@nibssplc/cams-sdk-react 0.0.1-beta.18 → 0.0.1-beta.20

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
@@ -16702,22 +16702,20 @@ function useCAMSMSALAuth(options) {
16702
16702
  var scopes = options.scopes || ["openid", "profile", "email"];
16703
16703
  useEffect(function () {
16704
16704
  if (account && !isMFAPending) {
16705
- // Get token silently
16705
+ // Get token in foreground popup
16706
16706
  instance
16707
- .acquireTokenSilent({
16707
+ .acquireTokenPopup({
16708
16708
  scopes: scopes,
16709
16709
  account: account,
16710
+ prompt: options.prompt || "select_account",
16710
16711
  })
16711
16712
  .then(function (response) {
16712
16713
  var _a, _b;
16713
16714
  if (options.mfaUrl) {
16714
- // Redirect to MFA page
16715
16715
  setIsMFAPending(true);
16716
16716
  (_a = options.onMFARequired) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken, account);
16717
- window.location.href = "".concat(options.mfaUrl, "?token=").concat(encodeURIComponent(response.accessToken));
16718
16717
  }
16719
16718
  else {
16720
- // Complete auth without MFA
16721
16719
  setToken(response.accessToken);
16722
16720
  setProfile({
16723
16721
  type: "AUTH_SUCCESS",
@@ -16739,7 +16737,7 @@ function useCAMSMSALAuth(options) {
16739
16737
  })
16740
16738
  .catch(function (err) {
16741
16739
  var _a;
16742
- var camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Failed to acquire token silently: " + err);
16740
+ var camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Failed to acquire token: " + err);
16743
16741
  setError(camsError);
16744
16742
  (_a = options.onAuthError) === null || _a === void 0 ? void 0 : _a.call(options, camsError);
16745
16743
  });
@@ -16755,9 +16753,9 @@ function useCAMSMSALAuth(options) {
16755
16753
  _b.label = 1;
16756
16754
  case 1:
16757
16755
  _b.trys.push([1, 3, , 4]);
16758
- return [4 /*yield*/, instance.loginRedirect({
16756
+ return [4 /*yield*/, instance.loginPopup({
16759
16757
  scopes: scopes,
16760
- prompt: "select_account",
16758
+ prompt: options.prompt || "select_account",
16761
16759
  })];
16762
16760
  case 2:
16763
16761
  _b.sent();