@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.js CHANGED
@@ -299,7 +299,7 @@ function usePaywallState() {
299
299
  const defaultMethod = (configDefault && methods.includes(configDefault) ? configDefault : null) ?? methods[0] ?? declaredMethods[0] ?? "card";
300
300
  const [selectedMethodRaw, setSelectedMethod] = useState(defaultMethod);
301
301
  const selectedMethod = methods.includes(selectedMethodRaw) ? selectedMethodRaw : methods[0] ?? selectedMethodRaw;
302
- const initialCycle = isFree ? "MONTHLY" : paywall.cycles[0] ?? "MONTHLY";
302
+ const initialCycle = isFree ? "MONTHLY" : paywall.cycles.includes("YEARLY") ? "YEARLY" : paywall.cycles[0] ?? "MONTHLY";
303
303
  const [cycle, setCycle] = useState(initialCycle);
304
304
  const cpfRequired = !isFree && paywall.requiresCpf;
305
305
  const [cpf, setCpf] = useState("");
@@ -3351,30 +3351,38 @@ function PaywallCyclePicker({
3351
3351
  anchorClassName
3352
3352
  }) {
3353
3353
  if (cycles.length < 2) return null;
3354
- return /* @__PURE__ */ jsx32("div", { role: "radiogroup", "aria-label": "Ciclo de cobran\xE7a", className, children: cycles.map((c) => {
3355
- const active = c === selected;
3356
- const label = c === "YEARLY" ? labels.annualLabel : labels.monthlyLabel;
3357
- const suffix = c === "YEARLY" ? labels.annualSuffix : labels.monthlySuffix;
3358
- const mainCents = c === "YEARLY" ? monthlyEquivByCycle[c] : priceCentsByCycle[c];
3359
- const anchorCents = anchorCentsByCycle[c];
3360
- return /* @__PURE__ */ jsxs19(
3361
- "button",
3362
- {
3363
- type: "button",
3364
- role: "radio",
3365
- "aria-checked": active,
3366
- onClick: () => onSelect(c),
3367
- className: [cardClassName, active ? cardSelectedClassName : ""].filter(Boolean).join(" "),
3368
- children: [
3369
- /* @__PURE__ */ jsx32("strong", { children: formatBRL(mainCents) }),
3370
- /* @__PURE__ */ jsx32("span", { children: suffix }),
3371
- /* @__PURE__ */ jsx32("span", { children: label }),
3372
- anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */ jsx32("span", { className: anchorClassName, children: /* @__PURE__ */ jsx32("s", { children: formatBRL(anchorCents) }) }) : null
3373
- ]
3374
- },
3375
- c
3376
- );
3377
- }) });
3354
+ return /* @__PURE__ */ jsx32(
3355
+ "div",
3356
+ {
3357
+ role: "radiogroup",
3358
+ "aria-label": "Ciclo de cobran\xE7a",
3359
+ className: ["flex flex-row gap-2", className].filter(Boolean).join(" "),
3360
+ children: cycles.map((c) => {
3361
+ const active = c === selected;
3362
+ const label = c === "YEARLY" ? labels.annualLabel : labels.monthlyLabel;
3363
+ const suffix = c === "YEARLY" ? labels.annualSuffix : labels.monthlySuffix;
3364
+ const mainCents = c === "YEARLY" ? monthlyEquivByCycle[c] : priceCentsByCycle[c];
3365
+ const anchorCents = anchorCentsByCycle[c];
3366
+ return /* @__PURE__ */ jsxs19(
3367
+ "button",
3368
+ {
3369
+ type: "button",
3370
+ role: "radio",
3371
+ "aria-checked": active,
3372
+ onClick: () => onSelect(c),
3373
+ className: ["flex flex-col items-center gap-0.5", cardClassName, active ? cardSelectedClassName : ""].filter(Boolean).join(" "),
3374
+ children: [
3375
+ /* @__PURE__ */ jsx32("span", { className: "font-bold text-base leading-tight", children: formatBRL(mainCents) }),
3376
+ /* @__PURE__ */ jsx32("span", { className: "text-xs opacity-70 leading-tight", children: suffix }),
3377
+ /* @__PURE__ */ jsx32("span", { className: "text-xs opacity-60 leading-tight", children: label }),
3378
+ anchorCents != null && anchorCents > mainCents ? /* @__PURE__ */ jsx32("span", { className: anchorClassName ?? "text-xs opacity-50", children: /* @__PURE__ */ jsx32("s", { children: formatBRL(anchorCents) }) }) : null
3379
+ ]
3380
+ },
3381
+ c
3382
+ );
3383
+ })
3384
+ }
3385
+ );
3378
3386
  }
3379
3387
 
3380
3388
  // src/components/paywall/PaywallCta.tsx
@@ -3542,7 +3550,7 @@ function Paywall({
3542
3550
  switchHint,
3543
3551
  trustLine: copy.trustLine,
3544
3552
  onClick: handleCta,
3545
- disabled: !s.initialLoadComplete,
3553
+ disabled: s.submitting,
3546
3554
  loading: s.submitting,
3547
3555
  buttonClassName: ctaTheme,
3548
3556
  switchHintClassName: themeClasses.switchHint,