@equinor/fusion-framework-react-app 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/create-app.js +10 -5
- package/dist/esm/create-app.js.map +1 -1
- package/dist/esm/http/useHttpClient.js +1 -1
- package/dist/esm/http/useHttpClient.js.map +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useAppModule.js +4 -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/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config/index.d.ts +2 -1
- package/dist/types/create-app.d.ts +13 -6
- package/dist/types/index.d.ts +6 -2
- package/dist/types/useAppModule.d.ts +3 -0
- package/dist/types/useAppModules.d.ts +3 -0
- package/package.json +11 -9
- package/src/config/index.ts +3 -3
- package/src/create-app.tsx +27 -36
- package/src/http/useHttpClient.ts +1 -1
- package/src/index.ts +15 -2
- package/src/useAppModule.ts +8 -0
- package/src/useAppModules.ts +6 -0
- package/tsconfig.json +6 -0
- package/dist/esm/modules.js +0 -8
- package/dist/esm/modules.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/types/modules.d.ts +0 -17
- package/dist/types/types.d.ts +0 -0
- package/src/modules.tsx +0 -17
- package/src/types.ts +0 -0
- package/yarn-error.log +0 -13173
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useAppConfig, useAppConfig$ } from '@equinor/fusion-framework-react-module-app-config';
|
|
2
|
+
export type { AppConfig, UseAppConfigResult, UseAppConfigStreamResult, } from '@equinor/fusion-framework-react-module-app-config';
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { AppModules } from '
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Fusion } from '@equinor/fusion-framework-react';
|
|
3
|
+
import type { AppManifest, AppConfigurator, AppModules } from '@equinor/fusion-framework-app';
|
|
4
|
+
import type { AnyModule, ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
5
|
+
import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
7
6
|
export declare const createApp: <TModules extends AnyModule[]>(Component: React.ComponentType, configure?: AppConfigurator<TModules> | undefined, modules?: TModules | undefined) => (fusion: Fusion, env: AppManifest) => React.LazyExoticComponent<React.ComponentType>;
|
|
7
|
+
declare module '@equinor/fusion-framework-module-event' {
|
|
8
|
+
interface FrameworkEventMap {
|
|
9
|
+
onReactAppLoaded: FrameworkEvent<FrameworkEventInit<{
|
|
10
|
+
modules: ModulesInstanceType<AppModules>;
|
|
11
|
+
fusion: Fusion;
|
|
12
|
+
}, React.ComponentType>>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
export default createApp;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { AppModules, AppModulesInstance,
|
|
1
|
+
export { appModules } from '@equinor/fusion-framework-app';
|
|
2
|
+
export type { AppConfigurator, AppModules, AppModulesInstance, AppManifest, } from '@equinor/fusion-framework-app';
|
|
3
|
+
export { useAppModule } from './useAppModule';
|
|
4
|
+
export { useAppModules } from './useAppModules';
|
|
5
|
+
export { createApp } from './create-app';
|
|
6
|
+
export { default } from './create-app';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-react-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,13 +39,15 @@
|
|
|
39
39
|
"directory": "packages/react"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@equinor/fusion-framework": "^2.0
|
|
43
|
-
"@equinor/fusion-framework-
|
|
44
|
-
"@equinor/fusion-framework-module
|
|
45
|
-
"@equinor/fusion-framework-module-
|
|
46
|
-
"@equinor/fusion-framework-
|
|
47
|
-
"@equinor/fusion-framework-
|
|
48
|
-
"@equinor/fusion-
|
|
42
|
+
"@equinor/fusion-framework": "^2.1.0",
|
|
43
|
+
"@equinor/fusion-framework-app": "^0.1.1",
|
|
44
|
+
"@equinor/fusion-framework-module": "^0.4.2",
|
|
45
|
+
"@equinor/fusion-framework-module-event": "^0.1.1",
|
|
46
|
+
"@equinor/fusion-framework-module-http": "^0.6.2",
|
|
47
|
+
"@equinor/fusion-framework-module-msal": "^0.3.2",
|
|
48
|
+
"@equinor/fusion-framework-react": "^0.2.17",
|
|
49
|
+
"@equinor/fusion-framework-react-module-app-config": "^0.1.3",
|
|
50
|
+
"@equinor/fusion-observable": "^0.3.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@types/react": "^17.0.11",
|
|
@@ -67,5 +69,5 @@
|
|
|
67
69
|
"optional": true
|
|
68
70
|
}
|
|
69
71
|
},
|
|
70
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "4a8883c57421b9353676a9972179321c59b48ed7"
|
|
71
73
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useAppConfig, useAppConfig$ } from '@equinor/fusion-framework-react-module-app-config';
|
|
2
|
+
|
|
3
|
+
export type {
|
|
2
4
|
AppConfig,
|
|
3
|
-
useAppConfig,
|
|
4
5
|
UseAppConfigResult,
|
|
5
|
-
useAppConfig$,
|
|
6
6
|
UseAppConfigStreamResult,
|
|
7
7
|
} from '@equinor/fusion-framework-react-module-app-config';
|
package/src/create-app.tsx
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
1
|
import { lazy } from 'react';
|
|
3
2
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { FrameworkProvider } from '@equinor/fusion-framework-react';
|
|
4
|
+
import type { Fusion } from '@equinor/fusion-framework-react';
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import { initializeAppModules } from '@equinor/fusion-framework-app';
|
|
7
|
+
import type { AppManifest, AppConfigurator, AppModules } from '@equinor/fusion-framework-app';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import type { AnyModule, ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
* Interface for type hinting configuration callbacks
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const configCallback: AppConfigurator = (configurator) => {
|
|
18
|
-
* configurator.http.configureClient(
|
|
19
|
-
* 'bar', {
|
|
20
|
-
* baseUri: 'https://somewhere-test.com',
|
|
21
|
-
* defaultScopes: ['foo/.default']
|
|
22
|
-
* }
|
|
23
|
-
* );
|
|
24
|
-
* };
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export interface AppConfigurator<TModules extends Array<AnyModule> = []> {
|
|
28
|
-
(
|
|
29
|
-
config: ModulesConfigType<AppModules> & ModulesConfigType<TModules>,
|
|
30
|
-
fusion: Fusion,
|
|
31
|
-
env: AppManifest
|
|
32
|
-
): void | Promise<void>;
|
|
33
|
-
}
|
|
13
|
+
import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
|
|
34
14
|
|
|
35
15
|
/**
|
|
36
16
|
* Creates an lazy loading Component which configures modules
|
|
@@ -96,18 +76,18 @@ export const createApp =
|
|
|
96
76
|
await Promise.resolve(configure(config, fusion, env));
|
|
97
77
|
}
|
|
98
78
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
);
|
|
79
|
+
|
|
80
|
+
const appInitiator = initializeAppModules(configurator, modules ?? []);
|
|
81
|
+
|
|
82
|
+
const appModules = await appInitiator(fusion, env);
|
|
83
|
+
appModules.event.dispatchEvent('onReactAppLoaded', {
|
|
84
|
+
detail: { modules, fusion },
|
|
85
|
+
source: Component,
|
|
86
|
+
});
|
|
107
87
|
return {
|
|
108
88
|
default: () => (
|
|
109
89
|
<FrameworkProvider value={fusion}>
|
|
110
|
-
<AppModuleProvider>
|
|
90
|
+
<AppModuleProvider value={appModules}>
|
|
111
91
|
<Component />
|
|
112
92
|
</AppModuleProvider>
|
|
113
93
|
</FrameworkProvider>
|
|
@@ -115,4 +95,15 @@ export const createApp =
|
|
|
115
95
|
};
|
|
116
96
|
});
|
|
117
97
|
|
|
98
|
+
declare module '@equinor/fusion-framework-module-event' {
|
|
99
|
+
interface FrameworkEventMap {
|
|
100
|
+
onReactAppLoaded: FrameworkEvent<
|
|
101
|
+
FrameworkEventInit<
|
|
102
|
+
{ modules: ModulesInstanceType<AppModules>; fusion: Fusion },
|
|
103
|
+
React.ComponentType
|
|
104
|
+
>
|
|
105
|
+
>;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
118
109
|
export default createApp;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
2
|
import { HttpClientMsal, IHttpClient } from '@equinor/fusion-framework-module-http';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { useAppModule } from '../
|
|
4
|
+
import { useAppModule } from '../useAppModule';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Use a configured client from application modules
|
package/src/index.ts
CHANGED
|
@@ -3,5 +3,18 @@
|
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export {
|
|
7
|
-
|
|
6
|
+
export { appModules } from '@equinor/fusion-framework-app';
|
|
7
|
+
|
|
8
|
+
export type {
|
|
9
|
+
AppConfigurator,
|
|
10
|
+
AppModules,
|
|
11
|
+
AppModulesInstance,
|
|
12
|
+
AppManifest,
|
|
13
|
+
} from '@equinor/fusion-framework-app';
|
|
14
|
+
|
|
15
|
+
export { useAppModule } from './useAppModule';
|
|
16
|
+
export { useAppModules } from './useAppModules';
|
|
17
|
+
|
|
18
|
+
export { createApp } from './create-app';
|
|
19
|
+
|
|
20
|
+
export { default } from './create-app';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppModulesInstance } from '@equinor/fusion-framework-app';
|
|
2
|
+
import { useAppModules } from './useAppModules';
|
|
3
|
+
|
|
4
|
+
export const useAppModule = <TKey extends keyof AppModulesInstance>(
|
|
5
|
+
module: TKey
|
|
6
|
+
): AppModulesInstance[TKey] => useAppModules()[module];
|
|
7
|
+
|
|
8
|
+
export default useAppModule;
|
package/tsconfig.json
CHANGED
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
{
|
|
15
15
|
"path": "../framework"
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../app"
|
|
19
|
+
},
|
|
17
20
|
{
|
|
18
21
|
"path": "../framework-react"
|
|
19
22
|
},
|
|
@@ -26,6 +29,9 @@
|
|
|
26
29
|
{
|
|
27
30
|
"path": "../module-msal"
|
|
28
31
|
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../module-event"
|
|
34
|
+
},
|
|
29
35
|
{
|
|
30
36
|
"path": "../react-module"
|
|
31
37
|
},
|
package/dist/esm/modules.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import http from '@equinor/fusion-framework-module-http';
|
|
2
|
-
import msal from '@equinor/fusion-framework-module-msal';
|
|
3
|
-
import appConfig from '@equinor/fusion-framework-react-module-app-config';
|
|
4
|
-
import { useModules } from '@equinor/fusion-framework-react-module';
|
|
5
|
-
export const appModules = [http, msal, appConfig];
|
|
6
|
-
export const useAppModules = (useModules);
|
|
7
|
-
export const useAppModule = (module) => useAppModules()[module];
|
|
8
|
-
//# sourceMappingURL=modules.js.map
|
package/dist/esm/modules.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/modules.tsx"],"names":[],"mappings":"AAEA,OAAO,IAAoB,MAAM,uCAAuC,CAAC;AACzE,OAAO,IAAoB,MAAM,uCAAuC,CAAC;AACzE,OAAO,SAA8B,MAAM,mDAAmD,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAKpE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAA,UAA8B,CAAA,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,CACxB,MAAY,EACY,EAAE,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/esm/types.js
DELETED
package/dist/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/dist/types/modules.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
2
|
-
import { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
3
|
-
import { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
4
|
-
import { AppConfigModule } from '@equinor/fusion-framework-react-module-app-config';
|
|
5
|
-
export declare type AppModules = [HttpModule, MsalModule, AppConfigModule];
|
|
6
|
-
export declare type AppModulesInstance = ModulesInstanceType<AppModules>;
|
|
7
|
-
export declare const appModules: (HttpModule | MsalModule | AppConfigModule)[];
|
|
8
|
-
export declare const useAppModules: () => {
|
|
9
|
-
http: import("@equinor/fusion-framework-module-http").IHttpClientProvider<import("@equinor/fusion-framework-module-http").IHttpClient<import("@equinor/fusion-framework-module-http").FetchRequest, Response>>;
|
|
10
|
-
auth: import("@equinor/fusion-framework-module-msal").IAuthProvider;
|
|
11
|
-
appConfig: import("@equinor/fusion-framework-react-module-app-config").IAppConfigProvider<unknown>;
|
|
12
|
-
};
|
|
13
|
-
export declare const useAppModule: <TKey extends "http" | "auth" | "appConfig">(module: TKey) => {
|
|
14
|
-
http: import("@equinor/fusion-framework-module-http").IHttpClientProvider<import("@equinor/fusion-framework-module-http").IHttpClient<import("@equinor/fusion-framework-module-http").FetchRequest, Response>>;
|
|
15
|
-
auth: import("@equinor/fusion-framework-module-msal").IAuthProvider;
|
|
16
|
-
appConfig: import("@equinor/fusion-framework-react-module-app-config").IAppConfigProvider<unknown>;
|
|
17
|
-
}[TKey];
|
package/dist/types/types.d.ts
DELETED
|
File without changes
|
package/src/modules.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ModulesInstanceType } from '@equinor/fusion-framework-module';
|
|
2
|
-
|
|
3
|
-
import http, { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
4
|
-
import msal, { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
5
|
-
import appConfig, { AppConfigModule } from '@equinor/fusion-framework-react-module-app-config';
|
|
6
|
-
|
|
7
|
-
import { useModules } from '@equinor/fusion-framework-react-module';
|
|
8
|
-
|
|
9
|
-
export type AppModules = [HttpModule, MsalModule, AppConfigModule];
|
|
10
|
-
export type AppModulesInstance = ModulesInstanceType<AppModules>;
|
|
11
|
-
|
|
12
|
-
export const appModules = [http, msal, appConfig];
|
|
13
|
-
|
|
14
|
-
export const useAppModules = useModules<AppModulesInstance>;
|
|
15
|
-
export const useAppModule = <TKey extends keyof AppModulesInstance>(
|
|
16
|
-
module: TKey
|
|
17
|
-
): AppModulesInstance[TKey] => useAppModules()[module];
|
package/src/types.ts
DELETED
|
File without changes
|