@monetize.software/sdk-extension 3.0.0-alpha.1 → 3.0.0-alpha.11
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/LICENSE +21 -0
- package/README.md +21 -20
- package/dist/chunks/ar-7cgIM-Vl.js +2 -0
- package/dist/chunks/ar-7cgIM-Vl.js.map +1 -0
- package/dist/chunks/ar-B2Wg_IrC.js +126 -0
- package/dist/chunks/ar-B2Wg_IrC.js.map +1 -0
- package/dist/chunks/chrome-port-BXK5myXz.js +2 -0
- package/dist/chunks/chrome-port-BXK5myXz.js.map +1 -0
- package/dist/chunks/{chrome-port-BXHR4SOG.js → chrome-port-KYVwww_u.js} +376 -216
- package/dist/chunks/chrome-port-KYVwww_u.js.map +1 -0
- package/dist/chunks/cs-BNo9Dx0Q.js +122 -0
- package/dist/chunks/cs-BNo9Dx0Q.js.map +1 -0
- package/dist/chunks/cs-S05PC5AC.js +2 -0
- package/dist/chunks/cs-S05PC5AC.js.map +1 -0
- package/dist/chunks/da-Bi4zBG14.js +2 -0
- package/dist/chunks/da-Bi4zBG14.js.map +1 -0
- package/dist/chunks/da-Do9Lq6En.js +122 -0
- package/dist/chunks/da-Do9Lq6En.js.map +1 -0
- package/dist/chunks/de-C8pDZNvx.js +141 -0
- package/dist/chunks/de-C8pDZNvx.js.map +1 -0
- package/dist/chunks/de-nCDB6D2W.js +2 -0
- package/dist/chunks/de-nCDB6D2W.js.map +1 -0
- package/dist/chunks/el-BrKaa978.js +2 -0
- package/dist/chunks/el-BrKaa978.js.map +1 -0
- package/dist/chunks/el-DzMNX-_P.js +126 -0
- package/dist/chunks/el-DzMNX-_P.js.map +1 -0
- package/dist/chunks/es-B-Wtyzrl.js +2 -0
- package/dist/chunks/es-B-Wtyzrl.js.map +1 -0
- package/dist/chunks/es-YrKt-q4w.js +141 -0
- package/dist/chunks/es-YrKt-q4w.js.map +1 -0
- package/dist/chunks/fi-Bh44pwZ4.js +122 -0
- package/dist/chunks/fi-Bh44pwZ4.js.map +1 -0
- package/dist/chunks/fi-D1SGXjnO.js +2 -0
- package/dist/chunks/fi-D1SGXjnO.js.map +1 -0
- package/dist/chunks/fr-Bc0pw4ws.js +141 -0
- package/dist/chunks/fr-Bc0pw4ws.js.map +1 -0
- package/dist/chunks/fr-BhYf-iKk.js +2 -0
- package/dist/chunks/fr-BhYf-iKk.js.map +1 -0
- package/dist/chunks/he-BXAaFv6Y.js +2 -0
- package/dist/chunks/he-BXAaFv6Y.js.map +1 -0
- package/dist/chunks/he-Bfm-bhe3.js +126 -0
- package/dist/chunks/he-Bfm-bhe3.js.map +1 -0
- package/dist/chunks/hi-D-O-B9Dn.js +126 -0
- package/dist/chunks/hi-D-O-B9Dn.js.map +1 -0
- package/dist/chunks/hi-xblDO0O7.js +2 -0
- package/dist/chunks/hi-xblDO0O7.js.map +1 -0
- package/dist/chunks/hu-CmIuAbLL.js +122 -0
- package/dist/chunks/hu-CmIuAbLL.js.map +1 -0
- package/dist/chunks/hu-Wa46p0y4.js +2 -0
- package/dist/chunks/hu-Wa46p0y4.js.map +1 -0
- package/dist/chunks/id-CQEo5X94.js +2 -0
- package/dist/chunks/id-CQEo5X94.js.map +1 -0
- package/dist/chunks/id-DN7IES-A.js +122 -0
- package/dist/chunks/id-DN7IES-A.js.map +1 -0
- package/dist/chunks/it-8AYCm0xz.js +2 -0
- package/dist/chunks/it-8AYCm0xz.js.map +1 -0
- package/dist/chunks/it-Cz5Nmqx5.js +141 -0
- package/dist/chunks/it-Cz5Nmqx5.js.map +1 -0
- package/dist/chunks/ja-BH9BlBh2.js +145 -0
- package/dist/chunks/ja-BH9BlBh2.js.map +1 -0
- package/dist/chunks/ja-q-COVayn.js +2 -0
- package/dist/chunks/ja-q-COVayn.js.map +1 -0
- package/dist/chunks/ko-B6HRCscZ.js +2 -0
- package/dist/chunks/ko-B6HRCscZ.js.map +1 -0
- package/dist/chunks/ko-CYV9QuYs.js +145 -0
- package/dist/chunks/ko-CYV9QuYs.js.map +1 -0
- package/dist/chunks/nl-BvkB900D.js +141 -0
- package/dist/chunks/nl-BvkB900D.js.map +1 -0
- package/dist/chunks/nl-CAd6_xlm.js +2 -0
- package/dist/chunks/nl-CAd6_xlm.js.map +1 -0
- package/dist/chunks/no-3s9_ormb.js +122 -0
- package/dist/chunks/no-3s9_ormb.js.map +1 -0
- package/dist/chunks/no-CAmz6bz6.js +2 -0
- package/dist/chunks/no-CAmz6bz6.js.map +1 -0
- package/dist/chunks/pl-C9WTGQtb.js +122 -0
- package/dist/chunks/pl-C9WTGQtb.js.map +1 -0
- package/dist/chunks/pl-DqUSTCaF.js +2 -0
- package/dist/chunks/pl-DqUSTCaF.js.map +1 -0
- package/dist/chunks/port-name-CF4WQQ3-.js +2 -0
- package/dist/chunks/port-name-CF4WQQ3-.js.map +1 -0
- package/dist/chunks/port-name-ervLBWAQ.js +6 -0
- package/dist/chunks/port-name-ervLBWAQ.js.map +1 -0
- package/dist/chunks/pt-8ARZnH0_.js +2 -0
- package/dist/chunks/pt-8ARZnH0_.js.map +1 -0
- package/dist/chunks/pt-uFVUv_Op.js +141 -0
- package/dist/chunks/pt-uFVUv_Op.js.map +1 -0
- package/dist/chunks/ro-BrqQ8Au-.js +122 -0
- package/dist/chunks/ro-BrqQ8Au-.js.map +1 -0
- package/dist/chunks/ro-D-NMbp2F.js +2 -0
- package/dist/chunks/ro-D-NMbp2F.js.map +1 -0
- package/dist/chunks/ru-8gbHPh0g.js +2 -0
- package/dist/chunks/ru-8gbHPh0g.js.map +1 -0
- package/dist/chunks/ru-DK594dA8.js +144 -0
- package/dist/chunks/ru-DK594dA8.js.map +1 -0
- package/dist/chunks/sv-CHNH8-mq.js +122 -0
- package/dist/chunks/sv-CHNH8-mq.js.map +1 -0
- package/dist/chunks/sv-D8a8hmx9.js +2 -0
- package/dist/chunks/sv-D8a8hmx9.js.map +1 -0
- package/dist/chunks/th-DfjUK0Y7.js +2 -0
- package/dist/chunks/th-DfjUK0Y7.js.map +1 -0
- package/dist/chunks/th-l24Pm5q-.js +126 -0
- package/dist/chunks/th-l24Pm5q-.js.map +1 -0
- package/dist/chunks/tr-ADpigSY5.js +122 -0
- package/dist/chunks/tr-ADpigSY5.js.map +1 -0
- package/dist/chunks/tr-BdBpz4tL.js +2 -0
- package/dist/chunks/tr-BdBpz4tL.js.map +1 -0
- package/dist/chunks/uk-CGqo4jek.js +144 -0
- package/dist/chunks/uk-CGqo4jek.js.map +1 -0
- package/dist/chunks/uk-Cx1zv1ao.js +2 -0
- package/dist/chunks/uk-Cx1zv1ao.js.map +1 -0
- package/dist/chunks/vi-Dk9bTu6f.js +122 -0
- package/dist/chunks/vi-Dk9bTu6f.js.map +1 -0
- package/dist/chunks/vi-oe2dW21I.js +2 -0
- package/dist/chunks/vi-oe2dW21I.js.map +1 -0
- package/dist/chunks/zh-CwczPMPp.js +2 -0
- package/dist/chunks/zh-CwczPMPp.js.map +1 -0
- package/dist/chunks/zh-LDkEV2D9.js +145 -0
- package/dist/chunks/zh-LDkEV2D9.js.map +1 -0
- package/dist/content/RemoteAuthClient.d.ts +8 -4
- package/dist/content/RemoteAuthClient.d.ts.map +1 -1
- package/dist/content/RemoteAuthClient.test-d.d.ts +2 -0
- package/dist/content/RemoteAuthClient.test-d.d.ts.map +1 -0
- package/dist/content/RemoteBillingClient.d.ts +34 -1
- package/dist/content/RemoteBillingClient.d.ts.map +1 -1
- package/dist/content/RemoteBillingClient.test-d.d.ts +2 -0
- package/dist/content/RemoteBillingClient.test-d.d.ts.map +1 -0
- package/dist/content.cjs +3 -3
- package/dist/content.cjs.map +1 -1
- package/dist/content.js +2356 -1221
- package/dist/content.js.map +1 -1
- package/dist/offscreen/server.d.ts.map +1 -1
- package/dist/offscreen.cjs +1 -1
- package/dist/offscreen.cjs.map +1 -1
- package/dist/offscreen.js +18 -15
- package/dist/offscreen.js.map +1 -1
- package/dist/shared/messages.d.ts +27 -4
- package/dist/shared/messages.d.ts.map +1 -1
- package/dist/shared/port-name.d.ts +1 -0
- package/dist/shared/port-name.d.ts.map +1 -1
- package/dist/shared/protocol.d.ts +1 -1
- package/dist/shared/protocol.d.ts.map +1 -1
- package/dist/sw.cjs +1 -1
- package/dist/sw.cjs.map +1 -1
- package/dist/sw.js +14 -14
- package/dist/sw.js.map +1 -1
- package/package.json +39 -21
- package/dist/chunks/chrome-port-BXHR4SOG.js.map +0 -1
- package/dist/chunks/chrome-port-EtYqHf3p.js +0 -2
- package/dist/chunks/chrome-port-EtYqHf3p.js.map +0 -1
- package/dist/chunks/port-name-BPfQKtdb.js +0 -5
- package/dist/chunks/port-name-BPfQKtdb.js.map +0 -1
- package/dist/chunks/port-name-qwB109u9.js +0 -2
- package/dist/chunks/port-name-qwB109u9.js.map +0 -1
package/dist/content.js
CHANGED
|
@@ -1,40 +1,82 @@
|
|
|
1
|
-
import { P as T, B as
|
|
2
|
-
import { render as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { P as
|
|
6
|
-
const oe = '@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}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { P as T, B as je, E as Re, c as De, A as ce, w as ze, a as X, r as Ne, b as qe } from "./chunks/chrome-port-KYVwww_u.js";
|
|
2
|
+
import { render as J, h as ue, createContext as Fe } from "preact";
|
|
3
|
+
import { jsx as o, jsxs as u, Fragment as se } from "preact/jsx-runtime";
|
|
4
|
+
import { useState as x, useEffect as B, useContext as $e, useRef as R, useMemo as Ve, useLayoutEffect as He } from "preact/hooks";
|
|
5
|
+
import { P as Ge } from "./chunks/port-name-ervLBWAQ.js";
|
|
6
|
+
function We(t) {
|
|
7
|
+
return `pw-offer-${t}-start`;
|
|
8
|
+
}
|
|
9
|
+
function $(t, e) {
|
|
10
|
+
if (!t || t.length === 0) return null;
|
|
11
|
+
const r = t.find(
|
|
12
|
+
(i) => i.price_id === e && (i.discount_percent ?? 0) > 0
|
|
13
|
+
);
|
|
14
|
+
return r || (t.find(
|
|
15
|
+
(i) => i.price_id == null && (i.discount_percent ?? 0) > 0
|
|
16
|
+
) ?? null);
|
|
17
|
+
}
|
|
18
|
+
function Ze(t, e = {}) {
|
|
19
|
+
const r = t.discount_percent ?? 0;
|
|
20
|
+
if (r <= 0) return null;
|
|
21
|
+
const n = e.now ?? Date.now(), i = Ye(t, e.readStart), s = Ke(t, i), a = i !== null ? Math.max(0, i - n) : null;
|
|
22
|
+
return i !== null && i <= n ? null : { offer: t, discountPercent: r, remainingMs: a, totalMs: s, expiresAt: i };
|
|
23
|
+
}
|
|
24
|
+
function Ye(t, e) {
|
|
25
|
+
if (t.expires_at) {
|
|
26
|
+
const r = Date.parse(t.expires_at);
|
|
27
|
+
return Number.isFinite(r) ? r : null;
|
|
28
|
+
}
|
|
29
|
+
if (t.duration_minutes && t.duration_minutes > 0 && e) {
|
|
30
|
+
const r = e(t.id);
|
|
31
|
+
if (!r) return null;
|
|
32
|
+
const n = Date.parse(r);
|
|
33
|
+
return Number.isFinite(n) ? n + t.duration_minutes * 6e4 : null;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function Ke(t, e) {
|
|
38
|
+
return t.duration_minutes && t.duration_minutes > 0 ? t.duration_minutes * 6e4 : e !== null ? e - Date.now() : null;
|
|
39
|
+
}
|
|
40
|
+
function Xe(t) {
|
|
41
|
+
if (typeof window > "u") return null;
|
|
42
|
+
try {
|
|
43
|
+
return window.localStorage.getItem(We(t));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
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 de = !1;
|
|
50
|
+
function Je() {
|
|
51
|
+
if (de || (de = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
|
|
52
|
+
let t;
|
|
11
53
|
try {
|
|
12
54
|
const e = new CSSStyleSheet();
|
|
13
|
-
e.replaceSync(
|
|
55
|
+
e.replaceSync(_e), t = e.cssRules;
|
|
14
56
|
} catch {
|
|
15
57
|
return;
|
|
16
58
|
}
|
|
17
|
-
for (const e of
|
|
59
|
+
for (const e of t) {
|
|
18
60
|
if (e.constructor.name !== "CSSPropertyRule") continue;
|
|
19
|
-
const
|
|
61
|
+
const r = e;
|
|
20
62
|
try {
|
|
21
63
|
CSS.registerProperty({
|
|
22
|
-
name:
|
|
23
|
-
syntax:
|
|
24
|
-
inherits:
|
|
25
|
-
...
|
|
64
|
+
name: r.name,
|
|
65
|
+
syntax: r.syntax,
|
|
66
|
+
inherits: r.inherits,
|
|
67
|
+
...r.initialValue != null ? { initialValue: r.initialValue } : {}
|
|
26
68
|
});
|
|
27
69
|
} catch {
|
|
28
70
|
}
|
|
29
71
|
}
|
|
30
72
|
}
|
|
31
|
-
function
|
|
73
|
+
function Qe(t, e, r = {}) {
|
|
32
74
|
if (typeof document > "u")
|
|
33
75
|
throw new Error("mountShadow called in non-DOM environment");
|
|
34
|
-
|
|
35
|
-
const n =
|
|
36
|
-
n.setAttribute("data-paywall-host", ""), n.style.cssText = "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", n.isConnected
|
|
37
|
-
const i = n.attachShadow({ mode:
|
|
76
|
+
Je();
|
|
77
|
+
const n = r.host ?? document.createElement("div");
|
|
78
|
+
n.setAttribute("data-paywall-host", ""), n.style.cssText = r.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 && !r.inline && document.body.appendChild(n);
|
|
79
|
+
const i = n.attachShadow({ mode: r.shadowMode ?? "closed" }), s = `
|
|
38
80
|
:host {
|
|
39
81
|
all: initial !important;
|
|
40
82
|
display: block !important;
|
|
@@ -52,124 +94,230 @@ function me(r, e, t = {}) {
|
|
|
52
94
|
cursor: auto !important;
|
|
53
95
|
visibility: visible !important;
|
|
54
96
|
}
|
|
55
|
-
`,
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
return
|
|
97
|
+
`, a = document.createElement("style");
|
|
98
|
+
a.textContent = s + _e + (r.injectCss ?? ""), i.appendChild(a);
|
|
99
|
+
const c = document.createElement("div");
|
|
100
|
+
c.style.pointerEvents = "auto", i.appendChild(c);
|
|
101
|
+
let l = e;
|
|
102
|
+
return J(ue(t, l), c), {
|
|
61
103
|
shadowRoot: i,
|
|
62
|
-
update(
|
|
63
|
-
|
|
104
|
+
update(f) {
|
|
105
|
+
l = { ...l, ...f }, J(ue(t, l), c);
|
|
64
106
|
},
|
|
65
107
|
unmount() {
|
|
66
|
-
|
|
108
|
+
J(null, c), n.remove();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const et = (t, e, r) => {
|
|
113
|
+
const n = t[e];
|
|
114
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
|
|
115
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
116
|
+
s.bind(
|
|
117
|
+
null,
|
|
118
|
+
new Error(
|
|
119
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== r ? ". Note that variables only represent file names one level deep." : "")
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
}, tt = [
|
|
125
|
+
"ru",
|
|
126
|
+
"uk",
|
|
127
|
+
"de",
|
|
128
|
+
"es",
|
|
129
|
+
"fr",
|
|
130
|
+
"it",
|
|
131
|
+
"pt",
|
|
132
|
+
"pl",
|
|
133
|
+
"cs",
|
|
134
|
+
"hu",
|
|
135
|
+
"ro",
|
|
136
|
+
"nl",
|
|
137
|
+
"sv",
|
|
138
|
+
"da",
|
|
139
|
+
"no",
|
|
140
|
+
"fi",
|
|
141
|
+
"el",
|
|
142
|
+
"tr",
|
|
143
|
+
"id",
|
|
144
|
+
"ar",
|
|
145
|
+
"ja",
|
|
146
|
+
"ko",
|
|
147
|
+
"zh",
|
|
148
|
+
"hi",
|
|
149
|
+
"th",
|
|
150
|
+
"vi",
|
|
151
|
+
"he"
|
|
152
|
+
], Se = (t, e, r) => Ie(e, r), Ce = Fe({ t: Se, locale: "en" });
|
|
153
|
+
function Ie(t, e) {
|
|
154
|
+
if (!e) return t;
|
|
155
|
+
let r = t;
|
|
156
|
+
for (const [n, i] of Object.entries(e))
|
|
157
|
+
r = r.split(`{${n}}`).join(String(i));
|
|
158
|
+
return r;
|
|
159
|
+
}
|
|
160
|
+
const Q = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map();
|
|
161
|
+
function Ae(t) {
|
|
162
|
+
return tt.includes(t);
|
|
163
|
+
}
|
|
164
|
+
function rt(t) {
|
|
165
|
+
const e = [];
|
|
166
|
+
if (typeof navigator < "u" && navigator.language) {
|
|
167
|
+
e.push(navigator.language);
|
|
168
|
+
const n = navigator.language.split("-")[0];
|
|
169
|
+
n && n !== navigator.language && e.push(n);
|
|
170
|
+
}
|
|
171
|
+
const r = t.settings.locale_default;
|
|
172
|
+
if (r) {
|
|
173
|
+
e.push(r);
|
|
174
|
+
const n = r.split("-")[0];
|
|
175
|
+
n && n !== r && e.push(n);
|
|
176
|
+
}
|
|
177
|
+
for (const n of e)
|
|
178
|
+
if (Ae(n)) return n;
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function nt(t, e) {
|
|
182
|
+
return !!t.locales && t.locales[e] !== void 0;
|
|
183
|
+
}
|
|
184
|
+
async function it(t) {
|
|
185
|
+
const e = Q.get(t);
|
|
186
|
+
if (e) return e;
|
|
187
|
+
const r = ee.get(t);
|
|
188
|
+
if (r) return r;
|
|
189
|
+
const n = et(/* @__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/${t}.ts`, 3).then((i) => {
|
|
190
|
+
const s = i.default ?? {};
|
|
191
|
+
return Q.set(t, s), s;
|
|
192
|
+
}).catch((i) => {
|
|
193
|
+
console.warn(`[paywall] failed to load locale chunk "${t}"`, i);
|
|
194
|
+
const s = {};
|
|
195
|
+
return Q.set(t, s), s;
|
|
196
|
+
}).finally(() => {
|
|
197
|
+
ee.delete(t);
|
|
198
|
+
});
|
|
199
|
+
return ee.set(t, n), n;
|
|
200
|
+
}
|
|
201
|
+
function ot({ bootstrap: t, forceLocale: e, children: r }) {
|
|
202
|
+
const [n, i] = x("en"), [s, a] = x(null);
|
|
203
|
+
B(() => {
|
|
204
|
+
const f = (e && Ae(e) ? e : null) ?? (() => {
|
|
205
|
+
if (!t) return null;
|
|
206
|
+
const d = rt(t);
|
|
207
|
+
return !d || !nt(t, d) ? null : d;
|
|
208
|
+
})();
|
|
209
|
+
if (!f) {
|
|
210
|
+
(s !== null || n !== "en") && (i("en"), a(null));
|
|
211
|
+
return;
|
|
67
212
|
}
|
|
213
|
+
if (f === n && s) return;
|
|
214
|
+
let h = !1;
|
|
215
|
+
return it(f).then((d) => {
|
|
216
|
+
h || (i(f), a(d));
|
|
217
|
+
}), () => {
|
|
218
|
+
h = !0;
|
|
219
|
+
};
|
|
220
|
+
}, [t, e]);
|
|
221
|
+
const c = {
|
|
222
|
+
locale: n,
|
|
223
|
+
t: s ? (l, f, h) => Ie(s[l] ?? f, h) : Se
|
|
68
224
|
};
|
|
225
|
+
return /* @__PURE__ */ o(Ce.Provider, { value: c, children: r });
|
|
226
|
+
}
|
|
227
|
+
function k() {
|
|
228
|
+
return $e(Ce);
|
|
69
229
|
}
|
|
70
|
-
const
|
|
71
|
-
function
|
|
72
|
-
open:
|
|
230
|
+
const he = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
231
|
+
function st({
|
|
232
|
+
open: t,
|
|
73
233
|
onClose: e,
|
|
74
|
-
labelledBy:
|
|
234
|
+
labelledBy: r,
|
|
75
235
|
brandColor: n,
|
|
76
|
-
|
|
236
|
+
topBanner: i,
|
|
77
237
|
allowClose: s = !0,
|
|
238
|
+
hideCloseButton: a = !1,
|
|
239
|
+
inline: c = !1,
|
|
78
240
|
children: l
|
|
79
241
|
}) {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
if (!
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
242
|
+
const { t: f } = k(), h = R(null), d = R(null);
|
|
243
|
+
return B(() => {
|
|
244
|
+
if (!t) return;
|
|
245
|
+
d.current = document.activeElement ?? null;
|
|
246
|
+
const p = h.current;
|
|
247
|
+
p && (p.querySelector(he) ?? p).focus({ preventScroll: !0 });
|
|
248
|
+
const y = (_) => {
|
|
249
|
+
if (_.key === "Escape") {
|
|
88
250
|
if (!s) return;
|
|
89
|
-
|
|
251
|
+
_.stopPropagation(), e();
|
|
90
252
|
return;
|
|
91
253
|
}
|
|
92
|
-
if (
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
).filter((
|
|
96
|
-
if (
|
|
97
|
-
|
|
254
|
+
if (_.key !== "Tab" || !h.current) return;
|
|
255
|
+
const S = Array.from(
|
|
256
|
+
h.current.querySelectorAll(he)
|
|
257
|
+
).filter((U) => !U.hasAttribute("disabled") && U.tabIndex !== -1);
|
|
258
|
+
if (S.length === 0) {
|
|
259
|
+
_.preventDefault();
|
|
98
260
|
return;
|
|
99
261
|
}
|
|
100
|
-
const A =
|
|
101
|
-
|
|
262
|
+
const A = S[0], D = S[S.length - 1], E = document.activeElement;
|
|
263
|
+
_.shiftKey && E === A ? (_.preventDefault(), D.focus()) : !_.shiftKey && E === D && (_.preventDefault(), A.focus());
|
|
102
264
|
};
|
|
103
|
-
document.addEventListener("keydown",
|
|
104
|
-
const
|
|
105
|
-
return document.body.style.overflow = "hidden", () => {
|
|
106
|
-
document.removeEventListener("keydown",
|
|
265
|
+
document.addEventListener("keydown", y, !0);
|
|
266
|
+
const O = document.body.style.overflow;
|
|
267
|
+
return c || (document.body.style.overflow = "hidden"), () => {
|
|
268
|
+
document.removeEventListener("keydown", y, !0), c || (document.body.style.overflow = O), d.current?.focus?.({ preventScroll: !0 });
|
|
107
269
|
};
|
|
108
|
-
}, [
|
|
270
|
+
}, [t, e, s, c]), t ? /* @__PURE__ */ u(
|
|
109
271
|
"div",
|
|
110
272
|
{
|
|
111
|
-
class: "
|
|
112
|
-
onClick: (
|
|
113
|
-
s &&
|
|
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: (p) => {
|
|
275
|
+
s && p.target === p.currentTarget && e();
|
|
114
276
|
},
|
|
115
277
|
"data-pw-root": !0,
|
|
116
278
|
children: [
|
|
117
279
|
/* @__PURE__ */ u(
|
|
118
280
|
"div",
|
|
119
281
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"aria-modal": "true",
|
|
123
|
-
"aria-labelledby": t,
|
|
124
|
-
tabIndex: -1,
|
|
125
|
-
class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full max-w-md flex-col overflow-hidden rounded-3xl bg-white outline-none ring-1 ring-black/5 animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
|
|
126
|
-
style: {
|
|
127
|
-
"--pw-accent": n ?? "#3b82f6",
|
|
128
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.04), 0 12px 32px -8px rgba(15,23,42,0.18), 0 24px 64px -16px rgba(15,23,42,0.22)"
|
|
129
|
-
},
|
|
282
|
+
class: "relative flex w-full max-w-[400px] flex-col animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
|
|
283
|
+
style: { "--pw-accent": n ?? "#3b82f6" },
|
|
130
284
|
children: [
|
|
131
|
-
i
|
|
285
|
+
i,
|
|
286
|
+
/* @__PURE__ */ u(
|
|
132
287
|
"div",
|
|
133
288
|
{
|
|
134
|
-
|
|
135
|
-
role: "
|
|
289
|
+
ref: h,
|
|
290
|
+
role: "dialog",
|
|
291
|
+
"aria-modal": "true",
|
|
292
|
+
"aria-labelledby": r,
|
|
293
|
+
tabIndex: -1,
|
|
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
|
+
style: {
|
|
296
|
+
boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
297
|
+
},
|
|
136
298
|
children: [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
299
|
+
l,
|
|
300
|
+
s && !a ? /* @__PURE__ */ o(
|
|
301
|
+
"button",
|
|
302
|
+
{
|
|
303
|
+
type: "button",
|
|
304
|
+
onClick: e,
|
|
305
|
+
"aria-label": f("modal.close_aria", "Close"),
|
|
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
|
+
children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
308
|
+
"path",
|
|
309
|
+
{
|
|
310
|
+
d: "M3 3l10 10M13 3L3 13",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
"stroke-width": "1.75",
|
|
313
|
+
"stroke-linecap": "round"
|
|
314
|
+
}
|
|
315
|
+
) })
|
|
316
|
+
}
|
|
317
|
+
) : null
|
|
151
318
|
]
|
|
152
319
|
}
|
|
153
|
-
)
|
|
154
|
-
/* @__PURE__ */ o("div", { class: "flex-1 overflow-y-auto p-7", children: l }),
|
|
155
|
-
s ? /* @__PURE__ */ o(
|
|
156
|
-
"button",
|
|
157
|
-
{
|
|
158
|
-
type: "button",
|
|
159
|
-
onClick: e,
|
|
160
|
-
"aria-label": "Close",
|
|
161
|
-
class: `absolute right-3 ${i ? "top-10" : "top-3"} z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-400 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]`,
|
|
162
|
-
children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
163
|
-
"path",
|
|
164
|
-
{
|
|
165
|
-
d: "M3 3l10 10M13 3L3 13",
|
|
166
|
-
stroke: "currentColor",
|
|
167
|
-
"stroke-width": "1.75",
|
|
168
|
-
"stroke-linecap": "round"
|
|
169
|
-
}
|
|
170
|
-
) })
|
|
171
|
-
}
|
|
172
|
-
) : null
|
|
320
|
+
)
|
|
173
321
|
]
|
|
174
322
|
}
|
|
175
323
|
),
|
|
@@ -184,33 +332,74 @@ function ye({
|
|
|
184
332
|
}
|
|
185
333
|
) : null;
|
|
186
334
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
335
|
+
function at(t, e) {
|
|
336
|
+
switch (t) {
|
|
337
|
+
case "google":
|
|
338
|
+
return e("auth.continue_with_google", "Continue with Google");
|
|
339
|
+
case "apple":
|
|
340
|
+
return e("auth.continue_with_apple", "Continue with Apple");
|
|
341
|
+
case "github":
|
|
342
|
+
return e("auth.continue_with_github", "Continue with GitHub");
|
|
343
|
+
case "facebook":
|
|
344
|
+
return e("auth.continue_with_facebook", "Continue with Facebook");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function pe(t, e, r) {
|
|
348
|
+
const n = e === "signup" ? r("auth.signup_failed", "Sign-up failed") : r("auth.signin_failed", "Sign-in failed");
|
|
349
|
+
if (!(t instanceof T)) return n;
|
|
350
|
+
switch (t.code) {
|
|
351
|
+
case "invalid_credentials":
|
|
352
|
+
return r("auth.invalid_credentials", "Invalid email or password");
|
|
353
|
+
case "email_not_confirmed":
|
|
354
|
+
return r("auth.email_not_confirmed", "Please confirm your email before signing in.");
|
|
355
|
+
case "email_exists":
|
|
356
|
+
case "user_already_exists":
|
|
357
|
+
return r("auth.email_exists", "An account with this email already exists.");
|
|
358
|
+
case "weak_password":
|
|
359
|
+
return r("auth.weak_password", "Password is too weak.");
|
|
360
|
+
case "invalid_otp":
|
|
361
|
+
case "otp_expired":
|
|
362
|
+
case "token_expired":
|
|
363
|
+
return r("auth.invalid_otp", "The code is invalid or has expired.");
|
|
364
|
+
case "over_email_send_rate_limit":
|
|
365
|
+
case "over_request_rate_limit":
|
|
366
|
+
case "rate_limited":
|
|
367
|
+
case "http_429":
|
|
368
|
+
return r("auth.rate_limited", "Too many requests. Please try again later.");
|
|
369
|
+
case "network_error":
|
|
370
|
+
return r("auth.network_error", "Network error. Please check your connection and try again.");
|
|
371
|
+
case "upstream":
|
|
372
|
+
case "upstream_error":
|
|
373
|
+
case "http_502":
|
|
374
|
+
case "http_503":
|
|
375
|
+
case "http_504":
|
|
376
|
+
return r("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
|
|
377
|
+
default:
|
|
378
|
+
return n;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function Le({ block: t, ctx: e }) {
|
|
382
|
+
const r = e.auth, n = e.authSession, i = t.allow_signup !== !1, s = t.allow_password_reset !== !1, a = t.hide_when_authenticated !== !1;
|
|
383
|
+
if (!r)
|
|
196
384
|
return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
|
|
197
|
-
const
|
|
198
|
-
return
|
|
385
|
+
const c = n && !n.user.is_anonymous ? n : null;
|
|
386
|
+
return c && a ? null : c ? /* @__PURE__ */ o(lt, { email: c.user.email ?? "", onSignOut: () => r.signOut().catch(() => {
|
|
199
387
|
}) }) : /* @__PURE__ */ o(
|
|
200
|
-
|
|
388
|
+
ct,
|
|
201
389
|
{
|
|
202
|
-
block:
|
|
390
|
+
block: t,
|
|
203
391
|
allowSignup: i,
|
|
204
392
|
allowReset: s,
|
|
205
393
|
ctx: e
|
|
206
394
|
}
|
|
207
395
|
);
|
|
208
396
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
397
|
+
function lt({ email: t, onSignOut: e }) {
|
|
398
|
+
const { t: r } = k();
|
|
399
|
+
return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
|
|
211
400
|
/* @__PURE__ */ u("div", { class: "flex flex-col", children: [
|
|
212
|
-
/* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: "Signed in" }),
|
|
213
|
-
/* @__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: r("auth.signed_in", "Signed in") }),
|
|
402
|
+
/* @__PURE__ */ o("span", { class: "text-sm font-medium text-gray-900", children: t })
|
|
214
403
|
] }),
|
|
215
404
|
/* @__PURE__ */ o(
|
|
216
405
|
"button",
|
|
@@ -218,723 +407,1294 @@ function be({ email: r, onSignOut: e }) {
|
|
|
218
407
|
type: "button",
|
|
219
408
|
onClick: e,
|
|
220
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)]",
|
|
221
|
-
children: "Sign out"
|
|
410
|
+
children: r("auth.sign_out", "Sign out")
|
|
222
411
|
}
|
|
223
412
|
)
|
|
224
413
|
] });
|
|
225
414
|
}
|
|
226
|
-
function
|
|
227
|
-
const i = n.auth,
|
|
228
|
-
|
|
229
|
-
|
|
415
|
+
function ct({ block: t, allowSignup: e, allowReset: r, ctx: n }) {
|
|
416
|
+
const { t: i } = k(), s = n.auth, a = t.providers ?? [], c = n.initialAuthMode === "signup" && e ? "signup" : "signin", [l, f] = x(c), [h, d] = x(""), [b, w] = x(""), [v, p] = x(""), [y, O] = x(""), [_, S] = x(null), A = R(!1), [D, E] = x(null), [U, z] = x(null), [j, P] = x(!1), [L, N] = x(null);
|
|
417
|
+
B(() => {
|
|
418
|
+
if (typeof s.getLastLogin != "function") return;
|
|
419
|
+
let I = !1;
|
|
420
|
+
return s.getLastLogin().then(
|
|
421
|
+
(M) => {
|
|
422
|
+
I || !M || (N(M), M.email && d((V) => V === "" ? M.email : V));
|
|
423
|
+
},
|
|
424
|
+
() => {
|
|
425
|
+
}
|
|
426
|
+
), () => {
|
|
427
|
+
I = !0;
|
|
428
|
+
};
|
|
429
|
+
}, [s]);
|
|
430
|
+
const q = (I) => {
|
|
431
|
+
f(I), E(null), z(null), P(!1);
|
|
432
|
+
}, Y = async (I) => {
|
|
433
|
+
if (I.preventDefault(), !(A.current || _)) {
|
|
434
|
+
A.current = !0;
|
|
230
435
|
try {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
436
|
+
if (E(null), z(null), l === "signup" && !j) {
|
|
437
|
+
if (!h.trim()) return;
|
|
438
|
+
P(!0);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (l === "signup" && b !== v) {
|
|
442
|
+
E(i("auth.passwords_mismatch", "Passwords don't match"));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
S("email");
|
|
446
|
+
try {
|
|
447
|
+
l === "signin" ? await s.signInWithEmail({ email: h, password: b }) : l === "signup" ? (await s.signUp({ email: h, password: b })).kind === "confirmation_required" && (w(""), f("signup_verify"), z(i("auth.check_email_message", "Check your email for a confirmation code."))) : l === "forgot" ? (await s.requestPasswordReset({ email: h }), f("reset_sent"), z(
|
|
448
|
+
i("auth.reset_sent_message", "If that email exists, a reset code has been sent.")
|
|
449
|
+
)) : l === "signup_verify" ? await s.verifyOtp({ email: h, token: y, type: "email" }) : l === "reset_verify" && (await s.verifyOtp({
|
|
450
|
+
email: h,
|
|
451
|
+
token: y,
|
|
452
|
+
type: b ? "recovery" : "email"
|
|
453
|
+
}), b && await s.updatePassword({ password: b }));
|
|
454
|
+
} catch (M) {
|
|
455
|
+
E(pe(M, l === "signup" ? "signup" : l === "signup_verify" || l === "reset_verify" ? "otp" : l === "forgot" ? "reset" : "signin", i));
|
|
456
|
+
} finally {
|
|
457
|
+
S(null);
|
|
458
|
+
}
|
|
239
459
|
} finally {
|
|
240
|
-
|
|
460
|
+
A.current = !1;
|
|
241
461
|
}
|
|
242
462
|
}
|
|
243
|
-
},
|
|
244
|
-
if (!
|
|
245
|
-
|
|
463
|
+
}, m = async (I) => {
|
|
464
|
+
if (!(A.current || _)) {
|
|
465
|
+
A.current = !0, S(I), E(null), z(null);
|
|
246
466
|
try {
|
|
247
|
-
await
|
|
248
|
-
provider:
|
|
249
|
-
onPopupOpened: () =>
|
|
467
|
+
await s.signInWithOAuth({
|
|
468
|
+
provider: I,
|
|
469
|
+
onPopupOpened: () => S(null)
|
|
250
470
|
});
|
|
251
|
-
} catch (
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
} else
|
|
256
|
-
v("Sign-in failed");
|
|
471
|
+
} catch (M) {
|
|
472
|
+
if (M instanceof T && (M.code === "oauth_cancelled" || M.code === "oauth_timeout"))
|
|
473
|
+
return;
|
|
474
|
+
E(pe(M, "signin", i));
|
|
257
475
|
} finally {
|
|
258
|
-
|
|
476
|
+
A.current = !1, S(null);
|
|
259
477
|
}
|
|
260
478
|
}
|
|
261
|
-
};
|
|
262
|
-
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
479
|
+
}, g = a.length > 0 && (l === "signin" || l === "signup"), C = l === "signin" || l === "signup" || l === "forgot", K = l === "signin" || l === "signup" && j;
|
|
480
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
|
|
481
|
+
/* @__PURE__ */ o(ut, { mode: l, customHeading: t.heading, customSubheading: t.subheading }),
|
|
482
|
+
g ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2.5", children: [
|
|
483
|
+
a.map((I) => /* @__PURE__ */ u("div", { class: "relative", children: [
|
|
484
|
+
/* @__PURE__ */ u(
|
|
485
|
+
"button",
|
|
486
|
+
{
|
|
487
|
+
type: "button",
|
|
488
|
+
onClick: () => m(I),
|
|
489
|
+
disabled: _ !== null,
|
|
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
|
+
children: [
|
|
492
|
+
_ === I ? /* @__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(wt, { provider: I }),
|
|
493
|
+
/* @__PURE__ */ o("span", { children: at(I, i) })
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
L?.method === I ? /* @__PURE__ */ o(yt, { email: L.email }) : null
|
|
498
|
+
] }, I)),
|
|
499
|
+
/* @__PURE__ */ o(bt, {})
|
|
280
500
|
] }) : null,
|
|
281
|
-
/* @__PURE__ */ u("form", { onSubmit:
|
|
282
|
-
|
|
283
|
-
|
|
501
|
+
/* @__PURE__ */ u("form", { onSubmit: Y, class: "flex flex-col gap-3", children: [
|
|
502
|
+
C && /* @__PURE__ */ o(
|
|
503
|
+
fe,
|
|
284
504
|
{
|
|
285
505
|
type: "email",
|
|
286
|
-
|
|
287
|
-
value:
|
|
288
|
-
onInput:
|
|
506
|
+
placeholder: i("auth.email", "Email address"),
|
|
507
|
+
value: h,
|
|
508
|
+
onInput: d,
|
|
289
509
|
autocomplete: "email",
|
|
290
510
|
required: !0
|
|
291
511
|
}
|
|
292
512
|
),
|
|
293
|
-
|
|
294
|
-
|
|
513
|
+
K && /* @__PURE__ */ o(
|
|
514
|
+
te,
|
|
295
515
|
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
onInput: b,
|
|
516
|
+
placeholder: i("auth.password", "Password"),
|
|
517
|
+
value: b,
|
|
518
|
+
onInput: w,
|
|
300
519
|
autocomplete: l === "signin" ? "current-password" : "new-password",
|
|
301
520
|
required: !0
|
|
302
521
|
}
|
|
303
522
|
),
|
|
304
|
-
l === "
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
523
|
+
l === "signup" && j && /* @__PURE__ */ o(
|
|
524
|
+
te,
|
|
525
|
+
{
|
|
526
|
+
placeholder: i("auth.repeat_password", "Repeat password"),
|
|
527
|
+
value: v,
|
|
528
|
+
onInput: p,
|
|
529
|
+
autocomplete: "new-password",
|
|
530
|
+
required: !0
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
(l === "signup_verify" || l === "reset_verify") && /* @__PURE__ */ o(
|
|
534
|
+
fe,
|
|
535
|
+
{
|
|
536
|
+
type: "text",
|
|
537
|
+
placeholder: i("auth.confirmation_code", "Confirmation code"),
|
|
538
|
+
value: y,
|
|
539
|
+
onInput: O,
|
|
540
|
+
autocomplete: "one-time-code",
|
|
541
|
+
inputMode: "numeric",
|
|
542
|
+
required: !0
|
|
543
|
+
}
|
|
544
|
+
),
|
|
545
|
+
l === "reset_verify" && /* @__PURE__ */ o(
|
|
546
|
+
te,
|
|
547
|
+
{
|
|
548
|
+
placeholder: i(
|
|
549
|
+
"auth.new_password_optional",
|
|
550
|
+
"New password (optional — only for password reset)"
|
|
551
|
+
),
|
|
552
|
+
value: b,
|
|
553
|
+
onInput: w,
|
|
554
|
+
autocomplete: "new-password"
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
l === "reset_sent" && U && /* @__PURE__ */ o("p", { class: "rounded-2xl bg-gray-100 px-4 py-3 text-sm text-gray-600", children: U }),
|
|
558
|
+
l === "signin" && r && /* @__PURE__ */ o("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ o(Z, { onClick: () => q("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
|
|
559
|
+
D && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: D }),
|
|
560
|
+
U && l !== "reset_sent" && /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: U }),
|
|
331
561
|
l !== "reset_sent" && /* @__PURE__ */ o(
|
|
332
|
-
|
|
562
|
+
ft,
|
|
333
563
|
{
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
class: "flex h-11 w-full items-center justify-center rounded-xl px-4 text-sm font-semibold tracking-tight 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)]",
|
|
337
|
-
style: {
|
|
338
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
339
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
340
|
-
},
|
|
341
|
-
children: y === "email" ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : we(l)
|
|
564
|
+
busy: _ === "email",
|
|
565
|
+
label: ht(l, j, t.submit_label ?? t.heading, i)
|
|
342
566
|
}
|
|
343
567
|
)
|
|
344
568
|
] }),
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
569
|
+
/* @__PURE__ */ o(
|
|
570
|
+
pt,
|
|
571
|
+
{
|
|
572
|
+
mode: l,
|
|
573
|
+
allowSignup: e,
|
|
574
|
+
onSwitch: q
|
|
575
|
+
}
|
|
576
|
+
)
|
|
352
577
|
] });
|
|
353
578
|
}
|
|
354
|
-
function
|
|
355
|
-
|
|
579
|
+
function ut({
|
|
580
|
+
mode: t,
|
|
581
|
+
customHeading: e,
|
|
582
|
+
customSubheading: r
|
|
583
|
+
}) {
|
|
584
|
+
const { t: n } = k(), i = dt(t, n), s = t === "signin" || t === "signup", a = s && e ? e : i.title, c = s && r !== void 0 ? r || null : i.subtitle;
|
|
585
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
586
|
+
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a }),
|
|
587
|
+
c ? /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: c }) : null
|
|
588
|
+
] });
|
|
589
|
+
}
|
|
590
|
+
function dt(t, e) {
|
|
591
|
+
switch (t) {
|
|
356
592
|
case "signin":
|
|
357
|
-
return
|
|
593
|
+
return {
|
|
594
|
+
title: e("auth.welcome", "Welcome back!"),
|
|
595
|
+
subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
596
|
+
};
|
|
358
597
|
case "signup":
|
|
359
|
-
return
|
|
598
|
+
return {
|
|
599
|
+
title: e("auth.welcome_signup", "Welcome!"),
|
|
600
|
+
subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
|
|
601
|
+
};
|
|
360
602
|
case "forgot":
|
|
361
|
-
return
|
|
603
|
+
return {
|
|
604
|
+
title: e("auth.forgot_password_title", "Forgot password?"),
|
|
605
|
+
subtitle: e(
|
|
606
|
+
"auth.forgot_subtitle",
|
|
607
|
+
"Enter your email and we'll send you a password reset link."
|
|
608
|
+
)
|
|
609
|
+
};
|
|
610
|
+
case "reset_sent":
|
|
611
|
+
return {
|
|
612
|
+
title: e("auth.check_email_title", "Check your email"),
|
|
613
|
+
subtitle: null
|
|
614
|
+
};
|
|
362
615
|
case "reset_verify":
|
|
363
|
-
return
|
|
616
|
+
return {
|
|
617
|
+
title: e("auth.reset_password_title", "Reset password"),
|
|
618
|
+
subtitle: e(
|
|
619
|
+
"auth.reset_password_subtitle",
|
|
620
|
+
"Enter the code from your email and a new password."
|
|
621
|
+
)
|
|
622
|
+
};
|
|
623
|
+
case "signup_verify":
|
|
624
|
+
return {
|
|
625
|
+
title: e("auth.confirm_email_title", "Confirm your email"),
|
|
626
|
+
subtitle: e(
|
|
627
|
+
"auth.confirm_email_subtitle",
|
|
628
|
+
"Enter the code we sent to your email to finish creating your account."
|
|
629
|
+
)
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function ht(t, e, r, n) {
|
|
634
|
+
if (t === "signin" && r) return r;
|
|
635
|
+
switch (t) {
|
|
636
|
+
case "signin":
|
|
637
|
+
return n("auth.log_in", "Sign In");
|
|
638
|
+
case "signup":
|
|
639
|
+
return e ? n("auth.create_account", "Create Account") : n("auth.sign_up", "Sign Up");
|
|
640
|
+
case "forgot":
|
|
641
|
+
return n("auth.send_reset", "Send Reset Email");
|
|
642
|
+
case "signup_verify":
|
|
643
|
+
case "reset_verify":
|
|
644
|
+
return n("auth.verify", "Verify");
|
|
364
645
|
default:
|
|
365
|
-
return "Continue";
|
|
646
|
+
return n("cta.continue", "Continue");
|
|
366
647
|
}
|
|
367
648
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
649
|
+
function pt({
|
|
650
|
+
mode: t,
|
|
651
|
+
allowSignup: e,
|
|
652
|
+
onSwitch: r
|
|
653
|
+
}) {
|
|
654
|
+
const { t: n } = k();
|
|
655
|
+
return t === "signin" && e ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
656
|
+
n("auth.no_account", "Don't have an account?"),
|
|
657
|
+
" ",
|
|
658
|
+
/* @__PURE__ */ o(Z, { onClick: () => r("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
659
|
+
] }) : t === "signup" || t === "signup_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
660
|
+
n("auth.have_account", "Already have an account?"),
|
|
661
|
+
" ",
|
|
662
|
+
/* @__PURE__ */ o(Z, { onClick: () => r("signin"), children: n("auth.log_in_link", "Log In") })
|
|
663
|
+
] }) : t === "forgot" || t === "reset_sent" || t === "reset_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
|
|
664
|
+
n("auth.no_account", "Don't have an account?"),
|
|
665
|
+
" ",
|
|
666
|
+
/* @__PURE__ */ o(Z, { onClick: () => r("signup"), children: n("auth.sign_up_link", "Sign Up") })
|
|
667
|
+
] }) : null;
|
|
668
|
+
}
|
|
669
|
+
function Z({
|
|
670
|
+
onClick: t,
|
|
671
|
+
children: e
|
|
672
|
+
}) {
|
|
673
|
+
return /* @__PURE__ */ o(
|
|
674
|
+
"button",
|
|
675
|
+
{
|
|
676
|
+
type: "button",
|
|
677
|
+
onClick: t,
|
|
678
|
+
class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
|
|
679
|
+
style: { color: "var(--pw-accent)" },
|
|
680
|
+
children: e
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
function ft({ busy: t, label: e }) {
|
|
685
|
+
return /* @__PURE__ */ o(
|
|
686
|
+
"button",
|
|
687
|
+
{
|
|
688
|
+
type: "submit",
|
|
689
|
+
disabled: t,
|
|
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
|
+
style: {
|
|
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
|
+
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
|
+
},
|
|
695
|
+
children: t ? /* @__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
|
+
}
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
function fe({ type: t, placeholder: e, value: r, onInput: n, autocomplete: i, inputMode: s, required: a }) {
|
|
700
|
+
return /* @__PURE__ */ o(
|
|
701
|
+
"input",
|
|
702
|
+
{
|
|
703
|
+
type: t,
|
|
704
|
+
value: r,
|
|
705
|
+
placeholder: e,
|
|
706
|
+
onInput: (c) => n(c.target.value),
|
|
707
|
+
autocomplete: i,
|
|
708
|
+
inputMode: s,
|
|
709
|
+
required: a,
|
|
710
|
+
class: "h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
|
|
711
|
+
}
|
|
712
|
+
);
|
|
370
713
|
}
|
|
371
|
-
function
|
|
372
|
-
|
|
373
|
-
|
|
714
|
+
function te({ placeholder: t, value: e, onInput: r, autocomplete: n, required: i }) {
|
|
715
|
+
const { t: s } = k(), [a, c] = x(!1), l = R(null);
|
|
716
|
+
B(() => {
|
|
717
|
+
const d = l.current;
|
|
718
|
+
d && d.value !== e && (d.value = e);
|
|
719
|
+
}, [a, e]);
|
|
720
|
+
const f = s("auth.show_password", "Show password"), h = s("auth.hide_password", "Hide password");
|
|
721
|
+
return /* @__PURE__ */ u("div", { class: "relative", children: [
|
|
374
722
|
/* @__PURE__ */ o(
|
|
375
723
|
"input",
|
|
376
724
|
{
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
725
|
+
ref: l,
|
|
726
|
+
type: a ? "text" : "password",
|
|
727
|
+
value: e,
|
|
728
|
+
placeholder: t,
|
|
729
|
+
onInput: (d) => r(d.target.value),
|
|
730
|
+
autocomplete: n,
|
|
731
|
+
required: i,
|
|
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)]"
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
/* @__PURE__ */ o(
|
|
736
|
+
"button",
|
|
737
|
+
{
|
|
738
|
+
type: "button",
|
|
739
|
+
onClick: () => c((d) => !d),
|
|
740
|
+
"aria-label": a ? h : f,
|
|
741
|
+
tabIndex: -1,
|
|
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(mt, {}) : /* @__PURE__ */ o(gt, {})
|
|
384
744
|
}
|
|
385
745
|
)
|
|
386
746
|
] });
|
|
387
747
|
}
|
|
388
|
-
function
|
|
389
|
-
return /* @__PURE__ */ u("
|
|
390
|
-
/* @__PURE__ */ o(
|
|
391
|
-
|
|
392
|
-
|
|
748
|
+
function gt() {
|
|
749
|
+
return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
750
|
+
/* @__PURE__ */ o(
|
|
751
|
+
"path",
|
|
752
|
+
{
|
|
753
|
+
d: "M1.667 10S4.583 4.167 10 4.167 18.333 10 18.333 10 15.417 15.833 10 15.833 1.667 10 1.667 10Z",
|
|
754
|
+
stroke: "currentColor",
|
|
755
|
+
"stroke-width": "1.5",
|
|
756
|
+
"stroke-linecap": "round",
|
|
757
|
+
"stroke-linejoin": "round"
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
|
|
761
|
+
] });
|
|
762
|
+
}
|
|
763
|
+
function mt() {
|
|
764
|
+
return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
765
|
+
/* @__PURE__ */ o(
|
|
766
|
+
"path",
|
|
767
|
+
{
|
|
768
|
+
d: "M8.236 4.293A6.96 6.96 0 0 1 10 4.167C15.417 4.167 18.333 10 18.333 10a13.5 13.5 0 0 1-1.92 2.755M11.768 11.768A2.5 2.5 0 0 1 8.233 8.233",
|
|
769
|
+
stroke: "currentColor",
|
|
770
|
+
"stroke-width": "1.5",
|
|
771
|
+
"stroke-linecap": "round",
|
|
772
|
+
"stroke-linejoin": "round"
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
/* @__PURE__ */ o(
|
|
776
|
+
"path",
|
|
777
|
+
{
|
|
778
|
+
d: "M14.953 14.953A8.84 8.84 0 0 1 10 15.833C4.583 15.833 1.667 10 1.667 10a13.5 13.5 0 0 1 3.38-3.953M1.667 1.667l16.666 16.666",
|
|
779
|
+
stroke: "currentColor",
|
|
780
|
+
"stroke-width": "1.5",
|
|
781
|
+
"stroke-linecap": "round",
|
|
782
|
+
"stroke-linejoin": "round"
|
|
783
|
+
}
|
|
784
|
+
)
|
|
393
785
|
] });
|
|
394
786
|
}
|
|
395
|
-
function
|
|
396
|
-
|
|
787
|
+
function yt({ email: t }) {
|
|
788
|
+
const { t: e } = k(), r = t ? e("auth.last_used", "Last · {email}", { email: xt(t) }) : 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: r });
|
|
790
|
+
}
|
|
791
|
+
function xt(t) {
|
|
792
|
+
const [e, r] = t.split("@");
|
|
793
|
+
return r ? `${e.slice(0, 3)}*****@${r}` : t;
|
|
794
|
+
}
|
|
795
|
+
function bt() {
|
|
796
|
+
const { t } = k();
|
|
797
|
+
return /* @__PURE__ */ u("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
|
|
798
|
+
/* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" }),
|
|
799
|
+
/* @__PURE__ */ o("span", { children: t("auth.or", "or") }),
|
|
800
|
+
/* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" })
|
|
801
|
+
] });
|
|
802
|
+
}
|
|
803
|
+
function wt({ provider: t }) {
|
|
804
|
+
return t === "google" ? /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
|
|
397
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" }),
|
|
398
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" }),
|
|
399
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" }),
|
|
400
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" })
|
|
401
|
-
] }) :
|
|
809
|
+
] }) : t === "apple" ? (
|
|
810
|
+
// viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
|
|
811
|
+
// Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
|
|
812
|
+
// width/height — 26×26 даёт примерно equal optical size с Google 20×20.
|
|
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
|
+
) : t === "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" }) });
|
|
402
815
|
}
|
|
403
|
-
function
|
|
404
|
-
block:
|
|
816
|
+
function kt({
|
|
817
|
+
block: t,
|
|
405
818
|
bootstrap: e,
|
|
406
|
-
auth:
|
|
819
|
+
auth: r,
|
|
407
820
|
authSession: n,
|
|
408
821
|
onBack: i,
|
|
409
|
-
showBack: s = !0
|
|
822
|
+
showBack: s = !0,
|
|
823
|
+
intent: a = "preauth",
|
|
824
|
+
initialMode: c
|
|
410
825
|
}) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
826
|
+
const { t: l } = k(), f = {
|
|
827
|
+
bootstrap: e,
|
|
828
|
+
selectedPriceId: null,
|
|
829
|
+
setSelectedPriceId: () => {
|
|
830
|
+
},
|
|
831
|
+
onAction: () => {
|
|
832
|
+
},
|
|
833
|
+
auth: r,
|
|
834
|
+
authSession: n,
|
|
835
|
+
initialAuthMode: c
|
|
836
|
+
}, h = a === "restore" ? {
|
|
837
|
+
...t,
|
|
838
|
+
heading: l("auth.restore_purchases_heading", "Restore Purchases"),
|
|
839
|
+
subheading: l(
|
|
840
|
+
"auth.restore_purchases_subheading",
|
|
841
|
+
"Please sign in to restore your purchases."
|
|
842
|
+
)
|
|
843
|
+
} : a === "preauth" ? {
|
|
844
|
+
...t,
|
|
845
|
+
heading: l("auth.login_continue_purchase", "Log in to continue your purchase"),
|
|
846
|
+
subheading: l(
|
|
847
|
+
"auth.link_purchase_subheading",
|
|
848
|
+
"We'll link the purchase to your account to keep access."
|
|
849
|
+
),
|
|
850
|
+
// Preauth heading — descriptive sentence ("Log in to continue your
|
|
851
|
+
// purchase"), а не action verb. Длинные локализации (RU: "Войдите,
|
|
852
|
+
// чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
|
|
853
|
+
// переносятся на 2 строки. Явный короткий submit_label решает.
|
|
854
|
+
submit_label: l("auth.log_in", "Sign In")
|
|
855
|
+
} : t;
|
|
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(vt, { onClick: i, ariaLabel: l("nav.back_aria", "Back") }) : null,
|
|
858
|
+
/* @__PURE__ */ o(Le, { block: h, ctx: f })
|
|
431
859
|
] });
|
|
432
860
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
861
|
+
function vt({ onClick: t, ariaLabel: e }) {
|
|
862
|
+
return /* @__PURE__ */ o(
|
|
863
|
+
"button",
|
|
864
|
+
{
|
|
865
|
+
type: "button",
|
|
866
|
+
onClick: t,
|
|
867
|
+
"aria-label": e,
|
|
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
|
+
children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
870
|
+
/* @__PURE__ */ o(
|
|
871
|
+
"path",
|
|
872
|
+
{
|
|
873
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
874
|
+
stroke: "currentColor",
|
|
875
|
+
"stroke-width": "1.75",
|
|
876
|
+
"stroke-linecap": "round",
|
|
877
|
+
"stroke-linejoin": "round"
|
|
878
|
+
}
|
|
879
|
+
),
|
|
880
|
+
/* @__PURE__ */ o(
|
|
881
|
+
"path",
|
|
882
|
+
{
|
|
883
|
+
d: "M8 4 4 8l4 4",
|
|
884
|
+
stroke: "currentColor",
|
|
885
|
+
"stroke-width": "1.75",
|
|
886
|
+
"stroke-linecap": "round",
|
|
887
|
+
"stroke-linejoin": "round"
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
] })
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
const Me = (t) => `pw-offer-${t}-start`;
|
|
895
|
+
function re(t) {
|
|
896
|
+
const e = t - Date.now();
|
|
897
|
+
return e <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
|
|
898
|
+
days: Math.floor(e / (1e3 * 60 * 60 * 24)),
|
|
899
|
+
hours: Math.floor(e % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
|
|
900
|
+
minutes: Math.floor(e % (1e3 * 60 * 60) / (1e3 * 60)),
|
|
901
|
+
seconds: Math.floor(e % (1e3 * 60) / 1e3),
|
|
902
|
+
expired: !1
|
|
458
903
|
};
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
904
|
+
}
|
|
905
|
+
function _t(t) {
|
|
906
|
+
if (t.expires_at) {
|
|
907
|
+
const e = Date.parse(t.expires_at);
|
|
908
|
+
return Number.isFinite(e) ? e : null;
|
|
909
|
+
}
|
|
910
|
+
if (t.duration_minutes && t.duration_minutes > 0) {
|
|
911
|
+
if (typeof window > "u") return null;
|
|
912
|
+
try {
|
|
913
|
+
const e = Me(t.id);
|
|
914
|
+
let r = window.localStorage.getItem(e);
|
|
915
|
+
return r || (r = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(e, r)), Date.parse(r) + t.duration_minutes * 6e4;
|
|
916
|
+
} catch {
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return null;
|
|
921
|
+
}
|
|
922
|
+
function Ee(t, e) {
|
|
923
|
+
if (!t || t.length === 0) return null;
|
|
924
|
+
if (e) {
|
|
925
|
+
const r = t.find((n) => n.id === e);
|
|
926
|
+
if (r) return r;
|
|
927
|
+
}
|
|
928
|
+
return t.find((r) => r.expires_at || r.duration_minutes) ?? null;
|
|
929
|
+
}
|
|
930
|
+
function Pe(t) {
|
|
931
|
+
const e = t ? _t(t) : null, [r, n] = x(
|
|
932
|
+
() => e !== null ? re(e) : null
|
|
933
|
+
), i = R(e);
|
|
934
|
+
return i.current = e, B(() => {
|
|
935
|
+
if (e === null) {
|
|
936
|
+
n(null);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
n(re(e));
|
|
940
|
+
const s = setInterval(() => {
|
|
941
|
+
const a = re(i.current ?? 0);
|
|
942
|
+
if (n(a), a.expired && (clearInterval(s), t?.duration_minutes && typeof window < "u"))
|
|
943
|
+
try {
|
|
944
|
+
window.localStorage.removeItem(Me(t.id));
|
|
945
|
+
} catch {
|
|
485
946
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
]
|
|
947
|
+
}, 1e3);
|
|
948
|
+
return () => clearInterval(s);
|
|
949
|
+
}, [e, t?.duration_minutes, t?.id]), r;
|
|
950
|
+
}
|
|
951
|
+
function St({ block: t, ctx: e }) {
|
|
952
|
+
const { t: r } = k(), n = Ee(e.bootstrap.offers, t.offer_id), i = Pe(n);
|
|
953
|
+
if (!n || i === null || i.expired && !t.force) return null;
|
|
954
|
+
const s = t.title ?? n.label ?? r("offer.limited_time", "Limited-time offer"), a = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
|
|
955
|
+
return /* @__PURE__ */ u(
|
|
956
|
+
"div",
|
|
957
|
+
{
|
|
958
|
+
class: "flex flex-wrap items-center justify-center gap-2 rounded-2xl px-4 py-3 text-[15px] font-semibold leading-tight text-white",
|
|
959
|
+
style: {
|
|
960
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
|
|
961
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
962
|
+
},
|
|
963
|
+
role: "status",
|
|
964
|
+
children: [
|
|
965
|
+
/* @__PURE__ */ o(Be, {}),
|
|
966
|
+
/* @__PURE__ */ o("span", { children: a }),
|
|
967
|
+
/* @__PURE__ */ o(Te, { value: i, t: r })
|
|
968
|
+
]
|
|
969
|
+
}
|
|
970
|
+
);
|
|
489
971
|
}
|
|
490
|
-
function
|
|
491
|
-
return /* @__PURE__ */ u("
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
|
|
972
|
+
function Te({ value: t, t: e }) {
|
|
973
|
+
return /* @__PURE__ */ u("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
|
|
974
|
+
t.days > 0 ? /* @__PURE__ */ u(se, { children: [
|
|
975
|
+
/* @__PURE__ */ o(H, { children: String(t.days) }),
|
|
976
|
+
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.d", "d") })
|
|
977
|
+
] }) : null,
|
|
978
|
+
/* @__PURE__ */ o(H, { children: String(t.hours).padStart(2, "0") }),
|
|
979
|
+
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.h", "h") }),
|
|
980
|
+
/* @__PURE__ */ o(H, { children: String(t.minutes).padStart(2, "0") }),
|
|
981
|
+
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.m", "m") }),
|
|
982
|
+
/* @__PURE__ */ o(H, { children: String(t.seconds).padStart(2, "0") }),
|
|
983
|
+
/* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.s", "s") })
|
|
494
984
|
] });
|
|
495
985
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
986
|
+
function H({ children: t }) {
|
|
987
|
+
return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: t });
|
|
988
|
+
}
|
|
989
|
+
function Ct({ offer: t }) {
|
|
990
|
+
const { t: e } = k(), r = Pe(t);
|
|
991
|
+
if (r === null || r.expired) return null;
|
|
992
|
+
const n = t.label ?? e("offer.limited_time", "Limited-time offer"), i = t.discount_percent ? `${n} ${t.discount_percent}%` : n;
|
|
993
|
+
return /* @__PURE__ */ u(
|
|
994
|
+
"div",
|
|
995
|
+
{
|
|
996
|
+
class: "-mb-2 flex flex-wrap items-center justify-center gap-2 rounded-t-xl px-4 pb-5 pt-3 text-[15px] font-semibold leading-tight text-white",
|
|
997
|
+
style: {
|
|
998
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
|
|
999
|
+
textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
|
|
1000
|
+
},
|
|
1001
|
+
role: "status",
|
|
1002
|
+
children: [
|
|
1003
|
+
/* @__PURE__ */ o(Be, {}),
|
|
1004
|
+
/* @__PURE__ */ o("span", { children: i }),
|
|
1005
|
+
/* @__PURE__ */ o(Te, { value: r, t: e })
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
function Be() {
|
|
1011
|
+
return /* @__PURE__ */ o(
|
|
1012
|
+
"svg",
|
|
1013
|
+
{
|
|
1014
|
+
width: "16",
|
|
1015
|
+
height: "16",
|
|
1016
|
+
viewBox: "0 0 12 12",
|
|
1017
|
+
fill: "none",
|
|
1018
|
+
"aria-hidden": "true",
|
|
1019
|
+
children: /* @__PURE__ */ o(
|
|
1020
|
+
"path",
|
|
1021
|
+
{
|
|
1022
|
+
fill: "currentColor",
|
|
1023
|
+
d: "m9.44 5.359-2.394-.895.61-3.036c.062-.31-.345-.531-.57-.291L2.434 6.105a.336.336 0 0 0 .126.537l2.395.894-.61 3.037c-.062.31.345.53.57.29l4.653-4.968a.336.336 0 0 0-.126-.536Z"
|
|
1024
|
+
}
|
|
1025
|
+
)
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
const ge = 3, me = 200, ye = 5e3, ne = 5, It = 10 * 1024 * 1024, xe = ["image/jpeg", "image/png", "image/webp"], At = /.+@.+\..+/;
|
|
1030
|
+
function Lt({ client: t, authSession: e, origin: r, onBack: n }) {
|
|
1031
|
+
const { t: i } = k(), s = e?.user.email ?? "", a = s || null, [c, l] = x(s), [f, h] = x(""), [d, b] = x(""), [w, v] = x([]), [p, y] = x(!1), [O, _] = x(null), [S, A] = x({}), D = () => {
|
|
1032
|
+
const P = {}, L = (a ?? c).trim(), N = f.trim(), q = d.trim();
|
|
1033
|
+
return L ? At.test(L.toLowerCase()) || (P.email = i("support.invalid_email", "Invalid email")) : P.email = i("support.required", "Required"), (N.length < ge || N.length > me) && (P.subject = i("support.subject_length", "{min}–{max} characters", {
|
|
1034
|
+
min: ge,
|
|
1035
|
+
max: me
|
|
1036
|
+
})), (q.length < 1 || q.length > ye) && (P.message = i("support.message_length", "{min}–{max} characters", {
|
|
1037
|
+
min: 1,
|
|
1038
|
+
max: ye
|
|
1039
|
+
})), A(P), Object.keys(P).length === 0;
|
|
1040
|
+
}, E = async (P) => {
|
|
1041
|
+
if (P.preventDefault(), !p && D()) {
|
|
1042
|
+
y(!0), A((L) => ({ ...L, submit: void 0 }));
|
|
507
1043
|
try {
|
|
508
|
-
const
|
|
509
|
-
await
|
|
510
|
-
subject:
|
|
511
|
-
content:
|
|
512
|
-
email:
|
|
513
|
-
files:
|
|
514
|
-
}),
|
|
515
|
-
} catch (
|
|
516
|
-
const
|
|
517
|
-
|
|
1044
|
+
const L = (a ?? c).trim();
|
|
1045
|
+
await t.createSupportTicket({
|
|
1046
|
+
subject: f.trim(),
|
|
1047
|
+
content: d.trim(),
|
|
1048
|
+
email: L || void 0,
|
|
1049
|
+
files: w.length > 0 ? w : void 0
|
|
1050
|
+
}), _(L);
|
|
1051
|
+
} catch (L) {
|
|
1052
|
+
const N = L instanceof T && L.message || "Failed to send. Please try again.";
|
|
1053
|
+
A((q) => ({ ...q, submit: N }));
|
|
518
1054
|
} finally {
|
|
519
|
-
|
|
1055
|
+
y(!1);
|
|
520
1056
|
}
|
|
521
1057
|
}
|
|
522
|
-
},
|
|
523
|
-
|
|
524
|
-
};
|
|
525
|
-
return
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
"
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
"
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
1058
|
+
}, U = () => {
|
|
1059
|
+
h(""), b(""), v([]), A({}), _(null);
|
|
1060
|
+
}, z = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", j = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
|
|
1061
|
+
return O ? /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
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
|
+
/* @__PURE__ */ o(
|
|
1064
|
+
"div",
|
|
1065
|
+
{
|
|
1066
|
+
class: "flex h-14 w-14 items-center justify-center rounded-full",
|
|
1067
|
+
style: {
|
|
1068
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
|
|
1069
|
+
color: "#fff",
|
|
1070
|
+
boxShadow: "0 0 0 8px color-mix(in srgb, var(--pw-accent) 12%, transparent), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 45%, transparent)"
|
|
1071
|
+
},
|
|
1072
|
+
"aria-hidden": "true",
|
|
1073
|
+
children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ o(
|
|
1074
|
+
"path",
|
|
1075
|
+
{
|
|
1076
|
+
fill: "currentColor",
|
|
1077
|
+
d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.93 8.2-6.85 9.29a1.01 1.01 0 0 1-1.43.19L5.76 13.77a1 1 0 1 1 1.25-1.56l4.08 3.26 6.23-8.45a1 1 0 1 1 1.61 1.18Z"
|
|
1078
|
+
}
|
|
1079
|
+
) })
|
|
1080
|
+
}
|
|
1081
|
+
),
|
|
1082
|
+
/* @__PURE__ */ o("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: i("support.success_heading", "Request submitted") }),
|
|
1083
|
+
/* @__PURE__ */ u("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
|
|
1084
|
+
i(
|
|
1085
|
+
"support.success_message_prefix",
|
|
1086
|
+
"We've received your message and will respond to"
|
|
1087
|
+
),
|
|
1088
|
+
" ",
|
|
1089
|
+
/* @__PURE__ */ o("b", { class: "text-gray-700", children: O }),
|
|
1090
|
+
"."
|
|
1091
|
+
] })
|
|
551
1092
|
] }),
|
|
552
|
-
/* @__PURE__ */ u("div", { class: "
|
|
1093
|
+
/* @__PURE__ */ o("div", { class: z, style: j, children: /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
553
1094
|
/* @__PURE__ */ o(
|
|
554
1095
|
"button",
|
|
555
1096
|
{
|
|
556
1097
|
type: "button",
|
|
557
1098
|
onClick: n,
|
|
558
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)]",
|
|
559
|
-
children:
|
|
1100
|
+
children: r === "standalone" ? i("support.done_button", "Done") : i("nav.back_aria", "Back")
|
|
560
1101
|
}
|
|
561
1102
|
),
|
|
562
1103
|
/* @__PURE__ */ o(
|
|
563
1104
|
"button",
|
|
564
1105
|
{
|
|
565
1106
|
type: "button",
|
|
566
|
-
onClick:
|
|
1107
|
+
onClick: U,
|
|
567
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)]",
|
|
568
1109
|
style: {
|
|
569
1110
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
570
1111
|
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
571
1112
|
},
|
|
572
|
-
children: "Send another request"
|
|
1113
|
+
children: i("support.send_another", "Send another request")
|
|
573
1114
|
}
|
|
574
1115
|
)
|
|
575
|
-
] })
|
|
576
|
-
] }) : /* @__PURE__ */ u("
|
|
577
|
-
/* @__PURE__ */ o(
|
|
578
|
-
|
|
579
|
-
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
),
|
|
628
|
-
/* @__PURE__ */ o(Ee, { files: f, onChange: m, disabled: y }),
|
|
629
|
-
S.submit && /* @__PURE__ */ o("p", { class: "text-xs text-red-600", children: S.submit }),
|
|
630
|
-
/* @__PURE__ */ u("div", { class: "mt-1 flex items-center justify-end gap-2", children: [
|
|
1116
|
+
] }) })
|
|
1117
|
+
] }) : /* @__PURE__ */ u("form", { onSubmit: E, class: "relative flex-1 min-h-0 flex flex-col", children: [
|
|
1118
|
+
/* @__PURE__ */ o(Mt, { onClick: n, ariaLabel: i("nav.back_aria", "Back") }),
|
|
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
|
+
/* @__PURE__ */ u("div", { class: "flex flex-col gap-2 pr-10", children: [
|
|
1121
|
+
/* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
|
|
1122
|
+
/* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: i("support.instruction", "Please fill out the form below to submit your support request.") })
|
|
1123
|
+
] }),
|
|
1124
|
+
/* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
|
|
1125
|
+
a ? /* @__PURE__ */ u("div", { class: "rounded-2xl bg-gray-100 px-5 py-3 text-sm text-gray-600", children: [
|
|
1126
|
+
i("support.sending_as", "Sending as"),
|
|
1127
|
+
" ",
|
|
1128
|
+
/* @__PURE__ */ o("b", { class: "font-medium text-gray-900", children: a })
|
|
1129
|
+
] }) : /* @__PURE__ */ o(
|
|
1130
|
+
be,
|
|
1131
|
+
{
|
|
1132
|
+
type: "email",
|
|
1133
|
+
placeholder: i("support.email_placeholder", "Enter your email *"),
|
|
1134
|
+
value: c,
|
|
1135
|
+
onInput: l,
|
|
1136
|
+
error: S.email,
|
|
1137
|
+
autocomplete: "email",
|
|
1138
|
+
required: !0
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
/* @__PURE__ */ o(
|
|
1142
|
+
be,
|
|
1143
|
+
{
|
|
1144
|
+
type: "text",
|
|
1145
|
+
placeholder: i("support.subject_placeholder", "Enter your subject *"),
|
|
1146
|
+
value: f,
|
|
1147
|
+
onInput: h,
|
|
1148
|
+
error: S.subject,
|
|
1149
|
+
required: !0
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
1152
|
+
/* @__PURE__ */ o(
|
|
1153
|
+
Et,
|
|
1154
|
+
{
|
|
1155
|
+
placeholder: i("support.message_placeholder", "Enter your message *"),
|
|
1156
|
+
value: d,
|
|
1157
|
+
onInput: b,
|
|
1158
|
+
error: S.message,
|
|
1159
|
+
required: !0
|
|
1160
|
+
}
|
|
1161
|
+
),
|
|
1162
|
+
/* @__PURE__ */ o(Pt, { files: w, onChange: v, disabled: p })
|
|
1163
|
+
] })
|
|
1164
|
+
] }) }),
|
|
1165
|
+
/* @__PURE__ */ u("div", { class: z, style: j, children: [
|
|
1166
|
+
S.submit && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: S.submit }),
|
|
1167
|
+
/* @__PURE__ */ u("div", { class: "flex items-center justify-end gap-3", children: [
|
|
631
1168
|
/* @__PURE__ */ o(
|
|
632
1169
|
"button",
|
|
633
1170
|
{
|
|
634
1171
|
type: "button",
|
|
635
1172
|
onClick: n,
|
|
636
|
-
disabled:
|
|
637
|
-
class: "rounded-
|
|
638
|
-
children:
|
|
1173
|
+
disabled: p,
|
|
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: r === "standalone" ? i("support.close_button", "Close") : i("nav.back_aria", "Back")
|
|
639
1176
|
}
|
|
640
1177
|
),
|
|
641
1178
|
/* @__PURE__ */ o(
|
|
642
1179
|
"button",
|
|
643
1180
|
{
|
|
644
1181
|
type: "submit",
|
|
645
|
-
disabled:
|
|
646
|
-
class: "flex h-
|
|
1182
|
+
disabled: p,
|
|
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)]",
|
|
647
1184
|
style: {
|
|
648
|
-
background: "linear-gradient(
|
|
649
|
-
boxShadow: "0
|
|
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
|
+
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)"
|
|
650
1187
|
},
|
|
651
|
-
children:
|
|
1188
|
+
children: p ? /* @__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") })
|
|
652
1189
|
}
|
|
653
1190
|
)
|
|
654
1191
|
] })
|
|
655
1192
|
] })
|
|
656
1193
|
] });
|
|
657
1194
|
}
|
|
658
|
-
function
|
|
659
|
-
return /* @__PURE__ */
|
|
660
|
-
|
|
1195
|
+
function Mt({ onClick: t, ariaLabel: e }) {
|
|
1196
|
+
return /* @__PURE__ */ o(
|
|
1197
|
+
"button",
|
|
1198
|
+
{
|
|
1199
|
+
type: "button",
|
|
1200
|
+
onClick: t,
|
|
1201
|
+
"aria-label": e,
|
|
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
|
+
children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1204
|
+
/* @__PURE__ */ o(
|
|
1205
|
+
"path",
|
|
1206
|
+
{
|
|
1207
|
+
d: "M5 8h8a4 4 0 0 1 0 8H9",
|
|
1208
|
+
stroke: "currentColor",
|
|
1209
|
+
"stroke-width": "1.75",
|
|
1210
|
+
"stroke-linecap": "round",
|
|
1211
|
+
"stroke-linejoin": "round"
|
|
1212
|
+
}
|
|
1213
|
+
),
|
|
1214
|
+
/* @__PURE__ */ o(
|
|
1215
|
+
"path",
|
|
1216
|
+
{
|
|
1217
|
+
d: "M8 4 4 8l4 4",
|
|
1218
|
+
stroke: "currentColor",
|
|
1219
|
+
"stroke-width": "1.75",
|
|
1220
|
+
"stroke-linecap": "round",
|
|
1221
|
+
"stroke-linejoin": "round"
|
|
1222
|
+
}
|
|
1223
|
+
)
|
|
1224
|
+
] })
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
function be({
|
|
1229
|
+
type: t,
|
|
1230
|
+
placeholder: e,
|
|
1231
|
+
value: r,
|
|
1232
|
+
onInput: n,
|
|
1233
|
+
error: i,
|
|
1234
|
+
autocomplete: s,
|
|
1235
|
+
required: a
|
|
1236
|
+
}) {
|
|
1237
|
+
return /* @__PURE__ */ u("div", { children: [
|
|
661
1238
|
/* @__PURE__ */ o(
|
|
662
1239
|
"input",
|
|
663
1240
|
{
|
|
664
|
-
type:
|
|
665
|
-
value:
|
|
666
|
-
|
|
1241
|
+
type: t,
|
|
1242
|
+
value: r,
|
|
1243
|
+
placeholder: e,
|
|
1244
|
+
onInput: (c) => n(c.target.value),
|
|
667
1245
|
autocomplete: s,
|
|
668
|
-
required:
|
|
669
|
-
class: `h-
|
|
1246
|
+
required: a,
|
|
1247
|
+
class: `h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${i ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
|
|
670
1248
|
}
|
|
671
1249
|
),
|
|
672
|
-
i && /* @__PURE__ */ o("span", { class: "text-
|
|
1250
|
+
i && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
|
|
673
1251
|
] });
|
|
674
1252
|
}
|
|
675
|
-
function
|
|
676
|
-
|
|
677
|
-
|
|
1253
|
+
function Et({
|
|
1254
|
+
placeholder: t,
|
|
1255
|
+
value: e,
|
|
1256
|
+
onInput: r,
|
|
1257
|
+
error: n,
|
|
1258
|
+
required: i
|
|
1259
|
+
}) {
|
|
1260
|
+
return /* @__PURE__ */ u("div", { children: [
|
|
678
1261
|
/* @__PURE__ */ o(
|
|
679
1262
|
"textarea",
|
|
680
1263
|
{
|
|
681
1264
|
value: e,
|
|
682
|
-
|
|
1265
|
+
placeholder: t,
|
|
1266
|
+
onInput: (s) => r(s.target.value),
|
|
683
1267
|
required: i,
|
|
684
|
-
rows:
|
|
685
|
-
class: `min-h-[
|
|
1268
|
+
rows: 5,
|
|
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)]"}`
|
|
686
1270
|
}
|
|
687
1271
|
),
|
|
688
|
-
n && /* @__PURE__ */ o("span", { class: "text-
|
|
1272
|
+
n && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
|
|
689
1273
|
] });
|
|
690
1274
|
}
|
|
691
|
-
function
|
|
692
|
-
const n =
|
|
693
|
-
if (!
|
|
694
|
-
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
697
|
-
|
|
1275
|
+
function Pt({ files: t, onChange: e, disabled: r }) {
|
|
1276
|
+
const { t: n } = k(), i = R(null), [s, a] = x(!1), [c, l] = x(null), f = (h) => {
|
|
1277
|
+
if (!h || r) return;
|
|
1278
|
+
l(null);
|
|
1279
|
+
const d = Array.from(h);
|
|
1280
|
+
if (t.length + d.length > ne) {
|
|
1281
|
+
l(n("support.too_many_files", "Up to {max} files", { max: ne }));
|
|
698
1282
|
return;
|
|
699
1283
|
}
|
|
700
|
-
const b =
|
|
701
|
-
(
|
|
1284
|
+
const b = d.filter(
|
|
1285
|
+
(w) => xe.includes(w.type) && w.size <= It
|
|
702
1286
|
);
|
|
703
|
-
if (b.length !==
|
|
704
|
-
|
|
1287
|
+
if (b.length !== d.length) {
|
|
1288
|
+
l(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
|
|
705
1289
|
return;
|
|
706
1290
|
}
|
|
707
|
-
e([...
|
|
1291
|
+
e([...t, ...b]);
|
|
708
1292
|
};
|
|
709
1293
|
return /* @__PURE__ */ u("div", { children: [
|
|
710
|
-
/* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: "Attachments (optional)" }),
|
|
1294
|
+
/* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: n("support.attachments_label", "Attachments (optional)") }),
|
|
711
1295
|
/* @__PURE__ */ u(
|
|
712
1296
|
"div",
|
|
713
1297
|
{
|
|
714
1298
|
role: "button",
|
|
715
1299
|
tabIndex: 0,
|
|
716
|
-
"aria-label": "Attachments upload",
|
|
717
|
-
onClick: () => !
|
|
718
|
-
onDragOver: (
|
|
719
|
-
|
|
1300
|
+
"aria-label": n("support.attachments_aria", "Attachments upload"),
|
|
1301
|
+
onClick: () => !r && i.current?.click(),
|
|
1302
|
+
onDragOver: (h) => {
|
|
1303
|
+
h.preventDefault(), r || a(!0);
|
|
720
1304
|
},
|
|
721
|
-
onDragLeave: () =>
|
|
722
|
-
onDrop: (
|
|
723
|
-
|
|
1305
|
+
onDragLeave: () => a(!1),
|
|
1306
|
+
onDrop: (h) => {
|
|
1307
|
+
h.preventDefault(), a(!1), f(h.dataTransfer?.files ?? null);
|
|
724
1308
|
},
|
|
725
|
-
class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${
|
|
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"} ${r ? "cursor-not-allowed opacity-60" : ""}`,
|
|
726
1310
|
children: [
|
|
727
|
-
/* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: "Drop images here or click to select" }),
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
" files, ≤ 10MB each"
|
|
732
|
-
] })
|
|
1311
|
+
/* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: n("support.dropzone_text", "Drop images here or click to select") }),
|
|
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: ne
|
|
1314
|
+
}) })
|
|
733
1315
|
]
|
|
734
1316
|
}
|
|
735
1317
|
),
|
|
736
1318
|
/* @__PURE__ */ o(
|
|
737
1319
|
"input",
|
|
738
1320
|
{
|
|
739
|
-
ref:
|
|
1321
|
+
ref: i,
|
|
740
1322
|
type: "file",
|
|
741
1323
|
multiple: !0,
|
|
742
|
-
accept:
|
|
1324
|
+
accept: xe.join(","),
|
|
743
1325
|
class: "hidden",
|
|
744
|
-
onChange: (
|
|
745
|
-
|
|
1326
|
+
onChange: (h) => {
|
|
1327
|
+
f(h.target.files), h.currentTarget.value = "";
|
|
746
1328
|
}
|
|
747
1329
|
}
|
|
748
1330
|
),
|
|
749
|
-
|
|
750
|
-
|
|
1331
|
+
c && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: c }),
|
|
1332
|
+
t.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: t.map((h, d) => /* @__PURE__ */ u(
|
|
751
1333
|
"li",
|
|
752
1334
|
{
|
|
753
1335
|
class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
|
|
754
1336
|
children: [
|
|
755
|
-
/* @__PURE__ */ o("span", { class: "truncate text-gray-700", children:
|
|
1337
|
+
/* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: h.name }),
|
|
756
1338
|
/* @__PURE__ */ o(
|
|
757
1339
|
"button",
|
|
758
1340
|
{
|
|
759
1341
|
type: "button",
|
|
760
1342
|
onClick: () => {
|
|
761
|
-
const b = [...
|
|
762
|
-
b.splice(
|
|
1343
|
+
const b = [...t];
|
|
1344
|
+
b.splice(d, 1), e(b);
|
|
763
1345
|
},
|
|
764
|
-
disabled:
|
|
1346
|
+
disabled: r,
|
|
765
1347
|
class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
|
|
766
|
-
"aria-label":
|
|
1348
|
+
"aria-label": n("support.remove_file_aria", "Remove {filename}", { filename: h.name }),
|
|
767
1349
|
children: "✕"
|
|
768
1350
|
}
|
|
769
1351
|
)
|
|
770
1352
|
]
|
|
771
1353
|
},
|
|
772
|
-
`${
|
|
1354
|
+
`${h.name}-${h.size}-${d}`
|
|
773
1355
|
)) })
|
|
774
1356
|
] });
|
|
775
1357
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
1358
|
+
const Tt = {
|
|
1359
|
+
day: "cta.get_plan_daily",
|
|
1360
|
+
week: "cta.get_plan_weekly",
|
|
1361
|
+
month: "cta.get_plan_monthly",
|
|
1362
|
+
year: "cta.get_plan_yearly"
|
|
1363
|
+
}, Bt = {
|
|
1364
|
+
day: "Get Daily Plan",
|
|
1365
|
+
week: "Get Weekly Plan",
|
|
1366
|
+
month: "Get Monthly Plan",
|
|
1367
|
+
year: "Get Yearly Plan"
|
|
1368
|
+
};
|
|
1369
|
+
function Ot(t, e, r, n) {
|
|
1370
|
+
if (e === "close") return n("cta.close", "Close");
|
|
1371
|
+
if (!t) return n("cta.continue", "Continue");
|
|
1372
|
+
if (!r && t.trial_days && t.interval && t.interval !== "lifetime")
|
|
1373
|
+
return n("cta.start_trial", "Start {days}-Day Free Trial", { days: t.trial_days });
|
|
1374
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1375
|
+
return n("cta.get_lifetime_access", "Get Lifetime Access");
|
|
1376
|
+
const i = Tt[t.interval];
|
|
1377
|
+
return i ? n(i, Bt[t.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
|
|
1378
|
+
interval: Ut(t.interval)
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
function Ut(t) {
|
|
1382
|
+
return t.length ? t[0].toUpperCase() + t.slice(1) : t;
|
|
1383
|
+
}
|
|
1384
|
+
function jt({ block: t, ctx: e }) {
|
|
1385
|
+
const { t: r } = k(), [n, i] = x(!1), s = t.priceId ?? e.selectedPriceId, a = n || t.action === "checkout" && !s, c = s ? e.bootstrap.prices.find((d) => d.id === s) ?? null : null, l = e.bootstrap.user?.had_previous_trial ?? !1, f = t.label ?? Ot(c, t.action, l, r);
|
|
1386
|
+
return /* @__PURE__ */ u(
|
|
779
1387
|
"button",
|
|
780
1388
|
{
|
|
781
1389
|
type: "button",
|
|
782
|
-
disabled:
|
|
1390
|
+
disabled: a,
|
|
783
1391
|
onClick: async () => {
|
|
784
|
-
if (!
|
|
785
|
-
|
|
1392
|
+
if (!a) {
|
|
1393
|
+
i(!0);
|
|
786
1394
|
try {
|
|
787
|
-
await e.onAction(
|
|
1395
|
+
await e.onAction(t.action, { priceId: s });
|
|
788
1396
|
} finally {
|
|
789
|
-
|
|
1397
|
+
i(!1);
|
|
790
1398
|
}
|
|
791
1399
|
}
|
|
792
1400
|
},
|
|
793
|
-
class: "relative flex h-12 w-full items-center justify-center overflow-hidden rounded-
|
|
1401
|
+
class: "pw-cta-shimmer relative 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)]",
|
|
794
1402
|
style: {
|
|
795
|
-
background: "linear-gradient(
|
|
796
|
-
boxShadow: "0
|
|
1403
|
+
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%)",
|
|
1404
|
+
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)"
|
|
797
1405
|
},
|
|
798
|
-
children:
|
|
1406
|
+
children: [
|
|
1407
|
+
/* @__PURE__ */ o(
|
|
1408
|
+
"span",
|
|
1409
|
+
{
|
|
1410
|
+
class: "absolute inset-0 opacity-40",
|
|
1411
|
+
style: {
|
|
1412
|
+
background: "radial-gradient(circle at 50% 0%, color-mix(in srgb, white 40%, transparent) 0%, transparent 70%)"
|
|
1413
|
+
},
|
|
1414
|
+
"aria-hidden": "true"
|
|
1415
|
+
}
|
|
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: f })
|
|
1418
|
+
]
|
|
799
1419
|
}
|
|
800
1420
|
);
|
|
801
1421
|
}
|
|
802
|
-
function
|
|
803
|
-
const e = r.authSession,
|
|
804
|
-
if (
|
|
805
|
-
const
|
|
806
|
-
if (!(!
|
|
807
|
-
|
|
1422
|
+
function Rt({ ctx: t }) {
|
|
1423
|
+
const { t: e } = k(), r = t.authSession, n = t.auth, [i, s] = x(!1), a = () => t.onAction("support");
|
|
1424
|
+
if (r && !r.user.is_anonymous) {
|
|
1425
|
+
const c = async () => {
|
|
1426
|
+
if (!(!n || i)) {
|
|
1427
|
+
s(!0);
|
|
808
1428
|
try {
|
|
809
|
-
await
|
|
1429
|
+
await n.signOut();
|
|
810
1430
|
} catch {
|
|
811
1431
|
} finally {
|
|
812
|
-
|
|
1432
|
+
s(!1);
|
|
813
1433
|
}
|
|
814
1434
|
}
|
|
815
1435
|
};
|
|
816
|
-
return /* @__PURE__ */ u("div", { class: "mt-
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
/* @__PURE__ */ o(
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
class: "font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",
|
|
827
|
-
children: n ? "Signing out…" : "Sign out"
|
|
828
|
-
}
|
|
829
|
-
),
|
|
830
|
-
/* @__PURE__ */ o(Q, {}),
|
|
831
|
-
/* @__PURE__ */ o(K, { onClick: s })
|
|
1436
|
+
return /* @__PURE__ */ u("div", { class: "-mt-3 flex flex-col items-center gap-1.5 pt-1 text-center text-[13px] text-gray-500", children: [
|
|
1437
|
+
/* @__PURE__ */ u("span", { children: [
|
|
1438
|
+
e("session.signed_in_as_prefix", "Signed in as"),
|
|
1439
|
+
" ",
|
|
1440
|
+
/* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: r.user.email })
|
|
1441
|
+
] }),
|
|
1442
|
+
/* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
|
|
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(we, {}),
|
|
1445
|
+
/* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
|
|
832
1446
|
] })
|
|
833
1447
|
] });
|
|
834
1448
|
}
|
|
835
|
-
return /* @__PURE__ */ u("div", { class: "mt-
|
|
836
|
-
/* @__PURE__ */ o(
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
type: "button",
|
|
840
|
-
onClick: () => r.onAction("restore"),
|
|
841
|
-
class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
|
|
842
|
-
children: "Restore purchases"
|
|
843
|
-
}
|
|
844
|
-
),
|
|
845
|
-
/* @__PURE__ */ o(Q, {}),
|
|
846
|
-
/* @__PURE__ */ o(K, { onClick: s })
|
|
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: () => t.onAction("restore"), children: e("session.restore_purchases", "Restore purchases") }),
|
|
1451
|
+
/* @__PURE__ */ o(we, {}),
|
|
1452
|
+
/* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
|
|
847
1453
|
] });
|
|
848
1454
|
}
|
|
849
|
-
function
|
|
1455
|
+
function G({
|
|
1456
|
+
onClick: t,
|
|
1457
|
+
disabled: e,
|
|
1458
|
+
children: r
|
|
1459
|
+
}) {
|
|
850
1460
|
return /* @__PURE__ */ o(
|
|
851
1461
|
"button",
|
|
852
1462
|
{
|
|
853
1463
|
type: "button",
|
|
854
|
-
onClick:
|
|
855
|
-
|
|
856
|
-
|
|
1464
|
+
onClick: t,
|
|
1465
|
+
disabled: e,
|
|
1466
|
+
class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
|
|
1467
|
+
style: { color: "var(--pw-accent)" },
|
|
1468
|
+
children: r
|
|
857
1469
|
}
|
|
858
1470
|
);
|
|
859
1471
|
}
|
|
860
|
-
function
|
|
1472
|
+
function we() {
|
|
861
1473
|
return /* @__PURE__ */ o("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
|
|
862
1474
|
}
|
|
863
|
-
function
|
|
864
|
-
return
|
|
1475
|
+
function Dt({ block: t }) {
|
|
1476
|
+
return t.items.length ? /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2.5", role: "list", children: t.items.map((e) => /* @__PURE__ */ u("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
|
|
865
1477
|
/* @__PURE__ */ o(
|
|
866
|
-
"
|
|
1478
|
+
"svg",
|
|
867
1479
|
{
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1480
|
+
width: "18",
|
|
1481
|
+
height: "18",
|
|
1482
|
+
viewBox: "0 0 20 20",
|
|
1483
|
+
fill: "none",
|
|
1484
|
+
class: "mt-0.5 flex-shrink-0 text-emerald-500",
|
|
873
1485
|
"aria-hidden": "true",
|
|
874
|
-
children: /* @__PURE__ */ o(
|
|
1486
|
+
children: /* @__PURE__ */ o(
|
|
875
1487
|
"path",
|
|
876
1488
|
{
|
|
877
|
-
d: "
|
|
1489
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
878
1490
|
stroke: "currentColor",
|
|
879
1491
|
"stroke-width": "2.5",
|
|
880
1492
|
"stroke-linecap": "round",
|
|
881
1493
|
"stroke-linejoin": "round"
|
|
882
1494
|
}
|
|
883
|
-
)
|
|
1495
|
+
)
|
|
884
1496
|
}
|
|
885
1497
|
),
|
|
886
1498
|
/* @__PURE__ */ u("div", { class: "flex flex-col gap-0.5", children: [
|
|
887
1499
|
/* @__PURE__ */ o("span", { class: "font-medium leading-snug text-gray-900", children: e.name }),
|
|
888
|
-
e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-
|
|
1500
|
+
e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-400", children: e.desc }) : null
|
|
889
1501
|
] })
|
|
890
1502
|
] }, e.id)) }) : null;
|
|
891
1503
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1504
|
+
function zt({ block: t }) {
|
|
1505
|
+
const { t: e } = k(), r = t.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = t.subtitle, i = (t.icon ?? "dollar_shield") !== "none", s = Nt(r);
|
|
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
|
+
/* @__PURE__ */ u("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
|
|
1508
|
+
i ? /* @__PURE__ */ o(qt, {}) : null,
|
|
1509
|
+
s ? /* @__PURE__ */ u("span", { children: [
|
|
1510
|
+
/* @__PURE__ */ o("b", { class: "font-bold text-gray-900", children: s.bold }),
|
|
1511
|
+
" ",
|
|
1512
|
+
/* @__PURE__ */ o("span", { class: "font-medium", children: s.rest })
|
|
1513
|
+
] }) : /* @__PURE__ */ o("span", { class: "font-medium", children: r })
|
|
1514
|
+
] }),
|
|
1515
|
+
n ? /* @__PURE__ */ o("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
|
|
1516
|
+
] });
|
|
1517
|
+
}
|
|
1518
|
+
function Nt(t) {
|
|
1519
|
+
const e = t.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
|
|
1520
|
+
return e ? { bold: e[1], rest: e[2] } : null;
|
|
1521
|
+
}
|
|
1522
|
+
function qt() {
|
|
1523
|
+
return /* @__PURE__ */ u(
|
|
1524
|
+
"svg",
|
|
1525
|
+
{
|
|
1526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1527
|
+
viewBox: "0 0 24 24",
|
|
1528
|
+
fill: "none",
|
|
1529
|
+
width: "16",
|
|
1530
|
+
height: "16",
|
|
1531
|
+
class: "flex-shrink-0 text-emerald-500",
|
|
1532
|
+
"aria-hidden": "true",
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ o(
|
|
1535
|
+
"path",
|
|
1536
|
+
{
|
|
1537
|
+
d: "M12 2 4 5v6c0 5.25 3.5 9.5 8 11 4.5-1.5 8-5.75 8-11V5l-8-3Z",
|
|
1538
|
+
stroke: "currentColor",
|
|
1539
|
+
"stroke-width": "2",
|
|
1540
|
+
"stroke-linejoin": "round"
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
/* @__PURE__ */ o(
|
|
1544
|
+
"path",
|
|
1545
|
+
{
|
|
1546
|
+
d: "m9 12 2 2 4-4",
|
|
1547
|
+
stroke: "currentColor",
|
|
1548
|
+
"stroke-width": "2",
|
|
1549
|
+
"stroke-linecap": "round",
|
|
1550
|
+
"stroke-linejoin": "round"
|
|
1551
|
+
}
|
|
1552
|
+
)
|
|
1553
|
+
]
|
|
1554
|
+
}
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
const Oe = 24, Ft = 16, $t = 2;
|
|
1558
|
+
function Vt(t, e) {
|
|
1559
|
+
const r = e * $t;
|
|
1560
|
+
let n = Oe;
|
|
1561
|
+
for (t.style.fontSize = `${n}px`; t.scrollHeight > r && n > Ft; )
|
|
1562
|
+
n -= 1, t.style.fontSize = `${n}px`;
|
|
1563
|
+
}
|
|
1564
|
+
function Ht({ block: t, ctx: e }) {
|
|
1565
|
+
const r = t.level ?? 1, n = `h${r}`, i = r === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : r === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = R(null), a = r === 1 && !!e.bootstrap.settings.title_auto_fit;
|
|
1566
|
+
return B(() => {
|
|
1567
|
+
if (!a || !s.current) return;
|
|
1568
|
+
const c = getComputedStyle(s.current), l = parseFloat(c.lineHeight) || Oe * 1.5;
|
|
1569
|
+
Vt(s.current, l);
|
|
1570
|
+
}, [a, t.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: t.text });
|
|
1571
|
+
}
|
|
1572
|
+
function Gt(t) {
|
|
1573
|
+
const e = t.local ?? { currency: t.currency, amount: t.amount };
|
|
1574
|
+
if (t.interval === "year") {
|
|
1575
|
+
const r = (t.interval_count ?? 1) * 12;
|
|
1576
|
+
return { amount: e.amount / r, currency: e.currency };
|
|
1577
|
+
}
|
|
1578
|
+
return { amount: e.amount, currency: e.currency };
|
|
1579
|
+
}
|
|
1580
|
+
function ie(t, e) {
|
|
1581
|
+
const r = t % 1 !== 0 ? 2 : 0;
|
|
909
1582
|
try {
|
|
910
|
-
|
|
1583
|
+
const n = new Intl.NumberFormat(void 0, {
|
|
911
1584
|
style: "currency",
|
|
912
|
-
currency: e
|
|
913
|
-
|
|
914
|
-
|
|
1585
|
+
currency: e,
|
|
1586
|
+
currencyDisplay: "narrowSymbol",
|
|
1587
|
+
maximumFractionDigits: r,
|
|
1588
|
+
minimumFractionDigits: r
|
|
1589
|
+
}).formatToParts(t);
|
|
1590
|
+
let i = "", s = "";
|
|
1591
|
+
for (const a of n)
|
|
1592
|
+
a.type === "currency" ? i = a.value : a.type !== "literal" && (s += a.value);
|
|
1593
|
+
return { currency: i || e, amount: s.trim() };
|
|
915
1594
|
} catch {
|
|
916
|
-
return
|
|
1595
|
+
return { currency: e, amount: String(t) };
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
function ae(t, e) {
|
|
1599
|
+
const { amount: r, currency: n } = Gt(t);
|
|
1600
|
+
if (!e) {
|
|
1601
|
+
const { currency: c, amount: l } = ie(r, n);
|
|
1602
|
+
return { currency: c, amount: l, originalAmount: null };
|
|
917
1603
|
}
|
|
1604
|
+
const i = r * (1 - e / 100), s = ie(i, n), a = ie(r, n);
|
|
1605
|
+
return {
|
|
1606
|
+
currency: s.currency,
|
|
1607
|
+
amount: s.amount,
|
|
1608
|
+
originalAmount: `${a.currency}${a.amount}`
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
function Ue(t, e) {
|
|
1612
|
+
if (t.label) return t.label.toUpperCase();
|
|
1613
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1614
|
+
return e("pricing.plan_label.lifetime", "LIFETIME");
|
|
1615
|
+
const n = {
|
|
1616
|
+
day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
|
|
1617
|
+
week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
|
|
1618
|
+
month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
|
|
1619
|
+
year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
|
|
1620
|
+
}[t.interval];
|
|
1621
|
+
return n ? e(n.key, n.fallback) : `${t.interval.toUpperCase()} PLAN`;
|
|
918
1622
|
}
|
|
919
|
-
function
|
|
920
|
-
if (!
|
|
921
|
-
|
|
922
|
-
|
|
1623
|
+
function le(t, e) {
|
|
1624
|
+
if (!t.interval || t.interval === "lifetime")
|
|
1625
|
+
return e("pricing.interval.lifetime_short", "lifetime");
|
|
1626
|
+
if (t.interval === "year") return e("pricing.interval.month", "month");
|
|
1627
|
+
const r = t.interval_count ?? 1;
|
|
1628
|
+
return r === 1 ? e(`pricing.interval.${t.interval}`, t.interval) : `${r} ${t.interval}s`;
|
|
923
1629
|
}
|
|
924
|
-
function
|
|
925
|
-
const t =
|
|
926
|
-
if (
|
|
927
|
-
return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: "No prices available." });
|
|
928
|
-
const
|
|
1630
|
+
function Wt({ block: t, ctx: e }) {
|
|
1631
|
+
const { t: r } = k(), n = t.priceIds && t.priceIds.length > 0 ? new Set(t.priceIds) : null, i = e.bootstrap.prices.filter((a) => !n || n.has(a.id));
|
|
1632
|
+
if (i.length === 0)
|
|
1633
|
+
return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: r("pricing.no_prices", "No prices available.") });
|
|
1634
|
+
const s = t.popular_label ?? r("pricing.most_popular", "Most popular");
|
|
1635
|
+
if (t.view === "compact")
|
|
1636
|
+
return /* @__PURE__ */ o(
|
|
1637
|
+
"div",
|
|
1638
|
+
{
|
|
1639
|
+
class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
|
|
1640
|
+
role: "radiogroup",
|
|
1641
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1642
|
+
children: i.map((a, c) => /* @__PURE__ */ o(
|
|
1643
|
+
Yt,
|
|
1644
|
+
{
|
|
1645
|
+
price: a,
|
|
1646
|
+
isLast: c === i.length - 1,
|
|
1647
|
+
isPopular: t.popular_price_id === a.id,
|
|
1648
|
+
popularLabel: s,
|
|
1649
|
+
offer: $(e.bootstrap.offers, a.id),
|
|
1650
|
+
selected: e.selectedPriceId === a.id,
|
|
1651
|
+
onSelect: () => {
|
|
1652
|
+
e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
|
|
1653
|
+
},
|
|
1654
|
+
t: r
|
|
1655
|
+
},
|
|
1656
|
+
a.id
|
|
1657
|
+
))
|
|
1658
|
+
}
|
|
1659
|
+
);
|
|
1660
|
+
if (t.view === "horizontal") {
|
|
1661
|
+
const a = Math.min(i.length, 3), c = i.some(
|
|
1662
|
+
(l) => ($(e.bootstrap.offers, l.id)?.discount_percent ?? 0) > 0
|
|
1663
|
+
);
|
|
1664
|
+
return /* @__PURE__ */ o(
|
|
1665
|
+
"div",
|
|
1666
|
+
{
|
|
1667
|
+
class: "grid items-stretch gap-2",
|
|
1668
|
+
style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` },
|
|
1669
|
+
role: "radiogroup",
|
|
1670
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1671
|
+
children: i.map((l) => /* @__PURE__ */ o(
|
|
1672
|
+
Kt,
|
|
1673
|
+
{
|
|
1674
|
+
price: l,
|
|
1675
|
+
isPopular: t.popular_price_id === l.id,
|
|
1676
|
+
popularLabel: s,
|
|
1677
|
+
offer: $(e.bootstrap.offers, l.id),
|
|
1678
|
+
reserveStrikeRow: c,
|
|
1679
|
+
selected: e.selectedPriceId === l.id,
|
|
1680
|
+
onSelect: () => {
|
|
1681
|
+
e.setSelectedPriceId(l.id), e.onAction("price_selected", { priceId: l.id, price: l });
|
|
1682
|
+
},
|
|
1683
|
+
t: r
|
|
1684
|
+
},
|
|
1685
|
+
l.id
|
|
1686
|
+
))
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
929
1690
|
return /* @__PURE__ */ o(
|
|
930
1691
|
"div",
|
|
931
1692
|
{
|
|
932
|
-
class:
|
|
933
|
-
style: i ? { gridTemplateColumns: `repeat(${l}, minmax(0, 1fr))` } : void 0,
|
|
1693
|
+
class: "flex flex-col gap-2",
|
|
934
1694
|
role: "radiogroup",
|
|
935
|
-
"aria-label": "Plans",
|
|
936
|
-
children:
|
|
937
|
-
const c = e.selectedPriceId === a.id,
|
|
1695
|
+
"aria-label": r("pricing.plans_aria", "Plans"),
|
|
1696
|
+
children: i.map((a) => {
|
|
1697
|
+
const c = e.selectedPriceId === a.id, l = t.popular_price_id === a.id, h = $(e.bootstrap.offers, a.id)?.discount_percent ?? null, { currency: d, amount: b, originalAmount: w } = ae(a, h);
|
|
938
1698
|
return /* @__PURE__ */ u(
|
|
939
1699
|
"button",
|
|
940
1700
|
{
|
|
@@ -945,47 +1705,87 @@ function ze({ block: r, ctx: e }) {
|
|
|
945
1705
|
e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
|
|
946
1706
|
},
|
|
947
1707
|
class: [
|
|
948
|
-
"group relative rounded-2xl border px-4 py-3.5 text-left transition-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1708
|
+
"group relative inline-flex w-full mx-auto items-center justify-between flex-row-reverse gap-4 rounded-2xl border-2 px-4 py-3.5 text-left transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1709
|
+
// Везде border 2px — selection выражается только цветом, layout
|
|
1710
|
+
// не прыгает (равная толщина у selected/unselected). Цветовая
|
|
1711
|
+
// разница accent vs gray достаточно сильная для visual hierarchy.
|
|
1712
|
+
c ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
|
|
952
1713
|
].join(" "),
|
|
953
1714
|
children: [
|
|
954
|
-
|
|
1715
|
+
/* @__PURE__ */ o(
|
|
955
1716
|
"span",
|
|
956
1717
|
{
|
|
957
|
-
class:
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1718
|
+
class: [
|
|
1719
|
+
"flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
1720
|
+
c ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
|
|
1721
|
+
// Popular-label badge сидит absolute сверху-справа карточки и
|
|
1722
|
+
// визуально сдвигает центр content'а вниз. flex items-center
|
|
1723
|
+
// на карточке держит галочку по геометрическому центру, что
|
|
1724
|
+
// делает её визуально выше — компенсируем небольшим mt'ом.
|
|
1725
|
+
l ? "mt-3" : ""
|
|
1726
|
+
].join(" "),
|
|
1727
|
+
style: c ? {
|
|
1728
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
|
|
1729
|
+
} : void 0,
|
|
1730
|
+
"aria-hidden": "true",
|
|
1731
|
+
children: /* @__PURE__ */ o(
|
|
1732
|
+
"svg",
|
|
1733
|
+
{
|
|
1734
|
+
width: "14",
|
|
1735
|
+
height: "10",
|
|
1736
|
+
viewBox: "0 0 17 12",
|
|
1737
|
+
fill: "none",
|
|
1738
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1739
|
+
class: c ? "opacity-100" : "opacity-0",
|
|
1740
|
+
children: /* @__PURE__ */ o(
|
|
1741
|
+
"path",
|
|
1742
|
+
{
|
|
1743
|
+
d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
|
|
1744
|
+
fill: "currentColor"
|
|
1745
|
+
}
|
|
1746
|
+
)
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
962
1749
|
}
|
|
963
|
-
)
|
|
964
|
-
/* @__PURE__ */ u("div", { class:
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
"span",
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
].
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
]
|
|
1750
|
+
),
|
|
1751
|
+
/* @__PURE__ */ u("div", { class: "flex flex-1 flex-col gap-0.5", children: [
|
|
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: Ue(a, r) }),
|
|
1754
|
+
w ? (
|
|
1755
|
+
// opacity-60 приглушает strike: глаз сначала ловит label
|
|
1756
|
+
// и discount-badge, потом main price; original «бывшая цена»
|
|
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: w })
|
|
1759
|
+
) : null,
|
|
1760
|
+
h ? (
|
|
1761
|
+
// Emerald pill — фиксированный «успех/выгода», не зависит от
|
|
1762
|
+
// brand_color. Читается даже на тёмных бренд-акцентах.
|
|
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
|
+
"-",
|
|
1765
|
+
h,
|
|
1766
|
+
"%"
|
|
1767
|
+
] })
|
|
1768
|
+
) : null
|
|
1769
|
+
] }),
|
|
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: d }),
|
|
1772
|
+
b,
|
|
1773
|
+
/* @__PURE__ */ u("span", { class: "text-sm font-normal text-gray-500", children: [
|
|
1774
|
+
" ",
|
|
1775
|
+
"/ ",
|
|
1776
|
+
le(a, r)
|
|
1777
|
+
] })
|
|
1778
|
+
] }) }),
|
|
1779
|
+
a.description ? /* @__PURE__ */ o("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: a.description }) : null
|
|
984
1780
|
] }),
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1781
|
+
l ? /* @__PURE__ */ o(
|
|
1782
|
+
"span",
|
|
1783
|
+
{
|
|
1784
|
+
class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
|
|
1785
|
+
style: { background: "var(--pw-accent)" },
|
|
1786
|
+
children: s
|
|
1787
|
+
}
|
|
1788
|
+
) : null
|
|
989
1789
|
]
|
|
990
1790
|
},
|
|
991
1791
|
a.id
|
|
@@ -994,381 +1794,585 @@ function ze({ block: r, ctx: e }) {
|
|
|
994
1794
|
}
|
|
995
1795
|
);
|
|
996
1796
|
}
|
|
997
|
-
function
|
|
998
|
-
return
|
|
1797
|
+
function Zt(t, e) {
|
|
1798
|
+
return t.label ? t.label : !t.interval || t.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${t.interval}`, t.interval);
|
|
1799
|
+
}
|
|
1800
|
+
function Yt({
|
|
1801
|
+
price: t,
|
|
1802
|
+
isLast: e,
|
|
1803
|
+
isPopular: r,
|
|
1804
|
+
popularLabel: n,
|
|
1805
|
+
offer: i,
|
|
1806
|
+
selected: s,
|
|
1807
|
+
onSelect: a,
|
|
1808
|
+
t: c
|
|
1809
|
+
}) {
|
|
1810
|
+
const l = i?.discount_percent ?? null, { currency: f, amount: h, originalAmount: d } = ae(t, l);
|
|
1811
|
+
return /* @__PURE__ */ u(
|
|
1812
|
+
"button",
|
|
1813
|
+
{
|
|
1814
|
+
type: "button",
|
|
1815
|
+
role: "radio",
|
|
1816
|
+
"aria-checked": s,
|
|
1817
|
+
onClick: a,
|
|
1818
|
+
class: "group relative inline-flex w-full max-w-[360px] mx-auto items-center justify-between gap-4 px-4 pt-3.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--pw-accent)]",
|
|
1819
|
+
children: [
|
|
1820
|
+
/* @__PURE__ */ o(
|
|
1821
|
+
"span",
|
|
1822
|
+
{
|
|
1823
|
+
class: [
|
|
1824
|
+
"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border transition-colors mb-3",
|
|
1825
|
+
s ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent"
|
|
1826
|
+
].join(" "),
|
|
1827
|
+
style: s ? {
|
|
1828
|
+
background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
|
|
1829
|
+
} : void 0,
|
|
1830
|
+
"aria-hidden": "true",
|
|
1831
|
+
children: /* @__PURE__ */ o(
|
|
1832
|
+
"svg",
|
|
1833
|
+
{
|
|
1834
|
+
width: "14",
|
|
1835
|
+
height: "10",
|
|
1836
|
+
viewBox: "0 0 17 12",
|
|
1837
|
+
fill: "none",
|
|
1838
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1839
|
+
class: s ? "opacity-100" : "opacity-0",
|
|
1840
|
+
children: /* @__PURE__ */ o(
|
|
1841
|
+
"path",
|
|
1842
|
+
{
|
|
1843
|
+
d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
|
|
1844
|
+
fill: "currentColor"
|
|
1845
|
+
}
|
|
1846
|
+
)
|
|
1847
|
+
}
|
|
1848
|
+
)
|
|
1849
|
+
}
|
|
1850
|
+
),
|
|
1851
|
+
/* @__PURE__ */ u(
|
|
1852
|
+
"div",
|
|
1853
|
+
{
|
|
1854
|
+
class: [
|
|
1855
|
+
"flex flex-1 items-center gap-1.5 pb-3.5",
|
|
1856
|
+
e ? "" : "border-b border-gray-200"
|
|
1857
|
+
].join(" "),
|
|
1858
|
+
children: [
|
|
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: Zt(t, c) }),
|
|
1861
|
+
r ? (
|
|
1862
|
+
// Pastel brand-mix pill — точно как `badge` в TelegramPricingRadio.
|
|
1863
|
+
// Низкий visual weight: pill про "имя плана" (most popular), а не
|
|
1864
|
+
// про savings — не должна конкурировать с -X% discount-pill.
|
|
1865
|
+
/* @__PURE__ */ o(
|
|
1866
|
+
"span",
|
|
1867
|
+
{
|
|
1868
|
+
class: "rounded-[9px] px-2 py-1 text-[10px] font-bold",
|
|
1869
|
+
style: {
|
|
1870
|
+
background: "linear-gradient(160deg, color-mix(in srgb, var(--pw-accent) 6%, white) 0%, color-mix(in srgb, var(--pw-accent) 15%, white) 100%)",
|
|
1871
|
+
color: "var(--pw-accent)"
|
|
1872
|
+
},
|
|
1873
|
+
children: n
|
|
1874
|
+
}
|
|
1875
|
+
)
|
|
1876
|
+
) : null,
|
|
1877
|
+
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: [
|
|
1878
|
+
"-",
|
|
1879
|
+
l,
|
|
1880
|
+
"%"
|
|
1881
|
+
] }) : null
|
|
1882
|
+
] }),
|
|
1883
|
+
/* @__PURE__ */ o("div", { class: "flex-1" }),
|
|
1884
|
+
/* @__PURE__ */ u("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
|
|
1885
|
+
d ? /* @__PURE__ */ o("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: d }) : null,
|
|
1886
|
+
/* @__PURE__ */ u("span", { class: "whitespace-nowrap", children: [
|
|
1887
|
+
/* @__PURE__ */ o("span", { class: "opacity-90", children: f }),
|
|
1888
|
+
h,
|
|
1889
|
+
/* @__PURE__ */ u("span", { class: "text-xs text-gray-400", children: [
|
|
1890
|
+
" ",
|
|
1891
|
+
"/ ",
|
|
1892
|
+
le(t, c)
|
|
1893
|
+
] })
|
|
1894
|
+
] })
|
|
1895
|
+
] })
|
|
1896
|
+
]
|
|
1897
|
+
}
|
|
1898
|
+
)
|
|
1899
|
+
]
|
|
1900
|
+
}
|
|
1901
|
+
);
|
|
1902
|
+
}
|
|
1903
|
+
function Kt({
|
|
1904
|
+
price: t,
|
|
1905
|
+
isPopular: e,
|
|
1906
|
+
popularLabel: r,
|
|
1907
|
+
offer: n,
|
|
1908
|
+
reserveStrikeRow: i,
|
|
1909
|
+
selected: s,
|
|
1910
|
+
onSelect: a,
|
|
1911
|
+
t: c
|
|
1912
|
+
}) {
|
|
1913
|
+
const l = n?.discount_percent ?? null, { currency: f, amount: h, originalAmount: d } = ae(t, l);
|
|
1914
|
+
return /* @__PURE__ */ u(
|
|
1915
|
+
"button",
|
|
1916
|
+
{
|
|
1917
|
+
type: "button",
|
|
1918
|
+
role: "radio",
|
|
1919
|
+
"aria-checked": s,
|
|
1920
|
+
onClick: a,
|
|
1921
|
+
class: [
|
|
1922
|
+
"group relative flex h-full flex-col items-center justify-start gap-1 rounded-2xl border-2 px-3 pb-4 pt-3.5 text-center transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1923
|
+
s ? "border-[var(--pw-accent)]" : "border-gray-200 hover:bg-gray-50"
|
|
1924
|
+
].join(" "),
|
|
1925
|
+
style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
|
|
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: Ue(t, c) }),
|
|
1928
|
+
i ? /* @__PURE__ */ u("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
|
|
1929
|
+
d ? /* @__PURE__ */ o("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: d }) : null,
|
|
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
|
+
"-",
|
|
1932
|
+
l,
|
|
1933
|
+
"%"
|
|
1934
|
+
] }) : null
|
|
1935
|
+
] }) : null,
|
|
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: f }),
|
|
1938
|
+
h
|
|
1939
|
+
] }),
|
|
1940
|
+
/* @__PURE__ */ u("span", { class: "text-xs font-normal text-gray-500", children: [
|
|
1941
|
+
"/ ",
|
|
1942
|
+
le(t, c)
|
|
1943
|
+
] }),
|
|
1944
|
+
e ? /* @__PURE__ */ o(
|
|
1945
|
+
"span",
|
|
1946
|
+
{
|
|
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
|
+
style: { background: "var(--pw-accent)" },
|
|
1949
|
+
children: r
|
|
1950
|
+
}
|
|
1951
|
+
) : null
|
|
1952
|
+
]
|
|
1953
|
+
}
|
|
1954
|
+
);
|
|
1955
|
+
}
|
|
1956
|
+
function Xt({ block: t }) {
|
|
1957
|
+
return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: t.text });
|
|
999
1958
|
}
|
|
1000
|
-
const
|
|
1959
|
+
const Jt = {
|
|
1001
1960
|
week: 0.25,
|
|
1002
1961
|
month: 1,
|
|
1003
1962
|
year: 12
|
|
1004
1963
|
};
|
|
1005
|
-
function
|
|
1006
|
-
return
|
|
1964
|
+
function Qt(t, e) {
|
|
1965
|
+
return t ? e(`pricing.interval.${t}`, t) : e("pricing.interval.period", "period");
|
|
1007
1966
|
}
|
|
1008
|
-
function
|
|
1009
|
-
|
|
1010
|
-
|
|
1967
|
+
function er({ block: t, ctx: e }) {
|
|
1968
|
+
const { t: r } = k();
|
|
1969
|
+
if (!t.queries.length) return null;
|
|
1970
|
+
const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ? Jt[i] : void 0;
|
|
1011
1971
|
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
const l = Number.isFinite(s.count) ? s.count : 0, a = i !== void 0 ? Math.round(l * i) : l;
|
|
1019
|
-
return /* @__PURE__ */ u("li", { class: `flex gap-2 ${s.desc ? "" : "items-center"}`, children: [
|
|
1972
|
+
/* @__PURE__ */ o("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ? r("pricing.included_total", "Included for lifetime:") : r("pricing.included_per", "Included per {interval}:", {
|
|
1973
|
+
interval: Qt(i, r)
|
|
1974
|
+
}) }),
|
|
1975
|
+
/* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: t.queries.map((a) => {
|
|
1976
|
+
const c = Number.isFinite(a.count) ? a.count : 0, l = s !== void 0 ? Math.round(c * s) : c;
|
|
1977
|
+
return /* @__PURE__ */ u("li", { class: `flex gap-3 ${a.desc ? "items-start" : "items-center"}`, children: [
|
|
1020
1978
|
/* @__PURE__ */ o(
|
|
1021
|
-
"
|
|
1979
|
+
"svg",
|
|
1022
1980
|
{
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}
|
|
1981
|
+
width: "18",
|
|
1982
|
+
height: "18",
|
|
1983
|
+
viewBox: "0 0 20 20",
|
|
1984
|
+
fill: "none",
|
|
1985
|
+
class: `flex-shrink-0 text-emerald-500 ${a.desc ? "mt-0.5" : ""}`,
|
|
1028
1986
|
"aria-hidden": "true",
|
|
1029
|
-
children: /* @__PURE__ */ o(
|
|
1987
|
+
children: /* @__PURE__ */ o(
|
|
1030
1988
|
"path",
|
|
1031
1989
|
{
|
|
1032
|
-
d: "
|
|
1990
|
+
d: "M4 10.5l3.5 3.5 8.5-8.5",
|
|
1033
1991
|
stroke: "currentColor",
|
|
1034
1992
|
"stroke-width": "2.5",
|
|
1035
1993
|
"stroke-linecap": "round",
|
|
1036
1994
|
"stroke-linejoin": "round"
|
|
1037
1995
|
}
|
|
1038
|
-
)
|
|
1996
|
+
)
|
|
1039
1997
|
}
|
|
1040
1998
|
),
|
|
1041
1999
|
/* @__PURE__ */ u("div", { children: [
|
|
1042
|
-
/* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children:
|
|
2000
|
+
/* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: l }),
|
|
1043
2001
|
" ",
|
|
1044
|
-
/* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children:
|
|
1045
|
-
|
|
2002
|
+
/* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: a.name }),
|
|
2003
|
+
a.desc ? /* @__PURE__ */ u(se, { children: [
|
|
1046
2004
|
/* @__PURE__ */ o("br", {}),
|
|
1047
|
-
/* @__PURE__ */ o("span", { class: "text-xs text-gray-
|
|
2005
|
+
/* @__PURE__ */ o("span", { class: "text-xs text-gray-400", children: a.desc })
|
|
1048
2006
|
] }) : null
|
|
1049
2007
|
] })
|
|
1050
|
-
] },
|
|
2008
|
+
] }, a.id);
|
|
1051
2009
|
}) })
|
|
1052
2010
|
] });
|
|
1053
2011
|
}
|
|
1054
|
-
const
|
|
1055
|
-
heading:
|
|
1056
|
-
text:
|
|
1057
|
-
price_grid:
|
|
1058
|
-
cta_button:
|
|
1059
|
-
auth_panel:
|
|
1060
|
-
current_session:
|
|
1061
|
-
features_list:
|
|
1062
|
-
tokenization_gate:
|
|
2012
|
+
const tr = {
|
|
2013
|
+
heading: Ht,
|
|
2014
|
+
text: Xt,
|
|
2015
|
+
price_grid: Wt,
|
|
2016
|
+
cta_button: jt,
|
|
2017
|
+
auth_panel: Le,
|
|
2018
|
+
current_session: Rt,
|
|
2019
|
+
features_list: Dt,
|
|
2020
|
+
tokenization_gate: er,
|
|
2021
|
+
guarantee_badge: zt,
|
|
2022
|
+
offer_banner: St
|
|
1063
2023
|
};
|
|
1064
|
-
function
|
|
1065
|
-
const
|
|
2024
|
+
function rr({ layout: t, bootstrap: e, onAction: r, auth: n, authSession: i, hasTopBanner: s }) {
|
|
2025
|
+
const a = Ve(() => {
|
|
2026
|
+
for (const v of t.blocks)
|
|
2027
|
+
if (v.type === "price_grid" && v.popular_price_id && e.prices.some((p) => p.id === v.popular_price_id))
|
|
2028
|
+
return v.popular_price_id;
|
|
2029
|
+
return e.prices[0]?.id ?? null;
|
|
2030
|
+
}, [t.blocks, e.prices]), [c, l] = x(a), f = {
|
|
1066
2031
|
bootstrap: e,
|
|
1067
|
-
selectedPriceId:
|
|
1068
|
-
setSelectedPriceId:
|
|
1069
|
-
onAction:
|
|
2032
|
+
selectedPriceId: c,
|
|
2033
|
+
setSelectedPriceId: l,
|
|
2034
|
+
onAction: r,
|
|
1070
2035
|
auth: n,
|
|
1071
2036
|
authSession: i
|
|
2037
|
+
}, h = t.blocks.findIndex((v) => v.type === "cta_button"), d = h === -1 ? t.blocks : t.blocks.slice(0, h), b = h === -1 ? [] : t.blocks.slice(h), w = (v, p) => {
|
|
2038
|
+
const y = tr[v.type];
|
|
2039
|
+
return y ? /* @__PURE__ */ o(y, { block: v, ctx: f }, `${v.type}-${p}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${v.type}`), null);
|
|
1072
2040
|
};
|
|
1073
|
-
return /* @__PURE__ */
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
2041
|
+
return /* @__PURE__ */ u(se, { 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: d.map(w) }) }),
|
|
2043
|
+
b.length > 0 ? (
|
|
2044
|
+
// Тонкий shadow-top вместо border-t — создаёт depth, читается как
|
|
2045
|
+
// «footer закреплён к низу dialog'а». Линия выглядела как divider
|
|
2046
|
+
// в обычном flow, не передавала sticky-character.
|
|
2047
|
+
/* @__PURE__ */ o(
|
|
2048
|
+
"div",
|
|
2049
|
+
{
|
|
2050
|
+
class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
|
|
2051
|
+
style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
|
|
2052
|
+
children: b.map((v, p) => w(v, d.length + p))
|
|
2053
|
+
}
|
|
2054
|
+
)
|
|
2055
|
+
) : null
|
|
2056
|
+
] });
|
|
1077
2057
|
}
|
|
1078
|
-
function
|
|
1079
|
-
return
|
|
2058
|
+
function nr(t, e, r, n) {
|
|
2059
|
+
return t ? n ? { open: !0, view: "purchased", error: null } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null } : e.status === "error" ? { open: !0, view: "error", error: e.error } : r.kind === "support" ? { open: !0, view: "support", error: null } : r.kind === "auth_gate" ? { open: !0, view: "auth", error: null } : r.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null } : r.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null } : r.kind === "purchase_success" ? { open: !0, view: "purchased", error: null } : r.kind === "verifying" ? { open: !0, view: "loading", error: null } : { open: !0, view: "layout", error: null } : { open: !1, view: null, error: null };
|
|
1080
2060
|
}
|
|
1081
|
-
function
|
|
1082
|
-
return
|
|
2061
|
+
function ir(t, e) {
|
|
2062
|
+
return t.open === e.open && t.view === e.view && t.error === e.error;
|
|
1083
2063
|
}
|
|
1084
|
-
function
|
|
1085
|
-
client:
|
|
2064
|
+
function or({
|
|
2065
|
+
client: t,
|
|
1086
2066
|
open: e,
|
|
1087
|
-
onClose:
|
|
2067
|
+
onClose: r,
|
|
1088
2068
|
onEvent: n,
|
|
1089
2069
|
initialView: i,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
2070
|
+
initialAuthMode: s,
|
|
2071
|
+
purchased: a,
|
|
2072
|
+
renew: c,
|
|
2073
|
+
onState: l,
|
|
2074
|
+
inline: f,
|
|
2075
|
+
locale: h
|
|
1093
2076
|
}) {
|
|
1094
|
-
const [
|
|
1095
|
-
() =>
|
|
1096
|
-
), [
|
|
1097
|
-
|
|
1098
|
-
if (!
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
}, [e,
|
|
1102
|
-
if (
|
|
1103
|
-
return
|
|
1104
|
-
}, [
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
2077
|
+
const [d, b] = x({ status: "idle" }), [w, v] = x(
|
|
2078
|
+
() => t.auth?.getCachedSession() ?? null
|
|
2079
|
+
), [p, y] = x(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? { kind: "auth_gate", origin: "standalone" } : { kind: "layout" }), O = R(!1), _ = R(null);
|
|
2080
|
+
B(() => {
|
|
2081
|
+
if (!l) return;
|
|
2082
|
+
const m = nr(e, d, p, a), g = _.current;
|
|
2083
|
+
g && ir(g, m) || (_.current = m, l(m));
|
|
2084
|
+
}, [e, d, p, a, l]), B(() => {
|
|
2085
|
+
if (t.auth)
|
|
2086
|
+
return t.auth.onAuthChange((m, g) => v(g));
|
|
2087
|
+
}, [t.auth]), B(() => {
|
|
2088
|
+
if (typeof t.onBootstrapChange == "function")
|
|
2089
|
+
return t.onBootstrapChange((m) => {
|
|
2090
|
+
b(
|
|
2091
|
+
(g) => g.status === "ready" ? { status: "ready", data: m } : g
|
|
2092
|
+
);
|
|
2093
|
+
});
|
|
2094
|
+
}, [t]), B(() => {
|
|
2095
|
+
if (!e || d.status === "ready" || d.status === "loading") return;
|
|
2096
|
+
let m = !1;
|
|
2097
|
+
return b({ status: "loading" }), t.bootstrap().then((g) => {
|
|
2098
|
+
m || (b({ status: "ready", data: g }), n("ready", g), g.user?.has_active_subscription && !c && !i && (n("purchase_completed", {
|
|
1109
2099
|
priceId: null,
|
|
1110
2100
|
sessionId: null,
|
|
1111
2101
|
restored: !0
|
|
1112
|
-
}),
|
|
1113
|
-
}).catch((
|
|
1114
|
-
if (
|
|
1115
|
-
const
|
|
1116
|
-
|
|
2102
|
+
}), y({ kind: "purchase_success", restored: !0 })));
|
|
2103
|
+
}).catch((g) => {
|
|
2104
|
+
if (m) return;
|
|
2105
|
+
const C = g instanceof T ? g : new T("unknown", "Failed to load paywall", { cause: g });
|
|
2106
|
+
b({ status: "error", error: C }), n("error", C);
|
|
1117
2107
|
}), () => {
|
|
1118
|
-
|
|
2108
|
+
m = !0;
|
|
1119
2109
|
};
|
|
1120
|
-
}, [e,
|
|
2110
|
+
}, [e, t]), He(() => {
|
|
1121
2111
|
if (!e) {
|
|
1122
|
-
|
|
2112
|
+
y({ kind: "layout" }), O.current = !1;
|
|
1123
2113
|
return;
|
|
1124
2114
|
}
|
|
1125
|
-
i === "support" ?
|
|
2115
|
+
i === "support" ? y({ kind: "support", origin: "standalone" }) : i === "auth" && y({ kind: "auth_gate", origin: "standalone" });
|
|
1126
2116
|
}, [e, i]);
|
|
1127
|
-
const
|
|
2117
|
+
const S = async (m) => {
|
|
1128
2118
|
try {
|
|
1129
|
-
const
|
|
1130
|
-
priceId:
|
|
1131
|
-
ignoreActivePurchase:
|
|
2119
|
+
const g = await t.createCheckout({
|
|
2120
|
+
priceId: m,
|
|
2121
|
+
ignoreActivePurchase: c === !0
|
|
1132
2122
|
});
|
|
1133
|
-
if (n("checkout_started", { priceId:
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
2123
|
+
if (n("checkout_started", { priceId: m, url: g.url, acquiring: g.acquiring }), typeof window > "u" || !g.url) return;
|
|
2124
|
+
const C = window.open(g.url, "_blank");
|
|
2125
|
+
if (C) {
|
|
1136
2126
|
try {
|
|
1137
|
-
|
|
2127
|
+
C.opener = null;
|
|
1138
2128
|
} catch {
|
|
1139
2129
|
}
|
|
1140
|
-
|
|
2130
|
+
y({ kind: "awaiting_payment", priceId: m, url: g.url });
|
|
1141
2131
|
} else
|
|
1142
|
-
|
|
1143
|
-
} catch (
|
|
1144
|
-
if (
|
|
2132
|
+
y({ kind: "popup_blocked", priceId: m, url: g.url });
|
|
2133
|
+
} catch (g) {
|
|
2134
|
+
if (g instanceof T && g.code === "already_purchased") {
|
|
1145
2135
|
try {
|
|
1146
|
-
await
|
|
2136
|
+
await t.getUser({ force: !0 });
|
|
1147
2137
|
} catch {
|
|
1148
2138
|
}
|
|
1149
|
-
n("purchase_completed", { priceId:
|
|
2139
|
+
n("purchase_completed", { priceId: m, sessionId: null, restored: !0 }), y({ kind: "purchase_success", restored: !0 });
|
|
1150
2140
|
return;
|
|
1151
2141
|
}
|
|
1152
|
-
const
|
|
1153
|
-
n("error",
|
|
2142
|
+
const C = g instanceof T ? g : new T("checkout_failed", "Checkout failed", { cause: g });
|
|
2143
|
+
n("error", C), y({ kind: "layout" });
|
|
1154
2144
|
}
|
|
1155
|
-
},
|
|
2145
|
+
}, A = (m, g) => {
|
|
1156
2146
|
if (typeof window > "u") return;
|
|
1157
|
-
const
|
|
1158
|
-
if (
|
|
2147
|
+
const C = window.open(g, "_blank");
|
|
2148
|
+
if (C) {
|
|
1159
2149
|
try {
|
|
1160
|
-
|
|
2150
|
+
C.opener = null;
|
|
1161
2151
|
} catch {
|
|
1162
2152
|
}
|
|
1163
|
-
|
|
2153
|
+
y({ kind: "awaiting_payment", priceId: m, url: g });
|
|
1164
2154
|
}
|
|
1165
2155
|
};
|
|
1166
|
-
|
|
1167
|
-
if (
|
|
1168
|
-
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
if (!
|
|
2156
|
+
B(() => {
|
|
2157
|
+
if (p.kind !== "auth_gate" || !w || w.user.is_anonymous || O.current) return;
|
|
2158
|
+
O.current = !0;
|
|
2159
|
+
const m = p.pendingCheckout, g = p.origin;
|
|
2160
|
+
y({ kind: "verifying" }), (async () => {
|
|
2161
|
+
if (!c)
|
|
1172
2162
|
try {
|
|
1173
|
-
if ((await
|
|
2163
|
+
if ((await t.getUser({ force: !0 })).has_active_subscription) {
|
|
1174
2164
|
n("purchase_completed", {
|
|
1175
|
-
priceId:
|
|
2165
|
+
priceId: m?.priceId ?? null,
|
|
1176
2166
|
sessionId: null,
|
|
1177
2167
|
restored: !0
|
|
1178
|
-
}),
|
|
2168
|
+
}), y({ kind: "purchase_success", restored: !0 });
|
|
1179
2169
|
return;
|
|
1180
2170
|
}
|
|
1181
2171
|
} catch {
|
|
1182
2172
|
}
|
|
1183
|
-
if (!
|
|
1184
|
-
|
|
2173
|
+
if (!m) {
|
|
2174
|
+
g === "standalone" ? r() : y({ kind: "layout" });
|
|
1185
2175
|
return;
|
|
1186
2176
|
}
|
|
1187
|
-
await
|
|
2177
|
+
await S(m.priceId);
|
|
1188
2178
|
})().finally(() => {
|
|
1189
|
-
|
|
2179
|
+
O.current = !1;
|
|
1190
2180
|
});
|
|
1191
|
-
}, [
|
|
1192
|
-
const
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
2181
|
+
}, [w, p]);
|
|
2182
|
+
const D = async (m, g) => {
|
|
2183
|
+
if (m === "close") {
|
|
2184
|
+
r();
|
|
1195
2185
|
return;
|
|
1196
2186
|
}
|
|
1197
|
-
if (
|
|
1198
|
-
n("price_selected",
|
|
2187
|
+
if (m === "price_selected") {
|
|
2188
|
+
n("price_selected", g);
|
|
1199
2189
|
return;
|
|
1200
2190
|
}
|
|
1201
|
-
if (
|
|
1202
|
-
if (!
|
|
1203
|
-
|
|
2191
|
+
if (m === "restore") {
|
|
2192
|
+
if (!t.auth) return;
|
|
2193
|
+
const C = t.auth.getCachedSession();
|
|
2194
|
+
if (C && !C.user.is_anonymous) return;
|
|
2195
|
+
y({ kind: "auth_gate", intent: "restore" });
|
|
1204
2196
|
return;
|
|
1205
2197
|
}
|
|
1206
|
-
if (
|
|
1207
|
-
|
|
2198
|
+
if (m === "support") {
|
|
2199
|
+
y({ kind: "support", origin: "layout" });
|
|
1208
2200
|
return;
|
|
1209
2201
|
}
|
|
1210
|
-
if (
|
|
1211
|
-
const
|
|
1212
|
-
if (!
|
|
2202
|
+
if (m === "checkout" && d.status === "ready") {
|
|
2203
|
+
const C = g?.priceId;
|
|
2204
|
+
if (!C) {
|
|
1213
2205
|
n("error", new T("no_price", "No price selected"));
|
|
1214
2206
|
return;
|
|
1215
2207
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
2208
|
+
const K = d.data.settings.checkout_mode ?? "guest", I = t.auth?.getCachedSession() ?? null, M = !!I && !I.user.is_anonymous;
|
|
2209
|
+
if (K === "preauth" && !!t.auth && !M) {
|
|
2210
|
+
y({ kind: "auth_gate", pendingCheckout: { priceId: C } });
|
|
1218
2211
|
return;
|
|
1219
2212
|
}
|
|
1220
|
-
await
|
|
2213
|
+
await S(C);
|
|
1221
2214
|
}
|
|
1222
|
-
},
|
|
2215
|
+
}, E = d.status === "ready" ? d.data.settings.brand_color : null, U = d.status === "ready" ? d.data.settings.allow_close !== !1 : !0, j = p.kind === "layout" && d.status === "ready" ? Ee(d.data.offers) : null, P = j ? /* @__PURE__ */ o(Ct, { offer: j }) : null, L = {
|
|
1223
2216
|
type: "auth_panel",
|
|
1224
|
-
|
|
2217
|
+
// Заголовок не задаём — AuthGate сам решит по intent'у (restore →
|
|
2218
|
+
// "Restore Purchases", остальные → дефолтный "Welcome back!").
|
|
1225
2219
|
allow_signup: !0,
|
|
1226
2220
|
allow_password_reset: !0,
|
|
1227
2221
|
// Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
|
|
1228
2222
|
// чем хотим показывать "Signed in as ..." промежуточным экраном.
|
|
1229
2223
|
hide_when_authenticated: !1,
|
|
1230
|
-
providers:
|
|
1231
|
-
},
|
|
1232
|
-
|
|
2224
|
+
providers: d.status === "ready" ? d.data.settings.auth_providers : void 0
|
|
2225
|
+
}, N = p.kind === "support" ? /* @__PURE__ */ o(
|
|
2226
|
+
Lt,
|
|
1233
2227
|
{
|
|
1234
|
-
client:
|
|
1235
|
-
authSession:
|
|
1236
|
-
origin:
|
|
2228
|
+
client: t,
|
|
2229
|
+
authSession: w,
|
|
2230
|
+
origin: p.origin,
|
|
1237
2231
|
onBack: () => {
|
|
1238
|
-
|
|
2232
|
+
p.origin === "standalone" ? r() : y({ kind: "layout" });
|
|
1239
2233
|
}
|
|
1240
2234
|
}
|
|
1241
|
-
) : null;
|
|
1242
|
-
return /* @__PURE__ */ o(
|
|
1243
|
-
|
|
2235
|
+
) : null, q = p.kind === "auth_gate" && p.origin !== "standalone" || p.kind === "support", Y = d.status === "ready" ? d.data : null;
|
|
2236
|
+
return /* @__PURE__ */ o(ot, { bootstrap: Y, forceLocale: h, children: /* @__PURE__ */ o(
|
|
2237
|
+
st,
|
|
1244
2238
|
{
|
|
1245
2239
|
open: e,
|
|
1246
|
-
onClose:
|
|
1247
|
-
brandColor:
|
|
1248
|
-
|
|
1249
|
-
allowClose:
|
|
2240
|
+
onClose: r,
|
|
2241
|
+
brandColor: E,
|
|
2242
|
+
topBanner: P,
|
|
2243
|
+
allowClose: U,
|
|
2244
|
+
hideCloseButton: q,
|
|
2245
|
+
inline: f,
|
|
1250
2246
|
labelledBy: "pw-title",
|
|
1251
|
-
children:
|
|
1252
|
-
|
|
1253
|
-
/* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: f.kind === "verifying" ? "Checking your subscription…" : "Loading…" })
|
|
1254
|
-
] }) : c.status === "error" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
1255
|
-
/* @__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: [
|
|
1256
|
-
/* @__PURE__ */ o(
|
|
1257
|
-
"path",
|
|
1258
|
-
{
|
|
1259
|
-
d: "M10 6v5M10 14h.01",
|
|
1260
|
-
stroke: "#dc2626",
|
|
1261
|
-
"stroke-width": "2",
|
|
1262
|
-
"stroke-linecap": "round"
|
|
1263
|
-
}
|
|
1264
|
-
),
|
|
1265
|
-
/* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
1266
|
-
] }) }),
|
|
1267
|
-
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Something went wrong" }),
|
|
1268
|
-
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: c.error.message })
|
|
1269
|
-
] }) : f.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
|
|
1270
|
-
Se,
|
|
2247
|
+
children: a ? /* @__PURE__ */ o(ke, { onContinue: r }) : p.kind === "purchase_success" ? /* @__PURE__ */ o(ke, { restored: p.restored, onContinue: r }) : N || (d.status === "loading" || d.status === "idle" || p.kind === "verifying" ? /* @__PURE__ */ o(sr, { verifying: p.kind === "verifying" }) : d.status === "error" ? /* @__PURE__ */ o(ar, { message: d.error.message }) : p.kind === "auth_gate" && t.auth ? /* @__PURE__ */ o(
|
|
2248
|
+
kt,
|
|
1271
2249
|
{
|
|
1272
|
-
block:
|
|
1273
|
-
bootstrap:
|
|
1274
|
-
auth:
|
|
1275
|
-
authSession:
|
|
1276
|
-
showBack:
|
|
2250
|
+
block: L,
|
|
2251
|
+
bootstrap: d.data,
|
|
2252
|
+
auth: t.auth,
|
|
2253
|
+
authSession: w,
|
|
2254
|
+
showBack: p.origin !== "standalone",
|
|
2255
|
+
intent: p.intent ?? (p.origin === "standalone" ? "standalone" : "preauth"),
|
|
2256
|
+
initialMode: p.origin === "standalone" ? s : void 0,
|
|
1277
2257
|
onBack: () => {
|
|
1278
|
-
|
|
2258
|
+
p.origin === "standalone" ? r() : y({ kind: "layout" });
|
|
1279
2259
|
}
|
|
1280
2260
|
}
|
|
1281
|
-
) :
|
|
1282
|
-
|
|
2261
|
+
) : p.kind === "awaiting_payment" ? /* @__PURE__ */ o(
|
|
2262
|
+
cr,
|
|
1283
2263
|
{
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
f.origin === "standalone" ? t() : m({ kind: "layout" });
|
|
1287
|
-
},
|
|
1288
|
-
onBack: f.origin === "standalone" ? void 0 : () => m({ kind: "layout" })
|
|
1289
|
-
}
|
|
1290
|
-
) : f.kind === "awaiting_payment" ? /* @__PURE__ */ o(
|
|
1291
|
-
Xe,
|
|
1292
|
-
{
|
|
1293
|
-
client: r,
|
|
1294
|
-
onBack: () => m({ kind: "layout" }),
|
|
2264
|
+
client: t,
|
|
2265
|
+
onBack: () => y({ kind: "layout" }),
|
|
1295
2266
|
onReopen: () => {
|
|
1296
2267
|
if (typeof window > "u") return;
|
|
1297
|
-
const
|
|
1298
|
-
if (
|
|
2268
|
+
const m = window.open(p.url, "_blank");
|
|
2269
|
+
if (m)
|
|
1299
2270
|
try {
|
|
1300
|
-
|
|
2271
|
+
m.opener = null;
|
|
1301
2272
|
} catch {
|
|
1302
2273
|
}
|
|
1303
2274
|
},
|
|
1304
|
-
onRetry: () =>
|
|
2275
|
+
onRetry: () => S(p.priceId)
|
|
1305
2276
|
}
|
|
1306
|
-
) :
|
|
1307
|
-
|
|
1308
|
-
"div",
|
|
1309
|
-
{
|
|
1310
|
-
class: "flex h-11 w-11 items-center justify-center rounded-full",
|
|
1311
|
-
style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
|
|
1312
|
-
"aria-hidden": "true",
|
|
1313
|
-
children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
1314
|
-
/* @__PURE__ */ o(
|
|
1315
|
-
"path",
|
|
1316
|
-
{
|
|
1317
|
-
d: "M4 5h12v10H4z",
|
|
1318
|
-
stroke: "currentColor",
|
|
1319
|
-
"stroke-width": "1.75",
|
|
1320
|
-
"stroke-linejoin": "round"
|
|
1321
|
-
}
|
|
1322
|
-
),
|
|
1323
|
-
/* @__PURE__ */ o("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
|
|
1324
|
-
] })
|
|
1325
|
-
}
|
|
1326
|
-
),
|
|
1327
|
-
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Allow popups to continue" }),
|
|
1328
|
-
/* @__PURE__ */ o("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: "Your browser blocked the checkout tab. Click below to open it." }),
|
|
1329
|
-
/* @__PURE__ */ o(
|
|
1330
|
-
"button",
|
|
1331
|
-
{
|
|
1332
|
-
type: "button",
|
|
1333
|
-
onClick: () => v(f.priceId, f.url),
|
|
1334
|
-
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)]",
|
|
1335
|
-
style: {
|
|
1336
|
-
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1337
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1338
|
-
},
|
|
1339
|
-
children: "Open checkout"
|
|
1340
|
-
}
|
|
1341
|
-
)
|
|
1342
|
-
] }) : /* @__PURE__ */ o(
|
|
1343
|
-
He,
|
|
2277
|
+
) : p.kind === "popup_blocked" ? /* @__PURE__ */ o(lr, { onReopen: () => A(p.priceId, p.url) }) : /* @__PURE__ */ o(
|
|
2278
|
+
rr,
|
|
1344
2279
|
{
|
|
1345
|
-
layout:
|
|
1346
|
-
bootstrap:
|
|
1347
|
-
onAction:
|
|
1348
|
-
auth:
|
|
1349
|
-
authSession:
|
|
2280
|
+
layout: d.data.layout,
|
|
2281
|
+
bootstrap: d.data,
|
|
2282
|
+
onAction: D,
|
|
2283
|
+
auth: t.auth,
|
|
2284
|
+
authSession: w
|
|
1350
2285
|
}
|
|
1351
2286
|
))
|
|
1352
2287
|
}
|
|
1353
|
-
);
|
|
2288
|
+
) });
|
|
2289
|
+
}
|
|
2290
|
+
function sr({ verifying: t }) {
|
|
2291
|
+
const { t: e } = k();
|
|
2292
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
|
|
2293
|
+
/* @__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: t ? e("modal.verifying_subscription", "Checking your subscription…") : e("modal.loading", "Loading…") })
|
|
2295
|
+
] });
|
|
2296
|
+
}
|
|
2297
|
+
function ar({ message: t }) {
|
|
2298
|
+
const { t: e } = k();
|
|
2299
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2300
|
+
/* @__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
|
+
/* @__PURE__ */ o("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
|
|
2302
|
+
/* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
|
|
2303
|
+
] }) }),
|
|
2304
|
+
/* @__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: t })
|
|
2306
|
+
] });
|
|
2307
|
+
}
|
|
2308
|
+
function lr({ onReopen: t }) {
|
|
2309
|
+
const { t: e } = k();
|
|
2310
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
2311
|
+
/* @__PURE__ */ o(
|
|
2312
|
+
"div",
|
|
2313
|
+
{
|
|
2314
|
+
class: "flex h-11 w-11 items-center justify-center rounded-full",
|
|
2315
|
+
style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
|
|
2316
|
+
"aria-hidden": "true",
|
|
2317
|
+
children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
2318
|
+
/* @__PURE__ */ o("path", { d: "M4 5h12v10H4z", stroke: "currentColor", "stroke-width": "1.75", "stroke-linejoin": "round" }),
|
|
2319
|
+
/* @__PURE__ */ o("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
|
|
2320
|
+
] })
|
|
2321
|
+
}
|
|
2322
|
+
),
|
|
2323
|
+
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: e("payment.popup_blocked_title", "Allow popups to continue") }),
|
|
2324
|
+
/* @__PURE__ */ o("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: e("payment.popup_blocked_message", "Your browser blocked the checkout tab. Click below to open it.") }),
|
|
2325
|
+
/* @__PURE__ */ o(
|
|
2326
|
+
"button",
|
|
2327
|
+
{
|
|
2328
|
+
type: "button",
|
|
2329
|
+
onClick: t,
|
|
2330
|
+
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
|
+
style: {
|
|
2332
|
+
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
2333
|
+
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
2334
|
+
},
|
|
2335
|
+
children: e("payment.open_checkout_button", "Open checkout")
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
] });
|
|
1354
2339
|
}
|
|
1355
|
-
function
|
|
1356
|
-
client:
|
|
2340
|
+
function cr({
|
|
2341
|
+
client: t,
|
|
1357
2342
|
onBack: e,
|
|
1358
|
-
onReopen:
|
|
2343
|
+
onReopen: r,
|
|
1359
2344
|
onRetry: n
|
|
1360
2345
|
}) {
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
}, [])
|
|
2346
|
+
const { t: i } = k(), [s, a] = x(!1), [c, l] = x(!1), f = R(null);
|
|
2347
|
+
B(() => () => {
|
|
2348
|
+
f.current !== null && clearTimeout(f.current);
|
|
2349
|
+
}, []);
|
|
2350
|
+
const h = async () => {
|
|
2351
|
+
if (!s) {
|
|
2352
|
+
a(!0), l(!1);
|
|
2353
|
+
try {
|
|
2354
|
+
if ((await t.getUser({ force: !0 })).has_active_subscription) {
|
|
2355
|
+
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
2356
|
+
return;
|
|
2357
|
+
}
|
|
2358
|
+
l(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
2359
|
+
l(!1), f.current = null;
|
|
2360
|
+
}, 5e3);
|
|
2361
|
+
} catch {
|
|
2362
|
+
l(!0);
|
|
2363
|
+
} finally {
|
|
2364
|
+
a(!1);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3 px-6 pb-6 pt-4 sm:px-8 sm:pb-8 sm:pt-5", children: [
|
|
1365
2369
|
/* @__PURE__ */ o(
|
|
1366
2370
|
"button",
|
|
1367
2371
|
{
|
|
1368
2372
|
type: "button",
|
|
1369
2373
|
onClick: e,
|
|
1370
2374
|
class: "-ml-1 self-start rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1371
|
-
children: "← Back"
|
|
2375
|
+
children: i("nav.back", "← Back")
|
|
1372
2376
|
}
|
|
1373
2377
|
),
|
|
1374
2378
|
/* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
|
|
@@ -1383,50 +2387,36 @@ function Xe({
|
|
|
1383
2387
|
),
|
|
1384
2388
|
/* @__PURE__ */ o("span", { class: "relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
|
|
1385
2389
|
] }),
|
|
1386
|
-
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Complete payment in the new tab" }),
|
|
1387
|
-
/* @__PURE__ */ o("p", { class: "max-w-[20rem] text-xs leading-relaxed text-gray-500", children:
|
|
2390
|
+
/* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: i("payment.awaiting_title", "Complete payment in the new tab") }),
|
|
2391
|
+
/* @__PURE__ */ o("p", { class: "max-w-[20rem] text-xs leading-relaxed text-gray-500", children: i(
|
|
2392
|
+
"payment.awaiting_subtitle",
|
|
2393
|
+
"We'll detect your payment automatically — or click below once you're done."
|
|
2394
|
+
) }),
|
|
1388
2395
|
/* @__PURE__ */ o(
|
|
1389
2396
|
"button",
|
|
1390
2397
|
{
|
|
1391
2398
|
type: "button",
|
|
1392
|
-
onClick:
|
|
1393
|
-
|
|
1394
|
-
s(!0), a(!1);
|
|
1395
|
-
try {
|
|
1396
|
-
if ((await r.getUser({ force: !0 })).has_active_subscription) {
|
|
1397
|
-
typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
a(!0), c.current !== null && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
1401
|
-
a(!1), c.current = null;
|
|
1402
|
-
}, 5e3);
|
|
1403
|
-
} catch {
|
|
1404
|
-
a(!0);
|
|
1405
|
-
} finally {
|
|
1406
|
-
s(!1);
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
},
|
|
1410
|
-
disabled: i,
|
|
2399
|
+
onClick: h,
|
|
2400
|
+
disabled: s,
|
|
1411
2401
|
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)]",
|
|
1412
2402
|
style: {
|
|
1413
2403
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1414
2404
|
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1415
2405
|
},
|
|
1416
|
-
children:
|
|
2406
|
+
children: s ? i("payment.checking", "Checking…") : i("payment.ive_paid", "I've paid")
|
|
1417
2407
|
}
|
|
1418
2408
|
),
|
|
1419
|
-
|
|
2409
|
+
c ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: i("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
|
|
1420
2410
|
] }),
|
|
1421
2411
|
/* @__PURE__ */ u("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
|
|
1422
|
-
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: "Checkout window didn't open or got blocked? Click here to open it again." }),
|
|
2412
|
+
/* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: i("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
|
|
1423
2413
|
/* @__PURE__ */ o(
|
|
1424
2414
|
"button",
|
|
1425
2415
|
{
|
|
1426
2416
|
type: "button",
|
|
1427
|
-
onClick:
|
|
2417
|
+
onClick: r,
|
|
1428
2418
|
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)]",
|
|
1429
|
-
children: "Open checkout again"
|
|
2419
|
+
children: i("payment.open_checkout_again", "Open checkout again")
|
|
1430
2420
|
}
|
|
1431
2421
|
)
|
|
1432
2422
|
] }),
|
|
@@ -1436,15 +2426,16 @@ function Xe({
|
|
|
1436
2426
|
type: "button",
|
|
1437
2427
|
onClick: n,
|
|
1438
2428
|
class: "self-center rounded-md px-2 py-1 text-xs text-gray-500 underline-offset-2 hover:text-gray-900 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
|
|
1439
|
-
children: "Tab closed? Try again"
|
|
2429
|
+
children: i("payment.tab_closed_retry", "Tab closed? Try again")
|
|
1440
2430
|
}
|
|
1441
2431
|
)
|
|
1442
2432
|
] });
|
|
1443
2433
|
}
|
|
1444
|
-
function
|
|
1445
|
-
onContinue:
|
|
2434
|
+
function ke({
|
|
2435
|
+
onContinue: t,
|
|
1446
2436
|
restored: e = !1
|
|
1447
2437
|
}) {
|
|
2438
|
+
const { t: r } = k();
|
|
1448
2439
|
return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
|
|
1449
2440
|
/* @__PURE__ */ o(
|
|
1450
2441
|
"div",
|
|
@@ -1469,34 +2460,37 @@ function te({
|
|
|
1469
2460
|
) })
|
|
1470
2461
|
}
|
|
1471
2462
|
),
|
|
1472
|
-
/* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? "Subscription restored" : "Payment received" }),
|
|
1473
|
-
/* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ?
|
|
2463
|
+
/* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? r("modal.purchase_restored_title", "Subscription restored") : r("modal.purchase_success_title", "Payment received") }),
|
|
2464
|
+
/* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? r(
|
|
2465
|
+
"modal.purchase_restored_subtitle",
|
|
2466
|
+
"Welcome back — your subscription is already active."
|
|
2467
|
+
) : r("modal.purchase_success_subtitle", "Your subscription is now active.") }),
|
|
1474
2468
|
/* @__PURE__ */ o(
|
|
1475
2469
|
"button",
|
|
1476
2470
|
{
|
|
1477
2471
|
type: "button",
|
|
1478
|
-
onClick:
|
|
2472
|
+
onClick: t,
|
|
1479
2473
|
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)]",
|
|
1480
2474
|
style: {
|
|
1481
2475
|
background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
|
|
1482
2476
|
boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
|
|
1483
2477
|
},
|
|
1484
|
-
children: "Continue"
|
|
2478
|
+
children: r("modal.continue", "Continue")
|
|
1485
2479
|
}
|
|
1486
2480
|
)
|
|
1487
2481
|
] });
|
|
1488
2482
|
}
|
|
1489
|
-
const
|
|
1490
|
-
class
|
|
2483
|
+
const ur = 10 * 6e4, dr = 5e3, hr = 3e4;
|
|
2484
|
+
class pr {
|
|
1491
2485
|
constructor(e) {
|
|
1492
2486
|
this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
|
|
1493
2487
|
client: e.client,
|
|
1494
2488
|
onActive: e.onActive,
|
|
1495
2489
|
onTimeout: e.onTimeout ?? (() => {
|
|
1496
2490
|
}),
|
|
1497
|
-
timeoutMs: e.timeoutMs ??
|
|
1498
|
-
visibleIntervalMs: e.visibleIntervalMs ??
|
|
1499
|
-
hiddenIntervalMs: e.hiddenIntervalMs ??
|
|
2491
|
+
timeoutMs: e.timeoutMs ?? ur,
|
|
2492
|
+
visibleIntervalMs: e.visibleIntervalMs ?? dr,
|
|
2493
|
+
hiddenIntervalMs: e.hiddenIntervalMs ?? hr
|
|
1500
2494
|
};
|
|
1501
2495
|
}
|
|
1502
2496
|
start() {
|
|
@@ -1522,53 +2516,53 @@ class Qe {
|
|
|
1522
2516
|
}
|
|
1523
2517
|
scheduleNext() {
|
|
1524
2518
|
if (this.stopped) return;
|
|
1525
|
-
const
|
|
2519
|
+
const r = typeof document < "u" && document.visibilityState === "visible" ? this.opts.visibleIntervalMs : this.opts.hiddenIntervalMs;
|
|
1526
2520
|
this.timer = setTimeout(async () => {
|
|
1527
2521
|
await this.check(), this.scheduleNext();
|
|
1528
|
-
},
|
|
2522
|
+
}, r);
|
|
1529
2523
|
}
|
|
1530
2524
|
handleVisibilityChange() {
|
|
1531
2525
|
typeof document > "u" || (document.visibilityState === "visible" && this.check(), this.timer !== null && (clearTimeout(this.timer), this.timer = null), this.scheduleNext());
|
|
1532
2526
|
}
|
|
1533
2527
|
handleMessage(e) {
|
|
1534
|
-
const
|
|
1535
|
-
!
|
|
2528
|
+
const r = e.data;
|
|
2529
|
+
!r || typeof r != "object" || r.type === "paywall_purchase" && this.check();
|
|
1536
2530
|
}
|
|
1537
2531
|
}
|
|
1538
|
-
function
|
|
2532
|
+
function fr() {
|
|
1539
2533
|
return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
|
|
1540
2534
|
}
|
|
1541
|
-
const
|
|
2535
|
+
const oe = { open: !1, view: null, error: null }, F = {
|
|
1542
2536
|
status: "paywall_status",
|
|
1543
2537
|
priceId: "paywall_price_id",
|
|
1544
2538
|
sessionId: "paywall_session_id"
|
|
1545
2539
|
};
|
|
1546
|
-
let
|
|
2540
|
+
let gr = class {
|
|
1547
2541
|
constructor(e) {
|
|
1548
|
-
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 =
|
|
1549
|
-
const { auth:
|
|
1550
|
-
this.auth =
|
|
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 = oe, this.stateListeners = /* @__PURE__ */ new Set();
|
|
2543
|
+
const { auth: r, ownsAuth: n } = mr(e);
|
|
2544
|
+
this.auth = r, this.ownsAuth = n, this.billing = e.client ?? new je({ ...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) => {
|
|
1551
2545
|
this.emit("userChange", i);
|
|
1552
|
-
}), this.auth && (this.authUnsub = this.auth.onAuthChange((i) => {
|
|
1553
|
-
this.emit("authChange", i);
|
|
2546
|
+
}), this.auth && (this.authUnsub = this.auth.onAuthChange((i, s) => {
|
|
2547
|
+
this.emit("authChange", { event: i, session: s });
|
|
1554
2548
|
})), this.initTracker(e.analytics), e.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
|
|
1555
2549
|
}
|
|
1556
2550
|
initTracker(e) {
|
|
1557
2551
|
if (e === !1) return;
|
|
1558
|
-
const
|
|
1559
|
-
if (
|
|
1560
|
-
const n =
|
|
1561
|
-
this.tracker = new
|
|
2552
|
+
const r = typeof e == "object" && e !== null ? e : {};
|
|
2553
|
+
if (r.enabled === !1) return;
|
|
2554
|
+
const n = r.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
|
|
2555
|
+
this.tracker = new Re({
|
|
1562
2556
|
endpoint: n,
|
|
1563
2557
|
paywallId: this.billing.paywallId,
|
|
1564
2558
|
capabilities: this.billing.capabilities,
|
|
1565
2559
|
getVisitorId: () => this.billing.getVisitorId(),
|
|
1566
2560
|
getCachedVisitorId: () => this.billing.getCachedVisitorId(),
|
|
1567
2561
|
getUserId: () => this.billing.getIdentity()?.userId ?? null,
|
|
1568
|
-
flushIntervalMs:
|
|
1569
|
-
maxBufferSize:
|
|
1570
|
-
fetch:
|
|
1571
|
-
sendBeacon:
|
|
2562
|
+
flushIntervalMs: r.flushIntervalMs,
|
|
2563
|
+
maxBufferSize: r.maxBufferSize,
|
|
2564
|
+
fetch: r.fetch,
|
|
2565
|
+
sendBeacon: r.sendBeacon
|
|
1572
2566
|
}), this.on("open", () => this.tracker?.track("paywall_opened")), this.on(
|
|
1573
2567
|
"ready",
|
|
1574
2568
|
(i) => this.tracker?.track("paywall_viewed", {
|
|
@@ -1621,8 +2615,8 @@ let tt = class {
|
|
|
1621
2615
|
* Самый частый кейс — `track('app_opened')` от хоста сразу после загрузки
|
|
1622
2616
|
* приложения, чтобы зафиксировать воронку до открытия пейвола.
|
|
1623
2617
|
*/
|
|
1624
|
-
track(e,
|
|
1625
|
-
this.tracker?.track(e,
|
|
2618
|
+
track(e, r) {
|
|
2619
|
+
this.tracker?.track(e, r);
|
|
1626
2620
|
}
|
|
1627
2621
|
/**
|
|
1628
2622
|
* Удобный шорткат вместо `paywall.on('userChange', cb)` — самый частый
|
|
@@ -1632,22 +2626,47 @@ let tt = class {
|
|
|
1632
2626
|
onUserChange(e) {
|
|
1633
2627
|
return this.on("userChange", e);
|
|
1634
2628
|
}
|
|
1635
|
-
|
|
2629
|
+
/**
|
|
2630
|
+
* Заменить cachedBootstrap живыми данными — для preview-режима в редакторе
|
|
2631
|
+
* админки. Если модалка открыта, PaywallRoot подписан на onBootstrapChange
|
|
2632
|
+
* и перерендерится мгновенно. До open() — затравка для bootstrap()-effect'а.
|
|
2633
|
+
*
|
|
2634
|
+
* См. {@link BillingClientOptions.preview} — обычно эту опцию ставят на
|
|
2635
|
+
* клиент, чтобы заодно отключить сетевой revalidate. setBootstrap технически
|
|
2636
|
+
* работает и в production-режиме, но конкуренция с revalidate'ом из сети
|
|
2637
|
+
* почти всегда нежелательна.
|
|
2638
|
+
*/
|
|
2639
|
+
setBootstrap(e) {
|
|
2640
|
+
this.billing.setBootstrap(e);
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Сменить force-locale на лету — для live-preview редактора админки, когда
|
|
2644
|
+
* юзер переключает «Preview as user from <country>». Грузит соответствующий
|
|
2645
|
+
* static-чанк и форсит re-render через handle.update. См. PaywallUIOptions.locale.
|
|
2646
|
+
*
|
|
2647
|
+
* Передай `null`/`undefined`, чтобы вернуть автоматическую резолв-логику
|
|
2648
|
+
* (navigator.language → locale_default).
|
|
2649
|
+
*/
|
|
2650
|
+
setLocale(e) {
|
|
2651
|
+
const r = e ?? null;
|
|
2652
|
+
r !== this.forceLocale && (this.forceLocale = r, this.handle && this.handle.update({ locale: r }));
|
|
2653
|
+
}
|
|
2654
|
+
on(e, r) {
|
|
1636
2655
|
let n = this.listeners.get(e);
|
|
1637
|
-
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(
|
|
2656
|
+
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(r), () => n.delete(r);
|
|
1638
2657
|
}
|
|
1639
|
-
off(e,
|
|
1640
|
-
this.listeners.get(e)?.delete(
|
|
2658
|
+
off(e, r) {
|
|
2659
|
+
this.listeners.get(e)?.delete(r);
|
|
1641
2660
|
}
|
|
1642
|
-
emit(e, ...
|
|
2661
|
+
emit(e, ...r) {
|
|
1643
2662
|
const n = this.listeners.get(e);
|
|
1644
2663
|
if (!n) return;
|
|
1645
|
-
const i =
|
|
2664
|
+
const i = r[0];
|
|
1646
2665
|
for (const s of n)
|
|
1647
2666
|
try {
|
|
1648
2667
|
s(i);
|
|
1649
|
-
} catch (
|
|
1650
|
-
typeof console < "u" && console.error("[paywall] listener error",
|
|
2668
|
+
} catch (a) {
|
|
2669
|
+
typeof console < "u" && console.error("[paywall] listener error", a);
|
|
1651
2670
|
}
|
|
1652
2671
|
}
|
|
1653
2672
|
open(e = {}) {
|
|
@@ -1700,68 +2719,88 @@ let tt = class {
|
|
|
1700
2719
|
this.auth && this.openInternal("auth", { ...e, skipTrial: !0 });
|
|
1701
2720
|
}
|
|
1702
2721
|
/**
|
|
1703
|
-
*
|
|
1704
|
-
* `
|
|
1705
|
-
*
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
2722
|
+
* Шорткат над `openAuth()` — открывает модалку сразу на signin-форме.
|
|
2723
|
+
* Эквивалент `openAuth()` (signin — дефолт). Существует для симметрии с
|
|
2724
|
+
* `openSignup()` и читаемости host-кода:
|
|
2725
|
+
* - `paywall.openSignin()` — «вход в существующий аккаунт»
|
|
2726
|
+
* - `paywall.openSignup()` — «новая регистрация»
|
|
2727
|
+
* Без managed-auth — no-op.
|
|
2728
|
+
*/
|
|
2729
|
+
openSignin(e = {}) {
|
|
2730
|
+
this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signin" });
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Открывает модалку с auth-gate сразу в режиме регистрации (signup-mode
|
|
2734
|
+
* AuthPanel'а — email/password/repeat). Если в paywall layout админ
|
|
2735
|
+
* отключил allow_signup, AuthPanel игнорит mode и стартует с signin —
|
|
2736
|
+
* соблюдается admin-конфиг.
|
|
2737
|
+
* Без managed-auth — no-op.
|
|
2738
|
+
*/
|
|
2739
|
+
openSignup(e = {}) {
|
|
2740
|
+
this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signup" });
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Headless anonymous signin без открытия модалки. Внутри:
|
|
2744
|
+
* idempotent (если уже анон — instant return) → resume через сохранённый
|
|
2745
|
+
* refresh_token → fresh /auth/anonymous/signin. Дедуплицирует
|
|
2746
|
+
* параллельные вызовы внутри AuthClient'а.
|
|
1714
2747
|
*
|
|
1715
|
-
*
|
|
1716
|
-
*
|
|
1717
|
-
*
|
|
2748
|
+
* Удобно для host-кнопок типа «Continue as guest» — host сам управляет
|
|
2749
|
+
* loading-стейтом на своей кнопке, без полупустой модалки со спиннером.
|
|
2750
|
+
* Без managed-auth — резолвится rejected promise'ом (нет AuthClient'а
|
|
2751
|
+
* чтобы делать signin).
|
|
1718
2752
|
*/
|
|
1719
|
-
|
|
1720
|
-
this.auth
|
|
2753
|
+
signInAnonymously() {
|
|
2754
|
+
return this.auth ? this.auth.signInAnonymously() : Promise.reject(
|
|
2755
|
+
new T(
|
|
2756
|
+
"invalid_config",
|
|
2757
|
+
"signInAnonymously requires managed-auth. Pass `auth: true` to PaywallUI."
|
|
2758
|
+
)
|
|
2759
|
+
);
|
|
1721
2760
|
}
|
|
1722
|
-
openInternal(e,
|
|
1723
|
-
|
|
1724
|
-
const n =
|
|
2761
|
+
openInternal(e, r) {
|
|
2762
|
+
r.identity && this.billing.setIdentity(r.identity), this.purchased = !1;
|
|
2763
|
+
const n = r.skipTrial === !0 || e === "support", i = r.skipVisibility === !0 || e === "support" || e === "auth", s = r.renew === !0;
|
|
1725
2764
|
if (n && i) {
|
|
1726
|
-
this.mountAndShow(e, { renew: s });
|
|
2765
|
+
this.mountAndShow(e, { renew: s, authMode: r.authMode });
|
|
1727
2766
|
return;
|
|
1728
2767
|
}
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
this.runOpenGates(e,
|
|
2768
|
+
const a = this.billing.getCachedBootstrap();
|
|
2769
|
+
if (a) {
|
|
2770
|
+
this.runOpenGates(e, a, { skipTrial: n, skipVisibility: i, renew: s });
|
|
1732
2771
|
return;
|
|
1733
2772
|
}
|
|
1734
2773
|
if (this.mountThenLoad) {
|
|
1735
|
-
this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((
|
|
2774
|
+
this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((c) => this.runDelayedGates(c, { skipTrial: n, skipVisibility: i })).catch(() => {
|
|
1736
2775
|
});
|
|
1737
2776
|
return;
|
|
1738
2777
|
}
|
|
1739
|
-
this.billing.bootstrap().then((
|
|
2778
|
+
this.billing.bootstrap().then((c) => this.runOpenGates(e, c, { skipTrial: n, skipVisibility: i, renew: s })).catch(() => {
|
|
1740
2779
|
this.mountAndShow(e, { renew: s });
|
|
1741
2780
|
});
|
|
1742
2781
|
}
|
|
1743
2782
|
/** Применить gates ПОСЛЕ того, как модалка уже смонтирована (mount-then-load
|
|
1744
2783
|
* путь). Если gate блокирует — close() + emit. Если юзер уже сам закрыл
|
|
1745
2784
|
* модалку до резолва bootstrap'а — no-op (isOpen=false). */
|
|
1746
|
-
runDelayedGates(e,
|
|
2785
|
+
runDelayedGates(e, r) {
|
|
1747
2786
|
if (!this.isOpen) return;
|
|
1748
|
-
if (!
|
|
2787
|
+
if (!r.skipVisibility) {
|
|
1749
2788
|
const s = e.settings.visibility;
|
|
1750
2789
|
if (s && (this.lastVisibility = s, !s.visible)) {
|
|
1751
2790
|
this.close(), this.emit("visibility_blocked", s);
|
|
1752
2791
|
return;
|
|
1753
2792
|
}
|
|
1754
2793
|
}
|
|
1755
|
-
if (
|
|
2794
|
+
if (r.skipTrial) return;
|
|
1756
2795
|
const n = e.settings.trial;
|
|
1757
2796
|
if (!n) return;
|
|
1758
2797
|
const i = this.ensureTrialStore(n);
|
|
1759
2798
|
i.check().then(async (s) => {
|
|
1760
2799
|
if (this.isOpen && (this.lastTrialStatus = s, s.mode !== "none")) {
|
|
1761
2800
|
if (s.blocked) {
|
|
1762
|
-
const
|
|
1763
|
-
if (this.lastTrialStatus =
|
|
1764
|
-
this.close(), this.emit("trial_blocked",
|
|
2801
|
+
const a = await i.recordBlock();
|
|
2802
|
+
if (this.lastTrialStatus = a, !this.isOpen) return;
|
|
2803
|
+
this.close(), this.emit("trial_blocked", a);
|
|
1765
2804
|
return;
|
|
1766
2805
|
}
|
|
1767
2806
|
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
|
|
@@ -1774,9 +2813,9 @@ let tt = class {
|
|
|
1774
2813
|
// вести trial-стейт «осталось N показов» под юзером, который вообще не
|
|
1775
2814
|
// должен увидеть пейвол по таргетингу — бессмысленно: при возврате в
|
|
1776
2815
|
// правильную страну он окажется со «слипшимся» триал-счётчиком.
|
|
1777
|
-
runOpenGates(e,
|
|
2816
|
+
runOpenGates(e, r, n) {
|
|
1778
2817
|
if (!n.skipVisibility) {
|
|
1779
|
-
const i =
|
|
2818
|
+
const i = r.settings.visibility;
|
|
1780
2819
|
if (i && (this.lastVisibility = i, !i.visible)) {
|
|
1781
2820
|
this.emit("visibility_blocked", i);
|
|
1782
2821
|
return;
|
|
@@ -1786,66 +2825,75 @@ let tt = class {
|
|
|
1786
2825
|
this.mountAndShow(e, { renew: n.renew });
|
|
1787
2826
|
return;
|
|
1788
2827
|
}
|
|
1789
|
-
this.gateThroughTrial(e,
|
|
2828
|
+
this.gateThroughTrial(e, r, n.renew);
|
|
1790
2829
|
}
|
|
1791
|
-
gateThroughTrial(e,
|
|
1792
|
-
const i =
|
|
2830
|
+
gateThroughTrial(e, r, n) {
|
|
2831
|
+
const i = r.settings.trial;
|
|
1793
2832
|
if (!i) {
|
|
1794
2833
|
this.mountAndShow(e, { renew: n });
|
|
1795
2834
|
return;
|
|
1796
2835
|
}
|
|
1797
2836
|
const s = this.ensureTrialStore(i);
|
|
1798
|
-
s.check().then(async (
|
|
1799
|
-
if (this.lastTrialStatus =
|
|
2837
|
+
s.check().then(async (a) => {
|
|
2838
|
+
if (this.lastTrialStatus = a, a.mode === "none") {
|
|
1800
2839
|
this.mountAndShow(e, { renew: n });
|
|
1801
2840
|
return;
|
|
1802
2841
|
}
|
|
1803
|
-
if (
|
|
1804
|
-
const
|
|
1805
|
-
this.lastTrialStatus =
|
|
2842
|
+
if (a.blocked) {
|
|
2843
|
+
const c = await s.recordBlock();
|
|
2844
|
+
this.lastTrialStatus = c, this.emit("trial_blocked", c);
|
|
1806
2845
|
return;
|
|
1807
2846
|
}
|
|
1808
2847
|
this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(e, { renew: n });
|
|
1809
|
-
}).catch((
|
|
1810
|
-
typeof console < "u" && console.warn("[paywall] trial check failed",
|
|
2848
|
+
}).catch((a) => {
|
|
2849
|
+
typeof console < "u" && console.warn("[paywall] trial check failed", a), this.mountAndShow(e, { renew: n });
|
|
1811
2850
|
});
|
|
1812
2851
|
}
|
|
1813
2852
|
ensureTrialStore(e) {
|
|
1814
|
-
if (this.trialStore && this.trialStoreConfig &&
|
|
2853
|
+
if (this.trialStore && this.trialStoreConfig && br(this.trialStoreConfig, e))
|
|
1815
2854
|
return this.trialStore;
|
|
1816
2855
|
this.trialStoreConfig = e;
|
|
1817
|
-
const
|
|
1818
|
-
return this.trialStore = typeof
|
|
2856
|
+
const r = this.billing.createTrialStore;
|
|
2857
|
+
return this.trialStore = typeof r == "function" ? r.call(this.billing, e) : De(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
|
|
1819
2858
|
}
|
|
1820
|
-
mountAndShow(e,
|
|
1821
|
-
const n =
|
|
2859
|
+
mountAndShow(e, r = {}) {
|
|
2860
|
+
const n = r.renew === !0, i = r.authMode;
|
|
1822
2861
|
if (this.handle) {
|
|
1823
|
-
this.isOpen = !0, this.handle.update({
|
|
2862
|
+
this.isOpen = !0, this.handle.update({
|
|
2863
|
+
open: !0,
|
|
2864
|
+
initialView: e,
|
|
2865
|
+
initialAuthMode: i,
|
|
2866
|
+
purchased: !1,
|
|
2867
|
+
renew: n
|
|
2868
|
+
}), this.emit("open");
|
|
1824
2869
|
return;
|
|
1825
2870
|
}
|
|
1826
|
-
this.isOpen = !0, this.handle =
|
|
1827
|
-
|
|
2871
|
+
this.isOpen = !0, this.handle = Qe(
|
|
2872
|
+
or,
|
|
1828
2873
|
{
|
|
1829
2874
|
client: this.billing,
|
|
1830
2875
|
open: !0,
|
|
1831
2876
|
initialView: e,
|
|
2877
|
+
initialAuthMode: i,
|
|
1832
2878
|
purchased: !1,
|
|
1833
2879
|
renew: n,
|
|
1834
2880
|
onClose: () => this.close(),
|
|
1835
|
-
onEvent: (
|
|
1836
|
-
this.emit(
|
|
2881
|
+
onEvent: (s, a) => {
|
|
2882
|
+
this.emit(s, a), s === "checkout_started" && this.startUserWatcher();
|
|
1837
2883
|
},
|
|
1838
|
-
onState: (
|
|
2884
|
+
onState: (s) => this.applyState(s),
|
|
2885
|
+
inline: this.inline,
|
|
2886
|
+
locale: this.forceLocale
|
|
1839
2887
|
},
|
|
1840
|
-
{ host: this.host, shadowMode: this.shadowMode }
|
|
2888
|
+
{ host: this.host, shadowMode: this.shadowMode, inline: this.inline }
|
|
1841
2889
|
), this.emit("open");
|
|
1842
2890
|
}
|
|
1843
2891
|
applyState(e) {
|
|
1844
|
-
if (!
|
|
2892
|
+
if (!xr(this.currentState, e)) {
|
|
1845
2893
|
this.currentState = e;
|
|
1846
|
-
for (const
|
|
2894
|
+
for (const r of this.stateListeners)
|
|
1847
2895
|
try {
|
|
1848
|
-
|
|
2896
|
+
r(e);
|
|
1849
2897
|
} catch (n) {
|
|
1850
2898
|
console.warn("[paywall] onStateChange listener threw", n);
|
|
1851
2899
|
}
|
|
@@ -1872,9 +2920,9 @@ let tt = class {
|
|
|
1872
2920
|
*
|
|
1873
2921
|
* Возвращает unsubscribe.
|
|
1874
2922
|
*/
|
|
1875
|
-
onStateChange(e,
|
|
2923
|
+
onStateChange(e, r = {}) {
|
|
1876
2924
|
this.stateListeners.add(e);
|
|
1877
|
-
const n =
|
|
2925
|
+
const n = r.immediate ?? "microtask";
|
|
1878
2926
|
if (n !== "none") {
|
|
1879
2927
|
const i = this.currentState;
|
|
1880
2928
|
if (n === "sync")
|
|
@@ -1919,6 +2967,36 @@ let tt = class {
|
|
|
1919
2967
|
getCachedPrices() {
|
|
1920
2968
|
return this.billing.getCachedPrices();
|
|
1921
2969
|
}
|
|
2970
|
+
/** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
|
|
2971
|
+
* Бэк уже применил серверный targeting (страны/email/режим) — наружу
|
|
2972
|
+
* выезжает только то, что применимо к текущему юзеру. */
|
|
2973
|
+
getCachedOffers() {
|
|
2974
|
+
return this.billing.getCachedOffers();
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Резолвит активный offer для конкретной цены: price_id-таргетинг +
|
|
2978
|
+
* countdown (`expires_at` ИЛИ `duration_minutes` от первого открытия
|
|
2979
|
+
* пейвола, см. clientStorage `pw-offer-{id}-start`).
|
|
2980
|
+
*
|
|
2981
|
+
* Read-only — НЕ записывает start для `duration_minutes`-офферов. Запись
|
|
2982
|
+
* стартует только когда модалка реально открыта (renderer'ом). До этого
|
|
2983
|
+
* `getOfferForPrice` вернёт `null` для duration-only офферов, чтобы
|
|
2984
|
+
* страницы-хосты вне модалки (pricing, landing) не активировали countdown
|
|
2985
|
+
* раньше времени.
|
|
2986
|
+
*
|
|
2987
|
+
* Хост-странице нужен countdown, который тикает каждую секунду — для
|
|
2988
|
+
* этого использовать React-хук `usePaywallOffer(priceId)` из sdk-react
|
|
2989
|
+
* либо обёртку поверх `setInterval(1000)` + повторный вызов этого метода.
|
|
2990
|
+
*/
|
|
2991
|
+
getOfferForPrice(e) {
|
|
2992
|
+
const r = this.billing.getCachedOffers();
|
|
2993
|
+
if (!r) return null;
|
|
2994
|
+
const n = $(r, e);
|
|
2995
|
+
return n ? Ze(n, {
|
|
2996
|
+
now: Date.now(),
|
|
2997
|
+
readStart: Xe
|
|
2998
|
+
}) : null;
|
|
2999
|
+
}
|
|
1922
3000
|
/** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
|
|
1923
3001
|
* Используй, чтобы синхронизировать i18n host'а с тем, что фактически
|
|
1924
3002
|
* показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
|
|
@@ -1947,50 +3025,50 @@ let tt = class {
|
|
|
1947
3025
|
* `getAccess()`, а не только после первого `open()`.
|
|
1948
3026
|
*/
|
|
1949
3027
|
async getAccess(e = {}) {
|
|
1950
|
-
let
|
|
1951
|
-
if (!
|
|
3028
|
+
let r = this.billing.getCachedBootstrap();
|
|
3029
|
+
if (!r)
|
|
1952
3030
|
try {
|
|
1953
|
-
|
|
3031
|
+
r = await this.billing.bootstrap({ signal: e.signal });
|
|
1954
3032
|
} catch {
|
|
1955
|
-
const
|
|
1956
|
-
return
|
|
3033
|
+
const a = this.billing.getCachedUser();
|
|
3034
|
+
return a?.has_active_subscription ? {
|
|
1957
3035
|
access: "granted",
|
|
1958
3036
|
reason: "has_subscription",
|
|
1959
3037
|
visibility: null,
|
|
1960
3038
|
trial: null,
|
|
1961
|
-
user:
|
|
3039
|
+
user: a
|
|
1962
3040
|
} : {
|
|
1963
3041
|
access: "blocked",
|
|
1964
3042
|
reason: "no_subscription",
|
|
1965
3043
|
visibility: null,
|
|
1966
3044
|
trial: null,
|
|
1967
|
-
user:
|
|
3045
|
+
user: a
|
|
1968
3046
|
};
|
|
1969
3047
|
}
|
|
1970
|
-
const n =
|
|
3048
|
+
const n = r.user ?? null;
|
|
1971
3049
|
if (n?.has_active_subscription)
|
|
1972
3050
|
return {
|
|
1973
3051
|
access: "granted",
|
|
1974
3052
|
reason: "has_subscription",
|
|
1975
|
-
visibility:
|
|
3053
|
+
visibility: r.settings.visibility ?? null,
|
|
1976
3054
|
trial: null,
|
|
1977
3055
|
user: n
|
|
1978
3056
|
};
|
|
1979
3057
|
let i = null;
|
|
1980
3058
|
if (!e.skipVisibility) {
|
|
1981
|
-
const
|
|
1982
|
-
if (
|
|
3059
|
+
const a = r.settings.visibility;
|
|
3060
|
+
if (a && (i = a, this.lastVisibility = a, !a.visible))
|
|
1983
3061
|
return { access: "granted", reason: "visibility_blocked", visibility: i, trial: null, user: n };
|
|
1984
3062
|
}
|
|
1985
3063
|
let s = null;
|
|
1986
3064
|
if (!e.skipTrial) {
|
|
1987
|
-
const
|
|
1988
|
-
if (
|
|
3065
|
+
const a = r.settings.trial;
|
|
3066
|
+
if (a)
|
|
1989
3067
|
try {
|
|
1990
|
-
if (s = await this.ensureTrialStore(
|
|
3068
|
+
if (s = await this.ensureTrialStore(a).check(), this.lastTrialStatus = s, s.blocked)
|
|
1991
3069
|
return { access: "granted", reason: "trial_blocked", visibility: i, trial: s, user: n };
|
|
1992
|
-
} catch (
|
|
1993
|
-
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed",
|
|
3070
|
+
} catch (c) {
|
|
3071
|
+
typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", c);
|
|
1994
3072
|
}
|
|
1995
3073
|
}
|
|
1996
3074
|
return { access: "blocked", reason: "no_subscription", visibility: i, trial: s, user: n };
|
|
@@ -2007,14 +3085,14 @@ let tt = class {
|
|
|
2007
3085
|
// В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
|
|
2008
3086
|
// bootstrap при следующем открытии.
|
|
2009
3087
|
startUserWatcher() {
|
|
2010
|
-
this.watcher ||
|
|
3088
|
+
this.watcher || fr() && (this.watcher = new pr({
|
|
2011
3089
|
client: this.billing,
|
|
2012
3090
|
onActive: (e) => {
|
|
2013
3091
|
this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
|
|
2014
|
-
const
|
|
2015
|
-
if (
|
|
3092
|
+
const r = this.billing.getCachedBootstrap()?.settings.success_redirect_url;
|
|
3093
|
+
if (r && typeof window < "u")
|
|
2016
3094
|
try {
|
|
2017
|
-
window.location.assign(
|
|
3095
|
+
window.location.assign(r);
|
|
2018
3096
|
return;
|
|
2019
3097
|
} catch {
|
|
2020
3098
|
}
|
|
@@ -2026,7 +3104,7 @@ let tt = class {
|
|
|
2026
3104
|
}), this.watcher.start());
|
|
2027
3105
|
}
|
|
2028
3106
|
close() {
|
|
2029
|
-
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(
|
|
3107
|
+
!this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(oe), this.emit("close"));
|
|
2030
3108
|
}
|
|
2031
3109
|
/**
|
|
2032
3110
|
* Сканирует текущий URL на маркеры возврата с checkout и эмитит
|
|
@@ -2036,80 +3114,80 @@ let tt = class {
|
|
|
2036
3114
|
*/
|
|
2037
3115
|
checkReturn() {
|
|
2038
3116
|
if (typeof window > "u") return;
|
|
2039
|
-
const e = new URL(window.location.href),
|
|
3117
|
+
const e = new URL(window.location.href), r = ve(e.hash.replace(/^#/, "")), n = ve(e.search.replace(/^\?/, "")), i = r ?? n;
|
|
2040
3118
|
i && (i.status === "paid" ? (this.emit("purchase_completed", {
|
|
2041
3119
|
priceId: i.priceId,
|
|
2042
3120
|
sessionId: i.sessionId
|
|
2043
|
-
}),
|
|
3121
|
+
}), wr(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), kr(e));
|
|
2044
3122
|
}
|
|
2045
3123
|
destroy() {
|
|
2046
|
-
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 =
|
|
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 = oe;
|
|
2047
3125
|
}
|
|
2048
3126
|
};
|
|
2049
|
-
function
|
|
2050
|
-
if (!
|
|
2051
|
-
if (
|
|
2052
|
-
return { auth:
|
|
2053
|
-
const e =
|
|
3127
|
+
function mr(t) {
|
|
3128
|
+
if (!t.auth) return { auth: void 0, ownsAuth: !1 };
|
|
3129
|
+
if (t.auth instanceof ce || yr(t.auth))
|
|
3130
|
+
return { auth: t.auth, ownsAuth: !1 };
|
|
3131
|
+
const e = t.auth === !0 ? {} : t.auth;
|
|
2054
3132
|
return {
|
|
2055
|
-
auth: new
|
|
2056
|
-
paywallId:
|
|
2057
|
-
apiOrigin: e.apiOrigin ??
|
|
2058
|
-
storage: e.storage ??
|
|
2059
|
-
fetch: e.fetch ??
|
|
3133
|
+
auth: new ce({
|
|
3134
|
+
paywallId: t.paywallId,
|
|
3135
|
+
apiOrigin: e.apiOrigin ?? t.apiOrigin,
|
|
3136
|
+
storage: e.storage ?? t.storage,
|
|
3137
|
+
fetch: e.fetch ?? t.fetch,
|
|
2060
3138
|
openPopup: e.openPopup
|
|
2061
3139
|
}),
|
|
2062
3140
|
ownsAuth: !0
|
|
2063
3141
|
};
|
|
2064
3142
|
}
|
|
2065
|
-
function
|
|
2066
|
-
if (typeof
|
|
2067
|
-
const e =
|
|
3143
|
+
function yr(t) {
|
|
3144
|
+
if (typeof t != "object" || t === null) return !1;
|
|
3145
|
+
const e = t;
|
|
2068
3146
|
return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
|
|
2069
3147
|
}
|
|
2070
|
-
function
|
|
2071
|
-
return
|
|
3148
|
+
function xr(t, e) {
|
|
3149
|
+
return t.open === e.open && t.view === e.view && t.error === e.error;
|
|
2072
3150
|
}
|
|
2073
|
-
function
|
|
2074
|
-
return
|
|
3151
|
+
function br(t, e) {
|
|
3152
|
+
return t.mode === e.mode && t.payload === e.payload && t.storage === e.storage;
|
|
2075
3153
|
}
|
|
2076
|
-
function
|
|
2077
|
-
if (!
|
|
2078
|
-
const e = new URLSearchParams(
|
|
2079
|
-
return
|
|
2080
|
-
status:
|
|
2081
|
-
priceId: e.get(
|
|
2082
|
-
sessionId: e.get(
|
|
3154
|
+
function ve(t) {
|
|
3155
|
+
if (!t) return null;
|
|
3156
|
+
const e = new URLSearchParams(t), r = e.get(F.status);
|
|
3157
|
+
return r ? {
|
|
3158
|
+
status: r,
|
|
3159
|
+
priceId: e.get(F.priceId),
|
|
3160
|
+
sessionId: e.get(F.sessionId)
|
|
2083
3161
|
} : null;
|
|
2084
3162
|
}
|
|
2085
|
-
function
|
|
3163
|
+
function wr(t) {
|
|
2086
3164
|
if (!(typeof window > "u" || !window.opener))
|
|
2087
3165
|
try {
|
|
2088
3166
|
window.opener.postMessage(
|
|
2089
3167
|
{
|
|
2090
3168
|
type: "paywall_purchase",
|
|
2091
|
-
status:
|
|
2092
|
-
priceId:
|
|
2093
|
-
sessionId:
|
|
3169
|
+
status: t.status,
|
|
3170
|
+
priceId: t.priceId,
|
|
3171
|
+
sessionId: t.sessionId
|
|
2094
3172
|
},
|
|
2095
3173
|
"*"
|
|
2096
3174
|
);
|
|
2097
3175
|
} catch {
|
|
2098
3176
|
}
|
|
2099
3177
|
}
|
|
2100
|
-
function
|
|
3178
|
+
function kr(t) {
|
|
2101
3179
|
const e = (n, i) => {
|
|
2102
3180
|
if (!n) return "";
|
|
2103
3181
|
const s = new URLSearchParams(n.replace(/^[?#]/, ""));
|
|
2104
|
-
s.delete(
|
|
2105
|
-
const
|
|
2106
|
-
return
|
|
2107
|
-
},
|
|
2108
|
-
window.history.replaceState(null, "",
|
|
3182
|
+
s.delete(F.status), s.delete(F.priceId), s.delete(F.sessionId);
|
|
3183
|
+
const a = s.toString();
|
|
3184
|
+
return a ? i + a : "";
|
|
3185
|
+
}, r = t.pathname + e(t.search, "?") + e(t.hash, "#");
|
|
3186
|
+
window.history.replaceState(null, "", r);
|
|
2109
3187
|
}
|
|
2110
|
-
class
|
|
2111
|
-
constructor(e,
|
|
2112
|
-
this.transport = e, this.paywallId =
|
|
3188
|
+
class vr {
|
|
3189
|
+
constructor(e, r, n) {
|
|
3190
|
+
this.transport = e, this.paywallId = r, this.config = n;
|
|
2113
3191
|
}
|
|
2114
3192
|
async check() {
|
|
2115
3193
|
return this.transport.request("trial.check", {
|
|
@@ -2130,9 +3208,9 @@ class at {
|
|
|
2130
3208
|
});
|
|
2131
3209
|
}
|
|
2132
3210
|
}
|
|
2133
|
-
class
|
|
2134
|
-
constructor(e,
|
|
2135
|
-
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.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId =
|
|
3211
|
+
class _r {
|
|
3212
|
+
constructor(e, r) {
|
|
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 = r.paywallId, this.apiOrigin = r.apiOrigin, this.remoteStorageAdapter = {
|
|
2136
3214
|
getItem: (n) => this.transport.request("storage.get", { key: n }),
|
|
2137
3215
|
setItem: async (n, i) => {
|
|
2138
3216
|
await this.transport.request("storage.set", { key: n, value: i });
|
|
@@ -2151,16 +3229,44 @@ class ct {
|
|
|
2151
3229
|
}
|
|
2152
3230
|
// === Bootstrap ===
|
|
2153
3231
|
async bootstrap(e = {}) {
|
|
2154
|
-
const
|
|
3232
|
+
const r = await this.transport.request(
|
|
2155
3233
|
"billing.bootstrap",
|
|
2156
3234
|
{ force: e.force },
|
|
2157
3235
|
{ signal: e.signal }
|
|
2158
3236
|
);
|
|
2159
|
-
return this.
|
|
3237
|
+
return this.applyBootstrap(r), r.user && this.applyUser(r.user), r;
|
|
2160
3238
|
}
|
|
2161
3239
|
getCachedBootstrap() {
|
|
2162
3240
|
return this.cachedBootstrap;
|
|
2163
3241
|
}
|
|
3242
|
+
/** Подписка на bootstrap-state. Структурно совместима с
|
|
3243
|
+
* `BillingClient.onBootstrapChange` — те же микротаск-семантики для initial
|
|
3244
|
+
* snapshot. В extension-режиме offscreen пока не broadcast'ит bootstrapChange,
|
|
3245
|
+
* поэтому listener срабатывает только на self-инициированные `bootstrap()`
|
|
3246
|
+
* внутри этого RemoteBillingClient'а (popup перезапрашивает bootstrap → mirror
|
|
3247
|
+
* обновляется → listener вызывается). Cross-surface revalidate (другая вкладка
|
|
3248
|
+
* обновила bootstrap) не доезжает до popup'а — для этого нужен отдельный
|
|
3249
|
+
* bootstrapChange-broadcast в protocol.ts/server.ts. */
|
|
3250
|
+
onBootstrapChange(e, r = {}) {
|
|
3251
|
+
this.bootstrapListeners.add(e);
|
|
3252
|
+
const n = r.immediate ?? "microtask";
|
|
3253
|
+
if (this.cachedBootstrap && n !== "none") {
|
|
3254
|
+
const i = this.cachedBootstrap;
|
|
3255
|
+
if (n === "sync")
|
|
3256
|
+
try {
|
|
3257
|
+
e(i);
|
|
3258
|
+
} catch (s) {
|
|
3259
|
+
console.warn("[paywall] onBootstrapChange initial sync threw", s);
|
|
3260
|
+
}
|
|
3261
|
+
else
|
|
3262
|
+
queueMicrotask(() => {
|
|
3263
|
+
this.bootstrapListeners.has(e) && e(i);
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
return () => {
|
|
3267
|
+
this.bootstrapListeners.delete(e);
|
|
3268
|
+
};
|
|
3269
|
+
}
|
|
2164
3270
|
/** Шорткат над `bootstrap()` — возвращает цены пейвола (locale-оверрайды
|
|
2165
3271
|
* уже применены в offscreen'е). Те же кэш-семантики, что у `bootstrap()`. */
|
|
2166
3272
|
async getPrices(e = {}) {
|
|
@@ -2170,18 +3276,24 @@ class ct {
|
|
|
2170
3276
|
getCachedPrices() {
|
|
2171
3277
|
return this.cachedBootstrap?.prices ?? null;
|
|
2172
3278
|
}
|
|
3279
|
+
/** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
|
|
3280
|
+
* Серверный таргетинг (страны/email/режим) уже применён бэком — наружу
|
|
3281
|
+
* выезжает только то, что применимо к текущему юзеру. */
|
|
3282
|
+
getCachedOffers() {
|
|
3283
|
+
return this.cachedBootstrap?.offers ?? null;
|
|
3284
|
+
}
|
|
2173
3285
|
// === Visitor ===
|
|
2174
3286
|
async getVisitorId() {
|
|
2175
3287
|
return this.transport.request("billing.getVisitorId", void 0);
|
|
2176
3288
|
}
|
|
2177
3289
|
// === User ===
|
|
2178
3290
|
async getUser(e = {}) {
|
|
2179
|
-
const
|
|
3291
|
+
const r = await this.transport.request(
|
|
2180
3292
|
"billing.getUser",
|
|
2181
3293
|
{ force: e.force },
|
|
2182
3294
|
{ signal: e.signal }
|
|
2183
3295
|
);
|
|
2184
|
-
return this.applyUser(
|
|
3296
|
+
return this.applyUser(r), r;
|
|
2185
3297
|
}
|
|
2186
3298
|
getCachedUser() {
|
|
2187
3299
|
return this.cachedUser;
|
|
@@ -2189,9 +3301,9 @@ class ct {
|
|
|
2189
3301
|
/** Подписка на user-state. Mirror'имся на broadcast'ы offscreen'а; initial
|
|
2190
3302
|
* snapshot отдаётся через microtask из локального cache (если есть) —
|
|
2191
3303
|
* ровно как в BillingClient.onUserChange. Возвращает функцию отписки. */
|
|
2192
|
-
onUserChange(e,
|
|
3304
|
+
onUserChange(e, r = {}) {
|
|
2193
3305
|
this.userListeners.add(e);
|
|
2194
|
-
const n =
|
|
3306
|
+
const n = r.immediate ?? "microtask";
|
|
2195
3307
|
if (this.cachedUser && n !== "none") {
|
|
2196
3308
|
const i = this.cachedUser;
|
|
2197
3309
|
if (n === "sync")
|
|
@@ -2221,9 +3333,9 @@ class ct {
|
|
|
2221
3333
|
getCachedBalances() {
|
|
2222
3334
|
return this.cachedBalances;
|
|
2223
3335
|
}
|
|
2224
|
-
onBalanceChange(e,
|
|
3336
|
+
onBalanceChange(e, r = {}) {
|
|
2225
3337
|
this.balanceListeners.add(e);
|
|
2226
|
-
const n =
|
|
3338
|
+
const n = r.immediate ?? "microtask";
|
|
2227
3339
|
if (this.cachedBalances && n !== "none") {
|
|
2228
3340
|
const i = this.cachedBalances;
|
|
2229
3341
|
if (n === "sync")
|
|
@@ -2243,8 +3355,8 @@ class ct {
|
|
|
2243
3355
|
}
|
|
2244
3356
|
// === Checkout ===
|
|
2245
3357
|
async createCheckout(e) {
|
|
2246
|
-
const { signal:
|
|
2247
|
-
return this.transport.request("billing.createCheckout", n, { signal:
|
|
3358
|
+
const { signal: r, ...n } = e;
|
|
3359
|
+
return this.transport.request("billing.createCheckout", n, { signal: r });
|
|
2248
3360
|
}
|
|
2249
3361
|
// === Customer portal: list/cancel purchases ===
|
|
2250
3362
|
/** Rich-shape список покупок юзера (с ценой, валютой, interval, discount,
|
|
@@ -2256,12 +3368,19 @@ class ct {
|
|
|
2256
3368
|
signal: e.signal
|
|
2257
3369
|
})];
|
|
2258
3370
|
}
|
|
3371
|
+
/** Саппорт-тикет через offscreen'овский BillingClient. File-объекты
|
|
3372
|
+
* переживают chrome.runtime structured-clone (port forward'ит as-is) —
|
|
3373
|
+
* Bearer-токен/email-substitution делает offscreen, как в обычном
|
|
3374
|
+
* BillingClient. */
|
|
3375
|
+
async createSupportTicket(e) {
|
|
3376
|
+
return this.transport.request("billing.createSupportTicket", e);
|
|
3377
|
+
}
|
|
2259
3378
|
/** Отменить подписку через бэк. По умолчанию cancel в конце текущего
|
|
2260
3379
|
* периода (юзер сохраняет access до renewal date'ы). reason обязательна
|
|
2261
3380
|
* (валидируется бэком) — собирается через select причин в host-UI. */
|
|
2262
3381
|
async cancelSubscription(e) {
|
|
2263
|
-
const { signal:
|
|
2264
|
-
return this.transport.request("billing.cancelSubscription", n, { signal:
|
|
3382
|
+
const { signal: r, ...n } = e;
|
|
3383
|
+
return this.transport.request("billing.cancelSubscription", n, { signal: r });
|
|
2265
3384
|
}
|
|
2266
3385
|
// === Storage ===
|
|
2267
3386
|
/** PaywallUI просит storage у billing-клиента для TrialStore и других
|
|
@@ -2276,7 +3395,7 @@ class ct {
|
|
|
2276
3395
|
* read-modify-write. PaywallUI duck-types этот метод и предпочитает его
|
|
2277
3396
|
* локальной фабрике, если он есть. */
|
|
2278
3397
|
createTrialStore(e) {
|
|
2279
|
-
return new
|
|
3398
|
+
return new vr(this.transport, this.paywallId, e);
|
|
2280
3399
|
}
|
|
2281
3400
|
// === Identity ===
|
|
2282
3401
|
getIdentity() {
|
|
@@ -2293,51 +3412,60 @@ class ct {
|
|
|
2293
3412
|
return this.identity = e, e;
|
|
2294
3413
|
}
|
|
2295
3414
|
destroy() {
|
|
2296
|
-
this.unsubUserBroadcast?.(), this.unsubBalancesBroadcast?.(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.userListeners.clear(), this.balanceListeners.clear(), this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null;
|
|
3415
|
+
this.unsubUserBroadcast?.(), this.unsubBalancesBroadcast?.(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.userListeners.clear(), this.balanceListeners.clear(), this.bootstrapListeners.clear(), this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null;
|
|
3416
|
+
}
|
|
3417
|
+
applyBootstrap(e) {
|
|
3418
|
+
this.cachedBootstrap = e;
|
|
3419
|
+
for (const r of [...this.bootstrapListeners])
|
|
3420
|
+
try {
|
|
3421
|
+
r(e);
|
|
3422
|
+
} catch (n) {
|
|
3423
|
+
console.warn("[paywall] onBootstrapChange listener threw", n);
|
|
3424
|
+
}
|
|
2297
3425
|
}
|
|
2298
3426
|
/** Обновить mirror user'а и эмитнуть listener'ам если он реально изменился.
|
|
2299
3427
|
* Используется и для self-инициированных RPC (bootstrap/getUser), и для
|
|
2300
3428
|
* broadcast'ов от offscreen — чтобы host'овский onUserChange handler
|
|
2301
3429
|
* получил signal независимо от того, кто триггернул обновление. */
|
|
2302
3430
|
applyUser(e) {
|
|
2303
|
-
|
|
3431
|
+
Sr(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
|
|
2304
3432
|
}
|
|
2305
3433
|
applyBalances(e) {
|
|
2306
|
-
|
|
3434
|
+
Cr(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
|
|
2307
3435
|
}
|
|
2308
3436
|
fireUserListeners(e) {
|
|
2309
|
-
for (const
|
|
3437
|
+
for (const r of [...this.userListeners])
|
|
2310
3438
|
try {
|
|
2311
|
-
|
|
3439
|
+
r(e);
|
|
2312
3440
|
} catch (n) {
|
|
2313
3441
|
console.warn("[paywall] onUserChange listener threw", n);
|
|
2314
3442
|
}
|
|
2315
3443
|
}
|
|
2316
3444
|
fireBalanceListeners(e) {
|
|
2317
|
-
for (const
|
|
3445
|
+
for (const r of [...this.balanceListeners])
|
|
2318
3446
|
try {
|
|
2319
|
-
|
|
3447
|
+
r(e);
|
|
2320
3448
|
} catch (n) {
|
|
2321
3449
|
console.warn("[paywall] onBalanceChange listener threw", n);
|
|
2322
3450
|
}
|
|
2323
3451
|
}
|
|
2324
3452
|
}
|
|
2325
|
-
function
|
|
2326
|
-
return
|
|
3453
|
+
function Sr(t, e) {
|
|
3454
|
+
return t === e ? !0 : !t || !e ? !1 : t.has_active_subscription === e.has_active_subscription && (t.purchases?.length ?? 0) === (e.purchases?.length ?? 0);
|
|
2327
3455
|
}
|
|
2328
|
-
function
|
|
2329
|
-
if (
|
|
2330
|
-
if (!
|
|
2331
|
-
for (let
|
|
2332
|
-
if (r
|
|
3456
|
+
function Cr(t, e) {
|
|
3457
|
+
if (t === e) return !0;
|
|
3458
|
+
if (!t || !e || t.length !== e.length) return !1;
|
|
3459
|
+
for (let r = 0; r < t.length; r++)
|
|
3460
|
+
if (t[r].type !== e[r].type || t[r].count !== e[r].count) return !1;
|
|
2333
3461
|
return !0;
|
|
2334
3462
|
}
|
|
2335
|
-
class
|
|
2336
|
-
constructor(e,
|
|
2337
|
-
this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId =
|
|
2338
|
-
this.applySession(n);
|
|
3463
|
+
class Ir {
|
|
3464
|
+
constructor(e, r) {
|
|
3465
|
+
this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = r.paywallId, this.apiOrigin = r.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", ({ event: n, session: i }) => {
|
|
3466
|
+
this.applySession(n, i);
|
|
2339
3467
|
}), this.hydrated = this.transport.request("auth.getCachedSession", void 0).then((n) => {
|
|
2340
|
-
this.session === null && n !== null && this.
|
|
3468
|
+
this.session === null && n !== null && (this.session = n);
|
|
2341
3469
|
}).catch(() => {
|
|
2342
3470
|
});
|
|
2343
3471
|
}
|
|
@@ -2353,39 +3481,40 @@ class dt {
|
|
|
2353
3481
|
return this.session?.user ?? null;
|
|
2354
3482
|
}
|
|
2355
3483
|
onAuthChange(e) {
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
3484
|
+
return this.listeners.add(e), this.hydrated.then(() => {
|
|
3485
|
+
if (this.listeners.has(e))
|
|
3486
|
+
try {
|
|
3487
|
+
e("INITIAL_SESSION", this.session);
|
|
3488
|
+
} catch (r) {
|
|
3489
|
+
console.warn("[paywall] onAuthChange INITIAL_SESSION threw", r);
|
|
3490
|
+
}
|
|
3491
|
+
}), () => {
|
|
2363
3492
|
this.listeners.delete(e);
|
|
2364
3493
|
};
|
|
2365
3494
|
}
|
|
2366
3495
|
// === Email/password ===
|
|
2367
3496
|
async signInWithEmail(e) {
|
|
2368
|
-
const
|
|
2369
|
-
return this.applySession(
|
|
3497
|
+
const r = await this.transport.request("auth.signInWithEmail", e);
|
|
3498
|
+
return this.applySession("SIGNED_IN", r), r;
|
|
2370
3499
|
}
|
|
2371
3500
|
async signUp(e) {
|
|
2372
|
-
const
|
|
2373
|
-
return
|
|
3501
|
+
const r = await this.transport.request("auth.signUp", e);
|
|
3502
|
+
return r.kind === "signed_in" && this.applySession("SIGNED_IN", r.session), r;
|
|
2374
3503
|
}
|
|
2375
3504
|
async signOut() {
|
|
2376
3505
|
await this.transport.request("auth.signOut", void 0);
|
|
2377
3506
|
}
|
|
2378
3507
|
async refresh() {
|
|
2379
3508
|
const e = await this.transport.request("auth.refresh", void 0);
|
|
2380
|
-
return this.applySession(e), e;
|
|
3509
|
+
return this.applySession(e ? "TOKEN_REFRESHED" : "SIGNED_OUT", e), e;
|
|
2381
3510
|
}
|
|
2382
3511
|
// === OTP / password reset / confirmation ===
|
|
2383
3512
|
async sendOtp(e) {
|
|
2384
3513
|
await this.transport.request("auth.sendOtp", e);
|
|
2385
3514
|
}
|
|
2386
3515
|
async verifyOtp(e) {
|
|
2387
|
-
const
|
|
2388
|
-
return this.applySession(
|
|
3516
|
+
const r = await this.transport.request("auth.verifyOtp", e);
|
|
3517
|
+
return this.applySession(e.type === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", r), r;
|
|
2389
3518
|
}
|
|
2390
3519
|
async resendConfirmation(e) {
|
|
2391
3520
|
await this.transport.request("auth.resendConfirmation", e);
|
|
@@ -2399,18 +3528,24 @@ class dt {
|
|
|
2399
3528
|
async revokeAllSessions() {
|
|
2400
3529
|
await this.transport.request("auth.revokeAllSessions", void 0);
|
|
2401
3530
|
}
|
|
3531
|
+
/** Last-used auth method + email — читается из offscreen-storage. AuthPanel
|
|
3532
|
+
* использует для "Last used"-бейджа и pre-fill'а email. Storage paywall-
|
|
3533
|
+
* scoped, и offscreen — единый источник правды для всех вкладок/popup'ов. */
|
|
3534
|
+
async getLastLogin() {
|
|
3535
|
+
return this.transport.request("auth.getLastLogin", void 0);
|
|
3536
|
+
}
|
|
2402
3537
|
// === Anonymous sign-in ===
|
|
2403
3538
|
/** Анонимный sign-in (Supabase user без email). Логика (idempotent-check +
|
|
2404
3539
|
* resume через сохранённый refresh_token + fresh signin) живёт в
|
|
2405
3540
|
* offscreen-AuthClient'е — content только проксирует. captchaToken и
|
|
2406
|
-
*
|
|
3541
|
+
* forceNewAnon — pass-through для forward-compat / switch-account flow. */
|
|
2407
3542
|
async signInAnonymously(e = {}) {
|
|
2408
|
-
const
|
|
3543
|
+
const r = await this.transport.request("auth.signInAnonymously", {
|
|
2409
3544
|
captchaToken: e.captchaToken,
|
|
2410
3545
|
userMeta: e.userMeta,
|
|
2411
|
-
|
|
3546
|
+
forceNewAnon: e.forceNewAnon
|
|
2412
3547
|
});
|
|
2413
|
-
return this.applySession(
|
|
3548
|
+
return this.applySession("SIGNED_IN", r), r;
|
|
2414
3549
|
}
|
|
2415
3550
|
/** Текущий access token (lazy-refreshable в offscreen'е). content/popup
|
|
2416
3551
|
* использует для Bearer'а в внешние fetch'и — ApiGatewayClient в
|
|
@@ -2437,13 +3572,13 @@ class dt {
|
|
|
2437
3572
|
async signInWithOAuth(e) {
|
|
2438
3573
|
if (typeof window > "u")
|
|
2439
3574
|
throw new T("oauth_unavailable", "window is required for OAuth");
|
|
2440
|
-
const
|
|
3575
|
+
const r = `pw-oauth-pending-${Math.random().toString(36).slice(2, 10)}`, n = window.open("about:blank", r, "width=480,height=640,popup=yes");
|
|
2441
3576
|
if (!n)
|
|
2442
3577
|
throw new T(
|
|
2443
3578
|
"popup_blocked",
|
|
2444
3579
|
"browser blocked auth popup — call from a user gesture"
|
|
2445
3580
|
);
|
|
2446
|
-
|
|
3581
|
+
Mr(n, e.provider);
|
|
2447
3582
|
try {
|
|
2448
3583
|
const { authorizeUrl: i, state: s } = await this.transport.request("auth.oauthStart", {
|
|
2449
3584
|
provider: e.provider,
|
|
@@ -2451,8 +3586,8 @@ class dt {
|
|
|
2451
3586
|
userMeta: e.userMeta
|
|
2452
3587
|
});
|
|
2453
3588
|
n.name = `pw-oauth-${s}`, n.location.replace(i), e.onPopupOpened?.();
|
|
2454
|
-
const
|
|
2455
|
-
return this.applySession(
|
|
3589
|
+
const a = await ze(n, s), c = await this.transport.request("auth.oauthExchange", { state: s, code: a });
|
|
3590
|
+
return this.applySession("SIGNED_IN", c), c;
|
|
2456
3591
|
} catch (i) {
|
|
2457
3592
|
try {
|
|
2458
3593
|
n.close();
|
|
@@ -2464,56 +3599,56 @@ class dt {
|
|
|
2464
3599
|
destroy() {
|
|
2465
3600
|
this.unsubBroadcast?.(), this.unsubBroadcast = null, this.listeners.clear(), this.session = null;
|
|
2466
3601
|
}
|
|
2467
|
-
applySession(e) {
|
|
2468
|
-
if (!
|
|
2469
|
-
this.session =
|
|
2470
|
-
for (const
|
|
3602
|
+
applySession(e, r) {
|
|
3603
|
+
if (!Ar(this.session, r)) {
|
|
3604
|
+
this.session = r;
|
|
3605
|
+
for (const n of [...this.listeners])
|
|
2471
3606
|
try {
|
|
2472
|
-
|
|
2473
|
-
} catch (
|
|
2474
|
-
console.warn("[paywall] onAuthChange listener threw",
|
|
3607
|
+
n(e, r);
|
|
3608
|
+
} catch (i) {
|
|
3609
|
+
console.warn("[paywall] onAuthChange listener threw", i);
|
|
2475
3610
|
}
|
|
2476
3611
|
}
|
|
2477
3612
|
}
|
|
2478
3613
|
}
|
|
2479
|
-
function
|
|
2480
|
-
return
|
|
3614
|
+
function Ar(t, e) {
|
|
3615
|
+
return t === e ? !0 : !t || !e ? !1 : t.access_token === e.access_token && t.refresh_token === e.refresh_token && t.expires_at === e.expires_at && t.user.id === e.user.id;
|
|
2481
3616
|
}
|
|
2482
|
-
const
|
|
3617
|
+
const Lr = {
|
|
2483
3618
|
google: "Google",
|
|
2484
3619
|
apple: "Apple",
|
|
2485
3620
|
github: "GitHub",
|
|
2486
3621
|
facebook: "Facebook"
|
|
2487
3622
|
};
|
|
2488
|
-
function
|
|
2489
|
-
const
|
|
3623
|
+
function Mr(t, e) {
|
|
3624
|
+
const r = Lr[e] ?? e;
|
|
2490
3625
|
try {
|
|
2491
|
-
const n =
|
|
2492
|
-
n.title = `Sign in with ${
|
|
3626
|
+
const n = t.document;
|
|
3627
|
+
n.title = `Sign in with ${r}`;
|
|
2493
3628
|
const i = n.createElement("style");
|
|
2494
3629
|
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);
|
|
2495
3630
|
const s = n.createElement("div");
|
|
2496
3631
|
s.className = "pw-oauth-wrap";
|
|
2497
|
-
const l = n.createElement("div");
|
|
2498
|
-
l.className = "pw-oauth-spinner";
|
|
2499
3632
|
const a = n.createElement("div");
|
|
2500
|
-
a.className = "pw-oauth-
|
|
3633
|
+
a.className = "pw-oauth-spinner";
|
|
3634
|
+
const c = n.createElement("div");
|
|
3635
|
+
c.className = "pw-oauth-label", c.textContent = `Connecting to ${r}…`, s.appendChild(a), s.appendChild(c), n.body.appendChild(s);
|
|
2501
3636
|
} catch {
|
|
2502
3637
|
}
|
|
2503
3638
|
}
|
|
2504
|
-
class
|
|
3639
|
+
class Er {
|
|
2505
3640
|
constructor(e) {
|
|
2506
3641
|
this.transport = e;
|
|
2507
3642
|
}
|
|
2508
3643
|
/** Отправить событие. Fire-and-forget — не возвращает Promise, не throw'ает.
|
|
2509
3644
|
* Сетевые/транспортные ошибки логируются в console и не блокируют caller. */
|
|
2510
|
-
track(e,
|
|
2511
|
-
typeof e != "string" || e.length === 0 || this.transport.request("tracker.track", { name: e, props:
|
|
3645
|
+
track(e, r) {
|
|
3646
|
+
typeof e != "string" || e.length === 0 || this.transport.request("tracker.track", { name: e, props: r }).catch((n) => {
|
|
2512
3647
|
console.warn("[paywall] track failed", n);
|
|
2513
3648
|
});
|
|
2514
3649
|
}
|
|
2515
3650
|
}
|
|
2516
|
-
class
|
|
3651
|
+
class Pr {
|
|
2517
3652
|
constructor(e) {
|
|
2518
3653
|
this.factory = e, this.channel = null, this.channelDisposers = [], this.pending = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.destroyed = !1, this.nextId = 0, this.clientId = `c-${Math.random().toString(36).slice(2, 10)}`;
|
|
2519
3654
|
}
|
|
@@ -2525,29 +3660,29 @@ class yt {
|
|
|
2525
3660
|
if (this.channel) return this.channel;
|
|
2526
3661
|
const e = this.factory();
|
|
2527
3662
|
this.channel = e;
|
|
2528
|
-
const
|
|
2529
|
-
return this.channelDisposers = [
|
|
2530
|
-
protocolVersion:
|
|
3663
|
+
const r = e.onMessage((i) => this.handleMessage(i)), n = e.onDisconnect(() => this.handleDisconnect());
|
|
3664
|
+
return this.channelDisposers = [r, n], this.request("handshake", {
|
|
3665
|
+
protocolVersion: X,
|
|
2531
3666
|
clientId: this.clientId
|
|
2532
3667
|
}).then((i) => {
|
|
2533
|
-
i.protocolVersion !==
|
|
2534
|
-
`[sdk-extension] protocol version mismatch: client=${
|
|
3668
|
+
i.protocolVersion !== X && console.warn(
|
|
3669
|
+
`[sdk-extension] protocol version mismatch: client=${X}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
|
|
2535
3670
|
);
|
|
2536
3671
|
}).catch(() => {
|
|
2537
3672
|
}), e;
|
|
2538
3673
|
}
|
|
2539
3674
|
handleMessage(e) {
|
|
2540
|
-
if (
|
|
3675
|
+
if (Br(e)) {
|
|
2541
3676
|
if (e.type === "response") {
|
|
2542
|
-
const
|
|
2543
|
-
if (!
|
|
2544
|
-
this.pending.delete(e.id),
|
|
3677
|
+
const r = this.pending.get(e.id);
|
|
3678
|
+
if (!r) return;
|
|
3679
|
+
this.pending.delete(e.id), r.signal?.removeEventListener("abort", r.abortListener), e.ok ? r.resolve(e.result) : r.reject(Ne(e.error));
|
|
2545
3680
|
return;
|
|
2546
3681
|
}
|
|
2547
3682
|
if (e.type === "event") {
|
|
2548
|
-
const
|
|
2549
|
-
if (!
|
|
2550
|
-
for (const n of [...
|
|
3683
|
+
const r = this.listeners.get(e.kind);
|
|
3684
|
+
if (!r) return;
|
|
3685
|
+
for (const n of [...r])
|
|
2551
3686
|
try {
|
|
2552
3687
|
n(e.payload);
|
|
2553
3688
|
} catch (i) {
|
|
@@ -2557,51 +3692,51 @@ class yt {
|
|
|
2557
3692
|
}
|
|
2558
3693
|
}
|
|
2559
3694
|
handleDisconnect() {
|
|
2560
|
-
for (const
|
|
3695
|
+
for (const r of this.channelDisposers) r();
|
|
2561
3696
|
this.channelDisposers = [], this.channel = null;
|
|
2562
3697
|
const e = Array.from(this.pending.values());
|
|
2563
3698
|
this.pending.clear();
|
|
2564
|
-
for (const
|
|
2565
|
-
|
|
3699
|
+
for (const r of e)
|
|
3700
|
+
r.signal?.removeEventListener("abort", r.abortListener), r.reject(new Tr());
|
|
2566
3701
|
}
|
|
2567
|
-
request(e,
|
|
3702
|
+
request(e, r, n = {}) {
|
|
2568
3703
|
if (this.destroyed)
|
|
2569
3704
|
return Promise.reject(new Error("TransportClient destroyed"));
|
|
2570
3705
|
if (n.signal?.aborted)
|
|
2571
3706
|
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
2572
3707
|
const i = this.ensureChannel(), s = `r${++this.nextId}`;
|
|
2573
|
-
return new Promise((
|
|
2574
|
-
const
|
|
2575
|
-
resolve:
|
|
2576
|
-
reject:
|
|
3708
|
+
return new Promise((a, c) => {
|
|
3709
|
+
const l = {
|
|
3710
|
+
resolve: a,
|
|
3711
|
+
reject: c,
|
|
2577
3712
|
signal: n.signal
|
|
2578
3713
|
};
|
|
2579
|
-
n.signal && (
|
|
3714
|
+
n.signal && (l.abortListener = () => {
|
|
2580
3715
|
if (this.pending.delete(s)) {
|
|
2581
|
-
|
|
3716
|
+
c(new DOMException("Aborted", "AbortError"));
|
|
2582
3717
|
try {
|
|
2583
3718
|
i.send({ type: "cancel", id: s });
|
|
2584
3719
|
} catch {
|
|
2585
3720
|
}
|
|
2586
3721
|
}
|
|
2587
|
-
}, n.signal.addEventListener("abort",
|
|
2588
|
-
const
|
|
3722
|
+
}, n.signal.addEventListener("abort", l.abortListener)), this.pending.set(s, l);
|
|
3723
|
+
const f = {
|
|
2589
3724
|
type: "request",
|
|
2590
3725
|
id: s,
|
|
2591
3726
|
kind: e,
|
|
2592
|
-
params:
|
|
3727
|
+
params: r
|
|
2593
3728
|
};
|
|
2594
3729
|
try {
|
|
2595
|
-
i.send(
|
|
2596
|
-
} catch (
|
|
2597
|
-
this.pending.delete(s), n.signal?.removeEventListener("abort",
|
|
3730
|
+
i.send(f);
|
|
3731
|
+
} catch (h) {
|
|
3732
|
+
this.pending.delete(s), n.signal?.removeEventListener("abort", l.abortListener), c(h);
|
|
2598
3733
|
}
|
|
2599
3734
|
});
|
|
2600
3735
|
}
|
|
2601
|
-
on(e,
|
|
3736
|
+
on(e, r) {
|
|
2602
3737
|
let n = this.listeners.get(e);
|
|
2603
3738
|
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n));
|
|
2604
|
-
const i =
|
|
3739
|
+
const i = r;
|
|
2605
3740
|
return n.add(i), this.ensureChannel(), () => {
|
|
2606
3741
|
n.delete(i);
|
|
2607
3742
|
};
|
|
@@ -2609,37 +3744,37 @@ class yt {
|
|
|
2609
3744
|
destroy() {
|
|
2610
3745
|
if (this.destroyed) return;
|
|
2611
3746
|
this.destroyed = !0;
|
|
2612
|
-
for (const
|
|
3747
|
+
for (const r of this.channelDisposers) r();
|
|
2613
3748
|
this.channelDisposers = [], this.listeners.clear();
|
|
2614
3749
|
const e = Array.from(this.pending.values());
|
|
2615
3750
|
this.pending.clear();
|
|
2616
|
-
for (const
|
|
2617
|
-
|
|
3751
|
+
for (const r of e)
|
|
3752
|
+
r.signal?.removeEventListener("abort", r.abortListener), r.reject(new Error("TransportClient destroyed"));
|
|
2618
3753
|
this.channel?.close(), this.channel = null;
|
|
2619
3754
|
}
|
|
2620
3755
|
}
|
|
2621
|
-
class
|
|
3756
|
+
class Tr extends Error {
|
|
2622
3757
|
constructor() {
|
|
2623
3758
|
super("Transport channel disconnected mid-request"), this.code = "transport_disconnected", this.name = "TransportDisconnectedError";
|
|
2624
3759
|
}
|
|
2625
3760
|
}
|
|
2626
|
-
function
|
|
2627
|
-
if (typeof
|
|
2628
|
-
const e =
|
|
3761
|
+
function Br(t) {
|
|
3762
|
+
if (typeof t != "object" || t === null) return !1;
|
|
3763
|
+
const e = t.type;
|
|
2629
3764
|
return e === "request" || e === "response" || e === "event";
|
|
2630
3765
|
}
|
|
2631
|
-
let
|
|
2632
|
-
function
|
|
2633
|
-
return
|
|
3766
|
+
let W = null;
|
|
3767
|
+
function Or() {
|
|
3768
|
+
return W || (W = new Pr(() => qe(Ge)), W);
|
|
2634
3769
|
}
|
|
2635
|
-
class
|
|
3770
|
+
class qr extends gr {
|
|
2636
3771
|
constructor(e) {
|
|
2637
|
-
const
|
|
3772
|
+
const r = Or(), n = new _r(r, {
|
|
2638
3773
|
paywallId: e.paywallId,
|
|
2639
3774
|
apiOrigin: e.apiOrigin
|
|
2640
3775
|
});
|
|
2641
3776
|
let i;
|
|
2642
|
-
e.auth === !0 ? i = new
|
|
3777
|
+
e.auth === !0 ? i = new Ir(r, {
|
|
2643
3778
|
paywallId: e.paywallId,
|
|
2644
3779
|
apiOrigin: e.apiOrigin
|
|
2645
3780
|
}) : e.auth && console.warn(
|
|
@@ -2655,7 +3790,7 @@ class Tt extends tt {
|
|
|
2655
3790
|
// Внутренний EventTracker отключаем — единственный tracker живёт в
|
|
2656
3791
|
// offscreen'е. Манчиально подписываемся ниже.
|
|
2657
3792
|
analytics: !1
|
|
2658
|
-
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new
|
|
3793
|
+
}), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new Er(r), this.bindAnalytics());
|
|
2659
3794
|
}
|
|
2660
3795
|
/** Зеркало sdk/PaywallUI.initTracker'овских биндингов, но с RemoteEventTracker.
|
|
2661
3796
|
* Когда @monetize.software/sdk экспоузнет публичный hook для inject'а tracker'а,
|
|
@@ -2666,46 +3801,46 @@ class Tt extends tt {
|
|
|
2666
3801
|
this.on("open", () => e.track("paywall_opened")),
|
|
2667
3802
|
this.on(
|
|
2668
3803
|
"ready",
|
|
2669
|
-
(
|
|
2670
|
-
is_test_mode:
|
|
2671
|
-
prices_count:
|
|
2672
|
-
offers_count:
|
|
3804
|
+
(r) => e.track("paywall_viewed", {
|
|
3805
|
+
is_test_mode: r.settings.is_test_mode,
|
|
3806
|
+
prices_count: r.prices.length,
|
|
3807
|
+
offers_count: r.offers.length
|
|
2673
3808
|
})
|
|
2674
3809
|
),
|
|
2675
3810
|
this.on(
|
|
2676
3811
|
"price_selected",
|
|
2677
|
-
(
|
|
3812
|
+
(r) => e.track("price_selected", { price_id: r.priceId })
|
|
2678
3813
|
),
|
|
2679
3814
|
this.on(
|
|
2680
3815
|
"checkout_started",
|
|
2681
|
-
(
|
|
3816
|
+
(r) => e.track("checkout_started", { price_id: r.priceId, acquiring: r.acquiring })
|
|
2682
3817
|
),
|
|
2683
3818
|
this.on(
|
|
2684
3819
|
"purchase_completed",
|
|
2685
|
-
(
|
|
3820
|
+
(r) => e.track("purchase_completed", { price_id: r.priceId, session_id: r.sessionId })
|
|
2686
3821
|
),
|
|
2687
|
-
this.on("purchase_failed", (
|
|
3822
|
+
this.on("purchase_failed", (r) => e.track("purchase_failed", { reason: r.reason })),
|
|
2688
3823
|
this.on("close", () => e.track("paywall_closed")),
|
|
2689
3824
|
this.on(
|
|
2690
3825
|
"trial_blocked",
|
|
2691
|
-
(
|
|
2692
|
-
mode:
|
|
2693
|
-
...
|
|
3826
|
+
(r) => e.track("trial_blocked", {
|
|
3827
|
+
mode: r.mode,
|
|
3828
|
+
...r.mode === "time" ? { remaining_ms: r.remainingMs, total_ms: r.totalMs } : r.mode === "opens" ? { remaining_actions: r.remainingActions, total_actions: r.totalActions } : {}
|
|
2694
3829
|
})
|
|
2695
3830
|
),
|
|
2696
3831
|
this.on("trial_expired", () => e.track("trial_expired")),
|
|
2697
3832
|
this.on(
|
|
2698
3833
|
"visibility_blocked",
|
|
2699
|
-
(
|
|
3834
|
+
(r) => e.track("visibility_blocked", { reason: r.reason, country: r.country, tier: r.tier })
|
|
2700
3835
|
),
|
|
2701
|
-
this.on("error", (
|
|
3836
|
+
this.on("error", (r) => e.track("error", { code: r.code, message: r.message }))
|
|
2702
3837
|
);
|
|
2703
3838
|
}
|
|
2704
3839
|
/** Прокси через RemoteEventTracker. Hosts могут вызывать paywall.track
|
|
2705
3840
|
* для произвольных аналитических событий — летит в единственный
|
|
2706
3841
|
* offscreen-tracker наряду с auto-emit'ами PaywallUI. */
|
|
2707
|
-
track(e,
|
|
2708
|
-
this.remoteTracker?.track(e,
|
|
3842
|
+
track(e, r) {
|
|
3843
|
+
this.remoteTracker?.track(e, r);
|
|
2709
3844
|
}
|
|
2710
3845
|
destroy() {
|
|
2711
3846
|
for (const e of this.trackerUnsubs) e();
|
|
@@ -2713,11 +3848,11 @@ class Tt extends tt {
|
|
|
2713
3848
|
}
|
|
2714
3849
|
}
|
|
2715
3850
|
export {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
3851
|
+
X as PROTOCOL_VERSION,
|
|
3852
|
+
qr as PaywallUI,
|
|
3853
|
+
Ir as RemoteAuthClient,
|
|
3854
|
+
_r as RemoteBillingClient,
|
|
3855
|
+
Er as RemoteEventTracker,
|
|
3856
|
+
Or as getContentTransport
|
|
2722
3857
|
};
|
|
2723
3858
|
//# sourceMappingURL=content.js.map
|