@stytch/vanilla-js 4.5.5 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/b2b/index.esm.js +5821 -4217
- package/dist/b2b/index.headless.esm.js +822 -674
- package/dist/b2b/index.headless.js +815 -671
- package/dist/b2b/index.js +5160 -3560
- package/dist/index.esm.js +4218 -4087
- package/dist/index.headless.esm.js +757 -738
- package/dist/index.headless.js +759 -744
- package/dist/index.js +4167 -4040
- package/package.json +10 -4
|
@@ -134,28 +134,29 @@ function d(e) {
|
|
|
134
134
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
135
135
|
}, d(e);
|
|
136
136
|
}
|
|
137
|
-
var h, p,
|
|
137
|
+
var h, p, f, _, m, v, b;
|
|
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, (
|
|
141
|
-
var
|
|
142
|
-
|
|
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, (b = exports.RNUIProducts || (exports.RNUIProducts = {}))[b.emailMagicLinks = 0] = "emailMagicLinks", b[b.oauth = 1] = "oauth", b[b.otp = 2] = "otp", b[b.passwords = 3] = "passwords";
|
|
141
|
+
var g,
|
|
142
|
+
y,
|
|
143
143
|
k,
|
|
144
|
-
|
|
144
|
+
w,
|
|
145
|
+
S = function (e) {
|
|
145
146
|
function t(e, r) {
|
|
146
147
|
var n;
|
|
147
148
|
return i(this, t), (n = o(this, t, [e + "\n" + r])).message = e + "\n" + r, n.name = "SDKAPIUnreachableError", n.details = r, Object.setPrototypeOf(s(n), t.prototype), n;
|
|
148
149
|
}
|
|
149
150
|
return a(t, c(Error)), r(t);
|
|
150
151
|
}(),
|
|
151
|
-
|
|
152
|
+
P = function (e) {
|
|
152
153
|
function t(e, r) {
|
|
153
154
|
var n;
|
|
154
155
|
return i(this, t), (n = o(this, t)).name = "StytchSDKUsageError", n.message = "Invalid call to ".concat(e, "\n") + r, n;
|
|
155
156
|
}
|
|
156
157
|
return a(t, c(Error)), r(t);
|
|
157
158
|
}(),
|
|
158
|
-
|
|
159
|
+
x = function (e) {
|
|
159
160
|
function t(e) {
|
|
160
161
|
var r, n;
|
|
161
162
|
i(this, t), (r = o(this, t)).name = "StytchSDKSchemaError";
|
|
@@ -166,7 +167,7 @@ var b,
|
|
|
166
167
|
}
|
|
167
168
|
return a(t, c(Error)), r(t);
|
|
168
169
|
}(),
|
|
169
|
-
|
|
170
|
+
C = function (e) {
|
|
170
171
|
function t(e) {
|
|
171
172
|
var r;
|
|
172
173
|
i(this, t), (r = o(this, t)).name = "StytchSDKAPIError";
|
|
@@ -179,22 +180,22 @@ var b,
|
|
|
179
180
|
}
|
|
180
181
|
return a(t, c(Error)), r(t);
|
|
181
182
|
}(),
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
T = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
184
|
+
O = function (e) {
|
|
184
185
|
function t(e, r) {
|
|
185
186
|
var n;
|
|
186
187
|
return i(this, t), (n = o(this, t, [r])).name = e, n;
|
|
187
188
|
}
|
|
188
189
|
return a(t, c(Error)), r(t);
|
|
189
190
|
}(),
|
|
190
|
-
|
|
191
|
+
E = function (e) {
|
|
191
192
|
function t(e) {
|
|
192
193
|
var r;
|
|
193
194
|
return i(this, t), r = o(this, t, ["StytchAPIUnreachableError", e]), Object.setPrototypeOf(s(r), t.prototype), r;
|
|
194
195
|
}
|
|
195
|
-
return a(t,
|
|
196
|
+
return a(t, O), r(t);
|
|
196
197
|
}(),
|
|
197
|
-
|
|
198
|
+
A = function (e) {
|
|
198
199
|
function t(e) {
|
|
199
200
|
var r;
|
|
200
201
|
i(this, t);
|
|
@@ -203,9 +204,9 @@ var b,
|
|
|
203
204
|
}).join("\n");
|
|
204
205
|
return o(this, t, ["StytchAPISchemaError", "Request does not match expected schema\n".concat(n)]);
|
|
205
206
|
}
|
|
206
|
-
return a(t,
|
|
207
|
+
return a(t, O), r(t);
|
|
207
208
|
}(),
|
|
208
|
-
|
|
209
|
+
D = function (e) {
|
|
209
210
|
function t(e) {
|
|
210
211
|
var r;
|
|
211
212
|
i(this, t);
|
|
@@ -216,190 +217,202 @@ var b,
|
|
|
216
217
|
u = e.request_id;
|
|
217
218
|
return (r = o(this, t, ["StytchAPIError", "[".concat(n, "] ").concat(s, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : "")])).error_type = s, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = n, r;
|
|
218
219
|
}
|
|
219
|
-
return a(t,
|
|
220
|
+
return a(t, O), r(t);
|
|
220
221
|
}(),
|
|
221
|
-
|
|
222
|
+
I = function (e) {
|
|
222
223
|
function t(e, r, n) {
|
|
223
224
|
var s;
|
|
224
225
|
return i(this, t), (s = o(this, t, [e, r])).options = n, s;
|
|
225
226
|
}
|
|
226
|
-
return a(t,
|
|
227
|
+
return a(t, O), r(t);
|
|
227
228
|
}(),
|
|
228
|
-
|
|
229
|
+
R = function (e) {
|
|
229
230
|
function t() {
|
|
230
231
|
return i(this, t), o(this, t, ["NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session."]);
|
|
231
232
|
}
|
|
232
|
-
return a(t,
|
|
233
|
+
return a(t, I), r(t);
|
|
233
234
|
}(),
|
|
234
|
-
|
|
235
|
+
B = function (e) {
|
|
235
236
|
function t(e) {
|
|
236
237
|
return i(this, t), o(this, t, ["InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs."]);
|
|
237
238
|
}
|
|
238
|
-
return a(t,
|
|
239
|
+
return a(t, I), r(t);
|
|
239
240
|
}(),
|
|
240
|
-
|
|
241
|
+
M = function (e) {
|
|
241
242
|
function t() {
|
|
242
243
|
return i(this, t), o(this, t, ["NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first."]);
|
|
243
244
|
}
|
|
244
|
-
return a(t,
|
|
245
|
+
return a(t, I), r(t);
|
|
245
246
|
}(),
|
|
246
|
-
|
|
247
|
+
F = function (e) {
|
|
247
248
|
function t() {
|
|
248
249
|
return i(this, t), o(this, t, ["BiometricsUnavailableError", "Biometrics is not available on the device."]);
|
|
249
250
|
}
|
|
250
|
-
return a(t,
|
|
251
|
+
return a(t, I), r(t);
|
|
251
252
|
}(),
|
|
252
|
-
|
|
253
|
+
j = function (e) {
|
|
253
254
|
function t() {
|
|
254
255
|
return i(this, t), o(this, t, ["KeyInvalidatedError", "The biometrics enrollment on the device has changed."]);
|
|
255
256
|
}
|
|
256
|
-
return a(t,
|
|
257
|
+
return a(t, I), r(t);
|
|
257
258
|
}(),
|
|
258
|
-
|
|
259
|
+
L = function (e) {
|
|
259
260
|
function t() {
|
|
260
261
|
return i(this, t), o(this, t, ["KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true."]);
|
|
261
262
|
}
|
|
262
|
-
return a(t,
|
|
263
|
+
return a(t, I), r(t);
|
|
263
264
|
}(),
|
|
264
|
-
|
|
265
|
+
K = function (e) {
|
|
265
266
|
function t() {
|
|
266
267
|
return i(this, t), o(this, t, ["NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings."]);
|
|
267
268
|
}
|
|
268
|
-
return a(t,
|
|
269
|
+
return a(t, I), r(t);
|
|
269
270
|
}(),
|
|
270
|
-
|
|
271
|
+
N = function (e) {
|
|
271
272
|
function t() {
|
|
272
273
|
return i(this, t), o(this, t, ["UserCancellationError", "The user canceled the prompt. Ask the user to try again."]);
|
|
273
274
|
}
|
|
274
|
-
return a(t,
|
|
275
|
+
return a(t, I), r(t);
|
|
275
276
|
}(),
|
|
276
|
-
|
|
277
|
+
U = function (e) {
|
|
277
278
|
function t() {
|
|
278
279
|
return i(this, t), o(this, t, ["UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later."]);
|
|
279
280
|
}
|
|
280
|
-
return a(t,
|
|
281
|
+
return a(t, I), r(t);
|
|
281
282
|
}(),
|
|
282
283
|
z = function (e) {
|
|
283
284
|
function t() {
|
|
284
285
|
return i(this, t), o(this, t, ["DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods."]);
|
|
285
286
|
}
|
|
286
|
-
return a(t,
|
|
287
|
+
return a(t, I), r(t);
|
|
287
288
|
}(),
|
|
288
|
-
|
|
289
|
+
q = function (e) {
|
|
289
290
|
function t() {
|
|
290
291
|
return i(this, t), o(this, t, ["MissingGoogleClientIDError", "No Google client ID was found in the project."]);
|
|
291
292
|
}
|
|
292
|
-
return a(t,
|
|
293
|
+
return a(t, I), r(t);
|
|
293
294
|
}(),
|
|
294
|
-
|
|
295
|
+
W = function (e) {
|
|
295
296
|
function t() {
|
|
296
297
|
return i(this, t), o(this, t, ["MissingPKCEError", "Make sure this flow is completed on the same device on which it was started."]);
|
|
297
298
|
}
|
|
298
|
-
return a(t,
|
|
299
|
+
return a(t, I), r(t);
|
|
299
300
|
}(),
|
|
300
|
-
|
|
301
|
+
H = function (e) {
|
|
301
302
|
function t() {
|
|
302
303
|
return i(this, t), o(this, t, ["MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token."]);
|
|
303
304
|
}
|
|
304
|
-
return a(t,
|
|
305
|
+
return a(t, I), r(t);
|
|
305
306
|
}(),
|
|
306
|
-
|
|
307
|
+
G = function (e) {
|
|
307
308
|
function t() {
|
|
308
309
|
return i(this, t), o(this, t, ["InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method."]);
|
|
309
310
|
}
|
|
310
|
-
return a(t,
|
|
311
|
+
return a(t, I), r(t);
|
|
311
312
|
}(),
|
|
312
|
-
|
|
313
|
+
V = function (e) {
|
|
313
314
|
function t() {
|
|
314
315
|
return i(this, t), o(this, t, ["MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration."]);
|
|
315
316
|
}
|
|
316
|
-
return a(t,
|
|
317
|
+
return a(t, I), r(t);
|
|
317
318
|
}(),
|
|
318
|
-
|
|
319
|
+
Y = function (e) {
|
|
319
320
|
function t() {
|
|
320
321
|
return i(this, t), o(this, t, ["ChallengeSigningFailedError", "Failed to sign the challenge with the key."]);
|
|
321
322
|
}
|
|
322
|
-
return a(t,
|
|
323
|
+
return a(t, I), r(t);
|
|
323
324
|
}(),
|
|
324
|
-
|
|
325
|
+
J = function (e) {
|
|
325
326
|
function t() {
|
|
326
327
|
return i(this, t), o(this, t, ["SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK"]);
|
|
327
328
|
}
|
|
328
|
-
return a(t,
|
|
329
|
+
return a(t, I), r(t);
|
|
329
330
|
}(),
|
|
330
|
-
|
|
331
|
+
$ = function (e) {
|
|
331
332
|
function t() {
|
|
332
333
|
return i(this, t), o(this, t, ["FailedCodeChallengeError", "Failed to create a code challenge"]);
|
|
333
334
|
}
|
|
334
|
-
return a(t,
|
|
335
|
+
return a(t, I), r(t);
|
|
335
336
|
}(),
|
|
336
|
-
|
|
337
|
+
X = function (e) {
|
|
337
338
|
function t() {
|
|
338
339
|
return i(this, t), o(this, t, ["PasskeysUnsupportedError", "Passkeys are not supported on this device"]);
|
|
339
340
|
}
|
|
340
|
-
return a(t,
|
|
341
|
+
return a(t, I), r(t);
|
|
341
342
|
}(),
|
|
342
|
-
|
|
343
|
+
Z = function (e) {
|
|
343
344
|
function t() {
|
|
344
345
|
return i(this, t), o(this, t, ["FailedToDecryptDataError", "Failed to decrypt user data"]);
|
|
345
346
|
}
|
|
346
|
-
return a(t,
|
|
347
|
+
return a(t, I), r(t);
|
|
347
348
|
}(),
|
|
348
|
-
|
|
349
|
+
Q = function (e) {
|
|
349
350
|
function t() {
|
|
350
351
|
return i(this, t), o(this, t, ["BiometricsFailedError", "Biometric authentication failed"]);
|
|
351
352
|
}
|
|
352
|
-
return a(t,
|
|
353
|
+
return a(t, I), r(t);
|
|
353
354
|
}(),
|
|
354
|
-
|
|
355
|
+
ee = function (e) {
|
|
355
356
|
function t() {
|
|
356
357
|
return i(this, t), o(this, t, ["InvalidStartUrlError", "The start URL was invalid or improperly formatted."]);
|
|
357
358
|
}
|
|
358
|
-
return a(t,
|
|
359
|
+
return a(t, I), r(t);
|
|
359
360
|
}(),
|
|
360
|
-
|
|
361
|
+
te = function (e) {
|
|
361
362
|
function t() {
|
|
362
363
|
return i(this, t), o(this, t, ["InvalidRedirectSchemeError", "The scheme from the given redirect urls was invalid. Possible reasons include: nil scheme, non-custom scheme (using http or https), or differing schemes for login/signup urls."]);
|
|
363
364
|
}
|
|
364
|
-
return a(t,
|
|
365
|
+
return a(t, I), r(t);
|
|
365
366
|
}(),
|
|
366
|
-
|
|
367
|
+
re = function (e) {
|
|
367
368
|
function t() {
|
|
368
369
|
return i(this, t), o(this, t, ["MissingUrlError", "The underlying web authentication service failed to return a URL."]);
|
|
369
370
|
}
|
|
370
|
-
return a(t,
|
|
371
|
+
return a(t, I), r(t);
|
|
371
372
|
}(),
|
|
372
|
-
|
|
373
|
+
ne = function (e) {
|
|
373
374
|
function t() {
|
|
374
375
|
return i(this, t), o(this, t, ["InvalidCredentialTypeError", "The public key credential type was not of the expected type."]);
|
|
375
376
|
}
|
|
376
|
-
return a(t,
|
|
377
|
+
return a(t, I), r(t);
|
|
377
378
|
}(),
|
|
378
|
-
|
|
379
|
+
ie = function (e) {
|
|
379
380
|
function t() {
|
|
380
381
|
return i(this, t), o(this, t, ["MissingAttestationObjectError", "The public key credential is missing the attestation object."]);
|
|
381
382
|
}
|
|
382
|
-
return a(t,
|
|
383
|
+
return a(t, I), r(t);
|
|
383
384
|
}(),
|
|
384
|
-
|
|
385
|
+
oe = function (e) {
|
|
385
386
|
function t() {
|
|
386
387
|
return i(this, t), o(this, t, ["JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type."]);
|
|
387
388
|
}
|
|
388
|
-
return a(t,
|
|
389
|
+
return a(t, I), r(t);
|
|
389
390
|
}(),
|
|
390
|
-
|
|
391
|
+
se = function (e) {
|
|
391
392
|
function t() {
|
|
392
393
|
return i(this, t), o(this, t, ["RandomNumberGenerationFailed", "Random number generation failed"]);
|
|
393
394
|
}
|
|
394
|
-
return a(t,
|
|
395
|
+
return a(t, I), r(t);
|
|
395
396
|
}(),
|
|
396
|
-
|
|
397
|
+
ae = function (e) {
|
|
397
398
|
function t() {
|
|
398
399
|
return i(this, t), o(this, t, ["PasskeysInvalidEncoding", "Invalid passkey encoding"]);
|
|
399
400
|
}
|
|
400
|
-
return a(t,
|
|
401
|
+
return a(t, I), r(t);
|
|
402
|
+
}(),
|
|
403
|
+
ce = function (e) {
|
|
404
|
+
function t() {
|
|
405
|
+
return i(this, t), o(this, t, ["PasskeysMisconfigured", "Passkeys are misconfigured. Verify that you have added the correct associated domain for your application, and that the signing information is correct."]);
|
|
406
|
+
}
|
|
407
|
+
return a(t, I), r(t);
|
|
408
|
+
}(),
|
|
409
|
+
ue = function (e) {
|
|
410
|
+
function t() {
|
|
411
|
+
return i(this, t), o(this, t, ["SignInWithAppleMisconfigured", "Sign In With Apple is misconfigured. Verify that you have correctly configured Apple OAuth in the Stytch Dashboard and added the Sign In With Apple capability to your project."]);
|
|
412
|
+
}
|
|
413
|
+
return a(t, I), r(t);
|
|
401
414
|
}();
|
|
402
|
-
function
|
|
415
|
+
function le(e, t) {
|
|
403
416
|
return function (e) {
|
|
404
417
|
if (Array.isArray(e)) return e;
|
|
405
418
|
}(e) || function (e, t) {
|
|
@@ -428,32 +441,32 @@ function se(e, t) {
|
|
|
428
441
|
}
|
|
429
442
|
return a;
|
|
430
443
|
}
|
|
431
|
-
}(e, t) ||
|
|
444
|
+
}(e, t) || de(e, t) || function () {
|
|
432
445
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
433
446
|
}();
|
|
434
447
|
}
|
|
435
|
-
function
|
|
448
|
+
function de(e, t) {
|
|
436
449
|
if (e) {
|
|
437
|
-
if ("string" == typeof e) return
|
|
450
|
+
if ("string" == typeof e) return he(e, t);
|
|
438
451
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
439
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
452
|
+
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) ? he(e, t) : void 0;
|
|
440
453
|
}
|
|
441
454
|
}
|
|
442
|
-
function
|
|
455
|
+
function he(e, t) {
|
|
443
456
|
(null == t || t > e.length) && (t = e.length);
|
|
444
457
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
445
458
|
return n;
|
|
446
459
|
}
|
|
447
|
-
function
|
|
448
|
-
return
|
|
460
|
+
function pe(e) {
|
|
461
|
+
return pe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
449
462
|
return _typeof(e);
|
|
450
463
|
} : function (e) {
|
|
451
464
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
452
|
-
},
|
|
465
|
+
}, pe(e);
|
|
453
466
|
}
|
|
454
|
-
function
|
|
467
|
+
function fe() {
|
|
455
468
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
456
|
-
|
|
469
|
+
fe = function fe() {
|
|
457
470
|
return t;
|
|
458
471
|
};
|
|
459
472
|
var e,
|
|
@@ -485,7 +498,7 @@ function le() {
|
|
|
485
498
|
function l(e, t, r, n) {
|
|
486
499
|
var o = t && t.prototype instanceof v ? t : v,
|
|
487
500
|
s = Object.create(o.prototype),
|
|
488
|
-
a = new
|
|
501
|
+
a = new A(n || []);
|
|
489
502
|
return i(s, "_invoke", {
|
|
490
503
|
value: C(e, r, a)
|
|
491
504
|
}), s;
|
|
@@ -506,34 +519,34 @@ function le() {
|
|
|
506
519
|
t.wrap = l;
|
|
507
520
|
var h = "suspendedStart",
|
|
508
521
|
p = "suspendedYield",
|
|
509
|
-
|
|
510
|
-
|
|
522
|
+
f = "executing",
|
|
523
|
+
_ = "completed",
|
|
511
524
|
m = {};
|
|
512
525
|
function v() {}
|
|
513
526
|
function b() {}
|
|
514
527
|
function g() {}
|
|
515
|
-
var
|
|
516
|
-
u(
|
|
528
|
+
var y = {};
|
|
529
|
+
u(y, s, function () {
|
|
517
530
|
return this;
|
|
518
531
|
});
|
|
519
|
-
var
|
|
520
|
-
w =
|
|
521
|
-
w && w !== r && n.call(w, s) && (
|
|
522
|
-
var S = g.prototype = v.prototype = Object.create(
|
|
523
|
-
function
|
|
532
|
+
var k = Object.getPrototypeOf,
|
|
533
|
+
w = k && k(k(D([])));
|
|
534
|
+
w && w !== r && n.call(w, s) && (y = w);
|
|
535
|
+
var S = g.prototype = v.prototype = Object.create(y);
|
|
536
|
+
function P(e) {
|
|
524
537
|
["next", "throw", "return"].forEach(function (t) {
|
|
525
538
|
u(e, t, function (e) {
|
|
526
539
|
return this._invoke(t, e);
|
|
527
540
|
});
|
|
528
541
|
});
|
|
529
542
|
}
|
|
530
|
-
function
|
|
543
|
+
function x(e, t) {
|
|
531
544
|
function r(i, o, s, a) {
|
|
532
545
|
var c = d(e[i], e, o);
|
|
533
546
|
if ("throw" !== c.type) {
|
|
534
547
|
var u = c.arg,
|
|
535
548
|
l = u.value;
|
|
536
|
-
return l && "object" ==
|
|
549
|
+
return l && "object" == pe(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
537
550
|
r("next", e, s, a);
|
|
538
551
|
}, function (e) {
|
|
539
552
|
r("throw", e, s, a);
|
|
@@ -560,8 +573,8 @@ function le() {
|
|
|
560
573
|
function C(t, r, n) {
|
|
561
574
|
var i = h;
|
|
562
575
|
return function (o, s) {
|
|
563
|
-
if (i ===
|
|
564
|
-
if (i ===
|
|
576
|
+
if (i === f) throw new Error("Generator is already running");
|
|
577
|
+
if (i === _) {
|
|
565
578
|
if ("throw" === o) throw s;
|
|
566
579
|
return {
|
|
567
580
|
value: e,
|
|
@@ -571,52 +584,52 @@ function le() {
|
|
|
571
584
|
for (n.method = o, n.arg = s;;) {
|
|
572
585
|
var a = n.delegate;
|
|
573
586
|
if (a) {
|
|
574
|
-
var c =
|
|
587
|
+
var c = T(a, n);
|
|
575
588
|
if (c) {
|
|
576
589
|
if (c === m) continue;
|
|
577
590
|
return c;
|
|
578
591
|
}
|
|
579
592
|
}
|
|
580
593
|
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
581
|
-
if (i === h) throw i =
|
|
594
|
+
if (i === h) throw i = _, n.arg;
|
|
582
595
|
n.dispatchException(n.arg);
|
|
583
596
|
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
584
|
-
i =
|
|
597
|
+
i = f;
|
|
585
598
|
var u = d(t, r, n);
|
|
586
599
|
if ("normal" === u.type) {
|
|
587
|
-
if (i = n.done ?
|
|
600
|
+
if (i = n.done ? _ : p, u.arg === m) continue;
|
|
588
601
|
return {
|
|
589
602
|
value: u.arg,
|
|
590
603
|
done: n.done
|
|
591
604
|
};
|
|
592
605
|
}
|
|
593
|
-
"throw" === u.type && (i =
|
|
606
|
+
"throw" === u.type && (i = _, n.method = "throw", n.arg = u.arg);
|
|
594
607
|
}
|
|
595
608
|
};
|
|
596
609
|
}
|
|
597
|
-
function
|
|
610
|
+
function T(t, r) {
|
|
598
611
|
var n = r.method,
|
|
599
612
|
i = t.iterator[n];
|
|
600
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
613
|
+
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e, T(t, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), m;
|
|
601
614
|
var o = d(i, t.iterator, r.arg);
|
|
602
615
|
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
603
616
|
var s = o.arg;
|
|
604
617
|
return s ? s.done ? (r[t.resultName] = s.value, r.next = t.nextLoc, "return" !== r.method && (r.method = "next", r.arg = e), r.delegate = null, m) : s : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, m);
|
|
605
618
|
}
|
|
606
|
-
function
|
|
619
|
+
function O(e) {
|
|
607
620
|
var t = {
|
|
608
621
|
tryLoc: e[0]
|
|
609
622
|
};
|
|
610
623
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
611
624
|
}
|
|
612
|
-
function
|
|
625
|
+
function E(e) {
|
|
613
626
|
var t = e.completion || {};
|
|
614
627
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
615
628
|
}
|
|
616
|
-
function
|
|
629
|
+
function A(e) {
|
|
617
630
|
this.tryEntries = [{
|
|
618
631
|
tryLoc: "root"
|
|
619
|
-
}], e.forEach(
|
|
632
|
+
}], e.forEach(O, this), this.reset(!0);
|
|
620
633
|
}
|
|
621
634
|
function D(t) {
|
|
622
635
|
if (t || "" === t) {
|
|
@@ -632,7 +645,7 @@ function le() {
|
|
|
632
645
|
return o.next = o;
|
|
633
646
|
}
|
|
634
647
|
}
|
|
635
|
-
throw new TypeError(
|
|
648
|
+
throw new TypeError(pe(t) + " is not iterable");
|
|
636
649
|
}
|
|
637
650
|
return b.prototype = g, i(S, "constructor", {
|
|
638
651
|
value: g,
|
|
@@ -649,15 +662,15 @@ function le() {
|
|
|
649
662
|
return {
|
|
650
663
|
__await: e
|
|
651
664
|
};
|
|
652
|
-
}, x
|
|
665
|
+
}, P(x.prototype), u(x.prototype, a, function () {
|
|
653
666
|
return this;
|
|
654
|
-
}), t.AsyncIterator =
|
|
667
|
+
}), t.AsyncIterator = x, t.async = function (e, r, n, i, o) {
|
|
655
668
|
void 0 === o && (o = Promise);
|
|
656
|
-
var s = new
|
|
669
|
+
var s = new x(l(e, r, n, i), o);
|
|
657
670
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
658
671
|
return e.done ? e.value : s.next();
|
|
659
672
|
});
|
|
660
|
-
},
|
|
673
|
+
}, P(S), u(S, c, "Generator"), u(S, s, function () {
|
|
661
674
|
return this;
|
|
662
675
|
}), u(S, "toString", function () {
|
|
663
676
|
return "[object Generator]";
|
|
@@ -672,10 +685,10 @@ function le() {
|
|
|
672
685
|
}
|
|
673
686
|
return e.done = !0, e;
|
|
674
687
|
};
|
|
675
|
-
}, t.values = D,
|
|
676
|
-
constructor:
|
|
688
|
+
}, t.values = D, A.prototype = {
|
|
689
|
+
constructor: A,
|
|
677
690
|
reset: function reset(t) {
|
|
678
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(
|
|
691
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(E), !t) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = e);
|
|
679
692
|
},
|
|
680
693
|
stop: function stop() {
|
|
681
694
|
this.done = !0;
|
|
@@ -727,7 +740,7 @@ function le() {
|
|
|
727
740
|
finish: function finish(e) {
|
|
728
741
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
729
742
|
var r = this.tryEntries[t];
|
|
730
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
743
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), E(r), m;
|
|
731
744
|
}
|
|
732
745
|
},
|
|
733
746
|
"catch": function _catch(e) {
|
|
@@ -737,7 +750,7 @@ function le() {
|
|
|
737
750
|
var n = r.completion;
|
|
738
751
|
if ("throw" === n.type) {
|
|
739
752
|
var i = n.arg;
|
|
740
|
-
|
|
753
|
+
E(r);
|
|
741
754
|
}
|
|
742
755
|
return i;
|
|
743
756
|
}
|
|
@@ -753,46 +766,46 @@ function le() {
|
|
|
753
766
|
}
|
|
754
767
|
}, t;
|
|
755
768
|
}
|
|
756
|
-
function
|
|
769
|
+
function _e(e, t) {
|
|
757
770
|
for (var r = 0; r < t.length; r++) {
|
|
758
771
|
var n = t[r];
|
|
759
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e,
|
|
772
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, ve(n.key), n);
|
|
760
773
|
}
|
|
761
774
|
}
|
|
762
|
-
function
|
|
763
|
-
return t &&
|
|
775
|
+
function me(e, t, r) {
|
|
776
|
+
return t && _e(e.prototype, t), r && _e(e, r), Object.defineProperty(e, "prototype", {
|
|
764
777
|
writable: !1
|
|
765
778
|
}), e;
|
|
766
779
|
}
|
|
767
|
-
function
|
|
780
|
+
function ve(e) {
|
|
768
781
|
var t = function (e, t) {
|
|
769
|
-
if ("object" !=
|
|
782
|
+
if ("object" != pe(e) || !e) return e;
|
|
770
783
|
var r = e[Symbol.toPrimitive];
|
|
771
784
|
if (void 0 !== r) {
|
|
772
785
|
var n = r.call(e, t || "default");
|
|
773
|
-
if ("object" !=
|
|
786
|
+
if ("object" != pe(n)) return n;
|
|
774
787
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
775
788
|
}
|
|
776
789
|
return ("string" === t ? String : Number)(e);
|
|
777
790
|
}(e, "string");
|
|
778
|
-
return "symbol" ==
|
|
791
|
+
return "symbol" == pe(t) ? t : String(t);
|
|
779
792
|
}
|
|
780
|
-
function
|
|
793
|
+
function be(e, t) {
|
|
781
794
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
782
795
|
}
|
|
783
|
-
function
|
|
784
|
-
return t =
|
|
785
|
-
if (t && ("object" ===
|
|
796
|
+
function ge(e, t, r) {
|
|
797
|
+
return t = Se(t), function (e, t) {
|
|
798
|
+
if (t && ("object" === pe(t) || "function" == typeof t)) return t;
|
|
786
799
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
787
800
|
return function (e) {
|
|
788
801
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
789
802
|
return e;
|
|
790
803
|
}(e);
|
|
791
|
-
}(e,
|
|
804
|
+
}(e, ke() ? Reflect.construct(t, r || [], Se(e).constructor) : t.apply(e, r));
|
|
792
805
|
}
|
|
793
|
-
function
|
|
806
|
+
function ye(e) {
|
|
794
807
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
795
|
-
return
|
|
808
|
+
return ye = function ye(e) {
|
|
796
809
|
if (null === e || !function (e) {
|
|
797
810
|
try {
|
|
798
811
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -807,12 +820,12 @@ function me(e) {
|
|
|
807
820
|
}
|
|
808
821
|
function r() {
|
|
809
822
|
return function (e, t, r) {
|
|
810
|
-
if (
|
|
823
|
+
if (ke()) return Reflect.construct.apply(null, arguments);
|
|
811
824
|
var n = [null];
|
|
812
825
|
n.push.apply(n, t);
|
|
813
826
|
var i = new (e.bind.apply(e, n))();
|
|
814
|
-
return r &&
|
|
815
|
-
}(e, arguments,
|
|
827
|
+
return r && we(i, r.prototype), i;
|
|
828
|
+
}(e, arguments, Se(this).constructor);
|
|
816
829
|
}
|
|
817
830
|
return r.prototype = Object.create(e.prototype, {
|
|
818
831
|
constructor: {
|
|
@@ -821,30 +834,30 @@ function me(e) {
|
|
|
821
834
|
writable: !0,
|
|
822
835
|
configurable: !0
|
|
823
836
|
}
|
|
824
|
-
}),
|
|
825
|
-
},
|
|
837
|
+
}), we(r, e);
|
|
838
|
+
}, ye(e);
|
|
826
839
|
}
|
|
827
|
-
function
|
|
840
|
+
function ke() {
|
|
828
841
|
try {
|
|
829
842
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
830
843
|
} catch (e) {}
|
|
831
|
-
return (
|
|
844
|
+
return (ke = function ke() {
|
|
832
845
|
return !!e;
|
|
833
846
|
})();
|
|
834
847
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
848
|
+
function we(e, t) {
|
|
849
|
+
return we = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
837
850
|
return e.__proto__ = t, e;
|
|
838
|
-
},
|
|
851
|
+
}, we(e, t);
|
|
839
852
|
}
|
|
840
|
-
function
|
|
841
|
-
return
|
|
853
|
+
function Se(e) {
|
|
854
|
+
return Se = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
842
855
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
843
|
-
},
|
|
856
|
+
}, Se(e);
|
|
844
857
|
}
|
|
845
|
-
exports.B2BProducts = void 0, (
|
|
846
|
-
var
|
|
847
|
-
function
|
|
858
|
+
exports.B2BProducts = void 0, (g = exports.B2BProducts || (exports.B2BProducts = {})).emailMagicLinks = "emailMagicLinks", g.sso = "sso", g.passwords = "passwords", g.oauth = "oauth", exports.AuthFlowType = void 0, (y = exports.AuthFlowType || (exports.AuthFlowType = {})).Discovery = "Discovery", y.Organization = "Organization", y.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";
|
|
859
|
+
var Pe;
|
|
860
|
+
function xe(e, t, r, n) {
|
|
848
861
|
return new (r || (r = Promise))(function (i, o) {
|
|
849
862
|
function s(e) {
|
|
850
863
|
try {
|
|
@@ -871,12 +884,12 @@ function ye(e, t, r, n) {
|
|
|
871
884
|
}
|
|
872
885
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
873
886
|
e.RequiredCatcha = "Catcha Required";
|
|
874
|
-
}(
|
|
875
|
-
var
|
|
876
|
-
|
|
887
|
+
}(Pe || (Pe = {}));
|
|
888
|
+
var Ce,
|
|
889
|
+
Te = function (e) {
|
|
877
890
|
function t(e) {
|
|
878
891
|
var r;
|
|
879
|
-
return
|
|
892
|
+
return be(this, t), (r = ge(this, t, [e])).type = e, r;
|
|
880
893
|
}
|
|
881
894
|
return function (e, t) {
|
|
882
895
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
@@ -888,10 +901,10 @@ var we,
|
|
|
888
901
|
}
|
|
889
902
|
}), Object.defineProperty(e, "prototype", {
|
|
890
903
|
writable: !1
|
|
891
|
-
}), t &&
|
|
892
|
-
}(t,
|
|
904
|
+
}), t && we(e, t);
|
|
905
|
+
}(t, ye(Error)), me(t);
|
|
893
906
|
}();
|
|
894
|
-
function
|
|
907
|
+
function Oe(e) {
|
|
895
908
|
var t,
|
|
896
909
|
r = e.method,
|
|
897
910
|
n = e.finalURL,
|
|
@@ -899,9 +912,9 @@ function xe(e) {
|
|
|
899
912
|
o = e.xSDKClientHeader,
|
|
900
913
|
s = e.xSDKParentHostHeader,
|
|
901
914
|
a = e.body;
|
|
902
|
-
return
|
|
915
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
903
916
|
var c, u, l, d, h, p;
|
|
904
|
-
return
|
|
917
|
+
return fe().wrap(function (e) {
|
|
905
918
|
for (;;) switch (e.prev = e.next) {
|
|
906
919
|
case 0:
|
|
907
920
|
return c = {
|
|
@@ -921,7 +934,7 @@ function xe(e) {
|
|
|
921
934
|
e.next = 13;
|
|
922
935
|
break;
|
|
923
936
|
}
|
|
924
|
-
throw new
|
|
937
|
+
throw new E("Unable to contact the Stytch servers. Are you online?");
|
|
925
938
|
case 13:
|
|
926
939
|
throw e.t0;
|
|
927
940
|
case 14:
|
|
@@ -933,7 +946,7 @@ function xe(e) {
|
|
|
933
946
|
case 18:
|
|
934
947
|
return d = e.sent, e.abrupt("return", d.data);
|
|
935
948
|
case 22:
|
|
936
|
-
throw e.prev = 22, e.t1 = e["catch"](15), new
|
|
949
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new E("Invalid JSON response from the Stytch servers.");
|
|
937
950
|
case 25:
|
|
938
951
|
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
939
952
|
e.next = 38;
|
|
@@ -944,30 +957,30 @@ function xe(e) {
|
|
|
944
957
|
h = e.sent, e.next = 35;
|
|
945
958
|
break;
|
|
946
959
|
case 32:
|
|
947
|
-
throw e.prev = 32, e.t2 = e["catch"](26), new
|
|
960
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new E("Invalid or no response from server");
|
|
948
961
|
case 35:
|
|
949
962
|
if (!("body" in h || "params" in h || "query" in h)) {
|
|
950
963
|
e.next = 37;
|
|
951
964
|
break;
|
|
952
965
|
}
|
|
953
|
-
throw new T(h);
|
|
954
|
-
case 37:
|
|
955
966
|
throw new A(h);
|
|
967
|
+
case 37:
|
|
968
|
+
throw new D(h);
|
|
956
969
|
case 38:
|
|
957
970
|
return e.prev = 38, e.next = 41, l.text();
|
|
958
971
|
case 41:
|
|
959
972
|
p = e.sent, e.next = 47;
|
|
960
973
|
break;
|
|
961
974
|
case 44:
|
|
962
|
-
throw e.prev = 44, e.t3 = e["catch"](38), new
|
|
975
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new E("Invalid response from the Stytch servers.");
|
|
963
976
|
case 47:
|
|
964
977
|
if (!p.includes("Captcha required")) {
|
|
965
978
|
e.next = 49;
|
|
966
979
|
break;
|
|
967
980
|
}
|
|
968
|
-
throw new
|
|
981
|
+
throw new Te(Pe.RequiredCatcha);
|
|
969
982
|
case 49:
|
|
970
|
-
throw new
|
|
983
|
+
throw new E("Invalid response from the Stytch servers.");
|
|
971
984
|
case 50:
|
|
972
985
|
case "end":
|
|
973
986
|
return e.stop();
|
|
@@ -975,43 +988,43 @@ function xe(e) {
|
|
|
975
988
|
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
976
989
|
}));
|
|
977
990
|
}
|
|
978
|
-
var
|
|
979
|
-
function
|
|
980
|
-
if (!
|
|
981
|
-
return
|
|
991
|
+
var Ee = new Uint8Array(16);
|
|
992
|
+
function Ae() {
|
|
993
|
+
if (!Ce && !(Ce = "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");
|
|
994
|
+
return Ce(Ee);
|
|
982
995
|
}
|
|
983
|
-
var
|
|
984
|
-
for (var
|
|
985
|
-
function
|
|
996
|
+
var De = /^(?:[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;
|
|
997
|
+
for (var Ie = [], Re = 0; Re < 256; ++Re) Ie.push((Re + 256).toString(16).substr(1));
|
|
998
|
+
function Be(e) {
|
|
986
999
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
987
|
-
r = (
|
|
1000
|
+
r = (Ie[e[t + 0]] + Ie[e[t + 1]] + Ie[e[t + 2]] + Ie[e[t + 3]] + "-" + Ie[e[t + 4]] + Ie[e[t + 5]] + "-" + Ie[e[t + 6]] + Ie[e[t + 7]] + "-" + Ie[e[t + 8]] + Ie[e[t + 9]] + "-" + Ie[e[t + 10]] + Ie[e[t + 11]] + Ie[e[t + 12]] + Ie[e[t + 13]] + Ie[e[t + 14]] + Ie[e[t + 15]]).toLowerCase();
|
|
988
1001
|
if (!function (e) {
|
|
989
|
-
return "string" == typeof e &&
|
|
1002
|
+
return "string" == typeof e && De.test(e);
|
|
990
1003
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
991
1004
|
return r;
|
|
992
1005
|
}
|
|
993
|
-
function
|
|
994
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1006
|
+
function Me(e, t, r) {
|
|
1007
|
+
var n = (e = e || {}).random || (e.rng || Ae)();
|
|
995
1008
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
996
1009
|
r = r || 0;
|
|
997
1010
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
998
1011
|
return t;
|
|
999
1012
|
}
|
|
1000
|
-
return
|
|
1013
|
+
return Be(n);
|
|
1001
1014
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1005
|
-
return
|
|
1015
|
+
var Fe = {};
|
|
1016
|
+
function je(e, t) {
|
|
1017
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
1018
|
+
return fe().wrap(function (r) {
|
|
1006
1019
|
for (;;) switch (r.prev = r.next) {
|
|
1007
1020
|
case 0:
|
|
1008
|
-
if (void 0 ===
|
|
1021
|
+
if (void 0 === Fe[e]) {
|
|
1009
1022
|
r.next = 2;
|
|
1010
1023
|
break;
|
|
1011
1024
|
}
|
|
1012
|
-
return r.abrupt("return",
|
|
1025
|
+
return r.abrupt("return", Fe[e]);
|
|
1013
1026
|
case 2:
|
|
1014
|
-
return
|
|
1027
|
+
return Fe[e] = Le(e, t), r.abrupt("return", Fe[e]);
|
|
1015
1028
|
case 4:
|
|
1016
1029
|
case "end":
|
|
1017
1030
|
return r.stop();
|
|
@@ -1019,10 +1032,10 @@ function Fe(e, t) {
|
|
|
1019
1032
|
}, r);
|
|
1020
1033
|
}));
|
|
1021
1034
|
}
|
|
1022
|
-
function
|
|
1035
|
+
function Le(e, t) {
|
|
1023
1036
|
return new Promise(function (r, n) {
|
|
1024
1037
|
var i = function (e) {
|
|
1025
|
-
var t =
|
|
1038
|
+
var t = Ke(e);
|
|
1026
1039
|
if (t[0]) return t[0];
|
|
1027
1040
|
}(e);
|
|
1028
1041
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -1046,47 +1059,47 @@ function je(e, t) {
|
|
|
1046
1059
|
});
|
|
1047
1060
|
});
|
|
1048
1061
|
}
|
|
1049
|
-
var
|
|
1062
|
+
var Ke = function Ke(e) {
|
|
1050
1063
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
1051
1064
|
};
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
|
|
1065
|
+
var Ne,
|
|
1066
|
+
Ue = ["[Stytch]"],
|
|
1067
|
+
ze = function ze() {
|
|
1055
1068
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1056
|
-
return (e = console).warn.apply(e,
|
|
1069
|
+
return (e = console).warn.apply(e, Ue.concat(r));
|
|
1057
1070
|
},
|
|
1058
|
-
|
|
1071
|
+
qe = function qe() {
|
|
1059
1072
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
1060
|
-
return (e = console).error.apply(e,
|
|
1073
|
+
return (e = console).error.apply(e, Ue.concat(r));
|
|
1061
1074
|
},
|
|
1062
|
-
|
|
1063
|
-
|
|
1075
|
+
We = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1076
|
+
He = function He(e) {
|
|
1064
1077
|
return e.includes("public-token-test");
|
|
1065
1078
|
},
|
|
1066
|
-
|
|
1079
|
+
Ge = function Ge(e) {
|
|
1067
1080
|
var t = {
|
|
1068
1081
|
isObject: function isObject(r, n) {
|
|
1069
|
-
var i = "object" ===
|
|
1070
|
-
if (!i) throw new
|
|
1082
|
+
var i = "object" === pe(n) && !Array.isArray(n) && null !== n;
|
|
1083
|
+
if (!i) throw new P(e, r + " must be an object.");
|
|
1071
1084
|
return t;
|
|
1072
1085
|
},
|
|
1073
1086
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
1074
1087
|
return void 0 === r ? t : t.isObject(e, r);
|
|
1075
1088
|
},
|
|
1076
1089
|
isString: function isString(r, n) {
|
|
1077
|
-
if ("string" != typeof n) throw new
|
|
1090
|
+
if ("string" != typeof n) throw new P(e, r + " must be a string.");
|
|
1078
1091
|
return t;
|
|
1079
1092
|
},
|
|
1080
1093
|
isOptionalString: function isOptionalString(e, r) {
|
|
1081
1094
|
return void 0 === r ? t : t.isString(e, r);
|
|
1082
1095
|
},
|
|
1083
1096
|
isStringArray: function isStringArray(r, n) {
|
|
1084
|
-
if (!Array.isArray(n)) throw new
|
|
1097
|
+
if (!Array.isArray(n)) throw new P(e, r + " must be an array of strings.");
|
|
1085
1098
|
var i,
|
|
1086
1099
|
o = function (e, t) {
|
|
1087
1100
|
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1088
1101
|
if (!r) {
|
|
1089
|
-
if (Array.isArray(e) || (r =
|
|
1102
|
+
if (Array.isArray(e) || (r = de(e)) || t && e && "number" == typeof e.length) {
|
|
1090
1103
|
r && (e = r);
|
|
1091
1104
|
var _n = 0,
|
|
1092
1105
|
i = function i() {};
|
|
@@ -1133,7 +1146,7 @@ var Me,
|
|
|
1133
1146
|
}(n);
|
|
1134
1147
|
try {
|
|
1135
1148
|
for (o.s(); !(i = o.n()).done;) {
|
|
1136
|
-
if ("string" != typeof i.value) throw new
|
|
1149
|
+
if ("string" != typeof i.value) throw new P(e, r + " must be an array of strings.");
|
|
1137
1150
|
}
|
|
1138
1151
|
} catch (e) {
|
|
1139
1152
|
o.e(e);
|
|
@@ -1146,14 +1159,14 @@ var Me,
|
|
|
1146
1159
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
1147
1160
|
},
|
|
1148
1161
|
isNumber: function isNumber(r, n) {
|
|
1149
|
-
if ("number" != typeof n) throw new
|
|
1162
|
+
if ("number" != typeof n) throw new P(e, r + " must be a number.");
|
|
1150
1163
|
return t;
|
|
1151
1164
|
},
|
|
1152
1165
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1153
1166
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
1154
1167
|
},
|
|
1155
1168
|
isBoolean: function isBoolean(r, n) {
|
|
1156
|
-
if ("boolean" != typeof n) throw new
|
|
1169
|
+
if ("boolean" != typeof n) throw new P(e, r + " must be a boolean.");
|
|
1157
1170
|
return t;
|
|
1158
1171
|
},
|
|
1159
1172
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -1162,14 +1175,14 @@ var Me,
|
|
|
1162
1175
|
};
|
|
1163
1176
|
return t;
|
|
1164
1177
|
},
|
|
1165
|
-
|
|
1178
|
+
Ve = me(function e(t, r, n) {
|
|
1166
1179
|
var i = this,
|
|
1167
1180
|
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
1168
1181
|
return Promise.resolve(void 0);
|
|
1169
1182
|
};
|
|
1170
|
-
|
|
1171
|
-
return
|
|
1172
|
-
return
|
|
1183
|
+
be(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1184
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1185
|
+
return fe().wrap(function (e) {
|
|
1173
1186
|
for (;;) switch (e.prev = e.next) {
|
|
1174
1187
|
case 0:
|
|
1175
1188
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -1182,9 +1195,9 @@ var Me,
|
|
|
1182
1195
|
}, e, this);
|
|
1183
1196
|
}));
|
|
1184
1197
|
}, this.getTelemetryID = function () {
|
|
1185
|
-
return
|
|
1198
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1186
1199
|
var t, r, n, i;
|
|
1187
|
-
return
|
|
1200
|
+
return fe().wrap(function (e) {
|
|
1188
1201
|
for (;;) switch (e.prev = e.next) {
|
|
1189
1202
|
case 0:
|
|
1190
1203
|
return e.next = 2, this.state;
|
|
@@ -1205,9 +1218,9 @@ var Me,
|
|
|
1205
1218
|
}, e, this);
|
|
1206
1219
|
}));
|
|
1207
1220
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
1208
|
-
return
|
|
1221
|
+
return xe(i, void 0, void 0, fe().mark(function e() {
|
|
1209
1222
|
var t, r, n, i, o, s;
|
|
1210
|
-
return
|
|
1223
|
+
return fe().wrap(function (e) {
|
|
1211
1224
|
for (;;) switch (e.prev = e.next) {
|
|
1212
1225
|
case 0:
|
|
1213
1226
|
return e.next = 2, this.state;
|
|
@@ -1250,14 +1263,14 @@ var Me,
|
|
|
1250
1263
|
}, e, this);
|
|
1251
1264
|
}));
|
|
1252
1265
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
1253
|
-
return
|
|
1266
|
+
return xe(i, void 0, void 0, fe().mark(function r() {
|
|
1254
1267
|
var n, i, o;
|
|
1255
|
-
return
|
|
1268
|
+
return fe().wrap(function (r) {
|
|
1256
1269
|
for (;;) switch (r.prev = r.next) {
|
|
1257
1270
|
case 0:
|
|
1258
1271
|
return r.next = 2, this.state;
|
|
1259
1272
|
case 2:
|
|
1260
|
-
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !==
|
|
1273
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== Pe.RequiredCatcha || !i) {
|
|
1261
1274
|
r.next = 14;
|
|
1262
1275
|
break;
|
|
1263
1276
|
}
|
|
@@ -1281,8 +1294,8 @@ var Me,
|
|
|
1281
1294
|
}, r, this);
|
|
1282
1295
|
}));
|
|
1283
1296
|
}, this.state = n.then(function (e) {
|
|
1284
|
-
return
|
|
1285
|
-
return
|
|
1297
|
+
return xe(i, void 0, void 0, fe().mark(function n() {
|
|
1298
|
+
return fe().wrap(function (n) {
|
|
1286
1299
|
for (;;) switch (n.prev = n.next) {
|
|
1287
1300
|
case 0:
|
|
1288
1301
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1297,7 +1310,7 @@ var Me,
|
|
|
1297
1310
|
executeRecaptcha: o
|
|
1298
1311
|
});
|
|
1299
1312
|
case 2:
|
|
1300
|
-
return n.next = 4, void
|
|
1313
|
+
return n.next = 4, void je("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1301
1314
|
return window;
|
|
1302
1315
|
});
|
|
1303
1316
|
case 4:
|
|
@@ -1317,11 +1330,11 @@ var Me,
|
|
|
1317
1330
|
}));
|
|
1318
1331
|
});
|
|
1319
1332
|
}),
|
|
1320
|
-
|
|
1333
|
+
Ye = function Ye() {
|
|
1321
1334
|
return {
|
|
1322
1335
|
isEnabled: function isEnabled() {
|
|
1323
|
-
return
|
|
1324
|
-
return
|
|
1336
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1337
|
+
return fe().wrap(function (e) {
|
|
1325
1338
|
for (;;) switch (e.prev = e.next) {
|
|
1326
1339
|
case 0:
|
|
1327
1340
|
return e.abrupt("return", !1);
|
|
@@ -1333,8 +1346,8 @@ var Me,
|
|
|
1333
1346
|
}));
|
|
1334
1347
|
},
|
|
1335
1348
|
getTelemetryID: function getTelemetryID() {
|
|
1336
|
-
return
|
|
1337
|
-
return
|
|
1349
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1350
|
+
return fe().wrap(function (e) {
|
|
1338
1351
|
for (;;) switch (e.prev = e.next) {
|
|
1339
1352
|
case 0:
|
|
1340
1353
|
return e.abrupt("return", void 0);
|
|
@@ -1346,8 +1359,8 @@ var Me,
|
|
|
1346
1359
|
}));
|
|
1347
1360
|
},
|
|
1348
1361
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1349
|
-
return
|
|
1350
|
-
return
|
|
1362
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1363
|
+
return fe().wrap(function (e) {
|
|
1351
1364
|
for (;;) switch (e.prev = e.next) {
|
|
1352
1365
|
case 0:
|
|
1353
1366
|
return e.abrupt("return", {
|
|
@@ -1362,8 +1375,8 @@ var Me,
|
|
|
1362
1375
|
}));
|
|
1363
1376
|
},
|
|
1364
1377
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1365
|
-
return
|
|
1366
|
-
return
|
|
1378
|
+
return xe(void 0, void 0, void 0, fe().mark(function e() {
|
|
1379
|
+
return fe().wrap(function (e) {
|
|
1367
1380
|
for (;;) switch (e.prev = e.next) {
|
|
1368
1381
|
case 0:
|
|
1369
1382
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1376,11 +1389,63 @@ var Me,
|
|
|
1376
1389
|
}
|
|
1377
1390
|
};
|
|
1378
1391
|
},
|
|
1379
|
-
|
|
1392
|
+
Je = function () {
|
|
1393
|
+
function e() {
|
|
1394
|
+
be(this, e);
|
|
1395
|
+
}
|
|
1396
|
+
return me(e, null, [{
|
|
1397
|
+
key: "marshall",
|
|
1398
|
+
value: function value(e) {
|
|
1399
|
+
return Object.assign(Object.assign({}, e), {
|
|
1400
|
+
name: e.name,
|
|
1401
|
+
message: e.message,
|
|
1402
|
+
stack: e.stack
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
}, {
|
|
1406
|
+
key: "inflate",
|
|
1407
|
+
value: function value(e, t) {
|
|
1408
|
+
var r = new e(t);
|
|
1409
|
+
return Object.assign(r, t), Object.setPrototypeOf(r, e.prototype), r;
|
|
1410
|
+
}
|
|
1411
|
+
}, {
|
|
1412
|
+
key: "unmarshall",
|
|
1413
|
+
value: function value(t) {
|
|
1414
|
+
if ("name" in t) switch (t.name) {
|
|
1415
|
+
case "SDKAPIUnreachableError":
|
|
1416
|
+
return e.inflate(S, t);
|
|
1417
|
+
case "StytchSDKSchemaError":
|
|
1418
|
+
return e.inflate(x, t);
|
|
1419
|
+
case "StytchAPIUnreachableError":
|
|
1420
|
+
return e.inflate(E, t);
|
|
1421
|
+
case "StytchAPISchemaError":
|
|
1422
|
+
return e.inflate(A, t);
|
|
1423
|
+
case "StytchSDKAPIError":
|
|
1424
|
+
return e.inflate(C, t);
|
|
1425
|
+
case "StytchAPIError":
|
|
1426
|
+
return e.inflate(D, t);
|
|
1427
|
+
case "TypeError":
|
|
1428
|
+
return e.inflate(TypeError, t);
|
|
1429
|
+
case "SyntaxError":
|
|
1430
|
+
return e.inflate(SyntaxError, t);
|
|
1431
|
+
case "ReferenceError":
|
|
1432
|
+
return e.inflate(ReferenceError, t);
|
|
1433
|
+
case "RangeError":
|
|
1434
|
+
return e.inflate(RangeError, t);
|
|
1435
|
+
case "EvalError":
|
|
1436
|
+
return e.inflate(EvalError, t);
|
|
1437
|
+
case "URIError":
|
|
1438
|
+
return e.inflate(URIError, t);
|
|
1439
|
+
}
|
|
1440
|
+
return e.inflate(Error, t);
|
|
1441
|
+
}
|
|
1442
|
+
}]), e;
|
|
1443
|
+
}(),
|
|
1444
|
+
$e = function () {
|
|
1380
1445
|
function e(t) {
|
|
1381
|
-
|
|
1446
|
+
be(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1382
1447
|
}
|
|
1383
|
-
return
|
|
1448
|
+
return me(e, [{
|
|
1384
1449
|
key: "logEvent",
|
|
1385
1450
|
value: function value(e, t) {
|
|
1386
1451
|
this.batch.push({
|
|
@@ -1391,9 +1456,9 @@ var Me,
|
|
|
1391
1456
|
}, {
|
|
1392
1457
|
key: "flush",
|
|
1393
1458
|
value: function value() {
|
|
1394
|
-
return
|
|
1459
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
1395
1460
|
var t;
|
|
1396
|
-
return
|
|
1461
|
+
return fe().wrap(function (e) {
|
|
1397
1462
|
for (;;) switch (e.prev = e.next) {
|
|
1398
1463
|
case 0:
|
|
1399
1464
|
if (this.batch.length) {
|
|
@@ -1425,26 +1490,26 @@ var Me,
|
|
|
1425
1490
|
}();
|
|
1426
1491
|
!function (e) {
|
|
1427
1492
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1428
|
-
}(
|
|
1493
|
+
}(Ne || (Ne = {})), Promise.resolve({
|
|
1429
1494
|
pkceRequiredForEmailMagicLinks: !1
|
|
1430
1495
|
}), Promise.resolve({
|
|
1431
1496
|
pkceRequiredForPasswordResets: !1
|
|
1432
1497
|
});
|
|
1433
|
-
var
|
|
1498
|
+
var Xe = Promise.resolve({
|
|
1434
1499
|
pkceRequiredForEmailMagicLinks: !1
|
|
1435
1500
|
}),
|
|
1436
|
-
|
|
1501
|
+
Ze = function () {
|
|
1437
1502
|
function e(t, r, n, i) {
|
|
1438
1503
|
var o = this,
|
|
1439
|
-
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
1440
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1441
|
-
|
|
1504
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Xe,
|
|
1505
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
1506
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1442
1507
|
invite: function invite(e) {
|
|
1443
|
-
return
|
|
1444
|
-
return
|
|
1508
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1509
|
+
return fe().wrap(function (t) {
|
|
1445
1510
|
for (;;) switch (t.prev = t.next) {
|
|
1446
1511
|
case 0:
|
|
1447
|
-
return
|
|
1512
|
+
return Ge("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1448
1513
|
url: "/b2b/magic_links/email/invite",
|
|
1449
1514
|
body: e,
|
|
1450
1515
|
errorMessage: "Failed to send invite.",
|
|
@@ -1458,12 +1523,12 @@ var Ge = Promise.resolve({
|
|
|
1458
1523
|
}));
|
|
1459
1524
|
},
|
|
1460
1525
|
loginOrSignup: function loginOrSignup(e) {
|
|
1461
|
-
return
|
|
1526
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1462
1527
|
var r, n;
|
|
1463
|
-
return
|
|
1528
|
+
return fe().wrap(function (t) {
|
|
1464
1529
|
for (;;) switch (t.prev = t.next) {
|
|
1465
1530
|
case 0:
|
|
1466
|
-
return
|
|
1531
|
+
return Ge("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1467
1532
|
case 3:
|
|
1468
1533
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1469
1534
|
pkce_code_challenge: r
|
|
@@ -1482,12 +1547,12 @@ var Ge = Promise.resolve({
|
|
|
1482
1547
|
},
|
|
1483
1548
|
discovery: {
|
|
1484
1549
|
send: function send(e) {
|
|
1485
|
-
return
|
|
1550
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1486
1551
|
var r, n;
|
|
1487
|
-
return
|
|
1552
|
+
return fe().wrap(function (t) {
|
|
1488
1553
|
for (;;) switch (t.prev = t.next) {
|
|
1489
1554
|
case 0:
|
|
1490
|
-
return
|
|
1555
|
+
return Ge("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1491
1556
|
case 3:
|
|
1492
1557
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1493
1558
|
pkce_code_challenge: r
|
|
@@ -1506,12 +1571,12 @@ var Ge = Promise.resolve({
|
|
|
1506
1571
|
}
|
|
1507
1572
|
}
|
|
1508
1573
|
}, this.authenticate = function (e) {
|
|
1509
|
-
return
|
|
1574
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1510
1575
|
var r, n;
|
|
1511
|
-
return
|
|
1576
|
+
return fe().wrap(function (t) {
|
|
1512
1577
|
for (;;) switch (t.prev = t.next) {
|
|
1513
1578
|
case 0:
|
|
1514
|
-
return
|
|
1579
|
+
return Ge("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1515
1580
|
case 3:
|
|
1516
1581
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1517
1582
|
t.next = 19;
|
|
@@ -1562,12 +1627,12 @@ var Ge = Promise.resolve({
|
|
|
1562
1627
|
}));
|
|
1563
1628
|
}, this.discovery = {
|
|
1564
1629
|
authenticate: function authenticate(e) {
|
|
1565
|
-
return
|
|
1630
|
+
return xe(o, void 0, void 0, fe().mark(function t() {
|
|
1566
1631
|
var r, n, i, o, s, a;
|
|
1567
|
-
return
|
|
1632
|
+
return fe().wrap(function (t) {
|
|
1568
1633
|
for (;;) switch (t.prev = t.next) {
|
|
1569
1634
|
case 0:
|
|
1570
|
-
return
|
|
1635
|
+
return Ge("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1571
1636
|
case 3:
|
|
1572
1637
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1573
1638
|
case 6:
|
|
@@ -1598,12 +1663,12 @@ var Ge = Promise.resolve({
|
|
|
1598
1663
|
}
|
|
1599
1664
|
};
|
|
1600
1665
|
}
|
|
1601
|
-
return
|
|
1666
|
+
return me(e, [{
|
|
1602
1667
|
key: "getCodeChallenge",
|
|
1603
1668
|
value: function value() {
|
|
1604
|
-
return
|
|
1669
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
1605
1670
|
var t, r;
|
|
1606
|
-
return
|
|
1671
|
+
return fe().wrap(function (e) {
|
|
1607
1672
|
for (;;) switch (e.prev = e.next) {
|
|
1608
1673
|
case 0:
|
|
1609
1674
|
return e.next = 2, this._config;
|
|
@@ -1635,9 +1700,9 @@ var Ge = Promise.resolve({
|
|
|
1635
1700
|
}, {
|
|
1636
1701
|
key: "handlePKCEForAuthenticate",
|
|
1637
1702
|
value: function value(e, t) {
|
|
1638
|
-
return
|
|
1703
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
1639
1704
|
var n, i, o, s, a, c;
|
|
1640
|
-
return
|
|
1705
|
+
return fe().wrap(function (r) {
|
|
1641
1706
|
for (;;) switch (r.prev = r.next) {
|
|
1642
1707
|
case 0:
|
|
1643
1708
|
return r.next = 2, e.getPKPair();
|
|
@@ -1666,12 +1731,12 @@ var Ge = Promise.resolve({
|
|
|
1666
1731
|
}
|
|
1667
1732
|
}]), e;
|
|
1668
1733
|
}(),
|
|
1669
|
-
|
|
1734
|
+
Qe = me(function e(t, r) {
|
|
1670
1735
|
var n = this;
|
|
1671
|
-
|
|
1672
|
-
return
|
|
1736
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1737
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1673
1738
|
var t;
|
|
1674
|
-
return
|
|
1739
|
+
return fe().wrap(function (e) {
|
|
1675
1740
|
for (;;) switch (e.prev = e.next) {
|
|
1676
1741
|
case 0:
|
|
1677
1742
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1695,12 +1760,12 @@ var Ge = Promise.resolve({
|
|
|
1695
1760
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1696
1761
|
});
|
|
1697
1762
|
}, this.update = function (e) {
|
|
1698
|
-
return
|
|
1763
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
1699
1764
|
var r;
|
|
1700
|
-
return
|
|
1765
|
+
return fe().wrap(function (t) {
|
|
1701
1766
|
for (;;) switch (t.prev = t.next) {
|
|
1702
1767
|
case 0:
|
|
1703
|
-
return
|
|
1768
|
+
return Ge("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("default_mfa_method", e.default_mfa_method), t.next = 3, this._networkClient.fetchSDK({
|
|
1704
1769
|
url: "/b2b/organizations/members/update",
|
|
1705
1770
|
body: e,
|
|
1706
1771
|
errorMessage: "Failed to update member.",
|
|
@@ -1715,9 +1780,9 @@ var Ge = Promise.resolve({
|
|
|
1715
1780
|
}, t, this);
|
|
1716
1781
|
}));
|
|
1717
1782
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1718
|
-
return
|
|
1783
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1719
1784
|
var t;
|
|
1720
|
-
return
|
|
1785
|
+
return fe().wrap(function (e) {
|
|
1721
1786
|
for (;;) switch (e.prev = e.next) {
|
|
1722
1787
|
case 0:
|
|
1723
1788
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1734,9 +1799,9 @@ var Ge = Promise.resolve({
|
|
|
1734
1799
|
}, e, this);
|
|
1735
1800
|
}));
|
|
1736
1801
|
}, this.deleteMFATOTP = function () {
|
|
1737
|
-
return
|
|
1802
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
1738
1803
|
var t;
|
|
1739
|
-
return
|
|
1804
|
+
return fe().wrap(function (e) {
|
|
1740
1805
|
for (;;) switch (e.prev = e.next) {
|
|
1741
1806
|
case 0:
|
|
1742
1807
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1753,9 +1818,9 @@ var Ge = Promise.resolve({
|
|
|
1753
1818
|
}, e, this);
|
|
1754
1819
|
}));
|
|
1755
1820
|
}, this.deletePassword = function (e) {
|
|
1756
|
-
return
|
|
1821
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
1757
1822
|
var r;
|
|
1758
|
-
return
|
|
1823
|
+
return fe().wrap(function (t) {
|
|
1759
1824
|
for (;;) switch (t.prev = t.next) {
|
|
1760
1825
|
case 0:
|
|
1761
1826
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1773,14 +1838,14 @@ var Ge = Promise.resolve({
|
|
|
1773
1838
|
}));
|
|
1774
1839
|
};
|
|
1775
1840
|
}),
|
|
1776
|
-
|
|
1841
|
+
et = function () {
|
|
1777
1842
|
function e(t, r, n, i, o) {
|
|
1778
1843
|
var s = this,
|
|
1779
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
1780
|
-
|
|
1844
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
1845
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1781
1846
|
createConnection: function createConnection(e) {
|
|
1782
|
-
return
|
|
1783
|
-
return
|
|
1847
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1848
|
+
return fe().wrap(function (t) {
|
|
1784
1849
|
for (;;) switch (t.prev = t.next) {
|
|
1785
1850
|
case 0:
|
|
1786
1851
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1799,8 +1864,8 @@ var Ge = Promise.resolve({
|
|
|
1799
1864
|
}));
|
|
1800
1865
|
},
|
|
1801
1866
|
updateConnection: function updateConnection(e) {
|
|
1802
|
-
return
|
|
1803
|
-
return
|
|
1867
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1868
|
+
return fe().wrap(function (t) {
|
|
1804
1869
|
for (;;) switch (t.prev = t.next) {
|
|
1805
1870
|
case 0:
|
|
1806
1871
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1819,8 +1884,8 @@ var Ge = Promise.resolve({
|
|
|
1819
1884
|
}));
|
|
1820
1885
|
},
|
|
1821
1886
|
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1822
|
-
return
|
|
1823
|
-
return
|
|
1887
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1888
|
+
return fe().wrap(function (t) {
|
|
1824
1889
|
for (;;) switch (t.prev = t.next) {
|
|
1825
1890
|
case 0:
|
|
1826
1891
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1839,8 +1904,8 @@ var Ge = Promise.resolve({
|
|
|
1839
1904
|
}));
|
|
1840
1905
|
},
|
|
1841
1906
|
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
1842
|
-
return
|
|
1843
|
-
return
|
|
1907
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1908
|
+
return fe().wrap(function (t) {
|
|
1844
1909
|
for (;;) switch (t.prev = t.next) {
|
|
1845
1910
|
case 0:
|
|
1846
1911
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1859,8 +1924,8 @@ var Ge = Promise.resolve({
|
|
|
1859
1924
|
}
|
|
1860
1925
|
}, this.oidc = {
|
|
1861
1926
|
createConnection: function createConnection(e) {
|
|
1862
|
-
return
|
|
1863
|
-
return
|
|
1927
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1928
|
+
return fe().wrap(function (t) {
|
|
1864
1929
|
for (;;) switch (t.prev = t.next) {
|
|
1865
1930
|
case 0:
|
|
1866
1931
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1879,8 +1944,8 @@ var Ge = Promise.resolve({
|
|
|
1879
1944
|
}));
|
|
1880
1945
|
},
|
|
1881
1946
|
updateConnection: function updateConnection(e) {
|
|
1882
|
-
return
|
|
1883
|
-
return
|
|
1947
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
1948
|
+
return fe().wrap(function (t) {
|
|
1884
1949
|
for (;;) switch (t.prev = t.next) {
|
|
1885
1950
|
case 0:
|
|
1886
1951
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1900,17 +1965,17 @@ var Ge = Promise.resolve({
|
|
|
1900
1965
|
}
|
|
1901
1966
|
};
|
|
1902
1967
|
}
|
|
1903
|
-
return
|
|
1968
|
+
return me(e, [{
|
|
1904
1969
|
key: "authenticate",
|
|
1905
1970
|
value: function value(e) {
|
|
1906
|
-
return
|
|
1971
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
1907
1972
|
var r, n, i, o, s;
|
|
1908
|
-
return
|
|
1973
|
+
return fe().wrap(function (t) {
|
|
1909
1974
|
for (;;) switch (t.prev = t.next) {
|
|
1910
1975
|
case 0:
|
|
1911
|
-
return
|
|
1976
|
+
return Ge("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1912
1977
|
case 3:
|
|
1913
|
-
return (r = t.sent) ||
|
|
1978
|
+
return (r = t.sent) || ze("No code verifier found in local storage for SSO flow.\nConsider using stytch.sso.start() to add PKCE to your SSO flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1914
1979
|
case 7:
|
|
1915
1980
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1916
1981
|
url: "/b2b/sso/authenticate",
|
|
@@ -1950,11 +2015,11 @@ var Ge = Promise.resolve({
|
|
|
1950
2015
|
}, {
|
|
1951
2016
|
key: "getBaseApiUrl",
|
|
1952
2017
|
value: function value() {
|
|
1953
|
-
return
|
|
1954
|
-
return
|
|
2018
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2019
|
+
return fe().wrap(function (e) {
|
|
1955
2020
|
for (;;) switch (e.prev = e.next) {
|
|
1956
2021
|
case 0:
|
|
1957
|
-
if (!
|
|
2022
|
+
if (!He(this._config.publicToken)) {
|
|
1958
2023
|
e.next = 2;
|
|
1959
2024
|
break;
|
|
1960
2025
|
}
|
|
@@ -1974,9 +2039,9 @@ var Ge = Promise.resolve({
|
|
|
1974
2039
|
var t = e.connection_id,
|
|
1975
2040
|
r = e.login_redirect_url,
|
|
1976
2041
|
n = e.signup_redirect_url;
|
|
1977
|
-
return
|
|
2042
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
1978
2043
|
var i, o, s, a, c;
|
|
1979
|
-
return
|
|
2044
|
+
return fe().wrap(function (e) {
|
|
1980
2045
|
for (;;) switch (e.prev = e.next) {
|
|
1981
2046
|
case 0:
|
|
1982
2047
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2005,8 +2070,8 @@ var Ge = Promise.resolve({
|
|
|
2005
2070
|
}, {
|
|
2006
2071
|
key: "getConnections",
|
|
2007
2072
|
value: function value() {
|
|
2008
|
-
return
|
|
2009
|
-
return
|
|
2073
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2074
|
+
return fe().wrap(function (e) {
|
|
2010
2075
|
for (;;) switch (e.prev = e.next) {
|
|
2011
2076
|
case 0:
|
|
2012
2077
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2026,8 +2091,8 @@ var Ge = Promise.resolve({
|
|
|
2026
2091
|
}, {
|
|
2027
2092
|
key: "deleteConnection",
|
|
2028
2093
|
value: function value(e) {
|
|
2029
|
-
return
|
|
2030
|
-
return
|
|
2094
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2095
|
+
return fe().wrap(function (t) {
|
|
2031
2096
|
for (;;) switch (t.prev = t.next) {
|
|
2032
2097
|
case 0:
|
|
2033
2098
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2044,12 +2109,12 @@ var Ge = Promise.resolve({
|
|
|
2044
2109
|
}
|
|
2045
2110
|
}]), e;
|
|
2046
2111
|
}(),
|
|
2047
|
-
|
|
2112
|
+
tt = me(function e(t, r) {
|
|
2048
2113
|
var n = this;
|
|
2049
|
-
|
|
2050
|
-
return
|
|
2114
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2115
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2051
2116
|
var t;
|
|
2052
|
-
return
|
|
2117
|
+
return fe().wrap(function (e) {
|
|
2053
2118
|
for (;;) switch (e.prev = e.next) {
|
|
2054
2119
|
case 0:
|
|
2055
2120
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2073,9 +2138,9 @@ var Ge = Promise.resolve({
|
|
|
2073
2138
|
return e(null !== (r = null == t ? void 0 : t.organization) && void 0 !== r ? r : null);
|
|
2074
2139
|
});
|
|
2075
2140
|
}, this.update = function (e) {
|
|
2076
|
-
return
|
|
2141
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2077
2142
|
var r;
|
|
2078
|
-
return
|
|
2143
|
+
return fe().wrap(function (t) {
|
|
2079
2144
|
for (;;) switch (t.prev = t.next) {
|
|
2080
2145
|
case 0:
|
|
2081
2146
|
return t.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2093,9 +2158,9 @@ var Ge = Promise.resolve({
|
|
|
2093
2158
|
}, t, this);
|
|
2094
2159
|
}));
|
|
2095
2160
|
}, this["delete"] = function () {
|
|
2096
|
-
return
|
|
2161
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2097
2162
|
var t;
|
|
2098
|
-
return
|
|
2163
|
+
return fe().wrap(function (e) {
|
|
2099
2164
|
for (;;) switch (e.prev = e.next) {
|
|
2100
2165
|
case 0:
|
|
2101
2166
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -2113,8 +2178,8 @@ var Ge = Promise.resolve({
|
|
|
2113
2178
|
}));
|
|
2114
2179
|
}, this.members = {
|
|
2115
2180
|
create: function create(e) {
|
|
2116
|
-
return
|
|
2117
|
-
return
|
|
2181
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2182
|
+
return fe().wrap(function (t) {
|
|
2118
2183
|
for (;;) switch (t.prev = t.next) {
|
|
2119
2184
|
case 0:
|
|
2120
2185
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2131,8 +2196,8 @@ var Ge = Promise.resolve({
|
|
|
2131
2196
|
}));
|
|
2132
2197
|
},
|
|
2133
2198
|
search: function search(e) {
|
|
2134
|
-
return
|
|
2135
|
-
return
|
|
2199
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2200
|
+
return fe().wrap(function (t) {
|
|
2136
2201
|
for (;;) switch (t.prev = t.next) {
|
|
2137
2202
|
case 0:
|
|
2138
2203
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2149,8 +2214,8 @@ var Ge = Promise.resolve({
|
|
|
2149
2214
|
}));
|
|
2150
2215
|
},
|
|
2151
2216
|
update: function update(e) {
|
|
2152
|
-
return
|
|
2153
|
-
return
|
|
2217
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2218
|
+
return fe().wrap(function (t) {
|
|
2154
2219
|
for (;;) switch (t.prev = t.next) {
|
|
2155
2220
|
case 0:
|
|
2156
2221
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2167,8 +2232,8 @@ var Ge = Promise.resolve({
|
|
|
2167
2232
|
}));
|
|
2168
2233
|
},
|
|
2169
2234
|
deletePassword: function deletePassword(e) {
|
|
2170
|
-
return
|
|
2171
|
-
return
|
|
2235
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2236
|
+
return fe().wrap(function (t) {
|
|
2172
2237
|
for (;;) switch (t.prev = t.next) {
|
|
2173
2238
|
case 0:
|
|
2174
2239
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2184,8 +2249,8 @@ var Ge = Promise.resolve({
|
|
|
2184
2249
|
}));
|
|
2185
2250
|
},
|
|
2186
2251
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2187
|
-
return
|
|
2188
|
-
return
|
|
2252
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2253
|
+
return fe().wrap(function (t) {
|
|
2189
2254
|
for (;;) switch (t.prev = t.next) {
|
|
2190
2255
|
case 0:
|
|
2191
2256
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2201,8 +2266,8 @@ var Ge = Promise.resolve({
|
|
|
2201
2266
|
}));
|
|
2202
2267
|
},
|
|
2203
2268
|
deleteMFATOTP: function deleteMFATOTP(e) {
|
|
2204
|
-
return
|
|
2205
|
-
return
|
|
2269
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2270
|
+
return fe().wrap(function (t) {
|
|
2206
2271
|
for (;;) switch (t.prev = t.next) {
|
|
2207
2272
|
case 0:
|
|
2208
2273
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2218,8 +2283,8 @@ var Ge = Promise.resolve({
|
|
|
2218
2283
|
}));
|
|
2219
2284
|
},
|
|
2220
2285
|
"delete": function _delete(e) {
|
|
2221
|
-
return
|
|
2222
|
-
return
|
|
2286
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2287
|
+
return fe().wrap(function (t) {
|
|
2223
2288
|
for (;;) switch (t.prev = t.next) {
|
|
2224
2289
|
case 0:
|
|
2225
2290
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2235,8 +2300,8 @@ var Ge = Promise.resolve({
|
|
|
2235
2300
|
}));
|
|
2236
2301
|
},
|
|
2237
2302
|
reactivate: function reactivate(e) {
|
|
2238
|
-
return
|
|
2239
|
-
return
|
|
2303
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2304
|
+
return fe().wrap(function (t) {
|
|
2240
2305
|
for (;;) switch (t.prev = t.next) {
|
|
2241
2306
|
case 0:
|
|
2242
2307
|
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -2253,18 +2318,18 @@ var Ge = Promise.resolve({
|
|
|
2253
2318
|
}
|
|
2254
2319
|
};
|
|
2255
2320
|
}),
|
|
2256
|
-
|
|
2321
|
+
rt = function () {
|
|
2257
2322
|
function e(t, r, n, i, o) {
|
|
2258
2323
|
var s = this,
|
|
2259
|
-
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] :
|
|
2260
|
-
|
|
2324
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ye();
|
|
2325
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
2261
2326
|
authenticate: function authenticate(e) {
|
|
2262
|
-
return
|
|
2327
|
+
return xe(s, void 0, void 0, fe().mark(function t() {
|
|
2263
2328
|
var r, n, i, o, s, a;
|
|
2264
|
-
return
|
|
2329
|
+
return fe().wrap(function (t) {
|
|
2265
2330
|
for (;;) switch (t.prev = t.next) {
|
|
2266
2331
|
case 0:
|
|
2267
|
-
return
|
|
2332
|
+
return Ge("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
2268
2333
|
case 3:
|
|
2269
2334
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2270
2335
|
case 6:
|
|
@@ -2305,17 +2370,17 @@ var Ge = Promise.resolve({
|
|
|
2305
2370
|
}
|
|
2306
2371
|
};
|
|
2307
2372
|
}
|
|
2308
|
-
return
|
|
2373
|
+
return me(e, [{
|
|
2309
2374
|
key: "authenticate",
|
|
2310
2375
|
value: function value(e) {
|
|
2311
|
-
return
|
|
2376
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2312
2377
|
var r, n, i, o, s;
|
|
2313
|
-
return
|
|
2378
|
+
return fe().wrap(function (t) {
|
|
2314
2379
|
for (;;) switch (t.prev = t.next) {
|
|
2315
2380
|
case 0:
|
|
2316
|
-
return
|
|
2381
|
+
return Ge("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2317
2382
|
case 3:
|
|
2318
|
-
return (r = t.sent) ||
|
|
2383
|
+
return (r = t.sent) || ze("No code verifier found in local storage for OAuth flow.\nConsider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\nSee https://stytch.com/docs/oauth#guides_pkce for more information."), t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2319
2384
|
case 7:
|
|
2320
2385
|
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
2321
2386
|
url: "/b2b/oauth/authenticate",
|
|
@@ -2354,9 +2419,9 @@ var Ge = Promise.resolve({
|
|
|
2354
2419
|
}, {
|
|
2355
2420
|
key: "getBaseApiUrl",
|
|
2356
2421
|
value: function value() {
|
|
2357
|
-
return
|
|
2422
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2358
2423
|
var t, r;
|
|
2359
|
-
return
|
|
2424
|
+
return fe().wrap(function (e) {
|
|
2360
2425
|
for (;;) switch (e.prev = e.next) {
|
|
2361
2426
|
case 0:
|
|
2362
2427
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -2367,7 +2432,7 @@ var Ge = Promise.resolve({
|
|
|
2367
2432
|
}
|
|
2368
2433
|
return e.abrupt("return", "https://".concat(r));
|
|
2369
2434
|
case 6:
|
|
2370
|
-
if (!
|
|
2435
|
+
if (!He(this._config.publicToken)) {
|
|
2371
2436
|
e.next = 8;
|
|
2372
2437
|
break;
|
|
2373
2438
|
}
|
|
@@ -2392,16 +2457,16 @@ var Ge = Promise.resolve({
|
|
|
2392
2457
|
s = r.signup_redirect_url,
|
|
2393
2458
|
a = r.custom_scopes,
|
|
2394
2459
|
c = r.provider_params;
|
|
2395
|
-
return
|
|
2460
|
+
return xe(t, void 0, void 0, fe().mark(function t() {
|
|
2396
2461
|
var r, u, l, d, h, p;
|
|
2397
|
-
return
|
|
2462
|
+
return fe().wrap(function (t) {
|
|
2398
2463
|
for (;;) switch (t.prev = t.next) {
|
|
2399
2464
|
case 0:
|
|
2400
2465
|
return t.next = 2, this._dynamicConfig;
|
|
2401
2466
|
case 2:
|
|
2402
2467
|
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2403
2468
|
case 6:
|
|
2404
|
-
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (
|
|
2469
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (Ge("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in Ge("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2405
2470
|
if (!u) {
|
|
2406
2471
|
t.next = 20;
|
|
2407
2472
|
break;
|
|
@@ -2430,16 +2495,16 @@ var Ge = Promise.resolve({
|
|
|
2430
2495
|
var n = r.discovery_redirect_url,
|
|
2431
2496
|
i = r.custom_scopes,
|
|
2432
2497
|
o = r.provider_params;
|
|
2433
|
-
return
|
|
2498
|
+
return xe(t, void 0, void 0, fe().mark(function t() {
|
|
2434
2499
|
var r, s, a, c, u, l;
|
|
2435
|
-
return
|
|
2500
|
+
return fe().wrap(function (t) {
|
|
2436
2501
|
for (;;) switch (t.prev = t.next) {
|
|
2437
2502
|
case 0:
|
|
2438
2503
|
return t.next = 2, this._dynamicConfig;
|
|
2439
2504
|
case 2:
|
|
2440
2505
|
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
2441
2506
|
case 6:
|
|
2442
|
-
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (
|
|
2507
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (Ge("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in Ge("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2443
2508
|
if (!s) {
|
|
2444
2509
|
t.next = 18;
|
|
2445
2510
|
break;
|
|
@@ -2462,10 +2527,10 @@ var Ge = Promise.resolve({
|
|
|
2462
2527
|
}
|
|
2463
2528
|
}]), e;
|
|
2464
2529
|
}(),
|
|
2465
|
-
|
|
2530
|
+
nt = function () {
|
|
2466
2531
|
function e(t, r) {
|
|
2467
2532
|
var n = this;
|
|
2468
|
-
|
|
2533
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
2469
2534
|
return n._subscriptionService.getSession();
|
|
2470
2535
|
}, this.onChange = function (e) {
|
|
2471
2536
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -2473,9 +2538,9 @@ var Ge = Promise.resolve({
|
|
|
2473
2538
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
2474
2539
|
});
|
|
2475
2540
|
}, this.revoke = function (e) {
|
|
2476
|
-
return
|
|
2541
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2477
2542
|
var r;
|
|
2478
|
-
return
|
|
2543
|
+
return fe().wrap(function (t) {
|
|
2479
2544
|
for (;;) switch (t.prev = t.next) {
|
|
2480
2545
|
case 0:
|
|
2481
2546
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -2486,7 +2551,7 @@ var Ge = Promise.resolve({
|
|
|
2486
2551
|
case 3:
|
|
2487
2552
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
2488
2553
|
case 8:
|
|
2489
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2554
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || T.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
2490
2555
|
case 12:
|
|
2491
2556
|
case "end":
|
|
2492
2557
|
return t.stop();
|
|
@@ -2494,13 +2559,13 @@ var Ge = Promise.resolve({
|
|
|
2494
2559
|
}, t, this, [[0, 8]]);
|
|
2495
2560
|
}));
|
|
2496
2561
|
}, this.authenticate = function (e) {
|
|
2497
|
-
return
|
|
2562
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2498
2563
|
var r,
|
|
2499
2564
|
n,
|
|
2500
2565
|
i,
|
|
2501
2566
|
o,
|
|
2502
2567
|
s = this;
|
|
2503
|
-
return
|
|
2568
|
+
return fe().wrap(function (t) {
|
|
2504
2569
|
for (;;) switch (t.prev = t.next) {
|
|
2505
2570
|
case 0:
|
|
2506
2571
|
return r = this._subscriptionService.getSession(), n = function n() {
|
|
@@ -2538,7 +2603,7 @@ var Ge = Promise.resolve({
|
|
|
2538
2603
|
}
|
|
2539
2604
|
return t.abrupt("return", this.authenticate(e));
|
|
2540
2605
|
case 17:
|
|
2541
|
-
throw
|
|
2606
|
+
throw T.includes(t.t0.error_type) && this._subscriptionService.destroySession(), t.t0;
|
|
2542
2607
|
case 19:
|
|
2543
2608
|
case "end":
|
|
2544
2609
|
return t.stop();
|
|
@@ -2546,12 +2611,12 @@ var Ge = Promise.resolve({
|
|
|
2546
2611
|
}, t, this, [[2, 13]]);
|
|
2547
2612
|
}));
|
|
2548
2613
|
}, this.exchange = function (e) {
|
|
2549
|
-
return
|
|
2614
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2550
2615
|
var r;
|
|
2551
|
-
return
|
|
2616
|
+
return fe().wrap(function (t) {
|
|
2552
2617
|
for (;;) switch (t.prev = t.next) {
|
|
2553
2618
|
case 0:
|
|
2554
|
-
return
|
|
2619
|
+
return Ge("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
2555
2620
|
url: "/b2b/sessions/exchange",
|
|
2556
2621
|
body: e,
|
|
2557
2622
|
errorMessage: "Failed to exchange session",
|
|
@@ -2583,19 +2648,19 @@ var Ge = Promise.resolve({
|
|
|
2583
2648
|
}));
|
|
2584
2649
|
};
|
|
2585
2650
|
}
|
|
2586
|
-
return
|
|
2651
|
+
return me(e, [{
|
|
2587
2652
|
key: "getTokens",
|
|
2588
2653
|
value: function value() {
|
|
2589
2654
|
return this._subscriptionService.getTokens();
|
|
2590
2655
|
}
|
|
2591
2656
|
}]), e;
|
|
2592
2657
|
}(),
|
|
2593
|
-
|
|
2658
|
+
it = me(function e(t, r) {
|
|
2594
2659
|
var n = this;
|
|
2595
|
-
|
|
2660
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
2596
2661
|
list: function list() {
|
|
2597
|
-
return
|
|
2598
|
-
return
|
|
2662
|
+
return xe(n, void 0, void 0, fe().mark(function e() {
|
|
2663
|
+
return fe().wrap(function (e) {
|
|
2599
2664
|
for (;;) switch (e.prev = e.next) {
|
|
2600
2665
|
case 0:
|
|
2601
2666
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -2622,12 +2687,12 @@ var Ge = Promise.resolve({
|
|
|
2622
2687
|
}));
|
|
2623
2688
|
},
|
|
2624
2689
|
create: function create(e) {
|
|
2625
|
-
return
|
|
2690
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2626
2691
|
var r, n;
|
|
2627
|
-
return
|
|
2692
|
+
return fe().wrap(function (t) {
|
|
2628
2693
|
for (;;) switch (t.prev = t.next) {
|
|
2629
2694
|
case 0:
|
|
2630
|
-
return
|
|
2695
|
+
return Ge("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2631
2696
|
case 5:
|
|
2632
2697
|
if (t.t2 = t.sent, t.t2) {
|
|
2633
2698
|
t.next = 8;
|
|
@@ -2668,12 +2733,12 @@ var Ge = Promise.resolve({
|
|
|
2668
2733
|
}
|
|
2669
2734
|
}, this.intermediateSessions = {
|
|
2670
2735
|
exchange: function exchange(e) {
|
|
2671
|
-
return
|
|
2736
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
2672
2737
|
var r, n;
|
|
2673
|
-
return
|
|
2738
|
+
return fe().wrap(function (t) {
|
|
2674
2739
|
for (;;) switch (t.prev = t.next) {
|
|
2675
2740
|
case 0:
|
|
2676
|
-
return
|
|
2741
|
+
return Ge("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
2677
2742
|
case 5:
|
|
2678
2743
|
if (t.t2 = t.sent, t.t2) {
|
|
2679
2744
|
t.next = 8;
|
|
@@ -2714,21 +2779,21 @@ var Ge = Promise.resolve({
|
|
|
2714
2779
|
}
|
|
2715
2780
|
};
|
|
2716
2781
|
}),
|
|
2717
|
-
|
|
2782
|
+
ot = Promise.resolve({
|
|
2718
2783
|
pkceRequiredForPasswordResets: !1
|
|
2719
2784
|
}),
|
|
2720
|
-
|
|
2785
|
+
st = function () {
|
|
2721
2786
|
function e(t, r, n) {
|
|
2722
|
-
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
|
|
2723
|
-
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] :
|
|
2724
|
-
|
|
2787
|
+
var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : ot,
|
|
2788
|
+
o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye();
|
|
2789
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._config = i, this.dfpProtectedAuth = o;
|
|
2725
2790
|
}
|
|
2726
|
-
return
|
|
2791
|
+
return me(e, [{
|
|
2727
2792
|
key: "getCodeChallenge",
|
|
2728
2793
|
value: function value() {
|
|
2729
|
-
return
|
|
2794
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
2730
2795
|
var t, r;
|
|
2731
|
-
return
|
|
2796
|
+
return fe().wrap(function (e) {
|
|
2732
2797
|
for (;;) switch (e.prev = e.next) {
|
|
2733
2798
|
case 0:
|
|
2734
2799
|
return e.next = 2, this._config;
|
|
@@ -2760,12 +2825,12 @@ var Ge = Promise.resolve({
|
|
|
2760
2825
|
}, {
|
|
2761
2826
|
key: "authenticate",
|
|
2762
2827
|
value: function value(e) {
|
|
2763
|
-
return
|
|
2828
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2764
2829
|
var r, n, i, o, s, a;
|
|
2765
|
-
return
|
|
2830
|
+
return fe().wrap(function (t) {
|
|
2766
2831
|
for (;;) switch (t.prev = t.next) {
|
|
2767
2832
|
case 0:
|
|
2768
|
-
return
|
|
2833
|
+
return Ge("stytch.passwords.authenticate").isString("org_id", e.organization_id).isString("password", e.password).isString("email_address", e.email_address).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
2769
2834
|
case 3:
|
|
2770
2835
|
return r = t.sent, n = null == r ? void 0 : r.code_verifier, t.next = 7, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2771
2836
|
case 7:
|
|
@@ -2811,12 +2876,12 @@ var Ge = Promise.resolve({
|
|
|
2811
2876
|
}, {
|
|
2812
2877
|
key: "resetByEmailStart",
|
|
2813
2878
|
value: function value(e) {
|
|
2814
|
-
return
|
|
2879
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2815
2880
|
var r, n, i, o;
|
|
2816
|
-
return
|
|
2881
|
+
return fe().wrap(function (t) {
|
|
2817
2882
|
for (;;) switch (t.prev = t.next) {
|
|
2818
2883
|
case 0:
|
|
2819
|
-
return
|
|
2884
|
+
return Ge("stytch.passwords.resetByEmailStart").isString("email", e.email_address).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("reset_password_redirect_url", e.reset_password_redirect_url).isOptionalString("reset_password_template_id", e.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes", e.reset_password_expiration_minutes), t.next = 3, this.getCodeChallenge();
|
|
2820
2885
|
case 3:
|
|
2821
2886
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2822
2887
|
case 6:
|
|
@@ -2847,12 +2912,12 @@ var Ge = Promise.resolve({
|
|
|
2847
2912
|
}, {
|
|
2848
2913
|
key: "resetByEmail",
|
|
2849
2914
|
value: function value(e) {
|
|
2850
|
-
return
|
|
2915
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2851
2916
|
var r, n, i, o, s, a;
|
|
2852
|
-
return
|
|
2917
|
+
return fe().wrap(function (t) {
|
|
2853
2918
|
for (;;) switch (t.prev = t.next) {
|
|
2854
2919
|
case 0:
|
|
2855
|
-
return
|
|
2920
|
+
return Ge("stytch.passwords.resetByEmail").isString("password_reset_token", e.password_reset_token).isString("password", e.password).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2856
2921
|
case 3:
|
|
2857
2922
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._pkceManager.getPKPair();
|
|
2858
2923
|
case 8:
|
|
@@ -2897,12 +2962,12 @@ var Ge = Promise.resolve({
|
|
|
2897
2962
|
}, {
|
|
2898
2963
|
key: "resetByExistingPassword",
|
|
2899
2964
|
value: function value(e) {
|
|
2900
|
-
return
|
|
2965
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2901
2966
|
var r, n, i, o;
|
|
2902
|
-
return
|
|
2967
|
+
return fe().wrap(function (t) {
|
|
2903
2968
|
for (;;) switch (t.prev = t.next) {
|
|
2904
2969
|
case 0:
|
|
2905
|
-
return
|
|
2970
|
+
return Ge("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2906
2971
|
case 3:
|
|
2907
2972
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2908
2973
|
url: "/b2b/passwords/existing_password/reset",
|
|
@@ -2946,12 +3011,12 @@ var Ge = Promise.resolve({
|
|
|
2946
3011
|
}, {
|
|
2947
3012
|
key: "resetBySession",
|
|
2948
3013
|
value: function value(e) {
|
|
2949
|
-
return
|
|
3014
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
2950
3015
|
var r, n, i, o;
|
|
2951
|
-
return
|
|
3016
|
+
return fe().wrap(function (t) {
|
|
2952
3017
|
for (;;) switch (t.prev = t.next) {
|
|
2953
3018
|
case 0:
|
|
2954
|
-
return
|
|
3019
|
+
return Ge("stytch.passwords.resetBySession").isString("password", e.password), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2955
3020
|
case 3:
|
|
2956
3021
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.next = 8, this._networkClient.retriableFetchSDK({
|
|
2957
3022
|
url: "/b2b/passwords/session/reset",
|
|
@@ -2985,11 +3050,11 @@ var Ge = Promise.resolve({
|
|
|
2985
3050
|
}, {
|
|
2986
3051
|
key: "strengthCheck",
|
|
2987
3052
|
value: function value(e) {
|
|
2988
|
-
return
|
|
2989
|
-
return
|
|
3053
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3054
|
+
return fe().wrap(function (t) {
|
|
2990
3055
|
for (;;) switch (t.prev = t.next) {
|
|
2991
3056
|
case 0:
|
|
2992
|
-
return
|
|
3057
|
+
return Ge("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), t.abrupt("return", this._networkClient.fetchSDK({
|
|
2993
3058
|
url: "/b2b/passwords/strength_check",
|
|
2994
3059
|
method: "POST",
|
|
2995
3060
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3007,17 +3072,17 @@ var Ge = Promise.resolve({
|
|
|
3007
3072
|
}
|
|
3008
3073
|
}]), e;
|
|
3009
3074
|
}(),
|
|
3010
|
-
|
|
3075
|
+
at = me(function e(t, r) {
|
|
3011
3076
|
var n = this,
|
|
3012
|
-
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3013
|
-
|
|
3077
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3078
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
3014
3079
|
send: function send(e) {
|
|
3015
|
-
return
|
|
3080
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3016
3081
|
var r, n, i;
|
|
3017
|
-
return
|
|
3082
|
+
return fe().wrap(function (t) {
|
|
3018
3083
|
for (;;) switch (t.prev = t.next) {
|
|
3019
3084
|
case 0:
|
|
3020
|
-
return
|
|
3085
|
+
return Ge("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3021
3086
|
case 3:
|
|
3022
3087
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3023
3088
|
case 13:
|
|
@@ -3046,12 +3111,12 @@ var Ge = Promise.resolve({
|
|
|
3046
3111
|
}));
|
|
3047
3112
|
},
|
|
3048
3113
|
authenticate: function authenticate(e) {
|
|
3049
|
-
return
|
|
3114
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3050
3115
|
var r, n, i, o, s;
|
|
3051
|
-
return
|
|
3116
|
+
return fe().wrap(function (t) {
|
|
3052
3117
|
for (;;) switch (t.prev = t.next) {
|
|
3053
3118
|
case 0:
|
|
3054
|
-
return
|
|
3119
|
+
return Ge("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3055
3120
|
case 3:
|
|
3056
3121
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3057
3122
|
case 12:
|
|
@@ -3092,20 +3157,20 @@ var Ge = Promise.resolve({
|
|
|
3092
3157
|
}
|
|
3093
3158
|
};
|
|
3094
3159
|
}),
|
|
3095
|
-
|
|
3160
|
+
ct = function () {
|
|
3096
3161
|
function e(t, r) {
|
|
3097
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3098
|
-
|
|
3162
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3163
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3099
3164
|
}
|
|
3100
|
-
return
|
|
3165
|
+
return me(e, [{
|
|
3101
3166
|
key: "create",
|
|
3102
3167
|
value: function value(e) {
|
|
3103
|
-
return
|
|
3168
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3104
3169
|
var r, n, i;
|
|
3105
|
-
return
|
|
3170
|
+
return fe().wrap(function (t) {
|
|
3106
3171
|
for (;;) switch (t.prev = t.next) {
|
|
3107
3172
|
case 0:
|
|
3108
|
-
return
|
|
3173
|
+
return Ge("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3109
3174
|
case 3:
|
|
3110
3175
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
3111
3176
|
case 13:
|
|
@@ -3136,12 +3201,12 @@ var Ge = Promise.resolve({
|
|
|
3136
3201
|
}, {
|
|
3137
3202
|
key: "authenticate",
|
|
3138
3203
|
value: function value(e) {
|
|
3139
|
-
return
|
|
3204
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3140
3205
|
var r, n, i, o, s;
|
|
3141
|
-
return
|
|
3206
|
+
return fe().wrap(function (t) {
|
|
3142
3207
|
for (;;) switch (t.prev = t.next) {
|
|
3143
3208
|
case 0:
|
|
3144
|
-
return
|
|
3209
|
+
return Ge("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3145
3210
|
case 3:
|
|
3146
3211
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3147
3212
|
case 12:
|
|
@@ -3182,20 +3247,20 @@ var Ge = Promise.resolve({
|
|
|
3182
3247
|
}
|
|
3183
3248
|
}]), e;
|
|
3184
3249
|
}(),
|
|
3185
|
-
|
|
3250
|
+
ut = function () {
|
|
3186
3251
|
function e(t, r) {
|
|
3187
|
-
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
|
|
3188
|
-
|
|
3252
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ye();
|
|
3253
|
+
be(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
3189
3254
|
}
|
|
3190
|
-
return
|
|
3255
|
+
return me(e, [{
|
|
3191
3256
|
key: "recover",
|
|
3192
3257
|
value: function value(e) {
|
|
3193
|
-
return
|
|
3258
|
+
return xe(this, void 0, void 0, fe().mark(function t() {
|
|
3194
3259
|
var r, n, i, o, s;
|
|
3195
|
-
return
|
|
3260
|
+
return fe().wrap(function (t) {
|
|
3196
3261
|
for (;;) switch (t.prev = t.next) {
|
|
3197
3262
|
case 0:
|
|
3198
|
-
return
|
|
3263
|
+
return Ge("stytch.recoveryCodes.recover").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3199
3264
|
case 3:
|
|
3200
3265
|
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = Object, t.t1 = Object.assign({}, e), t.t2 = n, t.t3 = i, t.next = 12, this._subscriptionService.getIntermediateSessionToken();
|
|
3201
3266
|
case 12:
|
|
@@ -3237,9 +3302,9 @@ var Ge = Promise.resolve({
|
|
|
3237
3302
|
}, {
|
|
3238
3303
|
key: "rotate",
|
|
3239
3304
|
value: function value() {
|
|
3240
|
-
return
|
|
3305
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3241
3306
|
var t, r, n;
|
|
3242
|
-
return
|
|
3307
|
+
return fe().wrap(function (e) {
|
|
3243
3308
|
for (;;) switch (e.prev = e.next) {
|
|
3244
3309
|
case 0:
|
|
3245
3310
|
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
@@ -3264,8 +3329,8 @@ var Ge = Promise.resolve({
|
|
|
3264
3329
|
}, {
|
|
3265
3330
|
key: "get",
|
|
3266
3331
|
value: function value() {
|
|
3267
|
-
return
|
|
3268
|
-
return
|
|
3332
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3333
|
+
return fe().wrap(function (e) {
|
|
3269
3334
|
for (;;) switch (e.prev = e.next) {
|
|
3270
3335
|
case 0:
|
|
3271
3336
|
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
@@ -3282,21 +3347,21 @@ var Ge = Promise.resolve({
|
|
|
3282
3347
|
}
|
|
3283
3348
|
}]), e;
|
|
3284
3349
|
}(),
|
|
3285
|
-
|
|
3350
|
+
lt = function () {
|
|
3286
3351
|
function e(t, r, n) {
|
|
3287
3352
|
var i = this;
|
|
3288
|
-
|
|
3353
|
+
be(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
3289
3354
|
var r;
|
|
3290
3355
|
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
3291
3356
|
}, this.isAuthorized = function (e, t) {
|
|
3292
3357
|
return i.policyPromise.then(function (r) {
|
|
3293
3358
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
3294
3359
|
});
|
|
3295
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
3296
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3360
|
+
}, this.cachedPolicy = t.rbacPolicy ? ft.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3361
|
+
return e.rbacPolicy ? (i.cachedPolicy = ft.fromJSON(e.rbacPolicy), i.cachedPolicy) : (qe("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new ft([], []));
|
|
3297
3362
|
});
|
|
3298
3363
|
}
|
|
3299
|
-
return
|
|
3364
|
+
return me(e, [{
|
|
3300
3365
|
key: "allPermissions",
|
|
3301
3366
|
value: function value() {
|
|
3302
3367
|
var e = this;
|
|
@@ -3313,15 +3378,107 @@ var Ge = Promise.resolve({
|
|
|
3313
3378
|
}
|
|
3314
3379
|
}]), e;
|
|
3315
3380
|
}(),
|
|
3316
|
-
|
|
3381
|
+
dt = function () {
|
|
3382
|
+
function e(t) {
|
|
3383
|
+
be(this, e), this.iframeURL = t, this.createIframe();
|
|
3384
|
+
}
|
|
3385
|
+
return me(e, [{
|
|
3386
|
+
key: "createIframe",
|
|
3387
|
+
value: function value() {
|
|
3388
|
+
var e = document.querySelector('[src~="'.concat(this.iframeURL, '"]'));
|
|
3389
|
+
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) {
|
|
3390
|
+
e.addEventListener("load", function () {
|
|
3391
|
+
e.dataset.loaded = "true", t(e);
|
|
3392
|
+
}, {
|
|
3393
|
+
once: !0
|
|
3394
|
+
});
|
|
3395
|
+
}) : this.frame = Promise.resolve(e);
|
|
3396
|
+
}
|
|
3397
|
+
}, {
|
|
3398
|
+
key: "call",
|
|
3399
|
+
value: function value(e, t) {
|
|
3400
|
+
return xe(this, void 0, void 0, fe().mark(function r() {
|
|
3401
|
+
var n,
|
|
3402
|
+
i,
|
|
3403
|
+
o = this;
|
|
3404
|
+
return fe().wrap(function (r) {
|
|
3405
|
+
for (;;) switch (r.prev = r.next) {
|
|
3406
|
+
case 0:
|
|
3407
|
+
return r.next = 2, this.frame;
|
|
3408
|
+
case 2:
|
|
3409
|
+
return n = r.sent, i = new MessageChannel(), r.abrupt("return", new Promise(function (r, s) {
|
|
3410
|
+
var a;
|
|
3411
|
+
i.port1.onmessage = function (e) {
|
|
3412
|
+
var t = e.data;
|
|
3413
|
+
i.port1.close(), t.success ? r(t.payload) : s(Je.unmarshall(t.error));
|
|
3414
|
+
};
|
|
3415
|
+
var c = {
|
|
3416
|
+
method: e,
|
|
3417
|
+
args: t
|
|
3418
|
+
};
|
|
3419
|
+
null === (a = n.contentWindow) || void 0 === a || a.postMessage(c, o.iframeURL, [i.port2]);
|
|
3420
|
+
}));
|
|
3421
|
+
case 5:
|
|
3422
|
+
case "end":
|
|
3423
|
+
return r.stop();
|
|
3424
|
+
}
|
|
3425
|
+
}, r, this);
|
|
3426
|
+
}));
|
|
3427
|
+
}
|
|
3428
|
+
}]), e;
|
|
3429
|
+
}(),
|
|
3430
|
+
ht = function () {
|
|
3431
|
+
function e(t) {
|
|
3432
|
+
be(this, e), this._networkClient = t;
|
|
3433
|
+
}
|
|
3434
|
+
return me(e, [{
|
|
3435
|
+
key: "searchUser",
|
|
3436
|
+
value: function value(e) {
|
|
3437
|
+
return this._networkClient.fetchSDK({
|
|
3438
|
+
url: "/users/search",
|
|
3439
|
+
method: "POST",
|
|
3440
|
+
body: {
|
|
3441
|
+
email: e
|
|
3442
|
+
},
|
|
3443
|
+
errorMessage: "Error searching for user ".concat(e)
|
|
3444
|
+
});
|
|
3445
|
+
}
|
|
3446
|
+
}, {
|
|
3447
|
+
key: "searchOrganization",
|
|
3448
|
+
value: function value(e) {
|
|
3449
|
+
return this._networkClient.fetchSDK({
|
|
3450
|
+
url: "/b2b/organizations/search",
|
|
3451
|
+
method: "POST",
|
|
3452
|
+
body: {
|
|
3453
|
+
organization_slug: e
|
|
3454
|
+
},
|
|
3455
|
+
errorMessage: "Error searching slug"
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
}, {
|
|
3459
|
+
key: "searchMember",
|
|
3460
|
+
value: function value(e, t) {
|
|
3461
|
+
return this._networkClient.fetchSDK({
|
|
3462
|
+
url: "/b2b/organizations/members/search",
|
|
3463
|
+
method: "POST",
|
|
3464
|
+
body: {
|
|
3465
|
+
email_address: e,
|
|
3466
|
+
organization_id: t
|
|
3467
|
+
},
|
|
3468
|
+
errorMessage: "Error searching for member ".concat(e)
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
}]), e;
|
|
3472
|
+
}(),
|
|
3473
|
+
pt = function () {
|
|
3317
3474
|
function e(t, r) {
|
|
3318
3475
|
var n = this;
|
|
3319
|
-
|
|
3476
|
+
be(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
3320
3477
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
3321
3478
|
}, this._reauthenticateWithBackoff = function () {
|
|
3322
|
-
return
|
|
3479
|
+
return xe(n, void 0, void 0, fe().mark(function t() {
|
|
3323
3480
|
var r;
|
|
3324
|
-
return
|
|
3481
|
+
return fe().wrap(function (t) {
|
|
3325
3482
|
for (;;) switch (t.prev = t.next) {
|
|
3326
3483
|
case 0:
|
|
3327
3484
|
r = 0;
|
|
@@ -3350,14 +3507,14 @@ var Ge = Promise.resolve({
|
|
|
3350
3507
|
}));
|
|
3351
3508
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
3352
3509
|
}
|
|
3353
|
-
return
|
|
3510
|
+
return me(e, [{
|
|
3354
3511
|
key: "performBackgroundRefresh",
|
|
3355
3512
|
value: function value() {
|
|
3356
3513
|
var e = this;
|
|
3357
3514
|
this._reauthenticateWithBackoff().then(function () {
|
|
3358
3515
|
e.scheduleBackgroundRefresh();
|
|
3359
3516
|
})["catch"](function (t) {
|
|
3360
|
-
|
|
3517
|
+
ze("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
3361
3518
|
error: t
|
|
3362
3519
|
}), e._subscriptionService.destroySession();
|
|
3363
3520
|
});
|
|
@@ -3383,19 +3540,19 @@ var Ge = Promise.resolve({
|
|
|
3383
3540
|
}, {
|
|
3384
3541
|
key: "isUnrecoverableError",
|
|
3385
3542
|
value: function value(e) {
|
|
3386
|
-
return
|
|
3543
|
+
return T.includes(e.error_type);
|
|
3387
3544
|
}
|
|
3388
3545
|
}]), e;
|
|
3389
3546
|
}();
|
|
3390
|
-
|
|
3391
|
-
var
|
|
3547
|
+
pt.REFRESH_INTERVAL_MS = 18e4;
|
|
3548
|
+
var ft = function () {
|
|
3392
3549
|
function e(t, r) {
|
|
3393
3550
|
var n = this;
|
|
3394
|
-
|
|
3551
|
+
be(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3395
3552
|
return n.rolesByID[e.role_id] = e;
|
|
3396
3553
|
});
|
|
3397
3554
|
}
|
|
3398
|
-
return
|
|
3555
|
+
return me(e, [{
|
|
3399
3556
|
key: "callerIsAuthorized",
|
|
3400
3557
|
value: function value(e, t, r) {
|
|
3401
3558
|
var n = this;
|
|
@@ -3429,19 +3586,19 @@ var at = function () {
|
|
|
3429
3586
|
}
|
|
3430
3587
|
}]), e;
|
|
3431
3588
|
}();
|
|
3432
|
-
var
|
|
3433
|
-
var
|
|
3434
|
-
function
|
|
3589
|
+
var _t = "bootstrap";
|
|
3590
|
+
var mt = /*#__PURE__*/function () {
|
|
3591
|
+
function mt(e, t, r) {
|
|
3435
3592
|
var _this = this;
|
|
3436
|
-
_classCallCheck(this,
|
|
3593
|
+
_classCallCheck(this, mt);
|
|
3437
3594
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3438
3595
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3439
3596
|
method: "GET",
|
|
3440
3597
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3441
|
-
}).then(
|
|
3442
|
-
return _this._dataLayer.setItem(
|
|
3598
|
+
}).then(mt.mapBootstrapData).then(function (e) {
|
|
3599
|
+
return _this._dataLayer.setItem(_t, JSON.stringify(e)), e;
|
|
3443
3600
|
})["catch"](function (e) {
|
|
3444
|
-
return
|
|
3601
|
+
return qe(e), {
|
|
3445
3602
|
displayWatermark: !1,
|
|
3446
3603
|
cnameDomain: null,
|
|
3447
3604
|
emailDomains: ["stytch.com"],
|
|
@@ -3460,10 +3617,10 @@ var ut = /*#__PURE__*/function () {
|
|
|
3460
3617
|
};
|
|
3461
3618
|
});
|
|
3462
3619
|
}
|
|
3463
|
-
_createClass(
|
|
3620
|
+
_createClass(mt, [{
|
|
3464
3621
|
key: "getSync",
|
|
3465
3622
|
value: function getSync() {
|
|
3466
|
-
var e = this._dataLayer.getItem(
|
|
3623
|
+
var e = this._dataLayer.getItem(_t);
|
|
3467
3624
|
if (null === e) return {
|
|
3468
3625
|
displayWatermark: !1,
|
|
3469
3626
|
cnameDomain: null,
|
|
@@ -3534,9 +3691,9 @@ var ut = /*#__PURE__*/function () {
|
|
|
3534
3691
|
};
|
|
3535
3692
|
}
|
|
3536
3693
|
}]);
|
|
3537
|
-
return
|
|
3694
|
+
return mt;
|
|
3538
3695
|
}();
|
|
3539
|
-
function
|
|
3696
|
+
function vt(e, t, r, n) {
|
|
3540
3697
|
return new (r || (r = Promise))(function (i, o) {
|
|
3541
3698
|
function s(e) {
|
|
3542
3699
|
try {
|
|
@@ -3562,11 +3719,11 @@ function lt(e, t, r, n) {
|
|
|
3562
3719
|
});
|
|
3563
3720
|
}
|
|
3564
3721
|
"function" == typeof SuppressedError && SuppressedError;
|
|
3565
|
-
var
|
|
3722
|
+
var bt = /*#__PURE__*/_createClass(function bt(e) {
|
|
3566
3723
|
var _this2 = this;
|
|
3567
|
-
_classCallCheck(this,
|
|
3724
|
+
_classCallCheck(this, bt);
|
|
3568
3725
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3569
|
-
return
|
|
3726
|
+
return vt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3570
3727
|
var _yield$this$state, e, t, r;
|
|
3571
3728
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3572
3729
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -3597,7 +3754,7 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3597
3754
|
}, _callee, this);
|
|
3598
3755
|
}));
|
|
3599
3756
|
}, this.state = e.then(function (e) {
|
|
3600
|
-
return
|
|
3757
|
+
return vt(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3601
3758
|
var t;
|
|
3602
3759
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3603
3760
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -3608,7 +3765,7 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3608
3765
|
}
|
|
3609
3766
|
_context2.t1 = !0;
|
|
3610
3767
|
_context2.next = 4;
|
|
3611
|
-
return t = e.captchaSettings.siteKey,
|
|
3768
|
+
return t = e.captchaSettings.siteKey, je("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
3612
3769
|
return window.grecaptcha.enterprise;
|
|
3613
3770
|
});
|
|
3614
3771
|
case 4:
|
|
@@ -3635,18 +3792,44 @@ var dt = /*#__PURE__*/_createClass(function dt(e) {
|
|
|
3635
3792
|
}));
|
|
3636
3793
|
});
|
|
3637
3794
|
});
|
|
3638
|
-
var
|
|
3639
|
-
function
|
|
3640
|
-
|
|
3795
|
+
var gt = /*#__PURE__*/function () {
|
|
3796
|
+
function gt(e) {
|
|
3797
|
+
var _this3 = this;
|
|
3798
|
+
_classCallCheck(this, gt);
|
|
3799
|
+
this.iframeURL = e, this.oneTapStart = function (e) {
|
|
3800
|
+
return _this3.call("oneTapStart", e);
|
|
3801
|
+
}, this.oneTapSubmit = function (e) {
|
|
3802
|
+
return _this3.call("oneTapSubmit", e);
|
|
3803
|
+
}, this.parsedPhoneNumber = function (e) {
|
|
3804
|
+
return _this3.call("parsedPhoneNumber", e);
|
|
3805
|
+
};
|
|
3806
|
+
}
|
|
3807
|
+
_createClass(gt, [{
|
|
3808
|
+
key: "frameClient",
|
|
3809
|
+
get: function get() {
|
|
3810
|
+
var e;
|
|
3811
|
+
return this._frameClient = null !== (e = this._frameClient) && void 0 !== e ? e : new dt(this.iframeURL), this._frameClient;
|
|
3812
|
+
}
|
|
3813
|
+
}, {
|
|
3814
|
+
key: "call",
|
|
3815
|
+
value: function call(e, t) {
|
|
3816
|
+
return this.frameClient.call(e, [t]);
|
|
3817
|
+
}
|
|
3818
|
+
}]);
|
|
3819
|
+
return gt;
|
|
3820
|
+
}();
|
|
3821
|
+
var yt = /*#__PURE__*/function () {
|
|
3822
|
+
function yt(e, t, r, n) {
|
|
3823
|
+
_classCallCheck(this, yt);
|
|
3641
3824
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3642
3825
|
return null;
|
|
3643
|
-
}, this.eventLogger = new
|
|
3826
|
+
}, this.eventLogger = new $e({
|
|
3644
3827
|
maxBatchSize: 15,
|
|
3645
3828
|
intervalDurationMs: 800,
|
|
3646
3829
|
logEventURL: this.buildSDKUrl("/events")
|
|
3647
3830
|
});
|
|
3648
3831
|
}
|
|
3649
|
-
_createClass(
|
|
3832
|
+
_createClass(yt, [{
|
|
3650
3833
|
key: "logEvent",
|
|
3651
3834
|
value: function logEvent(_ref) {
|
|
3652
3835
|
var e = _ref.name,
|
|
@@ -3666,9 +3849,9 @@ var ht = /*#__PURE__*/function () {
|
|
|
3666
3849
|
key: "createTelemetryBlob",
|
|
3667
3850
|
value: function createTelemetryBlob() {
|
|
3668
3851
|
return Object.assign(Object.assign({
|
|
3669
|
-
event_id: "event-id-".concat(
|
|
3670
|
-
app_session_id: "app-session-id-".concat(
|
|
3671
|
-
persistent_id: "persistent-id-".concat(
|
|
3852
|
+
event_id: "event-id-".concat(Me()),
|
|
3853
|
+
app_session_id: "app-session-id-".concat(Me()),
|
|
3854
|
+
persistent_id: "persistent-id-".concat(Me()),
|
|
3672
3855
|
client_sent_at: new Date().toISOString(),
|
|
3673
3856
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3674
3857
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -3677,7 +3860,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3677
3860
|
},
|
|
3678
3861
|
sdk: {
|
|
3679
3862
|
identifier: "Stytch.js Javascript SDK",
|
|
3680
|
-
version: "4.
|
|
3863
|
+
version: "4.7.0"
|
|
3681
3864
|
}
|
|
3682
3865
|
});
|
|
3683
3866
|
}
|
|
@@ -3688,13 +3871,13 @@ var ht = /*#__PURE__*/function () {
|
|
|
3688
3871
|
t = _ref2.body,
|
|
3689
3872
|
r = _ref2.errorMessage,
|
|
3690
3873
|
n = _ref2.method;
|
|
3691
|
-
return
|
|
3874
|
+
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3692
3875
|
var i, o, s, a;
|
|
3693
3876
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3694
3877
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3695
3878
|
case 0:
|
|
3696
3879
|
i = this._subscriptionDataLayer.readSessionCookie().session_token, o = "Basic " + window.btoa(this._publicToken + ":" + (i || this._publicToken)), s = window.btoa(JSON.stringify(this.createTelemetryBlob())), a = window.location.origin;
|
|
3697
|
-
return _context3.abrupt("return",
|
|
3880
|
+
return _context3.abrupt("return", Oe({
|
|
3698
3881
|
basicAuthHeader: o,
|
|
3699
3882
|
body: t,
|
|
3700
3883
|
errorMessage: r,
|
|
@@ -3718,7 +3901,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3718
3901
|
r = _ref3.errorMessage,
|
|
3719
3902
|
n = _ref3.method,
|
|
3720
3903
|
i = _ref3.retryCallback;
|
|
3721
|
-
return
|
|
3904
|
+
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3722
3905
|
var o, s, a, c;
|
|
3723
3906
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3724
3907
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -3733,9 +3916,9 @@ var ht = /*#__PURE__*/function () {
|
|
|
3733
3916
|
s = e.xSDKParentHostHeader,
|
|
3734
3917
|
a = e.body,
|
|
3735
3918
|
c = e.retryCallback;
|
|
3736
|
-
return
|
|
3919
|
+
return xe(this, void 0, void 0, fe().mark(function e() {
|
|
3737
3920
|
var u;
|
|
3738
|
-
return
|
|
3921
|
+
return fe().wrap(function (e) {
|
|
3739
3922
|
for (;;) switch (e.prev = e.next) {
|
|
3740
3923
|
case 0:
|
|
3741
3924
|
return u = {
|
|
@@ -3746,18 +3929,18 @@ var ht = /*#__PURE__*/function () {
|
|
|
3746
3929
|
xSDKClientHeader: o,
|
|
3747
3930
|
xSDKParentHostHeader: s,
|
|
3748
3931
|
body: a
|
|
3749
|
-
}, e.prev = 1, e.next = 4,
|
|
3932
|
+
}, e.prev = 1, e.next = 4, Oe(u);
|
|
3750
3933
|
case 4:
|
|
3751
3934
|
case 15:
|
|
3752
3935
|
return e.abrupt("return", e.sent);
|
|
3753
3936
|
case 7:
|
|
3754
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3937
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Te)) {
|
|
3755
3938
|
e.next = 16;
|
|
3756
3939
|
break;
|
|
3757
3940
|
}
|
|
3758
3941
|
return e.next = 12, c(e.t0, u);
|
|
3759
3942
|
case 12:
|
|
3760
|
-
return u = e.sent, e.next = 15,
|
|
3943
|
+
return u = e.sent, e.next = 15, Oe(u);
|
|
3761
3944
|
case 16:
|
|
3762
3945
|
throw e.t0;
|
|
3763
3946
|
case 17:
|
|
@@ -3789,18 +3972,18 @@ var ht = /*#__PURE__*/function () {
|
|
|
3789
3972
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3790
3973
|
}
|
|
3791
3974
|
}]);
|
|
3792
|
-
return
|
|
3975
|
+
return yt;
|
|
3793
3976
|
}();
|
|
3794
|
-
function
|
|
3977
|
+
function kt(e) {
|
|
3795
3978
|
var t = e.toString(16);
|
|
3796
3979
|
return 1 === t.length && (t = "0" + t), t;
|
|
3797
3980
|
}
|
|
3798
|
-
var
|
|
3799
|
-
function
|
|
3800
|
-
_classCallCheck(this,
|
|
3981
|
+
var wt = /*#__PURE__*/function () {
|
|
3982
|
+
function wt(e, t) {
|
|
3983
|
+
_classCallCheck(this, wt);
|
|
3801
3984
|
this._dataLayer = e, this.namespace = t;
|
|
3802
3985
|
}
|
|
3803
|
-
_createClass(
|
|
3986
|
+
_createClass(wt, [{
|
|
3804
3987
|
key: "key",
|
|
3805
3988
|
value: function key() {
|
|
3806
3989
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3808,13 +3991,13 @@ var _t = /*#__PURE__*/function () {
|
|
|
3808
3991
|
}, {
|
|
3809
3992
|
key: "startPKCETransaction",
|
|
3810
3993
|
value: function startPKCETransaction() {
|
|
3811
|
-
return
|
|
3994
|
+
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3812
3995
|
var e;
|
|
3813
3996
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3814
3997
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3815
3998
|
case 0:
|
|
3816
3999
|
_context5.next = 2;
|
|
3817
|
-
return
|
|
4000
|
+
return wt.createProofkeyPair();
|
|
3818
4001
|
case 2:
|
|
3819
4002
|
e = _context5.sent;
|
|
3820
4003
|
return _context5.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3832,7 +4015,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3832
4015
|
if (null !== e) try {
|
|
3833
4016
|
return JSON.parse(e);
|
|
3834
4017
|
} catch (e) {
|
|
3835
|
-
return void
|
|
4018
|
+
return void ze("Found malformed Proof Key pair in localstorage.");
|
|
3836
4019
|
}
|
|
3837
4020
|
}
|
|
3838
4021
|
}, {
|
|
@@ -3843,7 +4026,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3843
4026
|
}], [{
|
|
3844
4027
|
key: "createProofkeyPair",
|
|
3845
4028
|
value: function createProofkeyPair() {
|
|
3846
|
-
return
|
|
4029
|
+
return vt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3847
4030
|
var _String$fromCharCode;
|
|
3848
4031
|
var e, t, r, n;
|
|
3849
4032
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
@@ -3851,7 +4034,7 @@ var _t = /*#__PURE__*/function () {
|
|
|
3851
4034
|
case 0:
|
|
3852
4035
|
e = new Uint32Array(16);
|
|
3853
4036
|
window.crypto.getRandomValues(e);
|
|
3854
|
-
t = Array.from(e).map(
|
|
4037
|
+
t = Array.from(e).map(kt).join("");
|
|
3855
4038
|
_context6.next = 5;
|
|
3856
4039
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3857
4040
|
case 5:
|
|
@@ -3868,54 +4051,9 @@ var _t = /*#__PURE__*/function () {
|
|
|
3868
4051
|
}));
|
|
3869
4052
|
}
|
|
3870
4053
|
}]);
|
|
3871
|
-
return
|
|
3872
|
-
}();
|
|
3873
|
-
var ft = /*#__PURE__*/function () {
|
|
3874
|
-
function ft(e) {
|
|
3875
|
-
_classCallCheck(this, ft);
|
|
3876
|
-
this._networkClient = e;
|
|
3877
|
-
}
|
|
3878
|
-
_createClass(ft, [{
|
|
3879
|
-
key: "searchUser",
|
|
3880
|
-
value: function searchUser(e) {
|
|
3881
|
-
return this._networkClient.fetchSDK({
|
|
3882
|
-
url: "/users/search",
|
|
3883
|
-
method: "POST",
|
|
3884
|
-
body: {
|
|
3885
|
-
email: e
|
|
3886
|
-
},
|
|
3887
|
-
errorMessage: "Error searching for user ".concat(e)
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3890
|
-
}, {
|
|
3891
|
-
key: "searchOrganization",
|
|
3892
|
-
value: function searchOrganization(e) {
|
|
3893
|
-
return this._networkClient.fetchSDK({
|
|
3894
|
-
url: "/b2b/organizations/search",
|
|
3895
|
-
method: "POST",
|
|
3896
|
-
body: {
|
|
3897
|
-
organization_slug: e
|
|
3898
|
-
},
|
|
3899
|
-
errorMessage: "Error searching slug"
|
|
3900
|
-
});
|
|
3901
|
-
}
|
|
3902
|
-
}, {
|
|
3903
|
-
key: "searchMember",
|
|
3904
|
-
value: function searchMember(e, t) {
|
|
3905
|
-
return this._networkClient.fetchSDK({
|
|
3906
|
-
url: "/b2b/organizations/members/search",
|
|
3907
|
-
method: "POST",
|
|
3908
|
-
body: {
|
|
3909
|
-
email_address: e,
|
|
3910
|
-
organization_id: t
|
|
3911
|
-
},
|
|
3912
|
-
errorMessage: "Error searching for member ".concat(e)
|
|
3913
|
-
});
|
|
3914
|
-
}
|
|
3915
|
-
}]);
|
|
3916
|
-
return ft;
|
|
4054
|
+
return wt;
|
|
3917
4055
|
}();
|
|
3918
|
-
var
|
|
4056
|
+
var St = function St(e) {
|
|
3919
4057
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3920
4058
|
var _t$split = t.split("="),
|
|
3921
4059
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3924,17 +4062,17 @@ var mt = function mt(e) {
|
|
|
3924
4062
|
}).length > 1;
|
|
3925
4063
|
};
|
|
3926
4064
|
/*! js-cookie v3.0.1 | MIT */
|
|
3927
|
-
function
|
|
4065
|
+
function Pt(e) {
|
|
3928
4066
|
for (var t = 1; t < arguments.length; t++) {
|
|
3929
4067
|
var r = arguments[t];
|
|
3930
4068
|
for (var n in r) e[n] = r[n];
|
|
3931
4069
|
}
|
|
3932
4070
|
return e;
|
|
3933
4071
|
}
|
|
3934
|
-
var
|
|
4072
|
+
var xt = function e(t, r) {
|
|
3935
4073
|
function n(e, n, i) {
|
|
3936
4074
|
if ("undefined" != typeof document) {
|
|
3937
|
-
"number" == typeof (i =
|
|
4075
|
+
"number" == typeof (i = Pt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
3938
4076
|
var o = "";
|
|
3939
4077
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
3940
4078
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -3956,15 +4094,15 @@ var bt = function e(t, r) {
|
|
|
3956
4094
|
}
|
|
3957
4095
|
},
|
|
3958
4096
|
remove: function remove(e, t) {
|
|
3959
|
-
n(e, "",
|
|
4097
|
+
n(e, "", Pt({}, t, {
|
|
3960
4098
|
expires: -1
|
|
3961
4099
|
}));
|
|
3962
4100
|
},
|
|
3963
4101
|
withAttributes: function withAttributes(t) {
|
|
3964
|
-
return e(this.converter,
|
|
4102
|
+
return e(this.converter, Pt({}, this.attributes, t));
|
|
3965
4103
|
},
|
|
3966
4104
|
withConverter: function withConverter(t) {
|
|
3967
|
-
return e(
|
|
4105
|
+
return e(Pt({}, this.converter, t), this.attributes);
|
|
3968
4106
|
}
|
|
3969
4107
|
}, {
|
|
3970
4108
|
attributes: {
|
|
@@ -3984,37 +4122,37 @@ var bt = function e(t, r) {
|
|
|
3984
4122
|
}, {
|
|
3985
4123
|
path: "/"
|
|
3986
4124
|
});
|
|
3987
|
-
var
|
|
4125
|
+
var Ct = function Ct(e) {
|
|
3988
4126
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3989
4127
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3990
4128
|
},
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
clearTimeout(
|
|
4129
|
+
Tt = new Map(),
|
|
4130
|
+
Ot = function Ot(e) {
|
|
4131
|
+
clearTimeout(Tt.get(e));
|
|
3994
4132
|
},
|
|
3995
|
-
|
|
3996
|
-
|
|
4133
|
+
Et = function Et(e, t, r) {
|
|
4134
|
+
Ot(e);
|
|
3997
4135
|
var n = setTimeout(function () {
|
|
3998
|
-
void 0 ===
|
|
4136
|
+
void 0 === xt.get(e) && xt.set(e, t, r);
|
|
3999
4137
|
}, 10);
|
|
4000
|
-
return
|
|
4138
|
+
return Tt.set(e, n), xt.set(e, t, r);
|
|
4001
4139
|
};
|
|
4002
|
-
var
|
|
4003
|
-
function
|
|
4004
|
-
var
|
|
4005
|
-
_classCallCheck(this,
|
|
4140
|
+
var At = /*#__PURE__*/function () {
|
|
4141
|
+
function At(e, t) {
|
|
4142
|
+
var _this4 = this;
|
|
4143
|
+
_classCallCheck(this, At);
|
|
4006
4144
|
this.browserSessionStorage = {
|
|
4007
4145
|
getItem: function getItem(e) {
|
|
4008
|
-
return sessionStorage.getItem(
|
|
4146
|
+
return sessionStorage.getItem(Ct(_this4.publicToken, e));
|
|
4009
4147
|
},
|
|
4010
4148
|
setItem: function setItem(e, t) {
|
|
4011
|
-
return sessionStorage.setItem(
|
|
4149
|
+
return sessionStorage.setItem(Ct(_this4.publicToken, e), t);
|
|
4012
4150
|
},
|
|
4013
4151
|
removeItem: function removeItem(e) {
|
|
4014
|
-
return sessionStorage.removeItem(
|
|
4152
|
+
return sessionStorage.removeItem(Ct(_this4.publicToken, e));
|
|
4015
4153
|
}
|
|
4016
|
-
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
4017
|
-
var r = localStorage.getItem(
|
|
4154
|
+
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Ge("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);
|
|
4155
|
+
var r = localStorage.getItem(Ct(this.publicToken));
|
|
4018
4156
|
if (!r) return;
|
|
4019
4157
|
var n;
|
|
4020
4158
|
try {
|
|
@@ -4024,7 +4162,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4024
4162
|
}
|
|
4025
4163
|
this.state = n;
|
|
4026
4164
|
}
|
|
4027
|
-
_createClass(
|
|
4165
|
+
_createClass(At, [{
|
|
4028
4166
|
key: "opaqueTokenCookieName",
|
|
4029
4167
|
get: function get() {
|
|
4030
4168
|
var e;
|
|
@@ -4046,14 +4184,14 @@ var St = /*#__PURE__*/function () {
|
|
|
4046
4184
|
key: "readSessionCookie",
|
|
4047
4185
|
value: function readSessionCookie() {
|
|
4048
4186
|
return {
|
|
4049
|
-
session_token:
|
|
4050
|
-
session_jwt:
|
|
4187
|
+
session_token: xt.get(this.opaqueTokenCookieName),
|
|
4188
|
+
session_jwt: xt.get(this.jwtCookieName)
|
|
4051
4189
|
};
|
|
4052
4190
|
}
|
|
4053
4191
|
}, {
|
|
4054
4192
|
key: "readIntermediateSessionTokenCookie",
|
|
4055
4193
|
value: function readIntermediateSessionTokenCookie() {
|
|
4056
|
-
return
|
|
4194
|
+
return xt.get(this.istCookieName);
|
|
4057
4195
|
}
|
|
4058
4196
|
}, {
|
|
4059
4197
|
key: "writeSessionCookie",
|
|
@@ -4062,32 +4200,32 @@ var St = /*#__PURE__*/function () {
|
|
|
4062
4200
|
var o = e.state,
|
|
4063
4201
|
s = e.session_token,
|
|
4064
4202
|
a = e.session_jwt,
|
|
4065
|
-
c =
|
|
4203
|
+
c = At.generateCookieOpts({
|
|
4066
4204
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4067
4205
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4068
4206
|
path: this._cookiePath,
|
|
4069
4207
|
domain: this._domain
|
|
4070
4208
|
});
|
|
4071
|
-
|
|
4072
|
-
var u =
|
|
4209
|
+
Et(this.opaqueTokenCookieName, s, c), Et(this.jwtCookieName, a, c);
|
|
4210
|
+
var u = At.generateCookieOpts({
|
|
4073
4211
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4074
4212
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4075
4213
|
path: this._cookiePath,
|
|
4076
4214
|
domain: this._domain
|
|
4077
4215
|
});
|
|
4078
|
-
|
|
4216
|
+
St(this.jwtCookieName) && xt.remove(this.jwtCookieName, u), St(this.opaqueTokenCookieName) && xt.remove(this.opaqueTokenCookieName, u), St(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."), St(this.opaqueTokenCookieName) && ze("Could not remove extraneous opaque token cookie.");
|
|
4079
4217
|
}
|
|
4080
4218
|
}, {
|
|
4081
4219
|
key: "writeIntermediateSessionTokenCookie",
|
|
4082
4220
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4083
4221
|
var t = new Date(Date.now() + 6e5),
|
|
4084
|
-
r =
|
|
4222
|
+
r = At.generateCookieOpts({
|
|
4085
4223
|
expiresAt: t.toString(),
|
|
4086
4224
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4087
4225
|
path: this._cookiePath,
|
|
4088
4226
|
domain: this._domain
|
|
4089
4227
|
});
|
|
4090
|
-
|
|
4228
|
+
Et(this.istCookieName, e, r);
|
|
4091
4229
|
}
|
|
4092
4230
|
}, {
|
|
4093
4231
|
key: "removeSessionCookie",
|
|
@@ -4102,50 +4240,50 @@ var St = /*#__PURE__*/function () {
|
|
|
4102
4240
|
}, {
|
|
4103
4241
|
key: "removeCookies",
|
|
4104
4242
|
value: function removeCookies(e) {
|
|
4105
|
-
var
|
|
4243
|
+
var _this5 = this;
|
|
4106
4244
|
[!0, !1].forEach(function (t) {
|
|
4107
|
-
[
|
|
4108
|
-
[
|
|
4109
|
-
var i =
|
|
4245
|
+
[_this5._cookiePath, null].forEach(function (r) {
|
|
4246
|
+
[_this5._domain, null].forEach(function (n) {
|
|
4247
|
+
var i = At.generateCookieOpts({
|
|
4110
4248
|
expiresAt: new Date(0).toString(),
|
|
4111
4249
|
availableToSubdomains: t,
|
|
4112
4250
|
path: r,
|
|
4113
4251
|
domain: n
|
|
4114
4252
|
});
|
|
4115
4253
|
e.forEach(function (e) {
|
|
4116
|
-
|
|
4254
|
+
xt.remove(e, i);
|
|
4117
4255
|
});
|
|
4118
4256
|
});
|
|
4119
4257
|
});
|
|
4120
|
-
}), e.forEach(
|
|
4258
|
+
}), e.forEach(Ot);
|
|
4121
4259
|
}
|
|
4122
4260
|
}, {
|
|
4123
4261
|
key: "syncToLocalStorage",
|
|
4124
4262
|
value: function syncToLocalStorage() {
|
|
4125
|
-
localStorage.setItem(
|
|
4263
|
+
localStorage.setItem(Ct(this.publicToken), JSON.stringify(this.state));
|
|
4126
4264
|
}
|
|
4127
4265
|
}, {
|
|
4128
4266
|
key: "getItem",
|
|
4129
4267
|
value: function getItem(e) {
|
|
4130
|
-
return localStorage.getItem(
|
|
4268
|
+
return localStorage.getItem(Ct(this.publicToken, e));
|
|
4131
4269
|
}
|
|
4132
4270
|
}, {
|
|
4133
4271
|
key: "setItem",
|
|
4134
4272
|
value: function setItem(e, t) {
|
|
4135
|
-
return localStorage.setItem(
|
|
4273
|
+
return localStorage.setItem(Ct(this.publicToken, e), t);
|
|
4136
4274
|
}
|
|
4137
4275
|
}, {
|
|
4138
4276
|
key: "removeItem",
|
|
4139
4277
|
value: function removeItem(e) {
|
|
4140
|
-
return localStorage.removeItem(
|
|
4278
|
+
return localStorage.removeItem(Ct(this.publicToken, e));
|
|
4141
4279
|
}
|
|
4142
4280
|
}, {
|
|
4143
4281
|
key: "markStateKeysUpdated",
|
|
4144
4282
|
value: function markStateKeysUpdated(e) {
|
|
4145
|
-
var
|
|
4283
|
+
var _this6 = this;
|
|
4146
4284
|
var t = this.stateKeysUpdated.size;
|
|
4147
4285
|
return e.forEach(function (e) {
|
|
4148
|
-
return
|
|
4286
|
+
return _this6.stateKeysUpdated.add(e);
|
|
4149
4287
|
}), t !== this.stateKeysUpdated.size;
|
|
4150
4288
|
}
|
|
4151
4289
|
}], [{
|
|
@@ -4162,40 +4300,40 @@ var St = /*#__PURE__*/function () {
|
|
|
4162
4300
|
return e && (i.path = e), Boolean("localhost" === window.location.hostname || "[::1]" === window.location.hostname || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)) ? i.secure = !1 : (r && (i.domain = t || window.location.host), i.secure = !0), i;
|
|
4163
4301
|
}
|
|
4164
4302
|
}]);
|
|
4165
|
-
return
|
|
4303
|
+
return At;
|
|
4166
4304
|
}();
|
|
4167
|
-
var
|
|
4168
|
-
_inherits(
|
|
4169
|
-
function
|
|
4170
|
-
_classCallCheck(this,
|
|
4171
|
-
return _callSuper(this,
|
|
4305
|
+
var Dt = /*#__PURE__*/function (_At) {
|
|
4306
|
+
_inherits(Dt, _At);
|
|
4307
|
+
function Dt() {
|
|
4308
|
+
_classCallCheck(this, Dt);
|
|
4309
|
+
return _callSuper(this, Dt, arguments);
|
|
4172
4310
|
}
|
|
4173
|
-
return _createClass(
|
|
4174
|
-
}(
|
|
4175
|
-
var
|
|
4176
|
-
|
|
4311
|
+
return _createClass(Dt);
|
|
4312
|
+
}(At);
|
|
4313
|
+
var It = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4314
|
+
Rt = function Rt(e, t) {
|
|
4177
4315
|
var r = function () {
|
|
4178
4316
|
var e = window;
|
|
4179
|
-
return e[
|
|
4317
|
+
return e[It] || (e[It] = {}), e[It];
|
|
4180
4318
|
}();
|
|
4181
|
-
return r[e] || (r[e] = new
|
|
4319
|
+
return r[e] || (r[e] = new Dt(e, t)), r[e];
|
|
4182
4320
|
},
|
|
4183
|
-
|
|
4321
|
+
Bt = function Bt(e, t) {
|
|
4184
4322
|
Object.values(e).forEach(function (e) {
|
|
4185
4323
|
return e(t);
|
|
4186
4324
|
});
|
|
4187
4325
|
},
|
|
4188
|
-
|
|
4326
|
+
Mt = function () {
|
|
4189
4327
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4190
4328
|
t = void 0 === e ? [] : e;
|
|
4191
4329
|
return function e(r, n) {
|
|
4192
|
-
return
|
|
4330
|
+
return pe(r) === pe(n) && (null === r || null === n ? r === n : "object" === pe(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4193
4331
|
return !(e in n);
|
|
4194
4332
|
}) && Object.entries(r).filter(function (e) {
|
|
4195
|
-
var r =
|
|
4333
|
+
var r = le(e, 1)[0];
|
|
4196
4334
|
return !t.includes(r);
|
|
4197
4335
|
}).every(function (t) {
|
|
4198
|
-
var r =
|
|
4336
|
+
var r = le(t, 2),
|
|
4199
4337
|
i = r[0],
|
|
4200
4338
|
o = r[1];
|
|
4201
4339
|
return e(o, n[i]);
|
|
@@ -4204,20 +4342,20 @@ var Pt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4204
4342
|
}({
|
|
4205
4343
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4206
4344
|
});
|
|
4207
|
-
var
|
|
4208
|
-
function
|
|
4209
|
-
var
|
|
4210
|
-
_classCallCheck(this,
|
|
4345
|
+
var Ft = /*#__PURE__*/function () {
|
|
4346
|
+
function Ft(e, t) {
|
|
4347
|
+
var _this7 = this;
|
|
4348
|
+
_classCallCheck(this, Ft);
|
|
4211
4349
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4212
|
-
if (e.key !==
|
|
4350
|
+
if (e.key !== Ct(_this7._publicToken)) return;
|
|
4213
4351
|
var t = null === e.newValue || "null" === e.newValue ? null : JSON.parse(e.newValue);
|
|
4214
|
-
|
|
4352
|
+
_this7.updateState(t);
|
|
4215
4353
|
}, window.addEventListener("storage", this._listen);
|
|
4216
4354
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
4217
4355
|
r = _this$_datalayer$read.session_token;
|
|
4218
4356
|
r || this.destroySession();
|
|
4219
4357
|
}
|
|
4220
|
-
_createClass(
|
|
4358
|
+
_createClass(Ft, [{
|
|
4221
4359
|
key: "getTokens",
|
|
4222
4360
|
value: function getTokens() {
|
|
4223
4361
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4255,7 +4393,7 @@ var At = /*#__PURE__*/function () {
|
|
|
4255
4393
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4256
4394
|
this._datalayer.state = r;
|
|
4257
4395
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4258
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4396
|
+
!this._datalayer.markStateKeysUpdated(n) && Mt(t, r) || Bt(this._datalayer.subscriptions, r);
|
|
4259
4397
|
}
|
|
4260
4398
|
}, {
|
|
4261
4399
|
key: "updateStateAndTokens",
|
|
@@ -4270,8 +4408,8 @@ var At = /*#__PURE__*/function () {
|
|
|
4270
4408
|
this._datalayer.state = r;
|
|
4271
4409
|
var n = e ? Object.keys(e) : [],
|
|
4272
4410
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4273
|
-
o = !
|
|
4274
|
-
(i || o) && (
|
|
4411
|
+
o = !Mt(t, r);
|
|
4412
|
+
(i || o) && (Bt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4275
4413
|
}
|
|
4276
4414
|
}, {
|
|
4277
4415
|
key: "updateTokens",
|
|
@@ -4311,44 +4449,44 @@ var At = /*#__PURE__*/function () {
|
|
|
4311
4449
|
return null;
|
|
4312
4450
|
}
|
|
4313
4451
|
}]);
|
|
4314
|
-
return
|
|
4452
|
+
return Ft;
|
|
4315
4453
|
}();
|
|
4316
|
-
var
|
|
4317
|
-
_inherits(
|
|
4318
|
-
function
|
|
4319
|
-
var
|
|
4320
|
-
_classCallCheck(this,
|
|
4321
|
-
|
|
4322
|
-
return
|
|
4454
|
+
var jt = /*#__PURE__*/function (_Ft) {
|
|
4455
|
+
_inherits(jt, _Ft);
|
|
4456
|
+
function jt() {
|
|
4457
|
+
var _this8;
|
|
4458
|
+
_classCallCheck(this, jt);
|
|
4459
|
+
_this8 = _callSuper(this, jt, arguments), _this8.updateMember = function (e) {
|
|
4460
|
+
return _this8.updateState({
|
|
4323
4461
|
member: e
|
|
4324
4462
|
});
|
|
4325
|
-
},
|
|
4463
|
+
}, _this8.getMember = function () {
|
|
4326
4464
|
var e, t;
|
|
4327
|
-
return null !== (t = null === (e =
|
|
4328
|
-
},
|
|
4329
|
-
return
|
|
4465
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.member) && void 0 !== t ? t : null;
|
|
4466
|
+
}, _this8.updateOrganization = function (e) {
|
|
4467
|
+
return _this8.updateState({
|
|
4330
4468
|
organization: e
|
|
4331
4469
|
});
|
|
4332
|
-
},
|
|
4470
|
+
}, _this8.getOrganization = function () {
|
|
4333
4471
|
var e, t;
|
|
4334
|
-
return null !== (t = null === (e =
|
|
4335
|
-
},
|
|
4472
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.organization) && void 0 !== t ? t : null;
|
|
4473
|
+
}, _this8.getSession = function () {
|
|
4336
4474
|
var e, t;
|
|
4337
|
-
return null !== (t = null === (e =
|
|
4475
|
+
return null !== (t = null === (e = _this8.getState()) || void 0 === e ? void 0 : e.session) && void 0 !== t ? t : null;
|
|
4338
4476
|
};
|
|
4339
|
-
return
|
|
4477
|
+
return _this8;
|
|
4340
4478
|
}
|
|
4341
|
-
return _createClass(
|
|
4342
|
-
}(
|
|
4343
|
-
var
|
|
4344
|
-
exports.BiometricsFailedError =
|
|
4479
|
+
return _createClass(jt);
|
|
4480
|
+
}(Ft);
|
|
4481
|
+
var Lt = Symbol["for"]("stytch__internal_b2b");
|
|
4482
|
+
exports.BiometricsFailedError = Q, exports.BiometricsUnavailableError = F, exports.ChallengeSigningFailedError = Y, exports.DeviceCredentialsNotAllowedError = z, exports.FailedCodeChallengeError = $, exports.FailedToDecryptDataError = Z, exports.InternalError = B, exports.InvalidAuthorizationCredentialError = G, exports.InvalidCredentialTypeError = ne, exports.InvalidRedirectSchemeError = te, exports.InvalidStartUrlError = ee, exports.JSONDataNotConvertibleToStringError = oe, exports.KeyInvalidatedError = j, exports.KeystoreUnavailableError = L, exports.MissingAttestationObjectError = ie, exports.MissingAuthorizationCredentialIDTokenError = H, exports.MissingGoogleClientIDError = q, exports.MissingPKCEError = W, exports.MissingPublicKeyError = V, exports.MissingUrlError = re, exports.NoBiometricsEnrolledError = K, exports.NoBiometricsRegistrationError = M, exports.NoCurrentSessionError = R, exports.PasskeysInvalidEncoding = ae, exports.PasskeysMisconfigured = ce, exports.PasskeysUnsupportedError = X, exports.RandomNumberGenerationFailed = se, exports.SDKAPIUnreachableError = S, exports.SDKNotConfiguredError = J, exports.SignInWithAppleMisconfigured = ue, exports.StytchAPIError = D, exports.StytchAPISchemaError = A, exports.StytchAPIUnreachableError = E, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
|
|
4345
4483
|
function _class(e, t) {
|
|
4346
|
-
var
|
|
4484
|
+
var _this9 = this;
|
|
4347
4485
|
_classCallCheck(this, _class);
|
|
4348
4486
|
var r;
|
|
4349
4487
|
!function (e) {
|
|
4350
4488
|
if ("undefined" == typeof window) throw new Error("The ".concat(e, " is not compatible with server-side environments.\nIf using nextjs, use the create").concat(e, " method instead.\n```\n").concat("import { createStytchB2BHeadlessClient } from '@stytch/nextjs/b2b';\n \n const stytch = createStytchB2BHeadlessClient('public-token-...');\n ", "\n```\n"));
|
|
4351
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
4489
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? ze("Public token is malformed. Expected a string, got ".concat(pe(r), ".").concat(We)) : "" === r ? ze('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(We)) : r.startsWith("public-token-") || ze('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(We));
|
|
4352
4490
|
var n = t,
|
|
4353
4491
|
i = {
|
|
4354
4492
|
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
@@ -4357,32 +4495,33 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4357
4495
|
testAPIURL: null !== (u = null === (c = null == o ? void 0 : o.endpoints) || void 0 === c ? void 0 : c.testAPIURL) && void 0 !== u ? u : "https://test.stytch.com",
|
|
4358
4496
|
liveAPIURL: null !== (d = null === (l = null == o ? void 0 : o.endpoints) || void 0 === l ? void 0 : l.liveAPIURL) && void 0 !== d ? d : "https://api.stytch.com",
|
|
4359
4497
|
dfpBackendURL: null !== (p = null === (h = null == o ? void 0 : o.endpoints) || void 0 === h ? void 0 : h.dfpBackendURL) && void 0 !== p ? p : "https://telemetry.stytch.com",
|
|
4360
|
-
clientsideServicesIframeURL: null !== (
|
|
4498
|
+
clientsideServicesIframeURL: null !== (_ = null === (f = null == o ? void 0 : o.endpoints) || void 0 === f ? void 0 : f.clientsideServicesIframeURL) && void 0 !== _ ? _ : "https://js.stytch.com/clientside-services/index.html"
|
|
4361
4499
|
}
|
|
4362
4500
|
};
|
|
4363
|
-
var o, s, a, c, u, l, d, h, p,
|
|
4364
|
-
this._dataLayer =
|
|
4365
|
-
var m = new
|
|
4366
|
-
this._networkClient = new
|
|
4501
|
+
var o, s, a, c, u, l, d, h, p, f, _;
|
|
4502
|
+
this._dataLayer = Rt(e, n), this._subscriptionService = new jt(e, this._dataLayer);
|
|
4503
|
+
var m = new wt(this._dataLayer, "passwords");
|
|
4504
|
+
this._networkClient = new yt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4367
4505
|
var e, t, r, n;
|
|
4368
4506
|
return {
|
|
4369
|
-
stytch_member_id: null === (t = null === (e =
|
|
4370
|
-
stytch_member_session_id: null === (n = null === (r =
|
|
4507
|
+
stytch_member_id: null === (t = null === (e = _this9._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4508
|
+
stytch_member_session_id: null === (n = null === (r = _this9._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4371
4509
|
};
|
|
4372
4510
|
});
|
|
4373
|
-
var v = new
|
|
4374
|
-
b = new
|
|
4375
|
-
g = new
|
|
4376
|
-
|
|
4511
|
+
var v = new mt(e, this._networkClient, this._dataLayer),
|
|
4512
|
+
b = new bt(v.getAsync()),
|
|
4513
|
+
g = new Ve(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha),
|
|
4514
|
+
y = new gt(i.endpoints.clientsideServicesIframeURL);
|
|
4515
|
+
this.organization = new tt(this._networkClient, this._subscriptionService), this.member = new Qe(this._networkClient, this._subscriptionService), this.self = new Qe(this._networkClient, this._subscriptionService), this.session = new nt(this._networkClient, this._subscriptionService), this.magicLinks = new Ze(this._networkClient, this._subscriptionService, new wt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new rt(this._networkClient, this._subscriptionService, new wt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4377
4516
|
publicToken: e,
|
|
4378
4517
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4379
4518
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4380
|
-
}, g), this.sso = new
|
|
4519
|
+
}, g), this.sso = new et(this._networkClient, this._subscriptionService, new wt(this._dataLayer, "sso"), v.getAsync(), {
|
|
4381
4520
|
publicToken: e,
|
|
4382
4521
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4383
4522
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4384
|
-
}), this.discovery = new
|
|
4385
|
-
var k = new
|
|
4523
|
+
}), this.discovery = new it(this._networkClient, this._subscriptionService), this.passwords = new st(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new at(this._networkClient, this._subscriptionService, g), this.totp = new ct(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new ut(this._networkClient, this._subscriptionService, g), this.rbac = new lt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new pt(this._subscriptionService, this.session);
|
|
4524
|
+
var k = new ht(this._networkClient);
|
|
4386
4525
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4387
4526
|
name: "b2b_sdk_instance_instantiated",
|
|
4388
4527
|
details: {
|
|
@@ -4392,9 +4531,10 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4392
4531
|
}
|
|
4393
4532
|
});
|
|
4394
4533
|
(function (e, t) {
|
|
4395
|
-
Object.assign(e, _defineProperty({},
|
|
4534
|
+
Object.assign(e, _defineProperty({}, Lt, t));
|
|
4396
4535
|
})(this, {
|
|
4397
4536
|
bootstrap: v,
|
|
4537
|
+
clientsideServices: y,
|
|
4398
4538
|
publicToken: e,
|
|
4399
4539
|
searchManager: k,
|
|
4400
4540
|
dataLayer: this._dataLayer,
|
|
@@ -4402,70 +4542,74 @@ exports.BiometricsFailedError = X, exports.BiometricsUnavailableError = j, expor
|
|
|
4402
4542
|
});
|
|
4403
4543
|
}
|
|
4404
4544
|
return _createClass(_class);
|
|
4405
|
-
}(), exports.StytchError =
|
|
4545
|
+
}(), exports.StytchError = O, exports.StytchSDKAPIError = C, exports.StytchSDKError = I, exports.StytchSDKSchemaError = x, exports.StytchSDKUsageError = P, exports.UNRECOVERABLE_ERROR_TYPES = T, exports.UserCancellationError = N, exports.UserLockedOutError = U, exports.errorToStytchError = function (e) {
|
|
4406
4546
|
switch (e.message) {
|
|
4407
4547
|
case "internal_error":
|
|
4408
|
-
return new
|
|
4548
|
+
return new B(e.message);
|
|
4409
4549
|
case "no_current_session":
|
|
4410
|
-
return new
|
|
4550
|
+
return new R();
|
|
4411
4551
|
case "no_biometrics_registration":
|
|
4412
|
-
return new
|
|
4552
|
+
return new M();
|
|
4413
4553
|
case "biometrics_unavailable":
|
|
4414
4554
|
case "device_hardware_error":
|
|
4415
4555
|
case "biometrics_not_available":
|
|
4416
|
-
return new
|
|
4556
|
+
return new F();
|
|
4417
4557
|
case "key_invalidated":
|
|
4418
4558
|
case "no_biometric_key":
|
|
4419
|
-
return new
|
|
4559
|
+
return new j();
|
|
4420
4560
|
case "no_biometrics_enrolled":
|
|
4421
|
-
return new
|
|
4561
|
+
return new K();
|
|
4422
4562
|
case "keystore_unavailable":
|
|
4423
|
-
return new
|
|
4563
|
+
return new L();
|
|
4424
4564
|
case "device_credentials_not_allowed":
|
|
4425
4565
|
return new z();
|
|
4426
4566
|
case "user_cancellation":
|
|
4427
|
-
return new
|
|
4567
|
+
return new N();
|
|
4428
4568
|
case "user_locked_out":
|
|
4429
|
-
return new
|
|
4569
|
+
return new U();
|
|
4430
4570
|
case "google_onetap_missing_id_token":
|
|
4431
4571
|
case "oauth_apple_missing_id_token":
|
|
4432
4572
|
case "missing_authorization_credential_id_token":
|
|
4433
|
-
return new
|
|
4573
|
+
return new H();
|
|
4434
4574
|
case "google_onetap_missing_member":
|
|
4435
4575
|
case "oauth_apple_credential_invalid":
|
|
4436
4576
|
case "invalid_authorization_credential":
|
|
4437
|
-
return new
|
|
4577
|
+
return new G();
|
|
4438
4578
|
case "missing_public_key":
|
|
4439
|
-
return new
|
|
4579
|
+
return new V();
|
|
4440
4580
|
case "challenge_signing_failed":
|
|
4441
|
-
return new
|
|
4581
|
+
return new Y();
|
|
4442
4582
|
case "sdk_not_configured":
|
|
4443
|
-
return new
|
|
4583
|
+
return new J();
|
|
4444
4584
|
case "failed_code_challenge":
|
|
4445
|
-
return new
|
|
4585
|
+
return new $();
|
|
4446
4586
|
case "passkeys_unsupported":
|
|
4447
|
-
return new
|
|
4587
|
+
return new X();
|
|
4448
4588
|
case "failed_to_decrypt_data":
|
|
4449
|
-
return new
|
|
4589
|
+
return new Z();
|
|
4450
4590
|
case "biometrics_failed":
|
|
4451
|
-
return new
|
|
4591
|
+
return new Q();
|
|
4452
4592
|
case "invalid_start_url":
|
|
4453
|
-
return new
|
|
4593
|
+
return new ee();
|
|
4454
4594
|
case "invalid_redirect_scheme":
|
|
4455
|
-
return new
|
|
4595
|
+
return new te();
|
|
4456
4596
|
case "missing_url":
|
|
4457
|
-
return new
|
|
4597
|
+
return new re();
|
|
4458
4598
|
case "invalid_credential_type":
|
|
4459
|
-
return new
|
|
4599
|
+
return new ne();
|
|
4460
4600
|
case "missing_attestation_object":
|
|
4461
|
-
return new
|
|
4601
|
+
return new ie();
|
|
4462
4602
|
case "json_data_not_convertible_to_string":
|
|
4463
|
-
return new
|
|
4603
|
+
return new oe();
|
|
4464
4604
|
case "random_number_generation_failed":
|
|
4465
|
-
return new
|
|
4605
|
+
return new se();
|
|
4466
4606
|
case "passkeys_invalid_encoding":
|
|
4467
|
-
return new
|
|
4607
|
+
return new ae();
|
|
4608
|
+
case "passkeys_misconfigured":
|
|
4609
|
+
return new ce();
|
|
4610
|
+
case "signinwithapple_misconfigured":
|
|
4611
|
+
return new ue();
|
|
4468
4612
|
default:
|
|
4469
|
-
return new
|
|
4613
|
+
return new I(e.name, e.message);
|
|
4470
4614
|
}
|
|
4471
4615
|
};
|