@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,31 +1,27 @@
|
|
|
1
1
|
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; }
|
|
2
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
3
|
+
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); }
|
|
4
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
5
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
6
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
7
|
+
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); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
2
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
10
|
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."); }
|
|
4
11
|
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; } }
|
|
5
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
14
|
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."); }
|
|
15
|
+
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); }
|
|
8
16
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
17
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
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; }
|
|
11
|
-
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; } } }; }
|
|
12
|
-
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); }
|
|
13
18
|
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
21
|
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); } }
|
|
15
22
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
24
|
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); }
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
-
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); }
|
|
21
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
-
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); }
|
|
23
|
-
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); }
|
|
24
|
-
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; }
|
|
25
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
-
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
27
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
25
|
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); }
|
|
30
26
|
function e(t) {
|
|
31
27
|
return e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
@@ -152,8 +148,8 @@ var h, p, _, f, m, v;
|
|
|
152
148
|
}(v || (v = {}));
|
|
153
149
|
var b,
|
|
154
150
|
g,
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
k,
|
|
152
|
+
y = function (e) {
|
|
157
153
|
function t(e, r) {
|
|
158
154
|
var n;
|
|
159
155
|
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;
|
|
@@ -178,7 +174,7 @@ var b,
|
|
|
178
174
|
}
|
|
179
175
|
return a(t, c(Error)), r(t);
|
|
180
176
|
}(),
|
|
181
|
-
|
|
177
|
+
C = function (e) {
|
|
182
178
|
function t(e) {
|
|
183
179
|
var r;
|
|
184
180
|
i(this, t), (r = o(this, t)).name = "StytchSDKAPIError";
|
|
@@ -191,20 +187,20 @@ var b,
|
|
|
191
187
|
}
|
|
192
188
|
return a(t, c(Error)), r(t);
|
|
193
189
|
}(),
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
P = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
191
|
+
T = function (e) {
|
|
196
192
|
function t(e, r) {
|
|
197
193
|
var n;
|
|
198
194
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
199
195
|
}
|
|
200
196
|
return a(t, c(Error)), r(t);
|
|
201
197
|
}(),
|
|
202
|
-
|
|
198
|
+
x = function (e) {
|
|
203
199
|
function t(e) {
|
|
204
200
|
var r;
|
|
205
201
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
206
202
|
}
|
|
207
|
-
return a(t,
|
|
203
|
+
return a(t, T), r(t);
|
|
208
204
|
}(),
|
|
209
205
|
O = function (e) {
|
|
210
206
|
function t(e) {
|
|
@@ -215,9 +211,9 @@ var b,
|
|
|
215
211
|
}).join("\n");
|
|
216
212
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
217
213
|
}
|
|
218
|
-
return a(t,
|
|
214
|
+
return a(t, T), r(t);
|
|
219
215
|
}(),
|
|
220
|
-
|
|
216
|
+
A = function (e) {
|
|
221
217
|
function t(e) {
|
|
222
218
|
var r;
|
|
223
219
|
i(this, t);
|
|
@@ -228,188 +224,188 @@ var b,
|
|
|
228
224
|
u = e.request_id;
|
|
229
225
|
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
226
|
}
|
|
231
|
-
return a(t,
|
|
227
|
+
return a(t, T), r(t);
|
|
232
228
|
}(),
|
|
233
|
-
|
|
229
|
+
E = function (e) {
|
|
234
230
|
function t(e, r, n) {
|
|
235
231
|
var s;
|
|
236
232
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
237
233
|
}
|
|
238
|
-
return a(t,
|
|
234
|
+
return a(t, T), r(t);
|
|
239
235
|
}(),
|
|
240
236
|
D = function (e) {
|
|
241
237
|
function t() {
|
|
242
238
|
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
239
|
}
|
|
244
|
-
return a(t,
|
|
240
|
+
return a(t, E), r(t);
|
|
245
241
|
}(),
|
|
246
242
|
I = function (e) {
|
|
247
243
|
function t(e) {
|
|
248
244
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
249
245
|
}
|
|
250
|
-
return a(t,
|
|
246
|
+
return a(t, E), r(t);
|
|
251
247
|
}(),
|
|
252
|
-
|
|
248
|
+
j = function (e) {
|
|
253
249
|
function t() {
|
|
254
250
|
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
251
|
}
|
|
256
|
-
return a(t,
|
|
252
|
+
return a(t, E), r(t);
|
|
257
253
|
}(),
|
|
258
|
-
|
|
254
|
+
F = function (e) {
|
|
259
255
|
function t() {
|
|
260
256
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
261
257
|
}
|
|
262
|
-
return a(t,
|
|
258
|
+
return a(t, E), r(t);
|
|
263
259
|
}(),
|
|
264
|
-
|
|
260
|
+
R = function (e) {
|
|
265
261
|
function t() {
|
|
266
262
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
267
263
|
}
|
|
268
|
-
return a(t,
|
|
264
|
+
return a(t, E), r(t);
|
|
269
265
|
}(),
|
|
270
|
-
|
|
266
|
+
L = function (e) {
|
|
271
267
|
function t() {
|
|
272
268
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
273
269
|
}
|
|
274
|
-
return a(t,
|
|
270
|
+
return a(t, E), r(t);
|
|
275
271
|
}(),
|
|
276
|
-
|
|
272
|
+
M = function (e) {
|
|
277
273
|
function t() {
|
|
278
274
|
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
275
|
}
|
|
280
|
-
return a(t,
|
|
276
|
+
return a(t, E), r(t);
|
|
281
277
|
}(),
|
|
282
|
-
|
|
278
|
+
B = function (e) {
|
|
283
279
|
function t() {
|
|
284
280
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
285
281
|
}
|
|
286
|
-
return a(t,
|
|
282
|
+
return a(t, E), r(t);
|
|
287
283
|
}(),
|
|
288
284
|
K = function (e) {
|
|
289
285
|
function t() {
|
|
290
286
|
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
287
|
}
|
|
292
|
-
return a(t,
|
|
288
|
+
return a(t, E), r(t);
|
|
293
289
|
}(),
|
|
294
|
-
|
|
290
|
+
z = function (e) {
|
|
295
291
|
function t() {
|
|
296
292
|
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
293
|
}
|
|
298
|
-
return a(t,
|
|
294
|
+
return a(t, E), r(t);
|
|
299
295
|
}(),
|
|
300
|
-
|
|
296
|
+
N = function (e) {
|
|
301
297
|
function t() {
|
|
302
298
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
303
299
|
}
|
|
304
|
-
return a(t,
|
|
300
|
+
return a(t, E), r(t);
|
|
305
301
|
}(),
|
|
306
302
|
U = function (e) {
|
|
307
303
|
function t() {
|
|
308
304
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
309
305
|
}
|
|
310
|
-
return a(t,
|
|
306
|
+
return a(t, E), r(t);
|
|
311
307
|
}(),
|
|
312
308
|
q = function (e) {
|
|
313
309
|
function t() {
|
|
314
310
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
315
311
|
}
|
|
316
|
-
return a(t,
|
|
312
|
+
return a(t, E), r(t);
|
|
317
313
|
}(),
|
|
318
314
|
W = function (e) {
|
|
319
315
|
function t() {
|
|
320
316
|
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
317
|
}
|
|
322
|
-
return a(t,
|
|
318
|
+
return a(t, E), r(t);
|
|
323
319
|
}(),
|
|
324
|
-
|
|
320
|
+
H = function (e) {
|
|
325
321
|
function t() {
|
|
326
322
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
327
323
|
}
|
|
328
|
-
return a(t,
|
|
324
|
+
return a(t, E), r(t);
|
|
329
325
|
}(),
|
|
330
|
-
|
|
326
|
+
G = function (e) {
|
|
331
327
|
function t() {
|
|
332
328
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
333
329
|
}
|
|
334
|
-
return a(t,
|
|
330
|
+
return a(t, E), r(t);
|
|
335
331
|
}(),
|
|
336
|
-
|
|
332
|
+
V = function (e) {
|
|
337
333
|
function t() {
|
|
338
334
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
339
335
|
}
|
|
340
|
-
return a(t,
|
|
336
|
+
return a(t, E), r(t);
|
|
341
337
|
}(),
|
|
342
|
-
|
|
338
|
+
Y = function (e) {
|
|
343
339
|
function t() {
|
|
344
340
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
345
341
|
}
|
|
346
|
-
return a(t,
|
|
342
|
+
return a(t, E), r(t);
|
|
347
343
|
}(),
|
|
348
344
|
J = function (e) {
|
|
349
345
|
function t() {
|
|
350
346
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
351
347
|
}
|
|
352
|
-
return a(t,
|
|
348
|
+
return a(t, E), r(t);
|
|
353
349
|
}(),
|
|
354
350
|
$ = function (e) {
|
|
355
351
|
function t() {
|
|
356
352
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
357
353
|
}
|
|
358
|
-
return a(t,
|
|
354
|
+
return a(t, E), r(t);
|
|
359
355
|
}(),
|
|
360
356
|
X = function (e) {
|
|
361
357
|
function t() {
|
|
362
358
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
363
359
|
}
|
|
364
|
-
return a(t,
|
|
360
|
+
return a(t, E), r(t);
|
|
365
361
|
}(),
|
|
366
362
|
Z = function (e) {
|
|
367
363
|
function t() {
|
|
368
364
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
369
365
|
}
|
|
370
|
-
return a(t,
|
|
366
|
+
return a(t, E), r(t);
|
|
371
367
|
}(),
|
|
372
368
|
Q = function (e) {
|
|
373
369
|
function t() {
|
|
374
370
|
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
371
|
}
|
|
376
|
-
return a(t,
|
|
372
|
+
return a(t, E), r(t);
|
|
377
373
|
}(),
|
|
378
374
|
ee = function (e) {
|
|
379
375
|
function t() {
|
|
380
376
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
381
377
|
}
|
|
382
|
-
return a(t,
|
|
378
|
+
return a(t, E), r(t);
|
|
383
379
|
}(),
|
|
384
380
|
te = function (e) {
|
|
385
381
|
function t() {
|
|
386
382
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
387
383
|
}
|
|
388
|
-
return a(t,
|
|
384
|
+
return a(t, E), r(t);
|
|
389
385
|
}(),
|
|
390
386
|
re = function (e) {
|
|
391
387
|
function t() {
|
|
392
388
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
393
389
|
}
|
|
394
|
-
return a(t,
|
|
390
|
+
return a(t, E), r(t);
|
|
395
391
|
}(),
|
|
396
392
|
ne = function (e) {
|
|
397
393
|
function t() {
|
|
398
394
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
399
395
|
}
|
|
400
|
-
return a(t,
|
|
396
|
+
return a(t, E), r(t);
|
|
401
397
|
}(),
|
|
402
398
|
ie = function (e) {
|
|
403
399
|
function t() {
|
|
404
400
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
405
401
|
}
|
|
406
|
-
return a(t,
|
|
402
|
+
return a(t, E), r(t);
|
|
407
403
|
}(),
|
|
408
404
|
oe = function (e) {
|
|
409
405
|
function t() {
|
|
410
406
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
411
407
|
}
|
|
412
|
-
return a(t,
|
|
408
|
+
return a(t, E), r(t);
|
|
413
409
|
}();
|
|
414
410
|
function se(e) {
|
|
415
411
|
switch (e.message) {
|
|
@@ -418,22 +414,22 @@ function se(e) {
|
|
|
418
414
|
case "no_current_session":
|
|
419
415
|
return new D();
|
|
420
416
|
case "no_biometrics_registration":
|
|
421
|
-
return new
|
|
417
|
+
return new j();
|
|
422
418
|
case "biometrics_unavailable":
|
|
423
419
|
case "device_hardware_error":
|
|
424
420
|
case "biometrics_not_available":
|
|
425
|
-
return new
|
|
421
|
+
return new F();
|
|
426
422
|
case "key_invalidated":
|
|
427
423
|
case "no_biometric_key":
|
|
428
|
-
return new
|
|
424
|
+
return new R();
|
|
429
425
|
case "no_biometrics_enrolled":
|
|
430
|
-
return new F();
|
|
431
|
-
case "keystore_unavailable":
|
|
432
426
|
return new M();
|
|
427
|
+
case "keystore_unavailable":
|
|
428
|
+
return new L();
|
|
433
429
|
case "device_credentials_not_allowed":
|
|
434
|
-
return new
|
|
430
|
+
return new z();
|
|
435
431
|
case "user_cancellation":
|
|
436
|
-
return new
|
|
432
|
+
return new B();
|
|
437
433
|
case "user_locked_out":
|
|
438
434
|
return new K();
|
|
439
435
|
case "google_onetap_missing_id_token":
|
|
@@ -445,13 +441,13 @@ function se(e) {
|
|
|
445
441
|
case "invalid_authorization_credential":
|
|
446
442
|
return new W();
|
|
447
443
|
case "missing_public_key":
|
|
448
|
-
return new G();
|
|
449
|
-
case "challenge_signing_failed":
|
|
450
444
|
return new H();
|
|
445
|
+
case "challenge_signing_failed":
|
|
446
|
+
return new G();
|
|
451
447
|
case "sdk_not_configured":
|
|
452
|
-
return new Y();
|
|
453
|
-
case "failed_code_challenge":
|
|
454
448
|
return new V();
|
|
449
|
+
case "failed_code_challenge":
|
|
450
|
+
return new Y();
|
|
455
451
|
case "passkeys_unsupported":
|
|
456
452
|
return new J();
|
|
457
453
|
case "failed_to_decrypt_data":
|
|
@@ -475,7 +471,7 @@ function se(e) {
|
|
|
475
471
|
case "passkeys_invalid_encoding":
|
|
476
472
|
return new oe();
|
|
477
473
|
default:
|
|
478
|
-
return new
|
|
474
|
+
return new E(e.name, e.message);
|
|
479
475
|
}
|
|
480
476
|
}
|
|
481
477
|
function ae(e, t) {
|
|
@@ -564,9 +560,9 @@ function de() {
|
|
|
564
560
|
function l(e, t, r, n) {
|
|
565
561
|
var o = t && t.prototype instanceof v ? t : v,
|
|
566
562
|
s = Object.create(o.prototype),
|
|
567
|
-
a = new
|
|
563
|
+
a = new E(n || []);
|
|
568
564
|
return i(s, "_invoke", {
|
|
569
|
-
value:
|
|
565
|
+
value: T(e, r, a)
|
|
570
566
|
}), s;
|
|
571
567
|
}
|
|
572
568
|
function d(e, t, r) {
|
|
@@ -591,22 +587,22 @@ function de() {
|
|
|
591
587
|
function v() {}
|
|
592
588
|
function b() {}
|
|
593
589
|
function g() {}
|
|
594
|
-
var
|
|
595
|
-
u(
|
|
590
|
+
var k = {};
|
|
591
|
+
u(k, s, function () {
|
|
596
592
|
return this;
|
|
597
593
|
});
|
|
598
|
-
var
|
|
599
|
-
w =
|
|
600
|
-
w && w !== r && n.call(w, s) && (
|
|
601
|
-
var S = g.prototype = v.prototype = Object.create(
|
|
602
|
-
function
|
|
594
|
+
var y = Object.getPrototypeOf,
|
|
595
|
+
w = y && y(y(D([])));
|
|
596
|
+
w && w !== r && n.call(w, s) && (k = w);
|
|
597
|
+
var S = g.prototype = v.prototype = Object.create(k);
|
|
598
|
+
function C(e) {
|
|
603
599
|
["next", "throw", "return"].forEach(function (t) {
|
|
604
600
|
u(e, t, function (e) {
|
|
605
601
|
return this._invoke(t, e);
|
|
606
602
|
});
|
|
607
603
|
});
|
|
608
604
|
}
|
|
609
|
-
function
|
|
605
|
+
function P(e, t) {
|
|
610
606
|
function r(i, o, s, a) {
|
|
611
607
|
var c = d(e[i], e, o);
|
|
612
608
|
if ("throw" !== c.type) {
|
|
@@ -636,7 +632,7 @@ function de() {
|
|
|
636
632
|
}
|
|
637
633
|
});
|
|
638
634
|
}
|
|
639
|
-
function
|
|
635
|
+
function T(t, r, n) {
|
|
640
636
|
var i = h;
|
|
641
637
|
return function (o, s) {
|
|
642
638
|
if (i === _) throw new Error("Generator is already running");
|
|
@@ -650,7 +646,7 @@ function de() {
|
|
|
650
646
|
for (n.method = o, n.arg = s;;) {
|
|
651
647
|
var a = n.delegate;
|
|
652
648
|
if (a) {
|
|
653
|
-
var c =
|
|
649
|
+
var c = x(a, n);
|
|
654
650
|
if (c) {
|
|
655
651
|
if (c === m) continue;
|
|
656
652
|
return c;
|
|
@@ -673,10 +669,10 @@ function de() {
|
|
|
673
669
|
}
|
|
674
670
|
};
|
|
675
671
|
}
|
|
676
|
-
function
|
|
672
|
+
function x(t, r) {
|
|
677
673
|
var n = r.method,
|
|
678
674
|
i = t.iterator[n];
|
|
679
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
675
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, x(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
680
676
|
var o = d(i, t.iterator, r.arg);
|
|
681
677
|
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
682
678
|
var s = o.arg;
|
|
@@ -688,11 +684,11 @@ function de() {
|
|
|
688
684
|
};
|
|
689
685
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
690
686
|
}
|
|
691
|
-
function
|
|
687
|
+
function A(e) {
|
|
692
688
|
var t = e.completion || {};
|
|
693
689
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
694
690
|
}
|
|
695
|
-
function
|
|
691
|
+
function E(e) {
|
|
696
692
|
this.tryEntries = [{
|
|
697
693
|
tryLoc: "root"
|
|
698
694
|
}], e.forEach(O, this), this.reset(!0);
|
|
@@ -728,15 +724,15 @@ function de() {
|
|
|
728
724
|
return {
|
|
729
725
|
__await: e
|
|
730
726
|
};
|
|
731
|
-
}, P
|
|
727
|
+
}, C(P.prototype), u(P.prototype, a, function () {
|
|
732
728
|
return this;
|
|
733
|
-
}), t.AsyncIterator =
|
|
729
|
+
}), t.AsyncIterator = P, t.async = function (e, r, n, i, o) {
|
|
734
730
|
void 0 === o && (o = Promise);
|
|
735
|
-
var s = new
|
|
731
|
+
var s = new P(l(e, r, n, i), o);
|
|
736
732
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
737
733
|
return e.done ? e.value : s.next();
|
|
738
734
|
});
|
|
739
|
-
},
|
|
735
|
+
}, C(S), u(S, c, "Generator"), u(S, s, function () {
|
|
740
736
|
return this;
|
|
741
737
|
}), u(S, "toString", function () {
|
|
742
738
|
return "[object Generator]";
|
|
@@ -751,10 +747,10 @@ function de() {
|
|
|
751
747
|
}
|
|
752
748
|
return e.done = !0, e;
|
|
753
749
|
};
|
|
754
|
-
}, t.values = D,
|
|
755
|
-
constructor:
|
|
750
|
+
}, t.values = D, E.prototype = {
|
|
751
|
+
constructor: E,
|
|
756
752
|
reset: function reset(t) {
|
|
757
|
-
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(
|
|
753
|
+
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);
|
|
758
754
|
},
|
|
759
755
|
stop: function stop() {
|
|
760
756
|
this.done = !0;
|
|
@@ -806,7 +802,7 @@ function de() {
|
|
|
806
802
|
finish: function finish(e) {
|
|
807
803
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
808
804
|
var r = this.tryEntries[t];
|
|
809
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
805
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), A(r), m;
|
|
810
806
|
}
|
|
811
807
|
},
|
|
812
808
|
"catch": function _catch(e) {
|
|
@@ -816,7 +812,7 @@ function de() {
|
|
|
816
812
|
var n = r.completion;
|
|
817
813
|
if ("throw" === n.type) {
|
|
818
814
|
var i = n.arg;
|
|
819
|
-
|
|
815
|
+
A(r);
|
|
820
816
|
}
|
|
821
817
|
return i;
|
|
822
818
|
}
|
|
@@ -860,14 +856,14 @@ function fe(e, t) {
|
|
|
860
856
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
861
857
|
}
|
|
862
858
|
function me(e, t, r) {
|
|
863
|
-
return t =
|
|
859
|
+
return t = ke(t), function (e, t) {
|
|
864
860
|
if (t && ("object" === le(t) || "function" == typeof t)) return t;
|
|
865
861
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
866
862
|
return function (e) {
|
|
867
863
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
868
864
|
return e;
|
|
869
865
|
}(e);
|
|
870
|
-
}(e, be() ? Reflect.construct(t, r || [],
|
|
866
|
+
}(e, be() ? Reflect.construct(t, r || [], ke(e).constructor) : t.apply(e, r));
|
|
871
867
|
}
|
|
872
868
|
function ve(e) {
|
|
873
869
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
@@ -891,7 +887,7 @@ function ve(e) {
|
|
|
891
887
|
n.push.apply(n, t);
|
|
892
888
|
var i = new (e.bind.apply(e, n))();
|
|
893
889
|
return r && ge(i, r.prototype), i;
|
|
894
|
-
}(e, arguments,
|
|
890
|
+
}(e, arguments, ke(this).constructor);
|
|
895
891
|
}
|
|
896
892
|
return r.prototype = Object.create(e.prototype, {
|
|
897
893
|
constructor: {
|
|
@@ -916,10 +912,10 @@ function ge(e, t) {
|
|
|
916
912
|
return e.__proto__ = t, e;
|
|
917
913
|
}, ge(e, t);
|
|
918
914
|
}
|
|
919
|
-
function
|
|
920
|
-
return
|
|
915
|
+
function ke(e) {
|
|
916
|
+
return ke = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
921
917
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
922
|
-
},
|
|
918
|
+
}, ke(e);
|
|
923
919
|
}
|
|
924
920
|
!function (e) {
|
|
925
921
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
@@ -927,8 +923,8 @@ function ye(e) {
|
|
|
927
923
|
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
928
924
|
}(g || (g = {})), function (e) {
|
|
929
925
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
930
|
-
}(
|
|
931
|
-
var
|
|
926
|
+
}(k || (k = {}));
|
|
927
|
+
var ye;
|
|
932
928
|
function we(e, t, r, n) {
|
|
933
929
|
return new (r || (r = Promise))(function (i, o) {
|
|
934
930
|
function s(e) {
|
|
@@ -954,9 +950,11 @@ function we(e, t, r, n) {
|
|
|
954
950
|
c((n = n.apply(e, t || [])).next());
|
|
955
951
|
});
|
|
956
952
|
}
|
|
957
|
-
"function" == typeof SuppressedError && SuppressedError,
|
|
953
|
+
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
954
|
+
e.RequiredCatcha = "Catcha Required";
|
|
955
|
+
}(ye || (ye = {}));
|
|
958
956
|
var Se,
|
|
959
|
-
|
|
957
|
+
Ce = function (e) {
|
|
960
958
|
function t(e) {
|
|
961
959
|
var r;
|
|
962
960
|
return fe(this, t), (r = me(this, t, [e])).type = e, r;
|
|
@@ -974,7 +972,7 @@ var Se,
|
|
|
974
972
|
}), t && ge(e, t);
|
|
975
973
|
}(t, ve(Error)), pe(t);
|
|
976
974
|
}();
|
|
977
|
-
function
|
|
975
|
+
function Pe(e) {
|
|
978
976
|
var t,
|
|
979
977
|
r = e.method,
|
|
980
978
|
n = e.finalURL,
|
|
@@ -1004,7 +1002,7 @@ function Ce(e) {
|
|
|
1004
1002
|
e.next = 13;
|
|
1005
1003
|
break;
|
|
1006
1004
|
}
|
|
1007
|
-
throw new
|
|
1005
|
+
throw new x("Unable to contact the Stytch servers. Are you online?");
|
|
1008
1006
|
case 13:
|
|
1009
1007
|
throw e.t0;
|
|
1010
1008
|
case 14:
|
|
@@ -1016,7 +1014,7 @@ function Ce(e) {
|
|
|
1016
1014
|
case 18:
|
|
1017
1015
|
return d = e.sent, e.abrupt("return", d.data);
|
|
1018
1016
|
case 22:
|
|
1019
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
1017
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new x("Invalid JSON response from the Stytch servers.");
|
|
1020
1018
|
case 25:
|
|
1021
1019
|
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
1022
1020
|
e.next = 38;
|
|
@@ -1027,7 +1025,7 @@ function Ce(e) {
|
|
|
1027
1025
|
h = e.sent, e.next = 35;
|
|
1028
1026
|
break;
|
|
1029
1027
|
case 32:
|
|
1030
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
1028
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new x("Invalid or no response from server");
|
|
1031
1029
|
case 35:
|
|
1032
1030
|
if (!("body" in h || "params" in h || "query" in h)) {
|
|
1033
1031
|
e.next = 37;
|
|
@@ -1035,22 +1033,22 @@ function Ce(e) {
|
|
|
1035
1033
|
}
|
|
1036
1034
|
throw new O(h);
|
|
1037
1035
|
case 37:
|
|
1038
|
-
throw new
|
|
1036
|
+
throw new A(h);
|
|
1039
1037
|
case 38:
|
|
1040
1038
|
return e.prev = 38, e.next = 41, l.text();
|
|
1041
1039
|
case 41:
|
|
1042
1040
|
p = e.sent, e.next = 47;
|
|
1043
1041
|
break;
|
|
1044
1042
|
case 44:
|
|
1045
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
1043
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new x("Invalid response from the Stytch servers.");
|
|
1046
1044
|
case 47:
|
|
1047
1045
|
if (!p.includes("Captcha required")) {
|
|
1048
1046
|
e.next = 49;
|
|
1049
1047
|
break;
|
|
1050
1048
|
}
|
|
1051
|
-
throw new
|
|
1049
|
+
throw new Ce(ye.RequiredCatcha);
|
|
1052
1050
|
case 49:
|
|
1053
|
-
throw new
|
|
1051
|
+
throw new x("Invalid response from the Stytch servers.");
|
|
1054
1052
|
case 50:
|
|
1055
1053
|
case "end":
|
|
1056
1054
|
return e.stop();
|
|
@@ -1058,23 +1056,23 @@ function Ce(e) {
|
|
|
1058
1056
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1059
1057
|
}));
|
|
1060
1058
|
}
|
|
1061
|
-
var
|
|
1062
|
-
function
|
|
1059
|
+
var Te = new Uint8Array(16);
|
|
1060
|
+
function xe() {
|
|
1063
1061
|
if (!Se && !(Se = "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");
|
|
1064
|
-
return Se(
|
|
1062
|
+
return Se(Te);
|
|
1065
1063
|
}
|
|
1066
1064
|
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;
|
|
1067
|
-
for (var
|
|
1065
|
+
for (var Ae = [], Ee = 0; Ee < 256; ++Ee) Ae.push((Ee + 256).toString(16).substr(1));
|
|
1068
1066
|
function De(e) {
|
|
1069
1067
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1070
|
-
r = (
|
|
1068
|
+
r = (Ae[e[t + 0]] + Ae[e[t + 1]] + Ae[e[t + 2]] + Ae[e[t + 3]] + "-" + Ae[e[t + 4]] + Ae[e[t + 5]] + "-" + Ae[e[t + 6]] + Ae[e[t + 7]] + "-" + Ae[e[t + 8]] + Ae[e[t + 9]] + "-" + Ae[e[t + 10]] + Ae[e[t + 11]] + Ae[e[t + 12]] + Ae[e[t + 13]] + Ae[e[t + 14]] + Ae[e[t + 15]]).toLowerCase();
|
|
1071
1069
|
if (!function (e) {
|
|
1072
1070
|
return "string" == typeof e && Oe.test(e);
|
|
1073
1071
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1074
1072
|
return r;
|
|
1075
1073
|
}
|
|
1076
1074
|
function Ie(e, t, r) {
|
|
1077
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1075
|
+
var n = (e = e || {}).random || (e.rng || xe)();
|
|
1078
1076
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1079
1077
|
r = r || 0;
|
|
1080
1078
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
@@ -1082,19 +1080,19 @@ function Ie(e, t, r) {
|
|
|
1082
1080
|
}
|
|
1083
1081
|
return De(n);
|
|
1084
1082
|
}
|
|
1085
|
-
var
|
|
1086
|
-
function
|
|
1083
|
+
var je = {};
|
|
1084
|
+
function Fe(e, t) {
|
|
1087
1085
|
return we(this, void 0, void 0, de().mark(function r() {
|
|
1088
1086
|
return de().wrap(function (r) {
|
|
1089
1087
|
for (;;) switch (r.prev = r.next) {
|
|
1090
1088
|
case 0:
|
|
1091
|
-
if (void 0 ===
|
|
1089
|
+
if (void 0 === je[e]) {
|
|
1092
1090
|
r.next = 2;
|
|
1093
1091
|
break;
|
|
1094
1092
|
}
|
|
1095
|
-
return r.abrupt("return",
|
|
1093
|
+
return r.abrupt("return", je[e]);
|
|
1096
1094
|
case 2:
|
|
1097
|
-
return
|
|
1095
|
+
return je[e] = Re(e, t), r.abrupt("return", je[e]);
|
|
1098
1096
|
case 4:
|
|
1099
1097
|
case "end":
|
|
1100
1098
|
return r.stop();
|
|
@@ -1102,10 +1100,10 @@ function Be(e, t) {
|
|
|
1102
1100
|
}, r);
|
|
1103
1101
|
}));
|
|
1104
1102
|
}
|
|
1105
|
-
function
|
|
1103
|
+
function Re(e, t) {
|
|
1106
1104
|
return new Promise(function (r, n) {
|
|
1107
1105
|
var i = function (e) {
|
|
1108
|
-
var t =
|
|
1106
|
+
var t = Le(e);
|
|
1109
1107
|
if (t[0]) return t[0];
|
|
1110
1108
|
}(e);
|
|
1111
1109
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1129,20 +1127,20 @@ function Le(e, t) {
|
|
|
1129
1127
|
});
|
|
1130
1128
|
});
|
|
1131
1129
|
}
|
|
1132
|
-
var
|
|
1130
|
+
var Le = function Le(e) {
|
|
1133
1131
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1134
1132
|
};
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1133
|
+
var Me,
|
|
1134
|
+
Be = ["[Stytch]"],
|
|
1137
1135
|
Ke = function Ke() {
|
|
1138
1136
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1139
|
-
return (e = console).warn.apply(e,
|
|
1137
|
+
return (e = console).warn.apply(e, Be.concat(r));
|
|
1140
1138
|
},
|
|
1141
|
-
|
|
1139
|
+
ze = function ze() {
|
|
1142
1140
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1143
|
-
return (e = console).error.apply(e,
|
|
1141
|
+
return (e = console).error.apply(e, Be.concat(r));
|
|
1144
1142
|
},
|
|
1145
|
-
|
|
1143
|
+
Ne = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1146
1144
|
Ue = function Ue(e) {
|
|
1147
1145
|
return e.includes("public-token-test");
|
|
1148
1146
|
},
|
|
@@ -1340,7 +1338,7 @@ var Fe,
|
|
|
1340
1338
|
case 0:
|
|
1341
1339
|
return r.next = 2, this.state;
|
|
1342
1340
|
case 2:
|
|
1343
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1341
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== ye.RequiredCatcha || !i) {
|
|
1344
1342
|
r.next = 14;
|
|
1345
1343
|
break;
|
|
1346
1344
|
}
|
|
@@ -1380,7 +1378,7 @@ var Fe,
|
|
|
1380
1378
|
executeRecaptcha: o
|
|
1381
1379
|
});
|
|
1382
1380
|
case 2:
|
|
1383
|
-
return n.next = 4, void
|
|
1381
|
+
return n.next = 4, void Fe("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1384
1382
|
return window;
|
|
1385
1383
|
});
|
|
1386
1384
|
case 4:
|
|
@@ -1400,7 +1398,7 @@ var Fe,
|
|
|
1400
1398
|
}));
|
|
1401
1399
|
});
|
|
1402
1400
|
}),
|
|
1403
|
-
|
|
1401
|
+
He = function He() {
|
|
1404
1402
|
return {
|
|
1405
1403
|
isEnabled: function isEnabled() {
|
|
1406
1404
|
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
@@ -1459,7 +1457,7 @@ var Fe,
|
|
|
1459
1457
|
}
|
|
1460
1458
|
};
|
|
1461
1459
|
},
|
|
1462
|
-
|
|
1460
|
+
Ge = function () {
|
|
1463
1461
|
function e(t) {
|
|
1464
1462
|
fe(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1465
1463
|
}
|
|
@@ -1508,19 +1506,19 @@ var Fe,
|
|
|
1508
1506
|
}();
|
|
1509
1507
|
!function (e) {
|
|
1510
1508
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1511
|
-
}(
|
|
1509
|
+
}(Me || (Me = {})), Promise.resolve({
|
|
1512
1510
|
pkceRequiredForEmailMagicLinks: !1
|
|
1513
1511
|
}), Promise.resolve({
|
|
1514
1512
|
pkceRequiredForPasswordResets: !1
|
|
1515
1513
|
});
|
|
1516
|
-
var
|
|
1514
|
+
var Ve = Promise.resolve({
|
|
1517
1515
|
pkceRequiredForEmailMagicLinks: !1
|
|
1518
1516
|
}),
|
|
1519
|
-
|
|
1517
|
+
Ye = function () {
|
|
1520
1518
|
function e(t, r, n, i) {
|
|
1521
1519
|
var o = this,
|
|
1522
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1523
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1520
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ve,
|
|
1521
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
1524
1522
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1525
1523
|
invite: function invite(e) {
|
|
1526
1524
|
return we(o, void 0, void 0, de().mark(function t() {
|
|
@@ -1859,7 +1857,7 @@ var Ye = Promise.resolve({
|
|
|
1859
1857
|
$e = function () {
|
|
1860
1858
|
function e(t, r, n, i, o) {
|
|
1861
1859
|
var s = this,
|
|
1862
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1860
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
1863
1861
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1864
1862
|
createConnection: function createConnection(e) {
|
|
1865
1863
|
return we(s, void 0, void 0, de().mark(function t() {
|
|
@@ -2339,7 +2337,7 @@ var Ye = Promise.resolve({
|
|
|
2339
2337
|
Ze = function () {
|
|
2340
2338
|
function e(t, r, n, i, o) {
|
|
2341
2339
|
var s = this,
|
|
2342
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2340
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
2343
2341
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2344
2342
|
authenticate: function authenticate(e) {
|
|
2345
2343
|
return we(s, void 0, void 0, de().mark(function t() {
|
|
@@ -2377,14 +2375,14 @@ var Ye = Promise.resolve({
|
|
|
2377
2375
|
}));
|
|
2378
2376
|
}
|
|
2379
2377
|
}, this.google = {
|
|
2380
|
-
start: this.startOAuthFlow(
|
|
2378
|
+
start: this.startOAuthFlow(k.Google),
|
|
2381
2379
|
discovery: {
|
|
2382
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2380
|
+
start: this.startDiscoveryOAuthFlow(k.Google)
|
|
2383
2381
|
}
|
|
2384
2382
|
}, this.microsoft = {
|
|
2385
|
-
start: this.startOAuthFlow(
|
|
2383
|
+
start: this.startOAuthFlow(k.Microsoft),
|
|
2386
2384
|
discovery: {
|
|
2387
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2385
|
+
start: this.startDiscoveryOAuthFlow(k.Microsoft)
|
|
2388
2386
|
}
|
|
2389
2387
|
};
|
|
2390
2388
|
}
|
|
@@ -2569,7 +2567,7 @@ var Ye = Promise.resolve({
|
|
|
2569
2567
|
case 3:
|
|
2570
2568
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2571
2569
|
case 8:
|
|
2572
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2570
|
+
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;
|
|
2573
2571
|
case 12:
|
|
2574
2572
|
case "end":
|
|
2575
2573
|
return t.stop();
|
|
@@ -2621,7 +2619,7 @@ var Ye = Promise.resolve({
|
|
|
2621
2619
|
}
|
|
2622
2620
|
return t.abrupt("return", this.authenticate(e));
|
|
2623
2621
|
case 17:
|
|
2624
|
-
throw
|
|
2622
|
+
throw P.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2625
2623
|
case 19:
|
|
2626
2624
|
case "end":
|
|
2627
2625
|
return t.stop();
|
|
@@ -2796,13 +2794,303 @@ var Ye = Promise.resolve({
|
|
|
2796
2794
|
}));
|
|
2797
2795
|
}
|
|
2798
2796
|
};
|
|
2799
|
-
})
|
|
2800
|
-
Promise.resolve({
|
|
2801
|
-
|
|
2802
|
-
})
|
|
2803
|
-
|
|
2797
|
+
}),
|
|
2798
|
+
tt = Promise.resolve({
|
|
2799
|
+
pkceRequiredForPasswordResets: !1
|
|
2800
|
+
}),
|
|
2801
|
+
rt = function () {
|
|
2802
|
+
function e(t, r, n) {
|
|
2803
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : tt,
|
|
2804
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : He();
|
|
2805
|
+
fe(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2806
|
+
}
|
|
2807
|
+
return pe(e, [{
|
|
2808
|
+
key: "getCodeChallenge",
|
|
2809
|
+
value: function value() {
|
|
2810
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2811
|
+
var t, r;
|
|
2812
|
+
return de().wrap(function (e) {
|
|
2813
|
+
for (;;) switch (e.prev = e.next) {
|
|
2814
|
+
case 0:
|
|
2815
|
+
return e.next = 2, this._config;
|
|
2816
|
+
case 2:
|
|
2817
|
+
if (t = e.sent, t.pkceRequiredForPasswordResets) {
|
|
2818
|
+
e.next = 6;
|
|
2819
|
+
break;
|
|
2820
|
+
}
|
|
2821
|
+
return e.abrupt("return", void 0);
|
|
2822
|
+
case 6:
|
|
2823
|
+
return e.next = 8, this._pkceManager.getPKPair();
|
|
2824
|
+
case 8:
|
|
2825
|
+
if (!(r = e.sent)) {
|
|
2826
|
+
e.next = 11;
|
|
2827
|
+
break;
|
|
2828
|
+
}
|
|
2829
|
+
return e.abrupt("return", r.code_challenge);
|
|
2830
|
+
case 11:
|
|
2831
|
+
return e.next = 13, this._pkceManager.startPKCETransaction();
|
|
2832
|
+
case 13:
|
|
2833
|
+
return r = e.sent, e.abrupt("return", r.code_challenge);
|
|
2834
|
+
case 15:
|
|
2835
|
+
case "end":
|
|
2836
|
+
return e.stop();
|
|
2837
|
+
}
|
|
2838
|
+
}, e, this);
|
|
2839
|
+
}));
|
|
2840
|
+
}
|
|
2841
|
+
}, {
|
|
2842
|
+
key: "authenticate",
|
|
2843
|
+
value: function value(e) {
|
|
2844
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2845
|
+
var r, n, i, o, s, a;
|
|
2846
|
+
return de().wrap(function (t) {
|
|
2847
|
+
for (;;) switch (t.prev = t.next) {
|
|
2848
|
+
case 0:
|
|
2849
|
+
return qe("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();
|
|
2850
|
+
case 3:
|
|
2851
|
+
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2852
|
+
case 7:
|
|
2853
|
+
return i = t.sent, o = i.dfp_telemetry_id, s = i.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2854
|
+
url: "/b2b/passwords/authenticate",
|
|
2855
|
+
method: "POST",
|
|
2856
|
+
errorMessage: "Failed to authenticate password.",
|
|
2857
|
+
body: {
|
|
2858
|
+
organization_id: e.organization_id,
|
|
2859
|
+
email_address: e.email_address,
|
|
2860
|
+
password: e.password,
|
|
2861
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2862
|
+
locale: e.locale,
|
|
2863
|
+
captcha_token: s,
|
|
2864
|
+
dfp_telemetry_id: o,
|
|
2865
|
+
code_verifier: n
|
|
2866
|
+
},
|
|
2867
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2868
|
+
});
|
|
2869
|
+
case 12:
|
|
2870
|
+
return (a = t.sent).member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2871
|
+
state: {
|
|
2872
|
+
session: a.member_session,
|
|
2873
|
+
member: a.member,
|
|
2874
|
+
organization: a.organization
|
|
2875
|
+
},
|
|
2876
|
+
session_token: a.session_token,
|
|
2877
|
+
session_jwt: a.session_jwt,
|
|
2878
|
+
intermediate_session_token: null
|
|
2879
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
2880
|
+
state: null,
|
|
2881
|
+
session_token: null,
|
|
2882
|
+
session_jwt: null,
|
|
2883
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2884
|
+
}), t.abrupt("return", a);
|
|
2885
|
+
case 15:
|
|
2886
|
+
case "end":
|
|
2887
|
+
return t.stop();
|
|
2888
|
+
}
|
|
2889
|
+
}, t, this);
|
|
2890
|
+
}));
|
|
2891
|
+
}
|
|
2892
|
+
}, {
|
|
2893
|
+
key: "resetByEmailStart",
|
|
2894
|
+
value: function value(e) {
|
|
2895
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2896
|
+
var r, n, i, o;
|
|
2897
|
+
return de().wrap(function (t) {
|
|
2898
|
+
for (;;) switch (t.prev = t.next) {
|
|
2899
|
+
case 0:
|
|
2900
|
+
return qe("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();
|
|
2901
|
+
case 3:
|
|
2902
|
+
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2903
|
+
case 6:
|
|
2904
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2905
|
+
url: "/b2b/passwords/email/reset/start",
|
|
2906
|
+
method: "POST",
|
|
2907
|
+
errorMessage: "Failed to start password reset flow.",
|
|
2908
|
+
body: {
|
|
2909
|
+
organization_id: e.organization_id,
|
|
2910
|
+
email_address: e.email_address,
|
|
2911
|
+
login_redirect_url: e.login_redirect_url,
|
|
2912
|
+
reset_password_redirect_url: e.reset_password_redirect_url,
|
|
2913
|
+
reset_password_expiration_minutes: e.reset_password_expiration_minutes,
|
|
2914
|
+
reset_password_template_id: e.reset_password_template_id,
|
|
2915
|
+
code_challenge: r,
|
|
2916
|
+
captcha_token: o,
|
|
2917
|
+
dfp_telemetry_id: i
|
|
2918
|
+
},
|
|
2919
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2920
|
+
}));
|
|
2921
|
+
case 10:
|
|
2922
|
+
case "end":
|
|
2923
|
+
return t.stop();
|
|
2924
|
+
}
|
|
2925
|
+
}, t, this);
|
|
2926
|
+
}));
|
|
2927
|
+
}
|
|
2928
|
+
}, {
|
|
2929
|
+
key: "resetByEmail",
|
|
2930
|
+
value: function value(e) {
|
|
2931
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2932
|
+
var r, n, i, o, s, a;
|
|
2933
|
+
return de().wrap(function (t) {
|
|
2934
|
+
for (;;) switch (t.prev = t.next) {
|
|
2935
|
+
case 0:
|
|
2936
|
+
return qe("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();
|
|
2937
|
+
case 3:
|
|
2938
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2939
|
+
case 8:
|
|
2940
|
+
return o = t.sent, s = null == o ? void 0 : o.code_verifier, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2941
|
+
url: "/b2b/passwords/email/reset",
|
|
2942
|
+
method: "POST",
|
|
2943
|
+
errorMessage: "Failed to reset password.",
|
|
2944
|
+
body: {
|
|
2945
|
+
password_reset_token: e.password_reset_token,
|
|
2946
|
+
password: e.password,
|
|
2947
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2948
|
+
locale: e.locale,
|
|
2949
|
+
captcha_token: i,
|
|
2950
|
+
dfp_telemetry_id: n,
|
|
2951
|
+
code_verifier: s
|
|
2952
|
+
},
|
|
2953
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2954
|
+
});
|
|
2955
|
+
case 12:
|
|
2956
|
+
return a = t.sent, this._pkceManager.clearPKPair(), a.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2957
|
+
state: {
|
|
2958
|
+
session: a.member_session,
|
|
2959
|
+
member: a.member,
|
|
2960
|
+
organization: a.organization
|
|
2961
|
+
},
|
|
2962
|
+
session_token: a.session_token,
|
|
2963
|
+
session_jwt: a.session_jwt,
|
|
2964
|
+
intermediate_session_token: null
|
|
2965
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
2966
|
+
state: null,
|
|
2967
|
+
session_token: null,
|
|
2968
|
+
session_jwt: null,
|
|
2969
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2970
|
+
}), t.abrupt("return", a);
|
|
2971
|
+
case 16:
|
|
2972
|
+
case "end":
|
|
2973
|
+
return t.stop();
|
|
2974
|
+
}
|
|
2975
|
+
}, t, this);
|
|
2976
|
+
}));
|
|
2977
|
+
}
|
|
2978
|
+
}, {
|
|
2979
|
+
key: "resetByExistingPassword",
|
|
2980
|
+
value: function value(e) {
|
|
2981
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2982
|
+
var r, n, i, o;
|
|
2983
|
+
return de().wrap(function (t) {
|
|
2984
|
+
for (;;) switch (t.prev = t.next) {
|
|
2985
|
+
case 0:
|
|
2986
|
+
return qe("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();
|
|
2987
|
+
case 3:
|
|
2988
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2989
|
+
url: "/b2b/passwords/existing_password/reset",
|
|
2990
|
+
method: "POST",
|
|
2991
|
+
errorMessage: "Failed to reset password.",
|
|
2992
|
+
body: {
|
|
2993
|
+
organization_id: e.organization_id,
|
|
2994
|
+
email_address: e.email_address,
|
|
2995
|
+
existing_password: e.existing_password,
|
|
2996
|
+
new_password: e.new_password,
|
|
2997
|
+
locale: e.locale,
|
|
2998
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2999
|
+
captcha_token: i,
|
|
3000
|
+
dfp_telemetry_id: n
|
|
3001
|
+
},
|
|
3002
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3003
|
+
});
|
|
3004
|
+
case 8:
|
|
3005
|
+
return (o = t.sent).member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3006
|
+
state: {
|
|
3007
|
+
session: o.member_session,
|
|
3008
|
+
member: o.member,
|
|
3009
|
+
organization: o.organization
|
|
3010
|
+
},
|
|
3011
|
+
session_token: o.session_token,
|
|
3012
|
+
session_jwt: o.session_jwt,
|
|
3013
|
+
intermediate_session_token: null
|
|
3014
|
+
}) : this._subscriptionService.updateStateAndTokens({
|
|
3015
|
+
state: null,
|
|
3016
|
+
session_token: null,
|
|
3017
|
+
session_jwt: null,
|
|
3018
|
+
intermediate_session_token: o.intermediate_session_token
|
|
3019
|
+
}), t.abrupt("return", o);
|
|
3020
|
+
case 11:
|
|
3021
|
+
case "end":
|
|
3022
|
+
return t.stop();
|
|
3023
|
+
}
|
|
3024
|
+
}, t, this);
|
|
3025
|
+
}));
|
|
3026
|
+
}
|
|
3027
|
+
}, {
|
|
3028
|
+
key: "resetBySession",
|
|
3029
|
+
value: function value(e) {
|
|
3030
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3031
|
+
var r, n, i, o;
|
|
3032
|
+
return de().wrap(function (t) {
|
|
3033
|
+
for (;;) switch (t.prev = t.next) {
|
|
3034
|
+
case 0:
|
|
3035
|
+
return qe("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3036
|
+
case 3:
|
|
3037
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3038
|
+
url: "/b2b/passwords/session/reset",
|
|
3039
|
+
method: "POST",
|
|
3040
|
+
errorMessage: "Failed to reset by session.",
|
|
3041
|
+
body: {
|
|
3042
|
+
password: e.password,
|
|
3043
|
+
captcha_token: i,
|
|
3044
|
+
dfp_telemetry_id: n
|
|
3045
|
+
},
|
|
3046
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3047
|
+
});
|
|
3048
|
+
case 8:
|
|
3049
|
+
return o = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
3050
|
+
state: {
|
|
3051
|
+
session: o.member_session,
|
|
3052
|
+
member: o.member,
|
|
3053
|
+
organization: o.organization
|
|
3054
|
+
},
|
|
3055
|
+
session_token: o.session_token,
|
|
3056
|
+
session_jwt: o.session_jwt,
|
|
3057
|
+
intermediate_session_token: null
|
|
3058
|
+
}), t.abrupt("return", o);
|
|
3059
|
+
case 11:
|
|
3060
|
+
case "end":
|
|
3061
|
+
return t.stop();
|
|
3062
|
+
}
|
|
3063
|
+
}, t, this);
|
|
3064
|
+
}));
|
|
3065
|
+
}
|
|
3066
|
+
}, {
|
|
3067
|
+
key: "strengthCheck",
|
|
3068
|
+
value: function value(e) {
|
|
3069
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3070
|
+
return de().wrap(function (t) {
|
|
3071
|
+
for (;;) switch (t.prev = t.next) {
|
|
3072
|
+
case 0:
|
|
3073
|
+
return qe("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3074
|
+
url: "/b2b/passwords/strength_check",
|
|
3075
|
+
method: "POST",
|
|
3076
|
+
errorMessage: "Failed to check password strength.",
|
|
3077
|
+
body: {
|
|
3078
|
+
email_address: e.email_address,
|
|
3079
|
+
password: e.password
|
|
3080
|
+
}
|
|
3081
|
+
}));
|
|
3082
|
+
case 2:
|
|
3083
|
+
case "end":
|
|
3084
|
+
return t.stop();
|
|
3085
|
+
}
|
|
3086
|
+
}, t, this);
|
|
3087
|
+
}));
|
|
3088
|
+
}
|
|
3089
|
+
}]), e;
|
|
3090
|
+
}(),
|
|
3091
|
+
nt = pe(function e(t, r) {
|
|
2804
3092
|
var n = this,
|
|
2805
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3093
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
2806
3094
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
2807
3095
|
send: function send(e) {
|
|
2808
3096
|
return we(n, void 0, void 0, de().mark(function t() {
|
|
@@ -2885,9 +3173,9 @@ var tt = pe(function e(t, r) {
|
|
|
2885
3173
|
}
|
|
2886
3174
|
};
|
|
2887
3175
|
}),
|
|
2888
|
-
|
|
3176
|
+
it = function () {
|
|
2889
3177
|
function e(t, r) {
|
|
2890
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3178
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
2891
3179
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2892
3180
|
}
|
|
2893
3181
|
return pe(e, [{
|
|
@@ -2975,9 +3263,9 @@ var tt = pe(function e(t, r) {
|
|
|
2975
3263
|
}
|
|
2976
3264
|
}]), e;
|
|
2977
3265
|
}(),
|
|
2978
|
-
|
|
3266
|
+
ot = function () {
|
|
2979
3267
|
function e(t, r) {
|
|
2980
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3268
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
2981
3269
|
fe(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2982
3270
|
}
|
|
2983
3271
|
return pe(e, [{
|
|
@@ -3075,7 +3363,7 @@ var tt = pe(function e(t, r) {
|
|
|
3075
3363
|
}
|
|
3076
3364
|
}]), e;
|
|
3077
3365
|
}(),
|
|
3078
|
-
|
|
3366
|
+
st = function () {
|
|
3079
3367
|
function e(t, r, n) {
|
|
3080
3368
|
var i = this;
|
|
3081
3369
|
fe(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
@@ -3085,8 +3373,8 @@ var tt = pe(function e(t, r) {
|
|
|
3085
3373
|
return i.policyPromise.then(function (r) {
|
|
3086
3374
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3087
3375
|
});
|
|
3088
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3089
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3376
|
+
}, this.cachedPolicy = t.rbacPolicy ? ct.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3377
|
+
return e.rbacPolicy ? (i.cachedPolicy = ct.fromJSON(e.rbacPolicy), i.cachedPolicy) : (ze("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new ct([], []));
|
|
3090
3378
|
});
|
|
3091
3379
|
}
|
|
3092
3380
|
return pe(e, [{
|
|
@@ -3106,7 +3394,7 @@ var tt = pe(function e(t, r) {
|
|
|
3106
3394
|
}
|
|
3107
3395
|
}]), e;
|
|
3108
3396
|
}(),
|
|
3109
|
-
|
|
3397
|
+
at = function () {
|
|
3110
3398
|
function e(t, r) {
|
|
3111
3399
|
var n = this;
|
|
3112
3400
|
fe(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
@@ -3176,593 +3464,65 @@ var tt = pe(function e(t, r) {
|
|
|
3176
3464
|
}, {
|
|
3177
3465
|
key: "isUnrecoverableError",
|
|
3178
3466
|
value: function value(e) {
|
|
3179
|
-
return
|
|
3467
|
+
return P.includes(e.error_type);
|
|
3180
3468
|
}
|
|
3181
3469
|
}]), e;
|
|
3182
3470
|
}();
|
|
3183
|
-
|
|
3184
|
-
var
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
mt = function () {
|
|
3195
|
-
function e(t, r) {
|
|
3471
|
+
at.REFRESH_INTERVAL_MS = 18e4;
|
|
3472
|
+
var ct = function () {
|
|
3473
|
+
function e(t, r) {
|
|
3474
|
+
var n = this;
|
|
3475
|
+
fe(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3476
|
+
return n.rolesByID[e.role_id] = e;
|
|
3477
|
+
});
|
|
3478
|
+
}
|
|
3479
|
+
return pe(e, [{
|
|
3480
|
+
key: "callerIsAuthorized",
|
|
3481
|
+
value: function value(e, t, r) {
|
|
3196
3482
|
var n = this;
|
|
3197
|
-
|
|
3198
|
-
return n.rolesByID[e
|
|
3483
|
+
return !!e.map(function (e) {
|
|
3484
|
+
return n.rolesByID[e];
|
|
3485
|
+
}).filter(function (e) {
|
|
3486
|
+
return e;
|
|
3487
|
+
}).flatMap(function (e) {
|
|
3488
|
+
return e.permissions;
|
|
3489
|
+
}).filter(function (e) {
|
|
3490
|
+
return e.resource_id === t;
|
|
3491
|
+
}).find(function (e) {
|
|
3492
|
+
return e.actions.includes(r) || e.actions.includes("*");
|
|
3199
3493
|
});
|
|
3200
3494
|
}
|
|
3201
|
-
return pe(e, [{
|
|
3202
|
-
key: "callerIsAuthorized",
|
|
3203
|
-
value: function value(e, t, r) {
|
|
3204
|
-
var n = this;
|
|
3205
|
-
return !!e.map(function (e) {
|
|
3206
|
-
return n.rolesByID[e];
|
|
3207
|
-
}).filter(function (e) {
|
|
3208
|
-
return e;
|
|
3209
|
-
}).flatMap(function (e) {
|
|
3210
|
-
return e.permissions;
|
|
3211
|
-
}).filter(function (e) {
|
|
3212
|
-
return e.resource_id === t;
|
|
3213
|
-
}).find(function (e) {
|
|
3214
|
-
return e.actions.includes(r) || e.actions.includes("*");
|
|
3215
|
-
});
|
|
3216
|
-
}
|
|
3217
|
-
}, {
|
|
3218
|
-
key: "allPermissionsForCaller",
|
|
3219
|
-
value: function value(e) {
|
|
3220
|
-
var t = this,
|
|
3221
|
-
r = {};
|
|
3222
|
-
return this.resources.forEach(function (n) {
|
|
3223
|
-
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3224
|
-
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3225
|
-
});
|
|
3226
|
-
}), r;
|
|
3227
|
-
}
|
|
3228
|
-
}], [{
|
|
3229
|
-
key: "fromJSON",
|
|
3230
|
-
value: function value(t) {
|
|
3231
|
-
return new e(t.roles, t.resources);
|
|
3232
|
-
}
|
|
3233
|
-
}]), e;
|
|
3234
|
-
}();
|
|
3235
|
-
function vt(e, t, r, n) {
|
|
3236
|
-
return new (r || (r = Promise))(function (i, o) {
|
|
3237
|
-
function s(e) {
|
|
3238
|
-
try {
|
|
3239
|
-
c(n.next(e));
|
|
3240
|
-
} catch (e) {
|
|
3241
|
-
o(e);
|
|
3242
|
-
}
|
|
3243
|
-
}
|
|
3244
|
-
function a(e) {
|
|
3245
|
-
try {
|
|
3246
|
-
c(n["throw"](e));
|
|
3247
|
-
} catch (e) {
|
|
3248
|
-
o(e);
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
function c(e) {
|
|
3252
|
-
var t;
|
|
3253
|
-
e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
|
|
3254
|
-
e(t);
|
|
3255
|
-
})).then(s, a);
|
|
3256
|
-
}
|
|
3257
|
-
c((n = n.apply(e, t || [])).next());
|
|
3258
|
-
});
|
|
3259
|
-
}
|
|
3260
|
-
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
3261
|
-
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
3262
|
-
}(st || (st = {})), function (e) {
|
|
3263
|
-
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";
|
|
3264
|
-
}(at || (at = {})), function (e) {
|
|
3265
|
-
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";
|
|
3266
|
-
}(ct || (ct = {})), function (e) {
|
|
3267
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
3268
|
-
}(ut || (ut = {})), function (e) {
|
|
3269
|
-
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
3270
|
-
}(lt || (lt = {})), function (e) {
|
|
3271
|
-
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";
|
|
3272
|
-
}(dt || (dt = {}));
|
|
3273
|
-
var bt = /*#__PURE__*/function (_Error) {
|
|
3274
|
-
_inherits(bt, _Error);
|
|
3275
|
-
function bt(e, t) {
|
|
3276
|
-
var _this;
|
|
3277
|
-
_classCallCheck(this, bt);
|
|
3278
|
-
_this = _callSuper(this, bt), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
|
|
3279
|
-
return _this;
|
|
3280
|
-
}
|
|
3281
|
-
return _createClass(bt);
|
|
3282
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
3283
|
-
!function (e) {
|
|
3284
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3285
|
-
}(ht || (ht = {})), function (e) {
|
|
3286
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3287
|
-
}(pt || (pt = {})), function (e) {
|
|
3288
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
3289
|
-
}(_t || (_t = {})), function (e) {
|
|
3290
|
-
e.RequiredCatcha = "Catcha Required";
|
|
3291
|
-
}(ft || (ft = {}));
|
|
3292
|
-
var gt = function gt(e) {
|
|
3293
|
-
var t = {
|
|
3294
|
-
isObject: function isObject(r, n) {
|
|
3295
|
-
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new bt(e, r + " must be an object.");
|
|
3296
|
-
return t;
|
|
3297
|
-
},
|
|
3298
|
-
isOptionalObject: function isOptionalObject(e, r) {
|
|
3299
|
-
return void 0 === r ? t : t.isObject(e, r);
|
|
3300
|
-
},
|
|
3301
|
-
isString: function isString(r, n) {
|
|
3302
|
-
if ("string" != typeof n) throw new bt(e, r + " must be a string.");
|
|
3303
|
-
return t;
|
|
3304
|
-
},
|
|
3305
|
-
isOptionalString: function isOptionalString(e, r) {
|
|
3306
|
-
return void 0 === r ? t : t.isString(e, r);
|
|
3307
|
-
},
|
|
3308
|
-
isStringArray: function isStringArray(r, n) {
|
|
3309
|
-
if (!Array.isArray(n)) throw new bt(e, r + " must be an array of strings.");
|
|
3310
|
-
var _iterator = _createForOfIteratorHelper(n),
|
|
3311
|
-
_step;
|
|
3312
|
-
try {
|
|
3313
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3314
|
-
var _t2 = _step.value;
|
|
3315
|
-
if ("string" != typeof _t2) throw new bt(e, r + " must be an array of strings.");
|
|
3316
|
-
}
|
|
3317
|
-
} catch (err) {
|
|
3318
|
-
_iterator.e(err);
|
|
3319
|
-
} finally {
|
|
3320
|
-
_iterator.f();
|
|
3321
|
-
}
|
|
3322
|
-
return t;
|
|
3323
|
-
},
|
|
3324
|
-
isOptionalStringArray: function isOptionalStringArray(e, r) {
|
|
3325
|
-
return void 0 === r ? t : t.isStringArray(e, r);
|
|
3326
|
-
},
|
|
3327
|
-
isNumber: function isNumber(r, n) {
|
|
3328
|
-
if ("number" != typeof n) throw new bt(e, r + " must be a number.");
|
|
3329
|
-
return t;
|
|
3330
|
-
},
|
|
3331
|
-
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
3332
|
-
return void 0 === r ? t : t.isNumber(e, r);
|
|
3333
|
-
},
|
|
3334
|
-
isBoolean: function isBoolean(r, n) {
|
|
3335
|
-
if ("boolean" != typeof n) throw new bt(e, r + " must be a boolean.");
|
|
3336
|
-
return t;
|
|
3337
|
-
},
|
|
3338
|
-
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
3339
|
-
return void 0 === r ? t : t.isBoolean(e, r);
|
|
3340
|
-
}
|
|
3341
|
-
};
|
|
3342
|
-
return t;
|
|
3343
|
-
};
|
|
3344
|
-
var yt;
|
|
3345
|
-
!function (e) {
|
|
3346
|
-
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
3347
|
-
}(yt || (yt = {})), Promise.resolve({
|
|
3348
|
-
pkceRequiredForEmailMagicLinks: !1
|
|
3349
|
-
}), Promise.resolve({
|
|
3350
|
-
pkceRequiredForPasswordResets: !1
|
|
3351
|
-
}), Promise.resolve({
|
|
3352
|
-
pkceRequiredForEmailMagicLinks: !1
|
|
3353
|
-
});
|
|
3354
|
-
var kt = Promise.resolve({
|
|
3355
|
-
pkceRequiredForPasswordResets: !1
|
|
3356
|
-
});
|
|
3357
|
-
var wt = /*#__PURE__*/function () {
|
|
3358
|
-
function wt(e, t, r) {
|
|
3359
|
-
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : kt;
|
|
3360
|
-
var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
3361
|
-
return {
|
|
3362
|
-
isEnabled: function isEnabled() {
|
|
3363
|
-
return vt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3364
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3365
|
-
while (1) switch (_context.prev = _context.next) {
|
|
3366
|
-
case 0:
|
|
3367
|
-
return _context.abrupt("return", !1);
|
|
3368
|
-
case 1:
|
|
3369
|
-
case "end":
|
|
3370
|
-
return _context.stop();
|
|
3371
|
-
}
|
|
3372
|
-
}, _callee);
|
|
3373
|
-
}));
|
|
3374
|
-
},
|
|
3375
|
-
getTelemetryID: function getTelemetryID() {
|
|
3376
|
-
return vt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3377
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3378
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3379
|
-
case 0:
|
|
3380
|
-
case "end":
|
|
3381
|
-
return _context2.stop();
|
|
3382
|
-
}
|
|
3383
|
-
}, _callee2);
|
|
3384
|
-
}));
|
|
3385
|
-
},
|
|
3386
|
-
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
3387
|
-
return vt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3388
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3389
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
3390
|
-
case 0:
|
|
3391
|
-
return _context3.abrupt("return", {
|
|
3392
|
-
dfp_telemetry_id: void 0,
|
|
3393
|
-
captcha_token: void 0
|
|
3394
|
-
});
|
|
3395
|
-
case 1:
|
|
3396
|
-
case "end":
|
|
3397
|
-
return _context3.stop();
|
|
3398
|
-
}
|
|
3399
|
-
}, _callee3);
|
|
3400
|
-
}));
|
|
3401
|
-
},
|
|
3402
|
-
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
3403
|
-
return vt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3404
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3405
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
3406
|
-
case 0:
|
|
3407
|
-
throw new Error("DFP protected auth is disabled");
|
|
3408
|
-
case 1:
|
|
3409
|
-
case "end":
|
|
3410
|
-
return _context4.stop();
|
|
3411
|
-
}
|
|
3412
|
-
}, _callee4);
|
|
3413
|
-
}));
|
|
3414
|
-
}
|
|
3415
|
-
};
|
|
3416
|
-
}();
|
|
3417
|
-
_classCallCheck(this, wt);
|
|
3418
|
-
this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
|
|
3419
|
-
}
|
|
3420
|
-
_createClass(wt, [{
|
|
3421
|
-
key: "getCodeChallenge",
|
|
3422
|
-
value: function getCodeChallenge() {
|
|
3423
|
-
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3424
|
-
var _yield$this$_config, e, t;
|
|
3425
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3426
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
3427
|
-
case 0:
|
|
3428
|
-
_context5.next = 2;
|
|
3429
|
-
return this._config;
|
|
3430
|
-
case 2:
|
|
3431
|
-
_yield$this$_config = _context5.sent;
|
|
3432
|
-
e = _yield$this$_config.pkceRequiredForPasswordResets;
|
|
3433
|
-
if (e) {
|
|
3434
|
-
_context5.next = 6;
|
|
3435
|
-
break;
|
|
3436
|
-
}
|
|
3437
|
-
return _context5.abrupt("return");
|
|
3438
|
-
case 6:
|
|
3439
|
-
_context5.next = 8;
|
|
3440
|
-
return this._pkceManager.getPKPair();
|
|
3441
|
-
case 8:
|
|
3442
|
-
t = _context5.sent;
|
|
3443
|
-
_context5.t0 = t;
|
|
3444
|
-
if (_context5.t0) {
|
|
3445
|
-
_context5.next = 14;
|
|
3446
|
-
break;
|
|
3447
|
-
}
|
|
3448
|
-
_context5.next = 13;
|
|
3449
|
-
return this._pkceManager.startPKCETransaction();
|
|
3450
|
-
case 13:
|
|
3451
|
-
t = _context5.sent;
|
|
3452
|
-
case 14:
|
|
3453
|
-
return _context5.abrupt("return", t.code_challenge);
|
|
3454
|
-
case 15:
|
|
3455
|
-
case "end":
|
|
3456
|
-
return _context5.stop();
|
|
3457
|
-
}
|
|
3458
|
-
}, _callee5, this);
|
|
3459
|
-
}));
|
|
3460
|
-
}
|
|
3461
|
-
}, {
|
|
3462
|
-
key: "authenticate",
|
|
3463
|
-
value: function authenticate(e) {
|
|
3464
|
-
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3465
|
-
var t, r, _yield$this$dfpProtec, n, i, o;
|
|
3466
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3467
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
3468
|
-
case 0:
|
|
3469
|
-
gt("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);
|
|
3470
|
-
_context6.next = 3;
|
|
3471
|
-
return this._pkceManager.getPKPair();
|
|
3472
|
-
case 3:
|
|
3473
|
-
t = _context6.sent;
|
|
3474
|
-
r = null == t ? void 0 : t.code_verifier;
|
|
3475
|
-
_context6.next = 7;
|
|
3476
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3477
|
-
case 7:
|
|
3478
|
-
_yield$this$dfpProtec = _context6.sent;
|
|
3479
|
-
n = _yield$this$dfpProtec.dfp_telemetry_id;
|
|
3480
|
-
i = _yield$this$dfpProtec.captcha_token;
|
|
3481
|
-
_context6.next = 12;
|
|
3482
|
-
return this._networkClient.retriableFetchSDK({
|
|
3483
|
-
url: "/b2b/passwords/authenticate",
|
|
3484
|
-
method: "POST",
|
|
3485
|
-
errorMessage: "Failed to authenticate password.",
|
|
3486
|
-
body: {
|
|
3487
|
-
organization_id: e.organization_id,
|
|
3488
|
-
email_address: e.email_address,
|
|
3489
|
-
password: e.password,
|
|
3490
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3491
|
-
locale: e.locale,
|
|
3492
|
-
captcha_token: i,
|
|
3493
|
-
dfp_telemetry_id: n,
|
|
3494
|
-
code_verifier: r
|
|
3495
|
-
},
|
|
3496
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3497
|
-
});
|
|
3498
|
-
case 12:
|
|
3499
|
-
o = _context6.sent;
|
|
3500
|
-
return _context6.abrupt("return", (o.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3501
|
-
state: {
|
|
3502
|
-
session: o.member_session,
|
|
3503
|
-
member: o.member,
|
|
3504
|
-
organization: o.organization
|
|
3505
|
-
},
|
|
3506
|
-
session_token: o.session_token,
|
|
3507
|
-
session_jwt: o.session_jwt,
|
|
3508
|
-
intermediate_session_token: null
|
|
3509
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3510
|
-
state: null,
|
|
3511
|
-
session_token: null,
|
|
3512
|
-
session_jwt: null,
|
|
3513
|
-
intermediate_session_token: o.intermediate_session_token
|
|
3514
|
-
}), o));
|
|
3515
|
-
case 14:
|
|
3516
|
-
case "end":
|
|
3517
|
-
return _context6.stop();
|
|
3518
|
-
}
|
|
3519
|
-
}, _callee6, this);
|
|
3520
|
-
}));
|
|
3521
|
-
}
|
|
3522
|
-
}, {
|
|
3523
|
-
key: "resetByEmailStart",
|
|
3524
|
-
value: function resetByEmailStart(e) {
|
|
3525
|
-
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3526
|
-
var t, _yield$this$dfpProtec2, r, n;
|
|
3527
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3528
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
3529
|
-
case 0:
|
|
3530
|
-
gt("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);
|
|
3531
|
-
_context7.next = 3;
|
|
3532
|
-
return this.getCodeChallenge();
|
|
3533
|
-
case 3:
|
|
3534
|
-
t = _context7.sent;
|
|
3535
|
-
_context7.next = 6;
|
|
3536
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3537
|
-
case 6:
|
|
3538
|
-
_yield$this$dfpProtec2 = _context7.sent;
|
|
3539
|
-
r = _yield$this$dfpProtec2.dfp_telemetry_id;
|
|
3540
|
-
n = _yield$this$dfpProtec2.captcha_token;
|
|
3541
|
-
return _context7.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
3542
|
-
url: "/b2b/passwords/email/reset/start",
|
|
3543
|
-
method: "POST",
|
|
3544
|
-
errorMessage: "Failed to start password reset flow.",
|
|
3545
|
-
body: {
|
|
3546
|
-
organization_id: e.organization_id,
|
|
3547
|
-
email_address: e.email_address,
|
|
3548
|
-
login_redirect_url: e.login_redirect_url,
|
|
3549
|
-
reset_password_redirect_url: e.reset_password_redirect_url,
|
|
3550
|
-
reset_password_expiration_minutes: e.reset_password_expiration_minutes,
|
|
3551
|
-
reset_password_template_id: e.reset_password_template_id,
|
|
3552
|
-
code_challenge: t,
|
|
3553
|
-
captcha_token: n,
|
|
3554
|
-
dfp_telemetry_id: r
|
|
3555
|
-
},
|
|
3556
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3557
|
-
}));
|
|
3558
|
-
case 10:
|
|
3559
|
-
case "end":
|
|
3560
|
-
return _context7.stop();
|
|
3561
|
-
}
|
|
3562
|
-
}, _callee7, this);
|
|
3563
|
-
}));
|
|
3564
|
-
}
|
|
3565
3495
|
}, {
|
|
3566
|
-
key: "
|
|
3567
|
-
value: function
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3576
|
-
case 3:
|
|
3577
|
-
_yield$this$dfpProtec3 = _context8.sent;
|
|
3578
|
-
t = _yield$this$dfpProtec3.dfp_telemetry_id;
|
|
3579
|
-
r = _yield$this$dfpProtec3.captcha_token;
|
|
3580
|
-
_context8.next = 8;
|
|
3581
|
-
return this._pkceManager.getPKPair();
|
|
3582
|
-
case 8:
|
|
3583
|
-
n = _context8.sent;
|
|
3584
|
-
i = null == n ? void 0 : n.code_verifier;
|
|
3585
|
-
_context8.next = 12;
|
|
3586
|
-
return this._networkClient.retriableFetchSDK({
|
|
3587
|
-
url: "/b2b/passwords/email/reset",
|
|
3588
|
-
method: "POST",
|
|
3589
|
-
errorMessage: "Failed to reset password.",
|
|
3590
|
-
body: {
|
|
3591
|
-
password_reset_token: e.password_reset_token,
|
|
3592
|
-
password: e.password,
|
|
3593
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3594
|
-
locale: e.locale,
|
|
3595
|
-
captcha_token: r,
|
|
3596
|
-
dfp_telemetry_id: t,
|
|
3597
|
-
code_verifier: i
|
|
3598
|
-
},
|
|
3599
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3600
|
-
});
|
|
3601
|
-
case 12:
|
|
3602
|
-
o = _context8.sent;
|
|
3603
|
-
return _context8.abrupt("return", (this._pkceManager.clearPKPair(), o.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3604
|
-
state: {
|
|
3605
|
-
session: o.member_session,
|
|
3606
|
-
member: o.member,
|
|
3607
|
-
organization: o.organization
|
|
3608
|
-
},
|
|
3609
|
-
session_token: o.session_token,
|
|
3610
|
-
session_jwt: o.session_jwt,
|
|
3611
|
-
intermediate_session_token: null
|
|
3612
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3613
|
-
state: null,
|
|
3614
|
-
session_token: null,
|
|
3615
|
-
session_jwt: null,
|
|
3616
|
-
intermediate_session_token: o.intermediate_session_token
|
|
3617
|
-
}), o));
|
|
3618
|
-
case 14:
|
|
3619
|
-
case "end":
|
|
3620
|
-
return _context8.stop();
|
|
3621
|
-
}
|
|
3622
|
-
}, _callee8, this);
|
|
3623
|
-
}));
|
|
3624
|
-
}
|
|
3625
|
-
}, {
|
|
3626
|
-
key: "resetByExistingPassword",
|
|
3627
|
-
value: function resetByExistingPassword(e) {
|
|
3628
|
-
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3629
|
-
var _yield$this$dfpProtec4, t, r, n;
|
|
3630
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3631
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
3632
|
-
case 0:
|
|
3633
|
-
gt("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
|
|
3634
|
-
_context9.next = 3;
|
|
3635
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3636
|
-
case 3:
|
|
3637
|
-
_yield$this$dfpProtec4 = _context9.sent;
|
|
3638
|
-
t = _yield$this$dfpProtec4.dfp_telemetry_id;
|
|
3639
|
-
r = _yield$this$dfpProtec4.captcha_token;
|
|
3640
|
-
_context9.next = 8;
|
|
3641
|
-
return this._networkClient.retriableFetchSDK({
|
|
3642
|
-
url: "/b2b/passwords/existing_password/reset",
|
|
3643
|
-
method: "POST",
|
|
3644
|
-
errorMessage: "Failed to reset password.",
|
|
3645
|
-
body: {
|
|
3646
|
-
organization_id: e.organization_id,
|
|
3647
|
-
email_address: e.email_address,
|
|
3648
|
-
existing_password: e.existing_password,
|
|
3649
|
-
new_password: e.new_password,
|
|
3650
|
-
locale: e.locale,
|
|
3651
|
-
session_duration_minutes: e.session_duration_minutes,
|
|
3652
|
-
captcha_token: r,
|
|
3653
|
-
dfp_telemetry_id: t
|
|
3654
|
-
},
|
|
3655
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3656
|
-
});
|
|
3657
|
-
case 8:
|
|
3658
|
-
n = _context9.sent;
|
|
3659
|
-
return _context9.abrupt("return", (n.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
3660
|
-
state: {
|
|
3661
|
-
session: n.member_session,
|
|
3662
|
-
member: n.member,
|
|
3663
|
-
organization: n.organization
|
|
3664
|
-
},
|
|
3665
|
-
session_token: n.session_token,
|
|
3666
|
-
session_jwt: n.session_jwt,
|
|
3667
|
-
intermediate_session_token: null
|
|
3668
|
-
}) : this._subscriptionService.updateStateAndTokens({
|
|
3669
|
-
state: null,
|
|
3670
|
-
session_token: null,
|
|
3671
|
-
session_jwt: null,
|
|
3672
|
-
intermediate_session_token: n.intermediate_session_token
|
|
3673
|
-
}), n));
|
|
3674
|
-
case 10:
|
|
3675
|
-
case "end":
|
|
3676
|
-
return _context9.stop();
|
|
3677
|
-
}
|
|
3678
|
-
}, _callee9, this);
|
|
3679
|
-
}));
|
|
3680
|
-
}
|
|
3681
|
-
}, {
|
|
3682
|
-
key: "resetBySession",
|
|
3683
|
-
value: function resetBySession(e) {
|
|
3684
|
-
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3685
|
-
var _yield$this$dfpProtec5, t, r, n;
|
|
3686
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3687
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
3688
|
-
case 0:
|
|
3689
|
-
gt("stytch.passwords.resetBySession").isString("password", e.password);
|
|
3690
|
-
_context10.next = 3;
|
|
3691
|
-
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3692
|
-
case 3:
|
|
3693
|
-
_yield$this$dfpProtec5 = _context10.sent;
|
|
3694
|
-
t = _yield$this$dfpProtec5.dfp_telemetry_id;
|
|
3695
|
-
r = _yield$this$dfpProtec5.captcha_token;
|
|
3696
|
-
_context10.next = 8;
|
|
3697
|
-
return this._networkClient.retriableFetchSDK({
|
|
3698
|
-
url: "/b2b/passwords/session/reset",
|
|
3699
|
-
method: "POST",
|
|
3700
|
-
errorMessage: "Failed to reset by session.",
|
|
3701
|
-
body: {
|
|
3702
|
-
password: e.password,
|
|
3703
|
-
captcha_token: r,
|
|
3704
|
-
dfp_telemetry_id: t
|
|
3705
|
-
},
|
|
3706
|
-
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3707
|
-
});
|
|
3708
|
-
case 8:
|
|
3709
|
-
n = _context10.sent;
|
|
3710
|
-
return _context10.abrupt("return", (this._subscriptionService.updateStateAndTokens({
|
|
3711
|
-
state: {
|
|
3712
|
-
session: n.member_session,
|
|
3713
|
-
member: n.member,
|
|
3714
|
-
organization: n.organization
|
|
3715
|
-
},
|
|
3716
|
-
session_token: n.session_token,
|
|
3717
|
-
session_jwt: n.session_jwt,
|
|
3718
|
-
intermediate_session_token: null
|
|
3719
|
-
}), n));
|
|
3720
|
-
case 10:
|
|
3721
|
-
case "end":
|
|
3722
|
-
return _context10.stop();
|
|
3723
|
-
}
|
|
3724
|
-
}, _callee10, this);
|
|
3725
|
-
}));
|
|
3496
|
+
key: "allPermissionsForCaller",
|
|
3497
|
+
value: function value(e) {
|
|
3498
|
+
var t = this,
|
|
3499
|
+
r = {};
|
|
3500
|
+
return this.resources.forEach(function (n) {
|
|
3501
|
+
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3502
|
+
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3503
|
+
});
|
|
3504
|
+
}), r;
|
|
3726
3505
|
}
|
|
3727
|
-
}, {
|
|
3728
|
-
key: "
|
|
3729
|
-
value: function
|
|
3730
|
-
return
|
|
3731
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
3732
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
3733
|
-
case 0:
|
|
3734
|
-
return _context11.abrupt("return", (gt("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
|
|
3735
|
-
url: "/b2b/passwords/strength_check",
|
|
3736
|
-
method: "POST",
|
|
3737
|
-
errorMessage: "Failed to check password strength.",
|
|
3738
|
-
body: {
|
|
3739
|
-
email_address: e.email_address,
|
|
3740
|
-
password: e.password
|
|
3741
|
-
}
|
|
3742
|
-
})));
|
|
3743
|
-
case 1:
|
|
3744
|
-
case "end":
|
|
3745
|
-
return _context11.stop();
|
|
3746
|
-
}
|
|
3747
|
-
}, _callee11, this);
|
|
3748
|
-
}));
|
|
3506
|
+
}], [{
|
|
3507
|
+
key: "fromJSON",
|
|
3508
|
+
value: function value(t) {
|
|
3509
|
+
return new e(t.roles, t.resources);
|
|
3749
3510
|
}
|
|
3750
|
-
}]);
|
|
3751
|
-
return wt;
|
|
3511
|
+
}]), e;
|
|
3752
3512
|
}();
|
|
3753
|
-
var
|
|
3754
|
-
var
|
|
3755
|
-
function
|
|
3756
|
-
var
|
|
3757
|
-
_classCallCheck(this,
|
|
3513
|
+
var ut = "bootstrap";
|
|
3514
|
+
var lt = /*#__PURE__*/function () {
|
|
3515
|
+
function lt(e, t, r) {
|
|
3516
|
+
var _this = this;
|
|
3517
|
+
_classCallCheck(this, lt);
|
|
3758
3518
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3759
3519
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3760
3520
|
method: "GET",
|
|
3761
3521
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3762
|
-
}).then(
|
|
3763
|
-
return
|
|
3522
|
+
}).then(lt.mapBootstrapData).then(function (e) {
|
|
3523
|
+
return _this._dataLayer.setItem(ut, JSON.stringify(e)), e;
|
|
3764
3524
|
})["catch"](function (e) {
|
|
3765
|
-
return
|
|
3525
|
+
return ze(e), {
|
|
3766
3526
|
displayWatermark: !1,
|
|
3767
3527
|
cnameDomain: null,
|
|
3768
3528
|
emailDomains: ["stytch.com"],
|
|
@@ -3781,10 +3541,10 @@ var Pt = /*#__PURE__*/function () {
|
|
|
3781
3541
|
};
|
|
3782
3542
|
});
|
|
3783
3543
|
}
|
|
3784
|
-
_createClass(
|
|
3544
|
+
_createClass(lt, [{
|
|
3785
3545
|
key: "getSync",
|
|
3786
3546
|
value: function getSync() {
|
|
3787
|
-
var e = this._dataLayer.getItem(
|
|
3547
|
+
var e = this._dataLayer.getItem(ut);
|
|
3788
3548
|
if (null === e) return {
|
|
3789
3549
|
displayWatermark: !1,
|
|
3790
3550
|
cnameDomain: null,
|
|
@@ -3855,9 +3615,9 @@ var Pt = /*#__PURE__*/function () {
|
|
|
3855
3615
|
};
|
|
3856
3616
|
}
|
|
3857
3617
|
}]);
|
|
3858
|
-
return
|
|
3618
|
+
return lt;
|
|
3859
3619
|
}();
|
|
3860
|
-
function
|
|
3620
|
+
function dt(e, t, r, n) {
|
|
3861
3621
|
return new (r || (r = Promise))(function (i, o) {
|
|
3862
3622
|
function s(e) {
|
|
3863
3623
|
try {
|
|
@@ -3883,91 +3643,91 @@ function Ct(e, t, r, n) {
|
|
|
3883
3643
|
});
|
|
3884
3644
|
}
|
|
3885
3645
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3886
|
-
var
|
|
3887
|
-
var
|
|
3888
|
-
_classCallCheck(this,
|
|
3646
|
+
var ht = /*#__PURE__*/_createClass(function ht(e) {
|
|
3647
|
+
var _this2 = this;
|
|
3648
|
+
_classCallCheck(this, ht);
|
|
3889
3649
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3890
|
-
return
|
|
3650
|
+
return dt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3891
3651
|
var _yield$this$state, e, t, r;
|
|
3892
|
-
return _regeneratorRuntime().wrap(function
|
|
3893
|
-
while (1) switch (
|
|
3652
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3653
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3894
3654
|
case 0:
|
|
3895
|
-
|
|
3655
|
+
_context.next = 2;
|
|
3896
3656
|
return this.state;
|
|
3897
3657
|
case 2:
|
|
3898
|
-
_yield$this$state =
|
|
3658
|
+
_yield$this$state = _context.sent;
|
|
3899
3659
|
e = _yield$this$state.captchaClient;
|
|
3900
3660
|
t = _yield$this$state.configured;
|
|
3901
3661
|
r = _yield$this$state.siteKey;
|
|
3902
3662
|
if (!t) {
|
|
3903
|
-
|
|
3663
|
+
_context.next = 10;
|
|
3904
3664
|
break;
|
|
3905
3665
|
}
|
|
3906
|
-
|
|
3666
|
+
_context.next = 9;
|
|
3907
3667
|
return new Promise(function (t) {
|
|
3908
3668
|
return e.ready(t);
|
|
3909
3669
|
});
|
|
3910
3670
|
case 9:
|
|
3911
|
-
return
|
|
3671
|
+
return _context.abrupt("return", e.execute(r, {
|
|
3912
3672
|
action: "LOGIN"
|
|
3913
3673
|
}));
|
|
3914
3674
|
case 10:
|
|
3915
3675
|
case "end":
|
|
3916
|
-
return
|
|
3676
|
+
return _context.stop();
|
|
3917
3677
|
}
|
|
3918
|
-
},
|
|
3678
|
+
}, _callee, this);
|
|
3919
3679
|
}));
|
|
3920
3680
|
}, this.state = e.then(function (e) {
|
|
3921
|
-
return
|
|
3681
|
+
return dt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3922
3682
|
var t;
|
|
3923
|
-
return _regeneratorRuntime().wrap(function
|
|
3924
|
-
while (1) switch (
|
|
3683
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3684
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3925
3685
|
case 0:
|
|
3926
3686
|
if (!e.captchaSettings.enabled) {
|
|
3927
|
-
|
|
3687
|
+
_context2.next = 9;
|
|
3928
3688
|
break;
|
|
3929
3689
|
}
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
return t = e.captchaSettings.siteKey,
|
|
3690
|
+
_context2.t1 = !0;
|
|
3691
|
+
_context2.next = 4;
|
|
3692
|
+
return t = e.captchaSettings.siteKey, Fe("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3933
3693
|
return window.grecaptcha.enterprise;
|
|
3934
3694
|
});
|
|
3935
3695
|
case 4:
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
configured:
|
|
3940
|
-
captchaClient:
|
|
3941
|
-
siteKey:
|
|
3696
|
+
_context2.t2 = _context2.sent;
|
|
3697
|
+
_context2.t3 = e.captchaSettings.siteKey;
|
|
3698
|
+
_context2.t0 = {
|
|
3699
|
+
configured: _context2.t1,
|
|
3700
|
+
captchaClient: _context2.t2,
|
|
3701
|
+
siteKey: _context2.t3
|
|
3942
3702
|
};
|
|
3943
|
-
|
|
3703
|
+
_context2.next = 10;
|
|
3944
3704
|
break;
|
|
3945
3705
|
case 9:
|
|
3946
|
-
|
|
3706
|
+
_context2.t0 = {
|
|
3947
3707
|
configured: !1
|
|
3948
3708
|
};
|
|
3949
3709
|
case 10:
|
|
3950
|
-
return
|
|
3710
|
+
return _context2.abrupt("return", _context2.t0);
|
|
3951
3711
|
case 11:
|
|
3952
3712
|
case "end":
|
|
3953
|
-
return
|
|
3713
|
+
return _context2.stop();
|
|
3954
3714
|
}
|
|
3955
|
-
},
|
|
3715
|
+
}, _callee2);
|
|
3956
3716
|
}));
|
|
3957
3717
|
});
|
|
3958
3718
|
});
|
|
3959
|
-
var
|
|
3960
|
-
function
|
|
3961
|
-
_classCallCheck(this,
|
|
3719
|
+
var pt = /*#__PURE__*/function () {
|
|
3720
|
+
function pt(e, t, r, n) {
|
|
3721
|
+
_classCallCheck(this, pt);
|
|
3962
3722
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3963
3723
|
return null;
|
|
3964
|
-
}, this.eventLogger = new
|
|
3724
|
+
}, this.eventLogger = new Ge({
|
|
3965
3725
|
maxBatchSize: 15,
|
|
3966
3726
|
intervalDurationMs: 800,
|
|
3967
3727
|
logEventURL: this.buildSDKUrl("/events")
|
|
3968
3728
|
});
|
|
3969
3729
|
}
|
|
3970
|
-
_createClass(
|
|
3730
|
+
_createClass(pt, [{
|
|
3971
3731
|
key: "logEvent",
|
|
3972
3732
|
value: function logEvent(_ref) {
|
|
3973
3733
|
var e = _ref.name,
|
|
@@ -3998,7 +3758,7 @@ var Tt = /*#__PURE__*/function () {
|
|
|
3998
3758
|
},
|
|
3999
3759
|
sdk: {
|
|
4000
3760
|
identifier: "Stytch.js Javascript SDK",
|
|
4001
|
-
version: "4.5.
|
|
3761
|
+
version: "4.5.5"
|
|
4002
3762
|
}
|
|
4003
3763
|
});
|
|
4004
3764
|
}
|
|
@@ -4009,13 +3769,13 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4009
3769
|
t = _ref2.body,
|
|
4010
3770
|
r = _ref2.errorMessage,
|
|
4011
3771
|
n = _ref2.method;
|
|
4012
|
-
return
|
|
3772
|
+
return dt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
4013
3773
|
var i, o, s, a;
|
|
4014
|
-
return _regeneratorRuntime().wrap(function
|
|
4015
|
-
while (1) switch (
|
|
3774
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3775
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4016
3776
|
case 0:
|
|
4017
3777
|
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;
|
|
4018
|
-
return
|
|
3778
|
+
return _context3.abrupt("return", Pe({
|
|
4019
3779
|
basicAuthHeader: o,
|
|
4020
3780
|
body: t,
|
|
4021
3781
|
errorMessage: r,
|
|
@@ -4026,9 +3786,9 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4026
3786
|
}));
|
|
4027
3787
|
case 2:
|
|
4028
3788
|
case "end":
|
|
4029
|
-
return
|
|
3789
|
+
return _context3.stop();
|
|
4030
3790
|
}
|
|
4031
|
-
},
|
|
3791
|
+
}, _callee3, this);
|
|
4032
3792
|
}));
|
|
4033
3793
|
}
|
|
4034
3794
|
}, {
|
|
@@ -4039,13 +3799,13 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4039
3799
|
r = _ref3.errorMessage,
|
|
4040
3800
|
n = _ref3.method,
|
|
4041
3801
|
i = _ref3.retryCallback;
|
|
4042
|
-
return
|
|
3802
|
+
return dt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
4043
3803
|
var o, s, a, c;
|
|
4044
|
-
return _regeneratorRuntime().wrap(function
|
|
4045
|
-
while (1) switch (
|
|
3804
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3805
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
4046
3806
|
case 0:
|
|
4047
3807
|
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;
|
|
4048
|
-
return
|
|
3808
|
+
return _context4.abrupt("return", function (e) {
|
|
4049
3809
|
var t = e.method,
|
|
4050
3810
|
r = e.errorMessage,
|
|
4051
3811
|
n = e.finalURL,
|
|
@@ -4067,18 +3827,18 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4067
3827
|
xSDKClientHeader: o,
|
|
4068
3828
|
xSDKParentHostHeader: s,
|
|
4069
3829
|
body: a
|
|
4070
|
-
}, e.prev = 1, e.next = 4,
|
|
3830
|
+
}, e.prev = 1, e.next = 4, Pe(u);
|
|
4071
3831
|
case 4:
|
|
4072
3832
|
case 15:
|
|
4073
3833
|
return e.abrupt("return", e.sent);
|
|
4074
3834
|
case 7:
|
|
4075
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3835
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Ce)) {
|
|
4076
3836
|
e.next = 16;
|
|
4077
3837
|
break;
|
|
4078
3838
|
}
|
|
4079
3839
|
return e.next = 12, c(e.t0, u);
|
|
4080
3840
|
case 12:
|
|
4081
|
-
return u = e.sent, e.next = 15,
|
|
3841
|
+
return u = e.sent, e.next = 15, Pe(u);
|
|
4082
3842
|
case 16:
|
|
4083
3843
|
throw e.t0;
|
|
4084
3844
|
case 17:
|
|
@@ -4099,9 +3859,9 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4099
3859
|
}));
|
|
4100
3860
|
case 2:
|
|
4101
3861
|
case "end":
|
|
4102
|
-
return
|
|
3862
|
+
return _context4.stop();
|
|
4103
3863
|
}
|
|
4104
|
-
},
|
|
3864
|
+
}, _callee4, this);
|
|
4105
3865
|
}));
|
|
4106
3866
|
}
|
|
4107
3867
|
}, {
|
|
@@ -4110,18 +3870,18 @@ var Tt = /*#__PURE__*/function () {
|
|
|
4110
3870
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4111
3871
|
}
|
|
4112
3872
|
}]);
|
|
4113
|
-
return
|
|
3873
|
+
return pt;
|
|
4114
3874
|
}();
|
|
4115
|
-
function
|
|
3875
|
+
function _t(e) {
|
|
4116
3876
|
var t = e.toString(16);
|
|
4117
3877
|
return 1 === t.length && (t = "0" + t), t;
|
|
4118
3878
|
}
|
|
4119
|
-
var
|
|
4120
|
-
function
|
|
4121
|
-
_classCallCheck(this,
|
|
3879
|
+
var ft = /*#__PURE__*/function () {
|
|
3880
|
+
function ft(e, t) {
|
|
3881
|
+
_classCallCheck(this, ft);
|
|
4122
3882
|
this._dataLayer = e, this.namespace = t;
|
|
4123
3883
|
}
|
|
4124
|
-
_createClass(
|
|
3884
|
+
_createClass(ft, [{
|
|
4125
3885
|
key: "key",
|
|
4126
3886
|
value: function key() {
|
|
4127
3887
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4129,21 +3889,21 @@ var Et = /*#__PURE__*/function () {
|
|
|
4129
3889
|
}, {
|
|
4130
3890
|
key: "startPKCETransaction",
|
|
4131
3891
|
value: function startPKCETransaction() {
|
|
4132
|
-
return
|
|
3892
|
+
return dt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4133
3893
|
var e;
|
|
4134
|
-
return _regeneratorRuntime().wrap(function
|
|
4135
|
-
while (1) switch (
|
|
3894
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3895
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
4136
3896
|
case 0:
|
|
4137
|
-
|
|
4138
|
-
return
|
|
3897
|
+
_context5.next = 2;
|
|
3898
|
+
return ft.createProofkeyPair();
|
|
4139
3899
|
case 2:
|
|
4140
|
-
e =
|
|
4141
|
-
return
|
|
3900
|
+
e = _context5.sent;
|
|
3901
|
+
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
4142
3902
|
case 4:
|
|
4143
3903
|
case "end":
|
|
4144
|
-
return
|
|
3904
|
+
return _context5.stop();
|
|
4145
3905
|
}
|
|
4146
|
-
},
|
|
3906
|
+
}, _callee5, this);
|
|
4147
3907
|
}));
|
|
4148
3908
|
}
|
|
4149
3909
|
}, {
|
|
@@ -4164,39 +3924,39 @@ var Et = /*#__PURE__*/function () {
|
|
|
4164
3924
|
}], [{
|
|
4165
3925
|
key: "createProofkeyPair",
|
|
4166
3926
|
value: function createProofkeyPair() {
|
|
4167
|
-
return
|
|
3927
|
+
return dt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4168
3928
|
var _String$fromCharCode;
|
|
4169
3929
|
var e, t, r, n;
|
|
4170
|
-
return _regeneratorRuntime().wrap(function
|
|
4171
|
-
while (1) switch (
|
|
3930
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3931
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4172
3932
|
case 0:
|
|
4173
3933
|
e = new Uint32Array(16);
|
|
4174
3934
|
window.crypto.getRandomValues(e);
|
|
4175
|
-
t = Array.from(e).map(
|
|
4176
|
-
|
|
3935
|
+
t = Array.from(e).map(_t).join("");
|
|
3936
|
+
_context6.next = 5;
|
|
4177
3937
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4178
3938
|
case 5:
|
|
4179
|
-
r =
|
|
4180
|
-
return
|
|
3939
|
+
r = _context6.sent;
|
|
3940
|
+
return _context6.abrupt("return", {
|
|
4181
3941
|
code_challenge: (n = r, btoa((_String$fromCharCode = String.fromCharCode).call.apply(_String$fromCharCode, [null].concat(_toConsumableArray(new Uint8Array(n))))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")),
|
|
4182
3942
|
code_verifier: t
|
|
4183
3943
|
});
|
|
4184
3944
|
case 7:
|
|
4185
3945
|
case "end":
|
|
4186
|
-
return
|
|
3946
|
+
return _context6.stop();
|
|
4187
3947
|
}
|
|
4188
|
-
},
|
|
3948
|
+
}, _callee6);
|
|
4189
3949
|
}));
|
|
4190
3950
|
}
|
|
4191
3951
|
}]);
|
|
4192
|
-
return
|
|
3952
|
+
return ft;
|
|
4193
3953
|
}();
|
|
4194
|
-
var
|
|
4195
|
-
function
|
|
4196
|
-
_classCallCheck(this,
|
|
3954
|
+
var mt = /*#__PURE__*/function () {
|
|
3955
|
+
function mt(e) {
|
|
3956
|
+
_classCallCheck(this, mt);
|
|
4197
3957
|
this._networkClient = e;
|
|
4198
3958
|
}
|
|
4199
|
-
_createClass(
|
|
3959
|
+
_createClass(mt, [{
|
|
4200
3960
|
key: "searchUser",
|
|
4201
3961
|
value: function searchUser(e) {
|
|
4202
3962
|
return this._networkClient.fetchSDK({
|
|
@@ -4234,9 +3994,9 @@ var xt = /*#__PURE__*/function () {
|
|
|
4234
3994
|
});
|
|
4235
3995
|
}
|
|
4236
3996
|
}]);
|
|
4237
|
-
return
|
|
3997
|
+
return mt;
|
|
4238
3998
|
}();
|
|
4239
|
-
var
|
|
3999
|
+
var vt = function vt(e) {
|
|
4240
4000
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4241
4001
|
var _t$split = t.split("="),
|
|
4242
4002
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4245,17 +4005,17 @@ var Dt = function Dt(e) {
|
|
|
4245
4005
|
}).length > 1;
|
|
4246
4006
|
};
|
|
4247
4007
|
/*! js-cookie v3.0.1 | MIT */
|
|
4248
|
-
function
|
|
4008
|
+
function bt(e) {
|
|
4249
4009
|
for (var t = 1; t < arguments.length; t++) {
|
|
4250
4010
|
var r = arguments[t];
|
|
4251
4011
|
for (var n in r) e[n] = r[n];
|
|
4252
4012
|
}
|
|
4253
4013
|
return e;
|
|
4254
4014
|
}
|
|
4255
|
-
var
|
|
4015
|
+
var gt = function e(t, r) {
|
|
4256
4016
|
function n(e, n, i) {
|
|
4257
4017
|
if ("undefined" != typeof document) {
|
|
4258
|
-
"number" == typeof (i =
|
|
4018
|
+
"number" == typeof (i = bt({}, 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);
|
|
4259
4019
|
var o = "";
|
|
4260
4020
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4261
4021
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4277,15 +4037,15 @@ var Rt = function e(t, r) {
|
|
|
4277
4037
|
}
|
|
4278
4038
|
},
|
|
4279
4039
|
remove: function remove(e, t) {
|
|
4280
|
-
n(e, "",
|
|
4040
|
+
n(e, "", bt({}, t, {
|
|
4281
4041
|
expires: -1
|
|
4282
4042
|
}));
|
|
4283
4043
|
},
|
|
4284
4044
|
withAttributes: function withAttributes(t) {
|
|
4285
|
-
return e(this.converter,
|
|
4045
|
+
return e(this.converter, bt({}, this.attributes, t));
|
|
4286
4046
|
},
|
|
4287
4047
|
withConverter: function withConverter(t) {
|
|
4288
|
-
return e(
|
|
4048
|
+
return e(bt({}, this.converter, t), this.attributes);
|
|
4289
4049
|
}
|
|
4290
4050
|
}, {
|
|
4291
4051
|
attributes: {
|
|
@@ -4305,37 +4065,37 @@ var Rt = function e(t, r) {
|
|
|
4305
4065
|
}, {
|
|
4306
4066
|
path: "/"
|
|
4307
4067
|
});
|
|
4308
|
-
var
|
|
4068
|
+
var kt = function kt(e) {
|
|
4309
4069
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4310
4070
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4311
4071
|
},
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
clearTimeout(
|
|
4072
|
+
yt = new Map(),
|
|
4073
|
+
wt = function wt(e) {
|
|
4074
|
+
clearTimeout(yt.get(e));
|
|
4315
4075
|
},
|
|
4316
|
-
|
|
4317
|
-
|
|
4076
|
+
St = function St(e, t, r) {
|
|
4077
|
+
wt(e);
|
|
4318
4078
|
var n = setTimeout(function () {
|
|
4319
|
-
void 0 ===
|
|
4079
|
+
void 0 === gt.get(e) && gt.set(e, t, r);
|
|
4320
4080
|
}, 10);
|
|
4321
|
-
return
|
|
4081
|
+
return yt.set(e, n), gt.set(e, t, r);
|
|
4322
4082
|
};
|
|
4323
|
-
var
|
|
4324
|
-
function
|
|
4325
|
-
var
|
|
4326
|
-
_classCallCheck(this,
|
|
4083
|
+
var Ct = /*#__PURE__*/function () {
|
|
4084
|
+
function Ct(e, t) {
|
|
4085
|
+
var _this3 = this;
|
|
4086
|
+
_classCallCheck(this, Ct);
|
|
4327
4087
|
this.browserSessionStorage = {
|
|
4328
4088
|
getItem: function getItem(e) {
|
|
4329
|
-
return sessionStorage.getItem(
|
|
4089
|
+
return sessionStorage.getItem(kt(_this3.publicToken, e));
|
|
4330
4090
|
},
|
|
4331
4091
|
setItem: function setItem(e, t) {
|
|
4332
|
-
return sessionStorage.setItem(
|
|
4092
|
+
return sessionStorage.setItem(kt(_this3.publicToken, e), t);
|
|
4333
4093
|
},
|
|
4334
4094
|
removeItem: function removeItem(e) {
|
|
4335
|
-
return sessionStorage.removeItem(
|
|
4095
|
+
return sessionStorage.removeItem(kt(_this3.publicToken, e));
|
|
4336
4096
|
}
|
|
4337
4097
|
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("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);
|
|
4338
|
-
var r = localStorage.getItem(
|
|
4098
|
+
var r = localStorage.getItem(kt(this.publicToken));
|
|
4339
4099
|
if (!r) return;
|
|
4340
4100
|
var n;
|
|
4341
4101
|
try {
|
|
@@ -4345,7 +4105,7 @@ var jt = /*#__PURE__*/function () {
|
|
|
4345
4105
|
}
|
|
4346
4106
|
this.state = n;
|
|
4347
4107
|
}
|
|
4348
|
-
_createClass(
|
|
4108
|
+
_createClass(Ct, [{
|
|
4349
4109
|
key: "opaqueTokenCookieName",
|
|
4350
4110
|
get: function get() {
|
|
4351
4111
|
var e;
|
|
@@ -4367,14 +4127,14 @@ var jt = /*#__PURE__*/function () {
|
|
|
4367
4127
|
key: "readSessionCookie",
|
|
4368
4128
|
value: function readSessionCookie() {
|
|
4369
4129
|
return {
|
|
4370
|
-
session_token:
|
|
4371
|
-
session_jwt:
|
|
4130
|
+
session_token: gt.get(this.opaqueTokenCookieName),
|
|
4131
|
+
session_jwt: gt.get(this.jwtCookieName)
|
|
4372
4132
|
};
|
|
4373
4133
|
}
|
|
4374
4134
|
}, {
|
|
4375
4135
|
key: "readIntermediateSessionTokenCookie",
|
|
4376
4136
|
value: function readIntermediateSessionTokenCookie() {
|
|
4377
|
-
return
|
|
4137
|
+
return gt.get(this.istCookieName);
|
|
4378
4138
|
}
|
|
4379
4139
|
}, {
|
|
4380
4140
|
key: "writeSessionCookie",
|
|
@@ -4383,32 +4143,32 @@ var jt = /*#__PURE__*/function () {
|
|
|
4383
4143
|
var o = e.state,
|
|
4384
4144
|
s = e.session_token,
|
|
4385
4145
|
a = e.session_jwt,
|
|
4386
|
-
c =
|
|
4146
|
+
c = Ct.generateCookieOpts({
|
|
4387
4147
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4388
4148
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4389
4149
|
path: this._cookiePath,
|
|
4390
4150
|
domain: this._domain
|
|
4391
4151
|
});
|
|
4392
|
-
|
|
4393
|
-
var u =
|
|
4152
|
+
St(this.opaqueTokenCookieName, s, c), St(this.jwtCookieName, a, c);
|
|
4153
|
+
var u = Ct.generateCookieOpts({
|
|
4394
4154
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4395
4155
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4396
4156
|
path: this._cookiePath,
|
|
4397
4157
|
domain: this._domain
|
|
4398
4158
|
});
|
|
4399
|
-
|
|
4159
|
+
vt(this.jwtCookieName) && gt.remove(this.jwtCookieName, u), vt(this.opaqueTokenCookieName) && gt.remove(this.opaqueTokenCookieName, u), vt(this.jwtCookieName) && Ke("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), vt(this.opaqueTokenCookieName) && Ke("Could not remove extraneous opaque token cookie.");
|
|
4400
4160
|
}
|
|
4401
4161
|
}, {
|
|
4402
4162
|
key: "writeIntermediateSessionTokenCookie",
|
|
4403
4163
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4404
4164
|
var t = new Date(Date.now() + 6e5),
|
|
4405
|
-
r =
|
|
4165
|
+
r = Ct.generateCookieOpts({
|
|
4406
4166
|
expiresAt: t.toString(),
|
|
4407
4167
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4408
4168
|
path: this._cookiePath,
|
|
4409
4169
|
domain: this._domain
|
|
4410
4170
|
});
|
|
4411
|
-
|
|
4171
|
+
St(this.istCookieName, e, r);
|
|
4412
4172
|
}
|
|
4413
4173
|
}, {
|
|
4414
4174
|
key: "removeSessionCookie",
|
|
@@ -4423,50 +4183,50 @@ var jt = /*#__PURE__*/function () {
|
|
|
4423
4183
|
}, {
|
|
4424
4184
|
key: "removeCookies",
|
|
4425
4185
|
value: function removeCookies(e) {
|
|
4426
|
-
var
|
|
4186
|
+
var _this4 = this;
|
|
4427
4187
|
[!0, !1].forEach(function (t) {
|
|
4428
|
-
[
|
|
4429
|
-
[
|
|
4430
|
-
var i =
|
|
4188
|
+
[_this4._cookiePath, null].forEach(function (r) {
|
|
4189
|
+
[_this4._domain, null].forEach(function (n) {
|
|
4190
|
+
var i = Ct.generateCookieOpts({
|
|
4431
4191
|
expiresAt: new Date(0).toString(),
|
|
4432
4192
|
availableToSubdomains: t,
|
|
4433
4193
|
path: r,
|
|
4434
4194
|
domain: n
|
|
4435
4195
|
});
|
|
4436
4196
|
e.forEach(function (e) {
|
|
4437
|
-
|
|
4197
|
+
gt.remove(e, i);
|
|
4438
4198
|
});
|
|
4439
4199
|
});
|
|
4440
4200
|
});
|
|
4441
|
-
}), e.forEach(
|
|
4201
|
+
}), e.forEach(wt);
|
|
4442
4202
|
}
|
|
4443
4203
|
}, {
|
|
4444
4204
|
key: "syncToLocalStorage",
|
|
4445
4205
|
value: function syncToLocalStorage() {
|
|
4446
|
-
localStorage.setItem(
|
|
4206
|
+
localStorage.setItem(kt(this.publicToken), JSON.stringify(this.state));
|
|
4447
4207
|
}
|
|
4448
4208
|
}, {
|
|
4449
4209
|
key: "getItem",
|
|
4450
4210
|
value: function getItem(e) {
|
|
4451
|
-
return localStorage.getItem(
|
|
4211
|
+
return localStorage.getItem(kt(this.publicToken, e));
|
|
4452
4212
|
}
|
|
4453
4213
|
}, {
|
|
4454
4214
|
key: "setItem",
|
|
4455
4215
|
value: function setItem(e, t) {
|
|
4456
|
-
return localStorage.setItem(
|
|
4216
|
+
return localStorage.setItem(kt(this.publicToken, e), t);
|
|
4457
4217
|
}
|
|
4458
4218
|
}, {
|
|
4459
4219
|
key: "removeItem",
|
|
4460
4220
|
value: function removeItem(e) {
|
|
4461
|
-
return localStorage.removeItem(
|
|
4221
|
+
return localStorage.removeItem(kt(this.publicToken, e));
|
|
4462
4222
|
}
|
|
4463
4223
|
}, {
|
|
4464
4224
|
key: "markStateKeysUpdated",
|
|
4465
4225
|
value: function markStateKeysUpdated(e) {
|
|
4466
|
-
var
|
|
4226
|
+
var _this5 = this;
|
|
4467
4227
|
var t = this.stateKeysUpdated.size;
|
|
4468
4228
|
return e.forEach(function (e) {
|
|
4469
|
-
return
|
|
4229
|
+
return _this5.stateKeysUpdated.add(e);
|
|
4470
4230
|
}), t !== this.stateKeysUpdated.size;
|
|
4471
4231
|
}
|
|
4472
4232
|
}], [{
|
|
@@ -4483,30 +4243,30 @@ var jt = /*#__PURE__*/function () {
|
|
|
4483
4243
|
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;
|
|
4484
4244
|
}
|
|
4485
4245
|
}]);
|
|
4486
|
-
return
|
|
4246
|
+
return Ct;
|
|
4487
4247
|
}();
|
|
4488
|
-
var
|
|
4489
|
-
_inherits(
|
|
4490
|
-
function
|
|
4491
|
-
_classCallCheck(this,
|
|
4492
|
-
return _callSuper(this,
|
|
4248
|
+
var Pt = /*#__PURE__*/function (_Ct) {
|
|
4249
|
+
_inherits(Pt, _Ct);
|
|
4250
|
+
function Pt() {
|
|
4251
|
+
_classCallCheck(this, Pt);
|
|
4252
|
+
return _callSuper(this, Pt, arguments);
|
|
4493
4253
|
}
|
|
4494
|
-
return _createClass(
|
|
4495
|
-
}(
|
|
4496
|
-
var
|
|
4497
|
-
|
|
4254
|
+
return _createClass(Pt);
|
|
4255
|
+
}(Ct);
|
|
4256
|
+
var Tt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4257
|
+
xt = function xt(e, t) {
|
|
4498
4258
|
var r = function () {
|
|
4499
4259
|
var e = window;
|
|
4500
|
-
return e[
|
|
4260
|
+
return e[Tt] || (e[Tt] = {}), e[Tt];
|
|
4501
4261
|
}();
|
|
4502
|
-
return r[e] || (r[e] = new
|
|
4262
|
+
return r[e] || (r[e] = new Pt(e, t)), r[e];
|
|
4503
4263
|
},
|
|
4504
|
-
|
|
4264
|
+
Ot = function Ot(e, t) {
|
|
4505
4265
|
Object.values(e).forEach(function (e) {
|
|
4506
4266
|
return e(t);
|
|
4507
4267
|
});
|
|
4508
4268
|
},
|
|
4509
|
-
|
|
4269
|
+
At = function () {
|
|
4510
4270
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4511
4271
|
t = void 0 === e ? [] : e;
|
|
4512
4272
|
return function e(r, n) {
|
|
@@ -4525,20 +4285,20 @@ var Nt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4525
4285
|
}({
|
|
4526
4286
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4527
4287
|
});
|
|
4528
|
-
var
|
|
4529
|
-
function
|
|
4530
|
-
var
|
|
4531
|
-
_classCallCheck(this,
|
|
4288
|
+
var Et = /*#__PURE__*/function () {
|
|
4289
|
+
function Et(e, t) {
|
|
4290
|
+
var _this6 = this;
|
|
4291
|
+
_classCallCheck(this, Et);
|
|
4532
4292
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4533
|
-
if (e.key !==
|
|
4293
|
+
if (e.key !== kt(_this6._publicToken)) return;
|
|
4534
4294
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4535
|
-
|
|
4295
|
+
_this6.updateState(t);
|
|
4536
4296
|
}, window.addEventListener("storage", this._listen);
|
|
4537
4297
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4538
4298
|
r = _this$_datalayer$read.session_token;
|
|
4539
4299
|
r || this.destroySession();
|
|
4540
4300
|
}
|
|
4541
|
-
_createClass(
|
|
4301
|
+
_createClass(Et, [{
|
|
4542
4302
|
key: "getTokens",
|
|
4543
4303
|
value: function getTokens() {
|
|
4544
4304
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4576,7 +4336,7 @@ var Wt = /*#__PURE__*/function () {
|
|
|
4576
4336
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4577
4337
|
this._datalayer.state = r;
|
|
4578
4338
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4579
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4339
|
+
!this._datalayer.markStateKeysUpdated(n) && At(t, r) || Ot(this._datalayer.subscriptions, r);
|
|
4580
4340
|
}
|
|
4581
4341
|
}, {
|
|
4582
4342
|
key: "updateStateAndTokens",
|
|
@@ -4591,8 +4351,8 @@ var Wt = /*#__PURE__*/function () {
|
|
|
4591
4351
|
this._datalayer.state = r;
|
|
4592
4352
|
var n = e ? Object.keys(e) : [],
|
|
4593
4353
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4594
|
-
o = !
|
|
4595
|
-
(i || o) && (
|
|
4354
|
+
o = !At(t, r);
|
|
4355
|
+
(i || o) && (Ot(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4596
4356
|
}
|
|
4597
4357
|
}, {
|
|
4598
4358
|
key: "updateTokens",
|
|
@@ -4632,43 +4392,43 @@ var Wt = /*#__PURE__*/function () {
|
|
|
4632
4392
|
return null;
|
|
4633
4393
|
}
|
|
4634
4394
|
}]);
|
|
4635
|
-
return
|
|
4395
|
+
return Et;
|
|
4636
4396
|
}();
|
|
4637
|
-
var
|
|
4638
|
-
_inherits(
|
|
4639
|
-
function
|
|
4640
|
-
var
|
|
4641
|
-
_classCallCheck(this,
|
|
4642
|
-
|
|
4643
|
-
return
|
|
4397
|
+
var Dt = /*#__PURE__*/function (_Et) {
|
|
4398
|
+
_inherits(Dt, _Et);
|
|
4399
|
+
function Dt() {
|
|
4400
|
+
var _this7;
|
|
4401
|
+
_classCallCheck(this, Dt);
|
|
4402
|
+
_this7 = _callSuper(this, Dt, arguments), _this7.updateMember = function (e) {
|
|
4403
|
+
return _this7.updateState({
|
|
4644
4404
|
member: e
|
|
4645
4405
|
});
|
|
4646
|
-
},
|
|
4406
|
+
}, _this7.getMember = function () {
|
|
4647
4407
|
var e, t;
|
|
4648
|
-
return null !== (t = null === (e =
|
|
4649
|
-
},
|
|
4650
|
-
return
|
|
4408
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4409
|
+
}, _this7.updateOrganization = function (e) {
|
|
4410
|
+
return _this7.updateState({
|
|
4651
4411
|
organization: e
|
|
4652
4412
|
});
|
|
4653
|
-
},
|
|
4413
|
+
}, _this7.getOrganization = function () {
|
|
4654
4414
|
var e, t;
|
|
4655
|
-
return null !== (t = null === (e =
|
|
4656
|
-
},
|
|
4415
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4416
|
+
}, _this7.getSession = function () {
|
|
4657
4417
|
var e, t;
|
|
4658
|
-
return null !== (t = null === (e =
|
|
4418
|
+
return null !== (t = null === (e = _this7.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4659
4419
|
};
|
|
4660
|
-
return
|
|
4420
|
+
return _this7;
|
|
4661
4421
|
}
|
|
4662
|
-
return _createClass(
|
|
4663
|
-
}(
|
|
4664
|
-
var
|
|
4665
|
-
var
|
|
4666
|
-
var
|
|
4667
|
-
_classCallCheck(this,
|
|
4422
|
+
return _createClass(Dt);
|
|
4423
|
+
}(Et);
|
|
4424
|
+
var It = Symbol["for"]("stytch__internal_b2b");
|
|
4425
|
+
var jt = /*#__PURE__*/_createClass(function jt(e, t) {
|
|
4426
|
+
var _this8 = this;
|
|
4427
|
+
_classCallCheck(this, jt);
|
|
4668
4428
|
var r;
|
|
4669
4429
|
!function (e) {
|
|
4670
4430
|
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"));
|
|
4671
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ke("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(
|
|
4431
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ke("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(Ne)) : "" === r ? Ke('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ne)) : r.startsWith("public-token-") || Ke('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ne));
|
|
4672
4432
|
var n = t,
|
|
4673
4433
|
i = {
|
|
4674
4434
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4681,28 +4441,28 @@ var Yt = /*#__PURE__*/_createClass(function Yt(e, t) {
|
|
|
4681
4441
|
}
|
|
4682
4442
|
};
|
|
4683
4443
|
var o, s, a, c, u, l, d, h, p, _, f;
|
|
4684
|
-
this._dataLayer =
|
|
4685
|
-
var m = new
|
|
4686
|
-
this._networkClient = new
|
|
4444
|
+
this._dataLayer = xt(e, n), this._subscriptionService = new Dt(e, this._dataLayer);
|
|
4445
|
+
var m = new ft(this._dataLayer, "passwords");
|
|
4446
|
+
this._networkClient = new pt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4687
4447
|
var e, t, r, n;
|
|
4688
4448
|
return {
|
|
4689
|
-
stytch_member_id: null === (t = null === (e =
|
|
4690
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4449
|
+
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,
|
|
4450
|
+
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
|
|
4691
4451
|
};
|
|
4692
4452
|
});
|
|
4693
|
-
var v = new
|
|
4694
|
-
b = new
|
|
4453
|
+
var v = new lt(e, this._networkClient, this._dataLayer),
|
|
4454
|
+
b = new ht(v.getAsync()),
|
|
4695
4455
|
g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
4696
|
-
this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new
|
|
4456
|
+
this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ye(this._networkClient, this._subscriptionService, new ft(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new ft(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4697
4457
|
publicToken: e,
|
|
4698
4458
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4699
4459
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4700
|
-
}, g), this.sso = new $e(this._networkClient, this._subscriptionService, new
|
|
4460
|
+
}, g), this.sso = new $e(this._networkClient, this._subscriptionService, new ft(this._dataLayer, "sso"), v.getAsync(), {
|
|
4701
4461
|
publicToken: e,
|
|
4702
4462
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4703
4463
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4704
|
-
}), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new
|
|
4705
|
-
var
|
|
4464
|
+
}), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new rt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new nt(this._networkClient, this._subscriptionService, g), this.totp = new it(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new ot(this._networkClient, this._subscriptionService, g), this.rbac = new st(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new at(this._subscriptionService, this.session);
|
|
4465
|
+
var k = new mt(this._networkClient);
|
|
4706
4466
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4707
4467
|
name: "b2b_sdk_instance_instantiated",
|
|
4708
4468
|
details: {
|
|
@@ -4712,13 +4472,13 @@ var Yt = /*#__PURE__*/_createClass(function Yt(e, t) {
|
|
|
4712
4472
|
}
|
|
4713
4473
|
});
|
|
4714
4474
|
(function (e, t) {
|
|
4715
|
-
Object.assign(e, _defineProperty({},
|
|
4475
|
+
Object.assign(e, _defineProperty({}, It, t));
|
|
4716
4476
|
})(this, {
|
|
4717
4477
|
bootstrap: v,
|
|
4718
4478
|
publicToken: e,
|
|
4719
|
-
searchManager:
|
|
4479
|
+
searchManager: k,
|
|
4720
4480
|
dataLayer: this._dataLayer,
|
|
4721
4481
|
networkClient: this._networkClient
|
|
4722
4482
|
});
|
|
4723
4483
|
});
|
|
4724
|
-
export { g as AuthFlowType,
|
|
4484
|
+
export { g as AuthFlowType, k as B2BOAuthProviders, b as B2BProducts, X as BiometricsFailedError, F as BiometricsUnavailableError, G as ChallengeSigningFailedError, z as DeviceCredentialsNotAllowedError, Y as FailedCodeChallengeError, $ as FailedToDecryptDataError, I as InternalError, W as InvalidAuthorizationCredentialError, te as InvalidCredentialTypeError, Q as InvalidRedirectSchemeError, Z as InvalidStartUrlError, ne as JSONDataNotConvertibleToStringError, R as KeyInvalidatedError, L as KeystoreUnavailableError, re as MissingAttestationObjectError, q as MissingAuthorizationCredentialIDTokenError, N as MissingGoogleClientIDError, U as MissingPKCEError, H as MissingPublicKeyError, ee as MissingUrlError, M as NoBiometricsEnrolledError, j as NoBiometricsRegistrationError, D as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, f as OneTapPositions, oe as PasskeysInvalidEncoding, J as PasskeysUnsupportedError, h as Products, ie as RandomNumberGenerationFailed, y as SDKAPIUnreachableError, V as SDKNotConfiguredError, A as StytchAPIError, O as StytchAPISchemaError, x as StytchAPIUnreachableError, jt as StytchB2BHeadlessClient, T as StytchError, v as StytchEventType, C as StytchSDKAPIError, E as StytchSDKError, S as StytchSDKSchemaError, w as StytchSDKUsageError, P as UNRECOVERABLE_ERROR_TYPES, B as UserCancellationError, K as UserLockedOutError, _ as Wallets, se as errorToStytchError };
|