@stytch/vanilla-js 4.7.0 → 4.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @stytch/vanilla-js
2
2
 
3
+ ## 4.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e83a832: Added DFP functionality to users search in passwords screen
8
+ - Updated dependencies [e83a832]
9
+ - @stytch/core@2.9.1
10
+
11
+ ## 4.7.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 4799cf5: Ensure API errors are handled internally
16
+
3
17
  ## 4.7.0
4
18
 
5
19
  ### Minor Changes
@@ -3641,19 +3641,26 @@ var Xe = Promise.resolve({
3641
3641
  }]), e;
3642
3642
  }(),
3643
3643
  mt = function () {
3644
- function e(t) {
3645
- ve(this, e), this._networkClient = t;
3644
+ function e(t, n) {
3645
+ ve(this, e), this._networkClient = t, this.dfpProtectedAuth = n;
3646
3646
  }
3647
3647
  return _e(e, [{
3648
3648
  key: "searchUser",
3649
3649
  value: function value(e) {
3650
- return this._networkClient.fetchSDK({
3651
- url: "/users/search",
3652
- method: "POST",
3653
- body: {
3654
- email: e
3655
- },
3656
- errorMessage: "Error searching for user ".concat(e)
3650
+ var t = this;
3651
+ return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (n) {
3652
+ var r = n.dfp_telemetry_id,
3653
+ o = n.captcha_token;
3654
+ return t._networkClient.fetchSDK({
3655
+ url: "/users/search",
3656
+ method: "POST",
3657
+ body: {
3658
+ email: e,
3659
+ dfp_telemetry_id: r,
3660
+ captcha_token: o
3661
+ },
3662
+ errorMessage: "Error searching for user ".concat(e)
3663
+ });
3657
3664
  });
3658
3665
  }
3659
3666
  }, {
@@ -4073,7 +4080,7 @@ var wt = /*#__PURE__*/function () {
4073
4080
  },
4074
4081
  sdk: {
4075
4082
  identifier: "Stytch.js Javascript SDK",
4076
- version: "4.7.0"
4083
+ version: "4.7.2"
4077
4084
  }
4078
4085
  });
4079
4086
  }
@@ -4741,7 +4748,7 @@ var $t = /*#__PURE__*/_createClass(function $t(e, t) {
4741
4748
  testAPIURL: o.endpoints.testAPIURL,
4742
4749
  liveAPIURL: o.endpoints.liveAPIURL
4743
4750
  }), this.discovery = new at(this._networkClient, this._subscriptionService), this.passwords = new ct(this._networkClient, this._subscriptionService, i, a.getAsync(), c), this.otps = new lt(this._networkClient, this._subscriptionService, c), this.totp = new ut(this._networkClient, this._subscriptionService, c), this.recoveryCodes = new dt(this._networkClient, this._subscriptionService, c), this.rbac = new pt(a.getSync(), a.getAsync(), this._subscriptionService), this._sessionManager = new ft(this._subscriptionService, this.session);
4744
- var u = new mt(this._networkClient);
4751
+ var u = new mt(this._networkClient, c);
4745
4752
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4746
4753
  name: "b2b_sdk_instance_instantiated",
4747
4754
  details: {
@@ -9717,7 +9724,9 @@ var Vl = {
9717
9724
  ql = function ql(e, t, n) {
9718
9725
  var r = rs(),
9719
9726
  o = ns();
9720
- return Kl(e, t, Object.assign(Object.assign({}, n), {
9727
+ return Kl(e, t, Object.assign(Object.assign({
9728
+ throwOnError: !1
9729
+ }, n), {
9721
9730
  onSuccess: function onSuccess(e, t, o) {
9722
9731
  Vl[t] && r({
9723
9732
  type: Vl[t],
@@ -12228,6 +12237,12 @@ var $d = function $d() {
12228
12237
  phoneNumber: p,
12229
12238
  formattedPhoneNumber: "+".concat(Ve[u], " ").concat(p)
12230
12239
  });
12240
+ },
12241
+ onError: function onError(e) {
12242
+ o({
12243
+ type: "sms_otp/send_error",
12244
+ error: e
12245
+ });
12231
12246
  }
12232
12247
  }),
12233
12248
  f = _ql7.trigger,
@@ -3517,19 +3517,26 @@ var Ze = Promise.resolve({
3517
3517
  }]), e;
3518
3518
  }(),
3519
3519
  pt = function () {
3520
- function e(t) {
3521
- ge(this, e), this._networkClient = t;
3520
+ function e(t, r) {
3521
+ ge(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
3522
3522
  }
3523
3523
  return ve(e, [{
3524
3524
  key: "searchUser",
3525
3525
  value: function value(e) {
3526
- return this._networkClient.fetchSDK({
3527
- url: "/users/search",
3528
- method: "POST",
3529
- body: {
3530
- email: e
3531
- },
3532
- errorMessage: "Error searching for user ".concat(e)
3526
+ var t = this;
3527
+ return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (r) {
3528
+ var n = r.dfp_telemetry_id,
3529
+ i = r.captcha_token;
3530
+ return t._networkClient.fetchSDK({
3531
+ url: "/users/search",
3532
+ method: "POST",
3533
+ body: {
3534
+ email: e,
3535
+ dfp_telemetry_id: n,
3536
+ captcha_token: i
3537
+ },
3538
+ errorMessage: "Error searching for user ".concat(e)
3539
+ });
3533
3540
  });
3534
3541
  }
3535
3542
  }, {
@@ -3949,7 +3956,7 @@ var kt = /*#__PURE__*/function () {
3949
3956
  },
3950
3957
  sdk: {
3951
3958
  identifier: "Stytch.js Javascript SDK",
3952
- version: "4.7.0"
3959
+ version: "4.7.2"
3953
3960
  }
3954
3961
  });
3955
3962
  }
@@ -4609,7 +4616,7 @@ var zt = /*#__PURE__*/_createClass(function zt(e, t) {
4609
4616
  testAPIURL: i.endpoints.testAPIURL,
4610
4617
  liveAPIURL: i.endpoints.liveAPIURL
4611
4618
  }), this.discovery = new ot(this._networkClient, this._subscriptionService), this.passwords = new at(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new ct(this._networkClient, this._subscriptionService, g), this.totp = new ut(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new lt(this._networkClient, this._subscriptionService, g), this.rbac = new dt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new ft(this._subscriptionService, this.session);
4612
- var k = new pt(this._networkClient);
4619
+ var k = new pt(this._networkClient, g);
4613
4620
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4614
4621
  name: "b2b_sdk_instance_instantiated",
4615
4622
  details: {
@@ -188,14 +188,14 @@ var g,
188
188
  }
189
189
  return a(t, c(Error)), r(t);
190
190
  }(),
191
- E = function (e) {
191
+ A = function (e) {
192
192
  function t(e) {
193
193
  var r;
194
194
  return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
195
195
  }
196
196
  return a(t, O), r(t);
197
197
  }(),
198
- A = function (e) {
198
+ E = function (e) {
199
199
  function t(e) {
200
200
  var r;
201
201
  i(this, t);
@@ -498,7 +498,7 @@ function fe() {
498
498
  function l(e, t, r, n) {
499
499
  var o = t && t.prototype instanceof v ? t : v,
500
500
  s = Object.create(o.prototype),
501
- a = new A(n || []);
501
+ a = new E(n || []);
502
502
  return i(s, "_invoke", {
503
503
  value: C(e, r, a)
504
504
  }), s;
@@ -622,11 +622,11 @@ function fe() {
622
622
  };
623
623
  1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
624
624
  }
625
- function E(e) {
625
+ function A(e) {
626
626
  var t = e.completion || {};
627
627
  t.type = "normal", delete t.arg, e.completion = t;
628
628
  }
629
- function A(e) {
629
+ function E(e) {
630
630
  this.tryEntries = [{
631
631
  tryLoc: "root"
632
632
  }], e.forEach(O, this), this.reset(!0);
@@ -685,10 +685,10 @@ function fe() {
685
685
  }
686
686
  return e.done = !0, e;
687
687
  };
688
- }, t.values = D, A.prototype = {
689
- constructor: A,
688
+ }, t.values = D, E.prototype = {
689
+ constructor: E,
690
690
  reset: function reset(t) {
691
- if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(E), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
691
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(A), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
692
692
  },
693
693
  stop: function stop() {
694
694
  this.done = !0;
@@ -740,7 +740,7 @@ function fe() {
740
740
  finish: function finish(e) {
741
741
  for (var t = this.tryEntries.length - 1; t >= 0; --t) {
742
742
  var r = this.tryEntries[t];
743
- if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), E(r), m;
743
+ if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), A(r), m;
744
744
  }
745
745
  },
746
746
  "catch": function _catch(e) {
@@ -750,7 +750,7 @@ function fe() {
750
750
  var n = r.completion;
751
751
  if ("throw" === n.type) {
752
752
  var i = n.arg;
753
- E(r);
753
+ A(r);
754
754
  }
755
755
  return i;
756
756
  }
@@ -934,7 +934,7 @@ function Oe(e) {
934
934
  e.next = 13;
935
935
  break;
936
936
  }
937
- throw new E("Unable to contact the Stytch servers. Are you online?");
937
+ throw new A("Unable to contact the Stytch servers. Are you online?");
938
938
  case 13:
939
939
  throw e.t0;
940
940
  case 14:
@@ -946,7 +946,7 @@ function Oe(e) {
946
946
  case 18:
947
947
  return d = e.sent, e.abrupt("return", d.data);
948
948
  case 22:
949
- throw e.prev = 22, e.t1 = e["catch"](15), new E("Invalid JSON response from the Stytch servers.");
949
+ throw e.prev = 22, e.t1 = e["catch"](15), new A("Invalid JSON response from the Stytch servers.");
950
950
  case 25:
951
951
  if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
952
952
  e.next = 38;
@@ -957,13 +957,13 @@ function Oe(e) {
957
957
  h = e.sent, e.next = 35;
958
958
  break;
959
959
  case 32:
960
- throw e.prev = 32, e.t2 = e["catch"](26), new E("Invalid or no response from server");
960
+ throw e.prev = 32, e.t2 = e["catch"](26), new A("Invalid or no response from server");
961
961
  case 35:
962
962
  if (!("body" in h || "params" in h || "query" in h)) {
963
963
  e.next = 37;
964
964
  break;
965
965
  }
966
- throw new A(h);
966
+ throw new E(h);
967
967
  case 37:
968
968
  throw new D(h);
969
969
  case 38:
@@ -972,7 +972,7 @@ function Oe(e) {
972
972
  p = e.sent, e.next = 47;
973
973
  break;
974
974
  case 44:
975
- throw e.prev = 44, e.t3 = e["catch"](38), new E("Invalid response from the Stytch servers.");
975
+ throw e.prev = 44, e.t3 = e["catch"](38), new A("Invalid response from the Stytch servers.");
976
976
  case 47:
977
977
  if (!p.includes("Captcha required")) {
978
978
  e.next = 49;
@@ -980,7 +980,7 @@ function Oe(e) {
980
980
  }
981
981
  throw new Te(Pe.RequiredCatcha);
982
982
  case 49:
983
- throw new E("Invalid response from the Stytch servers.");
983
+ throw new A("Invalid response from the Stytch servers.");
984
984
  case 50:
985
985
  case "end":
986
986
  return e.stop();
@@ -988,10 +988,10 @@ function Oe(e) {
988
988
  }, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
989
989
  }));
990
990
  }
991
- var Ee = new Uint8Array(16);
992
- function Ae() {
991
+ var Ae = new Uint8Array(16);
992
+ function Ee() {
993
993
  if (!Ce && !(Ce = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
994
- return Ce(Ee);
994
+ return Ce(Ae);
995
995
  }
996
996
  var De = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
997
997
  for (var Ie = [], Re = 0; Re < 256; ++Re) Ie.push((Re + 256).toString(16).substr(1));
@@ -1004,7 +1004,7 @@ function Be(e) {
1004
1004
  return r;
1005
1005
  }
1006
1006
  function Me(e, t, r) {
1007
- var n = (e = e || {}).random || (e.rng || Ae)();
1007
+ var n = (e = e || {}).random || (e.rng || Ee)();
1008
1008
  if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
1009
1009
  r = r || 0;
1010
1010
  for (var i = 0; i < 16; ++i) t[r + i] = n[i];
@@ -1417,9 +1417,9 @@ var Ne,
1417
1417
  case "StytchSDKSchemaError":
1418
1418
  return e.inflate(x, t);
1419
1419
  case "StytchAPIUnreachableError":
1420
- return e.inflate(E, t);
1421
- case "StytchAPISchemaError":
1422
1420
  return e.inflate(A, t);
1421
+ case "StytchAPISchemaError":
1422
+ return e.inflate(E, t);
1423
1423
  case "StytchSDKAPIError":
1424
1424
  return e.inflate(C, t);
1425
1425
  case "StytchAPIError":
@@ -3428,19 +3428,26 @@ var Xe = Promise.resolve({
3428
3428
  }]), e;
3429
3429
  }(),
3430
3430
  ht = function () {
3431
- function e(t) {
3432
- be(this, e), this._networkClient = t;
3431
+ function e(t, r) {
3432
+ be(this, e), this._networkClient = t, this.dfpProtectedAuth = r;
3433
3433
  }
3434
3434
  return me(e, [{
3435
3435
  key: "searchUser",
3436
3436
  value: function value(e) {
3437
- return this._networkClient.fetchSDK({
3438
- url: "/users/search",
3439
- method: "POST",
3440
- body: {
3441
- email: e
3442
- },
3443
- errorMessage: "Error searching for user ".concat(e)
3437
+ var t = this;
3438
+ return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (r) {
3439
+ var n = r.dfp_telemetry_id,
3440
+ i = r.captcha_token;
3441
+ return t._networkClient.fetchSDK({
3442
+ url: "/users/search",
3443
+ method: "POST",
3444
+ body: {
3445
+ email: e,
3446
+ dfp_telemetry_id: n,
3447
+ captcha_token: i
3448
+ },
3449
+ errorMessage: "Error searching for user ".concat(e)
3450
+ });
3444
3451
  });
3445
3452
  }
3446
3453
  }, {
@@ -3860,7 +3867,7 @@ var yt = /*#__PURE__*/function () {
3860
3867
  },
3861
3868
  sdk: {
3862
3869
  identifier: "Stytch.js Javascript SDK",
3863
- version: "4.7.0"
3870
+ version: "4.7.2"
3864
3871
  }
3865
3872
  });
3866
3873
  }
@@ -4130,17 +4137,17 @@ var Ct = function Ct(e) {
4130
4137
  Ot = function Ot(e) {
4131
4138
  clearTimeout(Tt.get(e));
4132
4139
  },
4133
- Et = function Et(e, t, r) {
4140
+ At = function At(e, t, r) {
4134
4141
  Ot(e);
4135
4142
  var n = setTimeout(function () {
4136
4143
  void 0 === xt.get(e) && xt.set(e, t, r);
4137
4144
  }, 10);
4138
4145
  return Tt.set(e, n), xt.set(e, t, r);
4139
4146
  };
4140
- var At = /*#__PURE__*/function () {
4141
- function At(e, t) {
4147
+ var Et = /*#__PURE__*/function () {
4148
+ function Et(e, t) {
4142
4149
  var _this4 = this;
4143
- _classCallCheck(this, At);
4150
+ _classCallCheck(this, Et);
4144
4151
  this.browserSessionStorage = {
4145
4152
  getItem: function getItem(e) {
4146
4153
  return sessionStorage.getItem(Ct(_this4.publicToken, e));
@@ -4162,7 +4169,7 @@ var At = /*#__PURE__*/function () {
4162
4169
  }
4163
4170
  this.state = n;
4164
4171
  }
4165
- _createClass(At, [{
4172
+ _createClass(Et, [{
4166
4173
  key: "opaqueTokenCookieName",
4167
4174
  get: function get() {
4168
4175
  var e;
@@ -4200,14 +4207,14 @@ var At = /*#__PURE__*/function () {
4200
4207
  var o = e.state,
4201
4208
  s = e.session_token,
4202
4209
  a = e.session_jwt,
4203
- c = At.generateCookieOpts({
4210
+ c = Et.generateCookieOpts({
4204
4211
  expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
4205
4212
  availableToSubdomains: this._cookieAvailableToSubdomains,
4206
4213
  path: this._cookiePath,
4207
4214
  domain: this._domain
4208
4215
  });
4209
- Et(this.opaqueTokenCookieName, s, c), Et(this.jwtCookieName, a, c);
4210
- var u = At.generateCookieOpts({
4216
+ At(this.opaqueTokenCookieName, s, c), At(this.jwtCookieName, a, c);
4217
+ var u = Et.generateCookieOpts({
4211
4218
  expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
4212
4219
  availableToSubdomains: !this._cookieAvailableToSubdomains,
4213
4220
  path: this._cookiePath,
@@ -4219,13 +4226,13 @@ var At = /*#__PURE__*/function () {
4219
4226
  key: "writeIntermediateSessionTokenCookie",
4220
4227
  value: function writeIntermediateSessionTokenCookie(e) {
4221
4228
  var t = new Date(Date.now() + 6e5),
4222
- r = At.generateCookieOpts({
4229
+ r = Et.generateCookieOpts({
4223
4230
  expiresAt: t.toString(),
4224
4231
  availableToSubdomains: this._cookieAvailableToSubdomains,
4225
4232
  path: this._cookiePath,
4226
4233
  domain: this._domain
4227
4234
  });
4228
- Et(this.istCookieName, e, r);
4235
+ At(this.istCookieName, e, r);
4229
4236
  }
4230
4237
  }, {
4231
4238
  key: "removeSessionCookie",
@@ -4244,7 +4251,7 @@ var At = /*#__PURE__*/function () {
4244
4251
  [!0, !1].forEach(function (t) {
4245
4252
  [_this5._cookiePath, null].forEach(function (r) {
4246
4253
  [_this5._domain, null].forEach(function (n) {
4247
- var i = At.generateCookieOpts({
4254
+ var i = Et.generateCookieOpts({
4248
4255
  expiresAt: new Date(0).toString(),
4249
4256
  availableToSubdomains: t,
4250
4257
  path: r,
@@ -4300,16 +4307,16 @@ var At = /*#__PURE__*/function () {
4300
4307
  return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
4301
4308
  }
4302
4309
  }]);
4303
- return At;
4310
+ return Et;
4304
4311
  }();
4305
- var Dt = /*#__PURE__*/function (_At) {
4306
- _inherits(Dt, _At);
4312
+ var Dt = /*#__PURE__*/function (_Et) {
4313
+ _inherits(Dt, _Et);
4307
4314
  function Dt() {
4308
4315
  _classCallCheck(this, Dt);
4309
4316
  return _callSuper(this, Dt, arguments);
4310
4317
  }
4311
4318
  return _createClass(Dt);
4312
- }(At);
4319
+ }(Et);
4313
4320
  var It = Symbol["for"]("__stytch_b2b_DataLayer"),
4314
4321
  Rt = function Rt(e, t) {
4315
4322
  var r = function () {
@@ -4479,7 +4486,7 @@ var jt = /*#__PURE__*/function (_Ft) {
4479
4486
  return _createClass(jt);
4480
4487
  }(Ft);
4481
4488
  var Lt = Symbol["for"]("stytch__internal_b2b");
4482
- exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = F, exports.ChallengeSigningFailedError = Y, exports.DeviceCredentialsNotAllowedError = z, exports.FailedCodeChallengeError = $, exports.FailedToDecryptDataError = Z, exports.InternalError = B, exports.InvalidAuthorizationCredentialError = G, exports.InvalidCredentialTypeError = ne, exports.InvalidRedirectSchemeError = te, exports.InvalidStartUrlError = ee, exports.JSONDataNotConvertibleToStringError = oe, exports.KeyInvalidatedError = j, exports.KeystoreUnavailableError = L, exports.MissingAttestationObjectError = ie, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = q, exports.MissingPKCEError = W, exports.MissingPublicKeyError = V, exports.MissingUrlError = re, exports.NoBiometricsEnrolledError = K, exports.NoBiometricsRegistrationError = M, exports.NoCurrentSessionError = R, exports.PasskeysInvalidEncoding = ae, exports.PasskeysMisconfigured = ce, exports.PasskeysUnsupportedError = X, exports.RandomNumberGenerationFailed = se, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = J, exports.SignInWithAppleMisconfigured = ue, exports.StytchAPIError = D, exports.StytchAPISchemaError = A, exports.StytchAPIUnreachableError = E, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
4489
+ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = F, exports.ChallengeSigningFailedError = Y, exports.DeviceCredentialsNotAllowedError = z, exports.FailedCodeChallengeError = $, exports.FailedToDecryptDataError = Z, exports.InternalError = B, exports.InvalidAuthorizationCredentialError = G, exports.InvalidCredentialTypeError = ne, exports.InvalidRedirectSchemeError = te, exports.InvalidStartUrlError = ee, exports.JSONDataNotConvertibleToStringError = oe, exports.KeyInvalidatedError = j, exports.KeystoreUnavailableError = L, exports.MissingAttestationObjectError = ie, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = q, exports.MissingPKCEError = W, exports.MissingPublicKeyError = V, exports.MissingUrlError = re, exports.NoBiometricsEnrolledError = K, exports.NoBiometricsRegistrationError = M, exports.NoCurrentSessionError = R, exports.PasskeysInvalidEncoding = ae, exports.PasskeysMisconfigured = ce, exports.PasskeysUnsupportedError = X, exports.RandomNumberGenerationFailed = se, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = J, exports.SignInWithAppleMisconfigured = ue, exports.StytchAPIError = D, exports.StytchAPISchemaError = E, exports.StytchAPIUnreachableError = A, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
4483
4490
  function _class(e, t) {
4484
4491
  var _this9 = this;
4485
4492
  _classCallCheck(this, _class);
@@ -4521,7 +4528,7 @@ exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = F, expor
4521
4528
  testAPIURL: i.endpoints.testAPIURL,
4522
4529
  liveAPIURL: i.endpoints.liveAPIURL
4523
4530
  }), this.discovery = new it(this._networkClient, this._subscriptionService), this.passwords = new st(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new at(this._networkClient, this._subscriptionService, g), this.totp = new ct(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new ut(this._networkClient, this._subscriptionService, g), this.rbac = new lt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new pt(this._subscriptionService, this.session);
4524
- var k = new ht(this._networkClient);
4531
+ var k = new ht(this._networkClient, g);
4525
4532
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4526
4533
  name: "b2b_sdk_instance_instantiated",
4527
4534
  details: {
package/dist/b2b/index.js CHANGED
@@ -3552,19 +3552,26 @@ var Ze = Promise.resolve({
3552
3552
  }]), e;
3553
3553
  }(),
3554
3554
  ht = function () {
3555
- function e(t) {
3556
- Ae(this, e), this._networkClient = t;
3555
+ function e(t, n) {
3556
+ Ae(this, e), this._networkClient = t, this.dfpProtectedAuth = n;
3557
3557
  }
3558
3558
  return ge(e, [{
3559
3559
  key: "searchUser",
3560
3560
  value: function value(e) {
3561
- return this._networkClient.fetchSDK({
3562
- url: "/users/search",
3563
- method: "POST",
3564
- body: {
3565
- email: e
3566
- },
3567
- errorMessage: "Error searching for user ".concat(e)
3561
+ var t = this;
3562
+ return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (n) {
3563
+ var r = n.dfp_telemetry_id,
3564
+ o = n.captcha_token;
3565
+ return t._networkClient.fetchSDK({
3566
+ url: "/users/search",
3567
+ method: "POST",
3568
+ body: {
3569
+ email: e,
3570
+ dfp_telemetry_id: r,
3571
+ captcha_token: o
3572
+ },
3573
+ errorMessage: "Error searching for user ".concat(e)
3574
+ });
3568
3575
  });
3569
3576
  }
3570
3577
  }, {
@@ -3984,7 +3991,7 @@ var bt = /*#__PURE__*/function () {
3984
3991
  },
3985
3992
  sdk: {
3986
3993
  identifier: "Stytch.js Javascript SDK",
3987
- version: "4.7.0"
3994
+ version: "4.7.2"
3988
3995
  }
3989
3996
  });
3990
3997
  }
@@ -4652,7 +4659,7 @@ var Qt = /*#__PURE__*/_createClass(function Qt(e, t) {
4652
4659
  testAPIURL: o.endpoints.testAPIURL,
4653
4660
  liveAPIURL: o.endpoints.liveAPIURL
4654
4661
  }), this.discovery = new it(this._networkClient, this._subscriptionService), this.passwords = new at(this._networkClient, this._subscriptionService, i, s.getAsync(), c), this.otps = new ct(this._networkClient, this._subscriptionService, c), this.totp = new lt(this._networkClient, this._subscriptionService, c), this.recoveryCodes = new ut(this._networkClient, this._subscriptionService, c), this.rbac = new dt(s.getSync(), s.getAsync(), this._subscriptionService), this._sessionManager = new mt(this._subscriptionService, this.session);
4655
- var u = new ht(this._networkClient);
4662
+ var u = new ht(this._networkClient, c);
4656
4663
  this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
4657
4664
  name: "b2b_sdk_instance_instantiated",
4658
4665
  details: {
@@ -9628,7 +9635,9 @@ var Hl = {
9628
9635
  Vl = function Vl(e, t, n) {
9629
9636
  var r = na(),
9630
9637
  o = ta();
9631
- return Kl(e, t, Object.assign(Object.assign({}, n), {
9638
+ return Kl(e, t, Object.assign(Object.assign({
9639
+ throwOnError: !1
9640
+ }, n), {
9632
9641
  onSuccess: function onSuccess(e, t, o) {
9633
9642
  Hl[t] && r({
9634
9643
  type: Hl[t],
@@ -12139,6 +12148,12 @@ var Qd = function Qd() {
12139
12148
  phoneNumber: p,
12140
12149
  formattedPhoneNumber: "+".concat(He[u], " ").concat(p)
12141
12150
  });
12151
+ },
12152
+ onError: function onError(e) {
12153
+ o({
12154
+ type: "sms_otp/send_error",
12155
+ error: e
12156
+ });
12142
12157
  }
12143
12158
  }),
12144
12159
  f = _Vl7.trigger,
package/dist/index.esm.js CHANGED
@@ -3474,19 +3474,26 @@ var Ft = function () {
3474
3474
  }]), e;
3475
3475
  }(),
3476
3476
  Ut = function () {
3477
- function e(t) {
3478
- Ce(this, e), this._networkClient = t;
3477
+ function e(t, n) {
3478
+ Ce(this, e), this._networkClient = t, this.dfpProtectedAuth = n;
3479
3479
  }
3480
3480
  return ye(e, [{
3481
3481
  key: "searchUser",
3482
3482
  value: function value(e) {
3483
- return this._networkClient.fetchSDK({
3484
- url: "/users/search",
3485
- method: "POST",
3486
- body: {
3487
- email: e
3488
- },
3489
- errorMessage: "Error searching for user ".concat(e)
3483
+ var t = this;
3484
+ return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (n) {
3485
+ var r = n.dfp_telemetry_id,
3486
+ o = n.captcha_token;
3487
+ return t._networkClient.fetchSDK({
3488
+ url: "/users/search",
3489
+ method: "POST",
3490
+ body: {
3491
+ email: e,
3492
+ dfp_telemetry_id: r,
3493
+ captcha_token: o
3494
+ },
3495
+ errorMessage: "Error searching for user ".concat(e)
3496
+ });
3490
3497
  });
3491
3498
  }
3492
3499
  }, {
@@ -3920,7 +3927,7 @@ var qt = /*#__PURE__*/function () {
3920
3927
  },
3921
3928
  sdk: {
3922
3929
  identifier: "Stytch.js Javascript SDK",
3923
- version: "4.7.0"
3930
+ version: "4.7.2"
3924
3931
  }
3925
3932
  });
3926
3933
  }
@@ -4809,7 +4816,7 @@ var wn = /*#__PURE__*/_createClass(function wn(e, t) {
4809
4816
  c = new rt(e, o.endpoints.dfpBackendURL, a.getAsync(), s.executeRecaptcha),
4810
4817
  l = new Gt(o.endpoints.clientsideServicesIframeURL),
4811
4818
  u = new Yt(e, l),
4812
- d = new Ut(this._networkClient);
4819
+ d = new Ut(this._networkClient, c);
4813
4820
  var p, h;
4814
4821
  this.user = new st(this._networkClient, this._subscriptionService), this.session = new ct(this._networkClient, this._subscriptionService), this.magicLinks = new ut(this._networkClient, this._subscriptionService, new $t(this._dataLayer, "magic_links"), i, a.getAsync(), c), this.otps = new dt(this._networkClient, this._subscriptionService, s.executeRecaptcha, c), this.oauth = new Kt(this._networkClient, this._subscriptionService, new $t(this._dataLayer, "oauth"), a.getAsync(), {
4815
4822
  publicToken: e,