@equinor/fusion-framework-react-app 10.0.8 → 12.0.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.
@@ -0,0 +1,93 @@
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;
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.
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` |
@@ -0,0 +1,88 @@
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 ADDED
@@ -0,0 +1,118 @@
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)
@@ -0,0 +1,86 @@
1
+ # Routing
2
+
3
+ The `@equinor/fusion-framework-react-app/routing` entry point re-exports the full public API of
4
+ `@equinor/fusion-framework-react-router` — including the `<Router>` component, the route builder
5
+ DSL, all React Router hooks, and types — so you can import everything from a single package without
6
+ adding `@equinor/fusion-framework-react-router` as a direct dependency.
7
+
8
+ ## Installation
9
+
10
+ `@equinor/fusion-framework-react-router` is an **optional peer dependency**. Install it alongside the app package:
11
+
12
+ ```bash
13
+ pnpm add @equinor/fusion-framework-react-router
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { Router } from '@equinor/fusion-framework-react-app/routing';
20
+ import { layout, index, route, prefix } from '@equinor/fusion-framework-react-app/routing';
21
+ ```
22
+
23
+ Everything exported from `@equinor/fusion-framework-react-router` and its `/routes` DSL is
24
+ available from this single entry point.
25
+
26
+ ## Enable navigation in your configurator
27
+
28
+ The `<Router>` component reads `history` and `basename` from the Fusion navigation module.
29
+ Enable it in your configurator before mounting:
30
+
31
+ ```ts
32
+ import { enableNavigation } from '@equinor/fusion-framework-module-navigation';
33
+ import type { IAppConfigurator, AppEnv, Fusion } from '@equinor/fusion-framework-react-app';
34
+
35
+ export const configure = (
36
+ configurator: IAppConfigurator,
37
+ args: { fusion: Fusion; env: AppEnv },
38
+ ) => {
39
+ enableNavigation(configurator, {
40
+ configure: (config) => {
41
+ config.setBasename(args.env.basename);
42
+ },
43
+ });
44
+ };
45
+ ```
46
+
47
+ ## Define routes
48
+
49
+ ```ts
50
+ // src/routes.ts
51
+ import { layout, index, route, prefix } from '@equinor/fusion-framework-react-app/routing';
52
+
53
+ export default layout('./Layout.tsx', [
54
+ index('./pages/HomePage.tsx'),
55
+ prefix('products', [
56
+ index('./pages/ProductsPage.tsx'),
57
+ route(':id', './pages/ProductPage.tsx'),
58
+ ]),
59
+ ]);
60
+ ```
61
+
62
+ ## Mount the Router
63
+
64
+ ```tsx
65
+ // src/Router.tsx
66
+ import { Router } from '@equinor/fusion-framework-react-app/routing';
67
+ import routes from './routes';
68
+
69
+ export default function AppRouter() {
70
+ return <Router routes={routes} />;
71
+ }
72
+ ```
73
+
74
+ ## Use routing hooks
75
+
76
+ All React Router hooks are re-exported from the same entry point:
77
+
78
+ ```tsx
79
+ import { useNavigate, useParams, useLocation, Link } from '@equinor/fusion-framework-react-app/routing';
80
+ ```
81
+
82
+ ## See also
83
+
84
+ - [Getting started](/modules/react/router/getting-started) — full setup walkthrough for the standalone router package
85
+ - [Interop entry point](/modules/react/router/interop) — `MemoryRouter` and other react-router bridges for testing and mid-migration
86
+ - [Migration guide](/modules/react/router/migration) — moving from a plain react-router setup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react-app",
3
- "version": "10.0.8",
3
+ "version": "12.0.0",
4
4
  "description": "",
5
5
  "main": "./dist/esm/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -60,6 +60,10 @@
60
60
  "./widget": {
61
61
  "types": "./dist/types/widget/index.d.ts",
62
62
  "import": "./dist/esm/widget/index.js"
63
+ },
64
+ "./routing": {
65
+ "types": "./dist/types/routing/index.d.ts",
66
+ "import": "./dist/esm/routing/index.js"
63
67
  }
64
68
  },
65
69
  "typesVersions": {
@@ -102,6 +106,9 @@
102
106
  ],
103
107
  "widget": [
104
108
  "dist/types/widget/index.d.ts"
109
+ ],
110
+ "routing": [
111
+ "dist/types/routing/index.d.ts"
105
112
  ]
106
113
  }
107
114
  },
@@ -117,14 +124,14 @@
117
124
  "directory": "packages/react"
118
125
  },
119
126
  "dependencies": {
120
- "@equinor/fusion-framework-module": "6.0.0",
127
+ "@equinor/fusion-framework-app": "11.0.9",
121
128
  "@equinor/fusion-framework-module-app": "8.0.2",
122
- "@equinor/fusion-framework-app": "11.0.6",
123
- "@equinor/fusion-framework-module-http": "8.0.1",
129
+ "@equinor/fusion-framework-module": "6.1.0",
130
+ "@equinor/fusion-framework-module-http": "8.0.3",
124
131
  "@equinor/fusion-framework-react": "8.0.0",
125
- "@equinor/fusion-framework-react-module": "4.0.0",
126
- "@equinor/fusion-framework-react-module-http": "11.0.0",
127
- "@equinor/fusion-framework-module-navigation": "7.0.3"
132
+ "@equinor/fusion-framework-module-navigation": "7.0.4",
133
+ "@equinor/fusion-framework-react-module": "4.0.1",
134
+ "@equinor/fusion-framework-react-module-http": "11.0.0"
128
135
  },
129
136
  "devDependencies": {
130
137
  "@types/react": "^19.2.7",
@@ -136,20 +143,22 @@
136
143
  "typescript": "^6.0.3",
137
144
  "vitest": "^4.1.0",
138
145
  "@equinor/fusion-framework-module-ag-grid": "36.0.1",
146
+ "@equinor/fusion-framework-module-analytics": "3.0.0",
139
147
  "@equinor/fusion-framework-module-event": "6.0.0",
140
- "@equinor/fusion-framework-module-analytics": "2.0.5",
141
148
  "@equinor/fusion-framework-module-feature-flag": "2.0.1",
142
- "@equinor/fusion-framework-module-msal": "8.0.5",
143
- "@equinor/fusion-framework-react-module-bookmark": "6.0.0",
144
- "@equinor/fusion-observable": "9.0.1",
145
- "@equinor/fusion-framework-react-module-context": "7.0.0"
149
+ "@equinor/fusion-framework-module-msal": "10.0.0",
150
+ "@equinor/fusion-framework-react-router": "2.2.0",
151
+ "@equinor/fusion-framework-react-module-context": "7.0.1",
152
+ "@equinor/fusion-observable": "9.1.0",
153
+ "@equinor/fusion-framework-react-module-bookmark": "6.0.0"
146
154
  },
147
155
  "peerDependencies": {
148
156
  "@types/react": "^18.0.0 || ^19.0.0",
149
157
  "react": "^18.0.0 || ^19.0.0",
150
158
  "react-dom": "^18.0.0 || ^19.0.0",
151
159
  "rxjs": "^7.0.0",
152
- "@equinor/fusion-framework-module-msal": "^8.0.5"
160
+ "@equinor/fusion-framework-module-msal": "^10.0.0",
161
+ "@equinor/fusion-framework-react-router": "^2.2.0"
153
162
  },
154
163
  "peerDependenciesMeta": {
155
164
  "@equinor/fusion-framework-react-module-ag-grid": {
@@ -178,6 +187,9 @@
178
187
  },
179
188
  "rxjs": {
180
189
  "optional": true
190
+ },
191
+ "@equinor/fusion-framework-react-router": {
192
+ "optional": true
181
193
  }
182
194
  },
183
195
  "scripts": {
@@ -1,5 +1,8 @@
1
1
  # `@equinor/fusion-framework-react-app/apploader`
2
2
 
3
+ > [!NOTE]
4
+ > This file is kept for legacy tooling. The canonical documentation is in [`packages/react/app/docs/apploader.md`](../../docs/apploader.md) and published via VuePress.
5
+
3
6
  [Apploader](#apploader) component and [useApploader](#useapploader) is intended to be used to embed Fusion applications inside other Fusion application.
4
7
 
5
8
  > [!WARNING]
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Routing sub-path entry-point for `@equinor/fusion-framework-react-app`.
3
+ *
4
+ * Re-exports the full public API of `@equinor/fusion-framework-react-router`
5
+ * and its route builder DSL so consumers can import all routing primitives
6
+ * from a single entry point without adding a separate direct dependency.
7
+ *
8
+ * Requires `@equinor/fusion-framework-react-router` to be installed.
9
+ * It is declared as an optional peer dependency — install it only when
10
+ * you need routing in your app, portal, or widget.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { Router } from '@equinor/fusion-framework-react-app/routing';
15
+ * import { layout, index, route } from '@equinor/fusion-framework-react-app/routing';
16
+ * ```
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ export * from '@equinor/fusion-framework-react-router';
21
+ // Explicit re-exports from /routes so the DSL `Route` class takes precedence
22
+ // over the deprecated react-router `Route` component from the main entry.
23
+ export {
24
+ index,
25
+ IndexRoute,
26
+ route,
27
+ Route,
28
+ layout,
29
+ LayoutRoute,
30
+ prefix,
31
+ PrefixRoute,
32
+ } from '@equinor/fusion-framework-react-router/routes';
33
+ export type { RouteSchemaEntry } from '@equinor/fusion-framework-react-router/routes';
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '10.0.8';
2
+ export const version = '12.0.0';
package/tsconfig.json CHANGED
@@ -15,6 +15,9 @@
15
15
  {
16
16
  "path": "../framework"
17
17
  },
18
+ {
19
+ "path": "../router"
20
+ },
18
21
  {
19
22
  "path": "../../modules/analytics"
20
23
  },