@sesamy/sesamy-js 1.123.2 → 1.124.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/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +258 -256
- package/package.json +1 -1
package/dist/sesamy-js.mjs
CHANGED
|
@@ -2501,21 +2501,27 @@ function Jn(e) {
|
|
|
2501
2501
|
function Yn() {
|
|
2502
2502
|
return qn;
|
|
2503
2503
|
}
|
|
2504
|
+
//#endregion
|
|
2505
|
+
//#region src/utils/language.ts
|
|
2506
|
+
function Xn() {
|
|
2507
|
+
let e = (document.documentElement.getAttribute("lang") ?? navigator.language ?? "en").split("-")[0]?.toLowerCase() ?? "en";
|
|
2508
|
+
return e === "nn" && (e = "nb"), e;
|
|
2509
|
+
}
|
|
2504
2510
|
Hn(), Bn();
|
|
2505
|
-
var
|
|
2506
|
-
function
|
|
2511
|
+
var Zn = "sesamy_is_authenticated", Qn = "sesamy:legacy-migration-attempted";
|
|
2512
|
+
function $n() {
|
|
2507
2513
|
try {
|
|
2508
|
-
return sessionStorage.getItem(
|
|
2514
|
+
return sessionStorage.getItem(Qn) === "1";
|
|
2509
2515
|
} catch {
|
|
2510
2516
|
return !1;
|
|
2511
2517
|
}
|
|
2512
2518
|
}
|
|
2513
|
-
function
|
|
2519
|
+
function er() {
|
|
2514
2520
|
try {
|
|
2515
|
-
sessionStorage.setItem(
|
|
2521
|
+
sessionStorage.setItem(Qn, "1");
|
|
2516
2522
|
} catch {}
|
|
2517
2523
|
}
|
|
2518
|
-
function
|
|
2524
|
+
function tr() {
|
|
2519
2525
|
try {
|
|
2520
2526
|
for (let e of Object.keys(localStorage)) if (e.startsWith("@@auth0spajs@@")) try {
|
|
2521
2527
|
let t = JSON.parse(localStorage.getItem(e) || "{}");
|
|
@@ -2525,7 +2531,7 @@ function er() {
|
|
|
2525
2531
|
} catch {}
|
|
2526
2532
|
return !1;
|
|
2527
2533
|
}
|
|
2528
|
-
function
|
|
2534
|
+
function nr() {
|
|
2529
2535
|
try {
|
|
2530
2536
|
for (let e of Object.keys(localStorage)) e.startsWith("@@auth0spajs@@") && localStorage.removeItem(e);
|
|
2531
2537
|
localStorage.removeItem("sesamyRefreshToken"), localStorage.removeItem("sesamyAccessToken");
|
|
@@ -2533,20 +2539,20 @@ function tr() {
|
|
|
2533
2539
|
document.cookie = `auth0.is.authenticated=; path=/; max-age=0; SameSite=Lax${e}`;
|
|
2534
2540
|
} catch {}
|
|
2535
2541
|
}
|
|
2536
|
-
function
|
|
2542
|
+
function rr() {
|
|
2537
2543
|
try {
|
|
2538
|
-
return document.cookie.split(";").some((e) => e.trim().startsWith(`${
|
|
2544
|
+
return document.cookie.split(";").some((e) => e.trim().startsWith(`${Zn}=true`));
|
|
2539
2545
|
} catch {
|
|
2540
2546
|
return !1;
|
|
2541
2547
|
}
|
|
2542
2548
|
}
|
|
2543
|
-
function
|
|
2549
|
+
function ir(e) {
|
|
2544
2550
|
try {
|
|
2545
2551
|
let t = e ? 720 * 60 * 60 : 0, n = window.location.protocol === "https:" ? "; Secure" : "";
|
|
2546
|
-
document.cookie = `${
|
|
2552
|
+
document.cookie = `${Zn}=${e}; path=/; max-age=${t}; SameSite=Lax${n}`;
|
|
2547
2553
|
} catch {}
|
|
2548
2554
|
}
|
|
2549
|
-
function
|
|
2555
|
+
function ar() {
|
|
2550
2556
|
try {
|
|
2551
2557
|
let e = document.getElementById("sesamy-server-state");
|
|
2552
2558
|
return e?.textContent ? JSON.parse(e.textContent) : null;
|
|
@@ -2554,7 +2560,7 @@ function ir() {
|
|
|
2554
2560
|
return null;
|
|
2555
2561
|
}
|
|
2556
2562
|
}
|
|
2557
|
-
function
|
|
2563
|
+
function or(e) {
|
|
2558
2564
|
try {
|
|
2559
2565
|
let t = e.split(".");
|
|
2560
2566
|
if (t.length !== 3) return null;
|
|
@@ -2564,7 +2570,7 @@ function ar(e) {
|
|
|
2564
2570
|
return null;
|
|
2565
2571
|
}
|
|
2566
2572
|
}
|
|
2567
|
-
function
|
|
2573
|
+
function sr(e = {}) {
|
|
2568
2574
|
let t = e.baseUrl ?? "", n = "", r = !1, i = null, a = null, o = "sesamy:userinfo";
|
|
2569
2575
|
function s() {
|
|
2570
2576
|
try {
|
|
@@ -2614,15 +2620,15 @@ function or(e = {}) {
|
|
|
2614
2620
|
let d = {
|
|
2615
2621
|
async init(e) {
|
|
2616
2622
|
n = e.vendorId || e.clientId || "", K(`[cookie-auth] Initializing with baseUrl: ${t}`);
|
|
2617
|
-
let o =
|
|
2623
|
+
let o = ar(), s = e.idToken || o?.idToken;
|
|
2618
2624
|
if (s) {
|
|
2619
|
-
let e =
|
|
2625
|
+
let e = or(s);
|
|
2620
2626
|
if (e && typeof e.exp == "number" && e.exp > Date.now() / 1e3) {
|
|
2621
2627
|
let t = {
|
|
2622
2628
|
...e,
|
|
2623
2629
|
authenticated: !0
|
|
2624
2630
|
};
|
|
2625
|
-
i = !0, a = t,
|
|
2631
|
+
i = !0, a = t, ir(!0), c(t), K(`[cookie-auth] Using server-injected id-token for sub: ${e.sub}`), Gn(q.AUTHENTICATED, {
|
|
2626
2632
|
sub: e.sub,
|
|
2627
2633
|
appState: void 0
|
|
2628
2634
|
}), r = !0, Gn(q.AUTH_INITIALIZED, {});
|
|
@@ -2630,23 +2636,23 @@ function or(e = {}) {
|
|
|
2630
2636
|
}
|
|
2631
2637
|
K("[cookie-auth] Server-injected id-token is expired or invalid — falling through");
|
|
2632
2638
|
}
|
|
2633
|
-
if (
|
|
2639
|
+
if (rr()) {
|
|
2634
2640
|
let e = await u();
|
|
2635
|
-
e === null ? K("[cookie-auth] userinfo fetch failed transiently; retaining session hint") : e.authenticated && e.sub ? (i = !0, a = e,
|
|
2641
|
+
e === null ? K("[cookie-auth] userinfo fetch failed transiently; retaining session hint") : e.authenticated && e.sub ? (i = !0, a = e, ir(!0), Gn(q.AUTHENTICATED, {
|
|
2636
2642
|
sub: e.sub,
|
|
2637
2643
|
appState: void 0
|
|
2638
|
-
})) : (i = !1,
|
|
2644
|
+
})) : (i = !1, ir(!1), c(null));
|
|
2639
2645
|
} else i = !1;
|
|
2640
2646
|
if (e.migrateLegacySession && i === !1) {
|
|
2641
|
-
if (
|
|
2642
|
-
|
|
2647
|
+
if (tr() && !$n()) {
|
|
2648
|
+
er(), K("[cookie-auth] Legacy Auth0 session found — attempting silent BFF migration"), await d.login({
|
|
2643
2649
|
prompt: "none",
|
|
2644
2650
|
returnTo: window.location.href
|
|
2645
2651
|
});
|
|
2646
2652
|
return;
|
|
2647
2653
|
}
|
|
2648
|
-
|
|
2649
|
-
} else e.migrateLegacySession && i === !0 &&
|
|
2654
|
+
nr();
|
|
2655
|
+
} else e.migrateLegacySession && i === !0 && nr();
|
|
2650
2656
|
r = !0, Gn(q.AUTH_INITIALIZED, {});
|
|
2651
2657
|
},
|
|
2652
2658
|
async isAuthenticated() {
|
|
@@ -2672,7 +2678,9 @@ function or(e = {}) {
|
|
|
2672
2678
|
let r = e?.returnTo ?? window.location.href, i = new URL(`${t}/auth/${encodeURIComponent(n)}/login`, window.location.origin);
|
|
2673
2679
|
i.searchParams.set("return_to", r);
|
|
2674
2680
|
let a = e?.prompt;
|
|
2675
|
-
a && i.searchParams.set("prompt", a)
|
|
2681
|
+
a && i.searchParams.set("prompt", a);
|
|
2682
|
+
let o = e?.ui_locales || Xn() || "en";
|
|
2683
|
+
o && i.searchParams.set("ui_locales", o), window.location.href = i.toString();
|
|
2676
2684
|
},
|
|
2677
2685
|
async loginWithRedirect(e) {
|
|
2678
2686
|
return d.login(e);
|
|
@@ -2690,16 +2698,16 @@ function or(e = {}) {
|
|
|
2690
2698
|
});
|
|
2691
2699
|
if (!r.ok) return K(`[cookie-auth] refresh: userinfo returned ${r.status}`), e;
|
|
2692
2700
|
let o = await r.json();
|
|
2693
|
-
return o.authenticated && o.sub ? (i = !0, a = o,
|
|
2701
|
+
return o.authenticated && o.sub ? (i = !0, a = o, ir(!0), c(o), (!e || n !== o.sub) && Gn(q.AUTHENTICATED, {
|
|
2694
2702
|
sub: o.sub,
|
|
2695
2703
|
appState: void 0
|
|
2696
|
-
}), !0) : (i = !1, a = null,
|
|
2704
|
+
}), !0) : (i = !1, a = null, ir(!1), e && Gn(q.LOGOUT, {}), !1);
|
|
2697
2705
|
} catch (t) {
|
|
2698
2706
|
return K(`[cookie-auth] refresh failed: ${t.message}`), e;
|
|
2699
2707
|
}
|
|
2700
2708
|
},
|
|
2701
2709
|
async logout(e) {
|
|
2702
|
-
i = !1, a = null,
|
|
2710
|
+
i = !1, a = null, ir(!1), c(null), Gn(q.LOGOUT, {});
|
|
2703
2711
|
let r = e?.returnTo ?? window.location.href, o = new URL(`${t}/auth/${encodeURIComponent(n)}/logout`, window.location.origin);
|
|
2704
2712
|
o.searchParams.set("return_to", r), e?.localOnly && o.searchParams.set("local_only", "true"), window.location.href = o.toString();
|
|
2705
2713
|
}
|
|
@@ -2709,54 +2717,54 @@ function or(e = {}) {
|
|
|
2709
2717
|
//#endregion
|
|
2710
2718
|
//#region src/services/auth/index.ts
|
|
2711
2719
|
Bn();
|
|
2712
|
-
var
|
|
2713
|
-
function
|
|
2720
|
+
var cr = "sesamyAccessToken", lr = !1;
|
|
2721
|
+
function ur() {
|
|
2714
2722
|
let e = Yn();
|
|
2715
2723
|
if (!e) throw Error("[sesamy-js] No auth plugin registered. This should not happen.");
|
|
2716
2724
|
return e;
|
|
2717
2725
|
}
|
|
2718
|
-
async function
|
|
2726
|
+
async function dr(e) {
|
|
2719
2727
|
if (e.enabled === !1) {
|
|
2720
|
-
K("Auth disabled via config"),
|
|
2728
|
+
K("Auth disabled via config"), lr = !0;
|
|
2721
2729
|
return;
|
|
2722
2730
|
}
|
|
2723
|
-
e.useHttpCookies ? (K("useHttpCookies=true — using cookie-based BFF plugin"), Jn(
|
|
2724
|
-
}
|
|
2725
|
-
async function dr() {
|
|
2726
|
-
return cr ? lr().isAuthenticated() : !1;
|
|
2731
|
+
e.useHttpCookies ? (K("useHttpCookies=true — using cookie-based BFF plugin"), Jn(sr({ baseUrl: e.baseUrl }))) : Yn() || (K("No auth plugin registered — falling back to cookie-based BFF plugin"), Jn(sr({ baseUrl: e.baseUrl }))), await ur().init(e), lr = !0;
|
|
2727
2732
|
}
|
|
2728
|
-
async function fr(
|
|
2729
|
-
return
|
|
2733
|
+
async function fr() {
|
|
2734
|
+
return lr ? ur().isAuthenticated() : !1;
|
|
2730
2735
|
}
|
|
2731
|
-
async function pr() {
|
|
2732
|
-
return
|
|
2736
|
+
async function pr(e = !0, t = !1) {
|
|
2737
|
+
return lr ? ur().getTokenSilently(e, t) : null;
|
|
2733
2738
|
}
|
|
2734
|
-
function mr() {
|
|
2735
|
-
return
|
|
2739
|
+
async function mr() {
|
|
2740
|
+
return lr ? ur().getUser() : null;
|
|
2736
2741
|
}
|
|
2737
|
-
|
|
2738
|
-
return lr()
|
|
2742
|
+
function hr() {
|
|
2743
|
+
return lr ? Yn()?.getProxyAuthBaseUrl?.() ?? null : null;
|
|
2739
2744
|
}
|
|
2740
2745
|
async function gr(e) {
|
|
2741
|
-
return
|
|
2746
|
+
return ur().login(e);
|
|
2742
2747
|
}
|
|
2743
2748
|
async function _r(e) {
|
|
2744
|
-
return
|
|
2749
|
+
return ur().loginWithRedirect(e);
|
|
2750
|
+
}
|
|
2751
|
+
async function vr(e) {
|
|
2752
|
+
return ur().loginWithPopup(e);
|
|
2745
2753
|
}
|
|
2746
|
-
async function
|
|
2747
|
-
return
|
|
2754
|
+
async function yr(e = {}) {
|
|
2755
|
+
return ur().logout(e);
|
|
2748
2756
|
}
|
|
2749
|
-
async function
|
|
2750
|
-
if (!
|
|
2757
|
+
async function br() {
|
|
2758
|
+
if (!lr) return !1;
|
|
2751
2759
|
let e = Yn();
|
|
2752
2760
|
return e ? typeof e.refresh == "function" ? e.refresh() : e.isAuthenticated() : !1;
|
|
2753
2761
|
}
|
|
2754
|
-
async function
|
|
2762
|
+
async function xr(e) {
|
|
2755
2763
|
let t = e.split(".");
|
|
2756
2764
|
if (t.length !== 3) throw Error("Invalid token");
|
|
2757
2765
|
let n = decodeURIComponent(atob(t[1].replace(/-/g, "+").replace(/_/g, "/")).split("").map((e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join("")), r = JSON.parse(n);
|
|
2758
2766
|
if (!r?.exp || r.exp < Date.now() / 1e3) throw Error("Invalid token");
|
|
2759
|
-
K("Set token"), localStorage.setItem(
|
|
2767
|
+
K("Set token"), localStorage.setItem(cr, e);
|
|
2760
2768
|
let { triggerEvent: i } = await Promise.resolve().then(() => (Kn(), Un)), { Events: a } = await Promise.resolve().then(() => (Hn(), Vn));
|
|
2761
2769
|
i(a.AUTHENTICATED, {
|
|
2762
2770
|
...r,
|
|
@@ -2765,7 +2773,7 @@ async function br(e) {
|
|
|
2765
2773
|
}
|
|
2766
2774
|
//#endregion
|
|
2767
2775
|
//#region ../../node_modules/.pnpm/wretch@2.11.1/node_modules/wretch/dist/middlewares/dedupe.js
|
|
2768
|
-
var
|
|
2776
|
+
var Sr = (e, t) => t.skipDedupe || t.method !== "GET", Cr = (e, t) => t.method + "@" + e, wr = (e) => e.clone(), Tr = ({ skip: e = Sr, key: t = Cr, resolver: n = wr } = {}) => {
|
|
2769
2777
|
let r = /* @__PURE__ */ new Map();
|
|
2770
2778
|
return (i) => (a, o) => {
|
|
2771
2779
|
if (e(a, o)) return i(a, o);
|
|
@@ -2782,7 +2790,7 @@ var xr = (e, t) => t.skipDedupe || t.method !== "GET", Sr = (e, t) => t.method +
|
|
|
2782
2790
|
return r.delete(s), Promise.reject(e);
|
|
2783
2791
|
}
|
|
2784
2792
|
};
|
|
2785
|
-
},
|
|
2793
|
+
}, Er = (e, t) => e * t, Dr = (e) => e && e.ok, Or = ({ delayTimer: e = 500, delayRamp: t = Er, maxAttempts: n = 10, until: r = Dr, onRetry: i = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: o = !1, skip: s } = {}) => (c) => (l, u) => {
|
|
2786
2794
|
let d = 0;
|
|
2787
2795
|
if (s && s(l, u)) return c(l, u);
|
|
2788
2796
|
let f = (s, p) => Promise.resolve(r(s, p)).then((r) => r ? s && o ? s : p ? Promise.reject(p) : s : (d++, !n || d <= n ? new Promise((n) => {
|
|
@@ -2805,7 +2813,7 @@ var xr = (e, t) => t.skipDedupe || t.method !== "GET", Sr = (e, t) => t.method +
|
|
|
2805
2813
|
if (!a) throw e;
|
|
2806
2814
|
return f(null, e);
|
|
2807
2815
|
});
|
|
2808
|
-
},
|
|
2816
|
+
}, kr = class e extends Error {
|
|
2809
2817
|
status;
|
|
2810
2818
|
statusText;
|
|
2811
2819
|
url;
|
|
@@ -2825,20 +2833,20 @@ var xr = (e, t) => t.skipDedupe || t.method !== "GET", Sr = (e, t) => t.method +
|
|
|
2825
2833
|
isNotFoundError() {
|
|
2826
2834
|
return this.status === 404;
|
|
2827
2835
|
}
|
|
2828
|
-
},
|
|
2829
|
-
function
|
|
2836
|
+
}, Ar = /* @__PURE__ */ ((e) => (e.BROWSER = "browser", e.NORMAL = "normal", e))(Ar || {}), jr = "application/json", Mr = "Content-Type", Nr = Symbol(), Pr = Symbol();
|
|
2837
|
+
function Fr(e = {}) {
|
|
2830
2838
|
let t = e instanceof Array ? Object.fromEntries(e) : e;
|
|
2831
|
-
return Object.entries(t).find(([e]) => e.toLowerCase() ===
|
|
2839
|
+
return Object.entries(t).find(([e]) => e.toLowerCase() === Mr.toLowerCase())?.[1];
|
|
2832
2840
|
}
|
|
2833
|
-
function
|
|
2841
|
+
function Ir(e) {
|
|
2834
2842
|
return /^application\/.*json.*/.test(e);
|
|
2835
2843
|
}
|
|
2836
|
-
var
|
|
2844
|
+
var Lr = function(e, t, n = !1) {
|
|
2837
2845
|
return Object.entries(t).reduce((t, [r, i]) => {
|
|
2838
2846
|
let a = e[r];
|
|
2839
|
-
return Array.isArray(a) && Array.isArray(i) ? t[r] = n ? [...a, ...i] : i : typeof a == "object" && typeof i == "object" ? t[r] =
|
|
2847
|
+
return Array.isArray(a) && Array.isArray(i) ? t[r] = n ? [...a, ...i] : i : typeof a == "object" && typeof i == "object" ? t[r] = Lr(a, i, n) : t[r] = i, t;
|
|
2840
2848
|
}, { ...e });
|
|
2841
|
-
},
|
|
2849
|
+
}, Rr = {
|
|
2842
2850
|
options: {},
|
|
2843
2851
|
errorType: "text",
|
|
2844
2852
|
polyfills: {},
|
|
@@ -2848,23 +2856,23 @@ var Ir = function(e, t, n = !1) {
|
|
|
2848
2856
|
return n && i ? new i(...r) : i;
|
|
2849
2857
|
}
|
|
2850
2858
|
};
|
|
2851
|
-
function Rr(e, t = !1) {
|
|
2852
|
-
Lr.options = t ? e : Ir(Lr.options, e);
|
|
2853
|
-
}
|
|
2854
2859
|
function zr(e, t = !1) {
|
|
2855
|
-
|
|
2860
|
+
Rr.options = t ? e : Lr(Rr.options, e);
|
|
2861
|
+
}
|
|
2862
|
+
function Br(e, t = !1) {
|
|
2863
|
+
Rr.polyfills = t ? e : Lr(Rr.polyfills, e);
|
|
2856
2864
|
}
|
|
2857
|
-
function
|
|
2858
|
-
|
|
2865
|
+
function Vr(e) {
|
|
2866
|
+
Rr.errorType = e;
|
|
2859
2867
|
}
|
|
2860
|
-
var
|
|
2868
|
+
var Hr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Ur = class extends Error {}, Wr = (e) => {
|
|
2861
2869
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2862
2870
|
e = e._addons.reduce((n, r) => r.beforeRequest && r.beforeRequest(n, e._options, t) || n, e);
|
|
2863
|
-
let { _url: n, _options: r, _config: i, _catchers: a, _resolvers: o, _middlewares: s, _addons: c } = e, l = new Map(a), u =
|
|
2864
|
-
throw { [
|
|
2871
|
+
let { _url: n, _options: r, _config: i, _catchers: a, _resolvers: o, _middlewares: s, _addons: c } = e, l = new Map(a), u = Lr(i.options, r), d = n, f = Hr(s)((e, t) => (d = e, i.polyfill("fetch")(e, t)))(n, u), p = /* @__PURE__ */ Error(), m = f.catch((e) => {
|
|
2872
|
+
throw { [Nr]: e };
|
|
2865
2873
|
}).then((e) => {
|
|
2866
2874
|
if (!e.ok) {
|
|
2867
|
-
let t = new
|
|
2875
|
+
let t = new Ur();
|
|
2868
2876
|
if (t.cause = p, t.stack = t.stack + "\nCAUSE: " + p.stack, t.response = e, t.status = e.status, t.url = d, e.type === "opaque") throw t;
|
|
2869
2877
|
let n = i.errorType === "json" || e.headers.get("Content-Type")?.split(";")[0] === "application/json";
|
|
2870
2878
|
return (i.errorType ? n ? e.text() : e[i.errorType]() : Promise.resolve(e.body)).then((r) => {
|
|
@@ -2879,9 +2887,9 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
2879
2887
|
}
|
|
2880
2888
|
return e;
|
|
2881
2889
|
}), h = (t) => t.catch((t) => {
|
|
2882
|
-
let n = Object.prototype.hasOwnProperty.call(t,
|
|
2890
|
+
let n = Object.prototype.hasOwnProperty.call(t, Nr), r = n ? t[Nr] : t, i = r?.status && l.get(r.status) || l.get(r?.name) || n && l.has(Nr) && l.get(Nr);
|
|
2883
2891
|
if (i) return i(r, e);
|
|
2884
|
-
let a = l.get(
|
|
2892
|
+
let a = l.get(Pr);
|
|
2885
2893
|
if (a) return a(r, e);
|
|
2886
2894
|
throw r;
|
|
2887
2895
|
}), g = (e) => (t) => h(e ? m.then((t) => t && t[e]()).then((e) => t ? t(e) : e) : m.then((e) => t ? t(e) : e)), _ = {
|
|
@@ -2916,17 +2924,17 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
2916
2924
|
return this.error(500, e);
|
|
2917
2925
|
},
|
|
2918
2926
|
fetchError(e) {
|
|
2919
|
-
return this.error(
|
|
2927
|
+
return this.error(Nr, e);
|
|
2920
2928
|
}
|
|
2921
2929
|
}, v = c.reduce((e, t) => ({
|
|
2922
2930
|
...e,
|
|
2923
2931
|
...typeof t.resolver == "function" ? t.resolver(e) : t.resolver
|
|
2924
2932
|
}), _);
|
|
2925
2933
|
return o.reduce((t, n) => n(t, e), v);
|
|
2926
|
-
},
|
|
2934
|
+
}, Gr = {
|
|
2927
2935
|
_url: "",
|
|
2928
2936
|
_options: {},
|
|
2929
|
-
_config:
|
|
2937
|
+
_config: Rr,
|
|
2930
2938
|
_catchers: /* @__PURE__ */ new Map(),
|
|
2931
2939
|
_resolvers: [],
|
|
2932
2940
|
_deferred: [],
|
|
@@ -2953,7 +2961,7 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
2953
2961
|
...this,
|
|
2954
2962
|
_config: {
|
|
2955
2963
|
...this._config,
|
|
2956
|
-
polyfills: t ? e :
|
|
2964
|
+
polyfills: t ? e : Lr(this._config.polyfills, e)
|
|
2957
2965
|
}
|
|
2958
2966
|
};
|
|
2959
2967
|
},
|
|
@@ -2971,21 +2979,21 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
2971
2979
|
options(e, t = !1) {
|
|
2972
2980
|
return {
|
|
2973
2981
|
...this,
|
|
2974
|
-
_options: t ? e :
|
|
2982
|
+
_options: t ? e : Lr(this._options, e)
|
|
2975
2983
|
};
|
|
2976
2984
|
},
|
|
2977
2985
|
headers(e) {
|
|
2978
2986
|
let t = e ? Array.isArray(e) ? Object.fromEntries(e) : "entries" in e ? Object.fromEntries(e.entries()) : e : {};
|
|
2979
2987
|
return {
|
|
2980
2988
|
...this,
|
|
2981
|
-
_options:
|
|
2989
|
+
_options: Lr(this._options, { headers: t })
|
|
2982
2990
|
};
|
|
2983
2991
|
},
|
|
2984
2992
|
accept(e) {
|
|
2985
2993
|
return this.headers({ Accept: e });
|
|
2986
2994
|
},
|
|
2987
2995
|
content(e) {
|
|
2988
|
-
return this.headers({ [
|
|
2996
|
+
return this.headers({ [Mr]: e });
|
|
2989
2997
|
},
|
|
2990
2998
|
auth(e) {
|
|
2991
2999
|
return this.headers({ Authorization: e });
|
|
@@ -2998,7 +3006,7 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
2998
3006
|
};
|
|
2999
3007
|
},
|
|
3000
3008
|
catcherFallback(e) {
|
|
3001
|
-
return this.catcher(
|
|
3009
|
+
return this.catcher(Pr, e);
|
|
3002
3010
|
},
|
|
3003
3011
|
resolve(e, t = !1) {
|
|
3004
3012
|
return {
|
|
@@ -3019,8 +3027,8 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
3019
3027
|
};
|
|
3020
3028
|
},
|
|
3021
3029
|
fetch(e = this._options.method, t = "", n = null) {
|
|
3022
|
-
let r = this.url(t).options({ method: e }), i =
|
|
3023
|
-
return r = n ? o ? r.json(n, i) : r.body(n) : r,
|
|
3030
|
+
let r = this.url(t).options({ method: e }), i = Fr(r._options.headers), a = this._config.polyfill("FormData", !1), o = typeof n == "object" && !(a && n instanceof a) && (!r._options.headers || !i || Ir(i));
|
|
3031
|
+
return r = n ? o ? r.json(n, i) : r.body(n) : r, Wr(r._deferred.reduce((e, t) => t(e, e._url, e._options), r));
|
|
3024
3032
|
},
|
|
3025
3033
|
get(e = "") {
|
|
3026
3034
|
return this.fetch("GET", e);
|
|
@@ -3053,19 +3061,19 @@ var Vr = (e) => (t) => e.reduceRight((e, t) => t(e), t) || t, Hr = class extends
|
|
|
3053
3061
|
};
|
|
3054
3062
|
},
|
|
3055
3063
|
json(e, t) {
|
|
3056
|
-
let n =
|
|
3057
|
-
return this.content(t ||
|
|
3064
|
+
let n = Fr(this._options.headers);
|
|
3065
|
+
return this.content(t || Ir(n) && n || jr).body(JSON.stringify(e));
|
|
3058
3066
|
}
|
|
3059
3067
|
};
|
|
3060
|
-
function
|
|
3068
|
+
function Kr(e = "", t = {}) {
|
|
3061
3069
|
return {
|
|
3062
|
-
...
|
|
3070
|
+
...Gr,
|
|
3063
3071
|
_url: e,
|
|
3064
3072
|
_options: t
|
|
3065
3073
|
};
|
|
3066
3074
|
}
|
|
3067
|
-
|
|
3068
|
-
var
|
|
3075
|
+
Kr.default = Kr, Kr.options = zr, Kr.errorType = Vr, Kr.polyfills = Br, Kr.WretchError = Ur;
|
|
3076
|
+
var qr = (e, t) => t.skipDedupe || t.method !== "GET", Jr = (e, t) => t.method + "@" + e, Yr = (e) => e.clone(), Xr = ({ skip: e = qr, key: t = Jr, resolver: n = Yr } = {}) => {
|
|
3069
3077
|
let r = /* @__PURE__ */ new Map();
|
|
3070
3078
|
return (i) => (a, o) => {
|
|
3071
3079
|
if (e(a, o)) return i(a, o);
|
|
@@ -3082,7 +3090,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3082
3090
|
return r.delete(s), Promise.reject(e);
|
|
3083
3091
|
}
|
|
3084
3092
|
};
|
|
3085
|
-
},
|
|
3093
|
+
}, Zr = (e, t) => t.skipCache || t.method !== "GET", Qr = (e, t) => t.method + "@" + e, $r = () => !1, ei = () => null, ti = (e) => e.ok, ni = ({ throttle: e = 1e3, skip: t = Zr, key: n = Qr, clear: r = $r, invalidate: i = ei, condition: a = ti, flagResponseOnCacheHit: o = "__cached" } = {}) => {
|
|
3086
3094
|
let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = (t) => {
|
|
3087
3095
|
e && !l.has(t) && (l.add(t), setTimeout(() => {
|
|
3088
3096
|
l.delete(t);
|
|
@@ -3112,7 +3120,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3112
3120
|
return d.cacheResponse = function(e, t) {
|
|
3113
3121
|
u(e), s.set(e, t);
|
|
3114
3122
|
}, d.cache = s, d.inflight = c, d.throttling = l, d;
|
|
3115
|
-
},
|
|
3123
|
+
}, ri = (e, t) => e * t, ii = (e) => e && e.ok, ai = ({ delayTimer: e = 500, delayRamp: t = ri, maxAttempts: n = 10, until: r = ii, onRetry: i = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: o = !1, skip: s } = {}) => (c) => (l, u) => {
|
|
3116
3124
|
let d = 0;
|
|
3117
3125
|
if (s && s(l, u)) return c(l, u);
|
|
3118
3126
|
let f = (s, p) => Promise.resolve(r(s, p)).then((r) => r ? s && o ? s : p ? Promise.reject(p) : s : (d++, !n || d <= n ? new Promise((n) => {
|
|
@@ -3135,7 +3143,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3135
3143
|
if (!a) throw e;
|
|
3136
3144
|
return f(null, e);
|
|
3137
3145
|
});
|
|
3138
|
-
},
|
|
3146
|
+
}, oi = "@sesamy/sdk", si = "1.32.0", ci = class {
|
|
3139
3147
|
cache = /* @__PURE__ */ new Map();
|
|
3140
3148
|
get(e) {
|
|
3141
3149
|
return this.cache.get(e) || null;
|
|
@@ -3149,12 +3157,12 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3149
3157
|
clear() {
|
|
3150
3158
|
this.cache.clear();
|
|
3151
3159
|
}
|
|
3152
|
-
},
|
|
3153
|
-
let { libraryName: t =
|
|
3160
|
+
}, li = "sesamyCacheTimestamp", ui = (e) => {
|
|
3161
|
+
let { libraryName: t = oi, libraryVersion: n = si, cache: r } = e, i = r?.storage || new ci(), a = [
|
|
3154
3162
|
(e) => async (t, n) => {
|
|
3155
|
-
if (r?.mode ===
|
|
3163
|
+
if (r?.mode === Ar.BROWSER) {
|
|
3156
3164
|
let r;
|
|
3157
|
-
return typeof sessionStorage < "u" ? (r = sessionStorage.getItem(
|
|
3165
|
+
return typeof sessionStorage < "u" ? (r = sessionStorage.getItem(li), r || (r = Date.now().toString(), sessionStorage.setItem(li, r))) : (r = i.get(li), r || (r = Date.now().toString(), i.set(li, r))), e(t, {
|
|
3158
3166
|
...n,
|
|
3159
3167
|
headers: {
|
|
3160
3168
|
...n.headers,
|
|
@@ -3177,19 +3185,19 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3177
3185
|
}
|
|
3178
3186
|
});
|
|
3179
3187
|
},
|
|
3180
|
-
|
|
3188
|
+
Xr()
|
|
3181
3189
|
];
|
|
3182
|
-
r?.mode ===
|
|
3190
|
+
r?.mode === Ar.NORMAL && a.push(ni({
|
|
3183
3191
|
throttle: 300 * 1e3,
|
|
3184
3192
|
skip: (e, t) => t.method !== "GET"
|
|
3185
|
-
})), a.push(
|
|
3193
|
+
})), a.push(ai({
|
|
3186
3194
|
delayTimer: 1e3,
|
|
3187
3195
|
delayRamp: (e, t) => e * t,
|
|
3188
3196
|
maxAttempts: 3,
|
|
3189
3197
|
until: (e) => !!(e && (e.ok || e.status >= 400 && e.status < 500)),
|
|
3190
3198
|
retryOnNetworkError: !1
|
|
3191
3199
|
}));
|
|
3192
|
-
let o =
|
|
3200
|
+
let o = Kr(e.baseUrl).headers({
|
|
3193
3201
|
"X-Sesamy-Client": `${t}/${n}`,
|
|
3194
3202
|
...e.headers
|
|
3195
3203
|
}).middlewares(a);
|
|
@@ -3226,19 +3234,19 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3226
3234
|
"patch",
|
|
3227
3235
|
"put",
|
|
3228
3236
|
"delete"
|
|
3229
|
-
].includes(i) &&
|
|
3237
|
+
].includes(i) && di(), s.status === 204) return null;
|
|
3230
3238
|
if (!s.ok) {
|
|
3231
3239
|
let e = await s.text().catch(() => "Unknown error");
|
|
3232
|
-
throw new
|
|
3240
|
+
throw new kr(s.status, s.statusText, s.url, `API Error ${s.status}: ${e}`, e);
|
|
3233
3241
|
}
|
|
3234
3242
|
return await s.json();
|
|
3235
3243
|
} catch (n) {
|
|
3236
|
-
if (n instanceof
|
|
3244
|
+
if (n instanceof kr) throw n;
|
|
3237
3245
|
let r = n.status || 500;
|
|
3238
|
-
throw new
|
|
3246
|
+
throw new kr(r, n.message || "Unknown error", `${e.baseUrl}${t}`, `API Error ${r}: ${n.message || "Unknown error"}`, n.message || "Unknown error");
|
|
3239
3247
|
}
|
|
3240
3248
|
} };
|
|
3241
|
-
},
|
|
3249
|
+
}, di = () => (typeof sessionStorage < "u" && sessionStorage.removeItem(li), "Cache cleared"), fi = {
|
|
3242
3250
|
get: async (e, t) => e.request(`/profile/${t}`),
|
|
3243
3251
|
update: async (e, t, n) => e.request(`/profile/${t}`, {
|
|
3244
3252
|
method: "PATCH",
|
|
@@ -3249,7 +3257,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3249
3257
|
delete: async (e) => {
|
|
3250
3258
|
await e.request("/profile", { method: "DELETE" });
|
|
3251
3259
|
}
|
|
3252
|
-
},
|
|
3260
|
+
}, pi = {
|
|
3253
3261
|
list: async (e, t) => {
|
|
3254
3262
|
let n = new URLSearchParams();
|
|
3255
3263
|
t?.type && n.append("type", t.type), t?.sku && n.append("sku", t.sku), t?.purchaseOptionId && n.append("purchase-option-id", t.purchaseOptionId), t?.waitForEntitlementAfter && n.append("wait-for-entitlement-after", t.waitForEntitlementAfter);
|
|
@@ -3258,20 +3266,20 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3258
3266
|
},
|
|
3259
3267
|
get: async (e, t) => e.request(`/entitlements/${t}`),
|
|
3260
3268
|
getAccess: async (e, t) => e.request(`/entitlements/${t}/access`)
|
|
3261
|
-
},
|
|
3269
|
+
}, mi = {
|
|
3262
3270
|
list: async (e) => e.request("/subscriptions"),
|
|
3263
3271
|
get: async (e, t) => e.request(`/subscriptions/${t}`)
|
|
3264
|
-
},
|
|
3272
|
+
}, hi = {
|
|
3265
3273
|
get: async (e, t) => e.request(`/products/${t}`),
|
|
3266
3274
|
autoOnboard: async (e, t) => e.request(`/products/${t}/auto-onboard`, { method: "POST" })
|
|
3267
|
-
},
|
|
3275
|
+
}, gi = (e, t) => {
|
|
3268
3276
|
if (!e || !t) return e;
|
|
3269
3277
|
let n = new URL(e);
|
|
3270
3278
|
return n.hash = `access_token=${t}`, n.toString();
|
|
3271
|
-
},
|
|
3279
|
+
}, _i = (e, t) => !e.manageUrl || !t ? e : {
|
|
3272
3280
|
...e,
|
|
3273
|
-
manageUrl:
|
|
3274
|
-
},
|
|
3281
|
+
manageUrl: gi(e.manageUrl, t)
|
|
3282
|
+
}, vi = {
|
|
3275
3283
|
list: async (e) => e.request("/contracts"),
|
|
3276
3284
|
get: async (e, t) => e.request(`/contracts/${t}`),
|
|
3277
3285
|
cancel: async (e, t, n) => e.request(`/contracts/${t}/cancel`, {
|
|
@@ -3283,7 +3291,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3283
3291
|
body: JSON.stringify(n)
|
|
3284
3292
|
}),
|
|
3285
3293
|
confirmAmendment: async (e, t, n) => e.request(`/contracts/${t}/amendments/${n}/confirm`, { method: "POST" })
|
|
3286
|
-
},
|
|
3294
|
+
}, yi = {
|
|
3287
3295
|
get: async (e) => e.request("/user-metadata"),
|
|
3288
3296
|
set: async (e, t, n) => {
|
|
3289
3297
|
await e.request(`/user-metadata/${t}`, {
|
|
@@ -3294,7 +3302,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3294
3302
|
delete: async (e, t) => {
|
|
3295
3303
|
await e.request(`/user-metadata/${t}`, { method: "DELETE" });
|
|
3296
3304
|
}
|
|
3297
|
-
},
|
|
3305
|
+
}, bi = {
|
|
3298
3306
|
list: async (e) => e.request("/tallies"),
|
|
3299
3307
|
get: async (e, t) => e.request(`/tallies/${t}`),
|
|
3300
3308
|
update: async (e, t, n) => e.request(`/tallies/${t}`, {
|
|
@@ -3316,7 +3324,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3316
3324
|
method: "POST",
|
|
3317
3325
|
body: JSON.stringify(n)
|
|
3318
3326
|
})
|
|
3319
|
-
},
|
|
3327
|
+
}, xi = {
|
|
3320
3328
|
list: async (e) => e.request("/tags"),
|
|
3321
3329
|
add: async (e, t) => {
|
|
3322
3330
|
await e.request("/tags", {
|
|
@@ -3327,7 +3335,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3327
3335
|
remove: async (e, t) => {
|
|
3328
3336
|
await e.request(`/tags/${t}`, { method: "DELETE" });
|
|
3329
3337
|
}
|
|
3330
|
-
},
|
|
3338
|
+
}, Si = {
|
|
3331
3339
|
generateCheckoutLink: (e, t) => {
|
|
3332
3340
|
let n = new URL(`${e.apiUrl}/checkouts`);
|
|
3333
3341
|
return t.items && n.searchParams.set("items", JSON.stringify(t.items)), t.email && n.searchParams.set("email", t.email), t.language && n.searchParams.set("lang", t.language), t.redirectUrl && n.searchParams.set("redirect-url", t.redirectUrl), t.giftMode && n.searchParams.set("gift-mode", "true"), t.payerEmail && n.searchParams.set("payer-email", t.payerEmail), t.requireAddress && n.searchParams.set("require-address", "true"), t.metadata && Object.entries(t.metadata).forEach(([e, t]) => {
|
|
@@ -3350,7 +3358,7 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3350
3358
|
let n = t.language || "en", r = new URL(`${e.baseUrl}/consume/${encodeURIComponent(n)}/@${encodeURIComponent(e.clientId)}/${encodeURIComponent(t.sku)}`);
|
|
3351
3359
|
return t.episodeId ? r.href += `/${encodeURIComponent(t.episodeId)}` : r.href += "/listen", r.searchParams.set("sesamy-redirect-url", t.redirectUrl || "/"), r.toString();
|
|
3352
3360
|
}
|
|
3353
|
-
},
|
|
3361
|
+
}, Ci = {
|
|
3354
3362
|
generateLink: (e, t) => {
|
|
3355
3363
|
let n = new URL(`${e.apiUrl}/checkouts`);
|
|
3356
3364
|
return t.items && n.searchParams.set("items", JSON.stringify(t.items)), t.email && n.searchParams.set("email", t.email), t.language && n.searchParams.set("lang", t.language), t.redirectUrl && n.searchParams.set("redirect-url", t.redirectUrl), t.giftMode && n.searchParams.set("gift-mode", "true"), t.payerEmail && n.searchParams.set("payer-email", t.payerEmail), t.requireAddress && n.searchParams.set("require-address", "true"), t.metadata && Object.entries(t.metadata).forEach(([e, t]) => {
|
|
@@ -3366,16 +3374,16 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3366
3374
|
method: "PATCH",
|
|
3367
3375
|
body: JSON.stringify(n)
|
|
3368
3376
|
})
|
|
3369
|
-
},
|
|
3377
|
+
}, wi = {
|
|
3370
3378
|
list: async (e) => e.request("/bills"),
|
|
3371
3379
|
get: async (e, t) => e.request(`/bills/${t}`)
|
|
3372
|
-
},
|
|
3380
|
+
}, Ti = {
|
|
3373
3381
|
list: async (e) => e.request("/fulfillments"),
|
|
3374
3382
|
create: async (e, t) => e.request("/fulfillments", {
|
|
3375
3383
|
method: "POST",
|
|
3376
3384
|
body: JSON.stringify(t)
|
|
3377
3385
|
})
|
|
3378
|
-
},
|
|
3386
|
+
}, Ei = {
|
|
3379
3387
|
get: async (e, t) => {
|
|
3380
3388
|
try {
|
|
3381
3389
|
return new URL(t), e.request(t);
|
|
@@ -3391,113 +3399,113 @@ var Kr = (e, t) => t.skipDedupe || t.method !== "GET", qr = (e, t) => t.method +
|
|
|
3391
3399
|
method: "POST",
|
|
3392
3400
|
body: JSON.stringify(n)
|
|
3393
3401
|
})
|
|
3394
|
-
},
|
|
3402
|
+
}, Di = { list: async (e) => e.request("/payment-issues") }, Oi = { content: async (e, t, n, r, i) => {
|
|
3395
3403
|
let a = new URLSearchParams({ url: t });
|
|
3396
3404
|
return n && a.append("selector", n), r && a.append("cache", r), e.request(`/proxy?${a.toString()}`, i);
|
|
3397
|
-
} },
|
|
3405
|
+
} }, ki = { list: async (e, t) => {
|
|
3398
3406
|
let n = (t ? new URLSearchParams({ q: t }) : new URLSearchParams()).toString(), r = n ? `/transactions?${n}` : "/transactions";
|
|
3399
3407
|
return e.request(r);
|
|
3400
|
-
} },
|
|
3408
|
+
} }, Ai = {
|
|
3401
3409
|
get: async (e) => e.request("/vendor"),
|
|
3402
3410
|
list: async (e) => e.request("/vendors")
|
|
3403
|
-
},
|
|
3404
|
-
let t =
|
|
3411
|
+
}, ji = (e) => {
|
|
3412
|
+
let t = ui(e);
|
|
3405
3413
|
return {
|
|
3406
3414
|
profile: {
|
|
3407
|
-
get: (e) =>
|
|
3408
|
-
update: (e, n) =>
|
|
3409
|
-
checkSpotifyLink: () =>
|
|
3410
|
-
unlinkSpotify: () =>
|
|
3411
|
-
delete: () =>
|
|
3415
|
+
get: (e) => fi.get(t, e),
|
|
3416
|
+
update: (e, n) => fi.update(t, e, n),
|
|
3417
|
+
checkSpotifyLink: () => fi.checkSpotifyLink(t),
|
|
3418
|
+
unlinkSpotify: () => fi.unlinkSpotify(t),
|
|
3419
|
+
delete: () => fi.delete(t)
|
|
3412
3420
|
},
|
|
3413
3421
|
entitlements: {
|
|
3414
|
-
list: (e) =>
|
|
3415
|
-
get: (e) =>
|
|
3416
|
-
getAccess: (e) =>
|
|
3422
|
+
list: (e) => pi.list(t, e),
|
|
3423
|
+
get: (e) => pi.get(t, e),
|
|
3424
|
+
getAccess: (e) => pi.getAccess(t, e)
|
|
3417
3425
|
},
|
|
3418
3426
|
subscriptions: {
|
|
3419
|
-
list: () =>
|
|
3420
|
-
get: (e) =>
|
|
3427
|
+
list: () => mi.list(t),
|
|
3428
|
+
get: (e) => mi.get(t, e)
|
|
3421
3429
|
},
|
|
3422
3430
|
products: {
|
|
3423
|
-
get: (e) =>
|
|
3424
|
-
autoOnboard: (e) =>
|
|
3431
|
+
get: (e) => hi.get(t, e),
|
|
3432
|
+
autoOnboard: (e) => hi.autoOnboard(t, e)
|
|
3425
3433
|
},
|
|
3426
3434
|
contracts: {
|
|
3427
3435
|
list: async () => {
|
|
3428
|
-
let n = await
|
|
3436
|
+
let n = await vi.list(t), r = await e.tokenProvider();
|
|
3429
3437
|
if (!r || !r.toLowerCase().startsWith("bearer ")) return n;
|
|
3430
3438
|
let i = r.substring(7);
|
|
3431
|
-
return n.map((e) =>
|
|
3439
|
+
return n.map((e) => _i(e, i));
|
|
3432
3440
|
},
|
|
3433
3441
|
get: async (n) => {
|
|
3434
|
-
let r = await
|
|
3435
|
-
return !i || !i.toLowerCase().startsWith("bearer ") ? r :
|
|
3442
|
+
let r = await vi.get(t, n), i = await e.tokenProvider();
|
|
3443
|
+
return !i || !i.toLowerCase().startsWith("bearer ") ? r : _i(r, i.substring(7));
|
|
3436
3444
|
},
|
|
3437
|
-
cancel: (e, n) =>
|
|
3438
|
-
createAmendment: (e, n) =>
|
|
3439
|
-
confirmAmendment: (e, n) =>
|
|
3445
|
+
cancel: (e, n) => vi.cancel(t, e, n),
|
|
3446
|
+
createAmendment: (e, n) => vi.createAmendment(t, e, n),
|
|
3447
|
+
confirmAmendment: (e, n) => vi.confirmAmendment(t, e, n)
|
|
3440
3448
|
},
|
|
3441
3449
|
userMetadata: {
|
|
3442
|
-
get: () =>
|
|
3443
|
-
set: (e, n) =>
|
|
3444
|
-
delete: (e) =>
|
|
3450
|
+
get: () => yi.get(t),
|
|
3451
|
+
set: (e, n) => yi.set(t, e, n),
|
|
3452
|
+
delete: (e) => yi.delete(t, e)
|
|
3445
3453
|
},
|
|
3446
3454
|
tallies: {
|
|
3447
|
-
list: () =>
|
|
3448
|
-
get: (e) =>
|
|
3449
|
-
update: (e, n) =>
|
|
3450
|
-
create: (e) =>
|
|
3451
|
-
delete: (e) =>
|
|
3452
|
-
push: (e, n) =>
|
|
3455
|
+
list: () => bi.list(t),
|
|
3456
|
+
get: (e) => bi.get(t, e),
|
|
3457
|
+
update: (e, n) => bi.update(t, e, n),
|
|
3458
|
+
create: (e) => bi.create(t, e),
|
|
3459
|
+
delete: (e) => bi.delete(t, e),
|
|
3460
|
+
push: (e, n) => bi.push(t, e, n)
|
|
3453
3461
|
},
|
|
3454
3462
|
tags: {
|
|
3455
|
-
list: () =>
|
|
3456
|
-
add: (e) =>
|
|
3457
|
-
remove: (e) =>
|
|
3463
|
+
list: () => xi.list(t),
|
|
3464
|
+
add: (e) => xi.add(t, e),
|
|
3465
|
+
remove: (e) => xi.remove(t, e)
|
|
3458
3466
|
},
|
|
3459
3467
|
checkouts: {
|
|
3460
|
-
generateLink: (e, t) =>
|
|
3461
|
-
create: (e) =>
|
|
3462
|
-
get: (e) =>
|
|
3463
|
-
update: (e, n) =>
|
|
3468
|
+
generateLink: (e, t) => Si.generateCheckoutLink(e, t),
|
|
3469
|
+
create: (e) => Ci.create(t, e),
|
|
3470
|
+
get: (e) => Ci.get(t, e),
|
|
3471
|
+
update: (e, n) => Ci.update(t, e, n)
|
|
3464
3472
|
},
|
|
3465
3473
|
links: {
|
|
3466
|
-
generateCheckoutLink: (e, t) =>
|
|
3467
|
-
generateAccountLink: (e, t) =>
|
|
3468
|
-
generateChangePaymentLink: (e, t) =>
|
|
3469
|
-
generateChangePlanLink: (e, t) =>
|
|
3470
|
-
generateConsumeLink: (e, t) =>
|
|
3474
|
+
generateCheckoutLink: (e, t) => Si.generateCheckoutLink(e, t),
|
|
3475
|
+
generateAccountLink: (e, t) => Si.generateAccountLink(e, t),
|
|
3476
|
+
generateChangePaymentLink: (e, t) => Si.generateChangePaymentLink(e, t),
|
|
3477
|
+
generateChangePlanLink: (e, t) => Si.generateChangePlanLink(e, t),
|
|
3478
|
+
generateConsumeLink: (e, t) => Si.generateConsumeLink(e, t)
|
|
3471
3479
|
},
|
|
3472
3480
|
bills: {
|
|
3473
|
-
list: () =>
|
|
3474
|
-
get: (e) =>
|
|
3481
|
+
list: () => wi.list(t),
|
|
3482
|
+
get: (e) => wi.get(t, e)
|
|
3475
3483
|
},
|
|
3476
3484
|
fulfillments: {
|
|
3477
|
-
list: () =>
|
|
3478
|
-
create: (e) =>
|
|
3485
|
+
list: () => Ti.list(t),
|
|
3486
|
+
create: (e) => Ti.create(t, e)
|
|
3479
3487
|
},
|
|
3480
3488
|
paywalls: {
|
|
3481
|
-
get: (e) =>
|
|
3482
|
-
checkAccess: (e, n) =>
|
|
3483
|
-
registerAccess: (e, n) =>
|
|
3489
|
+
get: (e) => Ei.get(t, e),
|
|
3490
|
+
checkAccess: (e, n) => Ei.checkAccess(t, e, n),
|
|
3491
|
+
registerAccess: (e, n) => Ei.registerAccess(t, e, n)
|
|
3484
3492
|
},
|
|
3485
|
-
paymentIssues: { list: () =>
|
|
3486
|
-
proxy: { content: (e, n, r, i) =>
|
|
3487
|
-
transactions: { list: (e) =>
|
|
3493
|
+
paymentIssues: { list: () => Di.list(t) },
|
|
3494
|
+
proxy: { content: (e, n, r, i) => Oi.content(t, e, n, r, i) },
|
|
3495
|
+
transactions: { list: (e) => ki.list(t, e) },
|
|
3488
3496
|
vendor: {
|
|
3489
|
-
get: () =>
|
|
3490
|
-
list: () =>
|
|
3497
|
+
get: () => Ai.get(t),
|
|
3498
|
+
list: () => Ai.list(t)
|
|
3491
3499
|
}
|
|
3492
3500
|
};
|
|
3493
|
-
},
|
|
3494
|
-
function
|
|
3501
|
+
}, Mi = "sesamy.com", Ni = "sesamy.dev", Pi = "https://sesa.my", Fi = "sesamyCacheTimestamp", Ii = "sesamyContentReloaded", Li = /* @__PURE__ */ "co.uk,com.au,co.nz,co.za,com.br,co.jp,gov.uk,ac.uk,org.uk,net.uk,com.sg,com.my,co.in,co.id,co.th,co.kr,com.mx,com.ar,com.co,com.pe,com.ph,com.pk,com.sa,com.eg,com.ng,co.ke,co.tz,co.zw,co.bw,co.mz,gov.au,edu.au,org.au,net.au,asn.au,id.au".split(",");
|
|
3502
|
+
function Ri(e) {
|
|
3495
3503
|
try {
|
|
3496
3504
|
let t = new URL(e).hostname;
|
|
3497
3505
|
if (t.startsWith("[") || /^\d{1,3}(\.\d{1,3}){3}$/.test(t)) return t;
|
|
3498
3506
|
let n = t.split(".");
|
|
3499
3507
|
if (n.length <= 1) return t;
|
|
3500
|
-
for (let e of
|
|
3508
|
+
for (let e of Li) if (t.endsWith(`.${e}`)) {
|
|
3501
3509
|
let t = e.split(".").length + 1;
|
|
3502
3510
|
return n.slice(-t).join(".");
|
|
3503
3511
|
}
|
|
@@ -3508,7 +3516,7 @@ function Li(e) {
|
|
|
3508
3516
|
}
|
|
3509
3517
|
//#endregion
|
|
3510
3518
|
//#region src/types/Cache.ts
|
|
3511
|
-
var
|
|
3519
|
+
var zi = class {
|
|
3512
3520
|
get(e) {
|
|
3513
3521
|
return typeof sessionStorage > "u" ? null : sessionStorage.getItem(e);
|
|
3514
3522
|
}
|
|
@@ -3522,17 +3530,11 @@ var Ri = class {
|
|
|
3522
3530
|
};
|
|
3523
3531
|
//#endregion
|
|
3524
3532
|
//#region src/services/config/index.ts
|
|
3525
|
-
function zi(e, t) {
|
|
3526
|
-
return `${e}.${t === "dev" ? Mi : ji}`;
|
|
3527
|
-
}
|
|
3528
3533
|
function Bi(e, t) {
|
|
3529
|
-
return
|
|
3534
|
+
return `${e}.${t === "dev" ? Ni : Mi}`;
|
|
3530
3535
|
}
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
function Vi() {
|
|
3534
|
-
let e = (document.documentElement.getAttribute("lang") ?? navigator.language ?? "en").split("-")[0]?.toLowerCase() ?? "en";
|
|
3535
|
-
return e === "nn" && (e = "nb"), e;
|
|
3536
|
+
function Vi(e, t) {
|
|
3537
|
+
return `https://${Bi(e, t)}`;
|
|
3536
3538
|
}
|
|
3537
3539
|
//#endregion
|
|
3538
3540
|
//#region src/utils/links.ts
|
|
@@ -3694,7 +3696,7 @@ function ua(e) {
|
|
|
3694
3696
|
//#endregion
|
|
3695
3697
|
//#region src/controllers/checkout.ts
|
|
3696
3698
|
function da(e, t, n) {
|
|
3697
|
-
let r = new URL(`${
|
|
3699
|
+
let r = new URL(`${Vi("checkout3", e.environment)}`);
|
|
3698
3700
|
t.language && r.searchParams.set("lang", t.language);
|
|
3699
3701
|
let i = t.sku, a = t.purchaseOptionId, o = t.itemSrc;
|
|
3700
3702
|
if (t.itemSrc) {
|
|
@@ -5401,7 +5403,7 @@ function bc() {
|
|
|
5401
5403
|
}
|
|
5402
5404
|
//#endregion
|
|
5403
5405
|
//#region package.json
|
|
5404
|
-
var xc = "@sesamy/sesamy-js", Sc = "1.
|
|
5406
|
+
var xc = "@sesamy/sesamy-js", Sc = "1.124.0";
|
|
5405
5407
|
//#endregion
|
|
5406
5408
|
//#region src/services/analytics/listeners/route.ts
|
|
5407
5409
|
function Cc(e) {
|
|
@@ -6213,7 +6215,7 @@ function Wl(e) {
|
|
|
6213
6215
|
Hl(e);
|
|
6214
6216
|
}
|
|
6215
6217
|
function Gl(e, t, n) {
|
|
6216
|
-
Ll = t, Rl = `${
|
|
6218
|
+
Ll = t, Rl = `${Vi("logs", n)}/events`, zl = e;
|
|
6217
6219
|
}
|
|
6218
6220
|
var Kl = {
|
|
6219
6221
|
name: "custom-analytics-plugin",
|
|
@@ -6473,19 +6475,19 @@ async function xu() {
|
|
|
6473
6475
|
}
|
|
6474
6476
|
Hn(), Kn();
|
|
6475
6477
|
function Su(e) {
|
|
6476
|
-
let t = e.endpoint ??
|
|
6478
|
+
let t = e.endpoint ?? Vi("api2", e.environment), n = (() => {
|
|
6477
6479
|
try {
|
|
6478
|
-
let e =
|
|
6480
|
+
let e = Ri(new URL(t, window.location.origin).href), n = Ri(window.location.href);
|
|
6479
6481
|
return e !== null && e === n;
|
|
6480
6482
|
} catch {
|
|
6481
6483
|
return !1;
|
|
6482
6484
|
}
|
|
6483
|
-
})(), r = e.useHttpCookies === !0, i =
|
|
6485
|
+
})(), r = e.useHttpCookies === !0, i = ji({
|
|
6484
6486
|
baseUrl: t,
|
|
6485
6487
|
tokenProvider: async () => {
|
|
6486
6488
|
if (r) return null;
|
|
6487
|
-
if (await
|
|
6488
|
-
let e = await
|
|
6489
|
+
if (await fr()) try {
|
|
6490
|
+
let e = await pr(!1);
|
|
6489
6491
|
if (e) return `Bearer ${e}`;
|
|
6490
6492
|
if (n) return null;
|
|
6491
6493
|
} catch {}
|
|
@@ -6496,12 +6498,12 @@ function Su(e) {
|
|
|
6496
6498
|
libraryVersion: Sc,
|
|
6497
6499
|
vendorId: e.vendorId,
|
|
6498
6500
|
cache: {
|
|
6499
|
-
mode:
|
|
6500
|
-
storage: new
|
|
6501
|
+
mode: Ar.BROWSER,
|
|
6502
|
+
storage: new zi()
|
|
6501
6503
|
}
|
|
6502
6504
|
}), a = (e) => async (t, n) => {
|
|
6503
|
-
let r = sessionStorage.getItem(
|
|
6504
|
-
return r || (r = Date.now().toString(), sessionStorage.setItem(
|
|
6505
|
+
let r = sessionStorage.getItem(Fi);
|
|
6506
|
+
return r || (r = Date.now().toString(), sessionStorage.setItem(Fi, r)), e(t, {
|
|
6505
6507
|
...n,
|
|
6506
6508
|
headers: {
|
|
6507
6509
|
...n.headers,
|
|
@@ -6512,9 +6514,9 @@ function Su(e) {
|
|
|
6512
6514
|
...n,
|
|
6513
6515
|
credentials: "include"
|
|
6514
6516
|
}), s = (e = !0) => (t) => async (r, i) => {
|
|
6515
|
-
let a = await
|
|
6517
|
+
let a = await pr(e);
|
|
6516
6518
|
if (!a) {
|
|
6517
|
-
if (n && await
|
|
6519
|
+
if (n && await fr()) return t(r, {
|
|
6518
6520
|
...i,
|
|
6519
6521
|
credentials: "include"
|
|
6520
6522
|
});
|
|
@@ -6528,11 +6530,11 @@ function Su(e) {
|
|
|
6528
6530
|
Authorization: `Bearer ${a}`
|
|
6529
6531
|
}
|
|
6530
6532
|
});
|
|
6531
|
-
}, c =
|
|
6533
|
+
}, c = Kr(t).headers({ "Content-Type": "application/json" }).middlewares([
|
|
6532
6534
|
a,
|
|
6533
6535
|
r ? o : s(),
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
+
Tr(),
|
|
6537
|
+
Or({
|
|
6536
6538
|
delayTimer: 1e3,
|
|
6537
6539
|
delayRamp: (e, t) => e * t,
|
|
6538
6540
|
maxAttempts: 3,
|
|
@@ -6541,7 +6543,7 @@ function Su(e) {
|
|
|
6541
6543
|
})
|
|
6542
6544
|
]);
|
|
6543
6545
|
async function l(e = {}) {
|
|
6544
|
-
let { waitForEntitlementAfter: t, includeSignedLinks: n = !0 } = e, r = await
|
|
6546
|
+
let { waitForEntitlementAfter: t, includeSignedLinks: n = !0 } = e, r = await fr() ? await i.entitlements.list({ waitForEntitlementAfter: t?.toISOString() }) : [];
|
|
6545
6547
|
return n && r.push(...pa()), r;
|
|
6546
6548
|
}
|
|
6547
6549
|
async function u(e, t = []) {
|
|
@@ -6556,12 +6558,12 @@ function Su(e) {
|
|
|
6556
6558
|
async function d(e, n, i) {
|
|
6557
6559
|
let a = new URL(t, window.location.origin);
|
|
6558
6560
|
a.pathname = a.pathname.replace(/\/$/, "") + "/proxy", a.searchParams.set("url", n), i && a.searchParams.set("selector", i);
|
|
6559
|
-
let o =
|
|
6561
|
+
let o = Kr(a.toString());
|
|
6560
6562
|
return o = r ? o.options({ credentials: "include" }) : o.headers({ Authorization: `Bearer ${e}` }), o.get().text();
|
|
6561
6563
|
}
|
|
6562
6564
|
async function f(e) {
|
|
6563
6565
|
if (!e) throw Error("SKU is required to get fulfillments");
|
|
6564
|
-
return await
|
|
6566
|
+
return await fr() ? await c.get(`/fulfillments?sku=${encodeURIComponent(e)}`).json() : [];
|
|
6565
6567
|
}
|
|
6566
6568
|
async function p(e, t) {
|
|
6567
6569
|
if (!e || !t) throw Error("SKU and itemId are required to request delivery");
|
|
@@ -6578,11 +6580,11 @@ function Su(e) {
|
|
|
6578
6580
|
}
|
|
6579
6581
|
async function _(e) {
|
|
6580
6582
|
let t = await c.url(`/tags/${encodeURIComponent(e)}`).delete().res();
|
|
6581
|
-
return
|
|
6583
|
+
return di(), t.ok;
|
|
6582
6584
|
}
|
|
6583
6585
|
async function v(e) {
|
|
6584
6586
|
let t = await c.url("/tags").post(encodeURIComponent(e)).res();
|
|
6585
|
-
return Gn(q.USER_ATTRIBUTE_CHANGED, {}),
|
|
6587
|
+
return Gn(q.USER_ATTRIBUTE_CHANGED, {}), di(), t.ok;
|
|
6586
6588
|
}
|
|
6587
6589
|
async function y(e) {
|
|
6588
6590
|
return (await i.tallies.get(e)).value;
|
|
@@ -6599,11 +6601,11 @@ function Su(e) {
|
|
|
6599
6601
|
return await i.tallies.push(e, t);
|
|
6600
6602
|
}
|
|
6601
6603
|
async function C() {
|
|
6602
|
-
return !await
|
|
6604
|
+
return !await pr(!1) && !await fr() ? null : await c.url("/profile").get().json();
|
|
6603
6605
|
}
|
|
6604
6606
|
async function w(e) {
|
|
6605
6607
|
let t = await c.url("/profile").patch(e).res();
|
|
6606
|
-
return
|
|
6608
|
+
return di(), t.ok;
|
|
6607
6609
|
}
|
|
6608
6610
|
async function T() {
|
|
6609
6611
|
return (await c.url("/profile/spotify-link").get().json()).isSpotifyLinked;
|
|
@@ -6612,14 +6614,14 @@ function Su(e) {
|
|
|
6612
6614
|
return (await c.url("/profile/unlink-spotify").post().res()).ok;
|
|
6613
6615
|
}
|
|
6614
6616
|
async function D(t) {
|
|
6615
|
-
let n = await
|
|
6617
|
+
let n = await pr(!1);
|
|
6616
6618
|
if (n) {
|
|
6617
|
-
let r = new URL(`${
|
|
6619
|
+
let r = new URL(`${Vi("access-sync", e.environment)}/spotify/sesamy-callback`);
|
|
6618
6620
|
r.searchParams.set("access_token", n), r.searchParams.set("state", t), window.location.href = r.toString();
|
|
6619
6621
|
return;
|
|
6620
6622
|
}
|
|
6621
|
-
let r =
|
|
6622
|
-
if (r !== null && await
|
|
6623
|
+
let r = hr();
|
|
6624
|
+
if (r !== null && await fr()) {
|
|
6623
6625
|
let e = new URL(`${r}/auth/spotify-link`, window.location.origin);
|
|
6624
6626
|
e.searchParams.set("sku", t), window.location.href = e.toString();
|
|
6625
6627
|
return;
|
|
@@ -6628,29 +6630,29 @@ function Su(e) {
|
|
|
6628
6630
|
}
|
|
6629
6631
|
async function O(e) {
|
|
6630
6632
|
let t = await c.url(`/products/${encodeURIComponent(e)}/auto-onboard`).post().json();
|
|
6631
|
-
return t.length &&
|
|
6633
|
+
return t.length && di(), t;
|
|
6632
6634
|
}
|
|
6633
6635
|
async function k(e, t = 3600) {
|
|
6634
|
-
let { shortlink: n } = await
|
|
6636
|
+
let { shortlink: n } = await Kr(Pi).post({
|
|
6635
6637
|
url: e,
|
|
6636
6638
|
ttl: t
|
|
6637
6639
|
}).json();
|
|
6638
6640
|
return n;
|
|
6639
6641
|
}
|
|
6640
6642
|
async function A(t) {
|
|
6641
|
-
let n = await
|
|
6643
|
+
let n = await pr(!1, !0), r, i = t.language || Xn(), a = ba();
|
|
6642
6644
|
switch (t.target) {
|
|
6643
6645
|
case "account":
|
|
6644
|
-
r = new URL(`${
|
|
6646
|
+
r = new URL(`${Vi("account", e.environment)}/${encodeURIComponent(t.language || i)}/subscriptions/${encodeURIComponent(e.vendorId || e.clientId)}${t.contractId ? `/${encodeURIComponent(t.contractId)}` : ""}`), r.searchParams.set("sesamy-redirect-url", t.redirectUrl || window.location.href);
|
|
6645
6647
|
break;
|
|
6646
6648
|
case "change-payment":
|
|
6647
|
-
r = new URL(`${
|
|
6649
|
+
r = new URL(`${Vi("account", e.environment)}/${encodeURIComponent(t.language || i)}/subscriptions/${encodeURIComponent(e.vendorId || e.clientId)}/${encodeURIComponent(t.contractId)}/change-payment-method`), r.searchParams.set("sesamy-redirect-url", t.redirectUrl || window.location.href);
|
|
6648
6650
|
break;
|
|
6649
6651
|
case "change-plan":
|
|
6650
|
-
r = new URL(`${
|
|
6652
|
+
r = new URL(`${Vi("account", e.environment)}/${encodeURIComponent(t.language || i)}/subscriptions/${encodeURIComponent(e.vendorId || e.clientId)}/${encodeURIComponent(t.contractId)}/edit-plan`), r.searchParams.set("sesamy-redirect-url", t.redirectUrl || window.location.href);
|
|
6651
6653
|
break;
|
|
6652
6654
|
case "consume":
|
|
6653
|
-
r = new URL(`${
|
|
6655
|
+
r = new URL(`${Vi("consume", e.environment)}/${encodeURIComponent(t.language || i)}/@${encodeURIComponent(e.vendorId || e.clientId)}/${encodeURIComponent(t.sku)}`), t.episodeId ? r.href += `/${t.episodeId}` : r.href += "/listen", r.searchParams.set("sesamy-redirect-url", t.redirectUrl || window.location.href);
|
|
6654
6656
|
break;
|
|
6655
6657
|
case "checkout":
|
|
6656
6658
|
r = da(e, {
|
|
@@ -6663,7 +6665,7 @@ function Su(e) {
|
|
|
6663
6665
|
return n && (r.hash = `#access_token=${n}`), t.shorten ? k(r.href, t.ttl) : r.href;
|
|
6664
6666
|
}
|
|
6665
6667
|
async function j() {
|
|
6666
|
-
let t = await
|
|
6668
|
+
let t = await pr(!1), n = new URL(`${Vi("account", e.environment)}/subscriptions/${e.vendorId || e.clientId}`);
|
|
6667
6669
|
t && (n.hash = `#access_token=${t}`), window.location.href = n.toString();
|
|
6668
6670
|
}
|
|
6669
6671
|
async function M(e) {
|
|
@@ -6675,7 +6677,7 @@ function Su(e) {
|
|
|
6675
6677
|
}), n && !t.gaSessionId && (t.gaSessionId = n);
|
|
6676
6678
|
}
|
|
6677
6679
|
return i.checkouts.create({
|
|
6678
|
-
language:
|
|
6680
|
+
language: Xn(),
|
|
6679
6681
|
...e,
|
|
6680
6682
|
attribution: {
|
|
6681
6683
|
...t,
|
|
@@ -6694,7 +6696,7 @@ function Su(e) {
|
|
|
6694
6696
|
content: {
|
|
6695
6697
|
list: Al,
|
|
6696
6698
|
get: jl,
|
|
6697
|
-
getLanguage:
|
|
6699
|
+
getLanguage: Xn,
|
|
6698
6700
|
unlock: Nl,
|
|
6699
6701
|
getPropertyFromHTML: kl
|
|
6700
6702
|
},
|
|
@@ -7155,7 +7157,7 @@ function Uu(e, t) {
|
|
|
7155
7157
|
return;
|
|
7156
7158
|
}
|
|
7157
7159
|
n.init(e, {
|
|
7158
|
-
getToken:
|
|
7160
|
+
getToken: pr,
|
|
7159
7161
|
apiEndpoint: t
|
|
7160
7162
|
}), K("[capsule] DcaClient initialized"), window.addEventListener(q.AUTH_INITIALIZED, () => {
|
|
7161
7163
|
Gu();
|
|
@@ -7359,9 +7361,9 @@ async function rd(e) {
|
|
|
7359
7361
|
} catch (e) {
|
|
7360
7362
|
t.push(`SessionStorage collection failed: ${e.message}`);
|
|
7361
7363
|
}
|
|
7362
|
-
if (await
|
|
7364
|
+
if (await fr()) {
|
|
7363
7365
|
try {
|
|
7364
|
-
let e = await
|
|
7366
|
+
let e = await pr(!1);
|
|
7365
7367
|
if (e) {
|
|
7366
7368
|
let t = e.split(".");
|
|
7367
7369
|
t.length >= 2 && (n.userId = JSON.parse(atob(t[1])).sub);
|
|
@@ -7398,9 +7400,9 @@ async function rd(e) {
|
|
|
7398
7400
|
return t.length > 0 && (n.errors = t), n;
|
|
7399
7401
|
}
|
|
7400
7402
|
async function id(e, t, n) {
|
|
7401
|
-
let r = `${
|
|
7402
|
-
if (await
|
|
7403
|
-
let e = await
|
|
7403
|
+
let r = `${Vi("api2", t)}/diagnostics`, i = { "Content-Type": "application/json" };
|
|
7404
|
+
if (await fr()) try {
|
|
7405
|
+
let e = await pr(!1);
|
|
7404
7406
|
e && (i.Authorization = `Bearer ${e}`);
|
|
7405
7407
|
} catch {}
|
|
7406
7408
|
if (!i.Authorization && n) {
|
|
@@ -7491,14 +7493,14 @@ function fd(e) {
|
|
|
7491
7493
|
},
|
|
7492
7494
|
auth: {
|
|
7493
7495
|
getUser: d,
|
|
7494
|
-
getTokenSilently:
|
|
7495
|
-
isAuthenticated:
|
|
7496
|
-
loginWithRedirect:
|
|
7497
|
-
loginWithPopup:
|
|
7498
|
-
login:
|
|
7499
|
-
logout:
|
|
7500
|
-
refresh:
|
|
7501
|
-
setToken:
|
|
7496
|
+
getTokenSilently: pr,
|
|
7497
|
+
isAuthenticated: fr,
|
|
7498
|
+
loginWithRedirect: _r,
|
|
7499
|
+
loginWithPopup: vr,
|
|
7500
|
+
login: gr,
|
|
7501
|
+
logout: yr,
|
|
7502
|
+
refresh: br,
|
|
7503
|
+
setToken: xr
|
|
7502
7504
|
},
|
|
7503
7505
|
bills: n,
|
|
7504
7506
|
browser: {
|
|
@@ -7507,11 +7509,11 @@ function fd(e) {
|
|
|
7507
7509
|
isIncognito: Pu
|
|
7508
7510
|
},
|
|
7509
7511
|
checkouts: r,
|
|
7510
|
-
clearCache:
|
|
7512
|
+
clearCache: di,
|
|
7511
7513
|
content: {
|
|
7512
7514
|
list: Al,
|
|
7513
7515
|
get: jl,
|
|
7514
|
-
getLanguage:
|
|
7516
|
+
getLanguage: Xn,
|
|
7515
7517
|
hasAccess: Ml,
|
|
7516
7518
|
unlock: Nl,
|
|
7517
7519
|
getPropertyFromHTML: kl,
|
|
@@ -7619,7 +7621,7 @@ function fd(e) {
|
|
|
7619
7621
|
has: ia
|
|
7620
7622
|
},
|
|
7621
7623
|
vendor: M,
|
|
7622
|
-
setToken:
|
|
7624
|
+
setToken: xr
|
|
7623
7625
|
};
|
|
7624
7626
|
return e.namespace && typeof window < "u" && (window[e.namespace] = P), P;
|
|
7625
7627
|
}
|
|
@@ -7703,7 +7705,7 @@ async function yd(e, t) {
|
|
|
7703
7705
|
//#region src/services/transform/index.ts
|
|
7704
7706
|
async function bd({ enabled: e = !1, rules: t }) {
|
|
7705
7707
|
e && Qc(async () => {
|
|
7706
|
-
let e = await
|
|
7708
|
+
let e = await fr(), n = window.location.href;
|
|
7707
7709
|
for (let r of t) {
|
|
7708
7710
|
let t = document.querySelectorAll(r.selector);
|
|
7709
7711
|
if (!(r.path && !new RegExp(r.path).test(n))) for (let n of t) {
|
|
@@ -7736,7 +7738,7 @@ var xd = "access_token";
|
|
|
7736
7738
|
function Sd() {
|
|
7737
7739
|
let e = new URLSearchParams(window.location.hash.substring(1)), t = e.get(xd);
|
|
7738
7740
|
if (t) {
|
|
7739
|
-
|
|
7741
|
+
xr(t);
|
|
7740
7742
|
let n = new URL(window.location.href);
|
|
7741
7743
|
e.delete(xd), n.hash = e.toString(), window.history.replaceState(null, "", n);
|
|
7742
7744
|
}
|
|
@@ -7748,7 +7750,7 @@ function Td() {
|
|
|
7748
7750
|
let e = new URLSearchParams(window.location.search), t = e.get(wd), n = e.get(Cd);
|
|
7749
7751
|
if (t !== null || n !== null) {
|
|
7750
7752
|
let t = new URL(window.location.href);
|
|
7751
|
-
e.delete(wd), e.delete(Cd), t.search = e.toString(),
|
|
7753
|
+
e.delete(wd), e.delete(Cd), t.search = e.toString(), di(), window.history.replaceState(null, "", t);
|
|
7752
7754
|
}
|
|
7753
7755
|
}
|
|
7754
7756
|
//#endregion
|
|
@@ -7862,8 +7864,8 @@ var Md = "sesamy-user";
|
|
|
7862
7864
|
async function Nd() {
|
|
7863
7865
|
let e = new URLSearchParams(window.location.search).get(Md)?.toLowerCase();
|
|
7864
7866
|
if (!e) return;
|
|
7865
|
-
let t = await
|
|
7866
|
-
t?.email === e ? K(`Current user matches sesamy user: ${t?.email} === ${e}`) : (K(`Current user does not match sesamy user: ${t?.email} !== ${e}`),
|
|
7867
|
+
let t = await mr();
|
|
7868
|
+
t?.email === e ? K(`Current user matches sesamy user: ${t?.email} === ${e}`) : (K(`Current user does not match sesamy user: ${t?.email} !== ${e}`), di(), _r({ authorizationParams: { login_hint: e } }));
|
|
7867
7869
|
let n = new URL(window.location.href);
|
|
7868
7870
|
n.searchParams.delete(Md), window.history.replaceState(null, "", n);
|
|
7869
7871
|
}
|
|
@@ -7873,7 +7875,7 @@ function Fd() {
|
|
|
7873
7875
|
let e = new URLSearchParams(window.location.search), t = e.get(Pd);
|
|
7874
7876
|
if (t !== null) {
|
|
7875
7877
|
let n = new URL(window.location.href);
|
|
7876
|
-
e.delete(Pd), n.search = e.toString(), K(`Purchase ${t}`), Gn(q.PURCHASE, { itemSrc: t }),
|
|
7878
|
+
e.delete(Pd), n.search = e.toString(), K(`Purchase ${t}`), Gn(q.PURCHASE, { itemSrc: t }), di(), window.history.replaceState(null, "", n);
|
|
7877
7879
|
}
|
|
7878
7880
|
}
|
|
7879
7881
|
//#endregion
|
|
@@ -7882,7 +7884,7 @@ var Id = "sesamy-login", Ld = "sesamy_login";
|
|
|
7882
7884
|
async function Rd() {
|
|
7883
7885
|
let e = new URLSearchParams(window.location.search);
|
|
7884
7886
|
if (!(e.get(Id) || e.get(Ld))) return;
|
|
7885
|
-
await
|
|
7887
|
+
await fr() || _r();
|
|
7886
7888
|
let t = new URL(window.location.href);
|
|
7887
7889
|
t.searchParams.delete(Id), window.history.replaceState(null, "", t);
|
|
7888
7890
|
}
|
|
@@ -7932,8 +7934,8 @@ function Wd() {
|
|
|
7932
7934
|
} catch {
|
|
7933
7935
|
t = !1;
|
|
7934
7936
|
}
|
|
7935
|
-
let n = sessionStorage.getItem(
|
|
7936
|
-
!t || n || (sessionStorage.setItem(
|
|
7937
|
+
let n = sessionStorage.getItem(Ii) === "true", r = e.has("code") || e.has("error") || e.has("state");
|
|
7938
|
+
!t || n || (sessionStorage.setItem(Ii, "true"), r || (K("Reloading page to get query params in incognito browser"), window.location.reload()));
|
|
7937
7939
|
}
|
|
7938
7940
|
//#endregion
|
|
7939
7941
|
//#region src/handlers/links.ts
|
|
@@ -7998,7 +8000,7 @@ async function Yd(e, t, n) {
|
|
|
7998
8000
|
clientId: e.clientId,
|
|
7999
8001
|
environment: e.environment,
|
|
8000
8002
|
...e.analytics
|
|
8001
|
-
}), n && Jn(n), await
|
|
8003
|
+
}), n && Jn(n), await dr({
|
|
8002
8004
|
clientId: e.clientId,
|
|
8003
8005
|
vendorId: e.vendorId || e.clientId,
|
|
8004
8006
|
organization: e.organization,
|