@equinor/fusion-framework-react-app 5.2.2 → 5.2.4
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 +68 -0
- package/dist/esm/bookmark/useBookmark.js +16 -0
- package/dist/esm/bookmark/useBookmark.js.map +1 -1
- package/dist/esm/bookmark/useCurrentBookmark.js +12 -0
- package/dist/esm/bookmark/useCurrentBookmark.js.map +1 -1
- package/dist/esm/create-component.js +50 -0
- package/dist/esm/create-component.js.map +1 -1
- package/dist/esm/create-legacy-app.js +2 -0
- package/dist/esm/create-legacy-app.js.map +1 -1
- package/dist/esm/feature-flag/enable-feature-flag.js +5 -0
- package/dist/esm/feature-flag/enable-feature-flag.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js +11 -0
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/framework/index.js +1 -0
- package/dist/esm/framework/index.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/make-component.js +21 -0
- package/dist/esm/make-component.js.map +1 -1
- package/dist/esm/msal/useAccessToken.js +6 -0
- package/dist/esm/msal/useAccessToken.js.map +1 -1
- package/dist/esm/msal/useCurrentAccount.js +4 -0
- package/dist/esm/msal/useCurrentAccount.js.map +1 -1
- package/dist/esm/msal/useToken.js +5 -0
- package/dist/esm/msal/useToken.js.map +1 -1
- package/dist/esm/navigation/useNavigationModule.js +1 -0
- package/dist/esm/navigation/useNavigationModule.js.map +1 -1
- package/dist/esm/navigation/useRouter.js +6 -0
- package/dist/esm/navigation/useRouter.js.map +1 -1
- package/dist/esm/render-app.js +1 -0
- package/dist/esm/render-app.js.map +1 -1
- package/dist/esm/render-component.js +16 -0
- package/dist/esm/render-component.js.map +1 -1
- package/dist/esm/useAppEnvironmentVariables.js +29 -0
- package/dist/esm/useAppEnvironmentVariables.js.map +1 -1
- package/dist/esm/useAppModule.js +8 -0
- package/dist/esm/useAppModule.js.map +1 -1
- package/dist/esm/useAppModules.js +6 -0
- package/dist/esm/useAppModules.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/bookmark/useBookmark.d.ts +16 -0
- package/dist/types/bookmark/useCurrentBookmark.d.ts +12 -0
- package/dist/types/context/useCurrentContext.d.ts +1 -1
- package/dist/types/create-component.d.ts +51 -1
- package/dist/types/create-legacy-app.d.ts +1 -2
- package/dist/types/feature-flag/enable-feature-flag.d.ts +20 -0
- package/dist/types/feature-flag/useFeature.d.ts +7 -1
- package/dist/types/framework/useFrameworkCurrentContext.d.ts +1 -1
- package/dist/types/make-component.d.ts +22 -1
- package/dist/types/msal/useAccessToken.d.ts +7 -1
- package/dist/types/msal/useCurrentAccount.d.ts +4 -0
- package/dist/types/msal/useToken.d.ts +6 -1
- package/dist/types/navigation/useNavigationModule.d.ts +1 -0
- package/dist/types/navigation/useRouter.d.ts +7 -1
- package/dist/types/render-app.d.ts +1 -1
- package/dist/types/render-component.d.ts +1 -0
- package/dist/types/useAppEnvironmentVariables.d.ts +25 -0
- package/dist/types/useAppModule.d.ts +8 -0
- package/dist/types/useAppModules.d.ts +8 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/widget/index.d.ts +4 -0
- package/package.json +17 -17
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 5.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @equinor/fusion-framework-app@9.1.4
|
|
9
|
+
- @equinor/fusion-framework-module-app@5.3.8
|
|
10
|
+
- @equinor/fusion-framework-react@7.1.3
|
|
11
|
+
|
|
12
|
+
## 5.2.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#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
|
|
17
|
+
|
|
18
|
+
- [#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.
|
|
19
|
+
|
|
20
|
+
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
21
|
+
|
|
22
|
+
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
23
|
+
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
24
|
+
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
Before:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"compilerOptions": {
|
|
33
|
+
"module": "ES2022",
|
|
34
|
+
"target": "ES6",
|
|
35
|
+
"incremental": true,
|
|
36
|
+
"removeComments": true,
|
|
37
|
+
"preserveConstEnums": true,
|
|
38
|
+
"sourceMap": true,
|
|
39
|
+
"moduleResolution": "node"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
After:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"compilerOptions": {
|
|
49
|
+
"module": "ES2022",
|
|
50
|
+
"target": "ES6",
|
|
51
|
+
"incremental": true,
|
|
52
|
+
"preserveConstEnums": true,
|
|
53
|
+
"sourceMap": true,
|
|
54
|
+
"moduleResolution": "node"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This change ensures that comments are preserved in the compiled output, potentially improving the development and debugging experience for users of the Fusion Framework.
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [[`2f74edc`](https://github.com/equinor/fusion-framework/commit/2f74edcd4a3ea2b87d69f0fd63492145c3c01663), [`86d55b8`](https://github.com/equinor/fusion-framework/commit/86d55b8d27a572f3f62170b1e72aceda54f955e1), [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee)]:
|
|
62
|
+
- @equinor/fusion-framework-module@4.3.2
|
|
63
|
+
- @equinor/fusion-framework-react-module@3.1.3
|
|
64
|
+
- @equinor/fusion-framework-module-navigation@4.0.3
|
|
65
|
+
- @equinor/fusion-framework-react-module-http@6.0.1
|
|
66
|
+
- @equinor/fusion-framework-react@7.1.2
|
|
67
|
+
- @equinor/fusion-framework-module-msal@3.1.2
|
|
68
|
+
- @equinor/fusion-framework-module-app@5.3.8
|
|
69
|
+
- @equinor/fusion-framework-app@9.1.3
|
|
70
|
+
|
|
3
71
|
## 5.2.2
|
|
4
72
|
|
|
5
73
|
### Patch Changes
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { useBookmark as _useBookmark } from '@equinor/fusion-framework-react-module-bookmark';
|
|
2
|
+
/**
|
|
3
|
+
* For application development the useCurrentBookmark should be sufficient enough
|
|
4
|
+
*
|
|
5
|
+
* Functionality provided here is:
|
|
6
|
+
* - addBookmarkCreator
|
|
7
|
+
* - getAllBookmarks
|
|
8
|
+
* - createBookmark
|
|
9
|
+
* - updateBookmark
|
|
10
|
+
* - deleteBookmarkById
|
|
11
|
+
* - setCurrentBookmark
|
|
12
|
+
* - currentBookmark
|
|
13
|
+
* - bookmarks,
|
|
14
|
+
*
|
|
15
|
+
* @template TData - Current applications bookmark type
|
|
16
|
+
* @return {*} {Bookmarks<TData>} the full api fro handling bookmarks
|
|
17
|
+
*/
|
|
2
18
|
export const useBookmark = () => _useBookmark();
|
|
3
19
|
export default useBookmark;
|
|
4
20
|
//# sourceMappingURL=useBookmark.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"useBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE9F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAU,EAAE,CAAC,YAAY,EAAS,CAAC;AAE9D,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { useCurrentBookmark as _useCurrentBookmark, } from '@equinor/fusion-framework-react-module-bookmark';
|
|
2
|
+
/**
|
|
3
|
+
* By providing a CreateBookMarkFn bookmarks is enabled for the current application.
|
|
4
|
+
*
|
|
5
|
+
* @template TData - Type of data stored in bookmark
|
|
6
|
+
* @param {CreateBookMarkFn<TData>} [createBookmarkState] - Function for creating bookmark payload, this function should be wrapped in useCallback
|
|
7
|
+
*
|
|
8
|
+
* ```TS
|
|
9
|
+
* // Example
|
|
10
|
+
* const { currentBookmark } = useCurrentBookmark(useCallback(()=> someState, [someState]))
|
|
11
|
+
* ```
|
|
12
|
+
* @return {*} {CurrentBookmark<TData>}
|
|
13
|
+
*/
|
|
2
14
|
export const useCurrentBookmark = (createBookmarkState) => _useCurrentBookmark(createBookmarkState);
|
|
3
15
|
export default useCurrentBookmark;
|
|
4
16
|
//# sourceMappingURL=useCurrentBookmark.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useCurrentBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,IAAI,mBAAmB,GAC5C,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"useCurrentBookmark.js","sourceRoot":"","sources":["../../../src/bookmark/useCurrentBookmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,IAAI,mBAAmB,GAC5C,MAAM,iDAAiD,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAQ,mBAA6C,EAAE,EAAE,CACvF,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AAE7C,eAAe,kBAAkB,CAAC"}
|
|
@@ -12,6 +12,56 @@ import { lazy } from 'react';
|
|
|
12
12
|
import { FrameworkProvider } from '@equinor/fusion-framework-react';
|
|
13
13
|
import { configureModules } from '@equinor/fusion-framework-app';
|
|
14
14
|
import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated
|
|
17
|
+
* Creates an lazy loading Component which configures modules
|
|
18
|
+
* and provides context to framework and configured modules
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* ```mermaid
|
|
22
|
+
* sequenceDiagram
|
|
23
|
+
* App ->>+Framework: createApp
|
|
24
|
+
* Framework->>-Framework: initializeModules
|
|
25
|
+
* Framework->>App: configure(modules, framework, args)
|
|
26
|
+
* App-->Framework: await configuration
|
|
27
|
+
* Framework->>App: React.LazyExoticComponent
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const configCallback: AppConfigurator = (configurator) => {
|
|
33
|
+
* configurator.http.configureClient(
|
|
34
|
+
* 'bar', {
|
|
35
|
+
* baseUri: 'https://somewhere-test.com',
|
|
36
|
+
* defaultScopes: ['foo/.default']
|
|
37
|
+
* }
|
|
38
|
+
* );
|
|
39
|
+
* };
|
|
40
|
+
*
|
|
41
|
+
* export const App = () => {
|
|
42
|
+
* const client = useHttpClient('bar');
|
|
43
|
+
* const [foo, setFoo] = useState('no value');
|
|
44
|
+
* const onClick = useCallback(() => {
|
|
45
|
+
* client.fetchAsync('api').then(x => x.json).then(setFoo);
|
|
46
|
+
* }, [client]);
|
|
47
|
+
* return <Button onClick={onClick}>{foo}</Button>
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* export const render = createApp(App, configCallback);
|
|
51
|
+
*
|
|
52
|
+
* export default render;
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* __Exposed providers__
|
|
57
|
+
* @see {@link @equinor/fusion-framework-react.FrameworkProvider | FrameworkProvider}
|
|
58
|
+
* @see {@link ModuleProvider | ModuleProvider}
|
|
59
|
+
*
|
|
60
|
+
* @template TModules module types included in configuration.
|
|
61
|
+
* @param Component - React component to render
|
|
62
|
+
* @param configure - Callback for configuring application
|
|
63
|
+
* @param modules - required modules for application
|
|
64
|
+
*/
|
|
15
65
|
export const createComponent = (Component, configure) => (fusion, env) => lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
66
|
const init = configureModules(configure);
|
|
17
67
|
const modules = (yield init({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-component.js","sourceRoot":"","sources":["../../src/create-component.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAU,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-component.js","sourceRoot":"","sources":["../../src/create-component.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAU,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,MAAM,eAAe,GACxB,CACI,SAA4B,EAC5B,SAAoD,EACvB,EAAE,CACnC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CACZ,IAAI,CAAC,GAAS,EAAE;IACZ,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC;QACxB,MAAM;QACN,GAAG;KACN,CAAC,CAAkC,CAAC;IAErC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC5C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,MAAM,EAAE,SAAS;KACpB,CAAC,CAAC;IACH,OAAO;QACH,OAAO,EAAE,GAAG,EAAE,CAAC,CACX,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC5B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAI7B,KAAC,SAAS,KAAG,GACG,GACJ,CACvB;KACJ,CAAC;AACN,CAAC,CAAA,CAAC,CAAC;AAUX,eAAe,eAAe,CAAC"}
|
|
@@ -7,6 +7,8 @@ export const createLegacyApp = (Component, configure) => {
|
|
|
7
7
|
const fusion = useFramework();
|
|
8
8
|
const RenderComponent = useMemo(() => {
|
|
9
9
|
const creator = createComponent(Component, configure);
|
|
10
|
+
// @eikeland
|
|
11
|
+
// TODO - recheck when legacy fusion-cli is updated!
|
|
10
12
|
const appProvider = fusion.modules.app;
|
|
11
13
|
if (appProvider === null || appProvider === void 0 ? void 0 : appProvider.current) {
|
|
12
14
|
const { config, manifest } = appProvider.current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,SAA4B,EAC5B,SAAwC,EAC1C,EAAE;IACA,MAAM,eAAe,GAAG,GAAgB,EAAE;QACtC,MAAM,MAAM,GAAG,YAAY,EAAe,CAAC;QAC3C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACjC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,SAA4B,EAC5B,SAAwC,EAC1C,EAAE;IACA,MAAM,eAAe,GAAG,GAAgB,EAAE;QACtC,MAAM,MAAM,GAAG,YAAY,EAAe,CAAC;QAC3C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACjC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACtD,YAAY;YACZ,oDAAoD;YACpD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;YACvC,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,EAAE,CAAC;gBACvB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;gBACjD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAuB,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAuB,CAAC,CAAC;QACpD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,OAAO,CACH,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,eAAe,KAAG,GACZ,CACd,CAAC;IACN,CAAC,CAAC;IACF,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -20,6 +20,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
import { enableFeatureFlagging, } from '@equinor/fusion-framework-module-feature-flag';
|
|
22
22
|
import { createLocalStoragePlugin, createUrlPlugin, } from '@equinor/fusion-framework-module-feature-flag/plugins';
|
|
23
|
+
/**
|
|
24
|
+
* Enables feature flagging based on the provided configurator and flags callback.
|
|
25
|
+
* @param configurator The AppConfigurator instance.
|
|
26
|
+
* @param flags_cb Optional flags callback that can be an array of feature flags or a callback function.
|
|
27
|
+
*/
|
|
23
28
|
export function enableFeatureFlag(configurator, flags_cb) {
|
|
24
29
|
switch (typeof flags_cb) {
|
|
25
30
|
case 'function': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-feature-flag.js","sourceRoot":"","sources":["../../../src/feature-flag/enable-feature-flag.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EACH,qBAAqB,GAGxB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EACH,wBAAwB,EACxB,eAAe,GAClB,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"enable-feature-flag.js","sourceRoot":"","sources":["../../../src/feature-flag/enable-feature-flag.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EACH,qBAAqB,GAGxB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EACH,wBAAwB,EACxB,eAAe,GAClB,MAAM,uDAAuD,CAAC;AA4B/D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC7B,YAA8B,EAC9B,QAEgC;IAEhC,QAAQ,OAAO,QAAQ,EAAE,CAAC;QACtB,KAAK,UAAU,CAAC,CAAC,CAAC;YACd,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YAC9C,MAAM;QACV,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACZ,MAAM,QAAQ,GAAmB,EAAE,CAAC;YACpC,MAAM,UAAU,GAAG,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC7C,MAAM,EAAE,QAAQ,KAAmB,IAAI,EAAlB,SAAS,UAAK,IAAI,EAAjC,YAA0B,CAAO,CAAC;gBACxC,IAAI,QAAQ,EAAE,CAAC;oBACX,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxB,CAAC;gBACD,OAAO,SAAS,CAAC;YACrB,CAAC,CAAC,CAAC;YACH,qBAAqB,CAAC,YAAY,EAAE,CAAO,OAAO,EAAE,EAAE;;gBAClD,OAAO,CAAC,SAAS,CACb,wBAAwB,CAAC,UAAU,EAAE;oBACjC,IAAI,EAAE,MAAC,YAAgC,CAAC,GAAG,0CAAE,QAAQ,CAAC,GAAG;iBAC5D,CAAC,CACL,CAAC;gBACF,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjD,CAAC,CAAA,CAAC,CAAC;YACH,MAAM;QACV,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -4,13 +4,22 @@ import { useFrameworkModule } from '@equinor/fusion-framework-react';
|
|
|
4
4
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
5
|
import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selectors';
|
|
6
6
|
import { useAppModule } from '../useAppModule';
|
|
7
|
+
/**
|
|
8
|
+
* Custom hook for accessing and manipulating feature flags.
|
|
9
|
+
* @template T - The type of the feature flag value.
|
|
10
|
+
* @param key - The key of the feature flag.
|
|
11
|
+
* @returns An object containing the feature flag, toggle function, and error (if any).
|
|
12
|
+
*/
|
|
7
13
|
export const useFeature = (key) => {
|
|
8
14
|
const appProvider = useAppModule('featureFlag');
|
|
9
15
|
const frameworkProvider = useFrameworkModule('featureFlag');
|
|
16
|
+
/** get all available feature flags */
|
|
10
17
|
const features$ = useMemo(() => {
|
|
18
|
+
/** the framework does not have the feature flag module */
|
|
11
19
|
if (!frameworkProvider) {
|
|
12
20
|
return appProvider.features$;
|
|
13
21
|
}
|
|
22
|
+
/** merge feature flags from framework and application */
|
|
14
23
|
return combineLatest({
|
|
15
24
|
framework: frameworkProvider.features$,
|
|
16
25
|
app: appProvider.features$,
|
|
@@ -18,10 +27,12 @@ export const useFeature = (key) => {
|
|
|
18
27
|
return Object.assign(Object.assign({}, framework), app);
|
|
19
28
|
}));
|
|
20
29
|
}, [appProvider, frameworkProvider]);
|
|
30
|
+
/** find feature flag by the provided key */
|
|
21
31
|
const feature$ = useMemo(() => features$.pipe(findFeature(key)), [features$, key]);
|
|
22
32
|
const { value: feature, error } = useObservableState(feature$ !== null && feature$ !== void 0 ? feature$ : EMPTY);
|
|
23
33
|
const toggleFeature = useCallback((enable) => {
|
|
24
34
|
var _a;
|
|
35
|
+
/** if no value provided, invert the current value */
|
|
25
36
|
const enabled = enable === undefined ? !((_a = appProvider.getFeature(key)) === null || _a === void 0 ? void 0 : _a.enabled) : enable;
|
|
26
37
|
appProvider.toggleFeature({
|
|
27
38
|
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,aAAa,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACtB,GAAW,EAKb,EAAE;IACA,MAAM,WAAW,GAAG,YAAY,CAAoB,aAAa,CAAC,CAAC;IACnE,MAAM,iBAAiB,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IAE/E,sCAAsC;IACtC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,0DAA0D;QAC1D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACrB,OAAO,WAAW,CAAC,SAAS,CAAC;QACjC,CAAC;QACD,yDAAyD;QACzD,OAAO,aAAa,CAAC;YACjB,SAAS,EAAE,iBAAiB,CAAC,SAAS;YACtC,GAAG,EAAE,WAAW,CAAC,SAAS;SAC7B,CAAC,CAAC,IAAI,CACH,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE;YACvB,uCAAY,SAAS,GAAK,GAAG,EAAG;QACpC,CAAC,CAAC,CACL,CAAC;IACN,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAErC,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAI,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IAEtF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,CAAC,CAAC;IAExE,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,MAAgB,EAAE,EAAE;;QACjB,qDAAqD;QACrD,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA,MAAA,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,0CAAE,OAAO,CAAA,CAAC,CAAC,CAAC,MAAM,CAAC;QACtF,WAAW,CAAC,aAAa,CAAC;YACtB,GAAG;YACH,OAAO;SACV,CAAC,CAAC;IACP,CAAC,EACD,CAAC,WAAW,EAAE,GAAG,CAAC,CACrB,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO;AACP,OAAO,EACH,cAAc,EACd,aAAa,IAAI,sBAAsB,GAC1C,MAAM,uCAAuC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { useAppModules } from './useAppModules';
|
|
|
3
3
|
export { useAppEnvironmentVariables } from './useAppEnvironmentVariables';
|
|
4
4
|
export { makeComponent } from './make-component';
|
|
5
5
|
export { createLegacyApp } from './create-legacy-app';
|
|
6
|
+
// TODO deprecate
|
|
6
7
|
export { renderApp } from './render-app';
|
|
7
8
|
export { createComponent } from './create-component';
|
|
8
9
|
export { renderComponent } from './render-component';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -12,6 +12,27 @@ import { lazy } from 'react';
|
|
|
12
12
|
import { FrameworkProvider } from '@equinor/fusion-framework-react';
|
|
13
13
|
import { configureModules } from '@equinor/fusion-framework-app';
|
|
14
14
|
import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
15
|
+
/**
|
|
16
|
+
* Creates a lazy loading React Component that initializes and configures modules,
|
|
17
|
+
* then provides the necessary context to both the Fusion framework and the configured modules.
|
|
18
|
+
* This function is particularly useful for setting up a React application with modular architecture,
|
|
19
|
+
* allowing for lazy loading of components along with their dependencies.
|
|
20
|
+
*
|
|
21
|
+
* __Exposed providers__:
|
|
22
|
+
* - {@link @equinor/fusion-framework-react.FrameworkProvider | FrameworkProvider} to provide Fusion context.
|
|
23
|
+
* - {@link @equinor/fusion-framework-react-module.ModuleProvider | ModuleProvider} to provide module instances.
|
|
24
|
+
*
|
|
25
|
+
* @template TModules The types of modules included in the configuration.
|
|
26
|
+
* @template TRef The type of the Fusion instance.
|
|
27
|
+
* @template TEnv The environment type for the application.
|
|
28
|
+
* @param {React.ReactNode} Component - The React component to render lazily.
|
|
29
|
+
* @param {Object} args - The arguments required for module configuration and component rendering.
|
|
30
|
+
* @param {TRef} args.fusion - The Fusion instance to be used by the component and modules.
|
|
31
|
+
* @param {TEnv} args.env - The environment context for the application.
|
|
32
|
+
* @param {AppModuleInitiator<TModules, TRef, TEnv>} [configure] - Optional callback function for configuring application modules.
|
|
33
|
+
* @returns {React.LazyExoticComponent<React.ComponentType>} A lazy component that, when rendered,
|
|
34
|
+
* initializes the specified modules and provides the necessary Fusion and module context.
|
|
35
|
+
*/
|
|
15
36
|
export const makeComponent = (Component, args, configure) => lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
37
|
const init = configureModules(configure);
|
|
17
38
|
const modules = (yield init(args));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAU,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAU,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAKzB,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACN,EAAE,CAChD,IAAI,CAAC,GAAS,EAAE;IACZ,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAkC,CAAC;IAEpE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC5C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,MAAM,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,OAAO;QACH,OAAO,EAAE,GAAG,EAAE,CAAC,CACX,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC5B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAAG,SAAS,GAAqB,GAClD,CACvB;KACJ,CAAC;AACN,CAAC,CAAA,CAAC,CAAC;AAUP,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { useToken } from './useToken';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook that retrieves an access token for the specified authentication request.
|
|
4
|
+
*
|
|
5
|
+
* @param req - The authentication request.
|
|
6
|
+
* @returns An object containing the access token, pending state, and error.
|
|
7
|
+
*/
|
|
2
8
|
export const useAccessToken = (req) => {
|
|
3
9
|
const { token, error, pending } = useToken(req);
|
|
4
10
|
return { token: token === null || token === void 0 ? void 0 : token.accessToken, pending, error };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccessToken.js","sourceRoot":"","sources":["../../../src/msal/useAccessToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"useAccessToken.js","sourceRoot":"","sources":["../../../src/msal/useAccessToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,GAAgB,EACoC,EAAE;IACtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACzD,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import useAppModule from '../useAppModule';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the current account information from the MSAL provider.
|
|
4
|
+
* @returns The current account information or undefined if no account is available.
|
|
5
|
+
*/
|
|
2
6
|
export const useCurrentAccount = () => {
|
|
3
7
|
const msalProvider = useAppModule('auth');
|
|
4
8
|
return msalProvider.defaultAccount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAA4B,EAAE;IAC3D,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC,cAAc,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import useAppModule from '../useAppModule';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for acquiring an authentication token using MSAL.
|
|
5
|
+
* @param req - The authentication request.
|
|
6
|
+
* @returns An object containing the acquired token, pending state, and error.
|
|
7
|
+
*/
|
|
3
8
|
export const useToken = (req) => {
|
|
4
9
|
const msalProvider = useAppModule('auth');
|
|
5
10
|
const [token, setToken] = useState(undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACpB,GAAgB,EACkD,EAAE;IACpE,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmC,SAAS,CAAC,CAAC;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE;QACX,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,YAAY;aACP,YAAY,CAAC,GAAG,CAAC;aACjB,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;aACzC,KAAK,CAAC,QAAQ,CAAC;aACf,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IACxB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigationModule.js","sourceRoot":"","sources":["../../../src/navigation/useNavigationModule.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useNavigationModule.js","sourceRoot":"","sources":["../../../src/navigation/useNavigationModule.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAG3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAwB,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useNavigationModule } from './useNavigationModule';
|
|
3
|
+
/**
|
|
4
|
+
* create a router for react routing
|
|
5
|
+
* @see {@link [docs](https://equinor.github.io/fusion-framework/modules/navigation/)}
|
|
6
|
+
* @see {@link [react-router](https://reactrouter.com/en/main/routers/create-browser-router)}
|
|
7
|
+
* @param routes router objects __(must be static | memorized)__
|
|
8
|
+
*/
|
|
3
9
|
export const useRouter = (routes) => {
|
|
4
10
|
const provider = useNavigationModule();
|
|
5
11
|
return useMemo(() => provider.createRouter(routes), [provider, routes]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/navigation/useRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/navigation/useRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACrB,MAA0D,EACX,EAAE;IACjD,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC"}
|
package/dist/esm/render-app.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createComponent } from './create-component';
|
|
2
2
|
import { renderComponent } from './render-component';
|
|
3
|
+
/** @deprecated */
|
|
3
4
|
export const renderApp = (...componentArgs) => {
|
|
4
5
|
const renderer = renderComponent(createComponent(...componentArgs));
|
|
5
6
|
return (el, args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AAIrE,kBAAkB;AAClB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,aAAiD,EAAE,EAAE;IAC9E,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QAClE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, StrictMode } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
|
+
/** @deprecated */
|
|
4
5
|
export const renderComponent = (renderer) => {
|
|
5
6
|
return (el, args) => {
|
|
6
7
|
const Component = renderer(args.fusion, args.env);
|
|
@@ -8,10 +9,25 @@ export const renderComponent = (renderer) => {
|
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
11
|
const render = (el, Component) => {
|
|
12
|
+
// eslint-disable-next-line react/no-deprecated
|
|
11
13
|
ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
|
|
12
14
|
return () => {
|
|
15
|
+
// eslint-disable-next-line react/no-deprecated
|
|
13
16
|
ReactDOM.unmountComponentAtNode(el);
|
|
14
17
|
};
|
|
15
18
|
};
|
|
19
|
+
// const render = (el: Element, Component: FunctionComponent): RenderTeardown => {
|
|
20
|
+
// const root = createRoot(el);
|
|
21
|
+
// root.render(
|
|
22
|
+
// <StrictMode>
|
|
23
|
+
// <Suspense fallback={<p>loading app</p>}>
|
|
24
|
+
// <Component />
|
|
25
|
+
// </Suspense>
|
|
26
|
+
// </StrictMode>
|
|
27
|
+
// );
|
|
28
|
+
// return () => {
|
|
29
|
+
// root.unmount();
|
|
30
|
+
// };
|
|
31
|
+
// };
|
|
16
32
|
export default renderComponent;
|
|
17
33
|
//# sourceMappingURL=render-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,QAAQ,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAIjC,kBAAkB;AAClB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA2B,EAAE,EAAE;IAC3D,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACjC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IACzE,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CACX,KAAC,UAAU,cACP,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,SAAS,KAAG,GACN,GACF,EACb,EAAE,CACL,CAAC;IACF,OAAO,GAAG,EAAE;QACR,+CAA+C;QAC/C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,kFAAkF;AAClF,mCAAmC;AACnC,mBAAmB;AACnB,uBAAuB;AACvB,uDAAuD;AACvD,gCAAgC;AAChC,0BAA0B;AAC1B,wBAAwB;AACxB,SAAS;AACT,qBAAqB;AACrB,0BAA0B;AAC1B,SAAS;AACT,KAAK;AAEL,eAAe,eAAe,CAAC"}
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { useCurrentApp } from '@equinor/fusion-framework-react/app';
|
|
2
2
|
import { useObservableSelector, useObservableState, } from '@equinor/fusion-observable/react';
|
|
3
|
+
/**
|
|
4
|
+
* A React hook that provides access to the application's environment variables.
|
|
5
|
+
*
|
|
6
|
+
* This hook returns an observable state object that represents the current environment configuration.
|
|
7
|
+
* The environment configuration is retrieved from the app module provided by the framework.
|
|
8
|
+
*
|
|
9
|
+
* @note This hook is only available when the app module is loaded (should be always for applications).
|
|
10
|
+
* This hook in theory should always have a value if config was provided for the application, but is async by nature, hence the `complete` and `error` properties.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const MyComponent = () => {
|
|
15
|
+
* const env = useAppEnvironmentVariables();
|
|
16
|
+
* if(!env.complete) {
|
|
17
|
+
* return <div>Loading environment variables...</div>;
|
|
18
|
+
* }
|
|
19
|
+
* if(env.error) {
|
|
20
|
+
* return <div>Error loading environment variables</div>;
|
|
21
|
+
* }
|
|
22
|
+
* return <div>My environment variables: {JSON.stringify(env.value)}</div>;
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @template TEnvironmentVariables - The type of the environment variables. Defaults to `unknown`.
|
|
26
|
+
* @returns An observable state object containing the current environment configuration.
|
|
27
|
+
*/
|
|
3
28
|
export const useAppEnvironmentVariables = () => {
|
|
4
29
|
var _a;
|
|
30
|
+
// Get the current app module instance from the framework
|
|
5
31
|
const app = useCurrentApp().currentApp;
|
|
32
|
+
// Ensure the app module is available before proceeding
|
|
6
33
|
if (!app) {
|
|
7
34
|
throw Error('Framework is missing app module');
|
|
8
35
|
}
|
|
36
|
+
// Get the environment configuration observable from the app module
|
|
9
37
|
const env$ = useObservableSelector(app.getConfig(), (config) => config.environment);
|
|
38
|
+
// Return the observable state of the environment configuration
|
|
10
39
|
return useObservableState(env$, {
|
|
11
40
|
initial: (_a = app.config) === null || _a === void 0 ? void 0 : _a.environment,
|
|
12
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppEnvironmentVariables.js","sourceRoot":"","sources":["../../src/useAppEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAEH,qBAAqB,EACrB,kBAAkB,GACrB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"useAppEnvironmentVariables.js","sourceRoot":"","sources":["../../src/useAppEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAEH,qBAAqB,EACrB,kBAAkB,GACrB,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAEY,EAAE;;IACpD,yDAAyD;IACzD,MAAM,GAAG,GAAG,aAAa,EAA6B,CAAC,UAAU,CAAC;IAElE,uDAAuD;IACvD,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,MAAM,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACnD,CAAC;IAED,mEAAmE;IACnE,MAAM,IAAI,GAAG,qBAAqB,CAC9B,GAAG,CAAC,SAAS,EAAE,EACf,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAoC,CAC1D,CAAC;IAEF,+DAA+D;IAC/D,OAAO,kBAAkB,CAAC,IAAI,EAAE;QAC5B,OAAO,EAAE,MAAA,GAAG,CAAC,MAAM,0CAAE,WAAW;KACnC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/dist/esm/useAppModule.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { useAppModules } from './useAppModules';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the specified app module from the app scope.
|
|
4
|
+
*
|
|
5
|
+
* @template TType - The type of the app module.
|
|
6
|
+
* @template TKey - The key of the app module.
|
|
7
|
+
* @param module - The key of the app module to retrieve.
|
|
8
|
+
* @returns The app module instance if found, otherwise throws an error.
|
|
9
|
+
*/
|
|
2
10
|
export function useAppModule(module) {
|
|
3
11
|
const appModule = useAppModules()[module];
|
|
4
12
|
if (!appModule) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppModule.js","sourceRoot":"","sources":["../../src/useAppModule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useAppModule.js","sourceRoot":"","sources":["../../src/useAppModule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAIxB,MAAY;IAIZ,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC,MAAkC,CAAC,CAAC;IACtE,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,KAAK,CAAC,yBAAyB,MAAM,oCAAoC,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,SAE0D,CAAC;AACtE,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { useModules } from '@equinor/fusion-framework-react-module';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook that returns an instance of the app modules.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the app modules.
|
|
6
|
+
* @returns An instance of the app modules.
|
|
7
|
+
*/
|
|
2
8
|
export const useAppModules = () => useModules();
|
|
3
9
|
export default useAppModules;
|
|
4
10
|
//# sourceMappingURL=useAppModules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,EAAyB,CAAC;AAElE,eAAe,aAAa,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"}
|