@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.esm.js
CHANGED
|
@@ -622,32 +622,26 @@ function useCAMSMSALAuth(options) {
|
|
|
622
622
|
});
|
|
623
623
|
}); }, []);
|
|
624
624
|
var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
625
|
-
var
|
|
625
|
+
var camsError;
|
|
626
626
|
return __generator$1(this, function (_a) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return [3 /*break*/, 3];
|
|
644
|
-
case 2:
|
|
645
|
-
err_2 = _a.sent();
|
|
646
|
-
camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Logout failed: " + err_2);
|
|
647
|
-
setError(camsError);
|
|
648
|
-
return [3 /*break*/, 3];
|
|
649
|
-
case 3: return [2 /*return*/];
|
|
627
|
+
try {
|
|
628
|
+
Logger.info("Logging User Out");
|
|
629
|
+
setAccessToken("");
|
|
630
|
+
setIdToken("");
|
|
631
|
+
setError(null);
|
|
632
|
+
setRequiresMFA(false);
|
|
633
|
+
setIsAuthenticated(false);
|
|
634
|
+
if (typeof window !== "undefined") {
|
|
635
|
+
localStorage.removeItem(storageKey);
|
|
636
|
+
deleteCookie(storageKey + "-PROFILE");
|
|
637
|
+
}
|
|
638
|
+
// await instance.logoutRedirect();
|
|
639
|
+
}
|
|
640
|
+
catch (err) {
|
|
641
|
+
camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Logout failed: " + err);
|
|
642
|
+
setError(camsError);
|
|
650
643
|
}
|
|
644
|
+
return [2 /*return*/];
|
|
651
645
|
});
|
|
652
646
|
}); }, [instance, storageKey]);
|
|
653
647
|
return {
|
|
@@ -1555,16 +1549,20 @@ var MFAOptions = function (_a) {
|
|
|
1555
1549
|
var _f = useState(false), showSuccessAnimation = _f[0], setShowSuccessAnimation = _f[1];
|
|
1556
1550
|
var _g = useState(null), authType = _g[0], setAuthType = _g[1];
|
|
1557
1551
|
var context = useCAMSContext();
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1552
|
+
// Type-safe extraction of completeMFA and logout
|
|
1553
|
+
var completeMFA = context.authMode === "MSAL"
|
|
1554
|
+
? context.completeMFA
|
|
1555
|
+
: function (data) { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1556
|
+
return [2 /*return*/, data];
|
|
1557
|
+
}); }); };
|
|
1558
|
+
var logout = context.authMode === "MSAL"
|
|
1559
|
+
? context.logout
|
|
1560
|
+
: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1561
|
+
return [2 /*return*/];
|
|
1562
|
+
}); }); };
|
|
1565
1563
|
var authenticate = useWebAuthn().authenticate;
|
|
1566
1564
|
var authenticator = new CAMSMFAAuthenticator();
|
|
1567
|
-
var
|
|
1565
|
+
var _h = useOTPHandler({
|
|
1568
1566
|
email: ((_c = (_b = context.user) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.email) || context.email,
|
|
1569
1567
|
appCode: context.appCode || "",
|
|
1570
1568
|
MFAEndpoint: MFAEndpoints.ValidateUserMFA,
|
|
@@ -1603,9 +1601,9 @@ var MFAOptions = function (_a) {
|
|
|
1603
1601
|
}
|
|
1604
1602
|
});
|
|
1605
1603
|
}); },
|
|
1606
|
-
}), handleSubmitOTP =
|
|
1604
|
+
}), handleSubmitOTP = _h.handleSubmitOTP, loading = _h.loading,
|
|
1607
1605
|
// setLoading,
|
|
1608
|
-
attemptCount =
|
|
1606
|
+
attemptCount = _h.attemptCount, remainingAttempts = _h.remainingAttempts, isMaxAttemptsReached = _h.isMaxAttemptsReached, resetAttempts = _h.resetAttempts;
|
|
1609
1607
|
var handleGoBack = function () {
|
|
1610
1608
|
setAuthType(null);
|
|
1611
1609
|
setOtpVisible(false);
|