@equinor/fusion-framework-react-app 14.1.0 → 14.1.1

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 (93) hide show
  1. package/dist/esm/version.js +1 -1
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/dist/types/version.d.ts +1 -1
  4. package/package.json +33 -30
  5. package/CHANGELOG.md +0 -2785
  6. package/docs/ag-grid.md +0 -70
  7. package/docs/analytics.md +0 -122
  8. package/docs/app.md +0 -148
  9. package/docs/apploader.md +0 -110
  10. package/docs/bookmark.md +0 -108
  11. package/docs/context.md +0 -88
  12. package/docs/feature-flag.md +0 -119
  13. package/docs/framework.md +0 -93
  14. package/docs/help-center.md +0 -88
  15. package/docs/http.md +0 -118
  16. package/docs/msal.md +0 -291
  17. package/docs/navigation.md +0 -80
  18. package/docs/routing.md +0 -86
  19. package/docs/settings.md +0 -139
  20. package/src/__tests__/Apploader.test.tsx +0 -51
  21. package/src/__tests__/fixtures/apploader-child-script.ts +0 -9
  22. package/src/__tests__/render-app.test.tsx +0 -113
  23. package/src/__tests__/testApp.test.tsx +0 -76
  24. package/src/__tests__/useAccessToken.test.tsx +0 -51
  25. package/src/__tests__/useAppSetting.test.tsx +0 -133
  26. package/src/__tests__/useAppSettings.test.tsx +0 -147
  27. package/src/__tests__/useCurrentAccount.test.tsx +0 -32
  28. package/src/__tests__/useCurrentBookmark.test.tsx +0 -108
  29. package/src/__tests__/useCurrentContext.test.tsx +0 -72
  30. package/src/__tests__/useFeature.test.tsx +0 -104
  31. package/src/__tests__/useHelpCenter.test.tsx +0 -64
  32. package/src/__tests__/useStateSyncEvents.test.ts +0 -58
  33. package/src/__tests__/useToken.test.tsx +0 -71
  34. package/src/__tests__/useTrackFeature.test.tsx +0 -83
  35. package/src/ag-grid/community.ts +0 -11
  36. package/src/ag-grid/enterprise.ts +0 -11
  37. package/src/ag-grid/react.ts +0 -11
  38. package/src/ag-grid/testing.ts +0 -19
  39. package/src/ag-grid/theme.ts +0 -17
  40. package/src/ag-grid/useTheme.ts +0 -21
  41. package/src/analytics/README.md +0 -148
  42. package/src/analytics/index.ts +0 -9
  43. package/src/analytics/useTrackFeature.ts +0 -73
  44. package/src/apploader/Apploader.tsx +0 -50
  45. package/src/apploader/README.md +0 -81
  46. package/src/apploader/index.ts +0 -10
  47. package/src/apploader/useApploader.ts +0 -107
  48. package/src/bookmark/index.ts +0 -20
  49. package/src/bookmark/useBookmark.ts +0 -25
  50. package/src/bookmark/useCurrentBookmark.ts +0 -54
  51. package/src/context/index.ts +0 -14
  52. package/src/context/useContextProvider.ts +0 -12
  53. package/src/context/useCurrentContext.ts +0 -20
  54. package/src/create-component.tsx +0 -120
  55. package/src/create-legacy-app.tsx +0 -51
  56. package/src/feature-flag/README.md +0 -20
  57. package/src/feature-flag/enable-feature-flag.ts +0 -79
  58. package/src/feature-flag/index.ts +0 -17
  59. package/src/feature-flag/useFeature.ts +0 -90
  60. package/src/framework/index.ts +0 -14
  61. package/src/framework/useFrameworkCurrentContext.ts +0 -15
  62. package/src/help-center/README.md +0 -21
  63. package/src/help-center/event-name.ts +0 -1
  64. package/src/help-center/index.ts +0 -11
  65. package/src/help-center/useHelpCenter.ts +0 -162
  66. package/src/http/index.ts +0 -10
  67. package/src/http/selectors.ts +0 -9
  68. package/src/index.ts +0 -46
  69. package/src/make-component.tsx +0 -102
  70. package/src/msal/index.ts +0 -16
  71. package/src/msal/useAccessToken.ts +0 -26
  72. package/src/msal/useCurrentAccount.ts +0 -21
  73. package/src/msal/useToken.ts +0 -63
  74. package/src/navigation/index.ts +0 -10
  75. package/src/navigation/useNavigationModule.ts +0 -10
  76. package/src/navigation/useRouter.ts +0 -35
  77. package/src/render-app.ts +0 -35
  78. package/src/render-component.tsx +0 -55
  79. package/src/routing/index.ts +0 -33
  80. package/src/settings/README.md +0 -123
  81. package/src/settings/index.ts +0 -12
  82. package/src/settings/useAppSetting.ts +0 -113
  83. package/src/settings/useAppSettings.ts +0 -103
  84. package/src/settings/useAppSettingsStatus.ts +0 -52
  85. package/src/state/index.ts +0 -12
  86. package/src/state/useAppState.ts +0 -299
  87. package/src/state/useStateSyncEvents.ts +0 -59
  88. package/src/useAppEnvironmentVariables.ts +0 -59
  89. package/src/useAppModule.ts +0 -45
  90. package/src/useAppModules.ts +0 -21
  91. package/src/version.ts +0 -2
  92. package/tsconfig.json +0 -54
  93. package/vitest.config.ts +0 -9
@@ -1,120 +0,0 @@
1
- import type React from 'react';
2
- import { lazy } from 'react';
3
-
4
- import { FrameworkProvider } from '@equinor/fusion-framework-react';
5
- import type { Fusion } from '@equinor/fusion-framework-react';
6
-
7
- import { type AppEnv, configureModules } from '@equinor/fusion-framework-app';
8
- import type { AppModuleInitiator, AppModulesInstance } from '@equinor/fusion-framework-app';
9
-
10
- import type { AnyModule } from '@equinor/fusion-framework-module';
11
-
12
- import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
13
-
14
- import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-react-module';
15
-
16
- export type ComponentRenderArgs<TFusion extends Fusion = Fusion, TEnv = AppEnv> = {
17
- fusion: TFusion;
18
- env: TEnv;
19
- };
20
-
21
- export type ComponentRenderer<TFusion extends Fusion = Fusion, TEnv = AppEnv> = (
22
- fusion: TFusion,
23
- env: TEnv,
24
- ) => React.LazyExoticComponent<React.ComponentType>;
25
-
26
- /**
27
- * @deprecated
28
- * Creates an lazy loading Component which configures modules
29
- * and provides context to framework and configured modules
30
- *
31
- *
32
- * ```mermaid
33
- * sequenceDiagram
34
- * App ->>+Framework: createApp
35
- * Framework->>-Framework: initializeModules
36
- * Framework->>App: configure(modules, framework, args)
37
- * App-->Framework: await configuration
38
- * Framework->>App: React.LazyExoticComponent
39
- * ```
40
- *
41
- * @example
42
- * ```tsx
43
- * const configCallback: AppConfigurator = (configurator) => {
44
- * configurator.configureHttpClient(
45
- * 'bar', {
46
- * baseUri: 'https://somewhere-test.com',
47
- * defaultScopes: ['foo/.default']
48
- * }
49
- * );
50
- * };
51
- *
52
- * export const App = () => {
53
- * const client = useHttpClient('bar');
54
- * const [foo, setFoo] = useState('no value');
55
- * const onClick = useCallback(() => {
56
- * client.fetchAsync('api').then(x => x.json).then(setFoo);
57
- * }, [client]);
58
- * return <Button onClick={onClick}>{foo}</Button>
59
- * }
60
- *
61
- * export const render = createApp(App, configCallback);
62
- *
63
- * export default render;
64
- * ```
65
- *
66
- *
67
- * __Exposed providers__
68
- * @see {@link @equinor/fusion-framework-react.FrameworkProvider | FrameworkProvider}
69
- * @see {@link ModuleProvider | ModuleProvider}
70
- *
71
- * @template TModules module types included in configuration.
72
- * @param Component - React component to render
73
- * @param configure - Callback for configuring application
74
- * @param modules - required modules for application
75
- */
76
- export const createComponent =
77
- <TModules extends Array<AnyModule>, TRef extends Fusion = Fusion, TEnv extends AppEnv = AppEnv>(
78
- Component: React.ElementType,
79
- configure?: AppModuleInitiator<TModules, TRef, TEnv>,
80
- ): ComponentRenderer<TRef, TEnv> =>
81
- (fusion, env) =>
82
- lazy(async () => {
83
- const init = configureModules<TModules, TRef, TEnv>(configure);
84
- // configureModules returns a generic modules instance; narrow it to the
85
- // app-specific shape expected by consumers of this component.
86
- const modules = (await init({
87
- fusion,
88
- env,
89
- })) as unknown as AppModulesInstance;
90
-
91
- modules.event.dispatchEvent('onReactAppLoaded', {
92
- detail: { modules, fusion, env: env },
93
- source: Component,
94
- });
95
- return {
96
- default: () => (
97
- <FrameworkProvider value={fusion}>
98
- <AppModuleProvider value={modules}>
99
- {/* TODO(#5083): tighten generics so Component no longer needs @ts-ignore */}
100
- {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment*/}
101
- {/* @ts-ignore */}
102
- <Component />
103
- </AppModuleProvider>
104
- </FrameworkProvider>
105
- ),
106
- };
107
- });
108
-
109
- declare module '@equinor/fusion-framework-module-event' {
110
- interface FrameworkEventMap {
111
- onReactAppLoaded: FrameworkEvent<
112
- FrameworkEventInit<
113
- { modules: AppModulesInstance; fusion: Fusion; env: AppEnv },
114
- React.ComponentType
115
- >
116
- >;
117
- }
118
- }
119
-
120
- export default createComponent;
@@ -1,51 +0,0 @@
1
- import { Suspense, useMemo, type ElementType } from 'react';
2
-
3
- import { useFramework } from '@equinor/fusion-framework-react';
4
-
5
- import type { AnyModule } from '@equinor/fusion-framework-module';
6
- import type { AppEnv, AppModuleInitiator } from '@equinor/fusion-framework-app';
7
-
8
- import { createComponent } from './create-component';
9
- import type { AppModule } from '@equinor/fusion-framework-module-app';
10
-
11
- /**
12
- * Creates a legacy wrapper component that bootstraps a Fusion React app within
13
- * the older Fusion CLI hosting model.
14
- *
15
- * @deprecated Prefer {@link renderApp} for new applications. This helper exists
16
- * only for backward-compatibility with apps that must run inside the legacy
17
- * Fusion CLI.
18
- *
19
- * @template TModules - Array of additional module types to initialise.
20
- * @param Component - The root React element to render.
21
- * @param configure - Optional callback to configure application modules.
22
- * @returns A React function component that initialises modules and renders the app.
23
- */
24
- export const createLegacyApp = <TModules extends Array<AnyModule>>(
25
- Component: ElementType,
26
- configure?: AppModuleInitiator<TModules>,
27
- ) => {
28
- const LegacyComponent = () => {
29
- const fusion = useFramework<[AppModule]>();
30
- const RenderComponent = useMemo(() => {
31
- const creator = createComponent(Component, configure);
32
- // @eikeland
33
- // TODO(#5084): recheck when legacy fusion-cli is updated!
34
- const appProvider = fusion.modules.app;
35
- // Use the real app config/manifest once the provider has resolved them
36
- if (appProvider?.current) {
37
- const { config, manifest } = appProvider.current;
38
- // Legacy app provider config/manifest predate the strict AppEnv shape; cast until legacy fusion-cli is updated.
39
- return creator(fusion, { config, manifest } as unknown as AppEnv);
40
- }
41
- // No app provider available yet; pass an empty object cast to AppEnv as a placeholder.
42
- return creator(fusion, {} as unknown as AppEnv);
43
- }, [fusion]);
44
- return (
45
- <Suspense fallback={<p>loading app</p>}>
46
- <RenderComponent />
47
- </Suspense>
48
- );
49
- };
50
- return LegacyComponent;
51
- };
@@ -1,20 +0,0 @@
1
- __useFeature__
2
-
3
- Custom hook for accessing and manipulating feature flags.
4
-
5
- ```ts
6
- const Component = () => {
7
- const { feature, toggleFeature } = useFeature('my-feature');
8
- return (
9
- <>
10
- <p>My feature is { feature.enabled ? 'enabled': 'disabled' }</p>
11
- <button onClick={ () => toggleFeature() }>
12
- { feature.enabled ? 'disable' : 'enable' } my feature
13
- </button>
14
- </>
15
- )
16
- }
17
- ```
18
-
19
- > [!NOTE]
20
- > this hook can access parent feature if not found in application
@@ -1,79 +0,0 @@
1
- import type { AppConfigurator, IAppConfigurator } from '@equinor/fusion-framework-app';
2
-
3
- import {
4
- enableFeatureFlagging,
5
- type FeatureFlagBuilderCallback,
6
- type IFeatureFlag,
7
- } from '@equinor/fusion-framework-module-feature-flag';
8
-
9
- import {
10
- createLocalStoragePlugin,
11
- createUrlPlugin,
12
- } from '@equinor/fusion-framework-module-feature-flag/plugins';
13
-
14
- /**
15
- * Enables the specified feature flags.
16
- *
17
- * @param configurator - The AppConfigurator instance.
18
- * @param flags - An array of feature flags to enable.
19
- */
20
- export function enableFeatureFlag(
21
- configurator: IAppConfigurator,
22
- flags: Array<IFeatureFlag<unknown> & { allowUrl?: boolean | undefined }>,
23
- ): void;
24
-
25
- /**
26
- * Enables a feature flag by invoking the provided configurator and callback.
27
- *
28
- * @param configurator - The AppConfigurator responsible for configuring the feature flag.
29
- * @param cb - The FeatureFlagBuilderCallback to be executed for the feature flag.
30
- *
31
- * @remarks
32
- * Advance use __ONLY__
33
- */
34
- export function enableFeatureFlag(
35
- configurator: IAppConfigurator,
36
- cb: FeatureFlagBuilderCallback,
37
- ): void;
38
-
39
- /**
40
- * Enables feature flagging based on the provided configurator and flags callback.
41
- * @param configurator The AppConfigurator instance.
42
- * @param flags_cb Optional flags callback that can be an array of feature flags or a callback function.
43
- */
44
- export function enableFeatureFlag(
45
- configurator: IAppConfigurator,
46
- flags_cb:
47
- | Array<IFeatureFlag<unknown> & { allowUrl?: boolean | undefined }>
48
- | FeatureFlagBuilderCallback,
49
- ): void {
50
- // Dispatch based on whether the caller passed an array of flags or a builder callback
51
- switch (typeof flags_cb) {
52
- case 'function': {
53
- enableFeatureFlagging(configurator, flags_cb);
54
- break;
55
- }
56
- case 'object': {
57
- const urlFlags: IFeatureFlag[] = [];
58
- // Split out flags marked allowUrl so they can be registered with the URL plugin
59
- const localFlags = (flags_cb ?? []).map((flag) => {
60
- const { allowUrl, ...localFlag } = flag;
61
- // Track allowUrl flags separately; they still get registered locally too
62
- if (allowUrl) {
63
- urlFlags.push(flag);
64
- }
65
- return localFlag;
66
- });
67
- enableFeatureFlagging(configurator, async (builder) => {
68
- // TODO(#5086): should unnamed application be allowed to use feature flags?
69
- builder.addPlugin(
70
- createLocalStoragePlugin(localFlags, {
71
- name: (configurator as AppConfigurator).env?.manifest.appKey ?? undefined,
72
- }),
73
- );
74
- builder.addPlugin(createUrlPlugin(urlFlags));
75
- });
76
- break;
77
- }
78
- }
79
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Feature-flag sub-path entry-point.
3
- *
4
- * Provides the {@link enableFeatureFlag} configurator helper and the
5
- * {@link useFeature} hook for reading and toggling feature flags at runtime.
6
- *
7
- * @packageDocumentation
8
- */
9
- export {
10
- IFeatureFlag,
11
- IFeatureFlagProvider,
12
- FeatureFlagModule,
13
- } from '@equinor/fusion-framework-module-feature-flag';
14
-
15
- export { enableFeatureFlag } from './enable-feature-flag';
16
-
17
- export { useFeature } from './useFeature';
@@ -1,90 +0,0 @@
1
- import { useCallback, useMemo } from 'react';
2
-
3
- import { EMPTY, combineLatest, map } from 'rxjs';
4
-
5
- import { useFrameworkModule } from '@equinor/fusion-framework-react';
6
- import { useObservableState } from '@equinor/fusion-observable/react';
7
- import type {
8
- FeatureFlagModule,
9
- IFeatureFlag,
10
- } from '@equinor/fusion-framework-module-feature-flag';
11
- import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selectors';
12
-
13
- import { useAppModule } from '../useAppModule';
14
-
15
- /**
16
- * React hook for reading and toggling a single feature flag.
17
- *
18
- * Merges feature flags from both the framework and the application scope,
19
- * so framework-level flags are visible alongside app-specific ones.
20
- *
21
- * @template T - The type of the feature flag's value payload.
22
- * @param key - The unique key identifying the feature flag.
23
- * @returns An object with:
24
- * - `feature` – the resolved {@link IFeatureFlag}, or `undefined` if not found.
25
- * - `toggleFeature` – callback to toggle the flag; pass `true`/`false` to
26
- * set explicitly, or omit to invert the current state.
27
- * - `error` – any error from the feature-flag observable.
28
- *
29
- * @example
30
- * ```tsx
31
- * const { feature, toggleFeature } = useFeature('dark-mode');
32
- * return (
33
- * <Switch checked={feature?.enabled} onChange={() => toggleFeature()} />
34
- * );
35
- * ```
36
- */
37
- export const useFeature = <T = unknown>(
38
- key: string,
39
- ): {
40
- feature?: IFeatureFlag<T>;
41
- toggleFeature: (enabled?: boolean) => void;
42
- error?: unknown;
43
- } => {
44
- const appProvider = useAppModule<FeatureFlagModule>('featureFlag');
45
- const frameworkProvider = useFrameworkModule<FeatureFlagModule>('featureFlag');
46
-
47
- /** get all available feature flags */
48
- const features$ = useMemo(() => {
49
- /** the framework does not have the feature flag module */
50
- if (!frameworkProvider) {
51
- return appProvider.features$;
52
- }
53
- /** merge feature flags from framework and application */
54
- return combineLatest({
55
- framework: frameworkProvider.features$,
56
- app: appProvider.features$,
57
- }).pipe(
58
- map(({ framework, app }) => {
59
- // Application feature flags override framework defaults with the same key.
60
- const mergedFeatureFlags = { ...framework, ...app };
61
- return mergedFeatureFlags;
62
- }),
63
- );
64
- }, [appProvider, frameworkProvider]);
65
-
66
- /** find feature flag by the provided key */
67
- const feature$ = useMemo(
68
- () =>
69
- features$
70
- // Narrow the merged stream down to the requested feature key.
71
- .pipe(findFeature<T>(key)),
72
- [features$, key],
73
- );
74
-
75
- const { value: feature, error } = useObservableState(feature$ ?? EMPTY);
76
-
77
- const toggleFeature = useCallback(
78
- (enable?: boolean) => {
79
- /** if no value provided, invert the current value */
80
- const enabled = enable === undefined ? !appProvider.getFeature(key)?.enabled : enable;
81
- appProvider.toggleFeature({
82
- key,
83
- enabled,
84
- });
85
- },
86
- [appProvider, key],
87
- );
88
-
89
- return { feature, toggleFeature, error };
90
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * Framework sub-path entry-point.
3
- *
4
- * Re-exports framework-level hooks (as opposed to application-scoped ones)
5
- * for accessing the Fusion instance, current user, and HTTP clients.
6
- *
7
- * @packageDocumentation
8
- */
9
- export { useFramework } from '@equinor/fusion-framework-react';
10
-
11
- export {
12
- useCurrentUser,
13
- useHttpClient as useFrameworkHttpClient,
14
- } from '@equinor/fusion-framework-react/hooks';
@@ -1,15 +0,0 @@
1
- import { useFramework } from '@equinor/fusion-framework-react';
2
- import { useCurrentContext } from '@equinor/fusion-framework-react-module-context';
3
-
4
- /**
5
- * React hook that returns the currently selected context from the
6
- * **framework-level** context module (as opposed to the application-scoped one).
7
- *
8
- * Use this when you need the portal/host context rather than the app's own
9
- * context provider.
10
- *
11
- * @returns The current framework context, or `undefined` if none is selected.
12
- */
13
- export const useFrameworkCurrentContext = () => useCurrentContext(useFramework().modules.context);
14
-
15
- export default useFrameworkCurrentContext;
@@ -1,21 +0,0 @@
1
- ## Help center
2
-
3
- ### useHelpCenter
4
-
5
- A hook to open the help center side sheet programmatically.
6
-
7
- ```typescript
8
- const {
9
- openHelp,
10
- openArticle,
11
- openFaqs,
12
- openSearch,
13
- openGovernance
14
- } = useHelpCenter();
15
-
16
- openHelp();
17
- openArticle('article-slug-name');
18
- openFaqs();
19
- openSearch('search-input');
20
- openGovernance();
21
- ```
@@ -1 +0,0 @@
1
- export const EVENT_NAME = '@Portal::FusionHelp::open';
@@ -1,11 +0,0 @@
1
- import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
- import type { HelpCenterOpenEventDetail } from './useHelpCenter';
3
-
4
- export { useHelpCenter } from './useHelpCenter';
5
- export type { HelpCenterOpenEventDetail } from './useHelpCenter';
6
-
7
- declare module '@equinor/fusion-framework-module-event' {
8
- interface FrameworkEventMap {
9
- '@Portal::FusionHelp::open': FrameworkEvent<FrameworkEventInit<HelpCenterOpenEventDetail>>;
10
- }
11
- }
@@ -1,162 +0,0 @@
1
- import { useCallback } from 'react';
2
- import useAppModule from '../useAppModule';
3
-
4
- import { EVENT_NAME } from './event-name.js';
5
-
6
- type HelpCenterEventDetailBase<
7
- T extends string,
8
- V extends Record<string, unknown> = Record<string, unknown>,
9
- > = {
10
- page: T;
11
- } & V;
12
-
13
- type OpenHelpDetail = HelpCenterEventDetailBase<'home'>;
14
-
15
- type OpenArticleDetail = HelpCenterEventDetailBase<
16
- 'article',
17
- {
18
- articleId: string;
19
- }
20
- >;
21
-
22
- type OpenFaqsDetail = HelpCenterEventDetailBase<'faqs'>;
23
-
24
- type OpenSearchDetail = HelpCenterEventDetailBase<
25
- 'search',
26
- {
27
- search: string;
28
- }
29
- >;
30
-
31
- type OpenGovernanceDetail = HelpCenterEventDetailBase<'governance'>;
32
-
33
- export type HelpCenterOpenEventDetail =
34
- | OpenHelpDetail
35
- | OpenArticleDetail
36
- | OpenFaqsDetail
37
- | OpenSearchDetail
38
- | OpenGovernanceDetail;
39
-
40
- /**
41
- * Interface for requesting help features.
42
- */
43
- export interface HelpCenter {
44
- /**
45
- * Requesting the portal to open the help sidesheet on the normal page
46
- */
47
- openHelp(): void;
48
-
49
- /**
50
- * Requesting the portal to open the help sidesheet on the article page.
51
- *
52
- * @param {string} articleId - The articleId, slug or identifier to show.
53
- */
54
- openArticle(articleId: string): void;
55
-
56
- /**
57
- * Requesting the portal to open the help sidesheet on the FAQs page.
58
- */
59
- openFaqs(): void;
60
-
61
- /**
62
- * Requesting the portal to open the help sidesheet on the search page.
63
- *
64
- * @param {string} search - The search string.
65
- */
66
- openSearch(search: string): void;
67
-
68
- /**
69
- * Requesting the portal to open the help sidesheet on the governance tab.
70
- */
71
- openGovernance(): void;
72
-
73
- /**
74
- * Requesting the portal to open the help sidesheet on the release notes page.
75
- */
76
- openReleaseNotes(): void;
77
- }
78
-
79
- /**
80
- * React hook that returns an API for opening the portal help-center sidesheet.
81
- *
82
- * Each method dispatches a framework event that the portal shell listens for
83
- * and opens the corresponding help page.
84
- *
85
- * @returns A {@link HelpCenter} object with methods to open specific help pages.
86
- *
87
- * @example
88
- * ```tsx
89
- * const helpCenter = useHelpCenter();
90
- * <Button onClick={() => helpCenter.openFaqs()}>FAQs</Button>
91
- * ```
92
- */
93
- export const useHelpCenter = (): HelpCenter => {
94
- const eventModule = useAppModule('event');
95
-
96
- const openHelp = useCallback((): void => {
97
- eventModule.dispatchEvent(EVENT_NAME, {
98
- detail: {
99
- page: 'home',
100
- },
101
- });
102
- }, [eventModule]);
103
-
104
- const openArticle = useCallback(
105
- (articleId: string): void => {
106
- eventModule.dispatchEvent(EVENT_NAME, {
107
- detail: {
108
- page: 'article',
109
- articleId: articleId,
110
- },
111
- });
112
- },
113
- [eventModule],
114
- );
115
-
116
- const openFaqs = useCallback((): void => {
117
- eventModule.dispatchEvent(EVENT_NAME, {
118
- detail: {
119
- page: 'faqs',
120
- },
121
- });
122
- }, [eventModule]);
123
-
124
- const openSearch = useCallback(
125
- (search: string): void => {
126
- eventModule.dispatchEvent(EVENT_NAME, {
127
- detail: {
128
- page: 'search',
129
- search: search,
130
- },
131
- });
132
- },
133
- [eventModule],
134
- );
135
-
136
- const openGovernance = useCallback((): void => {
137
- eventModule.dispatchEvent(EVENT_NAME, {
138
- detail: {
139
- page: 'governance',
140
- },
141
- });
142
- }, [eventModule]);
143
-
144
- const openReleaseNotes = useCallback((): void => {
145
- eventModule.dispatchEvent(EVENT_NAME, {
146
- detail: {
147
- page: 'release-notes',
148
- },
149
- });
150
- }, [eventModule]);
151
-
152
- return {
153
- openHelp,
154
- openArticle,
155
- openFaqs,
156
- openSearch,
157
- openGovernance,
158
- openReleaseNotes,
159
- };
160
- };
161
-
162
- export default useHelpCenter;
package/src/http/index.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * HTTP sub-path entry-point.
3
- *
4
- * Re-exports hooks from `@equinor/fusion-framework-react-module-http`,
5
- * including {@link useHttpClient} for making authenticated HTTP requests
6
- * from within a Fusion application.
7
- *
8
- * @packageDocumentation
9
- */
10
- export * from '@equinor/fusion-framework-react-module-http';
@@ -1,9 +0,0 @@
1
- /**
2
- * HTTP selector utilities.
3
- *
4
- * Re-exports response-selector helpers (e.g. JSON, blob, text selectors)
5
- * from `@equinor/fusion-framework-module-http/selectors`.
6
- *
7
- * @packageDocumentation
8
- */
9
- export * from '@equinor/fusion-framework-module-http/selectors';
package/src/index.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * @packageDocumentation
3
- *
4
- * React bindings for building Fusion Framework applications.
5
- *
6
- * Provides the main entry-point helpers (`renderApp`, `createComponent`, `makeComponent`)
7
- * plus React hooks for accessing framework modules (HTTP, auth, context, navigation, etc.)
8
- * from within a Fusion app.
9
- *
10
- * @remarks
11
- * This is the primary package application developers depend on when building
12
- * React-based Fusion apps. It re-exports core types from `@equinor/fusion-framework-app`
13
- * and adds React-specific rendering, hooks, and sub-path entry-points for optional
14
- * modules such as MSAL, feature flags, bookmarks, analytics, and settings.
15
- */
16
-
17
- export type {
18
- AppConfig,
19
- AppEnv,
20
- AppModuleInitiator,
21
- AppModules,
22
- AppModulesInstance,
23
- AppRenderFn,
24
- IAppConfigurator,
25
- } from '@equinor/fusion-framework-app';
26
-
27
- export type { Fusion } from '@equinor/fusion-framework-react';
28
-
29
- export { AppManifest } from '@equinor/fusion-framework-module-app';
30
-
31
- export { useAppModule } from './useAppModule';
32
- export { useAppModules } from './useAppModules';
33
- export { useAppEnvironmentVariables } from './useAppEnvironmentVariables';
34
-
35
- export { makeComponent, ComponentRenderArgs } from './make-component';
36
-
37
- export { createLegacyApp } from './create-legacy-app';
38
-
39
- export { createComponent } from './create-component';
40
- export { renderApp } from './render-app';
41
- export { renderComponent } from './render-component';
42
-
43
- export type { ComponentRenderer } from './create-component';
44
- export type { RenderTeardown } from './render-component';
45
-
46
- export { default } from './render-app';