@stytch/vanilla-js 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/b2b/index.esm.js +4168 -4157
- package/dist/b2b/index.js +4052 -4041
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +536 -524
- package/dist/index.headless.js +508 -496
- package/dist/index.js +1 -1
- package/package.json +4 -2
|
@@ -178,15 +178,15 @@ function s() {
|
|
|
178
178
|
var p = {};
|
|
179
179
|
function f() {}
|
|
180
180
|
function _() {}
|
|
181
|
-
function
|
|
182
|
-
var
|
|
183
|
-
l(
|
|
181
|
+
function m() {}
|
|
182
|
+
var v = {};
|
|
183
|
+
l(v, a, function () {
|
|
184
184
|
return this;
|
|
185
185
|
});
|
|
186
186
|
var y = Object.getPrototypeOf,
|
|
187
187
|
g = y && y(y(x([])));
|
|
188
|
-
g && g !== t && r.call(g, a) && (
|
|
189
|
-
var b =
|
|
188
|
+
g && g !== t && r.call(g, a) && (v = g);
|
|
189
|
+
var b = m.prototype = f.prototype = Object.create(v);
|
|
190
190
|
function k(e) {
|
|
191
191
|
["next", "throw", "return"].forEach(function (t) {
|
|
192
192
|
l(e, t, function (e) {
|
|
@@ -306,17 +306,17 @@ function s() {
|
|
|
306
306
|
done: !0
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
return _.prototype =
|
|
310
|
-
value:
|
|
309
|
+
return _.prototype = m, n(b, "constructor", {
|
|
310
|
+
value: m,
|
|
311
311
|
configurable: !0
|
|
312
|
-
}), n(
|
|
312
|
+
}), n(m, "constructor", {
|
|
313
313
|
value: _,
|
|
314
314
|
configurable: !0
|
|
315
|
-
}), _.displayName = l(
|
|
315
|
+
}), _.displayName = l(m, u, "GeneratorFunction"), e.isGeneratorFunction = function (e) {
|
|
316
316
|
var t = "function" == typeof e && e.constructor;
|
|
317
317
|
return !!t && (t === _ || "GeneratorFunction" === (t.displayName || t.name));
|
|
318
318
|
}, e.mark = function (e) {
|
|
319
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e,
|
|
319
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, m) : (e.__proto__ = m, l(e, u, "GeneratorFunction")), e.prototype = Object.create(b), e;
|
|
320
320
|
}, e.awrap = function (e) {
|
|
321
321
|
return {
|
|
322
322
|
__await: e
|
|
@@ -465,9 +465,9 @@ function l(e) {
|
|
|
465
465
|
var t = f();
|
|
466
466
|
return function () {
|
|
467
467
|
var r,
|
|
468
|
-
n =
|
|
468
|
+
n = m(e);
|
|
469
469
|
if (t) {
|
|
470
|
-
var s =
|
|
470
|
+
var s = m(this).constructor;
|
|
471
471
|
r = Reflect.construct(n, arguments, s);
|
|
472
472
|
} else r = n.apply(this, arguments);
|
|
473
473
|
return function (e, t) {
|
|
@@ -492,7 +492,7 @@ function h(e) {
|
|
|
492
492
|
t.set(e, n);
|
|
493
493
|
}
|
|
494
494
|
function n() {
|
|
495
|
-
return p(e, arguments,
|
|
495
|
+
return p(e, arguments, m(this).constructor);
|
|
496
496
|
}
|
|
497
497
|
return n.prototype = Object.create(e.prototype, {
|
|
498
498
|
constructor: {
|
|
@@ -527,12 +527,12 @@ function _(e, t) {
|
|
|
527
527
|
return e.__proto__ = t, e;
|
|
528
528
|
}, _(e, t);
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
return
|
|
530
|
+
function m(e) {
|
|
531
|
+
return m = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
532
532
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
533
|
-
},
|
|
533
|
+
}, m(e);
|
|
534
534
|
}
|
|
535
|
-
var
|
|
535
|
+
var v,
|
|
536
536
|
y = "https://accounts.google.com/gsi",
|
|
537
537
|
g = "".concat(y, "/client");
|
|
538
538
|
function b(e, t) {
|
|
@@ -571,8 +571,8 @@ function k(e, t, r, n) {
|
|
|
571
571
|
}
|
|
572
572
|
var w = new Uint8Array(16);
|
|
573
573
|
function S() {
|
|
574
|
-
if (!
|
|
575
|
-
return
|
|
574
|
+
if (!v && !(v = "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");
|
|
575
|
+
return v(w);
|
|
576
576
|
}
|
|
577
577
|
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;
|
|
578
578
|
for (var O, C, E, x, A, P, R = [], D = 0; D < 256; ++D) R.push((D + 256).toString(16).substr(1));
|
|
@@ -716,17 +716,18 @@ function z(e, t) {
|
|
|
716
716
|
var Y = function Y(e) {
|
|
717
717
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
718
718
|
};
|
|
719
|
-
var V
|
|
720
|
-
J =
|
|
719
|
+
var V,
|
|
720
|
+
J = ["[Stytch]"],
|
|
721
|
+
$ = function $() {
|
|
721
722
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
722
|
-
return (e = console).warn.apply(e,
|
|
723
|
+
return (e = console).warn.apply(e, J.concat(r));
|
|
723
724
|
},
|
|
724
|
-
|
|
725
|
+
X = function X() {
|
|
725
726
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
726
|
-
return (e = console).error.apply(e,
|
|
727
|
+
return (e = console).error.apply(e, J.concat(r));
|
|
727
728
|
},
|
|
728
|
-
|
|
729
|
-
|
|
729
|
+
Z = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
730
|
+
Q = function Q(t) {
|
|
730
731
|
var r = {
|
|
731
732
|
isObject: function isObject(e, n) {
|
|
732
733
|
var s = "object" === i(n) && !Array.isArray(n) && null !== n;
|
|
@@ -778,13 +779,13 @@ var V = ["[Stytch]"],
|
|
|
778
779
|
};
|
|
779
780
|
return r;
|
|
780
781
|
},
|
|
781
|
-
|
|
782
|
+
ee = function ee(e) {
|
|
782
783
|
return b(e, ["request_id", "status_code"]);
|
|
783
784
|
},
|
|
784
|
-
|
|
785
|
+
te = function te(e) {
|
|
785
786
|
return b(e, ["__user"]);
|
|
786
787
|
},
|
|
787
|
-
|
|
788
|
+
re = a(function e(t, r, n) {
|
|
788
789
|
var i = this;
|
|
789
790
|
c(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
790
791
|
return k(i, void 0, void 0, s().mark(function e() {
|
|
@@ -857,7 +858,7 @@ var V = ["[Stytch]"],
|
|
|
857
858
|
}));
|
|
858
859
|
});
|
|
859
860
|
}),
|
|
860
|
-
|
|
861
|
+
ne = function () {
|
|
861
862
|
function e() {
|
|
862
863
|
c(this, e);
|
|
863
864
|
}
|
|
@@ -903,7 +904,7 @@ var V = ["[Stytch]"],
|
|
|
903
904
|
}
|
|
904
905
|
}]), e;
|
|
905
906
|
}(),
|
|
906
|
-
|
|
907
|
+
ie = function () {
|
|
907
908
|
function e(t) {
|
|
908
909
|
c(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
909
910
|
}
|
|
@@ -949,8 +950,12 @@ var V = ["[Stytch]"],
|
|
|
949
950
|
}));
|
|
950
951
|
}
|
|
951
952
|
}]), e;
|
|
952
|
-
}()
|
|
953
|
-
|
|
953
|
+
}();
|
|
954
|
+
!function (e) {
|
|
955
|
+
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
956
|
+
}(V || (V = {}));
|
|
957
|
+
var se,
|
|
958
|
+
oe = a(function e(t, r) {
|
|
954
959
|
var n = this;
|
|
955
960
|
c(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
956
961
|
return k(n, void 0, void 0, s().mark(function e() {
|
|
@@ -964,7 +969,7 @@ var V = ["[Stytch]"],
|
|
|
964
969
|
method: "GET"
|
|
965
970
|
});
|
|
966
971
|
case 2:
|
|
967
|
-
return t = e.sent, r =
|
|
972
|
+
return t = e.sent, r = ee(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
968
973
|
case 6:
|
|
969
974
|
case "end":
|
|
970
975
|
return e.stop();
|
|
@@ -979,14 +984,14 @@ var V = ["[Stytch]"],
|
|
|
979
984
|
return s().wrap(function (t) {
|
|
980
985
|
for (;;) switch (t.prev = t.next) {
|
|
981
986
|
case 0:
|
|
982
|
-
return
|
|
987
|
+
return Q("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
983
988
|
url: "/users/me",
|
|
984
989
|
body: e,
|
|
985
990
|
errorMessage: "Failed to update user.",
|
|
986
991
|
method: "PUT"
|
|
987
992
|
});
|
|
988
993
|
case 3:
|
|
989
|
-
return r = t.sent, n =
|
|
994
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
990
995
|
case 7:
|
|
991
996
|
case "end":
|
|
992
997
|
return t.stop();
|
|
@@ -1005,7 +1010,7 @@ var V = ["[Stytch]"],
|
|
|
1005
1010
|
method: "DELETE"
|
|
1006
1011
|
});
|
|
1007
1012
|
case 2:
|
|
1008
|
-
return r = t.sent, n =
|
|
1013
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1009
1014
|
case 6:
|
|
1010
1015
|
case "end":
|
|
1011
1016
|
return t.stop();
|
|
@@ -1024,7 +1029,7 @@ var V = ["[Stytch]"],
|
|
|
1024
1029
|
method: "DELETE"
|
|
1025
1030
|
});
|
|
1026
1031
|
case 2:
|
|
1027
|
-
return r = t.sent, n =
|
|
1032
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1028
1033
|
case 6:
|
|
1029
1034
|
case "end":
|
|
1030
1035
|
return t.stop();
|
|
@@ -1043,7 +1048,7 @@ var V = ["[Stytch]"],
|
|
|
1043
1048
|
method: "DELETE"
|
|
1044
1049
|
});
|
|
1045
1050
|
case 2:
|
|
1046
|
-
return r = t.sent, n =
|
|
1051
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1047
1052
|
case 6:
|
|
1048
1053
|
case "end":
|
|
1049
1054
|
return t.stop();
|
|
@@ -1062,7 +1067,7 @@ var V = ["[Stytch]"],
|
|
|
1062
1067
|
method: "DELETE"
|
|
1063
1068
|
});
|
|
1064
1069
|
case 2:
|
|
1065
|
-
return r = t.sent, n =
|
|
1070
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1066
1071
|
case 6:
|
|
1067
1072
|
case "end":
|
|
1068
1073
|
return t.stop();
|
|
@@ -1081,7 +1086,7 @@ var V = ["[Stytch]"],
|
|
|
1081
1086
|
method: "DELETE"
|
|
1082
1087
|
});
|
|
1083
1088
|
case 2:
|
|
1084
|
-
return r = t.sent, n =
|
|
1089
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1085
1090
|
case 6:
|
|
1086
1091
|
case "end":
|
|
1087
1092
|
return t.stop();
|
|
@@ -1100,7 +1105,7 @@ var V = ["[Stytch]"],
|
|
|
1100
1105
|
method: "DELETE"
|
|
1101
1106
|
});
|
|
1102
1107
|
case 2:
|
|
1103
|
-
return r = t.sent, n =
|
|
1108
|
+
return r = t.sent, n = ee(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", te(r));
|
|
1104
1109
|
case 6:
|
|
1105
1110
|
case "end":
|
|
1106
1111
|
return t.stop();
|
|
@@ -1115,7 +1120,7 @@ var V = ["[Stytch]"],
|
|
|
1115
1120
|
});
|
|
1116
1121
|
};
|
|
1117
1122
|
}),
|
|
1118
|
-
|
|
1123
|
+
ae = function () {
|
|
1119
1124
|
function e(t, r) {
|
|
1120
1125
|
var n = this;
|
|
1121
1126
|
c(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
@@ -1170,7 +1175,7 @@ var V = ["[Stytch]"],
|
|
|
1170
1175
|
session_token: n.session_token,
|
|
1171
1176
|
session_jwt: n.session_jwt,
|
|
1172
1177
|
intermediate_session_token: null
|
|
1173
|
-
}), t.abrupt("return",
|
|
1178
|
+
}), t.abrupt("return", te(n));
|
|
1174
1179
|
case 9:
|
|
1175
1180
|
throw t.prev = 9, t.t0 = t["catch"](0), W.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
|
|
1176
1181
|
case 13:
|
|
@@ -1192,14 +1197,110 @@ var V = ["[Stytch]"],
|
|
|
1192
1197
|
this._subscriptionService.updateTokens(e);
|
|
1193
1198
|
}
|
|
1194
1199
|
}]), e;
|
|
1195
|
-
}()
|
|
1196
|
-
|
|
1200
|
+
}();
|
|
1201
|
+
!function (e) {
|
|
1202
|
+
e.RequiredCatcha = "Catcha Required";
|
|
1203
|
+
}(se || (se = {}));
|
|
1204
|
+
var ce = function (e) {
|
|
1205
|
+
u(r, h(Error));
|
|
1206
|
+
var t = l(r);
|
|
1207
|
+
function r(e) {
|
|
1208
|
+
var n;
|
|
1209
|
+
return c(this, r), (n = t.call(this, e)).type = e, n;
|
|
1210
|
+
}
|
|
1211
|
+
return a(r);
|
|
1212
|
+
}();
|
|
1213
|
+
function ue(e) {
|
|
1214
|
+
var t = e.method,
|
|
1215
|
+
r = e.errorMessage,
|
|
1216
|
+
n = e.finalURL,
|
|
1217
|
+
i = e.basicAuthHeader,
|
|
1218
|
+
o = e.xSDKClientHeader,
|
|
1219
|
+
a = e.xSDKParentHostHeader,
|
|
1220
|
+
c = e.body;
|
|
1221
|
+
return k(this, void 0, void 0, s().mark(function e() {
|
|
1222
|
+
var u, l, d, h, p, f;
|
|
1223
|
+
return s().wrap(function (e) {
|
|
1224
|
+
for (;;) switch (e.prev = e.next) {
|
|
1225
|
+
case 0:
|
|
1226
|
+
return u = {
|
|
1227
|
+
Authorization: i,
|
|
1228
|
+
"Content-Type": "application/json",
|
|
1229
|
+
"X-SDK-Client": o
|
|
1230
|
+
}, a && (u["X-SDK-Parent-Host"] = a), l = {
|
|
1231
|
+
method: t,
|
|
1232
|
+
headers: u,
|
|
1233
|
+
body: c && JSON.stringify(c)
|
|
1234
|
+
}, e.prev = 3, e.next = 6, fetch(n, l);
|
|
1235
|
+
case 6:
|
|
1236
|
+
d = e.sent, e.next = 14;
|
|
1237
|
+
break;
|
|
1238
|
+
case 9:
|
|
1239
|
+
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
1240
|
+
e.next = 13;
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
throw new F(r, "Unable to contact the Stytch servers. Are you online?");
|
|
1244
|
+
case 13:
|
|
1245
|
+
throw e.t0;
|
|
1246
|
+
case 14:
|
|
1247
|
+
if (403 !== d.status) {
|
|
1248
|
+
e.next = 27;
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
return e.prev = 15, e.next = 18, d.text();
|
|
1252
|
+
case 18:
|
|
1253
|
+
h = e.sent, e.next = 24;
|
|
1254
|
+
break;
|
|
1255
|
+
case 21:
|
|
1256
|
+
throw e.prev = 21, e.t1 = e["catch"](15), new F(r, "Invalid response from the Stytch servers.");
|
|
1257
|
+
case 24:
|
|
1258
|
+
if (!h.includes("Captcha required")) {
|
|
1259
|
+
e.next = 26;
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
throw new ce(se.RequiredCatcha);
|
|
1263
|
+
case 26:
|
|
1264
|
+
throw new F(r, "Invalid response from the Stytch servers.");
|
|
1265
|
+
case 27:
|
|
1266
|
+
if (200 === d.status) {
|
|
1267
|
+
e.next = 40;
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
return e.prev = 28, e.next = 31, d.json();
|
|
1271
|
+
case 31:
|
|
1272
|
+
p = e.sent, e.next = 37;
|
|
1273
|
+
break;
|
|
1274
|
+
case 34:
|
|
1275
|
+
throw e.prev = 34, e.t2 = e["catch"](28), new F(r, "Invalid or no response from server");
|
|
1276
|
+
case 37:
|
|
1277
|
+
if (!("body" in p || "params" in p || "query" in p)) {
|
|
1278
|
+
e.next = 39;
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
throw new K(p);
|
|
1282
|
+
case 39:
|
|
1283
|
+
throw new q(p);
|
|
1284
|
+
case 40:
|
|
1285
|
+
return e.prev = 40, e.next = 43, d.json();
|
|
1286
|
+
case 43:
|
|
1287
|
+
return f = e.sent, e.abrupt("return", f.data);
|
|
1288
|
+
case 47:
|
|
1289
|
+
throw e.prev = 47, e.t3 = e["catch"](40), new F(r, "Invalid response from the Stytch servers.");
|
|
1290
|
+
case 50:
|
|
1291
|
+
case "end":
|
|
1292
|
+
return e.stop();
|
|
1293
|
+
}
|
|
1294
|
+
}, e, null, [[3, 9], [15, 21], [28, 34], [40, 47]]);
|
|
1295
|
+
}));
|
|
1296
|
+
}
|
|
1297
|
+
var le = Promise.resolve({
|
|
1197
1298
|
pkceRequiredForEmailMagicLinks: !1
|
|
1198
1299
|
}),
|
|
1199
|
-
|
|
1300
|
+
de = function () {
|
|
1200
1301
|
function e(t, r, n, i) {
|
|
1201
1302
|
var o = this,
|
|
1202
|
-
a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1303
|
+
a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : le,
|
|
1203
1304
|
u = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : function () {
|
|
1204
1305
|
return Promise.resolve(void 0);
|
|
1205
1306
|
},
|
|
@@ -1218,7 +1319,7 @@ var V = ["[Stytch]"],
|
|
|
1218
1319
|
case 5:
|
|
1219
1320
|
r.t0 = r.sent;
|
|
1220
1321
|
case 6:
|
|
1221
|
-
if (i = r.t0, e.type !==
|
|
1322
|
+
if (i = r.t0, e.type !== se.RequiredCatcha || !i) {
|
|
1222
1323
|
r.next = 16;
|
|
1223
1324
|
break;
|
|
1224
1325
|
}
|
|
@@ -1324,7 +1425,7 @@ var V = ["[Stytch]"],
|
|
|
1324
1425
|
return s().wrap(function (r) {
|
|
1325
1426
|
for (;;) switch (r.prev = r.next) {
|
|
1326
1427
|
case 0:
|
|
1327
|
-
return
|
|
1428
|
+
return Q("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1328
1429
|
case 3:
|
|
1329
1430
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1330
1431
|
r.next = 19;
|
|
@@ -1364,7 +1465,7 @@ var V = ["[Stytch]"],
|
|
|
1364
1465
|
session_token: i.session_token,
|
|
1365
1466
|
session_jwt: i.session_jwt,
|
|
1366
1467
|
intermediate_session_token: null
|
|
1367
|
-
}), r.abrupt("return",
|
|
1468
|
+
}), r.abrupt("return", te(i));
|
|
1368
1469
|
case 25:
|
|
1369
1470
|
case "end":
|
|
1370
1471
|
return r.stop();
|
|
@@ -1468,7 +1569,7 @@ var V = ["[Stytch]"],
|
|
|
1468
1569
|
}
|
|
1469
1570
|
}]), e;
|
|
1470
1571
|
}(),
|
|
1471
|
-
|
|
1572
|
+
he = a(function e(t, r) {
|
|
1472
1573
|
var n = this,
|
|
1473
1574
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1474
1575
|
return Promise.resolve(void 0);
|
|
@@ -1626,7 +1727,7 @@ var V = ["[Stytch]"],
|
|
|
1626
1727
|
return s().wrap(function (n) {
|
|
1627
1728
|
for (;;) switch (n.prev = n.next) {
|
|
1628
1729
|
case 0:
|
|
1629
|
-
return
|
|
1730
|
+
return Q("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), i = Object.assign({
|
|
1630
1731
|
token: e,
|
|
1631
1732
|
method_id: t
|
|
1632
1733
|
}, r), n.next = 4, this._networkClient.fetchSDK({
|
|
@@ -1644,7 +1745,7 @@ var V = ["[Stytch]"],
|
|
|
1644
1745
|
session_token: o.session_token,
|
|
1645
1746
|
session_jwt: o.session_jwt,
|
|
1646
1747
|
intermediate_session_token: null
|
|
1647
|
-
}), n.abrupt("return",
|
|
1748
|
+
}), n.abrupt("return", te(o));
|
|
1648
1749
|
case 7:
|
|
1649
1750
|
case "end":
|
|
1650
1751
|
return n.stop();
|
|
@@ -1653,7 +1754,7 @@ var V = ["[Stytch]"],
|
|
|
1653
1754
|
}));
|
|
1654
1755
|
};
|
|
1655
1756
|
}),
|
|
1656
|
-
|
|
1757
|
+
pe = function () {
|
|
1657
1758
|
function e(t, r, n, i, s) {
|
|
1658
1759
|
c(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = s, this.google = {
|
|
1659
1760
|
start: this.startOAuthFlow(C.Google)
|
|
@@ -1703,9 +1804,9 @@ var V = ["[Stytch]"],
|
|
|
1703
1804
|
return s().wrap(function (r) {
|
|
1704
1805
|
for (;;) switch (r.prev = r.next) {
|
|
1705
1806
|
case 0:
|
|
1706
|
-
return
|
|
1807
|
+
return Q("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
1707
1808
|
case 3:
|
|
1708
|
-
return (n = r.sent) ||
|
|
1809
|
+
return (n = r.sent) || $("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({
|
|
1709
1810
|
url: "/oauth/authenticate",
|
|
1710
1811
|
method: "POST",
|
|
1711
1812
|
body: Object.assign({
|
|
@@ -1718,12 +1819,12 @@ var V = ["[Stytch]"],
|
|
|
1718
1819
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1719
1820
|
state: {
|
|
1720
1821
|
session: i.session,
|
|
1721
|
-
user:
|
|
1822
|
+
user: ee(i.__user)
|
|
1722
1823
|
},
|
|
1723
1824
|
session_token: i.session_token,
|
|
1724
1825
|
session_jwt: i.session_jwt,
|
|
1725
1826
|
intermediate_session_token: null
|
|
1726
|
-
}), r.abrupt("return",
|
|
1827
|
+
}), r.abrupt("return", te(i));
|
|
1727
1828
|
case 11:
|
|
1728
1829
|
case "end":
|
|
1729
1830
|
return r.stop();
|
|
@@ -1798,7 +1899,7 @@ var V = ["[Stytch]"],
|
|
|
1798
1899
|
case 18:
|
|
1799
1900
|
this._pkceManager.clearPKPair();
|
|
1800
1901
|
case 19:
|
|
1801
|
-
o && (
|
|
1902
|
+
o && (Q("startOAuthFlow").isStringArray("custom_scopes", o), l.searchParams.set("custom_scopes", o.join(" "))), n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
1802
1903
|
case 23:
|
|
1803
1904
|
case "end":
|
|
1804
1905
|
return t.stop();
|
|
@@ -1809,7 +1910,7 @@ var V = ["[Stytch]"],
|
|
|
1809
1910
|
}
|
|
1810
1911
|
}]), e;
|
|
1811
1912
|
}(),
|
|
1812
|
-
|
|
1913
|
+
fe = function () {
|
|
1813
1914
|
function e(t, r) {
|
|
1814
1915
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1815
1916
|
return Promise.resolve(void 0);
|
|
@@ -1824,7 +1925,7 @@ var V = ["[Stytch]"],
|
|
|
1824
1925
|
return s().wrap(function (t) {
|
|
1825
1926
|
for (;;) switch (t.prev = t.next) {
|
|
1826
1927
|
case 0:
|
|
1827
|
-
return
|
|
1928
|
+
return Q("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();
|
|
1828
1929
|
case 4:
|
|
1829
1930
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
1830
1931
|
url: i,
|
|
@@ -1851,7 +1952,7 @@ var V = ["[Stytch]"],
|
|
|
1851
1952
|
return s().wrap(function (t) {
|
|
1852
1953
|
for (;;) switch (t.prev = t.next) {
|
|
1853
1954
|
case 0:
|
|
1854
|
-
return
|
|
1955
|
+
return Q("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._networkClient.fetchSDK({
|
|
1855
1956
|
url: "/crypto_wallets/authenticate",
|
|
1856
1957
|
method: "POST",
|
|
1857
1958
|
errorMessage: "Failed to authenticate.",
|
|
@@ -1866,12 +1967,12 @@ var V = ["[Stytch]"],
|
|
|
1866
1967
|
return r = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
1867
1968
|
state: {
|
|
1868
1969
|
session: r.session,
|
|
1869
|
-
user:
|
|
1970
|
+
user: ee(r.__user)
|
|
1870
1971
|
},
|
|
1871
1972
|
session_token: r.session_token,
|
|
1872
1973
|
session_jwt: r.session_jwt,
|
|
1873
1974
|
intermediate_session_token: null
|
|
1874
|
-
}), t.abrupt("return",
|
|
1975
|
+
}), t.abrupt("return", te(r));
|
|
1875
1976
|
case 6:
|
|
1876
1977
|
case "end":
|
|
1877
1978
|
return t.stop();
|
|
@@ -1881,7 +1982,7 @@ var V = ["[Stytch]"],
|
|
|
1881
1982
|
}
|
|
1882
1983
|
}]), e;
|
|
1883
1984
|
}(),
|
|
1884
|
-
|
|
1985
|
+
_e = function () {
|
|
1885
1986
|
function e(t, r) {
|
|
1886
1987
|
c(this, e), this._networkClient = t, this._subscriptionService = r;
|
|
1887
1988
|
}
|
|
@@ -1893,7 +1994,7 @@ var V = ["[Stytch]"],
|
|
|
1893
1994
|
return s().wrap(function (t) {
|
|
1894
1995
|
for (;;) switch (t.prev = t.next) {
|
|
1895
1996
|
case 0:
|
|
1896
|
-
return
|
|
1997
|
+
return Q("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
1897
1998
|
url: "/totps",
|
|
1898
1999
|
method: "POST",
|
|
1899
2000
|
errorMessage: "Failed to create TOTP",
|
|
@@ -1902,7 +2003,7 @@ var V = ["[Stytch]"],
|
|
|
1902
2003
|
}
|
|
1903
2004
|
});
|
|
1904
2005
|
case 3:
|
|
1905
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2006
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", te(r));
|
|
1906
2007
|
case 6:
|
|
1907
2008
|
case "end":
|
|
1908
2009
|
return t.stop();
|
|
@@ -1918,7 +2019,7 @@ var V = ["[Stytch]"],
|
|
|
1918
2019
|
return s().wrap(function (t) {
|
|
1919
2020
|
for (;;) switch (t.prev = t.next) {
|
|
1920
2021
|
case 0:
|
|
1921
|
-
return
|
|
2022
|
+
return Q("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this._networkClient.fetchSDK({
|
|
1922
2023
|
url: "/totps/authenticate",
|
|
1923
2024
|
method: "POST",
|
|
1924
2025
|
errorMessage: "Failed to authenticate TOTP",
|
|
@@ -1936,7 +2037,7 @@ var V = ["[Stytch]"],
|
|
|
1936
2037
|
session_token: r.session_token,
|
|
1937
2038
|
session_jwt: r.session_jwt,
|
|
1938
2039
|
intermediate_session_token: null
|
|
1939
|
-
}), t.abrupt("return",
|
|
2040
|
+
}), t.abrupt("return", te(r));
|
|
1940
2041
|
case 6:
|
|
1941
2042
|
case "end":
|
|
1942
2043
|
return t.stop();
|
|
@@ -1971,7 +2072,7 @@ var V = ["[Stytch]"],
|
|
|
1971
2072
|
return s().wrap(function (t) {
|
|
1972
2073
|
for (;;) switch (t.prev = t.next) {
|
|
1973
2074
|
case 0:
|
|
1974
|
-
return
|
|
2075
|
+
return Q("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this._networkClient.fetchSDK({
|
|
1975
2076
|
url: "/totps/recover",
|
|
1976
2077
|
method: "POST",
|
|
1977
2078
|
errorMessage: "Failed to recover TOTP",
|
|
@@ -1989,7 +2090,7 @@ var V = ["[Stytch]"],
|
|
|
1989
2090
|
session_token: r.session_token,
|
|
1990
2091
|
session_jwt: r.session_jwt,
|
|
1991
2092
|
intermediate_session_token: null
|
|
1992
|
-
}), t.abrupt("return",
|
|
2093
|
+
}), t.abrupt("return", te(r));
|
|
1993
2094
|
case 6:
|
|
1994
2095
|
case "end":
|
|
1995
2096
|
return t.stop();
|
|
@@ -1999,11 +2100,11 @@ var V = ["[Stytch]"],
|
|
|
1999
2100
|
}
|
|
2000
2101
|
}]), e;
|
|
2001
2102
|
}();
|
|
2002
|
-
function
|
|
2103
|
+
function me(e) {
|
|
2003
2104
|
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), s = new Uint8Array(i), o = 0; o < n.length; o++) s[o] = n.charCodeAt(o);
|
|
2004
2105
|
return i;
|
|
2005
2106
|
}
|
|
2006
|
-
function
|
|
2107
|
+
function ve(t) {
|
|
2007
2108
|
var r,
|
|
2008
2109
|
n = "",
|
|
2009
2110
|
i = e(new Uint8Array(t));
|
|
@@ -2019,13 +2120,13 @@ function pe(t) {
|
|
|
2019
2120
|
}
|
|
2020
2121
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2021
2122
|
}
|
|
2022
|
-
var
|
|
2023
|
-
|
|
2024
|
-
function
|
|
2025
|
-
if (r ===
|
|
2026
|
-
if (r ===
|
|
2123
|
+
var ye = "copy",
|
|
2124
|
+
ge = "convert";
|
|
2125
|
+
function be(e, r, n) {
|
|
2126
|
+
if (r === ye) return n;
|
|
2127
|
+
if (r === ge) return e(n);
|
|
2027
2128
|
if (r instanceof Array) return n.map(function (t) {
|
|
2028
|
-
return
|
|
2129
|
+
return be(e, r[0], t);
|
|
2029
2130
|
});
|
|
2030
2131
|
if (r instanceof Object) {
|
|
2031
2132
|
for (var i = {}, s = 0, o = Object.entries(r); s < o.length; s++) {
|
|
@@ -2036,122 +2137,122 @@ function ve(e, r, n) {
|
|
|
2036
2137
|
var l = u.derive(n);
|
|
2037
2138
|
void 0 !== l && (n[c] = l);
|
|
2038
2139
|
}
|
|
2039
|
-
if (c in n) null != n[c] ? i[c] =
|
|
2140
|
+
if (c in n) null != n[c] ? i[c] = be(e, u.schema, n[c]) : i[c] = null;else if (u.required) throw new Error("Missing key: ".concat(c));
|
|
2040
2141
|
}
|
|
2041
2142
|
return i;
|
|
2042
2143
|
}
|
|
2043
2144
|
}
|
|
2044
|
-
function
|
|
2145
|
+
function ke(e, t) {
|
|
2045
2146
|
return {
|
|
2046
2147
|
required: !0,
|
|
2047
2148
|
schema: e,
|
|
2048
2149
|
derive: t
|
|
2049
2150
|
};
|
|
2050
2151
|
}
|
|
2051
|
-
function
|
|
2152
|
+
function we(e) {
|
|
2052
2153
|
return {
|
|
2053
2154
|
required: !0,
|
|
2054
2155
|
schema: e
|
|
2055
2156
|
};
|
|
2056
2157
|
}
|
|
2057
|
-
function
|
|
2158
|
+
function Se(e) {
|
|
2058
2159
|
return {
|
|
2059
2160
|
required: !1,
|
|
2060
2161
|
schema: e
|
|
2061
2162
|
};
|
|
2062
2163
|
}
|
|
2063
|
-
var
|
|
2064
|
-
type: ye
|
|
2065
|
-
id:
|
|
2066
|
-
transports:
|
|
2164
|
+
var Te = {
|
|
2165
|
+
type: we(ye),
|
|
2166
|
+
id: we(ge),
|
|
2167
|
+
transports: Se(ye)
|
|
2067
2168
|
},
|
|
2068
|
-
|
|
2069
|
-
appid:
|
|
2070
|
-
appidExclude:
|
|
2071
|
-
credProps:
|
|
2169
|
+
Oe = {
|
|
2170
|
+
appid: Se(ye),
|
|
2171
|
+
appidExclude: Se(ye),
|
|
2172
|
+
credProps: Se(ye)
|
|
2072
2173
|
},
|
|
2073
|
-
|
|
2074
|
-
appid:
|
|
2075
|
-
appidExclude:
|
|
2076
|
-
credProps:
|
|
2174
|
+
Ce = {
|
|
2175
|
+
appid: Se(ye),
|
|
2176
|
+
appidExclude: Se(ye),
|
|
2177
|
+
credProps: Se(ye)
|
|
2077
2178
|
},
|
|
2078
|
-
|
|
2079
|
-
publicKey:
|
|
2080
|
-
rp: ye
|
|
2081
|
-
user:
|
|
2082
|
-
id:
|
|
2083
|
-
name: ye
|
|
2084
|
-
displayName: ye
|
|
2179
|
+
Ee = {
|
|
2180
|
+
publicKey: we({
|
|
2181
|
+
rp: we(ye),
|
|
2182
|
+
user: we({
|
|
2183
|
+
id: we(ge),
|
|
2184
|
+
name: we(ye),
|
|
2185
|
+
displayName: we(ye)
|
|
2085
2186
|
}),
|
|
2086
|
-
challenge:
|
|
2087
|
-
pubKeyCredParams: ye
|
|
2088
|
-
timeout:
|
|
2089
|
-
excludeCredentials:
|
|
2090
|
-
authenticatorSelection:
|
|
2091
|
-
attestation:
|
|
2092
|
-
extensions:
|
|
2187
|
+
challenge: we(ge),
|
|
2188
|
+
pubKeyCredParams: we(ye),
|
|
2189
|
+
timeout: Se(ye),
|
|
2190
|
+
excludeCredentials: Se([Te]),
|
|
2191
|
+
authenticatorSelection: Se(ye),
|
|
2192
|
+
attestation: Se(ye),
|
|
2193
|
+
extensions: Se(Oe)
|
|
2093
2194
|
}),
|
|
2094
|
-
signal:
|
|
2195
|
+
signal: Se(ye)
|
|
2095
2196
|
},
|
|
2096
|
-
|
|
2097
|
-
type: ye
|
|
2098
|
-
id: ye
|
|
2099
|
-
rawId:
|
|
2100
|
-
authenticatorAttachment:
|
|
2101
|
-
response:
|
|
2102
|
-
clientDataJSON:
|
|
2103
|
-
attestationObject:
|
|
2104
|
-
transports:
|
|
2197
|
+
xe = {
|
|
2198
|
+
type: we(ye),
|
|
2199
|
+
id: we(ye),
|
|
2200
|
+
rawId: we(ge),
|
|
2201
|
+
authenticatorAttachment: Se(ye),
|
|
2202
|
+
response: we({
|
|
2203
|
+
clientDataJSON: we(ge),
|
|
2204
|
+
attestationObject: we(ge),
|
|
2205
|
+
transports: ke(ye, function (e) {
|
|
2105
2206
|
var t;
|
|
2106
2207
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2107
2208
|
})
|
|
2108
2209
|
}),
|
|
2109
|
-
clientExtensionResults:
|
|
2210
|
+
clientExtensionResults: ke(Ce, function (e) {
|
|
2110
2211
|
return e.getClientExtensionResults();
|
|
2111
2212
|
})
|
|
2112
2213
|
},
|
|
2113
|
-
|
|
2114
|
-
mediation:
|
|
2115
|
-
publicKey:
|
|
2116
|
-
challenge:
|
|
2117
|
-
timeout:
|
|
2118
|
-
rpId:
|
|
2119
|
-
allowCredentials:
|
|
2120
|
-
userVerification:
|
|
2121
|
-
extensions:
|
|
2214
|
+
Ae = {
|
|
2215
|
+
mediation: Se(ye),
|
|
2216
|
+
publicKey: we({
|
|
2217
|
+
challenge: we(ge),
|
|
2218
|
+
timeout: Se(ye),
|
|
2219
|
+
rpId: Se(ye),
|
|
2220
|
+
allowCredentials: Se([Te]),
|
|
2221
|
+
userVerification: Se(ye),
|
|
2222
|
+
extensions: Se(Oe)
|
|
2122
2223
|
}),
|
|
2123
|
-
signal:
|
|
2224
|
+
signal: Se(ye)
|
|
2124
2225
|
},
|
|
2125
|
-
|
|
2126
|
-
type: ye
|
|
2127
|
-
id: ye
|
|
2128
|
-
rawId:
|
|
2129
|
-
authenticatorAttachment:
|
|
2130
|
-
response:
|
|
2131
|
-
clientDataJSON:
|
|
2132
|
-
authenticatorData:
|
|
2133
|
-
signature:
|
|
2134
|
-
userHandle:
|
|
2226
|
+
Pe = {
|
|
2227
|
+
type: we(ye),
|
|
2228
|
+
id: we(ye),
|
|
2229
|
+
rawId: we(ge),
|
|
2230
|
+
authenticatorAttachment: Se(ye),
|
|
2231
|
+
response: we({
|
|
2232
|
+
clientDataJSON: we(ge),
|
|
2233
|
+
authenticatorData: we(ge),
|
|
2234
|
+
signature: we(ge),
|
|
2235
|
+
userHandle: we(ge)
|
|
2135
2236
|
}),
|
|
2136
|
-
clientExtensionResults:
|
|
2237
|
+
clientExtensionResults: ke(Ce, function (e) {
|
|
2137
2238
|
return e.getClientExtensionResults();
|
|
2138
2239
|
})
|
|
2139
2240
|
};
|
|
2140
|
-
function
|
|
2141
|
-
return
|
|
2241
|
+
function Re(e) {
|
|
2242
|
+
return be(me, Ee, e);
|
|
2142
2243
|
}
|
|
2143
|
-
function
|
|
2144
|
-
return ve
|
|
2244
|
+
function De(e) {
|
|
2245
|
+
return be(ve, xe, e);
|
|
2145
2246
|
}
|
|
2146
|
-
function
|
|
2247
|
+
function Be(e) {
|
|
2147
2248
|
return k(this, void 0, void 0, s().mark(function t() {
|
|
2148
2249
|
var r;
|
|
2149
2250
|
return s().wrap(function (t) {
|
|
2150
2251
|
for (;;) switch (t.prev = t.next) {
|
|
2151
2252
|
case 0:
|
|
2152
|
-
return t.next = 2, navigator.credentials.create(
|
|
2253
|
+
return t.next = 2, navigator.credentials.create(Re(e));
|
|
2153
2254
|
case 2:
|
|
2154
|
-
return r = t.sent, t.abrupt("return",
|
|
2255
|
+
return r = t.sent, t.abrupt("return", De(r));
|
|
2155
2256
|
case 4:
|
|
2156
2257
|
case "end":
|
|
2157
2258
|
return t.stop();
|
|
@@ -2159,21 +2260,21 @@ function Ae(e) {
|
|
|
2159
2260
|
}, t);
|
|
2160
2261
|
}));
|
|
2161
2262
|
}
|
|
2162
|
-
function
|
|
2163
|
-
return
|
|
2263
|
+
function Ie(e) {
|
|
2264
|
+
return be(me, Ae, e);
|
|
2164
2265
|
}
|
|
2165
|
-
function
|
|
2166
|
-
return ve
|
|
2266
|
+
function Le(e) {
|
|
2267
|
+
return be(ve, Pe, e);
|
|
2167
2268
|
}
|
|
2168
|
-
function
|
|
2269
|
+
function je(e) {
|
|
2169
2270
|
return k(this, void 0, void 0, s().mark(function t() {
|
|
2170
2271
|
var r;
|
|
2171
2272
|
return s().wrap(function (t) {
|
|
2172
2273
|
for (;;) switch (t.prev = t.next) {
|
|
2173
2274
|
case 0:
|
|
2174
|
-
return t.next = 2, navigator.credentials.get(
|
|
2275
|
+
return t.next = 2, navigator.credentials.get(Ie(e));
|
|
2175
2276
|
case 2:
|
|
2176
|
-
return r = t.sent, t.abrupt("return",
|
|
2277
|
+
return r = t.sent, t.abrupt("return", Le(r));
|
|
2177
2278
|
case 4:
|
|
2178
2279
|
case "end":
|
|
2179
2280
|
return t.stop();
|
|
@@ -2181,8 +2282,7 @@ function De(e) {
|
|
|
2181
2282
|
}, t);
|
|
2182
2283
|
}));
|
|
2183
2284
|
}
|
|
2184
|
-
var
|
|
2185
|
-
Ie = function () {
|
|
2285
|
+
var Me = function () {
|
|
2186
2286
|
function e(t, r) {
|
|
2187
2287
|
c(this, e), this._networkClient = t, this._subscriptionService = r;
|
|
2188
2288
|
}
|
|
@@ -2195,7 +2295,7 @@ var Be,
|
|
|
2195
2295
|
return s().wrap(function (r) {
|
|
2196
2296
|
for (;;) switch (r.prev = r.next) {
|
|
2197
2297
|
case 0:
|
|
2198
|
-
return
|
|
2298
|
+
return Q("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({
|
|
2199
2299
|
url: "/webauthn/register/start",
|
|
2200
2300
|
method: "POST",
|
|
2201
2301
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2205,7 +2305,7 @@ var Be,
|
|
|
2205
2305
|
}
|
|
2206
2306
|
});
|
|
2207
2307
|
case 3:
|
|
2208
|
-
return n = r.sent, i = n.public_key_credential_creation_options, r.next = 7,
|
|
2308
|
+
return n = r.sent, i = n.public_key_credential_creation_options, r.next = 7, Be({
|
|
2209
2309
|
publicKey: JSON.parse(i)
|
|
2210
2310
|
});
|
|
2211
2311
|
case 7:
|
|
@@ -2218,7 +2318,7 @@ var Be,
|
|
|
2218
2318
|
}
|
|
2219
2319
|
});
|
|
2220
2320
|
case 10:
|
|
2221
|
-
return a = r.sent, this._subscriptionService.updateUser(a.__user), r.abrupt("return",
|
|
2321
|
+
return a = r.sent, this._subscriptionService.updateUser(a.__user), r.abrupt("return", te(a));
|
|
2222
2322
|
case 13:
|
|
2223
2323
|
case "end":
|
|
2224
2324
|
return r.stop();
|
|
@@ -2235,7 +2335,7 @@ var Be,
|
|
|
2235
2335
|
return s().wrap(function (r) {
|
|
2236
2336
|
for (;;) switch (r.prev = r.next) {
|
|
2237
2337
|
case 0:
|
|
2238
|
-
return
|
|
2338
|
+
return Q("stytch.webauthn.register").isOptionalString("domain", e.domain).isNumber("session_duration_minutes", e.session_duration_minutes), r.next = 3, this._networkClient.fetchSDK({
|
|
2239
2339
|
url: "/webauthn/authenticate/start",
|
|
2240
2340
|
method: "POST",
|
|
2241
2341
|
errorMessage: "Failed to start WebAuthn authentication",
|
|
@@ -2244,7 +2344,7 @@ var Be,
|
|
|
2244
2344
|
}
|
|
2245
2345
|
});
|
|
2246
2346
|
case 3:
|
|
2247
|
-
return n = r.sent, i = n.public_key_credential_request_options, r.next = 7,
|
|
2347
|
+
return n = r.sent, i = n.public_key_credential_request_options, r.next = 7, je({
|
|
2248
2348
|
publicKey: JSON.parse(i)
|
|
2249
2349
|
});
|
|
2250
2350
|
case 7:
|
|
@@ -2266,7 +2366,7 @@ var Be,
|
|
|
2266
2366
|
session_token: a.session_token,
|
|
2267
2367
|
session_jwt: a.session_jwt,
|
|
2268
2368
|
intermediate_session_token: null
|
|
2269
|
-
}), r.abrupt("return",
|
|
2369
|
+
}), r.abrupt("return", te(a));
|
|
2270
2370
|
case 13:
|
|
2271
2371
|
case "end":
|
|
2272
2372
|
return r.stop();
|
|
@@ -2276,13 +2376,13 @@ var Be,
|
|
|
2276
2376
|
}
|
|
2277
2377
|
}]), e;
|
|
2278
2378
|
}(),
|
|
2279
|
-
|
|
2379
|
+
Ne = Promise.resolve({
|
|
2280
2380
|
pkceRequiredForPasswordResets: !1
|
|
2281
2381
|
}),
|
|
2282
|
-
|
|
2382
|
+
Fe = function () {
|
|
2283
2383
|
function e(t, r, n) {
|
|
2284
2384
|
var i = this,
|
|
2285
|
-
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2385
|
+
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Ne,
|
|
2286
2386
|
a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : function () {
|
|
2287
2387
|
return Promise.resolve(void 0);
|
|
2288
2388
|
},
|
|
@@ -2301,7 +2401,7 @@ var Be,
|
|
|
2301
2401
|
case 5:
|
|
2302
2402
|
r.t0 = r.sent;
|
|
2303
2403
|
case 6:
|
|
2304
|
-
if (i = r.t0, e.type !==
|
|
2404
|
+
if (i = r.t0, e.type !== se.RequiredCatcha || !i) {
|
|
2305
2405
|
r.next = 16;
|
|
2306
2406
|
break;
|
|
2307
2407
|
}
|
|
@@ -2408,7 +2508,7 @@ var Be,
|
|
|
2408
2508
|
return s().wrap(function (t) {
|
|
2409
2509
|
for (;;) switch (t.prev = t.next) {
|
|
2410
2510
|
case 0:
|
|
2411
|
-
return
|
|
2511
|
+
return Q("stytch.passwords.create").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.getDFPTelemetryIDAndCaptcha();
|
|
2412
2512
|
case 3:
|
|
2413
2513
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2414
2514
|
url: "/passwords",
|
|
@@ -2432,7 +2532,7 @@ var Be,
|
|
|
2432
2532
|
session_token: o.session_token,
|
|
2433
2533
|
session_jwt: o.session_jwt,
|
|
2434
2534
|
intermediate_session_token: null
|
|
2435
|
-
}), t.abrupt("return",
|
|
2535
|
+
}), t.abrupt("return", te(o));
|
|
2436
2536
|
case 11:
|
|
2437
2537
|
case "end":
|
|
2438
2538
|
return t.stop();
|
|
@@ -2448,7 +2548,7 @@ var Be,
|
|
|
2448
2548
|
return s().wrap(function (t) {
|
|
2449
2549
|
for (;;) switch (t.prev = t.next) {
|
|
2450
2550
|
case 0:
|
|
2451
|
-
return
|
|
2551
|
+
return Q("stytch.passwords.authenticate").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.getDFPTelemetryIDAndCaptcha();
|
|
2452
2552
|
case 3:
|
|
2453
2553
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2454
2554
|
url: "/passwords/authenticate",
|
|
@@ -2472,7 +2572,7 @@ var Be,
|
|
|
2472
2572
|
session_token: o.session_token,
|
|
2473
2573
|
session_jwt: o.session_jwt,
|
|
2474
2574
|
intermediate_session_token: null
|
|
2475
|
-
}), t.abrupt("return",
|
|
2575
|
+
}), t.abrupt("return", te(o));
|
|
2476
2576
|
case 11:
|
|
2477
2577
|
case "end":
|
|
2478
2578
|
return t.stop();
|
|
@@ -2488,7 +2588,7 @@ var Be,
|
|
|
2488
2588
|
return s().wrap(function (t) {
|
|
2489
2589
|
for (;;) switch (t.prev = t.next) {
|
|
2490
2590
|
case 0:
|
|
2491
|
-
return
|
|
2591
|
+
return Q("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();
|
|
2492
2592
|
case 3:
|
|
2493
2593
|
return r = t.sent, t.next = 6, this.getDFPTelemetryIDAndCaptcha();
|
|
2494
2594
|
case 6:
|
|
@@ -2523,7 +2623,7 @@ var Be,
|
|
|
2523
2623
|
return s().wrap(function (t) {
|
|
2524
2624
|
for (;;) switch (t.prev = t.next) {
|
|
2525
2625
|
case 0:
|
|
2526
|
-
return
|
|
2626
|
+
return Q("stytch.passwords.resetByEmail").isString("token", e.token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.getDFPTelemetryIDAndCaptcha();
|
|
2527
2627
|
case 3:
|
|
2528
2628
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2529
2629
|
case 8:
|
|
@@ -2550,7 +2650,7 @@ var Be,
|
|
|
2550
2650
|
session_token: c.session_token,
|
|
2551
2651
|
session_jwt: c.session_jwt,
|
|
2552
2652
|
intermediate_session_token: null
|
|
2553
|
-
}), t.abrupt("return",
|
|
2653
|
+
}), t.abrupt("return", te(c));
|
|
2554
2654
|
case 16:
|
|
2555
2655
|
case "end":
|
|
2556
2656
|
return t.stop();
|
|
@@ -2566,7 +2666,7 @@ var Be,
|
|
|
2566
2666
|
return s().wrap(function (t) {
|
|
2567
2667
|
for (;;) switch (t.prev = t.next) {
|
|
2568
2668
|
case 0:
|
|
2569
|
-
return
|
|
2669
|
+
return Q("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._networkClient.fetchSDK({
|
|
2570
2670
|
url: "/passwords/existing_password/reset",
|
|
2571
2671
|
method: "POST",
|
|
2572
2672
|
errorMessage: "Failed to reset password.",
|
|
@@ -2586,7 +2686,7 @@ var Be,
|
|
|
2586
2686
|
session_token: r.session_token,
|
|
2587
2687
|
session_jwt: r.session_jwt,
|
|
2588
2688
|
intermediate_session_token: null
|
|
2589
|
-
}), t.abrupt("return",
|
|
2689
|
+
}), t.abrupt("return", te(r));
|
|
2590
2690
|
case 6:
|
|
2591
2691
|
case "end":
|
|
2592
2692
|
return t.stop();
|
|
@@ -2602,7 +2702,7 @@ var Be,
|
|
|
2602
2702
|
return s().wrap(function (t) {
|
|
2603
2703
|
for (;;) switch (t.prev = t.next) {
|
|
2604
2704
|
case 0:
|
|
2605
|
-
return
|
|
2705
|
+
return Q("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this._networkClient.fetchSDK({
|
|
2606
2706
|
url: "/passwords/session/reset",
|
|
2607
2707
|
method: "POST",
|
|
2608
2708
|
errorMessage: "Failed to reset session.",
|
|
@@ -2634,7 +2734,7 @@ var Be,
|
|
|
2634
2734
|
return s().wrap(function (t) {
|
|
2635
2735
|
for (;;) switch (t.prev = t.next) {
|
|
2636
2736
|
case 0:
|
|
2637
|
-
return
|
|
2737
|
+
return Q("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
2638
2738
|
url: "/passwords/strength_check",
|
|
2639
2739
|
method: "POST",
|
|
2640
2740
|
errorMessage: "Failed to check password strength.",
|
|
@@ -2656,103 +2756,8 @@ Promise.resolve({
|
|
|
2656
2756
|
pkceRequiredForEmailMagicLinks: !1
|
|
2657
2757
|
}), Promise.resolve({
|
|
2658
2758
|
pkceRequiredForPasswordResets: !1
|
|
2659
|
-
})
|
|
2660
|
-
|
|
2661
|
-
}(Be || (Be = {}));
|
|
2662
|
-
var Me = function (e) {
|
|
2663
|
-
u(r, h(Error));
|
|
2664
|
-
var t = l(r);
|
|
2665
|
-
function r(e) {
|
|
2666
|
-
var n;
|
|
2667
|
-
return c(this, r), (n = t.call(this, e)).type = e, n;
|
|
2668
|
-
}
|
|
2669
|
-
return a(r);
|
|
2670
|
-
}();
|
|
2671
|
-
function Ne(e) {
|
|
2672
|
-
var t = e.method,
|
|
2673
|
-
r = e.errorMessage,
|
|
2674
|
-
n = e.finalURL,
|
|
2675
|
-
i = e.basicAuthHeader,
|
|
2676
|
-
o = e.xSDKClientHeader,
|
|
2677
|
-
a = e.xSDKParentHostHeader,
|
|
2678
|
-
c = e.body;
|
|
2679
|
-
return k(this, void 0, void 0, s().mark(function e() {
|
|
2680
|
-
var u, l, d, h, p, f;
|
|
2681
|
-
return s().wrap(function (e) {
|
|
2682
|
-
for (;;) switch (e.prev = e.next) {
|
|
2683
|
-
case 0:
|
|
2684
|
-
return u = {
|
|
2685
|
-
Authorization: i,
|
|
2686
|
-
"Content-Type": "application/json",
|
|
2687
|
-
"X-SDK-Client": o
|
|
2688
|
-
}, a && (u["X-SDK-Parent-Host"] = a), l = {
|
|
2689
|
-
method: t,
|
|
2690
|
-
headers: u,
|
|
2691
|
-
body: c && JSON.stringify(c)
|
|
2692
|
-
}, e.prev = 3, e.next = 6, fetch(n, l);
|
|
2693
|
-
case 6:
|
|
2694
|
-
d = e.sent, e.next = 14;
|
|
2695
|
-
break;
|
|
2696
|
-
case 9:
|
|
2697
|
-
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
2698
|
-
e.next = 13;
|
|
2699
|
-
break;
|
|
2700
|
-
}
|
|
2701
|
-
throw new F(r, "Unable to contact the Stytch servers. Are you online?");
|
|
2702
|
-
case 13:
|
|
2703
|
-
throw e.t0;
|
|
2704
|
-
case 14:
|
|
2705
|
-
if (403 !== d.status) {
|
|
2706
|
-
e.next = 27;
|
|
2707
|
-
break;
|
|
2708
|
-
}
|
|
2709
|
-
return e.prev = 15, e.next = 18, d.text();
|
|
2710
|
-
case 18:
|
|
2711
|
-
h = e.sent, e.next = 24;
|
|
2712
|
-
break;
|
|
2713
|
-
case 21:
|
|
2714
|
-
throw e.prev = 21, e.t1 = e["catch"](15), new F(r, "Invalid response from the Stytch servers.");
|
|
2715
|
-
case 24:
|
|
2716
|
-
if (!h.includes("Captcha required")) {
|
|
2717
|
-
e.next = 26;
|
|
2718
|
-
break;
|
|
2719
|
-
}
|
|
2720
|
-
throw new Me(Be.RequiredCatcha);
|
|
2721
|
-
case 26:
|
|
2722
|
-
throw new F(r, "Invalid response from the Stytch servers.");
|
|
2723
|
-
case 27:
|
|
2724
|
-
if (200 === d.status) {
|
|
2725
|
-
e.next = 40;
|
|
2726
|
-
break;
|
|
2727
|
-
}
|
|
2728
|
-
return e.prev = 28, e.next = 31, d.json();
|
|
2729
|
-
case 31:
|
|
2730
|
-
p = e.sent, e.next = 37;
|
|
2731
|
-
break;
|
|
2732
|
-
case 34:
|
|
2733
|
-
throw e.prev = 34, e.t2 = e["catch"](28), new F(r, "Invalid or no response from server");
|
|
2734
|
-
case 37:
|
|
2735
|
-
if (!("body" in p || "params" in p || "query" in p)) {
|
|
2736
|
-
e.next = 39;
|
|
2737
|
-
break;
|
|
2738
|
-
}
|
|
2739
|
-
throw new K(p);
|
|
2740
|
-
case 39:
|
|
2741
|
-
throw new q(p);
|
|
2742
|
-
case 40:
|
|
2743
|
-
return e.prev = 40, e.next = 43, d.json();
|
|
2744
|
-
case 43:
|
|
2745
|
-
return f = e.sent, e.abrupt("return", f.data);
|
|
2746
|
-
case 47:
|
|
2747
|
-
throw e.prev = 47, e.t3 = e["catch"](40), new F(r, "Invalid response from the Stytch servers.");
|
|
2748
|
-
case 50:
|
|
2749
|
-
case "end":
|
|
2750
|
-
return e.stop();
|
|
2751
|
-
}
|
|
2752
|
-
}, e, null, [[3, 9], [15, 21], [28, 34], [40, 47]]);
|
|
2753
|
-
}));
|
|
2754
|
-
}
|
|
2755
|
-
var Fe = function () {
|
|
2759
|
+
});
|
|
2760
|
+
var Ue = function () {
|
|
2756
2761
|
function e(t) {
|
|
2757
2762
|
c(this, e), this.iframeURL = t, this.createIframe();
|
|
2758
2763
|
}
|
|
@@ -2760,7 +2765,7 @@ var Fe = function () {
|
|
|
2760
2765
|
key: "createIframe",
|
|
2761
2766
|
value: function value() {
|
|
2762
2767
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
2763
|
-
e ?
|
|
2768
|
+
e ? $("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) {
|
|
2764
2769
|
e.addEventListener("load", function () {
|
|
2765
2770
|
e.dataset.loaded = "true", t(e);
|
|
2766
2771
|
}, {
|
|
@@ -2784,7 +2789,7 @@ var Fe = function () {
|
|
|
2784
2789
|
var a;
|
|
2785
2790
|
i.port1.onmessage = function (e) {
|
|
2786
2791
|
var t = e.data;
|
|
2787
|
-
i.port1.close(), t.success ? r(t.payload) : s(
|
|
2792
|
+
i.port1.close(), t.success ? r(t.payload) : s(ne.unmarshall(t.error));
|
|
2788
2793
|
};
|
|
2789
2794
|
var c = {
|
|
2790
2795
|
method: e,
|
|
@@ -2801,7 +2806,7 @@ var Fe = function () {
|
|
|
2801
2806
|
}
|
|
2802
2807
|
}]), e;
|
|
2803
2808
|
}(),
|
|
2804
|
-
|
|
2809
|
+
Ke = function () {
|
|
2805
2810
|
function e(t, r) {
|
|
2806
2811
|
var n = this;
|
|
2807
2812
|
c(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
@@ -2845,7 +2850,7 @@ var Fe = function () {
|
|
|
2845
2850
|
this._reauthenticateWithBackoff().then(function () {
|
|
2846
2851
|
e.scheduleBackgroundRefresh();
|
|
2847
2852
|
})["catch"](function (t) {
|
|
2848
|
-
|
|
2853
|
+
$("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
2849
2854
|
error: t
|
|
2850
2855
|
}), e._subscriptionService.destroyState();
|
|
2851
2856
|
});
|
|
@@ -2875,20 +2880,20 @@ var Fe = function () {
|
|
|
2875
2880
|
}
|
|
2876
2881
|
}]), e;
|
|
2877
2882
|
}();
|
|
2878
|
-
|
|
2879
|
-
var
|
|
2880
|
-
var
|
|
2881
|
-
function
|
|
2883
|
+
Ke.REFRESH_INTERVAL_MS = 18e4;
|
|
2884
|
+
var qe = "bootstrap";
|
|
2885
|
+
var We = /*#__PURE__*/function () {
|
|
2886
|
+
function We(e, t, r) {
|
|
2882
2887
|
var _this = this;
|
|
2883
|
-
_classCallCheck(this,
|
|
2888
|
+
_classCallCheck(this, We);
|
|
2884
2889
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
2885
2890
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
2886
2891
|
method: "GET",
|
|
2887
2892
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
2888
|
-
}).then(
|
|
2889
|
-
return _this._dataLayer.setItem(
|
|
2893
|
+
}).then(We.mapBootstrapData).then(function (e) {
|
|
2894
|
+
return _this._dataLayer.setItem(qe, JSON.stringify(e)), e;
|
|
2890
2895
|
})["catch"](function (e) {
|
|
2891
|
-
return
|
|
2896
|
+
return X(e), {
|
|
2892
2897
|
displayWatermark: !1,
|
|
2893
2898
|
cnameDomain: null,
|
|
2894
2899
|
emailDomains: ["stytch.com"],
|
|
@@ -2906,10 +2911,10 @@ var qe = /*#__PURE__*/function () {
|
|
|
2906
2911
|
};
|
|
2907
2912
|
});
|
|
2908
2913
|
}
|
|
2909
|
-
_createClass(
|
|
2914
|
+
_createClass(We, [{
|
|
2910
2915
|
key: "getSync",
|
|
2911
2916
|
value: function getSync() {
|
|
2912
|
-
var e = this._dataLayer.getItem(
|
|
2917
|
+
var e = this._dataLayer.getItem(qe);
|
|
2913
2918
|
if (null === e) return {
|
|
2914
2919
|
displayWatermark: !1,
|
|
2915
2920
|
cnameDomain: null,
|
|
@@ -2976,9 +2981,9 @@ var qe = /*#__PURE__*/function () {
|
|
|
2976
2981
|
};
|
|
2977
2982
|
}
|
|
2978
2983
|
}]);
|
|
2979
|
-
return
|
|
2984
|
+
return We;
|
|
2980
2985
|
}();
|
|
2981
|
-
function
|
|
2986
|
+
function Ge(e, t, r, n) {
|
|
2982
2987
|
return new (r || (r = Promise))(function (i, s) {
|
|
2983
2988
|
function o(e) {
|
|
2984
2989
|
try {
|
|
@@ -3003,11 +3008,11 @@ function We(e, t, r, n) {
|
|
|
3003
3008
|
c((n = n.apply(e, t || [])).next());
|
|
3004
3009
|
});
|
|
3005
3010
|
}
|
|
3006
|
-
var
|
|
3011
|
+
var He = /*#__PURE__*/_createClass(function He(e) {
|
|
3007
3012
|
var _this2 = this;
|
|
3008
|
-
_classCallCheck(this,
|
|
3013
|
+
_classCallCheck(this, He);
|
|
3009
3014
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3010
|
-
return
|
|
3015
|
+
return Ge(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3011
3016
|
var _yield$this$state, e, t, r;
|
|
3012
3017
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3013
3018
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3038,7 +3043,7 @@ var Ge = /*#__PURE__*/_createClass(function Ge(e) {
|
|
|
3038
3043
|
}, _callee, this);
|
|
3039
3044
|
}));
|
|
3040
3045
|
}, this.state = e.then(function (e) {
|
|
3041
|
-
return
|
|
3046
|
+
return Ge(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3042
3047
|
var t;
|
|
3043
3048
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3044
3049
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3076,21 +3081,21 @@ var Ge = /*#__PURE__*/_createClass(function Ge(e) {
|
|
|
3076
3081
|
}));
|
|
3077
3082
|
});
|
|
3078
3083
|
});
|
|
3079
|
-
var
|
|
3080
|
-
function
|
|
3084
|
+
var ze = /*#__PURE__*/function () {
|
|
3085
|
+
function ze(e) {
|
|
3081
3086
|
var _this3 = this;
|
|
3082
|
-
_classCallCheck(this,
|
|
3087
|
+
_classCallCheck(this, ze);
|
|
3083
3088
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3084
3089
|
return _this3.call("oneTapStart", e);
|
|
3085
3090
|
}, this.oneTapSubmit = function (e) {
|
|
3086
3091
|
return _this3.call("oneTapSubmit", e);
|
|
3087
3092
|
};
|
|
3088
3093
|
}
|
|
3089
|
-
_createClass(
|
|
3094
|
+
_createClass(ze, [{
|
|
3090
3095
|
key: "frameClient",
|
|
3091
3096
|
get: function get() {
|
|
3092
3097
|
var e;
|
|
3093
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3098
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new Ue(this.iframeURL), this._frameClient;
|
|
3094
3099
|
}
|
|
3095
3100
|
}, {
|
|
3096
3101
|
key: "call",
|
|
@@ -3098,40 +3103,40 @@ var He = /*#__PURE__*/function () {
|
|
|
3098
3103
|
return this.frameClient.call(e, [t]);
|
|
3099
3104
|
}
|
|
3100
3105
|
}]);
|
|
3101
|
-
return
|
|
3106
|
+
return ze;
|
|
3102
3107
|
}();
|
|
3103
|
-
function
|
|
3104
|
-
return
|
|
3108
|
+
function Ye(e) {
|
|
3109
|
+
return Ye = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
3105
3110
|
return _typeof(e);
|
|
3106
3111
|
} : function (e) {
|
|
3107
3112
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
3108
|
-
},
|
|
3113
|
+
}, Ye(e);
|
|
3109
3114
|
}
|
|
3110
|
-
function
|
|
3115
|
+
function Ve(e, t) {
|
|
3111
3116
|
for (var r = 0; r < t.length; r++) {
|
|
3112
3117
|
var n = t[r];
|
|
3113
3118
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, s = void 0, s = function (e, t) {
|
|
3114
|
-
if ("object" !==
|
|
3119
|
+
if ("object" !== Ye(e) || null === e) return e;
|
|
3115
3120
|
var r = e[Symbol.toPrimitive];
|
|
3116
3121
|
if (void 0 !== r) {
|
|
3117
3122
|
var n = r.call(e, t || "default");
|
|
3118
|
-
if ("object" !==
|
|
3123
|
+
if ("object" !== Ye(n)) return n;
|
|
3119
3124
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3120
3125
|
}
|
|
3121
3126
|
return ("string" === t ? String : Number)(e);
|
|
3122
|
-
}(i, "string"), "symbol" ===
|
|
3127
|
+
}(i, "string"), "symbol" === Ye(s) ? s : String(s)), n);
|
|
3123
3128
|
}
|
|
3124
3129
|
var i, s;
|
|
3125
3130
|
}
|
|
3126
|
-
function
|
|
3127
|
-
return t &&
|
|
3131
|
+
function Je(e, t, r) {
|
|
3132
|
+
return t && Ve(e.prototype, t), r && Ve(e, r), Object.defineProperty(e, "prototype", {
|
|
3128
3133
|
writable: !1
|
|
3129
3134
|
}), e;
|
|
3130
3135
|
}
|
|
3131
|
-
function
|
|
3136
|
+
function $e(e, t) {
|
|
3132
3137
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
3133
3138
|
}
|
|
3134
|
-
function
|
|
3139
|
+
function Xe(e, t) {
|
|
3135
3140
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
3136
3141
|
e.prototype = Object.create(t && t.prototype, {
|
|
3137
3142
|
constructor: {
|
|
@@ -3141,31 +3146,31 @@ function $e(e, t) {
|
|
|
3141
3146
|
}
|
|
3142
3147
|
}), Object.defineProperty(e, "prototype", {
|
|
3143
3148
|
writable: !1
|
|
3144
|
-
}), t &&
|
|
3149
|
+
}), t && nt(e, t);
|
|
3145
3150
|
}
|
|
3146
|
-
function
|
|
3147
|
-
var t =
|
|
3151
|
+
function Ze(e) {
|
|
3152
|
+
var t = rt();
|
|
3148
3153
|
return function () {
|
|
3149
3154
|
var r,
|
|
3150
|
-
n =
|
|
3155
|
+
n = it(e);
|
|
3151
3156
|
if (t) {
|
|
3152
|
-
var i =
|
|
3157
|
+
var i = it(this).constructor;
|
|
3153
3158
|
r = Reflect.construct(n, arguments, i);
|
|
3154
3159
|
} else r = n.apply(this, arguments);
|
|
3155
3160
|
return function (e, t) {
|
|
3156
|
-
if (t && ("object" ===
|
|
3161
|
+
if (t && ("object" === Ye(t) || "function" == typeof t)) return t;
|
|
3157
3162
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
3158
|
-
return
|
|
3163
|
+
return Qe(e);
|
|
3159
3164
|
}(this, r);
|
|
3160
3165
|
};
|
|
3161
3166
|
}
|
|
3162
|
-
function
|
|
3167
|
+
function Qe(e) {
|
|
3163
3168
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
3164
3169
|
return e;
|
|
3165
3170
|
}
|
|
3166
|
-
function
|
|
3171
|
+
function et(e) {
|
|
3167
3172
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
3168
|
-
return
|
|
3173
|
+
return et = function et(e) {
|
|
3169
3174
|
if (null === e || (r = e, -1 === Function.toString.call(r).indexOf("[native code]"))) return e;
|
|
3170
3175
|
var r;
|
|
3171
3176
|
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -3174,7 +3179,7 @@ function Qe(e) {
|
|
|
3174
3179
|
t.set(e, n);
|
|
3175
3180
|
}
|
|
3176
3181
|
function n() {
|
|
3177
|
-
return
|
|
3182
|
+
return tt(e, arguments, it(this).constructor);
|
|
3178
3183
|
}
|
|
3179
3184
|
return n.prototype = Object.create(e.prototype, {
|
|
3180
3185
|
constructor: {
|
|
@@ -3183,18 +3188,18 @@ function Qe(e) {
|
|
|
3183
3188
|
writable: !0,
|
|
3184
3189
|
configurable: !0
|
|
3185
3190
|
}
|
|
3186
|
-
}),
|
|
3187
|
-
},
|
|
3191
|
+
}), nt(n, e);
|
|
3192
|
+
}, et(e);
|
|
3188
3193
|
}
|
|
3189
|
-
function
|
|
3190
|
-
return
|
|
3194
|
+
function tt(e, t, r) {
|
|
3195
|
+
return tt = rt() ? Reflect.construct.bind() : function (e, t, r) {
|
|
3191
3196
|
var n = [null];
|
|
3192
3197
|
n.push.apply(n, t);
|
|
3193
3198
|
var i = new (Function.bind.apply(e, n))();
|
|
3194
|
-
return r &&
|
|
3195
|
-
},
|
|
3199
|
+
return r && nt(i, r.prototype), i;
|
|
3200
|
+
}, tt.apply(null, arguments);
|
|
3196
3201
|
}
|
|
3197
|
-
function
|
|
3202
|
+
function rt() {
|
|
3198
3203
|
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
3199
3204
|
if (Reflect.construct.sham) return !1;
|
|
3200
3205
|
if ("function" == typeof Proxy) return !0;
|
|
@@ -3204,71 +3209,71 @@ function tt() {
|
|
|
3204
3209
|
return !1;
|
|
3205
3210
|
}
|
|
3206
3211
|
}
|
|
3207
|
-
function
|
|
3208
|
-
return
|
|
3212
|
+
function nt(e, t) {
|
|
3213
|
+
return nt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
3209
3214
|
return e.__proto__ = t, e;
|
|
3210
|
-
},
|
|
3215
|
+
}, nt(e, t);
|
|
3211
3216
|
}
|
|
3212
|
-
function
|
|
3213
|
-
return
|
|
3217
|
+
function it(e) {
|
|
3218
|
+
return it = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
3214
3219
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
3215
|
-
},
|
|
3220
|
+
}, it(e);
|
|
3216
3221
|
}
|
|
3217
|
-
var
|
|
3222
|
+
var st, ot, at, ct, ut, lt;
|
|
3218
3223
|
!function (e) {
|
|
3219
3224
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords";
|
|
3220
|
-
}(it || (it = {})), function (e) {
|
|
3221
|
-
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";
|
|
3222
3225
|
}(st || (st = {})), function (e) {
|
|
3223
|
-
e.
|
|
3226
|
+
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";
|
|
3224
3227
|
}(ot || (ot = {})), function (e) {
|
|
3225
|
-
e.
|
|
3228
|
+
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";
|
|
3226
3229
|
}(at || (at = {})), function (e) {
|
|
3227
|
-
e.
|
|
3230
|
+
e.embedded = "embedded", e.floating = "floating";
|
|
3228
3231
|
}(ct || (ct = {})), function (e) {
|
|
3232
|
+
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
3233
|
+
}(ut || (ut = {})), function (e) {
|
|
3229
3234
|
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";
|
|
3230
|
-
}(
|
|
3231
|
-
var
|
|
3232
|
-
dt,
|
|
3235
|
+
}(lt || (lt = {}));
|
|
3236
|
+
var dt,
|
|
3233
3237
|
ht,
|
|
3234
3238
|
pt,
|
|
3235
|
-
ft
|
|
3236
|
-
|
|
3237
|
-
|
|
3239
|
+
ft,
|
|
3240
|
+
_t = function (e) {
|
|
3241
|
+
Xe(r, et(Error));
|
|
3242
|
+
var t = Ze(r);
|
|
3238
3243
|
function r(e, n) {
|
|
3239
3244
|
var i;
|
|
3240
|
-
return
|
|
3245
|
+
return $e(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(Qe(i), r.prototype), i;
|
|
3241
3246
|
}
|
|
3242
|
-
return
|
|
3247
|
+
return Je(r);
|
|
3243
3248
|
}(),
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
var t =
|
|
3249
|
+
mt = function (e) {
|
|
3250
|
+
Xe(r, et(Error));
|
|
3251
|
+
var t = Ze(r);
|
|
3247
3252
|
function r(e, n) {
|
|
3248
3253
|
var i;
|
|
3249
|
-
return
|
|
3254
|
+
return $e(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
3250
3255
|
}
|
|
3251
|
-
return
|
|
3256
|
+
return Je(r);
|
|
3252
3257
|
}(),
|
|
3253
3258
|
vt = function (e) {
|
|
3254
|
-
|
|
3255
|
-
var t =
|
|
3259
|
+
Xe(r, et(Error));
|
|
3260
|
+
var t = Ze(r);
|
|
3256
3261
|
function r(e) {
|
|
3257
3262
|
var n, i;
|
|
3258
|
-
|
|
3263
|
+
$e(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
3259
3264
|
var s = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
3260
3265
|
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
3261
3266
|
}).join("\n");
|
|
3262
3267
|
return n.message = "[400] Request does not match expected schema\n".concat(s), n;
|
|
3263
3268
|
}
|
|
3264
|
-
return
|
|
3269
|
+
return Je(r);
|
|
3265
3270
|
}(),
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
var t =
|
|
3271
|
+
yt = function (e) {
|
|
3272
|
+
Xe(r, et(Error));
|
|
3273
|
+
var t = Ze(r);
|
|
3269
3274
|
function r(e) {
|
|
3270
3275
|
var n;
|
|
3271
|
-
|
|
3276
|
+
$e(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
3272
3277
|
var i = e.status_code,
|
|
3273
3278
|
s = e.error_type,
|
|
3274
3279
|
o = e.error_message,
|
|
@@ -3276,35 +3281,35 @@ var lt,
|
|
|
3276
3281
|
c = e.request_id;
|
|
3277
3282
|
return n.error_type = s, n.error_message = o, n.error_url = a, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(s, "\n") + "".concat(o, "\n") + "See ".concat(a, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n;
|
|
3278
3283
|
}
|
|
3279
|
-
return
|
|
3284
|
+
return Je(r);
|
|
3280
3285
|
}(),
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
var t =
|
|
3286
|
+
gt = function (e) {
|
|
3287
|
+
Xe(r, et(Error));
|
|
3288
|
+
var t = Ze(r);
|
|
3284
3289
|
function r(e) {
|
|
3285
3290
|
var n;
|
|
3286
|
-
return
|
|
3291
|
+
return $e(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n;
|
|
3287
3292
|
}
|
|
3288
|
-
return
|
|
3293
|
+
return Je(r);
|
|
3289
3294
|
}(),
|
|
3290
|
-
|
|
3295
|
+
bt = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
3291
3296
|
!function (e) {
|
|
3292
3297
|
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";
|
|
3293
|
-
}(lt || (lt = {})), function (e) {
|
|
3294
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3295
3298
|
}(dt || (dt = {})), function (e) {
|
|
3296
|
-
e.
|
|
3299
|
+
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3297
3300
|
}(ht || (ht = {})), function (e) {
|
|
3301
|
+
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3302
|
+
}(pt || (pt = {})), function (e) {
|
|
3298
3303
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
3299
|
-
}(
|
|
3300
|
-
var
|
|
3301
|
-
_inherits(
|
|
3302
|
-
var _super = _createSuper(
|
|
3303
|
-
function
|
|
3304
|
+
}(ft || (ft = {}));
|
|
3305
|
+
var kt = /*#__PURE__*/function (_pe) {
|
|
3306
|
+
_inherits(kt, _pe);
|
|
3307
|
+
var _super = _createSuper(kt);
|
|
3308
|
+
function kt(e, t, r, n, i, s) {
|
|
3304
3309
|
var _this4;
|
|
3305
|
-
_classCallCheck(this,
|
|
3310
|
+
_classCallCheck(this, kt);
|
|
3306
3311
|
_this4 = _super.call(this, e, t, r, n, i), _this4._oneTap = s, _this4.startOneTap = function (e) {
|
|
3307
|
-
return
|
|
3312
|
+
return Ge(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3308
3313
|
var t, r, n;
|
|
3309
3314
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3310
3315
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3326,7 +3331,7 @@ var bt = /*#__PURE__*/function (_ue) {
|
|
|
3326
3331
|
});
|
|
3327
3332
|
return _context3.abrupt("return", r.render({
|
|
3328
3333
|
style: {
|
|
3329
|
-
position:
|
|
3334
|
+
position: ct.floating
|
|
3330
3335
|
},
|
|
3331
3336
|
onOneTapCancelled: e.onOneTapCancelled,
|
|
3332
3337
|
callback: n
|
|
@@ -3342,20 +3347,20 @@ var bt = /*#__PURE__*/function (_ue) {
|
|
|
3342
3347
|
};
|
|
3343
3348
|
return _this4;
|
|
3344
3349
|
}
|
|
3345
|
-
return _createClass(
|
|
3346
|
-
}(
|
|
3347
|
-
var
|
|
3348
|
-
function
|
|
3349
|
-
_classCallCheck(this,
|
|
3350
|
+
return _createClass(kt);
|
|
3351
|
+
}(pe);
|
|
3352
|
+
var wt = /*#__PURE__*/function () {
|
|
3353
|
+
function wt(e, t, r, n) {
|
|
3354
|
+
_classCallCheck(this, wt);
|
|
3350
3355
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3351
3356
|
return null;
|
|
3352
|
-
}, this.eventLogger = new
|
|
3357
|
+
}, this.eventLogger = new ie({
|
|
3353
3358
|
maxBatchSize: 15,
|
|
3354
3359
|
intervalDurationMs: 800,
|
|
3355
3360
|
logEventURL: this.buildSDKUrl("/events")
|
|
3356
3361
|
});
|
|
3357
3362
|
}
|
|
3358
|
-
_createClass(
|
|
3363
|
+
_createClass(wt, [{
|
|
3359
3364
|
key: "logEvent",
|
|
3360
3365
|
value: function logEvent(_ref) {
|
|
3361
3366
|
var e = _ref.name,
|
|
@@ -3386,7 +3391,7 @@ var kt = /*#__PURE__*/function () {
|
|
|
3386
3391
|
},
|
|
3387
3392
|
sdk: {
|
|
3388
3393
|
identifier: "Stytch.js Javascript SDK",
|
|
3389
|
-
version: "2.0.
|
|
3394
|
+
version: "2.0.5"
|
|
3390
3395
|
}
|
|
3391
3396
|
});
|
|
3392
3397
|
}
|
|
@@ -3397,13 +3402,13 @@ var kt = /*#__PURE__*/function () {
|
|
|
3397
3402
|
t = _ref2.body,
|
|
3398
3403
|
r = _ref2.errorMessage,
|
|
3399
3404
|
n = _ref2.method;
|
|
3400
|
-
return
|
|
3405
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3401
3406
|
var i, s, o, a;
|
|
3402
3407
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3403
3408
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3404
3409
|
case 0:
|
|
3405
3410
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), o = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3406
|
-
return _context4.abrupt("return",
|
|
3411
|
+
return _context4.abrupt("return", ue({
|
|
3407
3412
|
basicAuthHeader: s,
|
|
3408
3413
|
body: t,
|
|
3409
3414
|
errorMessage: r,
|
|
@@ -3427,7 +3432,7 @@ var kt = /*#__PURE__*/function () {
|
|
|
3427
3432
|
r = _ref3.errorMessage,
|
|
3428
3433
|
n = _ref3.method,
|
|
3429
3434
|
i = _ref3.retryCallback;
|
|
3430
|
-
return
|
|
3435
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3431
3436
|
var o, a, c, u;
|
|
3432
3437
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3433
3438
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3455,18 +3460,18 @@ var kt = /*#__PURE__*/function () {
|
|
|
3455
3460
|
xSDKClientHeader: o,
|
|
3456
3461
|
xSDKParentHostHeader: a,
|
|
3457
3462
|
body: c
|
|
3458
|
-
}, e.prev = 1, e.next = 4,
|
|
3463
|
+
}, e.prev = 1, e.next = 4, ue(l);
|
|
3459
3464
|
case 4:
|
|
3460
3465
|
case 15:
|
|
3461
3466
|
return e.abrupt("return", e.sent);
|
|
3462
3467
|
case 7:
|
|
3463
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3468
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof ce)) {
|
|
3464
3469
|
e.next = 16;
|
|
3465
3470
|
break;
|
|
3466
3471
|
}
|
|
3467
3472
|
return e.next = 12, u(e.t0, l);
|
|
3468
3473
|
case 12:
|
|
3469
|
-
return l = e.sent, e.next = 15,
|
|
3474
|
+
return l = e.sent, e.next = 15, ue(l);
|
|
3470
3475
|
case 16:
|
|
3471
3476
|
throw e.t0;
|
|
3472
3477
|
case 17:
|
|
@@ -3498,14 +3503,14 @@ var kt = /*#__PURE__*/function () {
|
|
|
3498
3503
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3499
3504
|
}
|
|
3500
3505
|
}]);
|
|
3501
|
-
return
|
|
3506
|
+
return wt;
|
|
3502
3507
|
}();
|
|
3503
|
-
var
|
|
3504
|
-
function
|
|
3505
|
-
_classCallCheck(this,
|
|
3508
|
+
var St = /*#__PURE__*/function () {
|
|
3509
|
+
function St(e, t, r) {
|
|
3510
|
+
_classCallCheck(this, St);
|
|
3506
3511
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3507
3512
|
}
|
|
3508
|
-
_createClass(
|
|
3513
|
+
_createClass(St, [{
|
|
3509
3514
|
key: "cancel",
|
|
3510
3515
|
value: function cancel() {
|
|
3511
3516
|
this._googleClient.cancel();
|
|
@@ -3516,7 +3521,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
3516
3521
|
var e = _ref4.callback,
|
|
3517
3522
|
t = _ref4.onOneTapCancelled,
|
|
3518
3523
|
r = _ref4.style;
|
|
3519
|
-
return
|
|
3524
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3520
3525
|
var _this5 = this;
|
|
3521
3526
|
var n;
|
|
3522
3527
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3529,7 +3534,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
3529
3534
|
context: "use",
|
|
3530
3535
|
itp_support: !0
|
|
3531
3536
|
};
|
|
3532
|
-
return _context6.abrupt("return", (r.position ===
|
|
3537
|
+
return _context6.abrupt("return", (r.position === ct.embedded && (n.prompt_parent_id = "google-parent-prompt", n.cancel_on_tap_outside = !1), this._googleClient.initialize(n), new Promise(function (e) {
|
|
3533
3538
|
_this5._googleClient.prompt(function (n) {
|
|
3534
3539
|
return n.isSkippedMoment() ? ("user_cancel" === n.getSkippedReason() && (null == t || t()), e({
|
|
3535
3540
|
success: !1,
|
|
@@ -3552,23 +3557,23 @@ var wt = /*#__PURE__*/function () {
|
|
|
3552
3557
|
}, {
|
|
3553
3558
|
key: "styleFrame",
|
|
3554
3559
|
value: function styleFrame(e) {
|
|
3555
|
-
e.position ===
|
|
3560
|
+
e.position === ct.embedded && Array.from(document.getElementsByTagName("iframe")).forEach(function (e) {
|
|
3556
3561
|
e.src.includes(y) && (e.style.width = "100%");
|
|
3557
3562
|
});
|
|
3558
3563
|
}
|
|
3559
3564
|
}]);
|
|
3560
|
-
return
|
|
3565
|
+
return St;
|
|
3561
3566
|
}();
|
|
3562
|
-
var
|
|
3563
|
-
function
|
|
3567
|
+
var Tt = /*#__PURE__*/function () {
|
|
3568
|
+
function Tt(e, t) {
|
|
3564
3569
|
var _this6 = this;
|
|
3565
|
-
_classCallCheck(this,
|
|
3570
|
+
_classCallCheck(this, Tt);
|
|
3566
3571
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
3567
3572
|
var e = _ref5.loginRedirectUrl,
|
|
3568
3573
|
t = _ref5.signupRedirectUrl,
|
|
3569
3574
|
r = _ref5.onSuccess;
|
|
3570
3575
|
return function (n) {
|
|
3571
|
-
return
|
|
3576
|
+
return Ge(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3572
3577
|
var i, _yield$this$submitGoo, s;
|
|
3573
3578
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3574
3579
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -3595,10 +3600,10 @@ var St = /*#__PURE__*/function () {
|
|
|
3595
3600
|
window.location.href = e;
|
|
3596
3601
|
};
|
|
3597
3602
|
}
|
|
3598
|
-
_createClass(
|
|
3603
|
+
_createClass(Tt, [{
|
|
3599
3604
|
key: "createOneTapClient",
|
|
3600
3605
|
value: function createOneTapClient() {
|
|
3601
|
-
return
|
|
3606
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3602
3607
|
var e, _yield$this$fetchGoog;
|
|
3603
3608
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3604
3609
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -3629,7 +3634,7 @@ var St = /*#__PURE__*/function () {
|
|
|
3629
3634
|
});
|
|
3630
3635
|
case 12:
|
|
3631
3636
|
_context8.t1 = !0;
|
|
3632
|
-
_context8.t2 =
|
|
3637
|
+
_context8.t2 = St;
|
|
3633
3638
|
_context8.next = 16;
|
|
3634
3639
|
return H(g, function () {
|
|
3635
3640
|
return window.google.accounts.id;
|
|
@@ -3663,7 +3668,7 @@ var St = /*#__PURE__*/function () {
|
|
|
3663
3668
|
var e = _ref6.credential,
|
|
3664
3669
|
t = _ref6.loginRedirectUrl,
|
|
3665
3670
|
r = _ref6.signupRedirectUrl;
|
|
3666
|
-
return
|
|
3671
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3667
3672
|
var _yield$this$fetchGoog2, n;
|
|
3668
3673
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3669
3674
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -3700,21 +3705,21 @@ var St = /*#__PURE__*/function () {
|
|
|
3700
3705
|
}, {
|
|
3701
3706
|
key: "WillGoogleOneTapShowEmbedded",
|
|
3702
3707
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
3703
|
-
return !
|
|
3708
|
+
return !Tt.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
3704
3709
|
}
|
|
3705
3710
|
}]);
|
|
3706
|
-
return
|
|
3711
|
+
return Tt;
|
|
3707
3712
|
}();
|
|
3708
|
-
function
|
|
3713
|
+
function Ot(e) {
|
|
3709
3714
|
var t = e.toString(16);
|
|
3710
3715
|
return 1 === t.length && (t = "0" + t), t;
|
|
3711
3716
|
}
|
|
3712
|
-
var
|
|
3713
|
-
function
|
|
3714
|
-
_classCallCheck(this,
|
|
3717
|
+
var Ct = /*#__PURE__*/function () {
|
|
3718
|
+
function Ct(e, t) {
|
|
3719
|
+
_classCallCheck(this, Ct);
|
|
3715
3720
|
this._dataLayer = e, this.namespace = t;
|
|
3716
3721
|
}
|
|
3717
|
-
_createClass(
|
|
3722
|
+
_createClass(Ct, [{
|
|
3718
3723
|
key: "key",
|
|
3719
3724
|
value: function key() {
|
|
3720
3725
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3722,13 +3727,13 @@ var Ot = /*#__PURE__*/function () {
|
|
|
3722
3727
|
}, {
|
|
3723
3728
|
key: "startPKCETransaction",
|
|
3724
3729
|
value: function startPKCETransaction() {
|
|
3725
|
-
return
|
|
3730
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3726
3731
|
var e;
|
|
3727
3732
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3728
3733
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3729
3734
|
case 0:
|
|
3730
3735
|
_context10.next = 2;
|
|
3731
|
-
return
|
|
3736
|
+
return Ct.createProofkeyPair();
|
|
3732
3737
|
case 2:
|
|
3733
3738
|
e = _context10.sent;
|
|
3734
3739
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3746,7 +3751,7 @@ var Ot = /*#__PURE__*/function () {
|
|
|
3746
3751
|
if (null !== e) try {
|
|
3747
3752
|
return JSON.parse(e);
|
|
3748
3753
|
} catch (e) {
|
|
3749
|
-
return void
|
|
3754
|
+
return void $("Found malformed Proof Key pair in localstorage.");
|
|
3750
3755
|
}
|
|
3751
3756
|
}
|
|
3752
3757
|
}, {
|
|
@@ -3757,7 +3762,7 @@ var Ot = /*#__PURE__*/function () {
|
|
|
3757
3762
|
}], [{
|
|
3758
3763
|
key: "createProofkeyPair",
|
|
3759
3764
|
value: function createProofkeyPair() {
|
|
3760
|
-
return
|
|
3765
|
+
return Ge(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
3761
3766
|
var _String$fromCharCode;
|
|
3762
3767
|
var e, t, r, n;
|
|
3763
3768
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -3765,7 +3770,7 @@ var Ot = /*#__PURE__*/function () {
|
|
|
3765
3770
|
case 0:
|
|
3766
3771
|
e = new Uint32Array(16);
|
|
3767
3772
|
window.crypto.getRandomValues(e);
|
|
3768
|
-
t = Array.from(e).map(
|
|
3773
|
+
t = Array.from(e).map(Ot).join("");
|
|
3769
3774
|
_context11.next = 5;
|
|
3770
3775
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3771
3776
|
case 5:
|
|
@@ -3782,14 +3787,14 @@ var Ot = /*#__PURE__*/function () {
|
|
|
3782
3787
|
}));
|
|
3783
3788
|
}
|
|
3784
3789
|
}]);
|
|
3785
|
-
return
|
|
3790
|
+
return Ct;
|
|
3786
3791
|
}();
|
|
3787
|
-
var
|
|
3788
|
-
function
|
|
3789
|
-
_classCallCheck(this,
|
|
3792
|
+
var Et = /*#__PURE__*/function () {
|
|
3793
|
+
function Et(e) {
|
|
3794
|
+
_classCallCheck(this, Et);
|
|
3790
3795
|
this._networkClient = e;
|
|
3791
3796
|
}
|
|
3792
|
-
_createClass(
|
|
3797
|
+
_createClass(Et, [{
|
|
3793
3798
|
key: "searchUser",
|
|
3794
3799
|
value: function searchUser(e) {
|
|
3795
3800
|
return this._networkClient.fetchSDK({
|
|
@@ -3827,9 +3832,9 @@ var Ct = /*#__PURE__*/function () {
|
|
|
3827
3832
|
});
|
|
3828
3833
|
}
|
|
3829
3834
|
}]);
|
|
3830
|
-
return
|
|
3835
|
+
return Et;
|
|
3831
3836
|
}();
|
|
3832
|
-
var
|
|
3837
|
+
var xt = function xt(e) {
|
|
3833
3838
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3834
3839
|
var _t$split = t.split("="),
|
|
3835
3840
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3838,17 +3843,17 @@ var Et = function Et(e) {
|
|
|
3838
3843
|
}).length > 1;
|
|
3839
3844
|
};
|
|
3840
3845
|
/*! js-cookie v3.0.1 | MIT */
|
|
3841
|
-
function
|
|
3846
|
+
function At(e) {
|
|
3842
3847
|
for (var t = 1; t < arguments.length; t++) {
|
|
3843
3848
|
var r = arguments[t];
|
|
3844
3849
|
for (var n in r) e[n] = r[n];
|
|
3845
3850
|
}
|
|
3846
3851
|
return e;
|
|
3847
3852
|
}
|
|
3848
|
-
var
|
|
3853
|
+
var Pt = function e(t, r) {
|
|
3849
3854
|
function n(e, n, i) {
|
|
3850
3855
|
if ("undefined" != typeof document) {
|
|
3851
|
-
"number" == typeof (i =
|
|
3856
|
+
"number" == typeof (i = At({}, 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);
|
|
3852
3857
|
var s = "";
|
|
3853
3858
|
for (var o in i) i[o] && (s += "; " + o, !0 !== i[o] && (s += "=" + i[o].split(";")[0]));
|
|
3854
3859
|
return document.cookie = e + "=" + t.write(n, e) + s;
|
|
@@ -3870,15 +3875,15 @@ var At = function e(t, r) {
|
|
|
3870
3875
|
}
|
|
3871
3876
|
},
|
|
3872
3877
|
remove: function remove(e, t) {
|
|
3873
|
-
n(e, "",
|
|
3878
|
+
n(e, "", At({}, t, {
|
|
3874
3879
|
expires: -1
|
|
3875
3880
|
}));
|
|
3876
3881
|
},
|
|
3877
3882
|
withAttributes: function withAttributes(t) {
|
|
3878
|
-
return e(this.converter,
|
|
3883
|
+
return e(this.converter, At({}, this.attributes, t));
|
|
3879
3884
|
},
|
|
3880
3885
|
withConverter: function withConverter(t) {
|
|
3881
|
-
return e(
|
|
3886
|
+
return e(At({}, this.converter, t), this.attributes);
|
|
3882
3887
|
}
|
|
3883
3888
|
}, {
|
|
3884
3889
|
attributes: {
|
|
@@ -3898,26 +3903,26 @@ var At = function e(t, r) {
|
|
|
3898
3903
|
}, {
|
|
3899
3904
|
path: "/"
|
|
3900
3905
|
});
|
|
3901
|
-
var
|
|
3906
|
+
var Rt = function Rt(e) {
|
|
3902
3907
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3903
3908
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3904
3909
|
};
|
|
3905
|
-
var
|
|
3906
|
-
function
|
|
3910
|
+
var Dt = /*#__PURE__*/function () {
|
|
3911
|
+
function Dt(e, t) {
|
|
3907
3912
|
var _this7 = this;
|
|
3908
|
-
_classCallCheck(this,
|
|
3913
|
+
_classCallCheck(this, Dt);
|
|
3909
3914
|
this.browserSessionStorage = {
|
|
3910
3915
|
getItem: function getItem(e) {
|
|
3911
|
-
return sessionStorage.getItem(
|
|
3916
|
+
return sessionStorage.getItem(Rt(_this7.publicToken, e));
|
|
3912
3917
|
},
|
|
3913
3918
|
setItem: function setItem(e, t) {
|
|
3914
|
-
return sessionStorage.setItem(
|
|
3919
|
+
return sessionStorage.setItem(Rt(_this7.publicToken, e), t);
|
|
3915
3920
|
},
|
|
3916
3921
|
removeItem: function removeItem(e) {
|
|
3917
|
-
return sessionStorage.removeItem(
|
|
3922
|
+
return sessionStorage.removeItem(Rt(_this7.publicToken, e));
|
|
3918
3923
|
}
|
|
3919
|
-
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
3920
|
-
var r = localStorage.getItem(
|
|
3924
|
+
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Q("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);
|
|
3925
|
+
var r = localStorage.getItem(Rt(this.publicToken));
|
|
3921
3926
|
if (!r) return this.removeSessionCookie(), void this.removeISTCookie();
|
|
3922
3927
|
var n;
|
|
3923
3928
|
try {
|
|
@@ -3927,7 +3932,7 @@ var Rt = /*#__PURE__*/function () {
|
|
|
3927
3932
|
}
|
|
3928
3933
|
this.state = n;
|
|
3929
3934
|
}
|
|
3930
|
-
_createClass(
|
|
3935
|
+
_createClass(Dt, [{
|
|
3931
3936
|
key: "opaqueTokenCookieName",
|
|
3932
3937
|
get: function get() {
|
|
3933
3938
|
var e;
|
|
@@ -3949,14 +3954,14 @@ var Rt = /*#__PURE__*/function () {
|
|
|
3949
3954
|
key: "readSessionCookie",
|
|
3950
3955
|
value: function readSessionCookie() {
|
|
3951
3956
|
return {
|
|
3952
|
-
session_token:
|
|
3953
|
-
session_jwt:
|
|
3957
|
+
session_token: Pt.get(this.opaqueTokenCookieName),
|
|
3958
|
+
session_jwt: Pt.get(this.jwtCookieName)
|
|
3954
3959
|
};
|
|
3955
3960
|
}
|
|
3956
3961
|
}, {
|
|
3957
3962
|
key: "readIntermediateSessionTokenCookie",
|
|
3958
3963
|
value: function readIntermediateSessionTokenCookie() {
|
|
3959
|
-
return
|
|
3964
|
+
return Pt.get(this.istCookieName);
|
|
3960
3965
|
}
|
|
3961
3966
|
}, {
|
|
3962
3967
|
key: "writeSessionCookie",
|
|
@@ -3965,29 +3970,32 @@ var Rt = /*#__PURE__*/function () {
|
|
|
3965
3970
|
var s = e.state,
|
|
3966
3971
|
o = e.session_token,
|
|
3967
3972
|
a = e.session_jwt,
|
|
3968
|
-
c =
|
|
3973
|
+
c = Dt.generateCookieOpts({
|
|
3969
3974
|
expiresAt: null !== (r = null === (t = null == s ? void 0 : s.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
3970
3975
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3971
|
-
path: this._cookiePath
|
|
3976
|
+
path: this._cookiePath,
|
|
3977
|
+
domain: this._domain
|
|
3972
3978
|
});
|
|
3973
|
-
|
|
3974
|
-
var u =
|
|
3979
|
+
Pt.set(this.opaqueTokenCookieName, o, c), Pt.set(this.jwtCookieName, a, c);
|
|
3980
|
+
var u = Dt.generateCookieOpts({
|
|
3975
3981
|
expiresAt: null !== (i = null === (n = null == s ? void 0 : s.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
3976
3982
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
3977
|
-
path: this._cookiePath
|
|
3983
|
+
path: this._cookiePath,
|
|
3984
|
+
domain: this._domain
|
|
3978
3985
|
});
|
|
3979
|
-
|
|
3986
|
+
xt(this.jwtCookieName) && Pt.remove(this.jwtCookieName, u), xt(this.opaqueTokenCookieName) && Pt.remove(this.opaqueTokenCookieName, u), xt(this.jwtCookieName) && $("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), xt(this.opaqueTokenCookieName) && $("Could not remove extraneous opaque token cookie.");
|
|
3980
3987
|
}
|
|
3981
3988
|
}, {
|
|
3982
3989
|
key: "writeIntermediateSessionTokenCookie",
|
|
3983
3990
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
3984
3991
|
var t = new Date(Date.now() + 6e5),
|
|
3985
|
-
r =
|
|
3992
|
+
r = Dt.generateCookieOpts({
|
|
3986
3993
|
expiresAt: t.toString(),
|
|
3987
3994
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3988
|
-
path: this._cookiePath
|
|
3995
|
+
path: this._cookiePath,
|
|
3996
|
+
domain: this._domain
|
|
3989
3997
|
});
|
|
3990
|
-
|
|
3998
|
+
Pt.set(this.istCookieName, e, r);
|
|
3991
3999
|
}
|
|
3992
4000
|
}, {
|
|
3993
4001
|
key: "removeSessionCookie",
|
|
@@ -4005,13 +4013,16 @@ var Rt = /*#__PURE__*/function () {
|
|
|
4005
4013
|
var _this8 = this;
|
|
4006
4014
|
[!0, !1].forEach(function (t) {
|
|
4007
4015
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4016
|
+
[_this8._domain, null].forEach(function (n) {
|
|
4017
|
+
var i = Dt.generateCookieOpts({
|
|
4018
|
+
expiresAt: new Date(0).toString(),
|
|
4019
|
+
availableToSubdomains: t,
|
|
4020
|
+
path: r,
|
|
4021
|
+
domain: n
|
|
4022
|
+
});
|
|
4023
|
+
e.forEach(function (e) {
|
|
4024
|
+
Pt.remove(e, i);
|
|
4025
|
+
});
|
|
4015
4026
|
});
|
|
4016
4027
|
});
|
|
4017
4028
|
});
|
|
@@ -4019,61 +4030,62 @@ var Rt = /*#__PURE__*/function () {
|
|
|
4019
4030
|
}, {
|
|
4020
4031
|
key: "syncToLocalStorage",
|
|
4021
4032
|
value: function syncToLocalStorage() {
|
|
4022
|
-
localStorage.setItem(
|
|
4033
|
+
localStorage.setItem(Rt(this.publicToken), JSON.stringify(this.state));
|
|
4023
4034
|
}
|
|
4024
4035
|
}, {
|
|
4025
4036
|
key: "getItem",
|
|
4026
4037
|
value: function getItem(e) {
|
|
4027
|
-
return localStorage.getItem(
|
|
4038
|
+
return localStorage.getItem(Rt(this.publicToken, e));
|
|
4028
4039
|
}
|
|
4029
4040
|
}, {
|
|
4030
4041
|
key: "setItem",
|
|
4031
4042
|
value: function setItem(e, t) {
|
|
4032
|
-
return localStorage.setItem(
|
|
4043
|
+
return localStorage.setItem(Rt(this.publicToken, e), t);
|
|
4033
4044
|
}
|
|
4034
4045
|
}, {
|
|
4035
4046
|
key: "removeItem",
|
|
4036
4047
|
value: function removeItem(e) {
|
|
4037
|
-
return localStorage.removeItem(
|
|
4048
|
+
return localStorage.removeItem(Rt(this.publicToken, e));
|
|
4038
4049
|
}
|
|
4039
4050
|
}], [{
|
|
4040
4051
|
key: "generateCookieOpts",
|
|
4041
4052
|
value: function generateCookieOpts(_ref7) {
|
|
4042
4053
|
var e = _ref7.path,
|
|
4043
|
-
t = _ref7.
|
|
4044
|
-
r = _ref7.
|
|
4045
|
-
|
|
4046
|
-
|
|
4054
|
+
t = _ref7.domain,
|
|
4055
|
+
r = _ref7.availableToSubdomains,
|
|
4056
|
+
n = _ref7.expiresAt;
|
|
4057
|
+
var i = {
|
|
4058
|
+
expires: new Date(n),
|
|
4047
4059
|
sameSite: "lax"
|
|
4048
4060
|
};
|
|
4049
|
-
return e && (
|
|
4061
|
+
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;
|
|
4050
4062
|
}
|
|
4051
4063
|
}]);
|
|
4052
|
-
return
|
|
4064
|
+
return Dt;
|
|
4053
4065
|
}();
|
|
4054
|
-
var
|
|
4055
|
-
_inherits(
|
|
4056
|
-
var _super2 = _createSuper(
|
|
4057
|
-
function
|
|
4058
|
-
_classCallCheck(this,
|
|
4066
|
+
var Bt = /*#__PURE__*/function (_Dt) {
|
|
4067
|
+
_inherits(Bt, _Dt);
|
|
4068
|
+
var _super2 = _createSuper(Bt);
|
|
4069
|
+
function Bt() {
|
|
4070
|
+
_classCallCheck(this, Bt);
|
|
4059
4071
|
return _super2.apply(this, arguments);
|
|
4060
4072
|
}
|
|
4061
|
-
return _createClass(
|
|
4062
|
-
}(
|
|
4063
|
-
var
|
|
4064
|
-
|
|
4073
|
+
return _createClass(Bt);
|
|
4074
|
+
}(Dt);
|
|
4075
|
+
var It = Symbol["for"]("__stytch_DataLayer"),
|
|
4076
|
+
Lt = function Lt(e, t) {
|
|
4065
4077
|
var r = function () {
|
|
4066
4078
|
var e = window;
|
|
4067
|
-
return e[
|
|
4079
|
+
return e[It] || (e[It] = {}), e[It];
|
|
4068
4080
|
}();
|
|
4069
|
-
return r[e] || (r[e] = new
|
|
4081
|
+
return r[e] || (r[e] = new Bt(e, t)), r[e];
|
|
4070
4082
|
},
|
|
4071
|
-
|
|
4083
|
+
jt = function jt(e, t) {
|
|
4072
4084
|
Object.values(e).forEach(function (e) {
|
|
4073
4085
|
return e(t);
|
|
4074
4086
|
});
|
|
4075
4087
|
},
|
|
4076
|
-
|
|
4088
|
+
Mt = function () {
|
|
4077
4089
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4078
4090
|
r = void 0 === e ? [] : e;
|
|
4079
4091
|
return function e(n, s) {
|
|
@@ -4092,13 +4104,13 @@ var Bt = Symbol["for"]("__stytch_DataLayer"),
|
|
|
4092
4104
|
}({
|
|
4093
4105
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4094
4106
|
});
|
|
4095
|
-
var
|
|
4096
|
-
function
|
|
4107
|
+
var Nt = /*#__PURE__*/function () {
|
|
4108
|
+
function Nt(e, t) {
|
|
4097
4109
|
var _this9 = this;
|
|
4098
|
-
_classCallCheck(this,
|
|
4110
|
+
_classCallCheck(this, Nt);
|
|
4099
4111
|
var r;
|
|
4100
4112
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4101
|
-
if (e.key !==
|
|
4113
|
+
if (e.key !== Rt(_this9._publicToken)) return;
|
|
4102
4114
|
if (null === e.newValue || "null" === e.newValue) return void _this9.destroyState();
|
|
4103
4115
|
var t = JSON.parse(e.newValue);
|
|
4104
4116
|
_this9.updateState(t);
|
|
@@ -4109,7 +4121,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4109
4121
|
i = _this$_datalayer$read.session_token;
|
|
4110
4122
|
i || this.destroyState();
|
|
4111
4123
|
}
|
|
4112
|
-
_createClass(
|
|
4124
|
+
_createClass(Nt, [{
|
|
4113
4125
|
key: "getTokens",
|
|
4114
4126
|
value: function getTokens() {
|
|
4115
4127
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4140,7 +4152,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4140
4152
|
value: function _updateStateAndTokensInternal(e) {
|
|
4141
4153
|
var t = this._datalayer.state,
|
|
4142
4154
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4143
|
-
this._datalayer.state = r,
|
|
4155
|
+
this._datalayer.state = r, Mt(t, r) || jt(this._datalayer.subscriptions, r);
|
|
4144
4156
|
}
|
|
4145
4157
|
}, {
|
|
4146
4158
|
key: "updateStateAndTokens",
|
|
@@ -4152,7 +4164,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4152
4164
|
value: function updateState(e) {
|
|
4153
4165
|
var t = this._datalayer.state,
|
|
4154
4166
|
r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
4155
|
-
this._datalayer.state = r,
|
|
4167
|
+
this._datalayer.state = r, Mt(t, r) || (jt(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage());
|
|
4156
4168
|
}
|
|
4157
4169
|
}, {
|
|
4158
4170
|
key: "updateTokens",
|
|
@@ -4192,14 +4204,14 @@ var Mt = /*#__PURE__*/function () {
|
|
|
4192
4204
|
return null;
|
|
4193
4205
|
}
|
|
4194
4206
|
}]);
|
|
4195
|
-
return
|
|
4207
|
+
return Nt;
|
|
4196
4208
|
}();
|
|
4197
|
-
var
|
|
4198
|
-
_inherits(
|
|
4199
|
-
var _super3 = _createSuper(
|
|
4200
|
-
function
|
|
4209
|
+
var Ft = /*#__PURE__*/function (_Nt) {
|
|
4210
|
+
_inherits(Ft, _Nt);
|
|
4211
|
+
var _super3 = _createSuper(Ft);
|
|
4212
|
+
function Ft() {
|
|
4201
4213
|
var _this10;
|
|
4202
|
-
_classCallCheck(this,
|
|
4214
|
+
_classCallCheck(this, Ft);
|
|
4203
4215
|
_this10 = _super3.apply(this, arguments), _this10.updateUser = function (e) {
|
|
4204
4216
|
return _this10.updateState({
|
|
4205
4217
|
user: e
|
|
@@ -4213,17 +4225,17 @@ var Nt = /*#__PURE__*/function (_Mt) {
|
|
|
4213
4225
|
};
|
|
4214
4226
|
return _this10;
|
|
4215
4227
|
}
|
|
4216
|
-
return _createClass(
|
|
4217
|
-
}(
|
|
4218
|
-
var
|
|
4219
|
-
var
|
|
4228
|
+
return _createClass(Ft);
|
|
4229
|
+
}(Nt);
|
|
4230
|
+
var Ut = Symbol["for"]("stytch__internal_b2c");
|
|
4231
|
+
var Kt = /*#__PURE__*/_createClass(function Kt(e, t) {
|
|
4220
4232
|
var _this11 = this;
|
|
4221
|
-
_classCallCheck(this,
|
|
4233
|
+
_classCallCheck(this, Kt);
|
|
4222
4234
|
var r;
|
|
4223
4235
|
!function (e) {
|
|
4224
4236
|
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
4237
|
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) ?
|
|
4238
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? $("Public token is malformed. Expected a string, got ".concat(i(r), ".").concat(Z)) : "" === r ? $('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Z)) : r.startsWith("public-token-") || $('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Z));
|
|
4227
4239
|
var n = t,
|
|
4228
4240
|
s = {
|
|
4229
4241
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4232,31 +4244,31 @@ var Ut = /*#__PURE__*/_createClass(function Ut(e, t) {
|
|
|
4232
4244
|
testAPIURL: null !== (l = null === (u = null == o ? void 0 : o.endpoints) || void 0 === u ? void 0 : u.testAPIURL) && void 0 !== l ? l : "https://test.stytch.com",
|
|
4233
4245
|
liveAPIURL: null !== (h = null === (d = null == o ? void 0 : o.endpoints) || void 0 === d ? void 0 : d.liveAPIURL) && void 0 !== h ? h : "https://api.stytch.com",
|
|
4234
4246
|
dfpBackendURL: null !== (f = null === (p = null == o ? void 0 : o.endpoints) || void 0 === p ? void 0 : p.dfpBackendURL) && void 0 !== f ? f : "https://telemetry.stytch.com",
|
|
4235
|
-
clientsideServicesIframeURL: null !== (
|
|
4247
|
+
clientsideServicesIframeURL: null !== (m = null === (_ = null == o ? void 0 : o.endpoints) || void 0 === _ ? void 0 : _.clientsideServicesIframeURL) && void 0 !== m ? m : "https://js.stytch.com/clientside-services/index.html"
|
|
4236
4248
|
}
|
|
4237
4249
|
};
|
|
4238
|
-
var o, a, c, u, l, d, h, p, f, _,
|
|
4239
|
-
this._dataLayer =
|
|
4240
|
-
var
|
|
4241
|
-
this._networkClient = new
|
|
4250
|
+
var o, a, c, u, l, d, h, p, f, _, m;
|
|
4251
|
+
this._dataLayer = Lt(e, n), this._subscriptionService = new Ft(e, this._dataLayer);
|
|
4252
|
+
var v = new Ct(this._dataLayer, "passwords");
|
|
4253
|
+
this._networkClient = new wt(e, this._dataLayer, s.endpoints.sdkBackendURL, function () {
|
|
4242
4254
|
var e, t, r, n;
|
|
4243
4255
|
return {
|
|
4244
4256
|
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
4257
|
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
4258
|
};
|
|
4247
4259
|
});
|
|
4248
|
-
var y = new
|
|
4249
|
-
g = new
|
|
4250
|
-
b = new
|
|
4251
|
-
k = new
|
|
4252
|
-
w = new
|
|
4253
|
-
S = new
|
|
4260
|
+
var y = new We(e, this._networkClient, this._dataLayer),
|
|
4261
|
+
g = new He(y.getAsync()),
|
|
4262
|
+
b = new re(e, s.endpoints.dfpBackendURL, y.getAsync()),
|
|
4263
|
+
k = new ze(s.endpoints.clientsideServicesIframeURL),
|
|
4264
|
+
w = new Tt(e, k),
|
|
4265
|
+
S = new Et(this._networkClient);
|
|
4254
4266
|
var T, O;
|
|
4255
|
-
this.user = new
|
|
4267
|
+
this.user = new oe(this._networkClient, this._subscriptionService), this.session = new ae(this._networkClient, this._subscriptionService), this.magicLinks = new de(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "magic_links"), v, y.getAsync(), g.executeRecaptcha, b), this.otps = new he(this._networkClient, this._subscriptionService, g.executeRecaptcha), this.oauth = new kt(this._networkClient, this._subscriptionService, new Ct(this._dataLayer, "oauth"), y.getAsync(), {
|
|
4256
4268
|
publicToken: e,
|
|
4257
4269
|
testAPIURL: s.endpoints.testAPIURL,
|
|
4258
4270
|
liveAPIURL: s.endpoints.liveAPIURL
|
|
4259
|
-
}, w), this.cryptoWallets = new
|
|
4271
|
+
}, w), this.cryptoWallets = new fe(this._networkClient, this._subscriptionService, g.executeRecaptcha), this.totps = new _e(this._networkClient, this._subscriptionService), this.webauthn = new Me(this._networkClient, this._subscriptionService), this.passwords = new Fe(this._networkClient, this._subscriptionService, v, y.getAsync(), g.executeRecaptcha, b), this._sessionManager = new Ke(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4260
4272
|
name: "sdk_instance_instantiated",
|
|
4261
4273
|
details: {
|
|
4262
4274
|
event_callback_registered: !1,
|
|
@@ -4272,6 +4284,6 @@ var Ut = /*#__PURE__*/_createClass(function Ut(e, t) {
|
|
|
4272
4284
|
publicToken: e,
|
|
4273
4285
|
dataLayer: this._dataLayer,
|
|
4274
4286
|
networkClient: this._networkClient
|
|
4275
|
-
}, Object.assign(T, _defineProperty({},
|
|
4287
|
+
}, Object.assign(T, _defineProperty({}, Ut, O));
|
|
4276
4288
|
});
|
|
4277
|
-
export {
|
|
4289
|
+
export { pt as AuthFlowType, ft as B2BOAuthProviders, ht as B2BProducts, dt as BiometricsErrors, ot as OAuthProviders, ut as OTPMethods, ct as OneTapPositions, st as Products, _t as SDKAPIUnreachableError, lt as StytchEventType, Kt as StytchHeadlessClient, yt as StytchSDKAPIError, gt as StytchSDKNativeError, vt as StytchSDKSchemaError, mt as StytchSDKUsageError, bt as UNRECOVERABLE_ERROR_TYPES, at as Wallets };
|