@stytch/vanilla-js 4.5.5 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/b2b/index.esm.js +5724 -4136
- package/dist/b2b/index.headless.esm.js +735 -603
- package/dist/b2b/index.headless.js +717 -587
- package/dist/b2b/index.js +5049 -3463
- package/dist/index.esm.js +3927 -3812
- package/dist/index.headless.esm.js +670 -667
- package/dist/index.headless.js +647 -646
- package/dist/index.js +3837 -3724
- package/package.json +5 -3
|
@@ -132,38 +132,39 @@ function d(e) {
|
|
|
132
132
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
133
133
|
}, d(e);
|
|
134
134
|
}
|
|
135
|
-
var h, p,
|
|
135
|
+
var h, p, f, _, m, v;
|
|
136
136
|
!function (e) {
|
|
137
137
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
138
138
|
}(h || (h = {})), function (e) {
|
|
139
139
|
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";
|
|
140
140
|
}(p || (p = {})), function (e) {
|
|
141
141
|
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";
|
|
142
|
-
}(_ || (_ = {})), function (e) {
|
|
143
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
144
142
|
}(f || (f = {})), function (e) {
|
|
143
|
+
e.embedded = "embedded", e.floating = "floating";
|
|
144
|
+
}(_ || (_ = {})), function (e) {
|
|
145
145
|
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
146
146
|
}(m || (m = {})), function (e) {
|
|
147
|
-
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";
|
|
147
|
+
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", e.B2BSMSOTPSend = "B2B_SMS_OTP_SEND", e.B2BSMSOTPAuthenticate = "B2B_SMS_OTP_AUTHENTICATE", e.B2BTOTPCreate = "B2B_TOTP_CREATE", e.B2BTOTPAuthenticate = "B2B_TOTP_AUTHENTICATE", e.B2BRecoveryCodesRecover = "B2B_RECOVERY_CODES_RECOVER";
|
|
148
148
|
}(v || (v = {}));
|
|
149
149
|
var b,
|
|
150
150
|
g,
|
|
151
151
|
k,
|
|
152
|
-
y
|
|
152
|
+
y,
|
|
153
|
+
w = function (e) {
|
|
153
154
|
function t(e, r) {
|
|
154
155
|
var n;
|
|
155
156
|
return i(this, t), (n = o(this, t, [e + "\n" + r])).message = e + "\n" + r, n.name = "SDKAPIUnreachableError", n.details = r, Object.setPrototypeOf(s(n), t.prototype), n;
|
|
156
157
|
}
|
|
157
158
|
return a(t, c(Error)), r(t);
|
|
158
159
|
}(),
|
|
159
|
-
|
|
160
|
+
S = function (e) {
|
|
160
161
|
function t(e, r) {
|
|
161
162
|
var n;
|
|
162
163
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
163
164
|
}
|
|
164
165
|
return a(t, c(Error)), r(t);
|
|
165
166
|
}(),
|
|
166
|
-
|
|
167
|
+
P = function (e) {
|
|
167
168
|
function t(e) {
|
|
168
169
|
var r, n;
|
|
169
170
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -187,8 +188,8 @@ var b,
|
|
|
187
188
|
}
|
|
188
189
|
return a(t, c(Error)), r(t);
|
|
189
190
|
}(),
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
T = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
192
|
+
O = function (e) {
|
|
192
193
|
function t(e, r) {
|
|
193
194
|
var n;
|
|
194
195
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
@@ -200,9 +201,9 @@ var b,
|
|
|
200
201
|
var r;
|
|
201
202
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
202
203
|
}
|
|
203
|
-
return a(t,
|
|
204
|
+
return a(t, O), r(t);
|
|
204
205
|
}(),
|
|
205
|
-
|
|
206
|
+
A = function (e) {
|
|
206
207
|
function t(e) {
|
|
207
208
|
var r;
|
|
208
209
|
i(this, t);
|
|
@@ -211,9 +212,9 @@ var b,
|
|
|
211
212
|
}).join("\n");
|
|
212
213
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
213
214
|
}
|
|
214
|
-
return a(t,
|
|
215
|
+
return a(t, O), r(t);
|
|
215
216
|
}(),
|
|
216
|
-
|
|
217
|
+
E = function (e) {
|
|
217
218
|
function t(e) {
|
|
218
219
|
var r;
|
|
219
220
|
i(this, t);
|
|
@@ -224,195 +225,195 @@ var b,
|
|
|
224
225
|
u = e.request_id;
|
|
225
226
|
return (r = o(this, t, ["StytchAPIError", "[".concat(n, "] ").concat(s, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : "")])).error_type = s, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = n, r;
|
|
226
227
|
}
|
|
227
|
-
return a(t,
|
|
228
|
+
return a(t, O), r(t);
|
|
228
229
|
}(),
|
|
229
|
-
|
|
230
|
+
D = function (e) {
|
|
230
231
|
function t(e, r, n) {
|
|
231
232
|
var s;
|
|
232
233
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
233
234
|
}
|
|
234
|
-
return a(t,
|
|
235
|
+
return a(t, O), r(t);
|
|
235
236
|
}(),
|
|
236
|
-
|
|
237
|
+
I = function (e) {
|
|
237
238
|
function t() {
|
|
238
239
|
return i(this, t), o(this, t, ["NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session."]);
|
|
239
240
|
}
|
|
240
|
-
return a(t,
|
|
241
|
+
return a(t, D), r(t);
|
|
241
242
|
}(),
|
|
242
|
-
|
|
243
|
+
R = function (e) {
|
|
243
244
|
function t(e) {
|
|
244
245
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
245
246
|
}
|
|
246
|
-
return a(t,
|
|
247
|
+
return a(t, D), r(t);
|
|
247
248
|
}(),
|
|
248
249
|
j = function (e) {
|
|
249
250
|
function t() {
|
|
250
251
|
return i(this, t), o(this, t, ["NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first."]);
|
|
251
252
|
}
|
|
252
|
-
return a(t,
|
|
253
|
+
return a(t, D), r(t);
|
|
253
254
|
}(),
|
|
254
255
|
F = function (e) {
|
|
255
256
|
function t() {
|
|
256
257
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
257
258
|
}
|
|
258
|
-
return a(t,
|
|
259
|
+
return a(t, D), r(t);
|
|
259
260
|
}(),
|
|
260
|
-
|
|
261
|
+
L = function (e) {
|
|
261
262
|
function t() {
|
|
262
263
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
263
264
|
}
|
|
264
|
-
return a(t,
|
|
265
|
+
return a(t, D), r(t);
|
|
265
266
|
}(),
|
|
266
|
-
|
|
267
|
+
M = function (e) {
|
|
267
268
|
function t() {
|
|
268
269
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
269
270
|
}
|
|
270
|
-
return a(t,
|
|
271
|
+
return a(t, D), r(t);
|
|
271
272
|
}(),
|
|
272
|
-
|
|
273
|
+
B = function (e) {
|
|
273
274
|
function t() {
|
|
274
275
|
return i(this, t), o(this, t, ["NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings."]);
|
|
275
276
|
}
|
|
276
|
-
return a(t,
|
|
277
|
+
return a(t, D), r(t);
|
|
277
278
|
}(),
|
|
278
|
-
|
|
279
|
+
K = function (e) {
|
|
279
280
|
function t() {
|
|
280
281
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
281
282
|
}
|
|
282
|
-
return a(t,
|
|
283
|
+
return a(t, D), r(t);
|
|
283
284
|
}(),
|
|
284
|
-
|
|
285
|
+
z = function (e) {
|
|
285
286
|
function t() {
|
|
286
287
|
return i(this, t), o(this, t, ["UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later."]);
|
|
287
288
|
}
|
|
288
|
-
return a(t,
|
|
289
|
+
return a(t, D), r(t);
|
|
289
290
|
}(),
|
|
290
|
-
|
|
291
|
+
N = function (e) {
|
|
291
292
|
function t() {
|
|
292
293
|
return i(this, t), o(this, t, ["DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods."]);
|
|
293
294
|
}
|
|
294
|
-
return a(t,
|
|
295
|
+
return a(t, D), r(t);
|
|
295
296
|
}(),
|
|
296
|
-
|
|
297
|
+
U = function (e) {
|
|
297
298
|
function t() {
|
|
298
299
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
299
300
|
}
|
|
300
|
-
return a(t,
|
|
301
|
+
return a(t, D), r(t);
|
|
301
302
|
}(),
|
|
302
|
-
|
|
303
|
+
q = function (e) {
|
|
303
304
|
function t() {
|
|
304
305
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
305
306
|
}
|
|
306
|
-
return a(t,
|
|
307
|
+
return a(t, D), r(t);
|
|
307
308
|
}(),
|
|
308
|
-
|
|
309
|
+
W = function (e) {
|
|
309
310
|
function t() {
|
|
310
311
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
311
312
|
}
|
|
312
|
-
return a(t,
|
|
313
|
+
return a(t, D), r(t);
|
|
313
314
|
}(),
|
|
314
|
-
|
|
315
|
+
H = function (e) {
|
|
315
316
|
function t() {
|
|
316
317
|
return i(this, t), o(this, t, ["InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method."]);
|
|
317
318
|
}
|
|
318
|
-
return a(t,
|
|
319
|
+
return a(t, D), r(t);
|
|
319
320
|
}(),
|
|
320
|
-
|
|
321
|
+
G = function (e) {
|
|
321
322
|
function t() {
|
|
322
323
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
323
324
|
}
|
|
324
|
-
return a(t,
|
|
325
|
+
return a(t, D), r(t);
|
|
325
326
|
}(),
|
|
326
|
-
|
|
327
|
+
V = function (e) {
|
|
327
328
|
function t() {
|
|
328
329
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
329
330
|
}
|
|
330
|
-
return a(t,
|
|
331
|
+
return a(t, D), r(t);
|
|
331
332
|
}(),
|
|
332
|
-
|
|
333
|
+
Y = function (e) {
|
|
333
334
|
function t() {
|
|
334
335
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
335
336
|
}
|
|
336
|
-
return a(t,
|
|
337
|
+
return a(t, D), r(t);
|
|
337
338
|
}(),
|
|
338
|
-
|
|
339
|
+
J = function (e) {
|
|
339
340
|
function t() {
|
|
340
341
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
341
342
|
}
|
|
342
|
-
return a(t,
|
|
343
|
+
return a(t, D), r(t);
|
|
343
344
|
}(),
|
|
344
|
-
|
|
345
|
+
$ = function (e) {
|
|
345
346
|
function t() {
|
|
346
347
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
347
348
|
}
|
|
348
|
-
return a(t,
|
|
349
|
+
return a(t, D), r(t);
|
|
349
350
|
}(),
|
|
350
|
-
|
|
351
|
+
X = function (e) {
|
|
351
352
|
function t() {
|
|
352
353
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
353
354
|
}
|
|
354
|
-
return a(t,
|
|
355
|
+
return a(t, D), r(t);
|
|
355
356
|
}(),
|
|
356
|
-
|
|
357
|
+
Z = function (e) {
|
|
357
358
|
function t() {
|
|
358
359
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
359
360
|
}
|
|
360
|
-
return a(t,
|
|
361
|
+
return a(t, D), r(t);
|
|
361
362
|
}(),
|
|
362
|
-
|
|
363
|
+
Q = function (e) {
|
|
363
364
|
function t() {
|
|
364
365
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
365
366
|
}
|
|
366
|
-
return a(t,
|
|
367
|
+
return a(t, D), r(t);
|
|
367
368
|
}(),
|
|
368
|
-
|
|
369
|
+
ee = function (e) {
|
|
369
370
|
function t() {
|
|
370
371
|
return i(this, t), o(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
371
372
|
}
|
|
372
|
-
return a(t,
|
|
373
|
+
return a(t, D), r(t);
|
|
373
374
|
}(),
|
|
374
|
-
|
|
375
|
+
te = function (e) {
|
|
375
376
|
function t() {
|
|
376
377
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
377
378
|
}
|
|
378
|
-
return a(t,
|
|
379
|
+
return a(t, D), r(t);
|
|
379
380
|
}(),
|
|
380
|
-
|
|
381
|
+
re = function (e) {
|
|
381
382
|
function t() {
|
|
382
383
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
383
384
|
}
|
|
384
|
-
return a(t,
|
|
385
|
+
return a(t, D), r(t);
|
|
385
386
|
}(),
|
|
386
|
-
|
|
387
|
+
ne = function (e) {
|
|
387
388
|
function t() {
|
|
388
389
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
389
390
|
}
|
|
390
|
-
return a(t,
|
|
391
|
+
return a(t, D), r(t);
|
|
391
392
|
}(),
|
|
392
|
-
|
|
393
|
+
ie = function (e) {
|
|
393
394
|
function t() {
|
|
394
395
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
395
396
|
}
|
|
396
|
-
return a(t,
|
|
397
|
+
return a(t, D), r(t);
|
|
397
398
|
}(),
|
|
398
|
-
|
|
399
|
+
oe = function (e) {
|
|
399
400
|
function t() {
|
|
400
401
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
401
402
|
}
|
|
402
|
-
return a(t,
|
|
403
|
+
return a(t, D), r(t);
|
|
403
404
|
}(),
|
|
404
|
-
|
|
405
|
+
se = function (e) {
|
|
405
406
|
function t() {
|
|
406
407
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
407
408
|
}
|
|
408
|
-
return a(t,
|
|
409
|
+
return a(t, D), r(t);
|
|
409
410
|
}();
|
|
410
|
-
function
|
|
411
|
+
function ae(e) {
|
|
411
412
|
switch (e.message) {
|
|
412
413
|
case "internal_error":
|
|
413
|
-
return new
|
|
414
|
+
return new R(e.message);
|
|
414
415
|
case "no_current_session":
|
|
415
|
-
return new
|
|
416
|
+
return new I();
|
|
416
417
|
case "no_biometrics_registration":
|
|
417
418
|
return new j();
|
|
418
419
|
case "biometrics_unavailable":
|
|
@@ -421,60 +422,60 @@ function se(e) {
|
|
|
421
422
|
return new F();
|
|
422
423
|
case "key_invalidated":
|
|
423
424
|
case "no_biometric_key":
|
|
424
|
-
return new
|
|
425
|
+
return new L();
|
|
425
426
|
case "no_biometrics_enrolled":
|
|
426
|
-
return new
|
|
427
|
+
return new B();
|
|
427
428
|
case "keystore_unavailable":
|
|
428
|
-
return new
|
|
429
|
+
return new M();
|
|
429
430
|
case "device_credentials_not_allowed":
|
|
430
|
-
return new
|
|
431
|
+
return new N();
|
|
431
432
|
case "user_cancellation":
|
|
432
|
-
return new B();
|
|
433
|
-
case "user_locked_out":
|
|
434
433
|
return new K();
|
|
434
|
+
case "user_locked_out":
|
|
435
|
+
return new z();
|
|
435
436
|
case "google_onetap_missing_id_token":
|
|
436
437
|
case "oauth_apple_missing_id_token":
|
|
437
438
|
case "missing_authorization_credential_id_token":
|
|
438
|
-
return new
|
|
439
|
+
return new W();
|
|
439
440
|
case "google_onetap_missing_member":
|
|
440
441
|
case "oauth_apple_credential_invalid":
|
|
441
442
|
case "invalid_authorization_credential":
|
|
442
|
-
return new W();
|
|
443
|
-
case "missing_public_key":
|
|
444
443
|
return new H();
|
|
445
|
-
case "
|
|
444
|
+
case "missing_public_key":
|
|
446
445
|
return new G();
|
|
447
|
-
case "
|
|
446
|
+
case "challenge_signing_failed":
|
|
448
447
|
return new V();
|
|
449
|
-
case "
|
|
448
|
+
case "sdk_not_configured":
|
|
450
449
|
return new Y();
|
|
451
|
-
case "
|
|
450
|
+
case "failed_code_challenge":
|
|
452
451
|
return new J();
|
|
453
|
-
case "
|
|
452
|
+
case "passkeys_unsupported":
|
|
454
453
|
return new $();
|
|
455
|
-
case "
|
|
454
|
+
case "failed_to_decrypt_data":
|
|
456
455
|
return new X();
|
|
457
|
-
case "
|
|
456
|
+
case "biometrics_failed":
|
|
458
457
|
return new Z();
|
|
459
|
-
case "
|
|
458
|
+
case "invalid_start_url":
|
|
460
459
|
return new Q();
|
|
461
|
-
case "
|
|
460
|
+
case "invalid_redirect_scheme":
|
|
462
461
|
return new ee();
|
|
463
|
-
case "
|
|
462
|
+
case "missing_url":
|
|
464
463
|
return new te();
|
|
465
|
-
case "
|
|
464
|
+
case "invalid_credential_type":
|
|
466
465
|
return new re();
|
|
467
|
-
case "
|
|
466
|
+
case "missing_attestation_object":
|
|
468
467
|
return new ne();
|
|
469
|
-
case "
|
|
468
|
+
case "json_data_not_convertible_to_string":
|
|
470
469
|
return new ie();
|
|
471
|
-
case "
|
|
470
|
+
case "random_number_generation_failed":
|
|
472
471
|
return new oe();
|
|
472
|
+
case "passkeys_invalid_encoding":
|
|
473
|
+
return new se();
|
|
473
474
|
default:
|
|
474
|
-
return new
|
|
475
|
+
return new D(e.name, e.message);
|
|
475
476
|
}
|
|
476
477
|
}
|
|
477
|
-
function
|
|
478
|
+
function ce(e, t) {
|
|
478
479
|
return function (e) {
|
|
479
480
|
if (Array.isArray(e)) return e;
|
|
480
481
|
}(e) || function (e, t) {
|
|
@@ -503,32 +504,32 @@ function ae(e, t) {
|
|
|
503
504
|
}
|
|
504
505
|
return a;
|
|
505
506
|
}
|
|
506
|
-
}(e, t) ||
|
|
507
|
+
}(e, t) || ue(e, t) || function () {
|
|
507
508
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
508
509
|
}();
|
|
509
510
|
}
|
|
510
|
-
function
|
|
511
|
+
function ue(e, t) {
|
|
511
512
|
if (e) {
|
|
512
|
-
if ("string" == typeof e) return
|
|
513
|
+
if ("string" == typeof e) return le(e, t);
|
|
513
514
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
514
|
-
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) ?
|
|
515
|
+
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) ? le(e, t) : void 0;
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
|
-
function
|
|
518
|
+
function le(e, t) {
|
|
518
519
|
(null == t || t > e.length) && (t = e.length);
|
|
519
520
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
520
521
|
return n;
|
|
521
522
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
523
|
+
function de(e) {
|
|
524
|
+
return de = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
524
525
|
return _typeof(e);
|
|
525
526
|
} : function (e) {
|
|
526
527
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
527
|
-
},
|
|
528
|
+
}, de(e);
|
|
528
529
|
}
|
|
529
|
-
function
|
|
530
|
+
function he() {
|
|
530
531
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
531
|
-
|
|
532
|
+
he = function he() {
|
|
532
533
|
return t;
|
|
533
534
|
};
|
|
534
535
|
var e,
|
|
@@ -581,8 +582,8 @@ function de() {
|
|
|
581
582
|
t.wrap = l;
|
|
582
583
|
var h = "suspendedStart",
|
|
583
584
|
p = "suspendedYield",
|
|
584
|
-
|
|
585
|
-
|
|
585
|
+
f = "executing",
|
|
586
|
+
_ = "completed",
|
|
586
587
|
m = {};
|
|
587
588
|
function v() {}
|
|
588
589
|
function b() {}
|
|
@@ -595,20 +596,20 @@ function de() {
|
|
|
595
596
|
w = y && y(y(D([])));
|
|
596
597
|
w && w !== r && n.call(w, s) && (k = w);
|
|
597
598
|
var S = g.prototype = v.prototype = Object.create(k);
|
|
598
|
-
function
|
|
599
|
+
function P(e) {
|
|
599
600
|
["next", "throw", "return"].forEach(function (t) {
|
|
600
601
|
u(e, t, function (e) {
|
|
601
602
|
return this._invoke(t, e);
|
|
602
603
|
});
|
|
603
604
|
});
|
|
604
605
|
}
|
|
605
|
-
function
|
|
606
|
+
function C(e, t) {
|
|
606
607
|
function r(i, o, s, a) {
|
|
607
608
|
var c = d(e[i], e, o);
|
|
608
609
|
if ("throw" !== c.type) {
|
|
609
610
|
var u = c.arg,
|
|
610
611
|
l = u.value;
|
|
611
|
-
return l && "object" ==
|
|
612
|
+
return l && "object" == de(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
612
613
|
r("next", e, s, a);
|
|
613
614
|
}, function (e) {
|
|
614
615
|
r("throw", e, s, a);
|
|
@@ -635,8 +636,8 @@ function de() {
|
|
|
635
636
|
function T(t, r, n) {
|
|
636
637
|
var i = h;
|
|
637
638
|
return function (o, s) {
|
|
638
|
-
if (i ===
|
|
639
|
-
if (i ===
|
|
639
|
+
if (i === f) throw new Error("Generator is already running");
|
|
640
|
+
if (i === _) {
|
|
640
641
|
if ("throw" === o) throw s;
|
|
641
642
|
return {
|
|
642
643
|
value: e,
|
|
@@ -646,39 +647,39 @@ function de() {
|
|
|
646
647
|
for (n.method = o, n.arg = s;;) {
|
|
647
648
|
var a = n.delegate;
|
|
648
649
|
if (a) {
|
|
649
|
-
var c =
|
|
650
|
+
var c = O(a, n);
|
|
650
651
|
if (c) {
|
|
651
652
|
if (c === m) continue;
|
|
652
653
|
return c;
|
|
653
654
|
}
|
|
654
655
|
}
|
|
655
656
|
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
656
|
-
if (i === h) throw i =
|
|
657
|
+
if (i === h) throw i = _, n.arg;
|
|
657
658
|
n.dispatchException(n.arg);
|
|
658
659
|
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
659
|
-
i =
|
|
660
|
+
i = f;
|
|
660
661
|
var u = d(t, r, n);
|
|
661
662
|
if ("normal" === u.type) {
|
|
662
|
-
if (i = n.done ?
|
|
663
|
+
if (i = n.done ? _ : p, u.arg === m) continue;
|
|
663
664
|
return {
|
|
664
665
|
value: u.arg,
|
|
665
666
|
done: n.done
|
|
666
667
|
};
|
|
667
668
|
}
|
|
668
|
-
"throw" === u.type && (i =
|
|
669
|
+
"throw" === u.type && (i = _, n.method = "throw", n.arg = u.arg);
|
|
669
670
|
}
|
|
670
671
|
};
|
|
671
672
|
}
|
|
672
|
-
function
|
|
673
|
+
function O(t, r) {
|
|
673
674
|
var n = r.method,
|
|
674
675
|
i = t.iterator[n];
|
|
675
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
676
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, O(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
676
677
|
var o = d(i, t.iterator, r.arg);
|
|
677
678
|
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
678
679
|
var s = o.arg;
|
|
679
680
|
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);
|
|
680
681
|
}
|
|
681
|
-
function
|
|
682
|
+
function x(e) {
|
|
682
683
|
var t = {
|
|
683
684
|
tryLoc: e[0]
|
|
684
685
|
};
|
|
@@ -691,7 +692,7 @@ function de() {
|
|
|
691
692
|
function E(e) {
|
|
692
693
|
this.tryEntries = [{
|
|
693
694
|
tryLoc: "root"
|
|
694
|
-
}], e.forEach(
|
|
695
|
+
}], e.forEach(x, this), this.reset(!0);
|
|
695
696
|
}
|
|
696
697
|
function D(t) {
|
|
697
698
|
if (t || "" === t) {
|
|
@@ -707,7 +708,7 @@ function de() {
|
|
|
707
708
|
return o.next = o;
|
|
708
709
|
}
|
|
709
710
|
}
|
|
710
|
-
throw new TypeError(
|
|
711
|
+
throw new TypeError(de(t) + " is not iterable");
|
|
711
712
|
}
|
|
712
713
|
return b.prototype = g, i(S, "constructor", {
|
|
713
714
|
value: g,
|
|
@@ -724,15 +725,15 @@ function de() {
|
|
|
724
725
|
return {
|
|
725
726
|
__await: e
|
|
726
727
|
};
|
|
727
|
-
}, C
|
|
728
|
+
}, P(C.prototype), u(C.prototype, a, function () {
|
|
728
729
|
return this;
|
|
729
|
-
}), t.AsyncIterator =
|
|
730
|
+
}), t.AsyncIterator = C, t.async = function (e, r, n, i, o) {
|
|
730
731
|
void 0 === o && (o = Promise);
|
|
731
|
-
var s = new
|
|
732
|
+
var s = new C(l(e, r, n, i), o);
|
|
732
733
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
733
734
|
return e.done ? e.value : s.next();
|
|
734
735
|
});
|
|
735
|
-
},
|
|
736
|
+
}, P(S), u(S, c, "Generator"), u(S, s, function () {
|
|
736
737
|
return this;
|
|
737
738
|
}), u(S, "toString", function () {
|
|
738
739
|
return "[object Generator]";
|
|
@@ -828,46 +829,46 @@ function de() {
|
|
|
828
829
|
}
|
|
829
830
|
}, t;
|
|
830
831
|
}
|
|
831
|
-
function
|
|
832
|
+
function pe(e, t) {
|
|
832
833
|
for (var r = 0; r < t.length; r++) {
|
|
833
834
|
var n = t[r];
|
|
834
835
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, _e(n.key), n);
|
|
835
836
|
}
|
|
836
837
|
}
|
|
837
|
-
function
|
|
838
|
-
return t &&
|
|
838
|
+
function fe(e, t, r) {
|
|
839
|
+
return t && pe(e.prototype, t), r && pe(e, r), Object.defineProperty(e, "prototype", {
|
|
839
840
|
writable: !1
|
|
840
841
|
}), e;
|
|
841
842
|
}
|
|
842
843
|
function _e(e) {
|
|
843
844
|
var t = function (e, t) {
|
|
844
|
-
if ("object" !=
|
|
845
|
+
if ("object" != de(e) || !e) return e;
|
|
845
846
|
var r = e[Symbol.toPrimitive];
|
|
846
847
|
if (void 0 !== r) {
|
|
847
848
|
var n = r.call(e, t || "default");
|
|
848
|
-
if ("object" !=
|
|
849
|
+
if ("object" != de(n)) return n;
|
|
849
850
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
850
851
|
}
|
|
851
852
|
return ("string" === t ? String : Number)(e);
|
|
852
853
|
}(e, "string");
|
|
853
|
-
return "symbol" ==
|
|
854
|
+
return "symbol" == de(t) ? t : String(t);
|
|
854
855
|
}
|
|
855
|
-
function
|
|
856
|
+
function me(e, t) {
|
|
856
857
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
857
858
|
}
|
|
858
|
-
function
|
|
859
|
-
return t =
|
|
860
|
-
if (t && ("object" ===
|
|
859
|
+
function ve(e, t, r) {
|
|
860
|
+
return t = ye(t), function (e, t) {
|
|
861
|
+
if (t && ("object" === de(t) || "function" == typeof t)) return t;
|
|
861
862
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
862
863
|
return function (e) {
|
|
863
864
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
864
865
|
return e;
|
|
865
866
|
}(e);
|
|
866
|
-
}(e,
|
|
867
|
+
}(e, ge() ? Reflect.construct(t, r || [], ye(e).constructor) : t.apply(e, r));
|
|
867
868
|
}
|
|
868
|
-
function
|
|
869
|
+
function be(e) {
|
|
869
870
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
870
|
-
return
|
|
871
|
+
return be = function be(e) {
|
|
871
872
|
if (null === e || !function (e) {
|
|
872
873
|
try {
|
|
873
874
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -882,12 +883,12 @@ function ve(e) {
|
|
|
882
883
|
}
|
|
883
884
|
function r() {
|
|
884
885
|
return function (e, t, r) {
|
|
885
|
-
if (
|
|
886
|
+
if (ge()) return Reflect.construct.apply(null, arguments);
|
|
886
887
|
var n = [null];
|
|
887
888
|
n.push.apply(n, t);
|
|
888
889
|
var i = new (e.bind.apply(e, n))();
|
|
889
|
-
return r &&
|
|
890
|
-
}(e, arguments,
|
|
890
|
+
return r && ke(i, r.prototype), i;
|
|
891
|
+
}(e, arguments, ye(this).constructor);
|
|
891
892
|
}
|
|
892
893
|
return r.prototype = Object.create(e.prototype, {
|
|
893
894
|
constructor: {
|
|
@@ -896,36 +897,38 @@ function ve(e) {
|
|
|
896
897
|
writable: !0,
|
|
897
898
|
configurable: !0
|
|
898
899
|
}
|
|
899
|
-
}),
|
|
900
|
-
},
|
|
900
|
+
}), ke(r, e);
|
|
901
|
+
}, be(e);
|
|
901
902
|
}
|
|
902
|
-
function
|
|
903
|
+
function ge() {
|
|
903
904
|
try {
|
|
904
905
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
905
906
|
} catch (e) {}
|
|
906
|
-
return (
|
|
907
|
+
return (ge = function ge() {
|
|
907
908
|
return !!e;
|
|
908
909
|
})();
|
|
909
910
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
911
|
+
function ke(e, t) {
|
|
912
|
+
return ke = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
912
913
|
return e.__proto__ = t, e;
|
|
913
|
-
},
|
|
914
|
+
}, ke(e, t);
|
|
914
915
|
}
|
|
915
|
-
function
|
|
916
|
-
return
|
|
916
|
+
function ye(e) {
|
|
917
|
+
return ye = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
917
918
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
918
|
-
},
|
|
919
|
+
}, ye(e);
|
|
919
920
|
}
|
|
920
921
|
!function (e) {
|
|
921
922
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
922
923
|
}(b || (b = {})), function (e) {
|
|
923
924
|
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
924
925
|
}(g || (g = {})), function (e) {
|
|
926
|
+
e.smsOtp = "smsOtp", e.totp = "totp";
|
|
927
|
+
}(k || (k = {})), function (e) {
|
|
925
928
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
926
|
-
}(
|
|
927
|
-
var
|
|
928
|
-
function
|
|
929
|
+
}(y || (y = {}));
|
|
930
|
+
var we;
|
|
931
|
+
function Se(e, t, r, n) {
|
|
929
932
|
return new (r || (r = Promise))(function (i, o) {
|
|
930
933
|
function s(e) {
|
|
931
934
|
try {
|
|
@@ -952,12 +955,12 @@ function we(e, t, r, n) {
|
|
|
952
955
|
}
|
|
953
956
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
954
957
|
e.RequiredCatcha = "Catcha Required";
|
|
955
|
-
}(
|
|
956
|
-
var
|
|
958
|
+
}(we || (we = {}));
|
|
959
|
+
var Pe,
|
|
957
960
|
Ce = function (e) {
|
|
958
961
|
function t(e) {
|
|
959
962
|
var r;
|
|
960
|
-
return
|
|
963
|
+
return me(this, t), (r = ve(this, t, [e])).type = e, r;
|
|
961
964
|
}
|
|
962
965
|
return function (e, t) {
|
|
963
966
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -969,10 +972,10 @@ var Se,
|
|
|
969
972
|
}
|
|
970
973
|
}), Object.defineProperty(e, "prototype", {
|
|
971
974
|
writable: !1
|
|
972
|
-
}), t &&
|
|
973
|
-
}(t,
|
|
975
|
+
}), t && ke(e, t);
|
|
976
|
+
}(t, be(Error)), fe(t);
|
|
974
977
|
}();
|
|
975
|
-
function
|
|
978
|
+
function Te(e) {
|
|
976
979
|
var t,
|
|
977
980
|
r = e.method,
|
|
978
981
|
n = e.finalURL,
|
|
@@ -980,9 +983,9 @@ function Pe(e) {
|
|
|
980
983
|
o = e.xSDKClientHeader,
|
|
981
984
|
s = e.xSDKParentHostHeader,
|
|
982
985
|
a = e.body;
|
|
983
|
-
return
|
|
986
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
984
987
|
var c, u, l, d, h, p;
|
|
985
|
-
return
|
|
988
|
+
return he().wrap(function (e) {
|
|
986
989
|
for (;;) switch (e.prev = e.next) {
|
|
987
990
|
case 0:
|
|
988
991
|
return c = {
|
|
@@ -1031,9 +1034,9 @@ function Pe(e) {
|
|
|
1031
1034
|
e.next = 37;
|
|
1032
1035
|
break;
|
|
1033
1036
|
}
|
|
1034
|
-
throw new O(h);
|
|
1035
|
-
case 37:
|
|
1036
1037
|
throw new A(h);
|
|
1038
|
+
case 37:
|
|
1039
|
+
throw new E(h);
|
|
1037
1040
|
case 38:
|
|
1038
1041
|
return e.prev = 38, e.next = 41, l.text();
|
|
1039
1042
|
case 41:
|
|
@@ -1046,7 +1049,7 @@ function Pe(e) {
|
|
|
1046
1049
|
e.next = 49;
|
|
1047
1050
|
break;
|
|
1048
1051
|
}
|
|
1049
|
-
throw new Ce(
|
|
1052
|
+
throw new Ce(we.RequiredCatcha);
|
|
1050
1053
|
case 49:
|
|
1051
1054
|
throw new x("Invalid response from the Stytch servers.");
|
|
1052
1055
|
case 50:
|
|
@@ -1056,34 +1059,34 @@ function Pe(e) {
|
|
|
1056
1059
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1057
1060
|
}));
|
|
1058
1061
|
}
|
|
1059
|
-
var
|
|
1062
|
+
var Oe = new Uint8Array(16);
|
|
1060
1063
|
function xe() {
|
|
1061
|
-
if (!
|
|
1062
|
-
return
|
|
1064
|
+
if (!Pe && !(Pe = "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");
|
|
1065
|
+
return Pe(Oe);
|
|
1063
1066
|
}
|
|
1064
|
-
var
|
|
1065
|
-
for (var
|
|
1066
|
-
function
|
|
1067
|
+
var Ae = /^(?:[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;
|
|
1068
|
+
for (var Ee = [], De = 0; De < 256; ++De) Ee.push((De + 256).toString(16).substr(1));
|
|
1069
|
+
function Ie(e) {
|
|
1067
1070
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1068
|
-
r = (
|
|
1071
|
+
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();
|
|
1069
1072
|
if (!function (e) {
|
|
1070
|
-
return "string" == typeof e &&
|
|
1073
|
+
return "string" == typeof e && Ae.test(e);
|
|
1071
1074
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1072
1075
|
return r;
|
|
1073
1076
|
}
|
|
1074
|
-
function
|
|
1077
|
+
function Re(e, t, r) {
|
|
1075
1078
|
var n = (e = e || {}).random || (e.rng || xe)();
|
|
1076
1079
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1077
1080
|
r = r || 0;
|
|
1078
1081
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1079
1082
|
return t;
|
|
1080
1083
|
}
|
|
1081
|
-
return
|
|
1084
|
+
return Ie(n);
|
|
1082
1085
|
}
|
|
1083
1086
|
var je = {};
|
|
1084
1087
|
function Fe(e, t) {
|
|
1085
|
-
return
|
|
1086
|
-
return
|
|
1088
|
+
return Se(this, void 0, void 0, he().mark(function r() {
|
|
1089
|
+
return he().wrap(function (r) {
|
|
1087
1090
|
for (;;) switch (r.prev = r.next) {
|
|
1088
1091
|
case 0:
|
|
1089
1092
|
if (void 0 === je[e]) {
|
|
@@ -1092,7 +1095,7 @@ function Fe(e, t) {
|
|
|
1092
1095
|
}
|
|
1093
1096
|
return r.abrupt("return", je[e]);
|
|
1094
1097
|
case 2:
|
|
1095
|
-
return je[e] =
|
|
1098
|
+
return je[e] = Le(e, t), r.abrupt("return", je[e]);
|
|
1096
1099
|
case 4:
|
|
1097
1100
|
case "end":
|
|
1098
1101
|
return r.stop();
|
|
@@ -1100,10 +1103,10 @@ function Fe(e, t) {
|
|
|
1100
1103
|
}, r);
|
|
1101
1104
|
}));
|
|
1102
1105
|
}
|
|
1103
|
-
function
|
|
1106
|
+
function Le(e, t) {
|
|
1104
1107
|
return new Promise(function (r, n) {
|
|
1105
1108
|
var i = function (e) {
|
|
1106
|
-
var t =
|
|
1109
|
+
var t = Me(e);
|
|
1107
1110
|
if (t[0]) return t[0];
|
|
1108
1111
|
}(e);
|
|
1109
1112
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1127,47 +1130,47 @@ function Re(e, t) {
|
|
|
1127
1130
|
});
|
|
1128
1131
|
});
|
|
1129
1132
|
}
|
|
1130
|
-
var
|
|
1133
|
+
var Me = function Me(e) {
|
|
1131
1134
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1132
1135
|
};
|
|
1133
|
-
var
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
+
var Be,
|
|
1137
|
+
Ke = ["[Stytch]"],
|
|
1138
|
+
ze = function ze() {
|
|
1136
1139
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1137
|
-
return (e = console).warn.apply(e,
|
|
1140
|
+
return (e = console).warn.apply(e, Ke.concat(r));
|
|
1138
1141
|
},
|
|
1139
|
-
|
|
1142
|
+
Ne = function Ne() {
|
|
1140
1143
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1141
|
-
return (e = console).error.apply(e,
|
|
1144
|
+
return (e = console).error.apply(e, Ke.concat(r));
|
|
1142
1145
|
},
|
|
1143
|
-
|
|
1144
|
-
|
|
1146
|
+
Ue = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1147
|
+
qe = function qe(e) {
|
|
1145
1148
|
return e.includes("public-token-test");
|
|
1146
1149
|
},
|
|
1147
|
-
|
|
1150
|
+
We = function We(e) {
|
|
1148
1151
|
var t = {
|
|
1149
1152
|
isObject: function isObject(r, n) {
|
|
1150
|
-
var i = "object" ===
|
|
1151
|
-
if (!i) throw new
|
|
1153
|
+
var i = "object" === de(n) && !Array.isArray(n) && null !== n;
|
|
1154
|
+
if (!i) throw new S(e, r + " must be an object.");
|
|
1152
1155
|
return t;
|
|
1153
1156
|
},
|
|
1154
1157
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1155
1158
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1156
1159
|
},
|
|
1157
1160
|
isString: function isString(r, n) {
|
|
1158
|
-
if ("string" != typeof n) throw new
|
|
1161
|
+
if ("string" != typeof n) throw new S(e, r + " must be a string.");
|
|
1159
1162
|
return t;
|
|
1160
1163
|
},
|
|
1161
1164
|
isOptionalString: function isOptionalString(e, r) {
|
|
1162
1165
|
return void 0 === r ? t : t.isString(e, r);
|
|
1163
1166
|
},
|
|
1164
1167
|
isStringArray: function isStringArray(r, n) {
|
|
1165
|
-
if (!Array.isArray(n)) throw new
|
|
1168
|
+
if (!Array.isArray(n)) throw new S(e, r + " must be an array of strings.");
|
|
1166
1169
|
var i,
|
|
1167
1170
|
o = function (e, t) {
|
|
1168
1171
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1169
1172
|
if (!r) {
|
|
1170
|
-
if (Array.isArray(e) || (r =
|
|
1173
|
+
if (Array.isArray(e) || (r = ue(e)) || t && e && "number" == typeof e.length) {
|
|
1171
1174
|
r && (e = r);
|
|
1172
1175
|
var _n = 0,
|
|
1173
1176
|
i = function i() {};
|
|
@@ -1214,7 +1217,7 @@ var Me,
|
|
|
1214
1217
|
}(n);
|
|
1215
1218
|
try {
|
|
1216
1219
|
for (o.s(); !(i = o.n()).done;) {
|
|
1217
|
-
if ("string" != typeof i.value) throw new
|
|
1220
|
+
if ("string" != typeof i.value) throw new S(e, r + " must be an array of strings.");
|
|
1218
1221
|
}
|
|
1219
1222
|
} catch (e) {
|
|
1220
1223
|
o.e(e);
|
|
@@ -1227,14 +1230,14 @@ var Me,
|
|
|
1227
1230
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1228
1231
|
},
|
|
1229
1232
|
isNumber: function isNumber(r, n) {
|
|
1230
|
-
if ("number" != typeof n) throw new
|
|
1233
|
+
if ("number" != typeof n) throw new S(e, r + " must be a number.");
|
|
1231
1234
|
return t;
|
|
1232
1235
|
},
|
|
1233
1236
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1234
1237
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1235
1238
|
},
|
|
1236
1239
|
isBoolean: function isBoolean(r, n) {
|
|
1237
|
-
if ("boolean" != typeof n) throw new
|
|
1240
|
+
if ("boolean" != typeof n) throw new S(e, r + " must be a boolean.");
|
|
1238
1241
|
return t;
|
|
1239
1242
|
},
|
|
1240
1243
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1243,14 +1246,14 @@ var Me,
|
|
|
1243
1246
|
};
|
|
1244
1247
|
return t;
|
|
1245
1248
|
},
|
|
1246
|
-
|
|
1249
|
+
He = fe(function e(t, r, n) {
|
|
1247
1250
|
var i = this,
|
|
1248
1251
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1249
1252
|
return Promise.resolve(void 0);
|
|
1250
1253
|
};
|
|
1251
|
-
|
|
1252
|
-
return
|
|
1253
|
-
return
|
|
1254
|
+
me(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1255
|
+
return Se(i, void 0, void 0, he().mark(function e() {
|
|
1256
|
+
return he().wrap(function (e) {
|
|
1254
1257
|
for (;;) switch (e.prev = e.next) {
|
|
1255
1258
|
case 0:
|
|
1256
1259
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1263,9 +1266,9 @@ var Me,
|
|
|
1263
1266
|
}, e, this);
|
|
1264
1267
|
}));
|
|
1265
1268
|
}, this.getTelemetryID = function () {
|
|
1266
|
-
return
|
|
1269
|
+
return Se(i, void 0, void 0, he().mark(function e() {
|
|
1267
1270
|
var t, r, n, i;
|
|
1268
|
-
return
|
|
1271
|
+
return he().wrap(function (e) {
|
|
1269
1272
|
for (;;) switch (e.prev = e.next) {
|
|
1270
1273
|
case 0:
|
|
1271
1274
|
return e.next = 2, this.state;
|
|
@@ -1286,9 +1289,9 @@ var Me,
|
|
|
1286
1289
|
}, e, this);
|
|
1287
1290
|
}));
|
|
1288
1291
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1289
|
-
return
|
|
1292
|
+
return Se(i, void 0, void 0, he().mark(function e() {
|
|
1290
1293
|
var t, r, n, i, o, s;
|
|
1291
|
-
return
|
|
1294
|
+
return he().wrap(function (e) {
|
|
1292
1295
|
for (;;) switch (e.prev = e.next) {
|
|
1293
1296
|
case 0:
|
|
1294
1297
|
return e.next = 2, this.state;
|
|
@@ -1331,14 +1334,14 @@ var Me,
|
|
|
1331
1334
|
}, e, this);
|
|
1332
1335
|
}));
|
|
1333
1336
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1334
|
-
return
|
|
1337
|
+
return Se(i, void 0, void 0, he().mark(function r() {
|
|
1335
1338
|
var n, i, o;
|
|
1336
|
-
return
|
|
1339
|
+
return he().wrap(function (r) {
|
|
1337
1340
|
for (;;) switch (r.prev = r.next) {
|
|
1338
1341
|
case 0:
|
|
1339
1342
|
return r.next = 2, this.state;
|
|
1340
1343
|
case 2:
|
|
1341
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1344
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== we.RequiredCatcha || !i) {
|
|
1342
1345
|
r.next = 14;
|
|
1343
1346
|
break;
|
|
1344
1347
|
}
|
|
@@ -1362,8 +1365,8 @@ var Me,
|
|
|
1362
1365
|
}, r, this);
|
|
1363
1366
|
}));
|
|
1364
1367
|
}, this.state = n.then(function (e) {
|
|
1365
|
-
return
|
|
1366
|
-
return
|
|
1368
|
+
return Se(i, void 0, void 0, he().mark(function n() {
|
|
1369
|
+
return he().wrap(function (n) {
|
|
1367
1370
|
for (;;) switch (n.prev = n.next) {
|
|
1368
1371
|
case 0:
|
|
1369
1372
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1398,11 +1401,11 @@ var Me,
|
|
|
1398
1401
|
}));
|
|
1399
1402
|
});
|
|
1400
1403
|
}),
|
|
1401
|
-
|
|
1404
|
+
Ge = function Ge() {
|
|
1402
1405
|
return {
|
|
1403
1406
|
isEnabled: function isEnabled() {
|
|
1404
|
-
return
|
|
1405
|
-
return
|
|
1407
|
+
return Se(void 0, void 0, void 0, he().mark(function e() {
|
|
1408
|
+
return he().wrap(function (e) {
|
|
1406
1409
|
for (;;) switch (e.prev = e.next) {
|
|
1407
1410
|
case 0:
|
|
1408
1411
|
return e.abrupt("return", !1);
|
|
@@ -1414,8 +1417,8 @@ var Me,
|
|
|
1414
1417
|
}));
|
|
1415
1418
|
},
|
|
1416
1419
|
getTelemetryID: function getTelemetryID() {
|
|
1417
|
-
return
|
|
1418
|
-
return
|
|
1420
|
+
return Se(void 0, void 0, void 0, he().mark(function e() {
|
|
1421
|
+
return he().wrap(function (e) {
|
|
1419
1422
|
for (;;) switch (e.prev = e.next) {
|
|
1420
1423
|
case 0:
|
|
1421
1424
|
return e.abrupt("return", void 0);
|
|
@@ -1427,8 +1430,8 @@ var Me,
|
|
|
1427
1430
|
}));
|
|
1428
1431
|
},
|
|
1429
1432
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1430
|
-
return
|
|
1431
|
-
return
|
|
1433
|
+
return Se(void 0, void 0, void 0, he().mark(function e() {
|
|
1434
|
+
return he().wrap(function (e) {
|
|
1432
1435
|
for (;;) switch (e.prev = e.next) {
|
|
1433
1436
|
case 0:
|
|
1434
1437
|
return e.abrupt("return", {
|
|
@@ -1443,8 +1446,8 @@ var Me,
|
|
|
1443
1446
|
}));
|
|
1444
1447
|
},
|
|
1445
1448
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1446
|
-
return
|
|
1447
|
-
return
|
|
1449
|
+
return Se(void 0, void 0, void 0, he().mark(function e() {
|
|
1450
|
+
return he().wrap(function (e) {
|
|
1448
1451
|
for (;;) switch (e.prev = e.next) {
|
|
1449
1452
|
case 0:
|
|
1450
1453
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1457,11 +1460,63 @@ var Me,
|
|
|
1457
1460
|
}
|
|
1458
1461
|
};
|
|
1459
1462
|
},
|
|
1460
|
-
|
|
1463
|
+
Ve = function () {
|
|
1464
|
+
function e() {
|
|
1465
|
+
me(this, e);
|
|
1466
|
+
}
|
|
1467
|
+
return fe(e, null, [{
|
|
1468
|
+
key: "marshall",
|
|
1469
|
+
value: function value(e) {
|
|
1470
|
+
return Object.assign(Object.assign({}, e), {
|
|
1471
|
+
name: e.name,
|
|
1472
|
+
message: e.message,
|
|
1473
|
+
stack: e.stack
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
}, {
|
|
1477
|
+
key: "inflate",
|
|
1478
|
+
value: function value(e, t) {
|
|
1479
|
+
var r = new e(t);
|
|
1480
|
+
return Object.assign(r, t), Object.setPrototypeOf(r, e.prototype), r;
|
|
1481
|
+
}
|
|
1482
|
+
}, {
|
|
1483
|
+
key: "unmarshall",
|
|
1484
|
+
value: function value(t) {
|
|
1485
|
+
if ("name" in t) switch (t.name) {
|
|
1486
|
+
case "SDKAPIUnreachableError":
|
|
1487
|
+
return e.inflate(w, t);
|
|
1488
|
+
case "StytchSDKSchemaError":
|
|
1489
|
+
return e.inflate(P, t);
|
|
1490
|
+
case "StytchAPIUnreachableError":
|
|
1491
|
+
return e.inflate(x, t);
|
|
1492
|
+
case "StytchAPISchemaError":
|
|
1493
|
+
return e.inflate(A, t);
|
|
1494
|
+
case "StytchSDKAPIError":
|
|
1495
|
+
return e.inflate(C, t);
|
|
1496
|
+
case "StytchAPIError":
|
|
1497
|
+
return e.inflate(E, t);
|
|
1498
|
+
case "TypeError":
|
|
1499
|
+
return e.inflate(TypeError, t);
|
|
1500
|
+
case "SyntaxError":
|
|
1501
|
+
return e.inflate(SyntaxError, t);
|
|
1502
|
+
case "ReferenceError":
|
|
1503
|
+
return e.inflate(ReferenceError, t);
|
|
1504
|
+
case "RangeError":
|
|
1505
|
+
return e.inflate(RangeError, t);
|
|
1506
|
+
case "EvalError":
|
|
1507
|
+
return e.inflate(EvalError, t);
|
|
1508
|
+
case "URIError":
|
|
1509
|
+
return e.inflate(URIError, t);
|
|
1510
|
+
}
|
|
1511
|
+
return e.inflate(Error, t);
|
|
1512
|
+
}
|
|
1513
|
+
}]), e;
|
|
1514
|
+
}(),
|
|
1515
|
+
Ye = function () {
|
|
1461
1516
|
function e(t) {
|
|
1462
|
-
|
|
1517
|
+
me(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1463
1518
|
}
|
|
1464
|
-
return
|
|
1519
|
+
return fe(e, [{
|
|
1465
1520
|
key: "logEvent",
|
|
1466
1521
|
value: function value(e, t) {
|
|
1467
1522
|
this.batch.push({
|
|
@@ -1472,9 +1527,9 @@ var Me,
|
|
|
1472
1527
|
}, {
|
|
1473
1528
|
key: "flush",
|
|
1474
1529
|
value: function value() {
|
|
1475
|
-
return
|
|
1530
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
1476
1531
|
var t;
|
|
1477
|
-
return
|
|
1532
|
+
return he().wrap(function (e) {
|
|
1478
1533
|
for (;;) switch (e.prev = e.next) {
|
|
1479
1534
|
case 0:
|
|
1480
1535
|
if (this.batch.length) {
|
|
@@ -1506,26 +1561,26 @@ var Me,
|
|
|
1506
1561
|
}();
|
|
1507
1562
|
!function (e) {
|
|
1508
1563
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1509
|
-
}(
|
|
1564
|
+
}(Be || (Be = {})), Promise.resolve({
|
|
1510
1565
|
pkceRequiredForEmailMagicLinks: !1
|
|
1511
1566
|
}), Promise.resolve({
|
|
1512
1567
|
pkceRequiredForPasswordResets: !1
|
|
1513
1568
|
});
|
|
1514
|
-
var
|
|
1569
|
+
var Je = Promise.resolve({
|
|
1515
1570
|
pkceRequiredForEmailMagicLinks: !1
|
|
1516
1571
|
}),
|
|
1517
|
-
|
|
1572
|
+
$e = function () {
|
|
1518
1573
|
function e(t, r, n, i) {
|
|
1519
1574
|
var o = this,
|
|
1520
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1521
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1522
|
-
|
|
1575
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Je,
|
|
1576
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1577
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1523
1578
|
invite: function invite(e) {
|
|
1524
|
-
return
|
|
1525
|
-
return
|
|
1579
|
+
return Se(o, void 0, void 0, he().mark(function t() {
|
|
1580
|
+
return he().wrap(function (t) {
|
|
1526
1581
|
for (;;) switch (t.prev = t.next) {
|
|
1527
1582
|
case 0:
|
|
1528
|
-
return
|
|
1583
|
+
return We("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({
|
|
1529
1584
|
url: "/b2b/magic_links/email/invite",
|
|
1530
1585
|
body: e,
|
|
1531
1586
|
errorMessage: "Failed to send invite.",
|
|
@@ -1539,12 +1594,12 @@ var Ve = Promise.resolve({
|
|
|
1539
1594
|
}));
|
|
1540
1595
|
},
|
|
1541
1596
|
loginOrSignup: function loginOrSignup(e) {
|
|
1542
|
-
return
|
|
1597
|
+
return Se(o, void 0, void 0, he().mark(function t() {
|
|
1543
1598
|
var r, n;
|
|
1544
|
-
return
|
|
1599
|
+
return he().wrap(function (t) {
|
|
1545
1600
|
for (;;) switch (t.prev = t.next) {
|
|
1546
1601
|
case 0:
|
|
1547
|
-
return
|
|
1602
|
+
return We("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();
|
|
1548
1603
|
case 3:
|
|
1549
1604
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1550
1605
|
pkce_code_challenge: r
|
|
@@ -1563,12 +1618,12 @@ var Ve = Promise.resolve({
|
|
|
1563
1618
|
},
|
|
1564
1619
|
discovery: {
|
|
1565
1620
|
send: function send(e) {
|
|
1566
|
-
return
|
|
1621
|
+
return Se(o, void 0, void 0, he().mark(function t() {
|
|
1567
1622
|
var r, n;
|
|
1568
|
-
return
|
|
1623
|
+
return he().wrap(function (t) {
|
|
1569
1624
|
for (;;) switch (t.prev = t.next) {
|
|
1570
1625
|
case 0:
|
|
1571
|
-
return
|
|
1626
|
+
return We("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();
|
|
1572
1627
|
case 3:
|
|
1573
1628
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1574
1629
|
pkce_code_challenge: r
|
|
@@ -1587,12 +1642,12 @@ var Ve = Promise.resolve({
|
|
|
1587
1642
|
}
|
|
1588
1643
|
}
|
|
1589
1644
|
}, this.authenticate = function (e) {
|
|
1590
|
-
return
|
|
1645
|
+
return Se(o, void 0, void 0, he().mark(function t() {
|
|
1591
1646
|
var r, n;
|
|
1592
|
-
return
|
|
1647
|
+
return he().wrap(function (t) {
|
|
1593
1648
|
for (;;) switch (t.prev = t.next) {
|
|
1594
1649
|
case 0:
|
|
1595
|
-
return
|
|
1650
|
+
return We("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();
|
|
1596
1651
|
case 3:
|
|
1597
1652
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1598
1653
|
t.next = 19;
|
|
@@ -1643,12 +1698,12 @@ var Ve = Promise.resolve({
|
|
|
1643
1698
|
}));
|
|
1644
1699
|
}, this.discovery = {
|
|
1645
1700
|
authenticate: function authenticate(e) {
|
|
1646
|
-
return
|
|
1701
|
+
return Se(o, void 0, void 0, he().mark(function t() {
|
|
1647
1702
|
var r, n, i, o, s, a;
|
|
1648
|
-
return
|
|
1703
|
+
return he().wrap(function (t) {
|
|
1649
1704
|
for (;;) switch (t.prev = t.next) {
|
|
1650
1705
|
case 0:
|
|
1651
|
-
return
|
|
1706
|
+
return We("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1652
1707
|
case 3:
|
|
1653
1708
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1654
1709
|
case 6:
|
|
@@ -1679,12 +1734,12 @@ var Ve = Promise.resolve({
|
|
|
1679
1734
|
}
|
|
1680
1735
|
};
|
|
1681
1736
|
}
|
|
1682
|
-
return
|
|
1737
|
+
return fe(e, [{
|
|
1683
1738
|
key: "getCodeChallenge",
|
|
1684
1739
|
value: function value() {
|
|
1685
|
-
return
|
|
1740
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
1686
1741
|
var t, r;
|
|
1687
|
-
return
|
|
1742
|
+
return he().wrap(function (e) {
|
|
1688
1743
|
for (;;) switch (e.prev = e.next) {
|
|
1689
1744
|
case 0:
|
|
1690
1745
|
return e.next = 2, this._config;
|
|
@@ -1716,9 +1771,9 @@ var Ve = Promise.resolve({
|
|
|
1716
1771
|
}, {
|
|
1717
1772
|
key: "handlePKCEForAuthenticate",
|
|
1718
1773
|
value: function value(e, t) {
|
|
1719
|
-
return
|
|
1774
|
+
return Se(this, void 0, void 0, he().mark(function r() {
|
|
1720
1775
|
var n, i, o, s, a, c;
|
|
1721
|
-
return
|
|
1776
|
+
return he().wrap(function (r) {
|
|
1722
1777
|
for (;;) switch (r.prev = r.next) {
|
|
1723
1778
|
case 0:
|
|
1724
1779
|
return r.next = 2, e.getPKPair();
|
|
@@ -1747,12 +1802,12 @@ var Ve = Promise.resolve({
|
|
|
1747
1802
|
}
|
|
1748
1803
|
}]), e;
|
|
1749
1804
|
}(),
|
|
1750
|
-
|
|
1805
|
+
Xe = fe(function e(t, r) {
|
|
1751
1806
|
var n = this;
|
|
1752
|
-
|
|
1753
|
-
return
|
|
1807
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1808
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
1754
1809
|
var t;
|
|
1755
|
-
return
|
|
1810
|
+
return he().wrap(function (e) {
|
|
1756
1811
|
for (;;) switch (e.prev = e.next) {
|
|
1757
1812
|
case 0:
|
|
1758
1813
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1776,12 +1831,12 @@ var Ve = Promise.resolve({
|
|
|
1776
1831
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1777
1832
|
});
|
|
1778
1833
|
}, this.update = function (e) {
|
|
1779
|
-
return
|
|
1834
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
1780
1835
|
var r;
|
|
1781
|
-
return
|
|
1836
|
+
return he().wrap(function (t) {
|
|
1782
1837
|
for (;;) switch (t.prev = t.next) {
|
|
1783
1838
|
case 0:
|
|
1784
|
-
return
|
|
1839
|
+
return We("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("default_mfa_method", e.default_mfa_method), t.next = 3, this._networkClient.fetchSDK({
|
|
1785
1840
|
url: "/b2b/organizations/members/update",
|
|
1786
1841
|
body: e,
|
|
1787
1842
|
errorMessage: "Failed to update member.",
|
|
@@ -1796,9 +1851,9 @@ var Ve = Promise.resolve({
|
|
|
1796
1851
|
}, t, this);
|
|
1797
1852
|
}));
|
|
1798
1853
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1799
|
-
return
|
|
1854
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
1800
1855
|
var t;
|
|
1801
|
-
return
|
|
1856
|
+
return he().wrap(function (e) {
|
|
1802
1857
|
for (;;) switch (e.prev = e.next) {
|
|
1803
1858
|
case 0:
|
|
1804
1859
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1815,9 +1870,9 @@ var Ve = Promise.resolve({
|
|
|
1815
1870
|
}, e, this);
|
|
1816
1871
|
}));
|
|
1817
1872
|
}, this.deleteMFATOTP = function () {
|
|
1818
|
-
return
|
|
1873
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
1819
1874
|
var t;
|
|
1820
|
-
return
|
|
1875
|
+
return he().wrap(function (e) {
|
|
1821
1876
|
for (;;) switch (e.prev = e.next) {
|
|
1822
1877
|
case 0:
|
|
1823
1878
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1834,9 +1889,9 @@ var Ve = Promise.resolve({
|
|
|
1834
1889
|
}, e, this);
|
|
1835
1890
|
}));
|
|
1836
1891
|
}, this.deletePassword = function (e) {
|
|
1837
|
-
return
|
|
1892
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
1838
1893
|
var r;
|
|
1839
|
-
return
|
|
1894
|
+
return he().wrap(function (t) {
|
|
1840
1895
|
for (;;) switch (t.prev = t.next) {
|
|
1841
1896
|
case 0:
|
|
1842
1897
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1854,14 +1909,14 @@ var Ve = Promise.resolve({
|
|
|
1854
1909
|
}));
|
|
1855
1910
|
};
|
|
1856
1911
|
}),
|
|
1857
|
-
|
|
1912
|
+
Ze = function () {
|
|
1858
1913
|
function e(t, r, n, i, o) {
|
|
1859
1914
|
var s = this,
|
|
1860
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1861
|
-
|
|
1915
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1916
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1862
1917
|
createConnection: function createConnection(e) {
|
|
1863
|
-
return
|
|
1864
|
-
return
|
|
1918
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
1919
|
+
return he().wrap(function (t) {
|
|
1865
1920
|
for (;;) switch (t.prev = t.next) {
|
|
1866
1921
|
case 0:
|
|
1867
1922
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1880,8 +1935,8 @@ var Ve = Promise.resolve({
|
|
|
1880
1935
|
}));
|
|
1881
1936
|
},
|
|
1882
1937
|
updateConnection: function updateConnection(e) {
|
|
1883
|
-
return
|
|
1884
|
-
return
|
|
1938
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
1939
|
+
return he().wrap(function (t) {
|
|
1885
1940
|
for (;;) switch (t.prev = t.next) {
|
|
1886
1941
|
case 0:
|
|
1887
1942
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1900,8 +1955,8 @@ var Ve = Promise.resolve({
|
|
|
1900
1955
|
}));
|
|
1901
1956
|
},
|
|
1902
1957
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1903
|
-
return
|
|
1904
|
-
return
|
|
1958
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
1959
|
+
return he().wrap(function (t) {
|
|
1905
1960
|
for (;;) switch (t.prev = t.next) {
|
|
1906
1961
|
case 0:
|
|
1907
1962
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1920,8 +1975,8 @@ var Ve = Promise.resolve({
|
|
|
1920
1975
|
}));
|
|
1921
1976
|
},
|
|
1922
1977
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1923
|
-
return
|
|
1924
|
-
return
|
|
1978
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
1979
|
+
return he().wrap(function (t) {
|
|
1925
1980
|
for (;;) switch (t.prev = t.next) {
|
|
1926
1981
|
case 0:
|
|
1927
1982
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1940,8 +1995,8 @@ var Ve = Promise.resolve({
|
|
|
1940
1995
|
}
|
|
1941
1996
|
}, this.oidc = {
|
|
1942
1997
|
createConnection: function createConnection(e) {
|
|
1943
|
-
return
|
|
1944
|
-
return
|
|
1998
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
1999
|
+
return he().wrap(function (t) {
|
|
1945
2000
|
for (;;) switch (t.prev = t.next) {
|
|
1946
2001
|
case 0:
|
|
1947
2002
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1960,8 +2015,8 @@ var Ve = Promise.resolve({
|
|
|
1960
2015
|
}));
|
|
1961
2016
|
},
|
|
1962
2017
|
updateConnection: function updateConnection(e) {
|
|
1963
|
-
return
|
|
1964
|
-
return
|
|
2018
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
2019
|
+
return he().wrap(function (t) {
|
|
1965
2020
|
for (;;) switch (t.prev = t.next) {
|
|
1966
2021
|
case 0:
|
|
1967
2022
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1981,17 +2036,17 @@ var Ve = Promise.resolve({
|
|
|
1981
2036
|
}
|
|
1982
2037
|
};
|
|
1983
2038
|
}
|
|
1984
|
-
return
|
|
2039
|
+
return fe(e, [{
|
|
1985
2040
|
key: "authenticate",
|
|
1986
2041
|
value: function value(e) {
|
|
1987
|
-
return
|
|
2042
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
1988
2043
|
var r, n, i, o, s;
|
|
1989
|
-
return
|
|
2044
|
+
return he().wrap(function (t) {
|
|
1990
2045
|
for (;;) switch (t.prev = t.next) {
|
|
1991
2046
|
case 0:
|
|
1992
|
-
return
|
|
2047
|
+
return We("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();
|
|
1993
2048
|
case 3:
|
|
1994
|
-
return (r = t.sent) ||
|
|
2049
|
+
return (r = t.sent) || ze("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();
|
|
1995
2050
|
case 7:
|
|
1996
2051
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1997
2052
|
url: "/b2b/sso/authenticate",
|
|
@@ -2031,11 +2086,11 @@ var Ve = Promise.resolve({
|
|
|
2031
2086
|
}, {
|
|
2032
2087
|
key: "getBaseApiUrl",
|
|
2033
2088
|
value: function value() {
|
|
2034
|
-
return
|
|
2035
|
-
return
|
|
2089
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
2090
|
+
return he().wrap(function (e) {
|
|
2036
2091
|
for (;;) switch (e.prev = e.next) {
|
|
2037
2092
|
case 0:
|
|
2038
|
-
if (!
|
|
2093
|
+
if (!qe(this._config.publicToken)) {
|
|
2039
2094
|
e.next = 2;
|
|
2040
2095
|
break;
|
|
2041
2096
|
}
|
|
@@ -2055,9 +2110,9 @@ var Ve = Promise.resolve({
|
|
|
2055
2110
|
var t = e.connection_id,
|
|
2056
2111
|
r = e.login_redirect_url,
|
|
2057
2112
|
n = e.signup_redirect_url;
|
|
2058
|
-
return
|
|
2113
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
2059
2114
|
var i, o, s, a, c;
|
|
2060
|
-
return
|
|
2115
|
+
return he().wrap(function (e) {
|
|
2061
2116
|
for (;;) switch (e.prev = e.next) {
|
|
2062
2117
|
case 0:
|
|
2063
2118
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2086,8 +2141,8 @@ var Ve = Promise.resolve({
|
|
|
2086
2141
|
}, {
|
|
2087
2142
|
key: "getConnections",
|
|
2088
2143
|
value: function value() {
|
|
2089
|
-
return
|
|
2090
|
-
return
|
|
2144
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
2145
|
+
return he().wrap(function (e) {
|
|
2091
2146
|
for (;;) switch (e.prev = e.next) {
|
|
2092
2147
|
case 0:
|
|
2093
2148
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2107,8 +2162,8 @@ var Ve = Promise.resolve({
|
|
|
2107
2162
|
}, {
|
|
2108
2163
|
key: "deleteConnection",
|
|
2109
2164
|
value: function value(e) {
|
|
2110
|
-
return
|
|
2111
|
-
return
|
|
2165
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2166
|
+
return he().wrap(function (t) {
|
|
2112
2167
|
for (;;) switch (t.prev = t.next) {
|
|
2113
2168
|
case 0:
|
|
2114
2169
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2125,12 +2180,12 @@ var Ve = Promise.resolve({
|
|
|
2125
2180
|
}
|
|
2126
2181
|
}]), e;
|
|
2127
2182
|
}(),
|
|
2128
|
-
|
|
2183
|
+
Qe = fe(function e(t, r) {
|
|
2129
2184
|
var n = this;
|
|
2130
|
-
|
|
2131
|
-
return
|
|
2185
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2186
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
2132
2187
|
var t;
|
|
2133
|
-
return
|
|
2188
|
+
return he().wrap(function (e) {
|
|
2134
2189
|
for (;;) switch (e.prev = e.next) {
|
|
2135
2190
|
case 0:
|
|
2136
2191
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2154,9 +2209,9 @@ var Ve = Promise.resolve({
|
|
|
2154
2209
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2155
2210
|
});
|
|
2156
2211
|
}, this.update = function (e) {
|
|
2157
|
-
return
|
|
2212
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2158
2213
|
var r;
|
|
2159
|
-
return
|
|
2214
|
+
return he().wrap(function (t) {
|
|
2160
2215
|
for (;;) switch (t.prev = t.next) {
|
|
2161
2216
|
case 0:
|
|
2162
2217
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2174,9 +2229,9 @@ var Ve = Promise.resolve({
|
|
|
2174
2229
|
}, t, this);
|
|
2175
2230
|
}));
|
|
2176
2231
|
}, this["delete"] = function () {
|
|
2177
|
-
return
|
|
2232
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
2178
2233
|
var t;
|
|
2179
|
-
return
|
|
2234
|
+
return he().wrap(function (e) {
|
|
2180
2235
|
for (;;) switch (e.prev = e.next) {
|
|
2181
2236
|
case 0:
|
|
2182
2237
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2194,8 +2249,8 @@ var Ve = Promise.resolve({
|
|
|
2194
2249
|
}));
|
|
2195
2250
|
}, this.members = {
|
|
2196
2251
|
create: function create(e) {
|
|
2197
|
-
return
|
|
2198
|
-
return
|
|
2252
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2253
|
+
return he().wrap(function (t) {
|
|
2199
2254
|
for (;;) switch (t.prev = t.next) {
|
|
2200
2255
|
case 0:
|
|
2201
2256
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2212,8 +2267,8 @@ var Ve = Promise.resolve({
|
|
|
2212
2267
|
}));
|
|
2213
2268
|
},
|
|
2214
2269
|
search: function search(e) {
|
|
2215
|
-
return
|
|
2216
|
-
return
|
|
2270
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2271
|
+
return he().wrap(function (t) {
|
|
2217
2272
|
for (;;) switch (t.prev = t.next) {
|
|
2218
2273
|
case 0:
|
|
2219
2274
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2230,8 +2285,8 @@ var Ve = Promise.resolve({
|
|
|
2230
2285
|
}));
|
|
2231
2286
|
},
|
|
2232
2287
|
update: function update(e) {
|
|
2233
|
-
return
|
|
2234
|
-
return
|
|
2288
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2289
|
+
return he().wrap(function (t) {
|
|
2235
2290
|
for (;;) switch (t.prev = t.next) {
|
|
2236
2291
|
case 0:
|
|
2237
2292
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2248,8 +2303,8 @@ var Ve = Promise.resolve({
|
|
|
2248
2303
|
}));
|
|
2249
2304
|
},
|
|
2250
2305
|
deletePassword: function deletePassword(e) {
|
|
2251
|
-
return
|
|
2252
|
-
return
|
|
2306
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2307
|
+
return he().wrap(function (t) {
|
|
2253
2308
|
for (;;) switch (t.prev = t.next) {
|
|
2254
2309
|
case 0:
|
|
2255
2310
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2265,8 +2320,8 @@ var Ve = Promise.resolve({
|
|
|
2265
2320
|
}));
|
|
2266
2321
|
},
|
|
2267
2322
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2268
|
-
return
|
|
2269
|
-
return
|
|
2323
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2324
|
+
return he().wrap(function (t) {
|
|
2270
2325
|
for (;;) switch (t.prev = t.next) {
|
|
2271
2326
|
case 0:
|
|
2272
2327
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2282,8 +2337,8 @@ var Ve = Promise.resolve({
|
|
|
2282
2337
|
}));
|
|
2283
2338
|
},
|
|
2284
2339
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2285
|
-
return
|
|
2286
|
-
return
|
|
2340
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2341
|
+
return he().wrap(function (t) {
|
|
2287
2342
|
for (;;) switch (t.prev = t.next) {
|
|
2288
2343
|
case 0:
|
|
2289
2344
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2299,8 +2354,8 @@ var Ve = Promise.resolve({
|
|
|
2299
2354
|
}));
|
|
2300
2355
|
},
|
|
2301
2356
|
"delete": function _delete(e) {
|
|
2302
|
-
return
|
|
2303
|
-
return
|
|
2357
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2358
|
+
return he().wrap(function (t) {
|
|
2304
2359
|
for (;;) switch (t.prev = t.next) {
|
|
2305
2360
|
case 0:
|
|
2306
2361
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2316,8 +2371,8 @@ var Ve = Promise.resolve({
|
|
|
2316
2371
|
}));
|
|
2317
2372
|
},
|
|
2318
2373
|
reactivate: function reactivate(e) {
|
|
2319
|
-
return
|
|
2320
|
-
return
|
|
2374
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2375
|
+
return he().wrap(function (t) {
|
|
2321
2376
|
for (;;) switch (t.prev = t.next) {
|
|
2322
2377
|
case 0:
|
|
2323
2378
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2334,18 +2389,18 @@ var Ve = Promise.resolve({
|
|
|
2334
2389
|
}
|
|
2335
2390
|
};
|
|
2336
2391
|
}),
|
|
2337
|
-
|
|
2392
|
+
et = function () {
|
|
2338
2393
|
function e(t, r, n, i, o) {
|
|
2339
2394
|
var s = this,
|
|
2340
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2341
|
-
|
|
2395
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
2396
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2342
2397
|
authenticate: function authenticate(e) {
|
|
2343
|
-
return
|
|
2398
|
+
return Se(s, void 0, void 0, he().mark(function t() {
|
|
2344
2399
|
var r, n, i, o, s, a;
|
|
2345
|
-
return
|
|
2400
|
+
return he().wrap(function (t) {
|
|
2346
2401
|
for (;;) switch (t.prev = t.next) {
|
|
2347
2402
|
case 0:
|
|
2348
|
-
return
|
|
2403
|
+
return We("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2349
2404
|
case 3:
|
|
2350
2405
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2351
2406
|
case 6:
|
|
@@ -2375,28 +2430,28 @@ var Ve = Promise.resolve({
|
|
|
2375
2430
|
}));
|
|
2376
2431
|
}
|
|
2377
2432
|
}, this.google = {
|
|
2378
|
-
start: this.startOAuthFlow(
|
|
2433
|
+
start: this.startOAuthFlow(y.Google),
|
|
2379
2434
|
discovery: {
|
|
2380
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2435
|
+
start: this.startDiscoveryOAuthFlow(y.Google)
|
|
2381
2436
|
}
|
|
2382
2437
|
}, this.microsoft = {
|
|
2383
|
-
start: this.startOAuthFlow(
|
|
2438
|
+
start: this.startOAuthFlow(y.Microsoft),
|
|
2384
2439
|
discovery: {
|
|
2385
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2440
|
+
start: this.startDiscoveryOAuthFlow(y.Microsoft)
|
|
2386
2441
|
}
|
|
2387
2442
|
};
|
|
2388
2443
|
}
|
|
2389
|
-
return
|
|
2444
|
+
return fe(e, [{
|
|
2390
2445
|
key: "authenticate",
|
|
2391
2446
|
value: function value(e) {
|
|
2392
|
-
return
|
|
2447
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2393
2448
|
var r, n, i, o, s;
|
|
2394
|
-
return
|
|
2449
|
+
return he().wrap(function (t) {
|
|
2395
2450
|
for (;;) switch (t.prev = t.next) {
|
|
2396
2451
|
case 0:
|
|
2397
|
-
return
|
|
2452
|
+
return We("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();
|
|
2398
2453
|
case 3:
|
|
2399
|
-
return (r = t.sent) ||
|
|
2454
|
+
return (r = t.sent) || ze("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();
|
|
2400
2455
|
case 7:
|
|
2401
2456
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2402
2457
|
url: "/b2b/oauth/authenticate",
|
|
@@ -2435,9 +2490,9 @@ var Ve = Promise.resolve({
|
|
|
2435
2490
|
}, {
|
|
2436
2491
|
key: "getBaseApiUrl",
|
|
2437
2492
|
value: function value() {
|
|
2438
|
-
return
|
|
2493
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
2439
2494
|
var t, r;
|
|
2440
|
-
return
|
|
2495
|
+
return he().wrap(function (e) {
|
|
2441
2496
|
for (;;) switch (e.prev = e.next) {
|
|
2442
2497
|
case 0:
|
|
2443
2498
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2448,7 +2503,7 @@ var Ve = Promise.resolve({
|
|
|
2448
2503
|
}
|
|
2449
2504
|
return e.abrupt("return", "https://".concat(r));
|
|
2450
2505
|
case 6:
|
|
2451
|
-
if (!
|
|
2506
|
+
if (!qe(this._config.publicToken)) {
|
|
2452
2507
|
e.next = 8;
|
|
2453
2508
|
break;
|
|
2454
2509
|
}
|
|
@@ -2473,16 +2528,16 @@ var Ve = Promise.resolve({
|
|
|
2473
2528
|
s = r.signup_redirect_url,
|
|
2474
2529
|
a = r.custom_scopes,
|
|
2475
2530
|
c = r.provider_params;
|
|
2476
|
-
return
|
|
2531
|
+
return Se(t, void 0, void 0, he().mark(function t() {
|
|
2477
2532
|
var r, u, l, d, h, p;
|
|
2478
|
-
return
|
|
2533
|
+
return he().wrap(function (t) {
|
|
2479
2534
|
for (;;) switch (t.prev = t.next) {
|
|
2480
2535
|
case 0:
|
|
2481
2536
|
return t.next = 2, this._dynamicConfig;
|
|
2482
2537
|
case 2:
|
|
2483
2538
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2484
2539
|
case 6:
|
|
2485
|
-
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 && (
|
|
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 && (We("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in We("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2486
2541
|
if (!u) {
|
|
2487
2542
|
t.next = 20;
|
|
2488
2543
|
break;
|
|
@@ -2511,16 +2566,16 @@ var Ve = Promise.resolve({
|
|
|
2511
2566
|
var n = r.discovery_redirect_url,
|
|
2512
2567
|
i = r.custom_scopes,
|
|
2513
2568
|
o = r.provider_params;
|
|
2514
|
-
return
|
|
2569
|
+
return Se(t, void 0, void 0, he().mark(function t() {
|
|
2515
2570
|
var r, s, a, c, u, l;
|
|
2516
|
-
return
|
|
2571
|
+
return he().wrap(function (t) {
|
|
2517
2572
|
for (;;) switch (t.prev = t.next) {
|
|
2518
2573
|
case 0:
|
|
2519
2574
|
return t.next = 2, this._dynamicConfig;
|
|
2520
2575
|
case 2:
|
|
2521
2576
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2522
2577
|
case 6:
|
|
2523
|
-
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 && (
|
|
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 && (We("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in We("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2524
2579
|
if (!s) {
|
|
2525
2580
|
t.next = 18;
|
|
2526
2581
|
break;
|
|
@@ -2543,10 +2598,10 @@ var Ve = Promise.resolve({
|
|
|
2543
2598
|
}
|
|
2544
2599
|
}]), e;
|
|
2545
2600
|
}(),
|
|
2546
|
-
|
|
2601
|
+
tt = function () {
|
|
2547
2602
|
function e(t, r) {
|
|
2548
2603
|
var n = this;
|
|
2549
|
-
|
|
2604
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2550
2605
|
return n._subscriptionService.getSession();
|
|
2551
2606
|
}, this.onChange = function (e) {
|
|
2552
2607
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -2554,9 +2609,9 @@ var Ve = Promise.resolve({
|
|
|
2554
2609
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2555
2610
|
});
|
|
2556
2611
|
}, this.revoke = function (e) {
|
|
2557
|
-
return
|
|
2612
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2558
2613
|
var r;
|
|
2559
|
-
return
|
|
2614
|
+
return he().wrap(function (t) {
|
|
2560
2615
|
for (;;) switch (t.prev = t.next) {
|
|
2561
2616
|
case 0:
|
|
2562
2617
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2567,7 +2622,7 @@ var Ve = Promise.resolve({
|
|
|
2567
2622
|
case 3:
|
|
2568
2623
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2569
2624
|
case 8:
|
|
2570
|
-
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) || T.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2571
2626
|
case 12:
|
|
2572
2627
|
case "end":
|
|
2573
2628
|
return t.stop();
|
|
@@ -2575,13 +2630,13 @@ var Ve = Promise.resolve({
|
|
|
2575
2630
|
}, t, this, [[0, 8]]);
|
|
2576
2631
|
}));
|
|
2577
2632
|
}, this.authenticate = function (e) {
|
|
2578
|
-
return
|
|
2633
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2579
2634
|
var r,
|
|
2580
2635
|
n,
|
|
2581
2636
|
i,
|
|
2582
2637
|
o,
|
|
2583
2638
|
s = this;
|
|
2584
|
-
return
|
|
2639
|
+
return he().wrap(function (t) {
|
|
2585
2640
|
for (;;) switch (t.prev = t.next) {
|
|
2586
2641
|
case 0:
|
|
2587
2642
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2619,7 +2674,7 @@ var Ve = Promise.resolve({
|
|
|
2619
2674
|
}
|
|
2620
2675
|
return t.abrupt("return", this.authenticate(e));
|
|
2621
2676
|
case 17:
|
|
2622
|
-
throw
|
|
2677
|
+
throw T.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2623
2678
|
case 19:
|
|
2624
2679
|
case "end":
|
|
2625
2680
|
return t.stop();
|
|
@@ -2627,12 +2682,12 @@ var Ve = Promise.resolve({
|
|
|
2627
2682
|
}, t, this, [[2, 13]]);
|
|
2628
2683
|
}));
|
|
2629
2684
|
}, this.exchange = function (e) {
|
|
2630
|
-
return
|
|
2685
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2631
2686
|
var r;
|
|
2632
|
-
return
|
|
2687
|
+
return he().wrap(function (t) {
|
|
2633
2688
|
for (;;) switch (t.prev = t.next) {
|
|
2634
2689
|
case 0:
|
|
2635
|
-
return
|
|
2690
|
+
return We("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({
|
|
2636
2691
|
url: "/b2b/sessions/exchange",
|
|
2637
2692
|
body: e,
|
|
2638
2693
|
errorMessage: "Failed to exchange session",
|
|
@@ -2664,19 +2719,19 @@ var Ve = Promise.resolve({
|
|
|
2664
2719
|
}));
|
|
2665
2720
|
};
|
|
2666
2721
|
}
|
|
2667
|
-
return
|
|
2722
|
+
return fe(e, [{
|
|
2668
2723
|
key: "getTokens",
|
|
2669
2724
|
value: function value() {
|
|
2670
2725
|
return this._subscriptionService.getTokens();
|
|
2671
2726
|
}
|
|
2672
2727
|
}]), e;
|
|
2673
2728
|
}(),
|
|
2674
|
-
|
|
2729
|
+
rt = fe(function e(t, r) {
|
|
2675
2730
|
var n = this;
|
|
2676
|
-
|
|
2731
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2677
2732
|
list: function list() {
|
|
2678
|
-
return
|
|
2679
|
-
return
|
|
2733
|
+
return Se(n, void 0, void 0, he().mark(function e() {
|
|
2734
|
+
return he().wrap(function (e) {
|
|
2680
2735
|
for (;;) switch (e.prev = e.next) {
|
|
2681
2736
|
case 0:
|
|
2682
2737
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2703,12 +2758,12 @@ var Ve = Promise.resolve({
|
|
|
2703
2758
|
}));
|
|
2704
2759
|
},
|
|
2705
2760
|
create: function create(e) {
|
|
2706
|
-
return
|
|
2761
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2707
2762
|
var r, n;
|
|
2708
|
-
return
|
|
2763
|
+
return he().wrap(function (t) {
|
|
2709
2764
|
for (;;) switch (t.prev = t.next) {
|
|
2710
2765
|
case 0:
|
|
2711
|
-
return
|
|
2766
|
+
return We("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();
|
|
2712
2767
|
case 5:
|
|
2713
2768
|
if (t.t2 = t.sent, t.t2) {
|
|
2714
2769
|
t.next = 8;
|
|
@@ -2749,12 +2804,12 @@ var Ve = Promise.resolve({
|
|
|
2749
2804
|
}
|
|
2750
2805
|
}, this.intermediateSessions = {
|
|
2751
2806
|
exchange: function exchange(e) {
|
|
2752
|
-
return
|
|
2807
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
2753
2808
|
var r, n;
|
|
2754
|
-
return
|
|
2809
|
+
return he().wrap(function (t) {
|
|
2755
2810
|
for (;;) switch (t.prev = t.next) {
|
|
2756
2811
|
case 0:
|
|
2757
|
-
return
|
|
2812
|
+
return We("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();
|
|
2758
2813
|
case 5:
|
|
2759
2814
|
if (t.t2 = t.sent, t.t2) {
|
|
2760
2815
|
t.next = 8;
|
|
@@ -2795,21 +2850,21 @@ var Ve = Promise.resolve({
|
|
|
2795
2850
|
}
|
|
2796
2851
|
};
|
|
2797
2852
|
}),
|
|
2798
|
-
|
|
2853
|
+
nt = Promise.resolve({
|
|
2799
2854
|
pkceRequiredForPasswordResets: !1
|
|
2800
2855
|
}),
|
|
2801
|
-
|
|
2856
|
+
it = function () {
|
|
2802
2857
|
function e(t, r, n) {
|
|
2803
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2804
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2805
|
-
|
|
2858
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : nt,
|
|
2859
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ge();
|
|
2860
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2806
2861
|
}
|
|
2807
|
-
return
|
|
2862
|
+
return fe(e, [{
|
|
2808
2863
|
key: "getCodeChallenge",
|
|
2809
2864
|
value: function value() {
|
|
2810
|
-
return
|
|
2865
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
2811
2866
|
var t, r;
|
|
2812
|
-
return
|
|
2867
|
+
return he().wrap(function (e) {
|
|
2813
2868
|
for (;;) switch (e.prev = e.next) {
|
|
2814
2869
|
case 0:
|
|
2815
2870
|
return e.next = 2, this._config;
|
|
@@ -2841,12 +2896,12 @@ var Ve = Promise.resolve({
|
|
|
2841
2896
|
}, {
|
|
2842
2897
|
key: "authenticate",
|
|
2843
2898
|
value: function value(e) {
|
|
2844
|
-
return
|
|
2899
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2845
2900
|
var r, n, i, o, s, a;
|
|
2846
|
-
return
|
|
2901
|
+
return he().wrap(function (t) {
|
|
2847
2902
|
for (;;) switch (t.prev = t.next) {
|
|
2848
2903
|
case 0:
|
|
2849
|
-
return
|
|
2904
|
+
return We("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2850
2905
|
case 3:
|
|
2851
2906
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2852
2907
|
case 7:
|
|
@@ -2892,12 +2947,12 @@ var Ve = Promise.resolve({
|
|
|
2892
2947
|
}, {
|
|
2893
2948
|
key: "resetByEmailStart",
|
|
2894
2949
|
value: function value(e) {
|
|
2895
|
-
return
|
|
2950
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2896
2951
|
var r, n, i, o;
|
|
2897
|
-
return
|
|
2952
|
+
return he().wrap(function (t) {
|
|
2898
2953
|
for (;;) switch (t.prev = t.next) {
|
|
2899
2954
|
case 0:
|
|
2900
|
-
return
|
|
2955
|
+
return We("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
2901
2956
|
case 3:
|
|
2902
2957
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2903
2958
|
case 6:
|
|
@@ -2928,12 +2983,12 @@ var Ve = Promise.resolve({
|
|
|
2928
2983
|
}, {
|
|
2929
2984
|
key: "resetByEmail",
|
|
2930
2985
|
value: function value(e) {
|
|
2931
|
-
return
|
|
2986
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2932
2987
|
var r, n, i, o, s, a;
|
|
2933
|
-
return
|
|
2988
|
+
return he().wrap(function (t) {
|
|
2934
2989
|
for (;;) switch (t.prev = t.next) {
|
|
2935
2990
|
case 0:
|
|
2936
|
-
return
|
|
2991
|
+
return We("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2937
2992
|
case 3:
|
|
2938
2993
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2939
2994
|
case 8:
|
|
@@ -2978,12 +3033,12 @@ var Ve = Promise.resolve({
|
|
|
2978
3033
|
}, {
|
|
2979
3034
|
key: "resetByExistingPassword",
|
|
2980
3035
|
value: function value(e) {
|
|
2981
|
-
return
|
|
3036
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
2982
3037
|
var r, n, i, o;
|
|
2983
|
-
return
|
|
3038
|
+
return he().wrap(function (t) {
|
|
2984
3039
|
for (;;) switch (t.prev = t.next) {
|
|
2985
3040
|
case 0:
|
|
2986
|
-
return
|
|
3041
|
+
return We("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2987
3042
|
case 3:
|
|
2988
3043
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2989
3044
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -3027,12 +3082,12 @@ var Ve = Promise.resolve({
|
|
|
3027
3082
|
}, {
|
|
3028
3083
|
key: "resetBySession",
|
|
3029
3084
|
value: function value(e) {
|
|
3030
|
-
return
|
|
3085
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
3031
3086
|
var r, n, i, o;
|
|
3032
|
-
return
|
|
3087
|
+
return he().wrap(function (t) {
|
|
3033
3088
|
for (;;) switch (t.prev = t.next) {
|
|
3034
3089
|
case 0:
|
|
3035
|
-
return
|
|
3090
|
+
return We("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3036
3091
|
case 3:
|
|
3037
3092
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3038
3093
|
url: "/b2b/passwords/session/reset",
|
|
@@ -3066,11 +3121,11 @@ var Ve = Promise.resolve({
|
|
|
3066
3121
|
}, {
|
|
3067
3122
|
key: "strengthCheck",
|
|
3068
3123
|
value: function value(e) {
|
|
3069
|
-
return
|
|
3070
|
-
return
|
|
3124
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
3125
|
+
return he().wrap(function (t) {
|
|
3071
3126
|
for (;;) switch (t.prev = t.next) {
|
|
3072
3127
|
case 0:
|
|
3073
|
-
return
|
|
3128
|
+
return We("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3074
3129
|
url: "/b2b/passwords/strength_check",
|
|
3075
3130
|
method: "POST",
|
|
3076
3131
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3088,17 +3143,17 @@ var Ve = Promise.resolve({
|
|
|
3088
3143
|
}
|
|
3089
3144
|
}]), e;
|
|
3090
3145
|
}(),
|
|
3091
|
-
|
|
3146
|
+
ot = fe(function e(t, r) {
|
|
3092
3147
|
var n = this,
|
|
3093
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3094
|
-
|
|
3148
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
3149
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3095
3150
|
send: function send(e) {
|
|
3096
|
-
return
|
|
3151
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
3097
3152
|
var r, n, i;
|
|
3098
|
-
return
|
|
3153
|
+
return he().wrap(function (t) {
|
|
3099
3154
|
for (;;) switch (t.prev = t.next) {
|
|
3100
3155
|
case 0:
|
|
3101
|
-
return
|
|
3156
|
+
return We("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();
|
|
3102
3157
|
case 3:
|
|
3103
3158
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3104
3159
|
case 13:
|
|
@@ -3127,12 +3182,12 @@ var Ve = Promise.resolve({
|
|
|
3127
3182
|
}));
|
|
3128
3183
|
},
|
|
3129
3184
|
authenticate: function authenticate(e) {
|
|
3130
|
-
return
|
|
3185
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
3131
3186
|
var r, n, i, o, s;
|
|
3132
|
-
return
|
|
3187
|
+
return he().wrap(function (t) {
|
|
3133
3188
|
for (;;) switch (t.prev = t.next) {
|
|
3134
3189
|
case 0:
|
|
3135
|
-
return
|
|
3190
|
+
return We("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();
|
|
3136
3191
|
case 3:
|
|
3137
3192
|
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();
|
|
3138
3193
|
case 12:
|
|
@@ -3173,20 +3228,20 @@ var Ve = Promise.resolve({
|
|
|
3173
3228
|
}
|
|
3174
3229
|
};
|
|
3175
3230
|
}),
|
|
3176
|
-
|
|
3231
|
+
st = function () {
|
|
3177
3232
|
function e(t, r) {
|
|
3178
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3179
|
-
|
|
3233
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
3234
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3180
3235
|
}
|
|
3181
|
-
return
|
|
3236
|
+
return fe(e, [{
|
|
3182
3237
|
key: "create",
|
|
3183
3238
|
value: function value(e) {
|
|
3184
|
-
return
|
|
3239
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
3185
3240
|
var r, n, i;
|
|
3186
|
-
return
|
|
3241
|
+
return he().wrap(function (t) {
|
|
3187
3242
|
for (;;) switch (t.prev = t.next) {
|
|
3188
3243
|
case 0:
|
|
3189
|
-
return
|
|
3244
|
+
return We("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();
|
|
3190
3245
|
case 3:
|
|
3191
3246
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3192
3247
|
case 13:
|
|
@@ -3217,12 +3272,12 @@ var Ve = Promise.resolve({
|
|
|
3217
3272
|
}, {
|
|
3218
3273
|
key: "authenticate",
|
|
3219
3274
|
value: function value(e) {
|
|
3220
|
-
return
|
|
3275
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
3221
3276
|
var r, n, i, o, s;
|
|
3222
|
-
return
|
|
3277
|
+
return he().wrap(function (t) {
|
|
3223
3278
|
for (;;) switch (t.prev = t.next) {
|
|
3224
3279
|
case 0:
|
|
3225
|
-
return
|
|
3280
|
+
return We("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();
|
|
3226
3281
|
case 3:
|
|
3227
3282
|
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();
|
|
3228
3283
|
case 12:
|
|
@@ -3263,20 +3318,20 @@ var Ve = Promise.resolve({
|
|
|
3263
3318
|
}
|
|
3264
3319
|
}]), e;
|
|
3265
3320
|
}(),
|
|
3266
|
-
|
|
3321
|
+
at = function () {
|
|
3267
3322
|
function e(t, r) {
|
|
3268
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3269
|
-
|
|
3323
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
3324
|
+
me(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3270
3325
|
}
|
|
3271
|
-
return
|
|
3326
|
+
return fe(e, [{
|
|
3272
3327
|
key: "recover",
|
|
3273
3328
|
value: function value(e) {
|
|
3274
|
-
return
|
|
3329
|
+
return Se(this, void 0, void 0, he().mark(function t() {
|
|
3275
3330
|
var r, n, i, o, s;
|
|
3276
|
-
return
|
|
3331
|
+
return he().wrap(function (t) {
|
|
3277
3332
|
for (;;) switch (t.prev = t.next) {
|
|
3278
3333
|
case 0:
|
|
3279
|
-
return
|
|
3334
|
+
return We("stytch.recoveryCodes.recover").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3280
3335
|
case 3:
|
|
3281
3336
|
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();
|
|
3282
3337
|
case 12:
|
|
@@ -3318,9 +3373,9 @@ var Ve = Promise.resolve({
|
|
|
3318
3373
|
}, {
|
|
3319
3374
|
key: "rotate",
|
|
3320
3375
|
value: function value() {
|
|
3321
|
-
return
|
|
3376
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
3322
3377
|
var t, r, n;
|
|
3323
|
-
return
|
|
3378
|
+
return he().wrap(function (e) {
|
|
3324
3379
|
for (;;) switch (e.prev = e.next) {
|
|
3325
3380
|
case 0:
|
|
3326
3381
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3345,8 +3400,8 @@ var Ve = Promise.resolve({
|
|
|
3345
3400
|
}, {
|
|
3346
3401
|
key: "get",
|
|
3347
3402
|
value: function value() {
|
|
3348
|
-
return
|
|
3349
|
-
return
|
|
3403
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
3404
|
+
return he().wrap(function (e) {
|
|
3350
3405
|
for (;;) switch (e.prev = e.next) {
|
|
3351
3406
|
case 0:
|
|
3352
3407
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3363,21 +3418,21 @@ var Ve = Promise.resolve({
|
|
|
3363
3418
|
}
|
|
3364
3419
|
}]), e;
|
|
3365
3420
|
}(),
|
|
3366
|
-
|
|
3421
|
+
ct = function () {
|
|
3367
3422
|
function e(t, r, n) {
|
|
3368
3423
|
var i = this;
|
|
3369
|
-
|
|
3424
|
+
me(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3370
3425
|
var r;
|
|
3371
3426
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3372
3427
|
}, this.isAuthorized = function (e, t) {
|
|
3373
3428
|
return i.policyPromise.then(function (r) {
|
|
3374
3429
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3375
3430
|
});
|
|
3376
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3377
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3431
|
+
}, this.cachedPolicy = t.rbacPolicy ? dt.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3432
|
+
return e.rbacPolicy ? (i.cachedPolicy = dt.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ne("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new dt([], []));
|
|
3378
3433
|
});
|
|
3379
3434
|
}
|
|
3380
|
-
return
|
|
3435
|
+
return fe(e, [{
|
|
3381
3436
|
key: "allPermissions",
|
|
3382
3437
|
value: function value() {
|
|
3383
3438
|
var e = this;
|
|
@@ -3394,15 +3449,64 @@ var Ve = Promise.resolve({
|
|
|
3394
3449
|
}
|
|
3395
3450
|
}]), e;
|
|
3396
3451
|
}(),
|
|
3397
|
-
|
|
3452
|
+
ut = function () {
|
|
3453
|
+
function e(t) {
|
|
3454
|
+
me(this, e), this.iframeURL = t, this.createIframe();
|
|
3455
|
+
}
|
|
3456
|
+
return fe(e, [{
|
|
3457
|
+
key: "createIframe",
|
|
3458
|
+
value: function value() {
|
|
3459
|
+
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3460
|
+
e ? ze("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.") : ((e = document.createElement("iframe")).src = this.iframeURL, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e)), "true" !== e.dataset.loaded ? this.frame = new Promise(function (t) {
|
|
3461
|
+
e.addEventListener("load", function () {
|
|
3462
|
+
e.dataset.loaded = "true", t(e);
|
|
3463
|
+
}, {
|
|
3464
|
+
once: !0
|
|
3465
|
+
});
|
|
3466
|
+
}) : this.frame = Promise.resolve(e);
|
|
3467
|
+
}
|
|
3468
|
+
}, {
|
|
3469
|
+
key: "call",
|
|
3470
|
+
value: function value(e, t) {
|
|
3471
|
+
return Se(this, void 0, void 0, he().mark(function r() {
|
|
3472
|
+
var n,
|
|
3473
|
+
i,
|
|
3474
|
+
o = this;
|
|
3475
|
+
return he().wrap(function (r) {
|
|
3476
|
+
for (;;) switch (r.prev = r.next) {
|
|
3477
|
+
case 0:
|
|
3478
|
+
return r.next = 2, this.frame;
|
|
3479
|
+
case 2:
|
|
3480
|
+
return n = r.sent, i = new MessageChannel(), r.abrupt("return", new Promise(function (r, s) {
|
|
3481
|
+
var a;
|
|
3482
|
+
i.port1.onmessage = function (e) {
|
|
3483
|
+
var t = e.data;
|
|
3484
|
+
i.port1.close(), t.success ? r(t.payload) : s(Ve.unmarshall(t.error));
|
|
3485
|
+
};
|
|
3486
|
+
var c = {
|
|
3487
|
+
method: e,
|
|
3488
|
+
args: t
|
|
3489
|
+
};
|
|
3490
|
+
null === (a = n.contentWindow) || void 0 === a || a.postMessage(c, o.iframeURL, [i.port2]);
|
|
3491
|
+
}));
|
|
3492
|
+
case 5:
|
|
3493
|
+
case "end":
|
|
3494
|
+
return r.stop();
|
|
3495
|
+
}
|
|
3496
|
+
}, r, this);
|
|
3497
|
+
}));
|
|
3498
|
+
}
|
|
3499
|
+
}]), e;
|
|
3500
|
+
}(),
|
|
3501
|
+
lt = function () {
|
|
3398
3502
|
function e(t, r) {
|
|
3399
3503
|
var n = this;
|
|
3400
|
-
|
|
3504
|
+
me(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3401
3505
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3402
3506
|
}, this._reauthenticateWithBackoff = function () {
|
|
3403
|
-
return
|
|
3507
|
+
return Se(n, void 0, void 0, he().mark(function t() {
|
|
3404
3508
|
var r;
|
|
3405
|
-
return
|
|
3509
|
+
return he().wrap(function (t) {
|
|
3406
3510
|
for (;;) switch (t.prev = t.next) {
|
|
3407
3511
|
case 0:
|
|
3408
3512
|
r = 0;
|
|
@@ -3431,14 +3535,14 @@ var Ve = Promise.resolve({
|
|
|
3431
3535
|
}));
|
|
3432
3536
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3433
3537
|
}
|
|
3434
|
-
return
|
|
3538
|
+
return fe(e, [{
|
|
3435
3539
|
key: "performBackgroundRefresh",
|
|
3436
3540
|
value: function value() {
|
|
3437
3541
|
var e = this;
|
|
3438
3542
|
this._reauthenticateWithBackoff().then(function () {
|
|
3439
3543
|
e.scheduleBackgroundRefresh();
|
|
3440
3544
|
})["catch"](function (t) {
|
|
3441
|
-
|
|
3545
|
+
ze("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3442
3546
|
error: t
|
|
3443
3547
|
}), e._subscriptionService.destroySession();
|
|
3444
3548
|
});
|
|
@@ -3464,19 +3568,19 @@ var Ve = Promise.resolve({
|
|
|
3464
3568
|
}, {
|
|
3465
3569
|
key: "isUnrecoverableError",
|
|
3466
3570
|
value: function value(e) {
|
|
3467
|
-
return
|
|
3571
|
+
return T.includes(e.error_type);
|
|
3468
3572
|
}
|
|
3469
3573
|
}]), e;
|
|
3470
3574
|
}();
|
|
3471
|
-
|
|
3472
|
-
var
|
|
3575
|
+
lt.REFRESH_INTERVAL_MS = 18e4;
|
|
3576
|
+
var dt = function () {
|
|
3473
3577
|
function e(t, r) {
|
|
3474
3578
|
var n = this;
|
|
3475
|
-
|
|
3579
|
+
me(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3476
3580
|
return n.rolesByID[e.role_id] = e;
|
|
3477
3581
|
});
|
|
3478
3582
|
}
|
|
3479
|
-
return
|
|
3583
|
+
return fe(e, [{
|
|
3480
3584
|
key: "callerIsAuthorized",
|
|
3481
3585
|
value: function value(e, t, r) {
|
|
3482
3586
|
var n = this;
|
|
@@ -3510,19 +3614,19 @@ var ct = function () {
|
|
|
3510
3614
|
}
|
|
3511
3615
|
}]), e;
|
|
3512
3616
|
}();
|
|
3513
|
-
var
|
|
3514
|
-
var
|
|
3515
|
-
function
|
|
3617
|
+
var ht = "bootstrap";
|
|
3618
|
+
var pt = /*#__PURE__*/function () {
|
|
3619
|
+
function pt(e, t, r) {
|
|
3516
3620
|
var _this = this;
|
|
3517
|
-
_classCallCheck(this,
|
|
3621
|
+
_classCallCheck(this, pt);
|
|
3518
3622
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3519
3623
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3520
3624
|
method: "GET",
|
|
3521
3625
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3522
|
-
}).then(
|
|
3523
|
-
return _this._dataLayer.setItem(
|
|
3626
|
+
}).then(pt.mapBootstrapData).then(function (e) {
|
|
3627
|
+
return _this._dataLayer.setItem(ht, JSON.stringify(e)), e;
|
|
3524
3628
|
})["catch"](function (e) {
|
|
3525
|
-
return
|
|
3629
|
+
return Ne(e), {
|
|
3526
3630
|
displayWatermark: !1,
|
|
3527
3631
|
cnameDomain: null,
|
|
3528
3632
|
emailDomains: ["stytch.com"],
|
|
@@ -3541,10 +3645,10 @@ var lt = /*#__PURE__*/function () {
|
|
|
3541
3645
|
};
|
|
3542
3646
|
});
|
|
3543
3647
|
}
|
|
3544
|
-
_createClass(
|
|
3648
|
+
_createClass(pt, [{
|
|
3545
3649
|
key: "getSync",
|
|
3546
3650
|
value: function getSync() {
|
|
3547
|
-
var e = this._dataLayer.getItem(
|
|
3651
|
+
var e = this._dataLayer.getItem(ht);
|
|
3548
3652
|
if (null === e) return {
|
|
3549
3653
|
displayWatermark: !1,
|
|
3550
3654
|
cnameDomain: null,
|
|
@@ -3615,9 +3719,9 @@ var lt = /*#__PURE__*/function () {
|
|
|
3615
3719
|
};
|
|
3616
3720
|
}
|
|
3617
3721
|
}]);
|
|
3618
|
-
return
|
|
3722
|
+
return pt;
|
|
3619
3723
|
}();
|
|
3620
|
-
function
|
|
3724
|
+
function ft(e, t, r, n) {
|
|
3621
3725
|
return new (r || (r = Promise))(function (i, o) {
|
|
3622
3726
|
function s(e) {
|
|
3623
3727
|
try {
|
|
@@ -3643,11 +3747,11 @@ function dt(e, t, r, n) {
|
|
|
3643
3747
|
});
|
|
3644
3748
|
}
|
|
3645
3749
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3646
|
-
var
|
|
3750
|
+
var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
3647
3751
|
var _this2 = this;
|
|
3648
|
-
_classCallCheck(this,
|
|
3752
|
+
_classCallCheck(this, _t);
|
|
3649
3753
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3650
|
-
return
|
|
3754
|
+
return ft(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3651
3755
|
var _yield$this$state, e, t, r;
|
|
3652
3756
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3653
3757
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3678,7 +3782,7 @@ var ht = /*#__PURE__*/_createClass(function ht(e) {
|
|
|
3678
3782
|
}, _callee, this);
|
|
3679
3783
|
}));
|
|
3680
3784
|
}, this.state = e.then(function (e) {
|
|
3681
|
-
return
|
|
3785
|
+
return ft(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3682
3786
|
var t;
|
|
3683
3787
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3684
3788
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3716,18 +3820,44 @@ var ht = /*#__PURE__*/_createClass(function ht(e) {
|
|
|
3716
3820
|
}));
|
|
3717
3821
|
});
|
|
3718
3822
|
});
|
|
3719
|
-
var
|
|
3720
|
-
function
|
|
3721
|
-
|
|
3823
|
+
var mt = /*#__PURE__*/function () {
|
|
3824
|
+
function mt(e) {
|
|
3825
|
+
var _this3 = this;
|
|
3826
|
+
_classCallCheck(this, mt);
|
|
3827
|
+
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3828
|
+
return _this3.call("oneTapStart", e);
|
|
3829
|
+
}, this.oneTapSubmit = function (e) {
|
|
3830
|
+
return _this3.call("oneTapSubmit", e);
|
|
3831
|
+
}, this.parsedPhoneNumber = function (e) {
|
|
3832
|
+
return _this3.call("parsedPhoneNumber", e);
|
|
3833
|
+
};
|
|
3834
|
+
}
|
|
3835
|
+
_createClass(mt, [{
|
|
3836
|
+
key: "frameClient",
|
|
3837
|
+
get: function get() {
|
|
3838
|
+
var e;
|
|
3839
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new ut(this.iframeURL), this._frameClient;
|
|
3840
|
+
}
|
|
3841
|
+
}, {
|
|
3842
|
+
key: "call",
|
|
3843
|
+
value: function call(e, t) {
|
|
3844
|
+
return this.frameClient.call(e, [t]);
|
|
3845
|
+
}
|
|
3846
|
+
}]);
|
|
3847
|
+
return mt;
|
|
3848
|
+
}();
|
|
3849
|
+
var vt = /*#__PURE__*/function () {
|
|
3850
|
+
function vt(e, t, r, n) {
|
|
3851
|
+
_classCallCheck(this, vt);
|
|
3722
3852
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3723
3853
|
return null;
|
|
3724
|
-
}, this.eventLogger = new
|
|
3854
|
+
}, this.eventLogger = new Ye({
|
|
3725
3855
|
maxBatchSize: 15,
|
|
3726
3856
|
intervalDurationMs: 800,
|
|
3727
3857
|
logEventURL: this.buildSDKUrl("/events")
|
|
3728
3858
|
});
|
|
3729
3859
|
}
|
|
3730
|
-
_createClass(
|
|
3860
|
+
_createClass(vt, [{
|
|
3731
3861
|
key: "logEvent",
|
|
3732
3862
|
value: function logEvent(_ref) {
|
|
3733
3863
|
var e = _ref.name,
|
|
@@ -3747,9 +3877,9 @@ var pt = /*#__PURE__*/function () {
|
|
|
3747
3877
|
key: "createTelemetryBlob",
|
|
3748
3878
|
value: function createTelemetryBlob() {
|
|
3749
3879
|
return Object.assign(Object.assign({
|
|
3750
|
-
event_id: "event-id-".concat(
|
|
3751
|
-
app_session_id: "app-session-id-".concat(
|
|
3752
|
-
persistent_id: "persistent-id-".concat(
|
|
3880
|
+
event_id: "event-id-".concat(Re()),
|
|
3881
|
+
app_session_id: "app-session-id-".concat(Re()),
|
|
3882
|
+
persistent_id: "persistent-id-".concat(Re()),
|
|
3753
3883
|
client_sent_at: new Date().toISOString(),
|
|
3754
3884
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3755
3885
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3758,7 +3888,7 @@ var pt = /*#__PURE__*/function () {
|
|
|
3758
3888
|
},
|
|
3759
3889
|
sdk: {
|
|
3760
3890
|
identifier: "Stytch.js Javascript SDK",
|
|
3761
|
-
version: "4.
|
|
3891
|
+
version: "4.6.0"
|
|
3762
3892
|
}
|
|
3763
3893
|
});
|
|
3764
3894
|
}
|
|
@@ -3769,13 +3899,13 @@ var pt = /*#__PURE__*/function () {
|
|
|
3769
3899
|
t = _ref2.body,
|
|
3770
3900
|
r = _ref2.errorMessage,
|
|
3771
3901
|
n = _ref2.method;
|
|
3772
|
-
return
|
|
3902
|
+
return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3773
3903
|
var i, o, s, a;
|
|
3774
3904
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3775
3905
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3776
3906
|
case 0:
|
|
3777
3907
|
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;
|
|
3778
|
-
return _context3.abrupt("return",
|
|
3908
|
+
return _context3.abrupt("return", Te({
|
|
3779
3909
|
basicAuthHeader: o,
|
|
3780
3910
|
body: t,
|
|
3781
3911
|
errorMessage: r,
|
|
@@ -3799,7 +3929,7 @@ var pt = /*#__PURE__*/function () {
|
|
|
3799
3929
|
r = _ref3.errorMessage,
|
|
3800
3930
|
n = _ref3.method,
|
|
3801
3931
|
i = _ref3.retryCallback;
|
|
3802
|
-
return
|
|
3932
|
+
return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3803
3933
|
var o, s, a, c;
|
|
3804
3934
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3805
3935
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -3814,9 +3944,9 @@ var pt = /*#__PURE__*/function () {
|
|
|
3814
3944
|
s = e.xSDKParentHostHeader,
|
|
3815
3945
|
a = e.body,
|
|
3816
3946
|
c = e.retryCallback;
|
|
3817
|
-
return
|
|
3947
|
+
return Se(this, void 0, void 0, he().mark(function e() {
|
|
3818
3948
|
var u;
|
|
3819
|
-
return
|
|
3949
|
+
return he().wrap(function (e) {
|
|
3820
3950
|
for (;;) switch (e.prev = e.next) {
|
|
3821
3951
|
case 0:
|
|
3822
3952
|
return u = {
|
|
@@ -3827,7 +3957,7 @@ var pt = /*#__PURE__*/function () {
|
|
|
3827
3957
|
xSDKClientHeader: o,
|
|
3828
3958
|
xSDKParentHostHeader: s,
|
|
3829
3959
|
body: a
|
|
3830
|
-
}, e.prev = 1, e.next = 4,
|
|
3960
|
+
}, e.prev = 1, e.next = 4, Te(u);
|
|
3831
3961
|
case 4:
|
|
3832
3962
|
case 15:
|
|
3833
3963
|
return e.abrupt("return", e.sent);
|
|
@@ -3838,7 +3968,7 @@ var pt = /*#__PURE__*/function () {
|
|
|
3838
3968
|
}
|
|
3839
3969
|
return e.next = 12, c(e.t0, u);
|
|
3840
3970
|
case 12:
|
|
3841
|
-
return u = e.sent, e.next = 15,
|
|
3971
|
+
return u = e.sent, e.next = 15, Te(u);
|
|
3842
3972
|
case 16:
|
|
3843
3973
|
throw e.t0;
|
|
3844
3974
|
case 17:
|
|
@@ -3870,18 +4000,18 @@ var pt = /*#__PURE__*/function () {
|
|
|
3870
4000
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3871
4001
|
}
|
|
3872
4002
|
}]);
|
|
3873
|
-
return
|
|
4003
|
+
return vt;
|
|
3874
4004
|
}();
|
|
3875
|
-
function
|
|
4005
|
+
function bt(e) {
|
|
3876
4006
|
var t = e.toString(16);
|
|
3877
4007
|
return 1 === t.length && (t = "0" + t), t;
|
|
3878
4008
|
}
|
|
3879
|
-
var
|
|
3880
|
-
function
|
|
3881
|
-
_classCallCheck(this,
|
|
4009
|
+
var gt = /*#__PURE__*/function () {
|
|
4010
|
+
function gt(e, t) {
|
|
4011
|
+
_classCallCheck(this, gt);
|
|
3882
4012
|
this._dataLayer = e, this.namespace = t;
|
|
3883
4013
|
}
|
|
3884
|
-
_createClass(
|
|
4014
|
+
_createClass(gt, [{
|
|
3885
4015
|
key: "key",
|
|
3886
4016
|
value: function key() {
|
|
3887
4017
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3889,13 +4019,13 @@ var ft = /*#__PURE__*/function () {
|
|
|
3889
4019
|
}, {
|
|
3890
4020
|
key: "startPKCETransaction",
|
|
3891
4021
|
value: function startPKCETransaction() {
|
|
3892
|
-
return
|
|
4022
|
+
return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3893
4023
|
var e;
|
|
3894
4024
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3895
4025
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3896
4026
|
case 0:
|
|
3897
4027
|
_context5.next = 2;
|
|
3898
|
-
return
|
|
4028
|
+
return gt.createProofkeyPair();
|
|
3899
4029
|
case 2:
|
|
3900
4030
|
e = _context5.sent;
|
|
3901
4031
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3913,7 +4043,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3913
4043
|
if (null !== e) try {
|
|
3914
4044
|
return JSON.parse(e);
|
|
3915
4045
|
} catch (e) {
|
|
3916
|
-
return void
|
|
4046
|
+
return void ze("Found malformed Proof Key pair in localstorage.");
|
|
3917
4047
|
}
|
|
3918
4048
|
}
|
|
3919
4049
|
}, {
|
|
@@ -3924,7 +4054,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3924
4054
|
}], [{
|
|
3925
4055
|
key: "createProofkeyPair",
|
|
3926
4056
|
value: function createProofkeyPair() {
|
|
3927
|
-
return
|
|
4057
|
+
return ft(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3928
4058
|
var _String$fromCharCode;
|
|
3929
4059
|
var e, t, r, n;
|
|
3930
4060
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3932,7 +4062,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3932
4062
|
case 0:
|
|
3933
4063
|
e = new Uint32Array(16);
|
|
3934
4064
|
window.crypto.getRandomValues(e);
|
|
3935
|
-
t = Array.from(e).map(
|
|
4065
|
+
t = Array.from(e).map(bt).join("");
|
|
3936
4066
|
_context6.next = 5;
|
|
3937
4067
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3938
4068
|
case 5:
|
|
@@ -3949,14 +4079,14 @@ var ft = /*#__PURE__*/function () {
|
|
|
3949
4079
|
}));
|
|
3950
4080
|
}
|
|
3951
4081
|
}]);
|
|
3952
|
-
return
|
|
4082
|
+
return gt;
|
|
3953
4083
|
}();
|
|
3954
|
-
var
|
|
3955
|
-
function
|
|
3956
|
-
_classCallCheck(this,
|
|
4084
|
+
var kt = /*#__PURE__*/function () {
|
|
4085
|
+
function kt(e) {
|
|
4086
|
+
_classCallCheck(this, kt);
|
|
3957
4087
|
this._networkClient = e;
|
|
3958
4088
|
}
|
|
3959
|
-
_createClass(
|
|
4089
|
+
_createClass(kt, [{
|
|
3960
4090
|
key: "searchUser",
|
|
3961
4091
|
value: function searchUser(e) {
|
|
3962
4092
|
return this._networkClient.fetchSDK({
|
|
@@ -3994,9 +4124,9 @@ var mt = /*#__PURE__*/function () {
|
|
|
3994
4124
|
});
|
|
3995
4125
|
}
|
|
3996
4126
|
}]);
|
|
3997
|
-
return
|
|
4127
|
+
return kt;
|
|
3998
4128
|
}();
|
|
3999
|
-
var
|
|
4129
|
+
var yt = function yt(e) {
|
|
4000
4130
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4001
4131
|
var _t$split = t.split("="),
|
|
4002
4132
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4005,17 +4135,17 @@ var vt = function vt(e) {
|
|
|
4005
4135
|
}).length > 1;
|
|
4006
4136
|
};
|
|
4007
4137
|
/*! js-cookie v3.0.1 | MIT */
|
|
4008
|
-
function
|
|
4138
|
+
function wt(e) {
|
|
4009
4139
|
for (var t = 1; t < arguments.length; t++) {
|
|
4010
4140
|
var r = arguments[t];
|
|
4011
4141
|
for (var n in r) e[n] = r[n];
|
|
4012
4142
|
}
|
|
4013
4143
|
return e;
|
|
4014
4144
|
}
|
|
4015
|
-
var
|
|
4145
|
+
var St = function e(t, r) {
|
|
4016
4146
|
function n(e, n, i) {
|
|
4017
4147
|
if ("undefined" != typeof document) {
|
|
4018
|
-
"number" == typeof (i =
|
|
4148
|
+
"number" == typeof (i = wt({}, 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);
|
|
4019
4149
|
var o = "";
|
|
4020
4150
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4021
4151
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4037,15 +4167,15 @@ var gt = function e(t, r) {
|
|
|
4037
4167
|
}
|
|
4038
4168
|
},
|
|
4039
4169
|
remove: function remove(e, t) {
|
|
4040
|
-
n(e, "",
|
|
4170
|
+
n(e, "", wt({}, t, {
|
|
4041
4171
|
expires: -1
|
|
4042
4172
|
}));
|
|
4043
4173
|
},
|
|
4044
4174
|
withAttributes: function withAttributes(t) {
|
|
4045
|
-
return e(this.converter,
|
|
4175
|
+
return e(this.converter, wt({}, this.attributes, t));
|
|
4046
4176
|
},
|
|
4047
4177
|
withConverter: function withConverter(t) {
|
|
4048
|
-
return e(
|
|
4178
|
+
return e(wt({}, this.converter, t), this.attributes);
|
|
4049
4179
|
}
|
|
4050
4180
|
}, {
|
|
4051
4181
|
attributes: {
|
|
@@ -4065,37 +4195,37 @@ var gt = function e(t, r) {
|
|
|
4065
4195
|
}, {
|
|
4066
4196
|
path: "/"
|
|
4067
4197
|
});
|
|
4068
|
-
var
|
|
4198
|
+
var Pt = function Pt(e) {
|
|
4069
4199
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4070
4200
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4071
4201
|
},
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
clearTimeout(
|
|
4202
|
+
Ct = new Map(),
|
|
4203
|
+
Tt = function Tt(e) {
|
|
4204
|
+
clearTimeout(Ct.get(e));
|
|
4075
4205
|
},
|
|
4076
|
-
|
|
4077
|
-
|
|
4206
|
+
Ot = function Ot(e, t, r) {
|
|
4207
|
+
Tt(e);
|
|
4078
4208
|
var n = setTimeout(function () {
|
|
4079
|
-
void 0 ===
|
|
4209
|
+
void 0 === St.get(e) && St.set(e, t, r);
|
|
4080
4210
|
}, 10);
|
|
4081
|
-
return
|
|
4211
|
+
return Ct.set(e, n), St.set(e, t, r);
|
|
4082
4212
|
};
|
|
4083
|
-
var
|
|
4084
|
-
function
|
|
4085
|
-
var
|
|
4086
|
-
_classCallCheck(this,
|
|
4213
|
+
var xt = /*#__PURE__*/function () {
|
|
4214
|
+
function xt(e, t) {
|
|
4215
|
+
var _this4 = this;
|
|
4216
|
+
_classCallCheck(this, xt);
|
|
4087
4217
|
this.browserSessionStorage = {
|
|
4088
4218
|
getItem: function getItem(e) {
|
|
4089
|
-
return sessionStorage.getItem(
|
|
4219
|
+
return sessionStorage.getItem(Pt(_this4.publicToken, e));
|
|
4090
4220
|
},
|
|
4091
4221
|
setItem: function setItem(e, t) {
|
|
4092
|
-
return sessionStorage.setItem(
|
|
4222
|
+
return sessionStorage.setItem(Pt(_this4.publicToken, e), t);
|
|
4093
4223
|
},
|
|
4094
4224
|
removeItem: function removeItem(e) {
|
|
4095
|
-
return sessionStorage.removeItem(
|
|
4225
|
+
return sessionStorage.removeItem(Pt(_this4.publicToken, e));
|
|
4096
4226
|
}
|
|
4097
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4098
|
-
var r = localStorage.getItem(
|
|
4227
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (We("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);
|
|
4228
|
+
var r = localStorage.getItem(Pt(this.publicToken));
|
|
4099
4229
|
if (!r) return;
|
|
4100
4230
|
var n;
|
|
4101
4231
|
try {
|
|
@@ -4105,7 +4235,7 @@ var Ct = /*#__PURE__*/function () {
|
|
|
4105
4235
|
}
|
|
4106
4236
|
this.state = n;
|
|
4107
4237
|
}
|
|
4108
|
-
_createClass(
|
|
4238
|
+
_createClass(xt, [{
|
|
4109
4239
|
key: "opaqueTokenCookieName",
|
|
4110
4240
|
get: function get() {
|
|
4111
4241
|
var e;
|
|
@@ -4127,14 +4257,14 @@ var Ct = /*#__PURE__*/function () {
|
|
|
4127
4257
|
key: "readSessionCookie",
|
|
4128
4258
|
value: function readSessionCookie() {
|
|
4129
4259
|
return {
|
|
4130
|
-
session_token:
|
|
4131
|
-
session_jwt:
|
|
4260
|
+
session_token: St.get(this.opaqueTokenCookieName),
|
|
4261
|
+
session_jwt: St.get(this.jwtCookieName)
|
|
4132
4262
|
};
|
|
4133
4263
|
}
|
|
4134
4264
|
}, {
|
|
4135
4265
|
key: "readIntermediateSessionTokenCookie",
|
|
4136
4266
|
value: function readIntermediateSessionTokenCookie() {
|
|
4137
|
-
return
|
|
4267
|
+
return St.get(this.istCookieName);
|
|
4138
4268
|
}
|
|
4139
4269
|
}, {
|
|
4140
4270
|
key: "writeSessionCookie",
|
|
@@ -4143,32 +4273,32 @@ var Ct = /*#__PURE__*/function () {
|
|
|
4143
4273
|
var o = e.state,
|
|
4144
4274
|
s = e.session_token,
|
|
4145
4275
|
a = e.session_jwt,
|
|
4146
|
-
c =
|
|
4276
|
+
c = xt.generateCookieOpts({
|
|
4147
4277
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4148
4278
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4149
4279
|
path: this._cookiePath,
|
|
4150
4280
|
domain: this._domain
|
|
4151
4281
|
});
|
|
4152
|
-
|
|
4153
|
-
var u =
|
|
4282
|
+
Ot(this.opaqueTokenCookieName, s, c), Ot(this.jwtCookieName, a, c);
|
|
4283
|
+
var u = xt.generateCookieOpts({
|
|
4154
4284
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4155
4285
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4156
4286
|
path: this._cookiePath,
|
|
4157
4287
|
domain: this._domain
|
|
4158
4288
|
});
|
|
4159
|
-
|
|
4289
|
+
yt(this.jwtCookieName) && St.remove(this.jwtCookieName, u), yt(this.opaqueTokenCookieName) && St.remove(this.opaqueTokenCookieName, u), yt(this.jwtCookieName) && ze("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), yt(this.opaqueTokenCookieName) && ze("Could not remove extraneous opaque token cookie.");
|
|
4160
4290
|
}
|
|
4161
4291
|
}, {
|
|
4162
4292
|
key: "writeIntermediateSessionTokenCookie",
|
|
4163
4293
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4164
4294
|
var t = new Date(Date.now() + 6e5),
|
|
4165
|
-
r =
|
|
4295
|
+
r = xt.generateCookieOpts({
|
|
4166
4296
|
expiresAt: t.toString(),
|
|
4167
4297
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4168
4298
|
path: this._cookiePath,
|
|
4169
4299
|
domain: this._domain
|
|
4170
4300
|
});
|
|
4171
|
-
|
|
4301
|
+
Ot(this.istCookieName, e, r);
|
|
4172
4302
|
}
|
|
4173
4303
|
}, {
|
|
4174
4304
|
key: "removeSessionCookie",
|
|
@@ -4183,50 +4313,50 @@ var Ct = /*#__PURE__*/function () {
|
|
|
4183
4313
|
}, {
|
|
4184
4314
|
key: "removeCookies",
|
|
4185
4315
|
value: function removeCookies(e) {
|
|
4186
|
-
var
|
|
4316
|
+
var _this5 = this;
|
|
4187
4317
|
[!0, !1].forEach(function (t) {
|
|
4188
|
-
[
|
|
4189
|
-
[
|
|
4190
|
-
var i =
|
|
4318
|
+
[_this5._cookiePath, null].forEach(function (r) {
|
|
4319
|
+
[_this5._domain, null].forEach(function (n) {
|
|
4320
|
+
var i = xt.generateCookieOpts({
|
|
4191
4321
|
expiresAt: new Date(0).toString(),
|
|
4192
4322
|
availableToSubdomains: t,
|
|
4193
4323
|
path: r,
|
|
4194
4324
|
domain: n
|
|
4195
4325
|
});
|
|
4196
4326
|
e.forEach(function (e) {
|
|
4197
|
-
|
|
4327
|
+
St.remove(e, i);
|
|
4198
4328
|
});
|
|
4199
4329
|
});
|
|
4200
4330
|
});
|
|
4201
|
-
}), e.forEach(
|
|
4331
|
+
}), e.forEach(Tt);
|
|
4202
4332
|
}
|
|
4203
4333
|
}, {
|
|
4204
4334
|
key: "syncToLocalStorage",
|
|
4205
4335
|
value: function syncToLocalStorage() {
|
|
4206
|
-
localStorage.setItem(
|
|
4336
|
+
localStorage.setItem(Pt(this.publicToken), JSON.stringify(this.state));
|
|
4207
4337
|
}
|
|
4208
4338
|
}, {
|
|
4209
4339
|
key: "getItem",
|
|
4210
4340
|
value: function getItem(e) {
|
|
4211
|
-
return localStorage.getItem(
|
|
4341
|
+
return localStorage.getItem(Pt(this.publicToken, e));
|
|
4212
4342
|
}
|
|
4213
4343
|
}, {
|
|
4214
4344
|
key: "setItem",
|
|
4215
4345
|
value: function setItem(e, t) {
|
|
4216
|
-
return localStorage.setItem(
|
|
4346
|
+
return localStorage.setItem(Pt(this.publicToken, e), t);
|
|
4217
4347
|
}
|
|
4218
4348
|
}, {
|
|
4219
4349
|
key: "removeItem",
|
|
4220
4350
|
value: function removeItem(e) {
|
|
4221
|
-
return localStorage.removeItem(
|
|
4351
|
+
return localStorage.removeItem(Pt(this.publicToken, e));
|
|
4222
4352
|
}
|
|
4223
4353
|
}, {
|
|
4224
4354
|
key: "markStateKeysUpdated",
|
|
4225
4355
|
value: function markStateKeysUpdated(e) {
|
|
4226
|
-
var
|
|
4356
|
+
var _this6 = this;
|
|
4227
4357
|
var t = this.stateKeysUpdated.size;
|
|
4228
4358
|
return e.forEach(function (e) {
|
|
4229
|
-
return
|
|
4359
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4230
4360
|
}), t !== this.stateKeysUpdated.size;
|
|
4231
4361
|
}
|
|
4232
4362
|
}], [{
|
|
@@ -4243,40 +4373,40 @@ var Ct = /*#__PURE__*/function () {
|
|
|
4243
4373
|
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;
|
|
4244
4374
|
}
|
|
4245
4375
|
}]);
|
|
4246
|
-
return
|
|
4376
|
+
return xt;
|
|
4247
4377
|
}();
|
|
4248
|
-
var
|
|
4249
|
-
_inherits(
|
|
4250
|
-
function
|
|
4251
|
-
_classCallCheck(this,
|
|
4252
|
-
return _callSuper(this,
|
|
4378
|
+
var At = /*#__PURE__*/function (_xt) {
|
|
4379
|
+
_inherits(At, _xt);
|
|
4380
|
+
function At() {
|
|
4381
|
+
_classCallCheck(this, At);
|
|
4382
|
+
return _callSuper(this, At, arguments);
|
|
4253
4383
|
}
|
|
4254
|
-
return _createClass(
|
|
4255
|
-
}(
|
|
4256
|
-
var
|
|
4257
|
-
|
|
4384
|
+
return _createClass(At);
|
|
4385
|
+
}(xt);
|
|
4386
|
+
var Et = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4387
|
+
Dt = function Dt(e, t) {
|
|
4258
4388
|
var r = function () {
|
|
4259
4389
|
var e = window;
|
|
4260
|
-
return e[
|
|
4390
|
+
return e[Et] || (e[Et] = {}), e[Et];
|
|
4261
4391
|
}();
|
|
4262
|
-
return r[e] || (r[e] = new
|
|
4392
|
+
return r[e] || (r[e] = new At(e, t)), r[e];
|
|
4263
4393
|
},
|
|
4264
|
-
|
|
4394
|
+
It = function It(e, t) {
|
|
4265
4395
|
Object.values(e).forEach(function (e) {
|
|
4266
4396
|
return e(t);
|
|
4267
4397
|
});
|
|
4268
4398
|
},
|
|
4269
|
-
|
|
4399
|
+
Rt = function () {
|
|
4270
4400
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4271
4401
|
t = void 0 === e ? [] : e;
|
|
4272
4402
|
return function e(r, n) {
|
|
4273
|
-
return
|
|
4403
|
+
return de(r) === de(n) && (null === r || null === n ? r === n : "object" === de(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4274
4404
|
return !(e in n);
|
|
4275
4405
|
}) && Object.entries(r).filter(function (e) {
|
|
4276
|
-
var r =
|
|
4406
|
+
var r = ce(e, 1)[0];
|
|
4277
4407
|
return !t.includes(r);
|
|
4278
4408
|
}).every(function (t) {
|
|
4279
|
-
var r =
|
|
4409
|
+
var r = ce(t, 2),
|
|
4280
4410
|
i = r[0],
|
|
4281
4411
|
o = r[1];
|
|
4282
4412
|
return e(o, n[i]);
|
|
@@ -4285,20 +4415,20 @@ var Tt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4285
4415
|
}({
|
|
4286
4416
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4287
4417
|
});
|
|
4288
|
-
var
|
|
4289
|
-
function
|
|
4290
|
-
var
|
|
4291
|
-
_classCallCheck(this,
|
|
4418
|
+
var jt = /*#__PURE__*/function () {
|
|
4419
|
+
function jt(e, t) {
|
|
4420
|
+
var _this7 = this;
|
|
4421
|
+
_classCallCheck(this, jt);
|
|
4292
4422
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4293
|
-
if (e.key !==
|
|
4423
|
+
if (e.key !== Pt(_this7._publicToken)) return;
|
|
4294
4424
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4295
|
-
|
|
4425
|
+
_this7.updateState(t);
|
|
4296
4426
|
}, window.addEventListener("storage", this._listen);
|
|
4297
4427
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4298
4428
|
r = _this$_datalayer$read.session_token;
|
|
4299
4429
|
r || this.destroySession();
|
|
4300
4430
|
}
|
|
4301
|
-
_createClass(
|
|
4431
|
+
_createClass(jt, [{
|
|
4302
4432
|
key: "getTokens",
|
|
4303
4433
|
value: function getTokens() {
|
|
4304
4434
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4336,7 +4466,7 @@ var Et = /*#__PURE__*/function () {
|
|
|
4336
4466
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4337
4467
|
this._datalayer.state = r;
|
|
4338
4468
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4339
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4469
|
+
!this._datalayer.markStateKeysUpdated(n) && Rt(t, r) || It(this._datalayer.subscriptions, r);
|
|
4340
4470
|
}
|
|
4341
4471
|
}, {
|
|
4342
4472
|
key: "updateStateAndTokens",
|
|
@@ -4351,8 +4481,8 @@ var Et = /*#__PURE__*/function () {
|
|
|
4351
4481
|
this._datalayer.state = r;
|
|
4352
4482
|
var n = e ? Object.keys(e) : [],
|
|
4353
4483
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4354
|
-
o = !
|
|
4355
|
-
(i || o) && (
|
|
4484
|
+
o = !Rt(t, r);
|
|
4485
|
+
(i || o) && (It(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4356
4486
|
}
|
|
4357
4487
|
}, {
|
|
4358
4488
|
key: "updateTokens",
|
|
@@ -4392,43 +4522,43 @@ var Et = /*#__PURE__*/function () {
|
|
|
4392
4522
|
return null;
|
|
4393
4523
|
}
|
|
4394
4524
|
}]);
|
|
4395
|
-
return
|
|
4525
|
+
return jt;
|
|
4396
4526
|
}();
|
|
4397
|
-
var
|
|
4398
|
-
_inherits(
|
|
4399
|
-
function
|
|
4400
|
-
var
|
|
4401
|
-
_classCallCheck(this,
|
|
4402
|
-
|
|
4403
|
-
return
|
|
4527
|
+
var Ft = /*#__PURE__*/function (_jt) {
|
|
4528
|
+
_inherits(Ft, _jt);
|
|
4529
|
+
function Ft() {
|
|
4530
|
+
var _this8;
|
|
4531
|
+
_classCallCheck(this, Ft);
|
|
4532
|
+
_this8 = _callSuper(this, Ft, arguments), _this8.updateMember = function (e) {
|
|
4533
|
+
return _this8.updateState({
|
|
4404
4534
|
member: e
|
|
4405
4535
|
});
|
|
4406
|
-
},
|
|
4536
|
+
}, _this8.getMember = function () {
|
|
4407
4537
|
var e, t;
|
|
4408
|
-
return null !== (t = null === (e =
|
|
4409
|
-
},
|
|
4410
|
-
return
|
|
4538
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4539
|
+
}, _this8.updateOrganization = function (e) {
|
|
4540
|
+
return _this8.updateState({
|
|
4411
4541
|
organization: e
|
|
4412
4542
|
});
|
|
4413
|
-
},
|
|
4543
|
+
}, _this8.getOrganization = function () {
|
|
4414
4544
|
var e, t;
|
|
4415
|
-
return null !== (t = null === (e =
|
|
4416
|
-
},
|
|
4545
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4546
|
+
}, _this8.getSession = function () {
|
|
4417
4547
|
var e, t;
|
|
4418
|
-
return null !== (t = null === (e =
|
|
4548
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4419
4549
|
};
|
|
4420
|
-
return
|
|
4550
|
+
return _this8;
|
|
4421
4551
|
}
|
|
4422
|
-
return _createClass(
|
|
4423
|
-
}(
|
|
4424
|
-
var
|
|
4425
|
-
var
|
|
4426
|
-
var
|
|
4427
|
-
_classCallCheck(this,
|
|
4552
|
+
return _createClass(Ft);
|
|
4553
|
+
}(jt);
|
|
4554
|
+
var Lt = Symbol["for"]("stytch__internal_b2b");
|
|
4555
|
+
var Mt = /*#__PURE__*/_createClass(function Mt(e, t) {
|
|
4556
|
+
var _this9 = this;
|
|
4557
|
+
_classCallCheck(this, Mt);
|
|
4428
4558
|
var r;
|
|
4429
4559
|
!function (e) {
|
|
4430
4560
|
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"));
|
|
4431
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4561
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? ze("Public token is malformed. Expected a string, got ".concat(de(r), ".").concat(Ue)) : "" === r ? ze('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ue)) : r.startsWith("public-token-") || ze('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ue));
|
|
4432
4562
|
var n = t,
|
|
4433
4563
|
i = {
|
|
4434
4564
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4437,32 +4567,33 @@ var jt = /*#__PURE__*/_createClass(function jt(e, t) {
|
|
|
4437
4567
|
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",
|
|
4438
4568
|
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",
|
|
4439
4569
|
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",
|
|
4440
|
-
clientsideServicesIframeURL: null !== (
|
|
4570
|
+
clientsideServicesIframeURL: null !== (_ = null === (f = null == o ? void 0 : o.endpoints) || void 0 === f ? void 0 : f.clientsideServicesIframeURL) && void 0 !== _ ? _ : "https://js.stytch.com/clientside-services/index.html"
|
|
4441
4571
|
}
|
|
4442
4572
|
};
|
|
4443
|
-
var o, s, a, c, u, l, d, h, p,
|
|
4444
|
-
this._dataLayer =
|
|
4445
|
-
var m = new
|
|
4446
|
-
this._networkClient = new
|
|
4573
|
+
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4574
|
+
this._dataLayer = Dt(e, n), this._subscriptionService = new Ft(e, this._dataLayer);
|
|
4575
|
+
var m = new gt(this._dataLayer, "passwords");
|
|
4576
|
+
this._networkClient = new vt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4447
4577
|
var e, t, r, n;
|
|
4448
4578
|
return {
|
|
4449
|
-
stytch_member_id: null === (t = null === (e =
|
|
4450
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4579
|
+
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,
|
|
4580
|
+
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
|
|
4451
4581
|
};
|
|
4452
4582
|
});
|
|
4453
|
-
var v = new
|
|
4454
|
-
b = new
|
|
4455
|
-
g = new
|
|
4456
|
-
|
|
4583
|
+
var v = new pt(e, this._networkClient, this._dataLayer),
|
|
4584
|
+
b = new _t(v.getAsync()),
|
|
4585
|
+
g = new He(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4586
|
+
k = new mt(i.endpoints.clientsideServicesIframeURL);
|
|
4587
|
+
this.organization = new Qe(this._networkClient, this._subscriptionService), this.member = new Xe(this._networkClient, this._subscriptionService), this.self = new Xe(this._networkClient, this._subscriptionService), this.session = new tt(this._networkClient, this._subscriptionService), this.magicLinks = new $e(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new et(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4457
4588
|
publicToken: e,
|
|
4458
4589
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4459
4590
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4460
|
-
}, g), this.sso = new
|
|
4591
|
+
}, g), this.sso = new Ze(this._networkClient, this._subscriptionService, new gt(this._dataLayer, "sso"), v.getAsync(), {
|
|
4461
4592
|
publicToken: e,
|
|
4462
4593
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4463
4594
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4464
|
-
}), this.discovery = new
|
|
4465
|
-
var
|
|
4595
|
+
}), this.discovery = new rt(this._networkClient, this._subscriptionService), this.passwords = new it(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new ot(this._networkClient, this._subscriptionService, g), this.totp = new st(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new at(this._networkClient, this._subscriptionService, g), this.rbac = new ct(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new lt(this._subscriptionService, this.session);
|
|
4596
|
+
var y = new kt(this._networkClient);
|
|
4466
4597
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4467
4598
|
name: "b2b_sdk_instance_instantiated",
|
|
4468
4599
|
details: {
|
|
@@ -4472,13 +4603,14 @@ var jt = /*#__PURE__*/_createClass(function jt(e, t) {
|
|
|
4472
4603
|
}
|
|
4473
4604
|
});
|
|
4474
4605
|
(function (e, t) {
|
|
4475
|
-
Object.assign(e, _defineProperty({},
|
|
4606
|
+
Object.assign(e, _defineProperty({}, Lt, t));
|
|
4476
4607
|
})(this, {
|
|
4477
4608
|
bootstrap: v,
|
|
4609
|
+
clientsideServices: k,
|
|
4478
4610
|
publicToken: e,
|
|
4479
|
-
searchManager:
|
|
4611
|
+
searchManager: y,
|
|
4480
4612
|
dataLayer: this._dataLayer,
|
|
4481
4613
|
networkClient: this._networkClient
|
|
4482
4614
|
});
|
|
4483
4615
|
});
|
|
4484
|
-
export { g as AuthFlowType, k as B2BOAuthProviders, b as B2BProducts,
|
|
4616
|
+
export { g as AuthFlowType, k as B2BMFAProducts, y as B2BOAuthProviders, b as B2BProducts, Z as BiometricsFailedError, F as BiometricsUnavailableError, V as ChallengeSigningFailedError, N as DeviceCredentialsNotAllowedError, J as FailedCodeChallengeError, X as FailedToDecryptDataError, R as InternalError, H as InvalidAuthorizationCredentialError, re as InvalidCredentialTypeError, ee as InvalidRedirectSchemeError, Q as InvalidStartUrlError, ie as JSONDataNotConvertibleToStringError, L as KeyInvalidatedError, M as KeystoreUnavailableError, ne as MissingAttestationObjectError, W as MissingAuthorizationCredentialIDTokenError, U as MissingGoogleClientIDError, q as MissingPKCEError, G as MissingPublicKeyError, te as MissingUrlError, B as NoBiometricsEnrolledError, j as NoBiometricsRegistrationError, I as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, _ as OneTapPositions, se as PasskeysInvalidEncoding, $ as PasskeysUnsupportedError, h as Products, oe as RandomNumberGenerationFailed, w as SDKAPIUnreachableError, Y as SDKNotConfiguredError, E as StytchAPIError, A as StytchAPISchemaError, x as StytchAPIUnreachableError, Mt as StytchB2BHeadlessClient, O as StytchError, v as StytchEventType, C as StytchSDKAPIError, D as StytchSDKError, P as StytchSDKSchemaError, S as StytchSDKUsageError, T as UNRECOVERABLE_ERROR_TYPES, K as UserCancellationError, z as UserLockedOutError, f as Wallets, ae as errorToStytchError };
|