@stytch/vanilla-js 4.18.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
26
26
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
27
27
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
28
28
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
- var internal = require('../internal-BwJCD84k.js');
29
+ var internal = require('../internal-Rn587gVt.js');
30
30
  var DisabledDFPProtectedAuthProvider = function DisabledDFPProtectedAuthProvider() {
31
31
  return {
32
32
  isEnabled: function () {
@@ -429,132 +429,6 @@ var ClientsideServicesProvider = /*#__PURE__*/function () {
429
429
  }]);
430
430
  return ClientsideServicesProvider;
431
431
  }();
432
- var version = "4.18.2";
433
- var NetworkClient = /*#__PURE__*/function () {
434
- function NetworkClient(_publicToken, _subscriptionDataLayer, baseURL, additionalTelemetryDataFn) {
435
- _classCallCheck(this, NetworkClient);
436
- this._publicToken = _publicToken;
437
- this._subscriptionDataLayer = _subscriptionDataLayer;
438
- this.baseURL = baseURL;
439
- this.additionalTelemetryDataFn = additionalTelemetryDataFn;
440
- this.updateSessionToken = function () {
441
- return null;
442
- };
443
- this.eventLogger = new internal.EventLogger({
444
- maxBatchSize: internal.DEFAULT_MAX_BATCH_SIZE,
445
- intervalDurationMs: internal.DEFAULT_INTERVAL_DURATION_MS,
446
- logEventURL: this.buildSDKUrl('/events')
447
- });
448
- }
449
- _createClass(NetworkClient, [{
450
- key: "logEvent",
451
- value: function logEvent(_ref6) {
452
- var name = _ref6.name,
453
- details = _ref6.details,
454
- _ref6$error = _ref6.error,
455
- error = _ref6$error === void 0 ? {} : _ref6$error;
456
- this.eventLogger.logEvent(this.createTelemetryBlob(), {
457
- public_token: this._publicToken,
458
- event_name: name,
459
- details: details,
460
- error_code: error.error_code,
461
- error_description: error.error_description,
462
- http_status_code: error.http_status_code
463
- });
464
- }
465
- }, {
466
- key: "createTelemetryBlob",
467
- value: function createTelemetryBlob() {
468
- return Object.assign(Object.assign({
469
- event_id: internal.createEventId(),
470
- app_session_id: internal.createAppSessionId(),
471
- persistent_id: internal.createPersistentId(),
472
- client_sent_at: new Date().toISOString(),
473
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
474
- }, this.additionalTelemetryDataFn()), {
475
- app: {
476
- identifier: window.location.hostname
477
- },
478
- sdk: {
479
- identifier: 'Stytch.js Javascript SDK',
480
- version: version
481
- }
482
- });
483
- }
484
- }, {
485
- key: "fetchSDK",
486
- value: function fetchSDK(_ref7) {
487
- var url = _ref7.url,
488
- body = _ref7.body,
489
- errorMessage = _ref7.errorMessage,
490
- method = _ref7.method;
491
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
492
- var sessionToken, basicAuthHeader, xSDKClientHeader, xSDKParentHostHeader;
493
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
494
- while (1) switch (_context9.prev = _context9.next) {
495
- case 0:
496
- sessionToken = this._subscriptionDataLayer.readSessionCookie().session_token;
497
- basicAuthHeader = 'Basic ' + window.btoa(this._publicToken + ':' + (sessionToken || this._publicToken));
498
- xSDKClientHeader = window.btoa(JSON.stringify(this.createTelemetryBlob()));
499
- xSDKParentHostHeader = window.location.origin;
500
- return _context9.abrupt("return", internal.baseFetchSDK({
501
- basicAuthHeader: basicAuthHeader,
502
- body: body,
503
- errorMessage: errorMessage,
504
- finalURL: this.buildSDKUrl(url),
505
- method: method,
506
- xSDKClientHeader: xSDKClientHeader,
507
- xSDKParentHostHeader: xSDKParentHostHeader
508
- }));
509
- case 5:
510
- case "end":
511
- return _context9.stop();
512
- }
513
- }, _callee9, this);
514
- }));
515
- }
516
- }, {
517
- key: "retriableFetchSDK",
518
- value: function retriableFetchSDK(_ref8) {
519
- var url = _ref8.url,
520
- body = _ref8.body,
521
- errorMessage = _ref8.errorMessage,
522
- method = _ref8.method,
523
- retryCallback = _ref8.retryCallback;
524
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
525
- var sessionToken, basicAuthHeader, xSDKClientHeader, xSDKParentHostHeader;
526
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
527
- while (1) switch (_context10.prev = _context10.next) {
528
- case 0:
529
- sessionToken = this._subscriptionDataLayer.readSessionCookie().session_token;
530
- basicAuthHeader = 'Basic ' + window.btoa(this._publicToken + ':' + (sessionToken || this._publicToken));
531
- xSDKClientHeader = window.btoa(JSON.stringify(this.createTelemetryBlob()));
532
- xSDKParentHostHeader = window.location.origin;
533
- return _context10.abrupt("return", internal.retriableFetchSDK({
534
- basicAuthHeader: basicAuthHeader,
535
- body: body,
536
- errorMessage: errorMessage,
537
- finalURL: this.buildSDKUrl(url),
538
- method: method,
539
- xSDKClientHeader: xSDKClientHeader,
540
- xSDKParentHostHeader: xSDKParentHostHeader,
541
- retryCallback: retryCallback
542
- }));
543
- case 5:
544
- case "end":
545
- return _context10.stop();
546
- }
547
- }, _callee10, this);
548
- }));
549
- }
550
- }, {
551
- key: "buildSDKUrl",
552
- value: function buildSDKUrl(url) {
553
- return "".concat(this.baseURL, "/sdk/v1").concat(url);
554
- }
555
- }]);
556
- return NetworkClient;
557
- }();
558
432
  var PKCE_VERIFIER_STORAGE_KEY = 'PKCE_VERIFIER';
559
433
  function toHex(n) {
560
434
  var str = n.toString(16);
@@ -581,22 +455,22 @@ var PKCEManager = /*#__PURE__*/function () {
581
455
  }, {
582
456
  key: "startPKCETransaction",
583
457
  value: function startPKCETransaction() {
584
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
458
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
585
459
  var keyPair;
586
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
587
- while (1) switch (_context11.prev = _context11.next) {
460
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
461
+ while (1) switch (_context9.prev = _context9.next) {
588
462
  case 0:
589
- _context11.next = 2;
463
+ _context9.next = 2;
590
464
  return PKCEManager.createProofkeyPair();
591
465
  case 2:
592
- keyPair = _context11.sent;
466
+ keyPair = _context9.sent;
593
467
  this._dataLayer.setItem(this.key(), JSON.stringify(keyPair));
594
- return _context11.abrupt("return", keyPair);
468
+ return _context9.abrupt("return", keyPair);
595
469
  case 5:
596
470
  case "end":
597
- return _context11.stop();
471
+ return _context9.stop();
598
472
  }
599
- }, _callee11, this);
473
+ }, _callee9, this);
600
474
  }));
601
475
  }
602
476
  }, {
@@ -621,27 +495,27 @@ var PKCEManager = /*#__PURE__*/function () {
621
495
  }], [{
622
496
  key: "createProofkeyPair",
623
497
  value: function createProofkeyPair() {
624
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
498
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
625
499
  var bytes, codeVerifier, digest;
626
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
627
- while (1) switch (_context12.prev = _context12.next) {
500
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
501
+ while (1) switch (_context10.prev = _context10.next) {
628
502
  case 0:
629
503
  bytes = new Uint32Array(16);
630
504
  window.crypto.getRandomValues(bytes);
631
505
  codeVerifier = Array.from(bytes).map(toHex).join('');
632
- _context12.next = 5;
506
+ _context10.next = 5;
633
507
  return window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
634
508
  case 5:
635
- digest = _context12.sent;
636
- return _context12.abrupt("return", {
509
+ digest = _context10.sent;
510
+ return _context10.abrupt("return", {
637
511
  code_challenge: base64URLEncode(digest),
638
512
  code_verifier: codeVerifier
639
513
  });
640
514
  case 7:
641
515
  case "end":
642
- return _context12.stop();
516
+ return _context10.stop();
643
517
  }
644
- }, _callee12);
518
+ }, _callee10);
645
519
  }));
646
520
  }
647
521
  }]);
@@ -935,11 +809,11 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
935
809
  }
936
810
  }], [{
937
811
  key: "generateCookieOpts",
938
- value: function generateCookieOpts(_ref9) {
939
- var path = _ref9.path,
940
- domain = _ref9.domain,
941
- availableToSubdomains = _ref9.availableToSubdomains,
942
- expiresAt = _ref9.expiresAt;
812
+ value: function generateCookieOpts(_ref6) {
813
+ var path = _ref6.path,
814
+ domain = _ref6.domain,
815
+ availableToSubdomains = _ref6.availableToSubdomains,
816
+ expiresAt = _ref6.expiresAt;
943
817
  var cookieOpts = {
944
818
  expires: new Date(expiresAt),
945
819
  sameSite: 'lax'
@@ -1209,15 +1083,15 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
1209
1083
  }
1210
1084
  }, {
1211
1085
  key: "render",
1212
- value: function render(_ref10) {
1213
- var callback = _ref10.callback,
1214
- onOneTapCancelled = _ref10.onOneTapCancelled,
1215
- style = _ref10.style;
1216
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1086
+ value: function render(_ref7) {
1087
+ var callback = _ref7.callback,
1088
+ onOneTapCancelled = _ref7.onOneTapCancelled,
1089
+ style = _ref7.style;
1090
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1217
1091
  var _this9 = this;
1218
1092
  var embeddedMode, shouldRenderEmbeddedOneTap, config;
1219
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1220
- while (1) switch (_context13.prev = _context13.next) {
1093
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1094
+ while (1) switch (_context11.prev = _context11.next) {
1221
1095
  case 0:
1222
1096
  embeddedMode = getConfiguredEmbeddedMode(style.position);
1223
1097
  shouldRenderEmbeddedOneTap = getShouldRenderEmbeddedOneTap(style.position);
@@ -1234,7 +1108,7 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
1234
1108
  config.cancel_on_tap_outside = false;
1235
1109
  }
1236
1110
  this._googleClient.initialize(config);
1237
- return _context13.abrupt("return", new Promise(function (resolve) {
1111
+ return _context11.abrupt("return", new Promise(function (resolve) {
1238
1112
  _this9._googleClient.prompt(function (notification) {
1239
1113
  var _a, _b, _c, _d, _e;
1240
1114
  if (notification.isSkippedMoment()) {
@@ -1263,9 +1137,9 @@ var GoogleOneTapClient = /*#__PURE__*/function () {
1263
1137
  }));
1264
1138
  case 6:
1265
1139
  case "end":
1266
- return _context13.stop();
1140
+ return _context11.stop();
1267
1141
  }
1268
- }, _callee13, this);
1142
+ }, _callee11, this);
1269
1143
  }));
1270
1144
  }
1271
1145
  }, {
@@ -1299,15 +1173,15 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1299
1173
  this._networkClient = _networkClient;
1300
1174
  this._pkceManager = _pkceManager;
1301
1175
  this._config = _config;
1302
- this.createOnDiscoverySuccessHandler = function (_ref11) {
1303
- var discoveryRedirectUrl = _ref11.discoveryRedirectUrl,
1304
- onSuccess = _ref11.onSuccess,
1305
- onError = _ref11.onError;
1176
+ this.createOnDiscoverySuccessHandler = function (_ref8) {
1177
+ var discoveryRedirectUrl = _ref8.discoveryRedirectUrl,
1178
+ onSuccess = _ref8.onSuccess,
1179
+ onError = _ref8.onError;
1306
1180
  return function (response) {
1307
- return internal.__awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1181
+ return internal.__awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1308
1182
  var credential, submitPromise;
1309
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1310
- while (1) switch (_context14.prev = _context14.next) {
1183
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1184
+ while (1) switch (_context12.prev = _context12.next) {
1311
1185
  case 0:
1312
1186
  credential = response.credential;
1313
1187
  submitPromise = this.submitGoogleOneTapTokenDiscovery({
@@ -1321,27 +1195,27 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1321
1195
  return onError(error);
1322
1196
  });
1323
1197
  }
1324
- _context14.next = 5;
1198
+ _context12.next = 5;
1325
1199
  return submitPromise;
1326
1200
  case 5:
1327
1201
  case "end":
1328
- return _context14.stop();
1202
+ return _context12.stop();
1329
1203
  }
1330
- }, _callee14, this);
1204
+ }, _callee12, this);
1331
1205
  }));
1332
1206
  };
1333
1207
  };
1334
- this.createOnSuccessHandler = function (_ref12) {
1335
- var organizationId = _ref12.organizationId,
1336
- signupRedirectUrl = _ref12.signupRedirectUrl,
1337
- loginRedirectUrl = _ref12.loginRedirectUrl,
1338
- onSuccess = _ref12.onSuccess,
1339
- onError = _ref12.onError;
1208
+ this.createOnSuccessHandler = function (_ref9) {
1209
+ var organizationId = _ref9.organizationId,
1210
+ signupRedirectUrl = _ref9.signupRedirectUrl,
1211
+ loginRedirectUrl = _ref9.loginRedirectUrl,
1212
+ onSuccess = _ref9.onSuccess,
1213
+ onError = _ref9.onError;
1340
1214
  return function (response) {
1341
- return internal.__awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1215
+ return internal.__awaiter(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1342
1216
  var credential, submitPromise;
1343
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1344
- while (1) switch (_context15.prev = _context15.next) {
1217
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1218
+ while (1) switch (_context13.prev = _context13.next) {
1345
1219
  case 0:
1346
1220
  credential = response.credential;
1347
1221
  submitPromise = this.submitGoogleOneTapToken({
@@ -1357,13 +1231,13 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1357
1231
  return onError(error);
1358
1232
  });
1359
1233
  }
1360
- _context15.next = 5;
1234
+ _context13.next = 5;
1361
1235
  return submitPromise;
1362
1236
  case 5:
1363
1237
  case "end":
1364
- return _context15.stop();
1238
+ return _context13.stop();
1365
1239
  }
1366
- }, _callee15, this);
1240
+ }, _callee13, this);
1367
1241
  }));
1368
1242
  };
1369
1243
  };
@@ -1374,65 +1248,65 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1374
1248
  _createClass(B2BOneTapProvider, [{
1375
1249
  key: "fetchGoogleStart",
1376
1250
  value: function fetchGoogleStart() {
1377
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1251
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1378
1252
  var oneTapStartResp;
1379
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1380
- while (1) switch (_context16.prev = _context16.next) {
1253
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1254
+ while (1) switch (_context14.prev = _context14.next) {
1381
1255
  case 0:
1382
1256
  if (!this.googleClientID) {
1383
- _context16.next = 2;
1257
+ _context14.next = 2;
1384
1258
  break;
1385
1259
  }
1386
- return _context16.abrupt("return", this.googleClientID);
1260
+ return _context14.abrupt("return", this.googleClientID);
1387
1261
  case 2:
1388
- _context16.next = 4;
1262
+ _context14.next = 4;
1389
1263
  return this._networkClient.fetchSDK({
1390
1264
  url: '/b2b/oauth/google/onetap/start',
1391
1265
  method: 'GET',
1392
1266
  errorMessage: 'Failed to fetch google client ID'
1393
1267
  });
1394
1268
  case 4:
1395
- oneTapStartResp = _context16.sent;
1269
+ oneTapStartResp = _context14.sent;
1396
1270
  this.googleClientID = oneTapStartResp.google_client_id;
1397
- return _context16.abrupt("return", this.googleClientID);
1271
+ return _context14.abrupt("return", this.googleClientID);
1398
1272
  case 7:
1399
1273
  case "end":
1400
- return _context16.stop();
1274
+ return _context14.stop();
1401
1275
  }
1402
- }, _callee16, this);
1276
+ }, _callee14, this);
1403
1277
  }));
1404
1278
  }
1405
1279
  }, {
1406
1280
  key: "submitGoogleOneTapTokenDiscovery",
1407
- value: function submitGoogleOneTapTokenDiscovery(_ref13) {
1408
- var credential = _ref13.credential,
1409
- discoveryRedirectUrl = _ref13.discoveryRedirectUrl;
1410
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1281
+ value: function submitGoogleOneTapTokenDiscovery(_ref10) {
1282
+ var credential = _ref10.credential,
1283
+ discoveryRedirectUrl = _ref10.discoveryRedirectUrl;
1284
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1411
1285
  var codeChallenge, _yield$this$_config, pkceRequiredForOAuth, keyPair;
1412
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1413
- while (1) switch (_context17.prev = _context17.next) {
1286
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1287
+ while (1) switch (_context15.prev = _context15.next) {
1414
1288
  case 0:
1415
1289
  codeChallenge = undefined;
1416
- _context17.next = 3;
1290
+ _context15.next = 3;
1417
1291
  return this._config;
1418
1292
  case 3:
1419
- _yield$this$_config = _context17.sent;
1293
+ _yield$this$_config = _context15.sent;
1420
1294
  pkceRequiredForOAuth = _yield$this$_config.pkceRequiredForOAuth;
1421
1295
  if (!pkceRequiredForOAuth) {
1422
- _context17.next = 12;
1296
+ _context15.next = 12;
1423
1297
  break;
1424
1298
  }
1425
- _context17.next = 8;
1299
+ _context15.next = 8;
1426
1300
  return this._pkceManager.startPKCETransaction();
1427
1301
  case 8:
1428
- keyPair = _context17.sent;
1302
+ keyPair = _context15.sent;
1429
1303
  codeChallenge = keyPair.code_challenge;
1430
- _context17.next = 13;
1304
+ _context15.next = 13;
1431
1305
  break;
1432
1306
  case 12:
1433
1307
  this._pkceManager.clearPKPair();
1434
1308
  case 13:
1435
- _context17.next = 15;
1309
+ _context15.next = 15;
1436
1310
  return this._networkClient.fetchSDK({
1437
1311
  url: '/b2b/oauth/google/onetap/discovery/submit',
1438
1312
  method: 'POST',
@@ -1444,47 +1318,47 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1444
1318
  errorMessage: 'Failed to submit One Tap ID token for discovery'
1445
1319
  });
1446
1320
  case 15:
1447
- return _context17.abrupt("return", _context17.sent);
1321
+ return _context15.abrupt("return", _context15.sent);
1448
1322
  case 16:
1449
1323
  case "end":
1450
- return _context17.stop();
1324
+ return _context15.stop();
1451
1325
  }
1452
- }, _callee17, this);
1326
+ }, _callee15, this);
1453
1327
  }));
1454
1328
  }
1455
1329
  }, {
1456
1330
  key: "submitGoogleOneTapToken",
1457
- value: function submitGoogleOneTapToken(_ref14) {
1458
- var credential = _ref14.credential,
1459
- organizationId = _ref14.organizationId,
1460
- signupRedirectUrl = _ref14.signupRedirectUrl,
1461
- loginRedirectUrl = _ref14.loginRedirectUrl;
1462
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1331
+ value: function submitGoogleOneTapToken(_ref11) {
1332
+ var credential = _ref11.credential,
1333
+ organizationId = _ref11.organizationId,
1334
+ signupRedirectUrl = _ref11.signupRedirectUrl,
1335
+ loginRedirectUrl = _ref11.loginRedirectUrl;
1336
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1463
1337
  var codeChallenge, _yield$this$_config2, pkceRequiredForOAuth, keyPair;
1464
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1465
- while (1) switch (_context18.prev = _context18.next) {
1338
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1339
+ while (1) switch (_context16.prev = _context16.next) {
1466
1340
  case 0:
1467
1341
  codeChallenge = undefined;
1468
- _context18.next = 3;
1342
+ _context16.next = 3;
1469
1343
  return this._config;
1470
1344
  case 3:
1471
- _yield$this$_config2 = _context18.sent;
1345
+ _yield$this$_config2 = _context16.sent;
1472
1346
  pkceRequiredForOAuth = _yield$this$_config2.pkceRequiredForOAuth;
1473
1347
  if (!pkceRequiredForOAuth) {
1474
- _context18.next = 12;
1348
+ _context16.next = 12;
1475
1349
  break;
1476
1350
  }
1477
- _context18.next = 8;
1351
+ _context16.next = 8;
1478
1352
  return this._pkceManager.startPKCETransaction();
1479
1353
  case 8:
1480
- keyPair = _context18.sent;
1354
+ keyPair = _context16.sent;
1481
1355
  codeChallenge = keyPair.code_challenge;
1482
- _context18.next = 13;
1356
+ _context16.next = 13;
1483
1357
  break;
1484
1358
  case 12:
1485
1359
  this._pkceManager.clearPKPair();
1486
1360
  case 13:
1487
- _context18.next = 15;
1361
+ _context16.next = 15;
1488
1362
  return this._networkClient.fetchSDK({
1489
1363
  url: '/b2b/oauth/google/onetap/submit',
1490
1364
  method: 'POST',
@@ -1498,80 +1372,197 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
1498
1372
  errorMessage: 'Failed to submit One Tap ID token'
1499
1373
  });
1500
1374
  case 15:
1501
- return _context18.abrupt("return", _context18.sent);
1375
+ return _context16.abrupt("return", _context16.sent);
1502
1376
  case 16:
1503
1377
  case "end":
1504
- return _context18.stop();
1378
+ return _context16.stop();
1505
1379
  }
1506
- }, _callee18, this);
1380
+ }, _callee16, this);
1507
1381
  }));
1508
1382
  }
1509
1383
  }, {
1510
1384
  key: "createOneTapClient",
1511
1385
  value: function createOneTapClient() {
1512
- return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1386
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1513
1387
  var googleClientId, err, client;
1514
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1515
- while (1) switch (_context19.prev = _context19.next) {
1388
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1389
+ while (1) switch (_context17.prev = _context17.next) {
1516
1390
  case 0:
1517
- _context19.prev = 0;
1518
- _context19.next = 3;
1391
+ _context17.prev = 0;
1392
+ _context17.next = 3;
1519
1393
  return this.fetchGoogleStart();
1520
1394
  case 3:
1521
- googleClientId = _context19.sent;
1522
- _context19.next = 10;
1395
+ googleClientId = _context17.sent;
1396
+ _context17.next = 10;
1523
1397
  break;
1524
1398
  case 6:
1525
- _context19.prev = 6;
1526
- _context19.t0 = _context19["catch"](0);
1527
- err = _context19.t0;
1528
- return _context19.abrupt("return", {
1399
+ _context17.prev = 6;
1400
+ _context17.t0 = _context17["catch"](0);
1401
+ err = _context17.t0;
1402
+ return _context17.abrupt("return", {
1529
1403
  success: false,
1530
1404
  reason: err.error_type
1531
1405
  });
1532
1406
  case 10:
1533
1407
  if (!(googleClientId === '')) {
1534
- _context19.next = 12;
1408
+ _context17.next = 12;
1535
1409
  break;
1536
1410
  }
1537
- return _context19.abrupt("return", {
1411
+ return _context17.abrupt("return", {
1538
1412
  success: false,
1539
1413
  reason: 'oauth_config_not_found'
1540
1414
  });
1541
1415
  case 12:
1542
- _context19.t1 = GoogleOneTapClient;
1543
- _context19.next = 15;
1416
+ _context17.t1 = GoogleOneTapClient;
1417
+ _context17.next = 15;
1544
1418
  return loadGoogleOneTapClient();
1545
1419
  case 15:
1546
- _context19.t2 = _context19.sent;
1547
- _context19.t3 = googleClientId;
1548
- client = new _context19.t1(_context19.t2, _context19.t3);
1549
- return _context19.abrupt("return", {
1420
+ _context17.t2 = _context17.sent;
1421
+ _context17.t3 = googleClientId;
1422
+ client = new _context17.t1(_context17.t2, _context17.t3);
1423
+ return _context17.abrupt("return", {
1550
1424
  success: true,
1551
1425
  client: client
1552
1426
  });
1553
1427
  case 19:
1554
1428
  case "end":
1555
- return _context19.stop();
1429
+ return _context17.stop();
1556
1430
  }
1557
- }, _callee19, this, [[0, 6]]);
1431
+ }, _callee17, this, [[0, 6]]);
1558
1432
  }));
1559
1433
  }
1560
1434
  }]);
1561
1435
  return B2BOneTapProvider;
1562
1436
  }();
1563
- var APINetworkClient = /*#__PURE__*/function (_NetworkClient) {
1564
- _inherits(APINetworkClient, _NetworkClient);
1565
- function APINetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, _additionalTelemetryDataFn) {
1566
- _classCallCheck(this, APINetworkClient);
1567
- var apiBackendURL = _liveAPIURL;
1437
+ var version = "5.0.0";
1438
+ var NetworkClient = /*#__PURE__*/function () {
1439
+ function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
1440
+ _classCallCheck(this, NetworkClient);
1441
+ this._publicToken = _publicToken;
1442
+ this._subscriptionDataLayer = _subscriptionDataLayer;
1443
+ this.additionalTelemetryDataFn = additionalTelemetryDataFn;
1444
+ this.updateSessionToken = function () {
1445
+ return null;
1446
+ };
1447
+ this.baseURL = _liveAPIURL;
1568
1448
  if (internal.isTestPublicToken(_publicToken)) {
1569
- apiBackendURL = _testAPIURL;
1449
+ this.baseURL = _testAPIURL;
1570
1450
  }
1571
- return _callSuper(this, APINetworkClient, [_publicToken, _subscriptionDataLayer, apiBackendURL, _additionalTelemetryDataFn]);
1451
+ this.eventLogger = new internal.EventLogger({
1452
+ maxBatchSize: internal.DEFAULT_MAX_BATCH_SIZE,
1453
+ intervalDurationMs: internal.DEFAULT_INTERVAL_DURATION_MS,
1454
+ logEventURL: this.buildSDKUrl('/events')
1455
+ });
1572
1456
  }
1573
- return _createClass(APINetworkClient);
1574
- }(NetworkClient);
1457
+ _createClass(NetworkClient, [{
1458
+ key: "logEvent",
1459
+ value: function logEvent(_ref12) {
1460
+ var name = _ref12.name,
1461
+ details = _ref12.details,
1462
+ _ref12$error = _ref12.error,
1463
+ error = _ref12$error === void 0 ? {} : _ref12$error;
1464
+ this.eventLogger.logEvent(this.createTelemetryBlob(), {
1465
+ public_token: this._publicToken,
1466
+ event_name: name,
1467
+ details: details,
1468
+ error_code: error.error_code,
1469
+ error_description: error.error_description,
1470
+ http_status_code: error.http_status_code
1471
+ });
1472
+ }
1473
+ }, {
1474
+ key: "createTelemetryBlob",
1475
+ value: function createTelemetryBlob() {
1476
+ return Object.assign(Object.assign({
1477
+ event_id: internal.createEventId(),
1478
+ app_session_id: internal.createAppSessionId(),
1479
+ persistent_id: internal.createPersistentId(),
1480
+ client_sent_at: new Date().toISOString(),
1481
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
1482
+ }, this.additionalTelemetryDataFn()), {
1483
+ app: {
1484
+ identifier: window.location.hostname
1485
+ },
1486
+ sdk: {
1487
+ identifier: 'Stytch.js Javascript SDK',
1488
+ version: version
1489
+ }
1490
+ });
1491
+ }
1492
+ }, {
1493
+ key: "fetchSDK",
1494
+ value: function fetchSDK(_ref13) {
1495
+ var url = _ref13.url,
1496
+ body = _ref13.body,
1497
+ errorMessage = _ref13.errorMessage,
1498
+ method = _ref13.method;
1499
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1500
+ var sessionToken, basicAuthHeader, xSDKClientHeader, xSDKParentHostHeader;
1501
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1502
+ while (1) switch (_context18.prev = _context18.next) {
1503
+ case 0:
1504
+ sessionToken = this._subscriptionDataLayer.readSessionCookie().session_token;
1505
+ basicAuthHeader = 'Basic ' + window.btoa(this._publicToken + ':' + (sessionToken || this._publicToken));
1506
+ xSDKClientHeader = window.btoa(JSON.stringify(this.createTelemetryBlob()));
1507
+ xSDKParentHostHeader = window.location.origin;
1508
+ return _context18.abrupt("return", internal.baseFetchSDK({
1509
+ basicAuthHeader: basicAuthHeader,
1510
+ body: body,
1511
+ errorMessage: errorMessage,
1512
+ finalURL: this.buildSDKUrl(url),
1513
+ method: method,
1514
+ xSDKClientHeader: xSDKClientHeader,
1515
+ xSDKParentHostHeader: xSDKParentHostHeader
1516
+ }));
1517
+ case 5:
1518
+ case "end":
1519
+ return _context18.stop();
1520
+ }
1521
+ }, _callee18, this);
1522
+ }));
1523
+ }
1524
+ }, {
1525
+ key: "retriableFetchSDK",
1526
+ value: function retriableFetchSDK(_ref14) {
1527
+ var url = _ref14.url,
1528
+ body = _ref14.body,
1529
+ errorMessage = _ref14.errorMessage,
1530
+ method = _ref14.method,
1531
+ retryCallback = _ref14.retryCallback;
1532
+ return internal.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1533
+ var sessionToken, basicAuthHeader, xSDKClientHeader, xSDKParentHostHeader;
1534
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1535
+ while (1) switch (_context19.prev = _context19.next) {
1536
+ case 0:
1537
+ sessionToken = this._subscriptionDataLayer.readSessionCookie().session_token;
1538
+ basicAuthHeader = 'Basic ' + window.btoa(this._publicToken + ':' + (sessionToken || this._publicToken));
1539
+ xSDKClientHeader = window.btoa(JSON.stringify(this.createTelemetryBlob()));
1540
+ xSDKParentHostHeader = window.location.origin;
1541
+ return _context19.abrupt("return", internal.retriableFetchSDK({
1542
+ basicAuthHeader: basicAuthHeader,
1543
+ body: body,
1544
+ errorMessage: errorMessage,
1545
+ finalURL: this.buildSDKUrl(url),
1546
+ method: method,
1547
+ xSDKClientHeader: xSDKClientHeader,
1548
+ xSDKParentHostHeader: xSDKParentHostHeader,
1549
+ retryCallback: retryCallback
1550
+ }));
1551
+ case 5:
1552
+ case "end":
1553
+ return _context19.stop();
1554
+ }
1555
+ }, _callee19, this);
1556
+ }));
1557
+ }
1558
+ }, {
1559
+ key: "buildSDKUrl",
1560
+ value: function buildSDKUrl(url) {
1561
+ return "".concat(this.baseURL, "/sdk/v1").concat(url);
1562
+ }
1563
+ }]);
1564
+ return NetworkClient;
1565
+ }();
1575
1566
  var StytchB2BHeadlessClient = /*#__PURE__*/_createClass(function StytchB2BHeadlessClient(_PUBLIC_TOKEN, options) {
1576
1567
  var _this11 = this;
1577
1568
  _classCallCheck(this, StytchB2BHeadlessClient);
@@ -1594,17 +1585,16 @@ var StytchB2BHeadlessClient = /*#__PURE__*/_createClass(function StytchB2BHeadle
1594
1585
  };
1595
1586
  };
1596
1587
  var passwordsPKCEManager = new PKCEManager(this._dataLayer, 'passwords');
1597
- this._networkClient = new NetworkClient(_PUBLIC_TOKEN, this._dataLayer, config.endpoints.sdkBackendURL, additionalTelemetryDataFn);
1598
- this._apiNetworkClient = new APINetworkClient(_PUBLIC_TOKEN, this._dataLayer, config.endpoints.liveAPIURL, config.endpoints.testAPIURL, additionalTelemetryDataFn);
1588
+ this._networkClient = new NetworkClient(_PUBLIC_TOKEN, this._dataLayer, config.endpoints.liveAPIURL, config.endpoints.testAPIURL, additionalTelemetryDataFn);
1599
1589
  var bootstrap = new BootstrapDataManager(_PUBLIC_TOKEN, this._networkClient, this._dataLayer);
1600
1590
  var captcha = new CaptchaProvider(bootstrap.getAsync());
1601
1591
  var dfpProtectedAuth = new internal.DFPProtectedAuthProvider(_PUBLIC_TOKEN, config.endpoints.dfpBackendURL, bootstrap.getAsync(), captcha.executeRecaptcha);
1602
1592
  var clientsideServices = new ClientsideServicesProvider(config.endpoints.clientsideServicesIframeURL);
1603
1593
  var pkceManagerForOAuth = new PKCEManager(this._dataLayer, 'oauth');
1604
- var oneTap = new B2BOneTapProvider(this._apiNetworkClient, pkceManagerForOAuth, bootstrap.getAsync());
1605
- this.organization = new internal.HeadlessB2BOrganizationClient(this._networkClient, this._apiNetworkClient, this._subscriptionService);
1606
- this.member = new internal.HeadlessB2BSelfClient(this._networkClient, this._apiNetworkClient, this._subscriptionService);
1607
- this.self = new internal.HeadlessB2BSelfClient(this._networkClient, this._apiNetworkClient, this._subscriptionService);
1594
+ var oneTap = new B2BOneTapProvider(this._networkClient, pkceManagerForOAuth, bootstrap.getAsync());
1595
+ this.organization = new internal.HeadlessB2BOrganizationClient(this._networkClient, this._networkClient, this._subscriptionService);
1596
+ this.member = new internal.HeadlessB2BSelfClient(this._networkClient, this._networkClient, this._subscriptionService);
1597
+ this.self = new internal.HeadlessB2BSelfClient(this._networkClient, this._networkClient, this._subscriptionService);
1608
1598
  this.session = new internal.HeadlessB2BSessionClient(this._networkClient, this._subscriptionService);
1609
1599
  this.magicLinks = new internal.HeadlessB2BMagicLinksClient(this._networkClient, this._subscriptionService, new PKCEManager(this._dataLayer, 'magic_links'), passwordsPKCEManager, bootstrap.getAsync(), dfpProtectedAuth);
1610
1600
  this.oauth = new HeadlessB2BOAuthClient(this._networkClient, this._subscriptionService, pkceManagerForOAuth, bootstrap.getAsync(), {
@@ -1623,7 +1613,7 @@ var StytchB2BHeadlessClient = /*#__PURE__*/_createClass(function StytchB2BHeadle
1623
1613
  this.totp = new internal.HeadlessB2BTOTPsClient(this._networkClient, this._subscriptionService, dfpProtectedAuth);
1624
1614
  this.recoveryCodes = new internal.HeadlessB2BRecoveryCodesClient(this._networkClient, this._subscriptionService, dfpProtectedAuth);
1625
1615
  this.rbac = new internal.HeadlessB2BRBACClient(bootstrap.getSync(), bootstrap.getAsync(), this._subscriptionService);
1626
- this.scim = new internal.HeadlessB2BSCIMClient(this._apiNetworkClient, this._subscriptionService);
1616
+ this.scim = new internal.HeadlessB2BSCIMClient(this._networkClient, this._subscriptionService);
1627
1617
  this._sessionManager = new internal.SessionManager(this._subscriptionService, this.session);
1628
1618
  var searchManager = new internal.SearchDataManager(this._networkClient, dfpProtectedAuth);
1629
1619
  if (this._dataLayer.readSessionCookie().session_token) {
@@ -1644,7 +1634,6 @@ var StytchB2BHeadlessClient = /*#__PURE__*/_createClass(function StytchB2BHeadle
1644
1634
  searchManager: searchManager,
1645
1635
  dataLayer: this._dataLayer,
1646
1636
  networkClient: this._networkClient,
1647
- apiNetworkClient: this._apiNetworkClient,
1648
1637
  oneTap: oneTap
1649
1638
  };
1650
1639
  internal.writeB2BInternals(this, internals);