@equinor/fusion-framework-react-app 0.0.0-context-error-20240131144633
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 +1201 -0
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/dist/esm/bookmark/index.js +3 -0
- package/dist/esm/bookmark/index.js.map +1 -0
- package/dist/esm/bookmark/useBookmark.js +4 -0
- package/dist/esm/bookmark/useBookmark.js.map +1 -0
- package/dist/esm/bookmark/useCurrentBookmark.js +4 -0
- package/dist/esm/bookmark/useCurrentBookmark.js.map +1 -0
- package/dist/esm/context/index.js +5 -0
- package/dist/esm/context/index.js.map +1 -0
- package/dist/esm/context/useContextProvider.js +4 -0
- package/dist/esm/context/useContextProvider.js.map +1 -0
- package/dist/esm/context/useCurrentContext.js +5 -0
- package/dist/esm/context/useCurrentContext.js.map +1 -0
- package/dist/esm/create-component.js +30 -0
- package/dist/esm/create-component.js.map +1 -0
- package/dist/esm/create-legacy-app.js +21 -0
- package/dist/esm/create-legacy-app.js.map +1 -0
- package/dist/esm/feature-flag/index.js +2 -0
- package/dist/esm/feature-flag/index.js.map +1 -0
- package/dist/esm/feature-flag/useFeature.js +33 -0
- package/dist/esm/feature-flag/useFeature.js.map +1 -0
- package/dist/esm/framework/index.js +3 -0
- package/dist/esm/framework/index.js.map +1 -0
- package/dist/esm/framework/useFrameworkCurrentContext.js +5 -0
- package/dist/esm/framework/useFrameworkCurrentContext.js.map +1 -0
- package/dist/esm/http/index.js +2 -0
- package/dist/esm/http/index.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/make-component.js +28 -0
- package/dist/esm/make-component.js.map +1 -0
- package/dist/esm/msal/index.js +4 -0
- package/dist/esm/msal/index.js.map +1 -0
- package/dist/esm/msal/useAccessToken.js +6 -0
- package/dist/esm/msal/useAccessToken.js.map +1 -0
- package/dist/esm/msal/useCurrentAccount.js +6 -0
- package/dist/esm/msal/useCurrentAccount.js.map +1 -0
- package/dist/esm/msal/useToken.js +20 -0
- package/dist/esm/msal/useToken.js.map +1 -0
- package/dist/esm/navigation/index.js +3 -0
- package/dist/esm/navigation/index.js.map +1 -0
- package/dist/esm/navigation/useNavigationModule.js +3 -0
- package/dist/esm/navigation/useNavigationModule.js.map +1 -0
- package/dist/esm/navigation/useRouter.js +7 -0
- package/dist/esm/navigation/useRouter.js.map +1 -0
- package/dist/esm/render-app.js +10 -0
- package/dist/esm/render-app.js.map +1 -0
- package/dist/esm/render-component.js +17 -0
- package/dist/esm/render-component.js.map +1 -0
- package/dist/esm/useAppModule.js +10 -0
- package/dist/esm/useAppModule.js.map +1 -0
- package/dist/esm/useAppModules.js +4 -0
- package/dist/esm/useAppModules.js.map +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/bookmark/index.d.ts +3 -0
- package/dist/types/bookmark/useBookmark.d.ts +2 -0
- package/dist/types/bookmark/useCurrentBookmark.d.ts +3 -0
- package/dist/types/context/index.d.ts +4 -0
- package/dist/types/context/useContextProvider.d.ts +2 -0
- package/dist/types/context/useCurrentContext.d.ts +5 -0
- package/dist/types/create-component.d.ts +21 -0
- package/dist/types/create-legacy-app.d.ts +4 -0
- package/dist/types/feature-flag/index.d.ts +2 -0
- package/dist/types/feature-flag/useFeature.d.ts +6 -0
- package/dist/types/framework/index.d.ts +2 -0
- package/dist/types/framework/useFrameworkCurrentContext.d.ts +5 -0
- package/dist/types/http/index.d.ts +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/make-component.d.ts +24 -0
- package/dist/types/msal/index.d.ts +3 -0
- package/dist/types/msal/useAccessToken.d.ts +6 -0
- package/dist/types/msal/useCurrentAccount.d.ts +2 -0
- package/dist/types/msal/useToken.d.ts +7 -0
- package/dist/types/navigation/index.d.ts +2 -0
- package/dist/types/navigation/useNavigationModule.d.ts +2 -0
- package/dist/types/navigation/useRouter.d.ts +2 -0
- package/dist/types/render-app.d.ts +5 -0
- package/dist/types/render-component.d.ts +4 -0
- package/dist/types/useAppModule.d.ts +4 -0
- package/dist/types/useAppModules.d.ts +3 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +112 -0
- package/src/bookmark/index.ts +4 -0
- package/src/bookmark/useBookmark.ts +21 -0
- package/src/bookmark/useCurrentBookmark.ts +21 -0
- package/src/context/index.ts +6 -0
- package/src/context/useContextProvider.ts +6 -0
- package/src/context/useCurrentContext.ts +6 -0
- package/src/create-component.tsx +114 -0
- package/src/create-legacy-app.tsx +35 -0
- package/src/feature-flag/README.md +20 -0
- package/src/feature-flag/index.ts +6 -0
- package/src/feature-flag/useFeature.ts +66 -0
- package/src/framework/index.ts +7 -0
- package/src/framework/useFrameworkCurrentContext.ts +6 -0
- package/src/http/index.ts +1 -0
- package/src/index.ts +30 -0
- package/src/make-component.tsx +74 -0
- package/src/msal/index.ts +3 -0
- package/src/msal/useAccessToken.ts +15 -0
- package/src/msal/useCurrentAccount.ts +11 -0
- package/src/msal/useToken.ts +29 -0
- package/src/navigation/index.ts +2 -0
- package/src/navigation/useNavigationModule.ts +5 -0
- package/src/navigation/useRouter.ts +16 -0
- package/src/render-app.ts +14 -0
- package/src/render-component.tsx +46 -0
- package/src/useAppModule.ts +31 -0
- package/src/useAppModules.ts +9 -0
- package/src/version.ts +2 -0
- package/tsconfig.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Equinor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Fusion React App
|
|
2
|
+
|
|
3
|
+
Package for developing applications that uses the `@equinor/fusion-framework`.
|
|
4
|
+
|
|
5
|
+
[API documentation](https://equinor.github.io/fusion-framework/modules/_equinor_fusion_framework_react_app.html)
|
|
6
|
+
|
|
7
|
+
__Dependencies__
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fframework%2Fpackage.json&label=framework&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/framework)
|
|
11
|
+
|
|
12
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule%2Fpackage.json&label=module&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module)
|
|
13
|
+
|
|
14
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule-http%2Fpackage.json&label=module-http&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module-http)
|
|
15
|
+
|
|
16
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule-msal%2Fpackage.json&label=module-msal&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module-msal)
|
|
17
|
+
|
|
18
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Freact-module%2Fpackage.json&label=react-module&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/react-module)
|
|
19
|
+
|
|
20
|
+
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Freact-module-app-config%2Fpackage.json&label=react-module-app-config&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/react-module-app-config)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Configure
|
|
24
|
+
```tsx
|
|
25
|
+
// config.ts
|
|
26
|
+
import { AppConfigurator } from '@equinor/fusion-framework-react-app';
|
|
27
|
+
const configCallback: AppConfigurator = (configurator) => {
|
|
28
|
+
configurator.http.configureClient(
|
|
29
|
+
'bar', {
|
|
30
|
+
baseUri: 'https://somewhere-test.com',
|
|
31
|
+
defaultScopes: ['foo/.default']
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// App.tsx
|
|
37
|
+
export const App = () => {
|
|
38
|
+
const client = useHttpClient('bar');
|
|
39
|
+
const [foo, setFoo] = useState('no value');
|
|
40
|
+
const onClick = useCallback(() => {
|
|
41
|
+
client.fetchAsync('api').then(x => x.json).then(setFoo);
|
|
42
|
+
}, [client]);
|
|
43
|
+
return <Button onClick={onClick}>{foo}</Button>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// index.ts
|
|
47
|
+
import { createApp } from '@equinor/fusion-framework-react-app';
|
|
48
|
+
export const render = createApp(App, configCallback);
|
|
49
|
+
export default render;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Hooks
|
|
53
|
+
|
|
54
|
+
### useModule
|
|
55
|
+
```tsx
|
|
56
|
+
import { useModule } from '@equinor/fusion-framework-react-app';
|
|
57
|
+
const ShowToken = () => {
|
|
58
|
+
const auth = useModule('auth');
|
|
59
|
+
const [token, setToken] = useState<string>('');
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
auth.acquireAccessToken().then(setToken);
|
|
62
|
+
}, [auth]);
|
|
63
|
+
return <span>{token ?? 'fetching token'}</span>
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Http
|
|
68
|
+
|
|
69
|
+
### useHttpClient
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
|
|
73
|
+
const App = () => {
|
|
74
|
+
const fooClient = useHttpClient('foo');
|
|
75
|
+
|
|
76
|
+
// using as stream
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const sub = client.fetch('api/all').subscribe((x) => {
|
|
79
|
+
setFoo(x.json());
|
|
80
|
+
});
|
|
81
|
+
return () => sub.unsubscribe();
|
|
82
|
+
},[fooClient]);
|
|
83
|
+
|
|
84
|
+
// using as promise
|
|
85
|
+
const barClient = useHttpClient('bar');
|
|
86
|
+
useCallback(async() => {
|
|
87
|
+
const res = await portalClient.fetchAsync('api/bar');
|
|
88
|
+
console.log(res.json());
|
|
89
|
+
},[barClient]);
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bookmark/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +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;AAkB9F,MAAM,CAAC,MAAM,WAAW,GAAG,GAAU,EAAE,CAAC,YAAY,EAAS,CAAC;AAE9D,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { useCurrentBookmark as _useCurrentBookmark, } from '@equinor/fusion-framework-react-module-bookmark';
|
|
2
|
+
export const useCurrentBookmark = (createBookmarkState) => _useCurrentBookmark(createBookmarkState);
|
|
3
|
+
export default useCurrentBookmark;
|
|
4
|
+
//# sourceMappingURL=useCurrentBookmark.js.map
|
|
@@ -0,0 +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;AAczD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAQ,mBAA6C,EAAE,EAAE,CACvF,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AAE7C,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from '@equinor/fusion-framework-react-module-context';
|
|
2
|
+
export { useContextProvider } from './useContextProvider';
|
|
3
|
+
export { useCurrentContext } from './useCurrentContext';
|
|
4
|
+
export { useFrameworkCurrentContext } from '../framework/useFrameworkCurrentContext';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextProvider.js","sourceRoot":"","sources":["../../../src/context/useContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAgB,SAAS,CAAC,CAAC;AAE/E,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { useCurrentContext as _useCurrentContext } from '@equinor/fusion-framework-react-module-context';
|
|
2
|
+
import useContextProvider from './useContextProvider';
|
|
3
|
+
export const useCurrentContext = () => _useCurrentContext(useContextProvider());
|
|
4
|
+
export default useCurrentContext;
|
|
5
|
+
//# sourceMappingURL=useCurrentContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentContext.js","sourceRoot":"","sources":["../../../src/context/useCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAEhF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { lazy } from 'react';
|
|
12
|
+
import { FrameworkProvider } from '@equinor/fusion-framework-react';
|
|
13
|
+
import { configureModules } from '@equinor/fusion-framework-app';
|
|
14
|
+
import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
15
|
+
export const createComponent = (Component, configure) => (fusion, env) => lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const init = configureModules(configure);
|
|
17
|
+
const modules = (yield init({
|
|
18
|
+
fusion,
|
|
19
|
+
env,
|
|
20
|
+
}));
|
|
21
|
+
modules.event.dispatchEvent('onReactAppLoaded', {
|
|
22
|
+
detail: { modules, fusion },
|
|
23
|
+
source: Component,
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
default: () => (_jsx(FrameworkProvider, { value: fusion, children: _jsx(AppModuleProvider, { value: modules, children: _jsx(Component, {}) }) })),
|
|
27
|
+
};
|
|
28
|
+
}));
|
|
29
|
+
export default createComponent;
|
|
30
|
+
//# sourceMappingURL=create-component.js.map
|
|
@@ -0,0 +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;AA8D7F,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, useMemo } from 'react';
|
|
3
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
4
|
+
import { createComponent } from './create-component';
|
|
5
|
+
export const createLegacyApp = (Component, configure) => {
|
|
6
|
+
const LegacyComponent = () => {
|
|
7
|
+
const fusion = useFramework();
|
|
8
|
+
const RenderComponent = useMemo(() => {
|
|
9
|
+
const creator = createComponent(Component, configure);
|
|
10
|
+
const appProvider = fusion.modules.app;
|
|
11
|
+
if (appProvider === null || appProvider === void 0 ? void 0 : appProvider.current) {
|
|
12
|
+
const { config, manifest } = appProvider.current;
|
|
13
|
+
return creator(fusion, { config, manifest });
|
|
14
|
+
}
|
|
15
|
+
return creator(fusion, {});
|
|
16
|
+
}, [fusion]);
|
|
17
|
+
return (_jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(RenderComponent, {}) }));
|
|
18
|
+
};
|
|
19
|
+
return LegacyComponent;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=create-legacy-app.js.map
|
|
@@ -0,0 +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;YAGtD,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-flag/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { EMPTY, combineLatest, map } from 'rxjs';
|
|
3
|
+
import { useFrameworkModule } from '@equinor/fusion-framework-react';
|
|
4
|
+
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
5
|
+
import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selectors';
|
|
6
|
+
import { useAppModule } from '../useAppModule';
|
|
7
|
+
export const useFeature = (key) => {
|
|
8
|
+
const appProvider = useAppModule('featureFlag');
|
|
9
|
+
const frameworkProvider = useFrameworkModule('featureFlag');
|
|
10
|
+
const features$ = useMemo(() => {
|
|
11
|
+
if (!frameworkProvider) {
|
|
12
|
+
return appProvider.features$;
|
|
13
|
+
}
|
|
14
|
+
return combineLatest({
|
|
15
|
+
framework: frameworkProvider.features$,
|
|
16
|
+
app: appProvider.features$,
|
|
17
|
+
}).pipe(map(({ framework, app }) => {
|
|
18
|
+
return Object.assign(Object.assign({}, framework), app);
|
|
19
|
+
}));
|
|
20
|
+
}, [appProvider, frameworkProvider]);
|
|
21
|
+
const feature$ = useMemo(() => features$.pipe(findFeature(key)), [features$, key]);
|
|
22
|
+
const { value: feature, error } = useObservableState(feature$ !== null && feature$ !== void 0 ? feature$ : EMPTY);
|
|
23
|
+
const toggleFeature = useCallback((enable) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const enabled = enable === undefined ? !((_a = appProvider.getFeature(key)) === null || _a === void 0 ? void 0 : _a.enabled) : enable;
|
|
26
|
+
appProvider.toggleFeature({
|
|
27
|
+
key,
|
|
28
|
+
enabled,
|
|
29
|
+
});
|
|
30
|
+
}, [appProvider, key]);
|
|
31
|
+
return { feature, toggleFeature, error };
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useFeature.js.map
|
|
@@ -0,0 +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;AAQ/C,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;IAG/E,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAE3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACrB,OAAO,WAAW,CAAC,SAAS,CAAC;QACjC,CAAC;QAED,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;IAGrC,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;;QAEjB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/framework/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D,OAAO,EACH,cAAc,EACd,aAAa,IAAI,sBAAsB,GAC1C,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
2
|
+
import { useCurrentContext } from '@equinor/fusion-framework-react-module-context';
|
|
3
|
+
export const useFrameworkCurrentContext = () => useCurrentContext(useFramework().modules.context);
|
|
4
|
+
export default useFrameworkCurrentContext;
|
|
5
|
+
//# sourceMappingURL=useFrameworkCurrentContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFrameworkCurrentContext.js","sourceRoot":"","sources":["../../../src/framework/useFrameworkCurrentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAElG,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { useAppModule } from './useAppModule';
|
|
2
|
+
export { useAppModules } from './useAppModules';
|
|
3
|
+
export { makeComponent } from './make-component';
|
|
4
|
+
export { createLegacyApp } from './create-legacy-app';
|
|
5
|
+
export { renderApp } from './render-app';
|
|
6
|
+
export { createComponent } from './create-component';
|
|
7
|
+
export { renderComponent } from './render-component';
|
|
8
|
+
export { default } from './render-app';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { lazy } from 'react';
|
|
12
|
+
import { FrameworkProvider } from '@equinor/fusion-framework-react';
|
|
13
|
+
import { configureModules } from '@equinor/fusion-framework-app';
|
|
14
|
+
import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
15
|
+
export const makeComponent = (Component, args, configure) => lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const init = configureModules(configure);
|
|
17
|
+
const modules = (yield init(args));
|
|
18
|
+
const { fusion } = args;
|
|
19
|
+
modules.event.dispatchEvent('onReactAppLoaded', {
|
|
20
|
+
detail: { modules, fusion },
|
|
21
|
+
source: Component,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
default: () => (_jsx(FrameworkProvider, { value: fusion, children: _jsx(AppModuleProvider, { value: modules, children: Component }) })),
|
|
25
|
+
};
|
|
26
|
+
}));
|
|
27
|
+
export default makeComponent;
|
|
28
|
+
//# sourceMappingURL=make-component.js.map
|
|
@@ -0,0 +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;AAyB7F,MAAM,CAAC,MAAM,aAAa,GAAG,CAKzB,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACtD,EAAE,CACA,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;IACH,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/msal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useToken } from './useToken';
|
|
2
|
+
export const useAccessToken = (req) => {
|
|
3
|
+
const { token, error, pending } = useToken(req);
|
|
4
|
+
return { token: token === null || token === void 0 ? void 0 : token.accessToken, pending, error };
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useAccessToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAccessToken.js","sourceRoot":"","sources":["../../../src/msal/useAccessToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAM3C,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import useAppModule from '../useAppModule';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
export const useToken = (req) => {
|
|
4
|
+
const msalProvider = useAppModule('auth');
|
|
5
|
+
const [token, setToken] = useState(undefined);
|
|
6
|
+
const [pending, setPending] = useState(false);
|
|
7
|
+
const [error, setError] = useState(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setPending(true);
|
|
10
|
+
setToken(undefined);
|
|
11
|
+
msalProvider
|
|
12
|
+
.acquireToken(req)
|
|
13
|
+
.then((token) => token && setToken(token))
|
|
14
|
+
.catch(setError)
|
|
15
|
+
.finally(() => setPending(false));
|
|
16
|
+
}, [msalProvider, req]);
|
|
17
|
+
return { token, pending, error };
|
|
18
|
+
};
|
|
19
|
+
export default useToken;
|
|
20
|
+
//# sourceMappingURL=useToken.js.map
|
|
@@ -0,0 +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;AAO5C,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigationModule.js","sourceRoot":"","sources":["../../../src/navigation/useNavigationModule.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAwB,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useNavigationModule } from './useNavigationModule';
|
|
3
|
+
export const useRouter = (routes) => {
|
|
4
|
+
const provider = useNavigationModule();
|
|
5
|
+
return useMemo(() => provider.createRouter(routes), [provider, routes]);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useRouter.js.map
|
|
@@ -0,0 +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;AAS5D,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createComponent } from './create-component';
|
|
2
|
+
import { renderComponent } from './render-component';
|
|
3
|
+
export const renderApp = (...componentArgs) => {
|
|
4
|
+
const renderer = renderComponent(createComponent(...componentArgs));
|
|
5
|
+
return (el, args) => {
|
|
6
|
+
return renderer(el, args);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default renderApp;
|
|
10
|
+
//# sourceMappingURL=render-app.js.map
|
|
@@ -0,0 +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;AAKrE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, StrictMode } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
export const renderComponent = (renderer) => {
|
|
5
|
+
return (el, args) => {
|
|
6
|
+
const Component = renderer(args.fusion, args.env);
|
|
7
|
+
return render(el, Component);
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const render = (el, Component) => {
|
|
11
|
+
ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
|
|
12
|
+
return () => {
|
|
13
|
+
ReactDOM.unmountComponentAtNode(el);
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default renderComponent;
|
|
17
|
+
//# sourceMappingURL=render-component.js.map
|
|
@@ -0,0 +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;AAKjC,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;IAEzE,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;QAER,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;AACN,CAAC,CAAC;AAgBF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAppModules } from './useAppModules';
|
|
2
|
+
export const useAppModule = (module) => {
|
|
3
|
+
const appModule = useAppModules()[module];
|
|
4
|
+
if (!appModule) {
|
|
5
|
+
throw Error(`the requested module [${module}] is not included in the app scope`);
|
|
6
|
+
}
|
|
7
|
+
return appModule;
|
|
8
|
+
};
|
|
9
|
+
export default useAppModule;
|
|
10
|
+
//# sourceMappingURL=useAppModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppModule.js","sourceRoot":"","sources":["../../src/useAppModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWhD,MAAM,CAAC,MAAM,YAAY,GAAG,CAIxB,MAAY,EAGkD,EAAE;IAGhE,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,KAAK,CAAC,yBAAyB,MAAM,oCAAoC,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,EAAyB,CAAC;AAElE,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|