@okta/okta-auth-js 6.5.0 → 6.5.1

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.
@@ -5937,19 +5937,22 @@ var WebauthnEnrollment = function (_Authenticator) {
5937
5937
  _createClass(WebauthnEnrollment, [{
5938
5938
  key: "canVerify",
5939
5939
  value: function canVerify(values) {
5940
- var clientData = values.clientData,
5941
- attestation = values.attestation;
5940
+ var credentials = values.credentials;
5941
+ var obj = credentials || values;
5942
+ var clientData = obj.clientData,
5943
+ attestation = obj.attestation;
5942
5944
  return !!(clientData && attestation);
5943
5945
  }
5944
5946
  }, {
5945
5947
  key: "mapCredentials",
5946
5948
  value: function mapCredentials(values) {
5947
- var clientData = values.clientData,
5949
+ var credentials = values.credentials,
5950
+ clientData = values.clientData,
5948
5951
  attestation = values.attestation;
5949
- if (!clientData && !attestation) {
5952
+ if (!credentials && !clientData && !attestation) {
5950
5953
  return;
5951
5954
  }
5952
- return {
5955
+ return credentials || {
5953
5956
  clientData: clientData,
5954
5957
  attestation: attestation
5955
5958
  };
@@ -5987,21 +5990,24 @@ var WebauthnVerification = function (_Authenticator) {
5987
5990
  _createClass(WebauthnVerification, [{
5988
5991
  key: "canVerify",
5989
5992
  value: function canVerify(values) {
5990
- var clientData = values.clientData,
5991
- authenticatorData = values.authenticatorData,
5992
- signatureData = values.signatureData;
5993
+ var credentials = values.credentials;
5994
+ var obj = credentials || values;
5995
+ var clientData = obj.clientData,
5996
+ authenticatorData = obj.authenticatorData,
5997
+ signatureData = obj.signatureData;
5993
5998
  return !!(clientData && authenticatorData && signatureData);
5994
5999
  }
5995
6000
  }, {
5996
6001
  key: "mapCredentials",
5997
6002
  value: function mapCredentials(values) {
5998
- var authenticatorData = values.authenticatorData,
6003
+ var credentials = values.credentials,
6004
+ authenticatorData = values.authenticatorData,
5999
6005
  clientData = values.clientData,
6000
6006
  signatureData = values.signatureData;
6001
- if (!authenticatorData && !clientData && !signatureData) {
6007
+ if (!credentials && !authenticatorData && !clientData && !signatureData) {
6002
6008
  return;
6003
6009
  }
6004
- return {
6010
+ return credentials || {
6005
6011
  authenticatorData: authenticatorData,
6006
6012
  clientData: clientData,
6007
6013
  signatureData: signatureData
@@ -7099,19 +7105,53 @@ function hasValidInputValue(input, values) {
7099
7105
  var fn = function fn(input, values, requiredTracker) {
7100
7106
  var name = input.name,
7101
7107
  value = input.value,
7108
+ type = input.type,
7109
+ options = input.options,
7102
7110
  required = input.required;
7103
- var isRequired = required || requiredTracker
7104
- || name === 'authenticator';
7105
- if (!isRequired) {
7106
- return true;
7107
- }
7111
+ var isRequired = required || requiredTracker;
7108
7112
  if (Array.isArray(value)) {
7109
7113
  return _reduceInstanceProperty(value).call(value, function (acc, item) {
7110
7114
  return acc && fn(item, values[name], isRequired);
7111
7115
  }, true);
7112
- } else {
7113
- return !!(values && values[name]);
7114
7116
  }
7117
+ if (options) {
7118
+ if (type === 'object') {
7119
+ var _context4, _context5;
7120
+ var selectedOption = values[name];
7121
+ if (!(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id)) {
7122
+ return false;
7123
+ }
7124
+ var optionSchema = _findInstanceProperty(options).call(options, function (option) {
7125
+ var _context3;
7126
+ var idSchema = _findInstanceProperty(_context3 = option.value).call(_context3, function (_ref3) {
7127
+ var name = _ref3.name;
7128
+ return name === 'id';
7129
+ });
7130
+ return idSchema.value === selectedOption.id;
7131
+ });
7132
+ if (!optionSchema) {
7133
+ return false;
7134
+ }
7135
+ return _reduceInstanceProperty(_context4 = _filterInstanceProperty(_context5 = optionSchema.value).call(_context5, function (_ref4) {
7136
+ var required = _ref4.required;
7137
+ return !!required;
7138
+ })).call(_context4, function (acc, _ref5) {
7139
+ var name = _ref5.name;
7140
+ return acc && !!selectedOption[name];
7141
+ }, true);
7142
+ }
7143
+ if (required === false) {
7144
+ return true;
7145
+ }
7146
+ if (required === true) {
7147
+ return !!values[name];
7148
+ }
7149
+ throw new AuthSdkError("Unknown options type, ".concat(_JSON$stringify(input)));
7150
+ }
7151
+ if (!isRequired) {
7152
+ return true;
7153
+ }
7154
+ return !!(values && values[name]);
7115
7155
  };
7116
7156
  return fn(input, values, false);
7117
7157
  }
@@ -7513,30 +7553,31 @@ function getRemediator(idxRemediations, values, options) {
7513
7553
  }
7514
7554
  }
7515
7555
  var remediatorCandidates = [];
7516
- var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7517
- _step3;
7518
- try {
7519
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7520
- var _context12;
7521
- var _remediation = _step3.value;
7522
- var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7523
- if (!isRemeditionInFlow) {
7524
- continue;
7525
- }
7526
- var _T = getRemediatorClass(_remediation, options);
7527
- remediator = new _T(_remediation, values, options);
7528
- if (remediator.canRemediate()) {
7529
- return remediator;
7556
+ if (useGenericRemediator) {
7557
+ remediatorCandidates.push(new GenericRemediator(idxRemediations[0], values, options));
7558
+ } else {
7559
+ var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7560
+ _step3;
7561
+ try {
7562
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7563
+ var _context12;
7564
+ var _remediation = _step3.value;
7565
+ var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7566
+ if (!isRemeditionInFlow) {
7567
+ continue;
7568
+ }
7569
+ var _T = getRemediatorClass(_remediation, options);
7570
+ remediator = new _T(_remediation, values, options);
7571
+ if (remediator.canRemediate()) {
7572
+ return remediator;
7573
+ }
7574
+ remediatorCandidates.push(remediator);
7530
7575
  }
7531
- remediatorCandidates.push(remediator);
7576
+ } catch (err) {
7577
+ _iterator3.e(err);
7578
+ } finally {
7579
+ _iterator3.f();
7532
7580
  }
7533
- } catch (err) {
7534
- _iterator3.e(err);
7535
- } finally {
7536
- _iterator3.f();
7537
- }
7538
- if (!remediatorCandidates.length && !!idxRemediations.length && useGenericRemediator) {
7539
- return new GenericRemediator(idxRemediations[0], values, options);
7540
7581
  }
7541
7582
  return remediatorCandidates[0];
7542
7583
  }
@@ -8262,6 +8303,7 @@ function _run() {
8262
8303
  proceed,
8263
8304
  rawIdxState,
8264
8305
  requestDidSucceed,
8306
+ stepUp,
8265
8307
  _args5 = arguments;
8266
8308
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8267
8309
  while (1) {
@@ -8310,8 +8352,8 @@ function _run() {
8310
8352
  });
8311
8353
  }
8312
8354
  }
8313
- _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed;
8314
- return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8355
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed, stepUp = _ref.stepUp;
8356
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8315
8357
  status: status
8316
8358
  }, meta && {
8317
8359
  meta: meta
@@ -8327,6 +8369,8 @@ function _run() {
8327
8369
  messages: messages
8328
8370
  }), error && {
8329
8371
  error: error
8372
+ }), stepUp && {
8373
+ stepUp: stepUp
8330
8374
  }), {
8331
8375
  interactionCode: interactionCode,
8332
8376
  actions: actions,
@@ -8752,7 +8796,7 @@ function _unlockAccount() {
8752
8796
  var OktaUserAgent = function () {
8753
8797
  function OktaUserAgent() {
8754
8798
  _classCallCheck(this, OktaUserAgent);
8755
- this.environments = ["okta-auth-js/".concat("6.5.0")];
8799
+ this.environments = ["okta-auth-js/".concat("6.5.1")];
8756
8800
  }
8757
8801
  _createClass(OktaUserAgent, [{
8758
8802
  key: "addEnvironment",
@@ -8770,7 +8814,7 @@ var OktaUserAgent = function () {
8770
8814
  }, {
8771
8815
  key: "getVersion",
8772
8816
  value: function getVersion() {
8773
- return "6.5.0";
8817
+ return "6.5.1";
8774
8818
  }
8775
8819
  }, {
8776
8820
  key: "maybeAddNodeEnvironment",