@stytch/vanilla-js 3.2.5 → 4.1.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 +32 -0
- package/dist/b2b/index.d.ts +116 -17
- package/dist/b2b/index.esm.d.ts +116 -17
- package/dist/b2b/index.esm.js +4625 -3847
- package/dist/b2b/index.headless.d.ts +116 -17
- package/dist/b2b/index.headless.esm.d.ts +116 -17
- package/dist/b2b/index.headless.esm.js +1899 -1116
- package/dist/b2b/index.headless.js +1899 -1115
- package/dist/b2b/index.js +4398 -3615
- package/dist/index.esm.js +5413 -5111
- package/dist/index.headless.esm.js +1575 -1302
- package/dist/index.headless.js +1556 -1297
- package/dist/index.js +4607 -4305
- package/package.json +17 -18
|
@@ -27,7 +27,545 @@ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf
|
|
|
27
27
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
29
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
30
|
-
function e(
|
|
30
|
+
function e(t) {
|
|
31
|
+
return e = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
32
|
+
return _typeof(e);
|
|
33
|
+
} : function (e) {
|
|
34
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
35
|
+
}, e(t);
|
|
36
|
+
}
|
|
37
|
+
function t(t, r) {
|
|
38
|
+
for (var n = 0; n < r.length; n++) {
|
|
39
|
+
var i = r[n];
|
|
40
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, (o = i.key, s = void 0, s = function (t, r) {
|
|
41
|
+
if ("object" !== e(t) || null === t) return t;
|
|
42
|
+
var n = t[Symbol.toPrimitive];
|
|
43
|
+
if (void 0 !== n) {
|
|
44
|
+
var i = n.call(t, r || "default");
|
|
45
|
+
if ("object" !== e(i)) return i;
|
|
46
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
47
|
+
}
|
|
48
|
+
return ("string" === r ? String : Number)(t);
|
|
49
|
+
}(o, "string"), "symbol" === e(s) ? s : String(s)), i);
|
|
50
|
+
}
|
|
51
|
+
var o, s;
|
|
52
|
+
}
|
|
53
|
+
function r(e, r, n) {
|
|
54
|
+
return r && t(e.prototype, r), n && t(e, n), Object.defineProperty(e, "prototype", {
|
|
55
|
+
writable: !1
|
|
56
|
+
}), e;
|
|
57
|
+
}
|
|
58
|
+
function n(e, t) {
|
|
59
|
+
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
60
|
+
}
|
|
61
|
+
function i(e, t) {
|
|
62
|
+
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
63
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
64
|
+
constructor: {
|
|
65
|
+
value: e,
|
|
66
|
+
writable: !0,
|
|
67
|
+
configurable: !0
|
|
68
|
+
}
|
|
69
|
+
}), Object.defineProperty(e, "prototype", {
|
|
70
|
+
writable: !1
|
|
71
|
+
}), t && l(e, t);
|
|
72
|
+
}
|
|
73
|
+
function o(t) {
|
|
74
|
+
var r = u();
|
|
75
|
+
return function () {
|
|
76
|
+
var n,
|
|
77
|
+
i = d(t);
|
|
78
|
+
if (r) {
|
|
79
|
+
var o = d(this).constructor;
|
|
80
|
+
n = Reflect.construct(i, arguments, o);
|
|
81
|
+
} else n = i.apply(this, arguments);
|
|
82
|
+
return function (t, r) {
|
|
83
|
+
if (r && ("object" === e(r) || "function" == typeof r)) return r;
|
|
84
|
+
if (void 0 !== r) throw new TypeError("Derived constructors may only return object or undefined");
|
|
85
|
+
return s(t);
|
|
86
|
+
}(this, n);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function s(e) {
|
|
90
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
91
|
+
return e;
|
|
92
|
+
}
|
|
93
|
+
function a(e) {
|
|
94
|
+
var t = "function" == typeof Map ? new Map() : void 0;
|
|
95
|
+
return a = function a(e) {
|
|
96
|
+
if (null === e || !function (e) {
|
|
97
|
+
try {
|
|
98
|
+
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
99
|
+
} catch (t) {
|
|
100
|
+
return "function" == typeof e;
|
|
101
|
+
}
|
|
102
|
+
}(e)) return e;
|
|
103
|
+
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
104
|
+
if (void 0 !== t) {
|
|
105
|
+
if (t.has(e)) return t.get(e);
|
|
106
|
+
t.set(e, r);
|
|
107
|
+
}
|
|
108
|
+
function r() {
|
|
109
|
+
return c(e, arguments, d(this).constructor);
|
|
110
|
+
}
|
|
111
|
+
return r.prototype = Object.create(e.prototype, {
|
|
112
|
+
constructor: {
|
|
113
|
+
value: r,
|
|
114
|
+
enumerable: !1,
|
|
115
|
+
writable: !0,
|
|
116
|
+
configurable: !0
|
|
117
|
+
}
|
|
118
|
+
}), l(r, e);
|
|
119
|
+
}, a(e);
|
|
120
|
+
}
|
|
121
|
+
function c(e, t, r) {
|
|
122
|
+
return c = u() ? Reflect.construct.bind() : function (e, t, r) {
|
|
123
|
+
var n = [null];
|
|
124
|
+
n.push.apply(n, t);
|
|
125
|
+
var i = new (Function.bind.apply(e, n))();
|
|
126
|
+
return r && l(i, r.prototype), i;
|
|
127
|
+
}, c.apply(null, arguments);
|
|
128
|
+
}
|
|
129
|
+
function u() {
|
|
130
|
+
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
131
|
+
if (Reflect.construct.sham) return !1;
|
|
132
|
+
if ("function" == typeof Proxy) return !0;
|
|
133
|
+
try {
|
|
134
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
|
|
135
|
+
} catch (e) {
|
|
136
|
+
return !1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function l(e, t) {
|
|
140
|
+
return l = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
141
|
+
return e.__proto__ = t, e;
|
|
142
|
+
}, l(e, t);
|
|
143
|
+
}
|
|
144
|
+
function d(e) {
|
|
145
|
+
return d = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
146
|
+
return e.__proto__ || Object.getPrototypeOf(e);
|
|
147
|
+
}, d(e);
|
|
148
|
+
}
|
|
149
|
+
var h, p, _, f, m, v;
|
|
150
|
+
!function (e) {
|
|
151
|
+
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
152
|
+
}(h || (h = {})), function (e) {
|
|
153
|
+
e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
|
|
154
|
+
}(p || (p = {})), function (e) {
|
|
155
|
+
e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
|
|
156
|
+
}(_ || (_ = {})), function (e) {
|
|
157
|
+
e.embedded = "embedded", e.floating = "floating";
|
|
158
|
+
}(f || (f = {})), function (e) {
|
|
159
|
+
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
160
|
+
}(m || (m = {})), function (e) {
|
|
161
|
+
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
162
|
+
}(v || (v = {}));
|
|
163
|
+
var b,
|
|
164
|
+
g,
|
|
165
|
+
y,
|
|
166
|
+
k = function (e) {
|
|
167
|
+
i(c, a(Error));
|
|
168
|
+
var t = o(c);
|
|
169
|
+
function c(e, r) {
|
|
170
|
+
var i;
|
|
171
|
+
return n(this, c), (i = t.call(this, e + "\n" + r)).message = e + "\n" + r, i.name = "SDKAPIUnreachableError", i.details = r, Object.setPrototypeOf(s(i), c.prototype), i;
|
|
172
|
+
}
|
|
173
|
+
return r(c);
|
|
174
|
+
}(),
|
|
175
|
+
w = function (e) {
|
|
176
|
+
i(s, a(Error));
|
|
177
|
+
var t = o(s);
|
|
178
|
+
function s(e, r) {
|
|
179
|
+
var i;
|
|
180
|
+
return n(this, s), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + r, i;
|
|
181
|
+
}
|
|
182
|
+
return r(s);
|
|
183
|
+
}(),
|
|
184
|
+
S = function (e) {
|
|
185
|
+
i(s, a(Error));
|
|
186
|
+
var t = o(s);
|
|
187
|
+
function s(e) {
|
|
188
|
+
var r, i;
|
|
189
|
+
n(this, s), (r = t.call(this)).name = "StytchSDKSchemaError";
|
|
190
|
+
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
191
|
+
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
192
|
+
}).join("\n");
|
|
193
|
+
return r.message = "[400] Request does not match expected schema\n".concat(o), r;
|
|
194
|
+
}
|
|
195
|
+
return r(s);
|
|
196
|
+
}(),
|
|
197
|
+
P = function (e) {
|
|
198
|
+
i(s, a(Error));
|
|
199
|
+
var t = o(s);
|
|
200
|
+
function s(e) {
|
|
201
|
+
var r;
|
|
202
|
+
n(this, s), (r = t.call(this)).name = "StytchSDKAPIError";
|
|
203
|
+
var i = e.status_code,
|
|
204
|
+
o = e.error_type,
|
|
205
|
+
a = e.error_message,
|
|
206
|
+
c = e.error_url,
|
|
207
|
+
u = e.request_id;
|
|
208
|
+
return r.error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), r;
|
|
209
|
+
}
|
|
210
|
+
return r(s);
|
|
211
|
+
}(),
|
|
212
|
+
A = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"],
|
|
213
|
+
C = function (e) {
|
|
214
|
+
i(s, a(Error));
|
|
215
|
+
var t = o(s);
|
|
216
|
+
function s(e, r) {
|
|
217
|
+
var i;
|
|
218
|
+
return n(this, s), (i = t.call(this, r)).name = e, i;
|
|
219
|
+
}
|
|
220
|
+
return r(s);
|
|
221
|
+
}(),
|
|
222
|
+
T = function (e) {
|
|
223
|
+
i(a, C);
|
|
224
|
+
var t = o(a);
|
|
225
|
+
function a(e) {
|
|
226
|
+
var r;
|
|
227
|
+
return n(this, a), r = t.call(this, "StytchAPIUnreachableError", e), Object.setPrototypeOf(s(r), a.prototype), r;
|
|
228
|
+
}
|
|
229
|
+
return r(a);
|
|
230
|
+
}(),
|
|
231
|
+
O = function (e) {
|
|
232
|
+
i(s, C);
|
|
233
|
+
var t = o(s);
|
|
234
|
+
function s(e) {
|
|
235
|
+
var r;
|
|
236
|
+
n(this, s);
|
|
237
|
+
var i = null === (r = e.body) || void 0 === r ? void 0 : r.map(function (e) {
|
|
238
|
+
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
239
|
+
}).join("\n");
|
|
240
|
+
return t.call(this, "StytchAPISchemaError", "Request does not match expected schema\n".concat(i));
|
|
241
|
+
}
|
|
242
|
+
return r(s);
|
|
243
|
+
}(),
|
|
244
|
+
E = function (e) {
|
|
245
|
+
i(s, C);
|
|
246
|
+
var t = o(s);
|
|
247
|
+
function s(e) {
|
|
248
|
+
var r;
|
|
249
|
+
n(this, s);
|
|
250
|
+
var i = e.status_code,
|
|
251
|
+
o = e.error_type,
|
|
252
|
+
a = e.error_message,
|
|
253
|
+
c = e.error_url,
|
|
254
|
+
u = e.request_id;
|
|
255
|
+
return (r = t.call(this, "StytchAPIError", "[".concat(i, "] ").concat(o, "\n") + "".concat(a, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""))).error_type = o, r.error_message = a, r.error_url = c, r.request_id = u, r.status_code = i, r;
|
|
256
|
+
}
|
|
257
|
+
return r(s);
|
|
258
|
+
}(),
|
|
259
|
+
x = function (e) {
|
|
260
|
+
i(s, C);
|
|
261
|
+
var t = o(s);
|
|
262
|
+
function s(e, r, i) {
|
|
263
|
+
var o;
|
|
264
|
+
return n(this, s), (o = t.call(this, e, r)).options = i, o;
|
|
265
|
+
}
|
|
266
|
+
return r(s);
|
|
267
|
+
}(),
|
|
268
|
+
D = function (e) {
|
|
269
|
+
i(s, x);
|
|
270
|
+
var t = o(s);
|
|
271
|
+
function s() {
|
|
272
|
+
return n(this, s), t.call(this, "NoCurrentSessionError", "There is no session currently available. Make sure the user is authenticated with a valid session.");
|
|
273
|
+
}
|
|
274
|
+
return r(s);
|
|
275
|
+
}(),
|
|
276
|
+
R = function (e) {
|
|
277
|
+
i(s, x);
|
|
278
|
+
var t = o(s);
|
|
279
|
+
function s(e) {
|
|
280
|
+
return n(this, s), t.call(this, "InternalError", e || "An internal error has occurred. Please contact Stytch if this occurs.");
|
|
281
|
+
}
|
|
282
|
+
return r(s);
|
|
283
|
+
}(),
|
|
284
|
+
I = function (e) {
|
|
285
|
+
i(s, x);
|
|
286
|
+
var t = o(s);
|
|
287
|
+
function s() {
|
|
288
|
+
return n(this, s), t.call(this, "NoBiometricsRegistrationError", "There is no biometric registration available. Authenticate with another method and add a new biometric registration first.");
|
|
289
|
+
}
|
|
290
|
+
return r(s);
|
|
291
|
+
}(),
|
|
292
|
+
B = function (e) {
|
|
293
|
+
i(s, x);
|
|
294
|
+
var t = o(s);
|
|
295
|
+
function s() {
|
|
296
|
+
return n(this, s), t.call(this, "BiometricsUnavailableError", "Biometrics is not available on the device.");
|
|
297
|
+
}
|
|
298
|
+
return r(s);
|
|
299
|
+
}(),
|
|
300
|
+
L = function (e) {
|
|
301
|
+
i(s, x);
|
|
302
|
+
var t = o(s);
|
|
303
|
+
function s() {
|
|
304
|
+
return n(this, s), t.call(this, "KeyInvalidatedError", "The biometrics enrollment on the device has changed.");
|
|
305
|
+
}
|
|
306
|
+
return r(s);
|
|
307
|
+
}(),
|
|
308
|
+
M = function (e) {
|
|
309
|
+
i(s, x);
|
|
310
|
+
var t = o(s);
|
|
311
|
+
function s() {
|
|
312
|
+
return n(this, s), t.call(this, "KeystoreUnavailableError", "The Android keystore is unavailable on the device. Consider setting allowFallbackToCleartext to true.");
|
|
313
|
+
}
|
|
314
|
+
return r(s);
|
|
315
|
+
}(),
|
|
316
|
+
j = function (e) {
|
|
317
|
+
i(s, x);
|
|
318
|
+
var t = o(s);
|
|
319
|
+
function s() {
|
|
320
|
+
return n(this, s), t.call(this, "NoBiometricsEnrolledError", "There is no biometric factor enrolled on the device. Add a biometric factor in the device settings.");
|
|
321
|
+
}
|
|
322
|
+
return r(s);
|
|
323
|
+
}(),
|
|
324
|
+
F = function (e) {
|
|
325
|
+
i(s, x);
|
|
326
|
+
var t = o(s);
|
|
327
|
+
function s() {
|
|
328
|
+
return n(this, s), t.call(this, "UserCancellationError", "The user canceled the prompt. Ask the user to try again.");
|
|
329
|
+
}
|
|
330
|
+
return r(s);
|
|
331
|
+
}(),
|
|
332
|
+
N = function (e) {
|
|
333
|
+
i(s, x);
|
|
334
|
+
var t = o(s);
|
|
335
|
+
function s() {
|
|
336
|
+
return n(this, s), t.call(this, "UserLockedOutError", "The user has been locked out due to too many failed attempts. Ask the user to try again later.");
|
|
337
|
+
}
|
|
338
|
+
return r(s);
|
|
339
|
+
}(),
|
|
340
|
+
K = function (e) {
|
|
341
|
+
i(s, x);
|
|
342
|
+
var t = o(s);
|
|
343
|
+
function s() {
|
|
344
|
+
return n(this, s), t.call(this, "DeviceCredentialsNotAllowedError", "The device credentials allowment is mismatched. Change the allowDeviceCredentials parameter to be the same in both the register and authenticate methods.");
|
|
345
|
+
}
|
|
346
|
+
return r(s);
|
|
347
|
+
}(),
|
|
348
|
+
U = function (e) {
|
|
349
|
+
i(s, x);
|
|
350
|
+
var t = o(s);
|
|
351
|
+
function s() {
|
|
352
|
+
return n(this, s), t.call(this, "MissingGoogleClientIDError", "No Google client ID was found in the project.");
|
|
353
|
+
}
|
|
354
|
+
return r(s);
|
|
355
|
+
}(),
|
|
356
|
+
z = function (e) {
|
|
357
|
+
i(s, x);
|
|
358
|
+
var t = o(s);
|
|
359
|
+
function s() {
|
|
360
|
+
return n(this, s), t.call(this, "MissingPKCEError", "Make sure this flow is completed on the same device on which it was started.");
|
|
361
|
+
}
|
|
362
|
+
return r(s);
|
|
363
|
+
}(),
|
|
364
|
+
q = function (e) {
|
|
365
|
+
i(s, x);
|
|
366
|
+
var t = o(s);
|
|
367
|
+
function s() {
|
|
368
|
+
return n(this, s), t.call(this, "MissingAuthorizationCredentialIDTokenError", "The authorization credential is missing an ID token.");
|
|
369
|
+
}
|
|
370
|
+
return r(s);
|
|
371
|
+
}(),
|
|
372
|
+
W = function (e) {
|
|
373
|
+
i(s, x);
|
|
374
|
+
var t = o(s);
|
|
375
|
+
function s() {
|
|
376
|
+
return n(this, s), t.call(this, "InvalidAuthorizationCredentialError", "The authorization credential is invalid. Verify that OAuth is set up correctly in the developer console, and call the start flow method.");
|
|
377
|
+
}
|
|
378
|
+
return r(s);
|
|
379
|
+
}(),
|
|
380
|
+
G = function (e) {
|
|
381
|
+
i(s, x);
|
|
382
|
+
var t = o(s);
|
|
383
|
+
function s() {
|
|
384
|
+
return n(this, s), t.call(this, "MissingPublicKeyError", "Failed to retrieve the public key. Add a new biometric registration.");
|
|
385
|
+
}
|
|
386
|
+
return r(s);
|
|
387
|
+
}(),
|
|
388
|
+
H = function (e) {
|
|
389
|
+
i(s, x);
|
|
390
|
+
var t = o(s);
|
|
391
|
+
function s() {
|
|
392
|
+
return n(this, s), t.call(this, "ChallengeSigningFailedError", "Failed to sign the challenge with the key.");
|
|
393
|
+
}
|
|
394
|
+
return r(s);
|
|
395
|
+
}(),
|
|
396
|
+
Y = function (e) {
|
|
397
|
+
i(s, x);
|
|
398
|
+
var t = o(s);
|
|
399
|
+
function s() {
|
|
400
|
+
return n(this, s), t.call(this, "SDKNotConfiguredError", "Stytch client is not confiured. You must call the configure method before using the SDK");
|
|
401
|
+
}
|
|
402
|
+
return r(s);
|
|
403
|
+
}(),
|
|
404
|
+
V = function (e) {
|
|
405
|
+
i(s, x);
|
|
406
|
+
var t = o(s);
|
|
407
|
+
function s() {
|
|
408
|
+
return n(this, s), t.call(this, "FailedCodeChallengeError", "Failed to create a code challenge");
|
|
409
|
+
}
|
|
410
|
+
return r(s);
|
|
411
|
+
}(),
|
|
412
|
+
J = function (e) {
|
|
413
|
+
i(s, x);
|
|
414
|
+
var t = o(s);
|
|
415
|
+
function s() {
|
|
416
|
+
return n(this, s), t.call(this, "PasskeysUnsupportedError", "Passkeys are not supported on this device");
|
|
417
|
+
}
|
|
418
|
+
return r(s);
|
|
419
|
+
}(),
|
|
420
|
+
$ = function (e) {
|
|
421
|
+
i(s, x);
|
|
422
|
+
var t = o(s);
|
|
423
|
+
function s() {
|
|
424
|
+
return n(this, s), t.call(this, "FailedToDecryptDataError", "Failed to decrypt user data");
|
|
425
|
+
}
|
|
426
|
+
return r(s);
|
|
427
|
+
}(),
|
|
428
|
+
X = function (e) {
|
|
429
|
+
i(s, x);
|
|
430
|
+
var t = o(s);
|
|
431
|
+
function s() {
|
|
432
|
+
return n(this, s), t.call(this, "BiometricsFailedError", "Biometric authentication failed");
|
|
433
|
+
}
|
|
434
|
+
return r(s);
|
|
435
|
+
}(),
|
|
436
|
+
Z = function (e) {
|
|
437
|
+
i(s, x);
|
|
438
|
+
var t = o(s);
|
|
439
|
+
function s() {
|
|
440
|
+
return n(this, s), t.call(this, "InvalidStartUrlError", "The start URL was invalid or improperly formatted.");
|
|
441
|
+
}
|
|
442
|
+
return r(s);
|
|
443
|
+
}(),
|
|
444
|
+
Q = function (e) {
|
|
445
|
+
i(s, x);
|
|
446
|
+
var t = o(s);
|
|
447
|
+
function s() {
|
|
448
|
+
return n(this, s), t.call(this, "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.");
|
|
449
|
+
}
|
|
450
|
+
return r(s);
|
|
451
|
+
}(),
|
|
452
|
+
ee = function (e) {
|
|
453
|
+
i(s, x);
|
|
454
|
+
var t = o(s);
|
|
455
|
+
function s() {
|
|
456
|
+
return n(this, s), t.call(this, "MissingUrlError", "The underlying web authentication service failed to return a URL.");
|
|
457
|
+
}
|
|
458
|
+
return r(s);
|
|
459
|
+
}(),
|
|
460
|
+
te = function (e) {
|
|
461
|
+
i(s, x);
|
|
462
|
+
var t = o(s);
|
|
463
|
+
function s() {
|
|
464
|
+
return n(this, s), t.call(this, "InvalidCredentialTypeError", "The public key credential type was not of the expected type.");
|
|
465
|
+
}
|
|
466
|
+
return r(s);
|
|
467
|
+
}(),
|
|
468
|
+
re = function (e) {
|
|
469
|
+
i(s, x);
|
|
470
|
+
var t = o(s);
|
|
471
|
+
function s() {
|
|
472
|
+
return n(this, s), t.call(this, "MissingAttestationObjectError", "The public key credential is missing the attestation object.");
|
|
473
|
+
}
|
|
474
|
+
return r(s);
|
|
475
|
+
}(),
|
|
476
|
+
ne = function (e) {
|
|
477
|
+
i(s, x);
|
|
478
|
+
var t = o(s);
|
|
479
|
+
function s() {
|
|
480
|
+
return n(this, s), t.call(this, "JSONDataNotConvertibleToStringError", "JSON data unable to be converted to String type.");
|
|
481
|
+
}
|
|
482
|
+
return r(s);
|
|
483
|
+
}(),
|
|
484
|
+
ie = function (e) {
|
|
485
|
+
i(s, x);
|
|
486
|
+
var t = o(s);
|
|
487
|
+
function s() {
|
|
488
|
+
return n(this, s), t.call(this, "RandomNumberGenerationFailed", "Random number generation failed");
|
|
489
|
+
}
|
|
490
|
+
return r(s);
|
|
491
|
+
}(),
|
|
492
|
+
oe = function (e) {
|
|
493
|
+
i(s, x);
|
|
494
|
+
var t = o(s);
|
|
495
|
+
function s() {
|
|
496
|
+
return n(this, s), t.call(this, "PasskeysInvalidEncoding", "Invalid passkey encoding");
|
|
497
|
+
}
|
|
498
|
+
return r(s);
|
|
499
|
+
}();
|
|
500
|
+
function se(e) {
|
|
501
|
+
switch (e.message) {
|
|
502
|
+
case "internal_error":
|
|
503
|
+
return new R(e.message);
|
|
504
|
+
case "no_current_session":
|
|
505
|
+
return new D();
|
|
506
|
+
case "no_biometrics_registration":
|
|
507
|
+
case "no_biometrics_registration":
|
|
508
|
+
return new I();
|
|
509
|
+
case "biometrics_unavailable":
|
|
510
|
+
case "device_hardware_error":
|
|
511
|
+
case "biometrics_not_available":
|
|
512
|
+
return new B();
|
|
513
|
+
case "key_invalidated":
|
|
514
|
+
case "no_biometric_key":
|
|
515
|
+
return new L();
|
|
516
|
+
case "no_biometrics_enrolled":
|
|
517
|
+
return new j();
|
|
518
|
+
case "keystore_unavailable":
|
|
519
|
+
return new M();
|
|
520
|
+
case "device_credentials_not_allowed":
|
|
521
|
+
return new K();
|
|
522
|
+
case "user_cancellation":
|
|
523
|
+
return new F();
|
|
524
|
+
case "user_locked_out":
|
|
525
|
+
return new N();
|
|
526
|
+
case "google_onetap_missing_id_token":
|
|
527
|
+
case "oauth_apple_missing_id_token":
|
|
528
|
+
case "missing_authorization_credential_id_token":
|
|
529
|
+
return new q();
|
|
530
|
+
case "google_onetap_missing_member":
|
|
531
|
+
case "oauth_apple_credential_invalid":
|
|
532
|
+
case "invalid_authorization_credential":
|
|
533
|
+
return new W();
|
|
534
|
+
case "missing_public_key":
|
|
535
|
+
return new G();
|
|
536
|
+
case "challenge_signing_failed":
|
|
537
|
+
return new H();
|
|
538
|
+
case "sdk_not_configured":
|
|
539
|
+
return new Y();
|
|
540
|
+
case "failed_code_challenge":
|
|
541
|
+
return new V();
|
|
542
|
+
case "passkeys_unsupported":
|
|
543
|
+
return new J();
|
|
544
|
+
case "failed_to_decrypt_data":
|
|
545
|
+
return new $();
|
|
546
|
+
case "biometrics_failed":
|
|
547
|
+
return new X();
|
|
548
|
+
case "invalid_start_url":
|
|
549
|
+
return new Z();
|
|
550
|
+
case "invalid_redirect_scheme":
|
|
551
|
+
return new Q();
|
|
552
|
+
case "missing_url":
|
|
553
|
+
return new ee();
|
|
554
|
+
case "invalid_credential_type":
|
|
555
|
+
return new te();
|
|
556
|
+
case "missing_attestation_object":
|
|
557
|
+
return new re();
|
|
558
|
+
case "json_data_not_convertible_to_string":
|
|
559
|
+
return new ne();
|
|
560
|
+
case "random_number_generation_failed":
|
|
561
|
+
return new ie();
|
|
562
|
+
case "passkeys_invalid_encoding":
|
|
563
|
+
return new oe();
|
|
564
|
+
default:
|
|
565
|
+
return new x(e.name, e.message);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function ae(e, t) {
|
|
31
569
|
return function (e) {
|
|
32
570
|
if (Array.isArray(e)) return e;
|
|
33
571
|
}(e) || function (e, t) {
|
|
@@ -56,46 +594,46 @@ function e(e, r) {
|
|
|
56
594
|
}
|
|
57
595
|
return a;
|
|
58
596
|
}
|
|
59
|
-
}(e,
|
|
597
|
+
}(e, t) || ce(e, t) || function () {
|
|
60
598
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
61
599
|
}();
|
|
62
600
|
}
|
|
63
|
-
function
|
|
601
|
+
function ce(e, t) {
|
|
64
602
|
if (e) {
|
|
65
|
-
if ("string" == typeof e) return
|
|
66
|
-
var
|
|
67
|
-
return "Object" ===
|
|
603
|
+
if ("string" == typeof e) return ue(e, t);
|
|
604
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
605
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? ue(e, t) : void 0;
|
|
68
606
|
}
|
|
69
607
|
}
|
|
70
|
-
function
|
|
608
|
+
function ue(e, t) {
|
|
71
609
|
(null == t || t > e.length) && (t = e.length);
|
|
72
610
|
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
73
611
|
return n;
|
|
74
612
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
613
|
+
function le(e) {
|
|
614
|
+
return le = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
77
615
|
return _typeof(e);
|
|
78
616
|
} : function (e) {
|
|
79
617
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
80
|
-
},
|
|
618
|
+
}, le(e);
|
|
81
619
|
}
|
|
82
|
-
function
|
|
620
|
+
function de() {
|
|
83
621
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
84
|
-
|
|
622
|
+
de = function de() {
|
|
85
623
|
return t;
|
|
86
624
|
};
|
|
87
625
|
var e,
|
|
88
626
|
t = {},
|
|
89
627
|
r = Object.prototype,
|
|
90
|
-
|
|
91
|
-
|
|
628
|
+
n = r.hasOwnProperty,
|
|
629
|
+
i = Object.defineProperty || function (e, t, r) {
|
|
92
630
|
e[t] = r.value;
|
|
93
631
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function
|
|
632
|
+
o = "function" == typeof Symbol ? Symbol : {},
|
|
633
|
+
s = o.iterator || "@@iterator",
|
|
634
|
+
a = o.asyncIterator || "@@asyncIterator",
|
|
635
|
+
c = o.toStringTag || "@@toStringTag";
|
|
636
|
+
function u(e, t, r) {
|
|
99
637
|
return Object.defineProperty(e, t, {
|
|
100
638
|
value: r,
|
|
101
639
|
enumerable: !0,
|
|
@@ -104,21 +642,21 @@ function i() {
|
|
|
104
642
|
}), e[t];
|
|
105
643
|
}
|
|
106
644
|
try {
|
|
107
|
-
|
|
645
|
+
u({}, "");
|
|
108
646
|
} catch (e) {
|
|
109
|
-
|
|
647
|
+
u = function u(e, t, r) {
|
|
110
648
|
return e[t] = r;
|
|
111
649
|
};
|
|
112
650
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
115
|
-
|
|
651
|
+
function l(e, t, r, n) {
|
|
652
|
+
var o = t && t.prototype instanceof v ? t : v,
|
|
653
|
+
s = Object.create(o.prototype),
|
|
116
654
|
a = new x(n || []);
|
|
117
|
-
return s
|
|
118
|
-
value:
|
|
119
|
-
}),
|
|
655
|
+
return i(s, "_invoke", {
|
|
656
|
+
value: C(e, r, a)
|
|
657
|
+
}), s;
|
|
120
658
|
}
|
|
121
|
-
function
|
|
659
|
+
function d(e, t, r) {
|
|
122
660
|
try {
|
|
123
661
|
return {
|
|
124
662
|
type: "normal",
|
|
@@ -131,65 +669,65 @@ function i() {
|
|
|
131
669
|
};
|
|
132
670
|
}
|
|
133
671
|
}
|
|
134
|
-
t.wrap =
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
672
|
+
t.wrap = l;
|
|
673
|
+
var h = "suspendedStart",
|
|
674
|
+
p = "suspendedYield",
|
|
675
|
+
_ = "executing",
|
|
676
|
+
f = "completed",
|
|
677
|
+
m = {};
|
|
678
|
+
function v() {}
|
|
679
|
+
function b() {}
|
|
140
680
|
function g() {}
|
|
141
|
-
|
|
142
|
-
function
|
|
143
|
-
var S = {};
|
|
144
|
-
d(S, c, function () {
|
|
681
|
+
var y = {};
|
|
682
|
+
u(y, s, function () {
|
|
145
683
|
return this;
|
|
146
684
|
});
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
function
|
|
685
|
+
var k = Object.getPrototypeOf,
|
|
686
|
+
w = k && k(k(D([])));
|
|
687
|
+
w && w !== r && n.call(w, s) && (y = w);
|
|
688
|
+
var S = g.prototype = v.prototype = Object.create(y);
|
|
689
|
+
function P(e) {
|
|
152
690
|
["next", "throw", "return"].forEach(function (t) {
|
|
153
|
-
|
|
691
|
+
u(e, t, function (e) {
|
|
154
692
|
return this._invoke(t, e);
|
|
155
693
|
});
|
|
156
694
|
});
|
|
157
695
|
}
|
|
158
|
-
function
|
|
159
|
-
function r(i, s, a
|
|
160
|
-
var
|
|
161
|
-
if ("throw" !==
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
r("next", e,
|
|
696
|
+
function A(e, t) {
|
|
697
|
+
function r(i, o, s, a) {
|
|
698
|
+
var c = d(e[i], e, o);
|
|
699
|
+
if ("throw" !== c.type) {
|
|
700
|
+
var u = c.arg,
|
|
701
|
+
l = u.value;
|
|
702
|
+
return l && "object" == le(l) && n.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
|
|
703
|
+
r("next", e, s, a);
|
|
166
704
|
}, function (e) {
|
|
167
|
-
r("throw", e,
|
|
168
|
-
}) : t.resolve(
|
|
169
|
-
|
|
705
|
+
r("throw", e, s, a);
|
|
706
|
+
}) : t.resolve(l).then(function (e) {
|
|
707
|
+
u.value = e, s(u);
|
|
170
708
|
}, function (e) {
|
|
171
|
-
return r("throw", e,
|
|
709
|
+
return r("throw", e, s, a);
|
|
172
710
|
});
|
|
173
711
|
}
|
|
174
|
-
c
|
|
712
|
+
a(c.arg);
|
|
175
713
|
}
|
|
176
|
-
var
|
|
177
|
-
|
|
714
|
+
var o;
|
|
715
|
+
i(this, "_invoke", {
|
|
178
716
|
value: function value(e, n) {
|
|
179
|
-
function
|
|
717
|
+
function i() {
|
|
180
718
|
return new t(function (t, i) {
|
|
181
719
|
r(e, n, t, i);
|
|
182
720
|
});
|
|
183
721
|
}
|
|
184
|
-
return
|
|
722
|
+
return o = o ? o.then(i, i) : i();
|
|
185
723
|
}
|
|
186
724
|
});
|
|
187
725
|
}
|
|
188
|
-
function
|
|
189
|
-
var i =
|
|
726
|
+
function C(t, r, n) {
|
|
727
|
+
var i = h;
|
|
190
728
|
return function (o, s) {
|
|
191
|
-
if (i ===
|
|
192
|
-
if (i ===
|
|
729
|
+
if (i === _) throw new Error("Generator is already running");
|
|
730
|
+
if (i === f) {
|
|
193
731
|
if ("throw" === o) throw s;
|
|
194
732
|
return {
|
|
195
733
|
value: e,
|
|
@@ -199,95 +737,95 @@ function i() {
|
|
|
199
737
|
for (n.method = o, n.arg = s;;) {
|
|
200
738
|
var a = n.delegate;
|
|
201
739
|
if (a) {
|
|
202
|
-
var c =
|
|
740
|
+
var c = T(a, n);
|
|
203
741
|
if (c) {
|
|
204
|
-
if (c ===
|
|
742
|
+
if (c === m) continue;
|
|
205
743
|
return c;
|
|
206
744
|
}
|
|
207
745
|
}
|
|
208
746
|
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
209
|
-
if (i ===
|
|
747
|
+
if (i === h) throw i = f, n.arg;
|
|
210
748
|
n.dispatchException(n.arg);
|
|
211
749
|
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
212
|
-
i =
|
|
213
|
-
var u =
|
|
750
|
+
i = _;
|
|
751
|
+
var u = d(t, r, n);
|
|
214
752
|
if ("normal" === u.type) {
|
|
215
|
-
if (i = n.done ?
|
|
753
|
+
if (i = n.done ? f : p, u.arg === m) continue;
|
|
216
754
|
return {
|
|
217
755
|
value: u.arg,
|
|
218
756
|
done: n.done
|
|
219
757
|
};
|
|
220
758
|
}
|
|
221
|
-
"throw" === u.type && (i =
|
|
759
|
+
"throw" === u.type && (i = f, n.method = "throw", n.arg = u.arg);
|
|
222
760
|
}
|
|
223
761
|
};
|
|
224
762
|
}
|
|
225
|
-
function
|
|
763
|
+
function T(t, r) {
|
|
226
764
|
var n = r.method,
|
|
227
765
|
i = t.iterator[n];
|
|
228
|
-
if (i === e) return r.delegate = null, "throw" === n && t.iterator["return"] && (r.method = "return", r.arg = e,
|
|
229
|
-
var o =
|
|
230
|
-
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null,
|
|
766
|
+
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;
|
|
767
|
+
var o = d(i, t.iterator, r.arg);
|
|
768
|
+
if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, m;
|
|
231
769
|
var s = o.arg;
|
|
232
|
-
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,
|
|
770
|
+
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);
|
|
233
771
|
}
|
|
234
|
-
function
|
|
772
|
+
function O(e) {
|
|
235
773
|
var t = {
|
|
236
774
|
tryLoc: e[0]
|
|
237
775
|
};
|
|
238
776
|
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
|
|
239
777
|
}
|
|
240
|
-
function
|
|
778
|
+
function E(e) {
|
|
241
779
|
var t = e.completion || {};
|
|
242
780
|
t.type = "normal", delete t.arg, e.completion = t;
|
|
243
781
|
}
|
|
244
782
|
function x(e) {
|
|
245
783
|
this.tryEntries = [{
|
|
246
784
|
tryLoc: "root"
|
|
247
|
-
}], e.forEach(
|
|
785
|
+
}], e.forEach(O, this), this.reset(!0);
|
|
248
786
|
}
|
|
249
|
-
function
|
|
787
|
+
function D(t) {
|
|
250
788
|
if (t || "" === t) {
|
|
251
|
-
var r = t[
|
|
789
|
+
var r = t[s];
|
|
252
790
|
if (r) return r.call(t);
|
|
253
791
|
if ("function" == typeof t.next) return t;
|
|
254
792
|
if (!isNaN(t.length)) {
|
|
255
793
|
var i = -1,
|
|
256
|
-
|
|
257
|
-
for (; ++i < t.length;) if (
|
|
794
|
+
o = function r() {
|
|
795
|
+
for (; ++i < t.length;) if (n.call(t, i)) return r.value = t[i], r.done = !1, r;
|
|
258
796
|
return r.value = e, r.done = !0, r;
|
|
259
797
|
};
|
|
260
|
-
return
|
|
798
|
+
return o.next = o;
|
|
261
799
|
}
|
|
262
800
|
}
|
|
263
|
-
throw new TypeError(
|
|
801
|
+
throw new TypeError(le(t) + " is not iterable");
|
|
264
802
|
}
|
|
265
|
-
return
|
|
266
|
-
value:
|
|
803
|
+
return b.prototype = g, i(S, "constructor", {
|
|
804
|
+
value: g,
|
|
267
805
|
configurable: !0
|
|
268
|
-
}),
|
|
269
|
-
value:
|
|
806
|
+
}), i(g, "constructor", {
|
|
807
|
+
value: b,
|
|
270
808
|
configurable: !0
|
|
271
|
-
}),
|
|
809
|
+
}), b.displayName = u(g, c, "GeneratorFunction"), t.isGeneratorFunction = function (e) {
|
|
272
810
|
var t = "function" == typeof e && e.constructor;
|
|
273
|
-
return !!t && (t ===
|
|
811
|
+
return !!t && (t === b || "GeneratorFunction" === (t.displayName || t.name));
|
|
274
812
|
}, t.mark = function (e) {
|
|
275
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e,
|
|
813
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, g) : (e.__proto__ = g, u(e, c, "GeneratorFunction")), e.prototype = Object.create(S), e;
|
|
276
814
|
}, t.awrap = function (e) {
|
|
277
815
|
return {
|
|
278
816
|
__await: e
|
|
279
817
|
};
|
|
280
|
-
},
|
|
818
|
+
}, P(A.prototype), u(A.prototype, a, function () {
|
|
281
819
|
return this;
|
|
282
|
-
}), t.AsyncIterator =
|
|
820
|
+
}), t.AsyncIterator = A, t.async = function (e, r, n, i, o) {
|
|
283
821
|
void 0 === o && (o = Promise);
|
|
284
|
-
var s = new
|
|
822
|
+
var s = new A(l(e, r, n, i), o);
|
|
285
823
|
return t.isGeneratorFunction(r) ? s : s.next().then(function (e) {
|
|
286
824
|
return e.done ? e.value : s.next();
|
|
287
825
|
});
|
|
288
|
-
},
|
|
826
|
+
}, P(S), u(S, c, "Generator"), u(S, s, function () {
|
|
289
827
|
return this;
|
|
290
|
-
}),
|
|
828
|
+
}), u(S, "toString", function () {
|
|
291
829
|
return "[object Generator]";
|
|
292
830
|
}), t.keys = function (e) {
|
|
293
831
|
var t = Object(e),
|
|
@@ -300,10 +838,10 @@ function i() {
|
|
|
300
838
|
}
|
|
301
839
|
return e.done = !0, e;
|
|
302
840
|
};
|
|
303
|
-
}, t.values =
|
|
841
|
+
}, t.values = D, x.prototype = {
|
|
304
842
|
constructor: x,
|
|
305
843
|
reset: function reset(t) {
|
|
306
|
-
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(
|
|
844
|
+
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);
|
|
307
845
|
},
|
|
308
846
|
stop: function stop() {
|
|
309
847
|
this.done = !0;
|
|
@@ -314,48 +852,48 @@ function i() {
|
|
|
314
852
|
dispatchException: function dispatchException(t) {
|
|
315
853
|
if (this.done) throw t;
|
|
316
854
|
var r = this;
|
|
317
|
-
function
|
|
855
|
+
function i(n, i) {
|
|
318
856
|
return a.type = "throw", a.arg = t, r.next = n, i && (r.method = "next", r.arg = e), !!i;
|
|
319
857
|
}
|
|
320
|
-
for (var
|
|
321
|
-
var s = this.tryEntries[
|
|
858
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
859
|
+
var s = this.tryEntries[o],
|
|
322
860
|
a = s.completion;
|
|
323
|
-
if ("root" === s.tryLoc) return
|
|
861
|
+
if ("root" === s.tryLoc) return i("end");
|
|
324
862
|
if (s.tryLoc <= this.prev) {
|
|
325
|
-
var c =
|
|
326
|
-
u =
|
|
863
|
+
var c = n.call(s, "catchLoc"),
|
|
864
|
+
u = n.call(s, "finallyLoc");
|
|
327
865
|
if (c && u) {
|
|
328
|
-
if (this.prev < s.catchLoc) return
|
|
329
|
-
if (this.prev < s.finallyLoc) return
|
|
866
|
+
if (this.prev < s.catchLoc) return i(s.catchLoc, !0);
|
|
867
|
+
if (this.prev < s.finallyLoc) return i(s.finallyLoc);
|
|
330
868
|
} else if (c) {
|
|
331
|
-
if (this.prev < s.catchLoc) return
|
|
869
|
+
if (this.prev < s.catchLoc) return i(s.catchLoc, !0);
|
|
332
870
|
} else {
|
|
333
871
|
if (!u) throw new Error("try statement without catch or finally");
|
|
334
|
-
if (this.prev < s.finallyLoc) return
|
|
872
|
+
if (this.prev < s.finallyLoc) return i(s.finallyLoc);
|
|
335
873
|
}
|
|
336
874
|
}
|
|
337
875
|
}
|
|
338
876
|
},
|
|
339
877
|
abrupt: function abrupt(e, t) {
|
|
340
878
|
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
341
|
-
var
|
|
342
|
-
if (
|
|
343
|
-
var
|
|
879
|
+
var i = this.tryEntries[r];
|
|
880
|
+
if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
|
|
881
|
+
var o = i;
|
|
344
882
|
break;
|
|
345
883
|
}
|
|
346
884
|
}
|
|
347
|
-
|
|
348
|
-
var s =
|
|
349
|
-
return s.type = e, s.arg = t,
|
|
885
|
+
o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null);
|
|
886
|
+
var s = o ? o.completion : {};
|
|
887
|
+
return s.type = e, s.arg = t, o ? (this.method = "next", this.next = o.finallyLoc, m) : this.complete(s);
|
|
350
888
|
},
|
|
351
889
|
complete: function complete(e, t) {
|
|
352
890
|
if ("throw" === e.type) throw e.arg;
|
|
353
|
-
return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t),
|
|
891
|
+
return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), m;
|
|
354
892
|
},
|
|
355
893
|
finish: function finish(e) {
|
|
356
894
|
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
|
|
357
895
|
var r = this.tryEntries[t];
|
|
358
|
-
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc),
|
|
896
|
+
if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), E(r), m;
|
|
359
897
|
}
|
|
360
898
|
},
|
|
361
899
|
"catch": function _catch(e) {
|
|
@@ -365,7 +903,7 @@ function i() {
|
|
|
365
903
|
var n = r.completion;
|
|
366
904
|
if ("throw" === n.type) {
|
|
367
905
|
var i = n.arg;
|
|
368
|
-
|
|
906
|
+
E(r);
|
|
369
907
|
}
|
|
370
908
|
return i;
|
|
371
909
|
}
|
|
@@ -374,72 +912,59 @@ function i() {
|
|
|
374
912
|
},
|
|
375
913
|
delegateYield: function delegateYield(t, r, n) {
|
|
376
914
|
return this.delegate = {
|
|
377
|
-
iterator:
|
|
915
|
+
iterator: D(t),
|
|
378
916
|
resultName: r,
|
|
379
917
|
nextLoc: n
|
|
380
|
-
}, "next" === this.method && (this.arg = e),
|
|
918
|
+
}, "next" === this.method && (this.arg = e), m;
|
|
381
919
|
}
|
|
382
920
|
}, t;
|
|
383
921
|
}
|
|
384
|
-
function
|
|
922
|
+
function he(e, t) {
|
|
385
923
|
for (var r = 0; r < t.length; r++) {
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
if ("object" !==
|
|
924
|
+
var n = t[r];
|
|
925
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
|
|
926
|
+
if ("object" !== le(e) || null === e) return e;
|
|
389
927
|
var r = e[Symbol.toPrimitive];
|
|
390
928
|
if (void 0 !== r) {
|
|
391
|
-
var
|
|
392
|
-
if ("object" !== n
|
|
929
|
+
var n = r.call(e, t || "default");
|
|
930
|
+
if ("object" !== le(n)) return n;
|
|
393
931
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
394
932
|
}
|
|
395
933
|
return ("string" === t ? String : Number)(e);
|
|
396
|
-
}(
|
|
934
|
+
}(i, "string"), "symbol" === le(o) ? o : String(o)), n);
|
|
397
935
|
}
|
|
398
|
-
var
|
|
936
|
+
var i, o;
|
|
399
937
|
}
|
|
400
|
-
function
|
|
401
|
-
return t &&
|
|
938
|
+
function pe(e, t, r) {
|
|
939
|
+
return t && he(e.prototype, t), r && he(e, r), Object.defineProperty(e, "prototype", {
|
|
402
940
|
writable: !1
|
|
403
941
|
}), e;
|
|
404
942
|
}
|
|
405
|
-
function
|
|
943
|
+
function _e(e, t) {
|
|
406
944
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
407
945
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
410
|
-
e.prototype = Object.create(t && t.prototype, {
|
|
411
|
-
constructor: {
|
|
412
|
-
value: e,
|
|
413
|
-
writable: !0,
|
|
414
|
-
configurable: !0
|
|
415
|
-
}
|
|
416
|
-
}), Object.defineProperty(e, "prototype", {
|
|
417
|
-
writable: !1
|
|
418
|
-
}), t && _(e, t);
|
|
419
|
-
}
|
|
420
|
-
function u(e) {
|
|
421
|
-
var t = p();
|
|
946
|
+
function fe(e) {
|
|
947
|
+
var t = be();
|
|
422
948
|
return function () {
|
|
423
949
|
var r,
|
|
424
|
-
|
|
950
|
+
n = ye(e);
|
|
425
951
|
if (t) {
|
|
426
|
-
var
|
|
427
|
-
r = Reflect.construct(
|
|
428
|
-
} else r =
|
|
952
|
+
var i = ye(this).constructor;
|
|
953
|
+
r = Reflect.construct(n, arguments, i);
|
|
954
|
+
} else r = n.apply(this, arguments);
|
|
429
955
|
return function (e, t) {
|
|
430
|
-
if (t && ("object" ===
|
|
956
|
+
if (t && ("object" === le(t) || "function" == typeof t)) return t;
|
|
431
957
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
432
|
-
return
|
|
958
|
+
return function (e) {
|
|
959
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
960
|
+
return e;
|
|
961
|
+
}(e);
|
|
433
962
|
}(this, r);
|
|
434
963
|
};
|
|
435
964
|
}
|
|
436
|
-
function
|
|
437
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
438
|
-
return e;
|
|
439
|
-
}
|
|
440
|
-
function d(e) {
|
|
965
|
+
function me(e) {
|
|
441
966
|
var t = "function" == typeof Map ? new Map() : void 0;
|
|
442
|
-
return
|
|
967
|
+
return me = function me(e) {
|
|
443
968
|
if (null === e || !function (e) {
|
|
444
969
|
try {
|
|
445
970
|
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
@@ -453,7 +978,7 @@ function d(e) {
|
|
|
453
978
|
t.set(e, r);
|
|
454
979
|
}
|
|
455
980
|
function r() {
|
|
456
|
-
return
|
|
981
|
+
return ve(e, arguments, ye(this).constructor);
|
|
457
982
|
}
|
|
458
983
|
return r.prototype = Object.create(e.prototype, {
|
|
459
984
|
constructor: {
|
|
@@ -462,18 +987,18 @@ function d(e) {
|
|
|
462
987
|
writable: !0,
|
|
463
988
|
configurable: !0
|
|
464
989
|
}
|
|
465
|
-
}),
|
|
466
|
-
},
|
|
990
|
+
}), ge(r, e);
|
|
991
|
+
}, me(e);
|
|
467
992
|
}
|
|
468
|
-
function
|
|
469
|
-
return
|
|
993
|
+
function ve(e, t, r) {
|
|
994
|
+
return ve = be() ? Reflect.construct.bind() : function (e, t, r) {
|
|
470
995
|
var n = [null];
|
|
471
996
|
n.push.apply(n, t);
|
|
472
997
|
var i = new (Function.bind.apply(e, n))();
|
|
473
|
-
return r &&
|
|
474
|
-
},
|
|
998
|
+
return r && ge(i, r.prototype), i;
|
|
999
|
+
}, ve.apply(null, arguments);
|
|
475
1000
|
}
|
|
476
|
-
function
|
|
1001
|
+
function be() {
|
|
477
1002
|
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
478
1003
|
if (Reflect.construct.sham) return !1;
|
|
479
1004
|
if ("function" == typeof Proxy) return !0;
|
|
@@ -483,18 +1008,25 @@ function p() {
|
|
|
483
1008
|
return !1;
|
|
484
1009
|
}
|
|
485
1010
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
1011
|
+
function ge(e, t) {
|
|
1012
|
+
return ge = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
488
1013
|
return e.__proto__ = t, e;
|
|
489
|
-
},
|
|
1014
|
+
}, ge(e, t);
|
|
490
1015
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
1016
|
+
function ye(e) {
|
|
1017
|
+
return ye = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
493
1018
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
494
|
-
},
|
|
1019
|
+
}, ye(e);
|
|
495
1020
|
}
|
|
496
|
-
|
|
497
|
-
|
|
1021
|
+
!function (e) {
|
|
1022
|
+
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
1023
|
+
}(b || (b = {})), function (e) {
|
|
1024
|
+
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
1025
|
+
}(g || (g = {})), function (e) {
|
|
1026
|
+
e.Google = "google", e.Microsoft = "microsoft";
|
|
1027
|
+
}(y || (y = {}));
|
|
1028
|
+
var ke;
|
|
1029
|
+
function we(e, t, r, n) {
|
|
498
1030
|
return new (r || (r = Promise))(function (i, o) {
|
|
499
1031
|
function s(e) {
|
|
500
1032
|
try {
|
|
@@ -519,211 +1051,149 @@ function S(e, t, r, n) {
|
|
|
519
1051
|
c((n = n.apply(e, t || [])).next());
|
|
520
1052
|
});
|
|
521
1053
|
}
|
|
522
|
-
"function" == typeof SuppressedError && SuppressedError,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
T,
|
|
539
|
-
O,
|
|
540
|
-
P = function (e) {
|
|
541
|
-
c(r, d(Error));
|
|
542
|
-
var t = u(r);
|
|
543
|
-
function r(e, n) {
|
|
544
|
-
var i;
|
|
545
|
-
return a(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(l(i), r.prototype), i;
|
|
546
|
-
}
|
|
547
|
-
return s(r);
|
|
548
|
-
}(),
|
|
549
|
-
C = function (e) {
|
|
550
|
-
c(r, d(Error));
|
|
551
|
-
var t = u(r);
|
|
552
|
-
function r(e, n) {
|
|
553
|
-
var i;
|
|
554
|
-
return a(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
555
|
-
}
|
|
556
|
-
return s(r);
|
|
557
|
-
}(),
|
|
558
|
-
B = function (e) {
|
|
559
|
-
c(r, d(Error));
|
|
560
|
-
var t = u(r);
|
|
561
|
-
function r(e) {
|
|
562
|
-
var n, i;
|
|
563
|
-
a(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
564
|
-
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
565
|
-
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
566
|
-
}).join("\n");
|
|
567
|
-
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
568
|
-
}
|
|
569
|
-
return s(r);
|
|
570
|
-
}(),
|
|
571
|
-
R = function (e) {
|
|
572
|
-
c(r, d(Error));
|
|
573
|
-
var t = u(r);
|
|
574
|
-
function r(e) {
|
|
575
|
-
var n;
|
|
576
|
-
a(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
577
|
-
var i = e.status_code,
|
|
578
|
-
o = e.error_type,
|
|
579
|
-
s = e.error_message,
|
|
580
|
-
c = e.error_url,
|
|
581
|
-
u = e.request_id;
|
|
582
|
-
return n.error_type = o, n.error_message = s, n.error_url = c, n.request_id = u, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(c, " for more information.\n") + (u ? "request_id: ".concat(u, "\n") : ""), n;
|
|
583
|
-
}
|
|
584
|
-
return s(r);
|
|
585
|
-
}(),
|
|
586
|
-
x = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
587
|
-
!function (e) {
|
|
588
|
-
e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
|
|
589
|
-
}(w || (w = {})), function (e) {
|
|
590
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
591
|
-
}(A || (A = {})), function (e) {
|
|
592
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
593
|
-
}(E || (E = {})), function (e) {
|
|
594
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
595
|
-
}(T || (T = {})), (O || (O = {})).RequiredCatcha = "Catcha Required";
|
|
596
|
-
var I,
|
|
597
|
-
D = function (e) {
|
|
598
|
-
c(r, d(Error));
|
|
599
|
-
var t = u(r);
|
|
1054
|
+
"function" == typeof SuppressedError && SuppressedError, (ke || (ke = {})).RequiredCatcha = "Catcha Required";
|
|
1055
|
+
var Se,
|
|
1056
|
+
Pe = function (e) {
|
|
1057
|
+
!function (e, t) {
|
|
1058
|
+
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
1059
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
1060
|
+
constructor: {
|
|
1061
|
+
value: e,
|
|
1062
|
+
writable: !0,
|
|
1063
|
+
configurable: !0
|
|
1064
|
+
}
|
|
1065
|
+
}), Object.defineProperty(e, "prototype", {
|
|
1066
|
+
writable: !1
|
|
1067
|
+
}), t && ge(e, t);
|
|
1068
|
+
}(r, me(Error));
|
|
1069
|
+
var t = fe(r);
|
|
600
1070
|
function r(e) {
|
|
601
1071
|
var n;
|
|
602
|
-
return
|
|
1072
|
+
return _e(this, r), (n = t.call(this, e)).type = e, n;
|
|
603
1073
|
}
|
|
604
|
-
return
|
|
1074
|
+
return pe(r);
|
|
605
1075
|
}();
|
|
606
|
-
function
|
|
607
|
-
var t
|
|
608
|
-
r = e.
|
|
1076
|
+
function Ae(e) {
|
|
1077
|
+
var t,
|
|
1078
|
+
r = e.method,
|
|
609
1079
|
n = e.finalURL,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return
|
|
615
|
-
var u, l, d, h, p
|
|
616
|
-
return
|
|
1080
|
+
i = e.basicAuthHeader,
|
|
1081
|
+
o = e.xSDKClientHeader,
|
|
1082
|
+
s = e.xSDKParentHostHeader,
|
|
1083
|
+
a = e.body;
|
|
1084
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1085
|
+
var c, u, l, d, h, p;
|
|
1086
|
+
return de().wrap(function (e) {
|
|
617
1087
|
for (;;) switch (e.prev = e.next) {
|
|
618
1088
|
case 0:
|
|
619
|
-
return
|
|
620
|
-
Authorization:
|
|
1089
|
+
return c = {
|
|
1090
|
+
Authorization: i,
|
|
621
1091
|
"Content-Type": "application/json",
|
|
622
|
-
"X-SDK-Client":
|
|
623
|
-
},
|
|
624
|
-
method:
|
|
625
|
-
headers:
|
|
626
|
-
body:
|
|
627
|
-
}, e.prev = 3, e.next = 6, fetch(n,
|
|
1092
|
+
"X-SDK-Client": o
|
|
1093
|
+
}, s && (c["X-SDK-Parent-Host"] = s), u = {
|
|
1094
|
+
method: r,
|
|
1095
|
+
headers: c,
|
|
1096
|
+
body: a && JSON.stringify(a)
|
|
1097
|
+
}, e.prev = 3, e.next = 6, fetch(n, u);
|
|
628
1098
|
case 6:
|
|
629
|
-
|
|
1099
|
+
l = e.sent, e.next = 14;
|
|
630
1100
|
break;
|
|
631
1101
|
case 9:
|
|
632
1102
|
if (e.prev = 9, e.t0 = e["catch"](3), "Failed to fetch" !== e.t0.message) {
|
|
633
1103
|
e.next = 13;
|
|
634
1104
|
break;
|
|
635
1105
|
}
|
|
636
|
-
throw new
|
|
1106
|
+
throw new T("Unable to contact the Stytch servers. Are you online?");
|
|
637
1107
|
case 13:
|
|
638
1108
|
throw e.t0;
|
|
639
1109
|
case 14:
|
|
640
|
-
if (
|
|
641
|
-
e.next =
|
|
1110
|
+
if (!(l.status <= 299)) {
|
|
1111
|
+
e.next = 25;
|
|
642
1112
|
break;
|
|
643
1113
|
}
|
|
644
|
-
return e.prev = 15, e.next = 18,
|
|
1114
|
+
return e.prev = 15, e.next = 18, l.json();
|
|
645
1115
|
case 18:
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
e.next = 26;
|
|
1116
|
+
return d = e.sent, e.abrupt("return", d.data);
|
|
1117
|
+
case 22:
|
|
1118
|
+
throw e.prev = 22, e.t1 = e["catch"](15), new T("Invalid JSON response from the Stytch servers.");
|
|
1119
|
+
case 25:
|
|
1120
|
+
if (200 === l.status || !(null === (t = l.headers.get("content-type")) || void 0 === t ? void 0 : t.includes("application/json"))) {
|
|
1121
|
+
e.next = 38;
|
|
653
1122
|
break;
|
|
654
1123
|
}
|
|
655
|
-
|
|
656
|
-
case
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
1124
|
+
return e.prev = 26, e.next = 29, l.json();
|
|
1125
|
+
case 29:
|
|
1126
|
+
h = e.sent, e.next = 35;
|
|
1127
|
+
break;
|
|
1128
|
+
case 32:
|
|
1129
|
+
throw e.prev = 32, e.t2 = e["catch"](26), new T("Invalid or no response from server");
|
|
1130
|
+
case 35:
|
|
1131
|
+
if (!("body" in h || "params" in h || "query" in h)) {
|
|
1132
|
+
e.next = 37;
|
|
661
1133
|
break;
|
|
662
1134
|
}
|
|
663
|
-
|
|
664
|
-
case 31:
|
|
665
|
-
p = e.sent, e.next = 37;
|
|
666
|
-
break;
|
|
667
|
-
case 34:
|
|
668
|
-
throw e.prev = 34, e.t2 = e["catch"](28), new P(r, "Invalid or no response from server");
|
|
1135
|
+
throw new O(h);
|
|
669
1136
|
case 37:
|
|
670
|
-
|
|
671
|
-
|
|
1137
|
+
throw new E(h);
|
|
1138
|
+
case 38:
|
|
1139
|
+
return e.prev = 38, e.next = 41, l.text();
|
|
1140
|
+
case 41:
|
|
1141
|
+
p = e.sent, e.next = 47;
|
|
1142
|
+
break;
|
|
1143
|
+
case 44:
|
|
1144
|
+
throw e.prev = 44, e.t3 = e["catch"](38), new T("Invalid response from the Stytch servers.");
|
|
1145
|
+
case 47:
|
|
1146
|
+
if (!p.includes("Captcha required")) {
|
|
1147
|
+
e.next = 49;
|
|
672
1148
|
break;
|
|
673
1149
|
}
|
|
674
|
-
throw new
|
|
675
|
-
case
|
|
676
|
-
throw new
|
|
677
|
-
case 40:
|
|
678
|
-
return e.prev = 40, e.next = 43, d.json();
|
|
679
|
-
case 43:
|
|
680
|
-
return _ = e.sent, e.abrupt("return", _.data);
|
|
681
|
-
case 47:
|
|
682
|
-
throw e.prev = 47, e.t3 = e["catch"](40), new P(r, "Invalid response from the Stytch servers.");
|
|
1150
|
+
throw new Pe(ke.RequiredCatcha);
|
|
1151
|
+
case 49:
|
|
1152
|
+
throw new T("Invalid response from the Stytch servers.");
|
|
683
1153
|
case 50:
|
|
684
1154
|
case "end":
|
|
685
1155
|
return e.stop();
|
|
686
1156
|
}
|
|
687
|
-
}, e, null, [[3, 9], [15,
|
|
1157
|
+
}, e, null, [[3, 9], [15, 22], [26, 32], [38, 44]]);
|
|
688
1158
|
}));
|
|
689
1159
|
}
|
|
690
|
-
var
|
|
691
|
-
function
|
|
692
|
-
if (!
|
|
693
|
-
return
|
|
1160
|
+
var Ce = new Uint8Array(16);
|
|
1161
|
+
function Te() {
|
|
1162
|
+
if (!Se && !(Se = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1163
|
+
return Se(Ce);
|
|
694
1164
|
}
|
|
695
|
-
var
|
|
696
|
-
for (var
|
|
697
|
-
function
|
|
1165
|
+
var Oe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1166
|
+
for (var Ee = [], xe = 0; xe < 256; ++xe) Ee.push((xe + 256).toString(16).substr(1));
|
|
1167
|
+
function De(e) {
|
|
698
1168
|
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
|
|
699
|
-
r = (
|
|
1169
|
+
r = (Ee[e[t + 0]] + Ee[e[t + 1]] + Ee[e[t + 2]] + Ee[e[t + 3]] + "-" + Ee[e[t + 4]] + Ee[e[t + 5]] + "-" + Ee[e[t + 6]] + Ee[e[t + 7]] + "-" + Ee[e[t + 8]] + Ee[e[t + 9]] + "-" + Ee[e[t + 10]] + Ee[e[t + 11]] + Ee[e[t + 12]] + Ee[e[t + 13]] + Ee[e[t + 14]] + Ee[e[t + 15]]).toLowerCase();
|
|
700
1170
|
if (!function (e) {
|
|
701
|
-
return "string" == typeof e &&
|
|
1171
|
+
return "string" == typeof e && Oe.test(e);
|
|
702
1172
|
}(r)) throw TypeError("Stringified UUID is invalid");
|
|
703
1173
|
return r;
|
|
704
1174
|
}
|
|
705
|
-
function
|
|
706
|
-
var n = (e = e || {}).random || (e.rng ||
|
|
1175
|
+
function Re(e, t, r) {
|
|
1176
|
+
var n = (e = e || {}).random || (e.rng || Te)();
|
|
707
1177
|
if (n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, t) {
|
|
708
1178
|
r = r || 0;
|
|
709
1179
|
for (var i = 0; i < 16; ++i) t[r + i] = n[i];
|
|
710
1180
|
return t;
|
|
711
1181
|
}
|
|
712
|
-
return
|
|
1182
|
+
return De(n);
|
|
713
1183
|
}
|
|
714
|
-
var
|
|
715
|
-
function
|
|
716
|
-
return
|
|
717
|
-
return
|
|
1184
|
+
var Ie = {};
|
|
1185
|
+
function Be(e, t) {
|
|
1186
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1187
|
+
return de().wrap(function (r) {
|
|
718
1188
|
for (;;) switch (r.prev = r.next) {
|
|
719
1189
|
case 0:
|
|
720
|
-
if (void 0 ===
|
|
1190
|
+
if (void 0 === Ie[e]) {
|
|
721
1191
|
r.next = 2;
|
|
722
1192
|
break;
|
|
723
1193
|
}
|
|
724
|
-
return r.abrupt("return",
|
|
1194
|
+
return r.abrupt("return", Ie[e]);
|
|
725
1195
|
case 2:
|
|
726
|
-
return
|
|
1196
|
+
return Ie[e] = Le(e, t), r.abrupt("return", Ie[e]);
|
|
727
1197
|
case 4:
|
|
728
1198
|
case "end":
|
|
729
1199
|
return r.stop();
|
|
@@ -731,10 +1201,10 @@ function G(e, t) {
|
|
|
731
1201
|
}, r);
|
|
732
1202
|
}));
|
|
733
1203
|
}
|
|
734
|
-
function
|
|
1204
|
+
function Le(e, t) {
|
|
735
1205
|
return new Promise(function (r, n) {
|
|
736
1206
|
var i = function (e) {
|
|
737
|
-
var t =
|
|
1207
|
+
var t = Me(e);
|
|
738
1208
|
if (t[0]) return t[0];
|
|
739
1209
|
}(e);
|
|
740
1210
|
if (i && "true" === i.dataset.loaded) try {
|
|
@@ -758,130 +1228,130 @@ function H(e, t) {
|
|
|
758
1228
|
});
|
|
759
1229
|
});
|
|
760
1230
|
}
|
|
761
|
-
var
|
|
1231
|
+
var Me = function Me(e) {
|
|
762
1232
|
return document.querySelectorAll('script[src="'.concat(e, '"]'));
|
|
763
1233
|
};
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
1234
|
+
var je,
|
|
1235
|
+
Fe = ["[Stytch]"],
|
|
1236
|
+
Ne = function Ne() {
|
|
767
1237
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
768
|
-
return (e = console).warn.apply(e,
|
|
1238
|
+
return (e = console).warn.apply(e, Fe.concat(r));
|
|
769
1239
|
},
|
|
770
|
-
|
|
1240
|
+
Ke = function Ke() {
|
|
771
1241
|
for (var e, t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n];
|
|
772
|
-
return (e = console).error.apply(e,
|
|
1242
|
+
return (e = console).error.apply(e, Fe.concat(r));
|
|
773
1243
|
},
|
|
774
|
-
|
|
775
|
-
|
|
1244
|
+
Ue = "\nYou can find your public token at https://stytch.com/dashboard/api-keys.",
|
|
1245
|
+
ze = function ze(e) {
|
|
776
1246
|
return e.includes("public-token-test");
|
|
777
1247
|
},
|
|
778
|
-
|
|
779
|
-
var
|
|
780
|
-
isObject: function isObject(
|
|
781
|
-
var
|
|
782
|
-
if (!
|
|
783
|
-
return
|
|
1248
|
+
qe = function qe(e) {
|
|
1249
|
+
var t = {
|
|
1250
|
+
isObject: function isObject(r, n) {
|
|
1251
|
+
var i = "object" === le(n) && !Array.isArray(n) && null !== n;
|
|
1252
|
+
if (!i) throw new w(e, r + " must be an object.");
|
|
1253
|
+
return t;
|
|
784
1254
|
},
|
|
785
|
-
isOptionalObject: function isOptionalObject(e,
|
|
786
|
-
return void 0 ===
|
|
1255
|
+
isOptionalObject: function isOptionalObject(e, r) {
|
|
1256
|
+
return void 0 === r ? t : t.isObject(e, r);
|
|
787
1257
|
},
|
|
788
|
-
isString: function isString(
|
|
789
|
-
if ("string" != typeof n) throw new
|
|
790
|
-
return
|
|
1258
|
+
isString: function isString(r, n) {
|
|
1259
|
+
if ("string" != typeof n) throw new w(e, r + " must be a string.");
|
|
1260
|
+
return t;
|
|
791
1261
|
},
|
|
792
|
-
isOptionalString: function isOptionalString(e,
|
|
793
|
-
return void 0 ===
|
|
1262
|
+
isOptionalString: function isOptionalString(e, r) {
|
|
1263
|
+
return void 0 === r ? t : t.isString(e, r);
|
|
794
1264
|
},
|
|
795
|
-
isStringArray: function isStringArray(
|
|
796
|
-
if (!Array.isArray(
|
|
797
|
-
var
|
|
798
|
-
|
|
799
|
-
var
|
|
800
|
-
if (!
|
|
801
|
-
if (Array.isArray(e) || (
|
|
802
|
-
|
|
803
|
-
var
|
|
804
|
-
|
|
1265
|
+
isStringArray: function isStringArray(r, n) {
|
|
1266
|
+
if (!Array.isArray(n)) throw new w(e, r + " must be an array of strings.");
|
|
1267
|
+
var i,
|
|
1268
|
+
o = function (e, t) {
|
|
1269
|
+
var r = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1270
|
+
if (!r) {
|
|
1271
|
+
if (Array.isArray(e) || (r = ce(e)) || t && e && "number" == typeof e.length) {
|
|
1272
|
+
r && (e = r);
|
|
1273
|
+
var _n = 0,
|
|
1274
|
+
i = function i() {};
|
|
805
1275
|
return {
|
|
806
|
-
s:
|
|
1276
|
+
s: i,
|
|
807
1277
|
n: function n() {
|
|
808
|
-
return
|
|
1278
|
+
return _n >= e.length ? {
|
|
809
1279
|
done: !0
|
|
810
1280
|
} : {
|
|
811
1281
|
done: !1,
|
|
812
|
-
value: e[
|
|
1282
|
+
value: e[_n++]
|
|
813
1283
|
};
|
|
814
1284
|
},
|
|
815
1285
|
e: function e(_e2) {
|
|
816
1286
|
throw _e2;
|
|
817
1287
|
},
|
|
818
|
-
f:
|
|
1288
|
+
f: i
|
|
819
1289
|
};
|
|
820
1290
|
}
|
|
821
1291
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
822
1292
|
}
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
1293
|
+
var o,
|
|
1294
|
+
s = !0,
|
|
1295
|
+
a = !1;
|
|
826
1296
|
return {
|
|
827
1297
|
s: function s() {
|
|
828
|
-
|
|
1298
|
+
r = r.call(e);
|
|
829
1299
|
},
|
|
830
1300
|
n: function n() {
|
|
831
|
-
var e =
|
|
832
|
-
return
|
|
1301
|
+
var e = r.next();
|
|
1302
|
+
return s = e.done, e;
|
|
833
1303
|
},
|
|
834
1304
|
e: function e(_e3) {
|
|
835
|
-
|
|
1305
|
+
a = !0, o = _e3;
|
|
836
1306
|
},
|
|
837
1307
|
f: function f() {
|
|
838
1308
|
try {
|
|
839
|
-
|
|
1309
|
+
s || null == r["return"] || r["return"]();
|
|
840
1310
|
} finally {
|
|
841
|
-
if (
|
|
1311
|
+
if (a) throw o;
|
|
842
1312
|
}
|
|
843
1313
|
}
|
|
844
1314
|
};
|
|
845
|
-
}(
|
|
1315
|
+
}(n);
|
|
846
1316
|
try {
|
|
847
|
-
for (
|
|
848
|
-
if ("string" != typeof
|
|
1317
|
+
for (o.s(); !(i = o.n()).done;) {
|
|
1318
|
+
if ("string" != typeof i.value) throw new w(e, r + " must be an array of strings.");
|
|
849
1319
|
}
|
|
850
1320
|
} catch (e) {
|
|
851
|
-
|
|
1321
|
+
o.e(e);
|
|
852
1322
|
} finally {
|
|
853
|
-
|
|
1323
|
+
o.f();
|
|
854
1324
|
}
|
|
855
|
-
return
|
|
1325
|
+
return t;
|
|
856
1326
|
},
|
|
857
|
-
isOptionalStringArray: function isOptionalStringArray(e,
|
|
858
|
-
return void 0 ===
|
|
1327
|
+
isOptionalStringArray: function isOptionalStringArray(e, r) {
|
|
1328
|
+
return void 0 === r ? t : t.isStringArray(e, r);
|
|
859
1329
|
},
|
|
860
|
-
isNumber: function isNumber(
|
|
861
|
-
if ("number" != typeof n) throw new
|
|
862
|
-
return
|
|
1330
|
+
isNumber: function isNumber(r, n) {
|
|
1331
|
+
if ("number" != typeof n) throw new w(e, r + " must be a number.");
|
|
1332
|
+
return t;
|
|
863
1333
|
},
|
|
864
|
-
isOptionalNumber: function isOptionalNumber(e,
|
|
865
|
-
return void 0 ===
|
|
1334
|
+
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
1335
|
+
return void 0 === r ? t : t.isNumber(e, r);
|
|
866
1336
|
},
|
|
867
|
-
isBoolean: function isBoolean(
|
|
868
|
-
if ("boolean" != typeof n) throw new
|
|
869
|
-
return
|
|
1337
|
+
isBoolean: function isBoolean(r, n) {
|
|
1338
|
+
if ("boolean" != typeof n) throw new w(e, r + " must be a boolean.");
|
|
1339
|
+
return t;
|
|
870
1340
|
},
|
|
871
|
-
isOptionalBoolean: function isOptionalBoolean(e,
|
|
872
|
-
return void 0 ===
|
|
1341
|
+
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
1342
|
+
return void 0 === r ? t : t.isBoolean(e, r);
|
|
873
1343
|
}
|
|
874
1344
|
};
|
|
875
|
-
return
|
|
1345
|
+
return t;
|
|
876
1346
|
},
|
|
877
|
-
|
|
878
|
-
var
|
|
879
|
-
|
|
1347
|
+
We = pe(function e(t, r, n) {
|
|
1348
|
+
var i = this,
|
|
1349
|
+
o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function () {
|
|
880
1350
|
return Promise.resolve(void 0);
|
|
881
1351
|
};
|
|
882
|
-
|
|
883
|
-
return
|
|
884
|
-
return
|
|
1352
|
+
_e(this, e), this.bootstrapPromise = n, this.isEnabled = function () {
|
|
1353
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1354
|
+
return de().wrap(function (e) {
|
|
885
1355
|
for (;;) switch (e.prev = e.next) {
|
|
886
1356
|
case 0:
|
|
887
1357
|
return e.abrupt("return", this.state.then(function (e) {
|
|
@@ -894,20 +1364,20 @@ var Y,
|
|
|
894
1364
|
}, e, this);
|
|
895
1365
|
}));
|
|
896
1366
|
}, this.getTelemetryID = function () {
|
|
897
|
-
return
|
|
898
|
-
var t, r, n,
|
|
899
|
-
return
|
|
1367
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1368
|
+
var t, r, n, i;
|
|
1369
|
+
return de().wrap(function (e) {
|
|
900
1370
|
for (;;) switch (e.prev = e.next) {
|
|
901
1371
|
case 0:
|
|
902
1372
|
return e.next = 2, this.state;
|
|
903
1373
|
case 2:
|
|
904
|
-
if (t = e.sent, r = t.publicToken, n = t.enabled,
|
|
1374
|
+
if (t = e.sent, r = t.publicToken, n = t.enabled, i = t.dfpBackendURL, n) {
|
|
905
1375
|
e.next = 8;
|
|
906
1376
|
break;
|
|
907
1377
|
}
|
|
908
1378
|
return e.abrupt("return", void 0);
|
|
909
1379
|
case 8:
|
|
910
|
-
return e.next = 10, window.GetTelemetryID(r, "".concat(
|
|
1380
|
+
return e.next = 10, window.GetTelemetryID(r, "".concat(i, "/submit"));
|
|
911
1381
|
case 10:
|
|
912
1382
|
return e.abrupt("return", e.sent);
|
|
913
1383
|
case 11:
|
|
@@ -917,43 +1387,43 @@ var Y,
|
|
|
917
1387
|
}, e, this);
|
|
918
1388
|
}));
|
|
919
1389
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
920
|
-
return
|
|
921
|
-
var t, r, n, o, s
|
|
922
|
-
return
|
|
1390
|
+
return we(i, void 0, void 0, de().mark(function e() {
|
|
1391
|
+
var t, r, n, i, o, s;
|
|
1392
|
+
return de().wrap(function (e) {
|
|
923
1393
|
for (;;) switch (e.prev = e.next) {
|
|
924
1394
|
case 0:
|
|
925
1395
|
return e.next = 2, this.state;
|
|
926
1396
|
case 2:
|
|
927
|
-
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha,
|
|
1397
|
+
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = t.mode, o = void 0, s = void 0, r) {
|
|
928
1398
|
e.next = 12;
|
|
929
1399
|
break;
|
|
930
1400
|
}
|
|
931
1401
|
return e.next = 11, n();
|
|
932
1402
|
case 11:
|
|
933
|
-
|
|
1403
|
+
s = e.sent;
|
|
934
1404
|
case 12:
|
|
935
|
-
if ("DECISIONING" !==
|
|
1405
|
+
if ("DECISIONING" !== i) {
|
|
936
1406
|
e.next = 18;
|
|
937
1407
|
break;
|
|
938
1408
|
}
|
|
939
1409
|
return e.next = 15, this.getTelemetryID();
|
|
940
1410
|
case 15:
|
|
941
|
-
|
|
1411
|
+
o = e.sent, e.next = 25;
|
|
942
1412
|
break;
|
|
943
1413
|
case 18:
|
|
944
|
-
if ("OBSERVATION" !==
|
|
1414
|
+
if ("OBSERVATION" !== i) {
|
|
945
1415
|
e.next = 25;
|
|
946
1416
|
break;
|
|
947
1417
|
}
|
|
948
1418
|
return e.next = 21, this.getTelemetryID();
|
|
949
1419
|
case 21:
|
|
950
|
-
return
|
|
1420
|
+
return o = e.sent, e.next = 24, n();
|
|
951
1421
|
case 24:
|
|
952
|
-
|
|
1422
|
+
s = e.sent;
|
|
953
1423
|
case 25:
|
|
954
1424
|
return e.abrupt("return", {
|
|
955
|
-
dfp_telemetry_id:
|
|
956
|
-
captcha_token:
|
|
1425
|
+
dfp_telemetry_id: o,
|
|
1426
|
+
captcha_token: s
|
|
957
1427
|
});
|
|
958
1428
|
case 26:
|
|
959
1429
|
case "end":
|
|
@@ -962,14 +1432,14 @@ var Y,
|
|
|
962
1432
|
}, e, this);
|
|
963
1433
|
}));
|
|
964
1434
|
}, this.retryWithCaptchaAndDFP = function (e, t) {
|
|
965
|
-
return
|
|
966
|
-
var n,
|
|
967
|
-
return
|
|
1435
|
+
return we(i, void 0, void 0, de().mark(function r() {
|
|
1436
|
+
var n, i, o;
|
|
1437
|
+
return de().wrap(function (r) {
|
|
968
1438
|
for (;;) switch (r.prev = r.next) {
|
|
969
1439
|
case 0:
|
|
970
1440
|
return r.next = 2, this.state;
|
|
971
1441
|
case 2:
|
|
972
|
-
if (n = r.sent,
|
|
1442
|
+
if (n = r.sent, i = n.enabled, o = n.executeRecaptcha, e.type !== ke.RequiredCatcha || !i) {
|
|
973
1443
|
r.next = 14;
|
|
974
1444
|
break;
|
|
975
1445
|
}
|
|
@@ -979,7 +1449,7 @@ var Y,
|
|
|
979
1449
|
}
|
|
980
1450
|
return r.next = 9, this.getTelemetryID();
|
|
981
1451
|
case 9:
|
|
982
|
-
return t.body.dfp_telemetry_id = r.sent, r.next = 12,
|
|
1452
|
+
return t.body.dfp_telemetry_id = r.sent, r.next = 12, o();
|
|
983
1453
|
case 12:
|
|
984
1454
|
t.body.captcha_token = r.sent;
|
|
985
1455
|
case 13:
|
|
@@ -993,8 +1463,8 @@ var Y,
|
|
|
993
1463
|
}, r, this);
|
|
994
1464
|
}));
|
|
995
1465
|
}, this.state = n.then(function (e) {
|
|
996
|
-
return
|
|
997
|
-
return
|
|
1466
|
+
return we(i, void 0, void 0, de().mark(function n() {
|
|
1467
|
+
return de().wrap(function (n) {
|
|
998
1468
|
for (;;) switch (n.prev = n.next) {
|
|
999
1469
|
case 0:
|
|
1000
1470
|
if (e.runDFPProtectedAuth) {
|
|
@@ -1006,10 +1476,10 @@ var Y,
|
|
|
1006
1476
|
dfpBackendURL: r,
|
|
1007
1477
|
enabled: !1,
|
|
1008
1478
|
loaded: !1,
|
|
1009
|
-
executeRecaptcha:
|
|
1479
|
+
executeRecaptcha: o
|
|
1010
1480
|
});
|
|
1011
1481
|
case 2:
|
|
1012
|
-
return n.next = 4, void
|
|
1482
|
+
return n.next = 4, void Be("".concat("https://elements.stytch.com", "/telemetry.js"), function () {
|
|
1013
1483
|
return window;
|
|
1014
1484
|
});
|
|
1015
1485
|
case 4:
|
|
@@ -1019,7 +1489,7 @@ var Y,
|
|
|
1019
1489
|
enabled: !0,
|
|
1020
1490
|
mode: e.dfpProtectedAuthMode || "OBSERVATION",
|
|
1021
1491
|
loaded: !0,
|
|
1022
|
-
executeRecaptcha:
|
|
1492
|
+
executeRecaptcha: o
|
|
1023
1493
|
});
|
|
1024
1494
|
case 5:
|
|
1025
1495
|
case "end":
|
|
@@ -1029,11 +1499,11 @@ var Y,
|
|
|
1029
1499
|
}));
|
|
1030
1500
|
});
|
|
1031
1501
|
}),
|
|
1032
|
-
|
|
1502
|
+
Ge = function Ge() {
|
|
1033
1503
|
return {
|
|
1034
1504
|
isEnabled: function isEnabled() {
|
|
1035
|
-
return
|
|
1036
|
-
return
|
|
1505
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1506
|
+
return de().wrap(function (e) {
|
|
1037
1507
|
for (;;) switch (e.prev = e.next) {
|
|
1038
1508
|
case 0:
|
|
1039
1509
|
return e.abrupt("return", !1);
|
|
@@ -1045,8 +1515,8 @@ var Y,
|
|
|
1045
1515
|
}));
|
|
1046
1516
|
},
|
|
1047
1517
|
getTelemetryID: function getTelemetryID() {
|
|
1048
|
-
return
|
|
1049
|
-
return
|
|
1518
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1519
|
+
return de().wrap(function (e) {
|
|
1050
1520
|
for (;;) switch (e.prev = e.next) {
|
|
1051
1521
|
case 0:
|
|
1052
1522
|
return e.abrupt("return", void 0);
|
|
@@ -1058,8 +1528,8 @@ var Y,
|
|
|
1058
1528
|
}));
|
|
1059
1529
|
},
|
|
1060
1530
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
1061
|
-
return
|
|
1062
|
-
return
|
|
1531
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1532
|
+
return de().wrap(function (e) {
|
|
1063
1533
|
for (;;) switch (e.prev = e.next) {
|
|
1064
1534
|
case 0:
|
|
1065
1535
|
return e.abrupt("return", {
|
|
@@ -1074,8 +1544,8 @@ var Y,
|
|
|
1074
1544
|
}));
|
|
1075
1545
|
},
|
|
1076
1546
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
1077
|
-
return
|
|
1078
|
-
return
|
|
1547
|
+
return we(void 0, void 0, void 0, de().mark(function e() {
|
|
1548
|
+
return de().wrap(function (e) {
|
|
1079
1549
|
for (;;) switch (e.prev = e.next) {
|
|
1080
1550
|
case 0:
|
|
1081
1551
|
throw new Error("DFP protected auth is disabled");
|
|
@@ -1088,11 +1558,11 @@ var Y,
|
|
|
1088
1558
|
}
|
|
1089
1559
|
};
|
|
1090
1560
|
},
|
|
1091
|
-
|
|
1561
|
+
He = function () {
|
|
1092
1562
|
function e(t) {
|
|
1093
|
-
|
|
1563
|
+
_e(this, e), this.maxBatchSize = t.maxBatchSize, this.logEventURL = t.logEventURL, setInterval(this.flush.bind(this), t.intervalDurationMs), this.batch = [];
|
|
1094
1564
|
}
|
|
1095
|
-
return
|
|
1565
|
+
return pe(e, [{
|
|
1096
1566
|
key: "logEvent",
|
|
1097
1567
|
value: function value(e, t) {
|
|
1098
1568
|
this.batch.push({
|
|
@@ -1103,9 +1573,9 @@ var Y,
|
|
|
1103
1573
|
}, {
|
|
1104
1574
|
key: "flush",
|
|
1105
1575
|
value: function value() {
|
|
1106
|
-
return
|
|
1576
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1107
1577
|
var t;
|
|
1108
|
-
return
|
|
1578
|
+
return de().wrap(function (e) {
|
|
1109
1579
|
for (;;) switch (e.prev = e.next) {
|
|
1110
1580
|
case 0:
|
|
1111
1581
|
if (this.batch.length) {
|
|
@@ -1137,27 +1607,45 @@ var Y,
|
|
|
1137
1607
|
}();
|
|
1138
1608
|
!function (e) {
|
|
1139
1609
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
1140
|
-
}(
|
|
1610
|
+
}(je || (je = {})), Promise.resolve({
|
|
1141
1611
|
pkceRequiredForEmailMagicLinks: !1
|
|
1142
1612
|
}), Promise.resolve({
|
|
1143
1613
|
pkceRequiredForPasswordResets: !1
|
|
1144
1614
|
});
|
|
1145
|
-
var
|
|
1615
|
+
var Ye = Promise.resolve({
|
|
1146
1616
|
pkceRequiredForEmailMagicLinks: !1
|
|
1147
1617
|
}),
|
|
1148
|
-
|
|
1149
|
-
function e(t, r, n,
|
|
1150
|
-
var
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1618
|
+
Ve = function () {
|
|
1619
|
+
function e(t, r, n, i) {
|
|
1620
|
+
var o = this,
|
|
1621
|
+
s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : Ye,
|
|
1622
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1623
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._passwordResetPKCEManager = i, this._config = s, this.dfpProtectedAuth = a, this.email = {
|
|
1624
|
+
invite: function invite(e) {
|
|
1625
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1626
|
+
return de().wrap(function (t) {
|
|
1627
|
+
for (;;) switch (t.prev = t.next) {
|
|
1628
|
+
case 0:
|
|
1629
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isOptionalString("invite_redirect_url", e.invite_redirect_url).isOptionalString("invite_template_id", e.invite_template_id).isOptionalString("name", e.name).isOptionalString("locale", e.locale).isOptionalStringArray("roles", e.roles), t.abrupt("return", this._networkClient.fetchSDK({
|
|
1630
|
+
url: "/b2b/magic_links/email/invite",
|
|
1631
|
+
body: e,
|
|
1632
|
+
errorMessage: "Failed to send invite.",
|
|
1633
|
+
method: "POST"
|
|
1634
|
+
}));
|
|
1635
|
+
case 2:
|
|
1636
|
+
case "end":
|
|
1637
|
+
return t.stop();
|
|
1638
|
+
}
|
|
1639
|
+
}, t, this);
|
|
1640
|
+
}));
|
|
1641
|
+
},
|
|
1154
1642
|
loginOrSignup: function loginOrSignup(e) {
|
|
1155
|
-
return
|
|
1643
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1156
1644
|
var r, n;
|
|
1157
|
-
return
|
|
1645
|
+
return de().wrap(function (t) {
|
|
1158
1646
|
for (;;) switch (t.prev = t.next) {
|
|
1159
1647
|
case 0:
|
|
1160
|
-
return
|
|
1648
|
+
return qe("stytch.magicLinks.email.loginOrSignup").isString("email_address", e.email_address).isString("organization_id", e.organization_id).isOptionalString("login_redirect_url", e.login_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("signup_redirect_url", e.signup_redirect_url).isOptionalString("signup_template_id", e.signup_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1161
1649
|
case 3:
|
|
1162
1650
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1163
1651
|
pkce_code_challenge: r
|
|
@@ -1176,12 +1664,12 @@ var ne = Promise.resolve({
|
|
|
1176
1664
|
},
|
|
1177
1665
|
discovery: {
|
|
1178
1666
|
send: function send(e) {
|
|
1179
|
-
return
|
|
1667
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1180
1668
|
var r, n;
|
|
1181
|
-
return
|
|
1669
|
+
return de().wrap(function (t) {
|
|
1182
1670
|
for (;;) switch (t.prev = t.next) {
|
|
1183
1671
|
case 0:
|
|
1184
|
-
return
|
|
1672
|
+
return qe("stytch.magicLinks.email.discovery.send").isString("email_address", e.email_address).isOptionalString("discovery_redirect_url", e.discovery_redirect_url).isOptionalString("login_template_id", e.login_template_id).isOptionalString("locale", e.locale), t.next = 3, this.getCodeChallenge();
|
|
1185
1673
|
case 3:
|
|
1186
1674
|
return r = t.sent, n = Object.assign(Object.assign({}, e), {
|
|
1187
1675
|
pkce_code_challenge: r
|
|
@@ -1200,12 +1688,12 @@ var ne = Promise.resolve({
|
|
|
1200
1688
|
}
|
|
1201
1689
|
}
|
|
1202
1690
|
}, this.authenticate = function (e) {
|
|
1203
|
-
return
|
|
1691
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1204
1692
|
var r, n;
|
|
1205
|
-
return
|
|
1693
|
+
return de().wrap(function (t) {
|
|
1206
1694
|
for (;;) switch (t.prev = t.next) {
|
|
1207
1695
|
case 0:
|
|
1208
|
-
return
|
|
1696
|
+
return qe("stytch.magicLinks.authenticate").isString("magic_links_token", e.magic_links_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._passwordResetPKCEManager.getPKPair();
|
|
1209
1697
|
case 3:
|
|
1210
1698
|
if (r = t.sent, n = null, !(null == r ? void 0 : r.code_verifier)) {
|
|
1211
1699
|
t.next = 19;
|
|
@@ -1255,33 +1743,33 @@ var ne = Promise.resolve({
|
|
|
1255
1743
|
}));
|
|
1256
1744
|
}, this.discovery = {
|
|
1257
1745
|
authenticate: function authenticate(e) {
|
|
1258
|
-
return
|
|
1259
|
-
var r, n, o, s, a
|
|
1260
|
-
return
|
|
1746
|
+
return we(o, void 0, void 0, de().mark(function t() {
|
|
1747
|
+
var r, n, i, o, s, a;
|
|
1748
|
+
return de().wrap(function (t) {
|
|
1261
1749
|
for (;;) switch (t.prev = t.next) {
|
|
1262
1750
|
case 0:
|
|
1263
|
-
return
|
|
1751
|
+
return qe("stytch.magicLinks.discovery.authenticate").isString("discovery_magic_links_token", e.discovery_magic_links_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1264
1752
|
case 3:
|
|
1265
1753
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1266
1754
|
case 6:
|
|
1267
|
-
return n = t.sent,
|
|
1755
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
|
|
1268
1756
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1269
|
-
dfp_telemetry_id:
|
|
1270
|
-
captcha_token:
|
|
1757
|
+
dfp_telemetry_id: i,
|
|
1758
|
+
captcha_token: o
|
|
1271
1759
|
}, e), t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1272
1760
|
url: "/b2b/magic_links/discovery/authenticate",
|
|
1273
|
-
body:
|
|
1761
|
+
body: s,
|
|
1274
1762
|
errorMessage: "Failed to authenticate intermediate magic link token",
|
|
1275
1763
|
method: "POST",
|
|
1276
1764
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1277
1765
|
});
|
|
1278
1766
|
case 12:
|
|
1279
|
-
return
|
|
1767
|
+
return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1280
1768
|
state: null,
|
|
1281
1769
|
session_token: null,
|
|
1282
1770
|
session_jwt: null,
|
|
1283
|
-
intermediate_session_token:
|
|
1284
|
-
}), t.abrupt("return",
|
|
1771
|
+
intermediate_session_token: a.intermediate_session_token
|
|
1772
|
+
}), t.abrupt("return", a);
|
|
1285
1773
|
case 16:
|
|
1286
1774
|
case "end":
|
|
1287
1775
|
return t.stop();
|
|
@@ -1291,12 +1779,12 @@ var ne = Promise.resolve({
|
|
|
1291
1779
|
}
|
|
1292
1780
|
};
|
|
1293
1781
|
}
|
|
1294
|
-
return
|
|
1782
|
+
return pe(e, [{
|
|
1295
1783
|
key: "getCodeChallenge",
|
|
1296
1784
|
value: function value() {
|
|
1297
|
-
return
|
|
1785
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1298
1786
|
var t, r;
|
|
1299
|
-
return
|
|
1787
|
+
return de().wrap(function (e) {
|
|
1300
1788
|
for (;;) switch (e.prev = e.next) {
|
|
1301
1789
|
case 0:
|
|
1302
1790
|
return e.next = 2, this._config;
|
|
@@ -1328,28 +1816,28 @@ var ne = Promise.resolve({
|
|
|
1328
1816
|
}, {
|
|
1329
1817
|
key: "handlePKCEForAuthenticate",
|
|
1330
1818
|
value: function value(e, t) {
|
|
1331
|
-
return
|
|
1332
|
-
var n, o, s, a, c
|
|
1333
|
-
return
|
|
1819
|
+
return we(this, void 0, void 0, de().mark(function r() {
|
|
1820
|
+
var n, i, o, s, a, c;
|
|
1821
|
+
return de().wrap(function (r) {
|
|
1334
1822
|
for (;;) switch (r.prev = r.next) {
|
|
1335
1823
|
case 0:
|
|
1336
1824
|
return r.next = 2, e.getPKPair();
|
|
1337
1825
|
case 2:
|
|
1338
1826
|
return n = r.sent, r.next = 5, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1339
1827
|
case 5:
|
|
1340
|
-
return
|
|
1828
|
+
return i = r.sent, o = i.dfp_telemetry_id, s = i.captcha_token, a = Object.assign({
|
|
1341
1829
|
pkce_code_verifier: null == n ? void 0 : n.code_verifier,
|
|
1342
|
-
dfp_telemetry_id:
|
|
1343
|
-
captcha_token:
|
|
1830
|
+
dfp_telemetry_id: o,
|
|
1831
|
+
captcha_token: s
|
|
1344
1832
|
}, t), r.next = 11, this._networkClient.retriableFetchSDK({
|
|
1345
1833
|
url: "/b2b/magic_links/authenticate",
|
|
1346
|
-
body:
|
|
1834
|
+
body: a,
|
|
1347
1835
|
errorMessage: "Failed to authenticate token",
|
|
1348
1836
|
method: "POST",
|
|
1349
1837
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1350
1838
|
});
|
|
1351
1839
|
case 11:
|
|
1352
|
-
return
|
|
1840
|
+
return c = r.sent, e.clearPKPair(), r.abrupt("return", c);
|
|
1353
1841
|
case 14:
|
|
1354
1842
|
case "end":
|
|
1355
1843
|
return r.stop();
|
|
@@ -1359,12 +1847,12 @@ var ne = Promise.resolve({
|
|
|
1359
1847
|
}
|
|
1360
1848
|
}]), e;
|
|
1361
1849
|
}(),
|
|
1362
|
-
|
|
1850
|
+
Je = pe(function e(t, r) {
|
|
1363
1851
|
var n = this;
|
|
1364
|
-
|
|
1365
|
-
return
|
|
1852
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1853
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1366
1854
|
var t;
|
|
1367
|
-
return
|
|
1855
|
+
return de().wrap(function (e) {
|
|
1368
1856
|
for (;;) switch (e.prev = e.next) {
|
|
1369
1857
|
case 0:
|
|
1370
1858
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1388,12 +1876,12 @@ var ne = Promise.resolve({
|
|
|
1388
1876
|
return e(null !== (r = null == t ? void 0 : t.member) && void 0 !== r ? r : null);
|
|
1389
1877
|
});
|
|
1390
1878
|
}, this.update = function (e) {
|
|
1391
|
-
return
|
|
1879
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1392
1880
|
var r;
|
|
1393
|
-
return
|
|
1881
|
+
return de().wrap(function (t) {
|
|
1394
1882
|
for (;;) switch (t.prev = t.next) {
|
|
1395
1883
|
case 0:
|
|
1396
|
-
return
|
|
1884
|
+
return qe("stytch.self.update").isOptionalString("name", e.name).isOptionalObject("untrusted_metadata", e.untrusted_metadata).isOptionalBoolean("mfa_enrolled", e.mfa_enrolled).isOptionalString("mfa_phone_number", e.mfa_phone_number), t.next = 3, this._networkClient.fetchSDK({
|
|
1397
1885
|
url: "/b2b/organizations/members/update",
|
|
1398
1886
|
body: e,
|
|
1399
1887
|
errorMessage: "Failed to update member.",
|
|
@@ -1408,9 +1896,9 @@ var ne = Promise.resolve({
|
|
|
1408
1896
|
}, t, this);
|
|
1409
1897
|
}));
|
|
1410
1898
|
}, this.deleteMFAPhoneNumber = function () {
|
|
1411
|
-
return
|
|
1899
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
1412
1900
|
var t;
|
|
1413
|
-
return
|
|
1901
|
+
return de().wrap(function (e) {
|
|
1414
1902
|
for (;;) switch (e.prev = e.next) {
|
|
1415
1903
|
case 0:
|
|
1416
1904
|
return e.next = 2, this._networkClient.fetchSDK({
|
|
@@ -1426,52 +1914,193 @@ var ne = Promise.resolve({
|
|
|
1426
1914
|
}
|
|
1427
1915
|
}, e, this);
|
|
1428
1916
|
}));
|
|
1917
|
+
}, this.deletePassword = function (e) {
|
|
1918
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1919
|
+
var r;
|
|
1920
|
+
return de().wrap(function (t) {
|
|
1921
|
+
for (;;) switch (t.prev = t.next) {
|
|
1922
|
+
case 0:
|
|
1923
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
1924
|
+
url: "/b2b/organizations/members/passwords/".concat(e),
|
|
1925
|
+
errorMessage: "Failed to delete member password.",
|
|
1926
|
+
method: "DELETE"
|
|
1927
|
+
});
|
|
1928
|
+
case 2:
|
|
1929
|
+
return r = t.sent, this._subscriptionService.updateMember(r.member), t.abrupt("return", r);
|
|
1930
|
+
case 5:
|
|
1931
|
+
case "end":
|
|
1932
|
+
return t.stop();
|
|
1933
|
+
}
|
|
1934
|
+
}, t, this);
|
|
1935
|
+
}));
|
|
1429
1936
|
};
|
|
1430
1937
|
}),
|
|
1431
|
-
|
|
1938
|
+
$e = function () {
|
|
1432
1939
|
function e(t, r, n, i, o) {
|
|
1433
|
-
var s =
|
|
1434
|
-
|
|
1940
|
+
var s = this,
|
|
1941
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
1942
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.saml = {
|
|
1943
|
+
createConnection: function createConnection(e) {
|
|
1944
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1945
|
+
return de().wrap(function (t) {
|
|
1946
|
+
for (;;) switch (t.prev = t.next) {
|
|
1947
|
+
case 0:
|
|
1948
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
1949
|
+
url: "/b2b/sso/saml",
|
|
1950
|
+
method: "POST",
|
|
1951
|
+
body: e,
|
|
1952
|
+
errorMessage: "Failed to create SAML Connection."
|
|
1953
|
+
});
|
|
1954
|
+
case 2:
|
|
1955
|
+
return t.abrupt("return", t.sent);
|
|
1956
|
+
case 3:
|
|
1957
|
+
case "end":
|
|
1958
|
+
return t.stop();
|
|
1959
|
+
}
|
|
1960
|
+
}, t, this);
|
|
1961
|
+
}));
|
|
1962
|
+
},
|
|
1963
|
+
updateConnection: function updateConnection(e) {
|
|
1964
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1965
|
+
return de().wrap(function (t) {
|
|
1966
|
+
for (;;) switch (t.prev = t.next) {
|
|
1967
|
+
case 0:
|
|
1968
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
1969
|
+
url: "/b2b/sso/saml/".concat(e.connection_id),
|
|
1970
|
+
method: "PUT",
|
|
1971
|
+
body: e,
|
|
1972
|
+
errorMessage: "Failed to update SAML Connection."
|
|
1973
|
+
});
|
|
1974
|
+
case 2:
|
|
1975
|
+
return t.abrupt("return", t.sent);
|
|
1976
|
+
case 3:
|
|
1977
|
+
case "end":
|
|
1978
|
+
return t.stop();
|
|
1979
|
+
}
|
|
1980
|
+
}, t, this);
|
|
1981
|
+
}));
|
|
1982
|
+
},
|
|
1983
|
+
updateConnectionByURL: function updateConnectionByURL(e) {
|
|
1984
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
1985
|
+
return de().wrap(function (t) {
|
|
1986
|
+
for (;;) switch (t.prev = t.next) {
|
|
1987
|
+
case 0:
|
|
1988
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
1989
|
+
url: "/b2b/sso/saml/".concat(e.connection_id, "/url"),
|
|
1990
|
+
method: "PUT",
|
|
1991
|
+
body: e,
|
|
1992
|
+
errorMessage: "Failed to update SAML Connection."
|
|
1993
|
+
});
|
|
1994
|
+
case 2:
|
|
1995
|
+
return t.abrupt("return", t.sent);
|
|
1996
|
+
case 3:
|
|
1997
|
+
case "end":
|
|
1998
|
+
return t.stop();
|
|
1999
|
+
}
|
|
2000
|
+
}, t, this);
|
|
2001
|
+
}));
|
|
2002
|
+
},
|
|
2003
|
+
deleteVerificationCertificate: function deleteVerificationCertificate(e) {
|
|
2004
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2005
|
+
return de().wrap(function (t) {
|
|
2006
|
+
for (;;) switch (t.prev = t.next) {
|
|
2007
|
+
case 0:
|
|
2008
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
2009
|
+
url: "/b2b/sso/saml/".concat(e.connection_id, "/verification_certificates/").concat(e.certificate_id),
|
|
2010
|
+
method: "DELETE",
|
|
2011
|
+
errorMessage: "Failed to delete SAML Verification Certificate."
|
|
2012
|
+
});
|
|
2013
|
+
case 2:
|
|
2014
|
+
return t.abrupt("return", t.sent);
|
|
2015
|
+
case 3:
|
|
2016
|
+
case "end":
|
|
2017
|
+
return t.stop();
|
|
2018
|
+
}
|
|
2019
|
+
}, t, this);
|
|
2020
|
+
}));
|
|
2021
|
+
}
|
|
2022
|
+
}, this.oidc = {
|
|
2023
|
+
createConnection: function createConnection(e) {
|
|
2024
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2025
|
+
return de().wrap(function (t) {
|
|
2026
|
+
for (;;) switch (t.prev = t.next) {
|
|
2027
|
+
case 0:
|
|
2028
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
2029
|
+
url: "/b2b/sso/oidc",
|
|
2030
|
+
method: "POST",
|
|
2031
|
+
body: e,
|
|
2032
|
+
errorMessage: "Failed to create OIDC Connection."
|
|
2033
|
+
});
|
|
2034
|
+
case 2:
|
|
2035
|
+
return t.abrupt("return", t.sent);
|
|
2036
|
+
case 3:
|
|
2037
|
+
case "end":
|
|
2038
|
+
return t.stop();
|
|
2039
|
+
}
|
|
2040
|
+
}, t, this);
|
|
2041
|
+
}));
|
|
2042
|
+
},
|
|
2043
|
+
updateConnection: function updateConnection(e) {
|
|
2044
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2045
|
+
return de().wrap(function (t) {
|
|
2046
|
+
for (;;) switch (t.prev = t.next) {
|
|
2047
|
+
case 0:
|
|
2048
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
2049
|
+
url: "/b2b/sso/oidc/".concat(e.connection_id),
|
|
2050
|
+
method: "PUT",
|
|
2051
|
+
body: e,
|
|
2052
|
+
errorMessage: "Failed to update OIDC Connection."
|
|
2053
|
+
});
|
|
2054
|
+
case 2:
|
|
2055
|
+
return t.abrupt("return", t.sent);
|
|
2056
|
+
case 3:
|
|
2057
|
+
case "end":
|
|
2058
|
+
return t.stop();
|
|
2059
|
+
}
|
|
2060
|
+
}, t, this);
|
|
2061
|
+
}));
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
1435
2064
|
}
|
|
1436
|
-
return
|
|
2065
|
+
return pe(e, [{
|
|
1437
2066
|
key: "authenticate",
|
|
1438
2067
|
value: function value(e) {
|
|
1439
|
-
return
|
|
1440
|
-
var r, n, o, s
|
|
1441
|
-
return
|
|
2068
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2069
|
+
var r, n, i, o, s;
|
|
2070
|
+
return de().wrap(function (t) {
|
|
1442
2071
|
for (;;) switch (t.prev = t.next) {
|
|
1443
2072
|
case 0:
|
|
1444
|
-
return
|
|
2073
|
+
return qe("stytch.sso.authenticate").isString("sso_token", e.sso_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1445
2074
|
case 3:
|
|
1446
|
-
return (r = t.sent) ||
|
|
2075
|
+
return (r = t.sent) || Ne("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();
|
|
1447
2076
|
case 7:
|
|
1448
|
-
return n = t.sent,
|
|
2077
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1449
2078
|
url: "/b2b/sso/authenticate",
|
|
1450
2079
|
method: "POST",
|
|
1451
2080
|
body: Object.assign(Object.assign({
|
|
1452
2081
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier
|
|
1453
2082
|
}, e), {
|
|
1454
|
-
dfp_telemetry_id:
|
|
1455
|
-
captcha_token:
|
|
2083
|
+
dfp_telemetry_id: i,
|
|
2084
|
+
captcha_token: o
|
|
1456
2085
|
}),
|
|
1457
2086
|
errorMessage: "Failed to authenticate token",
|
|
1458
2087
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1459
2088
|
});
|
|
1460
2089
|
case 12:
|
|
1461
|
-
return
|
|
2090
|
+
return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
1462
2091
|
state: {
|
|
1463
|
-
session:
|
|
1464
|
-
member:
|
|
2092
|
+
session: s.member_session,
|
|
2093
|
+
member: s.member
|
|
1465
2094
|
},
|
|
1466
|
-
session_token:
|
|
1467
|
-
session_jwt:
|
|
2095
|
+
session_token: s.session_token,
|
|
2096
|
+
session_jwt: s.session_jwt,
|
|
1468
2097
|
intermediate_session_token: null
|
|
1469
2098
|
}) : this._subscriptionService.updateStateAndTokens({
|
|
1470
2099
|
state: null,
|
|
1471
2100
|
session_token: null,
|
|
1472
2101
|
session_jwt: null,
|
|
1473
|
-
intermediate_session_token:
|
|
1474
|
-
}), t.abrupt("return",
|
|
2102
|
+
intermediate_session_token: s.intermediate_session_token
|
|
2103
|
+
}), t.abrupt("return", s);
|
|
1475
2104
|
case 16:
|
|
1476
2105
|
case "end":
|
|
1477
2106
|
return t.stop();
|
|
@@ -1482,11 +2111,11 @@ var ne = Promise.resolve({
|
|
|
1482
2111
|
}, {
|
|
1483
2112
|
key: "getBaseApiUrl",
|
|
1484
2113
|
value: function value() {
|
|
1485
|
-
return
|
|
1486
|
-
return
|
|
2114
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2115
|
+
return de().wrap(function (e) {
|
|
1487
2116
|
for (;;) switch (e.prev = e.next) {
|
|
1488
2117
|
case 0:
|
|
1489
|
-
if (!
|
|
2118
|
+
if (!ze(this._config.publicToken)) {
|
|
1490
2119
|
e.next = 2;
|
|
1491
2120
|
break;
|
|
1492
2121
|
}
|
|
@@ -1506,92 +2135,294 @@ var ne = Promise.resolve({
|
|
|
1506
2135
|
var t = e.connection_id,
|
|
1507
2136
|
r = e.login_redirect_url,
|
|
1508
2137
|
n = e.signup_redirect_url;
|
|
1509
|
-
return
|
|
1510
|
-
var o, s, a, c
|
|
1511
|
-
return
|
|
2138
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2139
|
+
var i, o, s, a, c;
|
|
2140
|
+
return de().wrap(function (e) {
|
|
2141
|
+
for (;;) switch (e.prev = e.next) {
|
|
2142
|
+
case 0:
|
|
2143
|
+
return e.next = 2, this._dynamicConfig;
|
|
2144
|
+
case 2:
|
|
2145
|
+
return i = e.sent, o = i.pkceRequiredForSso, e.next = 6, this.getBaseApiUrl();
|
|
2146
|
+
case 6:
|
|
2147
|
+
if (s = e.sent, (a = new URL("".concat(s, "/v1/public/sso/start"))).searchParams.set("public_token", this._config.publicToken), a.searchParams.set("connection_id", t), !o) {
|
|
2148
|
+
e.next = 17;
|
|
2149
|
+
break;
|
|
2150
|
+
}
|
|
2151
|
+
return e.next = 13, this._pkceManager.startPKCETransaction();
|
|
2152
|
+
case 13:
|
|
2153
|
+
c = e.sent, a.searchParams.set("pkce_code_challenge", c.code_challenge), e.next = 18;
|
|
2154
|
+
break;
|
|
2155
|
+
case 17:
|
|
2156
|
+
this._pkceManager.clearPKPair();
|
|
2157
|
+
case 18:
|
|
2158
|
+
r && a.searchParams.set("login_redirect_url", r), n && a.searchParams.set("signup_redirect_url", n), window.location.href = a.toString();
|
|
2159
|
+
case 21:
|
|
2160
|
+
case "end":
|
|
2161
|
+
return e.stop();
|
|
2162
|
+
}
|
|
2163
|
+
}, e, this);
|
|
2164
|
+
}));
|
|
2165
|
+
}
|
|
2166
|
+
}, {
|
|
2167
|
+
key: "getConnections",
|
|
2168
|
+
value: function value() {
|
|
2169
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
2170
|
+
return de().wrap(function (e) {
|
|
1512
2171
|
for (;;) switch (e.prev = e.next) {
|
|
1513
2172
|
case 0:
|
|
1514
|
-
return e.next = 2, this.
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
2173
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
2174
|
+
url: "/b2b/sso",
|
|
2175
|
+
method: "GET",
|
|
2176
|
+
errorMessage: "Failed to get SSO Connections."
|
|
2177
|
+
});
|
|
2178
|
+
case 2:
|
|
2179
|
+
return e.abrupt("return", e.sent);
|
|
2180
|
+
case 3:
|
|
2181
|
+
case "end":
|
|
2182
|
+
return e.stop();
|
|
2183
|
+
}
|
|
2184
|
+
}, e, this);
|
|
2185
|
+
}));
|
|
2186
|
+
}
|
|
2187
|
+
}, {
|
|
2188
|
+
key: "deleteConnection",
|
|
2189
|
+
value: function value(e) {
|
|
2190
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2191
|
+
return de().wrap(function (t) {
|
|
2192
|
+
for (;;) switch (t.prev = t.next) {
|
|
2193
|
+
case 0:
|
|
2194
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2195
|
+
url: "/b2b/sso/".concat(e),
|
|
2196
|
+
method: "DELETE",
|
|
2197
|
+
errorMessage: "Failed to delete SSO Connection."
|
|
2198
|
+
}));
|
|
2199
|
+
case 1:
|
|
2200
|
+
case "end":
|
|
2201
|
+
return t.stop();
|
|
2202
|
+
}
|
|
2203
|
+
}, t, this);
|
|
2204
|
+
}));
|
|
2205
|
+
}
|
|
2206
|
+
}]), e;
|
|
2207
|
+
}(),
|
|
2208
|
+
Xe = pe(function e(t, r) {
|
|
2209
|
+
var n = this;
|
|
2210
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2211
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2212
|
+
var t;
|
|
2213
|
+
return de().wrap(function (e) {
|
|
2214
|
+
for (;;) switch (e.prev = e.next) {
|
|
2215
|
+
case 0:
|
|
2216
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
2217
|
+
url: "/b2b/organizations/me",
|
|
2218
|
+
errorMessage: "Failed to retrieve organization info.",
|
|
2219
|
+
method: "GET"
|
|
2220
|
+
});
|
|
2221
|
+
case 2:
|
|
2222
|
+
return t = e.sent, e.abrupt("return", t.organization);
|
|
2223
|
+
case 4:
|
|
2224
|
+
case "end":
|
|
2225
|
+
return e.stop();
|
|
2226
|
+
}
|
|
2227
|
+
}, e, this);
|
|
2228
|
+
}));
|
|
2229
|
+
}, this.update = function (e) {
|
|
2230
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2231
|
+
var r;
|
|
2232
|
+
return de().wrap(function (t) {
|
|
2233
|
+
for (;;) switch (t.prev = t.next) {
|
|
2234
|
+
case 0:
|
|
2235
|
+
return t.next = 2, this._networkClient.fetchSDK({
|
|
2236
|
+
url: "/b2b/organizations/me",
|
|
2237
|
+
errorMessage: "Failed to update organization info.",
|
|
2238
|
+
method: "PUT",
|
|
2239
|
+
body: e
|
|
2240
|
+
});
|
|
2241
|
+
case 2:
|
|
2242
|
+
return r = t.sent, t.abrupt("return", r);
|
|
2243
|
+
case 4:
|
|
2244
|
+
case "end":
|
|
2245
|
+
return t.stop();
|
|
2246
|
+
}
|
|
2247
|
+
}, t, this);
|
|
2248
|
+
}));
|
|
2249
|
+
}, this["delete"] = function () {
|
|
2250
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2251
|
+
var t;
|
|
2252
|
+
return de().wrap(function (e) {
|
|
2253
|
+
for (;;) switch (e.prev = e.next) {
|
|
2254
|
+
case 0:
|
|
2255
|
+
return e.next = 2, this._networkClient.fetchSDK({
|
|
2256
|
+
url: "/b2b/organizations/me",
|
|
2257
|
+
errorMessage: "Failed to delete organization.",
|
|
2258
|
+
method: "DELETE"
|
|
2259
|
+
});
|
|
2260
|
+
case 2:
|
|
2261
|
+
return t = e.sent, this._subscriptionService.destroyState(), e.abrupt("return", t);
|
|
2262
|
+
case 5:
|
|
2263
|
+
case "end":
|
|
2264
|
+
return e.stop();
|
|
2265
|
+
}
|
|
2266
|
+
}, e, this);
|
|
2267
|
+
}));
|
|
2268
|
+
}, this.members = {
|
|
2269
|
+
create: function create(e) {
|
|
2270
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2271
|
+
return de().wrap(function (t) {
|
|
2272
|
+
for (;;) switch (t.prev = t.next) {
|
|
2273
|
+
case 0:
|
|
2274
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2275
|
+
url: "/b2b/organizations/members",
|
|
2276
|
+
errorMessage: "Failed to create member.",
|
|
2277
|
+
method: "POST",
|
|
2278
|
+
body: e
|
|
2279
|
+
}));
|
|
2280
|
+
case 1:
|
|
2281
|
+
case "end":
|
|
2282
|
+
return t.stop();
|
|
2283
|
+
}
|
|
2284
|
+
}, t, this);
|
|
2285
|
+
}));
|
|
2286
|
+
},
|
|
2287
|
+
search: function search(e) {
|
|
2288
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2289
|
+
return de().wrap(function (t) {
|
|
2290
|
+
for (;;) switch (t.prev = t.next) {
|
|
2291
|
+
case 0:
|
|
2292
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2293
|
+
url: "/b2b/organizations/me/members/search",
|
|
2294
|
+
errorMessage: "Failed to search members.",
|
|
2295
|
+
method: "POST",
|
|
2296
|
+
body: e
|
|
2297
|
+
}));
|
|
2298
|
+
case 1:
|
|
2299
|
+
case "end":
|
|
2300
|
+
return t.stop();
|
|
2301
|
+
}
|
|
2302
|
+
}, t, this);
|
|
2303
|
+
}));
|
|
2304
|
+
},
|
|
2305
|
+
update: function update(e) {
|
|
2306
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2307
|
+
return de().wrap(function (t) {
|
|
2308
|
+
for (;;) switch (t.prev = t.next) {
|
|
2309
|
+
case 0:
|
|
2310
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2311
|
+
url: "/b2b/organizations/members/".concat(e.member_id),
|
|
2312
|
+
errorMessage: "Failed to update member.",
|
|
2313
|
+
method: "PUT",
|
|
2314
|
+
body: e
|
|
2315
|
+
}));
|
|
2316
|
+
case 1:
|
|
2317
|
+
case "end":
|
|
2318
|
+
return t.stop();
|
|
2319
|
+
}
|
|
2320
|
+
}, t, this);
|
|
2321
|
+
}));
|
|
2322
|
+
},
|
|
2323
|
+
deletePassword: function deletePassword(e) {
|
|
2324
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2325
|
+
return de().wrap(function (t) {
|
|
2326
|
+
for (;;) switch (t.prev = t.next) {
|
|
2327
|
+
case 0:
|
|
2328
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2329
|
+
url: "/b2b/organizations/members/passwords/".concat(e),
|
|
2330
|
+
errorMessage: "Failed to delete member password.",
|
|
2331
|
+
method: "DELETE"
|
|
2332
|
+
}));
|
|
2333
|
+
case 1:
|
|
2334
|
+
case "end":
|
|
2335
|
+
return t.stop();
|
|
2336
|
+
}
|
|
2337
|
+
}, t, this);
|
|
2338
|
+
}));
|
|
2339
|
+
},
|
|
2340
|
+
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(e) {
|
|
2341
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2342
|
+
return de().wrap(function (t) {
|
|
2343
|
+
for (;;) switch (t.prev = t.next) {
|
|
2344
|
+
case 0:
|
|
2345
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2346
|
+
url: "/b2b/organizations/members/mfa_phone_numbers/".concat(e),
|
|
2347
|
+
errorMessage: "Failed to delete member MFA Phone number.",
|
|
2348
|
+
method: "DELETE"
|
|
2349
|
+
}));
|
|
2350
|
+
case 1:
|
|
2351
|
+
case "end":
|
|
2352
|
+
return t.stop();
|
|
2353
|
+
}
|
|
2354
|
+
}, t, this);
|
|
2355
|
+
}));
|
|
2356
|
+
},
|
|
2357
|
+
"delete": function _delete(e) {
|
|
2358
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2359
|
+
return de().wrap(function (t) {
|
|
2360
|
+
for (;;) switch (t.prev = t.next) {
|
|
2361
|
+
case 0:
|
|
2362
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2363
|
+
url: "/b2b/organizations/members/".concat(e),
|
|
2364
|
+
errorMessage: "Failed to delete member.",
|
|
2365
|
+
method: "DELETE"
|
|
2366
|
+
}));
|
|
2367
|
+
case 1:
|
|
2368
|
+
case "end":
|
|
2369
|
+
return t.stop();
|
|
2370
|
+
}
|
|
2371
|
+
}, t, this);
|
|
2372
|
+
}));
|
|
2373
|
+
},
|
|
2374
|
+
reactivate: function reactivate(e) {
|
|
2375
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2376
|
+
return de().wrap(function (t) {
|
|
2377
|
+
for (;;) switch (t.prev = t.next) {
|
|
2378
|
+
case 0:
|
|
2379
|
+
return t.abrupt("return", this._networkClient.fetchSDK({
|
|
2380
|
+
url: "/b2b/organizations/members/".concat(e, "/reactivate"),
|
|
2381
|
+
errorMessage: "Failed to reactivate member.",
|
|
2382
|
+
method: "PUT"
|
|
2383
|
+
}));
|
|
2384
|
+
case 1:
|
|
1531
2385
|
case "end":
|
|
1532
|
-
return
|
|
2386
|
+
return t.stop();
|
|
1533
2387
|
}
|
|
1534
|
-
},
|
|
2388
|
+
}, t, this);
|
|
1535
2389
|
}));
|
|
1536
2390
|
}
|
|
1537
|
-
}]), e;
|
|
1538
|
-
}(),
|
|
1539
|
-
ae = s(function e(t) {
|
|
1540
|
-
var r = this;
|
|
1541
|
-
a(this, e), this._networkClient = t, this.get = function () {
|
|
1542
|
-
return S(r, void 0, void 0, i().mark(function e() {
|
|
1543
|
-
var t;
|
|
1544
|
-
return i().wrap(function (e) {
|
|
1545
|
-
for (;;) switch (e.prev = e.next) {
|
|
1546
|
-
case 0:
|
|
1547
|
-
return e.next = 2, this._networkClient.fetchSDK({
|
|
1548
|
-
url: "/b2b/organizations/me",
|
|
1549
|
-
errorMessage: "Failed to retrieve organization info.",
|
|
1550
|
-
method: "GET"
|
|
1551
|
-
});
|
|
1552
|
-
case 2:
|
|
1553
|
-
return t = e.sent, e.abrupt("return", t.organization);
|
|
1554
|
-
case 4:
|
|
1555
|
-
case "end":
|
|
1556
|
-
return e.stop();
|
|
1557
|
-
}
|
|
1558
|
-
}, e, this);
|
|
1559
|
-
}));
|
|
1560
2391
|
};
|
|
1561
2392
|
}),
|
|
1562
|
-
|
|
1563
|
-
function e(t, r, n,
|
|
1564
|
-
var
|
|
1565
|
-
|
|
1566
|
-
|
|
2393
|
+
Ze = function () {
|
|
2394
|
+
function e(t, r, n, i, o) {
|
|
2395
|
+
var s = this,
|
|
2396
|
+
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Ge();
|
|
2397
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this._pkceManager = n, this._dynamicConfig = i, this._config = o, this.dfpProtectedAuth = a, this.discovery = {
|
|
1567
2398
|
authenticate: function authenticate(e) {
|
|
1568
|
-
return
|
|
1569
|
-
var r, n, o, s, a
|
|
1570
|
-
return
|
|
2399
|
+
return we(s, void 0, void 0, de().mark(function t() {
|
|
2400
|
+
var r, n, i, o, s, a;
|
|
2401
|
+
return de().wrap(function (t) {
|
|
1571
2402
|
for (;;) switch (t.prev = t.next) {
|
|
1572
2403
|
case 0:
|
|
1573
|
-
return
|
|
2404
|
+
return qe("stytch.oauth.discovery.authenticate").isString("discovery_oauth_token", e.discovery_oauth_token), t.next = 3, this._pkceManager.getPKPair();
|
|
1574
2405
|
case 3:
|
|
1575
2406
|
return r = t.sent, t.next = 6, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
1576
2407
|
case 6:
|
|
1577
|
-
return n = t.sent,
|
|
2408
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, s = Object.assign({
|
|
1578
2409
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1579
|
-
dfp_telemetry_id:
|
|
1580
|
-
captcha_token:
|
|
2410
|
+
dfp_telemetry_id: i,
|
|
2411
|
+
captcha_token: o
|
|
1581
2412
|
}, e), t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1582
2413
|
url: "/b2b/oauth/discovery/authenticate",
|
|
1583
|
-
body:
|
|
2414
|
+
body: s,
|
|
1584
2415
|
errorMessage: "Failed to authenticate discovery oauth token",
|
|
1585
2416
|
method: "POST",
|
|
1586
2417
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1587
2418
|
});
|
|
1588
2419
|
case 12:
|
|
1589
|
-
return
|
|
2420
|
+
return a = t.sent, this._pkceManager.clearPKPair(), this._subscriptionService.updateStateAndTokens({
|
|
1590
2421
|
state: null,
|
|
1591
2422
|
session_token: null,
|
|
1592
2423
|
session_jwt: null,
|
|
1593
|
-
intermediate_session_token:
|
|
1594
|
-
}), t.abrupt("return",
|
|
2424
|
+
intermediate_session_token: a.intermediate_session_token
|
|
2425
|
+
}), t.abrupt("return", a);
|
|
1595
2426
|
case 16:
|
|
1596
2427
|
case "end":
|
|
1597
2428
|
return t.stop();
|
|
@@ -1600,55 +2431,55 @@ var ne = Promise.resolve({
|
|
|
1600
2431
|
}));
|
|
1601
2432
|
}
|
|
1602
2433
|
}, this.google = {
|
|
1603
|
-
start: this.startOAuthFlow(
|
|
2434
|
+
start: this.startOAuthFlow(y.Google),
|
|
1604
2435
|
discovery: {
|
|
1605
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2436
|
+
start: this.startDiscoveryOAuthFlow(y.Google)
|
|
1606
2437
|
}
|
|
1607
2438
|
}, this.microsoft = {
|
|
1608
|
-
start: this.startOAuthFlow(
|
|
2439
|
+
start: this.startOAuthFlow(y.Microsoft),
|
|
1609
2440
|
discovery: {
|
|
1610
|
-
start: this.startDiscoveryOAuthFlow(
|
|
2441
|
+
start: this.startDiscoveryOAuthFlow(y.Microsoft)
|
|
1611
2442
|
}
|
|
1612
2443
|
};
|
|
1613
2444
|
}
|
|
1614
|
-
return
|
|
2445
|
+
return pe(e, [{
|
|
1615
2446
|
key: "authenticate",
|
|
1616
2447
|
value: function value(e) {
|
|
1617
|
-
return
|
|
1618
|
-
var r, n, o, s
|
|
1619
|
-
return
|
|
2448
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2449
|
+
var r, n, i, o, s;
|
|
2450
|
+
return de().wrap(function (t) {
|
|
1620
2451
|
for (;;) switch (t.prev = t.next) {
|
|
1621
2452
|
case 0:
|
|
1622
|
-
return
|
|
2453
|
+
return qe("stytch.oauth.authenticate").isString("oauth_token", e.oauth_token).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.next = 3, this._pkceManager.getPKPair();
|
|
1623
2454
|
case 3:
|
|
1624
|
-
return (r = t.sent) ||
|
|
2455
|
+
return (r = t.sent) || Ne("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();
|
|
1625
2456
|
case 7:
|
|
1626
|
-
return n = t.sent,
|
|
2457
|
+
return n = t.sent, i = n.dfp_telemetry_id, o = n.captcha_token, t.next = 12, this._networkClient.retriableFetchSDK({
|
|
1627
2458
|
url: "/b2b/oauth/authenticate",
|
|
1628
2459
|
method: "POST",
|
|
1629
2460
|
body: Object.assign({
|
|
1630
2461
|
pkce_code_verifier: null == r ? void 0 : r.code_verifier,
|
|
1631
|
-
dfp_telemetry_id:
|
|
1632
|
-
captcha_token:
|
|
2462
|
+
dfp_telemetry_id: i,
|
|
2463
|
+
captcha_token: o
|
|
1633
2464
|
}, e),
|
|
1634
2465
|
errorMessage: "Failed to authenticate token",
|
|
1635
2466
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
1636
2467
|
});
|
|
1637
2468
|
case 12:
|
|
1638
|
-
return
|
|
2469
|
+
return s = t.sent, this._pkceManager.clearPKPair(), s.member_session ? this._subscriptionService.updateStateAndTokens({
|
|
1639
2470
|
state: {
|
|
1640
|
-
session:
|
|
1641
|
-
member:
|
|
2471
|
+
session: s.member_session,
|
|
2472
|
+
member: s.member
|
|
1642
2473
|
},
|
|
1643
|
-
session_token:
|
|
1644
|
-
session_jwt:
|
|
2474
|
+
session_token: s.session_token,
|
|
2475
|
+
session_jwt: s.session_jwt,
|
|
1645
2476
|
intermediate_session_token: null
|
|
1646
2477
|
}) : this._subscriptionService.updateStateAndTokens({
|
|
1647
2478
|
state: null,
|
|
1648
2479
|
session_token: null,
|
|
1649
2480
|
session_jwt: null,
|
|
1650
|
-
intermediate_session_token:
|
|
1651
|
-
}), t.abrupt("return",
|
|
2481
|
+
intermediate_session_token: s.intermediate_session_token
|
|
2482
|
+
}), t.abrupt("return", s);
|
|
1652
2483
|
case 16:
|
|
1653
2484
|
case "end":
|
|
1654
2485
|
return t.stop();
|
|
@@ -1659,9 +2490,9 @@ var ne = Promise.resolve({
|
|
|
1659
2490
|
}, {
|
|
1660
2491
|
key: "getBaseApiUrl",
|
|
1661
2492
|
value: function value() {
|
|
1662
|
-
return
|
|
2493
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
1663
2494
|
var t, r;
|
|
1664
|
-
return
|
|
2495
|
+
return de().wrap(function (e) {
|
|
1665
2496
|
for (;;) switch (e.prev = e.next) {
|
|
1666
2497
|
case 0:
|
|
1667
2498
|
return e.next = 2, this._dynamicConfig;
|
|
@@ -1672,7 +2503,7 @@ var ne = Promise.resolve({
|
|
|
1672
2503
|
}
|
|
1673
2504
|
return e.abrupt("return", "https://".concat(r));
|
|
1674
2505
|
case 6:
|
|
1675
|
-
if (!
|
|
2506
|
+
if (!ze(this._config.publicToken)) {
|
|
1676
2507
|
e.next = 8;
|
|
1677
2508
|
break;
|
|
1678
2509
|
}
|
|
@@ -1692,33 +2523,33 @@ var ne = Promise.resolve({
|
|
|
1692
2523
|
var t = this;
|
|
1693
2524
|
return function (r) {
|
|
1694
2525
|
var n = r.organization_id,
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
return
|
|
1701
|
-
var r, l, d, h, p
|
|
1702
|
-
return
|
|
2526
|
+
i = r.organization_slug,
|
|
2527
|
+
o = r.login_redirect_url,
|
|
2528
|
+
s = r.signup_redirect_url,
|
|
2529
|
+
a = r.custom_scopes,
|
|
2530
|
+
c = r.provider_params;
|
|
2531
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2532
|
+
var r, u, l, d, h, p;
|
|
2533
|
+
return de().wrap(function (t) {
|
|
1703
2534
|
for (;;) switch (t.prev = t.next) {
|
|
1704
2535
|
case 0:
|
|
1705
2536
|
return t.next = 2, this._dynamicConfig;
|
|
1706
2537
|
case 2:
|
|
1707
|
-
return r = t.sent,
|
|
2538
|
+
return r = t.sent, u = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
1708
2539
|
case 6:
|
|
1709
|
-
if (
|
|
1710
|
-
if (!
|
|
2540
|
+
if (l = t.sent, (d = new URL("".concat(l, "/v1/b2b/public/oauth/").concat(e, "/start"))).searchParams.set("public_token", this._config.publicToken), n && "" != n && d.searchParams.set("organization_id", n), i && "" != i && d.searchParams.set("slug", i), a && (qe("startOAuthFlow").isStringArray("custom_scopes", a), d.searchParams.set("custom_scopes", a.join(" "))), c) for (h in qe("startOAuthFlow").isOptionalObject("provider_params", c), c) d.searchParams.set("provider_" + h, c[h]);
|
|
2541
|
+
if (!u) {
|
|
1711
2542
|
t.next = 20;
|
|
1712
2543
|
break;
|
|
1713
2544
|
}
|
|
1714
2545
|
return t.next = 16, this._pkceManager.startPKCETransaction();
|
|
1715
2546
|
case 16:
|
|
1716
|
-
|
|
2547
|
+
p = t.sent, d.searchParams.set("pkce_code_challenge", p.code_challenge), t.next = 21;
|
|
1717
2548
|
break;
|
|
1718
2549
|
case 20:
|
|
1719
2550
|
this._pkceManager.clearPKPair();
|
|
1720
2551
|
case 21:
|
|
1721
|
-
|
|
2552
|
+
o && d.searchParams.set("login_redirect_url", o), s && d.searchParams.set("signup_redirect_url", s), window.location.href = d.toString();
|
|
1722
2553
|
case 24:
|
|
1723
2554
|
case "end":
|
|
1724
2555
|
return t.stop();
|
|
@@ -1733,30 +2564,30 @@ var ne = Promise.resolve({
|
|
|
1733
2564
|
var t = this;
|
|
1734
2565
|
return function (r) {
|
|
1735
2566
|
var n = r.discovery_redirect_url,
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
return
|
|
1739
|
-
var r, a, c, u, l
|
|
1740
|
-
return
|
|
2567
|
+
i = r.custom_scopes,
|
|
2568
|
+
o = r.provider_params;
|
|
2569
|
+
return we(t, void 0, void 0, de().mark(function t() {
|
|
2570
|
+
var r, s, a, c, u, l;
|
|
2571
|
+
return de().wrap(function (t) {
|
|
1741
2572
|
for (;;) switch (t.prev = t.next) {
|
|
1742
2573
|
case 0:
|
|
1743
2574
|
return t.next = 2, this._dynamicConfig;
|
|
1744
2575
|
case 2:
|
|
1745
|
-
return r = t.sent,
|
|
2576
|
+
return r = t.sent, s = r.pkceRequiredForOAuth, t.next = 6, this.getBaseApiUrl();
|
|
1746
2577
|
case 6:
|
|
1747
|
-
if (
|
|
1748
|
-
if (!
|
|
2578
|
+
if (a = t.sent, (c = new URL("".concat(a, "/v1/b2b/public/oauth/").concat(e, "/discovery/start"))).searchParams.set("public_token", this._config.publicToken), i && (qe("startOAuthFlow").isStringArray("custom_scopes", i), c.searchParams.set("custom_scopes", i.join(" "))), o) for (u in qe("startOAuthFlow").isOptionalObject("provider_params", o), o) c.searchParams.set("provider_" + u, o[u]);
|
|
2579
|
+
if (!s) {
|
|
1749
2580
|
t.next = 18;
|
|
1750
2581
|
break;
|
|
1751
2582
|
}
|
|
1752
2583
|
return t.next = 14, this._pkceManager.startPKCETransaction();
|
|
1753
2584
|
case 14:
|
|
1754
|
-
|
|
2585
|
+
l = t.sent, c.searchParams.set("pkce_code_challenge", l.code_challenge), t.next = 19;
|
|
1755
2586
|
break;
|
|
1756
2587
|
case 18:
|
|
1757
2588
|
this._pkceManager.clearPKPair();
|
|
1758
2589
|
case 19:
|
|
1759
|
-
n &&
|
|
2590
|
+
n && c.searchParams.set("discovery_redirect_url", n), window.location.href = c.toString();
|
|
1760
2591
|
case 21:
|
|
1761
2592
|
case "end":
|
|
1762
2593
|
return t.stop();
|
|
@@ -1767,10 +2598,10 @@ var ne = Promise.resolve({
|
|
|
1767
2598
|
}
|
|
1768
2599
|
}]), e;
|
|
1769
2600
|
}(),
|
|
1770
|
-
|
|
2601
|
+
Qe = function () {
|
|
1771
2602
|
function e(t, r) {
|
|
1772
2603
|
var n = this;
|
|
1773
|
-
|
|
2604
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.getSync = function () {
|
|
1774
2605
|
return n._subscriptionService.getSession();
|
|
1775
2606
|
}, this.onChange = function (e) {
|
|
1776
2607
|
return n._subscriptionService.subscribeToState(function (t) {
|
|
@@ -1778,9 +2609,9 @@ var ne = Promise.resolve({
|
|
|
1778
2609
|
return e(null !== (r = null == t ? void 0 : t.session) && void 0 !== r ? r : null);
|
|
1779
2610
|
});
|
|
1780
2611
|
}, this.revoke = function (e) {
|
|
1781
|
-
return
|
|
2612
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1782
2613
|
var r;
|
|
1783
|
-
return
|
|
2614
|
+
return de().wrap(function (t) {
|
|
1784
2615
|
for (;;) switch (t.prev = t.next) {
|
|
1785
2616
|
case 0:
|
|
1786
2617
|
return t.prev = 0, t.next = 3, this._networkClient.fetchSDK({
|
|
@@ -1791,7 +2622,7 @@ var ne = Promise.resolve({
|
|
|
1791
2622
|
case 3:
|
|
1792
2623
|
return r = t.sent, this._subscriptionService.destroyState(), t.abrupt("return", r);
|
|
1793
2624
|
case 8:
|
|
1794
|
-
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) ||
|
|
2625
|
+
throw t.prev = 8, t.t0 = t["catch"](0), ((null == e ? void 0 : e.forceClear) || A.includes(t.t0.error_type)) && this._subscriptionService.destroyState(), t.t0;
|
|
1795
2626
|
case 12:
|
|
1796
2627
|
case "end":
|
|
1797
2628
|
return t.stop();
|
|
@@ -1799,9 +2630,9 @@ var ne = Promise.resolve({
|
|
|
1799
2630
|
}, t, this, [[0, 8]]);
|
|
1800
2631
|
}));
|
|
1801
2632
|
}, this.authenticate = function (e) {
|
|
1802
|
-
return
|
|
2633
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1803
2634
|
var r, n;
|
|
1804
|
-
return
|
|
2635
|
+
return de().wrap(function (t) {
|
|
1805
2636
|
for (;;) switch (t.prev = t.next) {
|
|
1806
2637
|
case 0:
|
|
1807
2638
|
return t.prev = 0, r = {
|
|
@@ -1823,7 +2654,7 @@ var ne = Promise.resolve({
|
|
|
1823
2654
|
intermediate_session_token: null
|
|
1824
2655
|
}), t.abrupt("return", n);
|
|
1825
2656
|
case 9:
|
|
1826
|
-
throw t.prev = 9, t.t0 = t["catch"](0),
|
|
2657
|
+
throw t.prev = 9, t.t0 = t["catch"](0), A.includes(t.t0.error_type) && this._subscriptionService.destroyState(), t.t0;
|
|
1827
2658
|
case 13:
|
|
1828
2659
|
case "end":
|
|
1829
2660
|
return t.stop();
|
|
@@ -1831,12 +2662,12 @@ var ne = Promise.resolve({
|
|
|
1831
2662
|
}, t, this, [[0, 9]]);
|
|
1832
2663
|
}));
|
|
1833
2664
|
}, this.exchange = function (e) {
|
|
1834
|
-
return
|
|
2665
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1835
2666
|
var r;
|
|
1836
|
-
return
|
|
2667
|
+
return de().wrap(function (t) {
|
|
1837
2668
|
for (;;) switch (t.prev = t.next) {
|
|
1838
2669
|
case 0:
|
|
1839
|
-
return
|
|
2670
|
+
return qe("stytch.sessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.prev = 1, t.next = 4, this._networkClient.fetchSDK({
|
|
1840
2671
|
url: "/b2b/sessions/exchange",
|
|
1841
2672
|
body: e,
|
|
1842
2673
|
errorMessage: "Failed to exchange session",
|
|
@@ -1867,19 +2698,19 @@ var ne = Promise.resolve({
|
|
|
1867
2698
|
}));
|
|
1868
2699
|
};
|
|
1869
2700
|
}
|
|
1870
|
-
return
|
|
2701
|
+
return pe(e, [{
|
|
1871
2702
|
key: "getTokens",
|
|
1872
2703
|
value: function value() {
|
|
1873
2704
|
return this._subscriptionService.getTokens();
|
|
1874
2705
|
}
|
|
1875
2706
|
}]), e;
|
|
1876
2707
|
}(),
|
|
1877
|
-
|
|
2708
|
+
et = pe(function e(t, r) {
|
|
1878
2709
|
var n = this;
|
|
1879
|
-
|
|
2710
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.organizations = {
|
|
1880
2711
|
list: function list() {
|
|
1881
|
-
return
|
|
1882
|
-
return
|
|
2712
|
+
return we(n, void 0, void 0, de().mark(function e() {
|
|
2713
|
+
return de().wrap(function (e) {
|
|
1883
2714
|
for (;;) switch (e.prev = e.next) {
|
|
1884
2715
|
case 0:
|
|
1885
2716
|
return e.t0 = this._networkClient, e.next = 3, this._subscriptionService.getIntermediateSessionToken();
|
|
@@ -1906,12 +2737,12 @@ var ne = Promise.resolve({
|
|
|
1906
2737
|
}));
|
|
1907
2738
|
},
|
|
1908
2739
|
create: function create(e) {
|
|
1909
|
-
return
|
|
2740
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1910
2741
|
var r, n;
|
|
1911
|
-
return
|
|
2742
|
+
return de().wrap(function (t) {
|
|
1912
2743
|
for (;;) switch (t.prev = t.next) {
|
|
1913
2744
|
case 0:
|
|
1914
|
-
return
|
|
2745
|
+
return qe("stytch.discovery.organizations.create").isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("organization_name", e.organization_name).isOptionalString("organization_slug", e.organization_slug).isOptionalString("organization_logo_url", e.organization_logo_url).isOptionalString("sso_jit_provisioning", e.sso_jit_provisioning).isOptionalStringArray("email_allowed_domains", e.email_allowed_domains).isOptionalString("email_invites", e.email_invites).isOptionalString("auth_methods", e.auth_methods).isOptionalStringArray("allowed_auth_methods", e.allowed_auth_methods).isOptionalString("mfa_policy", e.mfa_policy), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
1915
2746
|
case 5:
|
|
1916
2747
|
if (t.t2 = t.sent, t.t2) {
|
|
1917
2748
|
t.next = 8;
|
|
@@ -1951,12 +2782,12 @@ var ne = Promise.resolve({
|
|
|
1951
2782
|
}
|
|
1952
2783
|
}, this.intermediateSessions = {
|
|
1953
2784
|
exchange: function exchange(e) {
|
|
1954
|
-
return
|
|
2785
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
1955
2786
|
var r, n;
|
|
1956
|
-
return
|
|
2787
|
+
return de().wrap(function (t) {
|
|
1957
2788
|
for (;;) switch (t.prev = t.next) {
|
|
1958
2789
|
case 0:
|
|
1959
|
-
return
|
|
2790
|
+
return qe("stytch.discovery.intermediateSessions.exchange").isString("organization_id", e.organization_id).isNumber("session_duration_minutes", e.session_duration_minutes).isOptionalString("locale", e.locale), t.t0 = Object, t.t1 = Object.assign({}, e), t.next = 5, this._subscriptionService.getIntermediateSessionToken();
|
|
1960
2791
|
case 5:
|
|
1961
2792
|
if (t.t2 = t.sent, t.t2) {
|
|
1962
2793
|
t.next = 8;
|
|
@@ -1999,34 +2830,23 @@ var ne = Promise.resolve({
|
|
|
1999
2830
|
Promise.resolve({
|
|
2000
2831
|
pkceRequiredForPasswordResets: !1
|
|
2001
2832
|
});
|
|
2002
|
-
var
|
|
2003
|
-
he,
|
|
2004
|
-
pe,
|
|
2005
|
-
_e,
|
|
2006
|
-
me,
|
|
2007
|
-
fe,
|
|
2008
|
-
ve,
|
|
2009
|
-
be,
|
|
2010
|
-
ge,
|
|
2011
|
-
ye,
|
|
2012
|
-
ke,
|
|
2013
|
-
Se = s(function e(t, r) {
|
|
2833
|
+
var tt = pe(function e(t, r) {
|
|
2014
2834
|
var n = this,
|
|
2015
|
-
|
|
2016
|
-
|
|
2835
|
+
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
2836
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = i, this.sms = {
|
|
2017
2837
|
send: function send(e) {
|
|
2018
|
-
return
|
|
2019
|
-
var r, n,
|
|
2020
|
-
return
|
|
2838
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2839
|
+
var r, n, i;
|
|
2840
|
+
return de().wrap(function (t) {
|
|
2021
2841
|
for (;;) switch (t.prev = t.next) {
|
|
2022
2842
|
case 0:
|
|
2023
|
-
return
|
|
2843
|
+
return qe("stytch.otps.sms.send").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalString("mfa_phone_number", e.mfa_phone_number).isOptionalString("locale", e.locale), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2024
2844
|
case 3:
|
|
2025
|
-
return r = t.sent, n = r.dfp_telemetry_id,
|
|
2845
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2026
2846
|
url: "/b2b/otps/sms/send",
|
|
2027
2847
|
body: Object.assign(Object.assign({}, e), {
|
|
2028
2848
|
dfp_telemetry_id: n,
|
|
2029
|
-
captcha_token:
|
|
2849
|
+
captcha_token: i
|
|
2030
2850
|
}),
|
|
2031
2851
|
errorMessage: "Failed to send one time passcode",
|
|
2032
2852
|
method: "POST",
|
|
@@ -2040,14 +2860,14 @@ var de,
|
|
|
2040
2860
|
}));
|
|
2041
2861
|
},
|
|
2042
2862
|
authenticate: function authenticate(e) {
|
|
2043
|
-
return
|
|
2044
|
-
var r, n, o, s
|
|
2045
|
-
return
|
|
2863
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2864
|
+
var r, n, i, o, s;
|
|
2865
|
+
return de().wrap(function (t) {
|
|
2046
2866
|
for (;;) switch (t.prev = t.next) {
|
|
2047
2867
|
case 0:
|
|
2048
|
-
return
|
|
2868
|
+
return qe("stytch.otps.sms.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2049
2869
|
case 3:
|
|
2050
|
-
return r = t.sent, n = r.dfp_telemetry_id,
|
|
2870
|
+
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();
|
|
2051
2871
|
case 12:
|
|
2052
2872
|
if (t.t4 = t.sent, t.t4) {
|
|
2053
2873
|
t.next = 15;
|
|
@@ -2059,23 +2879,23 @@ var de,
|
|
|
2059
2879
|
dfp_telemetry_id: t.t2,
|
|
2060
2880
|
captcha_token: t.t3,
|
|
2061
2881
|
intermediate_session_token: t.t5
|
|
2062
|
-
},
|
|
2882
|
+
}, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
|
|
2063
2883
|
url: "/b2b/otps/sms/authenticate",
|
|
2064
|
-
body:
|
|
2884
|
+
body: o,
|
|
2065
2885
|
errorMessage: "Failed to authenticate one time passcode",
|
|
2066
2886
|
method: "POST",
|
|
2067
2887
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2068
2888
|
});
|
|
2069
2889
|
case 20:
|
|
2070
|
-
return
|
|
2890
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2071
2891
|
state: {
|
|
2072
|
-
session:
|
|
2073
|
-
member:
|
|
2892
|
+
session: s.member_session,
|
|
2893
|
+
member: s.member
|
|
2074
2894
|
},
|
|
2075
|
-
session_token:
|
|
2076
|
-
session_jwt:
|
|
2895
|
+
session_token: s.session_token,
|
|
2896
|
+
session_jwt: s.session_jwt,
|
|
2077
2897
|
intermediate_session_token: null
|
|
2078
|
-
}), t.abrupt("return",
|
|
2898
|
+
}), t.abrupt("return", s);
|
|
2079
2899
|
case 23:
|
|
2080
2900
|
case "end":
|
|
2081
2901
|
return t.stop();
|
|
@@ -2085,15 +2905,126 @@ var de,
|
|
|
2085
2905
|
}
|
|
2086
2906
|
};
|
|
2087
2907
|
}),
|
|
2088
|
-
|
|
2908
|
+
rt = function () {
|
|
2909
|
+
function e(t, r) {
|
|
2910
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Ge();
|
|
2911
|
+
_e(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2912
|
+
}
|
|
2913
|
+
return pe(e, [{
|
|
2914
|
+
key: "create",
|
|
2915
|
+
value: function value(e) {
|
|
2916
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2917
|
+
var r, n, i;
|
|
2918
|
+
return de().wrap(function (t) {
|
|
2919
|
+
for (;;) switch (t.prev = t.next) {
|
|
2920
|
+
case 0:
|
|
2921
|
+
return qe("stytch.totp.create").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isOptionalNumber("expiration_minutes", e.expiration_minutes), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2922
|
+
case 3:
|
|
2923
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2924
|
+
url: "/b2b/totp",
|
|
2925
|
+
body: Object.assign(Object.assign({}, e), {
|
|
2926
|
+
dfp_telemetry_id: n,
|
|
2927
|
+
captcha_token: i
|
|
2928
|
+
}),
|
|
2929
|
+
errorMessage: "Failed to create TOTP",
|
|
2930
|
+
method: "POST",
|
|
2931
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2932
|
+
}));
|
|
2933
|
+
case 7:
|
|
2934
|
+
case "end":
|
|
2935
|
+
return t.stop();
|
|
2936
|
+
}
|
|
2937
|
+
}, t, this);
|
|
2938
|
+
}));
|
|
2939
|
+
}
|
|
2940
|
+
}, {
|
|
2941
|
+
key: "authenticate",
|
|
2942
|
+
value: function value(e) {
|
|
2943
|
+
return we(this, void 0, void 0, de().mark(function t() {
|
|
2944
|
+
var r, n, i, o, s;
|
|
2945
|
+
return de().wrap(function (t) {
|
|
2946
|
+
for (;;) switch (t.prev = t.next) {
|
|
2947
|
+
case 0:
|
|
2948
|
+
return qe("stytch.totp.authenticate").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("code", e.code).isOptionalString("set_mfa_enrollment", e.set_mfa_enrollment).isOptionalBoolean("set_default_mfa", e.set_default_mfa), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2949
|
+
case 3:
|
|
2950
|
+
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();
|
|
2951
|
+
case 12:
|
|
2952
|
+
if (t.t4 = t.sent, t.t4) {
|
|
2953
|
+
t.next = 15;
|
|
2954
|
+
break;
|
|
2955
|
+
}
|
|
2956
|
+
t.t4 = void 0;
|
|
2957
|
+
case 15:
|
|
2958
|
+
return t.t5 = t.t4, t.t6 = {
|
|
2959
|
+
dfp_telemetry_id: t.t2,
|
|
2960
|
+
captcha_token: t.t3,
|
|
2961
|
+
intermediate_session_token: t.t5
|
|
2962
|
+
}, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
|
|
2963
|
+
url: "/b2b/totp/authenticate",
|
|
2964
|
+
body: o,
|
|
2965
|
+
errorMessage: "Failed to authenticate TOTP",
|
|
2966
|
+
method: "POST",
|
|
2967
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2968
|
+
});
|
|
2969
|
+
case 20:
|
|
2970
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
2971
|
+
state: {
|
|
2972
|
+
session: s.member_session,
|
|
2973
|
+
member: s.member
|
|
2974
|
+
},
|
|
2975
|
+
session_token: s.session_token,
|
|
2976
|
+
session_jwt: s.session_jwt,
|
|
2977
|
+
intermediate_session_token: null
|
|
2978
|
+
}), t.abrupt("return", s);
|
|
2979
|
+
case 23:
|
|
2980
|
+
case "end":
|
|
2981
|
+
return t.stop();
|
|
2982
|
+
}
|
|
2983
|
+
}, t, this);
|
|
2984
|
+
}));
|
|
2985
|
+
}
|
|
2986
|
+
}]), e;
|
|
2987
|
+
}(),
|
|
2988
|
+
nt = function () {
|
|
2989
|
+
function e(t, r, n) {
|
|
2990
|
+
var i = this;
|
|
2991
|
+
_e(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
2992
|
+
var r;
|
|
2993
|
+
return !!(null === (r = i.cachedPolicy) || void 0 === r ? void 0 : r.callerIsAuthorized(i.roleIds(), e, t));
|
|
2994
|
+
}, this.isAuthorized = function (e, t) {
|
|
2995
|
+
return i.policyPromise.then(function (r) {
|
|
2996
|
+
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
2997
|
+
});
|
|
2998
|
+
}, this.cachedPolicy = t.rbacPolicy ? ft.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
2999
|
+
return e.rbacPolicy ? (i.cachedPolicy = ft.fromJSON(e.rbacPolicy), i.cachedPolicy) : (Ke("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new ft([], []));
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
return pe(e, [{
|
|
3003
|
+
key: "allPermissions",
|
|
3004
|
+
value: function value() {
|
|
3005
|
+
var e = this;
|
|
3006
|
+
return this.policyPromise.then(function (t) {
|
|
3007
|
+
return t.allPermissionsForCaller(e.roleIds());
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
}, {
|
|
3011
|
+
key: "roleIds",
|
|
3012
|
+
value: function value() {
|
|
3013
|
+
var e,
|
|
3014
|
+
t = this._subscriptionService.getSession();
|
|
3015
|
+
return t && null !== (e = t.roles) && void 0 !== e ? e : [];
|
|
3016
|
+
}
|
|
3017
|
+
}]), e;
|
|
3018
|
+
}(),
|
|
3019
|
+
it = function () {
|
|
2089
3020
|
function e(t, r) {
|
|
2090
3021
|
var n = this;
|
|
2091
|
-
|
|
3022
|
+
_e(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
2092
3023
|
(null == e ? void 0 : e.session) ? n.scheduleBackgroundRefresh() : n.cancelBackgroundRefresh();
|
|
2093
3024
|
}, this._reauthenticateWithBackoff = function () {
|
|
2094
|
-
return
|
|
3025
|
+
return we(n, void 0, void 0, de().mark(function t() {
|
|
2095
3026
|
var r;
|
|
2096
|
-
return
|
|
3027
|
+
return de().wrap(function (t) {
|
|
2097
3028
|
for (;;) switch (t.prev = t.next) {
|
|
2098
3029
|
case 0:
|
|
2099
3030
|
r = 0;
|
|
@@ -2122,14 +3053,14 @@ var de,
|
|
|
2122
3053
|
}));
|
|
2123
3054
|
}, this.timeout = null, this._subscriptionService.subscribeToState(this._onDataChange);
|
|
2124
3055
|
}
|
|
2125
|
-
return
|
|
3056
|
+
return pe(e, [{
|
|
2126
3057
|
key: "performBackgroundRefresh",
|
|
2127
3058
|
value: function value() {
|
|
2128
3059
|
var e = this;
|
|
2129
3060
|
this._reauthenticateWithBackoff().then(function () {
|
|
2130
3061
|
e.scheduleBackgroundRefresh();
|
|
2131
3062
|
})["catch"](function (t) {
|
|
2132
|
-
|
|
3063
|
+
Ne("Session background refresh failed. Signalling to app that user is logged out.", {
|
|
2133
3064
|
error: t
|
|
2134
3065
|
}), e._subscriptionService.destroyState();
|
|
2135
3066
|
});
|
|
@@ -2155,11 +3086,63 @@ var de,
|
|
|
2155
3086
|
}, {
|
|
2156
3087
|
key: "isUnrecoverableError",
|
|
2157
3088
|
value: function value(e) {
|
|
2158
|
-
return
|
|
3089
|
+
return A.includes(e.error_type);
|
|
3090
|
+
}
|
|
3091
|
+
}]), e;
|
|
3092
|
+
}();
|
|
3093
|
+
it.REFRESH_INTERVAL_MS = 18e4;
|
|
3094
|
+
var ot,
|
|
3095
|
+
st,
|
|
3096
|
+
at,
|
|
3097
|
+
ct,
|
|
3098
|
+
ut,
|
|
3099
|
+
lt,
|
|
3100
|
+
dt,
|
|
3101
|
+
ht,
|
|
3102
|
+
pt,
|
|
3103
|
+
_t,
|
|
3104
|
+
ft = function () {
|
|
3105
|
+
function e(t, r) {
|
|
3106
|
+
var n = this;
|
|
3107
|
+
_e(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
3108
|
+
return n.rolesByID[e.role_id] = e;
|
|
3109
|
+
});
|
|
3110
|
+
}
|
|
3111
|
+
return pe(e, [{
|
|
3112
|
+
key: "callerIsAuthorized",
|
|
3113
|
+
value: function value(e, t, r) {
|
|
3114
|
+
var n = this;
|
|
3115
|
+
return !!e.map(function (e) {
|
|
3116
|
+
return n.rolesByID[e];
|
|
3117
|
+
}).filter(function (e) {
|
|
3118
|
+
return e;
|
|
3119
|
+
}).flatMap(function (e) {
|
|
3120
|
+
return e.permissions;
|
|
3121
|
+
}).filter(function (e) {
|
|
3122
|
+
return e.resource_id === t;
|
|
3123
|
+
}).find(function (e) {
|
|
3124
|
+
return e.actions.includes(r) || e.actions.includes("*");
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3127
|
+
}, {
|
|
3128
|
+
key: "allPermissionsForCaller",
|
|
3129
|
+
value: function value(e) {
|
|
3130
|
+
var t = this,
|
|
3131
|
+
r = {};
|
|
3132
|
+
return this.resources.forEach(function (n) {
|
|
3133
|
+
r[n.resource_id] = {}, n.actions.forEach(function (i) {
|
|
3134
|
+
r[n.resource_id][i] = t.callerIsAuthorized(e, n.resource_id, i);
|
|
3135
|
+
});
|
|
3136
|
+
}), r;
|
|
3137
|
+
}
|
|
3138
|
+
}], [{
|
|
3139
|
+
key: "fromJSON",
|
|
3140
|
+
value: function value(t) {
|
|
3141
|
+
return new e(t.roles, t.resources);
|
|
2159
3142
|
}
|
|
2160
3143
|
}]), e;
|
|
2161
3144
|
}();
|
|
2162
|
-
function
|
|
3145
|
+
function mt(e, t, r, n) {
|
|
2163
3146
|
return new (r || (r = Promise))(function (i, o) {
|
|
2164
3147
|
function s(e) {
|
|
2165
3148
|
try {
|
|
@@ -2184,65 +3167,63 @@ function Ae(e, t, r, n) {
|
|
|
2184
3167
|
c((n = n.apply(e, t || [])).next());
|
|
2185
3168
|
});
|
|
2186
3169
|
}
|
|
2187
|
-
|
|
3170
|
+
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
2188
3171
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
2189
|
-
}(
|
|
3172
|
+
}(ot || (ot = {})), function (e) {
|
|
2190
3173
|
e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
|
|
2191
|
-
}(
|
|
3174
|
+
}(st || (st = {})), function (e) {
|
|
2192
3175
|
e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
|
|
2193
|
-
}(
|
|
3176
|
+
}(at || (at = {})), function (e) {
|
|
2194
3177
|
e.embedded = "embedded", e.floating = "floating";
|
|
2195
|
-
}(
|
|
3178
|
+
}(ct || (ct = {})), function (e) {
|
|
2196
3179
|
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
2197
|
-
}(
|
|
2198
|
-
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "
|
|
2199
|
-
}(
|
|
2200
|
-
var
|
|
2201
|
-
_inherits(
|
|
2202
|
-
var _super = _createSuper(
|
|
2203
|
-
function
|
|
3180
|
+
}(ut || (ut = {})), function (e) {
|
|
3181
|
+
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_OAUTH_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
3182
|
+
}(lt || (lt = {}));
|
|
3183
|
+
var vt = /*#__PURE__*/function (_Error) {
|
|
3184
|
+
_inherits(vt, _Error);
|
|
3185
|
+
var _super = _createSuper(vt);
|
|
3186
|
+
function vt(e, t) {
|
|
2204
3187
|
var _this;
|
|
2205
|
-
_classCallCheck(this,
|
|
3188
|
+
_classCallCheck(this, vt);
|
|
2206
3189
|
_this = _super.call(this), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
|
|
2207
3190
|
return _this;
|
|
2208
3191
|
}
|
|
2209
|
-
return _createClass(
|
|
3192
|
+
return _createClass(vt);
|
|
2210
3193
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
2211
3194
|
!function (e) {
|
|
2212
|
-
e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
|
|
2213
|
-
}(ve || (ve = {})), function (e) {
|
|
2214
3195
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
2215
|
-
}(
|
|
3196
|
+
}(dt || (dt = {})), function (e) {
|
|
2216
3197
|
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
2217
|
-
}(
|
|
3198
|
+
}(ht || (ht = {})), function (e) {
|
|
2218
3199
|
e.Google = "google", e.Microsoft = "microsoft";
|
|
2219
|
-
}(
|
|
3200
|
+
}(pt || (pt = {})), function (e) {
|
|
2220
3201
|
e.RequiredCatcha = "Catcha Required";
|
|
2221
|
-
}(
|
|
2222
|
-
var
|
|
3202
|
+
}(_t || (_t = {}));
|
|
3203
|
+
var bt = function bt(e) {
|
|
2223
3204
|
var t = {
|
|
2224
3205
|
isObject: function isObject(r, n) {
|
|
2225
|
-
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new
|
|
3206
|
+
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new vt(e, r + " must be an object.");
|
|
2226
3207
|
return t;
|
|
2227
3208
|
},
|
|
2228
3209
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
2229
3210
|
return void 0 === r ? t : t.isObject(e, r);
|
|
2230
3211
|
},
|
|
2231
3212
|
isString: function isString(r, n) {
|
|
2232
|
-
if ("string" != typeof n) throw new
|
|
3213
|
+
if ("string" != typeof n) throw new vt(e, r + " must be a string.");
|
|
2233
3214
|
return t;
|
|
2234
3215
|
},
|
|
2235
3216
|
isOptionalString: function isOptionalString(e, r) {
|
|
2236
3217
|
return void 0 === r ? t : t.isString(e, r);
|
|
2237
3218
|
},
|
|
2238
3219
|
isStringArray: function isStringArray(r, n) {
|
|
2239
|
-
if (!Array.isArray(n)) throw new
|
|
3220
|
+
if (!Array.isArray(n)) throw new vt(e, r + " must be an array of strings.");
|
|
2240
3221
|
var _iterator = _createForOfIteratorHelper(n),
|
|
2241
3222
|
_step;
|
|
2242
3223
|
try {
|
|
2243
3224
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2244
3225
|
var _t2 = _step.value;
|
|
2245
|
-
if ("string" != typeof _t2) throw new
|
|
3226
|
+
if ("string" != typeof _t2) throw new vt(e, r + " must be an array of strings.");
|
|
2246
3227
|
}
|
|
2247
3228
|
} catch (err) {
|
|
2248
3229
|
_iterator.e(err);
|
|
@@ -2255,14 +3236,14 @@ var Te = function Te(e) {
|
|
|
2255
3236
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
2256
3237
|
},
|
|
2257
3238
|
isNumber: function isNumber(r, n) {
|
|
2258
|
-
if ("number" != typeof n) throw new
|
|
3239
|
+
if ("number" != typeof n) throw new vt(e, r + " must be a number.");
|
|
2259
3240
|
return t;
|
|
2260
3241
|
},
|
|
2261
3242
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
2262
3243
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
2263
3244
|
},
|
|
2264
3245
|
isBoolean: function isBoolean(r, n) {
|
|
2265
|
-
if ("boolean" != typeof n) throw new
|
|
3246
|
+
if ("boolean" != typeof n) throw new vt(e, r + " must be a boolean.");
|
|
2266
3247
|
return t;
|
|
2267
3248
|
},
|
|
2268
3249
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -2271,26 +3252,26 @@ var Te = function Te(e) {
|
|
|
2271
3252
|
};
|
|
2272
3253
|
return t;
|
|
2273
3254
|
};
|
|
2274
|
-
var
|
|
3255
|
+
var gt;
|
|
2275
3256
|
!function (e) {
|
|
2276
3257
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
2277
|
-
}(
|
|
3258
|
+
}(gt || (gt = {})), Promise.resolve({
|
|
2278
3259
|
pkceRequiredForEmailMagicLinks: !1
|
|
2279
3260
|
}), Promise.resolve({
|
|
2280
3261
|
pkceRequiredForPasswordResets: !1
|
|
2281
3262
|
}), Promise.resolve({
|
|
2282
3263
|
pkceRequiredForEmailMagicLinks: !1
|
|
2283
3264
|
});
|
|
2284
|
-
var
|
|
3265
|
+
var yt = Promise.resolve({
|
|
2285
3266
|
pkceRequiredForPasswordResets: !1
|
|
2286
3267
|
});
|
|
2287
|
-
var
|
|
2288
|
-
function
|
|
2289
|
-
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
3268
|
+
var kt = /*#__PURE__*/function () {
|
|
3269
|
+
function kt(e, t, r) {
|
|
3270
|
+
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : yt;
|
|
2290
3271
|
var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
2291
3272
|
return {
|
|
2292
3273
|
isEnabled: function isEnabled() {
|
|
2293
|
-
return
|
|
3274
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2294
3275
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2295
3276
|
while (1) switch (_context.prev = _context.next) {
|
|
2296
3277
|
case 0:
|
|
@@ -2303,7 +3284,7 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2303
3284
|
}));
|
|
2304
3285
|
},
|
|
2305
3286
|
getTelemetryID: function getTelemetryID() {
|
|
2306
|
-
return
|
|
3287
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2307
3288
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2308
3289
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2309
3290
|
case 0:
|
|
@@ -2314,7 +3295,7 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2314
3295
|
}));
|
|
2315
3296
|
},
|
|
2316
3297
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
2317
|
-
return
|
|
3298
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2318
3299
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2319
3300
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2320
3301
|
case 0:
|
|
@@ -2330,7 +3311,7 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2330
3311
|
}));
|
|
2331
3312
|
},
|
|
2332
3313
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
2333
|
-
return
|
|
3314
|
+
return mt(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
2334
3315
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2335
3316
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2336
3317
|
case 0:
|
|
@@ -2344,13 +3325,13 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2344
3325
|
}
|
|
2345
3326
|
};
|
|
2346
3327
|
}();
|
|
2347
|
-
_classCallCheck(this,
|
|
3328
|
+
_classCallCheck(this, kt);
|
|
2348
3329
|
this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
|
|
2349
3330
|
}
|
|
2350
|
-
_createClass(
|
|
3331
|
+
_createClass(kt, [{
|
|
2351
3332
|
key: "getCodeChallenge",
|
|
2352
3333
|
value: function getCodeChallenge() {
|
|
2353
|
-
return
|
|
3334
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
2354
3335
|
var _yield$this$_config, e, t;
|
|
2355
3336
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2356
3337
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -2391,12 +3372,12 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2391
3372
|
}, {
|
|
2392
3373
|
key: "authenticate",
|
|
2393
3374
|
value: function authenticate(e) {
|
|
2394
|
-
return
|
|
3375
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
2395
3376
|
var t, r, _yield$this$dfpProtec, n, i, o;
|
|
2396
3377
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2397
3378
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2398
3379
|
case 0:
|
|
2399
|
-
|
|
3380
|
+
bt("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);
|
|
2400
3381
|
_context6.next = 3;
|
|
2401
3382
|
return this._pkceManager.getPKPair();
|
|
2402
3383
|
case 3:
|
|
@@ -2451,12 +3432,12 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2451
3432
|
}, {
|
|
2452
3433
|
key: "resetByEmailStart",
|
|
2453
3434
|
value: function resetByEmailStart(e) {
|
|
2454
|
-
return
|
|
3435
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
2455
3436
|
var t, _yield$this$dfpProtec2, r, n;
|
|
2456
3437
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2457
3438
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2458
3439
|
case 0:
|
|
2459
|
-
|
|
3440
|
+
bt("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);
|
|
2460
3441
|
_context7.next = 3;
|
|
2461
3442
|
return this.getCodeChallenge();
|
|
2462
3443
|
case 3:
|
|
@@ -2494,12 +3475,12 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2494
3475
|
}, {
|
|
2495
3476
|
key: "resetByEmail",
|
|
2496
3477
|
value: function resetByEmail(e) {
|
|
2497
|
-
return
|
|
3478
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
2498
3479
|
var _yield$this$dfpProtec3, t, r, n, i, o;
|
|
2499
3480
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
2500
3481
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2501
3482
|
case 0:
|
|
2502
|
-
|
|
3483
|
+
bt("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);
|
|
2503
3484
|
_context8.next = 3;
|
|
2504
3485
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2505
3486
|
case 3:
|
|
@@ -2553,12 +3534,12 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2553
3534
|
}, {
|
|
2554
3535
|
key: "resetByExistingPassword",
|
|
2555
3536
|
value: function resetByExistingPassword(e) {
|
|
2556
|
-
return
|
|
3537
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
2557
3538
|
var _yield$this$dfpProtec4, t, r, n;
|
|
2558
3539
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
2559
3540
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2560
3541
|
case 0:
|
|
2561
|
-
|
|
3542
|
+
bt("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
|
|
2562
3543
|
_context9.next = 3;
|
|
2563
3544
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2564
3545
|
case 3:
|
|
@@ -2607,12 +3588,12 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2607
3588
|
}, {
|
|
2608
3589
|
key: "resetBySession",
|
|
2609
3590
|
value: function resetBySession(e) {
|
|
2610
|
-
return
|
|
3591
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
2611
3592
|
var _yield$this$dfpProtec5, t, r, n;
|
|
2612
3593
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
2613
3594
|
while (1) switch (_context10.prev = _context10.next) {
|
|
2614
3595
|
case 0:
|
|
2615
|
-
|
|
3596
|
+
bt("stytch.passwords.resetBySession").isString("password", e.password);
|
|
2616
3597
|
_context10.next = 3;
|
|
2617
3598
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2618
3599
|
case 3:
|
|
@@ -2652,11 +3633,11 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2652
3633
|
}, {
|
|
2653
3634
|
key: "strengthCheck",
|
|
2654
3635
|
value: function strengthCheck(e) {
|
|
2655
|
-
return
|
|
3636
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
2656
3637
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
2657
3638
|
while (1) switch (_context11.prev = _context11.next) {
|
|
2658
3639
|
case 0:
|
|
2659
|
-
return _context11.abrupt("return", (
|
|
3640
|
+
return _context11.abrupt("return", (bt("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
|
|
2660
3641
|
url: "/b2b/passwords/strength_check",
|
|
2661
3642
|
method: "POST",
|
|
2662
3643
|
errorMessage: "Failed to check password strength.",
|
|
@@ -2673,21 +3654,21 @@ var Ce = /*#__PURE__*/function () {
|
|
|
2673
3654
|
}));
|
|
2674
3655
|
}
|
|
2675
3656
|
}]);
|
|
2676
|
-
return
|
|
3657
|
+
return kt;
|
|
2677
3658
|
}();
|
|
2678
|
-
var
|
|
2679
|
-
var
|
|
2680
|
-
function
|
|
3659
|
+
var wt = "bootstrap";
|
|
3660
|
+
var St = /*#__PURE__*/function () {
|
|
3661
|
+
function St(e, t, r) {
|
|
2681
3662
|
var _this2 = this;
|
|
2682
|
-
_classCallCheck(this,
|
|
3663
|
+
_classCallCheck(this, St);
|
|
2683
3664
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
2684
3665
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
2685
3666
|
method: "GET",
|
|
2686
3667
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
2687
|
-
}).then(
|
|
2688
|
-
return _this2._dataLayer.setItem(
|
|
3668
|
+
}).then(St.mapBootstrapData).then(function (e) {
|
|
3669
|
+
return _this2._dataLayer.setItem(wt, JSON.stringify(e)), e;
|
|
2689
3670
|
})["catch"](function (e) {
|
|
2690
|
-
return
|
|
3671
|
+
return Ke(e), {
|
|
2691
3672
|
displayWatermark: !1,
|
|
2692
3673
|
cnameDomain: null,
|
|
2693
3674
|
emailDomains: ["stytch.com"],
|
|
@@ -2701,14 +3682,15 @@ var Re = /*#__PURE__*/function () {
|
|
|
2701
3682
|
slugPattern: null,
|
|
2702
3683
|
createOrganizationEnabled: !1,
|
|
2703
3684
|
passwordConfig: null,
|
|
2704
|
-
runDFPProtectedAuth: !1
|
|
3685
|
+
runDFPProtectedAuth: !1,
|
|
3686
|
+
rbacPolicy: null
|
|
2705
3687
|
};
|
|
2706
3688
|
});
|
|
2707
3689
|
}
|
|
2708
|
-
_createClass(
|
|
3690
|
+
_createClass(St, [{
|
|
2709
3691
|
key: "getSync",
|
|
2710
3692
|
value: function getSync() {
|
|
2711
|
-
var e = this._dataLayer.getItem(
|
|
3693
|
+
var e = this._dataLayer.getItem(wt);
|
|
2712
3694
|
if (null === e) return {
|
|
2713
3695
|
displayWatermark: !1,
|
|
2714
3696
|
cnameDomain: null,
|
|
@@ -2723,7 +3705,8 @@ var Re = /*#__PURE__*/function () {
|
|
|
2723
3705
|
slugPattern: null,
|
|
2724
3706
|
createOrganizationEnabled: !1,
|
|
2725
3707
|
passwordConfig: null,
|
|
2726
|
-
runDFPProtectedAuth: !1
|
|
3708
|
+
runDFPProtectedAuth: !1,
|
|
3709
|
+
rbacPolicy: null
|
|
2727
3710
|
};
|
|
2728
3711
|
try {
|
|
2729
3712
|
return JSON.parse(e);
|
|
@@ -2742,7 +3725,8 @@ var Re = /*#__PURE__*/function () {
|
|
|
2742
3725
|
slugPattern: null,
|
|
2743
3726
|
createOrganizationEnabled: !1,
|
|
2744
3727
|
passwordConfig: null,
|
|
2745
|
-
runDFPProtectedAuth: !1
|
|
3728
|
+
runDFPProtectedAuth: !1,
|
|
3729
|
+
rbacPolicy: null
|
|
2746
3730
|
};
|
|
2747
3731
|
}
|
|
2748
3732
|
}
|
|
@@ -2754,8 +3738,8 @@ var Re = /*#__PURE__*/function () {
|
|
|
2754
3738
|
}], [{
|
|
2755
3739
|
key: "mapBootstrapData",
|
|
2756
3740
|
value: function mapBootstrapData(e) {
|
|
2757
|
-
var t;
|
|
2758
|
-
var
|
|
3741
|
+
var t, r;
|
|
3742
|
+
var n = null !== e.password_config ? {
|
|
2759
3743
|
ludsComplexity: e.password_config.luds_complexity,
|
|
2760
3744
|
ludsMinimumCount: e.password_config.luds_minimum_count
|
|
2761
3745
|
} : null;
|
|
@@ -2770,19 +3754,20 @@ var Re = /*#__PURE__*/function () {
|
|
|
2770
3754
|
pkceRequiredForSso: e.pkce_required_for_sso,
|
|
2771
3755
|
slugPattern: e.slug_pattern,
|
|
2772
3756
|
createOrganizationEnabled: e.create_organization_enabled,
|
|
2773
|
-
passwordConfig:
|
|
3757
|
+
passwordConfig: n,
|
|
2774
3758
|
runDFPProtectedAuth: null !== (t = e.dfp_protected_auth_enabled) && void 0 !== t && t,
|
|
2775
|
-
dfpProtectedAuthMode: e.dfp_protected_auth_mode
|
|
3759
|
+
dfpProtectedAuthMode: e.dfp_protected_auth_mode,
|
|
3760
|
+
rbacPolicy: null !== (r = e.rbac_policy) && void 0 !== r ? r : null
|
|
2776
3761
|
};
|
|
2777
3762
|
}
|
|
2778
3763
|
}]);
|
|
2779
|
-
return
|
|
3764
|
+
return St;
|
|
2780
3765
|
}();
|
|
2781
|
-
var
|
|
3766
|
+
var Pt = /*#__PURE__*/_createClass(function Pt(e) {
|
|
2782
3767
|
var _this3 = this;
|
|
2783
|
-
_classCallCheck(this,
|
|
3768
|
+
_classCallCheck(this, Pt);
|
|
2784
3769
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
2785
|
-
return
|
|
3770
|
+
return mt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
2786
3771
|
var _yield$this$state, e, t, r;
|
|
2787
3772
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2788
3773
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -2813,7 +3798,7 @@ var xe = /*#__PURE__*/_createClass(function xe(e) {
|
|
|
2813
3798
|
}, _callee12, this);
|
|
2814
3799
|
}));
|
|
2815
3800
|
}, this.state = e.then(function (e) {
|
|
2816
|
-
return
|
|
3801
|
+
return mt(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
2817
3802
|
var t;
|
|
2818
3803
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2819
3804
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -2824,7 +3809,7 @@ var xe = /*#__PURE__*/_createClass(function xe(e) {
|
|
|
2824
3809
|
}
|
|
2825
3810
|
_context13.t1 = !0;
|
|
2826
3811
|
_context13.next = 4;
|
|
2827
|
-
return t = e.captchaSettings.siteKey,
|
|
3812
|
+
return t = e.captchaSettings.siteKey, Be("https://www.google.com/recaptcha/enterprise.js?render=".concat(t), function () {
|
|
2828
3813
|
return window.grecaptcha.enterprise;
|
|
2829
3814
|
});
|
|
2830
3815
|
case 4:
|
|
@@ -2851,18 +3836,18 @@ var xe = /*#__PURE__*/_createClass(function xe(e) {
|
|
|
2851
3836
|
}));
|
|
2852
3837
|
});
|
|
2853
3838
|
});
|
|
2854
|
-
var
|
|
2855
|
-
function
|
|
2856
|
-
_classCallCheck(this,
|
|
3839
|
+
var At = /*#__PURE__*/function () {
|
|
3840
|
+
function At(e, t, r, n) {
|
|
3841
|
+
_classCallCheck(this, At);
|
|
2857
3842
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
2858
3843
|
return null;
|
|
2859
|
-
}, this.eventLogger = new
|
|
3844
|
+
}, this.eventLogger = new He({
|
|
2860
3845
|
maxBatchSize: 15,
|
|
2861
3846
|
intervalDurationMs: 800,
|
|
2862
3847
|
logEventURL: this.buildSDKUrl("/events")
|
|
2863
3848
|
});
|
|
2864
3849
|
}
|
|
2865
|
-
_createClass(
|
|
3850
|
+
_createClass(At, [{
|
|
2866
3851
|
key: "logEvent",
|
|
2867
3852
|
value: function logEvent(_ref) {
|
|
2868
3853
|
var e = _ref.name,
|
|
@@ -2882,9 +3867,9 @@ var Ie = /*#__PURE__*/function () {
|
|
|
2882
3867
|
key: "createTelemetryBlob",
|
|
2883
3868
|
value: function createTelemetryBlob() {
|
|
2884
3869
|
return Object.assign(Object.assign({
|
|
2885
|
-
event_id: "event-id-".concat(
|
|
2886
|
-
app_session_id: "app-session-id-".concat(
|
|
2887
|
-
persistent_id: "persistent-id-".concat(
|
|
3870
|
+
event_id: "event-id-".concat(Re()),
|
|
3871
|
+
app_session_id: "app-session-id-".concat(Re()),
|
|
3872
|
+
persistent_id: "persistent-id-".concat(Re()),
|
|
2888
3873
|
client_sent_at: new Date().toISOString(),
|
|
2889
3874
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
2890
3875
|
}, this.additionalTelemetryDataFn()), {
|
|
@@ -2893,7 +3878,7 @@ var Ie = /*#__PURE__*/function () {
|
|
|
2893
3878
|
},
|
|
2894
3879
|
sdk: {
|
|
2895
3880
|
identifier: "Stytch.js Javascript SDK",
|
|
2896
|
-
version: "
|
|
3881
|
+
version: "4.1.0"
|
|
2897
3882
|
}
|
|
2898
3883
|
});
|
|
2899
3884
|
}
|
|
@@ -2904,13 +3889,13 @@ var Ie = /*#__PURE__*/function () {
|
|
|
2904
3889
|
t = _ref2.body,
|
|
2905
3890
|
r = _ref2.errorMessage,
|
|
2906
3891
|
n = _ref2.method;
|
|
2907
|
-
return
|
|
3892
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2908
3893
|
var i, o, s, a;
|
|
2909
3894
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2910
3895
|
while (1) switch (_context14.prev = _context14.next) {
|
|
2911
3896
|
case 0:
|
|
2912
3897
|
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;
|
|
2913
|
-
return _context14.abrupt("return",
|
|
3898
|
+
return _context14.abrupt("return", Ae({
|
|
2914
3899
|
basicAuthHeader: o,
|
|
2915
3900
|
body: t,
|
|
2916
3901
|
errorMessage: r,
|
|
@@ -2933,47 +3918,47 @@ var Ie = /*#__PURE__*/function () {
|
|
|
2933
3918
|
t = _ref3.body,
|
|
2934
3919
|
r = _ref3.errorMessage,
|
|
2935
3920
|
n = _ref3.method,
|
|
2936
|
-
|
|
2937
|
-
return
|
|
2938
|
-
var s, a, c
|
|
3921
|
+
i = _ref3.retryCallback;
|
|
3922
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
3923
|
+
var o, s, a, c;
|
|
2939
3924
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2940
3925
|
while (1) switch (_context15.prev = _context15.next) {
|
|
2941
3926
|
case 0:
|
|
2942
|
-
|
|
3927
|
+
o = this._subscriptionDataLayer.readSessionCookie().session_token, s = "Basic " + window.btoa(this._publicToken + ":" + (o || this._publicToken)), a = window.btoa(JSON.stringify(this.createTelemetryBlob())), c = window.location.origin;
|
|
2943
3928
|
return _context15.abrupt("return", function (e) {
|
|
2944
3929
|
var t = e.method,
|
|
2945
3930
|
r = e.errorMessage,
|
|
2946
3931
|
n = e.finalURL,
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
return
|
|
2953
|
-
var
|
|
2954
|
-
return
|
|
3932
|
+
i = e.basicAuthHeader,
|
|
3933
|
+
o = e.xSDKClientHeader,
|
|
3934
|
+
s = e.xSDKParentHostHeader,
|
|
3935
|
+
a = e.body,
|
|
3936
|
+
c = e.retryCallback;
|
|
3937
|
+
return we(this, void 0, void 0, de().mark(function e() {
|
|
3938
|
+
var u;
|
|
3939
|
+
return de().wrap(function (e) {
|
|
2955
3940
|
for (;;) switch (e.prev = e.next) {
|
|
2956
3941
|
case 0:
|
|
2957
|
-
return
|
|
3942
|
+
return u = {
|
|
2958
3943
|
method: t,
|
|
2959
3944
|
errorMessage: r,
|
|
2960
3945
|
finalURL: n,
|
|
2961
|
-
basicAuthHeader:
|
|
2962
|
-
xSDKClientHeader:
|
|
2963
|
-
xSDKParentHostHeader:
|
|
2964
|
-
body:
|
|
2965
|
-
}, e.prev = 1, e.next = 4,
|
|
3946
|
+
basicAuthHeader: i,
|
|
3947
|
+
xSDKClientHeader: o,
|
|
3948
|
+
xSDKParentHostHeader: s,
|
|
3949
|
+
body: a
|
|
3950
|
+
}, e.prev = 1, e.next = 4, Ae(u);
|
|
2966
3951
|
case 4:
|
|
2967
3952
|
case 15:
|
|
2968
3953
|
return e.abrupt("return", e.sent);
|
|
2969
3954
|
case 7:
|
|
2970
|
-
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof
|
|
3955
|
+
if (e.prev = 7, e.t0 = e["catch"](1), !(e.t0 instanceof Pe)) {
|
|
2971
3956
|
e.next = 16;
|
|
2972
3957
|
break;
|
|
2973
3958
|
}
|
|
2974
|
-
return e.next = 12,
|
|
3959
|
+
return e.next = 12, c(e.t0, u);
|
|
2975
3960
|
case 12:
|
|
2976
|
-
return
|
|
3961
|
+
return u = e.sent, e.next = 15, Ae(u);
|
|
2977
3962
|
case 16:
|
|
2978
3963
|
throw e.t0;
|
|
2979
3964
|
case 17:
|
|
@@ -2983,14 +3968,14 @@ var Ie = /*#__PURE__*/function () {
|
|
|
2983
3968
|
}, e, null, [[1, 7]]);
|
|
2984
3969
|
}));
|
|
2985
3970
|
}({
|
|
2986
|
-
basicAuthHeader:
|
|
3971
|
+
basicAuthHeader: s,
|
|
2987
3972
|
body: t,
|
|
2988
3973
|
errorMessage: r,
|
|
2989
3974
|
finalURL: this.buildSDKUrl(e),
|
|
2990
3975
|
method: n,
|
|
2991
|
-
xSDKClientHeader:
|
|
2992
|
-
xSDKParentHostHeader:
|
|
2993
|
-
retryCallback:
|
|
3976
|
+
xSDKClientHeader: a,
|
|
3977
|
+
xSDKParentHostHeader: c,
|
|
3978
|
+
retryCallback: i
|
|
2994
3979
|
}));
|
|
2995
3980
|
case 2:
|
|
2996
3981
|
case "end":
|
|
@@ -3005,18 +3990,18 @@ var Ie = /*#__PURE__*/function () {
|
|
|
3005
3990
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3006
3991
|
}
|
|
3007
3992
|
}]);
|
|
3008
|
-
return
|
|
3993
|
+
return At;
|
|
3009
3994
|
}();
|
|
3010
|
-
function
|
|
3995
|
+
function Ct(e) {
|
|
3011
3996
|
var t = e.toString(16);
|
|
3012
3997
|
return 1 === t.length && (t = "0" + t), t;
|
|
3013
3998
|
}
|
|
3014
|
-
var
|
|
3015
|
-
function
|
|
3016
|
-
_classCallCheck(this,
|
|
3999
|
+
var Tt = /*#__PURE__*/function () {
|
|
4000
|
+
function Tt(e, t) {
|
|
4001
|
+
_classCallCheck(this, Tt);
|
|
3017
4002
|
this._dataLayer = e, this.namespace = t;
|
|
3018
4003
|
}
|
|
3019
|
-
_createClass(
|
|
4004
|
+
_createClass(Tt, [{
|
|
3020
4005
|
key: "key",
|
|
3021
4006
|
value: function key() {
|
|
3022
4007
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3024,13 +4009,13 @@ var Le = /*#__PURE__*/function () {
|
|
|
3024
4009
|
}, {
|
|
3025
4010
|
key: "startPKCETransaction",
|
|
3026
4011
|
value: function startPKCETransaction() {
|
|
3027
|
-
return
|
|
4012
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
3028
4013
|
var e;
|
|
3029
4014
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
3030
4015
|
while (1) switch (_context16.prev = _context16.next) {
|
|
3031
4016
|
case 0:
|
|
3032
4017
|
_context16.next = 2;
|
|
3033
|
-
return
|
|
4018
|
+
return Tt.createProofkeyPair();
|
|
3034
4019
|
case 2:
|
|
3035
4020
|
e = _context16.sent;
|
|
3036
4021
|
return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -3048,7 +4033,7 @@ var Le = /*#__PURE__*/function () {
|
|
|
3048
4033
|
if (null !== e) try {
|
|
3049
4034
|
return JSON.parse(e);
|
|
3050
4035
|
} catch (e) {
|
|
3051
|
-
return void
|
|
4036
|
+
return void Ne("Found malformed Proof Key pair in localstorage.");
|
|
3052
4037
|
}
|
|
3053
4038
|
}
|
|
3054
4039
|
}, {
|
|
@@ -3059,7 +4044,7 @@ var Le = /*#__PURE__*/function () {
|
|
|
3059
4044
|
}], [{
|
|
3060
4045
|
key: "createProofkeyPair",
|
|
3061
4046
|
value: function createProofkeyPair() {
|
|
3062
|
-
return
|
|
4047
|
+
return mt(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
3063
4048
|
var _String$fromCharCode;
|
|
3064
4049
|
var e, t, r, n;
|
|
3065
4050
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
@@ -3067,7 +4052,7 @@ var Le = /*#__PURE__*/function () {
|
|
|
3067
4052
|
case 0:
|
|
3068
4053
|
e = new Uint32Array(16);
|
|
3069
4054
|
window.crypto.getRandomValues(e);
|
|
3070
|
-
t = Array.from(e).map(
|
|
4055
|
+
t = Array.from(e).map(Ct).join("");
|
|
3071
4056
|
_context17.next = 5;
|
|
3072
4057
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
3073
4058
|
case 5:
|
|
@@ -3084,14 +4069,14 @@ var Le = /*#__PURE__*/function () {
|
|
|
3084
4069
|
}));
|
|
3085
4070
|
}
|
|
3086
4071
|
}]);
|
|
3087
|
-
return
|
|
4072
|
+
return Tt;
|
|
3088
4073
|
}();
|
|
3089
|
-
var
|
|
3090
|
-
function
|
|
3091
|
-
_classCallCheck(this,
|
|
4074
|
+
var Ot = /*#__PURE__*/function () {
|
|
4075
|
+
function Ot(e) {
|
|
4076
|
+
_classCallCheck(this, Ot);
|
|
3092
4077
|
this._networkClient = e;
|
|
3093
4078
|
}
|
|
3094
|
-
_createClass(
|
|
4079
|
+
_createClass(Ot, [{
|
|
3095
4080
|
key: "searchUser",
|
|
3096
4081
|
value: function searchUser(e) {
|
|
3097
4082
|
return this._networkClient.fetchSDK({
|
|
@@ -3129,9 +4114,9 @@ var Me = /*#__PURE__*/function () {
|
|
|
3129
4114
|
});
|
|
3130
4115
|
}
|
|
3131
4116
|
}]);
|
|
3132
|
-
return
|
|
4117
|
+
return Ot;
|
|
3133
4118
|
}();
|
|
3134
|
-
var
|
|
4119
|
+
var Et = function Et(e) {
|
|
3135
4120
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
3136
4121
|
var _t$split = t.split("="),
|
|
3137
4122
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -3140,17 +4125,17 @@ var Ne = function Ne(e) {
|
|
|
3140
4125
|
}).length > 1;
|
|
3141
4126
|
};
|
|
3142
4127
|
/*! js-cookie v3.0.1 | MIT */
|
|
3143
|
-
function
|
|
4128
|
+
function xt(e) {
|
|
3144
4129
|
for (var t = 1; t < arguments.length; t++) {
|
|
3145
4130
|
var r = arguments[t];
|
|
3146
4131
|
for (var n in r) e[n] = r[n];
|
|
3147
4132
|
}
|
|
3148
4133
|
return e;
|
|
3149
4134
|
}
|
|
3150
|
-
var
|
|
4135
|
+
var Dt = function e(t, r) {
|
|
3151
4136
|
function n(e, n, i) {
|
|
3152
4137
|
if ("undefined" != typeof document) {
|
|
3153
|
-
"number" == typeof (i =
|
|
4138
|
+
"number" == typeof (i = xt({}, 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);
|
|
3154
4139
|
var o = "";
|
|
3155
4140
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
3156
4141
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -3172,15 +4157,15 @@ var Fe = function e(t, r) {
|
|
|
3172
4157
|
}
|
|
3173
4158
|
},
|
|
3174
4159
|
remove: function remove(e, t) {
|
|
3175
|
-
n(e, "",
|
|
4160
|
+
n(e, "", xt({}, t, {
|
|
3176
4161
|
expires: -1
|
|
3177
4162
|
}));
|
|
3178
4163
|
},
|
|
3179
4164
|
withAttributes: function withAttributes(t) {
|
|
3180
|
-
return e(this.converter,
|
|
4165
|
+
return e(this.converter, xt({}, this.attributes, t));
|
|
3181
4166
|
},
|
|
3182
4167
|
withConverter: function withConverter(t) {
|
|
3183
|
-
return e(
|
|
4168
|
+
return e(xt({}, this.converter, t), this.attributes);
|
|
3184
4169
|
}
|
|
3185
4170
|
}, {
|
|
3186
4171
|
attributes: {
|
|
@@ -3200,26 +4185,26 @@ var Fe = function e(t, r) {
|
|
|
3200
4185
|
}, {
|
|
3201
4186
|
path: "/"
|
|
3202
4187
|
});
|
|
3203
|
-
var
|
|
4188
|
+
var Rt = function Rt(e) {
|
|
3204
4189
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3205
4190
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
3206
4191
|
};
|
|
3207
|
-
var
|
|
3208
|
-
function
|
|
4192
|
+
var It = /*#__PURE__*/function () {
|
|
4193
|
+
function It(e, t) {
|
|
3209
4194
|
var _this4 = this;
|
|
3210
|
-
_classCallCheck(this,
|
|
4195
|
+
_classCallCheck(this, It);
|
|
3211
4196
|
this.browserSessionStorage = {
|
|
3212
4197
|
getItem: function getItem(e) {
|
|
3213
|
-
return sessionStorage.getItem(
|
|
4198
|
+
return sessionStorage.getItem(Rt(_this4.publicToken, e));
|
|
3214
4199
|
},
|
|
3215
4200
|
setItem: function setItem(e, t) {
|
|
3216
|
-
return sessionStorage.setItem(
|
|
4201
|
+
return sessionStorage.setItem(Rt(_this4.publicToken, e), t);
|
|
3217
4202
|
},
|
|
3218
4203
|
removeItem: function removeItem(e) {
|
|
3219
|
-
return sessionStorage.removeItem(
|
|
4204
|
+
return sessionStorage.removeItem(Rt(_this4.publicToken, e));
|
|
3220
4205
|
}
|
|
3221
|
-
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (
|
|
3222
|
-
var r = localStorage.getItem(
|
|
4206
|
+
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (qe("SubscriptionDataLayer").isOptionalString("cookieOptions.opaqueTokenCookieName", t.cookieOptions.opaqueTokenCookieName).isOptionalString("cookieOptions.jwtCookieName", t.cookieOptions.jwtCookieName).isOptionalString("cookieOptions.istCookieName", t.cookieOptions.istCookieName).isOptionalString("cookieOptions.path", t.cookieOptions.path).isOptionalString("cookieOptions.domain", t.cookieOptions.domain), this._jwtCookieName = t.cookieOptions.jwtCookieName || null, this._opaqueTokenCookieName = t.cookieOptions.opaqueTokenCookieName || null, this._cookiePath = t.cookieOptions.path || null, this._domain = t.cookieOptions.domain || null, this._cookieAvailableToSubdomains = t.cookieOptions.availableToSubdomains || !1, this._istCookieName = t.cookieOptions.istCookieName || null) : (this._opaqueTokenCookieName = null, this._jwtCookieName = null, this._cookiePath = null, this._domain = null, this._cookieAvailableToSubdomains = !1, this._istCookieName = null);
|
|
4207
|
+
var r = localStorage.getItem(Rt(this.publicToken));
|
|
3223
4208
|
if (!r) return;
|
|
3224
4209
|
var n;
|
|
3225
4210
|
try {
|
|
@@ -3229,7 +4214,7 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3229
4214
|
}
|
|
3230
4215
|
this.state = n;
|
|
3231
4216
|
}
|
|
3232
|
-
_createClass(
|
|
4217
|
+
_createClass(It, [{
|
|
3233
4218
|
key: "opaqueTokenCookieName",
|
|
3234
4219
|
get: function get() {
|
|
3235
4220
|
var e;
|
|
@@ -3251,14 +4236,14 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3251
4236
|
key: "readSessionCookie",
|
|
3252
4237
|
value: function readSessionCookie() {
|
|
3253
4238
|
return {
|
|
3254
|
-
session_token:
|
|
3255
|
-
session_jwt:
|
|
4239
|
+
session_token: Dt.get(this.opaqueTokenCookieName),
|
|
4240
|
+
session_jwt: Dt.get(this.jwtCookieName)
|
|
3256
4241
|
};
|
|
3257
4242
|
}
|
|
3258
4243
|
}, {
|
|
3259
4244
|
key: "readIntermediateSessionTokenCookie",
|
|
3260
4245
|
value: function readIntermediateSessionTokenCookie() {
|
|
3261
|
-
return
|
|
4246
|
+
return Dt.get(this.istCookieName);
|
|
3262
4247
|
}
|
|
3263
4248
|
}, {
|
|
3264
4249
|
key: "writeSessionCookie",
|
|
@@ -3267,32 +4252,32 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3267
4252
|
var o = e.state,
|
|
3268
4253
|
s = e.session_token,
|
|
3269
4254
|
a = e.session_jwt,
|
|
3270
|
-
c =
|
|
4255
|
+
c = It.generateCookieOpts({
|
|
3271
4256
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
3272
4257
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3273
4258
|
path: this._cookiePath,
|
|
3274
4259
|
domain: this._domain
|
|
3275
4260
|
});
|
|
3276
|
-
|
|
3277
|
-
var u =
|
|
4261
|
+
Dt.set(this.opaqueTokenCookieName, s, c), Dt.set(this.jwtCookieName, a, c);
|
|
4262
|
+
var u = It.generateCookieOpts({
|
|
3278
4263
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
3279
4264
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
3280
4265
|
path: this._cookiePath,
|
|
3281
4266
|
domain: this._domain
|
|
3282
4267
|
});
|
|
3283
|
-
|
|
4268
|
+
Et(this.jwtCookieName) && Dt.remove(this.jwtCookieName, u), Et(this.opaqueTokenCookieName) && Dt.remove(this.opaqueTokenCookieName, u), Et(this.jwtCookieName) && Ne("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), Et(this.opaqueTokenCookieName) && Ne("Could not remove extraneous opaque token cookie.");
|
|
3284
4269
|
}
|
|
3285
4270
|
}, {
|
|
3286
4271
|
key: "writeIntermediateSessionTokenCookie",
|
|
3287
4272
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
3288
4273
|
var t = new Date(Date.now() + 6e5),
|
|
3289
|
-
r =
|
|
4274
|
+
r = It.generateCookieOpts({
|
|
3290
4275
|
expiresAt: t.toString(),
|
|
3291
4276
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
3292
4277
|
path: this._cookiePath,
|
|
3293
4278
|
domain: this._domain
|
|
3294
4279
|
});
|
|
3295
|
-
|
|
4280
|
+
Dt.set(this.istCookieName, e, r);
|
|
3296
4281
|
}
|
|
3297
4282
|
}, {
|
|
3298
4283
|
key: "removeSessionCookie",
|
|
@@ -3311,14 +4296,14 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3311
4296
|
[!0, !1].forEach(function (t) {
|
|
3312
4297
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
3313
4298
|
[_this5._domain, null].forEach(function (n) {
|
|
3314
|
-
var i =
|
|
4299
|
+
var i = It.generateCookieOpts({
|
|
3315
4300
|
expiresAt: new Date(0).toString(),
|
|
3316
4301
|
availableToSubdomains: t,
|
|
3317
4302
|
path: r,
|
|
3318
4303
|
domain: n
|
|
3319
4304
|
});
|
|
3320
4305
|
e.forEach(function (e) {
|
|
3321
|
-
|
|
4306
|
+
Dt.remove(e, i);
|
|
3322
4307
|
});
|
|
3323
4308
|
});
|
|
3324
4309
|
});
|
|
@@ -3327,22 +4312,22 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3327
4312
|
}, {
|
|
3328
4313
|
key: "syncToLocalStorage",
|
|
3329
4314
|
value: function syncToLocalStorage() {
|
|
3330
|
-
localStorage.setItem(
|
|
4315
|
+
localStorage.setItem(Rt(this.publicToken), JSON.stringify(this.state));
|
|
3331
4316
|
}
|
|
3332
4317
|
}, {
|
|
3333
4318
|
key: "getItem",
|
|
3334
4319
|
value: function getItem(e) {
|
|
3335
|
-
return localStorage.getItem(
|
|
4320
|
+
return localStorage.getItem(Rt(this.publicToken, e));
|
|
3336
4321
|
}
|
|
3337
4322
|
}, {
|
|
3338
4323
|
key: "setItem",
|
|
3339
4324
|
value: function setItem(e, t) {
|
|
3340
|
-
return localStorage.setItem(
|
|
4325
|
+
return localStorage.setItem(Rt(this.publicToken, e), t);
|
|
3341
4326
|
}
|
|
3342
4327
|
}, {
|
|
3343
4328
|
key: "removeItem",
|
|
3344
4329
|
value: function removeItem(e) {
|
|
3345
|
-
return localStorage.removeItem(
|
|
4330
|
+
return localStorage.removeItem(Rt(this.publicToken, e));
|
|
3346
4331
|
}
|
|
3347
4332
|
}], [{
|
|
3348
4333
|
key: "generateCookieOpts",
|
|
@@ -3358,55 +4343,55 @@ var Ue = /*#__PURE__*/function () {
|
|
|
3358
4343
|
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;
|
|
3359
4344
|
}
|
|
3360
4345
|
}]);
|
|
3361
|
-
return
|
|
4346
|
+
return It;
|
|
3362
4347
|
}();
|
|
3363
|
-
var
|
|
3364
|
-
_inherits(
|
|
3365
|
-
var _super2 = _createSuper(
|
|
3366
|
-
function
|
|
3367
|
-
_classCallCheck(this,
|
|
4348
|
+
var Bt = /*#__PURE__*/function (_It) {
|
|
4349
|
+
_inherits(Bt, _It);
|
|
4350
|
+
var _super2 = _createSuper(Bt);
|
|
4351
|
+
function Bt() {
|
|
4352
|
+
_classCallCheck(this, Bt);
|
|
3368
4353
|
return _super2.apply(this, arguments);
|
|
3369
4354
|
}
|
|
3370
|
-
return _createClass(
|
|
3371
|
-
}(
|
|
3372
|
-
var
|
|
3373
|
-
|
|
4355
|
+
return _createClass(Bt);
|
|
4356
|
+
}(It);
|
|
4357
|
+
var Lt = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4358
|
+
Mt = function Mt(e, t) {
|
|
3374
4359
|
var r = function () {
|
|
3375
4360
|
var e = window;
|
|
3376
|
-
return e[
|
|
4361
|
+
return e[Lt] || (e[Lt] = {}), e[Lt];
|
|
3377
4362
|
}();
|
|
3378
|
-
return r[e] || (r[e] = new
|
|
4363
|
+
return r[e] || (r[e] = new Bt(e, t)), r[e];
|
|
3379
4364
|
},
|
|
3380
|
-
|
|
4365
|
+
jt = function jt(e, t) {
|
|
3381
4366
|
Object.values(e).forEach(function (e) {
|
|
3382
4367
|
return e(t);
|
|
3383
4368
|
});
|
|
3384
4369
|
},
|
|
3385
|
-
|
|
3386
|
-
var
|
|
3387
|
-
|
|
3388
|
-
return function
|
|
3389
|
-
return
|
|
3390
|
-
return !(e in
|
|
3391
|
-
}) && Object.entries(
|
|
3392
|
-
var
|
|
3393
|
-
return !
|
|
3394
|
-
}).every(function (
|
|
3395
|
-
var
|
|
3396
|
-
i =
|
|
3397
|
-
|
|
3398
|
-
return
|
|
3399
|
-
}) :
|
|
4370
|
+
Ft = function () {
|
|
4371
|
+
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4372
|
+
t = void 0 === e ? [] : e;
|
|
4373
|
+
return function e(r, n) {
|
|
4374
|
+
return le(r) === le(n) && (null === r || null === n ? r === n : "object" === le(r) ? Object.keys(r).length === Object.keys(n).length && !Object.keys(r).some(function (e) {
|
|
4375
|
+
return !(e in n);
|
|
4376
|
+
}) && Object.entries(r).filter(function (e) {
|
|
4377
|
+
var r = ae(e, 1)[0];
|
|
4378
|
+
return !t.includes(r);
|
|
4379
|
+
}).every(function (t) {
|
|
4380
|
+
var r = ae(t, 2),
|
|
4381
|
+
i = r[0],
|
|
4382
|
+
o = r[1];
|
|
4383
|
+
return e(o, n[i]);
|
|
4384
|
+
}) : r === n);
|
|
3400
4385
|
};
|
|
3401
4386
|
}({
|
|
3402
4387
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
3403
4388
|
});
|
|
3404
|
-
var
|
|
3405
|
-
function
|
|
4389
|
+
var Nt = /*#__PURE__*/function () {
|
|
4390
|
+
function Nt(e, t) {
|
|
3406
4391
|
var _this6 = this;
|
|
3407
|
-
_classCallCheck(this,
|
|
4392
|
+
_classCallCheck(this, Nt);
|
|
3408
4393
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
3409
|
-
if (e.key !==
|
|
4394
|
+
if (e.key !== Rt(_this6._publicToken)) return;
|
|
3410
4395
|
if (null === e.newValue || "null" === e.newValue) return void _this6.destroyState();
|
|
3411
4396
|
var t = JSON.parse(e.newValue);
|
|
3412
4397
|
_this6.updateState(t);
|
|
@@ -3415,7 +4400,7 @@ var Ye = /*#__PURE__*/function () {
|
|
|
3415
4400
|
r = _this$_datalayer$read.session_token;
|
|
3416
4401
|
r || this.destroyState();
|
|
3417
4402
|
}
|
|
3418
|
-
_createClass(
|
|
4403
|
+
_createClass(Nt, [{
|
|
3419
4404
|
key: "getTokens",
|
|
3420
4405
|
value: function getTokens() {
|
|
3421
4406
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -3446,7 +4431,7 @@ var Ye = /*#__PURE__*/function () {
|
|
|
3446
4431
|
value: function _updateStateAndTokensInternal(e) {
|
|
3447
4432
|
var t = this._datalayer.state,
|
|
3448
4433
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
3449
|
-
this._datalayer.state = r,
|
|
4434
|
+
this._datalayer.state = r, Ft(t, r) || jt(this._datalayer.subscriptions, r);
|
|
3450
4435
|
}
|
|
3451
4436
|
}, {
|
|
3452
4437
|
key: "updateStateAndTokens",
|
|
@@ -3458,7 +4443,7 @@ var Ye = /*#__PURE__*/function () {
|
|
|
3458
4443
|
value: function updateState(e) {
|
|
3459
4444
|
var t = this._datalayer.state,
|
|
3460
4445
|
r = null === e ? null : Object.assign(Object.assign({}, this._datalayer.state), e);
|
|
3461
|
-
this._datalayer.state = r,
|
|
4446
|
+
this._datalayer.state = r, Ft(t, r) || (jt(this._datalayer.subscriptions, r), this._datalayer.syncToLocalStorage());
|
|
3462
4447
|
}
|
|
3463
4448
|
}, {
|
|
3464
4449
|
key: "updateTokens",
|
|
@@ -3498,14 +4483,14 @@ var Ye = /*#__PURE__*/function () {
|
|
|
3498
4483
|
return null;
|
|
3499
4484
|
}
|
|
3500
4485
|
}]);
|
|
3501
|
-
return
|
|
4486
|
+
return Nt;
|
|
3502
4487
|
}();
|
|
3503
|
-
var
|
|
3504
|
-
_inherits(
|
|
3505
|
-
var _super3 = _createSuper(
|
|
3506
|
-
function
|
|
4488
|
+
var Kt = /*#__PURE__*/function (_Nt) {
|
|
4489
|
+
_inherits(Kt, _Nt);
|
|
4490
|
+
var _super3 = _createSuper(Kt);
|
|
4491
|
+
function Kt() {
|
|
3507
4492
|
var _this7;
|
|
3508
|
-
_classCallCheck(this,
|
|
4493
|
+
_classCallCheck(this, Kt);
|
|
3509
4494
|
_this7 = _super3.apply(this, arguments), _this7.updateMember = function (e) {
|
|
3510
4495
|
return _this7.updateState({
|
|
3511
4496
|
member: e
|
|
@@ -3519,50 +4504,50 @@ var Ve = /*#__PURE__*/function (_Ye) {
|
|
|
3519
4504
|
};
|
|
3520
4505
|
return _this7;
|
|
3521
4506
|
}
|
|
3522
|
-
return _createClass(
|
|
3523
|
-
}(
|
|
3524
|
-
var
|
|
3525
|
-
var
|
|
4507
|
+
return _createClass(Kt);
|
|
4508
|
+
}(Nt);
|
|
4509
|
+
var Ut = Symbol["for"]("stytch__internal_b2b");
|
|
4510
|
+
var zt = /*#__PURE__*/_createClass(function zt(e, t) {
|
|
3526
4511
|
var _this8 = this;
|
|
3527
|
-
_classCallCheck(this,
|
|
4512
|
+
_classCallCheck(this, zt);
|
|
3528
4513
|
var r;
|
|
3529
4514
|
!function (e) {
|
|
3530
4515
|
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"));
|
|
3531
|
-
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ?
|
|
3532
|
-
var
|
|
3533
|
-
|
|
3534
|
-
cookieOptions: null == (
|
|
4516
|
+
}("StytchB2BHeadlessClient"), "string" != typeof (r = e) ? Ne("Public token is malformed. Expected a string, got ".concat(le(r), ".").concat(Ue)) : "" === r ? Ne('Public token is malformed. Expected "public-token-...", got an empty string.'.concat(Ue)) : r.startsWith("public-token-") || Ne('Public token is malformed. Expected "public-token-...", got '.concat(r, ".").concat(Ue));
|
|
4517
|
+
var n = t,
|
|
4518
|
+
i = {
|
|
4519
|
+
cookieOptions: null == (o = n) ? void 0 : o.cookieOptions,
|
|
3535
4520
|
endpoints: {
|
|
3536
|
-
sdkBackendURL: null !== (
|
|
3537
|
-
testAPIURL: null !== (
|
|
3538
|
-
liveAPIURL: null !== (
|
|
3539
|
-
dfpBackendURL: null !== (
|
|
3540
|
-
clientsideServicesIframeURL: null !== (f = null === (
|
|
4521
|
+
sdkBackendURL: null !== (a = null === (s = null == o ? void 0 : o.endpoints) || void 0 === s ? void 0 : s.sdkBackendURL) && void 0 !== a ? a : "https://web.stytch.com",
|
|
4522
|
+
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",
|
|
4523
|
+
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",
|
|
4524
|
+
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",
|
|
4525
|
+
clientsideServicesIframeURL: null !== (f = null === (_ = null == o ? void 0 : o.endpoints) || void 0 === _ ? void 0 : _.clientsideServicesIframeURL) && void 0 !== f ? f : "https://js.stytch.com/clientside-services/index.html"
|
|
3541
4526
|
}
|
|
3542
4527
|
};
|
|
3543
|
-
var s, a, c, u, l, d, h, p, _,
|
|
3544
|
-
this._dataLayer =
|
|
3545
|
-
var
|
|
3546
|
-
this._networkClient = new
|
|
4528
|
+
var o, s, a, c, u, l, d, h, p, _, f;
|
|
4529
|
+
this._dataLayer = Mt(e, n), this._subscriptionService = new Kt(e, this._dataLayer);
|
|
4530
|
+
var m = new Tt(this._dataLayer, "passwords");
|
|
4531
|
+
this._networkClient = new At(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
3547
4532
|
var e, t, r, n;
|
|
3548
4533
|
return {
|
|
3549
4534
|
stytch_member_id: null === (t = null === (e = _this8._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
3550
4535
|
stytch_member_session_id: null === (n = null === (r = _this8._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
3551
4536
|
};
|
|
3552
4537
|
});
|
|
3553
|
-
var
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
this.organization = new
|
|
4538
|
+
var v = new St(e, this._networkClient, this._dataLayer),
|
|
4539
|
+
b = new Pt(v.getAsync()),
|
|
4540
|
+
g = new We(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
4541
|
+
this.organization = new Xe(this._networkClient, this._subscriptionService), this.member = new Je(this._networkClient, this._subscriptionService), this.self = new Je(this._networkClient, this._subscriptionService), this.session = new Qe(this._networkClient, this._subscriptionService), this.magicLinks = new Ve(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ze(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
3557
4542
|
publicToken: e,
|
|
3558
|
-
testAPIURL:
|
|
3559
|
-
liveAPIURL:
|
|
3560
|
-
},
|
|
4543
|
+
testAPIURL: i.endpoints.testAPIURL,
|
|
4544
|
+
liveAPIURL: i.endpoints.liveAPIURL
|
|
4545
|
+
}, g), this.sso = new $e(this._networkClient, this._subscriptionService, new Tt(this._dataLayer, "sso"), v.getAsync(), {
|
|
3561
4546
|
publicToken: e,
|
|
3562
|
-
testAPIURL:
|
|
3563
|
-
liveAPIURL:
|
|
3564
|
-
}), this.discovery = new
|
|
3565
|
-
var
|
|
4547
|
+
testAPIURL: i.endpoints.testAPIURL,
|
|
4548
|
+
liveAPIURL: i.endpoints.liveAPIURL
|
|
4549
|
+
}), this.discovery = new et(this._networkClient, this._subscriptionService), this.passwords = new kt(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new tt(this._networkClient, this._subscriptionService, g), this.totp = new rt(this._networkClient, this._subscriptionService, g), this.rbac = new nt(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new it(this._subscriptionService, this.session);
|
|
4550
|
+
var y = new Ot(this._networkClient);
|
|
3566
4551
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
3567
4552
|
name: "b2b_sdk_instance_instantiated",
|
|
3568
4553
|
details: {
|
|
@@ -3572,215 +4557,13 @@ var Je = /*#__PURE__*/_createClass(function Je(e, t) {
|
|
|
3572
4557
|
}
|
|
3573
4558
|
});
|
|
3574
4559
|
(function (e, t) {
|
|
3575
|
-
Object.assign(e, _defineProperty({},
|
|
4560
|
+
Object.assign(e, _defineProperty({}, Ut, t));
|
|
3576
4561
|
})(this, {
|
|
3577
|
-
bootstrap:
|
|
4562
|
+
bootstrap: v,
|
|
3578
4563
|
publicToken: e,
|
|
3579
|
-
searchManager:
|
|
4564
|
+
searchManager: y,
|
|
3580
4565
|
dataLayer: this._dataLayer,
|
|
3581
4566
|
networkClient: this._networkClient
|
|
3582
4567
|
});
|
|
3583
4568
|
});
|
|
3584
|
-
|
|
3585
|
-
return Xe = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) {
|
|
3586
|
-
return _typeof(e);
|
|
3587
|
-
} : function (e) {
|
|
3588
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof(e);
|
|
3589
|
-
}, Xe(e);
|
|
3590
|
-
}
|
|
3591
|
-
function Ze(e, t) {
|
|
3592
|
-
for (var r = 0; r < t.length; r++) {
|
|
3593
|
-
var n = t[r];
|
|
3594
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, (i = n.key, o = void 0, o = function (e, t) {
|
|
3595
|
-
if ("object" !== Xe(e) || null === e) return e;
|
|
3596
|
-
var r = e[Symbol.toPrimitive];
|
|
3597
|
-
if (void 0 !== r) {
|
|
3598
|
-
var n = r.call(e, t || "default");
|
|
3599
|
-
if ("object" !== Xe(n)) return n;
|
|
3600
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3601
|
-
}
|
|
3602
|
-
return ("string" === t ? String : Number)(e);
|
|
3603
|
-
}(i, "string"), "symbol" === Xe(o) ? o : String(o)), n);
|
|
3604
|
-
}
|
|
3605
|
-
var i, o;
|
|
3606
|
-
}
|
|
3607
|
-
function Qe(e, t, r) {
|
|
3608
|
-
return t && Ze(e.prototype, t), r && Ze(e, r), Object.defineProperty(e, "prototype", {
|
|
3609
|
-
writable: !1
|
|
3610
|
-
}), e;
|
|
3611
|
-
}
|
|
3612
|
-
function et(e, t) {
|
|
3613
|
-
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
3614
|
-
}
|
|
3615
|
-
function tt(e, t) {
|
|
3616
|
-
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
3617
|
-
e.prototype = Object.create(t && t.prototype, {
|
|
3618
|
-
constructor: {
|
|
3619
|
-
value: e,
|
|
3620
|
-
writable: !0,
|
|
3621
|
-
configurable: !0
|
|
3622
|
-
}
|
|
3623
|
-
}), Object.defineProperty(e, "prototype", {
|
|
3624
|
-
writable: !1
|
|
3625
|
-
}), t && at(e, t);
|
|
3626
|
-
}
|
|
3627
|
-
function rt(e) {
|
|
3628
|
-
var t = st();
|
|
3629
|
-
return function () {
|
|
3630
|
-
var r,
|
|
3631
|
-
n = ct(e);
|
|
3632
|
-
if (t) {
|
|
3633
|
-
var i = ct(this).constructor;
|
|
3634
|
-
r = Reflect.construct(n, arguments, i);
|
|
3635
|
-
} else r = n.apply(this, arguments);
|
|
3636
|
-
return function (e, t) {
|
|
3637
|
-
if (t && ("object" === Xe(t) || "function" == typeof t)) return t;
|
|
3638
|
-
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
3639
|
-
return nt(e);
|
|
3640
|
-
}(this, r);
|
|
3641
|
-
};
|
|
3642
|
-
}
|
|
3643
|
-
function nt(e) {
|
|
3644
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
3645
|
-
return e;
|
|
3646
|
-
}
|
|
3647
|
-
function it(e) {
|
|
3648
|
-
var t = "function" == typeof Map ? new Map() : void 0;
|
|
3649
|
-
return it = function it(e) {
|
|
3650
|
-
if (null === e || !function (e) {
|
|
3651
|
-
try {
|
|
3652
|
-
return -1 !== Function.toString.call(e).indexOf("[native code]");
|
|
3653
|
-
} catch (t) {
|
|
3654
|
-
return "function" == typeof e;
|
|
3655
|
-
}
|
|
3656
|
-
}(e)) return e;
|
|
3657
|
-
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
|
|
3658
|
-
if (void 0 !== t) {
|
|
3659
|
-
if (t.has(e)) return t.get(e);
|
|
3660
|
-
t.set(e, r);
|
|
3661
|
-
}
|
|
3662
|
-
function r() {
|
|
3663
|
-
return ot(e, arguments, ct(this).constructor);
|
|
3664
|
-
}
|
|
3665
|
-
return r.prototype = Object.create(e.prototype, {
|
|
3666
|
-
constructor: {
|
|
3667
|
-
value: r,
|
|
3668
|
-
enumerable: !1,
|
|
3669
|
-
writable: !0,
|
|
3670
|
-
configurable: !0
|
|
3671
|
-
}
|
|
3672
|
-
}), at(r, e);
|
|
3673
|
-
}, it(e);
|
|
3674
|
-
}
|
|
3675
|
-
function ot(e, t, r) {
|
|
3676
|
-
return ot = st() ? Reflect.construct.bind() : function (e, t, r) {
|
|
3677
|
-
var n = [null];
|
|
3678
|
-
n.push.apply(n, t);
|
|
3679
|
-
var i = new (Function.bind.apply(e, n))();
|
|
3680
|
-
return r && at(i, r.prototype), i;
|
|
3681
|
-
}, ot.apply(null, arguments);
|
|
3682
|
-
}
|
|
3683
|
-
function st() {
|
|
3684
|
-
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
|
3685
|
-
if (Reflect.construct.sham) return !1;
|
|
3686
|
-
if ("function" == typeof Proxy) return !0;
|
|
3687
|
-
try {
|
|
3688
|
-
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
|
|
3689
|
-
} catch (e) {
|
|
3690
|
-
return !1;
|
|
3691
|
-
}
|
|
3692
|
-
}
|
|
3693
|
-
function at(e, t) {
|
|
3694
|
-
return at = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (e, t) {
|
|
3695
|
-
return e.__proto__ = t, e;
|
|
3696
|
-
}, at(e, t);
|
|
3697
|
-
}
|
|
3698
|
-
function ct(e) {
|
|
3699
|
-
return ct = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (e) {
|
|
3700
|
-
return e.__proto__ || Object.getPrototypeOf(e);
|
|
3701
|
-
}, ct(e);
|
|
3702
|
-
}
|
|
3703
|
-
var ut, lt, dt, ht, pt, _t;
|
|
3704
|
-
!function (e) {
|
|
3705
|
-
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
3706
|
-
}(ut || (ut = {})), function (e) {
|
|
3707
|
-
e.Google = "google", e.Microsoft = "microsoft", e.Apple = "apple", e.Github = "github", e.GitLab = "gitlab", e.Facebook = "facebook", e.Discord = "discord", e.Salesforce = "salesforce", e.Slack = "slack", e.Amazon = "amazon", e.Bitbucket = "bitbucket", e.LinkedIn = "linkedin", e.Coinbase = "coinbase", e.Twitch = "twitch", e.Twitter = "twitter", e.TikTok = "tiktok", e.Snapchat = "snapchat", e.Figma = "figma", e.Yahoo = "yahoo";
|
|
3708
|
-
}(lt || (lt = {})), function (e) {
|
|
3709
|
-
e.Vessel = "Vessel", e.Phantom = "Phantom", e.Metamask = "Metamask", e.Coinbase = "Coinbase", e.Binance = "Binance", e.GenericEthereumWallet = "Other Ethereum Wallet", e.GenericSolanaWallet = "Other Solana Wallet";
|
|
3710
|
-
}(dt || (dt = {})), function (e) {
|
|
3711
|
-
e.embedded = "embedded", e.floating = "floating";
|
|
3712
|
-
}(ht || (ht = {})), function (e) {
|
|
3713
|
-
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
3714
|
-
}(pt || (pt = {})), function (e) {
|
|
3715
|
-
e.MagicLinkLoginOrCreateEvent = "MAGIC_LINK_LOGIN_OR_CREATE", e.OTPsLoginOrCreateEvent = "OTP_LOGIN_OR_CREATE", e.OTPsAuthenticate = "OTP_AUTHENTICATE", e.CryptoWalletAuthenticateStart = "CRYPTO_WALLET_AUTHENTICATE_START", e.CryptoWalletAuthenticate = "CRYPTO_WALLET_AUTHENTICATE", e.PasswordCreate = "PASSWORD_CREATE", e.PasswordAuthenticate = "PASSWORD_AUTHENTICATE", e.PasswordResetByEmailStart = "PASSWORD_RESET_BY_EMAIL_START", e.PasswordResetByEmail = "PASSWORD_RESET_BY_EMAIL", e.PasskeyRegister = "PASSKEY_REGISTER", e.PasskeyAuthenticate = "PASSKEY_AUTHENTICATE", e.PasskeySkip = "PASSKEY_SKIP", e.PasskeyDone = "PASSKEY_DONE", e.B2BMagicLinkEmailLoginOrSignup = "B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP", e.B2BMagicLinkAuthenticate = "B2B_MAGIC_LINK_AUTHENTICATE", e.B2BMagicLinkEmailDiscoverySend = "B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND", e.B2BMagicLinkDiscoveryAuthenticate = "B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE", e.B2BSSOStart = "B2B_SSO_START", e.B2BSSOAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthAuthenticate = "B2B_SSO_AUTHENTICATE", e.B2BOAuthDiscoveryAuthenticate = "B2B_OAUTH_DISCOVERY_AUTHENTICATE", e.B2BDiscoveryOrganizationsCreate = "B2B_DISCOVERY_ORGANIZATIONS_CREATE", e.B2BDiscoveryIntermediateSessionExchange = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE", e.B2BPasswordAuthenticate = "B2B_PASSWORD_AUTHENTICATE", e.B2BPasswordResetByEmailStart = "B2B_PASSWORD_RESET_BY_EMAIL_START", e.B2BPasswordResetByEmail = "B2B_PASSWORD_RESET_BY_EMAIL", e.B2BPasswordResetBySession = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
3716
|
-
}(_t || (_t = {}));
|
|
3717
|
-
var mt,
|
|
3718
|
-
ft,
|
|
3719
|
-
vt,
|
|
3720
|
-
bt,
|
|
3721
|
-
gt = function (e) {
|
|
3722
|
-
tt(r, it(Error));
|
|
3723
|
-
var t = rt(r);
|
|
3724
|
-
function r(e, n) {
|
|
3725
|
-
var i;
|
|
3726
|
-
return et(this, r), (i = t.call(this, e + "\n" + n)).message = e + "\n" + n, i.name = "SDKAPIUnreachableError", i.details = n, Object.setPrototypeOf(nt(i), r.prototype), i;
|
|
3727
|
-
}
|
|
3728
|
-
return Qe(r);
|
|
3729
|
-
}(),
|
|
3730
|
-
yt = function (e) {
|
|
3731
|
-
tt(r, it(Error));
|
|
3732
|
-
var t = rt(r);
|
|
3733
|
-
function r(e, n) {
|
|
3734
|
-
var i;
|
|
3735
|
-
return et(this, r), (i = t.call(this)).name = "StytchSDKUsageError", i.message = "Invalid call to ".concat(e, "\n") + n, i;
|
|
3736
|
-
}
|
|
3737
|
-
return Qe(r);
|
|
3738
|
-
}(),
|
|
3739
|
-
kt = function (e) {
|
|
3740
|
-
tt(r, it(Error));
|
|
3741
|
-
var t = rt(r);
|
|
3742
|
-
function r(e) {
|
|
3743
|
-
var n, i;
|
|
3744
|
-
et(this, r), (n = t.call(this)).name = "StytchSDKSchemaError";
|
|
3745
|
-
var o = null === (i = e.body) || void 0 === i ? void 0 : i.map(function (e) {
|
|
3746
|
-
return "".concat(e.dataPath, ": ").concat(e.message);
|
|
3747
|
-
}).join("\n");
|
|
3748
|
-
return n.message = "[400] Request does not match expected schema\n".concat(o), n;
|
|
3749
|
-
}
|
|
3750
|
-
return Qe(r);
|
|
3751
|
-
}(),
|
|
3752
|
-
St = function (e) {
|
|
3753
|
-
tt(r, it(Error));
|
|
3754
|
-
var t = rt(r);
|
|
3755
|
-
function r(e) {
|
|
3756
|
-
var n;
|
|
3757
|
-
et(this, r), (n = t.call(this)).name = "StytchSDKAPIError";
|
|
3758
|
-
var i = e.status_code,
|
|
3759
|
-
o = e.error_type,
|
|
3760
|
-
s = e.error_message,
|
|
3761
|
-
a = e.error_url,
|
|
3762
|
-
c = e.request_id;
|
|
3763
|
-
return n.error_type = o, n.error_message = s, n.error_url = a, n.request_id = c, n.status_code = i, n.message = "[".concat(i, "] ").concat(o, "\n") + "".concat(s, "\n") + "See ".concat(a, " for more information.\n") + (c ? "request_id: ".concat(c, "\n") : ""), n;
|
|
3764
|
-
}
|
|
3765
|
-
return Qe(r);
|
|
3766
|
-
}(),
|
|
3767
|
-
wt = function (e) {
|
|
3768
|
-
tt(r, it(Error));
|
|
3769
|
-
var t = rt(r);
|
|
3770
|
-
function r(e) {
|
|
3771
|
-
var n;
|
|
3772
|
-
return et(this, r), (n = t.call(this)).name = "StytchSDKNativeError", n.error_type = e, n.message = "".concat(e), n;
|
|
3773
|
-
}
|
|
3774
|
-
return Qe(r);
|
|
3775
|
-
}(),
|
|
3776
|
-
At = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|
|
3777
|
-
!function (e) {
|
|
3778
|
-
e.BiometricsSensorError = "biometrics_sensor_error", e.DeviceCredentialsNotAllowed = "device_credentials_not_allowed", e.DeviceHardwareError = "device_hardware_error", e.InternalError = "internal_error", e.KeyInvalidated = "key_invalidated", e.KeystoreUnavailable = "keystore_unavailable", e.NoBiometricsEnrolled = "no_biometrics_enrolled", e.NoBiometricsRegistration = "no_biometrics_registration", e.SessionExpired = "session_expired", e.UserCancellation = "user_cancellation", e.UserLockedOut = "user_locked_out", e.BiometricsNotAvailable = "biometrics_not_available";
|
|
3779
|
-
}(mt || (mt = {})), function (e) {
|
|
3780
|
-
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3781
|
-
}(ft || (ft = {})), function (e) {
|
|
3782
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3783
|
-
}(vt || (vt = {})), function (e) {
|
|
3784
|
-
e.Google = "google", e.Microsoft = "microsoft";
|
|
3785
|
-
}(bt || (bt = {}));
|
|
3786
|
-
export { vt as AuthFlowType, bt as B2BOAuthProviders, ft as B2BProducts, mt as BiometricsErrors, lt as OAuthProviders, pt as OTPMethods, ht as OneTapPositions, ut as Products, gt as SDKAPIUnreachableError, Je as StytchB2BHeadlessClient, _t as StytchEventType, St as StytchSDKAPIError, wt as StytchSDKNativeError, kt as StytchSDKSchemaError, yt as StytchSDKUsageError, At as UNRECOVERABLE_ERROR_TYPES, dt as Wallets };
|
|
4569
|
+
export { g as AuthFlowType, y as B2BOAuthProviders, b as B2BProducts, X as BiometricsFailedError, B as BiometricsUnavailableError, H as ChallengeSigningFailedError, K as DeviceCredentialsNotAllowedError, V as FailedCodeChallengeError, $ as FailedToDecryptDataError, R as InternalError, W as InvalidAuthorizationCredentialError, te as InvalidCredentialTypeError, Q as InvalidRedirectSchemeError, Z as InvalidStartUrlError, ne as JSONDataNotConvertibleToStringError, L as KeyInvalidatedError, M as KeystoreUnavailableError, re as MissingAttestationObjectError, q as MissingAuthorizationCredentialIDTokenError, U as MissingGoogleClientIDError, z as MissingPKCEError, G as MissingPublicKeyError, ee as MissingUrlError, j as NoBiometricsEnrolledError, I as NoBiometricsRegistrationError, D as NoCurrentSessionError, p as OAuthProviders, m as OTPMethods, f as OneTapPositions, oe as PasskeysInvalidEncoding, J as PasskeysUnsupportedError, h as Products, ie as RandomNumberGenerationFailed, k as SDKAPIUnreachableError, Y as SDKNotConfiguredError, E as StytchAPIError, O as StytchAPISchemaError, T as StytchAPIUnreachableError, zt as StytchB2BHeadlessClient, C as StytchError, v as StytchEventType, P as StytchSDKAPIError, x as StytchSDKError, S as StytchSDKSchemaError, w as StytchSDKUsageError, A as UNRECOVERABLE_ERROR_TYPES, F as UserCancellationError, N as UserLockedOutError, _ as Wallets, se as errorToStytchError };
|