@nibssplc/cams-sdk-react 1.0.0-rc.17 → 1.0.0-rc.18
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.
|
@@ -11,7 +11,6 @@ export interface CAMSMSALProviderProps extends UseCAMSMSALAuthOptions {
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
msalConfig: Configuration;
|
|
13
13
|
msalInstance?: PublicClientApplication;
|
|
14
|
-
activeCookiePeriod?: number;
|
|
15
14
|
}
|
|
16
15
|
export declare function CAMSMSALProvider(props: Readonly<CAMSMSALProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
export declare function useCAMSMSALContext(): CAMSMSALContextValue;
|
|
@@ -28,5 +28,6 @@ export interface UseCAMSMSALAuthReturn {
|
|
|
28
28
|
completeMFA: (data: UserValidatedResponse) => Promise<MFAResponse>;
|
|
29
29
|
setRequiresMFA: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
30
|
sendEmailOTP: () => Promise<boolean>;
|
|
31
|
+
activeCookiePeriod: number;
|
|
31
32
|
}
|
|
32
33
|
export declare function useCAMSMSALAuth(options: UseCAMSMSALAuthOptions): UseCAMSMSALAuthReturn;
|
package/dist/index.cjs.js
CHANGED
|
@@ -562,7 +562,7 @@ function useCAMSMSALAuth(options) {
|
|
|
562
562
|
case 4: return [2 /*return*/];
|
|
563
563
|
}
|
|
564
564
|
});
|
|
565
|
-
}); }, [instance, scopes, options, inProgress]);
|
|
565
|
+
}); }, [instance, scopes, options.prompt, options.appCode, options.MFAEndpoint, options.onAuthSuccess, options.onAuthError, storageKey, inProgress]);
|
|
566
566
|
var completeMFA = React.useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
567
567
|
return __generator$1(this, function (_a) {
|
|
568
568
|
if (!mfaAuthenticator) {
|
|
@@ -597,7 +597,7 @@ function useCAMSMSALAuth(options) {
|
|
|
597
597
|
}
|
|
598
598
|
return [2 /*return*/];
|
|
599
599
|
});
|
|
600
|
-
}); }, [mfaAuthenticator, accessToken, idToken, storageKey]);
|
|
600
|
+
}); }, [mfaAuthenticator, accessToken, idToken, storageKey, options.activeCookiePeriod]);
|
|
601
601
|
var sendEmailOTP = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
602
602
|
return __generator$1(this, function (_a) {
|
|
603
603
|
switch (_a.label) {
|
|
@@ -654,6 +654,7 @@ function useCAMSMSALAuth(options) {
|
|
|
654
654
|
completeMFA: completeMFA,
|
|
655
655
|
sendEmailOTP: sendEmailOTP,
|
|
656
656
|
setRequiresMFA: setRequiresMFA,
|
|
657
|
+
activeCookiePeriod: options.activeCookiePeriod || 1,
|
|
657
658
|
};
|
|
658
659
|
}
|
|
659
660
|
|
|
@@ -1322,7 +1323,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1322
1323
|
React.useEffect(function () {
|
|
1323
1324
|
if (typeof window !== "undefined") {
|
|
1324
1325
|
if (userProfile) {
|
|
1325
|
-
setCookie(profileStorageKey, JSON.stringify(userProfile),
|
|
1326
|
+
setCookie(profileStorageKey, JSON.stringify(userProfile), auth.activeCookiePeriod); // Store for 1 day
|
|
1326
1327
|
}
|
|
1327
1328
|
else {
|
|
1328
1329
|
deleteCookie(profileStorageKey);
|