@okta/okta-auth-js 6.2.0 → 6.3.2

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 (134) hide show
  1. package/CHANGELOG.md +35 -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 +11 -5
  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 +68 -77
  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/dist/okta-auth-js.min.js +1 -1
  89. package/dist/okta-auth-js.min.js.map +1 -1
  90. package/dist/okta-auth-js.umd.js +1 -1
  91. package/dist/okta-auth-js.umd.js.map +1 -1
  92. package/esm/esm.browser.js +1060 -775
  93. package/esm/esm.browser.js.map +1 -1
  94. package/esm/esm.node.mjs +1057 -775
  95. package/esm/esm.node.mjs.map +1 -1
  96. package/lib/AuthStateManager.d.ts +2 -0
  97. package/lib/PromiseQueue.d.ts +6 -2
  98. package/lib/TransactionManager.d.ts +3 -4
  99. package/lib/idx/authenticator/Authenticator.d.ts +1 -1
  100. package/lib/idx/authenticator/OktaPassword.d.ts +2 -1
  101. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +1 -1
  102. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +3 -5
  103. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +1 -1
  104. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +2 -1
  105. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +1 -1
  106. package/lib/idx/authenticator/WebauthnVerification.d.ts +1 -1
  107. package/lib/idx/authenticator/util.d.ts +4 -0
  108. package/lib/idx/idx-js/index.d.ts +1 -17
  109. package/lib/idx/idx-js/introspect.d.ts +2 -1
  110. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +1 -1
  111. package/lib/idx/idx-js/v1/makeIdxState.d.ts +2 -2
  112. package/lib/idx/proceed.d.ts +1 -3
  113. package/lib/idx/remediate.d.ts +2 -2
  114. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +1 -0
  115. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +0 -3
  116. package/lib/idx/remediators/Base/Remediator.d.ts +5 -4
  117. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +7 -9
  118. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +2 -4
  119. package/lib/idx/remediators/ChallengePoll.d.ts +1 -0
  120. package/lib/idx/remediators/EnrollProfile.d.ts +0 -3
  121. package/lib/idx/remediators/EnrollmentChannelData.d.ts +0 -4
  122. package/lib/idx/remediators/Identify.d.ts +3 -5
  123. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -5
  124. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +2 -1
  125. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +1 -2
  126. package/lib/idx/remediators/Skip.d.ts +0 -3
  127. package/lib/idx/types/idx-js.d.ts +5 -1
  128. package/lib/idx/types/index.d.ts +7 -3
  129. package/lib/idx/util.d.ts +11 -0
  130. package/lib/options/browser.d.ts +2 -2
  131. package/lib/options/node.d.ts +2 -2
  132. package/lib/types/Storage.d.ts +7 -5
  133. package/lib/types/api.d.ts +1 -3
  134. 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",
@@ -4471,11 +4490,11 @@ var TransactionManager = function () {
4471
4490
  if (!storage) {
4472
4491
  return null;
4473
4492
  }
4474
- var idxResponse = storage.getStorage();
4475
- if (!isRawIdxResponse(idxResponse)) {
4493
+ var storedValue = storage.getStorage();
4494
+ if (!storedValue || !isRawIdxResponse(storedValue.rawIdxResponse)) {
4476
4495
  return null;
4477
4496
  }
4478
- return idxResponse;
4497
+ return storedValue;
4479
4498
  }
4480
4499
  }, {
4481
4500
  key: "clearIdxResponse",
@@ -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;) {
@@ -4672,6 +4691,9 @@ var ServerStorage = function () {
4672
4691
  }();
4673
4692
  var storage = new ServerStorage(sharedStorage);
4674
4693
 
4694
+ function getStorage() {
4695
+ return storage;
4696
+ }
4675
4697
  var STORAGE_MANAGER_OPTIONS = {
4676
4698
  token: {
4677
4699
  storageTypes: ['memory']
@@ -4693,7 +4715,7 @@ function getDefaultOptions() {
4693
4715
  var options = {
4694
4716
  devMode: false,
4695
4717
  httpRequestClient: fetchRequest,
4696
- storageUtil: storage,
4718
+ storageUtil: getStorage(),
4697
4719
  storageManager: STORAGE_MANAGER_OPTIONS,
4698
4720
  transactionManager: {
4699
4721
  enableSharedStorage: enableSharedStorage
@@ -4807,9 +4829,9 @@ var request = function () {
4807
4829
  };
4808
4830
  }();
4809
4831
 
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; }
4832
+ 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; } } }; }
4833
+ 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); }
4834
+ 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
4835
  var isFieldMutable = function isFieldMutable(field) {
4814
4836
  return field.mutable !== false;
4815
4837
  };
@@ -4826,7 +4848,7 @@ var divideSingleActionParamsByMutability = function divideSingleActionParamsByMu
4826
4848
  immutableParamsForAction: immutableParamsForAction
4827
4849
  };
4828
4850
  }
4829
- var _iterator = _createForOfIteratorHelper$4(action.value),
4851
+ var _iterator = _createForOfIteratorHelper$5(action.value),
4830
4852
  _step;
4831
4853
  try {
4832
4854
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4856,7 +4878,7 @@ var divideActionParamsByMutability = function divideActionParamsByMutability(act
4856
4878
  var neededParams = [];
4857
4879
  var defaultParams = {};
4858
4880
  var immutableParams = {};
4859
- var _iterator2 = _createForOfIteratorHelper$4(actionList),
4881
+ var _iterator2 = _createForOfIteratorHelper$5(actionList),
4860
4882
  _step2;
4861
4883
  try {
4862
4884
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -4891,7 +4913,7 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4891
4913
  var target = actionDefinition.href;
4892
4914
  return function () {
4893
4915
  var _ref2 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(params) {
4894
- var headers, body, credentials;
4916
+ var headers, body, credentials, response, responseJSON, requestDidSucceed, idxResponse;
4895
4917
  return _regeneratorRuntime.wrap(function _callee$(_context) {
4896
4918
  while (1) {
4897
4919
  switch (_context.prev = _context.next) {
@@ -4902,29 +4924,32 @@ var generateDirectFetch = function generateDirectFetch(_ref) {
4902
4924
  };
4903
4925
  body = _JSON$stringify(_Object$assign(_Object$assign(_Object$assign({}, defaultParamsForAction), params), immutableParamsForAction));
4904
4926
  credentials = toPersist && toPersist.withCredentials === false ? 'omit' : 'include';
4905
- return _context.abrupt("return", request(target, {
4927
+ _context.next = 5;
4928
+ return request(target, {
4906
4929
  method: actionDefinition.method,
4907
4930
  headers: headers,
4908
4931
  body: body,
4909
4932
  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:
4933
+ });
4934
+ case 5:
4935
+ response = _context.sent;
4936
+ _context.next = 8;
4937
+ return response.json();
4938
+ case 8:
4939
+ responseJSON = _context.sent;
4940
+ requestDidSucceed = response.ok;
4941
+ idxResponse = makeIdxState$1(responseJSON, toPersist, requestDidSucceed);
4942
+ if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm="Okta Device"') {
4943
+ idxResponse.stepUp = true;
4944
+ }
4945
+ if (requestDidSucceed) {
4946
+ _context.next = 14;
4947
+ break;
4948
+ }
4949
+ throw idxResponse;
4950
+ case 14:
4951
+ return _context.abrupt("return", idxResponse);
4952
+ case 15:
4928
4953
  case "end":
4929
4954
  return _context.stop();
4930
4955
  }
@@ -5059,9 +5084,8 @@ var parseIdxResponse = function parseIdxResponse(idxResponse) {
5059
5084
  };
5060
5085
  };
5061
5086
 
5062
- function makeIdxState$1(idxResponse, toPersist) {
5063
- var _context2;
5064
- var _a;
5087
+ function makeIdxState$1(idxResponse, toPersist, requestDidSucceed) {
5088
+ var _a, _b, _c;
5065
5089
  var rawIdxResponse = idxResponse;
5066
5090
  var _parseIdxResponse = parseIdxResponse(idxResponse, toPersist),
5067
5091
  remediations = _parseIdxResponse.remediations,
@@ -5102,7 +5126,7 @@ function makeIdxState$1(idxResponse, toPersist) {
5102
5126
  var findCode = function findCode(item) {
5103
5127
  return item.name === 'interaction_code';
5104
5128
  };
5105
- var interactionCode = (_a = rawIdxResponse.successWithInteractionCode) === null || _a === void 0 ? void 0 : _findInstanceProperty(_context2 = _a.value).call(_context2, findCode).value;
5129
+ 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
5130
  return {
5107
5131
  proceed: proceed,
5108
5132
  neededToProceed: neededToProceed,
@@ -5110,7 +5134,8 @@ function makeIdxState$1(idxResponse, toPersist) {
5110
5134
  context: context,
5111
5135
  rawIdxState: rawIdxResponse,
5112
5136
  interactionCode: interactionCode,
5113
- toPersist: toPersist
5137
+ toPersist: toPersist,
5138
+ requestDidSucceed: requestDidSucceed
5114
5139
  };
5115
5140
  }
5116
5141
 
@@ -5141,14 +5166,9 @@ function validateVersionConfig(version) {
5141
5166
  parsersForVersion(version);
5142
5167
  }
5143
5168
 
5144
- var parseAndReject$1 = function parseAndReject(response) {
5145
- return response.json().then(function (err) {
5146
- return _Promise.reject(err);
5147
- });
5148
- };
5149
5169
  var introspect$1 = function () {
5150
5170
  var _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
5151
- var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials;
5171
+ var withCredentials, domain, interactionHandle, stateHandle, version, target, body, headers, credentials, response, requestDidSucceed, rawIdxResponse;
5152
5172
  return _regeneratorRuntime.wrap(function _callee$(_context) {
5153
5173
  while (1) {
5154
5174
  switch (_context.prev = _context.next) {
@@ -5166,14 +5186,27 @@ var introspect$1 = function () {
5166
5186
  accept: "application/ion+json; okta-version=".concat(version)
5167
5187
  };
5168
5188
  credentials = withCredentials === false ? 'omit' : 'include';
5169
- return _context.abrupt("return", request(target, {
5189
+ _context.next = 8;
5190
+ return request(target, {
5170
5191
  credentials: credentials,
5171
5192
  headers: headers,
5172
5193
  body: _JSON$stringify(body)
5173
- }).then(function (response) {
5174
- return response.ok ? response.json() : parseAndReject$1(response);
5175
- }));
5176
- case 7:
5194
+ });
5195
+ case 8:
5196
+ response = _context.sent;
5197
+ requestDidSucceed = response.ok;
5198
+ _context.next = 12;
5199
+ return response.json();
5200
+ case 12:
5201
+ rawIdxResponse = _context.sent;
5202
+ if (requestDidSucceed) {
5203
+ _context.next = 15;
5204
+ break;
5205
+ }
5206
+ throw rawIdxResponse;
5207
+ case 15:
5208
+ return _context.abrupt("return", rawIdxResponse);
5209
+ case 16:
5177
5210
  case "end":
5178
5211
  return _context.stop();
5179
5212
  }
@@ -5252,131 +5285,9 @@ var interact$1 = function () {
5252
5285
  }();
5253
5286
 
5254
5287
  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;
5288
+ var _parsersForVersion = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION),
5289
+ makeIdxState = _parsersForVersion.makeIdxState;
5378
5290
  var idx = {
5379
- start: start,
5380
5291
  introspect: introspect$1,
5381
5292
  interact: interact$1,
5382
5293
  makeIdxState: makeIdxState,
@@ -5613,6 +5524,8 @@ function _introspect() {
5613
5524
  _introspect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
5614
5525
  var options,
5615
5526
  rawIdxResponse,
5527
+ requestDidSucceed,
5528
+ savedIdxResponse,
5616
5529
  version,
5617
5530
  domain,
5618
5531
  withCredentials,
@@ -5622,47 +5535,53 @@ function _introspect() {
5622
5535
  switch (_context.prev = _context.next) {
5623
5536
  case 0:
5624
5537
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
5625
- rawIdxResponse = authClient.transactionManager.loadIdxResponse();
5538
+ savedIdxResponse = authClient.transactionManager.loadIdxResponse();
5539
+ if (savedIdxResponse) {
5540
+ rawIdxResponse = savedIdxResponse.rawIdxResponse;
5541
+ requestDidSucceed = savedIdxResponse.requestDidSucceed;
5542
+ }
5626
5543
  if (rawIdxResponse) {
5627
- _context.next = 18;
5544
+ _context.next = 21;
5628
5545
  break;
5629
5546
  }
5630
5547
  version = options.version || IDX_API_VERSION;
5631
5548
  domain = getOAuthDomain(authClient);
5632
- _context.prev = 5;
5633
- _context.next = 8;
5549
+ _context.prev = 6;
5550
+ _context.next = 9;
5634
5551
  return idx.introspect(_Object$assign(_Object$assign({
5635
5552
  domain: domain
5636
5553
  }, options), {
5637
5554
  version: version
5638
5555
  }));
5639
- case 8:
5556
+ case 9:
5640
5557
  rawIdxResponse = _context.sent;
5641
- _context.next = 18;
5558
+ requestDidSucceed = true;
5559
+ _context.next = 21;
5642
5560
  break;
5643
- case 11:
5644
- _context.prev = 11;
5645
- _context.t0 = _context["catch"](5);
5561
+ case 13:
5562
+ _context.prev = 13;
5563
+ _context.t0 = _context["catch"](6);
5646
5564
  if (!isRawIdxResponse(_context.t0)) {
5647
- _context.next = 17;
5565
+ _context.next = 20;
5648
5566
  break;
5649
5567
  }
5650
5568
  rawIdxResponse = _context.t0;
5651
- _context.next = 18;
5569
+ requestDidSucceed = false;
5570
+ _context.next = 21;
5652
5571
  break;
5653
- case 17:
5572
+ case 20:
5654
5573
  throw _context.t0;
5655
- case 18:
5574
+ case 21:
5656
5575
  withCredentials = options.withCredentials;
5657
5576
  return _context.abrupt("return", idx.makeIdxState(rawIdxResponse, {
5658
5577
  withCredentials: withCredentials
5659
- }));
5660
- case 20:
5578
+ }, requestDidSucceed));
5579
+ case 23:
5661
5580
  case "end":
5662
5581
  return _context.stop();
5663
5582
  }
5664
5583
  }
5665
- }, _callee, null, [[5, 11]]);
5584
+ }, _callee, null, [[6, 13]]);
5666
5585
  }));
5667
5586
  return _introspect.apply(this, arguments);
5668
5587
  }
@@ -5693,42 +5612,91 @@ function getAuthenticatorFromRemediation(remediation) {
5693
5612
  });
5694
5613
  }
5695
5614
 
5615
+ 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; } } }; }
5616
+ 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); }
5617
+ 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; }
5618
+ function formatAuthenticator(incoming) {
5619
+ var authenticator;
5620
+ if (isAuthenticator(incoming)) {
5621
+ authenticator = incoming;
5622
+ } else if (typeof incoming === 'string') {
5623
+ authenticator = {
5624
+ key: incoming
5625
+ };
5626
+ } else {
5627
+ throw new Error('Invalid format for authenticator');
5628
+ }
5629
+ return authenticator;
5630
+ }
5631
+ function compareAuthenticators(auth1, auth2) {
5632
+ if (!auth1 || !auth2) {
5633
+ return false;
5634
+ }
5635
+ if (auth1.id && auth2.id) {
5636
+ return auth1.id === auth2.id;
5637
+ }
5638
+ if (auth1.key && auth2.key) {
5639
+ return auth1.key === auth2.key;
5640
+ }
5641
+ return false;
5642
+ }
5643
+ function findMatchedOption(authenticators, options) {
5644
+ var option;
5645
+ var _iterator = _createForOfIteratorHelper$4(authenticators),
5646
+ _step;
5647
+ try {
5648
+ var _loop = function _loop() {
5649
+ var authenticator = _step.value;
5650
+ option = _findInstanceProperty(options).call(options, function (_ref) {
5651
+ var relatesTo = _ref.relatesTo;
5652
+ return relatesTo.key === authenticator.key;
5653
+ });
5654
+ if (option) {
5655
+ return "break";
5656
+ }
5657
+ };
5658
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5659
+ var _ret = _loop();
5660
+ if (_ret === "break") break;
5661
+ }
5662
+ } catch (err) {
5663
+ _iterator.e(err);
5664
+ } finally {
5665
+ _iterator.f();
5666
+ }
5667
+ return option;
5668
+ }
5669
+
5696
5670
  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); }
5671
+ 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
5672
  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
5673
  var Remediator = function () {
5700
5674
  function Remediator(remediation) {
5701
5675
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5676
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5702
5677
  _classCallCheck(this, Remediator);
5703
5678
  this.values = _Object$assign({}, values);
5679
+ this.options = _Object$assign({}, options);
5704
5680
  this.formatAuthenticators();
5705
5681
  this.remediation = remediation;
5706
5682
  }
5707
5683
  _createClass(Remediator, [{
5708
5684
  key: "formatAuthenticators",
5709
5685
  value: function formatAuthenticators() {
5710
- var _this = this,
5711
- _context2,
5712
- _context3;
5686
+ var _context2, _context3;
5713
5687
  _valuesInstanceProperty(this).authenticators = _valuesInstanceProperty(this).authenticators || [];
5688
+ _valuesInstanceProperty(this).authenticators = _mapInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticators).call(_context2, function (authenticator) {
5689
+ return formatAuthenticator(authenticator);
5690
+ });
5714
5691
  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;
5692
+ var authenticator = formatAuthenticator(_valuesInstanceProperty(this).authenticator);
5693
+ var hasAuthenticatorInList = _valuesInstanceProperty(this).authenticators.some(function (existing) {
5694
+ return compareAuthenticators(authenticator, existing);
5720
5695
  });
5721
5696
  if (!hasAuthenticatorInList) {
5722
- _valuesInstanceProperty(this).authenticators.push({
5723
- key: _valuesInstanceProperty(this).authenticator
5724
- });
5697
+ _valuesInstanceProperty(this).authenticators.push(authenticator);
5725
5698
  }
5726
5699
  }
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
5700
  _valuesInstanceProperty(this).authenticatorsData = _reduceInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (acc, authenticator) {
5733
5701
  if (_typeof(authenticator) === 'object' && _Object$keys(authenticator).length > 1) {
5734
5702
  acc.push(authenticator);
@@ -5744,13 +5712,10 @@ var Remediator = function () {
5744
5712
  }, {
5745
5713
  key: "canRemediate",
5746
5714
  value: function canRemediate() {
5747
- var _this2 = this;
5748
- if (!_mapInstanceProperty(this)) {
5749
- return false;
5750
- }
5715
+ var _this = this;
5751
5716
  var required = getRequiredValues(this.remediation);
5752
5717
  var needed = _findInstanceProperty(required).call(required, function (key) {
5753
- return !_this2.hasData(key);
5718
+ return !_this.hasData(key);
5754
5719
  });
5755
5720
  if (needed) {
5756
5721
  return false;
@@ -5760,48 +5725,41 @@ var Remediator = function () {
5760
5725
  }, {
5761
5726
  key: "getData",
5762
5727
  value: function getData(key) {
5763
- var _this3 = this;
5728
+ var _this2 = this;
5764
5729
  if (!key) {
5765
5730
  var allValues = getAllValues(this.remediation);
5766
5731
  var res = _reduceInstanceProperty(allValues).call(allValues, function (data, key) {
5767
- data[key] = _this3.getData(key);
5732
+ data[key] = _this2.getData(key);
5768
5733
  return data;
5769
5734
  }, {});
5770
5735
  return res;
5771
5736
  }
5772
5737
  if (typeof this["map".concat(titleCase(key))] === 'function') {
5773
5738
  var _context4;
5774
- return this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5739
+ var val = this["map".concat(titleCase(key))](_findInstanceProperty(_context4 = this.remediation.value).call(_context4, function (_ref) {
5775
5740
  var name = _ref.name;
5776
5741
  return name === key;
5777
5742
  }));
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
5743
  if (val) {
5789
5744
  return val;
5790
5745
  }
5791
5746
  }
5747
+ if (_mapInstanceProperty(this) && _mapInstanceProperty(this)[key]) {
5748
+ var entry = _mapInstanceProperty(this)[key];
5749
+ for (var i = 0; i < entry.length; i++) {
5750
+ var _val = _valuesInstanceProperty(this)[entry[i]];
5751
+ if (_val) {
5752
+ return _val;
5753
+ }
5754
+ }
5755
+ }
5756
+ return _valuesInstanceProperty(this)[key];
5792
5757
  }
5793
5758
  }, {
5794
5759
  key: "hasData",
5795
5760
  value: function hasData(key
5796
5761
  ) {
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;
5762
+ return !!this.getData(key);
5805
5763
  }
5806
5764
  }, {
5807
5765
  key: "getNextStep",
@@ -5822,43 +5780,38 @@ var Remediator = function () {
5822
5780
  }, {
5823
5781
  key: "getInputs",
5824
5782
  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
- }
5783
+ var _this3 = this;
5784
+ var inputs = [];
5785
+ var inputsFromRemediation = this.remediation.value || [];
5786
+ inputsFromRemediation.forEach(function (inputFromRemediation) {
5838
5787
  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);
5788
+ var name = inputFromRemediation.name,
5789
+ type = inputFromRemediation.type,
5790
+ visible = inputFromRemediation.visible;
5791
+ if (visible === false) {
5792
+ return;
5793
+ }
5794
+ if (typeof _this3["getInput".concat(titleCase(name))] === 'function') {
5795
+ input = _this3["getInput".concat(titleCase(name))](inputFromRemediation);
5843
5796
  } else if (type !== 'object') {
5844
- var name;
5797
+ var alias;
5798
+ var aliases = (_mapInstanceProperty(_this3) ? _mapInstanceProperty(_this3)[name] : null) || [];
5845
5799
  if (aliases.length === 1) {
5846
- name = aliases[0];
5800
+ alias = aliases[0];
5847
5801
  } else {
5848
- name = _findInstanceProperty(aliases).call(aliases, function (name) {
5849
- var _context8;
5850
- return _includesInstanceProperty(_context8 = _Object$keys(_valuesInstanceProperty(_this4))).call(_context8, name);
5802
+ alias = _findInstanceProperty(aliases).call(aliases, function (name) {
5803
+ var _context5;
5804
+ return _includesInstanceProperty(_context5 = _Object$keys(_valuesInstanceProperty(_this3))).call(_context5, name);
5851
5805
  });
5852
5806
  }
5853
- if (name) {
5807
+ if (alias) {
5854
5808
  input = _Object$assign(_Object$assign({}, inputFromRemediation), {
5855
- name: name
5809
+ name: alias
5856
5810
  });
5857
5811
  }
5858
5812
  }
5859
5813
  if (!input) {
5860
- var _context9;
5861
- throw new AuthSdkError(_concatInstanceProperty(_context9 = "Missing custom getInput".concat(titleCase(key), " method in Remediator: ")).call(_context9, _this4.getName()));
5814
+ input = inputFromRemediation;
5862
5815
  }
5863
5816
  if (Array.isArray(input)) {
5864
5817
  input.forEach(function (i) {
@@ -5867,8 +5820,8 @@ var Remediator = function () {
5867
5820
  } else {
5868
5821
  inputs.push(input);
5869
5822
  }
5870
- return inputs;
5871
- }, []);
5823
+ });
5824
+ return inputs;
5872
5825
  }
5873
5826
  }, {
5874
5827
  key: "getValuesAfterProceed",
@@ -5892,21 +5845,41 @@ var Remediator = function () {
5892
5845
  }, {
5893
5846
  key: "getAuthenticator",
5894
5847
  value: function getAuthenticator() {
5895
- var _a;
5896
- return (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5848
+ var _context6, _context7;
5849
+ var _a, _b;
5850
+ var relatesTo = (_a = this.remediation.relatesTo) === null || _a === void 0 ? void 0 : _a.value;
5851
+ if (!relatesTo) {
5852
+ return;
5853
+ }
5854
+ var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
5855
+ if (!authenticatorFromRemediation) {
5856
+ return relatesTo;
5857
+ }
5858
+ var id = _findInstanceProperty(_context6 = authenticatorFromRemediation.form.value).call(_context6, function (_ref2) {
5859
+ var name = _ref2.name;
5860
+ return name === 'id';
5861
+ }).value;
5862
+ var enrollmentId = (_b = _findInstanceProperty(_context7 = authenticatorFromRemediation.form.value).call(_context7, function (_ref3) {
5863
+ var name = _ref3.name;
5864
+ return name === 'enrollmentId';
5865
+ })) === null || _b === void 0 ? void 0 : _b.value;
5866
+ return _Object$assign(_Object$assign({}, relatesTo), {
5867
+ id: id,
5868
+ enrollmentId: enrollmentId
5869
+ });
5897
5870
  }
5898
5871
  }], [{
5899
5872
  key: "getMessages",
5900
5873
  value: function getMessages(remediation) {
5901
- var _context10;
5874
+ var _context8;
5902
5875
  var _a, _b;
5903
5876
  if (!remediation.value) {
5904
5877
  return;
5905
5878
  }
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) {
5879
+ 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
5880
  if (field.messages) {
5908
- var _context11;
5909
- messages = _concatInstanceProperty(_context11 = []).call(_context11, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5881
+ var _context9;
5882
+ messages = _concatInstanceProperty(_context9 = []).call(_context9, _toConsumableArray(messages), _toConsumableArray(field.messages.value));
5910
5883
  }
5911
5884
  return messages;
5912
5885
  }, []);
@@ -5932,13 +5905,19 @@ var VerificationCodeAuthenticator = function (_Authenticator) {
5932
5905
  _createClass(VerificationCodeAuthenticator, [{
5933
5906
  key: "canVerify",
5934
5907
  value: function canVerify(values) {
5935
- return !!(values.verificationCode || values.otp);
5908
+ return !!(values.credentials || values.verificationCode || values.otp);
5936
5909
  }
5937
5910
  }, {
5938
5911
  key: "mapCredentials",
5939
5912
  value: function mapCredentials(values) {
5940
- return {
5941
- passcode: values.verificationCode || values.otp
5913
+ var credentials = values.credentials,
5914
+ verificationCode = values.verificationCode,
5915
+ otp = values.otp;
5916
+ if (!credentials && !verificationCode && !otp) {
5917
+ return;
5918
+ }
5919
+ return credentials || {
5920
+ passcode: verificationCode || otp
5942
5921
  };
5943
5922
  }
5944
5923
  }, {
@@ -5967,8 +5946,12 @@ var OktaVerifyTotp = function (_VerificationCodeAuth) {
5967
5946
  _createClass(OktaVerifyTotp, [{
5968
5947
  key: "mapCredentials",
5969
5948
  value: function mapCredentials(values) {
5949
+ var verificationCode = values.verificationCode;
5950
+ if (!verificationCode) {
5951
+ return;
5952
+ }
5970
5953
  return {
5971
- totp: values.verificationCode
5954
+ totp: verificationCode
5972
5955
  };
5973
5956
  }
5974
5957
  }]);
@@ -5987,13 +5970,18 @@ var OktaPassword = function (_Authenticator) {
5987
5970
  _createClass(OktaPassword, [{
5988
5971
  key: "canVerify",
5989
5972
  value: function canVerify(values) {
5990
- return !!values.password;
5973
+ return !!(values.credentials || values.password);
5991
5974
  }
5992
5975
  }, {
5993
5976
  key: "mapCredentials",
5994
5977
  value: function mapCredentials(values) {
5995
- return {
5996
- passcode: values.password
5978
+ var credentials = values.credentials,
5979
+ password = values.password;
5980
+ if (!credentials && !password) {
5981
+ return;
5982
+ }
5983
+ return credentials || {
5984
+ passcode: password
5997
5985
  };
5998
5986
  }
5999
5987
  }, {
@@ -6022,6 +6010,10 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6022
6010
  _createClass(SecurityQuestionEnrollment, [{
6023
6011
  key: "canVerify",
6024
6012
  value: function canVerify(values) {
6013
+ var credentials = values.credentials;
6014
+ if (credentials && credentials.questionKey && credentials.answer) {
6015
+ return true;
6016
+ }
6025
6017
  var questionKey = values.questionKey,
6026
6018
  question = values.question,
6027
6019
  answer = values.answer;
@@ -6033,6 +6025,9 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6033
6025
  var questionKey = values.questionKey,
6034
6026
  question = values.question,
6035
6027
  answer = values.answer;
6028
+ if (!questionKey && !question && !answer) {
6029
+ return;
6030
+ }
6036
6031
  return {
6037
6032
  questionKey: question ? 'custom' : questionKey,
6038
6033
  question: question,
@@ -6045,7 +6040,7 @@ var SecurityQuestionEnrollment = function (_Authenticator) {
6045
6040
  return [{
6046
6041
  name: 'questionKey',
6047
6042
  type: 'string',
6048
- require: true
6043
+ required: true
6049
6044
  }, {
6050
6045
  name: 'question',
6051
6046
  type: 'string',
@@ -6078,9 +6073,13 @@ var SecurityQuestionVerification = function (_Authenticator) {
6078
6073
  }, {
6079
6074
  key: "mapCredentials",
6080
6075
  value: function mapCredentials(values) {
6076
+ var answer = values.answer;
6077
+ if (!answer) {
6078
+ return;
6079
+ }
6081
6080
  return {
6082
6081
  questionKey: this.meta.contextualData.enrolledQuestion.questionKey,
6083
- answer: values.answer
6082
+ answer: answer
6084
6083
  };
6085
6084
  }
6086
6085
  }, {
@@ -6118,6 +6117,9 @@ var WebauthnEnrollment = function (_Authenticator) {
6118
6117
  value: function mapCredentials(values) {
6119
6118
  var clientData = values.clientData,
6120
6119
  attestation = values.attestation;
6120
+ if (!clientData && !attestation) {
6121
+ return;
6122
+ }
6121
6123
  return {
6122
6124
  clientData: clientData,
6123
6125
  attestation: attestation
@@ -6167,6 +6169,9 @@ var WebauthnVerification = function (_Authenticator) {
6167
6169
  var authenticatorData = values.authenticatorData,
6168
6170
  clientData = values.clientData,
6169
6171
  signatureData = values.signatureData;
6172
+ if (!authenticatorData && !clientData && !signatureData) {
6173
+ return;
6174
+ }
6170
6175
  return {
6171
6176
  authenticatorData: authenticatorData,
6172
6177
  clientData: clientData,
@@ -6236,9 +6241,6 @@ var VerifyAuthenticator = function (_Remediator) {
6236
6241
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6237
6242
  _classCallCheck(this, VerifyAuthenticator);
6238
6243
  _this = _super.call(this, remediation, values);
6239
- _this.map = {
6240
- 'credentials': []
6241
- };
6242
6244
  _this.authenticator = getAuthenticator(remediation);
6243
6245
  return _this;
6244
6246
  }
@@ -6267,6 +6269,19 @@ var VerifyAuthenticator = function (_Remediator) {
6267
6269
  value: function getInputCredentials(input) {
6268
6270
  return this.authenticator.getInputs(input);
6269
6271
  }
6272
+ }, {
6273
+ key: "getValuesAfterProceed",
6274
+ value: function getValuesAfterProceed() {
6275
+ var _context,
6276
+ _this2 = this;
6277
+ this.values = _get(_getPrototypeOf(VerifyAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6278
+ var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6279
+ return valueKey !== 'credentials';
6280
+ });
6281
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6282
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6283
+ }, {});
6284
+ }
6270
6285
  }]);
6271
6286
  return VerifyAuthenticator;
6272
6287
  }(Remediator);
@@ -6296,7 +6311,7 @@ var EnrollPoll = function (_Remediator) {
6296
6311
  _createClass(EnrollPoll, [{
6297
6312
  key: "canRemediate",
6298
6313
  value: function canRemediate() {
6299
- return Boolean(_valuesInstanceProperty(this).startPolling);
6314
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'enroll-poll';
6300
6315
  }
6301
6316
  }, {
6302
6317
  key: "getNextStep",
@@ -6404,14 +6419,8 @@ var EnrollmentChannelData = function (_Remediator) {
6404
6419
  _inherits(EnrollmentChannelData, _Remediator);
6405
6420
  var _super = _createSuper$h(EnrollmentChannelData);
6406
6421
  function EnrollmentChannelData() {
6407
- var _this;
6408
6422
  _classCallCheck(this, EnrollmentChannelData);
6409
- _this = _super.apply(this, arguments);
6410
- _this.map = {
6411
- email: [],
6412
- phoneNumber: []
6413
- };
6414
- return _this;
6423
+ return _super.apply(this, arguments);
6415
6424
  }
6416
6425
  _createClass(EnrollmentChannelData, [{
6417
6426
  key: "getInputEmail",
@@ -6460,13 +6469,13 @@ var EnrollmentChannelData = function (_Remediator) {
6460
6469
  key: "getValuesAfterProceed",
6461
6470
  value: function getValuesAfterProceed() {
6462
6471
  var _context,
6463
- _this2 = this;
6472
+ _this = this;
6464
6473
  var trimmedValues = _filterInstanceProperty(_context = _Object$keys(_valuesInstanceProperty(this))).call(_context, function (valueKey) {
6465
6474
  var _context2;
6466
6475
  return !_includesInstanceProperty(_context2 = ['email', 'phoneNumber']).call(_context2, valueKey);
6467
6476
  });
6468
6477
  return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
6469
- return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
6478
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this)[valueKey]));
6470
6479
  }, {});
6471
6480
  }
6472
6481
  }]);
@@ -6496,6 +6505,12 @@ var ChallengePoll = function (_EnrollPoll) {
6496
6505
  _classCallCheck(this, ChallengePoll);
6497
6506
  return _super.apply(this, arguments);
6498
6507
  }
6508
+ _createClass(ChallengePoll, [{
6509
+ key: "canRemediate",
6510
+ value: function canRemediate() {
6511
+ return !!_valuesInstanceProperty(this).startPolling || this.options.step === 'challenge-poll';
6512
+ }
6513
+ }]);
6499
6514
  return ChallengePoll;
6500
6515
  }(EnrollPoll);
6501
6516
  ChallengePoll.remediationName = 'challenge-poll';
@@ -6519,19 +6534,17 @@ var EnrollProfile = function (_Remediator) {
6519
6534
  _inherits(EnrollProfile, _Remediator);
6520
6535
  var _super = _createSuper$d(EnrollProfile);
6521
6536
  function EnrollProfile() {
6522
- var _this;
6523
6537
  _classCallCheck(this, EnrollProfile);
6524
- _this = _super.apply(this, arguments);
6525
- _this.map = {
6526
- 'userProfile': []
6527
- };
6528
- return _this;
6538
+ return _super.apply(this, arguments);
6529
6539
  }
6530
6540
  _createClass(EnrollProfile, [{
6531
6541
  key: "canRemediate",
6532
6542
  value: function canRemediate() {
6533
6543
  var _context, _context2;
6534
6544
  var userProfileFromValues = this.getData().userProfile;
6545
+ if (!userProfileFromValues) {
6546
+ return false;
6547
+ }
6535
6548
  var userProfileFromRemediation = _findInstanceProperty(_context = this.remediation.value).call(_context, function (_ref) {
6536
6549
  var name = _ref.name;
6537
6550
  return name === 'userProfile';
@@ -6546,15 +6559,19 @@ var EnrollProfile = function (_Remediator) {
6546
6559
  }, {
6547
6560
  key: "mapUserProfile",
6548
6561
  value: function mapUserProfile(_ref2) {
6549
- var _this2 = this;
6562
+ var _this = this;
6550
6563
  var profileAttributes = _ref2.form.value;
6551
6564
  var attributeNames = _mapInstanceProperty(profileAttributes).call(profileAttributes, function (_ref3) {
6552
6565
  var name = _ref3.name;
6553
6566
  return name;
6554
6567
  });
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;
6568
+ var data = _reduceInstanceProperty(attributeNames).call(attributeNames, function (attributeValues, attributeName) {
6569
+ return _valuesInstanceProperty(_this)[attributeName] ? _Object$assign(_Object$assign({}, attributeValues), _defineProperty({}, attributeName, _valuesInstanceProperty(_this)[attributeName])) : attributeValues;
6557
6570
  }, {});
6571
+ if (_Object$keys(data).length === 0) {
6572
+ return;
6573
+ }
6574
+ return data;
6558
6575
  }
6559
6576
  }, {
6560
6577
  key: "getInputUserProfile",
@@ -6587,9 +6604,7 @@ var Identify = function (_Remediator) {
6587
6604
  _classCallCheck(this, Identify);
6588
6605
  _this = _super.apply(this, arguments);
6589
6606
  _this.map = {
6590
- 'identifier': ['username'],
6591
- 'credentials': [],
6592
- 'rememberMe': ['rememberMe']
6607
+ 'identifier': ['username']
6593
6608
  };
6594
6609
  return _this;
6595
6610
  }
@@ -6603,8 +6618,14 @@ var Identify = function (_Remediator) {
6603
6618
  }, {
6604
6619
  key: "mapCredentials",
6605
6620
  value: function mapCredentials() {
6606
- return {
6607
- passcode: _valuesInstanceProperty(this).password
6621
+ var _this$values = _valuesInstanceProperty(this),
6622
+ credentials = _this$values.credentials,
6623
+ password = _this$values.password;
6624
+ if (!credentials && !password) {
6625
+ return;
6626
+ }
6627
+ return credentials || {
6628
+ passcode: password
6608
6629
  };
6609
6630
  }
6610
6631
  }, {
@@ -6626,19 +6647,18 @@ var ReEnrollAuthenticator = function (_Remediator) {
6626
6647
  _inherits(ReEnrollAuthenticator, _Remediator);
6627
6648
  var _super = _createSuper$b(ReEnrollAuthenticator);
6628
6649
  function ReEnrollAuthenticator() {
6629
- var _this;
6630
6650
  _classCallCheck(this, ReEnrollAuthenticator);
6631
- _this = _super.apply(this, arguments);
6632
- _this.map = {
6633
- 'credentials': []
6634
- };
6635
- return _this;
6651
+ return _super.apply(this, arguments);
6636
6652
  }
6637
6653
  _createClass(ReEnrollAuthenticator, [{
6638
6654
  key: "mapCredentials",
6639
6655
  value: function mapCredentials() {
6656
+ var newPassword = _valuesInstanceProperty(this).newPassword;
6657
+ if (!newPassword) {
6658
+ return;
6659
+ }
6640
6660
  return {
6641
- passcode: _valuesInstanceProperty(this).newPassword
6661
+ passcode: newPassword
6642
6662
  };
6643
6663
  }
6644
6664
  }, {
@@ -6698,17 +6718,13 @@ var SelectAuthenticator = function (_Remediator) {
6698
6718
  _inherits(SelectAuthenticator, _Remediator);
6699
6719
  var _super = _createSuper$9(SelectAuthenticator);
6700
6720
  function SelectAuthenticator() {
6701
- var _this;
6702
6721
  _classCallCheck(this, SelectAuthenticator);
6703
- _this = _super.apply(this, arguments);
6704
- _this.map = {
6705
- authenticator: []
6706
- };
6707
- return _this;
6722
+ return _super.apply(this, arguments);
6708
6723
  }
6709
6724
  _createClass(SelectAuthenticator, [{
6710
6725
  key: "findMatchedOption",
6711
- value: function findMatchedOption(authenticators, options) {
6726
+ value:
6727
+ function findMatchedOption(authenticators, options) {
6712
6728
  var option;
6713
6729
  var _iterator = _createForOfIteratorHelper$2(authenticators),
6714
6730
  _step;
@@ -6737,12 +6753,17 @@ var SelectAuthenticator = function (_Remediator) {
6737
6753
  }, {
6738
6754
  key: "canRemediate",
6739
6755
  value: function canRemediate() {
6740
- var authenticators = _valuesInstanceProperty(this).authenticators;
6756
+ var _this$values = _valuesInstanceProperty(this),
6757
+ authenticators = _this$values.authenticators,
6758
+ authenticator = _this$values.authenticator;
6741
6759
  var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
6742
6760
  var options = authenticatorFromRemediation.options;
6743
6761
  if (!authenticators || !authenticators.length) {
6744
6762
  return false;
6745
6763
  }
6764
+ if (isAuthenticator(authenticator) && authenticator.id) {
6765
+ return true;
6766
+ }
6746
6767
  var matchedOption = this.findMatchedOption(authenticators, options);
6747
6768
  if (matchedOption) {
6748
6769
  return true;
@@ -6772,9 +6793,15 @@ var SelectAuthenticator = function (_Remediator) {
6772
6793
  key: "mapAuthenticator",
6773
6794
  value: function mapAuthenticator(remediationValue) {
6774
6795
  var _context2;
6775
- var authenticators = _valuesInstanceProperty(this).authenticators;
6796
+ var _this$values2 = _valuesInstanceProperty(this),
6797
+ authenticators = _this$values2.authenticators,
6798
+ authenticator = _this$values2.authenticator;
6799
+ if (isAuthenticator(authenticator) && authenticator.id) {
6800
+ this.selectedAuthenticator = authenticator;
6801
+ return authenticator;
6802
+ }
6776
6803
  var options = remediationValue.options;
6777
- var selectedOption = this.findMatchedOption(authenticators, options);
6804
+ var selectedOption = findMatchedOption(authenticators, options);
6778
6805
  this.selectedAuthenticator = selectedOption.relatesTo;
6779
6806
  this.selectedOption = selectedOption;
6780
6807
  return {
@@ -6796,10 +6823,10 @@ var SelectAuthenticator = function (_Remediator) {
6796
6823
  key: "getValuesAfterProceed",
6797
6824
  value: function getValuesAfterProceed() {
6798
6825
  var _context3,
6799
- _this2 = this;
6826
+ _this = this;
6800
6827
  this.values = _get(_getPrototypeOf(SelectAuthenticator.prototype), "getValuesAfterProceed", this).call(this);
6801
6828
  var authenticators = _filterInstanceProperty(_context3 = _valuesInstanceProperty(this).authenticators).call(_context3, function (authenticator) {
6802
- return authenticator.key !== _this2.selectedAuthenticator.key;
6829
+ return compareAuthenticators(authenticator, _this.selectedAuthenticator) !== true;
6803
6830
  });
6804
6831
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
6805
6832
  authenticators: authenticators
@@ -6817,14 +6844,16 @@ var SelectAuthenticatorAuthenticate = function (_SelectAuthenticator) {
6817
6844
  function SelectAuthenticatorAuthenticate(remediation) {
6818
6845
  var _this;
6819
6846
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6847
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6820
6848
  _classCallCheck(this, SelectAuthenticatorAuthenticate);
6821
6849
  var _a;
6822
- _this = _super.call(this, remediation, values);
6850
+ _this = _super.call(this, remediation, values, options);
6851
+ var isRecoveryFlow = _this.options.flow === 'recoverPassword';
6823
6852
  var hasPasswordInOptions = (_a = getAuthenticatorFromRemediation(remediation).options) === null || _a === void 0 ? void 0 : _a.some(function (_ref) {
6824
6853
  var relatesTo = _ref.relatesTo;
6825
6854
  return (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.key) === AuthenticatorKey.OKTA_PASSWORD;
6826
6855
  });
6827
- if (hasPasswordInOptions && (_valuesInstanceProperty(_this).flow === 'recoverPassword' || _valuesInstanceProperty(_this).password)) {
6856
+ if (hasPasswordInOptions && (isRecoveryFlow || _valuesInstanceProperty(_this).password)) {
6828
6857
  var _context;
6829
6858
  _valuesInstanceProperty(_this).authenticators = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_valuesInstanceProperty(_this).authenticators || []), [{
6830
6859
  key: AuthenticatorKey.OKTA_PASSWORD
@@ -6859,7 +6888,6 @@ var SelectAuthenticatorUnlockAccount = function (_SelectAuthenticator) {
6859
6888
  _classCallCheck(this, SelectAuthenticatorUnlockAccount);
6860
6889
  _this = _super.apply(this, arguments);
6861
6890
  _this.map = {
6862
- authenticator: [],
6863
6891
  identifier: ['username']
6864
6892
  };
6865
6893
  return _this;
@@ -6930,9 +6958,6 @@ var AuthenticatorData = function (_Remediator) {
6930
6958
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6931
6959
  _classCallCheck(this, AuthenticatorData);
6932
6960
  _this = _super.call(this, remediation, values);
6933
- _this.map = {
6934
- 'authenticator': []
6935
- };
6936
6961
  _this.authenticator = _this.getAuthenticator();
6937
6962
  _this.formatAuthenticatorData();
6938
6963
  return _this;
@@ -6945,7 +6970,7 @@ var AuthenticatorData = function (_Remediator) {
6945
6970
  if (authenticatorData) {
6946
6971
  var _context;
6947
6972
  _valuesInstanceProperty(this).authenticatorsData = _mapInstanceProperty(_context = _valuesInstanceProperty(this).authenticatorsData).call(_context, function (data) {
6948
- if (data.key === _this2.authenticator.key) {
6973
+ if (compareAuthenticators(_this2.authenticator, data)) {
6949
6974
  return _this2.mapAuthenticatorDataFromValues(data);
6950
6975
  }
6951
6976
  return data;
@@ -6962,9 +6987,8 @@ var AuthenticatorData = function (_Remediator) {
6962
6987
  value: function getAuthenticatorData() {
6963
6988
  var _context2,
6964
6989
  _this3 = this;
6965
- return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (_ref) {
6966
- var key = _ref.key;
6967
- return key === _this3.authenticator.key;
6990
+ return _findInstanceProperty(_context2 = _valuesInstanceProperty(this).authenticatorsData).call(_context2, function (data) {
6991
+ return compareAuthenticators(_this3.authenticator, data);
6968
6992
  });
6969
6993
  }
6970
6994
  }, {
@@ -6972,7 +6996,7 @@ var AuthenticatorData = function (_Remediator) {
6972
6996
  value: function canRemediate() {
6973
6997
  var _this4 = this;
6974
6998
  return _valuesInstanceProperty(this).authenticatorsData.some(function (data) {
6975
- return data.key === _this4.authenticator.key;
6999
+ return compareAuthenticators(_this4.authenticator, data);
6976
7000
  });
6977
7001
  }
6978
7002
  }, {
@@ -6987,9 +7011,18 @@ var AuthenticatorData = function (_Remediator) {
6987
7011
  }, {
6988
7012
  key: "mapAuthenticatorDataFromValues",
6989
7013
  value: function mapAuthenticatorDataFromValues(authenticatorData) {
6990
- var methodType = _valuesInstanceProperty(this).methodType;
7014
+ var _this$values = _valuesInstanceProperty(this),
7015
+ methodType = _this$values.methodType,
7016
+ authenticator = _this$values.authenticator;
7017
+ if (!methodType && isAuthenticator(authenticator)) {
7018
+ methodType = authenticator === null || authenticator === void 0 ? void 0 : authenticator.methodType;
7019
+ }
7020
+ var _this$authenticator = this.authenticator,
7021
+ id = _this$authenticator.id,
7022
+ enrollmentId = _this$authenticator.enrollmentId;
6991
7023
  var data = _Object$assign(_Object$assign({
6992
- key: this.authenticator.key
7024
+ id: id,
7025
+ enrollmentId: enrollmentId
6993
7026
  }, authenticatorData && authenticatorData), methodType && {
6994
7027
  methodType: methodType
6995
7028
  });
@@ -6999,8 +7032,8 @@ var AuthenticatorData = function (_Remediator) {
6999
7032
  key: "getAuthenticatorFromRemediation",
7000
7033
  value: function getAuthenticatorFromRemediation() {
7001
7034
  var _context3;
7002
- var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref2) {
7003
- var name = _ref2.name;
7035
+ var authenticator = _findInstanceProperty(_context3 = this.remediation.value).call(_context3, function (_ref) {
7036
+ var name = _ref.name;
7004
7037
  return name === 'authenticator';
7005
7038
  });
7006
7039
  return authenticator;
@@ -7011,8 +7044,8 @@ var AuthenticatorData = function (_Remediator) {
7011
7044
  var _context4;
7012
7045
  var _a;
7013
7046
  var authenticator = this.getAuthenticatorFromRemediation();
7014
- return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
7015
- var name = _ref3.name;
7047
+ return (_a = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref2) {
7048
+ var name = _ref2.name;
7016
7049
  return name === 'methodType';
7017
7050
  })) === null || _a === void 0 ? void 0 : _a.options;
7018
7051
  }
@@ -7023,7 +7056,7 @@ var AuthenticatorData = function (_Remediator) {
7023
7056
  _this5 = this;
7024
7057
  this.values = _get(_getPrototypeOf(AuthenticatorData.prototype), "getValuesAfterProceed", this).call(this);
7025
7058
  var authenticatorsData = _filterInstanceProperty(_context5 = _valuesInstanceProperty(this).authenticatorsData).call(_context5, function (data) {
7026
- return data.key !== _this5.authenticator.key;
7059
+ return compareAuthenticators(_this5.authenticator, data) !== true;
7027
7060
  });
7028
7061
  return _Object$assign(_Object$assign({}, _valuesInstanceProperty(this)), {
7029
7062
  authenticatorsData: authenticatorsData
@@ -7057,12 +7090,10 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7057
7090
  }, {
7058
7091
  key: "mapAuthenticator",
7059
7092
  value: function mapAuthenticator() {
7060
- var _context2, _context3;
7061
- var _a, _b;
7062
- var authenticatorData = this.getAuthenticatorData();
7063
- var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
7093
+ var _a;
7064
7094
  if (this.shouldProceedWithEmailAuthenticator) {
7065
7095
  var _context;
7096
+ var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
7066
7097
  return (_a = authenticatorFromRemediation.form) === null || _a === void 0 ? void 0 : _reduceInstanceProperty(_context = _a.value).call(_context, function (acc, curr) {
7067
7098
  if (curr.value) {
7068
7099
  acc[curr.name] = curr.value;
@@ -7074,25 +7105,15 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7074
7105
  return acc;
7075
7106
  }, {});
7076
7107
  }
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
- };
7108
+ return this.getAuthenticatorData();
7088
7109
  }
7089
7110
  }, {
7090
7111
  key: "getInputAuthenticator",
7091
7112
  value: function getInputAuthenticator() {
7092
- var _context4;
7113
+ var _context2;
7093
7114
  var authenticator = this.getAuthenticatorFromRemediation();
7094
- var methodType = _findInstanceProperty(_context4 = authenticator.form.value).call(_context4, function (_ref3) {
7095
- var name = _ref3.name;
7115
+ var methodType = _findInstanceProperty(_context2 = authenticator.form.value).call(_context2, function (_ref) {
7116
+ var name = _ref.name;
7096
7117
  return name === 'methodType';
7097
7118
  });
7098
7119
  if (methodType && methodType.options) {
@@ -7105,6 +7126,19 @@ var AuthenticatorVerificationData = function (_AuthenticatorData) {
7105
7126
  var inputs = _toConsumableArray(authenticator.form.value);
7106
7127
  return inputs;
7107
7128
  }
7129
+ }, {
7130
+ key: "getValuesAfterProceed",
7131
+ value: function getValuesAfterProceed() {
7132
+ var _context3,
7133
+ _this2 = this;
7134
+ this.values = _get(_getPrototypeOf(AuthenticatorVerificationData.prototype), "getValuesAfterProceed", this).call(this);
7135
+ var trimmedValues = _filterInstanceProperty(_context3 = _Object$keys(_valuesInstanceProperty(this))).call(_context3, function (valueKey) {
7136
+ return valueKey !== 'authenticator';
7137
+ });
7138
+ return _reduceInstanceProperty(trimmedValues).call(trimmedValues, function (values, valueKey) {
7139
+ return _Object$assign(_Object$assign({}, values), _defineProperty({}, valueKey, _valuesInstanceProperty(_this2)[valueKey]));
7140
+ }, {});
7141
+ }
7108
7142
  }]);
7109
7143
  return AuthenticatorVerificationData;
7110
7144
  }(AuthenticatorData);
@@ -7153,10 +7187,12 @@ var AuthenticatorEnrollmentData = function (_AuthenticatorData) {
7153
7187
  value: function mapAuthenticatorDataFromValues(data) {
7154
7188
  data = _get(_getPrototypeOf(AuthenticatorEnrollmentData.prototype), "mapAuthenticatorDataFromValues", this).call(this, data);
7155
7189
  var phoneNumber = _valuesInstanceProperty(this).phoneNumber;
7156
- data = _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7190
+ if (!data && !phoneNumber) {
7191
+ return;
7192
+ }
7193
+ return _Object$assign(_Object$assign({}, data && data), phoneNumber && {
7157
7194
  phoneNumber: phoneNumber
7158
7195
  });
7159
- return data.phoneNumber && data.methodType ? data : null;
7160
7196
  }
7161
7197
  }]);
7162
7198
  return AuthenticatorEnrollmentData;
@@ -7169,18 +7205,13 @@ var Skip = function (_Remediator) {
7169
7205
  _inherits(Skip, _Remediator);
7170
7206
  var _super = _createSuper$1(Skip);
7171
7207
  function Skip() {
7172
- var _this;
7173
7208
  _classCallCheck(this, Skip);
7174
- _this = _super.apply(this, arguments);
7175
- _this.map = {
7176
- skip: ['skip']
7177
- };
7178
- return _this;
7209
+ return _super.apply(this, arguments);
7179
7210
  }
7180
7211
  _createClass(Skip, [{
7181
7212
  key: "canRemediate",
7182
7213
  value: function canRemediate() {
7183
- return !!_valuesInstanceProperty(this).skip;
7214
+ return !!_valuesInstanceProperty(this).skip || this.options.step === 'skip';
7184
7215
  }
7185
7216
  }]);
7186
7217
  return Skip;
@@ -7211,52 +7242,16 @@ var remediators = /*#__PURE__*/Object.freeze({
7211
7242
  });
7212
7243
 
7213
7244
  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); }
7245
+ 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
7246
  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
7247
  function isTerminalResponse(idxResponse) {
7253
7248
  var neededToProceed = idxResponse.neededToProceed,
7254
7249
  interactionCode = idxResponse.interactionCode;
7255
7250
  return !neededToProceed.length && !interactionCode;
7256
7251
  }
7257
7252
  function canSkipFn(idxResponse) {
7258
- return idxResponse.neededToProceed.some(function (_ref2) {
7259
- var name = _ref2.name;
7253
+ return idxResponse.neededToProceed.some(function (_ref) {
7254
+ var name = _ref.name;
7260
7255
  return name === 'skip';
7261
7256
  });
7262
7257
  }
@@ -7265,28 +7260,124 @@ function canResendFn(idxResponse) {
7265
7260
  return _includesInstanceProperty(actionName).call(actionName, 'resend');
7266
7261
  });
7267
7262
  }
7268
- function getIdxMessages(idxResponse) {
7269
- var _context2;
7263
+ function getMessagesFromIdxRemediationValue(value) {
7264
+ if (!value || !Array.isArray(value)) {
7265
+ return;
7266
+ }
7267
+ return _reduceInstanceProperty(value).call(value, function (messages, value) {
7268
+ if (value.messages) {
7269
+ var _context;
7270
+ messages = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(messages), _toConsumableArray(value.messages.value));
7271
+ }
7272
+ if (value.form) {
7273
+ var _context2;
7274
+ var messagesFromForm = getMessagesFromIdxRemediationValue(value.form.value) || [];
7275
+ messages = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(messages), _toConsumableArray(messagesFromForm));
7276
+ }
7277
+ if (value.options) {
7278
+ var _context4;
7279
+ var optionValues = [];
7280
+ value.options.forEach(function (option) {
7281
+ var _context3;
7282
+ if (!option.value || typeof option.value === 'string') {
7283
+ return;
7284
+ }
7285
+ optionValues = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(optionValues), [option.value]);
7286
+ });
7287
+ var messagesFromOptions = getMessagesFromIdxRemediationValue(optionValues) || [];
7288
+ messages = _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(messages), _toConsumableArray(messagesFromOptions));
7289
+ }
7290
+ return messages;
7291
+ }, []);
7292
+ }
7293
+ function getMessagesFromResponse(idxResponse) {
7294
+ var _context5;
7270
7295
  var _a;
7271
7296
  var messages = [];
7272
7297
  var rawIdxState = idxResponse.rawIdxState,
7273
7298
  neededToProceed = idxResponse.neededToProceed;
7274
- var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context2 = _a.value).call(_context2, function (message) {
7299
+ var globalMessages = (_a = rawIdxState.messages) === null || _a === void 0 ? void 0 : _mapInstanceProperty(_context5 = _a.value).call(_context5, function (message) {
7275
7300
  return message;
7276
7301
  });
7277
7302
  if (globalMessages) {
7278
- var _context3;
7279
- messages = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7303
+ var _context6;
7304
+ messages = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(messages), _toConsumableArray(globalMessages));
7280
7305
  }
7281
- var _iterator2 = _createForOfIteratorHelper$1(neededToProceed),
7306
+ var _iterator = _createForOfIteratorHelper$1(neededToProceed),
7307
+ _step;
7308
+ try {
7309
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7310
+ var remediation = _step.value;
7311
+ var fieldMessages = getMessagesFromIdxRemediationValue(remediation.value);
7312
+ if (fieldMessages) {
7313
+ var _context8;
7314
+ messages = _concatInstanceProperty(_context8 = []).call(_context8, _toConsumableArray(messages), _toConsumableArray(fieldMessages));
7315
+ }
7316
+ }
7317
+ } catch (err) {
7318
+ _iterator.e(err);
7319
+ } finally {
7320
+ _iterator.f();
7321
+ }
7322
+ var seen = {};
7323
+ messages = _reduceInstanceProperty(messages).call(messages, function (filtered, message) {
7324
+ var _context7;
7325
+ var _a;
7326
+ var key = (_a = message.i18n) === null || _a === void 0 ? void 0 : _a.key;
7327
+ if (key && seen[key]) {
7328
+ return filtered;
7329
+ }
7330
+ seen[key] = message;
7331
+ filtered = _concatInstanceProperty(_context7 = []).call(_context7, _toConsumableArray(filtered), [message]);
7332
+ return filtered;
7333
+ }, []);
7334
+ return messages;
7335
+ }
7336
+ function getEnabledFeatures(idxResponse) {
7337
+ var res = [];
7338
+ var actions = idxResponse.actions,
7339
+ neededToProceed = idxResponse.neededToProceed;
7340
+ if (actions['currentAuthenticator-recover']) {
7341
+ res.push(IdxFeature.PASSWORD_RECOVERY);
7342
+ }
7343
+ if (neededToProceed.some(function (_ref2) {
7344
+ var name = _ref2.name;
7345
+ return name === 'select-enroll-profile';
7346
+ })) {
7347
+ res.push(IdxFeature.REGISTRATION);
7348
+ }
7349
+ if (neededToProceed.some(function (_ref3) {
7350
+ var name = _ref3.name;
7351
+ return name === 'redirect-idp';
7352
+ })) {
7353
+ res.push(IdxFeature.SOCIAL_IDP);
7354
+ }
7355
+ if (neededToProceed.some(function (_ref4) {
7356
+ var name = _ref4.name;
7357
+ return name === 'unlock-account';
7358
+ })) {
7359
+ res.push(IdxFeature.ACCOUNT_UNLOCK);
7360
+ }
7361
+ return res;
7362
+ }
7363
+ function getAvailableSteps(idxResponse) {
7364
+ var _context9;
7365
+ var res = [];
7366
+ var remediatorMap = _reduceInstanceProperty(_context9 = _Object$values(remediators)).call(_context9, function (map, remediatorClass) {
7367
+ if (remediatorClass.remediationName) {
7368
+ map[remediatorClass.remediationName] = remediatorClass;
7369
+ }
7370
+ return map;
7371
+ }, {});
7372
+ var _iterator2 = _createForOfIteratorHelper$1(idxResponse.neededToProceed),
7282
7373
  _step2;
7283
7374
  try {
7284
7375
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
7285
7376
  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));
7377
+ var T = remediatorMap[remediation.name];
7378
+ if (T) {
7379
+ var remediator = new T(remediation);
7380
+ res.push(remediator.getNextStep(idxResponse.context));
7290
7381
  }
7291
7382
  }
7292
7383
  } catch (err) {
@@ -7294,7 +7385,61 @@ function getIdxMessages(idxResponse) {
7294
7385
  } finally {
7295
7386
  _iterator2.f();
7296
7387
  }
7297
- return messages;
7388
+ return res;
7389
+ }
7390
+ function filterValuesForRemediation(idxResponse, values) {
7391
+ var _context10;
7392
+ var valuesForRemediation = _reduceInstanceProperty(_context10 = idxResponse.neededToProceed[0].value).call(_context10, function (res, entry) {
7393
+ var name = entry.name;
7394
+ res[name] = values[name];
7395
+ return res;
7396
+ }, {});
7397
+ return valuesForRemediation;
7398
+ }
7399
+
7400
+ 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; } } }; }
7401
+ 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); }
7402
+ 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; }
7403
+ function getRemediator(idxRemediations, values, options) {
7404
+ var remediators = options.remediators;
7405
+ var remediator;
7406
+ if (options.step) {
7407
+ var remediation = _findInstanceProperty(idxRemediations).call(idxRemediations, function (_ref) {
7408
+ var name = _ref.name;
7409
+ return name === options.step;
7410
+ });
7411
+ if (remediation) {
7412
+ var T = remediation ? remediators[remediation.name] : undefined;
7413
+ return T ? new T(remediation, values, options) : undefined;
7414
+ } else {
7415
+ warn("step \"".concat(options.step, "\" did not match any remediations"));
7416
+ return;
7417
+ }
7418
+ }
7419
+ var remediatorCandidates = [];
7420
+ var _iterator = _createForOfIteratorHelper(idxRemediations),
7421
+ _step;
7422
+ try {
7423
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
7424
+ var _context;
7425
+ var _remediation = _step.value;
7426
+ var isRemeditionInFlow = _includesInstanceProperty(_context = _Object$keys(remediators)).call(_context, _remediation.name);
7427
+ if (!isRemeditionInFlow) {
7428
+ continue;
7429
+ }
7430
+ var _T = remediators[_remediation.name];
7431
+ remediator = new _T(_remediation, values, options);
7432
+ if (remediator.canRemediate()) {
7433
+ return remediator;
7434
+ }
7435
+ remediatorCandidates.push(remediator);
7436
+ }
7437
+ } catch (err) {
7438
+ _iterator.e(err);
7439
+ } finally {
7440
+ _iterator.f();
7441
+ }
7442
+ return remediatorCandidates[0];
7298
7443
  }
7299
7444
  function getNextStep(remediator, idxResponse) {
7300
7445
  var nextStep = remediator.getNextStep(idxResponse.context);
@@ -7307,20 +7452,23 @@ function getNextStep(remediator, idxResponse) {
7307
7452
  });
7308
7453
  }
7309
7454
  function handleIdxError(e, remediator) {
7310
- var idxState = isIdxResponse(e) ? e : null;
7311
- if (!idxState) {
7455
+ var idxResponse = isIdxResponse(e) ? e : null;
7456
+ if (!idxResponse) {
7312
7457
  throw e;
7313
7458
  }
7314
- var terminal = isTerminalResponse(idxState);
7315
- var messages = getIdxMessages(idxState);
7459
+ idxResponse.requestDidSucceed = false;
7460
+ var terminal = isTerminalResponse(idxResponse);
7461
+ var messages = getMessagesFromResponse(idxResponse);
7316
7462
  if (terminal) {
7317
7463
  return {
7464
+ idxResponse: idxResponse,
7318
7465
  terminal: terminal,
7319
7466
  messages: messages
7320
7467
  };
7321
7468
  } else {
7322
- var nextStep = remediator && getNextStep(remediator, idxState);
7469
+ var nextStep = remediator && getNextStep(remediator, idxResponse);
7323
7470
  return _Object$assign({
7471
+ idxResponse: idxResponse,
7324
7472
  messages: messages
7325
7473
  }, nextStep && {
7326
7474
  nextStep: nextStep
@@ -7328,8 +7476,8 @@ function handleIdxError(e, remediator) {
7328
7476
  }
7329
7477
  }
7330
7478
  function getActionFromValues(values, idxResponse) {
7331
- var _context5;
7332
- return _findInstanceProperty(_context5 = _Object$keys(idxResponse.actions)).call(_context5, function (action) {
7479
+ var _context2;
7480
+ return _findInstanceProperty(_context2 = _Object$keys(idxResponse.actions)).call(_context2, function (action) {
7333
7481
  return !!values.resend && _includesInstanceProperty(action).call(action, '-resend');
7334
7482
  });
7335
7483
  }
@@ -7342,198 +7490,230 @@ function remediate(_x, _x2, _x3) {
7342
7490
  }
7343
7491
  function _remediate() {
7344
7492
  _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) {
7493
+ var _context3;
7494
+ var _idxResponse, neededToProceed, interactionCode, flow, terminal, messages, remediator, actionFromValues, actionFromOptions, actions, _iterator2, _step2, _loop, _ret, nextStep, _nextStep, name, data;
7495
+ return _regeneratorRuntime.wrap(function _callee$(_context5) {
7348
7496
  while (1) {
7349
- switch (_context8.prev = _context8.next) {
7497
+ switch (_context5.prev = _context5.next) {
7350
7498
  case 0:
7351
7499
  _idxResponse = idxResponse, neededToProceed = _idxResponse.neededToProceed, interactionCode = _idxResponse.interactionCode;
7352
- remediators = options.remediators, flow = options.flow;
7500
+ flow = options.flow;
7353
7501
  if (!interactionCode) {
7354
- _context8.next = 4;
7502
+ _context5.next = 4;
7355
7503
  break;
7356
7504
  }
7357
- return _context8.abrupt("return", {
7505
+ return _context5.abrupt("return", {
7358
7506
  idxResponse: idxResponse
7359
7507
  });
7360
7508
  case 4:
7361
7509
  terminal = isTerminalResponse(idxResponse);
7362
- messages = getIdxMessages(idxResponse);
7510
+ messages = getMessagesFromResponse(idxResponse);
7363
7511
  if (!terminal) {
7364
- _context8.next = 8;
7512
+ _context5.next = 8;
7365
7513
  break;
7366
7514
  }
7367
- return _context8.abrupt("return", {
7515
+ return _context5.abrupt("return", {
7516
+ idxResponse: idxResponse,
7368
7517
  terminal: terminal,
7369
7518
  messages: messages
7370
7519
  });
7371
7520
  case 8:
7521
+ remediator = getRemediator(neededToProceed, values, options);
7372
7522
  actionFromValues = getActionFromValues(values, idxResponse);
7373
- actions = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(options.actions || []), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7523
+ actionFromOptions = options.actions || [];
7524
+ actions = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(actionFromOptions), _toConsumableArray(actionFromValues && [actionFromValues] || []));
7374
7525
  if (!actions) {
7375
- _context8.next = 30;
7526
+ _context5.next = 32;
7376
7527
  break;
7377
7528
  }
7378
- _iterator3 = _createForOfIteratorHelper$1(actions);
7379
- _context8.prev = 12;
7529
+ _iterator2 = _createForOfIteratorHelper(actions);
7530
+ _context5.prev = 14;
7380
7531
  _loop = _regeneratorRuntime.mark(function _loop() {
7381
- var action, valuesWithoutExecutedAction, remediationAction;
7382
- return _regeneratorRuntime.wrap(function _loop$(_context7) {
7532
+ var action, valuesWithoutExecutedAction, optionsWithoutExecutedAction, remediationAction;
7533
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
7383
7534
  while (1) {
7384
- switch (_context7.prev = _context7.next) {
7535
+ switch (_context4.prev = _context4.next) {
7385
7536
  case 0:
7386
- action = _step3.value;
7537
+ action = _step2.value;
7387
7538
  valuesWithoutExecutedAction = removeActionFromValues(values);
7539
+ optionsWithoutExecutedAction = _Object$assign(_Object$assign({}, options), {
7540
+ actions: _filterInstanceProperty(actionFromOptions).call(actionFromOptions, function (entry) {
7541
+ return entry !== action;
7542
+ })
7543
+ });
7388
7544
  if (!(typeof idxResponse.actions[action] === 'function')) {
7389
- _context7.next = 15;
7545
+ _context4.next = 17;
7390
7546
  break;
7391
7547
  }
7392
- _context7.prev = 3;
7393
- _context7.next = 6;
7548
+ _context4.prev = 4;
7549
+ _context4.next = 7;
7394
7550
  return idxResponse.actions[action]();
7395
- case 6:
7396
- idxResponse = _context7.sent;
7397
- _context7.next = 12;
7551
+ case 7:
7552
+ idxResponse = _context4.sent;
7553
+ idxResponse.requestDidSucceed = true;
7554
+ _context4.next = 14;
7398
7555
  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)
7556
+ case 11:
7557
+ _context4.prev = 11;
7558
+ _context4.t0 = _context4["catch"](4);
7559
+ return _context4.abrupt("return", {
7560
+ v: handleIdxError(_context4.t0, remediator)
7404
7561
  });
7405
- case 12:
7562
+ case 14:
7406
7563
  if (!(action === 'cancel')) {
7407
- _context7.next = 14;
7564
+ _context4.next = 16;
7408
7565
  break;
7409
7566
  }
7410
- return _context7.abrupt("return", {
7567
+ return _context4.abrupt("return", {
7411
7568
  v: {
7569
+ idxResponse: idxResponse,
7412
7570
  canceled: true
7413
7571
  }
7414
7572
  });
7415
- case 14:
7416
- return _context7.abrupt("return", {
7417
- v: remediate(idxResponse, valuesWithoutExecutedAction, options)
7573
+ case 16:
7574
+ return _context4.abrupt("return", {
7575
+ v: remediate(idxResponse, valuesWithoutExecutedAction, optionsWithoutExecutedAction)
7418
7576
  });
7419
- case 15:
7420
- remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref3) {
7421
- var name = _ref3.name;
7577
+ case 17:
7578
+ remediationAction = _findInstanceProperty(neededToProceed).call(neededToProceed, function (_ref2) {
7579
+ var name = _ref2.name;
7422
7580
  return name === action;
7423
7581
  });
7424
7582
  if (!remediationAction) {
7425
- _context7.next = 27;
7583
+ _context4.next = 30;
7426
7584
  break;
7427
7585
  }
7428
- _context7.prev = 17;
7429
- _context7.next = 20;
7586
+ _context4.prev = 19;
7587
+ _context4.next = 22;
7430
7588
  return idxResponse.proceed(action, {});
7431
- case 20:
7432
- idxResponse = _context7.sent;
7433
- _context7.next = 26;
7589
+ case 22:
7590
+ idxResponse = _context4.sent;
7591
+ idxResponse.requestDidSucceed = true;
7592
+ _context4.next = 29;
7434
7593
  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
7594
  case 26:
7442
- return _context7.abrupt("return", {
7443
- v: remediate(idxResponse, values, options)
7595
+ _context4.prev = 26;
7596
+ _context4.t1 = _context4["catch"](19);
7597
+ return _context4.abrupt("return", {
7598
+ v: handleIdxError(_context4.t1, remediator)
7444
7599
  });
7445
- case 27:
7600
+ case 29:
7601
+ return _context4.abrupt("return", {
7602
+ v: remediate(idxResponse, values, optionsWithoutExecutedAction)
7603
+ });
7604
+ case 30:
7446
7605
  case "end":
7447
- return _context7.stop();
7606
+ return _context4.stop();
7448
7607
  }
7449
7608
  }
7450
- }, _loop, null, [[3, 9], [17, 23]]);
7609
+ }, _loop, null, [[4, 11], [19, 26]]);
7451
7610
  });
7452
- _iterator3.s();
7453
- case 15:
7454
- if ((_step3 = _iterator3.n()).done) {
7455
- _context8.next = 22;
7611
+ _iterator2.s();
7612
+ case 17:
7613
+ if ((_step2 = _iterator2.n()).done) {
7614
+ _context5.next = 24;
7456
7615
  break;
7457
7616
  }
7458
- return _context8.delegateYield(_loop(), "t0", 17);
7459
- case 17:
7460
- _ret = _context8.t0;
7617
+ return _context5.delegateYield(_loop(), "t0", 19);
7618
+ case 19:
7619
+ _ret = _context5.t0;
7461
7620
  if (!(_typeof(_ret) === "object")) {
7462
- _context8.next = 20;
7621
+ _context5.next = 22;
7463
7622
  break;
7464
7623
  }
7465
- return _context8.abrupt("return", _ret.v);
7466
- case 20:
7467
- _context8.next = 15;
7468
- break;
7624
+ return _context5.abrupt("return", _ret.v);
7469
7625
  case 22:
7470
- _context8.next = 27;
7626
+ _context5.next = 17;
7471
7627
  break;
7472
7628
  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:
7481
- remediator = getRemediator(neededToProceed, values, options);
7482
- if (!(!remediator && flow === 'default')) {
7483
- _context8.next = 33;
7629
+ _context5.next = 29;
7630
+ break;
7631
+ case 26:
7632
+ _context5.prev = 26;
7633
+ _context5.t1 = _context5["catch"](14);
7634
+ _iterator2.e(_context5.t1);
7635
+ case 29:
7636
+ _context5.prev = 29;
7637
+ _iterator2.f();
7638
+ return _context5.finish(29);
7639
+ case 32:
7640
+ if (remediator) {
7641
+ _context5.next = 49;
7484
7642
  break;
7485
7643
  }
7486
- return _context8.abrupt("return", {
7644
+ if (!options.step) {
7645
+ _context5.next = 46;
7646
+ break;
7647
+ }
7648
+ values = filterValuesForRemediation(idxResponse, values);
7649
+ _context5.prev = 35;
7650
+ _context5.next = 38;
7651
+ return idxResponse.proceed(options.step, values);
7652
+ case 38:
7653
+ idxResponse = _context5.sent;
7654
+ idxResponse.requestDidSucceed = true;
7655
+ return _context5.abrupt("return", {
7487
7656
  idxResponse: idxResponse
7488
7657
  });
7489
- case 33:
7490
- if (remediator) {
7491
- _context8.next = 35;
7658
+ case 43:
7659
+ _context5.prev = 43;
7660
+ _context5.t2 = _context5["catch"](35);
7661
+ return _context5.abrupt("return", handleIdxError(_context5.t2));
7662
+ case 46:
7663
+ if (!(flow === 'default')) {
7664
+ _context5.next = 48;
7492
7665
  break;
7493
7666
  }
7667
+ return _context5.abrupt("return", {
7668
+ idxResponse: idxResponse
7669
+ });
7670
+ case 48:
7494
7671
  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
7672
  return acc ? acc + ' ,' + curr.name : curr.name;
7496
7673
  }, ''), "]\n "));
7497
- case 35:
7674
+ case 49:
7498
7675
  if (!messages.length) {
7499
- _context8.next = 38;
7676
+ _context5.next = 52;
7500
7677
  break;
7501
7678
  }
7502
7679
  nextStep = getNextStep(remediator, idxResponse);
7503
- return _context8.abrupt("return", {
7680
+ return _context5.abrupt("return", {
7681
+ idxResponse: idxResponse,
7504
7682
  nextStep: nextStep,
7505
7683
  messages: messages
7506
7684
  });
7507
- case 38:
7685
+ case 52:
7508
7686
  if (remediator.canRemediate()) {
7509
- _context8.next = 41;
7687
+ _context5.next = 55;
7510
7688
  break;
7511
7689
  }
7512
7690
  _nextStep = getNextStep(remediator, idxResponse);
7513
- return _context8.abrupt("return", {
7691
+ return _context5.abrupt("return", {
7514
7692
  idxResponse: idxResponse,
7515
7693
  nextStep: _nextStep
7516
7694
  });
7517
- case 41:
7695
+ case 55:
7518
7696
  name = remediator.getName();
7519
7697
  data = remediator.getData();
7520
- _context8.prev = 43;
7521
- _context8.next = 46;
7698
+ _context5.prev = 57;
7699
+ _context5.next = 60;
7522
7700
  return idxResponse.proceed(name, data);
7523
- case 46:
7524
- idxResponse = _context8.sent;
7701
+ case 60:
7702
+ idxResponse = _context5.sent;
7703
+ idxResponse.requestDidSucceed = true;
7525
7704
  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:
7705
+ delete options.step;
7706
+ return _context5.abrupt("return", remediate(idxResponse, values, options));
7707
+ case 67:
7708
+ _context5.prev = 67;
7709
+ _context5.t3 = _context5["catch"](57);
7710
+ return _context5.abrupt("return", handleIdxError(_context5.t3, remediator));
7711
+ case 70:
7532
7712
  case "end":
7533
- return _context8.stop();
7713
+ return _context5.stop();
7534
7714
  }
7535
7715
  }
7536
- }, _callee, null, [[12, 24, 27, 30], [43, 51]]);
7716
+ }, _callee, null, [[14, 26, 29, 32], [35, 43], [57, 67]]);
7537
7717
  }));
7538
7718
  return _remediate.apply(this, arguments);
7539
7719
  }
@@ -7627,148 +7807,78 @@ function getFlowSpecification(oktaAuth) {
7627
7807
  };
7628
7808
  }
7629
7809
 
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;
7810
+ function initializeValues(options) {
7811
+ var knownOptions = ['flow', 'remediators', 'actions', 'withCredentials', 'step'];
7812
+ var values = _Object$assign({}, options);
7813
+ knownOptions.forEach(function (option) {
7814
+ delete values[option];
7815
+ });
7816
+ return values;
7659
7817
  }
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;
7818
+ function initializeData(authClient, data) {
7819
+ var options = data.options;
7820
+ var flow = options.flow,
7821
+ withCredentials = options.withCredentials,
7822
+ remediators = options.remediators,
7823
+ actions = options.actions;
7824
+ var status = IdxStatus.PENDING;
7825
+ flow = flow || authClient.idx.getFlow() || 'default';
7826
+ if (flow) {
7827
+ authClient.idx.setFlow(flow);
7828
+ var flowSpec = getFlowSpecification(authClient, flow);
7829
+ withCredentials = typeof withCredentials !== 'undefined' ? withCredentials : flowSpec.withCredentials;
7830
+ remediators = remediators || flowSpec.remediators;
7831
+ actions = actions || flowSpec.actions;
7832
+ }
7833
+ return _Object$assign(_Object$assign({}, data), {
7834
+ options: _Object$assign(_Object$assign({}, options), {
7835
+ flow: flow,
7836
+ withCredentials: withCredentials,
7837
+ remediators: remediators,
7838
+ actions: actions
7839
+ }),
7840
+ status: status
7841
+ });
7686
7842
  }
7687
- function run(_x) {
7688
- return _run.apply(this, arguments);
7843
+ function getDataFromIntrospect(_x, _x2) {
7844
+ return _getDataFromIntrospect.apply(this, arguments);
7689
7845
  }
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) {
7846
+ function _getDataFromIntrospect() {
7847
+ _getDataFromIntrospect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, data) {
7848
+ var options, stateHandle, withCredentials, version, state, scopes, recoveryToken, activationToken, idxResponse, meta, interactionHandle, interactResponse;
7849
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
7743
7850
  while (1) {
7744
- switch (_context2.prev = _context2.next) {
7851
+ switch (_context.prev = _context.next) {
7745
7852
  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;
7853
+ options = data.options;
7854
+ stateHandle = options.stateHandle, withCredentials = options.withCredentials, version = options.version, state = options.state, scopes = options.scopes, recoveryToken = options.recoveryToken, activationToken = options.activationToken;
7855
+ if (!stateHandle) {
7856
+ _context.next = 8;
7857
+ break;
7759
7858
  }
7760
- metaFromResp = getSavedTransactionMeta(authClient, {
7859
+ _context.next = 5;
7860
+ return introspect(authClient, {
7861
+ withCredentials: withCredentials,
7862
+ version: version,
7863
+ stateHandle: stateHandle
7864
+ });
7865
+ case 5:
7866
+ idxResponse = _context.sent;
7867
+ _context.next = 20;
7868
+ break;
7869
+ case 8:
7870
+ meta = getSavedTransactionMeta(authClient, {
7761
7871
  state: state,
7762
7872
  recoveryToken: recoveryToken,
7763
7873
  activationToken: activationToken
7764
7874
  });
7765
- interactionHandle = metaFromResp === null || metaFromResp === void 0 ? void 0 : metaFromResp.interactionHandle;
7875
+ interactionHandle = meta === null || meta === void 0 ? void 0 : meta.interactionHandle;
7766
7876
  if (interactionHandle) {
7767
- _context2.next = 18;
7877
+ _context.next = 17;
7768
7878
  break;
7769
7879
  }
7770
7880
  authClient.transactionManager.clear();
7771
- _context2.next = 14;
7881
+ _context.next = 14;
7772
7882
  return interact(authClient, {
7773
7883
  withCredentials: withCredentials,
7774
7884
  state: state,
@@ -7777,119 +7887,288 @@ function _run() {
7777
7887
  recoveryToken: recoveryToken
7778
7888
  });
7779
7889
  case 14:
7780
- interactResponse = _context2.sent;
7890
+ interactResponse = _context.sent;
7781
7891
  interactionHandle = interactResponse.interactionHandle;
7782
- metaFromResp = interactResponse.meta;
7783
- withCredentials = metaFromResp.withCredentials;
7784
- case 18:
7785
- _context2.next = 20;
7892
+ meta = interactResponse.meta;
7893
+ case 17:
7894
+ _context.next = 19;
7786
7895
  return introspect(authClient, {
7787
7896
  withCredentials: withCredentials,
7788
7897
  version: version,
7789
7898
  interactionHandle: interactionHandle
7790
7899
  });
7900
+ case 19:
7901
+ idxResponse = _context.sent;
7791
7902
  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;
7903
+ return _context.abrupt("return", _Object$assign(_Object$assign({}, data), {
7904
+ idxResponse: idxResponse,
7905
+ meta: meta
7906
+ }));
7907
+ case 21:
7908
+ case "end":
7909
+ return _context.stop();
7910
+ }
7911
+ }
7912
+ }, _callee);
7913
+ }));
7914
+ return _getDataFromIntrospect.apply(this, arguments);
7915
+ }
7916
+ function getDataFromRemediate(_x3) {
7917
+ return _getDataFromRemediate.apply(this, arguments);
7918
+ }
7919
+ function _getDataFromRemediate() {
7920
+ _getDataFromRemediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee2(data) {
7921
+ var idxResponse, options, values, autoRemediate, remediators, actions, flow, step, shouldRemediate, _yield$remediate, idxResponseFromRemediation, nextStep, canceled;
7922
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
7923
+ while (1) {
7924
+ switch (_context2.prev = _context2.next) {
7925
+ case 0:
7926
+ idxResponse = data.idxResponse, options = data.options, values = _valuesInstanceProperty(data);
7927
+ autoRemediate = options.autoRemediate, remediators = options.remediators, actions = options.actions, flow = options.flow, step = options.step;
7928
+ shouldRemediate = autoRemediate !== false && (remediators || actions || step);
7929
+ if (shouldRemediate) {
7930
+ _context2.next = 5;
7798
7931
  break;
7799
7932
  }
7800
- values = _Object$assign(_Object$assign({}, options), {
7933
+ return _context2.abrupt("return", data);
7934
+ case 5:
7935
+ values = _Object$assign(_Object$assign({}, values), {
7801
7936
  stateHandle: idxResponse.rawIdxState.stateHandle
7802
7937
  });
7803
- _context2.next = 28;
7938
+ _context2.next = 8;
7804
7939
  return remediate(idxResponse, values, {
7805
- remediators: _remediators,
7806
- actions: _actions,
7940
+ remediators: remediators,
7941
+ actions: actions,
7807
7942
  flow: flow,
7808
7943
  step: step
7809
7944
  });
7810
- case 28:
7945
+ case 8:
7811
7946
  _yield$remediate = _context2.sent;
7812
- idxResponseFromResp = _yield$remediate.idxResponse;
7813
- nextStepFromResp = _yield$remediate.nextStep;
7814
- terminal = _yield$remediate.terminal;
7947
+ idxResponseFromRemediation = _yield$remediate.idxResponse;
7948
+ nextStep = _yield$remediate.nextStep;
7815
7949
  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);
7950
+ idxResponse = idxResponseFromRemediation;
7951
+ return _context2.abrupt("return", _Object$assign(_Object$assign({}, data), {
7952
+ idxResponse: idxResponse,
7953
+ nextStep: nextStep,
7954
+ canceled: canceled
7955
+ }));
7956
+ case 14:
7957
+ case "end":
7958
+ return _context2.stop();
7959
+ }
7960
+ }
7961
+ }, _callee2);
7962
+ }));
7963
+ return _getDataFromRemediate.apply(this, arguments);
7964
+ }
7965
+ function getTokens(_x4, _x5) {
7966
+ return _getTokens.apply(this, arguments);
7967
+ }
7968
+ function _getTokens() {
7969
+ _getTokens = _asyncToGenerator( _regeneratorRuntime.mark(function _callee3(authClient, data) {
7970
+ var meta, idxResponse, interactionCode, clientId, codeVerifier, ignoreSignature, redirectUri, urls, scopes, tokenResponse;
7971
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
7972
+ while (1) {
7973
+ switch (_context3.prev = _context3.next) {
7974
+ case 0:
7975
+ meta = data.meta, idxResponse = data.idxResponse;
7976
+ interactionCode = idxResponse.interactionCode;
7977
+ clientId = meta.clientId, codeVerifier = meta.codeVerifier, ignoreSignature = meta.ignoreSignature, redirectUri = meta.redirectUri, urls = meta.urls, scopes = meta.scopes;
7978
+ _context3.next = 5;
7979
+ return authClient.token.exchangeCodeForTokens({
7980
+ interactionCode: interactionCode,
7981
+ clientId: clientId,
7982
+ codeVerifier: codeVerifier,
7983
+ ignoreSignature: ignoreSignature,
7984
+ redirectUri: redirectUri,
7985
+ scopes: scopes
7986
+ }, urls);
7987
+ case 5:
7988
+ tokenResponse = _context3.sent;
7989
+ return _context3.abrupt("return", tokenResponse.tokens);
7990
+ case 7:
7991
+ case "end":
7992
+ return _context3.stop();
7993
+ }
7994
+ }
7995
+ }, _callee3);
7996
+ }));
7997
+ return _getTokens.apply(this, arguments);
7998
+ }
7999
+ function finalizeData(_x6, _x7) {
8000
+ return _finalizeData.apply(this, arguments);
8001
+ }
8002
+ function _finalizeData() {
8003
+ _finalizeData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee4(authClient, data) {
8004
+ var options, idxResponse, canceled, status, exchangeCodeForTokens, shouldClearTransaction, clearSharedStorage, interactionCode, tokens, enabledFeatures, availableSteps, messages, terminal;
8005
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
8006
+ while (1) {
8007
+ switch (_context4.prev = _context4.next) {
8008
+ case 0:
8009
+ options = data.options, idxResponse = data.idxResponse, canceled = data.canceled, status = data.status;
8010
+ exchangeCodeForTokens = options.exchangeCodeForTokens;
8011
+ shouldClearTransaction = false;
8012
+ clearSharedStorage = true;
8013
+ if (idxResponse) {
8014
+ enabledFeatures = getEnabledFeatures(idxResponse);
7822
8015
  availableSteps = getAvailableSteps(idxResponse);
8016
+ messages = getMessagesFromResponse(idxResponse);
8017
+ terminal = isTerminalResponse(idxResponse);
7823
8018
  }
7824
- if (terminal) {
7825
- status = IdxStatus.TERMINAL;
7826
- shouldClearTransaction = true;
7827
- clearSharedStorage = false;
8019
+ if (!terminal) {
8020
+ _context4.next = 11;
8021
+ break;
7828
8022
  }
8023
+ status = IdxStatus.TERMINAL;
8024
+ shouldClearTransaction = true;
8025
+ clearSharedStorage = false;
8026
+ _context4.next = 28;
8027
+ break;
8028
+ case 11:
7829
8029
  if (!canceled) {
7830
- _context2.next = 44;
8030
+ _context4.next = 16;
7831
8031
  break;
7832
8032
  }
7833
8033
  status = IdxStatus.CANCELED;
7834
8034
  shouldClearTransaction = true;
7835
- _context2.next = 57;
8035
+ _context4.next = 28;
7836
8036
  break;
7837
- case 44:
8037
+ case 16:
7838
8038
  if (!(idxResponse === null || idxResponse === void 0 ? void 0 : idxResponse.interactionCode)) {
7839
- _context2.next = 57;
8039
+ _context4.next = 28;
7840
8040
  break;
7841
8041
  }
7842
8042
  interactionCode = idxResponse.interactionCode;
7843
8043
  if (!(exchangeCodeForTokens === false)) {
7844
- _context2.next = 51;
8044
+ _context4.next = 23;
7845
8045
  break;
7846
8046
  }
7847
8047
  status = IdxStatus.SUCCESS;
7848
8048
  shouldClearTransaction = false;
7849
- _context2.next = 57;
8049
+ _context4.next = 28;
7850
8050
  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;
8051
+ case 23:
8052
+ _context4.next = 25;
8053
+ return getTokens(authClient, data);
8054
+ case 25:
8055
+ tokens = _context4.sent;
7864
8056
  status = IdxStatus.SUCCESS;
7865
8057
  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;
8058
+ case 28:
8059
+ return _context4.abrupt("return", _Object$assign(_Object$assign({}, data), {
8060
+ status: status,
8061
+ interactionCode: interactionCode,
8062
+ tokens: tokens,
8063
+ shouldClearTransaction: shouldClearTransaction,
8064
+ clearSharedStorage: clearSharedStorage,
8065
+ enabledFeatures: enabledFeatures,
8066
+ availableSteps: availableSteps,
8067
+ messages: messages,
8068
+ terminal: terminal
8069
+ }));
8070
+ case 29:
8071
+ case "end":
8072
+ return _context4.stop();
8073
+ }
8074
+ }
8075
+ }, _callee4);
8076
+ }));
8077
+ return _finalizeData.apply(this, arguments);
8078
+ }
8079
+ function handleError(err, data) {
8080
+ var error = data.error,
8081
+ status = data.status,
8082
+ shouldClearTransaction = data.shouldClearTransaction;
8083
+ if (isIdxResponse(err)) {
8084
+ error = err;
8085
+ status = IdxStatus.FAILURE;
8086
+ shouldClearTransaction = true;
8087
+ } else {
8088
+ throw err;
8089
+ }
8090
+ return _Object$assign(_Object$assign({}, data), {
8091
+ error: error,
8092
+ status: status,
8093
+ shouldClearTransaction: shouldClearTransaction
8094
+ });
8095
+ }
8096
+ function run(_x8) {
8097
+ return _run.apply(this, arguments);
8098
+ }
8099
+ function _run() {
8100
+ _run = _asyncToGenerator( _regeneratorRuntime.mark(function _callee5(authClient) {
8101
+ var options,
8102
+ data,
8103
+ _data,
8104
+ idxResponse,
8105
+ meta,
8106
+ shouldClearTransaction,
8107
+ clearSharedStorage,
8108
+ status,
8109
+ enabledFeatures,
8110
+ availableSteps,
8111
+ tokens,
8112
+ nextStep,
8113
+ messages,
8114
+ error,
8115
+ interactionCode,
8116
+ rawIdxResponse,
8117
+ requestDidSucceed,
8118
+ _ref,
8119
+ actions,
8120
+ context,
8121
+ neededToProceed,
8122
+ proceed,
8123
+ rawIdxState,
8124
+ _args5 = arguments;
8125
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8126
+ while (1) {
8127
+ switch (_context5.prev = _context5.next) {
8128
+ case 0:
8129
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
8130
+ data = {
8131
+ options: options,
8132
+ values: initializeValues(options)
8133
+ };
8134
+ data = initializeData(authClient, data);
8135
+ _context5.prev = 3;
8136
+ _context5.next = 6;
8137
+ return getDataFromIntrospect(authClient, data);
8138
+ case 6:
8139
+ data = _context5.sent;
8140
+ _context5.next = 9;
8141
+ return getDataFromRemediate(data);
8142
+ case 9:
8143
+ data = _context5.sent;
8144
+ _context5.next = 15;
7880
8145
  break;
7881
- case 67:
7882
- throw _context2.t0;
7883
- case 68:
8146
+ case 12:
8147
+ _context5.prev = 12;
8148
+ _context5.t0 = _context5["catch"](3);
8149
+ data = handleError(_context5.t0, data);
8150
+ case 15:
8151
+ _context5.next = 17;
8152
+ return finalizeData(authClient, data);
8153
+ case 17:
8154
+ data = _context5.sent;
8155
+ _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
8156
  if (shouldClearTransaction) {
7885
8157
  authClient.transactionManager.clear({
7886
8158
  clearSharedStorage: clearSharedStorage
7887
8159
  });
7888
- } else if (meta === null || meta === void 0 ? void 0 : meta.state) {
8160
+ } else {
7889
8161
  saveTransactionMeta(authClient, _Object$assign({}, meta));
8162
+ if (idxResponse) {
8163
+ rawIdxResponse = idxResponse.rawIdxState, requestDidSucceed = idxResponse.requestDidSucceed;
8164
+ authClient.transactionManager.saveIdxResponse({
8165
+ rawIdxResponse: rawIdxResponse,
8166
+ requestDidSucceed: requestDidSucceed
8167
+ });
8168
+ }
7890
8169
  }
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({
8170
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState;
8171
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
7893
8172
  status: status
7894
8173
  }, meta && {
7895
8174
  meta: meta
@@ -7898,10 +8177,10 @@ function _run() {
7898
8177
  }), availableSteps && {
7899
8178
  availableSteps: availableSteps
7900
8179
  }), tokens && {
7901
- tokens: tokens.tokens
8180
+ tokens: tokens
7902
8181
  }), nextStep && {
7903
8182
  nextStep: nextStep
7904
- }), messages && {
8183
+ }), messages && messages.length && {
7905
8184
  messages: messages
7906
8185
  }), error && {
7907
8186
  error: error
@@ -7913,12 +8192,12 @@ function _run() {
7913
8192
  proceed: proceed,
7914
8193
  rawIdxState: rawIdxState
7915
8194
  }));
7916
- case 71:
8195
+ case 22:
7917
8196
  case "end":
7918
- return _context2.stop();
8197
+ return _context5.stop();
7919
8198
  }
7920
8199
  }
7921
- }, _callee, null, [[4, 59]]);
8200
+ }, _callee5, null, [[3, 12]]);
7922
8201
  }));
7923
8202
  return _run.apply(this, arguments);
7924
8203
  }
@@ -8041,9 +8320,10 @@ function _handleEmailVerifyCallback() {
8041
8320
  return _handleEmailVerifyCallback.apply(this, arguments);
8042
8321
  }
8043
8322
 
8044
- function canProceed(authClient, options) {
8323
+ function canProceed(authClient) {
8324
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8045
8325
  var meta = getSavedTransactionMeta(authClient, options);
8046
- return !!meta;
8326
+ return !!(meta || options.stateHandle);
8047
8327
  }
8048
8328
  function proceed(_x) {
8049
8329
  return _proceed.apply(this, arguments);
@@ -8051,30 +8331,32 @@ function proceed(_x) {
8051
8331
  function _proceed() {
8052
8332
  _proceed = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient) {
8053
8333
  var options,
8334
+ flow,
8054
8335
  state,
8055
8336
  meta,
8056
- flow,
8057
8337
  _args = arguments;
8058
8338
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8059
8339
  while (1) {
8060
8340
  switch (_context.prev = _context.next) {
8061
8341
  case 0:
8062
8342
  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;
8343
+ if (canProceed(authClient, options)) {
8344
+ _context.next = 3;
8069
8345
  break;
8070
8346
  }
8071
8347
  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;
8348
+ case 3:
8349
+ flow = options.flow, state = options.state;
8350
+ if (!flow) {
8351
+ meta = getSavedTransactionMeta(authClient, {
8352
+ state: state
8353
+ });
8354
+ flow = meta === null || meta === void 0 ? void 0 : meta.flow;
8355
+ }
8074
8356
  return _context.abrupt("return", run(authClient, _Object$assign(_Object$assign({}, options), {
8075
8357
  flow: flow
8076
8358
  })));
8077
- case 7:
8359
+ case 6:
8078
8360
  case "end":
8079
8361
  return _context.stop();
8080
8362
  }
@@ -8272,7 +8554,7 @@ function handleInteractionCodeRedirect(_x, _x2) {
8272
8554
  }
8273
8555
  function _handleInteractionCodeRedirect() {
8274
8556
  _handleInteractionCodeRedirect = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, url) {
8275
- var meta, codeVerifier, savedState, _URL$1, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8557
+ var meta, codeVerifier, savedState, _URL, searchParams, state, interactionCode, error, _yield$authClient$tok, tokens;
8276
8558
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8277
8559
  while (1) {
8278
8560
  switch (_context.prev = _context.next) {
@@ -8285,7 +8567,7 @@ function _handleInteractionCodeRedirect() {
8285
8567
  throw new AuthSdkError('No transaction data was found in storage');
8286
8568
  case 3:
8287
8569
  codeVerifier = meta.codeVerifier, savedState = meta.state;
8288
- _URL$1 = new _URL(url), searchParams = _URL$1.searchParams;
8570
+ _URL = new _URL2(url), searchParams = _URL.searchParams;
8289
8571
  state = searchParams.get('state');
8290
8572
  interactionCode = searchParams.get('interaction_code');
8291
8573
  error = searchParams.get('error');
@@ -8388,7 +8670,7 @@ function createGlobalRequestInterceptor(sdk) {
8388
8670
  var OktaUserAgent = function () {
8389
8671
  function OktaUserAgent() {
8390
8672
  _classCallCheck(this, OktaUserAgent);
8391
- this.environments = ["okta-auth-js/".concat("6.2.0")];
8673
+ this.environments = ["okta-auth-js/".concat("6.3.2")];
8392
8674
  }
8393
8675
  _createClass(OktaUserAgent, [{
8394
8676
  key: "addEnvironment",
@@ -8406,7 +8688,7 @@ var OktaUserAgent = function () {
8406
8688
  }, {
8407
8689
  key: "getVersion",
8408
8690
  value: function getVersion() {
8409
- return "6.2.0";
8691
+ return "6.3.2";
8410
8692
  }
8411
8693
  }, {
8412
8694
  key: "maybeAddNodeEnvironment",
@@ -9273,5 +9555,5 @@ _Object$assign(OktaAuth, {
9273
9555
  constants: constants
9274
9556
  });
9275
9557
 
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 };
9558
+ 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
9559
  //# sourceMappingURL=esm.node.mjs.map