@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
package/esm/esm.node.mjs CHANGED
@@ -53,13 +53,13 @@ import PCancelable from 'p-cancelable';
53
53
  import _entriesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/entries';
54
54
  import crossFetch from 'cross-fetch';
55
55
  import NodeCache from 'node-cache';
56
- import _URL from '@babel/runtime-corejs3/core-js-stable/url';
57
56
  import _Object$fromEntries from '@babel/runtime-corejs3/core-js-stable/object/from-entries';
58
57
  import { JSONPath } from 'jsonpath-plus';
59
58
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
60
- import _get from '@babel/runtime-corejs3/helpers/get';
61
59
  import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
60
+ import _get from '@babel/runtime-corejs3/helpers/get';
62
61
  import _Number$isInteger from '@babel/runtime-corejs3/core-js-stable/number/is-integer';
62
+ import _URL2 from '@babel/runtime-corejs3/core-js-stable/url';
63
63
  import Emitter from 'tiny-emitter';
64
64
 
65
65
  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); }; }
@@ -1747,6 +1747,9 @@ var IdxFeature;
1747
1747
  IdxFeature["SOCIAL_IDP"] = "redirect-idp";
1748
1748
  IdxFeature["ACCOUNT_UNLOCK"] = "unlock-account";
1749
1749
  })(IdxFeature || (IdxFeature = {}));
1750
+ function isAuthenticator(obj) {
1751
+ return obj && (obj.key || obj.id);
1752
+ }
1750
1753
 
1751
1754
  function isToken(obj) {
1752
1755
  if (obj && (obj.accessToken || obj.idToken || obj.refreshToken) && Array.isArray(obj.scopes)) {
@@ -2685,16 +2688,16 @@ var storageUtil = {
2685
2688
  },
2686
2689
  browserHasLocalStorage: function browserHasLocalStorage() {
2687
2690
  try {
2688
- var storage = storageUtil.getLocalStorage();
2689
- return storageUtil.testStorage(storage);
2691
+ var storage = this.getLocalStorage();
2692
+ return this.testStorage(storage);
2690
2693
  } catch (e) {
2691
2694
  return false;
2692
2695
  }
2693
2696
  },
2694
2697
  browserHasSessionStorage: function browserHasSessionStorage() {
2695
2698
  try {
2696
- var storage = storageUtil.getSessionStorage();
2697
- return storageUtil.testStorage(storage);
2699
+ var storage = this.getSessionStorage();
2700
+ return this.testStorage(storage);
2698
2701
  } catch (e) {
2699
2702
  return false;
2700
2703
  }
@@ -2703,10 +2706,10 @@ var storageUtil = {
2703
2706
  var supported = false;
2704
2707
  switch (storageType) {
2705
2708
  case 'sessionStorage':
2706
- supported = storageUtil.browserHasSessionStorage();
2709
+ supported = this.browserHasSessionStorage();
2707
2710
  break;
2708
2711
  case 'localStorage':
2709
- supported = storageUtil.browserHasLocalStorage();
2712
+ supported = this.browserHasLocalStorage();
2710
2713
  break;
2711
2714
  case 'cookie':
2712
2715
  case 'memory':
@@ -2722,16 +2725,16 @@ var storageUtil = {
2722
2725
  var storageProvider;
2723
2726
  switch (storageType) {
2724
2727
  case 'sessionStorage':
2725
- storageProvider = storageUtil.getSessionStorage();
2728
+ storageProvider = this.getSessionStorage();
2726
2729
  break;
2727
2730
  case 'localStorage':
2728
- storageProvider = storageUtil.getLocalStorage();
2731
+ storageProvider = this.getLocalStorage();
2729
2732
  break;
2730
2733
  case 'cookie':
2731
- storageProvider = storageUtil.getCookieStorage(options);
2734
+ storageProvider = this.getCookieStorage(options);
2732
2735
  break;
2733
2736
  case 'memory':
2734
- storageProvider = storageUtil.getInMemoryStorage();
2737
+ storageProvider = this.getInMemoryStorage();
2735
2738
  break;
2736
2739
  default:
2737
2740
  throw new AuthSdkError("Unrecognized storage option: ".concat(storageType));
@@ -2748,11 +2751,11 @@ var storageUtil = {
2748
2751
  if (!nextType) {
2749
2752
  return curType;
2750
2753
  }
2751
- if (storageUtil.testStorageType(curType)) {
2754
+ if (this.testStorageType(curType)) {
2752
2755
  return curType;
2753
2756
  }
2754
2757
  warn(_concatInstanceProperty(_context = "This browser doesn't support ".concat(curType, ". Switching to ")).call(_context, nextType, "."));
2755
- return storageUtil.findStorageType(types);
2758
+ return this.findStorageType(types);
2756
2759
  },
2757
2760
  getLocalStorage: function getLocalStorage() {
2758
2761
  return localStorage;
@@ -2761,6 +2764,7 @@ var storageUtil = {
2761
2764
  return sessionStorage;
2762
2765
  },
2763
2766
  getCookieStorage: function getCookieStorage(options) {
2767
+ var _this = this;
2764
2768
  var secure = options.secure;
2765
2769
  var sameSite = options.sameSite;
2766
2770
  var sessionCookie = options.sessionCookie;
@@ -2768,17 +2772,17 @@ var storageUtil = {
2768
2772
  throw new AuthSdkError('getCookieStorage: "secure" and "sameSite" options must be provided');
2769
2773
  }
2770
2774
  var storage = {
2771
- getItem: storageUtil.storage.get,
2775
+ getItem: this.storage.get,
2772
2776
  setItem: function setItem(key, value) {
2773
2777
  var expiresAt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '2200-01-01T00:00:00.000Z';
2774
2778
  expiresAt = sessionCookie ? null : expiresAt;
2775
- storageUtil.storage.set(key, value, expiresAt, {
2779
+ _this.storage.set(key, value, expiresAt, {
2776
2780
  secure: secure,
2777
2781
  sameSite: sameSite
2778
2782
  });
2779
2783
  },
2780
2784
  removeItem: function removeItem(key) {
2781
- storageUtil.storage.delete(key);
2785
+ _this.storage.delete(key);
2782
2786
  }
2783
2787
  };
2784
2788
  if (!options.useSeparateCookies) {
@@ -2818,13 +2822,13 @@ var storageUtil = {
2818
2822
  },
2819
2823
  inMemoryStore: {},
2820
2824
  getInMemoryStorage: function getInMemoryStorage() {
2821
- var _this = this;
2825
+ var _this2 = this;
2822
2826
  return {
2823
2827
  getItem: function getItem(key) {
2824
- return _this.inMemoryStore[key];
2828
+ return _this2.inMemoryStore[key];
2825
2829
  },
2826
2830
  setItem: function setItem(key, value) {
2827
- _this.inMemoryStore[key] = value;
2831
+ _this2.inMemoryStore[key] = value;
2828
2832
  }
2829
2833
  };
2830
2834
  },
@@ -2854,7 +2858,7 @@ var storageUtil = {
2854
2858
  cookieOptions.expires = new Date(expiresAt);
2855
2859
  }
2856
2860
  Cookies.set(name, value, cookieOptions);
2857
- return storageUtil.storage.get(name);
2861
+ return this.get(name);
2858
2862
  },
2859
2863
  get: function get(name) {
2860
2864
  if (!arguments.length) {
@@ -3494,9 +3498,9 @@ var SyncStorageService = function () {
3494
3498
  return SyncStorageService;
3495
3499
  }();
3496
3500
 
3497
- 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; } } }; }
3498
- 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); }
3499
- 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; }
3501
+ 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; } } }; }
3502
+ 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); }
3503
+ 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; }
3500
3504
  var ServiceManager = function () {
3501
3505
  function ServiceManager(sdk) {
3502
3506
  var _this = this;
@@ -3581,7 +3585,7 @@ var ServiceManager = function () {
3581
3585
  key: "startServices",
3582
3586
  value: function startServices() {
3583
3587
  var _context2;
3584
- var _iterator = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context2 = this.services).call(_context2)),
3588
+ var _iterator = _createForOfIteratorHelper$7(_valuesInstanceProperty(_context2 = this.services).call(_context2)),
3585
3589
  _step;
3586
3590
  try {
3587
3591
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -3601,7 +3605,7 @@ var ServiceManager = function () {
3601
3605
  key: "stopServices",
3602
3606
  value: function stopServices() {
3603
3607
  var _context3;
3604
- var _iterator2 = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context3 = this.services).call(_context3)),
3608
+ var _iterator2 = _createForOfIteratorHelper$7(_valuesInstanceProperty(_context3 = this.services).call(_context3)),
3605
3609
  _step2;
3606
3610
  try {
3607
3611
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -3613,7 +3617,6 @@ var ServiceManager = function () {
3613
3617
  } finally {
3614
3618
  _iterator2.f();
3615
3619
  }
3616
- this.services = new _Map();
3617
3620
  }
3618
3621
  }, {
3619
3622
  key: "startElector",
@@ -3634,10 +3637,12 @@ var ServiceManager = function () {
3634
3637
  }, {
3635
3638
  key: "stopElector",
3636
3639
  value: function stopElector() {
3637
- var _a;
3640
+ var _a, _b;
3638
3641
  if (this.elector) {
3639
3642
  (_a = this.elector) === null || _a === void 0 ? void 0 : _a.die();
3640
3643
  this.elector = undefined;
3644
+ (_b = this.channel) === null || _b === void 0 ? void 0 : _b.close();
3645
+ this.channel = undefined;
3641
3646
  }
3642
3647
  }
3643
3648
  }, {
@@ -3674,9 +3679,13 @@ ServiceManager.defaultOptions = {
3674
3679
 
3675
3680
  var PromiseQueue = function () {
3676
3681
  function PromiseQueue() {
3682
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
3683
+ quiet: false
3684
+ };
3677
3685
  _classCallCheck(this, PromiseQueue);
3678
3686
  this.queue = [];
3679
3687
  this.running = false;
3688
+ this.options = options;
3680
3689
  }
3681
3690
  _createClass(PromiseQueue, [{
3682
3691
  key: "push",
@@ -3687,7 +3696,9 @@ var PromiseQueue = function () {
3687
3696
  }
3688
3697
  return new _Promise(function (resolve, reject) {
3689
3698
  if (_this.queue.length > 0) {
3690
- warn('Async method is being called but another async method is already running. ' + 'The new method will be delayed until the previous method completes.');
3699
+ if (_this.options.quiet !== false) {
3700
+ warn('Async method is being called but another async method is already running. ' + 'The new method will be delayed until the previous method completes.');
3701
+ }
3691
3702
  }
3692
3703
  _this.queue.push({
3693
3704
  method: method,
@@ -3800,6 +3811,9 @@ var AuthStateManager = function () {
3800
3811
  this._authState = INITIAL_AUTH_STATE;
3801
3812
  this._logOptions = {};
3802
3813
  this._prevAuthState = null;
3814
+ this._transformQueue = new PromiseQueue({
3815
+ quiet: true
3816
+ });
3803
3817
  sdk.tokenManager.on(EVENT_ADDED, function (key, token) {
3804
3818
  _this._setLogOptions({
3805
3819
  event: EVENT_ADDED,
@@ -3918,7 +3932,7 @@ var AuthStateManager = function () {
3918
3932
  refreshToken: refreshToken,
3919
3933
  isAuthenticated: !!(accessToken && idToken)
3920
3934
  };
3921
- var promise = transformAuthState ? transformAuthState(_this2._sdk, authState) : _Promise.resolve(authState);
3935
+ var promise = transformAuthState ? _this2._transformQueue.push(transformAuthState, null, _this2._sdk, authState) : _Promise.resolve(authState);
3922
3936
  promise.then(function (authState) {
3923
3937
  return emitAndResolve(authState);
3924
3938
  }).catch(function (error) {
@@ -4451,7 +4465,9 @@ var TransactionManager = function () {
4451
4465
  }
4452
4466
  }, {
4453
4467
  key: "saveIdxResponse",
4454
- value: function saveIdxResponse(idxResponse) {
4468
+ value: function saveIdxResponse(_ref) {
4469
+ var rawIdxResponse = _ref.rawIdxResponse,
4470
+ requestDidSucceed = _ref.requestDidSucceed;
4455
4471
  if (!this.saveLastResponse) {
4456
4472
  return;
4457
4473
  }
@@ -4459,7 +4475,10 @@ var TransactionManager = function () {
4459
4475
  if (!storage) {
4460
4476
  return;
4461
4477
  }
4462
- storage.setStorage(idxResponse);
4478
+ storage.setStorage({
4479
+ rawIdxResponse: rawIdxResponse,
4480
+ requestDidSucceed: requestDidSucceed
4481
+ });
4463
4482
  }
4464
4483
  }, {
4465
4484
  key: "loadIdxResponse",
@@ -4509,9 +4528,9 @@ function assertValidConfig(args) {
4509
4528
  }
4510
4529
  }
4511
4530
 
4512
- 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; } } }; }
4513
- 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); }
4514
- 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; }
4531
+ 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; } } }; }
4532
+ 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); }
4533
+ 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; }
4515
4534
  function readData(response) {
4516
4535
  var _context;
4517
4536
  if (response.headers.get('Content-Type') &&
@@ -4531,7 +4550,7 @@ function formatResult(status, data, response) {
4531
4550
  var _context2;
4532
4551
  var isObject = _typeof(data) === 'object';
4533
4552
  var headers = {};
4534
- var _iterator = _createForOfIteratorHelper$5(_entriesInstanceProperty(_context2 = response.headers).call(_context2)),
4553
+ var _iterator = _createForOfIteratorHelper$6(_entriesInstanceProperty(_context2 = response.headers).call(_context2)),
4535
4554
  _step;
4536
4555
  try {
4537
4556
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4670,9 +4689,26 @@ var ServerStorage = function () {
4670
4689
  }]);
4671
4690
  return ServerStorage;
4672
4691
  }();
4673
- var storage = new ServerStorage(sharedStorage);
4692
+ var serverStorage = new ServerStorage(sharedStorage);
4674
4693
 
4675
- var STORAGE_MANAGER_OPTIONS = {
4694
+ var BROWSER_STORAGE = {
4695
+ token: {
4696
+ storageTypes: ['localStorage', 'sessionStorage', 'cookie']
4697
+ },
4698
+ cache: {
4699
+ storageTypes: ['localStorage', 'sessionStorage', 'cookie']
4700
+ },
4701
+ transaction: {
4702
+ storageTypes: ['sessionStorage', 'localStorage', 'cookie']
4703
+ },
4704
+ 'shared-transaction': {
4705
+ storageTypes: ['localStorage']
4706
+ },
4707
+ 'original-uri': {
4708
+ storageTypes: ['localStorage']
4709
+ }
4710
+ };
4711
+ var SERVER_STORAGE = {
4676
4712
  token: {
4677
4713
  storageTypes: ['memory']
4678
4714
  },
@@ -4683,23 +4719,45 @@ var STORAGE_MANAGER_OPTIONS = {
4683
4719
  storageTypes: ['memory']
4684
4720
  }
4685
4721
  };
4686
- var enableSharedStorage = false;
4687
4722
  function getCookieSettings() {
4688
4723
  var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4689
- return args.cookies;
4724
+ var isHTTPS = arguments.length > 1 ? arguments[1] : undefined;
4725
+ var cookieSettings = args.cookies || {};
4726
+ if (typeof cookieSettings.secure === 'undefined') {
4727
+ cookieSettings.secure = isHTTPS;
4728
+ }
4729
+ if (typeof cookieSettings.sameSite === 'undefined') {
4730
+ cookieSettings.sameSite = cookieSettings.secure ? 'none' : 'lax';
4731
+ }
4732
+ if (cookieSettings.secure && !isHTTPS) {
4733
+ warn('The current page is not being served with the HTTPS protocol.\n' + 'For security reasons, we strongly recommend using HTTPS.\n' + 'If you cannot use HTTPS, set "cookies.secure" option to false.');
4734
+ cookieSettings.secure = false;
4735
+ }
4736
+ if (cookieSettings.sameSite === 'none' && !cookieSettings.secure) {
4737
+ cookieSettings.sameSite = 'lax';
4738
+ }
4739
+ return cookieSettings;
4690
4740
  }
4691
-
4692
4741
  function getDefaultOptions() {
4693
- var options = {
4742
+ var storageUtil$1;
4743
+ if (isBrowser()) {
4744
+ storageUtil$1 = _Object$assign({}, storageUtil, {
4745
+ inMemoryStore: {}
4746
+ });
4747
+ } else {
4748
+ storageUtil$1 = serverStorage;
4749
+ }
4750
+ var storageManager = isBrowser() ? BROWSER_STORAGE : SERVER_STORAGE;
4751
+ var enableSharedStorage = isBrowser() ? true : false;
4752
+ return {
4694
4753
  devMode: false,
4695
4754
  httpRequestClient: fetchRequest,
4696
- storageUtil: storage,
4697
- storageManager: STORAGE_MANAGER_OPTIONS,
4755
+ storageUtil: storageUtil$1,
4756
+ storageManager: storageManager,
4698
4757
  transactionManager: {
4699
4758
  enableSharedStorage: enableSharedStorage
4700
4759
  }
4701
4760
  };
4702
- return options;
4703
4761
  }
4704
4762
  function mergeOptions(options, args) {
4705
4763
  return _Object$assign({}, options, removeNils(args), {
@@ -4736,7 +4794,7 @@ function buildOptions() {
4736
4794
  devMode: !!args.devMode,
4737
4795
  storageManager: args.storageManager,
4738
4796
  transactionManager: args.transactionManager,
4739
- cookies: getCookieSettings(args, isHTTPS()),
4797
+ cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,
4740
4798
  flow: args.flow,
4741
4799
  codeChallenge: args.codeChallenge,
4742
4800
  codeChallengeMethod: args.codeChallengeMethod,
@@ -4807,9 +4865,9 @@ var request = function () {
4807
4865
  };
4808
4866
  }();
4809
4867
 
4810
- 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; } } }; }
4811
- 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); }
4812
- 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; }
4868
+ 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; } } }; }
4869
+ 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); }
4870
+ 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; }
4813
4871
  var isFieldMutable = function isFieldMutable(field) {
4814
4872
  return field.mutable !== false;
4815
4873
  };
@@ -4826,7 +4884,7 @@ var divideSingleActionParamsByMutability = function divideSingleActionParamsByMu
4826
4884
  immutableParamsForAction: immutableParamsForAction
4827
4885
  };
4828
4886
  }
4829
- var _iterator = _createForOfIteratorHelper$4(action.value),
4887
+ var _iterator = _createForOfIteratorHelper$5(action.value),
4830
4888
  _step;
4831
4889
  try {
4832
4890
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4856,7 +4914,7 @@ var divideActionParamsByMutability = function divideActionParamsByMutability(act
4856
4914
  var neededParams = [];
4857
4915
  var defaultParams = {};
4858
4916
  var immutableParams = {};
4859
- var _iterator2 = _createForOfIteratorHelper$4(actionList),
4917
+ var _iterator2 = _createForOfIteratorHelper$5(actionList),
4860
4918
  _step2;
4861
4919
  try {
4862
4920
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -4891,7 +4949,7 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4891
4949
  var target = actionDefinition.href;
4892
4950
  return function () {
4893
4951
  var _ref2 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(params) {
4894
- var headers, body, credentials;
4952
+ var headers, body, credentials, response, responseJSON, requestDidSucceed, idxResponse;
4895
4953
  return _regeneratorRuntime.wrap(function _callee$(_context) {
4896
4954
  while (1) {
4897
4955
  switch (_context.prev = _context.next) {
@@ -4902,29 +4960,32 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4902
4960
  };
4903
4961
  body = _JSON$stringify(_Object$assign(_Object$assign(_Object$assign({}, defaultParamsForAction), params), immutableParamsForAction));
4904
4962
  credentials = toPersist && toPersist.withCredentials === false ? 'omit' : 'include';
4905
- return _context.abrupt("return", request(target, {
4963
+ _context.next = 5;
4964
+ return request(target, {
4906
4965
  method: actionDefinition.method,
4907
4966
  headers: headers,
4908
4967
  body: body,
4909
4968
  credentials: credentials
4910
- }).then(function (response) {
4911
- var respJson = response.json();
4912
- if (response.ok) {
4913
- return respJson;
4914
- } else if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm="Okta Device"') {
4915
- return respJson.then(function (err) {
4916
- var ms = makeIdxState$1(err, toPersist);
4917
- ms.stepUp = true;
4918
- return _Promise.reject(ms);
4919
- });
4920
- }
4921
- return respJson.then(function (err) {
4922
- return _Promise.reject(makeIdxState$1(err, toPersist));
4923
- });
4924
- }).then(function (idxResponse) {
4925
- return makeIdxState$1(idxResponse, toPersist);
4926
- }));
4927
- case 4:
4969
+ });
4970
+ case 5:
4971
+ response = _context.sent;
4972
+ _context.next = 8;
4973
+ return response.json();
4974
+ case 8:
4975
+ responseJSON = _context.sent;
4976
+ requestDidSucceed = response.ok;
4977
+ idxResponse = makeIdxState$1(responseJSON, toPersist, requestDidSucceed);
4978
+ if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm="Okta Device"') {
4979
+ idxResponse.stepUp = true;
4980
+ }
4981
+ if (requestDidSucceed) {
4982
+ _context.next = 14;
4983
+ break;
4984
+ }
4985
+ throw idxResponse;
4986
+ case 14:
4987
+ return _context.abrupt("return", idxResponse);
4988
+ case 15:
4928
4989
  case "end":
4929
4990
  return _context.stop();
4930
4991
  }
@@ -5059,9 +5120,8 @@ var parseIdxResponse = function parseIdxResponse(idxResponse) {
5059
5120
  };
5060
5121
  };
5061
5122
 
5062
- function makeIdxState$1(idxResponse, toPersist) {
5063
- var _context2;
5064
- var _a;
5123
+ function makeIdxState$1(idxResponse, toPersist, requestDidSucceed) {
5124
+ var _a, _b, _c;
5065
5125
  var rawIdxResponse = idxResponse;
5066
5126
  var _parseIdxResponse = parseIdxResponse(idxResponse, toPersist),
5067
5127
  remediations = _parseIdxResponse.remediations,
@@ -5102,7 +5162,7 @@ function makeIdxState$1(idxResponse, toPersist) {
5102
5162
  var findCode = function findCode(item) {
5103
5163
  return item.name === 'interaction_code';
5104
5164
  };
5105
- var interactionCode = (_a = rawIdxResponse.successWithInteractionCode) === null || _a === void 0 ? void 0 : _findInstanceProperty(_context2 = _a.value).call(_context2, findCode).value;
5165
+ 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;
5106
5166
  return {
5107
5167
  proceed: proceed,
5108
5168
  neededToProceed: neededToProceed,
@@ -5110,7 +5170,8 @@ function makeIdxState$1(idxResponse, toPersist) {
5110
5170
  context: context,
5111
5171
  rawIdxState: rawIdxResponse,
5112
5172
  interactionCode: interactionCode,
5113
- toPersist: toPersist
5173
+ toPersist: toPersist,
5174
+ requestDidSucceed: requestDidSucceed
5114
5175
  };
5115
5176
  }
5116
5177
 
@@ -5141,14 +5202,9 @@ function validateVersionConfig(version) {
5141
5202
  parsersForVersion(version);
5142
5203
  }
5143
5204
 
5144
- var parseAndReject$1 = function parseAndReject(response) {
5145
- return response.json().then(function (err) {
5146
- return _Promise.reject(err);
5147
- });
5148
- };
5149
5205
  var introspect$1 = function () {
5150
5206
  var _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
5151
- var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials;
5207
+ var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials, response, requestDidSucceed, rawIdxResponse;
5152
5208
  return _regeneratorRuntime.wrap(function _callee$(_context) {
5153
5209
  while (1) {
5154
5210
  switch (_context.prev = _context.next) {
@@ -5166,14 +5222,27 @@ var introspect$1 = function () {
5166
5222
  accept: "application/ion+json; okta-version=".concat(version)
5167
5223
  };
5168
5224
  credentials = withCredentials === false ? 'omit' : 'include';
5169
- return _context.abrupt("return", request(target, {
5225
+ _context.next = 8;
5226
+ return request(target, {
5170
5227
  credentials: credentials,
5171
5228
  headers: headers,
5172
5229
  body: _JSON$stringify(body)
5173
- }).then(function (response) {
5174
- return response.ok ? response.json() : parseAndReject$1(response);
5175
- }));
5176
- case 7:
5230
+ });
5231
+ case 8:
5232
+ response = _context.sent;
5233
+ requestDidSucceed = response.ok;
5234
+ _context.next = 12;
5235
+ return response.json();
5236
+ case 12:
5237
+ rawIdxResponse = _context.sent;
5238
+ if (requestDidSucceed) {
5239
+ _context.next = 15;
5240
+ break;
5241
+ }
5242
+ throw rawIdxResponse;
5243
+ case 15:
5244
+ return _context.abrupt("return", rawIdxResponse);
5245
+ case 16:
5177
5246
  case "end":
5178
5247
  return _context.stop();
5179
5248
  }
@@ -5252,131 +5321,9 @@ var interact$1 = function () {
5252
5321
  }();
5253
5322
 
5254
5323
  var LATEST_SUPPORTED_IDX_API_VERSION = '1.0.0';
5255
- var start = function () {
5256
- var _start = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
5257
- var withCredentials, clientId, domain, issuer, stateHandle, interactionHandle, version, redirectUri, state, scopes, codeChallenge, codeChallengeMethod, activationToken, recoveryToken, baseUrl, toPersist, interactParams, interaction_handle, _parsersForVersion, _makeIdxState, idxResponse, idxState;
5258
- return _regeneratorRuntime.wrap(function _callee$(_context) {
5259
- while (1) {
5260
- switch (_context.prev = _context.next) {
5261
- case 0:
5262
- 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;
5263
- issuer = issuer === null || issuer === void 0 ? void 0 : issuer.replace(/\/+$/, '');
5264
- baseUrl = (issuer === null || issuer === void 0 ? void 0 : _indexOfInstanceProperty(issuer).call(issuer, '/oauth2')) > 0 ? issuer : issuer + '/oauth2';
5265
- toPersist = {
5266
- baseUrl: baseUrl,
5267
- clientId: clientId,
5268
- state: state,
5269
- withCredentials: withCredentials
5270
- };
5271
- if (!(!domain && !issuer)) {
5272
- _context.next = 6;
5273
- break;
5274
- }
5275
- return _context.abrupt("return", _Promise.reject({
5276
- error: 'issuer is required'
5277
- }));
5278
- case 6:
5279
- if (!(!stateHandle && !clientId)) {
5280
- _context.next = 8;
5281
- break;
5282
- }
5283
- return _context.abrupt("return", _Promise.reject({
5284
- error: 'clientId is required'
5285
- }));
5286
- case 8:
5287
- if (!(!stateHandle && !redirectUri)) {
5288
- _context.next = 10;
5289
- break;
5290
- }
5291
- return _context.abrupt("return", _Promise.reject({
5292
- error: 'redirectUri is required'
5293
- }));
5294
- case 10:
5295
- if (!(!stateHandle && !(codeChallenge && codeChallengeMethod))) {
5296
- _context.next = 12;
5297
- break;
5298
- }
5299
- return _context.abrupt("return", _Promise.reject({
5300
- error: 'PKCE params (codeChallenge, codeChallengeMethod) are required'
5301
- }));
5302
- case 12:
5303
- if (!domain) {
5304
- domain = new _URL(issuer).origin;
5305
- }
5306
- validateVersionConfig(version);
5307
- if (!(!stateHandle && !interactionHandle)) {
5308
- _context.next = 27;
5309
- break;
5310
- }
5311
- _context.prev = 15;
5312
- interactParams = {
5313
- withCredentials: withCredentials,
5314
- clientId: clientId,
5315
- baseUrl: baseUrl,
5316
- scopes: scopes,
5317
- redirectUri: redirectUri,
5318
- codeChallenge: codeChallenge,
5319
- codeChallengeMethod: codeChallengeMethod,
5320
- state: state,
5321
- activationToken: activationToken,
5322
- recoveryToken: recoveryToken
5323
- };
5324
- _context.next = 19;
5325
- return interact$1(interactParams);
5326
- case 19:
5327
- interaction_handle = _context.sent;
5328
- interactionHandle = interaction_handle;
5329
- toPersist.interactionHandle = interactionHandle;
5330
- _context.next = 27;
5331
- break;
5332
- case 24:
5333
- _context.prev = 24;
5334
- _context.t0 = _context["catch"](15);
5335
- return _context.abrupt("return", _Promise.reject({
5336
- error: _context.t0
5337
- }));
5338
- case 27:
5339
- _context.prev = 27;
5340
- _parsersForVersion = parsersForVersion(version), _makeIdxState = _parsersForVersion.makeIdxState;
5341
- _context.next = 31;
5342
- return introspect$1({
5343
- withCredentials: withCredentials,
5344
- domain: domain,
5345
- interactionHandle: interactionHandle,
5346
- stateHandle: stateHandle,
5347
- version: version
5348
- }).catch(function (err) {
5349
- return _Promise.reject({
5350
- error: 'introspect call failed',
5351
- details: _makeIdxState(err, toPersist)
5352
- });
5353
- });
5354
- case 31:
5355
- idxResponse = _context.sent;
5356
- idxState = _makeIdxState(idxResponse, toPersist);
5357
- return _context.abrupt("return", idxState);
5358
- case 36:
5359
- _context.prev = 36;
5360
- _context.t1 = _context["catch"](27);
5361
- return _context.abrupt("return", _Promise.reject({
5362
- error: _context.t1
5363
- }));
5364
- case 39:
5365
- case "end":
5366
- return _context.stop();
5367
- }
5368
- }
5369
- }, _callee, null, [[15, 24], [27, 36]]);
5370
- }));
5371
- function start(_x) {
5372
- return _start.apply(this, arguments);
5373
- }
5374
- return start;
5375
- }();
5376
- var _parsersForVersion2 = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION),
5377
- makeIdxState = _parsersForVersion2.makeIdxState;
5324
+ var _parsersForVersion = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION),
5325
+ makeIdxState = _parsersForVersion.makeIdxState;
5378
5326
  var idx = {
5379
- start: start,
5380
5327
  introspect: introspect$1,
5381
5328
  interact: interact$1,
5382
5329
  makeIdxState: makeIdxState,
@@ -5613,6 +5560,8 @@ function _introspect() {
5613
5560
  _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
5614
5561
  var options,
5615
5562
  rawIdxResponse,
5563
+ requestDidSucceed,
5564
+ savedIdxResponse,
5616
5565
  version,
5617
5566
  domain,
5618
5567
  withCredentials,
@@ -5622,47 +5571,53 @@ function _introspect() {
5622
5571
  switch (_context.prev = _context.next) {
5623
5572
  case 0:
5624
5573
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5625
- rawIdxResponse = authClient.transactionManager.loadIdxResponse();
5574
+ savedIdxResponse = authClient.transactionManager.loadIdxResponse();
5575
+ if (savedIdxResponse) {
5576
+ rawIdxResponse = savedIdxResponse.rawIdxResponse;
5577
+ requestDidSucceed = savedIdxResponse.requestDidSucceed;
5578
+ }
5626
5579
  if (rawIdxResponse) {
5627
- _context.next = 18;
5580
+ _context.next = 21;
5628
5581
  break;
5629
5582
  }
5630
5583
  version = options.version || IDX_API_VERSION;
5631
5584
  domain = getOAuthDomain(authClient);
5632
- _context.prev = 5;
5633
- _context.next = 8;
5585
+ _context.prev = 6;
5586
+ _context.next = 9;
5634
5587
  return idx.introspect(_Object$assign(_Object$assign({
5635
5588
  domain: domain
5636
5589
  }, options), {
5637
5590
  version: version
5638
5591
  }));
5639
- case 8:
5592
+ case 9:
5640
5593
  rawIdxResponse = _context.sent;
5641
- _context.next = 18;
5594
+ requestDidSucceed = true;
5595
+ _context.next = 21;
5642
5596
  break;
5643
- case 11:
5644
- _context.prev = 11;
5645
- _context.t0 = _context["catch"](5);
5597
+ case 13:
5598
+ _context.prev = 13;
5599
+ _context.t0 = _context["catch"](6);
5646
5600
  if (!isRawIdxResponse(_context.t0)) {
5647
- _context.next = 17;
5601
+ _context.next = 20;
5648
5602
  break;
5649
5603
  }
5650
5604
  rawIdxResponse = _context.t0;
5651
- _context.next = 18;
5605
+ requestDidSucceed = false;
5606
+ _context.next = 21;
5652
5607
  break;
5653
- case 17:
5608
+ case 20:
5654
5609
  throw _context.t0;
5655
- case 18:
5610
+ case 21:
5656
5611
  withCredentials = options.withCredentials;
5657
5612
  return _context.abrupt("return", idx.makeIdxState(rawIdxResponse, {
5658
5613
  withCredentials: withCredentials
5659
- }));
5660
- case 20:
5614
+ }, requestDidSucceed));
5615
+ case 23:
5661
5616
  case "end":
5662
5617
  return _context.stop();
5663
5618
  }
5664
5619
  }
5665
- }, _callee, null, [[5, 11]]);
5620
+ }, _callee, null, [[6, 13]]);
5666
5621
  }));
5667
5622
  return _introspect.apply(this, arguments);
5668
5623
  }
@@ -5693,42 +5648,91 @@ function getAuthenticatorFromRemediation(remediation) {
5693
5648
  });
5694
5649
  }
5695
5650
 
5651
+ 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; } } }; }
5652
+ 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); }
5653
+ 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; }
5654
+ function formatAuthenticator(incoming) {
5655
+ var authenticator;
5656
+ if (isAuthenticator(incoming)) {
5657
+ authenticator = incoming;
5658
+ } else if (typeof incoming === 'string') {
5659
+ authenticator = {
5660
+ key: incoming
5661
+ };
5662
+ } else {
5663
+ throw new Error('Invalid format for authenticator');
5664
+ }
5665
+ return authenticator;
5666
+ }
5667
+ function compareAuthenticators(auth1, auth2) {
5668
+ if (!auth1 || !auth2) {
5669
+ return false;
5670
+ }
5671
+ if (auth1.id && auth2.id) {
5672
+ return auth1.id === auth2.id;
5673
+ }
5674
+ if (auth1.key && auth2.key) {
5675
+ return auth1.key === auth2.key;
5676
+ }
5677
+ return false;
5678
+ }
5679
+ function findMatchedOption(authenticators, options) {
5680
+ var option;
5681
+ var _iterator = _createForOfIteratorHelper$4(authenticators),
5682
+ _step;
5683
+ try {
5684
+ var _loop = function _loop() {
5685
+ var authenticator = _step.value;
5686
+ option = _findInstanceProperty(options).call(options, function (_ref) {
5687
+ var relatesTo = _ref.relatesTo;
5688
+ return relatesTo.key === authenticator.key;
5689
+ });
5690
+ if (option) {
5691
+ return "break";
5692
+ }
5693
+ };
5694
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5695
+ var _ret = _loop();
5696
+ if (_ret === "break") break;
5697
+ }
5698
+ } catch (err) {
5699
+ _iterator.e(err);
5700
+ } finally {
5701
+ _iterator.f();
5702
+ }
5703
+ return option;
5704
+ }
5705
+
5696
5706
  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; } } }; }
5697
- 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); }
5707
+ 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); }
5698
5708
  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; }
5699
5709
  var Remediator = function () {
5700
5710
  function Remediator(remediation) {
5701
5711
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5712
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5702
5713
  _classCallCheck(this, Remediator);
5703
5714
  this.values = _Object$assign({}, values);
5715
+ this.options = _Object$assign({}, options);
5704
5716
  this.formatAuthenticators();
5705
5717
  this.remediation = remediation;
5706
5718
  }
5707
5719
  _createClass(Remediator, [{
5708
5720
  key: "formatAuthenticators",
5709
5721
  value: function formatAuthenticators() {
5710
- var _this = this,
5711
- _context2,
5712
- _context3;
5722
+ var _context2, _context3;
5713
5723
  _valuesInstanceProperty(this).authenticators = _valuesInstanceProperty(this).authenticators || [];
5724
+ _valuesInstanceProperty(this).authenticators = _mapInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticators).call(_context2, function (authenticator) {
5725
+ return formatAuthenticator(authenticator);
5726
+ });
5714
5727
  if (_valuesInstanceProperty(this).authenticator) {
5715
- var hasAuthenticatorInList = _valuesInstanceProperty(this).authenticators.some(function (authenticator) {
5716
- if (typeof authenticator === 'string') {
5717
- return authenticator === _valuesInstanceProperty(_this).authenticator;
5718
- }
5719
- return authenticator.key === _valuesInstanceProperty(_this).authenticator;
5728
+ var authenticator = formatAuthenticator(_valuesInstanceProperty(this).authenticator);
5729
+ var hasAuthenticatorInList = _valuesInstanceProperty(this).authenticators.some(function (existing) {
5730
+ return compareAuthenticators(authenticator, existing);
5720
5731
  });
5721
5732
  if (!hasAuthenticatorInList) {
5722
- _valuesInstanceProperty(this).authenticators.push({
5723
- key: _valuesInstanceProperty(this).authenticator
5724
- });
5733
+ _valuesInstanceProperty(this).authenticators.push(authenticator);
5725
5734
  }
5726
5735
  }
5727
- _valuesInstanceProperty(this).authenticators = _mapInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticators).call(_context2, function (authenticator) {
5728
- return typeof authenticator === 'string' ? {
5729
- key: authenticator
5730
- } : authenticator;
5731
- });
5732
5736
  _valuesInstanceProperty(this).authenticatorsData = _reduceInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (acc, authenticator) {
5733
5737
  if (_typeof(authenticator) === 'object' && _Object$keys(authenticator).length > 1) {
5734
5738
  acc.push(authenticator);
@@ -5744,13 +5748,10 @@ var Remediator = function () {
5744
5748
  }, {
5745
5749
  key: "canRemediate",
5746
5750
  value: function canRemediate() {
5747
- var _this2 = this;
5748
- if (!_mapInstanceProperty(this)) {
5749
- return false;
5750
- }
5751
+ var _this = this;
5751
5752
  var required = getRequiredValues(this.remediation);
5752
5753
  var needed = _findInstanceProperty(required).call(required, function (key) {
5753
- return !_this2.hasData(key);
5754
+ return !_this.hasData(key);
5754
5755
  });
5755
5756
  if (needed) {
5756
5757
  return false;
@@ -5760,48 +5761,41 @@ var Remediator = function () {
5760
5761
  }, {
5761
5762
  key: "getData",
5762
5763
  value: function getData(key) {
5763
- var _this3 = this;
5764
+ var _this2 = this;
5764
5765
  if (!key) {
5765
5766
  var allValues = getAllValues(this.remediation);
5766
5767
  var res = _reduceInstanceProperty(allValues).call(allValues, function (data, key) {
5767
- data[key] = _this3.getData(key);
5768
+ data[key] = _this2.getData(key);
5768
5769
  return data;
5769
5770
  }, {});
5770
5771
  return res;
5771
5772
  }
5772
5773
  if (typeof this["map".concat(titleCase(key))] === 'function') {
5773
5774
  var _context4;
5774
- return this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5775
+ var val = this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5775
5776
  var name = _ref.name;
5776
5777
  return name === key;
5777
5778
  }));
5778
- }
5779
- if (!_mapInstanceProperty(this)) {
5780
- return _valuesInstanceProperty(this)[key];
5781
- }
5782
- var entry = _mapInstanceProperty(this)[key];
5783
- if (!entry) {
5784
- return _valuesInstanceProperty(this)[key];
5785
- }
5786
- for (var i = 0; i < entry.length; i++) {
5787
- var val = _valuesInstanceProperty(this)[entry[i]];
5788
5779
  if (val) {
5789
5780
  return val;
5790
5781
  }
5791
5782
  }
5783
+ if (_mapInstanceProperty(this) && _mapInstanceProperty(this)[key]) {
5784
+ var entry = _mapInstanceProperty(this)[key];
5785
+ for (var i = 0; i < entry.length; i++) {
5786
+ var _val = _valuesInstanceProperty(this)[entry[i]];
5787
+ if (_val) {
5788
+ return _val;
5789
+ }
5790
+ }
5791
+ }
5792
+ return _valuesInstanceProperty(this)[key];
5792
5793
  }
5793
5794
  }, {
5794
5795
  key: "hasData",
5795
5796
  value: function hasData(key
5796
5797
  ) {
5797
- var data = this.getData(key);
5798
- if (_typeof(data) === 'object') {
5799
- var _context5;
5800
- return !!_findInstanceProperty(_context5 = _Object$keys(data)).call(_context5, function (key) {
5801
- return !!data[key];
5802
- });
5803
- }
5804
- return !!data;
5798
+ return !!this.getData(key);
5805
5799
  }
5806
5800
  }, {
5807
5801
  key: "getNextStep",
@@ -5822,43 +5816,38 @@ var Remediator = function () {
5822
5816
  }, {
5823
5817
  key: "getInputs",
5824
5818
  value: function getInputs() {
5825
- var _context6,
5826
- _this4 = this;
5827
- if (!_mapInstanceProperty(this)) {
5828
- return [];
5829
- }
5830
- return _reduceInstanceProperty(_context6 = _Object$keys(_mapInstanceProperty(this))).call(_context6, function (inputs, key) {
5831
- var _context7;
5832
- var inputFromRemediation = _findInstanceProperty(_context7 = _this4.remediation.value).call(_context7, function (item) {
5833
- return item.name === key;
5834
- });
5835
- if (!inputFromRemediation) {
5836
- return inputs;
5837
- }
5819
+ var _this3 = this;
5820
+ var inputs = [];
5821
+ var inputsFromRemediation = this.remediation.value || [];
5822
+ inputsFromRemediation.forEach(function (inputFromRemediation) {
5838
5823
  var input;
5839
- var aliases = _mapInstanceProperty(_this4)[key];
5840
- var type = inputFromRemediation.type;
5841
- if (typeof _this4["getInput".concat(titleCase(key))] === 'function') {
5842
- input = _this4["getInput".concat(titleCase(key))](inputFromRemediation);
5824
+ var name = inputFromRemediation.name,
5825
+ type = inputFromRemediation.type,
5826
+ visible = inputFromRemediation.visible;
5827
+ if (visible === false) {
5828
+ return;
5829
+ }
5830
+ if (typeof _this3["getInput".concat(titleCase(name))] === 'function') {
5831
+ input = _this3["getInput".concat(titleCase(name))](inputFromRemediation);
5843
5832
  } else if (type !== 'object') {
5844
- var name;
5833
+ var alias;
5834
+ var aliases = (_mapInstanceProperty(_this3) ? _mapInstanceProperty(_this3)[name] : null) || [];
5845
5835
  if (aliases.length === 1) {
5846
- name = aliases[0];
5836
+ alias = aliases[0];
5847
5837
  } else {
5848
- name = _findInstanceProperty(aliases).call(aliases, function (name) {
5849
- var _context8;
5850
- return _includesInstanceProperty(_context8 = _Object$keys(_valuesInstanceProperty(_this4))).call(_context8, name);
5838
+ alias = _findInstanceProperty(aliases).call(aliases, function (name) {
5839
+ var _context5;
5840
+ return _includesInstanceProperty(_context5 = _Object$keys(_valuesInstanceProperty(_this3))).call(_context5, name);
5851
5841
  });
5852
5842
  }
5853
- if (name) {
5843
+ if (alias) {
5854
5844
  input = _Object$assign(_Object$assign({}, inputFromRemediation), {
5855
- name: name
5845
+ name: alias
5856
5846
  });
5857
5847
  }
5858
5848
  }
5859
5849
  if (!input) {
5860
- var _context9;
5861
- throw new AuthSdkError(_concatInstanceProperty(_context9 = "Missing custom getInput".concat(titleCase(key), " method in Remediator: ")).call(_context9, _this4.getName()));
5850
+ input = inputFromRemediation;
5862
5851
  }
5863
5852
  if (Array.isArray(input)) {
5864
5853
  input.forEach(function (i) {
@@ -5867,8 +5856,8 @@ var Remediator = function () {
5867
5856
  } else {
5868
5857
  inputs.push(input);
5869
5858
  }
5870
- return inputs;
5871
- }, []);
5859
+ });
5860
+ return inputs;
5872
5861
  }
5873
5862
  }, {
5874
5863
  key: "getValuesAfterProceed",
@@ -5892,21 +5881,41 @@ var Remediator = function () {
5892
5881
  }, {
5893
5882
  key: "getAuthenticator",
5894
5883
  value: function getAuthenticator() {
5895
- var _a;
5896
- return (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5884
+ var _context6, _context7;
5885
+ var _a, _b;
5886
+ var relatesTo = (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5887
+ if (!relatesTo) {
5888
+ return;
5889
+ }
5890
+ var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
5891
+ if (!authenticatorFromRemediation) {
5892
+ return relatesTo;
5893
+ }
5894
+ var id = _findInstanceProperty(_context6 = authenticatorFromRemediation.form.value).call(_context6, function (_ref2) {
5895
+ var name = _ref2.name;
5896
+ return name === 'id';
5897
+ }).value;
5898
+ var enrollmentId = (_b = _findInstanceProperty(_context7 = authenticatorFromRemediation.form.value).call(_context7, function (_ref3) {
5899
+ var name = _ref3.name;
5900
+ return name === 'enrollmentId';
5901
+ })) === null || _b === void 0 ? void 0 : _b.value;
5902
+ return _Object$assign(_Object$assign({}, relatesTo), {
5903
+ id: id,
5904
+ enrollmentId: enrollmentId
5905
+ });
5897
5906
  }
5898
5907
  }], [{
5899
5908
  key: "getMessages",
5900
5909
  value: function getMessages(remediation) {
5901
- var _context10;
5910
+ var _context8;
5902
5911
  var _a, _b;
5903
5912
  if (!remediation.value) {
5904
5913
  return;
5905
5914
  }
5906
- 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) {
5915
+ 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) {
5907
5916
  if (field.messages) {
5908
- var _context11;
5909
- messages = _concatInstanceProperty(_context11 = []).call(_context11, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5917
+ var _context9;
5918
+ messages = _concatInstanceProperty(_context9 = []).call(_context9, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5910
5919
  }
5911
5920
  return messages;
5912
5921
  }, []);
@@ -5932,13 +5941,19 @@ var VerificationCodeAuthenticator = function (_Authenticator) {
5932
5941
  _createClass(VerificationCodeAuthenticator, [{
5933
5942
  key: "canVerify",
5934
5943
  value: function canVerify(values) {
5935
- return !!(values.verificationCode || values.otp);
5944
+ return !!(values.credentials || values.verificationCode || values.otp);
5936
5945
  }
5937
5946
  }, {
5938
5947
  key: "mapCredentials",
5939
5948
  value: function mapCredentials(values) {
5940
- return {
5941
- passcode: values.verificationCode || values.otp
5949
+ var credentials = values.credentials,
5950
+ verificationCode = values.verificationCode,
5951
+ otp = values.otp;
5952
+ if (!credentials && !verificationCode && !otp) {
5953
+ return;
5954
+ }
5955
+ return credentials || {
5956
+ passcode: verificationCode || otp
5942
5957
  };
5943
5958
  }
5944
5959
  }, {
@@ -5967,8 +5982,12 @@ var OktaVerifyTotp = function (_VerificationCodeAuth) {
5967
5982
  _createClass(OktaVerifyTotp, [{
5968
5983
  key: "mapCredentials",
5969
5984
  value: function mapCredentials(values) {
5985
+ var verificationCode = values.verificationCode;
5986
+ if (!verificationCode) {
5987
+ return;
5988
+ }
5970
5989
  return {
5971
- totp: values.verificationCode
5990
+ totp: verificationCode
5972
5991
  };
5973
5992
  }
5974
5993
  }]);
@@ -5987,13 +6006,18 @@ var OktaPassword = function (_Authenticator) {
5987
6006
  _createClass(OktaPassword, [{
5988
6007
  key: "canVerify",
5989
6008
  value: function canVerify(values) {
5990
- return !!values.password;
6009
+ return !!(values.credentials || values.password);
5991
6010
  }
5992
6011
  }, {
5993
6012
  key: "mapCredentials",
5994
6013
  value: function mapCredentials(values) {
5995
- return {
5996
- passcode: values.password
6014
+ var credentials = values.credentials,
6015
+ password = values.password;
6016
+ if (!credentials && !password) {
6017
+ return;
6018
+ }
6019
+ return credentials || {
6020
+ passcode: password
5997
6021
  };
5998
6022
  }
5999
6023
  }, {
@@ -6022,6 +6046,10 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6022
6046
  _createClass(SecurityQuestionEnrollment, [{
6023
6047
  key: "canVerify",
6024
6048
  value: function canVerify(values) {
6049
+ var credentials = values.credentials;
6050
+ if (credentials && credentials.questionKey && credentials.answer) {
6051
+ return true;
6052
+ }
6025
6053
  var questionKey = values.questionKey,
6026
6054
  question = values.question,
6027
6055
  answer = values.answer;
@@ -6033,6 +6061,9 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6033
6061
  var questionKey = values.questionKey,
6034
6062
  question = values.question,
6035
6063
  answer = values.answer;
6064
+ if (!questionKey && !question && !answer) {
6065
+ return;
6066
+ }
6036
6067
  return {
6037
6068
  questionKey: question ? 'custom' : questionKey,
6038
6069
  question: question,
@@ -6045,7 +6076,7 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6045
6076
  return [{
6046
6077
  name: 'questionKey',
6047
6078
  type: 'string',
6048
- require: true
6079
+ required: true
6049
6080
  }, {
6050
6081
  name: 'question',
6051
6082
  type: 'string',
@@ -6078,9 +6109,13 @@ var SecurityQuestionVerification = function (_Authenticator) {
6078
6109
  }, {
6079
6110
  key: "mapCredentials",
6080
6111
  value: function mapCredentials(values) {
6112
+ var answer = values.answer;
6113
+ if (!answer) {
6114
+ return;
6115
+ }
6081
6116
  return {
6082
6117
  questionKey: this.meta.contextualData.enrolledQuestion.questionKey,
6083
- answer: values.answer
6118
+ answer: answer
6084
6119
  };
6085
6120
  }
6086
6121
  }, {
@@ -6118,6 +6153,9 @@ var WebauthnEnrollment = function (_Authenticator) {
6118
6153
  value: function mapCredentials(values) {
6119
6154
  var clientData = values.clientData,
6120
6155
  attestation = values.attestation;
6156
+ if (!clientData && !attestation) {
6157
+ return;
6158
+ }
6121
6159
  return {
6122
6160
  clientData: clientData,
6123
6161
  attestation: attestation
@@ -6167,6 +6205,9 @@ var WebauthnVerification = function (_Authenticator) {
6167
6205
  var authenticatorData = values.authenticatorData,
6168
6206
  clientData = values.clientData,
6169
6207
  signatureData = values.signatureData;
6208
+ if (!authenticatorData && !clientData && !signatureData) {
6209
+ return;
6210
+ }
6170
6211
  return {
6171
6212
  authenticatorData: authenticatorData,
6172
6213
  clientData: clientData,
@@ -6236,9 +6277,6 @@ var VerifyAuthenticator = function (_Remediator) {
6236
6277
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6237
6278
  _classCallCheck(this, VerifyAuthenticator);
6238
6279
  _this = _super.call(this, remediation, values);
6239
- _this.map = {
6240
- 'credentials': []
6241
- };
6242
6280
  _this.authenticator = getAuthenticator(remediation);
6243
6281
  return _this;
6244
6282
  }
@@ -6267,6 +6305,19 @@ var VerifyAuthenticator = function (_Remediator) {
6267
6305
  value: function getInputCredentials(input) {
6268
6306
  return this.authenticator.getInputs(input);
6269
6307
  }
6308
+ }, {
6309
+ key: "getValuesAfterProceed",
6310
+ value: function getValuesAfterProceed() {
6311
+ var _context,
6312
+ _this2 = this;
6313
+ this.values = _get(_getPrototypeOf(VerifyAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6314
+ var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6315
+ return valueKey !== 'credentials';
6316
+ });
6317
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6318
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6319
+ }, {});
6320
+ }
6270
6321
  }]);
6271
6322
  return VerifyAuthenticator;
6272
6323
  }(Remediator);
@@ -6296,7 +6347,7 @@ var EnrollPoll = function (_Remediator) {
6296
6347
  _createClass(EnrollPoll, [{
6297
6348
  key: "canRemediate",
6298
6349
  value: function canRemediate() {
6299
- return Boolean(_valuesInstanceProperty(this).startPolling);
6350
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'enroll-poll';
6300
6351
  }
6301
6352
  }, {
6302
6353
  key: "getNextStep",
@@ -6404,14 +6455,8 @@ var EnrollmentChannelData = function (_Remediator) {
6404
6455
  _inherits(EnrollmentChannelData, _Remediator);
6405
6456
  var _super = _createSuper$h(EnrollmentChannelData);
6406
6457
  function EnrollmentChannelData() {
6407
- var _this;
6408
6458
  _classCallCheck(this, EnrollmentChannelData);
6409
- _this = _super.apply(this, arguments);
6410
- _this.map = {
6411
- email: [],
6412
- phoneNumber: []
6413
- };
6414
- return _this;
6459
+ return _super.apply(this, arguments);
6415
6460
  }
6416
6461
  _createClass(EnrollmentChannelData, [{
6417
6462
  key: "getInputEmail",
@@ -6460,13 +6505,13 @@ var EnrollmentChannelData = function (_Remediator) {
6460
6505
  key: "getValuesAfterProceed",
6461
6506
  value: function getValuesAfterProceed() {
6462
6507
  var _context,
6463
- _this2 = this;
6508
+ _this = this;
6464
6509
  var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6465
6510
  var _context2;
6466
6511
  return !_includesInstanceProperty(_context2 = ['email', 'phoneNumber']).call(_context2, valueKey);
6467
6512
  });
6468
6513
  return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6469
- return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6514
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this)[valueKey]));
6470
6515
  }, {});
6471
6516
  }
6472
6517
  }]);
@@ -6496,6 +6541,12 @@ var ChallengePoll = function (_EnrollPoll) {
6496
6541
  _classCallCheck(this, ChallengePoll);
6497
6542
  return _super.apply(this, arguments);
6498
6543
  }
6544
+ _createClass(ChallengePoll, [{
6545
+ key: "canRemediate",
6546
+ value: function canRemediate() {
6547
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'challenge-poll';
6548
+ }
6549
+ }]);
6499
6550
  return ChallengePoll;
6500
6551
  }(EnrollPoll);
6501
6552
  ChallengePoll.remediationName = 'challenge-poll';
@@ -6519,19 +6570,17 @@ var EnrollProfile = function (_Remediator) {
6519
6570
  _inherits(EnrollProfile, _Remediator);
6520
6571
  var _super = _createSuper$d(EnrollProfile);
6521
6572
  function EnrollProfile() {
6522
- var _this;
6523
6573
  _classCallCheck(this, EnrollProfile);
6524
- _this = _super.apply(this, arguments);
6525
- _this.map = {
6526
- 'userProfile': []
6527
- };
6528
- return _this;
6574
+ return _super.apply(this, arguments);
6529
6575
  }
6530
6576
  _createClass(EnrollProfile, [{
6531
6577
  key: "canRemediate",
6532
6578
  value: function canRemediate() {
6533
6579
  var _context, _context2;
6534
6580
  var userProfileFromValues = this.getData().userProfile;
6581
+ if (!userProfileFromValues) {
6582
+ return false;
6583
+ }
6535
6584
  var userProfileFromRemediation = _findInstanceProperty(_context = this.remediation.value).call(_context, function (_ref) {
6536
6585
  var name = _ref.name;
6537
6586
  return name === 'userProfile';
@@ -6546,15 +6595,19 @@ var EnrollProfile = function (_Remediator) {
6546
6595
  }, {
6547
6596
  key: "mapUserProfile",
6548
6597
  value: function mapUserProfile(_ref2) {
6549
- var _this2 = this;
6598
+ var _this = this;
6550
6599
  var profileAttributes = _ref2.form.value;
6551
6600
  var attributeNames = _mapInstanceProperty(profileAttributes).call(profileAttributes, function (_ref3) {
6552
6601
  var name = _ref3.name;
6553
6602
  return name;
6554
6603
  });
6555
- return _reduceInstanceProperty(attributeNames).call(attributeNames, function (attributeValues, attributeName) {
6556
- return _valuesInstanceProperty(_this2)[attributeName] ? _Object$assign(_Object$assign({}, attributeValues), _defineProperty({}, attributeName, _valuesInstanceProperty(_this2)[attributeName])) : attributeValues;
6604
+ var data = _reduceInstanceProperty(attributeNames).call(attributeNames, function (attributeValues, attributeName) {
6605
+ return _valuesInstanceProperty(_this)[attributeName] ? _Object$assign(_Object$assign({}, attributeValues), _defineProperty({}, attributeName, _valuesInstanceProperty(_this)[attributeName])) : attributeValues;
6557
6606
  }, {});
6607
+ if (_Object$keys(data).length === 0) {
6608
+ return;
6609
+ }
6610
+ return data;
6558
6611
  }
6559
6612
  }, {
6560
6613
  key: "getInputUserProfile",
@@ -6587,9 +6640,7 @@ var Identify = function (_Remediator) {
6587
6640
  _classCallCheck(this, Identify);
6588
6641
  _this = _super.apply(this, arguments);
6589
6642
  _this.map = {
6590
- 'identifier': ['username'],
6591
- 'credentials': [],
6592
- 'rememberMe': ['rememberMe']
6643
+ 'identifier': ['username']
6593
6644
  };
6594
6645
  return _this;
6595
6646
  }
@@ -6603,8 +6654,14 @@ var Identify = function (_Remediator) {
6603
6654
  }, {
6604
6655
  key: "mapCredentials",
6605
6656
  value: function mapCredentials() {
6606
- return {
6607
- passcode: _valuesInstanceProperty(this).password
6657
+ var _this$values = _valuesInstanceProperty(this),
6658
+ credentials = _this$values.credentials,
6659
+ password = _this$values.password;
6660
+ if (!credentials && !password) {
6661
+ return;
6662
+ }
6663
+ return credentials || {
6664
+ passcode: password
6608
6665
  };
6609
6666
  }
6610
6667
  }, {
@@ -6626,19 +6683,18 @@ var ReEnrollAuthenticator = function (_Remediator) {
6626
6683
  _inherits(ReEnrollAuthenticator, _Remediator);
6627
6684
  var _super = _createSuper$b(ReEnrollAuthenticator);
6628
6685
  function ReEnrollAuthenticator() {
6629
- var _this;
6630
6686
  _classCallCheck(this, ReEnrollAuthenticator);
6631
- _this = _super.apply(this, arguments);
6632
- _this.map = {
6633
- 'credentials': []
6634
- };
6635
- return _this;
6687
+ return _super.apply(this, arguments);
6636
6688
  }
6637
6689
  _createClass(ReEnrollAuthenticator, [{
6638
6690
  key: "mapCredentials",
6639
6691
  value: function mapCredentials() {
6692
+ var newPassword = _valuesInstanceProperty(this).newPassword;
6693
+ if (!newPassword) {
6694
+ return;
6695
+ }
6640
6696
  return {
6641
- passcode: _valuesInstanceProperty(this).newPassword
6697
+ passcode: newPassword
6642
6698
  };
6643
6699
  }
6644
6700
  }, {
@@ -6698,17 +6754,13 @@ var SelectAuthenticator = function (_Remediator) {
6698
6754
  _inherits(SelectAuthenticator, _Remediator);
6699
6755
  var _super = _createSuper$9(SelectAuthenticator);
6700
6756
  function SelectAuthenticator() {
6701
- var _this;
6702
6757
  _classCallCheck(this, SelectAuthenticator);
6703
- _this = _super.apply(this, arguments);
6704
- _this.map = {
6705
- authenticator: []
6706
- };
6707
- return _this;
6758
+ return _super.apply(this, arguments);
6708
6759
  }
6709
6760
  _createClass(SelectAuthenticator, [{
6710
6761
  key: "findMatchedOption",
6711
- value: function findMatchedOption(authenticators, options) {
6762
+ value:
6763
+ function findMatchedOption(authenticators, options) {
6712
6764
  var option;
6713
6765
  var _iterator = _createForOfIteratorHelper$2(authenticators),
6714
6766
  _step;
@@ -6737,12 +6789,17 @@ var SelectAuthenticator = function (_Remediator) {
6737
6789
  }, {
6738
6790
  key: "canRemediate",
6739
6791
  value: function canRemediate() {
6740
- var authenticators = _valuesInstanceProperty(this).authenticators;
6792
+ var _this$values = _valuesInstanceProperty(this),
6793
+ authenticators = _this$values.authenticators,
6794
+ authenticator = _this$values.authenticator;
6741
6795
  var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
6742
6796
  var options = authenticatorFromRemediation.options;
6743
6797
  if (!authenticators || !authenticators.length) {
6744
6798
  return false;
6745
6799
  }
6800
+ if (isAuthenticator(authenticator) && authenticator.id) {
6801
+ return true;
6802
+ }
6746
6803
  var matchedOption = this.findMatchedOption(authenticators, options);
6747
6804
  if (matchedOption) {
6748
6805
  return true;
@@ -6772,9 +6829,15 @@ var SelectAuthenticator = function (_Remediator) {
6772
6829
  key: "mapAuthenticator",
6773
6830
  value: function mapAuthenticator(remediationValue) {
6774
6831
  var _context2;
6775
- var authenticators = _valuesInstanceProperty(this).authenticators;
6832
+ var _this$values2 = _valuesInstanceProperty(this),
6833
+ authenticators = _this$values2.authenticators,
6834
+ authenticator = _this$values2.authenticator;
6835
+ if (isAuthenticator(authenticator) && authenticator.id) {
6836
+ this.selectedAuthenticator = authenticator;
6837
+ return authenticator;
6838
+ }
6776
6839
  var options = remediationValue.options;
6777
- var selectedOption = this.findMatchedOption(authenticators, options);
6840
+ var selectedOption = findMatchedOption(authenticators, options);
6778
6841
  this.selectedAuthenticator = selectedOption.relatesTo;
6779
6842
  this.selectedOption = selectedOption;
6780
6843
  return {
@@ -6796,10 +6859,10 @@ var SelectAuthenticator = function (_Remediator) {
6796
6859
  key: "getValuesAfterProceed",
6797
6860
  value: function getValuesAfterProceed() {
6798
6861
  var _context3,
6799
- _this2 = this;
6862
+ _this = this;
6800
6863
  this.values = _get(_getPrototypeOf(SelectAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6801
6864
  var authenticators = _filterInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (authenticator) {
6802
- return authenticator.key !== _this2.selectedAuthenticator.key;
6865
+ return compareAuthenticators(authenticator, _this.selectedAuthenticator) !== true;
6803
6866
  });
6804
6867
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
6805
6868
  authenticators: authenticators
@@ -6817,14 +6880,16 @@ var SelectAuthenticatorAuthenticate = function (_SelectAuthenticator) {
6817
6880
  function SelectAuthenticatorAuthenticate(remediation) {
6818
6881
  var _this;
6819
6882
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6883
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6820
6884
  _classCallCheck(this, SelectAuthenticatorAuthenticate);
6821
6885
  var _a;
6822
- _this = _super.call(this, remediation, values);
6886
+ _this = _super.call(this, remediation, values, options);
6887
+ var isRecoveryFlow = _this.options.flow === 'recoverPassword';
6823
6888
  var hasPasswordInOptions = (_a = getAuthenticatorFromRemediation(remediation).options) === null || _a === void 0 ? void 0 : _a.some(function (_ref) {
6824
6889
  var relatesTo = _ref.relatesTo;
6825
6890
  return (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.key) === AuthenticatorKey.OKTA_PASSWORD;
6826
6891
  });
6827
- if (hasPasswordInOptions && (_valuesInstanceProperty(_this).flow === 'recoverPassword' || _valuesInstanceProperty(_this).password)) {
6892
+ if (hasPasswordInOptions && (isRecoveryFlow || _valuesInstanceProperty(_this).password)) {
6828
6893
  var _context;
6829
6894
  _valuesInstanceProperty(_this).authenticators = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_valuesInstanceProperty(_this).authenticators || []), [{
6830
6895
  key: AuthenticatorKey.OKTA_PASSWORD
@@ -6859,7 +6924,6 @@ var SelectAuthenticatorUnlockAccount = function (_SelectAuthenticator) {
6859
6924
  _classCallCheck(this, SelectAuthenticatorUnlockAccount);
6860
6925
  _this = _super.apply(this, arguments);
6861
6926
  _this.map = {
6862
- authenticator: [],
6863
6927
  identifier: ['username']
6864
6928
  };
6865
6929
  return _this;
@@ -6930,9 +6994,6 @@ var AuthenticatorData = function (_Remediator) {
6930
6994
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6931
6995
  _classCallCheck(this, AuthenticatorData);
6932
6996
  _this = _super.call(this, remediation, values);
6933
- _this.map = {
6934
- 'authenticator': []
6935
- };
6936
6997
  _this.authenticator = _this.getAuthenticator();
6937
6998
  _this.formatAuthenticatorData();
6938
6999
  return _this;
@@ -6945,7 +7006,7 @@ var AuthenticatorData = function (_Remediator) {
6945
7006
  if (authenticatorData) {
6946
7007
  var _context;
6947
7008
  _valuesInstanceProperty(this).authenticatorsData = _mapInstanceProperty(_context = _valuesInstanceProperty(this).authenticatorsData).call(_context, function (data) {
6948
- if (data.key === _this2.authenticator.key) {
7009
+ if (compareAuthenticators(_this2.authenticator, data)) {
6949
7010
  return _this2.mapAuthenticatorDataFromValues(data);
6950
7011
  }
6951
7012
  return data;
@@ -6962,9 +7023,8 @@ var AuthenticatorData = function (_Remediator) {
6962
7023
  value: function getAuthenticatorData() {
6963
7024
  var _context2,
6964
7025
  _this3 = this;
6965
- return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (_ref) {
6966
- var key = _ref.key;
6967
- return key === _this3.authenticator.key;
7026
+ return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (data) {
7027
+ return compareAuthenticators(_this3.authenticator, data);
6968
7028
  });
6969
7029
  }
6970
7030
  }, {
@@ -6972,7 +7032,7 @@ var AuthenticatorData = function (_Remediator) {
6972
7032
  value: function canRemediate() {
6973
7033
  var _this4 = this;
6974
7034
  return _valuesInstanceProperty(this).authenticatorsData.some(function (data) {
6975
- return data.key === _this4.authenticator.key;
7035
+ return compareAuthenticators(_this4.authenticator, data);
6976
7036
  });
6977
7037
  }
6978
7038
  }, {
@@ -6987,9 +7047,18 @@ var AuthenticatorData = function (_Remediator) {
6987
7047
  }, {
6988
7048
  key: "mapAuthenticatorDataFromValues",
6989
7049
  value: function mapAuthenticatorDataFromValues(authenticatorData) {
6990
- var methodType = _valuesInstanceProperty(this).methodType;
7050
+ var _this$values = _valuesInstanceProperty(this),
7051
+ methodType = _this$values.methodType,
7052
+ authenticator = _this$values.authenticator;
7053
+ if (!methodType && isAuthenticator(authenticator)) {
7054
+ methodType = authenticator === null || authenticator === void 0 ? void 0 : authenticator.methodType;
7055
+ }
7056
+ var _this$authenticator = this.authenticator,
7057
+ id = _this$authenticator.id,
7058
+ enrollmentId = _this$authenticator.enrollmentId;
6991
7059
  var data = _Object$assign(_Object$assign({
6992
- key: this.authenticator.key
7060
+ id: id,
7061
+ enrollmentId: enrollmentId
6993
7062
  }, authenticatorData && authenticatorData), methodType && {
6994
7063
  methodType: methodType
6995
7064
  });
@@ -6999,8 +7068,8 @@ var AuthenticatorData = function (_Remediator) {
6999
7068
  key: "getAuthenticatorFromRemediation",
7000
7069
  value: function getAuthenticatorFromRemediation() {
7001
7070
  var _context3;
7002
- var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref2) {
7003
- var name = _ref2.name;
7071
+ var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref) {
7072
+ var name = _ref.name;
7004
7073
  return name === 'authenticator';
7005
7074
  });
7006
7075
  return authenticator;
@@ -7011,8 +7080,8 @@ var AuthenticatorData = function (_Remediator) {
7011
7080
  var _context4;
7012
7081
  var _a;
7013
7082
  var authenticator = this.getAuthenticatorFromRemediation();
7014
- return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
7015
- var name = _ref3.name;
7083
+ return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref2) {
7084
+ var name = _ref2.name;
7016
7085
  return name === 'methodType';
7017
7086
  })) === null || _a === void 0 ? void 0 : _a.options;
7018
7087
  }
@@ -7023,7 +7092,7 @@ var AuthenticatorData = function (_Remediator) {
7023
7092
  _this5 = this;
7024
7093
  this.values = _get(_getPrototypeOf(AuthenticatorData.prototype), "getValuesAfterProceed", this).call(this);
7025
7094
  var authenticatorsData = _filterInstanceProperty(_context5 = _valuesInstanceProperty(this).authenticatorsData).call(_context5, function (data) {
7026
- return data.key !== _this5.authenticator.key;
7095
+ return compareAuthenticators(_this5.authenticator, data) !== true;
7027
7096
  });
7028
7097
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
7029
7098
  authenticatorsData: authenticatorsData
@@ -7057,12 +7126,10 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7057
7126
  }, {
7058
7127
  key: "mapAuthenticator",
7059
7128
  value: function mapAuthenticator() {
7060
- var _context2, _context3;
7061
- var _a, _b;
7062
- var authenticatorData = this.getAuthenticatorData();
7063
- var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
7129
+ var _a;
7064
7130
  if (this.shouldProceedWithEmailAuthenticator) {
7065
7131
  var _context;
7132
+ var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
7066
7133
  return (_a = authenticatorFromRemediation.form) === null || _a === void 0 ? void 0 : _reduceInstanceProperty(_context = _a.value).call(_context, function (acc, curr) {
7067
7134
  if (curr.value) {
7068
7135
  acc[curr.name] = curr.value;
@@ -7074,25 +7141,15 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7074
7141
  return acc;
7075
7142
  }, {});
7076
7143
  }
7077
- return {
7078
- id: _findInstanceProperty(_context2 = authenticatorFromRemediation.form.value).call(_context2, function (_ref) {
7079
- var name = _ref.name;
7080
- return name === 'id';
7081
- }).value,
7082
- enrollmentId: (_b = _findInstanceProperty(_context3 = authenticatorFromRemediation.form.value).call(_context3, function (_ref2) {
7083
- var name = _ref2.name;
7084
- return name === 'enrollmentId';
7085
- })) === null || _b === void 0 ? void 0 : _b.value,
7086
- methodType: authenticatorData === null || authenticatorData === void 0 ? void 0 : authenticatorData.methodType
7087
- };
7144
+ return this.getAuthenticatorData();
7088
7145
  }
7089
7146
  }, {
7090
7147
  key: "getInputAuthenticator",
7091
7148
  value: function getInputAuthenticator() {
7092
- var _context4;
7149
+ var _context2;
7093
7150
  var authenticator = this.getAuthenticatorFromRemediation();
7094
- var methodType = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
7095
- var name = _ref3.name;
7151
+ var methodType = _findInstanceProperty(_context2 = authenticator.form.value).call(_context2, function (_ref) {
7152
+ var name = _ref.name;
7096
7153
  return name === 'methodType';
7097
7154
  });
7098
7155
  if (methodType && methodType.options) {
@@ -7105,6 +7162,19 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7105
7162
  var inputs = _toConsumableArray(authenticator.form.value);
7106
7163
  return inputs;
7107
7164
  }
7165
+ }, {
7166
+ key: "getValuesAfterProceed",
7167
+ value: function getValuesAfterProceed() {
7168
+ var _context3,
7169
+ _this2 = this;
7170
+ this.values = _get(_getPrototypeOf(AuthenticatorVerificationData.prototype), "getValuesAfterProceed", this).call(this);
7171
+ var trimmedValues = _filterInstanceProperty(_context3 = _Object$keys(_valuesInstanceProperty(this))).call(_context3, function (valueKey) {
7172
+ return valueKey !== 'authenticator';
7173
+ });
7174
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
7175
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
7176
+ }, {});
7177
+ }
7108
7178
  }]);
7109
7179
  return AuthenticatorVerificationData;
7110
7180
  }(AuthenticatorData);
@@ -7153,10 +7223,12 @@ var AuthenticatorEnrollmentData = function (_AuthenticatorData) {
7153
7223
  value: function mapAuthenticatorDataFromValues(data) {
7154
7224
  data = _get(_getPrototypeOf(AuthenticatorEnrollmentData.prototype), "mapAuthenticatorDataFromValues", this).call(this, data);
7155
7225
  var phoneNumber = _valuesInstanceProperty(this).phoneNumber;
7156
- data = _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7226
+ if (!data && !phoneNumber) {
7227
+ return;
7228
+ }
7229
+ return _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7157
7230
  phoneNumber: phoneNumber
7158
7231
  });
7159
- return data.phoneNumber && data.methodType ? data : null;
7160
7232
  }
7161
7233
  }]);
7162
7234
  return AuthenticatorEnrollmentData;
@@ -7169,18 +7241,13 @@ var Skip = function (_Remediator) {
7169
7241
  _inherits(Skip, _Remediator);
7170
7242
  var _super = _createSuper$1(Skip);
7171
7243
  function Skip() {
7172
- var _this;
7173
7244
  _classCallCheck(this, Skip);
7174
- _this = _super.apply(this, arguments);
7175
- _this.map = {
7176
- skip: ['skip']
7177
- };
7178
- return _this;
7245
+ return _super.apply(this, arguments);
7179
7246
  }
7180
7247
  _createClass(Skip, [{
7181
7248
  key: "canRemediate",
7182
7249
  value: function canRemediate() {
7183
- return !!_valuesInstanceProperty(this).skip;
7250
+ return !!_valuesInstanceProperty(this).skip || this.options.step === 'skip';
7184
7251
  }
7185
7252
  }]);
7186
7253
  return Skip;
@@ -7211,52 +7278,16 @@ var remediators = /*#__PURE__*/Object.freeze({
7211
7278
  });
7212
7279
 
7213
7280
  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; } } }; }
7214
- 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); }
7281
+ 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); }
7215
7282
  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; }
7216
- function getRemediator(idxRemediations, values, options) {
7217
- var remediators = options.remediators;
7218
- var remediator;
7219
- if (options.step) {
7220
- var remediation = _findInstanceProperty(idxRemediations).call(idxRemediations, function (_ref) {
7221
- var name = _ref.name;
7222
- return name === options.step;
7223
- });
7224
- var T = remediators[remediation.name];
7225
- return new T(remediation, values);
7226
- }
7227
- var remediatorCandidates = [];
7228
- var _iterator = _createForOfIteratorHelper$1(idxRemediations),
7229
- _step;
7230
- try {
7231
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
7232
- var _context;
7233
- var _remediation = _step.value;
7234
- var isRemeditionInFlow = _includesInstanceProperty(_context = _Object$keys(remediators)).call(_context, _remediation.name);
7235
- if (!isRemeditionInFlow) {
7236
- continue;
7237
- }
7238
- var _T = remediators[_remediation.name];
7239
- remediator = new _T(_remediation, values);
7240
- if (remediator.canRemediate()) {
7241
- return remediator;
7242
- }
7243
- remediatorCandidates.push(remediator);
7244
- }
7245
- } catch (err) {
7246
- _iterator.e(err);
7247
- } finally {
7248
- _iterator.f();
7249
- }
7250
- return remediatorCandidates[0];
7251
- }
7252
7283
  function isTerminalResponse(idxResponse) {
7253
7284
  var neededToProceed = idxResponse.neededToProceed,
7254
7285
  interactionCode = idxResponse.interactionCode;
7255
7286
  return !neededToProceed.length && !interactionCode;
7256
7287
  }
7257
7288
  function canSkipFn(idxResponse) {
7258
- return idxResponse.neededToProceed.some(function (_ref2) {
7259
- var name = _ref2.name;
7289
+ return idxResponse.neededToProceed.some(function (_ref) {
7290
+ var name = _ref.name;
7260
7291
  return name === 'skip';
7261
7292
  });
7262
7293
  }
@@ -7265,28 +7296,124 @@ function canResendFn(idxResponse) {
7265
7296
  return _includesInstanceProperty(actionName).call(actionName, 'resend');
7266
7297
  });
7267
7298
  }
7268
- function getIdxMessages(idxResponse) {
7269
- var _context2;
7299
+ function getMessagesFromIdxRemediationValue(value) {
7300
+ if (!value || !Array.isArray(value)) {
7301
+ return;
7302
+ }
7303
+ return _reduceInstanceProperty(value).call(value, function (messages, value) {
7304
+ if (value.messages) {
7305
+ var _context;
7306
+ messages = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(messages), _toConsumableArray(value.messages.value));
7307
+ }
7308
+ if (value.form) {
7309
+ var _context2;
7310
+ var messagesFromForm = getMessagesFromIdxRemediationValue(value.form.value) || [];
7311
+ messages = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(messages), _toConsumableArray(messagesFromForm));
7312
+ }
7313
+ if (value.options) {
7314
+ var _context4;
7315
+ var optionValues = [];
7316
+ value.options.forEach(function (option) {
7317
+ var _context3;
7318
+ if (!option.value || typeof option.value === 'string') {
7319
+ return;
7320
+ }
7321
+ optionValues = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(optionValues), [option.value]);
7322
+ });
7323
+ var messagesFromOptions = getMessagesFromIdxRemediationValue(optionValues) || [];
7324
+ messages = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(messages), _toConsumableArray(messagesFromOptions));
7325
+ }
7326
+ return messages;
7327
+ }, []);
7328
+ }
7329
+ function getMessagesFromResponse(idxResponse) {
7330
+ var _context5;
7270
7331
  var _a;
7271
7332
  var messages = [];
7272
7333
  var rawIdxState = idxResponse.rawIdxState,
7273
7334
  neededToProceed = idxResponse.neededToProceed;
7274
- var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context2 = _a.value).call(_context2, function (message) {
7335
+ var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context5 = _a.value).call(_context5, function (message) {
7275
7336
  return message;
7276
7337
  });
7277
7338
  if (globalMessages) {
7278
- var _context3;
7279
- messages = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7339
+ var _context6;
7340
+ messages = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7341
+ }
7342
+ var _iterator = _createForOfIteratorHelper$1(neededToProceed),
7343
+ _step;
7344
+ try {
7345
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7346
+ var remediation = _step.value;
7347
+ var fieldMessages = getMessagesFromIdxRemediationValue(remediation.value);
7348
+ if (fieldMessages) {
7349
+ var _context8;
7350
+ messages = _concatInstanceProperty(_context8 = []).call(_context8, _toConsumableArray(messages), _toConsumableArray(fieldMessages));
7351
+ }
7352
+ }
7353
+ } catch (err) {
7354
+ _iterator.e(err);
7355
+ } finally {
7356
+ _iterator.f();
7357
+ }
7358
+ var seen = {};
7359
+ messages = _reduceInstanceProperty(messages).call(messages, function (filtered, message) {
7360
+ var _context7;
7361
+ var _a;
7362
+ var key = (_a = message.i18n) === null || _a === void 0 ? void 0 : _a.key;
7363
+ if (key && seen[key]) {
7364
+ return filtered;
7365
+ }
7366
+ seen[key] = message;
7367
+ filtered = _concatInstanceProperty(_context7 = []).call(_context7, _toConsumableArray(filtered), [message]);
7368
+ return filtered;
7369
+ }, []);
7370
+ return messages;
7371
+ }
7372
+ function getEnabledFeatures(idxResponse) {
7373
+ var res = [];
7374
+ var actions = idxResponse.actions,
7375
+ neededToProceed = idxResponse.neededToProceed;
7376
+ if (actions['currentAuthenticator-recover']) {
7377
+ res.push(IdxFeature.PASSWORD_RECOVERY);
7280
7378
  }
7281
- var _iterator2 = _createForOfIteratorHelper$1(neededToProceed),
7379
+ if (neededToProceed.some(function (_ref2) {
7380
+ var name = _ref2.name;
7381
+ return name === 'select-enroll-profile';
7382
+ })) {
7383
+ res.push(IdxFeature.REGISTRATION);
7384
+ }
7385
+ if (neededToProceed.some(function (_ref3) {
7386
+ var name = _ref3.name;
7387
+ return name === 'redirect-idp';
7388
+ })) {
7389
+ res.push(IdxFeature.SOCIAL_IDP);
7390
+ }
7391
+ if (neededToProceed.some(function (_ref4) {
7392
+ var name = _ref4.name;
7393
+ return name === 'unlock-account';
7394
+ })) {
7395
+ res.push(IdxFeature.ACCOUNT_UNLOCK);
7396
+ }
7397
+ return res;
7398
+ }
7399
+ function getAvailableSteps(idxResponse) {
7400
+ var _context9;
7401
+ var res = [];
7402
+ var remediatorMap = _reduceInstanceProperty(_context9 = _Object$values(remediators)).call(_context9, function (map, remediatorClass) {
7403
+ if (remediatorClass.remediationName) {
7404
+ map[remediatorClass.remediationName] = remediatorClass;
7405
+ }
7406
+ return map;
7407
+ }, {});
7408
+ var _iterator2 = _createForOfIteratorHelper$1(idxResponse.neededToProceed),
7282
7409
  _step2;
7283
7410
  try {
7284
7411
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
7285
7412
  var remediation = _step2.value;
7286
- var fieldMessages = Remediator.getMessages(remediation);
7287
- if (fieldMessages) {
7288
- var _context4;
7289
- messages = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(messages), _toConsumableArray(fieldMessages));
7413
+ var T = remediatorMap[remediation.name];
7414
+ if (T) {
7415
+ var remediator = new T(remediation);
7416
+ res.push(remediator.getNextStep(idxResponse.context));
7290
7417
  }
7291
7418
  }
7292
7419
  } catch (err) {
@@ -7294,7 +7421,61 @@ function getIdxMessages(idxResponse) {
7294
7421
  } finally {
7295
7422
  _iterator2.f();
7296
7423
  }
7297
- return messages;
7424
+ return res;
7425
+ }
7426
+ function filterValuesForRemediation(idxResponse, values) {
7427
+ var _context10;
7428
+ var valuesForRemediation = _reduceInstanceProperty(_context10 = idxResponse.neededToProceed[0].value).call(_context10, function (res, entry) {
7429
+ var name = entry.name;
7430
+ res[name] = values[name];
7431
+ return res;
7432
+ }, {});
7433
+ return valuesForRemediation;
7434
+ }
7435
+
7436
+ 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; } } }; }
7437
+ 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); }
7438
+ 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; }
7439
+ function getRemediator(idxRemediations, values, options) {
7440
+ var remediators = options.remediators;
7441
+ var remediator;
7442
+ if (options.step) {
7443
+ var remediation = _findInstanceProperty(idxRemediations).call(idxRemediations, function (_ref) {
7444
+ var name = _ref.name;
7445
+ return name === options.step;
7446
+ });
7447
+ if (remediation) {
7448
+ var T = remediation ? remediators[remediation.name] : undefined;
7449
+ return T ? new T(remediation, values, options) : undefined;
7450
+ } else {
7451
+ warn("step \"".concat(options.step, "\" did not match any remediations"));
7452
+ return;
7453
+ }
7454
+ }
7455
+ var remediatorCandidates = [];
7456
+ var _iterator = _createForOfIteratorHelper(idxRemediations),
7457
+ _step;
7458
+ try {
7459
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7460
+ var _context;
7461
+ var _remediation = _step.value;
7462
+ var isRemeditionInFlow = _includesInstanceProperty(_context = _Object$keys(remediators)).call(_context, _remediation.name);
7463
+ if (!isRemeditionInFlow) {
7464
+ continue;
7465
+ }
7466
+ var _T = remediators[_remediation.name];
7467
+ remediator = new _T(_remediation, values, options);
7468
+ if (remediator.canRemediate()) {
7469
+ return remediator;
7470
+ }
7471
+ remediatorCandidates.push(remediator);
7472
+ }
7473
+ } catch (err) {
7474
+ _iterator.e(err);
7475
+ } finally {
7476
+ _iterator.f();
7477
+ }
7478
+ return remediatorCandidates[0];
7298
7479
  }
7299
7480
  function getNextStep(remediator, idxResponse) {
7300
7481
  var nextStep = remediator.getNextStep(idxResponse.context);
@@ -7307,20 +7488,23 @@ function getNextStep(remediator, idxResponse) {
7307
7488
  });
7308
7489
  }
7309
7490
  function handleIdxError(e, remediator) {
7310
- var idxState = isIdxResponse(e) ? e : null;
7311
- if (!idxState) {
7491
+ var idxResponse = isIdxResponse(e) ? e : null;
7492
+ if (!idxResponse) {
7312
7493
  throw e;
7313
7494
  }
7314
- var terminal = isTerminalResponse(idxState);
7315
- var messages = getIdxMessages(idxState);
7495
+ idxResponse.requestDidSucceed = false;
7496
+ var terminal = isTerminalResponse(idxResponse);
7497
+ var messages = getMessagesFromResponse(idxResponse);
7316
7498
  if (terminal) {
7317
7499
  return {
7500
+ idxResponse: idxResponse,
7318
7501
  terminal: terminal,
7319
7502
  messages: messages
7320
7503
  };
7321
7504
  } else {
7322
- var nextStep = remediator && getNextStep(remediator, idxState);
7505
+ var nextStep = remediator && getNextStep(remediator, idxResponse);
7323
7506
  return _Object$assign({
7507
+ idxResponse: idxResponse,
7324
7508
  messages: messages
7325
7509
  }, nextStep && {
7326
7510
  nextStep: nextStep
@@ -7328,8 +7512,8 @@ function handleIdxError(e, remediator) {
7328
7512
  }
7329
7513
  }
7330
7514
  function getActionFromValues(values, idxResponse) {
7331
- var _context5;
7332
- return _findInstanceProperty(_context5 = _Object$keys(idxResponse.actions)).call(_context5, function (action) {
7515
+ var _context2;
7516
+ return _findInstanceProperty(_context2 = _Object$keys(idxResponse.actions)).call(_context2, function (action) {
7333
7517
  return !!values.resend && _includesInstanceProperty(action).call(action, '-resend');
7334
7518
  });
7335
7519
  }
@@ -7342,198 +7526,230 @@ function remediate(_x, _x2, _x3) {
7342
7526
  }
7343
7527
  function _remediate() {
7344
7528
  _remediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(idxResponse, values, options) {
7345
- var _context6;
7346
- var _idxResponse, neededToProceed, interactionCode, remediators, flow, terminal, messages, actionFromValues, actions, _iterator3, _step3, _loop, _ret, remediator, nextStep, _nextStep, name, data;
7347
- return _regeneratorRuntime.wrap(function _callee$(_context8) {
7529
+ var _context3;
7530
+ var _idxResponse, neededToProceed, interactionCode, remediators, flow, terminal, messages, actionFromValues, actionFromOptions, actions, _iterator2, _step2, _loop, _ret, remediator, nextStep, _nextStep, name, data;
7531
+ return _regeneratorRuntime.wrap(function _callee$(_context5) {
7348
7532
  while (1) {
7349
- switch (_context8.prev = _context8.next) {
7533
+ switch (_context5.prev = _context5.next) {
7350
7534
  case 0:
7351
7535
  _idxResponse = idxResponse, neededToProceed = _idxResponse.neededToProceed, interactionCode = _idxResponse.interactionCode;
7352
7536
  remediators = options.remediators, flow = options.flow;
7353
7537
  if (!interactionCode) {
7354
- _context8.next = 4;
7538
+ _context5.next = 4;
7355
7539
  break;
7356
7540
  }
7357
- return _context8.abrupt("return", {
7541
+ return _context5.abrupt("return", {
7358
7542
  idxResponse: idxResponse
7359
7543
  });
7360
7544
  case 4:
7361
7545
  terminal = isTerminalResponse(idxResponse);
7362
- messages = getIdxMessages(idxResponse);
7546
+ messages = getMessagesFromResponse(idxResponse);
7363
7547
  if (!terminal) {
7364
- _context8.next = 8;
7548
+ _context5.next = 8;
7365
7549
  break;
7366
7550
  }
7367
- return _context8.abrupt("return", {
7551
+ return _context5.abrupt("return", {
7552
+ idxResponse: idxResponse,
7368
7553
  terminal: terminal,
7369
7554
  messages: messages
7370
7555
  });
7371
7556
  case 8:
7372
7557
  actionFromValues = getActionFromValues(values, idxResponse);
7373
- actions = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(options.actions || []), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7558
+ actionFromOptions = options.actions || [];
7559
+ actions = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(actionFromOptions), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7374
7560
  if (!actions) {
7375
- _context8.next = 30;
7561
+ _context5.next = 31;
7376
7562
  break;
7377
7563
  }
7378
- _iterator3 = _createForOfIteratorHelper$1(actions);
7379
- _context8.prev = 12;
7564
+ _iterator2 = _createForOfIteratorHelper(actions);
7565
+ _context5.prev = 13;
7380
7566
  _loop = _regeneratorRuntime.mark(function _loop() {
7381
- var action, valuesWithoutExecutedAction, remediationAction;
7382
- return _regeneratorRuntime.wrap(function _loop$(_context7) {
7567
+ var action, valuesWithoutExecutedAction, optionsWithoutExecutedAction, remediationAction;
7568
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
7383
7569
  while (1) {
7384
- switch (_context7.prev = _context7.next) {
7570
+ switch (_context4.prev = _context4.next) {
7385
7571
  case 0:
7386
- action = _step3.value;
7572
+ action = _step2.value;
7387
7573
  valuesWithoutExecutedAction = removeActionFromValues(values);
7574
+ optionsWithoutExecutedAction = _Object$assign(_Object$assign({}, options), {
7575
+ actions: _filterInstanceProperty(actionFromOptions).call(actionFromOptions, function (entry) {
7576
+ return entry !== action;
7577
+ })
7578
+ });
7388
7579
  if (!(typeof idxResponse.actions[action] === 'function')) {
7389
- _context7.next = 15;
7580
+ _context4.next = 17;
7390
7581
  break;
7391
7582
  }
7392
- _context7.prev = 3;
7393
- _context7.next = 6;
7583
+ _context4.prev = 4;
7584
+ _context4.next = 7;
7394
7585
  return idxResponse.actions[action]();
7395
- case 6:
7396
- idxResponse = _context7.sent;
7397
- _context7.next = 12;
7586
+ case 7:
7587
+ idxResponse = _context4.sent;
7588
+ idxResponse.requestDidSucceed = true;
7589
+ _context4.next = 14;
7398
7590
  break;
7399
- case 9:
7400
- _context7.prev = 9;
7401
- _context7.t0 = _context7["catch"](3);
7402
- return _context7.abrupt("return", {
7403
- v: handleIdxError(_context7.t0, remediators)
7591
+ case 11:
7592
+ _context4.prev = 11;
7593
+ _context4.t0 = _context4["catch"](4);
7594
+ return _context4.abrupt("return", {
7595
+ v: handleIdxError(_context4.t0, remediators)
7404
7596
  });
7405
- case 12:
7597
+ case 14:
7406
7598
  if (!(action === 'cancel')) {
7407
- _context7.next = 14;
7599
+ _context4.next = 16;
7408
7600
  break;
7409
7601
  }
7410
- return _context7.abrupt("return", {
7602
+ return _context4.abrupt("return", {
7411
7603
  v: {
7604
+ idxResponse: idxResponse,
7412
7605
  canceled: true
7413
7606
  }
7414
7607
  });
7415
- case 14:
7416
- return _context7.abrupt("return", {
7417
- v: remediate(idxResponse, valuesWithoutExecutedAction, options)
7608
+ case 16:
7609
+ return _context4.abrupt("return", {
7610
+ v: remediate(idxResponse, valuesWithoutExecutedAction, optionsWithoutExecutedAction)
7418
7611
  });
7419
- case 15:
7420
- remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref3) {
7421
- var name = _ref3.name;
7612
+ case 17:
7613
+ remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref2) {
7614
+ var name = _ref2.name;
7422
7615
  return name === action;
7423
7616
  });
7424
7617
  if (!remediationAction) {
7425
- _context7.next = 27;
7618
+ _context4.next = 30;
7426
7619
  break;
7427
7620
  }
7428
- _context7.prev = 17;
7429
- _context7.next = 20;
7621
+ _context4.prev = 19;
7622
+ _context4.next = 22;
7430
7623
  return idxResponse.proceed(action, {});
7431
- case 20:
7432
- idxResponse = _context7.sent;
7433
- _context7.next = 26;
7624
+ case 22:
7625
+ idxResponse = _context4.sent;
7626
+ idxResponse.requestDidSucceed = true;
7627
+ _context4.next = 29;
7434
7628
  break;
7435
- case 23:
7436
- _context7.prev = 23;
7437
- _context7.t1 = _context7["catch"](17);
7438
- return _context7.abrupt("return", {
7439
- v: handleIdxError(_context7.t1, remediators)
7440
- });
7441
7629
  case 26:
7442
- return _context7.abrupt("return", {
7443
- v: remediate(idxResponse, values, options)
7630
+ _context4.prev = 26;
7631
+ _context4.t1 = _context4["catch"](19);
7632
+ return _context4.abrupt("return", {
7633
+ v: handleIdxError(_context4.t1, remediators)
7634
+ });
7635
+ case 29:
7636
+ return _context4.abrupt("return", {
7637
+ v: remediate(idxResponse, values, optionsWithoutExecutedAction)
7444
7638
  });
7445
- case 27:
7639
+ case 30:
7446
7640
  case "end":
7447
- return _context7.stop();
7641
+ return _context4.stop();
7448
7642
  }
7449
7643
  }
7450
- }, _loop, null, [[3, 9], [17, 23]]);
7644
+ }, _loop, null, [[4, 11], [19, 26]]);
7451
7645
  });
7452
- _iterator3.s();
7453
- case 15:
7454
- if ((_step3 = _iterator3.n()).done) {
7455
- _context8.next = 22;
7646
+ _iterator2.s();
7647
+ case 16:
7648
+ if ((_step2 = _iterator2.n()).done) {
7649
+ _context5.next = 23;
7456
7650
  break;
7457
7651
  }
7458
- return _context8.delegateYield(_loop(), "t0", 17);
7459
- case 17:
7460
- _ret = _context8.t0;
7652
+ return _context5.delegateYield(_loop(), "t0", 18);
7653
+ case 18:
7654
+ _ret = _context5.t0;
7461
7655
  if (!(_typeof(_ret) === "object")) {
7462
- _context8.next = 20;
7656
+ _context5.next = 21;
7463
7657
  break;
7464
7658
  }
7465
- return _context8.abrupt("return", _ret.v);
7466
- case 20:
7467
- _context8.next = 15;
7659
+ return _context5.abrupt("return", _ret.v);
7660
+ case 21:
7661
+ _context5.next = 16;
7468
7662
  break;
7469
- case 22:
7470
- _context8.next = 27;
7663
+ case 23:
7664
+ _context5.next = 28;
7471
7665
  break;
7472
- case 24:
7473
- _context8.prev = 24;
7474
- _context8.t1 = _context8["catch"](12);
7475
- _iterator3.e(_context8.t1);
7476
- case 27:
7477
- _context8.prev = 27;
7478
- _iterator3.f();
7479
- return _context8.finish(27);
7480
- case 30:
7666
+ case 25:
7667
+ _context5.prev = 25;
7668
+ _context5.t1 = _context5["catch"](13);
7669
+ _iterator2.e(_context5.t1);
7670
+ case 28:
7671
+ _context5.prev = 28;
7672
+ _iterator2.f();
7673
+ return _context5.finish(28);
7674
+ case 31:
7481
7675
  remediator = getRemediator(neededToProceed, values, options);
7482
- if (!(!remediator && flow === 'default')) {
7483
- _context8.next = 33;
7676
+ if (remediator) {
7677
+ _context5.next = 49;
7484
7678
  break;
7485
7679
  }
7486
- return _context8.abrupt("return", {
7487
- idxResponse: idxResponse
7680
+ if (!options.step) {
7681
+ _context5.next = 46;
7682
+ break;
7683
+ }
7684
+ values = filterValuesForRemediation(idxResponse, values);
7685
+ _context5.prev = 35;
7686
+ _context5.next = 38;
7687
+ return idxResponse.proceed(options.step, values);
7688
+ case 38:
7689
+ idxResponse = _context5.sent;
7690
+ idxResponse.requestDidSucceed = true;
7691
+ return _context5.abrupt("return", {
7692
+ idxResponse: idxResponse
7488
7693
  });
7489
- case 33:
7490
- if (remediator) {
7491
- _context8.next = 35;
7694
+ case 43:
7695
+ _context5.prev = 43;
7696
+ _context5.t2 = _context5["catch"](35);
7697
+ return _context5.abrupt("return", handleIdxError(_context5.t2));
7698
+ case 46:
7699
+ if (!(flow === 'default')) {
7700
+ _context5.next = 48;
7492
7701
  break;
7493
7702
  }
7703
+ return _context5.abrupt("return", {
7704
+ idxResponse: idxResponse
7705
+ });
7706
+ case 48:
7494
7707
  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) {
7495
7708
  return acc ? acc + ' ,' + curr.name : curr.name;
7496
7709
  }, ''), "]\n "));
7497
- case 35:
7710
+ case 49:
7498
7711
  if (!messages.length) {
7499
- _context8.next = 38;
7712
+ _context5.next = 52;
7500
7713
  break;
7501
7714
  }
7502
7715
  nextStep = getNextStep(remediator, idxResponse);
7503
- return _context8.abrupt("return", {
7716
+ return _context5.abrupt("return", {
7717
+ idxResponse: idxResponse,
7504
7718
  nextStep: nextStep,
7505
7719
  messages: messages
7506
7720
  });
7507
- case 38:
7721
+ case 52:
7508
7722
  if (remediator.canRemediate()) {
7509
- _context8.next = 41;
7723
+ _context5.next = 55;
7510
7724
  break;
7511
7725
  }
7512
7726
  _nextStep = getNextStep(remediator, idxResponse);
7513
- return _context8.abrupt("return", {
7727
+ return _context5.abrupt("return", {
7514
7728
  idxResponse: idxResponse,
7515
7729
  nextStep: _nextStep
7516
7730
  });
7517
- case 41:
7731
+ case 55:
7518
7732
  name = remediator.getName();
7519
7733
  data = remediator.getData();
7520
- _context8.prev = 43;
7521
- _context8.next = 46;
7734
+ _context5.prev = 57;
7735
+ _context5.next = 60;
7522
7736
  return idxResponse.proceed(name, data);
7523
- case 46:
7524
- idxResponse = _context8.sent;
7737
+ case 60:
7738
+ idxResponse = _context5.sent;
7739
+ idxResponse.requestDidSucceed = true;
7525
7740
  values = remediator.getValuesAfterProceed();
7526
- return _context8.abrupt("return", remediate(idxResponse, values, options));
7527
- case 51:
7528
- _context8.prev = 51;
7529
- _context8.t2 = _context8["catch"](43);
7530
- return _context8.abrupt("return", handleIdxError(_context8.t2, remediator));
7531
- case 54:
7741
+ delete options.step;
7742
+ return _context5.abrupt("return", remediate(idxResponse, values, options));
7743
+ case 67:
7744
+ _context5.prev = 67;
7745
+ _context5.t3 = _context5["catch"](57);
7746
+ return _context5.abrupt("return", handleIdxError(_context5.t3, remediator));
7747
+ case 70:
7532
7748
  case "end":
7533
- return _context8.stop();
7749
+ return _context5.stop();
7534
7750
  }
7535
7751
  }
7536
- }, _callee, null, [[12, 24, 27, 30], [43, 51]]);
7752
+ }, _callee, null, [[13, 25, 28, 31], [35, 43], [57, 67]]);
7537
7753
  }));
7538
7754
  return _remediate.apply(this, arguments);
7539
7755
  }
@@ -7627,148 +7843,78 @@ function getFlowSpecification(oktaAuth) {
7627
7843
  };
7628
7844
  }
7629
7845
 
7630
- 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; } } }; }
7631
- 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); }
7632
- 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; }
7633
- function getEnabledFeatures(idxResponse) {
7634
- var res = [];
7635
- var actions = idxResponse.actions,
7636
- neededToProceed = idxResponse.neededToProceed;
7637
- if (actions['currentAuthenticator-recover']) {
7638
- res.push(IdxFeature.PASSWORD_RECOVERY);
7639
- }
7640
- if (neededToProceed.some(function (_ref) {
7641
- var name = _ref.name;
7642
- return name === 'select-enroll-profile';
7643
- })) {
7644
- res.push(IdxFeature.REGISTRATION);
7645
- }
7646
- if (neededToProceed.some(function (_ref2) {
7647
- var name = _ref2.name;
7648
- return name === 'redirect-idp';
7649
- })) {
7650
- res.push(IdxFeature.SOCIAL_IDP);
7651
- }
7652
- if (neededToProceed.some(function (_ref3) {
7653
- var name = _ref3.name;
7654
- return name === 'unlock-account';
7655
- })) {
7656
- res.push(IdxFeature.ACCOUNT_UNLOCK);
7657
- }
7658
- return res;
7846
+ function initializeValues(options) {
7847
+ var knownOptions = ['flow', 'remediators', 'actions', 'withCredentials', 'step'];
7848
+ var values = _Object$assign({}, options);
7849
+ knownOptions.forEach(function (option) {
7850
+ delete values[option];
7851
+ });
7852
+ return values;
7659
7853
  }
7660
- function getAvailableSteps(idxResponse) {
7661
- var _context;
7662
- var res = [];
7663
- var remediatorMap = _reduceInstanceProperty(_context = _Object$values(remediators)).call(_context, function (map, remediatorClass) {
7664
- if (remediatorClass.remediationName) {
7665
- map[remediatorClass.remediationName] = remediatorClass;
7666
- }
7667
- return map;
7668
- }, {});
7669
- var _iterator = _createForOfIteratorHelper(idxResponse.neededToProceed),
7670
- _step;
7671
- try {
7672
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
7673
- var remediation = _step.value;
7674
- var T = remediatorMap[remediation.name];
7675
- if (T) {
7676
- var remediator = new T(remediation);
7677
- res.push(remediator.getNextStep(idxResponse.context));
7678
- }
7679
- }
7680
- } catch (err) {
7681
- _iterator.e(err);
7682
- } finally {
7683
- _iterator.f();
7684
- }
7685
- return res;
7854
+ function initializeData(authClient, data) {
7855
+ var options = data.options;
7856
+ var flow = options.flow,
7857
+ withCredentials = options.withCredentials,
7858
+ remediators = options.remediators,
7859
+ actions = options.actions;
7860
+ var status = IdxStatus.PENDING;
7861
+ flow = flow || authClient.idx.getFlow() || 'default';
7862
+ if (flow) {
7863
+ authClient.idx.setFlow(flow);
7864
+ var flowSpec = getFlowSpecification(authClient, flow);
7865
+ withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7866
+ remediators = remediators || flowSpec.remediators;
7867
+ actions = actions || flowSpec.actions;
7868
+ }
7869
+ return _Object$assign(_Object$assign({}, data), {
7870
+ options: _Object$assign(_Object$assign({}, options), {
7871
+ flow: flow,
7872
+ withCredentials: withCredentials,
7873
+ remediators: remediators,
7874
+ actions: actions
7875
+ }),
7876
+ status: status
7877
+ });
7686
7878
  }
7687
- function run(_x) {
7688
- return _run.apply(this, arguments);
7879
+ function getDataFromIntrospect(_x, _x2) {
7880
+ return _getDataFromIntrospect.apply(this, arguments);
7689
7881
  }
7690
- function _run() {
7691
- _run = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
7692
- var options,
7693
- tokens,
7694
- nextStep,
7695
- messages,
7696
- error,
7697
- meta,
7698
- enabledFeatures,
7699
- availableSteps,
7700
- status,
7701
- shouldClearTransaction,
7702
- clearSharedStorage,
7703
- idxResponse,
7704
- interactionHandle,
7705
- metaFromResp,
7706
- interactionCode,
7707
- flow,
7708
- state,
7709
- scopes,
7710
- version,
7711
- _remediators,
7712
- _actions,
7713
- withCredentials,
7714
- exchangeCodeForTokens,
7715
- autoRemediate,
7716
- step,
7717
- recoveryToken,
7718
- activationToken,
7719
- flowSpec,
7720
- interactResponse,
7721
- values,
7722
- _yield$remediate,
7723
- idxResponseFromResp,
7724
- nextStepFromResp,
7725
- terminal,
7726
- canceled,
7727
- messagesFromResp,
7728
- _metaFromResp,
7729
- clientId,
7730
- codeVerifier,
7731
- ignoreSignature,
7732
- redirectUri,
7733
- urls,
7734
- _scopes,
7735
- _ref4,
7736
- actions,
7737
- context,
7738
- neededToProceed,
7739
- proceed,
7740
- rawIdxState,
7741
- _args = arguments;
7742
- return _regeneratorRuntime.wrap(function _callee$(_context2) {
7882
+ function _getDataFromIntrospect() {
7883
+ _getDataFromIntrospect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, data) {
7884
+ var options, stateHandle, withCredentials, version, state, scopes, recoveryToken, activationToken, idxResponse, meta, interactionHandle, interactResponse;
7885
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
7743
7886
  while (1) {
7744
- switch (_context2.prev = _context2.next) {
7887
+ switch (_context.prev = _context.next) {
7745
7888
  case 0:
7746
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
7747
- status = IdxStatus.PENDING;
7748
- shouldClearTransaction = false;
7749
- clearSharedStorage = true;
7750
- _context2.prev = 4;
7751
- 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;
7752
- flow = flow || authClient.idx.getFlow() || 'default';
7753
- if (flow) {
7754
- authClient.idx.setFlow(flow);
7755
- flowSpec = getFlowSpecification(authClient, flow);
7756
- withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7757
- _remediators = _remediators || flowSpec.remediators;
7758
- _actions = _actions || flowSpec.actions;
7889
+ options = data.options;
7890
+ stateHandle = options.stateHandle, withCredentials = options.withCredentials, version = options.version, state = options.state, scopes = options.scopes, recoveryToken = options.recoveryToken, activationToken = options.activationToken;
7891
+ if (!stateHandle) {
7892
+ _context.next = 8;
7893
+ break;
7759
7894
  }
7760
- metaFromResp = getSavedTransactionMeta(authClient, {
7895
+ _context.next = 5;
7896
+ return introspect(authClient, {
7897
+ withCredentials: withCredentials,
7898
+ version: version,
7899
+ stateHandle: stateHandle
7900
+ });
7901
+ case 5:
7902
+ idxResponse = _context.sent;
7903
+ _context.next = 20;
7904
+ break;
7905
+ case 8:
7906
+ meta = getSavedTransactionMeta(authClient, {
7761
7907
  state: state,
7762
7908
  recoveryToken: recoveryToken,
7763
7909
  activationToken: activationToken
7764
7910
  });
7765
- interactionHandle = metaFromResp === null || metaFromResp === void 0 ? void 0 : metaFromResp.interactionHandle;
7911
+ interactionHandle = meta === null || meta === void 0 ? void 0 : meta.interactionHandle;
7766
7912
  if (interactionHandle) {
7767
- _context2.next = 18;
7913
+ _context.next = 17;
7768
7914
  break;
7769
7915
  }
7770
7916
  authClient.transactionManager.clear();
7771
- _context2.next = 14;
7917
+ _context.next = 14;
7772
7918
  return interact(authClient, {
7773
7919
  withCredentials: withCredentials,
7774
7920
  state: state,
@@ -7777,119 +7923,288 @@ function _run() {
7777
7923
  recoveryToken: recoveryToken
7778
7924
  });
7779
7925
  case 14:
7780
- interactResponse = _context2.sent;
7926
+ interactResponse = _context.sent;
7781
7927
  interactionHandle = interactResponse.interactionHandle;
7782
- metaFromResp = interactResponse.meta;
7783
- withCredentials = metaFromResp.withCredentials;
7784
- case 18:
7785
- _context2.next = 20;
7928
+ meta = interactResponse.meta;
7929
+ case 17:
7930
+ _context.next = 19;
7786
7931
  return introspect(authClient, {
7787
7932
  withCredentials: withCredentials,
7788
7933
  version: version,
7789
7934
  interactionHandle: interactionHandle
7790
7935
  });
7936
+ case 19:
7937
+ idxResponse = _context.sent;
7791
7938
  case 20:
7792
- idxResponse = _context2.sent;
7793
- enabledFeatures = getEnabledFeatures(idxResponse);
7794
- availableSteps = getAvailableSteps(idxResponse);
7795
- meta = metaFromResp;
7796
- if (!(autoRemediate !== false && (_remediators || _actions))) {
7797
- _context2.next = 57;
7939
+ return _context.abrupt("return", _Object$assign(_Object$assign({}, data), {
7940
+ idxResponse: idxResponse,
7941
+ meta: meta
7942
+ }));
7943
+ case 21:
7944
+ case "end":
7945
+ return _context.stop();
7946
+ }
7947
+ }
7948
+ }, _callee);
7949
+ }));
7950
+ return _getDataFromIntrospect.apply(this, arguments);
7951
+ }
7952
+ function getDataFromRemediate(_x3) {
7953
+ return _getDataFromRemediate.apply(this, arguments);
7954
+ }
7955
+ function _getDataFromRemediate() {
7956
+ _getDataFromRemediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee2(data) {
7957
+ var idxResponse, options, values, autoRemediate, remediators, actions, flow, step, shouldRemediate, _yield$remediate, idxResponseFromRemediation, nextStep, canceled;
7958
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
7959
+ while (1) {
7960
+ switch (_context2.prev = _context2.next) {
7961
+ case 0:
7962
+ idxResponse = data.idxResponse, options = data.options, values = _valuesInstanceProperty(data);
7963
+ autoRemediate = options.autoRemediate, remediators = options.remediators, actions = options.actions, flow = options.flow, step = options.step;
7964
+ shouldRemediate = autoRemediate !== false && (remediators || actions || step);
7965
+ if (shouldRemediate) {
7966
+ _context2.next = 5;
7798
7967
  break;
7799
7968
  }
7800
- values = _Object$assign(_Object$assign({}, options), {
7969
+ return _context2.abrupt("return", data);
7970
+ case 5:
7971
+ values = _Object$assign(_Object$assign({}, values), {
7801
7972
  stateHandle: idxResponse.rawIdxState.stateHandle
7802
7973
  });
7803
- _context2.next = 28;
7974
+ _context2.next = 8;
7804
7975
  return remediate(idxResponse, values, {
7805
- remediators: _remediators,
7806
- actions: _actions,
7976
+ remediators: remediators,
7977
+ actions: actions,
7807
7978
  flow: flow,
7808
7979
  step: step
7809
7980
  });
7810
- case 28:
7981
+ case 8:
7811
7982
  _yield$remediate = _context2.sent;
7812
- idxResponseFromResp = _yield$remediate.idxResponse;
7813
- nextStepFromResp = _yield$remediate.nextStep;
7814
- terminal = _yield$remediate.terminal;
7983
+ idxResponseFromRemediation = _yield$remediate.idxResponse;
7984
+ nextStep = _yield$remediate.nextStep;
7815
7985
  canceled = _yield$remediate.canceled;
7816
- messagesFromResp = _yield$remediate.messages;
7817
- idxResponse = idxResponseFromResp || idxResponse;
7818
- nextStep = nextStepFromResp;
7819
- messages = messagesFromResp;
7820
- if (nextStep) {
7821
- authClient.transactionManager.saveIdxResponse(idxResponse.rawIdxState);
7986
+ idxResponse = idxResponseFromRemediation;
7987
+ return _context2.abrupt("return", _Object$assign(_Object$assign({}, data), {
7988
+ idxResponse: idxResponse,
7989
+ nextStep: nextStep,
7990
+ canceled: canceled
7991
+ }));
7992
+ case 14:
7993
+ case "end":
7994
+ return _context2.stop();
7995
+ }
7996
+ }
7997
+ }, _callee2);
7998
+ }));
7999
+ return _getDataFromRemediate.apply(this, arguments);
8000
+ }
8001
+ function getTokens(_x4, _x5) {
8002
+ return _getTokens.apply(this, arguments);
8003
+ }
8004
+ function _getTokens() {
8005
+ _getTokens = _asyncToGenerator( _regeneratorRuntime.mark(function _callee3(authClient, data) {
8006
+ var meta, idxResponse, interactionCode, clientId, codeVerifier, ignoreSignature, redirectUri, urls, scopes, tokenResponse;
8007
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
8008
+ while (1) {
8009
+ switch (_context3.prev = _context3.next) {
8010
+ case 0:
8011
+ meta = data.meta, idxResponse = data.idxResponse;
8012
+ interactionCode = idxResponse.interactionCode;
8013
+ clientId = meta.clientId, codeVerifier = meta.codeVerifier, ignoreSignature = meta.ignoreSignature, redirectUri = meta.redirectUri, urls = meta.urls, scopes = meta.scopes;
8014
+ _context3.next = 5;
8015
+ return authClient.token.exchangeCodeForTokens({
8016
+ interactionCode: interactionCode,
8017
+ clientId: clientId,
8018
+ codeVerifier: codeVerifier,
8019
+ ignoreSignature: ignoreSignature,
8020
+ redirectUri: redirectUri,
8021
+ scopes: scopes
8022
+ }, urls);
8023
+ case 5:
8024
+ tokenResponse = _context3.sent;
8025
+ return _context3.abrupt("return", tokenResponse.tokens);
8026
+ case 7:
8027
+ case "end":
8028
+ return _context3.stop();
8029
+ }
8030
+ }
8031
+ }, _callee3);
8032
+ }));
8033
+ return _getTokens.apply(this, arguments);
8034
+ }
8035
+ function finalizeData(_x6, _x7) {
8036
+ return _finalizeData.apply(this, arguments);
8037
+ }
8038
+ function _finalizeData() {
8039
+ _finalizeData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee4(authClient, data) {
8040
+ var options, idxResponse, canceled, status, exchangeCodeForTokens, shouldClearTransaction, clearSharedStorage, interactionCode, tokens, enabledFeatures, availableSteps, messages, terminal;
8041
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
8042
+ while (1) {
8043
+ switch (_context4.prev = _context4.next) {
8044
+ case 0:
8045
+ options = data.options, idxResponse = data.idxResponse, canceled = data.canceled, status = data.status;
8046
+ exchangeCodeForTokens = options.exchangeCodeForTokens;
8047
+ shouldClearTransaction = false;
8048
+ clearSharedStorage = true;
8049
+ if (idxResponse) {
8050
+ enabledFeatures = getEnabledFeatures(idxResponse);
7822
8051
  availableSteps = getAvailableSteps(idxResponse);
8052
+ messages = getMessagesFromResponse(idxResponse);
8053
+ terminal = isTerminalResponse(idxResponse);
7823
8054
  }
7824
- if (terminal) {
7825
- status = IdxStatus.TERMINAL;
7826
- shouldClearTransaction = true;
7827
- clearSharedStorage = false;
8055
+ if (!terminal) {
8056
+ _context4.next = 11;
8057
+ break;
7828
8058
  }
8059
+ status = IdxStatus.TERMINAL;
8060
+ shouldClearTransaction = true;
8061
+ clearSharedStorage = false;
8062
+ _context4.next = 28;
8063
+ break;
8064
+ case 11:
7829
8065
  if (!canceled) {
7830
- _context2.next = 44;
8066
+ _context4.next = 16;
7831
8067
  break;
7832
8068
  }
7833
8069
  status = IdxStatus.CANCELED;
7834
8070
  shouldClearTransaction = true;
7835
- _context2.next = 57;
8071
+ _context4.next = 28;
7836
8072
  break;
7837
- case 44:
8073
+ case 16:
7838
8074
  if (!(idxResponse === null || idxResponse === void 0 ? void 0 : idxResponse.interactionCode)) {
7839
- _context2.next = 57;
8075
+ _context4.next = 28;
7840
8076
  break;
7841
8077
  }
7842
8078
  interactionCode = idxResponse.interactionCode;
7843
8079
  if (!(exchangeCodeForTokens === false)) {
7844
- _context2.next = 51;
8080
+ _context4.next = 23;
7845
8081
  break;
7846
8082
  }
7847
8083
  status = IdxStatus.SUCCESS;
7848
8084
  shouldClearTransaction = false;
7849
- _context2.next = 57;
8085
+ _context4.next = 28;
7850
8086
  break;
7851
- case 51:
7852
- _metaFromResp = metaFromResp, clientId = _metaFromResp.clientId, codeVerifier = _metaFromResp.codeVerifier, ignoreSignature = _metaFromResp.ignoreSignature, redirectUri = _metaFromResp.redirectUri, urls = _metaFromResp.urls, _scopes = _metaFromResp.scopes;
7853
- _context2.next = 54;
7854
- return authClient.token.exchangeCodeForTokens({
7855
- interactionCode: interactionCode,
7856
- clientId: clientId,
7857
- codeVerifier: codeVerifier,
7858
- ignoreSignature: ignoreSignature,
7859
- redirectUri: redirectUri,
7860
- scopes: _scopes
7861
- }, urls);
7862
- case 54:
7863
- tokens = _context2.sent;
8087
+ case 23:
8088
+ _context4.next = 25;
8089
+ return getTokens(authClient, data);
8090
+ case 25:
8091
+ tokens = _context4.sent;
7864
8092
  status = IdxStatus.SUCCESS;
7865
8093
  shouldClearTransaction = true;
7866
- case 57:
7867
- _context2.next = 68;
7868
- break;
7869
- case 59:
7870
- _context2.prev = 59;
7871
- _context2.t0 = _context2["catch"](4);
7872
- if (!isIdxResponse(_context2.t0)) {
7873
- _context2.next = 67;
7874
- break;
7875
- }
7876
- error = _context2.t0;
7877
- status = IdxStatus.FAILURE;
7878
- shouldClearTransaction = true;
7879
- _context2.next = 68;
8094
+ case 28:
8095
+ return _context4.abrupt("return", _Object$assign(_Object$assign({}, data), {
8096
+ status: status,
8097
+ interactionCode: interactionCode,
8098
+ tokens: tokens,
8099
+ shouldClearTransaction: shouldClearTransaction,
8100
+ clearSharedStorage: clearSharedStorage,
8101
+ enabledFeatures: enabledFeatures,
8102
+ availableSteps: availableSteps,
8103
+ messages: messages,
8104
+ terminal: terminal
8105
+ }));
8106
+ case 29:
8107
+ case "end":
8108
+ return _context4.stop();
8109
+ }
8110
+ }
8111
+ }, _callee4);
8112
+ }));
8113
+ return _finalizeData.apply(this, arguments);
8114
+ }
8115
+ function handleError(err, data) {
8116
+ var error = data.error,
8117
+ status = data.status,
8118
+ shouldClearTransaction = data.shouldClearTransaction;
8119
+ if (isIdxResponse(err)) {
8120
+ error = err;
8121
+ status = IdxStatus.FAILURE;
8122
+ shouldClearTransaction = true;
8123
+ } else {
8124
+ throw err;
8125
+ }
8126
+ return _Object$assign(_Object$assign({}, data), {
8127
+ error: error,
8128
+ status: status,
8129
+ shouldClearTransaction: shouldClearTransaction
8130
+ });
8131
+ }
8132
+ function run(_x8) {
8133
+ return _run.apply(this, arguments);
8134
+ }
8135
+ function _run() {
8136
+ _run = _asyncToGenerator( _regeneratorRuntime.mark(function _callee5(authClient) {
8137
+ var options,
8138
+ data,
8139
+ _data,
8140
+ idxResponse,
8141
+ meta,
8142
+ shouldClearTransaction,
8143
+ clearSharedStorage,
8144
+ status,
8145
+ enabledFeatures,
8146
+ availableSteps,
8147
+ tokens,
8148
+ nextStep,
8149
+ messages,
8150
+ error,
8151
+ interactionCode,
8152
+ rawIdxResponse,
8153
+ requestDidSucceed,
8154
+ _ref,
8155
+ actions,
8156
+ context,
8157
+ neededToProceed,
8158
+ proceed,
8159
+ rawIdxState,
8160
+ _args5 = arguments;
8161
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8162
+ while (1) {
8163
+ switch (_context5.prev = _context5.next) {
8164
+ case 0:
8165
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
8166
+ data = {
8167
+ options: options,
8168
+ values: initializeValues(options)
8169
+ };
8170
+ data = initializeData(authClient, data);
8171
+ _context5.prev = 3;
8172
+ _context5.next = 6;
8173
+ return getDataFromIntrospect(authClient, data);
8174
+ case 6:
8175
+ data = _context5.sent;
8176
+ _context5.next = 9;
8177
+ return getDataFromRemediate(data);
8178
+ case 9:
8179
+ data = _context5.sent;
8180
+ _context5.next = 15;
7880
8181
  break;
7881
- case 67:
7882
- throw _context2.t0;
7883
- case 68:
8182
+ case 12:
8183
+ _context5.prev = 12;
8184
+ _context5.t0 = _context5["catch"](3);
8185
+ data = handleError(_context5.t0, data);
8186
+ case 15:
8187
+ _context5.next = 17;
8188
+ return finalizeData(authClient, data);
8189
+ case 17:
8190
+ data = _context5.sent;
8191
+ _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;
7884
8192
  if (shouldClearTransaction) {
7885
8193
  authClient.transactionManager.clear({
7886
8194
  clearSharedStorage: clearSharedStorage
7887
8195
  });
7888
- } else if (meta === null || meta === void 0 ? void 0 : meta.state) {
8196
+ } else {
7889
8197
  saveTransactionMeta(authClient, _Object$assign({}, meta));
8198
+ if (idxResponse) {
8199
+ rawIdxResponse = idxResponse.rawIdxState, requestDidSucceed = idxResponse.requestDidSucceed;
8200
+ authClient.transactionManager.saveIdxResponse({
8201
+ rawIdxResponse: rawIdxResponse,
8202
+ requestDidSucceed: requestDidSucceed
8203
+ });
8204
+ }
7890
8205
  }
7891
- _ref4 = idxResponse || {}, actions = _ref4.actions, context = _ref4.context, neededToProceed = _ref4.neededToProceed, proceed = _ref4.proceed, rawIdxState = _ref4.rawIdxState;
7892
- return _context2.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8206
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState;
8207
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
7893
8208
  status: status
7894
8209
  }, meta && {
7895
8210
  meta: meta
@@ -7898,10 +8213,10 @@ function _run() {
7898
8213
  }), availableSteps && {
7899
8214
  availableSteps: availableSteps
7900
8215
  }), tokens && {
7901
- tokens: tokens.tokens
8216
+ tokens: tokens
7902
8217
  }), nextStep && {
7903
8218
  nextStep: nextStep
7904
- }), messages && {
8219
+ }), messages && messages.length && {
7905
8220
  messages: messages
7906
8221
  }), error && {
7907
8222
  error: error
@@ -7913,12 +8228,12 @@ function _run() {
7913
8228
  proceed: proceed,
7914
8229
  rawIdxState: rawIdxState
7915
8230
  }));
7916
- case 71:
8231
+ case 22:
7917
8232
  case "end":
7918
- return _context2.stop();
8233
+ return _context5.stop();
7919
8234
  }
7920
8235
  }
7921
- }, _callee, null, [[4, 59]]);
8236
+ }, _callee5, null, [[3, 12]]);
7922
8237
  }));
7923
8238
  return _run.apply(this, arguments);
7924
8239
  }
@@ -8041,9 +8356,10 @@ function _handleEmailVerifyCallback() {
8041
8356
  return _handleEmailVerifyCallback.apply(this, arguments);
8042
8357
  }
8043
8358
 
8044
- function canProceed(authClient, options) {
8359
+ function canProceed(authClient) {
8360
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8045
8361
  var meta = getSavedTransactionMeta(authClient, options);
8046
- return !!meta;
8362
+ return !!(meta || options.stateHandle);
8047
8363
  }
8048
8364
  function proceed(_x) {
8049
8365
  return _proceed.apply(this, arguments);
@@ -8051,30 +8367,32 @@ function proceed(_x) {
8051
8367
  function _proceed() {
8052
8368
  _proceed = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
8053
8369
  var options,
8370
+ flow,
8054
8371
  state,
8055
8372
  meta,
8056
- flow,
8057
8373
  _args = arguments;
8058
8374
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8059
8375
  while (1) {
8060
8376
  switch (_context.prev = _context.next) {
8061
8377
  case 0:
8062
8378
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
8063
- state = options.state;
8064
- meta = getSavedTransactionMeta(authClient, {
8065
- state: state
8066
- });
8067
- if (meta) {
8068
- _context.next = 5;
8379
+ if (canProceed(authClient, options)) {
8380
+ _context.next = 3;
8069
8381
  break;
8070
8382
  }
8071
8383
  throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');
8072
- case 5:
8073
- flow = meta === null || meta === void 0 ? void 0 : meta.flow;
8384
+ case 3:
8385
+ flow = options.flow, state = options.state;
8386
+ if (!flow) {
8387
+ meta = getSavedTransactionMeta(authClient, {
8388
+ state: state
8389
+ });
8390
+ flow = meta === null || meta === void 0 ? void 0 : meta.flow;
8391
+ }
8074
8392
  return _context.abrupt("return", run(authClient, _Object$assign(_Object$assign({}, options), {
8075
8393
  flow: flow
8076
8394
  })));
8077
- case 7:
8395
+ case 6:
8078
8396
  case "end":
8079
8397
  return _context.stop();
8080
8398
  }
@@ -8272,7 +8590,7 @@ function handleInteractionCodeRedirect(_x, _x2) {
8272
8590
  }
8273
8591
  function _handleInteractionCodeRedirect() {
8274
8592
  _handleInteractionCodeRedirect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, url) {
8275
- var meta, codeVerifier, savedState, _URL$1, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8593
+ var meta, codeVerifier, savedState, _URL, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8276
8594
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8277
8595
  while (1) {
8278
8596
  switch (_context.prev = _context.next) {
@@ -8285,7 +8603,7 @@ function _handleInteractionCodeRedirect() {
8285
8603
  throw new AuthSdkError('No transaction data was found in storage');
8286
8604
  case 3:
8287
8605
  codeVerifier = meta.codeVerifier, savedState = meta.state;
8288
- _URL$1 = new _URL(url), searchParams = _URL$1.searchParams;
8606
+ _URL = new _URL2(url), searchParams = _URL.searchParams;
8289
8607
  state = searchParams.get('state');
8290
8608
  interactionCode = searchParams.get('interaction_code');
8291
8609
  error = searchParams.get('error');
@@ -8388,7 +8706,7 @@ function createGlobalRequestInterceptor(sdk) {
8388
8706
  var OktaUserAgent = function () {
8389
8707
  function OktaUserAgent() {
8390
8708
  _classCallCheck(this, OktaUserAgent);
8391
- this.environments = ["okta-auth-js/".concat("6.2.0")];
8709
+ this.environments = ["okta-auth-js/".concat("6.3.0")];
8392
8710
  }
8393
8711
  _createClass(OktaUserAgent, [{
8394
8712
  key: "addEnvironment",
@@ -8406,7 +8724,7 @@ var OktaUserAgent = function () {
8406
8724
  }, {
8407
8725
  key: "getVersion",
8408
8726
  value: function getVersion() {
8409
- return "6.2.0";
8727
+ return "6.3.0";
8410
8728
  }
8411
8729
  }, {
8412
8730
  key: "maybeAddNodeEnvironment",
@@ -9273,5 +9591,5 @@ _Object$assign(OktaAuth, {
9273
9591
  constants: constants
9274
9592
  });
9275
9593
 
9276
- 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, 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 };
9594
+ 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, 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 };
9277
9595
  //# sourceMappingURL=esm.node.mjs.map