@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 +28 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +28 -24
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1391,7 +1391,7 @@ var LoadingScreen = function (_a) {
|
|
|
1391
1391
|
useEffect(function () {
|
|
1392
1392
|
newtonsCradle.register();
|
|
1393
1393
|
}, []);
|
|
1394
|
-
return (jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsx("l-newtons-cradle", { size:
|
|
1394
|
+
return (jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsx("l-newtons-cradle", { size: 124, speed: 1.5, color: "green" }), loadingText ? (jsx("p", { className: "text-center font-semibold mt-3", children: loadingText })) : (jsx("p", { className: "text-center font-semibold mt-3", children: "Loading..." }))] }));
|
|
1395
1395
|
};
|
|
1396
1396
|
|
|
1397
1397
|
var AuthSuccessAnimation = function (_a) {
|
|
@@ -1405,8 +1405,8 @@ var useOTPHandler = function (_a) {
|
|
|
1405
1405
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
1406
1406
|
var _c = useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
|
|
1407
1407
|
var _d = useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
|
|
1408
|
-
var handleSubmitOTP =
|
|
1409
|
-
var currentAttempt, authentication, response, error_1
|
|
1408
|
+
var handleSubmitOTP = useCallback(function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1409
|
+
var currentAttempt, authentication, response, error_1;
|
|
1410
1410
|
return __generator$1(this, function (_a) {
|
|
1411
1411
|
switch (_a.label) {
|
|
1412
1412
|
case 0:
|
|
@@ -1418,10 +1418,15 @@ var useOTPHandler = function (_a) {
|
|
|
1418
1418
|
_a.sent();
|
|
1419
1419
|
return [2 /*return*/, false];
|
|
1420
1420
|
case 2:
|
|
1421
|
-
|
|
1421
|
+
currentAttempt = 0;
|
|
1422
|
+
_a.label = 3;
|
|
1423
|
+
case 3:
|
|
1424
|
+
_a.trys.push([3, 12, 14, 15]);
|
|
1422
1425
|
setLoading(true);
|
|
1423
|
-
|
|
1424
|
-
|
|
1426
|
+
setAttemptCount(function (prev) {
|
|
1427
|
+
currentAttempt = prev + 1;
|
|
1428
|
+
return currentAttempt;
|
|
1429
|
+
});
|
|
1425
1430
|
authentication = new CAMSMFAAuthenticator();
|
|
1426
1431
|
return [4 /*yield*/, authentication.VerifyMFAOTP({
|
|
1427
1432
|
appCode: appCode,
|
|
@@ -1429,46 +1434,45 @@ var useOTPHandler = function (_a) {
|
|
|
1429
1434
|
email: email,
|
|
1430
1435
|
MFACode: authenticationValue,
|
|
1431
1436
|
}, MFAEndpoint || "")];
|
|
1432
|
-
case
|
|
1437
|
+
case 4:
|
|
1433
1438
|
response = _a.sent();
|
|
1434
|
-
if (!response) return [3 /*break*/,
|
|
1439
|
+
if (!response) return [3 /*break*/, 6];
|
|
1435
1440
|
return [4 /*yield*/, onAuthComplete(true, response)];
|
|
1436
|
-
case
|
|
1441
|
+
case 5:
|
|
1437
1442
|
_a.sent();
|
|
1438
1443
|
return [2 /*return*/, true];
|
|
1439
|
-
case
|
|
1440
|
-
if (!(currentAttempt >= MAX_ATTEMPTS)) return [3 /*break*/,
|
|
1444
|
+
case 6:
|
|
1445
|
+
if (!(currentAttempt >= MAX_ATTEMPTS)) return [3 /*break*/, 8];
|
|
1441
1446
|
setIsMaxAttemptsReached(true);
|
|
1442
1447
|
return [4 /*yield*/, onAuthComplete(false, {
|
|
1443
1448
|
message: "Maximum Attempts Reached",
|
|
1444
1449
|
})];
|
|
1445
|
-
case
|
|
1450
|
+
case 7:
|
|
1446
1451
|
_a.sent();
|
|
1447
|
-
return [3 /*break*/,
|
|
1448
|
-
case
|
|
1449
|
-
case
|
|
1452
|
+
return [3 /*break*/, 10];
|
|
1453
|
+
case 8: return [4 /*yield*/, onAuthComplete(false, response)];
|
|
1454
|
+
case 9:
|
|
1450
1455
|
_a.sent();
|
|
1451
|
-
_a.label =
|
|
1452
|
-
case
|
|
1453
|
-
case
|
|
1454
|
-
case
|
|
1456
|
+
_a.label = 10;
|
|
1457
|
+
case 10: return [2 /*return*/, false];
|
|
1458
|
+
case 11: return [3 /*break*/, 15];
|
|
1459
|
+
case 12:
|
|
1455
1460
|
error_1 = _a.sent();
|
|
1456
1461
|
console.error(error_1);
|
|
1457
|
-
currentAttempt = attemptCount + 1;
|
|
1458
1462
|
if (currentAttempt >= MAX_ATTEMPTS) {
|
|
1459
1463
|
setIsMaxAttemptsReached(true);
|
|
1460
1464
|
}
|
|
1461
1465
|
return [4 /*yield*/, onAuthComplete(false, error_1)];
|
|
1462
|
-
case
|
|
1466
|
+
case 13:
|
|
1463
1467
|
_a.sent();
|
|
1464
1468
|
return [2 /*return*/, false];
|
|
1465
|
-
case
|
|
1469
|
+
case 14:
|
|
1466
1470
|
setLoading(false);
|
|
1467
1471
|
return [7 /*endfinally*/];
|
|
1468
|
-
case
|
|
1472
|
+
case 15: return [2 /*return*/];
|
|
1469
1473
|
}
|
|
1470
1474
|
});
|
|
1471
|
-
}); }
|
|
1475
|
+
}); }, [onAuthComplete, MFAEndpoint, isMaxAttemptsReached, appCode, instCode, email]);
|
|
1472
1476
|
var resetAttempts = useCallback(function () {
|
|
1473
1477
|
setAttemptCount(0);
|
|
1474
1478
|
setIsMaxAttemptsReached(false);
|