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