@nibssplc/cams-sdk-react 1.0.0-rc.16 → 1.0.0-rc.17
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/index.esm.js
CHANGED
|
@@ -362,6 +362,7 @@ function useCAMSAuth(options) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
var setCookie$1 = function (name, value, days) {
|
|
365
|
+
if (days === void 0) { days = 1; }
|
|
365
366
|
var expires = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toUTCString();
|
|
366
367
|
document.cookie = "".concat(name, "=").concat(encodeURIComponent(value), "; expires=").concat(expires, "; path=/; samesite=Lax");
|
|
367
368
|
};
|
|
@@ -556,7 +557,7 @@ function useCAMSMSALAuth(options) {
|
|
|
556
557
|
accessToken: accessToken,
|
|
557
558
|
idToken: idToken,
|
|
558
559
|
}));
|
|
559
|
-
setCookie$1("CAMS-MSAL-AUTH-SDK-PROFILE", JSON.stringify({ type: "AUTH_SUCCESS", userProfile: __assign({}, data) }),
|
|
560
|
+
setCookie$1("CAMS-MSAL-AUTH-SDK-PROFILE", JSON.stringify({ type: "AUTH_SUCCESS", userProfile: __assign({}, data) }), options.activeCookiePeriod);
|
|
560
561
|
setRequiresMFA(false);
|
|
561
562
|
// Set requiresMFA to false after storage update
|
|
562
563
|
Logger.debug("MFA completed successfully, storage updated", {
|
|
@@ -1225,7 +1226,9 @@ function ProtectedRoute(_a) {
|
|
|
1225
1226
|
|
|
1226
1227
|
var CAMSMSALContext = createContext(null);
|
|
1227
1228
|
var setCookie = function (name, value, days) {
|
|
1229
|
+
if (days === void 0) { days = 1; }
|
|
1228
1230
|
var expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
1231
|
+
Logger.debug("Auth Cookie Expires >>>", { name: name, value: value, expires: expires });
|
|
1229
1232
|
document.cookie = "".concat(name, "=").concat(encodeURIComponent(value), "; expires=").concat(expires, "; path=/; samesite=Lax");
|
|
1230
1233
|
};
|
|
1231
1234
|
var getCookie = function (name) {
|
|
@@ -1298,7 +1301,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1298
1301
|
useEffect(function () {
|
|
1299
1302
|
if (typeof window !== "undefined") {
|
|
1300
1303
|
if (userProfile) {
|
|
1301
|
-
setCookie(profileStorageKey, JSON.stringify(userProfile),
|
|
1304
|
+
setCookie(profileStorageKey, JSON.stringify(userProfile), authOptions.activeCookiePeriod); // Store for 1 day
|
|
1302
1305
|
}
|
|
1303
1306
|
else {
|
|
1304
1307
|
deleteCookie(profileStorageKey);
|
|
@@ -1449,7 +1452,8 @@ function CAMSProviderCore(props) {
|
|
|
1449
1452
|
userProfile,
|
|
1450
1453
|
]);
|
|
1451
1454
|
var value = useMemo(function () {
|
|
1452
|
-
|
|
1455
|
+
auth.logout; var authRest = __rest(auth, ["logout"]);
|
|
1456
|
+
return __assign(__assign({}, authRest), { logout: enhancedLogout, userProfile: userProfile, setUserProfile: setUserProfile, authMode: mode });
|
|
1453
1457
|
}, [auth, userProfile, mode]);
|
|
1454
1458
|
return jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children });
|
|
1455
1459
|
}
|