@nibssplc/cams-sdk-react 1.0.0-rc.83 → 1.0.0-rc.84

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.esm.js CHANGED
@@ -421,7 +421,8 @@ function useCAMSMSALAuth(options) {
421
421
  var _e = useState(""), accessToken = _e[0], setAccessToken = _e[1];
422
422
  var _f = useState(""), email = _f[0], setEmail = _f[1];
423
423
  var _g = useState(false), requiresMFA = _g[0], setRequiresMFA = _g[1];
424
- var isLoading = inProgress !== InteractionStatus.None;
424
+ var _h = useState(false), isFetchingMFAConfig = _h[0], setIsFetchingMFAConfig = _h[1];
425
+ var isLoading = inProgress !== InteractionStatus.None || isFetchingMFAConfig;
425
426
  var isAuthenticated = !!account && !!accessToken;
426
427
  var scopes = optScopes || ["openid", "profile", "email"];
427
428
  var isTokenValid = function (token) {
@@ -490,9 +491,11 @@ function useCAMSMSALAuth(options) {
490
491
  APIAuthEndpoint: ValidateUserEndpoint,
491
492
  };
492
493
  authenticator = new CAMSMFAAuthenticator();
494
+ setIsFetchingMFAConfig(true);
493
495
  return [4 /*yield*/, authenticator.GetUserMFAConfig(mfaConfig)];
494
496
  case 3:
495
497
  userConfig = _b.sent();
498
+ setIsFetchingMFAConfig(false);
496
499
  console.log("CAMS MFA Authenticator initialized:", {
497
500
  mfaConfig: mfaConfig,
498
501
  userConfig: userConfig,
@@ -519,6 +522,7 @@ function useCAMSMSALAuth(options) {
519
522
  camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Login failed: " + userConfig.message);
520
523
  toast.error("Login failed");
521
524
  setError(camsError);
525
+ setIsFetchingMFAConfig(false);
522
526
  }
523
527
  return [3 /*break*/, 5];
524
528
  case 4:
@@ -543,6 +547,7 @@ function useCAMSMSALAuth(options) {
543
547
  }
544
548
  camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Login failed: " + err_1.message || err_1);
545
549
  setError(camsError);
550
+ setIsFetchingMFAConfig(false);
546
551
  return [3 /*break*/, 5];
547
552
  case 5: return [2 /*return*/];
548
553
  }