@equinor/fusion-framework-react 8.0.0 → 9.0.0-next.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 -0
- package/dist/esm/app/useAppProvider.js +1 -0
- package/dist/esm/app/useAppProvider.js.map +1 -1
- package/dist/esm/app/useCurrentApp.js +1 -0
- package/dist/esm/app/useCurrentApp.js.map +1 -1
- package/dist/esm/app/useCurrentAppModule.js +13 -6
- package/dist/esm/app/useCurrentAppModule.js.map +1 -1
- package/dist/esm/context.js +1 -20
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/create-framework-provider.js +1 -1
- package/dist/esm/create-framework-provider.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +4 -1
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFeatures.js +10 -1
- package/dist/esm/feature-flag/useFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeature.js +1 -0
- package/dist/esm/feature-flag/useFrameworkFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeatures.js +1 -0
- package/dist/esm/feature-flag/useFrameworkFeatures.js.map +1 -1
- package/dist/esm/framework-provider.js +21 -0
- package/dist/esm/framework-provider.js.map +1 -0
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/{use-current-user.js → useCurrentUser.js} +1 -1
- package/dist/esm/hooks/useCurrentUser.js.map +1 -0
- package/dist/esm/hooks/{use-http-client.js → useHttpClient.js} +3 -2
- package/dist/esm/hooks/useHttpClient.js.map +1 -0
- package/dist/esm/http/index.js +1 -1
- package/dist/esm/http/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/signalr/index.js +1 -31
- package/dist/esm/signalr/index.js.map +1 -1
- package/dist/esm/signalr/useSignalR.js +33 -0
- package/dist/esm/signalr/useSignalR.js.map +1 -0
- package/dist/esm/useFramework.js +2 -0
- package/dist/esm/useFramework.js.map +1 -1
- package/dist/esm/useFrameworkModule.js +4 -3
- 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 +1 -1
- package/dist/types/app/useAppProvider.d.ts +1 -1
- package/dist/types/context.d.ts +1 -20
- package/dist/types/framework-provider.d.ts +19 -0
- package/dist/types/hooks/index.d.ts +2 -2
- package/dist/types/http/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signalr/index.d.ts +1 -24
- package/dist/types/signalr/useSignalR.d.ts +24 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +15 -15
- package/src/app/useAppProvider.ts +1 -0
- package/src/app/useCurrentApp.ts +1 -0
- package/src/app/useCurrentAppModule.ts +13 -7
- package/src/context.ts +1 -21
- package/src/create-framework-provider.tsx +2 -2
- package/src/feature-flag/useFeature.ts +8 -1
- package/src/feature-flag/useFeatures.ts +10 -1
- package/src/feature-flag/useFrameworkFeature.ts +1 -0
- package/src/feature-flag/useFrameworkFeatures.ts +1 -0
- package/src/framework-provider.ts +21 -0
- package/src/hooks/index.ts +2 -2
- package/src/hooks/{use-http-client.ts → useHttpClient.ts} +2 -1
- package/src/http/index.ts +1 -1
- package/src/index.tsx +1 -1
- package/src/signalr/index.ts +1 -39
- package/src/signalr/useSignalR.ts +40 -0
- package/src/useFramework.ts +2 -0
- package/src/useFrameworkModule.ts +4 -3
- package/src/version.ts +1 -1
- package/dist/esm/hooks/use-current-user.js.map +0 -1
- package/dist/esm/hooks/use-http-client.js.map +0 -1
- /package/dist/types/hooks/{use-current-user.d.ts → useCurrentUser.d.ts} +0 -0
- /package/dist/types/hooks/{use-http-client.d.ts → useHttpClient.d.ts} +0 -0
- /package/src/hooks/{use-current-user.ts → useCurrentUser.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e8aae1f: Internal: publish every package on the `next` pre-release tag so the whole framework can be installed as a coherent set.
|
|
8
|
+
|
|
9
|
+
Packages without their own changes are bumped only to receive a `-next.N` version and the `next` dist-tag on npm. Install with:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @equinor/fusion-framework-react-app@next
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- 2836e0b: Fix `useFrameworkModule`'s console warning to name the actually-requested module key instead of always printing `undefined`.
|
|
16
|
+
- Updated dependencies [e8aae1f]
|
|
17
|
+
- Updated dependencies [2836e0b]
|
|
18
|
+
- Updated dependencies [2836e0b]
|
|
19
|
+
- Updated dependencies [2836e0b]
|
|
20
|
+
- Updated dependencies [2836e0b]
|
|
21
|
+
- Updated dependencies [2836e0b]
|
|
22
|
+
- Updated dependencies [2836e0b]
|
|
23
|
+
- Updated dependencies [2836e0b]
|
|
24
|
+
- Updated dependencies [2836e0b]
|
|
25
|
+
- Updated dependencies [2836e0b]
|
|
26
|
+
- Updated dependencies [2836e0b]
|
|
27
|
+
- Updated dependencies [2836e0b]
|
|
28
|
+
- Updated dependencies [2836e0b]
|
|
29
|
+
- Updated dependencies [2836e0b]
|
|
30
|
+
- Updated dependencies [2836e0b]
|
|
31
|
+
- @equinor/fusion-framework@8.1.0-next.0
|
|
32
|
+
- @equinor/fusion-framework-module@6.1.3-next.0
|
|
33
|
+
- @equinor/fusion-framework-module-feature-flag@2.1.0-next.0
|
|
34
|
+
- @equinor/fusion-framework-react-module@4.0.3-next.0
|
|
35
|
+
- @equinor/fusion-framework-react-module-http@12.0.0-next.0
|
|
36
|
+
- @equinor/fusion-framework-react-module-signalr@4.0.4-next.0
|
|
37
|
+
- @equinor/fusion-observable@9.1.2-next.0
|
|
38
|
+
|
|
39
|
+
## 8.0.1
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 80c3e4a: Internal: resolve `noExplicitAny` Biome warnings in the framework React context, `createFrameworkProvider`'s `TRef` generic default, and `useCurrentAppModule`'s dynamic module-key lookup, using explanatory `biome-ignore` comments. No public API or behavior change.
|
|
44
|
+
- 80c3e4a: Internal: Reference tracking issues #5082 and #5085 in TODO comments, resolving `fusion-lint` `no-todo-without-issue` warnings.
|
|
45
|
+
- 80c3e4a: Internal: align framework hook filenames with their exports while preserving public entrypoints; no public API changes.
|
|
46
|
+
- 80c3e4a: Internal: add intent comments to `.pipe()` operator chains in `useFeature.ts` and `useFeatures.ts` to satisfy the `require-intent-comment/rxjs` lint rule. No functional change.
|
|
47
|
+
- 80c3e4a: Internal: add missing intent comments for `as`/`as unknown as` type assertions and inline separate re-exports at their definition site, per `fusion-lint`'s `require-intent-comment/type-assertion` and `no-separate-export` rules. No behavior changes.
|
|
48
|
+
- 80c3e4a: Internal: add intent comments to control-flow statements and iterator calls across several hooks to satisfy the `require-intent-comment/flow` and `require-intent-comment/iterators` lint rules. No functional change.
|
|
49
|
+
- 80c3e4a: Internal: split multi-export files into one export per file and convert pure interop re-exports to `export { X } from 'y'` syntax, per `fusion-lint`'s `single-export-per-file` rule. Also removed `modules/event/src/EventProvider.tsx`, a fully dead duplicate of `eventContext.ts`/`useEventProvider.ts`/`useModulesEventProvider.ts` with no remaining consumers. No behavior changes.
|
|
50
|
+
|
|
3
51
|
## 8.0.0
|
|
4
52
|
|
|
5
53
|
### Major Changes
|
|
@@ -14,6 +14,7 @@ import { useFramework } from '../useFramework';
|
|
|
14
14
|
*/
|
|
15
15
|
export const useAppProvider = () => {
|
|
16
16
|
const provider = useFramework().modules.app;
|
|
17
|
+
// Fail fast when the AppModule has not been configured on the framework
|
|
17
18
|
if (!provider) {
|
|
18
19
|
throw Error('Current framework does not have AppModule configured');
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC5E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC5E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,wEAAwE;IACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -32,6 +32,7 @@ import { useFramework } from '../useFramework';
|
|
|
32
32
|
*/
|
|
33
33
|
export const useCurrentApp = () => {
|
|
34
34
|
const provider = useFramework().modules.app;
|
|
35
|
+
// Fail fast when the AppModule has not been configured on the framework
|
|
35
36
|
if (!provider) {
|
|
36
37
|
throw Error('Current framework does not have AppModule configured');
|
|
37
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"A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,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAQ3B,EAAE;IACF,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,wEAAwE;IACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACxF,OAAO;QACL,UAAU,EAAE,KAAmC;QAC/C,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC/E,eAAe,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACnF,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -17,12 +17,19 @@ import useCurrentAppModules from './useCurrentAppModules';
|
|
|
17
17
|
*/
|
|
18
18
|
export const useCurrentAppModule = (moduleKey) => {
|
|
19
19
|
const { modules, error, complete } = useCurrentAppModules();
|
|
20
|
-
const module =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const module = (() => {
|
|
21
|
+
// Preserve an explicit null (modules not applicable) distinct from undefined (not yet loaded)
|
|
22
|
+
if (modules === null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
// Modules are still loading; propagate undefined rather than throwing
|
|
26
|
+
if (modules === undefined) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
// Module lookup by dynamic key can't be statically narrowed to the exact module type; cast to any.
|
|
30
|
+
// biome-ignore lint/suspicious/noExplicitAny: dynamic key lookup can't be statically narrowed to the exact module type
|
|
31
|
+
return modules[moduleKey];
|
|
32
|
+
})();
|
|
26
33
|
return { module, error, complete };
|
|
27
34
|
};
|
|
28
35
|
export default useCurrentAppModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,SAAe,EASf,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,SAAe,EASf,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;QACnB,8FAA8F;QAC9F,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,sEAAsE;QACtE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,mGAAmG;QACnG,uHAAuH;QACvH,OAAO,OAAO,CAAC,SAAiC,CAAQ,CAAC;IAC3D,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/dist/esm/context.js
CHANGED
|
@@ -8,25 +8,6 @@ import { createContext } from 'react';
|
|
|
8
8
|
*
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
//
|
|
11
|
+
// biome-ignore lint/suspicious/noExplicitAny: `Fusion<any>` widens the context to accept a Fusion instance with any concrete module set
|
|
12
12
|
export const context = createContext(null);
|
|
13
|
-
/**
|
|
14
|
-
* Component for providing framework.
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* Should be created by {@link createFrameworkProvider}
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* import {FrameworkProvider} from '@equinor/fusion-framework-react';
|
|
22
|
-
* export const Component = (args: React.PropsWithChildren<{framework: Fusion}>) => {
|
|
23
|
-
* return (
|
|
24
|
-
* <FrameworkProvider value={args.framework}>
|
|
25
|
-
* {args.children}
|
|
26
|
-
* </FrameworkProvider>
|
|
27
|
-
* );
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export const FrameworkProvider = context.Provider;
|
|
32
13
|
//# sourceMappingURL=context.js.map
|
package/dist/esm/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,wIAAwI;AACxI,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { lazy } from 'react';
|
|
3
3
|
import initFusion from '@equinor/fusion-framework';
|
|
4
4
|
import { FrameworkConfigurator } from '@equinor/fusion-framework';
|
|
5
|
-
import { FrameworkProvider } from './
|
|
5
|
+
import { FrameworkProvider } from './framework-provider';
|
|
6
6
|
import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
7
7
|
/**
|
|
8
8
|
* Creates a lazy-loaded React component that initialises a Fusion Framework
|
|
@@ -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,
|
|
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,sBAAsB,CAAC;AAEzD,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"}
|
|
@@ -18,7 +18,10 @@ import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selec
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export const useFeature = (provider, key) => {
|
|
21
|
-
|
|
21
|
+
// Narrow the features stream down to just the one matching feature by key.
|
|
22
|
+
const feature$ = useMemo(() => provider.features$
|
|
23
|
+
// Keep the observable scoped to the requested feature key.
|
|
24
|
+
.pipe(findFeature(key)), [provider, key]);
|
|
22
25
|
const { value: feature, error } = useObservableState(feature$ ?? EMPTY);
|
|
23
26
|
const toggleFeature = useCallback((enable) => {
|
|
24
27
|
const enabled = enable === undefined ? !provider.getFeature(key)?.enabled : enable;
|
|
@@ -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;AAqBtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,Q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,10 +26,18 @@ export const useFeatures = (provider, selector) => {
|
|
|
26
26
|
* @returns An object containing the features and any error that occurred while retrieving them.
|
|
27
27
|
*/
|
|
28
28
|
const { value: features, error } = useObservableState(useMemo(() => {
|
|
29
|
+
// Only compute the feature list when a provider is available; otherwise there's nothing to observe
|
|
29
30
|
if (provider) {
|
|
31
|
+
// Map the feature dictionary to a list, optionally narrowed by the caller-provided selector
|
|
30
32
|
return provider?.features$.pipe(map((x) => {
|
|
31
33
|
const values = Object.values(x);
|
|
32
|
-
|
|
34
|
+
// Return everything when no selector is provided
|
|
35
|
+
if (!selector) {
|
|
36
|
+
return values;
|
|
37
|
+
}
|
|
38
|
+
// Apply the caller-provided selector to narrow down the feature list
|
|
39
|
+
const filtered = values.filter(selector);
|
|
40
|
+
return filtered;
|
|
33
41
|
}));
|
|
34
42
|
}
|
|
35
43
|
return of([]);
|
|
@@ -42,6 +50,7 @@ export const useFeatures = (provider, selector) => {
|
|
|
42
50
|
* @throws Error if IFeatureFlagProvider is missing.
|
|
43
51
|
*/
|
|
44
52
|
const toggleFeature = useCallback((key, enable) => {
|
|
53
|
+
// Cannot toggle a feature without a provider to persist the change
|
|
45
54
|
if (!provider) {
|
|
46
55
|
throw new Error('Missing IFeatureFlagProvider.');
|
|
47
56
|
}
|
|
@@ -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;AAoBtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAsC,EACtC,QAA4B,EACT,EAAE;IACrB;;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;YAClB,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,mEAAmE;QACnE,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"}
|
|
@@ -17,6 +17,7 @@ import { useFeature } from './useFeature';
|
|
|
17
17
|
*/
|
|
18
18
|
export const useFrameworkFeature = (key) => {
|
|
19
19
|
const provider = useFrameworkModule('featureFlag');
|
|
20
|
+
// Fail fast when the FeatureFlagModule has not been enabled on the framework
|
|
20
21
|
if (!provider) {
|
|
21
22
|
throw Error('Feature flagging is not enabled in the framework');
|
|
22
23
|
}
|
|
@@ -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;;;;;;;;;;;;;;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
|
+
{"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,6EAA6E;IAC7E,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"}
|
|
@@ -15,6 +15,7 @@ import { useFeatures } from './useFeatures';
|
|
|
15
15
|
*/
|
|
16
16
|
export const useFrameworkFeatures = () => {
|
|
17
17
|
const provider = useFrameworkModule('featureFlag');
|
|
18
|
+
// Fail fast when the FeatureFlagModule has not been enabled on the framework
|
|
18
19
|
if (!provider) {
|
|
19
20
|
throw Error('Feature flagging is not enabled in the framework');
|
|
20
21
|
}
|
|
@@ -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;;;;;;;;;;;;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"}
|
|
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,6EAA6E;IAC7E,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { context } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Component for providing framework.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Should be created by {@link createFrameworkProvider}
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import {FrameworkProvider} from '@equinor/fusion-framework-react';
|
|
11
|
+
* export const Component = (args: React.PropsWithChildren<{framework: Fusion}>) => {
|
|
12
|
+
* return (
|
|
13
|
+
* <FrameworkProvider value={args.framework}>
|
|
14
|
+
* {args.children}
|
|
15
|
+
* </FrameworkProvider>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const FrameworkProvider = context.Provider;
|
|
21
|
+
//# sourceMappingURL=framework-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-provider.js","sourceRoot":"","sources":["../../src/framework-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
export { useCurrentUser } from './
|
|
10
|
-
export { useHttpClient } from './
|
|
9
|
+
export { useCurrentUser } from './useCurrentUser';
|
|
10
|
+
export { useHttpClient } from './useHttpClient';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentUser.js","sourceRoot":"","sources":["../../../src/hooks/useCurrentUser.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"}
|
|
@@ -16,12 +16,13 @@ import { useFramework } from '../useFramework';
|
|
|
16
16
|
export const useHttpClient = (name) => {
|
|
17
17
|
const framework = useFramework();
|
|
18
18
|
const client = useMemo(() => {
|
|
19
|
+
// Reuse an already-configured client for this key when one exists
|
|
19
20
|
if (framework.modules.http.hasClient(name)) {
|
|
20
21
|
return framework.modules.http.createClient(name);
|
|
21
22
|
}
|
|
22
23
|
throw Error(`no configured client for key [${name}]`);
|
|
23
24
|
}, [framework, name]);
|
|
24
|
-
// TODO
|
|
25
|
+
// TODO(#5085): abort on unmount?
|
|
25
26
|
return client;
|
|
26
27
|
};
|
|
27
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=useHttpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHttpClient.js","sourceRoot":"","sources":["../../../src/hooks/useHttpClient.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,kEAAkE;QAClE,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,iCAAiC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/esm/http/index.js
CHANGED
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
export { useHttpClient as useFrameworkHttpClient } from '../hooks/
|
|
11
|
+
export { useHttpClient as useFrameworkHttpClient } from '../hooks/useHttpClient';
|
|
12
12
|
export * from '@equinor/fusion-framework-react-module-http';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,cAAc,6CAA6C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { FusionConfigurator } from '@equinor/fusion-framework';
|
|
14
14
|
export { createFrameworkProvider } from './create-framework-provider';
|
|
15
|
-
export { FrameworkProvider } from './
|
|
15
|
+
export { FrameworkProvider } from './framework-provider';
|
|
16
16
|
export { useFramework } from './useFramework';
|
|
17
17
|
export { useFrameworkModule } from './useFrameworkModule';
|
|
18
18
|
export { default, Framework } from './Framework';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,sBAAsB,CAAC;AAEzD,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"}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { useProviderTopic, } from '@equinor/fusion-framework-react-module-signalr';
|
|
3
|
-
/**
|
|
4
|
-
* hook for subscribing to a topic of a SignalR hub
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
```ts
|
|
8
|
-
// config.ts
|
|
9
|
-
import {enableSignalR} from '@equinor/fusion-framework-react-module-signalr';
|
|
10
|
-
(configurator) => enableSignalR(configurator, 'notifications');
|
|
11
|
-
|
|
12
|
-
// myHook.ts
|
|
13
|
-
const myHook = () => {
|
|
14
|
-
const topic = useSignalR('notifications', 'foo');
|
|
15
|
-
return useObservableState(topic).next;
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
*
|
|
19
|
-
* @see {@link [module signalr](https://equinor.github.io/fusion-framework/modules/signalr)}
|
|
20
|
-
*
|
|
21
|
-
* @param hubId identifier of connection hub (must be configured)
|
|
22
|
-
* @param topicId identifier of topic to connect to
|
|
23
|
-
* @returns Topic
|
|
24
|
-
*/
|
|
25
|
-
export const useSignalR = (hubId, topicId) => {
|
|
26
|
-
const provider = useFramework().modules.signalR;
|
|
27
|
-
if (!provider) {
|
|
28
|
-
throw Error('SignalR is not configured, see @equinor/fusion-framework-react-module-signalr');
|
|
29
|
-
}
|
|
30
|
-
return useProviderTopic(provider, hubId, topicId);
|
|
31
|
-
};
|
|
1
|
+
export { useSignalR } from './useSignalR.js';
|
|
32
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useFramework } from '../useFramework';
|
|
2
|
+
import { useProviderTopic, } from '@equinor/fusion-framework-react-module-signalr';
|
|
3
|
+
/**
|
|
4
|
+
* hook for subscribing to a topic of a SignalR hub
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
```ts
|
|
8
|
+
// config.ts
|
|
9
|
+
import {enableSignalR} from '@equinor/fusion-framework-react-module-signalr';
|
|
10
|
+
(configurator) => enableSignalR(configurator, 'notifications');
|
|
11
|
+
|
|
12
|
+
// myHook.ts
|
|
13
|
+
const myHook = () => {
|
|
14
|
+
const topic = useSignalR('notifications', 'foo');
|
|
15
|
+
return useObservableState(topic).next;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link [module signalr](https://equinor.github.io/fusion-framework/modules/signalr)}
|
|
20
|
+
*
|
|
21
|
+
* @param hubId identifier of connection hub (must be configured)
|
|
22
|
+
* @param topicId identifier of topic to connect to
|
|
23
|
+
* @returns Topic
|
|
24
|
+
*/
|
|
25
|
+
export const useSignalR = (hubId, topicId) => {
|
|
26
|
+
const provider = useFramework().modules.signalR;
|
|
27
|
+
// Fail fast when the SignalRModule has not been configured on the framework
|
|
28
|
+
if (!provider) {
|
|
29
|
+
throw Error('SignalR is not configured, see @equinor/fusion-framework-react-module-signalr');
|
|
30
|
+
}
|
|
31
|
+
return useProviderTopic(provider, hubId, topicId);
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useSignalR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignalR.js","sourceRoot":"","sources":["../../../src/signalr/useSignalR.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,gBAAgB,GACjB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAa,EACb,OAAe,EACyB,EAAE;IAC1C,MAAM,QAAQ,GAAG,YAAY,EAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;IACjE,4EAA4E;IAC5E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
package/dist/esm/useFramework.js
CHANGED
|
@@ -23,10 +23,12 @@ import { context } from './context';
|
|
|
23
23
|
*/
|
|
24
24
|
export const useFramework = () => {
|
|
25
25
|
let framework = useContext(context);
|
|
26
|
+
// Warn loudly when the framework context is missing so integrators notice the misuse
|
|
26
27
|
if (!framework) {
|
|
27
28
|
console.warn('could not locate fusion in context!');
|
|
28
29
|
}
|
|
29
30
|
framework ??= window.Fusion;
|
|
31
|
+
// Surface an error when neither context nor the global fallback has the framework instance
|
|
30
32
|
if (!framework) {
|
|
31
33
|
console.error('Could not load framework, might not be initiated?');
|
|
32
34
|
}
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;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
|
+
{"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,qFAAqF;IACrF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACtD,CAAC;IACD,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC;IAC5B,2FAA2F;IAC3F,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"}
|
|
@@ -17,12 +17,13 @@ import { useFramework } from './useFramework';
|
|
|
17
17
|
*/
|
|
18
18
|
export const useFrameworkModule = (name) => {
|
|
19
19
|
const framework = useFramework();
|
|
20
|
-
// TODO
|
|
20
|
+
// TODO(#5082): tighten generics so this indexed lookup no longer needs @ts-expect-error
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
-
// @ts-
|
|
22
|
+
// @ts-expect-error
|
|
23
23
|
const module = framework.modules[name];
|
|
24
|
+
// Warn when the requested module key does not resolve to a registered module
|
|
24
25
|
if (!module) {
|
|
25
|
-
console.warn(`the requested module [${
|
|
26
|
+
console.warn(`the requested module [${name}] is not included in the framework instance`);
|
|
26
27
|
}
|
|
27
28
|
return module;
|
|
28
29
|
};
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,wFAAwF;IACxF,6DAA6D;IAC7D,mBAAmB;IACnB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,6EAA6E;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,yBAAyB,IAAI,6CAA6C,CAAC,CAAC;IAC3F,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,cAAc,CAAC"}
|