@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.cjs.js CHANGED
@@ -16814,13 +16814,21 @@ function useCAMSMSALAuth(options) {
16814
16814
  idToken: response.idToken,
16815
16815
  }));
16816
16816
  }
16817
- (_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
16818
16817
  if (typeof window !== "undefined" &&
16819
16818
  process.env.NODE_ENV !== "test") {
16820
16819
  // Center the popup window
16821
16820
  var left = (window.screen.width - 500) / 2;
16822
16821
  var top_1 = (window.screen.height - 600) / 2;
16823
- window.open(options.mfaUrl, "_blank", "width=500,height=600,left=".concat(left, ",top=").concat(top_1, ",scrollbars=yes,resizable=yes"));
16822
+ var authWindow = window.open(options.mfaUrl, "_blank", "width=500,height=600,left=".concat(left, ",top=").concat(top_1, ",scrollbars=yes,resizable=yes"));
16823
+ if (!authWindow) {
16824
+ camsSdk.Logger.error("Popup window blocked");
16825
+ throw new camsSdk.CAMSError(camsSdk.CAMSErrorType.POPUP_BLOCKED, "Popup blocked by browser. Please allow popups and try again.");
16826
+ }
16827
+ if (authWindow.closed) {
16828
+ camsSdk.Logger.error("Popup immediately closed by blocker");
16829
+ throw new camsSdk.CAMSError(camsSdk.CAMSErrorType.POPUP_BLOCKED, "Popup blocked by browser. Please allow popups and try again.");
16830
+ }
16831
+ (_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
16824
16832
  }
16825
16833
  })];
16826
16834
  case 2: