@sesamy/sesamy-js 1.95.0 → 1.97.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/dist/auth0-plugin.iife.js +4 -4
- package/dist/auth0-plugin.mjs +61 -62
- package/dist/sesamy-js.cjs +6 -6
- package/dist/sesamy-js.d.ts +12 -10
- package/dist/sesamy-js.iife.js +6 -6
- package/dist/sesamy-js.mjs +301 -299
- package/package.json +1 -1
package/dist/auth0-plugin.mjs
CHANGED
|
@@ -8,13 +8,13 @@ function O(o, e) {
|
|
|
8
8
|
return t;
|
|
9
9
|
}
|
|
10
10
|
var j = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
11
|
-
function
|
|
11
|
+
function ye(o) {
|
|
12
12
|
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function we(o, e) {
|
|
15
15
|
return o(e = { exports: {} }, e.exports), e.exports;
|
|
16
16
|
}
|
|
17
|
-
var R =
|
|
17
|
+
var R = we((function(o, e) {
|
|
18
18
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
19
19
|
var t = (function() {
|
|
20
20
|
function n() {
|
|
@@ -44,8 +44,8 @@ var R = be((function(o, e) {
|
|
|
44
44
|
return t.getInstance();
|
|
45
45
|
};
|
|
46
46
|
}));
|
|
47
|
-
|
|
48
|
-
var nt = we(
|
|
47
|
+
ye(R);
|
|
48
|
+
var nt = ye(we((function(o, e) {
|
|
49
49
|
var t = j && j.__awaiter || function(s, l, a, u) {
|
|
50
50
|
return new (a || (a = Promise))((function(p, g) {
|
|
51
51
|
function f(k) {
|
|
@@ -316,14 +316,14 @@ class _ extends Error {
|
|
|
316
316
|
return new _(e, t);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
class
|
|
319
|
+
class be extends _ {
|
|
320
320
|
constructor(e, t, n, i = null) {
|
|
321
|
-
super(e, t), this.state = n, this.appState = i, Object.setPrototypeOf(this,
|
|
321
|
+
super(e, t), this.state = n, this.appState = i, Object.setPrototypeOf(this, be.prototype);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
class
|
|
324
|
+
class ke extends _ {
|
|
325
325
|
constructor(e, t, n, i, r = null) {
|
|
326
|
-
super(e, t), this.connection = n, this.state = i, this.appState = r, Object.setPrototypeOf(this,
|
|
326
|
+
super(e, t), this.connection = n, this.state = i, this.appState = r, Object.setPrototypeOf(this, ke.prototype);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
class Z extends _ {
|
|
@@ -331,24 +331,24 @@ class Z extends _ {
|
|
|
331
331
|
super("timeout", "Timeout"), Object.setPrototypeOf(this, Z.prototype);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
class
|
|
334
|
+
class ve extends Z {
|
|
335
335
|
constructor(e) {
|
|
336
|
-
super(), this.popup = e, Object.setPrototypeOf(this,
|
|
336
|
+
super(), this.popup = e, Object.setPrototypeOf(this, ve.prototype);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class Se extends _ {
|
|
340
340
|
constructor(e) {
|
|
341
|
-
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this,
|
|
341
|
+
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, Se.prototype);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
class
|
|
344
|
+
class _e extends _ {
|
|
345
345
|
constructor() {
|
|
346
|
-
super("popup_open", "Unable to open a popup for loginWithPopup - window.open returned `null`"), Object.setPrototypeOf(this,
|
|
346
|
+
super("popup_open", "Unable to open a popup for loginWithPopup - window.open returned `null`"), Object.setPrototypeOf(this, _e.prototype);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
class
|
|
349
|
+
class Ie extends _ {
|
|
350
350
|
constructor(e, t, n) {
|
|
351
|
-
super(e, t), this.mfa_token = n, Object.setPrototypeOf(this,
|
|
351
|
+
super(e, t), this.mfa_token = n, Object.setPrototypeOf(this, Ie.prototype);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
class ce extends _ {
|
|
@@ -356,9 +356,9 @@ class ce extends _ {
|
|
|
356
356
|
super("missing_refresh_token", `Missing Refresh Token (audience: '${ie(e, ["default"])}', scope: '${ie(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, ce.prototype);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
class
|
|
359
|
+
class Te extends _ {
|
|
360
360
|
constructor(e, t) {
|
|
361
|
-
super("missing_scopes", `Missing requested scopes after refresh (audience: '${ie(e, ["default"])}', missing scope: '${ie(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this,
|
|
361
|
+
super("missing_scopes", `Missing requested scopes after refresh (audience: '${ie(e, ["default"])}', missing scope: '${ie(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, Te.prototype);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
class ue extends _ {
|
|
@@ -373,10 +373,10 @@ const re = () => window.crypto, W = () => {
|
|
|
373
373
|
const o = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
374
374
|
let e = "";
|
|
375
375
|
return Array.from(re().getRandomValues(new Uint8Array(43))).forEach(((t) => e += o[t % o.length])), e;
|
|
376
|
-
},
|
|
376
|
+
}, le = (o) => btoa(o), it = [{ key: "name", type: ["string"] }, { key: "version", type: ["string", "number"] }, { key: "env", type: ["object"] }], rt = (o) => Object.keys(o).reduce(((e, t) => {
|
|
377
377
|
const n = it.find(((i) => i.key === t));
|
|
378
378
|
return n && n.type.includes(typeof o[t]) && (e[t] = o[t]), e;
|
|
379
|
-
}), {}),
|
|
379
|
+
}), {}), me = (o) => {
|
|
380
380
|
var { clientId: e } = o, t = O(o, ["clientId"]);
|
|
381
381
|
return new URLSearchParams(((n) => Object.keys(n).filter(((i) => n[i] !== void 0)).reduce(((i, r) => Object.assign(Object.assign({}, i), { [r]: n[r] })), {}))(Object.assign({ client_id: e }, t))).toString();
|
|
382
382
|
}, Ae = async (o) => await re().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(o)), xe = (o) => ((e) => decodeURIComponent(atob(e).split("").map(((t) => "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2))).join("")))(o.replace(/_/g, "/").replace(/-/g, "+")), Re = (o) => {
|
|
@@ -409,15 +409,15 @@ async function ct(o, e, t) {
|
|
|
409
409
|
throw new K();
|
|
410
410
|
})(t), t, B(n)))}`;
|
|
411
411
|
}
|
|
412
|
-
let
|
|
413
|
-
Uint8Array.prototype.toBase64 ?
|
|
412
|
+
let fe;
|
|
413
|
+
Uint8Array.prototype.toBase64 ? fe = (o) => (o instanceof ArrayBuffer && (o = new Uint8Array(o)), o.toBase64({ alphabet: "base64url", omitPadding: !0 })) : fe = (e) => {
|
|
414
414
|
e instanceof ArrayBuffer && (e = new Uint8Array(e));
|
|
415
415
|
const t = [];
|
|
416
416
|
for (let n = 0; n < e.byteLength; n += 32768) t.push(String.fromCharCode.apply(null, e.subarray(n, n + 32768)));
|
|
417
417
|
return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
418
418
|
};
|
|
419
419
|
function q(o) {
|
|
420
|
-
return
|
|
420
|
+
return fe(o);
|
|
421
421
|
}
|
|
422
422
|
class K extends Error {
|
|
423
423
|
constructor(e) {
|
|
@@ -570,7 +570,7 @@ async function Ye(o, e, t, n, i, r, c, h, d, m) {
|
|
|
570
570
|
let b;
|
|
571
571
|
if (d && (b = f["dpop-nonce"], b && await d.setNonce(b)), !w) {
|
|
572
572
|
const k = p || `HTTP error. Unable to fetch ${o}`;
|
|
573
|
-
if (u === "mfa_required") throw new
|
|
573
|
+
if (u === "mfa_required") throw new Ie(u, k, g.mfa_token);
|
|
574
574
|
if (u === "missing_refresh_token") throw new ce(t, n);
|
|
575
575
|
if (u === "use_dpop_nonce") {
|
|
576
576
|
if (!d || !b || m) throw new ue(b);
|
|
@@ -582,7 +582,7 @@ async function Ye(o, e, t, n, i, r, c, h, d, m) {
|
|
|
582
582
|
}
|
|
583
583
|
async function kt(o, e) {
|
|
584
584
|
var { baseUrl: t, timeout: n, audience: i, scope: r, auth0Client: c, useFormData: h, useMrrt: d, dpop: m } = o, s = O(o, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop"]);
|
|
585
|
-
const l = s.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange", a = s.grant_type === "refresh_token" && d, u = Object.assign(Object.assign(Object.assign(Object.assign({}, s), l && i && { audience: i }), l && r && { scope: r }), a && { audience: i, scope: r }), p = h ?
|
|
585
|
+
const l = s.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange", a = s.grant_type === "refresh_token" && d, u = Object.assign(Object.assign(Object.assign(Object.assign({}, s), l && i && { audience: i }), l && r && { scope: r }), a && { audience: i, scope: r }), p = h ? me(u) : JSON.stringify(u), g = (f = s.grant_type, ht.includes(f));
|
|
586
586
|
var f;
|
|
587
587
|
return await Ye(`${t}/oauth/token`, n, i || "default", r, { method: "POST", body: p, headers: { "Content-Type": h ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(rt(c || $e))) } }, e, h, d, g ? m : void 0);
|
|
588
588
|
}
|
|
@@ -799,7 +799,7 @@ const J = (o) => typeof o == "number", It = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
799
799
|
}
|
|
800
800
|
return e;
|
|
801
801
|
};
|
|
802
|
-
var z =
|
|
802
|
+
var z = we((function(o, e) {
|
|
803
803
|
var t = j && j.__assign || function() {
|
|
804
804
|
return t = Object.assign || function(d) {
|
|
805
805
|
for (var m, s = 1, l = arguments.length; s < l; s++) for (var a in m = arguments[s]) Object.prototype.hasOwnProperty.call(m, a) && (d[a] = m[a]);
|
|
@@ -843,7 +843,7 @@ var z = be((function(o, e) {
|
|
|
843
843
|
h(d, "", t(t({}, m), { expires: -1 }));
|
|
844
844
|
};
|
|
845
845
|
}));
|
|
846
|
-
|
|
846
|
+
ye(z), z.encode, z.parse, z.getAll;
|
|
847
847
|
var Pt = z.get, qe = z.set, Qe = z.remove;
|
|
848
848
|
const L = { get(o) {
|
|
849
849
|
const e = Pt(o);
|
|
@@ -887,10 +887,10 @@ function Ct(o, e, t) {
|
|
|
887
887
|
`, 10) + 1, c = i.substring(r) + (n ? "//# sourceMappingURL=" + n : ""), h = new Blob([c], { type: "application/javascript" });
|
|
888
888
|
return URL.createObjectURL(h);
|
|
889
889
|
}
|
|
890
|
-
var Ne, De, Ke,
|
|
891
|
-
return
|
|
890
|
+
var Ne, De, Ke, de, At = (Ne = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0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T5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==", De = null, Ke = !1, function(o) {
|
|
891
|
+
return de = de || Ct(Ne, De, Ke), new Worker(de, o);
|
|
892
892
|
});
|
|
893
|
-
const
|
|
893
|
+
const he = {}, ze = async (o, e = 3) => {
|
|
894
894
|
for (let t = 0; t < e; t++) if (await o()) return !0;
|
|
895
895
|
return !1;
|
|
896
896
|
};
|
|
@@ -1142,7 +1142,7 @@ class zt {
|
|
|
1142
1142
|
return `${this.domainUrl}${e}&auth0Client=${t}`;
|
|
1143
1143
|
}
|
|
1144
1144
|
_authorizeUrl(e) {
|
|
1145
|
-
return this._url(`/authorize?${
|
|
1145
|
+
return this._url(`/authorize?${me(e)}`);
|
|
1146
1146
|
}
|
|
1147
1147
|
async _verifyIdToken(e, t, n) {
|
|
1148
1148
|
const i = await this.nowProvider();
|
|
@@ -1154,7 +1154,7 @@ class zt {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
async _prepareAuthorizeUrl(e, t, n) {
|
|
1156
1156
|
var i;
|
|
1157
|
-
const r =
|
|
1157
|
+
const r = le(W()), c = le(W()), h = W(), d = await Ae(h), m = Re(d), s = await ((i = this.dpop) === null || i === void 0 ? void 0 : i.calculateThumbprint()), l = ((u, p, g, f, w, b, k, y, S) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), g), { scope: Q(p, g.scope, g.audience), response_type: "code", response_mode: y || "query", state: f, nonce: w, redirect_uri: k || u.authorizationParams.redirect_uri, code_challenge: b, code_challenge_method: "S256", dpop_jkt: S }))(this.options, this.scope, e, r, c, m, e.redirect_uri || this.options.authorizationParams.redirect_uri || n, t?.response_mode, s), a = this._authorizeUrl(l);
|
|
1158
1158
|
return { nonce: c, code_verifier: h, scope: l.scope, audience: l.audience || "default", redirect_uri: l.redirect_uri, state: r, url: a };
|
|
1159
1159
|
}
|
|
1160
1160
|
async loginWithPopup(e, t) {
|
|
@@ -1162,15 +1162,15 @@ class zt {
|
|
|
1162
1162
|
if (e = e || {}, !(t = t || {}).popup && (t.popup = ((h) => {
|
|
1163
1163
|
const d = window.screenX + (window.innerWidth - 400) / 2, m = window.screenY + (window.innerHeight - 600) / 2;
|
|
1164
1164
|
return window.open(h, "auth0:authorize:popup", `left=${d},top=${m},width=400,height=600,resizable,scrollbars=yes,status=1`);
|
|
1165
|
-
})(""), !t.popup)) throw new
|
|
1165
|
+
})(""), !t.popup)) throw new _e();
|
|
1166
1166
|
const i = await this._prepareAuthorizeUrl(e.authorizationParams || {}, { response_mode: "web_message" }, window.location.origin);
|
|
1167
1167
|
t.popup.location.href = i.url;
|
|
1168
1168
|
const r = await ((h) => new Promise(((d, m) => {
|
|
1169
1169
|
let s;
|
|
1170
1170
|
const l = setInterval((() => {
|
|
1171
|
-
h.popup && h.popup.closed && (clearInterval(l), clearTimeout(a), window.removeEventListener("message", s, !1), m(new
|
|
1171
|
+
h.popup && h.popup.closed && (clearInterval(l), clearTimeout(a), window.removeEventListener("message", s, !1), m(new Se(h.popup)));
|
|
1172
1172
|
}), 1e3), a = setTimeout((() => {
|
|
1173
|
-
clearInterval(l), m(new
|
|
1173
|
+
clearInterval(l), m(new ve(h.popup)), window.removeEventListener("message", s, !1);
|
|
1174
1174
|
}), 1e3 * (h.timeoutInSeconds || 60));
|
|
1175
1175
|
s = function(u) {
|
|
1176
1176
|
if (u.data && u.data.type === "authorization_response") {
|
|
@@ -1215,14 +1215,14 @@ class zt {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
async _handleLoginRedirectCallback(e, t) {
|
|
1217
1217
|
const { code: n, state: i, error: r, error_description: c } = e;
|
|
1218
|
-
if (r) throw new
|
|
1218
|
+
if (r) throw new be(r, c || r, i, t.appState);
|
|
1219
1219
|
if (!t.code_verifier || t.state && t.state !== i) throw new _("state_mismatch", "Invalid state");
|
|
1220
1220
|
const h = t.organization, d = t.nonce, m = t.redirect_uri;
|
|
1221
1221
|
return await this._requestToken(Object.assign({ audience: t.audience, scope: t.scope, code_verifier: t.code_verifier, grant_type: "authorization_code", code: n }, m ? { redirect_uri: m } : {}), { nonceIn: d, organization: h }), { appState: t.appState, response_type: N.Code };
|
|
1222
1222
|
}
|
|
1223
1223
|
async _handleConnectAccountRedirectCallback(e, t) {
|
|
1224
1224
|
const { connect_code: n, state: i, error: r, error_description: c } = e;
|
|
1225
|
-
if (r) throw new
|
|
1225
|
+
if (r) throw new ke(r, c || r, t.connection, i, t.appState);
|
|
1226
1226
|
if (!n) throw new _("missing_connect_code", "Missing connect code");
|
|
1227
1227
|
if (!(t.code_verifier && t.state && t.auth_session && t.redirect_uri && t.state === i)) throw new _("state_mismatch", "Invalid state");
|
|
1228
1228
|
const h = await this.myAccountApi.completeAccount({ auth_session: t.auth_session, connect_code: n, redirect_uri: t.redirect_uri, code_verifier: t.code_verifier });
|
|
@@ -1241,10 +1241,10 @@ class zt {
|
|
|
1241
1241
|
async getTokenSilently(e = {}) {
|
|
1242
1242
|
var t, n;
|
|
1243
1243
|
const i = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Q(this.scope, (t = e.authorizationParams) === null || t === void 0 ? void 0 : t.scope, ((n = e.authorizationParams) === null || n === void 0 ? void 0 : n.audience) || this.options.authorizationParams.audience) }) }), r = await ((c, h) => {
|
|
1244
|
-
let d =
|
|
1244
|
+
let d = he[h];
|
|
1245
1245
|
return d || (d = c().finally((() => {
|
|
1246
|
-
delete
|
|
1247
|
-
})),
|
|
1246
|
+
delete he[h], d = null;
|
|
1247
|
+
})), he[h] = d), d;
|
|
1248
1248
|
})((() => this._getTokenSilently(i)), `${this.options.clientId}::${i.authorizationParams.audience}::${i.authorizationParams.scope}`);
|
|
1249
1249
|
return e.detailedResponse ? r : r?.access_token;
|
|
1250
1250
|
}
|
|
@@ -1281,7 +1281,7 @@ class zt {
|
|
|
1281
1281
|
_buildLogoutUrl(e) {
|
|
1282
1282
|
e.clientId !== null ? e.clientId = e.clientId || this.options.clientId : delete e.clientId;
|
|
1283
1283
|
const t = e.logoutParams || {}, { federated: n } = t, i = O(t, ["federated"]), r = n ? "&federated" : "";
|
|
1284
|
-
return this._url(`/v2/logout?${
|
|
1284
|
+
return this._url(`/v2/logout?${me(Object.assign({ clientId: e.clientId }, i))}`) + r;
|
|
1285
1285
|
}
|
|
1286
1286
|
async logout(e = {}) {
|
|
1287
1287
|
var t;
|
|
@@ -1354,7 +1354,7 @@ class zt {
|
|
|
1354
1354
|
const p = a?.split(" ") || [], g = u?.split(" ") || [];
|
|
1355
1355
|
return p.filter(((f) => g.indexOf(f) == -1)).join(",");
|
|
1356
1356
|
})(r, s.scope);
|
|
1357
|
-
throw new
|
|
1357
|
+
throw new Te(e.authorizationParams.audience || "default", l);
|
|
1358
1358
|
}
|
|
1359
1359
|
return Object.assign(Object.assign({}, s), { scope: e.authorizationParams.scope, oauthTokenScope: s.scope, audience: e.authorizationParams.audience || "default" });
|
|
1360
1360
|
} catch (s) {
|
|
@@ -1411,7 +1411,7 @@ class zt {
|
|
|
1411
1411
|
async connectAccountWithRedirect(e) {
|
|
1412
1412
|
const { openUrl: t, appState: n, connection: i, scopes: r, authorization_params: c, redirectUri: h = this.options.authorizationParams.redirect_uri || window.location.origin } = e;
|
|
1413
1413
|
if (!i) throw new Error("connection is required");
|
|
1414
|
-
const d =
|
|
1414
|
+
const d = le(W()), m = W(), s = await Ae(m), l = Re(s), { connect_uri: a, connect_params: u, auth_session: p } = await this.myAccountApi.connectAccount({ connection: i, scopes: r, redirect_uri: h, state: d, code_challenge: l, code_challenge_method: "S256", authorization_params: c });
|
|
1415
1415
|
this.transactionManager.create({ state: d, code_verifier: m, auth_session: p, redirect_uri: h, appState: n, connection: i, response_type: N.ConnectCode });
|
|
1416
1416
|
const g = new URL(a);
|
|
1417
1417
|
g.searchParams.set("ticket", u.ticket), t ? await t(g.toString()) : window.location.assign(g);
|
|
@@ -1441,7 +1441,7 @@ function Zt() {
|
|
|
1441
1441
|
function v(o) {
|
|
1442
1442
|
Zt() && console.log(o);
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function pe(o, e) {
|
|
1445
1445
|
if (typeof window > "u")
|
|
1446
1446
|
return;
|
|
1447
1447
|
const t = new CustomEvent(o, {
|
|
@@ -1491,10 +1491,10 @@ function $t() {
|
|
|
1491
1491
|
* Please keep this comment intact in order to properly abide by the MIT License.
|
|
1492
1492
|
*
|
|
1493
1493
|
**/
|
|
1494
|
-
var
|
|
1495
|
-
for (var t in e)
|
|
1496
|
-
}, o: (o, e) => Object.prototype.hasOwnProperty.call(o, e) },
|
|
1497
|
-
|
|
1494
|
+
var ge = { d: (o, e) => {
|
|
1495
|
+
for (var t in e) ge.o(e, t) && !ge.o(o, t) && Object.defineProperty(o, t, { enumerable: !0, get: e[t] });
|
|
1496
|
+
}, o: (o, e) => Object.prototype.hasOwnProperty.call(o, e) }, Pe = {};
|
|
1497
|
+
ge.d(Pe, { A: () => Xt, k: () => Oe });
|
|
1498
1498
|
var $ = function(o, e, t, n) {
|
|
1499
1499
|
return new (t || (t = Promise))(function(i, r) {
|
|
1500
1500
|
function c(m) {
|
|
@@ -1578,7 +1578,7 @@ var $ = function(o, e, t, n) {
|
|
|
1578
1578
|
};
|
|
1579
1579
|
}
|
|
1580
1580
|
};
|
|
1581
|
-
function
|
|
1581
|
+
function Oe() {
|
|
1582
1582
|
return $(this, void 0, Promise, function() {
|
|
1583
1583
|
return X(this, function(o) {
|
|
1584
1584
|
switch (o.label) {
|
|
@@ -1742,10 +1742,10 @@ function Ee() {
|
|
|
1742
1742
|
});
|
|
1743
1743
|
});
|
|
1744
1744
|
}
|
|
1745
|
-
typeof window < "u" && (window.detectIncognito =
|
|
1746
|
-
const Xt =
|
|
1747
|
-
|
|
1748
|
-
|
|
1745
|
+
typeof window < "u" && (window.detectIncognito = Oe);
|
|
1746
|
+
const Xt = Oe;
|
|
1747
|
+
Pe.A;
|
|
1748
|
+
Pe.k;
|
|
1749
1749
|
const Vt = "sesamy_incognito_mode";
|
|
1750
1750
|
function Ze() {
|
|
1751
1751
|
try {
|
|
@@ -1755,7 +1755,7 @@ function Ze() {
|
|
|
1755
1755
|
return;
|
|
1756
1756
|
}
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function Ee() {
|
|
1759
1759
|
return typeof window < "u";
|
|
1760
1760
|
}
|
|
1761
1761
|
function Gt() {
|
|
@@ -1781,7 +1781,7 @@ function Je(o) {
|
|
|
1781
1781
|
return JSON.parse(i);
|
|
1782
1782
|
}
|
|
1783
1783
|
function Fe() {
|
|
1784
|
-
if (!
|
|
1784
|
+
if (!Ee()) return !1;
|
|
1785
1785
|
try {
|
|
1786
1786
|
const o = document.cookie.split(";").map((t) => t.trim());
|
|
1787
1787
|
if (o.some((t) => t.startsWith(`${et}=true`)) || o.some((t) => t.startsWith("auth0.is.authenticated=true"))) return !0;
|
|
@@ -1798,7 +1798,7 @@ function Fe() {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
1800
|
function Y(o) {
|
|
1801
|
-
if (
|
|
1801
|
+
if (Ee())
|
|
1802
1802
|
try {
|
|
1803
1803
|
const e = o ? 2592e3 : 0, t = window.location.protocol === "https:" ? "; Secure" : "";
|
|
1804
1804
|
document.cookie = `${et}=${o}; path=/; max-age=${e}; SameSite=Lax${t}`;
|
|
@@ -1942,7 +1942,7 @@ function rn() {
|
|
|
1942
1942
|
}
|
|
1943
1943
|
function sn() {
|
|
1944
1944
|
let o, e, t, n = !1, i = !1, r = !1;
|
|
1945
|
-
|
|
1945
|
+
Ee() && window.addEventListener("pageshow", () => {
|
|
1946
1946
|
i = !1, r = !1;
|
|
1947
1947
|
});
|
|
1948
1948
|
async function c(a) {
|
|
@@ -2074,12 +2074,12 @@ function sn() {
|
|
|
2074
2074
|
v(`Login result: ${JSON.stringify(I)}`);
|
|
2075
2075
|
const A = await o.getUser();
|
|
2076
2076
|
if (!A) throw new Error("No user found");
|
|
2077
|
-
v(`User found ${JSON.stringify(A)}`), ne(), te() && (v("Successfully recovered session via prompt=none redirect"), G()), Y(!0), v(`Triggering AUTHENTICATED event with appState: ${JSON.stringify(I.appState)}`),
|
|
2077
|
+
v(`User found ${JSON.stringify(A)}`), ne(), te() && (v("Successfully recovered session via prompt=none redirect"), G()), Y(!0), v(`Triggering AUTHENTICATED event with appState: ${JSON.stringify(I.appState)}`), pe(M.AUTHENTICATED, { ...A, appState: I.appState });
|
|
2078
2078
|
} catch (I) {
|
|
2079
2079
|
v(`Error handling redirect: ${I.message}`), te() ? (G(), ee(), v("Silent redirect failed, cleared session hints")) : alert("There was an error logging in"), console.error(I);
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
|
-
n = !0,
|
|
2082
|
+
n = !0, pe(M.AUTH_INITIALIZED, {});
|
|
2083
2083
|
},
|
|
2084
2084
|
async isAuthenticated() {
|
|
2085
2085
|
if (!n) return !1;
|
|
@@ -2141,7 +2141,7 @@ function sn() {
|
|
|
2141
2141
|
window.dispatchEvent(g) && window.location.reload();
|
|
2142
2142
|
},
|
|
2143
2143
|
async logout(a = {}) {
|
|
2144
|
-
if (n && (localStorage.removeItem(U), localStorage.removeItem(V), ee(), G(), ne(),
|
|
2144
|
+
if (n && (localStorage.removeItem(U), localStorage.removeItem(V), ee(), G(), ne(), pe(M.LOGOUT, {}), !!o))
|
|
2145
2145
|
return v(`Logout with options: ${JSON.stringify(a)}`), o.logout({
|
|
2146
2146
|
...a,
|
|
2147
2147
|
logoutParams: {
|
|
@@ -2153,7 +2153,6 @@ function sn() {
|
|
|
2153
2153
|
};
|
|
2154
2154
|
return l;
|
|
2155
2155
|
}
|
|
2156
|
-
le() && (sn(), void 0);
|
|
2157
2156
|
export {
|
|
2158
2157
|
U as ACCESS_TOKEN_KEY,
|
|
2159
2158
|
V as REFRESH_TOKEN_KEY,
|