@monetize.software/sdk-extension 3.0.0-alpha.14 → 3.0.0-alpha.16
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/{chrome-port-BXK5myXz.js → chrome-port-Dl-cLIZy.js} +2 -2
- package/dist/chunks/{chrome-port-BXK5myXz.js.map → chrome-port-Dl-cLIZy.js.map} +1 -1
- package/dist/chunks/{chrome-port-KYVwww_u.js → chrome-port-bqs4PVlp.js} +35 -34
- package/dist/chunks/{chrome-port-KYVwww_u.js.map → chrome-port-bqs4PVlp.js.map} +1 -1
- package/dist/content.cjs +3 -3
- package/dist/content.cjs.map +1 -1
- package/dist/content.js +1219 -994
- package/dist/content.js.map +1 -1
- package/dist/offscreen.cjs +1 -1
- package/dist/offscreen.js +1 -1
- package/package.json +3 -3
package/dist/content.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { render as
|
|
3
|
-
import { jsx as o, jsxs as u, Fragment as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { P as
|
|
6
|
-
function
|
|
7
|
-
return `pw-offer-${
|
|
8
|
-
}
|
|
9
|
-
function
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
1
|
+
import { P as L, B as Re, 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-bqs4PVlp.js";
|
|
2
|
+
import { render as Q, h as de, createContext as Ve } from "preact";
|
|
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 D, useMemo as Ge, useLayoutEffect as We } from "preact/hooks";
|
|
5
|
+
import { P as Ze } from "./chunks/port-name-ervLBWAQ.js";
|
|
6
|
+
function Ye(r) {
|
|
7
|
+
return `pw-offer-${r}-start`;
|
|
8
|
+
}
|
|
9
|
+
function N(r, e) {
|
|
10
|
+
if (!r || r.length === 0) return null;
|
|
11
|
+
const t = r.find(
|
|
12
12
|
(i) => i.price_id === e && (i.discount_percent ?? 0) > 0
|
|
13
13
|
);
|
|
14
|
-
return
|
|
14
|
+
return t || (r.find(
|
|
15
15
|
(i) => i.price_id == null && (i.discount_percent ?? 0) > 0
|
|
16
16
|
) ?? null);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const n = e.now ?? Date.now(), i =
|
|
22
|
-
return i !== null && i <= n ? null : { offer:
|
|
18
|
+
function Ke(r, e = {}) {
|
|
19
|
+
const t = r.discount_percent ?? 0;
|
|
20
|
+
if (t <= 0) return null;
|
|
21
|
+
const n = e.now ?? Date.now(), i = Xe(r, e.readStart), s = Je(r, i), a = i !== null ? Math.max(0, i - n) : null;
|
|
22
|
+
return i !== null && i <= n ? null : { offer: r, discountPercent: t, remainingMs: a, totalMs: s, expiresAt: i };
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
return Number.isFinite(
|
|
24
|
+
function Xe(r, e) {
|
|
25
|
+
if (r.expires_at) {
|
|
26
|
+
const t = Date.parse(r.expires_at);
|
|
27
|
+
return Number.isFinite(t) ? t : null;
|
|
28
28
|
}
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
32
|
-
const n = Date.parse(
|
|
33
|
-
return Number.isFinite(n) ? n +
|
|
29
|
+
if (r.duration_minutes && r.duration_minutes > 0 && e) {
|
|
30
|
+
const t = e(r.id);
|
|
31
|
+
if (!t) return null;
|
|
32
|
+
const n = Date.parse(t);
|
|
33
|
+
return Number.isFinite(n) ? n + r.duration_minutes * 6e4 : null;
|
|
34
34
|
}
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function Je(r, e) {
|
|
38
|
+
return r.duration_minutes && r.duration_minutes > 0 ? r.duration_minutes * 6e4 : e !== null ? e - Date.now() : null;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Qe(r) {
|
|
41
41
|
if (typeof window > "u") return null;
|
|
42
42
|
try {
|
|
43
|
-
return window.localStorage.getItem(
|
|
43
|
+
return window.localStorage.getItem(Ye(r));
|
|
44
44
|
} catch {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const _e = '@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --color-red-50: oklch(97.1% .013 17.38); --color-red-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --color-red-400: oklch(70.4% .191 22.216); --color-red-500: oklch(63.7% .237 25.331); --color-red-600: oklch(57.7% .245 27.325); --color-red-700: oklch(50.5% .213 27.518); --color-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --color-slate-950: oklch(12.9% .042 264.695); --color-gray-50: oklch(98.5% .002 247.839); --color-gray-100: oklch(96.7% .003 264.542); --color-gray-200: oklch(92.8% .006 264.531); --color-gray-300: oklch(87.2% .01 258.338); --color-gray-400: oklch(70.7% .022 261.325); --color-gray-500: oklch(55.1% .027 264.364); --color-gray-600: oklch(44.6% .03 256.802); --color-gray-700: oklch(37.3% .034 259.733); --color-gray-800: oklch(27.8% .033 256.848); --color-gray-900: oklch(21% .034 264.665); --color-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{:host{all:initial;color-scheme:light;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}*,*:before,*:after{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}.pw-cta-shimmer:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.35) 50%,transparent);animation:pw-cta-shimmer 3s infinite;z-index:1}@keyframes pw-cta-shimmer{0%{left:-100%}to{left:100%}}';
|
|
49
|
-
let
|
|
50
|
-
function
|
|
51
|
-
if (
|
|
52
|
-
let
|
|
48
|
+
const Se = '@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --color-red-50: oklch(97.1% .013 17.38); --color-red-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --color-red-400: oklch(70.4% .191 22.216); --color-red-500: oklch(63.7% .237 25.331); --color-red-600: oklch(57.7% .245 27.325); --color-red-700: oklch(50.5% .213 27.518); --color-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --color-slate-950: oklch(12.9% .042 264.695); --color-gray-50: oklch(98.5% .002 247.839); --color-gray-100: oklch(96.7% .003 264.542); --color-gray-200: oklch(92.8% .006 264.531); --color-gray-300: oklch(87.2% .01 258.338); --color-gray-400: oklch(70.7% .022 261.325); --color-gray-500: oklch(55.1% .027 264.364); --color-gray-600: oklch(44.6% .03 256.802); --color-gray-700: oklch(37.3% .034 259.733); --color-gray-800: oklch(27.8% .033 256.848); --color-gray-900: oklch(21% .034 264.665); --color-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{:host{all:initial;color-scheme:light;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}*,*:before,*:after{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}.pw-cta-shimmer:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.35) 50%,transparent);animation:pw-cta-shimmer 3s infinite;z-index:1}@keyframes pw-cta-shimmer{0%{left:-100%}to{left:100%}}';
|
|
49
|
+
let he = !1;
|
|
50
|
+
function et() {
|
|
51
|
+
if (he || (he = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
|
|
52
|
+
let r;
|
|
53
53
|
try {
|
|
54
54
|
const e = new CSSStyleSheet();
|
|
55
|
-
e.replaceSync(
|
|
55
|
+
e.replaceSync(Se), r = e.cssRules;
|
|
56
56
|
} catch {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
for (const e of
|
|
59
|
+
for (const e of r) {
|
|
60
60
|
if (e.constructor.name !== "CSSPropertyRule") continue;
|
|
61
|
-
const
|
|
61
|
+
const t = e;
|
|
62
62
|
try {
|
|
63
63
|
CSS.registerProperty({
|
|
64
|
-
name:
|
|
65
|
-
syntax:
|
|
66
|
-
inherits:
|
|
67
|
-
...
|
|
64
|
+
name: t.name,
|
|
65
|
+
syntax: t.syntax,
|
|
66
|
+
inherits: t.inherits,
|
|
67
|
+
...t.initialValue != null ? { initialValue: t.initialValue } : {}
|
|
68
68
|
});
|
|
69
69
|
} catch {
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function tt(r, e, t = {}) {
|
|
74
74
|
if (typeof document > "u")
|
|
75
75
|
throw new Error("mountShadow called in non-DOM environment");
|
|
76
|
-
|
|
77
|
-
const n =
|
|
78
|
-
n.setAttribute("data-paywall-host", ""), n.style.cssText =
|
|
79
|
-
const i = n.attachShadow({ mode:
|
|
76
|
+
et();
|
|
77
|
+
const n = t.host ?? document.createElement("div");
|
|
78
|
+
n.setAttribute("data-paywall-host", ""), n.style.cssText = t.inline ? "all: initial; position: absolute; inset: 0; z-index: 1; pointer-events: none;" : "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", !n.isConnected && !t.inline && document.body.appendChild(n);
|
|
79
|
+
const i = n.attachShadow({ mode: t.shadowMode ?? "closed" }), s = `
|
|
80
80
|
:host {
|
|
81
81
|
all: initial !important;
|
|
82
82
|
display: block !important;
|
|
@@ -95,33 +95,33 @@ function Qe(t, e, r = {}) {
|
|
|
95
95
|
visibility: visible !important;
|
|
96
96
|
}
|
|
97
97
|
`, a = document.createElement("style");
|
|
98
|
-
a.textContent = s +
|
|
98
|
+
a.textContent = s + Se + (t.injectCss ?? ""), i.appendChild(a);
|
|
99
99
|
const c = document.createElement("div");
|
|
100
100
|
c.style.pointerEvents = "auto", i.appendChild(c);
|
|
101
101
|
let l = e;
|
|
102
|
-
return
|
|
102
|
+
return Q(de(r, l), c), {
|
|
103
103
|
shadowRoot: i,
|
|
104
|
-
update(
|
|
105
|
-
l = { ...l, ...
|
|
104
|
+
update(h) {
|
|
105
|
+
l = { ...l, ...h }, Q(de(r, l), c);
|
|
106
106
|
},
|
|
107
107
|
unmount() {
|
|
108
|
-
|
|
108
|
+
Q(null, c), n.remove();
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
const
|
|
113
|
-
const n =
|
|
112
|
+
const rt = (r, e, t) => {
|
|
113
|
+
const n = r[e];
|
|
114
114
|
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
|
|
115
115
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
116
116
|
s.bind(
|
|
117
117
|
null,
|
|
118
118
|
new Error(
|
|
119
|
-
"Unknown variable dynamic import: " + e + (e.split("/").length !==
|
|
119
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
|
|
120
120
|
)
|
|
121
121
|
)
|
|
122
122
|
);
|
|
123
123
|
});
|
|
124
|
-
},
|
|
124
|
+
}, nt = [
|
|
125
125
|
"ru",
|
|
126
126
|
"uk",
|
|
127
127
|
"de",
|
|
@@ -149,89 +149,89 @@ const et = (t, e, r) => {
|
|
|
149
149
|
"th",
|
|
150
150
|
"vi",
|
|
151
151
|
"he"
|
|
152
|
-
],
|
|
153
|
-
function
|
|
154
|
-
if (!e) return
|
|
155
|
-
let
|
|
152
|
+
], Ce = (r, e, t) => Ae(e, t), Ie = Ve({ t: Ce, locale: "en" });
|
|
153
|
+
function Ae(r, e) {
|
|
154
|
+
if (!e) return r;
|
|
155
|
+
let t = r;
|
|
156
156
|
for (const [n, i] of Object.entries(e))
|
|
157
|
-
|
|
158
|
-
return
|
|
157
|
+
t = t.split(`{${n}}`).join(String(i));
|
|
158
|
+
return t;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
162
|
-
return
|
|
160
|
+
const ee = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
|
|
161
|
+
function Le(r) {
|
|
162
|
+
return nt.includes(r);
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function it(r) {
|
|
165
165
|
const e = [];
|
|
166
166
|
if (typeof navigator < "u" && navigator.language) {
|
|
167
167
|
e.push(navigator.language);
|
|
168
168
|
const n = navigator.language.split("-")[0];
|
|
169
169
|
n && n !== navigator.language && e.push(n);
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
e.push(
|
|
174
|
-
const n =
|
|
175
|
-
n && n !==
|
|
171
|
+
const t = r.settings.locale_default;
|
|
172
|
+
if (t) {
|
|
173
|
+
e.push(t);
|
|
174
|
+
const n = t.split("-")[0];
|
|
175
|
+
n && n !== t && e.push(n);
|
|
176
176
|
}
|
|
177
177
|
for (const n of e)
|
|
178
|
-
if (
|
|
178
|
+
if (Le(n)) return n;
|
|
179
179
|
return null;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
return !!
|
|
181
|
+
function ot(r, e) {
|
|
182
|
+
return !!r.locales && r.locales[e] !== void 0;
|
|
183
183
|
}
|
|
184
|
-
async function
|
|
185
|
-
const e =
|
|
184
|
+
async function st(r) {
|
|
185
|
+
const e = ee.get(r);
|
|
186
186
|
if (e) return e;
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
const n =
|
|
187
|
+
const t = te.get(r);
|
|
188
|
+
if (t) return t;
|
|
189
|
+
const n = rt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./chunks/ar-B2Wg_IrC.js"), "./locales/cs.ts": () => import("./chunks/cs-BNo9Dx0Q.js"), "./locales/da.ts": () => import("./chunks/da-Do9Lq6En.js"), "./locales/de.ts": () => import("./chunks/de-C8pDZNvx.js"), "./locales/el.ts": () => import("./chunks/el-DzMNX-_P.js"), "./locales/es.ts": () => import("./chunks/es-YrKt-q4w.js"), "./locales/fi.ts": () => import("./chunks/fi-Bh44pwZ4.js"), "./locales/fr.ts": () => import("./chunks/fr-Bc0pw4ws.js"), "./locales/he.ts": () => import("./chunks/he-Bfm-bhe3.js"), "./locales/hi.ts": () => import("./chunks/hi-D-O-B9Dn.js"), "./locales/hu.ts": () => import("./chunks/hu-CmIuAbLL.js"), "./locales/id.ts": () => import("./chunks/id-DN7IES-A.js"), "./locales/it.ts": () => import("./chunks/it-Cz5Nmqx5.js"), "./locales/ja.ts": () => import("./chunks/ja-BH9BlBh2.js"), "./locales/ko.ts": () => import("./chunks/ko-CYV9QuYs.js"), "./locales/nl.ts": () => import("./chunks/nl-BvkB900D.js"), "./locales/no.ts": () => import("./chunks/no-3s9_ormb.js"), "./locales/pl.ts": () => import("./chunks/pl-C9WTGQtb.js"), "./locales/pt.ts": () => import("./chunks/pt-uFVUv_Op.js"), "./locales/ro.ts": () => import("./chunks/ro-BrqQ8Au-.js"), "./locales/ru.ts": () => import("./chunks/ru-DK594dA8.js"), "./locales/sv.ts": () => import("./chunks/sv-CHNH8-mq.js"), "./locales/th.ts": () => import("./chunks/th-l24Pm5q-.js"), "./locales/tr.ts": () => import("./chunks/tr-ADpigSY5.js"), "./locales/uk.ts": () => import("./chunks/uk-CGqo4jek.js"), "./locales/vi.ts": () => import("./chunks/vi-Dk9bTu6f.js"), "./locales/zh.ts": () => import("./chunks/zh-LDkEV2D9.js") }), `./locales/${r}.ts`, 3).then((i) => {
|
|
190
190
|
const s = i.default ?? {};
|
|
191
|
-
return
|
|
191
|
+
return ee.set(r, s), s;
|
|
192
192
|
}).catch((i) => {
|
|
193
|
-
console.warn(`[paywall] failed to load locale chunk "${
|
|
193
|
+
console.warn(`[paywall] failed to load locale chunk "${r}"`, i);
|
|
194
194
|
const s = {};
|
|
195
|
-
return
|
|
195
|
+
return ee.set(r, s), s;
|
|
196
196
|
}).finally(() => {
|
|
197
|
-
|
|
197
|
+
te.delete(r);
|
|
198
198
|
});
|
|
199
|
-
return
|
|
200
|
-
}
|
|
201
|
-
function
|
|
202
|
-
const [n, i] =
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
if (!
|
|
206
|
-
const
|
|
207
|
-
return !
|
|
199
|
+
return te.set(r, n), n;
|
|
200
|
+
}
|
|
201
|
+
function at({ bootstrap: r, forceLocale: e, children: t }) {
|
|
202
|
+
const [n, i] = k("en"), [s, a] = k(null);
|
|
203
|
+
P(() => {
|
|
204
|
+
const h = (e && Le(e) ? e : null) ?? (() => {
|
|
205
|
+
if (!r) return null;
|
|
206
|
+
const g = it(r);
|
|
207
|
+
return !g || !ot(r, g) ? null : g;
|
|
208
208
|
})();
|
|
209
|
-
if (!
|
|
209
|
+
if (!h) {
|
|
210
210
|
(s !== null || n !== "en") && (i("en"), a(null));
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
if (
|
|
214
|
-
let
|
|
215
|
-
return
|
|
216
|
-
|
|
213
|
+
if (h === n && s) return;
|
|
214
|
+
let d = !1;
|
|
215
|
+
return st(h).then((g) => {
|
|
216
|
+
d || (i(h), a(g));
|
|
217
217
|
}), () => {
|
|
218
|
-
|
|
218
|
+
d = !0;
|
|
219
219
|
};
|
|
220
|
-
}, [
|
|
220
|
+
}, [r, e]);
|
|
221
221
|
const c = {
|
|
222
222
|
locale: n,
|
|
223
|
-
t: s ? (l,
|
|
223
|
+
t: s ? (l, h, d) => Ae(s[l] ?? h, d) : Ce
|
|
224
224
|
};
|
|
225
|
-
return /* @__PURE__ */ o(
|
|
225
|
+
return /* @__PURE__ */ o(Ie.Provider, { value: c, children: t });
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
227
|
+
function S() {
|
|
228
|
+
return He(Ie);
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
open:
|
|
230
|
+
const pe = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
231
|
+
function lt({
|
|
232
|
+
open: r,
|
|
233
233
|
onClose: e,
|
|
234
|
-
labelledBy:
|
|
234
|
+
labelledBy: t,
|
|
235
235
|
brandColor: n,
|
|
236
236
|
topBanner: i,
|
|
237
237
|
allowClose: s = !0,
|
|
@@ -239,40 +239,40 @@ function st({
|
|
|
239
239
|
inline: c = !1,
|
|
240
240
|
children: l
|
|
241
241
|
}) {
|
|
242
|
-
const { t:
|
|
243
|
-
return
|
|
244
|
-
if (!
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
242
|
+
const { t: h } = S(), d = D(null), g = D(null);
|
|
243
|
+
return P(() => {
|
|
244
|
+
if (!r) return;
|
|
245
|
+
g.current = document.activeElement ?? null;
|
|
246
|
+
const m = d.current;
|
|
247
|
+
m && (m.querySelector(pe) ?? m).focus({ preventScroll: !0 });
|
|
248
|
+
const A = (y) => {
|
|
249
|
+
if (y.key === "Escape") {
|
|
250
250
|
if (!s) return;
|
|
251
|
-
|
|
251
|
+
y.stopPropagation(), e();
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
|
-
if (
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
).filter((
|
|
258
|
-
if (
|
|
259
|
-
|
|
254
|
+
if (y.key !== "Tab" || !d.current) return;
|
|
255
|
+
const C = Array.from(
|
|
256
|
+
d.current.querySelectorAll(pe)
|
|
257
|
+
).filter((O) => !O.hasAttribute("disabled") && O.tabIndex !== -1);
|
|
258
|
+
if (C.length === 0) {
|
|
259
|
+
y.preventDefault();
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
|
|
262
|
+
const I = C[0], U = C[C.length - 1], M = document.activeElement;
|
|
263
|
+
y.shiftKey && M === I ? (y.preventDefault(), U.focus()) : !y.shiftKey && M === U && (y.preventDefault(), I.focus());
|
|
264
264
|
};
|
|
265
|
-
document.addEventListener("keydown",
|
|
266
|
-
const
|
|
265
|
+
document.addEventListener("keydown", A, !0);
|
|
266
|
+
const b = document.body.style.overflow;
|
|
267
267
|
return c || (document.body.style.overflow = "hidden"), () => {
|
|
268
|
-
document.removeEventListener("keydown",
|
|
268
|
+
document.removeEventListener("keydown", A, !0), c || (document.body.style.overflow = b), g.current?.focus?.({ preventScroll: !0 });
|
|
269
269
|
};
|
|
270
|
-
}, [
|
|
270
|
+
}, [r, e, s, c]), r ? /* @__PURE__ */ u(
|
|
271
271
|
"div",
|
|
272
272
|
{
|
|
273
273
|
class: `${c ? "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
|
-
onClick: (
|
|
275
|
-
s &&
|
|
274
|
+
onClick: (m) => {
|
|
275
|
+
s && m.target === m.currentTarget && e();
|
|
276
276
|
},
|
|
277
277
|
"data-pw-root": !0,
|
|
278
278
|
children: [
|
|
@@ -286,10 +286,10 @@ function st({
|
|
|
286
286
|
/* @__PURE__ */ u(
|
|
287
287
|
"div",
|
|
288
288
|
{
|
|
289
|
-
ref:
|
|
289
|
+
ref: d,
|
|
290
290
|
role: "dialog",
|
|
291
291
|
"aria-modal": "true",
|
|
292
|
-
"aria-labelledby":
|
|
292
|
+
"aria-labelledby": t,
|
|
293
293
|
tabIndex: -1,
|
|
294
294
|
class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl bg-white outline-none",
|
|
295
295
|
style: {
|
|
@@ -302,7 +302,7 @@ function st({
|
|
|
302
302
|
{
|
|
303
303
|
type: "button",
|
|
304
304
|
onClick: e,
|
|
305
|
-
"aria-label":
|
|
305
|
+
"aria-label": h("modal.close_aria", "Close"),
|
|
306
306
|
class: "absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-500 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
307
307
|
children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
308
308
|
"path",
|
|
@@ -332,8 +332,8 @@ function st({
|
|
|
332
332
|
}
|
|
333
333
|
) : null;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
switch (
|
|
335
|
+
function ct(r, e) {
|
|
336
|
+
switch (r) {
|
|
337
337
|
case "google":
|
|
338
338
|
return e("auth.continue_with_google", "Continue with Google");
|
|
339
339
|
case "apple":
|
|
@@ -344,62 +344,62 @@ function at(t, e) {
|
|
|
344
344
|
return e("auth.continue_with_facebook", "Continue with Facebook");
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
const n = e === "signup" ?
|
|
349
|
-
if (!(
|
|
350
|
-
switch (
|
|
347
|
+
function fe(r, e, t) {
|
|
348
|
+
const n = e === "signup" ? t("auth.signup_failed", "Sign-up failed") : t("auth.signin_failed", "Sign-in failed");
|
|
349
|
+
if (!(r instanceof L)) return n;
|
|
350
|
+
switch (r.code) {
|
|
351
351
|
case "invalid_credentials":
|
|
352
|
-
return
|
|
352
|
+
return t("auth.invalid_credentials", "Invalid email or password");
|
|
353
353
|
case "email_not_confirmed":
|
|
354
|
-
return
|
|
354
|
+
return t("auth.email_not_confirmed", "Please confirm your email before signing in.");
|
|
355
355
|
case "email_exists":
|
|
356
356
|
case "user_already_exists":
|
|
357
|
-
return
|
|
357
|
+
return t("auth.email_exists", "An account with this email already exists.");
|
|
358
358
|
case "weak_password":
|
|
359
|
-
return
|
|
359
|
+
return t("auth.weak_password", "Password is too weak.");
|
|
360
360
|
case "invalid_otp":
|
|
361
361
|
case "otp_expired":
|
|
362
362
|
case "token_expired":
|
|
363
|
-
return
|
|
363
|
+
return t("auth.invalid_otp", "The code is invalid or has expired.");
|
|
364
364
|
case "over_email_send_rate_limit":
|
|
365
365
|
case "over_request_rate_limit":
|
|
366
366
|
case "rate_limited":
|
|
367
367
|
case "http_429":
|
|
368
|
-
return
|
|
368
|
+
return t("auth.rate_limited", "Too many requests. Please try again later.");
|
|
369
369
|
case "network_error":
|
|
370
|
-
return
|
|
370
|
+
return t("auth.network_error", "Network error. Please check your connection and try again.");
|
|
371
371
|
case "upstream":
|
|
372
372
|
case "upstream_error":
|
|
373
373
|
case "http_502":
|
|
374
374
|
case "http_503":
|
|
375
375
|
case "http_504":
|
|
376
|
-
return
|
|
376
|
+
return t("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
|
|
377
377
|
default:
|
|
378
378
|
return n;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
381
|
+
function Me({ block: r, ctx: e }) {
|
|
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
|
+
if (!t)
|
|
384
384
|
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
385
385
|
const c = n && !n.user.is_anonymous ? n : null;
|
|
386
|
-
return c && a ? null : c ? /* @__PURE__ */ o(
|
|
386
|
+
return c && a ? null : c ? /* @__PURE__ */ o(ut, { email: c.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
|
|
387
387
|
}) }) : /* @__PURE__ */ o(
|
|
388
|
-
|
|
388
|
+
dt,
|
|
389
389
|
{
|
|
390
|
-
block:
|
|
390
|
+
block: r,
|
|
391
391
|
allowSignup: i,
|
|
392
392
|
allowReset: s,
|
|
393
393
|
ctx: e
|
|
394
394
|
}
|
|
395
395
|
);
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
const { t
|
|
397
|
+
function ut({ email: r, onSignOut: e }) {
|
|
398
|
+
const { t } = S();
|
|
399
399
|
return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
|
|
400
400
|
/* @__PURE__ */ u("div", { class: "flex flex-col", children: [
|
|
401
|
-
/* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children:
|
|
402
|
-
/* @__PURE__ */ o("span", { class: "text-sm font-medium text-gray-900", children:
|
|
401
|
+
/* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: t("auth.signed_in", "Signed in") }),
|
|
402
|
+
/* @__PURE__ */ o("span", { class: "text-sm font-medium text-gray-900", children: r })
|
|
403
403
|
] }),
|
|
404
404
|
/* @__PURE__ */ o(
|
|
405
405
|
"button",
|
|
@@ -407,167 +407,167 @@ function lt({ email: t, onSignOut: e }) {
|
|
|
407
407
|
type: "button",
|
|
408
408
|
onClick: e,
|
|
409
409
|
class: "rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-600 transition-colors hover:bg-white hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
410
|
-
children:
|
|
410
|
+
children: t("auth.sign_out", "Sign out")
|
|
411
411
|
}
|
|
412
412
|
)
|
|
413
413
|
] });
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
const { t: i } =
|
|
417
|
-
|
|
415
|
+
function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
|
|
416
|
+
const { t: i } = S(), s = n.auth, a = r.providers ?? [], c = n.initialAuthMode === "signup" && e ? "signup" : "signin", [l, h] = k(c), [d, g] = k(""), [_, p] = k(""), [v, m] = k(""), [A, b] = k(""), [y, C] = k(null), I = D(!1), [U, M] = k(null), [O, j] = k(null), [R, T] = k(!1), [E, z] = k(null);
|
|
417
|
+
P(() => {
|
|
418
418
|
if (typeof s.getLastLogin != "function") return;
|
|
419
|
-
let
|
|
419
|
+
let f = !1;
|
|
420
420
|
return s.getLastLogin().then(
|
|
421
|
-
(
|
|
422
|
-
|
|
421
|
+
(w) => {
|
|
422
|
+
f || !w || (z(w), w.email && g((B) => B === "" ? w.email : B));
|
|
423
423
|
},
|
|
424
424
|
() => {
|
|
425
425
|
}
|
|
426
426
|
), () => {
|
|
427
|
-
|
|
427
|
+
f = !0;
|
|
428
428
|
};
|
|
429
429
|
}, [s]);
|
|
430
|
-
const q = (
|
|
431
|
-
f
|
|
432
|
-
}, Y = async (
|
|
433
|
-
if (
|
|
434
|
-
|
|
430
|
+
const q = (f) => {
|
|
431
|
+
h(f), M(null), j(null), T(!1);
|
|
432
|
+
}, Y = async (f) => {
|
|
433
|
+
if (f.preventDefault(), !(I.current || y)) {
|
|
434
|
+
I.current = !0;
|
|
435
435
|
try {
|
|
436
|
-
if (
|
|
437
|
-
if (!
|
|
438
|
-
|
|
436
|
+
if (M(null), j(null), l === "signup" && !R) {
|
|
437
|
+
if (!d.trim()) return;
|
|
438
|
+
T(!0);
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
if (l === "signup" &&
|
|
442
|
-
|
|
441
|
+
if (l === "signup" && _ !== v) {
|
|
442
|
+
M(i("auth.passwords_mismatch", "Passwords don't match"));
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
|
-
|
|
445
|
+
C("email");
|
|
446
446
|
try {
|
|
447
|
-
l === "signin" ? await s.signInWithEmail({ email:
|
|
447
|
+
l === "signin" ? await s.signInWithEmail({ email: d, password: _ }) : l === "signup" ? (await s.signUp({ email: d, password: _ })).kind === "confirmation_required" && (p(""), h("signup_verify"), j(i("auth.check_email_message", "Check your email for a confirmation code."))) : l === "forgot" ? (await s.requestPasswordReset({ email: d }), h("reset_sent"), j(
|
|
448
448
|
i("auth.reset_sent_message", "If that email exists, a reset code has been sent.")
|
|
449
|
-
)) : l === "signup_verify" ? await s.verifyOtp({ email:
|
|
450
|
-
email:
|
|
451
|
-
token:
|
|
452
|
-
type:
|
|
453
|
-
}),
|
|
454
|
-
} catch (
|
|
455
|
-
|
|
449
|
+
)) : l === "signup_verify" ? await s.verifyOtp({ email: d, token: A, type: "email" }) : l === "reset_verify" && (await s.verifyOtp({
|
|
450
|
+
email: d,
|
|
451
|
+
token: A,
|
|
452
|
+
type: _ ? "recovery" : "email"
|
|
453
|
+
}), _ && await s.updatePassword({ password: _ }));
|
|
454
|
+
} catch (w) {
|
|
455
|
+
M(fe(w, l === "signup" ? "signup" : l === "signup_verify" || l === "reset_verify" ? "otp" : l === "forgot" ? "reset" : "signin", i));
|
|
456
456
|
} finally {
|
|
457
|
-
|
|
457
|
+
C(null);
|
|
458
458
|
}
|
|
459
459
|
} finally {
|
|
460
|
-
|
|
460
|
+
I.current = !1;
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
},
|
|
464
|
-
if (!(
|
|
465
|
-
|
|
463
|
+
}, V = async (f) => {
|
|
464
|
+
if (!(I.current || y)) {
|
|
465
|
+
I.current = !0, C(f), M(null), j(null);
|
|
466
466
|
try {
|
|
467
467
|
await s.signInWithOAuth({
|
|
468
|
-
provider:
|
|
469
|
-
onPopupOpened: () =>
|
|
468
|
+
provider: f,
|
|
469
|
+
onPopupOpened: () => C(null)
|
|
470
470
|
});
|
|
471
|
-
} catch (
|
|
472
|
-
if (
|
|
471
|
+
} catch (w) {
|
|
472
|
+
if (w instanceof L && (w.code === "oauth_cancelled" || w.code === "oauth_timeout"))
|
|
473
473
|
return;
|
|
474
|
-
|
|
474
|
+
M(fe(w, "signin", i));
|
|
475
475
|
} finally {
|
|
476
|
-
|
|
476
|
+
I.current = !1, C(null);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
},
|
|
479
|
+
}, K = a.length > 0 && (l === "signin" || l === "signup"), X = l === "signin" || l === "signup" || l === "forgot", x = l === "signin" || l === "signup" && R;
|
|
480
480
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
|
|
481
|
-
/* @__PURE__ */ o(
|
|
482
|
-
|
|
483
|
-
a.map((
|
|
481
|
+
/* @__PURE__ */ o(ht, { mode: l, customHeading: r.heading, customSubheading: r.subheading }),
|
|
482
|
+
K ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2.5", children: [
|
|
483
|
+
a.map((f) => /* @__PURE__ */ u("div", { class: "relative", children: [
|
|
484
484
|
/* @__PURE__ */ u(
|
|
485
485
|
"button",
|
|
486
486
|
{
|
|
487
487
|
type: "button",
|
|
488
|
-
onClick: () =>
|
|
489
|
-
disabled:
|
|
488
|
+
onClick: () => V(f),
|
|
489
|
+
disabled: y !== null,
|
|
490
490
|
class: "flex h-12 w-full items-center justify-center gap-2.5 rounded-full border-1 border-gray-200 bg-white px-5 text-base font-medium text-gray-900 transition-all hover:border-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
491
491
|
children: [
|
|
492
|
-
|
|
493
|
-
/* @__PURE__ */ o("span", { children:
|
|
492
|
+
y === f ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ o(vt, { provider: f }),
|
|
493
|
+
/* @__PURE__ */ o("span", { children: ct(f, i) })
|
|
494
494
|
]
|
|
495
495
|
}
|
|
496
496
|
),
|
|
497
|
-
|
|
498
|
-
] },
|
|
499
|
-
/* @__PURE__ */ o(
|
|
497
|
+
E?.method === f ? /* @__PURE__ */ o(xt, { email: E.email }) : null
|
|
498
|
+
] }, f)),
|
|
499
|
+
/* @__PURE__ */ o(kt, {})
|
|
500
500
|
] }) : null,
|
|
501
501
|
/* @__PURE__ */ u("form", { onSubmit: Y, class: "flex flex-col gap-3", children: [
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
X && /* @__PURE__ */ o(
|
|
503
|
+
ge,
|
|
504
504
|
{
|
|
505
505
|
type: "email",
|
|
506
506
|
placeholder: i("auth.email", "Email address"),
|
|
507
|
-
value:
|
|
508
|
-
onInput:
|
|
507
|
+
value: d,
|
|
508
|
+
onInput: g,
|
|
509
509
|
autocomplete: "email",
|
|
510
510
|
required: !0
|
|
511
511
|
}
|
|
512
512
|
),
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
x && /* @__PURE__ */ o(
|
|
514
|
+
re,
|
|
515
515
|
{
|
|
516
516
|
placeholder: i("auth.password", "Password"),
|
|
517
|
-
value:
|
|
518
|
-
onInput:
|
|
517
|
+
value: _,
|
|
518
|
+
onInput: p,
|
|
519
519
|
autocomplete: l === "signin" ? "current-password" : "new-password",
|
|
520
520
|
required: !0
|
|
521
521
|
}
|
|
522
522
|
),
|
|
523
|
-
l === "signup" &&
|
|
524
|
-
|
|
523
|
+
l === "signup" && R && /* @__PURE__ */ o(
|
|
524
|
+
re,
|
|
525
525
|
{
|
|
526
526
|
placeholder: i("auth.repeat_password", "Repeat password"),
|
|
527
527
|
value: v,
|
|
528
|
-
onInput:
|
|
528
|
+
onInput: m,
|
|
529
529
|
autocomplete: "new-password",
|
|
530
530
|
required: !0
|
|
531
531
|
}
|
|
532
532
|
),
|
|
533
533
|
(l === "signup_verify" || l === "reset_verify") && /* @__PURE__ */ o(
|
|
534
|
-
|
|
534
|
+
ge,
|
|
535
535
|
{
|
|
536
536
|
type: "text",
|
|
537
537
|
placeholder: i("auth.confirmation_code", "Confirmation code"),
|
|
538
|
-
value:
|
|
539
|
-
onInput:
|
|
538
|
+
value: A,
|
|
539
|
+
onInput: b,
|
|
540
540
|
autocomplete: "one-time-code",
|
|
541
541
|
inputMode: "numeric",
|
|
542
542
|
required: !0
|
|
543
543
|
}
|
|
544
544
|
),
|
|
545
545
|
l === "reset_verify" && /* @__PURE__ */ o(
|
|
546
|
-
|
|
546
|
+
re,
|
|
547
547
|
{
|
|
548
548
|
placeholder: i(
|
|
549
549
|
"auth.new_password_optional",
|
|
550
550
|
"New password (optional — only for password reset)"
|
|
551
551
|
),
|
|
552
|
-
value:
|
|
553
|
-
onInput:
|
|
552
|
+
value: _,
|
|
553
|
+
onInput: p,
|
|
554
554
|
autocomplete: "new-password"
|
|
555
555
|
}
|
|
556
556
|
),
|
|
557
|
-
l === "reset_sent" &&
|
|
558
|
-
l === "signin" &&
|
|
559
|
-
|
|
560
|
-
|
|
557
|
+
l === "reset_sent" && O && /* @__PURE__ */ o("p", { class: "rounded-2xl bg-gray-100 px-4 py-3 text-sm text-gray-600", children: O }),
|
|
558
|
+
l === "signin" && t && /* @__PURE__ */ o("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ o(Z, { onClick: () => q("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
|
|
559
|
+
U && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: U }),
|
|
560
|
+
O && l !== "reset_sent" && /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: O }),
|
|
561
561
|
l !== "reset_sent" && /* @__PURE__ */ o(
|
|
562
|
-
|
|
562
|
+
mt,
|
|
563
563
|
{
|
|
564
|
-
busy:
|
|
565
|
-
label:
|
|
564
|
+
busy: y === "email",
|
|
565
|
+
label: ft(l, R, r.submit_label ?? r.heading, i)
|
|
566
566
|
}
|
|
567
567
|
)
|
|
568
568
|
] }),
|
|
569
569
|
/* @__PURE__ */ o(
|
|
570
|
-
|
|
570
|
+
gt,
|
|
571
571
|
{
|
|
572
572
|
mode: l,
|
|
573
573
|
allowSignup: e,
|
|
@@ -576,19 +576,19 @@ function ct({ block: t, allowSignup: e, allowReset: r, ctx: n }) {
|
|
|
576
576
|
)
|
|
577
577
|
] });
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
mode:
|
|
579
|
+
function ht({
|
|
580
|
+
mode: r,
|
|
581
581
|
customHeading: e,
|
|
582
|
-
customSubheading:
|
|
582
|
+
customSubheading: t
|
|
583
583
|
}) {
|
|
584
|
-
const { t: n } =
|
|
584
|
+
const { t: n } = S(), i = pt(r, n), s = r === "signin" || r === "signup", a = s && e ? e : i.title, c = s && t !== void 0 ? t || null : i.subtitle;
|
|
585
585
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
586
586
|
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a }),
|
|
587
587
|
c ? /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: c }) : null
|
|
588
588
|
] });
|
|
589
589
|
}
|
|
590
|
-
function
|
|
591
|
-
switch (
|
|
590
|
+
function pt(r, e) {
|
|
591
|
+
switch (r) {
|
|
592
592
|
case "signin":
|
|
593
593
|
return {
|
|
594
594
|
title: e("auth.welcome", "Welcome back!"),
|
|
@@ -630,9 +630,9 @@ function dt(t, e) {
|
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
if (
|
|
635
|
-
switch (
|
|
633
|
+
function ft(r, e, t, n) {
|
|
634
|
+
if (r === "signin" && t) return t;
|
|
635
|
+
switch (r) {
|
|
636
636
|
case "signin":
|
|
637
637
|
return n("auth.log_in", "Sign In");
|
|
638
638
|
case "signup":
|
|
@@ -646,62 +646,62 @@ function ht(t, e, r, n) {
|
|
|
646
646
|
return n("cta.continue", "Continue");
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
function
|
|
650
|
-
mode:
|
|
649
|
+
function gt({
|
|
650
|
+
mode: r,
|
|
651
651
|
allowSignup: e,
|
|
652
|
-
onSwitch:
|
|
652
|
+
onSwitch: t
|
|
653
653
|
}) {
|
|
654
|
-
const { t: n } =
|
|
655
|
-
return
|
|
654
|
+
const { t: n } = S();
|
|
655
|
+
return r === "signin" && e ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
656
656
|
n("auth.no_account", "Don't have an account?"),
|
|
657
657
|
" ",
|
|
658
|
-
/* @__PURE__ */ o(Z, { onClick: () =>
|
|
659
|
-
] }) :
|
|
658
|
+
/* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
659
|
+
] }) : r === "signup" || r === "signup_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
660
660
|
n("auth.have_account", "Already have an account?"),
|
|
661
661
|
" ",
|
|
662
|
-
/* @__PURE__ */ o(Z, { onClick: () =>
|
|
663
|
-
] }) :
|
|
662
|
+
/* @__PURE__ */ o(Z, { onClick: () => t("signin"), children: n("auth.log_in_link", "Log In") })
|
|
663
|
+
] }) : r === "forgot" || r === "reset_sent" || r === "reset_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
664
664
|
n("auth.no_account", "Don't have an account?"),
|
|
665
665
|
" ",
|
|
666
|
-
/* @__PURE__ */ o(Z, { onClick: () =>
|
|
666
|
+
/* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
667
667
|
] }) : null;
|
|
668
668
|
}
|
|
669
669
|
function Z({
|
|
670
|
-
onClick:
|
|
670
|
+
onClick: r,
|
|
671
671
|
children: e
|
|
672
672
|
}) {
|
|
673
673
|
return /* @__PURE__ */ o(
|
|
674
674
|
"button",
|
|
675
675
|
{
|
|
676
676
|
type: "button",
|
|
677
|
-
onClick:
|
|
677
|
+
onClick: r,
|
|
678
678
|
class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
|
|
679
679
|
style: { color: "var(--pw-accent)" },
|
|
680
680
|
children: e
|
|
681
681
|
}
|
|
682
682
|
);
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function mt({ busy: r, label: e }) {
|
|
685
685
|
return /* @__PURE__ */ o(
|
|
686
686
|
"button",
|
|
687
687
|
{
|
|
688
688
|
type: "submit",
|
|
689
|
-
disabled:
|
|
689
|
+
disabled: r,
|
|
690
690
|
class: "pw-cta-shimmer relative mt-1 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] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
691
691
|
style: {
|
|
692
692
|
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%)",
|
|
693
693
|
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)"
|
|
694
694
|
},
|
|
695
|
-
children:
|
|
695
|
+
children: r ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: e })
|
|
696
696
|
}
|
|
697
697
|
);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function ge({ type: r, placeholder: e, value: t, onInput: n, autocomplete: i, inputMode: s, required: a }) {
|
|
700
700
|
return /* @__PURE__ */ o(
|
|
701
701
|
"input",
|
|
702
702
|
{
|
|
703
|
-
type:
|
|
704
|
-
value:
|
|
703
|
+
type: r,
|
|
704
|
+
value: t,
|
|
705
705
|
placeholder: e,
|
|
706
706
|
onInput: (c) => n(c.target.value),
|
|
707
707
|
autocomplete: i,
|
|
@@ -711,13 +711,13 @@ function fe({ type: t, placeholder: e, value: r, onInput: n, autocomplete: i, in
|
|
|
711
711
|
}
|
|
712
712
|
);
|
|
713
713
|
}
|
|
714
|
-
function
|
|
715
|
-
const { t: s } =
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
|
|
714
|
+
function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i }) {
|
|
715
|
+
const { t: s } = S(), [a, c] = k(!1), l = D(null);
|
|
716
|
+
P(() => {
|
|
717
|
+
const g = l.current;
|
|
718
|
+
g && g.value !== e && (g.value = e);
|
|
719
719
|
}, [a, e]);
|
|
720
|
-
const
|
|
720
|
+
const h = s("auth.show_password", "Show password"), d = s("auth.hide_password", "Hide password");
|
|
721
721
|
return /* @__PURE__ */ u("div", { class: "relative", children: [
|
|
722
722
|
/* @__PURE__ */ o(
|
|
723
723
|
"input",
|
|
@@ -725,8 +725,8 @@ function te({ placeholder: t, value: e, onInput: r, autocomplete: n, required: i
|
|
|
725
725
|
ref: l,
|
|
726
726
|
type: a ? "text" : "password",
|
|
727
727
|
value: e,
|
|
728
|
-
placeholder:
|
|
729
|
-
onInput: (
|
|
728
|
+
placeholder: r,
|
|
729
|
+
onInput: (g) => t(g.target.value),
|
|
730
730
|
autocomplete: n,
|
|
731
731
|
required: i,
|
|
732
732
|
class: "h-14 w-full rounded-2xl bg-gray-100 pl-5 pr-12 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
|
|
@@ -736,16 +736,16 @@ function te({ placeholder: t, value: e, onInput: r, autocomplete: n, required: i
|
|
|
736
736
|
"button",
|
|
737
737
|
{
|
|
738
738
|
type: "button",
|
|
739
|
-
onClick: () => c((
|
|
740
|
-
"aria-label": a ?
|
|
739
|
+
onClick: () => c((g) => !g),
|
|
740
|
+
"aria-label": a ? d : h,
|
|
741
741
|
tabIndex: -1,
|
|
742
742
|
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)]",
|
|
743
|
-
children: a ? /* @__PURE__ */ o(
|
|
743
|
+
children: a ? /* @__PURE__ */ o(bt, {}) : /* @__PURE__ */ o(yt, {})
|
|
744
744
|
}
|
|
745
745
|
)
|
|
746
746
|
] });
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function yt() {
|
|
749
749
|
return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
750
750
|
/* @__PURE__ */ o(
|
|
751
751
|
"path",
|
|
@@ -760,7 +760,7 @@ function gt() {
|
|
|
760
760
|
/* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
|
|
761
761
|
] });
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function bt() {
|
|
764
764
|
return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
765
765
|
/* @__PURE__ */ o(
|
|
766
766
|
"path",
|
|
@@ -784,64 +784,64 @@ function mt() {
|
|
|
784
784
|
)
|
|
785
785
|
] });
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
const { t: e } =
|
|
789
|
-
return /* @__PURE__ */ o("span", { class: "pointer-events-none absolute -top-2 right-3 max-w-[75%] truncate rounded-full bg-gray-900 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white shadow-sm", children:
|
|
787
|
+
function xt({ email: r }) {
|
|
788
|
+
const { t: e } = S(), t = r ? e("auth.last_used", "Last · {email}", { email: wt(r) }) : e("auth.last_used_no_email", "Last");
|
|
789
|
+
return /* @__PURE__ */ o("span", { class: "pointer-events-none absolute -top-2 right-3 max-w-[75%] truncate rounded-full bg-gray-900 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white shadow-sm", children: t });
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
const [e,
|
|
793
|
-
return
|
|
791
|
+
function wt(r) {
|
|
792
|
+
const [e, t] = r.split("@");
|
|
793
|
+
return t ? `${e.slice(0, 3)}*****@${t}` : r;
|
|
794
794
|
}
|
|
795
|
-
function
|
|
796
|
-
const { t } =
|
|
795
|
+
function kt() {
|
|
796
|
+
const { t: r } = S();
|
|
797
797
|
return /* @__PURE__ */ u("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
|
|
798
798
|
/* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" }),
|
|
799
|
-
/* @__PURE__ */ o("span", { children:
|
|
799
|
+
/* @__PURE__ */ o("span", { children: r("auth.or", "or") }),
|
|
800
800
|
/* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" })
|
|
801
801
|
] });
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
return
|
|
803
|
+
function vt({ provider: r }) {
|
|
804
|
+
return r === "google" ? /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
|
|
805
805
|
/* @__PURE__ */ o("path", { fill: "#4285F4", d: "M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.49h4.84a4.14 4.14 0 0 1-1.79 2.71v2.26h2.9c1.7-1.56 2.69-3.87 2.69-6.62Z" }),
|
|
806
806
|
/* @__PURE__ */ o("path", { fill: "#34A853", d: "M9 18c2.43 0 4.47-.8 5.96-2.18l-2.9-2.26c-.8.54-1.83.86-3.06.86-2.36 0-4.36-1.59-5.07-3.74H.92v2.33A9 9 0 0 0 9 18Z" }),
|
|
807
807
|
/* @__PURE__ */ o("path", { fill: "#FBBC05", d: "M3.93 10.68a5.4 5.4 0 0 1 0-3.36V4.99H.92a9 9 0 0 0 0 8.02l3-2.33Z" }),
|
|
808
808
|
/* @__PURE__ */ o("path", { fill: "#EA4335", d: "M9 3.58c1.32 0 2.5.45 3.44 1.34l2.58-2.58A9 9 0 0 0 .92 4.99l3.01 2.33C4.64 5.17 6.64 3.58 9 3.58Z" })
|
|
809
|
-
] }) :
|
|
809
|
+
] }) : r === "apple" ? (
|
|
810
810
|
// viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
|
|
811
811
|
// Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
|
|
812
812
|
// width/height — 26×26 даёт примерно equal optical size с Google 20×20.
|
|
813
813
|
/* @__PURE__ */ o("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) })
|
|
814
|
-
) :
|
|
814
|
+
) : 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
815
|
}
|
|
816
|
-
function
|
|
817
|
-
block:
|
|
816
|
+
function _t({
|
|
817
|
+
block: r,
|
|
818
818
|
bootstrap: e,
|
|
819
|
-
auth:
|
|
819
|
+
auth: t,
|
|
820
820
|
authSession: n,
|
|
821
821
|
onBack: i,
|
|
822
822
|
showBack: s = !0,
|
|
823
823
|
intent: a = "preauth",
|
|
824
824
|
initialMode: c
|
|
825
825
|
}) {
|
|
826
|
-
const { t: l } =
|
|
826
|
+
const { t: l } = S(), h = {
|
|
827
827
|
bootstrap: e,
|
|
828
828
|
selectedPriceId: null,
|
|
829
829
|
setSelectedPriceId: () => {
|
|
830
830
|
},
|
|
831
831
|
onAction: () => {
|
|
832
832
|
},
|
|
833
|
-
auth:
|
|
833
|
+
auth: t,
|
|
834
834
|
authSession: n,
|
|
835
835
|
initialAuthMode: c
|
|
836
|
-
},
|
|
837
|
-
...
|
|
836
|
+
}, d = a === "restore" ? {
|
|
837
|
+
...r,
|
|
838
838
|
heading: l("auth.restore_purchases_heading", "Restore Purchases"),
|
|
839
839
|
subheading: l(
|
|
840
840
|
"auth.restore_purchases_subheading",
|
|
841
841
|
"Please sign in to restore your purchases."
|
|
842
842
|
)
|
|
843
843
|
} : a === "preauth" ? {
|
|
844
|
-
...
|
|
844
|
+
...r,
|
|
845
845
|
heading: l("auth.login_continue_purchase", "Log in to continue your purchase"),
|
|
846
846
|
subheading: l(
|
|
847
847
|
"auth.link_purchase_subheading",
|
|
@@ -852,18 +852,18 @@ function kt({
|
|
|
852
852
|
// чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
|
|
853
853
|
// переносятся на 2 строки. Явный короткий submit_label решает.
|
|
854
854
|
submit_label: l("auth.log_in", "Sign In")
|
|
855
|
-
} :
|
|
855
|
+
} : r;
|
|
856
856
|
return /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
|
|
857
|
-
s ? /* @__PURE__ */ o(
|
|
858
|
-
/* @__PURE__ */ o(
|
|
857
|
+
s ? /* @__PURE__ */ o(St, { onClick: i, ariaLabel: l("nav.back_aria", "Back") }) : null,
|
|
858
|
+
/* @__PURE__ */ o(Me, { block: d, ctx: h })
|
|
859
859
|
] });
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function St({ onClick: r, ariaLabel: e }) {
|
|
862
862
|
return /* @__PURE__ */ o(
|
|
863
863
|
"button",
|
|
864
864
|
{
|
|
865
865
|
type: "button",
|
|
866
|
-
onClick:
|
|
866
|
+
onClick: r,
|
|
867
867
|
"aria-label": e,
|
|
868
868
|
class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
869
869
|
children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
@@ -891,9 +891,9 @@ function vt({ onClick: t, ariaLabel: e }) {
|
|
|
891
891
|
}
|
|
892
892
|
);
|
|
893
893
|
}
|
|
894
|
-
const
|
|
895
|
-
function
|
|
896
|
-
const e =
|
|
894
|
+
const Ee = (r) => `pw-offer-${r}-start`;
|
|
895
|
+
function ne(r) {
|
|
896
|
+
const e = r - Date.now();
|
|
897
897
|
return e <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
|
|
898
898
|
days: Math.floor(e / (1e3 * 60 * 60 * 24)),
|
|
899
899
|
hours: Math.floor(e % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
|
|
@@ -902,56 +902,56 @@ function re(t) {
|
|
|
902
902
|
expired: !1
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
|
-
function
|
|
906
|
-
if (
|
|
907
|
-
const e = Date.parse(
|
|
905
|
+
function Ct(r) {
|
|
906
|
+
if (r.expires_at) {
|
|
907
|
+
const e = Date.parse(r.expires_at);
|
|
908
908
|
return Number.isFinite(e) ? e : null;
|
|
909
909
|
}
|
|
910
|
-
if (
|
|
910
|
+
if (r.duration_minutes && r.duration_minutes > 0) {
|
|
911
911
|
if (typeof window > "u") return null;
|
|
912
912
|
try {
|
|
913
|
-
const e =
|
|
914
|
-
let
|
|
915
|
-
return
|
|
913
|
+
const e = Ee(r.id);
|
|
914
|
+
let t = window.localStorage.getItem(e);
|
|
915
|
+
return t || (t = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(e, t)), Date.parse(t) + r.duration_minutes * 6e4;
|
|
916
916
|
} catch {
|
|
917
917
|
return null;
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
return null;
|
|
921
921
|
}
|
|
922
|
-
function
|
|
923
|
-
if (!
|
|
922
|
+
function Te(r, e) {
|
|
923
|
+
if (!r || r.length === 0) return null;
|
|
924
924
|
if (e) {
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
925
|
+
const t = r.find((n) => n.id === e);
|
|
926
|
+
if (t) return t;
|
|
927
927
|
}
|
|
928
|
-
return
|
|
928
|
+
return r.find((t) => t.expires_at || t.duration_minutes) ?? null;
|
|
929
929
|
}
|
|
930
|
-
function
|
|
931
|
-
const e =
|
|
932
|
-
() => e !== null ?
|
|
933
|
-
), i =
|
|
934
|
-
return i.current = e,
|
|
930
|
+
function Be(r) {
|
|
931
|
+
const e = r ? Ct(r) : null, [t, n] = k(
|
|
932
|
+
() => e !== null ? ne(e) : null
|
|
933
|
+
), i = D(e);
|
|
934
|
+
return i.current = e, P(() => {
|
|
935
935
|
if (e === null) {
|
|
936
936
|
n(null);
|
|
937
937
|
return;
|
|
938
938
|
}
|
|
939
|
-
n(
|
|
939
|
+
n(ne(e));
|
|
940
940
|
const s = setInterval(() => {
|
|
941
|
-
const a =
|
|
942
|
-
if (n(a), a.expired && (clearInterval(s),
|
|
941
|
+
const a = ne(i.current ?? 0);
|
|
942
|
+
if (n(a), a.expired && (clearInterval(s), r?.duration_minutes && typeof window < "u"))
|
|
943
943
|
try {
|
|
944
|
-
window.localStorage.removeItem(
|
|
944
|
+
window.localStorage.removeItem(Ee(r.id));
|
|
945
945
|
} catch {
|
|
946
946
|
}
|
|
947
947
|
}, 1e3);
|
|
948
948
|
return () => clearInterval(s);
|
|
949
|
-
}, [e,
|
|
949
|
+
}, [e, r?.duration_minutes, r?.id]), t;
|
|
950
950
|
}
|
|
951
|
-
function
|
|
952
|
-
const { t
|
|
953
|
-
if (!n || i === null || i.expired && !
|
|
954
|
-
const s =
|
|
951
|
+
function It({ block: r, ctx: e }) {
|
|
952
|
+
const { t } = S(), n = Te(e.bootstrap.offers, r.offer_id), i = Be(n);
|
|
953
|
+
if (!n || i === null || i.expired && !r.force) return null;
|
|
954
|
+
const s = r.title ?? n.label ?? t("offer.limited_time", "Limited-time offer"), a = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
|
|
955
955
|
return /* @__PURE__ */ u(
|
|
956
956
|
"div",
|
|
957
957
|
{
|
|
@@ -962,34 +962,34 @@ function St({ block: t, ctx: e }) {
|
|
|
962
962
|
},
|
|
963
963
|
role: "status",
|
|
964
964
|
children: [
|
|
965
|
-
/* @__PURE__ */ o(
|
|
965
|
+
/* @__PURE__ */ o(Oe, {}),
|
|
966
966
|
/* @__PURE__ */ o("span", { children: a }),
|
|
967
|
-
/* @__PURE__ */ o(
|
|
967
|
+
/* @__PURE__ */ o(Pe, { value: i, t })
|
|
968
968
|
]
|
|
969
969
|
}
|
|
970
970
|
);
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function Pe({ value: r, t: e }) {
|
|
973
973
|
return /* @__PURE__ */ u("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
|
|
974
|
-
|
|
975
|
-
/* @__PURE__ */ o(H, { children: String(
|
|
974
|
+
r.days > 0 ? /* @__PURE__ */ u(ae, { children: [
|
|
975
|
+
/* @__PURE__ */ o(H, { children: String(r.days) }),
|
|
976
976
|
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.d", "d") })
|
|
977
977
|
] }) : null,
|
|
978
|
-
/* @__PURE__ */ o(H, { children: String(
|
|
978
|
+
/* @__PURE__ */ o(H, { children: String(r.hours).padStart(2, "0") }),
|
|
979
979
|
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.h", "h") }),
|
|
980
|
-
/* @__PURE__ */ o(H, { children: String(
|
|
980
|
+
/* @__PURE__ */ o(H, { children: String(r.minutes).padStart(2, "0") }),
|
|
981
981
|
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.m", "m") }),
|
|
982
|
-
/* @__PURE__ */ o(H, { children: String(
|
|
982
|
+
/* @__PURE__ */ o(H, { children: String(r.seconds).padStart(2, "0") }),
|
|
983
983
|
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.s", "s") })
|
|
984
984
|
] });
|
|
985
985
|
}
|
|
986
|
-
function H({ children:
|
|
987
|
-
return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children:
|
|
986
|
+
function H({ children: r }) {
|
|
987
|
+
return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: r });
|
|
988
988
|
}
|
|
989
|
-
function
|
|
990
|
-
const { t: e } =
|
|
991
|
-
if (
|
|
992
|
-
const n =
|
|
989
|
+
function At({ offer: r }) {
|
|
990
|
+
const { t: e } = S(), t = Be(r);
|
|
991
|
+
if (t === null || t.expired) return null;
|
|
992
|
+
const n = r.label ?? e("offer.limited_time", "Limited-time offer"), i = r.discount_percent ? `${n} ${r.discount_percent}%` : n;
|
|
993
993
|
return /* @__PURE__ */ u(
|
|
994
994
|
"div",
|
|
995
995
|
{
|
|
@@ -1000,14 +1000,14 @@ function Ct({ offer: t }) {
|
|
|
1000
1000
|
},
|
|
1001
1001
|
role: "status",
|
|
1002
1002
|
children: [
|
|
1003
|
-
/* @__PURE__ */ o(
|
|
1003
|
+
/* @__PURE__ */ o(Oe, {}),
|
|
1004
1004
|
/* @__PURE__ */ o("span", { children: i }),
|
|
1005
|
-
/* @__PURE__ */ o(
|
|
1005
|
+
/* @__PURE__ */ o(Pe, { value: t, t: e })
|
|
1006
1006
|
]
|
|
1007
1007
|
}
|
|
1008
1008
|
);
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Oe() {
|
|
1011
1011
|
return /* @__PURE__ */ o(
|
|
1012
1012
|
"svg",
|
|
1013
1013
|
{
|
|
@@ -1026,39 +1026,39 @@ function Be() {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
);
|
|
1028
1028
|
}
|
|
1029
|
-
const
|
|
1030
|
-
function
|
|
1031
|
-
const { t: i } =
|
|
1032
|
-
const
|
|
1033
|
-
return
|
|
1034
|
-
min:
|
|
1035
|
-
max: me
|
|
1036
|
-
})), (q.length < 1 || q.length > ye) && (P.message = i("support.message_length", "{min}–{max} characters", {
|
|
1037
|
-
min: 1,
|
|
1029
|
+
const me = 3, ye = 200, be = 5e3, ie = 5, Lt = 10 * 1024 * 1024, xe = ["image/jpeg", "image/png", "image/webp"], Mt = /.+@.+\..+/;
|
|
1030
|
+
function Et({ client: r, authSession: e, origin: t, onBack: n }) {
|
|
1031
|
+
const { t: i } = S(), s = e?.user.email ?? "", a = s || null, [c, l] = k(s), [h, d] = k(""), [g, _] = k(""), [p, v] = k([]), [m, A] = k(!1), [b, y] = k(null), [C, I] = k({}), U = () => {
|
|
1032
|
+
const T = {}, E = (a ?? c).trim(), z = h.trim(), q = g.trim();
|
|
1033
|
+
return E ? Mt.test(E.toLowerCase()) || (T.email = i("support.invalid_email", "Invalid email")) : T.email = i("support.required", "Required"), (z.length < me || z.length > ye) && (T.subject = i("support.subject_length", "{min}–{max} characters", {
|
|
1034
|
+
min: me,
|
|
1038
1035
|
max: ye
|
|
1039
|
-
})),
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1036
|
+
})), (q.length < 1 || q.length > be) && (T.message = i("support.message_length", "{min}–{max} characters", {
|
|
1037
|
+
min: 1,
|
|
1038
|
+
max: be
|
|
1039
|
+
})), I(T), Object.keys(T).length === 0;
|
|
1040
|
+
}, M = async (T) => {
|
|
1041
|
+
if (T.preventDefault(), !m && U()) {
|
|
1042
|
+
A(!0), I((E) => ({ ...E, submit: void 0 }));
|
|
1043
1043
|
try {
|
|
1044
|
-
const
|
|
1045
|
-
await
|
|
1046
|
-
subject:
|
|
1047
|
-
content:
|
|
1048
|
-
email:
|
|
1049
|
-
files:
|
|
1050
|
-
}),
|
|
1051
|
-
} catch (
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1044
|
+
const E = (a ?? c).trim();
|
|
1045
|
+
await r.createSupportTicket({
|
|
1046
|
+
subject: h.trim(),
|
|
1047
|
+
content: g.trim(),
|
|
1048
|
+
email: E || void 0,
|
|
1049
|
+
files: p.length > 0 ? p : void 0
|
|
1050
|
+
}), y(E);
|
|
1051
|
+
} catch (E) {
|
|
1052
|
+
const z = E instanceof L && E.message || "Failed to send. Please try again.";
|
|
1053
|
+
I((q) => ({ ...q, submit: z }));
|
|
1054
1054
|
} finally {
|
|
1055
|
-
|
|
1055
|
+
A(!1);
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
},
|
|
1059
|
-
|
|
1060
|
-
},
|
|
1061
|
-
return
|
|
1058
|
+
}, O = () => {
|
|
1059
|
+
d(""), _(""), v([]), I({}), y(null);
|
|
1060
|
+
}, j = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", R = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
|
|
1061
|
+
return b ? /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1062
1062
|
/* @__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
1063
|
/* @__PURE__ */ o(
|
|
1064
1064
|
"div",
|
|
@@ -1086,25 +1086,25 @@ function Lt({ client: t, authSession: e, origin: r, onBack: n }) {
|
|
|
1086
1086
|
"We've received your message and will respond to"
|
|
1087
1087
|
),
|
|
1088
1088
|
" ",
|
|
1089
|
-
/* @__PURE__ */ o("b", { class: "text-gray-700", children:
|
|
1089
|
+
/* @__PURE__ */ o("b", { class: "text-gray-700", children: b }),
|
|
1090
1090
|
"."
|
|
1091
1091
|
] })
|
|
1092
1092
|
] }),
|
|
1093
|
-
/* @__PURE__ */ o("div", { class:
|
|
1093
|
+
/* @__PURE__ */ o("div", { class: j, style: R, children: /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1094
1094
|
/* @__PURE__ */ o(
|
|
1095
1095
|
"button",
|
|
1096
1096
|
{
|
|
1097
1097
|
type: "button",
|
|
1098
1098
|
onClick: n,
|
|
1099
1099
|
class: "rounded-xl px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1100
|
-
children:
|
|
1100
|
+
children: t === "standalone" ? i("support.done_button", "Done") : i("nav.back_aria", "Back")
|
|
1101
1101
|
}
|
|
1102
1102
|
),
|
|
1103
1103
|
/* @__PURE__ */ o(
|
|
1104
1104
|
"button",
|
|
1105
1105
|
{
|
|
1106
1106
|
type: "button",
|
|
1107
|
-
onClick:
|
|
1107
|
+
onClick: O,
|
|
1108
1108
|
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
1109
|
style: {
|
|
1110
1110
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
@@ -1114,8 +1114,8 @@ function Lt({ client: t, authSession: e, origin: r, onBack: n }) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
)
|
|
1116
1116
|
] }) })
|
|
1117
|
-
] }) : /* @__PURE__ */ u("form", { onSubmit:
|
|
1118
|
-
/* @__PURE__ */ o(
|
|
1117
|
+
] }) : /* @__PURE__ */ u("form", { onSubmit: M, class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1118
|
+
/* @__PURE__ */ o(Tt, { onClick: n, ariaLabel: i("nav.back_aria", "Back") }),
|
|
1119
1119
|
/* @__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
1120
|
/* @__PURE__ */ u("div", { class: "flex flex-col gap-2 pr-10", children: [
|
|
1121
1121
|
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
|
|
@@ -1127,77 +1127,77 @@ function Lt({ client: t, authSession: e, origin: r, onBack: n }) {
|
|
|
1127
1127
|
" ",
|
|
1128
1128
|
/* @__PURE__ */ o("b", { class: "font-medium text-gray-900", children: a })
|
|
1129
1129
|
] }) : /* @__PURE__ */ o(
|
|
1130
|
-
|
|
1130
|
+
we,
|
|
1131
1131
|
{
|
|
1132
1132
|
type: "email",
|
|
1133
1133
|
placeholder: i("support.email_placeholder", "Enter your email *"),
|
|
1134
1134
|
value: c,
|
|
1135
1135
|
onInput: l,
|
|
1136
|
-
error:
|
|
1136
|
+
error: C.email,
|
|
1137
1137
|
autocomplete: "email",
|
|
1138
1138
|
required: !0
|
|
1139
1139
|
}
|
|
1140
1140
|
),
|
|
1141
1141
|
/* @__PURE__ */ o(
|
|
1142
|
-
|
|
1142
|
+
we,
|
|
1143
1143
|
{
|
|
1144
1144
|
type: "text",
|
|
1145
1145
|
placeholder: i("support.subject_placeholder", "Enter your subject *"),
|
|
1146
|
-
value:
|
|
1147
|
-
onInput:
|
|
1148
|
-
error:
|
|
1146
|
+
value: h,
|
|
1147
|
+
onInput: d,
|
|
1148
|
+
error: C.subject,
|
|
1149
1149
|
required: !0
|
|
1150
1150
|
}
|
|
1151
1151
|
),
|
|
1152
1152
|
/* @__PURE__ */ o(
|
|
1153
|
-
|
|
1153
|
+
Bt,
|
|
1154
1154
|
{
|
|
1155
1155
|
placeholder: i("support.message_placeholder", "Enter your message *"),
|
|
1156
|
-
value:
|
|
1157
|
-
onInput:
|
|
1158
|
-
error:
|
|
1156
|
+
value: g,
|
|
1157
|
+
onInput: _,
|
|
1158
|
+
error: C.message,
|
|
1159
1159
|
required: !0
|
|
1160
1160
|
}
|
|
1161
1161
|
),
|
|
1162
|
-
/* @__PURE__ */ o(Pt, { files:
|
|
1162
|
+
/* @__PURE__ */ o(Pt, { files: p, onChange: v, disabled: m })
|
|
1163
1163
|
] })
|
|
1164
1164
|
] }) }),
|
|
1165
|
-
/* @__PURE__ */ u("div", { class:
|
|
1166
|
-
|
|
1165
|
+
/* @__PURE__ */ u("div", { class: j, style: R, children: [
|
|
1166
|
+
C.submit && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: C.submit }),
|
|
1167
1167
|
/* @__PURE__ */ u("div", { class: "flex items-center justify-end gap-3", children: [
|
|
1168
1168
|
/* @__PURE__ */ o(
|
|
1169
1169
|
"button",
|
|
1170
1170
|
{
|
|
1171
1171
|
type: "button",
|
|
1172
1172
|
onClick: n,
|
|
1173
|
-
disabled:
|
|
1173
|
+
disabled: m,
|
|
1174
1174
|
class: "rounded-full px-4 py-2 text-base font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1175
|
-
children:
|
|
1175
|
+
children: t === "standalone" ? i("support.close_button", "Close") : i("nav.back_aria", "Back")
|
|
1176
1176
|
}
|
|
1177
1177
|
),
|
|
1178
1178
|
/* @__PURE__ */ o(
|
|
1179
1179
|
"button",
|
|
1180
1180
|
{
|
|
1181
1181
|
type: "submit",
|
|
1182
|
-
disabled:
|
|
1182
|
+
disabled: m,
|
|
1183
1183
|
class: "pw-cta-shimmer relative flex h-12 items-center justify-center overflow-hidden rounded-full px-8 text-base font-semibold text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1184
1184
|
style: {
|
|
1185
1185
|
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%)",
|
|
1186
1186
|
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)"
|
|
1187
1187
|
},
|
|
1188
|
-
children:
|
|
1188
|
+
children: m ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: i("support.send_button", "Send") })
|
|
1189
1189
|
}
|
|
1190
1190
|
)
|
|
1191
1191
|
] })
|
|
1192
1192
|
] })
|
|
1193
1193
|
] });
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function Tt({ onClick: r, ariaLabel: e }) {
|
|
1196
1196
|
return /* @__PURE__ */ o(
|
|
1197
1197
|
"button",
|
|
1198
1198
|
{
|
|
1199
1199
|
type: "button",
|
|
1200
|
-
onClick:
|
|
1200
|
+
onClick: r,
|
|
1201
1201
|
"aria-label": e,
|
|
1202
1202
|
class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1203
1203
|
children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
@@ -1225,10 +1225,10 @@ function Mt({ onClick: t, ariaLabel: e }) {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
);
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1229
|
-
type:
|
|
1228
|
+
function we({
|
|
1229
|
+
type: r,
|
|
1230
1230
|
placeholder: e,
|
|
1231
|
-
value:
|
|
1231
|
+
value: t,
|
|
1232
1232
|
onInput: n,
|
|
1233
1233
|
error: i,
|
|
1234
1234
|
autocomplete: s,
|
|
@@ -1238,8 +1238,8 @@ function be({
|
|
|
1238
1238
|
/* @__PURE__ */ o(
|
|
1239
1239
|
"input",
|
|
1240
1240
|
{
|
|
1241
|
-
type:
|
|
1242
|
-
value:
|
|
1241
|
+
type: r,
|
|
1242
|
+
value: t,
|
|
1243
1243
|
placeholder: e,
|
|
1244
1244
|
onInput: (c) => n(c.target.value),
|
|
1245
1245
|
autocomplete: s,
|
|
@@ -1250,10 +1250,10 @@ function be({
|
|
|
1250
1250
|
i && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
|
|
1251
1251
|
] });
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1254
|
-
placeholder:
|
|
1253
|
+
function Bt({
|
|
1254
|
+
placeholder: r,
|
|
1255
1255
|
value: e,
|
|
1256
|
-
onInput:
|
|
1256
|
+
onInput: t,
|
|
1257
1257
|
error: n,
|
|
1258
1258
|
required: i
|
|
1259
1259
|
}) {
|
|
@@ -1262,8 +1262,8 @@ function Et({
|
|
|
1262
1262
|
"textarea",
|
|
1263
1263
|
{
|
|
1264
1264
|
value: e,
|
|
1265
|
-
placeholder:
|
|
1266
|
-
onInput: (s) =>
|
|
1265
|
+
placeholder: r,
|
|
1266
|
+
onInput: (s) => t(s.target.value),
|
|
1267
1267
|
required: i,
|
|
1268
1268
|
rows: 5,
|
|
1269
1269
|
class: `min-h-[120px] w-full rounded-2xl bg-gray-100 px-5 py-3.5 text-base leading-relaxed text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${n ? "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)]"}`
|
|
@@ -1272,23 +1272,23 @@ function Et({
|
|
|
1272
1272
|
n && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
|
|
1273
1273
|
] });
|
|
1274
1274
|
}
|
|
1275
|
-
function Pt({ files:
|
|
1276
|
-
const { t: n } =
|
|
1277
|
-
if (!
|
|
1275
|
+
function Pt({ files: r, onChange: e, disabled: t }) {
|
|
1276
|
+
const { t: n } = S(), i = D(null), [s, a] = k(!1), [c, l] = k(null), h = (d) => {
|
|
1277
|
+
if (!d || t) return;
|
|
1278
1278
|
l(null);
|
|
1279
|
-
const
|
|
1280
|
-
if (
|
|
1281
|
-
l(n("support.too_many_files", "Up to {max} files", { max:
|
|
1279
|
+
const g = Array.from(d);
|
|
1280
|
+
if (r.length + g.length > ie) {
|
|
1281
|
+
l(n("support.too_many_files", "Up to {max} files", { max: ie }));
|
|
1282
1282
|
return;
|
|
1283
1283
|
}
|
|
1284
|
-
const
|
|
1285
|
-
(
|
|
1284
|
+
const _ = g.filter(
|
|
1285
|
+
(p) => xe.includes(p.type) && p.size <= Lt
|
|
1286
1286
|
);
|
|
1287
|
-
if (
|
|
1287
|
+
if (_.length !== g.length) {
|
|
1288
1288
|
l(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
|
-
e([...
|
|
1291
|
+
e([...r, ..._]);
|
|
1292
1292
|
};
|
|
1293
1293
|
return /* @__PURE__ */ u("div", { children: [
|
|
1294
1294
|
/* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: n("support.attachments_label", "Attachments (optional)") }),
|
|
@@ -1298,19 +1298,19 @@ function Pt({ files: t, onChange: e, disabled: r }) {
|
|
|
1298
1298
|
role: "button",
|
|
1299
1299
|
tabIndex: 0,
|
|
1300
1300
|
"aria-label": n("support.attachments_aria", "Attachments upload"),
|
|
1301
|
-
onClick: () => !
|
|
1302
|
-
onDragOver: (
|
|
1303
|
-
|
|
1301
|
+
onClick: () => !t && i.current?.click(),
|
|
1302
|
+
onDragOver: (d) => {
|
|
1303
|
+
d.preventDefault(), t || a(!0);
|
|
1304
1304
|
},
|
|
1305
1305
|
onDragLeave: () => a(!1),
|
|
1306
|
-
onDrop: (
|
|
1307
|
-
|
|
1306
|
+
onDrop: (d) => {
|
|
1307
|
+
d.preventDefault(), a(!1), h(d.dataTransfer?.files ?? null);
|
|
1308
1308
|
},
|
|
1309
|
-
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${s ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${
|
|
1309
|
+
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${s ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${t ? "cursor-not-allowed opacity-60" : ""}`,
|
|
1310
1310
|
children: [
|
|
1311
1311
|
/* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: n("support.dropzone_text", "Drop images here or click to select") }),
|
|
1312
1312
|
/* @__PURE__ */ o("div", { class: "mt-0.5 text-[11px] text-gray-400", children: n("support.file_requirements", "JPEG/PNG/WebP, up to {max} files, ≤ 10MB each", {
|
|
1313
|
-
max:
|
|
1313
|
+
max: ie
|
|
1314
1314
|
}) })
|
|
1315
1315
|
]
|
|
1316
1316
|
}
|
|
@@ -1323,66 +1323,66 @@ function Pt({ files: t, onChange: e, disabled: r }) {
|
|
|
1323
1323
|
multiple: !0,
|
|
1324
1324
|
accept: xe.join(","),
|
|
1325
1325
|
class: "hidden",
|
|
1326
|
-
onChange: (
|
|
1327
|
-
|
|
1326
|
+
onChange: (d) => {
|
|
1327
|
+
h(d.target.files), d.currentTarget.value = "";
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
),
|
|
1331
1331
|
c && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: c }),
|
|
1332
|
-
|
|
1332
|
+
r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((d, g) => /* @__PURE__ */ u(
|
|
1333
1333
|
"li",
|
|
1334
1334
|
{
|
|
1335
1335
|
class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
|
|
1336
1336
|
children: [
|
|
1337
|
-
/* @__PURE__ */ o("span", { class: "truncate text-gray-700", children:
|
|
1337
|
+
/* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: d.name }),
|
|
1338
1338
|
/* @__PURE__ */ o(
|
|
1339
1339
|
"button",
|
|
1340
1340
|
{
|
|
1341
1341
|
type: "button",
|
|
1342
1342
|
onClick: () => {
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1343
|
+
const _ = [...r];
|
|
1344
|
+
_.splice(g, 1), e(_);
|
|
1345
1345
|
},
|
|
1346
|
-
disabled:
|
|
1346
|
+
disabled: t,
|
|
1347
1347
|
class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
|
|
1348
|
-
"aria-label": n("support.remove_file_aria", "Remove {filename}", { filename:
|
|
1348
|
+
"aria-label": n("support.remove_file_aria", "Remove {filename}", { filename: d.name }),
|
|
1349
1349
|
children: "✕"
|
|
1350
1350
|
}
|
|
1351
1351
|
)
|
|
1352
1352
|
]
|
|
1353
1353
|
},
|
|
1354
|
-
`${
|
|
1354
|
+
`${d.name}-${d.size}-${g}`
|
|
1355
1355
|
)) })
|
|
1356
1356
|
] });
|
|
1357
1357
|
}
|
|
1358
|
-
const
|
|
1358
|
+
const Ot = {
|
|
1359
1359
|
day: "cta.get_plan_daily",
|
|
1360
1360
|
week: "cta.get_plan_weekly",
|
|
1361
1361
|
month: "cta.get_plan_monthly",
|
|
1362
1362
|
year: "cta.get_plan_yearly"
|
|
1363
|
-
},
|
|
1363
|
+
}, Ut = {
|
|
1364
1364
|
day: "Get Daily Plan",
|
|
1365
1365
|
week: "Get Weekly Plan",
|
|
1366
1366
|
month: "Get Monthly Plan",
|
|
1367
1367
|
year: "Get Yearly Plan"
|
|
1368
1368
|
};
|
|
1369
|
-
function
|
|
1369
|
+
function jt(r, e, t, n) {
|
|
1370
1370
|
if (e === "close") return n("cta.close", "Close");
|
|
1371
|
-
if (!
|
|
1372
|
-
if (!
|
|
1373
|
-
return n("cta.start_trial", "Start {days}-Day Free Trial", { days:
|
|
1374
|
-
if (!
|
|
1371
|
+
if (!r) return n("cta.continue", "Continue");
|
|
1372
|
+
if (!t && r.trial_days && r.interval && r.interval !== "lifetime")
|
|
1373
|
+
return n("cta.start_trial", "Start {days}-Day Free Trial", { days: r.trial_days });
|
|
1374
|
+
if (!r.interval || r.interval === "lifetime")
|
|
1375
1375
|
return n("cta.get_lifetime_access", "Get Lifetime Access");
|
|
1376
|
-
const i =
|
|
1377
|
-
return i ? n(i,
|
|
1378
|
-
interval:
|
|
1376
|
+
const i = Ot[r.interval];
|
|
1377
|
+
return i ? n(i, Ut[r.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
|
|
1378
|
+
interval: Dt(r.interval)
|
|
1379
1379
|
});
|
|
1380
1380
|
}
|
|
1381
|
-
function
|
|
1382
|
-
return
|
|
1381
|
+
function Dt(r) {
|
|
1382
|
+
return r.length ? r[0].toUpperCase() + r.slice(1) : r;
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1385
|
-
const { t
|
|
1384
|
+
function Rt({ block: r, ctx: e }) {
|
|
1385
|
+
const { t } = S(), [n, i] = k(!1), s = r.priceId ?? e.selectedPriceId, a = n || r.action === "checkout" && !s, c = s ? e.bootstrap.prices.find((g) => g.id === s) ?? null : null, l = e.bootstrap.user?.had_previous_trial ?? !1, h = r.label ?? jt(c, r.action, l, t);
|
|
1386
1386
|
return /* @__PURE__ */ u(
|
|
1387
1387
|
"button",
|
|
1388
1388
|
{
|
|
@@ -1392,7 +1392,7 @@ function jt({ block: t, ctx: e }) {
|
|
|
1392
1392
|
if (!a) {
|
|
1393
1393
|
i(!0);
|
|
1394
1394
|
try {
|
|
1395
|
-
await e.onAction(
|
|
1395
|
+
await e.onAction(r.action, { priceId: s });
|
|
1396
1396
|
} finally {
|
|
1397
1397
|
i(!1);
|
|
1398
1398
|
}
|
|
@@ -1414,14 +1414,14 @@ function jt({ block: t, ctx: e }) {
|
|
|
1414
1414
|
"aria-hidden": "true"
|
|
1415
1415
|
}
|
|
1416
1416
|
),
|
|
1417
|
-
n ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children:
|
|
1417
|
+
n ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: h })
|
|
1418
1418
|
]
|
|
1419
1419
|
}
|
|
1420
1420
|
);
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1423
|
-
const { t: e } =
|
|
1424
|
-
if (
|
|
1422
|
+
function zt({ ctx: r }) {
|
|
1423
|
+
const { t: e } = S(), t = r.authSession, n = r.auth, [i, s] = k(!1), a = () => r.onAction("support");
|
|
1424
|
+
if (t && !t.user.is_anonymous) {
|
|
1425
1425
|
const c = async () => {
|
|
1426
1426
|
if (!(!n || i)) {
|
|
1427
1427
|
s(!0);
|
|
@@ -1437,43 +1437,43 @@ function Rt({ ctx: t }) {
|
|
|
1437
1437
|
/* @__PURE__ */ u("span", { children: [
|
|
1438
1438
|
e("session.signed_in_as_prefix", "Signed in as"),
|
|
1439
1439
|
" ",
|
|
1440
|
-
/* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children:
|
|
1440
|
+
/* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: t.user.email })
|
|
1441
1441
|
] }),
|
|
1442
1442
|
/* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
1443
1443
|
/* @__PURE__ */ o(G, { onClick: c, disabled: !n || i, children: i ? e("session.signing_out", "Signing out…") : e("session.sign_out", "Sign Out") }),
|
|
1444
|
-
/* @__PURE__ */ o(
|
|
1444
|
+
/* @__PURE__ */ o(ke, {}),
|
|
1445
1445
|
/* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
|
|
1446
1446
|
] })
|
|
1447
1447
|
] });
|
|
1448
1448
|
}
|
|
1449
1449
|
return /* @__PURE__ */ u("div", { class: "-mt-3 flex items-center justify-center gap-3 pt-1 text-center text-[13px]", children: [
|
|
1450
|
-
/* @__PURE__ */ o(G, { onClick: () =>
|
|
1451
|
-
/* @__PURE__ */ o(
|
|
1450
|
+
/* @__PURE__ */ o(G, { onClick: () => r.onAction("restore"), children: e("session.restore_purchases", "Restore purchases") }),
|
|
1451
|
+
/* @__PURE__ */ o(ke, {}),
|
|
1452
1452
|
/* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
|
|
1453
1453
|
] });
|
|
1454
1454
|
}
|
|
1455
1455
|
function G({
|
|
1456
|
-
onClick:
|
|
1456
|
+
onClick: r,
|
|
1457
1457
|
disabled: e,
|
|
1458
|
-
children:
|
|
1458
|
+
children: t
|
|
1459
1459
|
}) {
|
|
1460
1460
|
return /* @__PURE__ */ o(
|
|
1461
1461
|
"button",
|
|
1462
1462
|
{
|
|
1463
1463
|
type: "button",
|
|
1464
|
-
onClick:
|
|
1464
|
+
onClick: r,
|
|
1465
1465
|
disabled: e,
|
|
1466
1466
|
class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
|
|
1467
1467
|
style: { color: "var(--pw-accent)" },
|
|
1468
|
-
children:
|
|
1468
|
+
children: t
|
|
1469
1469
|
}
|
|
1470
1470
|
);
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1472
|
+
function ke() {
|
|
1473
1473
|
return /* @__PURE__ */ o("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1476
|
-
return
|
|
1475
|
+
function qt({ block: r }) {
|
|
1476
|
+
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
1477
|
/* @__PURE__ */ o(
|
|
1478
1478
|
"svg",
|
|
1479
1479
|
{
|
|
@@ -1501,25 +1501,25 @@ function Dt({ block: t }) {
|
|
|
1501
1501
|
] })
|
|
1502
1502
|
] }, e.id)) }) : null;
|
|
1503
1503
|
}
|
|
1504
|
-
function
|
|
1505
|
-
const { t: e } =
|
|
1504
|
+
function Nt({ block: r }) {
|
|
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 = Ft(t);
|
|
1506
1506
|
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
1507
|
/* @__PURE__ */ u("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
|
|
1508
|
-
i ? /* @__PURE__ */ o(
|
|
1508
|
+
i ? /* @__PURE__ */ o($t, {}) : null,
|
|
1509
1509
|
s ? /* @__PURE__ */ u("span", { children: [
|
|
1510
1510
|
/* @__PURE__ */ o("b", { class: "font-bold text-gray-900", children: s.bold }),
|
|
1511
1511
|
" ",
|
|
1512
1512
|
/* @__PURE__ */ o("span", { class: "font-medium", children: s.rest })
|
|
1513
|
-
] }) : /* @__PURE__ */ o("span", { class: "font-medium", children:
|
|
1513
|
+
] }) : /* @__PURE__ */ o("span", { class: "font-medium", children: t })
|
|
1514
1514
|
] }),
|
|
1515
1515
|
n ? /* @__PURE__ */ o("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
|
|
1516
1516
|
] });
|
|
1517
1517
|
}
|
|
1518
|
-
function
|
|
1519
|
-
const e =
|
|
1518
|
+
function Ft(r) {
|
|
1519
|
+
const e = r.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
|
|
1520
1520
|
return e ? { bold: e[1], rest: e[2] } : null;
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function $t() {
|
|
1523
1523
|
return /* @__PURE__ */ u(
|
|
1524
1524
|
"svg",
|
|
1525
1525
|
{
|
|
@@ -1554,112 +1554,112 @@ function qt() {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
);
|
|
1556
1556
|
}
|
|
1557
|
-
const
|
|
1558
|
-
function
|
|
1559
|
-
const
|
|
1560
|
-
let n =
|
|
1561
|
-
for (
|
|
1562
|
-
n -= 1,
|
|
1557
|
+
const Ue = 24, Vt = 16, Ht = 2;
|
|
1558
|
+
function Gt(r, e) {
|
|
1559
|
+
const t = e * Ht;
|
|
1560
|
+
let n = Ue;
|
|
1561
|
+
for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Vt; )
|
|
1562
|
+
n -= 1, r.style.fontSize = `${n}px`;
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const
|
|
1566
|
-
return
|
|
1564
|
+
function Wt({ block: r, ctx: e }) {
|
|
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 = D(null), a = t === 1 && !!e.bootstrap.settings.title_auto_fit;
|
|
1566
|
+
return P(() => {
|
|
1567
1567
|
if (!a || !s.current) return;
|
|
1568
|
-
const c = getComputedStyle(s.current), l = parseFloat(c.lineHeight) ||
|
|
1569
|
-
|
|
1570
|
-
}, [a,
|
|
1568
|
+
const c = getComputedStyle(s.current), l = parseFloat(c.lineHeight) || Ue * 1.5;
|
|
1569
|
+
Gt(s.current, l);
|
|
1570
|
+
}, [a, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
|
|
1571
1571
|
}
|
|
1572
|
-
function
|
|
1573
|
-
const e =
|
|
1574
|
-
if (
|
|
1575
|
-
const
|
|
1576
|
-
return { amount: e.amount /
|
|
1572
|
+
function Zt(r) {
|
|
1573
|
+
const e = r.local ?? { currency: r.currency, amount: r.amount };
|
|
1574
|
+
if (r.interval === "year") {
|
|
1575
|
+
const t = (r.interval_count ?? 1) * 12;
|
|
1576
|
+
return { amount: e.amount / t, currency: e.currency };
|
|
1577
1577
|
}
|
|
1578
1578
|
return { amount: e.amount, currency: e.currency };
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1581
|
-
const
|
|
1580
|
+
function oe(r, e) {
|
|
1581
|
+
const t = r % 1 !== 0 ? 2 : 0;
|
|
1582
1582
|
try {
|
|
1583
1583
|
const n = new Intl.NumberFormat(void 0, {
|
|
1584
1584
|
style: "currency",
|
|
1585
1585
|
currency: e,
|
|
1586
1586
|
currencyDisplay: "narrowSymbol",
|
|
1587
|
-
maximumFractionDigits:
|
|
1588
|
-
minimumFractionDigits:
|
|
1589
|
-
}).formatToParts(
|
|
1587
|
+
maximumFractionDigits: t,
|
|
1588
|
+
minimumFractionDigits: t
|
|
1589
|
+
}).formatToParts(r);
|
|
1590
1590
|
let i = "", s = "";
|
|
1591
1591
|
for (const a of n)
|
|
1592
1592
|
a.type === "currency" ? i = a.value : a.type !== "literal" && (s += a.value);
|
|
1593
1593
|
return { currency: i || e, amount: s.trim() };
|
|
1594
1594
|
} catch {
|
|
1595
|
-
return { currency: e, amount: String(
|
|
1595
|
+
return { currency: e, amount: String(r) };
|
|
1596
1596
|
}
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1599
|
-
const { amount:
|
|
1598
|
+
function le(r, e) {
|
|
1599
|
+
const { amount: t, currency: n } = Zt(r);
|
|
1600
1600
|
if (!e) {
|
|
1601
|
-
const { currency: c, amount: l } =
|
|
1601
|
+
const { currency: c, amount: l } = oe(t, n);
|
|
1602
1602
|
return { currency: c, amount: l, originalAmount: null };
|
|
1603
1603
|
}
|
|
1604
|
-
const i =
|
|
1604
|
+
const i = t * (1 - e / 100), s = oe(i, n), a = oe(t, n);
|
|
1605
1605
|
return {
|
|
1606
1606
|
currency: s.currency,
|
|
1607
1607
|
amount: s.amount,
|
|
1608
1608
|
originalAmount: `${a.currency}${a.amount}`
|
|
1609
1609
|
};
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1612
|
-
if (
|
|
1613
|
-
if (!
|
|
1611
|
+
function je(r, e) {
|
|
1612
|
+
if (r.label) return r.label.toUpperCase();
|
|
1613
|
+
if (!r.interval || r.interval === "lifetime")
|
|
1614
1614
|
return e("pricing.plan_label.lifetime", "LIFETIME");
|
|
1615
1615
|
const n = {
|
|
1616
1616
|
day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
|
|
1617
1617
|
week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
|
|
1618
1618
|
month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
|
|
1619
1619
|
year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
|
|
1620
|
-
}[
|
|
1621
|
-
return n ? e(n.key, n.fallback) : `${
|
|
1620
|
+
}[r.interval];
|
|
1621
|
+
return n ? e(n.key, n.fallback) : `${r.interval.toUpperCase()} PLAN`;
|
|
1622
1622
|
}
|
|
1623
|
-
function
|
|
1624
|
-
if (!
|
|
1623
|
+
function ce(r, e) {
|
|
1624
|
+
if (!r.interval || r.interval === "lifetime")
|
|
1625
1625
|
return e("pricing.interval.lifetime_short", "lifetime");
|
|
1626
|
-
if (
|
|
1627
|
-
const
|
|
1628
|
-
return
|
|
1626
|
+
if (r.interval === "year") return e("pricing.interval.month", "month");
|
|
1627
|
+
const t = r.interval_count ?? 1;
|
|
1628
|
+
return t === 1 ? e(`pricing.interval.${r.interval}`, r.interval) : `${t} ${r.interval}s`;
|
|
1629
1629
|
}
|
|
1630
|
-
function
|
|
1631
|
-
const { t
|
|
1630
|
+
function Yt({ block: r, ctx: e }) {
|
|
1631
|
+
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
1632
|
if (i.length === 0)
|
|
1633
|
-
return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children:
|
|
1634
|
-
const s =
|
|
1635
|
-
if (
|
|
1633
|
+
return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("pricing.no_prices", "No prices available.") });
|
|
1634
|
+
const s = r.popular_label ?? t("pricing.most_popular", "Most popular");
|
|
1635
|
+
if (r.view === "compact")
|
|
1636
1636
|
return /* @__PURE__ */ o(
|
|
1637
1637
|
"div",
|
|
1638
1638
|
{
|
|
1639
1639
|
class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
|
|
1640
1640
|
role: "radiogroup",
|
|
1641
|
-
"aria-label":
|
|
1641
|
+
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1642
1642
|
children: i.map((a, c) => /* @__PURE__ */ o(
|
|
1643
|
-
|
|
1643
|
+
Xt,
|
|
1644
1644
|
{
|
|
1645
1645
|
price: a,
|
|
1646
1646
|
isLast: c === i.length - 1,
|
|
1647
|
-
isPopular:
|
|
1647
|
+
isPopular: r.popular_price_id === a.id,
|
|
1648
1648
|
popularLabel: s,
|
|
1649
|
-
offer:
|
|
1649
|
+
offer: N(e.bootstrap.offers, a.id),
|
|
1650
1650
|
selected: e.selectedPriceId === a.id,
|
|
1651
1651
|
onSelect: () => {
|
|
1652
1652
|
e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
|
|
1653
1653
|
},
|
|
1654
|
-
t
|
|
1654
|
+
t
|
|
1655
1655
|
},
|
|
1656
1656
|
a.id
|
|
1657
1657
|
))
|
|
1658
1658
|
}
|
|
1659
1659
|
);
|
|
1660
|
-
if (
|
|
1660
|
+
if (r.view === "horizontal") {
|
|
1661
1661
|
const a = Math.min(i.length, 3), c = i.some(
|
|
1662
|
-
(l) => (
|
|
1662
|
+
(l) => (N(e.bootstrap.offers, l.id)?.discount_percent ?? 0) > 0
|
|
1663
1663
|
);
|
|
1664
1664
|
return /* @__PURE__ */ o(
|
|
1665
1665
|
"div",
|
|
@@ -1667,20 +1667,20 @@ function Wt({ block: t, ctx: e }) {
|
|
|
1667
1667
|
class: "grid items-stretch gap-2",
|
|
1668
1668
|
style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` },
|
|
1669
1669
|
role: "radiogroup",
|
|
1670
|
-
"aria-label":
|
|
1670
|
+
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1671
1671
|
children: i.map((l) => /* @__PURE__ */ o(
|
|
1672
|
-
|
|
1672
|
+
Jt,
|
|
1673
1673
|
{
|
|
1674
1674
|
price: l,
|
|
1675
|
-
isPopular:
|
|
1675
|
+
isPopular: r.popular_price_id === l.id,
|
|
1676
1676
|
popularLabel: s,
|
|
1677
|
-
offer:
|
|
1677
|
+
offer: N(e.bootstrap.offers, l.id),
|
|
1678
1678
|
reserveStrikeRow: c,
|
|
1679
1679
|
selected: e.selectedPriceId === l.id,
|
|
1680
1680
|
onSelect: () => {
|
|
1681
1681
|
e.setSelectedPriceId(l.id), e.onAction("price_selected", { priceId: l.id, price: l });
|
|
1682
1682
|
},
|
|
1683
|
-
t
|
|
1683
|
+
t
|
|
1684
1684
|
},
|
|
1685
1685
|
l.id
|
|
1686
1686
|
))
|
|
@@ -1692,9 +1692,9 @@ function Wt({ block: t, ctx: e }) {
|
|
|
1692
1692
|
{
|
|
1693
1693
|
class: "flex flex-col gap-2",
|
|
1694
1694
|
role: "radiogroup",
|
|
1695
|
-
"aria-label":
|
|
1695
|
+
"aria-label": t("pricing.plans_aria", "Plans"),
|
|
1696
1696
|
children: i.map((a) => {
|
|
1697
|
-
const c = e.selectedPriceId === a.id, l =
|
|
1697
|
+
const c = e.selectedPriceId === a.id, l = 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
1698
|
return /* @__PURE__ */ u(
|
|
1699
1699
|
"button",
|
|
1700
1700
|
{
|
|
@@ -1750,30 +1750,30 @@ function Wt({ block: t, ctx: e }) {
|
|
|
1750
1750
|
),
|
|
1751
1751
|
/* @__PURE__ */ u("div", { class: "flex flex-1 flex-col gap-0.5", children: [
|
|
1752
1752
|
/* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
1753
|
-
/* @__PURE__ */ o("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children:
|
|
1754
|
-
|
|
1753
|
+
/* @__PURE__ */ o("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children: je(a, t) }),
|
|
1754
|
+
p ? (
|
|
1755
1755
|
// opacity-60 приглушает strike: глаз сначала ловит label
|
|
1756
1756
|
// и discount-badge, потом main price; original «бывшая цена»
|
|
1757
1757
|
// — третичная информация, не должна конкурировать с label.
|
|
1758
|
-
/* @__PURE__ */ o("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children:
|
|
1758
|
+
/* @__PURE__ */ o("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children: p })
|
|
1759
1759
|
) : null,
|
|
1760
|
-
|
|
1760
|
+
d ? (
|
|
1761
1761
|
// Emerald pill — фиксированный «успех/выгода», не зависит от
|
|
1762
1762
|
// brand_color. Читается даже на тёмных бренд-акцентах.
|
|
1763
1763
|
/* @__PURE__ */ u("span", { class: "rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold leading-none text-emerald-700", children: [
|
|
1764
1764
|
"-",
|
|
1765
|
-
|
|
1765
|
+
d,
|
|
1766
1766
|
"%"
|
|
1767
1767
|
] })
|
|
1768
1768
|
) : null
|
|
1769
1769
|
] }),
|
|
1770
1770
|
/* @__PURE__ */ o("div", { class: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ u("span", { class: "text-[26px] leading-tight whitespace-nowrap text-gray-800 font-medium", children: [
|
|
1771
|
-
/* @__PURE__ */ o("span", { class: "opacity-90", children:
|
|
1772
|
-
|
|
1771
|
+
/* @__PURE__ */ o("span", { class: "opacity-90", children: g }),
|
|
1772
|
+
_,
|
|
1773
1773
|
/* @__PURE__ */ u("span", { class: "text-sm font-normal text-gray-500", children: [
|
|
1774
1774
|
" ",
|
|
1775
1775
|
"/ ",
|
|
1776
|
-
|
|
1776
|
+
ce(a, t)
|
|
1777
1777
|
] })
|
|
1778
1778
|
] }) }),
|
|
1779
1779
|
a.description ? /* @__PURE__ */ o("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: a.description }) : null
|
|
@@ -1794,20 +1794,20 @@ function Wt({ block: t, ctx: e }) {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
);
|
|
1796
1796
|
}
|
|
1797
|
-
function
|
|
1798
|
-
return
|
|
1797
|
+
function Kt(r, e) {
|
|
1798
|
+
return r.label ? r.label : !r.interval || r.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${r.interval}`, r.interval);
|
|
1799
1799
|
}
|
|
1800
|
-
function
|
|
1801
|
-
price:
|
|
1800
|
+
function Xt({
|
|
1801
|
+
price: r,
|
|
1802
1802
|
isLast: e,
|
|
1803
|
-
isPopular:
|
|
1803
|
+
isPopular: t,
|
|
1804
1804
|
popularLabel: n,
|
|
1805
1805
|
offer: i,
|
|
1806
1806
|
selected: s,
|
|
1807
1807
|
onSelect: a,
|
|
1808
1808
|
t: c
|
|
1809
1809
|
}) {
|
|
1810
|
-
const l = i?.discount_percent ?? null, { currency:
|
|
1810
|
+
const l = i?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, l);
|
|
1811
1811
|
return /* @__PURE__ */ u(
|
|
1812
1812
|
"button",
|
|
1813
1813
|
{
|
|
@@ -1857,8 +1857,8 @@ function Yt({
|
|
|
1857
1857
|
].join(" "),
|
|
1858
1858
|
children: [
|
|
1859
1859
|
/* @__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:
|
|
1861
|
-
|
|
1860
|
+
/* @__PURE__ */ o("span", { class: "text-base font-normal capitalize text-gray-800", children: Kt(r, c) }),
|
|
1861
|
+
t ? (
|
|
1862
1862
|
// Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
|
|
1863
1863
|
// Низкий visual weight: pill про "имя плана" (most popular), а не
|
|
1864
1864
|
// про savings — не должна конкурировать с -X% discount-pill.
|
|
@@ -1882,14 +1882,14 @@ function Yt({
|
|
|
1882
1882
|
] }),
|
|
1883
1883
|
/* @__PURE__ */ o("div", { class: "flex-1" }),
|
|
1884
1884
|
/* @__PURE__ */ u("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
|
|
1885
|
-
|
|
1885
|
+
g ? /* @__PURE__ */ o("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
|
|
1886
1886
|
/* @__PURE__ */ u("span", { class: "whitespace-nowrap", children: [
|
|
1887
|
-
/* @__PURE__ */ o("span", { class: "opacity-90", children:
|
|
1888
|
-
|
|
1887
|
+
/* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
|
|
1888
|
+
d,
|
|
1889
1889
|
/* @__PURE__ */ u("span", { class: "text-xs text-gray-400", children: [
|
|
1890
1890
|
" ",
|
|
1891
1891
|
"/ ",
|
|
1892
|
-
|
|
1892
|
+
ce(r, c)
|
|
1893
1893
|
] })
|
|
1894
1894
|
] })
|
|
1895
1895
|
] })
|
|
@@ -1900,17 +1900,17 @@ function Yt({
|
|
|
1900
1900
|
}
|
|
1901
1901
|
);
|
|
1902
1902
|
}
|
|
1903
|
-
function
|
|
1904
|
-
price:
|
|
1903
|
+
function Jt({
|
|
1904
|
+
price: r,
|
|
1905
1905
|
isPopular: e,
|
|
1906
|
-
popularLabel:
|
|
1906
|
+
popularLabel: t,
|
|
1907
1907
|
offer: n,
|
|
1908
1908
|
reserveStrikeRow: i,
|
|
1909
1909
|
selected: s,
|
|
1910
1910
|
onSelect: a,
|
|
1911
1911
|
t: c
|
|
1912
1912
|
}) {
|
|
1913
|
-
const l = n?.discount_percent ?? null, { currency:
|
|
1913
|
+
const l = n?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, l);
|
|
1914
1914
|
return /* @__PURE__ */ u(
|
|
1915
1915
|
"button",
|
|
1916
1916
|
{
|
|
@@ -1924,9 +1924,9 @@ function Kt({
|
|
|
1924
1924
|
].join(" "),
|
|
1925
1925
|
style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
|
|
1926
1926
|
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:
|
|
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, c) }),
|
|
1928
1928
|
i ? /* @__PURE__ */ u("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
|
|
1929
|
-
|
|
1929
|
+
g ? /* @__PURE__ */ o("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
|
|
1930
1930
|
l ? /* @__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
1931
|
"-",
|
|
1932
1932
|
l,
|
|
@@ -1934,45 +1934,45 @@ function Kt({
|
|
|
1934
1934
|
] }) : null
|
|
1935
1935
|
] }) : null,
|
|
1936
1936
|
/* @__PURE__ */ u("span", { class: "text-[26px] leading-none whitespace-nowrap text-gray-800 font-medium", children: [
|
|
1937
|
-
/* @__PURE__ */ o("span", { class: "opacity-90", children:
|
|
1938
|
-
|
|
1937
|
+
/* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
|
|
1938
|
+
d
|
|
1939
1939
|
] }),
|
|
1940
1940
|
/* @__PURE__ */ u("span", { class: "text-xs font-normal text-gray-500", children: [
|
|
1941
1941
|
"/ ",
|
|
1942
|
-
|
|
1942
|
+
ce(r, c)
|
|
1943
1943
|
] }),
|
|
1944
1944
|
e ? /* @__PURE__ */ o(
|
|
1945
1945
|
"span",
|
|
1946
1946
|
{
|
|
1947
1947
|
class: "absolute -top-[10px] left-1/2 -translate-x-1/2 whitespace-nowrap rounded-[11px] border-[3px] border-white px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",
|
|
1948
1948
|
style: { background: "var(--pw-accent)" },
|
|
1949
|
-
children:
|
|
1949
|
+
children: t
|
|
1950
1950
|
}
|
|
1951
1951
|
) : null
|
|
1952
1952
|
]
|
|
1953
1953
|
}
|
|
1954
1954
|
);
|
|
1955
1955
|
}
|
|
1956
|
-
function
|
|
1957
|
-
return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children:
|
|
1956
|
+
function Qt({ block: r }) {
|
|
1957
|
+
return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: r.text });
|
|
1958
1958
|
}
|
|
1959
|
-
const
|
|
1959
|
+
const er = {
|
|
1960
1960
|
week: 0.25,
|
|
1961
1961
|
month: 1,
|
|
1962
1962
|
year: 12
|
|
1963
1963
|
};
|
|
1964
|
-
function
|
|
1965
|
-
return
|
|
1964
|
+
function tr(r, e) {
|
|
1965
|
+
return r ? e(`pricing.interval.${r}`, r) : e("pricing.interval.period", "period");
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1968
|
-
const { t
|
|
1969
|
-
if (!
|
|
1970
|
-
const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ?
|
|
1967
|
+
function rr({ block: r, ctx: e }) {
|
|
1968
|
+
const { t } = S();
|
|
1969
|
+
if (!r.queries.length) return null;
|
|
1970
|
+
const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ? er[i] : void 0;
|
|
1971
1971
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
1972
|
-
/* @__PURE__ */ o("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ?
|
|
1973
|
-
interval:
|
|
1972
|
+
/* @__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: tr(i, t)
|
|
1974
1974
|
}) }),
|
|
1975
|
-
/* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children:
|
|
1975
|
+
/* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((a) => {
|
|
1976
1976
|
const c = Number.isFinite(a.count) ? a.count : 0, l = s !== void 0 ? Math.round(c * s) : c;
|
|
1977
1977
|
return /* @__PURE__ */ u("li", { class: `flex gap-3 ${a.desc ? "items-start" : "items-center"}`, children: [
|
|
1978
1978
|
/* @__PURE__ */ o(
|
|
@@ -2000,7 +2000,7 @@ function er({ block: t, ctx: e }) {
|
|
|
2000
2000
|
/* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: l }),
|
|
2001
2001
|
" ",
|
|
2002
2002
|
/* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: a.name }),
|
|
2003
|
-
a.desc ? /* @__PURE__ */ u(
|
|
2003
|
+
a.desc ? /* @__PURE__ */ u(ae, { children: [
|
|
2004
2004
|
/* @__PURE__ */ o("br", {}),
|
|
2005
2005
|
/* @__PURE__ */ o("span", { class: "text-xs text-gray-400", children: a.desc })
|
|
2006
2006
|
] }) : null
|
|
@@ -2009,38 +2009,38 @@ function er({ block: t, ctx: e }) {
|
|
|
2009
2009
|
}) })
|
|
2010
2010
|
] });
|
|
2011
2011
|
}
|
|
2012
|
-
const
|
|
2013
|
-
heading:
|
|
2014
|
-
text:
|
|
2015
|
-
price_grid:
|
|
2016
|
-
cta_button:
|
|
2017
|
-
auth_panel:
|
|
2018
|
-
current_session:
|
|
2019
|
-
features_list:
|
|
2020
|
-
tokenization_gate:
|
|
2021
|
-
guarantee_badge:
|
|
2022
|
-
offer_banner:
|
|
2012
|
+
const nr = {
|
|
2013
|
+
heading: Wt,
|
|
2014
|
+
text: Qt,
|
|
2015
|
+
price_grid: Yt,
|
|
2016
|
+
cta_button: Rt,
|
|
2017
|
+
auth_panel: Me,
|
|
2018
|
+
current_session: zt,
|
|
2019
|
+
features_list: qt,
|
|
2020
|
+
tokenization_gate: rr,
|
|
2021
|
+
guarantee_badge: Nt,
|
|
2022
|
+
offer_banner: It
|
|
2023
2023
|
};
|
|
2024
|
-
function
|
|
2025
|
-
const a =
|
|
2026
|
-
for (const v of
|
|
2027
|
-
if (v.type === "price_grid" && v.popular_price_id && e.prices.some((
|
|
2024
|
+
function ir({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i, hasTopBanner: s }) {
|
|
2025
|
+
const a = Ge(() => {
|
|
2026
|
+
for (const v of r.blocks)
|
|
2027
|
+
if (v.type === "price_grid" && v.popular_price_id && e.prices.some((m) => m.id === v.popular_price_id))
|
|
2028
2028
|
return v.popular_price_id;
|
|
2029
2029
|
return e.prices[0]?.id ?? null;
|
|
2030
|
-
}, [
|
|
2030
|
+
}, [r.blocks, e.prices]), [c, l] = k(a), h = {
|
|
2031
2031
|
bootstrap: e,
|
|
2032
2032
|
selectedPriceId: c,
|
|
2033
2033
|
setSelectedPriceId: l,
|
|
2034
|
-
onAction:
|
|
2034
|
+
onAction: t,
|
|
2035
2035
|
auth: n,
|
|
2036
2036
|
authSession: i
|
|
2037
|
-
},
|
|
2038
|
-
const
|
|
2039
|
-
return
|
|
2037
|
+
}, 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 = nr[v.type];
|
|
2039
|
+
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
2040
|
};
|
|
2041
|
-
return /* @__PURE__ */ u(
|
|
2042
|
-
/* @__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__ */ o("div", { class: "flex flex-col gap-6", children:
|
|
2043
|
-
|
|
2041
|
+
return /* @__PURE__ */ u(ae, { children: [
|
|
2042
|
+
/* @__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__ */ o("div", { class: "flex flex-col gap-6", children: g.map(p) }) }),
|
|
2043
|
+
_.length > 0 ? (
|
|
2044
2044
|
// Тонкий shadow-top вместо border-t — создаёт depth, читается как
|
|
2045
2045
|
// «footer закреплён к низу dialog'а». Линия выглядела как divider
|
|
2046
2046
|
// в обычном flow, не передавала sticky-character.
|
|
@@ -2049,170 +2049,202 @@ function rr({ layout: t, bootstrap: e, onAction: r, auth: n, authSession: i, has
|
|
|
2049
2049
|
{
|
|
2050
2050
|
class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
|
|
2051
2051
|
style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
|
|
2052
|
-
children:
|
|
2052
|
+
children: _.map((v, m) => p(v, g.length + m))
|
|
2053
2053
|
}
|
|
2054
2054
|
)
|
|
2055
2055
|
) : null
|
|
2056
2056
|
] });
|
|
2057
2057
|
}
|
|
2058
|
-
function
|
|
2059
|
-
return
|
|
2058
|
+
function or(r, e, t, n) {
|
|
2059
|
+
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
2060
|
}
|
|
2061
|
-
function
|
|
2062
|
-
return
|
|
2061
|
+
function sr(r, e) {
|
|
2062
|
+
return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2065
|
-
client:
|
|
2064
|
+
function ar({
|
|
2065
|
+
client: r,
|
|
2066
2066
|
open: e,
|
|
2067
|
-
onClose:
|
|
2067
|
+
onClose: t,
|
|
2068
2068
|
onEvent: n,
|
|
2069
2069
|
initialView: i,
|
|
2070
2070
|
initialAuthMode: s,
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2071
|
+
initialCheckoutPriceId: a,
|
|
2072
|
+
initialCheckoutUrl: c,
|
|
2073
|
+
purchased: l,
|
|
2074
|
+
renew: h,
|
|
2075
|
+
onState: d,
|
|
2076
|
+
inline: g,
|
|
2077
|
+
locale: _
|
|
2076
2078
|
}) {
|
|
2077
|
-
const [
|
|
2078
|
-
() =>
|
|
2079
|
-
), [
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2079
|
+
const [p, v] = k({ status: "idle" }), [m, A] = k(
|
|
2080
|
+
() => r.auth?.getCachedSession() ?? null
|
|
2081
|
+
), [b, y] = k(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? a ? {
|
|
2082
|
+
kind: "auth_gate",
|
|
2083
|
+
pendingCheckout: { priceId: a, direct: !0 },
|
|
2084
|
+
origin: "standalone",
|
|
2085
|
+
intent: "preauth"
|
|
2086
|
+
} : { kind: "auth_gate", origin: "standalone" } : i === "awaiting_payment" && a && c ? {
|
|
2087
|
+
kind: "awaiting_payment",
|
|
2088
|
+
priceId: a,
|
|
2089
|
+
url: c
|
|
2090
|
+
} : i === "popup_blocked" && a && c ? {
|
|
2091
|
+
kind: "popup_blocked",
|
|
2092
|
+
priceId: a,
|
|
2093
|
+
url: c
|
|
2094
|
+
} : { kind: "layout" }), C = i === "awaiting_payment" || i === "popup_blocked" || i === "auth" && !!a, I = D(!1), U = D(null);
|
|
2095
|
+
P(() => {
|
|
2096
|
+
if (!d) return;
|
|
2097
|
+
const x = or(e, p, b, l), f = U.current;
|
|
2098
|
+
f && sr(f, x) || (U.current = x, d(x));
|
|
2099
|
+
}, [e, p, b, l, d]), P(() => {
|
|
2100
|
+
if (r.auth)
|
|
2101
|
+
return r.auth.onAuthChange((x, f) => A(f));
|
|
2102
|
+
}, [r.auth]), P(() => {
|
|
2103
|
+
if (typeof r.onBootstrapChange == "function")
|
|
2104
|
+
return r.onBootstrapChange((x) => {
|
|
2105
|
+
v(
|
|
2106
|
+
(f) => f.status === "ready" ? { status: "ready", data: x } : f
|
|
2092
2107
|
);
|
|
2093
2108
|
});
|
|
2094
|
-
}, [
|
|
2095
|
-
if (!e ||
|
|
2096
|
-
let
|
|
2097
|
-
return
|
|
2098
|
-
|
|
2099
|
-
|
|
2109
|
+
}, [r]), P(() => {
|
|
2110
|
+
if (!e || p.status === "ready" || p.status === "loading") return;
|
|
2111
|
+
let x = !1;
|
|
2112
|
+
return v({ status: "loading" }), r.bootstrap().then((f) => {
|
|
2113
|
+
if (x) return;
|
|
2114
|
+
v({ status: "ready", data: f }), n("ready", f);
|
|
2115
|
+
const w = i === "support" || i === "auth" || C;
|
|
2116
|
+
f.user?.has_active_subscription && !h && !w && (n("purchase_completed", {
|
|
2117
|
+
priceId: a ?? null,
|
|
2100
2118
|
sessionId: null,
|
|
2101
2119
|
restored: !0
|
|
2102
|
-
}), y({ kind: "purchase_success", restored: !0 }))
|
|
2103
|
-
}).catch((
|
|
2104
|
-
if (
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2120
|
+
}), y({ kind: "purchase_success", restored: !0 }));
|
|
2121
|
+
}).catch((f) => {
|
|
2122
|
+
if (x) return;
|
|
2123
|
+
const w = f instanceof L ? f : new L("unknown", "Failed to load paywall", { cause: f });
|
|
2124
|
+
v({ status: "error", error: w }), n("error", w);
|
|
2107
2125
|
}), () => {
|
|
2108
|
-
|
|
2126
|
+
x = !0;
|
|
2109
2127
|
};
|
|
2110
|
-
}, [e,
|
|
2128
|
+
}, [e, r]), We(() => {
|
|
2111
2129
|
if (!e) {
|
|
2112
|
-
y({ kind: "layout" }),
|
|
2130
|
+
y({ kind: "layout" }), I.current = !1;
|
|
2113
2131
|
return;
|
|
2114
2132
|
}
|
|
2115
|
-
i === "support" ? y({ kind: "support", origin: "standalone" }) : i === "auth"
|
|
2116
|
-
|
|
2117
|
-
|
|
2133
|
+
i === "support" ? y({ kind: "support", origin: "standalone" }) : i === "auth" ? y(a ? {
|
|
2134
|
+
kind: "auth_gate",
|
|
2135
|
+
pendingCheckout: { priceId: a, direct: !0 },
|
|
2136
|
+
origin: "standalone",
|
|
2137
|
+
intent: "preauth"
|
|
2138
|
+
} : { kind: "auth_gate", origin: "standalone" }) : i === "awaiting_payment" && a && c ? y({
|
|
2139
|
+
kind: "awaiting_payment",
|
|
2140
|
+
priceId: a,
|
|
2141
|
+
url: c
|
|
2142
|
+
}) : i === "popup_blocked" && a && c && y({
|
|
2143
|
+
kind: "popup_blocked",
|
|
2144
|
+
priceId: a,
|
|
2145
|
+
url: c
|
|
2146
|
+
});
|
|
2147
|
+
}, [e, i, a, c]);
|
|
2148
|
+
const M = async (x) => {
|
|
2118
2149
|
try {
|
|
2119
|
-
const
|
|
2120
|
-
priceId:
|
|
2121
|
-
|
|
2150
|
+
const f = r.getCachedOffers?.() ?? null, w = f ? N(f, x) : null, B = await r.createCheckout({
|
|
2151
|
+
priceId: x,
|
|
2152
|
+
offerId: w?.id,
|
|
2153
|
+
ignoreActivePurchase: h === !0
|
|
2122
2154
|
});
|
|
2123
|
-
if (n("checkout_started", { priceId:
|
|
2124
|
-
const
|
|
2125
|
-
if (
|
|
2155
|
+
if (n("checkout_started", { priceId: x, url: B.url, acquiring: B.acquiring }), typeof window > "u" || !B.url) return;
|
|
2156
|
+
const $ = window.open(B.url, "_blank");
|
|
2157
|
+
if ($) {
|
|
2126
2158
|
try {
|
|
2127
|
-
|
|
2159
|
+
$.opener = null;
|
|
2128
2160
|
} catch {
|
|
2129
2161
|
}
|
|
2130
|
-
y({ kind: "awaiting_payment", priceId:
|
|
2162
|
+
y({ kind: "awaiting_payment", priceId: x, url: B.url });
|
|
2131
2163
|
} else
|
|
2132
|
-
y({ kind: "popup_blocked", priceId:
|
|
2133
|
-
} catch (
|
|
2134
|
-
if (
|
|
2164
|
+
y({ kind: "popup_blocked", priceId: x, url: B.url });
|
|
2165
|
+
} catch (f) {
|
|
2166
|
+
if (f instanceof L && f.code === "already_purchased") {
|
|
2135
2167
|
try {
|
|
2136
|
-
await
|
|
2168
|
+
await r.getUser({ force: !0 });
|
|
2137
2169
|
} catch {
|
|
2138
2170
|
}
|
|
2139
|
-
n("purchase_completed", { priceId:
|
|
2171
|
+
n("purchase_completed", { priceId: x, sessionId: null, restored: !0 }), C ? t() : y({ kind: "purchase_success", restored: !0 });
|
|
2140
2172
|
return;
|
|
2141
2173
|
}
|
|
2142
|
-
const
|
|
2143
|
-
n("error",
|
|
2174
|
+
const w = f instanceof L ? f : new L("checkout_failed", "Checkout failed", { cause: f });
|
|
2175
|
+
n("error", w), C ? t() : y({ kind: "layout" });
|
|
2144
2176
|
}
|
|
2145
|
-
},
|
|
2177
|
+
}, O = (x, f) => {
|
|
2146
2178
|
if (typeof window > "u") return;
|
|
2147
|
-
const
|
|
2148
|
-
if (
|
|
2179
|
+
const w = window.open(f, "_blank");
|
|
2180
|
+
if (w) {
|
|
2149
2181
|
try {
|
|
2150
|
-
|
|
2182
|
+
w.opener = null;
|
|
2151
2183
|
} catch {
|
|
2152
2184
|
}
|
|
2153
|
-
y({ kind: "awaiting_payment", priceId:
|
|
2185
|
+
y({ kind: "awaiting_payment", priceId: x, url: f });
|
|
2154
2186
|
}
|
|
2155
2187
|
};
|
|
2156
|
-
|
|
2157
|
-
if (
|
|
2158
|
-
|
|
2159
|
-
const
|
|
2188
|
+
P(() => {
|
|
2189
|
+
if (b.kind !== "auth_gate" || !m || m.user.is_anonymous || I.current) return;
|
|
2190
|
+
I.current = !0;
|
|
2191
|
+
const x = b.pendingCheckout, f = b.origin;
|
|
2160
2192
|
y({ kind: "verifying" }), (async () => {
|
|
2161
|
-
if (!
|
|
2193
|
+
if (!h)
|
|
2162
2194
|
try {
|
|
2163
|
-
if ((await
|
|
2195
|
+
if ((await r.getUser({ force: !0 })).has_active_subscription) {
|
|
2164
2196
|
n("purchase_completed", {
|
|
2165
|
-
priceId:
|
|
2197
|
+
priceId: x?.priceId ?? null,
|
|
2166
2198
|
sessionId: null,
|
|
2167
2199
|
restored: !0
|
|
2168
|
-
}), y({ kind: "purchase_success", restored: !0 });
|
|
2200
|
+
}), x?.direct ? t() : y({ kind: "purchase_success", restored: !0 });
|
|
2169
2201
|
return;
|
|
2170
2202
|
}
|
|
2171
2203
|
} catch {
|
|
2172
2204
|
}
|
|
2173
|
-
if (!
|
|
2174
|
-
|
|
2205
|
+
if (!x) {
|
|
2206
|
+
f === "standalone" ? t() : y({ kind: "layout" });
|
|
2175
2207
|
return;
|
|
2176
2208
|
}
|
|
2177
|
-
await
|
|
2209
|
+
await M(x.priceId);
|
|
2178
2210
|
})().finally(() => {
|
|
2179
|
-
|
|
2211
|
+
I.current = !1;
|
|
2180
2212
|
});
|
|
2181
|
-
}, [
|
|
2182
|
-
const
|
|
2183
|
-
if (
|
|
2184
|
-
|
|
2213
|
+
}, [m, b]);
|
|
2214
|
+
const j = async (x, f) => {
|
|
2215
|
+
if (x === "close") {
|
|
2216
|
+
t();
|
|
2185
2217
|
return;
|
|
2186
2218
|
}
|
|
2187
|
-
if (
|
|
2188
|
-
n("price_selected",
|
|
2219
|
+
if (x === "price_selected") {
|
|
2220
|
+
n("price_selected", f);
|
|
2189
2221
|
return;
|
|
2190
2222
|
}
|
|
2191
|
-
if (
|
|
2192
|
-
if (!
|
|
2193
|
-
const
|
|
2194
|
-
if (
|
|
2223
|
+
if (x === "restore") {
|
|
2224
|
+
if (!r.auth) return;
|
|
2225
|
+
const w = r.auth.getCachedSession();
|
|
2226
|
+
if (w && !w.user.is_anonymous) return;
|
|
2195
2227
|
y({ kind: "auth_gate", intent: "restore" });
|
|
2196
2228
|
return;
|
|
2197
2229
|
}
|
|
2198
|
-
if (
|
|
2230
|
+
if (x === "support") {
|
|
2199
2231
|
y({ kind: "support", origin: "layout" });
|
|
2200
2232
|
return;
|
|
2201
2233
|
}
|
|
2202
|
-
if (
|
|
2203
|
-
const
|
|
2204
|
-
if (!
|
|
2205
|
-
n("error", new
|
|
2234
|
+
if (x === "checkout" && p.status === "ready") {
|
|
2235
|
+
const w = f?.priceId;
|
|
2236
|
+
if (!w) {
|
|
2237
|
+
n("error", new L("no_price", "No price selected"));
|
|
2206
2238
|
return;
|
|
2207
2239
|
}
|
|
2208
|
-
const
|
|
2209
|
-
if (
|
|
2210
|
-
y({ kind: "auth_gate", pendingCheckout: { priceId:
|
|
2240
|
+
const B = p.data.settings.checkout_mode ?? "guest", $ = r.auth?.getCachedSession() ?? null, De = !!$ && !$.user.is_anonymous;
|
|
2241
|
+
if (B === "preauth" && !!r.auth && !De) {
|
|
2242
|
+
y({ kind: "auth_gate", pendingCheckout: { priceId: w } });
|
|
2211
2243
|
return;
|
|
2212
2244
|
}
|
|
2213
|
-
await
|
|
2245
|
+
await M(w);
|
|
2214
2246
|
}
|
|
2215
|
-
},
|
|
2247
|
+
}, R = p.status === "ready" ? p.data.settings.brand_color : null, T = p.status === "ready" ? p.data.settings.allow_close !== !1 : !0, z = b.kind === "layout" && p.status === "ready" ? Te(p.data.offers) : null, q = z ? /* @__PURE__ */ o(At, { offer: z }) : null, Y = {
|
|
2216
2248
|
type: "auth_panel",
|
|
2217
2249
|
// Заголовок не задаём — AuthGate сам решит по intent'у (restore →
|
|
2218
2250
|
// "Restore Purchases", остальные → дефолтный "Welcome back!").
|
|
@@ -2221,92 +2253,92 @@ function or({
|
|
|
2221
2253
|
// Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
|
|
2222
2254
|
// чем хотим показывать "Signed in as ..." промежуточным экраном.
|
|
2223
2255
|
hide_when_authenticated: !1,
|
|
2224
|
-
providers:
|
|
2225
|
-
},
|
|
2226
|
-
|
|
2256
|
+
providers: p.status === "ready" ? p.data.settings.auth_providers : void 0
|
|
2257
|
+
}, V = b.kind === "support" ? /* @__PURE__ */ o(
|
|
2258
|
+
Et,
|
|
2227
2259
|
{
|
|
2228
|
-
client:
|
|
2229
|
-
authSession:
|
|
2230
|
-
origin:
|
|
2260
|
+
client: r,
|
|
2261
|
+
authSession: m,
|
|
2262
|
+
origin: b.origin,
|
|
2231
2263
|
onBack: () => {
|
|
2232
|
-
|
|
2264
|
+
b.origin === "standalone" ? t() : y({ kind: "layout" });
|
|
2233
2265
|
}
|
|
2234
2266
|
}
|
|
2235
|
-
) : null,
|
|
2236
|
-
return /* @__PURE__ */ o(
|
|
2237
|
-
|
|
2267
|
+
) : null, K = b.kind === "auth_gate" && b.origin !== "standalone" || b.kind === "support", X = p.status === "ready" ? p.data : null;
|
|
2268
|
+
return /* @__PURE__ */ o(at, { bootstrap: X, forceLocale: _, children: /* @__PURE__ */ o(
|
|
2269
|
+
lt,
|
|
2238
2270
|
{
|
|
2239
2271
|
open: e,
|
|
2240
|
-
onClose:
|
|
2241
|
-
brandColor:
|
|
2242
|
-
topBanner:
|
|
2243
|
-
allowClose:
|
|
2244
|
-
hideCloseButton:
|
|
2245
|
-
inline:
|
|
2272
|
+
onClose: t,
|
|
2273
|
+
brandColor: R,
|
|
2274
|
+
topBanner: q,
|
|
2275
|
+
allowClose: T,
|
|
2276
|
+
hideCloseButton: K,
|
|
2277
|
+
inline: g,
|
|
2246
2278
|
labelledBy: "pw-title",
|
|
2247
|
-
children:
|
|
2248
|
-
|
|
2279
|
+
children: l ? /* @__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(lr, { verifying: b.kind === "verifying" }) : p.status === "error" ? /* @__PURE__ */ o(cr, { message: p.error.message }) : b.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
|
|
2280
|
+
_t,
|
|
2249
2281
|
{
|
|
2250
|
-
block:
|
|
2251
|
-
bootstrap:
|
|
2252
|
-
auth:
|
|
2253
|
-
authSession:
|
|
2254
|
-
showBack:
|
|
2255
|
-
intent:
|
|
2256
|
-
initialMode:
|
|
2282
|
+
block: Y,
|
|
2283
|
+
bootstrap: p.data,
|
|
2284
|
+
auth: r.auth,
|
|
2285
|
+
authSession: m,
|
|
2286
|
+
showBack: b.origin !== "standalone",
|
|
2287
|
+
intent: b.intent ?? (b.origin === "standalone" ? "standalone" : "preauth"),
|
|
2288
|
+
initialMode: b.origin === "standalone" ? s : void 0,
|
|
2257
2289
|
onBack: () => {
|
|
2258
|
-
|
|
2290
|
+
b.origin === "standalone" ? t() : y({ kind: "layout" });
|
|
2259
2291
|
}
|
|
2260
2292
|
}
|
|
2261
|
-
) :
|
|
2262
|
-
|
|
2293
|
+
) : b.kind === "awaiting_payment" ? /* @__PURE__ */ o(
|
|
2294
|
+
dr,
|
|
2263
2295
|
{
|
|
2264
|
-
client:
|
|
2296
|
+
client: r,
|
|
2265
2297
|
onBack: () => y({ kind: "layout" }),
|
|
2266
2298
|
onReopen: () => {
|
|
2267
2299
|
if (typeof window > "u") return;
|
|
2268
|
-
const
|
|
2269
|
-
if (
|
|
2300
|
+
const x = window.open(b.url, "_blank");
|
|
2301
|
+
if (x)
|
|
2270
2302
|
try {
|
|
2271
|
-
|
|
2303
|
+
x.opener = null;
|
|
2272
2304
|
} catch {
|
|
2273
2305
|
}
|
|
2274
2306
|
},
|
|
2275
|
-
onRetry: () =>
|
|
2307
|
+
onRetry: () => M(b.priceId)
|
|
2276
2308
|
}
|
|
2277
|
-
) :
|
|
2278
|
-
|
|
2309
|
+
) : b.kind === "popup_blocked" ? /* @__PURE__ */ o(ur, { onReopen: () => O(b.priceId, b.url) }) : /* @__PURE__ */ o(
|
|
2310
|
+
ir,
|
|
2279
2311
|
{
|
|
2280
|
-
layout:
|
|
2281
|
-
bootstrap:
|
|
2282
|
-
onAction:
|
|
2283
|
-
auth:
|
|
2284
|
-
authSession:
|
|
2312
|
+
layout: p.data.layout,
|
|
2313
|
+
bootstrap: p.data,
|
|
2314
|
+
onAction: j,
|
|
2315
|
+
auth: r.auth,
|
|
2316
|
+
authSession: m
|
|
2285
2317
|
}
|
|
2286
2318
|
))
|
|
2287
2319
|
}
|
|
2288
2320
|
) });
|
|
2289
2321
|
}
|
|
2290
|
-
function
|
|
2291
|
-
const { t: e } =
|
|
2322
|
+
function lr({ verifying: r }) {
|
|
2323
|
+
const { t: e } = S();
|
|
2292
2324
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
2293
2325
|
/* @__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)]" }),
|
|
2294
|
-
/* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children:
|
|
2326
|
+
/* @__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…") })
|
|
2295
2327
|
] });
|
|
2296
2328
|
}
|
|
2297
|
-
function
|
|
2298
|
-
const { t: e } =
|
|
2329
|
+
function cr({ message: r }) {
|
|
2330
|
+
const { t: e } = S();
|
|
2299
2331
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2300
2332
|
/* @__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: [
|
|
2301
2333
|
/* @__PURE__ */ o("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
|
|
2302
2334
|
/* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
2303
2335
|
] }) }),
|
|
2304
2336
|
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: e("modal.error_generic", "Something went wrong") }),
|
|
2305
|
-
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children:
|
|
2337
|
+
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: r })
|
|
2306
2338
|
] });
|
|
2307
2339
|
}
|
|
2308
|
-
function
|
|
2309
|
-
const { t: e } =
|
|
2340
|
+
function ur({ onReopen: r }) {
|
|
2341
|
+
const { t: e } = S();
|
|
2310
2342
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2311
2343
|
/* @__PURE__ */ o(
|
|
2312
2344
|
"div",
|
|
@@ -2326,7 +2358,7 @@ function lr({ onReopen: t }) {
|
|
|
2326
2358
|
"button",
|
|
2327
2359
|
{
|
|
2328
2360
|
type: "button",
|
|
2329
|
-
onClick:
|
|
2361
|
+
onClick: r,
|
|
2330
2362
|
class: "mt-1 rounded-xl px-4 py-2 text-xs 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)]",
|
|
2331
2363
|
style: {
|
|
2332
2364
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
@@ -2337,26 +2369,26 @@ function lr({ onReopen: t }) {
|
|
|
2337
2369
|
)
|
|
2338
2370
|
] });
|
|
2339
2371
|
}
|
|
2340
|
-
function
|
|
2341
|
-
client:
|
|
2372
|
+
function dr({
|
|
2373
|
+
client: r,
|
|
2342
2374
|
onBack: e,
|
|
2343
|
-
onReopen:
|
|
2375
|
+
onReopen: t,
|
|
2344
2376
|
onRetry: n
|
|
2345
2377
|
}) {
|
|
2346
|
-
const { t: i } =
|
|
2347
|
-
|
|
2348
|
-
|
|
2378
|
+
const { t: i } = S(), [s, a] = k(!1), [c, l] = k(!1), h = D(null);
|
|
2379
|
+
P(() => () => {
|
|
2380
|
+
h.current !== null && clearTimeout(h.current);
|
|
2349
2381
|
}, []);
|
|
2350
|
-
const
|
|
2382
|
+
const d = async () => {
|
|
2351
2383
|
if (!s) {
|
|
2352
2384
|
a(!0), l(!1);
|
|
2353
2385
|
try {
|
|
2354
|
-
if ((await
|
|
2386
|
+
if ((await r.getUser({ force: !0 })).has_active_subscription) {
|
|
2355
2387
|
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
2356
2388
|
return;
|
|
2357
2389
|
}
|
|
2358
|
-
l(!0),
|
|
2359
|
-
l(!1),
|
|
2390
|
+
l(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
2391
|
+
l(!1), h.current = null;
|
|
2360
2392
|
}, 5e3);
|
|
2361
2393
|
} catch {
|
|
2362
2394
|
l(!0);
|
|
@@ -2396,7 +2428,7 @@ function cr({
|
|
|
2396
2428
|
"button",
|
|
2397
2429
|
{
|
|
2398
2430
|
type: "button",
|
|
2399
|
-
onClick:
|
|
2431
|
+
onClick: d,
|
|
2400
2432
|
disabled: s,
|
|
2401
2433
|
class: "mt-1 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2402
2434
|
style: {
|
|
@@ -2414,7 +2446,7 @@ function cr({
|
|
|
2414
2446
|
"button",
|
|
2415
2447
|
{
|
|
2416
2448
|
type: "button",
|
|
2417
|
-
onClick:
|
|
2449
|
+
onClick: t,
|
|
2418
2450
|
class: "mt-2.5 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
2419
2451
|
children: i("payment.open_checkout_again", "Open checkout again")
|
|
2420
2452
|
}
|
|
@@ -2431,11 +2463,11 @@ function cr({
|
|
|
2431
2463
|
)
|
|
2432
2464
|
] });
|
|
2433
2465
|
}
|
|
2434
|
-
function
|
|
2435
|
-
onContinue:
|
|
2466
|
+
function ve({
|
|
2467
|
+
onContinue: r,
|
|
2436
2468
|
restored: e = !1
|
|
2437
2469
|
}) {
|
|
2438
|
-
const { t
|
|
2470
|
+
const { t } = S();
|
|
2439
2471
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2440
2472
|
/* @__PURE__ */ o(
|
|
2441
2473
|
"div",
|
|
@@ -2460,37 +2492,37 @@ function ke({
|
|
|
2460
2492
|
) })
|
|
2461
2493
|
}
|
|
2462
2494
|
),
|
|
2463
|
-
/* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ?
|
|
2464
|
-
/* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ?
|
|
2495
|
+
/* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? t("modal.purchase_restored_title", "Subscription restored") : t("modal.purchase_success_title", "Payment received") }),
|
|
2496
|
+
/* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? t(
|
|
2465
2497
|
"modal.purchase_restored_subtitle",
|
|
2466
2498
|
"Welcome back — your subscription is already active."
|
|
2467
|
-
) :
|
|
2499
|
+
) : t("modal.purchase_success_subtitle", "Your subscription is now active.") }),
|
|
2468
2500
|
/* @__PURE__ */ o(
|
|
2469
2501
|
"button",
|
|
2470
2502
|
{
|
|
2471
2503
|
type: "button",
|
|
2472
|
-
onClick:
|
|
2504
|
+
onClick: r,
|
|
2473
2505
|
class: "mt-3 rounded-xl px-5 py-2.5 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)]",
|
|
2474
2506
|
style: {
|
|
2475
2507
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2476
2508
|
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2477
2509
|
},
|
|
2478
|
-
children:
|
|
2510
|
+
children: t("modal.continue", "Continue")
|
|
2479
2511
|
}
|
|
2480
2512
|
)
|
|
2481
2513
|
] });
|
|
2482
2514
|
}
|
|
2483
|
-
const
|
|
2484
|
-
class
|
|
2515
|
+
const hr = 10 * 6e4, pr = 5e3, fr = 3e4;
|
|
2516
|
+
class gr {
|
|
2485
2517
|
constructor(e) {
|
|
2486
2518
|
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
2487
2519
|
client: e.client,
|
|
2488
2520
|
onActive: e.onActive,
|
|
2489
2521
|
onTimeout: e.onTimeout ?? (() => {
|
|
2490
2522
|
}),
|
|
2491
|
-
timeoutMs: e.timeoutMs ??
|
|
2492
|
-
visibleIntervalMs: e.visibleIntervalMs ??
|
|
2493
|
-
hiddenIntervalMs: e.hiddenIntervalMs ??
|
|
2523
|
+
timeoutMs: e.timeoutMs ?? hr,
|
|
2524
|
+
visibleIntervalMs: e.visibleIntervalMs ?? pr,
|
|
2525
|
+
hiddenIntervalMs: e.hiddenIntervalMs ?? fr
|
|
2494
2526
|
};
|
|
2495
2527
|
}
|
|
2496
2528
|
start() {
|
|
@@ -2516,32 +2548,37 @@ class pr {
|
|
|
2516
2548
|
}
|
|
2517
2549
|
scheduleNext() {
|
|
2518
2550
|
if (this.stopped) return;
|
|
2519
|
-
const
|
|
2551
|
+
const t = typeof document < "u" && document.visibilityState === "visible" ? this.opts.visibleIntervalMs : this.opts.hiddenIntervalMs;
|
|
2520
2552
|
this.timer = setTimeout(async () => {
|
|
2521
2553
|
await this.check(), this.scheduleNext();
|
|
2522
|
-
},
|
|
2554
|
+
}, t);
|
|
2523
2555
|
}
|
|
2524
2556
|
handleVisibilityChange() {
|
|
2525
2557
|
typeof document > "u" || (document.visibilityState === "visible" && this.check(), this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.scheduleNext());
|
|
2526
2558
|
}
|
|
2527
2559
|
handleMessage(e) {
|
|
2528
|
-
const
|
|
2529
|
-
!
|
|
2560
|
+
const t = e.data;
|
|
2561
|
+
!t || typeof t != "object" || t.type === "paywall_purchase" && this.check();
|
|
2530
2562
|
}
|
|
2531
2563
|
}
|
|
2532
|
-
function
|
|
2564
|
+
function mr() {
|
|
2533
2565
|
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
2534
2566
|
}
|
|
2535
|
-
const
|
|
2567
|
+
const se = {
|
|
2568
|
+
open: !1,
|
|
2569
|
+
view: null,
|
|
2570
|
+
error: null,
|
|
2571
|
+
processing: !1
|
|
2572
|
+
}, F = {
|
|
2536
2573
|
status: "paywall_status",
|
|
2537
2574
|
priceId: "paywall_price_id",
|
|
2538
2575
|
sessionId: "paywall_session_id"
|
|
2539
2576
|
};
|
|
2540
|
-
let
|
|
2577
|
+
let yr = class {
|
|
2541
2578
|
constructor(e) {
|
|
2542
|
-
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 =
|
|
2543
|
-
const { auth:
|
|
2544
|
-
this.auth =
|
|
2579
|
+
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();
|
|
2580
|
+
const { auth: t, ownsAuth: n } = br(e);
|
|
2581
|
+
this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new Re({ ...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) => {
|
|
2545
2582
|
this.emit("userChange", i);
|
|
2546
2583
|
}), this.auth && (this.authUnsub = this.auth.onAuthChange((i, s) => {
|
|
2547
2584
|
this.emit("authChange", { event: i, session: s });
|
|
@@ -2549,20 +2586,20 @@ let gr = class {
|
|
|
2549
2586
|
}
|
|
2550
2587
|
initTracker(e) {
|
|
2551
2588
|
if (e === !1) return;
|
|
2552
|
-
const
|
|
2553
|
-
if (
|
|
2554
|
-
const n =
|
|
2555
|
-
this.tracker = new
|
|
2589
|
+
const t = typeof e == "object" && e !== null ? e : {};
|
|
2590
|
+
if (t.enabled === !1) return;
|
|
2591
|
+
const n = t.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
|
|
2592
|
+
this.tracker = new ze({
|
|
2556
2593
|
endpoint: n,
|
|
2557
2594
|
paywallId: this.billing.paywallId,
|
|
2558
2595
|
capabilities: this.billing.capabilities,
|
|
2559
2596
|
getVisitorId: () => this.billing.getVisitorId(),
|
|
2560
2597
|
getCachedVisitorId: () => this.billing.getCachedVisitorId(),
|
|
2561
2598
|
getUserId: () => this.billing.getIdentity()?.userId ?? null,
|
|
2562
|
-
flushIntervalMs:
|
|
2563
|
-
maxBufferSize:
|
|
2564
|
-
fetch:
|
|
2565
|
-
sendBeacon:
|
|
2599
|
+
flushIntervalMs: t.flushIntervalMs,
|
|
2600
|
+
maxBufferSize: t.maxBufferSize,
|
|
2601
|
+
fetch: t.fetch,
|
|
2602
|
+
sendBeacon: t.sendBeacon
|
|
2566
2603
|
}), this.on("open", () => this.tracker?.track("paywall_opened")), this.on(
|
|
2567
2604
|
"ready",
|
|
2568
2605
|
(i) => this.tracker?.track("paywall_viewed", {
|
|
@@ -2615,8 +2652,8 @@ let gr = class {
|
|
|
2615
2652
|
* Самый частый кейс — `track('app_opened')` от хоста сразу после загрузки
|
|
2616
2653
|
* приложения, чтобы зафиксировать воронку до открытия пейвола.
|
|
2617
2654
|
*/
|
|
2618
|
-
track(e,
|
|
2619
|
-
this.tracker?.track(e,
|
|
2655
|
+
track(e, t) {
|
|
2656
|
+
this.tracker?.track(e, t);
|
|
2620
2657
|
}
|
|
2621
2658
|
/**
|
|
2622
2659
|
* Удобный шорткат вместо `paywall.on('userChange', cb)` — самый частый
|
|
@@ -2648,20 +2685,20 @@ let gr = class {
|
|
|
2648
2685
|
* (navigator.language → locale_default).
|
|
2649
2686
|
*/
|
|
2650
2687
|
setLocale(e) {
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2688
|
+
const t = e ?? null;
|
|
2689
|
+
t !== this.forceLocale && (this.forceLocale = t, this.handle && this.handle.update({ locale: t }));
|
|
2653
2690
|
}
|
|
2654
|
-
on(e,
|
|
2691
|
+
on(e, t) {
|
|
2655
2692
|
let n = this.listeners.get(e);
|
|
2656
|
-
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(
|
|
2693
|
+
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t), () => n.delete(t);
|
|
2657
2694
|
}
|
|
2658
|
-
off(e,
|
|
2659
|
-
this.listeners.get(e)?.delete(
|
|
2695
|
+
off(e, t) {
|
|
2696
|
+
this.listeners.get(e)?.delete(t);
|
|
2660
2697
|
}
|
|
2661
|
-
emit(e, ...
|
|
2698
|
+
emit(e, ...t) {
|
|
2662
2699
|
const n = this.listeners.get(e);
|
|
2663
2700
|
if (!n) return;
|
|
2664
|
-
const i =
|
|
2701
|
+
const i = t[0];
|
|
2665
2702
|
for (const s of n)
|
|
2666
2703
|
try {
|
|
2667
2704
|
s(i);
|
|
@@ -2739,6 +2776,188 @@ let gr = class {
|
|
|
2739
2776
|
openSignup(e = {}) {
|
|
2740
2777
|
this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signup" });
|
|
2741
2778
|
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Direct-checkout: создать checkout-URL по конкретной цене и сразу открыть
|
|
2781
|
+
* платёжного провайдера, минуя layout с тарифами. Полезно когда
|
|
2782
|
+
* host-приложение рендерит pricing-карточки/таблицу собственным UI и
|
|
2783
|
+
* хочет, чтобы клик по «Buy / Get this plan» вёл прямо в Stripe/Paddle.
|
|
2784
|
+
*
|
|
2785
|
+
* **Late-mount UX.** В отличие от `open()`, модалка не появляется во время
|
|
2786
|
+
* фоновой работы (bootstrap + visibility/trial gates + createCheckout).
|
|
2787
|
+
* Хост на этой фазе показывает busy-state прямо на своей кнопке (через
|
|
2788
|
+
* `state.processing === true` из `paywall.getState()` — или автоматически
|
|
2789
|
+
* через `<PaywallButton priceId>` в sdk-react). Модалка монтируется
|
|
2790
|
+
* ТОЛЬКО когда реально нужна UI:
|
|
2791
|
+
* - `checkout_mode='preauth'` + managed-auth + не залогинен → auth-gate
|
|
2792
|
+
* (форма signin'а); после успеха auto-resume в createCheckout.
|
|
2793
|
+
* - popup провайдера заблокирован браузером → popup_blocked view с
|
|
2794
|
+
* retry-кнопкой под fresh user gesture.
|
|
2795
|
+
* - popup открылся успешно → awaiting_payment view (индикатор «оплати
|
|
2796
|
+
* в новой вкладке» + I've paid).
|
|
2797
|
+
*
|
|
2798
|
+
* Что эмитится без модалки:
|
|
2799
|
+
* - `purchase_completed{restored:true, priceId}` когда юзер уже подписан
|
|
2800
|
+
* (cached user, fresh bootstrap, или 409 hasActivePurchase от бэка) —
|
|
2801
|
+
* headless reject;
|
|
2802
|
+
* - `error` когда createCheckout упал или identity.email отсутствует;
|
|
2803
|
+
* - `visibility_blocked` / `trial_blocked` — стандартные gate-эвенты.
|
|
2804
|
+
*
|
|
2805
|
+
* Что эмитится одновременно с модалкой:
|
|
2806
|
+
* - `checkout_started{priceId, url, acquiring}` ровно когда headless URL
|
|
2807
|
+
* получен, ДО mount'а awaiting_payment/popup_blocked.
|
|
2808
|
+
*
|
|
2809
|
+
* Offer (countdown-скидка) автоматически резолвится из cached offers'ов
|
|
2810
|
+
* через `getOfferForPrice(priceId)` и передаётся в createCheckout как
|
|
2811
|
+
* `offerId` — чтобы duration_minutes-офферы тоже применились на бэке
|
|
2812
|
+
* (для них нет server-side таймера, без явного offer-id скидка теряется).
|
|
2813
|
+
*
|
|
2814
|
+
* Требования:
|
|
2815
|
+
* - `identity.email` должен быть выставлен (через `opts.identity`, либо
|
|
2816
|
+
* managed-auth, либо ранний `setIdentity`/`paywall.open({identity})`).
|
|
2817
|
+
* Без email бэк `/start-checkout` 400'нёт; SDK эмитнет `error`.
|
|
2818
|
+
* - В `checkout_mode='preauth'` без managed-auth — backend требует
|
|
2819
|
+
* email-юзера; убедись что `identity.email` явно задан.
|
|
2820
|
+
*
|
|
2821
|
+
* Без модалки совсем (когда host рендерит свой awaiting-payment экран) —
|
|
2822
|
+
* используй `paywall.billing.createCheckout({priceId, offerId})` напрямую,
|
|
2823
|
+
* но тогда auth-gate / popup_blocked / awaiting_payment придётся рисовать
|
|
2824
|
+
* самостоятельно.
|
|
2825
|
+
*/
|
|
2826
|
+
checkout(e, t = {}) {
|
|
2827
|
+
if (t.identity && this.billing.setIdentity(t.identity), t.renew !== !0 && this.billing.getCachedUser()?.has_active_subscription) {
|
|
2828
|
+
this.emit("purchase_completed", {
|
|
2829
|
+
priceId: e,
|
|
2830
|
+
sessionId: null,
|
|
2831
|
+
restored: !0
|
|
2832
|
+
});
|
|
2833
|
+
return;
|
|
2834
|
+
}
|
|
2835
|
+
this.runDirectCheckout(e, t);
|
|
2836
|
+
}
|
|
2837
|
+
/** Headless prep-work для `checkout(priceId, opts)`: bootstrap → gates →
|
|
2838
|
+
* preauth check → createCheckout → mount модалки с финальным view.
|
|
2839
|
+
* Вынесено отдельным методом ради чистого async/await flow вместо вложенных
|
|
2840
|
+
* then-chain'ов (5+ ветвей). Любая ошибка не пробрасывается наружу: эмитим
|
|
2841
|
+
* через `paywall.emit('error')` и выходим — host подписан на `error`-event. */
|
|
2842
|
+
async runDirectCheckout(e, t) {
|
|
2843
|
+
const n = t.renew === !0, i = t.skipTrial === !0, s = t.skipVisibility === !0;
|
|
2844
|
+
this.applyProcessing(!0);
|
|
2845
|
+
const a = () => {
|
|
2846
|
+
this.applyProcessing(!1);
|
|
2847
|
+
};
|
|
2848
|
+
let c;
|
|
2849
|
+
try {
|
|
2850
|
+
c = await this.billing.bootstrap();
|
|
2851
|
+
} catch (m) {
|
|
2852
|
+
const A = m instanceof L ? m : new L("unknown", "Failed to load paywall", { cause: m });
|
|
2853
|
+
this.emit("error", A), a();
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
if (!s) {
|
|
2857
|
+
const m = c.settings.visibility;
|
|
2858
|
+
if (m && (this.lastVisibility = m, !m.visible)) {
|
|
2859
|
+
this.emit("visibility_blocked", m), a();
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
if (!i && await this.checkTrialBeforeCheckout(c)) {
|
|
2864
|
+
a();
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2867
|
+
if (!n && c.user?.has_active_subscription) {
|
|
2868
|
+
this.emit("purchase_completed", {
|
|
2869
|
+
priceId: e,
|
|
2870
|
+
sessionId: null,
|
|
2871
|
+
restored: !0
|
|
2872
|
+
}), a();
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
const l = c.settings.checkout_mode ?? "guest", h = this.auth?.getCachedSession() ?? null, d = !!h && !h.user.is_anonymous;
|
|
2876
|
+
if (l === "preauth" && !!this.auth && !d) {
|
|
2877
|
+
this.purchased = !1, this.mountAndShow("auth", {
|
|
2878
|
+
renew: n,
|
|
2879
|
+
authMode: "signin",
|
|
2880
|
+
checkoutPriceId: e
|
|
2881
|
+
});
|
|
2882
|
+
return;
|
|
2883
|
+
}
|
|
2884
|
+
const _ = this.getOfferForPrice(e);
|
|
2885
|
+
let p;
|
|
2886
|
+
try {
|
|
2887
|
+
p = await this.billing.createCheckout({
|
|
2888
|
+
priceId: e,
|
|
2889
|
+
offerId: _?.offer.id,
|
|
2890
|
+
ignoreActivePurchase: n
|
|
2891
|
+
});
|
|
2892
|
+
} catch (m) {
|
|
2893
|
+
if (m instanceof L && m.code === "already_purchased") {
|
|
2894
|
+
try {
|
|
2895
|
+
await this.billing.getUser({ force: !0 });
|
|
2896
|
+
} catch {
|
|
2897
|
+
}
|
|
2898
|
+
this.emit("purchase_completed", {
|
|
2899
|
+
priceId: e,
|
|
2900
|
+
sessionId: null,
|
|
2901
|
+
restored: !0
|
|
2902
|
+
}), a();
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2905
|
+
const A = m instanceof L ? m : new L("checkout_failed", "Checkout failed", { cause: m });
|
|
2906
|
+
this.emit("error", A), a();
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2909
|
+
if (this.emit("checkout_started", {
|
|
2910
|
+
priceId: e,
|
|
2911
|
+
url: p.url,
|
|
2912
|
+
acquiring: p.acquiring
|
|
2913
|
+
}), this.startUserWatcher(), typeof window > "u" || !p.url) {
|
|
2914
|
+
this.mountAndShow("awaiting_payment", {
|
|
2915
|
+
renew: n,
|
|
2916
|
+
checkoutPriceId: e,
|
|
2917
|
+
checkoutUrl: p.url
|
|
2918
|
+
});
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2921
|
+
const v = window.open(p.url, "_blank");
|
|
2922
|
+
if (this.purchased = !1, v) {
|
|
2923
|
+
try {
|
|
2924
|
+
v.opener = null;
|
|
2925
|
+
} catch {
|
|
2926
|
+
}
|
|
2927
|
+
this.mountAndShow("awaiting_payment", {
|
|
2928
|
+
renew: n,
|
|
2929
|
+
checkoutPriceId: e,
|
|
2930
|
+
checkoutUrl: p.url
|
|
2931
|
+
});
|
|
2932
|
+
} else
|
|
2933
|
+
this.mountAndShow("popup_blocked", {
|
|
2934
|
+
renew: n,
|
|
2935
|
+
checkoutPriceId: e,
|
|
2936
|
+
checkoutUrl: p.url
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
/** Trial-check без mount'а (для late-mount direct-checkout). Возвращает
|
|
2940
|
+
* true если trial заблокировал — caller должен прекратить flow. На любой
|
|
2941
|
+
* storage-ошибке log+продолжаем (не блокируем продажу). */
|
|
2942
|
+
async checkTrialBeforeCheckout(e) {
|
|
2943
|
+
const t = e.settings.trial;
|
|
2944
|
+
if (!t) return !1;
|
|
2945
|
+
const n = this.ensureTrialStore(t);
|
|
2946
|
+
try {
|
|
2947
|
+
const i = await n.check();
|
|
2948
|
+
if (this.lastTrialStatus = i, i.mode === "none") return !1;
|
|
2949
|
+
if (i.blocked) {
|
|
2950
|
+
const s = await n.recordBlock();
|
|
2951
|
+
return this.lastTrialStatus = s, this.emit("trial_blocked", s), !0;
|
|
2952
|
+
}
|
|
2953
|
+
return this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), !1;
|
|
2954
|
+
} catch (i) {
|
|
2955
|
+
return typeof console < "u" && console.warn("[paywall] trial check failed", i), !1;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
applyProcessing(e) {
|
|
2959
|
+
this.currentState.processing !== e && this.applyState({ ...this.currentState, processing: e });
|
|
2960
|
+
}
|
|
2742
2961
|
/**
|
|
2743
2962
|
* Headless anonymous signin без открытия модалки. Внутри:
|
|
2744
2963
|
* idempotent (если уже анон — instant return) → resume через сохранённый
|
|
@@ -2752,17 +2971,17 @@ let gr = class {
|
|
|
2752
2971
|
*/
|
|
2753
2972
|
signInAnonymously() {
|
|
2754
2973
|
return this.auth ? this.auth.signInAnonymously() : Promise.reject(
|
|
2755
|
-
new
|
|
2974
|
+
new L(
|
|
2756
2975
|
"invalid_config",
|
|
2757
2976
|
"signInAnonymously requires managed-auth. Pass `auth: true` to PaywallUI."
|
|
2758
2977
|
)
|
|
2759
2978
|
);
|
|
2760
2979
|
}
|
|
2761
|
-
openInternal(e,
|
|
2762
|
-
|
|
2763
|
-
const n =
|
|
2980
|
+
openInternal(e, t) {
|
|
2981
|
+
t.identity && this.billing.setIdentity(t.identity), this.purchased = !1;
|
|
2982
|
+
const n = t.skipTrial === !0 || e === "support", i = t.skipVisibility === !0 || e === "support" || e === "auth", s = t.renew === !0;
|
|
2764
2983
|
if (n && i) {
|
|
2765
|
-
this.mountAndShow(e, { renew: s, authMode:
|
|
2984
|
+
this.mountAndShow(e, { renew: s, authMode: t.authMode });
|
|
2766
2985
|
return;
|
|
2767
2986
|
}
|
|
2768
2987
|
const a = this.billing.getCachedBootstrap();
|
|
@@ -2775,23 +2994,25 @@ let gr = class {
|
|
|
2775
2994
|
});
|
|
2776
2995
|
return;
|
|
2777
2996
|
}
|
|
2778
|
-
this.billing.bootstrap().then(
|
|
2997
|
+
this.billing.bootstrap().then(
|
|
2998
|
+
(c) => this.runOpenGates(e, c, { skipTrial: n, skipVisibility: i, renew: s })
|
|
2999
|
+
).catch(() => {
|
|
2779
3000
|
this.mountAndShow(e, { renew: s });
|
|
2780
3001
|
});
|
|
2781
3002
|
}
|
|
2782
3003
|
/** Применить gates ПОСЛЕ того, как модалка уже смонтирована (mount-then-load
|
|
2783
3004
|
* путь). Если gate блокирует — close() + emit. Если юзер уже сам закрыл
|
|
2784
3005
|
* модалку до резолва bootstrap'а — no-op (isOpen=false). */
|
|
2785
|
-
runDelayedGates(e,
|
|
3006
|
+
runDelayedGates(e, t) {
|
|
2786
3007
|
if (!this.isOpen) return;
|
|
2787
|
-
if (!
|
|
3008
|
+
if (!t.skipVisibility) {
|
|
2788
3009
|
const s = e.settings.visibility;
|
|
2789
3010
|
if (s && (this.lastVisibility = s, !s.visible)) {
|
|
2790
3011
|
this.close(), this.emit("visibility_blocked", s);
|
|
2791
3012
|
return;
|
|
2792
3013
|
}
|
|
2793
3014
|
}
|
|
2794
|
-
if (
|
|
3015
|
+
if (t.skipTrial) return;
|
|
2795
3016
|
const n = e.settings.trial;
|
|
2796
3017
|
if (!n) return;
|
|
2797
3018
|
const i = this.ensureTrialStore(n);
|
|
@@ -2813,9 +3034,9 @@ let gr = class {
|
|
|
2813
3034
|
// вести trial-стейт «осталось N показов» под юзером, который вообще не
|
|
2814
3035
|
// должен увидеть пейвол по таргетингу — бессмысленно: при возврате в
|
|
2815
3036
|
// правильную страну он окажется со «слипшимся» триал-счётчиком.
|
|
2816
|
-
runOpenGates(e,
|
|
3037
|
+
runOpenGates(e, t, n) {
|
|
2817
3038
|
if (!n.skipVisibility) {
|
|
2818
|
-
const i =
|
|
3039
|
+
const i = t.settings.visibility;
|
|
2819
3040
|
if (i && (this.lastVisibility = i, !i.visible)) {
|
|
2820
3041
|
this.emit("visibility_blocked", i);
|
|
2821
3042
|
return;
|
|
@@ -2825,10 +3046,10 @@ let gr = class {
|
|
|
2825
3046
|
this.mountAndShow(e, { renew: n.renew });
|
|
2826
3047
|
return;
|
|
2827
3048
|
}
|
|
2828
|
-
this.gateThroughTrial(e,
|
|
3049
|
+
this.gateThroughTrial(e, t, n.renew);
|
|
2829
3050
|
}
|
|
2830
|
-
gateThroughTrial(e,
|
|
2831
|
-
const i =
|
|
3051
|
+
gateThroughTrial(e, t, n) {
|
|
3052
|
+
const i = t.settings.trial;
|
|
2832
3053
|
if (!i) {
|
|
2833
3054
|
this.mountAndShow(e, { renew: n });
|
|
2834
3055
|
return;
|
|
@@ -2850,38 +3071,42 @@ let gr = class {
|
|
|
2850
3071
|
});
|
|
2851
3072
|
}
|
|
2852
3073
|
ensureTrialStore(e) {
|
|
2853
|
-
if (this.trialStore && this.trialStoreConfig &&
|
|
3074
|
+
if (this.trialStore && this.trialStoreConfig && kr(this.trialStoreConfig, e))
|
|
2854
3075
|
return this.trialStore;
|
|
2855
3076
|
this.trialStoreConfig = e;
|
|
2856
|
-
const
|
|
2857
|
-
return this.trialStore = typeof
|
|
3077
|
+
const t = this.billing.createTrialStore;
|
|
3078
|
+
return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : qe(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
|
|
2858
3079
|
}
|
|
2859
|
-
mountAndShow(e,
|
|
2860
|
-
const n =
|
|
3080
|
+
mountAndShow(e, t = {}) {
|
|
3081
|
+
const n = t.renew === !0, i = t.authMode, a = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutPriceId ?? null : null, c = e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutUrl ?? null : null;
|
|
2861
3082
|
if (this.handle) {
|
|
2862
3083
|
this.isOpen = !0, this.handle.update({
|
|
2863
3084
|
open: !0,
|
|
2864
3085
|
initialView: e,
|
|
2865
3086
|
initialAuthMode: i,
|
|
3087
|
+
initialCheckoutPriceId: a,
|
|
3088
|
+
initialCheckoutUrl: c,
|
|
2866
3089
|
purchased: !1,
|
|
2867
3090
|
renew: n
|
|
2868
3091
|
}), this.emit("open");
|
|
2869
3092
|
return;
|
|
2870
3093
|
}
|
|
2871
|
-
this.isOpen = !0, this.handle =
|
|
2872
|
-
|
|
3094
|
+
this.isOpen = !0, this.handle = tt(
|
|
3095
|
+
ar,
|
|
2873
3096
|
{
|
|
2874
3097
|
client: this.billing,
|
|
2875
3098
|
open: !0,
|
|
2876
3099
|
initialView: e,
|
|
2877
3100
|
initialAuthMode: i,
|
|
3101
|
+
initialCheckoutPriceId: a,
|
|
3102
|
+
initialCheckoutUrl: c,
|
|
2878
3103
|
purchased: !1,
|
|
2879
3104
|
renew: n,
|
|
2880
3105
|
onClose: () => this.close(),
|
|
2881
|
-
onEvent: (
|
|
2882
|
-
this.emit(
|
|
3106
|
+
onEvent: (l, h) => {
|
|
3107
|
+
this.emit(l, h), l === "checkout_started" && this.startUserWatcher();
|
|
2883
3108
|
},
|
|
2884
|
-
onState: (
|
|
3109
|
+
onState: (l) => this.applyState(l),
|
|
2885
3110
|
inline: this.inline,
|
|
2886
3111
|
locale: this.forceLocale
|
|
2887
3112
|
},
|
|
@@ -2889,11 +3114,11 @@ let gr = class {
|
|
|
2889
3114
|
), this.emit("open");
|
|
2890
3115
|
}
|
|
2891
3116
|
applyState(e) {
|
|
2892
|
-
if (!
|
|
3117
|
+
if (!wr(this.currentState, e)) {
|
|
2893
3118
|
this.currentState = e;
|
|
2894
|
-
for (const
|
|
3119
|
+
for (const t of this.stateListeners)
|
|
2895
3120
|
try {
|
|
2896
|
-
|
|
3121
|
+
t(e);
|
|
2897
3122
|
} catch (n) {
|
|
2898
3123
|
console.warn("[paywall] onStateChange listener threw", n);
|
|
2899
3124
|
}
|
|
@@ -2920,9 +3145,9 @@ let gr = class {
|
|
|
2920
3145
|
*
|
|
2921
3146
|
* Возвращает unsubscribe.
|
|
2922
3147
|
*/
|
|
2923
|
-
onStateChange(e,
|
|
3148
|
+
onStateChange(e, t = {}) {
|
|
2924
3149
|
this.stateListeners.add(e);
|
|
2925
|
-
const n =
|
|
3150
|
+
const n = t.immediate ?? "microtask";
|
|
2926
3151
|
if (n !== "none") {
|
|
2927
3152
|
const i = this.currentState;
|
|
2928
3153
|
if (n === "sync")
|
|
@@ -2989,12 +3214,12 @@ let gr = class {
|
|
|
2989
3214
|
* либо обёртку поверх `setInterval(1000)` + повторный вызов этого метода.
|
|
2990
3215
|
*/
|
|
2991
3216
|
getOfferForPrice(e) {
|
|
2992
|
-
const
|
|
2993
|
-
if (!
|
|
2994
|
-
const n =
|
|
2995
|
-
return n ?
|
|
3217
|
+
const t = this.billing.getCachedOffers();
|
|
3218
|
+
if (!t) return null;
|
|
3219
|
+
const n = N(t, e);
|
|
3220
|
+
return n ? Ke(n, {
|
|
2996
3221
|
now: Date.now(),
|
|
2997
|
-
readStart:
|
|
3222
|
+
readStart: Qe
|
|
2998
3223
|
}) : null;
|
|
2999
3224
|
}
|
|
3000
3225
|
/** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
|
|
@@ -3025,10 +3250,10 @@ let gr = class {
|
|
|
3025
3250
|
* `getAccess()`, а не только после первого `open()`.
|
|
3026
3251
|
*/
|
|
3027
3252
|
async getAccess(e = {}) {
|
|
3028
|
-
let
|
|
3029
|
-
if (!
|
|
3253
|
+
let t = this.billing.getCachedBootstrap();
|
|
3254
|
+
if (!t)
|
|
3030
3255
|
try {
|
|
3031
|
-
|
|
3256
|
+
t = await this.billing.bootstrap({ signal: e.signal });
|
|
3032
3257
|
} catch {
|
|
3033
3258
|
const a = this.billing.getCachedUser();
|
|
3034
3259
|
return a?.has_active_subscription ? {
|
|
@@ -3045,24 +3270,24 @@ let gr = class {
|
|
|
3045
3270
|
user: a
|
|
3046
3271
|
};
|
|
3047
3272
|
}
|
|
3048
|
-
const n =
|
|
3273
|
+
const n = t.user ?? null;
|
|
3049
3274
|
if (n?.has_active_subscription)
|
|
3050
3275
|
return {
|
|
3051
3276
|
access: "granted",
|
|
3052
3277
|
reason: "has_subscription",
|
|
3053
|
-
visibility:
|
|
3278
|
+
visibility: t.settings.visibility ?? null,
|
|
3054
3279
|
trial: null,
|
|
3055
3280
|
user: n
|
|
3056
3281
|
};
|
|
3057
3282
|
let i = null;
|
|
3058
3283
|
if (!e.skipVisibility) {
|
|
3059
|
-
const a =
|
|
3284
|
+
const a = t.settings.visibility;
|
|
3060
3285
|
if (a && (i = a, this.lastVisibility = a, !a.visible))
|
|
3061
3286
|
return { access: "granted", reason: "visibility_blocked", visibility: i, trial: null, user: n };
|
|
3062
3287
|
}
|
|
3063
3288
|
let s = null;
|
|
3064
3289
|
if (!e.skipTrial) {
|
|
3065
|
-
const a =
|
|
3290
|
+
const a = t.settings.trial;
|
|
3066
3291
|
if (a)
|
|
3067
3292
|
try {
|
|
3068
3293
|
if (s = await this.ensureTrialStore(a).check(), this.lastTrialStatus = s, s.blocked)
|
|
@@ -3085,14 +3310,14 @@ let gr = class {
|
|
|
3085
3310
|
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
3086
3311
|
// bootstrap при следующем открытии.
|
|
3087
3312
|
startUserWatcher() {
|
|
3088
|
-
this.watcher ||
|
|
3313
|
+
this.watcher || mr() && (this.watcher = new gr({
|
|
3089
3314
|
client: this.billing,
|
|
3090
3315
|
onActive: (e) => {
|
|
3091
3316
|
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
3092
|
-
const
|
|
3093
|
-
if (
|
|
3317
|
+
const t = this.billing.getCachedBootstrap()?.settings.success_redirect_url;
|
|
3318
|
+
if (t && typeof window < "u")
|
|
3094
3319
|
try {
|
|
3095
|
-
window.location.assign(
|
|
3320
|
+
window.location.assign(t);
|
|
3096
3321
|
return;
|
|
3097
3322
|
} catch {
|
|
3098
3323
|
}
|
|
@@ -3104,7 +3329,7 @@ let gr = class {
|
|
|
3104
3329
|
}), this.watcher.start());
|
|
3105
3330
|
}
|
|
3106
3331
|
close() {
|
|
3107
|
-
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(
|
|
3332
|
+
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(se), this.emit("close"));
|
|
3108
3333
|
}
|
|
3109
3334
|
/**
|
|
3110
3335
|
* Сканирует текущий URL на маркеры возврата с checkout и эмитит
|
|
@@ -3114,80 +3339,80 @@ let gr = class {
|
|
|
3114
3339
|
*/
|
|
3115
3340
|
checkReturn() {
|
|
3116
3341
|
if (typeof window > "u") return;
|
|
3117
|
-
const e = new URL(window.location.href),
|
|
3342
|
+
const e = new URL(window.location.href), t = _e(e.hash.replace(/^#/, "")), n = _e(e.search.replace(/^\?/, "")), i = t ?? n;
|
|
3118
3343
|
i && (i.status === "paid" ? (this.emit("purchase_completed", {
|
|
3119
3344
|
priceId: i.priceId,
|
|
3120
3345
|
sessionId: i.sessionId
|
|
3121
|
-
}),
|
|
3346
|
+
}), vr(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), _r(e));
|
|
3122
3347
|
}
|
|
3123
3348
|
destroy() {
|
|
3124
|
-
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 =
|
|
3349
|
+
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;
|
|
3125
3350
|
}
|
|
3126
3351
|
};
|
|
3127
|
-
function
|
|
3128
|
-
if (!
|
|
3129
|
-
if (
|
|
3130
|
-
return { auth:
|
|
3131
|
-
const e =
|
|
3352
|
+
function br(r) {
|
|
3353
|
+
if (!r.auth) return { auth: void 0, ownsAuth: !1 };
|
|
3354
|
+
if (r.auth instanceof ue || xr(r.auth))
|
|
3355
|
+
return { auth: r.auth, ownsAuth: !1 };
|
|
3356
|
+
const e = r.auth === !0 ? {} : r.auth;
|
|
3132
3357
|
return {
|
|
3133
|
-
auth: new
|
|
3134
|
-
paywallId:
|
|
3135
|
-
apiOrigin: e.apiOrigin ??
|
|
3136
|
-
storage: e.storage ??
|
|
3137
|
-
fetch: e.fetch ??
|
|
3358
|
+
auth: new ue({
|
|
3359
|
+
paywallId: r.paywallId,
|
|
3360
|
+
apiOrigin: e.apiOrigin ?? r.apiOrigin,
|
|
3361
|
+
storage: e.storage ?? r.storage,
|
|
3362
|
+
fetch: e.fetch ?? r.fetch,
|
|
3138
3363
|
openPopup: e.openPopup
|
|
3139
3364
|
}),
|
|
3140
3365
|
ownsAuth: !0
|
|
3141
3366
|
};
|
|
3142
3367
|
}
|
|
3143
|
-
function
|
|
3144
|
-
if (typeof
|
|
3145
|
-
const e =
|
|
3368
|
+
function xr(r) {
|
|
3369
|
+
if (typeof r != "object" || r === null) return !1;
|
|
3370
|
+
const e = r;
|
|
3146
3371
|
return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
|
|
3147
3372
|
}
|
|
3148
|
-
function
|
|
3149
|
-
return
|
|
3373
|
+
function wr(r, e) {
|
|
3374
|
+
return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
|
|
3150
3375
|
}
|
|
3151
|
-
function
|
|
3152
|
-
return
|
|
3376
|
+
function kr(r, e) {
|
|
3377
|
+
return r.mode === e.mode && r.payload === e.payload && r.storage === e.storage;
|
|
3153
3378
|
}
|
|
3154
|
-
function
|
|
3155
|
-
if (!
|
|
3156
|
-
const e = new URLSearchParams(
|
|
3157
|
-
return
|
|
3158
|
-
status:
|
|
3379
|
+
function _e(r) {
|
|
3380
|
+
if (!r) return null;
|
|
3381
|
+
const e = new URLSearchParams(r), t = e.get(F.status);
|
|
3382
|
+
return t ? {
|
|
3383
|
+
status: t,
|
|
3159
3384
|
priceId: e.get(F.priceId),
|
|
3160
3385
|
sessionId: e.get(F.sessionId)
|
|
3161
3386
|
} : null;
|
|
3162
3387
|
}
|
|
3163
|
-
function
|
|
3388
|
+
function vr(r) {
|
|
3164
3389
|
if (!(typeof window > "u" || !window.opener))
|
|
3165
3390
|
try {
|
|
3166
3391
|
window.opener.postMessage(
|
|
3167
3392
|
{
|
|
3168
3393
|
type: "paywall_purchase",
|
|
3169
|
-
status:
|
|
3170
|
-
priceId:
|
|
3171
|
-
sessionId:
|
|
3394
|
+
status: r.status,
|
|
3395
|
+
priceId: r.priceId,
|
|
3396
|
+
sessionId: r.sessionId
|
|
3172
3397
|
},
|
|
3173
3398
|
"*"
|
|
3174
3399
|
);
|
|
3175
3400
|
} catch {
|
|
3176
3401
|
}
|
|
3177
3402
|
}
|
|
3178
|
-
function
|
|
3403
|
+
function _r(r) {
|
|
3179
3404
|
const e = (n, i) => {
|
|
3180
3405
|
if (!n) return "";
|
|
3181
3406
|
const s = new URLSearchParams(n.replace(/^[?#]/, ""));
|
|
3182
3407
|
s.delete(F.status), s.delete(F.priceId), s.delete(F.sessionId);
|
|
3183
3408
|
const a = s.toString();
|
|
3184
3409
|
return a ? i + a : "";
|
|
3185
|
-
},
|
|
3186
|
-
window.history.replaceState(null, "",
|
|
3410
|
+
}, t = r.pathname + e(r.search, "?") + e(r.hash, "#");
|
|
3411
|
+
window.history.replaceState(null, "", t);
|
|
3187
3412
|
}
|
|
3188
|
-
class
|
|
3189
|
-
constructor(e,
|
|
3190
|
-
this.transport = e, this.paywallId =
|
|
3413
|
+
class Sr {
|
|
3414
|
+
constructor(e, t, n) {
|
|
3415
|
+
this.transport = e, this.paywallId = t, this.config = n;
|
|
3191
3416
|
}
|
|
3192
3417
|
async check() {
|
|
3193
3418
|
return this.transport.request("trial.check", {
|
|
@@ -3208,9 +3433,9 @@ class vr {
|
|
|
3208
3433
|
});
|
|
3209
3434
|
}
|
|
3210
3435
|
}
|
|
3211
|
-
class
|
|
3212
|
-
constructor(e,
|
|
3213
|
-
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 =
|
|
3436
|
+
class Cr {
|
|
3437
|
+
constructor(e, t) {
|
|
3438
|
+
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 = {
|
|
3214
3439
|
getItem: (n) => this.transport.request("storage.get", { key: n }),
|
|
3215
3440
|
setItem: async (n, i) => {
|
|
3216
3441
|
await this.transport.request("storage.set", { key: n, value: i });
|
|
@@ -3229,12 +3454,12 @@ class _r {
|
|
|
3229
3454
|
}
|
|
3230
3455
|
// === Bootstrap ===
|
|
3231
3456
|
async bootstrap(e = {}) {
|
|
3232
|
-
const
|
|
3457
|
+
const t = await this.transport.request(
|
|
3233
3458
|
"billing.bootstrap",
|
|
3234
3459
|
{ force: e.force },
|
|
3235
3460
|
{ signal: e.signal }
|
|
3236
3461
|
);
|
|
3237
|
-
return this.applyBootstrap(
|
|
3462
|
+
return this.applyBootstrap(t), t.user && this.applyUser(t.user), t;
|
|
3238
3463
|
}
|
|
3239
3464
|
getCachedBootstrap() {
|
|
3240
3465
|
return this.cachedBootstrap;
|
|
@@ -3247,9 +3472,9 @@ class _r {
|
|
|
3247
3472
|
* обновляется → listener вызывается). Cross-surface revalidate (другая вкладка
|
|
3248
3473
|
* обновила bootstrap) не доезжает до popup'а — для этого нужен отдельный
|
|
3249
3474
|
* bootstrapChange-broadcast в protocol.ts/server.ts. */
|
|
3250
|
-
onBootstrapChange(e,
|
|
3475
|
+
onBootstrapChange(e, t = {}) {
|
|
3251
3476
|
this.bootstrapListeners.add(e);
|
|
3252
|
-
const n =
|
|
3477
|
+
const n = t.immediate ?? "microtask";
|
|
3253
3478
|
if (this.cachedBootstrap && n !== "none") {
|
|
3254
3479
|
const i = this.cachedBootstrap;
|
|
3255
3480
|
if (n === "sync")
|
|
@@ -3288,12 +3513,12 @@ class _r {
|
|
|
3288
3513
|
}
|
|
3289
3514
|
// === User ===
|
|
3290
3515
|
async getUser(e = {}) {
|
|
3291
|
-
const
|
|
3516
|
+
const t = await this.transport.request(
|
|
3292
3517
|
"billing.getUser",
|
|
3293
3518
|
{ force: e.force },
|
|
3294
3519
|
{ signal: e.signal }
|
|
3295
3520
|
);
|
|
3296
|
-
return this.applyUser(
|
|
3521
|
+
return this.applyUser(t), t;
|
|
3297
3522
|
}
|
|
3298
3523
|
getCachedUser() {
|
|
3299
3524
|
return this.cachedUser;
|
|
@@ -3301,9 +3526,9 @@ class _r {
|
|
|
3301
3526
|
/** Подписка на user-state. Mirror'имся на broadcast'ы offscreen'а; initial
|
|
3302
3527
|
* snapshot отдаётся через microtask из локального cache (если есть) —
|
|
3303
3528
|
* ровно как в BillingClient.onUserChange. Возвращает функцию отписки. */
|
|
3304
|
-
onUserChange(e,
|
|
3529
|
+
onUserChange(e, t = {}) {
|
|
3305
3530
|
this.userListeners.add(e);
|
|
3306
|
-
const n =
|
|
3531
|
+
const n = t.immediate ?? "microtask";
|
|
3307
3532
|
if (this.cachedUser && n !== "none") {
|
|
3308
3533
|
const i = this.cachedUser;
|
|
3309
3534
|
if (n === "sync")
|
|
@@ -3333,9 +3558,9 @@ class _r {
|
|
|
3333
3558
|
getCachedBalances() {
|
|
3334
3559
|
return this.cachedBalances;
|
|
3335
3560
|
}
|
|
3336
|
-
onBalanceChange(e,
|
|
3561
|
+
onBalanceChange(e, t = {}) {
|
|
3337
3562
|
this.balanceListeners.add(e);
|
|
3338
|
-
const n =
|
|
3563
|
+
const n = t.immediate ?? "microtask";
|
|
3339
3564
|
if (this.cachedBalances && n !== "none") {
|
|
3340
3565
|
const i = this.cachedBalances;
|
|
3341
3566
|
if (n === "sync")
|
|
@@ -3355,8 +3580,8 @@ class _r {
|
|
|
3355
3580
|
}
|
|
3356
3581
|
// === Checkout ===
|
|
3357
3582
|
async createCheckout(e) {
|
|
3358
|
-
const { signal:
|
|
3359
|
-
return this.transport.request("billing.createCheckout", n, { signal:
|
|
3583
|
+
const { signal: t, ...n } = e;
|
|
3584
|
+
return this.transport.request("billing.createCheckout", n, { signal: t });
|
|
3360
3585
|
}
|
|
3361
3586
|
// === Customer portal: list/cancel purchases ===
|
|
3362
3587
|
/** Rich-shape список покупок юзера (с ценой, валютой, interval, discount,
|
|
@@ -3379,8 +3604,8 @@ class _r {
|
|
|
3379
3604
|
* периода (юзер сохраняет access до renewal date'ы). reason обязательна
|
|
3380
3605
|
* (валидируется бэком) — собирается через select причин в host-UI. */
|
|
3381
3606
|
async cancelSubscription(e) {
|
|
3382
|
-
const { signal:
|
|
3383
|
-
return this.transport.request("billing.cancelSubscription", n, { signal:
|
|
3607
|
+
const { signal: t, ...n } = e;
|
|
3608
|
+
return this.transport.request("billing.cancelSubscription", n, { signal: t });
|
|
3384
3609
|
}
|
|
3385
3610
|
// === Storage ===
|
|
3386
3611
|
/** PaywallUI просит storage у billing-клиента для TrialStore и других
|
|
@@ -3395,7 +3620,7 @@ class _r {
|
|
|
3395
3620
|
* read-modify-write. PaywallUI duck-types этот метод и предпочитает его
|
|
3396
3621
|
* локальной фабрике, если он есть. */
|
|
3397
3622
|
createTrialStore(e) {
|
|
3398
|
-
return new
|
|
3623
|
+
return new Sr(this.transport, this.paywallId, e);
|
|
3399
3624
|
}
|
|
3400
3625
|
// === Identity ===
|
|
3401
3626
|
getIdentity() {
|
|
@@ -3416,9 +3641,9 @@ class _r {
|
|
|
3416
3641
|
}
|
|
3417
3642
|
applyBootstrap(e) {
|
|
3418
3643
|
this.cachedBootstrap = e;
|
|
3419
|
-
for (const
|
|
3644
|
+
for (const t of [...this.bootstrapListeners])
|
|
3420
3645
|
try {
|
|
3421
|
-
|
|
3646
|
+
t(e);
|
|
3422
3647
|
} catch (n) {
|
|
3423
3648
|
console.warn("[paywall] onBootstrapChange listener threw", n);
|
|
3424
3649
|
}
|
|
@@ -3428,41 +3653,41 @@ class _r {
|
|
|
3428
3653
|
* broadcast'ов от offscreen — чтобы host'овский onUserChange handler
|
|
3429
3654
|
* получил signal независимо от того, кто триггернул обновление. */
|
|
3430
3655
|
applyUser(e) {
|
|
3431
|
-
|
|
3656
|
+
Ir(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
|
|
3432
3657
|
}
|
|
3433
3658
|
applyBalances(e) {
|
|
3434
|
-
|
|
3659
|
+
Ar(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
|
|
3435
3660
|
}
|
|
3436
3661
|
fireUserListeners(e) {
|
|
3437
|
-
for (const
|
|
3662
|
+
for (const t of [...this.userListeners])
|
|
3438
3663
|
try {
|
|
3439
|
-
|
|
3664
|
+
t(e);
|
|
3440
3665
|
} catch (n) {
|
|
3441
3666
|
console.warn("[paywall] onUserChange listener threw", n);
|
|
3442
3667
|
}
|
|
3443
3668
|
}
|
|
3444
3669
|
fireBalanceListeners(e) {
|
|
3445
|
-
for (const
|
|
3670
|
+
for (const t of [...this.balanceListeners])
|
|
3446
3671
|
try {
|
|
3447
|
-
|
|
3672
|
+
t(e);
|
|
3448
3673
|
} catch (n) {
|
|
3449
3674
|
console.warn("[paywall] onBalanceChange listener threw", n);
|
|
3450
3675
|
}
|
|
3451
3676
|
}
|
|
3452
3677
|
}
|
|
3453
|
-
function
|
|
3454
|
-
return
|
|
3678
|
+
function Ir(r, e) {
|
|
3679
|
+
return r === e ? !0 : !r || !e ? !1 : r.has_active_subscription === e.has_active_subscription && (r.purchases?.length ?? 0) === (e.purchases?.length ?? 0);
|
|
3455
3680
|
}
|
|
3456
|
-
function
|
|
3457
|
-
if (
|
|
3458
|
-
if (!
|
|
3459
|
-
for (let
|
|
3460
|
-
if (t
|
|
3681
|
+
function Ar(r, e) {
|
|
3682
|
+
if (r === e) return !0;
|
|
3683
|
+
if (!r || !e || r.length !== e.length) return !1;
|
|
3684
|
+
for (let t = 0; t < r.length; t++)
|
|
3685
|
+
if (r[t].type !== e[t].type || r[t].count !== e[t].count) return !1;
|
|
3461
3686
|
return !0;
|
|
3462
3687
|
}
|
|
3463
|
-
class
|
|
3464
|
-
constructor(e,
|
|
3465
|
-
this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId =
|
|
3688
|
+
class Lr {
|
|
3689
|
+
constructor(e, t) {
|
|
3690
|
+
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 }) => {
|
|
3466
3691
|
this.applySession(n, i);
|
|
3467
3692
|
}), this.hydrated = this.transport.request("auth.getCachedSession", void 0).then((n) => {
|
|
3468
3693
|
this.session === null && n !== null && (this.session = n);
|
|
@@ -3485,8 +3710,8 @@ class Ir {
|
|
|
3485
3710
|
if (this.listeners.has(e))
|
|
3486
3711
|
try {
|
|
3487
3712
|
e("INITIAL_SESSION", this.session);
|
|
3488
|
-
} catch (
|
|
3489
|
-
console.warn("[paywall] onAuthChange INITIAL_SESSION threw",
|
|
3713
|
+
} catch (t) {
|
|
3714
|
+
console.warn("[paywall] onAuthChange INITIAL_SESSION threw", t);
|
|
3490
3715
|
}
|
|
3491
3716
|
}), () => {
|
|
3492
3717
|
this.listeners.delete(e);
|
|
@@ -3494,12 +3719,12 @@ class Ir {
|
|
|
3494
3719
|
}
|
|
3495
3720
|
// === Email/password ===
|
|
3496
3721
|
async signInWithEmail(e) {
|
|
3497
|
-
const
|
|
3498
|
-
return this.applySession("SIGNED_IN",
|
|
3722
|
+
const t = await this.transport.request("auth.signInWithEmail", e);
|
|
3723
|
+
return this.applySession("SIGNED_IN", t), t;
|
|
3499
3724
|
}
|
|
3500
3725
|
async signUp(e) {
|
|
3501
|
-
const
|
|
3502
|
-
return
|
|
3726
|
+
const t = await this.transport.request("auth.signUp", e);
|
|
3727
|
+
return t.kind === "signed_in" && this.applySession("SIGNED_IN", t.session), t;
|
|
3503
3728
|
}
|
|
3504
3729
|
async signOut() {
|
|
3505
3730
|
await this.transport.request("auth.signOut", void 0);
|
|
@@ -3513,8 +3738,8 @@ class Ir {
|
|
|
3513
3738
|
await this.transport.request("auth.sendOtp", e);
|
|
3514
3739
|
}
|
|
3515
3740
|
async verifyOtp(e) {
|
|
3516
|
-
const
|
|
3517
|
-
return this.applySession(e.type === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN",
|
|
3741
|
+
const t = await this.transport.request("auth.verifyOtp", e);
|
|
3742
|
+
return this.applySession(e.type === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", t), t;
|
|
3518
3743
|
}
|
|
3519
3744
|
async resendConfirmation(e) {
|
|
3520
3745
|
await this.transport.request("auth.resendConfirmation", e);
|
|
@@ -3540,12 +3765,12 @@ class Ir {
|
|
|
3540
3765
|
* offscreen-AuthClient'е — content только проксирует. captchaToken и
|
|
3541
3766
|
* forceNewAnon — pass-through для forward-compat / switch-account flow. */
|
|
3542
3767
|
async signInAnonymously(e = {}) {
|
|
3543
|
-
const
|
|
3768
|
+
const t = await this.transport.request("auth.signInAnonymously", {
|
|
3544
3769
|
captchaToken: e.captchaToken,
|
|
3545
3770
|
userMeta: e.userMeta,
|
|
3546
3771
|
forceNewAnon: e.forceNewAnon
|
|
3547
3772
|
});
|
|
3548
|
-
return this.applySession("SIGNED_IN",
|
|
3773
|
+
return this.applySession("SIGNED_IN", t), t;
|
|
3549
3774
|
}
|
|
3550
3775
|
/** Текущий access token (lazy-refreshable в offscreen'е). content/popup
|
|
3551
3776
|
* использует для Bearer'а в внешние fetch'и — ApiGatewayClient в
|
|
@@ -3571,14 +3796,14 @@ class Ir {
|
|
|
3571
3796
|
*/
|
|
3572
3797
|
async signInWithOAuth(e) {
|
|
3573
3798
|
if (typeof window > "u")
|
|
3574
|
-
throw new
|
|
3575
|
-
const
|
|
3799
|
+
throw new L("oauth_unavailable", "window is required for OAuth");
|
|
3800
|
+
const t = `pw-oauth-pending-${Math.random().toString(36).slice(2, 10)}`, n = window.open("about:blank", t, "width=480,height=640,popup=yes");
|
|
3576
3801
|
if (!n)
|
|
3577
|
-
throw new
|
|
3802
|
+
throw new L(
|
|
3578
3803
|
"popup_blocked",
|
|
3579
3804
|
"browser blocked auth popup — call from a user gesture"
|
|
3580
3805
|
);
|
|
3581
|
-
|
|
3806
|
+
Tr(n, e.provider);
|
|
3582
3807
|
try {
|
|
3583
3808
|
const { authorizeUrl: i, state: s } = await this.transport.request("auth.oauthStart", {
|
|
3584
3809
|
provider: e.provider,
|
|
@@ -3586,7 +3811,7 @@ class Ir {
|
|
|
3586
3811
|
userMeta: e.userMeta
|
|
3587
3812
|
});
|
|
3588
3813
|
n.name = `pw-oauth-${s}`, n.location.replace(i), e.onPopupOpened?.();
|
|
3589
|
-
const a = await
|
|
3814
|
+
const a = await Ne(n, s), c = await this.transport.request("auth.oauthExchange", { state: s, code: a });
|
|
3590
3815
|
return this.applySession("SIGNED_IN", c), c;
|
|
3591
3816
|
} catch (i) {
|
|
3592
3817
|
try {
|
|
@@ -3599,32 +3824,32 @@ class Ir {
|
|
|
3599
3824
|
destroy() {
|
|
3600
3825
|
this.unsubBroadcast?.(), this.unsubBroadcast = null, this.listeners.clear(), this.session = null;
|
|
3601
3826
|
}
|
|
3602
|
-
applySession(e,
|
|
3603
|
-
if (!
|
|
3604
|
-
this.session =
|
|
3827
|
+
applySession(e, t) {
|
|
3828
|
+
if (!Mr(this.session, t)) {
|
|
3829
|
+
this.session = t;
|
|
3605
3830
|
for (const n of [...this.listeners])
|
|
3606
3831
|
try {
|
|
3607
|
-
n(e,
|
|
3832
|
+
n(e, t);
|
|
3608
3833
|
} catch (i) {
|
|
3609
3834
|
console.warn("[paywall] onAuthChange listener threw", i);
|
|
3610
3835
|
}
|
|
3611
3836
|
}
|
|
3612
3837
|
}
|
|
3613
3838
|
}
|
|
3614
|
-
function
|
|
3615
|
-
return
|
|
3839
|
+
function Mr(r, e) {
|
|
3840
|
+
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;
|
|
3616
3841
|
}
|
|
3617
|
-
const
|
|
3842
|
+
const Er = {
|
|
3618
3843
|
google: "Google",
|
|
3619
3844
|
apple: "Apple",
|
|
3620
3845
|
github: "GitHub",
|
|
3621
3846
|
facebook: "Facebook"
|
|
3622
3847
|
};
|
|
3623
|
-
function
|
|
3624
|
-
const
|
|
3848
|
+
function Tr(r, e) {
|
|
3849
|
+
const t = Er[e] ?? e;
|
|
3625
3850
|
try {
|
|
3626
|
-
const n =
|
|
3627
|
-
n.title = `Sign in with ${
|
|
3851
|
+
const n = r.document;
|
|
3852
|
+
n.title = `Sign in with ${t}`;
|
|
3628
3853
|
const i = n.createElement("style");
|
|
3629
3854
|
i.textContent = "html,body{margin:0;padding:0;height:100%;font-family:-apple-system,system-ui,sans-serif;background:#fafafa;color:#475569}.pw-oauth-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px}.pw-oauth-spinner{width:36px;height:36px;border:3px solid #e2e8f0;border-top-color:#7c3aed;border-radius:50%;animation:pw-oauth-spin 800ms linear infinite}.pw-oauth-label{font-size:14px;font-weight:500;letter-spacing:-0.01em}@keyframes pw-oauth-spin{to{transform:rotate(360deg)}}", n.head.appendChild(i);
|
|
3630
3855
|
const s = n.createElement("div");
|
|
@@ -3632,18 +3857,18 @@ function Mr(t, e) {
|
|
|
3632
3857
|
const a = n.createElement("div");
|
|
3633
3858
|
a.className = "pw-oauth-spinner";
|
|
3634
3859
|
const c = n.createElement("div");
|
|
3635
|
-
c.className = "pw-oauth-label", c.textContent = `Connecting to ${
|
|
3860
|
+
c.className = "pw-oauth-label", c.textContent = `Connecting to ${t}…`, s.appendChild(a), s.appendChild(c), n.body.appendChild(s);
|
|
3636
3861
|
} catch {
|
|
3637
3862
|
}
|
|
3638
3863
|
}
|
|
3639
|
-
class
|
|
3864
|
+
class Br {
|
|
3640
3865
|
constructor(e) {
|
|
3641
3866
|
this.transport = e;
|
|
3642
3867
|
}
|
|
3643
3868
|
/** Отправить событие. Fire-and-forget — не возвращает Promise, не throw'ает.
|
|
3644
3869
|
* Сетевые/транспортные ошибки логируются в console и не блокируют caller. */
|
|
3645
|
-
track(e,
|
|
3646
|
-
typeof e != "string" || e.length === 0 || this.transport.request("tracker.track", { name: e, props:
|
|
3870
|
+
track(e, t) {
|
|
3871
|
+
typeof e != "string" || e.length === 0 || this.transport.request("tracker.track", { name: e, props: t }).catch((n) => {
|
|
3647
3872
|
console.warn("[paywall] track failed", n);
|
|
3648
3873
|
});
|
|
3649
3874
|
}
|
|
@@ -3660,29 +3885,29 @@ class Pr {
|
|
|
3660
3885
|
if (this.channel) return this.channel;
|
|
3661
3886
|
const e = this.factory();
|
|
3662
3887
|
this.channel = e;
|
|
3663
|
-
const
|
|
3664
|
-
return this.channelDisposers = [
|
|
3665
|
-
protocolVersion:
|
|
3888
|
+
const t = e.onMessage((i) => this.handleMessage(i)), n = e.onDisconnect(() => this.handleDisconnect());
|
|
3889
|
+
return this.channelDisposers = [t, n], this.request("handshake", {
|
|
3890
|
+
protocolVersion: J,
|
|
3666
3891
|
clientId: this.clientId
|
|
3667
3892
|
}).then((i) => {
|
|
3668
|
-
i.protocolVersion !==
|
|
3669
|
-
`[sdk-extension] protocol version mismatch: client=${
|
|
3893
|
+
i.protocolVersion !== J && console.warn(
|
|
3894
|
+
`[sdk-extension] protocol version mismatch: client=${J}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
|
|
3670
3895
|
);
|
|
3671
3896
|
}).catch(() => {
|
|
3672
3897
|
}), e;
|
|
3673
3898
|
}
|
|
3674
3899
|
handleMessage(e) {
|
|
3675
|
-
if (
|
|
3900
|
+
if (Ur(e)) {
|
|
3676
3901
|
if (e.type === "response") {
|
|
3677
|
-
const
|
|
3678
|
-
if (!
|
|
3679
|
-
this.pending.delete(e.id),
|
|
3902
|
+
const t = this.pending.get(e.id);
|
|
3903
|
+
if (!t) return;
|
|
3904
|
+
this.pending.delete(e.id), t.signal?.removeEventListener("abort", t.abortListener), e.ok ? t.resolve(e.result) : t.reject(Fe(e.error));
|
|
3680
3905
|
return;
|
|
3681
3906
|
}
|
|
3682
3907
|
if (e.type === "event") {
|
|
3683
|
-
const
|
|
3684
|
-
if (!
|
|
3685
|
-
for (const n of [...
|
|
3908
|
+
const t = this.listeners.get(e.kind);
|
|
3909
|
+
if (!t) return;
|
|
3910
|
+
for (const n of [...t])
|
|
3686
3911
|
try {
|
|
3687
3912
|
n(e.payload);
|
|
3688
3913
|
} catch (i) {
|
|
@@ -3692,14 +3917,14 @@ class Pr {
|
|
|
3692
3917
|
}
|
|
3693
3918
|
}
|
|
3694
3919
|
handleDisconnect() {
|
|
3695
|
-
for (const
|
|
3920
|
+
for (const t of this.channelDisposers) t();
|
|
3696
3921
|
this.channelDisposers = [], this.channel = null;
|
|
3697
3922
|
const e = Array.from(this.pending.values());
|
|
3698
3923
|
this.pending.clear();
|
|
3699
|
-
for (const
|
|
3700
|
-
|
|
3924
|
+
for (const t of e)
|
|
3925
|
+
t.signal?.removeEventListener("abort", t.abortListener), t.reject(new Or());
|
|
3701
3926
|
}
|
|
3702
|
-
request(e,
|
|
3927
|
+
request(e, t, n = {}) {
|
|
3703
3928
|
if (this.destroyed)
|
|
3704
3929
|
return Promise.reject(new Error("TransportClient destroyed"));
|
|
3705
3930
|
if (n.signal?.aborted)
|
|
@@ -3720,23 +3945,23 @@ class Pr {
|
|
|
3720
3945
|
}
|
|
3721
3946
|
}
|
|
3722
3947
|
}, n.signal.addEventListener("abort", l.abortListener)), this.pending.set(s, l);
|
|
3723
|
-
const
|
|
3948
|
+
const h = {
|
|
3724
3949
|
type: "request",
|
|
3725
3950
|
id: s,
|
|
3726
3951
|
kind: e,
|
|
3727
|
-
params:
|
|
3952
|
+
params: t
|
|
3728
3953
|
};
|
|
3729
3954
|
try {
|
|
3730
|
-
i.send(
|
|
3731
|
-
} catch (
|
|
3732
|
-
this.pending.delete(s), n.signal?.removeEventListener("abort", l.abortListener), c(
|
|
3955
|
+
i.send(h);
|
|
3956
|
+
} catch (d) {
|
|
3957
|
+
this.pending.delete(s), n.signal?.removeEventListener("abort", l.abortListener), c(d);
|
|
3733
3958
|
}
|
|
3734
3959
|
});
|
|
3735
3960
|
}
|
|
3736
|
-
on(e,
|
|
3961
|
+
on(e, t) {
|
|
3737
3962
|
let n = this.listeners.get(e);
|
|
3738
3963
|
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n));
|
|
3739
|
-
const i =
|
|
3964
|
+
const i = t;
|
|
3740
3965
|
return n.add(i), this.ensureChannel(), () => {
|
|
3741
3966
|
n.delete(i);
|
|
3742
3967
|
};
|
|
@@ -3744,37 +3969,37 @@ class Pr {
|
|
|
3744
3969
|
destroy() {
|
|
3745
3970
|
if (this.destroyed) return;
|
|
3746
3971
|
this.destroyed = !0;
|
|
3747
|
-
for (const
|
|
3972
|
+
for (const t of this.channelDisposers) t();
|
|
3748
3973
|
this.channelDisposers = [], this.listeners.clear();
|
|
3749
3974
|
const e = Array.from(this.pending.values());
|
|
3750
3975
|
this.pending.clear();
|
|
3751
|
-
for (const
|
|
3752
|
-
|
|
3976
|
+
for (const t of e)
|
|
3977
|
+
t.signal?.removeEventListener("abort", t.abortListener), t.reject(new Error("TransportClient destroyed"));
|
|
3753
3978
|
this.channel?.close(), this.channel = null;
|
|
3754
3979
|
}
|
|
3755
3980
|
}
|
|
3756
|
-
class
|
|
3981
|
+
class Or extends Error {
|
|
3757
3982
|
constructor() {
|
|
3758
3983
|
super("Transport channel disconnected mid-request"), this.code = "transport_disconnected", this.name = "TransportDisconnectedError";
|
|
3759
3984
|
}
|
|
3760
3985
|
}
|
|
3761
|
-
function
|
|
3762
|
-
if (typeof
|
|
3763
|
-
const e =
|
|
3986
|
+
function Ur(r) {
|
|
3987
|
+
if (typeof r != "object" || r === null) return !1;
|
|
3988
|
+
const e = r.type;
|
|
3764
3989
|
return e === "request" || e === "response" || e === "event";
|
|
3765
3990
|
}
|
|
3766
3991
|
let W = null;
|
|
3767
|
-
function
|
|
3768
|
-
return W || (W = new Pr(() =>
|
|
3992
|
+
function jr() {
|
|
3993
|
+
return W || (W = new Pr(() => $e(Ze)), W);
|
|
3769
3994
|
}
|
|
3770
|
-
class
|
|
3995
|
+
class Vr extends yr {
|
|
3771
3996
|
constructor(e) {
|
|
3772
|
-
const
|
|
3997
|
+
const t = jr(), n = new Cr(t, {
|
|
3773
3998
|
paywallId: e.paywallId,
|
|
3774
3999
|
apiOrigin: e.apiOrigin
|
|
3775
4000
|
});
|
|
3776
4001
|
let i;
|
|
3777
|
-
e.auth === !0 ? i = new
|
|
4002
|
+
e.auth === !0 ? i = new Lr(t, {
|
|
3778
4003
|
paywallId: e.paywallId,
|
|
3779
4004
|
apiOrigin: e.apiOrigin
|
|
3780
4005
|
}) : e.auth && console.warn(
|
|
@@ -3790,7 +4015,7 @@ class qr extends gr {
|
|
|
3790
4015
|
// Внутренний EventTracker отключаем — единственный tracker живёт в
|
|
3791
4016
|
// offscreen'е. Манчиально подписываемся ниже.
|
|
3792
4017
|
analytics: !1
|
|
3793
|
-
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new
|
|
4018
|
+
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new Br(t), this.bindAnalytics());
|
|
3794
4019
|
}
|
|
3795
4020
|
/** Зеркало sdk/PaywallUI.initTracker'овских биндингов, но с RemoteEventTracker.
|
|
3796
4021
|
* Когда @monetize.software/sdk экспоузнет публичный hook для inject'а tracker'а,
|
|
@@ -3801,46 +4026,46 @@ class qr extends gr {
|
|
|
3801
4026
|
this.on("open", () => e.track("paywall_opened")),
|
|
3802
4027
|
this.on(
|
|
3803
4028
|
"ready",
|
|
3804
|
-
(
|
|
3805
|
-
is_test_mode:
|
|
3806
|
-
prices_count:
|
|
3807
|
-
offers_count:
|
|
4029
|
+
(t) => e.track("paywall_viewed", {
|
|
4030
|
+
is_test_mode: t.settings.is_test_mode,
|
|
4031
|
+
prices_count: t.prices.length,
|
|
4032
|
+
offers_count: t.offers.length
|
|
3808
4033
|
})
|
|
3809
4034
|
),
|
|
3810
4035
|
this.on(
|
|
3811
4036
|
"price_selected",
|
|
3812
|
-
(
|
|
4037
|
+
(t) => e.track("price_selected", { price_id: t.priceId })
|
|
3813
4038
|
),
|
|
3814
4039
|
this.on(
|
|
3815
4040
|
"checkout_started",
|
|
3816
|
-
(
|
|
4041
|
+
(t) => e.track("checkout_started", { price_id: t.priceId, acquiring: t.acquiring })
|
|
3817
4042
|
),
|
|
3818
4043
|
this.on(
|
|
3819
4044
|
"purchase_completed",
|
|
3820
|
-
(
|
|
4045
|
+
(t) => e.track("purchase_completed", { price_id: t.priceId, session_id: t.sessionId })
|
|
3821
4046
|
),
|
|
3822
|
-
this.on("purchase_failed", (
|
|
4047
|
+
this.on("purchase_failed", (t) => e.track("purchase_failed", { reason: t.reason })),
|
|
3823
4048
|
this.on("close", () => e.track("paywall_closed")),
|
|
3824
4049
|
this.on(
|
|
3825
4050
|
"trial_blocked",
|
|
3826
|
-
(
|
|
3827
|
-
mode:
|
|
3828
|
-
...
|
|
4051
|
+
(t) => e.track("trial_blocked", {
|
|
4052
|
+
mode: t.mode,
|
|
4053
|
+
...t.mode === "time" ? { remaining_ms: t.remainingMs, total_ms: t.totalMs } : t.mode === "opens" ? { remaining_actions: t.remainingActions, total_actions: t.totalActions } : {}
|
|
3829
4054
|
})
|
|
3830
4055
|
),
|
|
3831
4056
|
this.on("trial_expired", () => e.track("trial_expired")),
|
|
3832
4057
|
this.on(
|
|
3833
4058
|
"visibility_blocked",
|
|
3834
|
-
(
|
|
4059
|
+
(t) => e.track("visibility_blocked", { reason: t.reason, country: t.country, tier: t.tier })
|
|
3835
4060
|
),
|
|
3836
|
-
this.on("error", (
|
|
4061
|
+
this.on("error", (t) => e.track("error", { code: t.code, message: t.message }))
|
|
3837
4062
|
);
|
|
3838
4063
|
}
|
|
3839
4064
|
/** Прокси через RemoteEventTracker. Hosts могут вызывать paywall.track
|
|
3840
4065
|
* для произвольных аналитических событий — летит в единственный
|
|
3841
4066
|
* offscreen-tracker наряду с auto-emit'ами PaywallUI. */
|
|
3842
|
-
track(e,
|
|
3843
|
-
this.remoteTracker?.track(e,
|
|
4067
|
+
track(e, t) {
|
|
4068
|
+
this.remoteTracker?.track(e, t);
|
|
3844
4069
|
}
|
|
3845
4070
|
destroy() {
|
|
3846
4071
|
for (const e of this.trackerUnsubs) e();
|
|
@@ -3848,11 +4073,11 @@ class qr extends gr {
|
|
|
3848
4073
|
}
|
|
3849
4074
|
}
|
|
3850
4075
|
export {
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
4076
|
+
J as PROTOCOL_VERSION,
|
|
4077
|
+
Vr as PaywallUI,
|
|
4078
|
+
Lr as RemoteAuthClient,
|
|
4079
|
+
Cr as RemoteBillingClient,
|
|
4080
|
+
Br as RemoteEventTracker,
|
|
4081
|
+
jr as getContentTransport
|
|
3857
4082
|
};
|
|
3858
4083
|
//# sourceMappingURL=content.js.map
|