@hook-sdk/template 0.27.0 → 0.28.1
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 +365 -146
- 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 +417 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2108,7 +2108,7 @@ function isDevToolsEnabled() {
|
|
|
2108
2108
|
|
|
2109
2109
|
// src/dev/DevSkipOnboardingFab.tsx
|
|
2110
2110
|
import { useCallback as useCallback3, useRef as useRef4, useState as useState5 } from "react";
|
|
2111
|
-
import { useHook as useHook5 } from "@hook-sdk/sdk";
|
|
2111
|
+
import { useHook as useHook5, usePersistedState as usePersistedState2 } from "@hook-sdk/sdk";
|
|
2112
2112
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2113
2113
|
var STORAGE_KEY = "hook_dev_skip_email";
|
|
2114
2114
|
var TEST_EMAIL_DOMAIN = "@hook.test";
|
|
@@ -2181,6 +2181,13 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2181
2181
|
const [state, setState] = useState5("idle");
|
|
2182
2182
|
const [errorMsg, setErrorMsg] = useState5(null);
|
|
2183
2183
|
const timerRef = useRef4(null);
|
|
2184
|
+
const isAuthed = hook.authStatus === "authenticated";
|
|
2185
|
+
const [onboarding] = usePersistedState2(
|
|
2186
|
+
"onboarding_data",
|
|
2187
|
+
null,
|
|
2188
|
+
{ enabled: isAuthed }
|
|
2189
|
+
);
|
|
2190
|
+
const onboardingCompleted = isAuthed && onboarding?.onboarding_completed === true;
|
|
2184
2191
|
const clearTimer = useCallback3(() => {
|
|
2185
2192
|
if (timerRef.current) {
|
|
2186
2193
|
clearTimeout(timerRef.current);
|
|
@@ -2211,6 +2218,7 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2211
2218
|
if (state === "error") return `failed \u2014 tap to retry`;
|
|
2212
2219
|
return hook.authStatus === "authenticated" ? "\u26A1 skip onboarding" : "\u26A1 skip + signup";
|
|
2213
2220
|
})();
|
|
2221
|
+
if (onboardingCompleted) return null;
|
|
2214
2222
|
const style = {
|
|
2215
2223
|
...STYLES.base,
|
|
2216
2224
|
...state === "confirm" || state === "error" ? STYLES.confirm : {},
|
|
@@ -2684,12 +2692,12 @@ function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, clas
|
|
|
2684
2692
|
}
|
|
2685
2693
|
|
|
2686
2694
|
// src/components/LanguageSwitcher.tsx
|
|
2687
|
-
import { usePersistedState as
|
|
2695
|
+
import { usePersistedState as usePersistedState3 } from "@hook-sdk/sdk";
|
|
2688
2696
|
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2689
2697
|
function LanguageSwitcher({ id, className, label = "Language" }) {
|
|
2690
2698
|
const config = useAppConfig();
|
|
2691
2699
|
const i18nConfig = config.i18n;
|
|
2692
|
-
const [userLocale, setUserLocale] =
|
|
2700
|
+
const [userLocale, setUserLocale] = usePersistedState3(
|
|
2693
2701
|
"user-locale",
|
|
2694
2702
|
i18nConfig?.defaultLocale ?? "en-US"
|
|
2695
2703
|
);
|
|
@@ -2726,7 +2734,7 @@ function EmptyState({ title, description, action }) {
|
|
|
2726
2734
|
}
|
|
2727
2735
|
|
|
2728
2736
|
// src/defaults/CheckoutPageDefault.tsx
|
|
2729
|
-
import { useEffect as useEffect11, useMemo as useMemo5 } from "react";
|
|
2737
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState9 } from "react";
|
|
2730
2738
|
import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
2731
2739
|
|
|
2732
2740
|
// src/hooks/useCheckoutForm.ts
|
|
@@ -2851,7 +2859,7 @@ function useCheckoutForm(args) {
|
|
|
2851
2859
|
const emailConfirmError = touchedEmailConfirm || formSubmitAttempted ? validateEmailConfirm : null;
|
|
2852
2860
|
const phoneError = touchedPhone || formSubmitAttempted ? validatePhone : null;
|
|
2853
2861
|
const cpfError = touchedCpf || formSubmitAttempted ? validateCpf : null;
|
|
2854
|
-
const canSubmit = name.trim().length >= 2 && EMAIL_RE.test(email) && emailConfirm === email && PHONE_RE.test(phone) && validateCpf === null && cpf.replace(/\D/g, "").length === 11 && emailStatus !== "exists" && !submitting && (method !== "card" || card.number.length >= 12 && card.ccv.length >= 3 && card.expiryMonth.length >= 1 && card.expiryYear.length >= 2 && card.holderName.length >= 1);
|
|
2862
|
+
const canSubmit = name.trim().length >= 2 && EMAIL_RE.test(email) && (emailConfirm === "" || emailConfirm === email) && (phone === "" || PHONE_RE.test(phone)) && validateCpf === null && cpf.replace(/\D/g, "").length === 11 && emailStatus !== "exists" && !submitting && (method !== "card" || card.number.length >= 12 && card.ccv.length >= 3 && card.expiryMonth.length >= 1 && card.expiryYear.length >= 2 && card.holderName.length >= 1);
|
|
2855
2863
|
const submit = useCallback6(async () => {
|
|
2856
2864
|
setFormSubmitAttempted(true);
|
|
2857
2865
|
setError(null);
|
|
@@ -2866,7 +2874,7 @@ function useCheckoutForm(args) {
|
|
|
2866
2874
|
method: "card",
|
|
2867
2875
|
name: name.trim(),
|
|
2868
2876
|
email,
|
|
2869
|
-
emailConfirm,
|
|
2877
|
+
emailConfirm: emailConfirm || email,
|
|
2870
2878
|
phone,
|
|
2871
2879
|
cpf: cpf.replace(/\D/g, ""),
|
|
2872
2880
|
cycle,
|
|
@@ -2893,7 +2901,7 @@ function useCheckoutForm(args) {
|
|
|
2893
2901
|
method: "pix-auto",
|
|
2894
2902
|
name: name.trim(),
|
|
2895
2903
|
email,
|
|
2896
|
-
emailConfirm,
|
|
2904
|
+
emailConfirm: emailConfirm || email,
|
|
2897
2905
|
phone,
|
|
2898
2906
|
cpf: cpf.replace(/\D/g, ""),
|
|
2899
2907
|
cycle
|
|
@@ -2966,7 +2974,7 @@ function usePlan() {
|
|
|
2966
2974
|
}
|
|
2967
2975
|
|
|
2968
2976
|
// src/defaults/CheckoutPageDefault.tsx
|
|
2969
|
-
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2977
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2970
2978
|
var INTENT_KEY = "hook:paywall:intent";
|
|
2971
2979
|
var PIX_PAYLOAD_KEY = "hook:paywall:pix-pending";
|
|
2972
2980
|
function readIntent() {
|
|
@@ -2982,13 +2990,49 @@ function readIntent() {
|
|
|
2982
2990
|
function formatBrl(cents) {
|
|
2983
2991
|
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(cents / 100);
|
|
2984
2992
|
}
|
|
2993
|
+
function formatCardNumber(v) {
|
|
2994
|
+
const digits = v.replace(/\D/g, "").slice(0, 16);
|
|
2995
|
+
return digits.replace(/(.{4})/g, "$1 ").trim();
|
|
2996
|
+
}
|
|
2997
|
+
function formatExpiryMmAa(v) {
|
|
2998
|
+
const d = v.replace(/\D/g, "").slice(0, 4);
|
|
2999
|
+
if (d.length < 3) return d;
|
|
3000
|
+
return d.slice(0, 2) + "/" + d.slice(2);
|
|
3001
|
+
}
|
|
3002
|
+
function parseExpiryMmAa(v) {
|
|
3003
|
+
const d = v.replace(/\D/g, "");
|
|
3004
|
+
return { month: d.slice(0, 2), year: d.slice(2, 4) };
|
|
3005
|
+
}
|
|
3006
|
+
function formatCpf(v) {
|
|
3007
|
+
const d = v.replace(/\D/g, "").slice(0, 11);
|
|
3008
|
+
if (d.length <= 3) return d;
|
|
3009
|
+
if (d.length <= 6) return d.slice(0, 3) + "." + d.slice(3);
|
|
3010
|
+
if (d.length <= 9) return d.slice(0, 3) + "." + d.slice(3, 6) + "." + d.slice(6);
|
|
3011
|
+
return d.slice(0, 3) + "." + d.slice(3, 6) + "." + d.slice(6, 9) + "-" + d.slice(9);
|
|
3012
|
+
}
|
|
3013
|
+
function detectCardBrand(num) {
|
|
3014
|
+
const n = num.replace(/\s/g, "");
|
|
3015
|
+
if (/^4/.test(n)) return "VISA";
|
|
3016
|
+
if (/^(5[1-5]|2[2-7])/.test(n)) return "MASTER";
|
|
3017
|
+
if (/^3[47]/.test(n)) return "AMEX";
|
|
3018
|
+
if (/^(4011|4312|4389|4514|6011|6362|6363)/.test(n)) return "ELO";
|
|
3019
|
+
if (/^(606282|3841)/.test(n)) return "HIPER";
|
|
3020
|
+
return "";
|
|
3021
|
+
}
|
|
2985
3022
|
function CheckoutPageDefault() {
|
|
2986
3023
|
const navigate = useNavigate2();
|
|
2987
3024
|
const plan = usePlan();
|
|
2988
3025
|
const intent = useMemo5(readIntent, []);
|
|
2989
3026
|
const defaultMethod = intent.method === "pix-auto" ? "pix-auto" : "card";
|
|
2990
|
-
const defaultCycle = intent.cycle === "
|
|
3027
|
+
const defaultCycle = intent.cycle === "MONTHLY" ? "MONTHLY" : "YEARLY";
|
|
2991
3028
|
const form = useCheckoutForm({ defaultMethod, defaultCycle });
|
|
3029
|
+
const [expiryMmAa, setExpiryMmAa] = useState9("");
|
|
3030
|
+
useEffect11(() => {
|
|
3031
|
+
const { month, year } = parseExpiryMmAa(expiryMmAa);
|
|
3032
|
+
if (month !== form.card.expiryMonth || year !== form.card.expiryYear) {
|
|
3033
|
+
form.setCard({ expiryMonth: month, expiryYear: year });
|
|
3034
|
+
}
|
|
3035
|
+
}, [expiryMmAa]);
|
|
2992
3036
|
useEffect11(() => {
|
|
2993
3037
|
if (form.emailTaken && form.loginUrl) {
|
|
2994
3038
|
const t = setTimeout(() => navigate(form.loginUrl), 1200);
|
|
@@ -3000,21 +3044,30 @@ function CheckoutPageDefault() {
|
|
|
3000
3044
|
yearlyPriceCents: plan.data.yearlyPriceCents,
|
|
3001
3045
|
trialDays: plan.data.trialDays
|
|
3002
3046
|
} : null;
|
|
3047
|
+
const annual = form.cycle === "YEARLY";
|
|
3003
3048
|
const cyclePrice = useMemo5(() => {
|
|
3004
3049
|
if (!planInfo) return null;
|
|
3005
|
-
return
|
|
3006
|
-
}, [planInfo,
|
|
3007
|
-
const
|
|
3008
|
-
if (
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
return cyclePrice
|
|
3017
|
-
}, [form.method,
|
|
3050
|
+
return annual ? planInfo.yearlyPriceCents ?? planInfo.priceCents * 12 : planInfo.priceCents;
|
|
3051
|
+
}, [planInfo, annual]);
|
|
3052
|
+
const monthlyText = useMemo5(() => {
|
|
3053
|
+
if (!planInfo) return "";
|
|
3054
|
+
const monthly = annual && planInfo.yearlyPriceCents ? Math.round(planInfo.yearlyPriceCents / 12) : planInfo.priceCents;
|
|
3055
|
+
return formatBrl(monthly);
|
|
3056
|
+
}, [planInfo, annual]);
|
|
3057
|
+
const todayCents = useMemo5(() => {
|
|
3058
|
+
if (form.method === "pix-auto") return cyclePrice ?? 0;
|
|
3059
|
+
const trialDays2 = planInfo?.trialDays ?? 0;
|
|
3060
|
+
if (trialDays2 > 0) return 0;
|
|
3061
|
+
return cyclePrice ?? 0;
|
|
3062
|
+
}, [form.method, cyclePrice, planInfo]);
|
|
3063
|
+
const todayAmount = formatBrl(todayCents);
|
|
3064
|
+
const cyclePriceText = cyclePrice !== null ? formatBrl(cyclePrice) : "";
|
|
3065
|
+
const annualSavingsCents = useMemo5(() => {
|
|
3066
|
+
if (!planInfo || !planInfo.yearlyPriceCents) return 0;
|
|
3067
|
+
return planInfo.priceCents * 12 - planInfo.yearlyPriceCents;
|
|
3068
|
+
}, [planInfo]);
|
|
3069
|
+
const trialDays = planInfo?.trialDays ?? 7;
|
|
3070
|
+
const cardBrand = detectCardBrand(form.card.number);
|
|
3018
3071
|
async function onSubmit(e) {
|
|
3019
3072
|
e.preventDefault();
|
|
3020
3073
|
const result = await form.submit();
|
|
@@ -3037,207 +3090,373 @@ function CheckoutPageDefault() {
|
|
|
3037
3090
|
}
|
|
3038
3091
|
navigate(result.redirect.replace(/^.*\/app\/[^/]+/, "") || "/");
|
|
3039
3092
|
}
|
|
3040
|
-
return /* @__PURE__ */ jsx27("div", { className: "flex-1 flex flex-col bg-background min-h-0", children: /* @__PURE__ */ jsxs18("form", { onSubmit, className: "flex-1 overflow-y-auto
|
|
3041
|
-
/* @__PURE__ */ jsxs18("
|
|
3042
|
-
/* @__PURE__ */ jsx27("h1", { className: "font-display text-2xl text-foreground", children: "Finalizar assinatura" }),
|
|
3043
|
-
/* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground", children: "Preencha seus dados pra liberar o app. Voc\xEA j\xE1 entra com acesso na hora." })
|
|
3044
|
-
] }),
|
|
3045
|
-
form.emailTaken ? /* @__PURE__ */ jsxs18("div", { role: "alert", className: "rounded-xl bg-destructive/10 p-4 text-sm text-destructive border border-destructive/20", children: [
|
|
3093
|
+
return /* @__PURE__ */ jsx27("div", { className: "flex-1 flex flex-col bg-background min-h-0", children: /* @__PURE__ */ jsxs18("form", { onSubmit, className: "flex-1 overflow-y-auto", children: [
|
|
3094
|
+
form.emailTaken ? /* @__PURE__ */ jsx27("div", { className: "px-5 pt-4", children: /* @__PURE__ */ jsxs18("div", { role: "alert", className: "rounded-2xl bg-destructive/10 p-4 text-sm text-destructive border border-destructive/20", children: [
|
|
3046
3095
|
"Esse e-mail j\xE1 tem conta nesse app.",
|
|
3047
3096
|
" ",
|
|
3048
|
-
/* @__PURE__ */ jsx27("a", { href: form.loginUrl ?? "/signin", className: "underline font-
|
|
3049
|
-
] }) : null,
|
|
3050
|
-
form.error ? /* @__PURE__ */ jsx27("div", { role: "alert", className: "rounded-
|
|
3051
|
-
/* @__PURE__ */ jsxs18("
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3097
|
+
/* @__PURE__ */ jsx27("a", { href: form.loginUrl ?? "/signin", className: "underline font-semibold", children: "Entrar agora" })
|
|
3098
|
+
] }) }) : null,
|
|
3099
|
+
form.error ? /* @__PURE__ */ jsx27("div", { className: "px-5 pt-4", children: /* @__PURE__ */ jsx27("div", { role: "alert", className: "rounded-2xl bg-destructive/10 p-4 text-sm text-destructive border border-destructive/20", children: form.error.message || "N\xE3o foi poss\xEDvel concluir o pagamento. Tente novamente." }) }) : null,
|
|
3100
|
+
/* @__PURE__ */ jsx27("div", { className: "px-5 pt-4", children: form.method === "card" ? /* @__PURE__ */ jsxs18("div", { className: "rounded-2xl bg-card border-[1.5px] border-foreground p-3.5", children: [
|
|
3101
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3102
|
+
/* @__PURE__ */ jsx27(ShieldIcon, { className: "w-4 h-4" }),
|
|
3103
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-bold", children: "Voc\xEA N\xC3O ser\xE1 cobrada hoje" })
|
|
3104
|
+
] }),
|
|
3105
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-baseline text-sm text-muted-foreground", children: [
|
|
3106
|
+
/* @__PURE__ */ jsx27("span", { children: "R$ 0,00 agora" }),
|
|
3107
|
+
/* @__PURE__ */ jsx27("span", { className: "opacity-50", children: "\xB7" }),
|
|
3108
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3109
|
+
monthlyText,
|
|
3110
|
+
"/m\xEAs ap\xF3s ",
|
|
3111
|
+
trialDays,
|
|
3112
|
+
" dias"
|
|
3113
|
+
] })
|
|
3114
|
+
] }),
|
|
3115
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2.5 text-[11px] text-muted-foreground flex items-center gap-1.5", children: [
|
|
3116
|
+
/* @__PURE__ */ jsx27(BellIcon, { className: "w-2.5 h-2.5" }),
|
|
3117
|
+
"Avisamos por email 2 dias antes da primeira cobran\xE7a"
|
|
3118
|
+
] })
|
|
3119
|
+
] }) : /* @__PURE__ */ jsxs18("div", { className: "rounded-2xl p-3.5 bg-emerald-50 border-[1.5px] border-emerald-600/60", children: [
|
|
3120
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mb-2 text-emerald-900", children: [
|
|
3121
|
+
/* @__PURE__ */ jsx27(ShieldIcon, { className: "w-4 h-4" }),
|
|
3122
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm font-bold", children: [
|
|
3123
|
+
"Garantia incondicional de ",
|
|
3124
|
+
trialDays,
|
|
3125
|
+
" dias"
|
|
3126
|
+
] })
|
|
3127
|
+
] }),
|
|
3128
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm text-emerald-900 leading-snug", children: [
|
|
3129
|
+
"Voc\xEA paga ",
|
|
3130
|
+
/* @__PURE__ */ jsx27("b", { children: todayAmount }),
|
|
3131
|
+
" agora via Pix.",
|
|
3132
|
+
/* @__PURE__ */ jsx27("br", {}),
|
|
3133
|
+
"N\xE3o gostou em ",
|
|
3134
|
+
trialDays,
|
|
3135
|
+
" dias? Devolvemos ",
|
|
3136
|
+
/* @__PURE__ */ jsx27("b", { children: "100%" }),
|
|
3137
|
+
" sem perguntas \u2014 direto pelo app."
|
|
3138
|
+
] })
|
|
3139
|
+
] }) }),
|
|
3140
|
+
/* @__PURE__ */ jsxs18("section", { className: "px-5 pt-5", children: [
|
|
3141
|
+
/* @__PURE__ */ jsx27("h2", { className: "font-display text-2xl mb-3.5 leading-tight text-foreground", children: "Quase l\xE1." }),
|
|
3142
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Email" }),
|
|
3064
3143
|
/* @__PURE__ */ jsx27(
|
|
3065
|
-
|
|
3144
|
+
FieldInput,
|
|
3066
3145
|
{
|
|
3067
|
-
label: "E-mail",
|
|
3068
3146
|
type: "email",
|
|
3069
|
-
|
|
3070
|
-
onChange: form.setEmail,
|
|
3071
|
-
onBlur: form.markEmailTouched,
|
|
3072
|
-
error: form.emailError,
|
|
3147
|
+
inputMode: "email",
|
|
3073
3148
|
autoComplete: "email",
|
|
3074
3149
|
autoCapitalize: "none",
|
|
3075
3150
|
autoCorrect: "off",
|
|
3076
3151
|
spellCheck: false,
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
label: "Confirme o e-mail",
|
|
3084
|
-
type: "email",
|
|
3085
|
-
value: form.emailConfirm,
|
|
3086
|
-
onChange: form.setEmailConfirm,
|
|
3087
|
-
onBlur: form.markEmailConfirmTouched,
|
|
3088
|
-
error: form.emailConfirmError,
|
|
3089
|
-
autoComplete: "email",
|
|
3090
|
-
autoCapitalize: "none",
|
|
3091
|
-
autoCorrect: "off",
|
|
3092
|
-
spellCheck: false
|
|
3152
|
+
placeholder: "seu@email.com",
|
|
3153
|
+
value: form.email,
|
|
3154
|
+
onChange: form.setEmail,
|
|
3155
|
+
onBlur: form.markEmailTouched,
|
|
3156
|
+
error: form.emailError,
|
|
3157
|
+
valid: form.emailStatus === "available"
|
|
3093
3158
|
}
|
|
3094
3159
|
),
|
|
3160
|
+
!form.emailError && /* @__PURE__ */ jsx27(FieldHint, { children: form.emailStatus === "checking" ? "Verificando\u2026" : form.emailStatus === "available" ? "\u2713 Dispon\xEDvel" : "Voc\xEA vai usar este email para entrar no app" }),
|
|
3161
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3162
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Nome completo" }),
|
|
3095
3163
|
/* @__PURE__ */ jsx27(
|
|
3096
|
-
|
|
3164
|
+
FieldInput,
|
|
3097
3165
|
{
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3166
|
+
type: "text",
|
|
3167
|
+
autoComplete: "name",
|
|
3168
|
+
placeholder: "como est\xE1 no documento",
|
|
3169
|
+
value: form.name,
|
|
3170
|
+
onChange: form.setName,
|
|
3171
|
+
onBlur: form.markNameTouched,
|
|
3172
|
+
error: form.nameError,
|
|
3173
|
+
valid: !!form.name && !form.nameError
|
|
3106
3174
|
}
|
|
3107
3175
|
),
|
|
3176
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3177
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "CPF" }),
|
|
3108
3178
|
/* @__PURE__ */ jsx27(
|
|
3109
|
-
|
|
3179
|
+
FieldInput,
|
|
3110
3180
|
{
|
|
3111
|
-
label: "CPF",
|
|
3112
3181
|
type: "text",
|
|
3113
3182
|
inputMode: "numeric",
|
|
3183
|
+
placeholder: "000.000.000-00",
|
|
3114
3184
|
value: form.cpf,
|
|
3115
|
-
onChange: form.setCpf,
|
|
3185
|
+
onChange: (v) => form.setCpf(formatCpf(v)),
|
|
3116
3186
|
onBlur: form.markCpfTouched,
|
|
3117
3187
|
error: form.cpfError,
|
|
3118
|
-
|
|
3119
|
-
placeholder: "000.000.000-00"
|
|
3188
|
+
valid: !!form.cpf && !form.cpfError
|
|
3120
3189
|
}
|
|
3121
3190
|
)
|
|
3122
3191
|
] }),
|
|
3123
|
-
/* @__PURE__ */ jsxs18("section", { className: "
|
|
3124
|
-
/* @__PURE__ */ jsx27(
|
|
3125
|
-
/* @__PURE__ */ jsxs18("div", { className: "
|
|
3126
|
-
/* @__PURE__ */ jsx27(MethodTab, { active: form.method === "card", onClick: () => form.setMethod("card"), children: "Cart\xE3o" }),
|
|
3127
|
-
/* @__PURE__ */ jsx27(MethodTab, { active: form.method === "pix-auto", onClick: () => form.setMethod("pix-auto"), children: "PIX" })
|
|
3128
|
-
] }),
|
|
3129
|
-
/* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-2", role: "tablist", children: [
|
|
3130
|
-
/* @__PURE__ */ jsx27(MethodTab, { active: form.cycle === "MONTHLY", onClick: () => form.setCycle("MONTHLY"), children: "Mensal" }),
|
|
3131
|
-
/* @__PURE__ */ jsx27(MethodTab, { active: form.cycle === "YEARLY", onClick: () => form.setCycle("YEARLY"), children: "Anual" })
|
|
3132
|
-
] }),
|
|
3133
|
-
form.method === "card" ? /* @__PURE__ */ jsxs18("div", { className: "space-y-3 rounded-xl border border-border p-4", children: [
|
|
3192
|
+
/* @__PURE__ */ jsxs18("section", { className: "px-5 pt-5", children: [
|
|
3193
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Forma de pagamento" }),
|
|
3194
|
+
/* @__PURE__ */ jsxs18("div", { role: "tablist", className: "flex gap-1.5 bg-muted p-1 rounded-xl", children: [
|
|
3134
3195
|
/* @__PURE__ */ jsx27(
|
|
3135
|
-
|
|
3196
|
+
TabButton,
|
|
3136
3197
|
{
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3198
|
+
active: form.method === "card",
|
|
3199
|
+
onClick: () => form.setMethod("card"),
|
|
3200
|
+
icon: /* @__PURE__ */ jsx27(CardIcon, { className: "w-3.5 h-3.5" }),
|
|
3201
|
+
label: "Cart\xE3o",
|
|
3202
|
+
subtitle: trialDays > 0 ? `${trialDays} dias gr\xE1tis` : "pague hoje",
|
|
3203
|
+
subtitleActiveClass: "text-emerald-700"
|
|
3141
3204
|
}
|
|
3142
3205
|
),
|
|
3143
3206
|
/* @__PURE__ */ jsx27(
|
|
3144
|
-
|
|
3207
|
+
TabButton,
|
|
3145
3208
|
{
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3209
|
+
active: form.method === "pix-auto",
|
|
3210
|
+
onClick: () => form.setMethod("pix-auto"),
|
|
3211
|
+
icon: /* @__PURE__ */ jsx27(PixIcon, { className: "w-3.5 h-3.5" }),
|
|
3212
|
+
label: "Pix",
|
|
3213
|
+
subtitle: `pague hoje \xB7 garantia ${trialDays}d`,
|
|
3214
|
+
subtitleActiveClass: "text-foreground/70"
|
|
3215
|
+
}
|
|
3216
|
+
)
|
|
3217
|
+
] })
|
|
3218
|
+
] }),
|
|
3219
|
+
form.method === "card" ? /* @__PURE__ */ jsxs18("section", { className: "px-5 pt-3.5", children: [
|
|
3220
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "N\xFAmero do cart\xE3o" }),
|
|
3221
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx27(
|
|
3223
|
+
FieldInput,
|
|
3224
|
+
{
|
|
3225
|
+
type: "text",
|
|
3150
3226
|
inputMode: "numeric",
|
|
3151
|
-
|
|
3227
|
+
autoComplete: "cc-number",
|
|
3228
|
+
placeholder: "0000 0000 0000 0000",
|
|
3229
|
+
value: form.card.number,
|
|
3230
|
+
onChange: (v) => form.setCard({ number: formatCardNumber(v) }),
|
|
3231
|
+
style: cardBrand ? { paddingRight: "4.5rem" } : void 0
|
|
3152
3232
|
}
|
|
3153
3233
|
),
|
|
3154
|
-
/* @__PURE__ */
|
|
3234
|
+
cardBrand && /* @__PURE__ */ jsx27("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-[10px] font-bold tracking-wide px-1.5 py-0.5 rounded bg-muted text-muted-foreground", children: cardBrand })
|
|
3235
|
+
] }),
|
|
3236
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3237
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2.5", children: [
|
|
3238
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3239
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Validade" }),
|
|
3155
3240
|
/* @__PURE__ */ jsx27(
|
|
3156
|
-
|
|
3241
|
+
FieldInput,
|
|
3157
3242
|
{
|
|
3158
|
-
|
|
3159
|
-
value: form.card.expiryMonth,
|
|
3160
|
-
onChange: (v) => form.setCard({ expiryMonth: v }),
|
|
3161
|
-
autoComplete: "cc-exp-month",
|
|
3243
|
+
type: "text",
|
|
3162
3244
|
inputMode: "numeric",
|
|
3163
|
-
|
|
3245
|
+
autoComplete: "cc-exp",
|
|
3246
|
+
placeholder: "MM/AA",
|
|
3247
|
+
value: expiryMmAa,
|
|
3248
|
+
onChange: (v) => setExpiryMmAa(formatExpiryMmAa(v))
|
|
3164
3249
|
}
|
|
3165
|
-
)
|
|
3250
|
+
)
|
|
3251
|
+
] }),
|
|
3252
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3253
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "CVV" }),
|
|
3166
3254
|
/* @__PURE__ */ jsx27(
|
|
3167
|
-
|
|
3255
|
+
FieldInput,
|
|
3168
3256
|
{
|
|
3169
|
-
|
|
3170
|
-
value: form.card.expiryYear,
|
|
3171
|
-
onChange: (v) => form.setCard({ expiryYear: v }),
|
|
3172
|
-
autoComplete: "cc-exp-year",
|
|
3257
|
+
type: "text",
|
|
3173
3258
|
inputMode: "numeric",
|
|
3174
|
-
placeholder: "AA"
|
|
3175
|
-
}
|
|
3176
|
-
),
|
|
3177
|
-
/* @__PURE__ */ jsx27(
|
|
3178
|
-
FieldRow,
|
|
3179
|
-
{
|
|
3180
|
-
label: "CVV",
|
|
3181
|
-
value: form.card.ccv,
|
|
3182
|
-
onChange: (v) => form.setCard({ ccv: v }),
|
|
3183
3259
|
autoComplete: "cc-csc",
|
|
3184
|
-
|
|
3185
|
-
|
|
3260
|
+
placeholder: "3 d\xEDgitos",
|
|
3261
|
+
value: form.card.ccv,
|
|
3262
|
+
onChange: (v) => form.setCard({ ccv: v.replace(/\D/g, "").slice(0, 4) })
|
|
3186
3263
|
}
|
|
3187
3264
|
)
|
|
3188
3265
|
] })
|
|
3189
|
-
] })
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3266
|
+
] }),
|
|
3267
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3268
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Nome no cart\xE3o" }),
|
|
3269
|
+
/* @__PURE__ */ jsx27(
|
|
3270
|
+
FieldInput,
|
|
3271
|
+
{
|
|
3272
|
+
type: "text",
|
|
3273
|
+
autoComplete: "cc-name",
|
|
3274
|
+
placeholder: "como est\xE1 no cart\xE3o",
|
|
3275
|
+
value: form.card.holderName,
|
|
3276
|
+
onChange: (v) => form.setCard({ holderName: v })
|
|
3277
|
+
}
|
|
3278
|
+
)
|
|
3279
|
+
] }) : /* @__PURE__ */ jsx27("section", { className: "px-5 pt-3.5", children: /* @__PURE__ */ jsxs18("div", { className: "rounded-2xl bg-card border border-border p-3.5 flex gap-3.5 items-center", children: [
|
|
3280
|
+
/* @__PURE__ */ jsx27("div", { className: "w-[72px] h-[72px] rounded-xl shrink-0 border-2 border-foreground relative overflow-hidden bg-muted", children: /* @__PURE__ */ jsx27("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[22px] h-[22px] bg-background flex items-center justify-center", children: /* @__PURE__ */ jsx27(PixIcon, { className: "w-3.5 h-3.5 text-foreground" }) }) }),
|
|
3281
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3282
|
+
/* @__PURE__ */ jsx27("div", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground", children: "pagamento em segundos" }),
|
|
3283
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm text-foreground mt-1 leading-snug", children: [
|
|
3284
|
+
"Geramos seu ",
|
|
3285
|
+
/* @__PURE__ */ jsx27("b", { children: "QR Pix" }),
|
|
3286
|
+
" no pr\xF3ximo passo. Pague pelo app do banco e seu acesso libera ",
|
|
3287
|
+
/* @__PURE__ */ jsx27("b", { children: "imediatamente" }),
|
|
3288
|
+
"."
|
|
3289
|
+
] })
|
|
3290
|
+
] })
|
|
3291
|
+
] }) }),
|
|
3292
|
+
/* @__PURE__ */ jsx27("section", { className: "px-5 pt-5", children: /* @__PURE__ */ jsxs18("div", { className: "bg-muted rounded-2xl p-4", children: [
|
|
3293
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between mb-2.5", children: [
|
|
3294
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3295
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold text-foreground", children: annual ? "Plano Anual" : "Plano Mensal" }),
|
|
3296
|
+
/* @__PURE__ */ jsx27("div", { className: "text-[11px] text-muted-foreground", children: "Coach" })
|
|
3297
|
+
] }),
|
|
3298
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-right", children: [
|
|
3299
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm font-bold text-foreground", children: [
|
|
3300
|
+
cyclePriceText,
|
|
3301
|
+
"/",
|
|
3302
|
+
annual ? "ano" : "m\xEAs"
|
|
3303
|
+
] }),
|
|
3304
|
+
annual && annualSavingsCents > 0 && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-emerald-700 font-semibold", children: [
|
|
3305
|
+
"economia ",
|
|
3306
|
+
formatBrl(annualSavingsCents)
|
|
3307
|
+
] })
|
|
3308
|
+
] })
|
|
3309
|
+
] }),
|
|
3310
|
+
/* @__PURE__ */ jsx27("div", { className: "h-px bg-border my-3" }),
|
|
3311
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-baseline", children: [
|
|
3312
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3313
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-bold text-foreground", children: "Voc\xEA paga hoje" }),
|
|
3314
|
+
form.method === "card" && trialDays > 0 && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-muted-foreground mt-0.5", children: [
|
|
3315
|
+
"cobran\xE7a inicia no dia ",
|
|
3316
|
+
trialDays
|
|
3317
|
+
] }),
|
|
3318
|
+
form.method === "pix-auto" && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-emerald-700 mt-0.5 font-semibold", children: [
|
|
3319
|
+
"reembolso garantido at\xE9 o dia ",
|
|
3320
|
+
trialDays
|
|
3321
|
+
] })
|
|
3322
|
+
] }),
|
|
3323
|
+
/* @__PURE__ */ jsx27("div", { className: "text-2xl font-bold font-display tracking-tight text-foreground", children: todayAmount })
|
|
3324
|
+
] })
|
|
3325
|
+
] }) }),
|
|
3326
|
+
/* @__PURE__ */ jsx27("div", { className: "h-4" }),
|
|
3327
|
+
/* @__PURE__ */ jsxs18("div", { className: "sticky bottom-0 px-5 pt-3.5 pb-6 bg-gradient-to-b from-transparent to-background", children: [
|
|
3328
|
+
/* @__PURE__ */ jsx27(
|
|
3329
|
+
"button",
|
|
3330
|
+
{
|
|
3331
|
+
type: "submit",
|
|
3332
|
+
disabled: !form.canSubmit,
|
|
3333
|
+
className: "w-full rounded-full bg-primary text-primary-foreground min-h-14 px-5 text-base font-bold inline-flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed shadow-lg",
|
|
3334
|
+
children: form.submitting ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3335
|
+
/* @__PURE__ */ jsx27(Spinner2, {}),
|
|
3336
|
+
" ",
|
|
3337
|
+
form.method === "pix-auto" ? "Gerando QR\u2026" : "Confirmando\u2026"
|
|
3338
|
+
] }) : form.method === "card" ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3339
|
+
/* @__PURE__ */ jsx27(LockIcon, { className: "w-3.5 h-3.5" }),
|
|
3340
|
+
" Confirmar e come\xE7ar gr\xE1tis"
|
|
3341
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3342
|
+
/* @__PURE__ */ jsx27(PixIcon, { className: "w-3.5 h-3.5" }),
|
|
3343
|
+
" Gerar QR \xB7 pagar ",
|
|
3344
|
+
todayAmount
|
|
3345
|
+
] })
|
|
3346
|
+
}
|
|
3347
|
+
),
|
|
3348
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-center mt-2.5 text-xs text-muted-foreground", children: [
|
|
3349
|
+
"Ao continuar, voc\xEA concorda com nossos ",
|
|
3350
|
+
/* @__PURE__ */ jsx27("u", { children: "Termos" }),
|
|
3351
|
+
". Pagamento seguro Asaas."
|
|
3352
|
+
] }),
|
|
3353
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-3 flex items-center justify-center gap-3.5 text-[11px] text-muted-foreground", children: [
|
|
3354
|
+
/* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1", children: [
|
|
3355
|
+
/* @__PURE__ */ jsx27(LockIcon, { className: "w-2.5 h-2.5 opacity-60" }),
|
|
3356
|
+
" SSL 256-bit"
|
|
3357
|
+
] }),
|
|
3358
|
+
/* @__PURE__ */ jsx27("span", { className: "w-px h-2.5 bg-border" }),
|
|
3359
|
+
/* @__PURE__ */ jsx27("span", { children: "Pagamento via Asaas" }),
|
|
3360
|
+
/* @__PURE__ */ jsx27("span", { className: "w-px h-2.5 bg-border" }),
|
|
3361
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3362
|
+
"Garantia ",
|
|
3363
|
+
trialDays,
|
|
3364
|
+
" dias"
|
|
3365
|
+
] })
|
|
3366
|
+
] })
|
|
3367
|
+
] })
|
|
3201
3368
|
] }) });
|
|
3202
3369
|
}
|
|
3203
|
-
function
|
|
3204
|
-
return /* @__PURE__ */
|
|
3205
|
-
|
|
3370
|
+
function FieldLabel({ children }) {
|
|
3371
|
+
return /* @__PURE__ */ jsx27("div", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-1.5", children });
|
|
3372
|
+
}
|
|
3373
|
+
function FieldInput(props) {
|
|
3374
|
+
const baseClass = "w-full px-4 rounded-xl bg-card text-base text-foreground outline-none border-[1.5px] transition-colors";
|
|
3375
|
+
const stateClass = props.error ? "border-destructive focus:border-destructive" : props.valid ? "border-emerald-600 focus:border-emerald-700" : "border-border focus:border-foreground";
|
|
3376
|
+
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3206
3377
|
/* @__PURE__ */ jsx27(
|
|
3207
3378
|
"input",
|
|
3208
3379
|
{
|
|
3209
3380
|
type: props.type ?? "text",
|
|
3210
|
-
|
|
3211
|
-
onChange: (e) => props.onChange(e.target.value),
|
|
3212
|
-
onBlur: props.onBlur,
|
|
3381
|
+
inputMode: props.inputMode,
|
|
3213
3382
|
autoComplete: props.autoComplete,
|
|
3214
3383
|
autoCapitalize: props.autoCapitalize,
|
|
3215
3384
|
autoCorrect: props.autoCorrect,
|
|
3216
3385
|
spellCheck: props.spellCheck,
|
|
3217
|
-
inputMode: props.inputMode,
|
|
3218
3386
|
placeholder: props.placeholder,
|
|
3219
|
-
|
|
3387
|
+
value: props.value,
|
|
3388
|
+
onChange: (e) => props.onChange(e.target.value),
|
|
3389
|
+
onBlur: props.onBlur,
|
|
3390
|
+
style: { height: "52px", ...props.style },
|
|
3391
|
+
className: `${baseClass} ${stateClass}`
|
|
3220
3392
|
}
|
|
3221
3393
|
),
|
|
3222
|
-
props.error ? /* @__PURE__ */ jsx27("
|
|
3394
|
+
props.error ? /* @__PURE__ */ jsx27("div", { className: "mt-1.5 text-xs text-destructive font-medium", children: props.error }) : null
|
|
3223
3395
|
] });
|
|
3224
3396
|
}
|
|
3225
|
-
function
|
|
3226
|
-
return /* @__PURE__ */ jsx27(
|
|
3397
|
+
function FieldHint({ children }) {
|
|
3398
|
+
return /* @__PURE__ */ jsx27("div", { className: "mt-1.5 text-xs text-muted-foreground", children });
|
|
3399
|
+
}
|
|
3400
|
+
function TabButton({ active, onClick, icon, label, subtitle, subtitleActiveClass }) {
|
|
3401
|
+
return /* @__PURE__ */ jsxs18(
|
|
3227
3402
|
"button",
|
|
3228
3403
|
{
|
|
3229
3404
|
type: "button",
|
|
3230
3405
|
role: "tab",
|
|
3231
3406
|
"aria-selected": active,
|
|
3232
3407
|
onClick,
|
|
3233
|
-
className: `
|
|
3234
|
-
|
|
3408
|
+
className: `flex-1 flex flex-col items-center justify-center gap-0.5 py-2.5 px-1.5 rounded-lg text-sm font-semibold transition-colors ${active ? "bg-card text-foreground shadow-sm" : "bg-transparent text-muted-foreground"}`,
|
|
3409
|
+
style: { minHeight: 56 },
|
|
3410
|
+
children: [
|
|
3411
|
+
/* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
3412
|
+
icon,
|
|
3413
|
+
" ",
|
|
3414
|
+
label
|
|
3415
|
+
] }),
|
|
3416
|
+
/* @__PURE__ */ jsx27("span", { className: `text-[10px] font-medium ${active ? subtitleActiveClass : "text-muted-foreground/70"}`, children: subtitle })
|
|
3417
|
+
]
|
|
3418
|
+
}
|
|
3419
|
+
);
|
|
3420
|
+
}
|
|
3421
|
+
function CardIcon({ className }) {
|
|
3422
|
+
return /* @__PURE__ */ jsxs18("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3423
|
+
/* @__PURE__ */ jsx27("rect", { x: "2.5", y: "5.5", width: "19", height: "13", rx: "2.5" }),
|
|
3424
|
+
/* @__PURE__ */ jsx27("path", { d: "M2.5 10h19" })
|
|
3425
|
+
] });
|
|
3426
|
+
}
|
|
3427
|
+
function PixIcon({ className }) {
|
|
3428
|
+
return /* @__PURE__ */ jsx27("svg", { className, viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx27("path", { d: "M12 2L2 12l10 10 10-10L12 2zm0 4.83L17.17 12 12 17.17 6.83 12 12 6.83z" }) });
|
|
3429
|
+
}
|
|
3430
|
+
function LockIcon({ className }) {
|
|
3431
|
+
return /* @__PURE__ */ jsxs18("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3432
|
+
/* @__PURE__ */ jsx27("rect", { x: "4", y: "10", width: "16", height: "11", rx: "2.5" }),
|
|
3433
|
+
/* @__PURE__ */ jsx27("path", { d: "M7.5 10V7a4.5 4.5 0 119 0v3" })
|
|
3434
|
+
] });
|
|
3435
|
+
}
|
|
3436
|
+
function ShieldIcon({ className }) {
|
|
3437
|
+
return /* @__PURE__ */ jsxs18("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3438
|
+
/* @__PURE__ */ jsx27("path", { d: "M12 2.5l8 3v6c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10v-6l8-3z" }),
|
|
3439
|
+
/* @__PURE__ */ jsx27("path", { d: "M9 12l2 2 4-4" })
|
|
3440
|
+
] });
|
|
3441
|
+
}
|
|
3442
|
+
function BellIcon({ className }) {
|
|
3443
|
+
return /* @__PURE__ */ jsxs18("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3444
|
+
/* @__PURE__ */ jsx27("path", { d: "M6 17V11a6 6 0 1112 0v6l1.5 2H4.5L6 17z" }),
|
|
3445
|
+
/* @__PURE__ */ jsx27("path", { d: "M10 21a2 2 0 004 0" })
|
|
3446
|
+
] });
|
|
3447
|
+
}
|
|
3448
|
+
function Spinner2() {
|
|
3449
|
+
return /* @__PURE__ */ jsx27(
|
|
3450
|
+
"span",
|
|
3451
|
+
{
|
|
3452
|
+
className: "w-4 h-4 rounded-full border-2 border-white/40 border-t-white",
|
|
3453
|
+
style: { animation: "spin 0.7s linear infinite" }
|
|
3235
3454
|
}
|
|
3236
3455
|
);
|
|
3237
3456
|
}
|
|
3238
3457
|
|
|
3239
3458
|
// src/defaults/PixWaitingPageDefault.tsx
|
|
3240
|
-
import { useEffect as useEffect12, useMemo as useMemo6, useState as
|
|
3459
|
+
import { useEffect as useEffect12, useMemo as useMemo6, useState as useState10 } from "react";
|
|
3241
3460
|
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
3242
3461
|
import { useHook as useHook11 } from "@hook-sdk/sdk";
|
|
3243
3462
|
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -3264,8 +3483,8 @@ function PixWaitingPageDefault() {
|
|
|
3264
3483
|
const navigate = useNavigate3();
|
|
3265
3484
|
const { subscription } = useHook11();
|
|
3266
3485
|
const payload = useMemo6(readPixPayload, []);
|
|
3267
|
-
const [copied, setCopied] =
|
|
3268
|
-
const [timedOut, setTimedOut] =
|
|
3486
|
+
const [copied, setCopied] = useState10(false);
|
|
3487
|
+
const [timedOut, setTimedOut] = useState10(false);
|
|
3269
3488
|
useEffect12(() => {
|
|
3270
3489
|
if (!payload) navigate("/paywall/checkout", { replace: true });
|
|
3271
3490
|
}, [payload, navigate]);
|
|
@@ -3337,19 +3556,19 @@ function PixWaitingPageDefault() {
|
|
|
3337
3556
|
}
|
|
3338
3557
|
|
|
3339
3558
|
// src/hooks/useLoginForm.ts
|
|
3340
|
-
import { useCallback as useCallback7, useMemo as useMemo7, useState as
|
|
3559
|
+
import { useCallback as useCallback7, useMemo as useMemo7, useState as useState11 } from "react";
|
|
3341
3560
|
import { useHook as useHook12 } from "@hook-sdk/sdk";
|
|
3342
3561
|
var EMAIL_RE2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3343
3562
|
var MIN_PASSWORD = 8;
|
|
3344
3563
|
function useLoginForm() {
|
|
3345
3564
|
const { auth } = useHook12();
|
|
3346
|
-
const [email, setEmail] =
|
|
3347
|
-
const [password, setPassword] =
|
|
3348
|
-
const [submitting, setSubmitting] =
|
|
3349
|
-
const [error, setError] =
|
|
3350
|
-
const [touchedEmail, setTouchedEmail] =
|
|
3351
|
-
const [touchedPassword, setTouchedPassword] =
|
|
3352
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
3565
|
+
const [email, setEmail] = useState11("");
|
|
3566
|
+
const [password, setPassword] = useState11("");
|
|
3567
|
+
const [submitting, setSubmitting] = useState11(false);
|
|
3568
|
+
const [error, setError] = useState11(null);
|
|
3569
|
+
const [touchedEmail, setTouchedEmail] = useState11(false);
|
|
3570
|
+
const [touchedPassword, setTouchedPassword] = useState11(false);
|
|
3571
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState11(false);
|
|
3353
3572
|
const validateEmail = useMemo7(() => {
|
|
3354
3573
|
if (email.length === 0) return null;
|
|
3355
3574
|
if (!EMAIL_RE2.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -3397,21 +3616,21 @@ function useLoginForm() {
|
|
|
3397
3616
|
}
|
|
3398
3617
|
|
|
3399
3618
|
// src/hooks/useSignupForm.ts
|
|
3400
|
-
import { useCallback as useCallback8, useMemo as useMemo8, useState as
|
|
3619
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
|
|
3401
3620
|
import { useHook as useHook13 } from "@hook-sdk/sdk";
|
|
3402
3621
|
var EMAIL_RE3 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3403
3622
|
var MIN_PASSWORD2 = 8;
|
|
3404
3623
|
function useSignupForm() {
|
|
3405
3624
|
const { auth } = useHook13();
|
|
3406
|
-
const [name, setName] =
|
|
3407
|
-
const [email, setEmail] =
|
|
3408
|
-
const [password, setPassword] =
|
|
3409
|
-
const [submitting, setSubmitting] =
|
|
3410
|
-
const [error, setError] =
|
|
3411
|
-
const [touchedName, setTouchedName] =
|
|
3412
|
-
const [touchedEmail, setTouchedEmail] =
|
|
3413
|
-
const [touchedPassword, setTouchedPassword] =
|
|
3414
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
3625
|
+
const [name, setName] = useState12("");
|
|
3626
|
+
const [email, setEmail] = useState12("");
|
|
3627
|
+
const [password, setPassword] = useState12("");
|
|
3628
|
+
const [submitting, setSubmitting] = useState12(false);
|
|
3629
|
+
const [error, setError] = useState12(null);
|
|
3630
|
+
const [touchedName, setTouchedName] = useState12(false);
|
|
3631
|
+
const [touchedEmail, setTouchedEmail] = useState12(false);
|
|
3632
|
+
const [touchedPassword, setTouchedPassword] = useState12(false);
|
|
3633
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState12(false);
|
|
3415
3634
|
const validateName = useMemo8(() => {
|
|
3416
3635
|
if (name.length === 0) return null;
|
|
3417
3636
|
if (name.trim().length < 2) return "Nome muito curto.";
|
|
@@ -3469,17 +3688,17 @@ function useSignupForm() {
|
|
|
3469
3688
|
}
|
|
3470
3689
|
|
|
3471
3690
|
// src/hooks/useForgotForm.ts
|
|
3472
|
-
import { useCallback as useCallback9, useMemo as useMemo9, useState as
|
|
3691
|
+
import { useCallback as useCallback9, useMemo as useMemo9, useState as useState13 } from "react";
|
|
3473
3692
|
import { useHook as useHook14 } from "@hook-sdk/sdk";
|
|
3474
3693
|
var EMAIL_RE4 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3475
3694
|
function useForgotForm() {
|
|
3476
3695
|
const { auth } = useHook14();
|
|
3477
|
-
const [email, setEmail] =
|
|
3478
|
-
const [submitting, setSubmitting] =
|
|
3479
|
-
const [sent, setSent] =
|
|
3480
|
-
const [error, setError] =
|
|
3481
|
-
const [touchedEmail, setTouchedEmail] =
|
|
3482
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
3696
|
+
const [email, setEmail] = useState13("");
|
|
3697
|
+
const [submitting, setSubmitting] = useState13(false);
|
|
3698
|
+
const [sent, setSent] = useState13(false);
|
|
3699
|
+
const [error, setError] = useState13(null);
|
|
3700
|
+
const [touchedEmail, setTouchedEmail] = useState13(false);
|
|
3701
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState13(false);
|
|
3483
3702
|
const validateEmail = useMemo9(() => {
|
|
3484
3703
|
if (email.length === 0) return null;
|
|
3485
3704
|
if (!EMAIL_RE4.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -3518,20 +3737,20 @@ function useForgotForm() {
|
|
|
3518
3737
|
}
|
|
3519
3738
|
|
|
3520
3739
|
// src/hooks/useResetForm.ts
|
|
3521
|
-
import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo10, useState as
|
|
3740
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo10, useState as useState14 } from "react";
|
|
3522
3741
|
import { useHook as useHook15 } from "@hook-sdk/sdk";
|
|
3523
3742
|
var MIN_PASSWORD3 = 12;
|
|
3524
3743
|
function useResetForm() {
|
|
3525
3744
|
const { auth } = useHook15();
|
|
3526
|
-
const [token, setToken] =
|
|
3527
|
-
const [password, setPassword] =
|
|
3528
|
-
const [confirm, setConfirm] =
|
|
3529
|
-
const [submitting, setSubmitting] =
|
|
3530
|
-
const [done, setDone] =
|
|
3531
|
-
const [error, setError] =
|
|
3532
|
-
const [touchedPassword, setTouchedPassword] =
|
|
3533
|
-
const [touchedConfirm, setTouchedConfirm] =
|
|
3534
|
-
const [formSubmitAttempted, setFormSubmitAttempted] =
|
|
3745
|
+
const [token, setToken] = useState14(null);
|
|
3746
|
+
const [password, setPassword] = useState14("");
|
|
3747
|
+
const [confirm, setConfirm] = useState14("");
|
|
3748
|
+
const [submitting, setSubmitting] = useState14(false);
|
|
3749
|
+
const [done, setDone] = useState14(false);
|
|
3750
|
+
const [error, setError] = useState14(null);
|
|
3751
|
+
const [touchedPassword, setTouchedPassword] = useState14(false);
|
|
3752
|
+
const [touchedConfirm, setTouchedConfirm] = useState14(false);
|
|
3753
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState14(false);
|
|
3535
3754
|
useEffect13(() => {
|
|
3536
3755
|
if (typeof window === "undefined") return;
|
|
3537
3756
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -3669,13 +3888,13 @@ function useSubscription() {
|
|
|
3669
3888
|
}
|
|
3670
3889
|
|
|
3671
3890
|
// src/hooks/useReminders.ts
|
|
3672
|
-
import { useCallback as useCallback11, useEffect as useEffect15, useState as
|
|
3891
|
+
import { useCallback as useCallback11, useEffect as useEffect15, useState as useState15 } from "react";
|
|
3673
3892
|
import { useHook as useHook19 } from "@hook-sdk/sdk";
|
|
3674
3893
|
function useReminders() {
|
|
3675
3894
|
const { push } = useHook19();
|
|
3676
3895
|
const r = push.reminders;
|
|
3677
|
-
const [reminders, setReminders] =
|
|
3678
|
-
const [loading, setLoading] =
|
|
3896
|
+
const [reminders, setReminders] = useState15([]);
|
|
3897
|
+
const [loading, setLoading] = useState15(true);
|
|
3679
3898
|
const reload = useCallback11(async () => {
|
|
3680
3899
|
setLoading(true);
|
|
3681
3900
|
try {
|
|
@@ -3706,9 +3925,9 @@ function useReminders() {
|
|
|
3706
3925
|
}
|
|
3707
3926
|
|
|
3708
3927
|
// src/hooks/useToast.ts
|
|
3709
|
-
import { useCallback as useCallback12, useState as
|
|
3928
|
+
import { useCallback as useCallback12, useState as useState16 } from "react";
|
|
3710
3929
|
function useToast() {
|
|
3711
|
-
const [items, setItems] =
|
|
3930
|
+
const [items, setItems] = useState16([]);
|
|
3712
3931
|
const show = useCallback12((message, kind = "info") => {
|
|
3713
3932
|
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3714
3933
|
setItems((prev) => [...prev, { id, message, kind }]);
|
|
@@ -3752,7 +3971,7 @@ function PreAuthShell({
|
|
|
3752
3971
|
|
|
3753
3972
|
// src/OnboardingFlow.tsx
|
|
3754
3973
|
import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo11, useRef as useRef7 } from "react";
|
|
3755
|
-
import { usePersistedState as
|
|
3974
|
+
import { usePersistedState as usePersistedState4, useHook as useHook20 } from "@hook-sdk/sdk";
|
|
3756
3975
|
|
|
3757
3976
|
// src/hooks/useOnboardingStep.ts
|
|
3758
3977
|
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
@@ -3781,7 +4000,7 @@ function OnboardingFlow({
|
|
|
3781
4000
|
onComplete,
|
|
3782
4001
|
persistKey
|
|
3783
4002
|
}) {
|
|
3784
|
-
const [draft, setDraft, status] =
|
|
4003
|
+
const [draft, setDraft, status] = usePersistedState4(persistKey, {});
|
|
3785
4004
|
const draftRef = useRef7(draft);
|
|
3786
4005
|
draftRef.current = draft;
|
|
3787
4006
|
const idx = readPersistedStepIdx(draft);
|
|
@@ -4279,7 +4498,7 @@ function PaywallPriceHeadline({
|
|
|
4279
4498
|
}
|
|
4280
4499
|
|
|
4281
4500
|
// src/components/paywall/blocks/PaywallCountdown.tsx
|
|
4282
|
-
import { useEffect as useEffect18, useRef as useRef8, useState as
|
|
4501
|
+
import { useEffect as useEffect18, useRef as useRef8, useState as useState17 } from "react";
|
|
4283
4502
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
4284
4503
|
var DEFAULT_COUNTDOWN_CLASSES = "font-mono tabular-nums";
|
|
4285
4504
|
function resolveDeadlineMs(deadline) {
|
|
@@ -4321,7 +4540,7 @@ function PaywallCountdown({
|
|
|
4321
4540
|
if (deadlineMsRef.current === null) {
|
|
4322
4541
|
deadlineMsRef.current = resolveDeadlineMs(deadline);
|
|
4323
4542
|
}
|
|
4324
|
-
const [state, setState] =
|
|
4543
|
+
const [state, setState] = useState17(() => computeRemaining(deadlineMsRef.current));
|
|
4325
4544
|
const expiredCalledRef = useRef8(false);
|
|
4326
4545
|
useEffect18(() => {
|
|
4327
4546
|
if (state.expired) {
|