@monetize.software/sdk-extension 3.0.0-alpha.20 → 3.0.0-alpha.22
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/chunks/ar-OnxZkqWR.js +2 -0
- package/dist/chunks/ar-OnxZkqWR.js.map +1 -0
- package/dist/chunks/{ar-B2Wg_IrC.js → ar-rSKgwKvp.js} +4 -1
- package/dist/chunks/ar-rSKgwKvp.js.map +1 -0
- package/dist/chunks/cs-Cb2KZ70r.js +2 -0
- package/dist/chunks/cs-Cb2KZ70r.js.map +1 -0
- package/dist/chunks/{cs-BNo9Dx0Q.js → cs-DIWkcge_.js} +4 -1
- package/dist/chunks/cs-DIWkcge_.js.map +1 -0
- package/dist/chunks/{da-Do9Lq6En.js → da-DdMW98j3.js} +4 -1
- package/dist/chunks/da-DdMW98j3.js.map +1 -0
- package/dist/chunks/da-DyQC12xy.js +2 -0
- package/dist/chunks/da-DyQC12xy.js.map +1 -0
- package/dist/chunks/de-CWM13wnK.js +2 -0
- package/dist/chunks/de-CWM13wnK.js.map +1 -0
- package/dist/chunks/{de-C8pDZNvx.js → de-D1bSmD_-.js} +4 -1
- package/dist/chunks/de-D1bSmD_-.js.map +1 -0
- package/dist/chunks/el-BtKuORsc.js +2 -0
- package/dist/chunks/el-BtKuORsc.js.map +1 -0
- package/dist/chunks/{el-DzMNX-_P.js → el-C4LtWpfP.js} +4 -1
- package/dist/chunks/el-C4LtWpfP.js.map +1 -0
- package/dist/chunks/{es-YrKt-q4w.js → es-Bhx7w85J.js} +4 -1
- package/dist/chunks/es-Bhx7w85J.js.map +1 -0
- package/dist/chunks/es-qLcKnBft.js +2 -0
- package/dist/chunks/es-qLcKnBft.js.map +1 -0
- package/dist/chunks/{fi-Bh44pwZ4.js → fi-C34Oc6rg.js} +4 -1
- package/dist/chunks/fi-C34Oc6rg.js.map +1 -0
- package/dist/chunks/fi-kGtbK51C.js +2 -0
- package/dist/chunks/fi-kGtbK51C.js.map +1 -0
- package/dist/chunks/{fr-Bc0pw4ws.js → fr-BrWtqej3.js} +4 -1
- package/dist/chunks/fr-BrWtqej3.js.map +1 -0
- package/dist/chunks/fr-CScwFVNj.js +2 -0
- package/dist/chunks/fr-CScwFVNj.js.map +1 -0
- package/dist/chunks/{he-Bfm-bhe3.js → he-Byr2r07x.js} +6 -3
- package/dist/chunks/he-Byr2r07x.js.map +1 -0
- package/dist/chunks/he-ChFVbP_S.js +2 -0
- package/dist/chunks/he-ChFVbP_S.js.map +1 -0
- package/dist/chunks/hi-BIswPYL2.js +2 -0
- package/dist/chunks/hi-BIswPYL2.js.map +1 -0
- package/dist/chunks/{hi-D-O-B9Dn.js → hi-CABVgpKU.js} +4 -1
- package/dist/chunks/hi-CABVgpKU.js.map +1 -0
- package/dist/chunks/{hu-CmIuAbLL.js → hu-CSQ9avfJ.js} +4 -1
- package/dist/chunks/hu-CSQ9avfJ.js.map +1 -0
- package/dist/chunks/hu-CT_jwL0k.js +2 -0
- package/dist/chunks/hu-CT_jwL0k.js.map +1 -0
- package/dist/chunks/id-2lYf7ogC.js +2 -0
- package/dist/chunks/id-2lYf7ogC.js.map +1 -0
- package/dist/chunks/{id-DN7IES-A.js → id-BJ5w6RSU.js} +4 -1
- package/dist/chunks/id-BJ5w6RSU.js.map +1 -0
- package/dist/chunks/it-CEMhCvXU.js +2 -0
- package/dist/chunks/it-CEMhCvXU.js.map +1 -0
- package/dist/chunks/{it-Cz5Nmqx5.js → it-Df8ChmTK.js} +4 -1
- package/dist/chunks/it-Df8ChmTK.js.map +1 -0
- package/dist/chunks/ja-CkpO3n78.js +2 -0
- package/dist/chunks/ja-CkpO3n78.js.map +1 -0
- package/dist/chunks/{ja-BH9BlBh2.js → ja-a53E5b2s.js} +6 -3
- package/dist/chunks/ja-a53E5b2s.js.map +1 -0
- package/dist/chunks/{ko-CYV9QuYs.js → ko-AZ8GrmXu.js} +6 -3
- package/dist/chunks/ko-AZ8GrmXu.js.map +1 -0
- package/dist/chunks/ko-BKdzk0jX.js +2 -0
- package/dist/chunks/ko-BKdzk0jX.js.map +1 -0
- package/dist/chunks/nl-Bek7IiHL.js +2 -0
- package/dist/chunks/nl-Bek7IiHL.js.map +1 -0
- package/dist/chunks/{nl-BvkB900D.js → nl-sF6ms5FU.js} +4 -1
- package/dist/chunks/nl-sF6ms5FU.js.map +1 -0
- package/dist/chunks/no-BztcQKh8.js +2 -0
- package/dist/chunks/no-BztcQKh8.js.map +1 -0
- package/dist/chunks/{no-3s9_ormb.js → no-DGf5PuW5.js} +4 -1
- package/dist/chunks/no-DGf5PuW5.js.map +1 -0
- package/dist/chunks/pl-CMF2KerQ.js +2 -0
- package/dist/chunks/pl-CMF2KerQ.js.map +1 -0
- package/dist/chunks/{pl-C9WTGQtb.js → pl-Dd-Ze6wn.js} +4 -1
- package/dist/chunks/pl-Dd-Ze6wn.js.map +1 -0
- package/dist/chunks/{pt-uFVUv_Op.js → pt-BL9X8Du2.js} +4 -1
- package/dist/chunks/pt-BL9X8Du2.js.map +1 -0
- package/dist/chunks/pt-DF9cd_iW.js +2 -0
- package/dist/chunks/pt-DF9cd_iW.js.map +1 -0
- package/dist/chunks/{ro-BrqQ8Au-.js → ro-CGYmtR8q.js} +4 -1
- package/dist/chunks/ro-CGYmtR8q.js.map +1 -0
- package/dist/chunks/ro-DpPc1UhJ.js +2 -0
- package/dist/chunks/ro-DpPc1UhJ.js.map +1 -0
- package/dist/chunks/ru-gt3-clOi.js +2 -0
- package/dist/chunks/ru-gt3-clOi.js.map +1 -0
- package/dist/chunks/{ru-DK594dA8.js → ru-oPoQtUxk.js} +4 -1
- package/dist/chunks/ru-oPoQtUxk.js.map +1 -0
- package/dist/chunks/sv-Cg7O9Uh3.js +2 -0
- package/dist/chunks/sv-Cg7O9Uh3.js.map +1 -0
- package/dist/chunks/{sv-CHNH8-mq.js → sv-kXHP1Ct3.js} +4 -1
- package/dist/chunks/sv-kXHP1Ct3.js.map +1 -0
- package/dist/chunks/{th-l24Pm5q-.js → th-DMcmb36d.js} +4 -1
- package/dist/chunks/th-DMcmb36d.js.map +1 -0
- package/dist/chunks/th-pvtT9u-U.js +2 -0
- package/dist/chunks/th-pvtT9u-U.js.map +1 -0
- package/dist/chunks/tr-gAn3KCul.js +2 -0
- package/dist/chunks/tr-gAn3KCul.js.map +1 -0
- package/dist/chunks/{tr-ADpigSY5.js → tr-zjLbddlL.js} +4 -1
- package/dist/chunks/tr-zjLbddlL.js.map +1 -0
- package/dist/chunks/{uk-CGqo4jek.js → uk-BYSiM14V.js} +4 -1
- package/dist/chunks/uk-BYSiM14V.js.map +1 -0
- package/dist/chunks/uk-HIaOETe4.js +2 -0
- package/dist/chunks/uk-HIaOETe4.js.map +1 -0
- package/dist/chunks/vi-B7DVCjxx.js +2 -0
- package/dist/chunks/vi-B7DVCjxx.js.map +1 -0
- package/dist/chunks/{vi-Dk9bTu6f.js → vi-FbVRwy9D.js} +4 -1
- package/dist/chunks/vi-FbVRwy9D.js.map +1 -0
- package/dist/chunks/{zh-CwczPMPp.js → zh-007yK7rl.js} +2 -2
- package/dist/chunks/zh-007yK7rl.js.map +1 -0
- package/dist/chunks/{zh-LDkEV2D9.js → zh-Cv0Yw4qR.js} +6 -3
- package/dist/chunks/zh-Cv0Yw4qR.js.map +1 -0
- package/dist/content.cjs +2 -2
- package/dist/content.cjs.map +1 -1
- package/dist/content.js +363 -316
- package/dist/content.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/ar-7cgIM-Vl.js +0 -2
- package/dist/chunks/ar-7cgIM-Vl.js.map +0 -1
- package/dist/chunks/ar-B2Wg_IrC.js.map +0 -1
- package/dist/chunks/cs-BNo9Dx0Q.js.map +0 -1
- package/dist/chunks/cs-S05PC5AC.js +0 -2
- package/dist/chunks/cs-S05PC5AC.js.map +0 -1
- package/dist/chunks/da-Bi4zBG14.js +0 -2
- package/dist/chunks/da-Bi4zBG14.js.map +0 -1
- package/dist/chunks/da-Do9Lq6En.js.map +0 -1
- package/dist/chunks/de-C8pDZNvx.js.map +0 -1
- package/dist/chunks/de-nCDB6D2W.js +0 -2
- package/dist/chunks/de-nCDB6D2W.js.map +0 -1
- package/dist/chunks/el-BrKaa978.js +0 -2
- package/dist/chunks/el-BrKaa978.js.map +0 -1
- package/dist/chunks/el-DzMNX-_P.js.map +0 -1
- package/dist/chunks/es-B-Wtyzrl.js +0 -2
- package/dist/chunks/es-B-Wtyzrl.js.map +0 -1
- package/dist/chunks/es-YrKt-q4w.js.map +0 -1
- package/dist/chunks/fi-Bh44pwZ4.js.map +0 -1
- package/dist/chunks/fi-D1SGXjnO.js +0 -2
- package/dist/chunks/fi-D1SGXjnO.js.map +0 -1
- package/dist/chunks/fr-Bc0pw4ws.js.map +0 -1
- package/dist/chunks/fr-BhYf-iKk.js +0 -2
- package/dist/chunks/fr-BhYf-iKk.js.map +0 -1
- package/dist/chunks/he-BXAaFv6Y.js +0 -2
- package/dist/chunks/he-BXAaFv6Y.js.map +0 -1
- package/dist/chunks/he-Bfm-bhe3.js.map +0 -1
- package/dist/chunks/hi-D-O-B9Dn.js.map +0 -1
- package/dist/chunks/hi-xblDO0O7.js +0 -2
- package/dist/chunks/hi-xblDO0O7.js.map +0 -1
- package/dist/chunks/hu-CmIuAbLL.js.map +0 -1
- package/dist/chunks/hu-Wa46p0y4.js +0 -2
- package/dist/chunks/hu-Wa46p0y4.js.map +0 -1
- package/dist/chunks/id-CQEo5X94.js +0 -2
- package/dist/chunks/id-CQEo5X94.js.map +0 -1
- package/dist/chunks/id-DN7IES-A.js.map +0 -1
- package/dist/chunks/it-8AYCm0xz.js +0 -2
- package/dist/chunks/it-8AYCm0xz.js.map +0 -1
- package/dist/chunks/it-Cz5Nmqx5.js.map +0 -1
- package/dist/chunks/ja-BH9BlBh2.js.map +0 -1
- package/dist/chunks/ja-q-COVayn.js +0 -2
- package/dist/chunks/ja-q-COVayn.js.map +0 -1
- package/dist/chunks/ko-B6HRCscZ.js +0 -2
- package/dist/chunks/ko-B6HRCscZ.js.map +0 -1
- package/dist/chunks/ko-CYV9QuYs.js.map +0 -1
- package/dist/chunks/nl-BvkB900D.js.map +0 -1
- package/dist/chunks/nl-CAd6_xlm.js +0 -2
- package/dist/chunks/nl-CAd6_xlm.js.map +0 -1
- package/dist/chunks/no-3s9_ormb.js.map +0 -1
- package/dist/chunks/no-CAmz6bz6.js +0 -2
- package/dist/chunks/no-CAmz6bz6.js.map +0 -1
- package/dist/chunks/pl-C9WTGQtb.js.map +0 -1
- package/dist/chunks/pl-DqUSTCaF.js +0 -2
- package/dist/chunks/pl-DqUSTCaF.js.map +0 -1
- package/dist/chunks/pt-8ARZnH0_.js +0 -2
- package/dist/chunks/pt-8ARZnH0_.js.map +0 -1
- package/dist/chunks/pt-uFVUv_Op.js.map +0 -1
- package/dist/chunks/ro-BrqQ8Au-.js.map +0 -1
- package/dist/chunks/ro-D-NMbp2F.js +0 -2
- package/dist/chunks/ro-D-NMbp2F.js.map +0 -1
- package/dist/chunks/ru-8gbHPh0g.js +0 -2
- package/dist/chunks/ru-8gbHPh0g.js.map +0 -1
- package/dist/chunks/ru-DK594dA8.js.map +0 -1
- package/dist/chunks/sv-CHNH8-mq.js.map +0 -1
- package/dist/chunks/sv-D8a8hmx9.js +0 -2
- package/dist/chunks/sv-D8a8hmx9.js.map +0 -1
- package/dist/chunks/th-DfjUK0Y7.js +0 -2
- package/dist/chunks/th-DfjUK0Y7.js.map +0 -1
- package/dist/chunks/th-l24Pm5q-.js.map +0 -1
- package/dist/chunks/tr-ADpigSY5.js.map +0 -1
- package/dist/chunks/tr-BdBpz4tL.js +0 -2
- package/dist/chunks/tr-BdBpz4tL.js.map +0 -1
- package/dist/chunks/uk-CGqo4jek.js.map +0 -1
- package/dist/chunks/uk-Cx1zv1ao.js +0 -2
- package/dist/chunks/uk-Cx1zv1ao.js.map +0 -1
- package/dist/chunks/vi-Dk9bTu6f.js.map +0 -1
- package/dist/chunks/vi-oe2dW21I.js +0 -2
- package/dist/chunks/vi-oe2dW21I.js.map +0 -1
- package/dist/chunks/zh-CwczPMPp.js.map +0 -1
- package/dist/chunks/zh-LDkEV2D9.js.map +0 -1
package/dist/content.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as L, B as
|
|
1
|
+
import { P as L, B as De, E as ze, c as qe, A as ue, w as Ne, a as J, r as Fe, b as $e } from "./chunks/chrome-port-bfTUUDz_.js";
|
|
2
2
|
import { render as Q, h as de, createContext as Ve } from "preact";
|
|
3
3
|
import { jsx as o, jsxs as u, Fragment as ae } from "preact/jsx-runtime";
|
|
4
|
-
import { useState as k, useEffect as P, useContext as He, useRef as
|
|
4
|
+
import { useState as k, useEffect as P, useContext as He, useRef as j, useMemo as Ge, useLayoutEffect as We } from "preact/hooks";
|
|
5
5
|
import { P as Ze } from "./chunks/port-name-ervLBWAQ.js";
|
|
6
6
|
function Ye(r) {
|
|
7
7
|
return `pw-offer-${r}-start`;
|
|
@@ -96,16 +96,16 @@ function tt(r, e, t = {}) {
|
|
|
96
96
|
}
|
|
97
97
|
`, a = document.createElement("style");
|
|
98
98
|
a.textContent = s + Se + (t.injectCss ?? ""), i.appendChild(a);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
return Q(de(r,
|
|
99
|
+
const l = document.createElement("div");
|
|
100
|
+
l.style.pointerEvents = "auto", i.appendChild(l);
|
|
101
|
+
let c = e;
|
|
102
|
+
return Q(de(r, c), l), {
|
|
103
103
|
shadowRoot: i,
|
|
104
104
|
update(h) {
|
|
105
|
-
|
|
105
|
+
c = { ...c, ...h }, Q(de(r, c), l);
|
|
106
106
|
},
|
|
107
107
|
unmount() {
|
|
108
|
-
Q(null,
|
|
108
|
+
Q(null, l), n.remove();
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
@@ -186,7 +186,7 @@ async function st(r) {
|
|
|
186
186
|
if (e) return e;
|
|
187
187
|
const t = te.get(r);
|
|
188
188
|
if (t) return t;
|
|
189
|
-
const n = rt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./chunks/ar-
|
|
189
|
+
const n = rt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./chunks/ar-rSKgwKvp.js"), "./locales/cs.ts": () => import("./chunks/cs-DIWkcge_.js"), "./locales/da.ts": () => import("./chunks/da-DdMW98j3.js"), "./locales/de.ts": () => import("./chunks/de-D1bSmD_-.js"), "./locales/el.ts": () => import("./chunks/el-C4LtWpfP.js"), "./locales/es.ts": () => import("./chunks/es-Bhx7w85J.js"), "./locales/fi.ts": () => import("./chunks/fi-C34Oc6rg.js"), "./locales/fr.ts": () => import("./chunks/fr-BrWtqej3.js"), "./locales/he.ts": () => import("./chunks/he-Byr2r07x.js"), "./locales/hi.ts": () => import("./chunks/hi-CABVgpKU.js"), "./locales/hu.ts": () => import("./chunks/hu-CSQ9avfJ.js"), "./locales/id.ts": () => import("./chunks/id-BJ5w6RSU.js"), "./locales/it.ts": () => import("./chunks/it-Df8ChmTK.js"), "./locales/ja.ts": () => import("./chunks/ja-a53E5b2s.js"), "./locales/ko.ts": () => import("./chunks/ko-AZ8GrmXu.js"), "./locales/nl.ts": () => import("./chunks/nl-sF6ms5FU.js"), "./locales/no.ts": () => import("./chunks/no-DGf5PuW5.js"), "./locales/pl.ts": () => import("./chunks/pl-Dd-Ze6wn.js"), "./locales/pt.ts": () => import("./chunks/pt-BL9X8Du2.js"), "./locales/ro.ts": () => import("./chunks/ro-CGYmtR8q.js"), "./locales/ru.ts": () => import("./chunks/ru-oPoQtUxk.js"), "./locales/sv.ts": () => import("./chunks/sv-kXHP1Ct3.js"), "./locales/th.ts": () => import("./chunks/th-DMcmb36d.js"), "./locales/tr.ts": () => import("./chunks/tr-zjLbddlL.js"), "./locales/uk.ts": () => import("./chunks/uk-BYSiM14V.js"), "./locales/vi.ts": () => import("./chunks/vi-FbVRwy9D.js"), "./locales/zh.ts": () => import("./chunks/zh-Cv0Yw4qR.js") }), `./locales/${r}.ts`, 3).then((i) => {
|
|
190
190
|
const s = i.default ?? {};
|
|
191
191
|
return ee.set(r, s), s;
|
|
192
192
|
}).catch((i) => {
|
|
@@ -218,11 +218,11 @@ function at({ bootstrap: r, forceLocale: e, children: t }) {
|
|
|
218
218
|
d = !0;
|
|
219
219
|
};
|
|
220
220
|
}, [r, e]);
|
|
221
|
-
const
|
|
221
|
+
const l = {
|
|
222
222
|
locale: n,
|
|
223
|
-
t: s ? (
|
|
223
|
+
t: s ? (c, h, d) => Ae(s[c] ?? h, d) : Ce
|
|
224
224
|
};
|
|
225
|
-
return /* @__PURE__ */ o(Ie.Provider, { value:
|
|
225
|
+
return /* @__PURE__ */ o(Ie.Provider, { value: l, children: t });
|
|
226
226
|
}
|
|
227
227
|
function S() {
|
|
228
228
|
return He(Ie);
|
|
@@ -236,10 +236,10 @@ function lt({
|
|
|
236
236
|
topBanner: i,
|
|
237
237
|
allowClose: s = !0,
|
|
238
238
|
hideCloseButton: a = !1,
|
|
239
|
-
inline:
|
|
240
|
-
children:
|
|
239
|
+
inline: l = !1,
|
|
240
|
+
children: c
|
|
241
241
|
}) {
|
|
242
|
-
const { t: h } = S(), d =
|
|
242
|
+
const { t: h } = S(), d = j(null), g = j(null);
|
|
243
243
|
return P(() => {
|
|
244
244
|
if (!r) return;
|
|
245
245
|
g.current = document.activeElement ?? null;
|
|
@@ -254,23 +254,23 @@ function lt({
|
|
|
254
254
|
if (y.key !== "Tab" || !d.current) return;
|
|
255
255
|
const C = Array.from(
|
|
256
256
|
d.current.querySelectorAll(pe)
|
|
257
|
-
).filter((
|
|
257
|
+
).filter((R) => !R.hasAttribute("disabled") && R.tabIndex !== -1);
|
|
258
258
|
if (C.length === 0) {
|
|
259
259
|
y.preventDefault();
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const I = C[0],
|
|
263
|
-
y.shiftKey && M === I ? (y.preventDefault(),
|
|
262
|
+
const I = C[0], O = C[C.length - 1], M = document.activeElement;
|
|
263
|
+
y.shiftKey && M === I ? (y.preventDefault(), O.focus()) : !y.shiftKey && M === O && (y.preventDefault(), I.focus());
|
|
264
264
|
};
|
|
265
265
|
document.addEventListener("keydown", A, !0);
|
|
266
266
|
const b = document.body.style.overflow;
|
|
267
|
-
return
|
|
268
|
-
document.removeEventListener("keydown", A, !0),
|
|
267
|
+
return l || (document.body.style.overflow = "hidden"), () => {
|
|
268
|
+
document.removeEventListener("keydown", A, !0), l || (document.body.style.overflow = b), g.current?.focus?.({ preventScroll: !0 });
|
|
269
269
|
};
|
|
270
|
-
}, [r, e, s,
|
|
270
|
+
}, [r, e, s, l]), r ? /* @__PURE__ */ u(
|
|
271
271
|
"div",
|
|
272
272
|
{
|
|
273
|
-
class: `${
|
|
273
|
+
class: `${l ? "absolute z-[1]" : "fixed z-[2147483647]"} inset-0 flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]`,
|
|
274
274
|
onClick: (m) => {
|
|
275
275
|
s && m.target === m.currentTarget && e();
|
|
276
276
|
},
|
|
@@ -296,7 +296,7 @@ function lt({
|
|
|
296
296
|
boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
297
297
|
},
|
|
298
298
|
children: [
|
|
299
|
-
|
|
299
|
+
c,
|
|
300
300
|
s && !a ? /* @__PURE__ */ o(
|
|
301
301
|
"button",
|
|
302
302
|
{
|
|
@@ -382,8 +382,8 @@ function Me({ block: r, ctx: e }) {
|
|
|
382
382
|
const t = e.auth, n = e.authSession, i = r.allow_signup !== !1, s = r.allow_password_reset !== !1, a = r.hide_when_authenticated !== !1;
|
|
383
383
|
if (!t)
|
|
384
384
|
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
385
|
-
const
|
|
386
|
-
return
|
|
385
|
+
const l = n && !n.user.is_anonymous ? n : null;
|
|
386
|
+
return l && a ? null : l ? /* @__PURE__ */ o(ut, { email: l.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
|
|
387
387
|
}) }) : /* @__PURE__ */ o(
|
|
388
388
|
dt,
|
|
389
389
|
{
|
|
@@ -413,13 +413,13 @@ function ut({ email: r, onSignOut: e }) {
|
|
|
413
413
|
] });
|
|
414
414
|
}
|
|
415
415
|
function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
416
|
-
const { t: i } = S(), s = n.auth, a = r.providers ?? [],
|
|
416
|
+
const { t: i } = S(), s = n.auth, a = r.providers ?? [], l = n.initialAuthMode === "signup" && e ? "signup" : "signin", [c, h] = k(l), [d, g] = k(""), [_, p] = k(""), [v, m] = k(""), [A, b] = k(""), [y, C] = k(null), I = j(!1), [O, M] = k(null), [R, D] = k(null), [z, T] = k(!1), [E, q] = k(null);
|
|
417
417
|
P(() => {
|
|
418
418
|
if (typeof s.getLastLogin != "function") return;
|
|
419
419
|
let f = !1;
|
|
420
420
|
return s.getLastLogin().then(
|
|
421
421
|
(w) => {
|
|
422
|
-
f || !w || (
|
|
422
|
+
f || !w || (q(w), w.email && g((B) => B === "" ? w.email : B));
|
|
423
423
|
},
|
|
424
424
|
() => {
|
|
425
425
|
}
|
|
@@ -427,32 +427,30 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
427
427
|
f = !0;
|
|
428
428
|
};
|
|
429
429
|
}, [s]);
|
|
430
|
-
const
|
|
431
|
-
h(f), M(null),
|
|
430
|
+
const U = (f) => {
|
|
431
|
+
h(f), M(null), D(null), T(!1);
|
|
432
432
|
}, Y = async (f) => {
|
|
433
433
|
if (f.preventDefault(), !(I.current || y)) {
|
|
434
434
|
I.current = !0;
|
|
435
435
|
try {
|
|
436
|
-
if (M(null),
|
|
436
|
+
if (M(null), D(null), c === "signup" && !z) {
|
|
437
437
|
if (!d.trim()) return;
|
|
438
438
|
T(!0);
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
if (
|
|
441
|
+
if (c === "signup" && _ !== v) {
|
|
442
442
|
M(i("auth.passwords_mismatch", "Passwords don't match"));
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
445
|
C("email");
|
|
446
446
|
try {
|
|
447
|
-
|
|
448
|
-
i("auth.reset_sent_message", "If that email exists, a reset code has been sent.")
|
|
449
|
-
)) : l === "signup_verify" ? await s.verifyOtp({ email: d, token: A, type: "email" }) : l === "reset_verify" && (await s.verifyOtp({
|
|
447
|
+
c === "signin" ? await s.signInWithEmail({ email: d, password: _ }) : c === "signup" ? (await s.signUp({ email: d, password: _ })).kind === "confirmation_required" && (p(""), h("signup_verify"), D(i("auth.check_email_message", "Check your email for a confirmation code."))) : c === "forgot" ? (await s.requestPasswordReset({ email: d }), h("reset_sent")) : c === "signup_verify" ? await s.verifyOtp({ email: d, token: A, type: "email" }) : c === "reset_verify" && (await s.verifyOtp({
|
|
450
448
|
email: d,
|
|
451
449
|
token: A,
|
|
452
450
|
type: _ ? "recovery" : "email"
|
|
453
451
|
}), _ && await s.updatePassword({ password: _ }));
|
|
454
452
|
} catch (w) {
|
|
455
|
-
M(fe(w,
|
|
453
|
+
M(fe(w, c === "signup" ? "signup" : c === "signup_verify" || c === "reset_verify" ? "otp" : c === "forgot" ? "reset" : "signin", i));
|
|
456
454
|
} finally {
|
|
457
455
|
C(null);
|
|
458
456
|
}
|
|
@@ -462,7 +460,7 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
462
460
|
}
|
|
463
461
|
}, V = async (f) => {
|
|
464
462
|
if (!(I.current || y)) {
|
|
465
|
-
I.current = !0, C(f), M(null),
|
|
463
|
+
I.current = !0, C(f), M(null), D(null);
|
|
466
464
|
try {
|
|
467
465
|
await s.signInWithOAuth({
|
|
468
466
|
provider: f,
|
|
@@ -476,9 +474,9 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
476
474
|
I.current = !1, C(null);
|
|
477
475
|
}
|
|
478
476
|
}
|
|
479
|
-
}, K = a.length > 0 && (
|
|
480
|
-
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
|
|
481
|
-
/* @__PURE__ */ o(ht, { mode:
|
|
477
|
+
}, K = a.length > 0 && (c === "signin" || c === "signup"), X = c === "signin" || c === "signup" || c === "forgot", x = c === "signin" || c === "signup" && z;
|
|
478
|
+
return c === "reset_sent" ? /* @__PURE__ */ o(_t, { email: d, onBack: () => U("signin"), t: i }) : /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
|
|
479
|
+
/* @__PURE__ */ o(ht, { mode: c, customHeading: r.heading, customSubheading: r.subheading }),
|
|
482
480
|
K ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2.5", children: [
|
|
483
481
|
a.map((f) => /* @__PURE__ */ u("div", { class: "relative", children: [
|
|
484
482
|
/* @__PURE__ */ u(
|
|
@@ -516,11 +514,11 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
516
514
|
placeholder: i("auth.password", "Password"),
|
|
517
515
|
value: _,
|
|
518
516
|
onInput: p,
|
|
519
|
-
autocomplete:
|
|
517
|
+
autocomplete: c === "signin" ? "current-password" : "new-password",
|
|
520
518
|
required: !0
|
|
521
519
|
}
|
|
522
520
|
),
|
|
523
|
-
|
|
521
|
+
c === "signup" && z && /* @__PURE__ */ o(
|
|
524
522
|
re,
|
|
525
523
|
{
|
|
526
524
|
placeholder: i("auth.repeat_password", "Repeat password"),
|
|
@@ -530,7 +528,7 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
530
528
|
required: !0
|
|
531
529
|
}
|
|
532
530
|
),
|
|
533
|
-
(
|
|
531
|
+
(c === "signup_verify" || c === "reset_verify") && /* @__PURE__ */ o(
|
|
534
532
|
ge,
|
|
535
533
|
{
|
|
536
534
|
type: "text",
|
|
@@ -542,7 +540,7 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
542
540
|
required: !0
|
|
543
541
|
}
|
|
544
542
|
),
|
|
545
|
-
|
|
543
|
+
c === "reset_verify" && /* @__PURE__ */ o(
|
|
546
544
|
re,
|
|
547
545
|
{
|
|
548
546
|
placeholder: i(
|
|
@@ -554,24 +552,23 @@ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
|
554
552
|
autocomplete: "new-password"
|
|
555
553
|
}
|
|
556
554
|
),
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
l !== "reset_sent" && /* @__PURE__ */ o(
|
|
555
|
+
c === "signin" && t && /* @__PURE__ */ o("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ o(Z, { onClick: () => U("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
|
|
556
|
+
O && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: O }),
|
|
557
|
+
R && /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: R }),
|
|
558
|
+
/* @__PURE__ */ o(
|
|
562
559
|
mt,
|
|
563
560
|
{
|
|
564
561
|
busy: y === "email",
|
|
565
|
-
label: ft(
|
|
562
|
+
label: ft(c, z, r.submit_label ?? r.heading, i)
|
|
566
563
|
}
|
|
567
564
|
)
|
|
568
565
|
] }),
|
|
569
566
|
/* @__PURE__ */ o(
|
|
570
567
|
gt,
|
|
571
568
|
{
|
|
572
|
-
mode:
|
|
569
|
+
mode: c,
|
|
573
570
|
allowSignup: e,
|
|
574
|
-
onSwitch:
|
|
571
|
+
onSwitch: U
|
|
575
572
|
}
|
|
576
573
|
)
|
|
577
574
|
] });
|
|
@@ -581,10 +578,10 @@ function ht({
|
|
|
581
578
|
customHeading: e,
|
|
582
579
|
customSubheading: t
|
|
583
580
|
}) {
|
|
584
|
-
const { t: n } = S(), i = pt(r, n), s = r === "signin" || r === "signup", a = s && e ? e : i.title,
|
|
581
|
+
const { t: n } = S(), i = pt(r, n), s = r === "signin" || r === "signup", a = s && e ? e : i.title, l = s && t !== void 0 ? t || null : i.subtitle;
|
|
585
582
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
586
583
|
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a }),
|
|
587
|
-
|
|
584
|
+
l ? /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: l }) : null
|
|
588
585
|
] });
|
|
589
586
|
}
|
|
590
587
|
function pt(r, e) {
|
|
@@ -703,7 +700,7 @@ function ge({ type: r, placeholder: e, value: t, onInput: n, autocomplete: i, in
|
|
|
703
700
|
type: r,
|
|
704
701
|
value: t,
|
|
705
702
|
placeholder: e,
|
|
706
|
-
onInput: (
|
|
703
|
+
onInput: (l) => n(l.target.value),
|
|
707
704
|
autocomplete: i,
|
|
708
705
|
inputMode: s,
|
|
709
706
|
required: a,
|
|
@@ -712,9 +709,9 @@ function ge({ type: r, placeholder: e, value: t, onInput: n, autocomplete: i, in
|
|
|
712
709
|
);
|
|
713
710
|
}
|
|
714
711
|
function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i }) {
|
|
715
|
-
const { t: s } = S(), [a,
|
|
712
|
+
const { t: s } = S(), [a, l] = k(!1), c = j(null);
|
|
716
713
|
P(() => {
|
|
717
|
-
const g =
|
|
714
|
+
const g = c.current;
|
|
718
715
|
g && g.value !== e && (g.value = e);
|
|
719
716
|
}, [a, e]);
|
|
720
717
|
const h = s("auth.show_password", "Show password"), d = s("auth.hide_password", "Hide password");
|
|
@@ -722,7 +719,7 @@ function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i
|
|
|
722
719
|
/* @__PURE__ */ o(
|
|
723
720
|
"input",
|
|
724
721
|
{
|
|
725
|
-
ref:
|
|
722
|
+
ref: c,
|
|
726
723
|
type: a ? "text" : "password",
|
|
727
724
|
value: e,
|
|
728
725
|
placeholder: r,
|
|
@@ -736,7 +733,7 @@ function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i
|
|
|
736
733
|
"button",
|
|
737
734
|
{
|
|
738
735
|
type: "button",
|
|
739
|
-
onClick: () =>
|
|
736
|
+
onClick: () => l((g) => !g),
|
|
740
737
|
"aria-label": a ? d : h,
|
|
741
738
|
tabIndex: -1,
|
|
742
739
|
class: "absolute right-4 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
@@ -814,6 +811,56 @@ function vt({ provider: r }) {
|
|
|
814
811
|
) : r === "github" ? /* @__PURE__ */ o("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ o("svg", { width: "18", height: "20", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M14 2.7C14 1.2 12.8 0 11.3 0H2.7C1.2 0 0 1.2 0 2.7v10.6C0 14.8 1.2 16 2.7 16h4V9.8H4.7v-2H6.7V6.4c0-2 1.2-3.1 3-3.1.9 0 1.7.1 2 .2V5h-1.4c-.8 0-1 .4-1 1v1.5h2.4l-.3 2H9.3V16h2c1.5 0 2.7-1.2 2.7-2.7V2.7Z" }) });
|
|
815
812
|
}
|
|
816
813
|
function _t({
|
|
814
|
+
email: r,
|
|
815
|
+
onBack: e,
|
|
816
|
+
t
|
|
817
|
+
}) {
|
|
818
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
|
|
819
|
+
/* @__PURE__ */ o(
|
|
820
|
+
"div",
|
|
821
|
+
{
|
|
822
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
823
|
+
style: {
|
|
824
|
+
background: "linear-gradient(135deg, #4ade80, #16a34a)",
|
|
825
|
+
color: "#fff",
|
|
826
|
+
boxShadow: "0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"
|
|
827
|
+
},
|
|
828
|
+
"aria-hidden": "true",
|
|
829
|
+
children: /* @__PURE__ */ o("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ o(
|
|
830
|
+
"path",
|
|
831
|
+
{
|
|
832
|
+
d: "M5 13l4 4L19 7",
|
|
833
|
+
stroke: "currentColor",
|
|
834
|
+
"stroke-width": "2.5",
|
|
835
|
+
"stroke-linecap": "round",
|
|
836
|
+
"stroke-linejoin": "round"
|
|
837
|
+
}
|
|
838
|
+
) })
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ o("h2", { class: "mt-1 text-3xl font-bold tracking-tight text-gray-900", children: t("auth.check_email_title", "Check your email") }),
|
|
842
|
+
/* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: t(
|
|
843
|
+
"auth.reset_sent_subtitle",
|
|
844
|
+
"We sent a password reset link. Follow the instructions in the email to reset your password."
|
|
845
|
+
) }),
|
|
846
|
+
r ? /* @__PURE__ */ o("p", { class: "break-all text-base font-semibold text-gray-900", children: r }) : null,
|
|
847
|
+
/* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("auth.reset_link_valid", "The link is valid for 1 hour.") }),
|
|
848
|
+
/* @__PURE__ */ o(
|
|
849
|
+
"button",
|
|
850
|
+
{
|
|
851
|
+
type: "button",
|
|
852
|
+
onClick: e,
|
|
853
|
+
class: "pw-cta-shimmer relative mt-2 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
854
|
+
style: {
|
|
855
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
|
|
856
|
+
boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
|
|
857
|
+
},
|
|
858
|
+
children: /* @__PURE__ */ o("span", { class: "relative z-10", children: t("auth.back_to_login", "Back to Login") })
|
|
859
|
+
}
|
|
860
|
+
)
|
|
861
|
+
] });
|
|
862
|
+
}
|
|
863
|
+
function St({
|
|
817
864
|
block: r,
|
|
818
865
|
bootstrap: e,
|
|
819
866
|
auth: t,
|
|
@@ -821,9 +868,9 @@ function _t({
|
|
|
821
868
|
onBack: i,
|
|
822
869
|
showBack: s = !0,
|
|
823
870
|
intent: a = "preauth",
|
|
824
|
-
initialMode:
|
|
871
|
+
initialMode: l
|
|
825
872
|
}) {
|
|
826
|
-
const { t:
|
|
873
|
+
const { t: c } = S(), h = {
|
|
827
874
|
bootstrap: e,
|
|
828
875
|
selectedPriceId: null,
|
|
829
876
|
setSelectedPriceId: () => {
|
|
@@ -832,18 +879,18 @@ function _t({
|
|
|
832
879
|
},
|
|
833
880
|
auth: t,
|
|
834
881
|
authSession: n,
|
|
835
|
-
initialAuthMode:
|
|
882
|
+
initialAuthMode: l
|
|
836
883
|
}, d = a === "restore" ? {
|
|
837
884
|
...r,
|
|
838
|
-
heading:
|
|
839
|
-
subheading:
|
|
885
|
+
heading: c("auth.restore_purchases_heading", "Restore Purchases"),
|
|
886
|
+
subheading: c(
|
|
840
887
|
"auth.restore_purchases_subheading",
|
|
841
888
|
"Please sign in to restore your purchases."
|
|
842
889
|
)
|
|
843
890
|
} : a === "preauth" ? {
|
|
844
891
|
...r,
|
|
845
|
-
heading:
|
|
846
|
-
subheading:
|
|
892
|
+
heading: c("auth.login_continue_purchase", "Log in to continue your purchase"),
|
|
893
|
+
subheading: c(
|
|
847
894
|
"auth.link_purchase_subheading",
|
|
848
895
|
"We'll link the purchase to your account to keep access."
|
|
849
896
|
),
|
|
@@ -851,14 +898,14 @@ function _t({
|
|
|
851
898
|
// purchase"), а не action verb. Длинные локализации (RU: "Войдите,
|
|
852
899
|
// чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
|
|
853
900
|
// переносятся на 2 строки. Явный короткий submit_label решает.
|
|
854
|
-
submit_label:
|
|
901
|
+
submit_label: c("auth.log_in", "Sign In")
|
|
855
902
|
} : r;
|
|
856
903
|
return /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
|
|
857
|
-
s ? /* @__PURE__ */ o(
|
|
904
|
+
s ? /* @__PURE__ */ o(Ct, { onClick: i, ariaLabel: c("nav.back_aria", "Back") }) : null,
|
|
858
905
|
/* @__PURE__ */ o(Me, { block: d, ctx: h })
|
|
859
906
|
] });
|
|
860
907
|
}
|
|
861
|
-
function
|
|
908
|
+
function Ct({ onClick: r, ariaLabel: e }) {
|
|
862
909
|
return /* @__PURE__ */ o(
|
|
863
910
|
"button",
|
|
864
911
|
{
|
|
@@ -902,7 +949,7 @@ function ne(r) {
|
|
|
902
949
|
expired: !1
|
|
903
950
|
};
|
|
904
951
|
}
|
|
905
|
-
function
|
|
952
|
+
function It(r) {
|
|
906
953
|
if (r.expires_at) {
|
|
907
954
|
const e = Date.parse(r.expires_at);
|
|
908
955
|
return Number.isFinite(e) ? e : null;
|
|
@@ -928,9 +975,9 @@ function Te(r, e) {
|
|
|
928
975
|
return r.find((t) => t.expires_at || t.duration_minutes) ?? null;
|
|
929
976
|
}
|
|
930
977
|
function Be(r) {
|
|
931
|
-
const e = r ?
|
|
978
|
+
const e = r ? It(r) : null, [t, n] = k(
|
|
932
979
|
() => e !== null ? ne(e) : null
|
|
933
|
-
), i =
|
|
980
|
+
), i = j(e);
|
|
934
981
|
return i.current = e, P(() => {
|
|
935
982
|
if (e === null) {
|
|
936
983
|
n(null);
|
|
@@ -948,7 +995,7 @@ function Be(r) {
|
|
|
948
995
|
return () => clearInterval(s);
|
|
949
996
|
}, [e, r?.duration_minutes, r?.id]), t;
|
|
950
997
|
}
|
|
951
|
-
function
|
|
998
|
+
function At({ block: r, ctx: e }) {
|
|
952
999
|
const { t } = S(), n = Te(e.bootstrap.offers, r.offer_id), i = Be(n);
|
|
953
1000
|
if (!n || i === null || i.expired && !r.force) return null;
|
|
954
1001
|
const s = r.title ?? n.label ?? t("offer.limited_time", "Limited-time offer"), a = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
|
|
@@ -986,7 +1033,7 @@ function Pe({ value: r, t: e }) {
|
|
|
986
1033
|
function H({ children: r }) {
|
|
987
1034
|
return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: r });
|
|
988
1035
|
}
|
|
989
|
-
function
|
|
1036
|
+
function Lt({ offer: r }) {
|
|
990
1037
|
const { t: e } = S(), t = Be(r);
|
|
991
1038
|
if (t === null || t.expired) return null;
|
|
992
1039
|
const n = r.label ?? e("offer.limited_time", "Limited-time offer"), i = r.discount_percent ? `${n} ${r.discount_percent}%` : n;
|
|
@@ -1026,22 +1073,22 @@ function Oe() {
|
|
|
1026
1073
|
}
|
|
1027
1074
|
);
|
|
1028
1075
|
}
|
|
1029
|
-
const me = 3, ye = 200, be = 5e3, ie = 5,
|
|
1030
|
-
function
|
|
1031
|
-
const { t: i } = S(), s = e?.user.email ?? "", a = s || null, [
|
|
1032
|
-
const T = {}, E = (a ??
|
|
1033
|
-
return E ?
|
|
1076
|
+
const me = 3, ye = 200, be = 5e3, ie = 5, Mt = 10 * 1024 * 1024, xe = ["image/jpeg", "image/png", "image/webp"], Et = /.+@.+\..+/;
|
|
1077
|
+
function Tt({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
1078
|
+
const { t: i } = S(), s = e?.user.email ?? "", a = s || null, [l, c] = k(s), [h, d] = k(""), [g, _] = k(""), [p, v] = k([]), [m, A] = k(!1), [b, y] = k(null), [C, I] = k({}), O = () => {
|
|
1079
|
+
const T = {}, E = (a ?? l).trim(), q = h.trim(), U = g.trim();
|
|
1080
|
+
return E ? Et.test(E.toLowerCase()) || (T.email = i("support.invalid_email", "Invalid email")) : T.email = i("support.required", "Required"), (q.length < me || q.length > ye) && (T.subject = i("support.subject_length", "{min}–{max} characters", {
|
|
1034
1081
|
min: me,
|
|
1035
1082
|
max: ye
|
|
1036
|
-
})), (
|
|
1083
|
+
})), (U.length < 1 || U.length > be) && (T.message = i("support.message_length", "{min}–{max} characters", {
|
|
1037
1084
|
min: 1,
|
|
1038
1085
|
max: be
|
|
1039
1086
|
})), I(T), Object.keys(T).length === 0;
|
|
1040
1087
|
}, M = async (T) => {
|
|
1041
|
-
if (T.preventDefault(), !m &&
|
|
1088
|
+
if (T.preventDefault(), !m && O()) {
|
|
1042
1089
|
A(!0), I((E) => ({ ...E, submit: void 0 }));
|
|
1043
1090
|
try {
|
|
1044
|
-
const E = (a ??
|
|
1091
|
+
const E = (a ?? l).trim();
|
|
1045
1092
|
await r.createSupportTicket({
|
|
1046
1093
|
subject: h.trim(),
|
|
1047
1094
|
content: g.trim(),
|
|
@@ -1049,15 +1096,15 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1049
1096
|
files: p.length > 0 ? p : void 0
|
|
1050
1097
|
}), y(E);
|
|
1051
1098
|
} catch (E) {
|
|
1052
|
-
const
|
|
1053
|
-
I((
|
|
1099
|
+
const q = E instanceof L && E.message || "Failed to send. Please try again.";
|
|
1100
|
+
I((U) => ({ ...U, submit: q }));
|
|
1054
1101
|
} finally {
|
|
1055
1102
|
A(!1);
|
|
1056
1103
|
}
|
|
1057
1104
|
}
|
|
1058
|
-
},
|
|
1105
|
+
}, R = () => {
|
|
1059
1106
|
d(""), _(""), v([]), I({}), y(null);
|
|
1060
|
-
},
|
|
1107
|
+
}, D = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", z = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
|
|
1061
1108
|
return b ? /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1062
1109
|
/* @__PURE__ */ u("div", { class: "flex-1 min-h-0 overflow-y-auto flex flex-col items-center gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8 text-center", children: [
|
|
1063
1110
|
/* @__PURE__ */ o(
|
|
@@ -1090,7 +1137,7 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1090
1137
|
"."
|
|
1091
1138
|
] })
|
|
1092
1139
|
] }),
|
|
1093
|
-
/* @__PURE__ */ o("div", { class:
|
|
1140
|
+
/* @__PURE__ */ o("div", { class: D, style: z, children: /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1094
1141
|
/* @__PURE__ */ o(
|
|
1095
1142
|
"button",
|
|
1096
1143
|
{
|
|
@@ -1104,7 +1151,7 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1104
1151
|
"button",
|
|
1105
1152
|
{
|
|
1106
1153
|
type: "button",
|
|
1107
|
-
onClick:
|
|
1154
|
+
onClick: R,
|
|
1108
1155
|
class: "flex h-10 items-center justify-center rounded-xl px-4 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1109
1156
|
style: {
|
|
1110
1157
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
@@ -1115,7 +1162,7 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1115
1162
|
)
|
|
1116
1163
|
] }) })
|
|
1117
1164
|
] }) : /* @__PURE__ */ u("form", { onSubmit: M, class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1118
|
-
/* @__PURE__ */ o(
|
|
1165
|
+
/* @__PURE__ */ o(Bt, { onClick: n, ariaLabel: i("nav.back_aria", "Back") }),
|
|
1119
1166
|
/* @__PURE__ */ o("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
|
|
1120
1167
|
/* @__PURE__ */ u("div", { class: "flex flex-col gap-2 pr-10", children: [
|
|
1121
1168
|
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
|
|
@@ -1131,8 +1178,8 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1131
1178
|
{
|
|
1132
1179
|
type: "email",
|
|
1133
1180
|
placeholder: i("support.email_placeholder", "Enter your email *"),
|
|
1134
|
-
value:
|
|
1135
|
-
onInput:
|
|
1181
|
+
value: l,
|
|
1182
|
+
onInput: c,
|
|
1136
1183
|
error: C.email,
|
|
1137
1184
|
autocomplete: "email",
|
|
1138
1185
|
required: !0
|
|
@@ -1150,7 +1197,7 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1150
1197
|
}
|
|
1151
1198
|
),
|
|
1152
1199
|
/* @__PURE__ */ o(
|
|
1153
|
-
|
|
1200
|
+
Pt,
|
|
1154
1201
|
{
|
|
1155
1202
|
placeholder: i("support.message_placeholder", "Enter your message *"),
|
|
1156
1203
|
value: g,
|
|
@@ -1159,10 +1206,10 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1159
1206
|
required: !0
|
|
1160
1207
|
}
|
|
1161
1208
|
),
|
|
1162
|
-
/* @__PURE__ */ o(
|
|
1209
|
+
/* @__PURE__ */ o(Ot, { files: p, onChange: v, disabled: m })
|
|
1163
1210
|
] })
|
|
1164
1211
|
] }) }),
|
|
1165
|
-
/* @__PURE__ */ u("div", { class:
|
|
1212
|
+
/* @__PURE__ */ u("div", { class: D, style: z, children: [
|
|
1166
1213
|
C.submit && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: C.submit }),
|
|
1167
1214
|
/* @__PURE__ */ u("div", { class: "flex items-center justify-end gap-3", children: [
|
|
1168
1215
|
/* @__PURE__ */ o(
|
|
@@ -1192,7 +1239,7 @@ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
|
1192
1239
|
] })
|
|
1193
1240
|
] });
|
|
1194
1241
|
}
|
|
1195
|
-
function
|
|
1242
|
+
function Bt({ onClick: r, ariaLabel: e }) {
|
|
1196
1243
|
return /* @__PURE__ */ o(
|
|
1197
1244
|
"button",
|
|
1198
1245
|
{
|
|
@@ -1241,7 +1288,7 @@ function we({
|
|
|
1241
1288
|
type: r,
|
|
1242
1289
|
value: t,
|
|
1243
1290
|
placeholder: e,
|
|
1244
|
-
onInput: (
|
|
1291
|
+
onInput: (l) => n(l.target.value),
|
|
1245
1292
|
autocomplete: s,
|
|
1246
1293
|
required: a,
|
|
1247
1294
|
class: `h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${i ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
|
|
@@ -1250,7 +1297,7 @@ function we({
|
|
|
1250
1297
|
i && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
|
|
1251
1298
|
] });
|
|
1252
1299
|
}
|
|
1253
|
-
function
|
|
1300
|
+
function Pt({
|
|
1254
1301
|
placeholder: r,
|
|
1255
1302
|
value: e,
|
|
1256
1303
|
onInput: t,
|
|
@@ -1272,20 +1319,20 @@ function Bt({
|
|
|
1272
1319
|
n && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
|
|
1273
1320
|
] });
|
|
1274
1321
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const { t: n } = S(), i =
|
|
1322
|
+
function Ot({ files: r, onChange: e, disabled: t }) {
|
|
1323
|
+
const { t: n } = S(), i = j(null), [s, a] = k(!1), [l, c] = k(null), h = (d) => {
|
|
1277
1324
|
if (!d || t) return;
|
|
1278
|
-
|
|
1325
|
+
c(null);
|
|
1279
1326
|
const g = Array.from(d);
|
|
1280
1327
|
if (r.length + g.length > ie) {
|
|
1281
|
-
|
|
1328
|
+
c(n("support.too_many_files", "Up to {max} files", { max: ie }));
|
|
1282
1329
|
return;
|
|
1283
1330
|
}
|
|
1284
1331
|
const _ = g.filter(
|
|
1285
|
-
(p) => xe.includes(p.type) && p.size <=
|
|
1332
|
+
(p) => xe.includes(p.type) && p.size <= Mt
|
|
1286
1333
|
);
|
|
1287
1334
|
if (_.length !== g.length) {
|
|
1288
|
-
|
|
1335
|
+
c(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
|
|
1289
1336
|
return;
|
|
1290
1337
|
}
|
|
1291
1338
|
e([...r, ..._]);
|
|
@@ -1328,7 +1375,7 @@ function Pt({ files: r, onChange: e, disabled: t }) {
|
|
|
1328
1375
|
}
|
|
1329
1376
|
}
|
|
1330
1377
|
),
|
|
1331
|
-
|
|
1378
|
+
l && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: l }),
|
|
1332
1379
|
r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((d, g) => /* @__PURE__ */ u(
|
|
1333
1380
|
"li",
|
|
1334
1381
|
{
|
|
@@ -1355,34 +1402,34 @@ function Pt({ files: r, onChange: e, disabled: t }) {
|
|
|
1355
1402
|
)) })
|
|
1356
1403
|
] });
|
|
1357
1404
|
}
|
|
1358
|
-
const
|
|
1405
|
+
const Ut = {
|
|
1359
1406
|
day: "cta.get_plan_daily",
|
|
1360
1407
|
week: "cta.get_plan_weekly",
|
|
1361
1408
|
month: "cta.get_plan_monthly",
|
|
1362
1409
|
year: "cta.get_plan_yearly"
|
|
1363
|
-
},
|
|
1410
|
+
}, jt = {
|
|
1364
1411
|
day: "Get Daily Plan",
|
|
1365
1412
|
week: "Get Weekly Plan",
|
|
1366
1413
|
month: "Get Monthly Plan",
|
|
1367
1414
|
year: "Get Yearly Plan"
|
|
1368
1415
|
};
|
|
1369
|
-
function
|
|
1416
|
+
function Rt(r, e, t, n) {
|
|
1370
1417
|
if (e === "close") return n("cta.close", "Close");
|
|
1371
1418
|
if (!r) return n("cta.continue", "Continue");
|
|
1372
1419
|
if (!t && r.trial_days && r.interval && r.interval !== "lifetime")
|
|
1373
1420
|
return n("cta.start_trial", "Start {days}-Day Free Trial", { days: r.trial_days });
|
|
1374
1421
|
if (!r.interval || r.interval === "lifetime")
|
|
1375
1422
|
return n("cta.get_lifetime_access", "Get Lifetime Access");
|
|
1376
|
-
const i =
|
|
1377
|
-
return i ? n(i,
|
|
1423
|
+
const i = Ut[r.interval];
|
|
1424
|
+
return i ? n(i, jt[r.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
|
|
1378
1425
|
interval: Dt(r.interval)
|
|
1379
1426
|
});
|
|
1380
1427
|
}
|
|
1381
1428
|
function Dt(r) {
|
|
1382
1429
|
return r.length ? r[0].toUpperCase() + r.slice(1) : r;
|
|
1383
1430
|
}
|
|
1384
|
-
function
|
|
1385
|
-
const { t } = S(), [n, i] = k(!1), s = r.priceId ?? e.selectedPriceId, a = n || r.action === "checkout" && !s,
|
|
1431
|
+
function zt({ block: r, ctx: e }) {
|
|
1432
|
+
const { t } = S(), [n, i] = k(!1), s = r.priceId ?? e.selectedPriceId, a = n || r.action === "checkout" && !s, l = s ? e.bootstrap.prices.find((g) => g.id === s) ?? null : null, c = e.bootstrap.user?.had_previous_trial ?? !1, h = r.label ?? Rt(l, r.action, c, t);
|
|
1386
1433
|
return /* @__PURE__ */ u(
|
|
1387
1434
|
"button",
|
|
1388
1435
|
{
|
|
@@ -1419,10 +1466,10 @@ function Rt({ block: r, ctx: e }) {
|
|
|
1419
1466
|
}
|
|
1420
1467
|
);
|
|
1421
1468
|
}
|
|
1422
|
-
function
|
|
1469
|
+
function qt({ ctx: r }) {
|
|
1423
1470
|
const { t: e } = S(), t = r.authSession, n = r.auth, [i, s] = k(!1), a = () => r.onAction("support");
|
|
1424
1471
|
if (t && !t.user.is_anonymous) {
|
|
1425
|
-
const
|
|
1472
|
+
const l = async () => {
|
|
1426
1473
|
if (!(!n || i)) {
|
|
1427
1474
|
s(!0);
|
|
1428
1475
|
try {
|
|
@@ -1440,7 +1487,7 @@ function zt({ ctx: r }) {
|
|
|
1440
1487
|
/* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: t.user.email })
|
|
1441
1488
|
] }),
|
|
1442
1489
|
/* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1443
|
-
/* @__PURE__ */ o(G, { onClick:
|
|
1490
|
+
/* @__PURE__ */ o(G, { onClick: l, disabled: !n || i, children: i ? e("session.signing_out", "Signing out…") : e("session.sign_out", "Sign Out") }),
|
|
1444
1491
|
/* @__PURE__ */ o(ke, {}),
|
|
1445
1492
|
/* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
|
|
1446
1493
|
] })
|
|
@@ -1472,7 +1519,7 @@ function G({
|
|
|
1472
1519
|
function ke() {
|
|
1473
1520
|
return /* @__PURE__ */ o("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
1474
1521
|
}
|
|
1475
|
-
function
|
|
1522
|
+
function Nt({ block: r }) {
|
|
1476
1523
|
return r.items.length ? /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2.5", role: "list", children: r.items.map((e) => /* @__PURE__ */ u("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
|
|
1477
1524
|
/* @__PURE__ */ o(
|
|
1478
1525
|
"svg",
|
|
@@ -1501,11 +1548,11 @@ function qt({ block: r }) {
|
|
|
1501
1548
|
] })
|
|
1502
1549
|
] }, e.id)) }) : null;
|
|
1503
1550
|
}
|
|
1504
|
-
function
|
|
1505
|
-
const { t: e } = S(), t = r.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = r.subtitle, i = (r.icon ?? "dollar_shield") !== "none", s =
|
|
1551
|
+
function Ft({ block: r }) {
|
|
1552
|
+
const { t: e } = S(), t = r.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = r.subtitle, i = (r.icon ?? "dollar_shield") !== "none", s = $t(t);
|
|
1506
1553
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-1.5 border-b-1 pb-4 mb-1 border-gray-100", children: [
|
|
1507
1554
|
/* @__PURE__ */ u("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
|
|
1508
|
-
i ? /* @__PURE__ */ o(
|
|
1555
|
+
i ? /* @__PURE__ */ o(Vt, {}) : null,
|
|
1509
1556
|
s ? /* @__PURE__ */ u("span", { children: [
|
|
1510
1557
|
/* @__PURE__ */ o("b", { class: "font-bold text-gray-900", children: s.bold }),
|
|
1511
1558
|
" ",
|
|
@@ -1515,11 +1562,11 @@ function Nt({ block: r }) {
|
|
|
1515
1562
|
n ? /* @__PURE__ */ o("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
|
|
1516
1563
|
] });
|
|
1517
1564
|
}
|
|
1518
|
-
function
|
|
1565
|
+
function $t(r) {
|
|
1519
1566
|
const e = r.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
|
|
1520
1567
|
return e ? { bold: e[1], rest: e[2] } : null;
|
|
1521
1568
|
}
|
|
1522
|
-
function
|
|
1569
|
+
function Vt() {
|
|
1523
1570
|
return /* @__PURE__ */ u(
|
|
1524
1571
|
"svg",
|
|
1525
1572
|
{
|
|
@@ -1554,22 +1601,22 @@ function $t() {
|
|
|
1554
1601
|
}
|
|
1555
1602
|
);
|
|
1556
1603
|
}
|
|
1557
|
-
const Ue = 24,
|
|
1558
|
-
function
|
|
1559
|
-
const t = e *
|
|
1604
|
+
const Ue = 24, Ht = 16, Gt = 2;
|
|
1605
|
+
function Wt(r, e) {
|
|
1606
|
+
const t = e * Gt;
|
|
1560
1607
|
let n = Ue;
|
|
1561
|
-
for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n >
|
|
1608
|
+
for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Ht; )
|
|
1562
1609
|
n -= 1, r.style.fontSize = `${n}px`;
|
|
1563
1610
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const t = r.level ?? 1, n = `h${t}`, i = t === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : t === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s =
|
|
1611
|
+
function Zt({ block: r, ctx: e }) {
|
|
1612
|
+
const t = r.level ?? 1, n = `h${t}`, i = t === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : t === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = j(null), a = t === 1 && !!e.bootstrap.settings.title_auto_fit;
|
|
1566
1613
|
return P(() => {
|
|
1567
1614
|
if (!a || !s.current) return;
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1615
|
+
const l = getComputedStyle(s.current), c = parseFloat(l.lineHeight) || Ue * 1.5;
|
|
1616
|
+
Wt(s.current, c);
|
|
1570
1617
|
}, [a, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
|
|
1571
1618
|
}
|
|
1572
|
-
function
|
|
1619
|
+
function Yt(r) {
|
|
1573
1620
|
const e = r.local ?? { currency: r.currency, amount: r.amount };
|
|
1574
1621
|
if (r.interval === "year") {
|
|
1575
1622
|
const t = (r.interval_count ?? 1) * 12;
|
|
@@ -1596,10 +1643,10 @@ function oe(r, e) {
|
|
|
1596
1643
|
}
|
|
1597
1644
|
}
|
|
1598
1645
|
function le(r, e) {
|
|
1599
|
-
const { amount: t, currency: n } =
|
|
1646
|
+
const { amount: t, currency: n } = Yt(r);
|
|
1600
1647
|
if (!e) {
|
|
1601
|
-
const { currency:
|
|
1602
|
-
return { currency:
|
|
1648
|
+
const { currency: l, amount: c } = oe(t, n);
|
|
1649
|
+
return { currency: l, amount: c, originalAmount: null };
|
|
1603
1650
|
}
|
|
1604
1651
|
const i = t * (1 - e / 100), s = oe(i, n), a = oe(t, n);
|
|
1605
1652
|
return {
|
|
@@ -1627,7 +1674,7 @@ function ce(r, e) {
|
|
|
1627
1674
|
const t = r.interval_count ?? 1;
|
|
1628
1675
|
return t === 1 ? e(`pricing.interval.${r.interval}`, r.interval) : `${t} ${r.interval}s`;
|
|
1629
1676
|
}
|
|
1630
|
-
function
|
|
1677
|
+
function Kt({ block: r, ctx: e }) {
|
|
1631
1678
|
const { t } = S(), n = r.priceIds && r.priceIds.length > 0 ? new Set(r.priceIds) : null, i = e.bootstrap.prices.filter((a) => !n || n.has(a.id));
|
|
1632
1679
|
if (i.length === 0)
|
|
1633
1680
|
return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("pricing.no_prices", "No prices available.") });
|
|
@@ -1639,11 +1686,11 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1639
1686
|
class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
|
|
1640
1687
|
role: "radiogroup",
|
|
1641
1688
|
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1642
|
-
children: i.map((a,
|
|
1643
|
-
|
|
1689
|
+
children: i.map((a, l) => /* @__PURE__ */ o(
|
|
1690
|
+
Jt,
|
|
1644
1691
|
{
|
|
1645
1692
|
price: a,
|
|
1646
|
-
isLast:
|
|
1693
|
+
isLast: l === i.length - 1,
|
|
1647
1694
|
isPopular: r.popular_price_id === a.id,
|
|
1648
1695
|
popularLabel: s,
|
|
1649
1696
|
offer: N(e.bootstrap.offers, a.id),
|
|
@@ -1658,8 +1705,8 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1658
1705
|
}
|
|
1659
1706
|
);
|
|
1660
1707
|
if (r.view === "horizontal") {
|
|
1661
|
-
const a = Math.min(i.length, 3),
|
|
1662
|
-
(
|
|
1708
|
+
const a = Math.min(i.length, 3), l = i.some(
|
|
1709
|
+
(c) => (N(e.bootstrap.offers, c.id)?.discount_percent ?? 0) > 0
|
|
1663
1710
|
);
|
|
1664
1711
|
return /* @__PURE__ */ o(
|
|
1665
1712
|
"div",
|
|
@@ -1668,21 +1715,21 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1668
1715
|
style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` },
|
|
1669
1716
|
role: "radiogroup",
|
|
1670
1717
|
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1671
|
-
children: i.map((
|
|
1672
|
-
|
|
1718
|
+
children: i.map((c) => /* @__PURE__ */ o(
|
|
1719
|
+
Qt,
|
|
1673
1720
|
{
|
|
1674
|
-
price:
|
|
1675
|
-
isPopular: r.popular_price_id ===
|
|
1721
|
+
price: c,
|
|
1722
|
+
isPopular: r.popular_price_id === c.id,
|
|
1676
1723
|
popularLabel: s,
|
|
1677
|
-
offer: N(e.bootstrap.offers,
|
|
1678
|
-
reserveStrikeRow:
|
|
1679
|
-
selected: e.selectedPriceId ===
|
|
1724
|
+
offer: N(e.bootstrap.offers, c.id),
|
|
1725
|
+
reserveStrikeRow: l,
|
|
1726
|
+
selected: e.selectedPriceId === c.id,
|
|
1680
1727
|
onSelect: () => {
|
|
1681
|
-
e.setSelectedPriceId(
|
|
1728
|
+
e.setSelectedPriceId(c.id), e.onAction("price_selected", { priceId: c.id, price: c });
|
|
1682
1729
|
},
|
|
1683
1730
|
t
|
|
1684
1731
|
},
|
|
1685
|
-
|
|
1732
|
+
c.id
|
|
1686
1733
|
))
|
|
1687
1734
|
}
|
|
1688
1735
|
);
|
|
@@ -1694,13 +1741,13 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1694
1741
|
role: "radiogroup",
|
|
1695
1742
|
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1696
1743
|
children: i.map((a) => {
|
|
1697
|
-
const
|
|
1744
|
+
const l = e.selectedPriceId === a.id, c = r.popular_price_id === a.id, d = N(e.bootstrap.offers, a.id)?.discount_percent ?? null, { currency: g, amount: _, originalAmount: p } = le(a, d);
|
|
1698
1745
|
return /* @__PURE__ */ u(
|
|
1699
1746
|
"button",
|
|
1700
1747
|
{
|
|
1701
1748
|
type: "button",
|
|
1702
1749
|
role: "radio",
|
|
1703
|
-
"aria-checked":
|
|
1750
|
+
"aria-checked": l,
|
|
1704
1751
|
onClick: () => {
|
|
1705
1752
|
e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
|
|
1706
1753
|
},
|
|
@@ -1709,7 +1756,7 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1709
1756
|
// Везде border 2px — selection выражается только цветом, layout
|
|
1710
1757
|
// не прыгает (равная толщина у selected/unselected). Цветовая
|
|
1711
1758
|
// разница accent vs gray достаточно сильная для visual hierarchy.
|
|
1712
|
-
|
|
1759
|
+
l ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
|
|
1713
1760
|
].join(" "),
|
|
1714
1761
|
children: [
|
|
1715
1762
|
/* @__PURE__ */ o(
|
|
@@ -1717,14 +1764,14 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1717
1764
|
{
|
|
1718
1765
|
class: [
|
|
1719
1766
|
"flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
1720
|
-
|
|
1767
|
+
l ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
|
|
1721
1768
|
// Popular-label badge сидит absolute сверху-справа карточки и
|
|
1722
1769
|
// визуально сдвигает центр content'а вниз. flex items-center
|
|
1723
1770
|
// на карточке держит галочку по геометрическому центру, что
|
|
1724
1771
|
// делает её визуально выше — компенсируем небольшим mt'ом.
|
|
1725
|
-
|
|
1772
|
+
c ? "mt-3" : ""
|
|
1726
1773
|
].join(" "),
|
|
1727
|
-
style:
|
|
1774
|
+
style: l ? {
|
|
1728
1775
|
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
|
|
1729
1776
|
} : void 0,
|
|
1730
1777
|
"aria-hidden": "true",
|
|
@@ -1736,7 +1783,7 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1736
1783
|
viewBox: "0 0 17 12",
|
|
1737
1784
|
fill: "none",
|
|
1738
1785
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1739
|
-
class:
|
|
1786
|
+
class: l ? "opacity-100" : "opacity-0",
|
|
1740
1787
|
children: /* @__PURE__ */ o(
|
|
1741
1788
|
"path",
|
|
1742
1789
|
{
|
|
@@ -1778,7 +1825,7 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1778
1825
|
] }) }),
|
|
1779
1826
|
a.description ? /* @__PURE__ */ o("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: a.description }) : null
|
|
1780
1827
|
] }),
|
|
1781
|
-
|
|
1828
|
+
c ? /* @__PURE__ */ o(
|
|
1782
1829
|
"span",
|
|
1783
1830
|
{
|
|
1784
1831
|
class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
|
|
@@ -1794,10 +1841,10 @@ function Yt({ block: r, ctx: e }) {
|
|
|
1794
1841
|
}
|
|
1795
1842
|
);
|
|
1796
1843
|
}
|
|
1797
|
-
function
|
|
1844
|
+
function Xt(r, e) {
|
|
1798
1845
|
return r.label ? r.label : !r.interval || r.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${r.interval}`, r.interval);
|
|
1799
1846
|
}
|
|
1800
|
-
function
|
|
1847
|
+
function Jt({
|
|
1801
1848
|
price: r,
|
|
1802
1849
|
isLast: e,
|
|
1803
1850
|
isPopular: t,
|
|
@@ -1805,9 +1852,9 @@ function Xt({
|
|
|
1805
1852
|
offer: i,
|
|
1806
1853
|
selected: s,
|
|
1807
1854
|
onSelect: a,
|
|
1808
|
-
t:
|
|
1855
|
+
t: l
|
|
1809
1856
|
}) {
|
|
1810
|
-
const
|
|
1857
|
+
const c = i?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, c);
|
|
1811
1858
|
return /* @__PURE__ */ u(
|
|
1812
1859
|
"button",
|
|
1813
1860
|
{
|
|
@@ -1857,7 +1904,7 @@ function Xt({
|
|
|
1857
1904
|
].join(" "),
|
|
1858
1905
|
children: [
|
|
1859
1906
|
/* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-1 gap-x-1.5", children: [
|
|
1860
|
-
/* @__PURE__ */ o("span", { class: "text-base font-normal capitalize text-gray-800", children:
|
|
1907
|
+
/* @__PURE__ */ o("span", { class: "text-base font-normal capitalize text-gray-800", children: Xt(r, l) }),
|
|
1861
1908
|
t ? (
|
|
1862
1909
|
// Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
|
|
1863
1910
|
// Низкий visual weight: pill про "имя плана" (most popular), а не
|
|
@@ -1874,9 +1921,9 @@ function Xt({
|
|
|
1874
1921
|
}
|
|
1875
1922
|
)
|
|
1876
1923
|
) : null,
|
|
1877
|
-
|
|
1924
|
+
c ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
1878
1925
|
"-",
|
|
1879
|
-
|
|
1926
|
+
c,
|
|
1880
1927
|
"%"
|
|
1881
1928
|
] }) : null
|
|
1882
1929
|
] }),
|
|
@@ -1889,7 +1936,7 @@ function Xt({
|
|
|
1889
1936
|
/* @__PURE__ */ u("span", { class: "text-xs text-gray-400", children: [
|
|
1890
1937
|
" ",
|
|
1891
1938
|
"/ ",
|
|
1892
|
-
ce(r,
|
|
1939
|
+
ce(r, l)
|
|
1893
1940
|
] })
|
|
1894
1941
|
] })
|
|
1895
1942
|
] })
|
|
@@ -1900,7 +1947,7 @@ function Xt({
|
|
|
1900
1947
|
}
|
|
1901
1948
|
);
|
|
1902
1949
|
}
|
|
1903
|
-
function
|
|
1950
|
+
function Qt({
|
|
1904
1951
|
price: r,
|
|
1905
1952
|
isPopular: e,
|
|
1906
1953
|
popularLabel: t,
|
|
@@ -1908,9 +1955,9 @@ function Jt({
|
|
|
1908
1955
|
reserveStrikeRow: i,
|
|
1909
1956
|
selected: s,
|
|
1910
1957
|
onSelect: a,
|
|
1911
|
-
t:
|
|
1958
|
+
t: l
|
|
1912
1959
|
}) {
|
|
1913
|
-
const
|
|
1960
|
+
const c = n?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, c);
|
|
1914
1961
|
return /* @__PURE__ */ u(
|
|
1915
1962
|
"button",
|
|
1916
1963
|
{
|
|
@@ -1924,12 +1971,12 @@ function Jt({
|
|
|
1924
1971
|
].join(" "),
|
|
1925
1972
|
style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
|
|
1926
1973
|
children: [
|
|
1927
|
-
/* @__PURE__ */ o("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: je(r,
|
|
1974
|
+
/* @__PURE__ */ o("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: je(r, l) }),
|
|
1928
1975
|
i ? /* @__PURE__ */ u("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
|
|
1929
1976
|
g ? /* @__PURE__ */ o("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
|
|
1930
|
-
|
|
1977
|
+
c ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
|
|
1931
1978
|
"-",
|
|
1932
|
-
|
|
1979
|
+
c,
|
|
1933
1980
|
"%"
|
|
1934
1981
|
] }) : null
|
|
1935
1982
|
] }) : null,
|
|
@@ -1939,7 +1986,7 @@ function Jt({
|
|
|
1939
1986
|
] }),
|
|
1940
1987
|
/* @__PURE__ */ u("span", { class: "text-xs font-normal text-gray-500", children: [
|
|
1941
1988
|
"/ ",
|
|
1942
|
-
ce(r,
|
|
1989
|
+
ce(r, l)
|
|
1943
1990
|
] }),
|
|
1944
1991
|
e ? /* @__PURE__ */ o(
|
|
1945
1992
|
"span",
|
|
@@ -1953,27 +2000,27 @@ function Jt({
|
|
|
1953
2000
|
}
|
|
1954
2001
|
);
|
|
1955
2002
|
}
|
|
1956
|
-
function
|
|
2003
|
+
function er({ block: r }) {
|
|
1957
2004
|
return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: r.text });
|
|
1958
2005
|
}
|
|
1959
|
-
const
|
|
2006
|
+
const tr = {
|
|
1960
2007
|
week: 0.25,
|
|
1961
2008
|
month: 1,
|
|
1962
2009
|
year: 12
|
|
1963
2010
|
};
|
|
1964
|
-
function
|
|
2011
|
+
function rr(r, e) {
|
|
1965
2012
|
return r ? e(`pricing.interval.${r}`, r) : e("pricing.interval.period", "period");
|
|
1966
2013
|
}
|
|
1967
|
-
function
|
|
2014
|
+
function nr({ block: r, ctx: e }) {
|
|
1968
2015
|
const { t } = S();
|
|
1969
2016
|
if (!r.queries.length) return null;
|
|
1970
|
-
const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ?
|
|
2017
|
+
const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ? tr[i] : void 0;
|
|
1971
2018
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
1972
2019
|
/* @__PURE__ */ o("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ? t("pricing.included_total", "Included for lifetime:") : t("pricing.included_per", "Included per {interval}:", {
|
|
1973
|
-
interval:
|
|
2020
|
+
interval: rr(i, t)
|
|
1974
2021
|
}) }),
|
|
1975
2022
|
/* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((a) => {
|
|
1976
|
-
const
|
|
2023
|
+
const l = Number.isFinite(a.count) ? a.count : 0, c = s !== void 0 ? Math.round(l * s) : l;
|
|
1977
2024
|
return /* @__PURE__ */ u("li", { class: `flex gap-3 ${a.desc ? "items-start" : "items-center"}`, children: [
|
|
1978
2025
|
/* @__PURE__ */ o(
|
|
1979
2026
|
"svg",
|
|
@@ -1997,7 +2044,7 @@ function rr({ block: r, ctx: e }) {
|
|
|
1997
2044
|
}
|
|
1998
2045
|
),
|
|
1999
2046
|
/* @__PURE__ */ u("div", { children: [
|
|
2000
|
-
/* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children:
|
|
2047
|
+
/* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: c }),
|
|
2001
2048
|
" ",
|
|
2002
2049
|
/* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: a.name }),
|
|
2003
2050
|
a.desc ? /* @__PURE__ */ u(ae, { children: [
|
|
@@ -2009,33 +2056,33 @@ function rr({ block: r, ctx: e }) {
|
|
|
2009
2056
|
}) })
|
|
2010
2057
|
] });
|
|
2011
2058
|
}
|
|
2012
|
-
const
|
|
2013
|
-
heading:
|
|
2014
|
-
text:
|
|
2015
|
-
price_grid:
|
|
2016
|
-
cta_button:
|
|
2059
|
+
const ir = {
|
|
2060
|
+
heading: Zt,
|
|
2061
|
+
text: er,
|
|
2062
|
+
price_grid: Kt,
|
|
2063
|
+
cta_button: zt,
|
|
2017
2064
|
auth_panel: Me,
|
|
2018
|
-
current_session:
|
|
2019
|
-
features_list:
|
|
2020
|
-
tokenization_gate:
|
|
2021
|
-
guarantee_badge:
|
|
2022
|
-
offer_banner:
|
|
2065
|
+
current_session: qt,
|
|
2066
|
+
features_list: Nt,
|
|
2067
|
+
tokenization_gate: nr,
|
|
2068
|
+
guarantee_badge: Ft,
|
|
2069
|
+
offer_banner: At
|
|
2023
2070
|
};
|
|
2024
|
-
function
|
|
2071
|
+
function or({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i, hasTopBanner: s }) {
|
|
2025
2072
|
const a = Ge(() => {
|
|
2026
2073
|
for (const v of r.blocks)
|
|
2027
2074
|
if (v.type === "price_grid" && v.popular_price_id && e.prices.some((m) => m.id === v.popular_price_id))
|
|
2028
2075
|
return v.popular_price_id;
|
|
2029
2076
|
return e.prices[0]?.id ?? null;
|
|
2030
|
-
}, [r.blocks, e.prices]), [
|
|
2077
|
+
}, [r.blocks, e.prices]), [l, c] = k(a), h = {
|
|
2031
2078
|
bootstrap: e,
|
|
2032
|
-
selectedPriceId:
|
|
2033
|
-
setSelectedPriceId:
|
|
2079
|
+
selectedPriceId: l,
|
|
2080
|
+
setSelectedPriceId: c,
|
|
2034
2081
|
onAction: t,
|
|
2035
2082
|
auth: n,
|
|
2036
2083
|
authSession: i
|
|
2037
2084
|
}, d = r.blocks.findIndex((v) => v.type === "cta_button"), g = d === -1 ? r.blocks : r.blocks.slice(0, d), _ = d === -1 ? [] : r.blocks.slice(d), p = (v, m) => {
|
|
2038
|
-
const A =
|
|
2085
|
+
const A = ir[v.type];
|
|
2039
2086
|
return A ? /* @__PURE__ */ o(A, { block: v, ctx: h }, `${v.type}-${m}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${v.type}`), null);
|
|
2040
2087
|
};
|
|
2041
2088
|
return /* @__PURE__ */ u(ae, { children: [
|
|
@@ -2055,13 +2102,13 @@ function ir({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i, has
|
|
|
2055
2102
|
) : null
|
|
2056
2103
|
] });
|
|
2057
2104
|
}
|
|
2058
|
-
function
|
|
2105
|
+
function sr(r, e, t, n) {
|
|
2059
2106
|
return r ? n ? { open: !0, view: "purchased", error: null, processing: !1 } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null, processing: !1 } : e.status === "error" ? { open: !0, view: "error", error: e.error, processing: !1 } : t.kind === "support" ? { open: !0, view: "support", error: null, processing: !1 } : t.kind === "auth_gate" ? { open: !0, view: "auth", error: null, processing: !1 } : t.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null, processing: !1 } : t.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null, processing: !1 } : t.kind === "purchase_success" ? { open: !0, view: "purchased", error: null, processing: !1 } : t.kind === "verifying" ? { open: !0, view: "loading", error: null, processing: !1 } : { open: !0, view: "layout", error: null, processing: !1 } : { open: !1, view: null, error: null, processing: !1 };
|
|
2060
2107
|
}
|
|
2061
|
-
function
|
|
2108
|
+
function ar(r, e) {
|
|
2062
2109
|
return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
|
|
2063
2110
|
}
|
|
2064
|
-
function
|
|
2111
|
+
function lr({
|
|
2065
2112
|
client: r,
|
|
2066
2113
|
open: e,
|
|
2067
2114
|
onClose: t,
|
|
@@ -2069,8 +2116,8 @@ function ar({
|
|
|
2069
2116
|
initialView: i,
|
|
2070
2117
|
initialAuthMode: s,
|
|
2071
2118
|
initialCheckoutPriceId: a,
|
|
2072
|
-
initialCheckoutUrl:
|
|
2073
|
-
purchased:
|
|
2119
|
+
initialCheckoutUrl: l,
|
|
2120
|
+
purchased: c,
|
|
2074
2121
|
renew: h,
|
|
2075
2122
|
onState: d,
|
|
2076
2123
|
inline: g,
|
|
@@ -2083,20 +2130,20 @@ function ar({
|
|
|
2083
2130
|
pendingCheckout: { priceId: a, direct: !0 },
|
|
2084
2131
|
origin: "standalone",
|
|
2085
2132
|
intent: "preauth"
|
|
2086
|
-
} : { kind: "auth_gate", origin: "standalone" } : i === "awaiting_payment" && a &&
|
|
2133
|
+
} : { kind: "auth_gate", origin: "standalone" } : i === "awaiting_payment" && a && l ? {
|
|
2087
2134
|
kind: "awaiting_payment",
|
|
2088
2135
|
priceId: a,
|
|
2089
|
-
url:
|
|
2090
|
-
} : i === "popup_blocked" && a &&
|
|
2136
|
+
url: l
|
|
2137
|
+
} : i === "popup_blocked" && a && l ? {
|
|
2091
2138
|
kind: "popup_blocked",
|
|
2092
2139
|
priceId: a,
|
|
2093
|
-
url:
|
|
2094
|
-
} : { kind: "layout" }), C = i === "awaiting_payment" || i === "popup_blocked" || i === "auth" && !!a, I =
|
|
2140
|
+
url: l
|
|
2141
|
+
} : { kind: "layout" }), C = i === "awaiting_payment" || i === "popup_blocked" || i === "auth" && !!a, I = j(!1), O = j(null);
|
|
2095
2142
|
P(() => {
|
|
2096
2143
|
if (!d) return;
|
|
2097
|
-
const x =
|
|
2098
|
-
f &&
|
|
2099
|
-
}, [e, p, b,
|
|
2144
|
+
const x = sr(e, p, b, c), f = O.current;
|
|
2145
|
+
f && ar(f, x) || (O.current = x, d(x));
|
|
2146
|
+
}, [e, p, b, c, d]), P(() => {
|
|
2100
2147
|
if (r.auth)
|
|
2101
2148
|
return r.auth.onAuthChange((x, f) => A(f));
|
|
2102
2149
|
}, [r.auth]), P(() => {
|
|
@@ -2135,16 +2182,16 @@ function ar({
|
|
|
2135
2182
|
pendingCheckout: { priceId: a, direct: !0 },
|
|
2136
2183
|
origin: "standalone",
|
|
2137
2184
|
intent: "preauth"
|
|
2138
|
-
} : { kind: "auth_gate", origin: "standalone" }) : i === "awaiting_payment" && a &&
|
|
2185
|
+
} : { kind: "auth_gate", origin: "standalone" }) : i === "awaiting_payment" && a && l ? y({
|
|
2139
2186
|
kind: "awaiting_payment",
|
|
2140
2187
|
priceId: a,
|
|
2141
|
-
url:
|
|
2142
|
-
}) : i === "popup_blocked" && a &&
|
|
2188
|
+
url: l
|
|
2189
|
+
}) : i === "popup_blocked" && a && l && y({
|
|
2143
2190
|
kind: "popup_blocked",
|
|
2144
2191
|
priceId: a,
|
|
2145
|
-
url:
|
|
2192
|
+
url: l
|
|
2146
2193
|
});
|
|
2147
|
-
}, [e, i, a,
|
|
2194
|
+
}, [e, i, a, l]);
|
|
2148
2195
|
const M = async (x) => {
|
|
2149
2196
|
try {
|
|
2150
2197
|
const f = r.getCachedOffers?.() ?? null, w = f ? N(f, x) : null, B = await r.createCheckout({
|
|
@@ -2174,7 +2221,7 @@ function ar({
|
|
|
2174
2221
|
const w = f instanceof L ? f : new L("checkout_failed", "Checkout failed", { cause: f });
|
|
2175
2222
|
n("error", w), C ? t() : y({ kind: "layout" });
|
|
2176
2223
|
}
|
|
2177
|
-
},
|
|
2224
|
+
}, R = (x, f) => {
|
|
2178
2225
|
if (typeof window > "u") return;
|
|
2179
2226
|
const w = window.open(f, "_blank");
|
|
2180
2227
|
if (w) {
|
|
@@ -2211,7 +2258,7 @@ function ar({
|
|
|
2211
2258
|
I.current = !1;
|
|
2212
2259
|
});
|
|
2213
2260
|
}, [m, b]);
|
|
2214
|
-
const
|
|
2261
|
+
const D = async (x, f) => {
|
|
2215
2262
|
if (x === "close") {
|
|
2216
2263
|
t();
|
|
2217
2264
|
return;
|
|
@@ -2237,14 +2284,14 @@ function ar({
|
|
|
2237
2284
|
n("error", new L("no_price", "No price selected"));
|
|
2238
2285
|
return;
|
|
2239
2286
|
}
|
|
2240
|
-
const B = p.data.settings.checkout_mode ?? "guest", $ = r.auth?.getCachedSession() ?? null,
|
|
2241
|
-
if (B === "preauth" && !!r.auth && !
|
|
2287
|
+
const B = p.data.settings.checkout_mode ?? "guest", $ = r.auth?.getCachedSession() ?? null, Re = !!$ && !$.user.is_anonymous;
|
|
2288
|
+
if (B === "preauth" && !!r.auth && !Re) {
|
|
2242
2289
|
y({ kind: "auth_gate", pendingCheckout: { priceId: w } });
|
|
2243
2290
|
return;
|
|
2244
2291
|
}
|
|
2245
2292
|
await M(w);
|
|
2246
2293
|
}
|
|
2247
|
-
},
|
|
2294
|
+
}, z = p.status === "ready" ? p.data.settings.brand_color : null, T = p.status === "ready" ? p.data.settings.allow_close !== !1 : !0, q = b.kind === "layout" && p.status === "ready" ? Te(p.data.offers) : null, U = q ? /* @__PURE__ */ o(Lt, { offer: q }) : null, Y = {
|
|
2248
2295
|
type: "auth_panel",
|
|
2249
2296
|
// Заголовок не задаём — AuthGate сам решит по intent'у (restore →
|
|
2250
2297
|
// "Restore Purchases", остальные → дефолтный "Welcome back!").
|
|
@@ -2255,7 +2302,7 @@ function ar({
|
|
|
2255
2302
|
hide_when_authenticated: !1,
|
|
2256
2303
|
providers: p.status === "ready" ? p.data.settings.auth_providers : void 0
|
|
2257
2304
|
}, V = b.kind === "support" ? /* @__PURE__ */ o(
|
|
2258
|
-
|
|
2305
|
+
Tt,
|
|
2259
2306
|
{
|
|
2260
2307
|
client: r,
|
|
2261
2308
|
authSession: m,
|
|
@@ -2270,14 +2317,14 @@ function ar({
|
|
|
2270
2317
|
{
|
|
2271
2318
|
open: e,
|
|
2272
2319
|
onClose: t,
|
|
2273
|
-
brandColor:
|
|
2274
|
-
topBanner:
|
|
2320
|
+
brandColor: z,
|
|
2321
|
+
topBanner: U,
|
|
2275
2322
|
allowClose: T,
|
|
2276
2323
|
hideCloseButton: K,
|
|
2277
2324
|
inline: g,
|
|
2278
2325
|
labelledBy: "pw-title",
|
|
2279
|
-
children:
|
|
2280
|
-
|
|
2326
|
+
children: c ? /* @__PURE__ */ o(ve, { onContinue: t }) : b.kind === "purchase_success" ? /* @__PURE__ */ o(ve, { restored: b.restored, onContinue: t }) : V || (p.status === "loading" || p.status === "idle" || b.kind === "verifying" ? /* @__PURE__ */ o(cr, { verifying: b.kind === "verifying" }) : p.status === "error" ? /* @__PURE__ */ o(ur, { message: p.error.message }) : b.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
|
|
2327
|
+
St,
|
|
2281
2328
|
{
|
|
2282
2329
|
block: Y,
|
|
2283
2330
|
bootstrap: p.data,
|
|
@@ -2291,7 +2338,7 @@ function ar({
|
|
|
2291
2338
|
}
|
|
2292
2339
|
}
|
|
2293
2340
|
) : b.kind === "awaiting_payment" ? /* @__PURE__ */ o(
|
|
2294
|
-
|
|
2341
|
+
hr,
|
|
2295
2342
|
{
|
|
2296
2343
|
client: r,
|
|
2297
2344
|
onBack: () => y({ kind: "layout" }),
|
|
@@ -2306,12 +2353,12 @@ function ar({
|
|
|
2306
2353
|
},
|
|
2307
2354
|
onRetry: () => M(b.priceId)
|
|
2308
2355
|
}
|
|
2309
|
-
) : b.kind === "popup_blocked" ? /* @__PURE__ */ o(
|
|
2310
|
-
|
|
2356
|
+
) : b.kind === "popup_blocked" ? /* @__PURE__ */ o(dr, { onReopen: () => R(b.priceId, b.url) }) : /* @__PURE__ */ o(
|
|
2357
|
+
or,
|
|
2311
2358
|
{
|
|
2312
2359
|
layout: p.data.layout,
|
|
2313
2360
|
bootstrap: p.data,
|
|
2314
|
-
onAction:
|
|
2361
|
+
onAction: D,
|
|
2315
2362
|
auth: r.auth,
|
|
2316
2363
|
authSession: m
|
|
2317
2364
|
}
|
|
@@ -2319,14 +2366,14 @@ function ar({
|
|
|
2319
2366
|
}
|
|
2320
2367
|
) });
|
|
2321
2368
|
}
|
|
2322
|
-
function
|
|
2369
|
+
function cr({ verifying: r }) {
|
|
2323
2370
|
const { t: e } = S();
|
|
2324
2371
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
2325
2372
|
/* @__PURE__ */ o("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
|
|
2326
2373
|
/* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: r ? e("modal.verifying_subscription", "Checking your subscription…") : e("modal.loading", "Loading…") })
|
|
2327
2374
|
] });
|
|
2328
2375
|
}
|
|
2329
|
-
function
|
|
2376
|
+
function ur({ message: r }) {
|
|
2330
2377
|
const { t: e } = S();
|
|
2331
2378
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2332
2379
|
/* @__PURE__ */ o("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
@@ -2337,7 +2384,7 @@ function cr({ message: r }) {
|
|
|
2337
2384
|
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: r })
|
|
2338
2385
|
] });
|
|
2339
2386
|
}
|
|
2340
|
-
function
|
|
2387
|
+
function dr({ onReopen: r }) {
|
|
2341
2388
|
const { t: e } = S();
|
|
2342
2389
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2343
2390
|
/* @__PURE__ */ o(
|
|
@@ -2404,29 +2451,29 @@ function ur({ onReopen: r }) {
|
|
|
2404
2451
|
)
|
|
2405
2452
|
] });
|
|
2406
2453
|
}
|
|
2407
|
-
function
|
|
2454
|
+
function hr({
|
|
2408
2455
|
client: r,
|
|
2409
2456
|
onBack: e,
|
|
2410
2457
|
onReopen: t,
|
|
2411
2458
|
onRetry: n
|
|
2412
2459
|
}) {
|
|
2413
|
-
const { t: i } = S(), [s, a] = k(!1), [
|
|
2460
|
+
const { t: i } = S(), [s, a] = k(!1), [l, c] = k(!1), h = j(null);
|
|
2414
2461
|
P(() => () => {
|
|
2415
2462
|
h.current !== null && clearTimeout(h.current);
|
|
2416
2463
|
}, []);
|
|
2417
2464
|
const d = async () => {
|
|
2418
2465
|
if (!s) {
|
|
2419
|
-
a(!0),
|
|
2466
|
+
a(!0), c(!1);
|
|
2420
2467
|
try {
|
|
2421
2468
|
if ((await r.getUser({ force: !0 })).has_active_subscription) {
|
|
2422
2469
|
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
2423
2470
|
return;
|
|
2424
2471
|
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2472
|
+
c(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
2473
|
+
c(!1), h.current = null;
|
|
2427
2474
|
}, 5e3);
|
|
2428
2475
|
} catch {
|
|
2429
|
-
|
|
2476
|
+
c(!0);
|
|
2430
2477
|
} finally {
|
|
2431
2478
|
a(!1);
|
|
2432
2479
|
}
|
|
@@ -2480,7 +2527,7 @@ function dr({
|
|
|
2480
2527
|
children: s ? i("payment.checking", "Checking…") : i("payment.ive_paid", "I've paid")
|
|
2481
2528
|
}
|
|
2482
2529
|
),
|
|
2483
|
-
|
|
2530
|
+
l ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: i("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
|
|
2484
2531
|
] }),
|
|
2485
2532
|
/* @__PURE__ */ u("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
|
|
2486
2533
|
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: i("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
|
|
@@ -2554,17 +2601,17 @@ function ve({
|
|
|
2554
2601
|
)
|
|
2555
2602
|
] });
|
|
2556
2603
|
}
|
|
2557
|
-
const
|
|
2558
|
-
class
|
|
2604
|
+
const pr = 10 * 6e4, fr = 5e3, gr = 3e4;
|
|
2605
|
+
class mr {
|
|
2559
2606
|
constructor(e) {
|
|
2560
2607
|
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
2561
2608
|
client: e.client,
|
|
2562
2609
|
onActive: e.onActive,
|
|
2563
2610
|
onTimeout: e.onTimeout ?? (() => {
|
|
2564
2611
|
}),
|
|
2565
|
-
timeoutMs: e.timeoutMs ??
|
|
2566
|
-
visibleIntervalMs: e.visibleIntervalMs ??
|
|
2567
|
-
hiddenIntervalMs: e.hiddenIntervalMs ??
|
|
2612
|
+
timeoutMs: e.timeoutMs ?? pr,
|
|
2613
|
+
visibleIntervalMs: e.visibleIntervalMs ?? fr,
|
|
2614
|
+
hiddenIntervalMs: e.hiddenIntervalMs ?? gr
|
|
2568
2615
|
};
|
|
2569
2616
|
}
|
|
2570
2617
|
start() {
|
|
@@ -2603,7 +2650,7 @@ class gr {
|
|
|
2603
2650
|
!t || typeof t != "object" || t.type === "paywall_purchase" && this.check();
|
|
2604
2651
|
}
|
|
2605
2652
|
}
|
|
2606
|
-
function
|
|
2653
|
+
function yr() {
|
|
2607
2654
|
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
2608
2655
|
}
|
|
2609
2656
|
const se = {
|
|
@@ -2616,11 +2663,11 @@ const se = {
|
|
|
2616
2663
|
priceId: "paywall_price_id",
|
|
2617
2664
|
sessionId: "paywall_session_id"
|
|
2618
2665
|
};
|
|
2619
|
-
let
|
|
2666
|
+
let br = class {
|
|
2620
2667
|
constructor(e) {
|
|
2621
2668
|
this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = se, this.stateListeners = /* @__PURE__ */ new Set();
|
|
2622
|
-
const { auth: t, ownsAuth: n } =
|
|
2623
|
-
this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new
|
|
2669
|
+
const { auth: t, ownsAuth: n } = xr(e);
|
|
2670
|
+
this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new De({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.inline = e.inline === !0, this.forceLocale = e.locale ?? null, this.userUnsub = this.billing.onUserChange((i) => {
|
|
2624
2671
|
this.emit("userChange", i);
|
|
2625
2672
|
}), this.auth && (this.authUnsub = this.auth.onAuthChange((i, s) => {
|
|
2626
2673
|
this.emit("authChange", { event: i, session: s });
|
|
@@ -2887,26 +2934,26 @@ let yr = class {
|
|
|
2887
2934
|
const a = () => {
|
|
2888
2935
|
this.applyProcessing(!1);
|
|
2889
2936
|
};
|
|
2890
|
-
let
|
|
2937
|
+
let l;
|
|
2891
2938
|
try {
|
|
2892
|
-
|
|
2939
|
+
l = await this.billing.bootstrap();
|
|
2893
2940
|
} catch (m) {
|
|
2894
2941
|
const A = m instanceof L ? m : new L("unknown", "Failed to load paywall", { cause: m });
|
|
2895
2942
|
this.emit("error", A), a();
|
|
2896
2943
|
return;
|
|
2897
2944
|
}
|
|
2898
2945
|
if (!s) {
|
|
2899
|
-
const m =
|
|
2946
|
+
const m = l.settings.visibility;
|
|
2900
2947
|
if (m && (this.lastVisibility = m, !m.visible)) {
|
|
2901
2948
|
this.emit("visibility_blocked", m), a();
|
|
2902
2949
|
return;
|
|
2903
2950
|
}
|
|
2904
2951
|
}
|
|
2905
|
-
if (!i && await this.checkTrialBeforeCheckout(
|
|
2952
|
+
if (!i && await this.checkTrialBeforeCheckout(l)) {
|
|
2906
2953
|
a();
|
|
2907
2954
|
return;
|
|
2908
2955
|
}
|
|
2909
|
-
if (!n &&
|
|
2956
|
+
if (!n && l.user?.has_active_subscription) {
|
|
2910
2957
|
this.emit("purchase_completed", {
|
|
2911
2958
|
priceId: e,
|
|
2912
2959
|
sessionId: null,
|
|
@@ -2914,8 +2961,8 @@ let yr = class {
|
|
|
2914
2961
|
}), a();
|
|
2915
2962
|
return;
|
|
2916
2963
|
}
|
|
2917
|
-
const
|
|
2918
|
-
if (
|
|
2964
|
+
const c = l.settings.checkout_mode ?? "guest", h = this.auth?.getCachedSession() ?? null, d = !!h && !h.user.is_anonymous;
|
|
2965
|
+
if (c === "preauth" && !!this.auth && !d) {
|
|
2919
2966
|
this.purchased = !1, this.mountAndShow("auth", {
|
|
2920
2967
|
renew: n,
|
|
2921
2968
|
authMode: "signin",
|
|
@@ -3032,12 +3079,12 @@ let yr = class {
|
|
|
3032
3079
|
return;
|
|
3033
3080
|
}
|
|
3034
3081
|
if (this.mountThenLoad) {
|
|
3035
|
-
this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((
|
|
3082
|
+
this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((l) => this.runDelayedGates(l, { skipTrial: n, skipVisibility: i })).catch(() => {
|
|
3036
3083
|
});
|
|
3037
3084
|
return;
|
|
3038
3085
|
}
|
|
3039
3086
|
this.billing.bootstrap().then(
|
|
3040
|
-
(
|
|
3087
|
+
(l) => this.runOpenGates(e, l, { skipTrial: n, skipVisibility: i, renew: s })
|
|
3041
3088
|
).catch(() => {
|
|
3042
3089
|
this.mountAndShow(e, { renew: s });
|
|
3043
3090
|
});
|
|
@@ -3103,8 +3150,8 @@ let yr = class {
|
|
|
3103
3150
|
return;
|
|
3104
3151
|
}
|
|
3105
3152
|
if (a.blocked) {
|
|
3106
|
-
const
|
|
3107
|
-
this.lastTrialStatus =
|
|
3153
|
+
const l = await s.recordBlock();
|
|
3154
|
+
this.lastTrialStatus = l, this.emit("trial_blocked", l);
|
|
3108
3155
|
return;
|
|
3109
3156
|
}
|
|
3110
3157
|
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(e, { renew: n });
|
|
@@ -3113,42 +3160,42 @@ let yr = class {
|
|
|
3113
3160
|
});
|
|
3114
3161
|
}
|
|
3115
3162
|
ensureTrialStore(e) {
|
|
3116
|
-
if (this.trialStore && this.trialStoreConfig &&
|
|
3163
|
+
if (this.trialStore && this.trialStoreConfig && vr(this.trialStoreConfig, e))
|
|
3117
3164
|
return this.trialStore;
|
|
3118
3165
|
this.trialStoreConfig = e;
|
|
3119
3166
|
const t = this.billing.createTrialStore;
|
|
3120
3167
|
return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : qe(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
|
|
3121
3168
|
}
|
|
3122
3169
|
mountAndShow(e, t = {}) {
|
|
3123
|
-
const n = t.renew === !0, i = t.authMode, a = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutPriceId ?? null : null,
|
|
3170
|
+
const n = t.renew === !0, i = t.authMode, a = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutPriceId ?? null : null, l = e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutUrl ?? null : null;
|
|
3124
3171
|
if (this.handle) {
|
|
3125
3172
|
this.isOpen = !0, this.handle.update({
|
|
3126
3173
|
open: !0,
|
|
3127
3174
|
initialView: e,
|
|
3128
3175
|
initialAuthMode: i,
|
|
3129
3176
|
initialCheckoutPriceId: a,
|
|
3130
|
-
initialCheckoutUrl:
|
|
3177
|
+
initialCheckoutUrl: l,
|
|
3131
3178
|
purchased: !1,
|
|
3132
3179
|
renew: n
|
|
3133
3180
|
}), this.emit("open");
|
|
3134
3181
|
return;
|
|
3135
3182
|
}
|
|
3136
3183
|
this.isOpen = !0, this.handle = tt(
|
|
3137
|
-
|
|
3184
|
+
lr,
|
|
3138
3185
|
{
|
|
3139
3186
|
client: this.billing,
|
|
3140
3187
|
open: !0,
|
|
3141
3188
|
initialView: e,
|
|
3142
3189
|
initialAuthMode: i,
|
|
3143
3190
|
initialCheckoutPriceId: a,
|
|
3144
|
-
initialCheckoutUrl:
|
|
3191
|
+
initialCheckoutUrl: l,
|
|
3145
3192
|
purchased: !1,
|
|
3146
3193
|
renew: n,
|
|
3147
3194
|
onClose: () => this.close(),
|
|
3148
|
-
onEvent: (
|
|
3149
|
-
this.emit(
|
|
3195
|
+
onEvent: (c, h) => {
|
|
3196
|
+
this.emit(c, h), c === "checkout_started" && this.startUserWatcher();
|
|
3150
3197
|
},
|
|
3151
|
-
onState: (
|
|
3198
|
+
onState: (c) => this.applyState(c),
|
|
3152
3199
|
inline: this.inline,
|
|
3153
3200
|
locale: this.forceLocale
|
|
3154
3201
|
},
|
|
@@ -3156,7 +3203,7 @@ let yr = class {
|
|
|
3156
3203
|
), this.emit("open");
|
|
3157
3204
|
}
|
|
3158
3205
|
applyState(e) {
|
|
3159
|
-
if (!
|
|
3206
|
+
if (!kr(this.currentState, e)) {
|
|
3160
3207
|
this.currentState = e;
|
|
3161
3208
|
for (const t of this.stateListeners)
|
|
3162
3209
|
try {
|
|
@@ -3334,8 +3381,8 @@ let yr = class {
|
|
|
3334
3381
|
try {
|
|
3335
3382
|
if (s = await this.ensureTrialStore(a).check(), this.lastTrialStatus = s, s.blocked)
|
|
3336
3383
|
return { access: "granted", reason: "trial_blocked", visibility: i, trial: s, user: n };
|
|
3337
|
-
} catch (
|
|
3338
|
-
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed",
|
|
3384
|
+
} catch (l) {
|
|
3385
|
+
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", l);
|
|
3339
3386
|
}
|
|
3340
3387
|
}
|
|
3341
3388
|
return { access: "blocked", reason: "no_subscription", visibility: i, trial: s, user: n };
|
|
@@ -3352,7 +3399,7 @@ let yr = class {
|
|
|
3352
3399
|
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
3353
3400
|
// bootstrap при следующем открытии.
|
|
3354
3401
|
startUserWatcher() {
|
|
3355
|
-
this.watcher ||
|
|
3402
|
+
this.watcher || yr() && (this.watcher = new mr({
|
|
3356
3403
|
client: this.billing,
|
|
3357
3404
|
onActive: (e) => {
|
|
3358
3405
|
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
@@ -3385,15 +3432,15 @@ let yr = class {
|
|
|
3385
3432
|
i && (i.status === "paid" ? (this.emit("purchase_completed", {
|
|
3386
3433
|
priceId: i.priceId,
|
|
3387
3434
|
sessionId: i.sessionId
|
|
3388
|
-
}),
|
|
3435
|
+
}), _r(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), Sr(e));
|
|
3389
3436
|
}
|
|
3390
3437
|
destroy() {
|
|
3391
3438
|
this.tracker?.destroy(), this.tracker = null, this.listeners.clear(), this.stateListeners.clear(), this.watcher?.stop(), this.watcher = null, this.userUnsub?.(), this.userUnsub = null, this.authUnsub?.(), this.authUnsub = null, this.ownsAuth && this.auth && this.auth.destroy?.(), this.ownsAuth = !1, this.billing.destroy?.(), this.handle?.unmount(), this.handle = null, this.isOpen = !1, this.currentState = se;
|
|
3392
3439
|
}
|
|
3393
3440
|
};
|
|
3394
|
-
function
|
|
3441
|
+
function xr(r) {
|
|
3395
3442
|
if (!r.auth) return { auth: void 0, ownsAuth: !1 };
|
|
3396
|
-
if (r.auth instanceof ue ||
|
|
3443
|
+
if (r.auth instanceof ue || wr(r.auth))
|
|
3397
3444
|
return { auth: r.auth, ownsAuth: !1 };
|
|
3398
3445
|
const e = r.auth === !0 ? {} : r.auth;
|
|
3399
3446
|
return {
|
|
@@ -3407,15 +3454,15 @@ function br(r) {
|
|
|
3407
3454
|
ownsAuth: !0
|
|
3408
3455
|
};
|
|
3409
3456
|
}
|
|
3410
|
-
function
|
|
3457
|
+
function wr(r) {
|
|
3411
3458
|
if (typeof r != "object" || r === null) return !1;
|
|
3412
3459
|
const e = r;
|
|
3413
3460
|
return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
|
|
3414
3461
|
}
|
|
3415
|
-
function
|
|
3462
|
+
function kr(r, e) {
|
|
3416
3463
|
return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
|
|
3417
3464
|
}
|
|
3418
|
-
function
|
|
3465
|
+
function vr(r, e) {
|
|
3419
3466
|
return r.mode === e.mode && r.payload === e.payload && r.storage === e.storage;
|
|
3420
3467
|
}
|
|
3421
3468
|
function _e(r) {
|
|
@@ -3427,7 +3474,7 @@ function _e(r) {
|
|
|
3427
3474
|
sessionId: e.get(F.sessionId)
|
|
3428
3475
|
} : null;
|
|
3429
3476
|
}
|
|
3430
|
-
function
|
|
3477
|
+
function _r(r) {
|
|
3431
3478
|
if (!(typeof window > "u" || !window.opener))
|
|
3432
3479
|
try {
|
|
3433
3480
|
window.opener.postMessage(
|
|
@@ -3442,7 +3489,7 @@ function vr(r) {
|
|
|
3442
3489
|
} catch {
|
|
3443
3490
|
}
|
|
3444
3491
|
}
|
|
3445
|
-
function
|
|
3492
|
+
function Sr(r) {
|
|
3446
3493
|
const e = (n, i) => {
|
|
3447
3494
|
if (!n) return "";
|
|
3448
3495
|
const s = new URLSearchParams(n.replace(/^[?#]/, ""));
|
|
@@ -3452,7 +3499,7 @@ function _r(r) {
|
|
|
3452
3499
|
}, t = r.pathname + e(r.search, "?") + e(r.hash, "#");
|
|
3453
3500
|
window.history.replaceState(null, "", t);
|
|
3454
3501
|
}
|
|
3455
|
-
class
|
|
3502
|
+
class Cr {
|
|
3456
3503
|
constructor(e, t, n) {
|
|
3457
3504
|
this.transport = e, this.paywallId = t, this.config = n;
|
|
3458
3505
|
}
|
|
@@ -3475,7 +3522,7 @@ class Sr {
|
|
|
3475
3522
|
});
|
|
3476
3523
|
}
|
|
3477
3524
|
}
|
|
3478
|
-
class
|
|
3525
|
+
class Ir {
|
|
3479
3526
|
constructor(e, t) {
|
|
3480
3527
|
this.transport = e, this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null, this.userListeners = /* @__PURE__ */ new Set(), this.balanceListeners = /* @__PURE__ */ new Set(), this.bootstrapListeners = /* @__PURE__ */ new Set(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.remoteStorageAdapter = {
|
|
3481
3528
|
getItem: (n) => this.transport.request("storage.get", { key: n }),
|
|
@@ -3662,7 +3709,7 @@ class Cr {
|
|
|
3662
3709
|
* read-modify-write. PaywallUI duck-types этот метод и предпочитает его
|
|
3663
3710
|
* локальной фабрике, если он есть. */
|
|
3664
3711
|
createTrialStore(e) {
|
|
3665
|
-
return new
|
|
3712
|
+
return new Cr(this.transport, this.paywallId, e);
|
|
3666
3713
|
}
|
|
3667
3714
|
// === Identity ===
|
|
3668
3715
|
getIdentity() {
|
|
@@ -3695,10 +3742,10 @@ class Cr {
|
|
|
3695
3742
|
* broadcast'ов от offscreen — чтобы host'овский onUserChange handler
|
|
3696
3743
|
* получил signal независимо от того, кто триггернул обновление. */
|
|
3697
3744
|
applyUser(e) {
|
|
3698
|
-
|
|
3745
|
+
Ar(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
|
|
3699
3746
|
}
|
|
3700
3747
|
applyBalances(e) {
|
|
3701
|
-
|
|
3748
|
+
Lr(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
|
|
3702
3749
|
}
|
|
3703
3750
|
fireUserListeners(e) {
|
|
3704
3751
|
for (const t of [...this.userListeners])
|
|
@@ -3717,17 +3764,17 @@ class Cr {
|
|
|
3717
3764
|
}
|
|
3718
3765
|
}
|
|
3719
3766
|
}
|
|
3720
|
-
function
|
|
3767
|
+
function Ar(r, e) {
|
|
3721
3768
|
return r === e ? !0 : !r || !e ? !1 : r.has_active_subscription === e.has_active_subscription && (r.purchases?.length ?? 0) === (e.purchases?.length ?? 0);
|
|
3722
3769
|
}
|
|
3723
|
-
function
|
|
3770
|
+
function Lr(r, e) {
|
|
3724
3771
|
if (r === e) return !0;
|
|
3725
3772
|
if (!r || !e || r.length !== e.length) return !1;
|
|
3726
3773
|
for (let t = 0; t < r.length; t++)
|
|
3727
3774
|
if (r[t].type !== e[t].type || r[t].count !== e[t].count) return !1;
|
|
3728
3775
|
return !0;
|
|
3729
3776
|
}
|
|
3730
|
-
class
|
|
3777
|
+
class Mr {
|
|
3731
3778
|
constructor(e, t) {
|
|
3732
3779
|
this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", ({ event: n, session: i }) => {
|
|
3733
3780
|
this.applySession(n, i);
|
|
@@ -3845,7 +3892,7 @@ class Lr {
|
|
|
3845
3892
|
"popup_blocked",
|
|
3846
3893
|
"browser blocked auth popup — call from a user gesture"
|
|
3847
3894
|
);
|
|
3848
|
-
|
|
3895
|
+
Br(n, e.provider);
|
|
3849
3896
|
try {
|
|
3850
3897
|
const { authorizeUrl: i, state: s } = await this.transport.request("auth.oauthStart", {
|
|
3851
3898
|
provider: e.provider,
|
|
@@ -3853,8 +3900,8 @@ class Lr {
|
|
|
3853
3900
|
userMeta: e.userMeta
|
|
3854
3901
|
});
|
|
3855
3902
|
n.name = `pw-oauth-${s}`, n.location.replace(i), e.onPopupOpened?.();
|
|
3856
|
-
const a = await Ne(n, s),
|
|
3857
|
-
return this.applySession("SIGNED_IN",
|
|
3903
|
+
const a = await Ne(n, s), l = await this.transport.request("auth.oauthExchange", { state: s, code: a });
|
|
3904
|
+
return this.applySession("SIGNED_IN", l), l;
|
|
3858
3905
|
} catch (i) {
|
|
3859
3906
|
try {
|
|
3860
3907
|
n.close();
|
|
@@ -3867,7 +3914,7 @@ class Lr {
|
|
|
3867
3914
|
this.unsubBroadcast?.(), this.unsubBroadcast = null, this.listeners.clear(), this.session = null;
|
|
3868
3915
|
}
|
|
3869
3916
|
applySession(e, t) {
|
|
3870
|
-
if (!
|
|
3917
|
+
if (!Er(this.session, t)) {
|
|
3871
3918
|
this.session = t;
|
|
3872
3919
|
for (const n of [...this.listeners])
|
|
3873
3920
|
try {
|
|
@@ -3878,17 +3925,17 @@ class Lr {
|
|
|
3878
3925
|
}
|
|
3879
3926
|
}
|
|
3880
3927
|
}
|
|
3881
|
-
function
|
|
3928
|
+
function Er(r, e) {
|
|
3882
3929
|
return r === e ? !0 : !r || !e ? !1 : r.access_token === e.access_token && r.refresh_token === e.refresh_token && r.expires_at === e.expires_at && r.user.id === e.user.id;
|
|
3883
3930
|
}
|
|
3884
|
-
const
|
|
3931
|
+
const Tr = {
|
|
3885
3932
|
google: "Google",
|
|
3886
3933
|
apple: "Apple",
|
|
3887
3934
|
github: "GitHub",
|
|
3888
3935
|
facebook: "Facebook"
|
|
3889
3936
|
};
|
|
3890
|
-
function
|
|
3891
|
-
const t =
|
|
3937
|
+
function Br(r, e) {
|
|
3938
|
+
const t = Tr[e] ?? e;
|
|
3892
3939
|
try {
|
|
3893
3940
|
const n = r.document;
|
|
3894
3941
|
n.title = `Sign in with ${t}`;
|
|
@@ -3898,12 +3945,12 @@ function Tr(r, e) {
|
|
|
3898
3945
|
s.className = "pw-oauth-wrap";
|
|
3899
3946
|
const a = n.createElement("div");
|
|
3900
3947
|
a.className = "pw-oauth-spinner";
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3948
|
+
const l = n.createElement("div");
|
|
3949
|
+
l.className = "pw-oauth-label", l.textContent = `Connecting to ${t}…`, s.appendChild(a), s.appendChild(l), n.body.appendChild(s);
|
|
3903
3950
|
} catch {
|
|
3904
3951
|
}
|
|
3905
3952
|
}
|
|
3906
|
-
class
|
|
3953
|
+
class Pr {
|
|
3907
3954
|
constructor(e) {
|
|
3908
3955
|
this.transport = e;
|
|
3909
3956
|
}
|
|
@@ -3915,7 +3962,7 @@ class Br {
|
|
|
3915
3962
|
});
|
|
3916
3963
|
}
|
|
3917
3964
|
}
|
|
3918
|
-
class
|
|
3965
|
+
class Or {
|
|
3919
3966
|
constructor(e) {
|
|
3920
3967
|
this.factory = e, this.channel = null, this.channelDisposers = [], this.pending = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.destroyed = !1, this.nextId = 0, this.clientId = `c-${Math.random().toString(36).slice(2, 10)}`;
|
|
3921
3968
|
}
|
|
@@ -3939,7 +3986,7 @@ class Pr {
|
|
|
3939
3986
|
}), e;
|
|
3940
3987
|
}
|
|
3941
3988
|
handleMessage(e) {
|
|
3942
|
-
if (
|
|
3989
|
+
if (jr(e)) {
|
|
3943
3990
|
if (e.type === "response") {
|
|
3944
3991
|
const t = this.pending.get(e.id);
|
|
3945
3992
|
if (!t) return;
|
|
@@ -3964,7 +4011,7 @@ class Pr {
|
|
|
3964
4011
|
const e = Array.from(this.pending.values());
|
|
3965
4012
|
this.pending.clear();
|
|
3966
4013
|
for (const t of e)
|
|
3967
|
-
t.signal?.removeEventListener("abort", t.abortListener), t.reject(new
|
|
4014
|
+
t.signal?.removeEventListener("abort", t.abortListener), t.reject(new Ur());
|
|
3968
4015
|
}
|
|
3969
4016
|
request(e, t, n = {}) {
|
|
3970
4017
|
if (this.destroyed)
|
|
@@ -3972,21 +4019,21 @@ class Pr {
|
|
|
3972
4019
|
if (n.signal?.aborted)
|
|
3973
4020
|
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
3974
4021
|
const i = this.ensureChannel(), s = `r${++this.nextId}`;
|
|
3975
|
-
return new Promise((a,
|
|
3976
|
-
const
|
|
4022
|
+
return new Promise((a, l) => {
|
|
4023
|
+
const c = {
|
|
3977
4024
|
resolve: a,
|
|
3978
|
-
reject:
|
|
4025
|
+
reject: l,
|
|
3979
4026
|
signal: n.signal
|
|
3980
4027
|
};
|
|
3981
|
-
n.signal && (
|
|
4028
|
+
n.signal && (c.abortListener = () => {
|
|
3982
4029
|
if (this.pending.delete(s)) {
|
|
3983
|
-
|
|
4030
|
+
l(new DOMException("Aborted", "AbortError"));
|
|
3984
4031
|
try {
|
|
3985
4032
|
i.send({ type: "cancel", id: s });
|
|
3986
4033
|
} catch {
|
|
3987
4034
|
}
|
|
3988
4035
|
}
|
|
3989
|
-
}, n.signal.addEventListener("abort",
|
|
4036
|
+
}, n.signal.addEventListener("abort", c.abortListener)), this.pending.set(s, c);
|
|
3990
4037
|
const h = {
|
|
3991
4038
|
type: "request",
|
|
3992
4039
|
id: s,
|
|
@@ -3996,7 +4043,7 @@ class Pr {
|
|
|
3996
4043
|
try {
|
|
3997
4044
|
i.send(h);
|
|
3998
4045
|
} catch (d) {
|
|
3999
|
-
this.pending.delete(s), n.signal?.removeEventListener("abort",
|
|
4046
|
+
this.pending.delete(s), n.signal?.removeEventListener("abort", c.abortListener), l(d);
|
|
4000
4047
|
}
|
|
4001
4048
|
});
|
|
4002
4049
|
}
|
|
@@ -4020,28 +4067,28 @@ class Pr {
|
|
|
4020
4067
|
this.channel?.close(), this.channel = null;
|
|
4021
4068
|
}
|
|
4022
4069
|
}
|
|
4023
|
-
class
|
|
4070
|
+
class Ur extends Error {
|
|
4024
4071
|
constructor() {
|
|
4025
4072
|
super("Transport channel disconnected mid-request"), this.code = "transport_disconnected", this.name = "TransportDisconnectedError";
|
|
4026
4073
|
}
|
|
4027
4074
|
}
|
|
4028
|
-
function
|
|
4075
|
+
function jr(r) {
|
|
4029
4076
|
if (typeof r != "object" || r === null) return !1;
|
|
4030
4077
|
const e = r.type;
|
|
4031
4078
|
return e === "request" || e === "response" || e === "event";
|
|
4032
4079
|
}
|
|
4033
4080
|
let W = null;
|
|
4034
|
-
function
|
|
4035
|
-
return W || (W = new
|
|
4081
|
+
function Rr() {
|
|
4082
|
+
return W || (W = new Or(() => $e(Ze)), W);
|
|
4036
4083
|
}
|
|
4037
|
-
class
|
|
4084
|
+
class Hr extends br {
|
|
4038
4085
|
constructor(e) {
|
|
4039
|
-
const t =
|
|
4086
|
+
const t = Rr(), n = new Ir(t, {
|
|
4040
4087
|
paywallId: e.paywallId,
|
|
4041
4088
|
apiOrigin: e.apiOrigin
|
|
4042
4089
|
});
|
|
4043
4090
|
let i;
|
|
4044
|
-
e.auth === !0 ? i = new
|
|
4091
|
+
e.auth === !0 ? i = new Mr(t, {
|
|
4045
4092
|
paywallId: e.paywallId,
|
|
4046
4093
|
apiOrigin: e.apiOrigin
|
|
4047
4094
|
}) : e.auth && console.warn(
|
|
@@ -4057,7 +4104,7 @@ class Vr extends yr {
|
|
|
4057
4104
|
// Внутренний EventTracker отключаем — единственный tracker живёт в
|
|
4058
4105
|
// offscreen'е. Манчиально подписываемся ниже.
|
|
4059
4106
|
analytics: !1
|
|
4060
|
-
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new
|
|
4107
|
+
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new Pr(t), this.bindAnalytics());
|
|
4061
4108
|
}
|
|
4062
4109
|
/** Зеркало sdk/PaywallUI.initTracker'овских биндингов, но с RemoteEventTracker.
|
|
4063
4110
|
* Когда @monetize.software/sdk экспоузнет публичный hook для inject'а tracker'а,
|
|
@@ -4116,10 +4163,10 @@ class Vr extends yr {
|
|
|
4116
4163
|
}
|
|
4117
4164
|
export {
|
|
4118
4165
|
J as PROTOCOL_VERSION,
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4166
|
+
Hr as PaywallUI,
|
|
4167
|
+
Mr as RemoteAuthClient,
|
|
4168
|
+
Ir as RemoteBillingClient,
|
|
4169
|
+
Pr as RemoteEventTracker,
|
|
4170
|
+
Rr as getContentTransport
|
|
4124
4171
|
};
|
|
4125
4172
|
//# sourceMappingURL=content.js.map
|