@stytch/vanilla-js 4.5.5 → 4.7.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 +23 -0
- package/dist/b2b/index.esm.js +5821 -4217
- package/dist/b2b/index.headless.esm.js +822 -674
- package/dist/b2b/index.headless.js +815 -671
- package/dist/b2b/index.js +5160 -3560
- package/dist/index.esm.js +4218 -4087
- package/dist/index.headless.esm.js +757 -738
- package/dist/index.headless.js +759 -744
- package/dist/index.js +4167 -4040
- package/package.json +10 -4
package/dist/index.headless.js
CHANGED
|
@@ -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, f, _, m, v;
|
|
137
|
+
var h, p, f, _, m, v, y;
|
|
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, (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";
|
|
141
|
-
var
|
|
142
|
-
g,
|
|
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", exports.RNUIProducts = void 0, (y = exports.RNUIProducts || (exports.RNUIProducts = {}))[y.emailMagicLinks = 0] = "emailMagicLinks", y[y.oauth = 1] = "oauth", y[y.otp = 2] = "otp", y[y.passwords = 3] = "passwords";
|
|
141
|
+
var g,
|
|
143
142
|
b,
|
|
144
|
-
k
|
|
143
|
+
k,
|
|
144
|
+
w,
|
|
145
|
+
S = function (e) {
|
|
145
146
|
function t(e, r) {
|
|
146
147
|
var n;
|
|
147
148
|
return i(this, t), (n = s(this, t, [e + "\n" + r])).message = e + "\n" + r, n.name = "SDKAPIUnreachableError", n.details = r, Object.setPrototypeOf(o(n), t.prototype), n;
|
|
148
149
|
}
|
|
149
150
|
return a(t, c(Error)), r(t);
|
|
150
151
|
}(),
|
|
151
|
-
|
|
152
|
+
x = function (e) {
|
|
152
153
|
function t(e, r) {
|
|
153
154
|
var n;
|
|
154
155
|
return i(this, t), (n = s(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 = s(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -166,7 +167,7 @@ var y,
|
|
|
166
167
|
}
|
|
167
168
|
return a(t, c(Error)), r(t);
|
|
168
169
|
}(),
|
|
169
|
-
|
|
170
|
+
O = function (e) {
|
|
170
171
|
function t(e) {
|
|
171
172
|
var r;
|
|
172
173
|
i(this, t), (r = s(this, t)).name = "StytchSDKAPIError";
|
|
@@ -180,21 +181,21 @@ var y,
|
|
|
180
181
|
return a(t, c(Error)), r(t);
|
|
181
182
|
}(),
|
|
182
183
|
C = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
183
|
-
|
|
184
|
+
T = function (e) {
|
|
184
185
|
function t(e, r) {
|
|
185
186
|
var n;
|
|
186
187
|
return i(this, t), (n = s(this, t, [r])).name = e, n;
|
|
187
188
|
}
|
|
188
189
|
return a(t, c(Error)), r(t);
|
|
189
190
|
}(),
|
|
190
|
-
|
|
191
|
+
A = function (e) {
|
|
191
192
|
function t(e) {
|
|
192
193
|
var r;
|
|
193
194
|
return i(this, t), r = s(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(o(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,9 +204,9 @@ var y,
|
|
|
203
204
|
}).join("\n");
|
|
204
205
|
return s(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
|
+
D = function (e) {
|
|
209
210
|
function t(e) {
|
|
210
211
|
var r;
|
|
211
212
|
i(this, t);
|
|
@@ -216,193 +217,205 @@ var y,
|
|
|
216
217
|
u = e.request_id;
|
|
217
218
|
return (r = s(this, t, ["StytchAPIError", "[".concat(n, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : "")])).error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = n, r;
|
|
218
219
|
}
|
|
219
|
-
return a(t,
|
|
220
|
+
return a(t, T), r(t);
|
|
220
221
|
}(),
|
|
221
|
-
|
|
222
|
+
R = function (e) {
|
|
222
223
|
function t(e, r, n) {
|
|
223
224
|
var o;
|
|
224
225
|
return i(this, t), (o = s(this, t, [e, r])).options = n, o;
|
|
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), s(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, R), r(t);
|
|
233
234
|
}(),
|
|
234
|
-
|
|
235
|
+
F = function (e) {
|
|
235
236
|
function t(e) {
|
|
236
237
|
return i(this, t), s(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, R), r(t);
|
|
239
240
|
}(),
|
|
240
|
-
|
|
241
|
+
j = function (e) {
|
|
241
242
|
function t() {
|
|
242
243
|
return i(this, t), s(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, R), r(t);
|
|
245
246
|
}(),
|
|
246
|
-
|
|
247
|
+
B = function (e) {
|
|
247
248
|
function t() {
|
|
248
249
|
return i(this, t), s(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
249
250
|
}
|
|
250
|
-
return a(t,
|
|
251
|
+
return a(t, R), r(t);
|
|
251
252
|
}(),
|
|
252
|
-
|
|
253
|
+
L = function (e) {
|
|
253
254
|
function t() {
|
|
254
255
|
return i(this, t), s(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
255
256
|
}
|
|
256
|
-
return a(t,
|
|
257
|
+
return a(t, R), r(t);
|
|
257
258
|
}(),
|
|
258
|
-
|
|
259
|
+
M = function (e) {
|
|
259
260
|
function t() {
|
|
260
261
|
return i(this, t), s(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, R), r(t);
|
|
263
264
|
}(),
|
|
264
|
-
|
|
265
|
+
U = function (e) {
|
|
265
266
|
function t() {
|
|
266
267
|
return i(this, t), s(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, R), r(t);
|
|
269
270
|
}(),
|
|
270
|
-
|
|
271
|
+
N = function (e) {
|
|
271
272
|
function t() {
|
|
272
273
|
return i(this, t), s(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
273
274
|
}
|
|
274
|
-
return a(t,
|
|
275
|
+
return a(t, R), r(t);
|
|
275
276
|
}(),
|
|
276
|
-
|
|
277
|
+
K = function (e) {
|
|
277
278
|
function t() {
|
|
278
279
|
return i(this, t), s(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, R), r(t);
|
|
281
282
|
}(),
|
|
282
|
-
|
|
283
|
+
q = function (e) {
|
|
283
284
|
function t() {
|
|
284
285
|
return i(this, t), s(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, R), r(t);
|
|
287
288
|
}(),
|
|
288
|
-
|
|
289
|
+
W = function (e) {
|
|
289
290
|
function t() {
|
|
290
291
|
return i(this, t), s(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
291
292
|
}
|
|
292
|
-
return a(t,
|
|
293
|
+
return a(t, R), r(t);
|
|
293
294
|
}(),
|
|
294
|
-
|
|
295
|
+
G = function (e) {
|
|
295
296
|
function t() {
|
|
296
297
|
return i(this, t), s(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, R), r(t);
|
|
299
300
|
}(),
|
|
300
|
-
|
|
301
|
+
H = function (e) {
|
|
301
302
|
function t() {
|
|
302
303
|
return i(this, t), s(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
303
304
|
}
|
|
304
|
-
return a(t,
|
|
305
|
+
return a(t, R), r(t);
|
|
305
306
|
}(),
|
|
306
|
-
|
|
307
|
+
z = function (e) {
|
|
307
308
|
function t() {
|
|
308
309
|
return i(this, t), s(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, R), r(t);
|
|
311
312
|
}(),
|
|
312
|
-
|
|
313
|
+
V = function (e) {
|
|
313
314
|
function t() {
|
|
314
315
|
return i(this, t), s(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
315
316
|
}
|
|
316
|
-
return a(t,
|
|
317
|
+
return a(t, R), r(t);
|
|
317
318
|
}(),
|
|
318
|
-
|
|
319
|
+
Y = function (e) {
|
|
319
320
|
function t() {
|
|
320
321
|
return i(this, t), s(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
321
322
|
}
|
|
322
|
-
return a(t,
|
|
323
|
+
return a(t, R), r(t);
|
|
323
324
|
}(),
|
|
324
|
-
|
|
325
|
+
J = function (e) {
|
|
325
326
|
function t() {
|
|
326
327
|
return i(this, t), s(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, R), r(t);
|
|
329
330
|
}(),
|
|
330
|
-
|
|
331
|
+
$ = function (e) {
|
|
331
332
|
function t() {
|
|
332
333
|
return i(this, t), s(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
333
334
|
}
|
|
334
|
-
return a(t,
|
|
335
|
+
return a(t, R), r(t);
|
|
335
336
|
}(),
|
|
336
|
-
|
|
337
|
+
X = function (e) {
|
|
337
338
|
function t() {
|
|
338
339
|
return i(this, t), s(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
339
340
|
}
|
|
340
|
-
return a(t,
|
|
341
|
+
return a(t, R), r(t);
|
|
341
342
|
}(),
|
|
342
|
-
|
|
343
|
+
Z = function (e) {
|
|
343
344
|
function t() {
|
|
344
345
|
return i(this, t), s(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
345
346
|
}
|
|
346
|
-
return a(t,
|
|
347
|
+
return a(t, R), r(t);
|
|
347
348
|
}(),
|
|
348
|
-
|
|
349
|
+
Q = function (e) {
|
|
349
350
|
function t() {
|
|
350
351
|
return i(this, t), s(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
351
352
|
}
|
|
352
|
-
return a(t,
|
|
353
|
+
return a(t, R), r(t);
|
|
353
354
|
}(),
|
|
354
|
-
|
|
355
|
+
ee = function (e) {
|
|
355
356
|
function t() {
|
|
356
357
|
return i(this, t), s(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
357
358
|
}
|
|
358
|
-
return a(t,
|
|
359
|
+
return a(t, R), r(t);
|
|
359
360
|
}(),
|
|
360
|
-
|
|
361
|
+
te = function (e) {
|
|
361
362
|
function t() {
|
|
362
363
|
return i(this, t), s(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, R), r(t);
|
|
365
366
|
}(),
|
|
366
|
-
|
|
367
|
+
re = function (e) {
|
|
367
368
|
function t() {
|
|
368
369
|
return i(this, t), s(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
369
370
|
}
|
|
370
|
-
return a(t,
|
|
371
|
+
return a(t, R), r(t);
|
|
371
372
|
}(),
|
|
372
|
-
|
|
373
|
+
ne = function (e) {
|
|
373
374
|
function t() {
|
|
374
375
|
return i(this, t), s(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
375
376
|
}
|
|
376
|
-
return a(t,
|
|
377
|
+
return a(t, R), r(t);
|
|
377
378
|
}(),
|
|
378
|
-
|
|
379
|
+
ie = function (e) {
|
|
379
380
|
function t() {
|
|
380
381
|
return i(this, t), s(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
381
382
|
}
|
|
382
|
-
return a(t,
|
|
383
|
+
return a(t, R), r(t);
|
|
383
384
|
}(),
|
|
384
|
-
|
|
385
|
+
se = function (e) {
|
|
385
386
|
function t() {
|
|
386
387
|
return i(this, t), s(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
387
388
|
}
|
|
388
|
-
return a(t,
|
|
389
|
+
return a(t, R), r(t);
|
|
389
390
|
}(),
|
|
390
|
-
|
|
391
|
+
oe = function (e) {
|
|
391
392
|
function t() {
|
|
392
393
|
return i(this, t), s(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
393
394
|
}
|
|
394
|
-
return a(t,
|
|
395
|
+
return a(t, R), r(t);
|
|
395
396
|
}(),
|
|
396
|
-
|
|
397
|
+
ae = function (e) {
|
|
397
398
|
function t() {
|
|
398
399
|
return i(this, t), s(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
399
400
|
}
|
|
400
|
-
return a(t,
|
|
401
|
+
return a(t, R), r(t);
|
|
402
|
+
}(),
|
|
403
|
+
ce = function (e) {
|
|
404
|
+
function t() {
|
|
405
|
+
return i(this, t), s(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
406
|
+
}
|
|
407
|
+
return a(t, R), r(t);
|
|
408
|
+
}(),
|
|
409
|
+
ue = function (e) {
|
|
410
|
+
function t() {
|
|
411
|
+
return i(this, t), s(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
412
|
+
}
|
|
413
|
+
return a(t, R), r(t);
|
|
401
414
|
}();
|
|
402
|
-
function
|
|
415
|
+
function le(e, t) {
|
|
403
416
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
404
417
|
if (!r) {
|
|
405
|
-
if (Array.isArray(e) || (r =
|
|
418
|
+
if (Array.isArray(e) || (r = he(e)) || t && e && "number" == typeof e.length) {
|
|
406
419
|
r && (e = r);
|
|
407
420
|
var _n = 0,
|
|
408
421
|
i = function i() {};
|
|
@@ -447,7 +460,7 @@ function oe(e, t) {
|
|
|
447
460
|
}
|
|
448
461
|
};
|
|
449
462
|
}
|
|
450
|
-
function
|
|
463
|
+
function de(e, t) {
|
|
451
464
|
return function (e) {
|
|
452
465
|
if (Array.isArray(e)) return e;
|
|
453
466
|
}(e) || function (e, t) {
|
|
@@ -476,32 +489,32 @@ function ae(e, t) {
|
|
|
476
489
|
}
|
|
477
490
|
return a;
|
|
478
491
|
}
|
|
479
|
-
}(e, t) ||
|
|
492
|
+
}(e, t) || he(e, t) || function () {
|
|
480
493
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
481
494
|
}();
|
|
482
495
|
}
|
|
483
|
-
function
|
|
496
|
+
function he(e, t) {
|
|
484
497
|
if (e) {
|
|
485
|
-
if ("string" == typeof e) return
|
|
498
|
+
if ("string" == typeof e) return pe(e, t);
|
|
486
499
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
487
|
-
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) ?
|
|
500
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? pe(e, t) : void 0;
|
|
488
501
|
}
|
|
489
502
|
}
|
|
490
|
-
function
|
|
503
|
+
function pe(e, t) {
|
|
491
504
|
(null == t || t > e.length) && (t = e.length);
|
|
492
505
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
493
506
|
return n;
|
|
494
507
|
}
|
|
495
|
-
function
|
|
496
|
-
return
|
|
508
|
+
function fe(e) {
|
|
509
|
+
return fe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
497
510
|
return _typeof(e);
|
|
498
511
|
} : function (e) {
|
|
499
512
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
500
|
-
},
|
|
513
|
+
}, fe(e);
|
|
501
514
|
}
|
|
502
|
-
function
|
|
515
|
+
function _e() {
|
|
503
516
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
504
|
-
|
|
517
|
+
_e = function _e() {
|
|
505
518
|
return t;
|
|
506
519
|
};
|
|
507
520
|
var e,
|
|
@@ -535,7 +548,7 @@ function de() {
|
|
|
535
548
|
o = Object.create(s.prototype),
|
|
536
549
|
a = new E(n || []);
|
|
537
550
|
return i(o, "_invoke", {
|
|
538
|
-
value:
|
|
551
|
+
value: O(e, r, a)
|
|
539
552
|
}), o;
|
|
540
553
|
}
|
|
541
554
|
function d(e, t, r) {
|
|
@@ -575,13 +588,13 @@ function de() {
|
|
|
575
588
|
});
|
|
576
589
|
});
|
|
577
590
|
}
|
|
578
|
-
function
|
|
591
|
+
function P(e, t) {
|
|
579
592
|
function r(i, s, o, a) {
|
|
580
593
|
var c = d(e[i], e, s);
|
|
581
594
|
if ("throw" !== c.type) {
|
|
582
595
|
var u = c.arg,
|
|
583
596
|
l = u.value;
|
|
584
|
-
return l && "object" ==
|
|
597
|
+
return l && "object" == fe(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
585
598
|
r("next", e, o, a);
|
|
586
599
|
}, function (e) {
|
|
587
600
|
r("throw", e, o, a);
|
|
@@ -605,7 +618,7 @@ function de() {
|
|
|
605
618
|
}
|
|
606
619
|
});
|
|
607
620
|
}
|
|
608
|
-
function
|
|
621
|
+
function O(t, r, n) {
|
|
609
622
|
var i = h;
|
|
610
623
|
return function (s, o) {
|
|
611
624
|
if (i === f) throw new Error("Generator is already running");
|
|
@@ -619,7 +632,7 @@ function de() {
|
|
|
619
632
|
for (n.method = s, n.arg = o;;) {
|
|
620
633
|
var a = n.delegate;
|
|
621
634
|
if (a) {
|
|
622
|
-
var c =
|
|
635
|
+
var c = C(a, n);
|
|
623
636
|
if (c) {
|
|
624
637
|
if (c === m) continue;
|
|
625
638
|
return c;
|
|
@@ -642,29 +655,29 @@ function de() {
|
|
|
642
655
|
}
|
|
643
656
|
};
|
|
644
657
|
}
|
|
645
|
-
function
|
|
658
|
+
function C(t, r) {
|
|
646
659
|
var n = r.method,
|
|
647
660
|
i = t.iterator[n];
|
|
648
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
661
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, C(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
649
662
|
var s = d(i, t.iterator, r.arg);
|
|
650
663
|
if ("throw" === s.type) return r.method = "throw", r.arg = s.arg, r.delegate = null, m;
|
|
651
664
|
var o = s.arg;
|
|
652
665
|
return o ? o.done ? (r[t.resultName] = o.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, m) : o : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, m);
|
|
653
666
|
}
|
|
654
|
-
function
|
|
667
|
+
function T(e) {
|
|
655
668
|
var t = {
|
|
656
669
|
tryLoc: e[0]
|
|
657
670
|
};
|
|
658
671
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
659
672
|
}
|
|
660
|
-
function
|
|
673
|
+
function A(e) {
|
|
661
674
|
var t = e.completion || {};
|
|
662
675
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
663
676
|
}
|
|
664
677
|
function E(e) {
|
|
665
678
|
this.tryEntries = [{
|
|
666
679
|
tryLoc: "root"
|
|
667
|
-
}], e.forEach(
|
|
680
|
+
}], e.forEach(T, this), this.reset(!0);
|
|
668
681
|
}
|
|
669
682
|
function D(t) {
|
|
670
683
|
if (t || "" === t) {
|
|
@@ -680,7 +693,7 @@ function de() {
|
|
|
680
693
|
return s.next = s;
|
|
681
694
|
}
|
|
682
695
|
}
|
|
683
|
-
throw new TypeError(
|
|
696
|
+
throw new TypeError(fe(t) + " is not iterable");
|
|
684
697
|
}
|
|
685
698
|
return y.prototype = g, i(S, "constructor", {
|
|
686
699
|
value: g,
|
|
@@ -697,11 +710,11 @@ function de() {
|
|
|
697
710
|
return {
|
|
698
711
|
__await: e
|
|
699
712
|
};
|
|
700
|
-
}, x(
|
|
713
|
+
}, x(P.prototype), u(P.prototype, a, function () {
|
|
701
714
|
return this;
|
|
702
|
-
}), t.AsyncIterator =
|
|
715
|
+
}), t.AsyncIterator = P, t.async = function (e, r, n, i, s) {
|
|
703
716
|
void 0 === s && (s = Promise);
|
|
704
|
-
var o = new
|
|
717
|
+
var o = new P(l(e, r, n, i), s);
|
|
705
718
|
return t.isGeneratorFunction(r) ? o : o.next().then(function (e) {
|
|
706
719
|
return e.done ? e.value : o.next();
|
|
707
720
|
});
|
|
@@ -723,7 +736,7 @@ function de() {
|
|
|
723
736
|
}, t.values = D, E.prototype = {
|
|
724
737
|
constructor: E,
|
|
725
738
|
reset: function reset(t) {
|
|
726
|
-
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(
|
|
739
|
+
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(A), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
727
740
|
},
|
|
728
741
|
stop: function stop() {
|
|
729
742
|
this.done = !0;
|
|
@@ -775,7 +788,7 @@ function de() {
|
|
|
775
788
|
finish: function finish(e) {
|
|
776
789
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
777
790
|
var r = this.tryEntries[t];
|
|
778
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
791
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), A(r), m;
|
|
779
792
|
}
|
|
780
793
|
},
|
|
781
794
|
"catch": function _catch(e) {
|
|
@@ -785,7 +798,7 @@ function de() {
|
|
|
785
798
|
var n = r.completion;
|
|
786
799
|
if ("throw" === n.type) {
|
|
787
800
|
var i = n.arg;
|
|
788
|
-
|
|
801
|
+
A(r);
|
|
789
802
|
}
|
|
790
803
|
return i;
|
|
791
804
|
}
|
|
@@ -801,46 +814,46 @@ function de() {
|
|
|
801
814
|
}
|
|
802
815
|
}, t;
|
|
803
816
|
}
|
|
804
|
-
function
|
|
817
|
+
function me(e, t) {
|
|
805
818
|
for (var r = 0; r < t.length; r++) {
|
|
806
819
|
var n = t[r];
|
|
807
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
820
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, ye(n.key), n);
|
|
808
821
|
}
|
|
809
822
|
}
|
|
810
|
-
function
|
|
811
|
-
return t &&
|
|
823
|
+
function ve(e, t, r) {
|
|
824
|
+
return t && me(e.prototype, t), r && me(e, r), Object.defineProperty(e, "prototype", {
|
|
812
825
|
writable: !1
|
|
813
826
|
}), e;
|
|
814
827
|
}
|
|
815
|
-
function
|
|
828
|
+
function ye(e) {
|
|
816
829
|
var t = function (e, t) {
|
|
817
|
-
if ("object" !=
|
|
830
|
+
if ("object" != fe(e) || !e) return e;
|
|
818
831
|
var r = e[Symbol.toPrimitive];
|
|
819
832
|
if (void 0 !== r) {
|
|
820
833
|
var n = r.call(e, t || "default");
|
|
821
|
-
if ("object" !=
|
|
834
|
+
if ("object" != fe(n)) return n;
|
|
822
835
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
823
836
|
}
|
|
824
837
|
return ("string" === t ? String : Number)(e);
|
|
825
838
|
}(e, "string");
|
|
826
|
-
return "symbol" ==
|
|
839
|
+
return "symbol" == fe(t) ? t : String(t);
|
|
827
840
|
}
|
|
828
|
-
function
|
|
841
|
+
function ge(e, t) {
|
|
829
842
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
830
843
|
}
|
|
831
|
-
function
|
|
832
|
-
return t =
|
|
833
|
-
if (t && ("object" ===
|
|
844
|
+
function be(e, t, r) {
|
|
845
|
+
return t = xe(t), function (e, t) {
|
|
846
|
+
if (t && ("object" === fe(t) || "function" == typeof t)) return t;
|
|
834
847
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
835
848
|
return function (e) {
|
|
836
849
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
837
850
|
return e;
|
|
838
851
|
}(e);
|
|
839
|
-
}(e,
|
|
852
|
+
}(e, we() ? Reflect.construct(t, r || [], xe(e).constructor) : t.apply(e, r));
|
|
840
853
|
}
|
|
841
|
-
function
|
|
854
|
+
function ke(e) {
|
|
842
855
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
843
|
-
return
|
|
856
|
+
return ke = function ke(e) {
|
|
844
857
|
if (null === e || !function (e) {
|
|
845
858
|
try {
|
|
846
859
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -855,12 +868,12 @@ function ve(e) {
|
|
|
855
868
|
}
|
|
856
869
|
function r() {
|
|
857
870
|
return function (e, t, r) {
|
|
858
|
-
if (
|
|
871
|
+
if (we()) return Reflect.construct.apply(null, arguments);
|
|
859
872
|
var n = [null];
|
|
860
873
|
n.push.apply(n, t);
|
|
861
874
|
var i = new (e.bind.apply(e, n))();
|
|
862
|
-
return r &&
|
|
863
|
-
}(e, arguments,
|
|
875
|
+
return r && Se(i, r.prototype), i;
|
|
876
|
+
}(e, arguments, xe(this).constructor);
|
|
864
877
|
}
|
|
865
878
|
return r.prototype = Object.create(e.prototype, {
|
|
866
879
|
constructor: {
|
|
@@ -869,32 +882,32 @@ function ve(e) {
|
|
|
869
882
|
writable: !0,
|
|
870
883
|
configurable: !0
|
|
871
884
|
}
|
|
872
|
-
}),
|
|
873
|
-
},
|
|
885
|
+
}), Se(r, e);
|
|
886
|
+
}, ke(e);
|
|
874
887
|
}
|
|
875
|
-
function
|
|
888
|
+
function we() {
|
|
876
889
|
try {
|
|
877
890
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
878
891
|
} catch (e) {}
|
|
879
|
-
return (
|
|
892
|
+
return (we = function we() {
|
|
880
893
|
return !!e;
|
|
881
894
|
})();
|
|
882
895
|
}
|
|
883
|
-
function
|
|
884
|
-
return
|
|
896
|
+
function Se(e, t) {
|
|
897
|
+
return Se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
885
898
|
return e.__proto__ = t, e;
|
|
886
|
-
},
|
|
899
|
+
}, Se(e, t);
|
|
887
900
|
}
|
|
888
|
-
function
|
|
889
|
-
return
|
|
901
|
+
function xe(e) {
|
|
902
|
+
return xe = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
890
903
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
891
|
-
},
|
|
904
|
+
}, xe(e);
|
|
892
905
|
}
|
|
893
|
-
exports.B2BProducts = void 0, (
|
|
894
|
-
var
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
function
|
|
906
|
+
exports.B2BProducts = void 0, (g = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", g.sso = "sso", g.passwords = "passwords", g.oauth = "oauth", exports.AuthFlowType = void 0, (b = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", b.Organization = "Organization", b.PasswordReset = "PasswordReset", exports.B2BMFAProducts = void 0, (k = exports.B2BMFAProducts || (exports.B2BMFAProducts = {})).smsOtp = "smsOtp", k.totp = "totp", exports.B2BOAuthProviders = void 0, (w = exports.B2BOAuthProviders || (exports.B2BOAuthProviders = {})).Google = "google", w.Microsoft = "microsoft";
|
|
907
|
+
var Pe,
|
|
908
|
+
Oe = "https://accounts.google.com/gsi",
|
|
909
|
+
Ce = "".concat(Oe, "/client");
|
|
910
|
+
function Te(e, t) {
|
|
898
911
|
var r = {};
|
|
899
912
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
900
913
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -903,7 +916,7 @@ function xe(e, t) {
|
|
|
903
916
|
}
|
|
904
917
|
return r;
|
|
905
918
|
}
|
|
906
|
-
function
|
|
919
|
+
function Ae(e, t, r, n) {
|
|
907
920
|
return new (r || (r = Promise))(function (i, s) {
|
|
908
921
|
function o(e) {
|
|
909
922
|
try {
|
|
@@ -930,12 +943,12 @@ function Ce(e, t, r, n) {
|
|
|
930
943
|
}
|
|
931
944
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
932
945
|
e.RequiredCatcha = "Catcha Required";
|
|
933
|
-
}(
|
|
934
|
-
var
|
|
935
|
-
|
|
946
|
+
}(Pe || (Pe = {}));
|
|
947
|
+
var Ee,
|
|
948
|
+
De = function (e) {
|
|
936
949
|
function t(e) {
|
|
937
950
|
var r;
|
|
938
|
-
return
|
|
951
|
+
return ge(this, t), (r = be(this, t, [e])).type = e, r;
|
|
939
952
|
}
|
|
940
953
|
return function (e, t) {
|
|
941
954
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -947,10 +960,10 @@ var Pe,
|
|
|
947
960
|
}
|
|
948
961
|
}), Object.defineProperty(e, "prototype", {
|
|
949
962
|
writable: !1
|
|
950
|
-
}), t &&
|
|
951
|
-
}(t,
|
|
963
|
+
}), t && Se(e, t);
|
|
964
|
+
}(t, ke(Error)), ve(t);
|
|
952
965
|
}();
|
|
953
|
-
function
|
|
966
|
+
function Re(e) {
|
|
954
967
|
var t,
|
|
955
968
|
r = e.method,
|
|
956
969
|
n = e.finalURL,
|
|
@@ -958,9 +971,9 @@ function Ae(e) {
|
|
|
958
971
|
s = e.xSDKClientHeader,
|
|
959
972
|
o = e.xSDKParentHostHeader,
|
|
960
973
|
a = e.body;
|
|
961
|
-
return
|
|
974
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
962
975
|
var c, u, l, d, h, p;
|
|
963
|
-
return
|
|
976
|
+
return _e().wrap(function (e) {
|
|
964
977
|
for (;;) switch (e.prev = e.next) {
|
|
965
978
|
case 0:
|
|
966
979
|
return c = {
|
|
@@ -980,7 +993,7 @@ function Ae(e) {
|
|
|
980
993
|
e.next = 13;
|
|
981
994
|
break;
|
|
982
995
|
}
|
|
983
|
-
throw new
|
|
996
|
+
throw new A("Unable to contact the Stytch servers. Are you online?");
|
|
984
997
|
case 13:
|
|
985
998
|
throw e.t0;
|
|
986
999
|
case 14:
|
|
@@ -992,7 +1005,7 @@ function Ae(e) {
|
|
|
992
1005
|
case 18:
|
|
993
1006
|
return d = e.sent, e.abrupt("return", d.data);
|
|
994
1007
|
case 22:
|
|
995
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
1008
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new A("Invalid JSON response from the Stytch servers.");
|
|
996
1009
|
case 25:
|
|
997
1010
|
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
998
1011
|
e.next = 38;
|
|
@@ -1003,30 +1016,30 @@ function Ae(e) {
|
|
|
1003
1016
|
h = e.sent, e.next = 35;
|
|
1004
1017
|
break;
|
|
1005
1018
|
case 32:
|
|
1006
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
1019
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new A("Invalid or no response from server");
|
|
1007
1020
|
case 35:
|
|
1008
1021
|
if (!("body" in h || "params" in h || "query" in h)) {
|
|
1009
1022
|
e.next = 37;
|
|
1010
1023
|
break;
|
|
1011
1024
|
}
|
|
1012
|
-
throw new
|
|
1025
|
+
throw new E(h);
|
|
1013
1026
|
case 37:
|
|
1014
|
-
throw new
|
|
1027
|
+
throw new D(h);
|
|
1015
1028
|
case 38:
|
|
1016
1029
|
return e.prev = 38, e.next = 41, l.text();
|
|
1017
1030
|
case 41:
|
|
1018
1031
|
p = e.sent, e.next = 47;
|
|
1019
1032
|
break;
|
|
1020
1033
|
case 44:
|
|
1021
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
1034
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new A("Invalid response from the Stytch servers.");
|
|
1022
1035
|
case 47:
|
|
1023
1036
|
if (!p.includes("Captcha required")) {
|
|
1024
1037
|
e.next = 49;
|
|
1025
1038
|
break;
|
|
1026
1039
|
}
|
|
1027
|
-
throw new
|
|
1040
|
+
throw new De(Pe.RequiredCatcha);
|
|
1028
1041
|
case 49:
|
|
1029
|
-
throw new
|
|
1042
|
+
throw new A("Invalid response from the Stytch servers.");
|
|
1030
1043
|
case 50:
|
|
1031
1044
|
case "end":
|
|
1032
1045
|
return e.stop();
|
|
@@ -1034,43 +1047,43 @@ function Ae(e) {
|
|
|
1034
1047
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
1035
1048
|
}));
|
|
1036
1049
|
}
|
|
1037
|
-
var
|
|
1038
|
-
function
|
|
1039
|
-
if (!
|
|
1040
|
-
return
|
|
1050
|
+
var Ie = new Uint8Array(16);
|
|
1051
|
+
function Fe() {
|
|
1052
|
+
if (!Ee && !(Ee = "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");
|
|
1053
|
+
return Ee(Ie);
|
|
1041
1054
|
}
|
|
1042
|
-
var
|
|
1043
|
-
for (var
|
|
1044
|
-
function
|
|
1055
|
+
var je = /^(?:[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;
|
|
1056
|
+
for (var Be = [], Le = 0; Le < 256; ++Le) Be.push((Le + 256).toString(16).substr(1));
|
|
1057
|
+
function Me(e) {
|
|
1045
1058
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
1046
|
-
r = (
|
|
1059
|
+
r = (Be[e[t + 0]] + Be[e[t + 1]] + Be[e[t + 2]] + Be[e[t + 3]] + "-" + Be[e[t + 4]] + Be[e[t + 5]] + "-" + Be[e[t + 6]] + Be[e[t + 7]] + "-" + Be[e[t + 8]] + Be[e[t + 9]] + "-" + Be[e[t + 10]] + Be[e[t + 11]] + Be[e[t + 12]] + Be[e[t + 13]] + Be[e[t + 14]] + Be[e[t + 15]]).toLowerCase();
|
|
1047
1060
|
if (!function (e) {
|
|
1048
|
-
return "string" == typeof e &&
|
|
1061
|
+
return "string" == typeof e && je.test(e);
|
|
1049
1062
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
1050
1063
|
return r;
|
|
1051
1064
|
}
|
|
1052
|
-
function
|
|
1053
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1065
|
+
function Ue(e, t, r) {
|
|
1066
|
+
var n = (e = e || {}).random || (e.rng || Fe)();
|
|
1054
1067
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
1055
1068
|
r = r || 0;
|
|
1056
1069
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
1057
1070
|
return t;
|
|
1058
1071
|
}
|
|
1059
|
-
return
|
|
1072
|
+
return Me(n);
|
|
1060
1073
|
}
|
|
1061
|
-
var
|
|
1062
|
-
function
|
|
1063
|
-
return
|
|
1064
|
-
return
|
|
1074
|
+
var Ne = {};
|
|
1075
|
+
function Ke(e, t) {
|
|
1076
|
+
return Ae(this, void 0, void 0, _e().mark(function r() {
|
|
1077
|
+
return _e().wrap(function (r) {
|
|
1065
1078
|
for (;;) switch (r.prev = r.next) {
|
|
1066
1079
|
case 0:
|
|
1067
|
-
if (void 0 ===
|
|
1080
|
+
if (void 0 === Ne[e]) {
|
|
1068
1081
|
r.next = 2;
|
|
1069
1082
|
break;
|
|
1070
1083
|
}
|
|
1071
|
-
return r.abrupt("return",
|
|
1084
|
+
return r.abrupt("return", Ne[e]);
|
|
1072
1085
|
case 2:
|
|
1073
|
-
return
|
|
1086
|
+
return Ne[e] = qe(e, t), r.abrupt("return", Ne[e]);
|
|
1074
1087
|
case 4:
|
|
1075
1088
|
case "end":
|
|
1076
1089
|
return r.stop();
|
|
@@ -1078,10 +1091,10 @@ function Be(e, t) {
|
|
|
1078
1091
|
}, r);
|
|
1079
1092
|
}));
|
|
1080
1093
|
}
|
|
1081
|
-
function
|
|
1094
|
+
function qe(e, t) {
|
|
1082
1095
|
return new Promise(function (r, n) {
|
|
1083
1096
|
var i = function (e) {
|
|
1084
|
-
var t =
|
|
1097
|
+
var t = We(e);
|
|
1085
1098
|
if (t[0]) return t[0];
|
|
1086
1099
|
}(e);
|
|
1087
1100
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1105,44 +1118,44 @@ function Me(e, t) {
|
|
|
1105
1118
|
});
|
|
1106
1119
|
});
|
|
1107
1120
|
}
|
|
1108
|
-
var
|
|
1121
|
+
var We = function We(e) {
|
|
1109
1122
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1110
1123
|
};
|
|
1111
|
-
var
|
|
1112
|
-
|
|
1113
|
-
|
|
1124
|
+
var Ge,
|
|
1125
|
+
He = ["[Stytch]"],
|
|
1126
|
+
ze = function ze() {
|
|
1114
1127
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1115
|
-
return (e = console).warn.apply(e,
|
|
1128
|
+
return (e = console).warn.apply(e, He.concat(r));
|
|
1116
1129
|
},
|
|
1117
|
-
|
|
1130
|
+
Ve = function Ve() {
|
|
1118
1131
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1119
|
-
return (e = console).error.apply(e,
|
|
1132
|
+
return (e = console).error.apply(e, He.concat(r));
|
|
1120
1133
|
},
|
|
1121
|
-
|
|
1122
|
-
|
|
1134
|
+
Ye = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1135
|
+
Je = function Je(e) {
|
|
1123
1136
|
var t = {
|
|
1124
1137
|
isObject: function isObject(r, n) {
|
|
1125
|
-
var i = "object" ===
|
|
1126
|
-
if (!i) throw new
|
|
1138
|
+
var i = "object" === fe(n) && !Array.isArray(n) && null !== n;
|
|
1139
|
+
if (!i) throw new x(e, r + " must be an object.");
|
|
1127
1140
|
return t;
|
|
1128
1141
|
},
|
|
1129
1142
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1130
1143
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1131
1144
|
},
|
|
1132
1145
|
isString: function isString(r, n) {
|
|
1133
|
-
if ("string" != typeof n) throw new
|
|
1146
|
+
if ("string" != typeof n) throw new x(e, r + " must be a string.");
|
|
1134
1147
|
return t;
|
|
1135
1148
|
},
|
|
1136
1149
|
isOptionalString: function isOptionalString(e, r) {
|
|
1137
1150
|
return void 0 === r ? t : t.isString(e, r);
|
|
1138
1151
|
},
|
|
1139
1152
|
isStringArray: function isStringArray(r, n) {
|
|
1140
|
-
if (!Array.isArray(n)) throw new
|
|
1153
|
+
if (!Array.isArray(n)) throw new x(e, r + " must be an array of strings.");
|
|
1141
1154
|
var i,
|
|
1142
|
-
s =
|
|
1155
|
+
s = le(n);
|
|
1143
1156
|
try {
|
|
1144
1157
|
for (s.s(); !(i = s.n()).done;) {
|
|
1145
|
-
if ("string" != typeof i.value) throw new
|
|
1158
|
+
if ("string" != typeof i.value) throw new x(e, r + " must be an array of strings.");
|
|
1146
1159
|
}
|
|
1147
1160
|
} catch (e) {
|
|
1148
1161
|
s.e(e);
|
|
@@ -1155,14 +1168,14 @@ var Ne,
|
|
|
1155
1168
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1156
1169
|
},
|
|
1157
1170
|
isNumber: function isNumber(r, n) {
|
|
1158
|
-
if ("number" != typeof n) throw new
|
|
1171
|
+
if ("number" != typeof n) throw new x(e, r + " must be a number.");
|
|
1159
1172
|
return t;
|
|
1160
1173
|
},
|
|
1161
1174
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1162
1175
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1163
1176
|
},
|
|
1164
1177
|
isBoolean: function isBoolean(r, n) {
|
|
1165
|
-
if ("boolean" != typeof n) throw new
|
|
1178
|
+
if ("boolean" != typeof n) throw new x(e, r + " must be a boolean.");
|
|
1166
1179
|
return t;
|
|
1167
1180
|
},
|
|
1168
1181
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1171,20 +1184,20 @@ var Ne,
|
|
|
1171
1184
|
};
|
|
1172
1185
|
return t;
|
|
1173
1186
|
},
|
|
1174
|
-
|
|
1175
|
-
return
|
|
1187
|
+
$e = function $e(e) {
|
|
1188
|
+
return Te(e, ["request_id", "status_code"]);
|
|
1176
1189
|
},
|
|
1177
|
-
|
|
1178
|
-
return
|
|
1190
|
+
Xe = function Xe(e) {
|
|
1191
|
+
return Te(e, ["__user"]);
|
|
1179
1192
|
},
|
|
1180
|
-
|
|
1193
|
+
Ze = ve(function e(t, r, n) {
|
|
1181
1194
|
var i = this,
|
|
1182
1195
|
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1183
1196
|
return Promise.resolve(void 0);
|
|
1184
1197
|
};
|
|
1185
|
-
|
|
1186
|
-
return
|
|
1187
|
-
return
|
|
1198
|
+
ge(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1199
|
+
return Ae(i, void 0, void 0, _e().mark(function e() {
|
|
1200
|
+
return _e().wrap(function (e) {
|
|
1188
1201
|
for (;;) switch (e.prev = e.next) {
|
|
1189
1202
|
case 0:
|
|
1190
1203
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1197,9 +1210,9 @@ var Ne,
|
|
|
1197
1210
|
}, e, this);
|
|
1198
1211
|
}));
|
|
1199
1212
|
}, this.getTelemetryID = function () {
|
|
1200
|
-
return
|
|
1213
|
+
return Ae(i, void 0, void 0, _e().mark(function e() {
|
|
1201
1214
|
var t, r, n, i;
|
|
1202
|
-
return
|
|
1215
|
+
return _e().wrap(function (e) {
|
|
1203
1216
|
for (;;) switch (e.prev = e.next) {
|
|
1204
1217
|
case 0:
|
|
1205
1218
|
return e.next = 2, this.state;
|
|
@@ -1220,9 +1233,9 @@ var Ne,
|
|
|
1220
1233
|
}, e, this);
|
|
1221
1234
|
}));
|
|
1222
1235
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1223
|
-
return
|
|
1236
|
+
return Ae(i, void 0, void 0, _e().mark(function e() {
|
|
1224
1237
|
var t, r, n, i, s, o;
|
|
1225
|
-
return
|
|
1238
|
+
return _e().wrap(function (e) {
|
|
1226
1239
|
for (;;) switch (e.prev = e.next) {
|
|
1227
1240
|
case 0:
|
|
1228
1241
|
return e.next = 2, this.state;
|
|
@@ -1265,14 +1278,14 @@ var Ne,
|
|
|
1265
1278
|
}, e, this);
|
|
1266
1279
|
}));
|
|
1267
1280
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1268
|
-
return
|
|
1281
|
+
return Ae(i, void 0, void 0, _e().mark(function r() {
|
|
1269
1282
|
var n, i, s;
|
|
1270
|
-
return
|
|
1283
|
+
return _e().wrap(function (r) {
|
|
1271
1284
|
for (;;) switch (r.prev = r.next) {
|
|
1272
1285
|
case 0:
|
|
1273
1286
|
return r.next = 2, this.state;
|
|
1274
1287
|
case 2:
|
|
1275
|
-
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !==
|
|
1288
|
+
if (n = r.sent, i = n.enabled, s = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1276
1289
|
r.next = 14;
|
|
1277
1290
|
break;
|
|
1278
1291
|
}
|
|
@@ -1296,8 +1309,8 @@ var Ne,
|
|
|
1296
1309
|
}, r, this);
|
|
1297
1310
|
}));
|
|
1298
1311
|
}, this.state = n.then(function (e) {
|
|
1299
|
-
return
|
|
1300
|
-
return
|
|
1312
|
+
return Ae(i, void 0, void 0, _e().mark(function n() {
|
|
1313
|
+
return _e().wrap(function (n) {
|
|
1301
1314
|
for (;;) switch (n.prev = n.next) {
|
|
1302
1315
|
case 0:
|
|
1303
1316
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1312,7 +1325,7 @@ var Ne,
|
|
|
1312
1325
|
executeRecaptcha: s
|
|
1313
1326
|
});
|
|
1314
1327
|
case 2:
|
|
1315
|
-
return n.next = 4, void
|
|
1328
|
+
return n.next = 4, void Ke("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1316
1329
|
return window;
|
|
1317
1330
|
});
|
|
1318
1331
|
case 4:
|
|
@@ -1332,11 +1345,11 @@ var Ne,
|
|
|
1332
1345
|
}));
|
|
1333
1346
|
});
|
|
1334
1347
|
}),
|
|
1335
|
-
|
|
1348
|
+
Qe = function Qe() {
|
|
1336
1349
|
return {
|
|
1337
1350
|
isEnabled: function isEnabled() {
|
|
1338
|
-
return
|
|
1339
|
-
return
|
|
1351
|
+
return Ae(void 0, void 0, void 0, _e().mark(function e() {
|
|
1352
|
+
return _e().wrap(function (e) {
|
|
1340
1353
|
for (;;) switch (e.prev = e.next) {
|
|
1341
1354
|
case 0:
|
|
1342
1355
|
return e.abrupt("return", !1);
|
|
@@ -1348,8 +1361,8 @@ var Ne,
|
|
|
1348
1361
|
}));
|
|
1349
1362
|
},
|
|
1350
1363
|
getTelemetryID: function getTelemetryID() {
|
|
1351
|
-
return
|
|
1352
|
-
return
|
|
1364
|
+
return Ae(void 0, void 0, void 0, _e().mark(function e() {
|
|
1365
|
+
return _e().wrap(function (e) {
|
|
1353
1366
|
for (;;) switch (e.prev = e.next) {
|
|
1354
1367
|
case 0:
|
|
1355
1368
|
return e.abrupt("return", void 0);
|
|
@@ -1361,8 +1374,8 @@ var Ne,
|
|
|
1361
1374
|
}));
|
|
1362
1375
|
},
|
|
1363
1376
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1364
|
-
return
|
|
1365
|
-
return
|
|
1377
|
+
return Ae(void 0, void 0, void 0, _e().mark(function e() {
|
|
1378
|
+
return _e().wrap(function (e) {
|
|
1366
1379
|
for (;;) switch (e.prev = e.next) {
|
|
1367
1380
|
case 0:
|
|
1368
1381
|
return e.abrupt("return", {
|
|
@@ -1377,8 +1390,8 @@ var Ne,
|
|
|
1377
1390
|
}));
|
|
1378
1391
|
},
|
|
1379
1392
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1380
|
-
return
|
|
1381
|
-
return
|
|
1393
|
+
return Ae(void 0, void 0, void 0, _e().mark(function e() {
|
|
1394
|
+
return _e().wrap(function (e) {
|
|
1382
1395
|
for (;;) switch (e.prev = e.next) {
|
|
1383
1396
|
case 0:
|
|
1384
1397
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1391,11 +1404,11 @@ var Ne,
|
|
|
1391
1404
|
}
|
|
1392
1405
|
};
|
|
1393
1406
|
},
|
|
1394
|
-
|
|
1407
|
+
et = function () {
|
|
1395
1408
|
function e() {
|
|
1396
|
-
|
|
1409
|
+
ge(this, e);
|
|
1397
1410
|
}
|
|
1398
|
-
return
|
|
1411
|
+
return ve(e, null, [{
|
|
1399
1412
|
key: "marshall",
|
|
1400
1413
|
value: function value(e) {
|
|
1401
1414
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -1415,17 +1428,17 @@ var Ne,
|
|
|
1415
1428
|
value: function value(t) {
|
|
1416
1429
|
if ("name" in t) switch (t.name) {
|
|
1417
1430
|
case "SDKAPIUnreachableError":
|
|
1418
|
-
return e.inflate(k, t);
|
|
1419
|
-
case "StytchSDKSchemaError":
|
|
1420
1431
|
return e.inflate(S, t);
|
|
1432
|
+
case "StytchSDKSchemaError":
|
|
1433
|
+
return e.inflate(P, t);
|
|
1421
1434
|
case "StytchAPIUnreachableError":
|
|
1422
|
-
return e.inflate(O, t);
|
|
1423
|
-
case "StytchAPISchemaError":
|
|
1424
1435
|
return e.inflate(A, t);
|
|
1436
|
+
case "StytchAPISchemaError":
|
|
1437
|
+
return e.inflate(E, t);
|
|
1425
1438
|
case "StytchSDKAPIError":
|
|
1426
|
-
return e.inflate(
|
|
1439
|
+
return e.inflate(O, t);
|
|
1427
1440
|
case "StytchAPIError":
|
|
1428
|
-
return e.inflate(
|
|
1441
|
+
return e.inflate(D, t);
|
|
1429
1442
|
case "TypeError":
|
|
1430
1443
|
return e.inflate(TypeError, t);
|
|
1431
1444
|
case "SyntaxError":
|
|
@@ -1443,11 +1456,11 @@ var Ne,
|
|
|
1443
1456
|
}
|
|
1444
1457
|
}]), e;
|
|
1445
1458
|
}(),
|
|
1446
|
-
|
|
1459
|
+
tt = function () {
|
|
1447
1460
|
function e(t) {
|
|
1448
|
-
|
|
1461
|
+
ge(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1449
1462
|
}
|
|
1450
|
-
return
|
|
1463
|
+
return ve(e, [{
|
|
1451
1464
|
key: "logEvent",
|
|
1452
1465
|
value: function value(e, t) {
|
|
1453
1466
|
this.batch.push({
|
|
@@ -1458,9 +1471,9 @@ var Ne,
|
|
|
1458
1471
|
}, {
|
|
1459
1472
|
key: "flush",
|
|
1460
1473
|
value: function value() {
|
|
1461
|
-
return
|
|
1474
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
1462
1475
|
var t;
|
|
1463
|
-
return
|
|
1476
|
+
return _e().wrap(function (e) {
|
|
1464
1477
|
for (;;) switch (e.prev = e.next) {
|
|
1465
1478
|
case 0:
|
|
1466
1479
|
if (this.batch.length) {
|
|
@@ -1492,13 +1505,13 @@ var Ne,
|
|
|
1492
1505
|
}();
|
|
1493
1506
|
!function (e) {
|
|
1494
1507
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1495
|
-
}(
|
|
1496
|
-
var
|
|
1508
|
+
}(Ge || (Ge = {}));
|
|
1509
|
+
var rt = ve(function e(t, r) {
|
|
1497
1510
|
var n = this;
|
|
1498
|
-
|
|
1499
|
-
return
|
|
1511
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1512
|
+
return Ae(n, void 0, void 0, _e().mark(function e() {
|
|
1500
1513
|
var t, r;
|
|
1501
|
-
return
|
|
1514
|
+
return _e().wrap(function (e) {
|
|
1502
1515
|
for (;;) switch (e.prev = e.next) {
|
|
1503
1516
|
case 0:
|
|
1504
1517
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1507,7 +1520,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1507
1520
|
method: "GET"
|
|
1508
1521
|
});
|
|
1509
1522
|
case 2:
|
|
1510
|
-
return t = e.sent, r =
|
|
1523
|
+
return t = e.sent, r = $e(t), this._subscriptionService.updateUser(r), e.abrupt("return", r);
|
|
1511
1524
|
case 6:
|
|
1512
1525
|
case "end":
|
|
1513
1526
|
return e.stop();
|
|
@@ -1517,19 +1530,19 @@ var Ze = pe(function e(t, r) {
|
|
|
1517
1530
|
}, this.getSync = function () {
|
|
1518
1531
|
return n._subscriptionService.getUser();
|
|
1519
1532
|
}, this.update = function (e) {
|
|
1520
|
-
return
|
|
1533
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1521
1534
|
var r, n;
|
|
1522
|
-
return
|
|
1535
|
+
return _e().wrap(function (t) {
|
|
1523
1536
|
for (;;) switch (t.prev = t.next) {
|
|
1524
1537
|
case 0:
|
|
1525
|
-
return
|
|
1538
|
+
return Je("stytch.user.update").isOptionalObject("untrusted_metadata", e.untrusted_metadata), t.next = 3, this._networkClient.fetchSDK({
|
|
1526
1539
|
url: "/users/me",
|
|
1527
1540
|
body: e,
|
|
1528
1541
|
errorMessage: "Failed to update user.",
|
|
1529
1542
|
method: "PUT"
|
|
1530
1543
|
});
|
|
1531
1544
|
case 3:
|
|
1532
|
-
return r = t.sent, n =
|
|
1545
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1533
1546
|
case 7:
|
|
1534
1547
|
case "end":
|
|
1535
1548
|
return t.stop();
|
|
@@ -1537,9 +1550,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1537
1550
|
}, t, this);
|
|
1538
1551
|
}));
|
|
1539
1552
|
}, this.deleteEmail = function (e) {
|
|
1540
|
-
return
|
|
1553
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1541
1554
|
var r, n;
|
|
1542
|
-
return
|
|
1555
|
+
return _e().wrap(function (t) {
|
|
1543
1556
|
for (;;) switch (t.prev = t.next) {
|
|
1544
1557
|
case 0:
|
|
1545
1558
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1548,7 +1561,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1548
1561
|
method: "DELETE"
|
|
1549
1562
|
});
|
|
1550
1563
|
case 2:
|
|
1551
|
-
return r = t.sent, n =
|
|
1564
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1552
1565
|
case 6:
|
|
1553
1566
|
case "end":
|
|
1554
1567
|
return t.stop();
|
|
@@ -1556,9 +1569,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1556
1569
|
}, t, this);
|
|
1557
1570
|
}));
|
|
1558
1571
|
}, this.deletePhoneNumber = function (e) {
|
|
1559
|
-
return
|
|
1572
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1560
1573
|
var r, n;
|
|
1561
|
-
return
|
|
1574
|
+
return _e().wrap(function (t) {
|
|
1562
1575
|
for (;;) switch (t.prev = t.next) {
|
|
1563
1576
|
case 0:
|
|
1564
1577
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1567,7 +1580,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1567
1580
|
method: "DELETE"
|
|
1568
1581
|
});
|
|
1569
1582
|
case 2:
|
|
1570
|
-
return r = t.sent, n =
|
|
1583
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1571
1584
|
case 6:
|
|
1572
1585
|
case "end":
|
|
1573
1586
|
return t.stop();
|
|
@@ -1575,9 +1588,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1575
1588
|
}, t, this);
|
|
1576
1589
|
}));
|
|
1577
1590
|
}, this.deleteTOTP = function (e) {
|
|
1578
|
-
return
|
|
1591
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1579
1592
|
var r, n;
|
|
1580
|
-
return
|
|
1593
|
+
return _e().wrap(function (t) {
|
|
1581
1594
|
for (;;) switch (t.prev = t.next) {
|
|
1582
1595
|
case 0:
|
|
1583
1596
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1586,7 +1599,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1586
1599
|
method: "DELETE"
|
|
1587
1600
|
});
|
|
1588
1601
|
case 2:
|
|
1589
|
-
return r = t.sent, n =
|
|
1602
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1590
1603
|
case 6:
|
|
1591
1604
|
case "end":
|
|
1592
1605
|
return t.stop();
|
|
@@ -1594,9 +1607,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1594
1607
|
}, t, this);
|
|
1595
1608
|
}));
|
|
1596
1609
|
}, this.deleteOAuthRegistration = function (e) {
|
|
1597
|
-
return
|
|
1610
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1598
1611
|
var r, n;
|
|
1599
|
-
return
|
|
1612
|
+
return _e().wrap(function (t) {
|
|
1600
1613
|
for (;;) switch (t.prev = t.next) {
|
|
1601
1614
|
case 0:
|
|
1602
1615
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1605,7 +1618,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1605
1618
|
method: "DELETE"
|
|
1606
1619
|
});
|
|
1607
1620
|
case 2:
|
|
1608
|
-
return r = t.sent, n =
|
|
1621
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1609
1622
|
case 6:
|
|
1610
1623
|
case "end":
|
|
1611
1624
|
return t.stop();
|
|
@@ -1613,9 +1626,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1613
1626
|
}, t, this);
|
|
1614
1627
|
}));
|
|
1615
1628
|
}, this.deleteWebauthnRegistration = function (e) {
|
|
1616
|
-
return
|
|
1629
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1617
1630
|
var r, n;
|
|
1618
|
-
return
|
|
1631
|
+
return _e().wrap(function (t) {
|
|
1619
1632
|
for (;;) switch (t.prev = t.next) {
|
|
1620
1633
|
case 0:
|
|
1621
1634
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1624,7 +1637,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1624
1637
|
method: "DELETE"
|
|
1625
1638
|
});
|
|
1626
1639
|
case 2:
|
|
1627
|
-
return r = t.sent, n =
|
|
1640
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1628
1641
|
case 6:
|
|
1629
1642
|
case "end":
|
|
1630
1643
|
return t.stop();
|
|
@@ -1632,9 +1645,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1632
1645
|
}, t, this);
|
|
1633
1646
|
}));
|
|
1634
1647
|
}, this.deleteBiometricRegistration = function (e) {
|
|
1635
|
-
return
|
|
1648
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1636
1649
|
var r, n;
|
|
1637
|
-
return
|
|
1650
|
+
return _e().wrap(function (t) {
|
|
1638
1651
|
for (;;) switch (t.prev = t.next) {
|
|
1639
1652
|
case 0:
|
|
1640
1653
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1643,7 +1656,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1643
1656
|
method: "DELETE"
|
|
1644
1657
|
});
|
|
1645
1658
|
case 2:
|
|
1646
|
-
return r = t.sent, n =
|
|
1659
|
+
return r = t.sent, n = $e(r.__user), this._subscriptionService.updateUser(n), t.abrupt("return", Xe(r));
|
|
1647
1660
|
case 6:
|
|
1648
1661
|
case "end":
|
|
1649
1662
|
return t.stop();
|
|
@@ -1658,10 +1671,10 @@ var Ze = pe(function e(t, r) {
|
|
|
1658
1671
|
});
|
|
1659
1672
|
};
|
|
1660
1673
|
}),
|
|
1661
|
-
|
|
1674
|
+
nt = function () {
|
|
1662
1675
|
function e(t, r) {
|
|
1663
1676
|
var n = this;
|
|
1664
|
-
|
|
1677
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
1665
1678
|
return n._subscriptionService.getSession();
|
|
1666
1679
|
}, this.onChange = function (e) {
|
|
1667
1680
|
var t = n._subscriptionService.getSession();
|
|
@@ -1670,9 +1683,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1670
1683
|
(null == r ? void 0 : r.session) !== t && (t = null !== (n = null == r ? void 0 : r.session) && void 0 !== n ? n : null, e(t));
|
|
1671
1684
|
});
|
|
1672
1685
|
}, this.revoke = function (e) {
|
|
1673
|
-
return
|
|
1686
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1674
1687
|
var r;
|
|
1675
|
-
return
|
|
1688
|
+
return _e().wrap(function (t) {
|
|
1676
1689
|
for (;;) switch (t.prev = t.next) {
|
|
1677
1690
|
case 0:
|
|
1678
1691
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1691,13 +1704,13 @@ var Ze = pe(function e(t, r) {
|
|
|
1691
1704
|
}, t, this, [[0, 8]]);
|
|
1692
1705
|
}));
|
|
1693
1706
|
}, this.authenticate = function (e) {
|
|
1694
|
-
return
|
|
1707
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
1695
1708
|
var r,
|
|
1696
1709
|
n,
|
|
1697
1710
|
i,
|
|
1698
1711
|
s,
|
|
1699
1712
|
o = this;
|
|
1700
|
-
return
|
|
1713
|
+
return _e().wrap(function (t) {
|
|
1701
1714
|
for (;;) switch (t.prev = t.next) {
|
|
1702
1715
|
case 0:
|
|
1703
1716
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -1726,7 +1739,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1726
1739
|
session_token: s.session_token,
|
|
1727
1740
|
session_jwt: s.session_jwt,
|
|
1728
1741
|
intermediate_session_token: null
|
|
1729
|
-
}), t.abrupt("return",
|
|
1742
|
+
}), t.abrupt("return", Xe(s));
|
|
1730
1743
|
case 13:
|
|
1731
1744
|
if (t.prev = 13, t.t0 = t["catch"](2), !n()) {
|
|
1732
1745
|
t.next = 17;
|
|
@@ -1743,7 +1756,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1743
1756
|
}));
|
|
1744
1757
|
};
|
|
1745
1758
|
}
|
|
1746
|
-
return
|
|
1759
|
+
return ve(e, [{
|
|
1747
1760
|
key: "getTokens",
|
|
1748
1761
|
value: function value() {
|
|
1749
1762
|
return this._subscriptionService.getTokens();
|
|
@@ -1755,20 +1768,20 @@ var Ze = pe(function e(t, r) {
|
|
|
1755
1768
|
}
|
|
1756
1769
|
}]), e;
|
|
1757
1770
|
}(),
|
|
1758
|
-
|
|
1771
|
+
it = Promise.resolve({
|
|
1759
1772
|
pkceRequiredForEmailMagicLinks: !1
|
|
1760
1773
|
}),
|
|
1761
|
-
|
|
1774
|
+
st = function () {
|
|
1762
1775
|
function e(t, r, n, i) {
|
|
1763
1776
|
var s = this,
|
|
1764
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1765
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1766
|
-
|
|
1777
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : it,
|
|
1778
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Qe();
|
|
1779
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = o, this.dfpProtectedAuth = a, this.email = {
|
|
1767
1780
|
loginOrCreate: function loginOrCreate(e) {
|
|
1768
1781
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1769
|
-
return
|
|
1782
|
+
return Ae(s, void 0, void 0, _e().mark(function r() {
|
|
1770
1783
|
var n, i, s, o, a, c, u;
|
|
1771
|
-
return
|
|
1784
|
+
return _e().wrap(function (r) {
|
|
1772
1785
|
for (;;) switch (r.prev = r.next) {
|
|
1773
1786
|
case 0:
|
|
1774
1787
|
return r.next = 2, this._config;
|
|
@@ -1804,9 +1817,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1804
1817
|
},
|
|
1805
1818
|
send: function send(e) {
|
|
1806
1819
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1807
|
-
return
|
|
1820
|
+
return Ae(s, void 0, void 0, _e().mark(function r() {
|
|
1808
1821
|
var n, i, s, o, a, c, u, l, d;
|
|
1809
|
-
return
|
|
1822
|
+
return _e().wrap(function (r) {
|
|
1810
1823
|
for (;;) switch (r.prev = r.next) {
|
|
1811
1824
|
case 0:
|
|
1812
1825
|
return r.next = 2, this._config;
|
|
@@ -1841,12 +1854,12 @@ var Ze = pe(function e(t, r) {
|
|
|
1841
1854
|
}));
|
|
1842
1855
|
}
|
|
1843
1856
|
}, this.authenticate = function (e, t) {
|
|
1844
|
-
return
|
|
1857
|
+
return Ae(s, void 0, void 0, _e().mark(function r() {
|
|
1845
1858
|
var n, i;
|
|
1846
|
-
return
|
|
1859
|
+
return _e().wrap(function (r) {
|
|
1847
1860
|
for (;;) switch (r.prev = r.next) {
|
|
1848
1861
|
case 0:
|
|
1849
|
-
return
|
|
1862
|
+
return Je("stytch.magicLinks.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1850
1863
|
case 3:
|
|
1851
1864
|
if (n = r.sent, i = null, !(null == n ? void 0 : n.code_verifier)) {
|
|
1852
1865
|
r.next = 19;
|
|
@@ -1886,7 +1899,7 @@ var Ze = pe(function e(t, r) {
|
|
|
1886
1899
|
session_token: i.session_token,
|
|
1887
1900
|
session_jwt: i.session_jwt,
|
|
1888
1901
|
intermediate_session_token: null
|
|
1889
|
-
}), r.abrupt("return",
|
|
1902
|
+
}), r.abrupt("return", Xe(i));
|
|
1890
1903
|
case 25:
|
|
1891
1904
|
case "end":
|
|
1892
1905
|
return r.stop();
|
|
@@ -1895,12 +1908,12 @@ var Ze = pe(function e(t, r) {
|
|
|
1895
1908
|
}));
|
|
1896
1909
|
};
|
|
1897
1910
|
}
|
|
1898
|
-
return
|
|
1911
|
+
return ve(e, [{
|
|
1899
1912
|
key: "getCodeChallenge",
|
|
1900
1913
|
value: function value() {
|
|
1901
|
-
return
|
|
1914
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
1902
1915
|
var t;
|
|
1903
|
-
return
|
|
1916
|
+
return _e().wrap(function (e) {
|
|
1904
1917
|
for (;;) switch (e.prev = e.next) {
|
|
1905
1918
|
case 0:
|
|
1906
1919
|
return e.next = 2, this._pkceManager.getPKPair();
|
|
@@ -1924,9 +1937,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1924
1937
|
}, {
|
|
1925
1938
|
key: "handlePKCEForAuthenticate",
|
|
1926
1939
|
value: function value(e, t) {
|
|
1927
|
-
return
|
|
1940
|
+
return Ae(this, void 0, void 0, _e().mark(function r() {
|
|
1928
1941
|
var n, i, s;
|
|
1929
|
-
return
|
|
1942
|
+
return _e().wrap(function (r) {
|
|
1930
1943
|
for (;;) switch (r.prev = r.next) {
|
|
1931
1944
|
case 0:
|
|
1932
1945
|
return r.next = 2, e.getPKPair();
|
|
@@ -1950,17 +1963,17 @@ var Ze = pe(function e(t, r) {
|
|
|
1950
1963
|
}
|
|
1951
1964
|
}]), e;
|
|
1952
1965
|
}(),
|
|
1953
|
-
|
|
1966
|
+
ot = ve(function e(t, r) {
|
|
1954
1967
|
var n = this,
|
|
1955
1968
|
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
1956
1969
|
return Promise.resolve(void 0);
|
|
1957
1970
|
},
|
|
1958
|
-
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
1959
|
-
|
|
1971
|
+
s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Qe();
|
|
1972
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = i, this.dfpProtectedAuth = s, this.sms = {
|
|
1960
1973
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
1961
|
-
return
|
|
1974
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
1962
1975
|
var n, i, s, o;
|
|
1963
|
-
return
|
|
1976
|
+
return _e().wrap(function (r) {
|
|
1964
1977
|
for (;;) switch (r.prev = r.next) {
|
|
1965
1978
|
case 0:
|
|
1966
1979
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -1984,9 +1997,9 @@ var Ze = pe(function e(t, r) {
|
|
|
1984
1997
|
}));
|
|
1985
1998
|
},
|
|
1986
1999
|
send: function send(e, t) {
|
|
1987
|
-
return
|
|
2000
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
1988
2001
|
var n, i, s, o, a, c;
|
|
1989
|
-
return
|
|
2002
|
+
return _e().wrap(function (r) {
|
|
1990
2003
|
for (;;) switch (r.prev = r.next) {
|
|
1991
2004
|
case 0:
|
|
1992
2005
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2011,9 +2024,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2011
2024
|
}
|
|
2012
2025
|
}, this.whatsapp = {
|
|
2013
2026
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2014
|
-
return
|
|
2027
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
2015
2028
|
var n, i, s, o;
|
|
2016
|
-
return
|
|
2029
|
+
return _e().wrap(function (r) {
|
|
2017
2030
|
for (;;) switch (r.prev = r.next) {
|
|
2018
2031
|
case 0:
|
|
2019
2032
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2037,9 +2050,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2037
2050
|
}));
|
|
2038
2051
|
},
|
|
2039
2052
|
send: function send(e, t) {
|
|
2040
|
-
return
|
|
2053
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
2041
2054
|
var n, i, s, o, a, c;
|
|
2042
|
-
return
|
|
2055
|
+
return _e().wrap(function (r) {
|
|
2043
2056
|
for (;;) switch (r.prev = r.next) {
|
|
2044
2057
|
case 0:
|
|
2045
2058
|
return r.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -2064,9 +2077,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2064
2077
|
}
|
|
2065
2078
|
}, this.email = {
|
|
2066
2079
|
loginOrCreate: function loginOrCreate(e, t) {
|
|
2067
|
-
return
|
|
2080
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
2068
2081
|
var n, i;
|
|
2069
|
-
return
|
|
2082
|
+
return _e().wrap(function (r) {
|
|
2070
2083
|
for (;;) switch (r.prev = r.next) {
|
|
2071
2084
|
case 0:
|
|
2072
2085
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2088,9 +2101,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2088
2101
|
}));
|
|
2089
2102
|
},
|
|
2090
2103
|
send: function send(e, t) {
|
|
2091
|
-
return
|
|
2104
|
+
return Ae(n, void 0, void 0, _e().mark(function r() {
|
|
2092
2105
|
var n, i, s, o;
|
|
2093
|
-
return
|
|
2106
|
+
return _e().wrap(function (r) {
|
|
2094
2107
|
for (;;) switch (r.prev = r.next) {
|
|
2095
2108
|
case 0:
|
|
2096
2109
|
return r.next = 2, this.executeRecaptcha();
|
|
@@ -2112,12 +2125,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2112
2125
|
}));
|
|
2113
2126
|
}
|
|
2114
2127
|
}, this.authenticate = function (e, t, r) {
|
|
2115
|
-
return
|
|
2128
|
+
return Ae(n, void 0, void 0, _e().mark(function n() {
|
|
2116
2129
|
var i, s, o, a, c;
|
|
2117
|
-
return
|
|
2130
|
+
return _e().wrap(function (n) {
|
|
2118
2131
|
for (;;) switch (n.prev = n.next) {
|
|
2119
2132
|
case 0:
|
|
2120
|
-
return
|
|
2133
|
+
return Je("stytch.otps.authenticate").isString("Code", e).isNumber("session_duration_minutes", r.session_duration_minutes), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2121
2134
|
case 3:
|
|
2122
2135
|
return i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, a = Object.assign({
|
|
2123
2136
|
token: e,
|
|
@@ -2140,7 +2153,7 @@ var Ze = pe(function e(t, r) {
|
|
|
2140
2153
|
session_token: c.session_token,
|
|
2141
2154
|
session_jwt: c.session_jwt,
|
|
2142
2155
|
intermediate_session_token: null
|
|
2143
|
-
}), n.abrupt("return",
|
|
2156
|
+
}), n.abrupt("return", Xe(c));
|
|
2144
2157
|
case 12:
|
|
2145
2158
|
case "end":
|
|
2146
2159
|
return n.stop();
|
|
@@ -2149,9 +2162,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2149
2162
|
}));
|
|
2150
2163
|
};
|
|
2151
2164
|
}),
|
|
2152
|
-
|
|
2165
|
+
at = function () {
|
|
2153
2166
|
function e(t, r, n, i, s) {
|
|
2154
|
-
|
|
2167
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = s, this.google = {
|
|
2155
2168
|
start: this.startOAuthFlow(exports.OAuthProviders.Google)
|
|
2156
2169
|
}, this.apple = {
|
|
2157
2170
|
start: this.startOAuthFlow(exports.OAuthProviders.Apple)
|
|
@@ -2191,17 +2204,17 @@ var Ze = pe(function e(t, r) {
|
|
|
2191
2204
|
start: this.startOAuthFlow(exports.OAuthProviders.Yahoo)
|
|
2192
2205
|
};
|
|
2193
2206
|
}
|
|
2194
|
-
return
|
|
2207
|
+
return ve(e, [{
|
|
2195
2208
|
key: "authenticate",
|
|
2196
2209
|
value: function value(e, t) {
|
|
2197
|
-
return
|
|
2210
|
+
return Ae(this, void 0, void 0, _e().mark(function r() {
|
|
2198
2211
|
var n, i;
|
|
2199
|
-
return
|
|
2212
|
+
return _e().wrap(function (r) {
|
|
2200
2213
|
for (;;) switch (r.prev = r.next) {
|
|
2201
2214
|
case 0:
|
|
2202
|
-
return
|
|
2215
|
+
return Je("stytch.oauth.authenticate").isString("Token", e).isNumber("session_duration_minutes", t.session_duration_minutes), r.next = 3, this._pkceManager.getPKPair();
|
|
2203
2216
|
case 3:
|
|
2204
|
-
return (n = r.sent) ||
|
|
2217
|
+
return (n = r.sent) || ze("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), r.next = 7, this._networkClient.fetchSDK({
|
|
2205
2218
|
url: "/oauth/authenticate",
|
|
2206
2219
|
method: "POST",
|
|
2207
2220
|
body: Object.assign({
|
|
@@ -2214,12 +2227,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2214
2227
|
return i = r.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
2215
2228
|
state: {
|
|
2216
2229
|
session: i.session,
|
|
2217
|
-
user:
|
|
2230
|
+
user: $e(i.__user)
|
|
2218
2231
|
},
|
|
2219
2232
|
session_token: i.session_token,
|
|
2220
2233
|
session_jwt: i.session_jwt,
|
|
2221
2234
|
intermediate_session_token: null
|
|
2222
|
-
}), r.abrupt("return",
|
|
2235
|
+
}), r.abrupt("return", Xe(i));
|
|
2223
2236
|
case 11:
|
|
2224
2237
|
case "end":
|
|
2225
2238
|
return r.stop();
|
|
@@ -2230,9 +2243,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2230
2243
|
}, {
|
|
2231
2244
|
key: "getBaseApiUrl",
|
|
2232
2245
|
value: function value() {
|
|
2233
|
-
return
|
|
2246
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
2234
2247
|
var t, r;
|
|
2235
|
-
return
|
|
2248
|
+
return _e().wrap(function (e) {
|
|
2236
2249
|
for (;;) switch (e.prev = e.next) {
|
|
2237
2250
|
case 0:
|
|
2238
2251
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2267,9 +2280,9 @@ var Ze = pe(function e(t, r) {
|
|
|
2267
2280
|
i = r.signup_redirect_url,
|
|
2268
2281
|
s = r.custom_scopes,
|
|
2269
2282
|
o = r.provider_params;
|
|
2270
|
-
return
|
|
2283
|
+
return Ae(t, void 0, void 0, _e().mark(function t() {
|
|
2271
2284
|
var r, a, c, u, l, d, h;
|
|
2272
|
-
return
|
|
2285
|
+
return _e().wrap(function (t) {
|
|
2273
2286
|
for (;;) switch (t.prev = t.next) {
|
|
2274
2287
|
case 0:
|
|
2275
2288
|
return t.next = 2, this._dynamicConfig;
|
|
@@ -2296,7 +2309,7 @@ var Ze = pe(function e(t, r) {
|
|
|
2296
2309
|
case 18:
|
|
2297
2310
|
this._pkceManager.clearPKPair();
|
|
2298
2311
|
case 19:
|
|
2299
|
-
if (s && (
|
|
2312
|
+
if (s && (Je("startOAuthFlow").isStringArray("custom_scopes", s), l.searchParams.set("custom_scopes", s.join(" "))), o) for (h in Je("startOAuthFlow").isOptionalObject("provider_params", o), o) l.searchParams.set("provider_" + h, o[h]);
|
|
2300
2313
|
n && l.searchParams.set("login_redirect_url", n), i && l.searchParams.set("signup_redirect_url", i), window.location.href = l.toString();
|
|
2301
2314
|
case 24:
|
|
2302
2315
|
case "end":
|
|
@@ -2308,23 +2321,23 @@ var Ze = pe(function e(t, r) {
|
|
|
2308
2321
|
}
|
|
2309
2322
|
}]), e;
|
|
2310
2323
|
}(),
|
|
2311
|
-
|
|
2324
|
+
ct = function () {
|
|
2312
2325
|
function e(t, r) {
|
|
2313
2326
|
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function () {
|
|
2314
2327
|
return Promise.resolve(void 0);
|
|
2315
2328
|
},
|
|
2316
|
-
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2317
|
-
|
|
2329
|
+
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Qe();
|
|
2330
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.executeRecaptcha = n, this.dfpProtectedAuth = i;
|
|
2318
2331
|
}
|
|
2319
|
-
return
|
|
2332
|
+
return ve(e, [{
|
|
2320
2333
|
key: "authenticateStart",
|
|
2321
2334
|
value: function value(e) {
|
|
2322
|
-
return
|
|
2335
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2323
2336
|
var r, n, i;
|
|
2324
|
-
return
|
|
2337
|
+
return _e().wrap(function (t) {
|
|
2325
2338
|
for (;;) switch (t.prev = t.next) {
|
|
2326
2339
|
case 0:
|
|
2327
|
-
return
|
|
2340
|
+
return Je("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type), r = !!this._subscriptionService.getSession(), t.next = 4, this.executeRecaptcha();
|
|
2328
2341
|
case 4:
|
|
2329
2342
|
return n = t.sent, i = r ? "/crypto_wallets/authenticate/start/secondary" : "/crypto_wallets/authenticate/start/primary", t.abrupt("return", this._networkClient.fetchSDK({
|
|
2330
2343
|
url: i,
|
|
@@ -2346,12 +2359,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2346
2359
|
}, {
|
|
2347
2360
|
key: "authenticate",
|
|
2348
2361
|
value: function value(e) {
|
|
2349
|
-
return
|
|
2362
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2350
2363
|
var r, n, i, s;
|
|
2351
|
-
return
|
|
2364
|
+
return _e().wrap(function (t) {
|
|
2352
2365
|
for (;;) switch (t.prev = t.next) {
|
|
2353
2366
|
case 0:
|
|
2354
|
-
return
|
|
2367
|
+
return Je("stytch.cryptoWallets.authenticate").isString("signature", e.signature).isString("crypto_wallet_address", e.crypto_wallet_address).isString("crypto_wallet_type", e.crypto_wallet_type).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2355
2368
|
case 3:
|
|
2356
2369
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2357
2370
|
url: "/crypto_wallets/authenticate",
|
|
@@ -2371,12 +2384,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2371
2384
|
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2372
2385
|
state: {
|
|
2373
2386
|
session: s.session,
|
|
2374
|
-
user:
|
|
2387
|
+
user: $e(s.__user)
|
|
2375
2388
|
},
|
|
2376
2389
|
session_token: s.session_token,
|
|
2377
2390
|
session_jwt: s.session_jwt,
|
|
2378
2391
|
intermediate_session_token: null
|
|
2379
|
-
}), t.abrupt("return",
|
|
2392
|
+
}), t.abrupt("return", Xe(s));
|
|
2380
2393
|
case 11:
|
|
2381
2394
|
case "end":
|
|
2382
2395
|
return t.stop();
|
|
@@ -2386,19 +2399,19 @@ var Ze = pe(function e(t, r) {
|
|
|
2386
2399
|
}
|
|
2387
2400
|
}]), e;
|
|
2388
2401
|
}(),
|
|
2389
|
-
|
|
2402
|
+
ut = function () {
|
|
2390
2403
|
function e(t, r, n) {
|
|
2391
|
-
|
|
2404
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2392
2405
|
}
|
|
2393
|
-
return
|
|
2406
|
+
return ve(e, [{
|
|
2394
2407
|
key: "create",
|
|
2395
2408
|
value: function value(e) {
|
|
2396
|
-
return
|
|
2409
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2397
2410
|
var r;
|
|
2398
|
-
return
|
|
2411
|
+
return _e().wrap(function (t) {
|
|
2399
2412
|
for (;;) switch (t.prev = t.next) {
|
|
2400
2413
|
case 0:
|
|
2401
|
-
return
|
|
2414
|
+
return Je("stytch.totps.create").isNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this._networkClient.fetchSDK({
|
|
2402
2415
|
url: "/totps",
|
|
2403
2416
|
method: "POST",
|
|
2404
2417
|
errorMessage: "Failed to create TOTP",
|
|
@@ -2407,7 +2420,7 @@ var Ze = pe(function e(t, r) {
|
|
|
2407
2420
|
}
|
|
2408
2421
|
});
|
|
2409
2422
|
case 3:
|
|
2410
|
-
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return",
|
|
2423
|
+
return r = t.sent, this._subscriptionService.updateUser(r.__user), t.abrupt("return", Xe(r));
|
|
2411
2424
|
case 6:
|
|
2412
2425
|
case "end":
|
|
2413
2426
|
return t.stop();
|
|
@@ -2418,12 +2431,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2418
2431
|
}, {
|
|
2419
2432
|
key: "authenticate",
|
|
2420
2433
|
value: function value(e) {
|
|
2421
|
-
return
|
|
2434
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2422
2435
|
var r, n, i, s;
|
|
2423
|
-
return
|
|
2436
|
+
return _e().wrap(function (t) {
|
|
2424
2437
|
for (;;) switch (t.prev = t.next) {
|
|
2425
2438
|
case 0:
|
|
2426
|
-
return
|
|
2439
|
+
return Je("stytch.totps.authenticate").isNumber("session_duration_minutes", e.session_duration_minutes).isString("totp_code", e.totp_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2427
2440
|
case 3:
|
|
2428
2441
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2429
2442
|
url: "/totps/authenticate",
|
|
@@ -2446,7 +2459,7 @@ var Ze = pe(function e(t, r) {
|
|
|
2446
2459
|
session_token: s.session_token,
|
|
2447
2460
|
session_jwt: s.session_jwt,
|
|
2448
2461
|
intermediate_session_token: null
|
|
2449
|
-
}), t.abrupt("return",
|
|
2462
|
+
}), t.abrupt("return", Xe(s));
|
|
2450
2463
|
case 11:
|
|
2451
2464
|
case "end":
|
|
2452
2465
|
return t.stop();
|
|
@@ -2457,8 +2470,8 @@ var Ze = pe(function e(t, r) {
|
|
|
2457
2470
|
}, {
|
|
2458
2471
|
key: "recoveryCodes",
|
|
2459
2472
|
value: function value() {
|
|
2460
|
-
return
|
|
2461
|
-
return
|
|
2473
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
2474
|
+
return _e().wrap(function (e) {
|
|
2462
2475
|
for (;;) switch (e.prev = e.next) {
|
|
2463
2476
|
case 0:
|
|
2464
2477
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2476,12 +2489,12 @@ var Ze = pe(function e(t, r) {
|
|
|
2476
2489
|
}, {
|
|
2477
2490
|
key: "recover",
|
|
2478
2491
|
value: function value(e) {
|
|
2479
|
-
return
|
|
2492
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2480
2493
|
var r, n, i, s;
|
|
2481
|
-
return
|
|
2494
|
+
return _e().wrap(function (t) {
|
|
2482
2495
|
for (;;) switch (t.prev = t.next) {
|
|
2483
2496
|
case 0:
|
|
2484
|
-
return
|
|
2497
|
+
return Je("stytch.totps.recover").isNumber("session_duration_minutes", e.session_duration_minutes).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2485
2498
|
case 3:
|
|
2486
2499
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2487
2500
|
url: "/totps/recover",
|
|
@@ -2504,7 +2517,7 @@ var Ze = pe(function e(t, r) {
|
|
|
2504
2517
|
session_token: s.session_token,
|
|
2505
2518
|
session_jwt: s.session_jwt,
|
|
2506
2519
|
intermediate_session_token: null
|
|
2507
|
-
}), t.abrupt("return",
|
|
2520
|
+
}), t.abrupt("return", Xe(s));
|
|
2508
2521
|
case 11:
|
|
2509
2522
|
case "end":
|
|
2510
2523
|
return t.stop();
|
|
@@ -2514,14 +2527,14 @@ var Ze = pe(function e(t, r) {
|
|
|
2514
2527
|
}
|
|
2515
2528
|
}]), e;
|
|
2516
2529
|
}();
|
|
2517
|
-
function
|
|
2530
|
+
function lt(e) {
|
|
2518
2531
|
for (var t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length), s = new Uint8Array(i), o = 0; o < n.length; o++) s[o] = n.charCodeAt(o);
|
|
2519
2532
|
return i;
|
|
2520
2533
|
}
|
|
2521
|
-
function
|
|
2534
|
+
function dt(e) {
|
|
2522
2535
|
var t,
|
|
2523
2536
|
r = "",
|
|
2524
|
-
n =
|
|
2537
|
+
n = le(new Uint8Array(e));
|
|
2525
2538
|
try {
|
|
2526
2539
|
for (n.s(); !(t = n.n()).done;) {
|
|
2527
2540
|
var i = t.value;
|
|
@@ -2534,139 +2547,139 @@ function at(e) {
|
|
|
2534
2547
|
}
|
|
2535
2548
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2536
2549
|
}
|
|
2537
|
-
var
|
|
2538
|
-
|
|
2539
|
-
function
|
|
2540
|
-
if (t ===
|
|
2541
|
-
if (t ===
|
|
2550
|
+
var ht = "copy",
|
|
2551
|
+
pt = "convert";
|
|
2552
|
+
function ft(e, t, r) {
|
|
2553
|
+
if (t === ht) return r;
|
|
2554
|
+
if (t === pt) return e(r);
|
|
2542
2555
|
if (t instanceof Array) return r.map(function (r) {
|
|
2543
|
-
return
|
|
2556
|
+
return ft(e, t[0], r);
|
|
2544
2557
|
});
|
|
2545
2558
|
if (t instanceof Object) {
|
|
2546
2559
|
for (var n = {}, i = 0, s = Object.entries(t); i < s.length; i++) {
|
|
2547
|
-
var o =
|
|
2560
|
+
var o = de(s[i], 2),
|
|
2548
2561
|
a = o[0],
|
|
2549
2562
|
c = o[1];
|
|
2550
2563
|
if (c.derive) {
|
|
2551
2564
|
var u = c.derive(r);
|
|
2552
2565
|
void 0 !== u && (r[a] = u);
|
|
2553
2566
|
}
|
|
2554
|
-
if (a in r) null != r[a] ? n[a] =
|
|
2567
|
+
if (a in r) null != r[a] ? n[a] = ft(e, c.schema, r[a]) : n[a] = null;else if (c.required) throw new Error("Missing key: ".concat(a));
|
|
2555
2568
|
}
|
|
2556
2569
|
return n;
|
|
2557
2570
|
}
|
|
2558
2571
|
}
|
|
2559
|
-
function
|
|
2572
|
+
function _t(e, t) {
|
|
2560
2573
|
return {
|
|
2561
2574
|
required: !0,
|
|
2562
2575
|
schema: e,
|
|
2563
2576
|
derive: t
|
|
2564
2577
|
};
|
|
2565
2578
|
}
|
|
2566
|
-
function
|
|
2579
|
+
function mt(e) {
|
|
2567
2580
|
return {
|
|
2568
2581
|
required: !0,
|
|
2569
2582
|
schema: e
|
|
2570
2583
|
};
|
|
2571
2584
|
}
|
|
2572
|
-
function
|
|
2585
|
+
function vt(e) {
|
|
2573
2586
|
return {
|
|
2574
2587
|
required: !1,
|
|
2575
2588
|
schema: e
|
|
2576
2589
|
};
|
|
2577
2590
|
}
|
|
2578
|
-
var
|
|
2579
|
-
type: ht
|
|
2580
|
-
id:
|
|
2581
|
-
transports:
|
|
2591
|
+
var yt = {
|
|
2592
|
+
type: mt(ht),
|
|
2593
|
+
id: mt(pt),
|
|
2594
|
+
transports: vt(ht)
|
|
2582
2595
|
},
|
|
2583
|
-
|
|
2584
|
-
appid:
|
|
2585
|
-
appidExclude:
|
|
2586
|
-
credProps:
|
|
2596
|
+
gt = {
|
|
2597
|
+
appid: vt(ht),
|
|
2598
|
+
appidExclude: vt(ht),
|
|
2599
|
+
credProps: vt(ht)
|
|
2587
2600
|
},
|
|
2588
|
-
|
|
2589
|
-
appid:
|
|
2590
|
-
appidExclude:
|
|
2591
|
-
credProps:
|
|
2601
|
+
bt = {
|
|
2602
|
+
appid: vt(ht),
|
|
2603
|
+
appidExclude: vt(ht),
|
|
2604
|
+
credProps: vt(ht)
|
|
2592
2605
|
},
|
|
2593
|
-
|
|
2594
|
-
publicKey:
|
|
2595
|
-
rp: ht
|
|
2596
|
-
user:
|
|
2597
|
-
id:
|
|
2598
|
-
name: ht
|
|
2599
|
-
displayName: ht
|
|
2606
|
+
kt = {
|
|
2607
|
+
publicKey: mt({
|
|
2608
|
+
rp: mt(ht),
|
|
2609
|
+
user: mt({
|
|
2610
|
+
id: mt(pt),
|
|
2611
|
+
name: mt(ht),
|
|
2612
|
+
displayName: mt(ht)
|
|
2600
2613
|
}),
|
|
2601
|
-
challenge:
|
|
2602
|
-
pubKeyCredParams: ht
|
|
2603
|
-
timeout:
|
|
2604
|
-
excludeCredentials:
|
|
2605
|
-
authenticatorSelection:
|
|
2606
|
-
attestation:
|
|
2607
|
-
extensions:
|
|
2614
|
+
challenge: mt(pt),
|
|
2615
|
+
pubKeyCredParams: mt(ht),
|
|
2616
|
+
timeout: vt(ht),
|
|
2617
|
+
excludeCredentials: vt([yt]),
|
|
2618
|
+
authenticatorSelection: vt(ht),
|
|
2619
|
+
attestation: vt(ht),
|
|
2620
|
+
extensions: vt(gt)
|
|
2608
2621
|
}),
|
|
2609
|
-
signal:
|
|
2622
|
+
signal: vt(ht)
|
|
2610
2623
|
},
|
|
2611
|
-
|
|
2612
|
-
type: ht
|
|
2613
|
-
id: ht
|
|
2614
|
-
rawId:
|
|
2615
|
-
authenticatorAttachment:
|
|
2616
|
-
response:
|
|
2617
|
-
clientDataJSON:
|
|
2618
|
-
attestationObject:
|
|
2619
|
-
transports:
|
|
2624
|
+
wt = {
|
|
2625
|
+
type: mt(ht),
|
|
2626
|
+
id: mt(ht),
|
|
2627
|
+
rawId: mt(pt),
|
|
2628
|
+
authenticatorAttachment: vt(ht),
|
|
2629
|
+
response: mt({
|
|
2630
|
+
clientDataJSON: mt(pt),
|
|
2631
|
+
attestationObject: mt(pt),
|
|
2632
|
+
transports: _t(ht, function (e) {
|
|
2620
2633
|
var t;
|
|
2621
2634
|
return (null == (t = e.getTransports) ? void 0 : t.call(e)) || [];
|
|
2622
2635
|
})
|
|
2623
2636
|
}),
|
|
2624
|
-
clientExtensionResults:
|
|
2637
|
+
clientExtensionResults: _t(bt, function (e) {
|
|
2625
2638
|
return e.getClientExtensionResults();
|
|
2626
2639
|
})
|
|
2627
2640
|
},
|
|
2628
|
-
|
|
2629
|
-
mediation:
|
|
2630
|
-
publicKey:
|
|
2631
|
-
challenge:
|
|
2632
|
-
timeout:
|
|
2633
|
-
rpId:
|
|
2634
|
-
allowCredentials:
|
|
2635
|
-
userVerification:
|
|
2636
|
-
extensions:
|
|
2641
|
+
St = {
|
|
2642
|
+
mediation: vt(ht),
|
|
2643
|
+
publicKey: mt({
|
|
2644
|
+
challenge: mt(pt),
|
|
2645
|
+
timeout: vt(ht),
|
|
2646
|
+
rpId: vt(ht),
|
|
2647
|
+
allowCredentials: vt([yt]),
|
|
2648
|
+
userVerification: vt(ht),
|
|
2649
|
+
extensions: vt(gt)
|
|
2637
2650
|
}),
|
|
2638
|
-
signal:
|
|
2651
|
+
signal: vt(ht)
|
|
2639
2652
|
},
|
|
2640
|
-
|
|
2641
|
-
type: ht
|
|
2642
|
-
id: ht
|
|
2643
|
-
rawId:
|
|
2644
|
-
authenticatorAttachment:
|
|
2645
|
-
response:
|
|
2646
|
-
clientDataJSON:
|
|
2647
|
-
authenticatorData:
|
|
2648
|
-
signature:
|
|
2649
|
-
userHandle:
|
|
2653
|
+
xt = {
|
|
2654
|
+
type: mt(ht),
|
|
2655
|
+
id: mt(ht),
|
|
2656
|
+
rawId: mt(pt),
|
|
2657
|
+
authenticatorAttachment: vt(ht),
|
|
2658
|
+
response: mt({
|
|
2659
|
+
clientDataJSON: mt(pt),
|
|
2660
|
+
authenticatorData: mt(pt),
|
|
2661
|
+
signature: mt(pt),
|
|
2662
|
+
userHandle: mt(pt)
|
|
2650
2663
|
}),
|
|
2651
|
-
clientExtensionResults:
|
|
2664
|
+
clientExtensionResults: _t(bt, function (e) {
|
|
2652
2665
|
return e.getClientExtensionResults();
|
|
2653
2666
|
})
|
|
2654
2667
|
};
|
|
2655
|
-
function
|
|
2656
|
-
return lt
|
|
2668
|
+
function Pt(e) {
|
|
2669
|
+
return ft(lt, kt, e);
|
|
2657
2670
|
}
|
|
2658
|
-
function
|
|
2659
|
-
return
|
|
2671
|
+
function Ot(e) {
|
|
2672
|
+
return ft(dt, wt, e);
|
|
2660
2673
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return
|
|
2674
|
+
function Ct(e) {
|
|
2675
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2663
2676
|
var r;
|
|
2664
|
-
return
|
|
2677
|
+
return _e().wrap(function (t) {
|
|
2665
2678
|
for (;;) switch (t.prev = t.next) {
|
|
2666
2679
|
case 0:
|
|
2667
|
-
return t.next = 2, navigator.credentials.create(
|
|
2680
|
+
return t.next = 2, navigator.credentials.create(Pt(e));
|
|
2668
2681
|
case 2:
|
|
2669
|
-
return r = t.sent, t.abrupt("return",
|
|
2682
|
+
return r = t.sent, t.abrupt("return", Ot(r));
|
|
2670
2683
|
case 4:
|
|
2671
2684
|
case "end":
|
|
2672
2685
|
return t.stop();
|
|
@@ -2674,21 +2687,21 @@ function St(e) {
|
|
|
2674
2687
|
}, t);
|
|
2675
2688
|
}));
|
|
2676
2689
|
}
|
|
2677
|
-
function
|
|
2678
|
-
return lt
|
|
2690
|
+
function Tt(e) {
|
|
2691
|
+
return ft(lt, St, e);
|
|
2679
2692
|
}
|
|
2680
|
-
function
|
|
2681
|
-
return
|
|
2693
|
+
function At(e) {
|
|
2694
|
+
return ft(dt, xt, e);
|
|
2682
2695
|
}
|
|
2683
|
-
function
|
|
2684
|
-
return
|
|
2696
|
+
function Et(e) {
|
|
2697
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2685
2698
|
var r;
|
|
2686
|
-
return
|
|
2699
|
+
return _e().wrap(function (t) {
|
|
2687
2700
|
for (;;) switch (t.prev = t.next) {
|
|
2688
2701
|
case 0:
|
|
2689
|
-
return t.next = 2, navigator.credentials.get(
|
|
2702
|
+
return t.next = 2, navigator.credentials.get(Tt(e));
|
|
2690
2703
|
case 2:
|
|
2691
|
-
return r = t.sent, t.abrupt("return",
|
|
2704
|
+
return r = t.sent, t.abrupt("return", At(r));
|
|
2692
2705
|
case 4:
|
|
2693
2706
|
case "end":
|
|
2694
2707
|
return t.stop();
|
|
@@ -2696,22 +2709,22 @@ function Pt(e) {
|
|
|
2696
2709
|
}, t);
|
|
2697
2710
|
}));
|
|
2698
2711
|
}
|
|
2699
|
-
var
|
|
2712
|
+
var Dt = function () {
|
|
2700
2713
|
function e(t, r, n) {
|
|
2701
|
-
|
|
2714
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n, this.checkEligibleInputs = function () {
|
|
2702
2715
|
return !(document.querySelectorAll("input[autocomplete*='webauthn']").length < 1) || (console.error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected'), !1);
|
|
2703
2716
|
};
|
|
2704
2717
|
}
|
|
2705
|
-
return
|
|
2718
|
+
return ve(e, [{
|
|
2706
2719
|
key: "register",
|
|
2707
2720
|
value: function value(e) {
|
|
2708
2721
|
var t, r;
|
|
2709
|
-
return
|
|
2722
|
+
return Ae(this, void 0, void 0, _e().mark(function n() {
|
|
2710
2723
|
var i, s, o, a, c;
|
|
2711
|
-
return
|
|
2724
|
+
return _e().wrap(function (n) {
|
|
2712
2725
|
for (;;) switch (n.prev = n.next) {
|
|
2713
2726
|
case 0:
|
|
2714
|
-
return
|
|
2727
|
+
return Je("stytch.webauthn.register").isOptionalString("domain", null == e ? void 0 : e.domain).isOptionalString("authenticator_type", null == e ? void 0 : e.authenticator_type).isOptionalBoolean("is_passkey", null == e ? void 0 : e.is_passkey).isOptionalNumber("session_duration_minutes", null == e ? void 0 : e.session_duration_minutes), n.next = 3, this._networkClient.fetchSDK({
|
|
2715
2728
|
url: "/webauthn/register/start",
|
|
2716
2729
|
method: "POST",
|
|
2717
2730
|
errorMessage: "Failed to start WebAuthn registration",
|
|
@@ -2723,7 +2736,7 @@ var Ot = function () {
|
|
|
2723
2736
|
}
|
|
2724
2737
|
});
|
|
2725
2738
|
case 3:
|
|
2726
|
-
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8,
|
|
2739
|
+
return i = n.sent, s = i.public_key_credential_creation_options, o = JSON.parse(s), n.next = 8, Ct({
|
|
2727
2740
|
publicKey: o
|
|
2728
2741
|
});
|
|
2729
2742
|
case 8:
|
|
@@ -2745,7 +2758,7 @@ var Ot = function () {
|
|
|
2745
2758
|
session_token: c.session_token,
|
|
2746
2759
|
session_jwt: c.session_jwt,
|
|
2747
2760
|
intermediate_session_token: null
|
|
2748
|
-
}), n.abrupt("return",
|
|
2761
|
+
}), n.abrupt("return", Xe(c));
|
|
2749
2762
|
case 14:
|
|
2750
2763
|
case "end":
|
|
2751
2764
|
return n.stop();
|
|
@@ -2757,12 +2770,12 @@ var Ot = function () {
|
|
|
2757
2770
|
key: "authenticate",
|
|
2758
2771
|
value: function value(e) {
|
|
2759
2772
|
var t, r;
|
|
2760
|
-
return
|
|
2773
|
+
return Ae(this, void 0, void 0, _e().mark(function n() {
|
|
2761
2774
|
var i, s, o, a, c, u, l, d, h, p, f, _;
|
|
2762
|
-
return
|
|
2775
|
+
return _e().wrap(function (n) {
|
|
2763
2776
|
for (;;) switch (n.prev = n.next) {
|
|
2764
2777
|
case 0:
|
|
2765
|
-
return
|
|
2778
|
+
return Je("stytch.webauthn.authenticate").isOptionalString("domain", e.domain).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalBoolean("is_passkey", e.is_passkey).isOptionalObject("signal", e.signal), n.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2766
2779
|
case 3:
|
|
2767
2780
|
if (i = n.sent, s = i.dfp_telemetry_id, o = i.captcha_token, !e.conditional_mediation) {
|
|
2768
2781
|
n.next = 14;
|
|
@@ -2797,7 +2810,7 @@ var Ot = function () {
|
|
|
2797
2810
|
signal: null !== (r = e.signal) && void 0 !== r ? r : d.signal
|
|
2798
2811
|
}, p = Object.assign(Object.assign({}, h), {
|
|
2799
2812
|
mediation: "conditional"
|
|
2800
|
-
}), n.next = 25,
|
|
2813
|
+
}), n.next = 25, Et(e.conditional_mediation ? p : h);
|
|
2801
2814
|
case 25:
|
|
2802
2815
|
return f = n.sent, n.next = 28, this._networkClient.retriableFetchSDK({
|
|
2803
2816
|
url: "/webauthn/authenticate",
|
|
@@ -2820,7 +2833,7 @@ var Ot = function () {
|
|
|
2820
2833
|
session_token: _.session_token,
|
|
2821
2834
|
session_jwt: _.session_jwt,
|
|
2822
2835
|
intermediate_session_token: null
|
|
2823
|
-
}), n.abrupt("return",
|
|
2836
|
+
}), n.abrupt("return", Xe(_));
|
|
2824
2837
|
case 31:
|
|
2825
2838
|
case "end":
|
|
2826
2839
|
return n.stop();
|
|
@@ -2831,9 +2844,9 @@ var Ot = function () {
|
|
|
2831
2844
|
}, {
|
|
2832
2845
|
key: "update",
|
|
2833
2846
|
value: function value(e) {
|
|
2834
|
-
return
|
|
2847
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2835
2848
|
var r;
|
|
2836
|
-
return
|
|
2849
|
+
return _e().wrap(function (t) {
|
|
2837
2850
|
for (;;) switch (t.prev = t.next) {
|
|
2838
2851
|
case 0:
|
|
2839
2852
|
return r = "/webauthn/update/" + e.webauthn_registration_id, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2856,9 +2869,9 @@ var Ot = function () {
|
|
|
2856
2869
|
}, {
|
|
2857
2870
|
key: "browserSupportsAutofill",
|
|
2858
2871
|
value: function value() {
|
|
2859
|
-
return
|
|
2872
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
2860
2873
|
var t;
|
|
2861
|
-
return
|
|
2874
|
+
return _e().wrap(function (e) {
|
|
2862
2875
|
for (;;) switch (e.prev = e.next) {
|
|
2863
2876
|
case 0:
|
|
2864
2877
|
if (void 0 !== (t = window.PublicKeyCredential) && void 0 !== t.isConditionalMediationAvailable) {
|
|
@@ -2879,21 +2892,21 @@ var Ot = function () {
|
|
|
2879
2892
|
}
|
|
2880
2893
|
}]), e;
|
|
2881
2894
|
}(),
|
|
2882
|
-
|
|
2895
|
+
Rt = Promise.resolve({
|
|
2883
2896
|
pkceRequiredForPasswordResets: !1
|
|
2884
2897
|
}),
|
|
2885
|
-
|
|
2898
|
+
It = function () {
|
|
2886
2899
|
function e(t, r, n) {
|
|
2887
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2888
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2889
|
-
|
|
2900
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : Rt,
|
|
2901
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Qe();
|
|
2902
|
+
ge(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = s;
|
|
2890
2903
|
}
|
|
2891
|
-
return
|
|
2904
|
+
return ve(e, [{
|
|
2892
2905
|
key: "getCodeChallenge",
|
|
2893
2906
|
value: function value() {
|
|
2894
|
-
return
|
|
2907
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
2895
2908
|
var t, r;
|
|
2896
|
-
return
|
|
2909
|
+
return _e().wrap(function (e) {
|
|
2897
2910
|
for (;;) switch (e.prev = e.next) {
|
|
2898
2911
|
case 0:
|
|
2899
2912
|
return e.next = 2, this._config;
|
|
@@ -2925,12 +2938,12 @@ var Ot = function () {
|
|
|
2925
2938
|
}, {
|
|
2926
2939
|
key: "create",
|
|
2927
2940
|
value: function value(e) {
|
|
2928
|
-
return
|
|
2941
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2929
2942
|
var r, n, i, s;
|
|
2930
|
-
return
|
|
2943
|
+
return _e().wrap(function (t) {
|
|
2931
2944
|
for (;;) switch (t.prev = t.next) {
|
|
2932
2945
|
case 0:
|
|
2933
|
-
return
|
|
2946
|
+
return Je("stytch.passwords.create").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2934
2947
|
case 3:
|
|
2935
2948
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2936
2949
|
url: "/passwords",
|
|
@@ -2954,7 +2967,7 @@ var Ot = function () {
|
|
|
2954
2967
|
session_token: s.session_token,
|
|
2955
2968
|
session_jwt: s.session_jwt,
|
|
2956
2969
|
intermediate_session_token: null
|
|
2957
|
-
}), t.abrupt("return",
|
|
2970
|
+
}), t.abrupt("return", Xe(s));
|
|
2958
2971
|
case 11:
|
|
2959
2972
|
case "end":
|
|
2960
2973
|
return t.stop();
|
|
@@ -2965,12 +2978,12 @@ var Ot = function () {
|
|
|
2965
2978
|
}, {
|
|
2966
2979
|
key: "authenticate",
|
|
2967
2980
|
value: function value(e) {
|
|
2968
|
-
return
|
|
2981
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
2969
2982
|
var r, n, i, s;
|
|
2970
|
-
return
|
|
2983
|
+
return _e().wrap(function (t) {
|
|
2971
2984
|
for (;;) switch (t.prev = t.next) {
|
|
2972
2985
|
case 0:
|
|
2973
|
-
return
|
|
2986
|
+
return Je("stytch.passwords.authenticate").isString("password", e.password).isString("email", e.email).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2974
2987
|
case 3:
|
|
2975
2988
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2976
2989
|
url: "/passwords/authenticate",
|
|
@@ -2994,7 +3007,7 @@ var Ot = function () {
|
|
|
2994
3007
|
session_token: s.session_token,
|
|
2995
3008
|
session_jwt: s.session_jwt,
|
|
2996
3009
|
intermediate_session_token: null
|
|
2997
|
-
}), t.abrupt("return",
|
|
3010
|
+
}), t.abrupt("return", Xe(s));
|
|
2998
3011
|
case 11:
|
|
2999
3012
|
case "end":
|
|
3000
3013
|
return t.stop();
|
|
@@ -3005,12 +3018,12 @@ var Ot = function () {
|
|
|
3005
3018
|
}, {
|
|
3006
3019
|
key: "resetByEmailStart",
|
|
3007
3020
|
value: function value(e) {
|
|
3008
|
-
return
|
|
3021
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
3009
3022
|
var r, n, i, s;
|
|
3010
|
-
return
|
|
3023
|
+
return _e().wrap(function (t) {
|
|
3011
3024
|
for (;;) switch (t.prev = t.next) {
|
|
3012
3025
|
case 0:
|
|
3013
|
-
return
|
|
3026
|
+
return Je("stytch.passwords.resetByEmailStart").isString("email", e.email).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
3014
3027
|
case 3:
|
|
3015
3028
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3016
3029
|
case 6:
|
|
@@ -3040,12 +3053,12 @@ var Ot = function () {
|
|
|
3040
3053
|
}, {
|
|
3041
3054
|
key: "resetByEmail",
|
|
3042
3055
|
value: function value(e) {
|
|
3043
|
-
return
|
|
3056
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
3044
3057
|
var r, n, i, s, o, a;
|
|
3045
|
-
return
|
|
3058
|
+
return _e().wrap(function (t) {
|
|
3046
3059
|
for (;;) switch (t.prev = t.next) {
|
|
3047
3060
|
case 0:
|
|
3048
|
-
return
|
|
3061
|
+
return Je("stytch.passwords.resetByEmail").isString("token", e.token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3049
3062
|
case 3:
|
|
3050
3063
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
3051
3064
|
case 8:
|
|
@@ -3072,7 +3085,7 @@ var Ot = function () {
|
|
|
3072
3085
|
session_token: a.session_token,
|
|
3073
3086
|
session_jwt: a.session_jwt,
|
|
3074
3087
|
intermediate_session_token: null
|
|
3075
|
-
}), t.abrupt("return",
|
|
3088
|
+
}), t.abrupt("return", Xe(a));
|
|
3076
3089
|
case 16:
|
|
3077
3090
|
case "end":
|
|
3078
3091
|
return t.stop();
|
|
@@ -3083,12 +3096,12 @@ var Ot = function () {
|
|
|
3083
3096
|
}, {
|
|
3084
3097
|
key: "resetByExistingPassword",
|
|
3085
3098
|
value: function value(e) {
|
|
3086
|
-
return
|
|
3099
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
3087
3100
|
var r, n, i, s;
|
|
3088
|
-
return
|
|
3101
|
+
return _e().wrap(function (t) {
|
|
3089
3102
|
for (;;) switch (t.prev = t.next) {
|
|
3090
3103
|
case 0:
|
|
3091
|
-
return
|
|
3104
|
+
return Je("stytch.passwords.resetByExistingPassword").isString("email", e.email).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isNumber("session_duration_minutes", e.session_duration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3092
3105
|
case 3:
|
|
3093
3106
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3094
3107
|
url: "/passwords/existing_password/reset",
|
|
@@ -3113,7 +3126,7 @@ var Ot = function () {
|
|
|
3113
3126
|
session_token: s.session_token,
|
|
3114
3127
|
session_jwt: s.session_jwt,
|
|
3115
3128
|
intermediate_session_token: null
|
|
3116
|
-
}), t.abrupt("return",
|
|
3129
|
+
}), t.abrupt("return", Xe(s));
|
|
3117
3130
|
case 11:
|
|
3118
3131
|
case "end":
|
|
3119
3132
|
return t.stop();
|
|
@@ -3124,12 +3137,12 @@ var Ot = function () {
|
|
|
3124
3137
|
}, {
|
|
3125
3138
|
key: "resetBySession",
|
|
3126
3139
|
value: function value(e) {
|
|
3127
|
-
return
|
|
3140
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
3128
3141
|
var r, n, i, s;
|
|
3129
|
-
return
|
|
3142
|
+
return _e().wrap(function (t) {
|
|
3130
3143
|
for (;;) switch (t.prev = t.next) {
|
|
3131
3144
|
case 0:
|
|
3132
|
-
return
|
|
3145
|
+
return Je("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3133
3146
|
case 3:
|
|
3134
3147
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
3135
3148
|
url: "/passwords/session/reset",
|
|
@@ -3163,11 +3176,11 @@ var Ot = function () {
|
|
|
3163
3176
|
}, {
|
|
3164
3177
|
key: "strengthCheck",
|
|
3165
3178
|
value: function value(e) {
|
|
3166
|
-
return
|
|
3167
|
-
return
|
|
3179
|
+
return Ae(this, void 0, void 0, _e().mark(function t() {
|
|
3180
|
+
return _e().wrap(function (t) {
|
|
3168
3181
|
for (;;) switch (t.prev = t.next) {
|
|
3169
3182
|
case 0:
|
|
3170
|
-
return
|
|
3183
|
+
return Je("stytch.passwords.strengthCheck").isOptionalString("email", e.email).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
3171
3184
|
url: "/passwords/strength_check",
|
|
3172
3185
|
method: "POST",
|
|
3173
3186
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3190,15 +3203,15 @@ Promise.resolve({
|
|
|
3190
3203
|
}), Promise.resolve({
|
|
3191
3204
|
pkceRequiredForPasswordResets: !1
|
|
3192
3205
|
});
|
|
3193
|
-
var
|
|
3206
|
+
var Ft = function () {
|
|
3194
3207
|
function e(t) {
|
|
3195
|
-
|
|
3208
|
+
ge(this, e), this.iframeURL = t, this.createIframe();
|
|
3196
3209
|
}
|
|
3197
|
-
return
|
|
3210
|
+
return ve(e, [{
|
|
3198
3211
|
key: "createIframe",
|
|
3199
3212
|
value: function value() {
|
|
3200
3213
|
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3201
|
-
e ?
|
|
3214
|
+
e ? ze("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.") : ((e = document.createElement("iframe")).src = this.iframeURL, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e)), "true" !== e.dataset.loaded ? this.frame = new Promise(function (t) {
|
|
3202
3215
|
e.addEventListener("load", function () {
|
|
3203
3216
|
e.dataset.loaded = "true", t(e);
|
|
3204
3217
|
}, {
|
|
@@ -3209,11 +3222,11 @@ var Et = function () {
|
|
|
3209
3222
|
}, {
|
|
3210
3223
|
key: "call",
|
|
3211
3224
|
value: function value(e, t) {
|
|
3212
|
-
return
|
|
3225
|
+
return Ae(this, void 0, void 0, _e().mark(function r() {
|
|
3213
3226
|
var n,
|
|
3214
3227
|
i,
|
|
3215
3228
|
s = this;
|
|
3216
|
-
return
|
|
3229
|
+
return _e().wrap(function (r) {
|
|
3217
3230
|
for (;;) switch (r.prev = r.next) {
|
|
3218
3231
|
case 0:
|
|
3219
3232
|
return r.next = 2, this.frame;
|
|
@@ -3222,7 +3235,7 @@ var Et = function () {
|
|
|
3222
3235
|
var a;
|
|
3223
3236
|
i.port1.onmessage = function (e) {
|
|
3224
3237
|
var t = e.data;
|
|
3225
|
-
i.port1.close(), t.success ? r(t.payload) : o(
|
|
3238
|
+
i.port1.close(), t.success ? r(t.payload) : o(et.unmarshall(t.error));
|
|
3226
3239
|
};
|
|
3227
3240
|
var c = {
|
|
3228
3241
|
method: e,
|
|
@@ -3239,15 +3252,58 @@ var Et = function () {
|
|
|
3239
3252
|
}
|
|
3240
3253
|
}]), e;
|
|
3241
3254
|
}(),
|
|
3242
|
-
|
|
3255
|
+
jt = function () {
|
|
3256
|
+
function e(t) {
|
|
3257
|
+
ge(this, e), this._networkClient = t;
|
|
3258
|
+
}
|
|
3259
|
+
return ve(e, [{
|
|
3260
|
+
key: "searchUser",
|
|
3261
|
+
value: function value(e) {
|
|
3262
|
+
return this._networkClient.fetchSDK({
|
|
3263
|
+
url: "/users/search",
|
|
3264
|
+
method: "POST",
|
|
3265
|
+
body: {
|
|
3266
|
+
email: e
|
|
3267
|
+
},
|
|
3268
|
+
errorMessage: "Error searching for user ".concat(e)
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
}, {
|
|
3272
|
+
key: "searchOrganization",
|
|
3273
|
+
value: function value(e) {
|
|
3274
|
+
return this._networkClient.fetchSDK({
|
|
3275
|
+
url: "/b2b/organizations/search",
|
|
3276
|
+
method: "POST",
|
|
3277
|
+
body: {
|
|
3278
|
+
organization_slug: e
|
|
3279
|
+
},
|
|
3280
|
+
errorMessage: "Error searching slug"
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3283
|
+
}, {
|
|
3284
|
+
key: "searchMember",
|
|
3285
|
+
value: function value(e, t) {
|
|
3286
|
+
return this._networkClient.fetchSDK({
|
|
3287
|
+
url: "/b2b/organizations/members/search",
|
|
3288
|
+
method: "POST",
|
|
3289
|
+
body: {
|
|
3290
|
+
email_address: e,
|
|
3291
|
+
organization_id: t
|
|
3292
|
+
},
|
|
3293
|
+
errorMessage: "Error searching for member ".concat(e)
|
|
3294
|
+
});
|
|
3295
|
+
}
|
|
3296
|
+
}]), e;
|
|
3297
|
+
}(),
|
|
3298
|
+
Bt = function () {
|
|
3243
3299
|
function e(t, r) {
|
|
3244
3300
|
var n = this;
|
|
3245
|
-
|
|
3301
|
+
ge(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3246
3302
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3247
3303
|
}, this._reauthenticateWithBackoff = function () {
|
|
3248
|
-
return
|
|
3304
|
+
return Ae(n, void 0, void 0, _e().mark(function t() {
|
|
3249
3305
|
var r;
|
|
3250
|
-
return
|
|
3306
|
+
return _e().wrap(function (t) {
|
|
3251
3307
|
for (;;) switch (t.prev = t.next) {
|
|
3252
3308
|
case 0:
|
|
3253
3309
|
r = 0;
|
|
@@ -3276,14 +3332,14 @@ var Et = function () {
|
|
|
3276
3332
|
}));
|
|
3277
3333
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3278
3334
|
}
|
|
3279
|
-
return
|
|
3335
|
+
return ve(e, [{
|
|
3280
3336
|
key: "performBackgroundRefresh",
|
|
3281
3337
|
value: function value() {
|
|
3282
3338
|
var e = this;
|
|
3283
3339
|
this._reauthenticateWithBackoff().then(function () {
|
|
3284
3340
|
e.scheduleBackgroundRefresh();
|
|
3285
3341
|
})["catch"](function (t) {
|
|
3286
|
-
|
|
3342
|
+
ze("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3287
3343
|
error: t
|
|
3288
3344
|
}), e._subscriptionService.destroySession();
|
|
3289
3345
|
});
|
|
@@ -3313,20 +3369,20 @@ var Et = function () {
|
|
|
3313
3369
|
}
|
|
3314
3370
|
}]), e;
|
|
3315
3371
|
}();
|
|
3316
|
-
|
|
3317
|
-
var
|
|
3318
|
-
var
|
|
3319
|
-
function
|
|
3372
|
+
Bt.REFRESH_INTERVAL_MS = 18e4;
|
|
3373
|
+
var Lt = "bootstrap";
|
|
3374
|
+
var Mt = /*#__PURE__*/function () {
|
|
3375
|
+
function Mt(e, t, r) {
|
|
3320
3376
|
var _this = this;
|
|
3321
|
-
_classCallCheck(this,
|
|
3377
|
+
_classCallCheck(this, Mt);
|
|
3322
3378
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3323
3379
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3324
3380
|
method: "GET",
|
|
3325
3381
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3326
|
-
}).then(
|
|
3327
|
-
return _this._dataLayer.setItem(
|
|
3382
|
+
}).then(Mt.mapBootstrapData).then(function (e) {
|
|
3383
|
+
return _this._dataLayer.setItem(Lt, JSON.stringify(e)), e;
|
|
3328
3384
|
})["catch"](function (e) {
|
|
3329
|
-
return
|
|
3385
|
+
return Ve(e), {
|
|
3330
3386
|
displayWatermark: !1,
|
|
3331
3387
|
cnameDomain: null,
|
|
3332
3388
|
emailDomains: ["stytch.com"],
|
|
@@ -3345,10 +3401,10 @@ var It = /*#__PURE__*/function () {
|
|
|
3345
3401
|
};
|
|
3346
3402
|
});
|
|
3347
3403
|
}
|
|
3348
|
-
_createClass(
|
|
3404
|
+
_createClass(Mt, [{
|
|
3349
3405
|
key: "getSync",
|
|
3350
3406
|
value: function getSync() {
|
|
3351
|
-
var e = this._dataLayer.getItem(
|
|
3407
|
+
var e = this._dataLayer.getItem(Lt);
|
|
3352
3408
|
if (null === e) return {
|
|
3353
3409
|
displayWatermark: !1,
|
|
3354
3410
|
cnameDomain: null,
|
|
@@ -3419,9 +3475,9 @@ var It = /*#__PURE__*/function () {
|
|
|
3419
3475
|
};
|
|
3420
3476
|
}
|
|
3421
3477
|
}]);
|
|
3422
|
-
return
|
|
3478
|
+
return Mt;
|
|
3423
3479
|
}();
|
|
3424
|
-
function
|
|
3480
|
+
function Ut(e, t, r, n) {
|
|
3425
3481
|
return new (r || (r = Promise))(function (i, s) {
|
|
3426
3482
|
function o(e) {
|
|
3427
3483
|
try {
|
|
@@ -3447,11 +3503,11 @@ function Ft(e, t, r, n) {
|
|
|
3447
3503
|
});
|
|
3448
3504
|
}
|
|
3449
3505
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3450
|
-
var
|
|
3506
|
+
var Nt = /*#__PURE__*/_createClass(function Nt(e) {
|
|
3451
3507
|
var _this2 = this;
|
|
3452
|
-
_classCallCheck(this,
|
|
3508
|
+
_classCallCheck(this, Nt);
|
|
3453
3509
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3454
|
-
return
|
|
3510
|
+
return Ut(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3455
3511
|
var _yield$this$state, e, t, r;
|
|
3456
3512
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3457
3513
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3482,7 +3538,7 @@ var jt = /*#__PURE__*/_createClass(function jt(e) {
|
|
|
3482
3538
|
}, _callee, this);
|
|
3483
3539
|
}));
|
|
3484
3540
|
}, this.state = e.then(function (e) {
|
|
3485
|
-
return
|
|
3541
|
+
return Ut(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3486
3542
|
var t;
|
|
3487
3543
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3488
3544
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3493,7 +3549,7 @@ var jt = /*#__PURE__*/_createClass(function jt(e) {
|
|
|
3493
3549
|
}
|
|
3494
3550
|
_context2.t1 = !0;
|
|
3495
3551
|
_context2.next = 4;
|
|
3496
|
-
return t = e.captchaSettings.siteKey,
|
|
3552
|
+
return t = e.captchaSettings.siteKey, Ke("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3497
3553
|
return window.grecaptcha.enterprise;
|
|
3498
3554
|
});
|
|
3499
3555
|
case 4:
|
|
@@ -3520,10 +3576,10 @@ var jt = /*#__PURE__*/_createClass(function jt(e) {
|
|
|
3520
3576
|
}));
|
|
3521
3577
|
});
|
|
3522
3578
|
});
|
|
3523
|
-
var
|
|
3524
|
-
function
|
|
3579
|
+
var Kt = /*#__PURE__*/function () {
|
|
3580
|
+
function Kt(e) {
|
|
3525
3581
|
var _this3 = this;
|
|
3526
|
-
_classCallCheck(this,
|
|
3582
|
+
_classCallCheck(this, Kt);
|
|
3527
3583
|
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3528
3584
|
return _this3.call("oneTapStart", e);
|
|
3529
3585
|
}, this.oneTapSubmit = function (e) {
|
|
@@ -3532,11 +3588,11 @@ var Lt = /*#__PURE__*/function () {
|
|
|
3532
3588
|
return _this3.call("parsedPhoneNumber", e);
|
|
3533
3589
|
};
|
|
3534
3590
|
}
|
|
3535
|
-
_createClass(
|
|
3591
|
+
_createClass(Kt, [{
|
|
3536
3592
|
key: "frameClient",
|
|
3537
3593
|
get: function get() {
|
|
3538
3594
|
var e;
|
|
3539
|
-
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new
|
|
3595
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new Ft(this.iframeURL), this._frameClient;
|
|
3540
3596
|
}
|
|
3541
3597
|
}, {
|
|
3542
3598
|
key: "call",
|
|
@@ -3544,15 +3600,15 @@ var Lt = /*#__PURE__*/function () {
|
|
|
3544
3600
|
return this.frameClient.call(e, [t]);
|
|
3545
3601
|
}
|
|
3546
3602
|
}]);
|
|
3547
|
-
return
|
|
3603
|
+
return Kt;
|
|
3548
3604
|
}();
|
|
3549
|
-
var
|
|
3550
|
-
_inherits(
|
|
3551
|
-
function
|
|
3605
|
+
var qt = /*#__PURE__*/function (_at) {
|
|
3606
|
+
_inherits(qt, _at);
|
|
3607
|
+
function qt(e, t, r, n, i, s) {
|
|
3552
3608
|
var _this4;
|
|
3553
|
-
_classCallCheck(this,
|
|
3554
|
-
_this4 = _callSuper(this,
|
|
3555
|
-
return
|
|
3609
|
+
_classCallCheck(this, qt);
|
|
3610
|
+
_this4 = _callSuper(this, qt, [e, t, r, n, i]), _this4._oneTap = s, _this4.startOneTap = function (e) {
|
|
3611
|
+
return Ut(_assertThisInitialized(_this4), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3556
3612
|
var t, r, n;
|
|
3557
3613
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3558
3614
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -3590,20 +3646,20 @@ var Bt = /*#__PURE__*/function (_nt) {
|
|
|
3590
3646
|
};
|
|
3591
3647
|
return _this4;
|
|
3592
3648
|
}
|
|
3593
|
-
return _createClass(
|
|
3594
|
-
}(
|
|
3595
|
-
var
|
|
3596
|
-
function
|
|
3597
|
-
_classCallCheck(this,
|
|
3649
|
+
return _createClass(qt);
|
|
3650
|
+
}(at);
|
|
3651
|
+
var Wt = /*#__PURE__*/function () {
|
|
3652
|
+
function Wt(e, t, r, n) {
|
|
3653
|
+
_classCallCheck(this, Wt);
|
|
3598
3654
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3599
3655
|
return null;
|
|
3600
|
-
}, this.eventLogger = new
|
|
3656
|
+
}, this.eventLogger = new tt({
|
|
3601
3657
|
maxBatchSize: 15,
|
|
3602
3658
|
intervalDurationMs: 800,
|
|
3603
3659
|
logEventURL: this.buildSDKUrl("/events")
|
|
3604
3660
|
});
|
|
3605
3661
|
}
|
|
3606
|
-
_createClass(
|
|
3662
|
+
_createClass(Wt, [{
|
|
3607
3663
|
key: "logEvent",
|
|
3608
3664
|
value: function logEvent(_ref) {
|
|
3609
3665
|
var e = _ref.name,
|
|
@@ -3623,9 +3679,9 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3623
3679
|
key: "createTelemetryBlob",
|
|
3624
3680
|
value: function createTelemetryBlob() {
|
|
3625
3681
|
return Object.assign(Object.assign({
|
|
3626
|
-
event_id: "event-id-".concat(
|
|
3627
|
-
app_session_id: "app-session-id-".concat(
|
|
3628
|
-
persistent_id: "persistent-id-".concat(
|
|
3682
|
+
event_id: "event-id-".concat(Ue()),
|
|
3683
|
+
app_session_id: "app-session-id-".concat(Ue()),
|
|
3684
|
+
persistent_id: "persistent-id-".concat(Ue()),
|
|
3629
3685
|
client_sent_at: new Date().toISOString(),
|
|
3630
3686
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3631
3687
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3634,7 +3690,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3634
3690
|
},
|
|
3635
3691
|
sdk: {
|
|
3636
3692
|
identifier: "Stytch.js Javascript SDK",
|
|
3637
|
-
version: "4.
|
|
3693
|
+
version: "4.7.0"
|
|
3638
3694
|
}
|
|
3639
3695
|
});
|
|
3640
3696
|
}
|
|
@@ -3645,13 +3701,13 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3645
3701
|
t = _ref2.body,
|
|
3646
3702
|
r = _ref2.errorMessage,
|
|
3647
3703
|
n = _ref2.method;
|
|
3648
|
-
return
|
|
3704
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3649
3705
|
var i, s, o, a;
|
|
3650
3706
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3651
3707
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3652
3708
|
case 0:
|
|
3653
3709
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), o = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3654
|
-
return _context4.abrupt("return",
|
|
3710
|
+
return _context4.abrupt("return", Re({
|
|
3655
3711
|
basicAuthHeader: s,
|
|
3656
3712
|
body: t,
|
|
3657
3713
|
errorMessage: r,
|
|
@@ -3675,7 +3731,7 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3675
3731
|
r = _ref3.errorMessage,
|
|
3676
3732
|
n = _ref3.method,
|
|
3677
3733
|
i = _ref3.retryCallback;
|
|
3678
|
-
return
|
|
3734
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3679
3735
|
var s, o, a, c;
|
|
3680
3736
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3681
3737
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3690,9 +3746,9 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3690
3746
|
o = e.xSDKParentHostHeader,
|
|
3691
3747
|
a = e.body,
|
|
3692
3748
|
c = e.retryCallback;
|
|
3693
|
-
return
|
|
3749
|
+
return Ae(this, void 0, void 0, _e().mark(function e() {
|
|
3694
3750
|
var u;
|
|
3695
|
-
return
|
|
3751
|
+
return _e().wrap(function (e) {
|
|
3696
3752
|
for (;;) switch (e.prev = e.next) {
|
|
3697
3753
|
case 0:
|
|
3698
3754
|
return u = {
|
|
@@ -3703,18 +3759,18 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3703
3759
|
xSDKClientHeader: s,
|
|
3704
3760
|
xSDKParentHostHeader: o,
|
|
3705
3761
|
body: a
|
|
3706
|
-
}, e.prev = 1, e.next = 4,
|
|
3762
|
+
}, e.prev = 1, e.next = 4, Re(u);
|
|
3707
3763
|
case 4:
|
|
3708
3764
|
case 15:
|
|
3709
3765
|
return e.abrupt("return", e.sent);
|
|
3710
3766
|
case 7:
|
|
3711
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3767
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof De)) {
|
|
3712
3768
|
e.next = 16;
|
|
3713
3769
|
break;
|
|
3714
3770
|
}
|
|
3715
3771
|
return e.next = 12, c(e.t0, u);
|
|
3716
3772
|
case 12:
|
|
3717
|
-
return u = e.sent, e.next = 15,
|
|
3773
|
+
return u = e.sent, e.next = 15, Re(u);
|
|
3718
3774
|
case 16:
|
|
3719
3775
|
throw e.t0;
|
|
3720
3776
|
case 17:
|
|
@@ -3746,14 +3802,14 @@ var Mt = /*#__PURE__*/function () {
|
|
|
3746
3802
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3747
3803
|
}
|
|
3748
3804
|
}]);
|
|
3749
|
-
return
|
|
3805
|
+
return Wt;
|
|
3750
3806
|
}();
|
|
3751
|
-
var
|
|
3752
|
-
function
|
|
3753
|
-
_classCallCheck(this,
|
|
3807
|
+
var Gt = /*#__PURE__*/function () {
|
|
3808
|
+
function Gt(e, t, r) {
|
|
3809
|
+
_classCallCheck(this, Gt);
|
|
3754
3810
|
this._googleClient = e, this._publicToken = t, this._clientId = r;
|
|
3755
3811
|
}
|
|
3756
|
-
_createClass(
|
|
3812
|
+
_createClass(Gt, [{
|
|
3757
3813
|
key: "cancel",
|
|
3758
3814
|
value: function cancel() {
|
|
3759
3815
|
this._googleClient.cancel();
|
|
@@ -3764,7 +3820,7 @@ var Ut = /*#__PURE__*/function () {
|
|
|
3764
3820
|
var e = _ref4.callback,
|
|
3765
3821
|
t = _ref4.onOneTapCancelled,
|
|
3766
3822
|
r = _ref4.style;
|
|
3767
|
-
return
|
|
3823
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3768
3824
|
var _this5 = this;
|
|
3769
3825
|
var n;
|
|
3770
3826
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3802,22 +3858,22 @@ var Ut = /*#__PURE__*/function () {
|
|
|
3802
3858
|
key: "styleFrame",
|
|
3803
3859
|
value: function styleFrame(e) {
|
|
3804
3860
|
e.position === exports.OneTapPositions.embedded && Array.from(document.getElementsByTagName("iframe")).forEach(function (e) {
|
|
3805
|
-
e.src.includes(
|
|
3861
|
+
e.src.includes(Oe) && (e.style.width = "100%");
|
|
3806
3862
|
});
|
|
3807
3863
|
}
|
|
3808
3864
|
}]);
|
|
3809
|
-
return
|
|
3865
|
+
return Gt;
|
|
3810
3866
|
}();
|
|
3811
|
-
var
|
|
3812
|
-
function
|
|
3867
|
+
var Ht = /*#__PURE__*/function () {
|
|
3868
|
+
function Ht(e, t) {
|
|
3813
3869
|
var _this6 = this;
|
|
3814
|
-
_classCallCheck(this,
|
|
3870
|
+
_classCallCheck(this, Ht);
|
|
3815
3871
|
this._publicToken = e, this.clientsideServices = t, this.createOnSuccessHandler = function (_ref5) {
|
|
3816
3872
|
var e = _ref5.loginRedirectUrl,
|
|
3817
3873
|
t = _ref5.signupRedirectUrl,
|
|
3818
3874
|
r = _ref5.onSuccess;
|
|
3819
3875
|
return function (n) {
|
|
3820
|
-
return
|
|
3876
|
+
return Ut(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3821
3877
|
var i, _yield$this$submitGoo, s;
|
|
3822
3878
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3823
3879
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -3844,10 +3900,10 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3844
3900
|
window.location.href = e;
|
|
3845
3901
|
};
|
|
3846
3902
|
}
|
|
3847
|
-
_createClass(
|
|
3903
|
+
_createClass(Ht, [{
|
|
3848
3904
|
key: "createOneTapClient",
|
|
3849
3905
|
value: function createOneTapClient() {
|
|
3850
|
-
return
|
|
3906
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3851
3907
|
var e, _yield$this$fetchGoog;
|
|
3852
3908
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3853
3909
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -3878,9 +3934,9 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3878
3934
|
});
|
|
3879
3935
|
case 12:
|
|
3880
3936
|
_context8.t1 = !0;
|
|
3881
|
-
_context8.t2 =
|
|
3937
|
+
_context8.t2 = Gt;
|
|
3882
3938
|
_context8.next = 16;
|
|
3883
|
-
return
|
|
3939
|
+
return Ke(Ce, function () {
|
|
3884
3940
|
return window.google.accounts.id;
|
|
3885
3941
|
});
|
|
3886
3942
|
case 16:
|
|
@@ -3912,7 +3968,7 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3912
3968
|
var e = _ref6.credential,
|
|
3913
3969
|
t = _ref6.loginRedirectUrl,
|
|
3914
3970
|
r = _ref6.signupRedirectUrl;
|
|
3915
|
-
return
|
|
3971
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3916
3972
|
var _yield$this$fetchGoog2, n;
|
|
3917
3973
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3918
3974
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -3949,21 +4005,21 @@ var Nt = /*#__PURE__*/function () {
|
|
|
3949
4005
|
}, {
|
|
3950
4006
|
key: "WillGoogleOneTapShowEmbedded",
|
|
3951
4007
|
value: function WillGoogleOneTapShowEmbedded() {
|
|
3952
|
-
return !
|
|
4008
|
+
return !Ht.WillGoogleOneTapShowBannerForUA(navigator.userAgent);
|
|
3953
4009
|
}
|
|
3954
4010
|
}]);
|
|
3955
|
-
return
|
|
4011
|
+
return Ht;
|
|
3956
4012
|
}();
|
|
3957
|
-
function
|
|
4013
|
+
function zt(e) {
|
|
3958
4014
|
var t = e.toString(16);
|
|
3959
4015
|
return 1 === t.length && (t = "0" + t), t;
|
|
3960
4016
|
}
|
|
3961
|
-
var
|
|
3962
|
-
function
|
|
3963
|
-
_classCallCheck(this,
|
|
4017
|
+
var Vt = /*#__PURE__*/function () {
|
|
4018
|
+
function Vt(e, t) {
|
|
4019
|
+
_classCallCheck(this, Vt);
|
|
3964
4020
|
this._dataLayer = e, this.namespace = t;
|
|
3965
4021
|
}
|
|
3966
|
-
_createClass(
|
|
4022
|
+
_createClass(Vt, [{
|
|
3967
4023
|
key: "key",
|
|
3968
4024
|
value: function key() {
|
|
3969
4025
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3971,13 +4027,13 @@ var qt = /*#__PURE__*/function () {
|
|
|
3971
4027
|
}, {
|
|
3972
4028
|
key: "startPKCETransaction",
|
|
3973
4029
|
value: function startPKCETransaction() {
|
|
3974
|
-
return
|
|
4030
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3975
4031
|
var e;
|
|
3976
4032
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3977
4033
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3978
4034
|
case 0:
|
|
3979
4035
|
_context10.next = 2;
|
|
3980
|
-
return
|
|
4036
|
+
return Vt.createProofkeyPair();
|
|
3981
4037
|
case 2:
|
|
3982
4038
|
e = _context10.sent;
|
|
3983
4039
|
return _context10.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3995,7 +4051,7 @@ var qt = /*#__PURE__*/function () {
|
|
|
3995
4051
|
if (null !== e) try {
|
|
3996
4052
|
return JSON.parse(e);
|
|
3997
4053
|
} catch (e) {
|
|
3998
|
-
return void
|
|
4054
|
+
return void ze("Found malformed Proof Key pair in localstorage.");
|
|
3999
4055
|
}
|
|
4000
4056
|
}
|
|
4001
4057
|
}, {
|
|
@@ -4006,7 +4062,7 @@ var qt = /*#__PURE__*/function () {
|
|
|
4006
4062
|
}], [{
|
|
4007
4063
|
key: "createProofkeyPair",
|
|
4008
4064
|
value: function createProofkeyPair() {
|
|
4009
|
-
return
|
|
4065
|
+
return Ut(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
4010
4066
|
var _String$fromCharCode;
|
|
4011
4067
|
var e, t, r, n;
|
|
4012
4068
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
@@ -4014,7 +4070,7 @@ var qt = /*#__PURE__*/function () {
|
|
|
4014
4070
|
case 0:
|
|
4015
4071
|
e = new Uint32Array(16);
|
|
4016
4072
|
window.crypto.getRandomValues(e);
|
|
4017
|
-
t = Array.from(e).map(
|
|
4073
|
+
t = Array.from(e).map(zt).join("");
|
|
4018
4074
|
_context11.next = 5;
|
|
4019
4075
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4020
4076
|
case 5:
|
|
@@ -4031,54 +4087,9 @@ var qt = /*#__PURE__*/function () {
|
|
|
4031
4087
|
}));
|
|
4032
4088
|
}
|
|
4033
4089
|
}]);
|
|
4034
|
-
return
|
|
4090
|
+
return Vt;
|
|
4035
4091
|
}();
|
|
4036
|
-
var
|
|
4037
|
-
function Wt(e) {
|
|
4038
|
-
_classCallCheck(this, Wt);
|
|
4039
|
-
this._networkClient = e;
|
|
4040
|
-
}
|
|
4041
|
-
_createClass(Wt, [{
|
|
4042
|
-
key: "searchUser",
|
|
4043
|
-
value: function searchUser(e) {
|
|
4044
|
-
return this._networkClient.fetchSDK({
|
|
4045
|
-
url: "/users/search",
|
|
4046
|
-
method: "POST",
|
|
4047
|
-
body: {
|
|
4048
|
-
email: e
|
|
4049
|
-
},
|
|
4050
|
-
errorMessage: "Error searching for user ".concat(e)
|
|
4051
|
-
});
|
|
4052
|
-
}
|
|
4053
|
-
}, {
|
|
4054
|
-
key: "searchOrganization",
|
|
4055
|
-
value: function searchOrganization(e) {
|
|
4056
|
-
return this._networkClient.fetchSDK({
|
|
4057
|
-
url: "/b2b/organizations/search",
|
|
4058
|
-
method: "POST",
|
|
4059
|
-
body: {
|
|
4060
|
-
organization_slug: e
|
|
4061
|
-
},
|
|
4062
|
-
errorMessage: "Error searching slug"
|
|
4063
|
-
});
|
|
4064
|
-
}
|
|
4065
|
-
}, {
|
|
4066
|
-
key: "searchMember",
|
|
4067
|
-
value: function searchMember(e, t) {
|
|
4068
|
-
return this._networkClient.fetchSDK({
|
|
4069
|
-
url: "/b2b/organizations/members/search",
|
|
4070
|
-
method: "POST",
|
|
4071
|
-
body: {
|
|
4072
|
-
email_address: e,
|
|
4073
|
-
organization_id: t
|
|
4074
|
-
},
|
|
4075
|
-
errorMessage: "Error searching for member ".concat(e)
|
|
4076
|
-
});
|
|
4077
|
-
}
|
|
4078
|
-
}]);
|
|
4079
|
-
return Wt;
|
|
4080
|
-
}();
|
|
4081
|
-
var Gt = function Gt(e) {
|
|
4092
|
+
var Yt = function Yt(e) {
|
|
4082
4093
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4083
4094
|
var _t$split = t.split("="),
|
|
4084
4095
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4087,17 +4098,17 @@ var Gt = function Gt(e) {
|
|
|
4087
4098
|
}).length > 1;
|
|
4088
4099
|
};
|
|
4089
4100
|
/*! js-cookie v3.0.1 | MIT */
|
|
4090
|
-
function
|
|
4101
|
+
function Jt(e) {
|
|
4091
4102
|
for (var t = 1; t < arguments.length; t++) {
|
|
4092
4103
|
var r = arguments[t];
|
|
4093
4104
|
for (var n in r) e[n] = r[n];
|
|
4094
4105
|
}
|
|
4095
4106
|
return e;
|
|
4096
4107
|
}
|
|
4097
|
-
var
|
|
4108
|
+
var $t = function e(t, r) {
|
|
4098
4109
|
function n(e, n, i) {
|
|
4099
4110
|
if ("undefined" != typeof document) {
|
|
4100
|
-
"number" == typeof (i =
|
|
4111
|
+
"number" == typeof (i = Jt({}, 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);
|
|
4101
4112
|
var s = "";
|
|
4102
4113
|
for (var o in i) i[o] && (s += "; " + o, !0 !== i[o] && (s += "=" + i[o].split(";")[0]));
|
|
4103
4114
|
return document.cookie = e + "=" + t.write(n, e) + s;
|
|
@@ -4119,15 +4130,15 @@ var zt = function e(t, r) {
|
|
|
4119
4130
|
}
|
|
4120
4131
|
},
|
|
4121
4132
|
remove: function remove(e, t) {
|
|
4122
|
-
n(e, "",
|
|
4133
|
+
n(e, "", Jt({}, t, {
|
|
4123
4134
|
expires: -1
|
|
4124
4135
|
}));
|
|
4125
4136
|
},
|
|
4126
4137
|
withAttributes: function withAttributes(t) {
|
|
4127
|
-
return e(this.converter,
|
|
4138
|
+
return e(this.converter, Jt({}, this.attributes, t));
|
|
4128
4139
|
},
|
|
4129
4140
|
withConverter: function withConverter(t) {
|
|
4130
|
-
return e(
|
|
4141
|
+
return e(Jt({}, this.converter, t), this.attributes);
|
|
4131
4142
|
}
|
|
4132
4143
|
}, {
|
|
4133
4144
|
attributes: {
|
|
@@ -4147,37 +4158,37 @@ var zt = function e(t, r) {
|
|
|
4147
4158
|
}, {
|
|
4148
4159
|
path: "/"
|
|
4149
4160
|
});
|
|
4150
|
-
var
|
|
4161
|
+
var Xt = function Xt(e) {
|
|
4151
4162
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4152
4163
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4153
4164
|
},
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
clearTimeout(
|
|
4165
|
+
Zt = new Map(),
|
|
4166
|
+
Qt = function Qt(e) {
|
|
4167
|
+
clearTimeout(Zt.get(e));
|
|
4157
4168
|
},
|
|
4158
|
-
|
|
4159
|
-
|
|
4169
|
+
er = function er(e, t, r) {
|
|
4170
|
+
Qt(e);
|
|
4160
4171
|
var n = setTimeout(function () {
|
|
4161
|
-
void 0 ===
|
|
4172
|
+
void 0 === $t.get(e) && $t.set(e, t, r);
|
|
4162
4173
|
}, 10);
|
|
4163
|
-
return
|
|
4174
|
+
return Zt.set(e, n), $t.set(e, t, r);
|
|
4164
4175
|
};
|
|
4165
|
-
var
|
|
4166
|
-
function
|
|
4176
|
+
var tr = /*#__PURE__*/function () {
|
|
4177
|
+
function tr(e, t) {
|
|
4167
4178
|
var _this7 = this;
|
|
4168
|
-
_classCallCheck(this,
|
|
4179
|
+
_classCallCheck(this, tr);
|
|
4169
4180
|
this.browserSessionStorage = {
|
|
4170
4181
|
getItem: function getItem(e) {
|
|
4171
|
-
return sessionStorage.getItem(
|
|
4182
|
+
return sessionStorage.getItem(Xt(_this7.publicToken, e));
|
|
4172
4183
|
},
|
|
4173
4184
|
setItem: function setItem(e, t) {
|
|
4174
|
-
return sessionStorage.setItem(
|
|
4185
|
+
return sessionStorage.setItem(Xt(_this7.publicToken, e), t);
|
|
4175
4186
|
},
|
|
4176
4187
|
removeItem: function removeItem(e) {
|
|
4177
|
-
return sessionStorage.removeItem(
|
|
4188
|
+
return sessionStorage.removeItem(Xt(_this7.publicToken, e));
|
|
4178
4189
|
}
|
|
4179
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4180
|
-
var r = localStorage.getItem(
|
|
4190
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Je("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);
|
|
4191
|
+
var r = localStorage.getItem(Xt(this.publicToken));
|
|
4181
4192
|
if (!r) return;
|
|
4182
4193
|
var n;
|
|
4183
4194
|
try {
|
|
@@ -4187,7 +4198,7 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4187
4198
|
}
|
|
4188
4199
|
this.state = n;
|
|
4189
4200
|
}
|
|
4190
|
-
_createClass(
|
|
4201
|
+
_createClass(tr, [{
|
|
4191
4202
|
key: "opaqueTokenCookieName",
|
|
4192
4203
|
get: function get() {
|
|
4193
4204
|
var e;
|
|
@@ -4209,14 +4220,14 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4209
4220
|
key: "readSessionCookie",
|
|
4210
4221
|
value: function readSessionCookie() {
|
|
4211
4222
|
return {
|
|
4212
|
-
session_token:
|
|
4213
|
-
session_jwt:
|
|
4223
|
+
session_token: $t.get(this.opaqueTokenCookieName),
|
|
4224
|
+
session_jwt: $t.get(this.jwtCookieName)
|
|
4214
4225
|
};
|
|
4215
4226
|
}
|
|
4216
4227
|
}, {
|
|
4217
4228
|
key: "readIntermediateSessionTokenCookie",
|
|
4218
4229
|
value: function readIntermediateSessionTokenCookie() {
|
|
4219
|
-
return
|
|
4230
|
+
return $t.get(this.istCookieName);
|
|
4220
4231
|
}
|
|
4221
4232
|
}, {
|
|
4222
4233
|
key: "writeSessionCookie",
|
|
@@ -4225,32 +4236,32 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4225
4236
|
var s = e.state,
|
|
4226
4237
|
o = e.session_token,
|
|
4227
4238
|
a = e.session_jwt,
|
|
4228
|
-
c =
|
|
4239
|
+
c = tr.generateCookieOpts({
|
|
4229
4240
|
expiresAt: null !== (r = null === (t = null == s ? void 0 : s.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4230
4241
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4231
4242
|
path: this._cookiePath,
|
|
4232
4243
|
domain: this._domain
|
|
4233
4244
|
});
|
|
4234
|
-
|
|
4235
|
-
var u =
|
|
4245
|
+
er(this.opaqueTokenCookieName, o, c), er(this.jwtCookieName, a, c);
|
|
4246
|
+
var u = tr.generateCookieOpts({
|
|
4236
4247
|
expiresAt: null !== (i = null === (n = null == s ? void 0 : s.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4237
4248
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4238
4249
|
path: this._cookiePath,
|
|
4239
4250
|
domain: this._domain
|
|
4240
4251
|
});
|
|
4241
|
-
|
|
4252
|
+
Yt(this.jwtCookieName) && $t.remove(this.jwtCookieName, u), Yt(this.opaqueTokenCookieName) && $t.remove(this.opaqueTokenCookieName, u), Yt(this.jwtCookieName) && ze("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Yt(this.opaqueTokenCookieName) && ze("Could not remove extraneous opaque token cookie.");
|
|
4242
4253
|
}
|
|
4243
4254
|
}, {
|
|
4244
4255
|
key: "writeIntermediateSessionTokenCookie",
|
|
4245
4256
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4246
4257
|
var t = new Date(Date.now() + 6e5),
|
|
4247
|
-
r =
|
|
4258
|
+
r = tr.generateCookieOpts({
|
|
4248
4259
|
expiresAt: t.toString(),
|
|
4249
4260
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4250
4261
|
path: this._cookiePath,
|
|
4251
4262
|
domain: this._domain
|
|
4252
4263
|
});
|
|
4253
|
-
|
|
4264
|
+
er(this.istCookieName, e, r);
|
|
4254
4265
|
}
|
|
4255
4266
|
}, {
|
|
4256
4267
|
key: "removeSessionCookie",
|
|
@@ -4269,38 +4280,38 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4269
4280
|
[!0, !1].forEach(function (t) {
|
|
4270
4281
|
[_this8._cookiePath, null].forEach(function (r) {
|
|
4271
4282
|
[_this8._domain, null].forEach(function (n) {
|
|
4272
|
-
var i =
|
|
4283
|
+
var i = tr.generateCookieOpts({
|
|
4273
4284
|
expiresAt: new Date(0).toString(),
|
|
4274
4285
|
availableToSubdomains: t,
|
|
4275
4286
|
path: r,
|
|
4276
4287
|
domain: n
|
|
4277
4288
|
});
|
|
4278
4289
|
e.forEach(function (e) {
|
|
4279
|
-
|
|
4290
|
+
$t.remove(e, i);
|
|
4280
4291
|
});
|
|
4281
4292
|
});
|
|
4282
4293
|
});
|
|
4283
|
-
}), e.forEach(
|
|
4294
|
+
}), e.forEach(Qt);
|
|
4284
4295
|
}
|
|
4285
4296
|
}, {
|
|
4286
4297
|
key: "syncToLocalStorage",
|
|
4287
4298
|
value: function syncToLocalStorage() {
|
|
4288
|
-
localStorage.setItem(
|
|
4299
|
+
localStorage.setItem(Xt(this.publicToken), JSON.stringify(this.state));
|
|
4289
4300
|
}
|
|
4290
4301
|
}, {
|
|
4291
4302
|
key: "getItem",
|
|
4292
4303
|
value: function getItem(e) {
|
|
4293
|
-
return localStorage.getItem(
|
|
4304
|
+
return localStorage.getItem(Xt(this.publicToken, e));
|
|
4294
4305
|
}
|
|
4295
4306
|
}, {
|
|
4296
4307
|
key: "setItem",
|
|
4297
4308
|
value: function setItem(e, t) {
|
|
4298
|
-
return localStorage.setItem(
|
|
4309
|
+
return localStorage.setItem(Xt(this.publicToken, e), t);
|
|
4299
4310
|
}
|
|
4300
4311
|
}, {
|
|
4301
4312
|
key: "removeItem",
|
|
4302
4313
|
value: function removeItem(e) {
|
|
4303
|
-
return localStorage.removeItem(
|
|
4314
|
+
return localStorage.removeItem(Xt(this.publicToken, e));
|
|
4304
4315
|
}
|
|
4305
4316
|
}, {
|
|
4306
4317
|
key: "markStateKeysUpdated",
|
|
@@ -4325,40 +4336,40 @@ var Xt = /*#__PURE__*/function () {
|
|
|
4325
4336
|
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;
|
|
4326
4337
|
}
|
|
4327
4338
|
}]);
|
|
4328
|
-
return
|
|
4339
|
+
return tr;
|
|
4329
4340
|
}();
|
|
4330
|
-
var
|
|
4331
|
-
_inherits(
|
|
4332
|
-
function
|
|
4333
|
-
_classCallCheck(this,
|
|
4334
|
-
return _callSuper(this,
|
|
4341
|
+
var rr = /*#__PURE__*/function (_tr) {
|
|
4342
|
+
_inherits(rr, _tr);
|
|
4343
|
+
function rr() {
|
|
4344
|
+
_classCallCheck(this, rr);
|
|
4345
|
+
return _callSuper(this, rr, arguments);
|
|
4335
4346
|
}
|
|
4336
|
-
return _createClass(
|
|
4337
|
-
}(
|
|
4338
|
-
var
|
|
4339
|
-
|
|
4347
|
+
return _createClass(rr);
|
|
4348
|
+
}(tr);
|
|
4349
|
+
var nr = Symbol["for"]("__stytch_DataLayer"),
|
|
4350
|
+
ir = function ir(e, t) {
|
|
4340
4351
|
var r = function () {
|
|
4341
4352
|
var e = window;
|
|
4342
|
-
return e[
|
|
4353
|
+
return e[nr] || (e[nr] = {}), e[nr];
|
|
4343
4354
|
}();
|
|
4344
|
-
return r[e] || (r[e] = new
|
|
4355
|
+
return r[e] || (r[e] = new rr(e, t)), r[e];
|
|
4345
4356
|
},
|
|
4346
|
-
|
|
4357
|
+
sr = function sr(e, t) {
|
|
4347
4358
|
Object.values(e).forEach(function (e) {
|
|
4348
4359
|
return e(t);
|
|
4349
4360
|
});
|
|
4350
4361
|
},
|
|
4351
|
-
|
|
4362
|
+
or = function () {
|
|
4352
4363
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4353
4364
|
t = void 0 === e ? [] : e;
|
|
4354
4365
|
return function e(r, n) {
|
|
4355
|
-
return
|
|
4366
|
+
return fe(r) === fe(n) && (null === r || null === n ? r === n : "object" === fe(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4356
4367
|
return !(e in n);
|
|
4357
4368
|
}) && Object.entries(r).filter(function (e) {
|
|
4358
|
-
var r =
|
|
4369
|
+
var r = de(e, 1)[0];
|
|
4359
4370
|
return !t.includes(r);
|
|
4360
4371
|
}).every(function (t) {
|
|
4361
|
-
var r =
|
|
4372
|
+
var r = de(t, 2),
|
|
4362
4373
|
i = r[0],
|
|
4363
4374
|
s = r[1];
|
|
4364
4375
|
return e(s, n[i]);
|
|
@@ -4367,12 +4378,12 @@ var Qt = Symbol["for"]("__stytch_DataLayer"),
|
|
|
4367
4378
|
}({
|
|
4368
4379
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4369
4380
|
});
|
|
4370
|
-
var
|
|
4371
|
-
function
|
|
4381
|
+
var ar = /*#__PURE__*/function () {
|
|
4382
|
+
function ar(e, t) {
|
|
4372
4383
|
var _this10 = this;
|
|
4373
|
-
_classCallCheck(this,
|
|
4384
|
+
_classCallCheck(this, ar);
|
|
4374
4385
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4375
|
-
if (e.key !==
|
|
4386
|
+
if (e.key !== Xt(_this10._publicToken)) return;
|
|
4376
4387
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4377
4388
|
_this10.updateState(t);
|
|
4378
4389
|
}, window.addEventListener("storage", this._listen);
|
|
@@ -4380,7 +4391,7 @@ var nr = /*#__PURE__*/function () {
|
|
|
4380
4391
|
r = _this$_datalayer$read.session_token;
|
|
4381
4392
|
r || this.destroySession();
|
|
4382
4393
|
}
|
|
4383
|
-
_createClass(
|
|
4394
|
+
_createClass(ar, [{
|
|
4384
4395
|
key: "getTokens",
|
|
4385
4396
|
value: function getTokens() {
|
|
4386
4397
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4418,7 +4429,7 @@ var nr = /*#__PURE__*/function () {
|
|
|
4418
4429
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4419
4430
|
this._datalayer.state = r;
|
|
4420
4431
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4421
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4432
|
+
!this._datalayer.markStateKeysUpdated(n) && or(t, r) || sr(this._datalayer.subscriptions, r);
|
|
4422
4433
|
}
|
|
4423
4434
|
}, {
|
|
4424
4435
|
key: "updateStateAndTokens",
|
|
@@ -4433,8 +4444,8 @@ var nr = /*#__PURE__*/function () {
|
|
|
4433
4444
|
this._datalayer.state = r;
|
|
4434
4445
|
var n = e ? Object.keys(e) : [],
|
|
4435
4446
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4436
|
-
s = !
|
|
4437
|
-
(i || s) && (
|
|
4447
|
+
s = !or(t, r);
|
|
4448
|
+
(i || s) && (sr(this._datalayer.subscriptions, r), s && this._datalayer.syncToLocalStorage());
|
|
4438
4449
|
}
|
|
4439
4450
|
}, {
|
|
4440
4451
|
key: "updateTokens",
|
|
@@ -4474,14 +4485,14 @@ var nr = /*#__PURE__*/function () {
|
|
|
4474
4485
|
return null;
|
|
4475
4486
|
}
|
|
4476
4487
|
}]);
|
|
4477
|
-
return
|
|
4488
|
+
return ar;
|
|
4478
4489
|
}();
|
|
4479
|
-
var
|
|
4480
|
-
_inherits(
|
|
4481
|
-
function
|
|
4490
|
+
var cr = /*#__PURE__*/function (_ar) {
|
|
4491
|
+
_inherits(cr, _ar);
|
|
4492
|
+
function cr() {
|
|
4482
4493
|
var _this11;
|
|
4483
|
-
_classCallCheck(this,
|
|
4484
|
-
_this11 = _callSuper(this,
|
|
4494
|
+
_classCallCheck(this, cr);
|
|
4495
|
+
_this11 = _callSuper(this, cr, arguments), _this11.updateUser = function (e) {
|
|
4485
4496
|
return _this11.updateState({
|
|
4486
4497
|
user: e
|
|
4487
4498
|
});
|
|
@@ -4494,10 +4505,10 @@ var ir = /*#__PURE__*/function (_nr) {
|
|
|
4494
4505
|
};
|
|
4495
4506
|
return _this11;
|
|
4496
4507
|
}
|
|
4497
|
-
return _createClass(
|
|
4498
|
-
}(
|
|
4499
|
-
var
|
|
4500
|
-
exports.BiometricsFailedError =
|
|
4508
|
+
return _createClass(cr);
|
|
4509
|
+
}(ar);
|
|
4510
|
+
var ur = Symbol["for"]("stytch__internal_b2c");
|
|
4511
|
+
exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = B, exports.ChallengeSigningFailedError = Y, exports.DeviceCredentialsNotAllowedError = q, exports.FailedCodeChallengeError = $, exports.FailedToDecryptDataError = Z, exports.InternalError = F, exports.InvalidAuthorizationCredentialError = z, exports.InvalidCredentialTypeError = ne, exports.InvalidRedirectSchemeError = te, exports.InvalidStartUrlError = ee, exports.JSONDataNotConvertibleToStringError = se, exports.KeyInvalidatedError = L, exports.KeystoreUnavailableError = M, exports.MissingAttestationObjectError = ie, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = W, exports.MissingPKCEError = G, exports.MissingPublicKeyError = V, exports.MissingUrlError = re, exports.NoBiometricsEnrolledError = U, exports.NoBiometricsRegistrationError = j, exports.NoCurrentSessionError = I, exports.PasskeysInvalidEncoding = ae, exports.PasskeysMisconfigured = ce, exports.PasskeysUnsupportedError = X, exports.RandomNumberGenerationFailed = oe, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = J, exports.SignInWithAppleMisconfigured = ue, exports.StytchAPIError = D, exports.StytchAPISchemaError = E, exports.StytchAPIUnreachableError = A, exports.StytchError = T, exports.StytchHeadlessClient = /*#__PURE__*/function () {
|
|
4501
4512
|
function _class(e, t) {
|
|
4502
4513
|
var _this12 = this;
|
|
4503
4514
|
_classCallCheck(this, _class);
|
|
@@ -4505,7 +4516,7 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = F, expor
|
|
|
4505
4516
|
!function (e) {
|
|
4506
4517
|
var t = "StytchUIClient" === e ? "import { createStytchUIClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchUIClient('public-token-...');\n" : "import { createStytchHeadlessClient } from '@stytch/nextjs/ui';\n \nconst stytch = createStytchHeadlessClient('public-token-...');\n";
|
|
4507
4518
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat(t, "\n```\n"));
|
|
4508
|
-
}("StytchHeadlessClient"), "string" != typeof (r = e) ?
|
|
4519
|
+
}("StytchHeadlessClient"), "string" != typeof (r = e) ? ze("Public token is malformed. Expected a string, got ".concat(fe(r), ".").concat(Ye)) : "" === r ? ze('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ye)) : r.startsWith("public-token-") || ze('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ye));
|
|
4509
4520
|
var n = t,
|
|
4510
4521
|
i = {
|
|
4511
4522
|
cookieOptions: null == (s = n) ? void 0 : s.cookieOptions,
|
|
@@ -4518,27 +4529,27 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = F, expor
|
|
|
4518
4529
|
}
|
|
4519
4530
|
};
|
|
4520
4531
|
var s, o, a, c, u, l, d, h, p, f, _;
|
|
4521
|
-
this._dataLayer =
|
|
4522
|
-
var m = new
|
|
4523
|
-
this._networkClient = new
|
|
4532
|
+
this._dataLayer = ir(e, n), this._subscriptionService = new cr(e, this._dataLayer);
|
|
4533
|
+
var m = new Vt(this._dataLayer, "passwords");
|
|
4534
|
+
this._networkClient = new Wt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4524
4535
|
var e, t, r, n;
|
|
4525
4536
|
return {
|
|
4526
4537
|
stytch_user_id: null === (t = null === (e = _this12._dataLayer.state) || void 0 === e ? void 0 : e.user) || void 0 === t ? void 0 : t.user_id,
|
|
4527
4538
|
stytch_session_id: null === (n = null === (r = _this12._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.session_id
|
|
4528
4539
|
};
|
|
4529
4540
|
});
|
|
4530
|
-
var v = new
|
|
4531
|
-
y = new
|
|
4532
|
-
g = new
|
|
4533
|
-
b = new
|
|
4534
|
-
k = new
|
|
4535
|
-
w = new
|
|
4541
|
+
var v = new Mt(e, this._networkClient, this._dataLayer),
|
|
4542
|
+
y = new Nt(v.getAsync()),
|
|
4543
|
+
g = new Ze(e, i.endpoints.dfpBackendURL, v.getAsync(), y.executeRecaptcha),
|
|
4544
|
+
b = new Kt(i.endpoints.clientsideServicesIframeURL),
|
|
4545
|
+
k = new Ht(e, b),
|
|
4546
|
+
w = new jt(this._networkClient);
|
|
4536
4547
|
var S, x;
|
|
4537
|
-
this.user = new
|
|
4548
|
+
this.user = new rt(this._networkClient, this._subscriptionService), this.session = new nt(this._networkClient, this._subscriptionService), this.magicLinks = new st(this._networkClient, this._subscriptionService, new Vt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.otps = new ot(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.oauth = new qt(this._networkClient, this._subscriptionService, new Vt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4538
4549
|
publicToken: e,
|
|
4539
4550
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4540
4551
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4541
|
-
}, k), this.cryptoWallets = new
|
|
4552
|
+
}, k), this.cryptoWallets = new ct(this._networkClient, this._subscriptionService, y.executeRecaptcha, g), this.totps = new ut(this._networkClient, this._subscriptionService, g), this.webauthn = new Dt(this._networkClient, this._subscriptionService, g), this.passwords = new It(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this._sessionManager = new Bt(this._subscriptionService, this.session), this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4542
4553
|
name: "sdk_instance_instantiated",
|
|
4543
4554
|
details: {
|
|
4544
4555
|
event_callback_registered: !1,
|
|
@@ -4554,73 +4565,77 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = F, expor
|
|
|
4554
4565
|
publicToken: e,
|
|
4555
4566
|
dataLayer: this._dataLayer,
|
|
4556
4567
|
networkClient: this._networkClient
|
|
4557
|
-
}, Object.assign(S, _defineProperty({},
|
|
4568
|
+
}, Object.assign(S, _defineProperty({}, ur, x));
|
|
4558
4569
|
}
|
|
4559
4570
|
return _createClass(_class);
|
|
4560
|
-
}(), exports.StytchSDKAPIError =
|
|
4571
|
+
}(), exports.StytchSDKAPIError = O, exports.StytchSDKError = R, exports.StytchSDKSchemaError = P, exports.StytchSDKUsageError = x, exports.UNRECOVERABLE_ERROR_TYPES = C, exports.UserCancellationError = N, exports.UserLockedOutError = K, exports.errorToStytchError = function (e) {
|
|
4561
4572
|
switch (e.message) {
|
|
4562
4573
|
case "internal_error":
|
|
4563
|
-
return new
|
|
4574
|
+
return new F(e.message);
|
|
4564
4575
|
case "no_current_session":
|
|
4565
|
-
return new D();
|
|
4566
|
-
case "no_biometrics_registration":
|
|
4567
4576
|
return new I();
|
|
4577
|
+
case "no_biometrics_registration":
|
|
4578
|
+
return new j();
|
|
4568
4579
|
case "biometrics_unavailable":
|
|
4569
4580
|
case "device_hardware_error":
|
|
4570
4581
|
case "biometrics_not_available":
|
|
4571
|
-
return new
|
|
4582
|
+
return new B();
|
|
4572
4583
|
case "key_invalidated":
|
|
4573
4584
|
case "no_biometric_key":
|
|
4574
|
-
return new
|
|
4585
|
+
return new L();
|
|
4575
4586
|
case "no_biometrics_enrolled":
|
|
4576
|
-
return new
|
|
4587
|
+
return new U();
|
|
4577
4588
|
case "keystore_unavailable":
|
|
4578
|
-
return new
|
|
4589
|
+
return new M();
|
|
4579
4590
|
case "device_credentials_not_allowed":
|
|
4580
|
-
return new
|
|
4591
|
+
return new q();
|
|
4581
4592
|
case "user_cancellation":
|
|
4582
|
-
return new
|
|
4593
|
+
return new N();
|
|
4583
4594
|
case "user_locked_out":
|
|
4584
|
-
return new
|
|
4595
|
+
return new K();
|
|
4585
4596
|
case "google_onetap_missing_id_token":
|
|
4586
4597
|
case "oauth_apple_missing_id_token":
|
|
4587
4598
|
case "missing_authorization_credential_id_token":
|
|
4588
|
-
return new
|
|
4599
|
+
return new H();
|
|
4589
4600
|
case "google_onetap_missing_member":
|
|
4590
4601
|
case "oauth_apple_credential_invalid":
|
|
4591
4602
|
case "invalid_authorization_credential":
|
|
4592
|
-
return new
|
|
4603
|
+
return new z();
|
|
4593
4604
|
case "missing_public_key":
|
|
4594
|
-
return new
|
|
4605
|
+
return new V();
|
|
4595
4606
|
case "challenge_signing_failed":
|
|
4596
|
-
return new z();
|
|
4597
|
-
case "sdk_not_configured":
|
|
4598
4607
|
return new Y();
|
|
4608
|
+
case "sdk_not_configured":
|
|
4609
|
+
return new J();
|
|
4599
4610
|
case "failed_code_challenge":
|
|
4600
|
-
return new
|
|
4611
|
+
return new $();
|
|
4601
4612
|
case "passkeys_unsupported":
|
|
4602
|
-
return new
|
|
4613
|
+
return new X();
|
|
4603
4614
|
case "failed_to_decrypt_data":
|
|
4604
|
-
return new
|
|
4615
|
+
return new Z();
|
|
4605
4616
|
case "biometrics_failed":
|
|
4606
|
-
return new
|
|
4617
|
+
return new Q();
|
|
4607
4618
|
case "invalid_start_url":
|
|
4608
|
-
return new
|
|
4619
|
+
return new ee();
|
|
4609
4620
|
case "invalid_redirect_scheme":
|
|
4610
|
-
return new
|
|
4621
|
+
return new te();
|
|
4611
4622
|
case "missing_url":
|
|
4612
|
-
return new
|
|
4623
|
+
return new re();
|
|
4613
4624
|
case "invalid_credential_type":
|
|
4614
|
-
return new
|
|
4625
|
+
return new ne();
|
|
4615
4626
|
case "missing_attestation_object":
|
|
4616
|
-
return new
|
|
4627
|
+
return new ie();
|
|
4617
4628
|
case "json_data_not_convertible_to_string":
|
|
4618
|
-
return new
|
|
4629
|
+
return new se();
|
|
4619
4630
|
case "random_number_generation_failed":
|
|
4620
|
-
return new
|
|
4631
|
+
return new oe();
|
|
4621
4632
|
case "passkeys_invalid_encoding":
|
|
4622
|
-
return new
|
|
4633
|
+
return new ae();
|
|
4634
|
+
case "passkeys_misconfigured":
|
|
4635
|
+
return new ce();
|
|
4636
|
+
case "signinwithapple_misconfigured":
|
|
4637
|
+
return new ue();
|
|
4623
4638
|
default:
|
|
4624
|
-
return new
|
|
4639
|
+
return new R(e.name, e.message);
|
|
4625
4640
|
}
|
|
4626
4641
|
};
|