@equinor/fusion-framework-react-app 14.0.2 → 14.0.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +9 -2
- package/dist/esm/ag-grid/community.js +12 -0
- package/dist/esm/ag-grid/community.js.map +1 -0
- package/dist/esm/ag-grid/enterprise.js +12 -0
- package/dist/esm/ag-grid/enterprise.js.map +1 -0
- package/dist/esm/ag-grid/react.js +12 -0
- package/dist/esm/ag-grid/react.js.map +1 -0
- package/dist/esm/ag-grid/testing.js +19 -0
- package/dist/esm/ag-grid/testing.js.map +1 -0
- package/dist/esm/ag-grid/theme.js +13 -0
- package/dist/esm/ag-grid/theme.js.map +1 -0
- package/dist/esm/create-component.js +1 -1
- package/dist/esm/msal/useToken.js +12 -3
- package/dist/esm/msal/useToken.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ag-grid/community.d.ts +11 -0
- package/dist/types/ag-grid/enterprise.d.ts +11 -0
- package/dist/types/ag-grid/react.d.ts +11 -0
- package/dist/types/ag-grid/testing.d.ts +18 -0
- package/dist/types/ag-grid/theme.d.ts +13 -0
- package/dist/types/create-component.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/bookmark.md +7 -0
- package/docs/context.md +3 -1
- package/docs/framework.md +2 -2
- package/docs/msal.md +3 -3
- package/package.json +77 -25
- package/src/__tests__/Apploader.test.tsx +51 -0
- package/src/__tests__/fixtures/apploader-child-script.ts +9 -0
- package/src/__tests__/testApp.test.tsx +76 -0
- package/src/__tests__/useAccessToken.test.tsx +51 -0
- package/src/__tests__/useAppSetting.test.tsx +133 -0
- package/src/__tests__/useAppSettings.test.tsx +147 -0
- package/src/__tests__/useCurrentAccount.test.tsx +32 -0
- package/src/__tests__/useCurrentBookmark.test.tsx +108 -0
- package/src/__tests__/useCurrentContext.test.tsx +72 -0
- package/src/__tests__/useFeature.test.tsx +104 -0
- package/src/__tests__/useHelpCenter.test.tsx +64 -0
- package/src/__tests__/useStateSyncEvents.test.ts +12 -11
- package/src/__tests__/useToken.test.tsx +71 -0
- package/src/__tests__/useTrackFeature.test.tsx +83 -0
- package/src/ag-grid/community.ts +11 -0
- package/src/ag-grid/enterprise.ts +11 -0
- package/src/ag-grid/react.ts +11 -0
- package/src/ag-grid/testing.ts +19 -0
- package/src/ag-grid/theme.ts +17 -0
- package/src/create-component.tsx +1 -1
- package/src/msal/useToken.ts +14 -3
- package/src/version.ts +1 -1
- package/tsconfig.json +6 -0
- package/vitest.config.ts +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 14.0.3-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @equinor/fusion-framework-app@13.0.3-next.1
|
|
8
|
+
- @equinor/fusion-framework@8.1.0-next.2
|
|
9
|
+
|
|
10
|
+
## 14.0.3-next.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- c8008e3: Internal: rebase `next` onto `main`, syncing in already-published stable releases so they carry a `next` pre-release tag.
|
|
15
|
+
- Updated dependencies [c8008e3]
|
|
16
|
+
- @equinor/fusion-framework-app@13.0.3-next.0
|
|
17
|
+
- @equinor/fusion-framework-module-ag-grid@37.0.3-next.0
|
|
18
|
+
- @equinor/fusion-framework-module-app@8.0.6-next.0
|
|
19
|
+
- @equinor/fusion-framework-module-navigation@7.0.9-next.0
|
|
20
|
+
- @equinor/fusion-framework-module-state@2.0.2-next.0
|
|
21
|
+
- @equinor/fusion-framework-react-ag-grid@37.0.3-next.0
|
|
22
|
+
- @equinor/fusion-framework-react@9.0.0-next.0
|
|
23
|
+
|
|
3
24
|
## 14.0.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ pnpm add @equinor/fusion-framework-react-app
|
|
|
25
25
|
import type { AppModuleInitiator } from '@equinor/fusion-framework-react-app';
|
|
26
26
|
|
|
27
27
|
export const configure: AppModuleInitiator = (configurator) => {
|
|
28
|
-
configurator.
|
|
28
|
+
configurator.configureHttpClient('my-api', {
|
|
29
29
|
baseUri: 'https://api.example.com',
|
|
30
30
|
defaultScopes: ['api://my-api/.default'],
|
|
31
31
|
});
|
|
@@ -372,6 +372,13 @@ const EnvInfo = () => {
|
|
|
372
372
|
};
|
|
373
373
|
```
|
|
374
374
|
|
|
375
|
+
### Testing
|
|
376
|
+
|
|
377
|
+
Testing utilities (`renderAppHook`, `renderAppComponent`, `testApp`, and a Vitest plugin
|
|
378
|
+
resolving an app's own manifest/config as virtual modules) have moved to their own package,
|
|
379
|
+
[`@equinor/fusion-framework-vitest-plugin-react-app`](../../vitest-plugin/react-app/README.md) —
|
|
380
|
+
see that package's README for usage.
|
|
381
|
+
|
|
375
382
|
## API Reference
|
|
376
383
|
|
|
377
384
|
### Core exports (main entry-point)
|
|
@@ -412,7 +419,7 @@ Application configuration is done via a callback passed to `renderApp` (or `make
|
|
|
412
419
|
```ts
|
|
413
420
|
const configure: AppModuleInitiator = (configurator) => {
|
|
414
421
|
// HTTP clients
|
|
415
|
-
configurator.
|
|
422
|
+
configurator.configureHttpClient('my-api', { baseUri: '...' });
|
|
416
423
|
|
|
417
424
|
// Feature flags
|
|
418
425
|
enableFeatureFlag(configurator, [{ key: 'beta', title: 'Beta' }]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AG Grid community-tier sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports every public symbol from
|
|
6
|
+
* `@equinor/fusion-framework-react-ag-grid/community` so the application
|
|
7
|
+
* resolves a single shared copy of `ag-grid-community`.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export * from '@equinor/fusion-framework-react-ag-grid/community';
|
|
12
|
+
//# sourceMappingURL=community.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.js","sourceRoot":"","sources":["../../../src/ag-grid/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AG Grid enterprise-tier sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports every public symbol from
|
|
6
|
+
* `@equinor/fusion-framework-react-ag-grid/enterprise` so the application
|
|
7
|
+
* resolves a single shared copy of `ag-grid-enterprise`.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export * from '@equinor/fusion-framework-react-ag-grid/enterprise';
|
|
12
|
+
//# sourceMappingURL=enterprise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enterprise.js","sourceRoot":"","sources":["../../../src/ag-grid/enterprise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,oDAAoD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AG Grid React component sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports the AG Grid React bindings from
|
|
6
|
+
* `@equinor/fusion-framework-react-ag-grid/react`, including the
|
|
7
|
+
* `AgGridReact` component, `enableAgGrid`, and their associated types.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export * from '@equinor/fusion-framework-react-ag-grid/react';
|
|
12
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/ag-grid/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AG Grid test helpers sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports the AG Grid test helpers from
|
|
6
|
+
* `@equinor/fusion-framework-module-ag-grid/testing`. Import from test setup
|
|
7
|
+
* files only — these helpers patch global state and are not meant for
|
|
8
|
+
* application runtime code.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Silences AG Grid Enterprise's unlicensed "License Key Not Found" banner on
|
|
14
|
+
* `console.error` so it doesn't bury real failures in test output.
|
|
15
|
+
*
|
|
16
|
+
* @returns A function that restores the original `console.error`.
|
|
17
|
+
*/
|
|
18
|
+
export { suppressAgGridLicenseBanner } from '@equinor/fusion-framework-module-ag-grid/testing';
|
|
19
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/ag-grid/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AG Grid theme sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports the Fusion AG Grid theme utilities from
|
|
6
|
+
* `@equinor/fusion-framework-module-ag-grid/themes`, together with the
|
|
7
|
+
* application-scoped {@link useTheme} hook.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export { fusionTheme, createThemeFromTheme, createTheme, } from '@equinor/fusion-framework-module-ag-grid/themes';
|
|
12
|
+
export { useTheme } from './useTheme';
|
|
13
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/ag-grid/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,WAAW,GACZ,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -21,7 +21,7 @@ import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-r
|
|
|
21
21
|
* @example
|
|
22
22
|
* ```tsx
|
|
23
23
|
* const configCallback: AppConfigurator = (configurator) => {
|
|
24
|
-
* configurator.
|
|
24
|
+
* configurator.configureHttpClient(
|
|
25
25
|
* 'bar', {
|
|
26
26
|
* baseUri: 'https://somewhere-test.com',
|
|
27
27
|
* defaultScopes: ['foo/.default']
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import useAppModule from '../useAppModule';
|
|
3
3
|
/**
|
|
4
4
|
* React hook that acquires a full MSAL {@link AuthenticationResult} for the
|
|
@@ -26,11 +26,20 @@ export const useToken = (req) => {
|
|
|
26
26
|
const [token, setToken] = useState(undefined);
|
|
27
27
|
const [pending, setPending] = useState(false);
|
|
28
28
|
const [error, setError] = useState(null);
|
|
29
|
+
// `req` is typically a fresh object literal each render; key the effect on its
|
|
30
|
+
// scopes' content instead of identity, so it doesn't re-run (and reset `pending`
|
|
31
|
+
// to `true` forever) every time the caller re-renders. `JSON.stringify` (rather than
|
|
32
|
+
// `.join(',')`) keeps scopes with different array boundaries (e.g. `['a,b']` vs.
|
|
33
|
+
// `['a', 'b']`) from colliding on the same key.
|
|
34
|
+
const scopesKey = JSON.stringify(req.scopes);
|
|
35
|
+
const reqRef = useRef(req);
|
|
36
|
+
reqRef.current = req;
|
|
37
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: scopesKey is a re-run trigger, not read in the body
|
|
29
38
|
useEffect(() => {
|
|
30
39
|
setPending(true);
|
|
31
40
|
setToken(undefined);
|
|
32
41
|
msalProvider
|
|
33
|
-
.acquireToken({ request:
|
|
42
|
+
.acquireToken({ request: reqRef.current })
|
|
34
43
|
.then((result) => {
|
|
35
44
|
// Only update state when a token was actually acquired
|
|
36
45
|
if (result) {
|
|
@@ -39,7 +48,7 @@ export const useToken = (req) => {
|
|
|
39
48
|
})
|
|
40
49
|
.catch(setError)
|
|
41
50
|
.finally(() => setPending(false));
|
|
42
|
-
}, [msalProvider,
|
|
51
|
+
}, [msalProvider, scopesKey]);
|
|
43
52
|
return { token, pending, error };
|
|
44
53
|
};
|
|
45
54
|
export default useToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIpD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAExB,EAAsE,EAAE;IACvE,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmC,SAAS,CAAC,CAAC;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAElD,+EAA+E;IAC/E,iFAAiF;IACjF,qFAAqF;IACrF,iFAAiF;IACjF,gDAAgD;IAChD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;IAErB,+GAA+G;IAC/G,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,YAAY;aACT,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;aACzC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,uDAAuD;YACvD,IAAI,MAAM,EAAE,CAAC;gBACX,QAAQ,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,QAAQ,CAAC;aACf,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAC9B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC"}
|