@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +457 -433
  2. package/dist/esm/ag-grid/useTheme.js.map +1 -1
  3. package/dist/esm/bookmark/useBookmark.js.map +1 -1
  4. package/dist/esm/bookmark/useCurrentBookmark.js.map +1 -1
  5. package/dist/esm/create-component.js.map +1 -1
  6. package/dist/esm/create-legacy-app.js +1 -0
  7. package/dist/esm/create-legacy-app.js.map +1 -1
  8. package/dist/esm/feature-flag/enable-feature-flag.js.map +1 -1
  9. package/dist/esm/feature-flag/useFeature.js.map +1 -1
  10. package/dist/esm/framework/index.js.map +1 -1
  11. package/dist/esm/make-component.js.map +1 -1
  12. package/dist/esm/msal/useAccessToken.js.map +1 -1
  13. package/dist/esm/msal/useCurrentAccount.js.map +1 -1
  14. package/dist/esm/msal/useToken.js.map +1 -1
  15. package/dist/esm/navigation/useRouter.js.map +1 -1
  16. package/dist/esm/render-app.js.map +1 -1
  17. package/dist/esm/render-component.js.map +1 -1
  18. package/dist/esm/settings/useAppSetting.js +1 -2
  19. package/dist/esm/settings/useAppSetting.js.map +1 -1
  20. package/dist/esm/settings/useAppSettings.js +1 -2
  21. package/dist/esm/settings/useAppSettings.js.map +1 -1
  22. package/dist/esm/settings/useAppSettingsStatus.js.map +1 -1
  23. package/dist/esm/useAppEnvironmentVariables.js.map +1 -1
  24. package/dist/esm/useAppModule.js.map +1 -1
  25. package/dist/esm/version.js +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/types/ag-grid/useTheme.d.ts +1 -1
  28. package/dist/types/bookmark/useCurrentBookmark.d.ts +1 -1
  29. package/dist/types/create-component.d.ts +2 -2
  30. package/dist/types/create-legacy-app.d.ts +2 -1
  31. package/dist/types/feature-flag/enable-feature-flag.d.ts +5 -17
  32. package/dist/types/feature-flag/useFeature.d.ts +1 -1
  33. package/dist/types/make-component.d.ts +2 -2
  34. package/dist/types/msal/useCurrentAccount.d.ts +1 -1
  35. package/dist/types/msal/useToken.d.ts +1 -1
  36. package/dist/types/navigation/useNavigationModule.d.ts +1 -1
  37. package/dist/types/navigation/useRouter.d.ts +1 -1
  38. package/dist/types/render-app.d.ts +2 -1
  39. package/dist/types/settings/useAppSettings.d.ts +1 -1
  40. package/dist/types/useAppEnvironmentVariables.d.ts +1 -1
  41. package/dist/types/version.d.ts +1 -1
  42. package/package.json +18 -18
  43. package/src/ag-grid/useTheme.ts +7 -7
  44. package/src/bookmark/index.ts +5 -5
  45. package/src/bookmark/useBookmark.ts +2 -2
  46. package/src/bookmark/useCurrentBookmark.ts +17 -17
  47. package/src/context/useContextProvider.ts +1 -1
  48. package/src/create-component.tsx +40 -39
  49. package/src/create-legacy-app.tsx +25 -24
  50. package/src/feature-flag/enable-feature-flag.ts +42 -43
  51. package/src/feature-flag/index.ts +3 -3
  52. package/src/feature-flag/useFeature.ts +40 -40
  53. package/src/framework/index.ts +2 -2
  54. package/src/index.ts +7 -7
  55. package/src/make-component.tsx +34 -33
  56. package/src/msal/useAccessToken.ts +3 -3
  57. package/src/msal/useCurrentAccount.ts +3 -3
  58. package/src/msal/useToken.ts +16 -16
  59. package/src/navigation/useNavigationModule.ts +1 -1
  60. package/src/navigation/useRouter.ts +4 -4
  61. package/src/render-app.ts +5 -5
  62. package/src/render-component.tsx +16 -16
  63. package/src/settings/useAppSetting.ts +49 -50
  64. package/src/settings/useAppSettings.ts +38 -39
  65. package/src/settings/useAppSettingsStatus.ts +19 -19
  66. package/src/useAppEnvironmentVariables.ts +20 -20
  67. package/src/useAppModule.ts +15 -15
  68. package/src/useAppModules.ts +1 -1
  69. package/src/version.ts +1 -1
  70. 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
- onLoading?: (isLoading: boolean) => void;
8
- onUpdating?: (isUpdating: boolean) => void;
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
- const { onLoading, onUpdating } = hooks ?? {};
29
+ const { onLoading, onUpdating } = hooks ?? {};
30
30
 
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]);
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
- 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]);
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
- type ObservableStateReturnType,
5
- useObservableSelector,
6
- useObservableState,
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
- TEnvironmentVariables extends ConfigEnvironment = ConfigEnvironment,
35
+ TEnvironmentVariables extends ConfigEnvironment = ConfigEnvironment,
36
36
  >(): ObservableStateReturnType<TEnvironmentVariables> => {
37
- // Get the current app module instance from the framework
38
- const app = useCurrentApp<[], TEnvironmentVariables>().currentApp;
37
+ // Get the current app module instance from the framework
38
+ const app = useCurrentApp<[], TEnvironmentVariables>().currentApp;
39
39
 
40
- // Ensure the app module is available before proceeding
41
- if (!app) {
42
- throw Error('Framework is missing app module');
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
- // Get the environment configuration observable from the app module
46
- const env$ = useObservableSelector(
47
- app.getConfig(),
48
- (config) => config.environment as TEnvironmentVariables,
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
- // Return the observable state of the environment configuration
52
- return useObservableState(env$, {
53
- initial: app.config?.environment,
54
- });
51
+ // Return the observable state of the environment configuration
52
+ return useObservableState(env$, {
53
+ initial: app.config?.environment,
54
+ });
55
55
  };
@@ -1,9 +1,9 @@
1
1
  import type { AppModules, AppModulesInstance } from '@equinor/fusion-framework-app';
2
2
  import type {
3
- AnyModule,
4
- ModuleKey,
5
- ModuleType,
6
- ModuleTypes,
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
- TType extends AnyModule | unknown = unknown,
21
- TKey extends string = ModuleKey<ModuleTypes<AppModules<[TType]>>>,
20
+ TType extends AnyModule | unknown = unknown,
21
+ TKey extends string = ModuleKey<ModuleTypes<AppModules<[TType]>>>,
22
22
  >(
23
- module: TKey,
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;
@@ -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
- T extends Array<AnyModule> | unknown = unknown,
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.0';
2
+ export const version = '6.0.2';
@@ -4,10 +4,10 @@
4
4
  */
5
5
  export type { WidgetModuleInitiator } from '@equinor/fusion-framework-react-widget';
6
6
  export type {
7
- WidgetProps,
8
- WidgetModule,
9
- WidgetRenderArgs,
10
- WidgetStateInitial,
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';