@equinor/fusion-framework-react-app 7.0.0 → 8.0.0-next.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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +38 -0
- package/README.md +33 -19
- package/dist/esm/help-center/useHelpCenter.js +6 -6
- package/dist/esm/help-center/useHelpCenter.js.map +1 -1
- package/dist/esm/msal/useCurrentAccount.js +1 -1
- package/dist/esm/msal/useCurrentAccount.js.map +1 -1
- package/dist/esm/msal/useToken.js +6 -3
- package/dist/esm/msal/useToken.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/msal.md +291 -0
- package/package.json +14 -14
- package/src/help-center/useHelpCenter.ts +6 -6
- package/src/msal/useCurrentAccount.ts +1 -1
- package/src/msal/useToken.ts +6 -3
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.0.0-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3693](https://github.com/equinor/fusion-framework/pull/3693) [`d6be2c4`](https://github.com/equinor/fusion-framework/commit/d6be2c4f2e01bab008b4d1f78f9adecb06647e66) Thanks [@github-actions](https://github.com/apps/github-actions)! - Fix MSAL v4 compatibility issues in React app hooks.
|
|
8
|
+
|
|
9
|
+
- Update useCurrentAccount to use account property instead of deprecated defaultAccount
|
|
10
|
+
- Fix useToken hook to properly handle AcquireTokenResult type
|
|
11
|
+
- Ensure proper null/undefined handling for account information
|
|
12
|
+
|
|
13
|
+
These changes ensure React app hooks work correctly with MSAL v4 while maintaining backward compatibility.
|
|
14
|
+
|
|
15
|
+
- [#3693](https://github.com/equinor/fusion-framework/pull/3693) [`dd26dd3`](https://github.com/equinor/fusion-framework/commit/dd26dd3e652eb07a77bcdc878f8493c6db4fed48) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update React App useToken hook to use new MSAL token acquisition API format.
|
|
16
|
+
|
|
17
|
+
Internal implementation change to adapt to MSAL interface updates. React App hooks continue to work the same way for consumers.
|
|
18
|
+
|
|
19
|
+
Why: Ensures compatibility with updated MSAL module API.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`d81294a`](https://github.com/equinor/fusion-framework/commit/d81294a4d74f7c7bebd8c7c3734c32c34fcb6b1e), [`dd26dd3`](https://github.com/equinor/fusion-framework/commit/dd26dd3e652eb07a77bcdc878f8493c6db4fed48), [`d6be2c4`](https://github.com/equinor/fusion-framework/commit/d6be2c4f2e01bab008b4d1f78f9adecb06647e66)]:
|
|
22
|
+
- @equinor/fusion-framework-module-msal@6.0.0-next.0
|
|
23
|
+
- @equinor/fusion-framework-react@7.4.19-next.0
|
|
24
|
+
- @equinor/fusion-framework-app@10.1.2-next.0
|
|
25
|
+
- @equinor/fusion-framework-module-app@7.0.3
|
|
26
|
+
- @equinor/fusion-framework-react-module-http@10.0.1-next.0
|
|
27
|
+
|
|
28
|
+
## 7.0.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [#3625](https://github.com/equinor/fusion-framework/pull/3625) [`b55c08b`](https://github.com/equinor/fusion-framework/commit/b55c08b59635fca51ba643f9081321514d306911) Thanks [@odinr](https://github.com/odinr)! - Fix React hooks dependency arrays in useHelpCenter to prevent exhaustive dependencies linting errors.
|
|
33
|
+
|
|
34
|
+
Changed dependency arrays from `[eventModule.dispatchEvent]` to `[eventModule]` in all useCallback hooks to properly track all dependencies used within the callbacks.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`e1a94c5`](https://github.com/equinor/fusion-framework/commit/e1a94c5a1df4ac2ec92ed25b75648397a3dbfa7b), [`e1a94c5`](https://github.com/equinor/fusion-framework/commit/e1a94c5a1df4ac2ec92ed25b75648397a3dbfa7b), [`0bc6b38`](https://github.com/equinor/fusion-framework/commit/0bc6b38e61c98a2f9dea7b55fa9983f268f860be)]:
|
|
37
|
+
- @equinor/fusion-framework-module@5.0.4
|
|
38
|
+
- @equinor/fusion-framework-module-msal@5.1.1
|
|
39
|
+
- @equinor/fusion-framework-app@10.1.1
|
|
40
|
+
|
|
3
41
|
## 7.0.0
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,24 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Package for developing applications that uses the `@equinor/fusion-framework`.
|
|
4
4
|
|
|
5
|
-
[API documentation](https://equinor.github.io/fusion-framework/modules/_equinor_fusion_framework_react_app.html)
|
|
6
|
-
|
|
7
|
-
__Dependencies__
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fframework%2Fpackage.json&label=framework&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/framework)
|
|
11
|
-
|
|
12
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule%2Fpackage.json&label=module&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module)
|
|
13
|
-
|
|
14
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule-http%2Fpackage.json&label=module-http&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module-http)
|
|
15
|
-
|
|
16
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Fmodule-msal%2Fpackage.json&label=module-msal&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/module-msal)
|
|
17
|
-
|
|
18
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Freact-module%2Fpackage.json&label=react-module&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/react-module)
|
|
19
|
-
|
|
20
|
-
[<img src="https://img.shields.io/github/package-json/v/equinor/fusion-framework?filename=packages%2Freact-module-app-config%2Fpackage.json&label=react-module-app-config&style=for-the-badge" />](https://github.com/equinor/fusion-framework/tree/main/packages/react-module-app-config)
|
|
21
|
-
|
|
22
|
-
|
|
23
5
|
## Configure
|
|
24
6
|
```tsx
|
|
25
7
|
// config.ts
|
|
@@ -64,6 +46,38 @@ const ShowToken = () => {
|
|
|
64
46
|
}
|
|
65
47
|
```
|
|
66
48
|
|
|
49
|
+
## MSAL Authentication
|
|
50
|
+
|
|
51
|
+
> [!IMPORTANT]
|
|
52
|
+
> `@equinor/fusion-framework-module-msal` must be installed to make MSAL hooks available
|
|
53
|
+
|
|
54
|
+
> [!CAUTION]
|
|
55
|
+
> **Applications should NOT configure the MSAL module themselves.** The MSAL module must be configured by the host/portal application for proper module hoisting. Apps should only use the hooks to access the already-configured MSAL module.
|
|
56
|
+
|
|
57
|
+
This package includes React hooks for Microsoft authentication using MSAL v4.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { useCurrentAccount, useAccessToken, useToken } from '@equinor/fusion-framework-react-app/msal';
|
|
61
|
+
|
|
62
|
+
const scopes = ['User.Read', 'api.read'];
|
|
63
|
+
|
|
64
|
+
function MyComponent() {
|
|
65
|
+
// Get current logged-in user
|
|
66
|
+
const user = useCurrentAccount();
|
|
67
|
+
|
|
68
|
+
// Get access token for API calls
|
|
69
|
+
const { token: accessToken } = useAccessToken( { scopes } );
|
|
70
|
+
|
|
71
|
+
// Get full token details
|
|
72
|
+
const { token } = useToken( { scopes } );
|
|
73
|
+
|
|
74
|
+
if (!user) return <div>Please log in</div>;
|
|
75
|
+
return <div>Welcome, {user.name}!</div>;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
📖 **[See MSAL Authentication Documentation](docs/msal.md) for complete API reference, examples, and migration guide.**
|
|
80
|
+
|
|
67
81
|
## Http
|
|
68
82
|
|
|
69
83
|
### useHttpClient
|
|
@@ -122,4 +136,4 @@ export const configure: ModuleInitiator = (appConfigurator, args) => {
|
|
|
122
136
|
}
|
|
123
137
|
```
|
|
124
138
|
|
|
125
|
-
[see module](
|
|
139
|
+
[see module](https://equinor.github.io/fusion-framework/modules/feature-flag/module.html) for more technical information;
|
|
@@ -12,7 +12,7 @@ export const useHelpCenter = () => {
|
|
|
12
12
|
page: 'home',
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
|
-
}, [eventModule
|
|
15
|
+
}, [eventModule]);
|
|
16
16
|
const openArticle = useCallback((articleId) => {
|
|
17
17
|
eventModule.dispatchEvent(EVENT_NAME, {
|
|
18
18
|
detail: {
|
|
@@ -20,14 +20,14 @@ export const useHelpCenter = () => {
|
|
|
20
20
|
articleId: articleId,
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
|
-
}, [eventModule
|
|
23
|
+
}, [eventModule]);
|
|
24
24
|
const openFaqs = useCallback(() => {
|
|
25
25
|
eventModule.dispatchEvent(EVENT_NAME, {
|
|
26
26
|
detail: {
|
|
27
27
|
page: 'faqs',
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
|
-
}, [eventModule
|
|
30
|
+
}, [eventModule]);
|
|
31
31
|
const openSearch = useCallback((search) => {
|
|
32
32
|
eventModule.dispatchEvent(EVENT_NAME, {
|
|
33
33
|
detail: {
|
|
@@ -35,21 +35,21 @@ export const useHelpCenter = () => {
|
|
|
35
35
|
search: search,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
|
-
}, [eventModule
|
|
38
|
+
}, [eventModule]);
|
|
39
39
|
const openGovernance = useCallback(() => {
|
|
40
40
|
eventModule.dispatchEvent(EVENT_NAME, {
|
|
41
41
|
detail: {
|
|
42
42
|
page: 'governance',
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
|
-
}, [eventModule
|
|
45
|
+
}, [eventModule]);
|
|
46
46
|
const openReleaseNotes = useCallback(() => {
|
|
47
47
|
eventModule.dispatchEvent(EVENT_NAME, {
|
|
48
48
|
detail: {
|
|
49
49
|
page: 'release-notes',
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
|
-
}, [eventModule
|
|
52
|
+
}, [eventModule]);
|
|
53
53
|
return {
|
|
54
54
|
openHelp,
|
|
55
55
|
openArticle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHelpCenter.js","sourceRoot":"","sources":["../../../src/help-center/useHelpCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAoC3C,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAyCtD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAe,EAAE;IAC5C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAS,EAAE;QACtC,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"useHelpCenter.js","sourceRoot":"","sources":["../../../src/help-center/useHelpCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAoC3C,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAyCtD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAe,EAAE;IAC5C,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAS,EAAE;QACtC,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;SACF,CAAC,CAAC;IACL,CAAC,EA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AC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -5,6 +5,6 @@ import useAppModule from '../useAppModule';
|
|
|
5
5
|
*/
|
|
6
6
|
export const useCurrentAccount = () => {
|
|
7
7
|
const msalProvider = useAppModule('auth');
|
|
8
|
-
return msalProvider.
|
|
8
|
+
return msalProvider.account || undefined;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=useCurrentAccount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAA4B,EAAE;IAC7D,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"useCurrentAccount.js","sourceRoot":"","sources":["../../../src/msal/useCurrentAccount.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAA4B,EAAE;IAC7D,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC,OAAO,IAAI,SAAS,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -14,9 +14,12 @@ export const useToken = (req) => {
|
|
|
14
14
|
setPending(true);
|
|
15
15
|
setToken(undefined);
|
|
16
16
|
msalProvider
|
|
17
|
-
.acquireToken(req)
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
.acquireToken({ request: req })
|
|
18
|
+
.then((result) => {
|
|
19
|
+
if (result) {
|
|
20
|
+
setToken(result);
|
|
21
|
+
}
|
|
22
|
+
})
|
|
20
23
|
.catch(setError)
|
|
21
24
|
.finally(() => setPending(false));
|
|
22
25
|
}, [msalProvider, req]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAExB,EAAsE,EAAE;IACvE,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmC,SAAS,CAAC,CAAC;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,YAAY;aACT,YAAY,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"useToken.js","sourceRoot":"","sources":["../../../src/msal/useToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAExB,EAAsE,EAAE;IACvE,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmC,SAAS,CAAC,CAAC;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAA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