@nibssplc/cams-sdk-react 0.0.1-beta.43 → 0.0.1-beta.45
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/dist/hooks/useCAMSMSALAuth.d.ts +3 -3
- package/dist/index.cjs.js +12 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -16697,9 +16697,10 @@ function useCAMSMSALAuth(options) {
|
|
|
16697
16697
|
var account = useAccount(accounts[0] || {});
|
|
16698
16698
|
var storageKey = "CAMS-MSAL-AUTH-SDK";
|
|
16699
16699
|
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
16700
|
-
var _c = useState(
|
|
16701
|
-
var _d = useState(
|
|
16702
|
-
var _e = useState(
|
|
16700
|
+
var _c = useState(""), token = _c[0], setToken = _c[1];
|
|
16701
|
+
var _d = useState(""), idToken = _d[0], setIdToken = _d[1];
|
|
16702
|
+
var _e = useState(""), appCode = _e[0], setAppCode = _e[1];
|
|
16703
|
+
var _f = useState(""), accessToken = _f[0], setAccessToken = _f[1];
|
|
16703
16704
|
var isLoading = inProgress !== InteractionStatus.None;
|
|
16704
16705
|
var isAuthenticated = !!account && !!token;
|
|
16705
16706
|
var scopes = options.scopes || ["openid", "profile", "email"];
|
|
@@ -16717,11 +16718,12 @@ function useCAMSMSALAuth(options) {
|
|
|
16717
16718
|
var stored = localStorage.getItem(storageKey);
|
|
16718
16719
|
if (stored) {
|
|
16719
16720
|
try {
|
|
16720
|
-
var _a = JSON.parse(stored), accessToken_1 = _a.accessToken, idToken_1 = _a.idToken;
|
|
16721
|
+
var _a = JSON.parse(stored), accessToken_1 = _a.accessToken, idToken_1 = _a.idToken, appCode_1 = _a.appCode;
|
|
16721
16722
|
if (accessToken_1 && isTokenValid(accessToken_1)) {
|
|
16722
16723
|
setToken(accessToken_1);
|
|
16723
16724
|
setAccessToken(accessToken_1);
|
|
16724
16725
|
setIdToken(idToken_1);
|
|
16726
|
+
setAppCode(appCode_1);
|
|
16725
16727
|
}
|
|
16726
16728
|
else {
|
|
16727
16729
|
localStorage.removeItem(storageKey);
|
|
@@ -16846,9 +16848,9 @@ function useCAMSMSALAuth(options) {
|
|
|
16846
16848
|
return [4 /*yield*/, instance.logoutRedirect()];
|
|
16847
16849
|
case 1:
|
|
16848
16850
|
_a.sent();
|
|
16849
|
-
setToken(
|
|
16850
|
-
setAccessToken(
|
|
16851
|
-
setIdToken(
|
|
16851
|
+
setToken("");
|
|
16852
|
+
setAccessToken("");
|
|
16853
|
+
setIdToken("");
|
|
16852
16854
|
setError(null);
|
|
16853
16855
|
if (typeof window !== "undefined") {
|
|
16854
16856
|
localStorage.removeItem(storageKey);
|
|
@@ -16870,9 +16872,9 @@ function useCAMSMSALAuth(options) {
|
|
|
16870
16872
|
isAuthenticated: isAuthenticated,
|
|
16871
16873
|
isLoading: isLoading,
|
|
16872
16874
|
error: error,
|
|
16873
|
-
token: token,
|
|
16874
16875
|
idToken: idToken,
|
|
16875
16876
|
accessToken: accessToken,
|
|
16877
|
+
appCode: appCode,
|
|
16876
16878
|
};
|
|
16877
16879
|
}
|
|
16878
16880
|
|
|
@@ -17394,17 +17396,13 @@ function CAMSMSALProviderInner(_a) {
|
|
|
17394
17396
|
localStorage.setItem(auth.storageKey, JSON.stringify({
|
|
17395
17397
|
accessToken: auth.accessToken,
|
|
17396
17398
|
idToken: auth.idToken,
|
|
17399
|
+
appCode: auth.appCode
|
|
17397
17400
|
}));
|
|
17398
17401
|
}
|
|
17399
|
-
}, [auth.accessToken, auth.idToken, auth.storageKey]);
|
|
17402
|
+
}, [auth.accessToken, auth.idToken, auth.appCode, auth.storageKey]);
|
|
17400
17403
|
// Persist profile separately
|
|
17401
17404
|
useEffect(function () {
|
|
17402
17405
|
if (typeof window !== "undefined") {
|
|
17403
|
-
// if (userProfile) {
|
|
17404
|
-
// localStorage.setItem(profileStorageKey, JSO N.stringify(userProfile));
|
|
17405
|
-
// } else {
|
|
17406
|
-
// localStorage.removeItem(profileStorageKey);
|
|
17407
|
-
// }
|
|
17408
17406
|
if (userProfile) {
|
|
17409
17407
|
setCookie(profileStorageKey, JSON.stringify(userProfile), 1); // Store for 1 day
|
|
17410
17408
|
}
|