@stytch/vanilla-js 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/b2b/index.esm.js +65 -39
- package/dist/b2b/index.js +395 -369
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +418 -402
- package/dist/index.headless.js +74 -58
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.headless.js
CHANGED
|
@@ -237,7 +237,7 @@ function o() {
|
|
|
237
237
|
for (r.method = i, r.arg = o;;) {
|
|
238
238
|
var s = r.delegate;
|
|
239
239
|
if (s) {
|
|
240
|
-
var a =
|
|
240
|
+
var a = T(s, r);
|
|
241
241
|
if (a) {
|
|
242
242
|
if (a === p) continue;
|
|
243
243
|
return a;
|
|
@@ -260,16 +260,16 @@ function o() {
|
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function T(e, t) {
|
|
264
264
|
var r = t.method,
|
|
265
265
|
n = e.iterator[r];
|
|
266
|
-
if (void 0 === n) return t.delegate = null, "throw" === r && e.iterator["return"] && (t.method = "return", t.arg = void 0,
|
|
266
|
+
if (void 0 === n) return t.delegate = null, "throw" === r && e.iterator["return"] && (t.method = "return", t.arg = void 0, T(e, t), "throw" === t.method) || "return" !== r && (t.method = "throw", t.arg = new TypeError("The iterator does not provide a '" + r + "' method")), p;
|
|
267
267
|
var i = h(n, e.iterator, t.arg);
|
|
268
268
|
if ("throw" === i.type) return t.method = "throw", t.arg = i.arg, t.delegate = null, p;
|
|
269
269
|
var o = i.arg;
|
|
270
270
|
return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, p) : o : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, p);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function C(e) {
|
|
273
273
|
var t = {
|
|
274
274
|
tryLoc: e[0]
|
|
275
275
|
};
|
|
@@ -282,7 +282,7 @@ function o() {
|
|
|
282
282
|
function A(e) {
|
|
283
283
|
this.tryEntries = [{
|
|
284
284
|
tryLoc: "root"
|
|
285
|
-
}], e.forEach(
|
|
285
|
+
}], e.forEach(C, this), this.reset(!0);
|
|
286
286
|
}
|
|
287
287
|
function E(e) {
|
|
288
288
|
if (e) {
|
|
@@ -544,8 +544,8 @@ var v,
|
|
|
544
544
|
k,
|
|
545
545
|
w,
|
|
546
546
|
S = "https://accounts.google.com/gsi",
|
|
547
|
-
|
|
548
|
-
function
|
|
547
|
+
T = "".concat(S, "/client");
|
|
548
|
+
function C(e, t) {
|
|
549
549
|
var r = {};
|
|
550
550
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
551
551
|
if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
|
|
@@ -887,10 +887,10 @@ var X,
|
|
|
887
887
|
return r;
|
|
888
888
|
},
|
|
889
889
|
ne = function ne(e) {
|
|
890
|
-
return
|
|
890
|
+
return C(e, ["request_id", "status_code"]);
|
|
891
891
|
},
|
|
892
892
|
ie = function ie(e) {
|
|
893
|
-
return
|
|
893
|
+
return C(e, ["__user"]);
|
|
894
894
|
},
|
|
895
895
|
oe = a(function e(t, r, n) {
|
|
896
896
|
var i = this,
|
|
@@ -936,30 +936,44 @@ var X,
|
|
|
936
936
|
}));
|
|
937
937
|
}, this.getDFPTelemetryIDAndCaptcha = function () {
|
|
938
938
|
return O(i, void 0, void 0, o().mark(function e() {
|
|
939
|
-
var t, r, n, i, s;
|
|
939
|
+
var t, r, n, i, s, a;
|
|
940
940
|
return o().wrap(function (e) {
|
|
941
941
|
for (;;) switch (e.prev = e.next) {
|
|
942
942
|
case 0:
|
|
943
943
|
return e.next = 2, this.state;
|
|
944
944
|
case 2:
|
|
945
|
-
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = void 0,
|
|
946
|
-
e.next =
|
|
945
|
+
if (t = e.sent, r = t.enabled, n = t.executeRecaptcha, i = t.mode, s = void 0, a = void 0, r) {
|
|
946
|
+
e.next = 12;
|
|
947
947
|
break;
|
|
948
948
|
}
|
|
949
|
-
return e.next =
|
|
950
|
-
case
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
949
|
+
return e.next = 11, n();
|
|
950
|
+
case 11:
|
|
951
|
+
a = e.sent;
|
|
952
|
+
case 12:
|
|
953
|
+
if ("DECISIONING" !== i) {
|
|
954
|
+
e.next = 18;
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
return e.next = 15, this.getTelemetryID();
|
|
955
958
|
case 15:
|
|
956
|
-
s = e.sent;
|
|
957
|
-
|
|
959
|
+
s = e.sent, e.next = 25;
|
|
960
|
+
break;
|
|
961
|
+
case 18:
|
|
962
|
+
if ("OBSERVATION" !== i) {
|
|
963
|
+
e.next = 25;
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
return e.next = 21, this.getTelemetryID();
|
|
967
|
+
case 21:
|
|
968
|
+
return s = e.sent, e.next = 24, n();
|
|
969
|
+
case 24:
|
|
970
|
+
a = e.sent;
|
|
971
|
+
case 25:
|
|
958
972
|
return e.abrupt("return", {
|
|
959
|
-
dfp_telemetry_id:
|
|
960
|
-
captcha_token:
|
|
973
|
+
dfp_telemetry_id: s,
|
|
974
|
+
captcha_token: a
|
|
961
975
|
});
|
|
962
|
-
case
|
|
976
|
+
case 26:
|
|
963
977
|
case "end":
|
|
964
978
|
return e.stop();
|
|
965
979
|
}
|
|
@@ -1021,6 +1035,7 @@ var X,
|
|
|
1021
1035
|
publicToken: t,
|
|
1022
1036
|
dfpBackendURL: r,
|
|
1023
1037
|
enabled: !0,
|
|
1038
|
+
mode: e.dfpProtectedAuthMode || "OBSERVATION",
|
|
1024
1039
|
loaded: !0,
|
|
1025
1040
|
executeRecaptcha: s
|
|
1026
1041
|
});
|
|
@@ -2241,26 +2256,26 @@ function Se(e) {
|
|
|
2241
2256
|
schema: e
|
|
2242
2257
|
};
|
|
2243
2258
|
}
|
|
2244
|
-
function
|
|
2259
|
+
function Te(e) {
|
|
2245
2260
|
return {
|
|
2246
2261
|
required: !1,
|
|
2247
2262
|
schema: e
|
|
2248
2263
|
};
|
|
2249
2264
|
}
|
|
2250
|
-
var
|
|
2265
|
+
var Ce = {
|
|
2251
2266
|
type: Se(ge),
|
|
2252
2267
|
id: Se(be),
|
|
2253
|
-
transports:
|
|
2268
|
+
transports: Te(ge)
|
|
2254
2269
|
},
|
|
2255
2270
|
Oe = {
|
|
2256
|
-
appid:
|
|
2257
|
-
appidExclude:
|
|
2258
|
-
credProps:
|
|
2271
|
+
appid: Te(ge),
|
|
2272
|
+
appidExclude: Te(ge),
|
|
2273
|
+
credProps: Te(ge)
|
|
2259
2274
|
},
|
|
2260
2275
|
Ae = {
|
|
2261
|
-
appid:
|
|
2262
|
-
appidExclude:
|
|
2263
|
-
credProps:
|
|
2276
|
+
appid: Te(ge),
|
|
2277
|
+
appidExclude: Te(ge),
|
|
2278
|
+
credProps: Te(ge)
|
|
2264
2279
|
},
|
|
2265
2280
|
Ee = {
|
|
2266
2281
|
publicKey: Se({
|
|
@@ -2272,19 +2287,19 @@ var Te = {
|
|
|
2272
2287
|
}),
|
|
2273
2288
|
challenge: Se(be),
|
|
2274
2289
|
pubKeyCredParams: Se(ge),
|
|
2275
|
-
timeout:
|
|
2276
|
-
excludeCredentials:
|
|
2277
|
-
authenticatorSelection:
|
|
2278
|
-
attestation:
|
|
2279
|
-
extensions:
|
|
2290
|
+
timeout: Te(ge),
|
|
2291
|
+
excludeCredentials: Te([Ce]),
|
|
2292
|
+
authenticatorSelection: Te(ge),
|
|
2293
|
+
attestation: Te(ge),
|
|
2294
|
+
extensions: Te(Oe)
|
|
2280
2295
|
}),
|
|
2281
|
-
signal:
|
|
2296
|
+
signal: Te(ge)
|
|
2282
2297
|
},
|
|
2283
2298
|
Pe = {
|
|
2284
2299
|
type: Se(ge),
|
|
2285
2300
|
id: Se(ge),
|
|
2286
2301
|
rawId: Se(be),
|
|
2287
|
-
authenticatorAttachment:
|
|
2302
|
+
authenticatorAttachment: Te(ge),
|
|
2288
2303
|
response: Se({
|
|
2289
2304
|
clientDataJSON: Se(be),
|
|
2290
2305
|
attestationObject: Se(be),
|
|
@@ -2298,22 +2313,22 @@ var Te = {
|
|
|
2298
2313
|
})
|
|
2299
2314
|
},
|
|
2300
2315
|
xe = {
|
|
2301
|
-
mediation:
|
|
2316
|
+
mediation: Te(ge),
|
|
2302
2317
|
publicKey: Se({
|
|
2303
2318
|
challenge: Se(be),
|
|
2304
|
-
timeout:
|
|
2305
|
-
rpId:
|
|
2306
|
-
allowCredentials:
|
|
2307
|
-
userVerification:
|
|
2308
|
-
extensions:
|
|
2319
|
+
timeout: Te(ge),
|
|
2320
|
+
rpId: Te(ge),
|
|
2321
|
+
allowCredentials: Te([Ce]),
|
|
2322
|
+
userVerification: Te(ge),
|
|
2323
|
+
extensions: Te(Oe)
|
|
2309
2324
|
}),
|
|
2310
|
-
signal:
|
|
2325
|
+
signal: Te(ge)
|
|
2311
2326
|
},
|
|
2312
2327
|
De = {
|
|
2313
2328
|
type: Se(ge),
|
|
2314
2329
|
id: Se(ge),
|
|
2315
2330
|
rawId: Se(be),
|
|
2316
|
-
authenticatorAttachment:
|
|
2331
|
+
authenticatorAttachment: Te(ge),
|
|
2317
2332
|
response: Se({
|
|
2318
2333
|
clientDataJSON: Se(be),
|
|
2319
2334
|
authenticatorData: Se(be),
|
|
@@ -2998,7 +3013,8 @@ var Ge = /*#__PURE__*/function () {
|
|
|
2998
3013
|
slugPattern: e.slug_pattern,
|
|
2999
3014
|
createOrganizationEnabled: e.create_organization_enabled,
|
|
3000
3015
|
passwordConfig: r,
|
|
3001
|
-
runDFPProtectedAuth: null !== (t = e.dfp_protected_auth_enabled) && void 0 !== t && t
|
|
3016
|
+
runDFPProtectedAuth: null !== (t = e.dfp_protected_auth_enabled) && void 0 !== t && t,
|
|
3017
|
+
dfpProtectedAuthMode: e.dfp_protected_auth_mode
|
|
3002
3018
|
};
|
|
3003
3019
|
}
|
|
3004
3020
|
}]);
|
|
@@ -3406,7 +3422,7 @@ var ht = /*#__PURE__*/function () {
|
|
|
3406
3422
|
},
|
|
3407
3423
|
sdk: {
|
|
3408
3424
|
identifier: "Stytch.js Javascript SDK",
|
|
3409
|
-
version: "2.
|
|
3425
|
+
version: "2.2.1"
|
|
3410
3426
|
}
|
|
3411
3427
|
});
|
|
3412
3428
|
}
|
|
@@ -3651,7 +3667,7 @@ var ft = /*#__PURE__*/function () {
|
|
|
3651
3667
|
_context8.t1 = !0;
|
|
3652
3668
|
_context8.t2 = pt;
|
|
3653
3669
|
_context8.next = 16;
|
|
3654
|
-
return V(
|
|
3670
|
+
return V(T, function () {
|
|
3655
3671
|
return window.google.accounts.id;
|
|
3656
3672
|
});
|
|
3657
3673
|
case 16:
|
|
@@ -3938,7 +3954,7 @@ var wt = /*#__PURE__*/function () {
|
|
|
3938
3954
|
}
|
|
3939
3955
|
}, this.publicToken = e, this.state = null, this.subscriptions = {}, (null == t ? void 0 : t.cookieOptions) ? (re("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);
|
|
3940
3956
|
var r = localStorage.getItem(kt(this.publicToken));
|
|
3941
|
-
if (!r) return
|
|
3957
|
+
if (!r) return;
|
|
3942
3958
|
var n;
|
|
3943
3959
|
try {
|
|
3944
3960
|
n = JSON.parse(r);
|
|
@@ -4087,11 +4103,11 @@ var St = /*#__PURE__*/function (_wt) {
|
|
|
4087
4103
|
}
|
|
4088
4104
|
return _createClass(St);
|
|
4089
4105
|
}(wt);
|
|
4090
|
-
var
|
|
4091
|
-
|
|
4106
|
+
var Tt = Symbol["for"]("__stytch_DataLayer"),
|
|
4107
|
+
Ct = function Ct(e, t) {
|
|
4092
4108
|
var r = function () {
|
|
4093
4109
|
var e = window;
|
|
4094
|
-
return e[
|
|
4110
|
+
return e[Tt] || (e[Tt] = {}), e[Tt];
|
|
4095
4111
|
}();
|
|
4096
4112
|
return r[e] || (r[e] = new St(e, t)), r[e];
|
|
4097
4113
|
},
|
|
@@ -4264,7 +4280,7 @@ exports.SDKAPIUnreachableError = st, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4264
4280
|
}
|
|
4265
4281
|
};
|
|
4266
4282
|
var s, a, c, u, l, d, h, p, f, _, m;
|
|
4267
|
-
this._dataLayer =
|
|
4283
|
+
this._dataLayer = Ct(e, n), this._subscriptionService = new Pt(e, this._dataLayer);
|
|
4268
4284
|
var v = new mt(this._dataLayer, "passwords");
|
|
4269
4285
|
this._networkClient = new ht(e, this._dataLayer, o.endpoints.sdkBackendURL, function () {
|
|
4270
4286
|
var e, t, r, n;
|
|
@@ -4279,7 +4295,7 @@ exports.SDKAPIUnreachableError = st, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4279
4295
|
k = new Ye(o.endpoints.clientsideServicesIframeURL),
|
|
4280
4296
|
w = new ft(e, k),
|
|
4281
4297
|
S = new vt(this._networkClient);
|
|
4282
|
-
var
|
|
4298
|
+
var T, C;
|
|
4283
4299
|
this.user = new ue(this._networkClient, this._subscriptionService), this.session = new le(this._networkClient, this._subscriptionService), this.magicLinks = new he(this._networkClient, this._subscriptionService, new mt(this._dataLayer, "magic_links"), v, y.getAsync(), b), this.otps = new pe(this._networkClient, this._subscriptionService, g.executeRecaptcha, b), this.oauth = new dt(this._networkClient, this._subscriptionService, new mt(this._dataLayer, "oauth"), y.getAsync(), {
|
|
4284
4300
|
publicToken: e,
|
|
4285
4301
|
testAPIURL: o.endpoints.testAPIURL,
|
|
@@ -4291,7 +4307,7 @@ exports.SDKAPIUnreachableError = st, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4291
4307
|
error_callback_registered: !1,
|
|
4292
4308
|
success_callback_registered: !1
|
|
4293
4309
|
}
|
|
4294
|
-
}),
|
|
4310
|
+
}), T = this, C = {
|
|
4295
4311
|
bootstrap: y,
|
|
4296
4312
|
clientsideServices: k,
|
|
4297
4313
|
captcha: g,
|
|
@@ -4300,7 +4316,7 @@ exports.SDKAPIUnreachableError = st, exports.StytchHeadlessClient = /*#__PURE__*
|
|
|
4300
4316
|
publicToken: e,
|
|
4301
4317
|
dataLayer: this._dataLayer,
|
|
4302
4318
|
networkClient: this._networkClient
|
|
4303
|
-
}, Object.assign(
|
|
4319
|
+
}, Object.assign(T, _defineProperty({}, xt, C));
|
|
4304
4320
|
}
|
|
4305
4321
|
return _createClass(_class);
|
|
4306
4322
|
}(), exports.StytchSDKAPIError = ut, exports.StytchSDKNativeError = lt, exports.StytchSDKSchemaError = ct, exports.StytchSDKUsageError = at, exports.UNRECOVERABLE_ERROR_TYPES = ["unauthorized_credentials", "user_unauthenticated", "invalid_secret_authentication", "session_not_found"];
|