@equinor/fusion-framework-react 7.1.1 → 7.1.3
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 +66 -0
- package/dist/esm/app/useAppProvider.js +4 -0
- package/dist/esm/app/useAppProvider.js.map +1 -1
- package/dist/esm/app/useApps.js +5 -0
- package/dist/esm/app/useApps.js.map +1 -1
- package/dist/esm/app/useCurrentApp.js +8 -0
- package/dist/esm/app/useCurrentApp.js.map +1 -1
- package/dist/esm/app/useCurrentAppModule.js +11 -1
- package/dist/esm/app/useCurrentAppModule.js.map +1 -1
- package/dist/esm/app/useCurrentAppModules.js +8 -0
- package/dist/esm/app/useCurrentAppModules.js.map +1 -1
- package/dist/esm/context.js +19 -0
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/create-framework-provider.js +19 -0
- package/dist/esm/create-framework-provider.js.map +1 -1
- package/dist/esm/feature-flag/useCurrentAppFeatures.js +4 -0
- package/dist/esm/feature-flag/useCurrentAppFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +8 -0
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFeatures.js +20 -0
- package/dist/esm/feature-flag/useFeatures.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeature.js +8 -0
- package/dist/esm/feature-flag/useFrameworkFeature.js.map +1 -1
- package/dist/esm/feature-flag/useFrameworkFeatures.js +6 -0
- package/dist/esm/feature-flag/useFrameworkFeatures.js.map +1 -1
- package/dist/esm/hooks/use-http-client.js +1 -0
- package/dist/esm/hooks/use-http-client.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/signalr/index.js +22 -0
- package/dist/esm/signalr/index.js.map +1 -1
- package/dist/esm/useFramework.js +9 -0
- package/dist/esm/useFramework.js.map +1 -1
- package/dist/esm/useFrameworkModule.js +12 -0
- package/dist/esm/useFrameworkModule.js.map +1 -1
- package/dist/esm/version.js +2 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/app/useAppProvider.d.ts +5 -1
- package/dist/types/app/useApps.d.ts +5 -0
- package/dist/types/app/useCurrentApp.d.ts +9 -1
- package/dist/types/app/useCurrentAppModule.d.ts +12 -2
- package/dist/types/app/useCurrentAppModules.d.ts +10 -2
- package/dist/types/context/useCurrentContext.d.ts +1 -1
- package/dist/types/context.d.ts +18 -1
- package/dist/types/create-framework-provider.d.ts +20 -1
- package/dist/types/feature-flag/useCurrentAppFeatures.d.ts +4 -0
- package/dist/types/feature-flag/useFeature.d.ts +11 -0
- package/dist/types/feature-flag/useFeatures.d.ts +12 -0
- package/dist/types/feature-flag/useFrameworkFeature.d.ts +8 -0
- package/dist/types/feature-flag/useFrameworkFeatures.d.ts +6 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/signalr/index.d.ts +22 -0
- package/dist/types/useFramework.d.ts +10 -1
- package/dist/types/useFrameworkModule.d.ts +10 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +13 -13
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 7.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @equinor/fusion-framework@7.2.3
|
|
9
|
+
- @equinor/fusion-framework-module-feature-flag@1.1.5
|
|
10
|
+
|
|
11
|
+
## 7.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#2333](https://github.com/equinor/fusion-framework/pull/2333) [`86d55b8`](https://github.com/equinor/fusion-framework/commit/86d55b8d27a572f3f62170b1e72aceda54f955e1) Thanks [@odinr](https://github.com/odinr)! - Updated `TypeScript` to 5.5.3
|
|
16
|
+
|
|
17
|
+
- [#2320](https://github.com/equinor/fusion-framework/pull/2320) [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee) Thanks [@odinr](https://github.com/odinr)! - Removed the `removeComments` option from the `tsconfig.base.json` file.
|
|
18
|
+
|
|
19
|
+
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
20
|
+
|
|
21
|
+
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
22
|
+
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
23
|
+
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
24
|
+
|
|
25
|
+
No action is required from consumers of the library. This change affects the build process and doesn't introduce any breaking changes or new features.
|
|
26
|
+
|
|
27
|
+
Before:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"compilerOptions": {
|
|
32
|
+
"module": "ES2022",
|
|
33
|
+
"target": "ES6",
|
|
34
|
+
"incremental": true,
|
|
35
|
+
"removeComments": true,
|
|
36
|
+
"preserveConstEnums": true,
|
|
37
|
+
"sourceMap": true,
|
|
38
|
+
"moduleResolution": "node"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
After:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"compilerOptions": {
|
|
48
|
+
"module": "ES2022",
|
|
49
|
+
"target": "ES6",
|
|
50
|
+
"incremental": true,
|
|
51
|
+
"preserveConstEnums": true,
|
|
52
|
+
"sourceMap": true,
|
|
53
|
+
"moduleResolution": "node"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This change ensures that comments are preserved in the compiled output, potentially improving the development and debugging experience for users of the Fusion Framework.
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [[`2f74edc`](https://github.com/equinor/fusion-framework/commit/2f74edcd4a3ea2b87d69f0fd63492145c3c01663), [`86d55b8`](https://github.com/equinor/fusion-framework/commit/86d55b8d27a572f3f62170b1e72aceda54f955e1), [`29ff796`](https://github.com/equinor/fusion-framework/commit/29ff796ebb3a643c604e4153b6798bde5992363c), [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee)]:
|
|
61
|
+
- @equinor/fusion-framework-module@4.3.2
|
|
62
|
+
- @equinor/fusion-framework-react-module-signalr@3.0.11
|
|
63
|
+
- @equinor/fusion-framework-module-feature-flag@1.1.5
|
|
64
|
+
- @equinor/fusion-framework-react-module@3.1.3
|
|
65
|
+
- @equinor/fusion-framework-react-module-http@6.0.1
|
|
66
|
+
- @equinor/fusion-observable@8.3.3
|
|
67
|
+
- @equinor/fusion-framework@7.2.2
|
|
68
|
+
|
|
3
69
|
## 7.1.1
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,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;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC1E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/esm/app/useApps.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useAppProvider } from './useAppProvider';
|
|
4
|
+
/**
|
|
5
|
+
* React Hook - Get apps from framework
|
|
6
|
+
* @param args Object with boolean member includeHidden
|
|
7
|
+
* @returns Object {apps, isLoading} where apps is Array of AppManifest, isLoading is a boolean on observable complete
|
|
8
|
+
*/
|
|
4
9
|
export const useApps = (args) => {
|
|
5
10
|
const provider = useAppProvider();
|
|
6
11
|
const { value: manifests, complete, error, } = useObservableState(useMemo(() => provider.getAllAppManifests(), [provider]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAEvB,EAA2E,EAAE;IAC1E,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;IAClC,MAAM,EACF,KAAK,EAAE,SAAS,EAChB,QAAQ,EACR,KAAK,GACR,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kBAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEjF,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACtB,IAAI,SAAS,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,CAAA,EAAE,CAAC;YACpC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAEtB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
3
3
|
import { useFramework } from '../useFramework';
|
|
4
|
+
/**
|
|
5
|
+
* Observers the stream of current app and return the latest application
|
|
6
|
+
*
|
|
7
|
+
* __Warning:__ type hint templates are only hints, this does not check if the modules are actually enabled!
|
|
8
|
+
*
|
|
9
|
+
* @template TModule type hint modules which the application has configured
|
|
10
|
+
* @template TEnv type hint what kind of environment config the application has
|
|
11
|
+
*/
|
|
4
12
|
export const useCurrentApp = () => {
|
|
5
13
|
const provider = useFramework().modules.app;
|
|
6
14
|
if (!provider) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAK3B,EAAE;IACA,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACxE,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;QACH,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;KACR,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import useCurrentAppModules from './useCurrentAppModules';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the current app module based on the provided module key.
|
|
4
|
+
* @template TType - The type of the module.
|
|
5
|
+
* @template TKey - The type of the module key.
|
|
6
|
+
* @param {TKey} moduleKey - The key of the module to retrieve.
|
|
7
|
+
* @returns {AnyModule | null | undefined} - The current app module or null if not found.
|
|
8
|
+
* @remarks
|
|
9
|
+
* - when module is null, there are no current selected application
|
|
10
|
+
* - when undefined is, the application has not enabled the requested module
|
|
11
|
+
*/
|
|
2
12
|
export const useCurrentAppModule = (moduleKey) => {
|
|
3
13
|
const { modules, error, complete } = useCurrentAppModules();
|
|
4
14
|
const module = modules === null
|
|
5
15
|
? null
|
|
6
16
|
: modules === undefined
|
|
7
17
|
? undefined
|
|
8
|
-
:
|
|
18
|
+
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
19
|
modules[moduleKey];
|
|
10
20
|
return { module, error, complete };
|
|
11
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAI/B,SAAe,EASjB,EAAE;IACA,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,GACR,OAAO,KAAK,IAAI;QACZ,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,KAAK,SAAS;YACrB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,8DAA8D;gBAC7D,OAAO,CAAC,SAAiC,CAAS,CAAC;IAChE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -2,6 +2,14 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import useCurrentApp from './useCurrentApp';
|
|
3
3
|
import { of } from 'rxjs';
|
|
4
4
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
|
+
/**
|
|
6
|
+
* Observers the stream of current app initialized modules
|
|
7
|
+
*
|
|
8
|
+
* __Warning:__ type hint templates are only hints, this does not check if the modules are actually enabled!
|
|
9
|
+
*
|
|
10
|
+
* @template TModule type hint modules which the application has configured
|
|
11
|
+
* @returns the observable instance of initialized modules of the application
|
|
12
|
+
*/
|
|
5
13
|
export const useCurrentAppModules = () => {
|
|
6
14
|
var _a;
|
|
7
15
|
const { currentApp, error: appError } = useCurrentApp();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAppModules.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAc,EAAE,EAAE,MAAM,MAAM,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"useCurrentAppModules.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAc,EAAE,EAAE,MAAM,MAAM,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAIlC,EAAE;;IACA,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAY,CAAC;IAClE,MAAM,QAAQ,GAAG,OAAO,CACpB,GAAG,EAAE,CACD,UAAU;QACN,CAAC,CAAE,UAAU,CAAC,SAAsD;QACpE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAClB,CAAC,UAAU,CAAC,CACf,CAAC;IACF,MAAM,EACF,KAAK,EAAE,OAAO,EACd,KAAK,EACL,QAAQ,GACX,GAAG,kBAAkB,CAAC,QAAQ,EAAE;QAC7B,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,mCAAI,IAAI;KAC/E,CAAC,CAAC;IACH,OAAO;QACH,OAAO;QACP,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,QAAQ;QACxB,QAAQ;KACX,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
package/dist/esm/context.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
3
|
export const context = createContext(null);
|
|
4
|
+
/**
|
|
5
|
+
* Component for providing framework.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Should be created by {@link createFrameworkProvider}
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import {FrameworkProvider} from '@equinor/fusion-framework-react';
|
|
13
|
+
* export const Component = (args: React.PropsWithChildren<{framework: Fusion}>) => {
|
|
14
|
+
* return (
|
|
15
|
+
* <FrameworkProvider value={args.framework}>
|
|
16
|
+
* {args.children}
|
|
17
|
+
* </FrameworkProvider>
|
|
18
|
+
* );
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
3
22
|
export const FrameworkProvider = context.Provider;
|
|
4
23
|
//# 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;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
|
|
@@ -13,6 +13,25 @@ import initFusion from '@equinor/fusion-framework';
|
|
|
13
13
|
import { FusionConfigurator } from '@equinor/fusion-framework';
|
|
14
14
|
import { FrameworkProvider } from './context';
|
|
15
15
|
import { ModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
16
|
+
/**
|
|
17
|
+
* Create a framework provider for react.
|
|
18
|
+
*
|
|
19
|
+
* This function is for providers of framework, like a portal.
|
|
20
|
+
*
|
|
21
|
+
* @param configurator - callback for configuring modules
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const config: FusionConfigurator = (config) => {}
|
|
25
|
+
* const Portal = () => {
|
|
26
|
+
* const Framework = createFrameworkProvider(config);
|
|
27
|
+
* return (
|
|
28
|
+
* <Suspense fallback={<span>loading...</span>}>
|
|
29
|
+
* <Framework>{children}</Framework>
|
|
30
|
+
* </Suspense>
|
|
31
|
+
* );
|
|
32
|
+
* };
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
16
35
|
export const createFrameworkProvider = (cb) => lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
36
|
const configurator = new FusionConfigurator();
|
|
18
37
|
yield cb(configurator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,EAAwE,EACY,EAAE,CACtF,IAAI,CAAC,GAAS,EAAE;IACZ,MAAM,YAAY,GAAG,IAAI,kBAAkB,EAAY,CAAC;IACxD,MAAM,EAAE,CAAC,YAAY,CAAC,CAAC;IACvB,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,OAAO;QACH,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE,CAAC,CACvD,KAAC,iBAAiB,IAAC,KAAK,EAAE,SAAS,YAC/B,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAG,QAAQ,GAAkB,GACrD,CACvB;KACJ,CAAC;AACN,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useCurrentAppModule } from '../app';
|
|
2
2
|
import { useFeatures } from './useFeatures';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook that returns the current app features and provides a function to toggle a feature.
|
|
5
|
+
* @returns An object containing the current app features, a function to toggle a feature, and any error that occurred.
|
|
6
|
+
*/
|
|
3
7
|
export const useCurrentAppFeatures = () => {
|
|
4
8
|
const { module, error: moduleError } = useCurrentAppModule('featureFlag');
|
|
5
9
|
const { features, toggleFeature, error } = useFeatures(module);
|
|
@@ -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;
|
|
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;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAsB,EAAE;IACzD,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;QACH,QAAQ;QACR,aAAa;QACb,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,WAAW;KAC9B,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -2,6 +2,14 @@ import { useCallback, useMemo } from 'react';
|
|
|
2
2
|
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
|
+
/**
|
|
6
|
+
* Custom hook that retrieves a feature flag from a feature flag provider.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the feature flag value.
|
|
9
|
+
* @param {IFeatureFlagProvider} provider - The feature flag provider.
|
|
10
|
+
* @param {string} key - The key of the feature flag.
|
|
11
|
+
* @returns {UseFeatureResult<T>} - An object containing the feature flag value, a function to toggle the feature flag, and any error that occurred.
|
|
12
|
+
*/
|
|
5
13
|
export const useFeature = (provider, key) => {
|
|
6
14
|
const feature$ = useMemo(() => provider.features$.pipe(findFeature(key)), [provider, key]);
|
|
7
15
|
const { value: feature, error } = useObservableState(feature$ !== null && feature$ !== void 0 ? feature$ : EMPTY);
|
|
@@ -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;AAWtF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACtB,QAA8B,EAC9B,GAAW,EACQ,EAAE;IACrB,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,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,MAAgB,EAAE,EAAE;;QACjB,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,0CAAE,OAAO,CAAA,CAAC,CAAC,CAAC,MAAM,CAAC;QACnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC,EACD,CAAC,QAAQ,EAAE,GAAG,CAAC,CAClB,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -2,8 +2,21 @@ import { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { of } from 'rxjs';
|
|
3
3
|
import { map } from 'rxjs/operators';
|
|
4
4
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
|
+
/**
|
|
6
|
+
* Custom hook that provides access to the feature flags and their values.
|
|
7
|
+
*
|
|
8
|
+
* @param provider - The feature flag provider.
|
|
9
|
+
* @param selector - Optional function to filter the feature flags.
|
|
10
|
+
* @returns An object containing the features, any error that occurred while retrieving them, and a function to set the enabled state of a feature flag.
|
|
11
|
+
* @throws Error if the feature flag provider is missing.
|
|
12
|
+
*/
|
|
5
13
|
export const useFeatures = (provider, selector) => {
|
|
6
14
|
var _a;
|
|
15
|
+
/**
|
|
16
|
+
* Custom hook that provides access to the feature flags and their values.
|
|
17
|
+
*
|
|
18
|
+
* @returns An object containing the features and any error that occurred while retrieving them.
|
|
19
|
+
*/
|
|
7
20
|
const { value: features, error } = useObservableState(useMemo(() => {
|
|
8
21
|
if (provider) {
|
|
9
22
|
return provider === null || provider === void 0 ? void 0 : provider.features$.pipe(map((x) => {
|
|
@@ -13,6 +26,13 @@ export const useFeatures = (provider, selector) => {
|
|
|
13
26
|
}
|
|
14
27
|
return of([]);
|
|
15
28
|
}, [provider, selector]), { initial: Object.values((_a = provider === null || provider === void 0 ? void 0 : provider.features) !== null && _a !== void 0 ? _a : {}) });
|
|
29
|
+
/**
|
|
30
|
+
* Sets the enabled state of a feature flag.
|
|
31
|
+
*
|
|
32
|
+
* @param key - The key of the feature flag.
|
|
33
|
+
* @param enable - The new enabled state of the feature flag.
|
|
34
|
+
* @throws Error if IFeatureFlagProvider is missing.
|
|
35
|
+
*/
|
|
16
36
|
const toggleFeature = useCallback((key, enable) => {
|
|
17
37
|
var _a;
|
|
18
38
|
if (!provider) {
|
|
@@ -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;AAYtE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACvB,QAAsC,EACtC,QAA4B,EACX,EAAE;;IACnB;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,kBAAkB,CACjD,OAAO,CAAC,GAAG,EAAE;QACT,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC,IAAI,CAC3B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACN,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;YACvD,CAAC,CAAC,CACL,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EACxB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,mCAAI,EAAE,CAAC,EAAE,CACvD,CAAC;IACF;;;;;;OAMG;IACH,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,GAAW,EAAE,MAAgB,EAAE,EAAE;;QAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,0CAAE,OAAO,CAAA,CAAC,CAAC,CAAC,MAAM,CAAC;QAEnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { useFrameworkModule } from '../useFrameworkModule';
|
|
2
2
|
import { useFeature } from './useFeature';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook that allows accessing a framework feature based on a given feature flag key.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of the feature.
|
|
7
|
+
* @param {string} key - The feature flag key.
|
|
8
|
+
* @returns {ReturnType<typeof useFeature<T>>} - The result of the feature hook.
|
|
9
|
+
* @throws {Error} - If feature flagging is not enabled in the framework.
|
|
10
|
+
*/
|
|
3
11
|
export const useFrameworkFeature = (key) => {
|
|
4
12
|
const provider = useFrameworkModule('featureFlag');
|
|
5
13
|
if (!provider) {
|
|
@@ -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;
|
|
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;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAI,GAAW,EAAoC,EAAE;IACpF,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useFrameworkModule } from '../useFrameworkModule';
|
|
2
2
|
import { useFeatures } from './useFeatures';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook that provides access to framework-specific feature flags.
|
|
5
|
+
* It returns the result of the `useFeatures` hook from the `featureFlag` module.
|
|
6
|
+
* @returns The result of the `useFeatures` hook.
|
|
7
|
+
* @throws Error if feature flagging is not enabled in the framework.
|
|
8
|
+
*/
|
|
3
9
|
export const useFrameworkFeatures = () => {
|
|
4
10
|
const provider = useFrameworkModule('featureFlag');
|
|
5
11
|
if (!provider) {
|
|
@@ -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;
|
|
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;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmC,EAAE;IACrE,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -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;AAK/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAyB,EAAc,EAAE;IACnE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,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;AAK/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAyB,EAAc,EAAE;IACnE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACtB,2BAA2B;IAC3B,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;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"}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { useFramework } from '../useFramework';
|
|
2
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
|
+
*/
|
|
3
25
|
export const useSignalR = (hubId, topicId) => {
|
|
4
26
|
const provider = useFramework().modules.signalR;
|
|
5
27
|
if (!provider) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACtB,KAAa,EACb,OAAe,EACuB,EAAE;IACxC,MAAM,QAAQ,GAAG,YAAY,EAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,KAAK,CACP,+EAA+E,CAClF,CAAC;IACN,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC,CAAC"}
|
package/dist/esm/useFramework.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { context } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const useSometing = () => {
|
|
7
|
+
* const fusion = useFramework();
|
|
8
|
+
* return fusion.something;
|
|
9
|
+
* }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
3
12
|
export const useFramework = () => {
|
|
4
13
|
let framework = useContext(context);
|
|
5
14
|
if (!framework) {
|
|
@@ -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;
|
|
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;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACvF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;IACD,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,MAAM,CAAC,MAAM,EAAC;IAC5B,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { useFramework } from './useFramework';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a module from the framework instance based on its name.
|
|
4
|
+
*
|
|
5
|
+
* @template TType - The type of the module to retrieve.
|
|
6
|
+
* @template TKey - The type of the module name.
|
|
7
|
+
* @param name - The name of the module to retrieve.
|
|
8
|
+
* @returns The requested module from the framework instance.
|
|
9
|
+
* @throws Error if the requested module is not included in the framework instance.
|
|
10
|
+
*/
|
|
2
11
|
export const useFrameworkModule = (name) => {
|
|
3
12
|
const framework = useFramework();
|
|
13
|
+
// TODO
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
4
16
|
const module = framework.modules[name];
|
|
5
17
|
if (!module) {
|
|
6
18
|
console.warn(`the requested module [${module}] is not included in the framework instance`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAI9B,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;QACV,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,6CAA6C,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,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":"
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|