@nibssplc/cams-sdk-react 1.0.0-rc.102 → 1.0.0-rc.104
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.cjs.js +32 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +32 -34
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -643,32 +643,26 @@ function useCAMSMSALAuth(options) {
|
|
|
643
643
|
});
|
|
644
644
|
}); }, []);
|
|
645
645
|
var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
646
|
-
var
|
|
646
|
+
var camsError;
|
|
647
647
|
return __generator$1(this, function (_a) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
return [3 /*break*/, 3];
|
|
665
|
-
case 2:
|
|
666
|
-
err_2 = _a.sent();
|
|
667
|
-
camsError = new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "Logout failed: " + err_2);
|
|
668
|
-
setError(camsError);
|
|
669
|
-
return [3 /*break*/, 3];
|
|
670
|
-
case 3: return [2 /*return*/];
|
|
648
|
+
try {
|
|
649
|
+
camsSdk.Logger.info("Logging User Out");
|
|
650
|
+
setAccessToken("");
|
|
651
|
+
setIdToken("");
|
|
652
|
+
setError(null);
|
|
653
|
+
setRequiresMFA(false);
|
|
654
|
+
setIsAuthenticated(false);
|
|
655
|
+
if (typeof window !== "undefined") {
|
|
656
|
+
localStorage.removeItem(storageKey);
|
|
657
|
+
deleteCookie(storageKey + "-PROFILE");
|
|
658
|
+
}
|
|
659
|
+
// await instance.logoutRedirect();
|
|
660
|
+
}
|
|
661
|
+
catch (err) {
|
|
662
|
+
camsError = new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "Logout failed: " + err);
|
|
663
|
+
setError(camsError);
|
|
671
664
|
}
|
|
665
|
+
return [2 /*return*/];
|
|
672
666
|
});
|
|
673
667
|
}); }, [instance, storageKey]);
|
|
674
668
|
return {
|
|
@@ -1576,16 +1570,20 @@ var MFAOptions = function (_a) {
|
|
|
1576
1570
|
var _f = React.useState(false), showSuccessAnimation = _f[0], setShowSuccessAnimation = _f[1];
|
|
1577
1571
|
var _g = React.useState(null), authType = _g[0], setAuthType = _g[1];
|
|
1578
1572
|
var context = useCAMSContext();
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1573
|
+
// Type-safe extraction of completeMFA and logout
|
|
1574
|
+
var completeMFA = context.authMode === "MSAL"
|
|
1575
|
+
? context.completeMFA
|
|
1576
|
+
: function (data) { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1577
|
+
return [2 /*return*/, data];
|
|
1578
|
+
}); }); };
|
|
1579
|
+
var logout = context.authMode === "MSAL"
|
|
1580
|
+
? context.logout
|
|
1581
|
+
: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1582
|
+
return [2 /*return*/];
|
|
1583
|
+
}); }); };
|
|
1586
1584
|
var authenticate = useWebAuthn().authenticate;
|
|
1587
1585
|
var authenticator = new camsSdk.CAMSMFAAuthenticator();
|
|
1588
|
-
var
|
|
1586
|
+
var _h = useOTPHandler({
|
|
1589
1587
|
email: ((_c = (_b = context.user) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.email) || context.email,
|
|
1590
1588
|
appCode: context.appCode || "",
|
|
1591
1589
|
MFAEndpoint: MFAEndpoints.ValidateUserMFA,
|
|
@@ -1624,9 +1622,9 @@ var MFAOptions = function (_a) {
|
|
|
1624
1622
|
}
|
|
1625
1623
|
});
|
|
1626
1624
|
}); },
|
|
1627
|
-
}), handleSubmitOTP =
|
|
1625
|
+
}), handleSubmitOTP = _h.handleSubmitOTP, loading = _h.loading,
|
|
1628
1626
|
// setLoading,
|
|
1629
|
-
attemptCount =
|
|
1627
|
+
attemptCount = _h.attemptCount, remainingAttempts = _h.remainingAttempts, isMaxAttemptsReached = _h.isMaxAttemptsReached, resetAttempts = _h.resetAttempts;
|
|
1630
1628
|
var handleGoBack = function () {
|
|
1631
1629
|
setAuthType(null);
|
|
1632
1630
|
setOtpVisible(false);
|