@nibssplc/cams-sdk-react 1.0.0-rc.125 → 1.0.0-rc.127

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 CHANGED
@@ -1319,7 +1319,7 @@ var LoadingScreen = function (_a) {
1319
1319
 
1320
1320
  var AuthSuccessAnimation = function (_a) {
1321
1321
  var onComplete = _a.onComplete;
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: 2 }, className: "h-1 bg-green-500 rounded-full max-w-xs" })] }));
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 })] }));
1323
1323
  };
1324
1324
 
1325
1325
  var MAX_ATTEMPTS = 3;
@@ -1479,11 +1479,9 @@ var MFAOptions = function (_a) {
1479
1479
  var _j = React.useState(null), authType = _j[0], setAuthType = _j[1];
1480
1480
  var context = useCAMSContext();
1481
1481
  // Type-safe extraction of completeMFA and logout
1482
- var completeMFA = "completeMFA" in context
1483
- ? context.completeMFA
1484
- : function (data) { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
1485
- return [2 /*return*/, data];
1486
- }); }); };
1482
+ var completeMFA = "completeMFA" in context ? context.completeMFA : function (data) { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
1483
+ return [2 /*return*/, data];
1484
+ }); }); };
1487
1485
  var logout = context.logout;
1488
1486
  var authenticate = useWebAuthN().authenticate;
1489
1487
  var authenticator = new camsSdk.CAMSMFAAuthenticator();
@@ -1508,12 +1506,16 @@ var MFAOptions = function (_a) {
1508
1506
  state: "AUTH_SUCCESS",
1509
1507
  message: (data === null || data === void 0 ? void 0 : data.message) || "Authentication Successful",
1510
1508
  role: data.userInfo.role,
1511
- profile: { userInfo: __assign({}, data.userInfo), tokens: __assign({}, data.tokens) },
1512
- authType: (((_a = context.user) === null || _a === void 0 ? void 0 : _a.authType) || "MSAL"),
1509
+ profile: {
1510
+ userInfo: __assign({}, data.userInfo),
1511
+ tokens: __assign({}, data.tokens),
1512
+ },
1513
+ authType: ((_a = context.user) === null || _a === void 0 ? void 0 : _a.authType) || "MSAL",
1513
1514
  };
1514
1515
  context.setUserProfile(userProfile);
1515
1516
  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] })] }));
1516
1517
  setShowSuccessAnimation(true);
1518
+ onComplete(true);
1517
1519
  return [3 /*break*/, 3];
1518
1520
  case 2:
1519
1521
  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." })] }));