@stytch/vanilla-js 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/b2b/index.d.ts +1 -1
- package/dist/b2b/index.esm.d.ts +1 -1
- package/dist/b2b/index.esm.js +5758 -5423
- package/dist/b2b/index.js +5736 -5401
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +1233 -1206
- package/dist/index.headless.js +1216 -1189
- package/dist/index.js +1 -1
- package/package.json +4 -2
package/dist/index.headless.js
CHANGED
|
@@ -31,9 +31,9 @@ function e(e, t) {
|
|
|
31
31
|
if (Array.isArray(e) || (_n = r(e)) || t && e && "number" == typeof e.length) {
|
|
32
32
|
_n && (e = _n);
|
|
33
33
|
var i = 0,
|
|
34
|
-
|
|
34
|
+
o = function o() {};
|
|
35
35
|
return {
|
|
36
|
-
s:
|
|
36
|
+
s: o,
|
|
37
37
|
n: function n() {
|
|
38
38
|
return i >= e.length ? {
|
|
39
39
|
done: !0
|
|
@@ -45,12 +45,12 @@ function e(e, t) {
|
|
|
45
45
|
e: function e(_e2) {
|
|
46
46
|
throw _e2;
|
|
47
47
|
},
|
|
48
|
-
f:
|
|
48
|
+
f: o
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
52
52
|
}
|
|
53
|
-
var
|
|
53
|
+
var s,
|
|
54
54
|
a = !0,
|
|
55
55
|
c = !1;
|
|
56
56
|
return {
|
|
@@ -62,13 +62,13 @@ function e(e, t) {
|
|
|
62
62
|
return a = e.done, e;
|
|
63
63
|
},
|
|
64
64
|
e: function e(_e3) {
|
|
65
|
-
c = !0,
|
|
65
|
+
c = !0, s = _e3;
|
|
66
66
|
},
|
|
67
67
|
f: function f() {
|
|
68
68
|
try {
|
|
69
69
|
a || null == _n["return"] || _n["return"]();
|
|
70
70
|
} finally {
|
|
71
|
-
if (c) throw
|
|
71
|
+
if (c) throw s;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
};
|
|
@@ -81,21 +81,21 @@ function t(e, t) {
|
|
|
81
81
|
if (null != r) {
|
|
82
82
|
var n,
|
|
83
83
|
i,
|
|
84
|
-
s,
|
|
85
84
|
o,
|
|
85
|
+
s,
|
|
86
86
|
a = [],
|
|
87
87
|
c = !0,
|
|
88
88
|
u = !1;
|
|
89
89
|
try {
|
|
90
|
-
if (
|
|
90
|
+
if (o = (r = r.call(e)).next, 0 === t) {
|
|
91
91
|
if (Object(r) !== r) return;
|
|
92
92
|
c = !1;
|
|
93
|
-
} else for (; !(c = (n =
|
|
93
|
+
} else for (; !(c = (n = o.call(r)).done) && (a.push(n.value), a.length !== t); c = !0);
|
|
94
94
|
} catch (e) {
|
|
95
95
|
u = !0, i = e;
|
|
96
96
|
} finally {
|
|
97
97
|
try {
|
|
98
|
-
if (!c && null != r["return"] && (
|
|
98
|
+
if (!c && null != r["return"] && (s = r["return"](), Object(s) !== s)) return;
|
|
99
99
|
} finally {
|
|
100
100
|
if (u) throw i;
|
|
101
101
|
}
|
|
@@ -125,9 +125,9 @@ function i(e) {
|
|
|
125
125
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
126
126
|
}, i(e);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function o() {
|
|
129
129
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
130
|
-
|
|
130
|
+
o = function o() {
|
|
131
131
|
return e;
|
|
132
132
|
};
|
|
133
133
|
var e = {},
|
|
@@ -136,10 +136,10 @@ function s() {
|
|
|
136
136
|
n = Object.defineProperty || function (e, t, r) {
|
|
137
137
|
e[t] = r.value;
|
|
138
138
|
},
|
|
139
|
-
|
|
140
|
-
a =
|
|
141
|
-
c =
|
|
142
|
-
u =
|
|
139
|
+
s = "function" == typeof Symbol ? Symbol : {},
|
|
140
|
+
a = s.iterator || "@@iterator",
|
|
141
|
+
c = s.asyncIterator || "@@asyncIterator",
|
|
142
|
+
u = s.toStringTag || "@@toStringTag";
|
|
143
143
|
function l(e, t, r) {
|
|
144
144
|
return Object.defineProperty(e, t, {
|
|
145
145
|
value: r,
|
|
@@ -156,12 +156,12 @@ function s() {
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
function d(e, t, r, i) {
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
a = new
|
|
162
|
-
return n(
|
|
159
|
+
var o = t && t.prototype instanceof f ? t : f,
|
|
160
|
+
s = Object.create(o.prototype),
|
|
161
|
+
a = new A(i || []);
|
|
162
|
+
return n(s, "_invoke", {
|
|
163
163
|
value: S(e, r, a)
|
|
164
|
-
}),
|
|
164
|
+
}), s;
|
|
165
165
|
}
|
|
166
166
|
function h(e, t, r) {
|
|
167
167
|
try {
|
|
@@ -180,15 +180,15 @@ function s() {
|
|
|
180
180
|
var p = {};
|
|
181
181
|
function f() {}
|
|
182
182
|
function _() {}
|
|
183
|
-
function
|
|
184
|
-
var
|
|
185
|
-
l(
|
|
183
|
+
function m() {}
|
|
184
|
+
var v = {};
|
|
185
|
+
l(v, a, function () {
|
|
186
186
|
return this;
|
|
187
187
|
});
|
|
188
188
|
var y = Object.getPrototypeOf,
|
|
189
189
|
g = y && y(y(E([])));
|
|
190
|
-
g && g !== t && r.call(g, a) && (
|
|
191
|
-
var b =
|
|
190
|
+
g && g !== t && r.call(g, a) && (v = g);
|
|
191
|
+
var b = m.prototype = f.prototype = Object.create(v);
|
|
192
192
|
function k(e) {
|
|
193
193
|
["next", "throw", "return"].forEach(function (t) {
|
|
194
194
|
l(e, t, function (e) {
|
|
@@ -197,47 +197,47 @@ function s() {
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
function w(e, t) {
|
|
200
|
-
function
|
|
201
|
-
var u = h(e[n], e,
|
|
200
|
+
function o(n, s, a, c) {
|
|
201
|
+
var u = h(e[n], e, s);
|
|
202
202
|
if ("throw" !== u.type) {
|
|
203
203
|
var l = u.arg,
|
|
204
204
|
d = l.value;
|
|
205
205
|
return d && "object" == i(d) && r.call(d, "__await") ? t.resolve(d.__await).then(function (e) {
|
|
206
|
-
|
|
206
|
+
o("next", e, a, c);
|
|
207
207
|
}, function (e) {
|
|
208
|
-
|
|
208
|
+
o("throw", e, a, c);
|
|
209
209
|
}) : t.resolve(d).then(function (e) {
|
|
210
210
|
l.value = e, a(l);
|
|
211
211
|
}, function (e) {
|
|
212
|
-
return
|
|
212
|
+
return o("throw", e, a, c);
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
c(u.arg);
|
|
216
216
|
}
|
|
217
|
-
var
|
|
217
|
+
var s;
|
|
218
218
|
n(this, "_invoke", {
|
|
219
219
|
value: function value(e, r) {
|
|
220
220
|
function n() {
|
|
221
221
|
return new t(function (t, n) {
|
|
222
|
-
|
|
222
|
+
o(e, r, t, n);
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
return
|
|
225
|
+
return s = s ? s.then(n, n) : n();
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
function S(e, t, r) {
|
|
230
230
|
var n = "suspendedStart";
|
|
231
|
-
return function (i,
|
|
231
|
+
return function (i, o) {
|
|
232
232
|
if ("executing" === n) throw new Error("Generator is already running");
|
|
233
233
|
if ("completed" === n) {
|
|
234
|
-
if ("throw" === i) throw
|
|
235
|
-
return
|
|
234
|
+
if ("throw" === i) throw o;
|
|
235
|
+
return P();
|
|
236
236
|
}
|
|
237
|
-
for (r.method = i, r.arg =
|
|
238
|
-
var
|
|
239
|
-
if (
|
|
240
|
-
var a =
|
|
237
|
+
for (r.method = i, r.arg = o;;) {
|
|
238
|
+
var s = r.delegate;
|
|
239
|
+
if (s) {
|
|
240
|
+
var a = C(s, r);
|
|
241
241
|
if (a) {
|
|
242
242
|
if (a === p) continue;
|
|
243
243
|
return a;
|
|
@@ -260,29 +260,29 @@ function s() {
|
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function C(e, t) {
|
|
264
264
|
var r = t.method,
|
|
265
265
|
n = e.iterator[r];
|
|
266
|
-
if (void 0 === n) return t.delegate = null, "throw" === r && e.iterator["return"] && (t.method = "return", t.arg = void 0,
|
|
266
|
+
if (void 0 === n) return t.delegate = null, "throw" === r && e.iterator["return"] && (t.method = "return", t.arg = void 0, C(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), p;
|
|
267
267
|
var i = h(n, e.iterator, t.arg);
|
|
268
268
|
if ("throw" === i.type) return t.method = "throw", t.arg = i.arg, t.delegate = null, p;
|
|
269
|
-
var
|
|
270
|
-
return
|
|
269
|
+
var o = i.arg;
|
|
270
|
+
return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, p) : o : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, p);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function T(e) {
|
|
273
273
|
var t = {
|
|
274
274
|
tryLoc: e[0]
|
|
275
275
|
};
|
|
276
276
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function O(e) {
|
|
279
279
|
var t = e.completion || {};
|
|
280
280
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function A(e) {
|
|
283
283
|
this.tryEntries = [{
|
|
284
284
|
tryLoc: "root"
|
|
285
|
-
}], e.forEach(
|
|
285
|
+
}], e.forEach(T, this), this.reset(!0);
|
|
286
286
|
}
|
|
287
287
|
function E(e) {
|
|
288
288
|
if (e) {
|
|
@@ -299,37 +299,37 @@ function s() {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
return {
|
|
302
|
-
next:
|
|
302
|
+
next: P
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function P() {
|
|
306
306
|
return {
|
|
307
307
|
value: void 0,
|
|
308
308
|
done: !0
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
|
-
return _.prototype =
|
|
312
|
-
value:
|
|
311
|
+
return _.prototype = m, n(b, "constructor", {
|
|
312
|
+
value: m,
|
|
313
313
|
configurable: !0
|
|
314
|
-
}), n(
|
|
314
|
+
}), n(m, "constructor", {
|
|
315
315
|
value: _,
|
|
316
316
|
configurable: !0
|
|
317
|
-
}), _.displayName = l(
|
|
317
|
+
}), _.displayName = l(m, u, "GeneratorFunction"), e.isGeneratorFunction = function (e) {
|
|
318
318
|
var t = "function" == typeof e && e.constructor;
|
|
319
319
|
return !!t && (t === _ || "GeneratorFunction" === (t.displayName || t.name));
|
|
320
320
|
}, e.mark = function (e) {
|
|
321
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e,
|
|
321
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, m) : (e.__proto__ = m, l(e, u, "GeneratorFunction")), e.prototype = Object.create(b), e;
|
|
322
322
|
}, e.awrap = function (e) {
|
|
323
323
|
return {
|
|
324
324
|
__await: e
|
|
325
325
|
};
|
|
326
326
|
}, k(w.prototype), l(w.prototype, c, function () {
|
|
327
327
|
return this;
|
|
328
|
-
}), e.AsyncIterator = w, e.async = function (t, r, n, i,
|
|
329
|
-
void 0 ===
|
|
330
|
-
var
|
|
331
|
-
return e.isGeneratorFunction(r) ?
|
|
332
|
-
return e.done ? e.value :
|
|
328
|
+
}), e.AsyncIterator = w, e.async = function (t, r, n, i, o) {
|
|
329
|
+
void 0 === o && (o = Promise);
|
|
330
|
+
var s = new w(d(t, r, n, i), o);
|
|
331
|
+
return e.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
332
|
+
return e.done ? e.value : s.next();
|
|
333
333
|
});
|
|
334
334
|
}, k(b), l(b, u, "Generator"), l(b, a, function () {
|
|
335
335
|
return this;
|
|
@@ -346,10 +346,10 @@ function s() {
|
|
|
346
346
|
}
|
|
347
347
|
return e.done = !0, e;
|
|
348
348
|
};
|
|
349
|
-
}, e.values = E,
|
|
350
|
-
constructor:
|
|
349
|
+
}, e.values = E, A.prototype = {
|
|
350
|
+
constructor: A,
|
|
351
351
|
reset: function reset(e) {
|
|
352
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(
|
|
352
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(O), !e) for (var t in this) "t" === t.charAt(0) && r.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0);
|
|
353
353
|
},
|
|
354
354
|
stop: function stop() {
|
|
355
355
|
this.done = !0;
|
|
@@ -361,23 +361,23 @@ function s() {
|
|
|
361
361
|
if (this.done) throw e;
|
|
362
362
|
var t = this;
|
|
363
363
|
function n(r, n) {
|
|
364
|
-
return
|
|
364
|
+
return s.type = "throw", s.arg = e, t.next = r, n && (t.method = "next", t.arg = void 0), !!n;
|
|
365
365
|
}
|
|
366
366
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
367
|
-
var
|
|
368
|
-
|
|
369
|
-
if ("root" ===
|
|
370
|
-
if (
|
|
371
|
-
var a = r.call(
|
|
372
|
-
c = r.call(
|
|
367
|
+
var o = this.tryEntries[i],
|
|
368
|
+
s = o.completion;
|
|
369
|
+
if ("root" === o.tryLoc) return n("end");
|
|
370
|
+
if (o.tryLoc <= this.prev) {
|
|
371
|
+
var a = r.call(o, "catchLoc"),
|
|
372
|
+
c = r.call(o, "finallyLoc");
|
|
373
373
|
if (a && c) {
|
|
374
|
-
if (this.prev <
|
|
375
|
-
if (this.prev <
|
|
374
|
+
if (this.prev < o.catchLoc) return n(o.catchLoc, !0);
|
|
375
|
+
if (this.prev < o.finallyLoc) return n(o.finallyLoc);
|
|
376
376
|
} else if (a) {
|
|
377
|
-
if (this.prev <
|
|
377
|
+
if (this.prev < o.catchLoc) return n(o.catchLoc, !0);
|
|
378
378
|
} else {
|
|
379
379
|
if (!c) throw new Error("try statement without catch or finally");
|
|
380
|
-
if (this.prev <
|
|
380
|
+
if (this.prev < o.finallyLoc) return n(o.finallyLoc);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
}
|
|
@@ -386,13 +386,13 @@ function s() {
|
|
|
386
386
|
for (var n = this.tryEntries.length - 1; n >= 0; --n) {
|
|
387
387
|
var i = this.tryEntries[n];
|
|
388
388
|
if (i.tryLoc <= this.prev && r.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
|
|
389
|
-
var
|
|
389
|
+
var o = i;
|
|
390
390
|
break;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
|
|
394
|
-
var
|
|
395
|
-
return
|
|
393
|
+
o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null);
|
|
394
|
+
var s = o ? o.completion : {};
|
|
395
|
+
return s.type = e, s.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, p) : this.complete(s);
|
|
396
396
|
},
|
|
397
397
|
complete: function complete(e, t) {
|
|
398
398
|
if ("throw" === e.type) throw e.arg;
|
|
@@ -401,7 +401,7 @@ function s() {
|
|
|
401
401
|
finish: function finish(e) {
|
|
402
402
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
403
403
|
var r = this.tryEntries[t];
|
|
404
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
404
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), O(r), p;
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
407
|
"catch": function _catch(e) {
|
|
@@ -411,7 +411,7 @@ function s() {
|
|
|
411
411
|
var n = r.completion;
|
|
412
412
|
if ("throw" === n.type) {
|
|
413
413
|
var i = n.arg;
|
|
414
|
-
|
|
414
|
+
O(r);
|
|
415
415
|
}
|
|
416
416
|
return i;
|
|
417
417
|
}
|
|
@@ -427,10 +427,10 @@ function s() {
|
|
|
427
427
|
}
|
|
428
428
|
}, e;
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function s(e, t) {
|
|
431
431
|
for (var r = 0; r < t.length; r++) {
|
|
432
432
|
var n = t[r];
|
|
433
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (
|
|
433
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (o = n.key, s = void 0, s = function (e, t) {
|
|
434
434
|
if ("object" !== i(e) || null === e) return e;
|
|
435
435
|
var r = e[Symbol.toPrimitive];
|
|
436
436
|
if (void 0 !== r) {
|
|
@@ -439,12 +439,12 @@ function o(e, t) {
|
|
|
439
439
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
440
440
|
}
|
|
441
441
|
return ("string" === t ? String : Number)(e);
|
|
442
|
-
}(
|
|
442
|
+
}(o, "string"), "symbol" === i(s) ? s : String(s)), n);
|
|
443
443
|
}
|
|
444
|
-
var
|
|
444
|
+
var o, s;
|
|
445
445
|
}
|
|
446
446
|
function a(e, t, r) {
|
|
447
|
-
return t &&
|
|
447
|
+
return t && s(e.prototype, t), r && s(e, r), Object.defineProperty(e, "prototype", {
|
|
448
448
|
writable: !1
|
|
449
449
|
}), e;
|
|
450
450
|
}
|
|
@@ -467,10 +467,10 @@ function l(e) {
|
|
|
467
467
|
var t = f();
|
|
468
468
|
return function () {
|
|
469
469
|
var r,
|
|
470
|
-
n =
|
|
470
|
+
n = m(e);
|
|
471
471
|
if (t) {
|
|
472
|
-
var
|
|
473
|
-
r = Reflect.construct(n, arguments,
|
|
472
|
+
var o = m(this).constructor;
|
|
473
|
+
r = Reflect.construct(n, arguments, o);
|
|
474
474
|
} else r = n.apply(this, arguments);
|
|
475
475
|
return function (e, t) {
|
|
476
476
|
if (t && ("object" === i(t) || "function" == typeof t)) return t;
|
|
@@ -494,7 +494,7 @@ function h(e) {
|
|
|
494
494
|
t.set(e, n);
|
|
495
495
|
}
|
|
496
496
|
function n() {
|
|
497
|
-
return p(e, arguments,
|
|
497
|
+
return p(e, arguments, m(this).constructor);
|
|
498
498
|
}
|
|
499
499
|
return n.prototype = Object.create(e.prototype, {
|
|
500
500
|
constructor: {
|
|
@@ -529,18 +529,23 @@ function _(e, t) {
|
|
|
529
529
|
return e.__proto__ = t, e;
|
|
530
530
|
}, _(e, t);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return
|
|
532
|
+
function m(e) {
|
|
533
|
+
return m = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
534
534
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
535
|
-
},
|
|
535
|
+
}, m(e);
|
|
536
536
|
}
|
|
537
537
|
Object.defineProperty(exports, "__esModule", {
|
|
538
538
|
value: !0
|
|
539
539
|
});
|
|
540
|
-
var
|
|
541
|
-
y
|
|
542
|
-
g
|
|
543
|
-
|
|
540
|
+
var v,
|
|
541
|
+
y,
|
|
542
|
+
g,
|
|
543
|
+
b,
|
|
544
|
+
k,
|
|
545
|
+
w,
|
|
546
|
+
S = "https://accounts.google.com/gsi",
|
|
547
|
+
C = "".concat(S, "/client");
|
|
548
|
+
function T(e, t) {
|
|
544
549
|
var r = {};
|
|
545
550
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
546
551
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -549,73 +554,50 @@ function b(e, t) {
|
|
|
549
554
|
}
|
|
550
555
|
return r;
|
|
551
556
|
}
|
|
552
|
-
function
|
|
553
|
-
return new (r || (r = Promise))(function (i,
|
|
554
|
-
function
|
|
557
|
+
function O(e, t, r, n) {
|
|
558
|
+
return new (r || (r = Promise))(function (i, o) {
|
|
559
|
+
function s(e) {
|
|
555
560
|
try {
|
|
556
561
|
c(n.next(e));
|
|
557
562
|
} catch (e) {
|
|
558
|
-
|
|
563
|
+
o(e);
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
566
|
function a(e) {
|
|
562
567
|
try {
|
|
563
568
|
c(n["throw"](e));
|
|
564
569
|
} catch (e) {
|
|
565
|
-
|
|
570
|
+
o(e);
|
|
566
571
|
}
|
|
567
572
|
}
|
|
568
573
|
function c(e) {
|
|
569
574
|
var t;
|
|
570
575
|
e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
|
|
571
576
|
e(t);
|
|
572
|
-
})).then(
|
|
577
|
+
})).then(s, a);
|
|
573
578
|
}
|
|
574
579
|
c((n = n.apply(e, t || [])).next());
|
|
575
580
|
});
|
|
576
581
|
}
|
|
577
|
-
var w = new Uint8Array(16);
|
|
578
|
-
function S() {
|
|
579
|
-
if (!m && !(m = "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");
|
|
580
|
-
return m(w);
|
|
581
|
-
}
|
|
582
|
-
var T = /^(?:[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;
|
|
583
|
-
for (var O, x, C, E, A, P, R = [], B = 0; B < 256; ++B) R.push((B + 256).toString(16).substr(1));
|
|
584
|
-
function D(e) {
|
|
585
|
-
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
586
|
-
r = (R[e[t + 0]] + R[e[t + 1]] + R[e[t + 2]] + R[e[t + 3]] + "-" + R[e[t + 4]] + R[e[t + 5]] + "-" + R[e[t + 6]] + R[e[t + 7]] + "-" + R[e[t + 8]] + R[e[t + 9]] + "-" + R[e[t + 10]] + R[e[t + 11]] + R[e[t + 12]] + R[e[t + 13]] + R[e[t + 14]] + R[e[t + 15]]).toLowerCase();
|
|
587
|
-
if (!function (e) {
|
|
588
|
-
return "string" == typeof e && T.test(e);
|
|
589
|
-
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
590
|
-
return r;
|
|
591
|
-
}
|
|
592
|
-
function I(e, t, r) {
|
|
593
|
-
var n = (e = e || {}).random || (e.rng || S)();
|
|
594
|
-
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
595
|
-
r = r || 0;
|
|
596
|
-
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
597
|
-
return t;
|
|
598
|
-
}
|
|
599
|
-
return D(n);
|
|
600
|
-
}
|
|
601
582
|
!function (e) {
|
|
602
583
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords";
|
|
603
|
-
}(
|
|
584
|
+
}(v || (v = {})), function (e) {
|
|
604
585
|
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";
|
|
605
|
-
}(
|
|
586
|
+
}(y || (y = {})), function (e) {
|
|
606
587
|
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";
|
|
607
|
-
}(
|
|
588
|
+
}(g || (g = {})), function (e) {
|
|
608
589
|
e.embedded = "embedded", e.floating = "floating";
|
|
609
|
-
}(
|
|
590
|
+
}(b || (b = {})), function (e) {
|
|
610
591
|
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
611
|
-
}(
|
|
592
|
+
}(k || (k = {})), function (e) {
|
|
612
593
|
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.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_SSO_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";
|
|
613
|
-
}(
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
594
|
+
}(w || (w = {}));
|
|
595
|
+
var A,
|
|
596
|
+
E,
|
|
597
|
+
P,
|
|
598
|
+
x,
|
|
599
|
+
D,
|
|
600
|
+
R = function (e) {
|
|
619
601
|
u(r, h(Error));
|
|
620
602
|
var t = l(r);
|
|
621
603
|
function r(e, n) {
|
|
@@ -624,7 +606,7 @@ var L,
|
|
|
624
606
|
}
|
|
625
607
|
return a(r);
|
|
626
608
|
}(),
|
|
627
|
-
|
|
609
|
+
B = function (e) {
|
|
628
610
|
u(r, h(Error));
|
|
629
611
|
var t = l(r);
|
|
630
612
|
function r(e, n) {
|
|
@@ -633,57 +615,177 @@ var L,
|
|
|
633
615
|
}
|
|
634
616
|
return a(r);
|
|
635
617
|
}(),
|
|
636
|
-
|
|
618
|
+
I = function (e) {
|
|
637
619
|
u(r, h(Error));
|
|
638
620
|
var t = l(r);
|
|
639
621
|
function r(e) {
|
|
640
622
|
var n, i;
|
|
641
623
|
c(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
642
|
-
var
|
|
624
|
+
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
643
625
|
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
644
626
|
}).join("\n");
|
|
645
|
-
return n.message = "[400] Request does not match expected schema\n".concat(
|
|
627
|
+
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
646
628
|
}
|
|
647
629
|
return a(r);
|
|
648
630
|
}(),
|
|
649
|
-
|
|
631
|
+
L = function (e) {
|
|
650
632
|
u(r, h(Error));
|
|
651
633
|
var t = l(r);
|
|
652
634
|
function r(e) {
|
|
653
635
|
var n;
|
|
654
636
|
c(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
655
637
|
var i = e.status_code,
|
|
656
|
-
|
|
657
|
-
|
|
638
|
+
o = e.error_type,
|
|
639
|
+
s = e.error_message,
|
|
658
640
|
a = e.error_url,
|
|
659
641
|
u = e.request_id;
|
|
660
|
-
return n.error_type =
|
|
642
|
+
return n.error_type = o, n.error_message = s, n.error_url = a, n.request_id = u, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(a, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), n;
|
|
661
643
|
}
|
|
662
644
|
return a(r);
|
|
663
645
|
}(),
|
|
664
|
-
|
|
646
|
+
F = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
665
647
|
!function (e) {
|
|
666
648
|
e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
|
|
667
|
-
}(
|
|
649
|
+
}(A || (A = {})), function (e) {
|
|
668
650
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
669
|
-
}(
|
|
651
|
+
}(E || (E = {})), function (e) {
|
|
670
652
|
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
671
|
-
}(
|
|
653
|
+
}(P || (P = {})), function (e) {
|
|
672
654
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
673
|
-
}(
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
655
|
+
}(x || (x = {})), function (e) {
|
|
656
|
+
e.RequiredCatcha = "Catcha Required";
|
|
657
|
+
}(D || (D = {}));
|
|
658
|
+
var j,
|
|
659
|
+
M = function (e) {
|
|
660
|
+
u(r, h(Error));
|
|
661
|
+
var t = l(r);
|
|
662
|
+
function r(e) {
|
|
663
|
+
var n;
|
|
664
|
+
return c(this, r), (n = t.call(this, e)).type = e, n;
|
|
665
|
+
}
|
|
666
|
+
return a(r);
|
|
667
|
+
}();
|
|
668
|
+
function N(e) {
|
|
669
|
+
var t = e.method,
|
|
670
|
+
r = e.errorMessage,
|
|
671
|
+
n = e.finalURL,
|
|
672
|
+
i = e.basicAuthHeader,
|
|
673
|
+
s = e.xSDKClientHeader,
|
|
674
|
+
a = e.xSDKParentHostHeader,
|
|
675
|
+
c = e.body;
|
|
676
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
677
|
+
var u, l, d, h, p, f;
|
|
678
|
+
return o().wrap(function (e) {
|
|
679
|
+
for (;;) switch (e.prev = e.next) {
|
|
680
|
+
case 0:
|
|
681
|
+
return u = {
|
|
682
|
+
Authorization: i,
|
|
683
|
+
"Content-Type": "application/json",
|
|
684
|
+
"X-SDK-Client": s
|
|
685
|
+
}, a && (u["X-SDK-Parent-Host"] = a), l = {
|
|
686
|
+
method: t,
|
|
687
|
+
headers: u,
|
|
688
|
+
body: c && JSON.stringify(c)
|
|
689
|
+
}, e.prev = 3, e.next = 6, fetch(n, l);
|
|
690
|
+
case 6:
|
|
691
|
+
d = e.sent, e.next = 14;
|
|
692
|
+
break;
|
|
693
|
+
case 9:
|
|
694
|
+
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
695
|
+
e.next = 13;
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
throw new R(r, "Unable to contact the Stytch servers. Are you online?");
|
|
699
|
+
case 13:
|
|
700
|
+
throw e.t0;
|
|
701
|
+
case 14:
|
|
702
|
+
if (403 !== d.status) {
|
|
703
|
+
e.next = 27;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
return e.prev = 15, e.next = 18, d.text();
|
|
707
|
+
case 18:
|
|
708
|
+
h = e.sent, e.next = 24;
|
|
709
|
+
break;
|
|
710
|
+
case 21:
|
|
711
|
+
throw e.prev = 21, e.t1 = e["catch"](15), new R(r, "Invalid response from the Stytch servers.");
|
|
712
|
+
case 24:
|
|
713
|
+
if (!h.includes("Captcha required")) {
|
|
714
|
+
e.next = 26;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
throw new M(D.RequiredCatcha);
|
|
718
|
+
case 26:
|
|
719
|
+
throw new R(r, "Invalid response from the Stytch servers.");
|
|
720
|
+
case 27:
|
|
721
|
+
if (200 === d.status) {
|
|
722
|
+
e.next = 40;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
return e.prev = 28, e.next = 31, d.json();
|
|
726
|
+
case 31:
|
|
727
|
+
p = e.sent, e.next = 37;
|
|
728
|
+
break;
|
|
729
|
+
case 34:
|
|
730
|
+
throw e.prev = 34, e.t2 = e["catch"](28), new R(r, "Invalid or no response from server");
|
|
731
|
+
case 37:
|
|
732
|
+
if (!("body" in p || "params" in p || "query" in p)) {
|
|
733
|
+
e.next = 39;
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
throw new I(p);
|
|
737
|
+
case 39:
|
|
738
|
+
throw new L(p);
|
|
739
|
+
case 40:
|
|
740
|
+
return e.prev = 40, e.next = 43, d.json();
|
|
741
|
+
case 43:
|
|
742
|
+
return f = e.sent, e.abrupt("return", f.data);
|
|
743
|
+
case 47:
|
|
744
|
+
throw e.prev = 47, e.t3 = e["catch"](40), new R(r, "Invalid response from the Stytch servers.");
|
|
745
|
+
case 50:
|
|
746
|
+
case "end":
|
|
747
|
+
return e.stop();
|
|
748
|
+
}
|
|
749
|
+
}, e, null, [[3, 9], [15, 21], [28, 34], [40, 47]]);
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
var U = new Uint8Array(16);
|
|
753
|
+
function K() {
|
|
754
|
+
if (!j && !(j = "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");
|
|
755
|
+
return j(U);
|
|
756
|
+
}
|
|
757
|
+
var W = /^(?:[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;
|
|
758
|
+
for (var q = [], G = 0; G < 256; ++G) q.push((G + 256).toString(16).substr(1));
|
|
759
|
+
function H(e) {
|
|
760
|
+
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
761
|
+
r = (q[e[t + 0]] + q[e[t + 1]] + q[e[t + 2]] + q[e[t + 3]] + "-" + q[e[t + 4]] + q[e[t + 5]] + "-" + q[e[t + 6]] + q[e[t + 7]] + "-" + q[e[t + 8]] + q[e[t + 9]] + "-" + q[e[t + 10]] + q[e[t + 11]] + q[e[t + 12]] + q[e[t + 13]] + q[e[t + 14]] + q[e[t + 15]]).toLowerCase();
|
|
762
|
+
if (!function (e) {
|
|
763
|
+
return "string" == typeof e && W.test(e);
|
|
764
|
+
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
765
|
+
return r;
|
|
766
|
+
}
|
|
767
|
+
function z(e, t, r) {
|
|
768
|
+
var n = (e = e || {}).random || (e.rng || K)();
|
|
769
|
+
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
770
|
+
r = r || 0;
|
|
771
|
+
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
772
|
+
return t;
|
|
773
|
+
}
|
|
774
|
+
return H(n);
|
|
775
|
+
}
|
|
776
|
+
var Y = {};
|
|
777
|
+
function V(e, t) {
|
|
778
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
779
|
+
return o().wrap(function (r) {
|
|
678
780
|
for (;;) switch (r.prev = r.next) {
|
|
679
781
|
case 0:
|
|
680
|
-
if (void 0 ===
|
|
782
|
+
if (void 0 === Y[e]) {
|
|
681
783
|
r.next = 2;
|
|
682
784
|
break;
|
|
683
785
|
}
|
|
684
|
-
return r.abrupt("return",
|
|
786
|
+
return r.abrupt("return", Y[e]);
|
|
685
787
|
case 2:
|
|
686
|
-
return
|
|
788
|
+
return Y[e] = J(e, t), r.abrupt("return", Y[e]);
|
|
687
789
|
case 4:
|
|
688
790
|
case "end":
|
|
689
791
|
return r.stop();
|
|
@@ -691,10 +793,10 @@ function H(e, t) {
|
|
|
691
793
|
}, r);
|
|
692
794
|
}));
|
|
693
795
|
}
|
|
694
|
-
function
|
|
796
|
+
function J(e, t) {
|
|
695
797
|
return new Promise(function (r, n) {
|
|
696
798
|
var i = function (e) {
|
|
697
|
-
var t =
|
|
799
|
+
var t = $(e);
|
|
698
800
|
if (t[0]) return t[0];
|
|
699
801
|
}(e);
|
|
700
802
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -702,64 +804,65 @@ function z(e, t) {
|
|
|
702
804
|
} catch (t) {
|
|
703
805
|
return n(new Error("".concat(e, " already loaded, but module was not found in global scope: ").concat(t)));
|
|
704
806
|
}
|
|
705
|
-
var
|
|
807
|
+
var o = function (e) {
|
|
706
808
|
var t = document.createElement("script");
|
|
707
809
|
return t.setAttribute("src", e), t.setAttribute("async", "true"), t.setAttribute("defer", "true"), document.head.appendChild(t), t;
|
|
708
810
|
}(e);
|
|
709
|
-
|
|
710
|
-
|
|
811
|
+
o.addEventListener("load", function () {
|
|
812
|
+
o.dataset.loaded = "true";
|
|
711
813
|
try {
|
|
712
814
|
r(t());
|
|
713
815
|
} catch (t) {
|
|
714
816
|
n(new Error("".concat(e, " was loaded, but module was not found in global scope: ").concat(t)));
|
|
715
817
|
}
|
|
716
|
-
}),
|
|
818
|
+
}), o.addEventListener("error", function (t) {
|
|
717
819
|
n(new Error("".concat(e, " could not be loaded: ").concat(t)));
|
|
718
820
|
});
|
|
719
821
|
});
|
|
720
822
|
}
|
|
721
|
-
var
|
|
823
|
+
var $ = function $(e) {
|
|
722
824
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
723
825
|
};
|
|
724
|
-
var
|
|
725
|
-
|
|
826
|
+
var X,
|
|
827
|
+
Z = ["[Stytch]"],
|
|
828
|
+
Q = function Q() {
|
|
726
829
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
727
|
-
return (e = console).warn.apply(e,
|
|
830
|
+
return (e = console).warn.apply(e, Z.concat(r));
|
|
728
831
|
},
|
|
729
|
-
|
|
832
|
+
ee = function ee() {
|
|
730
833
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
731
|
-
return (e = console).error.apply(e,
|
|
834
|
+
return (e = console).error.apply(e, Z.concat(r));
|
|
732
835
|
},
|
|
733
|
-
|
|
734
|
-
|
|
836
|
+
te = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
837
|
+
re = function re(t) {
|
|
735
838
|
var r = {
|
|
736
839
|
isObject: function isObject(e, n) {
|
|
737
|
-
var
|
|
738
|
-
if (!
|
|
840
|
+
var o = "object" === i(n) && !Array.isArray(n) && null !== n;
|
|
841
|
+
if (!o) throw new B(t, e + " must be an object.");
|
|
739
842
|
return r;
|
|
740
843
|
},
|
|
741
844
|
isOptionalObject: function isOptionalObject(e, t) {
|
|
742
845
|
return void 0 === t ? r : r.isObject(e, t);
|
|
743
846
|
},
|
|
744
847
|
isString: function isString(e, n) {
|
|
745
|
-
if ("string" != typeof n) throw new
|
|
848
|
+
if ("string" != typeof n) throw new B(t, e + " must be a string.");
|
|
746
849
|
return r;
|
|
747
850
|
},
|
|
748
851
|
isOptionalString: function isOptionalString(e, t) {
|
|
749
852
|
return void 0 === t ? r : r.isString(e, t);
|
|
750
853
|
},
|
|
751
854
|
isStringArray: function isStringArray(n, i) {
|
|
752
|
-
if (!Array.isArray(i)) throw new
|
|
753
|
-
var
|
|
754
|
-
|
|
855
|
+
if (!Array.isArray(i)) throw new B(t, n + " must be an array of strings.");
|
|
856
|
+
var o,
|
|
857
|
+
s = e(i);
|
|
755
858
|
try {
|
|
756
|
-
for (
|
|
757
|
-
if ("string" != typeof
|
|
859
|
+
for (s.s(); !(o = s.n()).done;) {
|
|
860
|
+
if ("string" != typeof o.value) throw new B(t, n + " must be an array of strings.");
|
|
758
861
|
}
|
|
759
862
|
} catch (e) {
|
|
760
|
-
|
|
863
|
+
s.e(e);
|
|
761
864
|
} finally {
|
|
762
|
-
|
|
865
|
+
s.f();
|
|
763
866
|
}
|
|
764
867
|
return r;
|
|
765
868
|
},
|
|
@@ -767,14 +870,14 @@ var V = ["[Stytch]"],
|
|
|
767
870
|
return void 0 === t ? r : r.isStringArray(e, t);
|
|
768
871
|
},
|
|
769
872
|
isNumber: function isNumber(e, n) {
|
|
770
|
-
if ("number" != typeof n) throw new
|
|
873
|
+
if ("number" != typeof n) throw new B(t, e + " must be a number.");
|
|
771
874
|
return r;
|
|
772
875
|
},
|
|
773
876
|
isOptionalNumber: function isOptionalNumber(e, t) {
|
|
774
877
|
return void 0 === t ? r : r.isNumber(e, t);
|
|
775
878
|
},
|
|
776
879
|
isBoolean: function isBoolean(e, n) {
|
|
777
|
-
if ("boolean" != typeof n) throw new
|
|
880
|
+
if ("boolean" != typeof n) throw new B(t, e + " must be a boolean.");
|
|
778
881
|
return r;
|
|
779
882
|
},
|
|
780
883
|
isOptionalBoolean: function isOptionalBoolean(e, t) {
|
|
@@ -783,17 +886,20 @@ var V = ["[Stytch]"],
|
|
|
783
886
|
};
|
|
784
887
|
return r;
|
|
785
888
|
},
|
|
786
|
-
|
|
787
|
-
return
|
|
889
|
+
ne = function ne(e) {
|
|
890
|
+
return T(e, ["request_id", "status_code"]);
|
|
788
891
|
},
|
|
789
|
-
|
|
790
|
-
return
|
|
892
|
+
ie = function ie(e) {
|
|
893
|
+
return T(e, ["__user"]);
|
|
791
894
|
},
|
|
792
|
-
|
|
793
|
-
var i = this
|
|
895
|
+
oe = a(function e(t, r, n) {
|
|
896
|
+
var i = this,
|
|
897
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
898
|
+
return Promise.resolve(void 0);
|
|
899
|
+
};
|
|
794
900
|
c(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
795
|
-
return
|
|
796
|
-
return
|
|
901
|
+
return O(i, void 0, void 0, o().mark(function e() {
|
|
902
|
+
return o().wrap(function (e) {
|
|
797
903
|
for (;;) switch (e.prev = e.next) {
|
|
798
904
|
case 0:
|
|
799
905
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -806,9 +912,9 @@ var V = ["[Stytch]"],
|
|
|
806
912
|
}, e, this);
|
|
807
913
|
}));
|
|
808
914
|
}, this.getTelemetryID = function () {
|
|
809
|
-
return
|
|
915
|
+
return O(i, void 0, void 0, o().mark(function e() {
|
|
810
916
|
var t, r, n, i;
|
|
811
|
-
return
|
|
917
|
+
return o().wrap(function (e) {
|
|
812
918
|
for (;;) switch (e.prev = e.next) {
|
|
813
919
|
case 0:
|
|
814
920
|
return e.next = 2, this.state;
|
|
@@ -828,9 +934,71 @@ var V = ["[Stytch]"],
|
|
|
828
934
|
}
|
|
829
935
|
}, e, this);
|
|
830
936
|
}));
|
|
937
|
+
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
938
|
+
return O(i, void 0, void 0, o().mark(function e() {
|
|
939
|
+
var t, r, n, i, s;
|
|
940
|
+
return o().wrap(function (e) {
|
|
941
|
+
for (;;) switch (e.prev = e.next) {
|
|
942
|
+
case 0:
|
|
943
|
+
return e.next = 2, this.state;
|
|
944
|
+
case 2:
|
|
945
|
+
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = void 0, s = void 0, !r) {
|
|
946
|
+
e.next = 13;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
return e.next = 10, this.getTelemetryID();
|
|
950
|
+
case 10:
|
|
951
|
+
i = e.sent, e.next = 16;
|
|
952
|
+
break;
|
|
953
|
+
case 13:
|
|
954
|
+
return e.next = 15, n();
|
|
955
|
+
case 15:
|
|
956
|
+
s = e.sent;
|
|
957
|
+
case 16:
|
|
958
|
+
return e.abrupt("return", {
|
|
959
|
+
dfp_telemetry_id: i,
|
|
960
|
+
captcha_token: s
|
|
961
|
+
});
|
|
962
|
+
case 17:
|
|
963
|
+
case "end":
|
|
964
|
+
return e.stop();
|
|
965
|
+
}
|
|
966
|
+
}, e, this);
|
|
967
|
+
}));
|
|
968
|
+
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
969
|
+
return O(i, void 0, void 0, o().mark(function r() {
|
|
970
|
+
var n, i, s;
|
|
971
|
+
return o().wrap(function (r) {
|
|
972
|
+
for (;;) switch (r.prev = r.next) {
|
|
973
|
+
case 0:
|
|
974
|
+
return r.next = 2, this.state;
|
|
975
|
+
case 2:
|
|
976
|
+
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !== D.RequiredCatcha || !i) {
|
|
977
|
+
r.next = 14;
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
if (!t.body) {
|
|
981
|
+
r.next = 13;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
return r.next = 9, this.getTelemetryID();
|
|
985
|
+
case 9:
|
|
986
|
+
return t.body.dfp_telemetry_id = r.sent, r.next = 12, s();
|
|
987
|
+
case 12:
|
|
988
|
+
t.body.captcha_token = r.sent;
|
|
989
|
+
case 13:
|
|
990
|
+
return r.abrupt("return", t);
|
|
991
|
+
case 14:
|
|
992
|
+
throw new Error("Unable to query captcha and/or dfp telemetry ID");
|
|
993
|
+
case 15:
|
|
994
|
+
case "end":
|
|
995
|
+
return r.stop();
|
|
996
|
+
}
|
|
997
|
+
}, r, this);
|
|
998
|
+
}));
|
|
831
999
|
}, this.state = n.then(function (e) {
|
|
832
|
-
return
|
|
833
|
-
return
|
|
1000
|
+
return O(i, void 0, void 0, o().mark(function n() {
|
|
1001
|
+
return o().wrap(function (n) {
|
|
834
1002
|
for (;;) switch (n.prev = n.next) {
|
|
835
1003
|
case 0:
|
|
836
1004
|
if (e.runDFPProtectedAuth) {
|
|
@@ -841,10 +1009,11 @@ var V = ["[Stytch]"],
|
|
|
841
1009
|
publicToken: t,
|
|
842
1010
|
dfpBackendURL: r,
|
|
843
1011
|
enabled: !1,
|
|
844
|
-
loaded: !1
|
|
1012
|
+
loaded: !1,
|
|
1013
|
+
executeRecaptcha: s
|
|
845
1014
|
});
|
|
846
1015
|
case 2:
|
|
847
|
-
return n.next = 4, void
|
|
1016
|
+
return n.next = 4, void V("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
848
1017
|
return window;
|
|
849
1018
|
});
|
|
850
1019
|
case 4:
|
|
@@ -852,7 +1021,8 @@ var V = ["[Stytch]"],
|
|
|
852
1021
|
publicToken: t,
|
|
853
1022
|
dfpBackendURL: r,
|
|
854
1023
|
enabled: !0,
|
|
855
|
-
loaded: !0
|
|
1024
|
+
loaded: !0,
|
|
1025
|
+
executeRecaptcha: s
|
|
856
1026
|
});
|
|
857
1027
|
case 5:
|
|
858
1028
|
case "end":
|
|
@@ -862,7 +1032,66 @@ var V = ["[Stytch]"],
|
|
|
862
1032
|
}));
|
|
863
1033
|
});
|
|
864
1034
|
}),
|
|
865
|
-
|
|
1035
|
+
se = function se() {
|
|
1036
|
+
return {
|
|
1037
|
+
isEnabled: function isEnabled() {
|
|
1038
|
+
return O(void 0, void 0, void 0, o().mark(function e() {
|
|
1039
|
+
return o().wrap(function (e) {
|
|
1040
|
+
for (;;) switch (e.prev = e.next) {
|
|
1041
|
+
case 0:
|
|
1042
|
+
return e.abrupt("return", !1);
|
|
1043
|
+
case 1:
|
|
1044
|
+
case "end":
|
|
1045
|
+
return e.stop();
|
|
1046
|
+
}
|
|
1047
|
+
}, e);
|
|
1048
|
+
}));
|
|
1049
|
+
},
|
|
1050
|
+
getTelemetryID: function getTelemetryID() {
|
|
1051
|
+
return O(void 0, void 0, void 0, o().mark(function e() {
|
|
1052
|
+
return o().wrap(function (e) {
|
|
1053
|
+
for (;;) switch (e.prev = e.next) {
|
|
1054
|
+
case 0:
|
|
1055
|
+
return e.abrupt("return", void 0);
|
|
1056
|
+
case 1:
|
|
1057
|
+
case "end":
|
|
1058
|
+
return e.stop();
|
|
1059
|
+
}
|
|
1060
|
+
}, e);
|
|
1061
|
+
}));
|
|
1062
|
+
},
|
|
1063
|
+
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1064
|
+
return O(void 0, void 0, void 0, o().mark(function e() {
|
|
1065
|
+
return o().wrap(function (e) {
|
|
1066
|
+
for (;;) switch (e.prev = e.next) {
|
|
1067
|
+
case 0:
|
|
1068
|
+
return e.abrupt("return", {
|
|
1069
|
+
dfp_telemetry_id: void 0,
|
|
1070
|
+
captcha_token: void 0
|
|
1071
|
+
});
|
|
1072
|
+
case 1:
|
|
1073
|
+
case "end":
|
|
1074
|
+
return e.stop();
|
|
1075
|
+
}
|
|
1076
|
+
}, e);
|
|
1077
|
+
}));
|
|
1078
|
+
},
|
|
1079
|
+
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1080
|
+
return O(void 0, void 0, void 0, o().mark(function e() {
|
|
1081
|
+
return o().wrap(function (e) {
|
|
1082
|
+
for (;;) switch (e.prev = e.next) {
|
|
1083
|
+
case 0:
|
|
1084
|
+
throw new Error("DFP protected auth is disabled");
|
|
1085
|
+
case 1:
|
|
1086
|
+
case "end":
|
|
1087
|
+
return e.stop();
|
|
1088
|
+
}
|
|
1089
|
+
}, e);
|
|
1090
|
+
}));
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
},
|
|
1094
|
+
ae = function () {
|
|
866
1095
|
function e() {
|
|
867
1096
|
c(this, e);
|
|
868
1097
|
}
|
|
@@ -886,11 +1115,11 @@ var V = ["[Stytch]"],
|
|
|
886
1115
|
value: function value(t) {
|
|
887
1116
|
if ("name" in t) switch (t.name) {
|
|
888
1117
|
case "SDKAPIUnreachableError":
|
|
889
|
-
return e.inflate(
|
|
1118
|
+
return e.inflate(R, t);
|
|
890
1119
|
case "StytchSDKSchemaError":
|
|
891
|
-
return e.inflate(
|
|
1120
|
+
return e.inflate(I, t);
|
|
892
1121
|
case "StytchSDKAPIError":
|
|
893
|
-
return e.inflate(
|
|
1122
|
+
return e.inflate(L, t);
|
|
894
1123
|
case "TypeError":
|
|
895
1124
|
return e.inflate(TypeError, t);
|
|
896
1125
|
case "SyntaxError":
|
|
@@ -908,7 +1137,7 @@ var V = ["[Stytch]"],
|
|
|
908
1137
|
}
|
|
909
1138
|
}]), e;
|
|
910
1139
|
}(),
|
|
911
|
-
|
|
1140
|
+
ce = function () {
|
|
912
1141
|
function e(t) {
|
|
913
1142
|
c(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
914
1143
|
}
|
|
@@ -923,9 +1152,9 @@ var V = ["[Stytch]"],
|
|
|
923
1152
|
}, {
|
|
924
1153
|
key: "flush",
|
|
925
1154
|
value: function value() {
|
|
926
|
-
return
|
|
1155
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
927
1156
|
var t;
|
|
928
|
-
return
|
|
1157
|
+
return o().wrap(function (e) {
|
|
929
1158
|
for (;;) switch (e.prev = e.next) {
|
|
930
1159
|
case 0:
|
|
931
1160
|
if (this.batch.length) {
|
|
@@ -954,13 +1183,16 @@ var V = ["[Stytch]"],
|
|
|
954
1183
|
}));
|
|
955
1184
|
}
|
|
956
1185
|
}]), e;
|
|
957
|
-
}()
|
|
958
|
-
|
|
1186
|
+
}();
|
|
1187
|
+
!function (e) {
|
|
1188
|
+
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1189
|
+
}(X || (X = {}));
|
|
1190
|
+
var ue = a(function e(t, r) {
|
|
959
1191
|
var n = this;
|
|
960
1192
|
c(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
961
|
-
return
|
|
1193
|
+
return O(n, void 0, void 0, o().mark(function e() {
|
|
962
1194
|
var t, r;
|
|
963
|
-
return
|
|
1195
|
+
return o().wrap(function (e) {
|
|
964
1196
|
for (;;) switch (e.prev = e.next) {
|
|
965
1197
|
case 0:
|
|
966
1198
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -969,7 +1201,7 @@ var V = ["[Stytch]"],
|
|
|
969
1201
|
method: "GET"
|
|
970
1202
|
});
|
|
971
1203
|
case 2:
|
|
972
|
-
return t = e.sent, r =
|
|
1204
|
+
return t = e.sent, r = ne(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
973
1205
|
case 6:
|
|
974
1206
|
case "end":
|
|
975
1207
|
return e.stop();
|
|
@@ -979,19 +1211,19 @@ var V = ["[Stytch]"],
|
|
|
979
1211
|
}, this.getSync = function () {
|
|
980
1212
|
return n._subscriptionService.getUser();
|
|
981
1213
|
}, this.update = function (e) {
|
|
982
|
-
return
|
|
1214
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
983
1215
|
var r, n;
|
|
984
|
-
return
|
|
1216
|
+
return o().wrap(function (t) {
|
|
985
1217
|
for (;;) switch (t.prev = t.next) {
|
|
986
1218
|
case 0:
|
|
987
|
-
return
|
|
1219
|
+
return re("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
988
1220
|
url: "/users/me",
|
|
989
1221
|
body: e,
|
|
990
1222
|
errorMessage: "Failed to update user.",
|
|
991
1223
|
method: "PUT"
|
|
992
1224
|
});
|
|
993
1225
|
case 3:
|
|
994
|
-
return r = t.sent, n =
|
|
1226
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
995
1227
|
case 7:
|
|
996
1228
|
case "end":
|
|
997
1229
|
return t.stop();
|
|
@@ -999,9 +1231,9 @@ var V = ["[Stytch]"],
|
|
|
999
1231
|
}, t, this);
|
|
1000
1232
|
}));
|
|
1001
1233
|
}, this.deleteEmail = function (e) {
|
|
1002
|
-
return
|
|
1234
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1003
1235
|
var r, n;
|
|
1004
|
-
return
|
|
1236
|
+
return o().wrap(function (t) {
|
|
1005
1237
|
for (;;) switch (t.prev = t.next) {
|
|
1006
1238
|
case 0:
|
|
1007
1239
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1010,7 +1242,7 @@ var V = ["[Stytch]"],
|
|
|
1010
1242
|
method: "DELETE"
|
|
1011
1243
|
});
|
|
1012
1244
|
case 2:
|
|
1013
|
-
return r = t.sent, n =
|
|
1245
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1014
1246
|
case 6:
|
|
1015
1247
|
case "end":
|
|
1016
1248
|
return t.stop();
|
|
@@ -1018,9 +1250,9 @@ var V = ["[Stytch]"],
|
|
|
1018
1250
|
}, t, this);
|
|
1019
1251
|
}));
|
|
1020
1252
|
}, this.deletePhoneNumber = function (e) {
|
|
1021
|
-
return
|
|
1253
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1022
1254
|
var r, n;
|
|
1023
|
-
return
|
|
1255
|
+
return o().wrap(function (t) {
|
|
1024
1256
|
for (;;) switch (t.prev = t.next) {
|
|
1025
1257
|
case 0:
|
|
1026
1258
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1029,7 +1261,7 @@ var V = ["[Stytch]"],
|
|
|
1029
1261
|
method: "DELETE"
|
|
1030
1262
|
});
|
|
1031
1263
|
case 2:
|
|
1032
|
-
return r = t.sent, n =
|
|
1264
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1033
1265
|
case 6:
|
|
1034
1266
|
case "end":
|
|
1035
1267
|
return t.stop();
|
|
@@ -1037,9 +1269,9 @@ var V = ["[Stytch]"],
|
|
|
1037
1269
|
}, t, this);
|
|
1038
1270
|
}));
|
|
1039
1271
|
}, this.deleteTOTP = function (e) {
|
|
1040
|
-
return
|
|
1272
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1041
1273
|
var r, n;
|
|
1042
|
-
return
|
|
1274
|
+
return o().wrap(function (t) {
|
|
1043
1275
|
for (;;) switch (t.prev = t.next) {
|
|
1044
1276
|
case 0:
|
|
1045
1277
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1048,7 +1280,7 @@ var V = ["[Stytch]"],
|
|
|
1048
1280
|
method: "DELETE"
|
|
1049
1281
|
});
|
|
1050
1282
|
case 2:
|
|
1051
|
-
return r = t.sent, n =
|
|
1283
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1052
1284
|
case 6:
|
|
1053
1285
|
case "end":
|
|
1054
1286
|
return t.stop();
|
|
@@ -1056,9 +1288,9 @@ var V = ["[Stytch]"],
|
|
|
1056
1288
|
}, t, this);
|
|
1057
1289
|
}));
|
|
1058
1290
|
}, this.deleteOAuthRegistration = function (e) {
|
|
1059
|
-
return
|
|
1291
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1060
1292
|
var r, n;
|
|
1061
|
-
return
|
|
1293
|
+
return o().wrap(function (t) {
|
|
1062
1294
|
for (;;) switch (t.prev = t.next) {
|
|
1063
1295
|
case 0:
|
|
1064
1296
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1067,7 +1299,7 @@ var V = ["[Stytch]"],
|
|
|
1067
1299
|
method: "DELETE"
|
|
1068
1300
|
});
|
|
1069
1301
|
case 2:
|
|
1070
|
-
return r = t.sent, n =
|
|
1302
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1071
1303
|
case 6:
|
|
1072
1304
|
case "end":
|
|
1073
1305
|
return t.stop();
|
|
@@ -1075,9 +1307,9 @@ var V = ["[Stytch]"],
|
|
|
1075
1307
|
}, t, this);
|
|
1076
1308
|
}));
|
|
1077
1309
|
}, this.deleteWebauthnRegistration = function (e) {
|
|
1078
|
-
return
|
|
1310
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1079
1311
|
var r, n;
|
|
1080
|
-
return
|
|
1312
|
+
return o().wrap(function (t) {
|
|
1081
1313
|
for (;;) switch (t.prev = t.next) {
|
|
1082
1314
|
case 0:
|
|
1083
1315
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1086,7 +1318,7 @@ var V = ["[Stytch]"],
|
|
|
1086
1318
|
method: "DELETE"
|
|
1087
1319
|
});
|
|
1088
1320
|
case 2:
|
|
1089
|
-
return r = t.sent, n =
|
|
1321
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1090
1322
|
case 6:
|
|
1091
1323
|
case "end":
|
|
1092
1324
|
return t.stop();
|
|
@@ -1094,9 +1326,9 @@ var V = ["[Stytch]"],
|
|
|
1094
1326
|
}, t, this);
|
|
1095
1327
|
}));
|
|
1096
1328
|
}, this.deleteBiometricRegistration = function (e) {
|
|
1097
|
-
return
|
|
1329
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1098
1330
|
var r, n;
|
|
1099
|
-
return
|
|
1331
|
+
return o().wrap(function (t) {
|
|
1100
1332
|
for (;;) switch (t.prev = t.next) {
|
|
1101
1333
|
case 0:
|
|
1102
1334
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1105,7 +1337,7 @@ var V = ["[Stytch]"],
|
|
|
1105
1337
|
method: "DELETE"
|
|
1106
1338
|
});
|
|
1107
1339
|
case 2:
|
|
1108
|
-
return r = t.sent, n =
|
|
1340
|
+
return r = t.sent, n = ne(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", ie(r));
|
|
1109
1341
|
case 6:
|
|
1110
1342
|
case "end":
|
|
1111
1343
|
return t.stop();
|
|
@@ -1120,7 +1352,7 @@ var V = ["[Stytch]"],
|
|
|
1120
1352
|
});
|
|
1121
1353
|
};
|
|
1122
1354
|
}),
|
|
1123
|
-
|
|
1355
|
+
le = function () {
|
|
1124
1356
|
function e(t, r) {
|
|
1125
1357
|
var n = this;
|
|
1126
1358
|
c(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
@@ -1132,9 +1364,9 @@ var V = ["[Stytch]"],
|
|
|
1132
1364
|
(null == r ? void 0 : r.session) !== t && (t = null !== (n = null == r ? void 0 : r.session) && void 0 !== n ? n : null, e(t));
|
|
1133
1365
|
});
|
|
1134
1366
|
}, this.revoke = function (e) {
|
|
1135
|
-
return
|
|
1367
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1136
1368
|
var r;
|
|
1137
|
-
return
|
|
1369
|
+
return o().wrap(function (t) {
|
|
1138
1370
|
for (;;) switch (t.prev = t.next) {
|
|
1139
1371
|
case 0:
|
|
1140
1372
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1145,7 +1377,7 @@ var V = ["[Stytch]"],
|
|
|
1145
1377
|
case 3:
|
|
1146
1378
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
1147
1379
|
case 8:
|
|
1148
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
1380
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || F.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
1149
1381
|
case 12:
|
|
1150
1382
|
case "end":
|
|
1151
1383
|
return t.stop();
|
|
@@ -1153,9 +1385,9 @@ var V = ["[Stytch]"],
|
|
|
1153
1385
|
}, t, this, [[0, 8]]);
|
|
1154
1386
|
}));
|
|
1155
1387
|
}, this.authenticate = function (e) {
|
|
1156
|
-
return
|
|
1388
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
1157
1389
|
var r, n;
|
|
1158
|
-
return
|
|
1390
|
+
return o().wrap(function (t) {
|
|
1159
1391
|
for (;;) switch (t.prev = t.next) {
|
|
1160
1392
|
case 0:
|
|
1161
1393
|
return t.prev = 0, r = {
|
|
@@ -1175,9 +1407,9 @@ var V = ["[Stytch]"],
|
|
|
1175
1407
|
session_token: n.session_token,
|
|
1176
1408
|
session_jwt: n.session_jwt,
|
|
1177
1409
|
intermediate_session_token: null
|
|
1178
|
-
}), t.abrupt("return",
|
|
1410
|
+
}), t.abrupt("return", ie(n));
|
|
1179
1411
|
case 9:
|
|
1180
|
-
throw t.prev = 9, t.t0 = t["catch"](0),
|
|
1412
|
+
throw t.prev = 9, t.t0 = t["catch"](0), F.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
|
|
1181
1413
|
case 13:
|
|
1182
1414
|
case "end":
|
|
1183
1415
|
return t.stop();
|
|
@@ -1198,77 +1430,37 @@ var V = ["[Stytch]"],
|
|
|
1198
1430
|
}
|
|
1199
1431
|
}]), e;
|
|
1200
1432
|
}(),
|
|
1201
|
-
|
|
1433
|
+
de = Promise.resolve({
|
|
1202
1434
|
pkceRequiredForEmailMagicLinks: !1
|
|
1203
1435
|
}),
|
|
1204
|
-
|
|
1436
|
+
he = function () {
|
|
1205
1437
|
function e(t, r, n, i) {
|
|
1206
|
-
var
|
|
1207
|
-
a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1208
|
-
u = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1209
|
-
|
|
1210
|
-
},
|
|
1211
|
-
l = arguments.length > 6 ? arguments[6] : void 0;
|
|
1212
|
-
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = a, this.executeRecaptcha = u, this._dfpProtectedAuth = l, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1213
|
-
return k(o, void 0, void 0, s().mark(function r() {
|
|
1214
|
-
var n, i;
|
|
1215
|
-
return s().wrap(function (r) {
|
|
1216
|
-
for (;;) switch (r.prev = r.next) {
|
|
1217
|
-
case 0:
|
|
1218
|
-
if (n = this._dfpProtectedAuth, r.t0 = n, !r.t0) {
|
|
1219
|
-
r.next = 6;
|
|
1220
|
-
break;
|
|
1221
|
-
}
|
|
1222
|
-
return r.next = 5, n.isEnabled();
|
|
1223
|
-
case 5:
|
|
1224
|
-
r.t0 = r.sent;
|
|
1225
|
-
case 6:
|
|
1226
|
-
if (i = r.t0, e.type !== De.RequiredCatcha || !i) {
|
|
1227
|
-
r.next = 16;
|
|
1228
|
-
break;
|
|
1229
|
-
}
|
|
1230
|
-
if (!t.body) {
|
|
1231
|
-
r.next = 15;
|
|
1232
|
-
break;
|
|
1233
|
-
}
|
|
1234
|
-
return r.next = 11, n.getTelemetryID();
|
|
1235
|
-
case 11:
|
|
1236
|
-
return t.body.dfp_telemetry_id = r.sent, r.next = 14, this.executeRecaptcha();
|
|
1237
|
-
case 14:
|
|
1238
|
-
t.body.captcha_token = r.sent;
|
|
1239
|
-
case 15:
|
|
1240
|
-
return r.abrupt("return", t);
|
|
1241
|
-
case 16:
|
|
1242
|
-
throw new Error("Unable to query captcha and/or dfp telemetry ID");
|
|
1243
|
-
case 17:
|
|
1244
|
-
case "end":
|
|
1245
|
-
return r.stop();
|
|
1246
|
-
}
|
|
1247
|
-
}, r, this);
|
|
1248
|
-
}));
|
|
1249
|
-
}, this.email = {
|
|
1438
|
+
var s = this,
|
|
1439
|
+
a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : de,
|
|
1440
|
+
u = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : se();
|
|
1441
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = a, this.dfpProtectedAuth = u, this.email = {
|
|
1250
1442
|
loginOrCreate: function loginOrCreate(e) {
|
|
1251
1443
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1252
|
-
return
|
|
1253
|
-
var n, i,
|
|
1254
|
-
return
|
|
1444
|
+
return O(s, void 0, void 0, o().mark(function r() {
|
|
1445
|
+
var n, i, s, a, c, u, l;
|
|
1446
|
+
return o().wrap(function (r) {
|
|
1255
1447
|
for (;;) switch (r.prev = r.next) {
|
|
1256
1448
|
case 0:
|
|
1257
1449
|
return r.next = 2, this._config;
|
|
1258
1450
|
case 2:
|
|
1259
|
-
if (n = r.sent, i = n.pkceRequiredForEmailMagicLinks,
|
|
1451
|
+
if (n = r.sent, i = n.pkceRequiredForEmailMagicLinks, s = void 0, !i) {
|
|
1260
1452
|
r.next = 9;
|
|
1261
1453
|
break;
|
|
1262
1454
|
}
|
|
1263
1455
|
return r.next = 8, this.getCodeChallenge();
|
|
1264
1456
|
case 8:
|
|
1265
|
-
|
|
1457
|
+
s = r.sent;
|
|
1266
1458
|
case 9:
|
|
1267
|
-
return r.next = 11, this.getDFPTelemetryIDAndCaptcha();
|
|
1459
|
+
return r.next = 11, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1268
1460
|
case 11:
|
|
1269
1461
|
return a = r.sent, c = a.dfp_telemetry_id, u = a.captcha_token, l = Object.assign(Object.assign({}, t), {
|
|
1270
1462
|
email: e,
|
|
1271
|
-
code_challenge:
|
|
1463
|
+
code_challenge: s,
|
|
1272
1464
|
captcha_token: u,
|
|
1273
1465
|
dfp_telemetry_id: c
|
|
1274
1466
|
}), r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
@@ -1276,7 +1468,7 @@ var V = ["[Stytch]"],
|
|
|
1276
1468
|
body: l,
|
|
1277
1469
|
errorMessage: "Failed to send magic link",
|
|
1278
1470
|
method: "POST",
|
|
1279
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
1471
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1280
1472
|
}));
|
|
1281
1473
|
case 16:
|
|
1282
1474
|
case "end":
|
|
@@ -1287,26 +1479,26 @@ var V = ["[Stytch]"],
|
|
|
1287
1479
|
},
|
|
1288
1480
|
send: function send(e) {
|
|
1289
1481
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1290
|
-
return
|
|
1291
|
-
var n, i,
|
|
1292
|
-
return
|
|
1482
|
+
return O(s, void 0, void 0, o().mark(function r() {
|
|
1483
|
+
var n, i, s, a, c, u, l, d, h;
|
|
1484
|
+
return o().wrap(function (r) {
|
|
1293
1485
|
for (;;) switch (r.prev = r.next) {
|
|
1294
1486
|
case 0:
|
|
1295
1487
|
return r.next = 2, this._config;
|
|
1296
1488
|
case 2:
|
|
1297
|
-
if (n = r.sent, i = n.pkceRequiredForEmailMagicLinks,
|
|
1489
|
+
if (n = r.sent, i = n.pkceRequiredForEmailMagicLinks, s = void 0, !i) {
|
|
1298
1490
|
r.next = 9;
|
|
1299
1491
|
break;
|
|
1300
1492
|
}
|
|
1301
1493
|
return r.next = 8, this.getCodeChallenge();
|
|
1302
1494
|
case 8:
|
|
1303
|
-
|
|
1495
|
+
s = r.sent;
|
|
1304
1496
|
case 9:
|
|
1305
|
-
return r.next = 11, this.getDFPTelemetryIDAndCaptcha();
|
|
1497
|
+
return r.next = 11, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1306
1498
|
case 11:
|
|
1307
1499
|
return a = r.sent, c = a.dfp_telemetry_id, u = a.captcha_token, l = Object.assign(Object.assign({}, t), {
|
|
1308
1500
|
email: e,
|
|
1309
|
-
code_challenge:
|
|
1501
|
+
code_challenge: s,
|
|
1310
1502
|
captcha_token: u,
|
|
1311
1503
|
dfp_telemetry_id: c
|
|
1312
1504
|
}), d = !!this._subscriptionService.getSession(), h = d ? "/magic_links/email/send/secondary" : "/magic_links/email/send/primary", r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
@@ -1314,7 +1506,7 @@ var V = ["[Stytch]"],
|
|
|
1314
1506
|
body: l,
|
|
1315
1507
|
errorMessage: "Failed to send magic link",
|
|
1316
1508
|
method: "POST",
|
|
1317
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
1509
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1318
1510
|
}));
|
|
1319
1511
|
case 18:
|
|
1320
1512
|
case "end":
|
|
@@ -1324,12 +1516,12 @@ var V = ["[Stytch]"],
|
|
|
1324
1516
|
}));
|
|
1325
1517
|
}
|
|
1326
1518
|
}, this.authenticate = function (e, t) {
|
|
1327
|
-
return
|
|
1519
|
+
return O(s, void 0, void 0, o().mark(function r() {
|
|
1328
1520
|
var n, i;
|
|
1329
|
-
return
|
|
1521
|
+
return o().wrap(function (r) {
|
|
1330
1522
|
for (;;) switch (r.prev = r.next) {
|
|
1331
1523
|
case 0:
|
|
1332
|
-
return
|
|
1524
|
+
return re("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1333
1525
|
case 3:
|
|
1334
1526
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1335
1527
|
r.next = 19;
|
|
@@ -1369,7 +1561,7 @@ var V = ["[Stytch]"],
|
|
|
1369
1561
|
session_token: i.session_token,
|
|
1370
1562
|
session_jwt: i.session_jwt,
|
|
1371
1563
|
intermediate_session_token: null
|
|
1372
|
-
}), r.abrupt("return",
|
|
1564
|
+
}), r.abrupt("return", ie(i));
|
|
1373
1565
|
case 25:
|
|
1374
1566
|
case "end":
|
|
1375
1567
|
return r.stop();
|
|
@@ -1381,9 +1573,9 @@ var V = ["[Stytch]"],
|
|
|
1381
1573
|
return a(e, [{
|
|
1382
1574
|
key: "getCodeChallenge",
|
|
1383
1575
|
value: function value() {
|
|
1384
|
-
return
|
|
1576
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
1385
1577
|
var t;
|
|
1386
|
-
return
|
|
1578
|
+
return o().wrap(function (e) {
|
|
1387
1579
|
for (;;) switch (e.prev = e.next) {
|
|
1388
1580
|
case 0:
|
|
1389
1581
|
return e.next = 2, this._pkceManager.getPKPair();
|
|
@@ -1404,52 +1596,12 @@ var V = ["[Stytch]"],
|
|
|
1404
1596
|
}, e, this);
|
|
1405
1597
|
}));
|
|
1406
1598
|
}
|
|
1407
|
-
}, {
|
|
1408
|
-
key: "getDFPTelemetryIDAndCaptcha",
|
|
1409
|
-
value: function value() {
|
|
1410
|
-
return k(this, void 0, void 0, s().mark(function e() {
|
|
1411
|
-
var t, r;
|
|
1412
|
-
return s().wrap(function (e) {
|
|
1413
|
-
for (;;) switch (e.prev = e.next) {
|
|
1414
|
-
case 0:
|
|
1415
|
-
if (t = void 0, r = void 0, e.t0 = this._dfpProtectedAuth, !e.t0) {
|
|
1416
|
-
e.next = 7;
|
|
1417
|
-
break;
|
|
1418
|
-
}
|
|
1419
|
-
return e.next = 6, this._dfpProtectedAuth.isEnabled();
|
|
1420
|
-
case 6:
|
|
1421
|
-
e.t0 = e.sent;
|
|
1422
|
-
case 7:
|
|
1423
|
-
if (!e.t0) {
|
|
1424
|
-
e.next = 13;
|
|
1425
|
-
break;
|
|
1426
|
-
}
|
|
1427
|
-
return e.next = 10, this._dfpProtectedAuth.getTelemetryID();
|
|
1428
|
-
case 10:
|
|
1429
|
-
t = e.sent, e.next = 16;
|
|
1430
|
-
break;
|
|
1431
|
-
case 13:
|
|
1432
|
-
return e.next = 15, this.executeRecaptcha();
|
|
1433
|
-
case 15:
|
|
1434
|
-
r = e.sent;
|
|
1435
|
-
case 16:
|
|
1436
|
-
return e.abrupt("return", {
|
|
1437
|
-
dfp_telemetry_id: t,
|
|
1438
|
-
captcha_token: r
|
|
1439
|
-
});
|
|
1440
|
-
case 17:
|
|
1441
|
-
case "end":
|
|
1442
|
-
return e.stop();
|
|
1443
|
-
}
|
|
1444
|
-
}, e, this);
|
|
1445
|
-
}));
|
|
1446
|
-
}
|
|
1447
1599
|
}, {
|
|
1448
1600
|
key: "handlePKCEForAuthenticate",
|
|
1449
1601
|
value: function value(e, t) {
|
|
1450
|
-
return
|
|
1451
|
-
var n, i,
|
|
1452
|
-
return
|
|
1602
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
1603
|
+
var n, i, s;
|
|
1604
|
+
return o().wrap(function (r) {
|
|
1453
1605
|
for (;;) switch (r.prev = r.next) {
|
|
1454
1606
|
case 0:
|
|
1455
1607
|
return r.next = 2, e.getPKPair();
|
|
@@ -1463,7 +1615,7 @@ var V = ["[Stytch]"],
|
|
|
1463
1615
|
method: "POST"
|
|
1464
1616
|
});
|
|
1465
1617
|
case 6:
|
|
1466
|
-
return
|
|
1618
|
+
return s = r.sent, e.clearPKPair(), r.abrupt("return", s);
|
|
1467
1619
|
case 9:
|
|
1468
1620
|
case "end":
|
|
1469
1621
|
return r.stop();
|
|
@@ -1473,30 +1625,33 @@ var V = ["[Stytch]"],
|
|
|
1473
1625
|
}
|
|
1474
1626
|
}]), e;
|
|
1475
1627
|
}(),
|
|
1476
|
-
|
|
1628
|
+
pe = a(function e(t, r) {
|
|
1477
1629
|
var n = this,
|
|
1478
1630
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1479
1631
|
return Promise.resolve(void 0);
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1632
|
+
},
|
|
1633
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : se();
|
|
1634
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = i, this.dfpProtectedAuth = s, this.sms = {
|
|
1482
1635
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1483
|
-
return
|
|
1484
|
-
var n, i;
|
|
1485
|
-
return
|
|
1636
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1637
|
+
var n, i, s, a;
|
|
1638
|
+
return o().wrap(function (r) {
|
|
1486
1639
|
for (;;) switch (r.prev = r.next) {
|
|
1487
1640
|
case 0:
|
|
1488
|
-
return r.next = 2, this.
|
|
1641
|
+
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1489
1642
|
case 2:
|
|
1490
|
-
return n = r.sent, i = Object.assign(Object.assign({}, t), {
|
|
1643
|
+
return n = r.sent, i = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign(Object.assign({}, t), {
|
|
1491
1644
|
phone_number: e,
|
|
1492
|
-
captcha_token:
|
|
1493
|
-
|
|
1645
|
+
captcha_token: s,
|
|
1646
|
+
dfp_telemetry_id: i
|
|
1647
|
+
}), r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
1494
1648
|
url: "/otps/sms/login_or_create",
|
|
1495
|
-
body:
|
|
1649
|
+
body: a,
|
|
1496
1650
|
errorMessage: "Failed to send one time passcode",
|
|
1497
|
-
method: "POST"
|
|
1651
|
+
method: "POST",
|
|
1652
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1498
1653
|
}));
|
|
1499
|
-
case
|
|
1654
|
+
case 7:
|
|
1500
1655
|
case "end":
|
|
1501
1656
|
return r.stop();
|
|
1502
1657
|
}
|
|
@@ -1504,23 +1659,25 @@ var V = ["[Stytch]"],
|
|
|
1504
1659
|
}));
|
|
1505
1660
|
},
|
|
1506
1661
|
send: function send(e, t) {
|
|
1507
|
-
return
|
|
1508
|
-
var n, i,
|
|
1509
|
-
return
|
|
1662
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1663
|
+
var n, i, s, a, c, u;
|
|
1664
|
+
return o().wrap(function (r) {
|
|
1510
1665
|
for (;;) switch (r.prev = r.next) {
|
|
1511
1666
|
case 0:
|
|
1512
|
-
return r.next = 2, this.
|
|
1667
|
+
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1513
1668
|
case 2:
|
|
1514
|
-
return n = r.sent, i = Object.assign(Object.assign({}, t), {
|
|
1669
|
+
return n = r.sent, i = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign(Object.assign({}, t), {
|
|
1515
1670
|
phone_number: e,
|
|
1516
|
-
captcha_token:
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1671
|
+
captcha_token: s,
|
|
1672
|
+
dfp_telemetry_id: i
|
|
1673
|
+
}), c = !!this._subscriptionService.getSession(), u = c ? "/otps/sms/send/secondary" : "/otps/sms/send/primary", r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
1674
|
+
url: u,
|
|
1675
|
+
body: a,
|
|
1520
1676
|
errorMessage: "Failed to send one time passcode",
|
|
1521
|
-
method: "POST"
|
|
1677
|
+
method: "POST",
|
|
1678
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1522
1679
|
}));
|
|
1523
|
-
case
|
|
1680
|
+
case 9:
|
|
1524
1681
|
case "end":
|
|
1525
1682
|
return r.stop();
|
|
1526
1683
|
}
|
|
@@ -1529,23 +1686,25 @@ var V = ["[Stytch]"],
|
|
|
1529
1686
|
}
|
|
1530
1687
|
}, this.whatsapp = {
|
|
1531
1688
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1532
|
-
return
|
|
1533
|
-
var n, i;
|
|
1534
|
-
return
|
|
1689
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1690
|
+
var n, i, s, a;
|
|
1691
|
+
return o().wrap(function (r) {
|
|
1535
1692
|
for (;;) switch (r.prev = r.next) {
|
|
1536
1693
|
case 0:
|
|
1537
|
-
return r.next = 2, this.
|
|
1694
|
+
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1538
1695
|
case 2:
|
|
1539
|
-
return n = r.sent, i = Object.assign(Object.assign({}, t), {
|
|
1696
|
+
return n = r.sent, i = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign(Object.assign({}, t), {
|
|
1540
1697
|
phone_number: e,
|
|
1541
|
-
|
|
1542
|
-
|
|
1698
|
+
dfp_telemetry_id: i,
|
|
1699
|
+
captcha_token: s
|
|
1700
|
+
}), r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
1543
1701
|
url: "/otps/whatsapp/login_or_create",
|
|
1544
|
-
body:
|
|
1702
|
+
body: a,
|
|
1545
1703
|
errorMessage: "Failed to send one time passcode",
|
|
1546
|
-
method: "POST"
|
|
1704
|
+
method: "POST",
|
|
1705
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1547
1706
|
}));
|
|
1548
|
-
case
|
|
1707
|
+
case 7:
|
|
1549
1708
|
case "end":
|
|
1550
1709
|
return r.stop();
|
|
1551
1710
|
}
|
|
@@ -1553,23 +1712,25 @@ var V = ["[Stytch]"],
|
|
|
1553
1712
|
}));
|
|
1554
1713
|
},
|
|
1555
1714
|
send: function send(e, t) {
|
|
1556
|
-
return
|
|
1557
|
-
var n, i,
|
|
1558
|
-
return
|
|
1715
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1716
|
+
var n, i, s, a, c, u;
|
|
1717
|
+
return o().wrap(function (r) {
|
|
1559
1718
|
for (;;) switch (r.prev = r.next) {
|
|
1560
1719
|
case 0:
|
|
1561
|
-
return r.next = 2, this.
|
|
1720
|
+
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1562
1721
|
case 2:
|
|
1563
|
-
return n = r.sent, i = Object.assign(Object.assign({}, t), {
|
|
1722
|
+
return n = r.sent, i = n.dfp_telemetry_id, s = n.captcha_token, a = Object.assign(Object.assign({}, t), {
|
|
1564
1723
|
phone_number: e,
|
|
1565
|
-
captcha_token:
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1724
|
+
captcha_token: s,
|
|
1725
|
+
dfp_telemetry_id: i
|
|
1726
|
+
}), c = !!this._subscriptionService.getSession(), u = c ? "/otps/whatsapp/send/secondary" : "/otps/whatsapp/send/primary", r.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
1727
|
+
url: u,
|
|
1728
|
+
body: a,
|
|
1569
1729
|
errorMessage: "Failed to send one time passcode",
|
|
1570
|
-
method: "POST"
|
|
1730
|
+
method: "POST",
|
|
1731
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1571
1732
|
}));
|
|
1572
|
-
case
|
|
1733
|
+
case 9:
|
|
1573
1734
|
case "end":
|
|
1574
1735
|
return r.stop();
|
|
1575
1736
|
}
|
|
@@ -1578,9 +1739,9 @@ var V = ["[Stytch]"],
|
|
|
1578
1739
|
}
|
|
1579
1740
|
}, this.email = {
|
|
1580
1741
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1581
|
-
return
|
|
1742
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1582
1743
|
var n, i;
|
|
1583
|
-
return
|
|
1744
|
+
return o().wrap(function (r) {
|
|
1584
1745
|
for (;;) switch (r.prev = r.next) {
|
|
1585
1746
|
case 0:
|
|
1586
1747
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -1602,9 +1763,9 @@ var V = ["[Stytch]"],
|
|
|
1602
1763
|
}));
|
|
1603
1764
|
},
|
|
1604
1765
|
send: function send(e, t) {
|
|
1605
|
-
return
|
|
1606
|
-
var n, i,
|
|
1607
|
-
return
|
|
1766
|
+
return O(n, void 0, void 0, o().mark(function r() {
|
|
1767
|
+
var n, i, s, a;
|
|
1768
|
+
return o().wrap(function (r) {
|
|
1608
1769
|
for (;;) switch (r.prev = r.next) {
|
|
1609
1770
|
case 0:
|
|
1610
1771
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -1612,7 +1773,7 @@ var V = ["[Stytch]"],
|
|
|
1612
1773
|
return n = r.sent, i = Object.assign(Object.assign({}, t), {
|
|
1613
1774
|
email: e,
|
|
1614
1775
|
captcha_token: n
|
|
1615
|
-
}),
|
|
1776
|
+
}), s = !!this._subscriptionService.getSession(), a = s ? "/otps/email/send/secondary" : "/otps/email/send/primary", r.abrupt("return", this._networkClient.fetchSDK({
|
|
1616
1777
|
url: a,
|
|
1617
1778
|
body: i,
|
|
1618
1779
|
errorMessage: "Failed to send one time passcode",
|
|
@@ -1626,31 +1787,36 @@ var V = ["[Stytch]"],
|
|
|
1626
1787
|
}));
|
|
1627
1788
|
}
|
|
1628
1789
|
}, this.authenticate = function (e, t, r) {
|
|
1629
|
-
return
|
|
1630
|
-
var i,
|
|
1631
|
-
return
|
|
1790
|
+
return O(n, void 0, void 0, o().mark(function n() {
|
|
1791
|
+
var i, s, a, c, u;
|
|
1792
|
+
return o().wrap(function (n) {
|
|
1632
1793
|
for (;;) switch (n.prev = n.next) {
|
|
1633
1794
|
case 0:
|
|
1634
|
-
return
|
|
1795
|
+
return re("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1796
|
+
case 3:
|
|
1797
|
+
return i = n.sent, s = i.dfp_telemetry_id, a = i.captcha_token, c = Object.assign({
|
|
1635
1798
|
token: e,
|
|
1636
|
-
method_id: t
|
|
1637
|
-
|
|
1799
|
+
method_id: t,
|
|
1800
|
+
dfp_telemetry_id: s,
|
|
1801
|
+
captcha_token: a
|
|
1802
|
+
}, r), n.next = 9, this._networkClient.retriableFetchSDK({
|
|
1638
1803
|
url: "/otps/authenticate",
|
|
1639
|
-
body:
|
|
1804
|
+
body: c,
|
|
1640
1805
|
errorMessage: "Failed to authenticate token.",
|
|
1641
|
-
method: "POST"
|
|
1806
|
+
method: "POST",
|
|
1807
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1642
1808
|
});
|
|
1643
|
-
case
|
|
1644
|
-
return
|
|
1809
|
+
case 9:
|
|
1810
|
+
return u = n.sent, this._subscriptionService.updateStateAndTokens({
|
|
1645
1811
|
state: {
|
|
1646
|
-
session:
|
|
1647
|
-
user:
|
|
1812
|
+
session: u.session,
|
|
1813
|
+
user: u.user
|
|
1648
1814
|
},
|
|
1649
|
-
session_token:
|
|
1650
|
-
session_jwt:
|
|
1815
|
+
session_token: u.session_token,
|
|
1816
|
+
session_jwt: u.session_jwt,
|
|
1651
1817
|
intermediate_session_token: null
|
|
1652
|
-
}), n.abrupt("return",
|
|
1653
|
-
case
|
|
1818
|
+
}), n.abrupt("return", ie(u));
|
|
1819
|
+
case 12:
|
|
1654
1820
|
case "end":
|
|
1655
1821
|
return n.stop();
|
|
1656
1822
|
}
|
|
@@ -1658,59 +1824,59 @@ var V = ["[Stytch]"],
|
|
|
1658
1824
|
}));
|
|
1659
1825
|
};
|
|
1660
1826
|
}),
|
|
1661
|
-
|
|
1662
|
-
function e(t, r, n, i,
|
|
1663
|
-
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config =
|
|
1664
|
-
start: this.startOAuthFlow(
|
|
1827
|
+
fe = function () {
|
|
1828
|
+
function e(t, r, n, i, o) {
|
|
1829
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.google = {
|
|
1830
|
+
start: this.startOAuthFlow(y.Google)
|
|
1665
1831
|
}, this.apple = {
|
|
1666
|
-
start: this.startOAuthFlow(
|
|
1832
|
+
start: this.startOAuthFlow(y.Apple)
|
|
1667
1833
|
}, this.microsoft = {
|
|
1668
|
-
start: this.startOAuthFlow(
|
|
1834
|
+
start: this.startOAuthFlow(y.Microsoft)
|
|
1669
1835
|
}, this.github = {
|
|
1670
|
-
start: this.startOAuthFlow(
|
|
1836
|
+
start: this.startOAuthFlow(y.Github)
|
|
1671
1837
|
}, this.gitlab = {
|
|
1672
|
-
start: this.startOAuthFlow(
|
|
1838
|
+
start: this.startOAuthFlow(y.GitLab)
|
|
1673
1839
|
}, this.facebook = {
|
|
1674
|
-
start: this.startOAuthFlow(
|
|
1840
|
+
start: this.startOAuthFlow(y.Facebook)
|
|
1675
1841
|
}, this.discord = {
|
|
1676
|
-
start: this.startOAuthFlow(
|
|
1842
|
+
start: this.startOAuthFlow(y.Discord)
|
|
1677
1843
|
}, this.salesforce = {
|
|
1678
|
-
start: this.startOAuthFlow(
|
|
1844
|
+
start: this.startOAuthFlow(y.Salesforce)
|
|
1679
1845
|
}, this.slack = {
|
|
1680
|
-
start: this.startOAuthFlow(
|
|
1846
|
+
start: this.startOAuthFlow(y.Slack)
|
|
1681
1847
|
}, this.amazon = {
|
|
1682
|
-
start: this.startOAuthFlow(
|
|
1848
|
+
start: this.startOAuthFlow(y.Amazon)
|
|
1683
1849
|
}, this.bitbucket = {
|
|
1684
|
-
start: this.startOAuthFlow(
|
|
1850
|
+
start: this.startOAuthFlow(y.Bitbucket)
|
|
1685
1851
|
}, this.linkedin = {
|
|
1686
|
-
start: this.startOAuthFlow(
|
|
1852
|
+
start: this.startOAuthFlow(y.LinkedIn)
|
|
1687
1853
|
}, this.coinbase = {
|
|
1688
|
-
start: this.startOAuthFlow(
|
|
1854
|
+
start: this.startOAuthFlow(y.Coinbase)
|
|
1689
1855
|
}, this.twitch = {
|
|
1690
|
-
start: this.startOAuthFlow(
|
|
1856
|
+
start: this.startOAuthFlow(y.Twitch)
|
|
1691
1857
|
}, this.twitter = {
|
|
1692
|
-
start: this.startOAuthFlow(
|
|
1858
|
+
start: this.startOAuthFlow(y.Twitter)
|
|
1693
1859
|
}, this.tiktok = {
|
|
1694
|
-
start: this.startOAuthFlow(
|
|
1860
|
+
start: this.startOAuthFlow(y.TikTok)
|
|
1695
1861
|
}, this.snapchat = {
|
|
1696
|
-
start: this.startOAuthFlow(
|
|
1862
|
+
start: this.startOAuthFlow(y.Snapchat)
|
|
1697
1863
|
}, this.figma = {
|
|
1698
|
-
start: this.startOAuthFlow(
|
|
1864
|
+
start: this.startOAuthFlow(y.Figma)
|
|
1699
1865
|
}, this.yahoo = {
|
|
1700
|
-
start: this.startOAuthFlow(
|
|
1866
|
+
start: this.startOAuthFlow(y.Yahoo)
|
|
1701
1867
|
};
|
|
1702
1868
|
}
|
|
1703
1869
|
return a(e, [{
|
|
1704
1870
|
key: "authenticate",
|
|
1705
1871
|
value: function value(e, t) {
|
|
1706
|
-
return
|
|
1872
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
1707
1873
|
var n, i;
|
|
1708
|
-
return
|
|
1874
|
+
return o().wrap(function (r) {
|
|
1709
1875
|
for (;;) switch (r.prev = r.next) {
|
|
1710
1876
|
case 0:
|
|
1711
|
-
return
|
|
1877
|
+
return re("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
1712
1878
|
case 3:
|
|
1713
|
-
return (n = r.sent) ||
|
|
1879
|
+
return (n = r.sent) || Q("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), r.next = 7, this._networkClient.fetchSDK({
|
|
1714
1880
|
url: "/oauth/authenticate",
|
|
1715
1881
|
method: "POST",
|
|
1716
1882
|
body: Object.assign({
|
|
@@ -1723,12 +1889,12 @@ var V = ["[Stytch]"],
|
|
|
1723
1889
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1724
1890
|
state: {
|
|
1725
1891
|
session: i.session,
|
|
1726
|
-
user:
|
|
1892
|
+
user: ne(i.__user)
|
|
1727
1893
|
},
|
|
1728
1894
|
session_token: i.session_token,
|
|
1729
1895
|
session_jwt: i.session_jwt,
|
|
1730
1896
|
intermediate_session_token: null
|
|
1731
|
-
}), r.abrupt("return",
|
|
1897
|
+
}), r.abrupt("return", ie(i));
|
|
1732
1898
|
case 11:
|
|
1733
1899
|
case "end":
|
|
1734
1900
|
return r.stop();
|
|
@@ -1739,9 +1905,9 @@ var V = ["[Stytch]"],
|
|
|
1739
1905
|
}, {
|
|
1740
1906
|
key: "getBaseApiUrl",
|
|
1741
1907
|
value: function value() {
|
|
1742
|
-
return
|
|
1908
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
1743
1909
|
var t, r;
|
|
1744
|
-
return
|
|
1910
|
+
return o().wrap(function (e) {
|
|
1745
1911
|
for (;;) switch (e.prev = e.next) {
|
|
1746
1912
|
case 0:
|
|
1747
1913
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -1774,10 +1940,10 @@ var V = ["[Stytch]"],
|
|
|
1774
1940
|
var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
|
|
1775
1941
|
n = r.login_redirect_url,
|
|
1776
1942
|
i = r.signup_redirect_url,
|
|
1777
|
-
|
|
1778
|
-
return
|
|
1943
|
+
s = r.custom_scopes;
|
|
1944
|
+
return O(t, void 0, void 0, o().mark(function t() {
|
|
1779
1945
|
var r, a, c, u, l, d;
|
|
1780
|
-
return
|
|
1946
|
+
return o().wrap(function (t) {
|
|
1781
1947
|
for (;;) switch (t.prev = t.next) {
|
|
1782
1948
|
case 0:
|
|
1783
1949
|
return t.next = 2, this._dynamicConfig;
|
|
@@ -1788,7 +1954,7 @@ var V = ["[Stytch]"],
|
|
|
1788
1954
|
name: "start_oauth_flow",
|
|
1789
1955
|
details: {
|
|
1790
1956
|
provider_type: e,
|
|
1791
|
-
custom_scopes:
|
|
1957
|
+
custom_scopes: s,
|
|
1792
1958
|
cname_domain: a,
|
|
1793
1959
|
pkce: c
|
|
1794
1960
|
}
|
|
@@ -1803,7 +1969,7 @@ var V = ["[Stytch]"],
|
|
|
1803
1969
|
case 18:
|
|
1804
1970
|
this._pkceManager.clearPKPair();
|
|
1805
1971
|
case 19:
|
|
1806
|
-
|
|
1972
|
+
s && (re("startOAuthFlow").isStringArray("custom_scopes", s), l.searchParams.set("custom_scopes", s.join(" "))), n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
1807
1973
|
case 23:
|
|
1808
1974
|
case "end":
|
|
1809
1975
|
return t.stop();
|
|
@@ -1814,22 +1980,23 @@ var V = ["[Stytch]"],
|
|
|
1814
1980
|
}
|
|
1815
1981
|
}]), e;
|
|
1816
1982
|
}(),
|
|
1817
|
-
|
|
1983
|
+
_e = function () {
|
|
1818
1984
|
function e(t, r) {
|
|
1819
1985
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1986
|
+
return Promise.resolve(void 0);
|
|
1987
|
+
},
|
|
1988
|
+
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : se();
|
|
1989
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = n, this.dfpProtectedAuth = i;
|
|
1823
1990
|
}
|
|
1824
1991
|
return a(e, [{
|
|
1825
1992
|
key: "authenticateStart",
|
|
1826
1993
|
value: function value(e) {
|
|
1827
|
-
return
|
|
1994
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
1828
1995
|
var r, n, i;
|
|
1829
|
-
return
|
|
1996
|
+
return o().wrap(function (t) {
|
|
1830
1997
|
for (;;) switch (t.prev = t.next) {
|
|
1831
1998
|
case 0:
|
|
1832
|
-
return
|
|
1999
|
+
return re("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type), r = !!this._subscriptionService.getSession(), t.next = 4, this.executeRecaptcha();
|
|
1833
2000
|
case 4:
|
|
1834
2001
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
1835
2002
|
url: i,
|
|
@@ -1851,12 +2018,14 @@ var V = ["[Stytch]"],
|
|
|
1851
2018
|
}, {
|
|
1852
2019
|
key: "authenticate",
|
|
1853
2020
|
value: function value(e) {
|
|
1854
|
-
return
|
|
1855
|
-
var r;
|
|
1856
|
-
return
|
|
2021
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2022
|
+
var r, n, i, s;
|
|
2023
|
+
return o().wrap(function (t) {
|
|
1857
2024
|
for (;;) switch (t.prev = t.next) {
|
|
1858
2025
|
case 0:
|
|
1859
|
-
return
|
|
2026
|
+
return re("stytch.cryptoWallets.authenticate").isString("signature", e.signature).isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2027
|
+
case 3:
|
|
2028
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
1860
2029
|
url: "/crypto_wallets/authenticate",
|
|
1861
2030
|
method: "POST",
|
|
1862
2031
|
errorMessage: "Failed to authenticate.",
|
|
@@ -1864,20 +2033,23 @@ var V = ["[Stytch]"],
|
|
|
1864
2033
|
session_duration_minutes: e.session_duration_minutes,
|
|
1865
2034
|
crypto_wallet_address: e.crypto_wallet_address,
|
|
1866
2035
|
crypto_wallet_type: e.crypto_wallet_type,
|
|
1867
|
-
signature: e.signature
|
|
1868
|
-
|
|
2036
|
+
signature: e.signature,
|
|
2037
|
+
captcha_token: i,
|
|
2038
|
+
dfp_telemetry_id: n
|
|
2039
|
+
},
|
|
2040
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1869
2041
|
});
|
|
1870
|
-
case
|
|
1871
|
-
return
|
|
2042
|
+
case 8:
|
|
2043
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
1872
2044
|
state: {
|
|
1873
|
-
session:
|
|
1874
|
-
user:
|
|
2045
|
+
session: s.session,
|
|
2046
|
+
user: ne(s.__user)
|
|
1875
2047
|
},
|
|
1876
|
-
session_token:
|
|
1877
|
-
session_jwt:
|
|
2048
|
+
session_token: s.session_token,
|
|
2049
|
+
session_jwt: s.session_jwt,
|
|
1878
2050
|
intermediate_session_token: null
|
|
1879
|
-
}), t.abrupt("return",
|
|
1880
|
-
case
|
|
2051
|
+
}), t.abrupt("return", ie(s));
|
|
2052
|
+
case 11:
|
|
1881
2053
|
case "end":
|
|
1882
2054
|
return t.stop();
|
|
1883
2055
|
}
|
|
@@ -1886,19 +2058,19 @@ var V = ["[Stytch]"],
|
|
|
1886
2058
|
}
|
|
1887
2059
|
}]), e;
|
|
1888
2060
|
}(),
|
|
1889
|
-
|
|
1890
|
-
function e(t, r) {
|
|
1891
|
-
c(this, e), this._networkClient = t, this._subscriptionService = r;
|
|
2061
|
+
me = function () {
|
|
2062
|
+
function e(t, r, n) {
|
|
2063
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
1892
2064
|
}
|
|
1893
2065
|
return a(e, [{
|
|
1894
2066
|
key: "create",
|
|
1895
2067
|
value: function value(e) {
|
|
1896
|
-
return
|
|
2068
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
1897
2069
|
var r;
|
|
1898
|
-
return
|
|
2070
|
+
return o().wrap(function (t) {
|
|
1899
2071
|
for (;;) switch (t.prev = t.next) {
|
|
1900
2072
|
case 0:
|
|
1901
|
-
return
|
|
2073
|
+
return re("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
1902
2074
|
url: "/totps",
|
|
1903
2075
|
method: "POST",
|
|
1904
2076
|
errorMessage: "Failed to create TOTP",
|
|
@@ -1907,7 +2079,7 @@ var V = ["[Stytch]"],
|
|
|
1907
2079
|
}
|
|
1908
2080
|
});
|
|
1909
2081
|
case 3:
|
|
1910
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2082
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", ie(r));
|
|
1911
2083
|
case 6:
|
|
1912
2084
|
case "end":
|
|
1913
2085
|
return t.stop();
|
|
@@ -1918,31 +2090,36 @@ var V = ["[Stytch]"],
|
|
|
1918
2090
|
}, {
|
|
1919
2091
|
key: "authenticate",
|
|
1920
2092
|
value: function value(e) {
|
|
1921
|
-
return
|
|
1922
|
-
var r;
|
|
1923
|
-
return
|
|
2093
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2094
|
+
var r, n, i, s;
|
|
2095
|
+
return o().wrap(function (t) {
|
|
1924
2096
|
for (;;) switch (t.prev = t.next) {
|
|
1925
2097
|
case 0:
|
|
1926
|
-
return
|
|
2098
|
+
return re("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2099
|
+
case 3:
|
|
2100
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
1927
2101
|
url: "/totps/authenticate",
|
|
1928
2102
|
method: "POST",
|
|
1929
2103
|
errorMessage: "Failed to authenticate TOTP",
|
|
1930
2104
|
body: {
|
|
1931
2105
|
session_duration_minutes: e.session_duration_minutes,
|
|
1932
|
-
totp_code: e.totp_code
|
|
1933
|
-
|
|
2106
|
+
totp_code: e.totp_code,
|
|
2107
|
+
captcha_token: i,
|
|
2108
|
+
dfp_telemetry_id: n
|
|
2109
|
+
},
|
|
2110
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1934
2111
|
});
|
|
1935
|
-
case
|
|
1936
|
-
return
|
|
2112
|
+
case 8:
|
|
2113
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
1937
2114
|
state: {
|
|
1938
|
-
session:
|
|
1939
|
-
user:
|
|
2115
|
+
session: s.session,
|
|
2116
|
+
user: s.__user
|
|
1940
2117
|
},
|
|
1941
|
-
session_token:
|
|
1942
|
-
session_jwt:
|
|
2118
|
+
session_token: s.session_token,
|
|
2119
|
+
session_jwt: s.session_jwt,
|
|
1943
2120
|
intermediate_session_token: null
|
|
1944
|
-
}), t.abrupt("return",
|
|
1945
|
-
case
|
|
2121
|
+
}), t.abrupt("return", ie(s));
|
|
2122
|
+
case 11:
|
|
1946
2123
|
case "end":
|
|
1947
2124
|
return t.stop();
|
|
1948
2125
|
}
|
|
@@ -1952,8 +2129,8 @@ var V = ["[Stytch]"],
|
|
|
1952
2129
|
}, {
|
|
1953
2130
|
key: "recoveryCodes",
|
|
1954
2131
|
value: function value() {
|
|
1955
|
-
return
|
|
1956
|
-
return
|
|
2132
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
2133
|
+
return o().wrap(function (e) {
|
|
1957
2134
|
for (;;) switch (e.prev = e.next) {
|
|
1958
2135
|
case 0:
|
|
1959
2136
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1971,31 +2148,36 @@ var V = ["[Stytch]"],
|
|
|
1971
2148
|
}, {
|
|
1972
2149
|
key: "recover",
|
|
1973
2150
|
value: function value(e) {
|
|
1974
|
-
return
|
|
1975
|
-
var r;
|
|
1976
|
-
return
|
|
2151
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2152
|
+
var r, n, i, s;
|
|
2153
|
+
return o().wrap(function (t) {
|
|
1977
2154
|
for (;;) switch (t.prev = t.next) {
|
|
1978
2155
|
case 0:
|
|
1979
|
-
return
|
|
2156
|
+
return re("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2157
|
+
case 3:
|
|
2158
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
1980
2159
|
url: "/totps/recover",
|
|
1981
2160
|
method: "POST",
|
|
1982
2161
|
errorMessage: "Failed to recover TOTP",
|
|
1983
2162
|
body: {
|
|
1984
2163
|
session_duration_minutes: e.session_duration_minutes,
|
|
1985
|
-
recovery_code: e.recovery_code
|
|
1986
|
-
|
|
2164
|
+
recovery_code: e.recovery_code,
|
|
2165
|
+
captcha_token: i,
|
|
2166
|
+
dfp_telemetry_id: n
|
|
2167
|
+
},
|
|
2168
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1987
2169
|
});
|
|
1988
|
-
case
|
|
1989
|
-
return
|
|
2170
|
+
case 8:
|
|
2171
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
1990
2172
|
state: {
|
|
1991
|
-
session:
|
|
1992
|
-
user:
|
|
2173
|
+
session: s.session,
|
|
2174
|
+
user: s.__user
|
|
1993
2175
|
},
|
|
1994
|
-
session_token:
|
|
1995
|
-
session_jwt:
|
|
2176
|
+
session_token: s.session_token,
|
|
2177
|
+
session_jwt: s.session_jwt,
|
|
1996
2178
|
intermediate_session_token: null
|
|
1997
|
-
}), t.abrupt("return",
|
|
1998
|
-
case
|
|
2179
|
+
}), t.abrupt("return", ie(s));
|
|
2180
|
+
case 11:
|
|
1999
2181
|
case "end":
|
|
2000
2182
|
return t.stop();
|
|
2001
2183
|
}
|
|
@@ -2004,18 +2186,18 @@ var V = ["[Stytch]"],
|
|
|
2004
2186
|
}
|
|
2005
2187
|
}]), e;
|
|
2006
2188
|
}();
|
|
2007
|
-
function
|
|
2008
|
-
for (var t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length),
|
|
2189
|
+
function ve(e) {
|
|
2190
|
+
for (var t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length), o = new Uint8Array(i), s = 0; s < n.length; s++) o[s] = n.charCodeAt(s);
|
|
2009
2191
|
return i;
|
|
2010
2192
|
}
|
|
2011
|
-
function
|
|
2193
|
+
function ye(t) {
|
|
2012
2194
|
var r,
|
|
2013
2195
|
n = "",
|
|
2014
2196
|
i = e(new Uint8Array(t));
|
|
2015
2197
|
try {
|
|
2016
2198
|
for (i.s(); !(r = i.n()).done;) {
|
|
2017
|
-
var
|
|
2018
|
-
n += String.fromCharCode(
|
|
2199
|
+
var o = r.value;
|
|
2200
|
+
n += String.fromCharCode(o);
|
|
2019
2201
|
}
|
|
2020
2202
|
} catch (e) {
|
|
2021
2203
|
i.e(e);
|
|
@@ -2024,139 +2206,139 @@ function pe(t) {
|
|
|
2024
2206
|
}
|
|
2025
2207
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2026
2208
|
}
|
|
2027
|
-
var
|
|
2028
|
-
|
|
2029
|
-
function
|
|
2030
|
-
if (r ===
|
|
2031
|
-
if (r ===
|
|
2209
|
+
var ge = "copy",
|
|
2210
|
+
be = "convert";
|
|
2211
|
+
function ke(e, r, n) {
|
|
2212
|
+
if (r === ge) return n;
|
|
2213
|
+
if (r === be) return e(n);
|
|
2032
2214
|
if (r instanceof Array) return n.map(function (t) {
|
|
2033
|
-
return
|
|
2215
|
+
return ke(e, r[0], t);
|
|
2034
2216
|
});
|
|
2035
2217
|
if (r instanceof Object) {
|
|
2036
|
-
for (var i = {},
|
|
2037
|
-
var a = t(o
|
|
2218
|
+
for (var i = {}, o = 0, s = Object.entries(r); o < s.length; o++) {
|
|
2219
|
+
var a = t(s[o], 2),
|
|
2038
2220
|
c = a[0],
|
|
2039
2221
|
u = a[1];
|
|
2040
2222
|
if (u.derive) {
|
|
2041
2223
|
var l = u.derive(n);
|
|
2042
2224
|
void 0 !== l && (n[c] = l);
|
|
2043
2225
|
}
|
|
2044
|
-
if (c in n) null != n[c] ? i[c] =
|
|
2226
|
+
if (c in n) null != n[c] ? i[c] = ke(e, u.schema, n[c]) : i[c] = null;else if (u.required) throw new Error("Missing key: ".concat(c));
|
|
2045
2227
|
}
|
|
2046
2228
|
return i;
|
|
2047
2229
|
}
|
|
2048
2230
|
}
|
|
2049
|
-
function
|
|
2231
|
+
function we(e, t) {
|
|
2050
2232
|
return {
|
|
2051
2233
|
required: !0,
|
|
2052
2234
|
schema: e,
|
|
2053
2235
|
derive: t
|
|
2054
2236
|
};
|
|
2055
2237
|
}
|
|
2056
|
-
function
|
|
2238
|
+
function Se(e) {
|
|
2057
2239
|
return {
|
|
2058
2240
|
required: !0,
|
|
2059
2241
|
schema: e
|
|
2060
2242
|
};
|
|
2061
2243
|
}
|
|
2062
|
-
function
|
|
2244
|
+
function Ce(e) {
|
|
2063
2245
|
return {
|
|
2064
2246
|
required: !1,
|
|
2065
2247
|
schema: e
|
|
2066
2248
|
};
|
|
2067
2249
|
}
|
|
2068
|
-
var
|
|
2069
|
-
type:
|
|
2070
|
-
id:
|
|
2071
|
-
transports: ge
|
|
2250
|
+
var Te = {
|
|
2251
|
+
type: Se(ge),
|
|
2252
|
+
id: Se(be),
|
|
2253
|
+
transports: Ce(ge)
|
|
2072
2254
|
},
|
|
2073
|
-
|
|
2074
|
-
appid: ge
|
|
2075
|
-
appidExclude: ge
|
|
2076
|
-
credProps: ge
|
|
2255
|
+
Oe = {
|
|
2256
|
+
appid: Ce(ge),
|
|
2257
|
+
appidExclude: Ce(ge),
|
|
2258
|
+
credProps: Ce(ge)
|
|
2077
2259
|
},
|
|
2078
|
-
|
|
2079
|
-
appid: ge
|
|
2080
|
-
appidExclude: ge
|
|
2081
|
-
credProps: ge
|
|
2260
|
+
Ae = {
|
|
2261
|
+
appid: Ce(ge),
|
|
2262
|
+
appidExclude: Ce(ge),
|
|
2263
|
+
credProps: Ce(ge)
|
|
2082
2264
|
},
|
|
2083
|
-
|
|
2084
|
-
publicKey:
|
|
2085
|
-
rp:
|
|
2086
|
-
user:
|
|
2087
|
-
id:
|
|
2088
|
-
name:
|
|
2089
|
-
displayName:
|
|
2265
|
+
Ee = {
|
|
2266
|
+
publicKey: Se({
|
|
2267
|
+
rp: Se(ge),
|
|
2268
|
+
user: Se({
|
|
2269
|
+
id: Se(be),
|
|
2270
|
+
name: Se(ge),
|
|
2271
|
+
displayName: Se(ge)
|
|
2090
2272
|
}),
|
|
2091
|
-
challenge:
|
|
2092
|
-
pubKeyCredParams:
|
|
2093
|
-
timeout: ge
|
|
2094
|
-
excludeCredentials:
|
|
2095
|
-
authenticatorSelection: ge
|
|
2096
|
-
attestation: ge
|
|
2097
|
-
extensions:
|
|
2273
|
+
challenge: Se(be),
|
|
2274
|
+
pubKeyCredParams: Se(ge),
|
|
2275
|
+
timeout: Ce(ge),
|
|
2276
|
+
excludeCredentials: Ce([Te]),
|
|
2277
|
+
authenticatorSelection: Ce(ge),
|
|
2278
|
+
attestation: Ce(ge),
|
|
2279
|
+
extensions: Ce(Oe)
|
|
2098
2280
|
}),
|
|
2099
|
-
signal: ge
|
|
2281
|
+
signal: Ce(ge)
|
|
2100
2282
|
},
|
|
2101
|
-
|
|
2102
|
-
type:
|
|
2103
|
-
id:
|
|
2104
|
-
rawId:
|
|
2105
|
-
authenticatorAttachment: ge
|
|
2106
|
-
response:
|
|
2107
|
-
clientDataJSON:
|
|
2108
|
-
attestationObject:
|
|
2109
|
-
transports:
|
|
2283
|
+
Pe = {
|
|
2284
|
+
type: Se(ge),
|
|
2285
|
+
id: Se(ge),
|
|
2286
|
+
rawId: Se(be),
|
|
2287
|
+
authenticatorAttachment: Ce(ge),
|
|
2288
|
+
response: Se({
|
|
2289
|
+
clientDataJSON: Se(be),
|
|
2290
|
+
attestationObject: Se(be),
|
|
2291
|
+
transports: we(ge, function (e) {
|
|
2110
2292
|
var t;
|
|
2111
2293
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2112
2294
|
})
|
|
2113
2295
|
}),
|
|
2114
|
-
clientExtensionResults:
|
|
2296
|
+
clientExtensionResults: we(Ae, function (e) {
|
|
2115
2297
|
return e.getClientExtensionResults();
|
|
2116
2298
|
})
|
|
2117
2299
|
},
|
|
2118
|
-
|
|
2119
|
-
mediation: ge
|
|
2120
|
-
publicKey:
|
|
2121
|
-
challenge:
|
|
2122
|
-
timeout: ge
|
|
2123
|
-
rpId: ge
|
|
2124
|
-
allowCredentials:
|
|
2125
|
-
userVerification: ge
|
|
2126
|
-
extensions:
|
|
2300
|
+
xe = {
|
|
2301
|
+
mediation: Ce(ge),
|
|
2302
|
+
publicKey: Se({
|
|
2303
|
+
challenge: Se(be),
|
|
2304
|
+
timeout: Ce(ge),
|
|
2305
|
+
rpId: Ce(ge),
|
|
2306
|
+
allowCredentials: Ce([Te]),
|
|
2307
|
+
userVerification: Ce(ge),
|
|
2308
|
+
extensions: Ce(Oe)
|
|
2127
2309
|
}),
|
|
2128
|
-
signal: ge
|
|
2310
|
+
signal: Ce(ge)
|
|
2129
2311
|
},
|
|
2130
|
-
|
|
2131
|
-
type:
|
|
2132
|
-
id:
|
|
2133
|
-
rawId:
|
|
2134
|
-
authenticatorAttachment: ge
|
|
2135
|
-
response:
|
|
2136
|
-
clientDataJSON:
|
|
2137
|
-
authenticatorData:
|
|
2138
|
-
signature:
|
|
2139
|
-
userHandle:
|
|
2312
|
+
De = {
|
|
2313
|
+
type: Se(ge),
|
|
2314
|
+
id: Se(ge),
|
|
2315
|
+
rawId: Se(be),
|
|
2316
|
+
authenticatorAttachment: Ce(ge),
|
|
2317
|
+
response: Se({
|
|
2318
|
+
clientDataJSON: Se(be),
|
|
2319
|
+
authenticatorData: Se(be),
|
|
2320
|
+
signature: Se(be),
|
|
2321
|
+
userHandle: Se(be)
|
|
2140
2322
|
}),
|
|
2141
|
-
clientExtensionResults:
|
|
2323
|
+
clientExtensionResults: we(Ae, function (e) {
|
|
2142
2324
|
return e.getClientExtensionResults();
|
|
2143
2325
|
})
|
|
2144
2326
|
};
|
|
2145
|
-
function
|
|
2146
|
-
return ve
|
|
2327
|
+
function Re(e) {
|
|
2328
|
+
return ke(ve, Ee, e);
|
|
2147
2329
|
}
|
|
2148
|
-
function
|
|
2149
|
-
return
|
|
2330
|
+
function Be(e) {
|
|
2331
|
+
return ke(ye, Pe, e);
|
|
2150
2332
|
}
|
|
2151
|
-
function
|
|
2152
|
-
return
|
|
2333
|
+
function Ie(e) {
|
|
2334
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2153
2335
|
var r;
|
|
2154
|
-
return
|
|
2336
|
+
return o().wrap(function (t) {
|
|
2155
2337
|
for (;;) switch (t.prev = t.next) {
|
|
2156
2338
|
case 0:
|
|
2157
|
-
return t.next = 2, navigator.credentials.create(
|
|
2339
|
+
return t.next = 2, navigator.credentials.create(Re(e));
|
|
2158
2340
|
case 2:
|
|
2159
|
-
return r = t.sent, t.abrupt("return",
|
|
2341
|
+
return r = t.sent, t.abrupt("return", Be(r));
|
|
2160
2342
|
case 4:
|
|
2161
2343
|
case "end":
|
|
2162
2344
|
return t.stop();
|
|
@@ -2164,21 +2346,21 @@ function Ae(e) {
|
|
|
2164
2346
|
}, t);
|
|
2165
2347
|
}));
|
|
2166
2348
|
}
|
|
2167
|
-
function
|
|
2168
|
-
return ve
|
|
2349
|
+
function Le(e) {
|
|
2350
|
+
return ke(ve, xe, e);
|
|
2169
2351
|
}
|
|
2170
|
-
function
|
|
2171
|
-
return
|
|
2352
|
+
function Fe(e) {
|
|
2353
|
+
return ke(ye, De, e);
|
|
2172
2354
|
}
|
|
2173
|
-
function
|
|
2174
|
-
return
|
|
2355
|
+
function je(e) {
|
|
2356
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2175
2357
|
var r;
|
|
2176
|
-
return
|
|
2358
|
+
return o().wrap(function (t) {
|
|
2177
2359
|
for (;;) switch (t.prev = t.next) {
|
|
2178
2360
|
case 0:
|
|
2179
|
-
return t.next = 2, navigator.credentials.get(
|
|
2361
|
+
return t.next = 2, navigator.credentials.get(Le(e));
|
|
2180
2362
|
case 2:
|
|
2181
|
-
return r = t.sent, t.abrupt("return",
|
|
2363
|
+
return r = t.sent, t.abrupt("return", Fe(r));
|
|
2182
2364
|
case 4:
|
|
2183
2365
|
case "end":
|
|
2184
2366
|
return t.stop();
|
|
@@ -2186,21 +2368,20 @@ function Be(e) {
|
|
|
2186
2368
|
}, t);
|
|
2187
2369
|
}));
|
|
2188
2370
|
}
|
|
2189
|
-
var
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
c(this, e), this._networkClient = t, this._subscriptionService = r;
|
|
2371
|
+
var Me = function () {
|
|
2372
|
+
function e(t, r, n) {
|
|
2373
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2193
2374
|
}
|
|
2194
2375
|
return a(e, [{
|
|
2195
2376
|
key: "register",
|
|
2196
2377
|
value: function value(e) {
|
|
2197
2378
|
var t;
|
|
2198
|
-
return
|
|
2199
|
-
var n, i,
|
|
2200
|
-
return
|
|
2379
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
2380
|
+
var n, i, s, a;
|
|
2381
|
+
return o().wrap(function (r) {
|
|
2201
2382
|
for (;;) switch (r.prev = r.next) {
|
|
2202
2383
|
case 0:
|
|
2203
|
-
return
|
|
2384
|
+
return re("stytch.webauthn.register").isOptionalString("domain", null == e ? void 0 : e.domain).isOptionalString("authenticator_type", null == e ? void 0 : e.authenticator_type), r.next = 3, this._networkClient.fetchSDK({
|
|
2204
2385
|
url: "/webauthn/register/start",
|
|
2205
2386
|
method: "POST",
|
|
2206
2387
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2210,20 +2391,20 @@ var De,
|
|
|
2210
2391
|
}
|
|
2211
2392
|
});
|
|
2212
2393
|
case 3:
|
|
2213
|
-
return n = r.sent, i = n.public_key_credential_creation_options, r.next = 7,
|
|
2394
|
+
return n = r.sent, i = n.public_key_credential_creation_options, r.next = 7, Ie({
|
|
2214
2395
|
publicKey: JSON.parse(i)
|
|
2215
2396
|
});
|
|
2216
2397
|
case 7:
|
|
2217
|
-
return
|
|
2398
|
+
return s = r.sent, r.next = 10, this._networkClient.fetchSDK({
|
|
2218
2399
|
url: "/webauthn/register",
|
|
2219
2400
|
method: "POST",
|
|
2220
2401
|
errorMessage: "Failed to register WebAuthn device",
|
|
2221
2402
|
body: {
|
|
2222
|
-
public_key_credential: JSON.stringify(
|
|
2403
|
+
public_key_credential: JSON.stringify(s)
|
|
2223
2404
|
}
|
|
2224
2405
|
});
|
|
2225
2406
|
case 10:
|
|
2226
|
-
return a = r.sent, this._subscriptionService.updateUser(a.__user), r.abrupt("return",
|
|
2407
|
+
return a = r.sent, this._subscriptionService.updateUser(a.__user), r.abrupt("return", ie(a));
|
|
2227
2408
|
case 13:
|
|
2228
2409
|
case "end":
|
|
2229
2410
|
return r.stop();
|
|
@@ -2235,12 +2416,14 @@ var De,
|
|
|
2235
2416
|
key: "authenticate",
|
|
2236
2417
|
value: function value(e) {
|
|
2237
2418
|
var t;
|
|
2238
|
-
return
|
|
2239
|
-
var n, i,
|
|
2240
|
-
return
|
|
2419
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
2420
|
+
var n, i, s, a, c, u, l;
|
|
2421
|
+
return o().wrap(function (r) {
|
|
2241
2422
|
for (;;) switch (r.prev = r.next) {
|
|
2242
2423
|
case 0:
|
|
2243
|
-
return
|
|
2424
|
+
return re("stytch.webauthn.register").isOptionalString("domain", e.domain).isNumber("session_duration_minutes", e.session_duration_minutes), r.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2425
|
+
case 3:
|
|
2426
|
+
return n = r.sent, i = n.dfp_telemetry_id, s = n.captcha_token, r.next = 8, this._networkClient.fetchSDK({
|
|
2244
2427
|
url: "/webauthn/authenticate/start",
|
|
2245
2428
|
method: "POST",
|
|
2246
2429
|
errorMessage: "Failed to start WebAuthn authentication",
|
|
@@ -2248,31 +2431,34 @@ var De,
|
|
|
2248
2431
|
domain: null !== (t = e.domain) && void 0 !== t ? t : window.location.hostname
|
|
2249
2432
|
}
|
|
2250
2433
|
});
|
|
2251
|
-
case
|
|
2252
|
-
return
|
|
2253
|
-
publicKey: JSON.parse(
|
|
2434
|
+
case 8:
|
|
2435
|
+
return a = r.sent, c = a.public_key_credential_request_options, r.next = 12, je({
|
|
2436
|
+
publicKey: JSON.parse(c)
|
|
2254
2437
|
});
|
|
2255
|
-
case
|
|
2256
|
-
return
|
|
2438
|
+
case 12:
|
|
2439
|
+
return u = r.sent, r.next = 15, this._networkClient.retriableFetchSDK({
|
|
2257
2440
|
url: "/webauthn/authenticate",
|
|
2258
2441
|
method: "POST",
|
|
2259
2442
|
errorMessage: "Failed to authenticate WebAuthn device",
|
|
2260
2443
|
body: {
|
|
2261
|
-
public_key_credential: JSON.stringify(
|
|
2262
|
-
session_duration_minutes: e.session_duration_minutes
|
|
2263
|
-
|
|
2444
|
+
public_key_credential: JSON.stringify(u),
|
|
2445
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2446
|
+
dfp_telemetry_id: i,
|
|
2447
|
+
captcha_token: s
|
|
2448
|
+
},
|
|
2449
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2264
2450
|
});
|
|
2265
|
-
case
|
|
2266
|
-
return
|
|
2451
|
+
case 15:
|
|
2452
|
+
return l = r.sent, this._subscriptionService.updateStateAndTokens({
|
|
2267
2453
|
state: {
|
|
2268
|
-
session:
|
|
2269
|
-
user:
|
|
2454
|
+
session: l.session,
|
|
2455
|
+
user: l.__user
|
|
2270
2456
|
},
|
|
2271
|
-
session_token:
|
|
2272
|
-
session_jwt:
|
|
2457
|
+
session_token: l.session_token,
|
|
2458
|
+
session_jwt: l.session_jwt,
|
|
2273
2459
|
intermediate_session_token: null
|
|
2274
|
-
}), r.abrupt("return",
|
|
2275
|
-
case
|
|
2460
|
+
}), r.abrupt("return", ie(l));
|
|
2461
|
+
case 18:
|
|
2276
2462
|
case "end":
|
|
2277
2463
|
return r.stop();
|
|
2278
2464
|
}
|
|
@@ -2281,62 +2467,21 @@ var De,
|
|
|
2281
2467
|
}
|
|
2282
2468
|
}]), e;
|
|
2283
2469
|
}(),
|
|
2284
|
-
|
|
2470
|
+
Ne = Promise.resolve({
|
|
2285
2471
|
pkceRequiredForPasswordResets: !1
|
|
2286
2472
|
}),
|
|
2287
|
-
|
|
2473
|
+
Ue = function () {
|
|
2288
2474
|
function e(t, r, n) {
|
|
2289
|
-
var i =
|
|
2290
|
-
o = arguments.length >
|
|
2291
|
-
|
|
2292
|
-
return Promise.resolve(void 0);
|
|
2293
|
-
},
|
|
2294
|
-
u = arguments.length > 5 ? arguments[5] : void 0;
|
|
2295
|
-
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = o, this.executeRecaptcha = a, this._dfpProtectedAuth = u, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
2296
|
-
return k(i, void 0, void 0, s().mark(function r() {
|
|
2297
|
-
var n, i;
|
|
2298
|
-
return s().wrap(function (r) {
|
|
2299
|
-
for (;;) switch (r.prev = r.next) {
|
|
2300
|
-
case 0:
|
|
2301
|
-
if (n = this._dfpProtectedAuth, r.t0 = n, !r.t0) {
|
|
2302
|
-
r.next = 6;
|
|
2303
|
-
break;
|
|
2304
|
-
}
|
|
2305
|
-
return r.next = 5, n.isEnabled();
|
|
2306
|
-
case 5:
|
|
2307
|
-
r.t0 = r.sent;
|
|
2308
|
-
case 6:
|
|
2309
|
-
if (i = r.t0, e.type !== De.RequiredCatcha || !i) {
|
|
2310
|
-
r.next = 16;
|
|
2311
|
-
break;
|
|
2312
|
-
}
|
|
2313
|
-
if (!t.body) {
|
|
2314
|
-
r.next = 15;
|
|
2315
|
-
break;
|
|
2316
|
-
}
|
|
2317
|
-
return r.next = 11, n.getTelemetryID();
|
|
2318
|
-
case 11:
|
|
2319
|
-
return t.body.dfp_telemetry_id = r.sent, r.next = 14, this.executeRecaptcha();
|
|
2320
|
-
case 14:
|
|
2321
|
-
t.body.captcha_token = r.sent;
|
|
2322
|
-
case 15:
|
|
2323
|
-
return r.abrupt("return", t);
|
|
2324
|
-
case 16:
|
|
2325
|
-
throw new Error("Unable to query captcha and/or dfp telemetry ID");
|
|
2326
|
-
case 17:
|
|
2327
|
-
case "end":
|
|
2328
|
-
return r.stop();
|
|
2329
|
-
}
|
|
2330
|
-
}, r, this);
|
|
2331
|
-
}));
|
|
2332
|
-
};
|
|
2475
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Ne,
|
|
2476
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : se();
|
|
2477
|
+
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2333
2478
|
}
|
|
2334
2479
|
return a(e, [{
|
|
2335
2480
|
key: "getCodeChallenge",
|
|
2336
2481
|
value: function value() {
|
|
2337
|
-
return
|
|
2482
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
2338
2483
|
var t, r;
|
|
2339
|
-
return
|
|
2484
|
+
return o().wrap(function (e) {
|
|
2340
2485
|
for (;;) switch (e.prev = e.next) {
|
|
2341
2486
|
case 0:
|
|
2342
2487
|
return e.next = 2, this._config;
|
|
@@ -2365,55 +2510,15 @@ var De,
|
|
|
2365
2510
|
}, e, this);
|
|
2366
2511
|
}));
|
|
2367
2512
|
}
|
|
2368
|
-
}, {
|
|
2369
|
-
key: "getDFPTelemetryIDAndCaptcha",
|
|
2370
|
-
value: function value() {
|
|
2371
|
-
return k(this, void 0, void 0, s().mark(function e() {
|
|
2372
|
-
var t, r;
|
|
2373
|
-
return s().wrap(function (e) {
|
|
2374
|
-
for (;;) switch (e.prev = e.next) {
|
|
2375
|
-
case 0:
|
|
2376
|
-
if (t = void 0, r = void 0, e.t0 = this._dfpProtectedAuth, !e.t0) {
|
|
2377
|
-
e.next = 7;
|
|
2378
|
-
break;
|
|
2379
|
-
}
|
|
2380
|
-
return e.next = 6, this._dfpProtectedAuth.isEnabled();
|
|
2381
|
-
case 6:
|
|
2382
|
-
e.t0 = e.sent;
|
|
2383
|
-
case 7:
|
|
2384
|
-
if (!e.t0) {
|
|
2385
|
-
e.next = 13;
|
|
2386
|
-
break;
|
|
2387
|
-
}
|
|
2388
|
-
return e.next = 10, this._dfpProtectedAuth.getTelemetryID();
|
|
2389
|
-
case 10:
|
|
2390
|
-
t = e.sent, e.next = 16;
|
|
2391
|
-
break;
|
|
2392
|
-
case 13:
|
|
2393
|
-
return e.next = 15, this.executeRecaptcha();
|
|
2394
|
-
case 15:
|
|
2395
|
-
r = e.sent;
|
|
2396
|
-
case 16:
|
|
2397
|
-
return e.abrupt("return", {
|
|
2398
|
-
dfp_telemetry_id: t,
|
|
2399
|
-
captcha_token: r
|
|
2400
|
-
});
|
|
2401
|
-
case 17:
|
|
2402
|
-
case "end":
|
|
2403
|
-
return e.stop();
|
|
2404
|
-
}
|
|
2405
|
-
}, e, this);
|
|
2406
|
-
}));
|
|
2407
|
-
}
|
|
2408
2513
|
}, {
|
|
2409
2514
|
key: "create",
|
|
2410
2515
|
value: function value(e) {
|
|
2411
|
-
return
|
|
2412
|
-
var r, n, i,
|
|
2413
|
-
return
|
|
2516
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2517
|
+
var r, n, i, s;
|
|
2518
|
+
return o().wrap(function (t) {
|
|
2414
2519
|
for (;;) switch (t.prev = t.next) {
|
|
2415
2520
|
case 0:
|
|
2416
|
-
return
|
|
2521
|
+
return re("stytch.passwords.create").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2417
2522
|
case 3:
|
|
2418
2523
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2419
2524
|
url: "/passwords",
|
|
@@ -2426,18 +2531,18 @@ var De,
|
|
|
2426
2531
|
captcha_token: i,
|
|
2427
2532
|
dfp_telemetry_id: n
|
|
2428
2533
|
},
|
|
2429
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
2534
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2430
2535
|
});
|
|
2431
2536
|
case 8:
|
|
2432
|
-
return
|
|
2537
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2433
2538
|
state: {
|
|
2434
|
-
session:
|
|
2435
|
-
user:
|
|
2539
|
+
session: s.session,
|
|
2540
|
+
user: s.user
|
|
2436
2541
|
},
|
|
2437
|
-
session_token:
|
|
2438
|
-
session_jwt:
|
|
2542
|
+
session_token: s.session_token,
|
|
2543
|
+
session_jwt: s.session_jwt,
|
|
2439
2544
|
intermediate_session_token: null
|
|
2440
|
-
}), t.abrupt("return",
|
|
2545
|
+
}), t.abrupt("return", ie(s));
|
|
2441
2546
|
case 11:
|
|
2442
2547
|
case "end":
|
|
2443
2548
|
return t.stop();
|
|
@@ -2448,12 +2553,12 @@ var De,
|
|
|
2448
2553
|
}, {
|
|
2449
2554
|
key: "authenticate",
|
|
2450
2555
|
value: function value(e) {
|
|
2451
|
-
return
|
|
2452
|
-
var r, n, i,
|
|
2453
|
-
return
|
|
2556
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2557
|
+
var r, n, i, s;
|
|
2558
|
+
return o().wrap(function (t) {
|
|
2454
2559
|
for (;;) switch (t.prev = t.next) {
|
|
2455
2560
|
case 0:
|
|
2456
|
-
return
|
|
2561
|
+
return re("stytch.passwords.authenticate").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2457
2562
|
case 3:
|
|
2458
2563
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2459
2564
|
url: "/passwords/authenticate",
|
|
@@ -2466,18 +2571,18 @@ var De,
|
|
|
2466
2571
|
captcha_token: i,
|
|
2467
2572
|
dfp_telemetry_id: n
|
|
2468
2573
|
},
|
|
2469
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
2574
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2470
2575
|
});
|
|
2471
2576
|
case 8:
|
|
2472
|
-
return
|
|
2577
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2473
2578
|
state: {
|
|
2474
|
-
session:
|
|
2475
|
-
user:
|
|
2579
|
+
session: s.session,
|
|
2580
|
+
user: s.user
|
|
2476
2581
|
},
|
|
2477
|
-
session_token:
|
|
2478
|
-
session_jwt:
|
|
2582
|
+
session_token: s.session_token,
|
|
2583
|
+
session_jwt: s.session_jwt,
|
|
2479
2584
|
intermediate_session_token: null
|
|
2480
|
-
}), t.abrupt("return",
|
|
2585
|
+
}), t.abrupt("return", ie(s));
|
|
2481
2586
|
case 11:
|
|
2482
2587
|
case "end":
|
|
2483
2588
|
return t.stop();
|
|
@@ -2488,16 +2593,16 @@ var De,
|
|
|
2488
2593
|
}, {
|
|
2489
2594
|
key: "resetByEmailStart",
|
|
2490
2595
|
value: function value(e) {
|
|
2491
|
-
return
|
|
2492
|
-
var r, n, i,
|
|
2493
|
-
return
|
|
2596
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2597
|
+
var r, n, i, s;
|
|
2598
|
+
return o().wrap(function (t) {
|
|
2494
2599
|
for (;;) switch (t.prev = t.next) {
|
|
2495
2600
|
case 0:
|
|
2496
|
-
return
|
|
2601
|
+
return re("stytch.passwords.resetByEmailStart").isString("email", e.email).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();
|
|
2497
2602
|
case 3:
|
|
2498
|
-
return r = t.sent, t.next = 6, this.getDFPTelemetryIDAndCaptcha();
|
|
2603
|
+
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2499
2604
|
case 6:
|
|
2500
|
-
return n = t.sent, i = n.dfp_telemetry_id,
|
|
2605
|
+
return n = t.sent, i = n.dfp_telemetry_id, s = n.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2501
2606
|
url: "/passwords/email/reset/start",
|
|
2502
2607
|
method: "POST",
|
|
2503
2608
|
errorMessage: "Failed to start password reset flow.",
|
|
@@ -2508,10 +2613,10 @@ var De,
|
|
|
2508
2613
|
reset_password_expiration_minutes: e.reset_password_expiration_minutes,
|
|
2509
2614
|
reset_password_template_id: e.reset_password_template_id,
|
|
2510
2615
|
code_challenge: r,
|
|
2511
|
-
captcha_token:
|
|
2616
|
+
captcha_token: s,
|
|
2512
2617
|
dfp_telemetry_id: i
|
|
2513
2618
|
},
|
|
2514
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
2619
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2515
2620
|
}));
|
|
2516
2621
|
case 10:
|
|
2517
2622
|
case "end":
|
|
@@ -2523,16 +2628,16 @@ var De,
|
|
|
2523
2628
|
}, {
|
|
2524
2629
|
key: "resetByEmail",
|
|
2525
2630
|
value: function value(e) {
|
|
2526
|
-
return
|
|
2527
|
-
var r, n, i,
|
|
2528
|
-
return
|
|
2631
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2632
|
+
var r, n, i, s, a, c;
|
|
2633
|
+
return o().wrap(function (t) {
|
|
2529
2634
|
for (;;) switch (t.prev = t.next) {
|
|
2530
2635
|
case 0:
|
|
2531
|
-
return
|
|
2636
|
+
return re("stytch.passwords.resetByEmail").isString("token", e.token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2532
2637
|
case 3:
|
|
2533
2638
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2534
2639
|
case 8:
|
|
2535
|
-
return
|
|
2640
|
+
return s = t.sent, a = null == s ? void 0 : s.code_verifier, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2536
2641
|
url: "/passwords/email/reset",
|
|
2537
2642
|
method: "POST",
|
|
2538
2643
|
errorMessage: "Failed to reset password.",
|
|
@@ -2544,7 +2649,7 @@ var De,
|
|
|
2544
2649
|
code_verifier: a,
|
|
2545
2650
|
dfp_telemetry_id: n
|
|
2546
2651
|
},
|
|
2547
|
-
retryCallback: this.retryWithCaptchaAndDFP
|
|
2652
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2548
2653
|
});
|
|
2549
2654
|
case 12:
|
|
2550
2655
|
return c = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
@@ -2555,7 +2660,7 @@ var De,
|
|
|
2555
2660
|
session_token: c.session_token,
|
|
2556
2661
|
session_jwt: c.session_jwt,
|
|
2557
2662
|
intermediate_session_token: null
|
|
2558
|
-
}), t.abrupt("return",
|
|
2663
|
+
}), t.abrupt("return", ie(c));
|
|
2559
2664
|
case 16:
|
|
2560
2665
|
case "end":
|
|
2561
2666
|
return t.stop();
|
|
@@ -2566,12 +2671,14 @@ var De,
|
|
|
2566
2671
|
}, {
|
|
2567
2672
|
key: "resetByExistingPassword",
|
|
2568
2673
|
value: function value(e) {
|
|
2569
|
-
return
|
|
2570
|
-
var r;
|
|
2571
|
-
return
|
|
2674
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2675
|
+
var r, n, i, s;
|
|
2676
|
+
return o().wrap(function (t) {
|
|
2572
2677
|
for (;;) switch (t.prev = t.next) {
|
|
2573
2678
|
case 0:
|
|
2574
|
-
return
|
|
2679
|
+
return re("stytch.passwords.resetByExistingPassword").isString("email", e.email).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2680
|
+
case 3:
|
|
2681
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2575
2682
|
url: "/passwords/existing_password/reset",
|
|
2576
2683
|
method: "POST",
|
|
2577
2684
|
errorMessage: "Failed to reset password.",
|
|
@@ -2579,20 +2686,23 @@ var De,
|
|
|
2579
2686
|
email: e.email,
|
|
2580
2687
|
existing_password: e.existing_password,
|
|
2581
2688
|
new_password: e.new_password,
|
|
2582
|
-
session_duration_minutes: e.session_duration_minutes
|
|
2583
|
-
|
|
2689
|
+
session_duration_minutes: e.session_duration_minutes,
|
|
2690
|
+
dfp_telemetry_id: n,
|
|
2691
|
+
captcha_token: i
|
|
2692
|
+
},
|
|
2693
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2584
2694
|
});
|
|
2585
|
-
case
|
|
2586
|
-
return
|
|
2695
|
+
case 8:
|
|
2696
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2587
2697
|
state: {
|
|
2588
|
-
session:
|
|
2589
|
-
user:
|
|
2698
|
+
session: s.session,
|
|
2699
|
+
user: s.user
|
|
2590
2700
|
},
|
|
2591
|
-
session_token:
|
|
2592
|
-
session_jwt:
|
|
2701
|
+
session_token: s.session_token,
|
|
2702
|
+
session_jwt: s.session_jwt,
|
|
2593
2703
|
intermediate_session_token: null
|
|
2594
|
-
}), t.abrupt("return",
|
|
2595
|
-
case
|
|
2704
|
+
}), t.abrupt("return", ie(s));
|
|
2705
|
+
case 11:
|
|
2596
2706
|
case "end":
|
|
2597
2707
|
return t.stop();
|
|
2598
2708
|
}
|
|
@@ -2602,30 +2712,35 @@ var De,
|
|
|
2602
2712
|
}, {
|
|
2603
2713
|
key: "resetBySession",
|
|
2604
2714
|
value: function value(e) {
|
|
2605
|
-
return
|
|
2606
|
-
var r;
|
|
2607
|
-
return
|
|
2715
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2716
|
+
var r, n, i, s;
|
|
2717
|
+
return o().wrap(function (t) {
|
|
2608
2718
|
for (;;) switch (t.prev = t.next) {
|
|
2609
2719
|
case 0:
|
|
2610
|
-
return
|
|
2720
|
+
return re("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2721
|
+
case 3:
|
|
2722
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2611
2723
|
url: "/passwords/session/reset",
|
|
2612
2724
|
method: "POST",
|
|
2613
2725
|
errorMessage: "Failed to reset session.",
|
|
2614
2726
|
body: {
|
|
2615
|
-
password: e.password
|
|
2616
|
-
|
|
2727
|
+
password: e.password,
|
|
2728
|
+
dfp_telemetry_id: n,
|
|
2729
|
+
captcha_token: i
|
|
2730
|
+
},
|
|
2731
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2617
2732
|
});
|
|
2618
|
-
case
|
|
2619
|
-
return
|
|
2733
|
+
case 8:
|
|
2734
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2620
2735
|
state: {
|
|
2621
|
-
session:
|
|
2622
|
-
user:
|
|
2736
|
+
session: s.session,
|
|
2737
|
+
user: s.user
|
|
2623
2738
|
},
|
|
2624
|
-
session_token:
|
|
2625
|
-
session_jwt:
|
|
2739
|
+
session_token: s.session_token,
|
|
2740
|
+
session_jwt: s.session_jwt,
|
|
2626
2741
|
intermediate_session_token: null
|
|
2627
|
-
}), t.abrupt("return",
|
|
2628
|
-
case
|
|
2742
|
+
}), t.abrupt("return", s);
|
|
2743
|
+
case 11:
|
|
2629
2744
|
case "end":
|
|
2630
2745
|
return t.stop();
|
|
2631
2746
|
}
|
|
@@ -2635,11 +2750,11 @@ var De,
|
|
|
2635
2750
|
}, {
|
|
2636
2751
|
key: "strengthCheck",
|
|
2637
2752
|
value: function value(e) {
|
|
2638
|
-
return
|
|
2639
|
-
return
|
|
2753
|
+
return O(this, void 0, void 0, o().mark(function t() {
|
|
2754
|
+
return o().wrap(function (t) {
|
|
2640
2755
|
for (;;) switch (t.prev = t.next) {
|
|
2641
2756
|
case 0:
|
|
2642
|
-
return
|
|
2757
|
+
return re("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
2643
2758
|
url: "/passwords/strength_check",
|
|
2644
2759
|
method: "POST",
|
|
2645
2760
|
errorMessage: "Failed to check password strength.",
|
|
@@ -2661,103 +2776,8 @@ Promise.resolve({
|
|
|
2661
2776
|
pkceRequiredForEmailMagicLinks: !1
|
|
2662
2777
|
}), Promise.resolve({
|
|
2663
2778
|
pkceRequiredForPasswordResets: !1
|
|
2664
|
-
})
|
|
2665
|
-
|
|
2666
|
-
}(De || (De = {}));
|
|
2667
|
-
var Me = function (e) {
|
|
2668
|
-
u(r, h(Error));
|
|
2669
|
-
var t = l(r);
|
|
2670
|
-
function r(e) {
|
|
2671
|
-
var n;
|
|
2672
|
-
return c(this, r), (n = t.call(this, e)).type = e, n;
|
|
2673
|
-
}
|
|
2674
|
-
return a(r);
|
|
2675
|
-
}();
|
|
2676
|
-
function Ne(e) {
|
|
2677
|
-
var t = e.method,
|
|
2678
|
-
r = e.errorMessage,
|
|
2679
|
-
n = e.finalURL,
|
|
2680
|
-
i = e.basicAuthHeader,
|
|
2681
|
-
o = e.xSDKClientHeader,
|
|
2682
|
-
a = e.xSDKParentHostHeader,
|
|
2683
|
-
c = e.body;
|
|
2684
|
-
return k(this, void 0, void 0, s().mark(function e() {
|
|
2685
|
-
var u, l, d, h, p, f;
|
|
2686
|
-
return s().wrap(function (e) {
|
|
2687
|
-
for (;;) switch (e.prev = e.next) {
|
|
2688
|
-
case 0:
|
|
2689
|
-
return u = {
|
|
2690
|
-
Authorization: i,
|
|
2691
|
-
"Content-Type": "application/json",
|
|
2692
|
-
"X-SDK-Client": o
|
|
2693
|
-
}, a && (u["X-SDK-Parent-Host"] = a), l = {
|
|
2694
|
-
method: t,
|
|
2695
|
-
headers: u,
|
|
2696
|
-
body: c && JSON.stringify(c)
|
|
2697
|
-
}, e.prev = 3, e.next = 6, fetch(n, l);
|
|
2698
|
-
case 6:
|
|
2699
|
-
d = e.sent, e.next = 14;
|
|
2700
|
-
break;
|
|
2701
|
-
case 9:
|
|
2702
|
-
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
2703
|
-
e.next = 13;
|
|
2704
|
-
break;
|
|
2705
|
-
}
|
|
2706
|
-
throw new F(r, "Unable to contact the Stytch servers. Are you online?");
|
|
2707
|
-
case 13:
|
|
2708
|
-
throw e.t0;
|
|
2709
|
-
case 14:
|
|
2710
|
-
if (403 !== d.status) {
|
|
2711
|
-
e.next = 27;
|
|
2712
|
-
break;
|
|
2713
|
-
}
|
|
2714
|
-
return e.prev = 15, e.next = 18, d.text();
|
|
2715
|
-
case 18:
|
|
2716
|
-
h = e.sent, e.next = 24;
|
|
2717
|
-
break;
|
|
2718
|
-
case 21:
|
|
2719
|
-
throw e.prev = 21, e.t1 = e["catch"](15), new F(r, "Invalid response from the Stytch servers.");
|
|
2720
|
-
case 24:
|
|
2721
|
-
if (!h.includes("Captcha required")) {
|
|
2722
|
-
e.next = 26;
|
|
2723
|
-
break;
|
|
2724
|
-
}
|
|
2725
|
-
throw new Me(De.RequiredCatcha);
|
|
2726
|
-
case 26:
|
|
2727
|
-
throw new F(r, "Invalid response from the Stytch servers.");
|
|
2728
|
-
case 27:
|
|
2729
|
-
if (200 === d.status) {
|
|
2730
|
-
e.next = 40;
|
|
2731
|
-
break;
|
|
2732
|
-
}
|
|
2733
|
-
return e.prev = 28, e.next = 31, d.json();
|
|
2734
|
-
case 31:
|
|
2735
|
-
p = e.sent, e.next = 37;
|
|
2736
|
-
break;
|
|
2737
|
-
case 34:
|
|
2738
|
-
throw e.prev = 34, e.t2 = e["catch"](28), new F(r, "Invalid or no response from server");
|
|
2739
|
-
case 37:
|
|
2740
|
-
if (!("body" in p || "params" in p || "query" in p)) {
|
|
2741
|
-
e.next = 39;
|
|
2742
|
-
break;
|
|
2743
|
-
}
|
|
2744
|
-
throw new K(p);
|
|
2745
|
-
case 39:
|
|
2746
|
-
throw new q(p);
|
|
2747
|
-
case 40:
|
|
2748
|
-
return e.prev = 40, e.next = 43, d.json();
|
|
2749
|
-
case 43:
|
|
2750
|
-
return f = e.sent, e.abrupt("return", f.data);
|
|
2751
|
-
case 47:
|
|
2752
|
-
throw e.prev = 47, e.t3 = e["catch"](40), new F(r, "Invalid response from the Stytch servers.");
|
|
2753
|
-
case 50:
|
|
2754
|
-
case "end":
|
|
2755
|
-
return e.stop();
|
|
2756
|
-
}
|
|
2757
|
-
}, e, null, [[3, 9], [15, 21], [28, 34], [40, 47]]);
|
|
2758
|
-
}));
|
|
2759
|
-
}
|
|
2760
|
-
var Fe = function () {
|
|
2779
|
+
});
|
|
2780
|
+
var Ke = function () {
|
|
2761
2781
|
function e(t) {
|
|
2762
2782
|
c(this, e), this.iframeURL = t, this.createIframe();
|
|
2763
2783
|
}
|
|
@@ -2765,7 +2785,7 @@ var Fe = function () {
|
|
|
2765
2785
|
key: "createIframe",
|
|
2766
2786
|
value: function value() {
|
|
2767
2787
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
2768
|
-
e ?
|
|
2788
|
+
e ? Q("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.") : ((e = document.createElement("iframe")).src = this.iframeURL, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e)), "true" !== e.dataset.loaded ? this.frame = new Promise(function (t) {
|
|
2769
2789
|
e.addEventListener("load", function () {
|
|
2770
2790
|
e.dataset.loaded = "true", t(e);
|
|
2771
2791
|
}, {
|
|
@@ -2776,26 +2796,26 @@ var Fe = function () {
|
|
|
2776
2796
|
}, {
|
|
2777
2797
|
key: "call",
|
|
2778
2798
|
value: function value(e, t) {
|
|
2779
|
-
return
|
|
2799
|
+
return O(this, void 0, void 0, o().mark(function r() {
|
|
2780
2800
|
var n,
|
|
2781
2801
|
i,
|
|
2782
|
-
|
|
2783
|
-
return
|
|
2802
|
+
s = this;
|
|
2803
|
+
return o().wrap(function (r) {
|
|
2784
2804
|
for (;;) switch (r.prev = r.next) {
|
|
2785
2805
|
case 0:
|
|
2786
2806
|
return r.next = 2, this.frame;
|
|
2787
2807
|
case 2:
|
|
2788
|
-
return n = r.sent, i = new MessageChannel(), r.abrupt("return", new Promise(function (r,
|
|
2808
|
+
return n = r.sent, i = new MessageChannel(), r.abrupt("return", new Promise(function (r, o) {
|
|
2789
2809
|
var a;
|
|
2790
2810
|
i.port1.onmessage = function (e) {
|
|
2791
2811
|
var t = e.data;
|
|
2792
|
-
i.port1.close(), t.success ? r(t.payload) :
|
|
2812
|
+
i.port1.close(), t.success ? r(t.payload) : o(ae.unmarshall(t.error));
|
|
2793
2813
|
};
|
|
2794
2814
|
var c = {
|
|
2795
2815
|
method: e,
|
|
2796
2816
|
args: t
|
|
2797
2817
|
};
|
|
2798
|
-
null === (a = n.contentWindow) || void 0 === a || a.postMessage(c,
|
|
2818
|
+
null === (a = n.contentWindow) || void 0 === a || a.postMessage(c, s.iframeURL, [i.port2]);
|
|
2799
2819
|
}));
|
|
2800
2820
|
case 5:
|
|
2801
2821
|
case "end":
|
|
@@ -2806,15 +2826,15 @@ var Fe = function () {
|
|
|
2806
2826
|
}
|
|
2807
2827
|
}]), e;
|
|
2808
2828
|
}(),
|
|
2809
|
-
|
|
2829
|
+
We = function () {
|
|
2810
2830
|
function e(t, r) {
|
|
2811
2831
|
var n = this;
|
|
2812
2832
|
c(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
2813
2833
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
2814
2834
|
}, this._reauthenticateWithBackoff = function () {
|
|
2815
|
-
return
|
|
2835
|
+
return O(n, void 0, void 0, o().mark(function t() {
|
|
2816
2836
|
var r;
|
|
2817
|
-
return
|
|
2837
|
+
return o().wrap(function (t) {
|
|
2818
2838
|
for (;;) switch (t.prev = t.next) {
|
|
2819
2839
|
case 0:
|
|
2820
2840
|
r = 0;
|
|
@@ -2850,7 +2870,7 @@ var Fe = function () {
|
|
|
2850
2870
|
this._reauthenticateWithBackoff().then(function () {
|
|
2851
2871
|
e.scheduleBackgroundRefresh();
|
|
2852
2872
|
})["catch"](function (t) {
|
|
2853
|
-
|
|
2873
|
+
Q("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
2854
2874
|
error: t
|
|
2855
2875
|
}), e._subscriptionService.destroyState();
|
|
2856
2876
|
});
|
|
@@ -2876,24 +2896,24 @@ var Fe = function () {
|
|
|
2876
2896
|
}, {
|
|
2877
2897
|
key: "isUnrecoverableError",
|
|
2878
2898
|
value: function value(e) {
|
|
2879
|
-
return
|
|
2899
|
+
return F.includes(e.error_type);
|
|
2880
2900
|
}
|
|
2881
2901
|
}]), e;
|
|
2882
2902
|
}();
|
|
2883
|
-
|
|
2884
|
-
var
|
|
2885
|
-
var
|
|
2886
|
-
function
|
|
2903
|
+
We.REFRESH_INTERVAL_MS = 18e4;
|
|
2904
|
+
var qe = "bootstrap";
|
|
2905
|
+
var Ge = /*#__PURE__*/function () {
|
|
2906
|
+
function Ge(e, t, r) {
|
|
2887
2907
|
var _this = this;
|
|
2888
|
-
_classCallCheck(this,
|
|
2908
|
+
_classCallCheck(this, Ge);
|
|
2889
2909
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
2890
2910
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
2891
2911
|
method: "GET",
|
|
2892
2912
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
2893
|
-
}).then(
|
|
2894
|
-
return _this._dataLayer.setItem(
|
|
2913
|
+
}).then(Ge.mapBootstrapData).then(function (e) {
|
|
2914
|
+
return _this._dataLayer.setItem(qe, JSON.stringify(e)), e;
|
|
2895
2915
|
})["catch"](function (e) {
|
|
2896
|
-
return
|
|
2916
|
+
return ee(e), {
|
|
2897
2917
|
displayWatermark: !1,
|
|
2898
2918
|
cnameDomain: null,
|
|
2899
2919
|
emailDomains: ["stytch.com"],
|
|
@@ -2911,10 +2931,10 @@ var qe = /*#__PURE__*/function () {
|
|
|
2911
2931
|
};
|
|
2912
2932
|
});
|
|
2913
2933
|
}
|
|
2914
|
-
_createClass(
|
|
2934
|
+
_createClass(Ge, [{
|
|
2915
2935
|
key: "getSync",
|
|
2916
2936
|
value: function getSync() {
|
|
2917
|
-
var e = this._dataLayer.getItem(
|
|
2937
|
+
var e = this._dataLayer.getItem(qe);
|
|
2918
2938
|
if (null === e) return {
|
|
2919
2939
|
displayWatermark: !1,
|
|
2920
2940
|
cnameDomain: null,
|
|
@@ -2981,38 +3001,38 @@ var qe = /*#__PURE__*/function () {
|
|
|
2981
3001
|
};
|
|
2982
3002
|
}
|
|
2983
3003
|
}]);
|
|
2984
|
-
return
|
|
3004
|
+
return Ge;
|
|
2985
3005
|
}();
|
|
2986
|
-
function
|
|
2987
|
-
return new (r || (r = Promise))(function (i,
|
|
2988
|
-
function
|
|
3006
|
+
function He(e, t, r, n) {
|
|
3007
|
+
return new (r || (r = Promise))(function (i, o) {
|
|
3008
|
+
function s(e) {
|
|
2989
3009
|
try {
|
|
2990
3010
|
c(n.next(e));
|
|
2991
3011
|
} catch (e) {
|
|
2992
|
-
|
|
3012
|
+
o(e);
|
|
2993
3013
|
}
|
|
2994
3014
|
}
|
|
2995
3015
|
function a(e) {
|
|
2996
3016
|
try {
|
|
2997
3017
|
c(n["throw"](e));
|
|
2998
3018
|
} catch (e) {
|
|
2999
|
-
|
|
3019
|
+
o(e);
|
|
3000
3020
|
}
|
|
3001
3021
|
}
|
|
3002
3022
|
function c(e) {
|
|
3003
3023
|
var t;
|
|
3004
3024
|
e.done ? i(e.value) : (t = e.value, t instanceof r ? t : new r(function (e) {
|
|
3005
3025
|
e(t);
|
|
3006
|
-
})).then(
|
|
3026
|
+
})).then(s, a);
|
|
3007
3027
|
}
|
|
3008
3028
|
c((n = n.apply(e, t || [])).next());
|
|
3009
3029
|
});
|
|
3010
3030
|
}
|
|
3011
|
-
var
|
|
3031
|
+
var ze = /*#__PURE__*/_createClass(function ze(e) {
|
|
3012
3032
|
var _this2 = this;
|
|
3013
|
-
_classCallCheck(this,
|
|
3033
|
+
_classCallCheck(this, ze);
|
|
3014
3034
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3015
|
-
return
|
|
3035
|
+
return He(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3016
3036
|
var _yield$this$state, e, t, r;
|
|
3017
3037
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3018
3038
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3043,7 +3063,7 @@ var Ge = /*#__PURE__*/_createClass(function Ge(e) {
|
|
|
3043
3063
|
}, _callee, this);
|
|
3044
3064
|
}));
|
|
3045
3065
|
}, this.state = e.then(function (e) {
|
|
3046
|
-
return
|
|
3066
|
+
return He(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3047
3067
|
var t;
|
|
3048
3068
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3049
3069
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3054,7 +3074,7 @@ var Ge = /*#__PURE__*/_createClass(function Ge(e) {
|
|
|
3054
3074
|
}
|
|
3055
3075
|
_context2.t1 = !0;
|
|
3056
3076
|
_context2.next = 4;
|
|
3057
|
-
return t = e.captchaSettings.siteKey,
|
|
3077
|
+
return t = e.captchaSettings.siteKey, V("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3058
3078
|
return window.grecaptcha.enterprise;
|
|
3059
3079
|
});
|
|
3060
3080
|
case 4:
|
|
@@ -3081,21 +3101,21 @@ var Ge = /*#__PURE__*/_createClass(function Ge(e) {
|
|
|
3081
3101
|
}));
|
|
3082
3102
|
});
|
|
3083
3103
|
});
|
|
3084
|
-
var
|
|
3085
|
-
function
|
|
3104
|
+
var Ye = /*#__PURE__*/function () {
|
|
3105
|
+
function Ye(e) {
|
|
3086
3106
|
var _this3 = this;
|
|
3087
|
-
_classCallCheck(this,
|
|
3107
|
+
_classCallCheck(this, Ye);
|
|
3088
3108
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3089
3109
|
return _this3.call("oneTapStart", e);
|
|
3090
3110
|
}, this.oneTapSubmit = function (e) {
|
|
3091
3111
|
return _this3.call("oneTapSubmit", e);
|
|
3092
3112
|
};
|
|
3093
3113
|
}
|
|
3094
|
-
_createClass(
|
|
3114
|
+
_createClass(Ye, [{
|
|
3095
3115
|
key: "frameClient",
|
|
3096
3116
|
get: function get() {
|
|
3097
3117
|
var e;
|
|
3098
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3118
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new Ke(this.iframeURL), this._frameClient;
|
|
3099
3119
|
}
|
|
3100
3120
|
}, {
|
|
3101
3121
|
key: "call",
|
|
@@ -3103,40 +3123,40 @@ var He = /*#__PURE__*/function () {
|
|
|
3103
3123
|
return this.frameClient.call(e, [t]);
|
|
3104
3124
|
}
|
|
3105
3125
|
}]);
|
|
3106
|
-
return
|
|
3126
|
+
return Ye;
|
|
3107
3127
|
}();
|
|
3108
|
-
function
|
|
3109
|
-
return
|
|
3128
|
+
function Ve(e) {
|
|
3129
|
+
return Ve = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
3110
3130
|
return _typeof(e);
|
|
3111
3131
|
} : function (e) {
|
|
3112
3132
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
3113
|
-
},
|
|
3133
|
+
}, Ve(e);
|
|
3114
3134
|
}
|
|
3115
|
-
function
|
|
3135
|
+
function Je(e, t) {
|
|
3116
3136
|
for (var r = 0; r < t.length; r++) {
|
|
3117
3137
|
var n = t[r];
|
|
3118
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key,
|
|
3119
|
-
if ("object" !==
|
|
3138
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
|
|
3139
|
+
if ("object" !== Ve(e) || null === e) return e;
|
|
3120
3140
|
var r = e[Symbol.toPrimitive];
|
|
3121
3141
|
if (void 0 !== r) {
|
|
3122
3142
|
var n = r.call(e, t || "default");
|
|
3123
|
-
if ("object" !==
|
|
3143
|
+
if ("object" !== Ve(n)) return n;
|
|
3124
3144
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3125
3145
|
}
|
|
3126
3146
|
return ("string" === t ? String : Number)(e);
|
|
3127
|
-
}(i, "string"), "symbol" ===
|
|
3147
|
+
}(i, "string"), "symbol" === Ve(o) ? o : String(o)), n);
|
|
3128
3148
|
}
|
|
3129
|
-
var i,
|
|
3149
|
+
var i, o;
|
|
3130
3150
|
}
|
|
3131
|
-
function
|
|
3132
|
-
return t &&
|
|
3151
|
+
function $e(e, t, r) {
|
|
3152
|
+
return t && Je(e.prototype, t), r && Je(e, r), Object.defineProperty(e, "prototype", {
|
|
3133
3153
|
writable: !1
|
|
3134
3154
|
}), e;
|
|
3135
3155
|
}
|
|
3136
|
-
function
|
|
3156
|
+
function Xe(e, t) {
|
|
3137
3157
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
3138
3158
|
}
|
|
3139
|
-
function
|
|
3159
|
+
function Ze(e, t) {
|
|
3140
3160
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
3141
3161
|
e.prototype = Object.create(t && t.prototype, {
|
|
3142
3162
|
constructor: {
|
|
@@ -3146,31 +3166,31 @@ function $e(e, t) {
|
|
|
3146
3166
|
}
|
|
3147
3167
|
}), Object.defineProperty(e, "prototype", {
|
|
3148
3168
|
writable: !1
|
|
3149
|
-
}), t &&
|
|
3169
|
+
}), t && it(e, t);
|
|
3150
3170
|
}
|
|
3151
|
-
function
|
|
3152
|
-
var t =
|
|
3171
|
+
function Qe(e) {
|
|
3172
|
+
var t = nt();
|
|
3153
3173
|
return function () {
|
|
3154
3174
|
var r,
|
|
3155
|
-
n =
|
|
3175
|
+
n = ot(e);
|
|
3156
3176
|
if (t) {
|
|
3157
|
-
var i =
|
|
3177
|
+
var i = ot(this).constructor;
|
|
3158
3178
|
r = Reflect.construct(n, arguments, i);
|
|
3159
3179
|
} else r = n.apply(this, arguments);
|
|
3160
3180
|
return function (e, t) {
|
|
3161
|
-
if (t && ("object" ===
|
|
3181
|
+
if (t && ("object" === Ve(t) || "function" == typeof t)) return t;
|
|
3162
3182
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
3163
|
-
return
|
|
3183
|
+
return et(e);
|
|
3164
3184
|
}(this, r);
|
|
3165
3185
|
};
|
|
3166
3186
|
}
|
|
3167
|
-
function
|
|
3187
|
+
function et(e) {
|
|
3168
3188
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
3169
3189
|
return e;
|
|
3170
3190
|
}
|
|
3171
|
-
function
|
|
3191
|
+
function tt(e) {
|
|
3172
3192
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
3173
|
-
return
|
|
3193
|
+
return tt = function tt(e) {
|
|
3174
3194
|
if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]"))) return e;
|
|
3175
3195
|
var r;
|
|
3176
3196
|
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -3179,7 +3199,7 @@ function Qe(e) {
|
|
|
3179
3199
|
t.set(e, n);
|
|
3180
3200
|
}
|
|
3181
3201
|
function n() {
|
|
3182
|
-
return
|
|
3202
|
+
return rt(e, arguments, ot(this).constructor);
|
|
3183
3203
|
}
|
|
3184
3204
|
return n.prototype = Object.create(e.prototype, {
|
|
3185
3205
|
constructor: {
|
|
@@ -3188,18 +3208,18 @@ function Qe(e) {
|
|
|
3188
3208
|
writable: !0,
|
|
3189
3209
|
configurable: !0
|
|
3190
3210
|
}
|
|
3191
|
-
}),
|
|
3192
|
-
},
|
|
3211
|
+
}), it(n, e);
|
|
3212
|
+
}, tt(e);
|
|
3193
3213
|
}
|
|
3194
|
-
function
|
|
3195
|
-
return
|
|
3214
|
+
function rt(e, t, r) {
|
|
3215
|
+
return rt = nt() ? Reflect.construct.bind() : function (e, t, r) {
|
|
3196
3216
|
var n = [null];
|
|
3197
3217
|
n.push.apply(n, t);
|
|
3198
3218
|
var i = new (Function.bind.apply(e, n))();
|
|
3199
|
-
return r &&
|
|
3200
|
-
},
|
|
3219
|
+
return r && it(i, r.prototype), i;
|
|
3220
|
+
}, rt.apply(null, arguments);
|
|
3201
3221
|
}
|
|
3202
|
-
function
|
|
3222
|
+
function nt() {
|
|
3203
3223
|
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
3204
3224
|
if (Reflect.construct.sham) return !1;
|
|
3205
3225
|
if ("function" == typeof Proxy) return !0;
|
|
@@ -3209,15 +3229,15 @@ function tt() {
|
|
|
3209
3229
|
return !1;
|
|
3210
3230
|
}
|
|
3211
3231
|
}
|
|
3212
|
-
function
|
|
3213
|
-
return
|
|
3232
|
+
function it(e, t) {
|
|
3233
|
+
return it = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
3214
3234
|
return e.__proto__ = t, e;
|
|
3215
|
-
},
|
|
3235
|
+
}, it(e, t);
|
|
3216
3236
|
}
|
|
3217
|
-
function
|
|
3218
|
-
return
|
|
3237
|
+
function ot(e) {
|
|
3238
|
+
return ot = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
3219
3239
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
3220
|
-
},
|
|
3240
|
+
}, ot(e);
|
|
3221
3241
|
}
|
|
3222
3242
|
exports.Products = void 0, function (e) {
|
|
3223
3243
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords";
|
|
@@ -3232,60 +3252,60 @@ exports.Products = void 0, function (e) {
|
|
|
3232
3252
|
}(exports.OTPMethods || (exports.OTPMethods = {})), exports.StytchEventType = void 0, function (e) {
|
|
3233
3253
|
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.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_SSO_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";
|
|
3234
3254
|
}(exports.StytchEventType || (exports.StytchEventType = {}));
|
|
3235
|
-
var
|
|
3236
|
-
|
|
3237
|
-
var t =
|
|
3255
|
+
var st = function (e) {
|
|
3256
|
+
Ze(r, tt(Error));
|
|
3257
|
+
var t = Qe(r);
|
|
3238
3258
|
function r(e, n) {
|
|
3239
3259
|
var i;
|
|
3240
|
-
return
|
|
3260
|
+
return Xe(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(et(i), r.prototype), i;
|
|
3241
3261
|
}
|
|
3242
|
-
return
|
|
3262
|
+
return $e(r);
|
|
3243
3263
|
}(),
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
var t =
|
|
3264
|
+
at = function (e) {
|
|
3265
|
+
Ze(r, tt(Error));
|
|
3266
|
+
var t = Qe(r);
|
|
3247
3267
|
function r(e, n) {
|
|
3248
3268
|
var i;
|
|
3249
|
-
return
|
|
3269
|
+
return Xe(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
3250
3270
|
}
|
|
3251
|
-
return
|
|
3271
|
+
return $e(r);
|
|
3252
3272
|
}(),
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
var t =
|
|
3273
|
+
ct = function (e) {
|
|
3274
|
+
Ze(r, tt(Error));
|
|
3275
|
+
var t = Qe(r);
|
|
3256
3276
|
function r(e) {
|
|
3257
3277
|
var n, i;
|
|
3258
|
-
|
|
3259
|
-
var
|
|
3278
|
+
Xe(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
3279
|
+
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
3260
3280
|
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
3261
3281
|
}).join("\n");
|
|
3262
|
-
return n.message = "[400] Request does not match expected schema\n".concat(
|
|
3282
|
+
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
3263
3283
|
}
|
|
3264
|
-
return
|
|
3284
|
+
return $e(r);
|
|
3265
3285
|
}(),
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
var t =
|
|
3286
|
+
ut = function (e) {
|
|
3287
|
+
Ze(r, tt(Error));
|
|
3288
|
+
var t = Qe(r);
|
|
3269
3289
|
function r(e) {
|
|
3270
3290
|
var n;
|
|
3271
|
-
|
|
3291
|
+
Xe(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
3272
3292
|
var i = e.status_code,
|
|
3273
|
-
|
|
3274
|
-
|
|
3293
|
+
o = e.error_type,
|
|
3294
|
+
s = e.error_message,
|
|
3275
3295
|
a = e.error_url,
|
|
3276
3296
|
c = e.request_id;
|
|
3277
|
-
return n.error_type =
|
|
3297
|
+
return n.error_type = o, n.error_message = s, n.error_url = a, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(a, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n;
|
|
3278
3298
|
}
|
|
3279
|
-
return
|
|
3299
|
+
return $e(r);
|
|
3280
3300
|
}(),
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
var t =
|
|
3301
|
+
lt = function (e) {
|
|
3302
|
+
Ze(r, tt(Error));
|
|
3303
|
+
var t = Qe(r);
|
|
3284
3304
|
function r(e) {
|
|
3285
3305
|
var n;
|
|
3286
|
-
return
|
|
3306
|
+
return Xe(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n;
|
|
3287
3307
|
}
|
|
3288
|
-
return
|
|
3308
|
+
return $e(r);
|
|
3289
3309
|
}();
|
|
3290
3310
|
exports.BiometricsErrors = void 0, function (e) {
|
|
3291
3311
|
e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
|
|
@@ -3296,14 +3316,14 @@ exports.BiometricsErrors = void 0, function (e) {
|
|
|
3296
3316
|
}(exports.AuthFlowType || (exports.AuthFlowType = {})), exports.B2BOAuthProviders = void 0, function (e) {
|
|
3297
3317
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
3298
3318
|
}(exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {}));
|
|
3299
|
-
var
|
|
3300
|
-
_inherits(
|
|
3301
|
-
var _super = _createSuper(
|
|
3302
|
-
function
|
|
3319
|
+
var dt = /*#__PURE__*/function (_fe) {
|
|
3320
|
+
_inherits(dt, _fe);
|
|
3321
|
+
var _super = _createSuper(dt);
|
|
3322
|
+
function dt(e, t, r, n, i, o) {
|
|
3303
3323
|
var _this4;
|
|
3304
|
-
_classCallCheck(this,
|
|
3305
|
-
_this4 = _super.call(this, e, t, r, n, i), _this4._oneTap =
|
|
3306
|
-
return
|
|
3324
|
+
_classCallCheck(this, dt);
|
|
3325
|
+
_this4 = _super.call(this, e, t, r, n, i), _this4._oneTap = o, _this4.startOneTap = function (e) {
|
|
3326
|
+
return He(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3307
3327
|
var t, r, n;
|
|
3308
3328
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3309
3329
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3341,20 +3361,20 @@ var ut = /*#__PURE__*/function (_ue) {
|
|
|
3341
3361
|
};
|
|
3342
3362
|
return _this4;
|
|
3343
3363
|
}
|
|
3344
|
-
return _createClass(
|
|
3345
|
-
}(
|
|
3346
|
-
var
|
|
3347
|
-
function
|
|
3348
|
-
_classCallCheck(this,
|
|
3364
|
+
return _createClass(dt);
|
|
3365
|
+
}(fe);
|
|
3366
|
+
var ht = /*#__PURE__*/function () {
|
|
3367
|
+
function ht(e, t, r, n) {
|
|
3368
|
+
_classCallCheck(this, ht);
|
|
3349
3369
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3350
3370
|
return null;
|
|
3351
|
-
}, this.eventLogger = new
|
|
3371
|
+
}, this.eventLogger = new ce({
|
|
3352
3372
|
maxBatchSize: 15,
|
|
3353
3373
|
intervalDurationMs: 800,
|
|
3354
3374
|
logEventURL: this.buildSDKUrl("/events")
|
|
3355
3375
|
});
|
|
3356
3376
|
}
|
|
3357
|
-
_createClass(
|
|
3377
|
+
_createClass(ht, [{
|
|
3358
3378
|
key: "logEvent",
|
|
3359
3379
|
value: function logEvent(_ref) {
|
|
3360
3380
|
var e = _ref.name,
|
|
@@ -3374,9 +3394,9 @@ var lt = /*#__PURE__*/function () {
|
|
|
3374
3394
|
key: "createTelemetryBlob",
|
|
3375
3395
|
value: function createTelemetryBlob() {
|
|
3376
3396
|
return Object.assign(Object.assign({
|
|
3377
|
-
event_id: "event-id-".concat(
|
|
3378
|
-
app_session_id: "app-session-id-".concat(
|
|
3379
|
-
persistent_id: "persistent-id-".concat(
|
|
3397
|
+
event_id: "event-id-".concat(z()),
|
|
3398
|
+
app_session_id: "app-session-id-".concat(z()),
|
|
3399
|
+
persistent_id: "persistent-id-".concat(z()),
|
|
3380
3400
|
client_sent_at: new Date().toISOString(),
|
|
3381
3401
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3382
3402
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3385,7 +3405,7 @@ var lt = /*#__PURE__*/function () {
|
|
|
3385
3405
|
},
|
|
3386
3406
|
sdk: {
|
|
3387
3407
|
identifier: "Stytch.js Javascript SDK",
|
|
3388
|
-
version: "2.0
|
|
3408
|
+
version: "2.1.0"
|
|
3389
3409
|
}
|
|
3390
3410
|
});
|
|
3391
3411
|
}
|
|
@@ -3396,19 +3416,19 @@ var lt = /*#__PURE__*/function () {
|
|
|
3396
3416
|
t = _ref2.body,
|
|
3397
3417
|
r = _ref2.errorMessage,
|
|
3398
3418
|
n = _ref2.method;
|
|
3399
|
-
return
|
|
3400
|
-
var i,
|
|
3419
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3420
|
+
var i, o, s, a;
|
|
3401
3421
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3402
3422
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3403
3423
|
case 0:
|
|
3404
|
-
i = this._subscriptionDataLayer.readSessionCookie().session_token,
|
|
3405
|
-
return _context4.abrupt("return",
|
|
3406
|
-
basicAuthHeader:
|
|
3424
|
+
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;
|
|
3425
|
+
return _context4.abrupt("return", N({
|
|
3426
|
+
basicAuthHeader: o,
|
|
3407
3427
|
body: t,
|
|
3408
3428
|
errorMessage: r,
|
|
3409
3429
|
finalURL: this.buildSDKUrl(e),
|
|
3410
3430
|
method: n,
|
|
3411
|
-
xSDKClientHeader:
|
|
3431
|
+
xSDKClientHeader: s,
|
|
3412
3432
|
xSDKParentHostHeader: a
|
|
3413
3433
|
}));
|
|
3414
3434
|
case 2:
|
|
@@ -3426,24 +3446,24 @@ var lt = /*#__PURE__*/function () {
|
|
|
3426
3446
|
r = _ref3.errorMessage,
|
|
3427
3447
|
n = _ref3.method,
|
|
3428
3448
|
i = _ref3.retryCallback;
|
|
3429
|
-
return
|
|
3430
|
-
var
|
|
3449
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3450
|
+
var s, a, c, u;
|
|
3431
3451
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3432
3452
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3433
3453
|
case 0:
|
|
3434
|
-
|
|
3454
|
+
s = this._subscriptionDataLayer.readSessionCookie().session_token, a = "Basic " + window.btoa(this._publicToken + ":" + (s || this._publicToken)), c = window.btoa(JSON.stringify(this.createTelemetryBlob())), u = window.location.origin;
|
|
3435
3455
|
return _context5.abrupt("return", function (e) {
|
|
3436
3456
|
var t = e.method,
|
|
3437
3457
|
r = e.errorMessage,
|
|
3438
3458
|
n = e.finalURL,
|
|
3439
3459
|
i = e.basicAuthHeader,
|
|
3440
|
-
|
|
3460
|
+
s = e.xSDKClientHeader,
|
|
3441
3461
|
a = e.xSDKParentHostHeader,
|
|
3442
3462
|
c = e.body,
|
|
3443
3463
|
u = e.retryCallback;
|
|
3444
|
-
return
|
|
3464
|
+
return O(this, void 0, void 0, o().mark(function e() {
|
|
3445
3465
|
var l;
|
|
3446
|
-
return
|
|
3466
|
+
return o().wrap(function (e) {
|
|
3447
3467
|
for (;;) switch (e.prev = e.next) {
|
|
3448
3468
|
case 0:
|
|
3449
3469
|
return l = {
|
|
@@ -3451,21 +3471,21 @@ var lt = /*#__PURE__*/function () {
|
|
|
3451
3471
|
errorMessage: r,
|
|
3452
3472
|
finalURL: n,
|
|
3453
3473
|
basicAuthHeader: i,
|
|
3454
|
-
xSDKClientHeader:
|
|
3474
|
+
xSDKClientHeader: s,
|
|
3455
3475
|
xSDKParentHostHeader: a,
|
|
3456
3476
|
body: c
|
|
3457
|
-
}, e.prev = 1, e.next = 4,
|
|
3477
|
+
}, e.prev = 1, e.next = 4, N(l);
|
|
3458
3478
|
case 4:
|
|
3459
3479
|
case 15:
|
|
3460
3480
|
return e.abrupt("return", e.sent);
|
|
3461
3481
|
case 7:
|
|
3462
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3482
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof M)) {
|
|
3463
3483
|
e.next = 16;
|
|
3464
3484
|
break;
|
|
3465
3485
|
}
|
|
3466
3486
|
return e.next = 12, u(e.t0, l);
|
|
3467
3487
|
case 12:
|
|
3468
|
-
return l = e.sent, e.next = 15,
|
|
3488
|
+
return l = e.sent, e.next = 15, N(l);
|
|
3469
3489
|
case 16:
|
|
3470
3490
|
throw e.t0;
|
|
3471
3491
|
case 17:
|
|
@@ -3497,14 +3517,14 @@ var lt = /*#__PURE__*/function () {
|
|
|
3497
3517
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3498
3518
|
}
|
|
3499
3519
|
}]);
|
|
3500
|
-
return
|
|
3520
|
+
return ht;
|
|
3501
3521
|
}();
|
|
3502
|
-
var
|
|
3503
|
-
function
|
|
3504
|
-
_classCallCheck(this,
|
|
3522
|
+
var pt = /*#__PURE__*/function () {
|
|
3523
|
+
function pt(e, t, r) {
|
|
3524
|
+
_classCallCheck(this, pt);
|
|
3505
3525
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3506
3526
|
}
|
|
3507
|
-
_createClass(
|
|
3527
|
+
_createClass(pt, [{
|
|
3508
3528
|
key: "cancel",
|
|
3509
3529
|
value: function cancel() {
|
|
3510
3530
|
this._googleClient.cancel();
|
|
@@ -3515,7 +3535,7 @@ var dt = /*#__PURE__*/function () {
|
|
|
3515
3535
|
var e = _ref4.callback,
|
|
3516
3536
|
t = _ref4.onOneTapCancelled,
|
|
3517
3537
|
r = _ref4.style;
|
|
3518
|
-
return
|
|
3538
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3519
3539
|
var _this5 = this;
|
|
3520
3540
|
var n;
|
|
3521
3541
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3552,23 +3572,23 @@ var dt = /*#__PURE__*/function () {
|
|
|
3552
3572
|
key: "styleFrame",
|
|
3553
3573
|
value: function styleFrame(e) {
|
|
3554
3574
|
e.position === exports.OneTapPositions.embedded && Array.from(document.getElementsByTagName("iframe")).forEach(function (e) {
|
|
3555
|
-
e.src.includes(
|
|
3575
|
+
e.src.includes(S) && (e.style.width = "100%");
|
|
3556
3576
|
});
|
|
3557
3577
|
}
|
|
3558
3578
|
}]);
|
|
3559
|
-
return
|
|
3579
|
+
return pt;
|
|
3560
3580
|
}();
|
|
3561
|
-
var
|
|
3562
|
-
function
|
|
3581
|
+
var ft = /*#__PURE__*/function () {
|
|
3582
|
+
function ft(e, t) {
|
|
3563
3583
|
var _this6 = this;
|
|
3564
|
-
_classCallCheck(this,
|
|
3584
|
+
_classCallCheck(this, ft);
|
|
3565
3585
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
3566
3586
|
var e = _ref5.loginRedirectUrl,
|
|
3567
3587
|
t = _ref5.signupRedirectUrl,
|
|
3568
3588
|
r = _ref5.onSuccess;
|
|
3569
3589
|
return function (n) {
|
|
3570
|
-
return
|
|
3571
|
-
var i, _yield$this$submitGoo,
|
|
3590
|
+
return He(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3591
|
+
var i, _yield$this$submitGoo, o;
|
|
3572
3592
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3573
3593
|
while (1) switch (_context7.prev = _context7.next) {
|
|
3574
3594
|
case 0:
|
|
@@ -3581,8 +3601,8 @@ var ht = /*#__PURE__*/function () {
|
|
|
3581
3601
|
});
|
|
3582
3602
|
case 3:
|
|
3583
3603
|
_yield$this$submitGoo = _context7.sent;
|
|
3584
|
-
|
|
3585
|
-
r(
|
|
3604
|
+
o = _yield$this$submitGoo.redirect_url;
|
|
3605
|
+
r(o);
|
|
3586
3606
|
case 6:
|
|
3587
3607
|
case "end":
|
|
3588
3608
|
return _context7.stop();
|
|
@@ -3594,10 +3614,10 @@ var ht = /*#__PURE__*/function () {
|
|
|
3594
3614
|
window.location.href = e;
|
|
3595
3615
|
};
|
|
3596
3616
|
}
|
|
3597
|
-
_createClass(
|
|
3617
|
+
_createClass(ft, [{
|
|
3598
3618
|
key: "createOneTapClient",
|
|
3599
3619
|
value: function createOneTapClient() {
|
|
3600
|
-
return
|
|
3620
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3601
3621
|
var e, _yield$this$fetchGoog;
|
|
3602
3622
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3603
3623
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -3628,9 +3648,9 @@ var ht = /*#__PURE__*/function () {
|
|
|
3628
3648
|
});
|
|
3629
3649
|
case 12:
|
|
3630
3650
|
_context8.t1 = !0;
|
|
3631
|
-
_context8.t2 =
|
|
3651
|
+
_context8.t2 = pt;
|
|
3632
3652
|
_context8.next = 16;
|
|
3633
|
-
return
|
|
3653
|
+
return V(C, function () {
|
|
3634
3654
|
return window.google.accounts.id;
|
|
3635
3655
|
});
|
|
3636
3656
|
case 16:
|
|
@@ -3662,7 +3682,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3662
3682
|
var e = _ref6.credential,
|
|
3663
3683
|
t = _ref6.loginRedirectUrl,
|
|
3664
3684
|
r = _ref6.signupRedirectUrl;
|
|
3665
|
-
return
|
|
3685
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3666
3686
|
var _yield$this$fetchGoog2, n;
|
|
3667
3687
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3668
3688
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -3699,21 +3719,21 @@ var ht = /*#__PURE__*/function () {
|
|
|
3699
3719
|
}, {
|
|
3700
3720
|
key: "WillGoogleOneTapShowEmbedded",
|
|
3701
3721
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
3702
|
-
return !
|
|
3722
|
+
return !ft.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
3703
3723
|
}
|
|
3704
3724
|
}]);
|
|
3705
|
-
return
|
|
3725
|
+
return ft;
|
|
3706
3726
|
}();
|
|
3707
|
-
function
|
|
3727
|
+
function _t(e) {
|
|
3708
3728
|
var t = e.toString(16);
|
|
3709
3729
|
return 1 === t.length && (t = "0" + t), t;
|
|
3710
3730
|
}
|
|
3711
|
-
var
|
|
3712
|
-
function
|
|
3713
|
-
_classCallCheck(this,
|
|
3731
|
+
var mt = /*#__PURE__*/function () {
|
|
3732
|
+
function mt(e, t) {
|
|
3733
|
+
_classCallCheck(this, mt);
|
|
3714
3734
|
this._dataLayer = e, this.namespace = t;
|
|
3715
3735
|
}
|
|
3716
|
-
_createClass(
|
|
3736
|
+
_createClass(mt, [{
|
|
3717
3737
|
key: "key",
|
|
3718
3738
|
value: function key() {
|
|
3719
3739
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3721,13 +3741,13 @@ var ft = /*#__PURE__*/function () {
|
|
|
3721
3741
|
}, {
|
|
3722
3742
|
key: "startPKCETransaction",
|
|
3723
3743
|
value: function startPKCETransaction() {
|
|
3724
|
-
return
|
|
3744
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3725
3745
|
var e;
|
|
3726
3746
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3727
3747
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3728
3748
|
case 0:
|
|
3729
3749
|
_context10.next = 2;
|
|
3730
|
-
return
|
|
3750
|
+
return mt.createProofkeyPair();
|
|
3731
3751
|
case 2:
|
|
3732
3752
|
e = _context10.sent;
|
|
3733
3753
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3745,7 +3765,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3745
3765
|
if (null !== e) try {
|
|
3746
3766
|
return JSON.parse(e);
|
|
3747
3767
|
} catch (e) {
|
|
3748
|
-
return void
|
|
3768
|
+
return void Q("Found malformed Proof Key pair in localstorage.");
|
|
3749
3769
|
}
|
|
3750
3770
|
}
|
|
3751
3771
|
}, {
|
|
@@ -3756,7 +3776,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3756
3776
|
}], [{
|
|
3757
3777
|
key: "createProofkeyPair",
|
|
3758
3778
|
value: function createProofkeyPair() {
|
|
3759
|
-
return
|
|
3779
|
+
return He(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
3760
3780
|
var _String$fromCharCode;
|
|
3761
3781
|
var e, t, r, n;
|
|
3762
3782
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -3764,7 +3784,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3764
3784
|
case 0:
|
|
3765
3785
|
e = new Uint32Array(16);
|
|
3766
3786
|
window.crypto.getRandomValues(e);
|
|
3767
|
-
t = Array.from(e).map(
|
|
3787
|
+
t = Array.from(e).map(_t).join("");
|
|
3768
3788
|
_context11.next = 5;
|
|
3769
3789
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3770
3790
|
case 5:
|
|
@@ -3781,14 +3801,14 @@ var ft = /*#__PURE__*/function () {
|
|
|
3781
3801
|
}));
|
|
3782
3802
|
}
|
|
3783
3803
|
}]);
|
|
3784
|
-
return
|
|
3804
|
+
return mt;
|
|
3785
3805
|
}();
|
|
3786
|
-
var
|
|
3787
|
-
function
|
|
3788
|
-
_classCallCheck(this,
|
|
3806
|
+
var vt = /*#__PURE__*/function () {
|
|
3807
|
+
function vt(e) {
|
|
3808
|
+
_classCallCheck(this, vt);
|
|
3789
3809
|
this._networkClient = e;
|
|
3790
3810
|
}
|
|
3791
|
-
_createClass(
|
|
3811
|
+
_createClass(vt, [{
|
|
3792
3812
|
key: "searchUser",
|
|
3793
3813
|
value: function searchUser(e) {
|
|
3794
3814
|
return this._networkClient.fetchSDK({
|
|
@@ -3826,9 +3846,9 @@ var _t = /*#__PURE__*/function () {
|
|
|
3826
3846
|
});
|
|
3827
3847
|
}
|
|
3828
3848
|
}]);
|
|
3829
|
-
return
|
|
3849
|
+
return vt;
|
|
3830
3850
|
}();
|
|
3831
|
-
var
|
|
3851
|
+
var yt = function yt(e) {
|
|
3832
3852
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3833
3853
|
var _t$split = t.split("="),
|
|
3834
3854
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3837,20 +3857,20 @@ var vt = function vt(e) {
|
|
|
3837
3857
|
}).length > 1;
|
|
3838
3858
|
};
|
|
3839
3859
|
/*! js-cookie v3.0.1 | MIT */
|
|
3840
|
-
function
|
|
3860
|
+
function gt(e) {
|
|
3841
3861
|
for (var t = 1; t < arguments.length; t++) {
|
|
3842
3862
|
var r = arguments[t];
|
|
3843
3863
|
for (var n in r) e[n] = r[n];
|
|
3844
3864
|
}
|
|
3845
3865
|
return e;
|
|
3846
3866
|
}
|
|
3847
|
-
var
|
|
3867
|
+
var bt = function e(t, r) {
|
|
3848
3868
|
function n(e, n, i) {
|
|
3849
3869
|
if ("undefined" != typeof document) {
|
|
3850
|
-
"number" == typeof (i =
|
|
3851
|
-
var
|
|
3852
|
-
for (var
|
|
3853
|
-
return document.cookie = e + "=" + t.write(n, e) +
|
|
3870
|
+
"number" == typeof (i = gt({}, 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);
|
|
3871
|
+
var o = "";
|
|
3872
|
+
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
3873
|
+
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
3854
3874
|
}
|
|
3855
3875
|
}
|
|
3856
3876
|
return Object.create({
|
|
@@ -3858,26 +3878,26 @@ var yt = function e(t, r) {
|
|
|
3858
3878
|
get: function get(e) {
|
|
3859
3879
|
if ("undefined" != typeof document && (!arguments.length || e)) {
|
|
3860
3880
|
for (var r = document.cookie ? document.cookie.split("; ") : [], n = {}, i = 0; i < r.length; i++) {
|
|
3861
|
-
var
|
|
3862
|
-
|
|
3881
|
+
var o = r[i].split("="),
|
|
3882
|
+
s = o.slice(1).join("=");
|
|
3863
3883
|
try {
|
|
3864
|
-
var a = decodeURIComponent(
|
|
3865
|
-
if (n[a] = t.read(
|
|
3884
|
+
var a = decodeURIComponent(o[0]);
|
|
3885
|
+
if (n[a] = t.read(s, a), e === a) break;
|
|
3866
3886
|
} catch (e) {}
|
|
3867
3887
|
}
|
|
3868
3888
|
return e ? n[e] : n;
|
|
3869
3889
|
}
|
|
3870
3890
|
},
|
|
3871
3891
|
remove: function remove(e, t) {
|
|
3872
|
-
n(e, "",
|
|
3892
|
+
n(e, "", gt({}, t, {
|
|
3873
3893
|
expires: -1
|
|
3874
3894
|
}));
|
|
3875
3895
|
},
|
|
3876
3896
|
withAttributes: function withAttributes(t) {
|
|
3877
|
-
return e(this.converter,
|
|
3897
|
+
return e(this.converter, gt({}, this.attributes, t));
|
|
3878
3898
|
},
|
|
3879
3899
|
withConverter: function withConverter(t) {
|
|
3880
|
-
return e(
|
|
3900
|
+
return e(gt({}, this.converter, t), this.attributes);
|
|
3881
3901
|
}
|
|
3882
3902
|
}, {
|
|
3883
3903
|
attributes: {
|
|
@@ -3897,26 +3917,26 @@ var yt = function e(t, r) {
|
|
|
3897
3917
|
}, {
|
|
3898
3918
|
path: "/"
|
|
3899
3919
|
});
|
|
3900
|
-
var
|
|
3920
|
+
var kt = function kt(e) {
|
|
3901
3921
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3902
3922
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3903
3923
|
};
|
|
3904
|
-
var
|
|
3905
|
-
function
|
|
3924
|
+
var wt = /*#__PURE__*/function () {
|
|
3925
|
+
function wt(e, t) {
|
|
3906
3926
|
var _this7 = this;
|
|
3907
|
-
_classCallCheck(this,
|
|
3927
|
+
_classCallCheck(this, wt);
|
|
3908
3928
|
this.browserSessionStorage = {
|
|
3909
3929
|
getItem: function getItem(e) {
|
|
3910
|
-
return sessionStorage.getItem(
|
|
3930
|
+
return sessionStorage.getItem(kt(_this7.publicToken, e));
|
|
3911
3931
|
},
|
|
3912
3932
|
setItem: function setItem(e, t) {
|
|
3913
|
-
return sessionStorage.setItem(
|
|
3933
|
+
return sessionStorage.setItem(kt(_this7.publicToken, e), t);
|
|
3914
3934
|
},
|
|
3915
3935
|
removeItem: function removeItem(e) {
|
|
3916
|
-
return sessionStorage.removeItem(
|
|
3936
|
+
return sessionStorage.removeItem(kt(_this7.publicToken, e));
|
|
3917
3937
|
}
|
|
3918
|
-
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
3919
|
-
var r = localStorage.getItem(
|
|
3938
|
+
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (re("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);
|
|
3939
|
+
var r = localStorage.getItem(kt(this.publicToken));
|
|
3920
3940
|
if (!r) return this.removeSessionCookie(), void this.removeISTCookie();
|
|
3921
3941
|
var n;
|
|
3922
3942
|
try {
|
|
@@ -3926,7 +3946,7 @@ var bt = /*#__PURE__*/function () {
|
|
|
3926
3946
|
}
|
|
3927
3947
|
this.state = n;
|
|
3928
3948
|
}
|
|
3929
|
-
_createClass(
|
|
3949
|
+
_createClass(wt, [{
|
|
3930
3950
|
key: "opaqueTokenCookieName",
|
|
3931
3951
|
get: function get() {
|
|
3932
3952
|
var e;
|
|
@@ -3948,45 +3968,48 @@ var bt = /*#__PURE__*/function () {
|
|
|
3948
3968
|
key: "readSessionCookie",
|
|
3949
3969
|
value: function readSessionCookie() {
|
|
3950
3970
|
return {
|
|
3951
|
-
session_token:
|
|
3952
|
-
session_jwt:
|
|
3971
|
+
session_token: bt.get(this.opaqueTokenCookieName),
|
|
3972
|
+
session_jwt: bt.get(this.jwtCookieName)
|
|
3953
3973
|
};
|
|
3954
3974
|
}
|
|
3955
3975
|
}, {
|
|
3956
3976
|
key: "readIntermediateSessionTokenCookie",
|
|
3957
3977
|
value: function readIntermediateSessionTokenCookie() {
|
|
3958
|
-
return
|
|
3978
|
+
return bt.get(this.istCookieName);
|
|
3959
3979
|
}
|
|
3960
3980
|
}, {
|
|
3961
3981
|
key: "writeSessionCookie",
|
|
3962
3982
|
value: function writeSessionCookie(e) {
|
|
3963
3983
|
var t, r, n, i;
|
|
3964
|
-
var
|
|
3965
|
-
|
|
3984
|
+
var o = e.state,
|
|
3985
|
+
s = e.session_token,
|
|
3966
3986
|
a = e.session_jwt,
|
|
3967
|
-
c =
|
|
3968
|
-
expiresAt: null !== (r = null === (t = null ==
|
|
3987
|
+
c = wt.generateCookieOpts({
|
|
3988
|
+
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
3969
3989
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3970
|
-
path: this._cookiePath
|
|
3990
|
+
path: this._cookiePath,
|
|
3991
|
+
domain: this._domain
|
|
3971
3992
|
});
|
|
3972
|
-
|
|
3973
|
-
var u =
|
|
3974
|
-
expiresAt: null !== (i = null === (n = null ==
|
|
3993
|
+
bt.set(this.opaqueTokenCookieName, s, c), bt.set(this.jwtCookieName, a, c);
|
|
3994
|
+
var u = wt.generateCookieOpts({
|
|
3995
|
+
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
3975
3996
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
3976
|
-
path: this._cookiePath
|
|
3997
|
+
path: this._cookiePath,
|
|
3998
|
+
domain: this._domain
|
|
3977
3999
|
});
|
|
3978
|
-
|
|
4000
|
+
yt(this.jwtCookieName) && bt.remove(this.jwtCookieName, u), yt(this.opaqueTokenCookieName) && bt.remove(this.opaqueTokenCookieName, u), yt(this.jwtCookieName) && Q("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), yt(this.opaqueTokenCookieName) && Q("Could not remove extraneous opaque token cookie.");
|
|
3979
4001
|
}
|
|
3980
4002
|
}, {
|
|
3981
4003
|
key: "writeIntermediateSessionTokenCookie",
|
|
3982
4004
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
3983
4005
|
var t = new Date(Date.now() + 6e5),
|
|
3984
|
-
r =
|
|
4006
|
+
r = wt.generateCookieOpts({
|
|
3985
4007
|
expiresAt: t.toString(),
|
|
3986
4008
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3987
|
-
path: this._cookiePath
|
|
4009
|
+
path: this._cookiePath,
|
|
4010
|
+
domain: this._domain
|
|
3988
4011
|
});
|
|
3989
|
-
|
|
4012
|
+
bt.set(this.istCookieName, e, r);
|
|
3990
4013
|
}
|
|
3991
4014
|
}, {
|
|
3992
4015
|
key: "removeSessionCookie",
|
|
@@ -4004,13 +4027,16 @@ var bt = /*#__PURE__*/function () {
|
|
|
4004
4027
|
var _this8 = this;
|
|
4005
4028
|
[!0, !1].forEach(function (t) {
|
|
4006
4029
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4030
|
+
[_this8._domain, null].forEach(function (n) {
|
|
4031
|
+
var i = wt.generateCookieOpts({
|
|
4032
|
+
expiresAt: new Date(0).toString(),
|
|
4033
|
+
availableToSubdomains: t,
|
|
4034
|
+
path: r,
|
|
4035
|
+
domain: n
|
|
4036
|
+
});
|
|
4037
|
+
e.forEach(function (e) {
|
|
4038
|
+
bt.remove(e, i);
|
|
4039
|
+
});
|
|
4014
4040
|
});
|
|
4015
4041
|
});
|
|
4016
4042
|
});
|
|
@@ -4018,86 +4044,87 @@ var bt = /*#__PURE__*/function () {
|
|
|
4018
4044
|
}, {
|
|
4019
4045
|
key: "syncToLocalStorage",
|
|
4020
4046
|
value: function syncToLocalStorage() {
|
|
4021
|
-
localStorage.setItem(
|
|
4047
|
+
localStorage.setItem(kt(this.publicToken), JSON.stringify(this.state));
|
|
4022
4048
|
}
|
|
4023
4049
|
}, {
|
|
4024
4050
|
key: "getItem",
|
|
4025
4051
|
value: function getItem(e) {
|
|
4026
|
-
return localStorage.getItem(
|
|
4052
|
+
return localStorage.getItem(kt(this.publicToken, e));
|
|
4027
4053
|
}
|
|
4028
4054
|
}, {
|
|
4029
4055
|
key: "setItem",
|
|
4030
4056
|
value: function setItem(e, t) {
|
|
4031
|
-
return localStorage.setItem(
|
|
4057
|
+
return localStorage.setItem(kt(this.publicToken, e), t);
|
|
4032
4058
|
}
|
|
4033
4059
|
}, {
|
|
4034
4060
|
key: "removeItem",
|
|
4035
4061
|
value: function removeItem(e) {
|
|
4036
|
-
return localStorage.removeItem(
|
|
4062
|
+
return localStorage.removeItem(kt(this.publicToken, e));
|
|
4037
4063
|
}
|
|
4038
4064
|
}], [{
|
|
4039
4065
|
key: "generateCookieOpts",
|
|
4040
4066
|
value: function generateCookieOpts(_ref7) {
|
|
4041
4067
|
var e = _ref7.path,
|
|
4042
|
-
t = _ref7.
|
|
4043
|
-
r = _ref7.
|
|
4044
|
-
|
|
4045
|
-
|
|
4068
|
+
t = _ref7.domain,
|
|
4069
|
+
r = _ref7.availableToSubdomains,
|
|
4070
|
+
n = _ref7.expiresAt;
|
|
4071
|
+
var i = {
|
|
4072
|
+
expires: new Date(n),
|
|
4046
4073
|
sameSite: "lax"
|
|
4047
4074
|
};
|
|
4048
|
-
return e && (
|
|
4075
|
+
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;
|
|
4049
4076
|
}
|
|
4050
4077
|
}]);
|
|
4051
|
-
return
|
|
4078
|
+
return wt;
|
|
4052
4079
|
}();
|
|
4053
|
-
var
|
|
4054
|
-
_inherits(
|
|
4055
|
-
var _super2 = _createSuper(
|
|
4056
|
-
function
|
|
4057
|
-
_classCallCheck(this,
|
|
4080
|
+
var St = /*#__PURE__*/function (_wt) {
|
|
4081
|
+
_inherits(St, _wt);
|
|
4082
|
+
var _super2 = _createSuper(St);
|
|
4083
|
+
function St() {
|
|
4084
|
+
_classCallCheck(this, St);
|
|
4058
4085
|
return _super2.apply(this, arguments);
|
|
4059
4086
|
}
|
|
4060
|
-
return _createClass(
|
|
4061
|
-
}(
|
|
4062
|
-
var
|
|
4063
|
-
|
|
4087
|
+
return _createClass(St);
|
|
4088
|
+
}(wt);
|
|
4089
|
+
var Ct = Symbol["for"]("__stytch_DataLayer"),
|
|
4090
|
+
Tt = function Tt(e, t) {
|
|
4064
4091
|
var r = function () {
|
|
4065
4092
|
var e = window;
|
|
4066
|
-
return e[
|
|
4093
|
+
return e[Ct] || (e[Ct] = {}), e[Ct];
|
|
4067
4094
|
}();
|
|
4068
|
-
return r[e] || (r[e] = new
|
|
4095
|
+
return r[e] || (r[e] = new St(e, t)), r[e];
|
|
4069
4096
|
},
|
|
4070
|
-
|
|
4097
|
+
Ot = function Ot(e, t) {
|
|
4071
4098
|
Object.values(e).forEach(function (e) {
|
|
4072
4099
|
return e(t);
|
|
4073
4100
|
});
|
|
4074
4101
|
},
|
|
4075
|
-
|
|
4102
|
+
At = function () {
|
|
4076
4103
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4077
4104
|
r = void 0 === e ? [] : e;
|
|
4078
|
-
return function e(n,
|
|
4079
|
-
return i(n) === i(
|
|
4080
|
-
return !(e in
|
|
4105
|
+
return function e(n, o) {
|
|
4106
|
+
return i(n) === i(o) && (null === n || null === o ? n === o : "object" === i(n) ? Object.keys(n).length === Object.keys(o).length && !Object.keys(n).some(function (e) {
|
|
4107
|
+
return !(e in o);
|
|
4081
4108
|
}) && Object.entries(n).filter(function (e) {
|
|
4082
4109
|
var n = t(e, 1)[0];
|
|
4083
4110
|
return !r.includes(n);
|
|
4084
4111
|
}).every(function (r) {
|
|
4085
4112
|
var n = t(r, 2),
|
|
4086
4113
|
i = n[0],
|
|
4087
|
-
|
|
4088
|
-
return e(
|
|
4089
|
-
}) : n ===
|
|
4114
|
+
s = n[1];
|
|
4115
|
+
return e(s, o[i]);
|
|
4116
|
+
}) : n === o);
|
|
4090
4117
|
};
|
|
4091
4118
|
}({
|
|
4092
4119
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4093
4120
|
});
|
|
4094
|
-
var
|
|
4095
|
-
function
|
|
4121
|
+
var Et = /*#__PURE__*/function () {
|
|
4122
|
+
function Et(e, t) {
|
|
4096
4123
|
var _this9 = this;
|
|
4097
|
-
_classCallCheck(this,
|
|
4124
|
+
_classCallCheck(this, Et);
|
|
4098
4125
|
var r;
|
|
4099
4126
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4100
|
-
if (e.key !==
|
|
4127
|
+
if (e.key !== kt(_this9._publicToken)) return;
|
|
4101
4128
|
if (null === e.newValue || "null" === e.newValue) return void _this9.destroyState();
|
|
4102
4129
|
var t = JSON.parse(e.newValue);
|
|
4103
4130
|
_this9.updateState(t);
|
|
@@ -4108,7 +4135,7 @@ var xt = /*#__PURE__*/function () {
|
|
|
4108
4135
|
i = _this$_datalayer$read.session_token;
|
|
4109
4136
|
i || this.destroyState();
|
|
4110
4137
|
}
|
|
4111
|
-
_createClass(
|
|
4138
|
+
_createClass(Et, [{
|
|
4112
4139
|
key: "getTokens",
|
|
4113
4140
|
value: function getTokens() {
|
|
4114
4141
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4139,7 +4166,7 @@ var xt = /*#__PURE__*/function () {
|
|
|
4139
4166
|
value: function _updateStateAndTokensInternal(e) {
|
|
4140
4167
|
var t = this._datalayer.state,
|
|
4141
4168
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4142
|
-
this._datalayer.state = r,
|
|
4169
|
+
this._datalayer.state = r, At(t, r) || Ot(this._datalayer.subscriptions, r);
|
|
4143
4170
|
}
|
|
4144
4171
|
}, {
|
|
4145
4172
|
key: "updateStateAndTokens",
|
|
@@ -4151,7 +4178,7 @@ var xt = /*#__PURE__*/function () {
|
|
|
4151
4178
|
value: function updateState(e) {
|
|
4152
4179
|
var t = this._datalayer.state,
|
|
4153
4180
|
r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4154
|
-
this._datalayer.state = r,
|
|
4181
|
+
this._datalayer.state = r, At(t, r) || (Ot(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage());
|
|
4155
4182
|
}
|
|
4156
4183
|
}, {
|
|
4157
4184
|
key: "updateTokens",
|
|
@@ -4191,14 +4218,14 @@ var xt = /*#__PURE__*/function () {
|
|
|
4191
4218
|
return null;
|
|
4192
4219
|
}
|
|
4193
4220
|
}]);
|
|
4194
|
-
return
|
|
4221
|
+
return Et;
|
|
4195
4222
|
}();
|
|
4196
|
-
var
|
|
4197
|
-
_inherits(
|
|
4198
|
-
var _super3 = _createSuper(
|
|
4199
|
-
function
|
|
4223
|
+
var Pt = /*#__PURE__*/function (_Et) {
|
|
4224
|
+
_inherits(Pt, _Et);
|
|
4225
|
+
var _super3 = _createSuper(Pt);
|
|
4226
|
+
function Pt() {
|
|
4200
4227
|
var _this10;
|
|
4201
|
-
_classCallCheck(this,
|
|
4228
|
+
_classCallCheck(this, Pt);
|
|
4202
4229
|
_this10 = _super3.apply(this, arguments), _this10.updateUser = function (e) {
|
|
4203
4230
|
return _this10.updateState({
|
|
4204
4231
|
user: e
|
|
@@ -4212,10 +4239,10 @@ var Ct = /*#__PURE__*/function (_xt) {
|
|
|
4212
4239
|
};
|
|
4213
4240
|
return _this10;
|
|
4214
4241
|
}
|
|
4215
|
-
return _createClass(
|
|
4216
|
-
}(
|
|
4217
|
-
var
|
|
4218
|
-
exports.SDKAPIUnreachableError =
|
|
4242
|
+
return _createClass(Pt);
|
|
4243
|
+
}(Et);
|
|
4244
|
+
var xt = Symbol["for"]("stytch__internal_b2c");
|
|
4245
|
+
exports.SDKAPIUnreachableError = st, exports.StytchHeadlessClient = /*#__PURE__*/function () {
|
|
4219
4246
|
function _class(e, t) {
|
|
4220
4247
|
var _this11 = this;
|
|
4221
4248
|
_classCallCheck(this, _class);
|
|
@@ -4223,47 +4250,47 @@ exports.SDKAPIUnreachableError = it, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4223
4250
|
!function (e) {
|
|
4224
4251
|
var t = "StytchUIClient" === e ? "import { createStytchUIClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchUIClient('public-token-...');\n" : "import { createStytchHeadlessClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchHeadlessClient('public-token-...');\n";
|
|
4225
4252
|
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(t, "\n```\n"));
|
|
4226
|
-
}("StytchHeadlessClient"), "string" != typeof (r = e) ?
|
|
4253
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? Q("Public token is malformed. Expected a string, got ".concat(i(r), ".").concat(te)) : "" === r ? Q('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(te)) : r.startsWith("public-token-") || Q('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(te));
|
|
4227
4254
|
var n = t,
|
|
4228
|
-
|
|
4229
|
-
cookieOptions: null == (
|
|
4255
|
+
o = {
|
|
4256
|
+
cookieOptions: null == (s = n) ? void 0 : s.cookieOptions,
|
|
4230
4257
|
endpoints: {
|
|
4231
|
-
sdkBackendURL: null !== (c = null === (a = null ==
|
|
4232
|
-
testAPIURL: null !== (l = null === (u = null ==
|
|
4233
|
-
liveAPIURL: null !== (h = null === (d = null ==
|
|
4234
|
-
dfpBackendURL: null !== (f = null === (p = null ==
|
|
4235
|
-
clientsideServicesIframeURL: null !== (
|
|
4258
|
+
sdkBackendURL: null !== (c = null === (a = null == s ? void 0 : s.endpoints) || void 0 === a ? void 0 : a.sdkBackendURL) && void 0 !== c ? c : "https://web.stytch.com",
|
|
4259
|
+
testAPIURL: null !== (l = null === (u = null == s ? void 0 : s.endpoints) || void 0 === u ? void 0 : u.testAPIURL) && void 0 !== l ? l : "https://test.stytch.com",
|
|
4260
|
+
liveAPIURL: null !== (h = null === (d = null == s ? void 0 : s.endpoints) || void 0 === d ? void 0 : d.liveAPIURL) && void 0 !== h ? h : "https://api.stytch.com",
|
|
4261
|
+
dfpBackendURL: null !== (f = null === (p = null == s ? void 0 : s.endpoints) || void 0 === p ? void 0 : p.dfpBackendURL) && void 0 !== f ? f : "https://telemetry.stytch.com",
|
|
4262
|
+
clientsideServicesIframeURL: null !== (m = null === (_ = null == s ? void 0 : s.endpoints) || void 0 === _ ? void 0 : _.clientsideServicesIframeURL) && void 0 !== m ? m : "https://js.stytch.com/clientside-services/index.html"
|
|
4236
4263
|
}
|
|
4237
4264
|
};
|
|
4238
|
-
var
|
|
4239
|
-
this._dataLayer =
|
|
4240
|
-
var
|
|
4241
|
-
this._networkClient = new
|
|
4265
|
+
var s, a, c, u, l, d, h, p, f, _, m;
|
|
4266
|
+
this._dataLayer = Tt(e, n), this._subscriptionService = new Pt(e, this._dataLayer);
|
|
4267
|
+
var v = new mt(this._dataLayer, "passwords");
|
|
4268
|
+
this._networkClient = new ht(e, this._dataLayer, o.endpoints.sdkBackendURL, function () {
|
|
4242
4269
|
var e, t, r, n;
|
|
4243
4270
|
return {
|
|
4244
4271
|
stytch_user_id: null === (t = null === (e = _this11._dataLayer.state) || void 0 === e ? void 0 : e.user) || void 0 === t ? void 0 : t.user_id,
|
|
4245
4272
|
stytch_session_id: null === (n = null === (r = _this11._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.session_id
|
|
4246
4273
|
};
|
|
4247
4274
|
});
|
|
4248
|
-
var y = new
|
|
4249
|
-
g = new
|
|
4250
|
-
b = new
|
|
4251
|
-
k = new
|
|
4252
|
-
w = new
|
|
4253
|
-
S = new
|
|
4254
|
-
var
|
|
4255
|
-
this.user = new
|
|
4275
|
+
var y = new Ge(e, this._networkClient, this._dataLayer),
|
|
4276
|
+
g = new ze(y.getAsync()),
|
|
4277
|
+
b = new oe(e, o.endpoints.dfpBackendURL, y.getAsync(), g.executeRecaptcha),
|
|
4278
|
+
k = new Ye(o.endpoints.clientsideServicesIframeURL),
|
|
4279
|
+
w = new ft(e, k),
|
|
4280
|
+
S = new vt(this._networkClient);
|
|
4281
|
+
var C, T;
|
|
4282
|
+
this.user = new ue(this._networkClient, this._subscriptionService), this.session = new le(this._networkClient, this._subscriptionService), this.magicLinks = new he(this._networkClient, this._subscriptionService, new mt(this._dataLayer, "magic_links"), v, y.getAsync(), b), this.otps = new pe(this._networkClient, this._subscriptionService, g.executeRecaptcha, b), this.oauth = new dt(this._networkClient, this._subscriptionService, new mt(this._dataLayer, "oauth"), y.getAsync(), {
|
|
4256
4283
|
publicToken: e,
|
|
4257
|
-
testAPIURL:
|
|
4258
|
-
liveAPIURL:
|
|
4259
|
-
}, w), this.cryptoWallets = new
|
|
4284
|
+
testAPIURL: o.endpoints.testAPIURL,
|
|
4285
|
+
liveAPIURL: o.endpoints.liveAPIURL
|
|
4286
|
+
}, w), this.cryptoWallets = new _e(this._networkClient, this._subscriptionService, g.executeRecaptcha, b), this.totps = new me(this._networkClient, this._subscriptionService, b), this.webauthn = new Me(this._networkClient, this._subscriptionService, b), this.passwords = new Ue(this._networkClient, this._subscriptionService, v, y.getAsync(), b), this._sessionManager = new We(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4260
4287
|
name: "sdk_instance_instantiated",
|
|
4261
4288
|
details: {
|
|
4262
4289
|
event_callback_registered: !1,
|
|
4263
4290
|
error_callback_registered: !1,
|
|
4264
4291
|
success_callback_registered: !1
|
|
4265
4292
|
}
|
|
4266
|
-
}),
|
|
4293
|
+
}), C = this, T = {
|
|
4267
4294
|
bootstrap: y,
|
|
4268
4295
|
clientsideServices: k,
|
|
4269
4296
|
captcha: g,
|
|
@@ -4272,7 +4299,7 @@ exports.SDKAPIUnreachableError = it, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4272
4299
|
publicToken: e,
|
|
4273
4300
|
dataLayer: this._dataLayer,
|
|
4274
4301
|
networkClient: this._networkClient
|
|
4275
|
-
}, Object.assign(
|
|
4302
|
+
}, Object.assign(C, _defineProperty({}, xt, T));
|
|
4276
4303
|
}
|
|
4277
4304
|
return _createClass(_class);
|
|
4278
|
-
}(), exports.StytchSDKAPIError =
|
|
4305
|
+
}(), exports.StytchSDKAPIError = ut, exports.StytchSDKNativeError = lt, exports.StytchSDKSchemaError = ct, exports.StytchSDKUsageError = at, exports.UNRECOVERABLE_ERROR_TYPES = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|