@hook-sdk/template 0.26.0 → 0.28.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 +942 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +329 -23
- package/dist/index.d.ts +329 -23
- package/dist/index.js +968 -309
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -632,8 +632,8 @@ function usePaywallState() {
|
|
|
632
632
|
opening: submitting,
|
|
633
633
|
availableMethods: methods,
|
|
634
634
|
monthlyEquivalent,
|
|
635
|
-
|
|
636
|
-
|
|
635
|
+
// G154 fix (template 0.24.0 + SDK 0.26.0): wired to SDK action.
|
|
636
|
+
dismissPix: subscription.clearPixPending,
|
|
637
637
|
refreshPlan: () => {
|
|
638
638
|
}
|
|
639
639
|
};
|
|
@@ -2726,7 +2726,7 @@ function EmptyState({ title, description, action }) {
|
|
|
2726
2726
|
}
|
|
2727
2727
|
|
|
2728
2728
|
// src/defaults/CheckoutPageDefault.tsx
|
|
2729
|
-
import { useEffect as useEffect11, useMemo as useMemo5 } from "react";
|
|
2729
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState9 } from "react";
|
|
2730
2730
|
import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
2731
2731
|
|
|
2732
2732
|
// src/hooks/useCheckoutForm.ts
|
|
@@ -2851,7 +2851,7 @@ function useCheckoutForm(args) {
|
|
|
2851
2851
|
const emailConfirmError = touchedEmailConfirm || formSubmitAttempted ? validateEmailConfirm : null;
|
|
2852
2852
|
const phoneError = touchedPhone || formSubmitAttempted ? validatePhone : null;
|
|
2853
2853
|
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);
|
|
2854
|
+
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
2855
|
const submit = useCallback6(async () => {
|
|
2856
2856
|
setFormSubmitAttempted(true);
|
|
2857
2857
|
setError(null);
|
|
@@ -2866,7 +2866,7 @@ function useCheckoutForm(args) {
|
|
|
2866
2866
|
method: "card",
|
|
2867
2867
|
name: name.trim(),
|
|
2868
2868
|
email,
|
|
2869
|
-
emailConfirm,
|
|
2869
|
+
emailConfirm: emailConfirm || email,
|
|
2870
2870
|
phone,
|
|
2871
2871
|
cpf: cpf.replace(/\D/g, ""),
|
|
2872
2872
|
cycle,
|
|
@@ -2893,7 +2893,7 @@ function useCheckoutForm(args) {
|
|
|
2893
2893
|
method: "pix-auto",
|
|
2894
2894
|
name: name.trim(),
|
|
2895
2895
|
email,
|
|
2896
|
-
emailConfirm,
|
|
2896
|
+
emailConfirm: emailConfirm || email,
|
|
2897
2897
|
phone,
|
|
2898
2898
|
cpf: cpf.replace(/\D/g, ""),
|
|
2899
2899
|
cycle
|
|
@@ -2966,7 +2966,7 @@ function usePlan() {
|
|
|
2966
2966
|
}
|
|
2967
2967
|
|
|
2968
2968
|
// src/defaults/CheckoutPageDefault.tsx
|
|
2969
|
-
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2969
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2970
2970
|
var INTENT_KEY = "hook:paywall:intent";
|
|
2971
2971
|
var PIX_PAYLOAD_KEY = "hook:paywall:pix-pending";
|
|
2972
2972
|
function readIntent() {
|
|
@@ -2982,13 +2982,49 @@ function readIntent() {
|
|
|
2982
2982
|
function formatBrl(cents) {
|
|
2983
2983
|
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(cents / 100);
|
|
2984
2984
|
}
|
|
2985
|
+
function formatCardNumber(v) {
|
|
2986
|
+
const digits = v.replace(/\D/g, "").slice(0, 16);
|
|
2987
|
+
return digits.replace(/(.{4})/g, "$1 ").trim();
|
|
2988
|
+
}
|
|
2989
|
+
function formatExpiryMmAa(v) {
|
|
2990
|
+
const d = v.replace(/\D/g, "").slice(0, 4);
|
|
2991
|
+
if (d.length < 3) return d;
|
|
2992
|
+
return d.slice(0, 2) + "/" + d.slice(2);
|
|
2993
|
+
}
|
|
2994
|
+
function parseExpiryMmAa(v) {
|
|
2995
|
+
const d = v.replace(/\D/g, "");
|
|
2996
|
+
return { month: d.slice(0, 2), year: d.slice(2, 4) };
|
|
2997
|
+
}
|
|
2998
|
+
function formatCpf(v) {
|
|
2999
|
+
const d = v.replace(/\D/g, "").slice(0, 11);
|
|
3000
|
+
if (d.length <= 3) return d;
|
|
3001
|
+
if (d.length <= 6) return d.slice(0, 3) + "." + d.slice(3);
|
|
3002
|
+
if (d.length <= 9) return d.slice(0, 3) + "." + d.slice(3, 6) + "." + d.slice(6);
|
|
3003
|
+
return d.slice(0, 3) + "." + d.slice(3, 6) + "." + d.slice(6, 9) + "-" + d.slice(9);
|
|
3004
|
+
}
|
|
3005
|
+
function detectCardBrand(num) {
|
|
3006
|
+
const n = num.replace(/\s/g, "");
|
|
3007
|
+
if (/^4/.test(n)) return "VISA";
|
|
3008
|
+
if (/^(5[1-5]|2[2-7])/.test(n)) return "MASTER";
|
|
3009
|
+
if (/^3[47]/.test(n)) return "AMEX";
|
|
3010
|
+
if (/^(4011|4312|4389|4514|6011|6362|6363)/.test(n)) return "ELO";
|
|
3011
|
+
if (/^(606282|3841)/.test(n)) return "HIPER";
|
|
3012
|
+
return "";
|
|
3013
|
+
}
|
|
2985
3014
|
function CheckoutPageDefault() {
|
|
2986
3015
|
const navigate = useNavigate2();
|
|
2987
3016
|
const plan = usePlan();
|
|
2988
3017
|
const intent = useMemo5(readIntent, []);
|
|
2989
3018
|
const defaultMethod = intent.method === "pix-auto" ? "pix-auto" : "card";
|
|
2990
|
-
const defaultCycle = intent.cycle === "
|
|
3019
|
+
const defaultCycle = intent.cycle === "MONTHLY" ? "MONTHLY" : "YEARLY";
|
|
2991
3020
|
const form = useCheckoutForm({ defaultMethod, defaultCycle });
|
|
3021
|
+
const [expiryMmAa, setExpiryMmAa] = useState9("");
|
|
3022
|
+
useEffect11(() => {
|
|
3023
|
+
const { month, year } = parseExpiryMmAa(expiryMmAa);
|
|
3024
|
+
if (month !== form.card.expiryMonth || year !== form.card.expiryYear) {
|
|
3025
|
+
form.setCard({ expiryMonth: month, expiryYear: year });
|
|
3026
|
+
}
|
|
3027
|
+
}, [expiryMmAa]);
|
|
2992
3028
|
useEffect11(() => {
|
|
2993
3029
|
if (form.emailTaken && form.loginUrl) {
|
|
2994
3030
|
const t = setTimeout(() => navigate(form.loginUrl), 1200);
|
|
@@ -3000,21 +3036,30 @@ function CheckoutPageDefault() {
|
|
|
3000
3036
|
yearlyPriceCents: plan.data.yearlyPriceCents,
|
|
3001
3037
|
trialDays: plan.data.trialDays
|
|
3002
3038
|
} : null;
|
|
3039
|
+
const annual = form.cycle === "YEARLY";
|
|
3003
3040
|
const cyclePrice = useMemo5(() => {
|
|
3004
3041
|
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,
|
|
3042
|
+
return annual ? planInfo.yearlyPriceCents ?? planInfo.priceCents * 12 : planInfo.priceCents;
|
|
3043
|
+
}, [planInfo, annual]);
|
|
3044
|
+
const monthlyText = useMemo5(() => {
|
|
3045
|
+
if (!planInfo) return "";
|
|
3046
|
+
const monthly = annual && planInfo.yearlyPriceCents ? Math.round(planInfo.yearlyPriceCents / 12) : planInfo.priceCents;
|
|
3047
|
+
return formatBrl(monthly);
|
|
3048
|
+
}, [planInfo, annual]);
|
|
3049
|
+
const todayCents = useMemo5(() => {
|
|
3050
|
+
if (form.method === "pix-auto") return cyclePrice ?? 0;
|
|
3051
|
+
const trialDays2 = planInfo?.trialDays ?? 0;
|
|
3052
|
+
if (trialDays2 > 0) return 0;
|
|
3053
|
+
return cyclePrice ?? 0;
|
|
3054
|
+
}, [form.method, cyclePrice, planInfo]);
|
|
3055
|
+
const todayAmount = formatBrl(todayCents);
|
|
3056
|
+
const cyclePriceText = cyclePrice !== null ? formatBrl(cyclePrice) : "";
|
|
3057
|
+
const annualSavingsCents = useMemo5(() => {
|
|
3058
|
+
if (!planInfo || !planInfo.yearlyPriceCents) return 0;
|
|
3059
|
+
return planInfo.priceCents * 12 - planInfo.yearlyPriceCents;
|
|
3060
|
+
}, [planInfo]);
|
|
3061
|
+
const trialDays = planInfo?.trialDays ?? 7;
|
|
3062
|
+
const cardBrand = detectCardBrand(form.card.number);
|
|
3018
3063
|
async function onSubmit(e) {
|
|
3019
3064
|
e.preventDefault();
|
|
3020
3065
|
const result = await form.submit();
|
|
@@ -3037,207 +3082,373 @@ function CheckoutPageDefault() {
|
|
|
3037
3082
|
}
|
|
3038
3083
|
navigate(result.redirect.replace(/^.*\/app\/[^/]+/, "") || "/");
|
|
3039
3084
|
}
|
|
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: [
|
|
3085
|
+
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: [
|
|
3086
|
+
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
3087
|
"Esse e-mail j\xE1 tem conta nesse app.",
|
|
3047
3088
|
" ",
|
|
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
|
-
|
|
3089
|
+
/* @__PURE__ */ jsx27("a", { href: form.loginUrl ?? "/signin", className: "underline font-semibold", children: "Entrar agora" })
|
|
3090
|
+
] }) }) : null,
|
|
3091
|
+
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,
|
|
3092
|
+
/* @__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: [
|
|
3093
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3094
|
+
/* @__PURE__ */ jsx27(ShieldIcon, { className: "w-4 h-4" }),
|
|
3095
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-bold", children: "Voc\xEA N\xC3O ser\xE1 cobrada hoje" })
|
|
3096
|
+
] }),
|
|
3097
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-baseline text-sm text-muted-foreground", children: [
|
|
3098
|
+
/* @__PURE__ */ jsx27("span", { children: "R$ 0,00 agora" }),
|
|
3099
|
+
/* @__PURE__ */ jsx27("span", { className: "opacity-50", children: "\xB7" }),
|
|
3100
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3101
|
+
monthlyText,
|
|
3102
|
+
"/m\xEAs ap\xF3s ",
|
|
3103
|
+
trialDays,
|
|
3104
|
+
" dias"
|
|
3105
|
+
] })
|
|
3106
|
+
] }),
|
|
3107
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2.5 text-[11px] text-muted-foreground flex items-center gap-1.5", children: [
|
|
3108
|
+
/* @__PURE__ */ jsx27(BellIcon, { className: "w-2.5 h-2.5" }),
|
|
3109
|
+
"Avisamos por email 2 dias antes da primeira cobran\xE7a"
|
|
3110
|
+
] })
|
|
3111
|
+
] }) : /* @__PURE__ */ jsxs18("div", { className: "rounded-2xl p-3.5 bg-emerald-50 border-[1.5px] border-emerald-600/60", children: [
|
|
3112
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mb-2 text-emerald-900", children: [
|
|
3113
|
+
/* @__PURE__ */ jsx27(ShieldIcon, { className: "w-4 h-4" }),
|
|
3114
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm font-bold", children: [
|
|
3115
|
+
"Garantia incondicional de ",
|
|
3116
|
+
trialDays,
|
|
3117
|
+
" dias"
|
|
3118
|
+
] })
|
|
3119
|
+
] }),
|
|
3120
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm text-emerald-900 leading-snug", children: [
|
|
3121
|
+
"Voc\xEA paga ",
|
|
3122
|
+
/* @__PURE__ */ jsx27("b", { children: todayAmount }),
|
|
3123
|
+
" agora via Pix.",
|
|
3124
|
+
/* @__PURE__ */ jsx27("br", {}),
|
|
3125
|
+
"N\xE3o gostou em ",
|
|
3126
|
+
trialDays,
|
|
3127
|
+
" dias? Devolvemos ",
|
|
3128
|
+
/* @__PURE__ */ jsx27("b", { children: "100%" }),
|
|
3129
|
+
" sem perguntas \u2014 direto pelo app."
|
|
3130
|
+
] })
|
|
3131
|
+
] }) }),
|
|
3132
|
+
/* @__PURE__ */ jsxs18("section", { className: "px-5 pt-5", children: [
|
|
3133
|
+
/* @__PURE__ */ jsx27("h2", { className: "font-display text-2xl mb-3.5 leading-tight text-foreground", children: "Quase l\xE1." }),
|
|
3134
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Email" }),
|
|
3064
3135
|
/* @__PURE__ */ jsx27(
|
|
3065
|
-
|
|
3136
|
+
FieldInput,
|
|
3066
3137
|
{
|
|
3067
|
-
label: "E-mail",
|
|
3068
3138
|
type: "email",
|
|
3069
|
-
|
|
3070
|
-
onChange: form.setEmail,
|
|
3071
|
-
onBlur: form.markEmailTouched,
|
|
3072
|
-
error: form.emailError,
|
|
3139
|
+
inputMode: "email",
|
|
3073
3140
|
autoComplete: "email",
|
|
3074
3141
|
autoCapitalize: "none",
|
|
3075
3142
|
autoCorrect: "off",
|
|
3076
3143
|
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
|
|
3144
|
+
placeholder: "seu@email.com",
|
|
3145
|
+
value: form.email,
|
|
3146
|
+
onChange: form.setEmail,
|
|
3147
|
+
onBlur: form.markEmailTouched,
|
|
3148
|
+
error: form.emailError,
|
|
3149
|
+
valid: form.emailStatus === "available"
|
|
3093
3150
|
}
|
|
3094
3151
|
),
|
|
3152
|
+
!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" }),
|
|
3153
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3154
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Nome completo" }),
|
|
3095
3155
|
/* @__PURE__ */ jsx27(
|
|
3096
|
-
|
|
3156
|
+
FieldInput,
|
|
3097
3157
|
{
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3158
|
+
type: "text",
|
|
3159
|
+
autoComplete: "name",
|
|
3160
|
+
placeholder: "como est\xE1 no documento",
|
|
3161
|
+
value: form.name,
|
|
3162
|
+
onChange: form.setName,
|
|
3163
|
+
onBlur: form.markNameTouched,
|
|
3164
|
+
error: form.nameError,
|
|
3165
|
+
valid: !!form.name && !form.nameError
|
|
3106
3166
|
}
|
|
3107
3167
|
),
|
|
3168
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3169
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "CPF" }),
|
|
3108
3170
|
/* @__PURE__ */ jsx27(
|
|
3109
|
-
|
|
3171
|
+
FieldInput,
|
|
3110
3172
|
{
|
|
3111
|
-
label: "CPF",
|
|
3112
3173
|
type: "text",
|
|
3113
3174
|
inputMode: "numeric",
|
|
3175
|
+
placeholder: "000.000.000-00",
|
|
3114
3176
|
value: form.cpf,
|
|
3115
|
-
onChange: form.setCpf,
|
|
3177
|
+
onChange: (v) => form.setCpf(formatCpf(v)),
|
|
3116
3178
|
onBlur: form.markCpfTouched,
|
|
3117
3179
|
error: form.cpfError,
|
|
3118
|
-
|
|
3119
|
-
placeholder: "000.000.000-00"
|
|
3180
|
+
valid: !!form.cpf && !form.cpfError
|
|
3120
3181
|
}
|
|
3121
3182
|
)
|
|
3122
3183
|
] }),
|
|
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: [
|
|
3184
|
+
/* @__PURE__ */ jsxs18("section", { className: "px-5 pt-5", children: [
|
|
3185
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Forma de pagamento" }),
|
|
3186
|
+
/* @__PURE__ */ jsxs18("div", { role: "tablist", className: "flex gap-1.5 bg-muted p-1 rounded-xl", children: [
|
|
3134
3187
|
/* @__PURE__ */ jsx27(
|
|
3135
|
-
|
|
3188
|
+
TabButton,
|
|
3136
3189
|
{
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3190
|
+
active: form.method === "card",
|
|
3191
|
+
onClick: () => form.setMethod("card"),
|
|
3192
|
+
icon: /* @__PURE__ */ jsx27(CardIcon, { className: "w-3.5 h-3.5" }),
|
|
3193
|
+
label: "Cart\xE3o",
|
|
3194
|
+
subtitle: trialDays > 0 ? `${trialDays} dias gr\xE1tis` : "pague hoje",
|
|
3195
|
+
subtitleActiveClass: "text-emerald-700"
|
|
3141
3196
|
}
|
|
3142
3197
|
),
|
|
3143
3198
|
/* @__PURE__ */ jsx27(
|
|
3144
|
-
|
|
3199
|
+
TabButton,
|
|
3145
3200
|
{
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3201
|
+
active: form.method === "pix-auto",
|
|
3202
|
+
onClick: () => form.setMethod("pix-auto"),
|
|
3203
|
+
icon: /* @__PURE__ */ jsx27(PixIcon, { className: "w-3.5 h-3.5" }),
|
|
3204
|
+
label: "Pix",
|
|
3205
|
+
subtitle: `pague hoje \xB7 garantia ${trialDays}d`,
|
|
3206
|
+
subtitleActiveClass: "text-foreground/70"
|
|
3207
|
+
}
|
|
3208
|
+
)
|
|
3209
|
+
] })
|
|
3210
|
+
] }),
|
|
3211
|
+
form.method === "card" ? /* @__PURE__ */ jsxs18("section", { className: "px-5 pt-3.5", children: [
|
|
3212
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "N\xFAmero do cart\xE3o" }),
|
|
3213
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx27(
|
|
3215
|
+
FieldInput,
|
|
3216
|
+
{
|
|
3217
|
+
type: "text",
|
|
3150
3218
|
inputMode: "numeric",
|
|
3151
|
-
|
|
3219
|
+
autoComplete: "cc-number",
|
|
3220
|
+
placeholder: "0000 0000 0000 0000",
|
|
3221
|
+
value: form.card.number,
|
|
3222
|
+
onChange: (v) => form.setCard({ number: formatCardNumber(v) }),
|
|
3223
|
+
style: cardBrand ? { paddingRight: "4.5rem" } : void 0
|
|
3152
3224
|
}
|
|
3153
3225
|
),
|
|
3154
|
-
/* @__PURE__ */
|
|
3226
|
+
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 })
|
|
3227
|
+
] }),
|
|
3228
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3229
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2.5", children: [
|
|
3230
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3231
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Validade" }),
|
|
3155
3232
|
/* @__PURE__ */ jsx27(
|
|
3156
|
-
|
|
3233
|
+
FieldInput,
|
|
3157
3234
|
{
|
|
3158
|
-
|
|
3159
|
-
value: form.card.expiryMonth,
|
|
3160
|
-
onChange: (v) => form.setCard({ expiryMonth: v }),
|
|
3161
|
-
autoComplete: "cc-exp-month",
|
|
3235
|
+
type: "text",
|
|
3162
3236
|
inputMode: "numeric",
|
|
3163
|
-
|
|
3237
|
+
autoComplete: "cc-exp",
|
|
3238
|
+
placeholder: "MM/AA",
|
|
3239
|
+
value: expiryMmAa,
|
|
3240
|
+
onChange: (v) => setExpiryMmAa(formatExpiryMmAa(v))
|
|
3164
3241
|
}
|
|
3165
|
-
)
|
|
3242
|
+
)
|
|
3243
|
+
] }),
|
|
3244
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3245
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "CVV" }),
|
|
3166
3246
|
/* @__PURE__ */ jsx27(
|
|
3167
|
-
|
|
3247
|
+
FieldInput,
|
|
3168
3248
|
{
|
|
3169
|
-
|
|
3170
|
-
value: form.card.expiryYear,
|
|
3171
|
-
onChange: (v) => form.setCard({ expiryYear: v }),
|
|
3172
|
-
autoComplete: "cc-exp-year",
|
|
3249
|
+
type: "text",
|
|
3173
3250
|
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
3251
|
autoComplete: "cc-csc",
|
|
3184
|
-
|
|
3185
|
-
|
|
3252
|
+
placeholder: "3 d\xEDgitos",
|
|
3253
|
+
value: form.card.ccv,
|
|
3254
|
+
onChange: (v) => form.setCard({ ccv: v.replace(/\D/g, "").slice(0, 4) })
|
|
3186
3255
|
}
|
|
3187
3256
|
)
|
|
3188
3257
|
] })
|
|
3189
|
-
] })
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3258
|
+
] }),
|
|
3259
|
+
/* @__PURE__ */ jsx27("div", { className: "h-3" }),
|
|
3260
|
+
/* @__PURE__ */ jsx27(FieldLabel, { children: "Nome no cart\xE3o" }),
|
|
3261
|
+
/* @__PURE__ */ jsx27(
|
|
3262
|
+
FieldInput,
|
|
3263
|
+
{
|
|
3264
|
+
type: "text",
|
|
3265
|
+
autoComplete: "cc-name",
|
|
3266
|
+
placeholder: "como est\xE1 no cart\xE3o",
|
|
3267
|
+
value: form.card.holderName,
|
|
3268
|
+
onChange: (v) => form.setCard({ holderName: v })
|
|
3269
|
+
}
|
|
3270
|
+
)
|
|
3271
|
+
] }) : /* @__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: [
|
|
3272
|
+
/* @__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" }) }) }),
|
|
3273
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
|
|
3274
|
+
/* @__PURE__ */ jsx27("div", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground", children: "pagamento em segundos" }),
|
|
3275
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm text-foreground mt-1 leading-snug", children: [
|
|
3276
|
+
"Geramos seu ",
|
|
3277
|
+
/* @__PURE__ */ jsx27("b", { children: "QR Pix" }),
|
|
3278
|
+
" no pr\xF3ximo passo. Pague pelo app do banco e seu acesso libera ",
|
|
3279
|
+
/* @__PURE__ */ jsx27("b", { children: "imediatamente" }),
|
|
3280
|
+
"."
|
|
3281
|
+
] })
|
|
3282
|
+
] })
|
|
3283
|
+
] }) }),
|
|
3284
|
+
/* @__PURE__ */ jsx27("section", { className: "px-5 pt-5", children: /* @__PURE__ */ jsxs18("div", { className: "bg-muted rounded-2xl p-4", children: [
|
|
3285
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between mb-2.5", children: [
|
|
3286
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3287
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold text-foreground", children: annual ? "Plano Anual" : "Plano Mensal" }),
|
|
3288
|
+
/* @__PURE__ */ jsx27("div", { className: "text-[11px] text-muted-foreground", children: "Coach" })
|
|
3289
|
+
] }),
|
|
3290
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-right", children: [
|
|
3291
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-sm font-bold text-foreground", children: [
|
|
3292
|
+
cyclePriceText,
|
|
3293
|
+
"/",
|
|
3294
|
+
annual ? "ano" : "m\xEAs"
|
|
3295
|
+
] }),
|
|
3296
|
+
annual && annualSavingsCents > 0 && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-emerald-700 font-semibold", children: [
|
|
3297
|
+
"economia ",
|
|
3298
|
+
formatBrl(annualSavingsCents)
|
|
3299
|
+
] })
|
|
3300
|
+
] })
|
|
3301
|
+
] }),
|
|
3302
|
+
/* @__PURE__ */ jsx27("div", { className: "h-px bg-border my-3" }),
|
|
3303
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-baseline", children: [
|
|
3304
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3305
|
+
/* @__PURE__ */ jsx27("div", { className: "text-sm font-bold text-foreground", children: "Voc\xEA paga hoje" }),
|
|
3306
|
+
form.method === "card" && trialDays > 0 && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-muted-foreground mt-0.5", children: [
|
|
3307
|
+
"cobran\xE7a inicia no dia ",
|
|
3308
|
+
trialDays
|
|
3309
|
+
] }),
|
|
3310
|
+
form.method === "pix-auto" && /* @__PURE__ */ jsxs18("div", { className: "text-[11px] text-emerald-700 mt-0.5 font-semibold", children: [
|
|
3311
|
+
"reembolso garantido at\xE9 o dia ",
|
|
3312
|
+
trialDays
|
|
3313
|
+
] })
|
|
3314
|
+
] }),
|
|
3315
|
+
/* @__PURE__ */ jsx27("div", { className: "text-2xl font-bold font-display tracking-tight text-foreground", children: todayAmount })
|
|
3316
|
+
] })
|
|
3317
|
+
] }) }),
|
|
3318
|
+
/* @__PURE__ */ jsx27("div", { className: "h-4" }),
|
|
3319
|
+
/* @__PURE__ */ jsxs18("div", { className: "sticky bottom-0 px-5 pt-3.5 pb-6 bg-gradient-to-b from-transparent to-background", children: [
|
|
3320
|
+
/* @__PURE__ */ jsx27(
|
|
3321
|
+
"button",
|
|
3322
|
+
{
|
|
3323
|
+
type: "submit",
|
|
3324
|
+
disabled: !form.canSubmit,
|
|
3325
|
+
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",
|
|
3326
|
+
children: form.submitting ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3327
|
+
/* @__PURE__ */ jsx27(Spinner2, {}),
|
|
3328
|
+
" ",
|
|
3329
|
+
form.method === "pix-auto" ? "Gerando QR\u2026" : "Confirmando\u2026"
|
|
3330
|
+
] }) : form.method === "card" ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3331
|
+
/* @__PURE__ */ jsx27(LockIcon, { className: "w-3.5 h-3.5" }),
|
|
3332
|
+
" Confirmar e come\xE7ar gr\xE1tis"
|
|
3333
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3334
|
+
/* @__PURE__ */ jsx27(PixIcon, { className: "w-3.5 h-3.5" }),
|
|
3335
|
+
" Gerar QR \xB7 pagar ",
|
|
3336
|
+
todayAmount
|
|
3337
|
+
] })
|
|
3338
|
+
}
|
|
3339
|
+
),
|
|
3340
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-center mt-2.5 text-xs text-muted-foreground", children: [
|
|
3341
|
+
"Ao continuar, voc\xEA concorda com nossos ",
|
|
3342
|
+
/* @__PURE__ */ jsx27("u", { children: "Termos" }),
|
|
3343
|
+
". Pagamento seguro Asaas."
|
|
3344
|
+
] }),
|
|
3345
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-3 flex items-center justify-center gap-3.5 text-[11px] text-muted-foreground", children: [
|
|
3346
|
+
/* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1", children: [
|
|
3347
|
+
/* @__PURE__ */ jsx27(LockIcon, { className: "w-2.5 h-2.5 opacity-60" }),
|
|
3348
|
+
" SSL 256-bit"
|
|
3349
|
+
] }),
|
|
3350
|
+
/* @__PURE__ */ jsx27("span", { className: "w-px h-2.5 bg-border" }),
|
|
3351
|
+
/* @__PURE__ */ jsx27("span", { children: "Pagamento via Asaas" }),
|
|
3352
|
+
/* @__PURE__ */ jsx27("span", { className: "w-px h-2.5 bg-border" }),
|
|
3353
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3354
|
+
"Garantia ",
|
|
3355
|
+
trialDays,
|
|
3356
|
+
" dias"
|
|
3357
|
+
] })
|
|
3358
|
+
] })
|
|
3359
|
+
] })
|
|
3201
3360
|
] }) });
|
|
3202
3361
|
}
|
|
3203
|
-
function
|
|
3204
|
-
return /* @__PURE__ */
|
|
3205
|
-
|
|
3362
|
+
function FieldLabel({ children }) {
|
|
3363
|
+
return /* @__PURE__ */ jsx27("div", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-1.5", children });
|
|
3364
|
+
}
|
|
3365
|
+
function FieldInput(props) {
|
|
3366
|
+
const baseClass = "w-full px-4 rounded-xl bg-card text-base text-foreground outline-none border-[1.5px] transition-colors";
|
|
3367
|
+
const stateClass = props.error ? "border-destructive focus:border-destructive" : props.valid ? "border-emerald-600 focus:border-emerald-700" : "border-border focus:border-foreground";
|
|
3368
|
+
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3206
3369
|
/* @__PURE__ */ jsx27(
|
|
3207
3370
|
"input",
|
|
3208
3371
|
{
|
|
3209
3372
|
type: props.type ?? "text",
|
|
3210
|
-
|
|
3211
|
-
onChange: (e) => props.onChange(e.target.value),
|
|
3212
|
-
onBlur: props.onBlur,
|
|
3373
|
+
inputMode: props.inputMode,
|
|
3213
3374
|
autoComplete: props.autoComplete,
|
|
3214
3375
|
autoCapitalize: props.autoCapitalize,
|
|
3215
3376
|
autoCorrect: props.autoCorrect,
|
|
3216
3377
|
spellCheck: props.spellCheck,
|
|
3217
|
-
inputMode: props.inputMode,
|
|
3218
3378
|
placeholder: props.placeholder,
|
|
3219
|
-
|
|
3379
|
+
value: props.value,
|
|
3380
|
+
onChange: (e) => props.onChange(e.target.value),
|
|
3381
|
+
onBlur: props.onBlur,
|
|
3382
|
+
style: { height: "52px", ...props.style },
|
|
3383
|
+
className: `${baseClass} ${stateClass}`
|
|
3220
3384
|
}
|
|
3221
3385
|
),
|
|
3222
|
-
props.error ? /* @__PURE__ */ jsx27("
|
|
3386
|
+
props.error ? /* @__PURE__ */ jsx27("div", { className: "mt-1.5 text-xs text-destructive font-medium", children: props.error }) : null
|
|
3223
3387
|
] });
|
|
3224
3388
|
}
|
|
3225
|
-
function
|
|
3226
|
-
return /* @__PURE__ */ jsx27(
|
|
3389
|
+
function FieldHint({ children }) {
|
|
3390
|
+
return /* @__PURE__ */ jsx27("div", { className: "mt-1.5 text-xs text-muted-foreground", children });
|
|
3391
|
+
}
|
|
3392
|
+
function TabButton({ active, onClick, icon, label, subtitle, subtitleActiveClass }) {
|
|
3393
|
+
return /* @__PURE__ */ jsxs18(
|
|
3227
3394
|
"button",
|
|
3228
3395
|
{
|
|
3229
3396
|
type: "button",
|
|
3230
3397
|
role: "tab",
|
|
3231
3398
|
"aria-selected": active,
|
|
3232
3399
|
onClick,
|
|
3233
|
-
className: `
|
|
3234
|
-
|
|
3400
|
+
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"}`,
|
|
3401
|
+
style: { minHeight: 56 },
|
|
3402
|
+
children: [
|
|
3403
|
+
/* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
3404
|
+
icon,
|
|
3405
|
+
" ",
|
|
3406
|
+
label
|
|
3407
|
+
] }),
|
|
3408
|
+
/* @__PURE__ */ jsx27("span", { className: `text-[10px] font-medium ${active ? subtitleActiveClass : "text-muted-foreground/70"}`, children: subtitle })
|
|
3409
|
+
]
|
|
3410
|
+
}
|
|
3411
|
+
);
|
|
3412
|
+
}
|
|
3413
|
+
function CardIcon({ className }) {
|
|
3414
|
+
return /* @__PURE__ */ jsxs18("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3415
|
+
/* @__PURE__ */ jsx27("rect", { x: "2.5", y: "5.5", width: "19", height: "13", rx: "2.5" }),
|
|
3416
|
+
/* @__PURE__ */ jsx27("path", { d: "M2.5 10h19" })
|
|
3417
|
+
] });
|
|
3418
|
+
}
|
|
3419
|
+
function PixIcon({ className }) {
|
|
3420
|
+
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" }) });
|
|
3421
|
+
}
|
|
3422
|
+
function LockIcon({ className }) {
|
|
3423
|
+
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: [
|
|
3424
|
+
/* @__PURE__ */ jsx27("rect", { x: "4", y: "10", width: "16", height: "11", rx: "2.5" }),
|
|
3425
|
+
/* @__PURE__ */ jsx27("path", { d: "M7.5 10V7a4.5 4.5 0 119 0v3" })
|
|
3426
|
+
] });
|
|
3427
|
+
}
|
|
3428
|
+
function ShieldIcon({ className }) {
|
|
3429
|
+
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: [
|
|
3430
|
+
/* @__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" }),
|
|
3431
|
+
/* @__PURE__ */ jsx27("path", { d: "M9 12l2 2 4-4" })
|
|
3432
|
+
] });
|
|
3433
|
+
}
|
|
3434
|
+
function BellIcon({ className }) {
|
|
3435
|
+
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: [
|
|
3436
|
+
/* @__PURE__ */ jsx27("path", { d: "M6 17V11a6 6 0 1112 0v6l1.5 2H4.5L6 17z" }),
|
|
3437
|
+
/* @__PURE__ */ jsx27("path", { d: "M10 21a2 2 0 004 0" })
|
|
3438
|
+
] });
|
|
3439
|
+
}
|
|
3440
|
+
function Spinner2() {
|
|
3441
|
+
return /* @__PURE__ */ jsx27(
|
|
3442
|
+
"span",
|
|
3443
|
+
{
|
|
3444
|
+
className: "w-4 h-4 rounded-full border-2 border-white/40 border-t-white",
|
|
3445
|
+
style: { animation: "spin 0.7s linear infinite" }
|
|
3235
3446
|
}
|
|
3236
3447
|
);
|
|
3237
3448
|
}
|
|
3238
3449
|
|
|
3239
3450
|
// src/defaults/PixWaitingPageDefault.tsx
|
|
3240
|
-
import { useEffect as useEffect12, useMemo as useMemo6, useState as
|
|
3451
|
+
import { useEffect as useEffect12, useMemo as useMemo6, useState as useState10 } from "react";
|
|
3241
3452
|
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
3242
3453
|
import { useHook as useHook11 } from "@hook-sdk/sdk";
|
|
3243
3454
|
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -3264,8 +3475,8 @@ function PixWaitingPageDefault() {
|
|
|
3264
3475
|
const navigate = useNavigate3();
|
|
3265
3476
|
const { subscription } = useHook11();
|
|
3266
3477
|
const payload = useMemo6(readPixPayload, []);
|
|
3267
|
-
const [copied, setCopied] =
|
|
3268
|
-
const [timedOut, setTimedOut] =
|
|
3478
|
+
const [copied, setCopied] = useState10(false);
|
|
3479
|
+
const [timedOut, setTimedOut] = useState10(false);
|
|
3269
3480
|
useEffect12(() => {
|
|
3270
3481
|
if (!payload) navigate("/paywall/checkout", { replace: true });
|
|
3271
3482
|
}, [payload, navigate]);
|
|
@@ -3337,19 +3548,19 @@ function PixWaitingPageDefault() {
|
|
|
3337
3548
|
}
|
|
3338
3549
|
|
|
3339
3550
|
// src/hooks/useLoginForm.ts
|
|
3340
|
-
import { useCallback as useCallback7, useMemo as useMemo7, useState as
|
|
3551
|
+
import { useCallback as useCallback7, useMemo as useMemo7, useState as useState11 } from "react";
|
|
3341
3552
|
import { useHook as useHook12 } from "@hook-sdk/sdk";
|
|
3342
3553
|
var EMAIL_RE2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3343
3554
|
var MIN_PASSWORD = 8;
|
|
3344
3555
|
function useLoginForm() {
|
|
3345
3556
|
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] =
|
|
3557
|
+
const [email, setEmail] = useState11("");
|
|
3558
|
+
const [password, setPassword] = useState11("");
|
|
3559
|
+
const [submitting, setSubmitting] = useState11(false);
|
|
3560
|
+
const [error, setError] = useState11(null);
|
|
3561
|
+
const [touchedEmail, setTouchedEmail] = useState11(false);
|
|
3562
|
+
const [touchedPassword, setTouchedPassword] = useState11(false);
|
|
3563
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState11(false);
|
|
3353
3564
|
const validateEmail = useMemo7(() => {
|
|
3354
3565
|
if (email.length === 0) return null;
|
|
3355
3566
|
if (!EMAIL_RE2.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -3397,21 +3608,21 @@ function useLoginForm() {
|
|
|
3397
3608
|
}
|
|
3398
3609
|
|
|
3399
3610
|
// src/hooks/useSignupForm.ts
|
|
3400
|
-
import { useCallback as useCallback8, useMemo as useMemo8, useState as
|
|
3611
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
|
|
3401
3612
|
import { useHook as useHook13 } from "@hook-sdk/sdk";
|
|
3402
3613
|
var EMAIL_RE3 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3403
3614
|
var MIN_PASSWORD2 = 8;
|
|
3404
3615
|
function useSignupForm() {
|
|
3405
3616
|
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] =
|
|
3617
|
+
const [name, setName] = useState12("");
|
|
3618
|
+
const [email, setEmail] = useState12("");
|
|
3619
|
+
const [password, setPassword] = useState12("");
|
|
3620
|
+
const [submitting, setSubmitting] = useState12(false);
|
|
3621
|
+
const [error, setError] = useState12(null);
|
|
3622
|
+
const [touchedName, setTouchedName] = useState12(false);
|
|
3623
|
+
const [touchedEmail, setTouchedEmail] = useState12(false);
|
|
3624
|
+
const [touchedPassword, setTouchedPassword] = useState12(false);
|
|
3625
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState12(false);
|
|
3415
3626
|
const validateName = useMemo8(() => {
|
|
3416
3627
|
if (name.length === 0) return null;
|
|
3417
3628
|
if (name.trim().length < 2) return "Nome muito curto.";
|
|
@@ -3469,17 +3680,17 @@ function useSignupForm() {
|
|
|
3469
3680
|
}
|
|
3470
3681
|
|
|
3471
3682
|
// src/hooks/useForgotForm.ts
|
|
3472
|
-
import { useCallback as useCallback9, useMemo as useMemo9, useState as
|
|
3683
|
+
import { useCallback as useCallback9, useMemo as useMemo9, useState as useState13 } from "react";
|
|
3473
3684
|
import { useHook as useHook14 } from "@hook-sdk/sdk";
|
|
3474
3685
|
var EMAIL_RE4 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3475
3686
|
function useForgotForm() {
|
|
3476
3687
|
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] =
|
|
3688
|
+
const [email, setEmail] = useState13("");
|
|
3689
|
+
const [submitting, setSubmitting] = useState13(false);
|
|
3690
|
+
const [sent, setSent] = useState13(false);
|
|
3691
|
+
const [error, setError] = useState13(null);
|
|
3692
|
+
const [touchedEmail, setTouchedEmail] = useState13(false);
|
|
3693
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState13(false);
|
|
3483
3694
|
const validateEmail = useMemo9(() => {
|
|
3484
3695
|
if (email.length === 0) return null;
|
|
3485
3696
|
if (!EMAIL_RE4.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -3518,20 +3729,20 @@ function useForgotForm() {
|
|
|
3518
3729
|
}
|
|
3519
3730
|
|
|
3520
3731
|
// src/hooks/useResetForm.ts
|
|
3521
|
-
import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo10, useState as
|
|
3732
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo10, useState as useState14 } from "react";
|
|
3522
3733
|
import { useHook as useHook15 } from "@hook-sdk/sdk";
|
|
3523
3734
|
var MIN_PASSWORD3 = 12;
|
|
3524
3735
|
function useResetForm() {
|
|
3525
3736
|
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] =
|
|
3737
|
+
const [token, setToken] = useState14(null);
|
|
3738
|
+
const [password, setPassword] = useState14("");
|
|
3739
|
+
const [confirm, setConfirm] = useState14("");
|
|
3740
|
+
const [submitting, setSubmitting] = useState14(false);
|
|
3741
|
+
const [done, setDone] = useState14(false);
|
|
3742
|
+
const [error, setError] = useState14(null);
|
|
3743
|
+
const [touchedPassword, setTouchedPassword] = useState14(false);
|
|
3744
|
+
const [touchedConfirm, setTouchedConfirm] = useState14(false);
|
|
3745
|
+
const [formSubmitAttempted, setFormSubmitAttempted] = useState14(false);
|
|
3535
3746
|
useEffect13(() => {
|
|
3536
3747
|
if (typeof window === "undefined") return;
|
|
3537
3748
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -3669,13 +3880,13 @@ function useSubscription() {
|
|
|
3669
3880
|
}
|
|
3670
3881
|
|
|
3671
3882
|
// src/hooks/useReminders.ts
|
|
3672
|
-
import { useCallback as useCallback11, useEffect as useEffect15, useState as
|
|
3883
|
+
import { useCallback as useCallback11, useEffect as useEffect15, useState as useState15 } from "react";
|
|
3673
3884
|
import { useHook as useHook19 } from "@hook-sdk/sdk";
|
|
3674
3885
|
function useReminders() {
|
|
3675
3886
|
const { push } = useHook19();
|
|
3676
3887
|
const r = push.reminders;
|
|
3677
|
-
const [reminders, setReminders] =
|
|
3678
|
-
const [loading, setLoading] =
|
|
3888
|
+
const [reminders, setReminders] = useState15([]);
|
|
3889
|
+
const [loading, setLoading] = useState15(true);
|
|
3679
3890
|
const reload = useCallback11(async () => {
|
|
3680
3891
|
setLoading(true);
|
|
3681
3892
|
try {
|
|
@@ -3706,9 +3917,9 @@ function useReminders() {
|
|
|
3706
3917
|
}
|
|
3707
3918
|
|
|
3708
3919
|
// src/hooks/useToast.ts
|
|
3709
|
-
import { useCallback as useCallback12, useState as
|
|
3920
|
+
import { useCallback as useCallback12, useState as useState16 } from "react";
|
|
3710
3921
|
function useToast() {
|
|
3711
|
-
const [items, setItems] =
|
|
3922
|
+
const [items, setItems] = useState16([]);
|
|
3712
3923
|
const show = useCallback12((message, kind = "info") => {
|
|
3713
3924
|
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3714
3925
|
setItems((prev) => [...prev, { id, message, kind }]);
|
|
@@ -3871,22 +4082,39 @@ function useFeature(name) {
|
|
|
3871
4082
|
import { useEffect as useEffect17, useMemo as useMemo12 } from "react";
|
|
3872
4083
|
import { useHook as useHook21 } from "@hook-sdk/sdk";
|
|
3873
4084
|
|
|
3874
|
-
// src/components/paywall/
|
|
4085
|
+
// src/components/paywall/PaywallProvider.tsx
|
|
4086
|
+
import { createContext as createContext4 } from "react";
|
|
3875
4087
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
4088
|
+
var PaywallContext = createContext4(null);
|
|
4089
|
+
function PaywallProvider({ children }) {
|
|
4090
|
+
const state = usePaywallState();
|
|
4091
|
+
return /* @__PURE__ */ jsx32(PaywallContext.Provider, { value: state, children });
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
// src/components/paywall/usePaywallContext.ts
|
|
4095
|
+
import { useContext as useContext5 } from "react";
|
|
4096
|
+
function usePaywallContext() {
|
|
4097
|
+
const ctx = useContext5(PaywallContext);
|
|
4098
|
+
if (!ctx) {
|
|
4099
|
+
throw new Error("usePaywallContext must be used within <PaywallProvider>");
|
|
4100
|
+
}
|
|
4101
|
+
return ctx;
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
// src/components/paywall/PaywallMethodTabs.tsx
|
|
4105
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3876
4106
|
function PaywallMethodTabs({
|
|
3877
|
-
methods,
|
|
3878
|
-
selected,
|
|
3879
|
-
onSelect,
|
|
3880
4107
|
labels,
|
|
3881
4108
|
className,
|
|
3882
4109
|
tabClassName,
|
|
3883
4110
|
tabActiveClassName
|
|
3884
4111
|
}) {
|
|
4112
|
+
const { methods, selectedMethod, selectMethod } = usePaywallContext();
|
|
3885
4113
|
if (methods.length < 2) return null;
|
|
3886
|
-
return /* @__PURE__ */
|
|
3887
|
-
const active = m ===
|
|
4114
|
+
return /* @__PURE__ */ jsx33("div", { role: "tablist", "aria-label": "M\xE9todo de pagamento", className, children: methods.map((m) => {
|
|
4115
|
+
const active = m === selectedMethod;
|
|
3888
4116
|
const label = labels[m] ?? m;
|
|
3889
|
-
return /* @__PURE__ */
|
|
4117
|
+
return /* @__PURE__ */ jsx33(
|
|
3890
4118
|
"button",
|
|
3891
4119
|
{
|
|
3892
4120
|
type: "button",
|
|
@@ -3894,7 +4122,7 @@ function PaywallMethodTabs({
|
|
|
3894
4122
|
"aria-selected": active,
|
|
3895
4123
|
"aria-controls": `paywall-tab-${m}`,
|
|
3896
4124
|
tabIndex: active ? 0 : -1,
|
|
3897
|
-
onClick: () =>
|
|
4125
|
+
onClick: () => selectMethod(m),
|
|
3898
4126
|
className: [tabClassName, active ? tabActiveClassName : ""].filter(Boolean).join(" "),
|
|
3899
4127
|
children: label
|
|
3900
4128
|
},
|
|
@@ -3904,36 +4132,51 @@ function PaywallMethodTabs({
|
|
|
3904
4132
|
}
|
|
3905
4133
|
|
|
3906
4134
|
// src/components/paywall/PaywallMethodContent.tsx
|
|
3907
|
-
import { jsx as
|
|
3908
|
-
function PaywallMethodContent({
|
|
3909
|
-
|
|
3910
|
-
copy
|
|
3911
|
-
|
|
3912
|
-
className,
|
|
3913
|
-
rowClassName
|
|
3914
|
-
}) {
|
|
3915
|
-
const useCardConsumed = method === "card" && hasConsumedTrial && copy.cardConsumedTrial;
|
|
3916
|
-
const rows = useCardConsumed ? copy.cardConsumedTrial.bodyRows : method === "pix-auto" || method === "pix-once" ? copy.pix.bodyRows : copy.card.bodyRows;
|
|
3917
|
-
return /* @__PURE__ */ jsx33("div", { role: "tabpanel", id: `paywall-tab-${method}`, className, children: rows.map((row, i) => /* @__PURE__ */ jsx33("div", { className: rowClassName, children: row }, i)) });
|
|
4135
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4136
|
+
function PaywallMethodContent({ copy, className, rowClassName }) {
|
|
4137
|
+
const { selectedMethod, hasConsumedTrial } = usePaywallContext();
|
|
4138
|
+
const useCardConsumed = selectedMethod === "card" && hasConsumedTrial && copy.cardConsumedTrial;
|
|
4139
|
+
const rows = useCardConsumed ? copy.cardConsumedTrial.bodyRows : selectedMethod === "pix-auto" || selectedMethod === "pix-once" ? copy.pix.bodyRows : copy.card.bodyRows;
|
|
4140
|
+
return /* @__PURE__ */ jsx34("div", { role: "tabpanel", id: `paywall-tab-${selectedMethod}`, className, children: rows.map((row, i) => /* @__PURE__ */ jsx34("div", { className: rowClassName, children: row }, i)) });
|
|
3918
4141
|
}
|
|
3919
4142
|
|
|
3920
4143
|
// src/components/paywall/PaywallCyclePicker.tsx
|
|
3921
|
-
import { jsx as
|
|
4144
|
+
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4145
|
+
var VARIANT_CLASSES = {
|
|
4146
|
+
default: { card: "", cardSelected: "" },
|
|
4147
|
+
"premium-gold": {
|
|
4148
|
+
card: "",
|
|
4149
|
+
cardSelected: "border-2 border-yellow-400/80 ring-2 ring-yellow-400/20"
|
|
4150
|
+
},
|
|
4151
|
+
"pink-pill": {
|
|
4152
|
+
card: "rounded-2xl",
|
|
4153
|
+
cardSelected: "border-2 border-pink-500"
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
3922
4156
|
function PaywallCyclePicker({
|
|
3923
|
-
cycles,
|
|
3924
|
-
selected,
|
|
3925
|
-
onSelect,
|
|
3926
|
-
priceCentsByCycle,
|
|
3927
|
-
anchorCentsByCycle,
|
|
3928
|
-
monthlyEquivByCycle,
|
|
3929
4157
|
labels,
|
|
3930
4158
|
className,
|
|
3931
4159
|
cardClassName,
|
|
3932
4160
|
cardSelectedClassName,
|
|
3933
|
-
anchorClassName
|
|
4161
|
+
anchorClassName,
|
|
4162
|
+
variant = "default",
|
|
4163
|
+
render
|
|
3934
4164
|
}) {
|
|
4165
|
+
const ctx = usePaywallContext();
|
|
4166
|
+
const { cycle: selected, setCycle, plan, anchorPriceCents } = ctx;
|
|
4167
|
+
const cycles = ["MONTHLY", "YEARLY"];
|
|
4168
|
+
if (render) {
|
|
4169
|
+
return /* @__PURE__ */ jsx35("div", { className, children: render({ cycles, selected, setCycle, plan, anchorPriceCents }) });
|
|
4170
|
+
}
|
|
3935
4171
|
if (cycles.length < 2) return null;
|
|
3936
|
-
|
|
4172
|
+
const v = VARIANT_CLASSES[variant];
|
|
4173
|
+
const composedCardClassName = [v.card, cardClassName].filter(Boolean).join(" ");
|
|
4174
|
+
const composedCardSelectedClassName = [v.cardSelected, cardSelectedClassName].filter(Boolean).join(" ");
|
|
4175
|
+
const monthlyCents = plan?.monthlyCents ?? 0;
|
|
4176
|
+
const yearlyCents = plan?.yearlyCents ?? 0;
|
|
4177
|
+
const anchorMonthly = plan?.anchorMonthlyCents ?? null;
|
|
4178
|
+
const anchorYearly = plan?.anchorYearlyCents ?? null;
|
|
4179
|
+
return /* @__PURE__ */ jsx35(
|
|
3937
4180
|
"div",
|
|
3938
4181
|
{
|
|
3939
4182
|
role: "radiogroup",
|
|
@@ -3943,21 +4186,25 @@ function PaywallCyclePicker({
|
|
|
3943
4186
|
const active = c === selected;
|
|
3944
4187
|
const label = c === "YEARLY" ? labels.annualLabel : labels.monthlyLabel;
|
|
3945
4188
|
const suffix = c === "YEARLY" ? labels.annualSuffix : labels.monthlySuffix;
|
|
3946
|
-
const mainCents = c === "YEARLY" ?
|
|
3947
|
-
const anchorCents =
|
|
4189
|
+
const mainCents = c === "YEARLY" ? Math.round(yearlyCents / 12) : monthlyCents;
|
|
4190
|
+
const anchorCents = c === "YEARLY" ? anchorYearly : anchorMonthly;
|
|
3948
4191
|
return /* @__PURE__ */ jsxs21(
|
|
3949
4192
|
"button",
|
|
3950
4193
|
{
|
|
3951
4194
|
type: "button",
|
|
3952
4195
|
role: "radio",
|
|
3953
4196
|
"aria-checked": active,
|
|
3954
|
-
onClick: () =>
|
|
3955
|
-
className: [
|
|
4197
|
+
onClick: () => setCycle(c),
|
|
4198
|
+
className: [
|
|
4199
|
+
"flex flex-col items-center gap-0.5",
|
|
4200
|
+
composedCardClassName,
|
|
4201
|
+
active ? composedCardSelectedClassName : ""
|
|
4202
|
+
].filter(Boolean).join(" "),
|
|
3956
4203
|
children: [
|
|
3957
|
-
/* @__PURE__ */
|
|
3958
|
-
/* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
3960
|
-
anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */
|
|
4204
|
+
/* @__PURE__ */ jsx35("span", { className: "font-bold text-base leading-tight", children: formatBRL(mainCents) }),
|
|
4205
|
+
/* @__PURE__ */ jsx35("span", { className: "text-xs opacity-70 leading-tight", children: suffix }),
|
|
4206
|
+
/* @__PURE__ */ jsx35("span", { className: "text-xs opacity-60 leading-tight", children: label }),
|
|
4207
|
+
anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */ jsx35("span", { className: anchorClassName ?? "text-xs opacity-50", children: /* @__PURE__ */ jsx35("s", { children: formatBRL(anchorCents) }) }) : null
|
|
3961
4208
|
]
|
|
3962
4209
|
},
|
|
3963
4210
|
c
|
|
@@ -3967,62 +4214,51 @@ function PaywallCyclePicker({
|
|
|
3967
4214
|
);
|
|
3968
4215
|
}
|
|
3969
4216
|
|
|
3970
|
-
// src/components/paywall/PaywallCta.tsx
|
|
3971
|
-
import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3972
|
-
function PaywallCta({
|
|
3973
|
-
ctaLabel,
|
|
3974
|
-
loadingLabel,
|
|
3975
|
-
switchHint,
|
|
3976
|
-
trustLine,
|
|
3977
|
-
onClick,
|
|
3978
|
-
disabled = false,
|
|
3979
|
-
loading = false,
|
|
3980
|
-
className,
|
|
3981
|
-
buttonClassName,
|
|
3982
|
-
switchHintClassName,
|
|
3983
|
-
trustClassName
|
|
3984
|
-
}) {
|
|
3985
|
-
const label = loading && loadingLabel ? loadingLabel : ctaLabel;
|
|
3986
|
-
return /* @__PURE__ */ jsxs22("div", { className, children: [
|
|
3987
|
-
/* @__PURE__ */ jsx35(
|
|
3988
|
-
"button",
|
|
3989
|
-
{
|
|
3990
|
-
type: "button",
|
|
3991
|
-
onClick,
|
|
3992
|
-
disabled: disabled || loading,
|
|
3993
|
-
className: buttonClassName,
|
|
3994
|
-
children: label
|
|
3995
|
-
}
|
|
3996
|
-
),
|
|
3997
|
-
switchHint ? /* @__PURE__ */ jsx35("p", { className: switchHintClassName, children: switchHint }) : null,
|
|
3998
|
-
/* @__PURE__ */ jsx35("p", { className: trustClassName, children: trustLine })
|
|
3999
|
-
] });
|
|
4000
|
-
}
|
|
4001
|
-
|
|
4002
4217
|
// src/components/paywall/Paywall.tsx
|
|
4003
|
-
import { jsx as jsx36, jsxs as
|
|
4218
|
+
import { jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4004
4219
|
var NBSP = "\xA0";
|
|
4005
4220
|
function Paywall({
|
|
4006
4221
|
copy,
|
|
4007
4222
|
themeClasses = {},
|
|
4008
4223
|
slots = {},
|
|
4009
4224
|
onBeforeCheckout
|
|
4225
|
+
}) {
|
|
4226
|
+
return /* @__PURE__ */ jsx36(PaywallProvider, { children: /* @__PURE__ */ jsx36(
|
|
4227
|
+
PaywallInner,
|
|
4228
|
+
{
|
|
4229
|
+
copy,
|
|
4230
|
+
themeClasses,
|
|
4231
|
+
slots,
|
|
4232
|
+
onBeforeCheckout
|
|
4233
|
+
}
|
|
4234
|
+
) });
|
|
4235
|
+
}
|
|
4236
|
+
function PaywallInner({
|
|
4237
|
+
copy,
|
|
4238
|
+
themeClasses = {},
|
|
4239
|
+
slots = {},
|
|
4240
|
+
onBeforeCheckout
|
|
4010
4241
|
}) {
|
|
4011
4242
|
const { track: track2 } = useHook21();
|
|
4012
|
-
const s =
|
|
4243
|
+
const s = usePaywallContext();
|
|
4013
4244
|
const priceLabel = formatBRL(s.currentPriceCents).replace(new RegExp(NBSP, "g"), " ");
|
|
4014
|
-
const monthlyEquivLabel = formatBRL(s.currentMonthlyEquivCents).replace(new RegExp(NBSP, "g"), " ");
|
|
4015
4245
|
const trialDaysCardLabel = String(s.trialDaysCard);
|
|
4016
4246
|
const ctaLabel = useMemo12(() => {
|
|
4017
4247
|
if (s.isFree) return copy.freeCta ?? "Come\xE7ar agora";
|
|
4018
4248
|
if (s.selectedMethod === "card") {
|
|
4019
4249
|
if (s.hasConsumedTrial && copy.cardConsumedTrial) {
|
|
4020
|
-
return interp(copy.cardConsumedTrial.ctaTemplate, {
|
|
4250
|
+
return interp(copy.cardConsumedTrial.ctaTemplate, {
|
|
4251
|
+
price: priceLabel,
|
|
4252
|
+
days: trialDaysCardLabel
|
|
4253
|
+
});
|
|
4021
4254
|
}
|
|
4022
4255
|
if (s.trialDaysCard > 0) {
|
|
4023
4256
|
return interp(copy.card.ctaTemplate, { price: priceLabel, days: trialDaysCardLabel });
|
|
4024
4257
|
}
|
|
4025
|
-
return copy.cardConsumedTrial ? interp(copy.cardConsumedTrial.ctaTemplate, {
|
|
4258
|
+
return copy.cardConsumedTrial ? interp(copy.cardConsumedTrial.ctaTemplate, {
|
|
4259
|
+
price: priceLabel,
|
|
4260
|
+
days: trialDaysCardLabel
|
|
4261
|
+
}) : `Assinar por ${priceLabel}`;
|
|
4026
4262
|
}
|
|
4027
4263
|
return interp(copy.pix.ctaTemplate, { price: priceLabel, days: trialDaysCardLabel });
|
|
4028
4264
|
}, [
|
|
@@ -4060,10 +4296,10 @@ function Paywall({
|
|
|
4060
4296
|
await s.submit();
|
|
4061
4297
|
};
|
|
4062
4298
|
const ctaTheme = s.selectedMethod === "card" ? themeClasses.ctaCard : themeClasses.ctaPix;
|
|
4063
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ jsxs22("div", { className: themeClasses.container, children: [
|
|
4064
4300
|
slots.heroSlot,
|
|
4065
4301
|
/* @__PURE__ */ jsx36("h1", { className: themeClasses.headline, children: copy.headline }),
|
|
4066
|
-
/* @__PURE__ */ jsx36("ul", { children: copy.features.map((f) => /* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx36("ul", { children: copy.features.map((f) => /* @__PURE__ */ jsxs22("li", { className: themeClasses.feature, children: [
|
|
4067
4303
|
"\u2713 ",
|
|
4068
4304
|
/* @__PURE__ */ jsx36("span", { children: f })
|
|
4069
4305
|
] }, f)) }),
|
|
@@ -4071,21 +4307,6 @@ function Paywall({
|
|
|
4071
4307
|
slots.cyclePickerSlot ?? /* @__PURE__ */ jsx36(
|
|
4072
4308
|
PaywallCyclePicker,
|
|
4073
4309
|
{
|
|
4074
|
-
cycles: ["MONTHLY", "YEARLY"],
|
|
4075
|
-
selected: s.cycle,
|
|
4076
|
-
onSelect: s.selectCycle,
|
|
4077
|
-
priceCentsByCycle: {
|
|
4078
|
-
MONTHLY: priceCentsForCycle(s, "MONTHLY"),
|
|
4079
|
-
YEARLY: priceCentsForCycle(s, "YEARLY")
|
|
4080
|
-
},
|
|
4081
|
-
anchorCentsByCycle: {
|
|
4082
|
-
MONTHLY: anchorForCycle(s, "MONTHLY"),
|
|
4083
|
-
YEARLY: anchorForCycle(s, "YEARLY")
|
|
4084
|
-
},
|
|
4085
|
-
monthlyEquivByCycle: {
|
|
4086
|
-
MONTHLY: priceCentsForCycle(s, "MONTHLY"),
|
|
4087
|
-
YEARLY: Math.round(priceCentsForCycle(s, "YEARLY") / 12)
|
|
4088
|
-
},
|
|
4089
4310
|
labels: copy.cycle,
|
|
4090
4311
|
cardClassName: themeClasses.cycleCard,
|
|
4091
4312
|
cardSelectedClassName: themeClasses.cycleCardSelected,
|
|
@@ -4095,9 +4316,6 @@ function Paywall({
|
|
|
4095
4316
|
/* @__PURE__ */ jsx36(
|
|
4096
4317
|
PaywallMethodTabs,
|
|
4097
4318
|
{
|
|
4098
|
-
methods: s.methods,
|
|
4099
|
-
selected: s.selectedMethod,
|
|
4100
|
-
onSelect: s.selectMethod,
|
|
4101
4319
|
labels: { "pix-auto": copy.pix.tabLabel, card: copy.card.tabLabel },
|
|
4102
4320
|
className: themeClasses.tabs,
|
|
4103
4321
|
tabClassName: themeClasses.tab,
|
|
@@ -4107,7 +4325,6 @@ function Paywall({
|
|
|
4107
4325
|
/* @__PURE__ */ jsx36(
|
|
4108
4326
|
PaywallMethodContent,
|
|
4109
4327
|
{
|
|
4110
|
-
method: s.selectedMethod,
|
|
4111
4328
|
copy: {
|
|
4112
4329
|
pix: interpolateCopy(copy.pix, priceLabel, trialDaysCardLabel),
|
|
4113
4330
|
card: interpolateCopy(copy.card, priceLabel, trialDaysCardLabel),
|
|
@@ -4118,27 +4335,27 @@ function Paywall({
|
|
|
4118
4335
|
ctaTemplate: copy.cardConsumedTrial.ctaTemplate
|
|
4119
4336
|
} : void 0
|
|
4120
4337
|
},
|
|
4121
|
-
hasConsumedTrial: s.hasConsumedTrial,
|
|
4122
4338
|
className: themeClasses.tabContent,
|
|
4123
4339
|
rowClassName: themeClasses.tabContentRow
|
|
4124
4340
|
}
|
|
4125
4341
|
),
|
|
4126
4342
|
slots.beforeCtaSlot,
|
|
4127
|
-
/* @__PURE__ */
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
}
|
|
4141
|
-
|
|
4343
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
4344
|
+
/* @__PURE__ */ jsx36(
|
|
4345
|
+
"button",
|
|
4346
|
+
{
|
|
4347
|
+
type: "button",
|
|
4348
|
+
onClick: () => {
|
|
4349
|
+
void handleCta();
|
|
4350
|
+
},
|
|
4351
|
+
disabled: s.submitting,
|
|
4352
|
+
className: ctaTheme,
|
|
4353
|
+
children: s.submitting ? "Abrindo checkout\u2026" : ctaLabel
|
|
4354
|
+
}
|
|
4355
|
+
),
|
|
4356
|
+
switchHint ? /* @__PURE__ */ jsx36("p", { className: themeClasses.switchHint, children: switchHint }) : null,
|
|
4357
|
+
/* @__PURE__ */ jsx36("p", { className: themeClasses.trustLine, children: copy.trustLine })
|
|
4358
|
+
] })
|
|
4142
4359
|
] });
|
|
4143
4360
|
}
|
|
4144
4361
|
function interp(tpl, vars) {
|
|
@@ -4152,13 +4369,438 @@ function interpolateCopy(m, price, days) {
|
|
|
4152
4369
|
switchHint: m.switchHint
|
|
4153
4370
|
};
|
|
4154
4371
|
}
|
|
4155
|
-
|
|
4156
|
-
|
|
4372
|
+
|
|
4373
|
+
// src/components/paywall/PaywallCta.tsx
|
|
4374
|
+
import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4375
|
+
function PaywallCta({
|
|
4376
|
+
ctaLabel,
|
|
4377
|
+
loadingLabel,
|
|
4378
|
+
switchHint,
|
|
4379
|
+
trustLine,
|
|
4380
|
+
className,
|
|
4381
|
+
buttonClassName,
|
|
4382
|
+
switchHintClassName,
|
|
4383
|
+
trustClassName
|
|
4384
|
+
}) {
|
|
4385
|
+
const { submit, submitting } = usePaywallContext();
|
|
4386
|
+
const label = submitting && loadingLabel ? loadingLabel : ctaLabel;
|
|
4387
|
+
return /* @__PURE__ */ jsxs23("div", { className, children: [
|
|
4388
|
+
/* @__PURE__ */ jsx37(
|
|
4389
|
+
"button",
|
|
4390
|
+
{
|
|
4391
|
+
type: "button",
|
|
4392
|
+
onClick: () => {
|
|
4393
|
+
void submit();
|
|
4394
|
+
},
|
|
4395
|
+
disabled: submitting,
|
|
4396
|
+
className: buttonClassName,
|
|
4397
|
+
children: label
|
|
4398
|
+
}
|
|
4399
|
+
),
|
|
4400
|
+
switchHint ? /* @__PURE__ */ jsx37("p", { className: switchHintClassName, children: switchHint }) : null,
|
|
4401
|
+
/* @__PURE__ */ jsx37("p", { className: trustClassName, children: trustLine })
|
|
4402
|
+
] });
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
// src/components/paywall/blocks/PaywallEyebrow.tsx
|
|
4406
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
4407
|
+
var DEFAULT_EYEBROW_CLASSES = "text-xs uppercase tracking-widest font-semibold opacity-70";
|
|
4408
|
+
function PaywallEyebrow({ text, className }) {
|
|
4409
|
+
return /* @__PURE__ */ jsx38("div", { className: [DEFAULT_EYEBROW_CLASSES, className].filter(Boolean).join(" "), children: text });
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
// src/components/paywall/blocks/PaywallHero.tsx
|
|
4413
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4414
|
+
var DEFAULT_GRADIENT = "absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent";
|
|
4415
|
+
function PaywallHero({
|
|
4416
|
+
src,
|
|
4417
|
+
alt = "",
|
|
4418
|
+
headline,
|
|
4419
|
+
aspectRatio = "16/9",
|
|
4420
|
+
gradientClassName,
|
|
4421
|
+
className,
|
|
4422
|
+
headlineClassName,
|
|
4423
|
+
imgClassName,
|
|
4424
|
+
render
|
|
4425
|
+
}) {
|
|
4426
|
+
if (render) {
|
|
4427
|
+
return /* @__PURE__ */ jsx39("div", { className, children: render({ src, headline }) });
|
|
4428
|
+
}
|
|
4429
|
+
return /* @__PURE__ */ jsxs24(
|
|
4430
|
+
"div",
|
|
4431
|
+
{
|
|
4432
|
+
className: ["relative overflow-hidden", className].filter(Boolean).join(" "),
|
|
4433
|
+
style: { aspectRatio },
|
|
4434
|
+
children: [
|
|
4435
|
+
/* @__PURE__ */ jsx39(
|
|
4436
|
+
"img",
|
|
4437
|
+
{
|
|
4438
|
+
src,
|
|
4439
|
+
alt,
|
|
4440
|
+
className: ["absolute inset-0 w-full h-full object-cover", imgClassName].filter(Boolean).join(" ")
|
|
4441
|
+
}
|
|
4442
|
+
),
|
|
4443
|
+
/* @__PURE__ */ jsx39("div", { className: gradientClassName ?? DEFAULT_GRADIENT, "aria-hidden": "true" }),
|
|
4444
|
+
headline ? /* @__PURE__ */ jsx39(
|
|
4445
|
+
"h1",
|
|
4446
|
+
{
|
|
4447
|
+
className: ["absolute bottom-0 left-0 right-0 p-4 text-white font-bold text-2xl", headlineClassName].filter(Boolean).join(" "),
|
|
4448
|
+
children: headline
|
|
4449
|
+
}
|
|
4450
|
+
) : null
|
|
4451
|
+
]
|
|
4452
|
+
}
|
|
4453
|
+
);
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4456
|
+
// src/components/paywall/blocks/PaywallHeadline.tsx
|
|
4457
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4458
|
+
var DEFAULT_HEADLINE_CLASSES = "text-2xl font-bold leading-tight";
|
|
4459
|
+
function PaywallHeadline({ text, className, as = "h1" }) {
|
|
4460
|
+
const Tag = as;
|
|
4461
|
+
return /* @__PURE__ */ jsx40(Tag, { className: [DEFAULT_HEADLINE_CLASSES, className].filter(Boolean).join(" "), children: text });
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
// src/components/paywall/blocks/PaywallPriceHeadline.tsx
|
|
4465
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
4466
|
+
var DEFAULT_CLASS = "text-2xl font-bold leading-tight";
|
|
4467
|
+
var CYCLE_LABEL = {
|
|
4468
|
+
MONTHLY: "mensal",
|
|
4469
|
+
YEARLY: "anual"
|
|
4470
|
+
};
|
|
4471
|
+
function PaywallPriceHeadline({
|
|
4472
|
+
template,
|
|
4473
|
+
className,
|
|
4474
|
+
as = "h1",
|
|
4475
|
+
render
|
|
4476
|
+
}) {
|
|
4477
|
+
const { cycle, currentMonthlyEquivCents, plan } = usePaywallContext();
|
|
4478
|
+
const yearlyCents = plan?.yearlyCents ?? null;
|
|
4479
|
+
const pricePerDay = formatBRL(dailyFromYearly(yearlyCents));
|
|
4480
|
+
const monthlyEquiv = currentMonthlyEquivCents ?? 0;
|
|
4481
|
+
const cycleLabel = CYCLE_LABEL[cycle] ?? cycle.toLowerCase();
|
|
4482
|
+
const rootClasses = [DEFAULT_CLASS, className].filter(Boolean).join(" ");
|
|
4483
|
+
if (render) {
|
|
4484
|
+
const RootTag2 = as;
|
|
4485
|
+
return /* @__PURE__ */ jsx41(RootTag2, { className: [className].filter(Boolean).join(" ") || void 0, children: render({ pricePerDay, currentMonthlyEquivCents: monthlyEquiv, cycle }) });
|
|
4486
|
+
}
|
|
4487
|
+
const text = template.replaceAll("{pricePerDay}", pricePerDay).replaceAll("{currentMonthlyEquiv}", formatBRL(monthlyEquiv)).replaceAll("{cycle}", cycleLabel);
|
|
4488
|
+
const RootTag = as;
|
|
4489
|
+
return /* @__PURE__ */ jsx41(RootTag, { className: rootClasses, children: text });
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
// src/components/paywall/blocks/PaywallCountdown.tsx
|
|
4493
|
+
import { useEffect as useEffect18, useRef as useRef8, useState as useState17 } from "react";
|
|
4494
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
4495
|
+
var DEFAULT_COUNTDOWN_CLASSES = "font-mono tabular-nums";
|
|
4496
|
+
function resolveDeadlineMs(deadline) {
|
|
4497
|
+
if (deadline instanceof Date) return deadline.getTime();
|
|
4498
|
+
if (typeof deadline === "string") return new Date(deadline).getTime();
|
|
4499
|
+
const { sessionStorageKey, durationMs } = deadline;
|
|
4500
|
+
if (typeof window === "undefined" || typeof window.sessionStorage === "undefined") {
|
|
4501
|
+
return Date.now() + durationMs;
|
|
4502
|
+
}
|
|
4503
|
+
const stored = window.sessionStorage.getItem(sessionStorageKey);
|
|
4504
|
+
const parsed = stored ? Number.parseInt(stored, 10) : NaN;
|
|
4505
|
+
const now = Date.now();
|
|
4506
|
+
if (!Number.isFinite(parsed) || parsed < now) {
|
|
4507
|
+
const target = now + durationMs;
|
|
4508
|
+
window.sessionStorage.setItem(sessionStorageKey, String(target));
|
|
4509
|
+
return target;
|
|
4510
|
+
}
|
|
4511
|
+
return parsed;
|
|
4512
|
+
}
|
|
4513
|
+
function computeRemaining(deadlineMs) {
|
|
4514
|
+
const diff = Math.max(0, deadlineMs - Date.now());
|
|
4515
|
+
const totalSeconds = Math.floor(diff / 1e3);
|
|
4516
|
+
const h = Math.floor(totalSeconds / 3600);
|
|
4517
|
+
const m = Math.floor(totalSeconds % 3600 / 60);
|
|
4518
|
+
const s = totalSeconds % 60;
|
|
4519
|
+
return { h, m, s, expired: diff === 0 };
|
|
4520
|
+
}
|
|
4521
|
+
function pad(n) {
|
|
4522
|
+
return String(n).padStart(2, "0");
|
|
4523
|
+
}
|
|
4524
|
+
function PaywallCountdown({
|
|
4525
|
+
deadline,
|
|
4526
|
+
format = "h:m:s",
|
|
4527
|
+
onExpire,
|
|
4528
|
+
className,
|
|
4529
|
+
render
|
|
4530
|
+
}) {
|
|
4531
|
+
const deadlineMsRef = useRef8(null);
|
|
4532
|
+
if (deadlineMsRef.current === null) {
|
|
4533
|
+
deadlineMsRef.current = resolveDeadlineMs(deadline);
|
|
4534
|
+
}
|
|
4535
|
+
const [state, setState] = useState17(() => computeRemaining(deadlineMsRef.current));
|
|
4536
|
+
const expiredCalledRef = useRef8(false);
|
|
4537
|
+
useEffect18(() => {
|
|
4538
|
+
if (state.expired) {
|
|
4539
|
+
if (!expiredCalledRef.current) {
|
|
4540
|
+
expiredCalledRef.current = true;
|
|
4541
|
+
onExpire?.();
|
|
4542
|
+
}
|
|
4543
|
+
return;
|
|
4544
|
+
}
|
|
4545
|
+
const tick = () => {
|
|
4546
|
+
const next = computeRemaining(deadlineMsRef.current);
|
|
4547
|
+
setState(next);
|
|
4548
|
+
if (next.expired && !expiredCalledRef.current) {
|
|
4549
|
+
expiredCalledRef.current = true;
|
|
4550
|
+
onExpire?.();
|
|
4551
|
+
}
|
|
4552
|
+
};
|
|
4553
|
+
const id = setInterval(tick, 1e3);
|
|
4554
|
+
return () => clearInterval(id);
|
|
4555
|
+
}, [state.expired]);
|
|
4556
|
+
if (render) {
|
|
4557
|
+
return /* @__PURE__ */ jsx42("div", { className, children: render(state) });
|
|
4558
|
+
}
|
|
4559
|
+
const formatted = format === "h:m:s" ? `${pad(state.h)}:${pad(state.m)}:${pad(state.s)}` : `${pad(state.h * 60 + state.m)}:${pad(state.s)}`;
|
|
4560
|
+
return /* @__PURE__ */ jsx42("div", { className: [DEFAULT_COUNTDOWN_CLASSES, className].filter(Boolean).join(" "), children: formatted });
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
// src/components/paywall/blocks/PaywallFeatures.tsx
|
|
4564
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4565
|
+
function PaywallFeatures({
|
|
4566
|
+
items,
|
|
4567
|
+
IconComponent,
|
|
4568
|
+
className,
|
|
4569
|
+
itemClassName,
|
|
4570
|
+
iconClassName,
|
|
4571
|
+
render,
|
|
4572
|
+
renderItem
|
|
4573
|
+
}) {
|
|
4574
|
+
if (render) {
|
|
4575
|
+
return /* @__PURE__ */ jsx43("div", { className, children: render({ items }) });
|
|
4576
|
+
}
|
|
4577
|
+
if (renderItem) {
|
|
4578
|
+
return /* @__PURE__ */ jsx43("ul", { className, children: items.map((item, idx) => /* @__PURE__ */ jsx43("li", { children: renderItem(item, idx) }, idx)) });
|
|
4579
|
+
}
|
|
4580
|
+
return /* @__PURE__ */ jsx43("ul", { className, children: items.map((item, idx) => /* @__PURE__ */ jsxs25("li", { className: itemClassName, children: [
|
|
4581
|
+
IconComponent ? /* @__PURE__ */ jsx43(IconComponent, { className: iconClassName }) : /* @__PURE__ */ jsx43("span", { className: iconClassName, "aria-hidden": "true", children: "\u2713" }),
|
|
4582
|
+
/* @__PURE__ */ jsx43("span", { children: item })
|
|
4583
|
+
] }, idx)) });
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
// src/components/paywall/blocks/PaywallFeaturesCard.tsx
|
|
4587
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4588
|
+
var DEFAULT_CARD_CLASSES = "rounded-xl border p-4";
|
|
4589
|
+
function PaywallFeaturesCard({
|
|
4590
|
+
title,
|
|
4591
|
+
items,
|
|
4592
|
+
className,
|
|
4593
|
+
cardClassName,
|
|
4594
|
+
titleClassName,
|
|
4595
|
+
itemClassName,
|
|
4596
|
+
renderItem
|
|
4597
|
+
}) {
|
|
4598
|
+
return /* @__PURE__ */ jsx44("div", { className, children: /* @__PURE__ */ jsxs26("div", { className: [DEFAULT_CARD_CLASSES, cardClassName].filter(Boolean).join(" "), children: [
|
|
4599
|
+
title ? /* @__PURE__ */ jsx44("div", { className: ["font-semibold mb-2", titleClassName].filter(Boolean).join(" "), children: title }) : null,
|
|
4600
|
+
/* @__PURE__ */ jsx44("ul", { children: items.map(
|
|
4601
|
+
(item, idx) => renderItem ? /* @__PURE__ */ jsx44("li", { children: renderItem(item, idx) }, idx) : /* @__PURE__ */ jsxs26("li", { className: itemClassName, children: [
|
|
4602
|
+
/* @__PURE__ */ jsx44("span", { "aria-hidden": "true", children: "\u2022" }),
|
|
4603
|
+
" ",
|
|
4604
|
+
/* @__PURE__ */ jsx44("span", { children: item })
|
|
4605
|
+
] }, idx)
|
|
4606
|
+
) })
|
|
4607
|
+
] }) });
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4610
|
+
// src/components/paywall/blocks/PaywallTrophyBadge.tsx
|
|
4611
|
+
import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4612
|
+
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";
|
|
4613
|
+
var FLOATING_CLASSES = "absolute top-2 right-2 z-10 shadow-md";
|
|
4614
|
+
function PaywallTrophyBadge({
|
|
4615
|
+
text,
|
|
4616
|
+
className,
|
|
4617
|
+
iconClassName,
|
|
4618
|
+
floating = false,
|
|
4619
|
+
render
|
|
4620
|
+
}) {
|
|
4621
|
+
if (render) {
|
|
4622
|
+
return /* @__PURE__ */ jsx45("div", { className, children: render({ text }) });
|
|
4623
|
+
}
|
|
4624
|
+
const rootClasses = [
|
|
4625
|
+
DEFAULT_CHIP_CLASSES,
|
|
4626
|
+
floating ? FLOATING_CLASSES : "",
|
|
4627
|
+
className
|
|
4628
|
+
].filter(Boolean).join(" ");
|
|
4629
|
+
return /* @__PURE__ */ jsxs27("div", { className: rootClasses, children: [
|
|
4630
|
+
/* @__PURE__ */ jsx45("span", { className: iconClassName, "aria-hidden": "true", children: "\u{1F3C6}" }),
|
|
4631
|
+
/* @__PURE__ */ jsx45("span", { children: text })
|
|
4632
|
+
] });
|
|
4157
4633
|
}
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4634
|
+
|
|
4635
|
+
// src/components/paywall/blocks/PaywallAnchorPrice.tsx
|
|
4636
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
4637
|
+
var DEFAULT_CLASS2 = "text-sm opacity-60 line-through";
|
|
4638
|
+
function PaywallAnchorPrice({
|
|
4639
|
+
className,
|
|
4640
|
+
render
|
|
4641
|
+
}) {
|
|
4642
|
+
const { anchorPriceCents, cycle } = usePaywallContext();
|
|
4643
|
+
if (anchorPriceCents === null || anchorPriceCents === void 0 || anchorPriceCents <= 0) {
|
|
4644
|
+
return null;
|
|
4645
|
+
}
|
|
4646
|
+
void cycle;
|
|
4647
|
+
const formatted = formatBRL(anchorPriceCents);
|
|
4648
|
+
const rootClasses = [DEFAULT_CLASS2, className].filter(Boolean).join(" ");
|
|
4649
|
+
if (render) {
|
|
4650
|
+
return /* @__PURE__ */ jsx46("span", { className: className || void 0, children: render({ anchorCents: anchorPriceCents, formatted }) });
|
|
4651
|
+
}
|
|
4652
|
+
return /* @__PURE__ */ jsx46("span", { className: rootClasses, children: formatted });
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
// src/components/paywall/blocks/PaywallTestimonials.tsx
|
|
4656
|
+
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4657
|
+
var DEFAULT_ROOT = "flex gap-3 overflow-x-auto snap-x snap-mandatory pb-2";
|
|
4658
|
+
var DEFAULT_CARD = "snap-start shrink-0 w-72 rounded-2xl border p-4 flex flex-col gap-2";
|
|
4659
|
+
var DEFAULT_AVATAR = "w-10 h-10 rounded-full object-cover";
|
|
4660
|
+
var DEFAULT_QUOTE = "text-sm leading-snug";
|
|
4661
|
+
var DEFAULT_NAME = "text-xs font-semibold opacity-80";
|
|
4662
|
+
var DEFAULT_STARS = "text-yellow-500 text-sm";
|
|
4663
|
+
function clampStars(n) {
|
|
4664
|
+
return Math.max(0, Math.min(5, Math.round(n)));
|
|
4665
|
+
}
|
|
4666
|
+
function PaywallTestimonials({
|
|
4667
|
+
items,
|
|
4668
|
+
className,
|
|
4669
|
+
cardClassName,
|
|
4670
|
+
avatarClassName,
|
|
4671
|
+
quoteClassName,
|
|
4672
|
+
nameClassName,
|
|
4673
|
+
starsClassName,
|
|
4674
|
+
renderItem
|
|
4675
|
+
}) {
|
|
4676
|
+
const rootClasses = [DEFAULT_ROOT, className].filter(Boolean).join(" ");
|
|
4677
|
+
const cardClasses = [DEFAULT_CARD, cardClassName].filter(Boolean).join(" ");
|
|
4678
|
+
const avatarClasses = [DEFAULT_AVATAR, avatarClassName].filter(Boolean).join(" ");
|
|
4679
|
+
const quoteClasses = [DEFAULT_QUOTE, quoteClassName].filter(Boolean).join(" ");
|
|
4680
|
+
const nameClasses = [DEFAULT_NAME, nameClassName].filter(Boolean).join(" ");
|
|
4681
|
+
const starsClasses = [DEFAULT_STARS, starsClassName].filter(Boolean).join(" ");
|
|
4682
|
+
return /* @__PURE__ */ jsx47("div", { className: rootClasses, children: items.map((item, idx) => {
|
|
4683
|
+
if (renderItem) return renderItem(item, idx);
|
|
4684
|
+
const filled = clampStars(item.stars);
|
|
4685
|
+
const empty = 5 - filled;
|
|
4686
|
+
return /* @__PURE__ */ jsxs28("div", { className: cardClasses, children: [
|
|
4687
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
4688
|
+
item.avatar ? /* @__PURE__ */ jsx47(
|
|
4689
|
+
"img",
|
|
4690
|
+
{
|
|
4691
|
+
src: item.avatar,
|
|
4692
|
+
alt: "",
|
|
4693
|
+
loading: "lazy",
|
|
4694
|
+
className: avatarClasses,
|
|
4695
|
+
"aria-hidden": "true"
|
|
4696
|
+
}
|
|
4697
|
+
) : null,
|
|
4698
|
+
/* @__PURE__ */ jsx47("div", { className: nameClasses, children: item.name })
|
|
4699
|
+
] }),
|
|
4700
|
+
/* @__PURE__ */ jsxs28("div", { className: starsClasses, "aria-label": `${filled} de 5 estrelas`, children: [
|
|
4701
|
+
"\u2605".repeat(filled),
|
|
4702
|
+
"\u2606".repeat(empty)
|
|
4703
|
+
] }),
|
|
4704
|
+
/* @__PURE__ */ jsx47("p", { className: quoteClasses, children: item.quote })
|
|
4705
|
+
] }, idx);
|
|
4706
|
+
}) });
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
// src/components/paywall/blocks/PaywallStatsRow.tsx
|
|
4710
|
+
import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4711
|
+
var DEFAULT_ROOT2 = "grid grid-cols-3 gap-4";
|
|
4712
|
+
var DEFAULT_CELL = "flex flex-col items-center text-center";
|
|
4713
|
+
var DEFAULT_VALUE = "text-2xl font-bold";
|
|
4714
|
+
var DEFAULT_LABEL = "text-xs opacity-70";
|
|
4715
|
+
function PaywallStatsRow({
|
|
4716
|
+
stats,
|
|
4717
|
+
className,
|
|
4718
|
+
cellClassName,
|
|
4719
|
+
valueClassName,
|
|
4720
|
+
labelClassName,
|
|
4721
|
+
renderCell
|
|
4722
|
+
}) {
|
|
4723
|
+
const rootClasses = [DEFAULT_ROOT2, className].filter(Boolean).join(" ");
|
|
4724
|
+
const cellClasses = [DEFAULT_CELL, cellClassName].filter(Boolean).join(" ");
|
|
4725
|
+
const valueClasses = [DEFAULT_VALUE, valueClassName].filter(Boolean).join(" ");
|
|
4726
|
+
const labelClasses = [DEFAULT_LABEL, labelClassName].filter(Boolean).join(" ");
|
|
4727
|
+
return /* @__PURE__ */ jsx48("div", { className: rootClasses, children: stats.map((stat, idx) => {
|
|
4728
|
+
if (renderCell) return renderCell(stat, idx);
|
|
4729
|
+
return /* @__PURE__ */ jsxs29("div", { className: cellClasses, children: [
|
|
4730
|
+
stat.icon ? /* @__PURE__ */ jsx48("div", { "aria-hidden": "true", children: stat.icon }) : null,
|
|
4731
|
+
/* @__PURE__ */ jsx48("div", { className: valueClasses, children: stat.value }),
|
|
4732
|
+
/* @__PURE__ */ jsx48("div", { className: labelClasses, children: stat.label })
|
|
4733
|
+
] }, idx);
|
|
4734
|
+
}) });
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
// src/components/paywall/blocks/PaywallFinePrint.tsx
|
|
4738
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
4739
|
+
var DEFAULT_CLASS3 = "text-xs opacity-60 leading-snug";
|
|
4740
|
+
var CYCLE_LABEL2 = {
|
|
4741
|
+
MONTHLY: "mensal",
|
|
4742
|
+
YEARLY: "anual"
|
|
4743
|
+
};
|
|
4744
|
+
function PaywallFinePrint({
|
|
4745
|
+
template,
|
|
4746
|
+
className,
|
|
4747
|
+
render
|
|
4748
|
+
}) {
|
|
4749
|
+
const {
|
|
4750
|
+
currentPriceCents,
|
|
4751
|
+
cycle,
|
|
4752
|
+
trialDaysCard,
|
|
4753
|
+
trialDaysPix,
|
|
4754
|
+
selectedMethod
|
|
4755
|
+
} = usePaywallContext();
|
|
4756
|
+
const trialDays = selectedMethod === "card" ? trialDaysCard : trialDaysPix;
|
|
4757
|
+
const cycleLabel = CYCLE_LABEL2[cycle] ?? cycle.toLowerCase();
|
|
4758
|
+
const priceFormatted = formatBRL(currentPriceCents ?? 0);
|
|
4759
|
+
const rootClasses = [DEFAULT_CLASS3, className].filter(Boolean).join(" ");
|
|
4760
|
+
if (render) {
|
|
4761
|
+
return /* @__PURE__ */ jsx49("p", { className: className || void 0, children: render({
|
|
4762
|
+
currentPriceCents: currentPriceCents ?? 0,
|
|
4763
|
+
cycle,
|
|
4764
|
+
trialDays: trialDays ?? 0,
|
|
4765
|
+
selectedMethod
|
|
4766
|
+
}) });
|
|
4767
|
+
}
|
|
4768
|
+
const text = template.replaceAll("{price}", priceFormatted).replaceAll("{trialDays}", String(trialDays ?? 0)).replaceAll("{cycle}", cycleLabel);
|
|
4769
|
+
return /* @__PURE__ */ jsx49("p", { className: rootClasses, children: text });
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
// src/components/paywall/blocks/PaywallTrustLine.tsx
|
|
4773
|
+
import { jsx as jsx50, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4774
|
+
var DEFAULT_ROOT3 = "flex items-center gap-3";
|
|
4775
|
+
var DEFAULT_ITEM = "flex items-center gap-1.5 text-xs";
|
|
4776
|
+
function PaywallTrustLine({
|
|
4777
|
+
items,
|
|
4778
|
+
className,
|
|
4779
|
+
itemClassName,
|
|
4780
|
+
renderItem
|
|
4781
|
+
}) {
|
|
4782
|
+
const rootClasses = [DEFAULT_ROOT3, className].filter(Boolean).join(" ");
|
|
4783
|
+
const itemClasses = [DEFAULT_ITEM, itemClassName].filter(Boolean).join(" ");
|
|
4784
|
+
return /* @__PURE__ */ jsx50("div", { className: rootClasses, children: items.map((item, idx) => {
|
|
4785
|
+
if (renderItem) return renderItem(item, idx);
|
|
4786
|
+
return /* @__PURE__ */ jsxs30("span", { className: itemClasses, children: [
|
|
4787
|
+
/* @__PURE__ */ jsx50("span", { "aria-hidden": "true", children: item.icon }),
|
|
4788
|
+
/* @__PURE__ */ jsx50("span", { children: item.text })
|
|
4789
|
+
] }, idx);
|
|
4790
|
+
}) });
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
// src/components/paywall/blocks/PaywallStickyFooter.tsx
|
|
4794
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
4795
|
+
var DEFAULT_CLASSES = "sticky bottom-0 left-0 right-0 bg-background";
|
|
4796
|
+
var SAFE_AREA_CLASS = "pb-[env(safe-area-inset-bottom)]";
|
|
4797
|
+
function PaywallStickyFooter({
|
|
4798
|
+
children,
|
|
4799
|
+
className,
|
|
4800
|
+
safeAreaInsets = true
|
|
4801
|
+
}) {
|
|
4802
|
+
const classes = [DEFAULT_CLASSES, safeAreaInsets ? SAFE_AREA_CLASS : null, className].filter(Boolean).join(" ");
|
|
4803
|
+
return /* @__PURE__ */ jsx51("div", { className: classes, children });
|
|
4162
4804
|
}
|
|
4163
4805
|
export {
|
|
4164
4806
|
AppConfigProvider,
|
|
@@ -4177,10 +4819,26 @@ export {
|
|
|
4177
4819
|
OnboardingFlow,
|
|
4178
4820
|
PaymentReturnHandler,
|
|
4179
4821
|
Paywall,
|
|
4822
|
+
PaywallAnchorPrice,
|
|
4823
|
+
PaywallContext,
|
|
4824
|
+
PaywallCountdown,
|
|
4180
4825
|
PaywallCta,
|
|
4181
4826
|
PaywallCyclePicker,
|
|
4827
|
+
PaywallEyebrow,
|
|
4828
|
+
PaywallFeatures,
|
|
4829
|
+
PaywallFeaturesCard,
|
|
4830
|
+
PaywallFinePrint,
|
|
4831
|
+
PaywallHeadline,
|
|
4832
|
+
PaywallHero,
|
|
4182
4833
|
PaywallMethodContent,
|
|
4183
4834
|
PaywallMethodTabs,
|
|
4835
|
+
PaywallPriceHeadline,
|
|
4836
|
+
PaywallProvider,
|
|
4837
|
+
PaywallStatsRow,
|
|
4838
|
+
PaywallStickyFooter,
|
|
4839
|
+
PaywallTestimonials,
|
|
4840
|
+
PaywallTrophyBadge,
|
|
4841
|
+
PaywallTrustLine,
|
|
4184
4842
|
PersistenceRegistry,
|
|
4185
4843
|
PixWaitingPageDefault,
|
|
4186
4844
|
PreAuthShell,
|
|
@@ -4211,6 +4869,7 @@ export {
|
|
|
4211
4869
|
useInstallPrompt,
|
|
4212
4870
|
useLoginForm,
|
|
4213
4871
|
useOnboardingStep,
|
|
4872
|
+
usePaywallContext,
|
|
4214
4873
|
usePaywallState,
|
|
4215
4874
|
usePlan,
|
|
4216
4875
|
usePush,
|