@hook-sdk/template 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +382 -332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +307 -257
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/AppRoot.tsx
|
|
2
2
|
import { useMemo as useMemo3 } from "react";
|
|
3
3
|
import { BrowserRouter, MemoryRouter, Navigate, Route, Routes } from "react-router-dom";
|
|
4
|
-
import { useHook as
|
|
4
|
+
import { useHook as useHook8 } from "@hook-sdk/sdk";
|
|
5
5
|
|
|
6
6
|
// src/config/AppConfigContext.tsx
|
|
7
7
|
import { createContext, useContext } from "react";
|
|
@@ -2031,9 +2031,53 @@ function SessionExpiredBanner() {
|
|
|
2031
2031
|
] });
|
|
2032
2032
|
}
|
|
2033
2033
|
|
|
2034
|
+
// src/internal/EmailVerifyBanner.tsx
|
|
2035
|
+
import { useState as useState5 } from "react";
|
|
2036
|
+
import { useHook as useHook5 } from "@hook-sdk/sdk";
|
|
2037
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2038
|
+
function EmailVerifyBanner() {
|
|
2039
|
+
const { user, auth } = useHook5();
|
|
2040
|
+
const [sending, setSending] = useState5(false);
|
|
2041
|
+
const [sent, setSent] = useState5(false);
|
|
2042
|
+
if (!user || user.emailVerified) return null;
|
|
2043
|
+
async function handleResend() {
|
|
2044
|
+
if (sending || sent) return;
|
|
2045
|
+
setSending(true);
|
|
2046
|
+
try {
|
|
2047
|
+
await auth.resendVerify();
|
|
2048
|
+
setSent(true);
|
|
2049
|
+
} catch {
|
|
2050
|
+
} finally {
|
|
2051
|
+
setSending(false);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
const label = sent ? "Enviado!" : sending ? "Enviando..." : "Reenviar link";
|
|
2055
|
+
return /* @__PURE__ */ jsxs12(
|
|
2056
|
+
"div",
|
|
2057
|
+
{
|
|
2058
|
+
role: "status",
|
|
2059
|
+
"data-testid": "email-verify-banner",
|
|
2060
|
+
className: "sticky top-0 inset-x-0 z-50 bg-yellow-100 text-yellow-900 border-b border-yellow-200 px-4 py-2 flex items-center justify-between gap-3 text-sm",
|
|
2061
|
+
children: [
|
|
2062
|
+
/* @__PURE__ */ jsx18("span", { children: "Confirma teu e-mail pra liberar tudo." }),
|
|
2063
|
+
/* @__PURE__ */ jsx18(
|
|
2064
|
+
"button",
|
|
2065
|
+
{
|
|
2066
|
+
type: "button",
|
|
2067
|
+
onClick: handleResend,
|
|
2068
|
+
disabled: sending || sent,
|
|
2069
|
+
className: "px-3 py-1 rounded text-xs font-medium bg-yellow-900 text-yellow-50 hover:bg-yellow-800 disabled:opacity-60 disabled:cursor-not-allowed",
|
|
2070
|
+
children: label
|
|
2071
|
+
}
|
|
2072
|
+
)
|
|
2073
|
+
]
|
|
2074
|
+
}
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2034
2078
|
// src/defaults/ErrorBoundary.tsx
|
|
2035
2079
|
import { Component } from "react";
|
|
2036
|
-
import { Fragment as Fragment4, jsx as
|
|
2080
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2037
2081
|
var ErrorBoundary = class extends Component {
|
|
2038
2082
|
state = { error: null };
|
|
2039
2083
|
static getDerivedStateFromError(error) {
|
|
@@ -2051,12 +2095,12 @@ var ErrorBoundary = class extends Component {
|
|
|
2051
2095
|
}
|
|
2052
2096
|
render() {
|
|
2053
2097
|
if (this.state.error) {
|
|
2054
|
-
return this.props.fallback ?? /* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2098
|
+
return this.props.fallback ?? /* @__PURE__ */ jsxs13("div", { role: "alert", style: { padding: 24, textAlign: "center" }, children: [
|
|
2099
|
+
/* @__PURE__ */ jsx19("h2", { children: "Algo deu errado" }),
|
|
2100
|
+
/* @__PURE__ */ jsx19("p", { style: { opacity: 0.7 }, children: "Recarregue a p\xE1gina pra tentar de novo." })
|
|
2057
2101
|
] });
|
|
2058
2102
|
}
|
|
2059
|
-
return /* @__PURE__ */
|
|
2103
|
+
return /* @__PURE__ */ jsx19(Fragment4, { children: this.props.children });
|
|
2060
2104
|
}
|
|
2061
2105
|
};
|
|
2062
2106
|
|
|
@@ -2065,7 +2109,7 @@ import { useEffect as useEffect7 } from "react";
|
|
|
2065
2109
|
import i18n from "i18next";
|
|
2066
2110
|
import { I18nextProvider, initReactI18next } from "react-i18next";
|
|
2067
2111
|
import { usePersistedState } from "@hook-sdk/sdk";
|
|
2068
|
-
import { jsx as
|
|
2112
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2069
2113
|
function ensureInitialized(defaultLocale, supportedLocales, resources, initialLocale) {
|
|
2070
2114
|
if (i18n.isInitialized) return;
|
|
2071
2115
|
i18n.use(initReactI18next).init({
|
|
@@ -2094,7 +2138,7 @@ function I18nProvider({
|
|
|
2094
2138
|
i18n.changeLanguage(userLocale);
|
|
2095
2139
|
}
|
|
2096
2140
|
}, [userLocale]);
|
|
2097
|
-
return /* @__PURE__ */
|
|
2141
|
+
return /* @__PURE__ */ jsx20(I18nextProvider, { i18n, children });
|
|
2098
2142
|
}
|
|
2099
2143
|
|
|
2100
2144
|
// src/dev/env.ts
|
|
@@ -2105,9 +2149,9 @@ function isDevToolsEnabled() {
|
|
|
2105
2149
|
}
|
|
2106
2150
|
|
|
2107
2151
|
// src/dev/DevSkipOnboardingFab.tsx
|
|
2108
|
-
import { useCallback as useCallback3, useRef as useRef4, useState as
|
|
2109
|
-
import { useHook as
|
|
2110
|
-
import { jsx as
|
|
2152
|
+
import { useCallback as useCallback3, useRef as useRef4, useState as useState6 } from "react";
|
|
2153
|
+
import { useHook as useHook6 } from "@hook-sdk/sdk";
|
|
2154
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2111
2155
|
var STORAGE_KEY = "hook_dev_skip_email";
|
|
2112
2156
|
var TEST_EMAIL_DOMAIN = "@hook.test";
|
|
2113
2157
|
var TEST_PASSWORD = "SkipTest!2026";
|
|
@@ -2174,10 +2218,10 @@ var STYLES = {
|
|
|
2174
2218
|
};
|
|
2175
2219
|
var CONFIRM_TIMEOUT_MS = 3e3;
|
|
2176
2220
|
function DevSkipOnboardingFab({ defaults }) {
|
|
2177
|
-
const hook =
|
|
2221
|
+
const hook = useHook6();
|
|
2178
2222
|
const { slug } = useAppConfig();
|
|
2179
|
-
const [state, setState] =
|
|
2180
|
-
const [errorMsg, setErrorMsg] =
|
|
2223
|
+
const [state, setState] = useState6("idle");
|
|
2224
|
+
const [errorMsg, setErrorMsg] = useState6(null);
|
|
2181
2225
|
const timerRef = useRef4(null);
|
|
2182
2226
|
const clearTimer = useCallback3(() => {
|
|
2183
2227
|
if (timerRef.current) {
|
|
@@ -2214,7 +2258,7 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2214
2258
|
...state === "confirm" || state === "error" ? STYLES.confirm : {},
|
|
2215
2259
|
...state === "busy" ? STYLES.busy : {}
|
|
2216
2260
|
};
|
|
2217
|
-
return /* @__PURE__ */
|
|
2261
|
+
return /* @__PURE__ */ jsx21(
|
|
2218
2262
|
"button",
|
|
2219
2263
|
{
|
|
2220
2264
|
type: "button",
|
|
@@ -2229,20 +2273,20 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2229
2273
|
}
|
|
2230
2274
|
|
|
2231
2275
|
// src/internal/PaymentReturnHandler.tsx
|
|
2232
|
-
import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef5, useState as
|
|
2233
|
-
import { useHook as
|
|
2234
|
-
import { Fragment as Fragment5, jsx as
|
|
2276
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef5, useState as useState7 } from "react";
|
|
2277
|
+
import { useHook as useHook7 } from "@hook-sdk/sdk";
|
|
2278
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2235
2279
|
var BACKOFF_MS = [2e3, 5e3, 1e4, 2e4, 4e4];
|
|
2236
2280
|
var MAX_CYCLES = 3;
|
|
2237
2281
|
var SUPPORT_MAILTO = "mailto:suporte@usehook.net?subject=Pagamento%20pendente";
|
|
2238
2282
|
function PaymentReturnHandler({ children }) {
|
|
2239
|
-
const { subscription, track: track2 } =
|
|
2283
|
+
const { subscription, track: track2 } = useHook7();
|
|
2240
2284
|
const subRef = useRef5(subscription);
|
|
2241
2285
|
subRef.current = subscription;
|
|
2242
2286
|
const runIdRef = useRef5(0);
|
|
2243
2287
|
const cyclesRef = useRef5(0);
|
|
2244
2288
|
const startMsRef = useRef5(0);
|
|
2245
|
-
const [state, setState] =
|
|
2289
|
+
const [state, setState] = useState7("idle");
|
|
2246
2290
|
const runPoll = useCallback4(() => {
|
|
2247
2291
|
const runId = ++runIdRef.current;
|
|
2248
2292
|
const isFirstRun = cyclesRef.current === 0;
|
|
@@ -2308,19 +2352,19 @@ function PaymentReturnHandler({ children }) {
|
|
|
2308
2352
|
window.location.href = cleanUrl.toString();
|
|
2309
2353
|
}, []);
|
|
2310
2354
|
if (state === "confirming") {
|
|
2311
|
-
return /* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ jsx22("div", { role: "status", "aria-live": "polite", style: overlayStyle2, children: "Confirmando pagamento\u2026" });
|
|
2312
2356
|
}
|
|
2313
2357
|
if (state === "waiting") {
|
|
2314
|
-
return /* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2358
|
+
return /* @__PURE__ */ jsx22("div", { role: "status", "aria-live": "polite", style: overlayStyle2, children: /* @__PURE__ */ jsxs14("div", { style: { maxWidth: 320, textAlign: "center", lineHeight: 1.5 }, children: [
|
|
2359
|
+
/* @__PURE__ */ jsx22("div", { style: { marginBottom: 16 }, children: "Pagamento aceito. Estamos confirmando com o banco \u2014 pode levar alguns minutos." }),
|
|
2360
|
+
/* @__PURE__ */ jsx22("button", { type: "button", onClick: runPoll, style: buttonStyle, children: "Atualizar" })
|
|
2317
2361
|
] }) });
|
|
2318
2362
|
}
|
|
2319
2363
|
if (state === "timeout") {
|
|
2320
|
-
return /* @__PURE__ */
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2364
|
+
return /* @__PURE__ */ jsx22("div", { role: "alert", "aria-live": "assertive", style: overlayStyle2, children: /* @__PURE__ */ jsxs14("div", { style: { maxWidth: 360, textAlign: "center", lineHeight: 1.5 }, children: [
|
|
2365
|
+
/* @__PURE__ */ jsx22("div", { style: { marginBottom: 16 }, children: "Ainda n\xE3o conseguimos confirmar seu pagamento com o banco. Voc\xEA pode tentar de novo, voltar pro app, ou falar com a gente." }),
|
|
2366
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
2367
|
+
/* @__PURE__ */ jsx22(
|
|
2324
2368
|
"button",
|
|
2325
2369
|
{
|
|
2326
2370
|
type: "button",
|
|
@@ -2333,7 +2377,7 @@ function PaymentReturnHandler({ children }) {
|
|
|
2333
2377
|
children: "Tentar de novo"
|
|
2334
2378
|
}
|
|
2335
2379
|
),
|
|
2336
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ jsx22(
|
|
2337
2381
|
"button",
|
|
2338
2382
|
{
|
|
2339
2383
|
type: "button",
|
|
@@ -2343,7 +2387,7 @@ function PaymentReturnHandler({ children }) {
|
|
|
2343
2387
|
children: "Voltar pro app"
|
|
2344
2388
|
}
|
|
2345
2389
|
),
|
|
2346
|
-
/* @__PURE__ */
|
|
2390
|
+
/* @__PURE__ */ jsx22(
|
|
2347
2391
|
"a",
|
|
2348
2392
|
{
|
|
2349
2393
|
href: SUPPORT_MAILTO,
|
|
@@ -2355,7 +2399,7 @@ function PaymentReturnHandler({ children }) {
|
|
|
2355
2399
|
] })
|
|
2356
2400
|
] }) });
|
|
2357
2401
|
}
|
|
2358
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsx22(Fragment5, { children });
|
|
2359
2403
|
}
|
|
2360
2404
|
var overlayStyle2 = {
|
|
2361
2405
|
position: "fixed",
|
|
@@ -2394,7 +2438,7 @@ var linkStyle = {
|
|
|
2394
2438
|
};
|
|
2395
2439
|
|
|
2396
2440
|
// src/AppRoot.tsx
|
|
2397
|
-
import { Fragment as Fragment6, jsx as
|
|
2441
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2398
2442
|
function buildLegacyConfigShim(config) {
|
|
2399
2443
|
const paywall = config.paywall;
|
|
2400
2444
|
const isFree = paywall.mode === "free";
|
|
@@ -2473,14 +2517,17 @@ function AppRoot(props) {
|
|
|
2473
2517
|
const basename = `/app/${config.slug}`;
|
|
2474
2518
|
const routerProps = testRouter === "memory" ? { basename, initialEntries: testInitialEntries } : { basename };
|
|
2475
2519
|
const position = config.install_prompt?.position ?? "post-paywall";
|
|
2476
|
-
const subscriptionGated = /* @__PURE__ */
|
|
2477
|
-
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
/* @__PURE__ */
|
|
2482
|
-
|
|
2483
|
-
|
|
2520
|
+
const subscriptionGated = /* @__PURE__ */ jsxs15(SubscriptionGate, { Paywall: Paywall2 ?? FallbackPaywall, children: [
|
|
2521
|
+
/* @__PURE__ */ jsx23(EmailVerifyBanner, {}),
|
|
2522
|
+
position === "post-paywall" ? /* @__PURE__ */ jsxs15(InstallGate, { position: "post-paywall", children: [
|
|
2523
|
+
children,
|
|
2524
|
+
/* @__PURE__ */ jsx23(PushPrompt, {})
|
|
2525
|
+
] }) : /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2526
|
+
children,
|
|
2527
|
+
/* @__PURE__ */ jsx23(PushPrompt, {})
|
|
2528
|
+
] })
|
|
2529
|
+
] });
|
|
2530
|
+
const authGated = /* @__PURE__ */ jsx23(
|
|
2484
2531
|
AuthGated,
|
|
2485
2532
|
{
|
|
2486
2533
|
config,
|
|
@@ -2495,13 +2542,13 @@ function AppRoot(props) {
|
|
|
2495
2542
|
children: subscriptionGated
|
|
2496
2543
|
}
|
|
2497
2544
|
);
|
|
2498
|
-
const routedTree = /* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
position === "pre-auth" ? /* @__PURE__ */
|
|
2502
|
-
isDevToolsEnabled() && devSkipOnboarding ? /* @__PURE__ */
|
|
2545
|
+
const routedTree = /* @__PURE__ */ jsxs15(Router, { ...routerProps, children: [
|
|
2546
|
+
/* @__PURE__ */ jsx23(DeepLinkHandler, { deepLinks: config.deepLinks }),
|
|
2547
|
+
/* @__PURE__ */ jsx23(SessionExpiredBanner, {}),
|
|
2548
|
+
position === "pre-auth" ? /* @__PURE__ */ jsx23(InstallGate, { position: "pre-auth", children: authGated }) : authGated,
|
|
2549
|
+
isDevToolsEnabled() && devSkipOnboarding ? /* @__PURE__ */ jsx23(DevSkipOnboardingFab, { defaults: devSkipOnboarding.defaults }) : null
|
|
2503
2550
|
] });
|
|
2504
|
-
return /* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ jsx23(ErrorBoundary, { children: /* @__PURE__ */ jsx23(AppConfigProvider, { config, children: /* @__PURE__ */ jsx23(TemplateConfigProvider, { config: legacyShim, children: /* @__PURE__ */ jsx23(ThemeProvider, { children: /* @__PURE__ */ jsx23(PersistenceRegistry, { config: config.persistedKeys, children: config.i18n ? /* @__PURE__ */ jsx23(
|
|
2505
2552
|
I18nProvider,
|
|
2506
2553
|
{
|
|
2507
2554
|
defaultLocale: config.i18n.defaultLocale,
|
|
@@ -2521,37 +2568,37 @@ function AuthGated({
|
|
|
2521
2568
|
EmailVerify,
|
|
2522
2569
|
PreAuthFlow
|
|
2523
2570
|
}) {
|
|
2524
|
-
const { authStatus } =
|
|
2571
|
+
const { authStatus } = useHook8();
|
|
2525
2572
|
if (authStatus === "loading") return null;
|
|
2526
2573
|
if (authStatus !== "authenticated") {
|
|
2527
2574
|
if (config.onboarding?.trigger === "pre_signup_custom" && PreAuthFlow) {
|
|
2528
|
-
return /* @__PURE__ */
|
|
2529
|
-
/* @__PURE__ */
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
EmailVerify ? /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2575
|
+
return /* @__PURE__ */ jsxs15(Routes, { children: [
|
|
2576
|
+
/* @__PURE__ */ jsx23(Route, { path: "/signin", element: /* @__PURE__ */ jsx23(Login, {}) }),
|
|
2577
|
+
/* @__PURE__ */ jsx23(Route, { path: "/signup", element: /* @__PURE__ */ jsx23(Signup, {}) }),
|
|
2578
|
+
/* @__PURE__ */ jsx23(Route, { path: "/forgot", element: /* @__PURE__ */ jsx23(Forgot, {}) }),
|
|
2579
|
+
/* @__PURE__ */ jsx23(Route, { path: "/reset", element: /* @__PURE__ */ jsx23(Reset, {}) }),
|
|
2580
|
+
EmailVerify ? /* @__PURE__ */ jsx23(Route, { path: "/verify", element: /* @__PURE__ */ jsx23(EmailVerify, {}) }) : null,
|
|
2581
|
+
/* @__PURE__ */ jsx23(Route, { path: "/*", element: /* @__PURE__ */ jsx23(PreAuthFlow, {}) })
|
|
2535
2582
|
] });
|
|
2536
2583
|
}
|
|
2537
|
-
return /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
EmailVerify ? /* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2584
|
+
return /* @__PURE__ */ jsxs15(Routes, { children: [
|
|
2585
|
+
/* @__PURE__ */ jsx23(Route, { path: "/", element: /* @__PURE__ */ jsx23(Login, {}) }),
|
|
2586
|
+
/* @__PURE__ */ jsx23(Route, { path: "/signup", element: /* @__PURE__ */ jsx23(Signup, {}) }),
|
|
2587
|
+
/* @__PURE__ */ jsx23(Route, { path: "/forgot", element: /* @__PURE__ */ jsx23(Forgot, {}) }),
|
|
2588
|
+
/* @__PURE__ */ jsx23(Route, { path: "/reset", element: /* @__PURE__ */ jsx23(Reset, {}) }),
|
|
2589
|
+
EmailVerify ? /* @__PURE__ */ jsx23(Route, { path: "/verify", element: /* @__PURE__ */ jsx23(EmailVerify, {}) }) : null,
|
|
2590
|
+
/* @__PURE__ */ jsx23(Route, { path: "*", element: /* @__PURE__ */ jsx23(Navigate, { to: "/", replace: true }) })
|
|
2544
2591
|
] });
|
|
2545
2592
|
}
|
|
2546
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ jsx23(Fragment6, { children });
|
|
2547
2594
|
}
|
|
2548
2595
|
function FallbackPaywall() {
|
|
2549
2596
|
return null;
|
|
2550
2597
|
}
|
|
2551
2598
|
|
|
2552
2599
|
// src/hooks/usePush.ts
|
|
2553
|
-
import { useCallback as useCallback5, useEffect as useEffect9, useState as
|
|
2554
|
-
import { useHook as
|
|
2600
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useState as useState8 } from "react";
|
|
2601
|
+
import { useHook as useHook9 } from "@hook-sdk/sdk";
|
|
2555
2602
|
var DISMISS_STORAGE_KEY = "push:dismissed-until";
|
|
2556
2603
|
var DISMISS_TTL_MS2 = 7 * 24 * 60 * 60 * 1e3;
|
|
2557
2604
|
function detectIosNeedsInstall() {
|
|
@@ -2595,8 +2642,8 @@ function deriveState(push) {
|
|
|
2595
2642
|
return { kind: "prompt" };
|
|
2596
2643
|
}
|
|
2597
2644
|
function usePush() {
|
|
2598
|
-
const { push } =
|
|
2599
|
-
const [state, setState] =
|
|
2645
|
+
const { push } = useHook9();
|
|
2646
|
+
const [state, setState] = useState8(() => deriveState(push));
|
|
2600
2647
|
useEffect9(() => {
|
|
2601
2648
|
setState(deriveState(push));
|
|
2602
2649
|
}, [push]);
|
|
@@ -2634,27 +2681,27 @@ function usePush() {
|
|
|
2634
2681
|
}
|
|
2635
2682
|
|
|
2636
2683
|
// src/components/PushPrompt.tsx
|
|
2637
|
-
import { jsx as
|
|
2684
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2638
2685
|
function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, className }) {
|
|
2639
2686
|
const { state, subscribe } = usePush();
|
|
2640
2687
|
if (state.kind === "denied" || state.kind === "dismissed" || state.kind === "subscribed") {
|
|
2641
2688
|
return null;
|
|
2642
2689
|
}
|
|
2643
2690
|
if (state.kind === "ios_needs_install") {
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
onInstallRequested && texts.iosInstallCta && /* @__PURE__ */
|
|
2691
|
+
return /* @__PURE__ */ jsxs16("div", { className, role: "region", "aria-label": texts.iosInstallTitle, children: [
|
|
2692
|
+
/* @__PURE__ */ jsx24("h3", { children: texts.iosInstallTitle }),
|
|
2693
|
+
/* @__PURE__ */ jsx24("p", { children: texts.iosInstallBody }),
|
|
2694
|
+
onInstallRequested && texts.iosInstallCta && /* @__PURE__ */ jsx24("button", { onClick: onInstallRequested, children: texts.iosInstallCta })
|
|
2648
2695
|
] });
|
|
2649
2696
|
}
|
|
2650
2697
|
if (state.kind === "unsupported") {
|
|
2651
|
-
return /* @__PURE__ */
|
|
2698
|
+
return /* @__PURE__ */ jsx24("div", { className, role: "region", children: /* @__PURE__ */ jsx24("p", { children: texts.unsupportedBody }) });
|
|
2652
2699
|
}
|
|
2653
2700
|
if (state.kind === "error") {
|
|
2654
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ jsx24("div", { className, role: "region", "aria-label": "error", children: /* @__PURE__ */ jsx24("p", { children: state.message }) });
|
|
2655
2702
|
}
|
|
2656
|
-
return /* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2703
|
+
return /* @__PURE__ */ jsxs16("div", { className, role: "region", children: [
|
|
2704
|
+
/* @__PURE__ */ jsx24(
|
|
2658
2705
|
"button",
|
|
2659
2706
|
{
|
|
2660
2707
|
type: "button",
|
|
@@ -2668,13 +2715,13 @@ function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, clas
|
|
|
2668
2715
|
children: texts.cta
|
|
2669
2716
|
}
|
|
2670
2717
|
),
|
|
2671
|
-
onDeclined && /* @__PURE__ */
|
|
2718
|
+
onDeclined && /* @__PURE__ */ jsx24("button", { type: "button", onClick: onDeclined, children: texts.declineCta })
|
|
2672
2719
|
] });
|
|
2673
2720
|
}
|
|
2674
2721
|
|
|
2675
2722
|
// src/components/LanguageSwitcher.tsx
|
|
2676
2723
|
import { usePersistedState as usePersistedState2 } from "@hook-sdk/sdk";
|
|
2677
|
-
import { jsx as
|
|
2724
|
+
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2678
2725
|
function LanguageSwitcher({ id, className, label = "Language" }) {
|
|
2679
2726
|
const config = useAppConfig();
|
|
2680
2727
|
const i18nConfig = config.i18n;
|
|
@@ -2683,43 +2730,43 @@ function LanguageSwitcher({ id, className, label = "Language" }) {
|
|
|
2683
2730
|
i18nConfig?.defaultLocale ?? "en-US"
|
|
2684
2731
|
);
|
|
2685
2732
|
if (!i18nConfig) return null;
|
|
2686
|
-
return /* @__PURE__ */
|
|
2687
|
-
label ? /* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2733
|
+
return /* @__PURE__ */ jsxs17("label", { className, children: [
|
|
2734
|
+
label ? /* @__PURE__ */ jsx25("span", { children: label }) : null,
|
|
2735
|
+
/* @__PURE__ */ jsx25(
|
|
2689
2736
|
"select",
|
|
2690
2737
|
{
|
|
2691
2738
|
id,
|
|
2692
2739
|
value: userLocale,
|
|
2693
2740
|
onChange: (e) => setUserLocale(e.target.value),
|
|
2694
2741
|
"data-testid": "language-switcher",
|
|
2695
|
-
children: i18nConfig.supportedLocales.map((loc) => /* @__PURE__ */
|
|
2742
|
+
children: i18nConfig.supportedLocales.map((loc) => /* @__PURE__ */ jsx25("option", { value: loc, children: loc }, loc))
|
|
2696
2743
|
}
|
|
2697
2744
|
)
|
|
2698
2745
|
] });
|
|
2699
2746
|
}
|
|
2700
2747
|
|
|
2701
2748
|
// src/defaults/LoadingState.tsx
|
|
2702
|
-
import { jsx as
|
|
2749
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2703
2750
|
function LoadingState({ message }) {
|
|
2704
|
-
return /* @__PURE__ */
|
|
2751
|
+
return /* @__PURE__ */ jsx26("div", { role: "status", "aria-live": "polite", style: { padding: 24, textAlign: "center" }, children: /* @__PURE__ */ jsx26("span", { children: message ?? "Carregando..." }) });
|
|
2705
2752
|
}
|
|
2706
2753
|
|
|
2707
2754
|
// src/defaults/EmptyState.tsx
|
|
2708
|
-
import { jsx as
|
|
2755
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2709
2756
|
function EmptyState({ title, description, action }) {
|
|
2710
|
-
return /* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
description && /* @__PURE__ */
|
|
2713
|
-
action && /* @__PURE__ */
|
|
2757
|
+
return /* @__PURE__ */ jsxs18("div", { role: "status", style: { padding: 32, textAlign: "center" }, children: [
|
|
2758
|
+
/* @__PURE__ */ jsx27("h2", { style: { marginBottom: 8 }, children: title }),
|
|
2759
|
+
description && /* @__PURE__ */ jsx27("p", { style: { opacity: 0.7 }, children: description }),
|
|
2760
|
+
action && /* @__PURE__ */ jsx27("div", { style: { marginTop: 16 }, children: action })
|
|
2714
2761
|
] });
|
|
2715
2762
|
}
|
|
2716
2763
|
|
|
2717
2764
|
// src/hooks/useLoginForm.ts
|
|
2718
|
-
import { useCallback as useCallback6, useMemo as useMemo4, useState as
|
|
2719
|
-
import { useHook as
|
|
2765
|
+
import { useCallback as useCallback6, useMemo as useMemo4, useState as useState9 } from "react";
|
|
2766
|
+
import { useHook as useHook10 } from "@hook-sdk/sdk";
|
|
2720
2767
|
|
|
2721
2768
|
// src/errors.ts
|
|
2722
|
-
import { SdkError, SdkAuthError, SdkRateLimitError } from "@hook-sdk/sdk";
|
|
2769
|
+
import { SdkError, SdkAuthError, SdkRateLimitError, SdkValidationError } from "@hook-sdk/sdk";
|
|
2723
2770
|
function mapSdkError(err) {
|
|
2724
2771
|
if (err instanceof SdkRateLimitError) {
|
|
2725
2772
|
return {
|
|
@@ -2738,6 +2785,9 @@ function mapSdkError(err) {
|
|
|
2738
2785
|
}
|
|
2739
2786
|
return { code: "invalid_credentials", message: "E-mail ou senha inv\xE1lidos." };
|
|
2740
2787
|
}
|
|
2788
|
+
if (err instanceof SdkValidationError && err.code === "auth.email_taken") {
|
|
2789
|
+
return { code: "email_taken", message: "Esse e-mail j\xE1 tem conta." };
|
|
2790
|
+
}
|
|
2741
2791
|
if (err instanceof SdkError && err.httpStatus === 0) {
|
|
2742
2792
|
return { code: "network", message: "Sem conex\xE3o com o servidor. Verifique sua internet." };
|
|
2743
2793
|
}
|
|
@@ -2751,14 +2801,14 @@ function mapSdkError(err) {
|
|
|
2751
2801
|
var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2752
2802
|
var MIN_PASSWORD = 8;
|
|
2753
2803
|
function useLoginForm() {
|
|
2754
|
-
const { auth } =
|
|
2755
|
-
const [email, setEmail] =
|
|
2756
|
-
const [password, setPassword] =
|
|
2757
|
-
const [submitting, setSubmitting] =
|
|
2758
|
-
const [error, setError] =
|
|
2759
|
-
const [touchedEmail, setTouchedEmail] =
|
|
2760
|
-
const [touchedPassword, setTouchedPassword] =
|
|
2761
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
2804
|
+
const { auth } = useHook10();
|
|
2805
|
+
const [email, setEmail] = useState9("");
|
|
2806
|
+
const [password, setPassword] = useState9("");
|
|
2807
|
+
const [submitting, setSubmitting] = useState9(false);
|
|
2808
|
+
const [error, setError] = useState9(null);
|
|
2809
|
+
const [touchedEmail, setTouchedEmail] = useState9(false);
|
|
2810
|
+
const [touchedPassword, setTouchedPassword] = useState9(false);
|
|
2811
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState9(false);
|
|
2762
2812
|
const validateEmail = useMemo4(() => {
|
|
2763
2813
|
if (email.length === 0) return null;
|
|
2764
2814
|
if (!EMAIL_RE.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -2806,21 +2856,21 @@ function useLoginForm() {
|
|
|
2806
2856
|
}
|
|
2807
2857
|
|
|
2808
2858
|
// src/hooks/useSignupForm.ts
|
|
2809
|
-
import { useCallback as useCallback7, useMemo as useMemo5, useState as
|
|
2810
|
-
import { useHook as
|
|
2859
|
+
import { useCallback as useCallback7, useMemo as useMemo5, useState as useState10 } from "react";
|
|
2860
|
+
import { useHook as useHook11 } from "@hook-sdk/sdk";
|
|
2811
2861
|
var EMAIL_RE2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2812
2862
|
var MIN_PASSWORD2 = 8;
|
|
2813
2863
|
function useSignupForm() {
|
|
2814
|
-
const { auth } =
|
|
2815
|
-
const [name, setName] =
|
|
2816
|
-
const [email, setEmail] =
|
|
2817
|
-
const [password, setPassword] =
|
|
2818
|
-
const [submitting, setSubmitting] =
|
|
2819
|
-
const [error, setError] =
|
|
2820
|
-
const [touchedName, setTouchedName] =
|
|
2821
|
-
const [touchedEmail, setTouchedEmail] =
|
|
2822
|
-
const [touchedPassword, setTouchedPassword] =
|
|
2823
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
2864
|
+
const { auth } = useHook11();
|
|
2865
|
+
const [name, setName] = useState10("");
|
|
2866
|
+
const [email, setEmail] = useState10("");
|
|
2867
|
+
const [password, setPassword] = useState10("");
|
|
2868
|
+
const [submitting, setSubmitting] = useState10(false);
|
|
2869
|
+
const [error, setError] = useState10(null);
|
|
2870
|
+
const [touchedName, setTouchedName] = useState10(false);
|
|
2871
|
+
const [touchedEmail, setTouchedEmail] = useState10(false);
|
|
2872
|
+
const [touchedPassword, setTouchedPassword] = useState10(false);
|
|
2873
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState10(false);
|
|
2824
2874
|
const validateName = useMemo5(() => {
|
|
2825
2875
|
if (name.length === 0) return null;
|
|
2826
2876
|
if (name.trim().length < 2) return "Nome muito curto.";
|
|
@@ -2878,17 +2928,17 @@ function useSignupForm() {
|
|
|
2878
2928
|
}
|
|
2879
2929
|
|
|
2880
2930
|
// src/hooks/useForgotForm.ts
|
|
2881
|
-
import { useCallback as useCallback8, useMemo as useMemo6, useState as
|
|
2882
|
-
import { useHook as
|
|
2931
|
+
import { useCallback as useCallback8, useMemo as useMemo6, useState as useState11 } from "react";
|
|
2932
|
+
import { useHook as useHook12 } from "@hook-sdk/sdk";
|
|
2883
2933
|
var EMAIL_RE3 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2884
2934
|
function useForgotForm() {
|
|
2885
|
-
const { auth } =
|
|
2886
|
-
const [email, setEmail] =
|
|
2887
|
-
const [submitting, setSubmitting] =
|
|
2888
|
-
const [sent, setSent] =
|
|
2889
|
-
const [error, setError] =
|
|
2890
|
-
const [touchedEmail, setTouchedEmail] =
|
|
2891
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
2935
|
+
const { auth } = useHook12();
|
|
2936
|
+
const [email, setEmail] = useState11("");
|
|
2937
|
+
const [submitting, setSubmitting] = useState11(false);
|
|
2938
|
+
const [sent, setSent] = useState11(false);
|
|
2939
|
+
const [error, setError] = useState11(null);
|
|
2940
|
+
const [touchedEmail, setTouchedEmail] = useState11(false);
|
|
2941
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState11(false);
|
|
2892
2942
|
const validateEmail = useMemo6(() => {
|
|
2893
2943
|
if (email.length === 0) return null;
|
|
2894
2944
|
if (!EMAIL_RE3.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -2927,20 +2977,20 @@ function useForgotForm() {
|
|
|
2927
2977
|
}
|
|
2928
2978
|
|
|
2929
2979
|
// src/hooks/useResetForm.ts
|
|
2930
|
-
import { useCallback as useCallback9, useEffect as useEffect10, useMemo as useMemo7, useState as
|
|
2931
|
-
import { useHook as
|
|
2980
|
+
import { useCallback as useCallback9, useEffect as useEffect10, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2981
|
+
import { useHook as useHook13 } from "@hook-sdk/sdk";
|
|
2932
2982
|
var MIN_PASSWORD3 = 12;
|
|
2933
2983
|
function useResetForm() {
|
|
2934
|
-
const { auth } =
|
|
2935
|
-
const [token, setToken] =
|
|
2936
|
-
const [password, setPassword] =
|
|
2937
|
-
const [confirm, setConfirm] =
|
|
2938
|
-
const [submitting, setSubmitting] =
|
|
2939
|
-
const [done, setDone] =
|
|
2940
|
-
const [error, setError] =
|
|
2941
|
-
const [touchedPassword, setTouchedPassword] =
|
|
2942
|
-
const [touchedConfirm, setTouchedConfirm] =
|
|
2943
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
2984
|
+
const { auth } = useHook13();
|
|
2985
|
+
const [token, setToken] = useState12(null);
|
|
2986
|
+
const [password, setPassword] = useState12("");
|
|
2987
|
+
const [confirm, setConfirm] = useState12("");
|
|
2988
|
+
const [submitting, setSubmitting] = useState12(false);
|
|
2989
|
+
const [done, setDone] = useState12(false);
|
|
2990
|
+
const [error, setError] = useState12(null);
|
|
2991
|
+
const [touchedPassword, setTouchedPassword] = useState12(false);
|
|
2992
|
+
const [touchedConfirm, setTouchedConfirm] = useState12(false);
|
|
2993
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState12(false);
|
|
2944
2994
|
useEffect10(() => {
|
|
2945
2995
|
if (typeof window === "undefined") return;
|
|
2946
2996
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -3000,9 +3050,9 @@ function useResetForm() {
|
|
|
3000
3050
|
}
|
|
3001
3051
|
|
|
3002
3052
|
// src/hooks/usePlan.ts
|
|
3003
|
-
import { useHook as
|
|
3053
|
+
import { useHook as useHook14 } from "@hook-sdk/sdk";
|
|
3004
3054
|
function usePlan() {
|
|
3005
|
-
const { plan } =
|
|
3055
|
+
const { plan } = useHook14();
|
|
3006
3056
|
return plan;
|
|
3007
3057
|
}
|
|
3008
3058
|
|
|
@@ -3036,10 +3086,10 @@ function discountPercent(anchorCents, realCents) {
|
|
|
3036
3086
|
|
|
3037
3087
|
// src/hooks/useAuthPrimitives.ts
|
|
3038
3088
|
import { useEffect as useEffect11 } from "react";
|
|
3039
|
-
import { useHook as
|
|
3089
|
+
import { useHook as useHook15 } from "@hook-sdk/sdk";
|
|
3040
3090
|
var warned = false;
|
|
3041
3091
|
function useAuthPrimitives() {
|
|
3042
|
-
const { auth } =
|
|
3092
|
+
const { auth } = useHook15();
|
|
3043
3093
|
useEffect11(() => {
|
|
3044
3094
|
if (!warned && process.env.NODE_ENV !== "production") {
|
|
3045
3095
|
warned = true;
|
|
@@ -3062,9 +3112,9 @@ function useAuthPrimitives() {
|
|
|
3062
3112
|
}
|
|
3063
3113
|
|
|
3064
3114
|
// src/hooks/useAuth.ts
|
|
3065
|
-
import { useHook as
|
|
3115
|
+
import { useHook as useHook16 } from "@hook-sdk/sdk";
|
|
3066
3116
|
function useAuth() {
|
|
3067
|
-
const { user, authStatus, auth } =
|
|
3117
|
+
const { user, authStatus, auth } = useHook16();
|
|
3068
3118
|
return {
|
|
3069
3119
|
user,
|
|
3070
3120
|
authStatus,
|
|
@@ -3076,22 +3126,22 @@ function useAuth() {
|
|
|
3076
3126
|
import { useTrackOnboardingStep } from "@hook-sdk/sdk";
|
|
3077
3127
|
|
|
3078
3128
|
// src/hooks/useSubscription.ts
|
|
3079
|
-
import { useHook as
|
|
3129
|
+
import { useHook as useHook17 } from "@hook-sdk/sdk";
|
|
3080
3130
|
function useSubscription() {
|
|
3081
|
-
const { subscription } =
|
|
3131
|
+
const { subscription } = useHook17();
|
|
3082
3132
|
return {
|
|
3083
3133
|
status: subscription.status()
|
|
3084
3134
|
};
|
|
3085
3135
|
}
|
|
3086
3136
|
|
|
3087
3137
|
// src/hooks/useReminders.ts
|
|
3088
|
-
import { useCallback as useCallback10, useEffect as useEffect12, useState as
|
|
3089
|
-
import { useHook as
|
|
3138
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useState as useState13 } from "react";
|
|
3139
|
+
import { useHook as useHook18 } from "@hook-sdk/sdk";
|
|
3090
3140
|
function useReminders() {
|
|
3091
|
-
const { push } =
|
|
3141
|
+
const { push } = useHook18();
|
|
3092
3142
|
const r = push.reminders;
|
|
3093
|
-
const [reminders, setReminders] =
|
|
3094
|
-
const [loading, setLoading] =
|
|
3143
|
+
const [reminders, setReminders] = useState13([]);
|
|
3144
|
+
const [loading, setLoading] = useState13(true);
|
|
3095
3145
|
const reload = useCallback10(async () => {
|
|
3096
3146
|
setLoading(true);
|
|
3097
3147
|
try {
|
|
@@ -3122,9 +3172,9 @@ function useReminders() {
|
|
|
3122
3172
|
}
|
|
3123
3173
|
|
|
3124
3174
|
// src/hooks/useToast.ts
|
|
3125
|
-
import { useCallback as useCallback11, useState as
|
|
3175
|
+
import { useCallback as useCallback11, useState as useState14 } from "react";
|
|
3126
3176
|
function useToast() {
|
|
3127
|
-
const [items, setItems] =
|
|
3177
|
+
const [items, setItems] = useState14([]);
|
|
3128
3178
|
const show = useCallback11((message, kind = "info") => {
|
|
3129
3179
|
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3130
3180
|
setItems((prev) => [...prev, { id, message, kind }]);
|
|
@@ -3140,20 +3190,20 @@ function useToast() {
|
|
|
3140
3190
|
|
|
3141
3191
|
// src/RouteBoundary.tsx
|
|
3142
3192
|
import { Routes as Routes2, Route as Route2 } from "react-router-dom";
|
|
3143
|
-
import { jsx as
|
|
3193
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3144
3194
|
function RouteBoundary({ children }) {
|
|
3145
|
-
return /* @__PURE__ */
|
|
3195
|
+
return /* @__PURE__ */ jsxs19(Routes2, { children: [
|
|
3146
3196
|
children,
|
|
3147
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsx28(Route2, { path: "*", element: /* @__PURE__ */ jsx28(DefaultNotFound, {}) })
|
|
3148
3198
|
] });
|
|
3149
3199
|
}
|
|
3150
3200
|
function DefaultNotFound() {
|
|
3151
|
-
return /* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsx28("div", { role: "alert", children: "P\xE1gina n\xE3o encontrada" });
|
|
3152
3202
|
}
|
|
3153
3203
|
|
|
3154
3204
|
// src/PreAuthShell.tsx
|
|
3155
3205
|
import { BrowserRouter as BrowserRouter2, MemoryRouter as MemoryRouter2, Routes as Routes3 } from "react-router-dom";
|
|
3156
|
-
import { jsx as
|
|
3206
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3157
3207
|
function PreAuthShell({
|
|
3158
3208
|
basename,
|
|
3159
3209
|
testRouter,
|
|
@@ -3161,14 +3211,14 @@ function PreAuthShell({
|
|
|
3161
3211
|
children
|
|
3162
3212
|
}) {
|
|
3163
3213
|
if (testRouter === "memory") {
|
|
3164
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsx29(MemoryRouter2, { basename, initialEntries: testInitialEntries, children: /* @__PURE__ */ jsx29(Routes3, { children }) });
|
|
3165
3215
|
}
|
|
3166
|
-
return /* @__PURE__ */
|
|
3216
|
+
return /* @__PURE__ */ jsx29(BrowserRouter2, { basename, children: /* @__PURE__ */ jsx29(Routes3, { children }) });
|
|
3167
3217
|
}
|
|
3168
3218
|
|
|
3169
3219
|
// src/OnboardingFlow.tsx
|
|
3170
3220
|
import { useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo8, useRef as useRef6 } from "react";
|
|
3171
|
-
import { usePersistedState as usePersistedState3, useHook as
|
|
3221
|
+
import { usePersistedState as usePersistedState3, useHook as useHook19 } from "@hook-sdk/sdk";
|
|
3172
3222
|
|
|
3173
3223
|
// src/hooks/useOnboardingStep.ts
|
|
3174
3224
|
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
@@ -3184,7 +3234,7 @@ function useOnboardingStep() {
|
|
|
3184
3234
|
}
|
|
3185
3235
|
|
|
3186
3236
|
// src/OnboardingFlow.tsx
|
|
3187
|
-
import { jsx as
|
|
3237
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3188
3238
|
var isFilled = (v) => v != null && v !== "";
|
|
3189
3239
|
var CURRENT_STEP_FIELD = "currentStep";
|
|
3190
3240
|
function readPersistedStepIdx(draft) {
|
|
@@ -3220,7 +3270,7 @@ function OnboardingFlow({
|
|
|
3220
3270
|
[setDraft]
|
|
3221
3271
|
);
|
|
3222
3272
|
const step = steps[clampedIdx];
|
|
3223
|
-
const hookCtx =
|
|
3273
|
+
const hookCtx = useHook19();
|
|
3224
3274
|
const track2 = typeof hookCtx.track === "function" ? hookCtx.track : void 0;
|
|
3225
3275
|
useEffect13(() => {
|
|
3226
3276
|
if (status.loading) return;
|
|
@@ -3274,7 +3324,7 @@ function OnboardingFlow({
|
|
|
3274
3324
|
`[hook-template] OnboardingFlow: missing screen component for step '${step.id}' (expected key '${step.screen}' in screens prop)`
|
|
3275
3325
|
);
|
|
3276
3326
|
}
|
|
3277
|
-
return /* @__PURE__ */
|
|
3327
|
+
return /* @__PURE__ */ jsx30(OnboardingStepContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx30(Screen, {}) });
|
|
3278
3328
|
}
|
|
3279
3329
|
|
|
3280
3330
|
// src/hooks/useFeature.ts
|
|
@@ -3285,15 +3335,15 @@ function useFeature(name) {
|
|
|
3285
3335
|
|
|
3286
3336
|
// src/components/paywall/Paywall.tsx
|
|
3287
3337
|
import { useEffect as useEffect14, useMemo as useMemo9 } from "react";
|
|
3288
|
-
import { useHook as
|
|
3338
|
+
import { useHook as useHook20 } from "@hook-sdk/sdk";
|
|
3289
3339
|
|
|
3290
3340
|
// src/components/paywall/PaywallProvider.tsx
|
|
3291
3341
|
import { createContext as createContext4 } from "react";
|
|
3292
|
-
import { jsx as
|
|
3342
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3293
3343
|
var PaywallContext = createContext4(null);
|
|
3294
3344
|
function PaywallProvider({ children }) {
|
|
3295
3345
|
const state = usePaywallState();
|
|
3296
|
-
return /* @__PURE__ */
|
|
3346
|
+
return /* @__PURE__ */ jsx31(PaywallContext.Provider, { value: state, children });
|
|
3297
3347
|
}
|
|
3298
3348
|
|
|
3299
3349
|
// src/components/paywall/usePaywallContext.ts
|
|
@@ -3307,7 +3357,7 @@ function usePaywallContext() {
|
|
|
3307
3357
|
}
|
|
3308
3358
|
|
|
3309
3359
|
// src/components/paywall/PaywallMethodTabs.tsx
|
|
3310
|
-
import { jsx as
|
|
3360
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3311
3361
|
function PaywallMethodTabs({
|
|
3312
3362
|
labels,
|
|
3313
3363
|
className,
|
|
@@ -3316,10 +3366,10 @@ function PaywallMethodTabs({
|
|
|
3316
3366
|
}) {
|
|
3317
3367
|
const { methods, selectedMethod, selectMethod } = usePaywallContext();
|
|
3318
3368
|
if (methods.length < 2) return null;
|
|
3319
|
-
return /* @__PURE__ */
|
|
3369
|
+
return /* @__PURE__ */ jsx32("div", { role: "tablist", "aria-label": "M\xE9todo de pagamento", className, children: methods.map((m) => {
|
|
3320
3370
|
const active = m === selectedMethod;
|
|
3321
3371
|
const label = labels[m] ?? m;
|
|
3322
|
-
return /* @__PURE__ */
|
|
3372
|
+
return /* @__PURE__ */ jsx32(
|
|
3323
3373
|
"button",
|
|
3324
3374
|
{
|
|
3325
3375
|
type: "button",
|
|
@@ -3337,16 +3387,16 @@ function PaywallMethodTabs({
|
|
|
3337
3387
|
}
|
|
3338
3388
|
|
|
3339
3389
|
// src/components/paywall/PaywallMethodContent.tsx
|
|
3340
|
-
import { jsx as
|
|
3390
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3341
3391
|
function PaywallMethodContent({ copy, className, rowClassName }) {
|
|
3342
3392
|
const { selectedMethod, hasConsumedTrial } = usePaywallContext();
|
|
3343
3393
|
const useCardConsumed = selectedMethod === "card" && hasConsumedTrial && copy.cardConsumedTrial;
|
|
3344
3394
|
const rows = useCardConsumed ? copy.cardConsumedTrial.bodyRows : selectedMethod === "pix-auto" || selectedMethod === "pix-once" ? copy.pix.bodyRows : copy.card.bodyRows;
|
|
3345
|
-
return /* @__PURE__ */
|
|
3395
|
+
return /* @__PURE__ */ jsx33("div", { role: "tabpanel", id: `paywall-tab-${selectedMethod}`, className, children: rows.map((row, i) => /* @__PURE__ */ jsx33("div", { className: rowClassName, children: row }, i)) });
|
|
3346
3396
|
}
|
|
3347
3397
|
|
|
3348
3398
|
// src/components/paywall/PaywallCyclePicker.tsx
|
|
3349
|
-
import { jsx as
|
|
3399
|
+
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3350
3400
|
var VARIANT_CLASSES = {
|
|
3351
3401
|
default: { card: "", cardSelected: "" },
|
|
3352
3402
|
"premium-gold": {
|
|
@@ -3371,7 +3421,7 @@ function PaywallCyclePicker({
|
|
|
3371
3421
|
const { cycle: selected, setCycle, plan, anchorPriceCents } = ctx;
|
|
3372
3422
|
const cycles = ["MONTHLY", "YEARLY"];
|
|
3373
3423
|
if (render) {
|
|
3374
|
-
return /* @__PURE__ */
|
|
3424
|
+
return /* @__PURE__ */ jsx34("div", { className, children: render({ cycles, selected, setCycle, plan, anchorPriceCents }) });
|
|
3375
3425
|
}
|
|
3376
3426
|
if (cycles.length < 2) return null;
|
|
3377
3427
|
const v = VARIANT_CLASSES[variant];
|
|
@@ -3381,7 +3431,7 @@ function PaywallCyclePicker({
|
|
|
3381
3431
|
const yearlyCents = plan?.yearlyCents ?? 0;
|
|
3382
3432
|
const anchorMonthly = plan?.anchorMonthlyCents ?? null;
|
|
3383
3433
|
const anchorYearly = plan?.anchorYearlyCents ?? null;
|
|
3384
|
-
return /* @__PURE__ */
|
|
3434
|
+
return /* @__PURE__ */ jsx34(
|
|
3385
3435
|
"div",
|
|
3386
3436
|
{
|
|
3387
3437
|
role: "radiogroup",
|
|
@@ -3393,7 +3443,7 @@ function PaywallCyclePicker({
|
|
|
3393
3443
|
const suffix = c === "YEARLY" ? labels.annualSuffix : labels.monthlySuffix;
|
|
3394
3444
|
const mainCents = c === "YEARLY" ? Math.round(yearlyCents / 12) : monthlyCents;
|
|
3395
3445
|
const anchorCents = c === "YEARLY" ? anchorYearly : anchorMonthly;
|
|
3396
|
-
return /* @__PURE__ */
|
|
3446
|
+
return /* @__PURE__ */ jsxs20(
|
|
3397
3447
|
"button",
|
|
3398
3448
|
{
|
|
3399
3449
|
type: "button",
|
|
@@ -3406,10 +3456,10 @@ function PaywallCyclePicker({
|
|
|
3406
3456
|
active ? composedCardSelectedClassName : ""
|
|
3407
3457
|
].filter(Boolean).join(" "),
|
|
3408
3458
|
children: [
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsx34("span", { className: "font-bold text-base leading-tight", children: formatBRL(mainCents) }),
|
|
3460
|
+
/* @__PURE__ */ jsx34("span", { className: "text-xs opacity-70 leading-tight", children: suffix }),
|
|
3461
|
+
/* @__PURE__ */ jsx34("span", { className: "text-xs opacity-60 leading-tight", children: label }),
|
|
3462
|
+
anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */ jsx34("span", { className: anchorClassName ?? "text-xs opacity-50", children: /* @__PURE__ */ jsx34("s", { children: formatBRL(anchorCents) }) }) : null
|
|
3413
3463
|
]
|
|
3414
3464
|
},
|
|
3415
3465
|
c
|
|
@@ -3420,7 +3470,7 @@ function PaywallCyclePicker({
|
|
|
3420
3470
|
}
|
|
3421
3471
|
|
|
3422
3472
|
// src/components/paywall/Paywall.tsx
|
|
3423
|
-
import { jsx as
|
|
3473
|
+
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3424
3474
|
var NBSP = "\xA0";
|
|
3425
3475
|
function Paywall({
|
|
3426
3476
|
copy,
|
|
@@ -3428,7 +3478,7 @@ function Paywall({
|
|
|
3428
3478
|
slots = {},
|
|
3429
3479
|
onBeforeCheckout
|
|
3430
3480
|
}) {
|
|
3431
|
-
return /* @__PURE__ */
|
|
3481
|
+
return /* @__PURE__ */ jsx35(PaywallProvider, { children: /* @__PURE__ */ jsx35(
|
|
3432
3482
|
PaywallInner,
|
|
3433
3483
|
{
|
|
3434
3484
|
copy,
|
|
@@ -3444,7 +3494,7 @@ function PaywallInner({
|
|
|
3444
3494
|
slots = {},
|
|
3445
3495
|
onBeforeCheckout
|
|
3446
3496
|
}) {
|
|
3447
|
-
const { track: track2 } =
|
|
3497
|
+
const { track: track2 } = useHook20();
|
|
3448
3498
|
const s = usePaywallContext();
|
|
3449
3499
|
const priceLabel = formatBRL(s.currentPriceCents).replace(new RegExp(NBSP, "g"), " ");
|
|
3450
3500
|
const trialDaysCardLabel = String(s.trialDaysCard);
|
|
@@ -3501,15 +3551,15 @@ function PaywallInner({
|
|
|
3501
3551
|
await s.submit();
|
|
3502
3552
|
};
|
|
3503
3553
|
const ctaTheme = s.selectedMethod === "card" ? themeClasses.ctaCard : themeClasses.ctaPix;
|
|
3504
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ jsxs21("div", { className: themeClasses.container, children: [
|
|
3505
3555
|
slots.heroSlot,
|
|
3506
|
-
/* @__PURE__ */
|
|
3507
|
-
/* @__PURE__ */
|
|
3556
|
+
/* @__PURE__ */ jsx35("h1", { className: themeClasses.headline, children: copy.headline }),
|
|
3557
|
+
/* @__PURE__ */ jsx35("ul", { children: copy.features.map((f) => /* @__PURE__ */ jsxs21("li", { className: themeClasses.feature, children: [
|
|
3508
3558
|
"\u2713 ",
|
|
3509
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsx35("span", { children: f })
|
|
3510
3560
|
] }, f)) }),
|
|
3511
|
-
copy.socialProof ? /* @__PURE__ */
|
|
3512
|
-
slots.cyclePickerSlot ?? /* @__PURE__ */
|
|
3561
|
+
copy.socialProof ? /* @__PURE__ */ jsx35("p", { className: themeClasses.socialProof, children: copy.socialProof }) : null,
|
|
3562
|
+
slots.cyclePickerSlot ?? /* @__PURE__ */ jsx35(
|
|
3513
3563
|
PaywallCyclePicker,
|
|
3514
3564
|
{
|
|
3515
3565
|
labels: copy.cycle,
|
|
@@ -3518,7 +3568,7 @@ function PaywallInner({
|
|
|
3518
3568
|
anchorClassName: themeClasses.anchorPrice
|
|
3519
3569
|
}
|
|
3520
3570
|
),
|
|
3521
|
-
/* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsx35(
|
|
3522
3572
|
PaywallMethodTabs,
|
|
3523
3573
|
{
|
|
3524
3574
|
labels: { "pix-auto": copy.pix.tabLabel, card: copy.card.tabLabel },
|
|
@@ -3527,7 +3577,7 @@ function PaywallInner({
|
|
|
3527
3577
|
tabActiveClassName: themeClasses.tabActive
|
|
3528
3578
|
}
|
|
3529
3579
|
),
|
|
3530
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx35(
|
|
3531
3581
|
PaywallMethodContent,
|
|
3532
3582
|
{
|
|
3533
3583
|
copy: {
|
|
@@ -3545,8 +3595,8 @@ function PaywallInner({
|
|
|
3545
3595
|
}
|
|
3546
3596
|
),
|
|
3547
3597
|
slots.beforeCtaSlot,
|
|
3548
|
-
/* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
3599
|
+
/* @__PURE__ */ jsx35(
|
|
3550
3600
|
"button",
|
|
3551
3601
|
{
|
|
3552
3602
|
type: "button",
|
|
@@ -3558,8 +3608,8 @@ function PaywallInner({
|
|
|
3558
3608
|
children: s.submitting ? "Abrindo checkout\u2026" : ctaLabel
|
|
3559
3609
|
}
|
|
3560
3610
|
),
|
|
3561
|
-
switchHint ? /* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3611
|
+
switchHint ? /* @__PURE__ */ jsx35("p", { className: themeClasses.switchHint, children: switchHint }) : null,
|
|
3612
|
+
/* @__PURE__ */ jsx35("p", { className: themeClasses.trustLine, children: copy.trustLine })
|
|
3563
3613
|
] })
|
|
3564
3614
|
] });
|
|
3565
3615
|
}
|
|
@@ -3576,7 +3626,7 @@ function interpolateCopy(m, price, days) {
|
|
|
3576
3626
|
}
|
|
3577
3627
|
|
|
3578
3628
|
// src/components/paywall/PaywallCta.tsx
|
|
3579
|
-
import { jsx as
|
|
3629
|
+
import { jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3580
3630
|
function PaywallCta({
|
|
3581
3631
|
ctaLabel,
|
|
3582
3632
|
loadingLabel,
|
|
@@ -3589,8 +3639,8 @@ function PaywallCta({
|
|
|
3589
3639
|
}) {
|
|
3590
3640
|
const { submit, submitting } = usePaywallContext();
|
|
3591
3641
|
const label = submitting && loadingLabel ? loadingLabel : ctaLabel;
|
|
3592
|
-
return /* @__PURE__ */
|
|
3593
|
-
/* @__PURE__ */
|
|
3642
|
+
return /* @__PURE__ */ jsxs22("div", { className, children: [
|
|
3643
|
+
/* @__PURE__ */ jsx36(
|
|
3594
3644
|
"button",
|
|
3595
3645
|
{
|
|
3596
3646
|
type: "button",
|
|
@@ -3602,20 +3652,20 @@ function PaywallCta({
|
|
|
3602
3652
|
children: label
|
|
3603
3653
|
}
|
|
3604
3654
|
),
|
|
3605
|
-
switchHint ? /* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3655
|
+
switchHint ? /* @__PURE__ */ jsx36("p", { className: switchHintClassName, children: switchHint }) : null,
|
|
3656
|
+
/* @__PURE__ */ jsx36("p", { className: trustClassName, children: trustLine })
|
|
3607
3657
|
] });
|
|
3608
3658
|
}
|
|
3609
3659
|
|
|
3610
3660
|
// src/components/paywall/blocks/PaywallEyebrow.tsx
|
|
3611
|
-
import { jsx as
|
|
3661
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3612
3662
|
var DEFAULT_EYEBROW_CLASSES = "text-xs uppercase tracking-widest font-semibold opacity-70";
|
|
3613
3663
|
function PaywallEyebrow({ text, className }) {
|
|
3614
|
-
return /* @__PURE__ */
|
|
3664
|
+
return /* @__PURE__ */ jsx37("div", { className: [DEFAULT_EYEBROW_CLASSES, className].filter(Boolean).join(" "), children: text });
|
|
3615
3665
|
}
|
|
3616
3666
|
|
|
3617
3667
|
// src/components/paywall/blocks/PaywallHero.tsx
|
|
3618
|
-
import { jsx as
|
|
3668
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3619
3669
|
var DEFAULT_GRADIENT = "absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent";
|
|
3620
3670
|
function PaywallHero({
|
|
3621
3671
|
src,
|
|
@@ -3629,15 +3679,15 @@ function PaywallHero({
|
|
|
3629
3679
|
render
|
|
3630
3680
|
}) {
|
|
3631
3681
|
if (render) {
|
|
3632
|
-
return /* @__PURE__ */
|
|
3682
|
+
return /* @__PURE__ */ jsx38("div", { className, children: render({ src, headline }) });
|
|
3633
3683
|
}
|
|
3634
|
-
return /* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ jsxs23(
|
|
3635
3685
|
"div",
|
|
3636
3686
|
{
|
|
3637
3687
|
className: ["relative overflow-hidden", className].filter(Boolean).join(" "),
|
|
3638
3688
|
style: { aspectRatio },
|
|
3639
3689
|
children: [
|
|
3640
|
-
/* @__PURE__ */
|
|
3690
|
+
/* @__PURE__ */ jsx38(
|
|
3641
3691
|
"img",
|
|
3642
3692
|
{
|
|
3643
3693
|
src,
|
|
@@ -3645,8 +3695,8 @@ function PaywallHero({
|
|
|
3645
3695
|
className: ["absolute inset-0 w-full h-full object-cover", imgClassName].filter(Boolean).join(" ")
|
|
3646
3696
|
}
|
|
3647
3697
|
),
|
|
3648
|
-
/* @__PURE__ */
|
|
3649
|
-
headline ? /* @__PURE__ */
|
|
3698
|
+
/* @__PURE__ */ jsx38("div", { className: gradientClassName ?? DEFAULT_GRADIENT, "aria-hidden": "true" }),
|
|
3699
|
+
headline ? /* @__PURE__ */ jsx38(
|
|
3650
3700
|
"h1",
|
|
3651
3701
|
{
|
|
3652
3702
|
className: ["absolute bottom-0 left-0 right-0 p-4 text-white font-bold text-2xl", headlineClassName].filter(Boolean).join(" "),
|
|
@@ -3659,15 +3709,15 @@ function PaywallHero({
|
|
|
3659
3709
|
}
|
|
3660
3710
|
|
|
3661
3711
|
// src/components/paywall/blocks/PaywallHeadline.tsx
|
|
3662
|
-
import { jsx as
|
|
3712
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
3663
3713
|
var DEFAULT_HEADLINE_CLASSES = "text-2xl font-bold leading-tight";
|
|
3664
3714
|
function PaywallHeadline({ text, className, as = "h1" }) {
|
|
3665
3715
|
const Tag = as;
|
|
3666
|
-
return /* @__PURE__ */
|
|
3716
|
+
return /* @__PURE__ */ jsx39(Tag, { className: [DEFAULT_HEADLINE_CLASSES, className].filter(Boolean).join(" "), children: text });
|
|
3667
3717
|
}
|
|
3668
3718
|
|
|
3669
3719
|
// src/components/paywall/blocks/PaywallPriceHeadline.tsx
|
|
3670
|
-
import { jsx as
|
|
3720
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3671
3721
|
var DEFAULT_CLASS = "text-2xl font-bold leading-tight";
|
|
3672
3722
|
var CYCLE_LABEL = {
|
|
3673
3723
|
MONTHLY: "mensal",
|
|
@@ -3687,16 +3737,16 @@ function PaywallPriceHeadline({
|
|
|
3687
3737
|
const rootClasses = [DEFAULT_CLASS, className].filter(Boolean).join(" ");
|
|
3688
3738
|
if (render) {
|
|
3689
3739
|
const RootTag2 = as;
|
|
3690
|
-
return /* @__PURE__ */
|
|
3740
|
+
return /* @__PURE__ */ jsx40(RootTag2, { className: [className].filter(Boolean).join(" ") || void 0, children: render({ pricePerDay, currentMonthlyEquivCents: monthlyEquiv, cycle }) });
|
|
3691
3741
|
}
|
|
3692
3742
|
const text = template.replaceAll("{pricePerDay}", pricePerDay).replaceAll("{currentMonthlyEquiv}", formatBRL(monthlyEquiv)).replaceAll("{cycle}", cycleLabel);
|
|
3693
3743
|
const RootTag = as;
|
|
3694
|
-
return /* @__PURE__ */
|
|
3744
|
+
return /* @__PURE__ */ jsx40(RootTag, { className: rootClasses, children: text });
|
|
3695
3745
|
}
|
|
3696
3746
|
|
|
3697
3747
|
// src/components/paywall/blocks/PaywallCountdown.tsx
|
|
3698
|
-
import { useEffect as useEffect15, useRef as useRef7, useState as
|
|
3699
|
-
import { jsx as
|
|
3748
|
+
import { useEffect as useEffect15, useRef as useRef7, useState as useState15 } from "react";
|
|
3749
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3700
3750
|
var DEFAULT_COUNTDOWN_CLASSES = "font-mono tabular-nums";
|
|
3701
3751
|
function resolveDeadlineMs(deadline) {
|
|
3702
3752
|
if (deadline instanceof Date) return deadline.getTime();
|
|
@@ -3737,7 +3787,7 @@ function PaywallCountdown({
|
|
|
3737
3787
|
if (deadlineMsRef.current === null) {
|
|
3738
3788
|
deadlineMsRef.current = resolveDeadlineMs(deadline);
|
|
3739
3789
|
}
|
|
3740
|
-
const [state, setState] =
|
|
3790
|
+
const [state, setState] = useState15(() => computeRemaining(deadlineMsRef.current));
|
|
3741
3791
|
const expiredCalledRef = useRef7(false);
|
|
3742
3792
|
useEffect15(() => {
|
|
3743
3793
|
if (state.expired) {
|
|
@@ -3759,14 +3809,14 @@ function PaywallCountdown({
|
|
|
3759
3809
|
return () => clearInterval(id);
|
|
3760
3810
|
}, [state.expired]);
|
|
3761
3811
|
if (render) {
|
|
3762
|
-
return /* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsx41("div", { className, children: render(state) });
|
|
3763
3813
|
}
|
|
3764
3814
|
const formatted = format === "h:m:s" ? `${pad(state.h)}:${pad(state.m)}:${pad(state.s)}` : `${pad(state.h * 60 + state.m)}:${pad(state.s)}`;
|
|
3765
|
-
return /* @__PURE__ */
|
|
3815
|
+
return /* @__PURE__ */ jsx41("div", { className: [DEFAULT_COUNTDOWN_CLASSES, className].filter(Boolean).join(" "), children: formatted });
|
|
3766
3816
|
}
|
|
3767
3817
|
|
|
3768
3818
|
// src/components/paywall/blocks/PaywallFeatures.tsx
|
|
3769
|
-
import { jsx as
|
|
3819
|
+
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3770
3820
|
function PaywallFeatures({
|
|
3771
3821
|
items,
|
|
3772
3822
|
IconComponent,
|
|
@@ -3777,19 +3827,19 @@ function PaywallFeatures({
|
|
|
3777
3827
|
renderItem
|
|
3778
3828
|
}) {
|
|
3779
3829
|
if (render) {
|
|
3780
|
-
return /* @__PURE__ */
|
|
3830
|
+
return /* @__PURE__ */ jsx42("div", { className, children: render({ items }) });
|
|
3781
3831
|
}
|
|
3782
3832
|
if (renderItem) {
|
|
3783
|
-
return /* @__PURE__ */
|
|
3833
|
+
return /* @__PURE__ */ jsx42("ul", { className, children: items.map((item, idx) => /* @__PURE__ */ jsx42("li", { children: renderItem(item, idx) }, idx)) });
|
|
3784
3834
|
}
|
|
3785
|
-
return /* @__PURE__ */
|
|
3786
|
-
IconComponent ? /* @__PURE__ */
|
|
3787
|
-
/* @__PURE__ */
|
|
3835
|
+
return /* @__PURE__ */ jsx42("ul", { className, children: items.map((item, idx) => /* @__PURE__ */ jsxs24("li", { className: itemClassName, children: [
|
|
3836
|
+
IconComponent ? /* @__PURE__ */ jsx42(IconComponent, { className: iconClassName }) : /* @__PURE__ */ jsx42("span", { className: iconClassName, "aria-hidden": "true", children: "\u2713" }),
|
|
3837
|
+
/* @__PURE__ */ jsx42("span", { children: item })
|
|
3788
3838
|
] }, idx)) });
|
|
3789
3839
|
}
|
|
3790
3840
|
|
|
3791
3841
|
// src/components/paywall/blocks/PaywallFeaturesCard.tsx
|
|
3792
|
-
import { jsx as
|
|
3842
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3793
3843
|
var DEFAULT_CARD_CLASSES = "rounded-xl border p-4";
|
|
3794
3844
|
function PaywallFeaturesCard({
|
|
3795
3845
|
title,
|
|
@@ -3800,20 +3850,20 @@ function PaywallFeaturesCard({
|
|
|
3800
3850
|
itemClassName,
|
|
3801
3851
|
renderItem
|
|
3802
3852
|
}) {
|
|
3803
|
-
return /* @__PURE__ */
|
|
3804
|
-
title ? /* @__PURE__ */
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
(item, idx) => renderItem ? /* @__PURE__ */
|
|
3807
|
-
/* @__PURE__ */
|
|
3853
|
+
return /* @__PURE__ */ jsx43("div", { className, children: /* @__PURE__ */ jsxs25("div", { className: [DEFAULT_CARD_CLASSES, cardClassName].filter(Boolean).join(" "), children: [
|
|
3854
|
+
title ? /* @__PURE__ */ jsx43("div", { className: ["font-semibold mb-2", titleClassName].filter(Boolean).join(" "), children: title }) : null,
|
|
3855
|
+
/* @__PURE__ */ jsx43("ul", { children: items.map(
|
|
3856
|
+
(item, idx) => renderItem ? /* @__PURE__ */ jsx43("li", { children: renderItem(item, idx) }, idx) : /* @__PURE__ */ jsxs25("li", { className: itemClassName, children: [
|
|
3857
|
+
/* @__PURE__ */ jsx43("span", { "aria-hidden": "true", children: "\u2022" }),
|
|
3808
3858
|
" ",
|
|
3809
|
-
/* @__PURE__ */
|
|
3859
|
+
/* @__PURE__ */ jsx43("span", { children: item })
|
|
3810
3860
|
] }, idx)
|
|
3811
3861
|
) })
|
|
3812
3862
|
] }) });
|
|
3813
3863
|
}
|
|
3814
3864
|
|
|
3815
3865
|
// src/components/paywall/blocks/PaywallTrophyBadge.tsx
|
|
3816
|
-
import { jsx as
|
|
3866
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3817
3867
|
var DEFAULT_CHIP_CLASSES = "inline-flex items-center gap-1 px-3 py-1 rounded-full bg-yellow-100 text-yellow-900 text-sm font-medium";
|
|
3818
3868
|
var FLOATING_CLASSES = "absolute top-2 right-2 z-10 shadow-md";
|
|
3819
3869
|
function PaywallTrophyBadge({
|
|
@@ -3824,21 +3874,21 @@ function PaywallTrophyBadge({
|
|
|
3824
3874
|
render
|
|
3825
3875
|
}) {
|
|
3826
3876
|
if (render) {
|
|
3827
|
-
return /* @__PURE__ */
|
|
3877
|
+
return /* @__PURE__ */ jsx44("div", { className, children: render({ text }) });
|
|
3828
3878
|
}
|
|
3829
3879
|
const rootClasses = [
|
|
3830
3880
|
DEFAULT_CHIP_CLASSES,
|
|
3831
3881
|
floating ? FLOATING_CLASSES : "",
|
|
3832
3882
|
className
|
|
3833
3883
|
].filter(Boolean).join(" ");
|
|
3834
|
-
return /* @__PURE__ */
|
|
3835
|
-
/* @__PURE__ */
|
|
3836
|
-
/* @__PURE__ */
|
|
3884
|
+
return /* @__PURE__ */ jsxs26("div", { className: rootClasses, children: [
|
|
3885
|
+
/* @__PURE__ */ jsx44("span", { className: iconClassName, "aria-hidden": "true", children: "\u{1F3C6}" }),
|
|
3886
|
+
/* @__PURE__ */ jsx44("span", { children: text })
|
|
3837
3887
|
] });
|
|
3838
3888
|
}
|
|
3839
3889
|
|
|
3840
3890
|
// src/components/paywall/blocks/PaywallAnchorPrice.tsx
|
|
3841
|
-
import { jsx as
|
|
3891
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3842
3892
|
var DEFAULT_CLASS2 = "text-sm opacity-60 line-through";
|
|
3843
3893
|
function PaywallAnchorPrice({
|
|
3844
3894
|
className,
|
|
@@ -3852,13 +3902,13 @@ function PaywallAnchorPrice({
|
|
|
3852
3902
|
const formatted = formatBRL(anchorPriceCents);
|
|
3853
3903
|
const rootClasses = [DEFAULT_CLASS2, className].filter(Boolean).join(" ");
|
|
3854
3904
|
if (render) {
|
|
3855
|
-
return /* @__PURE__ */
|
|
3905
|
+
return /* @__PURE__ */ jsx45("span", { className: className || void 0, children: render({ anchorCents: anchorPriceCents, formatted }) });
|
|
3856
3906
|
}
|
|
3857
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ jsx45("span", { className: rootClasses, children: formatted });
|
|
3858
3908
|
}
|
|
3859
3909
|
|
|
3860
3910
|
// src/components/paywall/blocks/PaywallTestimonials.tsx
|
|
3861
|
-
import { jsx as
|
|
3911
|
+
import { jsx as jsx46, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3862
3912
|
var DEFAULT_ROOT = "flex gap-3 overflow-x-auto snap-x snap-mandatory pb-2";
|
|
3863
3913
|
var DEFAULT_CARD = "snap-start shrink-0 w-72 rounded-2xl border p-4 flex flex-col gap-2";
|
|
3864
3914
|
var DEFAULT_AVATAR = "w-10 h-10 rounded-full object-cover";
|
|
@@ -3884,13 +3934,13 @@ function PaywallTestimonials({
|
|
|
3884
3934
|
const quoteClasses = [DEFAULT_QUOTE, quoteClassName].filter(Boolean).join(" ");
|
|
3885
3935
|
const nameClasses = [DEFAULT_NAME, nameClassName].filter(Boolean).join(" ");
|
|
3886
3936
|
const starsClasses = [DEFAULT_STARS, starsClassName].filter(Boolean).join(" ");
|
|
3887
|
-
return /* @__PURE__ */
|
|
3937
|
+
return /* @__PURE__ */ jsx46("div", { className: rootClasses, children: items.map((item, idx) => {
|
|
3888
3938
|
if (renderItem) return renderItem(item, idx);
|
|
3889
3939
|
const filled = clampStars(item.stars);
|
|
3890
3940
|
const empty = 5 - filled;
|
|
3891
|
-
return /* @__PURE__ */
|
|
3892
|
-
/* @__PURE__ */
|
|
3893
|
-
item.avatar ? /* @__PURE__ */
|
|
3941
|
+
return /* @__PURE__ */ jsxs27("div", { className: cardClasses, children: [
|
|
3942
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
|
|
3943
|
+
item.avatar ? /* @__PURE__ */ jsx46(
|
|
3894
3944
|
"img",
|
|
3895
3945
|
{
|
|
3896
3946
|
src: item.avatar,
|
|
@@ -3900,19 +3950,19 @@ function PaywallTestimonials({
|
|
|
3900
3950
|
"aria-hidden": "true"
|
|
3901
3951
|
}
|
|
3902
3952
|
) : null,
|
|
3903
|
-
/* @__PURE__ */
|
|
3953
|
+
/* @__PURE__ */ jsx46("div", { className: nameClasses, children: item.name })
|
|
3904
3954
|
] }),
|
|
3905
|
-
/* @__PURE__ */
|
|
3955
|
+
/* @__PURE__ */ jsxs27("div", { className: starsClasses, "aria-label": `${filled} de 5 estrelas`, children: [
|
|
3906
3956
|
"\u2605".repeat(filled),
|
|
3907
3957
|
"\u2606".repeat(empty)
|
|
3908
3958
|
] }),
|
|
3909
|
-
/* @__PURE__ */
|
|
3959
|
+
/* @__PURE__ */ jsx46("p", { className: quoteClasses, children: item.quote })
|
|
3910
3960
|
] }, idx);
|
|
3911
3961
|
}) });
|
|
3912
3962
|
}
|
|
3913
3963
|
|
|
3914
3964
|
// src/components/paywall/blocks/PaywallStatsRow.tsx
|
|
3915
|
-
import { jsx as
|
|
3965
|
+
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3916
3966
|
var DEFAULT_ROOT2 = "grid grid-cols-3 gap-4";
|
|
3917
3967
|
var DEFAULT_CELL = "flex flex-col items-center text-center";
|
|
3918
3968
|
var DEFAULT_VALUE = "text-2xl font-bold";
|
|
@@ -3929,18 +3979,18 @@ function PaywallStatsRow({
|
|
|
3929
3979
|
const cellClasses = [DEFAULT_CELL, cellClassName].filter(Boolean).join(" ");
|
|
3930
3980
|
const valueClasses = [DEFAULT_VALUE, valueClassName].filter(Boolean).join(" ");
|
|
3931
3981
|
const labelClasses = [DEFAULT_LABEL, labelClassName].filter(Boolean).join(" ");
|
|
3932
|
-
return /* @__PURE__ */
|
|
3982
|
+
return /* @__PURE__ */ jsx47("div", { className: rootClasses, children: stats.map((stat, idx) => {
|
|
3933
3983
|
if (renderCell) return renderCell(stat, idx);
|
|
3934
|
-
return /* @__PURE__ */
|
|
3935
|
-
stat.icon ? /* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3984
|
+
return /* @__PURE__ */ jsxs28("div", { className: cellClasses, children: [
|
|
3985
|
+
stat.icon ? /* @__PURE__ */ jsx47("div", { "aria-hidden": "true", children: stat.icon }) : null,
|
|
3986
|
+
/* @__PURE__ */ jsx47("div", { className: valueClasses, children: stat.value }),
|
|
3987
|
+
/* @__PURE__ */ jsx47("div", { className: labelClasses, children: stat.label })
|
|
3938
3988
|
] }, idx);
|
|
3939
3989
|
}) });
|
|
3940
3990
|
}
|
|
3941
3991
|
|
|
3942
3992
|
// src/components/paywall/blocks/PaywallFinePrint.tsx
|
|
3943
|
-
import { jsx as
|
|
3993
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
3944
3994
|
var DEFAULT_CLASS3 = "text-xs opacity-60 leading-snug";
|
|
3945
3995
|
var CYCLE_LABEL2 = {
|
|
3946
3996
|
MONTHLY: "mensal",
|
|
@@ -3963,7 +4013,7 @@ function PaywallFinePrint({
|
|
|
3963
4013
|
const priceFormatted = formatBRL(currentPriceCents ?? 0);
|
|
3964
4014
|
const rootClasses = [DEFAULT_CLASS3, className].filter(Boolean).join(" ");
|
|
3965
4015
|
if (render) {
|
|
3966
|
-
return /* @__PURE__ */
|
|
4016
|
+
return /* @__PURE__ */ jsx48("p", { className: className || void 0, children: render({
|
|
3967
4017
|
currentPriceCents: currentPriceCents ?? 0,
|
|
3968
4018
|
cycle,
|
|
3969
4019
|
trialDays: trialDays ?? 0,
|
|
@@ -3971,11 +4021,11 @@ function PaywallFinePrint({
|
|
|
3971
4021
|
}) });
|
|
3972
4022
|
}
|
|
3973
4023
|
const text = template.replaceAll("{price}", priceFormatted).replaceAll("{trialDays}", String(trialDays ?? 0)).replaceAll("{cycle}", cycleLabel);
|
|
3974
|
-
return /* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsx48("p", { className: rootClasses, children: text });
|
|
3975
4025
|
}
|
|
3976
4026
|
|
|
3977
4027
|
// src/components/paywall/blocks/PaywallTrustLine.tsx
|
|
3978
|
-
import { jsx as
|
|
4028
|
+
import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3979
4029
|
var DEFAULT_ROOT3 = "flex items-center gap-3";
|
|
3980
4030
|
var DEFAULT_ITEM = "flex items-center gap-1.5 text-xs";
|
|
3981
4031
|
function PaywallTrustLine({
|
|
@@ -3986,17 +4036,17 @@ function PaywallTrustLine({
|
|
|
3986
4036
|
}) {
|
|
3987
4037
|
const rootClasses = [DEFAULT_ROOT3, className].filter(Boolean).join(" ");
|
|
3988
4038
|
const itemClasses = [DEFAULT_ITEM, itemClassName].filter(Boolean).join(" ");
|
|
3989
|
-
return /* @__PURE__ */
|
|
4039
|
+
return /* @__PURE__ */ jsx49("div", { className: rootClasses, children: items.map((item, idx) => {
|
|
3990
4040
|
if (renderItem) return renderItem(item, idx);
|
|
3991
|
-
return /* @__PURE__ */
|
|
3992
|
-
/* @__PURE__ */
|
|
3993
|
-
/* @__PURE__ */
|
|
4041
|
+
return /* @__PURE__ */ jsxs29("span", { className: itemClasses, children: [
|
|
4042
|
+
/* @__PURE__ */ jsx49("span", { "aria-hidden": "true", children: item.icon }),
|
|
4043
|
+
/* @__PURE__ */ jsx49("span", { children: item.text })
|
|
3994
4044
|
] }, idx);
|
|
3995
4045
|
}) });
|
|
3996
4046
|
}
|
|
3997
4047
|
|
|
3998
4048
|
// src/components/paywall/blocks/PaywallStickyFooter.tsx
|
|
3999
|
-
import { jsx as
|
|
4049
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
4000
4050
|
var DEFAULT_CLASSES = "sticky bottom-0 left-0 right-0 bg-background";
|
|
4001
4051
|
var SAFE_AREA_CLASS = "pb-[env(safe-area-inset-bottom)]";
|
|
4002
4052
|
function PaywallStickyFooter({
|
|
@@ -4005,7 +4055,7 @@ function PaywallStickyFooter({
|
|
|
4005
4055
|
safeAreaInsets = true
|
|
4006
4056
|
}) {
|
|
4007
4057
|
const classes = [DEFAULT_CLASSES, safeAreaInsets ? SAFE_AREA_CLASS : null, className].filter(Boolean).join(" ");
|
|
4008
|
-
return /* @__PURE__ */
|
|
4058
|
+
return /* @__PURE__ */ jsx50("div", { className: classes, children });
|
|
4009
4059
|
}
|
|
4010
4060
|
export {
|
|
4011
4061
|
AppConfigProvider,
|