@okta/okta-auth-js 6.2.0 → 6.3.0

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/cjs/AuthStateManager.js +9 -3
  3. package/cjs/AuthStateManager.js.map +1 -1
  4. package/cjs/OktaUserAgent.js +2 -2
  5. package/cjs/PromiseQueue.js +9 -2
  6. package/cjs/PromiseQueue.js.map +1 -1
  7. package/cjs/ServiceManager.js +3 -3
  8. package/cjs/ServiceManager.js.map +1 -1
  9. package/cjs/TransactionManager.js +8 -2
  10. package/cjs/TransactionManager.js.map +1 -1
  11. package/cjs/browser/browserStorage.js +19 -18
  12. package/cjs/browser/browserStorage.js.map +1 -1
  13. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  14. package/cjs/idx/authenticator/OktaPassword.js +12 -3
  15. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  16. package/cjs/idx/authenticator/OktaVerifyTotp.js +9 -1
  17. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -1
  18. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +14 -1
  19. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  20. package/cjs/idx/authenticator/SecurityQuestionVerification.js +9 -1
  21. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  22. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +13 -3
  23. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  24. package/cjs/idx/authenticator/WebauthnEnrollment.js +5 -0
  25. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -1
  26. package/cjs/idx/authenticator/WebauthnVerification.js +5 -0
  27. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -1
  28. package/cjs/idx/authenticator/util.js +64 -0
  29. package/cjs/idx/authenticator/util.js.map +1 -0
  30. package/cjs/idx/idx-js/index.js +0 -122
  31. package/cjs/idx/idx-js/index.js.map +1 -1
  32. package/cjs/idx/idx-js/introspect.js +10 -6
  33. package/cjs/idx/idx-js/introspect.js.map +1 -1
  34. package/cjs/idx/idx-js/v1/generateIdxAction.js +17 -23
  35. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -1
  36. package/cjs/idx/idx-js/v1/makeIdxState.js +5 -4
  37. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -1
  38. package/cjs/idx/introspect.js +13 -3
  39. package/cjs/idx/introspect.js.map +1 -1
  40. package/cjs/idx/proceed.js +14 -11
  41. package/cjs/idx/proceed.js.map +1 -1
  42. package/cjs/idx/remediate.js +65 -72
  43. package/cjs/idx/remediate.js.map +1 -1
  44. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +6 -2
  45. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  46. package/cjs/idx/remediators/AuthenticatorVerificationData.js +23 -19
  47. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  48. package/cjs/idx/remediators/Base/AuthenticatorData.js +22 -14
  49. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  50. package/cjs/idx/remediators/Base/Remediator.js +85 -85
  51. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  52. package/cjs/idx/remediators/Base/SelectAuthenticator.js +24 -15
  53. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  54. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +15 -4
  55. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  56. package/cjs/idx/remediators/ChallengePoll.js +8 -1
  57. package/cjs/idx/remediators/ChallengePoll.js.map +1 -1
  58. package/cjs/idx/remediators/EnrollPoll.js +1 -1
  59. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  60. package/cjs/idx/remediators/EnrollProfile.js +15 -9
  61. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  62. package/cjs/idx/remediators/EnrollmentChannelData.js +0 -8
  63. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  64. package/cjs/idx/remediators/Identify.js +12 -5
  65. package/cjs/idx/remediators/Identify.js.map +1 -1
  66. package/cjs/idx/remediators/ReEnrollAuthenticator.js +9 -8
  67. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  68. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +4 -3
  69. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  70. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +0 -1
  71. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
  72. package/cjs/idx/remediators/Skip.js +1 -8
  73. package/cjs/idx/remediators/Skip.js.map +1 -1
  74. package/cjs/idx/remediators/util.js.map +1 -1
  75. package/cjs/idx/run.js +267 -198
  76. package/cjs/idx/run.js.map +1 -1
  77. package/cjs/idx/types/idx-js.js.map +1 -1
  78. package/cjs/idx/types/index.js +37 -0
  79. package/cjs/idx/types/index.js.map +1 -1
  80. package/cjs/idx/util.js +198 -0
  81. package/cjs/idx/util.js.map +1 -0
  82. package/cjs/options/browser.js +11 -6
  83. package/cjs/options/browser.js.map +1 -1
  84. package/cjs/options/index.js +1 -1
  85. package/cjs/options/index.js.map +1 -1
  86. package/cjs/options/node.js +5 -6
  87. package/cjs/options/node.js.map +1 -1
  88. package/cjs/options.js +170 -0
  89. package/cjs/options.js.map +1 -0
  90. package/dist/okta-auth-js.min.js +1 -1
  91. package/dist/okta-auth-js.min.js.map +1 -1
  92. package/dist/okta-auth-js.umd.js +1 -1
  93. package/dist/okta-auth-js.umd.js.map +1 -1
  94. package/esm/esm.browser.js +1178 -794
  95. package/esm/esm.browser.js.map +1 -1
  96. package/esm/esm.node.mjs +1099 -781
  97. package/esm/esm.node.mjs.map +1 -1
  98. package/lib/AuthStateManager.d.ts +2 -0
  99. package/lib/PromiseQueue.d.ts +6 -2
  100. package/lib/TransactionManager.d.ts +3 -4
  101. package/lib/idx/authenticator/Authenticator.d.ts +1 -1
  102. package/lib/idx/authenticator/OktaPassword.d.ts +2 -1
  103. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +1 -1
  104. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +3 -5
  105. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +1 -1
  106. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +2 -1
  107. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +1 -1
  108. package/lib/idx/authenticator/WebauthnVerification.d.ts +1 -1
  109. package/lib/idx/authenticator/util.d.ts +4 -0
  110. package/lib/idx/idx-js/index.d.ts +1 -17
  111. package/lib/idx/idx-js/introspect.d.ts +2 -1
  112. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +1 -1
  113. package/lib/idx/idx-js/v1/makeIdxState.d.ts +2 -2
  114. package/lib/idx/proceed.d.ts +1 -3
  115. package/lib/idx/remediate.d.ts +2 -2
  116. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +1 -0
  117. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +0 -3
  118. package/lib/idx/remediators/Base/Remediator.d.ts +5 -4
  119. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +7 -9
  120. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +2 -4
  121. package/lib/idx/remediators/ChallengePoll.d.ts +1 -0
  122. package/lib/idx/remediators/EnrollProfile.d.ts +0 -3
  123. package/lib/idx/remediators/EnrollmentChannelData.d.ts +0 -4
  124. package/lib/idx/remediators/Identify.d.ts +3 -5
  125. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -5
  126. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +2 -1
  127. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +1 -2
  128. package/lib/idx/remediators/Skip.d.ts +0 -3
  129. package/lib/idx/types/idx-js.d.ts +5 -1
  130. package/lib/idx/types/index.d.ts +7 -3
  131. package/lib/idx/util.d.ts +11 -0
  132. package/lib/options/browser.d.ts +2 -2
  133. package/lib/options/node.d.ts +2 -2
  134. package/lib/options.d.ts +14 -0
  135. package/lib/types/Storage.d.ts +7 -5
  136. package/lib/types/api.d.ts +1 -3
  137. package/package.json +7 -6
@@ -49,13 +49,14 @@ import { BroadcastChannel, createLeaderElection } from 'broadcast-channel';
49
49
  import PCancelable from 'p-cancelable';
50
50
  import _entriesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/entries';
51
51
  import crossFetch from 'cross-fetch';
52
- import _URL from '@babel/runtime-corejs3/core-js-stable/url';
52
+ import NodeCache from 'node-cache';
53
53
  import _Object$fromEntries from '@babel/runtime-corejs3/core-js-stable/object/from-entries';
54
54
  import { JSONPath } from 'jsonpath-plus';
55
55
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
56
- import _get from '@babel/runtime-corejs3/helpers/get';
57
56
  import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
57
+ import _get from '@babel/runtime-corejs3/helpers/get';
58
58
  import _Number$isInteger from '@babel/runtime-corejs3/core-js-stable/number/is-integer';
59
+ import _URL2 from '@babel/runtime-corejs3/core-js-stable/url';
59
60
  import Emitter from 'tiny-emitter';
60
61
 
61
62
  function _createSuper$x(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$x(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -1711,6 +1712,9 @@ var IdxFeature;
1711
1712
  IdxFeature["SOCIAL_IDP"] = "redirect-idp";
1712
1713
  IdxFeature["ACCOUNT_UNLOCK"] = "unlock-account";
1713
1714
  })(IdxFeature || (IdxFeature = {}));
1715
+ function isAuthenticator(obj) {
1716
+ return obj && (obj.key || obj.id);
1717
+ }
1714
1718
 
1715
1719
  function isToken(obj) {
1716
1720
  if (obj && (obj.accessToken || obj.idToken || obj.refreshToken) && Array.isArray(obj.scopes)) {
@@ -2649,16 +2653,16 @@ var storageUtil = {
2649
2653
  },
2650
2654
  browserHasLocalStorage: function browserHasLocalStorage() {
2651
2655
  try {
2652
- var storage = storageUtil.getLocalStorage();
2653
- return storageUtil.testStorage(storage);
2656
+ var storage = this.getLocalStorage();
2657
+ return this.testStorage(storage);
2654
2658
  } catch (e) {
2655
2659
  return false;
2656
2660
  }
2657
2661
  },
2658
2662
  browserHasSessionStorage: function browserHasSessionStorage() {
2659
2663
  try {
2660
- var storage = storageUtil.getSessionStorage();
2661
- return storageUtil.testStorage(storage);
2664
+ var storage = this.getSessionStorage();
2665
+ return this.testStorage(storage);
2662
2666
  } catch (e) {
2663
2667
  return false;
2664
2668
  }
@@ -2667,10 +2671,10 @@ var storageUtil = {
2667
2671
  var supported = false;
2668
2672
  switch (storageType) {
2669
2673
  case 'sessionStorage':
2670
- supported = storageUtil.browserHasSessionStorage();
2674
+ supported = this.browserHasSessionStorage();
2671
2675
  break;
2672
2676
  case 'localStorage':
2673
- supported = storageUtil.browserHasLocalStorage();
2677
+ supported = this.browserHasLocalStorage();
2674
2678
  break;
2675
2679
  case 'cookie':
2676
2680
  case 'memory':
@@ -2686,16 +2690,16 @@ var storageUtil = {
2686
2690
  var storageProvider;
2687
2691
  switch (storageType) {
2688
2692
  case 'sessionStorage':
2689
- storageProvider = storageUtil.getSessionStorage();
2693
+ storageProvider = this.getSessionStorage();
2690
2694
  break;
2691
2695
  case 'localStorage':
2692
- storageProvider = storageUtil.getLocalStorage();
2696
+ storageProvider = this.getLocalStorage();
2693
2697
  break;
2694
2698
  case 'cookie':
2695
- storageProvider = storageUtil.getCookieStorage(options);
2699
+ storageProvider = this.getCookieStorage(options);
2696
2700
  break;
2697
2701
  case 'memory':
2698
- storageProvider = storageUtil.getInMemoryStorage();
2702
+ storageProvider = this.getInMemoryStorage();
2699
2703
  break;
2700
2704
  default:
2701
2705
  throw new AuthSdkError("Unrecognized storage option: ".concat(storageType));
@@ -2712,11 +2716,11 @@ var storageUtil = {
2712
2716
  if (!nextType) {
2713
2717
  return curType;
2714
2718
  }
2715
- if (storageUtil.testStorageType(curType)) {
2719
+ if (this.testStorageType(curType)) {
2716
2720
  return curType;
2717
2721
  }
2718
2722
  warn(_concatInstanceProperty(_context = "This browser doesn't support ".concat(curType, ". Switching to ")).call(_context, nextType, "."));
2719
- return storageUtil.findStorageType(types);
2723
+ return this.findStorageType(types);
2720
2724
  },
2721
2725
  getLocalStorage: function getLocalStorage() {
2722
2726
  return localStorage;
@@ -2725,6 +2729,7 @@ var storageUtil = {
2725
2729
  return sessionStorage;
2726
2730
  },
2727
2731
  getCookieStorage: function getCookieStorage(options) {
2732
+ var _this = this;
2728
2733
  var secure = options.secure;
2729
2734
  var sameSite = options.sameSite;
2730
2735
  var sessionCookie = options.sessionCookie;
@@ -2732,17 +2737,17 @@ var storageUtil = {
2732
2737
  throw new AuthSdkError('getCookieStorage: "secure" and "sameSite" options must be provided');
2733
2738
  }
2734
2739
  var storage = {
2735
- getItem: storageUtil.storage.get,
2740
+ getItem: this.storage.get,
2736
2741
  setItem: function setItem(key, value) {
2737
2742
  var expiresAt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '2200-01-01T00:00:00.000Z';
2738
2743
  expiresAt = sessionCookie ? null : expiresAt;
2739
- storageUtil.storage.set(key, value, expiresAt, {
2744
+ _this.storage.set(key, value, expiresAt, {
2740
2745
  secure: secure,
2741
2746
  sameSite: sameSite
2742
2747
  });
2743
2748
  },
2744
2749
  removeItem: function removeItem(key) {
2745
- storageUtil.storage.delete(key);
2750
+ _this.storage.delete(key);
2746
2751
  }
2747
2752
  };
2748
2753
  if (!options.useSeparateCookies) {
@@ -2782,13 +2787,13 @@ var storageUtil = {
2782
2787
  },
2783
2788
  inMemoryStore: {},
2784
2789
  getInMemoryStorage: function getInMemoryStorage() {
2785
- var _this = this;
2790
+ var _this2 = this;
2786
2791
  return {
2787
2792
  getItem: function getItem(key) {
2788
- return _this.inMemoryStore[key];
2793
+ return _this2.inMemoryStore[key];
2789
2794
  },
2790
2795
  setItem: function setItem(key, value) {
2791
- _this.inMemoryStore[key] = value;
2796
+ _this2.inMemoryStore[key] = value;
2792
2797
  }
2793
2798
  };
2794
2799
  },
@@ -2818,7 +2823,7 @@ var storageUtil = {
2818
2823
  cookieOptions.expires = new Date(expiresAt);
2819
2824
  }
2820
2825
  Cookies.set(name, value, cookieOptions);
2821
- return storageUtil.storage.get(name);
2826
+ return this.get(name);
2822
2827
  },
2823
2828
  get: function get(name) {
2824
2829
  if (!arguments.length) {
@@ -3458,9 +3463,9 @@ var SyncStorageService = function () {
3458
3463
  return SyncStorageService;
3459
3464
  }();
3460
3465
 
3461
- function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3462
- function _unsupportedIterableToArray$6(o, minLen) { var _context4; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = _sliceInstanceProperty(_context4 = Object.prototype.toString.call(o)).call(_context4, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
3463
- function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3466
+ function _createForOfIteratorHelper$7(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3467
+ function _unsupportedIterableToArray$7(o, minLen) { var _context4; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$7(o, minLen); var n = _sliceInstanceProperty(_context4 = Object.prototype.toString.call(o)).call(_context4, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen); }
3468
+ function _arrayLikeToArray$7(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3464
3469
  var ServiceManager = function () {
3465
3470
  function ServiceManager(sdk) {
3466
3471
  var _this = this;
@@ -3545,7 +3550,7 @@ var ServiceManager = function () {
3545
3550
  key: "startServices",
3546
3551
  value: function startServices() {
3547
3552
  var _context2;
3548
- var _iterator = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context2 = this.services).call(_context2)),
3553
+ var _iterator = _createForOfIteratorHelper$7(_valuesInstanceProperty(_context2 = this.services).call(_context2)),
3549
3554
  _step;
3550
3555
  try {
3551
3556
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -3565,7 +3570,7 @@ var ServiceManager = function () {
3565
3570
  key: "stopServices",
3566
3571
  value: function stopServices() {
3567
3572
  var _context3;
3568
- var _iterator2 = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context3 = this.services).call(_context3)),
3573
+ var _iterator2 = _createForOfIteratorHelper$7(_valuesInstanceProperty(_context3 = this.services).call(_context3)),
3569
3574
  _step2;
3570
3575
  try {
3571
3576
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -3577,7 +3582,6 @@ var ServiceManager = function () {
3577
3582
  } finally {
3578
3583
  _iterator2.f();
3579
3584
  }
3580
- this.services = new _Map();
3581
3585
  }
3582
3586
  }, {
3583
3587
  key: "startElector",
@@ -3598,10 +3602,12 @@ var ServiceManager = function () {
3598
3602
  }, {
3599
3603
  key: "stopElector",
3600
3604
  value: function stopElector() {
3601
- var _a;
3605
+ var _a, _b;
3602
3606
  if (this.elector) {
3603
3607
  (_a = this.elector) === null || _a === void 0 ? void 0 : _a.die();
3604
3608
  this.elector = undefined;
3609
+ (_b = this.channel) === null || _b === void 0 ? void 0 : _b.close();
3610
+ this.channel = undefined;
3605
3611
  }
3606
3612
  }
3607
3613
  }, {
@@ -3638,9 +3644,13 @@ ServiceManager.defaultOptions = {
3638
3644
 
3639
3645
  var PromiseQueue = function () {
3640
3646
  function PromiseQueue() {
3647
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
3648
+ quiet: false
3649
+ };
3641
3650
  _classCallCheck(this, PromiseQueue);
3642
3651
  this.queue = [];
3643
3652
  this.running = false;
3653
+ this.options = options;
3644
3654
  }
3645
3655
  _createClass(PromiseQueue, [{
3646
3656
  key: "push",
@@ -3651,7 +3661,9 @@ var PromiseQueue = function () {
3651
3661
  }
3652
3662
  return new _Promise(function (resolve, reject) {
3653
3663
  if (_this.queue.length > 0) {
3654
- warn('Async method is being called but another async method is already running. ' + 'The new method will be delayed until the previous method completes.');
3664
+ if (_this.options.quiet !== false) {
3665
+ warn('Async method is being called but another async method is already running. ' + 'The new method will be delayed until the previous method completes.');
3666
+ }
3655
3667
  }
3656
3668
  _this.queue.push({
3657
3669
  method: method,
@@ -3764,6 +3776,9 @@ var AuthStateManager = function () {
3764
3776
  this._authState = INITIAL_AUTH_STATE;
3765
3777
  this._logOptions = {};
3766
3778
  this._prevAuthState = null;
3779
+ this._transformQueue = new PromiseQueue({
3780
+ quiet: true
3781
+ });
3767
3782
  sdk.tokenManager.on(EVENT_ADDED, function (key, token) {
3768
3783
  _this._setLogOptions({
3769
3784
  event: EVENT_ADDED,
@@ -3882,7 +3897,7 @@ var AuthStateManager = function () {
3882
3897
  refreshToken: refreshToken,
3883
3898
  isAuthenticated: !!(accessToken && idToken)
3884
3899
  };
3885
- var promise = transformAuthState ? transformAuthState(_this2._sdk, authState) : _Promise.resolve(authState);
3900
+ var promise = transformAuthState ? _this2._transformQueue.push(transformAuthState, null, _this2._sdk, authState) : _Promise.resolve(authState);
3886
3901
  promise.then(function (authState) {
3887
3902
  return emitAndResolve(authState);
3888
3903
  }).catch(function (error) {
@@ -4415,7 +4430,9 @@ var TransactionManager = function () {
4415
4430
  }
4416
4431
  }, {
4417
4432
  key: "saveIdxResponse",
4418
- value: function saveIdxResponse(idxResponse) {
4433
+ value: function saveIdxResponse(_ref) {
4434
+ var rawIdxResponse = _ref.rawIdxResponse,
4435
+ requestDidSucceed = _ref.requestDidSucceed;
4419
4436
  if (!this.saveLastResponse) {
4420
4437
  return;
4421
4438
  }
@@ -4423,7 +4440,10 @@ var TransactionManager = function () {
4423
4440
  if (!storage) {
4424
4441
  return;
4425
4442
  }
4426
- storage.setStorage(idxResponse);
4443
+ storage.setStorage({
4444
+ rawIdxResponse: rawIdxResponse,
4445
+ requestDidSucceed: requestDidSucceed
4446
+ });
4427
4447
  }
4428
4448
  }, {
4429
4449
  key: "loadIdxResponse",
@@ -4473,9 +4493,9 @@ function assertValidConfig(args) {
4473
4493
  }
4474
4494
  }
4475
4495
 
4476
- function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4477
- function _unsupportedIterableToArray$5(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
4478
- function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4496
+ function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4497
+ function _unsupportedIterableToArray$6(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
4498
+ function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4479
4499
  function readData(response) {
4480
4500
  var _context;
4481
4501
  if (response.headers.get('Content-Type') &&
@@ -4495,7 +4515,7 @@ function formatResult(status, data, response) {
4495
4515
  var _context2;
4496
4516
  var isObject = _typeof(data) === 'object';
4497
4517
  var headers = {};
4498
- var _iterator = _createForOfIteratorHelper$5(_entriesInstanceProperty(_context2 = response.headers).call(_context2)),
4518
+ var _iterator = _createForOfIteratorHelper$6(_entriesInstanceProperty(_context2 = response.headers).call(_context2)),
4499
4519
  _step;
4500
4520
  try {
4501
4521
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4550,7 +4570,93 @@ function fetchRequest(method, url, args) {
4550
4570
  });
4551
4571
  }
4552
4572
 
4553
- var STORAGE_MANAGER_OPTIONS = {
4573
+ var sharedStorage = typeof NodeCache === 'function' ? new NodeCache() : null;
4574
+ var ServerCookies = function () {
4575
+ function ServerCookies(nodeCache) {
4576
+ _classCallCheck(this, ServerCookies);
4577
+ this.nodeCache = nodeCache;
4578
+ }
4579
+ _createClass(ServerCookies, [{
4580
+ key: "set",
4581
+ value: function set(name, value, expiresAt) {
4582
+ if (!!Date.parse(expiresAt)) {
4583
+ var ttl = (Date.parse(expiresAt) - Date.now()) / 1000;
4584
+ this.nodeCache.set(name, value, ttl);
4585
+ } else {
4586
+ this.nodeCache.set(name, value);
4587
+ }
4588
+ return this.get(name);
4589
+ }
4590
+ }, {
4591
+ key: "get",
4592
+ value: function get(name) {
4593
+ return this.nodeCache.get(name);
4594
+ }
4595
+ }, {
4596
+ key: "delete",
4597
+ value: function _delete(name) {
4598
+ return this.nodeCache.del(name);
4599
+ }
4600
+ }]);
4601
+ return ServerCookies;
4602
+ }();
4603
+ var ServerStorage = function () {
4604
+ function ServerStorage(nodeCache) {
4605
+ _classCallCheck(this, ServerStorage);
4606
+ this.nodeCache = nodeCache;
4607
+ this.storage = new ServerCookies(nodeCache);
4608
+ }
4609
+ _createClass(ServerStorage, [{
4610
+ key: "testStorageType",
4611
+ value: function testStorageType(storageType) {
4612
+ var supported = false;
4613
+ switch (storageType) {
4614
+ case 'memory':
4615
+ supported = true;
4616
+ break;
4617
+ }
4618
+ return supported;
4619
+ }
4620
+ }, {
4621
+ key: "getStorageByType",
4622
+ value: function getStorageByType(storageType) {
4623
+ var storageProvider;
4624
+ switch (storageType) {
4625
+ case 'memory':
4626
+ storageProvider = this.getStorage();
4627
+ break;
4628
+ default:
4629
+ throw new AuthSdkError("Unrecognized storage option: ".concat(storageType));
4630
+ }
4631
+ return storageProvider;
4632
+ }
4633
+ }, {
4634
+ key: "findStorageType",
4635
+ value: function findStorageType() {
4636
+ return 'memory';
4637
+ }
4638
+ }, {
4639
+ key: "getHttpCache",
4640
+ value: function getHttpCache() {
4641
+ return null;
4642
+ }
4643
+ }, {
4644
+ key: "getStorage",
4645
+ value: function getStorage() {
4646
+ var _this = this;
4647
+ return {
4648
+ getItem: this.nodeCache.get,
4649
+ setItem: function setItem(key, value) {
4650
+ _this.nodeCache.set(key, value, '2200-01-01T00:00:00.000Z');
4651
+ }
4652
+ };
4653
+ }
4654
+ }]);
4655
+ return ServerStorage;
4656
+ }();
4657
+ var serverStorage = new ServerStorage(sharedStorage);
4658
+
4659
+ var BROWSER_STORAGE = {
4554
4660
  token: {
4555
4661
  storageTypes: ['localStorage', 'sessionStorage', 'cookie']
4556
4662
  },
@@ -4567,7 +4673,17 @@ var STORAGE_MANAGER_OPTIONS = {
4567
4673
  storageTypes: ['localStorage']
4568
4674
  }
4569
4675
  };
4570
- var enableSharedStorage = true;
4676
+ var SERVER_STORAGE = {
4677
+ token: {
4678
+ storageTypes: ['memory']
4679
+ },
4680
+ cache: {
4681
+ storageTypes: ['memory']
4682
+ },
4683
+ transaction: {
4684
+ storageTypes: ['memory']
4685
+ }
4686
+ };
4571
4687
  function getCookieSettings() {
4572
4688
  var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4573
4689
  var isHTTPS = arguments.length > 1 ? arguments[1] : undefined;
@@ -4587,18 +4703,26 @@ function getCookieSettings() {
4587
4703
  }
4588
4704
  return cookieSettings;
4589
4705
  }
4590
-
4591
4706
  function getDefaultOptions() {
4592
- var options = {
4707
+ var storageUtil$1;
4708
+ if (isBrowser()) {
4709
+ storageUtil$1 = _Object$assign({}, storageUtil, {
4710
+ inMemoryStore: {}
4711
+ });
4712
+ } else {
4713
+ storageUtil$1 = serverStorage;
4714
+ }
4715
+ var storageManager = isBrowser() ? BROWSER_STORAGE : SERVER_STORAGE;
4716
+ var enableSharedStorage = isBrowser() ? true : false;
4717
+ return {
4593
4718
  devMode: false,
4594
4719
  httpRequestClient: fetchRequest,
4595
- storageUtil: storageUtil,
4596
- storageManager: STORAGE_MANAGER_OPTIONS,
4720
+ storageUtil: storageUtil$1,
4721
+ storageManager: storageManager,
4597
4722
  transactionManager: {
4598
4723
  enableSharedStorage: enableSharedStorage
4599
4724
  }
4600
4725
  };
4601
- return options;
4602
4726
  }
4603
4727
  function mergeOptions(options, args) {
4604
4728
  return _Object$assign({}, options, removeNils(args), {
@@ -4635,7 +4759,7 @@ function buildOptions() {
4635
4759
  devMode: !!args.devMode,
4636
4760
  storageManager: args.storageManager,
4637
4761
  transactionManager: args.transactionManager,
4638
- cookies: getCookieSettings(args, isHTTPS()),
4762
+ cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,
4639
4763
  flow: args.flow,
4640
4764
  codeChallenge: args.codeChallenge,
4641
4765
  codeChallengeMethod: args.codeChallengeMethod,
@@ -4706,9 +4830,9 @@ var request = function () {
4706
4830
  };
4707
4831
  }();
4708
4832
 
4709
- function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4710
- function _unsupportedIterableToArray$4(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
4711
- function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4833
+ function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4834
+ function _unsupportedIterableToArray$5(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
4835
+ function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4712
4836
  var isFieldMutable = function isFieldMutable(field) {
4713
4837
  return field.mutable !== false;
4714
4838
  };
@@ -4725,7 +4849,7 @@ var divideSingleActionParamsByMutability = function divideSingleActionParamsByMu
4725
4849
  immutableParamsForAction: immutableParamsForAction
4726
4850
  };
4727
4851
  }
4728
- var _iterator = _createForOfIteratorHelper$4(action.value),
4852
+ var _iterator = _createForOfIteratorHelper$5(action.value),
4729
4853
  _step;
4730
4854
  try {
4731
4855
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4755,7 +4879,7 @@ var divideActionParamsByMutability = function divideActionParamsByMutability(act
4755
4879
  var neededParams = [];
4756
4880
  var defaultParams = {};
4757
4881
  var immutableParams = {};
4758
- var _iterator2 = _createForOfIteratorHelper$4(actionList),
4882
+ var _iterator2 = _createForOfIteratorHelper$5(actionList),
4759
4883
  _step2;
4760
4884
  try {
4761
4885
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -4790,7 +4914,7 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4790
4914
  var target = actionDefinition.href;
4791
4915
  return function () {
4792
4916
  var _ref2 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(params) {
4793
- var headers, body, credentials;
4917
+ var headers, body, credentials, response, responseJSON, requestDidSucceed, idxResponse;
4794
4918
  return _regeneratorRuntime.wrap(function _callee$(_context) {
4795
4919
  while (1) {
4796
4920
  switch (_context.prev = _context.next) {
@@ -4801,29 +4925,32 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4801
4925
  };
4802
4926
  body = _JSON$stringify(_Object$assign(_Object$assign(_Object$assign({}, defaultParamsForAction), params), immutableParamsForAction));
4803
4927
  credentials = toPersist && toPersist.withCredentials === false ? 'omit' : 'include';
4804
- return _context.abrupt("return", request(target, {
4928
+ _context.next = 5;
4929
+ return request(target, {
4805
4930
  method: actionDefinition.method,
4806
4931
  headers: headers,
4807
4932
  body: body,
4808
4933
  credentials: credentials
4809
- }).then(function (response) {
4810
- var respJson = response.json();
4811
- if (response.ok) {
4812
- return respJson;
4813
- } else if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm="Okta Device"') {
4814
- return respJson.then(function (err) {
4815
- var ms = makeIdxState$1(err, toPersist);
4816
- ms.stepUp = true;
4817
- return _Promise.reject(ms);
4818
- });
4819
- }
4820
- return respJson.then(function (err) {
4821
- return _Promise.reject(makeIdxState$1(err, toPersist));
4822
- });
4823
- }).then(function (idxResponse) {
4824
- return makeIdxState$1(idxResponse, toPersist);
4825
- }));
4826
- case 4:
4934
+ });
4935
+ case 5:
4936
+ response = _context.sent;
4937
+ _context.next = 8;
4938
+ return response.json();
4939
+ case 8:
4940
+ responseJSON = _context.sent;
4941
+ requestDidSucceed = response.ok;
4942
+ idxResponse = makeIdxState$1(responseJSON, toPersist, requestDidSucceed);
4943
+ if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm="Okta Device"') {
4944
+ idxResponse.stepUp = true;
4945
+ }
4946
+ if (requestDidSucceed) {
4947
+ _context.next = 14;
4948
+ break;
4949
+ }
4950
+ throw idxResponse;
4951
+ case 14:
4952
+ return _context.abrupt("return", idxResponse);
4953
+ case 15:
4827
4954
  case "end":
4828
4955
  return _context.stop();
4829
4956
  }
@@ -4958,9 +5085,8 @@ var parseIdxResponse = function parseIdxResponse(idxResponse) {
4958
5085
  };
4959
5086
  };
4960
5087
 
4961
- function makeIdxState$1(idxResponse, toPersist) {
4962
- var _context2;
4963
- var _a;
5088
+ function makeIdxState$1(idxResponse, toPersist, requestDidSucceed) {
5089
+ var _a, _b, _c;
4964
5090
  var rawIdxResponse = idxResponse;
4965
5091
  var _parseIdxResponse = parseIdxResponse(idxResponse, toPersist),
4966
5092
  remediations = _parseIdxResponse.remediations,
@@ -5001,7 +5127,7 @@ function makeIdxState$1(idxResponse, toPersist) {
5001
5127
  var findCode = function findCode(item) {
5002
5128
  return item.name === 'interaction_code';
5003
5129
  };
5004
- var interactionCode = (_a = rawIdxResponse.successWithInteractionCode) === null || _a === void 0 ? void 0 : _findInstanceProperty(_context2 = _a.value).call(_context2, findCode).value;
5130
+ var interactionCode = (_c = (_b = (_a = rawIdxResponse.successWithInteractionCode) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _findInstanceProperty(_b).call(_b, findCode)) === null || _c === void 0 ? void 0 : _c.value;
5005
5131
  return {
5006
5132
  proceed: proceed,
5007
5133
  neededToProceed: neededToProceed,
@@ -5009,7 +5135,8 @@ function makeIdxState$1(idxResponse, toPersist) {
5009
5135
  context: context,
5010
5136
  rawIdxState: rawIdxResponse,
5011
5137
  interactionCode: interactionCode,
5012
- toPersist: toPersist
5138
+ toPersist: toPersist,
5139
+ requestDidSucceed: requestDidSucceed
5013
5140
  };
5014
5141
  }
5015
5142
 
@@ -5040,14 +5167,9 @@ function validateVersionConfig(version) {
5040
5167
  parsersForVersion(version);
5041
5168
  }
5042
5169
 
5043
- var parseAndReject$1 = function parseAndReject(response) {
5044
- return response.json().then(function (err) {
5045
- return _Promise.reject(err);
5046
- });
5047
- };
5048
5170
  var introspect$1 = function () {
5049
5171
  var _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
5050
- var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials;
5172
+ var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials, response, requestDidSucceed, rawIdxResponse;
5051
5173
  return _regeneratorRuntime.wrap(function _callee$(_context) {
5052
5174
  while (1) {
5053
5175
  switch (_context.prev = _context.next) {
@@ -5065,14 +5187,27 @@ var introspect$1 = function () {
5065
5187
  accept: "application/ion+json; okta-version=".concat(version)
5066
5188
  };
5067
5189
  credentials = withCredentials === false ? 'omit' : 'include';
5068
- return _context.abrupt("return", request(target, {
5190
+ _context.next = 8;
5191
+ return request(target, {
5069
5192
  credentials: credentials,
5070
5193
  headers: headers,
5071
5194
  body: _JSON$stringify(body)
5072
- }).then(function (response) {
5073
- return response.ok ? response.json() : parseAndReject$1(response);
5074
- }));
5075
- case 7:
5195
+ });
5196
+ case 8:
5197
+ response = _context.sent;
5198
+ requestDidSucceed = response.ok;
5199
+ _context.next = 12;
5200
+ return response.json();
5201
+ case 12:
5202
+ rawIdxResponse = _context.sent;
5203
+ if (requestDidSucceed) {
5204
+ _context.next = 15;
5205
+ break;
5206
+ }
5207
+ throw rawIdxResponse;
5208
+ case 15:
5209
+ return _context.abrupt("return", rawIdxResponse);
5210
+ case 16:
5076
5211
  case "end":
5077
5212
  return _context.stop();
5078
5213
  }
@@ -5151,131 +5286,9 @@ var interact$1 = function () {
5151
5286
  }();
5152
5287
 
5153
5288
  var LATEST_SUPPORTED_IDX_API_VERSION = '1.0.0';
5154
- var start = function () {
5155
- var _start = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
5156
- var withCredentials, clientId, domain, issuer, stateHandle, interactionHandle, version, redirectUri, state, scopes, codeChallenge, codeChallengeMethod, activationToken, recoveryToken, baseUrl, toPersist, interactParams, interaction_handle, _parsersForVersion, _makeIdxState, idxResponse, idxState;
5157
- return _regeneratorRuntime.wrap(function _callee$(_context) {
5158
- while (1) {
5159
- switch (_context.prev = _context.next) {
5160
- case 0:
5161
- withCredentials = _ref.withCredentials, clientId = _ref.clientId, domain = _ref.domain, issuer = _ref.issuer, stateHandle = _ref.stateHandle, interactionHandle = _ref.interactionHandle, version = _ref.version, redirectUri = _ref.redirectUri, state = _ref.state, scopes = _ref.scopes, codeChallenge = _ref.codeChallenge, codeChallengeMethod = _ref.codeChallengeMethod, activationToken = _ref.activationToken, recoveryToken = _ref.recoveryToken;
5162
- issuer = issuer === null || issuer === void 0 ? void 0 : issuer.replace(/\/+$/, '');
5163
- baseUrl = (issuer === null || issuer === void 0 ? void 0 : _indexOfInstanceProperty(issuer).call(issuer, '/oauth2')) > 0 ? issuer : issuer + '/oauth2';
5164
- toPersist = {
5165
- baseUrl: baseUrl,
5166
- clientId: clientId,
5167
- state: state,
5168
- withCredentials: withCredentials
5169
- };
5170
- if (!(!domain && !issuer)) {
5171
- _context.next = 6;
5172
- break;
5173
- }
5174
- return _context.abrupt("return", _Promise.reject({
5175
- error: 'issuer is required'
5176
- }));
5177
- case 6:
5178
- if (!(!stateHandle && !clientId)) {
5179
- _context.next = 8;
5180
- break;
5181
- }
5182
- return _context.abrupt("return", _Promise.reject({
5183
- error: 'clientId is required'
5184
- }));
5185
- case 8:
5186
- if (!(!stateHandle && !redirectUri)) {
5187
- _context.next = 10;
5188
- break;
5189
- }
5190
- return _context.abrupt("return", _Promise.reject({
5191
- error: 'redirectUri is required'
5192
- }));
5193
- case 10:
5194
- if (!(!stateHandle && !(codeChallenge && codeChallengeMethod))) {
5195
- _context.next = 12;
5196
- break;
5197
- }
5198
- return _context.abrupt("return", _Promise.reject({
5199
- error: 'PKCE params (codeChallenge, codeChallengeMethod) are required'
5200
- }));
5201
- case 12:
5202
- if (!domain) {
5203
- domain = new _URL(issuer).origin;
5204
- }
5205
- validateVersionConfig(version);
5206
- if (!(!stateHandle && !interactionHandle)) {
5207
- _context.next = 27;
5208
- break;
5209
- }
5210
- _context.prev = 15;
5211
- interactParams = {
5212
- withCredentials: withCredentials,
5213
- clientId: clientId,
5214
- baseUrl: baseUrl,
5215
- scopes: scopes,
5216
- redirectUri: redirectUri,
5217
- codeChallenge: codeChallenge,
5218
- codeChallengeMethod: codeChallengeMethod,
5219
- state: state,
5220
- activationToken: activationToken,
5221
- recoveryToken: recoveryToken
5222
- };
5223
- _context.next = 19;
5224
- return interact$1(interactParams);
5225
- case 19:
5226
- interaction_handle = _context.sent;
5227
- interactionHandle = interaction_handle;
5228
- toPersist.interactionHandle = interactionHandle;
5229
- _context.next = 27;
5230
- break;
5231
- case 24:
5232
- _context.prev = 24;
5233
- _context.t0 = _context["catch"](15);
5234
- return _context.abrupt("return", _Promise.reject({
5235
- error: _context.t0
5236
- }));
5237
- case 27:
5238
- _context.prev = 27;
5239
- _parsersForVersion = parsersForVersion(version), _makeIdxState = _parsersForVersion.makeIdxState;
5240
- _context.next = 31;
5241
- return introspect$1({
5242
- withCredentials: withCredentials,
5243
- domain: domain,
5244
- interactionHandle: interactionHandle,
5245
- stateHandle: stateHandle,
5246
- version: version
5247
- }).catch(function (err) {
5248
- return _Promise.reject({
5249
- error: 'introspect call failed',
5250
- details: _makeIdxState(err, toPersist)
5251
- });
5252
- });
5253
- case 31:
5254
- idxResponse = _context.sent;
5255
- idxState = _makeIdxState(idxResponse, toPersist);
5256
- return _context.abrupt("return", idxState);
5257
- case 36:
5258
- _context.prev = 36;
5259
- _context.t1 = _context["catch"](27);
5260
- return _context.abrupt("return", _Promise.reject({
5261
- error: _context.t1
5262
- }));
5263
- case 39:
5264
- case "end":
5265
- return _context.stop();
5266
- }
5267
- }
5268
- }, _callee, null, [[15, 24], [27, 36]]);
5269
- }));
5270
- function start(_x) {
5271
- return _start.apply(this, arguments);
5272
- }
5273
- return start;
5274
- }();
5275
- var _parsersForVersion2 = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION),
5276
- makeIdxState = _parsersForVersion2.makeIdxState;
5289
+ var _parsersForVersion = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION),
5290
+ makeIdxState = _parsersForVersion.makeIdxState;
5277
5291
  var idx = {
5278
- start: start,
5279
5292
  introspect: introspect$1,
5280
5293
  interact: interact$1,
5281
5294
  makeIdxState: makeIdxState,
@@ -5512,6 +5525,8 @@ function _introspect() {
5512
5525
  _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
5513
5526
  var options,
5514
5527
  rawIdxResponse,
5528
+ requestDidSucceed,
5529
+ savedIdxResponse,
5515
5530
  version,
5516
5531
  domain,
5517
5532
  withCredentials,
@@ -5521,47 +5536,53 @@ function _introspect() {
5521
5536
  switch (_context.prev = _context.next) {
5522
5537
  case 0:
5523
5538
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5524
- rawIdxResponse = authClient.transactionManager.loadIdxResponse();
5539
+ savedIdxResponse = authClient.transactionManager.loadIdxResponse();
5540
+ if (savedIdxResponse) {
5541
+ rawIdxResponse = savedIdxResponse.rawIdxResponse;
5542
+ requestDidSucceed = savedIdxResponse.requestDidSucceed;
5543
+ }
5525
5544
  if (rawIdxResponse) {
5526
- _context.next = 18;
5545
+ _context.next = 21;
5527
5546
  break;
5528
5547
  }
5529
5548
  version = options.version || IDX_API_VERSION;
5530
5549
  domain = getOAuthDomain(authClient);
5531
- _context.prev = 5;
5532
- _context.next = 8;
5550
+ _context.prev = 6;
5551
+ _context.next = 9;
5533
5552
  return idx.introspect(_Object$assign(_Object$assign({
5534
5553
  domain: domain
5535
5554
  }, options), {
5536
5555
  version: version
5537
5556
  }));
5538
- case 8:
5557
+ case 9:
5539
5558
  rawIdxResponse = _context.sent;
5540
- _context.next = 18;
5559
+ requestDidSucceed = true;
5560
+ _context.next = 21;
5541
5561
  break;
5542
- case 11:
5543
- _context.prev = 11;
5544
- _context.t0 = _context["catch"](5);
5562
+ case 13:
5563
+ _context.prev = 13;
5564
+ _context.t0 = _context["catch"](6);
5545
5565
  if (!isRawIdxResponse(_context.t0)) {
5546
- _context.next = 17;
5566
+ _context.next = 20;
5547
5567
  break;
5548
5568
  }
5549
5569
  rawIdxResponse = _context.t0;
5550
- _context.next = 18;
5570
+ requestDidSucceed = false;
5571
+ _context.next = 21;
5551
5572
  break;
5552
- case 17:
5573
+ case 20:
5553
5574
  throw _context.t0;
5554
- case 18:
5575
+ case 21:
5555
5576
  withCredentials = options.withCredentials;
5556
5577
  return _context.abrupt("return", idx.makeIdxState(rawIdxResponse, {
5557
5578
  withCredentials: withCredentials
5558
- }));
5559
- case 20:
5579
+ }, requestDidSucceed));
5580
+ case 23:
5560
5581
  case "end":
5561
5582
  return _context.stop();
5562
5583
  }
5563
5584
  }
5564
- }, _callee, null, [[5, 11]]);
5585
+ }, _callee, null, [[6, 13]]);
5565
5586
  }));
5566
5587
  return _introspect.apply(this, arguments);
5567
5588
  }
@@ -5592,42 +5613,91 @@ function getAuthenticatorFromRemediation(remediation) {
5592
5613
  });
5593
5614
  }
5594
5615
 
5616
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5617
+ function _unsupportedIterableToArray$4(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
5618
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5619
+ function formatAuthenticator(incoming) {
5620
+ var authenticator;
5621
+ if (isAuthenticator(incoming)) {
5622
+ authenticator = incoming;
5623
+ } else if (typeof incoming === 'string') {
5624
+ authenticator = {
5625
+ key: incoming
5626
+ };
5627
+ } else {
5628
+ throw new Error('Invalid format for authenticator');
5629
+ }
5630
+ return authenticator;
5631
+ }
5632
+ function compareAuthenticators(auth1, auth2) {
5633
+ if (!auth1 || !auth2) {
5634
+ return false;
5635
+ }
5636
+ if (auth1.id && auth2.id) {
5637
+ return auth1.id === auth2.id;
5638
+ }
5639
+ if (auth1.key && auth2.key) {
5640
+ return auth1.key === auth2.key;
5641
+ }
5642
+ return false;
5643
+ }
5644
+ function findMatchedOption(authenticators, options) {
5645
+ var option;
5646
+ var _iterator = _createForOfIteratorHelper$4(authenticators),
5647
+ _step;
5648
+ try {
5649
+ var _loop = function _loop() {
5650
+ var authenticator = _step.value;
5651
+ option = _findInstanceProperty(options).call(options, function (_ref) {
5652
+ var relatesTo = _ref.relatesTo;
5653
+ return relatesTo.key === authenticator.key;
5654
+ });
5655
+ if (option) {
5656
+ return "break";
5657
+ }
5658
+ };
5659
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5660
+ var _ret = _loop();
5661
+ if (_ret === "break") break;
5662
+ }
5663
+ } catch (err) {
5664
+ _iterator.e(err);
5665
+ } finally {
5666
+ _iterator.f();
5667
+ }
5668
+ return option;
5669
+ }
5670
+
5595
5671
  function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5596
- function _unsupportedIterableToArray$3(o, minLen) { var _context12; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = _sliceInstanceProperty(_context12 = Object.prototype.toString.call(o)).call(_context12, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
5672
+ function _unsupportedIterableToArray$3(o, minLen) { var _context10; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = _sliceInstanceProperty(_context10 = Object.prototype.toString.call(o)).call(_context10, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
5597
5673
  function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5598
5674
  var Remediator = function () {
5599
5675
  function Remediator(remediation) {
5600
5676
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5677
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5601
5678
  _classCallCheck(this, Remediator);
5602
5679
  this.values = _Object$assign({}, values);
5680
+ this.options = _Object$assign({}, options);
5603
5681
  this.formatAuthenticators();
5604
5682
  this.remediation = remediation;
5605
5683
  }
5606
5684
  _createClass(Remediator, [{
5607
5685
  key: "formatAuthenticators",
5608
5686
  value: function formatAuthenticators() {
5609
- var _this = this,
5610
- _context2,
5611
- _context3;
5687
+ var _context2, _context3;
5612
5688
  _valuesInstanceProperty(this).authenticators = _valuesInstanceProperty(this).authenticators || [];
5689
+ _valuesInstanceProperty(this).authenticators = _mapInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticators).call(_context2, function (authenticator) {
5690
+ return formatAuthenticator(authenticator);
5691
+ });
5613
5692
  if (_valuesInstanceProperty(this).authenticator) {
5614
- var hasAuthenticatorInList = _valuesInstanceProperty(this).authenticators.some(function (authenticator) {
5615
- if (typeof authenticator === 'string') {
5616
- return authenticator === _valuesInstanceProperty(_this).authenticator;
5617
- }
5618
- return authenticator.key === _valuesInstanceProperty(_this).authenticator;
5693
+ var authenticator = formatAuthenticator(_valuesInstanceProperty(this).authenticator);
5694
+ var hasAuthenticatorInList = _valuesInstanceProperty(this).authenticators.some(function (existing) {
5695
+ return compareAuthenticators(authenticator, existing);
5619
5696
  });
5620
5697
  if (!hasAuthenticatorInList) {
5621
- _valuesInstanceProperty(this).authenticators.push({
5622
- key: _valuesInstanceProperty(this).authenticator
5623
- });
5698
+ _valuesInstanceProperty(this).authenticators.push(authenticator);
5624
5699
  }
5625
5700
  }
5626
- _valuesInstanceProperty(this).authenticators = _mapInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticators).call(_context2, function (authenticator) {
5627
- return typeof authenticator === 'string' ? {
5628
- key: authenticator
5629
- } : authenticator;
5630
- });
5631
5701
  _valuesInstanceProperty(this).authenticatorsData = _reduceInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (acc, authenticator) {
5632
5702
  if (_typeof(authenticator) === 'object' && _Object$keys(authenticator).length > 1) {
5633
5703
  acc.push(authenticator);
@@ -5643,13 +5713,10 @@ var Remediator = function () {
5643
5713
  }, {
5644
5714
  key: "canRemediate",
5645
5715
  value: function canRemediate() {
5646
- var _this2 = this;
5647
- if (!_mapInstanceProperty(this)) {
5648
- return false;
5649
- }
5716
+ var _this = this;
5650
5717
  var required = getRequiredValues(this.remediation);
5651
5718
  var needed = _findInstanceProperty(required).call(required, function (key) {
5652
- return !_this2.hasData(key);
5719
+ return !_this.hasData(key);
5653
5720
  });
5654
5721
  if (needed) {
5655
5722
  return false;
@@ -5659,48 +5726,41 @@ var Remediator = function () {
5659
5726
  }, {
5660
5727
  key: "getData",
5661
5728
  value: function getData(key) {
5662
- var _this3 = this;
5729
+ var _this2 = this;
5663
5730
  if (!key) {
5664
5731
  var allValues = getAllValues(this.remediation);
5665
5732
  var res = _reduceInstanceProperty(allValues).call(allValues, function (data, key) {
5666
- data[key] = _this3.getData(key);
5733
+ data[key] = _this2.getData(key);
5667
5734
  return data;
5668
5735
  }, {});
5669
5736
  return res;
5670
5737
  }
5671
5738
  if (typeof this["map".concat(titleCase(key))] === 'function') {
5672
5739
  var _context4;
5673
- return this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5740
+ var val = this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5674
5741
  var name = _ref.name;
5675
5742
  return name === key;
5676
5743
  }));
5677
- }
5678
- if (!_mapInstanceProperty(this)) {
5679
- return _valuesInstanceProperty(this)[key];
5680
- }
5681
- var entry = _mapInstanceProperty(this)[key];
5682
- if (!entry) {
5683
- return _valuesInstanceProperty(this)[key];
5684
- }
5685
- for (var i = 0; i < entry.length; i++) {
5686
- var val = _valuesInstanceProperty(this)[entry[i]];
5687
5744
  if (val) {
5688
5745
  return val;
5689
5746
  }
5690
5747
  }
5748
+ if (_mapInstanceProperty(this) && _mapInstanceProperty(this)[key]) {
5749
+ var entry = _mapInstanceProperty(this)[key];
5750
+ for (var i = 0; i < entry.length; i++) {
5751
+ var _val = _valuesInstanceProperty(this)[entry[i]];
5752
+ if (_val) {
5753
+ return _val;
5754
+ }
5755
+ }
5756
+ }
5757
+ return _valuesInstanceProperty(this)[key];
5691
5758
  }
5692
5759
  }, {
5693
5760
  key: "hasData",
5694
5761
  value: function hasData(key
5695
5762
  ) {
5696
- var data = this.getData(key);
5697
- if (_typeof(data) === 'object') {
5698
- var _context5;
5699
- return !!_findInstanceProperty(_context5 = _Object$keys(data)).call(_context5, function (key) {
5700
- return !!data[key];
5701
- });
5702
- }
5703
- return !!data;
5763
+ return !!this.getData(key);
5704
5764
  }
5705
5765
  }, {
5706
5766
  key: "getNextStep",
@@ -5721,43 +5781,38 @@ var Remediator = function () {
5721
5781
  }, {
5722
5782
  key: "getInputs",
5723
5783
  value: function getInputs() {
5724
- var _context6,
5725
- _this4 = this;
5726
- if (!_mapInstanceProperty(this)) {
5727
- return [];
5728
- }
5729
- return _reduceInstanceProperty(_context6 = _Object$keys(_mapInstanceProperty(this))).call(_context6, function (inputs, key) {
5730
- var _context7;
5731
- var inputFromRemediation = _findInstanceProperty(_context7 = _this4.remediation.value).call(_context7, function (item) {
5732
- return item.name === key;
5733
- });
5734
- if (!inputFromRemediation) {
5735
- return inputs;
5736
- }
5784
+ var _this3 = this;
5785
+ var inputs = [];
5786
+ var inputsFromRemediation = this.remediation.value || [];
5787
+ inputsFromRemediation.forEach(function (inputFromRemediation) {
5737
5788
  var input;
5738
- var aliases = _mapInstanceProperty(_this4)[key];
5739
- var type = inputFromRemediation.type;
5740
- if (typeof _this4["getInput".concat(titleCase(key))] === 'function') {
5741
- input = _this4["getInput".concat(titleCase(key))](inputFromRemediation);
5789
+ var name = inputFromRemediation.name,
5790
+ type = inputFromRemediation.type,
5791
+ visible = inputFromRemediation.visible;
5792
+ if (visible === false) {
5793
+ return;
5794
+ }
5795
+ if (typeof _this3["getInput".concat(titleCase(name))] === 'function') {
5796
+ input = _this3["getInput".concat(titleCase(name))](inputFromRemediation);
5742
5797
  } else if (type !== 'object') {
5743
- var name;
5798
+ var alias;
5799
+ var aliases = (_mapInstanceProperty(_this3) ? _mapInstanceProperty(_this3)[name] : null) || [];
5744
5800
  if (aliases.length === 1) {
5745
- name = aliases[0];
5801
+ alias = aliases[0];
5746
5802
  } else {
5747
- name = _findInstanceProperty(aliases).call(aliases, function (name) {
5748
- var _context8;
5749
- return _includesInstanceProperty(_context8 = _Object$keys(_valuesInstanceProperty(_this4))).call(_context8, name);
5803
+ alias = _findInstanceProperty(aliases).call(aliases, function (name) {
5804
+ var _context5;
5805
+ return _includesInstanceProperty(_context5 = _Object$keys(_valuesInstanceProperty(_this3))).call(_context5, name);
5750
5806
  });
5751
5807
  }
5752
- if (name) {
5808
+ if (alias) {
5753
5809
  input = _Object$assign(_Object$assign({}, inputFromRemediation), {
5754
- name: name
5810
+ name: alias
5755
5811
  });
5756
5812
  }
5757
5813
  }
5758
5814
  if (!input) {
5759
- var _context9;
5760
- throw new AuthSdkError(_concatInstanceProperty(_context9 = "Missing custom getInput".concat(titleCase(key), " method in Remediator: ")).call(_context9, _this4.getName()));
5815
+ input = inputFromRemediation;
5761
5816
  }
5762
5817
  if (Array.isArray(input)) {
5763
5818
  input.forEach(function (i) {
@@ -5766,8 +5821,8 @@ var Remediator = function () {
5766
5821
  } else {
5767
5822
  inputs.push(input);
5768
5823
  }
5769
- return inputs;
5770
- }, []);
5824
+ });
5825
+ return inputs;
5771
5826
  }
5772
5827
  }, {
5773
5828
  key: "getValuesAfterProceed",
@@ -5791,21 +5846,41 @@ var Remediator = function () {
5791
5846
  }, {
5792
5847
  key: "getAuthenticator",
5793
5848
  value: function getAuthenticator() {
5794
- var _a;
5795
- return (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5849
+ var _context6, _context7;
5850
+ var _a, _b;
5851
+ var relatesTo = (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5852
+ if (!relatesTo) {
5853
+ return;
5854
+ }
5855
+ var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
5856
+ if (!authenticatorFromRemediation) {
5857
+ return relatesTo;
5858
+ }
5859
+ var id = _findInstanceProperty(_context6 = authenticatorFromRemediation.form.value).call(_context6, function (_ref2) {
5860
+ var name = _ref2.name;
5861
+ return name === 'id';
5862
+ }).value;
5863
+ var enrollmentId = (_b = _findInstanceProperty(_context7 = authenticatorFromRemediation.form.value).call(_context7, function (_ref3) {
5864
+ var name = _ref3.name;
5865
+ return name === 'enrollmentId';
5866
+ })) === null || _b === void 0 ? void 0 : _b.value;
5867
+ return _Object$assign(_Object$assign({}, relatesTo), {
5868
+ id: id,
5869
+ enrollmentId: enrollmentId
5870
+ });
5796
5871
  }
5797
5872
  }], [{
5798
5873
  key: "getMessages",
5799
5874
  value: function getMessages(remediation) {
5800
- var _context10;
5875
+ var _context8;
5801
5876
  var _a, _b;
5802
5877
  if (!remediation.value) {
5803
5878
  return;
5804
5879
  }
5805
- return (_b = (_a = remediation.value[0]) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _reduceInstanceProperty(_context10 = _b.value).call(_context10, function (messages, field) {
5880
+ return (_b = (_a = remediation.value[0]) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _reduceInstanceProperty(_context8 = _b.value).call(_context8, function (messages, field) {
5806
5881
  if (field.messages) {
5807
- var _context11;
5808
- messages = _concatInstanceProperty(_context11 = []).call(_context11, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5882
+ var _context9;
5883
+ messages = _concatInstanceProperty(_context9 = []).call(_context9, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5809
5884
  }
5810
5885
  return messages;
5811
5886
  }, []);
@@ -5831,13 +5906,19 @@ var VerificationCodeAuthenticator = function (_Authenticator) {
5831
5906
  _createClass(VerificationCodeAuthenticator, [{
5832
5907
  key: "canVerify",
5833
5908
  value: function canVerify(values) {
5834
- return !!(values.verificationCode || values.otp);
5909
+ return !!(values.credentials || values.verificationCode || values.otp);
5835
5910
  }
5836
5911
  }, {
5837
5912
  key: "mapCredentials",
5838
5913
  value: function mapCredentials(values) {
5839
- return {
5840
- passcode: values.verificationCode || values.otp
5914
+ var credentials = values.credentials,
5915
+ verificationCode = values.verificationCode,
5916
+ otp = values.otp;
5917
+ if (!credentials && !verificationCode && !otp) {
5918
+ return;
5919
+ }
5920
+ return credentials || {
5921
+ passcode: verificationCode || otp
5841
5922
  };
5842
5923
  }
5843
5924
  }, {
@@ -5866,8 +5947,12 @@ var OktaVerifyTotp = function (_VerificationCodeAuth) {
5866
5947
  _createClass(OktaVerifyTotp, [{
5867
5948
  key: "mapCredentials",
5868
5949
  value: function mapCredentials(values) {
5950
+ var verificationCode = values.verificationCode;
5951
+ if (!verificationCode) {
5952
+ return;
5953
+ }
5869
5954
  return {
5870
- totp: values.verificationCode
5955
+ totp: verificationCode
5871
5956
  };
5872
5957
  }
5873
5958
  }]);
@@ -5886,14 +5971,19 @@ var OktaPassword = function (_Authenticator) {
5886
5971
  _createClass(OktaPassword, [{
5887
5972
  key: "canVerify",
5888
5973
  value: function canVerify(values) {
5889
- return !!values.password;
5974
+ return !!(values.credentials || values.password);
5890
5975
  }
5891
5976
  }, {
5892
5977
  key: "mapCredentials",
5893
5978
  value: function mapCredentials(values) {
5894
- return {
5895
- passcode: values.password
5896
- };
5979
+ var credentials = values.credentials,
5980
+ password = values.password;
5981
+ if (!credentials && !password) {
5982
+ return;
5983
+ }
5984
+ return credentials || {
5985
+ passcode: password
5986
+ };
5897
5987
  }
5898
5988
  }, {
5899
5989
  key: "getInputs",
@@ -5921,6 +6011,10 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
5921
6011
  _createClass(SecurityQuestionEnrollment, [{
5922
6012
  key: "canVerify",
5923
6013
  value: function canVerify(values) {
6014
+ var credentials = values.credentials;
6015
+ if (credentials && credentials.questionKey && credentials.answer) {
6016
+ return true;
6017
+ }
5924
6018
  var questionKey = values.questionKey,
5925
6019
  question = values.question,
5926
6020
  answer = values.answer;
@@ -5932,6 +6026,9 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
5932
6026
  var questionKey = values.questionKey,
5933
6027
  question = values.question,
5934
6028
  answer = values.answer;
6029
+ if (!questionKey && !question && !answer) {
6030
+ return;
6031
+ }
5935
6032
  return {
5936
6033
  questionKey: question ? 'custom' : questionKey,
5937
6034
  question: question,
@@ -5944,7 +6041,7 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
5944
6041
  return [{
5945
6042
  name: 'questionKey',
5946
6043
  type: 'string',
5947
- require: true
6044
+ required: true
5948
6045
  }, {
5949
6046
  name: 'question',
5950
6047
  type: 'string',
@@ -5977,9 +6074,13 @@ var SecurityQuestionVerification = function (_Authenticator) {
5977
6074
  }, {
5978
6075
  key: "mapCredentials",
5979
6076
  value: function mapCredentials(values) {
6077
+ var answer = values.answer;
6078
+ if (!answer) {
6079
+ return;
6080
+ }
5980
6081
  return {
5981
6082
  questionKey: this.meta.contextualData.enrolledQuestion.questionKey,
5982
- answer: values.answer
6083
+ answer: answer
5983
6084
  };
5984
6085
  }
5985
6086
  }, {
@@ -6017,6 +6118,9 @@ var WebauthnEnrollment = function (_Authenticator) {
6017
6118
  value: function mapCredentials(values) {
6018
6119
  var clientData = values.clientData,
6019
6120
  attestation = values.attestation;
6121
+ if (!clientData && !attestation) {
6122
+ return;
6123
+ }
6020
6124
  return {
6021
6125
  clientData: clientData,
6022
6126
  attestation: attestation
@@ -6066,6 +6170,9 @@ var WebauthnVerification = function (_Authenticator) {
6066
6170
  var authenticatorData = values.authenticatorData,
6067
6171
  clientData = values.clientData,
6068
6172
  signatureData = values.signatureData;
6173
+ if (!authenticatorData && !clientData && !signatureData) {
6174
+ return;
6175
+ }
6069
6176
  return {
6070
6177
  authenticatorData: authenticatorData,
6071
6178
  clientData: clientData,
@@ -6135,9 +6242,6 @@ var VerifyAuthenticator = function (_Remediator) {
6135
6242
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6136
6243
  _classCallCheck(this, VerifyAuthenticator);
6137
6244
  _this = _super.call(this, remediation, values);
6138
- _this.map = {
6139
- 'credentials': []
6140
- };
6141
6245
  _this.authenticator = getAuthenticator(remediation);
6142
6246
  return _this;
6143
6247
  }
@@ -6166,6 +6270,19 @@ var VerifyAuthenticator = function (_Remediator) {
6166
6270
  value: function getInputCredentials(input) {
6167
6271
  return this.authenticator.getInputs(input);
6168
6272
  }
6273
+ }, {
6274
+ key: "getValuesAfterProceed",
6275
+ value: function getValuesAfterProceed() {
6276
+ var _context,
6277
+ _this2 = this;
6278
+ this.values = _get(_getPrototypeOf(VerifyAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6279
+ var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6280
+ return valueKey !== 'credentials';
6281
+ });
6282
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6283
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6284
+ }, {});
6285
+ }
6169
6286
  }]);
6170
6287
  return VerifyAuthenticator;
6171
6288
  }(Remediator);
@@ -6195,7 +6312,7 @@ var EnrollPoll = function (_Remediator) {
6195
6312
  _createClass(EnrollPoll, [{
6196
6313
  key: "canRemediate",
6197
6314
  value: function canRemediate() {
6198
- return Boolean(_valuesInstanceProperty(this).startPolling);
6315
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'enroll-poll';
6199
6316
  }
6200
6317
  }, {
6201
6318
  key: "getNextStep",
@@ -6303,14 +6420,8 @@ var EnrollmentChannelData = function (_Remediator) {
6303
6420
  _inherits(EnrollmentChannelData, _Remediator);
6304
6421
  var _super = _createSuper$h(EnrollmentChannelData);
6305
6422
  function EnrollmentChannelData() {
6306
- var _this;
6307
6423
  _classCallCheck(this, EnrollmentChannelData);
6308
- _this = _super.apply(this, arguments);
6309
- _this.map = {
6310
- email: [],
6311
- phoneNumber: []
6312
- };
6313
- return _this;
6424
+ return _super.apply(this, arguments);
6314
6425
  }
6315
6426
  _createClass(EnrollmentChannelData, [{
6316
6427
  key: "getInputEmail",
@@ -6359,13 +6470,13 @@ var EnrollmentChannelData = function (_Remediator) {
6359
6470
  key: "getValuesAfterProceed",
6360
6471
  value: function getValuesAfterProceed() {
6361
6472
  var _context,
6362
- _this2 = this;
6473
+ _this = this;
6363
6474
  var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6364
6475
  var _context2;
6365
6476
  return !_includesInstanceProperty(_context2 = ['email', 'phoneNumber']).call(_context2, valueKey);
6366
6477
  });
6367
6478
  return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6368
- return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6479
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this)[valueKey]));
6369
6480
  }, {});
6370
6481
  }
6371
6482
  }]);
@@ -6395,6 +6506,12 @@ var ChallengePoll = function (_EnrollPoll) {
6395
6506
  _classCallCheck(this, ChallengePoll);
6396
6507
  return _super.apply(this, arguments);
6397
6508
  }
6509
+ _createClass(ChallengePoll, [{
6510
+ key: "canRemediate",
6511
+ value: function canRemediate() {
6512
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'challenge-poll';
6513
+ }
6514
+ }]);
6398
6515
  return ChallengePoll;
6399
6516
  }(EnrollPoll);
6400
6517
  ChallengePoll.remediationName = 'challenge-poll';
@@ -6418,19 +6535,17 @@ var EnrollProfile = function (_Remediator) {
6418
6535
  _inherits(EnrollProfile, _Remediator);
6419
6536
  var _super = _createSuper$d(EnrollProfile);
6420
6537
  function EnrollProfile() {
6421
- var _this;
6422
6538
  _classCallCheck(this, EnrollProfile);
6423
- _this = _super.apply(this, arguments);
6424
- _this.map = {
6425
- 'userProfile': []
6426
- };
6427
- return _this;
6539
+ return _super.apply(this, arguments);
6428
6540
  }
6429
6541
  _createClass(EnrollProfile, [{
6430
6542
  key: "canRemediate",
6431
6543
  value: function canRemediate() {
6432
6544
  var _context, _context2;
6433
6545
  var userProfileFromValues = this.getData().userProfile;
6546
+ if (!userProfileFromValues) {
6547
+ return false;
6548
+ }
6434
6549
  var userProfileFromRemediation = _findInstanceProperty(_context = this.remediation.value).call(_context, function (_ref) {
6435
6550
  var name = _ref.name;
6436
6551
  return name === 'userProfile';
@@ -6445,15 +6560,19 @@ var EnrollProfile = function (_Remediator) {
6445
6560
  }, {
6446
6561
  key: "mapUserProfile",
6447
6562
  value: function mapUserProfile(_ref2) {
6448
- var _this2 = this;
6563
+ var _this = this;
6449
6564
  var profileAttributes = _ref2.form.value;
6450
6565
  var attributeNames = _mapInstanceProperty(profileAttributes).call(profileAttributes, function (_ref3) {
6451
6566
  var name = _ref3.name;
6452
6567
  return name;
6453
6568
  });
6454
- return _reduceInstanceProperty(attributeNames).call(attributeNames, function (attributeValues, attributeName) {
6455
- return _valuesInstanceProperty(_this2)[attributeName] ? _Object$assign(_Object$assign({}, attributeValues), _defineProperty({}, attributeName, _valuesInstanceProperty(_this2)[attributeName])) : attributeValues;
6569
+ var data = _reduceInstanceProperty(attributeNames).call(attributeNames, function (attributeValues, attributeName) {
6570
+ return _valuesInstanceProperty(_this)[attributeName] ? _Object$assign(_Object$assign({}, attributeValues), _defineProperty({}, attributeName, _valuesInstanceProperty(_this)[attributeName])) : attributeValues;
6456
6571
  }, {});
6572
+ if (_Object$keys(data).length === 0) {
6573
+ return;
6574
+ }
6575
+ return data;
6457
6576
  }
6458
6577
  }, {
6459
6578
  key: "getInputUserProfile",
@@ -6486,9 +6605,7 @@ var Identify = function (_Remediator) {
6486
6605
  _classCallCheck(this, Identify);
6487
6606
  _this = _super.apply(this, arguments);
6488
6607
  _this.map = {
6489
- 'identifier': ['username'],
6490
- 'credentials': [],
6491
- 'rememberMe': ['rememberMe']
6608
+ 'identifier': ['username']
6492
6609
  };
6493
6610
  return _this;
6494
6611
  }
@@ -6502,8 +6619,14 @@ var Identify = function (_Remediator) {
6502
6619
  }, {
6503
6620
  key: "mapCredentials",
6504
6621
  value: function mapCredentials() {
6505
- return {
6506
- passcode: _valuesInstanceProperty(this).password
6622
+ var _this$values = _valuesInstanceProperty(this),
6623
+ credentials = _this$values.credentials,
6624
+ password = _this$values.password;
6625
+ if (!credentials && !password) {
6626
+ return;
6627
+ }
6628
+ return credentials || {
6629
+ passcode: password
6507
6630
  };
6508
6631
  }
6509
6632
  }, {
@@ -6525,19 +6648,18 @@ var ReEnrollAuthenticator = function (_Remediator) {
6525
6648
  _inherits(ReEnrollAuthenticator, _Remediator);
6526
6649
  var _super = _createSuper$b(ReEnrollAuthenticator);
6527
6650
  function ReEnrollAuthenticator() {
6528
- var _this;
6529
6651
  _classCallCheck(this, ReEnrollAuthenticator);
6530
- _this = _super.apply(this, arguments);
6531
- _this.map = {
6532
- 'credentials': []
6533
- };
6534
- return _this;
6652
+ return _super.apply(this, arguments);
6535
6653
  }
6536
6654
  _createClass(ReEnrollAuthenticator, [{
6537
6655
  key: "mapCredentials",
6538
6656
  value: function mapCredentials() {
6657
+ var newPassword = _valuesInstanceProperty(this).newPassword;
6658
+ if (!newPassword) {
6659
+ return;
6660
+ }
6539
6661
  return {
6540
- passcode: _valuesInstanceProperty(this).newPassword
6662
+ passcode: newPassword
6541
6663
  };
6542
6664
  }
6543
6665
  }, {
@@ -6597,17 +6719,13 @@ var SelectAuthenticator = function (_Remediator) {
6597
6719
  _inherits(SelectAuthenticator, _Remediator);
6598
6720
  var _super = _createSuper$9(SelectAuthenticator);
6599
6721
  function SelectAuthenticator() {
6600
- var _this;
6601
6722
  _classCallCheck(this, SelectAuthenticator);
6602
- _this = _super.apply(this, arguments);
6603
- _this.map = {
6604
- authenticator: []
6605
- };
6606
- return _this;
6723
+ return _super.apply(this, arguments);
6607
6724
  }
6608
6725
  _createClass(SelectAuthenticator, [{
6609
6726
  key: "findMatchedOption",
6610
- value: function findMatchedOption(authenticators, options) {
6727
+ value:
6728
+ function findMatchedOption(authenticators, options) {
6611
6729
  var option;
6612
6730
  var _iterator = _createForOfIteratorHelper$2(authenticators),
6613
6731
  _step;
@@ -6636,12 +6754,17 @@ var SelectAuthenticator = function (_Remediator) {
6636
6754
  }, {
6637
6755
  key: "canRemediate",
6638
6756
  value: function canRemediate() {
6639
- var authenticators = _valuesInstanceProperty(this).authenticators;
6757
+ var _this$values = _valuesInstanceProperty(this),
6758
+ authenticators = _this$values.authenticators,
6759
+ authenticator = _this$values.authenticator;
6640
6760
  var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
6641
6761
  var options = authenticatorFromRemediation.options;
6642
6762
  if (!authenticators || !authenticators.length) {
6643
6763
  return false;
6644
6764
  }
6765
+ if (isAuthenticator(authenticator) && authenticator.id) {
6766
+ return true;
6767
+ }
6645
6768
  var matchedOption = this.findMatchedOption(authenticators, options);
6646
6769
  if (matchedOption) {
6647
6770
  return true;
@@ -6671,9 +6794,15 @@ var SelectAuthenticator = function (_Remediator) {
6671
6794
  key: "mapAuthenticator",
6672
6795
  value: function mapAuthenticator(remediationValue) {
6673
6796
  var _context2;
6674
- var authenticators = _valuesInstanceProperty(this).authenticators;
6797
+ var _this$values2 = _valuesInstanceProperty(this),
6798
+ authenticators = _this$values2.authenticators,
6799
+ authenticator = _this$values2.authenticator;
6800
+ if (isAuthenticator(authenticator) && authenticator.id) {
6801
+ this.selectedAuthenticator = authenticator;
6802
+ return authenticator;
6803
+ }
6675
6804
  var options = remediationValue.options;
6676
- var selectedOption = this.findMatchedOption(authenticators, options);
6805
+ var selectedOption = findMatchedOption(authenticators, options);
6677
6806
  this.selectedAuthenticator = selectedOption.relatesTo;
6678
6807
  this.selectedOption = selectedOption;
6679
6808
  return {
@@ -6695,10 +6824,10 @@ var SelectAuthenticator = function (_Remediator) {
6695
6824
  key: "getValuesAfterProceed",
6696
6825
  value: function getValuesAfterProceed() {
6697
6826
  var _context3,
6698
- _this2 = this;
6827
+ _this = this;
6699
6828
  this.values = _get(_getPrototypeOf(SelectAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6700
6829
  var authenticators = _filterInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (authenticator) {
6701
- return authenticator.key !== _this2.selectedAuthenticator.key;
6830
+ return compareAuthenticators(authenticator, _this.selectedAuthenticator) !== true;
6702
6831
  });
6703
6832
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
6704
6833
  authenticators: authenticators
@@ -6716,14 +6845,16 @@ var SelectAuthenticatorAuthenticate = function (_SelectAuthenticator) {
6716
6845
  function SelectAuthenticatorAuthenticate(remediation) {
6717
6846
  var _this;
6718
6847
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6848
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6719
6849
  _classCallCheck(this, SelectAuthenticatorAuthenticate);
6720
6850
  var _a;
6721
- _this = _super.call(this, remediation, values);
6851
+ _this = _super.call(this, remediation, values, options);
6852
+ var isRecoveryFlow = _this.options.flow === 'recoverPassword';
6722
6853
  var hasPasswordInOptions = (_a = getAuthenticatorFromRemediation(remediation).options) === null || _a === void 0 ? void 0 : _a.some(function (_ref) {
6723
6854
  var relatesTo = _ref.relatesTo;
6724
6855
  return (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.key) === AuthenticatorKey.OKTA_PASSWORD;
6725
6856
  });
6726
- if (hasPasswordInOptions && (_valuesInstanceProperty(_this).flow === 'recoverPassword' || _valuesInstanceProperty(_this).password)) {
6857
+ if (hasPasswordInOptions && (isRecoveryFlow || _valuesInstanceProperty(_this).password)) {
6727
6858
  var _context;
6728
6859
  _valuesInstanceProperty(_this).authenticators = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_valuesInstanceProperty(_this).authenticators || []), [{
6729
6860
  key: AuthenticatorKey.OKTA_PASSWORD
@@ -6758,7 +6889,6 @@ var SelectAuthenticatorUnlockAccount = function (_SelectAuthenticator) {
6758
6889
  _classCallCheck(this, SelectAuthenticatorUnlockAccount);
6759
6890
  _this = _super.apply(this, arguments);
6760
6891
  _this.map = {
6761
- authenticator: [],
6762
6892
  identifier: ['username']
6763
6893
  };
6764
6894
  return _this;
@@ -6829,9 +6959,6 @@ var AuthenticatorData = function (_Remediator) {
6829
6959
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6830
6960
  _classCallCheck(this, AuthenticatorData);
6831
6961
  _this = _super.call(this, remediation, values);
6832
- _this.map = {
6833
- 'authenticator': []
6834
- };
6835
6962
  _this.authenticator = _this.getAuthenticator();
6836
6963
  _this.formatAuthenticatorData();
6837
6964
  return _this;
@@ -6844,7 +6971,7 @@ var AuthenticatorData = function (_Remediator) {
6844
6971
  if (authenticatorData) {
6845
6972
  var _context;
6846
6973
  _valuesInstanceProperty(this).authenticatorsData = _mapInstanceProperty(_context = _valuesInstanceProperty(this).authenticatorsData).call(_context, function (data) {
6847
- if (data.key === _this2.authenticator.key) {
6974
+ if (compareAuthenticators(_this2.authenticator, data)) {
6848
6975
  return _this2.mapAuthenticatorDataFromValues(data);
6849
6976
  }
6850
6977
  return data;
@@ -6861,9 +6988,8 @@ var AuthenticatorData = function (_Remediator) {
6861
6988
  value: function getAuthenticatorData() {
6862
6989
  var _context2,
6863
6990
  _this3 = this;
6864
- return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (_ref) {
6865
- var key = _ref.key;
6866
- return key === _this3.authenticator.key;
6991
+ return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (data) {
6992
+ return compareAuthenticators(_this3.authenticator, data);
6867
6993
  });
6868
6994
  }
6869
6995
  }, {
@@ -6871,7 +6997,7 @@ var AuthenticatorData = function (_Remediator) {
6871
6997
  value: function canRemediate() {
6872
6998
  var _this4 = this;
6873
6999
  return _valuesInstanceProperty(this).authenticatorsData.some(function (data) {
6874
- return data.key === _this4.authenticator.key;
7000
+ return compareAuthenticators(_this4.authenticator, data);
6875
7001
  });
6876
7002
  }
6877
7003
  }, {
@@ -6886,9 +7012,18 @@ var AuthenticatorData = function (_Remediator) {
6886
7012
  }, {
6887
7013
  key: "mapAuthenticatorDataFromValues",
6888
7014
  value: function mapAuthenticatorDataFromValues(authenticatorData) {
6889
- var methodType = _valuesInstanceProperty(this).methodType;
7015
+ var _this$values = _valuesInstanceProperty(this),
7016
+ methodType = _this$values.methodType,
7017
+ authenticator = _this$values.authenticator;
7018
+ if (!methodType && isAuthenticator(authenticator)) {
7019
+ methodType = authenticator === null || authenticator === void 0 ? void 0 : authenticator.methodType;
7020
+ }
7021
+ var _this$authenticator = this.authenticator,
7022
+ id = _this$authenticator.id,
7023
+ enrollmentId = _this$authenticator.enrollmentId;
6890
7024
  var data = _Object$assign(_Object$assign({
6891
- key: this.authenticator.key
7025
+ id: id,
7026
+ enrollmentId: enrollmentId
6892
7027
  }, authenticatorData && authenticatorData), methodType && {
6893
7028
  methodType: methodType
6894
7029
  });
@@ -6898,8 +7033,8 @@ var AuthenticatorData = function (_Remediator) {
6898
7033
  key: "getAuthenticatorFromRemediation",
6899
7034
  value: function getAuthenticatorFromRemediation() {
6900
7035
  var _context3;
6901
- var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref2) {
6902
- var name = _ref2.name;
7036
+ var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref) {
7037
+ var name = _ref.name;
6903
7038
  return name === 'authenticator';
6904
7039
  });
6905
7040
  return authenticator;
@@ -6910,8 +7045,8 @@ var AuthenticatorData = function (_Remediator) {
6910
7045
  var _context4;
6911
7046
  var _a;
6912
7047
  var authenticator = this.getAuthenticatorFromRemediation();
6913
- return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
6914
- var name = _ref3.name;
7048
+ return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref2) {
7049
+ var name = _ref2.name;
6915
7050
  return name === 'methodType';
6916
7051
  })) === null || _a === void 0 ? void 0 : _a.options;
6917
7052
  }
@@ -6922,7 +7057,7 @@ var AuthenticatorData = function (_Remediator) {
6922
7057
  _this5 = this;
6923
7058
  this.values = _get(_getPrototypeOf(AuthenticatorData.prototype), "getValuesAfterProceed", this).call(this);
6924
7059
  var authenticatorsData = _filterInstanceProperty(_context5 = _valuesInstanceProperty(this).authenticatorsData).call(_context5, function (data) {
6925
- return data.key !== _this5.authenticator.key;
7060
+ return compareAuthenticators(_this5.authenticator, data) !== true;
6926
7061
  });
6927
7062
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
6928
7063
  authenticatorsData: authenticatorsData
@@ -6956,12 +7091,10 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
6956
7091
  }, {
6957
7092
  key: "mapAuthenticator",
6958
7093
  value: function mapAuthenticator() {
6959
- var _context2, _context3;
6960
- var _a, _b;
6961
- var authenticatorData = this.getAuthenticatorData();
6962
- var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
7094
+ var _a;
6963
7095
  if (this.shouldProceedWithEmailAuthenticator) {
6964
7096
  var _context;
7097
+ var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
6965
7098
  return (_a = authenticatorFromRemediation.form) === null || _a === void 0 ? void 0 : _reduceInstanceProperty(_context = _a.value).call(_context, function (acc, curr) {
6966
7099
  if (curr.value) {
6967
7100
  acc[curr.name] = curr.value;
@@ -6973,25 +7106,15 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
6973
7106
  return acc;
6974
7107
  }, {});
6975
7108
  }
6976
- return {
6977
- id: _findInstanceProperty(_context2 = authenticatorFromRemediation.form.value).call(_context2, function (_ref) {
6978
- var name = _ref.name;
6979
- return name === 'id';
6980
- }).value,
6981
- enrollmentId: (_b = _findInstanceProperty(_context3 = authenticatorFromRemediation.form.value).call(_context3, function (_ref2) {
6982
- var name = _ref2.name;
6983
- return name === 'enrollmentId';
6984
- })) === null || _b === void 0 ? void 0 : _b.value,
6985
- methodType: authenticatorData === null || authenticatorData === void 0 ? void 0 : authenticatorData.methodType
6986
- };
7109
+ return this.getAuthenticatorData();
6987
7110
  }
6988
7111
  }, {
6989
7112
  key: "getInputAuthenticator",
6990
7113
  value: function getInputAuthenticator() {
6991
- var _context4;
7114
+ var _context2;
6992
7115
  var authenticator = this.getAuthenticatorFromRemediation();
6993
- var methodType = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
6994
- var name = _ref3.name;
7116
+ var methodType = _findInstanceProperty(_context2 = authenticator.form.value).call(_context2, function (_ref) {
7117
+ var name = _ref.name;
6995
7118
  return name === 'methodType';
6996
7119
  });
6997
7120
  if (methodType && methodType.options) {
@@ -7004,6 +7127,19 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7004
7127
  var inputs = _toConsumableArray(authenticator.form.value);
7005
7128
  return inputs;
7006
7129
  }
7130
+ }, {
7131
+ key: "getValuesAfterProceed",
7132
+ value: function getValuesAfterProceed() {
7133
+ var _context3,
7134
+ _this2 = this;
7135
+ this.values = _get(_getPrototypeOf(AuthenticatorVerificationData.prototype), "getValuesAfterProceed", this).call(this);
7136
+ var trimmedValues = _filterInstanceProperty(_context3 = _Object$keys(_valuesInstanceProperty(this))).call(_context3, function (valueKey) {
7137
+ return valueKey !== 'authenticator';
7138
+ });
7139
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
7140
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
7141
+ }, {});
7142
+ }
7007
7143
  }]);
7008
7144
  return AuthenticatorVerificationData;
7009
7145
  }(AuthenticatorData);
@@ -7052,10 +7188,12 @@ var AuthenticatorEnrollmentData = function (_AuthenticatorData) {
7052
7188
  value: function mapAuthenticatorDataFromValues(data) {
7053
7189
  data = _get(_getPrototypeOf(AuthenticatorEnrollmentData.prototype), "mapAuthenticatorDataFromValues", this).call(this, data);
7054
7190
  var phoneNumber = _valuesInstanceProperty(this).phoneNumber;
7055
- data = _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7191
+ if (!data && !phoneNumber) {
7192
+ return;
7193
+ }
7194
+ return _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7056
7195
  phoneNumber: phoneNumber
7057
7196
  });
7058
- return data.phoneNumber && data.methodType ? data : null;
7059
7197
  }
7060
7198
  }]);
7061
7199
  return AuthenticatorEnrollmentData;
@@ -7068,18 +7206,13 @@ var Skip = function (_Remediator) {
7068
7206
  _inherits(Skip, _Remediator);
7069
7207
  var _super = _createSuper$1(Skip);
7070
7208
  function Skip() {
7071
- var _this;
7072
7209
  _classCallCheck(this, Skip);
7073
- _this = _super.apply(this, arguments);
7074
- _this.map = {
7075
- skip: ['skip']
7076
- };
7077
- return _this;
7210
+ return _super.apply(this, arguments);
7078
7211
  }
7079
7212
  _createClass(Skip, [{
7080
7213
  key: "canRemediate",
7081
7214
  value: function canRemediate() {
7082
- return !!_valuesInstanceProperty(this).skip;
7215
+ return !!_valuesInstanceProperty(this).skip || this.options.step === 'skip';
7083
7216
  }
7084
7217
  }]);
7085
7218
  return Skip;
@@ -7110,52 +7243,16 @@ var remediators = /*#__PURE__*/Object.freeze({
7110
7243
  });
7111
7244
 
7112
7245
  function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7113
- function _unsupportedIterableToArray$1(o, minLen) { var _context9; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty(_context9 = Object.prototype.toString.call(o)).call(_context9, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
7246
+ function _unsupportedIterableToArray$1(o, minLen) { var _context11; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty(_context11 = Object.prototype.toString.call(o)).call(_context11, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
7114
7247
  function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7115
- function getRemediator(idxRemediations, values, options) {
7116
- var remediators = options.remediators;
7117
- var remediator;
7118
- if (options.step) {
7119
- var remediation = _findInstanceProperty(idxRemediations).call(idxRemediations, function (_ref) {
7120
- var name = _ref.name;
7121
- return name === options.step;
7122
- });
7123
- var T = remediators[remediation.name];
7124
- return new T(remediation, values);
7125
- }
7126
- var remediatorCandidates = [];
7127
- var _iterator = _createForOfIteratorHelper$1(idxRemediations),
7128
- _step;
7129
- try {
7130
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
7131
- var _context;
7132
- var _remediation = _step.value;
7133
- var isRemeditionInFlow = _includesInstanceProperty(_context = _Object$keys(remediators)).call(_context, _remediation.name);
7134
- if (!isRemeditionInFlow) {
7135
- continue;
7136
- }
7137
- var _T = remediators[_remediation.name];
7138
- remediator = new _T(_remediation, values);
7139
- if (remediator.canRemediate()) {
7140
- return remediator;
7141
- }
7142
- remediatorCandidates.push(remediator);
7143
- }
7144
- } catch (err) {
7145
- _iterator.e(err);
7146
- } finally {
7147
- _iterator.f();
7148
- }
7149
- return remediatorCandidates[0];
7150
- }
7151
7248
  function isTerminalResponse(idxResponse) {
7152
7249
  var neededToProceed = idxResponse.neededToProceed,
7153
7250
  interactionCode = idxResponse.interactionCode;
7154
7251
  return !neededToProceed.length && !interactionCode;
7155
7252
  }
7156
7253
  function canSkipFn(idxResponse) {
7157
- return idxResponse.neededToProceed.some(function (_ref2) {
7158
- var name = _ref2.name;
7254
+ return idxResponse.neededToProceed.some(function (_ref) {
7255
+ var name = _ref.name;
7159
7256
  return name === 'skip';
7160
7257
  });
7161
7258
  }
@@ -7164,28 +7261,124 @@ function canResendFn(idxResponse) {
7164
7261
  return _includesInstanceProperty(actionName).call(actionName, 'resend');
7165
7262
  });
7166
7263
  }
7167
- function getIdxMessages(idxResponse) {
7168
- var _context2;
7264
+ function getMessagesFromIdxRemediationValue(value) {
7265
+ if (!value || !Array.isArray(value)) {
7266
+ return;
7267
+ }
7268
+ return _reduceInstanceProperty(value).call(value, function (messages, value) {
7269
+ if (value.messages) {
7270
+ var _context;
7271
+ messages = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(messages), _toConsumableArray(value.messages.value));
7272
+ }
7273
+ if (value.form) {
7274
+ var _context2;
7275
+ var messagesFromForm = getMessagesFromIdxRemediationValue(value.form.value) || [];
7276
+ messages = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(messages), _toConsumableArray(messagesFromForm));
7277
+ }
7278
+ if (value.options) {
7279
+ var _context4;
7280
+ var optionValues = [];
7281
+ value.options.forEach(function (option) {
7282
+ var _context3;
7283
+ if (!option.value || typeof option.value === 'string') {
7284
+ return;
7285
+ }
7286
+ optionValues = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(optionValues), [option.value]);
7287
+ });
7288
+ var messagesFromOptions = getMessagesFromIdxRemediationValue(optionValues) || [];
7289
+ messages = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(messages), _toConsumableArray(messagesFromOptions));
7290
+ }
7291
+ return messages;
7292
+ }, []);
7293
+ }
7294
+ function getMessagesFromResponse(idxResponse) {
7295
+ var _context5;
7169
7296
  var _a;
7170
7297
  var messages = [];
7171
7298
  var rawIdxState = idxResponse.rawIdxState,
7172
7299
  neededToProceed = idxResponse.neededToProceed;
7173
- var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context2 = _a.value).call(_context2, function (message) {
7300
+ var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context5 = _a.value).call(_context5, function (message) {
7174
7301
  return message;
7175
7302
  });
7176
7303
  if (globalMessages) {
7177
- var _context3;
7178
- messages = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7304
+ var _context6;
7305
+ messages = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7306
+ }
7307
+ var _iterator = _createForOfIteratorHelper$1(neededToProceed),
7308
+ _step;
7309
+ try {
7310
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7311
+ var remediation = _step.value;
7312
+ var fieldMessages = getMessagesFromIdxRemediationValue(remediation.value);
7313
+ if (fieldMessages) {
7314
+ var _context8;
7315
+ messages = _concatInstanceProperty(_context8 = []).call(_context8, _toConsumableArray(messages), _toConsumableArray(fieldMessages));
7316
+ }
7317
+ }
7318
+ } catch (err) {
7319
+ _iterator.e(err);
7320
+ } finally {
7321
+ _iterator.f();
7322
+ }
7323
+ var seen = {};
7324
+ messages = _reduceInstanceProperty(messages).call(messages, function (filtered, message) {
7325
+ var _context7;
7326
+ var _a;
7327
+ var key = (_a = message.i18n) === null || _a === void 0 ? void 0 : _a.key;
7328
+ if (key && seen[key]) {
7329
+ return filtered;
7330
+ }
7331
+ seen[key] = message;
7332
+ filtered = _concatInstanceProperty(_context7 = []).call(_context7, _toConsumableArray(filtered), [message]);
7333
+ return filtered;
7334
+ }, []);
7335
+ return messages;
7336
+ }
7337
+ function getEnabledFeatures(idxResponse) {
7338
+ var res = [];
7339
+ var actions = idxResponse.actions,
7340
+ neededToProceed = idxResponse.neededToProceed;
7341
+ if (actions['currentAuthenticator-recover']) {
7342
+ res.push(IdxFeature.PASSWORD_RECOVERY);
7179
7343
  }
7180
- var _iterator2 = _createForOfIteratorHelper$1(neededToProceed),
7344
+ if (neededToProceed.some(function (_ref2) {
7345
+ var name = _ref2.name;
7346
+ return name === 'select-enroll-profile';
7347
+ })) {
7348
+ res.push(IdxFeature.REGISTRATION);
7349
+ }
7350
+ if (neededToProceed.some(function (_ref3) {
7351
+ var name = _ref3.name;
7352
+ return name === 'redirect-idp';
7353
+ })) {
7354
+ res.push(IdxFeature.SOCIAL_IDP);
7355
+ }
7356
+ if (neededToProceed.some(function (_ref4) {
7357
+ var name = _ref4.name;
7358
+ return name === 'unlock-account';
7359
+ })) {
7360
+ res.push(IdxFeature.ACCOUNT_UNLOCK);
7361
+ }
7362
+ return res;
7363
+ }
7364
+ function getAvailableSteps(idxResponse) {
7365
+ var _context9;
7366
+ var res = [];
7367
+ var remediatorMap = _reduceInstanceProperty(_context9 = _Object$values(remediators)).call(_context9, function (map, remediatorClass) {
7368
+ if (remediatorClass.remediationName) {
7369
+ map[remediatorClass.remediationName] = remediatorClass;
7370
+ }
7371
+ return map;
7372
+ }, {});
7373
+ var _iterator2 = _createForOfIteratorHelper$1(idxResponse.neededToProceed),
7181
7374
  _step2;
7182
7375
  try {
7183
7376
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
7184
7377
  var remediation = _step2.value;
7185
- var fieldMessages = Remediator.getMessages(remediation);
7186
- if (fieldMessages) {
7187
- var _context4;
7188
- messages = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(messages), _toConsumableArray(fieldMessages));
7378
+ var T = remediatorMap[remediation.name];
7379
+ if (T) {
7380
+ var remediator = new T(remediation);
7381
+ res.push(remediator.getNextStep(idxResponse.context));
7189
7382
  }
7190
7383
  }
7191
7384
  } catch (err) {
@@ -7193,33 +7386,90 @@ function getIdxMessages(idxResponse) {
7193
7386
  } finally {
7194
7387
  _iterator2.f();
7195
7388
  }
7196
- return messages;
7389
+ return res;
7197
7390
  }
7198
- function getNextStep(remediator, idxResponse) {
7199
- var nextStep = remediator.getNextStep(idxResponse.context);
7200
- var canSkip = canSkipFn(idxResponse);
7201
- var canResend = canResendFn(idxResponse);
7202
- return _Object$assign(_Object$assign(_Object$assign({}, nextStep), canSkip && {
7203
- canSkip: canSkip
7204
- }), canResend && {
7205
- canResend: canResend
7206
- });
7391
+ function filterValuesForRemediation(idxResponse, values) {
7392
+ var _context10;
7393
+ var valuesForRemediation = _reduceInstanceProperty(_context10 = idxResponse.neededToProceed[0].value).call(_context10, function (res, entry) {
7394
+ var name = entry.name;
7395
+ res[name] = values[name];
7396
+ return res;
7397
+ }, {});
7398
+ return valuesForRemediation;
7207
7399
  }
7208
- function handleIdxError(e, remediator) {
7209
- var idxState = isIdxResponse(e) ? e : null;
7210
- if (!idxState) {
7211
- throw e;
7400
+
7401
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7402
+ function _unsupportedIterableToArray(o, minLen) { var _context6; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7403
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7404
+ function getRemediator(idxRemediations, values, options) {
7405
+ var remediators = options.remediators;
7406
+ var remediator;
7407
+ if (options.step) {
7408
+ var remediation = _findInstanceProperty(idxRemediations).call(idxRemediations, function (_ref) {
7409
+ var name = _ref.name;
7410
+ return name === options.step;
7411
+ });
7412
+ if (remediation) {
7413
+ var T = remediation ? remediators[remediation.name] : undefined;
7414
+ return T ? new T(remediation, values, options) : undefined;
7415
+ } else {
7416
+ warn("step \"".concat(options.step, "\" did not match any remediations"));
7417
+ return;
7418
+ }
7212
7419
  }
7213
- var terminal = isTerminalResponse(idxState);
7214
- var messages = getIdxMessages(idxState);
7215
- if (terminal) {
7216
- return {
7217
- terminal: terminal,
7218
- messages: messages
7420
+ var remediatorCandidates = [];
7421
+ var _iterator = _createForOfIteratorHelper(idxRemediations),
7422
+ _step;
7423
+ try {
7424
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7425
+ var _context;
7426
+ var _remediation = _step.value;
7427
+ var isRemeditionInFlow = _includesInstanceProperty(_context = _Object$keys(remediators)).call(_context, _remediation.name);
7428
+ if (!isRemeditionInFlow) {
7429
+ continue;
7430
+ }
7431
+ var _T = remediators[_remediation.name];
7432
+ remediator = new _T(_remediation, values, options);
7433
+ if (remediator.canRemediate()) {
7434
+ return remediator;
7435
+ }
7436
+ remediatorCandidates.push(remediator);
7437
+ }
7438
+ } catch (err) {
7439
+ _iterator.e(err);
7440
+ } finally {
7441
+ _iterator.f();
7442
+ }
7443
+ return remediatorCandidates[0];
7444
+ }
7445
+ function getNextStep(remediator, idxResponse) {
7446
+ var nextStep = remediator.getNextStep(idxResponse.context);
7447
+ var canSkip = canSkipFn(idxResponse);
7448
+ var canResend = canResendFn(idxResponse);
7449
+ return _Object$assign(_Object$assign(_Object$assign({}, nextStep), canSkip && {
7450
+ canSkip: canSkip
7451
+ }), canResend && {
7452
+ canResend: canResend
7453
+ });
7454
+ }
7455
+ function handleIdxError(e, remediator) {
7456
+ var idxResponse = isIdxResponse(e) ? e : null;
7457
+ if (!idxResponse) {
7458
+ throw e;
7459
+ }
7460
+ idxResponse.requestDidSucceed = false;
7461
+ var terminal = isTerminalResponse(idxResponse);
7462
+ var messages = getMessagesFromResponse(idxResponse);
7463
+ if (terminal) {
7464
+ return {
7465
+ idxResponse: idxResponse,
7466
+ terminal: terminal,
7467
+ messages: messages
7219
7468
  };
7220
7469
  } else {
7221
- var nextStep = remediator && getNextStep(remediator, idxState);
7470
+ var nextStep = remediator && getNextStep(remediator, idxResponse);
7222
7471
  return _Object$assign({
7472
+ idxResponse: idxResponse,
7223
7473
  messages: messages
7224
7474
  }, nextStep && {
7225
7475
  nextStep: nextStep
@@ -7227,8 +7477,8 @@ function handleIdxError(e, remediator) {
7227
7477
  }
7228
7478
  }
7229
7479
  function getActionFromValues(values, idxResponse) {
7230
- var _context5;
7231
- return _findInstanceProperty(_context5 = _Object$keys(idxResponse.actions)).call(_context5, function (action) {
7480
+ var _context2;
7481
+ return _findInstanceProperty(_context2 = _Object$keys(idxResponse.actions)).call(_context2, function (action) {
7232
7482
  return !!values.resend && _includesInstanceProperty(action).call(action, '-resend');
7233
7483
  });
7234
7484
  }
@@ -7241,198 +7491,230 @@ function remediate(_x, _x2, _x3) {
7241
7491
  }
7242
7492
  function _remediate() {
7243
7493
  _remediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(idxResponse, values, options) {
7244
- var _context6;
7245
- var _idxResponse, neededToProceed, interactionCode, remediators, flow, terminal, messages, actionFromValues, actions, _iterator3, _step3, _loop, _ret, remediator, nextStep, _nextStep, name, data;
7246
- return _regeneratorRuntime.wrap(function _callee$(_context8) {
7494
+ var _context3;
7495
+ var _idxResponse, neededToProceed, interactionCode, remediators, flow, terminal, messages, actionFromValues, actionFromOptions, actions, _iterator2, _step2, _loop, _ret, remediator, nextStep, _nextStep, name, data;
7496
+ return _regeneratorRuntime.wrap(function _callee$(_context5) {
7247
7497
  while (1) {
7248
- switch (_context8.prev = _context8.next) {
7498
+ switch (_context5.prev = _context5.next) {
7249
7499
  case 0:
7250
7500
  _idxResponse = idxResponse, neededToProceed = _idxResponse.neededToProceed, interactionCode = _idxResponse.interactionCode;
7251
7501
  remediators = options.remediators, flow = options.flow;
7252
7502
  if (!interactionCode) {
7253
- _context8.next = 4;
7503
+ _context5.next = 4;
7254
7504
  break;
7255
7505
  }
7256
- return _context8.abrupt("return", {
7506
+ return _context5.abrupt("return", {
7257
7507
  idxResponse: idxResponse
7258
7508
  });
7259
7509
  case 4:
7260
7510
  terminal = isTerminalResponse(idxResponse);
7261
- messages = getIdxMessages(idxResponse);
7511
+ messages = getMessagesFromResponse(idxResponse);
7262
7512
  if (!terminal) {
7263
- _context8.next = 8;
7513
+ _context5.next = 8;
7264
7514
  break;
7265
7515
  }
7266
- return _context8.abrupt("return", {
7516
+ return _context5.abrupt("return", {
7517
+ idxResponse: idxResponse,
7267
7518
  terminal: terminal,
7268
7519
  messages: messages
7269
7520
  });
7270
7521
  case 8:
7271
7522
  actionFromValues = getActionFromValues(values, idxResponse);
7272
- actions = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(options.actions || []), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7523
+ actionFromOptions = options.actions || [];
7524
+ actions = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(actionFromOptions), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7273
7525
  if (!actions) {
7274
- _context8.next = 30;
7526
+ _context5.next = 31;
7275
7527
  break;
7276
7528
  }
7277
- _iterator3 = _createForOfIteratorHelper$1(actions);
7278
- _context8.prev = 12;
7529
+ _iterator2 = _createForOfIteratorHelper(actions);
7530
+ _context5.prev = 13;
7279
7531
  _loop = _regeneratorRuntime.mark(function _loop() {
7280
- var action, valuesWithoutExecutedAction, remediationAction;
7281
- return _regeneratorRuntime.wrap(function _loop$(_context7) {
7532
+ var action, valuesWithoutExecutedAction, optionsWithoutExecutedAction, remediationAction;
7533
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
7282
7534
  while (1) {
7283
- switch (_context7.prev = _context7.next) {
7535
+ switch (_context4.prev = _context4.next) {
7284
7536
  case 0:
7285
- action = _step3.value;
7537
+ action = _step2.value;
7286
7538
  valuesWithoutExecutedAction = removeActionFromValues(values);
7539
+ optionsWithoutExecutedAction = _Object$assign(_Object$assign({}, options), {
7540
+ actions: _filterInstanceProperty(actionFromOptions).call(actionFromOptions, function (entry) {
7541
+ return entry !== action;
7542
+ })
7543
+ });
7287
7544
  if (!(typeof idxResponse.actions[action] === 'function')) {
7288
- _context7.next = 15;
7545
+ _context4.next = 17;
7289
7546
  break;
7290
7547
  }
7291
- _context7.prev = 3;
7292
- _context7.next = 6;
7548
+ _context4.prev = 4;
7549
+ _context4.next = 7;
7293
7550
  return idxResponse.actions[action]();
7294
- case 6:
7295
- idxResponse = _context7.sent;
7296
- _context7.next = 12;
7551
+ case 7:
7552
+ idxResponse = _context4.sent;
7553
+ idxResponse.requestDidSucceed = true;
7554
+ _context4.next = 14;
7297
7555
  break;
7298
- case 9:
7299
- _context7.prev = 9;
7300
- _context7.t0 = _context7["catch"](3);
7301
- return _context7.abrupt("return", {
7302
- v: handleIdxError(_context7.t0, remediators)
7556
+ case 11:
7557
+ _context4.prev = 11;
7558
+ _context4.t0 = _context4["catch"](4);
7559
+ return _context4.abrupt("return", {
7560
+ v: handleIdxError(_context4.t0, remediators)
7303
7561
  });
7304
- case 12:
7562
+ case 14:
7305
7563
  if (!(action === 'cancel')) {
7306
- _context7.next = 14;
7564
+ _context4.next = 16;
7307
7565
  break;
7308
7566
  }
7309
- return _context7.abrupt("return", {
7567
+ return _context4.abrupt("return", {
7310
7568
  v: {
7569
+ idxResponse: idxResponse,
7311
7570
  canceled: true
7312
7571
  }
7313
7572
  });
7314
- case 14:
7315
- return _context7.abrupt("return", {
7316
- v: remediate(idxResponse, valuesWithoutExecutedAction, options)
7573
+ case 16:
7574
+ return _context4.abrupt("return", {
7575
+ v: remediate(idxResponse, valuesWithoutExecutedAction, optionsWithoutExecutedAction)
7317
7576
  });
7318
- case 15:
7319
- remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref3) {
7320
- var name = _ref3.name;
7577
+ case 17:
7578
+ remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref2) {
7579
+ var name = _ref2.name;
7321
7580
  return name === action;
7322
7581
  });
7323
7582
  if (!remediationAction) {
7324
- _context7.next = 27;
7583
+ _context4.next = 30;
7325
7584
  break;
7326
7585
  }
7327
- _context7.prev = 17;
7328
- _context7.next = 20;
7586
+ _context4.prev = 19;
7587
+ _context4.next = 22;
7329
7588
  return idxResponse.proceed(action, {});
7330
- case 20:
7331
- idxResponse = _context7.sent;
7332
- _context7.next = 26;
7589
+ case 22:
7590
+ idxResponse = _context4.sent;
7591
+ idxResponse.requestDidSucceed = true;
7592
+ _context4.next = 29;
7333
7593
  break;
7334
- case 23:
7335
- _context7.prev = 23;
7336
- _context7.t1 = _context7["catch"](17);
7337
- return _context7.abrupt("return", {
7338
- v: handleIdxError(_context7.t1, remediators)
7339
- });
7340
7594
  case 26:
7341
- return _context7.abrupt("return", {
7342
- v: remediate(idxResponse, values, options)
7595
+ _context4.prev = 26;
7596
+ _context4.t1 = _context4["catch"](19);
7597
+ return _context4.abrupt("return", {
7598
+ v: handleIdxError(_context4.t1, remediators)
7599
+ });
7600
+ case 29:
7601
+ return _context4.abrupt("return", {
7602
+ v: remediate(idxResponse, values, optionsWithoutExecutedAction)
7343
7603
  });
7344
- case 27:
7604
+ case 30:
7345
7605
  case "end":
7346
- return _context7.stop();
7606
+ return _context4.stop();
7347
7607
  }
7348
7608
  }
7349
- }, _loop, null, [[3, 9], [17, 23]]);
7609
+ }, _loop, null, [[4, 11], [19, 26]]);
7350
7610
  });
7351
- _iterator3.s();
7352
- case 15:
7353
- if ((_step3 = _iterator3.n()).done) {
7354
- _context8.next = 22;
7611
+ _iterator2.s();
7612
+ case 16:
7613
+ if ((_step2 = _iterator2.n()).done) {
7614
+ _context5.next = 23;
7355
7615
  break;
7356
7616
  }
7357
- return _context8.delegateYield(_loop(), "t0", 17);
7358
- case 17:
7359
- _ret = _context8.t0;
7617
+ return _context5.delegateYield(_loop(), "t0", 18);
7618
+ case 18:
7619
+ _ret = _context5.t0;
7360
7620
  if (!(_typeof(_ret) === "object")) {
7361
- _context8.next = 20;
7621
+ _context5.next = 21;
7362
7622
  break;
7363
7623
  }
7364
- return _context8.abrupt("return", _ret.v);
7365
- case 20:
7366
- _context8.next = 15;
7624
+ return _context5.abrupt("return", _ret.v);
7625
+ case 21:
7626
+ _context5.next = 16;
7367
7627
  break;
7368
- case 22:
7369
- _context8.next = 27;
7628
+ case 23:
7629
+ _context5.next = 28;
7370
7630
  break;
7371
- case 24:
7372
- _context8.prev = 24;
7373
- _context8.t1 = _context8["catch"](12);
7374
- _iterator3.e(_context8.t1);
7375
- case 27:
7376
- _context8.prev = 27;
7377
- _iterator3.f();
7378
- return _context8.finish(27);
7379
- case 30:
7631
+ case 25:
7632
+ _context5.prev = 25;
7633
+ _context5.t1 = _context5["catch"](13);
7634
+ _iterator2.e(_context5.t1);
7635
+ case 28:
7636
+ _context5.prev = 28;
7637
+ _iterator2.f();
7638
+ return _context5.finish(28);
7639
+ case 31:
7380
7640
  remediator = getRemediator(neededToProceed, values, options);
7381
- if (!(!remediator && flow === 'default')) {
7382
- _context8.next = 33;
7641
+ if (remediator) {
7642
+ _context5.next = 49;
7383
7643
  break;
7384
7644
  }
7385
- return _context8.abrupt("return", {
7645
+ if (!options.step) {
7646
+ _context5.next = 46;
7647
+ break;
7648
+ }
7649
+ values = filterValuesForRemediation(idxResponse, values);
7650
+ _context5.prev = 35;
7651
+ _context5.next = 38;
7652
+ return idxResponse.proceed(options.step, values);
7653
+ case 38:
7654
+ idxResponse = _context5.sent;
7655
+ idxResponse.requestDidSucceed = true;
7656
+ return _context5.abrupt("return", {
7386
7657
  idxResponse: idxResponse
7387
7658
  });
7388
- case 33:
7389
- if (remediator) {
7390
- _context8.next = 35;
7659
+ case 43:
7660
+ _context5.prev = 43;
7661
+ _context5.t2 = _context5["catch"](35);
7662
+ return _context5.abrupt("return", handleIdxError(_context5.t2));
7663
+ case 46:
7664
+ if (!(flow === 'default')) {
7665
+ _context5.next = 48;
7391
7666
  break;
7392
7667
  }
7668
+ return _context5.abrupt("return", {
7669
+ idxResponse: idxResponse
7670
+ });
7671
+ case 48:
7393
7672
  throw new AuthSdkError("\n No remediation can match current flow, check policy settings in your org.\n Remediations: [".concat(_reduceInstanceProperty(neededToProceed).call(neededToProceed, function (acc, curr) {
7394
7673
  return acc ? acc + ' ,' + curr.name : curr.name;
7395
7674
  }, ''), "]\n "));
7396
- case 35:
7675
+ case 49:
7397
7676
  if (!messages.length) {
7398
- _context8.next = 38;
7677
+ _context5.next = 52;
7399
7678
  break;
7400
7679
  }
7401
7680
  nextStep = getNextStep(remediator, idxResponse);
7402
- return _context8.abrupt("return", {
7681
+ return _context5.abrupt("return", {
7682
+ idxResponse: idxResponse,
7403
7683
  nextStep: nextStep,
7404
7684
  messages: messages
7405
7685
  });
7406
- case 38:
7686
+ case 52:
7407
7687
  if (remediator.canRemediate()) {
7408
- _context8.next = 41;
7688
+ _context5.next = 55;
7409
7689
  break;
7410
7690
  }
7411
7691
  _nextStep = getNextStep(remediator, idxResponse);
7412
- return _context8.abrupt("return", {
7692
+ return _context5.abrupt("return", {
7413
7693
  idxResponse: idxResponse,
7414
7694
  nextStep: _nextStep
7415
7695
  });
7416
- case 41:
7696
+ case 55:
7417
7697
  name = remediator.getName();
7418
7698
  data = remediator.getData();
7419
- _context8.prev = 43;
7420
- _context8.next = 46;
7699
+ _context5.prev = 57;
7700
+ _context5.next = 60;
7421
7701
  return idxResponse.proceed(name, data);
7422
- case 46:
7423
- idxResponse = _context8.sent;
7702
+ case 60:
7703
+ idxResponse = _context5.sent;
7704
+ idxResponse.requestDidSucceed = true;
7424
7705
  values = remediator.getValuesAfterProceed();
7425
- return _context8.abrupt("return", remediate(idxResponse, values, options));
7426
- case 51:
7427
- _context8.prev = 51;
7428
- _context8.t2 = _context8["catch"](43);
7429
- return _context8.abrupt("return", handleIdxError(_context8.t2, remediator));
7430
- case 54:
7706
+ delete options.step;
7707
+ return _context5.abrupt("return", remediate(idxResponse, values, options));
7708
+ case 67:
7709
+ _context5.prev = 67;
7710
+ _context5.t3 = _context5["catch"](57);
7711
+ return _context5.abrupt("return", handleIdxError(_context5.t3, remediator));
7712
+ case 70:
7431
7713
  case "end":
7432
- return _context8.stop();
7714
+ return _context5.stop();
7433
7715
  }
7434
7716
  }
7435
- }, _callee, null, [[12, 24, 27, 30], [43, 51]]);
7717
+ }, _callee, null, [[13, 25, 28, 31], [35, 43], [57, 67]]);
7436
7718
  }));
7437
7719
  return _remediate.apply(this, arguments);
7438
7720
  }
@@ -7526,148 +7808,78 @@ function getFlowSpecification(oktaAuth) {
7526
7808
  };
7527
7809
  }
7528
7810
 
7529
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7530
- function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7531
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7532
- function getEnabledFeatures(idxResponse) {
7533
- var res = [];
7534
- var actions = idxResponse.actions,
7535
- neededToProceed = idxResponse.neededToProceed;
7536
- if (actions['currentAuthenticator-recover']) {
7537
- res.push(IdxFeature.PASSWORD_RECOVERY);
7538
- }
7539
- if (neededToProceed.some(function (_ref) {
7540
- var name = _ref.name;
7541
- return name === 'select-enroll-profile';
7542
- })) {
7543
- res.push(IdxFeature.REGISTRATION);
7544
- }
7545
- if (neededToProceed.some(function (_ref2) {
7546
- var name = _ref2.name;
7547
- return name === 'redirect-idp';
7548
- })) {
7549
- res.push(IdxFeature.SOCIAL_IDP);
7550
- }
7551
- if (neededToProceed.some(function (_ref3) {
7552
- var name = _ref3.name;
7553
- return name === 'unlock-account';
7554
- })) {
7555
- res.push(IdxFeature.ACCOUNT_UNLOCK);
7556
- }
7557
- return res;
7811
+ function initializeValues(options) {
7812
+ var knownOptions = ['flow', 'remediators', 'actions', 'withCredentials', 'step'];
7813
+ var values = _Object$assign({}, options);
7814
+ knownOptions.forEach(function (option) {
7815
+ delete values[option];
7816
+ });
7817
+ return values;
7558
7818
  }
7559
- function getAvailableSteps(idxResponse) {
7560
- var _context;
7561
- var res = [];
7562
- var remediatorMap = _reduceInstanceProperty(_context = _Object$values(remediators)).call(_context, function (map, remediatorClass) {
7563
- if (remediatorClass.remediationName) {
7564
- map[remediatorClass.remediationName] = remediatorClass;
7565
- }
7566
- return map;
7567
- }, {});
7568
- var _iterator = _createForOfIteratorHelper(idxResponse.neededToProceed),
7569
- _step;
7570
- try {
7571
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
7572
- var remediation = _step.value;
7573
- var T = remediatorMap[remediation.name];
7574
- if (T) {
7575
- var remediator = new T(remediation);
7576
- res.push(remediator.getNextStep(idxResponse.context));
7577
- }
7578
- }
7579
- } catch (err) {
7580
- _iterator.e(err);
7581
- } finally {
7582
- _iterator.f();
7583
- }
7584
- return res;
7819
+ function initializeData(authClient, data) {
7820
+ var options = data.options;
7821
+ var flow = options.flow,
7822
+ withCredentials = options.withCredentials,
7823
+ remediators = options.remediators,
7824
+ actions = options.actions;
7825
+ var status = IdxStatus.PENDING;
7826
+ flow = flow || authClient.idx.getFlow() || 'default';
7827
+ if (flow) {
7828
+ authClient.idx.setFlow(flow);
7829
+ var flowSpec = getFlowSpecification(authClient, flow);
7830
+ withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7831
+ remediators = remediators || flowSpec.remediators;
7832
+ actions = actions || flowSpec.actions;
7833
+ }
7834
+ return _Object$assign(_Object$assign({}, data), {
7835
+ options: _Object$assign(_Object$assign({}, options), {
7836
+ flow: flow,
7837
+ withCredentials: withCredentials,
7838
+ remediators: remediators,
7839
+ actions: actions
7840
+ }),
7841
+ status: status
7842
+ });
7585
7843
  }
7586
- function run(_x) {
7587
- return _run.apply(this, arguments);
7844
+ function getDataFromIntrospect(_x, _x2) {
7845
+ return _getDataFromIntrospect.apply(this, arguments);
7588
7846
  }
7589
- function _run() {
7590
- _run = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
7591
- var options,
7592
- tokens,
7593
- nextStep,
7594
- messages,
7595
- error,
7596
- meta,
7597
- enabledFeatures,
7598
- availableSteps,
7599
- status,
7600
- shouldClearTransaction,
7601
- clearSharedStorage,
7602
- idxResponse,
7603
- interactionHandle,
7604
- metaFromResp,
7605
- interactionCode,
7606
- flow,
7607
- state,
7608
- scopes,
7609
- version,
7610
- _remediators,
7611
- _actions,
7612
- withCredentials,
7613
- exchangeCodeForTokens,
7614
- autoRemediate,
7615
- step,
7616
- recoveryToken,
7617
- activationToken,
7618
- flowSpec,
7619
- interactResponse,
7620
- values,
7621
- _yield$remediate,
7622
- idxResponseFromResp,
7623
- nextStepFromResp,
7624
- terminal,
7625
- canceled,
7626
- messagesFromResp,
7627
- _metaFromResp,
7628
- clientId,
7629
- codeVerifier,
7630
- ignoreSignature,
7631
- redirectUri,
7632
- urls,
7633
- _scopes,
7634
- _ref4,
7635
- actions,
7636
- context,
7637
- neededToProceed,
7638
- proceed,
7639
- rawIdxState,
7640
- _args = arguments;
7641
- return _regeneratorRuntime.wrap(function _callee$(_context2) {
7847
+ function _getDataFromIntrospect() {
7848
+ _getDataFromIntrospect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, data) {
7849
+ var options, stateHandle, withCredentials, version, state, scopes, recoveryToken, activationToken, idxResponse, meta, interactionHandle, interactResponse;
7850
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
7642
7851
  while (1) {
7643
- switch (_context2.prev = _context2.next) {
7852
+ switch (_context.prev = _context.next) {
7644
7853
  case 0:
7645
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7646
- status = IdxStatus.PENDING;
7647
- shouldClearTransaction = false;
7648
- clearSharedStorage = true;
7649
- _context2.prev = 4;
7650
- flow = options.flow, state = options.state, scopes = options.scopes, version = options.version, _remediators = options.remediators, _actions = options.actions, withCredentials = options.withCredentials, exchangeCodeForTokens = options.exchangeCodeForTokens, autoRemediate = options.autoRemediate, step = options.step, recoveryToken = options.recoveryToken, activationToken = options.activationToken;
7651
- flow = flow || authClient.idx.getFlow() || 'default';
7652
- if (flow) {
7653
- authClient.idx.setFlow(flow);
7654
- flowSpec = getFlowSpecification(authClient, flow);
7655
- withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7656
- _remediators = _remediators || flowSpec.remediators;
7657
- _actions = _actions || flowSpec.actions;
7854
+ options = data.options;
7855
+ stateHandle = options.stateHandle, withCredentials = options.withCredentials, version = options.version, state = options.state, scopes = options.scopes, recoveryToken = options.recoveryToken, activationToken = options.activationToken;
7856
+ if (!stateHandle) {
7857
+ _context.next = 8;
7858
+ break;
7658
7859
  }
7659
- metaFromResp = getSavedTransactionMeta(authClient, {
7860
+ _context.next = 5;
7861
+ return introspect(authClient, {
7862
+ withCredentials: withCredentials,
7863
+ version: version,
7864
+ stateHandle: stateHandle
7865
+ });
7866
+ case 5:
7867
+ idxResponse = _context.sent;
7868
+ _context.next = 20;
7869
+ break;
7870
+ case 8:
7871
+ meta = getSavedTransactionMeta(authClient, {
7660
7872
  state: state,
7661
7873
  recoveryToken: recoveryToken,
7662
7874
  activationToken: activationToken
7663
7875
  });
7664
- interactionHandle = metaFromResp === null || metaFromResp === void 0 ? void 0 : metaFromResp.interactionHandle;
7876
+ interactionHandle = meta === null || meta === void 0 ? void 0 : meta.interactionHandle;
7665
7877
  if (interactionHandle) {
7666
- _context2.next = 18;
7878
+ _context.next = 17;
7667
7879
  break;
7668
7880
  }
7669
7881
  authClient.transactionManager.clear();
7670
- _context2.next = 14;
7882
+ _context.next = 14;
7671
7883
  return interact(authClient, {
7672
7884
  withCredentials: withCredentials,
7673
7885
  state: state,
@@ -7676,119 +7888,288 @@ function _run() {
7676
7888
  recoveryToken: recoveryToken
7677
7889
  });
7678
7890
  case 14:
7679
- interactResponse = _context2.sent;
7891
+ interactResponse = _context.sent;
7680
7892
  interactionHandle = interactResponse.interactionHandle;
7681
- metaFromResp = interactResponse.meta;
7682
- withCredentials = metaFromResp.withCredentials;
7683
- case 18:
7684
- _context2.next = 20;
7893
+ meta = interactResponse.meta;
7894
+ case 17:
7895
+ _context.next = 19;
7685
7896
  return introspect(authClient, {
7686
7897
  withCredentials: withCredentials,
7687
7898
  version: version,
7688
7899
  interactionHandle: interactionHandle
7689
7900
  });
7901
+ case 19:
7902
+ idxResponse = _context.sent;
7690
7903
  case 20:
7691
- idxResponse = _context2.sent;
7692
- enabledFeatures = getEnabledFeatures(idxResponse);
7693
- availableSteps = getAvailableSteps(idxResponse);
7694
- meta = metaFromResp;
7695
- if (!(autoRemediate !== false && (_remediators || _actions))) {
7696
- _context2.next = 57;
7904
+ return _context.abrupt("return", _Object$assign(_Object$assign({}, data), {
7905
+ idxResponse: idxResponse,
7906
+ meta: meta
7907
+ }));
7908
+ case 21:
7909
+ case "end":
7910
+ return _context.stop();
7911
+ }
7912
+ }
7913
+ }, _callee);
7914
+ }));
7915
+ return _getDataFromIntrospect.apply(this, arguments);
7916
+ }
7917
+ function getDataFromRemediate(_x3) {
7918
+ return _getDataFromRemediate.apply(this, arguments);
7919
+ }
7920
+ function _getDataFromRemediate() {
7921
+ _getDataFromRemediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee2(data) {
7922
+ var idxResponse, options, values, autoRemediate, remediators, actions, flow, step, shouldRemediate, _yield$remediate, idxResponseFromRemediation, nextStep, canceled;
7923
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
7924
+ while (1) {
7925
+ switch (_context2.prev = _context2.next) {
7926
+ case 0:
7927
+ idxResponse = data.idxResponse, options = data.options, values = _valuesInstanceProperty(data);
7928
+ autoRemediate = options.autoRemediate, remediators = options.remediators, actions = options.actions, flow = options.flow, step = options.step;
7929
+ shouldRemediate = autoRemediate !== false && (remediators || actions || step);
7930
+ if (shouldRemediate) {
7931
+ _context2.next = 5;
7697
7932
  break;
7698
7933
  }
7699
- values = _Object$assign(_Object$assign({}, options), {
7934
+ return _context2.abrupt("return", data);
7935
+ case 5:
7936
+ values = _Object$assign(_Object$assign({}, values), {
7700
7937
  stateHandle: idxResponse.rawIdxState.stateHandle
7701
7938
  });
7702
- _context2.next = 28;
7939
+ _context2.next = 8;
7703
7940
  return remediate(idxResponse, values, {
7704
- remediators: _remediators,
7705
- actions: _actions,
7941
+ remediators: remediators,
7942
+ actions: actions,
7706
7943
  flow: flow,
7707
7944
  step: step
7708
7945
  });
7709
- case 28:
7946
+ case 8:
7710
7947
  _yield$remediate = _context2.sent;
7711
- idxResponseFromResp = _yield$remediate.idxResponse;
7712
- nextStepFromResp = _yield$remediate.nextStep;
7713
- terminal = _yield$remediate.terminal;
7948
+ idxResponseFromRemediation = _yield$remediate.idxResponse;
7949
+ nextStep = _yield$remediate.nextStep;
7714
7950
  canceled = _yield$remediate.canceled;
7715
- messagesFromResp = _yield$remediate.messages;
7716
- idxResponse = idxResponseFromResp || idxResponse;
7717
- nextStep = nextStepFromResp;
7718
- messages = messagesFromResp;
7719
- if (nextStep) {
7720
- authClient.transactionManager.saveIdxResponse(idxResponse.rawIdxState);
7951
+ idxResponse = idxResponseFromRemediation;
7952
+ return _context2.abrupt("return", _Object$assign(_Object$assign({}, data), {
7953
+ idxResponse: idxResponse,
7954
+ nextStep: nextStep,
7955
+ canceled: canceled
7956
+ }));
7957
+ case 14:
7958
+ case "end":
7959
+ return _context2.stop();
7960
+ }
7961
+ }
7962
+ }, _callee2);
7963
+ }));
7964
+ return _getDataFromRemediate.apply(this, arguments);
7965
+ }
7966
+ function getTokens(_x4, _x5) {
7967
+ return _getTokens.apply(this, arguments);
7968
+ }
7969
+ function _getTokens() {
7970
+ _getTokens = _asyncToGenerator( _regeneratorRuntime.mark(function _callee3(authClient, data) {
7971
+ var meta, idxResponse, interactionCode, clientId, codeVerifier, ignoreSignature, redirectUri, urls, scopes, tokenResponse;
7972
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
7973
+ while (1) {
7974
+ switch (_context3.prev = _context3.next) {
7975
+ case 0:
7976
+ meta = data.meta, idxResponse = data.idxResponse;
7977
+ interactionCode = idxResponse.interactionCode;
7978
+ clientId = meta.clientId, codeVerifier = meta.codeVerifier, ignoreSignature = meta.ignoreSignature, redirectUri = meta.redirectUri, urls = meta.urls, scopes = meta.scopes;
7979
+ _context3.next = 5;
7980
+ return authClient.token.exchangeCodeForTokens({
7981
+ interactionCode: interactionCode,
7982
+ clientId: clientId,
7983
+ codeVerifier: codeVerifier,
7984
+ ignoreSignature: ignoreSignature,
7985
+ redirectUri: redirectUri,
7986
+ scopes: scopes
7987
+ }, urls);
7988
+ case 5:
7989
+ tokenResponse = _context3.sent;
7990
+ return _context3.abrupt("return", tokenResponse.tokens);
7991
+ case 7:
7992
+ case "end":
7993
+ return _context3.stop();
7994
+ }
7995
+ }
7996
+ }, _callee3);
7997
+ }));
7998
+ return _getTokens.apply(this, arguments);
7999
+ }
8000
+ function finalizeData(_x6, _x7) {
8001
+ return _finalizeData.apply(this, arguments);
8002
+ }
8003
+ function _finalizeData() {
8004
+ _finalizeData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee4(authClient, data) {
8005
+ var options, idxResponse, canceled, status, exchangeCodeForTokens, shouldClearTransaction, clearSharedStorage, interactionCode, tokens, enabledFeatures, availableSteps, messages, terminal;
8006
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
8007
+ while (1) {
8008
+ switch (_context4.prev = _context4.next) {
8009
+ case 0:
8010
+ options = data.options, idxResponse = data.idxResponse, canceled = data.canceled, status = data.status;
8011
+ exchangeCodeForTokens = options.exchangeCodeForTokens;
8012
+ shouldClearTransaction = false;
8013
+ clearSharedStorage = true;
8014
+ if (idxResponse) {
8015
+ enabledFeatures = getEnabledFeatures(idxResponse);
7721
8016
  availableSteps = getAvailableSteps(idxResponse);
8017
+ messages = getMessagesFromResponse(idxResponse);
8018
+ terminal = isTerminalResponse(idxResponse);
7722
8019
  }
7723
- if (terminal) {
7724
- status = IdxStatus.TERMINAL;
7725
- shouldClearTransaction = true;
7726
- clearSharedStorage = false;
8020
+ if (!terminal) {
8021
+ _context4.next = 11;
8022
+ break;
7727
8023
  }
8024
+ status = IdxStatus.TERMINAL;
8025
+ shouldClearTransaction = true;
8026
+ clearSharedStorage = false;
8027
+ _context4.next = 28;
8028
+ break;
8029
+ case 11:
7728
8030
  if (!canceled) {
7729
- _context2.next = 44;
8031
+ _context4.next = 16;
7730
8032
  break;
7731
8033
  }
7732
8034
  status = IdxStatus.CANCELED;
7733
8035
  shouldClearTransaction = true;
7734
- _context2.next = 57;
8036
+ _context4.next = 28;
7735
8037
  break;
7736
- case 44:
8038
+ case 16:
7737
8039
  if (!(idxResponse === null || idxResponse === void 0 ? void 0 : idxResponse.interactionCode)) {
7738
- _context2.next = 57;
8040
+ _context4.next = 28;
7739
8041
  break;
7740
8042
  }
7741
8043
  interactionCode = idxResponse.interactionCode;
7742
8044
  if (!(exchangeCodeForTokens === false)) {
7743
- _context2.next = 51;
8045
+ _context4.next = 23;
7744
8046
  break;
7745
8047
  }
7746
8048
  status = IdxStatus.SUCCESS;
7747
8049
  shouldClearTransaction = false;
7748
- _context2.next = 57;
8050
+ _context4.next = 28;
7749
8051
  break;
7750
- case 51:
7751
- _metaFromResp = metaFromResp, clientId = _metaFromResp.clientId, codeVerifier = _metaFromResp.codeVerifier, ignoreSignature = _metaFromResp.ignoreSignature, redirectUri = _metaFromResp.redirectUri, urls = _metaFromResp.urls, _scopes = _metaFromResp.scopes;
7752
- _context2.next = 54;
7753
- return authClient.token.exchangeCodeForTokens({
7754
- interactionCode: interactionCode,
7755
- clientId: clientId,
7756
- codeVerifier: codeVerifier,
7757
- ignoreSignature: ignoreSignature,
7758
- redirectUri: redirectUri,
7759
- scopes: _scopes
7760
- }, urls);
7761
- case 54:
7762
- tokens = _context2.sent;
8052
+ case 23:
8053
+ _context4.next = 25;
8054
+ return getTokens(authClient, data);
8055
+ case 25:
8056
+ tokens = _context4.sent;
7763
8057
  status = IdxStatus.SUCCESS;
7764
8058
  shouldClearTransaction = true;
7765
- case 57:
7766
- _context2.next = 68;
7767
- break;
7768
- case 59:
7769
- _context2.prev = 59;
7770
- _context2.t0 = _context2["catch"](4);
7771
- if (!isIdxResponse(_context2.t0)) {
7772
- _context2.next = 67;
7773
- break;
7774
- }
7775
- error = _context2.t0;
7776
- status = IdxStatus.FAILURE;
7777
- shouldClearTransaction = true;
7778
- _context2.next = 68;
8059
+ case 28:
8060
+ return _context4.abrupt("return", _Object$assign(_Object$assign({}, data), {
8061
+ status: status,
8062
+ interactionCode: interactionCode,
8063
+ tokens: tokens,
8064
+ shouldClearTransaction: shouldClearTransaction,
8065
+ clearSharedStorage: clearSharedStorage,
8066
+ enabledFeatures: enabledFeatures,
8067
+ availableSteps: availableSteps,
8068
+ messages: messages,
8069
+ terminal: terminal
8070
+ }));
8071
+ case 29:
8072
+ case "end":
8073
+ return _context4.stop();
8074
+ }
8075
+ }
8076
+ }, _callee4);
8077
+ }));
8078
+ return _finalizeData.apply(this, arguments);
8079
+ }
8080
+ function handleError(err, data) {
8081
+ var error = data.error,
8082
+ status = data.status,
8083
+ shouldClearTransaction = data.shouldClearTransaction;
8084
+ if (isIdxResponse(err)) {
8085
+ error = err;
8086
+ status = IdxStatus.FAILURE;
8087
+ shouldClearTransaction = true;
8088
+ } else {
8089
+ throw err;
8090
+ }
8091
+ return _Object$assign(_Object$assign({}, data), {
8092
+ error: error,
8093
+ status: status,
8094
+ shouldClearTransaction: shouldClearTransaction
8095
+ });
8096
+ }
8097
+ function run(_x8) {
8098
+ return _run.apply(this, arguments);
8099
+ }
8100
+ function _run() {
8101
+ _run = _asyncToGenerator( _regeneratorRuntime.mark(function _callee5(authClient) {
8102
+ var options,
8103
+ data,
8104
+ _data,
8105
+ idxResponse,
8106
+ meta,
8107
+ shouldClearTransaction,
8108
+ clearSharedStorage,
8109
+ status,
8110
+ enabledFeatures,
8111
+ availableSteps,
8112
+ tokens,
8113
+ nextStep,
8114
+ messages,
8115
+ error,
8116
+ interactionCode,
8117
+ rawIdxResponse,
8118
+ requestDidSucceed,
8119
+ _ref,
8120
+ actions,
8121
+ context,
8122
+ neededToProceed,
8123
+ proceed,
8124
+ rawIdxState,
8125
+ _args5 = arguments;
8126
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8127
+ while (1) {
8128
+ switch (_context5.prev = _context5.next) {
8129
+ case 0:
8130
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
8131
+ data = {
8132
+ options: options,
8133
+ values: initializeValues(options)
8134
+ };
8135
+ data = initializeData(authClient, data);
8136
+ _context5.prev = 3;
8137
+ _context5.next = 6;
8138
+ return getDataFromIntrospect(authClient, data);
8139
+ case 6:
8140
+ data = _context5.sent;
8141
+ _context5.next = 9;
8142
+ return getDataFromRemediate(data);
8143
+ case 9:
8144
+ data = _context5.sent;
8145
+ _context5.next = 15;
7779
8146
  break;
7780
- case 67:
7781
- throw _context2.t0;
7782
- case 68:
8147
+ case 12:
8148
+ _context5.prev = 12;
8149
+ _context5.t0 = _context5["catch"](3);
8150
+ data = handleError(_context5.t0, data);
8151
+ case 15:
8152
+ _context5.next = 17;
8153
+ return finalizeData(authClient, data);
8154
+ case 17:
8155
+ data = _context5.sent;
8156
+ _data = data, idxResponse = _data.idxResponse, meta = _data.meta, shouldClearTransaction = _data.shouldClearTransaction, clearSharedStorage = _data.clearSharedStorage, status = _data.status, enabledFeatures = _data.enabledFeatures, availableSteps = _data.availableSteps, tokens = _data.tokens, nextStep = _data.nextStep, messages = _data.messages, error = _data.error, interactionCode = _data.interactionCode;
7783
8157
  if (shouldClearTransaction) {
7784
8158
  authClient.transactionManager.clear({
7785
8159
  clearSharedStorage: clearSharedStorage
7786
8160
  });
7787
- } else if (meta === null || meta === void 0 ? void 0 : meta.state) {
8161
+ } else {
7788
8162
  saveTransactionMeta(authClient, _Object$assign({}, meta));
8163
+ if (idxResponse) {
8164
+ rawIdxResponse = idxResponse.rawIdxState, requestDidSucceed = idxResponse.requestDidSucceed;
8165
+ authClient.transactionManager.saveIdxResponse({
8166
+ rawIdxResponse: rawIdxResponse,
8167
+ requestDidSucceed: requestDidSucceed
8168
+ });
8169
+ }
7789
8170
  }
7790
- _ref4 = idxResponse || {}, actions = _ref4.actions, context = _ref4.context, neededToProceed = _ref4.neededToProceed, proceed = _ref4.proceed, rawIdxState = _ref4.rawIdxState;
7791
- return _context2.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8171
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState;
8172
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
7792
8173
  status: status
7793
8174
  }, meta && {
7794
8175
  meta: meta
@@ -7797,10 +8178,10 @@ function _run() {
7797
8178
  }), availableSteps && {
7798
8179
  availableSteps: availableSteps
7799
8180
  }), tokens && {
7800
- tokens: tokens.tokens
8181
+ tokens: tokens
7801
8182
  }), nextStep && {
7802
8183
  nextStep: nextStep
7803
- }), messages && {
8184
+ }), messages && messages.length && {
7804
8185
  messages: messages
7805
8186
  }), error && {
7806
8187
  error: error
@@ -7812,12 +8193,12 @@ function _run() {
7812
8193
  proceed: proceed,
7813
8194
  rawIdxState: rawIdxState
7814
8195
  }));
7815
- case 71:
8196
+ case 22:
7816
8197
  case "end":
7817
- return _context2.stop();
8198
+ return _context5.stop();
7818
8199
  }
7819
8200
  }
7820
- }, _callee, null, [[4, 59]]);
8201
+ }, _callee5, null, [[3, 12]]);
7821
8202
  }));
7822
8203
  return _run.apply(this, arguments);
7823
8204
  }
@@ -7940,9 +8321,10 @@ function _handleEmailVerifyCallback() {
7940
8321
  return _handleEmailVerifyCallback.apply(this, arguments);
7941
8322
  }
7942
8323
 
7943
- function canProceed(authClient, options) {
8324
+ function canProceed(authClient) {
8325
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7944
8326
  var meta = getSavedTransactionMeta(authClient, options);
7945
- return !!meta;
8327
+ return !!(meta || options.stateHandle);
7946
8328
  }
7947
8329
  function proceed(_x) {
7948
8330
  return _proceed.apply(this, arguments);
@@ -7950,30 +8332,32 @@ function proceed(_x) {
7950
8332
  function _proceed() {
7951
8333
  _proceed = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
7952
8334
  var options,
8335
+ flow,
7953
8336
  state,
7954
8337
  meta,
7955
- flow,
7956
8338
  _args = arguments;
7957
8339
  return _regeneratorRuntime.wrap(function _callee$(_context) {
7958
8340
  while (1) {
7959
8341
  switch (_context.prev = _context.next) {
7960
8342
  case 0:
7961
8343
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7962
- state = options.state;
7963
- meta = getSavedTransactionMeta(authClient, {
7964
- state: state
7965
- });
7966
- if (meta) {
7967
- _context.next = 5;
8344
+ if (canProceed(authClient, options)) {
8345
+ _context.next = 3;
7968
8346
  break;
7969
8347
  }
7970
8348
  throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');
7971
- case 5:
7972
- flow = meta === null || meta === void 0 ? void 0 : meta.flow;
8349
+ case 3:
8350
+ flow = options.flow, state = options.state;
8351
+ if (!flow) {
8352
+ meta = getSavedTransactionMeta(authClient, {
8353
+ state: state
8354
+ });
8355
+ flow = meta === null || meta === void 0 ? void 0 : meta.flow;
8356
+ }
7973
8357
  return _context.abrupt("return", run(authClient, _Object$assign(_Object$assign({}, options), {
7974
8358
  flow: flow
7975
8359
  })));
7976
- case 7:
8360
+ case 6:
7977
8361
  case "end":
7978
8362
  return _context.stop();
7979
8363
  }
@@ -8171,7 +8555,7 @@ function handleInteractionCodeRedirect(_x, _x2) {
8171
8555
  }
8172
8556
  function _handleInteractionCodeRedirect() {
8173
8557
  _handleInteractionCodeRedirect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, url) {
8174
- var meta, codeVerifier, savedState, _URL$1, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8558
+ var meta, codeVerifier, savedState, _URL, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8175
8559
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8176
8560
  while (1) {
8177
8561
  switch (_context.prev = _context.next) {
@@ -8184,7 +8568,7 @@ function _handleInteractionCodeRedirect() {
8184
8568
  throw new AuthSdkError('No transaction data was found in storage');
8185
8569
  case 3:
8186
8570
  codeVerifier = meta.codeVerifier, savedState = meta.state;
8187
- _URL$1 = new _URL(url), searchParams = _URL$1.searchParams;
8571
+ _URL = new _URL2(url), searchParams = _URL.searchParams;
8188
8572
  state = searchParams.get('state');
8189
8573
  interactionCode = searchParams.get('interaction_code');
8190
8574
  error = searchParams.get('error');
@@ -8287,7 +8671,7 @@ function createGlobalRequestInterceptor(sdk) {
8287
8671
  var OktaUserAgent = function () {
8288
8672
  function OktaUserAgent() {
8289
8673
  _classCallCheck(this, OktaUserAgent);
8290
- this.environments = ["okta-auth-js/".concat("6.2.0")];
8674
+ this.environments = ["okta-auth-js/".concat("6.3.0")];
8291
8675
  }
8292
8676
  _createClass(OktaUserAgent, [{
8293
8677
  key: "addEnvironment",
@@ -8305,7 +8689,7 @@ var OktaUserAgent = function () {
8305
8689
  }, {
8306
8690
  key: "getVersion",
8307
8691
  value: function getVersion() {
8308
- return "6.2.0";
8692
+ return "6.3.0";
8309
8693
  }
8310
8694
  }, {
8311
8695
  key: "maybeAddNodeEnvironment",
@@ -9172,5 +9556,5 @@ _Object$assign(OktaAuth, {
9172
9556
  constants: constants
9173
9557
  });
9174
9558
 
9175
- export { ACCESS_TOKEN_STORAGE_KEY, AuthApiError, AuthPollStopError, AuthSdkError, AuthStateManager, AuthTransaction, AuthenticatorKey, CACHE_STORAGE_NAME, DEFAULT_CACHE_DURATION, DEFAULT_CODE_CHALLENGE_METHOD, DEFAULT_MAX_CLOCK_SKEW, DEFAULT_POLLING_DELAY, EVENT_ADDED, EVENT_ERROR, EVENT_EXPIRED, EVENT_REMOVED, EVENT_RENEWED, IDX_API_VERSION, IDX_RESPONSE_STORAGE_NAME, ID_TOKEN_STORAGE_KEY, INITIAL_AUTH_STATE, IdxFeature, IdxStatus, MAX_VERIFIER_LENGTH, MIN_VERIFIER_LENGTH, OAuthError, ORIGINAL_URI_STORAGE_NAME, OktaAuth, PKCE_STORAGE_NAME, REDIRECT_NONCE_COOKIE_NAME, REDIRECT_OAUTH_PARAMS_NAME, REDIRECT_STATE_COOKIE_NAME, REFERRER_PATH_STORAGE_KEY, REFRESH_TOKEN_STORAGE_KEY, SHARED_TRANSACTION_STORAGE_NAME, STATE_TOKEN_KEY_NAME, StorageManager, TOKEN_STORAGE_NAME, TRANSACTION_STORAGE_NAME, TokenManager, addListener, addPostMessageListener, addStateToken, assertPKCESupport, authenticate, bind, buildAuthorizeParams, canProceed, cancel, clearTransactionMeta, clone, convertTokenParamsToOAuthParams, createOAuthMeta, createTransactionMeta, crypto$1 as crypto, decodeToken, delay, deprecate, deprecateWrap, exchangeCodeForTokens, extend, find, genRandomString, generateNonce, generateState, getConsole, getDefaultTokenParams, getHashOrSearch, getKey, getLink, getNativeConsole, getOAuthBaseUrl, getOAuthDomain, getOAuthUrls, getPollFn, getSavedTransactionMeta, getStateToken, getToken, getTransactionMeta, getUserInfo, getWellKnown, getWithPopup, getWithRedirect, getWithoutPrompt, handleEmailVerifyCallback, handleInteractionCodeRedirect, handleOAuthResponse, hasAuthorizationCode, hasErrorInUrl, hasInteractionCode, hasSavedInteractionHandle, hasTokensInHash, interact, introspect, introspectAuthn, isAbsoluteUrl, isAccessToken, isAuthApiError, isAuthorizationCodeError, isCodeFlow, isCustomAuthTransactionMeta, isEmailVerifyCallback, isEmailVerifyCallbackError, isFunction, isIDToken, isIdxTransactionMeta, isInteractionRequired, isInteractionRequiredError, isLoginRedirect, isNumber, isOAuthTransactionMeta, isObject, isPKCETransactionMeta, isPromise, isRedirectUri, isRefreshToken, isRefreshTokenError, isSameRefreshToken, isString, isToken, isTransactionMeta, isTransactionMetaValid, isTransactionMetaValidForFlow, isTransactionMetaValidForOptions, isoToUTCString, loadFrame, loadPopup, omit, parseEmailVerifyCallback, parseFromUrl, PKCE as pkce, poll, postRefreshToken, postToTokenEndpoint, postToTransaction, preparePKCE, prepareTokenParams, proceed, recoverPassword, register, removeListener, removeNils, removeTrailingSlash, renewToken, renewTokens, renewTokensWithRefresh, resumeTransaction, revokeToken, saveTransactionMeta, startTransaction, toAbsoluteUrl, toQueryString, toRelativeUrl, transactionExists, transactionStatus, transactionStep, unlockAccount, urlParamsToObject, validateClaims, validateCodeChallengeMethod, validateToken, verifyToken, warn };
9559
+ export { ACCESS_TOKEN_STORAGE_KEY, AuthApiError, AuthPollStopError, AuthSdkError, AuthStateManager, AuthTransaction, AuthenticatorKey, CACHE_STORAGE_NAME, DEFAULT_CACHE_DURATION, DEFAULT_CODE_CHALLENGE_METHOD, DEFAULT_MAX_CLOCK_SKEW, DEFAULT_POLLING_DELAY, EVENT_ADDED, EVENT_ERROR, EVENT_EXPIRED, EVENT_REMOVED, EVENT_RENEWED, IDX_API_VERSION, IDX_RESPONSE_STORAGE_NAME, ID_TOKEN_STORAGE_KEY, INITIAL_AUTH_STATE, IdxFeature, IdxStatus, MAX_VERIFIER_LENGTH, MIN_VERIFIER_LENGTH, OAuthError, ORIGINAL_URI_STORAGE_NAME, OktaAuth, PKCE_STORAGE_NAME, REDIRECT_NONCE_COOKIE_NAME, REDIRECT_OAUTH_PARAMS_NAME, REDIRECT_STATE_COOKIE_NAME, REFERRER_PATH_STORAGE_KEY, REFRESH_TOKEN_STORAGE_KEY, SHARED_TRANSACTION_STORAGE_NAME, STATE_TOKEN_KEY_NAME, StorageManager, TOKEN_STORAGE_NAME, TRANSACTION_STORAGE_NAME, TokenManager, addListener, addPostMessageListener, addStateToken, assertPKCESupport, authenticate, bind, buildAuthorizeParams, canProceed, cancel, clearTransactionMeta, clone, convertTokenParamsToOAuthParams, createOAuthMeta, createTransactionMeta, crypto$1 as crypto, decodeToken, delay, deprecate, deprecateWrap, exchangeCodeForTokens, extend, find, genRandomString, generateNonce, generateState, getConsole, getDefaultTokenParams, getHashOrSearch, getKey, getLink, getNativeConsole, getOAuthBaseUrl, getOAuthDomain, getOAuthUrls, getPollFn, getSavedTransactionMeta, getStateToken, getToken, getTransactionMeta, getUserInfo, getWellKnown, getWithPopup, getWithRedirect, getWithoutPrompt, handleEmailVerifyCallback, handleInteractionCodeRedirect, handleOAuthResponse, hasAuthorizationCode, hasErrorInUrl, hasInteractionCode, hasSavedInteractionHandle, hasTokensInHash, interact, introspect, introspectAuthn, isAbsoluteUrl, isAccessToken, isAuthApiError, isAuthenticator, isAuthorizationCodeError, isCodeFlow, isCustomAuthTransactionMeta, isEmailVerifyCallback, isEmailVerifyCallbackError, isFunction, isIDToken, isIdxTransactionMeta, isInteractionRequired, isInteractionRequiredError, isLoginRedirect, isNumber, isOAuthTransactionMeta, isObject, isPKCETransactionMeta, isPromise, isRedirectUri, isRefreshToken, isRefreshTokenError, isSameRefreshToken, isString, isToken, isTransactionMeta, isTransactionMetaValid, isTransactionMetaValidForFlow, isTransactionMetaValidForOptions, isoToUTCString, loadFrame, loadPopup, omit, parseEmailVerifyCallback, parseFromUrl, PKCE as pkce, poll, postRefreshToken, postToTokenEndpoint, postToTransaction, preparePKCE, prepareTokenParams, proceed, recoverPassword, register, removeListener, removeNils, removeTrailingSlash, renewToken, renewTokens, renewTokensWithRefresh, resumeTransaction, revokeToken, saveTransactionMeta, startTransaction, toAbsoluteUrl, toQueryString, toRelativeUrl, transactionExists, transactionStatus, transactionStep, unlockAccount, urlParamsToObject, validateClaims, validateCodeChallengeMethod, validateToken, verifyToken, warn };
9176
9560
  //# sourceMappingURL=esm.browser.js.map