@stytch/vanilla-js 4.5.5 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/b2b/index.esm.js +5724 -4136
- package/dist/b2b/index.headless.esm.js +735 -603
- package/dist/b2b/index.headless.js +717 -587
- package/dist/b2b/index.js +5049 -3463
- package/dist/index.esm.js +3927 -3812
- package/dist/index.headless.esm.js +670 -667
- package/dist/index.headless.js +647 -646
- package/dist/index.js +3837 -3724
- package/package.json +5 -3
|
@@ -134,28 +134,29 @@ function d(e) {
|
|
|
134
134
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
135
135
|
}, d(e);
|
|
136
136
|
}
|
|
137
|
-
var h, p,
|
|
137
|
+
var h, p, f, _, m, v;
|
|
138
138
|
Object.defineProperty(exports, "__esModule", {
|
|
139
139
|
value: !0
|
|
140
|
-
}), exports.Products = void 0, (h = exports.Products || (exports.Products = {})).emailMagicLinks = "emailMagicLinks", h.oauth = "oauth", h.otp = "otp", h.crypto = "crypto", h.passwords = "passwords", h.passkeys = "passkeys", exports.OAuthProviders = void 0, (p = exports.OAuthProviders || (exports.OAuthProviders = {})).Google = "google", p.Microsoft = "microsoft", p.Apple = "apple", p.Github = "github", p.GitLab = "gitlab", p.Facebook = "facebook", p.Discord = "discord", p.Salesforce = "salesforce", p.Slack = "slack", p.Amazon = "amazon", p.Bitbucket = "bitbucket", p.LinkedIn = "linkedin", p.Coinbase = "coinbase", p.Twitch = "twitch", p.Twitter = "twitter", p.TikTok = "tiktok", p.Snapchat = "snapchat", p.Figma = "figma", p.Yahoo = "yahoo", exports.Wallets = void 0, (
|
|
140
|
+
}), exports.Products = void 0, (h = exports.Products || (exports.Products = {})).emailMagicLinks = "emailMagicLinks", h.oauth = "oauth", h.otp = "otp", h.crypto = "crypto", h.passwords = "passwords", h.passkeys = "passkeys", exports.OAuthProviders = void 0, (p = exports.OAuthProviders || (exports.OAuthProviders = {})).Google = "google", p.Microsoft = "microsoft", p.Apple = "apple", p.Github = "github", p.GitLab = "gitlab", p.Facebook = "facebook", p.Discord = "discord", p.Salesforce = "salesforce", p.Slack = "slack", p.Amazon = "amazon", p.Bitbucket = "bitbucket", p.LinkedIn = "linkedin", p.Coinbase = "coinbase", p.Twitch = "twitch", p.Twitter = "twitter", p.TikTok = "tiktok", p.Snapchat = "snapchat", p.Figma = "figma", p.Yahoo = "yahoo", exports.Wallets = void 0, (f = exports.Wallets || (exports.Wallets = {})).Vessel = "Vessel", f.Phantom = "Phantom", f.Metamask = "Metamask", f.Coinbase = "Coinbase", f.Binance = "Binance", f.GenericEthereumWallet = "Other Ethereum Wallet", f.GenericSolanaWallet = "Other Solana Wallet", exports.OneTapPositions = void 0, (_ = exports.OneTapPositions || (exports.OneTapPositions = {})).embedded = "embedded", _.floating = "floating", exports.OTPMethods = void 0, (m = exports.OTPMethods || (exports.OTPMethods = {})).SMS = "sms", m.WhatsApp = "whatsapp", m.Email = "email", exports.StytchEventType = void 0, (v = exports.StytchEventType || (exports.StytchEventType = {})).MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", v.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", v.OTPsAuthenticate = "OTP_AUTHENTICATE", v.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", v.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", v.PasswordCreate = "PASSWORD_CREATE", v.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", v.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", v.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", v.PasskeyRegister = "PASSKEY_REGISTER", v.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", v.PasskeySkip = "PASSKEY_SKIP", v.PasskeyDone = "PASSKEY_DONE", v.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", v.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", v.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", v.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", v.B2BSSOStart = "B2B_SSO_START", v.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", v.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", v.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", v.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", v.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", v.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", v.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", v.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", v.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION", v.B2BSMSOTPSend = "B2B_SMS_OTP_SEND", v.B2BSMSOTPAuthenticate = "B2B_SMS_OTP_AUTHENTICATE", v.B2BTOTPCreate = "B2B_TOTP_CREATE", v.B2BTOTPAuthenticate = "B2B_TOTP_AUTHENTICATE", v.B2BRecoveryCodesRecover = "B2B_RECOVERY_CODES_RECOVER";
|
|
141
141
|
var b,
|
|
142
142
|
g,
|
|
143
|
+
y,
|
|
143
144
|
k,
|
|
144
|
-
|
|
145
|
+
w = function (e) {
|
|
145
146
|
function t(e, r) {
|
|
146
147
|
var n;
|
|
147
148
|
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;
|
|
148
149
|
}
|
|
149
150
|
return a(t, c(Error)), r(t);
|
|
150
151
|
}(),
|
|
151
|
-
|
|
152
|
+
S = function (e) {
|
|
152
153
|
function t(e, r) {
|
|
153
154
|
var n;
|
|
154
155
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
155
156
|
}
|
|
156
157
|
return a(t, c(Error)), r(t);
|
|
157
158
|
}(),
|
|
158
|
-
|
|
159
|
+
P = function (e) {
|
|
159
160
|
function t(e) {
|
|
160
161
|
var r, n;
|
|
161
162
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -179,8 +180,8 @@ var b,
|
|
|
179
180
|
}
|
|
180
181
|
return a(t, c(Error)), r(t);
|
|
181
182
|
}(),
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
C = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
184
|
+
T = function (e) {
|
|
184
185
|
function t(e, r) {
|
|
185
186
|
var n;
|
|
186
187
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
@@ -192,9 +193,9 @@ var b,
|
|
|
192
193
|
var r;
|
|
193
194
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
194
195
|
}
|
|
195
|
-
return a(t,
|
|
196
|
+
return a(t, T), r(t);
|
|
196
197
|
}(),
|
|
197
|
-
|
|
198
|
+
E = function (e) {
|
|
198
199
|
function t(e) {
|
|
199
200
|
var r;
|
|
200
201
|
i(this, t);
|
|
@@ -203,7 +204,7 @@ var b,
|
|
|
203
204
|
}).join("\n");
|
|
204
205
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
205
206
|
}
|
|
206
|
-
return a(t,
|
|
207
|
+
return a(t, T), r(t);
|
|
207
208
|
}(),
|
|
208
209
|
A = function (e) {
|
|
209
210
|
function t(e) {
|
|
@@ -216,190 +217,190 @@ var b,
|
|
|
216
217
|
u = e.request_id;
|
|
217
218
|
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;
|
|
218
219
|
}
|
|
219
|
-
return a(t,
|
|
220
|
+
return a(t, T), r(t);
|
|
220
221
|
}(),
|
|
221
|
-
|
|
222
|
+
D = function (e) {
|
|
222
223
|
function t(e, r, n) {
|
|
223
224
|
var s;
|
|
224
225
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
225
226
|
}
|
|
226
|
-
return a(t,
|
|
227
|
+
return a(t, T), r(t);
|
|
227
228
|
}(),
|
|
228
|
-
|
|
229
|
+
I = function (e) {
|
|
229
230
|
function t() {
|
|
230
231
|
return i(this, t), o(this, t, ["NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session."]);
|
|
231
232
|
}
|
|
232
|
-
return a(t,
|
|
233
|
+
return a(t, D), r(t);
|
|
233
234
|
}(),
|
|
234
|
-
|
|
235
|
+
R = function (e) {
|
|
235
236
|
function t(e) {
|
|
236
237
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
237
238
|
}
|
|
238
|
-
return a(t,
|
|
239
|
+
return a(t, D), r(t);
|
|
239
240
|
}(),
|
|
240
|
-
|
|
241
|
+
B = function (e) {
|
|
241
242
|
function t() {
|
|
242
243
|
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."]);
|
|
243
244
|
}
|
|
244
|
-
return a(t,
|
|
245
|
+
return a(t, D), r(t);
|
|
245
246
|
}(),
|
|
246
|
-
|
|
247
|
+
F = function (e) {
|
|
247
248
|
function t() {
|
|
248
249
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
249
250
|
}
|
|
250
|
-
return a(t,
|
|
251
|
+
return a(t, D), r(t);
|
|
251
252
|
}(),
|
|
252
|
-
|
|
253
|
+
j = function (e) {
|
|
253
254
|
function t() {
|
|
254
255
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
255
256
|
}
|
|
256
|
-
return a(t,
|
|
257
|
+
return a(t, D), r(t);
|
|
257
258
|
}(),
|
|
258
259
|
M = function (e) {
|
|
259
260
|
function t() {
|
|
260
261
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
261
262
|
}
|
|
262
|
-
return a(t,
|
|
263
|
+
return a(t, D), r(t);
|
|
263
264
|
}(),
|
|
264
265
|
L = function (e) {
|
|
265
266
|
function t() {
|
|
266
267
|
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."]);
|
|
267
268
|
}
|
|
268
|
-
return a(t,
|
|
269
|
+
return a(t, D), r(t);
|
|
269
270
|
}(),
|
|
270
|
-
|
|
271
|
+
K = function (e) {
|
|
271
272
|
function t() {
|
|
272
273
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
273
274
|
}
|
|
274
|
-
return a(t,
|
|
275
|
+
return a(t, D), r(t);
|
|
275
276
|
}(),
|
|
276
|
-
|
|
277
|
+
N = function (e) {
|
|
277
278
|
function t() {
|
|
278
279
|
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."]);
|
|
279
280
|
}
|
|
280
|
-
return a(t,
|
|
281
|
+
return a(t, D), r(t);
|
|
281
282
|
}(),
|
|
282
|
-
|
|
283
|
+
U = function (e) {
|
|
283
284
|
function t() {
|
|
284
285
|
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."]);
|
|
285
286
|
}
|
|
286
|
-
return a(t,
|
|
287
|
+
return a(t, D), r(t);
|
|
287
288
|
}(),
|
|
288
|
-
|
|
289
|
+
z = function (e) {
|
|
289
290
|
function t() {
|
|
290
291
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
291
292
|
}
|
|
292
|
-
return a(t,
|
|
293
|
+
return a(t, D), r(t);
|
|
293
294
|
}(),
|
|
294
|
-
|
|
295
|
+
q = function (e) {
|
|
295
296
|
function t() {
|
|
296
297
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
297
298
|
}
|
|
298
|
-
return a(t,
|
|
299
|
+
return a(t, D), r(t);
|
|
299
300
|
}(),
|
|
300
|
-
|
|
301
|
+
W = function (e) {
|
|
301
302
|
function t() {
|
|
302
303
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
303
304
|
}
|
|
304
|
-
return a(t,
|
|
305
|
+
return a(t, D), r(t);
|
|
305
306
|
}(),
|
|
306
|
-
|
|
307
|
+
H = function (e) {
|
|
307
308
|
function t() {
|
|
308
309
|
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."]);
|
|
309
310
|
}
|
|
310
|
-
return a(t,
|
|
311
|
+
return a(t, D), r(t);
|
|
311
312
|
}(),
|
|
312
|
-
|
|
313
|
+
G = function (e) {
|
|
313
314
|
function t() {
|
|
314
315
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
315
316
|
}
|
|
316
|
-
return a(t,
|
|
317
|
+
return a(t, D), r(t);
|
|
317
318
|
}(),
|
|
318
|
-
|
|
319
|
+
V = function (e) {
|
|
319
320
|
function t() {
|
|
320
321
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
321
322
|
}
|
|
322
|
-
return a(t,
|
|
323
|
+
return a(t, D), r(t);
|
|
323
324
|
}(),
|
|
324
|
-
|
|
325
|
+
Y = function (e) {
|
|
325
326
|
function t() {
|
|
326
327
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
327
328
|
}
|
|
328
|
-
return a(t,
|
|
329
|
+
return a(t, D), r(t);
|
|
329
330
|
}(),
|
|
330
|
-
|
|
331
|
+
J = function (e) {
|
|
331
332
|
function t() {
|
|
332
333
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
333
334
|
}
|
|
334
|
-
return a(t,
|
|
335
|
+
return a(t, D), r(t);
|
|
335
336
|
}(),
|
|
336
|
-
|
|
337
|
+
$ = function (e) {
|
|
337
338
|
function t() {
|
|
338
339
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
339
340
|
}
|
|
340
|
-
return a(t,
|
|
341
|
+
return a(t, D), r(t);
|
|
341
342
|
}(),
|
|
342
|
-
|
|
343
|
+
X = function (e) {
|
|
343
344
|
function t() {
|
|
344
345
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
345
346
|
}
|
|
346
|
-
return a(t,
|
|
347
|
+
return a(t, D), r(t);
|
|
347
348
|
}(),
|
|
348
|
-
|
|
349
|
+
Z = function (e) {
|
|
349
350
|
function t() {
|
|
350
351
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
351
352
|
}
|
|
352
|
-
return a(t,
|
|
353
|
+
return a(t, D), r(t);
|
|
353
354
|
}(),
|
|
354
|
-
|
|
355
|
+
Q = function (e) {
|
|
355
356
|
function t() {
|
|
356
357
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
357
358
|
}
|
|
358
|
-
return a(t,
|
|
359
|
+
return a(t, D), r(t);
|
|
359
360
|
}(),
|
|
360
|
-
|
|
361
|
+
ee = function (e) {
|
|
361
362
|
function t() {
|
|
362
363
|
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."]);
|
|
363
364
|
}
|
|
364
|
-
return a(t,
|
|
365
|
+
return a(t, D), r(t);
|
|
365
366
|
}(),
|
|
366
|
-
|
|
367
|
+
te = function (e) {
|
|
367
368
|
function t() {
|
|
368
369
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
369
370
|
}
|
|
370
|
-
return a(t,
|
|
371
|
+
return a(t, D), r(t);
|
|
371
372
|
}(),
|
|
372
|
-
|
|
373
|
+
re = function (e) {
|
|
373
374
|
function t() {
|
|
374
375
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
375
376
|
}
|
|
376
|
-
return a(t,
|
|
377
|
+
return a(t, D), r(t);
|
|
377
378
|
}(),
|
|
378
|
-
|
|
379
|
+
ne = function (e) {
|
|
379
380
|
function t() {
|
|
380
381
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
381
382
|
}
|
|
382
|
-
return a(t,
|
|
383
|
+
return a(t, D), r(t);
|
|
383
384
|
}(),
|
|
384
|
-
|
|
385
|
+
ie = function (e) {
|
|
385
386
|
function t() {
|
|
386
387
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
387
388
|
}
|
|
388
|
-
return a(t,
|
|
389
|
+
return a(t, D), r(t);
|
|
389
390
|
}(),
|
|
390
|
-
|
|
391
|
+
oe = function (e) {
|
|
391
392
|
function t() {
|
|
392
393
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
393
394
|
}
|
|
394
|
-
return a(t,
|
|
395
|
+
return a(t, D), r(t);
|
|
395
396
|
}(),
|
|
396
|
-
|
|
397
|
+
se = function (e) {
|
|
397
398
|
function t() {
|
|
398
399
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
399
400
|
}
|
|
400
|
-
return a(t,
|
|
401
|
+
return a(t, D), r(t);
|
|
401
402
|
}();
|
|
402
|
-
function
|
|
403
|
+
function ae(e, t) {
|
|
403
404
|
return function (e) {
|
|
404
405
|
if (Array.isArray(e)) return e;
|
|
405
406
|
}(e) || function (e, t) {
|
|
@@ -428,32 +429,32 @@ function se(e, t) {
|
|
|
428
429
|
}
|
|
429
430
|
return a;
|
|
430
431
|
}
|
|
431
|
-
}(e, t) ||
|
|
432
|
+
}(e, t) || ce(e, t) || function () {
|
|
432
433
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
433
434
|
}();
|
|
434
435
|
}
|
|
435
|
-
function
|
|
436
|
+
function ce(e, t) {
|
|
436
437
|
if (e) {
|
|
437
|
-
if ("string" == typeof e) return
|
|
438
|
+
if ("string" == typeof e) return ue(e, t);
|
|
438
439
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
439
|
-
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) ?
|
|
440
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ue(e, t) : void 0;
|
|
440
441
|
}
|
|
441
442
|
}
|
|
442
|
-
function
|
|
443
|
+
function ue(e, t) {
|
|
443
444
|
(null == t || t > e.length) && (t = e.length);
|
|
444
445
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
445
446
|
return n;
|
|
446
447
|
}
|
|
447
|
-
function
|
|
448
|
-
return
|
|
448
|
+
function le(e) {
|
|
449
|
+
return le = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
449
450
|
return _typeof(e);
|
|
450
451
|
} : function (e) {
|
|
451
452
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
452
|
-
},
|
|
453
|
+
}, le(e);
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
+
function de() {
|
|
455
456
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
456
|
-
|
|
457
|
+
de = function de() {
|
|
457
458
|
return t;
|
|
458
459
|
};
|
|
459
460
|
var e,
|
|
@@ -485,7 +486,7 @@ function le() {
|
|
|
485
486
|
function l(e, t, r, n) {
|
|
486
487
|
var o = t && t.prototype instanceof v ? t : v,
|
|
487
488
|
s = Object.create(o.prototype),
|
|
488
|
-
a = new
|
|
489
|
+
a = new A(n || []);
|
|
489
490
|
return i(s, "_invoke", {
|
|
490
491
|
value: C(e, r, a)
|
|
491
492
|
}), s;
|
|
@@ -506,34 +507,34 @@ function le() {
|
|
|
506
507
|
t.wrap = l;
|
|
507
508
|
var h = "suspendedStart",
|
|
508
509
|
p = "suspendedYield",
|
|
509
|
-
|
|
510
|
-
|
|
510
|
+
f = "executing",
|
|
511
|
+
_ = "completed",
|
|
511
512
|
m = {};
|
|
512
513
|
function v() {}
|
|
513
514
|
function b() {}
|
|
514
515
|
function g() {}
|
|
515
|
-
var
|
|
516
|
-
u(
|
|
516
|
+
var y = {};
|
|
517
|
+
u(y, s, function () {
|
|
517
518
|
return this;
|
|
518
519
|
});
|
|
519
|
-
var
|
|
520
|
-
w =
|
|
521
|
-
w && w !== r && n.call(w, s) && (
|
|
522
|
-
var S = g.prototype = v.prototype = Object.create(
|
|
523
|
-
function
|
|
520
|
+
var k = Object.getPrototypeOf,
|
|
521
|
+
w = k && k(k(D([])));
|
|
522
|
+
w && w !== r && n.call(w, s) && (y = w);
|
|
523
|
+
var S = g.prototype = v.prototype = Object.create(y);
|
|
524
|
+
function P(e) {
|
|
524
525
|
["next", "throw", "return"].forEach(function (t) {
|
|
525
526
|
u(e, t, function (e) {
|
|
526
527
|
return this._invoke(t, e);
|
|
527
528
|
});
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
|
-
function
|
|
531
|
+
function x(e, t) {
|
|
531
532
|
function r(i, o, s, a) {
|
|
532
533
|
var c = d(e[i], e, o);
|
|
533
534
|
if ("throw" !== c.type) {
|
|
534
535
|
var u = c.arg,
|
|
535
536
|
l = u.value;
|
|
536
|
-
return l && "object" ==
|
|
537
|
+
return l && "object" == le(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
537
538
|
r("next", e, s, a);
|
|
538
539
|
}, function (e) {
|
|
539
540
|
r("throw", e, s, a);
|
|
@@ -560,8 +561,8 @@ function le() {
|
|
|
560
561
|
function C(t, r, n) {
|
|
561
562
|
var i = h;
|
|
562
563
|
return function (o, s) {
|
|
563
|
-
if (i ===
|
|
564
|
-
if (i ===
|
|
564
|
+
if (i === f) throw new Error("Generator is already running");
|
|
565
|
+
if (i === _) {
|
|
565
566
|
if ("throw" === o) throw s;
|
|
566
567
|
return {
|
|
567
568
|
value: e,
|
|
@@ -571,52 +572,52 @@ function le() {
|
|
|
571
572
|
for (n.method = o, n.arg = s;;) {
|
|
572
573
|
var a = n.delegate;
|
|
573
574
|
if (a) {
|
|
574
|
-
var c =
|
|
575
|
+
var c = T(a, n);
|
|
575
576
|
if (c) {
|
|
576
577
|
if (c === m) continue;
|
|
577
578
|
return c;
|
|
578
579
|
}
|
|
579
580
|
}
|
|
580
581
|
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
581
|
-
if (i === h) throw i =
|
|
582
|
+
if (i === h) throw i = _, n.arg;
|
|
582
583
|
n.dispatchException(n.arg);
|
|
583
584
|
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
584
|
-
i =
|
|
585
|
+
i = f;
|
|
585
586
|
var u = d(t, r, n);
|
|
586
587
|
if ("normal" === u.type) {
|
|
587
|
-
if (i = n.done ?
|
|
588
|
+
if (i = n.done ? _ : p, u.arg === m) continue;
|
|
588
589
|
return {
|
|
589
590
|
value: u.arg,
|
|
590
591
|
done: n.done
|
|
591
592
|
};
|
|
592
593
|
}
|
|
593
|
-
"throw" === u.type && (i =
|
|
594
|
+
"throw" === u.type && (i = _, n.method = "throw", n.arg = u.arg);
|
|
594
595
|
}
|
|
595
596
|
};
|
|
596
597
|
}
|
|
597
|
-
function
|
|
598
|
+
function T(t, r) {
|
|
598
599
|
var n = r.method,
|
|
599
600
|
i = t.iterator[n];
|
|
600
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
601
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, T(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
601
602
|
var o = d(i, t.iterator, r.arg);
|
|
602
603
|
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
603
604
|
var s = o.arg;
|
|
604
605
|
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);
|
|
605
606
|
}
|
|
606
|
-
function
|
|
607
|
+
function O(e) {
|
|
607
608
|
var t = {
|
|
608
609
|
tryLoc: e[0]
|
|
609
610
|
};
|
|
610
611
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
611
612
|
}
|
|
612
|
-
function
|
|
613
|
+
function E(e) {
|
|
613
614
|
var t = e.completion || {};
|
|
614
615
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
615
616
|
}
|
|
616
|
-
function
|
|
617
|
+
function A(e) {
|
|
617
618
|
this.tryEntries = [{
|
|
618
619
|
tryLoc: "root"
|
|
619
|
-
}], e.forEach(
|
|
620
|
+
}], e.forEach(O, this), this.reset(!0);
|
|
620
621
|
}
|
|
621
622
|
function D(t) {
|
|
622
623
|
if (t || "" === t) {
|
|
@@ -632,7 +633,7 @@ function le() {
|
|
|
632
633
|
return o.next = o;
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
|
-
throw new TypeError(
|
|
636
|
+
throw new TypeError(le(t) + " is not iterable");
|
|
636
637
|
}
|
|
637
638
|
return b.prototype = g, i(S, "constructor", {
|
|
638
639
|
value: g,
|
|
@@ -649,15 +650,15 @@ function le() {
|
|
|
649
650
|
return {
|
|
650
651
|
__await: e
|
|
651
652
|
};
|
|
652
|
-
}, x
|
|
653
|
+
}, P(x.prototype), u(x.prototype, a, function () {
|
|
653
654
|
return this;
|
|
654
|
-
}), t.AsyncIterator =
|
|
655
|
+
}), t.AsyncIterator = x, t.async = function (e, r, n, i, o) {
|
|
655
656
|
void 0 === o && (o = Promise);
|
|
656
|
-
var s = new
|
|
657
|
+
var s = new x(l(e, r, n, i), o);
|
|
657
658
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
658
659
|
return e.done ? e.value : s.next();
|
|
659
660
|
});
|
|
660
|
-
},
|
|
661
|
+
}, P(S), u(S, c, "Generator"), u(S, s, function () {
|
|
661
662
|
return this;
|
|
662
663
|
}), u(S, "toString", function () {
|
|
663
664
|
return "[object Generator]";
|
|
@@ -672,10 +673,10 @@ function le() {
|
|
|
672
673
|
}
|
|
673
674
|
return e.done = !0, e;
|
|
674
675
|
};
|
|
675
|
-
}, t.values = D,
|
|
676
|
-
constructor:
|
|
676
|
+
}, t.values = D, A.prototype = {
|
|
677
|
+
constructor: A,
|
|
677
678
|
reset: function reset(t) {
|
|
678
|
-
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(
|
|
679
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(E), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
679
680
|
},
|
|
680
681
|
stop: function stop() {
|
|
681
682
|
this.done = !0;
|
|
@@ -727,7 +728,7 @@ function le() {
|
|
|
727
728
|
finish: function finish(e) {
|
|
728
729
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
729
730
|
var r = this.tryEntries[t];
|
|
730
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
731
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), E(r), m;
|
|
731
732
|
}
|
|
732
733
|
},
|
|
733
734
|
"catch": function _catch(e) {
|
|
@@ -737,7 +738,7 @@ function le() {
|
|
|
737
738
|
var n = r.completion;
|
|
738
739
|
if ("throw" === n.type) {
|
|
739
740
|
var i = n.arg;
|
|
740
|
-
|
|
741
|
+
E(r);
|
|
741
742
|
}
|
|
742
743
|
return i;
|
|
743
744
|
}
|
|
@@ -753,46 +754,46 @@ function le() {
|
|
|
753
754
|
}
|
|
754
755
|
}, t;
|
|
755
756
|
}
|
|
756
|
-
function
|
|
757
|
+
function he(e, t) {
|
|
757
758
|
for (var r = 0; r < t.length; r++) {
|
|
758
759
|
var n = t[r];
|
|
759
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
760
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, fe(n.key), n);
|
|
760
761
|
}
|
|
761
762
|
}
|
|
762
|
-
function
|
|
763
|
-
return t &&
|
|
763
|
+
function pe(e, t, r) {
|
|
764
|
+
return t && he(e.prototype, t), r && he(e, r), Object.defineProperty(e, "prototype", {
|
|
764
765
|
writable: !1
|
|
765
766
|
}), e;
|
|
766
767
|
}
|
|
767
|
-
function
|
|
768
|
+
function fe(e) {
|
|
768
769
|
var t = function (e, t) {
|
|
769
|
-
if ("object" !=
|
|
770
|
+
if ("object" != le(e) || !e) return e;
|
|
770
771
|
var r = e[Symbol.toPrimitive];
|
|
771
772
|
if (void 0 !== r) {
|
|
772
773
|
var n = r.call(e, t || "default");
|
|
773
|
-
if ("object" !=
|
|
774
|
+
if ("object" != le(n)) return n;
|
|
774
775
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
775
776
|
}
|
|
776
777
|
return ("string" === t ? String : Number)(e);
|
|
777
778
|
}(e, "string");
|
|
778
|
-
return "symbol" ==
|
|
779
|
+
return "symbol" == le(t) ? t : String(t);
|
|
779
780
|
}
|
|
780
781
|
function _e(e, t) {
|
|
781
782
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
782
783
|
}
|
|
783
|
-
function
|
|
784
|
-
return t =
|
|
785
|
-
if (t && ("object" ===
|
|
784
|
+
function me(e, t, r) {
|
|
785
|
+
return t = ye(t), function (e, t) {
|
|
786
|
+
if (t && ("object" === le(t) || "function" == typeof t)) return t;
|
|
786
787
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
787
788
|
return function (e) {
|
|
788
789
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
789
790
|
return e;
|
|
790
791
|
}(e);
|
|
791
|
-
}(e,
|
|
792
|
+
}(e, be() ? Reflect.construct(t, r || [], ye(e).constructor) : t.apply(e, r));
|
|
792
793
|
}
|
|
793
|
-
function
|
|
794
|
+
function ve(e) {
|
|
794
795
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
795
|
-
return
|
|
796
|
+
return ve = function ve(e) {
|
|
796
797
|
if (null === e || !function (e) {
|
|
797
798
|
try {
|
|
798
799
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -807,12 +808,12 @@ function me(e) {
|
|
|
807
808
|
}
|
|
808
809
|
function r() {
|
|
809
810
|
return function (e, t, r) {
|
|
810
|
-
if (
|
|
811
|
+
if (be()) return Reflect.construct.apply(null, arguments);
|
|
811
812
|
var n = [null];
|
|
812
813
|
n.push.apply(n, t);
|
|
813
814
|
var i = new (e.bind.apply(e, n))();
|
|
814
|
-
return r &&
|
|
815
|
-
}(e, arguments,
|
|
815
|
+
return r && ge(i, r.prototype), i;
|
|
816
|
+
}(e, arguments, ye(this).constructor);
|
|
816
817
|
}
|
|
817
818
|
return r.prototype = Object.create(e.prototype, {
|
|
818
819
|
constructor: {
|
|
@@ -821,30 +822,30 @@ function me(e) {
|
|
|
821
822
|
writable: !0,
|
|
822
823
|
configurable: !0
|
|
823
824
|
}
|
|
824
|
-
}),
|
|
825
|
-
},
|
|
825
|
+
}), ge(r, e);
|
|
826
|
+
}, ve(e);
|
|
826
827
|
}
|
|
827
|
-
function
|
|
828
|
+
function be() {
|
|
828
829
|
try {
|
|
829
830
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
830
831
|
} catch (e) {}
|
|
831
|
-
return (
|
|
832
|
+
return (be = function be() {
|
|
832
833
|
return !!e;
|
|
833
834
|
})();
|
|
834
835
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
836
|
+
function ge(e, t) {
|
|
837
|
+
return ge = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
837
838
|
return e.__proto__ = t, e;
|
|
838
|
-
},
|
|
839
|
+
}, ge(e, t);
|
|
839
840
|
}
|
|
840
|
-
function
|
|
841
|
-
return
|
|
841
|
+
function ye(e) {
|
|
842
|
+
return ye = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
842
843
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
843
|
-
},
|
|
844
|
+
}, ye(e);
|
|
844
845
|
}
|
|
845
|
-
exports.B2BProducts = void 0, (b = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", b.sso = "sso", b.passwords = "passwords", b.oauth = "oauth", exports.AuthFlowType = void 0, (g = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", g.Organization = "Organization", g.PasswordReset = "PasswordReset", exports.B2BOAuthProviders = void 0, (k = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", k.Microsoft = "microsoft";
|
|
846
|
+
exports.B2BProducts = void 0, (b = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", b.sso = "sso", b.passwords = "passwords", b.oauth = "oauth", exports.AuthFlowType = void 0, (g = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", g.Organization = "Organization", g.PasswordReset = "PasswordReset", exports.B2BMFAProducts = void 0, (y = exports.B2BMFAProducts || (exports.B2BMFAProducts = {})).smsOtp = "smsOtp", y.totp = "totp", exports.B2BOAuthProviders = void 0, (k = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", k.Microsoft = "microsoft";
|
|
846
847
|
var ke;
|
|
847
|
-
function
|
|
848
|
+
function we(e, t, r, n) {
|
|
848
849
|
return new (r || (r = Promise))(function (i, o) {
|
|
849
850
|
function s(e) {
|
|
850
851
|
try {
|
|
@@ -872,11 +873,11 @@ function ye(e, t, r, n) {
|
|
|
872
873
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
873
874
|
e.RequiredCatcha = "Catcha Required";
|
|
874
875
|
}(ke || (ke = {}));
|
|
875
|
-
var
|
|
876
|
-
|
|
876
|
+
var Se,
|
|
877
|
+
Pe = function (e) {
|
|
877
878
|
function t(e) {
|
|
878
879
|
var r;
|
|
879
|
-
return _e(this, t), (r =
|
|
880
|
+
return _e(this, t), (r = me(this, t, [e])).type = e, r;
|
|
880
881
|
}
|
|
881
882
|
return function (e, t) {
|
|
882
883
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -888,8 +889,8 @@ var we,
|
|
|
888
889
|
}
|
|
889
890
|
}), Object.defineProperty(e, "prototype", {
|
|
890
891
|
writable: !1
|
|
891
|
-
}), t &&
|
|
892
|
-
}(t,
|
|
892
|
+
}), t && ge(e, t);
|
|
893
|
+
}(t, ve(Error)), pe(t);
|
|
893
894
|
}();
|
|
894
895
|
function xe(e) {
|
|
895
896
|
var t,
|
|
@@ -899,9 +900,9 @@ function xe(e) {
|
|
|
899
900
|
o = e.xSDKClientHeader,
|
|
900
901
|
s = e.xSDKParentHostHeader,
|
|
901
902
|
a = e.body;
|
|
902
|
-
return
|
|
903
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
903
904
|
var c, u, l, d, h, p;
|
|
904
|
-
return
|
|
905
|
+
return de().wrap(function (e) {
|
|
905
906
|
for (;;) switch (e.prev = e.next) {
|
|
906
907
|
case 0:
|
|
907
908
|
return c = {
|
|
@@ -950,7 +951,7 @@ function xe(e) {
|
|
|
950
951
|
e.next = 37;
|
|
951
952
|
break;
|
|
952
953
|
}
|
|
953
|
-
throw new
|
|
954
|
+
throw new E(h);
|
|
954
955
|
case 37:
|
|
955
956
|
throw new A(h);
|
|
956
957
|
case 38:
|
|
@@ -965,7 +966,7 @@ function xe(e) {
|
|
|
965
966
|
e.next = 49;
|
|
966
967
|
break;
|
|
967
968
|
}
|
|
968
|
-
throw new
|
|
969
|
+
throw new Pe(ke.RequiredCatcha);
|
|
969
970
|
case 49:
|
|
970
971
|
throw new O("Invalid response from the Stytch servers.");
|
|
971
972
|
case 50:
|
|
@@ -975,43 +976,43 @@ function xe(e) {
|
|
|
975
976
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
976
977
|
}));
|
|
977
978
|
}
|
|
978
|
-
var
|
|
979
|
-
function
|
|
980
|
-
if (!
|
|
981
|
-
return
|
|
979
|
+
var Ce = new Uint8Array(16);
|
|
980
|
+
function Te() {
|
|
981
|
+
if (!Se && !(Se = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
982
|
+
return Se(Ce);
|
|
982
983
|
}
|
|
983
984
|
var Oe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
984
|
-
for (var
|
|
985
|
-
function
|
|
985
|
+
for (var Ee = [], Ae = 0; Ae < 256; ++Ae) Ee.push((Ae + 256).toString(16).substr(1));
|
|
986
|
+
function De(e) {
|
|
986
987
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
987
|
-
r = (
|
|
988
|
+
r = (Ee[e[t + 0]] + Ee[e[t + 1]] + Ee[e[t + 2]] + Ee[e[t + 3]] + "-" + Ee[e[t + 4]] + Ee[e[t + 5]] + "-" + Ee[e[t + 6]] + Ee[e[t + 7]] + "-" + Ee[e[t + 8]] + Ee[e[t + 9]] + "-" + Ee[e[t + 10]] + Ee[e[t + 11]] + Ee[e[t + 12]] + Ee[e[t + 13]] + Ee[e[t + 14]] + Ee[e[t + 15]]).toLowerCase();
|
|
988
989
|
if (!function (e) {
|
|
989
990
|
return "string" == typeof e && Oe.test(e);
|
|
990
991
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
991
992
|
return r;
|
|
992
993
|
}
|
|
993
|
-
function
|
|
994
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
994
|
+
function Ie(e, t, r) {
|
|
995
|
+
var n = (e = e || {}).random || (e.rng || Te)();
|
|
995
996
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
996
997
|
r = r || 0;
|
|
997
998
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
998
999
|
return t;
|
|
999
1000
|
}
|
|
1000
|
-
return
|
|
1001
|
+
return De(n);
|
|
1001
1002
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1005
|
-
return
|
|
1003
|
+
var Re = {};
|
|
1004
|
+
function Be(e, t) {
|
|
1005
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1006
|
+
return de().wrap(function (r) {
|
|
1006
1007
|
for (;;) switch (r.prev = r.next) {
|
|
1007
1008
|
case 0:
|
|
1008
|
-
if (void 0 ===
|
|
1009
|
+
if (void 0 === Re[e]) {
|
|
1009
1010
|
r.next = 2;
|
|
1010
1011
|
break;
|
|
1011
1012
|
}
|
|
1012
|
-
return r.abrupt("return",
|
|
1013
|
+
return r.abrupt("return", Re[e]);
|
|
1013
1014
|
case 2:
|
|
1014
|
-
return
|
|
1015
|
+
return Re[e] = Fe(e, t), r.abrupt("return", Re[e]);
|
|
1015
1016
|
case 4:
|
|
1016
1017
|
case "end":
|
|
1017
1018
|
return r.stop();
|
|
@@ -1019,10 +1020,10 @@ function Fe(e, t) {
|
|
|
1019
1020
|
}, r);
|
|
1020
1021
|
}));
|
|
1021
1022
|
}
|
|
1022
|
-
function
|
|
1023
|
+
function Fe(e, t) {
|
|
1023
1024
|
return new Promise(function (r, n) {
|
|
1024
1025
|
var i = function (e) {
|
|
1025
|
-
var t =
|
|
1026
|
+
var t = je(e);
|
|
1026
1027
|
if (t[0]) return t[0];
|
|
1027
1028
|
}(e);
|
|
1028
1029
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1046,47 +1047,47 @@ function je(e, t) {
|
|
|
1046
1047
|
});
|
|
1047
1048
|
});
|
|
1048
1049
|
}
|
|
1049
|
-
var
|
|
1050
|
+
var je = function je(e) {
|
|
1050
1051
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1051
1052
|
};
|
|
1052
1053
|
var Me,
|
|
1053
1054
|
Le = ["[Stytch]"],
|
|
1054
|
-
|
|
1055
|
+
Ke = function Ke() {
|
|
1055
1056
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1056
1057
|
return (e = console).warn.apply(e, Le.concat(r));
|
|
1057
1058
|
},
|
|
1058
|
-
|
|
1059
|
+
Ne = function Ne() {
|
|
1059
1060
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1060
1061
|
return (e = console).error.apply(e, Le.concat(r));
|
|
1061
1062
|
},
|
|
1062
|
-
|
|
1063
|
-
|
|
1063
|
+
Ue = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1064
|
+
ze = function ze(e) {
|
|
1064
1065
|
return e.includes("public-token-test");
|
|
1065
1066
|
},
|
|
1066
|
-
|
|
1067
|
+
qe = function qe(e) {
|
|
1067
1068
|
var t = {
|
|
1068
1069
|
isObject: function isObject(r, n) {
|
|
1069
|
-
var i = "object" ===
|
|
1070
|
-
if (!i) throw new
|
|
1070
|
+
var i = "object" === le(n) && !Array.isArray(n) && null !== n;
|
|
1071
|
+
if (!i) throw new S(e, r + " must be an object.");
|
|
1071
1072
|
return t;
|
|
1072
1073
|
},
|
|
1073
1074
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1074
1075
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1075
1076
|
},
|
|
1076
1077
|
isString: function isString(r, n) {
|
|
1077
|
-
if ("string" != typeof n) throw new
|
|
1078
|
+
if ("string" != typeof n) throw new S(e, r + " must be a string.");
|
|
1078
1079
|
return t;
|
|
1079
1080
|
},
|
|
1080
1081
|
isOptionalString: function isOptionalString(e, r) {
|
|
1081
1082
|
return void 0 === r ? t : t.isString(e, r);
|
|
1082
1083
|
},
|
|
1083
1084
|
isStringArray: function isStringArray(r, n) {
|
|
1084
|
-
if (!Array.isArray(n)) throw new
|
|
1085
|
+
if (!Array.isArray(n)) throw new S(e, r + " must be an array of strings.");
|
|
1085
1086
|
var i,
|
|
1086
1087
|
o = function (e, t) {
|
|
1087
1088
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1088
1089
|
if (!r) {
|
|
1089
|
-
if (Array.isArray(e) || (r =
|
|
1090
|
+
if (Array.isArray(e) || (r = ce(e)) || t && e && "number" == typeof e.length) {
|
|
1090
1091
|
r && (e = r);
|
|
1091
1092
|
var _n = 0,
|
|
1092
1093
|
i = function i() {};
|
|
@@ -1133,7 +1134,7 @@ var Me,
|
|
|
1133
1134
|
}(n);
|
|
1134
1135
|
try {
|
|
1135
1136
|
for (o.s(); !(i = o.n()).done;) {
|
|
1136
|
-
if ("string" != typeof i.value) throw new
|
|
1137
|
+
if ("string" != typeof i.value) throw new S(e, r + " must be an array of strings.");
|
|
1137
1138
|
}
|
|
1138
1139
|
} catch (e) {
|
|
1139
1140
|
o.e(e);
|
|
@@ -1146,14 +1147,14 @@ var Me,
|
|
|
1146
1147
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1147
1148
|
},
|
|
1148
1149
|
isNumber: function isNumber(r, n) {
|
|
1149
|
-
if ("number" != typeof n) throw new
|
|
1150
|
+
if ("number" != typeof n) throw new S(e, r + " must be a number.");
|
|
1150
1151
|
return t;
|
|
1151
1152
|
},
|
|
1152
1153
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1153
1154
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1154
1155
|
},
|
|
1155
1156
|
isBoolean: function isBoolean(r, n) {
|
|
1156
|
-
if ("boolean" != typeof n) throw new
|
|
1157
|
+
if ("boolean" != typeof n) throw new S(e, r + " must be a boolean.");
|
|
1157
1158
|
return t;
|
|
1158
1159
|
},
|
|
1159
1160
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1162,14 +1163,14 @@ var Me,
|
|
|
1162
1163
|
};
|
|
1163
1164
|
return t;
|
|
1164
1165
|
},
|
|
1165
|
-
|
|
1166
|
+
We = pe(function e(t, r, n) {
|
|
1166
1167
|
var i = this,
|
|
1167
1168
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1168
1169
|
return Promise.resolve(void 0);
|
|
1169
1170
|
};
|
|
1170
1171
|
_e(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1171
|
-
return
|
|
1172
|
-
return
|
|
1172
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1173
|
+
return de().wrap(function (e) {
|
|
1173
1174
|
for (;;) switch (e.prev = e.next) {
|
|
1174
1175
|
case 0:
|
|
1175
1176
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1182,9 +1183,9 @@ var Me,
|
|
|
1182
1183
|
}, e, this);
|
|
1183
1184
|
}));
|
|
1184
1185
|
}, this.getTelemetryID = function () {
|
|
1185
|
-
return
|
|
1186
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1186
1187
|
var t, r, n, i;
|
|
1187
|
-
return
|
|
1188
|
+
return de().wrap(function (e) {
|
|
1188
1189
|
for (;;) switch (e.prev = e.next) {
|
|
1189
1190
|
case 0:
|
|
1190
1191
|
return e.next = 2, this.state;
|
|
@@ -1205,9 +1206,9 @@ var Me,
|
|
|
1205
1206
|
}, e, this);
|
|
1206
1207
|
}));
|
|
1207
1208
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1208
|
-
return
|
|
1209
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1209
1210
|
var t, r, n, i, o, s;
|
|
1210
|
-
return
|
|
1211
|
+
return de().wrap(function (e) {
|
|
1211
1212
|
for (;;) switch (e.prev = e.next) {
|
|
1212
1213
|
case 0:
|
|
1213
1214
|
return e.next = 2, this.state;
|
|
@@ -1250,9 +1251,9 @@ var Me,
|
|
|
1250
1251
|
}, e, this);
|
|
1251
1252
|
}));
|
|
1252
1253
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1253
|
-
return
|
|
1254
|
+
return we(i, void 0, void 0, de().mark(function r() {
|
|
1254
1255
|
var n, i, o;
|
|
1255
|
-
return
|
|
1256
|
+
return de().wrap(function (r) {
|
|
1256
1257
|
for (;;) switch (r.prev = r.next) {
|
|
1257
1258
|
case 0:
|
|
1258
1259
|
return r.next = 2, this.state;
|
|
@@ -1281,8 +1282,8 @@ var Me,
|
|
|
1281
1282
|
}, r, this);
|
|
1282
1283
|
}));
|
|
1283
1284
|
}, this.state = n.then(function (e) {
|
|
1284
|
-
return
|
|
1285
|
-
return
|
|
1285
|
+
return we(i, void 0, void 0, de().mark(function n() {
|
|
1286
|
+
return de().wrap(function (n) {
|
|
1286
1287
|
for (;;) switch (n.prev = n.next) {
|
|
1287
1288
|
case 0:
|
|
1288
1289
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1297,7 +1298,7 @@ var Me,
|
|
|
1297
1298
|
executeRecaptcha: o
|
|
1298
1299
|
});
|
|
1299
1300
|
case 2:
|
|
1300
|
-
return n.next = 4, void
|
|
1301
|
+
return n.next = 4, void Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1301
1302
|
return window;
|
|
1302
1303
|
});
|
|
1303
1304
|
case 4:
|
|
@@ -1317,11 +1318,11 @@ var Me,
|
|
|
1317
1318
|
}));
|
|
1318
1319
|
});
|
|
1319
1320
|
}),
|
|
1320
|
-
|
|
1321
|
+
He = function He() {
|
|
1321
1322
|
return {
|
|
1322
1323
|
isEnabled: function isEnabled() {
|
|
1323
|
-
return
|
|
1324
|
-
return
|
|
1324
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1325
|
+
return de().wrap(function (e) {
|
|
1325
1326
|
for (;;) switch (e.prev = e.next) {
|
|
1326
1327
|
case 0:
|
|
1327
1328
|
return e.abrupt("return", !1);
|
|
@@ -1333,8 +1334,8 @@ var Me,
|
|
|
1333
1334
|
}));
|
|
1334
1335
|
},
|
|
1335
1336
|
getTelemetryID: function getTelemetryID() {
|
|
1336
|
-
return
|
|
1337
|
-
return
|
|
1337
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1338
|
+
return de().wrap(function (e) {
|
|
1338
1339
|
for (;;) switch (e.prev = e.next) {
|
|
1339
1340
|
case 0:
|
|
1340
1341
|
return e.abrupt("return", void 0);
|
|
@@ -1346,8 +1347,8 @@ var Me,
|
|
|
1346
1347
|
}));
|
|
1347
1348
|
},
|
|
1348
1349
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1349
|
-
return
|
|
1350
|
-
return
|
|
1350
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1351
|
+
return de().wrap(function (e) {
|
|
1351
1352
|
for (;;) switch (e.prev = e.next) {
|
|
1352
1353
|
case 0:
|
|
1353
1354
|
return e.abrupt("return", {
|
|
@@ -1362,8 +1363,8 @@ var Me,
|
|
|
1362
1363
|
}));
|
|
1363
1364
|
},
|
|
1364
1365
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1365
|
-
return
|
|
1366
|
-
return
|
|
1366
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1367
|
+
return de().wrap(function (e) {
|
|
1367
1368
|
for (;;) switch (e.prev = e.next) {
|
|
1368
1369
|
case 0:
|
|
1369
1370
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1376,11 +1377,63 @@ var Me,
|
|
|
1376
1377
|
}
|
|
1377
1378
|
};
|
|
1378
1379
|
},
|
|
1379
|
-
|
|
1380
|
+
Ge = function () {
|
|
1381
|
+
function e() {
|
|
1382
|
+
_e(this, e);
|
|
1383
|
+
}
|
|
1384
|
+
return pe(e, null, [{
|
|
1385
|
+
key: "marshall",
|
|
1386
|
+
value: function value(e) {
|
|
1387
|
+
return Object.assign(Object.assign({}, e), {
|
|
1388
|
+
name: e.name,
|
|
1389
|
+
message: e.message,
|
|
1390
|
+
stack: e.stack
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
}, {
|
|
1394
|
+
key: "inflate",
|
|
1395
|
+
value: function value(e, t) {
|
|
1396
|
+
var r = new e(t);
|
|
1397
|
+
return Object.assign(r, t), Object.setPrototypeOf(r, e.prototype), r;
|
|
1398
|
+
}
|
|
1399
|
+
}, {
|
|
1400
|
+
key: "unmarshall",
|
|
1401
|
+
value: function value(t) {
|
|
1402
|
+
if ("name" in t) switch (t.name) {
|
|
1403
|
+
case "SDKAPIUnreachableError":
|
|
1404
|
+
return e.inflate(w, t);
|
|
1405
|
+
case "StytchSDKSchemaError":
|
|
1406
|
+
return e.inflate(P, t);
|
|
1407
|
+
case "StytchAPIUnreachableError":
|
|
1408
|
+
return e.inflate(O, t);
|
|
1409
|
+
case "StytchAPISchemaError":
|
|
1410
|
+
return e.inflate(E, t);
|
|
1411
|
+
case "StytchSDKAPIError":
|
|
1412
|
+
return e.inflate(x, t);
|
|
1413
|
+
case "StytchAPIError":
|
|
1414
|
+
return e.inflate(A, t);
|
|
1415
|
+
case "TypeError":
|
|
1416
|
+
return e.inflate(TypeError, t);
|
|
1417
|
+
case "SyntaxError":
|
|
1418
|
+
return e.inflate(SyntaxError, t);
|
|
1419
|
+
case "ReferenceError":
|
|
1420
|
+
return e.inflate(ReferenceError, t);
|
|
1421
|
+
case "RangeError":
|
|
1422
|
+
return e.inflate(RangeError, t);
|
|
1423
|
+
case "EvalError":
|
|
1424
|
+
return e.inflate(EvalError, t);
|
|
1425
|
+
case "URIError":
|
|
1426
|
+
return e.inflate(URIError, t);
|
|
1427
|
+
}
|
|
1428
|
+
return e.inflate(Error, t);
|
|
1429
|
+
}
|
|
1430
|
+
}]), e;
|
|
1431
|
+
}(),
|
|
1432
|
+
Ve = function () {
|
|
1380
1433
|
function e(t) {
|
|
1381
1434
|
_e(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1382
1435
|
}
|
|
1383
|
-
return
|
|
1436
|
+
return pe(e, [{
|
|
1384
1437
|
key: "logEvent",
|
|
1385
1438
|
value: function value(e, t) {
|
|
1386
1439
|
this.batch.push({
|
|
@@ -1391,9 +1444,9 @@ var Me,
|
|
|
1391
1444
|
}, {
|
|
1392
1445
|
key: "flush",
|
|
1393
1446
|
value: function value() {
|
|
1394
|
-
return
|
|
1447
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1395
1448
|
var t;
|
|
1396
|
-
return
|
|
1449
|
+
return de().wrap(function (e) {
|
|
1397
1450
|
for (;;) switch (e.prev = e.next) {
|
|
1398
1451
|
case 0:
|
|
1399
1452
|
if (this.batch.length) {
|
|
@@ -1430,21 +1483,21 @@ var Me,
|
|
|
1430
1483
|
}), Promise.resolve({
|
|
1431
1484
|
pkceRequiredForPasswordResets: !1
|
|
1432
1485
|
});
|
|
1433
|
-
var
|
|
1486
|
+
var Ye = Promise.resolve({
|
|
1434
1487
|
pkceRequiredForEmailMagicLinks: !1
|
|
1435
1488
|
}),
|
|
1436
|
-
|
|
1489
|
+
Je = function () {
|
|
1437
1490
|
function e(t, r, n, i) {
|
|
1438
1491
|
var o = this,
|
|
1439
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1440
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1492
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye,
|
|
1493
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
1441
1494
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1442
1495
|
invite: function invite(e) {
|
|
1443
|
-
return
|
|
1444
|
-
return
|
|
1496
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1497
|
+
return de().wrap(function (t) {
|
|
1445
1498
|
for (;;) switch (t.prev = t.next) {
|
|
1446
1499
|
case 0:
|
|
1447
|
-
return
|
|
1500
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1448
1501
|
url: "/b2b/magic_links/email/invite",
|
|
1449
1502
|
body: e,
|
|
1450
1503
|
errorMessage: "Failed to send invite.",
|
|
@@ -1458,12 +1511,12 @@ var Ge = Promise.resolve({
|
|
|
1458
1511
|
}));
|
|
1459
1512
|
},
|
|
1460
1513
|
loginOrSignup: function loginOrSignup(e) {
|
|
1461
|
-
return
|
|
1514
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1462
1515
|
var r, n;
|
|
1463
|
-
return
|
|
1516
|
+
return de().wrap(function (t) {
|
|
1464
1517
|
for (;;) switch (t.prev = t.next) {
|
|
1465
1518
|
case 0:
|
|
1466
|
-
return
|
|
1519
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1467
1520
|
case 3:
|
|
1468
1521
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1469
1522
|
pkce_code_challenge: r
|
|
@@ -1482,12 +1535,12 @@ var Ge = Promise.resolve({
|
|
|
1482
1535
|
},
|
|
1483
1536
|
discovery: {
|
|
1484
1537
|
send: function send(e) {
|
|
1485
|
-
return
|
|
1538
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1486
1539
|
var r, n;
|
|
1487
|
-
return
|
|
1540
|
+
return de().wrap(function (t) {
|
|
1488
1541
|
for (;;) switch (t.prev = t.next) {
|
|
1489
1542
|
case 0:
|
|
1490
|
-
return
|
|
1543
|
+
return qe("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1491
1544
|
case 3:
|
|
1492
1545
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1493
1546
|
pkce_code_challenge: r
|
|
@@ -1506,12 +1559,12 @@ var Ge = Promise.resolve({
|
|
|
1506
1559
|
}
|
|
1507
1560
|
}
|
|
1508
1561
|
}, this.authenticate = function (e) {
|
|
1509
|
-
return
|
|
1562
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1510
1563
|
var r, n;
|
|
1511
|
-
return
|
|
1564
|
+
return de().wrap(function (t) {
|
|
1512
1565
|
for (;;) switch (t.prev = t.next) {
|
|
1513
1566
|
case 0:
|
|
1514
|
-
return
|
|
1567
|
+
return qe("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1515
1568
|
case 3:
|
|
1516
1569
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1517
1570
|
t.next = 19;
|
|
@@ -1562,12 +1615,12 @@ var Ge = Promise.resolve({
|
|
|
1562
1615
|
}));
|
|
1563
1616
|
}, this.discovery = {
|
|
1564
1617
|
authenticate: function authenticate(e) {
|
|
1565
|
-
return
|
|
1618
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1566
1619
|
var r, n, i, o, s, a;
|
|
1567
|
-
return
|
|
1620
|
+
return de().wrap(function (t) {
|
|
1568
1621
|
for (;;) switch (t.prev = t.next) {
|
|
1569
1622
|
case 0:
|
|
1570
|
-
return
|
|
1623
|
+
return qe("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1571
1624
|
case 3:
|
|
1572
1625
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1573
1626
|
case 6:
|
|
@@ -1598,12 +1651,12 @@ var Ge = Promise.resolve({
|
|
|
1598
1651
|
}
|
|
1599
1652
|
};
|
|
1600
1653
|
}
|
|
1601
|
-
return
|
|
1654
|
+
return pe(e, [{
|
|
1602
1655
|
key: "getCodeChallenge",
|
|
1603
1656
|
value: function value() {
|
|
1604
|
-
return
|
|
1657
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1605
1658
|
var t, r;
|
|
1606
|
-
return
|
|
1659
|
+
return de().wrap(function (e) {
|
|
1607
1660
|
for (;;) switch (e.prev = e.next) {
|
|
1608
1661
|
case 0:
|
|
1609
1662
|
return e.next = 2, this._config;
|
|
@@ -1635,9 +1688,9 @@ var Ge = Promise.resolve({
|
|
|
1635
1688
|
}, {
|
|
1636
1689
|
key: "handlePKCEForAuthenticate",
|
|
1637
1690
|
value: function value(e, t) {
|
|
1638
|
-
return
|
|
1691
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1639
1692
|
var n, i, o, s, a, c;
|
|
1640
|
-
return
|
|
1693
|
+
return de().wrap(function (r) {
|
|
1641
1694
|
for (;;) switch (r.prev = r.next) {
|
|
1642
1695
|
case 0:
|
|
1643
1696
|
return r.next = 2, e.getPKPair();
|
|
@@ -1666,12 +1719,12 @@ var Ge = Promise.resolve({
|
|
|
1666
1719
|
}
|
|
1667
1720
|
}]), e;
|
|
1668
1721
|
}(),
|
|
1669
|
-
|
|
1722
|
+
$e = pe(function e(t, r) {
|
|
1670
1723
|
var n = this;
|
|
1671
1724
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1672
|
-
return
|
|
1725
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1673
1726
|
var t;
|
|
1674
|
-
return
|
|
1727
|
+
return de().wrap(function (e) {
|
|
1675
1728
|
for (;;) switch (e.prev = e.next) {
|
|
1676
1729
|
case 0:
|
|
1677
1730
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1695,12 +1748,12 @@ var Ge = Promise.resolve({
|
|
|
1695
1748
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1696
1749
|
});
|
|
1697
1750
|
}, this.update = function (e) {
|
|
1698
|
-
return
|
|
1751
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1699
1752
|
var r;
|
|
1700
|
-
return
|
|
1753
|
+
return de().wrap(function (t) {
|
|
1701
1754
|
for (;;) switch (t.prev = t.next) {
|
|
1702
1755
|
case 0:
|
|
1703
|
-
return
|
|
1756
|
+
return qe("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("default_mfa_method", e.default_mfa_method), t.next = 3, this._networkClient.fetchSDK({
|
|
1704
1757
|
url: "/b2b/organizations/members/update",
|
|
1705
1758
|
body: e,
|
|
1706
1759
|
errorMessage: "Failed to update member.",
|
|
@@ -1715,9 +1768,9 @@ var Ge = Promise.resolve({
|
|
|
1715
1768
|
}, t, this);
|
|
1716
1769
|
}));
|
|
1717
1770
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1718
|
-
return
|
|
1771
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1719
1772
|
var t;
|
|
1720
|
-
return
|
|
1773
|
+
return de().wrap(function (e) {
|
|
1721
1774
|
for (;;) switch (e.prev = e.next) {
|
|
1722
1775
|
case 0:
|
|
1723
1776
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1734,9 +1787,9 @@ var Ge = Promise.resolve({
|
|
|
1734
1787
|
}, e, this);
|
|
1735
1788
|
}));
|
|
1736
1789
|
}, this.deleteMFATOTP = function () {
|
|
1737
|
-
return
|
|
1790
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1738
1791
|
var t;
|
|
1739
|
-
return
|
|
1792
|
+
return de().wrap(function (e) {
|
|
1740
1793
|
for (;;) switch (e.prev = e.next) {
|
|
1741
1794
|
case 0:
|
|
1742
1795
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1753,9 +1806,9 @@ var Ge = Promise.resolve({
|
|
|
1753
1806
|
}, e, this);
|
|
1754
1807
|
}));
|
|
1755
1808
|
}, this.deletePassword = function (e) {
|
|
1756
|
-
return
|
|
1809
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1757
1810
|
var r;
|
|
1758
|
-
return
|
|
1811
|
+
return de().wrap(function (t) {
|
|
1759
1812
|
for (;;) switch (t.prev = t.next) {
|
|
1760
1813
|
case 0:
|
|
1761
1814
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1773,14 +1826,14 @@ var Ge = Promise.resolve({
|
|
|
1773
1826
|
}));
|
|
1774
1827
|
};
|
|
1775
1828
|
}),
|
|
1776
|
-
|
|
1829
|
+
Xe = function () {
|
|
1777
1830
|
function e(t, r, n, i, o) {
|
|
1778
1831
|
var s = this,
|
|
1779
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1832
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
1780
1833
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1781
1834
|
createConnection: function createConnection(e) {
|
|
1782
|
-
return
|
|
1783
|
-
return
|
|
1835
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1836
|
+
return de().wrap(function (t) {
|
|
1784
1837
|
for (;;) switch (t.prev = t.next) {
|
|
1785
1838
|
case 0:
|
|
1786
1839
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1799,8 +1852,8 @@ var Ge = Promise.resolve({
|
|
|
1799
1852
|
}));
|
|
1800
1853
|
},
|
|
1801
1854
|
updateConnection: function updateConnection(e) {
|
|
1802
|
-
return
|
|
1803
|
-
return
|
|
1855
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1856
|
+
return de().wrap(function (t) {
|
|
1804
1857
|
for (;;) switch (t.prev = t.next) {
|
|
1805
1858
|
case 0:
|
|
1806
1859
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1819,8 +1872,8 @@ var Ge = Promise.resolve({
|
|
|
1819
1872
|
}));
|
|
1820
1873
|
},
|
|
1821
1874
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1822
|
-
return
|
|
1823
|
-
return
|
|
1875
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1876
|
+
return de().wrap(function (t) {
|
|
1824
1877
|
for (;;) switch (t.prev = t.next) {
|
|
1825
1878
|
case 0:
|
|
1826
1879
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1839,8 +1892,8 @@ var Ge = Promise.resolve({
|
|
|
1839
1892
|
}));
|
|
1840
1893
|
},
|
|
1841
1894
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1842
|
-
return
|
|
1843
|
-
return
|
|
1895
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1896
|
+
return de().wrap(function (t) {
|
|
1844
1897
|
for (;;) switch (t.prev = t.next) {
|
|
1845
1898
|
case 0:
|
|
1846
1899
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1859,8 +1912,8 @@ var Ge = Promise.resolve({
|
|
|
1859
1912
|
}
|
|
1860
1913
|
}, this.oidc = {
|
|
1861
1914
|
createConnection: function createConnection(e) {
|
|
1862
|
-
return
|
|
1863
|
-
return
|
|
1915
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1916
|
+
return de().wrap(function (t) {
|
|
1864
1917
|
for (;;) switch (t.prev = t.next) {
|
|
1865
1918
|
case 0:
|
|
1866
1919
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1879,8 +1932,8 @@ var Ge = Promise.resolve({
|
|
|
1879
1932
|
}));
|
|
1880
1933
|
},
|
|
1881
1934
|
updateConnection: function updateConnection(e) {
|
|
1882
|
-
return
|
|
1883
|
-
return
|
|
1935
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1936
|
+
return de().wrap(function (t) {
|
|
1884
1937
|
for (;;) switch (t.prev = t.next) {
|
|
1885
1938
|
case 0:
|
|
1886
1939
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1900,17 +1953,17 @@ var Ge = Promise.resolve({
|
|
|
1900
1953
|
}
|
|
1901
1954
|
};
|
|
1902
1955
|
}
|
|
1903
|
-
return
|
|
1956
|
+
return pe(e, [{
|
|
1904
1957
|
key: "authenticate",
|
|
1905
1958
|
value: function value(e) {
|
|
1906
|
-
return
|
|
1959
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
1907
1960
|
var r, n, i, o, s;
|
|
1908
|
-
return
|
|
1961
|
+
return de().wrap(function (t) {
|
|
1909
1962
|
for (;;) switch (t.prev = t.next) {
|
|
1910
1963
|
case 0:
|
|
1911
|
-
return
|
|
1964
|
+
return qe("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1912
1965
|
case 3:
|
|
1913
|
-
return (r = t.sent) ||
|
|
1966
|
+
return (r = t.sent) || Ke("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();
|
|
1914
1967
|
case 7:
|
|
1915
1968
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1916
1969
|
url: "/b2b/sso/authenticate",
|
|
@@ -1950,11 +2003,11 @@ var Ge = Promise.resolve({
|
|
|
1950
2003
|
}, {
|
|
1951
2004
|
key: "getBaseApiUrl",
|
|
1952
2005
|
value: function value() {
|
|
1953
|
-
return
|
|
1954
|
-
return
|
|
2006
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2007
|
+
return de().wrap(function (e) {
|
|
1955
2008
|
for (;;) switch (e.prev = e.next) {
|
|
1956
2009
|
case 0:
|
|
1957
|
-
if (!
|
|
2010
|
+
if (!ze(this._config.publicToken)) {
|
|
1958
2011
|
e.next = 2;
|
|
1959
2012
|
break;
|
|
1960
2013
|
}
|
|
@@ -1974,9 +2027,9 @@ var Ge = Promise.resolve({
|
|
|
1974
2027
|
var t = e.connection_id,
|
|
1975
2028
|
r = e.login_redirect_url,
|
|
1976
2029
|
n = e.signup_redirect_url;
|
|
1977
|
-
return
|
|
2030
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1978
2031
|
var i, o, s, a, c;
|
|
1979
|
-
return
|
|
2032
|
+
return de().wrap(function (e) {
|
|
1980
2033
|
for (;;) switch (e.prev = e.next) {
|
|
1981
2034
|
case 0:
|
|
1982
2035
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2005,8 +2058,8 @@ var Ge = Promise.resolve({
|
|
|
2005
2058
|
}, {
|
|
2006
2059
|
key: "getConnections",
|
|
2007
2060
|
value: function value() {
|
|
2008
|
-
return
|
|
2009
|
-
return
|
|
2061
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2062
|
+
return de().wrap(function (e) {
|
|
2010
2063
|
for (;;) switch (e.prev = e.next) {
|
|
2011
2064
|
case 0:
|
|
2012
2065
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2026,8 +2079,8 @@ var Ge = Promise.resolve({
|
|
|
2026
2079
|
}, {
|
|
2027
2080
|
key: "deleteConnection",
|
|
2028
2081
|
value: function value(e) {
|
|
2029
|
-
return
|
|
2030
|
-
return
|
|
2082
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2083
|
+
return de().wrap(function (t) {
|
|
2031
2084
|
for (;;) switch (t.prev = t.next) {
|
|
2032
2085
|
case 0:
|
|
2033
2086
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2044,12 +2097,12 @@ var Ge = Promise.resolve({
|
|
|
2044
2097
|
}
|
|
2045
2098
|
}]), e;
|
|
2046
2099
|
}(),
|
|
2047
|
-
|
|
2100
|
+
Ze = pe(function e(t, r) {
|
|
2048
2101
|
var n = this;
|
|
2049
2102
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2050
|
-
return
|
|
2103
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2051
2104
|
var t;
|
|
2052
|
-
return
|
|
2105
|
+
return de().wrap(function (e) {
|
|
2053
2106
|
for (;;) switch (e.prev = e.next) {
|
|
2054
2107
|
case 0:
|
|
2055
2108
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2073,9 +2126,9 @@ var Ge = Promise.resolve({
|
|
|
2073
2126
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2074
2127
|
});
|
|
2075
2128
|
}, this.update = function (e) {
|
|
2076
|
-
return
|
|
2129
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2077
2130
|
var r;
|
|
2078
|
-
return
|
|
2131
|
+
return de().wrap(function (t) {
|
|
2079
2132
|
for (;;) switch (t.prev = t.next) {
|
|
2080
2133
|
case 0:
|
|
2081
2134
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2093,9 +2146,9 @@ var Ge = Promise.resolve({
|
|
|
2093
2146
|
}, t, this);
|
|
2094
2147
|
}));
|
|
2095
2148
|
}, this["delete"] = function () {
|
|
2096
|
-
return
|
|
2149
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2097
2150
|
var t;
|
|
2098
|
-
return
|
|
2151
|
+
return de().wrap(function (e) {
|
|
2099
2152
|
for (;;) switch (e.prev = e.next) {
|
|
2100
2153
|
case 0:
|
|
2101
2154
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2113,8 +2166,8 @@ var Ge = Promise.resolve({
|
|
|
2113
2166
|
}));
|
|
2114
2167
|
}, this.members = {
|
|
2115
2168
|
create: function create(e) {
|
|
2116
|
-
return
|
|
2117
|
-
return
|
|
2169
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2170
|
+
return de().wrap(function (t) {
|
|
2118
2171
|
for (;;) switch (t.prev = t.next) {
|
|
2119
2172
|
case 0:
|
|
2120
2173
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2131,8 +2184,8 @@ var Ge = Promise.resolve({
|
|
|
2131
2184
|
}));
|
|
2132
2185
|
},
|
|
2133
2186
|
search: function search(e) {
|
|
2134
|
-
return
|
|
2135
|
-
return
|
|
2187
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2188
|
+
return de().wrap(function (t) {
|
|
2136
2189
|
for (;;) switch (t.prev = t.next) {
|
|
2137
2190
|
case 0:
|
|
2138
2191
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2149,8 +2202,8 @@ var Ge = Promise.resolve({
|
|
|
2149
2202
|
}));
|
|
2150
2203
|
},
|
|
2151
2204
|
update: function update(e) {
|
|
2152
|
-
return
|
|
2153
|
-
return
|
|
2205
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2206
|
+
return de().wrap(function (t) {
|
|
2154
2207
|
for (;;) switch (t.prev = t.next) {
|
|
2155
2208
|
case 0:
|
|
2156
2209
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2167,8 +2220,8 @@ var Ge = Promise.resolve({
|
|
|
2167
2220
|
}));
|
|
2168
2221
|
},
|
|
2169
2222
|
deletePassword: function deletePassword(e) {
|
|
2170
|
-
return
|
|
2171
|
-
return
|
|
2223
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2224
|
+
return de().wrap(function (t) {
|
|
2172
2225
|
for (;;) switch (t.prev = t.next) {
|
|
2173
2226
|
case 0:
|
|
2174
2227
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2184,8 +2237,8 @@ var Ge = Promise.resolve({
|
|
|
2184
2237
|
}));
|
|
2185
2238
|
},
|
|
2186
2239
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2187
|
-
return
|
|
2188
|
-
return
|
|
2240
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2241
|
+
return de().wrap(function (t) {
|
|
2189
2242
|
for (;;) switch (t.prev = t.next) {
|
|
2190
2243
|
case 0:
|
|
2191
2244
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2201,8 +2254,8 @@ var Ge = Promise.resolve({
|
|
|
2201
2254
|
}));
|
|
2202
2255
|
},
|
|
2203
2256
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2204
|
-
return
|
|
2205
|
-
return
|
|
2257
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2258
|
+
return de().wrap(function (t) {
|
|
2206
2259
|
for (;;) switch (t.prev = t.next) {
|
|
2207
2260
|
case 0:
|
|
2208
2261
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2218,8 +2271,8 @@ var Ge = Promise.resolve({
|
|
|
2218
2271
|
}));
|
|
2219
2272
|
},
|
|
2220
2273
|
"delete": function _delete(e) {
|
|
2221
|
-
return
|
|
2222
|
-
return
|
|
2274
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2275
|
+
return de().wrap(function (t) {
|
|
2223
2276
|
for (;;) switch (t.prev = t.next) {
|
|
2224
2277
|
case 0:
|
|
2225
2278
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2235,8 +2288,8 @@ var Ge = Promise.resolve({
|
|
|
2235
2288
|
}));
|
|
2236
2289
|
},
|
|
2237
2290
|
reactivate: function reactivate(e) {
|
|
2238
|
-
return
|
|
2239
|
-
return
|
|
2291
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2292
|
+
return de().wrap(function (t) {
|
|
2240
2293
|
for (;;) switch (t.prev = t.next) {
|
|
2241
2294
|
case 0:
|
|
2242
2295
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2253,18 +2306,18 @@ var Ge = Promise.resolve({
|
|
|
2253
2306
|
}
|
|
2254
2307
|
};
|
|
2255
2308
|
}),
|
|
2256
|
-
|
|
2309
|
+
Qe = function () {
|
|
2257
2310
|
function e(t, r, n, i, o) {
|
|
2258
2311
|
var s = this,
|
|
2259
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2312
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : He();
|
|
2260
2313
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2261
2314
|
authenticate: function authenticate(e) {
|
|
2262
|
-
return
|
|
2315
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2263
2316
|
var r, n, i, o, s, a;
|
|
2264
|
-
return
|
|
2317
|
+
return de().wrap(function (t) {
|
|
2265
2318
|
for (;;) switch (t.prev = t.next) {
|
|
2266
2319
|
case 0:
|
|
2267
|
-
return
|
|
2320
|
+
return qe("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2268
2321
|
case 3:
|
|
2269
2322
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2270
2323
|
case 6:
|
|
@@ -2305,17 +2358,17 @@ var Ge = Promise.resolve({
|
|
|
2305
2358
|
}
|
|
2306
2359
|
};
|
|
2307
2360
|
}
|
|
2308
|
-
return
|
|
2361
|
+
return pe(e, [{
|
|
2309
2362
|
key: "authenticate",
|
|
2310
2363
|
value: function value(e) {
|
|
2311
|
-
return
|
|
2364
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2312
2365
|
var r, n, i, o, s;
|
|
2313
|
-
return
|
|
2366
|
+
return de().wrap(function (t) {
|
|
2314
2367
|
for (;;) switch (t.prev = t.next) {
|
|
2315
2368
|
case 0:
|
|
2316
|
-
return
|
|
2369
|
+
return qe("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2317
2370
|
case 3:
|
|
2318
|
-
return (r = t.sent) ||
|
|
2371
|
+
return (r = t.sent) || Ke("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();
|
|
2319
2372
|
case 7:
|
|
2320
2373
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2321
2374
|
url: "/b2b/oauth/authenticate",
|
|
@@ -2354,9 +2407,9 @@ var Ge = Promise.resolve({
|
|
|
2354
2407
|
}, {
|
|
2355
2408
|
key: "getBaseApiUrl",
|
|
2356
2409
|
value: function value() {
|
|
2357
|
-
return
|
|
2410
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2358
2411
|
var t, r;
|
|
2359
|
-
return
|
|
2412
|
+
return de().wrap(function (e) {
|
|
2360
2413
|
for (;;) switch (e.prev = e.next) {
|
|
2361
2414
|
case 0:
|
|
2362
2415
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2367,7 +2420,7 @@ var Ge = Promise.resolve({
|
|
|
2367
2420
|
}
|
|
2368
2421
|
return e.abrupt("return", "https://".concat(r));
|
|
2369
2422
|
case 6:
|
|
2370
|
-
if (!
|
|
2423
|
+
if (!ze(this._config.publicToken)) {
|
|
2371
2424
|
e.next = 8;
|
|
2372
2425
|
break;
|
|
2373
2426
|
}
|
|
@@ -2392,16 +2445,16 @@ var Ge = Promise.resolve({
|
|
|
2392
2445
|
s = r.signup_redirect_url,
|
|
2393
2446
|
a = r.custom_scopes,
|
|
2394
2447
|
c = r.provider_params;
|
|
2395
|
-
return
|
|
2448
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2396
2449
|
var r, u, l, d, h, p;
|
|
2397
|
-
return
|
|
2450
|
+
return de().wrap(function (t) {
|
|
2398
2451
|
for (;;) switch (t.prev = t.next) {
|
|
2399
2452
|
case 0:
|
|
2400
2453
|
return t.next = 2, this._dynamicConfig;
|
|
2401
2454
|
case 2:
|
|
2402
2455
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2403
2456
|
case 6:
|
|
2404
|
-
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 && (
|
|
2457
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (qe("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in qe("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2405
2458
|
if (!u) {
|
|
2406
2459
|
t.next = 20;
|
|
2407
2460
|
break;
|
|
@@ -2430,16 +2483,16 @@ var Ge = Promise.resolve({
|
|
|
2430
2483
|
var n = r.discovery_redirect_url,
|
|
2431
2484
|
i = r.custom_scopes,
|
|
2432
2485
|
o = r.provider_params;
|
|
2433
|
-
return
|
|
2486
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2434
2487
|
var r, s, a, c, u, l;
|
|
2435
|
-
return
|
|
2488
|
+
return de().wrap(function (t) {
|
|
2436
2489
|
for (;;) switch (t.prev = t.next) {
|
|
2437
2490
|
case 0:
|
|
2438
2491
|
return t.next = 2, this._dynamicConfig;
|
|
2439
2492
|
case 2:
|
|
2440
2493
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2441
2494
|
case 6:
|
|
2442
|
-
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 && (
|
|
2495
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (qe("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in qe("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2443
2496
|
if (!s) {
|
|
2444
2497
|
t.next = 18;
|
|
2445
2498
|
break;
|
|
@@ -2462,7 +2515,7 @@ var Ge = Promise.resolve({
|
|
|
2462
2515
|
}
|
|
2463
2516
|
}]), e;
|
|
2464
2517
|
}(),
|
|
2465
|
-
|
|
2518
|
+
et = function () {
|
|
2466
2519
|
function e(t, r) {
|
|
2467
2520
|
var n = this;
|
|
2468
2521
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
@@ -2473,9 +2526,9 @@ var Ge = Promise.resolve({
|
|
|
2473
2526
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2474
2527
|
});
|
|
2475
2528
|
}, this.revoke = function (e) {
|
|
2476
|
-
return
|
|
2529
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2477
2530
|
var r;
|
|
2478
|
-
return
|
|
2531
|
+
return de().wrap(function (t) {
|
|
2479
2532
|
for (;;) switch (t.prev = t.next) {
|
|
2480
2533
|
case 0:
|
|
2481
2534
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2486,7 +2539,7 @@ var Ge = Promise.resolve({
|
|
|
2486
2539
|
case 3:
|
|
2487
2540
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2488
2541
|
case 8:
|
|
2489
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2542
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || C.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2490
2543
|
case 12:
|
|
2491
2544
|
case "end":
|
|
2492
2545
|
return t.stop();
|
|
@@ -2494,13 +2547,13 @@ var Ge = Promise.resolve({
|
|
|
2494
2547
|
}, t, this, [[0, 8]]);
|
|
2495
2548
|
}));
|
|
2496
2549
|
}, this.authenticate = function (e) {
|
|
2497
|
-
return
|
|
2550
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2498
2551
|
var r,
|
|
2499
2552
|
n,
|
|
2500
2553
|
i,
|
|
2501
2554
|
o,
|
|
2502
2555
|
s = this;
|
|
2503
|
-
return
|
|
2556
|
+
return de().wrap(function (t) {
|
|
2504
2557
|
for (;;) switch (t.prev = t.next) {
|
|
2505
2558
|
case 0:
|
|
2506
2559
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2538,7 +2591,7 @@ var Ge = Promise.resolve({
|
|
|
2538
2591
|
}
|
|
2539
2592
|
return t.abrupt("return", this.authenticate(e));
|
|
2540
2593
|
case 17:
|
|
2541
|
-
throw
|
|
2594
|
+
throw C.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2542
2595
|
case 19:
|
|
2543
2596
|
case "end":
|
|
2544
2597
|
return t.stop();
|
|
@@ -2546,12 +2599,12 @@ var Ge = Promise.resolve({
|
|
|
2546
2599
|
}, t, this, [[2, 13]]);
|
|
2547
2600
|
}));
|
|
2548
2601
|
}, this.exchange = function (e) {
|
|
2549
|
-
return
|
|
2602
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2550
2603
|
var r;
|
|
2551
|
-
return
|
|
2604
|
+
return de().wrap(function (t) {
|
|
2552
2605
|
for (;;) switch (t.prev = t.next) {
|
|
2553
2606
|
case 0:
|
|
2554
|
-
return
|
|
2607
|
+
return qe("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
2555
2608
|
url: "/b2b/sessions/exchange",
|
|
2556
2609
|
body: e,
|
|
2557
2610
|
errorMessage: "Failed to exchange session",
|
|
@@ -2583,19 +2636,19 @@ var Ge = Promise.resolve({
|
|
|
2583
2636
|
}));
|
|
2584
2637
|
};
|
|
2585
2638
|
}
|
|
2586
|
-
return
|
|
2639
|
+
return pe(e, [{
|
|
2587
2640
|
key: "getTokens",
|
|
2588
2641
|
value: function value() {
|
|
2589
2642
|
return this._subscriptionService.getTokens();
|
|
2590
2643
|
}
|
|
2591
2644
|
}]), e;
|
|
2592
2645
|
}(),
|
|
2593
|
-
|
|
2646
|
+
tt = pe(function e(t, r) {
|
|
2594
2647
|
var n = this;
|
|
2595
2648
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2596
2649
|
list: function list() {
|
|
2597
|
-
return
|
|
2598
|
-
return
|
|
2650
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2651
|
+
return de().wrap(function (e) {
|
|
2599
2652
|
for (;;) switch (e.prev = e.next) {
|
|
2600
2653
|
case 0:
|
|
2601
2654
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2622,12 +2675,12 @@ var Ge = Promise.resolve({
|
|
|
2622
2675
|
}));
|
|
2623
2676
|
},
|
|
2624
2677
|
create: function create(e) {
|
|
2625
|
-
return
|
|
2678
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2626
2679
|
var r, n;
|
|
2627
|
-
return
|
|
2680
|
+
return de().wrap(function (t) {
|
|
2628
2681
|
for (;;) switch (t.prev = t.next) {
|
|
2629
2682
|
case 0:
|
|
2630
|
-
return
|
|
2683
|
+
return qe("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2631
2684
|
case 5:
|
|
2632
2685
|
if (t.t2 = t.sent, t.t2) {
|
|
2633
2686
|
t.next = 8;
|
|
@@ -2668,12 +2721,12 @@ var Ge = Promise.resolve({
|
|
|
2668
2721
|
}
|
|
2669
2722
|
}, this.intermediateSessions = {
|
|
2670
2723
|
exchange: function exchange(e) {
|
|
2671
|
-
return
|
|
2724
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2672
2725
|
var r, n;
|
|
2673
|
-
return
|
|
2726
|
+
return de().wrap(function (t) {
|
|
2674
2727
|
for (;;) switch (t.prev = t.next) {
|
|
2675
2728
|
case 0:
|
|
2676
|
-
return
|
|
2729
|
+
return qe("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2677
2730
|
case 5:
|
|
2678
2731
|
if (t.t2 = t.sent, t.t2) {
|
|
2679
2732
|
t.next = 8;
|
|
@@ -2714,21 +2767,21 @@ var Ge = Promise.resolve({
|
|
|
2714
2767
|
}
|
|
2715
2768
|
};
|
|
2716
2769
|
}),
|
|
2717
|
-
|
|
2770
|
+
rt = Promise.resolve({
|
|
2718
2771
|
pkceRequiredForPasswordResets: !1
|
|
2719
2772
|
}),
|
|
2720
|
-
|
|
2773
|
+
nt = function () {
|
|
2721
2774
|
function e(t, r, n) {
|
|
2722
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2723
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2775
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : rt,
|
|
2776
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : He();
|
|
2724
2777
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2725
2778
|
}
|
|
2726
|
-
return
|
|
2779
|
+
return pe(e, [{
|
|
2727
2780
|
key: "getCodeChallenge",
|
|
2728
2781
|
value: function value() {
|
|
2729
|
-
return
|
|
2782
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2730
2783
|
var t, r;
|
|
2731
|
-
return
|
|
2784
|
+
return de().wrap(function (e) {
|
|
2732
2785
|
for (;;) switch (e.prev = e.next) {
|
|
2733
2786
|
case 0:
|
|
2734
2787
|
return e.next = 2, this._config;
|
|
@@ -2760,12 +2813,12 @@ var Ge = Promise.resolve({
|
|
|
2760
2813
|
}, {
|
|
2761
2814
|
key: "authenticate",
|
|
2762
2815
|
value: function value(e) {
|
|
2763
|
-
return
|
|
2816
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2764
2817
|
var r, n, i, o, s, a;
|
|
2765
|
-
return
|
|
2818
|
+
return de().wrap(function (t) {
|
|
2766
2819
|
for (;;) switch (t.prev = t.next) {
|
|
2767
2820
|
case 0:
|
|
2768
|
-
return
|
|
2821
|
+
return qe("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();
|
|
2769
2822
|
case 3:
|
|
2770
2823
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2771
2824
|
case 7:
|
|
@@ -2811,12 +2864,12 @@ var Ge = Promise.resolve({
|
|
|
2811
2864
|
}, {
|
|
2812
2865
|
key: "resetByEmailStart",
|
|
2813
2866
|
value: function value(e) {
|
|
2814
|
-
return
|
|
2867
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2815
2868
|
var r, n, i, o;
|
|
2816
|
-
return
|
|
2869
|
+
return de().wrap(function (t) {
|
|
2817
2870
|
for (;;) switch (t.prev = t.next) {
|
|
2818
2871
|
case 0:
|
|
2819
|
-
return
|
|
2872
|
+
return qe("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();
|
|
2820
2873
|
case 3:
|
|
2821
2874
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2822
2875
|
case 6:
|
|
@@ -2847,12 +2900,12 @@ var Ge = Promise.resolve({
|
|
|
2847
2900
|
}, {
|
|
2848
2901
|
key: "resetByEmail",
|
|
2849
2902
|
value: function value(e) {
|
|
2850
|
-
return
|
|
2903
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2851
2904
|
var r, n, i, o, s, a;
|
|
2852
|
-
return
|
|
2905
|
+
return de().wrap(function (t) {
|
|
2853
2906
|
for (;;) switch (t.prev = t.next) {
|
|
2854
2907
|
case 0:
|
|
2855
|
-
return
|
|
2908
|
+
return qe("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();
|
|
2856
2909
|
case 3:
|
|
2857
2910
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2858
2911
|
case 8:
|
|
@@ -2897,12 +2950,12 @@ var Ge = Promise.resolve({
|
|
|
2897
2950
|
}, {
|
|
2898
2951
|
key: "resetByExistingPassword",
|
|
2899
2952
|
value: function value(e) {
|
|
2900
|
-
return
|
|
2953
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2901
2954
|
var r, n, i, o;
|
|
2902
|
-
return
|
|
2955
|
+
return de().wrap(function (t) {
|
|
2903
2956
|
for (;;) switch (t.prev = t.next) {
|
|
2904
2957
|
case 0:
|
|
2905
|
-
return
|
|
2958
|
+
return qe("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();
|
|
2906
2959
|
case 3:
|
|
2907
2960
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2908
2961
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -2946,12 +2999,12 @@ var Ge = Promise.resolve({
|
|
|
2946
2999
|
}, {
|
|
2947
3000
|
key: "resetBySession",
|
|
2948
3001
|
value: function value(e) {
|
|
2949
|
-
return
|
|
3002
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2950
3003
|
var r, n, i, o;
|
|
2951
|
-
return
|
|
3004
|
+
return de().wrap(function (t) {
|
|
2952
3005
|
for (;;) switch (t.prev = t.next) {
|
|
2953
3006
|
case 0:
|
|
2954
|
-
return
|
|
3007
|
+
return qe("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2955
3008
|
case 3:
|
|
2956
3009
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2957
3010
|
url: "/b2b/passwords/session/reset",
|
|
@@ -2985,11 +3038,11 @@ var Ge = Promise.resolve({
|
|
|
2985
3038
|
}, {
|
|
2986
3039
|
key: "strengthCheck",
|
|
2987
3040
|
value: function value(e) {
|
|
2988
|
-
return
|
|
2989
|
-
return
|
|
3041
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3042
|
+
return de().wrap(function (t) {
|
|
2990
3043
|
for (;;) switch (t.prev = t.next) {
|
|
2991
3044
|
case 0:
|
|
2992
|
-
return
|
|
3045
|
+
return qe("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
2993
3046
|
url: "/b2b/passwords/strength_check",
|
|
2994
3047
|
method: "POST",
|
|
2995
3048
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3007,17 +3060,17 @@ var Ge = Promise.resolve({
|
|
|
3007
3060
|
}
|
|
3008
3061
|
}]), e;
|
|
3009
3062
|
}(),
|
|
3010
|
-
|
|
3063
|
+
it = pe(function e(t, r) {
|
|
3011
3064
|
var n = this,
|
|
3012
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3065
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
3013
3066
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3014
3067
|
send: function send(e) {
|
|
3015
|
-
return
|
|
3068
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
3016
3069
|
var r, n, i;
|
|
3017
|
-
return
|
|
3070
|
+
return de().wrap(function (t) {
|
|
3018
3071
|
for (;;) switch (t.prev = t.next) {
|
|
3019
3072
|
case 0:
|
|
3020
|
-
return
|
|
3073
|
+
return qe("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3021
3074
|
case 3:
|
|
3022
3075
|
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();
|
|
3023
3076
|
case 13:
|
|
@@ -3046,12 +3099,12 @@ var Ge = Promise.resolve({
|
|
|
3046
3099
|
}));
|
|
3047
3100
|
},
|
|
3048
3101
|
authenticate: function authenticate(e) {
|
|
3049
|
-
return
|
|
3102
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
3050
3103
|
var r, n, i, o, s;
|
|
3051
|
-
return
|
|
3104
|
+
return de().wrap(function (t) {
|
|
3052
3105
|
for (;;) switch (t.prev = t.next) {
|
|
3053
3106
|
case 0:
|
|
3054
|
-
return
|
|
3107
|
+
return qe("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3055
3108
|
case 3:
|
|
3056
3109
|
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();
|
|
3057
3110
|
case 12:
|
|
@@ -3092,20 +3145,20 @@ var Ge = Promise.resolve({
|
|
|
3092
3145
|
}
|
|
3093
3146
|
};
|
|
3094
3147
|
}),
|
|
3095
|
-
|
|
3148
|
+
ot = function () {
|
|
3096
3149
|
function e(t, r) {
|
|
3097
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3150
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
3098
3151
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3099
3152
|
}
|
|
3100
|
-
return
|
|
3153
|
+
return pe(e, [{
|
|
3101
3154
|
key: "create",
|
|
3102
3155
|
value: function value(e) {
|
|
3103
|
-
return
|
|
3156
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3104
3157
|
var r, n, i;
|
|
3105
|
-
return
|
|
3158
|
+
return de().wrap(function (t) {
|
|
3106
3159
|
for (;;) switch (t.prev = t.next) {
|
|
3107
3160
|
case 0:
|
|
3108
|
-
return
|
|
3161
|
+
return qe("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3109
3162
|
case 3:
|
|
3110
3163
|
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();
|
|
3111
3164
|
case 13:
|
|
@@ -3136,12 +3189,12 @@ var Ge = Promise.resolve({
|
|
|
3136
3189
|
}, {
|
|
3137
3190
|
key: "authenticate",
|
|
3138
3191
|
value: function value(e) {
|
|
3139
|
-
return
|
|
3192
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3140
3193
|
var r, n, i, o, s;
|
|
3141
|
-
return
|
|
3194
|
+
return de().wrap(function (t) {
|
|
3142
3195
|
for (;;) switch (t.prev = t.next) {
|
|
3143
3196
|
case 0:
|
|
3144
|
-
return
|
|
3197
|
+
return qe("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3145
3198
|
case 3:
|
|
3146
3199
|
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();
|
|
3147
3200
|
case 12:
|
|
@@ -3182,20 +3235,20 @@ var Ge = Promise.resolve({
|
|
|
3182
3235
|
}
|
|
3183
3236
|
}]), e;
|
|
3184
3237
|
}(),
|
|
3185
|
-
|
|
3238
|
+
st = function () {
|
|
3186
3239
|
function e(t, r) {
|
|
3187
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3240
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : He();
|
|
3188
3241
|
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3189
3242
|
}
|
|
3190
|
-
return
|
|
3243
|
+
return pe(e, [{
|
|
3191
3244
|
key: "recover",
|
|
3192
3245
|
value: function value(e) {
|
|
3193
|
-
return
|
|
3246
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
3194
3247
|
var r, n, i, o, s;
|
|
3195
|
-
return
|
|
3248
|
+
return de().wrap(function (t) {
|
|
3196
3249
|
for (;;) switch (t.prev = t.next) {
|
|
3197
3250
|
case 0:
|
|
3198
|
-
return
|
|
3251
|
+
return qe("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();
|
|
3199
3252
|
case 3:
|
|
3200
3253
|
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();
|
|
3201
3254
|
case 12:
|
|
@@ -3237,9 +3290,9 @@ var Ge = Promise.resolve({
|
|
|
3237
3290
|
}, {
|
|
3238
3291
|
key: "rotate",
|
|
3239
3292
|
value: function value() {
|
|
3240
|
-
return
|
|
3293
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
3241
3294
|
var t, r, n;
|
|
3242
|
-
return
|
|
3295
|
+
return de().wrap(function (e) {
|
|
3243
3296
|
for (;;) switch (e.prev = e.next) {
|
|
3244
3297
|
case 0:
|
|
3245
3298
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3264,8 +3317,8 @@ var Ge = Promise.resolve({
|
|
|
3264
3317
|
}, {
|
|
3265
3318
|
key: "get",
|
|
3266
3319
|
value: function value() {
|
|
3267
|
-
return
|
|
3268
|
-
return
|
|
3320
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
3321
|
+
return de().wrap(function (e) {
|
|
3269
3322
|
for (;;) switch (e.prev = e.next) {
|
|
3270
3323
|
case 0:
|
|
3271
3324
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3282,7 +3335,7 @@ var Ge = Promise.resolve({
|
|
|
3282
3335
|
}
|
|
3283
3336
|
}]), e;
|
|
3284
3337
|
}(),
|
|
3285
|
-
|
|
3338
|
+
at = function () {
|
|
3286
3339
|
function e(t, r, n) {
|
|
3287
3340
|
var i = this;
|
|
3288
3341
|
_e(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
@@ -3292,11 +3345,11 @@ var Ge = Promise.resolve({
|
|
|
3292
3345
|
return i.policyPromise.then(function (r) {
|
|
3293
3346
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3294
3347
|
});
|
|
3295
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3296
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3348
|
+
}, this.cachedPolicy = t.rbacPolicy ? lt.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3349
|
+
return e.rbacPolicy ? (i.cachedPolicy = lt.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ne("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new lt([], []));
|
|
3297
3350
|
});
|
|
3298
3351
|
}
|
|
3299
|
-
return
|
|
3352
|
+
return pe(e, [{
|
|
3300
3353
|
key: "allPermissions",
|
|
3301
3354
|
value: function value() {
|
|
3302
3355
|
var e = this;
|
|
@@ -3313,15 +3366,64 @@ var Ge = Promise.resolve({
|
|
|
3313
3366
|
}
|
|
3314
3367
|
}]), e;
|
|
3315
3368
|
}(),
|
|
3316
|
-
|
|
3369
|
+
ct = function () {
|
|
3370
|
+
function e(t) {
|
|
3371
|
+
_e(this, e), this.iframeURL = t, this.createIframe();
|
|
3372
|
+
}
|
|
3373
|
+
return pe(e, [{
|
|
3374
|
+
key: "createIframe",
|
|
3375
|
+
value: function value() {
|
|
3376
|
+
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3377
|
+
e ? Ke("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) {
|
|
3378
|
+
e.addEventListener("load", function () {
|
|
3379
|
+
e.dataset.loaded = "true", t(e);
|
|
3380
|
+
}, {
|
|
3381
|
+
once: !0
|
|
3382
|
+
});
|
|
3383
|
+
}) : this.frame = Promise.resolve(e);
|
|
3384
|
+
}
|
|
3385
|
+
}, {
|
|
3386
|
+
key: "call",
|
|
3387
|
+
value: function value(e, t) {
|
|
3388
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
3389
|
+
var n,
|
|
3390
|
+
i,
|
|
3391
|
+
o = this;
|
|
3392
|
+
return de().wrap(function (r) {
|
|
3393
|
+
for (;;) switch (r.prev = r.next) {
|
|
3394
|
+
case 0:
|
|
3395
|
+
return r.next = 2, this.frame;
|
|
3396
|
+
case 2:
|
|
3397
|
+
return n = r.sent, i = new MessageChannel(), r.abrupt("return", new Promise(function (r, s) {
|
|
3398
|
+
var a;
|
|
3399
|
+
i.port1.onmessage = function (e) {
|
|
3400
|
+
var t = e.data;
|
|
3401
|
+
i.port1.close(), t.success ? r(t.payload) : s(Ge.unmarshall(t.error));
|
|
3402
|
+
};
|
|
3403
|
+
var c = {
|
|
3404
|
+
method: e,
|
|
3405
|
+
args: t
|
|
3406
|
+
};
|
|
3407
|
+
null === (a = n.contentWindow) || void 0 === a || a.postMessage(c, o.iframeURL, [i.port2]);
|
|
3408
|
+
}));
|
|
3409
|
+
case 5:
|
|
3410
|
+
case "end":
|
|
3411
|
+
return r.stop();
|
|
3412
|
+
}
|
|
3413
|
+
}, r, this);
|
|
3414
|
+
}));
|
|
3415
|
+
}
|
|
3416
|
+
}]), e;
|
|
3417
|
+
}(),
|
|
3418
|
+
ut = function () {
|
|
3317
3419
|
function e(t, r) {
|
|
3318
3420
|
var n = this;
|
|
3319
3421
|
_e(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3320
3422
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3321
3423
|
}, this._reauthenticateWithBackoff = function () {
|
|
3322
|
-
return
|
|
3424
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
3323
3425
|
var r;
|
|
3324
|
-
return
|
|
3426
|
+
return de().wrap(function (t) {
|
|
3325
3427
|
for (;;) switch (t.prev = t.next) {
|
|
3326
3428
|
case 0:
|
|
3327
3429
|
r = 0;
|
|
@@ -3350,14 +3452,14 @@ var Ge = Promise.resolve({
|
|
|
3350
3452
|
}));
|
|
3351
3453
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3352
3454
|
}
|
|
3353
|
-
return
|
|
3455
|
+
return pe(e, [{
|
|
3354
3456
|
key: "performBackgroundRefresh",
|
|
3355
3457
|
value: function value() {
|
|
3356
3458
|
var e = this;
|
|
3357
3459
|
this._reauthenticateWithBackoff().then(function () {
|
|
3358
3460
|
e.scheduleBackgroundRefresh();
|
|
3359
3461
|
})["catch"](function (t) {
|
|
3360
|
-
|
|
3462
|
+
Ke("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3361
3463
|
error: t
|
|
3362
3464
|
}), e._subscriptionService.destroySession();
|
|
3363
3465
|
});
|
|
@@ -3383,19 +3485,19 @@ var Ge = Promise.resolve({
|
|
|
3383
3485
|
}, {
|
|
3384
3486
|
key: "isUnrecoverableError",
|
|
3385
3487
|
value: function value(e) {
|
|
3386
|
-
return
|
|
3488
|
+
return C.includes(e.error_type);
|
|
3387
3489
|
}
|
|
3388
3490
|
}]), e;
|
|
3389
3491
|
}();
|
|
3390
|
-
|
|
3391
|
-
var
|
|
3492
|
+
ut.REFRESH_INTERVAL_MS = 18e4;
|
|
3493
|
+
var lt = function () {
|
|
3392
3494
|
function e(t, r) {
|
|
3393
3495
|
var n = this;
|
|
3394
3496
|
_e(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3395
3497
|
return n.rolesByID[e.role_id] = e;
|
|
3396
3498
|
});
|
|
3397
3499
|
}
|
|
3398
|
-
return
|
|
3500
|
+
return pe(e, [{
|
|
3399
3501
|
key: "callerIsAuthorized",
|
|
3400
3502
|
value: function value(e, t, r) {
|
|
3401
3503
|
var n = this;
|
|
@@ -3429,19 +3531,19 @@ var at = function () {
|
|
|
3429
3531
|
}
|
|
3430
3532
|
}]), e;
|
|
3431
3533
|
}();
|
|
3432
|
-
var
|
|
3433
|
-
var
|
|
3434
|
-
function
|
|
3534
|
+
var dt = "bootstrap";
|
|
3535
|
+
var ht = /*#__PURE__*/function () {
|
|
3536
|
+
function ht(e, t, r) {
|
|
3435
3537
|
var _this = this;
|
|
3436
|
-
_classCallCheck(this,
|
|
3538
|
+
_classCallCheck(this, ht);
|
|
3437
3539
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3438
3540
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3439
3541
|
method: "GET",
|
|
3440
3542
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3441
|
-
}).then(
|
|
3442
|
-
return _this._dataLayer.setItem(
|
|
3543
|
+
}).then(ht.mapBootstrapData).then(function (e) {
|
|
3544
|
+
return _this._dataLayer.setItem(dt, JSON.stringify(e)), e;
|
|
3443
3545
|
})["catch"](function (e) {
|
|
3444
|
-
return
|
|
3546
|
+
return Ne(e), {
|
|
3445
3547
|
displayWatermark: !1,
|
|
3446
3548
|
cnameDomain: null,
|
|
3447
3549
|
emailDomains: ["stytch.com"],
|
|
@@ -3460,10 +3562,10 @@ var ut = /*#__PURE__*/function () {
|
|
|
3460
3562
|
};
|
|
3461
3563
|
});
|
|
3462
3564
|
}
|
|
3463
|
-
_createClass(
|
|
3565
|
+
_createClass(ht, [{
|
|
3464
3566
|
key: "getSync",
|
|
3465
3567
|
value: function getSync() {
|
|
3466
|
-
var e = this._dataLayer.getItem(
|
|
3568
|
+
var e = this._dataLayer.getItem(dt);
|
|
3467
3569
|
if (null === e) return {
|
|
3468
3570
|
displayWatermark: !1,
|
|
3469
3571
|
cnameDomain: null,
|
|
@@ -3534,9 +3636,9 @@ var ut = /*#__PURE__*/function () {
|
|
|
3534
3636
|
};
|
|
3535
3637
|
}
|
|
3536
3638
|
}]);
|
|
3537
|
-
return
|
|
3639
|
+
return ht;
|
|
3538
3640
|
}();
|
|
3539
|
-
function
|
|
3641
|
+
function pt(e, t, r, n) {
|
|
3540
3642
|
return new (r || (r = Promise))(function (i, o) {
|
|
3541
3643
|
function s(e) {
|
|
3542
3644
|
try {
|
|
@@ -3562,11 +3664,11 @@ function lt(e, t, r, n) {
|
|
|
3562
3664
|
});
|
|
3563
3665
|
}
|
|
3564
3666
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3565
|
-
var
|
|
3667
|
+
var ft = /*#__PURE__*/_createClass(function ft(e) {
|
|
3566
3668
|
var _this2 = this;
|
|
3567
|
-
_classCallCheck(this,
|
|
3669
|
+
_classCallCheck(this, ft);
|
|
3568
3670
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3569
|
-
return
|
|
3671
|
+
return pt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3570
3672
|
var _yield$this$state, e, t, r;
|
|
3571
3673
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3572
3674
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3597,7 +3699,7 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3597
3699
|
}, _callee, this);
|
|
3598
3700
|
}));
|
|
3599
3701
|
}, this.state = e.then(function (e) {
|
|
3600
|
-
return
|
|
3702
|
+
return pt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3601
3703
|
var t;
|
|
3602
3704
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3603
3705
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3608,7 +3710,7 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3608
3710
|
}
|
|
3609
3711
|
_context2.t1 = !0;
|
|
3610
3712
|
_context2.next = 4;
|
|
3611
|
-
return t = e.captchaSettings.siteKey,
|
|
3713
|
+
return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3612
3714
|
return window.grecaptcha.enterprise;
|
|
3613
3715
|
});
|
|
3614
3716
|
case 4:
|
|
@@ -3635,18 +3737,44 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3635
3737
|
}));
|
|
3636
3738
|
});
|
|
3637
3739
|
});
|
|
3638
|
-
var
|
|
3639
|
-
function
|
|
3640
|
-
|
|
3740
|
+
var _t = /*#__PURE__*/function () {
|
|
3741
|
+
function _t(e) {
|
|
3742
|
+
var _this3 = this;
|
|
3743
|
+
_classCallCheck(this, _t);
|
|
3744
|
+
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3745
|
+
return _this3.call("oneTapStart", e);
|
|
3746
|
+
}, this.oneTapSubmit = function (e) {
|
|
3747
|
+
return _this3.call("oneTapSubmit", e);
|
|
3748
|
+
}, this.parsedPhoneNumber = function (e) {
|
|
3749
|
+
return _this3.call("parsedPhoneNumber", e);
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3752
|
+
_createClass(_t, [{
|
|
3753
|
+
key: "frameClient",
|
|
3754
|
+
get: function get() {
|
|
3755
|
+
var e;
|
|
3756
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new ct(this.iframeURL), this._frameClient;
|
|
3757
|
+
}
|
|
3758
|
+
}, {
|
|
3759
|
+
key: "call",
|
|
3760
|
+
value: function call(e, t) {
|
|
3761
|
+
return this.frameClient.call(e, [t]);
|
|
3762
|
+
}
|
|
3763
|
+
}]);
|
|
3764
|
+
return _t;
|
|
3765
|
+
}();
|
|
3766
|
+
var mt = /*#__PURE__*/function () {
|
|
3767
|
+
function mt(e, t, r, n) {
|
|
3768
|
+
_classCallCheck(this, mt);
|
|
3641
3769
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3642
3770
|
return null;
|
|
3643
|
-
}, this.eventLogger = new
|
|
3771
|
+
}, this.eventLogger = new Ve({
|
|
3644
3772
|
maxBatchSize: 15,
|
|
3645
3773
|
intervalDurationMs: 800,
|
|
3646
3774
|
logEventURL: this.buildSDKUrl("/events")
|
|
3647
3775
|
});
|
|
3648
3776
|
}
|
|
3649
|
-
_createClass(
|
|
3777
|
+
_createClass(mt, [{
|
|
3650
3778
|
key: "logEvent",
|
|
3651
3779
|
value: function logEvent(_ref) {
|
|
3652
3780
|
var e = _ref.name,
|
|
@@ -3666,9 +3794,9 @@ var ht = /*#__PURE__*/function () {
|
|
|
3666
3794
|
key: "createTelemetryBlob",
|
|
3667
3795
|
value: function createTelemetryBlob() {
|
|
3668
3796
|
return Object.assign(Object.assign({
|
|
3669
|
-
event_id: "event-id-".concat(
|
|
3670
|
-
app_session_id: "app-session-id-".concat(
|
|
3671
|
-
persistent_id: "persistent-id-".concat(
|
|
3797
|
+
event_id: "event-id-".concat(Ie()),
|
|
3798
|
+
app_session_id: "app-session-id-".concat(Ie()),
|
|
3799
|
+
persistent_id: "persistent-id-".concat(Ie()),
|
|
3672
3800
|
client_sent_at: new Date().toISOString(),
|
|
3673
3801
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3674
3802
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3677,7 +3805,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3677
3805
|
},
|
|
3678
3806
|
sdk: {
|
|
3679
3807
|
identifier: "Stytch.js Javascript SDK",
|
|
3680
|
-
version: "4.
|
|
3808
|
+
version: "4.6.0"
|
|
3681
3809
|
}
|
|
3682
3810
|
});
|
|
3683
3811
|
}
|
|
@@ -3688,7 +3816,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3688
3816
|
t = _ref2.body,
|
|
3689
3817
|
r = _ref2.errorMessage,
|
|
3690
3818
|
n = _ref2.method;
|
|
3691
|
-
return
|
|
3819
|
+
return pt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3692
3820
|
var i, o, s, a;
|
|
3693
3821
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3694
3822
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3718,7 +3846,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3718
3846
|
r = _ref3.errorMessage,
|
|
3719
3847
|
n = _ref3.method,
|
|
3720
3848
|
i = _ref3.retryCallback;
|
|
3721
|
-
return
|
|
3849
|
+
return pt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3722
3850
|
var o, s, a, c;
|
|
3723
3851
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3724
3852
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -3733,9 +3861,9 @@ var ht = /*#__PURE__*/function () {
|
|
|
3733
3861
|
s = e.xSDKParentHostHeader,
|
|
3734
3862
|
a = e.body,
|
|
3735
3863
|
c = e.retryCallback;
|
|
3736
|
-
return
|
|
3864
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
3737
3865
|
var u;
|
|
3738
|
-
return
|
|
3866
|
+
return de().wrap(function (e) {
|
|
3739
3867
|
for (;;) switch (e.prev = e.next) {
|
|
3740
3868
|
case 0:
|
|
3741
3869
|
return u = {
|
|
@@ -3751,7 +3879,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3751
3879
|
case 15:
|
|
3752
3880
|
return e.abrupt("return", e.sent);
|
|
3753
3881
|
case 7:
|
|
3754
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3882
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Pe)) {
|
|
3755
3883
|
e.next = 16;
|
|
3756
3884
|
break;
|
|
3757
3885
|
}
|
|
@@ -3789,18 +3917,18 @@ var ht = /*#__PURE__*/function () {
|
|
|
3789
3917
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3790
3918
|
}
|
|
3791
3919
|
}]);
|
|
3792
|
-
return
|
|
3920
|
+
return mt;
|
|
3793
3921
|
}();
|
|
3794
|
-
function
|
|
3922
|
+
function vt(e) {
|
|
3795
3923
|
var t = e.toString(16);
|
|
3796
3924
|
return 1 === t.length && (t = "0" + t), t;
|
|
3797
3925
|
}
|
|
3798
|
-
var
|
|
3799
|
-
function
|
|
3800
|
-
_classCallCheck(this,
|
|
3926
|
+
var bt = /*#__PURE__*/function () {
|
|
3927
|
+
function bt(e, t) {
|
|
3928
|
+
_classCallCheck(this, bt);
|
|
3801
3929
|
this._dataLayer = e, this.namespace = t;
|
|
3802
3930
|
}
|
|
3803
|
-
_createClass(
|
|
3931
|
+
_createClass(bt, [{
|
|
3804
3932
|
key: "key",
|
|
3805
3933
|
value: function key() {
|
|
3806
3934
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3808,13 +3936,13 @@ var _t = /*#__PURE__*/function () {
|
|
|
3808
3936
|
}, {
|
|
3809
3937
|
key: "startPKCETransaction",
|
|
3810
3938
|
value: function startPKCETransaction() {
|
|
3811
|
-
return
|
|
3939
|
+
return pt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3812
3940
|
var e;
|
|
3813
3941
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3814
3942
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3815
3943
|
case 0:
|
|
3816
3944
|
_context5.next = 2;
|
|
3817
|
-
return
|
|
3945
|
+
return bt.createProofkeyPair();
|
|
3818
3946
|
case 2:
|
|
3819
3947
|
e = _context5.sent;
|
|
3820
3948
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3832,7 +3960,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3832
3960
|
if (null !== e) try {
|
|
3833
3961
|
return JSON.parse(e);
|
|
3834
3962
|
} catch (e) {
|
|
3835
|
-
return void
|
|
3963
|
+
return void Ke("Found malformed Proof Key pair in localstorage.");
|
|
3836
3964
|
}
|
|
3837
3965
|
}
|
|
3838
3966
|
}, {
|
|
@@ -3843,7 +3971,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3843
3971
|
}], [{
|
|
3844
3972
|
key: "createProofkeyPair",
|
|
3845
3973
|
value: function createProofkeyPair() {
|
|
3846
|
-
return
|
|
3974
|
+
return pt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3847
3975
|
var _String$fromCharCode;
|
|
3848
3976
|
var e, t, r, n;
|
|
3849
3977
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3851,7 +3979,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3851
3979
|
case 0:
|
|
3852
3980
|
e = new Uint32Array(16);
|
|
3853
3981
|
window.crypto.getRandomValues(e);
|
|
3854
|
-
t = Array.from(e).map(
|
|
3982
|
+
t = Array.from(e).map(vt).join("");
|
|
3855
3983
|
_context6.next = 5;
|
|
3856
3984
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3857
3985
|
case 5:
|
|
@@ -3868,14 +3996,14 @@ var _t = /*#__PURE__*/function () {
|
|
|
3868
3996
|
}));
|
|
3869
3997
|
}
|
|
3870
3998
|
}]);
|
|
3871
|
-
return
|
|
3999
|
+
return bt;
|
|
3872
4000
|
}();
|
|
3873
|
-
var
|
|
3874
|
-
function
|
|
3875
|
-
_classCallCheck(this,
|
|
4001
|
+
var gt = /*#__PURE__*/function () {
|
|
4002
|
+
function gt(e) {
|
|
4003
|
+
_classCallCheck(this, gt);
|
|
3876
4004
|
this._networkClient = e;
|
|
3877
4005
|
}
|
|
3878
|
-
_createClass(
|
|
4006
|
+
_createClass(gt, [{
|
|
3879
4007
|
key: "searchUser",
|
|
3880
4008
|
value: function searchUser(e) {
|
|
3881
4009
|
return this._networkClient.fetchSDK({
|
|
@@ -3913,9 +4041,9 @@ var ft = /*#__PURE__*/function () {
|
|
|
3913
4041
|
});
|
|
3914
4042
|
}
|
|
3915
4043
|
}]);
|
|
3916
|
-
return
|
|
4044
|
+
return gt;
|
|
3917
4045
|
}();
|
|
3918
|
-
var
|
|
4046
|
+
var yt = function yt(e) {
|
|
3919
4047
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3920
4048
|
var _t$split = t.split("="),
|
|
3921
4049
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3924,17 +4052,17 @@ var mt = function mt(e) {
|
|
|
3924
4052
|
}).length > 1;
|
|
3925
4053
|
};
|
|
3926
4054
|
/*! js-cookie v3.0.1 | MIT */
|
|
3927
|
-
function
|
|
4055
|
+
function kt(e) {
|
|
3928
4056
|
for (var t = 1; t < arguments.length; t++) {
|
|
3929
4057
|
var r = arguments[t];
|
|
3930
4058
|
for (var n in r) e[n] = r[n];
|
|
3931
4059
|
}
|
|
3932
4060
|
return e;
|
|
3933
4061
|
}
|
|
3934
|
-
var
|
|
4062
|
+
var wt = function e(t, r) {
|
|
3935
4063
|
function n(e, n, i) {
|
|
3936
4064
|
if ("undefined" != typeof document) {
|
|
3937
|
-
"number" == typeof (i =
|
|
4065
|
+
"number" == typeof (i = kt({}, 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);
|
|
3938
4066
|
var o = "";
|
|
3939
4067
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
3940
4068
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -3956,15 +4084,15 @@ var bt = function e(t, r) {
|
|
|
3956
4084
|
}
|
|
3957
4085
|
},
|
|
3958
4086
|
remove: function remove(e, t) {
|
|
3959
|
-
n(e, "",
|
|
4087
|
+
n(e, "", kt({}, t, {
|
|
3960
4088
|
expires: -1
|
|
3961
4089
|
}));
|
|
3962
4090
|
},
|
|
3963
4091
|
withAttributes: function withAttributes(t) {
|
|
3964
|
-
return e(this.converter,
|
|
4092
|
+
return e(this.converter, kt({}, this.attributes, t));
|
|
3965
4093
|
},
|
|
3966
4094
|
withConverter: function withConverter(t) {
|
|
3967
|
-
return e(
|
|
4095
|
+
return e(kt({}, this.converter, t), this.attributes);
|
|
3968
4096
|
}
|
|
3969
4097
|
}, {
|
|
3970
4098
|
attributes: {
|
|
@@ -3984,37 +4112,37 @@ var bt = function e(t, r) {
|
|
|
3984
4112
|
}, {
|
|
3985
4113
|
path: "/"
|
|
3986
4114
|
});
|
|
3987
|
-
var
|
|
4115
|
+
var St = function St(e) {
|
|
3988
4116
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3989
4117
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3990
4118
|
},
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
clearTimeout(
|
|
4119
|
+
Pt = new Map(),
|
|
4120
|
+
xt = function xt(e) {
|
|
4121
|
+
clearTimeout(Pt.get(e));
|
|
3994
4122
|
},
|
|
3995
|
-
|
|
3996
|
-
|
|
4123
|
+
Ct = function Ct(e, t, r) {
|
|
4124
|
+
xt(e);
|
|
3997
4125
|
var n = setTimeout(function () {
|
|
3998
|
-
void 0 ===
|
|
4126
|
+
void 0 === wt.get(e) && wt.set(e, t, r);
|
|
3999
4127
|
}, 10);
|
|
4000
|
-
return
|
|
4128
|
+
return Pt.set(e, n), wt.set(e, t, r);
|
|
4001
4129
|
};
|
|
4002
|
-
var
|
|
4003
|
-
function
|
|
4004
|
-
var
|
|
4005
|
-
_classCallCheck(this,
|
|
4130
|
+
var Tt = /*#__PURE__*/function () {
|
|
4131
|
+
function Tt(e, t) {
|
|
4132
|
+
var _this4 = this;
|
|
4133
|
+
_classCallCheck(this, Tt);
|
|
4006
4134
|
this.browserSessionStorage = {
|
|
4007
4135
|
getItem: function getItem(e) {
|
|
4008
|
-
return sessionStorage.getItem(
|
|
4136
|
+
return sessionStorage.getItem(St(_this4.publicToken, e));
|
|
4009
4137
|
},
|
|
4010
4138
|
setItem: function setItem(e, t) {
|
|
4011
|
-
return sessionStorage.setItem(
|
|
4139
|
+
return sessionStorage.setItem(St(_this4.publicToken, e), t);
|
|
4012
4140
|
},
|
|
4013
4141
|
removeItem: function removeItem(e) {
|
|
4014
|
-
return sessionStorage.removeItem(
|
|
4142
|
+
return sessionStorage.removeItem(St(_this4.publicToken, e));
|
|
4015
4143
|
}
|
|
4016
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4017
|
-
var r = localStorage.getItem(
|
|
4144
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4145
|
+
var r = localStorage.getItem(St(this.publicToken));
|
|
4018
4146
|
if (!r) return;
|
|
4019
4147
|
var n;
|
|
4020
4148
|
try {
|
|
@@ -4024,7 +4152,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4024
4152
|
}
|
|
4025
4153
|
this.state = n;
|
|
4026
4154
|
}
|
|
4027
|
-
_createClass(
|
|
4155
|
+
_createClass(Tt, [{
|
|
4028
4156
|
key: "opaqueTokenCookieName",
|
|
4029
4157
|
get: function get() {
|
|
4030
4158
|
var e;
|
|
@@ -4046,14 +4174,14 @@ var St = /*#__PURE__*/function () {
|
|
|
4046
4174
|
key: "readSessionCookie",
|
|
4047
4175
|
value: function readSessionCookie() {
|
|
4048
4176
|
return {
|
|
4049
|
-
session_token:
|
|
4050
|
-
session_jwt:
|
|
4177
|
+
session_token: wt.get(this.opaqueTokenCookieName),
|
|
4178
|
+
session_jwt: wt.get(this.jwtCookieName)
|
|
4051
4179
|
};
|
|
4052
4180
|
}
|
|
4053
4181
|
}, {
|
|
4054
4182
|
key: "readIntermediateSessionTokenCookie",
|
|
4055
4183
|
value: function readIntermediateSessionTokenCookie() {
|
|
4056
|
-
return
|
|
4184
|
+
return wt.get(this.istCookieName);
|
|
4057
4185
|
}
|
|
4058
4186
|
}, {
|
|
4059
4187
|
key: "writeSessionCookie",
|
|
@@ -4062,32 +4190,32 @@ var St = /*#__PURE__*/function () {
|
|
|
4062
4190
|
var o = e.state,
|
|
4063
4191
|
s = e.session_token,
|
|
4064
4192
|
a = e.session_jwt,
|
|
4065
|
-
c =
|
|
4193
|
+
c = Tt.generateCookieOpts({
|
|
4066
4194
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4067
4195
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4068
4196
|
path: this._cookiePath,
|
|
4069
4197
|
domain: this._domain
|
|
4070
4198
|
});
|
|
4071
|
-
|
|
4072
|
-
var u =
|
|
4199
|
+
Ct(this.opaqueTokenCookieName, s, c), Ct(this.jwtCookieName, a, c);
|
|
4200
|
+
var u = Tt.generateCookieOpts({
|
|
4073
4201
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4074
4202
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4075
4203
|
path: this._cookiePath,
|
|
4076
4204
|
domain: this._domain
|
|
4077
4205
|
});
|
|
4078
|
-
|
|
4206
|
+
yt(this.jwtCookieName) && wt.remove(this.jwtCookieName, u), yt(this.opaqueTokenCookieName) && wt.remove(this.opaqueTokenCookieName, u), yt(this.jwtCookieName) && Ke("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), yt(this.opaqueTokenCookieName) && Ke("Could not remove extraneous opaque token cookie.");
|
|
4079
4207
|
}
|
|
4080
4208
|
}, {
|
|
4081
4209
|
key: "writeIntermediateSessionTokenCookie",
|
|
4082
4210
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4083
4211
|
var t = new Date(Date.now() + 6e5),
|
|
4084
|
-
r =
|
|
4212
|
+
r = Tt.generateCookieOpts({
|
|
4085
4213
|
expiresAt: t.toString(),
|
|
4086
4214
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4087
4215
|
path: this._cookiePath,
|
|
4088
4216
|
domain: this._domain
|
|
4089
4217
|
});
|
|
4090
|
-
|
|
4218
|
+
Ct(this.istCookieName, e, r);
|
|
4091
4219
|
}
|
|
4092
4220
|
}, {
|
|
4093
4221
|
key: "removeSessionCookie",
|
|
@@ -4102,50 +4230,50 @@ var St = /*#__PURE__*/function () {
|
|
|
4102
4230
|
}, {
|
|
4103
4231
|
key: "removeCookies",
|
|
4104
4232
|
value: function removeCookies(e) {
|
|
4105
|
-
var
|
|
4233
|
+
var _this5 = this;
|
|
4106
4234
|
[!0, !1].forEach(function (t) {
|
|
4107
|
-
[
|
|
4108
|
-
[
|
|
4109
|
-
var i =
|
|
4235
|
+
[_this5._cookiePath, null].forEach(function (r) {
|
|
4236
|
+
[_this5._domain, null].forEach(function (n) {
|
|
4237
|
+
var i = Tt.generateCookieOpts({
|
|
4110
4238
|
expiresAt: new Date(0).toString(),
|
|
4111
4239
|
availableToSubdomains: t,
|
|
4112
4240
|
path: r,
|
|
4113
4241
|
domain: n
|
|
4114
4242
|
});
|
|
4115
4243
|
e.forEach(function (e) {
|
|
4116
|
-
|
|
4244
|
+
wt.remove(e, i);
|
|
4117
4245
|
});
|
|
4118
4246
|
});
|
|
4119
4247
|
});
|
|
4120
|
-
}), e.forEach(
|
|
4248
|
+
}), e.forEach(xt);
|
|
4121
4249
|
}
|
|
4122
4250
|
}, {
|
|
4123
4251
|
key: "syncToLocalStorage",
|
|
4124
4252
|
value: function syncToLocalStorage() {
|
|
4125
|
-
localStorage.setItem(
|
|
4253
|
+
localStorage.setItem(St(this.publicToken), JSON.stringify(this.state));
|
|
4126
4254
|
}
|
|
4127
4255
|
}, {
|
|
4128
4256
|
key: "getItem",
|
|
4129
4257
|
value: function getItem(e) {
|
|
4130
|
-
return localStorage.getItem(
|
|
4258
|
+
return localStorage.getItem(St(this.publicToken, e));
|
|
4131
4259
|
}
|
|
4132
4260
|
}, {
|
|
4133
4261
|
key: "setItem",
|
|
4134
4262
|
value: function setItem(e, t) {
|
|
4135
|
-
return localStorage.setItem(
|
|
4263
|
+
return localStorage.setItem(St(this.publicToken, e), t);
|
|
4136
4264
|
}
|
|
4137
4265
|
}, {
|
|
4138
4266
|
key: "removeItem",
|
|
4139
4267
|
value: function removeItem(e) {
|
|
4140
|
-
return localStorage.removeItem(
|
|
4268
|
+
return localStorage.removeItem(St(this.publicToken, e));
|
|
4141
4269
|
}
|
|
4142
4270
|
}, {
|
|
4143
4271
|
key: "markStateKeysUpdated",
|
|
4144
4272
|
value: function markStateKeysUpdated(e) {
|
|
4145
|
-
var
|
|
4273
|
+
var _this6 = this;
|
|
4146
4274
|
var t = this.stateKeysUpdated.size;
|
|
4147
4275
|
return e.forEach(function (e) {
|
|
4148
|
-
return
|
|
4276
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4149
4277
|
}), t !== this.stateKeysUpdated.size;
|
|
4150
4278
|
}
|
|
4151
4279
|
}], [{
|
|
@@ -4162,40 +4290,40 @@ var St = /*#__PURE__*/function () {
|
|
|
4162
4290
|
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;
|
|
4163
4291
|
}
|
|
4164
4292
|
}]);
|
|
4165
|
-
return
|
|
4293
|
+
return Tt;
|
|
4166
4294
|
}();
|
|
4167
|
-
var
|
|
4168
|
-
_inherits(
|
|
4169
|
-
function
|
|
4170
|
-
_classCallCheck(this,
|
|
4171
|
-
return _callSuper(this,
|
|
4295
|
+
var Ot = /*#__PURE__*/function (_Tt) {
|
|
4296
|
+
_inherits(Ot, _Tt);
|
|
4297
|
+
function Ot() {
|
|
4298
|
+
_classCallCheck(this, Ot);
|
|
4299
|
+
return _callSuper(this, Ot, arguments);
|
|
4172
4300
|
}
|
|
4173
|
-
return _createClass(
|
|
4174
|
-
}(
|
|
4175
|
-
var
|
|
4176
|
-
|
|
4301
|
+
return _createClass(Ot);
|
|
4302
|
+
}(Tt);
|
|
4303
|
+
var Et = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4304
|
+
At = function At(e, t) {
|
|
4177
4305
|
var r = function () {
|
|
4178
4306
|
var e = window;
|
|
4179
|
-
return e[
|
|
4307
|
+
return e[Et] || (e[Et] = {}), e[Et];
|
|
4180
4308
|
}();
|
|
4181
|
-
return r[e] || (r[e] = new
|
|
4309
|
+
return r[e] || (r[e] = new Ot(e, t)), r[e];
|
|
4182
4310
|
},
|
|
4183
|
-
|
|
4311
|
+
Dt = function Dt(e, t) {
|
|
4184
4312
|
Object.values(e).forEach(function (e) {
|
|
4185
4313
|
return e(t);
|
|
4186
4314
|
});
|
|
4187
4315
|
},
|
|
4188
|
-
|
|
4316
|
+
It = function () {
|
|
4189
4317
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4190
4318
|
t = void 0 === e ? [] : e;
|
|
4191
4319
|
return function e(r, n) {
|
|
4192
|
-
return
|
|
4320
|
+
return le(r) === le(n) && (null === r || null === n ? r === n : "object" === le(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4193
4321
|
return !(e in n);
|
|
4194
4322
|
}) && Object.entries(r).filter(function (e) {
|
|
4195
|
-
var r =
|
|
4323
|
+
var r = ae(e, 1)[0];
|
|
4196
4324
|
return !t.includes(r);
|
|
4197
4325
|
}).every(function (t) {
|
|
4198
|
-
var r =
|
|
4326
|
+
var r = ae(t, 2),
|
|
4199
4327
|
i = r[0],
|
|
4200
4328
|
o = r[1];
|
|
4201
4329
|
return e(o, n[i]);
|
|
@@ -4204,20 +4332,20 @@ var Pt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4204
4332
|
}({
|
|
4205
4333
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4206
4334
|
});
|
|
4207
|
-
var
|
|
4208
|
-
function
|
|
4209
|
-
var
|
|
4210
|
-
_classCallCheck(this,
|
|
4335
|
+
var Rt = /*#__PURE__*/function () {
|
|
4336
|
+
function Rt(e, t) {
|
|
4337
|
+
var _this7 = this;
|
|
4338
|
+
_classCallCheck(this, Rt);
|
|
4211
4339
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4212
|
-
if (e.key !==
|
|
4340
|
+
if (e.key !== St(_this7._publicToken)) return;
|
|
4213
4341
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4214
|
-
|
|
4342
|
+
_this7.updateState(t);
|
|
4215
4343
|
}, window.addEventListener("storage", this._listen);
|
|
4216
4344
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4217
4345
|
r = _this$_datalayer$read.session_token;
|
|
4218
4346
|
r || this.destroySession();
|
|
4219
4347
|
}
|
|
4220
|
-
_createClass(
|
|
4348
|
+
_createClass(Rt, [{
|
|
4221
4349
|
key: "getTokens",
|
|
4222
4350
|
value: function getTokens() {
|
|
4223
4351
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4255,7 +4383,7 @@ var At = /*#__PURE__*/function () {
|
|
|
4255
4383
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4256
4384
|
this._datalayer.state = r;
|
|
4257
4385
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4258
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4386
|
+
!this._datalayer.markStateKeysUpdated(n) && It(t, r) || Dt(this._datalayer.subscriptions, r);
|
|
4259
4387
|
}
|
|
4260
4388
|
}, {
|
|
4261
4389
|
key: "updateStateAndTokens",
|
|
@@ -4270,8 +4398,8 @@ var At = /*#__PURE__*/function () {
|
|
|
4270
4398
|
this._datalayer.state = r;
|
|
4271
4399
|
var n = e ? Object.keys(e) : [],
|
|
4272
4400
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4273
|
-
o = !
|
|
4274
|
-
(i || o) && (
|
|
4401
|
+
o = !It(t, r);
|
|
4402
|
+
(i || o) && (Dt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4275
4403
|
}
|
|
4276
4404
|
}, {
|
|
4277
4405
|
key: "updateTokens",
|
|
@@ -4311,44 +4439,44 @@ var At = /*#__PURE__*/function () {
|
|
|
4311
4439
|
return null;
|
|
4312
4440
|
}
|
|
4313
4441
|
}]);
|
|
4314
|
-
return
|
|
4442
|
+
return Rt;
|
|
4315
4443
|
}();
|
|
4316
|
-
var
|
|
4317
|
-
_inherits(
|
|
4318
|
-
function
|
|
4319
|
-
var
|
|
4320
|
-
_classCallCheck(this,
|
|
4321
|
-
|
|
4322
|
-
return
|
|
4444
|
+
var Bt = /*#__PURE__*/function (_Rt) {
|
|
4445
|
+
_inherits(Bt, _Rt);
|
|
4446
|
+
function Bt() {
|
|
4447
|
+
var _this8;
|
|
4448
|
+
_classCallCheck(this, Bt);
|
|
4449
|
+
_this8 = _callSuper(this, Bt, arguments), _this8.updateMember = function (e) {
|
|
4450
|
+
return _this8.updateState({
|
|
4323
4451
|
member: e
|
|
4324
4452
|
});
|
|
4325
|
-
},
|
|
4453
|
+
}, _this8.getMember = function () {
|
|
4326
4454
|
var e, t;
|
|
4327
|
-
return null !== (t = null === (e =
|
|
4328
|
-
},
|
|
4329
|
-
return
|
|
4455
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4456
|
+
}, _this8.updateOrganization = function (e) {
|
|
4457
|
+
return _this8.updateState({
|
|
4330
4458
|
organization: e
|
|
4331
4459
|
});
|
|
4332
|
-
},
|
|
4460
|
+
}, _this8.getOrganization = function () {
|
|
4333
4461
|
var e, t;
|
|
4334
|
-
return null !== (t = null === (e =
|
|
4335
|
-
},
|
|
4462
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4463
|
+
}, _this8.getSession = function () {
|
|
4336
4464
|
var e, t;
|
|
4337
|
-
return null !== (t = null === (e =
|
|
4465
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4338
4466
|
};
|
|
4339
|
-
return
|
|
4467
|
+
return _this8;
|
|
4340
4468
|
}
|
|
4341
|
-
return _createClass(
|
|
4342
|
-
}(
|
|
4343
|
-
var
|
|
4344
|
-
exports.BiometricsFailedError =
|
|
4469
|
+
return _createClass(Bt);
|
|
4470
|
+
}(Rt);
|
|
4471
|
+
var Ft = Symbol["for"]("stytch__internal_b2b");
|
|
4472
|
+
exports.BiometricsFailedError = Z, exports.BiometricsUnavailableError = F, exports.ChallengeSigningFailedError = V, exports.DeviceCredentialsNotAllowedError = U, exports.FailedCodeChallengeError = J, exports.FailedToDecryptDataError = X, exports.InternalError = R, exports.InvalidAuthorizationCredentialError = H, exports.InvalidCredentialTypeError = re, exports.InvalidRedirectSchemeError = ee, exports.InvalidStartUrlError = Q, exports.JSONDataNotConvertibleToStringError = ie, exports.KeyInvalidatedError = j, exports.KeystoreUnavailableError = M, exports.MissingAttestationObjectError = ne, exports.MissingAuthorizationCredentialIDTokenError = W, exports.MissingGoogleClientIDError = z, exports.MissingPKCEError = q, exports.MissingPublicKeyError = G, exports.MissingUrlError = te, exports.NoBiometricsEnrolledError = L, exports.NoBiometricsRegistrationError = B, exports.NoCurrentSessionError = I, exports.PasskeysInvalidEncoding = se, exports.PasskeysUnsupportedError = $, exports.RandomNumberGenerationFailed = oe, exports.SDKAPIUnreachableError = w, exports.SDKNotConfiguredError = Y, exports.StytchAPIError = A, exports.StytchAPISchemaError = E, exports.StytchAPIUnreachableError = O, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
|
|
4345
4473
|
function _class(e, t) {
|
|
4346
|
-
var
|
|
4474
|
+
var _this9 = this;
|
|
4347
4475
|
_classCallCheck(this, _class);
|
|
4348
4476
|
var r;
|
|
4349
4477
|
!function (e) {
|
|
4350
4478
|
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"));
|
|
4351
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4479
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ke("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(Ue)) : "" === r ? Ke('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ue)) : r.startsWith("public-token-") || Ke('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ue));
|
|
4352
4480
|
var n = t,
|
|
4353
4481
|
i = {
|
|
4354
4482
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4357,32 +4485,33 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4357
4485
|
testAPIURL: null !== (u = null === (c = null == o ? void 0 : o.endpoints) || void 0 === c ? void 0 : c.testAPIURL) && void 0 !== u ? u : "https://test.stytch.com",
|
|
4358
4486
|
liveAPIURL: null !== (d = null === (l = null == o ? void 0 : o.endpoints) || void 0 === l ? void 0 : l.liveAPIURL) && void 0 !== d ? d : "https://api.stytch.com",
|
|
4359
4487
|
dfpBackendURL: null !== (p = null === (h = null == o ? void 0 : o.endpoints) || void 0 === h ? void 0 : h.dfpBackendURL) && void 0 !== p ? p : "https://telemetry.stytch.com",
|
|
4360
|
-
clientsideServicesIframeURL: null !== (
|
|
4488
|
+
clientsideServicesIframeURL: null !== (_ = null === (f = null == o ? void 0 : o.endpoints) || void 0 === f ? void 0 : f.clientsideServicesIframeURL) && void 0 !== _ ? _ : "https://js.stytch.com/clientside-services/index.html"
|
|
4361
4489
|
}
|
|
4362
4490
|
};
|
|
4363
|
-
var o, s, a, c, u, l, d, h, p,
|
|
4364
|
-
this._dataLayer =
|
|
4365
|
-
var m = new
|
|
4366
|
-
this._networkClient = new
|
|
4491
|
+
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4492
|
+
this._dataLayer = At(e, n), this._subscriptionService = new Bt(e, this._dataLayer);
|
|
4493
|
+
var m = new bt(this._dataLayer, "passwords");
|
|
4494
|
+
this._networkClient = new mt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4367
4495
|
var e, t, r, n;
|
|
4368
4496
|
return {
|
|
4369
|
-
stytch_member_id: null === (t = null === (e =
|
|
4370
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4497
|
+
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,
|
|
4498
|
+
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
|
|
4371
4499
|
};
|
|
4372
4500
|
});
|
|
4373
|
-
var v = new
|
|
4374
|
-
b = new
|
|
4375
|
-
g = new
|
|
4376
|
-
|
|
4501
|
+
var v = new ht(e, this._networkClient, this._dataLayer),
|
|
4502
|
+
b = new ft(v.getAsync()),
|
|
4503
|
+
g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4504
|
+
y = new _t(i.endpoints.clientsideServicesIframeURL);
|
|
4505
|
+
this.organization = new Ze(this._networkClient, this._subscriptionService), this.member = new $e(this._networkClient, this._subscriptionService), this.self = new $e(this._networkClient, this._subscriptionService), this.session = new et(this._networkClient, this._subscriptionService), this.magicLinks = new Je(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Qe(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4377
4506
|
publicToken: e,
|
|
4378
4507
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4379
4508
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4380
|
-
}, g), this.sso = new
|
|
4509
|
+
}, g), this.sso = new Xe(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "sso"), v.getAsync(), {
|
|
4381
4510
|
publicToken: e,
|
|
4382
4511
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4383
4512
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4384
|
-
}), this.discovery = new
|
|
4385
|
-
var k = new
|
|
4513
|
+
}), this.discovery = new tt(this._networkClient, this._subscriptionService), this.passwords = new nt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new it(this._networkClient, this._subscriptionService, g), this.totp = new ot(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new st(this._networkClient, this._subscriptionService, g), this.rbac = new at(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new ut(this._subscriptionService, this.session);
|
|
4514
|
+
var k = new gt(this._networkClient);
|
|
4386
4515
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4387
4516
|
name: "b2b_sdk_instance_instantiated",
|
|
4388
4517
|
details: {
|
|
@@ -4392,9 +4521,10 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4392
4521
|
}
|
|
4393
4522
|
});
|
|
4394
4523
|
(function (e, t) {
|
|
4395
|
-
Object.assign(e, _defineProperty({},
|
|
4524
|
+
Object.assign(e, _defineProperty({}, Ft, t));
|
|
4396
4525
|
})(this, {
|
|
4397
4526
|
bootstrap: v,
|
|
4527
|
+
clientsideServices: y,
|
|
4398
4528
|
publicToken: e,
|
|
4399
4529
|
searchManager: k,
|
|
4400
4530
|
dataLayer: this._dataLayer,
|
|
@@ -4402,70 +4532,70 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4402
4532
|
});
|
|
4403
4533
|
}
|
|
4404
4534
|
return _createClass(_class);
|
|
4405
|
-
}(), exports.StytchError =
|
|
4535
|
+
}(), exports.StytchError = T, exports.StytchSDKAPIError = x, exports.StytchSDKError = D, exports.StytchSDKSchemaError = P, exports.StytchSDKUsageError = S, exports.UNRECOVERABLE_ERROR_TYPES = C, exports.UserCancellationError = K, exports.UserLockedOutError = N, exports.errorToStytchError = function (e) {
|
|
4406
4536
|
switch (e.message) {
|
|
4407
4537
|
case "internal_error":
|
|
4408
|
-
return new
|
|
4538
|
+
return new R(e.message);
|
|
4409
4539
|
case "no_current_session":
|
|
4410
|
-
return new
|
|
4540
|
+
return new I();
|
|
4411
4541
|
case "no_biometrics_registration":
|
|
4412
|
-
return new
|
|
4542
|
+
return new B();
|
|
4413
4543
|
case "biometrics_unavailable":
|
|
4414
4544
|
case "device_hardware_error":
|
|
4415
4545
|
case "biometrics_not_available":
|
|
4416
|
-
return new
|
|
4546
|
+
return new F();
|
|
4417
4547
|
case "key_invalidated":
|
|
4418
4548
|
case "no_biometric_key":
|
|
4419
|
-
return new
|
|
4549
|
+
return new j();
|
|
4420
4550
|
case "no_biometrics_enrolled":
|
|
4421
4551
|
return new L();
|
|
4422
4552
|
case "keystore_unavailable":
|
|
4423
4553
|
return new M();
|
|
4424
4554
|
case "device_credentials_not_allowed":
|
|
4425
|
-
return new
|
|
4555
|
+
return new U();
|
|
4426
4556
|
case "user_cancellation":
|
|
4427
|
-
return new B();
|
|
4428
|
-
case "user_locked_out":
|
|
4429
4557
|
return new K();
|
|
4558
|
+
case "user_locked_out":
|
|
4559
|
+
return new N();
|
|
4430
4560
|
case "google_onetap_missing_id_token":
|
|
4431
4561
|
case "oauth_apple_missing_id_token":
|
|
4432
4562
|
case "missing_authorization_credential_id_token":
|
|
4433
|
-
return new
|
|
4563
|
+
return new W();
|
|
4434
4564
|
case "google_onetap_missing_member":
|
|
4435
4565
|
case "oauth_apple_credential_invalid":
|
|
4436
4566
|
case "invalid_authorization_credential":
|
|
4437
|
-
return new W();
|
|
4438
|
-
case "missing_public_key":
|
|
4439
4567
|
return new H();
|
|
4440
|
-
case "
|
|
4568
|
+
case "missing_public_key":
|
|
4441
4569
|
return new G();
|
|
4442
|
-
case "
|
|
4570
|
+
case "challenge_signing_failed":
|
|
4443
4571
|
return new V();
|
|
4444
|
-
case "
|
|
4572
|
+
case "sdk_not_configured":
|
|
4445
4573
|
return new Y();
|
|
4446
|
-
case "
|
|
4574
|
+
case "failed_code_challenge":
|
|
4447
4575
|
return new J();
|
|
4448
|
-
case "
|
|
4576
|
+
case "passkeys_unsupported":
|
|
4449
4577
|
return new $();
|
|
4450
|
-
case "
|
|
4578
|
+
case "failed_to_decrypt_data":
|
|
4451
4579
|
return new X();
|
|
4452
|
-
case "
|
|
4580
|
+
case "biometrics_failed":
|
|
4453
4581
|
return new Z();
|
|
4454
|
-
case "
|
|
4582
|
+
case "invalid_start_url":
|
|
4455
4583
|
return new Q();
|
|
4456
|
-
case "
|
|
4584
|
+
case "invalid_redirect_scheme":
|
|
4457
4585
|
return new ee();
|
|
4458
|
-
case "
|
|
4586
|
+
case "missing_url":
|
|
4459
4587
|
return new te();
|
|
4460
|
-
case "
|
|
4588
|
+
case "invalid_credential_type":
|
|
4461
4589
|
return new re();
|
|
4462
|
-
case "
|
|
4590
|
+
case "missing_attestation_object":
|
|
4463
4591
|
return new ne();
|
|
4464
|
-
case "
|
|
4592
|
+
case "json_data_not_convertible_to_string":
|
|
4465
4593
|
return new ie();
|
|
4466
|
-
case "
|
|
4594
|
+
case "random_number_generation_failed":
|
|
4467
4595
|
return new oe();
|
|
4596
|
+
case "passkeys_invalid_encoding":
|
|
4597
|
+
return new se();
|
|
4468
4598
|
default:
|
|
4469
|
-
return new
|
|
4599
|
+
return new D(e.name, e.message);
|
|
4470
4600
|
}
|
|
4471
4601
|
};
|