@equinor/fusion-framework-react-app 9.0.8 → 10.0.0
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 +85 -14
- package/README.md +176 -99
- package/dist/esm/ag-grid/useTheme.js +7 -0
- package/dist/esm/ag-grid/useTheme.js.map +1 -1
- package/dist/esm/analytics/index.js +8 -0
- package/dist/esm/analytics/index.js.map +1 -1
- package/dist/esm/analytics/useTrackFeature.js +17 -1
- package/dist/esm/analytics/useTrackFeature.js.map +1 -1
- package/dist/esm/apploader/Apploader.js +1 -1
- package/dist/esm/apploader/Apploader.js.map +1 -1
- package/dist/esm/apploader/index.js +8 -0
- package/dist/esm/apploader/index.js.map +1 -1
- package/dist/esm/bookmark/index.js +8 -0
- package/dist/esm/bookmark/index.js.map +1 -1
- package/dist/esm/context/index.js +8 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/useContextProvider.js +6 -0
- package/dist/esm/context/useContextProvider.js.map +1 -1
- package/dist/esm/context/useCurrentContext.js +14 -0
- package/dist/esm/context/useCurrentContext.js.map +1 -1
- package/dist/esm/create-legacy-app.js +13 -0
- package/dist/esm/create-legacy-app.js.map +1 -1
- package/dist/esm/feature-flag/index.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +20 -4
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/framework/index.js +8 -1
- package/dist/esm/framework/index.js.map +1 -1
- package/dist/esm/framework/useFrameworkCurrentContext.js +9 -0
- package/dist/esm/framework/useFrameworkCurrentContext.js.map +1 -1
- package/dist/esm/help-center/useHelpCenter.js +12 -1
- package/dist/esm/help-center/useHelpCenter.js.map +1 -1
- package/dist/esm/http/index.js +9 -0
- package/dist/esm/http/index.js.map +1 -1
- package/dist/esm/http/selectors.js +10 -0
- package/dist/esm/http/selectors.js.map +1 -0
- package/dist/esm/index.js +16 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/make-component.js +1 -1
- package/dist/esm/make-component.js.map +1 -1
- package/dist/esm/msal/index.js +13 -0
- package/dist/esm/msal/index.js.map +1 -1
- package/dist/esm/msal/useAccessToken.js +15 -3
- package/dist/esm/msal/useAccessToken.js.map +1 -1
- package/dist/esm/msal/useCurrentAccount.js +12 -2
- package/dist/esm/msal/useCurrentAccount.js.map +1 -1
- package/dist/esm/msal/useToken.js +19 -3
- package/dist/esm/msal/useToken.js.map +1 -1
- package/dist/esm/navigation/index.js +8 -0
- package/dist/esm/navigation/index.js.map +1 -1
- package/dist/esm/navigation/useNavigationModule.js +6 -1
- package/dist/esm/navigation/useNavigationModule.js.map +1 -1
- package/dist/esm/navigation/useRouter.js +23 -4
- package/dist/esm/navigation/useRouter.js.map +1 -1
- package/dist/esm/render-app.js +22 -1
- package/dist/esm/render-app.js.map +1 -1
- package/dist/esm/render-component.js +30 -23
- package/dist/esm/render-component.js.map +1 -1
- package/dist/esm/settings/index.js +8 -0
- package/dist/esm/settings/index.js.map +1 -1
- package/dist/esm/useAppModule.js +13 -5
- package/dist/esm/useAppModule.js.map +1 -1
- package/dist/esm/useAppModules.js +9 -3
- package/dist/esm/useAppModules.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/useTheme.d.ts +7 -0
- package/dist/types/analytics/index.d.ts +8 -0
- package/dist/types/analytics/useTrackFeature.d.ts +17 -1
- package/dist/types/apploader/Apploader.d.ts +3 -2
- package/dist/types/apploader/index.d.ts +8 -0
- package/dist/types/bookmark/index.d.ts +8 -0
- package/dist/types/context/index.d.ts +8 -0
- package/dist/types/context/useContextProvider.d.ts +6 -0
- package/dist/types/context/useCurrentContext.d.ts +14 -0
- package/dist/types/create-legacy-app.d.ts +13 -0
- package/dist/types/feature-flag/index.d.ts +8 -0
- package/dist/types/feature-flag/useFeature.d.ts +20 -4
- package/dist/types/framework/index.d.ts +8 -0
- package/dist/types/framework/useFrameworkCurrentContext.d.ts +9 -0
- package/dist/types/help-center/useHelpCenter.d.ts +12 -1
- package/dist/types/http/index.d.ts +9 -0
- package/dist/types/http/selectors.d.ts +9 -0
- package/dist/types/index.d.ts +18 -1
- package/dist/types/make-component.d.ts +15 -0
- package/dist/types/msal/index.d.ts +13 -0
- package/dist/types/msal/useAccessToken.d.ts +15 -3
- package/dist/types/msal/useCurrentAccount.d.ts +12 -2
- package/dist/types/msal/useToken.d.ts +19 -3
- package/dist/types/navigation/index.d.ts +8 -0
- package/dist/types/navigation/useNavigationModule.d.ts +6 -1
- package/dist/types/navigation/useRouter.d.ts +23 -4
- package/dist/types/render-app.d.ts +22 -1
- package/dist/types/render-component.d.ts +16 -1
- package/dist/types/settings/index.d.ts +8 -0
- package/dist/types/useAppModule.d.ts +13 -5
- package/dist/types/useAppModules.d.ts +9 -3
- package/dist/types/version.d.ts +1 -1
- package/package.json +35 -27
- package/src/__tests__/render-app.test.tsx +113 -0
- package/src/ag-grid/useTheme.ts +7 -0
- package/src/analytics/index.ts +8 -0
- package/src/analytics/useTrackFeature.ts +17 -1
- package/src/apploader/Apploader.tsx +3 -3
- package/src/apploader/index.ts +8 -0
- package/src/bookmark/index.ts +8 -0
- package/src/context/index.ts +8 -0
- package/src/context/useContextProvider.ts +6 -0
- package/src/context/useCurrentContext.ts +14 -0
- package/src/create-legacy-app.tsx +13 -0
- package/src/feature-flag/index.ts +8 -0
- package/src/feature-flag/useFeature.ts +20 -4
- package/src/framework/index.ts +8 -1
- package/src/framework/useFrameworkCurrentContext.ts +9 -0
- package/src/help-center/useHelpCenter.ts +12 -1
- package/src/http/index.ts +9 -0
- package/src/http/selectors.ts +9 -0
- package/src/index.ts +20 -2
- package/src/make-component.tsx +16 -1
- package/src/msal/index.ts +13 -0
- package/src/msal/useAccessToken.ts +15 -3
- package/src/msal/useCurrentAccount.ts +12 -2
- package/src/msal/useToken.ts +19 -3
- package/src/navigation/index.ts +8 -0
- package/src/navigation/useNavigationModule.ts +6 -1
- package/src/navigation/useRouter.ts +23 -4
- package/src/render-app.ts +22 -1
- package/src/render-component.tsx +36 -27
- package/src/settings/index.ts +8 -0
- package/src/useAppModule.ts +13 -5
- package/src/useAppModules.ts +11 -5
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -1
- package/vitest.config.ts +15 -0
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { useAppModule } from '../useAppModule';
|
|
2
|
+
/**
|
|
3
|
+
* React hook that resolves the application-scoped context module provider.
|
|
4
|
+
*
|
|
5
|
+
* @returns The context module provider instance.
|
|
6
|
+
* @throws If the context module is not registered in the application scope.
|
|
7
|
+
*/
|
|
2
8
|
export const useContextProvider = () => useAppModule('context');
|
|
3
9
|
export default useContextProvider;
|
|
4
10
|
//# sourceMappingURL=useContextProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContextProvider.js","sourceRoot":"","sources":["../../../src/context/useContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAgB,SAAS,CAAC,CAAC;AAE/E,eAAe,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useContextProvider.js","sourceRoot":"","sources":["../../../src/context/useContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAgB,SAAS,CAAC,CAAC;AAE/E,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { useCurrentContext as _useCurrentContext } from '@equinor/fusion-framework-react-module-context';
|
|
2
2
|
import useContextProvider from './useContextProvider';
|
|
3
|
+
/**
|
|
4
|
+
* React hook that returns the currently selected Fusion context from the
|
|
5
|
+
* **application-scoped** context module.
|
|
6
|
+
*
|
|
7
|
+
* @returns The current context object, or `undefined` if no context is selected.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const context = useCurrentContext();
|
|
12
|
+
* if (context) {
|
|
13
|
+
* console.log('Selected:', context.title);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
3
17
|
export const useCurrentContext = () => _useCurrentContext(useContextProvider());
|
|
4
18
|
export default useCurrentContext;
|
|
5
19
|
//# sourceMappingURL=useCurrentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentContext.js","sourceRoot":"","sources":["../../../src/context/useCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAEhF,eAAe,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useCurrentContext.js","sourceRoot":"","sources":["../../../src/context/useCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAEhF,eAAe,iBAAiB,CAAC"}
|
|
@@ -2,6 +2,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Suspense, useMemo } from 'react';
|
|
3
3
|
import { useFramework } from '@equinor/fusion-framework-react';
|
|
4
4
|
import { createComponent } from './create-component';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a legacy wrapper component that bootstraps a Fusion React app within
|
|
7
|
+
* the older Fusion CLI hosting model.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Prefer {@link renderApp} for new applications. This helper exists
|
|
10
|
+
* only for backward-compatibility with apps that must run inside the legacy
|
|
11
|
+
* Fusion CLI.
|
|
12
|
+
*
|
|
13
|
+
* @template TModules - Array of additional module types to initialise.
|
|
14
|
+
* @param Component - The root React element to render.
|
|
15
|
+
* @param configure - Optional callback to configure application modules.
|
|
16
|
+
* @returns A React function component that initialises modules and renders the app.
|
|
17
|
+
*/
|
|
5
18
|
export const createLegacyApp = (Component, configure) => {
|
|
6
19
|
const LegacyComponent = () => {
|
|
7
20
|
const fusion = useFramework();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAoB,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAsB,EACtB,SAAwC,EACxC,EAAE;IACF,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,MAAM,MAAM,GAAG,YAAY,EAAe,CAAC;QAC3C,qFAAqF;QACrF,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACnC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACtD,YAAY;YACZ,oDAAoD;YACpD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;YACvC,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;gBACzB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;gBACjD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAuB,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAuB,CAAC,CAAC;QAClD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YACpC,KAAC,eAAe,KAAG,GACV,CACZ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAoB,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAsB,EACtB,SAAwC,EACxC,EAAE;IACF,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,MAAM,MAAM,GAAG,YAAY,EAAe,CAAC;QAC3C,qFAAqF;QACrF,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACnC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACtD,YAAY;YACZ,oDAAoD;YACpD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;YACvC,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;gBACzB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;gBACjD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAuB,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAuB,CAAC,CAAC;QAClD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YACpC,KAAC,eAAe,KAAG,GACV,CACZ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-flag/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-flag/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -5,10 +5,26 @@ import { useObservableState } from '@equinor/fusion-observable/react';
|
|
|
5
5
|
import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selectors';
|
|
6
6
|
import { useAppModule } from '../useAppModule';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* React hook for reading and toggling a single feature flag.
|
|
9
|
+
*
|
|
10
|
+
* Merges feature flags from both the framework and the application scope,
|
|
11
|
+
* so framework-level flags are visible alongside app-specific ones.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The type of the feature flag's value payload.
|
|
14
|
+
* @param key - The unique key identifying the feature flag.
|
|
15
|
+
* @returns An object with:
|
|
16
|
+
* - `feature` – the resolved {@link IFeatureFlag}, or `undefined` if not found.
|
|
17
|
+
* - `toggleFeature` – callback to toggle the flag; pass `true`/`false` to
|
|
18
|
+
* set explicitly, or omit to invert the current state.
|
|
19
|
+
* - `error` – any error from the feature-flag observable.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { feature, toggleFeature } = useFeature('dark-mode');
|
|
24
|
+
* return (
|
|
25
|
+
* <Switch checked={feature?.enabled} onChange={() => toggleFeature()} />
|
|
26
|
+
* );
|
|
27
|
+
* ```
|
|
12
28
|
*/
|
|
13
29
|
export const useFeature = (key) => {
|
|
14
30
|
const appProvider = useAppModule('featureFlag');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,GAAW,EAKX,EAAE;IACF,MAAM,WAAW,GAAG,YAAY,CAAoB,aAAa,CAAC,CAAC;IACnE,MAAM,iBAAiB,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IAE/E,sCAAsC;IACtC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,0DAA0D;QAC1D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,OAAO,WAAW,CAAC,SAAS,CAAC;QAC/B,CAAC;QACD,yDAAyD;QACzD,OAAO,aAAa,CAAC;YACnB,SAAS,EAAE,iBAAiB,CAAC,SAAS;YACtC,GAAG,EAAE,WAAW,CAAC,SAAS;SAC3B,CAAC,CAAC,IAAI,CACL,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE;YACzB,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,GAAG,EAAE,CAAC;QAClC,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAErC,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAI,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IAEtF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC;IAExE,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,MAAgB,EAAE,EAAE;QACnB,qDAAqD;QACrD,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACtF,WAAW,CAAC,aAAa,CAAC;YACxB,GAAG;YACH,OAAO;SACR,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,GAAG,CAAC,CACnB,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports framework-level hooks (as opposed to application-scoped ones)
|
|
5
|
+
* for accessing the Fusion instance, current user, and HTTP clients.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
1
9
|
export { useFramework } from '@equinor/fusion-framework-react';
|
|
2
|
-
// TODO
|
|
3
10
|
export { useCurrentUser, useHttpClient as useFrameworkHttpClient, } from '@equinor/fusion-framework-react/hooks';
|
|
4
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/framework/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EACL,cAAc,EACd,aAAa,IAAI,sBAAsB,GACxC,MAAM,uCAAuC,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { useFramework } from '@equinor/fusion-framework-react';
|
|
2
2
|
import { useCurrentContext } from '@equinor/fusion-framework-react-module-context';
|
|
3
|
+
/**
|
|
4
|
+
* React hook that returns the currently selected context from the
|
|
5
|
+
* **framework-level** context module (as opposed to the application-scoped one).
|
|
6
|
+
*
|
|
7
|
+
* Use this when you need the portal/host context rather than the app's own
|
|
8
|
+
* context provider.
|
|
9
|
+
*
|
|
10
|
+
* @returns The current framework context, or `undefined` if none is selected.
|
|
11
|
+
*/
|
|
3
12
|
export const useFrameworkCurrentContext = () => useCurrentContext(useFramework().modules.context);
|
|
4
13
|
export default useFrameworkCurrentContext;
|
|
5
14
|
//# sourceMappingURL=useFrameworkCurrentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameworkCurrentContext.js","sourceRoot":"","sources":["../../../src/framework/useFrameworkCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAElG,eAAe,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"useFrameworkCurrentContext.js","sourceRoot":"","sources":["../../../src/framework/useFrameworkCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAElG,eAAe,0BAA0B,CAAC"}
|
|
@@ -2,7 +2,18 @@ import { useCallback } from 'react';
|
|
|
2
2
|
import useAppModule from '../useAppModule';
|
|
3
3
|
export const EVENT_NAME = '@Portal::FusionHelp::open';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* React hook that returns an API for opening the portal help-center sidesheet.
|
|
6
|
+
*
|
|
7
|
+
* Each method dispatches a framework event that the portal shell listens for
|
|
8
|
+
* and opens the corresponding help page.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link HelpCenter} object with methods to open specific help pages.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const helpCenter = useHelpCenter();
|
|
15
|
+
* <Button onClick={() => helpCenter.openFaqs()}>FAQs</Button>
|
|
16
|
+
* ```
|
|
6
17
|
*/
|
|
7
18
|
export const useHelpCenter = () => {
|
|
8
19
|
const eventModule = useAppModule('event');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHelpCenter.js","sourceRoot":"","sources":["../../../src/help-center/useHelpCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAoC3C,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAyCtD
|
|
1
|
+
{"version":3,"file":"useHelpCenter.js","sourceRoot":"","sources":["../../../src/help-center/useHelpCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAoC3C,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAyCtD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAe,EAAE;IAC5C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAS,EAAE;QACtC,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,SAAiB,EAAQ,EAAE;QAC1B,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,SAAS,EAAE,SAAS;aACrB;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAS,EAAE;QACtC,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,UAAU,GAAG,WAAW,CAC5B,CAAC,MAAc,EAAQ,EAAE;QACvB,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,MAAM;aACf;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAS,EAAE;QAC5C,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,YAAY;aACnB;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAS,EAAE;QAC9C,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,eAAe;aACtB;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,QAAQ;QACR,WAAW;QACX,QAAQ;QACR,UAAU;QACV,cAAc;QACd,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/esm/http/index.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports hooks from `@equinor/fusion-framework-react-module-http`,
|
|
5
|
+
* including {@link useHttpClient} for making authenticated HTTP requests
|
|
6
|
+
* from within a Fusion application.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
export * from '@equinor/fusion-framework-react-module-http';
|
|
2
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP selector utilities.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports response-selector helpers (e.g. JSON, blob, text selectors)
|
|
5
|
+
* from `@equinor/fusion-framework-module-http/selectors`.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from '@equinor/fusion-framework-module-http/selectors';
|
|
10
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/http/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,iDAAiD,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* React bindings for building Fusion Framework applications.
|
|
5
|
+
*
|
|
6
|
+
* Provides the main entry-point helpers (`renderApp`, `createComponent`, `makeComponent`)
|
|
7
|
+
* plus React hooks for accessing framework modules (HTTP, auth, context, navigation, etc.)
|
|
8
|
+
* from within a Fusion app.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This is the primary package application developers depend on when building
|
|
12
|
+
* React-based Fusion apps. It re-exports core types from `@equinor/fusion-framework-app`
|
|
13
|
+
* and adds React-specific rendering, hooks, and sub-path entry-points for optional
|
|
14
|
+
* modules such as MSAL, feature flags, bookmarks, analytics, and settings.
|
|
15
|
+
*/
|
|
1
16
|
export { useAppModule } from './useAppModule';
|
|
2
17
|
export { useAppModules } from './useAppModules';
|
|
3
18
|
export { useAppEnvironmentVariables } from './useAppEnvironmentVariables';
|
|
4
19
|
export { makeComponent } from './make-component';
|
|
5
20
|
export { createLegacyApp } from './create-legacy-app';
|
|
6
|
-
// TODO deprecate
|
|
7
|
-
export { renderApp } from './render-app';
|
|
8
21
|
export { createComponent } from './create-component';
|
|
22
|
+
export { renderApp } from './render-app';
|
|
9
23
|
export { renderComponent } from './render-component';
|
|
10
24
|
export { default } from './render-app';
|
|
11
25
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -26,7 +26,7 @@ import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-r
|
|
|
26
26
|
*/
|
|
27
27
|
export const makeComponent = (Component, args, configure) => lazy(async () => {
|
|
28
28
|
const init = configureModules(configure);
|
|
29
|
-
const modules =
|
|
29
|
+
const modules = await init(args);
|
|
30
30
|
const { fusion } = args;
|
|
31
31
|
modules.event.dispatchEvent('onReactAppLoaded', {
|
|
32
32
|
detail: { modules, fusion, env: args.env },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AA2B7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAK3B,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACJ,EAAE,CAClD,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC9C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC9B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAAG,SAAS,GAAqB,GAChD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAaL,eAAe,aAAa,CAAC"}
|
package/dist/esm/msal/index.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MSAL authentication sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* Provides React hooks for accessing MSAL-based authentication state
|
|
5
|
+
* (current account, access tokens) from within a Fusion application.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Requires `@equinor/fusion-framework-module-msal` to be installed and
|
|
9
|
+
* configured by the host/portal. Applications should **not** configure the
|
|
10
|
+
* MSAL module themselves.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
1
14
|
export { useCurrentAccount } from './useCurrentAccount';
|
|
2
15
|
export { useAccessToken } from './useAccessToken';
|
|
3
16
|
export { useToken } from './useToken';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/msal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/msal/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { useToken } from './useToken';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* React hook that acquires an OAuth 2.0 access token string via MSAL.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
5
|
+
* This is a convenience wrapper around {@link useToken} that extracts the
|
|
6
|
+
* `accessToken` property from the full `AuthenticationResult`.
|
|
7
|
+
*
|
|
8
|
+
* @param req - The token request containing the `scopes` to acquire.
|
|
9
|
+
* @param req.scopes - Array of scope strings (e.g. `['User.Read']`).
|
|
10
|
+
* @returns An object with:
|
|
11
|
+
* - `token` – the access token string, or `undefined` while pending.
|
|
12
|
+
* - `pending` – `true` while the token is being acquired.
|
|
13
|
+
* - `error` – any error encountered during acquisition.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const { token, pending, error } = useAccessToken({ scopes: ['api://my-api/.default'] });
|
|
18
|
+
* ```
|
|
7
19
|
*/
|
|
8
20
|
export const useAccessToken = (req) => {
|
|
9
21
|
const { token, error, pending } = useToken(req);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccessToken.js","sourceRoot":"","sources":["../../../src/msal/useAccessToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"useAccessToken.js","sourceRoot":"","sources":["../../../src/msal/useAccessToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAE9B,EAAwD,EAAE;IACzD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import useAppModule from '../useAppModule';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* React hook that returns the currently signed-in user's MSAL account info.
|
|
4
|
+
*
|
|
5
|
+
* @returns The {@link AccountInfo} for the active account, or `undefined` if
|
|
6
|
+
* no user is signed in.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const account = useCurrentAccount();
|
|
11
|
+
* if (account) {
|
|
12
|
+
* console.log('Signed in as', account.name);
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
5
15
|
*/
|
|
6
16
|
export const useCurrentAccount = () => {
|
|
7
17
|
const msalProvider = useAppModule('auth');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAA4B,EAAE;IAC7D,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC,OAAO,IAAI,SAAS,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import useAppModule from '../useAppModule';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* React hook that acquires a full MSAL {@link AuthenticationResult} for the
|
|
5
|
+
* requested scopes.
|
|
6
|
+
*
|
|
7
|
+
* The hook attempts silent acquisition first and falls back to an interactive
|
|
8
|
+
* prompt when required by the MSAL provider.
|
|
9
|
+
*
|
|
10
|
+
* @param req - The token request containing the `scopes` to acquire.
|
|
11
|
+
* @param req.scopes - Array of scope strings (e.g. `['User.Read']`).
|
|
12
|
+
* @returns An object with:
|
|
13
|
+
* - `token` – the full {@link AuthenticationResult}, or `undefined` while pending.
|
|
14
|
+
* - `pending` – `true` while the token is being acquired.
|
|
15
|
+
* - `error` – any error encountered during acquisition.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { token, pending } = useToken({ scopes: ['User.Read'] });
|
|
20
|
+
* if (pending) return <Spinner />;
|
|
21
|
+
* console.log('ID token:', token?.idToken);
|
|
22
|
+
* ```
|
|
7
23
|
*/
|
|
8
24
|
export const useToken = (req) => {
|
|
9
25
|
const msalProvider = useAppModule('auth');
|
|
@@ -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;AAI5C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C,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;IAClD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,YAAY;aACT,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;aAC9B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,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,GAAG,CAAC,CAAC,CAAC;IACxB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* Provides hooks for accessing the Fusion navigation module and creating
|
|
5
|
+
* client-side routers compatible with `react-router`.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
1
9
|
export { useNavigationModule } from './useNavigationModule';
|
|
2
10
|
export { useRouter } from './useRouter';
|
|
3
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/navigation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import useAppModule from '../useAppModule';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* React hook that resolves the application-scoped navigation module provider.
|
|
4
|
+
*
|
|
5
|
+
* @returns The navigation provider instance.
|
|
6
|
+
* @throws If the navigation module has not been enabled for the application.
|
|
7
|
+
*/
|
|
3
8
|
export const useNavigationModule = () => useAppModule('navigation');
|
|
4
9
|
//# sourceMappingURL=useNavigationModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigationModule.js","sourceRoot":"","sources":["../../../src/navigation/useNavigationModule.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAG3C
|
|
1
|
+
{"version":3,"file":"useNavigationModule.js","sourceRoot":"","sources":["../../../src/navigation/useNavigationModule.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAwB,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useNavigationModule } from './useNavigationModule';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* React hook that creates a router instance for client-side navigation.
|
|
5
|
+
*
|
|
6
|
+
* The `routes` argument **must** be static or memoised to avoid re-creating
|
|
7
|
+
* the router on every render.
|
|
8
|
+
*
|
|
9
|
+
* @param routes - An array of route objects compatible with
|
|
10
|
+
* `INavigationProvider.createRouter`.
|
|
11
|
+
* @returns A router instance to pass to `<RouterProvider>`.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://equinor.github.io/fusion-framework/modules/navigation/ | Fusion navigation docs}
|
|
14
|
+
* @see {@link https://reactrouter.com/en/main/routers/create-browser-router | react-router docs}
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { useRouter } from '@equinor/fusion-framework-react-app/navigation';
|
|
19
|
+
* import { RouterProvider } from 'react-router-dom';
|
|
20
|
+
*
|
|
21
|
+
* const routes = [{ path: '/', element: <Home /> }];
|
|
22
|
+
* const App = () => {
|
|
23
|
+
* const router = useRouter(routes);
|
|
24
|
+
* return <RouterProvider router={router} />;
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
8
27
|
*/
|
|
9
28
|
export const useRouter = (routes) => {
|
|
10
29
|
const provider = useNavigationModule();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/navigation/useRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D
|
|
1
|
+
{"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/navigation/useRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAA0D,EACT,EAAE;IACnD,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC"}
|
package/dist/esm/render-app.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { createComponent } from './create-component';
|
|
2
2
|
import { renderComponent } from './render-component';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Creates a render function for a Fusion React application.
|
|
5
|
+
*
|
|
6
|
+
* Wraps {@link createComponent} and {@link renderComponent} into a single factory:
|
|
7
|
+
* call the returned function with an `HTMLElement` and `ComponentRenderArgs` to
|
|
8
|
+
* mount the app using React 18's `createRoot` API.
|
|
9
|
+
*
|
|
10
|
+
* @param componentArgs - Arguments forwarded to {@link createComponent} (the React
|
|
11
|
+
* component to render and an optional module-configuration callback).
|
|
12
|
+
* @returns A mount function that accepts a DOM element and render args, and returns
|
|
13
|
+
* a {@link RenderTeardown} callback to unmount the application.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { renderApp } from '@equinor/fusion-framework-react-app';
|
|
18
|
+
* import { App } from './App';
|
|
19
|
+
* import { configure } from './config';
|
|
20
|
+
*
|
|
21
|
+
* export const render = renderApp(App, configure);
|
|
22
|
+
* export default render;
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export const renderApp = (...componentArgs) => {
|
|
5
26
|
const renderer = renderComponent(createComponent(...componentArgs));
|
|
6
27
|
return (el, args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAuB,MAAM,oBAAoB,CAAC;AAI1E
|
|
1
|
+
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAuB,MAAM,oBAAoB,CAAC;AAI1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,aAAiD,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, StrictMode } from 'react';
|
|
3
|
-
import
|
|
4
|
-
/**
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a React component into a DOM element using React 18's `createRoot` API.
|
|
6
|
+
*
|
|
7
|
+
* The component is wrapped in `<StrictMode>` and `<Suspense>` with a basic
|
|
8
|
+
* loading fallback.
|
|
9
|
+
*
|
|
10
|
+
* @param el - The DOM element to render into.
|
|
11
|
+
* @param Component - The React function component to render.
|
|
12
|
+
* @returns A {@link RenderTeardown} callback that unmounts the component.
|
|
13
|
+
*/
|
|
14
|
+
const render = (el, Component) => {
|
|
15
|
+
const root = createRoot(el);
|
|
16
|
+
root.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }));
|
|
17
|
+
return () => {
|
|
18
|
+
root.unmount();
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Creates a mount function from a {@link ComponentRenderer}.
|
|
23
|
+
*
|
|
24
|
+
* The returned function accepts a target `HTMLElement` and
|
|
25
|
+
* {@link ComponentRenderArgs}, resolves the lazy component via the renderer,
|
|
26
|
+
* and mounts it with React 18's `createRoot`.
|
|
27
|
+
*
|
|
28
|
+
* @param renderer - A {@link ComponentRenderer} that produces a lazy component
|
|
29
|
+
* from Fusion and environment arguments.
|
|
30
|
+
* @returns A function `(el, args) => RenderTeardown` that mounts the app and
|
|
31
|
+
* returns a teardown callback.
|
|
32
|
+
*/
|
|
5
33
|
export const renderComponent = (renderer) => {
|
|
6
34
|
return (el, args) => {
|
|
7
35
|
const Component = renderer(args.fusion, args.env);
|
|
8
36
|
return render(el, Component);
|
|
9
37
|
};
|
|
10
38
|
};
|
|
11
|
-
const render = (el, Component) => {
|
|
12
|
-
// eslint-disable-next-line react/no-deprecated
|
|
13
|
-
ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
|
|
14
|
-
return () => {
|
|
15
|
-
// eslint-disable-next-line react/no-deprecated
|
|
16
|
-
ReactDOM.unmountComponentAtNode(el);
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
// const render = (el: Element, Component: FunctionComponent): RenderTeardown => {
|
|
20
|
-
// const root = createRoot(el);
|
|
21
|
-
// root.render(
|
|
22
|
-
// <StrictMode>
|
|
23
|
-
// <Suspense fallback={<p>loading app</p>}>
|
|
24
|
-
// <Component />
|
|
25
|
-
// </Suspense>
|
|
26
|
-
// </StrictMode>
|
|
27
|
-
// );
|
|
28
|
-
// return () => {
|
|
29
|
-
// root.unmount();
|
|
30
|
-
// };
|
|
31
|
-
// };
|
|
32
39
|
export default renderComponent;
|
|
33
40
|
//# sourceMappingURL=render-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AASzD;;;;;;;;;GASG;AACH,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IAC3E,MAAM,IAAI,GAAS,UAAU,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CACT,KAAC,UAAU,cACT,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YACpC,KAAC,SAAS,KAAG,GACJ,GACA,CACd,CAAC;IACF,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA2B,EAAE,EAAE;IAC7D,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings sub-path entry-point.
|
|
3
|
+
*
|
|
4
|
+
* Provides hooks for reading and updating per-application user settings
|
|
5
|
+
* that are persisted by the Fusion platform.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
1
9
|
export { useAppSetting } from './useAppSetting';
|
|
2
10
|
export { useAppSettings } from './useAppSettings';
|
|
3
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/settings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|