@stytch/vanilla-js 4.5.3 → 4.5.5
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 +14 -0
- package/dist/b2b/index.d.ts +4 -743
- package/dist/b2b/index.esm.d.ts +4 -743
- package/dist/b2b/index.esm.js +2837 -3073
- package/dist/b2b/index.headless.d.ts +1 -737
- package/dist/b2b/index.headless.esm.d.ts +1 -737
- package/dist/b2b/index.headless.esm.js +698 -938
- package/dist/b2b/index.headless.js +984 -1238
- package/dist/b2b/index.js +3435 -3685
- package/dist/index.esm.js +3248 -3276
- package/dist/index.headless.esm.js +3 -2
- package/dist/index.headless.js +3 -2
- package/dist/index.js +3667 -3709
- package/package.json +2 -2
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
5
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
6
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
13
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
15
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
16
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(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); }
|
|
10
18
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
19
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
-
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; }
|
|
13
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || 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(_e4) { throw _e4; }, 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(_e5) { didErr = true; err = _e5; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
14
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(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); }
|
|
15
20
|
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
23
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
24
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
26
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
22
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
23
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
26
|
-
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
27
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
-
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
29
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
27
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
32
28
|
function e(t) {
|
|
33
29
|
return e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
@@ -138,36 +134,28 @@ function d(e) {
|
|
|
138
134
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
139
135
|
}, d(e);
|
|
140
136
|
}
|
|
137
|
+
var h, p, _, f, m, v;
|
|
141
138
|
Object.defineProperty(exports, "__esModule", {
|
|
142
139
|
value: !0
|
|
143
|
-
}), exports.Products = void 0,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
|
|
149
|
-
}(exports.Wallets || (exports.Wallets = {})), exports.OneTapPositions = void 0, function (e) {
|
|
150
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
151
|
-
}(exports.OneTapPositions || (exports.OneTapPositions = {})), exports.OTPMethods = void 0, function (e) {
|
|
152
|
-
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
153
|
-
}(exports.OTPMethods || (exports.OTPMethods = {})), exports.StytchEventType = void 0, function (e) {
|
|
154
|
-
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
155
|
-
}(exports.StytchEventType || (exports.StytchEventType = {}));
|
|
156
|
-
var h = function (e) {
|
|
140
|
+
}), exports.Products = void 0, (h = exports.Products || (exports.Products = {})).emailMagicLinks = "emailMagicLinks", h.oauth = "oauth", h.otp = "otp", h.crypto = "crypto", h.passwords = "passwords", h.passkeys = "passkeys", exports.OAuthProviders = void 0, (p = exports.OAuthProviders || (exports.OAuthProviders = {})).Google = "google", p.Microsoft = "microsoft", p.Apple = "apple", p.Github = "github", p.GitLab = "gitlab", p.Facebook = "facebook", p.Discord = "discord", p.Salesforce = "salesforce", p.Slack = "slack", p.Amazon = "amazon", p.Bitbucket = "bitbucket", p.LinkedIn = "linkedin", p.Coinbase = "coinbase", p.Twitch = "twitch", p.Twitter = "twitter", p.TikTok = "tiktok", p.Snapchat = "snapchat", p.Figma = "figma", p.Yahoo = "yahoo", exports.Wallets = void 0, (_ = exports.Wallets || (exports.Wallets = {})).Vessel = "Vessel", _.Phantom = "Phantom", _.Metamask = "Metamask", _.Coinbase = "Coinbase", _.Binance = "Binance", _.GenericEthereumWallet = "Other Ethereum Wallet", _.GenericSolanaWallet = "Other Solana Wallet", exports.OneTapPositions = void 0, (f = exports.OneTapPositions || (exports.OneTapPositions = {})).embedded = "embedded", f.floating = "floating", exports.OTPMethods = void 0, (m = exports.OTPMethods || (exports.OTPMethods = {})).SMS = "sms", m.WhatsApp = "whatsapp", m.Email = "email", exports.StytchEventType = void 0, (v = exports.StytchEventType || (exports.StytchEventType = {})).MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", v.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", v.OTPsAuthenticate = "OTP_AUTHENTICATE", v.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", v.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", v.PasswordCreate = "PASSWORD_CREATE", v.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", v.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", v.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", v.PasskeyRegister = "PASSKEY_REGISTER", v.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", v.PasskeySkip = "PASSKEY_SKIP", v.PasskeyDone = "PASSKEY_DONE", v.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", v.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", v.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", v.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", v.B2BSSOStart = "B2B_SSO_START", v.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", v.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", v.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", v.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", v.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", v.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", v.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", v.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", v.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
141
|
+
var b,
|
|
142
|
+
g,
|
|
143
|
+
k,
|
|
144
|
+
y = function (e) {
|
|
157
145
|
function t(e, r) {
|
|
158
146
|
var n;
|
|
159
147
|
return i(this, t), (n = o(this, t, [e + "\n" + r])).message = e + "\n" + r, n.name = "SDKAPIUnreachableError", n.details = r, Object.setPrototypeOf(s(n), t.prototype), n;
|
|
160
148
|
}
|
|
161
149
|
return a(t, c(Error)), r(t);
|
|
162
150
|
}(),
|
|
163
|
-
|
|
151
|
+
w = function (e) {
|
|
164
152
|
function t(e, r) {
|
|
165
153
|
var n;
|
|
166
154
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
167
155
|
}
|
|
168
156
|
return a(t, c(Error)), r(t);
|
|
169
157
|
}(),
|
|
170
|
-
|
|
158
|
+
S = function (e) {
|
|
171
159
|
function t(e) {
|
|
172
160
|
var r, n;
|
|
173
161
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -178,7 +166,7 @@ var h = function (e) {
|
|
|
178
166
|
}
|
|
179
167
|
return a(t, c(Error)), r(t);
|
|
180
168
|
}(),
|
|
181
|
-
|
|
169
|
+
x = function (e) {
|
|
182
170
|
function t(e) {
|
|
183
171
|
var r;
|
|
184
172
|
i(this, t), (r = o(this, t)).name = "StytchSDKAPIError";
|
|
@@ -191,22 +179,22 @@ var h = function (e) {
|
|
|
191
179
|
}
|
|
192
180
|
return a(t, c(Error)), r(t);
|
|
193
181
|
}(),
|
|
194
|
-
|
|
195
|
-
|
|
182
|
+
P = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
183
|
+
C = function (e) {
|
|
196
184
|
function t(e, r) {
|
|
197
185
|
var n;
|
|
198
186
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
199
187
|
}
|
|
200
188
|
return a(t, c(Error)), r(t);
|
|
201
189
|
}(),
|
|
202
|
-
|
|
190
|
+
O = function (e) {
|
|
203
191
|
function t(e) {
|
|
204
192
|
var r;
|
|
205
193
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
206
194
|
}
|
|
207
|
-
return a(t,
|
|
195
|
+
return a(t, C), r(t);
|
|
208
196
|
}(),
|
|
209
|
-
|
|
197
|
+
T = function (e) {
|
|
210
198
|
function t(e) {
|
|
211
199
|
var r;
|
|
212
200
|
i(this, t);
|
|
@@ -215,9 +203,9 @@ var h = function (e) {
|
|
|
215
203
|
}).join("\n");
|
|
216
204
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
217
205
|
}
|
|
218
|
-
return a(t,
|
|
206
|
+
return a(t, C), r(t);
|
|
219
207
|
}(),
|
|
220
|
-
|
|
208
|
+
A = function (e) {
|
|
221
209
|
function t(e) {
|
|
222
210
|
var r;
|
|
223
211
|
i(this, t);
|
|
@@ -228,190 +216,190 @@ var h = function (e) {
|
|
|
228
216
|
u = e.request_id;
|
|
229
217
|
return (r = o(this, t, ["StytchAPIError", "[".concat(n, "] ").concat(s, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : "")])).error_type = s, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = n, r;
|
|
230
218
|
}
|
|
231
|
-
return a(t,
|
|
219
|
+
return a(t, C), r(t);
|
|
232
220
|
}(),
|
|
233
|
-
|
|
221
|
+
E = function (e) {
|
|
234
222
|
function t(e, r, n) {
|
|
235
223
|
var s;
|
|
236
224
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
237
225
|
}
|
|
238
|
-
return a(t,
|
|
226
|
+
return a(t, C), r(t);
|
|
239
227
|
}(),
|
|
240
|
-
|
|
228
|
+
D = function (e) {
|
|
241
229
|
function t() {
|
|
242
230
|
return i(this, t), o(this, t, ["NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session."]);
|
|
243
231
|
}
|
|
244
|
-
return a(t,
|
|
232
|
+
return a(t, E), r(t);
|
|
245
233
|
}(),
|
|
246
|
-
|
|
234
|
+
I = function (e) {
|
|
247
235
|
function t(e) {
|
|
248
236
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
249
237
|
}
|
|
250
|
-
return a(t,
|
|
238
|
+
return a(t, E), r(t);
|
|
251
239
|
}(),
|
|
252
|
-
|
|
240
|
+
F = function (e) {
|
|
253
241
|
function t() {
|
|
254
242
|
return i(this, t), o(this, t, ["NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first."]);
|
|
255
243
|
}
|
|
256
|
-
return a(t,
|
|
244
|
+
return a(t, E), r(t);
|
|
257
245
|
}(),
|
|
258
|
-
|
|
246
|
+
j = function (e) {
|
|
259
247
|
function t() {
|
|
260
248
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
261
249
|
}
|
|
262
|
-
return a(t,
|
|
250
|
+
return a(t, E), r(t);
|
|
263
251
|
}(),
|
|
264
|
-
|
|
252
|
+
R = function (e) {
|
|
265
253
|
function t() {
|
|
266
254
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
267
255
|
}
|
|
268
|
-
return a(t,
|
|
256
|
+
return a(t, E), r(t);
|
|
269
257
|
}(),
|
|
270
|
-
|
|
258
|
+
M = function (e) {
|
|
271
259
|
function t() {
|
|
272
260
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
273
261
|
}
|
|
274
|
-
return a(t,
|
|
262
|
+
return a(t, E), r(t);
|
|
275
263
|
}(),
|
|
276
|
-
|
|
264
|
+
L = function (e) {
|
|
277
265
|
function t() {
|
|
278
266
|
return i(this, t), o(this, t, ["NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings."]);
|
|
279
267
|
}
|
|
280
|
-
return a(t,
|
|
268
|
+
return a(t, E), r(t);
|
|
281
269
|
}(),
|
|
282
|
-
|
|
270
|
+
B = function (e) {
|
|
283
271
|
function t() {
|
|
284
272
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
285
273
|
}
|
|
286
|
-
return a(t,
|
|
274
|
+
return a(t, E), r(t);
|
|
287
275
|
}(),
|
|
288
|
-
|
|
276
|
+
K = function (e) {
|
|
289
277
|
function t() {
|
|
290
278
|
return i(this, t), o(this, t, ["UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later."]);
|
|
291
279
|
}
|
|
292
|
-
return a(t,
|
|
280
|
+
return a(t, E), r(t);
|
|
293
281
|
}(),
|
|
294
|
-
|
|
282
|
+
z = function (e) {
|
|
295
283
|
function t() {
|
|
296
284
|
return i(this, t), o(this, t, ["DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods."]);
|
|
297
285
|
}
|
|
298
|
-
return a(t,
|
|
286
|
+
return a(t, E), r(t);
|
|
299
287
|
}(),
|
|
300
|
-
|
|
288
|
+
N = function (e) {
|
|
301
289
|
function t() {
|
|
302
290
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
303
291
|
}
|
|
304
|
-
return a(t,
|
|
292
|
+
return a(t, E), r(t);
|
|
305
293
|
}(),
|
|
306
|
-
|
|
294
|
+
U = function (e) {
|
|
307
295
|
function t() {
|
|
308
296
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
309
297
|
}
|
|
310
|
-
return a(t,
|
|
298
|
+
return a(t, E), r(t);
|
|
311
299
|
}(),
|
|
312
|
-
|
|
300
|
+
q = function (e) {
|
|
313
301
|
function t() {
|
|
314
302
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
315
303
|
}
|
|
316
|
-
return a(t,
|
|
304
|
+
return a(t, E), r(t);
|
|
317
305
|
}(),
|
|
318
|
-
|
|
306
|
+
W = function (e) {
|
|
319
307
|
function t() {
|
|
320
308
|
return i(this, t), o(this, t, ["InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method."]);
|
|
321
309
|
}
|
|
322
|
-
return a(t,
|
|
310
|
+
return a(t, E), r(t);
|
|
323
311
|
}(),
|
|
324
|
-
|
|
312
|
+
H = function (e) {
|
|
325
313
|
function t() {
|
|
326
314
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
327
315
|
}
|
|
328
|
-
return a(t,
|
|
316
|
+
return a(t, E), r(t);
|
|
329
317
|
}(),
|
|
330
|
-
|
|
318
|
+
G = function (e) {
|
|
331
319
|
function t() {
|
|
332
320
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
333
321
|
}
|
|
334
|
-
return a(t,
|
|
322
|
+
return a(t, E), r(t);
|
|
335
323
|
}(),
|
|
336
|
-
|
|
324
|
+
V = function (e) {
|
|
337
325
|
function t() {
|
|
338
326
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
339
327
|
}
|
|
340
|
-
return a(t,
|
|
328
|
+
return a(t, E), r(t);
|
|
341
329
|
}(),
|
|
342
|
-
|
|
330
|
+
Y = function (e) {
|
|
343
331
|
function t() {
|
|
344
332
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
345
333
|
}
|
|
346
|
-
return a(t,
|
|
334
|
+
return a(t, E), r(t);
|
|
347
335
|
}(),
|
|
348
|
-
|
|
336
|
+
J = function (e) {
|
|
349
337
|
function t() {
|
|
350
338
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
351
339
|
}
|
|
352
|
-
return a(t,
|
|
340
|
+
return a(t, E), r(t);
|
|
353
341
|
}(),
|
|
354
|
-
|
|
342
|
+
$ = function (e) {
|
|
355
343
|
function t() {
|
|
356
344
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
357
345
|
}
|
|
358
|
-
return a(t,
|
|
346
|
+
return a(t, E), r(t);
|
|
359
347
|
}(),
|
|
360
|
-
|
|
348
|
+
X = function (e) {
|
|
361
349
|
function t() {
|
|
362
350
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
363
351
|
}
|
|
364
|
-
return a(t,
|
|
352
|
+
return a(t, E), r(t);
|
|
365
353
|
}(),
|
|
366
|
-
|
|
354
|
+
Z = function (e) {
|
|
367
355
|
function t() {
|
|
368
356
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
369
357
|
}
|
|
370
|
-
return a(t,
|
|
358
|
+
return a(t, E), r(t);
|
|
371
359
|
}(),
|
|
372
|
-
|
|
360
|
+
Q = function (e) {
|
|
373
361
|
function t() {
|
|
374
362
|
return i(this, t), o(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
375
363
|
}
|
|
376
|
-
return a(t,
|
|
364
|
+
return a(t, E), r(t);
|
|
377
365
|
}(),
|
|
378
|
-
|
|
366
|
+
ee = function (e) {
|
|
379
367
|
function t() {
|
|
380
368
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
381
369
|
}
|
|
382
|
-
return a(t,
|
|
370
|
+
return a(t, E), r(t);
|
|
383
371
|
}(),
|
|
384
|
-
|
|
372
|
+
te = function (e) {
|
|
385
373
|
function t() {
|
|
386
374
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
387
375
|
}
|
|
388
|
-
return a(t,
|
|
376
|
+
return a(t, E), r(t);
|
|
389
377
|
}(),
|
|
390
|
-
|
|
378
|
+
re = function (e) {
|
|
391
379
|
function t() {
|
|
392
380
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
393
381
|
}
|
|
394
|
-
return a(t,
|
|
382
|
+
return a(t, E), r(t);
|
|
395
383
|
}(),
|
|
396
|
-
|
|
384
|
+
ne = function (e) {
|
|
397
385
|
function t() {
|
|
398
386
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
399
387
|
}
|
|
400
|
-
return a(t,
|
|
388
|
+
return a(t, E), r(t);
|
|
401
389
|
}(),
|
|
402
|
-
|
|
390
|
+
ie = function (e) {
|
|
403
391
|
function t() {
|
|
404
392
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
405
393
|
}
|
|
406
|
-
return a(t,
|
|
394
|
+
return a(t, E), r(t);
|
|
407
395
|
}(),
|
|
408
|
-
|
|
396
|
+
oe = function (e) {
|
|
409
397
|
function t() {
|
|
410
398
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
411
399
|
}
|
|
412
|
-
return a(t,
|
|
400
|
+
return a(t, E), r(t);
|
|
413
401
|
}();
|
|
414
|
-
function
|
|
402
|
+
function se(e, t) {
|
|
415
403
|
return function (e) {
|
|
416
404
|
if (Array.isArray(e)) return e;
|
|
417
405
|
}(e) || function (e, t) {
|
|
@@ -440,32 +428,32 @@ function X(e, t) {
|
|
|
440
428
|
}
|
|
441
429
|
return a;
|
|
442
430
|
}
|
|
443
|
-
}(e, t) ||
|
|
431
|
+
}(e, t) || ae(e, t) || function () {
|
|
444
432
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
445
433
|
}();
|
|
446
434
|
}
|
|
447
|
-
function
|
|
435
|
+
function ae(e, t) {
|
|
448
436
|
if (e) {
|
|
449
|
-
if ("string" == typeof e) return
|
|
437
|
+
if ("string" == typeof e) return ce(e, t);
|
|
450
438
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
451
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
439
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ce(e, t) : void 0;
|
|
452
440
|
}
|
|
453
441
|
}
|
|
454
|
-
function
|
|
442
|
+
function ce(e, t) {
|
|
455
443
|
(null == t || t > e.length) && (t = e.length);
|
|
456
444
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
457
445
|
return n;
|
|
458
446
|
}
|
|
459
|
-
function
|
|
460
|
-
return
|
|
447
|
+
function ue(e) {
|
|
448
|
+
return ue = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
461
449
|
return _typeof(e);
|
|
462
450
|
} : function (e) {
|
|
463
451
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
464
|
-
},
|
|
452
|
+
}, ue(e);
|
|
465
453
|
}
|
|
466
|
-
function
|
|
454
|
+
function le() {
|
|
467
455
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
468
|
-
|
|
456
|
+
le = function le() {
|
|
469
457
|
return t;
|
|
470
458
|
};
|
|
471
459
|
var e,
|
|
@@ -497,7 +485,7 @@ function te() {
|
|
|
497
485
|
function l(e, t, r, n) {
|
|
498
486
|
var o = t && t.prototype instanceof v ? t : v,
|
|
499
487
|
s = Object.create(o.prototype),
|
|
500
|
-
a = new
|
|
488
|
+
a = new E(n || []);
|
|
501
489
|
return i(s, "_invoke", {
|
|
502
490
|
value: C(e, r, a)
|
|
503
491
|
}), s;
|
|
@@ -524,28 +512,28 @@ function te() {
|
|
|
524
512
|
function v() {}
|
|
525
513
|
function b() {}
|
|
526
514
|
function g() {}
|
|
527
|
-
var
|
|
528
|
-
u(
|
|
515
|
+
var k = {};
|
|
516
|
+
u(k, s, function () {
|
|
529
517
|
return this;
|
|
530
518
|
});
|
|
531
|
-
var
|
|
532
|
-
w =
|
|
533
|
-
w && w !== r && n.call(w, s) && (
|
|
534
|
-
var S = g.prototype = v.prototype = Object.create(
|
|
535
|
-
function
|
|
519
|
+
var y = Object.getPrototypeOf,
|
|
520
|
+
w = y && y(y(D([])));
|
|
521
|
+
w && w !== r && n.call(w, s) && (k = w);
|
|
522
|
+
var S = g.prototype = v.prototype = Object.create(k);
|
|
523
|
+
function x(e) {
|
|
536
524
|
["next", "throw", "return"].forEach(function (t) {
|
|
537
525
|
u(e, t, function (e) {
|
|
538
526
|
return this._invoke(t, e);
|
|
539
527
|
});
|
|
540
528
|
});
|
|
541
529
|
}
|
|
542
|
-
function
|
|
530
|
+
function P(e, t) {
|
|
543
531
|
function r(i, o, s, a) {
|
|
544
532
|
var c = d(e[i], e, o);
|
|
545
533
|
if ("throw" !== c.type) {
|
|
546
534
|
var u = c.arg,
|
|
547
535
|
l = u.value;
|
|
548
|
-
return l && "object" ==
|
|
536
|
+
return l && "object" == ue(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
549
537
|
r("next", e, s, a);
|
|
550
538
|
}, function (e) {
|
|
551
539
|
r("throw", e, s, a);
|
|
@@ -583,7 +571,7 @@ function te() {
|
|
|
583
571
|
for (n.method = o, n.arg = s;;) {
|
|
584
572
|
var a = n.delegate;
|
|
585
573
|
if (a) {
|
|
586
|
-
var c =
|
|
574
|
+
var c = O(a, n);
|
|
587
575
|
if (c) {
|
|
588
576
|
if (c === m) continue;
|
|
589
577
|
return c;
|
|
@@ -606,10 +594,10 @@ function te() {
|
|
|
606
594
|
}
|
|
607
595
|
};
|
|
608
596
|
}
|
|
609
|
-
function
|
|
597
|
+
function O(t, r) {
|
|
610
598
|
var n = r.method,
|
|
611
599
|
i = t.iterator[n];
|
|
612
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
600
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, O(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
613
601
|
var o = d(i, t.iterator, r.arg);
|
|
614
602
|
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
615
603
|
var s = o.arg;
|
|
@@ -621,11 +609,11 @@ function te() {
|
|
|
621
609
|
};
|
|
622
610
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
623
611
|
}
|
|
624
|
-
function
|
|
612
|
+
function A(e) {
|
|
625
613
|
var t = e.completion || {};
|
|
626
614
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
627
615
|
}
|
|
628
|
-
function
|
|
616
|
+
function E(e) {
|
|
629
617
|
this.tryEntries = [{
|
|
630
618
|
tryLoc: "root"
|
|
631
619
|
}], e.forEach(T, this), this.reset(!0);
|
|
@@ -644,7 +632,7 @@ function te() {
|
|
|
644
632
|
return o.next = o;
|
|
645
633
|
}
|
|
646
634
|
}
|
|
647
|
-
throw new TypeError(
|
|
635
|
+
throw new TypeError(ue(t) + " is not iterable");
|
|
648
636
|
}
|
|
649
637
|
return b.prototype = g, i(S, "constructor", {
|
|
650
638
|
value: g,
|
|
@@ -661,15 +649,15 @@ function te() {
|
|
|
661
649
|
return {
|
|
662
650
|
__await: e
|
|
663
651
|
};
|
|
664
|
-
}, P
|
|
652
|
+
}, x(P.prototype), u(P.prototype, a, function () {
|
|
665
653
|
return this;
|
|
666
|
-
}), t.AsyncIterator =
|
|
654
|
+
}), t.AsyncIterator = P, t.async = function (e, r, n, i, o) {
|
|
667
655
|
void 0 === o && (o = Promise);
|
|
668
|
-
var s = new
|
|
656
|
+
var s = new P(l(e, r, n, i), o);
|
|
669
657
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
670
658
|
return e.done ? e.value : s.next();
|
|
671
659
|
});
|
|
672
|
-
},
|
|
660
|
+
}, x(S), u(S, c, "Generator"), u(S, s, function () {
|
|
673
661
|
return this;
|
|
674
662
|
}), u(S, "toString", function () {
|
|
675
663
|
return "[object Generator]";
|
|
@@ -684,10 +672,10 @@ function te() {
|
|
|
684
672
|
}
|
|
685
673
|
return e.done = !0, e;
|
|
686
674
|
};
|
|
687
|
-
}, t.values = D,
|
|
688
|
-
constructor:
|
|
675
|
+
}, t.values = D, E.prototype = {
|
|
676
|
+
constructor: E,
|
|
689
677
|
reset: function reset(t) {
|
|
690
|
-
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(
|
|
678
|
+
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);
|
|
691
679
|
},
|
|
692
680
|
stop: function stop() {
|
|
693
681
|
this.done = !0;
|
|
@@ -739,7 +727,7 @@ function te() {
|
|
|
739
727
|
finish: function finish(e) {
|
|
740
728
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
741
729
|
var r = this.tryEntries[t];
|
|
742
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
730
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), A(r), m;
|
|
743
731
|
}
|
|
744
732
|
},
|
|
745
733
|
"catch": function _catch(e) {
|
|
@@ -749,7 +737,7 @@ function te() {
|
|
|
749
737
|
var n = r.completion;
|
|
750
738
|
if ("throw" === n.type) {
|
|
751
739
|
var i = n.arg;
|
|
752
|
-
|
|
740
|
+
A(r);
|
|
753
741
|
}
|
|
754
742
|
return i;
|
|
755
743
|
}
|
|
@@ -765,46 +753,46 @@ function te() {
|
|
|
765
753
|
}
|
|
766
754
|
}, t;
|
|
767
755
|
}
|
|
768
|
-
function
|
|
756
|
+
function de(e, t) {
|
|
769
757
|
for (var r = 0; r < t.length; r++) {
|
|
770
758
|
var n = t[r];
|
|
771
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
759
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, pe(n.key), n);
|
|
772
760
|
}
|
|
773
761
|
}
|
|
774
|
-
function
|
|
775
|
-
return t &&
|
|
762
|
+
function he(e, t, r) {
|
|
763
|
+
return t && de(e.prototype, t), r && de(e, r), Object.defineProperty(e, "prototype", {
|
|
776
764
|
writable: !1
|
|
777
765
|
}), e;
|
|
778
766
|
}
|
|
779
|
-
function
|
|
767
|
+
function pe(e) {
|
|
780
768
|
var t = function (e, t) {
|
|
781
|
-
if ("object" !=
|
|
769
|
+
if ("object" != ue(e) || !e) return e;
|
|
782
770
|
var r = e[Symbol.toPrimitive];
|
|
783
771
|
if (void 0 !== r) {
|
|
784
772
|
var n = r.call(e, t || "default");
|
|
785
|
-
if ("object" !=
|
|
773
|
+
if ("object" != ue(n)) return n;
|
|
786
774
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
787
775
|
}
|
|
788
776
|
return ("string" === t ? String : Number)(e);
|
|
789
777
|
}(e, "string");
|
|
790
|
-
return "symbol" ==
|
|
778
|
+
return "symbol" == ue(t) ? t : String(t);
|
|
791
779
|
}
|
|
792
|
-
function
|
|
780
|
+
function _e(e, t) {
|
|
793
781
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
794
782
|
}
|
|
795
|
-
function
|
|
796
|
-
return t =
|
|
797
|
-
if (t && ("object" ===
|
|
783
|
+
function fe(e, t, r) {
|
|
784
|
+
return t = ge(t), function (e, t) {
|
|
785
|
+
if (t && ("object" === ue(t) || "function" == typeof t)) return t;
|
|
798
786
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
799
787
|
return function (e) {
|
|
800
788
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
801
789
|
return e;
|
|
802
790
|
}(e);
|
|
803
|
-
}(e,
|
|
791
|
+
}(e, ve() ? Reflect.construct(t, r || [], ge(e).constructor) : t.apply(e, r));
|
|
804
792
|
}
|
|
805
|
-
function
|
|
793
|
+
function me(e) {
|
|
806
794
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
807
|
-
return
|
|
795
|
+
return me = function me(e) {
|
|
808
796
|
if (null === e || !function (e) {
|
|
809
797
|
try {
|
|
810
798
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -819,12 +807,12 @@ function ae(e) {
|
|
|
819
807
|
}
|
|
820
808
|
function r() {
|
|
821
809
|
return function (e, t, r) {
|
|
822
|
-
if (
|
|
810
|
+
if (ve()) return Reflect.construct.apply(null, arguments);
|
|
823
811
|
var n = [null];
|
|
824
812
|
n.push.apply(n, t);
|
|
825
813
|
var i = new (e.bind.apply(e, n))();
|
|
826
|
-
return r &&
|
|
827
|
-
}(e, arguments,
|
|
814
|
+
return r && be(i, r.prototype), i;
|
|
815
|
+
}(e, arguments, ge(this).constructor);
|
|
828
816
|
}
|
|
829
817
|
return r.prototype = Object.create(e.prototype, {
|
|
830
818
|
constructor: {
|
|
@@ -833,36 +821,30 @@ function ae(e) {
|
|
|
833
821
|
writable: !0,
|
|
834
822
|
configurable: !0
|
|
835
823
|
}
|
|
836
|
-
}),
|
|
837
|
-
},
|
|
824
|
+
}), be(r, e);
|
|
825
|
+
}, me(e);
|
|
838
826
|
}
|
|
839
|
-
function
|
|
827
|
+
function ve() {
|
|
840
828
|
try {
|
|
841
829
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
842
830
|
} catch (e) {}
|
|
843
|
-
return (
|
|
831
|
+
return (ve = function ve() {
|
|
844
832
|
return !!e;
|
|
845
833
|
})();
|
|
846
834
|
}
|
|
847
|
-
function
|
|
848
|
-
return
|
|
835
|
+
function be(e, t) {
|
|
836
|
+
return be = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
849
837
|
return e.__proto__ = t, e;
|
|
850
|
-
},
|
|
838
|
+
}, be(e, t);
|
|
851
839
|
}
|
|
852
|
-
function
|
|
853
|
-
return
|
|
840
|
+
function ge(e) {
|
|
841
|
+
return ge = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
854
842
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
855
|
-
},
|
|
843
|
+
}, ge(e);
|
|
856
844
|
}
|
|
857
|
-
exports.B2BProducts = void 0,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
861
|
-
}(exports.AuthFlowType || (exports.AuthFlowType = {})), exports.B2BOAuthProviders = void 0, function (e) {
|
|
862
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
863
|
-
}(exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {}));
|
|
864
|
-
var de;
|
|
865
|
-
function he(e, t, r, n) {
|
|
845
|
+
exports.B2BProducts = void 0, (b = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", b.sso = "sso", b.passwords = "passwords", b.oauth = "oauth", exports.AuthFlowType = void 0, (g = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", g.Organization = "Organization", g.PasswordReset = "PasswordReset", exports.B2BOAuthProviders = void 0, (k = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", k.Microsoft = "microsoft";
|
|
846
|
+
var ke;
|
|
847
|
+
function ye(e, t, r, n) {
|
|
866
848
|
return new (r || (r = Promise))(function (i, o) {
|
|
867
849
|
function s(e) {
|
|
868
850
|
try {
|
|
@@ -887,12 +869,14 @@ function he(e, t, r, n) {
|
|
|
887
869
|
c((n = n.apply(e, t || [])).next());
|
|
888
870
|
});
|
|
889
871
|
}
|
|
890
|
-
"function" == typeof SuppressedError && SuppressedError,
|
|
891
|
-
|
|
892
|
-
|
|
872
|
+
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
873
|
+
e.RequiredCatcha = "Catcha Required";
|
|
874
|
+
}(ke || (ke = {}));
|
|
875
|
+
var we,
|
|
876
|
+
Se = function (e) {
|
|
893
877
|
function t(e) {
|
|
894
878
|
var r;
|
|
895
|
-
return
|
|
879
|
+
return _e(this, t), (r = fe(this, t, [e])).type = e, r;
|
|
896
880
|
}
|
|
897
881
|
return function (e, t) {
|
|
898
882
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -904,10 +888,10 @@ var pe,
|
|
|
904
888
|
}
|
|
905
889
|
}), Object.defineProperty(e, "prototype", {
|
|
906
890
|
writable: !1
|
|
907
|
-
}), t &&
|
|
908
|
-
}(t,
|
|
891
|
+
}), t && be(e, t);
|
|
892
|
+
}(t, me(Error)), he(t);
|
|
909
893
|
}();
|
|
910
|
-
function
|
|
894
|
+
function xe(e) {
|
|
911
895
|
var t,
|
|
912
896
|
r = e.method,
|
|
913
897
|
n = e.finalURL,
|
|
@@ -915,9 +899,9 @@ function fe(e) {
|
|
|
915
899
|
o = e.xSDKClientHeader,
|
|
916
900
|
s = e.xSDKParentHostHeader,
|
|
917
901
|
a = e.body;
|
|
918
|
-
return
|
|
902
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
919
903
|
var c, u, l, d, h, p;
|
|
920
|
-
return
|
|
904
|
+
return le().wrap(function (e) {
|
|
921
905
|
for (;;) switch (e.prev = e.next) {
|
|
922
906
|
case 0:
|
|
923
907
|
return c = {
|
|
@@ -937,7 +921,7 @@ function fe(e) {
|
|
|
937
921
|
e.next = 13;
|
|
938
922
|
break;
|
|
939
923
|
}
|
|
940
|
-
throw new
|
|
924
|
+
throw new O("Unable to contact the Stytch servers. Are you online?");
|
|
941
925
|
case 13:
|
|
942
926
|
throw e.t0;
|
|
943
927
|
case 14:
|
|
@@ -949,7 +933,7 @@ function fe(e) {
|
|
|
949
933
|
case 18:
|
|
950
934
|
return d = e.sent, e.abrupt("return", d.data);
|
|
951
935
|
case 22:
|
|
952
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
936
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new O("Invalid JSON response from the Stytch servers.");
|
|
953
937
|
case 25:
|
|
954
938
|
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
955
939
|
e.next = 38;
|
|
@@ -960,30 +944,30 @@ function fe(e) {
|
|
|
960
944
|
h = e.sent, e.next = 35;
|
|
961
945
|
break;
|
|
962
946
|
case 32:
|
|
963
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
947
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new O("Invalid or no response from server");
|
|
964
948
|
case 35:
|
|
965
949
|
if (!("body" in h || "params" in h || "query" in h)) {
|
|
966
950
|
e.next = 37;
|
|
967
951
|
break;
|
|
968
952
|
}
|
|
969
|
-
throw new
|
|
953
|
+
throw new T(h);
|
|
970
954
|
case 37:
|
|
971
|
-
throw new
|
|
955
|
+
throw new A(h);
|
|
972
956
|
case 38:
|
|
973
957
|
return e.prev = 38, e.next = 41, l.text();
|
|
974
958
|
case 41:
|
|
975
959
|
p = e.sent, e.next = 47;
|
|
976
960
|
break;
|
|
977
961
|
case 44:
|
|
978
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
962
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new O("Invalid response from the Stytch servers.");
|
|
979
963
|
case 47:
|
|
980
964
|
if (!p.includes("Captcha required")) {
|
|
981
965
|
e.next = 49;
|
|
982
966
|
break;
|
|
983
967
|
}
|
|
984
|
-
throw new
|
|
968
|
+
throw new Se(ke.RequiredCatcha);
|
|
985
969
|
case 49:
|
|
986
|
-
throw new
|
|
970
|
+
throw new O("Invalid response from the Stytch servers.");
|
|
987
971
|
case 50:
|
|
988
972
|
case "end":
|
|
989
973
|
return e.stop();
|
|
@@ -991,43 +975,43 @@ function fe(e) {
|
|
|
991
975
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
992
976
|
}));
|
|
993
977
|
}
|
|
994
|
-
var
|
|
995
|
-
function
|
|
996
|
-
if (!
|
|
997
|
-
return
|
|
978
|
+
var Pe = new Uint8Array(16);
|
|
979
|
+
function Ce() {
|
|
980
|
+
if (!we && !(we = "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");
|
|
981
|
+
return we(Pe);
|
|
998
982
|
}
|
|
999
|
-
var
|
|
1000
|
-
for (var
|
|
1001
|
-
function
|
|
983
|
+
var Oe = /^(?:[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;
|
|
984
|
+
for (var Te = [], Ae = 0; Ae < 256; ++Ae) Te.push((Ae + 256).toString(16).substr(1));
|
|
985
|
+
function Ee(e) {
|
|
1002
986
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1003
|
-
r = (
|
|
987
|
+
r = (Te[e[t + 0]] + Te[e[t + 1]] + Te[e[t + 2]] + Te[e[t + 3]] + "-" + Te[e[t + 4]] + Te[e[t + 5]] + "-" + Te[e[t + 6]] + Te[e[t + 7]] + "-" + Te[e[t + 8]] + Te[e[t + 9]] + "-" + Te[e[t + 10]] + Te[e[t + 11]] + Te[e[t + 12]] + Te[e[t + 13]] + Te[e[t + 14]] + Te[e[t + 15]]).toLowerCase();
|
|
1004
988
|
if (!function (e) {
|
|
1005
|
-
return "string" == typeof e &&
|
|
989
|
+
return "string" == typeof e && Oe.test(e);
|
|
1006
990
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1007
991
|
return r;
|
|
1008
992
|
}
|
|
1009
|
-
function
|
|
1010
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
993
|
+
function De(e, t, r) {
|
|
994
|
+
var n = (e = e || {}).random || (e.rng || Ce)();
|
|
1011
995
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1012
996
|
r = r || 0;
|
|
1013
997
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1014
998
|
return t;
|
|
1015
999
|
}
|
|
1016
|
-
return
|
|
1000
|
+
return Ee(n);
|
|
1017
1001
|
}
|
|
1018
|
-
var
|
|
1019
|
-
function
|
|
1020
|
-
return
|
|
1021
|
-
return
|
|
1002
|
+
var Ie = {};
|
|
1003
|
+
function Fe(e, t) {
|
|
1004
|
+
return ye(this, void 0, void 0, le().mark(function r() {
|
|
1005
|
+
return le().wrap(function (r) {
|
|
1022
1006
|
for (;;) switch (r.prev = r.next) {
|
|
1023
1007
|
case 0:
|
|
1024
|
-
if (void 0 ===
|
|
1008
|
+
if (void 0 === Ie[e]) {
|
|
1025
1009
|
r.next = 2;
|
|
1026
1010
|
break;
|
|
1027
1011
|
}
|
|
1028
|
-
return r.abrupt("return",
|
|
1012
|
+
return r.abrupt("return", Ie[e]);
|
|
1029
1013
|
case 2:
|
|
1030
|
-
return
|
|
1014
|
+
return Ie[e] = je(e, t), r.abrupt("return", Ie[e]);
|
|
1031
1015
|
case 4:
|
|
1032
1016
|
case "end":
|
|
1033
1017
|
return r.stop();
|
|
@@ -1035,10 +1019,10 @@ function Pe(e, t) {
|
|
|
1035
1019
|
}, r);
|
|
1036
1020
|
}));
|
|
1037
1021
|
}
|
|
1038
|
-
function
|
|
1022
|
+
function je(e, t) {
|
|
1039
1023
|
return new Promise(function (r, n) {
|
|
1040
1024
|
var i = function (e) {
|
|
1041
|
-
var t =
|
|
1025
|
+
var t = Re(e);
|
|
1042
1026
|
if (t[0]) return t[0];
|
|
1043
1027
|
}(e);
|
|
1044
1028
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1062,47 +1046,47 @@ function Ae(e, t) {
|
|
|
1062
1046
|
});
|
|
1063
1047
|
});
|
|
1064
1048
|
}
|
|
1065
|
-
var
|
|
1049
|
+
var Re = function Re(e) {
|
|
1066
1050
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1067
1051
|
};
|
|
1068
|
-
var
|
|
1069
|
-
|
|
1070
|
-
|
|
1052
|
+
var Me,
|
|
1053
|
+
Le = ["[Stytch]"],
|
|
1054
|
+
Be = function Be() {
|
|
1071
1055
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1072
|
-
return (e = console).warn.apply(e,
|
|
1056
|
+
return (e = console).warn.apply(e, Le.concat(r));
|
|
1073
1057
|
},
|
|
1074
|
-
|
|
1058
|
+
Ke = function Ke() {
|
|
1075
1059
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1076
|
-
return (e = console).error.apply(e,
|
|
1060
|
+
return (e = console).error.apply(e, Le.concat(r));
|
|
1077
1061
|
},
|
|
1078
|
-
|
|
1079
|
-
|
|
1062
|
+
ze = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1063
|
+
Ne = function Ne(e) {
|
|
1080
1064
|
return e.includes("public-token-test");
|
|
1081
1065
|
},
|
|
1082
|
-
|
|
1066
|
+
Ue = function Ue(e) {
|
|
1083
1067
|
var t = {
|
|
1084
1068
|
isObject: function isObject(r, n) {
|
|
1085
|
-
var i = "object" ===
|
|
1086
|
-
if (!i) throw new
|
|
1069
|
+
var i = "object" === ue(n) && !Array.isArray(n) && null !== n;
|
|
1070
|
+
if (!i) throw new w(e, r + " must be an object.");
|
|
1087
1071
|
return t;
|
|
1088
1072
|
},
|
|
1089
1073
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1090
1074
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1091
1075
|
},
|
|
1092
1076
|
isString: function isString(r, n) {
|
|
1093
|
-
if ("string" != typeof n) throw new
|
|
1077
|
+
if ("string" != typeof n) throw new w(e, r + " must be a string.");
|
|
1094
1078
|
return t;
|
|
1095
1079
|
},
|
|
1096
1080
|
isOptionalString: function isOptionalString(e, r) {
|
|
1097
1081
|
return void 0 === r ? t : t.isString(e, r);
|
|
1098
1082
|
},
|
|
1099
1083
|
isStringArray: function isStringArray(r, n) {
|
|
1100
|
-
if (!Array.isArray(n)) throw new
|
|
1084
|
+
if (!Array.isArray(n)) throw new w(e, r + " must be an array of strings.");
|
|
1101
1085
|
var i,
|
|
1102
1086
|
o = function (e, t) {
|
|
1103
1087
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1104
1088
|
if (!r) {
|
|
1105
|
-
if (Array.isArray(e) || (r =
|
|
1089
|
+
if (Array.isArray(e) || (r = ae(e)) || t && e && "number" == typeof e.length) {
|
|
1106
1090
|
r && (e = r);
|
|
1107
1091
|
var _n = 0,
|
|
1108
1092
|
i = function i() {};
|
|
@@ -1149,7 +1133,7 @@ var Ee,
|
|
|
1149
1133
|
}(n);
|
|
1150
1134
|
try {
|
|
1151
1135
|
for (o.s(); !(i = o.n()).done;) {
|
|
1152
|
-
if ("string" != typeof i.value) throw new
|
|
1136
|
+
if ("string" != typeof i.value) throw new w(e, r + " must be an array of strings.");
|
|
1153
1137
|
}
|
|
1154
1138
|
} catch (e) {
|
|
1155
1139
|
o.e(e);
|
|
@@ -1162,14 +1146,14 @@ var Ee,
|
|
|
1162
1146
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1163
1147
|
},
|
|
1164
1148
|
isNumber: function isNumber(r, n) {
|
|
1165
|
-
if ("number" != typeof n) throw new
|
|
1149
|
+
if ("number" != typeof n) throw new w(e, r + " must be a number.");
|
|
1166
1150
|
return t;
|
|
1167
1151
|
},
|
|
1168
1152
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1169
1153
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1170
1154
|
},
|
|
1171
1155
|
isBoolean: function isBoolean(r, n) {
|
|
1172
|
-
if ("boolean" != typeof n) throw new
|
|
1156
|
+
if ("boolean" != typeof n) throw new w(e, r + " must be a boolean.");
|
|
1173
1157
|
return t;
|
|
1174
1158
|
},
|
|
1175
1159
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1178,14 +1162,14 @@ var Ee,
|
|
|
1178
1162
|
};
|
|
1179
1163
|
return t;
|
|
1180
1164
|
},
|
|
1181
|
-
|
|
1165
|
+
qe = he(function e(t, r, n) {
|
|
1182
1166
|
var i = this,
|
|
1183
1167
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1184
1168
|
return Promise.resolve(void 0);
|
|
1185
1169
|
};
|
|
1186
|
-
|
|
1187
|
-
return
|
|
1188
|
-
return
|
|
1170
|
+
_e(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1171
|
+
return ye(i, void 0, void 0, le().mark(function e() {
|
|
1172
|
+
return le().wrap(function (e) {
|
|
1189
1173
|
for (;;) switch (e.prev = e.next) {
|
|
1190
1174
|
case 0:
|
|
1191
1175
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1198,9 +1182,9 @@ var Ee,
|
|
|
1198
1182
|
}, e, this);
|
|
1199
1183
|
}));
|
|
1200
1184
|
}, this.getTelemetryID = function () {
|
|
1201
|
-
return
|
|
1185
|
+
return ye(i, void 0, void 0, le().mark(function e() {
|
|
1202
1186
|
var t, r, n, i;
|
|
1203
|
-
return
|
|
1187
|
+
return le().wrap(function (e) {
|
|
1204
1188
|
for (;;) switch (e.prev = e.next) {
|
|
1205
1189
|
case 0:
|
|
1206
1190
|
return e.next = 2, this.state;
|
|
@@ -1221,9 +1205,9 @@ var Ee,
|
|
|
1221
1205
|
}, e, this);
|
|
1222
1206
|
}));
|
|
1223
1207
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1224
|
-
return
|
|
1208
|
+
return ye(i, void 0, void 0, le().mark(function e() {
|
|
1225
1209
|
var t, r, n, i, o, s;
|
|
1226
|
-
return
|
|
1210
|
+
return le().wrap(function (e) {
|
|
1227
1211
|
for (;;) switch (e.prev = e.next) {
|
|
1228
1212
|
case 0:
|
|
1229
1213
|
return e.next = 2, this.state;
|
|
@@ -1266,14 +1250,14 @@ var Ee,
|
|
|
1266
1250
|
}, e, this);
|
|
1267
1251
|
}));
|
|
1268
1252
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1269
|
-
return
|
|
1253
|
+
return ye(i, void 0, void 0, le().mark(function r() {
|
|
1270
1254
|
var n, i, o;
|
|
1271
|
-
return
|
|
1255
|
+
return le().wrap(function (r) {
|
|
1272
1256
|
for (;;) switch (r.prev = r.next) {
|
|
1273
1257
|
case 0:
|
|
1274
1258
|
return r.next = 2, this.state;
|
|
1275
1259
|
case 2:
|
|
1276
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1260
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== ke.RequiredCatcha || !i) {
|
|
1277
1261
|
r.next = 14;
|
|
1278
1262
|
break;
|
|
1279
1263
|
}
|
|
@@ -1297,8 +1281,8 @@ var Ee,
|
|
|
1297
1281
|
}, r, this);
|
|
1298
1282
|
}));
|
|
1299
1283
|
}, this.state = n.then(function (e) {
|
|
1300
|
-
return
|
|
1301
|
-
return
|
|
1284
|
+
return ye(i, void 0, void 0, le().mark(function n() {
|
|
1285
|
+
return le().wrap(function (n) {
|
|
1302
1286
|
for (;;) switch (n.prev = n.next) {
|
|
1303
1287
|
case 0:
|
|
1304
1288
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1313,7 +1297,7 @@ var Ee,
|
|
|
1313
1297
|
executeRecaptcha: o
|
|
1314
1298
|
});
|
|
1315
1299
|
case 2:
|
|
1316
|
-
return n.next = 4, void
|
|
1300
|
+
return n.next = 4, void Fe("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1317
1301
|
return window;
|
|
1318
1302
|
});
|
|
1319
1303
|
case 4:
|
|
@@ -1333,11 +1317,11 @@ var Ee,
|
|
|
1333
1317
|
}));
|
|
1334
1318
|
});
|
|
1335
1319
|
}),
|
|
1336
|
-
|
|
1320
|
+
We = function We() {
|
|
1337
1321
|
return {
|
|
1338
1322
|
isEnabled: function isEnabled() {
|
|
1339
|
-
return
|
|
1340
|
-
return
|
|
1323
|
+
return ye(void 0, void 0, void 0, le().mark(function e() {
|
|
1324
|
+
return le().wrap(function (e) {
|
|
1341
1325
|
for (;;) switch (e.prev = e.next) {
|
|
1342
1326
|
case 0:
|
|
1343
1327
|
return e.abrupt("return", !1);
|
|
@@ -1349,8 +1333,8 @@ var Ee,
|
|
|
1349
1333
|
}));
|
|
1350
1334
|
},
|
|
1351
1335
|
getTelemetryID: function getTelemetryID() {
|
|
1352
|
-
return
|
|
1353
|
-
return
|
|
1336
|
+
return ye(void 0, void 0, void 0, le().mark(function e() {
|
|
1337
|
+
return le().wrap(function (e) {
|
|
1354
1338
|
for (;;) switch (e.prev = e.next) {
|
|
1355
1339
|
case 0:
|
|
1356
1340
|
return e.abrupt("return", void 0);
|
|
@@ -1362,8 +1346,8 @@ var Ee,
|
|
|
1362
1346
|
}));
|
|
1363
1347
|
},
|
|
1364
1348
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1365
|
-
return
|
|
1366
|
-
return
|
|
1349
|
+
return ye(void 0, void 0, void 0, le().mark(function e() {
|
|
1350
|
+
return le().wrap(function (e) {
|
|
1367
1351
|
for (;;) switch (e.prev = e.next) {
|
|
1368
1352
|
case 0:
|
|
1369
1353
|
return e.abrupt("return", {
|
|
@@ -1378,8 +1362,8 @@ var Ee,
|
|
|
1378
1362
|
}));
|
|
1379
1363
|
},
|
|
1380
1364
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1381
|
-
return
|
|
1382
|
-
return
|
|
1365
|
+
return ye(void 0, void 0, void 0, le().mark(function e() {
|
|
1366
|
+
return le().wrap(function (e) {
|
|
1383
1367
|
for (;;) switch (e.prev = e.next) {
|
|
1384
1368
|
case 0:
|
|
1385
1369
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1392,11 +1376,11 @@ var Ee,
|
|
|
1392
1376
|
}
|
|
1393
1377
|
};
|
|
1394
1378
|
},
|
|
1395
|
-
|
|
1379
|
+
He = function () {
|
|
1396
1380
|
function e(t) {
|
|
1397
|
-
|
|
1381
|
+
_e(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1398
1382
|
}
|
|
1399
|
-
return
|
|
1383
|
+
return he(e, [{
|
|
1400
1384
|
key: "logEvent",
|
|
1401
1385
|
value: function value(e, t) {
|
|
1402
1386
|
this.batch.push({
|
|
@@ -1407,9 +1391,9 @@ var Ee,
|
|
|
1407
1391
|
}, {
|
|
1408
1392
|
key: "flush",
|
|
1409
1393
|
value: function value() {
|
|
1410
|
-
return
|
|
1394
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
1411
1395
|
var t;
|
|
1412
|
-
return
|
|
1396
|
+
return le().wrap(function (e) {
|
|
1413
1397
|
for (;;) switch (e.prev = e.next) {
|
|
1414
1398
|
case 0:
|
|
1415
1399
|
if (this.batch.length) {
|
|
@@ -1441,26 +1425,26 @@ var Ee,
|
|
|
1441
1425
|
}();
|
|
1442
1426
|
!function (e) {
|
|
1443
1427
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1444
|
-
}(
|
|
1428
|
+
}(Me || (Me = {})), Promise.resolve({
|
|
1445
1429
|
pkceRequiredForEmailMagicLinks: !1
|
|
1446
1430
|
}), Promise.resolve({
|
|
1447
1431
|
pkceRequiredForPasswordResets: !1
|
|
1448
1432
|
});
|
|
1449
|
-
var
|
|
1433
|
+
var Ge = Promise.resolve({
|
|
1450
1434
|
pkceRequiredForEmailMagicLinks: !1
|
|
1451
1435
|
}),
|
|
1452
|
-
|
|
1436
|
+
Ve = function () {
|
|
1453
1437
|
function e(t, r, n, i) {
|
|
1454
1438
|
var o = this,
|
|
1455
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1456
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1457
|
-
|
|
1439
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ge,
|
|
1440
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : We();
|
|
1441
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1458
1442
|
invite: function invite(e) {
|
|
1459
|
-
return
|
|
1460
|
-
return
|
|
1443
|
+
return ye(o, void 0, void 0, le().mark(function t() {
|
|
1444
|
+
return le().wrap(function (t) {
|
|
1461
1445
|
for (;;) switch (t.prev = t.next) {
|
|
1462
1446
|
case 0:
|
|
1463
|
-
return
|
|
1447
|
+
return Ue("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1464
1448
|
url: "/b2b/magic_links/email/invite",
|
|
1465
1449
|
body: e,
|
|
1466
1450
|
errorMessage: "Failed to send invite.",
|
|
@@ -1474,12 +1458,12 @@ var Fe = Promise.resolve({
|
|
|
1474
1458
|
}));
|
|
1475
1459
|
},
|
|
1476
1460
|
loginOrSignup: function loginOrSignup(e) {
|
|
1477
|
-
return
|
|
1461
|
+
return ye(o, void 0, void 0, le().mark(function t() {
|
|
1478
1462
|
var r, n;
|
|
1479
|
-
return
|
|
1463
|
+
return le().wrap(function (t) {
|
|
1480
1464
|
for (;;) switch (t.prev = t.next) {
|
|
1481
1465
|
case 0:
|
|
1482
|
-
return
|
|
1466
|
+
return Ue("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1483
1467
|
case 3:
|
|
1484
1468
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1485
1469
|
pkce_code_challenge: r
|
|
@@ -1498,12 +1482,12 @@ var Fe = Promise.resolve({
|
|
|
1498
1482
|
},
|
|
1499
1483
|
discovery: {
|
|
1500
1484
|
send: function send(e) {
|
|
1501
|
-
return
|
|
1485
|
+
return ye(o, void 0, void 0, le().mark(function t() {
|
|
1502
1486
|
var r, n;
|
|
1503
|
-
return
|
|
1487
|
+
return le().wrap(function (t) {
|
|
1504
1488
|
for (;;) switch (t.prev = t.next) {
|
|
1505
1489
|
case 0:
|
|
1506
|
-
return
|
|
1490
|
+
return Ue("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1507
1491
|
case 3:
|
|
1508
1492
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1509
1493
|
pkce_code_challenge: r
|
|
@@ -1522,12 +1506,12 @@ var Fe = Promise.resolve({
|
|
|
1522
1506
|
}
|
|
1523
1507
|
}
|
|
1524
1508
|
}, this.authenticate = function (e) {
|
|
1525
|
-
return
|
|
1509
|
+
return ye(o, void 0, void 0, le().mark(function t() {
|
|
1526
1510
|
var r, n;
|
|
1527
|
-
return
|
|
1511
|
+
return le().wrap(function (t) {
|
|
1528
1512
|
for (;;) switch (t.prev = t.next) {
|
|
1529
1513
|
case 0:
|
|
1530
|
-
return
|
|
1514
|
+
return Ue("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1531
1515
|
case 3:
|
|
1532
1516
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1533
1517
|
t.next = 19;
|
|
@@ -1578,12 +1562,12 @@ var Fe = Promise.resolve({
|
|
|
1578
1562
|
}));
|
|
1579
1563
|
}, this.discovery = {
|
|
1580
1564
|
authenticate: function authenticate(e) {
|
|
1581
|
-
return
|
|
1565
|
+
return ye(o, void 0, void 0, le().mark(function t() {
|
|
1582
1566
|
var r, n, i, o, s, a;
|
|
1583
|
-
return
|
|
1567
|
+
return le().wrap(function (t) {
|
|
1584
1568
|
for (;;) switch (t.prev = t.next) {
|
|
1585
1569
|
case 0:
|
|
1586
|
-
return
|
|
1570
|
+
return Ue("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1587
1571
|
case 3:
|
|
1588
1572
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1589
1573
|
case 6:
|
|
@@ -1614,12 +1598,12 @@ var Fe = Promise.resolve({
|
|
|
1614
1598
|
}
|
|
1615
1599
|
};
|
|
1616
1600
|
}
|
|
1617
|
-
return
|
|
1601
|
+
return he(e, [{
|
|
1618
1602
|
key: "getCodeChallenge",
|
|
1619
1603
|
value: function value() {
|
|
1620
|
-
return
|
|
1604
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
1621
1605
|
var t, r;
|
|
1622
|
-
return
|
|
1606
|
+
return le().wrap(function (e) {
|
|
1623
1607
|
for (;;) switch (e.prev = e.next) {
|
|
1624
1608
|
case 0:
|
|
1625
1609
|
return e.next = 2, this._config;
|
|
@@ -1651,9 +1635,9 @@ var Fe = Promise.resolve({
|
|
|
1651
1635
|
}, {
|
|
1652
1636
|
key: "handlePKCEForAuthenticate",
|
|
1653
1637
|
value: function value(e, t) {
|
|
1654
|
-
return
|
|
1638
|
+
return ye(this, void 0, void 0, le().mark(function r() {
|
|
1655
1639
|
var n, i, o, s, a, c;
|
|
1656
|
-
return
|
|
1640
|
+
return le().wrap(function (r) {
|
|
1657
1641
|
for (;;) switch (r.prev = r.next) {
|
|
1658
1642
|
case 0:
|
|
1659
1643
|
return r.next = 2, e.getPKPair();
|
|
@@ -1682,12 +1666,12 @@ var Fe = Promise.resolve({
|
|
|
1682
1666
|
}
|
|
1683
1667
|
}]), e;
|
|
1684
1668
|
}(),
|
|
1685
|
-
|
|
1669
|
+
Ye = he(function e(t, r) {
|
|
1686
1670
|
var n = this;
|
|
1687
|
-
|
|
1688
|
-
return
|
|
1671
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1672
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
1689
1673
|
var t;
|
|
1690
|
-
return
|
|
1674
|
+
return le().wrap(function (e) {
|
|
1691
1675
|
for (;;) switch (e.prev = e.next) {
|
|
1692
1676
|
case 0:
|
|
1693
1677
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1711,12 +1695,12 @@ var Fe = Promise.resolve({
|
|
|
1711
1695
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1712
1696
|
});
|
|
1713
1697
|
}, this.update = function (e) {
|
|
1714
|
-
return
|
|
1698
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
1715
1699
|
var r;
|
|
1716
|
-
return
|
|
1700
|
+
return le().wrap(function (t) {
|
|
1717
1701
|
for (;;) switch (t.prev = t.next) {
|
|
1718
1702
|
case 0:
|
|
1719
|
-
return
|
|
1703
|
+
return Ue("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("default_mfa_method", e.default_mfa_method), t.next = 3, this._networkClient.fetchSDK({
|
|
1720
1704
|
url: "/b2b/organizations/members/update",
|
|
1721
1705
|
body: e,
|
|
1722
1706
|
errorMessage: "Failed to update member.",
|
|
@@ -1731,9 +1715,9 @@ var Fe = Promise.resolve({
|
|
|
1731
1715
|
}, t, this);
|
|
1732
1716
|
}));
|
|
1733
1717
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1734
|
-
return
|
|
1718
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
1735
1719
|
var t;
|
|
1736
|
-
return
|
|
1720
|
+
return le().wrap(function (e) {
|
|
1737
1721
|
for (;;) switch (e.prev = e.next) {
|
|
1738
1722
|
case 0:
|
|
1739
1723
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1750,9 +1734,9 @@ var Fe = Promise.resolve({
|
|
|
1750
1734
|
}, e, this);
|
|
1751
1735
|
}));
|
|
1752
1736
|
}, this.deleteMFATOTP = function () {
|
|
1753
|
-
return
|
|
1737
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
1754
1738
|
var t;
|
|
1755
|
-
return
|
|
1739
|
+
return le().wrap(function (e) {
|
|
1756
1740
|
for (;;) switch (e.prev = e.next) {
|
|
1757
1741
|
case 0:
|
|
1758
1742
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1769,9 +1753,9 @@ var Fe = Promise.resolve({
|
|
|
1769
1753
|
}, e, this);
|
|
1770
1754
|
}));
|
|
1771
1755
|
}, this.deletePassword = function (e) {
|
|
1772
|
-
return
|
|
1756
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
1773
1757
|
var r;
|
|
1774
|
-
return
|
|
1758
|
+
return le().wrap(function (t) {
|
|
1775
1759
|
for (;;) switch (t.prev = t.next) {
|
|
1776
1760
|
case 0:
|
|
1777
1761
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1789,14 +1773,14 @@ var Fe = Promise.resolve({
|
|
|
1789
1773
|
}));
|
|
1790
1774
|
};
|
|
1791
1775
|
}),
|
|
1792
|
-
|
|
1776
|
+
Je = function () {
|
|
1793
1777
|
function e(t, r, n, i, o) {
|
|
1794
1778
|
var s = this,
|
|
1795
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1796
|
-
|
|
1779
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : We();
|
|
1780
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1797
1781
|
createConnection: function createConnection(e) {
|
|
1798
|
-
return
|
|
1799
|
-
return
|
|
1782
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1783
|
+
return le().wrap(function (t) {
|
|
1800
1784
|
for (;;) switch (t.prev = t.next) {
|
|
1801
1785
|
case 0:
|
|
1802
1786
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1815,8 +1799,8 @@ var Fe = Promise.resolve({
|
|
|
1815
1799
|
}));
|
|
1816
1800
|
},
|
|
1817
1801
|
updateConnection: function updateConnection(e) {
|
|
1818
|
-
return
|
|
1819
|
-
return
|
|
1802
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1803
|
+
return le().wrap(function (t) {
|
|
1820
1804
|
for (;;) switch (t.prev = t.next) {
|
|
1821
1805
|
case 0:
|
|
1822
1806
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1835,8 +1819,8 @@ var Fe = Promise.resolve({
|
|
|
1835
1819
|
}));
|
|
1836
1820
|
},
|
|
1837
1821
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1838
|
-
return
|
|
1839
|
-
return
|
|
1822
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1823
|
+
return le().wrap(function (t) {
|
|
1840
1824
|
for (;;) switch (t.prev = t.next) {
|
|
1841
1825
|
case 0:
|
|
1842
1826
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1855,8 +1839,8 @@ var Fe = Promise.resolve({
|
|
|
1855
1839
|
}));
|
|
1856
1840
|
},
|
|
1857
1841
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1858
|
-
return
|
|
1859
|
-
return
|
|
1842
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1843
|
+
return le().wrap(function (t) {
|
|
1860
1844
|
for (;;) switch (t.prev = t.next) {
|
|
1861
1845
|
case 0:
|
|
1862
1846
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1875,8 +1859,8 @@ var Fe = Promise.resolve({
|
|
|
1875
1859
|
}
|
|
1876
1860
|
}, this.oidc = {
|
|
1877
1861
|
createConnection: function createConnection(e) {
|
|
1878
|
-
return
|
|
1879
|
-
return
|
|
1862
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1863
|
+
return le().wrap(function (t) {
|
|
1880
1864
|
for (;;) switch (t.prev = t.next) {
|
|
1881
1865
|
case 0:
|
|
1882
1866
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1895,8 +1879,8 @@ var Fe = Promise.resolve({
|
|
|
1895
1879
|
}));
|
|
1896
1880
|
},
|
|
1897
1881
|
updateConnection: function updateConnection(e) {
|
|
1898
|
-
return
|
|
1899
|
-
return
|
|
1882
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
1883
|
+
return le().wrap(function (t) {
|
|
1900
1884
|
for (;;) switch (t.prev = t.next) {
|
|
1901
1885
|
case 0:
|
|
1902
1886
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1916,17 +1900,17 @@ var Fe = Promise.resolve({
|
|
|
1916
1900
|
}
|
|
1917
1901
|
};
|
|
1918
1902
|
}
|
|
1919
|
-
return
|
|
1903
|
+
return he(e, [{
|
|
1920
1904
|
key: "authenticate",
|
|
1921
1905
|
value: function value(e) {
|
|
1922
|
-
return
|
|
1906
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
1923
1907
|
var r, n, i, o, s;
|
|
1924
|
-
return
|
|
1908
|
+
return le().wrap(function (t) {
|
|
1925
1909
|
for (;;) switch (t.prev = t.next) {
|
|
1926
1910
|
case 0:
|
|
1927
|
-
return
|
|
1911
|
+
return Ue("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1928
1912
|
case 3:
|
|
1929
|
-
return (r = t.sent) ||
|
|
1913
|
+
return (r = t.sent) || Be("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1930
1914
|
case 7:
|
|
1931
1915
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1932
1916
|
url: "/b2b/sso/authenticate",
|
|
@@ -1966,11 +1950,11 @@ var Fe = Promise.resolve({
|
|
|
1966
1950
|
}, {
|
|
1967
1951
|
key: "getBaseApiUrl",
|
|
1968
1952
|
value: function value() {
|
|
1969
|
-
return
|
|
1970
|
-
return
|
|
1953
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
1954
|
+
return le().wrap(function (e) {
|
|
1971
1955
|
for (;;) switch (e.prev = e.next) {
|
|
1972
1956
|
case 0:
|
|
1973
|
-
if (!
|
|
1957
|
+
if (!Ne(this._config.publicToken)) {
|
|
1974
1958
|
e.next = 2;
|
|
1975
1959
|
break;
|
|
1976
1960
|
}
|
|
@@ -1990,9 +1974,9 @@ var Fe = Promise.resolve({
|
|
|
1990
1974
|
var t = e.connection_id,
|
|
1991
1975
|
r = e.login_redirect_url,
|
|
1992
1976
|
n = e.signup_redirect_url;
|
|
1993
|
-
return
|
|
1977
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
1994
1978
|
var i, o, s, a, c;
|
|
1995
|
-
return
|
|
1979
|
+
return le().wrap(function (e) {
|
|
1996
1980
|
for (;;) switch (e.prev = e.next) {
|
|
1997
1981
|
case 0:
|
|
1998
1982
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2021,8 +2005,8 @@ var Fe = Promise.resolve({
|
|
|
2021
2005
|
}, {
|
|
2022
2006
|
key: "getConnections",
|
|
2023
2007
|
value: function value() {
|
|
2024
|
-
return
|
|
2025
|
-
return
|
|
2008
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
2009
|
+
return le().wrap(function (e) {
|
|
2026
2010
|
for (;;) switch (e.prev = e.next) {
|
|
2027
2011
|
case 0:
|
|
2028
2012
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2042,8 +2026,8 @@ var Fe = Promise.resolve({
|
|
|
2042
2026
|
}, {
|
|
2043
2027
|
key: "deleteConnection",
|
|
2044
2028
|
value: function value(e) {
|
|
2045
|
-
return
|
|
2046
|
-
return
|
|
2029
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2030
|
+
return le().wrap(function (t) {
|
|
2047
2031
|
for (;;) switch (t.prev = t.next) {
|
|
2048
2032
|
case 0:
|
|
2049
2033
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2060,12 +2044,12 @@ var Fe = Promise.resolve({
|
|
|
2060
2044
|
}
|
|
2061
2045
|
}]), e;
|
|
2062
2046
|
}(),
|
|
2063
|
-
|
|
2047
|
+
$e = he(function e(t, r) {
|
|
2064
2048
|
var n = this;
|
|
2065
|
-
|
|
2066
|
-
return
|
|
2049
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2050
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
2067
2051
|
var t;
|
|
2068
|
-
return
|
|
2052
|
+
return le().wrap(function (e) {
|
|
2069
2053
|
for (;;) switch (e.prev = e.next) {
|
|
2070
2054
|
case 0:
|
|
2071
2055
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2089,9 +2073,9 @@ var Fe = Promise.resolve({
|
|
|
2089
2073
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2090
2074
|
});
|
|
2091
2075
|
}, this.update = function (e) {
|
|
2092
|
-
return
|
|
2076
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2093
2077
|
var r;
|
|
2094
|
-
return
|
|
2078
|
+
return le().wrap(function (t) {
|
|
2095
2079
|
for (;;) switch (t.prev = t.next) {
|
|
2096
2080
|
case 0:
|
|
2097
2081
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2109,9 +2093,9 @@ var Fe = Promise.resolve({
|
|
|
2109
2093
|
}, t, this);
|
|
2110
2094
|
}));
|
|
2111
2095
|
}, this["delete"] = function () {
|
|
2112
|
-
return
|
|
2096
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
2113
2097
|
var t;
|
|
2114
|
-
return
|
|
2098
|
+
return le().wrap(function (e) {
|
|
2115
2099
|
for (;;) switch (e.prev = e.next) {
|
|
2116
2100
|
case 0:
|
|
2117
2101
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2129,8 +2113,8 @@ var Fe = Promise.resolve({
|
|
|
2129
2113
|
}));
|
|
2130
2114
|
}, this.members = {
|
|
2131
2115
|
create: function create(e) {
|
|
2132
|
-
return
|
|
2133
|
-
return
|
|
2116
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2117
|
+
return le().wrap(function (t) {
|
|
2134
2118
|
for (;;) switch (t.prev = t.next) {
|
|
2135
2119
|
case 0:
|
|
2136
2120
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2147,8 +2131,8 @@ var Fe = Promise.resolve({
|
|
|
2147
2131
|
}));
|
|
2148
2132
|
},
|
|
2149
2133
|
search: function search(e) {
|
|
2150
|
-
return
|
|
2151
|
-
return
|
|
2134
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2135
|
+
return le().wrap(function (t) {
|
|
2152
2136
|
for (;;) switch (t.prev = t.next) {
|
|
2153
2137
|
case 0:
|
|
2154
2138
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2165,8 +2149,8 @@ var Fe = Promise.resolve({
|
|
|
2165
2149
|
}));
|
|
2166
2150
|
},
|
|
2167
2151
|
update: function update(e) {
|
|
2168
|
-
return
|
|
2169
|
-
return
|
|
2152
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2153
|
+
return le().wrap(function (t) {
|
|
2170
2154
|
for (;;) switch (t.prev = t.next) {
|
|
2171
2155
|
case 0:
|
|
2172
2156
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2183,8 +2167,8 @@ var Fe = Promise.resolve({
|
|
|
2183
2167
|
}));
|
|
2184
2168
|
},
|
|
2185
2169
|
deletePassword: function deletePassword(e) {
|
|
2186
|
-
return
|
|
2187
|
-
return
|
|
2170
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2171
|
+
return le().wrap(function (t) {
|
|
2188
2172
|
for (;;) switch (t.prev = t.next) {
|
|
2189
2173
|
case 0:
|
|
2190
2174
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2200,8 +2184,8 @@ var Fe = Promise.resolve({
|
|
|
2200
2184
|
}));
|
|
2201
2185
|
},
|
|
2202
2186
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2203
|
-
return
|
|
2204
|
-
return
|
|
2187
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2188
|
+
return le().wrap(function (t) {
|
|
2205
2189
|
for (;;) switch (t.prev = t.next) {
|
|
2206
2190
|
case 0:
|
|
2207
2191
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2217,8 +2201,8 @@ var Fe = Promise.resolve({
|
|
|
2217
2201
|
}));
|
|
2218
2202
|
},
|
|
2219
2203
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2220
|
-
return
|
|
2221
|
-
return
|
|
2204
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2205
|
+
return le().wrap(function (t) {
|
|
2222
2206
|
for (;;) switch (t.prev = t.next) {
|
|
2223
2207
|
case 0:
|
|
2224
2208
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2234,8 +2218,8 @@ var Fe = Promise.resolve({
|
|
|
2234
2218
|
}));
|
|
2235
2219
|
},
|
|
2236
2220
|
"delete": function _delete(e) {
|
|
2237
|
-
return
|
|
2238
|
-
return
|
|
2221
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2222
|
+
return le().wrap(function (t) {
|
|
2239
2223
|
for (;;) switch (t.prev = t.next) {
|
|
2240
2224
|
case 0:
|
|
2241
2225
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2251,8 +2235,8 @@ var Fe = Promise.resolve({
|
|
|
2251
2235
|
}));
|
|
2252
2236
|
},
|
|
2253
2237
|
reactivate: function reactivate(e) {
|
|
2254
|
-
return
|
|
2255
|
-
return
|
|
2238
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2239
|
+
return le().wrap(function (t) {
|
|
2256
2240
|
for (;;) switch (t.prev = t.next) {
|
|
2257
2241
|
case 0:
|
|
2258
2242
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2269,18 +2253,18 @@ var Fe = Promise.resolve({
|
|
|
2269
2253
|
}
|
|
2270
2254
|
};
|
|
2271
2255
|
}),
|
|
2272
|
-
|
|
2256
|
+
Xe = function () {
|
|
2273
2257
|
function e(t, r, n, i, o) {
|
|
2274
2258
|
var s = this,
|
|
2275
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2276
|
-
|
|
2259
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : We();
|
|
2260
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2277
2261
|
authenticate: function authenticate(e) {
|
|
2278
|
-
return
|
|
2262
|
+
return ye(s, void 0, void 0, le().mark(function t() {
|
|
2279
2263
|
var r, n, i, o, s, a;
|
|
2280
|
-
return
|
|
2264
|
+
return le().wrap(function (t) {
|
|
2281
2265
|
for (;;) switch (t.prev = t.next) {
|
|
2282
2266
|
case 0:
|
|
2283
|
-
return
|
|
2267
|
+
return Ue("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2284
2268
|
case 3:
|
|
2285
2269
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2286
2270
|
case 6:
|
|
@@ -2321,17 +2305,17 @@ var Fe = Promise.resolve({
|
|
|
2321
2305
|
}
|
|
2322
2306
|
};
|
|
2323
2307
|
}
|
|
2324
|
-
return
|
|
2308
|
+
return he(e, [{
|
|
2325
2309
|
key: "authenticate",
|
|
2326
2310
|
value: function value(e) {
|
|
2327
|
-
return
|
|
2311
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2328
2312
|
var r, n, i, o, s;
|
|
2329
|
-
return
|
|
2313
|
+
return le().wrap(function (t) {
|
|
2330
2314
|
for (;;) switch (t.prev = t.next) {
|
|
2331
2315
|
case 0:
|
|
2332
|
-
return
|
|
2316
|
+
return Ue("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2333
2317
|
case 3:
|
|
2334
|
-
return (r = t.sent) ||
|
|
2318
|
+
return (r = t.sent) || Be("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2335
2319
|
case 7:
|
|
2336
2320
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2337
2321
|
url: "/b2b/oauth/authenticate",
|
|
@@ -2370,9 +2354,9 @@ var Fe = Promise.resolve({
|
|
|
2370
2354
|
}, {
|
|
2371
2355
|
key: "getBaseApiUrl",
|
|
2372
2356
|
value: function value() {
|
|
2373
|
-
return
|
|
2357
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
2374
2358
|
var t, r;
|
|
2375
|
-
return
|
|
2359
|
+
return le().wrap(function (e) {
|
|
2376
2360
|
for (;;) switch (e.prev = e.next) {
|
|
2377
2361
|
case 0:
|
|
2378
2362
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2383,7 +2367,7 @@ var Fe = Promise.resolve({
|
|
|
2383
2367
|
}
|
|
2384
2368
|
return e.abrupt("return", "https://".concat(r));
|
|
2385
2369
|
case 6:
|
|
2386
|
-
if (!
|
|
2370
|
+
if (!Ne(this._config.publicToken)) {
|
|
2387
2371
|
e.next = 8;
|
|
2388
2372
|
break;
|
|
2389
2373
|
}
|
|
@@ -2408,16 +2392,16 @@ var Fe = Promise.resolve({
|
|
|
2408
2392
|
s = r.signup_redirect_url,
|
|
2409
2393
|
a = r.custom_scopes,
|
|
2410
2394
|
c = r.provider_params;
|
|
2411
|
-
return
|
|
2395
|
+
return ye(t, void 0, void 0, le().mark(function t() {
|
|
2412
2396
|
var r, u, l, d, h, p;
|
|
2413
|
-
return
|
|
2397
|
+
return le().wrap(function (t) {
|
|
2414
2398
|
for (;;) switch (t.prev = t.next) {
|
|
2415
2399
|
case 0:
|
|
2416
2400
|
return t.next = 2, this._dynamicConfig;
|
|
2417
2401
|
case 2:
|
|
2418
2402
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2419
2403
|
case 6:
|
|
2420
|
-
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (
|
|
2404
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (Ue("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in Ue("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2421
2405
|
if (!u) {
|
|
2422
2406
|
t.next = 20;
|
|
2423
2407
|
break;
|
|
@@ -2446,16 +2430,16 @@ var Fe = Promise.resolve({
|
|
|
2446
2430
|
var n = r.discovery_redirect_url,
|
|
2447
2431
|
i = r.custom_scopes,
|
|
2448
2432
|
o = r.provider_params;
|
|
2449
|
-
return
|
|
2433
|
+
return ye(t, void 0, void 0, le().mark(function t() {
|
|
2450
2434
|
var r, s, a, c, u, l;
|
|
2451
|
-
return
|
|
2435
|
+
return le().wrap(function (t) {
|
|
2452
2436
|
for (;;) switch (t.prev = t.next) {
|
|
2453
2437
|
case 0:
|
|
2454
2438
|
return t.next = 2, this._dynamicConfig;
|
|
2455
2439
|
case 2:
|
|
2456
2440
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2457
2441
|
case 6:
|
|
2458
|
-
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (
|
|
2442
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (Ue("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in Ue("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2459
2443
|
if (!s) {
|
|
2460
2444
|
t.next = 18;
|
|
2461
2445
|
break;
|
|
@@ -2478,10 +2462,10 @@ var Fe = Promise.resolve({
|
|
|
2478
2462
|
}
|
|
2479
2463
|
}]), e;
|
|
2480
2464
|
}(),
|
|
2481
|
-
|
|
2465
|
+
Ze = function () {
|
|
2482
2466
|
function e(t, r) {
|
|
2483
2467
|
var n = this;
|
|
2484
|
-
|
|
2468
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2485
2469
|
return n._subscriptionService.getSession();
|
|
2486
2470
|
}, this.onChange = function (e) {
|
|
2487
2471
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -2489,9 +2473,9 @@ var Fe = Promise.resolve({
|
|
|
2489
2473
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2490
2474
|
});
|
|
2491
2475
|
}, this.revoke = function (e) {
|
|
2492
|
-
return
|
|
2476
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2493
2477
|
var r;
|
|
2494
|
-
return
|
|
2478
|
+
return le().wrap(function (t) {
|
|
2495
2479
|
for (;;) switch (t.prev = t.next) {
|
|
2496
2480
|
case 0:
|
|
2497
2481
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2502,7 +2486,7 @@ var Fe = Promise.resolve({
|
|
|
2502
2486
|
case 3:
|
|
2503
2487
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2504
2488
|
case 8:
|
|
2505
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2489
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || P.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2506
2490
|
case 12:
|
|
2507
2491
|
case "end":
|
|
2508
2492
|
return t.stop();
|
|
@@ -2510,13 +2494,13 @@ var Fe = Promise.resolve({
|
|
|
2510
2494
|
}, t, this, [[0, 8]]);
|
|
2511
2495
|
}));
|
|
2512
2496
|
}, this.authenticate = function (e) {
|
|
2513
|
-
return
|
|
2497
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2514
2498
|
var r,
|
|
2515
2499
|
n,
|
|
2516
2500
|
i,
|
|
2517
2501
|
o,
|
|
2518
2502
|
s = this;
|
|
2519
|
-
return
|
|
2503
|
+
return le().wrap(function (t) {
|
|
2520
2504
|
for (;;) switch (t.prev = t.next) {
|
|
2521
2505
|
case 0:
|
|
2522
2506
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2554,7 +2538,7 @@ var Fe = Promise.resolve({
|
|
|
2554
2538
|
}
|
|
2555
2539
|
return t.abrupt("return", this.authenticate(e));
|
|
2556
2540
|
case 17:
|
|
2557
|
-
throw
|
|
2541
|
+
throw P.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2558
2542
|
case 19:
|
|
2559
2543
|
case "end":
|
|
2560
2544
|
return t.stop();
|
|
@@ -2562,12 +2546,12 @@ var Fe = Promise.resolve({
|
|
|
2562
2546
|
}, t, this, [[2, 13]]);
|
|
2563
2547
|
}));
|
|
2564
2548
|
}, this.exchange = function (e) {
|
|
2565
|
-
return
|
|
2549
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2566
2550
|
var r;
|
|
2567
|
-
return
|
|
2551
|
+
return le().wrap(function (t) {
|
|
2568
2552
|
for (;;) switch (t.prev = t.next) {
|
|
2569
2553
|
case 0:
|
|
2570
|
-
return
|
|
2554
|
+
return Ue("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
2571
2555
|
url: "/b2b/sessions/exchange",
|
|
2572
2556
|
body: e,
|
|
2573
2557
|
errorMessage: "Failed to exchange session",
|
|
@@ -2599,19 +2583,19 @@ var Fe = Promise.resolve({
|
|
|
2599
2583
|
}));
|
|
2600
2584
|
};
|
|
2601
2585
|
}
|
|
2602
|
-
return
|
|
2586
|
+
return he(e, [{
|
|
2603
2587
|
key: "getTokens",
|
|
2604
2588
|
value: function value() {
|
|
2605
2589
|
return this._subscriptionService.getTokens();
|
|
2606
2590
|
}
|
|
2607
2591
|
}]), e;
|
|
2608
2592
|
}(),
|
|
2609
|
-
|
|
2593
|
+
Qe = he(function e(t, r) {
|
|
2610
2594
|
var n = this;
|
|
2611
|
-
|
|
2595
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2612
2596
|
list: function list() {
|
|
2613
|
-
return
|
|
2614
|
-
return
|
|
2597
|
+
return ye(n, void 0, void 0, le().mark(function e() {
|
|
2598
|
+
return le().wrap(function (e) {
|
|
2615
2599
|
for (;;) switch (e.prev = e.next) {
|
|
2616
2600
|
case 0:
|
|
2617
2601
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2638,12 +2622,12 @@ var Fe = Promise.resolve({
|
|
|
2638
2622
|
}));
|
|
2639
2623
|
},
|
|
2640
2624
|
create: function create(e) {
|
|
2641
|
-
return
|
|
2625
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2642
2626
|
var r, n;
|
|
2643
|
-
return
|
|
2627
|
+
return le().wrap(function (t) {
|
|
2644
2628
|
for (;;) switch (t.prev = t.next) {
|
|
2645
2629
|
case 0:
|
|
2646
|
-
return
|
|
2630
|
+
return Ue("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2647
2631
|
case 5:
|
|
2648
2632
|
if (t.t2 = t.sent, t.t2) {
|
|
2649
2633
|
t.next = 8;
|
|
@@ -2684,12 +2668,12 @@ var Fe = Promise.resolve({
|
|
|
2684
2668
|
}
|
|
2685
2669
|
}, this.intermediateSessions = {
|
|
2686
2670
|
exchange: function exchange(e) {
|
|
2687
|
-
return
|
|
2671
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2688
2672
|
var r, n;
|
|
2689
|
-
return
|
|
2673
|
+
return le().wrap(function (t) {
|
|
2690
2674
|
for (;;) switch (t.prev = t.next) {
|
|
2691
2675
|
case 0:
|
|
2692
|
-
return
|
|
2676
|
+
return Ue("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2693
2677
|
case 5:
|
|
2694
2678
|
if (t.t2 = t.sent, t.t2) {
|
|
2695
2679
|
t.next = 8;
|
|
@@ -2729,21 +2713,311 @@ var Fe = Promise.resolve({
|
|
|
2729
2713
|
}));
|
|
2730
2714
|
}
|
|
2731
2715
|
};
|
|
2732
|
-
})
|
|
2733
|
-
Promise.resolve({
|
|
2734
|
-
|
|
2735
|
-
})
|
|
2736
|
-
|
|
2716
|
+
}),
|
|
2717
|
+
et = Promise.resolve({
|
|
2718
|
+
pkceRequiredForPasswordResets: !1
|
|
2719
|
+
}),
|
|
2720
|
+
tt = function () {
|
|
2721
|
+
function e(t, r, n) {
|
|
2722
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : et,
|
|
2723
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : We();
|
|
2724
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2725
|
+
}
|
|
2726
|
+
return he(e, [{
|
|
2727
|
+
key: "getCodeChallenge",
|
|
2728
|
+
value: function value() {
|
|
2729
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
2730
|
+
var t, r;
|
|
2731
|
+
return le().wrap(function (e) {
|
|
2732
|
+
for (;;) switch (e.prev = e.next) {
|
|
2733
|
+
case 0:
|
|
2734
|
+
return e.next = 2, this._config;
|
|
2735
|
+
case 2:
|
|
2736
|
+
if (t = e.sent, t.pkceRequiredForPasswordResets) {
|
|
2737
|
+
e.next = 6;
|
|
2738
|
+
break;
|
|
2739
|
+
}
|
|
2740
|
+
return e.abrupt("return", void 0);
|
|
2741
|
+
case 6:
|
|
2742
|
+
return e.next = 8, this._pkceManager.getPKPair();
|
|
2743
|
+
case 8:
|
|
2744
|
+
if (!(r = e.sent)) {
|
|
2745
|
+
e.next = 11;
|
|
2746
|
+
break;
|
|
2747
|
+
}
|
|
2748
|
+
return e.abrupt("return", r.code_challenge);
|
|
2749
|
+
case 11:
|
|
2750
|
+
return e.next = 13, this._pkceManager.startPKCETransaction();
|
|
2751
|
+
case 13:
|
|
2752
|
+
return r = e.sent, e.abrupt("return", r.code_challenge);
|
|
2753
|
+
case 15:
|
|
2754
|
+
case "end":
|
|
2755
|
+
return e.stop();
|
|
2756
|
+
}
|
|
2757
|
+
}, e, this);
|
|
2758
|
+
}));
|
|
2759
|
+
}
|
|
2760
|
+
}, {
|
|
2761
|
+
key: "authenticate",
|
|
2762
|
+
value: function value(e) {
|
|
2763
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2764
|
+
var r, n, i, o, s, a;
|
|
2765
|
+
return le().wrap(function (t) {
|
|
2766
|
+
for (;;) switch (t.prev = t.next) {
|
|
2767
|
+
case 0:
|
|
2768
|
+
return Ue("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2769
|
+
case 3:
|
|
2770
|
+
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2771
|
+
case 7:
|
|
2772
|
+
return i = t.sent, o = i.dfp_telemetry_id, s = i.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2773
|
+
url: "/b2b/passwords/authenticate",
|
|
2774
|
+
method: "POST",
|
|
2775
|
+
errorMessage: "Failed to authenticate password.",
|
|
2776
|
+
body: {
|
|
2777
|
+
organization_id: e.organization_id,
|
|
2778
|
+
email_address: e.email_address,
|
|
2779
|
+
password: e.password,
|
|
2780
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2781
|
+
locale: e.locale,
|
|
2782
|
+
captcha_token: s,
|
|
2783
|
+
dfp_telemetry_id: o,
|
|
2784
|
+
code_verifier: n
|
|
2785
|
+
},
|
|
2786
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2787
|
+
});
|
|
2788
|
+
case 12:
|
|
2789
|
+
return (a = t.sent).member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2790
|
+
state: {
|
|
2791
|
+
session: a.member_session,
|
|
2792
|
+
member: a.member,
|
|
2793
|
+
organization: a.organization
|
|
2794
|
+
},
|
|
2795
|
+
session_token: a.session_token,
|
|
2796
|
+
session_jwt: a.session_jwt,
|
|
2797
|
+
intermediate_session_token: null
|
|
2798
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
2799
|
+
state: null,
|
|
2800
|
+
session_token: null,
|
|
2801
|
+
session_jwt: null,
|
|
2802
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2803
|
+
}), t.abrupt("return", a);
|
|
2804
|
+
case 15:
|
|
2805
|
+
case "end":
|
|
2806
|
+
return t.stop();
|
|
2807
|
+
}
|
|
2808
|
+
}, t, this);
|
|
2809
|
+
}));
|
|
2810
|
+
}
|
|
2811
|
+
}, {
|
|
2812
|
+
key: "resetByEmailStart",
|
|
2813
|
+
value: function value(e) {
|
|
2814
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2815
|
+
var r, n, i, o;
|
|
2816
|
+
return le().wrap(function (t) {
|
|
2817
|
+
for (;;) switch (t.prev = t.next) {
|
|
2818
|
+
case 0:
|
|
2819
|
+
return Ue("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
2820
|
+
case 3:
|
|
2821
|
+
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2822
|
+
case 6:
|
|
2823
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2824
|
+
url: "/b2b/passwords/email/reset/start",
|
|
2825
|
+
method: "POST",
|
|
2826
|
+
errorMessage: "Failed to start password reset flow.",
|
|
2827
|
+
body: {
|
|
2828
|
+
organization_id: e.organization_id,
|
|
2829
|
+
email_address: e.email_address,
|
|
2830
|
+
login_redirect_url: e.login_redirect_url,
|
|
2831
|
+
reset_password_redirect_url: e.reset_password_redirect_url,
|
|
2832
|
+
reset_password_expiration_minutes: e.reset_password_expiration_minutes,
|
|
2833
|
+
reset_password_template_id: e.reset_password_template_id,
|
|
2834
|
+
code_challenge: r,
|
|
2835
|
+
captcha_token: o,
|
|
2836
|
+
dfp_telemetry_id: i
|
|
2837
|
+
},
|
|
2838
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2839
|
+
}));
|
|
2840
|
+
case 10:
|
|
2841
|
+
case "end":
|
|
2842
|
+
return t.stop();
|
|
2843
|
+
}
|
|
2844
|
+
}, t, this);
|
|
2845
|
+
}));
|
|
2846
|
+
}
|
|
2847
|
+
}, {
|
|
2848
|
+
key: "resetByEmail",
|
|
2849
|
+
value: function value(e) {
|
|
2850
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2851
|
+
var r, n, i, o, s, a;
|
|
2852
|
+
return le().wrap(function (t) {
|
|
2853
|
+
for (;;) switch (t.prev = t.next) {
|
|
2854
|
+
case 0:
|
|
2855
|
+
return Ue("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2856
|
+
case 3:
|
|
2857
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2858
|
+
case 8:
|
|
2859
|
+
return o = t.sent, s = null == o ? void 0 : o.code_verifier, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2860
|
+
url: "/b2b/passwords/email/reset",
|
|
2861
|
+
method: "POST",
|
|
2862
|
+
errorMessage: "Failed to reset password.",
|
|
2863
|
+
body: {
|
|
2864
|
+
password_reset_token: e.password_reset_token,
|
|
2865
|
+
password: e.password,
|
|
2866
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2867
|
+
locale: e.locale,
|
|
2868
|
+
captcha_token: i,
|
|
2869
|
+
dfp_telemetry_id: n,
|
|
2870
|
+
code_verifier: s
|
|
2871
|
+
},
|
|
2872
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2873
|
+
});
|
|
2874
|
+
case 12:
|
|
2875
|
+
return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2876
|
+
state: {
|
|
2877
|
+
session: a.member_session,
|
|
2878
|
+
member: a.member,
|
|
2879
|
+
organization: a.organization
|
|
2880
|
+
},
|
|
2881
|
+
session_token: a.session_token,
|
|
2882
|
+
session_jwt: a.session_jwt,
|
|
2883
|
+
intermediate_session_token: null
|
|
2884
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
2885
|
+
state: null,
|
|
2886
|
+
session_token: null,
|
|
2887
|
+
session_jwt: null,
|
|
2888
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2889
|
+
}), t.abrupt("return", a);
|
|
2890
|
+
case 16:
|
|
2891
|
+
case "end":
|
|
2892
|
+
return t.stop();
|
|
2893
|
+
}
|
|
2894
|
+
}, t, this);
|
|
2895
|
+
}));
|
|
2896
|
+
}
|
|
2897
|
+
}, {
|
|
2898
|
+
key: "resetByExistingPassword",
|
|
2899
|
+
value: function value(e) {
|
|
2900
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2901
|
+
var r, n, i, o;
|
|
2902
|
+
return le().wrap(function (t) {
|
|
2903
|
+
for (;;) switch (t.prev = t.next) {
|
|
2904
|
+
case 0:
|
|
2905
|
+
return Ue("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2906
|
+
case 3:
|
|
2907
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2908
|
+
url: "/b2b/passwords/existing_password/reset",
|
|
2909
|
+
method: "POST",
|
|
2910
|
+
errorMessage: "Failed to reset password.",
|
|
2911
|
+
body: {
|
|
2912
|
+
organization_id: e.organization_id,
|
|
2913
|
+
email_address: e.email_address,
|
|
2914
|
+
existing_password: e.existing_password,
|
|
2915
|
+
new_password: e.new_password,
|
|
2916
|
+
locale: e.locale,
|
|
2917
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2918
|
+
captcha_token: i,
|
|
2919
|
+
dfp_telemetry_id: n
|
|
2920
|
+
},
|
|
2921
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2922
|
+
});
|
|
2923
|
+
case 8:
|
|
2924
|
+
return (o = t.sent).member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2925
|
+
state: {
|
|
2926
|
+
session: o.member_session,
|
|
2927
|
+
member: o.member,
|
|
2928
|
+
organization: o.organization
|
|
2929
|
+
},
|
|
2930
|
+
session_token: o.session_token,
|
|
2931
|
+
session_jwt: o.session_jwt,
|
|
2932
|
+
intermediate_session_token: null
|
|
2933
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
2934
|
+
state: null,
|
|
2935
|
+
session_token: null,
|
|
2936
|
+
session_jwt: null,
|
|
2937
|
+
intermediate_session_token: o.intermediate_session_token
|
|
2938
|
+
}), t.abrupt("return", o);
|
|
2939
|
+
case 11:
|
|
2940
|
+
case "end":
|
|
2941
|
+
return t.stop();
|
|
2942
|
+
}
|
|
2943
|
+
}, t, this);
|
|
2944
|
+
}));
|
|
2945
|
+
}
|
|
2946
|
+
}, {
|
|
2947
|
+
key: "resetBySession",
|
|
2948
|
+
value: function value(e) {
|
|
2949
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2950
|
+
var r, n, i, o;
|
|
2951
|
+
return le().wrap(function (t) {
|
|
2952
|
+
for (;;) switch (t.prev = t.next) {
|
|
2953
|
+
case 0:
|
|
2954
|
+
return Ue("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2955
|
+
case 3:
|
|
2956
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2957
|
+
url: "/b2b/passwords/session/reset",
|
|
2958
|
+
method: "POST",
|
|
2959
|
+
errorMessage: "Failed to reset by session.",
|
|
2960
|
+
body: {
|
|
2961
|
+
password: e.password,
|
|
2962
|
+
captcha_token: i,
|
|
2963
|
+
dfp_telemetry_id: n
|
|
2964
|
+
},
|
|
2965
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2966
|
+
});
|
|
2967
|
+
case 8:
|
|
2968
|
+
return o = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2969
|
+
state: {
|
|
2970
|
+
session: o.member_session,
|
|
2971
|
+
member: o.member,
|
|
2972
|
+
organization: o.organization
|
|
2973
|
+
},
|
|
2974
|
+
session_token: o.session_token,
|
|
2975
|
+
session_jwt: o.session_jwt,
|
|
2976
|
+
intermediate_session_token: null
|
|
2977
|
+
}), t.abrupt("return", o);
|
|
2978
|
+
case 11:
|
|
2979
|
+
case "end":
|
|
2980
|
+
return t.stop();
|
|
2981
|
+
}
|
|
2982
|
+
}, t, this);
|
|
2983
|
+
}));
|
|
2984
|
+
}
|
|
2985
|
+
}, {
|
|
2986
|
+
key: "strengthCheck",
|
|
2987
|
+
value: function value(e) {
|
|
2988
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2989
|
+
return le().wrap(function (t) {
|
|
2990
|
+
for (;;) switch (t.prev = t.next) {
|
|
2991
|
+
case 0:
|
|
2992
|
+
return Ue("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
2993
|
+
url: "/b2b/passwords/strength_check",
|
|
2994
|
+
method: "POST",
|
|
2995
|
+
errorMessage: "Failed to check password strength.",
|
|
2996
|
+
body: {
|
|
2997
|
+
email_address: e.email_address,
|
|
2998
|
+
password: e.password
|
|
2999
|
+
}
|
|
3000
|
+
}));
|
|
3001
|
+
case 2:
|
|
3002
|
+
case "end":
|
|
3003
|
+
return t.stop();
|
|
3004
|
+
}
|
|
3005
|
+
}, t, this);
|
|
3006
|
+
}));
|
|
3007
|
+
}
|
|
3008
|
+
}]), e;
|
|
3009
|
+
}(),
|
|
3010
|
+
rt = he(function e(t, r) {
|
|
2737
3011
|
var n = this,
|
|
2738
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
2739
|
-
|
|
3012
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : We();
|
|
3013
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
2740
3014
|
send: function send(e) {
|
|
2741
|
-
return
|
|
3015
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2742
3016
|
var r, n, i;
|
|
2743
|
-
return
|
|
3017
|
+
return le().wrap(function (t) {
|
|
2744
3018
|
for (;;) switch (t.prev = t.next) {
|
|
2745
3019
|
case 0:
|
|
2746
|
-
return
|
|
3020
|
+
return Ue("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2747
3021
|
case 3:
|
|
2748
3022
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
2749
3023
|
case 13:
|
|
@@ -2772,12 +3046,12 @@ var Ge = ne(function e(t, r) {
|
|
|
2772
3046
|
}));
|
|
2773
3047
|
},
|
|
2774
3048
|
authenticate: function authenticate(e) {
|
|
2775
|
-
return
|
|
3049
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
2776
3050
|
var r, n, i, o, s;
|
|
2777
|
-
return
|
|
3051
|
+
return le().wrap(function (t) {
|
|
2778
3052
|
for (;;) switch (t.prev = t.next) {
|
|
2779
3053
|
case 0:
|
|
2780
|
-
return
|
|
3054
|
+
return Ue("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2781
3055
|
case 3:
|
|
2782
3056
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
2783
3057
|
case 12:
|
|
@@ -2818,20 +3092,20 @@ var Ge = ne(function e(t, r) {
|
|
|
2818
3092
|
}
|
|
2819
3093
|
};
|
|
2820
3094
|
}),
|
|
2821
|
-
|
|
3095
|
+
nt = function () {
|
|
2822
3096
|
function e(t, r) {
|
|
2823
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
2824
|
-
|
|
3097
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : We();
|
|
3098
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2825
3099
|
}
|
|
2826
|
-
return
|
|
3100
|
+
return he(e, [{
|
|
2827
3101
|
key: "create",
|
|
2828
3102
|
value: function value(e) {
|
|
2829
|
-
return
|
|
3103
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2830
3104
|
var r, n, i;
|
|
2831
|
-
return
|
|
3105
|
+
return le().wrap(function (t) {
|
|
2832
3106
|
for (;;) switch (t.prev = t.next) {
|
|
2833
3107
|
case 0:
|
|
2834
|
-
return
|
|
3108
|
+
return Ue("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2835
3109
|
case 3:
|
|
2836
3110
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
2837
3111
|
case 13:
|
|
@@ -2862,12 +3136,12 @@ var Ge = ne(function e(t, r) {
|
|
|
2862
3136
|
}, {
|
|
2863
3137
|
key: "authenticate",
|
|
2864
3138
|
value: function value(e) {
|
|
2865
|
-
return
|
|
3139
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2866
3140
|
var r, n, i, o, s;
|
|
2867
|
-
return
|
|
3141
|
+
return le().wrap(function (t) {
|
|
2868
3142
|
for (;;) switch (t.prev = t.next) {
|
|
2869
3143
|
case 0:
|
|
2870
|
-
return
|
|
3144
|
+
return Ue("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2871
3145
|
case 3:
|
|
2872
3146
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
2873
3147
|
case 12:
|
|
@@ -2908,20 +3182,20 @@ var Ge = ne(function e(t, r) {
|
|
|
2908
3182
|
}
|
|
2909
3183
|
}]), e;
|
|
2910
3184
|
}(),
|
|
2911
|
-
|
|
3185
|
+
it = function () {
|
|
2912
3186
|
function e(t, r) {
|
|
2913
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
2914
|
-
|
|
3187
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : We();
|
|
3188
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2915
3189
|
}
|
|
2916
|
-
return
|
|
3190
|
+
return he(e, [{
|
|
2917
3191
|
key: "recover",
|
|
2918
3192
|
value: function value(e) {
|
|
2919
|
-
return
|
|
3193
|
+
return ye(this, void 0, void 0, le().mark(function t() {
|
|
2920
3194
|
var r, n, i, o, s;
|
|
2921
|
-
return
|
|
3195
|
+
return le().wrap(function (t) {
|
|
2922
3196
|
for (;;) switch (t.prev = t.next) {
|
|
2923
3197
|
case 0:
|
|
2924
|
-
return
|
|
3198
|
+
return Ue("stytch.recoveryCodes.recover").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2925
3199
|
case 3:
|
|
2926
3200
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
2927
3201
|
case 12:
|
|
@@ -2963,9 +3237,9 @@ var Ge = ne(function e(t, r) {
|
|
|
2963
3237
|
}, {
|
|
2964
3238
|
key: "rotate",
|
|
2965
3239
|
value: function value() {
|
|
2966
|
-
return
|
|
3240
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
2967
3241
|
var t, r, n;
|
|
2968
|
-
return
|
|
3242
|
+
return le().wrap(function (e) {
|
|
2969
3243
|
for (;;) switch (e.prev = e.next) {
|
|
2970
3244
|
case 0:
|
|
2971
3245
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2990,8 +3264,8 @@ var Ge = ne(function e(t, r) {
|
|
|
2990
3264
|
}, {
|
|
2991
3265
|
key: "get",
|
|
2992
3266
|
value: function value() {
|
|
2993
|
-
return
|
|
2994
|
-
return
|
|
3267
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
3268
|
+
return le().wrap(function (e) {
|
|
2995
3269
|
for (;;) switch (e.prev = e.next) {
|
|
2996
3270
|
case 0:
|
|
2997
3271
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3008,21 +3282,21 @@ var Ge = ne(function e(t, r) {
|
|
|
3008
3282
|
}
|
|
3009
3283
|
}]), e;
|
|
3010
3284
|
}(),
|
|
3011
|
-
|
|
3285
|
+
ot = function () {
|
|
3012
3286
|
function e(t, r, n) {
|
|
3013
3287
|
var i = this;
|
|
3014
|
-
|
|
3288
|
+
_e(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3015
3289
|
var r;
|
|
3016
3290
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3017
3291
|
}, this.isAuthorized = function (e, t) {
|
|
3018
3292
|
return i.policyPromise.then(function (r) {
|
|
3019
3293
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3020
3294
|
});
|
|
3021
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3022
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3295
|
+
}, this.cachedPolicy = t.rbacPolicy ? at.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3296
|
+
return e.rbacPolicy ? (i.cachedPolicy = at.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ke("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new at([], []));
|
|
3023
3297
|
});
|
|
3024
3298
|
}
|
|
3025
|
-
return
|
|
3299
|
+
return he(e, [{
|
|
3026
3300
|
key: "allPermissions",
|
|
3027
3301
|
value: function value() {
|
|
3028
3302
|
var e = this;
|
|
@@ -3039,15 +3313,15 @@ var Ge = ne(function e(t, r) {
|
|
|
3039
3313
|
}
|
|
3040
3314
|
}]), e;
|
|
3041
3315
|
}(),
|
|
3042
|
-
|
|
3316
|
+
st = function () {
|
|
3043
3317
|
function e(t, r) {
|
|
3044
3318
|
var n = this;
|
|
3045
|
-
|
|
3319
|
+
_e(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3046
3320
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3047
3321
|
}, this._reauthenticateWithBackoff = function () {
|
|
3048
|
-
return
|
|
3322
|
+
return ye(n, void 0, void 0, le().mark(function t() {
|
|
3049
3323
|
var r;
|
|
3050
|
-
return
|
|
3324
|
+
return le().wrap(function (t) {
|
|
3051
3325
|
for (;;) switch (t.prev = t.next) {
|
|
3052
3326
|
case 0:
|
|
3053
3327
|
r = 0;
|
|
@@ -3076,14 +3350,14 @@ var Ge = ne(function e(t, r) {
|
|
|
3076
3350
|
}));
|
|
3077
3351
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3078
3352
|
}
|
|
3079
|
-
return
|
|
3353
|
+
return he(e, [{
|
|
3080
3354
|
key: "performBackgroundRefresh",
|
|
3081
3355
|
value: function value() {
|
|
3082
3356
|
var e = this;
|
|
3083
3357
|
this._reauthenticateWithBackoff().then(function () {
|
|
3084
3358
|
e.scheduleBackgroundRefresh();
|
|
3085
3359
|
})["catch"](function (t) {
|
|
3086
|
-
|
|
3360
|
+
Be("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3087
3361
|
error: t
|
|
3088
3362
|
}), e._subscriptionService.destroySession();
|
|
3089
3363
|
});
|
|
@@ -3109,593 +3383,65 @@ var Ge = ne(function e(t, r) {
|
|
|
3109
3383
|
}, {
|
|
3110
3384
|
key: "isUnrecoverableError",
|
|
3111
3385
|
value: function value(e) {
|
|
3112
|
-
return
|
|
3386
|
+
return P.includes(e.error_type);
|
|
3113
3387
|
}
|
|
3114
3388
|
}]), e;
|
|
3115
3389
|
}();
|
|
3116
|
-
|
|
3117
|
-
var
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
st = function () {
|
|
3128
|
-
function e(t, r) {
|
|
3390
|
+
st.REFRESH_INTERVAL_MS = 18e4;
|
|
3391
|
+
var at = function () {
|
|
3392
|
+
function e(t, r) {
|
|
3393
|
+
var n = this;
|
|
3394
|
+
_e(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3395
|
+
return n.rolesByID[e.role_id] = e;
|
|
3396
|
+
});
|
|
3397
|
+
}
|
|
3398
|
+
return he(e, [{
|
|
3399
|
+
key: "callerIsAuthorized",
|
|
3400
|
+
value: function value(e, t, r) {
|
|
3129
3401
|
var n = this;
|
|
3130
|
-
|
|
3131
|
-
return n.rolesByID[e
|
|
3402
|
+
return !!e.map(function (e) {
|
|
3403
|
+
return n.rolesByID[e];
|
|
3404
|
+
}).filter(function (e) {
|
|
3405
|
+
return e;
|
|
3406
|
+
}).flatMap(function (e) {
|
|
3407
|
+
return e.permissions;
|
|
3408
|
+
}).filter(function (e) {
|
|
3409
|
+
return e.resource_id === t;
|
|
3410
|
+
}).find(function (e) {
|
|
3411
|
+
return e.actions.includes(r) || e.actions.includes("*");
|
|
3132
3412
|
});
|
|
3133
3413
|
}
|
|
3134
|
-
return ne(e, [{
|
|
3135
|
-
key: "callerIsAuthorized",
|
|
3136
|
-
value: function value(e, t, r) {
|
|
3137
|
-
var n = this;
|
|
3138
|
-
return !!e.map(function (e) {
|
|
3139
|
-
return n.rolesByID[e];
|
|
3140
|
-
}).filter(function (e) {
|
|
3141
|
-
return e;
|
|
3142
|
-
}).flatMap(function (e) {
|
|
3143
|
-
return e.permissions;
|
|
3144
|
-
}).filter(function (e) {
|
|
3145
|
-
return e.resource_id === t;
|
|
3146
|
-
}).find(function (e) {
|
|
3147
|
-
return e.actions.includes(r) || e.actions.includes("*");
|
|
3148
|
-
});
|
|
3149
|
-
}
|
|
3150
|
-
}, {
|
|
3151
|
-
key: "allPermissionsForCaller",
|
|
3152
|
-
value: function value(e) {
|
|
3153
|
-
var t = this,
|
|
3154
|
-
r = {};
|
|
3155
|
-
return this.resources.forEach(function (n) {
|
|
3156
|
-
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3157
|
-
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3158
|
-
});
|
|
3159
|
-
}), r;
|
|
3160
|
-
}
|
|
3161
|
-
}], [{
|
|
3162
|
-
key: "fromJSON",
|
|
3163
|
-
value: function value(t) {
|
|
3164
|
-
return new e(t.roles, t.resources);
|
|
3165
|
-
}
|
|
3166
|
-
}]), e;
|
|
3167
|
-
}();
|
|
3168
|
-
function at(e, t, r, n) {
|
|
3169
|
-
return new (r || (r = Promise))(function (i, o) {
|
|
3170
|
-
function s(e) {
|
|
3171
|
-
try {
|
|
3172
|
-
c(n.next(e));
|
|
3173
|
-
} catch (e) {
|
|
3174
|
-
o(e);
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
function a(e) {
|
|
3178
|
-
try {
|
|
3179
|
-
c(n["throw"](e));
|
|
3180
|
-
} catch (e) {
|
|
3181
|
-
o(e);
|
|
3182
|
-
}
|
|
3183
|
-
}
|
|
3184
|
-
function c(e) {
|
|
3185
|
-
var t;
|
|
3186
|
-
e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
|
|
3187
|
-
e(t);
|
|
3188
|
-
})).then(s, a);
|
|
3189
|
-
}
|
|
3190
|
-
c((n = n.apply(e, t || [])).next());
|
|
3191
|
-
});
|
|
3192
|
-
}
|
|
3193
|
-
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
3194
|
-
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
3195
|
-
}($e || ($e = {})), function (e) {
|
|
3196
|
-
e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
|
|
3197
|
-
}(Xe || (Xe = {})), function (e) {
|
|
3198
|
-
e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
|
|
3199
|
-
}(Ze || (Ze = {})), function (e) {
|
|
3200
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
3201
|
-
}(Qe || (Qe = {})), function (e) {
|
|
3202
|
-
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
3203
|
-
}(et || (et = {})), function (e) {
|
|
3204
|
-
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
3205
|
-
}(tt || (tt = {}));
|
|
3206
|
-
var ct = /*#__PURE__*/function (_Error) {
|
|
3207
|
-
_inherits(ct, _Error);
|
|
3208
|
-
function ct(e, t) {
|
|
3209
|
-
var _this;
|
|
3210
|
-
_classCallCheck(this, ct);
|
|
3211
|
-
_this = _callSuper(this, ct), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
|
|
3212
|
-
return _this;
|
|
3213
|
-
}
|
|
3214
|
-
return _createClass(ct);
|
|
3215
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
3216
|
-
!function (e) {
|
|
3217
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3218
|
-
}(rt || (rt = {})), function (e) {
|
|
3219
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3220
|
-
}(nt || (nt = {})), function (e) {
|
|
3221
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
3222
|
-
}(it || (it = {})), function (e) {
|
|
3223
|
-
e.RequiredCatcha = "Catcha Required";
|
|
3224
|
-
}(ot || (ot = {}));
|
|
3225
|
-
var ut = function ut(e) {
|
|
3226
|
-
var t = {
|
|
3227
|
-
isObject: function isObject(r, n) {
|
|
3228
|
-
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new ct(e, r + " must be an object.");
|
|
3229
|
-
return t;
|
|
3230
|
-
},
|
|
3231
|
-
isOptionalObject: function isOptionalObject(e, r) {
|
|
3232
|
-
return void 0 === r ? t : t.isObject(e, r);
|
|
3233
|
-
},
|
|
3234
|
-
isString: function isString(r, n) {
|
|
3235
|
-
if ("string" != typeof n) throw new ct(e, r + " must be a string.");
|
|
3236
|
-
return t;
|
|
3237
|
-
},
|
|
3238
|
-
isOptionalString: function isOptionalString(e, r) {
|
|
3239
|
-
return void 0 === r ? t : t.isString(e, r);
|
|
3240
|
-
},
|
|
3241
|
-
isStringArray: function isStringArray(r, n) {
|
|
3242
|
-
if (!Array.isArray(n)) throw new ct(e, r + " must be an array of strings.");
|
|
3243
|
-
var _iterator = _createForOfIteratorHelper(n),
|
|
3244
|
-
_step;
|
|
3245
|
-
try {
|
|
3246
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3247
|
-
var _t2 = _step.value;
|
|
3248
|
-
if ("string" != typeof _t2) throw new ct(e, r + " must be an array of strings.");
|
|
3249
|
-
}
|
|
3250
|
-
} catch (err) {
|
|
3251
|
-
_iterator.e(err);
|
|
3252
|
-
} finally {
|
|
3253
|
-
_iterator.f();
|
|
3254
|
-
}
|
|
3255
|
-
return t;
|
|
3256
|
-
},
|
|
3257
|
-
isOptionalStringArray: function isOptionalStringArray(e, r) {
|
|
3258
|
-
return void 0 === r ? t : t.isStringArray(e, r);
|
|
3259
|
-
},
|
|
3260
|
-
isNumber: function isNumber(r, n) {
|
|
3261
|
-
if ("number" != typeof n) throw new ct(e, r + " must be a number.");
|
|
3262
|
-
return t;
|
|
3263
|
-
},
|
|
3264
|
-
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
3265
|
-
return void 0 === r ? t : t.isNumber(e, r);
|
|
3266
|
-
},
|
|
3267
|
-
isBoolean: function isBoolean(r, n) {
|
|
3268
|
-
if ("boolean" != typeof n) throw new ct(e, r + " must be a boolean.");
|
|
3269
|
-
return t;
|
|
3270
|
-
},
|
|
3271
|
-
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
3272
|
-
return void 0 === r ? t : t.isBoolean(e, r);
|
|
3273
|
-
}
|
|
3274
|
-
};
|
|
3275
|
-
return t;
|
|
3276
|
-
};
|
|
3277
|
-
var lt;
|
|
3278
|
-
!function (e) {
|
|
3279
|
-
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
3280
|
-
}(lt || (lt = {})), Promise.resolve({
|
|
3281
|
-
pkceRequiredForEmailMagicLinks: !1
|
|
3282
|
-
}), Promise.resolve({
|
|
3283
|
-
pkceRequiredForPasswordResets: !1
|
|
3284
|
-
}), Promise.resolve({
|
|
3285
|
-
pkceRequiredForEmailMagicLinks: !1
|
|
3286
|
-
});
|
|
3287
|
-
var dt = Promise.resolve({
|
|
3288
|
-
pkceRequiredForPasswordResets: !1
|
|
3289
|
-
});
|
|
3290
|
-
var ht = /*#__PURE__*/function () {
|
|
3291
|
-
function ht(e, t, r) {
|
|
3292
|
-
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : dt;
|
|
3293
|
-
var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
3294
|
-
return {
|
|
3295
|
-
isEnabled: function isEnabled() {
|
|
3296
|
-
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3297
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3298
|
-
while (1) switch (_context.prev = _context.next) {
|
|
3299
|
-
case 0:
|
|
3300
|
-
return _context.abrupt("return", !1);
|
|
3301
|
-
case 1:
|
|
3302
|
-
case "end":
|
|
3303
|
-
return _context.stop();
|
|
3304
|
-
}
|
|
3305
|
-
}, _callee);
|
|
3306
|
-
}));
|
|
3307
|
-
},
|
|
3308
|
-
getTelemetryID: function getTelemetryID() {
|
|
3309
|
-
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3310
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3311
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3312
|
-
case 0:
|
|
3313
|
-
case "end":
|
|
3314
|
-
return _context2.stop();
|
|
3315
|
-
}
|
|
3316
|
-
}, _callee2);
|
|
3317
|
-
}));
|
|
3318
|
-
},
|
|
3319
|
-
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
3320
|
-
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3321
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3322
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
3323
|
-
case 0:
|
|
3324
|
-
return _context3.abrupt("return", {
|
|
3325
|
-
dfp_telemetry_id: void 0,
|
|
3326
|
-
captcha_token: void 0
|
|
3327
|
-
});
|
|
3328
|
-
case 1:
|
|
3329
|
-
case "end":
|
|
3330
|
-
return _context3.stop();
|
|
3331
|
-
}
|
|
3332
|
-
}, _callee3);
|
|
3333
|
-
}));
|
|
3334
|
-
},
|
|
3335
|
-
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
3336
|
-
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3337
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3338
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
3339
|
-
case 0:
|
|
3340
|
-
throw new Error("DFP protected auth is disabled");
|
|
3341
|
-
case 1:
|
|
3342
|
-
case "end":
|
|
3343
|
-
return _context4.stop();
|
|
3344
|
-
}
|
|
3345
|
-
}, _callee4);
|
|
3346
|
-
}));
|
|
3347
|
-
}
|
|
3348
|
-
};
|
|
3349
|
-
}();
|
|
3350
|
-
_classCallCheck(this, ht);
|
|
3351
|
-
this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
|
|
3352
|
-
}
|
|
3353
|
-
_createClass(ht, [{
|
|
3354
|
-
key: "getCodeChallenge",
|
|
3355
|
-
value: function getCodeChallenge() {
|
|
3356
|
-
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3357
|
-
var _yield$this$_config, e, t;
|
|
3358
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3359
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
3360
|
-
case 0:
|
|
3361
|
-
_context5.next = 2;
|
|
3362
|
-
return this._config;
|
|
3363
|
-
case 2:
|
|
3364
|
-
_yield$this$_config = _context5.sent;
|
|
3365
|
-
e = _yield$this$_config.pkceRequiredForPasswordResets;
|
|
3366
|
-
if (e) {
|
|
3367
|
-
_context5.next = 6;
|
|
3368
|
-
break;
|
|
3369
|
-
}
|
|
3370
|
-
return _context5.abrupt("return");
|
|
3371
|
-
case 6:
|
|
3372
|
-
_context5.next = 8;
|
|
3373
|
-
return this._pkceManager.getPKPair();
|
|
3374
|
-
case 8:
|
|
3375
|
-
t = _context5.sent;
|
|
3376
|
-
_context5.t0 = t;
|
|
3377
|
-
if (_context5.t0) {
|
|
3378
|
-
_context5.next = 14;
|
|
3379
|
-
break;
|
|
3380
|
-
}
|
|
3381
|
-
_context5.next = 13;
|
|
3382
|
-
return this._pkceManager.startPKCETransaction();
|
|
3383
|
-
case 13:
|
|
3384
|
-
t = _context5.sent;
|
|
3385
|
-
case 14:
|
|
3386
|
-
return _context5.abrupt("return", t.code_challenge);
|
|
3387
|
-
case 15:
|
|
3388
|
-
case "end":
|
|
3389
|
-
return _context5.stop();
|
|
3390
|
-
}
|
|
3391
|
-
}, _callee5, this);
|
|
3392
|
-
}));
|
|
3393
|
-
}
|
|
3394
|
-
}, {
|
|
3395
|
-
key: "authenticate",
|
|
3396
|
-
value: function authenticate(e) {
|
|
3397
|
-
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3398
|
-
var t, r, _yield$this$dfpProtec, n, i, o;
|
|
3399
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3400
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
3401
|
-
case 0:
|
|
3402
|
-
ut("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
|
|
3403
|
-
_context6.next = 3;
|
|
3404
|
-
return this._pkceManager.getPKPair();
|
|
3405
|
-
case 3:
|
|
3406
|
-
t = _context6.sent;
|
|
3407
|
-
r = null == t ? void 0 : t.code_verifier;
|
|
3408
|
-
_context6.next = 7;
|
|
3409
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3410
|
-
case 7:
|
|
3411
|
-
_yield$this$dfpProtec = _context6.sent;
|
|
3412
|
-
n = _yield$this$dfpProtec.dfp_telemetry_id;
|
|
3413
|
-
i = _yield$this$dfpProtec.captcha_token;
|
|
3414
|
-
_context6.next = 12;
|
|
3415
|
-
return this._networkClient.retriableFetchSDK({
|
|
3416
|
-
url: "/b2b/passwords/authenticate",
|
|
3417
|
-
method: "POST",
|
|
3418
|
-
errorMessage: "Failed to authenticate password.",
|
|
3419
|
-
body: {
|
|
3420
|
-
organization_id: e.organization_id,
|
|
3421
|
-
email_address: e.email_address,
|
|
3422
|
-
password: e.password,
|
|
3423
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3424
|
-
locale: e.locale,
|
|
3425
|
-
captcha_token: i,
|
|
3426
|
-
dfp_telemetry_id: n,
|
|
3427
|
-
code_verifier: r
|
|
3428
|
-
},
|
|
3429
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3430
|
-
});
|
|
3431
|
-
case 12:
|
|
3432
|
-
o = _context6.sent;
|
|
3433
|
-
return _context6.abrupt("return", (o.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3434
|
-
state: {
|
|
3435
|
-
session: o.member_session,
|
|
3436
|
-
member: o.member,
|
|
3437
|
-
organization: o.organization
|
|
3438
|
-
},
|
|
3439
|
-
session_token: o.session_token,
|
|
3440
|
-
session_jwt: o.session_jwt,
|
|
3441
|
-
intermediate_session_token: null
|
|
3442
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3443
|
-
state: null,
|
|
3444
|
-
session_token: null,
|
|
3445
|
-
session_jwt: null,
|
|
3446
|
-
intermediate_session_token: o.intermediate_session_token
|
|
3447
|
-
}), o));
|
|
3448
|
-
case 14:
|
|
3449
|
-
case "end":
|
|
3450
|
-
return _context6.stop();
|
|
3451
|
-
}
|
|
3452
|
-
}, _callee6, this);
|
|
3453
|
-
}));
|
|
3454
|
-
}
|
|
3455
|
-
}, {
|
|
3456
|
-
key: "resetByEmailStart",
|
|
3457
|
-
value: function resetByEmailStart(e) {
|
|
3458
|
-
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3459
|
-
var t, _yield$this$dfpProtec2, r, n;
|
|
3460
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3461
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
3462
|
-
case 0:
|
|
3463
|
-
ut("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes);
|
|
3464
|
-
_context7.next = 3;
|
|
3465
|
-
return this.getCodeChallenge();
|
|
3466
|
-
case 3:
|
|
3467
|
-
t = _context7.sent;
|
|
3468
|
-
_context7.next = 6;
|
|
3469
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3470
|
-
case 6:
|
|
3471
|
-
_yield$this$dfpProtec2 = _context7.sent;
|
|
3472
|
-
r = _yield$this$dfpProtec2.dfp_telemetry_id;
|
|
3473
|
-
n = _yield$this$dfpProtec2.captcha_token;
|
|
3474
|
-
return _context7.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
3475
|
-
url: "/b2b/passwords/email/reset/start",
|
|
3476
|
-
method: "POST",
|
|
3477
|
-
errorMessage: "Failed to start password reset flow.",
|
|
3478
|
-
body: {
|
|
3479
|
-
organization_id: e.organization_id,
|
|
3480
|
-
email_address: e.email_address,
|
|
3481
|
-
login_redirect_url: e.login_redirect_url,
|
|
3482
|
-
reset_password_redirect_url: e.reset_password_redirect_url,
|
|
3483
|
-
reset_password_expiration_minutes: e.reset_password_expiration_minutes,
|
|
3484
|
-
reset_password_template_id: e.reset_password_template_id,
|
|
3485
|
-
code_challenge: t,
|
|
3486
|
-
captcha_token: n,
|
|
3487
|
-
dfp_telemetry_id: r
|
|
3488
|
-
},
|
|
3489
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3490
|
-
}));
|
|
3491
|
-
case 10:
|
|
3492
|
-
case "end":
|
|
3493
|
-
return _context7.stop();
|
|
3494
|
-
}
|
|
3495
|
-
}, _callee7, this);
|
|
3496
|
-
}));
|
|
3497
|
-
}
|
|
3498
|
-
}, {
|
|
3499
|
-
key: "resetByEmail",
|
|
3500
|
-
value: function resetByEmail(e) {
|
|
3501
|
-
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3502
|
-
var _yield$this$dfpProtec3, t, r, n, i, o;
|
|
3503
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3504
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
3505
|
-
case 0:
|
|
3506
|
-
ut("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
|
|
3507
|
-
_context8.next = 3;
|
|
3508
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3509
|
-
case 3:
|
|
3510
|
-
_yield$this$dfpProtec3 = _context8.sent;
|
|
3511
|
-
t = _yield$this$dfpProtec3.dfp_telemetry_id;
|
|
3512
|
-
r = _yield$this$dfpProtec3.captcha_token;
|
|
3513
|
-
_context8.next = 8;
|
|
3514
|
-
return this._pkceManager.getPKPair();
|
|
3515
|
-
case 8:
|
|
3516
|
-
n = _context8.sent;
|
|
3517
|
-
i = null == n ? void 0 : n.code_verifier;
|
|
3518
|
-
_context8.next = 12;
|
|
3519
|
-
return this._networkClient.retriableFetchSDK({
|
|
3520
|
-
url: "/b2b/passwords/email/reset",
|
|
3521
|
-
method: "POST",
|
|
3522
|
-
errorMessage: "Failed to reset password.",
|
|
3523
|
-
body: {
|
|
3524
|
-
password_reset_token: e.password_reset_token,
|
|
3525
|
-
password: e.password,
|
|
3526
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3527
|
-
locale: e.locale,
|
|
3528
|
-
captcha_token: r,
|
|
3529
|
-
dfp_telemetry_id: t,
|
|
3530
|
-
code_verifier: i
|
|
3531
|
-
},
|
|
3532
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3533
|
-
});
|
|
3534
|
-
case 12:
|
|
3535
|
-
o = _context8.sent;
|
|
3536
|
-
return _context8.abrupt("return", (this._pkceManager.clearPKPair(), o.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3537
|
-
state: {
|
|
3538
|
-
session: o.member_session,
|
|
3539
|
-
member: o.member,
|
|
3540
|
-
organization: o.organization
|
|
3541
|
-
},
|
|
3542
|
-
session_token: o.session_token,
|
|
3543
|
-
session_jwt: o.session_jwt,
|
|
3544
|
-
intermediate_session_token: null
|
|
3545
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3546
|
-
state: null,
|
|
3547
|
-
session_token: null,
|
|
3548
|
-
session_jwt: null,
|
|
3549
|
-
intermediate_session_token: o.intermediate_session_token
|
|
3550
|
-
}), o));
|
|
3551
|
-
case 14:
|
|
3552
|
-
case "end":
|
|
3553
|
-
return _context8.stop();
|
|
3554
|
-
}
|
|
3555
|
-
}, _callee8, this);
|
|
3556
|
-
}));
|
|
3557
|
-
}
|
|
3558
|
-
}, {
|
|
3559
|
-
key: "resetByExistingPassword",
|
|
3560
|
-
value: function resetByExistingPassword(e) {
|
|
3561
|
-
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3562
|
-
var _yield$this$dfpProtec4, t, r, n;
|
|
3563
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3564
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
3565
|
-
case 0:
|
|
3566
|
-
ut("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
|
|
3567
|
-
_context9.next = 3;
|
|
3568
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3569
|
-
case 3:
|
|
3570
|
-
_yield$this$dfpProtec4 = _context9.sent;
|
|
3571
|
-
t = _yield$this$dfpProtec4.dfp_telemetry_id;
|
|
3572
|
-
r = _yield$this$dfpProtec4.captcha_token;
|
|
3573
|
-
_context9.next = 8;
|
|
3574
|
-
return this._networkClient.retriableFetchSDK({
|
|
3575
|
-
url: "/b2b/passwords/existing_password/reset",
|
|
3576
|
-
method: "POST",
|
|
3577
|
-
errorMessage: "Failed to reset password.",
|
|
3578
|
-
body: {
|
|
3579
|
-
organization_id: e.organization_id,
|
|
3580
|
-
email_address: e.email_address,
|
|
3581
|
-
existing_password: e.existing_password,
|
|
3582
|
-
new_password: e.new_password,
|
|
3583
|
-
locale: e.locale,
|
|
3584
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3585
|
-
captcha_token: r,
|
|
3586
|
-
dfp_telemetry_id: t
|
|
3587
|
-
},
|
|
3588
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3589
|
-
});
|
|
3590
|
-
case 8:
|
|
3591
|
-
n = _context9.sent;
|
|
3592
|
-
return _context9.abrupt("return", (n.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3593
|
-
state: {
|
|
3594
|
-
session: n.member_session,
|
|
3595
|
-
member: n.member,
|
|
3596
|
-
organization: n.organization
|
|
3597
|
-
},
|
|
3598
|
-
session_token: n.session_token,
|
|
3599
|
-
session_jwt: n.session_jwt,
|
|
3600
|
-
intermediate_session_token: null
|
|
3601
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3602
|
-
state: null,
|
|
3603
|
-
session_token: null,
|
|
3604
|
-
session_jwt: null,
|
|
3605
|
-
intermediate_session_token: n.intermediate_session_token
|
|
3606
|
-
}), n));
|
|
3607
|
-
case 10:
|
|
3608
|
-
case "end":
|
|
3609
|
-
return _context9.stop();
|
|
3610
|
-
}
|
|
3611
|
-
}, _callee9, this);
|
|
3612
|
-
}));
|
|
3613
|
-
}
|
|
3614
3414
|
}, {
|
|
3615
|
-
key: "
|
|
3616
|
-
value: function
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3625
|
-
case 3:
|
|
3626
|
-
_yield$this$dfpProtec5 = _context10.sent;
|
|
3627
|
-
t = _yield$this$dfpProtec5.dfp_telemetry_id;
|
|
3628
|
-
r = _yield$this$dfpProtec5.captcha_token;
|
|
3629
|
-
_context10.next = 8;
|
|
3630
|
-
return this._networkClient.retriableFetchSDK({
|
|
3631
|
-
url: "/b2b/passwords/session/reset",
|
|
3632
|
-
method: "POST",
|
|
3633
|
-
errorMessage: "Failed to reset by session.",
|
|
3634
|
-
body: {
|
|
3635
|
-
password: e.password,
|
|
3636
|
-
captcha_token: r,
|
|
3637
|
-
dfp_telemetry_id: t
|
|
3638
|
-
},
|
|
3639
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3640
|
-
});
|
|
3641
|
-
case 8:
|
|
3642
|
-
n = _context10.sent;
|
|
3643
|
-
return _context10.abrupt("return", (this._subscriptionService.updateStateAndTokens({
|
|
3644
|
-
state: {
|
|
3645
|
-
session: n.member_session,
|
|
3646
|
-
member: n.member,
|
|
3647
|
-
organization: n.organization
|
|
3648
|
-
},
|
|
3649
|
-
session_token: n.session_token,
|
|
3650
|
-
session_jwt: n.session_jwt,
|
|
3651
|
-
intermediate_session_token: null
|
|
3652
|
-
}), n));
|
|
3653
|
-
case 10:
|
|
3654
|
-
case "end":
|
|
3655
|
-
return _context10.stop();
|
|
3656
|
-
}
|
|
3657
|
-
}, _callee10, this);
|
|
3658
|
-
}));
|
|
3415
|
+
key: "allPermissionsForCaller",
|
|
3416
|
+
value: function value(e) {
|
|
3417
|
+
var t = this,
|
|
3418
|
+
r = {};
|
|
3419
|
+
return this.resources.forEach(function (n) {
|
|
3420
|
+
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3421
|
+
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3422
|
+
});
|
|
3423
|
+
}), r;
|
|
3659
3424
|
}
|
|
3660
|
-
}, {
|
|
3661
|
-
key: "
|
|
3662
|
-
value: function
|
|
3663
|
-
return
|
|
3664
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
3665
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
3666
|
-
case 0:
|
|
3667
|
-
return _context11.abrupt("return", (ut("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
|
|
3668
|
-
url: "/b2b/passwords/strength_check",
|
|
3669
|
-
method: "POST",
|
|
3670
|
-
errorMessage: "Failed to check password strength.",
|
|
3671
|
-
body: {
|
|
3672
|
-
email_address: e.email_address,
|
|
3673
|
-
password: e.password
|
|
3674
|
-
}
|
|
3675
|
-
})));
|
|
3676
|
-
case 1:
|
|
3677
|
-
case "end":
|
|
3678
|
-
return _context11.stop();
|
|
3679
|
-
}
|
|
3680
|
-
}, _callee11, this);
|
|
3681
|
-
}));
|
|
3425
|
+
}], [{
|
|
3426
|
+
key: "fromJSON",
|
|
3427
|
+
value: function value(t) {
|
|
3428
|
+
return new e(t.roles, t.resources);
|
|
3682
3429
|
}
|
|
3683
|
-
}]);
|
|
3684
|
-
return ht;
|
|
3430
|
+
}]), e;
|
|
3685
3431
|
}();
|
|
3686
|
-
var
|
|
3687
|
-
var
|
|
3688
|
-
function
|
|
3689
|
-
var
|
|
3690
|
-
_classCallCheck(this,
|
|
3432
|
+
var ct = "bootstrap";
|
|
3433
|
+
var ut = /*#__PURE__*/function () {
|
|
3434
|
+
function ut(e, t, r) {
|
|
3435
|
+
var _this = this;
|
|
3436
|
+
_classCallCheck(this, ut);
|
|
3691
3437
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3692
3438
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3693
3439
|
method: "GET",
|
|
3694
3440
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3695
|
-
}).then(
|
|
3696
|
-
return
|
|
3441
|
+
}).then(ut.mapBootstrapData).then(function (e) {
|
|
3442
|
+
return _this._dataLayer.setItem(ct, JSON.stringify(e)), e;
|
|
3697
3443
|
})["catch"](function (e) {
|
|
3698
|
-
return
|
|
3444
|
+
return Ke(e), {
|
|
3699
3445
|
displayWatermark: !1,
|
|
3700
3446
|
cnameDomain: null,
|
|
3701
3447
|
emailDomains: ["stytch.com"],
|
|
@@ -3714,10 +3460,10 @@ var _t = /*#__PURE__*/function () {
|
|
|
3714
3460
|
};
|
|
3715
3461
|
});
|
|
3716
3462
|
}
|
|
3717
|
-
_createClass(
|
|
3463
|
+
_createClass(ut, [{
|
|
3718
3464
|
key: "getSync",
|
|
3719
3465
|
value: function getSync() {
|
|
3720
|
-
var e = this._dataLayer.getItem(
|
|
3466
|
+
var e = this._dataLayer.getItem(ct);
|
|
3721
3467
|
if (null === e) return {
|
|
3722
3468
|
displayWatermark: !1,
|
|
3723
3469
|
cnameDomain: null,
|
|
@@ -3788,9 +3534,9 @@ var _t = /*#__PURE__*/function () {
|
|
|
3788
3534
|
};
|
|
3789
3535
|
}
|
|
3790
3536
|
}]);
|
|
3791
|
-
return
|
|
3537
|
+
return ut;
|
|
3792
3538
|
}();
|
|
3793
|
-
function
|
|
3539
|
+
function lt(e, t, r, n) {
|
|
3794
3540
|
return new (r || (r = Promise))(function (i, o) {
|
|
3795
3541
|
function s(e) {
|
|
3796
3542
|
try {
|
|
@@ -3816,91 +3562,91 @@ function ft(e, t, r, n) {
|
|
|
3816
3562
|
});
|
|
3817
3563
|
}
|
|
3818
3564
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3819
|
-
var
|
|
3820
|
-
var
|
|
3821
|
-
_classCallCheck(this,
|
|
3565
|
+
var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
3566
|
+
var _this2 = this;
|
|
3567
|
+
_classCallCheck(this, dt);
|
|
3822
3568
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3823
|
-
return
|
|
3569
|
+
return lt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3824
3570
|
var _yield$this$state, e, t, r;
|
|
3825
|
-
return _regeneratorRuntime().wrap(function
|
|
3826
|
-
while (1) switch (
|
|
3571
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3572
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3827
3573
|
case 0:
|
|
3828
|
-
|
|
3574
|
+
_context.next = 2;
|
|
3829
3575
|
return this.state;
|
|
3830
3576
|
case 2:
|
|
3831
|
-
_yield$this$state =
|
|
3577
|
+
_yield$this$state = _context.sent;
|
|
3832
3578
|
e = _yield$this$state.captchaClient;
|
|
3833
3579
|
t = _yield$this$state.configured;
|
|
3834
3580
|
r = _yield$this$state.siteKey;
|
|
3835
3581
|
if (!t) {
|
|
3836
|
-
|
|
3582
|
+
_context.next = 10;
|
|
3837
3583
|
break;
|
|
3838
3584
|
}
|
|
3839
|
-
|
|
3585
|
+
_context.next = 9;
|
|
3840
3586
|
return new Promise(function (t) {
|
|
3841
3587
|
return e.ready(t);
|
|
3842
3588
|
});
|
|
3843
3589
|
case 9:
|
|
3844
|
-
return
|
|
3590
|
+
return _context.abrupt("return", e.execute(r, {
|
|
3845
3591
|
action: "LOGIN"
|
|
3846
3592
|
}));
|
|
3847
3593
|
case 10:
|
|
3848
3594
|
case "end":
|
|
3849
|
-
return
|
|
3595
|
+
return _context.stop();
|
|
3850
3596
|
}
|
|
3851
|
-
},
|
|
3597
|
+
}, _callee, this);
|
|
3852
3598
|
}));
|
|
3853
3599
|
}, this.state = e.then(function (e) {
|
|
3854
|
-
return
|
|
3600
|
+
return lt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3855
3601
|
var t;
|
|
3856
|
-
return _regeneratorRuntime().wrap(function
|
|
3857
|
-
while (1) switch (
|
|
3602
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3603
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3858
3604
|
case 0:
|
|
3859
3605
|
if (!e.captchaSettings.enabled) {
|
|
3860
|
-
|
|
3606
|
+
_context2.next = 9;
|
|
3861
3607
|
break;
|
|
3862
3608
|
}
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
return t = e.captchaSettings.siteKey,
|
|
3609
|
+
_context2.t1 = !0;
|
|
3610
|
+
_context2.next = 4;
|
|
3611
|
+
return t = e.captchaSettings.siteKey, Fe("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3866
3612
|
return window.grecaptcha.enterprise;
|
|
3867
3613
|
});
|
|
3868
3614
|
case 4:
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
configured:
|
|
3873
|
-
captchaClient:
|
|
3874
|
-
siteKey:
|
|
3615
|
+
_context2.t2 = _context2.sent;
|
|
3616
|
+
_context2.t3 = e.captchaSettings.siteKey;
|
|
3617
|
+
_context2.t0 = {
|
|
3618
|
+
configured: _context2.t1,
|
|
3619
|
+
captchaClient: _context2.t2,
|
|
3620
|
+
siteKey: _context2.t3
|
|
3875
3621
|
};
|
|
3876
|
-
|
|
3622
|
+
_context2.next = 10;
|
|
3877
3623
|
break;
|
|
3878
3624
|
case 9:
|
|
3879
|
-
|
|
3625
|
+
_context2.t0 = {
|
|
3880
3626
|
configured: !1
|
|
3881
3627
|
};
|
|
3882
3628
|
case 10:
|
|
3883
|
-
return
|
|
3629
|
+
return _context2.abrupt("return", _context2.t0);
|
|
3884
3630
|
case 11:
|
|
3885
3631
|
case "end":
|
|
3886
|
-
return
|
|
3632
|
+
return _context2.stop();
|
|
3887
3633
|
}
|
|
3888
|
-
},
|
|
3634
|
+
}, _callee2);
|
|
3889
3635
|
}));
|
|
3890
3636
|
});
|
|
3891
3637
|
});
|
|
3892
|
-
var
|
|
3893
|
-
function
|
|
3894
|
-
_classCallCheck(this,
|
|
3638
|
+
var ht = /*#__PURE__*/function () {
|
|
3639
|
+
function ht(e, t, r, n) {
|
|
3640
|
+
_classCallCheck(this, ht);
|
|
3895
3641
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3896
3642
|
return null;
|
|
3897
|
-
}, this.eventLogger = new
|
|
3643
|
+
}, this.eventLogger = new He({
|
|
3898
3644
|
maxBatchSize: 15,
|
|
3899
3645
|
intervalDurationMs: 800,
|
|
3900
3646
|
logEventURL: this.buildSDKUrl("/events")
|
|
3901
3647
|
});
|
|
3902
3648
|
}
|
|
3903
|
-
_createClass(
|
|
3649
|
+
_createClass(ht, [{
|
|
3904
3650
|
key: "logEvent",
|
|
3905
3651
|
value: function logEvent(_ref) {
|
|
3906
3652
|
var e = _ref.name,
|
|
@@ -3920,9 +3666,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3920
3666
|
key: "createTelemetryBlob",
|
|
3921
3667
|
value: function createTelemetryBlob() {
|
|
3922
3668
|
return Object.assign(Object.assign({
|
|
3923
|
-
event_id: "event-id-".concat(
|
|
3924
|
-
app_session_id: "app-session-id-".concat(
|
|
3925
|
-
persistent_id: "persistent-id-".concat(
|
|
3669
|
+
event_id: "event-id-".concat(De()),
|
|
3670
|
+
app_session_id: "app-session-id-".concat(De()),
|
|
3671
|
+
persistent_id: "persistent-id-".concat(De()),
|
|
3926
3672
|
client_sent_at: new Date().toISOString(),
|
|
3927
3673
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3928
3674
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3931,7 +3677,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
3931
3677
|
},
|
|
3932
3678
|
sdk: {
|
|
3933
3679
|
identifier: "Stytch.js Javascript SDK",
|
|
3934
|
-
version: "4.5.
|
|
3680
|
+
version: "4.5.5"
|
|
3935
3681
|
}
|
|
3936
3682
|
});
|
|
3937
3683
|
}
|
|
@@ -3942,13 +3688,13 @@ var vt = /*#__PURE__*/function () {
|
|
|
3942
3688
|
t = _ref2.body,
|
|
3943
3689
|
r = _ref2.errorMessage,
|
|
3944
3690
|
n = _ref2.method;
|
|
3945
|
-
return
|
|
3691
|
+
return lt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3946
3692
|
var i, o, s, a;
|
|
3947
|
-
return _regeneratorRuntime().wrap(function
|
|
3948
|
-
while (1) switch (
|
|
3693
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3694
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3949
3695
|
case 0:
|
|
3950
3696
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, o = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3951
|
-
return
|
|
3697
|
+
return _context3.abrupt("return", xe({
|
|
3952
3698
|
basicAuthHeader: o,
|
|
3953
3699
|
body: t,
|
|
3954
3700
|
errorMessage: r,
|
|
@@ -3959,9 +3705,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3959
3705
|
}));
|
|
3960
3706
|
case 2:
|
|
3961
3707
|
case "end":
|
|
3962
|
-
return
|
|
3708
|
+
return _context3.stop();
|
|
3963
3709
|
}
|
|
3964
|
-
},
|
|
3710
|
+
}, _callee3, this);
|
|
3965
3711
|
}));
|
|
3966
3712
|
}
|
|
3967
3713
|
}, {
|
|
@@ -3972,13 +3718,13 @@ var vt = /*#__PURE__*/function () {
|
|
|
3972
3718
|
r = _ref3.errorMessage,
|
|
3973
3719
|
n = _ref3.method,
|
|
3974
3720
|
i = _ref3.retryCallback;
|
|
3975
|
-
return
|
|
3721
|
+
return lt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3976
3722
|
var o, s, a, c;
|
|
3977
|
-
return _regeneratorRuntime().wrap(function
|
|
3978
|
-
while (1) switch (
|
|
3723
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3724
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3979
3725
|
case 0:
|
|
3980
3726
|
o = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (o || this._publicToken)), a = window.btoa(JSON.stringify(this.createTelemetryBlob())), c = window.location.origin;
|
|
3981
|
-
return
|
|
3727
|
+
return _context4.abrupt("return", function (e) {
|
|
3982
3728
|
var t = e.method,
|
|
3983
3729
|
r = e.errorMessage,
|
|
3984
3730
|
n = e.finalURL,
|
|
@@ -3987,9 +3733,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3987
3733
|
s = e.xSDKParentHostHeader,
|
|
3988
3734
|
a = e.body,
|
|
3989
3735
|
c = e.retryCallback;
|
|
3990
|
-
return
|
|
3736
|
+
return ye(this, void 0, void 0, le().mark(function e() {
|
|
3991
3737
|
var u;
|
|
3992
|
-
return
|
|
3738
|
+
return le().wrap(function (e) {
|
|
3993
3739
|
for (;;) switch (e.prev = e.next) {
|
|
3994
3740
|
case 0:
|
|
3995
3741
|
return u = {
|
|
@@ -4000,18 +3746,18 @@ var vt = /*#__PURE__*/function () {
|
|
|
4000
3746
|
xSDKClientHeader: o,
|
|
4001
3747
|
xSDKParentHostHeader: s,
|
|
4002
3748
|
body: a
|
|
4003
|
-
}, e.prev = 1, e.next = 4,
|
|
3749
|
+
}, e.prev = 1, e.next = 4, xe(u);
|
|
4004
3750
|
case 4:
|
|
4005
3751
|
case 15:
|
|
4006
3752
|
return e.abrupt("return", e.sent);
|
|
4007
3753
|
case 7:
|
|
4008
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3754
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Se)) {
|
|
4009
3755
|
e.next = 16;
|
|
4010
3756
|
break;
|
|
4011
3757
|
}
|
|
4012
3758
|
return e.next = 12, c(e.t0, u);
|
|
4013
3759
|
case 12:
|
|
4014
|
-
return u = e.sent, e.next = 15,
|
|
3760
|
+
return u = e.sent, e.next = 15, xe(u);
|
|
4015
3761
|
case 16:
|
|
4016
3762
|
throw e.t0;
|
|
4017
3763
|
case 17:
|
|
@@ -4032,9 +3778,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
4032
3778
|
}));
|
|
4033
3779
|
case 2:
|
|
4034
3780
|
case "end":
|
|
4035
|
-
return
|
|
3781
|
+
return _context4.stop();
|
|
4036
3782
|
}
|
|
4037
|
-
},
|
|
3783
|
+
}, _callee4, this);
|
|
4038
3784
|
}));
|
|
4039
3785
|
}
|
|
4040
3786
|
}, {
|
|
@@ -4043,18 +3789,18 @@ var vt = /*#__PURE__*/function () {
|
|
|
4043
3789
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4044
3790
|
}
|
|
4045
3791
|
}]);
|
|
4046
|
-
return
|
|
3792
|
+
return ht;
|
|
4047
3793
|
}();
|
|
4048
|
-
function
|
|
3794
|
+
function pt(e) {
|
|
4049
3795
|
var t = e.toString(16);
|
|
4050
3796
|
return 1 === t.length && (t = "0" + t), t;
|
|
4051
3797
|
}
|
|
4052
|
-
var
|
|
4053
|
-
function
|
|
4054
|
-
_classCallCheck(this,
|
|
3798
|
+
var _t = /*#__PURE__*/function () {
|
|
3799
|
+
function _t(e, t) {
|
|
3800
|
+
_classCallCheck(this, _t);
|
|
4055
3801
|
this._dataLayer = e, this.namespace = t;
|
|
4056
3802
|
}
|
|
4057
|
-
_createClass(
|
|
3803
|
+
_createClass(_t, [{
|
|
4058
3804
|
key: "key",
|
|
4059
3805
|
value: function key() {
|
|
4060
3806
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4062,21 +3808,21 @@ var gt = /*#__PURE__*/function () {
|
|
|
4062
3808
|
}, {
|
|
4063
3809
|
key: "startPKCETransaction",
|
|
4064
3810
|
value: function startPKCETransaction() {
|
|
4065
|
-
return
|
|
3811
|
+
return lt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4066
3812
|
var e;
|
|
4067
|
-
return _regeneratorRuntime().wrap(function
|
|
4068
|
-
while (1) switch (
|
|
3813
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3814
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
4069
3815
|
case 0:
|
|
4070
|
-
|
|
4071
|
-
return
|
|
3816
|
+
_context5.next = 2;
|
|
3817
|
+
return _t.createProofkeyPair();
|
|
4072
3818
|
case 2:
|
|
4073
|
-
e =
|
|
4074
|
-
return
|
|
3819
|
+
e = _context5.sent;
|
|
3820
|
+
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
4075
3821
|
case 4:
|
|
4076
3822
|
case "end":
|
|
4077
|
-
return
|
|
3823
|
+
return _context5.stop();
|
|
4078
3824
|
}
|
|
4079
|
-
},
|
|
3825
|
+
}, _callee5, this);
|
|
4080
3826
|
}));
|
|
4081
3827
|
}
|
|
4082
3828
|
}, {
|
|
@@ -4086,7 +3832,7 @@ var gt = /*#__PURE__*/function () {
|
|
|
4086
3832
|
if (null !== e) try {
|
|
4087
3833
|
return JSON.parse(e);
|
|
4088
3834
|
} catch (e) {
|
|
4089
|
-
return void
|
|
3835
|
+
return void Be("Found malformed Proof Key pair in localstorage.");
|
|
4090
3836
|
}
|
|
4091
3837
|
}
|
|
4092
3838
|
}, {
|
|
@@ -4097,39 +3843,39 @@ var gt = /*#__PURE__*/function () {
|
|
|
4097
3843
|
}], [{
|
|
4098
3844
|
key: "createProofkeyPair",
|
|
4099
3845
|
value: function createProofkeyPair() {
|
|
4100
|
-
return
|
|
3846
|
+
return lt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4101
3847
|
var _String$fromCharCode;
|
|
4102
3848
|
var e, t, r, n;
|
|
4103
|
-
return _regeneratorRuntime().wrap(function
|
|
4104
|
-
while (1) switch (
|
|
3849
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3850
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4105
3851
|
case 0:
|
|
4106
3852
|
e = new Uint32Array(16);
|
|
4107
3853
|
window.crypto.getRandomValues(e);
|
|
4108
|
-
t = Array.from(e).map(
|
|
4109
|
-
|
|
3854
|
+
t = Array.from(e).map(pt).join("");
|
|
3855
|
+
_context6.next = 5;
|
|
4110
3856
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4111
3857
|
case 5:
|
|
4112
|
-
r =
|
|
4113
|
-
return
|
|
3858
|
+
r = _context6.sent;
|
|
3859
|
+
return _context6.abrupt("return", {
|
|
4114
3860
|
code_challenge: (n = r, btoa((_String$fromCharCode = String.fromCharCode).call.apply(_String$fromCharCode, [null].concat(_toConsumableArray(new Uint8Array(n))))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")),
|
|
4115
3861
|
code_verifier: t
|
|
4116
3862
|
});
|
|
4117
3863
|
case 7:
|
|
4118
3864
|
case "end":
|
|
4119
|
-
return
|
|
3865
|
+
return _context6.stop();
|
|
4120
3866
|
}
|
|
4121
|
-
},
|
|
3867
|
+
}, _callee6);
|
|
4122
3868
|
}));
|
|
4123
3869
|
}
|
|
4124
3870
|
}]);
|
|
4125
|
-
return
|
|
3871
|
+
return _t;
|
|
4126
3872
|
}();
|
|
4127
|
-
var
|
|
4128
|
-
function
|
|
4129
|
-
_classCallCheck(this,
|
|
3873
|
+
var ft = /*#__PURE__*/function () {
|
|
3874
|
+
function ft(e) {
|
|
3875
|
+
_classCallCheck(this, ft);
|
|
4130
3876
|
this._networkClient = e;
|
|
4131
3877
|
}
|
|
4132
|
-
_createClass(
|
|
3878
|
+
_createClass(ft, [{
|
|
4133
3879
|
key: "searchUser",
|
|
4134
3880
|
value: function searchUser(e) {
|
|
4135
3881
|
return this._networkClient.fetchSDK({
|
|
@@ -4167,9 +3913,9 @@ var yt = /*#__PURE__*/function () {
|
|
|
4167
3913
|
});
|
|
4168
3914
|
}
|
|
4169
3915
|
}]);
|
|
4170
|
-
return
|
|
3916
|
+
return ft;
|
|
4171
3917
|
}();
|
|
4172
|
-
var
|
|
3918
|
+
var mt = function mt(e) {
|
|
4173
3919
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4174
3920
|
var _t$split = t.split("="),
|
|
4175
3921
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4178,17 +3924,17 @@ var kt = function kt(e) {
|
|
|
4178
3924
|
}).length > 1;
|
|
4179
3925
|
};
|
|
4180
3926
|
/*! js-cookie v3.0.1 | MIT */
|
|
4181
|
-
function
|
|
3927
|
+
function vt(e) {
|
|
4182
3928
|
for (var t = 1; t < arguments.length; t++) {
|
|
4183
3929
|
var r = arguments[t];
|
|
4184
3930
|
for (var n in r) e[n] = r[n];
|
|
4185
3931
|
}
|
|
4186
3932
|
return e;
|
|
4187
3933
|
}
|
|
4188
|
-
var
|
|
3934
|
+
var bt = function e(t, r) {
|
|
4189
3935
|
function n(e, n, i) {
|
|
4190
3936
|
if ("undefined" != typeof document) {
|
|
4191
|
-
"number" == typeof (i =
|
|
3937
|
+
"number" == typeof (i = vt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
4192
3938
|
var o = "";
|
|
4193
3939
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4194
3940
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4210,15 +3956,15 @@ var St = function e(t, r) {
|
|
|
4210
3956
|
}
|
|
4211
3957
|
},
|
|
4212
3958
|
remove: function remove(e, t) {
|
|
4213
|
-
n(e, "",
|
|
3959
|
+
n(e, "", vt({}, t, {
|
|
4214
3960
|
expires: -1
|
|
4215
3961
|
}));
|
|
4216
3962
|
},
|
|
4217
3963
|
withAttributes: function withAttributes(t) {
|
|
4218
|
-
return e(this.converter,
|
|
3964
|
+
return e(this.converter, vt({}, this.attributes, t));
|
|
4219
3965
|
},
|
|
4220
3966
|
withConverter: function withConverter(t) {
|
|
4221
|
-
return e(
|
|
3967
|
+
return e(vt({}, this.converter, t), this.attributes);
|
|
4222
3968
|
}
|
|
4223
3969
|
}, {
|
|
4224
3970
|
attributes: {
|
|
@@ -4238,37 +3984,37 @@ var St = function e(t, r) {
|
|
|
4238
3984
|
}, {
|
|
4239
3985
|
path: "/"
|
|
4240
3986
|
});
|
|
4241
|
-
var
|
|
3987
|
+
var gt = function gt(e) {
|
|
4242
3988
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4243
3989
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4244
3990
|
},
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
clearTimeout(
|
|
3991
|
+
kt = new Map(),
|
|
3992
|
+
yt = function yt(e) {
|
|
3993
|
+
clearTimeout(kt.get(e));
|
|
4248
3994
|
},
|
|
4249
|
-
|
|
4250
|
-
|
|
3995
|
+
wt = function wt(e, t, r) {
|
|
3996
|
+
yt(e);
|
|
4251
3997
|
var n = setTimeout(function () {
|
|
4252
|
-
void 0 ===
|
|
3998
|
+
void 0 === bt.get(e) && bt.set(e, t, r);
|
|
4253
3999
|
}, 10);
|
|
4254
|
-
return
|
|
4000
|
+
return kt.set(e, n), bt.set(e, t, r);
|
|
4255
4001
|
};
|
|
4256
|
-
var
|
|
4257
|
-
function
|
|
4258
|
-
var
|
|
4259
|
-
_classCallCheck(this,
|
|
4002
|
+
var St = /*#__PURE__*/function () {
|
|
4003
|
+
function St(e, t) {
|
|
4004
|
+
var _this3 = this;
|
|
4005
|
+
_classCallCheck(this, St);
|
|
4260
4006
|
this.browserSessionStorage = {
|
|
4261
4007
|
getItem: function getItem(e) {
|
|
4262
|
-
return sessionStorage.getItem(
|
|
4008
|
+
return sessionStorage.getItem(gt(_this3.publicToken, e));
|
|
4263
4009
|
},
|
|
4264
4010
|
setItem: function setItem(e, t) {
|
|
4265
|
-
return sessionStorage.setItem(
|
|
4011
|
+
return sessionStorage.setItem(gt(_this3.publicToken, e), t);
|
|
4266
4012
|
},
|
|
4267
4013
|
removeItem: function removeItem(e) {
|
|
4268
|
-
return sessionStorage.removeItem(
|
|
4014
|
+
return sessionStorage.removeItem(gt(_this3.publicToken, e));
|
|
4269
4015
|
}
|
|
4270
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4271
|
-
var r = localStorage.getItem(
|
|
4016
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ue("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4017
|
+
var r = localStorage.getItem(gt(this.publicToken));
|
|
4272
4018
|
if (!r) return;
|
|
4273
4019
|
var n;
|
|
4274
4020
|
try {
|
|
@@ -4278,7 +4024,7 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4278
4024
|
}
|
|
4279
4025
|
this.state = n;
|
|
4280
4026
|
}
|
|
4281
|
-
_createClass(
|
|
4027
|
+
_createClass(St, [{
|
|
4282
4028
|
key: "opaqueTokenCookieName",
|
|
4283
4029
|
get: function get() {
|
|
4284
4030
|
var e;
|
|
@@ -4300,14 +4046,14 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4300
4046
|
key: "readSessionCookie",
|
|
4301
4047
|
value: function readSessionCookie() {
|
|
4302
4048
|
return {
|
|
4303
|
-
session_token:
|
|
4304
|
-
session_jwt:
|
|
4049
|
+
session_token: bt.get(this.opaqueTokenCookieName),
|
|
4050
|
+
session_jwt: bt.get(this.jwtCookieName)
|
|
4305
4051
|
};
|
|
4306
4052
|
}
|
|
4307
4053
|
}, {
|
|
4308
4054
|
key: "readIntermediateSessionTokenCookie",
|
|
4309
4055
|
value: function readIntermediateSessionTokenCookie() {
|
|
4310
|
-
return
|
|
4056
|
+
return bt.get(this.istCookieName);
|
|
4311
4057
|
}
|
|
4312
4058
|
}, {
|
|
4313
4059
|
key: "writeSessionCookie",
|
|
@@ -4316,32 +4062,32 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4316
4062
|
var o = e.state,
|
|
4317
4063
|
s = e.session_token,
|
|
4318
4064
|
a = e.session_jwt,
|
|
4319
|
-
c =
|
|
4065
|
+
c = St.generateCookieOpts({
|
|
4320
4066
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4321
4067
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4322
4068
|
path: this._cookiePath,
|
|
4323
4069
|
domain: this._domain
|
|
4324
4070
|
});
|
|
4325
|
-
|
|
4326
|
-
var u =
|
|
4071
|
+
wt(this.opaqueTokenCookieName, s, c), wt(this.jwtCookieName, a, c);
|
|
4072
|
+
var u = St.generateCookieOpts({
|
|
4327
4073
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4328
4074
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4329
4075
|
path: this._cookiePath,
|
|
4330
4076
|
domain: this._domain
|
|
4331
4077
|
});
|
|
4332
|
-
|
|
4078
|
+
mt(this.jwtCookieName) && bt.remove(this.jwtCookieName, u), mt(this.opaqueTokenCookieName) && bt.remove(this.opaqueTokenCookieName, u), mt(this.jwtCookieName) && Be("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), mt(this.opaqueTokenCookieName) && Be("Could not remove extraneous opaque token cookie.");
|
|
4333
4079
|
}
|
|
4334
4080
|
}, {
|
|
4335
4081
|
key: "writeIntermediateSessionTokenCookie",
|
|
4336
4082
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4337
4083
|
var t = new Date(Date.now() + 6e5),
|
|
4338
|
-
r =
|
|
4084
|
+
r = St.generateCookieOpts({
|
|
4339
4085
|
expiresAt: t.toString(),
|
|
4340
4086
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4341
4087
|
path: this._cookiePath,
|
|
4342
4088
|
domain: this._domain
|
|
4343
4089
|
});
|
|
4344
|
-
|
|
4090
|
+
wt(this.istCookieName, e, r);
|
|
4345
4091
|
}
|
|
4346
4092
|
}, {
|
|
4347
4093
|
key: "removeSessionCookie",
|
|
@@ -4356,50 +4102,50 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4356
4102
|
}, {
|
|
4357
4103
|
key: "removeCookies",
|
|
4358
4104
|
value: function removeCookies(e) {
|
|
4359
|
-
var
|
|
4105
|
+
var _this4 = this;
|
|
4360
4106
|
[!0, !1].forEach(function (t) {
|
|
4361
|
-
[
|
|
4362
|
-
[
|
|
4363
|
-
var i =
|
|
4107
|
+
[_this4._cookiePath, null].forEach(function (r) {
|
|
4108
|
+
[_this4._domain, null].forEach(function (n) {
|
|
4109
|
+
var i = St.generateCookieOpts({
|
|
4364
4110
|
expiresAt: new Date(0).toString(),
|
|
4365
4111
|
availableToSubdomains: t,
|
|
4366
4112
|
path: r,
|
|
4367
4113
|
domain: n
|
|
4368
4114
|
});
|
|
4369
4115
|
e.forEach(function (e) {
|
|
4370
|
-
|
|
4116
|
+
bt.remove(e, i);
|
|
4371
4117
|
});
|
|
4372
4118
|
});
|
|
4373
4119
|
});
|
|
4374
|
-
}), e.forEach(
|
|
4120
|
+
}), e.forEach(yt);
|
|
4375
4121
|
}
|
|
4376
4122
|
}, {
|
|
4377
4123
|
key: "syncToLocalStorage",
|
|
4378
4124
|
value: function syncToLocalStorage() {
|
|
4379
|
-
localStorage.setItem(
|
|
4125
|
+
localStorage.setItem(gt(this.publicToken), JSON.stringify(this.state));
|
|
4380
4126
|
}
|
|
4381
4127
|
}, {
|
|
4382
4128
|
key: "getItem",
|
|
4383
4129
|
value: function getItem(e) {
|
|
4384
|
-
return localStorage.getItem(
|
|
4130
|
+
return localStorage.getItem(gt(this.publicToken, e));
|
|
4385
4131
|
}
|
|
4386
4132
|
}, {
|
|
4387
4133
|
key: "setItem",
|
|
4388
4134
|
value: function setItem(e, t) {
|
|
4389
|
-
return localStorage.setItem(
|
|
4135
|
+
return localStorage.setItem(gt(this.publicToken, e), t);
|
|
4390
4136
|
}
|
|
4391
4137
|
}, {
|
|
4392
4138
|
key: "removeItem",
|
|
4393
4139
|
value: function removeItem(e) {
|
|
4394
|
-
return localStorage.removeItem(
|
|
4140
|
+
return localStorage.removeItem(gt(this.publicToken, e));
|
|
4395
4141
|
}
|
|
4396
4142
|
}, {
|
|
4397
4143
|
key: "markStateKeysUpdated",
|
|
4398
4144
|
value: function markStateKeysUpdated(e) {
|
|
4399
|
-
var
|
|
4145
|
+
var _this5 = this;
|
|
4400
4146
|
var t = this.stateKeysUpdated.size;
|
|
4401
4147
|
return e.forEach(function (e) {
|
|
4402
|
-
return
|
|
4148
|
+
return _this5.stateKeysUpdated.add(e);
|
|
4403
4149
|
}), t !== this.stateKeysUpdated.size;
|
|
4404
4150
|
}
|
|
4405
4151
|
}], [{
|
|
@@ -4416,40 +4162,40 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4416
4162
|
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;
|
|
4417
4163
|
}
|
|
4418
4164
|
}]);
|
|
4419
|
-
return
|
|
4165
|
+
return St;
|
|
4420
4166
|
}();
|
|
4421
|
-
var
|
|
4422
|
-
_inherits(
|
|
4423
|
-
function
|
|
4424
|
-
_classCallCheck(this,
|
|
4425
|
-
return _callSuper(this,
|
|
4167
|
+
var xt = /*#__PURE__*/function (_St) {
|
|
4168
|
+
_inherits(xt, _St);
|
|
4169
|
+
function xt() {
|
|
4170
|
+
_classCallCheck(this, xt);
|
|
4171
|
+
return _callSuper(this, xt, arguments);
|
|
4426
4172
|
}
|
|
4427
|
-
return _createClass(
|
|
4428
|
-
}(
|
|
4429
|
-
var
|
|
4430
|
-
|
|
4173
|
+
return _createClass(xt);
|
|
4174
|
+
}(St);
|
|
4175
|
+
var Pt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4176
|
+
Ct = function Ct(e, t) {
|
|
4431
4177
|
var r = function () {
|
|
4432
4178
|
var e = window;
|
|
4433
|
-
return e[
|
|
4179
|
+
return e[Pt] || (e[Pt] = {}), e[Pt];
|
|
4434
4180
|
}();
|
|
4435
|
-
return r[e] || (r[e] = new
|
|
4181
|
+
return r[e] || (r[e] = new xt(e, t)), r[e];
|
|
4436
4182
|
},
|
|
4437
|
-
|
|
4183
|
+
Ot = function Ot(e, t) {
|
|
4438
4184
|
Object.values(e).forEach(function (e) {
|
|
4439
4185
|
return e(t);
|
|
4440
4186
|
});
|
|
4441
4187
|
},
|
|
4442
|
-
|
|
4188
|
+
Tt = function () {
|
|
4443
4189
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4444
4190
|
t = void 0 === e ? [] : e;
|
|
4445
4191
|
return function e(r, n) {
|
|
4446
|
-
return
|
|
4192
|
+
return ue(r) === ue(n) && (null === r || null === n ? r === n : "object" === ue(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4447
4193
|
return !(e in n);
|
|
4448
4194
|
}) && Object.entries(r).filter(function (e) {
|
|
4449
|
-
var r =
|
|
4195
|
+
var r = se(e, 1)[0];
|
|
4450
4196
|
return !t.includes(r);
|
|
4451
4197
|
}).every(function (t) {
|
|
4452
|
-
var r =
|
|
4198
|
+
var r = se(t, 2),
|
|
4453
4199
|
i = r[0],
|
|
4454
4200
|
o = r[1];
|
|
4455
4201
|
return e(o, n[i]);
|
|
@@ -4458,20 +4204,20 @@ var xt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4458
4204
|
}({
|
|
4459
4205
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4460
4206
|
});
|
|
4461
|
-
var
|
|
4462
|
-
function
|
|
4463
|
-
var
|
|
4464
|
-
_classCallCheck(this,
|
|
4207
|
+
var At = /*#__PURE__*/function () {
|
|
4208
|
+
function At(e, t) {
|
|
4209
|
+
var _this6 = this;
|
|
4210
|
+
_classCallCheck(this, At);
|
|
4465
4211
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4466
|
-
if (e.key !==
|
|
4212
|
+
if (e.key !== gt(_this6._publicToken)) return;
|
|
4467
4213
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4468
|
-
|
|
4214
|
+
_this6.updateState(t);
|
|
4469
4215
|
}, window.addEventListener("storage", this._listen);
|
|
4470
4216
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4471
4217
|
r = _this$_datalayer$read.session_token;
|
|
4472
4218
|
r || this.destroySession();
|
|
4473
4219
|
}
|
|
4474
|
-
_createClass(
|
|
4220
|
+
_createClass(At, [{
|
|
4475
4221
|
key: "getTokens",
|
|
4476
4222
|
value: function getTokens() {
|
|
4477
4223
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4509,7 +4255,7 @@ var Rt = /*#__PURE__*/function () {
|
|
|
4509
4255
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4510
4256
|
this._datalayer.state = r;
|
|
4511
4257
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4512
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4258
|
+
!this._datalayer.markStateKeysUpdated(n) && Tt(t, r) || Ot(this._datalayer.subscriptions, r);
|
|
4513
4259
|
}
|
|
4514
4260
|
}, {
|
|
4515
4261
|
key: "updateStateAndTokens",
|
|
@@ -4524,8 +4270,8 @@ var Rt = /*#__PURE__*/function () {
|
|
|
4524
4270
|
this._datalayer.state = r;
|
|
4525
4271
|
var n = e ? Object.keys(e) : [],
|
|
4526
4272
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4527
|
-
o = !
|
|
4528
|
-
(i || o) && (
|
|
4273
|
+
o = !Tt(t, r);
|
|
4274
|
+
(i || o) && (Ot(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4529
4275
|
}
|
|
4530
4276
|
}, {
|
|
4531
4277
|
key: "updateTokens",
|
|
@@ -4565,44 +4311,44 @@ var Rt = /*#__PURE__*/function () {
|
|
|
4565
4311
|
return null;
|
|
4566
4312
|
}
|
|
4567
4313
|
}]);
|
|
4568
|
-
return
|
|
4314
|
+
return At;
|
|
4569
4315
|
}();
|
|
4570
|
-
var
|
|
4571
|
-
_inherits(
|
|
4572
|
-
function
|
|
4573
|
-
var
|
|
4574
|
-
_classCallCheck(this,
|
|
4575
|
-
|
|
4576
|
-
return
|
|
4316
|
+
var Et = /*#__PURE__*/function (_At) {
|
|
4317
|
+
_inherits(Et, _At);
|
|
4318
|
+
function Et() {
|
|
4319
|
+
var _this7;
|
|
4320
|
+
_classCallCheck(this, Et);
|
|
4321
|
+
_this7 = _callSuper(this, Et, arguments), _this7.updateMember = function (e) {
|
|
4322
|
+
return _this7.updateState({
|
|
4577
4323
|
member: e
|
|
4578
4324
|
});
|
|
4579
|
-
},
|
|
4325
|
+
}, _this7.getMember = function () {
|
|
4580
4326
|
var e, t;
|
|
4581
|
-
return null !== (t = null === (e =
|
|
4582
|
-
},
|
|
4583
|
-
return
|
|
4327
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4328
|
+
}, _this7.updateOrganization = function (e) {
|
|
4329
|
+
return _this7.updateState({
|
|
4584
4330
|
organization: e
|
|
4585
4331
|
});
|
|
4586
|
-
},
|
|
4332
|
+
}, _this7.getOrganization = function () {
|
|
4587
4333
|
var e, t;
|
|
4588
|
-
return null !== (t = null === (e =
|
|
4589
|
-
},
|
|
4334
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4335
|
+
}, _this7.getSession = function () {
|
|
4590
4336
|
var e, t;
|
|
4591
|
-
return null !== (t = null === (e =
|
|
4337
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4592
4338
|
};
|
|
4593
|
-
return
|
|
4339
|
+
return _this7;
|
|
4594
4340
|
}
|
|
4595
|
-
return _createClass(
|
|
4596
|
-
}(
|
|
4597
|
-
var
|
|
4598
|
-
exports.BiometricsFailedError =
|
|
4341
|
+
return _createClass(Et);
|
|
4342
|
+
}(At);
|
|
4343
|
+
var Dt = Symbol["for"]("stytch__internal_b2b");
|
|
4344
|
+
exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, exports.ChallengeSigningFailedError = G, exports.DeviceCredentialsNotAllowedError = z, exports.FailedCodeChallengeError = Y, exports.FailedToDecryptDataError = $, exports.InternalError = I, exports.InvalidAuthorizationCredentialError = W, exports.InvalidCredentialTypeError = te, exports.InvalidRedirectSchemeError = Q, exports.InvalidStartUrlError = Z, exports.JSONDataNotConvertibleToStringError = ne, exports.KeyInvalidatedError = R, exports.KeystoreUnavailableError = M, exports.MissingAttestationObjectError = re, exports.MissingAuthorizationCredentialIDTokenError = q, exports.MissingGoogleClientIDError = N, exports.MissingPKCEError = U, exports.MissingPublicKeyError = H, exports.MissingUrlError = ee, exports.NoBiometricsEnrolledError = L, exports.NoBiometricsRegistrationError = F, exports.NoCurrentSessionError = D, exports.PasskeysInvalidEncoding = oe, exports.PasskeysUnsupportedError = J, exports.RandomNumberGenerationFailed = ie, exports.SDKAPIUnreachableError = y, exports.SDKNotConfiguredError = V, exports.StytchAPIError = A, exports.StytchAPISchemaError = T, exports.StytchAPIUnreachableError = O, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
|
|
4599
4345
|
function _class(e, t) {
|
|
4600
|
-
var
|
|
4346
|
+
var _this8 = this;
|
|
4601
4347
|
_classCallCheck(this, _class);
|
|
4602
4348
|
var r;
|
|
4603
4349
|
!function (e) {
|
|
4604
4350
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
|
|
4605
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4351
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Be("Public token is malformed. Expected a string, got ".concat(ue(r), ".").concat(ze)) : "" === r ? Be('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(ze)) : r.startsWith("public-token-") || Be('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(ze));
|
|
4606
4352
|
var n = t,
|
|
4607
4353
|
i = {
|
|
4608
4354
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4615,28 +4361,28 @@ exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, expor
|
|
|
4615
4361
|
}
|
|
4616
4362
|
};
|
|
4617
4363
|
var o, s, a, c, u, l, d, h, p, _, f;
|
|
4618
|
-
this._dataLayer =
|
|
4619
|
-
var m = new
|
|
4620
|
-
this._networkClient = new
|
|
4364
|
+
this._dataLayer = Ct(e, n), this._subscriptionService = new Et(e, this._dataLayer);
|
|
4365
|
+
var m = new _t(this._dataLayer, "passwords");
|
|
4366
|
+
this._networkClient = new ht(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4621
4367
|
var e, t, r, n;
|
|
4622
4368
|
return {
|
|
4623
|
-
stytch_member_id: null === (t = null === (e =
|
|
4624
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4369
|
+
stytch_member_id: null === (t = null === (e = _this8._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4370
|
+
stytch_member_session_id: null === (n = null === (r = _this8._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4625
4371
|
};
|
|
4626
4372
|
});
|
|
4627
|
-
var v = new
|
|
4628
|
-
b = new
|
|
4629
|
-
g = new
|
|
4630
|
-
this.organization = new
|
|
4373
|
+
var v = new ut(e, this._networkClient, this._dataLayer),
|
|
4374
|
+
b = new dt(v.getAsync()),
|
|
4375
|
+
g = new qe(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
4376
|
+
this.organization = new $e(this._networkClient, this._subscriptionService), this.member = new Ye(this._networkClient, this._subscriptionService), this.self = new Ye(this._networkClient, this._subscriptionService), this.session = new Ze(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new _t(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Xe(this._networkClient, this._subscriptionService, new _t(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4631
4377
|
publicToken: e,
|
|
4632
4378
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4633
4379
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4634
|
-
}, g), this.sso = new
|
|
4380
|
+
}, g), this.sso = new Je(this._networkClient, this._subscriptionService, new _t(this._dataLayer, "sso"), v.getAsync(), {
|
|
4635
4381
|
publicToken: e,
|
|
4636
4382
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4637
4383
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4638
|
-
}), this.discovery = new
|
|
4639
|
-
var
|
|
4384
|
+
}), this.discovery = new Qe(this._networkClient, this._subscriptionService), this.passwords = new tt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new rt(this._networkClient, this._subscriptionService, g), this.totp = new nt(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new it(this._networkClient, this._subscriptionService, g), this.rbac = new ot(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new st(this._subscriptionService, this.session);
|
|
4385
|
+
var k = new ft(this._networkClient);
|
|
4640
4386
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4641
4387
|
name: "b2b_sdk_instance_instantiated",
|
|
4642
4388
|
details: {
|
|
@@ -4646,80 +4392,80 @@ exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, expor
|
|
|
4646
4392
|
}
|
|
4647
4393
|
});
|
|
4648
4394
|
(function (e, t) {
|
|
4649
|
-
Object.assign(e, _defineProperty({},
|
|
4395
|
+
Object.assign(e, _defineProperty({}, Dt, t));
|
|
4650
4396
|
})(this, {
|
|
4651
4397
|
bootstrap: v,
|
|
4652
4398
|
publicToken: e,
|
|
4653
|
-
searchManager:
|
|
4399
|
+
searchManager: k,
|
|
4654
4400
|
dataLayer: this._dataLayer,
|
|
4655
4401
|
networkClient: this._networkClient
|
|
4656
4402
|
});
|
|
4657
4403
|
}
|
|
4658
4404
|
return _createClass(_class);
|
|
4659
|
-
}(), exports.StytchError =
|
|
4405
|
+
}(), exports.StytchError = C, exports.StytchSDKAPIError = x, exports.StytchSDKError = E, exports.StytchSDKSchemaError = S, exports.StytchSDKUsageError = w, exports.UNRECOVERABLE_ERROR_TYPES = P, exports.UserCancellationError = B, exports.UserLockedOutError = K, exports.errorToStytchError = function (e) {
|
|
4660
4406
|
switch (e.message) {
|
|
4661
4407
|
case "internal_error":
|
|
4662
|
-
return new
|
|
4408
|
+
return new I(e.message);
|
|
4663
4409
|
case "no_current_session":
|
|
4664
|
-
return new
|
|
4410
|
+
return new D();
|
|
4665
4411
|
case "no_biometrics_registration":
|
|
4666
|
-
return new
|
|
4412
|
+
return new F();
|
|
4667
4413
|
case "biometrics_unavailable":
|
|
4668
4414
|
case "device_hardware_error":
|
|
4669
4415
|
case "biometrics_not_available":
|
|
4670
|
-
return new
|
|
4416
|
+
return new j();
|
|
4671
4417
|
case "key_invalidated":
|
|
4672
4418
|
case "no_biometric_key":
|
|
4673
|
-
return new
|
|
4419
|
+
return new R();
|
|
4674
4420
|
case "no_biometrics_enrolled":
|
|
4675
|
-
return new
|
|
4421
|
+
return new L();
|
|
4676
4422
|
case "keystore_unavailable":
|
|
4677
|
-
return new
|
|
4423
|
+
return new M();
|
|
4678
4424
|
case "device_credentials_not_allowed":
|
|
4679
|
-
return new
|
|
4425
|
+
return new z();
|
|
4680
4426
|
case "user_cancellation":
|
|
4681
|
-
return new
|
|
4427
|
+
return new B();
|
|
4682
4428
|
case "user_locked_out":
|
|
4683
|
-
return new
|
|
4429
|
+
return new K();
|
|
4684
4430
|
case "google_onetap_missing_id_token":
|
|
4685
4431
|
case "oauth_apple_missing_id_token":
|
|
4686
4432
|
case "missing_authorization_credential_id_token":
|
|
4687
|
-
return new
|
|
4433
|
+
return new q();
|
|
4688
4434
|
case "google_onetap_missing_member":
|
|
4689
4435
|
case "oauth_apple_credential_invalid":
|
|
4690
4436
|
case "invalid_authorization_credential":
|
|
4691
|
-
return new
|
|
4437
|
+
return new W();
|
|
4692
4438
|
case "missing_public_key":
|
|
4693
|
-
return new
|
|
4439
|
+
return new H();
|
|
4694
4440
|
case "challenge_signing_failed":
|
|
4695
|
-
return new
|
|
4441
|
+
return new G();
|
|
4696
4442
|
case "sdk_not_configured":
|
|
4697
|
-
return new
|
|
4443
|
+
return new V();
|
|
4698
4444
|
case "failed_code_challenge":
|
|
4699
|
-
return new
|
|
4445
|
+
return new Y();
|
|
4700
4446
|
case "passkeys_unsupported":
|
|
4701
|
-
return new
|
|
4447
|
+
return new J();
|
|
4702
4448
|
case "failed_to_decrypt_data":
|
|
4703
|
-
return new
|
|
4449
|
+
return new $();
|
|
4704
4450
|
case "biometrics_failed":
|
|
4705
|
-
return new
|
|
4451
|
+
return new X();
|
|
4706
4452
|
case "invalid_start_url":
|
|
4707
|
-
return new
|
|
4453
|
+
return new Z();
|
|
4708
4454
|
case "invalid_redirect_scheme":
|
|
4709
|
-
return new
|
|
4455
|
+
return new Q();
|
|
4710
4456
|
case "missing_url":
|
|
4711
|
-
return new
|
|
4457
|
+
return new ee();
|
|
4712
4458
|
case "invalid_credential_type":
|
|
4713
|
-
return new
|
|
4459
|
+
return new te();
|
|
4714
4460
|
case "missing_attestation_object":
|
|
4715
|
-
return new
|
|
4461
|
+
return new re();
|
|
4716
4462
|
case "json_data_not_convertible_to_string":
|
|
4717
|
-
return new
|
|
4463
|
+
return new ne();
|
|
4718
4464
|
case "random_number_generation_failed":
|
|
4719
|
-
return new
|
|
4465
|
+
return new ie();
|
|
4720
4466
|
case "passkeys_invalid_encoding":
|
|
4721
|
-
return new
|
|
4467
|
+
return new oe();
|
|
4722
4468
|
default:
|
|
4723
|
-
return new
|
|
4469
|
+
return new E(e.name, e.message);
|
|
4724
4470
|
}
|
|
4725
4471
|
};
|