@nibssplc/cams-sdk-react 1.0.0-rc.90 → 1.0.0-rc.92
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 +24 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +24 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- /package/dist/{components → context}/CAMSMSALProvider.d.ts +0 -0
- /package/dist/{components → context}/CAMSProvider.d.ts +0 -0
- /package/dist/{components → context}/UnifiedCAMSProvider.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -482,7 +482,7 @@ function useCAMSMSALAuth(options) {
|
|
|
482
482
|
}
|
|
483
483
|
}, [accessToken, account, instance, options.storageKey]);
|
|
484
484
|
var login = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
485
|
-
var response, authenticator, userConfig, camsError, err_1, camsError_1, camsError;
|
|
485
|
+
var response, authenticator, userConfig, camsError, error_1, err_1, camsError_1, camsError;
|
|
486
486
|
var _a, _b;
|
|
487
487
|
return __generator$1(this, function (_c) {
|
|
488
488
|
switch (_c.label) {
|
|
@@ -494,7 +494,7 @@ function useCAMSMSALAuth(options) {
|
|
|
494
494
|
setError(null);
|
|
495
495
|
_c.label = 1;
|
|
496
496
|
case 1:
|
|
497
|
-
_c.trys.push([1,
|
|
497
|
+
_c.trys.push([1, 7, , 8]);
|
|
498
498
|
return [4 /*yield*/, instance.loginPopup({
|
|
499
499
|
scopes: scopes,
|
|
500
500
|
prompt: prompt || "login",
|
|
@@ -503,13 +503,16 @@ function useCAMSMSALAuth(options) {
|
|
|
503
503
|
response = _c.sent();
|
|
504
504
|
authenticator = new camsSdk.CAMSMFAAuthenticator();
|
|
505
505
|
setIsFetchingMFAConfig(true);
|
|
506
|
+
_c.label = 3;
|
|
507
|
+
case 3:
|
|
508
|
+
_c.trys.push([3, 5, , 6]);
|
|
506
509
|
return [4 /*yield*/, authenticator.GetUserMFAConfig({
|
|
507
510
|
accessToken: response.accessToken,
|
|
508
511
|
idToken: response.idToken,
|
|
509
512
|
provider: "MSAL",
|
|
510
513
|
APIAuthEndpoint: ValidateUserEndpoint,
|
|
511
514
|
})];
|
|
512
|
-
case
|
|
515
|
+
case 4:
|
|
513
516
|
userConfig = _c.sent();
|
|
514
517
|
setIsFetchingMFAConfig(false);
|
|
515
518
|
camsSdk.Logger.info("CAMS MFA Authenticator initialized. MSAL User Auth is Completed...", {
|
|
@@ -537,8 +540,20 @@ function useCAMSMSALAuth(options) {
|
|
|
537
540
|
setError(camsError);
|
|
538
541
|
setIsFetchingMFAConfig(false);
|
|
539
542
|
}
|
|
540
|
-
return [3 /*break*/,
|
|
541
|
-
case
|
|
543
|
+
return [3 /*break*/, 6];
|
|
544
|
+
case 5:
|
|
545
|
+
error_1 = _c.sent();
|
|
546
|
+
if (error_1 instanceof camsSdk.CAMSError &&
|
|
547
|
+
error_1.type === camsSdk.CAMSErrorType.NETWORK_ERROR) {
|
|
548
|
+
sonner.toast.error(error_1.message);
|
|
549
|
+
camsSdk.Logger.error(error_1.message);
|
|
550
|
+
setError(error_1);
|
|
551
|
+
setIsFetchingMFAConfig(false);
|
|
552
|
+
return [2 /*return*/];
|
|
553
|
+
}
|
|
554
|
+
return [3 /*break*/, 6];
|
|
555
|
+
case 6: return [3 /*break*/, 8];
|
|
556
|
+
case 7:
|
|
542
557
|
err_1 = _c.sent();
|
|
543
558
|
// Handle interaction_in_progress error
|
|
544
559
|
if (err_1.errorCode === "interaction_in_progress") {
|
|
@@ -548,8 +563,8 @@ function useCAMSMSALAuth(options) {
|
|
|
548
563
|
}
|
|
549
564
|
// Handle user cancellation gracefully
|
|
550
565
|
if (err_1.errorCode === "user_cancelled") {
|
|
551
|
-
camsSdk.Logger.error("User
|
|
552
|
-
sonner.toast.error("User
|
|
566
|
+
camsSdk.Logger.error("User Cancelled Login Flow");
|
|
567
|
+
sonner.toast.error("User Cancelled Login Flow");
|
|
553
568
|
setError(null); // Don't treat cancellation as an error
|
|
554
569
|
return [2 /*return*/];
|
|
555
570
|
}
|
|
@@ -564,8 +579,8 @@ function useCAMSMSALAuth(options) {
|
|
|
564
579
|
camsError = new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "Login failed: " + err_1.message || err_1);
|
|
565
580
|
setError(camsError);
|
|
566
581
|
setIsFetchingMFAConfig(false);
|
|
567
|
-
return [3 /*break*/,
|
|
568
|
-
case
|
|
582
|
+
return [3 /*break*/, 8];
|
|
583
|
+
case 8: return [2 /*return*/];
|
|
569
584
|
}
|
|
570
585
|
});
|
|
571
586
|
}); }, [
|