@nibssplc/cams-sdk-react 0.0.1-beta.42 → 0.0.1-beta.43

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
@@ -16795,13 +16795,21 @@ function useCAMSMSALAuth(options) {
16795
16795
  idToken: response.idToken,
16796
16796
  }));
16797
16797
  }
16798
- (_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
16799
16798
  if (typeof window !== "undefined" &&
16800
16799
  process.env.NODE_ENV !== "test") {
16801
16800
  // Center the popup window
16802
16801
  var left = (window.screen.width - 500) / 2;
16803
16802
  var top_1 = (window.screen.height - 600) / 2;
16804
- window.open(options.mfaUrl, "_blank", "width=500,height=600,left=".concat(left, ",top=").concat(top_1, ",scrollbars=yes,resizable=yes"));
16803
+ var authWindow = window.open(options.mfaUrl, "_blank", "width=500,height=600,left=".concat(left, ",top=").concat(top_1, ",scrollbars=yes,resizable=yes"));
16804
+ if (!authWindow) {
16805
+ Logger$1.error("Popup window blocked");
16806
+ throw new CAMSError(CAMSErrorType.POPUP_BLOCKED, "Popup blocked by browser. Please allow popups and try again.");
16807
+ }
16808
+ if (authWindow.closed) {
16809
+ Logger$1.error("Popup immediately closed by blocker");
16810
+ throw new CAMSError(CAMSErrorType.POPUP_BLOCKED, "Popup blocked by browser. Please allow popups and try again.");
16811
+ }
16812
+ (_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
16805
16813
  }
16806
16814
  })];
16807
16815
  case 2: