@equinor/fusion-framework-react-app 9.0.0-next.0 → 9.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.
- package/CHANGELOG.md +51 -33
- 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,65 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 9.0.0
|
|
3
|
+
## 9.0.0
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`9f7597e`](https://github.com/equinor/fusion-framework/commit/9f7597ee237ef069dc24cbe39c73b5b26db157dd) Thanks [@odinr](https://github.com/odinr)! - Require React 18+ and modernize `renderComponent` and `renderApp` functions to use React 18's `createRoot` API. These functions are no longer deprecated.
|
|
8
|
-
|
|
9
|
-
**Migration:** Update to React 18+. If you use `renderComponent` or `renderApp`, these functions now use the `createRoot` API internally. No immediate migration is required unless you are using features specific to React 17.
|
|
10
|
-
|
|
11
|
-
Closes https://github.com/equinor/fusion-framework/issues/3504
|
|
12
|
-
|
|
13
|
-
- [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`75c068f`](https://github.com/equinor/fusion-framework/commit/75c068fea13c32435ac26bd9043cc156482bfaf1) Thanks [@odinr](https://github.com/odinr)! - Upgrade to React 19 and remove support for React versions lower than 18.
|
|
5
|
+
### Patch Changes
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
7
|
+
- Updated dependencies [[`cb37cae`](https://github.com/equinor/fusion-framework/commit/cb37cae45e06778e8d1ea20faed31b582e49fcae)]:
|
|
8
|
+
- @equinor/fusion-framework-module-msal@7.0.0
|
|
9
|
+
- @equinor/fusion-framework-app@10.3.1
|
|
10
|
+
- @equinor/fusion-framework-module-app@7.4.0
|
|
11
|
+
- @equinor/fusion-framework-react@7.4.19
|
|
19
12
|
|
|
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
|
|
13
|
+
## 8.2.0
|
|
23
14
|
|
|
24
15
|
### Minor Changes
|
|
25
16
|
|
|
26
|
-
- [#
|
|
17
|
+
- [#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
|
|
18
|
+
data.
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
Example
|
|
29
21
|
|
|
30
22
|
```typescript
|
|
31
|
-
|
|
23
|
+
const trackFeature = useTrackFeature();
|
|
24
|
+
|
|
25
|
+
// Without extra data
|
|
26
|
+
trackFeature("SomeComponent:loaded");
|
|
27
|
+
|
|
28
|
+
// Send additional data
|
|
29
|
+
trackFeature("some:feature:happened", {
|
|
30
|
+
extra: "data",
|
|
31
|
+
foo: "bar",
|
|
32
|
+
});
|
|
32
33
|
```
|
|
33
34
|
|
|
35
|
+
## 8.1.1
|
|
36
|
+
|
|
34
37
|
### Patch Changes
|
|
35
38
|
|
|
36
|
-
- [#
|
|
39
|
+
- [#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
40
|
|
|
38
|
-
-
|
|
41
|
+
- Updated dependencies [[`5114ac4`](https://github.com/equinor/fusion-framework/commit/5114ac4f71a60935d0194b9b2766f95adff0ba1e)]:
|
|
42
|
+
- @equinor/fusion-framework-module-app@7.2.1
|
|
43
|
+
- @equinor/fusion-framework-app@10.2.1
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
## 8.1.0
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- [#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
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
41
52
|
|
|
42
|
-
- Updated dependencies [[`
|
|
43
|
-
- @equinor/fusion-framework-
|
|
44
|
-
- @equinor/fusion-framework-
|
|
45
|
-
- @equinor/fusion-framework-react-module-http@11.0.0-next.0
|
|
46
|
-
- @equinor/fusion-framework-react@8.0.0-next.0
|
|
47
|
-
- @equinor/fusion-framework-module-app@7.2.0-next.0
|
|
48
|
-
- @equinor/fusion-framework-app@10.1.3-next.0
|
|
49
|
-
- @equinor/fusion-framework-module-http@7.0.6-next.0
|
|
50
|
-
- @equinor/fusion-framework-module@5.0.6-next.0
|
|
51
|
-
- @equinor/fusion-framework-module-msal@7.0.0-next.0
|
|
53
|
+
- Updated dependencies [[`d38cd60`](https://github.com/equinor/fusion-framework/commit/d38cd60472380d60282c2a5672dc6e3bba3e7ca9)]:
|
|
54
|
+
- @equinor/fusion-framework-module-app@7.2.0
|
|
55
|
+
- @equinor/fusion-framework-app@10.2.0
|
|
52
56
|
|
|
53
57
|
## 8.0.0
|
|
54
58
|
|
|
55
59
|
### Patch Changes
|
|
56
60
|
|
|
57
61
|
- [#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.
|
|
62
|
+
|
|
58
63
|
- Update useCurrentAccount to use account property instead of deprecated defaultAccount
|
|
59
64
|
- Fix useToken hook to properly handle AcquireTokenResult type
|
|
60
65
|
- Ensure proper null/undefined handling for account information
|
|
@@ -110,12 +115,14 @@
|
|
|
110
115
|
- [#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
116
|
|
|
112
117
|
**Module Bookmark Changes:**
|
|
118
|
+
|
|
113
119
|
- Refactored `Bookmark` type in `packages/modules/bookmark/src/types.ts`
|
|
114
120
|
- Added export for `BookmarkProviderEvents` type in `packages/modules/bookmark/src/index.ts`
|
|
115
121
|
- Updated JSDoc comment from `@note` to `@remarks` in `packages/modules/bookmark/src/BookmarkClient.ts`
|
|
116
122
|
- Reordered tsconfig references (event before services)
|
|
117
123
|
|
|
118
124
|
**React Changes:**
|
|
125
|
+
|
|
119
126
|
- Updated `packages/react/modules/bookmark/src/portal/useBookmarkNavigate.ts` to use proper TypeScript typing for bookmark provider events
|
|
120
127
|
- Removed React paths configuration from `packages/react/app/tsconfig.json`
|
|
121
128
|
|
|
@@ -162,6 +169,7 @@
|
|
|
162
169
|
### Patch Changes
|
|
163
170
|
|
|
164
171
|
- [#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
|
|
172
|
+
|
|
165
173
|
- Updated package.json typesVersions.
|
|
166
174
|
- Ensures backward compatibility with older node versions.
|
|
167
175
|
- Ensured consistency with workspace and repository configuration.
|
|
@@ -221,6 +229,7 @@
|
|
|
221
229
|
`appKey (string)`: The key of the Fusion app to load and mount.
|
|
222
230
|
|
|
223
231
|
### Returns
|
|
232
|
+
|
|
224
233
|
- **loading** `(boolean)`: true while the app is loading.
|
|
225
234
|
- **error** `(Error | undefined)`: Error object if loading fails, otherwise undefined.
|
|
226
235
|
- **appRef** `(React.RefObject<HTMLDivElement | null>)`: Ref to the DOM element where the child app is mounted.
|
|
@@ -254,6 +263,7 @@
|
|
|
254
263
|
```
|
|
255
264
|
|
|
256
265
|
### Notes
|
|
266
|
+
|
|
257
267
|
- The hook is designed to be used in a parent Fusion app context.
|
|
258
268
|
- The returned appRef should be appended to a container element in your component.
|
|
259
269
|
- Handles subscription and cleanup automatically.
|
|
@@ -537,6 +547,7 @@
|
|
|
537
547
|
### Minor Changes
|
|
538
548
|
|
|
539
549
|
- [#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:
|
|
550
|
+
|
|
540
551
|
1. **AppClient.ts**
|
|
541
552
|
- Added `updateAppSettings` method to set app settings by appKey.
|
|
542
553
|
2. **AppModuleProvider.ts**
|
|
@@ -584,6 +595,7 @@
|
|
|
584
595
|
### Minor Changes
|
|
585
596
|
|
|
586
597
|
- [#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.
|
|
598
|
+
|
|
587
599
|
- Updated `index.ts` to re-export everything from `@equinor/fusion-framework-react-module-bookmark` instead of individual exports.
|
|
588
600
|
- Marked `useBookmark` as deprecated in `useBookmark.ts`.
|
|
589
601
|
- Enhanced `useCurrentBookmark` in `useCurrentBookmark.ts` to accept a `BookmarkPayloadGenerator` and use the `BookmarkModule` from `useAppModule`.
|
|
@@ -625,10 +637,12 @@
|
|
|
625
637
|
> This will introduce breaking changes to the configuration of `AppConfigurator.client`.
|
|
626
638
|
|
|
627
639
|
**Added**
|
|
640
|
+
|
|
628
641
|
- Introduced `AppClient` class to handle application manifest and configuration queries.
|
|
629
642
|
- Added `zod` to validate the application manifest.
|
|
630
643
|
|
|
631
644
|
**Changed**
|
|
645
|
+
|
|
632
646
|
- Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations.
|
|
633
647
|
- Modified `AppConfigurator` to utilize `AppClient` for client configuration.
|
|
634
648
|
- Updated `useApps` hook with new input parameter for `filterByCurrentUser` in `fusion-framework-react`.
|
|
@@ -760,6 +774,7 @@
|
|
|
760
774
|
- [#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
775
|
|
|
762
776
|
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
777
|
+
|
|
763
778
|
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
764
779
|
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
765
780
|
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
@@ -1128,6 +1143,7 @@
|
|
|
1128
1143
|
### Minor Changes
|
|
1129
1144
|
|
|
1130
1145
|
- [#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:
|
|
1146
|
+
|
|
1131
1147
|
- Created hooks for accessing current authenticated account
|
|
1132
1148
|
- Created hooks for acquiring token
|
|
1133
1149
|
- Created hooks for acquiring access token
|
|
@@ -1354,6 +1370,7 @@
|
|
|
1354
1370
|
### Minor Changes
|
|
1355
1371
|
|
|
1356
1372
|
- [#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**
|
|
1373
|
+
|
|
1357
1374
|
- add hook for using the navigation module
|
|
1358
1375
|
- add hook for creating a react router
|
|
1359
1376
|
|
|
@@ -1384,6 +1401,7 @@
|
|
|
1384
1401
|
### Patch Changes
|
|
1385
1402
|
|
|
1386
1403
|
- [#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**
|
|
1404
|
+
|
|
1387
1405
|
- align all versions of typescript
|
|
1388
1406
|
- update types to build
|
|
1389
1407
|
- 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"}
|