@equinor/fusion-framework-react-app 6.0.0 → 6.0.2
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 +457 -433
- package/dist/esm/ag-grid/useTheme.js.map +1 -1
- package/dist/esm/bookmark/useBookmark.js.map +1 -1
- package/dist/esm/bookmark/useCurrentBookmark.js.map +1 -1
- package/dist/esm/create-component.js.map +1 -1
- package/dist/esm/create-legacy-app.js +1 -0
- package/dist/esm/create-legacy-app.js.map +1 -1
- package/dist/esm/feature-flag/enable-feature-flag.js.map +1 -1
- package/dist/esm/feature-flag/useFeature.js.map +1 -1
- package/dist/esm/framework/index.js.map +1 -1
- package/dist/esm/make-component.js.map +1 -1
- package/dist/esm/msal/useAccessToken.js.map +1 -1
- package/dist/esm/msal/useCurrentAccount.js.map +1 -1
- package/dist/esm/msal/useToken.js.map +1 -1
- package/dist/esm/navigation/useRouter.js.map +1 -1
- package/dist/esm/render-app.js.map +1 -1
- package/dist/esm/render-component.js.map +1 -1
- package/dist/esm/settings/useAppSetting.js +1 -2
- package/dist/esm/settings/useAppSetting.js.map +1 -1
- package/dist/esm/settings/useAppSettings.js +1 -2
- package/dist/esm/settings/useAppSettings.js.map +1 -1
- package/dist/esm/settings/useAppSettingsStatus.js.map +1 -1
- package/dist/esm/useAppEnvironmentVariables.js.map +1 -1
- package/dist/esm/useAppModule.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ag-grid/useTheme.d.ts +1 -1
- package/dist/types/bookmark/useCurrentBookmark.d.ts +1 -1
- package/dist/types/create-component.d.ts +2 -2
- package/dist/types/create-legacy-app.d.ts +2 -1
- package/dist/types/feature-flag/enable-feature-flag.d.ts +5 -17
- package/dist/types/feature-flag/useFeature.d.ts +1 -1
- package/dist/types/make-component.d.ts +2 -2
- package/dist/types/msal/useCurrentAccount.d.ts +1 -1
- package/dist/types/msal/useToken.d.ts +1 -1
- package/dist/types/navigation/useNavigationModule.d.ts +1 -1
- package/dist/types/navigation/useRouter.d.ts +1 -1
- package/dist/types/render-app.d.ts +2 -1
- package/dist/types/settings/useAppSettings.d.ts +1 -1
- package/dist/types/useAppEnvironmentVariables.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +18 -18
- package/src/ag-grid/useTheme.ts +7 -7
- package/src/bookmark/index.ts +5 -5
- package/src/bookmark/useBookmark.ts +2 -2
- package/src/bookmark/useCurrentBookmark.ts +17 -17
- package/src/context/useContextProvider.ts +1 -1
- package/src/create-component.tsx +40 -39
- package/src/create-legacy-app.tsx +25 -24
- package/src/feature-flag/enable-feature-flag.ts +42 -43
- package/src/feature-flag/index.ts +3 -3
- package/src/feature-flag/useFeature.ts +40 -40
- package/src/framework/index.ts +2 -2
- package/src/index.ts +7 -7
- package/src/make-component.tsx +34 -33
- package/src/msal/useAccessToken.ts +3 -3
- package/src/msal/useCurrentAccount.ts +3 -3
- package/src/msal/useToken.ts +16 -16
- package/src/navigation/useNavigationModule.ts +1 -1
- package/src/navigation/useRouter.ts +4 -4
- package/src/render-app.ts +5 -5
- package/src/render-component.tsx +16 -16
- package/src/settings/useAppSetting.ts +49 -50
- package/src/settings/useAppSettings.ts +38 -39
- package/src/settings/useAppSettingsStatus.ts +19 -19
- package/src/useAppEnvironmentVariables.ts +20 -20
- package/src/useAppModule.ts +15 -15
- package/src/useAppModules.ts +1 -1
- package/src/version.ts +1 -1
- package/src/widget/index.ts +4 -4
|
@@ -4,8 +4,8 @@ import { map } from 'rxjs';
|
|
|
4
4
|
import type { IApp } from '@equinor/fusion-framework-module-app';
|
|
5
5
|
|
|
6
6
|
export type AppSettingsStatusHooks = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
onLoading?: (isLoading: boolean) => void;
|
|
8
|
+
onUpdating?: (isUpdating: boolean) => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -26,23 +26,23 @@ export type AppSettingsStatusHooks = {
|
|
|
26
26
|
* useAppSettingsStatus(app, hooks);
|
|
27
27
|
*/
|
|
28
28
|
export const useAppSettingsStatus = (app: IApp | null, hooks?: AppSettingsStatusHooks) => {
|
|
29
|
-
|
|
29
|
+
const { onLoading, onUpdating } = hooks ?? {};
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
if (app && onLoading) {
|
|
33
|
+
const subscription = app.status$
|
|
34
|
+
.pipe(map((status) => status.has('fetch_settings')))
|
|
35
|
+
.subscribe(onLoading);
|
|
36
|
+
return () => subscription.unsubscribe();
|
|
37
|
+
}
|
|
38
|
+
}, [app, onLoading]);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
useLayoutEffect(() => {
|
|
41
|
+
if (app && onUpdating) {
|
|
42
|
+
const subscription = app.status$
|
|
43
|
+
.pipe(map((status) => status.has('update_settings')))
|
|
44
|
+
.subscribe(onUpdating);
|
|
45
|
+
return () => subscription.unsubscribe();
|
|
46
|
+
}
|
|
47
|
+
}, [app, onUpdating]);
|
|
48
48
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ConfigEnvironment } from '@equinor/fusion-framework-module-app';
|
|
1
|
+
import type { ConfigEnvironment } from '@equinor/fusion-framework-module-app';
|
|
2
2
|
import { useCurrentApp } from '@equinor/fusion-framework-react/app';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type ObservableStateReturnType,
|
|
5
|
+
useObservableSelector,
|
|
6
|
+
useObservableState,
|
|
7
7
|
} from '@equinor/fusion-observable/react';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -32,24 +32,24 @@ import {
|
|
|
32
32
|
* @returns An observable state object containing the current environment configuration.
|
|
33
33
|
*/
|
|
34
34
|
export const useAppEnvironmentVariables = <
|
|
35
|
-
|
|
35
|
+
TEnvironmentVariables extends ConfigEnvironment = ConfigEnvironment,
|
|
36
36
|
>(): ObservableStateReturnType<TEnvironmentVariables> => {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Get the current app module instance from the framework
|
|
38
|
+
const app = useCurrentApp<[], TEnvironmentVariables>().currentApp;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
// Ensure the app module is available before proceeding
|
|
41
|
+
if (!app) {
|
|
42
|
+
throw Error('Framework is missing app module');
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
// Get the environment configuration observable from the app module
|
|
46
|
+
const env$ = useObservableSelector(
|
|
47
|
+
app.getConfig(),
|
|
48
|
+
(config) => config.environment as TEnvironmentVariables,
|
|
49
|
+
);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
// Return the observable state of the environment configuration
|
|
52
|
+
return useObservableState(env$, {
|
|
53
|
+
initial: app.config?.environment,
|
|
54
|
+
});
|
|
55
55
|
};
|
package/src/useAppModule.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AppModules, AppModulesInstance } from '@equinor/fusion-framework-app';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
AnyModule,
|
|
4
|
+
ModuleKey,
|
|
5
|
+
ModuleType,
|
|
6
|
+
ModuleTypes,
|
|
7
7
|
} from '@equinor/fusion-framework-module';
|
|
8
8
|
|
|
9
9
|
import { useAppModules } from './useAppModules';
|
|
@@ -17,20 +17,20 @@ import { useAppModules } from './useAppModules';
|
|
|
17
17
|
* @returns The app module instance if found, otherwise throws an error.
|
|
18
18
|
*/
|
|
19
19
|
export function useAppModule<
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
TType extends AnyModule | unknown = unknown,
|
|
21
|
+
TKey extends string = ModuleKey<ModuleTypes<AppModules<[TType]>>>,
|
|
22
22
|
>(
|
|
23
|
-
|
|
23
|
+
module: TKey,
|
|
24
24
|
): TType extends AnyModule
|
|
25
|
+
? ModuleType<TType>
|
|
26
|
+
: AppModulesInstance[Extract<keyof AppModulesInstance, TKey>] {
|
|
27
|
+
const appModule = useAppModules()[module as keyof AppModulesInstance];
|
|
28
|
+
if (!appModule) {
|
|
29
|
+
throw Error(`the requested module [${module}] is not included in the app scope`);
|
|
30
|
+
}
|
|
31
|
+
return appModule as TType extends AnyModule
|
|
25
32
|
? ModuleType<TType>
|
|
26
|
-
: AppModulesInstance[Extract<keyof AppModulesInstance, TKey>]
|
|
27
|
-
const appModule = useAppModules()[module as keyof AppModulesInstance];
|
|
28
|
-
if (!appModule) {
|
|
29
|
-
throw Error(`the requested module [${module}] is not included in the app scope`);
|
|
30
|
-
}
|
|
31
|
-
return appModule as TType extends AnyModule
|
|
32
|
-
? ModuleType<TType>
|
|
33
|
-
: AppModulesInstance[Extract<keyof AppModulesInstance, TKey>];
|
|
33
|
+
: AppModulesInstance[Extract<keyof AppModulesInstance, TKey>];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export default useAppModule;
|
package/src/useAppModules.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { useModules } from '@equinor/fusion-framework-react-module';
|
|
|
9
9
|
* @returns An instance of the app modules.
|
|
10
10
|
*/
|
|
11
11
|
export const useAppModules = <
|
|
12
|
-
|
|
12
|
+
T extends Array<AnyModule> | unknown = unknown,
|
|
13
13
|
>(): AppModulesInstance<T> => useModules<AppModulesInstance<T>>();
|
|
14
14
|
|
|
15
15
|
export default useAppModules;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '6.0.
|
|
2
|
+
export const version = '6.0.2';
|
package/src/widget/index.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { WidgetModuleInitiator } from '@equinor/fusion-framework-react-widget';
|
|
6
6
|
export type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
WidgetProps,
|
|
8
|
+
WidgetModule,
|
|
9
|
+
WidgetRenderArgs,
|
|
10
|
+
WidgetStateInitial,
|
|
11
11
|
} from '@equinor/fusion-framework-react-widget';
|
|
12
12
|
export { Widget } from '@equinor/fusion-framework-react-widget';
|
|
13
13
|
export { Widget as default } from '@equinor/fusion-framework-react-widget';
|