Skip to content

Commit d1b699f

Browse files
authored
Merge pull request #60 from oracle-samples/update-spa-samples
Update SPA samples
2 parents 0bd0fa8 + c884778 commit d1b699f

File tree

126 files changed

+2542
-1271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+2542
-1271
lines changed

spa-suiteapp-samples/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ These samples use the SPA SuiteApp project template that contains a TypeScript c
66

77
Each sample SuiteApp contains `ESLint` and `Prettier` configuration files, and you can configure them using the `inspect` and `lint` npm scripts available in each SuiteApp. Using both is highly recommended to ensure adherence to coding standards.
88

9-
## Availability
10-
The Single Page Application feature in NetSuite is available by request only. Currently, this feature can be enabled only for SDN partners with a publisher ID. This feature requires the use of SuiteCloud Development Framework (SDF) SuiteApp projects and SuiteScript 2.1. For information about the requirements to use this feature and how to request access, see [Single Page Applications](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_161244635803.html#Single-Page-Applications).
9+
The Single Page Application feature in NetSuite requires the use of SDF SuiteApp projects and SuiteScript 2.1. For more information, see [Single Page Applications](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_161244635803.html#Single-Page-Applications).
1110

1211
## Environment Setup
1312

spa-suiteapp-samples/airport360/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
!test/unit/**/*
1010
!test/e2e/__test__/**/*
1111
types/uif/**/*
12+
!test/integration/**/*
1213

1314

spa-suiteapp-samples/airport360/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ Testing is carried out using [Jest](https://jestjs.io/) for both unit and e2e (e
4747
You can run unit tests out of the box. Before you start with e2e tests, you need to configure some of the files in the `/test` folder first:
4848

4949
1. Ensure you have set up an account using `suitecloud account:setup` and have a valid authentication ID.
50-
2. Modify the `baseUrl` specified in `e2e/jest.config.json` to match the URL of your NetSuite account.
51-
3. Look for the `.suitecloud-sdk` folder located in your root folder by default.
52-
4. Copy the credentials from `.suitecloud-sdk/credentials` to `e2e/setup/credentials`. You can either copy the contents of the credentials file or simply replace the file.
53-
5. Check that the `COMPANY_ID` in `e2e/constants/credential.ts` is correct.
54-
6. Run `npm run test_e2e` for end-to-end tests and `npm run test_unit` for unit tests, or run `npm run test` for both.
50+
2. In `e2e/jest.config.json`, modify the `baseUrl` to match the URL of your NetSuite account.
51+
3. In `e2e/constants/credential.ts`, specify the `USERNAME`, `PASSWORD`, and `COMPANY_ID` that you use in the specified NetSuite account.
52+
4. Run `npm run test_e2e` for end-to-end tests and `npm run test_unit` for unit tests, or run `npm run test` for both.

spa-suiteapp-samples/airport360/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "1.0.0",
44
"description": "Hello World UIF SuiteApp - TS",
55
"devDependencies": {
6-
"@oracle/netsuite-uif-types": "^5.0.0",
7-
"@hitc/netsuite-types": "^2023.2.2",
6+
"@oracle/netsuite-uif-types": "^6.0.0",
7+
"@hitc/netsuite-types": "^2024.2.2",
88
"@typescript-eslint/eslint-plugin": "^5.50.0",
99
"@typescript-eslint/parser": "^5.50.0",
1010
"cross-env": "^7.0.3",
@@ -14,16 +14,17 @@
1414
"eslint-plugin-jasmine": "^4.1.0",
1515
"eslint-plugin-react": "^7.31.0",
1616
"fast-xml-parser": "^4.0.0",
17-
"jest": "^29.6.4",
18-
"jest-puppeteer": "^9.0.0",
1917
"prettier": "^2.8.1",
20-
"puppeteer": "^21.1.0",
21-
"ts-jest": "^29.1.1",
2218
"@rollup/plugin-terser": "^0.4.0",
2319
"gulp": "^4.0.0",
2420
"gulp-typescript": "^5.0.0",
2521
"rollup": "^3.26.0",
26-
"typescript": "^5.1.0"
22+
"typescript": "^5.1.0",
23+
"@types/jest": "^29.5.14",
24+
"jest": "^29.7.0",
25+
"jest-puppeteer": "^11.0.0",
26+
"puppeteer": "^24.2.1",
27+
"ts-jest": "^29.2.5"
2728
},
2829
"scripts": {
2930
"clean": "gulp clean",
Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {StackPanel, ScrollPanel} from '@uif-js/component';
1+
import {StackPanel, ScrollPanel, ThemeSelector} from '@uif-js/component';
22
import FlightList from './components/flights/FlightList';
33
import GateList from './components/gates/GateList';
4-
import {PureComponent, Store, Router} from '@uif-js/core';
4+
import {PureComponent, Store, Router, Theme} from '@uif-js/core';
55
import initialState from './app/InitialState';
66
import reducer from './app/Reducer';
77
import Menu from './components/Menu';
@@ -19,6 +19,7 @@ const scrollOptions = {
1919

2020
export default class Airport extends PureComponent {
2121
private store: Store;
22+
2223
constructor(props, context) {
2324
super(props, context);
2425
const state = initialState;
@@ -37,45 +38,47 @@ export default class Airport extends PureComponent {
3738
const {state} = this.state;
3839
const {flights, gates} = state;
3940
return (
40-
<Store.Provider store={this.store}>
41-
{/* Wrapper component that allows children component to use dispatch function to trigger store actions */}
42-
<Router.Hash>
43-
{/* Layout component that make the app ake the height and width of the browser window */}
44-
<StackPanel>
45-
{/* Basic two column layout */}
46-
<StackPanel.Item shrink={0}>
47-
<Menu />
48-
{/* Navigation component */}
49-
</StackPanel.Item>
50-
<StackPanel.Item grow={1}>
51-
<ScrollPanel {...scrollOptions}>
52-
{/* ScrollPanel that contains page content - enables scrolling just the content, not the rest of the app that is fixed */}
53-
<Router.Routes>
54-
<Router.Route path={Route.DASHBOARD} exact={true}>
55-
<Dashboard flights={flights} gates={gates} />
56-
</Router.Route>
57-
{/* Content loaded based on the current route */}
58-
<Router.Route path={Route.GATES} exact={true}>
59-
<GateList flights={flights} gates={gates} />
60-
</Router.Route>
61-
<Router.Route path={Route.GATE} exact={true}>
62-
<GateList flights={flights} gates={gates} />
63-
</Router.Route>
64-
<Router.Route path={Route.FLIGHTS} exact={true}>
65-
<FlightList flights={flights} gates={gates} />
66-
</Router.Route>
67-
<Router.Route path={Route.FLIGHT} exact={true}>
68-
<FlightPage flights={flights} gates={gates} />
69-
</Router.Route>
70-
<Router.Route path={Route.OTHERS}>
71-
<NotFoundPage />
72-
</Router.Route>
73-
</Router.Routes>
74-
</ScrollPanel>
75-
</StackPanel.Item>
76-
</StackPanel>
77-
</Router.Hash>
78-
</Store.Provider>
41+
<ThemeSelector supportedThemes={[Theme.Name.REDWOOD, Theme.Name.REFRESHED]}>
42+
<Store.Provider store={this.store}>
43+
{/* Wrapper component that allows children component to use dispatch function to trigger store actions */}
44+
<Router.Hash>
45+
{/* Layout component that make the app ake the height and width of the browser window */}
46+
<StackPanel>
47+
{/* Basic two column layout */}
48+
<StackPanel.Item shrink={0}>
49+
<Menu />
50+
{/* Navigation component */}
51+
</StackPanel.Item>
52+
<StackPanel.Item grow={1}>
53+
<ScrollPanel {...scrollOptions}>
54+
{/* ScrollPanel that contains page content - enables scrolling just the content, not the rest of the app that is fixed */}
55+
<Router.Routes>
56+
<Router.Route path={Route.DASHBOARD} exact={true}>
57+
<Dashboard flights={flights} gates={gates} />
58+
</Router.Route>
59+
{/* Content loaded based on the current route */}
60+
<Router.Route path={Route.GATES} exact={true}>
61+
<GateList flights={flights} gates={gates} />
62+
</Router.Route>
63+
<Router.Route path={Route.GATE} exact={true}>
64+
<GateList flights={flights} gates={gates} />
65+
</Router.Route>
66+
<Router.Route path={Route.FLIGHTS} exact={true}>
67+
<FlightList flights={flights} gates={gates} />
68+
</Router.Route>
69+
<Router.Route path={Route.FLIGHT} exact={true}>
70+
<FlightPage flights={flights} gates={gates} />
71+
</Router.Route>
72+
<Router.Route path={Route.OTHERS}>
73+
<NotFoundPage />
74+
</Router.Route>
75+
</Router.Routes>
76+
</ScrollPanel>
77+
</StackPanel.Item>
78+
</StackPanel>
79+
</Router.Hash>
80+
</Store.Provider>
81+
</ThemeSelector>
7982
);
8083
}
8184
}

spa-suiteapp-samples/airport360/src/SuiteApps/com.netsuite.airport360/airport/app/Action.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Enumeration of available actions
2-
import {flightInfo, gateInfo} from '../../../../../types/appTypes';
2+
import {FlightInfo, GateInfo} from '../../../../../types/appTypes';
33
import FlightService from '../services/FlightService';
44
import GateService from '../services/GateService';
55

@@ -24,7 +24,7 @@ const Action = {
2424
};
2525
},
2626
// Load gates
27-
gatesLoaded(gates: [gateInfo]) {
27+
gatesLoaded(gates: [GateInfo]) {
2828
return {
2929
type: ActionType.GATES_LOADED,
3030
gates,
@@ -38,14 +38,14 @@ const Action = {
3838
};
3939
},
4040
// Load flights
41-
flightsLoaded(flights: flightInfo) {
41+
flightsLoaded(flights: FlightInfo) {
4242
return {
4343
type: ActionType.FLIGHTS_LOADED,
4444
flights,
4545
};
4646
},
4747
// Set gate status to closed
48-
gateClosed(gate: gateInfo) {
48+
gateClosed(gate: GateInfo) {
4949
return {
5050
type: ActionType.GATE_CLOSED,
5151
gate,

spa-suiteapp-samples/airport360/src/SuiteApps/com.netsuite.airport360/airport/components/flights/FlightList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default class FlightList extends PureComponent {
4242
const {loading, data, missingGates} = flights;
4343
const listView = ListView.ofStaticData({
4444
dataProvider: () => data, // array of data objects
45-
//@ts-ignore
4645
layout: {
4746
[ListView.Layout.TABLE]: {
4847
columns: this.columns, // array of columns definition

0 commit comments

Comments
 (0)