@nibssplc/cams-sdk-react 1.0.0-rc.124 → 1.0.0-rc.126
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 +7 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -950,14 +950,16 @@ function CAMSProviderCore(props) {
|
|
|
950
950
|
}
|
|
951
951
|
});
|
|
952
952
|
}); };
|
|
953
|
+
var onAuthSuccessCallback = mode === "MSAL" ? props.onAuthSuccess : undefined;
|
|
954
|
+
var onAuthErrorCallback = mode === "MSAL" ? props.onAuthError : undefined;
|
|
953
955
|
var value = React.useMemo(function () {
|
|
954
956
|
auth.logout; var authRest = __rest(auth, ["logout"]);
|
|
955
957
|
var baseValue = __assign(__assign({}, authRest), { logout: enhancedLogout, user: userProfile, setUserProfile: setUserProfileWithCookie, authMode: mode });
|
|
956
958
|
if (mode === "MSAL") {
|
|
957
|
-
return __assign(__assign({}, baseValue), { onAuthSuccess:
|
|
959
|
+
return __assign(__assign({}, baseValue), { onAuthSuccess: onAuthSuccessCallback, onAuthError: onAuthErrorCallback });
|
|
958
960
|
}
|
|
959
961
|
return baseValue;
|
|
960
|
-
}, [auth, userProfile, mode,
|
|
962
|
+
}, [auth, userProfile, mode, onAuthSuccessCallback, onAuthErrorCallback, enhancedLogout]);
|
|
961
963
|
return jsxRuntime.jsx(CAMSContext.Provider, { value: value, children: children });
|
|
962
964
|
}
|
|
963
965
|
function UnifiedCAMSProvider(props) {
|
|
@@ -1317,7 +1319,7 @@ var LoadingScreen = function (_a) {
|
|
|
1317
1319
|
|
|
1318
1320
|
var AuthSuccessAnimation = function (_a) {
|
|
1319
1321
|
var onComplete = _a.onComplete;
|
|
1320
|
-
return (jsxRuntime.jsxs(framerMotion.motion.div, { initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut" }, className: "flex flex-col items-center justify-center space-y-6 p-8", onAnimationComplete: onComplete, children: [jsxRuntime.jsx(framerMotion.motion.div, { initial: { scale: 0 }, animate: { scale: 1 }, transition: { delay: 0.2, duration: 0.6, type: "spring", stiffness: 200 }, children: jsxRuntime.jsx(lucideReact.CheckCircle, { className: "w-20 h-20 text-green-500" }) }), jsxRuntime.jsxs(framerMotion.motion.div, { initial: { y: 20, opacity: 0 }, animate: { y: 0, opacity: 1 }, transition: { delay: 0.4, duration: 0.5 }, className: "text-center space-y-2", children: [jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-green-600", children: "Authentication Successful!" }), jsxRuntime.jsx("p", { className: "text-gray-600", children: "Redirecting you to the application..." })] }), jsxRuntime.jsx(framerMotion.motion.div, { initial: { width: 0 }, animate: { width: "100%" }, transition: { delay: 0.8, duration:
|
|
1322
|
+
return (jsxRuntime.jsxs(framerMotion.motion.div, { initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut" }, className: "flex flex-col items-center justify-center space-y-6 p-8", onAnimationComplete: onComplete, children: [jsxRuntime.jsx(framerMotion.motion.div, { initial: { scale: 0 }, animate: { scale: 1 }, transition: { delay: 0.2, duration: 0.6, type: "spring", stiffness: 200 }, children: jsxRuntime.jsx(lucideReact.CheckCircle, { className: "w-20 h-20 text-green-500" }) }), jsxRuntime.jsxs(framerMotion.motion.div, { initial: { y: 20, opacity: 0 }, animate: { y: 0, opacity: 1 }, transition: { delay: 0.4, duration: 0.5 }, className: "text-center space-y-2", children: [jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-green-600", children: "Authentication Successful!" }), jsxRuntime.jsx("p", { className: "text-gray-600", children: "Redirecting you to the application..." })] }), jsxRuntime.jsx(framerMotion.motion.div, { initial: { width: 0 }, animate: { width: "100%" }, transition: { delay: 0.8, duration: 0.8 }, className: "h-1 bg-green-500 rounded-full max-w-xs", onAnimationComplete: onComplete })] }));
|
|
1321
1323
|
};
|
|
1322
1324
|
|
|
1323
1325
|
var MAX_ATTEMPTS = 3;
|
|
@@ -1512,6 +1514,7 @@ var MFAOptions = function (_a) {
|
|
|
1512
1514
|
context.setUserProfile(userProfile);
|
|
1513
1515
|
sonner.toast.success(jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-green-600 bg-green-50 p-3 rounded-lg", children: [jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4" }), jsxRuntime.jsxs("span", { children: ["Multi-Factor Authentication Successful. ", data === null || data === void 0 ? void 0 : data.message] })] }));
|
|
1514
1516
|
setShowSuccessAnimation(true);
|
|
1517
|
+
setTimeout(function () { return onComplete(true); }, 1000);
|
|
1515
1518
|
return [3 /*break*/, 3];
|
|
1516
1519
|
case 2:
|
|
1517
1520
|
sonner.toast.error(jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-red-600 bg-red-50 p-3 rounded-lg", children: [jsxRuntime.jsx(lucideReact.ShieldClose, { className: "w-4 h-4" }), jsxRuntime.jsx("span", { children: (data === null || data === void 0 ? void 0 : data.message) || "Unable to Validate User. Please try again." })] }));
|
|
@@ -1774,6 +1777,7 @@ var MFAGate = function (_a) {
|
|
|
1774
1777
|
camsSdk.Logger.info("MFA Authentication Successful");
|
|
1775
1778
|
setAuthState("Authenticated");
|
|
1776
1779
|
var tokens = { accessToken: accessToken, idToken: idToken };
|
|
1780
|
+
console.log("[MFAGate] Calling onAuthSuccess callbacks", { tokens: tokens, hasLocalCallback: !!onAuthSuccess, hasContextCallback: "onAuthSuccess" in context && !!context.onAuthSuccess });
|
|
1777
1781
|
onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess(tokens);
|
|
1778
1782
|
if ("onAuthSuccess" in context) {
|
|
1779
1783
|
(_a = context.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(context, tokens);
|