@nibssplc/cams-sdk-react 1.0.0-rc.108 → 1.0.0-rc.109

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
@@ -1412,7 +1412,7 @@ var LoadingScreen = function (_a) {
1412
1412
  React.useEffect(function () {
1413
1413
  ldrs.newtonsCradle.register();
1414
1414
  }, []);
1415
- return (jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsxRuntime.jsx("l-newtons-cradle", { size: "35", speed: "1", color: "green" }), loadingText ? (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: loadingText })) : (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: "Loading..." }))] }));
1415
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsxRuntime.jsx("l-newtons-cradle", { size: 124, speed: 1.5, color: "green" }), loadingText ? (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: loadingText })) : (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: "Loading..." }))] }));
1416
1416
  };
1417
1417
 
1418
1418
  var AuthSuccessAnimation = function (_a) {
@@ -1426,8 +1426,8 @@ var useOTPHandler = function (_a) {
1426
1426
  var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
1427
1427
  var _c = React.useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
1428
1428
  var _d = React.useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
1429
- var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
1430
- var currentAttempt, authentication, response, error_1, currentAttempt;
1429
+ var handleSubmitOTP = React.useCallback(function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
1430
+ var currentAttempt, authentication, response, error_1;
1431
1431
  return __generator$1(this, function (_a) {
1432
1432
  switch (_a.label) {
1433
1433
  case 0:
@@ -1439,10 +1439,15 @@ var useOTPHandler = function (_a) {
1439
1439
  _a.sent();
1440
1440
  return [2 /*return*/, false];
1441
1441
  case 2:
1442
- _a.trys.push([2, 11, 13, 14]);
1442
+ currentAttempt = 0;
1443
+ _a.label = 3;
1444
+ case 3:
1445
+ _a.trys.push([3, 12, 14, 15]);
1443
1446
  setLoading(true);
1444
- currentAttempt = attemptCount + 1;
1445
- setAttemptCount(currentAttempt);
1447
+ setAttemptCount(function (prev) {
1448
+ currentAttempt = prev + 1;
1449
+ return currentAttempt;
1450
+ });
1446
1451
  authentication = new camsSdk.CAMSMFAAuthenticator();
1447
1452
  return [4 /*yield*/, authentication.VerifyMFAOTP({
1448
1453
  appCode: appCode,
@@ -1450,46 +1455,45 @@ var useOTPHandler = function (_a) {
1450
1455
  email: email,
1451
1456
  MFACode: authenticationValue,
1452
1457
  }, MFAEndpoint || "")];
1453
- case 3:
1458
+ case 4:
1454
1459
  response = _a.sent();
1455
- if (!response) return [3 /*break*/, 5];
1460
+ if (!response) return [3 /*break*/, 6];
1456
1461
  return [4 /*yield*/, onAuthComplete(true, response)];
1457
- case 4:
1462
+ case 5:
1458
1463
  _a.sent();
1459
1464
  return [2 /*return*/, true];
1460
- case 5:
1461
- if (!(currentAttempt >= MAX_ATTEMPTS)) return [3 /*break*/, 7];
1465
+ case 6:
1466
+ if (!(currentAttempt >= MAX_ATTEMPTS)) return [3 /*break*/, 8];
1462
1467
  setIsMaxAttemptsReached(true);
1463
1468
  return [4 /*yield*/, onAuthComplete(false, {
1464
1469
  message: "Maximum Attempts Reached",
1465
1470
  })];
1466
- case 6:
1471
+ case 7:
1467
1472
  _a.sent();
1468
- return [3 /*break*/, 9];
1469
- case 7: return [4 /*yield*/, onAuthComplete(false, response)];
1470
- case 8:
1473
+ return [3 /*break*/, 10];
1474
+ case 8: return [4 /*yield*/, onAuthComplete(false, response)];
1475
+ case 9:
1471
1476
  _a.sent();
1472
- _a.label = 9;
1473
- case 9: return [2 /*return*/, false];
1474
- case 10: return [3 /*break*/, 14];
1475
- case 11:
1477
+ _a.label = 10;
1478
+ case 10: return [2 /*return*/, false];
1479
+ case 11: return [3 /*break*/, 15];
1480
+ case 12:
1476
1481
  error_1 = _a.sent();
1477
1482
  console.error(error_1);
1478
- currentAttempt = attemptCount + 1;
1479
1483
  if (currentAttempt >= MAX_ATTEMPTS) {
1480
1484
  setIsMaxAttemptsReached(true);
1481
1485
  }
1482
1486
  return [4 /*yield*/, onAuthComplete(false, error_1)];
1483
- case 12:
1487
+ case 13:
1484
1488
  _a.sent();
1485
1489
  return [2 /*return*/, false];
1486
- case 13:
1490
+ case 14:
1487
1491
  setLoading(false);
1488
1492
  return [7 /*endfinally*/];
1489
- case 14: return [2 /*return*/];
1493
+ case 15: return [2 /*return*/];
1490
1494
  }
1491
1495
  });
1492
- }); }; }, [onAuthComplete, MFAEndpoint, attemptCount, isMaxAttemptsReached]);
1496
+ }); }, [onAuthComplete, MFAEndpoint, isMaxAttemptsReached, appCode, instCode, email]);
1493
1497
  var resetAttempts = React.useCallback(function () {
1494
1498
  setAttemptCount(0);
1495
1499
  setIsMaxAttemptsReached(false);