@stytch/vanilla-js 4.6.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/b2b/index.esm.js +3238 -3214
- package/dist/b2b/index.headless.esm.js +671 -655
- package/dist/b2b/index.headless.js +649 -635
- package/dist/b2b/index.js +3191 -3169
- package/dist/index.esm.js +3794 -3778
- package/dist/index.headless.esm.js +752 -736
- package/dist/index.headless.js +748 -734
- package/dist/index.js +3819 -3805
- package/package.json +8 -4
|
@@ -132,7 +132,7 @@ function d(e) {
|
|
|
132
132
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
133
133
|
}, d(e);
|
|
134
134
|
}
|
|
135
|
-
var h, p, f, _, m, v;
|
|
135
|
+
var h, p, f, _, m, v, b;
|
|
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) {
|
|
@@ -145,26 +145,28 @@ var h, p, f, _, m, v;
|
|
|
145
145
|
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
146
146
|
}(m || (m = {})), function (e) {
|
|
147
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
|
-
}(v || (v = {}))
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
}(v || (v = {})), function (e) {
|
|
149
|
+
e[e.emailMagicLinks = 0] = "emailMagicLinks", e[e.oauth = 1] = "oauth", e[e.otp = 2] = "otp", e[e.passwords = 3] = "passwords";
|
|
150
|
+
}(b || (b = {}));
|
|
151
|
+
var g,
|
|
152
152
|
y,
|
|
153
|
-
|
|
153
|
+
k,
|
|
154
|
+
w,
|
|
155
|
+
S = function (e) {
|
|
154
156
|
function t(e, r) {
|
|
155
157
|
var n;
|
|
156
158
|
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;
|
|
157
159
|
}
|
|
158
160
|
return a(t, c(Error)), r(t);
|
|
159
161
|
}(),
|
|
160
|
-
|
|
162
|
+
P = function (e) {
|
|
161
163
|
function t(e, r) {
|
|
162
164
|
var n;
|
|
163
165
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
164
166
|
}
|
|
165
167
|
return a(t, c(Error)), r(t);
|
|
166
168
|
}(),
|
|
167
|
-
|
|
169
|
+
C = function (e) {
|
|
168
170
|
function t(e) {
|
|
169
171
|
var r, n;
|
|
170
172
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -175,7 +177,7 @@ var b,
|
|
|
175
177
|
}
|
|
176
178
|
return a(t, c(Error)), r(t);
|
|
177
179
|
}(),
|
|
178
|
-
|
|
180
|
+
T = function (e) {
|
|
179
181
|
function t(e) {
|
|
180
182
|
var r;
|
|
181
183
|
i(this, t), (r = o(this, t)).name = "StytchSDKAPIError";
|
|
@@ -188,8 +190,8 @@ var b,
|
|
|
188
190
|
}
|
|
189
191
|
return a(t, c(Error)), r(t);
|
|
190
192
|
}(),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
O = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
194
|
+
A = function (e) {
|
|
193
195
|
function t(e, r) {
|
|
194
196
|
var n;
|
|
195
197
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
@@ -201,9 +203,9 @@ var b,
|
|
|
201
203
|
var r;
|
|
202
204
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
203
205
|
}
|
|
204
|
-
return a(t,
|
|
206
|
+
return a(t, A), r(t);
|
|
205
207
|
}(),
|
|
206
|
-
|
|
208
|
+
E = function (e) {
|
|
207
209
|
function t(e) {
|
|
208
210
|
var r;
|
|
209
211
|
i(this, t);
|
|
@@ -212,9 +214,9 @@ var b,
|
|
|
212
214
|
}).join("\n");
|
|
213
215
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
214
216
|
}
|
|
215
|
-
return a(t,
|
|
217
|
+
return a(t, A), r(t);
|
|
216
218
|
}(),
|
|
217
|
-
|
|
219
|
+
D = function (e) {
|
|
218
220
|
function t(e) {
|
|
219
221
|
var r;
|
|
220
222
|
i(this, t);
|
|
@@ -225,257 +227,273 @@ var b,
|
|
|
225
227
|
u = e.request_id;
|
|
226
228
|
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;
|
|
227
229
|
}
|
|
228
|
-
return a(t,
|
|
230
|
+
return a(t, A), r(t);
|
|
229
231
|
}(),
|
|
230
|
-
|
|
232
|
+
I = function (e) {
|
|
231
233
|
function t(e, r, n) {
|
|
232
234
|
var s;
|
|
233
235
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
234
236
|
}
|
|
235
|
-
return a(t,
|
|
237
|
+
return a(t, A), r(t);
|
|
236
238
|
}(),
|
|
237
|
-
|
|
239
|
+
R = function (e) {
|
|
238
240
|
function t() {
|
|
239
241
|
return i(this, t), o(this, t, ["NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session."]);
|
|
240
242
|
}
|
|
241
|
-
return a(t,
|
|
243
|
+
return a(t, I), r(t);
|
|
242
244
|
}(),
|
|
243
|
-
|
|
245
|
+
j = function (e) {
|
|
244
246
|
function t(e) {
|
|
245
247
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
246
248
|
}
|
|
247
|
-
return a(t,
|
|
249
|
+
return a(t, I), r(t);
|
|
248
250
|
}(),
|
|
249
|
-
|
|
251
|
+
F = function (e) {
|
|
250
252
|
function t() {
|
|
251
253
|
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."]);
|
|
252
254
|
}
|
|
253
|
-
return a(t,
|
|
255
|
+
return a(t, I), r(t);
|
|
254
256
|
}(),
|
|
255
|
-
|
|
257
|
+
L = function (e) {
|
|
256
258
|
function t() {
|
|
257
259
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
258
260
|
}
|
|
259
|
-
return a(t,
|
|
261
|
+
return a(t, I), r(t);
|
|
260
262
|
}(),
|
|
261
|
-
|
|
263
|
+
M = function (e) {
|
|
262
264
|
function t() {
|
|
263
265
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
264
266
|
}
|
|
265
|
-
return a(t,
|
|
267
|
+
return a(t, I), r(t);
|
|
266
268
|
}(),
|
|
267
|
-
|
|
269
|
+
B = function (e) {
|
|
268
270
|
function t() {
|
|
269
271
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
270
272
|
}
|
|
271
|
-
return a(t,
|
|
273
|
+
return a(t, I), r(t);
|
|
272
274
|
}(),
|
|
273
|
-
|
|
275
|
+
K = function (e) {
|
|
274
276
|
function t() {
|
|
275
277
|
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."]);
|
|
276
278
|
}
|
|
277
|
-
return a(t,
|
|
279
|
+
return a(t, I), r(t);
|
|
278
280
|
}(),
|
|
279
|
-
|
|
281
|
+
z = function (e) {
|
|
280
282
|
function t() {
|
|
281
283
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
282
284
|
}
|
|
283
|
-
return a(t,
|
|
285
|
+
return a(t, I), r(t);
|
|
284
286
|
}(),
|
|
285
|
-
|
|
287
|
+
N = function (e) {
|
|
286
288
|
function t() {
|
|
287
289
|
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."]);
|
|
288
290
|
}
|
|
289
|
-
return a(t,
|
|
291
|
+
return a(t, I), r(t);
|
|
290
292
|
}(),
|
|
291
|
-
|
|
293
|
+
U = function (e) {
|
|
292
294
|
function t() {
|
|
293
295
|
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."]);
|
|
294
296
|
}
|
|
295
|
-
return a(t,
|
|
297
|
+
return a(t, I), r(t);
|
|
296
298
|
}(),
|
|
297
|
-
|
|
299
|
+
q = function (e) {
|
|
298
300
|
function t() {
|
|
299
301
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
300
302
|
}
|
|
301
|
-
return a(t,
|
|
303
|
+
return a(t, I), r(t);
|
|
302
304
|
}(),
|
|
303
|
-
|
|
305
|
+
W = function (e) {
|
|
304
306
|
function t() {
|
|
305
307
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
306
308
|
}
|
|
307
|
-
return a(t,
|
|
309
|
+
return a(t, I), r(t);
|
|
308
310
|
}(),
|
|
309
|
-
|
|
311
|
+
H = function (e) {
|
|
310
312
|
function t() {
|
|
311
313
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
312
314
|
}
|
|
313
|
-
return a(t,
|
|
315
|
+
return a(t, I), r(t);
|
|
314
316
|
}(),
|
|
315
|
-
|
|
317
|
+
G = function (e) {
|
|
316
318
|
function t() {
|
|
317
319
|
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."]);
|
|
318
320
|
}
|
|
319
|
-
return a(t,
|
|
321
|
+
return a(t, I), r(t);
|
|
320
322
|
}(),
|
|
321
|
-
|
|
323
|
+
V = function (e) {
|
|
322
324
|
function t() {
|
|
323
325
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
324
326
|
}
|
|
325
|
-
return a(t,
|
|
327
|
+
return a(t, I), r(t);
|
|
326
328
|
}(),
|
|
327
|
-
|
|
329
|
+
Y = function (e) {
|
|
328
330
|
function t() {
|
|
329
331
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
330
332
|
}
|
|
331
|
-
return a(t,
|
|
333
|
+
return a(t, I), r(t);
|
|
332
334
|
}(),
|
|
333
|
-
|
|
335
|
+
J = function (e) {
|
|
334
336
|
function t() {
|
|
335
337
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
336
338
|
}
|
|
337
|
-
return a(t,
|
|
339
|
+
return a(t, I), r(t);
|
|
338
340
|
}(),
|
|
339
|
-
|
|
341
|
+
$ = function (e) {
|
|
340
342
|
function t() {
|
|
341
343
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
342
344
|
}
|
|
343
|
-
return a(t,
|
|
345
|
+
return a(t, I), r(t);
|
|
344
346
|
}(),
|
|
345
|
-
|
|
347
|
+
X = function (e) {
|
|
346
348
|
function t() {
|
|
347
349
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
348
350
|
}
|
|
349
|
-
return a(t,
|
|
351
|
+
return a(t, I), r(t);
|
|
350
352
|
}(),
|
|
351
|
-
|
|
353
|
+
Z = function (e) {
|
|
352
354
|
function t() {
|
|
353
355
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
354
356
|
}
|
|
355
|
-
return a(t,
|
|
357
|
+
return a(t, I), r(t);
|
|
356
358
|
}(),
|
|
357
|
-
|
|
359
|
+
Q = function (e) {
|
|
358
360
|
function t() {
|
|
359
361
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
360
362
|
}
|
|
361
|
-
return a(t,
|
|
363
|
+
return a(t, I), r(t);
|
|
362
364
|
}(),
|
|
363
|
-
|
|
365
|
+
ee = function (e) {
|
|
364
366
|
function t() {
|
|
365
367
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
366
368
|
}
|
|
367
|
-
return a(t,
|
|
369
|
+
return a(t, I), r(t);
|
|
368
370
|
}(),
|
|
369
|
-
|
|
371
|
+
te = function (e) {
|
|
370
372
|
function t() {
|
|
371
373
|
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."]);
|
|
372
374
|
}
|
|
373
|
-
return a(t,
|
|
375
|
+
return a(t, I), r(t);
|
|
374
376
|
}(),
|
|
375
|
-
|
|
377
|
+
re = function (e) {
|
|
376
378
|
function t() {
|
|
377
379
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
378
380
|
}
|
|
379
|
-
return a(t,
|
|
381
|
+
return a(t, I), r(t);
|
|
380
382
|
}(),
|
|
381
|
-
|
|
383
|
+
ne = function (e) {
|
|
382
384
|
function t() {
|
|
383
385
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
384
386
|
}
|
|
385
|
-
return a(t,
|
|
387
|
+
return a(t, I), r(t);
|
|
386
388
|
}(),
|
|
387
|
-
|
|
389
|
+
ie = function (e) {
|
|
388
390
|
function t() {
|
|
389
391
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
390
392
|
}
|
|
391
|
-
return a(t,
|
|
393
|
+
return a(t, I), r(t);
|
|
392
394
|
}(),
|
|
393
|
-
|
|
395
|
+
oe = function (e) {
|
|
394
396
|
function t() {
|
|
395
397
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
396
398
|
}
|
|
397
|
-
return a(t,
|
|
399
|
+
return a(t, I), r(t);
|
|
398
400
|
}(),
|
|
399
|
-
|
|
401
|
+
se = function (e) {
|
|
400
402
|
function t() {
|
|
401
403
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
402
404
|
}
|
|
403
|
-
return a(t,
|
|
405
|
+
return a(t, I), r(t);
|
|
404
406
|
}(),
|
|
405
|
-
|
|
407
|
+
ae = function (e) {
|
|
406
408
|
function t() {
|
|
407
409
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
408
410
|
}
|
|
409
|
-
return a(t,
|
|
411
|
+
return a(t, I), r(t);
|
|
412
|
+
}(),
|
|
413
|
+
ce = function (e) {
|
|
414
|
+
function t() {
|
|
415
|
+
return i(this, t), o(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
416
|
+
}
|
|
417
|
+
return a(t, I), r(t);
|
|
418
|
+
}(),
|
|
419
|
+
ue = function (e) {
|
|
420
|
+
function t() {
|
|
421
|
+
return i(this, t), o(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
422
|
+
}
|
|
423
|
+
return a(t, I), r(t);
|
|
410
424
|
}();
|
|
411
|
-
function
|
|
425
|
+
function le(e) {
|
|
412
426
|
switch (e.message) {
|
|
413
427
|
case "internal_error":
|
|
414
|
-
return new
|
|
428
|
+
return new j(e.message);
|
|
415
429
|
case "no_current_session":
|
|
416
|
-
return new
|
|
430
|
+
return new R();
|
|
417
431
|
case "no_biometrics_registration":
|
|
418
|
-
return new
|
|
432
|
+
return new F();
|
|
419
433
|
case "biometrics_unavailable":
|
|
420
434
|
case "device_hardware_error":
|
|
421
435
|
case "biometrics_not_available":
|
|
422
|
-
return new
|
|
436
|
+
return new L();
|
|
423
437
|
case "key_invalidated":
|
|
424
438
|
case "no_biometric_key":
|
|
425
|
-
return new
|
|
439
|
+
return new M();
|
|
426
440
|
case "no_biometrics_enrolled":
|
|
427
|
-
return new
|
|
441
|
+
return new K();
|
|
428
442
|
case "keystore_unavailable":
|
|
429
|
-
return new
|
|
443
|
+
return new B();
|
|
430
444
|
case "device_credentials_not_allowed":
|
|
431
|
-
return new
|
|
445
|
+
return new U();
|
|
432
446
|
case "user_cancellation":
|
|
433
|
-
return new K();
|
|
434
|
-
case "user_locked_out":
|
|
435
447
|
return new z();
|
|
448
|
+
case "user_locked_out":
|
|
449
|
+
return new N();
|
|
436
450
|
case "google_onetap_missing_id_token":
|
|
437
451
|
case "oauth_apple_missing_id_token":
|
|
438
452
|
case "missing_authorization_credential_id_token":
|
|
439
|
-
return new
|
|
453
|
+
return new H();
|
|
440
454
|
case "google_onetap_missing_member":
|
|
441
455
|
case "oauth_apple_credential_invalid":
|
|
442
456
|
case "invalid_authorization_credential":
|
|
443
|
-
return new H();
|
|
444
|
-
case "missing_public_key":
|
|
445
457
|
return new G();
|
|
446
|
-
case "
|
|
458
|
+
case "missing_public_key":
|
|
447
459
|
return new V();
|
|
448
|
-
case "
|
|
460
|
+
case "challenge_signing_failed":
|
|
449
461
|
return new Y();
|
|
450
|
-
case "
|
|
462
|
+
case "sdk_not_configured":
|
|
451
463
|
return new J();
|
|
452
|
-
case "
|
|
464
|
+
case "failed_code_challenge":
|
|
453
465
|
return new $();
|
|
454
|
-
case "
|
|
466
|
+
case "passkeys_unsupported":
|
|
455
467
|
return new X();
|
|
456
|
-
case "
|
|
468
|
+
case "failed_to_decrypt_data":
|
|
457
469
|
return new Z();
|
|
458
|
-
case "
|
|
470
|
+
case "biometrics_failed":
|
|
459
471
|
return new Q();
|
|
460
|
-
case "
|
|
472
|
+
case "invalid_start_url":
|
|
461
473
|
return new ee();
|
|
462
|
-
case "
|
|
474
|
+
case "invalid_redirect_scheme":
|
|
463
475
|
return new te();
|
|
464
|
-
case "
|
|
476
|
+
case "missing_url":
|
|
465
477
|
return new re();
|
|
466
|
-
case "
|
|
478
|
+
case "invalid_credential_type":
|
|
467
479
|
return new ne();
|
|
468
|
-
case "
|
|
480
|
+
case "missing_attestation_object":
|
|
469
481
|
return new ie();
|
|
470
|
-
case "
|
|
482
|
+
case "json_data_not_convertible_to_string":
|
|
471
483
|
return new oe();
|
|
472
|
-
case "
|
|
484
|
+
case "random_number_generation_failed":
|
|
473
485
|
return new se();
|
|
486
|
+
case "passkeys_invalid_encoding":
|
|
487
|
+
return new ae();
|
|
488
|
+
case "passkeys_misconfigured":
|
|
489
|
+
return new ce();
|
|
490
|
+
case "signinwithapple_misconfigured":
|
|
491
|
+
return new ue();
|
|
474
492
|
default:
|
|
475
|
-
return new
|
|
493
|
+
return new I(e.name, e.message);
|
|
476
494
|
}
|
|
477
495
|
}
|
|
478
|
-
function
|
|
496
|
+
function de(e, t) {
|
|
479
497
|
return function (e) {
|
|
480
498
|
if (Array.isArray(e)) return e;
|
|
481
499
|
}(e) || function (e, t) {
|
|
@@ -504,32 +522,32 @@ function ce(e, t) {
|
|
|
504
522
|
}
|
|
505
523
|
return a;
|
|
506
524
|
}
|
|
507
|
-
}(e, t) ||
|
|
525
|
+
}(e, t) || he(e, t) || function () {
|
|
508
526
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
509
527
|
}();
|
|
510
528
|
}
|
|
511
|
-
function
|
|
529
|
+
function he(e, t) {
|
|
512
530
|
if (e) {
|
|
513
|
-
if ("string" == typeof e) return
|
|
531
|
+
if ("string" == typeof e) return pe(e, t);
|
|
514
532
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
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) ?
|
|
533
|
+
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) ? pe(e, t) : void 0;
|
|
516
534
|
}
|
|
517
535
|
}
|
|
518
|
-
function
|
|
536
|
+
function pe(e, t) {
|
|
519
537
|
(null == t || t > e.length) && (t = e.length);
|
|
520
538
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
521
539
|
return n;
|
|
522
540
|
}
|
|
523
|
-
function
|
|
524
|
-
return
|
|
541
|
+
function fe(e) {
|
|
542
|
+
return fe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
525
543
|
return _typeof(e);
|
|
526
544
|
} : function (e) {
|
|
527
545
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
528
|
-
},
|
|
546
|
+
}, fe(e);
|
|
529
547
|
}
|
|
530
|
-
function
|
|
548
|
+
function _e() {
|
|
531
549
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
532
|
-
|
|
550
|
+
_e = function _e() {
|
|
533
551
|
return t;
|
|
534
552
|
};
|
|
535
553
|
var e,
|
|
@@ -588,14 +606,14 @@ function he() {
|
|
|
588
606
|
function v() {}
|
|
589
607
|
function b() {}
|
|
590
608
|
function g() {}
|
|
591
|
-
var
|
|
592
|
-
u(
|
|
609
|
+
var y = {};
|
|
610
|
+
u(y, s, function () {
|
|
593
611
|
return this;
|
|
594
612
|
});
|
|
595
|
-
var
|
|
596
|
-
w =
|
|
597
|
-
w && w !== r && n.call(w, s) && (
|
|
598
|
-
var S = g.prototype = v.prototype = Object.create(
|
|
613
|
+
var k = Object.getPrototypeOf,
|
|
614
|
+
w = k && k(k(D([])));
|
|
615
|
+
w && w !== r && n.call(w, s) && (y = w);
|
|
616
|
+
var S = g.prototype = v.prototype = Object.create(y);
|
|
599
617
|
function P(e) {
|
|
600
618
|
["next", "throw", "return"].forEach(function (t) {
|
|
601
619
|
u(e, t, function (e) {
|
|
@@ -609,7 +627,7 @@ function he() {
|
|
|
609
627
|
if ("throw" !== c.type) {
|
|
610
628
|
var u = c.arg,
|
|
611
629
|
l = u.value;
|
|
612
|
-
return l && "object" ==
|
|
630
|
+
return l && "object" == fe(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
613
631
|
r("next", e, s, a);
|
|
614
632
|
}, function (e) {
|
|
615
633
|
r("throw", e, s, a);
|
|
@@ -679,20 +697,20 @@ function he() {
|
|
|
679
697
|
var s = o.arg;
|
|
680
698
|
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);
|
|
681
699
|
}
|
|
682
|
-
function
|
|
700
|
+
function A(e) {
|
|
683
701
|
var t = {
|
|
684
702
|
tryLoc: e[0]
|
|
685
703
|
};
|
|
686
704
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
687
705
|
}
|
|
688
|
-
function
|
|
706
|
+
function x(e) {
|
|
689
707
|
var t = e.completion || {};
|
|
690
708
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
691
709
|
}
|
|
692
710
|
function E(e) {
|
|
693
711
|
this.tryEntries = [{
|
|
694
712
|
tryLoc: "root"
|
|
695
|
-
}], e.forEach(
|
|
713
|
+
}], e.forEach(A, this), this.reset(!0);
|
|
696
714
|
}
|
|
697
715
|
function D(t) {
|
|
698
716
|
if (t || "" === t) {
|
|
@@ -708,7 +726,7 @@ function he() {
|
|
|
708
726
|
return o.next = o;
|
|
709
727
|
}
|
|
710
728
|
}
|
|
711
|
-
throw new TypeError(
|
|
729
|
+
throw new TypeError(fe(t) + " is not iterable");
|
|
712
730
|
}
|
|
713
731
|
return b.prototype = g, i(S, "constructor", {
|
|
714
732
|
value: g,
|
|
@@ -751,7 +769,7 @@ function he() {
|
|
|
751
769
|
}, t.values = D, E.prototype = {
|
|
752
770
|
constructor: E,
|
|
753
771
|
reset: function reset(t) {
|
|
754
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(
|
|
772
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(x), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
755
773
|
},
|
|
756
774
|
stop: function stop() {
|
|
757
775
|
this.done = !0;
|
|
@@ -803,7 +821,7 @@ function he() {
|
|
|
803
821
|
finish: function finish(e) {
|
|
804
822
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
805
823
|
var r = this.tryEntries[t];
|
|
806
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
824
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), x(r), m;
|
|
807
825
|
}
|
|
808
826
|
},
|
|
809
827
|
"catch": function _catch(e) {
|
|
@@ -813,7 +831,7 @@ function he() {
|
|
|
813
831
|
var n = r.completion;
|
|
814
832
|
if ("throw" === n.type) {
|
|
815
833
|
var i = n.arg;
|
|
816
|
-
|
|
834
|
+
x(r);
|
|
817
835
|
}
|
|
818
836
|
return i;
|
|
819
837
|
}
|
|
@@ -829,46 +847,46 @@ function he() {
|
|
|
829
847
|
}
|
|
830
848
|
}, t;
|
|
831
849
|
}
|
|
832
|
-
function
|
|
850
|
+
function me(e, t) {
|
|
833
851
|
for (var r = 0; r < t.length; r++) {
|
|
834
852
|
var n = t[r];
|
|
835
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
853
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, be(n.key), n);
|
|
836
854
|
}
|
|
837
855
|
}
|
|
838
|
-
function
|
|
839
|
-
return t &&
|
|
856
|
+
function ve(e, t, r) {
|
|
857
|
+
return t && me(e.prototype, t), r && me(e, r), Object.defineProperty(e, "prototype", {
|
|
840
858
|
writable: !1
|
|
841
859
|
}), e;
|
|
842
860
|
}
|
|
843
|
-
function
|
|
861
|
+
function be(e) {
|
|
844
862
|
var t = function (e, t) {
|
|
845
|
-
if ("object" !=
|
|
863
|
+
if ("object" != fe(e) || !e) return e;
|
|
846
864
|
var r = e[Symbol.toPrimitive];
|
|
847
865
|
if (void 0 !== r) {
|
|
848
866
|
var n = r.call(e, t || "default");
|
|
849
|
-
if ("object" !=
|
|
867
|
+
if ("object" != fe(n)) return n;
|
|
850
868
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
851
869
|
}
|
|
852
870
|
return ("string" === t ? String : Number)(e);
|
|
853
871
|
}(e, "string");
|
|
854
|
-
return "symbol" ==
|
|
872
|
+
return "symbol" == fe(t) ? t : String(t);
|
|
855
873
|
}
|
|
856
|
-
function
|
|
874
|
+
function ge(e, t) {
|
|
857
875
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
858
876
|
}
|
|
859
|
-
function
|
|
860
|
-
return t =
|
|
861
|
-
if (t && ("object" ===
|
|
877
|
+
function ye(e, t, r) {
|
|
878
|
+
return t = Pe(t), function (e, t) {
|
|
879
|
+
if (t && ("object" === fe(t) || "function" == typeof t)) return t;
|
|
862
880
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
863
881
|
return function (e) {
|
|
864
882
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
865
883
|
return e;
|
|
866
884
|
}(e);
|
|
867
|
-
}(e,
|
|
885
|
+
}(e, we() ? Reflect.construct(t, r || [], Pe(e).constructor) : t.apply(e, r));
|
|
868
886
|
}
|
|
869
|
-
function
|
|
887
|
+
function ke(e) {
|
|
870
888
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
871
|
-
return
|
|
889
|
+
return ke = function ke(e) {
|
|
872
890
|
if (null === e || !function (e) {
|
|
873
891
|
try {
|
|
874
892
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -883,12 +901,12 @@ function be(e) {
|
|
|
883
901
|
}
|
|
884
902
|
function r() {
|
|
885
903
|
return function (e, t, r) {
|
|
886
|
-
if (
|
|
904
|
+
if (we()) return Reflect.construct.apply(null, arguments);
|
|
887
905
|
var n = [null];
|
|
888
906
|
n.push.apply(n, t);
|
|
889
907
|
var i = new (e.bind.apply(e, n))();
|
|
890
|
-
return r &&
|
|
891
|
-
}(e, arguments,
|
|
908
|
+
return r && Se(i, r.prototype), i;
|
|
909
|
+
}(e, arguments, Pe(this).constructor);
|
|
892
910
|
}
|
|
893
911
|
return r.prototype = Object.create(e.prototype, {
|
|
894
912
|
constructor: {
|
|
@@ -897,38 +915,38 @@ function be(e) {
|
|
|
897
915
|
writable: !0,
|
|
898
916
|
configurable: !0
|
|
899
917
|
}
|
|
900
|
-
}),
|
|
901
|
-
},
|
|
918
|
+
}), Se(r, e);
|
|
919
|
+
}, ke(e);
|
|
902
920
|
}
|
|
903
|
-
function
|
|
921
|
+
function we() {
|
|
904
922
|
try {
|
|
905
923
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
906
924
|
} catch (e) {}
|
|
907
|
-
return (
|
|
925
|
+
return (we = function we() {
|
|
908
926
|
return !!e;
|
|
909
927
|
})();
|
|
910
928
|
}
|
|
911
|
-
function
|
|
912
|
-
return
|
|
929
|
+
function Se(e, t) {
|
|
930
|
+
return Se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
913
931
|
return e.__proto__ = t, e;
|
|
914
|
-
},
|
|
932
|
+
}, Se(e, t);
|
|
915
933
|
}
|
|
916
|
-
function
|
|
917
|
-
return
|
|
934
|
+
function Pe(e) {
|
|
935
|
+
return Pe = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
918
936
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
919
|
-
},
|
|
937
|
+
}, Pe(e);
|
|
920
938
|
}
|
|
921
939
|
!function (e) {
|
|
922
940
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
923
|
-
}(b || (b = {})), function (e) {
|
|
924
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
925
941
|
}(g || (g = {})), function (e) {
|
|
942
|
+
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
943
|
+
}(y || (y = {})), function (e) {
|
|
926
944
|
e.smsOtp = "smsOtp", e.totp = "totp";
|
|
927
945
|
}(k || (k = {})), function (e) {
|
|
928
946
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
929
|
-
}(
|
|
930
|
-
var
|
|
931
|
-
function
|
|
947
|
+
}(w || (w = {}));
|
|
948
|
+
var Ce;
|
|
949
|
+
function Te(e, t, r, n) {
|
|
932
950
|
return new (r || (r = Promise))(function (i, o) {
|
|
933
951
|
function s(e) {
|
|
934
952
|
try {
|
|
@@ -955,12 +973,12 @@ function Se(e, t, r, n) {
|
|
|
955
973
|
}
|
|
956
974
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
957
975
|
e.RequiredCatcha = "Catcha Required";
|
|
958
|
-
}(
|
|
959
|
-
var
|
|
960
|
-
|
|
976
|
+
}(Ce || (Ce = {}));
|
|
977
|
+
var Oe,
|
|
978
|
+
Ae = function (e) {
|
|
961
979
|
function t(e) {
|
|
962
980
|
var r;
|
|
963
|
-
return
|
|
981
|
+
return ge(this, t), (r = ye(this, t, [e])).type = e, r;
|
|
964
982
|
}
|
|
965
983
|
return function (e, t) {
|
|
966
984
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -972,10 +990,10 @@ var Pe,
|
|
|
972
990
|
}
|
|
973
991
|
}), Object.defineProperty(e, "prototype", {
|
|
974
992
|
writable: !1
|
|
975
|
-
}), t &&
|
|
976
|
-
}(t,
|
|
993
|
+
}), t && Se(e, t);
|
|
994
|
+
}(t, ke(Error)), ve(t);
|
|
977
995
|
}();
|
|
978
|
-
function
|
|
996
|
+
function xe(e) {
|
|
979
997
|
var t,
|
|
980
998
|
r = e.method,
|
|
981
999
|
n = e.finalURL,
|
|
@@ -983,9 +1001,9 @@ function Te(e) {
|
|
|
983
1001
|
o = e.xSDKClientHeader,
|
|
984
1002
|
s = e.xSDKParentHostHeader,
|
|
985
1003
|
a = e.body;
|
|
986
|
-
return
|
|
1004
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
987
1005
|
var c, u, l, d, h, p;
|
|
988
|
-
return
|
|
1006
|
+
return _e().wrap(function (e) {
|
|
989
1007
|
for (;;) switch (e.prev = e.next) {
|
|
990
1008
|
case 0:
|
|
991
1009
|
return c = {
|
|
@@ -1034,9 +1052,9 @@ function Te(e) {
|
|
|
1034
1052
|
e.next = 37;
|
|
1035
1053
|
break;
|
|
1036
1054
|
}
|
|
1037
|
-
throw new A(h);
|
|
1038
|
-
case 37:
|
|
1039
1055
|
throw new E(h);
|
|
1056
|
+
case 37:
|
|
1057
|
+
throw new D(h);
|
|
1040
1058
|
case 38:
|
|
1041
1059
|
return e.prev = 38, e.next = 41, l.text();
|
|
1042
1060
|
case 41:
|
|
@@ -1049,7 +1067,7 @@ function Te(e) {
|
|
|
1049
1067
|
e.next = 49;
|
|
1050
1068
|
break;
|
|
1051
1069
|
}
|
|
1052
|
-
throw new Ce
|
|
1070
|
+
throw new Ae(Ce.RequiredCatcha);
|
|
1053
1071
|
case 49:
|
|
1054
1072
|
throw new x("Invalid response from the Stytch servers.");
|
|
1055
1073
|
case 50:
|
|
@@ -1059,43 +1077,43 @@ function Te(e) {
|
|
|
1059
1077
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1060
1078
|
}));
|
|
1061
1079
|
}
|
|
1062
|
-
var
|
|
1063
|
-
function
|
|
1064
|
-
if (!
|
|
1065
|
-
return
|
|
1080
|
+
var Ee = new Uint8Array(16);
|
|
1081
|
+
function De() {
|
|
1082
|
+
if (!Oe && !(Oe = "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");
|
|
1083
|
+
return Oe(Ee);
|
|
1066
1084
|
}
|
|
1067
|
-
var
|
|
1068
|
-
for (var
|
|
1069
|
-
function
|
|
1085
|
+
var Ie = /^(?:[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;
|
|
1086
|
+
for (var Re = [], je = 0; je < 256; ++je) Re.push((je + 256).toString(16).substr(1));
|
|
1087
|
+
function Fe(e) {
|
|
1070
1088
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1071
|
-
r = (
|
|
1089
|
+
r = (Re[e[t + 0]] + Re[e[t + 1]] + Re[e[t + 2]] + Re[e[t + 3]] + "-" + Re[e[t + 4]] + Re[e[t + 5]] + "-" + Re[e[t + 6]] + Re[e[t + 7]] + "-" + Re[e[t + 8]] + Re[e[t + 9]] + "-" + Re[e[t + 10]] + Re[e[t + 11]] + Re[e[t + 12]] + Re[e[t + 13]] + Re[e[t + 14]] + Re[e[t + 15]]).toLowerCase();
|
|
1072
1090
|
if (!function (e) {
|
|
1073
|
-
return "string" == typeof e &&
|
|
1091
|
+
return "string" == typeof e && Ie.test(e);
|
|
1074
1092
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1075
1093
|
return r;
|
|
1076
1094
|
}
|
|
1077
|
-
function
|
|
1078
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1095
|
+
function Le(e, t, r) {
|
|
1096
|
+
var n = (e = e || {}).random || (e.rng || De)();
|
|
1079
1097
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1080
1098
|
r = r || 0;
|
|
1081
1099
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1082
1100
|
return t;
|
|
1083
1101
|
}
|
|
1084
|
-
return
|
|
1102
|
+
return Fe(n);
|
|
1085
1103
|
}
|
|
1086
|
-
var
|
|
1087
|
-
function
|
|
1088
|
-
return
|
|
1089
|
-
return
|
|
1104
|
+
var Me = {};
|
|
1105
|
+
function Be(e, t) {
|
|
1106
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
1107
|
+
return _e().wrap(function (r) {
|
|
1090
1108
|
for (;;) switch (r.prev = r.next) {
|
|
1091
1109
|
case 0:
|
|
1092
|
-
if (void 0 ===
|
|
1110
|
+
if (void 0 === Me[e]) {
|
|
1093
1111
|
r.next = 2;
|
|
1094
1112
|
break;
|
|
1095
1113
|
}
|
|
1096
|
-
return r.abrupt("return",
|
|
1114
|
+
return r.abrupt("return", Me[e]);
|
|
1097
1115
|
case 2:
|
|
1098
|
-
return
|
|
1116
|
+
return Me[e] = Ke(e, t), r.abrupt("return", Me[e]);
|
|
1099
1117
|
case 4:
|
|
1100
1118
|
case "end":
|
|
1101
1119
|
return r.stop();
|
|
@@ -1103,10 +1121,10 @@ function Fe(e, t) {
|
|
|
1103
1121
|
}, r);
|
|
1104
1122
|
}));
|
|
1105
1123
|
}
|
|
1106
|
-
function
|
|
1124
|
+
function Ke(e, t) {
|
|
1107
1125
|
return new Promise(function (r, n) {
|
|
1108
1126
|
var i = function (e) {
|
|
1109
|
-
var t =
|
|
1127
|
+
var t = ze(e);
|
|
1110
1128
|
if (t[0]) return t[0];
|
|
1111
1129
|
}(e);
|
|
1112
1130
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1130,47 +1148,47 @@ function Le(e, t) {
|
|
|
1130
1148
|
});
|
|
1131
1149
|
});
|
|
1132
1150
|
}
|
|
1133
|
-
var
|
|
1151
|
+
var ze = function ze(e) {
|
|
1134
1152
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1135
1153
|
};
|
|
1136
|
-
var
|
|
1137
|
-
|
|
1138
|
-
|
|
1154
|
+
var Ne,
|
|
1155
|
+
Ue = ["[Stytch]"],
|
|
1156
|
+
qe = function qe() {
|
|
1139
1157
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1140
|
-
return (e = console).warn.apply(e,
|
|
1158
|
+
return (e = console).warn.apply(e, Ue.concat(r));
|
|
1141
1159
|
},
|
|
1142
|
-
|
|
1160
|
+
We = function We() {
|
|
1143
1161
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1144
|
-
return (e = console).error.apply(e,
|
|
1162
|
+
return (e = console).error.apply(e, Ue.concat(r));
|
|
1145
1163
|
},
|
|
1146
|
-
|
|
1147
|
-
|
|
1164
|
+
He = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1165
|
+
Ge = function Ge(e) {
|
|
1148
1166
|
return e.includes("public-token-test");
|
|
1149
1167
|
},
|
|
1150
|
-
|
|
1168
|
+
Ve = function Ve(e) {
|
|
1151
1169
|
var t = {
|
|
1152
1170
|
isObject: function isObject(r, n) {
|
|
1153
|
-
var i = "object" ===
|
|
1154
|
-
if (!i) throw new
|
|
1171
|
+
var i = "object" === fe(n) && !Array.isArray(n) && null !== n;
|
|
1172
|
+
if (!i) throw new P(e, r + " must be an object.");
|
|
1155
1173
|
return t;
|
|
1156
1174
|
},
|
|
1157
1175
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1158
1176
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1159
1177
|
},
|
|
1160
1178
|
isString: function isString(r, n) {
|
|
1161
|
-
if ("string" != typeof n) throw new
|
|
1179
|
+
if ("string" != typeof n) throw new P(e, r + " must be a string.");
|
|
1162
1180
|
return t;
|
|
1163
1181
|
},
|
|
1164
1182
|
isOptionalString: function isOptionalString(e, r) {
|
|
1165
1183
|
return void 0 === r ? t : t.isString(e, r);
|
|
1166
1184
|
},
|
|
1167
1185
|
isStringArray: function isStringArray(r, n) {
|
|
1168
|
-
if (!Array.isArray(n)) throw new
|
|
1186
|
+
if (!Array.isArray(n)) throw new P(e, r + " must be an array of strings.");
|
|
1169
1187
|
var i,
|
|
1170
1188
|
o = function (e, t) {
|
|
1171
1189
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1172
1190
|
if (!r) {
|
|
1173
|
-
if (Array.isArray(e) || (r =
|
|
1191
|
+
if (Array.isArray(e) || (r = he(e)) || t && e && "number" == typeof e.length) {
|
|
1174
1192
|
r && (e = r);
|
|
1175
1193
|
var _n = 0,
|
|
1176
1194
|
i = function i() {};
|
|
@@ -1217,7 +1235,7 @@ var Be,
|
|
|
1217
1235
|
}(n);
|
|
1218
1236
|
try {
|
|
1219
1237
|
for (o.s(); !(i = o.n()).done;) {
|
|
1220
|
-
if ("string" != typeof i.value) throw new
|
|
1238
|
+
if ("string" != typeof i.value) throw new P(e, r + " must be an array of strings.");
|
|
1221
1239
|
}
|
|
1222
1240
|
} catch (e) {
|
|
1223
1241
|
o.e(e);
|
|
@@ -1230,14 +1248,14 @@ var Be,
|
|
|
1230
1248
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1231
1249
|
},
|
|
1232
1250
|
isNumber: function isNumber(r, n) {
|
|
1233
|
-
if ("number" != typeof n) throw new
|
|
1251
|
+
if ("number" != typeof n) throw new P(e, r + " must be a number.");
|
|
1234
1252
|
return t;
|
|
1235
1253
|
},
|
|
1236
1254
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1237
1255
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1238
1256
|
},
|
|
1239
1257
|
isBoolean: function isBoolean(r, n) {
|
|
1240
|
-
if ("boolean" != typeof n) throw new
|
|
1258
|
+
if ("boolean" != typeof n) throw new P(e, r + " must be a boolean.");
|
|
1241
1259
|
return t;
|
|
1242
1260
|
},
|
|
1243
1261
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1246,14 +1264,14 @@ var Be,
|
|
|
1246
1264
|
};
|
|
1247
1265
|
return t;
|
|
1248
1266
|
},
|
|
1249
|
-
|
|
1267
|
+
Ye = ve(function e(t, r, n) {
|
|
1250
1268
|
var i = this,
|
|
1251
1269
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1252
1270
|
return Promise.resolve(void 0);
|
|
1253
1271
|
};
|
|
1254
|
-
|
|
1255
|
-
return
|
|
1256
|
-
return
|
|
1272
|
+
ge(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1273
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1274
|
+
return _e().wrap(function (e) {
|
|
1257
1275
|
for (;;) switch (e.prev = e.next) {
|
|
1258
1276
|
case 0:
|
|
1259
1277
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1266,9 +1284,9 @@ var Be,
|
|
|
1266
1284
|
}, e, this);
|
|
1267
1285
|
}));
|
|
1268
1286
|
}, this.getTelemetryID = function () {
|
|
1269
|
-
return
|
|
1287
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1270
1288
|
var t, r, n, i;
|
|
1271
|
-
return
|
|
1289
|
+
return _e().wrap(function (e) {
|
|
1272
1290
|
for (;;) switch (e.prev = e.next) {
|
|
1273
1291
|
case 0:
|
|
1274
1292
|
return e.next = 2, this.state;
|
|
@@ -1289,9 +1307,9 @@ var Be,
|
|
|
1289
1307
|
}, e, this);
|
|
1290
1308
|
}));
|
|
1291
1309
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1292
|
-
return
|
|
1310
|
+
return Te(i, void 0, void 0, _e().mark(function e() {
|
|
1293
1311
|
var t, r, n, i, o, s;
|
|
1294
|
-
return
|
|
1312
|
+
return _e().wrap(function (e) {
|
|
1295
1313
|
for (;;) switch (e.prev = e.next) {
|
|
1296
1314
|
case 0:
|
|
1297
1315
|
return e.next = 2, this.state;
|
|
@@ -1334,14 +1352,14 @@ var Be,
|
|
|
1334
1352
|
}, e, this);
|
|
1335
1353
|
}));
|
|
1336
1354
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1337
|
-
return
|
|
1355
|
+
return Te(i, void 0, void 0, _e().mark(function r() {
|
|
1338
1356
|
var n, i, o;
|
|
1339
|
-
return
|
|
1357
|
+
return _e().wrap(function (r) {
|
|
1340
1358
|
for (;;) switch (r.prev = r.next) {
|
|
1341
1359
|
case 0:
|
|
1342
1360
|
return r.next = 2, this.state;
|
|
1343
1361
|
case 2:
|
|
1344
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1362
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== Ce.RequiredCatcha || !i) {
|
|
1345
1363
|
r.next = 14;
|
|
1346
1364
|
break;
|
|
1347
1365
|
}
|
|
@@ -1365,8 +1383,8 @@ var Be,
|
|
|
1365
1383
|
}, r, this);
|
|
1366
1384
|
}));
|
|
1367
1385
|
}, this.state = n.then(function (e) {
|
|
1368
|
-
return
|
|
1369
|
-
return
|
|
1386
|
+
return Te(i, void 0, void 0, _e().mark(function n() {
|
|
1387
|
+
return _e().wrap(function (n) {
|
|
1370
1388
|
for (;;) switch (n.prev = n.next) {
|
|
1371
1389
|
case 0:
|
|
1372
1390
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1381,7 +1399,7 @@ var Be,
|
|
|
1381
1399
|
executeRecaptcha: o
|
|
1382
1400
|
});
|
|
1383
1401
|
case 2:
|
|
1384
|
-
return n.next = 4, void
|
|
1402
|
+
return n.next = 4, void Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1385
1403
|
return window;
|
|
1386
1404
|
});
|
|
1387
1405
|
case 4:
|
|
@@ -1401,11 +1419,11 @@ var Be,
|
|
|
1401
1419
|
}));
|
|
1402
1420
|
});
|
|
1403
1421
|
}),
|
|
1404
|
-
|
|
1422
|
+
Je = function Je() {
|
|
1405
1423
|
return {
|
|
1406
1424
|
isEnabled: function isEnabled() {
|
|
1407
|
-
return
|
|
1408
|
-
return
|
|
1425
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1426
|
+
return _e().wrap(function (e) {
|
|
1409
1427
|
for (;;) switch (e.prev = e.next) {
|
|
1410
1428
|
case 0:
|
|
1411
1429
|
return e.abrupt("return", !1);
|
|
@@ -1417,8 +1435,8 @@ var Be,
|
|
|
1417
1435
|
}));
|
|
1418
1436
|
},
|
|
1419
1437
|
getTelemetryID: function getTelemetryID() {
|
|
1420
|
-
return
|
|
1421
|
-
return
|
|
1438
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1439
|
+
return _e().wrap(function (e) {
|
|
1422
1440
|
for (;;) switch (e.prev = e.next) {
|
|
1423
1441
|
case 0:
|
|
1424
1442
|
return e.abrupt("return", void 0);
|
|
@@ -1430,8 +1448,8 @@ var Be,
|
|
|
1430
1448
|
}));
|
|
1431
1449
|
},
|
|
1432
1450
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1433
|
-
return
|
|
1434
|
-
return
|
|
1451
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1452
|
+
return _e().wrap(function (e) {
|
|
1435
1453
|
for (;;) switch (e.prev = e.next) {
|
|
1436
1454
|
case 0:
|
|
1437
1455
|
return e.abrupt("return", {
|
|
@@ -1446,8 +1464,8 @@ var Be,
|
|
|
1446
1464
|
}));
|
|
1447
1465
|
},
|
|
1448
1466
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1449
|
-
return
|
|
1450
|
-
return
|
|
1467
|
+
return Te(void 0, void 0, void 0, _e().mark(function e() {
|
|
1468
|
+
return _e().wrap(function (e) {
|
|
1451
1469
|
for (;;) switch (e.prev = e.next) {
|
|
1452
1470
|
case 0:
|
|
1453
1471
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1460,11 +1478,11 @@ var Be,
|
|
|
1460
1478
|
}
|
|
1461
1479
|
};
|
|
1462
1480
|
},
|
|
1463
|
-
|
|
1481
|
+
$e = function () {
|
|
1464
1482
|
function e() {
|
|
1465
|
-
|
|
1483
|
+
ge(this, e);
|
|
1466
1484
|
}
|
|
1467
|
-
return
|
|
1485
|
+
return ve(e, null, [{
|
|
1468
1486
|
key: "marshall",
|
|
1469
1487
|
value: function value(e) {
|
|
1470
1488
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1484,17 +1502,17 @@ var Be,
|
|
|
1484
1502
|
value: function value(t) {
|
|
1485
1503
|
if ("name" in t) switch (t.name) {
|
|
1486
1504
|
case "SDKAPIUnreachableError":
|
|
1487
|
-
return e.inflate(
|
|
1505
|
+
return e.inflate(S, t);
|
|
1488
1506
|
case "StytchSDKSchemaError":
|
|
1489
|
-
return e.inflate(
|
|
1507
|
+
return e.inflate(C, t);
|
|
1490
1508
|
case "StytchAPIUnreachableError":
|
|
1491
1509
|
return e.inflate(x, t);
|
|
1492
1510
|
case "StytchAPISchemaError":
|
|
1493
|
-
return e.inflate(
|
|
1511
|
+
return e.inflate(E, t);
|
|
1494
1512
|
case "StytchSDKAPIError":
|
|
1495
|
-
return e.inflate(
|
|
1513
|
+
return e.inflate(T, t);
|
|
1496
1514
|
case "StytchAPIError":
|
|
1497
|
-
return e.inflate(
|
|
1515
|
+
return e.inflate(D, t);
|
|
1498
1516
|
case "TypeError":
|
|
1499
1517
|
return e.inflate(TypeError, t);
|
|
1500
1518
|
case "SyntaxError":
|
|
@@ -1512,11 +1530,11 @@ var Be,
|
|
|
1512
1530
|
}
|
|
1513
1531
|
}]), e;
|
|
1514
1532
|
}(),
|
|
1515
|
-
|
|
1533
|
+
Xe = function () {
|
|
1516
1534
|
function e(t) {
|
|
1517
|
-
|
|
1535
|
+
ge(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1518
1536
|
}
|
|
1519
|
-
return
|
|
1537
|
+
return ve(e, [{
|
|
1520
1538
|
key: "logEvent",
|
|
1521
1539
|
value: function value(e, t) {
|
|
1522
1540
|
this.batch.push({
|
|
@@ -1527,9 +1545,9 @@ var Be,
|
|
|
1527
1545
|
}, {
|
|
1528
1546
|
key: "flush",
|
|
1529
1547
|
value: function value() {
|
|
1530
|
-
return
|
|
1548
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
1531
1549
|
var t;
|
|
1532
|
-
return
|
|
1550
|
+
return _e().wrap(function (e) {
|
|
1533
1551
|
for (;;) switch (e.prev = e.next) {
|
|
1534
1552
|
case 0:
|
|
1535
1553
|
if (this.batch.length) {
|
|
@@ -1561,26 +1579,26 @@ var Be,
|
|
|
1561
1579
|
}();
|
|
1562
1580
|
!function (e) {
|
|
1563
1581
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1564
|
-
}(
|
|
1582
|
+
}(Ne || (Ne = {})), Promise.resolve({
|
|
1565
1583
|
pkceRequiredForEmailMagicLinks: !1
|
|
1566
1584
|
}), Promise.resolve({
|
|
1567
1585
|
pkceRequiredForPasswordResets: !1
|
|
1568
1586
|
});
|
|
1569
|
-
var
|
|
1587
|
+
var Ze = Promise.resolve({
|
|
1570
1588
|
pkceRequiredForEmailMagicLinks: !1
|
|
1571
1589
|
}),
|
|
1572
|
-
|
|
1590
|
+
Qe = function () {
|
|
1573
1591
|
function e(t, r, n, i) {
|
|
1574
1592
|
var o = this,
|
|
1575
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1576
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1577
|
-
|
|
1593
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ze,
|
|
1594
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
1595
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1578
1596
|
invite: function invite(e) {
|
|
1579
|
-
return
|
|
1580
|
-
return
|
|
1597
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1598
|
+
return _e().wrap(function (t) {
|
|
1581
1599
|
for (;;) switch (t.prev = t.next) {
|
|
1582
1600
|
case 0:
|
|
1583
|
-
return
|
|
1601
|
+
return Ve("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({
|
|
1584
1602
|
url: "/b2b/magic_links/email/invite",
|
|
1585
1603
|
body: e,
|
|
1586
1604
|
errorMessage: "Failed to send invite.",
|
|
@@ -1594,12 +1612,12 @@ var Je = Promise.resolve({
|
|
|
1594
1612
|
}));
|
|
1595
1613
|
},
|
|
1596
1614
|
loginOrSignup: function loginOrSignup(e) {
|
|
1597
|
-
return
|
|
1615
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1598
1616
|
var r, n;
|
|
1599
|
-
return
|
|
1617
|
+
return _e().wrap(function (t) {
|
|
1600
1618
|
for (;;) switch (t.prev = t.next) {
|
|
1601
1619
|
case 0:
|
|
1602
|
-
return
|
|
1620
|
+
return Ve("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();
|
|
1603
1621
|
case 3:
|
|
1604
1622
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1605
1623
|
pkce_code_challenge: r
|
|
@@ -1618,12 +1636,12 @@ var Je = Promise.resolve({
|
|
|
1618
1636
|
},
|
|
1619
1637
|
discovery: {
|
|
1620
1638
|
send: function send(e) {
|
|
1621
|
-
return
|
|
1639
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1622
1640
|
var r, n;
|
|
1623
|
-
return
|
|
1641
|
+
return _e().wrap(function (t) {
|
|
1624
1642
|
for (;;) switch (t.prev = t.next) {
|
|
1625
1643
|
case 0:
|
|
1626
|
-
return
|
|
1644
|
+
return Ve("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();
|
|
1627
1645
|
case 3:
|
|
1628
1646
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1629
1647
|
pkce_code_challenge: r
|
|
@@ -1642,12 +1660,12 @@ var Je = Promise.resolve({
|
|
|
1642
1660
|
}
|
|
1643
1661
|
}
|
|
1644
1662
|
}, this.authenticate = function (e) {
|
|
1645
|
-
return
|
|
1663
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1646
1664
|
var r, n;
|
|
1647
|
-
return
|
|
1665
|
+
return _e().wrap(function (t) {
|
|
1648
1666
|
for (;;) switch (t.prev = t.next) {
|
|
1649
1667
|
case 0:
|
|
1650
|
-
return
|
|
1668
|
+
return Ve("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();
|
|
1651
1669
|
case 3:
|
|
1652
1670
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1653
1671
|
t.next = 19;
|
|
@@ -1698,12 +1716,12 @@ var Je = Promise.resolve({
|
|
|
1698
1716
|
}));
|
|
1699
1717
|
}, this.discovery = {
|
|
1700
1718
|
authenticate: function authenticate(e) {
|
|
1701
|
-
return
|
|
1719
|
+
return Te(o, void 0, void 0, _e().mark(function t() {
|
|
1702
1720
|
var r, n, i, o, s, a;
|
|
1703
|
-
return
|
|
1721
|
+
return _e().wrap(function (t) {
|
|
1704
1722
|
for (;;) switch (t.prev = t.next) {
|
|
1705
1723
|
case 0:
|
|
1706
|
-
return
|
|
1724
|
+
return Ve("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1707
1725
|
case 3:
|
|
1708
1726
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1709
1727
|
case 6:
|
|
@@ -1734,12 +1752,12 @@ var Je = Promise.resolve({
|
|
|
1734
1752
|
}
|
|
1735
1753
|
};
|
|
1736
1754
|
}
|
|
1737
|
-
return
|
|
1755
|
+
return ve(e, [{
|
|
1738
1756
|
key: "getCodeChallenge",
|
|
1739
1757
|
value: function value() {
|
|
1740
|
-
return
|
|
1758
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
1741
1759
|
var t, r;
|
|
1742
|
-
return
|
|
1760
|
+
return _e().wrap(function (e) {
|
|
1743
1761
|
for (;;) switch (e.prev = e.next) {
|
|
1744
1762
|
case 0:
|
|
1745
1763
|
return e.next = 2, this._config;
|
|
@@ -1771,9 +1789,9 @@ var Je = Promise.resolve({
|
|
|
1771
1789
|
}, {
|
|
1772
1790
|
key: "handlePKCEForAuthenticate",
|
|
1773
1791
|
value: function value(e, t) {
|
|
1774
|
-
return
|
|
1792
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
1775
1793
|
var n, i, o, s, a, c;
|
|
1776
|
-
return
|
|
1794
|
+
return _e().wrap(function (r) {
|
|
1777
1795
|
for (;;) switch (r.prev = r.next) {
|
|
1778
1796
|
case 0:
|
|
1779
1797
|
return r.next = 2, e.getPKPair();
|
|
@@ -1802,12 +1820,12 @@ var Je = Promise.resolve({
|
|
|
1802
1820
|
}
|
|
1803
1821
|
}]), e;
|
|
1804
1822
|
}(),
|
|
1805
|
-
|
|
1823
|
+
et = ve(function e(t, r) {
|
|
1806
1824
|
var n = this;
|
|
1807
|
-
|
|
1808
|
-
return
|
|
1825
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1826
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1809
1827
|
var t;
|
|
1810
|
-
return
|
|
1828
|
+
return _e().wrap(function (e) {
|
|
1811
1829
|
for (;;) switch (e.prev = e.next) {
|
|
1812
1830
|
case 0:
|
|
1813
1831
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1831,12 +1849,12 @@ var Je = Promise.resolve({
|
|
|
1831
1849
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1832
1850
|
});
|
|
1833
1851
|
}, this.update = function (e) {
|
|
1834
|
-
return
|
|
1852
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
1835
1853
|
var r;
|
|
1836
|
-
return
|
|
1854
|
+
return _e().wrap(function (t) {
|
|
1837
1855
|
for (;;) switch (t.prev = t.next) {
|
|
1838
1856
|
case 0:
|
|
1839
|
-
return
|
|
1857
|
+
return Ve("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({
|
|
1840
1858
|
url: "/b2b/organizations/members/update",
|
|
1841
1859
|
body: e,
|
|
1842
1860
|
errorMessage: "Failed to update member.",
|
|
@@ -1851,9 +1869,9 @@ var Je = Promise.resolve({
|
|
|
1851
1869
|
}, t, this);
|
|
1852
1870
|
}));
|
|
1853
1871
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1854
|
-
return
|
|
1872
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1855
1873
|
var t;
|
|
1856
|
-
return
|
|
1874
|
+
return _e().wrap(function (e) {
|
|
1857
1875
|
for (;;) switch (e.prev = e.next) {
|
|
1858
1876
|
case 0:
|
|
1859
1877
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1870,9 +1888,9 @@ var Je = Promise.resolve({
|
|
|
1870
1888
|
}, e, this);
|
|
1871
1889
|
}));
|
|
1872
1890
|
}, this.deleteMFATOTP = function () {
|
|
1873
|
-
return
|
|
1891
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
1874
1892
|
var t;
|
|
1875
|
-
return
|
|
1893
|
+
return _e().wrap(function (e) {
|
|
1876
1894
|
for (;;) switch (e.prev = e.next) {
|
|
1877
1895
|
case 0:
|
|
1878
1896
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1889,9 +1907,9 @@ var Je = Promise.resolve({
|
|
|
1889
1907
|
}, e, this);
|
|
1890
1908
|
}));
|
|
1891
1909
|
}, this.deletePassword = function (e) {
|
|
1892
|
-
return
|
|
1910
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
1893
1911
|
var r;
|
|
1894
|
-
return
|
|
1912
|
+
return _e().wrap(function (t) {
|
|
1895
1913
|
for (;;) switch (t.prev = t.next) {
|
|
1896
1914
|
case 0:
|
|
1897
1915
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1909,14 +1927,14 @@ var Je = Promise.resolve({
|
|
|
1909
1927
|
}));
|
|
1910
1928
|
};
|
|
1911
1929
|
}),
|
|
1912
|
-
|
|
1930
|
+
tt = function () {
|
|
1913
1931
|
function e(t, r, n, i, o) {
|
|
1914
1932
|
var s = this,
|
|
1915
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1916
|
-
|
|
1933
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
1934
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1917
1935
|
createConnection: function createConnection(e) {
|
|
1918
|
-
return
|
|
1919
|
-
return
|
|
1936
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1937
|
+
return _e().wrap(function (t) {
|
|
1920
1938
|
for (;;) switch (t.prev = t.next) {
|
|
1921
1939
|
case 0:
|
|
1922
1940
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1935,8 +1953,8 @@ var Je = Promise.resolve({
|
|
|
1935
1953
|
}));
|
|
1936
1954
|
},
|
|
1937
1955
|
updateConnection: function updateConnection(e) {
|
|
1938
|
-
return
|
|
1939
|
-
return
|
|
1956
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1957
|
+
return _e().wrap(function (t) {
|
|
1940
1958
|
for (;;) switch (t.prev = t.next) {
|
|
1941
1959
|
case 0:
|
|
1942
1960
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1955,8 +1973,8 @@ var Je = Promise.resolve({
|
|
|
1955
1973
|
}));
|
|
1956
1974
|
},
|
|
1957
1975
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1958
|
-
return
|
|
1959
|
-
return
|
|
1976
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1977
|
+
return _e().wrap(function (t) {
|
|
1960
1978
|
for (;;) switch (t.prev = t.next) {
|
|
1961
1979
|
case 0:
|
|
1962
1980
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1975,8 +1993,8 @@ var Je = Promise.resolve({
|
|
|
1975
1993
|
}));
|
|
1976
1994
|
},
|
|
1977
1995
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1978
|
-
return
|
|
1979
|
-
return
|
|
1996
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
1997
|
+
return _e().wrap(function (t) {
|
|
1980
1998
|
for (;;) switch (t.prev = t.next) {
|
|
1981
1999
|
case 0:
|
|
1982
2000
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1995,8 +2013,8 @@ var Je = Promise.resolve({
|
|
|
1995
2013
|
}
|
|
1996
2014
|
}, this.oidc = {
|
|
1997
2015
|
createConnection: function createConnection(e) {
|
|
1998
|
-
return
|
|
1999
|
-
return
|
|
2016
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2017
|
+
return _e().wrap(function (t) {
|
|
2000
2018
|
for (;;) switch (t.prev = t.next) {
|
|
2001
2019
|
case 0:
|
|
2002
2020
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2015,8 +2033,8 @@ var Je = Promise.resolve({
|
|
|
2015
2033
|
}));
|
|
2016
2034
|
},
|
|
2017
2035
|
updateConnection: function updateConnection(e) {
|
|
2018
|
-
return
|
|
2019
|
-
return
|
|
2036
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2037
|
+
return _e().wrap(function (t) {
|
|
2020
2038
|
for (;;) switch (t.prev = t.next) {
|
|
2021
2039
|
case 0:
|
|
2022
2040
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2036,17 +2054,17 @@ var Je = Promise.resolve({
|
|
|
2036
2054
|
}
|
|
2037
2055
|
};
|
|
2038
2056
|
}
|
|
2039
|
-
return
|
|
2057
|
+
return ve(e, [{
|
|
2040
2058
|
key: "authenticate",
|
|
2041
2059
|
value: function value(e) {
|
|
2042
|
-
return
|
|
2060
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2043
2061
|
var r, n, i, o, s;
|
|
2044
|
-
return
|
|
2062
|
+
return _e().wrap(function (t) {
|
|
2045
2063
|
for (;;) switch (t.prev = t.next) {
|
|
2046
2064
|
case 0:
|
|
2047
|
-
return
|
|
2065
|
+
return Ve("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();
|
|
2048
2066
|
case 3:
|
|
2049
|
-
return (r = t.sent) ||
|
|
2067
|
+
return (r = t.sent) || qe("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();
|
|
2050
2068
|
case 7:
|
|
2051
2069
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2052
2070
|
url: "/b2b/sso/authenticate",
|
|
@@ -2086,11 +2104,11 @@ var Je = Promise.resolve({
|
|
|
2086
2104
|
}, {
|
|
2087
2105
|
key: "getBaseApiUrl",
|
|
2088
2106
|
value: function value() {
|
|
2089
|
-
return
|
|
2090
|
-
return
|
|
2107
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2108
|
+
return _e().wrap(function (e) {
|
|
2091
2109
|
for (;;) switch (e.prev = e.next) {
|
|
2092
2110
|
case 0:
|
|
2093
|
-
if (!
|
|
2111
|
+
if (!Ge(this._config.publicToken)) {
|
|
2094
2112
|
e.next = 2;
|
|
2095
2113
|
break;
|
|
2096
2114
|
}
|
|
@@ -2110,9 +2128,9 @@ var Je = Promise.resolve({
|
|
|
2110
2128
|
var t = e.connection_id,
|
|
2111
2129
|
r = e.login_redirect_url,
|
|
2112
2130
|
n = e.signup_redirect_url;
|
|
2113
|
-
return
|
|
2131
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2114
2132
|
var i, o, s, a, c;
|
|
2115
|
-
return
|
|
2133
|
+
return _e().wrap(function (e) {
|
|
2116
2134
|
for (;;) switch (e.prev = e.next) {
|
|
2117
2135
|
case 0:
|
|
2118
2136
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2141,8 +2159,8 @@ var Je = Promise.resolve({
|
|
|
2141
2159
|
}, {
|
|
2142
2160
|
key: "getConnections",
|
|
2143
2161
|
value: function value() {
|
|
2144
|
-
return
|
|
2145
|
-
return
|
|
2162
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2163
|
+
return _e().wrap(function (e) {
|
|
2146
2164
|
for (;;) switch (e.prev = e.next) {
|
|
2147
2165
|
case 0:
|
|
2148
2166
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2162,8 +2180,8 @@ var Je = Promise.resolve({
|
|
|
2162
2180
|
}, {
|
|
2163
2181
|
key: "deleteConnection",
|
|
2164
2182
|
value: function value(e) {
|
|
2165
|
-
return
|
|
2166
|
-
return
|
|
2183
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2184
|
+
return _e().wrap(function (t) {
|
|
2167
2185
|
for (;;) switch (t.prev = t.next) {
|
|
2168
2186
|
case 0:
|
|
2169
2187
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2180,12 +2198,12 @@ var Je = Promise.resolve({
|
|
|
2180
2198
|
}
|
|
2181
2199
|
}]), e;
|
|
2182
2200
|
}(),
|
|
2183
|
-
|
|
2201
|
+
rt = ve(function e(t, r) {
|
|
2184
2202
|
var n = this;
|
|
2185
|
-
|
|
2186
|
-
return
|
|
2203
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2204
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2187
2205
|
var t;
|
|
2188
|
-
return
|
|
2206
|
+
return _e().wrap(function (e) {
|
|
2189
2207
|
for (;;) switch (e.prev = e.next) {
|
|
2190
2208
|
case 0:
|
|
2191
2209
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2209,9 +2227,9 @@ var Je = Promise.resolve({
|
|
|
2209
2227
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2210
2228
|
});
|
|
2211
2229
|
}, this.update = function (e) {
|
|
2212
|
-
return
|
|
2230
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2213
2231
|
var r;
|
|
2214
|
-
return
|
|
2232
|
+
return _e().wrap(function (t) {
|
|
2215
2233
|
for (;;) switch (t.prev = t.next) {
|
|
2216
2234
|
case 0:
|
|
2217
2235
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2229,9 +2247,9 @@ var Je = Promise.resolve({
|
|
|
2229
2247
|
}, t, this);
|
|
2230
2248
|
}));
|
|
2231
2249
|
}, this["delete"] = function () {
|
|
2232
|
-
return
|
|
2250
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2233
2251
|
var t;
|
|
2234
|
-
return
|
|
2252
|
+
return _e().wrap(function (e) {
|
|
2235
2253
|
for (;;) switch (e.prev = e.next) {
|
|
2236
2254
|
case 0:
|
|
2237
2255
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2249,8 +2267,8 @@ var Je = Promise.resolve({
|
|
|
2249
2267
|
}));
|
|
2250
2268
|
}, this.members = {
|
|
2251
2269
|
create: function create(e) {
|
|
2252
|
-
return
|
|
2253
|
-
return
|
|
2270
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2271
|
+
return _e().wrap(function (t) {
|
|
2254
2272
|
for (;;) switch (t.prev = t.next) {
|
|
2255
2273
|
case 0:
|
|
2256
2274
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2267,8 +2285,8 @@ var Je = Promise.resolve({
|
|
|
2267
2285
|
}));
|
|
2268
2286
|
},
|
|
2269
2287
|
search: function search(e) {
|
|
2270
|
-
return
|
|
2271
|
-
return
|
|
2288
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2289
|
+
return _e().wrap(function (t) {
|
|
2272
2290
|
for (;;) switch (t.prev = t.next) {
|
|
2273
2291
|
case 0:
|
|
2274
2292
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2285,8 +2303,8 @@ var Je = Promise.resolve({
|
|
|
2285
2303
|
}));
|
|
2286
2304
|
},
|
|
2287
2305
|
update: function update(e) {
|
|
2288
|
-
return
|
|
2289
|
-
return
|
|
2306
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2307
|
+
return _e().wrap(function (t) {
|
|
2290
2308
|
for (;;) switch (t.prev = t.next) {
|
|
2291
2309
|
case 0:
|
|
2292
2310
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2303,8 +2321,8 @@ var Je = Promise.resolve({
|
|
|
2303
2321
|
}));
|
|
2304
2322
|
},
|
|
2305
2323
|
deletePassword: function deletePassword(e) {
|
|
2306
|
-
return
|
|
2307
|
-
return
|
|
2324
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2325
|
+
return _e().wrap(function (t) {
|
|
2308
2326
|
for (;;) switch (t.prev = t.next) {
|
|
2309
2327
|
case 0:
|
|
2310
2328
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2320,8 +2338,8 @@ var Je = Promise.resolve({
|
|
|
2320
2338
|
}));
|
|
2321
2339
|
},
|
|
2322
2340
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2323
|
-
return
|
|
2324
|
-
return
|
|
2341
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2342
|
+
return _e().wrap(function (t) {
|
|
2325
2343
|
for (;;) switch (t.prev = t.next) {
|
|
2326
2344
|
case 0:
|
|
2327
2345
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2337,8 +2355,8 @@ var Je = Promise.resolve({
|
|
|
2337
2355
|
}));
|
|
2338
2356
|
},
|
|
2339
2357
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2340
|
-
return
|
|
2341
|
-
return
|
|
2358
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2359
|
+
return _e().wrap(function (t) {
|
|
2342
2360
|
for (;;) switch (t.prev = t.next) {
|
|
2343
2361
|
case 0:
|
|
2344
2362
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2354,8 +2372,8 @@ var Je = Promise.resolve({
|
|
|
2354
2372
|
}));
|
|
2355
2373
|
},
|
|
2356
2374
|
"delete": function _delete(e) {
|
|
2357
|
-
return
|
|
2358
|
-
return
|
|
2375
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2376
|
+
return _e().wrap(function (t) {
|
|
2359
2377
|
for (;;) switch (t.prev = t.next) {
|
|
2360
2378
|
case 0:
|
|
2361
2379
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2371,8 +2389,8 @@ var Je = Promise.resolve({
|
|
|
2371
2389
|
}));
|
|
2372
2390
|
},
|
|
2373
2391
|
reactivate: function reactivate(e) {
|
|
2374
|
-
return
|
|
2375
|
-
return
|
|
2392
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2393
|
+
return _e().wrap(function (t) {
|
|
2376
2394
|
for (;;) switch (t.prev = t.next) {
|
|
2377
2395
|
case 0:
|
|
2378
2396
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2389,18 +2407,18 @@ var Je = Promise.resolve({
|
|
|
2389
2407
|
}
|
|
2390
2408
|
};
|
|
2391
2409
|
}),
|
|
2392
|
-
|
|
2410
|
+
nt = function () {
|
|
2393
2411
|
function e(t, r, n, i, o) {
|
|
2394
2412
|
var s = this,
|
|
2395
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2396
|
-
|
|
2413
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Je();
|
|
2414
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2397
2415
|
authenticate: function authenticate(e) {
|
|
2398
|
-
return
|
|
2416
|
+
return Te(s, void 0, void 0, _e().mark(function t() {
|
|
2399
2417
|
var r, n, i, o, s, a;
|
|
2400
|
-
return
|
|
2418
|
+
return _e().wrap(function (t) {
|
|
2401
2419
|
for (;;) switch (t.prev = t.next) {
|
|
2402
2420
|
case 0:
|
|
2403
|
-
return
|
|
2421
|
+
return Ve("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2404
2422
|
case 3:
|
|
2405
2423
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2406
2424
|
case 6:
|
|
@@ -2430,28 +2448,28 @@ var Je = Promise.resolve({
|
|
|
2430
2448
|
}));
|
|
2431
2449
|
}
|
|
2432
2450
|
}, this.google = {
|
|
2433
|
-
start: this.startOAuthFlow(
|
|
2451
|
+
start: this.startOAuthFlow(w.Google),
|
|
2434
2452
|
discovery: {
|
|
2435
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2453
|
+
start: this.startDiscoveryOAuthFlow(w.Google)
|
|
2436
2454
|
}
|
|
2437
2455
|
}, this.microsoft = {
|
|
2438
|
-
start: this.startOAuthFlow(
|
|
2456
|
+
start: this.startOAuthFlow(w.Microsoft),
|
|
2439
2457
|
discovery: {
|
|
2440
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2458
|
+
start: this.startDiscoveryOAuthFlow(w.Microsoft)
|
|
2441
2459
|
}
|
|
2442
2460
|
};
|
|
2443
2461
|
}
|
|
2444
|
-
return
|
|
2462
|
+
return ve(e, [{
|
|
2445
2463
|
key: "authenticate",
|
|
2446
2464
|
value: function value(e) {
|
|
2447
|
-
return
|
|
2465
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2448
2466
|
var r, n, i, o, s;
|
|
2449
|
-
return
|
|
2467
|
+
return _e().wrap(function (t) {
|
|
2450
2468
|
for (;;) switch (t.prev = t.next) {
|
|
2451
2469
|
case 0:
|
|
2452
|
-
return
|
|
2470
|
+
return Ve("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();
|
|
2453
2471
|
case 3:
|
|
2454
|
-
return (r = t.sent) ||
|
|
2472
|
+
return (r = t.sent) || qe("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();
|
|
2455
2473
|
case 7:
|
|
2456
2474
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2457
2475
|
url: "/b2b/oauth/authenticate",
|
|
@@ -2490,9 +2508,9 @@ var Je = Promise.resolve({
|
|
|
2490
2508
|
}, {
|
|
2491
2509
|
key: "getBaseApiUrl",
|
|
2492
2510
|
value: function value() {
|
|
2493
|
-
return
|
|
2511
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2494
2512
|
var t, r;
|
|
2495
|
-
return
|
|
2513
|
+
return _e().wrap(function (e) {
|
|
2496
2514
|
for (;;) switch (e.prev = e.next) {
|
|
2497
2515
|
case 0:
|
|
2498
2516
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2503,7 +2521,7 @@ var Je = Promise.resolve({
|
|
|
2503
2521
|
}
|
|
2504
2522
|
return e.abrupt("return", "https://".concat(r));
|
|
2505
2523
|
case 6:
|
|
2506
|
-
if (!
|
|
2524
|
+
if (!Ge(this._config.publicToken)) {
|
|
2507
2525
|
e.next = 8;
|
|
2508
2526
|
break;
|
|
2509
2527
|
}
|
|
@@ -2528,16 +2546,16 @@ var Je = Promise.resolve({
|
|
|
2528
2546
|
s = r.signup_redirect_url,
|
|
2529
2547
|
a = r.custom_scopes,
|
|
2530
2548
|
c = r.provider_params;
|
|
2531
|
-
return
|
|
2549
|
+
return Te(t, void 0, void 0, _e().mark(function t() {
|
|
2532
2550
|
var r, u, l, d, h, p;
|
|
2533
|
-
return
|
|
2551
|
+
return _e().wrap(function (t) {
|
|
2534
2552
|
for (;;) switch (t.prev = t.next) {
|
|
2535
2553
|
case 0:
|
|
2536
2554
|
return t.next = 2, this._dynamicConfig;
|
|
2537
2555
|
case 2:
|
|
2538
2556
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2539
2557
|
case 6:
|
|
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 && (
|
|
2558
|
+
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 && (Ve("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in Ve("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2541
2559
|
if (!u) {
|
|
2542
2560
|
t.next = 20;
|
|
2543
2561
|
break;
|
|
@@ -2566,16 +2584,16 @@ var Je = Promise.resolve({
|
|
|
2566
2584
|
var n = r.discovery_redirect_url,
|
|
2567
2585
|
i = r.custom_scopes,
|
|
2568
2586
|
o = r.provider_params;
|
|
2569
|
-
return
|
|
2587
|
+
return Te(t, void 0, void 0, _e().mark(function t() {
|
|
2570
2588
|
var r, s, a, c, u, l;
|
|
2571
|
-
return
|
|
2589
|
+
return _e().wrap(function (t) {
|
|
2572
2590
|
for (;;) switch (t.prev = t.next) {
|
|
2573
2591
|
case 0:
|
|
2574
2592
|
return t.next = 2, this._dynamicConfig;
|
|
2575
2593
|
case 2:
|
|
2576
2594
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2577
2595
|
case 6:
|
|
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 && (
|
|
2596
|
+
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 && (Ve("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in Ve("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2579
2597
|
if (!s) {
|
|
2580
2598
|
t.next = 18;
|
|
2581
2599
|
break;
|
|
@@ -2598,10 +2616,10 @@ var Je = Promise.resolve({
|
|
|
2598
2616
|
}
|
|
2599
2617
|
}]), e;
|
|
2600
2618
|
}(),
|
|
2601
|
-
|
|
2619
|
+
it = function () {
|
|
2602
2620
|
function e(t, r) {
|
|
2603
2621
|
var n = this;
|
|
2604
|
-
|
|
2622
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2605
2623
|
return n._subscriptionService.getSession();
|
|
2606
2624
|
}, this.onChange = function (e) {
|
|
2607
2625
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -2609,9 +2627,9 @@ var Je = Promise.resolve({
|
|
|
2609
2627
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2610
2628
|
});
|
|
2611
2629
|
}, this.revoke = function (e) {
|
|
2612
|
-
return
|
|
2630
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2613
2631
|
var r;
|
|
2614
|
-
return
|
|
2632
|
+
return _e().wrap(function (t) {
|
|
2615
2633
|
for (;;) switch (t.prev = t.next) {
|
|
2616
2634
|
case 0:
|
|
2617
2635
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2622,7 +2640,7 @@ var Je = Promise.resolve({
|
|
|
2622
2640
|
case 3:
|
|
2623
2641
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2624
2642
|
case 8:
|
|
2625
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2643
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || O.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2626
2644
|
case 12:
|
|
2627
2645
|
case "end":
|
|
2628
2646
|
return t.stop();
|
|
@@ -2630,13 +2648,13 @@ var Je = Promise.resolve({
|
|
|
2630
2648
|
}, t, this, [[0, 8]]);
|
|
2631
2649
|
}));
|
|
2632
2650
|
}, this.authenticate = function (e) {
|
|
2633
|
-
return
|
|
2651
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2634
2652
|
var r,
|
|
2635
2653
|
n,
|
|
2636
2654
|
i,
|
|
2637
2655
|
o,
|
|
2638
2656
|
s = this;
|
|
2639
|
-
return
|
|
2657
|
+
return _e().wrap(function (t) {
|
|
2640
2658
|
for (;;) switch (t.prev = t.next) {
|
|
2641
2659
|
case 0:
|
|
2642
2660
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2674,7 +2692,7 @@ var Je = Promise.resolve({
|
|
|
2674
2692
|
}
|
|
2675
2693
|
return t.abrupt("return", this.authenticate(e));
|
|
2676
2694
|
case 17:
|
|
2677
|
-
throw
|
|
2695
|
+
throw O.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2678
2696
|
case 19:
|
|
2679
2697
|
case "end":
|
|
2680
2698
|
return t.stop();
|
|
@@ -2682,12 +2700,12 @@ var Je = Promise.resolve({
|
|
|
2682
2700
|
}, t, this, [[2, 13]]);
|
|
2683
2701
|
}));
|
|
2684
2702
|
}, this.exchange = function (e) {
|
|
2685
|
-
return
|
|
2703
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2686
2704
|
var r;
|
|
2687
|
-
return
|
|
2705
|
+
return _e().wrap(function (t) {
|
|
2688
2706
|
for (;;) switch (t.prev = t.next) {
|
|
2689
2707
|
case 0:
|
|
2690
|
-
return
|
|
2708
|
+
return Ve("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({
|
|
2691
2709
|
url: "/b2b/sessions/exchange",
|
|
2692
2710
|
body: e,
|
|
2693
2711
|
errorMessage: "Failed to exchange session",
|
|
@@ -2719,19 +2737,19 @@ var Je = Promise.resolve({
|
|
|
2719
2737
|
}));
|
|
2720
2738
|
};
|
|
2721
2739
|
}
|
|
2722
|
-
return
|
|
2740
|
+
return ve(e, [{
|
|
2723
2741
|
key: "getTokens",
|
|
2724
2742
|
value: function value() {
|
|
2725
2743
|
return this._subscriptionService.getTokens();
|
|
2726
2744
|
}
|
|
2727
2745
|
}]), e;
|
|
2728
2746
|
}(),
|
|
2729
|
-
|
|
2747
|
+
ot = ve(function e(t, r) {
|
|
2730
2748
|
var n = this;
|
|
2731
|
-
|
|
2749
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2732
2750
|
list: function list() {
|
|
2733
|
-
return
|
|
2734
|
-
return
|
|
2751
|
+
return Te(n, void 0, void 0, _e().mark(function e() {
|
|
2752
|
+
return _e().wrap(function (e) {
|
|
2735
2753
|
for (;;) switch (e.prev = e.next) {
|
|
2736
2754
|
case 0:
|
|
2737
2755
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2758,12 +2776,12 @@ var Je = Promise.resolve({
|
|
|
2758
2776
|
}));
|
|
2759
2777
|
},
|
|
2760
2778
|
create: function create(e) {
|
|
2761
|
-
return
|
|
2779
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2762
2780
|
var r, n;
|
|
2763
|
-
return
|
|
2781
|
+
return _e().wrap(function (t) {
|
|
2764
2782
|
for (;;) switch (t.prev = t.next) {
|
|
2765
2783
|
case 0:
|
|
2766
|
-
return
|
|
2784
|
+
return Ve("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();
|
|
2767
2785
|
case 5:
|
|
2768
2786
|
if (t.t2 = t.sent, t.t2) {
|
|
2769
2787
|
t.next = 8;
|
|
@@ -2804,12 +2822,12 @@ var Je = Promise.resolve({
|
|
|
2804
2822
|
}
|
|
2805
2823
|
}, this.intermediateSessions = {
|
|
2806
2824
|
exchange: function exchange(e) {
|
|
2807
|
-
return
|
|
2825
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
2808
2826
|
var r, n;
|
|
2809
|
-
return
|
|
2827
|
+
return _e().wrap(function (t) {
|
|
2810
2828
|
for (;;) switch (t.prev = t.next) {
|
|
2811
2829
|
case 0:
|
|
2812
|
-
return
|
|
2830
|
+
return Ve("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();
|
|
2813
2831
|
case 5:
|
|
2814
2832
|
if (t.t2 = t.sent, t.t2) {
|
|
2815
2833
|
t.next = 8;
|
|
@@ -2850,21 +2868,21 @@ var Je = Promise.resolve({
|
|
|
2850
2868
|
}
|
|
2851
2869
|
};
|
|
2852
2870
|
}),
|
|
2853
|
-
|
|
2871
|
+
st = Promise.resolve({
|
|
2854
2872
|
pkceRequiredForPasswordResets: !1
|
|
2855
2873
|
}),
|
|
2856
|
-
|
|
2874
|
+
at = function () {
|
|
2857
2875
|
function e(t, r, n) {
|
|
2858
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2859
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2860
|
-
|
|
2876
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : st,
|
|
2877
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Je();
|
|
2878
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2861
2879
|
}
|
|
2862
|
-
return
|
|
2880
|
+
return ve(e, [{
|
|
2863
2881
|
key: "getCodeChallenge",
|
|
2864
2882
|
value: function value() {
|
|
2865
|
-
return
|
|
2883
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
2866
2884
|
var t, r;
|
|
2867
|
-
return
|
|
2885
|
+
return _e().wrap(function (e) {
|
|
2868
2886
|
for (;;) switch (e.prev = e.next) {
|
|
2869
2887
|
case 0:
|
|
2870
2888
|
return e.next = 2, this._config;
|
|
@@ -2896,12 +2914,12 @@ var Je = Promise.resolve({
|
|
|
2896
2914
|
}, {
|
|
2897
2915
|
key: "authenticate",
|
|
2898
2916
|
value: function value(e) {
|
|
2899
|
-
return
|
|
2917
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2900
2918
|
var r, n, i, o, s, a;
|
|
2901
|
-
return
|
|
2919
|
+
return _e().wrap(function (t) {
|
|
2902
2920
|
for (;;) switch (t.prev = t.next) {
|
|
2903
2921
|
case 0:
|
|
2904
|
-
return
|
|
2922
|
+
return Ve("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();
|
|
2905
2923
|
case 3:
|
|
2906
2924
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2907
2925
|
case 7:
|
|
@@ -2947,12 +2965,12 @@ var Je = Promise.resolve({
|
|
|
2947
2965
|
}, {
|
|
2948
2966
|
key: "resetByEmailStart",
|
|
2949
2967
|
value: function value(e) {
|
|
2950
|
-
return
|
|
2968
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2951
2969
|
var r, n, i, o;
|
|
2952
|
-
return
|
|
2970
|
+
return _e().wrap(function (t) {
|
|
2953
2971
|
for (;;) switch (t.prev = t.next) {
|
|
2954
2972
|
case 0:
|
|
2955
|
-
return
|
|
2973
|
+
return Ve("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();
|
|
2956
2974
|
case 3:
|
|
2957
2975
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2958
2976
|
case 6:
|
|
@@ -2983,12 +3001,12 @@ var Je = Promise.resolve({
|
|
|
2983
3001
|
}, {
|
|
2984
3002
|
key: "resetByEmail",
|
|
2985
3003
|
value: function value(e) {
|
|
2986
|
-
return
|
|
3004
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
2987
3005
|
var r, n, i, o, s, a;
|
|
2988
|
-
return
|
|
3006
|
+
return _e().wrap(function (t) {
|
|
2989
3007
|
for (;;) switch (t.prev = t.next) {
|
|
2990
3008
|
case 0:
|
|
2991
|
-
return
|
|
3009
|
+
return Ve("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();
|
|
2992
3010
|
case 3:
|
|
2993
3011
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2994
3012
|
case 8:
|
|
@@ -3033,12 +3051,12 @@ var Je = Promise.resolve({
|
|
|
3033
3051
|
}, {
|
|
3034
3052
|
key: "resetByExistingPassword",
|
|
3035
3053
|
value: function value(e) {
|
|
3036
|
-
return
|
|
3054
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3037
3055
|
var r, n, i, o;
|
|
3038
|
-
return
|
|
3056
|
+
return _e().wrap(function (t) {
|
|
3039
3057
|
for (;;) switch (t.prev = t.next) {
|
|
3040
3058
|
case 0:
|
|
3041
|
-
return
|
|
3059
|
+
return Ve("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();
|
|
3042
3060
|
case 3:
|
|
3043
3061
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3044
3062
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -3082,12 +3100,12 @@ var Je = Promise.resolve({
|
|
|
3082
3100
|
}, {
|
|
3083
3101
|
key: "resetBySession",
|
|
3084
3102
|
value: function value(e) {
|
|
3085
|
-
return
|
|
3103
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3086
3104
|
var r, n, i, o;
|
|
3087
|
-
return
|
|
3105
|
+
return _e().wrap(function (t) {
|
|
3088
3106
|
for (;;) switch (t.prev = t.next) {
|
|
3089
3107
|
case 0:
|
|
3090
|
-
return
|
|
3108
|
+
return Ve("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3091
3109
|
case 3:
|
|
3092
3110
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3093
3111
|
url: "/b2b/passwords/session/reset",
|
|
@@ -3121,11 +3139,11 @@ var Je = Promise.resolve({
|
|
|
3121
3139
|
}, {
|
|
3122
3140
|
key: "strengthCheck",
|
|
3123
3141
|
value: function value(e) {
|
|
3124
|
-
return
|
|
3125
|
-
return
|
|
3142
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3143
|
+
return _e().wrap(function (t) {
|
|
3126
3144
|
for (;;) switch (t.prev = t.next) {
|
|
3127
3145
|
case 0:
|
|
3128
|
-
return
|
|
3146
|
+
return Ve("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3129
3147
|
url: "/b2b/passwords/strength_check",
|
|
3130
3148
|
method: "POST",
|
|
3131
3149
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3143,17 +3161,17 @@ var Je = Promise.resolve({
|
|
|
3143
3161
|
}
|
|
3144
3162
|
}]), e;
|
|
3145
3163
|
}(),
|
|
3146
|
-
|
|
3164
|
+
ct = ve(function e(t, r) {
|
|
3147
3165
|
var n = this,
|
|
3148
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3149
|
-
|
|
3166
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3167
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3150
3168
|
send: function send(e) {
|
|
3151
|
-
return
|
|
3169
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3152
3170
|
var r, n, i;
|
|
3153
|
-
return
|
|
3171
|
+
return _e().wrap(function (t) {
|
|
3154
3172
|
for (;;) switch (t.prev = t.next) {
|
|
3155
3173
|
case 0:
|
|
3156
|
-
return
|
|
3174
|
+
return Ve("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();
|
|
3157
3175
|
case 3:
|
|
3158
3176
|
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();
|
|
3159
3177
|
case 13:
|
|
@@ -3182,12 +3200,12 @@ var Je = Promise.resolve({
|
|
|
3182
3200
|
}));
|
|
3183
3201
|
},
|
|
3184
3202
|
authenticate: function authenticate(e) {
|
|
3185
|
-
return
|
|
3203
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3186
3204
|
var r, n, i, o, s;
|
|
3187
|
-
return
|
|
3205
|
+
return _e().wrap(function (t) {
|
|
3188
3206
|
for (;;) switch (t.prev = t.next) {
|
|
3189
3207
|
case 0:
|
|
3190
|
-
return
|
|
3208
|
+
return Ve("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();
|
|
3191
3209
|
case 3:
|
|
3192
3210
|
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();
|
|
3193
3211
|
case 12:
|
|
@@ -3228,20 +3246,20 @@ var Je = Promise.resolve({
|
|
|
3228
3246
|
}
|
|
3229
3247
|
};
|
|
3230
3248
|
}),
|
|
3231
|
-
|
|
3249
|
+
ut = function () {
|
|
3232
3250
|
function e(t, r) {
|
|
3233
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3234
|
-
|
|
3251
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3252
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3235
3253
|
}
|
|
3236
|
-
return
|
|
3254
|
+
return ve(e, [{
|
|
3237
3255
|
key: "create",
|
|
3238
3256
|
value: function value(e) {
|
|
3239
|
-
return
|
|
3257
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3240
3258
|
var r, n, i;
|
|
3241
|
-
return
|
|
3259
|
+
return _e().wrap(function (t) {
|
|
3242
3260
|
for (;;) switch (t.prev = t.next) {
|
|
3243
3261
|
case 0:
|
|
3244
|
-
return
|
|
3262
|
+
return Ve("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();
|
|
3245
3263
|
case 3:
|
|
3246
3264
|
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();
|
|
3247
3265
|
case 13:
|
|
@@ -3272,12 +3290,12 @@ var Je = Promise.resolve({
|
|
|
3272
3290
|
}, {
|
|
3273
3291
|
key: "authenticate",
|
|
3274
3292
|
value: function value(e) {
|
|
3275
|
-
return
|
|
3293
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3276
3294
|
var r, n, i, o, s;
|
|
3277
|
-
return
|
|
3295
|
+
return _e().wrap(function (t) {
|
|
3278
3296
|
for (;;) switch (t.prev = t.next) {
|
|
3279
3297
|
case 0:
|
|
3280
|
-
return
|
|
3298
|
+
return Ve("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();
|
|
3281
3299
|
case 3:
|
|
3282
3300
|
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();
|
|
3283
3301
|
case 12:
|
|
@@ -3318,20 +3336,20 @@ var Je = Promise.resolve({
|
|
|
3318
3336
|
}
|
|
3319
3337
|
}]), e;
|
|
3320
3338
|
}(),
|
|
3321
|
-
|
|
3339
|
+
lt = function () {
|
|
3322
3340
|
function e(t, r) {
|
|
3323
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3324
|
-
|
|
3341
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Je();
|
|
3342
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3325
3343
|
}
|
|
3326
|
-
return
|
|
3344
|
+
return ve(e, [{
|
|
3327
3345
|
key: "recover",
|
|
3328
3346
|
value: function value(e) {
|
|
3329
|
-
return
|
|
3347
|
+
return Te(this, void 0, void 0, _e().mark(function t() {
|
|
3330
3348
|
var r, n, i, o, s;
|
|
3331
|
-
return
|
|
3349
|
+
return _e().wrap(function (t) {
|
|
3332
3350
|
for (;;) switch (t.prev = t.next) {
|
|
3333
3351
|
case 0:
|
|
3334
|
-
return
|
|
3352
|
+
return Ve("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();
|
|
3335
3353
|
case 3:
|
|
3336
3354
|
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();
|
|
3337
3355
|
case 12:
|
|
@@ -3373,9 +3391,9 @@ var Je = Promise.resolve({
|
|
|
3373
3391
|
}, {
|
|
3374
3392
|
key: "rotate",
|
|
3375
3393
|
value: function value() {
|
|
3376
|
-
return
|
|
3394
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
3377
3395
|
var t, r, n;
|
|
3378
|
-
return
|
|
3396
|
+
return _e().wrap(function (e) {
|
|
3379
3397
|
for (;;) switch (e.prev = e.next) {
|
|
3380
3398
|
case 0:
|
|
3381
3399
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3400,8 +3418,8 @@ var Je = Promise.resolve({
|
|
|
3400
3418
|
}, {
|
|
3401
3419
|
key: "get",
|
|
3402
3420
|
value: function value() {
|
|
3403
|
-
return
|
|
3404
|
-
return
|
|
3421
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
3422
|
+
return _e().wrap(function (e) {
|
|
3405
3423
|
for (;;) switch (e.prev = e.next) {
|
|
3406
3424
|
case 0:
|
|
3407
3425
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3418,21 +3436,21 @@ var Je = Promise.resolve({
|
|
|
3418
3436
|
}
|
|
3419
3437
|
}]), e;
|
|
3420
3438
|
}(),
|
|
3421
|
-
|
|
3439
|
+
dt = function () {
|
|
3422
3440
|
function e(t, r, n) {
|
|
3423
3441
|
var i = this;
|
|
3424
|
-
|
|
3442
|
+
ge(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3425
3443
|
var r;
|
|
3426
3444
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3427
3445
|
}, this.isAuthorized = function (e, t) {
|
|
3428
3446
|
return i.policyPromise.then(function (r) {
|
|
3429
3447
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3430
3448
|
});
|
|
3431
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3432
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3449
|
+
}, this.cachedPolicy = t.rbacPolicy ? _t.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3450
|
+
return e.rbacPolicy ? (i.cachedPolicy = _t.fromJSON(e.rbacPolicy), i.cachedPolicy) : (We("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new _t([], []));
|
|
3433
3451
|
});
|
|
3434
3452
|
}
|
|
3435
|
-
return
|
|
3453
|
+
return ve(e, [{
|
|
3436
3454
|
key: "allPermissions",
|
|
3437
3455
|
value: function value() {
|
|
3438
3456
|
var e = this;
|
|
@@ -3449,15 +3467,15 @@ var Je = Promise.resolve({
|
|
|
3449
3467
|
}
|
|
3450
3468
|
}]), e;
|
|
3451
3469
|
}(),
|
|
3452
|
-
|
|
3470
|
+
ht = function () {
|
|
3453
3471
|
function e(t) {
|
|
3454
|
-
|
|
3472
|
+
ge(this, e), this.iframeURL = t, this.createIframe();
|
|
3455
3473
|
}
|
|
3456
|
-
return
|
|
3474
|
+
return ve(e, [{
|
|
3457
3475
|
key: "createIframe",
|
|
3458
3476
|
value: function value() {
|
|
3459
3477
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3460
|
-
e ?
|
|
3478
|
+
e ? qe("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
3479
|
e.addEventListener("load", function () {
|
|
3462
3480
|
e.dataset.loaded = "true", t(e);
|
|
3463
3481
|
}, {
|
|
@@ -3468,11 +3486,11 @@ var Je = Promise.resolve({
|
|
|
3468
3486
|
}, {
|
|
3469
3487
|
key: "call",
|
|
3470
3488
|
value: function value(e, t) {
|
|
3471
|
-
return
|
|
3489
|
+
return Te(this, void 0, void 0, _e().mark(function r() {
|
|
3472
3490
|
var n,
|
|
3473
3491
|
i,
|
|
3474
3492
|
o = this;
|
|
3475
|
-
return
|
|
3493
|
+
return _e().wrap(function (r) {
|
|
3476
3494
|
for (;;) switch (r.prev = r.next) {
|
|
3477
3495
|
case 0:
|
|
3478
3496
|
return r.next = 2, this.frame;
|
|
@@ -3481,7 +3499,7 @@ var Je = Promise.resolve({
|
|
|
3481
3499
|
var a;
|
|
3482
3500
|
i.port1.onmessage = function (e) {
|
|
3483
3501
|
var t = e.data;
|
|
3484
|
-
i.port1.close(), t.success ? r(t.payload) : s(
|
|
3502
|
+
i.port1.close(), t.success ? r(t.payload) : s($e.unmarshall(t.error));
|
|
3485
3503
|
};
|
|
3486
3504
|
var c = {
|
|
3487
3505
|
method: e,
|
|
@@ -3498,15 +3516,58 @@ var Je = Promise.resolve({
|
|
|
3498
3516
|
}
|
|
3499
3517
|
}]), e;
|
|
3500
3518
|
}(),
|
|
3501
|
-
|
|
3519
|
+
pt = function () {
|
|
3520
|
+
function e(t) {
|
|
3521
|
+
ge(this, e), this._networkClient = t;
|
|
3522
|
+
}
|
|
3523
|
+
return ve(e, [{
|
|
3524
|
+
key: "searchUser",
|
|
3525
|
+
value: function value(e) {
|
|
3526
|
+
return this._networkClient.fetchSDK({
|
|
3527
|
+
url: "/users/search",
|
|
3528
|
+
method: "POST",
|
|
3529
|
+
body: {
|
|
3530
|
+
email: e
|
|
3531
|
+
},
|
|
3532
|
+
errorMessage: "Error searching for user ".concat(e)
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
}, {
|
|
3536
|
+
key: "searchOrganization",
|
|
3537
|
+
value: function value(e) {
|
|
3538
|
+
return this._networkClient.fetchSDK({
|
|
3539
|
+
url: "/b2b/organizations/search",
|
|
3540
|
+
method: "POST",
|
|
3541
|
+
body: {
|
|
3542
|
+
organization_slug: e
|
|
3543
|
+
},
|
|
3544
|
+
errorMessage: "Error searching slug"
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3547
|
+
}, {
|
|
3548
|
+
key: "searchMember",
|
|
3549
|
+
value: function value(e, t) {
|
|
3550
|
+
return this._networkClient.fetchSDK({
|
|
3551
|
+
url: "/b2b/organizations/members/search",
|
|
3552
|
+
method: "POST",
|
|
3553
|
+
body: {
|
|
3554
|
+
email_address: e,
|
|
3555
|
+
organization_id: t
|
|
3556
|
+
},
|
|
3557
|
+
errorMessage: "Error searching for member ".concat(e)
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
}]), e;
|
|
3561
|
+
}(),
|
|
3562
|
+
ft = function () {
|
|
3502
3563
|
function e(t, r) {
|
|
3503
3564
|
var n = this;
|
|
3504
|
-
|
|
3565
|
+
ge(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3505
3566
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3506
3567
|
}, this._reauthenticateWithBackoff = function () {
|
|
3507
|
-
return
|
|
3568
|
+
return Te(n, void 0, void 0, _e().mark(function t() {
|
|
3508
3569
|
var r;
|
|
3509
|
-
return
|
|
3570
|
+
return _e().wrap(function (t) {
|
|
3510
3571
|
for (;;) switch (t.prev = t.next) {
|
|
3511
3572
|
case 0:
|
|
3512
3573
|
r = 0;
|
|
@@ -3535,14 +3596,14 @@ var Je = Promise.resolve({
|
|
|
3535
3596
|
}));
|
|
3536
3597
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3537
3598
|
}
|
|
3538
|
-
return
|
|
3599
|
+
return ve(e, [{
|
|
3539
3600
|
key: "performBackgroundRefresh",
|
|
3540
3601
|
value: function value() {
|
|
3541
3602
|
var e = this;
|
|
3542
3603
|
this._reauthenticateWithBackoff().then(function () {
|
|
3543
3604
|
e.scheduleBackgroundRefresh();
|
|
3544
3605
|
})["catch"](function (t) {
|
|
3545
|
-
|
|
3606
|
+
qe("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3546
3607
|
error: t
|
|
3547
3608
|
}), e._subscriptionService.destroySession();
|
|
3548
3609
|
});
|
|
@@ -3568,19 +3629,19 @@ var Je = Promise.resolve({
|
|
|
3568
3629
|
}, {
|
|
3569
3630
|
key: "isUnrecoverableError",
|
|
3570
3631
|
value: function value(e) {
|
|
3571
|
-
return
|
|
3632
|
+
return O.includes(e.error_type);
|
|
3572
3633
|
}
|
|
3573
3634
|
}]), e;
|
|
3574
3635
|
}();
|
|
3575
|
-
|
|
3576
|
-
var
|
|
3636
|
+
ft.REFRESH_INTERVAL_MS = 18e4;
|
|
3637
|
+
var _t = function () {
|
|
3577
3638
|
function e(t, r) {
|
|
3578
3639
|
var n = this;
|
|
3579
|
-
|
|
3640
|
+
ge(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3580
3641
|
return n.rolesByID[e.role_id] = e;
|
|
3581
3642
|
});
|
|
3582
3643
|
}
|
|
3583
|
-
return
|
|
3644
|
+
return ve(e, [{
|
|
3584
3645
|
key: "callerIsAuthorized",
|
|
3585
3646
|
value: function value(e, t, r) {
|
|
3586
3647
|
var n = this;
|
|
@@ -3614,19 +3675,19 @@ var dt = function () {
|
|
|
3614
3675
|
}
|
|
3615
3676
|
}]), e;
|
|
3616
3677
|
}();
|
|
3617
|
-
var
|
|
3618
|
-
var
|
|
3619
|
-
function
|
|
3678
|
+
var mt = "bootstrap";
|
|
3679
|
+
var vt = /*#__PURE__*/function () {
|
|
3680
|
+
function vt(e, t, r) {
|
|
3620
3681
|
var _this = this;
|
|
3621
|
-
_classCallCheck(this,
|
|
3682
|
+
_classCallCheck(this, vt);
|
|
3622
3683
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3623
3684
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3624
3685
|
method: "GET",
|
|
3625
3686
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3626
|
-
}).then(
|
|
3627
|
-
return _this._dataLayer.setItem(
|
|
3687
|
+
}).then(vt.mapBootstrapData).then(function (e) {
|
|
3688
|
+
return _this._dataLayer.setItem(mt, JSON.stringify(e)), e;
|
|
3628
3689
|
})["catch"](function (e) {
|
|
3629
|
-
return
|
|
3690
|
+
return We(e), {
|
|
3630
3691
|
displayWatermark: !1,
|
|
3631
3692
|
cnameDomain: null,
|
|
3632
3693
|
emailDomains: ["stytch.com"],
|
|
@@ -3645,10 +3706,10 @@ var pt = /*#__PURE__*/function () {
|
|
|
3645
3706
|
};
|
|
3646
3707
|
});
|
|
3647
3708
|
}
|
|
3648
|
-
_createClass(
|
|
3709
|
+
_createClass(vt, [{
|
|
3649
3710
|
key: "getSync",
|
|
3650
3711
|
value: function getSync() {
|
|
3651
|
-
var e = this._dataLayer.getItem(
|
|
3712
|
+
var e = this._dataLayer.getItem(mt);
|
|
3652
3713
|
if (null === e) return {
|
|
3653
3714
|
displayWatermark: !1,
|
|
3654
3715
|
cnameDomain: null,
|
|
@@ -3719,9 +3780,9 @@ var pt = /*#__PURE__*/function () {
|
|
|
3719
3780
|
};
|
|
3720
3781
|
}
|
|
3721
3782
|
}]);
|
|
3722
|
-
return
|
|
3783
|
+
return vt;
|
|
3723
3784
|
}();
|
|
3724
|
-
function
|
|
3785
|
+
function bt(e, t, r, n) {
|
|
3725
3786
|
return new (r || (r = Promise))(function (i, o) {
|
|
3726
3787
|
function s(e) {
|
|
3727
3788
|
try {
|
|
@@ -3747,11 +3808,11 @@ function ft(e, t, r, n) {
|
|
|
3747
3808
|
});
|
|
3748
3809
|
}
|
|
3749
3810
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3750
|
-
var
|
|
3811
|
+
var gt = /*#__PURE__*/_createClass(function gt(e) {
|
|
3751
3812
|
var _this2 = this;
|
|
3752
|
-
_classCallCheck(this,
|
|
3813
|
+
_classCallCheck(this, gt);
|
|
3753
3814
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3754
|
-
return
|
|
3815
|
+
return bt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3755
3816
|
var _yield$this$state, e, t, r;
|
|
3756
3817
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3757
3818
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3782,7 +3843,7 @@ var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
|
3782
3843
|
}, _callee, this);
|
|
3783
3844
|
}));
|
|
3784
3845
|
}, this.state = e.then(function (e) {
|
|
3785
|
-
return
|
|
3846
|
+
return bt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3786
3847
|
var t;
|
|
3787
3848
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3788
3849
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3793,7 +3854,7 @@ var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
|
3793
3854
|
}
|
|
3794
3855
|
_context2.t1 = !0;
|
|
3795
3856
|
_context2.next = 4;
|
|
3796
|
-
return t = e.captchaSettings.siteKey,
|
|
3857
|
+
return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3797
3858
|
return window.grecaptcha.enterprise;
|
|
3798
3859
|
});
|
|
3799
3860
|
case 4:
|
|
@@ -3820,10 +3881,10 @@ var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
|
3820
3881
|
}));
|
|
3821
3882
|
});
|
|
3822
3883
|
});
|
|
3823
|
-
var
|
|
3824
|
-
function
|
|
3884
|
+
var yt = /*#__PURE__*/function () {
|
|
3885
|
+
function yt(e) {
|
|
3825
3886
|
var _this3 = this;
|
|
3826
|
-
_classCallCheck(this,
|
|
3887
|
+
_classCallCheck(this, yt);
|
|
3827
3888
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3828
3889
|
return _this3.call("oneTapStart", e);
|
|
3829
3890
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3832,11 +3893,11 @@ var mt = /*#__PURE__*/function () {
|
|
|
3832
3893
|
return _this3.call("parsedPhoneNumber", e);
|
|
3833
3894
|
};
|
|
3834
3895
|
}
|
|
3835
|
-
_createClass(
|
|
3896
|
+
_createClass(yt, [{
|
|
3836
3897
|
key: "frameClient",
|
|
3837
3898
|
get: function get() {
|
|
3838
3899
|
var e;
|
|
3839
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3900
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new ht(this.iframeURL), this._frameClient;
|
|
3840
3901
|
}
|
|
3841
3902
|
}, {
|
|
3842
3903
|
key: "call",
|
|
@@ -3844,20 +3905,20 @@ var mt = /*#__PURE__*/function () {
|
|
|
3844
3905
|
return this.frameClient.call(e, [t]);
|
|
3845
3906
|
}
|
|
3846
3907
|
}]);
|
|
3847
|
-
return
|
|
3908
|
+
return yt;
|
|
3848
3909
|
}();
|
|
3849
|
-
var
|
|
3850
|
-
function
|
|
3851
|
-
_classCallCheck(this,
|
|
3910
|
+
var kt = /*#__PURE__*/function () {
|
|
3911
|
+
function kt(e, t, r, n) {
|
|
3912
|
+
_classCallCheck(this, kt);
|
|
3852
3913
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3853
3914
|
return null;
|
|
3854
|
-
}, this.eventLogger = new
|
|
3915
|
+
}, this.eventLogger = new Xe({
|
|
3855
3916
|
maxBatchSize: 15,
|
|
3856
3917
|
intervalDurationMs: 800,
|
|
3857
3918
|
logEventURL: this.buildSDKUrl("/events")
|
|
3858
3919
|
});
|
|
3859
3920
|
}
|
|
3860
|
-
_createClass(
|
|
3921
|
+
_createClass(kt, [{
|
|
3861
3922
|
key: "logEvent",
|
|
3862
3923
|
value: function logEvent(_ref) {
|
|
3863
3924
|
var e = _ref.name,
|
|
@@ -3877,9 +3938,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3877
3938
|
key: "createTelemetryBlob",
|
|
3878
3939
|
value: function createTelemetryBlob() {
|
|
3879
3940
|
return Object.assign(Object.assign({
|
|
3880
|
-
event_id: "event-id-".concat(
|
|
3881
|
-
app_session_id: "app-session-id-".concat(
|
|
3882
|
-
persistent_id: "persistent-id-".concat(
|
|
3941
|
+
event_id: "event-id-".concat(Le()),
|
|
3942
|
+
app_session_id: "app-session-id-".concat(Le()),
|
|
3943
|
+
persistent_id: "persistent-id-".concat(Le()),
|
|
3883
3944
|
client_sent_at: new Date().toISOString(),
|
|
3884
3945
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3885
3946
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3888,7 +3949,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
3888
3949
|
},
|
|
3889
3950
|
sdk: {
|
|
3890
3951
|
identifier: "Stytch.js Javascript SDK",
|
|
3891
|
-
version: "4.
|
|
3952
|
+
version: "4.7.1"
|
|
3892
3953
|
}
|
|
3893
3954
|
});
|
|
3894
3955
|
}
|
|
@@ -3899,13 +3960,13 @@ var vt = /*#__PURE__*/function () {
|
|
|
3899
3960
|
t = _ref2.body,
|
|
3900
3961
|
r = _ref2.errorMessage,
|
|
3901
3962
|
n = _ref2.method;
|
|
3902
|
-
return
|
|
3963
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3903
3964
|
var i, o, s, a;
|
|
3904
3965
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3905
3966
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3906
3967
|
case 0:
|
|
3907
3968
|
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;
|
|
3908
|
-
return _context3.abrupt("return",
|
|
3969
|
+
return _context3.abrupt("return", xe({
|
|
3909
3970
|
basicAuthHeader: o,
|
|
3910
3971
|
body: t,
|
|
3911
3972
|
errorMessage: r,
|
|
@@ -3929,7 +3990,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
3929
3990
|
r = _ref3.errorMessage,
|
|
3930
3991
|
n = _ref3.method,
|
|
3931
3992
|
i = _ref3.retryCallback;
|
|
3932
|
-
return
|
|
3993
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3933
3994
|
var o, s, a, c;
|
|
3934
3995
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3935
3996
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -3944,9 +4005,9 @@ var vt = /*#__PURE__*/function () {
|
|
|
3944
4005
|
s = e.xSDKParentHostHeader,
|
|
3945
4006
|
a = e.body,
|
|
3946
4007
|
c = e.retryCallback;
|
|
3947
|
-
return
|
|
4008
|
+
return Te(this, void 0, void 0, _e().mark(function e() {
|
|
3948
4009
|
var u;
|
|
3949
|
-
return
|
|
4010
|
+
return _e().wrap(function (e) {
|
|
3950
4011
|
for (;;) switch (e.prev = e.next) {
|
|
3951
4012
|
case 0:
|
|
3952
4013
|
return u = {
|
|
@@ -3957,18 +4018,18 @@ var vt = /*#__PURE__*/function () {
|
|
|
3957
4018
|
xSDKClientHeader: o,
|
|
3958
4019
|
xSDKParentHostHeader: s,
|
|
3959
4020
|
body: a
|
|
3960
|
-
}, e.prev = 1, e.next = 4,
|
|
4021
|
+
}, e.prev = 1, e.next = 4, xe(u);
|
|
3961
4022
|
case 4:
|
|
3962
4023
|
case 15:
|
|
3963
4024
|
return e.abrupt("return", e.sent);
|
|
3964
4025
|
case 7:
|
|
3965
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
4026
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Ae)) {
|
|
3966
4027
|
e.next = 16;
|
|
3967
4028
|
break;
|
|
3968
4029
|
}
|
|
3969
4030
|
return e.next = 12, c(e.t0, u);
|
|
3970
4031
|
case 12:
|
|
3971
|
-
return u = e.sent, e.next = 15,
|
|
4032
|
+
return u = e.sent, e.next = 15, xe(u);
|
|
3972
4033
|
case 16:
|
|
3973
4034
|
throw e.t0;
|
|
3974
4035
|
case 17:
|
|
@@ -4000,18 +4061,18 @@ var vt = /*#__PURE__*/function () {
|
|
|
4000
4061
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
4001
4062
|
}
|
|
4002
4063
|
}]);
|
|
4003
|
-
return
|
|
4064
|
+
return kt;
|
|
4004
4065
|
}();
|
|
4005
|
-
function
|
|
4066
|
+
function wt(e) {
|
|
4006
4067
|
var t = e.toString(16);
|
|
4007
4068
|
return 1 === t.length && (t = "0" + t), t;
|
|
4008
4069
|
}
|
|
4009
|
-
var
|
|
4010
|
-
function
|
|
4011
|
-
_classCallCheck(this,
|
|
4070
|
+
var St = /*#__PURE__*/function () {
|
|
4071
|
+
function St(e, t) {
|
|
4072
|
+
_classCallCheck(this, St);
|
|
4012
4073
|
this._dataLayer = e, this.namespace = t;
|
|
4013
4074
|
}
|
|
4014
|
-
_createClass(
|
|
4075
|
+
_createClass(St, [{
|
|
4015
4076
|
key: "key",
|
|
4016
4077
|
value: function key() {
|
|
4017
4078
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -4019,13 +4080,13 @@ var gt = /*#__PURE__*/function () {
|
|
|
4019
4080
|
}, {
|
|
4020
4081
|
key: "startPKCETransaction",
|
|
4021
4082
|
value: function startPKCETransaction() {
|
|
4022
|
-
return
|
|
4083
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
4023
4084
|
var e;
|
|
4024
4085
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4025
4086
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4026
4087
|
case 0:
|
|
4027
4088
|
_context5.next = 2;
|
|
4028
|
-
return
|
|
4089
|
+
return St.createProofkeyPair();
|
|
4029
4090
|
case 2:
|
|
4030
4091
|
e = _context5.sent;
|
|
4031
4092
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4043,7 +4104,7 @@ var gt = /*#__PURE__*/function () {
|
|
|
4043
4104
|
if (null !== e) try {
|
|
4044
4105
|
return JSON.parse(e);
|
|
4045
4106
|
} catch (e) {
|
|
4046
|
-
return void
|
|
4107
|
+
return void qe("Found malformed Proof Key pair in localstorage.");
|
|
4047
4108
|
}
|
|
4048
4109
|
}
|
|
4049
4110
|
}, {
|
|
@@ -4054,7 +4115,7 @@ var gt = /*#__PURE__*/function () {
|
|
|
4054
4115
|
}], [{
|
|
4055
4116
|
key: "createProofkeyPair",
|
|
4056
4117
|
value: function createProofkeyPair() {
|
|
4057
|
-
return
|
|
4118
|
+
return bt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
4058
4119
|
var _String$fromCharCode;
|
|
4059
4120
|
var e, t, r, n;
|
|
4060
4121
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -4062,7 +4123,7 @@ var gt = /*#__PURE__*/function () {
|
|
|
4062
4123
|
case 0:
|
|
4063
4124
|
e = new Uint32Array(16);
|
|
4064
4125
|
window.crypto.getRandomValues(e);
|
|
4065
|
-
t = Array.from(e).map(
|
|
4126
|
+
t = Array.from(e).map(wt).join("");
|
|
4066
4127
|
_context6.next = 5;
|
|
4067
4128
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4068
4129
|
case 5:
|
|
@@ -4079,54 +4140,9 @@ var gt = /*#__PURE__*/function () {
|
|
|
4079
4140
|
}));
|
|
4080
4141
|
}
|
|
4081
4142
|
}]);
|
|
4082
|
-
return
|
|
4083
|
-
}();
|
|
4084
|
-
var kt = /*#__PURE__*/function () {
|
|
4085
|
-
function kt(e) {
|
|
4086
|
-
_classCallCheck(this, kt);
|
|
4087
|
-
this._networkClient = e;
|
|
4088
|
-
}
|
|
4089
|
-
_createClass(kt, [{
|
|
4090
|
-
key: "searchUser",
|
|
4091
|
-
value: function searchUser(e) {
|
|
4092
|
-
return this._networkClient.fetchSDK({
|
|
4093
|
-
url: "/users/search",
|
|
4094
|
-
method: "POST",
|
|
4095
|
-
body: {
|
|
4096
|
-
email: e
|
|
4097
|
-
},
|
|
4098
|
-
errorMessage: "Error searching for user ".concat(e)
|
|
4099
|
-
});
|
|
4100
|
-
}
|
|
4101
|
-
}, {
|
|
4102
|
-
key: "searchOrganization",
|
|
4103
|
-
value: function searchOrganization(e) {
|
|
4104
|
-
return this._networkClient.fetchSDK({
|
|
4105
|
-
url: "/b2b/organizations/search",
|
|
4106
|
-
method: "POST",
|
|
4107
|
-
body: {
|
|
4108
|
-
organization_slug: e
|
|
4109
|
-
},
|
|
4110
|
-
errorMessage: "Error searching slug"
|
|
4111
|
-
});
|
|
4112
|
-
}
|
|
4113
|
-
}, {
|
|
4114
|
-
key: "searchMember",
|
|
4115
|
-
value: function searchMember(e, t) {
|
|
4116
|
-
return this._networkClient.fetchSDK({
|
|
4117
|
-
url: "/b2b/organizations/members/search",
|
|
4118
|
-
method: "POST",
|
|
4119
|
-
body: {
|
|
4120
|
-
email_address: e,
|
|
4121
|
-
organization_id: t
|
|
4122
|
-
},
|
|
4123
|
-
errorMessage: "Error searching for member ".concat(e)
|
|
4124
|
-
});
|
|
4125
|
-
}
|
|
4126
|
-
}]);
|
|
4127
|
-
return kt;
|
|
4143
|
+
return St;
|
|
4128
4144
|
}();
|
|
4129
|
-
var
|
|
4145
|
+
var Pt = function Pt(e) {
|
|
4130
4146
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4131
4147
|
var _t$split = t.split("="),
|
|
4132
4148
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4135,17 +4151,17 @@ var yt = function yt(e) {
|
|
|
4135
4151
|
}).length > 1;
|
|
4136
4152
|
};
|
|
4137
4153
|
/*! js-cookie v3.0.1 | MIT */
|
|
4138
|
-
function
|
|
4154
|
+
function Ct(e) {
|
|
4139
4155
|
for (var t = 1; t < arguments.length; t++) {
|
|
4140
4156
|
var r = arguments[t];
|
|
4141
4157
|
for (var n in r) e[n] = r[n];
|
|
4142
4158
|
}
|
|
4143
4159
|
return e;
|
|
4144
4160
|
}
|
|
4145
|
-
var
|
|
4161
|
+
var Tt = function e(t, r) {
|
|
4146
4162
|
function n(e, n, i) {
|
|
4147
4163
|
if ("undefined" != typeof document) {
|
|
4148
|
-
"number" == typeof (i =
|
|
4164
|
+
"number" == typeof (i = Ct({}, 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);
|
|
4149
4165
|
var o = "";
|
|
4150
4166
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4151
4167
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4167,15 +4183,15 @@ var St = function e(t, r) {
|
|
|
4167
4183
|
}
|
|
4168
4184
|
},
|
|
4169
4185
|
remove: function remove(e, t) {
|
|
4170
|
-
n(e, "",
|
|
4186
|
+
n(e, "", Ct({}, t, {
|
|
4171
4187
|
expires: -1
|
|
4172
4188
|
}));
|
|
4173
4189
|
},
|
|
4174
4190
|
withAttributes: function withAttributes(t) {
|
|
4175
|
-
return e(this.converter,
|
|
4191
|
+
return e(this.converter, Ct({}, this.attributes, t));
|
|
4176
4192
|
},
|
|
4177
4193
|
withConverter: function withConverter(t) {
|
|
4178
|
-
return e(
|
|
4194
|
+
return e(Ct({}, this.converter, t), this.attributes);
|
|
4179
4195
|
}
|
|
4180
4196
|
}, {
|
|
4181
4197
|
attributes: {
|
|
@@ -4195,37 +4211,37 @@ var St = function e(t, r) {
|
|
|
4195
4211
|
}, {
|
|
4196
4212
|
path: "/"
|
|
4197
4213
|
});
|
|
4198
|
-
var
|
|
4214
|
+
var Ot = function Ot(e) {
|
|
4199
4215
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4200
4216
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4201
4217
|
},
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
clearTimeout(
|
|
4218
|
+
At = new Map(),
|
|
4219
|
+
xt = function xt(e) {
|
|
4220
|
+
clearTimeout(At.get(e));
|
|
4205
4221
|
},
|
|
4206
|
-
|
|
4207
|
-
|
|
4222
|
+
Et = function Et(e, t, r) {
|
|
4223
|
+
xt(e);
|
|
4208
4224
|
var n = setTimeout(function () {
|
|
4209
|
-
void 0 ===
|
|
4225
|
+
void 0 === Tt.get(e) && Tt.set(e, t, r);
|
|
4210
4226
|
}, 10);
|
|
4211
|
-
return
|
|
4227
|
+
return At.set(e, n), Tt.set(e, t, r);
|
|
4212
4228
|
};
|
|
4213
|
-
var
|
|
4214
|
-
function
|
|
4229
|
+
var Dt = /*#__PURE__*/function () {
|
|
4230
|
+
function Dt(e, t) {
|
|
4215
4231
|
var _this4 = this;
|
|
4216
|
-
_classCallCheck(this,
|
|
4232
|
+
_classCallCheck(this, Dt);
|
|
4217
4233
|
this.browserSessionStorage = {
|
|
4218
4234
|
getItem: function getItem(e) {
|
|
4219
|
-
return sessionStorage.getItem(
|
|
4235
|
+
return sessionStorage.getItem(Ot(_this4.publicToken, e));
|
|
4220
4236
|
},
|
|
4221
4237
|
setItem: function setItem(e, t) {
|
|
4222
|
-
return sessionStorage.setItem(
|
|
4238
|
+
return sessionStorage.setItem(Ot(_this4.publicToken, e), t);
|
|
4223
4239
|
},
|
|
4224
4240
|
removeItem: function removeItem(e) {
|
|
4225
|
-
return sessionStorage.removeItem(
|
|
4241
|
+
return sessionStorage.removeItem(Ot(_this4.publicToken, e));
|
|
4226
4242
|
}
|
|
4227
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4228
|
-
var r = localStorage.getItem(
|
|
4243
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ve("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);
|
|
4244
|
+
var r = localStorage.getItem(Ot(this.publicToken));
|
|
4229
4245
|
if (!r) return;
|
|
4230
4246
|
var n;
|
|
4231
4247
|
try {
|
|
@@ -4235,7 +4251,7 @@ var xt = /*#__PURE__*/function () {
|
|
|
4235
4251
|
}
|
|
4236
4252
|
this.state = n;
|
|
4237
4253
|
}
|
|
4238
|
-
_createClass(
|
|
4254
|
+
_createClass(Dt, [{
|
|
4239
4255
|
key: "opaqueTokenCookieName",
|
|
4240
4256
|
get: function get() {
|
|
4241
4257
|
var e;
|
|
@@ -4257,14 +4273,14 @@ var xt = /*#__PURE__*/function () {
|
|
|
4257
4273
|
key: "readSessionCookie",
|
|
4258
4274
|
value: function readSessionCookie() {
|
|
4259
4275
|
return {
|
|
4260
|
-
session_token:
|
|
4261
|
-
session_jwt:
|
|
4276
|
+
session_token: Tt.get(this.opaqueTokenCookieName),
|
|
4277
|
+
session_jwt: Tt.get(this.jwtCookieName)
|
|
4262
4278
|
};
|
|
4263
4279
|
}
|
|
4264
4280
|
}, {
|
|
4265
4281
|
key: "readIntermediateSessionTokenCookie",
|
|
4266
4282
|
value: function readIntermediateSessionTokenCookie() {
|
|
4267
|
-
return
|
|
4283
|
+
return Tt.get(this.istCookieName);
|
|
4268
4284
|
}
|
|
4269
4285
|
}, {
|
|
4270
4286
|
key: "writeSessionCookie",
|
|
@@ -4273,32 +4289,32 @@ var xt = /*#__PURE__*/function () {
|
|
|
4273
4289
|
var o = e.state,
|
|
4274
4290
|
s = e.session_token,
|
|
4275
4291
|
a = e.session_jwt,
|
|
4276
|
-
c =
|
|
4292
|
+
c = Dt.generateCookieOpts({
|
|
4277
4293
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4278
4294
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4279
4295
|
path: this._cookiePath,
|
|
4280
4296
|
domain: this._domain
|
|
4281
4297
|
});
|
|
4282
|
-
|
|
4283
|
-
var u =
|
|
4298
|
+
Et(this.opaqueTokenCookieName, s, c), Et(this.jwtCookieName, a, c);
|
|
4299
|
+
var u = Dt.generateCookieOpts({
|
|
4284
4300
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4285
4301
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4286
4302
|
path: this._cookiePath,
|
|
4287
4303
|
domain: this._domain
|
|
4288
4304
|
});
|
|
4289
|
-
|
|
4305
|
+
Pt(this.jwtCookieName) && Tt.remove(this.jwtCookieName, u), Pt(this.opaqueTokenCookieName) && Tt.remove(this.opaqueTokenCookieName, u), Pt(this.jwtCookieName) && qe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Pt(this.opaqueTokenCookieName) && qe("Could not remove extraneous opaque token cookie.");
|
|
4290
4306
|
}
|
|
4291
4307
|
}, {
|
|
4292
4308
|
key: "writeIntermediateSessionTokenCookie",
|
|
4293
4309
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4294
4310
|
var t = new Date(Date.now() + 6e5),
|
|
4295
|
-
r =
|
|
4311
|
+
r = Dt.generateCookieOpts({
|
|
4296
4312
|
expiresAt: t.toString(),
|
|
4297
4313
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4298
4314
|
path: this._cookiePath,
|
|
4299
4315
|
domain: this._domain
|
|
4300
4316
|
});
|
|
4301
|
-
|
|
4317
|
+
Et(this.istCookieName, e, r);
|
|
4302
4318
|
}
|
|
4303
4319
|
}, {
|
|
4304
4320
|
key: "removeSessionCookie",
|
|
@@ -4317,38 +4333,38 @@ var xt = /*#__PURE__*/function () {
|
|
|
4317
4333
|
[!0, !1].forEach(function (t) {
|
|
4318
4334
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
4319
4335
|
[_this5._domain, null].forEach(function (n) {
|
|
4320
|
-
var i =
|
|
4336
|
+
var i = Dt.generateCookieOpts({
|
|
4321
4337
|
expiresAt: new Date(0).toString(),
|
|
4322
4338
|
availableToSubdomains: t,
|
|
4323
4339
|
path: r,
|
|
4324
4340
|
domain: n
|
|
4325
4341
|
});
|
|
4326
4342
|
e.forEach(function (e) {
|
|
4327
|
-
|
|
4343
|
+
Tt.remove(e, i);
|
|
4328
4344
|
});
|
|
4329
4345
|
});
|
|
4330
4346
|
});
|
|
4331
|
-
}), e.forEach(
|
|
4347
|
+
}), e.forEach(xt);
|
|
4332
4348
|
}
|
|
4333
4349
|
}, {
|
|
4334
4350
|
key: "syncToLocalStorage",
|
|
4335
4351
|
value: function syncToLocalStorage() {
|
|
4336
|
-
localStorage.setItem(
|
|
4352
|
+
localStorage.setItem(Ot(this.publicToken), JSON.stringify(this.state));
|
|
4337
4353
|
}
|
|
4338
4354
|
}, {
|
|
4339
4355
|
key: "getItem",
|
|
4340
4356
|
value: function getItem(e) {
|
|
4341
|
-
return localStorage.getItem(
|
|
4357
|
+
return localStorage.getItem(Ot(this.publicToken, e));
|
|
4342
4358
|
}
|
|
4343
4359
|
}, {
|
|
4344
4360
|
key: "setItem",
|
|
4345
4361
|
value: function setItem(e, t) {
|
|
4346
|
-
return localStorage.setItem(
|
|
4362
|
+
return localStorage.setItem(Ot(this.publicToken, e), t);
|
|
4347
4363
|
}
|
|
4348
4364
|
}, {
|
|
4349
4365
|
key: "removeItem",
|
|
4350
4366
|
value: function removeItem(e) {
|
|
4351
|
-
return localStorage.removeItem(
|
|
4367
|
+
return localStorage.removeItem(Ot(this.publicToken, e));
|
|
4352
4368
|
}
|
|
4353
4369
|
}, {
|
|
4354
4370
|
key: "markStateKeysUpdated",
|
|
@@ -4373,40 +4389,40 @@ var xt = /*#__PURE__*/function () {
|
|
|
4373
4389
|
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;
|
|
4374
4390
|
}
|
|
4375
4391
|
}]);
|
|
4376
|
-
return
|
|
4392
|
+
return Dt;
|
|
4377
4393
|
}();
|
|
4378
|
-
var
|
|
4379
|
-
_inherits(
|
|
4380
|
-
function
|
|
4381
|
-
_classCallCheck(this,
|
|
4382
|
-
return _callSuper(this,
|
|
4394
|
+
var It = /*#__PURE__*/function (_Dt) {
|
|
4395
|
+
_inherits(It, _Dt);
|
|
4396
|
+
function It() {
|
|
4397
|
+
_classCallCheck(this, It);
|
|
4398
|
+
return _callSuper(this, It, arguments);
|
|
4383
4399
|
}
|
|
4384
|
-
return _createClass(
|
|
4385
|
-
}(
|
|
4386
|
-
var
|
|
4387
|
-
|
|
4400
|
+
return _createClass(It);
|
|
4401
|
+
}(Dt);
|
|
4402
|
+
var Rt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4403
|
+
jt = function jt(e, t) {
|
|
4388
4404
|
var r = function () {
|
|
4389
4405
|
var e = window;
|
|
4390
|
-
return e[
|
|
4406
|
+
return e[Rt] || (e[Rt] = {}), e[Rt];
|
|
4391
4407
|
}();
|
|
4392
|
-
return r[e] || (r[e] = new
|
|
4408
|
+
return r[e] || (r[e] = new It(e, t)), r[e];
|
|
4393
4409
|
},
|
|
4394
|
-
|
|
4410
|
+
Ft = function Ft(e, t) {
|
|
4395
4411
|
Object.values(e).forEach(function (e) {
|
|
4396
4412
|
return e(t);
|
|
4397
4413
|
});
|
|
4398
4414
|
},
|
|
4399
|
-
|
|
4415
|
+
Lt = function () {
|
|
4400
4416
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4401
4417
|
t = void 0 === e ? [] : e;
|
|
4402
4418
|
return function e(r, n) {
|
|
4403
|
-
return
|
|
4419
|
+
return fe(r) === fe(n) && (null === r || null === n ? r === n : "object" === fe(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4404
4420
|
return !(e in n);
|
|
4405
4421
|
}) && Object.entries(r).filter(function (e) {
|
|
4406
|
-
var r =
|
|
4422
|
+
var r = de(e, 1)[0];
|
|
4407
4423
|
return !t.includes(r);
|
|
4408
4424
|
}).every(function (t) {
|
|
4409
|
-
var r =
|
|
4425
|
+
var r = de(t, 2),
|
|
4410
4426
|
i = r[0],
|
|
4411
4427
|
o = r[1];
|
|
4412
4428
|
return e(o, n[i]);
|
|
@@ -4415,12 +4431,12 @@ var Et = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4415
4431
|
}({
|
|
4416
4432
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4417
4433
|
});
|
|
4418
|
-
var
|
|
4419
|
-
function
|
|
4434
|
+
var Mt = /*#__PURE__*/function () {
|
|
4435
|
+
function Mt(e, t) {
|
|
4420
4436
|
var _this7 = this;
|
|
4421
|
-
_classCallCheck(this,
|
|
4437
|
+
_classCallCheck(this, Mt);
|
|
4422
4438
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4423
|
-
if (e.key !==
|
|
4439
|
+
if (e.key !== Ot(_this7._publicToken)) return;
|
|
4424
4440
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4425
4441
|
_this7.updateState(t);
|
|
4426
4442
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4428,7 +4444,7 @@ var jt = /*#__PURE__*/function () {
|
|
|
4428
4444
|
r = _this$_datalayer$read.session_token;
|
|
4429
4445
|
r || this.destroySession();
|
|
4430
4446
|
}
|
|
4431
|
-
_createClass(
|
|
4447
|
+
_createClass(Mt, [{
|
|
4432
4448
|
key: "getTokens",
|
|
4433
4449
|
value: function getTokens() {
|
|
4434
4450
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4466,7 +4482,7 @@ var jt = /*#__PURE__*/function () {
|
|
|
4466
4482
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4467
4483
|
this._datalayer.state = r;
|
|
4468
4484
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4469
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4485
|
+
!this._datalayer.markStateKeysUpdated(n) && Lt(t, r) || Ft(this._datalayer.subscriptions, r);
|
|
4470
4486
|
}
|
|
4471
4487
|
}, {
|
|
4472
4488
|
key: "updateStateAndTokens",
|
|
@@ -4481,8 +4497,8 @@ var jt = /*#__PURE__*/function () {
|
|
|
4481
4497
|
this._datalayer.state = r;
|
|
4482
4498
|
var n = e ? Object.keys(e) : [],
|
|
4483
4499
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4484
|
-
o = !
|
|
4485
|
-
(i || o) && (
|
|
4500
|
+
o = !Lt(t, r);
|
|
4501
|
+
(i || o) && (Ft(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4486
4502
|
}
|
|
4487
4503
|
}, {
|
|
4488
4504
|
key: "updateTokens",
|
|
@@ -4522,14 +4538,14 @@ var jt = /*#__PURE__*/function () {
|
|
|
4522
4538
|
return null;
|
|
4523
4539
|
}
|
|
4524
4540
|
}]);
|
|
4525
|
-
return
|
|
4541
|
+
return Mt;
|
|
4526
4542
|
}();
|
|
4527
|
-
var
|
|
4528
|
-
_inherits(
|
|
4529
|
-
function
|
|
4543
|
+
var Bt = /*#__PURE__*/function (_Mt) {
|
|
4544
|
+
_inherits(Bt, _Mt);
|
|
4545
|
+
function Bt() {
|
|
4530
4546
|
var _this8;
|
|
4531
|
-
_classCallCheck(this,
|
|
4532
|
-
_this8 = _callSuper(this,
|
|
4547
|
+
_classCallCheck(this, Bt);
|
|
4548
|
+
_this8 = _callSuper(this, Bt, arguments), _this8.updateMember = function (e) {
|
|
4533
4549
|
return _this8.updateState({
|
|
4534
4550
|
member: e
|
|
4535
4551
|
});
|
|
@@ -4549,16 +4565,16 @@ var Ft = /*#__PURE__*/function (_jt) {
|
|
|
4549
4565
|
};
|
|
4550
4566
|
return _this8;
|
|
4551
4567
|
}
|
|
4552
|
-
return _createClass(
|
|
4553
|
-
}(
|
|
4554
|
-
var
|
|
4555
|
-
var
|
|
4568
|
+
return _createClass(Bt);
|
|
4569
|
+
}(Mt);
|
|
4570
|
+
var Kt = Symbol["for"]("stytch__internal_b2b");
|
|
4571
|
+
var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
4556
4572
|
var _this9 = this;
|
|
4557
|
-
_classCallCheck(this,
|
|
4573
|
+
_classCallCheck(this, zt);
|
|
4558
4574
|
var r;
|
|
4559
4575
|
!function (e) {
|
|
4560
4576
|
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"));
|
|
4561
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4577
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? qe("Public token is malformed. Expected a string, got ".concat(fe(r), ".").concat(He)) : "" === r ? qe('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(He)) : r.startsWith("public-token-") || qe('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(He));
|
|
4562
4578
|
var n = t,
|
|
4563
4579
|
i = {
|
|
4564
4580
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4571,29 +4587,29 @@ var Mt = /*#__PURE__*/_createClass(function Mt(e, t) {
|
|
|
4571
4587
|
}
|
|
4572
4588
|
};
|
|
4573
4589
|
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4574
|
-
this._dataLayer =
|
|
4575
|
-
var m = new
|
|
4576
|
-
this._networkClient = new
|
|
4590
|
+
this._dataLayer = jt(e, n), this._subscriptionService = new Bt(e, this._dataLayer);
|
|
4591
|
+
var m = new St(this._dataLayer, "passwords");
|
|
4592
|
+
this._networkClient = new kt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4577
4593
|
var e, t, r, n;
|
|
4578
4594
|
return {
|
|
4579
4595
|
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
4596
|
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
|
|
4581
4597
|
};
|
|
4582
4598
|
});
|
|
4583
|
-
var v = new
|
|
4584
|
-
b = new
|
|
4585
|
-
g = new
|
|
4586
|
-
|
|
4587
|
-
this.organization = new
|
|
4599
|
+
var v = new vt(e, this._networkClient, this._dataLayer),
|
|
4600
|
+
b = new gt(v.getAsync()),
|
|
4601
|
+
g = new Ye(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4602
|
+
y = new yt(i.endpoints.clientsideServicesIframeURL);
|
|
4603
|
+
this.organization = new rt(this._networkClient, this._subscriptionService), this.member = new et(this._networkClient, this._subscriptionService), this.self = new et(this._networkClient, this._subscriptionService), this.session = new it(this._networkClient, this._subscriptionService), this.magicLinks = new Qe(this._networkClient, this._subscriptionService, new St(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new nt(this._networkClient, this._subscriptionService, new St(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4588
4604
|
publicToken: e,
|
|
4589
4605
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4590
4606
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4591
|
-
}, g), this.sso = new
|
|
4607
|
+
}, g), this.sso = new tt(this._networkClient, this._subscriptionService, new St(this._dataLayer, "sso"), v.getAsync(), {
|
|
4592
4608
|
publicToken: e,
|
|
4593
4609
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4594
4610
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4595
|
-
}), this.discovery = new
|
|
4596
|
-
var
|
|
4611
|
+
}), this.discovery = new ot(this._networkClient, this._subscriptionService), this.passwords = new at(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new ct(this._networkClient, this._subscriptionService, g), this.totp = new ut(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new lt(this._networkClient, this._subscriptionService, g), this.rbac = new dt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new ft(this._subscriptionService, this.session);
|
|
4612
|
+
var k = new pt(this._networkClient);
|
|
4597
4613
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4598
4614
|
name: "b2b_sdk_instance_instantiated",
|
|
4599
4615
|
details: {
|
|
@@ -4603,14 +4619,14 @@ var Mt = /*#__PURE__*/_createClass(function Mt(e, t) {
|
|
|
4603
4619
|
}
|
|
4604
4620
|
});
|
|
4605
4621
|
(function (e, t) {
|
|
4606
|
-
Object.assign(e, _defineProperty({},
|
|
4622
|
+
Object.assign(e, _defineProperty({}, Kt, t));
|
|
4607
4623
|
})(this, {
|
|
4608
4624
|
bootstrap: v,
|
|
4609
|
-
clientsideServices:
|
|
4625
|
+
clientsideServices: y,
|
|
4610
4626
|
publicToken: e,
|
|
4611
|
-
searchManager:
|
|
4627
|
+
searchManager: k,
|
|
4612
4628
|
dataLayer: this._dataLayer,
|
|
4613
4629
|
networkClient: this._networkClient
|
|
4614
4630
|
});
|
|
4615
4631
|
});
|
|
4616
|
-
export {
|
|
4632
|
+
export { y as AuthFlowType, k as B2BMFAProducts, w as B2BOAuthProviders, g as B2BProducts, Q as BiometricsFailedError, L as BiometricsUnavailableError, Y as ChallengeSigningFailedError, U as DeviceCredentialsNotAllowedError, $ as FailedCodeChallengeError, Z as FailedToDecryptDataError, j as InternalError, G as InvalidAuthorizationCredentialError, ne as InvalidCredentialTypeError, te as InvalidRedirectSchemeError, ee as InvalidStartUrlError, oe as JSONDataNotConvertibleToStringError, M as KeyInvalidatedError, B as KeystoreUnavailableError, ie as MissingAttestationObjectError, H as MissingAuthorizationCredentialIDTokenError, q as MissingGoogleClientIDError, W as MissingPKCEError, V as MissingPublicKeyError, re as MissingUrlError, K as NoBiometricsEnrolledError, F as NoBiometricsRegistrationError, R as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, _ as OneTapPositions, ae as PasskeysInvalidEncoding, ce as PasskeysMisconfigured, X as PasskeysUnsupportedError, h as Products, b as RNUIProducts, se as RandomNumberGenerationFailed, S as SDKAPIUnreachableError, J as SDKNotConfiguredError, ue as SignInWithAppleMisconfigured, D as StytchAPIError, E as StytchAPISchemaError, x as StytchAPIUnreachableError, zt as StytchB2BHeadlessClient, A as StytchError, v as StytchEventType, T as StytchSDKAPIError, I as StytchSDKError, C as StytchSDKSchemaError, P as StytchSDKUsageError, O as UNRECOVERABLE_ERROR_TYPES, z as UserCancellationError, N as UserLockedOutError, f as Wallets, le as errorToStytchError };
|