@equinor/fusion-framework-react 8.0.0-next.0 → 8.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 +48 -12
- package/README.md +164 -31
- package/dist/esm/Framework.js +32 -0
- package/dist/esm/Framework.js.map +1 -1
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/app/useAppProvider.js +11 -2
- package/dist/esm/app/useAppProvider.js.map +1 -1
- package/dist/esm/app/useApps.js +17 -3
- package/dist/esm/app/useApps.js.map +1 -1
- package/dist/esm/app/useCurrentApp.js +25 -4
- package/dist/esm/app/useCurrentApp.js.map +1 -1
- package/dist/esm/app/useCurrentAppModule.js +13 -7
- package/dist/esm/app/useCurrentAppModule.js.map +1 -1
- package/dist/esm/app/useCurrentAppModules.js +14 -4
- package/dist/esm/app/useCurrentAppModules.js.map +1 -1
- package/dist/esm/context/index.js +10 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/useCurrentContext.js +16 -0
- package/dist/esm/context/useCurrentContext.js.map +1 -1
- package/dist/esm/context.js +9 -0
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/create-framework-provider.js +29 -8
- package/dist/esm/create-framework-provider.js.map +1 -1
- package/dist/esm/feature-flag/index.js +10 -0
- package/dist/esm/feature-flag/index.js.map +1 -1
- package/dist/esm/feature-flag/useCurrentAppFeatures.js +12 -2
- package/dist/esm/feature-flag/useCurrentAppFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +12 -5
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFeatures.js +14 -5
- package/dist/esm/feature-flag/useFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeature.js +12 -5
- package/dist/esm/feature-flag/useFrameworkFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeatures.js +11 -4
- package/dist/esm/feature-flag/useFrameworkFeatures.js.map +1 -1
- package/dist/esm/hooks/index.js +8 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/use-current-user.js +14 -0
- package/dist/esm/hooks/use-current-user.js.map +1 -1
- package/dist/esm/hooks/use-http-client.js +13 -0
- package/dist/esm/hooks/use-http-client.js.map +1 -1
- package/dist/esm/http/index.js +10 -0
- package/dist/esm/http/index.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useFramework.js +16 -4
- package/dist/esm/useFramework.js.map +1 -1
- package/dist/esm/useFrameworkModule.js +13 -6
- package/dist/esm/useFrameworkModule.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/Framework.d.ts +37 -0
- package/dist/types/app/index.d.ts +10 -0
- package/dist/types/app/useAppProvider.d.ts +11 -2
- package/dist/types/app/useApps.d.ts +17 -3
- package/dist/types/app/useCurrentApp.d.ts +25 -4
- package/dist/types/app/useCurrentAppModule.d.ts +13 -7
- package/dist/types/app/useCurrentAppModules.d.ts +14 -4
- package/dist/types/context/index.d.ts +10 -0
- package/dist/types/context/useCurrentContext.d.ts +16 -0
- package/dist/types/context.d.ts +0 -1
- package/dist/types/create-framework-provider.d.ts +29 -8
- package/dist/types/feature-flag/index.d.ts +10 -0
- package/dist/types/feature-flag/useCurrentAppFeatures.d.ts +12 -2
- package/dist/types/feature-flag/useFeature.d.ts +23 -6
- package/dist/types/feature-flag/useFeatures.d.ts +23 -6
- package/dist/types/feature-flag/useFrameworkFeature.d.ts +12 -5
- package/dist/types/feature-flag/useFrameworkFeatures.d.ts +11 -4
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/use-current-user.d.ts +14 -0
- package/dist/types/hooks/use-http-client.d.ts +15 -0
- package/dist/types/http/index.d.ts +10 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/useFramework.d.ts +16 -4
- package/dist/types/useFrameworkModule.d.ts +13 -6
- package/dist/types/version.d.ts +1 -1
- package/package.json +15 -14
- package/src/Framework.tsx +37 -0
- package/src/app/index.ts +10 -0
- package/src/app/useAppProvider.ts +11 -2
- package/src/app/useApps.ts +17 -3
- package/src/app/useCurrentApp.ts +25 -4
- package/src/app/useCurrentAppModule.ts +13 -7
- package/src/app/useCurrentAppModules.ts +14 -4
- package/src/context/index.ts +10 -0
- package/src/context/useCurrentContext.ts +16 -0
- package/src/context.ts +9 -0
- package/src/create-framework-provider.tsx +29 -8
- package/src/feature-flag/index.ts +10 -0
- package/src/feature-flag/useCurrentAppFeatures.ts +12 -2
- package/src/feature-flag/useFeature.ts +23 -6
- package/src/feature-flag/useFeatures.ts +23 -6
- package/src/feature-flag/useFrameworkFeature.ts +12 -5
- package/src/feature-flag/useFrameworkFeatures.ts +11 -4
- package/src/hooks/index.ts +8 -0
- package/src/hooks/use-current-user.ts +14 -0
- package/src/hooks/use-http-client.ts +16 -0
- package/src/http/index.ts +10 -0
- package/src/index.tsx +8 -0
- package/src/useFramework.ts +16 -4
- package/src/useFrameworkModule.ts +13 -6
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAKrC,EAAuF,EACvF,GAAU,EAC4E,EAAE,CACxF,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,YAAY,GAAG,IAAI,qBAAqB,EAAY,CAAC;IAC3D,MAAM,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE,CAAC,CACzD,KAAC,iBAAiB,IAAC,KAAK,EAAE,SAAS,YACjC,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAG,QAAQ,GAAkB,GACnD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature-flag React hooks.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Available via the `@equinor/fusion-framework-react/feature-flag` sub-entry-point.
|
|
6
|
+
* Provides hooks to read, toggle, and observe feature flags at the
|
|
7
|
+
* framework or application level.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
1
11
|
export { useFeature } from './useFeature';
|
|
2
12
|
export { useFeatures } from './useFeatures';
|
|
3
13
|
export { useCurrentAppFeatures } from './useCurrentAppFeatures';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-flag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-flag/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { useCurrentAppModule } from '../app';
|
|
2
2
|
import { useFeatures } from './useFeatures';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* React hook that returns feature flags registered on the current application.
|
|
5
|
+
*
|
|
6
|
+
* @returns A {@link UseFeaturesResult} containing:
|
|
7
|
+
* - `features` — Array of feature flags for the current app.
|
|
8
|
+
* - `toggleFeature(key, enable?)` — Toggles a feature flag on or off.
|
|
9
|
+
* - `error` — Any error from the feature-flag or app-module streams.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const { features, toggleFeature } = useCurrentAppFeatures();
|
|
14
|
+
* toggleFeature('dark-mode', true);
|
|
15
|
+
* ```
|
|
6
16
|
*/
|
|
7
17
|
export const useCurrentAppFeatures = () => {
|
|
8
18
|
const { module, error: moduleError } = useCurrentAppModule('featureFlag');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useCurrentAppFeatures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"useCurrentAppFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useCurrentAppFeatures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAsB,EAAE;IAC3D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,mBAAmB,CAAoB,aAAa,CAAC,CAAC;IAE7F,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAE/D,OAAO;QACL,QAAQ;QACR,aAAa;QACb,KAAK,EAAE,KAAK,IAAI,WAAW;KAC5B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,12 +3,19 @@ import { EMPTY } from 'rxjs';
|
|
|
3
3
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
4
4
|
import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selectors';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* React hook that retrieves and manages a single feature flag.
|
|
7
7
|
*
|
|
8
|
-
* @template T -
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @returns {UseFeatureResult
|
|
8
|
+
* @template T - Value type carried by the feature flag.
|
|
9
|
+
* @param provider - The feature-flag provider instance.
|
|
10
|
+
* @param key - Unique key identifying the feature flag.
|
|
11
|
+
* @returns A {@link UseFeatureResult} with the flag value, toggle helper,
|
|
12
|
+
* and any error.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const { feature, toggleFeature } = useFeature(provider, 'dark-mode');
|
|
17
|
+
* console.log(feature?.enabled);
|
|
18
|
+
* ```
|
|
12
19
|
*/
|
|
13
20
|
export const useFeature = (provider, key) => {
|
|
14
21
|
const feature$ = useMemo(() => provider.features$.pipe(findFeature(key)), [provider, key]);
|
|
@@ -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,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;
|
|
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,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAqBtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAA8B,EAC9B,GAAW,EACU,EAAE;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAI,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9F,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,MAAgB,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,EACD,CAAC,QAAQ,EAAE,GAAG,CAAC,CAChB,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -3,12 +3,21 @@ import { of } from 'rxjs';
|
|
|
3
3
|
import { map } from 'rxjs/operators';
|
|
4
4
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* React hook that returns all feature flags from a provider, with optional
|
|
7
|
+
* filtering.
|
|
7
8
|
*
|
|
8
|
-
* @param provider - The feature
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
9
|
+
* @param provider - The feature-flag provider instance, or `null`/`undefined`
|
|
10
|
+
* when not yet available.
|
|
11
|
+
* @param selector - Optional predicate to filter the feature flags.
|
|
12
|
+
* @returns A {@link UseFeaturesResult} with the flags, a toggle helper,
|
|
13
|
+
* and any error.
|
|
14
|
+
* @throws {Error} If `toggleFeature` is called when the provider is missing.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const { features, toggleFeature } = useFeatures(provider);
|
|
19
|
+
* toggleFeature('beta', true);
|
|
20
|
+
* ```
|
|
12
21
|
*/
|
|
13
22
|
export const useFeatures = (provider, selector) => {
|
|
14
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"useFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAoBtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAsC,EACtC,QAA4B,EACT,EAAE;IACrB;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,kBAAkB,CACnD,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,EAAE,SAAS,CAAC,IAAI,CAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACR,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACrD,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EACxB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,IAAI,EAAE,CAAC,EAAE,CACrD,CAAC;IACF;;;;;;OAMG;IACH,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,GAAW,EAAE,MAAgB,EAAE,EAAE;QAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAEnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { useFrameworkModule } from '../useFrameworkModule';
|
|
2
2
|
import { useFeature } from './useFeature';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* React hook that retrieves a single feature flag from the **framework-level**
|
|
5
|
+
* feature-flag provider.
|
|
5
6
|
*
|
|
6
|
-
* @template T -
|
|
7
|
-
* @param
|
|
8
|
-
* @returns {
|
|
9
|
-
*
|
|
7
|
+
* @template T - Value type carried by the feature flag.
|
|
8
|
+
* @param key - Unique key identifying the feature flag.
|
|
9
|
+
* @returns A {@link UseFeatureResult} with the flag value, toggle helper,
|
|
10
|
+
* and any error.
|
|
11
|
+
* @throws {Error} If the `FeatureFlagModule` is not enabled in the framework.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const { feature, toggleFeature } = useFrameworkFeature('experimental-ui');
|
|
16
|
+
* ```
|
|
10
17
|
*/
|
|
11
18
|
export const useFrameworkFeature = (key) => {
|
|
12
19
|
const provider = useFrameworkModule('featureFlag');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameworkFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"useFrameworkFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAI,GAAW,EAAoC,EAAE;IACtF,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { useFrameworkModule } from '../useFrameworkModule';
|
|
2
2
|
import { useFeatures } from './useFeatures';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
4
|
+
* React hook that returns all feature flags from the **framework-level**
|
|
5
|
+
* feature-flag provider.
|
|
6
|
+
*
|
|
7
|
+
* @returns A {@link UseFeaturesResult} containing all framework feature flags,
|
|
8
|
+
* a toggle helper, and any error.
|
|
9
|
+
* @throws {Error} If the `FeatureFlagModule` is not enabled in the framework.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const { features, toggleFeature } = useFrameworkFeatures();
|
|
14
|
+
* ```
|
|
8
15
|
*/
|
|
9
16
|
export const useFrameworkFeatures = () => {
|
|
10
17
|
const provider = useFrameworkModule('featureFlag');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameworkFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"useFrameworkFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmC,EAAE;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience hooks for common framework operations.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Available via the `@equinor/fusion-framework-react/hooks` sub-entry-point.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
export { useCurrentUser } from './use-current-user';
|
|
2
10
|
export { useHttpClient } from './use-http-client';
|
|
3
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { useFramework } from '../useFramework';
|
|
2
|
+
/**
|
|
3
|
+
* React hook that returns the currently authenticated user's account info.
|
|
4
|
+
*
|
|
5
|
+
* @returns The {@link AccountInfo} of the signed-in user, or `undefined` if
|
|
6
|
+
* no user is authenticated.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const UserGreeting = () => {
|
|
11
|
+
* const user = useCurrentUser();
|
|
12
|
+
* return <span>Hello, {user?.name ?? 'Guest'}</span>;
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
2
16
|
export const useCurrentUser = () => {
|
|
3
17
|
const framework = useFramework();
|
|
4
18
|
return framework.modules.auth.account || undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user.js","sourceRoot":"","sources":["../../../src/hooks/use-current-user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,GAA4B,EAAE;IAC1D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;AACrD,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"use-current-user.js","sourceRoot":"","sources":["../../../src/hooks/use-current-user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA4B,EAAE;IAC1D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useFramework } from '../useFramework';
|
|
3
|
+
/**
|
|
4
|
+
* React hook that returns a pre-configured HTTP client from the framework.
|
|
5
|
+
*
|
|
6
|
+
* @param name - Key of the HTTP client to retrieve (e.g. `'portal'` or `'people'`).
|
|
7
|
+
* @returns The resolved {@link HttpClient} instance.
|
|
8
|
+
* @throws {Error} If no client is configured for the given key.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const client = useHttpClient('portal');
|
|
13
|
+
* client.fetch('/api/data').subscribe(console.log);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
3
16
|
export const useHttpClient = (name) => {
|
|
4
17
|
const framework = useFramework();
|
|
5
18
|
const client = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-http-client.js","sourceRoot":"","sources":["../../../src/hooks/use-http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-http-client.js","sourceRoot":"","sources":["../../../src/hooks/use-http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAyB,EAAc,EAAE;IACrE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACtB,2BAA2B;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/esm/http/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP sub-entry-point (`@equinor/fusion-framework-react/http`).
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Re-exports the framework-level {@link useHttpClient} hook as
|
|
6
|
+
* `useFrameworkHttpClient` together with all exports from the
|
|
7
|
+
* standalone HTTP React module.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
1
11
|
export { useHttpClient as useFrameworkHttpClient } from '../hooks/use-http-client';
|
|
2
12
|
export * from '@equinor/fusion-framework-react-module-http';
|
|
3
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,cAAc,6CAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,cAAc,6CAA6C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* React bindings for the Fusion Framework.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This package provides React components, context providers, and hooks for
|
|
6
|
+
* initialising and consuming a Fusion Framework instance inside a React
|
|
7
|
+
* application tree. It is the main entry-point for portals and host
|
|
8
|
+
* applications that need to bootstrap the framework with React.
|
|
9
|
+
*
|
|
2
10
|
* [[include:framework-react/README.MD]]
|
|
3
11
|
* @module
|
|
4
12
|
*/
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/esm/useFramework.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { context } from './context';
|
|
3
3
|
/**
|
|
4
|
+
* React hook that returns the current Fusion Framework instance from context.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The hook first looks for a framework instance provided via
|
|
8
|
+
* {@link FrameworkProvider}. If none is found it falls back to the global
|
|
9
|
+
* `window.Fusion` object. A console warning / error is emitted when the
|
|
10
|
+
* framework cannot be resolved.
|
|
11
|
+
*
|
|
12
|
+
* @template TModules - Tuple of additional module types expected on the
|
|
13
|
+
* framework instance (used for type-narrowing only).
|
|
14
|
+
* @returns The active {@link Fusion} instance.
|
|
15
|
+
*
|
|
4
16
|
* @example
|
|
5
17
|
* ```ts
|
|
6
|
-
* const
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* }
|
|
18
|
+
* const useMyService = () => {
|
|
19
|
+
* const fusion = useFramework();
|
|
20
|
+
* return fusion.modules.http.createClient('my-service');
|
|
21
|
+
* };
|
|
10
22
|
* ```
|
|
11
23
|
*/
|
|
12
24
|
export const useFramework = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFramework.js","sourceRoot":"","sources":["../../src/useFramework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC
|
|
1
|
+
{"version":3,"file":"useFramework.js","sourceRoot":"","sources":["../../src/useFramework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACzF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACtD,CAAC;IACD,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { useFramework } from './useFramework';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* React hook that retrieves a module from the Fusion Framework by name.
|
|
4
4
|
*
|
|
5
|
-
* @template TType - The
|
|
6
|
-
* @template TKey - The
|
|
7
|
-
* @param name - The name of the module to retrieve.
|
|
8
|
-
* @returns The
|
|
9
|
-
*
|
|
5
|
+
* @template TType - The expected module type (used for type-narrowing).
|
|
6
|
+
* @template TKey - The module key string.
|
|
7
|
+
* @param name - The registered name of the module to retrieve.
|
|
8
|
+
* @returns The resolved module instance, or `undefined` if the module is
|
|
9
|
+
* not registered.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import type { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
14
|
+
*
|
|
15
|
+
* const http = useFrameworkModule<HttpModule>('http');
|
|
16
|
+
* ```
|
|
10
17
|
*/
|
|
11
18
|
export const useFrameworkModule = (name) => {
|
|
12
19
|
const framework = useFramework();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C
|
|
1
|
+
{"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAIhC,IAAU,EAGsE,EAAE;IAClF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,OAAO;IACP,6DAA6D;IAC7D,aAAa;IACb,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,6CAA6C,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,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,OAAO,CAAC"}
|