@sesamy/sesamy-js 1.3.3 → 1.3.5
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/README.md +69 -0
- package/dist/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +77 -77
- package/package.json +2 -2
package/dist/sesamy-js.mjs
CHANGED
|
@@ -414,7 +414,7 @@ async function Tr(t, e) {
|
|
|
414
414
|
return T;
|
|
415
415
|
}(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: p, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || En)) } }, e, s);
|
|
416
416
|
}
|
|
417
|
-
const
|
|
417
|
+
const Je = (...t) => {
|
|
418
418
|
return (e = t.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
|
|
419
419
|
var e;
|
|
420
420
|
};
|
|
@@ -710,8 +710,8 @@ function Lr(t, e, n) {
|
|
|
710
710
|
`, 10) + 1, a = i.substring(o) + (r ? "//# sourceMappingURL=" + r : ""), s = new Blob([a], { type: "application/javascript" });
|
|
711
711
|
return URL.createObjectURL(s);
|
|
712
712
|
}
|
|
713
|
-
var Mt,
|
|
714
|
-
return ht = ht || Lr(Mt,
|
|
713
|
+
var Mt, Jt, Xt, ht, Ur = (Mt = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm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XRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=", Jt = null, Xt = !1, function(t) {
|
|
714
|
+
return ht = ht || Lr(Mt, Jt, Xt), new Worker(ht, t);
|
|
715
715
|
});
|
|
716
716
|
const ft = {};
|
|
717
717
|
let Rr = class {
|
|
@@ -740,7 +740,7 @@ let Rr = class {
|
|
|
740
740
|
return `@@auth0spajs@@::${e}`;
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
|
-
const Zr = { memory: () => new zn().enclosedCache, localstorage: () => new jr() },
|
|
743
|
+
const Zr = { memory: () => new zn().enclosedCache, localstorage: () => new jr() }, Ft = (t) => Zr[t], Ht = (t) => {
|
|
744
744
|
const { openUrl: e, onRedirect: n } = t, r = Q(t, ["openUrl", "onRedirect"]);
|
|
745
745
|
return Object.assign(Object.assign({}, r), { openUrl: e === !1 || e ? e : n });
|
|
746
746
|
}, pt = new vr();
|
|
@@ -759,14 +759,14 @@ let Wr = class {
|
|
|
759
759
|
})(), e.cache && e.cacheLocation && console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."), e.cache)
|
|
760
760
|
r = e.cache;
|
|
761
761
|
else {
|
|
762
|
-
if (n = e.cacheLocation || "memory", !
|
|
762
|
+
if (n = e.cacheLocation || "memory", !Ft(n))
|
|
763
763
|
throw new Error(`Invalid cache location "${n}"`);
|
|
764
|
-
r =
|
|
764
|
+
r = Ft(n)();
|
|
765
765
|
}
|
|
766
766
|
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? we : Nr, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((a) => `auth0.${a}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
|
|
767
767
|
const i = e.useCookiesForTransactions ? this.cookieStorage : Dr;
|
|
768
768
|
var o;
|
|
769
|
-
this.scope =
|
|
769
|
+
this.scope = Je("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new Cr(i, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || On, this.cacheManager = new xr(r, r.allKeys ? void 0 : new Rr(r, this.options.clientId), this.nowProvider), this.domainUrl = (o = this.options.domain, /^https?:\/\//.test(o) ? o : `https://${o}`), this.tokenIssuer = ((a, s) => a ? a.startsWith("https://") ? a : `https://${a}/` : `${s}/`)(this.options.issuer, this.domainUrl), typeof window < "u" && window.Worker && this.options.useRefreshTokens && n === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new Ur());
|
|
770
770
|
}
|
|
771
771
|
_url(e) {
|
|
772
772
|
const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || En)));
|
|
@@ -790,7 +790,7 @@ let Wr = class {
|
|
|
790
790
|
const d = { "+": "-", "/": "_", "=": "" };
|
|
791
791
|
return h.replace(/[+/=]/g, (w) => d[w]);
|
|
792
792
|
})(window.btoa(String.fromCharCode(...Array.from(c))));
|
|
793
|
-
})(await (async (u) => await Be().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), m = ((u, c, h, d, w, k, v, I) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), h), { scope:
|
|
793
|
+
})(await (async (u) => await Be().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), m = ((u, c, h, d, w, k, v, I) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), h), { scope: Je(c, h.scope), response_type: "code", response_mode: I || "query", state: d, nonce: w, redirect_uri: v || u.authorizationParams.redirect_uri, code_challenge: k, code_challenge_method: "S256" }))(this.options, this.scope, e, i, o, s, e.redirect_uri || this.options.authorizationParams.redirect_uri || r, n == null ? void 0 : n.response_mode), p = this._authorizeUrl(m);
|
|
794
794
|
return { nonce: o, code_verifier: a, scope: m.scope, audience: m.audience || "default", redirect_uri: m.redirect_uri, state: i, url: p };
|
|
795
795
|
}
|
|
796
796
|
async loginWithPopup(e, n) {
|
|
@@ -870,7 +870,7 @@ let Wr = class {
|
|
|
870
870
|
}
|
|
871
871
|
async getTokenSilently(e = {}) {
|
|
872
872
|
var n;
|
|
873
|
-
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
873
|
+
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Je(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope) }) }), i = await ((o, a) => {
|
|
874
874
|
let s = ft[a];
|
|
875
875
|
return s || (s = o().finally(() => {
|
|
876
876
|
delete ft[a], s = null;
|
|
@@ -908,7 +908,7 @@ let Wr = class {
|
|
|
908
908
|
}
|
|
909
909
|
async getTokenWithPopup(e = {}, n = {}) {
|
|
910
910
|
var r;
|
|
911
|
-
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
911
|
+
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Je(this.scope, (r = e.authorizationParams) === null || r === void 0 ? void 0 : r.scope) }) });
|
|
912
912
|
return n = Object.assign(Object.assign({}, wr), n), await this.loginWithPopup(i, n), (await this.cacheManager.get(new le({ scope: i.authorizationParams.scope, audience: i.authorizationParams.audience || "default", clientId: this.options.clientId }))).access_token;
|
|
913
913
|
}
|
|
914
914
|
async isAuthenticated() {
|
|
@@ -999,51 +999,51 @@ async function Kr(t) {
|
|
|
999
999
|
return await e.checkSession(), e;
|
|
1000
1000
|
}
|
|
1001
1001
|
const xt = "sesamy.com", Mr = "https://logs.sesamy.com/events";
|
|
1002
|
-
var pe = /* @__PURE__ */ ((t) => (t.READY = "
|
|
1003
|
-
let
|
|
1004
|
-
async function
|
|
1005
|
-
if (
|
|
1002
|
+
var pe = /* @__PURE__ */ ((t) => (t.READY = "sesamyJsReady", t.AUTHENTICATED = "sesamyJsAuthenticated", t.LOGOUT = "sesamyJsLogout", t.SOFT_PAYWALL = "sesamyJsSoftPaywall", t))(pe || {});
|
|
1003
|
+
let X;
|
|
1004
|
+
async function Jr({ clientId: t }) {
|
|
1005
|
+
if (X = await Kr({
|
|
1006
1006
|
domain: `token.${xt}`,
|
|
1007
1007
|
clientId: t,
|
|
1008
1008
|
cacheLocation: "localstorage"
|
|
1009
1009
|
}), window.location.search.includes("code="))
|
|
1010
1010
|
try {
|
|
1011
|
-
await
|
|
1012
|
-
const e = await
|
|
1011
|
+
await X.handleRedirectCallback();
|
|
1012
|
+
const e = await X.getUser();
|
|
1013
1013
|
rt(pe.AUTHENTICATED, e), window.history.replaceState({}, document.title, "/");
|
|
1014
|
-
const n = await
|
|
1014
|
+
const n = await X.getTokenSilently();
|
|
1015
1015
|
localStorage.setItem("accessToken", n);
|
|
1016
1016
|
} catch {
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
async function
|
|
1020
|
-
if (!
|
|
1019
|
+
async function Xr() {
|
|
1020
|
+
if (!X)
|
|
1021
1021
|
throw new Error("Auth0 client not initialized");
|
|
1022
|
-
return
|
|
1022
|
+
return X.isAuthenticated();
|
|
1023
1023
|
}
|
|
1024
|
-
async function
|
|
1025
|
-
if (!
|
|
1024
|
+
async function Fr() {
|
|
1025
|
+
if (!X)
|
|
1026
1026
|
throw new Error("Auth0 client not initialized");
|
|
1027
|
-
return
|
|
1027
|
+
return X.getUser();
|
|
1028
1028
|
}
|
|
1029
1029
|
function Hr() {
|
|
1030
|
-
if (!
|
|
1030
|
+
if (!X)
|
|
1031
1031
|
throw new Error("Auth0 client not initialized");
|
|
1032
|
-
return
|
|
1032
|
+
return X.loginWithRedirect({
|
|
1033
1033
|
authorizationParams: {
|
|
1034
1034
|
redirect_uri: window.location.href
|
|
1035
1035
|
}
|
|
1036
1036
|
});
|
|
1037
1037
|
}
|
|
1038
1038
|
async function Vr() {
|
|
1039
|
-
if (!
|
|
1039
|
+
if (!X)
|
|
1040
1040
|
throw new Error("Auth0 client not initialized");
|
|
1041
|
-
return
|
|
1041
|
+
return X.getTokenSilently();
|
|
1042
1042
|
}
|
|
1043
1043
|
async function Yr() {
|
|
1044
|
-
if (!
|
|
1044
|
+
if (!X)
|
|
1045
1045
|
throw new Error("Auth0 client not initialized");
|
|
1046
|
-
return rt(pe.LOGOUT, {}),
|
|
1046
|
+
return rt(pe.LOGOUT, {}), X.logout({
|
|
1047
1047
|
logoutParams: {
|
|
1048
1048
|
returnTo: window.location.href
|
|
1049
1049
|
}
|
|
@@ -1429,8 +1429,8 @@ function ki() {
|
|
|
1429
1429
|
function Ii(t = "sesamy") {
|
|
1430
1430
|
const e = {
|
|
1431
1431
|
auth: {
|
|
1432
|
-
getUser:
|
|
1433
|
-
isAuthenticated:
|
|
1432
|
+
getUser: Fr,
|
|
1433
|
+
isAuthenticated: Xr,
|
|
1434
1434
|
loginWithRedirect: Hr,
|
|
1435
1435
|
logout: Yr
|
|
1436
1436
|
},
|
|
@@ -1457,19 +1457,19 @@ function Gt(t, e, n, r, i) {
|
|
|
1457
1457
|
t = t ? t[e[r]] : i;
|
|
1458
1458
|
return t === i ? n : t;
|
|
1459
1459
|
}
|
|
1460
|
-
var
|
|
1461
|
-
}, Mn = "any",
|
|
1460
|
+
var Xe = "undefined", Bt = "object", _i = function() {
|
|
1461
|
+
}, Mn = "any", Jn = "*", me = "__", Qe = typeof process < "u" ? process : {};
|
|
1462
1462
|
Qe.env && Qe.env.NODE_ENV;
|
|
1463
1463
|
var Y = typeof document < "u";
|
|
1464
1464
|
Qe.versions != null && Qe.versions.node != null;
|
|
1465
1465
|
typeof Deno < "u" && Deno.core;
|
|
1466
1466
|
Y && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1467
|
-
function
|
|
1467
|
+
function Xn(t, e) {
|
|
1468
1468
|
return e.charAt(0)[t]() + e.slice(1);
|
|
1469
1469
|
}
|
|
1470
|
-
var Si =
|
|
1470
|
+
var Si = Xn.bind(null, "toUpperCase"), Ei = Xn.bind(null, "toLowerCase");
|
|
1471
1471
|
function Oi(t) {
|
|
1472
|
-
return
|
|
1472
|
+
return Fn(t) ? Si("null") : typeof t == "object" ? xi(t) : Object.prototype.toString.call(t).slice(8, -1);
|
|
1473
1473
|
}
|
|
1474
1474
|
function et(t, e) {
|
|
1475
1475
|
e === void 0 && (e = !0);
|
|
@@ -1481,7 +1481,7 @@ function Ke(t, e) {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
var G = Ke.bind(null, "function"), re = Ke.bind(null, "string"), be = Ke.bind(null, "undefined"), Pi = Ke.bind(null, "boolean");
|
|
1483
1483
|
Ke.bind(null, "symbol");
|
|
1484
|
-
function
|
|
1484
|
+
function Fn(t) {
|
|
1485
1485
|
return t === null;
|
|
1486
1486
|
}
|
|
1487
1487
|
function Ti(t) {
|
|
@@ -1490,7 +1490,7 @@ function Ti(t) {
|
|
|
1490
1490
|
function Hn(t) {
|
|
1491
1491
|
return et(t) === "array";
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function J(t) {
|
|
1494
1494
|
if (!ji(t))
|
|
1495
1495
|
return !1;
|
|
1496
1496
|
for (var e = t; Object.getPrototypeOf(e) !== null; )
|
|
@@ -1507,7 +1507,7 @@ function Ci(t) {
|
|
|
1507
1507
|
return t instanceof Error || re(t.message) && t.constructor && Ti(t.constructor.stackTraceLimit);
|
|
1508
1508
|
}
|
|
1509
1509
|
function Vn(t, e) {
|
|
1510
|
-
if (typeof e != "object" ||
|
|
1510
|
+
if (typeof e != "object" || Fn(e))
|
|
1511
1511
|
return !1;
|
|
1512
1512
|
if (e instanceof t)
|
|
1513
1513
|
return !0;
|
|
@@ -1620,17 +1620,17 @@ function Ce(t, e, n) {
|
|
|
1620
1620
|
return r || n;
|
|
1621
1621
|
}
|
|
1622
1622
|
Pe[Oe] || (Pe[Oe] = {});
|
|
1623
|
-
var
|
|
1623
|
+
var Fe = {};
|
|
1624
1624
|
function $t(t) {
|
|
1625
|
-
if (typeof
|
|
1626
|
-
return
|
|
1625
|
+
if (typeof Fe[t] !== Xe)
|
|
1626
|
+
return Fe[t];
|
|
1627
1627
|
try {
|
|
1628
1628
|
var e = window[t];
|
|
1629
|
-
e.setItem(
|
|
1629
|
+
e.setItem(Xe, Xe), e.removeItem(Xe);
|
|
1630
1630
|
} catch {
|
|
1631
|
-
return
|
|
1631
|
+
return Fe[t] = !1;
|
|
1632
1632
|
}
|
|
1633
|
-
return
|
|
1633
|
+
return Fe[t] = !0;
|
|
1634
1634
|
}
|
|
1635
1635
|
function O() {
|
|
1636
1636
|
return O = Object.assign || function(t) {
|
|
@@ -1674,7 +1674,7 @@ function Yn(t, e, n) {
|
|
|
1674
1674
|
};
|
|
1675
1675
|
}
|
|
1676
1676
|
function h(d) {
|
|
1677
|
-
if (!
|
|
1677
|
+
if (!J(d))
|
|
1678
1678
|
throw new Error("Act != obj");
|
|
1679
1679
|
if (typeof d.type === ee)
|
|
1680
1680
|
throw new Error("ActType " + ee);
|
|
@@ -1829,7 +1829,7 @@ function Gn(t, e, n) {
|
|
|
1829
1829
|
});
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
|
-
function
|
|
1832
|
+
function Ji(t) {
|
|
1833
1833
|
return { abort: t };
|
|
1834
1834
|
}
|
|
1835
1835
|
function Bn(t, e, n) {
|
|
@@ -1847,7 +1847,7 @@ function Bn(t, e, n) {
|
|
|
1847
1847
|
return l.hasOwnProperty(P) && b[P] && b[P] !== l[P] && (T[P] = b[P]), T;
|
|
1848
1848
|
}, l);
|
|
1849
1849
|
}(h.payload, m), _ = r[I.meta.rid];
|
|
1850
|
-
if (!_ && (v = k({ payload: I, config: a[d].config, instance: n, abort:
|
|
1850
|
+
if (!_ && (v = k({ payload: I, config: a[d].config, instance: n, abort: Ji })) && J(v) && v.abort)
|
|
1851
1851
|
return void (r[I.meta.rid] = !0);
|
|
1852
1852
|
if (!_) {
|
|
1853
1853
|
var y = w + ":" + d;
|
|
@@ -1875,9 +1875,9 @@ var mt = function(t) {
|
|
|
1875
1875
|
return function(_, y, l) {
|
|
1876
1876
|
var b = y.config, T = y.name, P = T + "." + _.type;
|
|
1877
1877
|
l && (P = l.event);
|
|
1878
|
-
var x = _.type.match(_e) ? /* @__PURE__ */ function(L, D,
|
|
1878
|
+
var x = _.type.match(_e) ? /* @__PURE__ */ function(L, D, F, U, H) {
|
|
1879
1879
|
return function(Z, j) {
|
|
1880
|
-
var K = U ? U.name : L, M = j && We(j) ? j :
|
|
1880
|
+
var K = U ? U.name : L, M = j && We(j) ? j : F;
|
|
1881
1881
|
if (U && (!(M = j && We(j) ? j : [L]).includes(L) || M.length !== 1))
|
|
1882
1882
|
throw new Error("Method " + D + " can only abort " + L + " plugin. " + JSON.stringify(M) + " input valid");
|
|
1883
1883
|
return O({}, H, { abort: { reason: Z, plugins: M, caller: D, _: K } });
|
|
@@ -1887,7 +1887,7 @@ var mt = function(t) {
|
|
|
1887
1887
|
throw new Error(L.type + " action not cancellable. Remove abort in " + D);
|
|
1888
1888
|
};
|
|
1889
1889
|
}(_, P);
|
|
1890
|
-
return { payload:
|
|
1890
|
+
return { payload: Xi(_), instance: v, config: b || {}, abort: x };
|
|
1891
1891
|
};
|
|
1892
1892
|
}(r, d), k = e.exact.reduce(function(v, I) {
|
|
1893
1893
|
var _ = I.pluginName, y = I.methodName, l = !1;
|
|
@@ -1912,13 +1912,13 @@ var mt = function(t) {
|
|
|
1912
1912
|
throw new Error([j + " plugin is calling method " + Z, "Plugins cant call self", "Use " + K.method + " " + (M ? "or " + M.method : "") + " in " + j + " plugin insteadof " + Z].join(`
|
|
1913
1913
|
`));
|
|
1914
1914
|
}
|
|
1915
|
-
}(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: D, instance: r, abort: (
|
|
1916
|
-
return O({},
|
|
1915
|
+
}(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: D, instance: r, abort: (F = D, U = y, H = x.pluginName, function(Z, j) {
|
|
1916
|
+
return O({}, F, { abort: { reason: Z, plugins: j || [U], caller: c, from: H || U } });
|
|
1917
1917
|
}), config: cn(x.pluginName, p, o), plugins: p })).then(function(Z) {
|
|
1918
|
-
var j =
|
|
1918
|
+
var j = J(Z) ? Z : {};
|
|
1919
1919
|
return Promise.resolve(O({}, D, j));
|
|
1920
1920
|
})) : D;
|
|
1921
|
-
var
|
|
1921
|
+
var F, U, H;
|
|
1922
1922
|
});
|
|
1923
1923
|
} catch (D) {
|
|
1924
1924
|
return Promise.reject(D);
|
|
@@ -1947,7 +1947,7 @@ var mt = function(t) {
|
|
|
1947
1947
|
return s.dispatch({ type: "queue", plugin: b, payload: x, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(P);
|
|
1948
1948
|
var L = w(v[b], o[b]);
|
|
1949
1949
|
return Promise.resolve(T[c]({ abort: L.abort, payload: x, instance: r, config: cn(b, p, o), plugins: p })).then(function(D) {
|
|
1950
|
-
var
|
|
1950
|
+
var F = J(D) ? D : {}, U = O({}, P, F), H = v[b];
|
|
1951
1951
|
if (yt(H, b))
|
|
1952
1952
|
gt({ data: H, method: c, instance: r, pluginName: b, store: s });
|
|
1953
1953
|
else {
|
|
@@ -2014,12 +2014,12 @@ function hn(t) {
|
|
|
2014
2014
|
var e = t.match(/(.*):(.*)/);
|
|
2015
2015
|
return !!e && { method: e[1], name: e[2] };
|
|
2016
2016
|
}
|
|
2017
|
-
function
|
|
2017
|
+
function Xi(t) {
|
|
2018
2018
|
return Object.keys(t).reduce(function(e, n) {
|
|
2019
|
-
return n === "type" || (e[n] =
|
|
2019
|
+
return n === "type" || (e[n] = J(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
|
|
2020
2020
|
}, {});
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function Fi(t, e, n) {
|
|
2023
2023
|
var r = {};
|
|
2024
2024
|
return function(i) {
|
|
2025
2025
|
return function(o) {
|
|
@@ -2064,7 +2064,7 @@ function Ji(t, e, n) {
|
|
|
2064
2064
|
return Bn(i, e, t);
|
|
2065
2065
|
}, 0), Promise.resolve(function(l, b, T, P, x) {
|
|
2066
2066
|
try {
|
|
2067
|
-
var L = G(b) ? b() : b, D = l.type,
|
|
2067
|
+
var L = G(b) ? b() : b, D = l.type, F = D.replace(_e, "");
|
|
2068
2068
|
if (l._ && l._.called)
|
|
2069
2069
|
return Promise.resolve(l);
|
|
2070
2070
|
var U = T.getState(), H = (K = L, (M = U.plugins) === void 0 && (M = {}), ($e = l.options) === void 0 && ($e = {}), Object.keys(K).filter(function(f) {
|
|
@@ -2096,7 +2096,7 @@ function Ji(t, e, n) {
|
|
|
2096
2096
|
function g() {
|
|
2097
2097
|
var $ = function() {
|
|
2098
2098
|
if (D.match(_e))
|
|
2099
|
-
return Promise.resolve(mt({ action: O({}, S, { type:
|
|
2099
|
+
return Promise.resolve(mt({ action: O({}, S, { type: F + "End" }), data: { exact: j.after, namespaced: j.afterNS }, state: U, allPlugins: L, allMatches: j, instance: T, store: P, EVENTS: x })).then(function(A) {
|
|
2100
2100
|
A.meta && A.meta.hasCallback && on(A.meta.rid, { payload: A });
|
|
2101
2101
|
});
|
|
2102
2102
|
}();
|
|
@@ -2107,8 +2107,8 @@ function Ji(t, e, n) {
|
|
|
2107
2107
|
if (qn(f, Z.length))
|
|
2108
2108
|
return f;
|
|
2109
2109
|
var S, C = function() {
|
|
2110
|
-
if (D !==
|
|
2111
|
-
return Promise.resolve(mt({ action: O({}, f, { type:
|
|
2110
|
+
if (D !== F)
|
|
2111
|
+
return Promise.resolve(mt({ action: O({}, f, { type: F }), data: { exact: j.during, namespaced: j.duringNS }, state: U, allPlugins: L, allMatches: j, instance: T, store: P, EVENTS: x })).then(function($) {
|
|
2112
2112
|
S = $;
|
|
2113
2113
|
});
|
|
2114
2114
|
S = f;
|
|
@@ -2364,7 +2364,7 @@ function co(t) {
|
|
|
2364
2364
|
}), f;
|
|
2365
2365
|
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: ge, setItem: ye, removeItem: xe }, o = /* @__PURE__ */ function(f) {
|
|
2366
2366
|
return function(g, S, C) {
|
|
2367
|
-
return S.getState("user")[g] || (C &&
|
|
2367
|
+
return S.getState("user")[g] || (C && J(C) && C[g] ? C[g] : rn(f)[g] || ge(Ot(g)) || null);
|
|
2368
2368
|
};
|
|
2369
2369
|
}(i), a = r.plugins, s = r.events.filter(function(f) {
|
|
2370
2370
|
return !Et.includes(f);
|
|
@@ -2386,7 +2386,7 @@ function co(t) {
|
|
|
2386
2386
|
});
|
|
2387
2387
|
} }, r.methods), l = !1, b = { identify: function(f, g, S, C) {
|
|
2388
2388
|
try {
|
|
2389
|
-
var $ = re(f) ? f : null, A =
|
|
2389
|
+
var $ = re(f) ? f : null, A = J(f) ? f : g, W = S || {}, N = b.user();
|
|
2390
2390
|
ye(Ot(te), $);
|
|
2391
2391
|
var R = $ || A.userId || o(te, b, A);
|
|
2392
2392
|
return Promise.resolve(new Promise(function(z) {
|
|
@@ -2397,10 +2397,10 @@ function co(t) {
|
|
|
2397
2397
|
}
|
|
2398
2398
|
}, track: function(f, g, S, C) {
|
|
2399
2399
|
try {
|
|
2400
|
-
var $ =
|
|
2400
|
+
var $ = J(f) ? f.event : f;
|
|
2401
2401
|
if (!$ || !re($))
|
|
2402
2402
|
throw new Error("EventMissing");
|
|
2403
|
-
var A =
|
|
2403
|
+
var A = J(f) ? f : g || {}, W = J(S) ? S : {};
|
|
2404
2404
|
return Promise.resolve(new Promise(function(N) {
|
|
2405
2405
|
j.dispatch({ type: E.trackStart, event: $, properties: A, options: W, userId: o(te, b, g), anonymousId: o(ke, b, g) }, N, [g, S, C]);
|
|
2406
2406
|
}));
|
|
@@ -2409,7 +2409,7 @@ function co(t) {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}, page: function(f, g, S) {
|
|
2411
2411
|
try {
|
|
2412
|
-
var C =
|
|
2412
|
+
var C = J(f) ? f : {}, $ = J(g) ? g : {};
|
|
2413
2413
|
return Promise.resolve(new Promise(function(A) {
|
|
2414
2414
|
j.dispatch({ type: E.pageStart, properties: to(C), options: $, userId: o(te, b, C), anonymousId: o(ke, b, C) }, A, [f, g, S]);
|
|
2415
2415
|
}));
|
|
@@ -2495,14 +2495,14 @@ function co(t) {
|
|
|
2495
2495
|
return S.meta || (S.meta = yn()), g(S);
|
|
2496
2496
|
};
|
|
2497
2497
|
};
|
|
2498
|
-
}, w(Ve),
|
|
2498
|
+
}, w(Ve), Fi(b, u, { all: p, plugins: s }), Hi(i), Wi(b), Mi(b), w(Ye)]), P = { context: io, user: Ki(i), page: ro, track: Bi, plugins: Yi(u), queue: Qi }, x = Te, L = Te;
|
|
2499
2499
|
if (Y && t.debug) {
|
|
2500
2500
|
var D = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2501
2501
|
D && (x = D({ trace: !0, traceLimit: 25 })), L = function() {
|
|
2502
|
-
return arguments.length === 0 ? or() :
|
|
2502
|
+
return arguments.length === 0 ? or() : J(typeof arguments[0]) ? gn() : gn().apply(null, arguments);
|
|
2503
2503
|
};
|
|
2504
2504
|
}
|
|
2505
|
-
var
|
|
2505
|
+
var F, U = function(f) {
|
|
2506
2506
|
return Object.keys(f).reduce(function(g, S) {
|
|
2507
2507
|
return oo.includes(S) || (g[S] = f[S]), g;
|
|
2508
2508
|
}, {});
|
|
@@ -2540,9 +2540,9 @@ function co(t) {
|
|
|
2540
2540
|
return z ? q : N;
|
|
2541
2541
|
};
|
|
2542
2542
|
}(O({}, P, e)), Z, L(x(Zi.apply(void 0, T))));
|
|
2543
|
-
j.dispatch = (
|
|
2543
|
+
j.dispatch = (F = j.dispatch, function(f, g, S) {
|
|
2544
2544
|
var C = O({}, f, { meta: yn(f.meta, g, vt(S)) });
|
|
2545
|
-
return
|
|
2545
|
+
return F.apply(null, [C]);
|
|
2546
2546
|
});
|
|
2547
2547
|
var K = Object.keys(a);
|
|
2548
2548
|
j.dispatch({ type: E.bootstrap, plugins: K, config: U, params: v, user: _, initialUser: n, persistedUser: I });
|
|
@@ -2598,7 +2598,7 @@ function Se(t) {
|
|
|
2598
2598
|
return !0;
|
|
2599
2599
|
if (e === "false")
|
|
2600
2600
|
return !1;
|
|
2601
|
-
if (
|
|
2601
|
+
if (J(e))
|
|
2602
2602
|
return e;
|
|
2603
2603
|
parseFloat(e) === e && (e = parseFloat(e));
|
|
2604
2604
|
} catch {
|
|
@@ -2630,7 +2630,7 @@ function go(t, e, n) {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
function yo(t, e) {
|
|
2632
2632
|
if (t) {
|
|
2633
|
-
var n = At(e), r = ur(t,
|
|
2633
|
+
var n = At(e), r = ur(t, Jn), i = {};
|
|
2634
2634
|
return !be(r.localStorage) && zt(n) && (localStorage.removeItem(t), i[Re] = r.localStorage), !be(r.cookie) && Nt(n) && (sr(t), i[Ue] = r.cookie), !be(r.sessionStorage) && Dt(n) && (sessionStorage.removeItem(t), i[Ze] = r.sessionStorage), !be(r.global) && ut(n, Le) && (xe(t), i[Le] = r.global), i;
|
|
2635
2635
|
}
|
|
2636
2636
|
}
|
|
@@ -2647,7 +2647,7 @@ function Dt(t) {
|
|
|
2647
2647
|
return po && ut(t, Ze);
|
|
2648
2648
|
}
|
|
2649
2649
|
function Lt(t) {
|
|
2650
|
-
return t ===
|
|
2650
|
+
return t === Jn || t === "all";
|
|
2651
2651
|
}
|
|
2652
2652
|
function ut(t, e) {
|
|
2653
2653
|
return t === Mn || t === e || Lt(t);
|
|
@@ -3063,7 +3063,7 @@ async function Uo(t) {
|
|
|
3063
3063
|
clientId: t.clientId,
|
|
3064
3064
|
// The default client id can be overridden by the config
|
|
3065
3065
|
...t.analytics
|
|
3066
|
-
}), await
|
|
3066
|
+
}), await Jr(t);
|
|
3067
3067
|
const e = Ii(t.namespace);
|
|
3068
3068
|
return rt(pe.READY, {}), e;
|
|
3069
3069
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
7
7
|
"tag": "latest"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.3.
|
|
9
|
+
"version": "1.3.5",
|
|
10
10
|
"main": "./dist/sesamy-js.cjs",
|
|
11
11
|
"module": "./dist/sesamy-js.mjs",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "vite",
|
|
25
25
|
"build": "rimraf build/**/* && tsc && vite build --config vite.dev.config.ts",
|
|
26
|
-
"build:prod": "rimraf build/**/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts && copyfiles ./package.json build",
|
|
26
|
+
"build:prod": "rimraf build/**/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts && copyfiles ./package.json build && copyfiles ./README.md build",
|
|
27
27
|
"preview": "vite preview",
|
|
28
28
|
"type-check": "tsc",
|
|
29
29
|
"semantic-release": "semantic-release",
|