@nibssplc/cams-sdk-react 1.0.0-rc.14 → 1.0.0-rc.16

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
@@ -36,8 +36,8 @@ if (typeof window !== 'undefined') {
36
36
  return array;
37
37
  };
38
38
  }
39
- // Polyfill crypto.subtle with SHA-256
40
- if (!window.crypto.subtle) {
39
+ // Polyfill crypto.subtle with SHA-256 (handles both undefined and null in non-HTTPS contexts)
40
+ if (!window.crypto.subtle || window.location.protocol === 'http:') {
41
41
  var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
42
42
  var bytes, hash, k, ml, msg, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
43
43
  return __generator(this, function (_a) {
@@ -471,6 +471,10 @@ function useCAMSMSALAuth(options) {
471
471
  return __generator$1(this, function (_e) {
472
472
  switch (_e.label) {
473
473
  case 0:
474
+ if (inProgress !== InteractionStatus.None) {
475
+ Logger.warn("Authentication already in progress, ignoring duplicate call");
476
+ return [2 /*return*/];
477
+ }
474
478
  setError(null);
475
479
  _e.label = 1;
476
480
  case 1:
@@ -510,6 +514,11 @@ function useCAMSMSALAuth(options) {
510
514
  return [3 /*break*/, 4];
511
515
  case 3:
512
516
  err_1 = _e.sent();
517
+ // Handle interaction_in_progress error
518
+ if (err_1.errorCode === "interaction_in_progress") {
519
+ Logger.warn("Interaction already in progress, please wait");
520
+ return [2 /*return*/];
521
+ }
513
522
  // Handle user cancellation gracefully
514
523
  if (err_1.errorCode === "user_cancelled") {
515
524
  Logger.error("User cancelled login");
@@ -531,7 +540,7 @@ function useCAMSMSALAuth(options) {
531
540
  case 4: return [2 /*return*/];
532
541
  }
533
542
  });
534
- }); }, [instance, scopes, options]);
543
+ }); }, [instance, scopes, options, inProgress]);
535
544
  var completeMFA = useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
536
545
  return __generator$1(this, function (_a) {
537
546
  if (!mfaAuthenticator) {