@equinor/fusion-framework-react-app 14.1.0 → 14.1.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 (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,119 +0,0 @@
1
- # Feature Flag
2
-
3
- Add, read, and toggle feature flags in your Fusion app.
4
-
5
- > [!NOTE]
6
- > Requires `@equinor/fusion-framework-module-feature-flag` to be installed as a dependency. The `enableFeatureFlag` helper and `useFeature` hook will not work without it.
7
-
8
- **Import:**
9
-
10
- ```ts
11
- import { enableFeatureFlag, useFeature } from '@equinor/fusion-framework-react-app/feature-flag';
12
- ```
13
-
14
- ## Overview
15
-
16
- Feature flags let you ship code behind a toggle — enabling gradual rollouts, A/B testing, or developer-only features. The `enableFeatureFlag` helper registers flags in your app's configurator, and the `useFeature` hook reads and toggles them at runtime. Framework-level flags are also visible through this hook.
17
-
18
- ## Configure Feature Flags
19
-
20
- Register flags in your app's configuration callback. Each flag has a `key`, a `title`, and optionally `allowUrl` to enable URL-driven overrides (e.g. `?my-flag=true`):
21
-
22
- ```ts
23
- import { enableFeatureFlag } from '@equinor/fusion-framework-react-app/feature-flag';
24
-
25
- export const configure = (configurator) => {
26
- enableFeatureFlag(configurator, [
27
- {
28
- key: 'dark-mode',
29
- title: 'Dark Mode',
30
- enabled: false,
31
- },
32
- {
33
- key: 'beta-dashboard',
34
- title: 'Beta Dashboard',
35
- enabled: false,
36
- allowUrl: true, // can be toggled via URL query parameter — requires the navigation module to be registered
37
- },
38
- ]);
39
- };
40
- ```
41
-
42
- ## useFeature
43
-
44
- Reads a single feature flag by key and provides a toggle callback. Merges feature flags from both the framework scope and the application scope, so framework-level flags are visible alongside app-specific ones.
45
-
46
- **Signature:**
47
-
48
- ```ts
49
- function useFeature<T = unknown>(key: string): {
50
- feature?: IFeatureFlag<T>;
51
- toggleFeature: (enabled?: boolean) => void;
52
- error?: unknown;
53
- };
54
- ```
55
-
56
- **Returns:**
57
-
58
- | Property | Type | Description |
59
- | --------------- | --------------------------- | ----------------------------------------------------- |
60
- | `feature` | `IFeatureFlag<T> \| undefined` | The resolved feature flag, or `undefined` if not found |
61
- | `toggleFeature` | `(enabled?: boolean) => void` | Toggle the flag; pass `true`/`false` to set explicitly, or omit to invert |
62
- | `error` | `unknown` | Any error from the feature-flag observable |
63
-
64
- ### End-to-End Example
65
-
66
- ```tsx
67
- import { useFeature } from '@equinor/fusion-framework-react-app/feature-flag';
68
-
69
- const Dashboard = () => {
70
- const { feature, toggleFeature } = useFeature('beta-dashboard');
71
-
72
- return (
73
- <div>
74
- <button onClick={() => toggleFeature()}>
75
- {feature?.enabled ? 'Disable' : 'Enable'} beta dashboard
76
- </button>
77
- {feature?.enabled && <BetaDashboard />}
78
- </div>
79
- );
80
- };
81
- ```
82
-
83
- ### Read-Only Flag Check
84
-
85
- ```tsx
86
- import { useFeature } from '@equinor/fusion-framework-react-app/feature-flag';
87
-
88
- const FeatureGate = ({ flagKey, children }: { flagKey: string; children: React.ReactNode }) => {
89
- const { feature } = useFeature(flagKey);
90
- if (!feature?.enabled) return null;
91
- return <>{children}</>;
92
- };
93
- ```
94
-
95
- ## Advanced Configuration
96
-
97
- For advanced scenarios, pass a builder callback instead of an array. The builder exposes `addPlugin` — use it to register feature sources such as the local-storage or URL plugin directly:
98
-
99
- ```ts
100
- import { enableFeatureFlag } from '@equinor/fusion-framework-react-app/feature-flag';
101
- import {
102
- createLocalStoragePlugin,
103
- createUrlPlugin,
104
- } from '@equinor/fusion-framework-module-feature-flag/plugins';
105
-
106
- export const configure = (configurator) => {
107
- enableFeatureFlag(configurator, (builder) => {
108
- builder.addPlugin(createLocalStoragePlugin([{ key: 'dark-mode', title: 'Dark Mode', enabled: false }]));
109
- // only add URL plugin if your app also registers the navigation module
110
- builder.addPlugin(createUrlPlugin([{ key: 'beta-dashboard', title: 'Beta Dashboard', enabled: false }]));
111
- });
112
- };
113
- ```
114
-
115
- ## Notes
116
-
117
- - Framework-level flags are merged with app-level flags — if both define the same key, the app-level flag takes precedence
118
- - **Array overload**: local-storage persistence and URL override support are wired automatically. Flags with `allowUrl: true` are passed to the URL plugin (requires the `navigation` module)
119
- - **Builder-callback overload**: no plugins are added automatically — add `createLocalStoragePlugin` and/or `createUrlPlugin` explicitly if you need persistence or URL overrides
package/docs/framework.md DELETED
@@ -1,93 +0,0 @@
1
- # Framework
2
-
3
- Access framework-level (portal/host) context and services from within your app.
4
-
5
- **Import:**
6
-
7
- ```ts
8
- import { useFramework, useCurrentUser, useFrameworkHttpClient } from '@equinor/fusion-framework-react-app/framework';
9
- // useFrameworkCurrentContext is exported from the /context sub-path:
10
- import { useFrameworkCurrentContext } from '@equinor/fusion-framework-react-app/context';
11
- ```
12
-
13
- ## When to Use
14
-
15
- Most apps should use the **app-scoped** hooks from the `/context` sub-path (`@equinor/fusion-framework-react-app/context`). The framework sub-path is for specific cases where you need data from the portal/host level, regardless of your app's own module configuration.
16
-
17
- > [!NOTE]
18
- > **Prefer `/context` unless you specifically need framework-level context.**
19
- >
20
- > `useCurrentContext` (from `/context`) reads from your app's own context module.
21
- > `useFrameworkCurrentContext` (also from `/context`) reads from the portal's context, bypassing your app's context module entirely.
22
-
23
- ## useFrameworkCurrentContext
24
-
25
- Returns the currently selected context from the **framework-level** context module — the portal or host application's context, not your app's.
26
-
27
- Use this when your app hasn't configured its own context module but still needs to read what context the portal has selected.
28
-
29
- **Signature:**
30
-
31
- ```ts
32
- function useFrameworkCurrentContext(): {
33
- currentContext: ContextItem | undefined;
34
- setCurrentContext: (entry?: ContextItem | string | null) => void | Promise<ContextItem | null>;
35
- };
36
- ```
37
-
38
- **Returns:** An object with `currentContext` (the portal's active context, or `undefined` if none is selected) and `setCurrentContext` to change it. Clearing (no argument or `null`) returns `void`; setting by `id` or by item returns a `Promise` that resolves once the switch completes.
39
-
40
- **Example:**
41
-
42
- ```tsx
43
- import { useFrameworkCurrentContext } from '@equinor/fusion-framework-react-app/context';
44
-
45
- const PortalContextInfo = () => {
46
- const { currentContext } = useFrameworkCurrentContext();
47
-
48
- if (!currentContext) return <p>No portal context selected</p>;
49
-
50
- return <p>Portal context: {currentContext.title}</p>;
51
- };
52
- ```
53
-
54
- ## useFramework
55
-
56
- Returns the Fusion framework instance directly, giving access to all framework-level modules.
57
-
58
- **Signature:**
59
-
60
- ```ts
61
- function useFramework(): Fusion;
62
- ```
63
-
64
- ## useCurrentUser
65
-
66
- Returns the currently authenticated user from the framework.
67
-
68
- **Signature:**
69
-
70
- ```ts
71
- function useCurrentUser(): AccountInfo | undefined;
72
- ```
73
-
74
- ## useFrameworkHttpClient
75
-
76
- Returns an HTTP client from the framework-level HTTP module (not your app's configured clients). Useful for accessing portal-provided API clients.
77
-
78
- **Signature:**
79
-
80
- ```ts
81
- function useFrameworkHttpClient(name: 'portal' | 'people'): IHttpClient;
82
- ```
83
-
84
- **Throws** if no client is configured for the given key.
85
-
86
- ## App-Scoped vs Framework-Scoped
87
-
88
- | Need | Use | Sub-path |
89
- | --------------------------------------------- | ---------------------------- | ------------- |
90
- | Context your app configured | `useCurrentContext` | `/context` |
91
- | Portal-level context (no app context module) | `useFrameworkCurrentContext` | `/context` |
92
- | App-specific HTTP client | `useHttpClient` | `/http` |
93
- | Portal-level HTTP client | `useFrameworkHttpClient` | `/framework` |
@@ -1,88 +0,0 @@
1
- # Help Center
2
-
3
- Open the Fusion portal help sidesheet programmatically from your app using the `useHelpCenter` hook.
4
-
5
- **Import:**
6
-
7
- ```ts
8
- import { useHelpCenter } from '@equinor/fusion-framework-react-app/help-center';
9
- ```
10
-
11
- > [!NOTE]
12
- > This hook dispatches a framework event to the portal shell. The help module must be enabled by the host — your app does not configure it directly.
13
-
14
- ## useHelpCenter
15
-
16
- Returns an object with methods for opening specific pages of the portal help sidesheet.
17
-
18
- **Signature:**
19
-
20
- ```ts
21
- useHelpCenter(): HelpCenter;
22
- ```
23
-
24
- **Returned methods:**
25
-
26
- | Method | Description |
27
- | ------------------------------- | --------------------------------------------------- |
28
- | `openHelp()` | Opens the help sidesheet on the home page |
29
- | `openArticle(articleId: string)` | Opens a specific help article by its slug or ID |
30
- | `openFaqs()` | Opens the FAQs page |
31
- | `openSearch(search: string)` | Opens the search page with a pre-filled query |
32
- | `openGovernance()` | Opens the governance tab |
33
- | `openReleaseNotes()` | Opens the release notes page |
34
-
35
- ## Examples
36
-
37
- ### Open a Specific Article from a Button
38
-
39
- ```tsx
40
- import { useHelpCenter } from '@equinor/fusion-framework-react-app/help-center';
41
-
42
- const HelpButton = () => {
43
- const { openArticle } = useHelpCenter();
44
-
45
- return (
46
- <button onClick={() => openArticle('getting-started')}>
47
- How to get started
48
- </button>
49
- );
50
- };
51
- ```
52
-
53
- ### Open Help Home
54
-
55
- ```tsx
56
- import { useHelpCenter } from '@equinor/fusion-framework-react-app/help-center';
57
-
58
- const HelpLink = () => {
59
- const { openHelp } = useHelpCenter();
60
- return <button onClick={openHelp}>Help</button>;
61
- };
62
- ```
63
-
64
- ### Search Help Content
65
-
66
- ```tsx
67
- import { useHelpCenter } from '@equinor/fusion-framework-react-app/help-center';
68
-
69
- const SearchHelp = ({ query }: { query: string }) => {
70
- const { openSearch } = useHelpCenter();
71
- return <button onClick={() => openSearch(query)}>Search help</button>;
72
- };
73
- ```
74
-
75
- ## How It Works
76
-
77
- Each method dispatches a `@Portal::FusionHelp::open` framework event with a `page` discriminator. The portal shell listens for this event and opens the corresponding help sidesheet page. The event module must be available in the app's module scope — this is the default when running inside a Fusion portal.
78
-
79
- The known `page` values and their additional fields are:
80
-
81
- | `page` value | Extra fields | Opened by |
82
- | ----------------- | ----------------------------- | ------------------ |
83
- | `home` | — | `openHelp()` |
84
- | `article` | `articleId: string` | `openArticle(id)` |
85
- | `faqs` | — | `openFaqs()` |
86
- | `search` | `search: string` | `openSearch(q)` |
87
- | `governance` | — | `openGovernance()` |
88
- | `release-notes` | — | `openReleaseNotes()` |
package/docs/http.md DELETED
@@ -1,118 +0,0 @@
1
- # HTTP
2
-
3
- Make authenticated HTTP calls from your Fusion app using the framework-managed HTTP client.
4
-
5
- **Import:**
6
-
7
- ```ts
8
- import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
9
- ```
10
-
11
- **Selectors sub-path:**
12
-
13
- ```ts
14
- import { jsonSelector, blobSelector } from '@equinor/fusion-framework-react-app/http/selectors';
15
- ```
16
-
17
- ## Overview
18
-
19
- The `useHttpClient` hook provides access to named HTTP clients that are pre-configured with authentication, base URLs, and interceptors. Clients must be registered in the app configurator before use — the hook creates a memoised client instance by name.
20
-
21
- The `selectors` sub-path re-exports response selectors (`jsonSelector`, `blobSelector`, `createSseSelector`) from the HTTP module, providing typed helpers for parsing fetch responses.
22
-
23
- ## Configure an HTTP Client
24
-
25
- Register a named client in your app's configuration callback:
26
-
27
- ```ts
28
- import type { AppModuleInitiator } from '@equinor/fusion-framework-react-app';
29
-
30
- export const configure: AppModuleInitiator = (configurator) => {
31
- configurator.configureHttpClient('my-api', {
32
- baseUri: 'https://api.example.com',
33
- defaultScopes: ['api://my-api/.default'],
34
- });
35
- };
36
- ```
37
-
38
- ## useHttpClient
39
-
40
- Returns a configured `IHttpClient` instance by name. Throws if no client is registered for the given key.
41
-
42
- **Signature:**
43
-
44
- ```ts
45
- function useHttpClient(name: string): IHttpClient;
46
- ```
47
-
48
- | Parameter | Type | Description |
49
- | --------- | -------- | ------------------------------------ |
50
- | `name` | `string` | Named client key from configuration |
51
-
52
- **Returns:** An `IHttpClient` instance with `fetch`, `json`, `blob`, and other request methods.
53
-
54
- ### Fetch JSON Data
55
-
56
- ```tsx
57
- import { useEffect, useState } from 'react';
58
- import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
59
-
60
- type Item = { id: string; name: string };
61
-
62
- const ItemList = () => {
63
- const client = useHttpClient('my-api');
64
- const [items, setItems] = useState<Item[]>([]);
65
-
66
- useEffect(() => {
67
- client.json<Item[]>('/items')
68
- .then(setItems);
69
- }, [client]);
70
-
71
- return (
72
- <ul>
73
- {items.map((item) => (
74
- <li key={item.id}>{item.name}</li>
75
- ))}
76
- </ul>
77
- );
78
- };
79
- ```
80
-
81
- ### POST Data
82
-
83
- ```tsx
84
- import { useCallback } from 'react';
85
- import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
86
-
87
- const CreateItem = () => {
88
- const client = useHttpClient('my-api');
89
-
90
- const handleSubmit = useCallback(async (name: string) => {
91
- await client.fetch('/items', {
92
- method: 'POST',
93
- body: JSON.stringify({ name }),
94
- headers: { 'Content-Type': 'application/json' },
95
- });
96
- }, [client]);
97
-
98
- return <button onClick={() => handleSubmit('New item')}>Create</button>;
99
- };
100
- ```
101
-
102
- ## Response Selectors
103
-
104
- The `selectors` sub-path provides typed helpers for parsing HTTP responses:
105
-
106
- | Selector | Description |
107
- | -------------------- | ---------------------------------------------- |
108
- | `jsonSelector` | Parses response as JSON; use a typed call (e.g. `client.json<T>(...)`) to get a typed result |
109
- | `blobSelector` | Returns response as a `Blob` |
110
- | `createSseSelector` | Creates a selector for Server-Sent Events streams |
111
-
112
- These are re-exported from `@equinor/fusion-framework-module-http/selectors`.
113
-
114
- ## Prerequisites
115
-
116
- - HTTP clients must be configured in your app's configurator before calling `useHttpClient`
117
- - Authentication scopes are attached automatically based on the client configuration
118
- - For detailed HTTP module configuration, see the [`@equinor/fusion-framework-module-http` documentation](../../../modules/http/README.md)