@stytch/vanilla-js 3.3.0 → 4.1.1
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 +25 -2
- package/dist/b2b/index.d.ts +14 -13
- package/dist/b2b/index.esm.d.ts +14 -13
- package/dist/b2b/index.esm.js +4180 -3826
- package/dist/b2b/index.headless.d.ts +14 -13
- package/dist/b2b/index.headless.esm.d.ts +14 -13
- package/dist/b2b/index.headless.esm.js +1477 -1118
- package/dist/b2b/index.headless.js +1472 -1112
- package/dist/b2b/index.js +3733 -3374
- package/dist/index.esm.js +5388 -5107
- package/dist/index.headless.esm.js +1576 -1293
- package/dist/index.headless.js +1557 -1288
- package/dist/index.js +4599 -4318
- package/package.json +2 -2
|
@@ -27,7 +27,545 @@ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf
|
|
|
27
27
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
29
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
30
|
-
function e(
|
|
30
|
+
function e(t) {
|
|
31
|
+
return e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
32
|
+
return _typeof(e);
|
|
33
|
+
} : function (e) {
|
|
34
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
35
|
+
}, e(t);
|
|
36
|
+
}
|
|
37
|
+
function t(t, r) {
|
|
38
|
+
for (var n = 0; n < r.length; n++) {
|
|
39
|
+
var i = r[n];
|
|
40
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, (o = i.key, s = void 0, s = function (t, r) {
|
|
41
|
+
if ("object" !== e(t) || null === t) return t;
|
|
42
|
+
var n = t[Symbol.toPrimitive];
|
|
43
|
+
if (void 0 !== n) {
|
|
44
|
+
var i = n.call(t, r || "default");
|
|
45
|
+
if ("object" !== e(i)) return i;
|
|
46
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
47
|
+
}
|
|
48
|
+
return ("string" === r ? String : Number)(t);
|
|
49
|
+
}(o, "string"), "symbol" === e(s) ? s : String(s)), i);
|
|
50
|
+
}
|
|
51
|
+
var o, s;
|
|
52
|
+
}
|
|
53
|
+
function r(e, r, n) {
|
|
54
|
+
return r && t(e.prototype, r), n && t(e, n), Object.defineProperty(e, "prototype", {
|
|
55
|
+
writable: !1
|
|
56
|
+
}), e;
|
|
57
|
+
}
|
|
58
|
+
function n(e, t) {
|
|
59
|
+
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
60
|
+
}
|
|
61
|
+
function i(e, t) {
|
|
62
|
+
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
63
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
64
|
+
constructor: {
|
|
65
|
+
value: e,
|
|
66
|
+
writable: !0,
|
|
67
|
+
configurable: !0
|
|
68
|
+
}
|
|
69
|
+
}), Object.defineProperty(e, "prototype", {
|
|
70
|
+
writable: !1
|
|
71
|
+
}), t && l(e, t);
|
|
72
|
+
}
|
|
73
|
+
function o(t) {
|
|
74
|
+
var r = u();
|
|
75
|
+
return function () {
|
|
76
|
+
var n,
|
|
77
|
+
i = d(t);
|
|
78
|
+
if (r) {
|
|
79
|
+
var o = d(this).constructor;
|
|
80
|
+
n = Reflect.construct(i, arguments, o);
|
|
81
|
+
} else n = i.apply(this, arguments);
|
|
82
|
+
return function (t, r) {
|
|
83
|
+
if (r && ("object" === e(r) || "function" == typeof r)) return r;
|
|
84
|
+
if (void 0 !== r) throw new TypeError("Derived constructors may only return object or undefined");
|
|
85
|
+
return s(t);
|
|
86
|
+
}(this, n);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function s(e) {
|
|
90
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
91
|
+
return e;
|
|
92
|
+
}
|
|
93
|
+
function a(e) {
|
|
94
|
+
var t = "function" == typeof Map ? new Map() : void 0;
|
|
95
|
+
return a = function a(e) {
|
|
96
|
+
if (null === e || !function (e) {
|
|
97
|
+
try {
|
|
98
|
+
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
99
|
+
} catch (t) {
|
|
100
|
+
return "function" == typeof e;
|
|
101
|
+
}
|
|
102
|
+
}(e)) return e;
|
|
103
|
+
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
104
|
+
if (void 0 !== t) {
|
|
105
|
+
if (t.has(e)) return t.get(e);
|
|
106
|
+
t.set(e, r);
|
|
107
|
+
}
|
|
108
|
+
function r() {
|
|
109
|
+
return c(e, arguments, d(this).constructor);
|
|
110
|
+
}
|
|
111
|
+
return r.prototype = Object.create(e.prototype, {
|
|
112
|
+
constructor: {
|
|
113
|
+
value: r,
|
|
114
|
+
enumerable: !1,
|
|
115
|
+
writable: !0,
|
|
116
|
+
configurable: !0
|
|
117
|
+
}
|
|
118
|
+
}), l(r, e);
|
|
119
|
+
}, a(e);
|
|
120
|
+
}
|
|
121
|
+
function c(e, t, r) {
|
|
122
|
+
return c = u() ? Reflect.construct.bind() : function (e, t, r) {
|
|
123
|
+
var n = [null];
|
|
124
|
+
n.push.apply(n, t);
|
|
125
|
+
var i = new (Function.bind.apply(e, n))();
|
|
126
|
+
return r && l(i, r.prototype), i;
|
|
127
|
+
}, c.apply(null, arguments);
|
|
128
|
+
}
|
|
129
|
+
function u() {
|
|
130
|
+
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
131
|
+
if (Reflect.construct.sham) return !1;
|
|
132
|
+
if ("function" == typeof Proxy) return !0;
|
|
133
|
+
try {
|
|
134
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
|
|
135
|
+
} catch (e) {
|
|
136
|
+
return !1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function l(e, t) {
|
|
140
|
+
return l = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
141
|
+
return e.__proto__ = t, e;
|
|
142
|
+
}, l(e, t);
|
|
143
|
+
}
|
|
144
|
+
function d(e) {
|
|
145
|
+
return d = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
146
|
+
return e.__proto__ || Object.getPrototypeOf(e);
|
|
147
|
+
}, d(e);
|
|
148
|
+
}
|
|
149
|
+
var h, p, _, f, m, v;
|
|
150
|
+
!function (e) {
|
|
151
|
+
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
152
|
+
}(h || (h = {})), function (e) {
|
|
153
|
+
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";
|
|
154
|
+
}(p || (p = {})), function (e) {
|
|
155
|
+
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";
|
|
156
|
+
}(_ || (_ = {})), function (e) {
|
|
157
|
+
e.embedded = "embedded", e.floating = "floating";
|
|
158
|
+
}(f || (f = {})), function (e) {
|
|
159
|
+
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
160
|
+
}(m || (m = {})), function (e) {
|
|
161
|
+
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
162
|
+
}(v || (v = {}));
|
|
163
|
+
var b,
|
|
164
|
+
g,
|
|
165
|
+
y,
|
|
166
|
+
k = function (e) {
|
|
167
|
+
i(c, a(Error));
|
|
168
|
+
var t = o(c);
|
|
169
|
+
function c(e, r) {
|
|
170
|
+
var i;
|
|
171
|
+
return n(this, c), (i = t.call(this, e + "\n" + r)).message = e + "\n" + r, i.name = "SDKAPIUnreachableError", i.details = r, Object.setPrototypeOf(s(i), c.prototype), i;
|
|
172
|
+
}
|
|
173
|
+
return r(c);
|
|
174
|
+
}(),
|
|
175
|
+
w = function (e) {
|
|
176
|
+
i(s, a(Error));
|
|
177
|
+
var t = o(s);
|
|
178
|
+
function s(e, r) {
|
|
179
|
+
var i;
|
|
180
|
+
return n(this, s), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + r, i;
|
|
181
|
+
}
|
|
182
|
+
return r(s);
|
|
183
|
+
}(),
|
|
184
|
+
S = function (e) {
|
|
185
|
+
i(s, a(Error));
|
|
186
|
+
var t = o(s);
|
|
187
|
+
function s(e) {
|
|
188
|
+
var r, i;
|
|
189
|
+
n(this, s), (r = t.call(this)).name = "StytchSDKSchemaError";
|
|
190
|
+
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
191
|
+
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
192
|
+
}).join("\n");
|
|
193
|
+
return r.message = "[400] Request does not match expected schema\n".concat(o), r;
|
|
194
|
+
}
|
|
195
|
+
return r(s);
|
|
196
|
+
}(),
|
|
197
|
+
P = function (e) {
|
|
198
|
+
i(s, a(Error));
|
|
199
|
+
var t = o(s);
|
|
200
|
+
function s(e) {
|
|
201
|
+
var r;
|
|
202
|
+
n(this, s), (r = t.call(this)).name = "StytchSDKAPIError";
|
|
203
|
+
var i = e.status_code,
|
|
204
|
+
o = e.error_type,
|
|
205
|
+
a = e.error_message,
|
|
206
|
+
c = e.error_url,
|
|
207
|
+
u = e.request_id;
|
|
208
|
+
return r.error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), r;
|
|
209
|
+
}
|
|
210
|
+
return r(s);
|
|
211
|
+
}(),
|
|
212
|
+
A = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
213
|
+
C = function (e) {
|
|
214
|
+
i(s, a(Error));
|
|
215
|
+
var t = o(s);
|
|
216
|
+
function s(e, r) {
|
|
217
|
+
var i;
|
|
218
|
+
return n(this, s), (i = t.call(this, r)).name = e, i;
|
|
219
|
+
}
|
|
220
|
+
return r(s);
|
|
221
|
+
}(),
|
|
222
|
+
T = function (e) {
|
|
223
|
+
i(a, C);
|
|
224
|
+
var t = o(a);
|
|
225
|
+
function a(e) {
|
|
226
|
+
var r;
|
|
227
|
+
return n(this, a), r = t.call(this, "StytchAPIUnreachableError", e), Object.setPrototypeOf(s(r), a.prototype), r;
|
|
228
|
+
}
|
|
229
|
+
return r(a);
|
|
230
|
+
}(),
|
|
231
|
+
O = function (e) {
|
|
232
|
+
i(s, C);
|
|
233
|
+
var t = o(s);
|
|
234
|
+
function s(e) {
|
|
235
|
+
var r;
|
|
236
|
+
n(this, s);
|
|
237
|
+
var i = null === (r = e.body) || void 0 === r ? void 0 : r.map(function (e) {
|
|
238
|
+
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
239
|
+
}).join("\n");
|
|
240
|
+
return t.call(this, "StytchAPISchemaError", "Request does not match expected schema\n".concat(i));
|
|
241
|
+
}
|
|
242
|
+
return r(s);
|
|
243
|
+
}(),
|
|
244
|
+
E = function (e) {
|
|
245
|
+
i(s, C);
|
|
246
|
+
var t = o(s);
|
|
247
|
+
function s(e) {
|
|
248
|
+
var r;
|
|
249
|
+
n(this, s);
|
|
250
|
+
var i = e.status_code,
|
|
251
|
+
o = e.error_type,
|
|
252
|
+
a = e.error_message,
|
|
253
|
+
c = e.error_url,
|
|
254
|
+
u = e.request_id;
|
|
255
|
+
return (r = t.call(this, "StytchAPIError", "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""))).error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r;
|
|
256
|
+
}
|
|
257
|
+
return r(s);
|
|
258
|
+
}(),
|
|
259
|
+
x = function (e) {
|
|
260
|
+
i(s, C);
|
|
261
|
+
var t = o(s);
|
|
262
|
+
function s(e, r, i) {
|
|
263
|
+
var o;
|
|
264
|
+
return n(this, s), (o = t.call(this, e, r)).options = i, o;
|
|
265
|
+
}
|
|
266
|
+
return r(s);
|
|
267
|
+
}(),
|
|
268
|
+
D = function (e) {
|
|
269
|
+
i(s, x);
|
|
270
|
+
var t = o(s);
|
|
271
|
+
function s() {
|
|
272
|
+
return n(this, s), t.call(this, "NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session.");
|
|
273
|
+
}
|
|
274
|
+
return r(s);
|
|
275
|
+
}(),
|
|
276
|
+
R = function (e) {
|
|
277
|
+
i(s, x);
|
|
278
|
+
var t = o(s);
|
|
279
|
+
function s(e) {
|
|
280
|
+
return n(this, s), t.call(this, "InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs.");
|
|
281
|
+
}
|
|
282
|
+
return r(s);
|
|
283
|
+
}(),
|
|
284
|
+
I = function (e) {
|
|
285
|
+
i(s, x);
|
|
286
|
+
var t = o(s);
|
|
287
|
+
function s() {
|
|
288
|
+
return n(this, s), t.call(this, "NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first.");
|
|
289
|
+
}
|
|
290
|
+
return r(s);
|
|
291
|
+
}(),
|
|
292
|
+
B = function (e) {
|
|
293
|
+
i(s, x);
|
|
294
|
+
var t = o(s);
|
|
295
|
+
function s() {
|
|
296
|
+
return n(this, s), t.call(this, "BiometricsUnavailableError", "Biometrics is not available on the device.");
|
|
297
|
+
}
|
|
298
|
+
return r(s);
|
|
299
|
+
}(),
|
|
300
|
+
L = function (e) {
|
|
301
|
+
i(s, x);
|
|
302
|
+
var t = o(s);
|
|
303
|
+
function s() {
|
|
304
|
+
return n(this, s), t.call(this, "KeyInvalidatedError", "The biometrics enrollment on the device has changed.");
|
|
305
|
+
}
|
|
306
|
+
return r(s);
|
|
307
|
+
}(),
|
|
308
|
+
M = function (e) {
|
|
309
|
+
i(s, x);
|
|
310
|
+
var t = o(s);
|
|
311
|
+
function s() {
|
|
312
|
+
return n(this, s), t.call(this, "KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true.");
|
|
313
|
+
}
|
|
314
|
+
return r(s);
|
|
315
|
+
}(),
|
|
316
|
+
j = function (e) {
|
|
317
|
+
i(s, x);
|
|
318
|
+
var t = o(s);
|
|
319
|
+
function s() {
|
|
320
|
+
return n(this, s), t.call(this, "NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings.");
|
|
321
|
+
}
|
|
322
|
+
return r(s);
|
|
323
|
+
}(),
|
|
324
|
+
F = function (e) {
|
|
325
|
+
i(s, x);
|
|
326
|
+
var t = o(s);
|
|
327
|
+
function s() {
|
|
328
|
+
return n(this, s), t.call(this, "UserCancellationError", "The user canceled the prompt. Ask the user to try again.");
|
|
329
|
+
}
|
|
330
|
+
return r(s);
|
|
331
|
+
}(),
|
|
332
|
+
N = function (e) {
|
|
333
|
+
i(s, x);
|
|
334
|
+
var t = o(s);
|
|
335
|
+
function s() {
|
|
336
|
+
return n(this, s), t.call(this, "UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later.");
|
|
337
|
+
}
|
|
338
|
+
return r(s);
|
|
339
|
+
}(),
|
|
340
|
+
K = function (e) {
|
|
341
|
+
i(s, x);
|
|
342
|
+
var t = o(s);
|
|
343
|
+
function s() {
|
|
344
|
+
return n(this, s), t.call(this, "DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods.");
|
|
345
|
+
}
|
|
346
|
+
return r(s);
|
|
347
|
+
}(),
|
|
348
|
+
U = function (e) {
|
|
349
|
+
i(s, x);
|
|
350
|
+
var t = o(s);
|
|
351
|
+
function s() {
|
|
352
|
+
return n(this, s), t.call(this, "MissingGoogleClientIDError", "No Google client ID was found in the project.");
|
|
353
|
+
}
|
|
354
|
+
return r(s);
|
|
355
|
+
}(),
|
|
356
|
+
z = function (e) {
|
|
357
|
+
i(s, x);
|
|
358
|
+
var t = o(s);
|
|
359
|
+
function s() {
|
|
360
|
+
return n(this, s), t.call(this, "MissingPKCEError", "Make sure this flow is completed on the same device on which it was started.");
|
|
361
|
+
}
|
|
362
|
+
return r(s);
|
|
363
|
+
}(),
|
|
364
|
+
q = function (e) {
|
|
365
|
+
i(s, x);
|
|
366
|
+
var t = o(s);
|
|
367
|
+
function s() {
|
|
368
|
+
return n(this, s), t.call(this, "MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token.");
|
|
369
|
+
}
|
|
370
|
+
return r(s);
|
|
371
|
+
}(),
|
|
372
|
+
W = function (e) {
|
|
373
|
+
i(s, x);
|
|
374
|
+
var t = o(s);
|
|
375
|
+
function s() {
|
|
376
|
+
return n(this, s), t.call(this, "InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method.");
|
|
377
|
+
}
|
|
378
|
+
return r(s);
|
|
379
|
+
}(),
|
|
380
|
+
G = function (e) {
|
|
381
|
+
i(s, x);
|
|
382
|
+
var t = o(s);
|
|
383
|
+
function s() {
|
|
384
|
+
return n(this, s), t.call(this, "MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration.");
|
|
385
|
+
}
|
|
386
|
+
return r(s);
|
|
387
|
+
}(),
|
|
388
|
+
H = function (e) {
|
|
389
|
+
i(s, x);
|
|
390
|
+
var t = o(s);
|
|
391
|
+
function s() {
|
|
392
|
+
return n(this, s), t.call(this, "ChallengeSigningFailedError", "Failed to sign the challenge with the key.");
|
|
393
|
+
}
|
|
394
|
+
return r(s);
|
|
395
|
+
}(),
|
|
396
|
+
Y = function (e) {
|
|
397
|
+
i(s, x);
|
|
398
|
+
var t = o(s);
|
|
399
|
+
function s() {
|
|
400
|
+
return n(this, s), t.call(this, "SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK");
|
|
401
|
+
}
|
|
402
|
+
return r(s);
|
|
403
|
+
}(),
|
|
404
|
+
V = function (e) {
|
|
405
|
+
i(s, x);
|
|
406
|
+
var t = o(s);
|
|
407
|
+
function s() {
|
|
408
|
+
return n(this, s), t.call(this, "FailedCodeChallengeError", "Failed to create a code challenge");
|
|
409
|
+
}
|
|
410
|
+
return r(s);
|
|
411
|
+
}(),
|
|
412
|
+
J = function (e) {
|
|
413
|
+
i(s, x);
|
|
414
|
+
var t = o(s);
|
|
415
|
+
function s() {
|
|
416
|
+
return n(this, s), t.call(this, "PasskeysUnsupportedError", "Passkeys are not supported on this device");
|
|
417
|
+
}
|
|
418
|
+
return r(s);
|
|
419
|
+
}(),
|
|
420
|
+
$ = function (e) {
|
|
421
|
+
i(s, x);
|
|
422
|
+
var t = o(s);
|
|
423
|
+
function s() {
|
|
424
|
+
return n(this, s), t.call(this, "FailedToDecryptDataError", "Failed to decrypt user data");
|
|
425
|
+
}
|
|
426
|
+
return r(s);
|
|
427
|
+
}(),
|
|
428
|
+
X = function (e) {
|
|
429
|
+
i(s, x);
|
|
430
|
+
var t = o(s);
|
|
431
|
+
function s() {
|
|
432
|
+
return n(this, s), t.call(this, "BiometricsFailedError", "Biometric authentication failed");
|
|
433
|
+
}
|
|
434
|
+
return r(s);
|
|
435
|
+
}(),
|
|
436
|
+
Z = function (e) {
|
|
437
|
+
i(s, x);
|
|
438
|
+
var t = o(s);
|
|
439
|
+
function s() {
|
|
440
|
+
return n(this, s), t.call(this, "InvalidStartUrlError", "The start URL was invalid or improperly formatted.");
|
|
441
|
+
}
|
|
442
|
+
return r(s);
|
|
443
|
+
}(),
|
|
444
|
+
Q = function (e) {
|
|
445
|
+
i(s, x);
|
|
446
|
+
var t = o(s);
|
|
447
|
+
function s() {
|
|
448
|
+
return n(this, s), t.call(this, "InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls.");
|
|
449
|
+
}
|
|
450
|
+
return r(s);
|
|
451
|
+
}(),
|
|
452
|
+
ee = function (e) {
|
|
453
|
+
i(s, x);
|
|
454
|
+
var t = o(s);
|
|
455
|
+
function s() {
|
|
456
|
+
return n(this, s), t.call(this, "MissingUrlError", "The underlying web authentication service failed to return a URL.");
|
|
457
|
+
}
|
|
458
|
+
return r(s);
|
|
459
|
+
}(),
|
|
460
|
+
te = function (e) {
|
|
461
|
+
i(s, x);
|
|
462
|
+
var t = o(s);
|
|
463
|
+
function s() {
|
|
464
|
+
return n(this, s), t.call(this, "InvalidCredentialTypeError", "The public key credential type was not of the expected type.");
|
|
465
|
+
}
|
|
466
|
+
return r(s);
|
|
467
|
+
}(),
|
|
468
|
+
re = function (e) {
|
|
469
|
+
i(s, x);
|
|
470
|
+
var t = o(s);
|
|
471
|
+
function s() {
|
|
472
|
+
return n(this, s), t.call(this, "MissingAttestationObjectError", "The public key credential is missing the attestation object.");
|
|
473
|
+
}
|
|
474
|
+
return r(s);
|
|
475
|
+
}(),
|
|
476
|
+
ne = function (e) {
|
|
477
|
+
i(s, x);
|
|
478
|
+
var t = o(s);
|
|
479
|
+
function s() {
|
|
480
|
+
return n(this, s), t.call(this, "JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type.");
|
|
481
|
+
}
|
|
482
|
+
return r(s);
|
|
483
|
+
}(),
|
|
484
|
+
ie = function (e) {
|
|
485
|
+
i(s, x);
|
|
486
|
+
var t = o(s);
|
|
487
|
+
function s() {
|
|
488
|
+
return n(this, s), t.call(this, "RandomNumberGenerationFailed", "Random number generation failed");
|
|
489
|
+
}
|
|
490
|
+
return r(s);
|
|
491
|
+
}(),
|
|
492
|
+
oe = function (e) {
|
|
493
|
+
i(s, x);
|
|
494
|
+
var t = o(s);
|
|
495
|
+
function s() {
|
|
496
|
+
return n(this, s), t.call(this, "PasskeysInvalidEncoding", "Invalid passkey encoding");
|
|
497
|
+
}
|
|
498
|
+
return r(s);
|
|
499
|
+
}();
|
|
500
|
+
function se(e) {
|
|
501
|
+
switch (e.message) {
|
|
502
|
+
case "internal_error":
|
|
503
|
+
return new R(e.message);
|
|
504
|
+
case "no_current_session":
|
|
505
|
+
return new D();
|
|
506
|
+
case "no_biometrics_registration":
|
|
507
|
+
case "no_biometrics_registration":
|
|
508
|
+
return new I();
|
|
509
|
+
case "biometrics_unavailable":
|
|
510
|
+
case "device_hardware_error":
|
|
511
|
+
case "biometrics_not_available":
|
|
512
|
+
return new B();
|
|
513
|
+
case "key_invalidated":
|
|
514
|
+
case "no_biometric_key":
|
|
515
|
+
return new L();
|
|
516
|
+
case "no_biometrics_enrolled":
|
|
517
|
+
return new j();
|
|
518
|
+
case "keystore_unavailable":
|
|
519
|
+
return new M();
|
|
520
|
+
case "device_credentials_not_allowed":
|
|
521
|
+
return new K();
|
|
522
|
+
case "user_cancellation":
|
|
523
|
+
return new F();
|
|
524
|
+
case "user_locked_out":
|
|
525
|
+
return new N();
|
|
526
|
+
case "google_onetap_missing_id_token":
|
|
527
|
+
case "oauth_apple_missing_id_token":
|
|
528
|
+
case "missing_authorization_credential_id_token":
|
|
529
|
+
return new q();
|
|
530
|
+
case "google_onetap_missing_member":
|
|
531
|
+
case "oauth_apple_credential_invalid":
|
|
532
|
+
case "invalid_authorization_credential":
|
|
533
|
+
return new W();
|
|
534
|
+
case "missing_public_key":
|
|
535
|
+
return new G();
|
|
536
|
+
case "challenge_signing_failed":
|
|
537
|
+
return new H();
|
|
538
|
+
case "sdk_not_configured":
|
|
539
|
+
return new Y();
|
|
540
|
+
case "failed_code_challenge":
|
|
541
|
+
return new V();
|
|
542
|
+
case "passkeys_unsupported":
|
|
543
|
+
return new J();
|
|
544
|
+
case "failed_to_decrypt_data":
|
|
545
|
+
return new $();
|
|
546
|
+
case "biometrics_failed":
|
|
547
|
+
return new X();
|
|
548
|
+
case "invalid_start_url":
|
|
549
|
+
return new Z();
|
|
550
|
+
case "invalid_redirect_scheme":
|
|
551
|
+
return new Q();
|
|
552
|
+
case "missing_url":
|
|
553
|
+
return new ee();
|
|
554
|
+
case "invalid_credential_type":
|
|
555
|
+
return new te();
|
|
556
|
+
case "missing_attestation_object":
|
|
557
|
+
return new re();
|
|
558
|
+
case "json_data_not_convertible_to_string":
|
|
559
|
+
return new ne();
|
|
560
|
+
case "random_number_generation_failed":
|
|
561
|
+
return new ie();
|
|
562
|
+
case "passkeys_invalid_encoding":
|
|
563
|
+
return new oe();
|
|
564
|
+
default:
|
|
565
|
+
return new x(e.name, e.message);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function ae(e, t) {
|
|
31
569
|
return function (e) {
|
|
32
570
|
if (Array.isArray(e)) return e;
|
|
33
571
|
}(e) || function (e, t) {
|
|
@@ -56,46 +594,46 @@ function e(e, r) {
|
|
|
56
594
|
}
|
|
57
595
|
return a;
|
|
58
596
|
}
|
|
59
|
-
}(e,
|
|
597
|
+
}(e, t) || ce(e, t) || function () {
|
|
60
598
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
61
599
|
}();
|
|
62
600
|
}
|
|
63
|
-
function
|
|
601
|
+
function ce(e, t) {
|
|
64
602
|
if (e) {
|
|
65
|
-
if ("string" == typeof e) return
|
|
66
|
-
var
|
|
67
|
-
return "Object" ===
|
|
603
|
+
if ("string" == typeof e) return ue(e, t);
|
|
604
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
605
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ue(e, t) : void 0;
|
|
68
606
|
}
|
|
69
607
|
}
|
|
70
|
-
function
|
|
608
|
+
function ue(e, t) {
|
|
71
609
|
(null == t || t > e.length) && (t = e.length);
|
|
72
610
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
73
611
|
return n;
|
|
74
612
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
613
|
+
function le(e) {
|
|
614
|
+
return le = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
77
615
|
return _typeof(e);
|
|
78
616
|
} : function (e) {
|
|
79
617
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
80
|
-
},
|
|
618
|
+
}, le(e);
|
|
81
619
|
}
|
|
82
|
-
function
|
|
620
|
+
function de() {
|
|
83
621
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
84
|
-
|
|
622
|
+
de = function de() {
|
|
85
623
|
return t;
|
|
86
624
|
};
|
|
87
625
|
var e,
|
|
88
626
|
t = {},
|
|
89
627
|
r = Object.prototype,
|
|
90
|
-
|
|
91
|
-
|
|
628
|
+
n = r.hasOwnProperty,
|
|
629
|
+
i = Object.defineProperty || function (e, t, r) {
|
|
92
630
|
e[t] = r.value;
|
|
93
631
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function
|
|
632
|
+
o = "function" == typeof Symbol ? Symbol : {},
|
|
633
|
+
s = o.iterator || "@@iterator",
|
|
634
|
+
a = o.asyncIterator || "@@asyncIterator",
|
|
635
|
+
c = o.toStringTag || "@@toStringTag";
|
|
636
|
+
function u(e, t, r) {
|
|
99
637
|
return Object.defineProperty(e, t, {
|
|
100
638
|
value: r,
|
|
101
639
|
enumerable: !0,
|
|
@@ -104,21 +642,21 @@ function i() {
|
|
|
104
642
|
}), e[t];
|
|
105
643
|
}
|
|
106
644
|
try {
|
|
107
|
-
|
|
645
|
+
u({}, "");
|
|
108
646
|
} catch (e) {
|
|
109
|
-
|
|
647
|
+
u = function u(e, t, r) {
|
|
110
648
|
return e[t] = r;
|
|
111
649
|
};
|
|
112
650
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
a = new
|
|
117
|
-
return s
|
|
651
|
+
function l(e, t, r, n) {
|
|
652
|
+
var o = t && t.prototype instanceof v ? t : v,
|
|
653
|
+
s = Object.create(o.prototype),
|
|
654
|
+
a = new x(n || []);
|
|
655
|
+
return i(s, "_invoke", {
|
|
118
656
|
value: C(e, r, a)
|
|
119
|
-
}),
|
|
657
|
+
}), s;
|
|
120
658
|
}
|
|
121
|
-
function
|
|
659
|
+
function d(e, t, r) {
|
|
122
660
|
try {
|
|
123
661
|
return {
|
|
124
662
|
type: "normal",
|
|
@@ -131,65 +669,65 @@ function i() {
|
|
|
131
669
|
};
|
|
132
670
|
}
|
|
133
671
|
}
|
|
134
|
-
t.wrap =
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
672
|
+
t.wrap = l;
|
|
673
|
+
var h = "suspendedStart",
|
|
674
|
+
p = "suspendedYield",
|
|
675
|
+
_ = "executing",
|
|
676
|
+
f = "completed",
|
|
677
|
+
m = {};
|
|
678
|
+
function v() {}
|
|
679
|
+
function b() {}
|
|
140
680
|
function g() {}
|
|
141
|
-
|
|
142
|
-
function
|
|
143
|
-
var S = {};
|
|
144
|
-
d(S, c, function () {
|
|
681
|
+
var y = {};
|
|
682
|
+
u(y, s, function () {
|
|
145
683
|
return this;
|
|
146
684
|
});
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
function
|
|
685
|
+
var k = Object.getPrototypeOf,
|
|
686
|
+
w = k && k(k(D([])));
|
|
687
|
+
w && w !== r && n.call(w, s) && (y = w);
|
|
688
|
+
var S = g.prototype = v.prototype = Object.create(y);
|
|
689
|
+
function P(e) {
|
|
152
690
|
["next", "throw", "return"].forEach(function (t) {
|
|
153
|
-
|
|
691
|
+
u(e, t, function (e) {
|
|
154
692
|
return this._invoke(t, e);
|
|
155
693
|
});
|
|
156
694
|
});
|
|
157
695
|
}
|
|
158
|
-
function
|
|
159
|
-
function r(i, s, a
|
|
160
|
-
var
|
|
161
|
-
if ("throw" !==
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
r("next", e,
|
|
696
|
+
function A(e, t) {
|
|
697
|
+
function r(i, o, s, a) {
|
|
698
|
+
var c = d(e[i], e, o);
|
|
699
|
+
if ("throw" !== c.type) {
|
|
700
|
+
var u = c.arg,
|
|
701
|
+
l = u.value;
|
|
702
|
+
return l && "object" == le(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
703
|
+
r("next", e, s, a);
|
|
166
704
|
}, function (e) {
|
|
167
|
-
r("throw", e,
|
|
168
|
-
}) : t.resolve(
|
|
169
|
-
|
|
705
|
+
r("throw", e, s, a);
|
|
706
|
+
}) : t.resolve(l).then(function (e) {
|
|
707
|
+
u.value = e, s(u);
|
|
170
708
|
}, function (e) {
|
|
171
|
-
return r("throw", e,
|
|
709
|
+
return r("throw", e, s, a);
|
|
172
710
|
});
|
|
173
711
|
}
|
|
174
|
-
c
|
|
712
|
+
a(c.arg);
|
|
175
713
|
}
|
|
176
|
-
var
|
|
177
|
-
|
|
714
|
+
var o;
|
|
715
|
+
i(this, "_invoke", {
|
|
178
716
|
value: function value(e, n) {
|
|
179
|
-
function
|
|
717
|
+
function i() {
|
|
180
718
|
return new t(function (t, i) {
|
|
181
719
|
r(e, n, t, i);
|
|
182
720
|
});
|
|
183
721
|
}
|
|
184
|
-
return
|
|
722
|
+
return o = o ? o.then(i, i) : i();
|
|
185
723
|
}
|
|
186
724
|
});
|
|
187
725
|
}
|
|
188
726
|
function C(t, r, n) {
|
|
189
|
-
var i =
|
|
727
|
+
var i = h;
|
|
190
728
|
return function (o, s) {
|
|
191
|
-
if (i ===
|
|
192
|
-
if (i ===
|
|
729
|
+
if (i === _) throw new Error("Generator is already running");
|
|
730
|
+
if (i === f) {
|
|
193
731
|
if ("throw" === o) throw s;
|
|
194
732
|
return {
|
|
195
733
|
value: e,
|
|
@@ -199,95 +737,95 @@ function i() {
|
|
|
199
737
|
for (n.method = o, n.arg = s;;) {
|
|
200
738
|
var a = n.delegate;
|
|
201
739
|
if (a) {
|
|
202
|
-
var c =
|
|
740
|
+
var c = T(a, n);
|
|
203
741
|
if (c) {
|
|
204
|
-
if (c ===
|
|
742
|
+
if (c === m) continue;
|
|
205
743
|
return c;
|
|
206
744
|
}
|
|
207
745
|
}
|
|
208
746
|
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
209
|
-
if (i ===
|
|
747
|
+
if (i === h) throw i = f, n.arg;
|
|
210
748
|
n.dispatchException(n.arg);
|
|
211
749
|
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
212
|
-
i =
|
|
213
|
-
var u =
|
|
750
|
+
i = _;
|
|
751
|
+
var u = d(t, r, n);
|
|
214
752
|
if ("normal" === u.type) {
|
|
215
|
-
if (i = n.done ?
|
|
753
|
+
if (i = n.done ? f : p, u.arg === m) continue;
|
|
216
754
|
return {
|
|
217
755
|
value: u.arg,
|
|
218
756
|
done: n.done
|
|
219
757
|
};
|
|
220
758
|
}
|
|
221
|
-
"throw" === u.type && (i =
|
|
759
|
+
"throw" === u.type && (i = f, n.method = "throw", n.arg = u.arg);
|
|
222
760
|
}
|
|
223
761
|
};
|
|
224
762
|
}
|
|
225
|
-
function
|
|
763
|
+
function T(t, r) {
|
|
226
764
|
var n = r.method,
|
|
227
765
|
i = t.iterator[n];
|
|
228
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
229
|
-
var o =
|
|
230
|
-
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null,
|
|
766
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, T(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
767
|
+
var o = d(i, t.iterator, r.arg);
|
|
768
|
+
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
231
769
|
var s = o.arg;
|
|
232
|
-
return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null,
|
|
770
|
+
return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, m) : s : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, m);
|
|
233
771
|
}
|
|
234
|
-
function
|
|
772
|
+
function O(e) {
|
|
235
773
|
var t = {
|
|
236
774
|
tryLoc: e[0]
|
|
237
775
|
};
|
|
238
776
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
239
777
|
}
|
|
240
|
-
function
|
|
778
|
+
function E(e) {
|
|
241
779
|
var t = e.completion || {};
|
|
242
780
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
243
781
|
}
|
|
244
|
-
function
|
|
782
|
+
function x(e) {
|
|
245
783
|
this.tryEntries = [{
|
|
246
784
|
tryLoc: "root"
|
|
247
|
-
}], e.forEach(
|
|
785
|
+
}], e.forEach(O, this), this.reset(!0);
|
|
248
786
|
}
|
|
249
787
|
function D(t) {
|
|
250
788
|
if (t || "" === t) {
|
|
251
|
-
var r = t[
|
|
789
|
+
var r = t[s];
|
|
252
790
|
if (r) return r.call(t);
|
|
253
791
|
if ("function" == typeof t.next) return t;
|
|
254
792
|
if (!isNaN(t.length)) {
|
|
255
793
|
var i = -1,
|
|
256
|
-
|
|
257
|
-
for (; ++i < t.length;) if (
|
|
794
|
+
o = function r() {
|
|
795
|
+
for (; ++i < t.length;) if (n.call(t, i)) return r.value = t[i], r.done = !1, r;
|
|
258
796
|
return r.value = e, r.done = !0, r;
|
|
259
797
|
};
|
|
260
|
-
return
|
|
798
|
+
return o.next = o;
|
|
261
799
|
}
|
|
262
800
|
}
|
|
263
|
-
throw new TypeError(
|
|
801
|
+
throw new TypeError(le(t) + " is not iterable");
|
|
264
802
|
}
|
|
265
|
-
return
|
|
266
|
-
value:
|
|
803
|
+
return b.prototype = g, i(S, "constructor", {
|
|
804
|
+
value: g,
|
|
267
805
|
configurable: !0
|
|
268
|
-
}),
|
|
269
|
-
value:
|
|
806
|
+
}), i(g, "constructor", {
|
|
807
|
+
value: b,
|
|
270
808
|
configurable: !0
|
|
271
|
-
}),
|
|
809
|
+
}), b.displayName = u(g, c, "GeneratorFunction"), t.isGeneratorFunction = function (e) {
|
|
272
810
|
var t = "function" == typeof e && e.constructor;
|
|
273
|
-
return !!t && (t ===
|
|
811
|
+
return !!t && (t === b || "GeneratorFunction" === (t.displayName || t.name));
|
|
274
812
|
}, t.mark = function (e) {
|
|
275
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e,
|
|
813
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, g) : (e.__proto__ = g, u(e, c, "GeneratorFunction")), e.prototype = Object.create(S), e;
|
|
276
814
|
}, t.awrap = function (e) {
|
|
277
815
|
return {
|
|
278
816
|
__await: e
|
|
279
817
|
};
|
|
280
|
-
},
|
|
818
|
+
}, P(A.prototype), u(A.prototype, a, function () {
|
|
281
819
|
return this;
|
|
282
|
-
}), t.AsyncIterator =
|
|
820
|
+
}), t.AsyncIterator = A, t.async = function (e, r, n, i, o) {
|
|
283
821
|
void 0 === o && (o = Promise);
|
|
284
|
-
var s = new
|
|
822
|
+
var s = new A(l(e, r, n, i), o);
|
|
285
823
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
286
824
|
return e.done ? e.value : s.next();
|
|
287
825
|
});
|
|
288
|
-
},
|
|
826
|
+
}, P(S), u(S, c, "Generator"), u(S, s, function () {
|
|
289
827
|
return this;
|
|
290
|
-
}),
|
|
828
|
+
}), u(S, "toString", function () {
|
|
291
829
|
return "[object Generator]";
|
|
292
830
|
}), t.keys = function (e) {
|
|
293
831
|
var t = Object(e),
|
|
@@ -300,10 +838,10 @@ function i() {
|
|
|
300
838
|
}
|
|
301
839
|
return e.done = !0, e;
|
|
302
840
|
};
|
|
303
|
-
}, t.values = D,
|
|
304
|
-
constructor:
|
|
841
|
+
}, t.values = D, x.prototype = {
|
|
842
|
+
constructor: x,
|
|
305
843
|
reset: function reset(t) {
|
|
306
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(
|
|
844
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(E), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
307
845
|
},
|
|
308
846
|
stop: function stop() {
|
|
309
847
|
this.done = !0;
|
|
@@ -314,48 +852,48 @@ function i() {
|
|
|
314
852
|
dispatchException: function dispatchException(t) {
|
|
315
853
|
if (this.done) throw t;
|
|
316
854
|
var r = this;
|
|
317
|
-
function
|
|
855
|
+
function i(n, i) {
|
|
318
856
|
return a.type = "throw", a.arg = t, r.next = n, i && (r.method = "next", r.arg = e), !!i;
|
|
319
857
|
}
|
|
320
|
-
for (var
|
|
321
|
-
var s = this.tryEntries[
|
|
858
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
859
|
+
var s = this.tryEntries[o],
|
|
322
860
|
a = s.completion;
|
|
323
|
-
if ("root" === s.tryLoc) return
|
|
861
|
+
if ("root" === s.tryLoc) return i("end");
|
|
324
862
|
if (s.tryLoc <= this.prev) {
|
|
325
|
-
var c =
|
|
326
|
-
u =
|
|
863
|
+
var c = n.call(s, "catchLoc"),
|
|
864
|
+
u = n.call(s, "finallyLoc");
|
|
327
865
|
if (c && u) {
|
|
328
|
-
if (this.prev < s.catchLoc) return
|
|
329
|
-
if (this.prev < s.finallyLoc) return
|
|
866
|
+
if (this.prev < s.catchLoc) return i(s.catchLoc, !0);
|
|
867
|
+
if (this.prev < s.finallyLoc) return i(s.finallyLoc);
|
|
330
868
|
} else if (c) {
|
|
331
|
-
if (this.prev < s.catchLoc) return
|
|
869
|
+
if (this.prev < s.catchLoc) return i(s.catchLoc, !0);
|
|
332
870
|
} else {
|
|
333
871
|
if (!u) throw new Error("try statement without catch or finally");
|
|
334
|
-
if (this.prev < s.finallyLoc) return
|
|
872
|
+
if (this.prev < s.finallyLoc) return i(s.finallyLoc);
|
|
335
873
|
}
|
|
336
874
|
}
|
|
337
875
|
}
|
|
338
876
|
},
|
|
339
877
|
abrupt: function abrupt(e, t) {
|
|
340
878
|
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
341
|
-
var
|
|
342
|
-
if (
|
|
343
|
-
var
|
|
879
|
+
var i = this.tryEntries[r];
|
|
880
|
+
if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
|
|
881
|
+
var o = i;
|
|
344
882
|
break;
|
|
345
883
|
}
|
|
346
884
|
}
|
|
347
|
-
|
|
348
|
-
var s =
|
|
349
|
-
return s.type = e, s.arg = t,
|
|
885
|
+
o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null);
|
|
886
|
+
var s = o ? o.completion : {};
|
|
887
|
+
return s.type = e, s.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, m) : this.complete(s);
|
|
350
888
|
},
|
|
351
889
|
complete: function complete(e, t) {
|
|
352
890
|
if ("throw" === e.type) throw e.arg;
|
|
353
|
-
return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t),
|
|
891
|
+
return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), m;
|
|
354
892
|
},
|
|
355
893
|
finish: function finish(e) {
|
|
356
894
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
357
895
|
var r = this.tryEntries[t];
|
|
358
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
896
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), E(r), m;
|
|
359
897
|
}
|
|
360
898
|
},
|
|
361
899
|
"catch": function _catch(e) {
|
|
@@ -365,7 +903,7 @@ function i() {
|
|
|
365
903
|
var n = r.completion;
|
|
366
904
|
if ("throw" === n.type) {
|
|
367
905
|
var i = n.arg;
|
|
368
|
-
|
|
906
|
+
E(r);
|
|
369
907
|
}
|
|
370
908
|
return i;
|
|
371
909
|
}
|
|
@@ -377,69 +915,56 @@ function i() {
|
|
|
377
915
|
iterator: D(t),
|
|
378
916
|
resultName: r,
|
|
379
917
|
nextLoc: n
|
|
380
|
-
}, "next" === this.method && (this.arg = e),
|
|
918
|
+
}, "next" === this.method && (this.arg = e), m;
|
|
381
919
|
}
|
|
382
920
|
}, t;
|
|
383
921
|
}
|
|
384
|
-
function
|
|
922
|
+
function he(e, t) {
|
|
385
923
|
for (var r = 0; r < t.length; r++) {
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
if ("object" !==
|
|
924
|
+
var n = t[r];
|
|
925
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
|
|
926
|
+
if ("object" !== le(e) || null === e) return e;
|
|
389
927
|
var r = e[Symbol.toPrimitive];
|
|
390
928
|
if (void 0 !== r) {
|
|
391
|
-
var
|
|
392
|
-
if ("object" !== n
|
|
929
|
+
var n = r.call(e, t || "default");
|
|
930
|
+
if ("object" !== le(n)) return n;
|
|
393
931
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
394
932
|
}
|
|
395
933
|
return ("string" === t ? String : Number)(e);
|
|
396
|
-
}(
|
|
934
|
+
}(i, "string"), "symbol" === le(o) ? o : String(o)), n);
|
|
397
935
|
}
|
|
398
|
-
var
|
|
936
|
+
var i, o;
|
|
399
937
|
}
|
|
400
|
-
function
|
|
401
|
-
return t &&
|
|
938
|
+
function pe(e, t, r) {
|
|
939
|
+
return t && he(e.prototype, t), r && he(e, r), Object.defineProperty(e, "prototype", {
|
|
402
940
|
writable: !1
|
|
403
941
|
}), e;
|
|
404
942
|
}
|
|
405
|
-
function
|
|
943
|
+
function _e(e, t) {
|
|
406
944
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
407
945
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
410
|
-
e.prototype = Object.create(t && t.prototype, {
|
|
411
|
-
constructor: {
|
|
412
|
-
value: e,
|
|
413
|
-
writable: !0,
|
|
414
|
-
configurable: !0
|
|
415
|
-
}
|
|
416
|
-
}), Object.defineProperty(e, "prototype", {
|
|
417
|
-
writable: !1
|
|
418
|
-
}), t && _(e, t);
|
|
419
|
-
}
|
|
420
|
-
function u(e) {
|
|
421
|
-
var t = p();
|
|
946
|
+
function fe(e) {
|
|
947
|
+
var t = be();
|
|
422
948
|
return function () {
|
|
423
949
|
var r,
|
|
424
|
-
|
|
950
|
+
n = ye(e);
|
|
425
951
|
if (t) {
|
|
426
|
-
var
|
|
427
|
-
r = Reflect.construct(
|
|
428
|
-
} else r =
|
|
952
|
+
var i = ye(this).constructor;
|
|
953
|
+
r = Reflect.construct(n, arguments, i);
|
|
954
|
+
} else r = n.apply(this, arguments);
|
|
429
955
|
return function (e, t) {
|
|
430
|
-
if (t && ("object" ===
|
|
956
|
+
if (t && ("object" === le(t) || "function" == typeof t)) return t;
|
|
431
957
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
432
|
-
return
|
|
958
|
+
return function (e) {
|
|
959
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
960
|
+
return e;
|
|
961
|
+
}(e);
|
|
433
962
|
}(this, r);
|
|
434
963
|
};
|
|
435
964
|
}
|
|
436
|
-
function
|
|
437
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
438
|
-
return e;
|
|
439
|
-
}
|
|
440
|
-
function d(e) {
|
|
965
|
+
function me(e) {
|
|
441
966
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
442
|
-
return
|
|
967
|
+
return me = function me(e) {
|
|
443
968
|
if (null === e || !function (e) {
|
|
444
969
|
try {
|
|
445
970
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -453,7 +978,7 @@ function d(e) {
|
|
|
453
978
|
t.set(e, r);
|
|
454
979
|
}
|
|
455
980
|
function r() {
|
|
456
|
-
return
|
|
981
|
+
return ve(e, arguments, ye(this).constructor);
|
|
457
982
|
}
|
|
458
983
|
return r.prototype = Object.create(e.prototype, {
|
|
459
984
|
constructor: {
|
|
@@ -462,18 +987,18 @@ function d(e) {
|
|
|
462
987
|
writable: !0,
|
|
463
988
|
configurable: !0
|
|
464
989
|
}
|
|
465
|
-
}),
|
|
466
|
-
},
|
|
990
|
+
}), ge(r, e);
|
|
991
|
+
}, me(e);
|
|
467
992
|
}
|
|
468
|
-
function
|
|
469
|
-
return
|
|
993
|
+
function ve(e, t, r) {
|
|
994
|
+
return ve = be() ? Reflect.construct.bind() : function (e, t, r) {
|
|
470
995
|
var n = [null];
|
|
471
996
|
n.push.apply(n, t);
|
|
472
997
|
var i = new (Function.bind.apply(e, n))();
|
|
473
|
-
return r &&
|
|
474
|
-
},
|
|
998
|
+
return r && ge(i, r.prototype), i;
|
|
999
|
+
}, ve.apply(null, arguments);
|
|
475
1000
|
}
|
|
476
|
-
function
|
|
1001
|
+
function be() {
|
|
477
1002
|
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
478
1003
|
if (Reflect.construct.sham) return !1;
|
|
479
1004
|
if ("function" == typeof Proxy) return !0;
|
|
@@ -483,18 +1008,25 @@ function p() {
|
|
|
483
1008
|
return !1;
|
|
484
1009
|
}
|
|
485
1010
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
1011
|
+
function ge(e, t) {
|
|
1012
|
+
return ge = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
488
1013
|
return e.__proto__ = t, e;
|
|
489
|
-
},
|
|
1014
|
+
}, ge(e, t);
|
|
490
1015
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
1016
|
+
function ye(e) {
|
|
1017
|
+
return ye = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
493
1018
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
494
|
-
},
|
|
1019
|
+
}, ye(e);
|
|
495
1020
|
}
|
|
496
|
-
|
|
497
|
-
|
|
1021
|
+
!function (e) {
|
|
1022
|
+
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
1023
|
+
}(b || (b = {})), function (e) {
|
|
1024
|
+
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
1025
|
+
}(g || (g = {})), function (e) {
|
|
1026
|
+
e.Google = "google", e.Microsoft = "microsoft";
|
|
1027
|
+
}(y || (y = {}));
|
|
1028
|
+
var ke;
|
|
1029
|
+
function we(e, t, r, n) {
|
|
498
1030
|
return new (r || (r = Promise))(function (i, o) {
|
|
499
1031
|
function s(e) {
|
|
500
1032
|
try {
|
|
@@ -519,168 +1051,105 @@ function S(e, t, r, n) {
|
|
|
519
1051
|
c((n = n.apply(e, t || [])).next());
|
|
520
1052
|
});
|
|
521
1053
|
}
|
|
522
|
-
"function" == typeof SuppressedError && SuppressedError,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
T,
|
|
539
|
-
P,
|
|
540
|
-
C = function (e) {
|
|
541
|
-
c(r, d(Error));
|
|
542
|
-
var t = u(r);
|
|
543
|
-
function r(e, n) {
|
|
544
|
-
var i;
|
|
545
|
-
return a(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(l(i), r.prototype), i;
|
|
546
|
-
}
|
|
547
|
-
return s(r);
|
|
548
|
-
}(),
|
|
549
|
-
O = function (e) {
|
|
550
|
-
c(r, d(Error));
|
|
551
|
-
var t = u(r);
|
|
552
|
-
function r(e, n) {
|
|
553
|
-
var i;
|
|
554
|
-
return a(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
555
|
-
}
|
|
556
|
-
return s(r);
|
|
557
|
-
}(),
|
|
558
|
-
x = function (e) {
|
|
559
|
-
c(r, d(Error));
|
|
560
|
-
var t = u(r);
|
|
561
|
-
function r(e) {
|
|
562
|
-
var n, i;
|
|
563
|
-
a(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
564
|
-
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
565
|
-
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
566
|
-
}).join("\n");
|
|
567
|
-
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
568
|
-
}
|
|
569
|
-
return s(r);
|
|
570
|
-
}(),
|
|
571
|
-
B = function (e) {
|
|
572
|
-
c(r, d(Error));
|
|
573
|
-
var t = u(r);
|
|
574
|
-
function r(e) {
|
|
575
|
-
var n;
|
|
576
|
-
a(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
577
|
-
var i = e.status_code,
|
|
578
|
-
o = e.error_type,
|
|
579
|
-
s = e.error_message,
|
|
580
|
-
c = e.error_url,
|
|
581
|
-
u = e.request_id;
|
|
582
|
-
return n.error_type = o, n.error_message = s, n.error_url = c, n.request_id = u, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), n;
|
|
583
|
-
}
|
|
584
|
-
return s(r);
|
|
585
|
-
}(),
|
|
586
|
-
R = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
587
|
-
!function (e) {
|
|
588
|
-
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";
|
|
589
|
-
}(w || (w = {})), function (e) {
|
|
590
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
591
|
-
}(A || (A = {})), function (e) {
|
|
592
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
593
|
-
}(E || (E = {})), function (e) {
|
|
594
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
595
|
-
}(T || (T = {})), (P || (P = {})).RequiredCatcha = "Catcha Required";
|
|
596
|
-
var D,
|
|
597
|
-
I = function (e) {
|
|
598
|
-
c(r, d(Error));
|
|
599
|
-
var t = u(r);
|
|
1054
|
+
"function" == typeof SuppressedError && SuppressedError, (ke || (ke = {})).RequiredCatcha = "Catcha Required";
|
|
1055
|
+
var Se,
|
|
1056
|
+
Pe = function (e) {
|
|
1057
|
+
!function (e, t) {
|
|
1058
|
+
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
1059
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
1060
|
+
constructor: {
|
|
1061
|
+
value: e,
|
|
1062
|
+
writable: !0,
|
|
1063
|
+
configurable: !0
|
|
1064
|
+
}
|
|
1065
|
+
}), Object.defineProperty(e, "prototype", {
|
|
1066
|
+
writable: !1
|
|
1067
|
+
}), t && ge(e, t);
|
|
1068
|
+
}(r, me(Error));
|
|
1069
|
+
var t = fe(r);
|
|
600
1070
|
function r(e) {
|
|
601
1071
|
var n;
|
|
602
|
-
return
|
|
1072
|
+
return _e(this, r), (n = t.call(this, e)).type = e, n;
|
|
603
1073
|
}
|
|
604
|
-
return
|
|
1074
|
+
return pe(r);
|
|
605
1075
|
}();
|
|
606
|
-
function
|
|
1076
|
+
function Ae(e) {
|
|
607
1077
|
var t,
|
|
608
1078
|
r = e.method,
|
|
609
|
-
n = e.
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return i().wrap(function (e) {
|
|
1079
|
+
n = e.finalURL,
|
|
1080
|
+
i = e.basicAuthHeader,
|
|
1081
|
+
o = e.xSDKClientHeader,
|
|
1082
|
+
s = e.xSDKParentHostHeader,
|
|
1083
|
+
a = e.body;
|
|
1084
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1085
|
+
var c, u, l, d, h, p;
|
|
1086
|
+
return de().wrap(function (e) {
|
|
618
1087
|
for (;;) switch (e.prev = e.next) {
|
|
619
1088
|
case 0:
|
|
620
|
-
return
|
|
621
|
-
Authorization:
|
|
1089
|
+
return c = {
|
|
1090
|
+
Authorization: i,
|
|
622
1091
|
"Content-Type": "application/json",
|
|
623
|
-
"X-SDK-Client":
|
|
624
|
-
},
|
|
1092
|
+
"X-SDK-Client": o
|
|
1093
|
+
}, s && (c["X-SDK-Parent-Host"] = s), u = {
|
|
625
1094
|
method: r,
|
|
626
|
-
headers:
|
|
627
|
-
body:
|
|
628
|
-
}, e.prev = 3, e.next = 6, fetch(
|
|
1095
|
+
headers: c,
|
|
1096
|
+
body: a && JSON.stringify(a)
|
|
1097
|
+
}, e.prev = 3, e.next = 6, fetch(n, u);
|
|
629
1098
|
case 6:
|
|
630
|
-
|
|
1099
|
+
l = e.sent, e.next = 14;
|
|
631
1100
|
break;
|
|
632
1101
|
case 9:
|
|
633
1102
|
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
634
1103
|
e.next = 13;
|
|
635
1104
|
break;
|
|
636
1105
|
}
|
|
637
|
-
throw new
|
|
1106
|
+
throw new T("Unable to contact the Stytch servers. Are you online?");
|
|
638
1107
|
case 13:
|
|
639
1108
|
throw e.t0;
|
|
640
1109
|
case 14:
|
|
641
|
-
if (!(
|
|
1110
|
+
if (!(l.status <= 299)) {
|
|
642
1111
|
e.next = 25;
|
|
643
1112
|
break;
|
|
644
1113
|
}
|
|
645
|
-
return e.prev = 15, e.next = 18,
|
|
1114
|
+
return e.prev = 15, e.next = 18, l.json();
|
|
646
1115
|
case 18:
|
|
647
|
-
return
|
|
1116
|
+
return d = e.sent, e.abrupt("return", d.data);
|
|
648
1117
|
case 22:
|
|
649
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
1118
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new T("Invalid JSON response from the Stytch servers.");
|
|
650
1119
|
case 25:
|
|
651
|
-
if (200 ===
|
|
1120
|
+
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
652
1121
|
e.next = 38;
|
|
653
1122
|
break;
|
|
654
1123
|
}
|
|
655
|
-
return e.prev = 26, e.next = 29,
|
|
1124
|
+
return e.prev = 26, e.next = 29, l.json();
|
|
656
1125
|
case 29:
|
|
657
|
-
|
|
1126
|
+
h = e.sent, e.next = 35;
|
|
658
1127
|
break;
|
|
659
1128
|
case 32:
|
|
660
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
1129
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new T("Invalid or no response from server");
|
|
661
1130
|
case 35:
|
|
662
|
-
if (!("body" in
|
|
1131
|
+
if (!("body" in h || "params" in h || "query" in h)) {
|
|
663
1132
|
e.next = 37;
|
|
664
1133
|
break;
|
|
665
1134
|
}
|
|
666
|
-
throw new
|
|
1135
|
+
throw new O(h);
|
|
667
1136
|
case 37:
|
|
668
|
-
throw new
|
|
1137
|
+
throw new E(h);
|
|
669
1138
|
case 38:
|
|
670
|
-
return e.prev = 38, e.next = 41,
|
|
1139
|
+
return e.prev = 38, e.next = 41, l.text();
|
|
671
1140
|
case 41:
|
|
672
|
-
|
|
1141
|
+
p = e.sent, e.next = 47;
|
|
673
1142
|
break;
|
|
674
1143
|
case 44:
|
|
675
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
1144
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new T("Invalid response from the Stytch servers.");
|
|
676
1145
|
case 47:
|
|
677
|
-
if (!
|
|
1146
|
+
if (!p.includes("Captcha required")) {
|
|
678
1147
|
e.next = 49;
|
|
679
1148
|
break;
|
|
680
1149
|
}
|
|
681
|
-
throw new
|
|
1150
|
+
throw new Pe(ke.RequiredCatcha);
|
|
682
1151
|
case 49:
|
|
683
|
-
throw new
|
|
1152
|
+
throw new T("Invalid response from the Stytch servers.");
|
|
684
1153
|
case 50:
|
|
685
1154
|
case "end":
|
|
686
1155
|
return e.stop();
|
|
@@ -688,43 +1157,43 @@ function L(e) {
|
|
|
688
1157
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
689
1158
|
}));
|
|
690
1159
|
}
|
|
691
|
-
var
|
|
692
|
-
function
|
|
693
|
-
if (!
|
|
694
|
-
return
|
|
1160
|
+
var Ce = new Uint8Array(16);
|
|
1161
|
+
function Te() {
|
|
1162
|
+
if (!Se && !(Se = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1163
|
+
return Se(Ce);
|
|
695
1164
|
}
|
|
696
|
-
var
|
|
697
|
-
for (var
|
|
698
|
-
function
|
|
1165
|
+
var Oe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1166
|
+
for (var Ee = [], xe = 0; xe < 256; ++xe) Ee.push((xe + 256).toString(16).substr(1));
|
|
1167
|
+
function De(e) {
|
|
699
1168
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
700
|
-
r = (
|
|
1169
|
+
r = (Ee[e[t + 0]] + Ee[e[t + 1]] + Ee[e[t + 2]] + Ee[e[t + 3]] + "-" + Ee[e[t + 4]] + Ee[e[t + 5]] + "-" + Ee[e[t + 6]] + Ee[e[t + 7]] + "-" + Ee[e[t + 8]] + Ee[e[t + 9]] + "-" + Ee[e[t + 10]] + Ee[e[t + 11]] + Ee[e[t + 12]] + Ee[e[t + 13]] + Ee[e[t + 14]] + Ee[e[t + 15]]).toLowerCase();
|
|
701
1170
|
if (!function (e) {
|
|
702
|
-
return "string" == typeof e &&
|
|
1171
|
+
return "string" == typeof e && Oe.test(e);
|
|
703
1172
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
704
1173
|
return r;
|
|
705
1174
|
}
|
|
706
|
-
function
|
|
707
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1175
|
+
function Re(e, t, r) {
|
|
1176
|
+
var n = (e = e || {}).random || (e.rng || Te)();
|
|
708
1177
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
709
1178
|
r = r || 0;
|
|
710
1179
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
711
1180
|
return t;
|
|
712
1181
|
}
|
|
713
|
-
return
|
|
1182
|
+
return De(n);
|
|
714
1183
|
}
|
|
715
|
-
var
|
|
716
|
-
function
|
|
717
|
-
return
|
|
718
|
-
return
|
|
1184
|
+
var Ie = {};
|
|
1185
|
+
function Be(e, t) {
|
|
1186
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1187
|
+
return de().wrap(function (r) {
|
|
719
1188
|
for (;;) switch (r.prev = r.next) {
|
|
720
1189
|
case 0:
|
|
721
|
-
if (void 0 ===
|
|
1190
|
+
if (void 0 === Ie[e]) {
|
|
722
1191
|
r.next = 2;
|
|
723
1192
|
break;
|
|
724
1193
|
}
|
|
725
|
-
return r.abrupt("return",
|
|
1194
|
+
return r.abrupt("return", Ie[e]);
|
|
726
1195
|
case 2:
|
|
727
|
-
return
|
|
1196
|
+
return Ie[e] = Le(e, t), r.abrupt("return", Ie[e]);
|
|
728
1197
|
case 4:
|
|
729
1198
|
case "end":
|
|
730
1199
|
return r.stop();
|
|
@@ -732,10 +1201,10 @@ function H(e, t) {
|
|
|
732
1201
|
}, r);
|
|
733
1202
|
}));
|
|
734
1203
|
}
|
|
735
|
-
function
|
|
1204
|
+
function Le(e, t) {
|
|
736
1205
|
return new Promise(function (r, n) {
|
|
737
1206
|
var i = function (e) {
|
|
738
|
-
var t =
|
|
1207
|
+
var t = Me(e);
|
|
739
1208
|
if (t[0]) return t[0];
|
|
740
1209
|
}(e);
|
|
741
1210
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -759,130 +1228,130 @@ function G(e, t) {
|
|
|
759
1228
|
});
|
|
760
1229
|
});
|
|
761
1230
|
}
|
|
762
|
-
var
|
|
1231
|
+
var Me = function Me(e) {
|
|
763
1232
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
764
1233
|
};
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
|
|
1234
|
+
var je,
|
|
1235
|
+
Fe = ["[Stytch]"],
|
|
1236
|
+
Ne = function Ne() {
|
|
768
1237
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
769
|
-
return (e = console).warn.apply(e,
|
|
1238
|
+
return (e = console).warn.apply(e, Fe.concat(r));
|
|
770
1239
|
},
|
|
771
|
-
|
|
1240
|
+
Ke = function Ke() {
|
|
772
1241
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
773
|
-
return (e = console).error.apply(e,
|
|
1242
|
+
return (e = console).error.apply(e, Fe.concat(r));
|
|
774
1243
|
},
|
|
775
|
-
|
|
776
|
-
|
|
1244
|
+
Ue = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1245
|
+
ze = function ze(e) {
|
|
777
1246
|
return e.includes("public-token-test");
|
|
778
1247
|
},
|
|
779
|
-
|
|
780
|
-
var
|
|
781
|
-
isObject: function isObject(
|
|
782
|
-
var
|
|
783
|
-
if (!
|
|
784
|
-
return
|
|
1248
|
+
qe = function qe(e) {
|
|
1249
|
+
var t = {
|
|
1250
|
+
isObject: function isObject(r, n) {
|
|
1251
|
+
var i = "object" === le(n) && !Array.isArray(n) && null !== n;
|
|
1252
|
+
if (!i) throw new w(e, r + " must be an object.");
|
|
1253
|
+
return t;
|
|
785
1254
|
},
|
|
786
|
-
isOptionalObject: function isOptionalObject(e,
|
|
787
|
-
return void 0 ===
|
|
1255
|
+
isOptionalObject: function isOptionalObject(e, r) {
|
|
1256
|
+
return void 0 === r ? t : t.isObject(e, r);
|
|
788
1257
|
},
|
|
789
|
-
isString: function isString(
|
|
790
|
-
if ("string" != typeof n) throw new
|
|
791
|
-
return
|
|
1258
|
+
isString: function isString(r, n) {
|
|
1259
|
+
if ("string" != typeof n) throw new w(e, r + " must be a string.");
|
|
1260
|
+
return t;
|
|
792
1261
|
},
|
|
793
|
-
isOptionalString: function isOptionalString(e,
|
|
794
|
-
return void 0 ===
|
|
1262
|
+
isOptionalString: function isOptionalString(e, r) {
|
|
1263
|
+
return void 0 === r ? t : t.isString(e, r);
|
|
795
1264
|
},
|
|
796
|
-
isStringArray: function isStringArray(
|
|
797
|
-
if (!Array.isArray(
|
|
798
|
-
var
|
|
799
|
-
|
|
800
|
-
var
|
|
801
|
-
if (!
|
|
802
|
-
if (Array.isArray(e) || (
|
|
803
|
-
|
|
804
|
-
var
|
|
805
|
-
|
|
1265
|
+
isStringArray: function isStringArray(r, n) {
|
|
1266
|
+
if (!Array.isArray(n)) throw new w(e, r + " must be an array of strings.");
|
|
1267
|
+
var i,
|
|
1268
|
+
o = function (e, t) {
|
|
1269
|
+
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1270
|
+
if (!r) {
|
|
1271
|
+
if (Array.isArray(e) || (r = ce(e)) || t && e && "number" == typeof e.length) {
|
|
1272
|
+
r && (e = r);
|
|
1273
|
+
var _n = 0,
|
|
1274
|
+
i = function i() {};
|
|
806
1275
|
return {
|
|
807
|
-
s:
|
|
1276
|
+
s: i,
|
|
808
1277
|
n: function n() {
|
|
809
|
-
return
|
|
1278
|
+
return _n >= e.length ? {
|
|
810
1279
|
done: !0
|
|
811
1280
|
} : {
|
|
812
1281
|
done: !1,
|
|
813
|
-
value: e[
|
|
1282
|
+
value: e[_n++]
|
|
814
1283
|
};
|
|
815
1284
|
},
|
|
816
1285
|
e: function e(_e2) {
|
|
817
1286
|
throw _e2;
|
|
818
1287
|
},
|
|
819
|
-
f:
|
|
1288
|
+
f: i
|
|
820
1289
|
};
|
|
821
1290
|
}
|
|
822
1291
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
823
1292
|
}
|
|
824
|
-
var
|
|
825
|
-
|
|
826
|
-
|
|
1293
|
+
var o,
|
|
1294
|
+
s = !0,
|
|
1295
|
+
a = !1;
|
|
827
1296
|
return {
|
|
828
1297
|
s: function s() {
|
|
829
|
-
|
|
1298
|
+
r = r.call(e);
|
|
830
1299
|
},
|
|
831
1300
|
n: function n() {
|
|
832
|
-
var e =
|
|
833
|
-
return
|
|
1301
|
+
var e = r.next();
|
|
1302
|
+
return s = e.done, e;
|
|
834
1303
|
},
|
|
835
1304
|
e: function e(_e3) {
|
|
836
|
-
|
|
1305
|
+
a = !0, o = _e3;
|
|
837
1306
|
},
|
|
838
1307
|
f: function f() {
|
|
839
1308
|
try {
|
|
840
|
-
|
|
1309
|
+
s || null == r["return"] || r["return"]();
|
|
841
1310
|
} finally {
|
|
842
|
-
if (
|
|
1311
|
+
if (a) throw o;
|
|
843
1312
|
}
|
|
844
1313
|
}
|
|
845
1314
|
};
|
|
846
|
-
}(
|
|
1315
|
+
}(n);
|
|
847
1316
|
try {
|
|
848
|
-
for (
|
|
849
|
-
if ("string" != typeof
|
|
1317
|
+
for (o.s(); !(i = o.n()).done;) {
|
|
1318
|
+
if ("string" != typeof i.value) throw new w(e, r + " must be an array of strings.");
|
|
850
1319
|
}
|
|
851
1320
|
} catch (e) {
|
|
852
|
-
|
|
1321
|
+
o.e(e);
|
|
853
1322
|
} finally {
|
|
854
|
-
|
|
1323
|
+
o.f();
|
|
855
1324
|
}
|
|
856
|
-
return
|
|
1325
|
+
return t;
|
|
857
1326
|
},
|
|
858
|
-
isOptionalStringArray: function isOptionalStringArray(e,
|
|
859
|
-
return void 0 ===
|
|
1327
|
+
isOptionalStringArray: function isOptionalStringArray(e, r) {
|
|
1328
|
+
return void 0 === r ? t : t.isStringArray(e, r);
|
|
860
1329
|
},
|
|
861
|
-
isNumber: function isNumber(
|
|
862
|
-
if ("number" != typeof n) throw new
|
|
863
|
-
return
|
|
1330
|
+
isNumber: function isNumber(r, n) {
|
|
1331
|
+
if ("number" != typeof n) throw new w(e, r + " must be a number.");
|
|
1332
|
+
return t;
|
|
864
1333
|
},
|
|
865
|
-
isOptionalNumber: function isOptionalNumber(e,
|
|
866
|
-
return void 0 ===
|
|
1334
|
+
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1335
|
+
return void 0 === r ? t : t.isNumber(e, r);
|
|
867
1336
|
},
|
|
868
|
-
isBoolean: function isBoolean(
|
|
869
|
-
if ("boolean" != typeof n) throw new
|
|
870
|
-
return
|
|
1337
|
+
isBoolean: function isBoolean(r, n) {
|
|
1338
|
+
if ("boolean" != typeof n) throw new w(e, r + " must be a boolean.");
|
|
1339
|
+
return t;
|
|
871
1340
|
},
|
|
872
|
-
isOptionalBoolean: function isOptionalBoolean(e,
|
|
873
|
-
return void 0 ===
|
|
1341
|
+
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
1342
|
+
return void 0 === r ? t : t.isBoolean(e, r);
|
|
874
1343
|
}
|
|
875
1344
|
};
|
|
876
|
-
return
|
|
1345
|
+
return t;
|
|
877
1346
|
},
|
|
878
|
-
|
|
879
|
-
var
|
|
880
|
-
|
|
1347
|
+
We = pe(function e(t, r, n) {
|
|
1348
|
+
var i = this,
|
|
1349
|
+
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
881
1350
|
return Promise.resolve(void 0);
|
|
882
1351
|
};
|
|
883
|
-
|
|
884
|
-
return
|
|
885
|
-
return
|
|
1352
|
+
_e(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1353
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1354
|
+
return de().wrap(function (e) {
|
|
886
1355
|
for (;;) switch (e.prev = e.next) {
|
|
887
1356
|
case 0:
|
|
888
1357
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -895,20 +1364,20 @@ var Y,
|
|
|
895
1364
|
}, e, this);
|
|
896
1365
|
}));
|
|
897
1366
|
}, this.getTelemetryID = function () {
|
|
898
|
-
return
|
|
899
|
-
var t, r, n,
|
|
900
|
-
return
|
|
1367
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1368
|
+
var t, r, n, i;
|
|
1369
|
+
return de().wrap(function (e) {
|
|
901
1370
|
for (;;) switch (e.prev = e.next) {
|
|
902
1371
|
case 0:
|
|
903
1372
|
return e.next = 2, this.state;
|
|
904
1373
|
case 2:
|
|
905
|
-
if (t = e.sent, r = t.publicToken, n = t.enabled,
|
|
1374
|
+
if (t = e.sent, r = t.publicToken, n = t.enabled, i = t.dfpBackendURL, n) {
|
|
906
1375
|
e.next = 8;
|
|
907
1376
|
break;
|
|
908
1377
|
}
|
|
909
1378
|
return e.abrupt("return", void 0);
|
|
910
1379
|
case 8:
|
|
911
|
-
return e.next = 10, window.GetTelemetryID(r, "".concat(
|
|
1380
|
+
return e.next = 10, window.GetTelemetryID(r, "".concat(i, "/submit"));
|
|
912
1381
|
case 10:
|
|
913
1382
|
return e.abrupt("return", e.sent);
|
|
914
1383
|
case 11:
|
|
@@ -918,43 +1387,43 @@ var Y,
|
|
|
918
1387
|
}, e, this);
|
|
919
1388
|
}));
|
|
920
1389
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
921
|
-
return
|
|
922
|
-
var t, r, n, o, s
|
|
923
|
-
return
|
|
1390
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1391
|
+
var t, r, n, i, o, s;
|
|
1392
|
+
return de().wrap(function (e) {
|
|
924
1393
|
for (;;) switch (e.prev = e.next) {
|
|
925
1394
|
case 0:
|
|
926
1395
|
return e.next = 2, this.state;
|
|
927
1396
|
case 2:
|
|
928
|
-
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha,
|
|
1397
|
+
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = t.mode, o = void 0, s = void 0, r) {
|
|
929
1398
|
e.next = 12;
|
|
930
1399
|
break;
|
|
931
1400
|
}
|
|
932
1401
|
return e.next = 11, n();
|
|
933
1402
|
case 11:
|
|
934
|
-
|
|
1403
|
+
s = e.sent;
|
|
935
1404
|
case 12:
|
|
936
|
-
if ("DECISIONING" !==
|
|
1405
|
+
if ("DECISIONING" !== i) {
|
|
937
1406
|
e.next = 18;
|
|
938
1407
|
break;
|
|
939
1408
|
}
|
|
940
1409
|
return e.next = 15, this.getTelemetryID();
|
|
941
1410
|
case 15:
|
|
942
|
-
|
|
1411
|
+
o = e.sent, e.next = 25;
|
|
943
1412
|
break;
|
|
944
1413
|
case 18:
|
|
945
|
-
if ("OBSERVATION" !==
|
|
1414
|
+
if ("OBSERVATION" !== i) {
|
|
946
1415
|
e.next = 25;
|
|
947
1416
|
break;
|
|
948
1417
|
}
|
|
949
1418
|
return e.next = 21, this.getTelemetryID();
|
|
950
1419
|
case 21:
|
|
951
|
-
return
|
|
1420
|
+
return o = e.sent, e.next = 24, n();
|
|
952
1421
|
case 24:
|
|
953
|
-
|
|
1422
|
+
s = e.sent;
|
|
954
1423
|
case 25:
|
|
955
1424
|
return e.abrupt("return", {
|
|
956
|
-
dfp_telemetry_id:
|
|
957
|
-
captcha_token:
|
|
1425
|
+
dfp_telemetry_id: o,
|
|
1426
|
+
captcha_token: s
|
|
958
1427
|
});
|
|
959
1428
|
case 26:
|
|
960
1429
|
case "end":
|
|
@@ -963,14 +1432,14 @@ var Y,
|
|
|
963
1432
|
}, e, this);
|
|
964
1433
|
}));
|
|
965
1434
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
966
|
-
return
|
|
967
|
-
var n,
|
|
968
|
-
return
|
|
1435
|
+
return we(i, void 0, void 0, de().mark(function r() {
|
|
1436
|
+
var n, i, o;
|
|
1437
|
+
return de().wrap(function (r) {
|
|
969
1438
|
for (;;) switch (r.prev = r.next) {
|
|
970
1439
|
case 0:
|
|
971
1440
|
return r.next = 2, this.state;
|
|
972
1441
|
case 2:
|
|
973
|
-
if (n = r.sent,
|
|
1442
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== ke.RequiredCatcha || !i) {
|
|
974
1443
|
r.next = 14;
|
|
975
1444
|
break;
|
|
976
1445
|
}
|
|
@@ -980,7 +1449,7 @@ var Y,
|
|
|
980
1449
|
}
|
|
981
1450
|
return r.next = 9, this.getTelemetryID();
|
|
982
1451
|
case 9:
|
|
983
|
-
return t.body.dfp_telemetry_id = r.sent, r.next = 12,
|
|
1452
|
+
return t.body.dfp_telemetry_id = r.sent, r.next = 12, o();
|
|
984
1453
|
case 12:
|
|
985
1454
|
t.body.captcha_token = r.sent;
|
|
986
1455
|
case 13:
|
|
@@ -994,8 +1463,8 @@ var Y,
|
|
|
994
1463
|
}, r, this);
|
|
995
1464
|
}));
|
|
996
1465
|
}, this.state = n.then(function (e) {
|
|
997
|
-
return
|
|
998
|
-
return
|
|
1466
|
+
return we(i, void 0, void 0, de().mark(function n() {
|
|
1467
|
+
return de().wrap(function (n) {
|
|
999
1468
|
for (;;) switch (n.prev = n.next) {
|
|
1000
1469
|
case 0:
|
|
1001
1470
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1007,10 +1476,10 @@ var Y,
|
|
|
1007
1476
|
dfpBackendURL: r,
|
|
1008
1477
|
enabled: !1,
|
|
1009
1478
|
loaded: !1,
|
|
1010
|
-
executeRecaptcha:
|
|
1479
|
+
executeRecaptcha: o
|
|
1011
1480
|
});
|
|
1012
1481
|
case 2:
|
|
1013
|
-
return n.next = 4, void
|
|
1482
|
+
return n.next = 4, void Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1014
1483
|
return window;
|
|
1015
1484
|
});
|
|
1016
1485
|
case 4:
|
|
@@ -1020,7 +1489,7 @@ var Y,
|
|
|
1020
1489
|
enabled: !0,
|
|
1021
1490
|
mode: e.dfpProtectedAuthMode || "OBSERVATION",
|
|
1022
1491
|
loaded: !0,
|
|
1023
|
-
executeRecaptcha:
|
|
1492
|
+
executeRecaptcha: o
|
|
1024
1493
|
});
|
|
1025
1494
|
case 5:
|
|
1026
1495
|
case "end":
|
|
@@ -1030,11 +1499,11 @@ var Y,
|
|
|
1030
1499
|
}));
|
|
1031
1500
|
});
|
|
1032
1501
|
}),
|
|
1033
|
-
|
|
1502
|
+
Ge = function Ge() {
|
|
1034
1503
|
return {
|
|
1035
1504
|
isEnabled: function isEnabled() {
|
|
1036
|
-
return
|
|
1037
|
-
return
|
|
1505
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1506
|
+
return de().wrap(function (e) {
|
|
1038
1507
|
for (;;) switch (e.prev = e.next) {
|
|
1039
1508
|
case 0:
|
|
1040
1509
|
return e.abrupt("return", !1);
|
|
@@ -1046,8 +1515,8 @@ var Y,
|
|
|
1046
1515
|
}));
|
|
1047
1516
|
},
|
|
1048
1517
|
getTelemetryID: function getTelemetryID() {
|
|
1049
|
-
return
|
|
1050
|
-
return
|
|
1518
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1519
|
+
return de().wrap(function (e) {
|
|
1051
1520
|
for (;;) switch (e.prev = e.next) {
|
|
1052
1521
|
case 0:
|
|
1053
1522
|
return e.abrupt("return", void 0);
|
|
@@ -1059,8 +1528,8 @@ var Y,
|
|
|
1059
1528
|
}));
|
|
1060
1529
|
},
|
|
1061
1530
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1062
|
-
return
|
|
1063
|
-
return
|
|
1531
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1532
|
+
return de().wrap(function (e) {
|
|
1064
1533
|
for (;;) switch (e.prev = e.next) {
|
|
1065
1534
|
case 0:
|
|
1066
1535
|
return e.abrupt("return", {
|
|
@@ -1075,8 +1544,8 @@ var Y,
|
|
|
1075
1544
|
}));
|
|
1076
1545
|
},
|
|
1077
1546
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1078
|
-
return
|
|
1079
|
-
return
|
|
1547
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1548
|
+
return de().wrap(function (e) {
|
|
1080
1549
|
for (;;) switch (e.prev = e.next) {
|
|
1081
1550
|
case 0:
|
|
1082
1551
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1089,11 +1558,11 @@ var Y,
|
|
|
1089
1558
|
}
|
|
1090
1559
|
};
|
|
1091
1560
|
},
|
|
1092
|
-
|
|
1561
|
+
He = function () {
|
|
1093
1562
|
function e(t) {
|
|
1094
|
-
|
|
1563
|
+
_e(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1095
1564
|
}
|
|
1096
|
-
return
|
|
1565
|
+
return pe(e, [{
|
|
1097
1566
|
key: "logEvent",
|
|
1098
1567
|
value: function value(e, t) {
|
|
1099
1568
|
this.batch.push({
|
|
@@ -1104,9 +1573,9 @@ var Y,
|
|
|
1104
1573
|
}, {
|
|
1105
1574
|
key: "flush",
|
|
1106
1575
|
value: function value() {
|
|
1107
|
-
return
|
|
1576
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1108
1577
|
var t;
|
|
1109
|
-
return
|
|
1578
|
+
return de().wrap(function (e) {
|
|
1110
1579
|
for (;;) switch (e.prev = e.next) {
|
|
1111
1580
|
case 0:
|
|
1112
1581
|
if (this.batch.length) {
|
|
@@ -1138,26 +1607,26 @@ var Y,
|
|
|
1138
1607
|
}();
|
|
1139
1608
|
!function (e) {
|
|
1140
1609
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1141
|
-
}(
|
|
1610
|
+
}(je || (je = {})), Promise.resolve({
|
|
1142
1611
|
pkceRequiredForEmailMagicLinks: !1
|
|
1143
1612
|
}), Promise.resolve({
|
|
1144
1613
|
pkceRequiredForPasswordResets: !1
|
|
1145
1614
|
});
|
|
1146
|
-
var
|
|
1615
|
+
var Ye = Promise.resolve({
|
|
1147
1616
|
pkceRequiredForEmailMagicLinks: !1
|
|
1148
1617
|
}),
|
|
1149
|
-
|
|
1150
|
-
function e(t, r, n,
|
|
1151
|
-
var
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1618
|
+
Ve = function () {
|
|
1619
|
+
function e(t, r, n, i) {
|
|
1620
|
+
var o = this,
|
|
1621
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye,
|
|
1622
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1623
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1155
1624
|
invite: function invite(e) {
|
|
1156
|
-
return
|
|
1157
|
-
return
|
|
1625
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1626
|
+
return de().wrap(function (t) {
|
|
1158
1627
|
for (;;) switch (t.prev = t.next) {
|
|
1159
1628
|
case 0:
|
|
1160
|
-
return
|
|
1629
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1161
1630
|
url: "/b2b/magic_links/email/invite",
|
|
1162
1631
|
body: e,
|
|
1163
1632
|
errorMessage: "Failed to send invite.",
|
|
@@ -1171,12 +1640,12 @@ var ne = Promise.resolve({
|
|
|
1171
1640
|
}));
|
|
1172
1641
|
},
|
|
1173
1642
|
loginOrSignup: function loginOrSignup(e) {
|
|
1174
|
-
return
|
|
1643
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1175
1644
|
var r, n;
|
|
1176
|
-
return
|
|
1645
|
+
return de().wrap(function (t) {
|
|
1177
1646
|
for (;;) switch (t.prev = t.next) {
|
|
1178
1647
|
case 0:
|
|
1179
|
-
return
|
|
1648
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1180
1649
|
case 3:
|
|
1181
1650
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1182
1651
|
pkce_code_challenge: r
|
|
@@ -1195,12 +1664,12 @@ var ne = Promise.resolve({
|
|
|
1195
1664
|
},
|
|
1196
1665
|
discovery: {
|
|
1197
1666
|
send: function send(e) {
|
|
1198
|
-
return
|
|
1667
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1199
1668
|
var r, n;
|
|
1200
|
-
return
|
|
1669
|
+
return de().wrap(function (t) {
|
|
1201
1670
|
for (;;) switch (t.prev = t.next) {
|
|
1202
1671
|
case 0:
|
|
1203
|
-
return
|
|
1672
|
+
return qe("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1204
1673
|
case 3:
|
|
1205
1674
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1206
1675
|
pkce_code_challenge: r
|
|
@@ -1219,12 +1688,12 @@ var ne = Promise.resolve({
|
|
|
1219
1688
|
}
|
|
1220
1689
|
}
|
|
1221
1690
|
}, this.authenticate = function (e) {
|
|
1222
|
-
return
|
|
1691
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1223
1692
|
var r, n;
|
|
1224
|
-
return
|
|
1693
|
+
return de().wrap(function (t) {
|
|
1225
1694
|
for (;;) switch (t.prev = t.next) {
|
|
1226
1695
|
case 0:
|
|
1227
|
-
return
|
|
1696
|
+
return qe("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1228
1697
|
case 3:
|
|
1229
1698
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1230
1699
|
t.next = 19;
|
|
@@ -1274,33 +1743,33 @@ var ne = Promise.resolve({
|
|
|
1274
1743
|
}));
|
|
1275
1744
|
}, this.discovery = {
|
|
1276
1745
|
authenticate: function authenticate(e) {
|
|
1277
|
-
return
|
|
1278
|
-
var r, n, o, s, a
|
|
1279
|
-
return
|
|
1746
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1747
|
+
var r, n, i, o, s, a;
|
|
1748
|
+
return de().wrap(function (t) {
|
|
1280
1749
|
for (;;) switch (t.prev = t.next) {
|
|
1281
1750
|
case 0:
|
|
1282
|
-
return
|
|
1751
|
+
return qe("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1283
1752
|
case 3:
|
|
1284
1753
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1285
1754
|
case 6:
|
|
1286
|
-
return n = t.sent,
|
|
1755
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
|
|
1287
1756
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1288
|
-
dfp_telemetry_id:
|
|
1289
|
-
captcha_token:
|
|
1757
|
+
dfp_telemetry_id: i,
|
|
1758
|
+
captcha_token: o
|
|
1290
1759
|
}, e), t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1291
1760
|
url: "/b2b/magic_links/discovery/authenticate",
|
|
1292
|
-
body:
|
|
1761
|
+
body: s,
|
|
1293
1762
|
errorMessage: "Failed to authenticate intermediate magic link token",
|
|
1294
1763
|
method: "POST",
|
|
1295
1764
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1296
1765
|
});
|
|
1297
1766
|
case 12:
|
|
1298
|
-
return
|
|
1767
|
+
return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1299
1768
|
state: null,
|
|
1300
1769
|
session_token: null,
|
|
1301
1770
|
session_jwt: null,
|
|
1302
|
-
intermediate_session_token:
|
|
1303
|
-
}), t.abrupt("return",
|
|
1771
|
+
intermediate_session_token: a.intermediate_session_token
|
|
1772
|
+
}), t.abrupt("return", a);
|
|
1304
1773
|
case 16:
|
|
1305
1774
|
case "end":
|
|
1306
1775
|
return t.stop();
|
|
@@ -1310,12 +1779,12 @@ var ne = Promise.resolve({
|
|
|
1310
1779
|
}
|
|
1311
1780
|
};
|
|
1312
1781
|
}
|
|
1313
|
-
return
|
|
1782
|
+
return pe(e, [{
|
|
1314
1783
|
key: "getCodeChallenge",
|
|
1315
1784
|
value: function value() {
|
|
1316
|
-
return
|
|
1785
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1317
1786
|
var t, r;
|
|
1318
|
-
return
|
|
1787
|
+
return de().wrap(function (e) {
|
|
1319
1788
|
for (;;) switch (e.prev = e.next) {
|
|
1320
1789
|
case 0:
|
|
1321
1790
|
return e.next = 2, this._config;
|
|
@@ -1347,28 +1816,28 @@ var ne = Promise.resolve({
|
|
|
1347
1816
|
}, {
|
|
1348
1817
|
key: "handlePKCEForAuthenticate",
|
|
1349
1818
|
value: function value(e, t) {
|
|
1350
|
-
return
|
|
1351
|
-
var n, o, s, a, c
|
|
1352
|
-
return
|
|
1819
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1820
|
+
var n, i, o, s, a, c;
|
|
1821
|
+
return de().wrap(function (r) {
|
|
1353
1822
|
for (;;) switch (r.prev = r.next) {
|
|
1354
1823
|
case 0:
|
|
1355
1824
|
return r.next = 2, e.getPKPair();
|
|
1356
1825
|
case 2:
|
|
1357
1826
|
return n = r.sent, r.next = 5, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1358
1827
|
case 5:
|
|
1359
|
-
return
|
|
1828
|
+
return i = r.sent, o = i.dfp_telemetry_id, s = i.captcha_token, a = Object.assign({
|
|
1360
1829
|
pkce_code_verifier: null == n ? void 0 : n.code_verifier,
|
|
1361
|
-
dfp_telemetry_id:
|
|
1362
|
-
captcha_token:
|
|
1830
|
+
dfp_telemetry_id: o,
|
|
1831
|
+
captcha_token: s
|
|
1363
1832
|
}, t), r.next = 11, this._networkClient.retriableFetchSDK({
|
|
1364
1833
|
url: "/b2b/magic_links/authenticate",
|
|
1365
|
-
body:
|
|
1834
|
+
body: a,
|
|
1366
1835
|
errorMessage: "Failed to authenticate token",
|
|
1367
1836
|
method: "POST",
|
|
1368
1837
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1369
1838
|
});
|
|
1370
1839
|
case 11:
|
|
1371
|
-
return
|
|
1840
|
+
return c = r.sent, e.clearPKPair(), r.abrupt("return", c);
|
|
1372
1841
|
case 14:
|
|
1373
1842
|
case "end":
|
|
1374
1843
|
return r.stop();
|
|
@@ -1378,12 +1847,12 @@ var ne = Promise.resolve({
|
|
|
1378
1847
|
}
|
|
1379
1848
|
}]), e;
|
|
1380
1849
|
}(),
|
|
1381
|
-
|
|
1850
|
+
Je = pe(function e(t, r) {
|
|
1382
1851
|
var n = this;
|
|
1383
|
-
|
|
1384
|
-
return
|
|
1852
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1853
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1385
1854
|
var t;
|
|
1386
|
-
return
|
|
1855
|
+
return de().wrap(function (e) {
|
|
1387
1856
|
for (;;) switch (e.prev = e.next) {
|
|
1388
1857
|
case 0:
|
|
1389
1858
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1407,12 +1876,12 @@ var ne = Promise.resolve({
|
|
|
1407
1876
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1408
1877
|
});
|
|
1409
1878
|
}, this.update = function (e) {
|
|
1410
|
-
return
|
|
1879
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1411
1880
|
var r;
|
|
1412
|
-
return
|
|
1881
|
+
return de().wrap(function (t) {
|
|
1413
1882
|
for (;;) switch (t.prev = t.next) {
|
|
1414
1883
|
case 0:
|
|
1415
|
-
return
|
|
1884
|
+
return qe("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number), t.next = 3, this._networkClient.fetchSDK({
|
|
1416
1885
|
url: "/b2b/organizations/members/update",
|
|
1417
1886
|
body: e,
|
|
1418
1887
|
errorMessage: "Failed to update member.",
|
|
@@ -1427,9 +1896,9 @@ var ne = Promise.resolve({
|
|
|
1427
1896
|
}, t, this);
|
|
1428
1897
|
}));
|
|
1429
1898
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1430
|
-
return
|
|
1899
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1431
1900
|
var t;
|
|
1432
|
-
return
|
|
1901
|
+
return de().wrap(function (e) {
|
|
1433
1902
|
for (;;) switch (e.prev = e.next) {
|
|
1434
1903
|
case 0:
|
|
1435
1904
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1446,9 +1915,9 @@ var ne = Promise.resolve({
|
|
|
1446
1915
|
}, e, this);
|
|
1447
1916
|
}));
|
|
1448
1917
|
}, this.deletePassword = function (e) {
|
|
1449
|
-
return
|
|
1918
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1450
1919
|
var r;
|
|
1451
|
-
return
|
|
1920
|
+
return de().wrap(function (t) {
|
|
1452
1921
|
for (;;) switch (t.prev = t.next) {
|
|
1453
1922
|
case 0:
|
|
1454
1923
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1466,14 +1935,14 @@ var ne = Promise.resolve({
|
|
|
1466
1935
|
}));
|
|
1467
1936
|
};
|
|
1468
1937
|
}),
|
|
1469
|
-
|
|
1470
|
-
function e(t, r, n,
|
|
1471
|
-
var
|
|
1472
|
-
|
|
1473
|
-
|
|
1938
|
+
$e = function () {
|
|
1939
|
+
function e(t, r, n, i, o) {
|
|
1940
|
+
var s = this,
|
|
1941
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1942
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1474
1943
|
createConnection: function createConnection(e) {
|
|
1475
|
-
return
|
|
1476
|
-
return
|
|
1944
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1945
|
+
return de().wrap(function (t) {
|
|
1477
1946
|
for (;;) switch (t.prev = t.next) {
|
|
1478
1947
|
case 0:
|
|
1479
1948
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1492,8 +1961,8 @@ var ne = Promise.resolve({
|
|
|
1492
1961
|
}));
|
|
1493
1962
|
},
|
|
1494
1963
|
updateConnection: function updateConnection(e) {
|
|
1495
|
-
return
|
|
1496
|
-
return
|
|
1964
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1965
|
+
return de().wrap(function (t) {
|
|
1497
1966
|
for (;;) switch (t.prev = t.next) {
|
|
1498
1967
|
case 0:
|
|
1499
1968
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1512,8 +1981,8 @@ var ne = Promise.resolve({
|
|
|
1512
1981
|
}));
|
|
1513
1982
|
},
|
|
1514
1983
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1515
|
-
return
|
|
1516
|
-
return
|
|
1984
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1985
|
+
return de().wrap(function (t) {
|
|
1517
1986
|
for (;;) switch (t.prev = t.next) {
|
|
1518
1987
|
case 0:
|
|
1519
1988
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1532,8 +2001,8 @@ var ne = Promise.resolve({
|
|
|
1532
2001
|
}));
|
|
1533
2002
|
},
|
|
1534
2003
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1535
|
-
return
|
|
1536
|
-
return
|
|
2004
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2005
|
+
return de().wrap(function (t) {
|
|
1537
2006
|
for (;;) switch (t.prev = t.next) {
|
|
1538
2007
|
case 0:
|
|
1539
2008
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1552,8 +2021,8 @@ var ne = Promise.resolve({
|
|
|
1552
2021
|
}
|
|
1553
2022
|
}, this.oidc = {
|
|
1554
2023
|
createConnection: function createConnection(e) {
|
|
1555
|
-
return
|
|
1556
|
-
return
|
|
2024
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2025
|
+
return de().wrap(function (t) {
|
|
1557
2026
|
for (;;) switch (t.prev = t.next) {
|
|
1558
2027
|
case 0:
|
|
1559
2028
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1572,8 +2041,8 @@ var ne = Promise.resolve({
|
|
|
1572
2041
|
}));
|
|
1573
2042
|
},
|
|
1574
2043
|
updateConnection: function updateConnection(e) {
|
|
1575
|
-
return
|
|
1576
|
-
return
|
|
2044
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2045
|
+
return de().wrap(function (t) {
|
|
1577
2046
|
for (;;) switch (t.prev = t.next) {
|
|
1578
2047
|
case 0:
|
|
1579
2048
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1593,45 +2062,45 @@ var ne = Promise.resolve({
|
|
|
1593
2062
|
}
|
|
1594
2063
|
};
|
|
1595
2064
|
}
|
|
1596
|
-
return
|
|
2065
|
+
return pe(e, [{
|
|
1597
2066
|
key: "authenticate",
|
|
1598
2067
|
value: function value(e) {
|
|
1599
|
-
return
|
|
1600
|
-
var r, n, o, s
|
|
1601
|
-
return
|
|
2068
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2069
|
+
var r, n, i, o, s;
|
|
2070
|
+
return de().wrap(function (t) {
|
|
1602
2071
|
for (;;) switch (t.prev = t.next) {
|
|
1603
2072
|
case 0:
|
|
1604
|
-
return
|
|
2073
|
+
return qe("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1605
2074
|
case 3:
|
|
1606
|
-
return (r = t.sent) ||
|
|
2075
|
+
return (r = t.sent) || Ne("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1607
2076
|
case 7:
|
|
1608
|
-
return n = t.sent,
|
|
2077
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1609
2078
|
url: "/b2b/sso/authenticate",
|
|
1610
2079
|
method: "POST",
|
|
1611
2080
|
body: Object.assign(Object.assign({
|
|
1612
2081
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier
|
|
1613
2082
|
}, e), {
|
|
1614
|
-
dfp_telemetry_id:
|
|
1615
|
-
captcha_token:
|
|
2083
|
+
dfp_telemetry_id: i,
|
|
2084
|
+
captcha_token: o
|
|
1616
2085
|
}),
|
|
1617
2086
|
errorMessage: "Failed to authenticate token",
|
|
1618
2087
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1619
2088
|
});
|
|
1620
2089
|
case 12:
|
|
1621
|
-
return
|
|
2090
|
+
return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
1622
2091
|
state: {
|
|
1623
|
-
session:
|
|
1624
|
-
member:
|
|
2092
|
+
session: s.member_session,
|
|
2093
|
+
member: s.member
|
|
1625
2094
|
},
|
|
1626
|
-
session_token:
|
|
1627
|
-
session_jwt:
|
|
2095
|
+
session_token: s.session_token,
|
|
2096
|
+
session_jwt: s.session_jwt,
|
|
1628
2097
|
intermediate_session_token: null
|
|
1629
2098
|
}) : this._subscriptionService.updateStateAndTokens({
|
|
1630
2099
|
state: null,
|
|
1631
2100
|
session_token: null,
|
|
1632
2101
|
session_jwt: null,
|
|
1633
|
-
intermediate_session_token:
|
|
1634
|
-
}), t.abrupt("return",
|
|
2102
|
+
intermediate_session_token: s.intermediate_session_token
|
|
2103
|
+
}), t.abrupt("return", s);
|
|
1635
2104
|
case 16:
|
|
1636
2105
|
case "end":
|
|
1637
2106
|
return t.stop();
|
|
@@ -1642,11 +2111,11 @@ var ne = Promise.resolve({
|
|
|
1642
2111
|
}, {
|
|
1643
2112
|
key: "getBaseApiUrl",
|
|
1644
2113
|
value: function value() {
|
|
1645
|
-
return
|
|
1646
|
-
return
|
|
2114
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2115
|
+
return de().wrap(function (e) {
|
|
1647
2116
|
for (;;) switch (e.prev = e.next) {
|
|
1648
2117
|
case 0:
|
|
1649
|
-
if (!
|
|
2118
|
+
if (!ze(this._config.publicToken)) {
|
|
1650
2119
|
e.next = 2;
|
|
1651
2120
|
break;
|
|
1652
2121
|
}
|
|
@@ -1666,27 +2135,27 @@ var ne = Promise.resolve({
|
|
|
1666
2135
|
var t = e.connection_id,
|
|
1667
2136
|
r = e.login_redirect_url,
|
|
1668
2137
|
n = e.signup_redirect_url;
|
|
1669
|
-
return
|
|
1670
|
-
var o, s, a, c
|
|
1671
|
-
return
|
|
2138
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2139
|
+
var i, o, s, a, c;
|
|
2140
|
+
return de().wrap(function (e) {
|
|
1672
2141
|
for (;;) switch (e.prev = e.next) {
|
|
1673
2142
|
case 0:
|
|
1674
2143
|
return e.next = 2, this._dynamicConfig;
|
|
1675
2144
|
case 2:
|
|
1676
|
-
return
|
|
2145
|
+
return i = e.sent, o = i.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
|
|
1677
2146
|
case 6:
|
|
1678
|
-
if (
|
|
2147
|
+
if (s = e.sent, (a = new URL("".concat(s, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), a.searchParams.set("connection_id", t), !o) {
|
|
1679
2148
|
e.next = 17;
|
|
1680
2149
|
break;
|
|
1681
2150
|
}
|
|
1682
2151
|
return e.next = 13, this._pkceManager.startPKCETransaction();
|
|
1683
2152
|
case 13:
|
|
1684
|
-
|
|
2153
|
+
c = e.sent, a.searchParams.set("pkce_code_challenge", c.code_challenge), e.next = 18;
|
|
1685
2154
|
break;
|
|
1686
2155
|
case 17:
|
|
1687
2156
|
this._pkceManager.clearPKPair();
|
|
1688
2157
|
case 18:
|
|
1689
|
-
r &&
|
|
2158
|
+
r && a.searchParams.set("login_redirect_url", r), n && a.searchParams.set("signup_redirect_url", n), window.location.href = a.toString();
|
|
1690
2159
|
case 21:
|
|
1691
2160
|
case "end":
|
|
1692
2161
|
return e.stop();
|
|
@@ -1697,8 +2166,8 @@ var ne = Promise.resolve({
|
|
|
1697
2166
|
}, {
|
|
1698
2167
|
key: "getConnections",
|
|
1699
2168
|
value: function value() {
|
|
1700
|
-
return
|
|
1701
|
-
return
|
|
2169
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2170
|
+
return de().wrap(function (e) {
|
|
1702
2171
|
for (;;) switch (e.prev = e.next) {
|
|
1703
2172
|
case 0:
|
|
1704
2173
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1718,8 +2187,8 @@ var ne = Promise.resolve({
|
|
|
1718
2187
|
}, {
|
|
1719
2188
|
key: "deleteConnection",
|
|
1720
2189
|
value: function value(e) {
|
|
1721
|
-
return
|
|
1722
|
-
return
|
|
2190
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2191
|
+
return de().wrap(function (t) {
|
|
1723
2192
|
for (;;) switch (t.prev = t.next) {
|
|
1724
2193
|
case 0:
|
|
1725
2194
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1736,12 +2205,12 @@ var ne = Promise.resolve({
|
|
|
1736
2205
|
}
|
|
1737
2206
|
}]), e;
|
|
1738
2207
|
}(),
|
|
1739
|
-
|
|
2208
|
+
Xe = pe(function e(t, r) {
|
|
1740
2209
|
var n = this;
|
|
1741
|
-
|
|
1742
|
-
return
|
|
2210
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2211
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1743
2212
|
var t;
|
|
1744
|
-
return
|
|
2213
|
+
return de().wrap(function (e) {
|
|
1745
2214
|
for (;;) switch (e.prev = e.next) {
|
|
1746
2215
|
case 0:
|
|
1747
2216
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1758,9 +2227,9 @@ var ne = Promise.resolve({
|
|
|
1758
2227
|
}, e, this);
|
|
1759
2228
|
}));
|
|
1760
2229
|
}, this.update = function (e) {
|
|
1761
|
-
return
|
|
2230
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1762
2231
|
var r;
|
|
1763
|
-
return
|
|
2232
|
+
return de().wrap(function (t) {
|
|
1764
2233
|
for (;;) switch (t.prev = t.next) {
|
|
1765
2234
|
case 0:
|
|
1766
2235
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1778,9 +2247,9 @@ var ne = Promise.resolve({
|
|
|
1778
2247
|
}, t, this);
|
|
1779
2248
|
}));
|
|
1780
2249
|
}, this["delete"] = function () {
|
|
1781
|
-
return
|
|
2250
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1782
2251
|
var t;
|
|
1783
|
-
return
|
|
2252
|
+
return de().wrap(function (e) {
|
|
1784
2253
|
for (;;) switch (e.prev = e.next) {
|
|
1785
2254
|
case 0:
|
|
1786
2255
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1798,8 +2267,8 @@ var ne = Promise.resolve({
|
|
|
1798
2267
|
}));
|
|
1799
2268
|
}, this.members = {
|
|
1800
2269
|
create: function create(e) {
|
|
1801
|
-
return
|
|
1802
|
-
return
|
|
2270
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2271
|
+
return de().wrap(function (t) {
|
|
1803
2272
|
for (;;) switch (t.prev = t.next) {
|
|
1804
2273
|
case 0:
|
|
1805
2274
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1816,8 +2285,8 @@ var ne = Promise.resolve({
|
|
|
1816
2285
|
}));
|
|
1817
2286
|
},
|
|
1818
2287
|
search: function search(e) {
|
|
1819
|
-
return
|
|
1820
|
-
return
|
|
2288
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2289
|
+
return de().wrap(function (t) {
|
|
1821
2290
|
for (;;) switch (t.prev = t.next) {
|
|
1822
2291
|
case 0:
|
|
1823
2292
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1834,8 +2303,8 @@ var ne = Promise.resolve({
|
|
|
1834
2303
|
}));
|
|
1835
2304
|
},
|
|
1836
2305
|
update: function update(e) {
|
|
1837
|
-
return
|
|
1838
|
-
return
|
|
2306
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2307
|
+
return de().wrap(function (t) {
|
|
1839
2308
|
for (;;) switch (t.prev = t.next) {
|
|
1840
2309
|
case 0:
|
|
1841
2310
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1852,8 +2321,8 @@ var ne = Promise.resolve({
|
|
|
1852
2321
|
}));
|
|
1853
2322
|
},
|
|
1854
2323
|
deletePassword: function deletePassword(e) {
|
|
1855
|
-
return
|
|
1856
|
-
return
|
|
2324
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2325
|
+
return de().wrap(function (t) {
|
|
1857
2326
|
for (;;) switch (t.prev = t.next) {
|
|
1858
2327
|
case 0:
|
|
1859
2328
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1869,8 +2338,8 @@ var ne = Promise.resolve({
|
|
|
1869
2338
|
}));
|
|
1870
2339
|
},
|
|
1871
2340
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
1872
|
-
return
|
|
1873
|
-
return
|
|
2341
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2342
|
+
return de().wrap(function (t) {
|
|
1874
2343
|
for (;;) switch (t.prev = t.next) {
|
|
1875
2344
|
case 0:
|
|
1876
2345
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1886,8 +2355,8 @@ var ne = Promise.resolve({
|
|
|
1886
2355
|
}));
|
|
1887
2356
|
},
|
|
1888
2357
|
"delete": function _delete(e) {
|
|
1889
|
-
return
|
|
1890
|
-
return
|
|
2358
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2359
|
+
return de().wrap(function (t) {
|
|
1891
2360
|
for (;;) switch (t.prev = t.next) {
|
|
1892
2361
|
case 0:
|
|
1893
2362
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1903,8 +2372,8 @@ var ne = Promise.resolve({
|
|
|
1903
2372
|
}));
|
|
1904
2373
|
},
|
|
1905
2374
|
reactivate: function reactivate(e) {
|
|
1906
|
-
return
|
|
1907
|
-
return
|
|
2375
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2376
|
+
return de().wrap(function (t) {
|
|
1908
2377
|
for (;;) switch (t.prev = t.next) {
|
|
1909
2378
|
case 0:
|
|
1910
2379
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -1921,39 +2390,39 @@ var ne = Promise.resolve({
|
|
|
1921
2390
|
}
|
|
1922
2391
|
};
|
|
1923
2392
|
}),
|
|
1924
|
-
|
|
1925
|
-
function e(t, r, n,
|
|
1926
|
-
var
|
|
1927
|
-
|
|
1928
|
-
|
|
2393
|
+
Ze = function () {
|
|
2394
|
+
function e(t, r, n, i, o) {
|
|
2395
|
+
var s = this,
|
|
2396
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
2397
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
1929
2398
|
authenticate: function authenticate(e) {
|
|
1930
|
-
return
|
|
1931
|
-
var r, n, o, s, a
|
|
1932
|
-
return
|
|
2399
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2400
|
+
var r, n, i, o, s, a;
|
|
2401
|
+
return de().wrap(function (t) {
|
|
1933
2402
|
for (;;) switch (t.prev = t.next) {
|
|
1934
2403
|
case 0:
|
|
1935
|
-
return
|
|
2404
|
+
return qe("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1936
2405
|
case 3:
|
|
1937
2406
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1938
2407
|
case 6:
|
|
1939
|
-
return n = t.sent,
|
|
2408
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
|
|
1940
2409
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1941
|
-
dfp_telemetry_id:
|
|
1942
|
-
captcha_token:
|
|
2410
|
+
dfp_telemetry_id: i,
|
|
2411
|
+
captcha_token: o
|
|
1943
2412
|
}, e), t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1944
2413
|
url: "/b2b/oauth/discovery/authenticate",
|
|
1945
|
-
body:
|
|
2414
|
+
body: s,
|
|
1946
2415
|
errorMessage: "Failed to authenticate discovery oauth token",
|
|
1947
2416
|
method: "POST",
|
|
1948
2417
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1949
2418
|
});
|
|
1950
2419
|
case 12:
|
|
1951
|
-
return
|
|
2420
|
+
return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1952
2421
|
state: null,
|
|
1953
2422
|
session_token: null,
|
|
1954
2423
|
session_jwt: null,
|
|
1955
|
-
intermediate_session_token:
|
|
1956
|
-
}), t.abrupt("return",
|
|
2424
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2425
|
+
}), t.abrupt("return", a);
|
|
1957
2426
|
case 16:
|
|
1958
2427
|
case "end":
|
|
1959
2428
|
return t.stop();
|
|
@@ -1962,55 +2431,55 @@ var ne = Promise.resolve({
|
|
|
1962
2431
|
}));
|
|
1963
2432
|
}
|
|
1964
2433
|
}, this.google = {
|
|
1965
|
-
start: this.startOAuthFlow(
|
|
2434
|
+
start: this.startOAuthFlow(y.Google),
|
|
1966
2435
|
discovery: {
|
|
1967
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2436
|
+
start: this.startDiscoveryOAuthFlow(y.Google)
|
|
1968
2437
|
}
|
|
1969
2438
|
}, this.microsoft = {
|
|
1970
|
-
start: this.startOAuthFlow(
|
|
2439
|
+
start: this.startOAuthFlow(y.Microsoft),
|
|
1971
2440
|
discovery: {
|
|
1972
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2441
|
+
start: this.startDiscoveryOAuthFlow(y.Microsoft)
|
|
1973
2442
|
}
|
|
1974
2443
|
};
|
|
1975
2444
|
}
|
|
1976
|
-
return
|
|
2445
|
+
return pe(e, [{
|
|
1977
2446
|
key: "authenticate",
|
|
1978
2447
|
value: function value(e) {
|
|
1979
|
-
return
|
|
1980
|
-
var r, n, o, s
|
|
1981
|
-
return
|
|
2448
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2449
|
+
var r, n, i, o, s;
|
|
2450
|
+
return de().wrap(function (t) {
|
|
1982
2451
|
for (;;) switch (t.prev = t.next) {
|
|
1983
2452
|
case 0:
|
|
1984
|
-
return
|
|
2453
|
+
return qe("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1985
2454
|
case 3:
|
|
1986
|
-
return (r = t.sent) ||
|
|
2455
|
+
return (r = t.sent) || Ne("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1987
2456
|
case 7:
|
|
1988
|
-
return n = t.sent,
|
|
2457
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1989
2458
|
url: "/b2b/oauth/authenticate",
|
|
1990
2459
|
method: "POST",
|
|
1991
2460
|
body: Object.assign({
|
|
1992
2461
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1993
|
-
dfp_telemetry_id:
|
|
1994
|
-
captcha_token:
|
|
2462
|
+
dfp_telemetry_id: i,
|
|
2463
|
+
captcha_token: o
|
|
1995
2464
|
}, e),
|
|
1996
2465
|
errorMessage: "Failed to authenticate token",
|
|
1997
2466
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1998
2467
|
});
|
|
1999
2468
|
case 12:
|
|
2000
|
-
return
|
|
2469
|
+
return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
2001
2470
|
state: {
|
|
2002
|
-
session:
|
|
2003
|
-
member:
|
|
2471
|
+
session: s.member_session,
|
|
2472
|
+
member: s.member
|
|
2004
2473
|
},
|
|
2005
|
-
session_token:
|
|
2006
|
-
session_jwt:
|
|
2474
|
+
session_token: s.session_token,
|
|
2475
|
+
session_jwt: s.session_jwt,
|
|
2007
2476
|
intermediate_session_token: null
|
|
2008
2477
|
}) : this._subscriptionService.updateStateAndTokens({
|
|
2009
2478
|
state: null,
|
|
2010
2479
|
session_token: null,
|
|
2011
2480
|
session_jwt: null,
|
|
2012
|
-
intermediate_session_token:
|
|
2013
|
-
}), t.abrupt("return",
|
|
2481
|
+
intermediate_session_token: s.intermediate_session_token
|
|
2482
|
+
}), t.abrupt("return", s);
|
|
2014
2483
|
case 16:
|
|
2015
2484
|
case "end":
|
|
2016
2485
|
return t.stop();
|
|
@@ -2021,9 +2490,9 @@ var ne = Promise.resolve({
|
|
|
2021
2490
|
}, {
|
|
2022
2491
|
key: "getBaseApiUrl",
|
|
2023
2492
|
value: function value() {
|
|
2024
|
-
return
|
|
2493
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2025
2494
|
var t, r;
|
|
2026
|
-
return
|
|
2495
|
+
return de().wrap(function (e) {
|
|
2027
2496
|
for (;;) switch (e.prev = e.next) {
|
|
2028
2497
|
case 0:
|
|
2029
2498
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2034,7 +2503,7 @@ var ne = Promise.resolve({
|
|
|
2034
2503
|
}
|
|
2035
2504
|
return e.abrupt("return", "https://".concat(r));
|
|
2036
2505
|
case 6:
|
|
2037
|
-
if (!
|
|
2506
|
+
if (!ze(this._config.publicToken)) {
|
|
2038
2507
|
e.next = 8;
|
|
2039
2508
|
break;
|
|
2040
2509
|
}
|
|
@@ -2054,33 +2523,33 @@ var ne = Promise.resolve({
|
|
|
2054
2523
|
var t = this;
|
|
2055
2524
|
return function (r) {
|
|
2056
2525
|
var n = r.organization_id,
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
return
|
|
2063
|
-
var r, l, d, h, p
|
|
2064
|
-
return
|
|
2526
|
+
i = r.organization_slug,
|
|
2527
|
+
o = r.login_redirect_url,
|
|
2528
|
+
s = r.signup_redirect_url,
|
|
2529
|
+
a = r.custom_scopes,
|
|
2530
|
+
c = r.provider_params;
|
|
2531
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2532
|
+
var r, u, l, d, h, p;
|
|
2533
|
+
return de().wrap(function (t) {
|
|
2065
2534
|
for (;;) switch (t.prev = t.next) {
|
|
2066
2535
|
case 0:
|
|
2067
2536
|
return t.next = 2, this._dynamicConfig;
|
|
2068
2537
|
case 2:
|
|
2069
|
-
return r = t.sent,
|
|
2538
|
+
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2070
2539
|
case 6:
|
|
2071
|
-
if (
|
|
2072
|
-
if (!
|
|
2540
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (qe("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in qe("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2541
|
+
if (!u) {
|
|
2073
2542
|
t.next = 20;
|
|
2074
2543
|
break;
|
|
2075
2544
|
}
|
|
2076
2545
|
return t.next = 16, this._pkceManager.startPKCETransaction();
|
|
2077
2546
|
case 16:
|
|
2078
|
-
|
|
2547
|
+
p = t.sent, d.searchParams.set("pkce_code_challenge", p.code_challenge), t.next = 21;
|
|
2079
2548
|
break;
|
|
2080
2549
|
case 20:
|
|
2081
2550
|
this._pkceManager.clearPKPair();
|
|
2082
2551
|
case 21:
|
|
2083
|
-
|
|
2552
|
+
o && d.searchParams.set("login_redirect_url", o), s && d.searchParams.set("signup_redirect_url", s), window.location.href = d.toString();
|
|
2084
2553
|
case 24:
|
|
2085
2554
|
case "end":
|
|
2086
2555
|
return t.stop();
|
|
@@ -2095,30 +2564,30 @@ var ne = Promise.resolve({
|
|
|
2095
2564
|
var t = this;
|
|
2096
2565
|
return function (r) {
|
|
2097
2566
|
var n = r.discovery_redirect_url,
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
return
|
|
2101
|
-
var r, a, c, u, l
|
|
2102
|
-
return
|
|
2567
|
+
i = r.custom_scopes,
|
|
2568
|
+
o = r.provider_params;
|
|
2569
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2570
|
+
var r, s, a, c, u, l;
|
|
2571
|
+
return de().wrap(function (t) {
|
|
2103
2572
|
for (;;) switch (t.prev = t.next) {
|
|
2104
2573
|
case 0:
|
|
2105
2574
|
return t.next = 2, this._dynamicConfig;
|
|
2106
2575
|
case 2:
|
|
2107
|
-
return r = t.sent,
|
|
2576
|
+
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2108
2577
|
case 6:
|
|
2109
|
-
if (
|
|
2110
|
-
if (!
|
|
2578
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (qe("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in qe("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2579
|
+
if (!s) {
|
|
2111
2580
|
t.next = 18;
|
|
2112
2581
|
break;
|
|
2113
2582
|
}
|
|
2114
2583
|
return t.next = 14, this._pkceManager.startPKCETransaction();
|
|
2115
2584
|
case 14:
|
|
2116
|
-
|
|
2585
|
+
l = t.sent, c.searchParams.set("pkce_code_challenge", l.code_challenge), t.next = 19;
|
|
2117
2586
|
break;
|
|
2118
2587
|
case 18:
|
|
2119
2588
|
this._pkceManager.clearPKPair();
|
|
2120
2589
|
case 19:
|
|
2121
|
-
n &&
|
|
2590
|
+
n && c.searchParams.set("discovery_redirect_url", n), window.location.href = c.toString();
|
|
2122
2591
|
case 21:
|
|
2123
2592
|
case "end":
|
|
2124
2593
|
return t.stop();
|
|
@@ -2129,10 +2598,10 @@ var ne = Promise.resolve({
|
|
|
2129
2598
|
}
|
|
2130
2599
|
}]), e;
|
|
2131
2600
|
}(),
|
|
2132
|
-
|
|
2601
|
+
Qe = function () {
|
|
2133
2602
|
function e(t, r) {
|
|
2134
2603
|
var n = this;
|
|
2135
|
-
|
|
2604
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2136
2605
|
return n._subscriptionService.getSession();
|
|
2137
2606
|
}, this.onChange = function (e) {
|
|
2138
2607
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -2140,9 +2609,9 @@ var ne = Promise.resolve({
|
|
|
2140
2609
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2141
2610
|
});
|
|
2142
2611
|
}, this.revoke = function (e) {
|
|
2143
|
-
return
|
|
2612
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2144
2613
|
var r;
|
|
2145
|
-
return
|
|
2614
|
+
return de().wrap(function (t) {
|
|
2146
2615
|
for (;;) switch (t.prev = t.next) {
|
|
2147
2616
|
case 0:
|
|
2148
2617
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2153,7 +2622,7 @@ var ne = Promise.resolve({
|
|
|
2153
2622
|
case 3:
|
|
2154
2623
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2155
2624
|
case 8:
|
|
2156
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2625
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || A.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2157
2626
|
case 12:
|
|
2158
2627
|
case "end":
|
|
2159
2628
|
return t.stop();
|
|
@@ -2161,9 +2630,9 @@ var ne = Promise.resolve({
|
|
|
2161
2630
|
}, t, this, [[0, 8]]);
|
|
2162
2631
|
}));
|
|
2163
2632
|
}, this.authenticate = function (e) {
|
|
2164
|
-
return
|
|
2633
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2165
2634
|
var r, n;
|
|
2166
|
-
return
|
|
2635
|
+
return de().wrap(function (t) {
|
|
2167
2636
|
for (;;) switch (t.prev = t.next) {
|
|
2168
2637
|
case 0:
|
|
2169
2638
|
return t.prev = 0, r = {
|
|
@@ -2185,7 +2654,7 @@ var ne = Promise.resolve({
|
|
|
2185
2654
|
intermediate_session_token: null
|
|
2186
2655
|
}), t.abrupt("return", n);
|
|
2187
2656
|
case 9:
|
|
2188
|
-
throw t.prev = 9, t.t0 = t["catch"](0),
|
|
2657
|
+
throw t.prev = 9, t.t0 = t["catch"](0), A.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
|
|
2189
2658
|
case 13:
|
|
2190
2659
|
case "end":
|
|
2191
2660
|
return t.stop();
|
|
@@ -2193,12 +2662,12 @@ var ne = Promise.resolve({
|
|
|
2193
2662
|
}, t, this, [[0, 9]]);
|
|
2194
2663
|
}));
|
|
2195
2664
|
}, this.exchange = function (e) {
|
|
2196
|
-
return
|
|
2665
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2197
2666
|
var r;
|
|
2198
|
-
return
|
|
2667
|
+
return de().wrap(function (t) {
|
|
2199
2668
|
for (;;) switch (t.prev = t.next) {
|
|
2200
2669
|
case 0:
|
|
2201
|
-
return
|
|
2670
|
+
return qe("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
2202
2671
|
url: "/b2b/sessions/exchange",
|
|
2203
2672
|
body: e,
|
|
2204
2673
|
errorMessage: "Failed to exchange session",
|
|
@@ -2229,19 +2698,19 @@ var ne = Promise.resolve({
|
|
|
2229
2698
|
}));
|
|
2230
2699
|
};
|
|
2231
2700
|
}
|
|
2232
|
-
return
|
|
2701
|
+
return pe(e, [{
|
|
2233
2702
|
key: "getTokens",
|
|
2234
2703
|
value: function value() {
|
|
2235
2704
|
return this._subscriptionService.getTokens();
|
|
2236
2705
|
}
|
|
2237
2706
|
}]), e;
|
|
2238
2707
|
}(),
|
|
2239
|
-
|
|
2708
|
+
et = pe(function e(t, r) {
|
|
2240
2709
|
var n = this;
|
|
2241
|
-
|
|
2710
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2242
2711
|
list: function list() {
|
|
2243
|
-
return
|
|
2244
|
-
return
|
|
2712
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2713
|
+
return de().wrap(function (e) {
|
|
2245
2714
|
for (;;) switch (e.prev = e.next) {
|
|
2246
2715
|
case 0:
|
|
2247
2716
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2268,12 +2737,12 @@ var ne = Promise.resolve({
|
|
|
2268
2737
|
}));
|
|
2269
2738
|
},
|
|
2270
2739
|
create: function create(e) {
|
|
2271
|
-
return
|
|
2740
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2272
2741
|
var r, n;
|
|
2273
|
-
return
|
|
2742
|
+
return de().wrap(function (t) {
|
|
2274
2743
|
for (;;) switch (t.prev = t.next) {
|
|
2275
2744
|
case 0:
|
|
2276
|
-
return
|
|
2745
|
+
return qe("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2277
2746
|
case 5:
|
|
2278
2747
|
if (t.t2 = t.sent, t.t2) {
|
|
2279
2748
|
t.next = 8;
|
|
@@ -2313,12 +2782,12 @@ var ne = Promise.resolve({
|
|
|
2313
2782
|
}
|
|
2314
2783
|
}, this.intermediateSessions = {
|
|
2315
2784
|
exchange: function exchange(e) {
|
|
2316
|
-
return
|
|
2785
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2317
2786
|
var r, n;
|
|
2318
|
-
return
|
|
2787
|
+
return de().wrap(function (t) {
|
|
2319
2788
|
for (;;) switch (t.prev = t.next) {
|
|
2320
2789
|
case 0:
|
|
2321
|
-
return
|
|
2790
|
+
return qe("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2322
2791
|
case 5:
|
|
2323
2792
|
if (t.t2 = t.sent, t.t2) {
|
|
2324
2793
|
t.next = 8;
|
|
@@ -2361,23 +2830,23 @@ var ne = Promise.resolve({
|
|
|
2361
2830
|
Promise.resolve({
|
|
2362
2831
|
pkceRequiredForPasswordResets: !1
|
|
2363
2832
|
});
|
|
2364
|
-
var
|
|
2833
|
+
var tt = pe(function e(t, r) {
|
|
2365
2834
|
var n = this,
|
|
2366
|
-
|
|
2367
|
-
|
|
2835
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
2836
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
2368
2837
|
send: function send(e) {
|
|
2369
|
-
return
|
|
2370
|
-
var r, n,
|
|
2371
|
-
return
|
|
2838
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2839
|
+
var r, n, i;
|
|
2840
|
+
return de().wrap(function (t) {
|
|
2372
2841
|
for (;;) switch (t.prev = t.next) {
|
|
2373
2842
|
case 0:
|
|
2374
|
-
return
|
|
2843
|
+
return qe("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2375
2844
|
case 3:
|
|
2376
|
-
return r = t.sent, n = r.dfp_telemetry_id,
|
|
2845
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2377
2846
|
url: "/b2b/otps/sms/send",
|
|
2378
2847
|
body: Object.assign(Object.assign({}, e), {
|
|
2379
2848
|
dfp_telemetry_id: n,
|
|
2380
|
-
captcha_token:
|
|
2849
|
+
captcha_token: i
|
|
2381
2850
|
}),
|
|
2382
2851
|
errorMessage: "Failed to send one time passcode",
|
|
2383
2852
|
method: "POST",
|
|
@@ -2391,14 +2860,14 @@ var de = s(function e(t, r) {
|
|
|
2391
2860
|
}));
|
|
2392
2861
|
},
|
|
2393
2862
|
authenticate: function authenticate(e) {
|
|
2394
|
-
return
|
|
2395
|
-
var r, n, o, s
|
|
2396
|
-
return
|
|
2863
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2864
|
+
var r, n, i, o, s;
|
|
2865
|
+
return de().wrap(function (t) {
|
|
2397
2866
|
for (;;) switch (t.prev = t.next) {
|
|
2398
2867
|
case 0:
|
|
2399
|
-
return
|
|
2868
|
+
return qe("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2400
2869
|
case 3:
|
|
2401
|
-
return r = t.sent, n = r.dfp_telemetry_id,
|
|
2870
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
2402
2871
|
case 12:
|
|
2403
2872
|
if (t.t4 = t.sent, t.t4) {
|
|
2404
2873
|
t.next = 15;
|
|
@@ -2410,23 +2879,23 @@ var de = s(function e(t, r) {
|
|
|
2410
2879
|
dfp_telemetry_id: t.t2,
|
|
2411
2880
|
captcha_token: t.t3,
|
|
2412
2881
|
intermediate_session_token: t.t5
|
|
2413
|
-
},
|
|
2882
|
+
}, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
|
|
2414
2883
|
url: "/b2b/otps/sms/authenticate",
|
|
2415
|
-
body:
|
|
2884
|
+
body: o,
|
|
2416
2885
|
errorMessage: "Failed to authenticate one time passcode",
|
|
2417
2886
|
method: "POST",
|
|
2418
2887
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2419
2888
|
});
|
|
2420
2889
|
case 20:
|
|
2421
|
-
return
|
|
2890
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2422
2891
|
state: {
|
|
2423
|
-
session:
|
|
2424
|
-
member:
|
|
2892
|
+
session: s.member_session,
|
|
2893
|
+
member: s.member
|
|
2425
2894
|
},
|
|
2426
|
-
session_token:
|
|
2427
|
-
session_jwt:
|
|
2895
|
+
session_token: s.session_token,
|
|
2896
|
+
session_jwt: s.session_jwt,
|
|
2428
2897
|
intermediate_session_token: null
|
|
2429
|
-
}), t.abrupt("return",
|
|
2898
|
+
}), t.abrupt("return", s);
|
|
2430
2899
|
case 23:
|
|
2431
2900
|
case "end":
|
|
2432
2901
|
return t.stop();
|
|
@@ -2436,21 +2905,101 @@ var de = s(function e(t, r) {
|
|
|
2436
2905
|
}
|
|
2437
2906
|
};
|
|
2438
2907
|
}),
|
|
2439
|
-
|
|
2908
|
+
rt = function () {
|
|
2909
|
+
function e(t, r) {
|
|
2910
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
2911
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2912
|
+
}
|
|
2913
|
+
return pe(e, [{
|
|
2914
|
+
key: "create",
|
|
2915
|
+
value: function value(e) {
|
|
2916
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2917
|
+
var r, n, i;
|
|
2918
|
+
return de().wrap(function (t) {
|
|
2919
|
+
for (;;) switch (t.prev = t.next) {
|
|
2920
|
+
case 0:
|
|
2921
|
+
return qe("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2922
|
+
case 3:
|
|
2923
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2924
|
+
url: "/b2b/totp",
|
|
2925
|
+
body: Object.assign(Object.assign({}, e), {
|
|
2926
|
+
dfp_telemetry_id: n,
|
|
2927
|
+
captcha_token: i
|
|
2928
|
+
}),
|
|
2929
|
+
errorMessage: "Failed to create TOTP",
|
|
2930
|
+
method: "POST",
|
|
2931
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2932
|
+
}));
|
|
2933
|
+
case 7:
|
|
2934
|
+
case "end":
|
|
2935
|
+
return t.stop();
|
|
2936
|
+
}
|
|
2937
|
+
}, t, this);
|
|
2938
|
+
}));
|
|
2939
|
+
}
|
|
2940
|
+
}, {
|
|
2941
|
+
key: "authenticate",
|
|
2942
|
+
value: function value(e) {
|
|
2943
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2944
|
+
var r, n, i, o, s;
|
|
2945
|
+
return de().wrap(function (t) {
|
|
2946
|
+
for (;;) switch (t.prev = t.next) {
|
|
2947
|
+
case 0:
|
|
2948
|
+
return qe("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2949
|
+
case 3:
|
|
2950
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
2951
|
+
case 12:
|
|
2952
|
+
if (t.t4 = t.sent, t.t4) {
|
|
2953
|
+
t.next = 15;
|
|
2954
|
+
break;
|
|
2955
|
+
}
|
|
2956
|
+
t.t4 = void 0;
|
|
2957
|
+
case 15:
|
|
2958
|
+
return t.t5 = t.t4, t.t6 = {
|
|
2959
|
+
dfp_telemetry_id: t.t2,
|
|
2960
|
+
captcha_token: t.t3,
|
|
2961
|
+
intermediate_session_token: t.t5
|
|
2962
|
+
}, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
|
|
2963
|
+
url: "/b2b/totp/authenticate",
|
|
2964
|
+
body: o,
|
|
2965
|
+
errorMessage: "Failed to authenticate TOTP",
|
|
2966
|
+
method: "POST",
|
|
2967
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2968
|
+
});
|
|
2969
|
+
case 20:
|
|
2970
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2971
|
+
state: {
|
|
2972
|
+
session: s.member_session,
|
|
2973
|
+
member: s.member
|
|
2974
|
+
},
|
|
2975
|
+
session_token: s.session_token,
|
|
2976
|
+
session_jwt: s.session_jwt,
|
|
2977
|
+
intermediate_session_token: null
|
|
2978
|
+
}), t.abrupt("return", s);
|
|
2979
|
+
case 23:
|
|
2980
|
+
case "end":
|
|
2981
|
+
return t.stop();
|
|
2982
|
+
}
|
|
2983
|
+
}, t, this);
|
|
2984
|
+
}));
|
|
2985
|
+
}
|
|
2986
|
+
}]), e;
|
|
2987
|
+
}(),
|
|
2988
|
+
nt = function () {
|
|
2440
2989
|
function e(t, r, n) {
|
|
2441
2990
|
var i = this;
|
|
2442
|
-
|
|
2991
|
+
_e(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
2443
2992
|
var r;
|
|
2444
2993
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
2445
2994
|
}, this.isAuthorized = function (e, t) {
|
|
2446
2995
|
return i.policyPromise.then(function (r) {
|
|
2447
2996
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
2448
2997
|
});
|
|
2449
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
2450
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
2998
|
+
}, this.cachedPolicy = t.rbacPolicy ? ft.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
2999
|
+
return e.rbacPolicy ? (i.cachedPolicy = ft.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ke("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new ft([], []));
|
|
2451
3000
|
});
|
|
2452
3001
|
}
|
|
2453
|
-
return
|
|
3002
|
+
return pe(e, [{
|
|
2454
3003
|
key: "allPermissions",
|
|
2455
3004
|
value: function value() {
|
|
2456
3005
|
var e = this;
|
|
@@ -2467,15 +3016,15 @@ var de = s(function e(t, r) {
|
|
|
2467
3016
|
}
|
|
2468
3017
|
}]), e;
|
|
2469
3018
|
}(),
|
|
2470
|
-
|
|
3019
|
+
it = function () {
|
|
2471
3020
|
function e(t, r) {
|
|
2472
3021
|
var n = this;
|
|
2473
|
-
|
|
3022
|
+
_e(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
2474
3023
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
2475
3024
|
}, this._reauthenticateWithBackoff = function () {
|
|
2476
|
-
return
|
|
3025
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2477
3026
|
var r;
|
|
2478
|
-
return
|
|
3027
|
+
return de().wrap(function (t) {
|
|
2479
3028
|
for (;;) switch (t.prev = t.next) {
|
|
2480
3029
|
case 0:
|
|
2481
3030
|
r = 0;
|
|
@@ -2504,14 +3053,14 @@ var de = s(function e(t, r) {
|
|
|
2504
3053
|
}));
|
|
2505
3054
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
2506
3055
|
}
|
|
2507
|
-
return
|
|
3056
|
+
return pe(e, [{
|
|
2508
3057
|
key: "performBackgroundRefresh",
|
|
2509
3058
|
value: function value() {
|
|
2510
3059
|
var e = this;
|
|
2511
3060
|
this._reauthenticateWithBackoff().then(function () {
|
|
2512
3061
|
e.scheduleBackgroundRefresh();
|
|
2513
3062
|
})["catch"](function (t) {
|
|
2514
|
-
|
|
3063
|
+
Ne("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
2515
3064
|
error: t
|
|
2516
3065
|
}), e._subscriptionService.destroyState();
|
|
2517
3066
|
});
|
|
@@ -2537,30 +3086,29 @@ var de = s(function e(t, r) {
|
|
|
2537
3086
|
}, {
|
|
2538
3087
|
key: "isUnrecoverableError",
|
|
2539
3088
|
value: function value(e) {
|
|
2540
|
-
return
|
|
3089
|
+
return A.includes(e.error_type);
|
|
2541
3090
|
}
|
|
2542
3091
|
}]), e;
|
|
2543
3092
|
}();
|
|
2544
|
-
|
|
2545
|
-
var
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
Ee = function () {
|
|
3093
|
+
it.REFRESH_INTERVAL_MS = 18e4;
|
|
3094
|
+
var ot,
|
|
3095
|
+
st,
|
|
3096
|
+
at,
|
|
3097
|
+
ct,
|
|
3098
|
+
ut,
|
|
3099
|
+
lt,
|
|
3100
|
+
dt,
|
|
3101
|
+
ht,
|
|
3102
|
+
pt,
|
|
3103
|
+
_t,
|
|
3104
|
+
ft = function () {
|
|
2557
3105
|
function e(t, r) {
|
|
2558
3106
|
var n = this;
|
|
2559
|
-
|
|
3107
|
+
_e(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
2560
3108
|
return n.rolesByID[e.role_id] = e;
|
|
2561
3109
|
});
|
|
2562
3110
|
}
|
|
2563
|
-
return
|
|
3111
|
+
return pe(e, [{
|
|
2564
3112
|
key: "callerIsAuthorized",
|
|
2565
3113
|
value: function value(e, t, r) {
|
|
2566
3114
|
var n = this;
|
|
@@ -2594,7 +3142,7 @@ var _e,
|
|
|
2594
3142
|
}
|
|
2595
3143
|
}]), e;
|
|
2596
3144
|
}();
|
|
2597
|
-
function
|
|
3145
|
+
function mt(e, t, r, n) {
|
|
2598
3146
|
return new (r || (r = Promise))(function (i, o) {
|
|
2599
3147
|
function s(e) {
|
|
2600
3148
|
try {
|
|
@@ -2621,63 +3169,61 @@ function Te(e, t, r, n) {
|
|
|
2621
3169
|
}
|
|
2622
3170
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
2623
3171
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
2624
|
-
}(
|
|
3172
|
+
}(ot || (ot = {})), function (e) {
|
|
2625
3173
|
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";
|
|
2626
|
-
}(
|
|
3174
|
+
}(st || (st = {})), function (e) {
|
|
2627
3175
|
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";
|
|
2628
|
-
}(
|
|
3176
|
+
}(at || (at = {})), function (e) {
|
|
2629
3177
|
e.embedded = "embedded", e.floating = "floating";
|
|
2630
|
-
}(
|
|
3178
|
+
}(ct || (ct = {})), function (e) {
|
|
2631
3179
|
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
2632
|
-
}(
|
|
3180
|
+
}(ut || (ut = {})), function (e) {
|
|
2633
3181
|
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
2634
|
-
}(
|
|
2635
|
-
var
|
|
2636
|
-
_inherits(
|
|
2637
|
-
var _super = _createSuper(
|
|
2638
|
-
function
|
|
3182
|
+
}(lt || (lt = {}));
|
|
3183
|
+
var vt = /*#__PURE__*/function (_Error) {
|
|
3184
|
+
_inherits(vt, _Error);
|
|
3185
|
+
var _super = _createSuper(vt);
|
|
3186
|
+
function vt(e, t) {
|
|
2639
3187
|
var _this;
|
|
2640
|
-
_classCallCheck(this,
|
|
3188
|
+
_classCallCheck(this, vt);
|
|
2641
3189
|
_this = _super.call(this), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
|
|
2642
3190
|
return _this;
|
|
2643
3191
|
}
|
|
2644
|
-
return _createClass(
|
|
3192
|
+
return _createClass(vt);
|
|
2645
3193
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
2646
3194
|
!function (e) {
|
|
2647
|
-
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";
|
|
2648
|
-
}(ye || (ye = {})), function (e) {
|
|
2649
3195
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
2650
|
-
}(
|
|
3196
|
+
}(dt || (dt = {})), function (e) {
|
|
2651
3197
|
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
2652
|
-
}(
|
|
3198
|
+
}(ht || (ht = {})), function (e) {
|
|
2653
3199
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
2654
|
-
}(
|
|
3200
|
+
}(pt || (pt = {})), function (e) {
|
|
2655
3201
|
e.RequiredCatcha = "Catcha Required";
|
|
2656
|
-
}(
|
|
2657
|
-
var
|
|
3202
|
+
}(_t || (_t = {}));
|
|
3203
|
+
var bt = function bt(e) {
|
|
2658
3204
|
var t = {
|
|
2659
3205
|
isObject: function isObject(r, n) {
|
|
2660
|
-
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new
|
|
3206
|
+
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new vt(e, r + " must be an object.");
|
|
2661
3207
|
return t;
|
|
2662
3208
|
},
|
|
2663
3209
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
2664
3210
|
return void 0 === r ? t : t.isObject(e, r);
|
|
2665
3211
|
},
|
|
2666
3212
|
isString: function isString(r, n) {
|
|
2667
|
-
if ("string" != typeof n) throw new
|
|
3213
|
+
if ("string" != typeof n) throw new vt(e, r + " must be a string.");
|
|
2668
3214
|
return t;
|
|
2669
3215
|
},
|
|
2670
3216
|
isOptionalString: function isOptionalString(e, r) {
|
|
2671
3217
|
return void 0 === r ? t : t.isString(e, r);
|
|
2672
3218
|
},
|
|
2673
3219
|
isStringArray: function isStringArray(r, n) {
|
|
2674
|
-
if (!Array.isArray(n)) throw new
|
|
3220
|
+
if (!Array.isArray(n)) throw new vt(e, r + " must be an array of strings.");
|
|
2675
3221
|
var _iterator = _createForOfIteratorHelper(n),
|
|
2676
3222
|
_step;
|
|
2677
3223
|
try {
|
|
2678
3224
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2679
3225
|
var _t2 = _step.value;
|
|
2680
|
-
if ("string" != typeof _t2) throw new
|
|
3226
|
+
if ("string" != typeof _t2) throw new vt(e, r + " must be an array of strings.");
|
|
2681
3227
|
}
|
|
2682
3228
|
} catch (err) {
|
|
2683
3229
|
_iterator.e(err);
|
|
@@ -2690,14 +3236,14 @@ var Ce = function Ce(e) {
|
|
|
2690
3236
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
2691
3237
|
},
|
|
2692
3238
|
isNumber: function isNumber(r, n) {
|
|
2693
|
-
if ("number" != typeof n) throw new
|
|
3239
|
+
if ("number" != typeof n) throw new vt(e, r + " must be a number.");
|
|
2694
3240
|
return t;
|
|
2695
3241
|
},
|
|
2696
3242
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
2697
3243
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
2698
3244
|
},
|
|
2699
3245
|
isBoolean: function isBoolean(r, n) {
|
|
2700
|
-
if ("boolean" != typeof n) throw new
|
|
3246
|
+
if ("boolean" != typeof n) throw new vt(e, r + " must be a boolean.");
|
|
2701
3247
|
return t;
|
|
2702
3248
|
},
|
|
2703
3249
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -2706,26 +3252,26 @@ var Ce = function Ce(e) {
|
|
|
2706
3252
|
};
|
|
2707
3253
|
return t;
|
|
2708
3254
|
};
|
|
2709
|
-
var
|
|
3255
|
+
var gt;
|
|
2710
3256
|
!function (e) {
|
|
2711
3257
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
2712
|
-
}(
|
|
3258
|
+
}(gt || (gt = {})), Promise.resolve({
|
|
2713
3259
|
pkceRequiredForEmailMagicLinks: !1
|
|
2714
3260
|
}), Promise.resolve({
|
|
2715
3261
|
pkceRequiredForPasswordResets: !1
|
|
2716
3262
|
}), Promise.resolve({
|
|
2717
3263
|
pkceRequiredForEmailMagicLinks: !1
|
|
2718
3264
|
});
|
|
2719
|
-
var
|
|
3265
|
+
var yt = Promise.resolve({
|
|
2720
3266
|
pkceRequiredForPasswordResets: !1
|
|
2721
3267
|
});
|
|
2722
|
-
var
|
|
2723
|
-
function
|
|
2724
|
-
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
3268
|
+
var kt = /*#__PURE__*/function () {
|
|
3269
|
+
function kt(e, t, r) {
|
|
3270
|
+
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : yt;
|
|
2725
3271
|
var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
2726
3272
|
return {
|
|
2727
3273
|
isEnabled: function isEnabled() {
|
|
2728
|
-
return
|
|
3274
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2729
3275
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2730
3276
|
while (1) switch (_context.prev = _context.next) {
|
|
2731
3277
|
case 0:
|
|
@@ -2738,7 +3284,7 @@ var Be = /*#__PURE__*/function () {
|
|
|
2738
3284
|
}));
|
|
2739
3285
|
},
|
|
2740
3286
|
getTelemetryID: function getTelemetryID() {
|
|
2741
|
-
return
|
|
3287
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2742
3288
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2743
3289
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2744
3290
|
case 0:
|
|
@@ -2749,7 +3295,7 @@ var Be = /*#__PURE__*/function () {
|
|
|
2749
3295
|
}));
|
|
2750
3296
|
},
|
|
2751
3297
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
2752
|
-
return
|
|
3298
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2753
3299
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2754
3300
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2755
3301
|
case 0:
|
|
@@ -2765,7 +3311,7 @@ var Be = /*#__PURE__*/function () {
|
|
|
2765
3311
|
}));
|
|
2766
3312
|
},
|
|
2767
3313
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
2768
|
-
return
|
|
3314
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
2769
3315
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2770
3316
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2771
3317
|
case 0:
|
|
@@ -2779,13 +3325,13 @@ var Be = /*#__PURE__*/function () {
|
|
|
2779
3325
|
}
|
|
2780
3326
|
};
|
|
2781
3327
|
}();
|
|
2782
|
-
_classCallCheck(this,
|
|
3328
|
+
_classCallCheck(this, kt);
|
|
2783
3329
|
this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
|
|
2784
3330
|
}
|
|
2785
|
-
_createClass(
|
|
3331
|
+
_createClass(kt, [{
|
|
2786
3332
|
key: "getCodeChallenge",
|
|
2787
3333
|
value: function getCodeChallenge() {
|
|
2788
|
-
return
|
|
3334
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
2789
3335
|
var _yield$this$_config, e, t;
|
|
2790
3336
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2791
3337
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -2826,12 +3372,12 @@ var Be = /*#__PURE__*/function () {
|
|
|
2826
3372
|
}, {
|
|
2827
3373
|
key: "authenticate",
|
|
2828
3374
|
value: function authenticate(e) {
|
|
2829
|
-
return
|
|
3375
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
2830
3376
|
var t, r, _yield$this$dfpProtec, n, i, o;
|
|
2831
3377
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2832
3378
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2833
3379
|
case 0:
|
|
2834
|
-
|
|
3380
|
+
bt("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
|
|
2835
3381
|
_context6.next = 3;
|
|
2836
3382
|
return this._pkceManager.getPKPair();
|
|
2837
3383
|
case 3:
|
|
@@ -2886,12 +3432,12 @@ var Be = /*#__PURE__*/function () {
|
|
|
2886
3432
|
}, {
|
|
2887
3433
|
key: "resetByEmailStart",
|
|
2888
3434
|
value: function resetByEmailStart(e) {
|
|
2889
|
-
return
|
|
3435
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
2890
3436
|
var t, _yield$this$dfpProtec2, r, n;
|
|
2891
3437
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2892
3438
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2893
3439
|
case 0:
|
|
2894
|
-
|
|
3440
|
+
bt("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes);
|
|
2895
3441
|
_context7.next = 3;
|
|
2896
3442
|
return this.getCodeChallenge();
|
|
2897
3443
|
case 3:
|
|
@@ -2929,12 +3475,12 @@ var Be = /*#__PURE__*/function () {
|
|
|
2929
3475
|
}, {
|
|
2930
3476
|
key: "resetByEmail",
|
|
2931
3477
|
value: function resetByEmail(e) {
|
|
2932
|
-
return
|
|
3478
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
2933
3479
|
var _yield$this$dfpProtec3, t, r, n, i, o;
|
|
2934
3480
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
2935
3481
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2936
3482
|
case 0:
|
|
2937
|
-
|
|
3483
|
+
bt("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale);
|
|
2938
3484
|
_context8.next = 3;
|
|
2939
3485
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2940
3486
|
case 3:
|
|
@@ -2988,12 +3534,12 @@ var Be = /*#__PURE__*/function () {
|
|
|
2988
3534
|
}, {
|
|
2989
3535
|
key: "resetByExistingPassword",
|
|
2990
3536
|
value: function resetByExistingPassword(e) {
|
|
2991
|
-
return
|
|
3537
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
2992
3538
|
var _yield$this$dfpProtec4, t, r, n;
|
|
2993
3539
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
2994
3540
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2995
3541
|
case 0:
|
|
2996
|
-
|
|
3542
|
+
bt("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
|
|
2997
3543
|
_context9.next = 3;
|
|
2998
3544
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2999
3545
|
case 3:
|
|
@@ -3042,12 +3588,12 @@ var Be = /*#__PURE__*/function () {
|
|
|
3042
3588
|
}, {
|
|
3043
3589
|
key: "resetBySession",
|
|
3044
3590
|
value: function resetBySession(e) {
|
|
3045
|
-
return
|
|
3591
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3046
3592
|
var _yield$this$dfpProtec5, t, r, n;
|
|
3047
3593
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3048
3594
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3049
3595
|
case 0:
|
|
3050
|
-
|
|
3596
|
+
bt("stytch.passwords.resetBySession").isString("password", e.password);
|
|
3051
3597
|
_context10.next = 3;
|
|
3052
3598
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3053
3599
|
case 3:
|
|
@@ -3087,11 +3633,11 @@ var Be = /*#__PURE__*/function () {
|
|
|
3087
3633
|
}, {
|
|
3088
3634
|
key: "strengthCheck",
|
|
3089
3635
|
value: function strengthCheck(e) {
|
|
3090
|
-
return
|
|
3636
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
3091
3637
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
3092
3638
|
while (1) switch (_context11.prev = _context11.next) {
|
|
3093
3639
|
case 0:
|
|
3094
|
-
return _context11.abrupt("return", (
|
|
3640
|
+
return _context11.abrupt("return", (bt("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
|
|
3095
3641
|
url: "/b2b/passwords/strength_check",
|
|
3096
3642
|
method: "POST",
|
|
3097
3643
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3108,21 +3654,21 @@ var Be = /*#__PURE__*/function () {
|
|
|
3108
3654
|
}));
|
|
3109
3655
|
}
|
|
3110
3656
|
}]);
|
|
3111
|
-
return
|
|
3657
|
+
return kt;
|
|
3112
3658
|
}();
|
|
3113
|
-
var
|
|
3114
|
-
var
|
|
3115
|
-
function
|
|
3659
|
+
var wt = "bootstrap";
|
|
3660
|
+
var St = /*#__PURE__*/function () {
|
|
3661
|
+
function St(e, t, r) {
|
|
3116
3662
|
var _this2 = this;
|
|
3117
|
-
_classCallCheck(this,
|
|
3663
|
+
_classCallCheck(this, St);
|
|
3118
3664
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3119
3665
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3120
3666
|
method: "GET",
|
|
3121
3667
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3122
|
-
}).then(
|
|
3123
|
-
return _this2._dataLayer.setItem(
|
|
3668
|
+
}).then(St.mapBootstrapData).then(function (e) {
|
|
3669
|
+
return _this2._dataLayer.setItem(wt, JSON.stringify(e)), e;
|
|
3124
3670
|
})["catch"](function (e) {
|
|
3125
|
-
return
|
|
3671
|
+
return Ke(e), {
|
|
3126
3672
|
displayWatermark: !1,
|
|
3127
3673
|
cnameDomain: null,
|
|
3128
3674
|
emailDomains: ["stytch.com"],
|
|
@@ -3141,10 +3687,10 @@ var De = /*#__PURE__*/function () {
|
|
|
3141
3687
|
};
|
|
3142
3688
|
});
|
|
3143
3689
|
}
|
|
3144
|
-
_createClass(
|
|
3690
|
+
_createClass(St, [{
|
|
3145
3691
|
key: "getSync",
|
|
3146
3692
|
value: function getSync() {
|
|
3147
|
-
var e = this._dataLayer.getItem(
|
|
3693
|
+
var e = this._dataLayer.getItem(wt);
|
|
3148
3694
|
if (null === e) return {
|
|
3149
3695
|
displayWatermark: !1,
|
|
3150
3696
|
cnameDomain: null,
|
|
@@ -3215,13 +3761,13 @@ var De = /*#__PURE__*/function () {
|
|
|
3215
3761
|
};
|
|
3216
3762
|
}
|
|
3217
3763
|
}]);
|
|
3218
|
-
return
|
|
3764
|
+
return St;
|
|
3219
3765
|
}();
|
|
3220
|
-
var
|
|
3766
|
+
var Pt = /*#__PURE__*/_createClass(function Pt(e) {
|
|
3221
3767
|
var _this3 = this;
|
|
3222
|
-
_classCallCheck(this,
|
|
3768
|
+
_classCallCheck(this, Pt);
|
|
3223
3769
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3224
|
-
return
|
|
3770
|
+
return mt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
3225
3771
|
var _yield$this$state, e, t, r;
|
|
3226
3772
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
3227
3773
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -3252,7 +3798,7 @@ var Ie = /*#__PURE__*/_createClass(function Ie(e) {
|
|
|
3252
3798
|
}, _callee12, this);
|
|
3253
3799
|
}));
|
|
3254
3800
|
}, this.state = e.then(function (e) {
|
|
3255
|
-
return
|
|
3801
|
+
return mt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
3256
3802
|
var t;
|
|
3257
3803
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
3258
3804
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -3263,7 +3809,7 @@ var Ie = /*#__PURE__*/_createClass(function Ie(e) {
|
|
|
3263
3809
|
}
|
|
3264
3810
|
_context13.t1 = !0;
|
|
3265
3811
|
_context13.next = 4;
|
|
3266
|
-
return t = e.captchaSettings.siteKey,
|
|
3812
|
+
return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3267
3813
|
return window.grecaptcha.enterprise;
|
|
3268
3814
|
});
|
|
3269
3815
|
case 4:
|
|
@@ -3290,18 +3836,18 @@ var Ie = /*#__PURE__*/_createClass(function Ie(e) {
|
|
|
3290
3836
|
}));
|
|
3291
3837
|
});
|
|
3292
3838
|
});
|
|
3293
|
-
var
|
|
3294
|
-
function
|
|
3295
|
-
_classCallCheck(this,
|
|
3839
|
+
var At = /*#__PURE__*/function () {
|
|
3840
|
+
function At(e, t, r, n) {
|
|
3841
|
+
_classCallCheck(this, At);
|
|
3296
3842
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3297
3843
|
return null;
|
|
3298
|
-
}, this.eventLogger = new
|
|
3844
|
+
}, this.eventLogger = new He({
|
|
3299
3845
|
maxBatchSize: 15,
|
|
3300
3846
|
intervalDurationMs: 800,
|
|
3301
3847
|
logEventURL: this.buildSDKUrl("/events")
|
|
3302
3848
|
});
|
|
3303
3849
|
}
|
|
3304
|
-
_createClass(
|
|
3850
|
+
_createClass(At, [{
|
|
3305
3851
|
key: "logEvent",
|
|
3306
3852
|
value: function logEvent(_ref) {
|
|
3307
3853
|
var e = _ref.name,
|
|
@@ -3321,9 +3867,9 @@ var Le = /*#__PURE__*/function () {
|
|
|
3321
3867
|
key: "createTelemetryBlob",
|
|
3322
3868
|
value: function createTelemetryBlob() {
|
|
3323
3869
|
return Object.assign(Object.assign({
|
|
3324
|
-
event_id: "event-id-".concat(
|
|
3325
|
-
app_session_id: "app-session-id-".concat(
|
|
3326
|
-
persistent_id: "persistent-id-".concat(
|
|
3870
|
+
event_id: "event-id-".concat(Re()),
|
|
3871
|
+
app_session_id: "app-session-id-".concat(Re()),
|
|
3872
|
+
persistent_id: "persistent-id-".concat(Re()),
|
|
3327
3873
|
client_sent_at: new Date().toISOString(),
|
|
3328
3874
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3329
3875
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3332,7 +3878,7 @@ var Le = /*#__PURE__*/function () {
|
|
|
3332
3878
|
},
|
|
3333
3879
|
sdk: {
|
|
3334
3880
|
identifier: "Stytch.js Javascript SDK",
|
|
3335
|
-
version: "
|
|
3881
|
+
version: "4.1.1"
|
|
3336
3882
|
}
|
|
3337
3883
|
});
|
|
3338
3884
|
}
|
|
@@ -3343,13 +3889,13 @@ var Le = /*#__PURE__*/function () {
|
|
|
3343
3889
|
t = _ref2.body,
|
|
3344
3890
|
r = _ref2.errorMessage,
|
|
3345
3891
|
n = _ref2.method;
|
|
3346
|
-
return
|
|
3892
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
3347
3893
|
var i, o, s, a;
|
|
3348
3894
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
3349
3895
|
while (1) switch (_context14.prev = _context14.next) {
|
|
3350
3896
|
case 0:
|
|
3351
3897
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, o = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3352
|
-
return _context14.abrupt("return",
|
|
3898
|
+
return _context14.abrupt("return", Ae({
|
|
3353
3899
|
basicAuthHeader: o,
|
|
3354
3900
|
body: t,
|
|
3355
3901
|
errorMessage: r,
|
|
@@ -3372,47 +3918,47 @@ var Le = /*#__PURE__*/function () {
|
|
|
3372
3918
|
t = _ref3.body,
|
|
3373
3919
|
r = _ref3.errorMessage,
|
|
3374
3920
|
n = _ref3.method,
|
|
3375
|
-
|
|
3376
|
-
return
|
|
3377
|
-
var s, a, c
|
|
3921
|
+
i = _ref3.retryCallback;
|
|
3922
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
3923
|
+
var o, s, a, c;
|
|
3378
3924
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
3379
3925
|
while (1) switch (_context15.prev = _context15.next) {
|
|
3380
3926
|
case 0:
|
|
3381
|
-
|
|
3927
|
+
o = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (o || this._publicToken)), a = window.btoa(JSON.stringify(this.createTelemetryBlob())), c = window.location.origin;
|
|
3382
3928
|
return _context15.abrupt("return", function (e) {
|
|
3383
3929
|
var t = e.method,
|
|
3384
3930
|
r = e.errorMessage,
|
|
3385
3931
|
n = e.finalURL,
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
return
|
|
3392
|
-
var
|
|
3393
|
-
return
|
|
3932
|
+
i = e.basicAuthHeader,
|
|
3933
|
+
o = e.xSDKClientHeader,
|
|
3934
|
+
s = e.xSDKParentHostHeader,
|
|
3935
|
+
a = e.body,
|
|
3936
|
+
c = e.retryCallback;
|
|
3937
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
3938
|
+
var u;
|
|
3939
|
+
return de().wrap(function (e) {
|
|
3394
3940
|
for (;;) switch (e.prev = e.next) {
|
|
3395
3941
|
case 0:
|
|
3396
|
-
return
|
|
3942
|
+
return u = {
|
|
3397
3943
|
method: t,
|
|
3398
3944
|
errorMessage: r,
|
|
3399
3945
|
finalURL: n,
|
|
3400
|
-
basicAuthHeader:
|
|
3401
|
-
xSDKClientHeader:
|
|
3402
|
-
xSDKParentHostHeader:
|
|
3403
|
-
body:
|
|
3404
|
-
}, e.prev = 1, e.next = 4,
|
|
3946
|
+
basicAuthHeader: i,
|
|
3947
|
+
xSDKClientHeader: o,
|
|
3948
|
+
xSDKParentHostHeader: s,
|
|
3949
|
+
body: a
|
|
3950
|
+
}, e.prev = 1, e.next = 4, Ae(u);
|
|
3405
3951
|
case 4:
|
|
3406
3952
|
case 15:
|
|
3407
3953
|
return e.abrupt("return", e.sent);
|
|
3408
3954
|
case 7:
|
|
3409
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3955
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Pe)) {
|
|
3410
3956
|
e.next = 16;
|
|
3411
3957
|
break;
|
|
3412
3958
|
}
|
|
3413
|
-
return e.next = 12,
|
|
3959
|
+
return e.next = 12, c(e.t0, u);
|
|
3414
3960
|
case 12:
|
|
3415
|
-
return
|
|
3961
|
+
return u = e.sent, e.next = 15, Ae(u);
|
|
3416
3962
|
case 16:
|
|
3417
3963
|
throw e.t0;
|
|
3418
3964
|
case 17:
|
|
@@ -3422,14 +3968,14 @@ var Le = /*#__PURE__*/function () {
|
|
|
3422
3968
|
}, e, null, [[1, 7]]);
|
|
3423
3969
|
}));
|
|
3424
3970
|
}({
|
|
3425
|
-
basicAuthHeader:
|
|
3971
|
+
basicAuthHeader: s,
|
|
3426
3972
|
body: t,
|
|
3427
3973
|
errorMessage: r,
|
|
3428
3974
|
finalURL: this.buildSDKUrl(e),
|
|
3429
3975
|
method: n,
|
|
3430
|
-
xSDKClientHeader:
|
|
3431
|
-
xSDKParentHostHeader:
|
|
3432
|
-
retryCallback:
|
|
3976
|
+
xSDKClientHeader: a,
|
|
3977
|
+
xSDKParentHostHeader: c,
|
|
3978
|
+
retryCallback: i
|
|
3433
3979
|
}));
|
|
3434
3980
|
case 2:
|
|
3435
3981
|
case "end":
|
|
@@ -3444,18 +3990,18 @@ var Le = /*#__PURE__*/function () {
|
|
|
3444
3990
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3445
3991
|
}
|
|
3446
3992
|
}]);
|
|
3447
|
-
return
|
|
3993
|
+
return At;
|
|
3448
3994
|
}();
|
|
3449
|
-
function
|
|
3995
|
+
function Ct(e) {
|
|
3450
3996
|
var t = e.toString(16);
|
|
3451
3997
|
return 1 === t.length && (t = "0" + t), t;
|
|
3452
3998
|
}
|
|
3453
|
-
var
|
|
3454
|
-
function
|
|
3455
|
-
_classCallCheck(this,
|
|
3999
|
+
var Tt = /*#__PURE__*/function () {
|
|
4000
|
+
function Tt(e, t) {
|
|
4001
|
+
_classCallCheck(this, Tt);
|
|
3456
4002
|
this._dataLayer = e, this.namespace = t;
|
|
3457
4003
|
}
|
|
3458
|
-
_createClass(
|
|
4004
|
+
_createClass(Tt, [{
|
|
3459
4005
|
key: "key",
|
|
3460
4006
|
value: function key() {
|
|
3461
4007
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3463,13 +4009,13 @@ var Ne = /*#__PURE__*/function () {
|
|
|
3463
4009
|
}, {
|
|
3464
4010
|
key: "startPKCETransaction",
|
|
3465
4011
|
value: function startPKCETransaction() {
|
|
3466
|
-
return
|
|
4012
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
3467
4013
|
var e;
|
|
3468
4014
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
3469
4015
|
while (1) switch (_context16.prev = _context16.next) {
|
|
3470
4016
|
case 0:
|
|
3471
4017
|
_context16.next = 2;
|
|
3472
|
-
return
|
|
4018
|
+
return Tt.createProofkeyPair();
|
|
3473
4019
|
case 2:
|
|
3474
4020
|
e = _context16.sent;
|
|
3475
4021
|
return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3487,7 +4033,7 @@ var Ne = /*#__PURE__*/function () {
|
|
|
3487
4033
|
if (null !== e) try {
|
|
3488
4034
|
return JSON.parse(e);
|
|
3489
4035
|
} catch (e) {
|
|
3490
|
-
return void
|
|
4036
|
+
return void Ne("Found malformed Proof Key pair in localstorage.");
|
|
3491
4037
|
}
|
|
3492
4038
|
}
|
|
3493
4039
|
}, {
|
|
@@ -3498,7 +4044,7 @@ var Ne = /*#__PURE__*/function () {
|
|
|
3498
4044
|
}], [{
|
|
3499
4045
|
key: "createProofkeyPair",
|
|
3500
4046
|
value: function createProofkeyPair() {
|
|
3501
|
-
return
|
|
4047
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
3502
4048
|
var _String$fromCharCode;
|
|
3503
4049
|
var e, t, r, n;
|
|
3504
4050
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
@@ -3506,7 +4052,7 @@ var Ne = /*#__PURE__*/function () {
|
|
|
3506
4052
|
case 0:
|
|
3507
4053
|
e = new Uint32Array(16);
|
|
3508
4054
|
window.crypto.getRandomValues(e);
|
|
3509
|
-
t = Array.from(e).map(
|
|
4055
|
+
t = Array.from(e).map(Ct).join("");
|
|
3510
4056
|
_context17.next = 5;
|
|
3511
4057
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3512
4058
|
case 5:
|
|
@@ -3523,14 +4069,14 @@ var Ne = /*#__PURE__*/function () {
|
|
|
3523
4069
|
}));
|
|
3524
4070
|
}
|
|
3525
4071
|
}]);
|
|
3526
|
-
return
|
|
4072
|
+
return Tt;
|
|
3527
4073
|
}();
|
|
3528
|
-
var
|
|
3529
|
-
function
|
|
3530
|
-
_classCallCheck(this,
|
|
4074
|
+
var Ot = /*#__PURE__*/function () {
|
|
4075
|
+
function Ot(e) {
|
|
4076
|
+
_classCallCheck(this, Ot);
|
|
3531
4077
|
this._networkClient = e;
|
|
3532
4078
|
}
|
|
3533
|
-
_createClass(
|
|
4079
|
+
_createClass(Ot, [{
|
|
3534
4080
|
key: "searchUser",
|
|
3535
4081
|
value: function searchUser(e) {
|
|
3536
4082
|
return this._networkClient.fetchSDK({
|
|
@@ -3568,9 +4114,9 @@ var je = /*#__PURE__*/function () {
|
|
|
3568
4114
|
});
|
|
3569
4115
|
}
|
|
3570
4116
|
}]);
|
|
3571
|
-
return
|
|
4117
|
+
return Ot;
|
|
3572
4118
|
}();
|
|
3573
|
-
var
|
|
4119
|
+
var Et = function Et(e) {
|
|
3574
4120
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3575
4121
|
var _t$split = t.split("="),
|
|
3576
4122
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3579,17 +4125,17 @@ var Fe = function Fe(e) {
|
|
|
3579
4125
|
}).length > 1;
|
|
3580
4126
|
};
|
|
3581
4127
|
/*! js-cookie v3.0.1 | MIT */
|
|
3582
|
-
function
|
|
4128
|
+
function xt(e) {
|
|
3583
4129
|
for (var t = 1; t < arguments.length; t++) {
|
|
3584
4130
|
var r = arguments[t];
|
|
3585
4131
|
for (var n in r) e[n] = r[n];
|
|
3586
4132
|
}
|
|
3587
4133
|
return e;
|
|
3588
4134
|
}
|
|
3589
|
-
var
|
|
4135
|
+
var Dt = function e(t, r) {
|
|
3590
4136
|
function n(e, n, i) {
|
|
3591
4137
|
if ("undefined" != typeof document) {
|
|
3592
|
-
"number" == typeof (i =
|
|
4138
|
+
"number" == typeof (i = xt({}, 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);
|
|
3593
4139
|
var o = "";
|
|
3594
4140
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
3595
4141
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -3611,15 +4157,15 @@ var Ue = function e(t, r) {
|
|
|
3611
4157
|
}
|
|
3612
4158
|
},
|
|
3613
4159
|
remove: function remove(e, t) {
|
|
3614
|
-
n(e, "",
|
|
4160
|
+
n(e, "", xt({}, t, {
|
|
3615
4161
|
expires: -1
|
|
3616
4162
|
}));
|
|
3617
4163
|
},
|
|
3618
4164
|
withAttributes: function withAttributes(t) {
|
|
3619
|
-
return e(this.converter,
|
|
4165
|
+
return e(this.converter, xt({}, this.attributes, t));
|
|
3620
4166
|
},
|
|
3621
4167
|
withConverter: function withConverter(t) {
|
|
3622
|
-
return e(
|
|
4168
|
+
return e(xt({}, this.converter, t), this.attributes);
|
|
3623
4169
|
}
|
|
3624
4170
|
}, {
|
|
3625
4171
|
attributes: {
|
|
@@ -3639,26 +4185,26 @@ var Ue = function e(t, r) {
|
|
|
3639
4185
|
}, {
|
|
3640
4186
|
path: "/"
|
|
3641
4187
|
});
|
|
3642
|
-
var
|
|
4188
|
+
var Rt = function Rt(e) {
|
|
3643
4189
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3644
4190
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3645
4191
|
};
|
|
3646
|
-
var
|
|
3647
|
-
function
|
|
4192
|
+
var It = /*#__PURE__*/function () {
|
|
4193
|
+
function It(e, t) {
|
|
3648
4194
|
var _this4 = this;
|
|
3649
|
-
_classCallCheck(this,
|
|
4195
|
+
_classCallCheck(this, It);
|
|
3650
4196
|
this.browserSessionStorage = {
|
|
3651
4197
|
getItem: function getItem(e) {
|
|
3652
|
-
return sessionStorage.getItem(
|
|
4198
|
+
return sessionStorage.getItem(Rt(_this4.publicToken, e));
|
|
3653
4199
|
},
|
|
3654
4200
|
setItem: function setItem(e, t) {
|
|
3655
|
-
return sessionStorage.setItem(
|
|
4201
|
+
return sessionStorage.setItem(Rt(_this4.publicToken, e), t);
|
|
3656
4202
|
},
|
|
3657
4203
|
removeItem: function removeItem(e) {
|
|
3658
|
-
return sessionStorage.removeItem(
|
|
4204
|
+
return sessionStorage.removeItem(Rt(_this4.publicToken, e));
|
|
3659
4205
|
}
|
|
3660
|
-
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
3661
|
-
var r = localStorage.getItem(
|
|
4206
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4207
|
+
var r = localStorage.getItem(Rt(this.publicToken));
|
|
3662
4208
|
if (!r) return;
|
|
3663
4209
|
var n;
|
|
3664
4210
|
try {
|
|
@@ -3668,7 +4214,7 @@ var We = /*#__PURE__*/function () {
|
|
|
3668
4214
|
}
|
|
3669
4215
|
this.state = n;
|
|
3670
4216
|
}
|
|
3671
|
-
_createClass(
|
|
4217
|
+
_createClass(It, [{
|
|
3672
4218
|
key: "opaqueTokenCookieName",
|
|
3673
4219
|
get: function get() {
|
|
3674
4220
|
var e;
|
|
@@ -3690,14 +4236,14 @@ var We = /*#__PURE__*/function () {
|
|
|
3690
4236
|
key: "readSessionCookie",
|
|
3691
4237
|
value: function readSessionCookie() {
|
|
3692
4238
|
return {
|
|
3693
|
-
session_token:
|
|
3694
|
-
session_jwt:
|
|
4239
|
+
session_token: Dt.get(this.opaqueTokenCookieName),
|
|
4240
|
+
session_jwt: Dt.get(this.jwtCookieName)
|
|
3695
4241
|
};
|
|
3696
4242
|
}
|
|
3697
4243
|
}, {
|
|
3698
4244
|
key: "readIntermediateSessionTokenCookie",
|
|
3699
4245
|
value: function readIntermediateSessionTokenCookie() {
|
|
3700
|
-
return
|
|
4246
|
+
return Dt.get(this.istCookieName);
|
|
3701
4247
|
}
|
|
3702
4248
|
}, {
|
|
3703
4249
|
key: "writeSessionCookie",
|
|
@@ -3706,32 +4252,32 @@ var We = /*#__PURE__*/function () {
|
|
|
3706
4252
|
var o = e.state,
|
|
3707
4253
|
s = e.session_token,
|
|
3708
4254
|
a = e.session_jwt,
|
|
3709
|
-
c =
|
|
4255
|
+
c = It.generateCookieOpts({
|
|
3710
4256
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
3711
4257
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3712
4258
|
path: this._cookiePath,
|
|
3713
4259
|
domain: this._domain
|
|
3714
4260
|
});
|
|
3715
|
-
|
|
3716
|
-
var u =
|
|
4261
|
+
Dt.set(this.opaqueTokenCookieName, s, c), Dt.set(this.jwtCookieName, a, c);
|
|
4262
|
+
var u = It.generateCookieOpts({
|
|
3717
4263
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
3718
4264
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
3719
4265
|
path: this._cookiePath,
|
|
3720
4266
|
domain: this._domain
|
|
3721
4267
|
});
|
|
3722
|
-
|
|
4268
|
+
Et(this.jwtCookieName) && Dt.remove(this.jwtCookieName, u), Et(this.opaqueTokenCookieName) && Dt.remove(this.opaqueTokenCookieName, u), Et(this.jwtCookieName) && Ne("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Et(this.opaqueTokenCookieName) && Ne("Could not remove extraneous opaque token cookie.");
|
|
3723
4269
|
}
|
|
3724
4270
|
}, {
|
|
3725
4271
|
key: "writeIntermediateSessionTokenCookie",
|
|
3726
4272
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
3727
4273
|
var t = new Date(Date.now() + 6e5),
|
|
3728
|
-
r =
|
|
4274
|
+
r = It.generateCookieOpts({
|
|
3729
4275
|
expiresAt: t.toString(),
|
|
3730
4276
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3731
4277
|
path: this._cookiePath,
|
|
3732
4278
|
domain: this._domain
|
|
3733
4279
|
});
|
|
3734
|
-
|
|
4280
|
+
Dt.set(this.istCookieName, e, r);
|
|
3735
4281
|
}
|
|
3736
4282
|
}, {
|
|
3737
4283
|
key: "removeSessionCookie",
|
|
@@ -3750,14 +4296,14 @@ var We = /*#__PURE__*/function () {
|
|
|
3750
4296
|
[!0, !1].forEach(function (t) {
|
|
3751
4297
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
3752
4298
|
[_this5._domain, null].forEach(function (n) {
|
|
3753
|
-
var i =
|
|
4299
|
+
var i = It.generateCookieOpts({
|
|
3754
4300
|
expiresAt: new Date(0).toString(),
|
|
3755
4301
|
availableToSubdomains: t,
|
|
3756
4302
|
path: r,
|
|
3757
4303
|
domain: n
|
|
3758
4304
|
});
|
|
3759
4305
|
e.forEach(function (e) {
|
|
3760
|
-
|
|
4306
|
+
Dt.remove(e, i);
|
|
3761
4307
|
});
|
|
3762
4308
|
});
|
|
3763
4309
|
});
|
|
@@ -3766,22 +4312,31 @@ var We = /*#__PURE__*/function () {
|
|
|
3766
4312
|
}, {
|
|
3767
4313
|
key: "syncToLocalStorage",
|
|
3768
4314
|
value: function syncToLocalStorage() {
|
|
3769
|
-
localStorage.setItem(
|
|
4315
|
+
localStorage.setItem(Rt(this.publicToken), JSON.stringify(this.state));
|
|
3770
4316
|
}
|
|
3771
4317
|
}, {
|
|
3772
4318
|
key: "getItem",
|
|
3773
4319
|
value: function getItem(e) {
|
|
3774
|
-
return localStorage.getItem(
|
|
4320
|
+
return localStorage.getItem(Rt(this.publicToken, e));
|
|
3775
4321
|
}
|
|
3776
4322
|
}, {
|
|
3777
4323
|
key: "setItem",
|
|
3778
4324
|
value: function setItem(e, t) {
|
|
3779
|
-
return localStorage.setItem(
|
|
4325
|
+
return localStorage.setItem(Rt(this.publicToken, e), t);
|
|
3780
4326
|
}
|
|
3781
4327
|
}, {
|
|
3782
4328
|
key: "removeItem",
|
|
3783
4329
|
value: function removeItem(e) {
|
|
3784
|
-
return localStorage.removeItem(
|
|
4330
|
+
return localStorage.removeItem(Rt(this.publicToken, e));
|
|
4331
|
+
}
|
|
4332
|
+
}, {
|
|
4333
|
+
key: "markStateKeysUpdated",
|
|
4334
|
+
value: function markStateKeysUpdated(e) {
|
|
4335
|
+
var _this6 = this;
|
|
4336
|
+
var t = this.stateKeysUpdated.size;
|
|
4337
|
+
return e.forEach(function (e) {
|
|
4338
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4339
|
+
}), t !== this.stateKeysUpdated.size;
|
|
3785
4340
|
}
|
|
3786
4341
|
}], [{
|
|
3787
4342
|
key: "generateCookieOpts",
|
|
@@ -3797,64 +4352,64 @@ var We = /*#__PURE__*/function () {
|
|
|
3797
4352
|
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;
|
|
3798
4353
|
}
|
|
3799
4354
|
}]);
|
|
3800
|
-
return
|
|
4355
|
+
return It;
|
|
3801
4356
|
}();
|
|
3802
|
-
var
|
|
3803
|
-
_inherits(
|
|
3804
|
-
var _super2 = _createSuper(
|
|
3805
|
-
function
|
|
3806
|
-
_classCallCheck(this,
|
|
4357
|
+
var Bt = /*#__PURE__*/function (_It) {
|
|
4358
|
+
_inherits(Bt, _It);
|
|
4359
|
+
var _super2 = _createSuper(Bt);
|
|
4360
|
+
function Bt() {
|
|
4361
|
+
_classCallCheck(this, Bt);
|
|
3807
4362
|
return _super2.apply(this, arguments);
|
|
3808
4363
|
}
|
|
3809
|
-
return _createClass(
|
|
3810
|
-
}(
|
|
3811
|
-
var
|
|
3812
|
-
|
|
4364
|
+
return _createClass(Bt);
|
|
4365
|
+
}(It);
|
|
4366
|
+
var Lt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4367
|
+
Mt = function Mt(e, t) {
|
|
3813
4368
|
var r = function () {
|
|
3814
4369
|
var e = window;
|
|
3815
|
-
return e[
|
|
4370
|
+
return e[Lt] || (e[Lt] = {}), e[Lt];
|
|
3816
4371
|
}();
|
|
3817
|
-
return r[e] || (r[e] = new
|
|
4372
|
+
return r[e] || (r[e] = new Bt(e, t)), r[e];
|
|
3818
4373
|
},
|
|
3819
|
-
|
|
4374
|
+
jt = function jt(e, t) {
|
|
3820
4375
|
Object.values(e).forEach(function (e) {
|
|
3821
4376
|
return e(t);
|
|
3822
4377
|
});
|
|
3823
4378
|
},
|
|
3824
|
-
|
|
3825
|
-
var
|
|
3826
|
-
|
|
3827
|
-
return function
|
|
3828
|
-
return
|
|
3829
|
-
return !(e in
|
|
3830
|
-
}) && Object.entries(
|
|
3831
|
-
var
|
|
3832
|
-
return !
|
|
3833
|
-
}).every(function (
|
|
3834
|
-
var
|
|
3835
|
-
i =
|
|
3836
|
-
|
|
3837
|
-
return
|
|
3838
|
-
}) :
|
|
4379
|
+
Ft = function () {
|
|
4380
|
+
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4381
|
+
t = void 0 === e ? [] : e;
|
|
4382
|
+
return function e(r, n) {
|
|
4383
|
+
return le(r) === le(n) && (null === r || null === n ? r === n : "object" === le(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4384
|
+
return !(e in n);
|
|
4385
|
+
}) && Object.entries(r).filter(function (e) {
|
|
4386
|
+
var r = ae(e, 1)[0];
|
|
4387
|
+
return !t.includes(r);
|
|
4388
|
+
}).every(function (t) {
|
|
4389
|
+
var r = ae(t, 2),
|
|
4390
|
+
i = r[0],
|
|
4391
|
+
o = r[1];
|
|
4392
|
+
return e(o, n[i]);
|
|
4393
|
+
}) : r === n);
|
|
3839
4394
|
};
|
|
3840
4395
|
}({
|
|
3841
4396
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
3842
4397
|
});
|
|
3843
|
-
var
|
|
3844
|
-
function
|
|
3845
|
-
var
|
|
3846
|
-
_classCallCheck(this,
|
|
4398
|
+
var Nt = /*#__PURE__*/function () {
|
|
4399
|
+
function Nt(e, t) {
|
|
4400
|
+
var _this7 = this;
|
|
4401
|
+
_classCallCheck(this, Nt);
|
|
3847
4402
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
3848
|
-
if (e.key !==
|
|
3849
|
-
if (null === e.newValue || "null" === e.newValue) return void
|
|
4403
|
+
if (e.key !== Rt(_this7._publicToken)) return;
|
|
4404
|
+
if (null === e.newValue || "null" === e.newValue) return void _this7.destroyState();
|
|
3850
4405
|
var t = JSON.parse(e.newValue);
|
|
3851
|
-
|
|
4406
|
+
_this7.updateState(t);
|
|
3852
4407
|
}, window.addEventListener("storage", this._listen);
|
|
3853
4408
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
3854
4409
|
r = _this$_datalayer$read.session_token;
|
|
3855
4410
|
r || this.destroyState();
|
|
3856
4411
|
}
|
|
3857
|
-
_createClass(
|
|
4412
|
+
_createClass(Nt, [{
|
|
3858
4413
|
key: "getTokens",
|
|
3859
4414
|
value: function getTokens() {
|
|
3860
4415
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -3885,7 +4440,9 @@ var Je = /*#__PURE__*/function () {
|
|
|
3885
4440
|
value: function _updateStateAndTokensInternal(e) {
|
|
3886
4441
|
var t = this._datalayer.state,
|
|
3887
4442
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
3888
|
-
this._datalayer.state = r
|
|
4443
|
+
this._datalayer.state = r;
|
|
4444
|
+
var n = e.state ? Object.keys(e.state) : [];
|
|
4445
|
+
!this._datalayer.markStateKeysUpdated(n) && Ft(t, r) || jt(this._datalayer.subscriptions, r);
|
|
3889
4446
|
}
|
|
3890
4447
|
}, {
|
|
3891
4448
|
key: "updateStateAndTokens",
|
|
@@ -3897,7 +4454,11 @@ var Je = /*#__PURE__*/function () {
|
|
|
3897
4454
|
value: function updateState(e) {
|
|
3898
4455
|
var t = this._datalayer.state,
|
|
3899
4456
|
r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
3900
|
-
this._datalayer.state = r
|
|
4457
|
+
this._datalayer.state = r;
|
|
4458
|
+
var n = e ? Object.keys(e) : [],
|
|
4459
|
+
i = this._datalayer.markStateKeysUpdated(n),
|
|
4460
|
+
o = !Ft(t, r);
|
|
4461
|
+
(i || o) && (jt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
3901
4462
|
}
|
|
3902
4463
|
}, {
|
|
3903
4464
|
key: "updateTokens",
|
|
@@ -3937,71 +4498,71 @@ var Je = /*#__PURE__*/function () {
|
|
|
3937
4498
|
return null;
|
|
3938
4499
|
}
|
|
3939
4500
|
}]);
|
|
3940
|
-
return
|
|
4501
|
+
return Nt;
|
|
3941
4502
|
}();
|
|
3942
|
-
var
|
|
3943
|
-
_inherits(
|
|
3944
|
-
var _super3 = _createSuper(
|
|
3945
|
-
function
|
|
3946
|
-
var
|
|
3947
|
-
_classCallCheck(this,
|
|
3948
|
-
|
|
3949
|
-
return
|
|
4503
|
+
var Kt = /*#__PURE__*/function (_Nt) {
|
|
4504
|
+
_inherits(Kt, _Nt);
|
|
4505
|
+
var _super3 = _createSuper(Kt);
|
|
4506
|
+
function Kt() {
|
|
4507
|
+
var _this8;
|
|
4508
|
+
_classCallCheck(this, Kt);
|
|
4509
|
+
_this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
|
|
4510
|
+
return _this8.updateState({
|
|
3950
4511
|
member: e
|
|
3951
4512
|
});
|
|
3952
|
-
},
|
|
4513
|
+
}, _this8.getMember = function () {
|
|
3953
4514
|
var e, t;
|
|
3954
|
-
return null !== (t = null === (e =
|
|
3955
|
-
},
|
|
4515
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4516
|
+
}, _this8.getSession = function () {
|
|
3956
4517
|
var e, t;
|
|
3957
|
-
return null !== (t = null === (e =
|
|
4518
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
3958
4519
|
};
|
|
3959
|
-
return
|
|
4520
|
+
return _this8;
|
|
3960
4521
|
}
|
|
3961
|
-
return _createClass(
|
|
3962
|
-
}(
|
|
3963
|
-
var
|
|
3964
|
-
var
|
|
3965
|
-
var
|
|
3966
|
-
_classCallCheck(this,
|
|
4522
|
+
return _createClass(Kt);
|
|
4523
|
+
}(Nt);
|
|
4524
|
+
var Ut = Symbol["for"]("stytch__internal_b2b");
|
|
4525
|
+
var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
4526
|
+
var _this9 = this;
|
|
4527
|
+
_classCallCheck(this, zt);
|
|
3967
4528
|
var r;
|
|
3968
4529
|
!function (e) {
|
|
3969
4530
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
|
|
3970
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
3971
|
-
var
|
|
3972
|
-
|
|
3973
|
-
cookieOptions: null == (
|
|
4531
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ne("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(Ue)) : "" === r ? Ne('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ue)) : r.startsWith("public-token-") || Ne('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ue));
|
|
4532
|
+
var n = t,
|
|
4533
|
+
i = {
|
|
4534
|
+
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
3974
4535
|
endpoints: {
|
|
3975
|
-
sdkBackendURL: null !== (
|
|
3976
|
-
testAPIURL: null !== (
|
|
3977
|
-
liveAPIURL: null !== (
|
|
3978
|
-
dfpBackendURL: null !== (
|
|
3979
|
-
clientsideServicesIframeURL: null !== (
|
|
4536
|
+
sdkBackendURL: null !== (a = null === (s = null == o ? void 0 : o.endpoints) || void 0 === s ? void 0 : s.sdkBackendURL) && void 0 !== a ? a : "https://web.stytch.com",
|
|
4537
|
+
testAPIURL: null !== (u = null === (c = null == o ? void 0 : o.endpoints) || void 0 === c ? void 0 : c.testAPIURL) && void 0 !== u ? u : "https://test.stytch.com",
|
|
4538
|
+
liveAPIURL: null !== (d = null === (l = null == o ? void 0 : o.endpoints) || void 0 === l ? void 0 : l.liveAPIURL) && void 0 !== d ? d : "https://api.stytch.com",
|
|
4539
|
+
dfpBackendURL: null !== (p = null === (h = null == o ? void 0 : o.endpoints) || void 0 === h ? void 0 : h.dfpBackendURL) && void 0 !== p ? p : "https://telemetry.stytch.com",
|
|
4540
|
+
clientsideServicesIframeURL: null !== (f = null === (_ = null == o ? void 0 : o.endpoints) || void 0 === _ ? void 0 : _.clientsideServicesIframeURL) && void 0 !== f ? f : "https://js.stytch.com/clientside-services/index.html"
|
|
3980
4541
|
}
|
|
3981
4542
|
};
|
|
3982
|
-
var s, a, c, u, l, d, h, p, _, f
|
|
3983
|
-
this._dataLayer =
|
|
3984
|
-
var
|
|
3985
|
-
this._networkClient = new
|
|
4543
|
+
var o, s, a, c, u, l, d, h, p, _, f;
|
|
4544
|
+
this._dataLayer = Mt(e, n), this._subscriptionService = new Kt(e, this._dataLayer);
|
|
4545
|
+
var m = new Tt(this._dataLayer, "passwords");
|
|
4546
|
+
this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
3986
4547
|
var e, t, r, n;
|
|
3987
4548
|
return {
|
|
3988
|
-
stytch_member_id: null === (t = null === (e =
|
|
3989
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4549
|
+
stytch_member_id: null === (t = null === (e = _this9._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4550
|
+
stytch_member_session_id: null === (n = null === (r = _this9._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
3990
4551
|
};
|
|
3991
4552
|
});
|
|
3992
|
-
var
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
this.organization = new
|
|
4553
|
+
var v = new St(e, this._networkClient, this._dataLayer),
|
|
4554
|
+
b = new Pt(v.getAsync()),
|
|
4555
|
+
g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
4556
|
+
this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
3996
4557
|
publicToken: e,
|
|
3997
|
-
testAPIURL:
|
|
3998
|
-
liveAPIURL:
|
|
3999
|
-
},
|
|
4558
|
+
testAPIURL: i.endpoints.testAPIURL,
|
|
4559
|
+
liveAPIURL: i.endpoints.liveAPIURL
|
|
4560
|
+
}, g), this.sso = new $e(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "sso"), v.getAsync(), {
|
|
4000
4561
|
publicToken: e,
|
|
4001
|
-
testAPIURL:
|
|
4002
|
-
liveAPIURL:
|
|
4003
|
-
}), this.discovery = new
|
|
4004
|
-
var
|
|
4562
|
+
testAPIURL: i.endpoints.testAPIURL,
|
|
4563
|
+
liveAPIURL: i.endpoints.liveAPIURL
|
|
4564
|
+
}), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new kt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new tt(this._networkClient, this._subscriptionService, g), this.totp = new rt(this._networkClient, this._subscriptionService, g), this.rbac = new nt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new it(this._subscriptionService, this.session);
|
|
4565
|
+
var y = new Ot(this._networkClient);
|
|
4005
4566
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4006
4567
|
name: "b2b_sdk_instance_instantiated",
|
|
4007
4568
|
details: {
|
|
@@ -4011,215 +4572,13 @@ var Ze = /*#__PURE__*/_createClass(function Ze(e, t) {
|
|
|
4011
4572
|
}
|
|
4012
4573
|
});
|
|
4013
4574
|
(function (e, t) {
|
|
4014
|
-
Object.assign(e, _defineProperty({},
|
|
4575
|
+
Object.assign(e, _defineProperty({}, Ut, t));
|
|
4015
4576
|
})(this, {
|
|
4016
|
-
bootstrap:
|
|
4577
|
+
bootstrap: v,
|
|
4017
4578
|
publicToken: e,
|
|
4018
|
-
searchManager:
|
|
4579
|
+
searchManager: y,
|
|
4019
4580
|
dataLayer: this._dataLayer,
|
|
4020
4581
|
networkClient: this._networkClient
|
|
4021
4582
|
});
|
|
4022
4583
|
});
|
|
4023
|
-
|
|
4024
|
-
return Qe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
4025
|
-
return _typeof(e);
|
|
4026
|
-
} : function (e) {
|
|
4027
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
4028
|
-
}, Qe(e);
|
|
4029
|
-
}
|
|
4030
|
-
function et(e, t) {
|
|
4031
|
-
for (var r = 0; r < t.length; r++) {
|
|
4032
|
-
var n = t[r];
|
|
4033
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
|
|
4034
|
-
if ("object" !== Qe(e) || null === e) return e;
|
|
4035
|
-
var r = e[Symbol.toPrimitive];
|
|
4036
|
-
if (void 0 !== r) {
|
|
4037
|
-
var n = r.call(e, t || "default");
|
|
4038
|
-
if ("object" !== Qe(n)) return n;
|
|
4039
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4040
|
-
}
|
|
4041
|
-
return ("string" === t ? String : Number)(e);
|
|
4042
|
-
}(i, "string"), "symbol" === Qe(o) ? o : String(o)), n);
|
|
4043
|
-
}
|
|
4044
|
-
var i, o;
|
|
4045
|
-
}
|
|
4046
|
-
function tt(e, t, r) {
|
|
4047
|
-
return t && et(e.prototype, t), r && et(e, r), Object.defineProperty(e, "prototype", {
|
|
4048
|
-
writable: !1
|
|
4049
|
-
}), e;
|
|
4050
|
-
}
|
|
4051
|
-
function rt(e, t) {
|
|
4052
|
-
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
4053
|
-
}
|
|
4054
|
-
function nt(e, t) {
|
|
4055
|
-
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
4056
|
-
e.prototype = Object.create(t && t.prototype, {
|
|
4057
|
-
constructor: {
|
|
4058
|
-
value: e,
|
|
4059
|
-
writable: !0,
|
|
4060
|
-
configurable: !0
|
|
4061
|
-
}
|
|
4062
|
-
}), Object.defineProperty(e, "prototype", {
|
|
4063
|
-
writable: !1
|
|
4064
|
-
}), t && ut(e, t);
|
|
4065
|
-
}
|
|
4066
|
-
function it(e) {
|
|
4067
|
-
var t = ct();
|
|
4068
|
-
return function () {
|
|
4069
|
-
var r,
|
|
4070
|
-
n = lt(e);
|
|
4071
|
-
if (t) {
|
|
4072
|
-
var i = lt(this).constructor;
|
|
4073
|
-
r = Reflect.construct(n, arguments, i);
|
|
4074
|
-
} else r = n.apply(this, arguments);
|
|
4075
|
-
return function (e, t) {
|
|
4076
|
-
if (t && ("object" === Qe(t) || "function" == typeof t)) return t;
|
|
4077
|
-
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
4078
|
-
return ot(e);
|
|
4079
|
-
}(this, r);
|
|
4080
|
-
};
|
|
4081
|
-
}
|
|
4082
|
-
function ot(e) {
|
|
4083
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4084
|
-
return e;
|
|
4085
|
-
}
|
|
4086
|
-
function st(e) {
|
|
4087
|
-
var t = "function" == typeof Map ? new Map() : void 0;
|
|
4088
|
-
return st = function st(e) {
|
|
4089
|
-
if (null === e || !function (e) {
|
|
4090
|
-
try {
|
|
4091
|
-
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
4092
|
-
} catch (t) {
|
|
4093
|
-
return "function" == typeof e;
|
|
4094
|
-
}
|
|
4095
|
-
}(e)) return e;
|
|
4096
|
-
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
4097
|
-
if (void 0 !== t) {
|
|
4098
|
-
if (t.has(e)) return t.get(e);
|
|
4099
|
-
t.set(e, r);
|
|
4100
|
-
}
|
|
4101
|
-
function r() {
|
|
4102
|
-
return at(e, arguments, lt(this).constructor);
|
|
4103
|
-
}
|
|
4104
|
-
return r.prototype = Object.create(e.prototype, {
|
|
4105
|
-
constructor: {
|
|
4106
|
-
value: r,
|
|
4107
|
-
enumerable: !1,
|
|
4108
|
-
writable: !0,
|
|
4109
|
-
configurable: !0
|
|
4110
|
-
}
|
|
4111
|
-
}), ut(r, e);
|
|
4112
|
-
}, st(e);
|
|
4113
|
-
}
|
|
4114
|
-
function at(e, t, r) {
|
|
4115
|
-
return at = ct() ? Reflect.construct.bind() : function (e, t, r) {
|
|
4116
|
-
var n = [null];
|
|
4117
|
-
n.push.apply(n, t);
|
|
4118
|
-
var i = new (Function.bind.apply(e, n))();
|
|
4119
|
-
return r && ut(i, r.prototype), i;
|
|
4120
|
-
}, at.apply(null, arguments);
|
|
4121
|
-
}
|
|
4122
|
-
function ct() {
|
|
4123
|
-
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
4124
|
-
if (Reflect.construct.sham) return !1;
|
|
4125
|
-
if ("function" == typeof Proxy) return !0;
|
|
4126
|
-
try {
|
|
4127
|
-
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
|
|
4128
|
-
} catch (e) {
|
|
4129
|
-
return !1;
|
|
4130
|
-
}
|
|
4131
|
-
}
|
|
4132
|
-
function ut(e, t) {
|
|
4133
|
-
return ut = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
4134
|
-
return e.__proto__ = t, e;
|
|
4135
|
-
}, ut(e, t);
|
|
4136
|
-
}
|
|
4137
|
-
function lt(e) {
|
|
4138
|
-
return lt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
4139
|
-
return e.__proto__ || Object.getPrototypeOf(e);
|
|
4140
|
-
}, lt(e);
|
|
4141
|
-
}
|
|
4142
|
-
var dt, ht, pt, _t, ft, mt;
|
|
4143
|
-
!function (e) {
|
|
4144
|
-
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
4145
|
-
}(dt || (dt = {})), function (e) {
|
|
4146
|
-
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";
|
|
4147
|
-
}(ht || (ht = {})), function (e) {
|
|
4148
|
-
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";
|
|
4149
|
-
}(pt || (pt = {})), function (e) {
|
|
4150
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
4151
|
-
}(_t || (_t = {})), function (e) {
|
|
4152
|
-
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
4153
|
-
}(ft || (ft = {})), function (e) {
|
|
4154
|
-
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
4155
|
-
}(mt || (mt = {}));
|
|
4156
|
-
var vt,
|
|
4157
|
-
bt,
|
|
4158
|
-
gt,
|
|
4159
|
-
yt,
|
|
4160
|
-
kt = function (e) {
|
|
4161
|
-
nt(r, st(Error));
|
|
4162
|
-
var t = it(r);
|
|
4163
|
-
function r(e, n) {
|
|
4164
|
-
var i;
|
|
4165
|
-
return rt(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(ot(i), r.prototype), i;
|
|
4166
|
-
}
|
|
4167
|
-
return tt(r);
|
|
4168
|
-
}(),
|
|
4169
|
-
St = function (e) {
|
|
4170
|
-
nt(r, st(Error));
|
|
4171
|
-
var t = it(r);
|
|
4172
|
-
function r(e, n) {
|
|
4173
|
-
var i;
|
|
4174
|
-
return rt(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
4175
|
-
}
|
|
4176
|
-
return tt(r);
|
|
4177
|
-
}(),
|
|
4178
|
-
wt = function (e) {
|
|
4179
|
-
nt(r, st(Error));
|
|
4180
|
-
var t = it(r);
|
|
4181
|
-
function r(e) {
|
|
4182
|
-
var n, i;
|
|
4183
|
-
rt(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
4184
|
-
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
4185
|
-
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
4186
|
-
}).join("\n");
|
|
4187
|
-
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
4188
|
-
}
|
|
4189
|
-
return tt(r);
|
|
4190
|
-
}(),
|
|
4191
|
-
At = function (e) {
|
|
4192
|
-
nt(r, st(Error));
|
|
4193
|
-
var t = it(r);
|
|
4194
|
-
function r(e) {
|
|
4195
|
-
var n;
|
|
4196
|
-
rt(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
4197
|
-
var i = e.status_code,
|
|
4198
|
-
o = e.error_type,
|
|
4199
|
-
s = e.error_message,
|
|
4200
|
-
a = e.error_url,
|
|
4201
|
-
c = e.request_id;
|
|
4202
|
-
return n.error_type = o, n.error_message = s, n.error_url = a, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(a, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n;
|
|
4203
|
-
}
|
|
4204
|
-
return tt(r);
|
|
4205
|
-
}(),
|
|
4206
|
-
Et = function (e) {
|
|
4207
|
-
nt(r, st(Error));
|
|
4208
|
-
var t = it(r);
|
|
4209
|
-
function r(e) {
|
|
4210
|
-
var n;
|
|
4211
|
-
return rt(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n;
|
|
4212
|
-
}
|
|
4213
|
-
return tt(r);
|
|
4214
|
-
}(),
|
|
4215
|
-
Tt = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
4216
|
-
!function (e) {
|
|
4217
|
-
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";
|
|
4218
|
-
}(vt || (vt = {})), function (e) {
|
|
4219
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
4220
|
-
}(bt || (bt = {})), function (e) {
|
|
4221
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
4222
|
-
}(gt || (gt = {})), function (e) {
|
|
4223
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
4224
|
-
}(yt || (yt = {}));
|
|
4225
|
-
export { gt as AuthFlowType, yt as B2BOAuthProviders, bt as B2BProducts, vt as BiometricsErrors, ht as OAuthProviders, ft as OTPMethods, _t as OneTapPositions, dt as Products, kt as SDKAPIUnreachableError, Ze as StytchB2BHeadlessClient, mt as StytchEventType, At as StytchSDKAPIError, Et as StytchSDKNativeError, wt as StytchSDKSchemaError, St as StytchSDKUsageError, Tt as UNRECOVERABLE_ERROR_TYPES, pt as Wallets };
|
|
4584
|
+
export { g as AuthFlowType, y as B2BOAuthProviders, b as B2BProducts, X as BiometricsFailedError, B as BiometricsUnavailableError, H as ChallengeSigningFailedError, K as DeviceCredentialsNotAllowedError, V as FailedCodeChallengeError, $ as FailedToDecryptDataError, R as InternalError, W as InvalidAuthorizationCredentialError, te as InvalidCredentialTypeError, Q as InvalidRedirectSchemeError, Z as InvalidStartUrlError, ne as JSONDataNotConvertibleToStringError, L as KeyInvalidatedError, M as KeystoreUnavailableError, re as MissingAttestationObjectError, q as MissingAuthorizationCredentialIDTokenError, U as MissingGoogleClientIDError, z as MissingPKCEError, G as MissingPublicKeyError, ee as MissingUrlError, j as NoBiometricsEnrolledError, I as NoBiometricsRegistrationError, D as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, f as OneTapPositions, oe as PasskeysInvalidEncoding, J as PasskeysUnsupportedError, h as Products, ie as RandomNumberGenerationFailed, k as SDKAPIUnreachableError, Y as SDKNotConfiguredError, E as StytchAPIError, O as StytchAPISchemaError, T as StytchAPIUnreachableError, zt as StytchB2BHeadlessClient, C as StytchError, v as StytchEventType, P as StytchSDKAPIError, x as StytchSDKError, S as StytchSDKSchemaError, w as StytchSDKUsageError, A as UNRECOVERABLE_ERROR_TYPES, F as UserCancellationError, N as UserLockedOutError, _ as Wallets, se as errorToStytchError };
|