@equinor/fusion-framework-react-app 9.0.0-next.0 → 9.0.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.
- package/CHANGELOG.md +55 -29
- package/dist/esm/analytics/index.js +2 -0
- package/dist/esm/analytics/index.js.map +1 -0
- package/dist/esm/analytics/useTrackFeature.js +48 -0
- package/dist/esm/analytics/useTrackFeature.js.map +1 -0
- package/dist/esm/apploader/Apploader.js +1 -1
- package/dist/esm/apploader/Apploader.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/make-component.js +1 -1
- package/dist/esm/make-component.js.map +1 -1
- package/dist/esm/render-app.js +1 -7
- package/dist/esm/render-app.js.map +1 -1
- package/dist/esm/render-component.js +23 -22
- package/dist/esm/render-component.js.map +1 -1
- package/dist/esm/useAppModules.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/analytics/index.d.ts +1 -0
- package/dist/types/analytics/useTrackFeature.d.ts +5 -0
- package/dist/types/apploader/Apploader.d.ts +2 -3
- package/dist/types/index.d.ts +1 -3
- package/dist/types/render-app.d.ts +1 -7
- package/dist/types/render-component.d.ts +1 -7
- package/dist/types/version.d.ts +1 -1
- package/package.json +32 -34
- package/src/analytics/README.md +41 -0
- package/src/analytics/index.ts +1 -0
- package/src/analytics/useTrackFeature.ts +56 -0
- package/src/apploader/Apploader.tsx +3 -3
- package/src/index.ts +2 -4
- package/src/make-component.tsx +1 -1
- package/src/render-app.ts +1 -7
- package/src/render-component.tsx +27 -24
- package/src/useAppModules.ts +2 -2
- package/src/version.ts +1 -1
- package/tsconfig.json +4 -1
- package/dist/esm/http/selectors.js +0 -2
- package/dist/esm/http/selectors.js.map +0 -1
- package/dist/types/http/selectors.d.ts +0 -1
- package/src/__tests__/render-app.test.tsx +0 -113
- package/src/http/selectors.ts +0 -1
- package/vitest.config.ts +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,60 +1,73 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 9.0.
|
|
3
|
+
## 9.0.1
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- [
|
|
7
|
+
- [`bd539b5`](https://github.com/equinor/fusion-framework/commit/bd539b5355db0cdec7569e9a09f4e8dce2a9a05c) Thanks [@odinr](https://github.com/odinr)! - Internal: Update workspace dependency versions from `workspace:^` to `workspace:*` for better compatibility.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Changed all internal workspace dependencies to use `workspace:*` instead of `workspace:^` to ensure exact version matching within the monorepo. This prevents version mismatch issues when different parts of the framework have conflicting version constraints.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 9.0.0
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Patch Changes
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
- Updated dependencies [[`cb37cae`](https://github.com/equinor/fusion-framework/commit/cb37cae45e06778e8d1ea20faed31b582e49fcae)]:
|
|
16
|
+
- @equinor/fusion-framework-module-msal@7.0.0
|
|
17
|
+
- @equinor/fusion-framework-app@10.3.1
|
|
18
|
+
- @equinor/fusion-framework-module-app@7.4.0
|
|
19
|
+
- @equinor/fusion-framework-react@7.4.19
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
- Update your React version to 18.0.0 or higher before upgrading these packages
|
|
22
|
-
- If using React 16 or 17, upgrade to React 18 or 19 first
|
|
21
|
+
## 8.2.0
|
|
23
22
|
|
|
24
23
|
### Minor Changes
|
|
25
24
|
|
|
26
|
-
- [#
|
|
25
|
+
- [#3849](https://github.com/equinor/fusion-framework/pull/3849) [`7caca57`](https://github.com/equinor/fusion-framework/commit/7caca573584ae4daedfb17e287d0329c2633771a) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - `trackFeature` now has an extra optional argument for passing additional analytics
|
|
26
|
+
data.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Example
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
|
|
31
|
+
const trackFeature = useTrackFeature();
|
|
32
|
+
|
|
33
|
+
// Without extra data
|
|
34
|
+
trackFeature("SomeComponent:loaded");
|
|
35
|
+
|
|
36
|
+
// Send additional data
|
|
37
|
+
trackFeature("some:feature:happened", {
|
|
38
|
+
extra: "data",
|
|
39
|
+
foo: "bar",
|
|
40
|
+
});
|
|
32
41
|
```
|
|
33
42
|
|
|
43
|
+
## 8.1.1
|
|
44
|
+
|
|
34
45
|
### Patch Changes
|
|
35
46
|
|
|
36
|
-
- [#
|
|
47
|
+
- [#3845](https://github.com/equinor/fusion-framework/pull/3845) [`5114ac4`](https://github.com/equinor/fusion-framework/commit/5114ac4f71a60935d0194b9b2766f95adff0ba1e) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - Fix tsconfig references
|
|
37
48
|
|
|
38
|
-
-
|
|
49
|
+
- Updated dependencies [[`5114ac4`](https://github.com/equinor/fusion-framework/commit/5114ac4f71a60935d0194b9b2766f95adff0ba1e)]:
|
|
50
|
+
- @equinor/fusion-framework-module-app@7.2.1
|
|
51
|
+
- @equinor/fusion-framework-app@10.2.1
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
## 8.1.0
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- @equinor/fusion-framework-module-
|
|
50
|
-
- @equinor/fusion-framework-
|
|
51
|
-
- @equinor/fusion-framework-module-msal@7.0.0-next.0
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- [#3842](https://github.com/equinor/fusion-framework/pull/3842) [`d38cd60`](https://github.com/equinor/fusion-framework/commit/d38cd60472380d60282c2a5672dc6e3bba3e7ca9) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - Add module fusion-framework-module-analytics
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [[`d38cd60`](https://github.com/equinor/fusion-framework/commit/d38cd60472380d60282c2a5672dc6e3bba3e7ca9)]:
|
|
62
|
+
- @equinor/fusion-framework-module-app@7.2.0
|
|
63
|
+
- @equinor/fusion-framework-app@10.2.0
|
|
52
64
|
|
|
53
65
|
## 8.0.0
|
|
54
66
|
|
|
55
67
|
### Patch Changes
|
|
56
68
|
|
|
57
69
|
- [#3714](https://github.com/equinor/fusion-framework/pull/3714) [`11fe961`](https://github.com/equinor/fusion-framework/commit/11fe961794e4960ccb987bc320268cc9b263f1f8) Thanks [@odinr](https://github.com/odinr)! - Fix MSAL v4 compatibility issues in React app hooks.
|
|
70
|
+
|
|
58
71
|
- Update useCurrentAccount to use account property instead of deprecated defaultAccount
|
|
59
72
|
- Fix useToken hook to properly handle AcquireTokenResult type
|
|
60
73
|
- Ensure proper null/undefined handling for account information
|
|
@@ -110,12 +123,14 @@
|
|
|
110
123
|
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`8fffbfb`](https://github.com/equinor/fusion-framework/commit/8fffbfb12daa9748bf5290e5084cd4d409aed253) Thanks [@odinr](https://github.com/odinr)! - Refactored the `Bookmark` type to be an intersection of `BookmarkWithoutData` and an optional `payload` property, improving type safety and flexibility. Updated `useBookmarkNavigate` to use proper TypeScript typing for bookmark events.
|
|
111
124
|
|
|
112
125
|
**Module Bookmark Changes:**
|
|
126
|
+
|
|
113
127
|
- Refactored `Bookmark` type in `packages/modules/bookmark/src/types.ts`
|
|
114
128
|
- Added export for `BookmarkProviderEvents` type in `packages/modules/bookmark/src/index.ts`
|
|
115
129
|
- Updated JSDoc comment from `@note` to `@remarks` in `packages/modules/bookmark/src/BookmarkClient.ts`
|
|
116
130
|
- Reordered tsconfig references (event before services)
|
|
117
131
|
|
|
118
132
|
**React Changes:**
|
|
133
|
+
|
|
119
134
|
- Updated `packages/react/modules/bookmark/src/portal/useBookmarkNavigate.ts` to use proper TypeScript typing for bookmark provider events
|
|
120
135
|
- Removed React paths configuration from `packages/react/app/tsconfig.json`
|
|
121
136
|
|
|
@@ -162,6 +177,7 @@
|
|
|
162
177
|
### Patch Changes
|
|
163
178
|
|
|
164
179
|
- [#3088](https://github.com/equinor/fusion-framework/pull/3088) [`7441b13`](https://github.com/equinor/fusion-framework/commit/7441b13aa50dd7362d1629086a27b6b4e571575d) Thanks [@eikeland](https://github.com/eikeland)! - chore: update package typesVersions
|
|
180
|
+
|
|
165
181
|
- Updated package.json typesVersions.
|
|
166
182
|
- Ensures backward compatibility with older node versions.
|
|
167
183
|
- Ensured consistency with workspace and repository configuration.
|
|
@@ -221,6 +237,7 @@
|
|
|
221
237
|
`appKey (string)`: The key of the Fusion app to load and mount.
|
|
222
238
|
|
|
223
239
|
### Returns
|
|
240
|
+
|
|
224
241
|
- **loading** `(boolean)`: true while the app is loading.
|
|
225
242
|
- **error** `(Error | undefined)`: Error object if loading fails, otherwise undefined.
|
|
226
243
|
- **appRef** `(React.RefObject<HTMLDivElement | null>)`: Ref to the DOM element where the child app is mounted.
|
|
@@ -254,6 +271,7 @@
|
|
|
254
271
|
```
|
|
255
272
|
|
|
256
273
|
### Notes
|
|
274
|
+
|
|
257
275
|
- The hook is designed to be used in a parent Fusion app context.
|
|
258
276
|
- The returned appRef should be appended to a container element in your component.
|
|
259
277
|
- Handles subscription and cleanup automatically.
|
|
@@ -537,6 +555,7 @@
|
|
|
537
555
|
### Minor Changes
|
|
538
556
|
|
|
539
557
|
- [#2577](https://github.com/equinor/fusion-framework/pull/2577) [`c3ba9f1`](https://github.com/equinor/fusion-framework/commit/c3ba9f109d9f96d6dc6ee2f0ddac00c8b3090982) Thanks [@eikeland](https://github.com/eikeland)! - #### Changes:
|
|
558
|
+
|
|
540
559
|
1. **AppClient.ts**
|
|
541
560
|
- Added `updateAppSettings` method to set app settings by appKey.
|
|
542
561
|
2. **AppModuleProvider.ts**
|
|
@@ -584,6 +603,7 @@
|
|
|
584
603
|
### Minor Changes
|
|
585
604
|
|
|
586
605
|
- [#2410](https://github.com/equinor/fusion-framework/pull/2410) [`9d1cb90`](https://github.com/equinor/fusion-framework/commit/9d1cb9003fa10e7ccaa95c20ef86f0a618034641) Thanks [@odinr](https://github.com/odinr)! - Updated bookmark namespace in `@equinor/fusion-react-app` to include new hooks and updated `useCurrentBookmark` hook.
|
|
606
|
+
|
|
587
607
|
- Updated `index.ts` to re-export everything from `@equinor/fusion-framework-react-module-bookmark` instead of individual exports.
|
|
588
608
|
- Marked `useBookmark` as deprecated in `useBookmark.ts`.
|
|
589
609
|
- Enhanced `useCurrentBookmark` in `useCurrentBookmark.ts` to accept a `BookmarkPayloadGenerator` and use the `BookmarkModule` from `useAppModule`.
|
|
@@ -625,10 +645,12 @@
|
|
|
625
645
|
> This will introduce breaking changes to the configuration of `AppConfigurator.client`.
|
|
626
646
|
|
|
627
647
|
**Added**
|
|
648
|
+
|
|
628
649
|
- Introduced `AppClient` class to handle application manifest and configuration queries.
|
|
629
650
|
- Added `zod` to validate the application manifest.
|
|
630
651
|
|
|
631
652
|
**Changed**
|
|
653
|
+
|
|
632
654
|
- Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations.
|
|
633
655
|
- Modified `AppConfigurator` to utilize `AppClient` for client configuration.
|
|
634
656
|
- Updated `useApps` hook with new input parameter for `filterByCurrentUser` in `fusion-framework-react`.
|
|
@@ -760,6 +782,7 @@
|
|
|
760
782
|
- [#2320](https://github.com/equinor/fusion-framework/pull/2320) [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee) Thanks [@odinr](https://github.com/odinr)! - Removed the `removeComments` option from the `tsconfig.base.json` file.
|
|
761
783
|
|
|
762
784
|
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
785
|
+
|
|
763
786
|
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
764
787
|
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
765
788
|
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
@@ -1128,6 +1151,7 @@
|
|
|
1128
1151
|
### Minor Changes
|
|
1129
1152
|
|
|
1130
1153
|
- [#1646](https://github.com/equinor/fusion-framework/pull/1646) [`5eab8af`](https://github.com/equinor/fusion-framework/commit/5eab8afe3c3106cc67ad14ce4cbee6c7e4e8dfb1) Thanks [@odinr](https://github.com/odinr)! - Created namespace for MSAL:
|
|
1154
|
+
|
|
1131
1155
|
- Created hooks for accessing current authenticated account
|
|
1132
1156
|
- Created hooks for acquiring token
|
|
1133
1157
|
- Created hooks for acquiring access token
|
|
@@ -1354,6 +1378,7 @@
|
|
|
1354
1378
|
### Minor Changes
|
|
1355
1379
|
|
|
1356
1380
|
- [#934](https://github.com/equinor/fusion-framework/pull/934) [`ea081696`](https://github.com/equinor/fusion-framework/commit/ea0816967244917b01a3aa43b75cd3cf59573958) Thanks [@odinr](https://github.com/odinr)! - **Add tooling for navigation in React App package**
|
|
1381
|
+
|
|
1357
1382
|
- add hook for using the navigation module
|
|
1358
1383
|
- add hook for creating a react router
|
|
1359
1384
|
|
|
@@ -1384,6 +1409,7 @@
|
|
|
1384
1409
|
### Patch Changes
|
|
1385
1410
|
|
|
1386
1411
|
- [#905](https://github.com/equinor/fusion-framework/pull/905) [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c) Thanks [@odinr](https://github.com/odinr)! - **🚧 Chore: dedupe packages**
|
|
1412
|
+
|
|
1387
1413
|
- align all versions of typescript
|
|
1388
1414
|
- update types to build
|
|
1389
1415
|
- a couple of typecasts did not [satisfies](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#satisfies-support-in-jsdoc) and was recasted as `unknwon`, marked with `TODO`, should be fixed in future
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useFrameworkModule } from '@equinor/fusion-framework-react';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for using analytics module configured in the framework.
|
|
5
|
+
*/
|
|
6
|
+
export const useTrackFeature = () => {
|
|
7
|
+
const analyticsProvider = useFrameworkModule('analytics');
|
|
8
|
+
const appProvider = useFrameworkModule('app');
|
|
9
|
+
const contextProvider = useFrameworkModule('context');
|
|
10
|
+
const telemetryProvider = useFrameworkModule('telemetry');
|
|
11
|
+
/**
|
|
12
|
+
* Tracks a analytics event.
|
|
13
|
+
*
|
|
14
|
+
* Can be used both in useCallback or useEffects - see README.md for examples.
|
|
15
|
+
*
|
|
16
|
+
* @param name - The feature to track
|
|
17
|
+
* @param data - Optional map of additional key-value pairs to include with the analytics event
|
|
18
|
+
*/
|
|
19
|
+
const trackFeature = useCallback((name, data) => {
|
|
20
|
+
if (!analyticsProvider) {
|
|
21
|
+
telemetryProvider?.trackException({
|
|
22
|
+
name: 'AnalyticsProviderNotFound',
|
|
23
|
+
exception: new Error(`Analytics provider not found`),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
analyticsProvider?.trackAnalytic({
|
|
27
|
+
name: 'app-feature',
|
|
28
|
+
value: {
|
|
29
|
+
feature: name,
|
|
30
|
+
data,
|
|
31
|
+
},
|
|
32
|
+
attributes: {
|
|
33
|
+
appKey: appProvider?.current?.appKey,
|
|
34
|
+
context: contextProvider?.currentContext
|
|
35
|
+
? {
|
|
36
|
+
id: contextProvider.currentContext.id,
|
|
37
|
+
externalId: contextProvider.currentContext.externalId,
|
|
38
|
+
title: contextProvider.currentContext.title,
|
|
39
|
+
type: contextProvider.currentContext.type.id,
|
|
40
|
+
source: contextProvider.currentContext.source,
|
|
41
|
+
}
|
|
42
|
+
: undefined,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}, [analyticsProvider, appProvider, contextProvider, telemetryProvider]);
|
|
46
|
+
return trackFeature;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=useTrackFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTrackFeature.js","sourceRoot":"","sources":["../../../src/analytics/useTrackFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,iBAAiB,GAAG,kBAAkB,CAAkB,WAAW,CAAC,CAAC;IAC3E,MAAM,WAAW,GAAG,kBAAkB,CAAY,KAAK,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAE1D;;;;;;;OAOG;IACH,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE;QACnC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,EAAE,cAAc,CAAC;gBAChC,IAAI,EAAE,2BAA2B;gBACjC,SAAS,EAAE,IAAI,KAAK,CAAC,8BAA8B,CAAC;aACrD,CAAC,CAAC;QACL,CAAC;QAED,iBAAiB,EAAE,aAAa,CAAC;YAC/B,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;aACL;YACD,UAAU,EAAE;gBACV,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;gBACpC,OAAO,EAAE,eAAe,EAAE,cAAc;oBACtC,CAAC,CAAC;wBACE,EAAE,EAAE,eAAe,CAAC,cAAc,CAAC,EAAE;wBACrC,UAAU,EAAE,eAAe,CAAC,cAAc,CAAC,UAAU;wBACrD,KAAK,EAAE,eAAe,CAAC,cAAc,CAAC,KAAK;wBAC3C,IAAI,EAAE,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;wBAC5C,MAAM,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM;qBAC9C;oBACH,CAAC,CAAC,SAAS;aACd;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,CAAC,CACrE,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { useApploader } from './useApploader';
|
|
|
9
9
|
*
|
|
10
10
|
* @param { ApploaderProps } props - The props for the component.
|
|
11
11
|
* @param { string } props.appKey - The key of the Fusion app to load and mount.
|
|
12
|
-
* @returns {
|
|
12
|
+
* @returns { JSX.Element } The rendered component, which displays loading, error, or the embedded app.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* <Apploader appKey="my-app" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Apploader.js","sourceRoot":"","sources":["../../../src/apploader/Apploader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Apploader.js","sourceRoot":"","sources":["../../../src/apploader/Apploader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAkB,EAAe,EAAE;IACnE,MAAM,QAAQ,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAErB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,sCAAc,MAAM,IAAO,CAAC;IACrC,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CACL,4CACiB,MAAM,eAAW,KAAK,CAAC,OAAO,IACzC,CACP,CAAC;IACJ,CAAC;IAED,OAAO,cAAK,GAAG,EAAE,QAAQ,GAAI,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,8 +3,9 @@ export { useAppModules } from './useAppModules';
|
|
|
3
3
|
export { useAppEnvironmentVariables } from './useAppEnvironmentVariables';
|
|
4
4
|
export { makeComponent } from './make-component';
|
|
5
5
|
export { createLegacyApp } from './create-legacy-app';
|
|
6
|
-
|
|
6
|
+
// TODO deprecate
|
|
7
7
|
export { renderApp } from './render-app';
|
|
8
|
+
export { createComponent } from './create-component';
|
|
8
9
|
export { renderComponent } from './render-component';
|
|
9
10
|
export { default } from './render-app';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -26,7 +26,7 @@ import { ModuleProvider as AppModuleProvider } from '@equinor/fusion-framework-r
|
|
|
26
26
|
*/
|
|
27
27
|
export const makeComponent = (Component, args, configure) => lazy(async () => {
|
|
28
28
|
const init = configureModules(configure);
|
|
29
|
-
const modules = await init(args);
|
|
29
|
+
const modules = (await init(args));
|
|
30
30
|
const { fusion } = args;
|
|
31
31
|
modules.event.dispatchEvent('onReactAppLoaded', {
|
|
32
32
|
detail: { modules, fusion, env: args.env },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAK3B,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACJ,EAAE,CAClD,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"make-component.js","sourceRoot":"","sources":["../../src/make-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAK3B,SAA0B,EAC1B,IAAiC,EACjC,SAAoD,EACJ,EAAE,CAClD,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,IAAI,GAAG,gBAAgB,CAAuB,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAkC,CAAC;IAEpE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;QAC9C,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC9B,KAAC,iBAAiB,IAAC,KAAK,EAAE,OAAO,YAAG,SAAS,GAAqB,GAChD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAaL,eAAe,aAAa,CAAC"}
|
package/dist/esm/render-app.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { createComponent } from './create-component';
|
|
2
2
|
import { renderComponent } from './render-component';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a render function for an app component.
|
|
5
|
-
* Uses React 18's createRoot API via renderComponent.
|
|
6
|
-
*
|
|
7
|
-
* @param componentArgs - Arguments to pass to createComponent
|
|
8
|
-
* @returns A function that renders the app into a DOM element
|
|
9
|
-
*/
|
|
3
|
+
/** @deprecated */
|
|
10
4
|
export const renderApp = (...componentArgs) => {
|
|
11
5
|
const renderer = renderComponent(createComponent(...componentArgs));
|
|
12
6
|
return (el, args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAuB,MAAM,oBAAoB,CAAC;AAI1E
|
|
1
|
+
{"version":3,"file":"render-app.js","sourceRoot":"","sources":["../../src/render-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAuB,MAAM,oBAAoB,CAAC;AAI1E,kBAAkB;AAClB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,aAAiD,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, StrictMode } from 'react';
|
|
3
|
-
import
|
|
4
|
-
/**
|
|
5
|
-
* Renders a React component into a DOM element using React 18's createRoot API.
|
|
6
|
-
*
|
|
7
|
-
* @param el - The DOM element to render into
|
|
8
|
-
* @param Component - The React component to render
|
|
9
|
-
* @returns A teardown function that unmounts the component
|
|
10
|
-
*/
|
|
11
|
-
const render = (el, Component) => {
|
|
12
|
-
const root = createRoot(el);
|
|
13
|
-
root.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }));
|
|
14
|
-
return () => {
|
|
15
|
-
root.unmount();
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Creates a render function for a component renderer.
|
|
20
|
-
* Uses React 18's createRoot API instead of the deprecated ReactDOM.render.
|
|
21
|
-
*
|
|
22
|
-
* @param renderer - A function that creates a component from fusion and env
|
|
23
|
-
* @returns A function that renders the component into a DOM element
|
|
24
|
-
*/
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
/** @deprecated */
|
|
25
5
|
export const renderComponent = (renderer) => {
|
|
26
6
|
return (el, args) => {
|
|
27
7
|
const Component = renderer(args.fusion, args.env);
|
|
28
8
|
return render(el, Component);
|
|
29
9
|
};
|
|
30
10
|
};
|
|
11
|
+
const render = (el, Component) => {
|
|
12
|
+
// eslint-disable-next-line react/no-deprecated
|
|
13
|
+
ReactDOM.render(_jsx(StrictMode, { children: _jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(Component, {}) }) }), el);
|
|
14
|
+
return () => {
|
|
15
|
+
// eslint-disable-next-line react/no-deprecated
|
|
16
|
+
ReactDOM.unmountComponentAtNode(el);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
// const render = (el: Element, Component: FunctionComponent): RenderTeardown => {
|
|
20
|
+
// const root = createRoot(el);
|
|
21
|
+
// root.render(
|
|
22
|
+
// <StrictMode>
|
|
23
|
+
// <Suspense fallback={<p>loading app</p>}>
|
|
24
|
+
// <Component />
|
|
25
|
+
// </Suspense>
|
|
26
|
+
// </StrictMode>
|
|
27
|
+
// );
|
|
28
|
+
// return () => {
|
|
29
|
+
// root.unmount();
|
|
30
|
+
// };
|
|
31
|
+
// };
|
|
31
32
|
export default renderComponent;
|
|
32
33
|
//# sourceMappingURL=render-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"render-component.js","sourceRoot":"","sources":["../../src/render-component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAIjC,kBAAkB;AAClB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA2B,EAAE,EAAE;IAC7D,OAAO,CAAC,EAAe,EAAE,IAAyB,EAAkB,EAAE;QACpE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,SAA4B,EAAkB,EAAE;IAC3E,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CACb,KAAC,UAAU,cACT,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YACpC,KAAC,SAAS,KAAG,GACJ,GACA,EACb,EAAE,CACH,CAAC;IACF,OAAO,GAAG,EAAE;QACV,+CAA+C;QAC/C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kFAAkF;AAClF,mCAAmC;AACnC,mBAAmB;AACnB,uBAAuB;AACvB,uDAAuD;AACvD,gCAAgC;AAChC,0BAA0B;AAC1B,wBAAwB;AACxB,SAAS;AACT,qBAAqB;AACrB,0BAA0B;AAC1B,SAAS;AACT,KAAK;AAEL,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"useAppModules.js","sourceRoot":"","sources":["../../src/useAppModules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAEF,EAAE,CAAC,UAAU,EAAyB,CAAC;AAElE,eAAe,aAAa,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|