@hook-sdk/template 0.21.0 → 0.22.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 +34 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -390,7 +390,7 @@ function usePaywallState() {
|
|
|
390
390
|
const defaultMethod = (configDefault && methods.includes(configDefault) ? configDefault : null) ?? methods[0] ?? declaredMethods[0] ?? "card";
|
|
391
391
|
const [selectedMethodRaw, setSelectedMethod] = (0, import_react6.useState)(defaultMethod);
|
|
392
392
|
const selectedMethod = methods.includes(selectedMethodRaw) ? selectedMethodRaw : methods[0] ?? selectedMethodRaw;
|
|
393
|
-
const initialCycle = isFree ? "MONTHLY" : paywall.cycles[0] ?? "MONTHLY";
|
|
393
|
+
const initialCycle = isFree ? "MONTHLY" : paywall.cycles.includes("YEARLY") ? "YEARLY" : paywall.cycles[0] ?? "MONTHLY";
|
|
394
394
|
const [cycle, setCycle] = (0, import_react6.useState)(initialCycle);
|
|
395
395
|
const cpfRequired = !isFree && paywall.requiresCpf;
|
|
396
396
|
const [cpf, setCpf] = (0, import_react6.useState)("");
|
|
@@ -3443,30 +3443,38 @@ function PaywallCyclePicker({
|
|
|
3443
3443
|
anchorClassName
|
|
3444
3444
|
}) {
|
|
3445
3445
|
if (cycles.length < 2) return null;
|
|
3446
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3447
|
+
"div",
|
|
3448
|
+
{
|
|
3449
|
+
role: "radiogroup",
|
|
3450
|
+
"aria-label": "Ciclo de cobran\xE7a",
|
|
3451
|
+
className: ["flex flex-row gap-2", className].filter(Boolean).join(" "),
|
|
3452
|
+
children: cycles.map((c) => {
|
|
3453
|
+
const active = c === selected;
|
|
3454
|
+
const label = c === "YEARLY" ? labels.annualLabel : labels.monthlyLabel;
|
|
3455
|
+
const suffix = c === "YEARLY" ? labels.annualSuffix : labels.monthlySuffix;
|
|
3456
|
+
const mainCents = c === "YEARLY" ? monthlyEquivByCycle[c] : priceCentsByCycle[c];
|
|
3457
|
+
const anchorCents = anchorCentsByCycle[c];
|
|
3458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3459
|
+
"button",
|
|
3460
|
+
{
|
|
3461
|
+
type: "button",
|
|
3462
|
+
role: "radio",
|
|
3463
|
+
"aria-checked": active,
|
|
3464
|
+
onClick: () => onSelect(c),
|
|
3465
|
+
className: ["flex flex-col items-center gap-0.5", cardClassName, active ? cardSelectedClassName : ""].filter(Boolean).join(" "),
|
|
3466
|
+
children: [
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-bold text-base leading-tight", children: formatBRL(mainCents) }),
|
|
3468
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs opacity-70 leading-tight", children: suffix }),
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs opacity-60 leading-tight", children: label }),
|
|
3470
|
+
anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: anchorClassName ?? "text-xs opacity-50", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("s", { children: formatBRL(anchorCents) }) }) : null
|
|
3471
|
+
]
|
|
3472
|
+
},
|
|
3473
|
+
c
|
|
3474
|
+
);
|
|
3475
|
+
})
|
|
3476
|
+
}
|
|
3477
|
+
);
|
|
3470
3478
|
}
|
|
3471
3479
|
|
|
3472
3480
|
// src/components/paywall/PaywallCta.tsx
|
|
@@ -3634,7 +3642,7 @@ function Paywall({
|
|
|
3634
3642
|
switchHint,
|
|
3635
3643
|
trustLine: copy.trustLine,
|
|
3636
3644
|
onClick: handleCta,
|
|
3637
|
-
disabled:
|
|
3645
|
+
disabled: s.submitting,
|
|
3638
3646
|
loading: s.submitting,
|
|
3639
3647
|
buttonClassName: ctaTheme,
|
|
3640
3648
|
switchHintClassName: themeClasses.switchHint,
|