@stytch/vanilla-js 4.3.2 → 4.4.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 +12 -0
- package/dist/b2b/index.d.ts +2 -1
- package/dist/b2b/index.esm.d.ts +2 -1
- package/dist/b2b/index.esm.js +2380 -2266
- package/dist/b2b/index.headless.d.ts +2 -1
- package/dist/b2b/index.headless.esm.d.ts +2 -1
- package/dist/b2b/index.headless.esm.js +332 -214
- package/dist/b2b/index.headless.js +312 -194
- package/dist/b2b/index.js +2937 -2823
- package/dist/index.esm.js +1 -5
- package/dist/index.headless.esm.js +1 -1
- package/dist/index.headless.js +1 -1
- package/dist/index.js +317 -321
- package/package.json +2 -2
|
@@ -401,7 +401,7 @@ var h = function (e) {
|
|
|
401
401
|
}
|
|
402
402
|
return r(s);
|
|
403
403
|
}(),
|
|
404
|
-
|
|
404
|
+
K = function (e) {
|
|
405
405
|
i(s, k);
|
|
406
406
|
var t = o(s);
|
|
407
407
|
function s() {
|
|
@@ -409,7 +409,7 @@ var h = function (e) {
|
|
|
409
409
|
}
|
|
410
410
|
return r(s);
|
|
411
411
|
}(),
|
|
412
|
-
|
|
412
|
+
N = function (e) {
|
|
413
413
|
i(s, k);
|
|
414
414
|
var t = o(s);
|
|
415
415
|
function s() {
|
|
@@ -417,7 +417,7 @@ var h = function (e) {
|
|
|
417
417
|
}
|
|
418
418
|
return r(s);
|
|
419
419
|
}(),
|
|
420
|
-
|
|
420
|
+
z = function (e) {
|
|
421
421
|
i(s, k);
|
|
422
422
|
var t = o(s);
|
|
423
423
|
function s() {
|
|
@@ -425,7 +425,7 @@ var h = function (e) {
|
|
|
425
425
|
}
|
|
426
426
|
return r(s);
|
|
427
427
|
}(),
|
|
428
|
-
|
|
428
|
+
U = function (e) {
|
|
429
429
|
i(s, k);
|
|
430
430
|
var t = o(s);
|
|
431
431
|
function s() {
|
|
@@ -1780,7 +1780,7 @@ var Fe = Promise.resolve({
|
|
|
1780
1780
|
}
|
|
1781
1781
|
}]), e;
|
|
1782
1782
|
}(),
|
|
1783
|
-
|
|
1783
|
+
Ke = ne(function e(t, r) {
|
|
1784
1784
|
var n = this;
|
|
1785
1785
|
ie(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
1786
1786
|
return he(n, void 0, void 0, te().mark(function e() {
|
|
@@ -1868,7 +1868,7 @@ var Fe = Promise.resolve({
|
|
|
1868
1868
|
}));
|
|
1869
1869
|
};
|
|
1870
1870
|
}),
|
|
1871
|
-
|
|
1871
|
+
Ne = function () {
|
|
1872
1872
|
function e(t, r, n, i, o) {
|
|
1873
1873
|
var s = this,
|
|
1874
1874
|
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Le();
|
|
@@ -2139,7 +2139,7 @@ var Fe = Promise.resolve({
|
|
|
2139
2139
|
}
|
|
2140
2140
|
}]), e;
|
|
2141
2141
|
}(),
|
|
2142
|
-
|
|
2142
|
+
ze = ne(function e(t, r) {
|
|
2143
2143
|
var n = this;
|
|
2144
2144
|
ie(this, e), this._networkClient = t, this._subscriptionService = r, this.get = function () {
|
|
2145
2145
|
return he(n, void 0, void 0, te().mark(function e() {
|
|
@@ -2331,7 +2331,7 @@ var Fe = Promise.resolve({
|
|
|
2331
2331
|
}
|
|
2332
2332
|
};
|
|
2333
2333
|
}),
|
|
2334
|
-
|
|
2334
|
+
Ue = function () {
|
|
2335
2335
|
function e(t, r, n, i, o) {
|
|
2336
2336
|
var s = this,
|
|
2337
2337
|
a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : Le();
|
|
@@ -2807,17 +2807,26 @@ var Ge = ne(function e(t, r) {
|
|
|
2807
2807
|
case 0:
|
|
2808
2808
|
return Be("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();
|
|
2809
2809
|
case 3:
|
|
2810
|
-
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.
|
|
2810
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
2811
|
+
case 13:
|
|
2812
|
+
if (t.t5 = t.sent, t.t5) {
|
|
2813
|
+
t.next = 16;
|
|
2814
|
+
break;
|
|
2815
|
+
}
|
|
2816
|
+
t.t5 = void 0;
|
|
2817
|
+
case 16:
|
|
2818
|
+
return t.t6 = t.t5, t.t7 = {
|
|
2819
|
+
dfp_telemetry_id: t.t3,
|
|
2820
|
+
captcha_token: t.t4,
|
|
2821
|
+
intermediate_session_token: t.t6
|
|
2822
|
+
}, t.t8 = t.t1.assign.call(t.t1, t.t2, t.t7), t.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t10 = {
|
|
2811
2823
|
url: "/b2b/otps/sms/send",
|
|
2812
|
-
body:
|
|
2813
|
-
dfp_telemetry_id: n,
|
|
2814
|
-
captcha_token: i
|
|
2815
|
-
}),
|
|
2824
|
+
body: t.t8,
|
|
2816
2825
|
errorMessage: "Failed to send one time passcode",
|
|
2817
2826
|
method: "POST",
|
|
2818
|
-
retryCallback:
|
|
2819
|
-
}));
|
|
2820
|
-
case
|
|
2827
|
+
retryCallback: t.t9
|
|
2828
|
+
}, t.abrupt("return", t.t0.retriableFetchSDK.call(t.t0, t.t10));
|
|
2829
|
+
case 22:
|
|
2821
2830
|
case "end":
|
|
2822
2831
|
return t.stop();
|
|
2823
2832
|
}
|
|
@@ -2886,17 +2895,26 @@ var Ge = ne(function e(t, r) {
|
|
|
2886
2895
|
case 0:
|
|
2887
2896
|
return Be("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();
|
|
2888
2897
|
case 3:
|
|
2889
|
-
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.
|
|
2898
|
+
return r = t.sent, n = r.dfp_telemetry_id, i = r.captcha_token, t.t0 = this._networkClient, t.t1 = Object, t.t2 = Object.assign({}, e), t.t3 = n, t.t4 = i, t.next = 13, this._subscriptionService.getIntermediateSessionToken();
|
|
2899
|
+
case 13:
|
|
2900
|
+
if (t.t5 = t.sent, t.t5) {
|
|
2901
|
+
t.next = 16;
|
|
2902
|
+
break;
|
|
2903
|
+
}
|
|
2904
|
+
t.t5 = void 0;
|
|
2905
|
+
case 16:
|
|
2906
|
+
return t.t6 = t.t5, t.t7 = {
|
|
2907
|
+
dfp_telemetry_id: t.t3,
|
|
2908
|
+
captcha_token: t.t4,
|
|
2909
|
+
intermediate_session_token: t.t6
|
|
2910
|
+
}, t.t8 = t.t1.assign.call(t.t1, t.t2, t.t7), t.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP, t.t10 = {
|
|
2890
2911
|
url: "/b2b/totp",
|
|
2891
|
-
body:
|
|
2892
|
-
dfp_telemetry_id: n,
|
|
2893
|
-
captcha_token: i
|
|
2894
|
-
}),
|
|
2912
|
+
body: t.t8,
|
|
2895
2913
|
errorMessage: "Failed to create TOTP",
|
|
2896
2914
|
method: "POST",
|
|
2897
|
-
retryCallback:
|
|
2898
|
-
}));
|
|
2899
|
-
case
|
|
2915
|
+
retryCallback: t.t9
|
|
2916
|
+
}, t.abrupt("return", t.t0.retriableFetchSDK.call(t.t0, t.t10));
|
|
2917
|
+
case 22:
|
|
2900
2918
|
case "end":
|
|
2901
2919
|
return t.stop();
|
|
2902
2920
|
}
|
|
@@ -2953,6 +2971,106 @@ var Ge = ne(function e(t, r) {
|
|
|
2953
2971
|
}]), e;
|
|
2954
2972
|
}(),
|
|
2955
2973
|
Ye = function () {
|
|
2974
|
+
function e(t, r) {
|
|
2975
|
+
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Le();
|
|
2976
|
+
ie(this, e), this._networkClient = t, this._subscriptionService = r, this.dfpProtectedAuth = n;
|
|
2977
|
+
}
|
|
2978
|
+
return ne(e, [{
|
|
2979
|
+
key: "recover",
|
|
2980
|
+
value: function value(e) {
|
|
2981
|
+
return he(this, void 0, void 0, te().mark(function t() {
|
|
2982
|
+
var r, n, i, o, s;
|
|
2983
|
+
return te().wrap(function (t) {
|
|
2984
|
+
for (;;) switch (t.prev = t.next) {
|
|
2985
|
+
case 0:
|
|
2986
|
+
return Be("stytch.recoveryCodes.recover").isString("organization_id", e.organization_id).isString("member_id", e.member_id).isString("recovery_code", e.recovery_code), t.next = 3, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2987
|
+
case 3:
|
|
2988
|
+
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();
|
|
2989
|
+
case 12:
|
|
2990
|
+
if (t.t4 = t.sent, t.t4) {
|
|
2991
|
+
t.next = 15;
|
|
2992
|
+
break;
|
|
2993
|
+
}
|
|
2994
|
+
t.t4 = void 0;
|
|
2995
|
+
case 15:
|
|
2996
|
+
return t.t5 = t.t4, t.t6 = {
|
|
2997
|
+
dfp_telemetry_id: t.t2,
|
|
2998
|
+
captcha_token: t.t3,
|
|
2999
|
+
intermediate_session_token: t.t5
|
|
3000
|
+
}, o = t.t0.assign.call(t.t0, t.t1, t.t6), t.next = 20, this._networkClient.retriableFetchSDK({
|
|
3001
|
+
url: "/b2b/recovery_codes/recover",
|
|
3002
|
+
body: o,
|
|
3003
|
+
errorMessage: "Failed to recover using recovery code",
|
|
3004
|
+
method: "POST",
|
|
3005
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3006
|
+
});
|
|
3007
|
+
case 20:
|
|
3008
|
+
return s = t.sent, this._subscriptionService.updateStateAndTokens({
|
|
3009
|
+
state: {
|
|
3010
|
+
session: s.member_session,
|
|
3011
|
+
member: s.member,
|
|
3012
|
+
organization: s.organization
|
|
3013
|
+
},
|
|
3014
|
+
session_token: s.session_token,
|
|
3015
|
+
session_jwt: s.session_jwt,
|
|
3016
|
+
intermediate_session_token: null
|
|
3017
|
+
}), t.abrupt("return", s);
|
|
3018
|
+
case 23:
|
|
3019
|
+
case "end":
|
|
3020
|
+
return t.stop();
|
|
3021
|
+
}
|
|
3022
|
+
}, t, this);
|
|
3023
|
+
}));
|
|
3024
|
+
}
|
|
3025
|
+
}, {
|
|
3026
|
+
key: "rotate",
|
|
3027
|
+
value: function value() {
|
|
3028
|
+
return he(this, void 0, void 0, te().mark(function e() {
|
|
3029
|
+
var t, r, n;
|
|
3030
|
+
return te().wrap(function (e) {
|
|
3031
|
+
for (;;) switch (e.prev = e.next) {
|
|
3032
|
+
case 0:
|
|
3033
|
+
return e.next = 2, this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3034
|
+
case 2:
|
|
3035
|
+
return t = e.sent, r = t.dfp_telemetry_id, n = t.captcha_token, e.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
3036
|
+
url: "/b2b/recovery_codes/rotate",
|
|
3037
|
+
body: {
|
|
3038
|
+
dfp_telemetry_id: r,
|
|
3039
|
+
captcha_token: n
|
|
3040
|
+
},
|
|
3041
|
+
errorMessage: "Failed to rotate recovery codes",
|
|
3042
|
+
method: "POST",
|
|
3043
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3044
|
+
}));
|
|
3045
|
+
case 6:
|
|
3046
|
+
case "end":
|
|
3047
|
+
return e.stop();
|
|
3048
|
+
}
|
|
3049
|
+
}, e, this);
|
|
3050
|
+
}));
|
|
3051
|
+
}
|
|
3052
|
+
}, {
|
|
3053
|
+
key: "get",
|
|
3054
|
+
value: function value() {
|
|
3055
|
+
return he(this, void 0, void 0, te().mark(function e() {
|
|
3056
|
+
return te().wrap(function (e) {
|
|
3057
|
+
for (;;) switch (e.prev = e.next) {
|
|
3058
|
+
case 0:
|
|
3059
|
+
return e.abrupt("return", this._networkClient.fetchSDK({
|
|
3060
|
+
url: "/b2b/recovery_codes",
|
|
3061
|
+
errorMessage: "Failed to get recovery codes",
|
|
3062
|
+
method: "GET"
|
|
3063
|
+
}));
|
|
3064
|
+
case 1:
|
|
3065
|
+
case "end":
|
|
3066
|
+
return e.stop();
|
|
3067
|
+
}
|
|
3068
|
+
}, e, this);
|
|
3069
|
+
}));
|
|
3070
|
+
}
|
|
3071
|
+
}]), e;
|
|
3072
|
+
}(),
|
|
3073
|
+
Ve = function () {
|
|
2956
3074
|
function e(t, r, n) {
|
|
2957
3075
|
var i = this;
|
|
2958
3076
|
ie(this, e), this._subscriptionService = n, this.isAuthorizedSync = function (e, t) {
|
|
@@ -2962,8 +3080,8 @@ var Ge = ne(function e(t, r) {
|
|
|
2962
3080
|
return i.policyPromise.then(function (r) {
|
|
2963
3081
|
return r.callerIsAuthorized(i.roleIds(), e, t);
|
|
2964
3082
|
});
|
|
2965
|
-
}, this.cachedPolicy = t.rbacPolicy ?
|
|
2966
|
-
return e.rbacPolicy ? (i.cachedPolicy =
|
|
3083
|
+
}, this.cachedPolicy = t.rbacPolicy ? st.fromJSON(t.rbacPolicy) : null, this.policyPromise = r.then(function (e) {
|
|
3084
|
+
return e.rbacPolicy ? (i.cachedPolicy = st.fromJSON(e.rbacPolicy), i.cachedPolicy) : (xe("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."), new st([], []));
|
|
2967
3085
|
});
|
|
2968
3086
|
}
|
|
2969
3087
|
return ne(e, [{
|
|
@@ -2983,7 +3101,7 @@ var Ge = ne(function e(t, r) {
|
|
|
2983
3101
|
}
|
|
2984
3102
|
}]), e;
|
|
2985
3103
|
}(),
|
|
2986
|
-
|
|
3104
|
+
Je = function () {
|
|
2987
3105
|
function e(t, r) {
|
|
2988
3106
|
var n = this;
|
|
2989
3107
|
ie(this, e), this._subscriptionService = t, this._headlessSessionClient = r, this._onDataChange = function (e) {
|
|
@@ -3057,9 +3175,8 @@ var Ge = ne(function e(t, r) {
|
|
|
3057
3175
|
}
|
|
3058
3176
|
}]), e;
|
|
3059
3177
|
}();
|
|
3060
|
-
|
|
3061
|
-
var
|
|
3062
|
-
$e,
|
|
3178
|
+
Je.REFRESH_INTERVAL_MS = 18e4;
|
|
3179
|
+
var $e,
|
|
3063
3180
|
Xe,
|
|
3064
3181
|
Ze,
|
|
3065
3182
|
Qe,
|
|
@@ -3068,7 +3185,8 @@ var Je,
|
|
|
3068
3185
|
rt,
|
|
3069
3186
|
nt,
|
|
3070
3187
|
it,
|
|
3071
|
-
ot
|
|
3188
|
+
ot,
|
|
3189
|
+
st = function () {
|
|
3072
3190
|
function e(t, r) {
|
|
3073
3191
|
var n = this;
|
|
3074
3192
|
ie(this, e), this.roles = t, this.resources = r, this.rolesByID = {}, t.forEach(function (e) {
|
|
@@ -3109,7 +3227,7 @@ var Je,
|
|
|
3109
3227
|
}
|
|
3110
3228
|
}]), e;
|
|
3111
3229
|
}();
|
|
3112
|
-
function
|
|
3230
|
+
function at(e, t, r, n) {
|
|
3113
3231
|
return new (r || (r = Promise))(function (i, o) {
|
|
3114
3232
|
function s(e) {
|
|
3115
3233
|
try {
|
|
@@ -3136,61 +3254,61 @@ function st(e, t, r, n) {
|
|
|
3136
3254
|
}
|
|
3137
3255
|
"function" == typeof SuppressedError && SuppressedError, function (e) {
|
|
3138
3256
|
e.emailMagicLinks = "emailMagicLinks", e.oauth = "oauth", e.otp = "otp", e.crypto = "crypto", e.passwords = "passwords", e.passkeys = "passkeys";
|
|
3139
|
-
}(Je || (Je = {})), function (e) {
|
|
3140
|
-
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";
|
|
3141
3257
|
}($e || ($e = {})), function (e) {
|
|
3142
|
-
e.
|
|
3258
|
+
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";
|
|
3143
3259
|
}(Xe || (Xe = {})), function (e) {
|
|
3144
|
-
e.
|
|
3260
|
+
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";
|
|
3145
3261
|
}(Ze || (Ze = {})), function (e) {
|
|
3146
|
-
e.
|
|
3262
|
+
e.embedded = "embedded", e.floating = "floating";
|
|
3147
3263
|
}(Qe || (Qe = {})), function (e) {
|
|
3264
|
+
e.SMS = "sms", e.WhatsApp = "whatsapp", e.Email = "email";
|
|
3265
|
+
}(et || (et = {})), function (e) {
|
|
3148
3266
|
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";
|
|
3149
|
-
}(
|
|
3150
|
-
var
|
|
3151
|
-
_inherits(
|
|
3152
|
-
var _super = _createSuper(
|
|
3153
|
-
function
|
|
3267
|
+
}(tt || (tt = {}));
|
|
3268
|
+
var ct = /*#__PURE__*/function (_Error) {
|
|
3269
|
+
_inherits(ct, _Error);
|
|
3270
|
+
var _super = _createSuper(ct);
|
|
3271
|
+
function ct(e, t) {
|
|
3154
3272
|
var _this;
|
|
3155
|
-
_classCallCheck(this,
|
|
3273
|
+
_classCallCheck(this, ct);
|
|
3156
3274
|
_this = _super.call(this), _this.name = "StytchSDKUsageError", _this.message = "Invalid call to ".concat(e, "\n") + t;
|
|
3157
3275
|
return _this;
|
|
3158
3276
|
}
|
|
3159
|
-
return _createClass(
|
|
3277
|
+
return _createClass(ct);
|
|
3160
3278
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
3161
3279
|
!function (e) {
|
|
3162
3280
|
e.emailMagicLinks = "emailMagicLinks", e.sso = "sso", e.passwords = "passwords", e.oauth = "oauth";
|
|
3163
|
-
}(tt || (tt = {})), function (e) {
|
|
3164
|
-
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3165
3281
|
}(rt || (rt = {})), function (e) {
|
|
3166
|
-
e.
|
|
3282
|
+
e.Discovery = "Discovery", e.Organization = "Organization", e.PasswordReset = "PasswordReset";
|
|
3167
3283
|
}(nt || (nt = {})), function (e) {
|
|
3284
|
+
e.Google = "google", e.Microsoft = "microsoft";
|
|
3285
|
+
}(it || (it = {})), function (e) {
|
|
3168
3286
|
e.RequiredCatcha = "Catcha Required";
|
|
3169
|
-
}(
|
|
3170
|
-
var
|
|
3287
|
+
}(ot || (ot = {}));
|
|
3288
|
+
var ut = function ut(e) {
|
|
3171
3289
|
var t = {
|
|
3172
3290
|
isObject: function isObject(r, n) {
|
|
3173
|
-
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new
|
|
3291
|
+
if (!("object" == _typeof(n) && !Array.isArray(n) && null !== n)) throw new ct(e, r + " must be an object.");
|
|
3174
3292
|
return t;
|
|
3175
3293
|
},
|
|
3176
3294
|
isOptionalObject: function isOptionalObject(e, r) {
|
|
3177
3295
|
return void 0 === r ? t : t.isObject(e, r);
|
|
3178
3296
|
},
|
|
3179
3297
|
isString: function isString(r, n) {
|
|
3180
|
-
if ("string" != typeof n) throw new
|
|
3298
|
+
if ("string" != typeof n) throw new ct(e, r + " must be a string.");
|
|
3181
3299
|
return t;
|
|
3182
3300
|
},
|
|
3183
3301
|
isOptionalString: function isOptionalString(e, r) {
|
|
3184
3302
|
return void 0 === r ? t : t.isString(e, r);
|
|
3185
3303
|
},
|
|
3186
3304
|
isStringArray: function isStringArray(r, n) {
|
|
3187
|
-
if (!Array.isArray(n)) throw new
|
|
3305
|
+
if (!Array.isArray(n)) throw new ct(e, r + " must be an array of strings.");
|
|
3188
3306
|
var _iterator = _createForOfIteratorHelper(n),
|
|
3189
3307
|
_step;
|
|
3190
3308
|
try {
|
|
3191
3309
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3192
3310
|
var _t2 = _step.value;
|
|
3193
|
-
if ("string" != typeof _t2) throw new
|
|
3311
|
+
if ("string" != typeof _t2) throw new ct(e, r + " must be an array of strings.");
|
|
3194
3312
|
}
|
|
3195
3313
|
} catch (err) {
|
|
3196
3314
|
_iterator.e(err);
|
|
@@ -3203,14 +3321,14 @@ var ct = function ct(e) {
|
|
|
3203
3321
|
return void 0 === r ? t : t.isStringArray(e, r);
|
|
3204
3322
|
},
|
|
3205
3323
|
isNumber: function isNumber(r, n) {
|
|
3206
|
-
if ("number" != typeof n) throw new
|
|
3324
|
+
if ("number" != typeof n) throw new ct(e, r + " must be a number.");
|
|
3207
3325
|
return t;
|
|
3208
3326
|
},
|
|
3209
3327
|
isOptionalNumber: function isOptionalNumber(e, r) {
|
|
3210
3328
|
return void 0 === r ? t : t.isNumber(e, r);
|
|
3211
3329
|
},
|
|
3212
3330
|
isBoolean: function isBoolean(r, n) {
|
|
3213
|
-
if ("boolean" != typeof n) throw new
|
|
3331
|
+
if ("boolean" != typeof n) throw new ct(e, r + " must be a boolean.");
|
|
3214
3332
|
return t;
|
|
3215
3333
|
},
|
|
3216
3334
|
isOptionalBoolean: function isOptionalBoolean(e, r) {
|
|
@@ -3219,26 +3337,26 @@ var ct = function ct(e) {
|
|
|
3219
3337
|
};
|
|
3220
3338
|
return t;
|
|
3221
3339
|
};
|
|
3222
|
-
var
|
|
3340
|
+
var lt;
|
|
3223
3341
|
!function (e) {
|
|
3224
3342
|
e.LoginOrCreateEML = "login_or_create_eml", e.LoginOrCreateOTP = "login_or_create_otp", e.ResetPassword = "reset_password";
|
|
3225
|
-
}(
|
|
3343
|
+
}(lt || (lt = {})), Promise.resolve({
|
|
3226
3344
|
pkceRequiredForEmailMagicLinks: !1
|
|
3227
3345
|
}), Promise.resolve({
|
|
3228
3346
|
pkceRequiredForPasswordResets: !1
|
|
3229
3347
|
}), Promise.resolve({
|
|
3230
3348
|
pkceRequiredForEmailMagicLinks: !1
|
|
3231
3349
|
});
|
|
3232
|
-
var
|
|
3350
|
+
var dt = Promise.resolve({
|
|
3233
3351
|
pkceRequiredForPasswordResets: !1
|
|
3234
3352
|
});
|
|
3235
|
-
var
|
|
3236
|
-
function
|
|
3237
|
-
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
3353
|
+
var ht = /*#__PURE__*/function () {
|
|
3354
|
+
function ht(e, t, r) {
|
|
3355
|
+
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : dt;
|
|
3238
3356
|
var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
3239
3357
|
return {
|
|
3240
3358
|
isEnabled: function isEnabled() {
|
|
3241
|
-
return
|
|
3359
|
+
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3242
3360
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3243
3361
|
while (1) switch (_context.prev = _context.next) {
|
|
3244
3362
|
case 0:
|
|
@@ -3251,7 +3369,7 @@ var dt = /*#__PURE__*/function () {
|
|
|
3251
3369
|
}));
|
|
3252
3370
|
},
|
|
3253
3371
|
getTelemetryID: function getTelemetryID() {
|
|
3254
|
-
return
|
|
3372
|
+
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3255
3373
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3256
3374
|
while (1) switch (_context2.prev = _context2.next) {
|
|
3257
3375
|
case 0:
|
|
@@ -3262,7 +3380,7 @@ var dt = /*#__PURE__*/function () {
|
|
|
3262
3380
|
}));
|
|
3263
3381
|
},
|
|
3264
3382
|
getDFPTelemetryIDAndCaptcha: function getDFPTelemetryIDAndCaptcha() {
|
|
3265
|
-
return
|
|
3383
|
+
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3266
3384
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3267
3385
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3268
3386
|
case 0:
|
|
@@ -3278,7 +3396,7 @@ var dt = /*#__PURE__*/function () {
|
|
|
3278
3396
|
}));
|
|
3279
3397
|
},
|
|
3280
3398
|
retryWithCaptchaAndDFP: function retryWithCaptchaAndDFP() {
|
|
3281
|
-
return
|
|
3399
|
+
return at(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3282
3400
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3283
3401
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3284
3402
|
case 0:
|
|
@@ -3292,13 +3410,13 @@ var dt = /*#__PURE__*/function () {
|
|
|
3292
3410
|
}
|
|
3293
3411
|
};
|
|
3294
3412
|
}();
|
|
3295
|
-
_classCallCheck(this,
|
|
3413
|
+
_classCallCheck(this, ht);
|
|
3296
3414
|
this._networkClient = e, this._subscriptionService = t, this._pkceManager = r, this._config = n, this.dfpProtectedAuth = i;
|
|
3297
3415
|
}
|
|
3298
|
-
_createClass(
|
|
3416
|
+
_createClass(ht, [{
|
|
3299
3417
|
key: "getCodeChallenge",
|
|
3300
3418
|
value: function getCodeChallenge() {
|
|
3301
|
-
return
|
|
3419
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3302
3420
|
var _yield$this$_config, e, t;
|
|
3303
3421
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3304
3422
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -3339,12 +3457,12 @@ var dt = /*#__PURE__*/function () {
|
|
|
3339
3457
|
}, {
|
|
3340
3458
|
key: "authenticate",
|
|
3341
3459
|
value: function authenticate(e) {
|
|
3342
|
-
return
|
|
3460
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3343
3461
|
var t, r, _yield$this$dfpProtec, n, i, o;
|
|
3344
3462
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3345
3463
|
while (1) switch (_context6.prev = _context6.next) {
|
|
3346
3464
|
case 0:
|
|
3347
|
-
|
|
3465
|
+
ut("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);
|
|
3348
3466
|
_context6.next = 3;
|
|
3349
3467
|
return this._pkceManager.getPKPair();
|
|
3350
3468
|
case 3:
|
|
@@ -3400,12 +3518,12 @@ var dt = /*#__PURE__*/function () {
|
|
|
3400
3518
|
}, {
|
|
3401
3519
|
key: "resetByEmailStart",
|
|
3402
3520
|
value: function resetByEmailStart(e) {
|
|
3403
|
-
return
|
|
3521
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3404
3522
|
var t, _yield$this$dfpProtec2, r, n;
|
|
3405
3523
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3406
3524
|
while (1) switch (_context7.prev = _context7.next) {
|
|
3407
3525
|
case 0:
|
|
3408
|
-
|
|
3526
|
+
ut("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);
|
|
3409
3527
|
_context7.next = 3;
|
|
3410
3528
|
return this.getCodeChallenge();
|
|
3411
3529
|
case 3:
|
|
@@ -3443,12 +3561,12 @@ var dt = /*#__PURE__*/function () {
|
|
|
3443
3561
|
}, {
|
|
3444
3562
|
key: "resetByEmail",
|
|
3445
3563
|
value: function resetByEmail(e) {
|
|
3446
|
-
return
|
|
3564
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
3447
3565
|
var _yield$this$dfpProtec3, t, r, n, i, o;
|
|
3448
3566
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3449
3567
|
while (1) switch (_context8.prev = _context8.next) {
|
|
3450
3568
|
case 0:
|
|
3451
|
-
|
|
3569
|
+
ut("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);
|
|
3452
3570
|
_context8.next = 3;
|
|
3453
3571
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3454
3572
|
case 3:
|
|
@@ -3503,12 +3621,12 @@ var dt = /*#__PURE__*/function () {
|
|
|
3503
3621
|
}, {
|
|
3504
3622
|
key: "resetByExistingPassword",
|
|
3505
3623
|
value: function resetByExistingPassword(e) {
|
|
3506
|
-
return
|
|
3624
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
3507
3625
|
var _yield$this$dfpProtec4, t, r, n;
|
|
3508
3626
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
3509
3627
|
while (1) switch (_context9.prev = _context9.next) {
|
|
3510
3628
|
case 0:
|
|
3511
|
-
|
|
3629
|
+
ut("stytch.passwords.resetByExistingPassword").isString("email", e.email_address).isString("existing_password", e.existing_password).isString("new_password", e.new_password).isOptionalString("locale", e.locale);
|
|
3512
3630
|
_context9.next = 3;
|
|
3513
3631
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3514
3632
|
case 3:
|
|
@@ -3558,12 +3676,12 @@ var dt = /*#__PURE__*/function () {
|
|
|
3558
3676
|
}, {
|
|
3559
3677
|
key: "resetBySession",
|
|
3560
3678
|
value: function resetBySession(e) {
|
|
3561
|
-
return
|
|
3679
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
3562
3680
|
var _yield$this$dfpProtec5, t, r, n;
|
|
3563
3681
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
3564
3682
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3565
3683
|
case 0:
|
|
3566
|
-
|
|
3684
|
+
ut("stytch.passwords.resetBySession").isString("password", e.password);
|
|
3567
3685
|
_context10.next = 3;
|
|
3568
3686
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3569
3687
|
case 3:
|
|
@@ -3604,11 +3722,11 @@ var dt = /*#__PURE__*/function () {
|
|
|
3604
3722
|
}, {
|
|
3605
3723
|
key: "strengthCheck",
|
|
3606
3724
|
value: function strengthCheck(e) {
|
|
3607
|
-
return
|
|
3725
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
3608
3726
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
3609
3727
|
while (1) switch (_context11.prev = _context11.next) {
|
|
3610
3728
|
case 0:
|
|
3611
|
-
return _context11.abrupt("return", (
|
|
3729
|
+
return _context11.abrupt("return", (ut("stytch.passwords.strengthCheck").isOptionalString("email", e.email_address).isString("password", e.password), this._networkClient.fetchSDK({
|
|
3612
3730
|
url: "/b2b/passwords/strength_check",
|
|
3613
3731
|
method: "POST",
|
|
3614
3732
|
errorMessage: "Failed to check password strength.",
|
|
@@ -3625,19 +3743,19 @@ var dt = /*#__PURE__*/function () {
|
|
|
3625
3743
|
}));
|
|
3626
3744
|
}
|
|
3627
3745
|
}]);
|
|
3628
|
-
return
|
|
3746
|
+
return ht;
|
|
3629
3747
|
}();
|
|
3630
|
-
var
|
|
3631
|
-
var
|
|
3632
|
-
function
|
|
3748
|
+
var pt = "bootstrap";
|
|
3749
|
+
var _t = /*#__PURE__*/function () {
|
|
3750
|
+
function _t(e, t, r) {
|
|
3633
3751
|
var _this2 = this;
|
|
3634
|
-
_classCallCheck(this,
|
|
3752
|
+
_classCallCheck(this, _t);
|
|
3635
3753
|
this._publicToken = e, this._networkClient = t, this._dataLayer = r, this._bootstrapDataPromise = this._networkClient.fetchSDK({
|
|
3636
3754
|
url: "/projects/bootstrap/".concat(this._publicToken),
|
|
3637
3755
|
method: "GET",
|
|
3638
3756
|
errorMessage: "Error fetching bootstrap data for SDK for ".concat(this._publicToken)
|
|
3639
|
-
}).then(
|
|
3640
|
-
return _this2._dataLayer.setItem(
|
|
3757
|
+
}).then(_t.mapBootstrapData).then(function (e) {
|
|
3758
|
+
return _this2._dataLayer.setItem(pt, JSON.stringify(e)), e;
|
|
3641
3759
|
})["catch"](function (e) {
|
|
3642
3760
|
return xe(e), {
|
|
3643
3761
|
displayWatermark: !1,
|
|
@@ -3658,10 +3776,10 @@ var pt = /*#__PURE__*/function () {
|
|
|
3658
3776
|
};
|
|
3659
3777
|
});
|
|
3660
3778
|
}
|
|
3661
|
-
_createClass(
|
|
3779
|
+
_createClass(_t, [{
|
|
3662
3780
|
key: "getSync",
|
|
3663
3781
|
value: function getSync() {
|
|
3664
|
-
var e = this._dataLayer.getItem(
|
|
3782
|
+
var e = this._dataLayer.getItem(pt);
|
|
3665
3783
|
if (null === e) return {
|
|
3666
3784
|
displayWatermark: !1,
|
|
3667
3785
|
cnameDomain: null,
|
|
@@ -3732,13 +3850,13 @@ var pt = /*#__PURE__*/function () {
|
|
|
3732
3850
|
};
|
|
3733
3851
|
}
|
|
3734
3852
|
}]);
|
|
3735
|
-
return
|
|
3853
|
+
return _t;
|
|
3736
3854
|
}();
|
|
3737
|
-
var
|
|
3855
|
+
var ft = /*#__PURE__*/_createClass(function ft(e) {
|
|
3738
3856
|
var _this3 = this;
|
|
3739
|
-
_classCallCheck(this,
|
|
3857
|
+
_classCallCheck(this, ft);
|
|
3740
3858
|
this.bootstrapPromise = e, this.executeRecaptcha = function () {
|
|
3741
|
-
return
|
|
3859
|
+
return at(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
3742
3860
|
var _yield$this$state, e, t, r;
|
|
3743
3861
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
3744
3862
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -3769,7 +3887,7 @@ var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
|
3769
3887
|
}, _callee12, this);
|
|
3770
3888
|
}));
|
|
3771
3889
|
}, this.state = e.then(function (e) {
|
|
3772
|
-
return
|
|
3890
|
+
return at(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
3773
3891
|
var t;
|
|
3774
3892
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
3775
3893
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -3807,9 +3925,9 @@ var _t = /*#__PURE__*/_createClass(function _t(e) {
|
|
|
3807
3925
|
}));
|
|
3808
3926
|
});
|
|
3809
3927
|
});
|
|
3810
|
-
var
|
|
3811
|
-
function
|
|
3812
|
-
_classCallCheck(this,
|
|
3928
|
+
var mt = /*#__PURE__*/function () {
|
|
3929
|
+
function mt(e, t, r, n) {
|
|
3930
|
+
_classCallCheck(this, mt);
|
|
3813
3931
|
this._publicToken = e, this._subscriptionDataLayer = t, this.baseURL = r, this.additionalTelemetryDataFn = n, this.updateSessionToken = function () {
|
|
3814
3932
|
return null;
|
|
3815
3933
|
}, this.eventLogger = new Me({
|
|
@@ -3818,7 +3936,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3818
3936
|
logEventURL: this.buildSDKUrl("/events")
|
|
3819
3937
|
});
|
|
3820
3938
|
}
|
|
3821
|
-
_createClass(
|
|
3939
|
+
_createClass(mt, [{
|
|
3822
3940
|
key: "logEvent",
|
|
3823
3941
|
value: function logEvent(_ref) {
|
|
3824
3942
|
var e = _ref.name,
|
|
@@ -3849,7 +3967,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3849
3967
|
},
|
|
3850
3968
|
sdk: {
|
|
3851
3969
|
identifier: "Stytch.js Javascript SDK",
|
|
3852
|
-
version: "4.
|
|
3970
|
+
version: "4.4.0"
|
|
3853
3971
|
}
|
|
3854
3972
|
});
|
|
3855
3973
|
}
|
|
@@ -3860,7 +3978,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3860
3978
|
t = _ref2.body,
|
|
3861
3979
|
r = _ref2.errorMessage,
|
|
3862
3980
|
n = _ref2.method;
|
|
3863
|
-
return
|
|
3981
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
3864
3982
|
var i, o, s, a;
|
|
3865
3983
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
3866
3984
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -3890,7 +4008,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3890
4008
|
r = _ref3.errorMessage,
|
|
3891
4009
|
n = _ref3.method,
|
|
3892
4010
|
i = _ref3.retryCallback;
|
|
3893
|
-
return
|
|
4011
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
3894
4012
|
var o, s, a, c;
|
|
3895
4013
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
3896
4014
|
while (1) switch (_context15.prev = _context15.next) {
|
|
@@ -3961,18 +4079,18 @@ var ft = /*#__PURE__*/function () {
|
|
|
3961
4079
|
return "".concat(this.baseURL, "/sdk/v1").concat(e);
|
|
3962
4080
|
}
|
|
3963
4081
|
}]);
|
|
3964
|
-
return
|
|
4082
|
+
return mt;
|
|
3965
4083
|
}();
|
|
3966
|
-
function
|
|
4084
|
+
function vt(e) {
|
|
3967
4085
|
var t = e.toString(16);
|
|
3968
4086
|
return 1 === t.length && (t = "0" + t), t;
|
|
3969
4087
|
}
|
|
3970
|
-
var
|
|
3971
|
-
function
|
|
3972
|
-
_classCallCheck(this,
|
|
4088
|
+
var bt = /*#__PURE__*/function () {
|
|
4089
|
+
function bt(e, t) {
|
|
4090
|
+
_classCallCheck(this, bt);
|
|
3973
4091
|
this._dataLayer = e, this.namespace = t;
|
|
3974
4092
|
}
|
|
3975
|
-
_createClass(
|
|
4093
|
+
_createClass(bt, [{
|
|
3976
4094
|
key: "key",
|
|
3977
4095
|
value: function key() {
|
|
3978
4096
|
return "PKCE_VERIFIER:" + this.namespace;
|
|
@@ -3980,13 +4098,13 @@ var vt = /*#__PURE__*/function () {
|
|
|
3980
4098
|
}, {
|
|
3981
4099
|
key: "startPKCETransaction",
|
|
3982
4100
|
value: function startPKCETransaction() {
|
|
3983
|
-
return
|
|
4101
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
3984
4102
|
var e;
|
|
3985
4103
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
3986
4104
|
while (1) switch (_context16.prev = _context16.next) {
|
|
3987
4105
|
case 0:
|
|
3988
4106
|
_context16.next = 2;
|
|
3989
|
-
return
|
|
4107
|
+
return bt.createProofkeyPair();
|
|
3990
4108
|
case 2:
|
|
3991
4109
|
e = _context16.sent;
|
|
3992
4110
|
return _context16.abrupt("return", (this._dataLayer.setItem(this.key(), JSON.stringify(e)), e));
|
|
@@ -4015,7 +4133,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
4015
4133
|
}], [{
|
|
4016
4134
|
key: "createProofkeyPair",
|
|
4017
4135
|
value: function createProofkeyPair() {
|
|
4018
|
-
return
|
|
4136
|
+
return at(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
4019
4137
|
var _String$fromCharCode;
|
|
4020
4138
|
var e, t, r, n;
|
|
4021
4139
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
@@ -4023,7 +4141,7 @@ var vt = /*#__PURE__*/function () {
|
|
|
4023
4141
|
case 0:
|
|
4024
4142
|
e = new Uint32Array(16);
|
|
4025
4143
|
window.crypto.getRandomValues(e);
|
|
4026
|
-
t = Array.from(e).map(
|
|
4144
|
+
t = Array.from(e).map(vt).join("");
|
|
4027
4145
|
_context17.next = 5;
|
|
4028
4146
|
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(t));
|
|
4029
4147
|
case 5:
|
|
@@ -4040,14 +4158,14 @@ var vt = /*#__PURE__*/function () {
|
|
|
4040
4158
|
}));
|
|
4041
4159
|
}
|
|
4042
4160
|
}]);
|
|
4043
|
-
return
|
|
4161
|
+
return bt;
|
|
4044
4162
|
}();
|
|
4045
|
-
var
|
|
4046
|
-
function
|
|
4047
|
-
_classCallCheck(this,
|
|
4163
|
+
var gt = /*#__PURE__*/function () {
|
|
4164
|
+
function gt(e) {
|
|
4165
|
+
_classCallCheck(this, gt);
|
|
4048
4166
|
this._networkClient = e;
|
|
4049
4167
|
}
|
|
4050
|
-
_createClass(
|
|
4168
|
+
_createClass(gt, [{
|
|
4051
4169
|
key: "searchUser",
|
|
4052
4170
|
value: function searchUser(e) {
|
|
4053
4171
|
return this._networkClient.fetchSDK({
|
|
@@ -4085,9 +4203,9 @@ var bt = /*#__PURE__*/function () {
|
|
|
4085
4203
|
});
|
|
4086
4204
|
}
|
|
4087
4205
|
}]);
|
|
4088
|
-
return
|
|
4206
|
+
return gt;
|
|
4089
4207
|
}();
|
|
4090
|
-
var
|
|
4208
|
+
var yt = function yt(e) {
|
|
4091
4209
|
return (document.cookie ? document.cookie.split("; ") : []).filter(function (t) {
|
|
4092
4210
|
var _t$split = t.split("="),
|
|
4093
4211
|
_t$split2 = _slicedToArray(_t$split, 1),
|
|
@@ -4096,17 +4214,17 @@ var gt = function gt(e) {
|
|
|
4096
4214
|
}).length > 1;
|
|
4097
4215
|
};
|
|
4098
4216
|
/*! js-cookie v3.0.1 | MIT */
|
|
4099
|
-
function
|
|
4217
|
+
function kt(e) {
|
|
4100
4218
|
for (var t = 1; t < arguments.length; t++) {
|
|
4101
4219
|
var r = arguments[t];
|
|
4102
4220
|
for (var n in r) e[n] = r[n];
|
|
4103
4221
|
}
|
|
4104
4222
|
return e;
|
|
4105
4223
|
}
|
|
4106
|
-
var
|
|
4224
|
+
var wt = function e(t, r) {
|
|
4107
4225
|
function n(e, n, i) {
|
|
4108
4226
|
if ("undefined" != typeof document) {
|
|
4109
|
-
"number" == typeof (i =
|
|
4227
|
+
"number" == typeof (i = kt({}, r, i)).expires && (i.expires = new Date(Date.now() + 864e5 * i.expires)), i.expires && (i.expires = i.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
4110
4228
|
var o = "";
|
|
4111
4229
|
for (var s in i) i[s] && (o += "; " + s, !0 !== i[s] && (o += "=" + i[s].split(";")[0]));
|
|
4112
4230
|
return document.cookie = e + "=" + t.write(n, e) + o;
|
|
@@ -4128,15 +4246,15 @@ var kt = function e(t, r) {
|
|
|
4128
4246
|
}
|
|
4129
4247
|
},
|
|
4130
4248
|
remove: function remove(e, t) {
|
|
4131
|
-
n(e, "",
|
|
4249
|
+
n(e, "", kt({}, t, {
|
|
4132
4250
|
expires: -1
|
|
4133
4251
|
}));
|
|
4134
4252
|
},
|
|
4135
4253
|
withAttributes: function withAttributes(t) {
|
|
4136
|
-
return e(this.converter,
|
|
4254
|
+
return e(this.converter, kt({}, this.attributes, t));
|
|
4137
4255
|
},
|
|
4138
4256
|
withConverter: function withConverter(t) {
|
|
4139
|
-
return e(
|
|
4257
|
+
return e(kt({}, this.converter, t), this.attributes);
|
|
4140
4258
|
}
|
|
4141
4259
|
}, {
|
|
4142
4260
|
attributes: {
|
|
@@ -4156,26 +4274,26 @@ var kt = function e(t, r) {
|
|
|
4156
4274
|
}, {
|
|
4157
4275
|
path: "/"
|
|
4158
4276
|
});
|
|
4159
|
-
var
|
|
4277
|
+
var St = function St(e) {
|
|
4160
4278
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
4161
4279
|
return "stytch_sdk_state_".concat(e).concat(t ? "::".concat(t) : "");
|
|
4162
4280
|
};
|
|
4163
|
-
var
|
|
4164
|
-
function
|
|
4281
|
+
var Pt = /*#__PURE__*/function () {
|
|
4282
|
+
function Pt(e, t) {
|
|
4165
4283
|
var _this4 = this;
|
|
4166
|
-
_classCallCheck(this,
|
|
4284
|
+
_classCallCheck(this, Pt);
|
|
4167
4285
|
this.browserSessionStorage = {
|
|
4168
4286
|
getItem: function getItem(e) {
|
|
4169
|
-
return sessionStorage.getItem(
|
|
4287
|
+
return sessionStorage.getItem(St(_this4.publicToken, e));
|
|
4170
4288
|
},
|
|
4171
4289
|
setItem: function setItem(e, t) {
|
|
4172
|
-
return sessionStorage.setItem(
|
|
4290
|
+
return sessionStorage.setItem(St(_this4.publicToken, e), t);
|
|
4173
4291
|
},
|
|
4174
4292
|
removeItem: function removeItem(e) {
|
|
4175
|
-
return sessionStorage.removeItem(
|
|
4293
|
+
return sessionStorage.removeItem(St(_this4.publicToken, e));
|
|
4176
4294
|
}
|
|
4177
4295
|
}, this.publicToken = e, this.state = null, this.stateKeysUpdated = new Set(), this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (Be("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);
|
|
4178
|
-
var r = localStorage.getItem(
|
|
4296
|
+
var r = localStorage.getItem(St(this.publicToken));
|
|
4179
4297
|
if (!r) return;
|
|
4180
4298
|
var n;
|
|
4181
4299
|
try {
|
|
@@ -4185,7 +4303,7 @@ var St = /*#__PURE__*/function () {
|
|
|
4185
4303
|
}
|
|
4186
4304
|
this.state = n;
|
|
4187
4305
|
}
|
|
4188
|
-
_createClass(
|
|
4306
|
+
_createClass(Pt, [{
|
|
4189
4307
|
key: "opaqueTokenCookieName",
|
|
4190
4308
|
get: function get() {
|
|
4191
4309
|
var e;
|
|
@@ -4207,14 +4325,14 @@ var St = /*#__PURE__*/function () {
|
|
|
4207
4325
|
key: "readSessionCookie",
|
|
4208
4326
|
value: function readSessionCookie() {
|
|
4209
4327
|
return {
|
|
4210
|
-
session_token:
|
|
4211
|
-
session_jwt:
|
|
4328
|
+
session_token: wt.get(this.opaqueTokenCookieName),
|
|
4329
|
+
session_jwt: wt.get(this.jwtCookieName)
|
|
4212
4330
|
};
|
|
4213
4331
|
}
|
|
4214
4332
|
}, {
|
|
4215
4333
|
key: "readIntermediateSessionTokenCookie",
|
|
4216
4334
|
value: function readIntermediateSessionTokenCookie() {
|
|
4217
|
-
return
|
|
4335
|
+
return wt.get(this.istCookieName);
|
|
4218
4336
|
}
|
|
4219
4337
|
}, {
|
|
4220
4338
|
key: "writeSessionCookie",
|
|
@@ -4223,32 +4341,32 @@ var St = /*#__PURE__*/function () {
|
|
|
4223
4341
|
var o = e.state,
|
|
4224
4342
|
s = e.session_token,
|
|
4225
4343
|
a = e.session_jwt,
|
|
4226
|
-
c =
|
|
4344
|
+
c = Pt.generateCookieOpts({
|
|
4227
4345
|
expiresAt: null !== (r = null === (t = null == o ? void 0 : o.session) || void 0 === t ? void 0 : t.expires_at) && void 0 !== r ? r : "",
|
|
4228
4346
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4229
4347
|
path: this._cookiePath,
|
|
4230
4348
|
domain: this._domain
|
|
4231
4349
|
});
|
|
4232
|
-
|
|
4233
|
-
var u =
|
|
4350
|
+
wt.set(this.opaqueTokenCookieName, s, c), wt.set(this.jwtCookieName, a, c);
|
|
4351
|
+
var u = Pt.generateCookieOpts({
|
|
4234
4352
|
expiresAt: null !== (i = null === (n = null == o ? void 0 : o.session) || void 0 === n ? void 0 : n.expires_at) && void 0 !== i ? i : "",
|
|
4235
4353
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
4236
4354
|
path: this._cookiePath,
|
|
4237
4355
|
domain: this._domain
|
|
4238
4356
|
});
|
|
4239
|
-
|
|
4357
|
+
yt(this.jwtCookieName) && wt.remove(this.jwtCookieName, u), yt(this.opaqueTokenCookieName) && wt.remove(this.opaqueTokenCookieName, u), yt(this.jwtCookieName) && Oe("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."), yt(this.opaqueTokenCookieName) && Oe("Could not remove extraneous opaque token cookie.");
|
|
4240
4358
|
}
|
|
4241
4359
|
}, {
|
|
4242
4360
|
key: "writeIntermediateSessionTokenCookie",
|
|
4243
4361
|
value: function writeIntermediateSessionTokenCookie(e) {
|
|
4244
4362
|
var t = new Date(Date.now() + 6e5),
|
|
4245
|
-
r =
|
|
4363
|
+
r = Pt.generateCookieOpts({
|
|
4246
4364
|
expiresAt: t.toString(),
|
|
4247
4365
|
availableToSubdomains: this._cookieAvailableToSubdomains,
|
|
4248
4366
|
path: this._cookiePath,
|
|
4249
4367
|
domain: this._domain
|
|
4250
4368
|
});
|
|
4251
|
-
|
|
4369
|
+
wt.set(this.istCookieName, e, r);
|
|
4252
4370
|
}
|
|
4253
4371
|
}, {
|
|
4254
4372
|
key: "removeSessionCookie",
|
|
@@ -4267,14 +4385,14 @@ var St = /*#__PURE__*/function () {
|
|
|
4267
4385
|
[!0, !1].forEach(function (t) {
|
|
4268
4386
|
[_this5._cookiePath, null].forEach(function (r) {
|
|
4269
4387
|
[_this5._domain, null].forEach(function (n) {
|
|
4270
|
-
var i =
|
|
4388
|
+
var i = Pt.generateCookieOpts({
|
|
4271
4389
|
expiresAt: new Date(0).toString(),
|
|
4272
4390
|
availableToSubdomains: t,
|
|
4273
4391
|
path: r,
|
|
4274
4392
|
domain: n
|
|
4275
4393
|
});
|
|
4276
4394
|
e.forEach(function (e) {
|
|
4277
|
-
|
|
4395
|
+
wt.remove(e, i);
|
|
4278
4396
|
});
|
|
4279
4397
|
});
|
|
4280
4398
|
});
|
|
@@ -4283,22 +4401,22 @@ var St = /*#__PURE__*/function () {
|
|
|
4283
4401
|
}, {
|
|
4284
4402
|
key: "syncToLocalStorage",
|
|
4285
4403
|
value: function syncToLocalStorage() {
|
|
4286
|
-
localStorage.setItem(
|
|
4404
|
+
localStorage.setItem(St(this.publicToken), JSON.stringify(this.state));
|
|
4287
4405
|
}
|
|
4288
4406
|
}, {
|
|
4289
4407
|
key: "getItem",
|
|
4290
4408
|
value: function getItem(e) {
|
|
4291
|
-
return localStorage.getItem(
|
|
4409
|
+
return localStorage.getItem(St(this.publicToken, e));
|
|
4292
4410
|
}
|
|
4293
4411
|
}, {
|
|
4294
4412
|
key: "setItem",
|
|
4295
4413
|
value: function setItem(e, t) {
|
|
4296
|
-
return localStorage.setItem(
|
|
4414
|
+
return localStorage.setItem(St(this.publicToken, e), t);
|
|
4297
4415
|
}
|
|
4298
4416
|
}, {
|
|
4299
4417
|
key: "removeItem",
|
|
4300
4418
|
value: function removeItem(e) {
|
|
4301
|
-
return localStorage.removeItem(
|
|
4419
|
+
return localStorage.removeItem(St(this.publicToken, e));
|
|
4302
4420
|
}
|
|
4303
4421
|
}, {
|
|
4304
4422
|
key: "markStateKeysUpdated",
|
|
@@ -4323,31 +4441,31 @@ var St = /*#__PURE__*/function () {
|
|
|
4323
4441
|
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;
|
|
4324
4442
|
}
|
|
4325
4443
|
}]);
|
|
4326
|
-
return
|
|
4444
|
+
return Pt;
|
|
4327
4445
|
}();
|
|
4328
|
-
var
|
|
4329
|
-
_inherits(
|
|
4330
|
-
var _super2 = _createSuper(
|
|
4331
|
-
function
|
|
4332
|
-
_classCallCheck(this,
|
|
4446
|
+
var At = /*#__PURE__*/function (_Pt) {
|
|
4447
|
+
_inherits(At, _Pt);
|
|
4448
|
+
var _super2 = _createSuper(At);
|
|
4449
|
+
function At() {
|
|
4450
|
+
_classCallCheck(this, At);
|
|
4333
4451
|
return _super2.apply(this, arguments);
|
|
4334
4452
|
}
|
|
4335
|
-
return _createClass(
|
|
4336
|
-
}(
|
|
4337
|
-
var
|
|
4338
|
-
|
|
4453
|
+
return _createClass(At);
|
|
4454
|
+
}(Pt);
|
|
4455
|
+
var Ct = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
4456
|
+
Et = function Et(e, t) {
|
|
4339
4457
|
var r = function () {
|
|
4340
4458
|
var e = window;
|
|
4341
|
-
return e[
|
|
4459
|
+
return e[Ct] || (e[Ct] = {}), e[Ct];
|
|
4342
4460
|
}();
|
|
4343
|
-
return r[e] || (r[e] = new
|
|
4461
|
+
return r[e] || (r[e] = new At(e, t)), r[e];
|
|
4344
4462
|
},
|
|
4345
|
-
|
|
4463
|
+
Tt = function Tt(e, t) {
|
|
4346
4464
|
Object.values(e).forEach(function (e) {
|
|
4347
4465
|
return e(t);
|
|
4348
4466
|
});
|
|
4349
4467
|
},
|
|
4350
|
-
|
|
4468
|
+
Ot = function () {
|
|
4351
4469
|
var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).KEYS_TO_EXCLUDE,
|
|
4352
4470
|
t = void 0 === e ? [] : e;
|
|
4353
4471
|
return function e(r, n) {
|
|
@@ -4366,12 +4484,12 @@ var At = Symbol["for"]("__stytch_b2b_DataLayer"),
|
|
|
4366
4484
|
}({
|
|
4367
4485
|
KEYS_TO_EXCLUDE: ["last_accessed_at"]
|
|
4368
4486
|
});
|
|
4369
|
-
var
|
|
4370
|
-
function
|
|
4487
|
+
var xt = /*#__PURE__*/function () {
|
|
4488
|
+
function xt(e, t) {
|
|
4371
4489
|
var _this7 = this;
|
|
4372
|
-
_classCallCheck(this,
|
|
4490
|
+
_classCallCheck(this, xt);
|
|
4373
4491
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
4374
|
-
if (e.key !==
|
|
4492
|
+
if (e.key !== St(_this7._publicToken)) return;
|
|
4375
4493
|
if (null === e.newValue || "null" === e.newValue) return void _this7.destroyState();
|
|
4376
4494
|
var t = JSON.parse(e.newValue);
|
|
4377
4495
|
_this7.updateState(t);
|
|
@@ -4380,7 +4498,7 @@ var Ot = /*#__PURE__*/function () {
|
|
|
4380
4498
|
r = _this$_datalayer$read.session_token;
|
|
4381
4499
|
r || this.destroyState();
|
|
4382
4500
|
}
|
|
4383
|
-
_createClass(
|
|
4501
|
+
_createClass(xt, [{
|
|
4384
4502
|
key: "getTokens",
|
|
4385
4503
|
value: function getTokens() {
|
|
4386
4504
|
var _this$_datalayer$read2 = this._datalayer.readSessionCookie(),
|
|
@@ -4413,7 +4531,7 @@ var Ot = /*#__PURE__*/function () {
|
|
|
4413
4531
|
r = null === e.state ? null : Object.assign(Object.assign({}, this._datalayer.state), e.state);
|
|
4414
4532
|
this._datalayer.state = r;
|
|
4415
4533
|
var n = e.state ? Object.keys(e.state) : [];
|
|
4416
|
-
!this._datalayer.markStateKeysUpdated(n) &&
|
|
4534
|
+
!this._datalayer.markStateKeysUpdated(n) && Ot(t, r) || Tt(this._datalayer.subscriptions, r);
|
|
4417
4535
|
}
|
|
4418
4536
|
}, {
|
|
4419
4537
|
key: "updateStateAndTokens",
|
|
@@ -4428,8 +4546,8 @@ var Ot = /*#__PURE__*/function () {
|
|
|
4428
4546
|
this._datalayer.state = r;
|
|
4429
4547
|
var n = e ? Object.keys(e) : [],
|
|
4430
4548
|
i = this._datalayer.markStateKeysUpdated(n),
|
|
4431
|
-
o = !
|
|
4432
|
-
(i || o) && (
|
|
4549
|
+
o = !Ot(t, r);
|
|
4550
|
+
(i || o) && (Tt(this._datalayer.subscriptions, r), o && this._datalayer.syncToLocalStorage());
|
|
4433
4551
|
}
|
|
4434
4552
|
}, {
|
|
4435
4553
|
key: "updateTokens",
|
|
@@ -4469,14 +4587,14 @@ var Ot = /*#__PURE__*/function () {
|
|
|
4469
4587
|
return null;
|
|
4470
4588
|
}
|
|
4471
4589
|
}]);
|
|
4472
|
-
return
|
|
4590
|
+
return xt;
|
|
4473
4591
|
}();
|
|
4474
|
-
var
|
|
4475
|
-
_inherits(
|
|
4476
|
-
var _super3 = _createSuper(
|
|
4477
|
-
function
|
|
4592
|
+
var Dt = /*#__PURE__*/function (_xt) {
|
|
4593
|
+
_inherits(Dt, _xt);
|
|
4594
|
+
var _super3 = _createSuper(Dt);
|
|
4595
|
+
function Dt() {
|
|
4478
4596
|
var _this8;
|
|
4479
|
-
_classCallCheck(this,
|
|
4597
|
+
_classCallCheck(this, Dt);
|
|
4480
4598
|
_this8 = _super3.apply(this, arguments), _this8.updateMember = function (e) {
|
|
4481
4599
|
return _this8.updateState({
|
|
4482
4600
|
member: e
|
|
@@ -4497,10 +4615,10 @@ var xt = /*#__PURE__*/function (_Ot) {
|
|
|
4497
4615
|
};
|
|
4498
4616
|
return _this8;
|
|
4499
4617
|
}
|
|
4500
|
-
return _createClass(
|
|
4501
|
-
}(
|
|
4502
|
-
var
|
|
4503
|
-
exports.BiometricsFailedError =
|
|
4618
|
+
return _createClass(Dt);
|
|
4619
|
+
}(xt);
|
|
4620
|
+
var It = Symbol["for"]("stytch__internal_b2b");
|
|
4621
|
+
exports.BiometricsFailedError = U, exports.BiometricsUnavailableError = A, exports.ChallengeSigningFailedError = F, exports.DeviceCredentialsNotAllowedError = D, exports.FailedCodeChallengeError = K, exports.FailedToDecryptDataError = z, exports.InternalError = S, exports.InvalidAuthorizationCredentialError = L, exports.InvalidCredentialTypeError = H, exports.InvalidRedirectSchemeError = W, exports.InvalidStartUrlError = q, exports.JSONDataNotConvertibleToStringError = V, exports.KeyInvalidatedError = C, exports.KeystoreUnavailableError = E, exports.MissingAttestationObjectError = Y, exports.MissingAuthorizationCredentialIDTokenError = R, exports.MissingGoogleClientIDError = I, exports.MissingPKCEError = B, exports.MissingPublicKeyError = M, exports.MissingUrlError = G, exports.NoBiometricsEnrolledError = T, exports.NoBiometricsRegistrationError = P, exports.NoCurrentSessionError = w, exports.PasskeysInvalidEncoding = $, exports.PasskeysUnsupportedError = N, exports.RandomNumberGenerationFailed = J, exports.SDKAPIUnreachableError = h, exports.SDKNotConfiguredError = j, exports.StytchAPIError = y, exports.StytchAPISchemaError = g, exports.StytchAPIUnreachableError = b, exports.StytchB2BHeadlessClient = /*#__PURE__*/function () {
|
|
4504
4622
|
function _class(e, t) {
|
|
4505
4623
|
var _this9 = this;
|
|
4506
4624
|
_classCallCheck(this, _class);
|
|
@@ -4520,28 +4638,28 @@ exports.BiometricsFailedError = z, exports.BiometricsUnavailableError = A, expor
|
|
|
4520
4638
|
}
|
|
4521
4639
|
};
|
|
4522
4640
|
var o, s, a, c, u, l, d, h, p, _, f;
|
|
4523
|
-
this._dataLayer =
|
|
4524
|
-
var m = new
|
|
4525
|
-
this._networkClient = new
|
|
4641
|
+
this._dataLayer = Et(e, n), this._subscriptionService = new Dt(e, this._dataLayer);
|
|
4642
|
+
var m = new bt(this._dataLayer, "passwords");
|
|
4643
|
+
this._networkClient = new mt(e, this._dataLayer, i.endpoints.sdkBackendURL, function () {
|
|
4526
4644
|
var e, t, r, n;
|
|
4527
4645
|
return {
|
|
4528
4646
|
stytch_member_id: null === (t = null === (e = _this9._dataLayer.state) || void 0 === e ? void 0 : e.member) || void 0 === t ? void 0 : t.member_id,
|
|
4529
4647
|
stytch_member_session_id: null === (n = null === (r = _this9._dataLayer.state) || void 0 === r ? void 0 : r.session) || void 0 === n ? void 0 : n.member_session_id
|
|
4530
4648
|
};
|
|
4531
4649
|
});
|
|
4532
|
-
var v = new
|
|
4533
|
-
b = new
|
|
4650
|
+
var v = new _t(e, this._networkClient, this._dataLayer),
|
|
4651
|
+
b = new ft(v.getAsync()),
|
|
4534
4652
|
g = new Re(e, i.endpoints.dfpBackendURL, v.getAsync(), b.executeRecaptcha);
|
|
4535
|
-
this.organization = new
|
|
4653
|
+
this.organization = new ze(this._networkClient, this._subscriptionService), this.member = new Ke(this._networkClient, this._subscriptionService), this.self = new Ke(this._networkClient, this._subscriptionService), this.session = new qe(this._networkClient, this._subscriptionService), this.magicLinks = new je(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "magic_links"), m, v.getAsync(), g), this.oauth = new Ue(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "oauth"), v.getAsync(), {
|
|
4536
4654
|
publicToken: e,
|
|
4537
4655
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4538
4656
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4539
|
-
}, g), this.sso = new
|
|
4657
|
+
}, g), this.sso = new Ne(this._networkClient, this._subscriptionService, new bt(this._dataLayer, "sso"), v.getAsync(), {
|
|
4540
4658
|
publicToken: e,
|
|
4541
4659
|
testAPIURL: i.endpoints.testAPIURL,
|
|
4542
4660
|
liveAPIURL: i.endpoints.liveAPIURL
|
|
4543
|
-
}), this.discovery = new We(this._networkClient, this._subscriptionService), this.passwords = new
|
|
4544
|
-
var y = new
|
|
4661
|
+
}), this.discovery = new We(this._networkClient, this._subscriptionService), this.passwords = new ht(this._networkClient, this._subscriptionService, m, v.getAsync(), g), this.otps = new Ge(this._networkClient, this._subscriptionService, g), this.totp = new He(this._networkClient, this._subscriptionService, g), this.recoveryCodes = new Ye(this._networkClient, this._subscriptionService, g), this.rbac = new Ve(v.getSync(), v.getAsync(), this._subscriptionService), this._sessionManager = new Je(this._subscriptionService, this.session);
|
|
4662
|
+
var y = new gt(this._networkClient);
|
|
4545
4663
|
this._dataLayer.readSessionCookie().session_token && this._sessionManager.performBackgroundRefresh(), this._networkClient.logEvent({
|
|
4546
4664
|
name: "b2b_sdk_instance_instantiated",
|
|
4547
4665
|
details: {
|
|
@@ -4551,7 +4669,7 @@ exports.BiometricsFailedError = z, exports.BiometricsUnavailableError = A, expor
|
|
|
4551
4669
|
}
|
|
4552
4670
|
});
|
|
4553
4671
|
(function (e, t) {
|
|
4554
|
-
Object.assign(e, _defineProperty({},
|
|
4672
|
+
Object.assign(e, _defineProperty({}, It, t));
|
|
4555
4673
|
})(this, {
|
|
4556
4674
|
bootstrap: v,
|
|
4557
4675
|
publicToken: e,
|
|
@@ -4602,13 +4720,13 @@ exports.BiometricsFailedError = z, exports.BiometricsUnavailableError = A, expor
|
|
|
4602
4720
|
case "sdk_not_configured":
|
|
4603
4721
|
return new j();
|
|
4604
4722
|
case "failed_code_challenge":
|
|
4605
|
-
return new N();
|
|
4606
|
-
case "passkeys_unsupported":
|
|
4607
4723
|
return new K();
|
|
4724
|
+
case "passkeys_unsupported":
|
|
4725
|
+
return new N();
|
|
4608
4726
|
case "failed_to_decrypt_data":
|
|
4609
|
-
return new U();
|
|
4610
|
-
case "biometrics_failed":
|
|
4611
4727
|
return new z();
|
|
4728
|
+
case "biometrics_failed":
|
|
4729
|
+
return new U();
|
|
4612
4730
|
case "invalid_start_url":
|
|
4613
4731
|
return new q();
|
|
4614
4732
|
case "invalid_redirect_scheme":
|