@olwiba/ui 0.2.8 → 0.2.10

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.d.ts CHANGED
@@ -770,8 +770,17 @@ interface PricingSectionProps {
770
770
  cadences?: PricingCadence[];
771
771
  /** Which cadence opens selected. Defaults to the first in `cadences`. */
772
772
  defaultCadence?: string;
773
+ /**
774
+ * Called when a plan's CTA is pressed, with the cadence currently selected —
775
+ * which is the half the caller can't otherwise know, since the toggle's state
776
+ * lives in here. Without it the CTA is inert: `PricingCard` takes an
777
+ * `onSelect` and this section had never passed one.
778
+ */
779
+ onSelectPlan?: (plan: PricingPlan, cadence?: string) => void;
780
+ /** Marks one plan as busy (e.g. its checkout is being created). */
781
+ pendingPlanName?: string;
773
782
  }
774
- declare function PricingSection({ title, description, badge, plans, saveBadge, isAuthenticated, renderLink, footnote, mode, foundingDeadline, currency, highlightedBadgeLabel, renderPlanFooter, cadences, defaultCadence, }: PricingSectionProps): react_jsx_runtime.JSX.Element;
783
+ declare function PricingSection({ title, description, badge, plans, saveBadge, isAuthenticated, renderLink, footnote, mode, foundingDeadline, currency, highlightedBadgeLabel, renderPlanFooter, cadences, defaultCadence, onSelectPlan, pendingPlanName, }: PricingSectionProps): react_jsx_runtime.JSX.Element;
775
784
 
776
785
  interface TestimonialsSectionProps {
777
786
  title?: string;
package/dist/index.js CHANGED
@@ -2324,7 +2324,9 @@ function PricingSection({
2324
2324
  highlightedBadgeLabel = "Founding member",
2325
2325
  renderPlanFooter,
2326
2326
  cadences,
2327
- defaultCadence
2327
+ defaultCadence,
2328
+ onSelectPlan,
2329
+ pendingPlanName
2328
2330
  }) {
2329
2331
  const [annual, setAnnual] = React35.useState(false);
2330
2332
  const isOneTime = mode === "one-time";
@@ -2361,7 +2363,12 @@ function PricingSection({
2361
2363
  ),
2362
2364
  children: [
2363
2365
  entry.label,
2364
- saveBadges[entry.key] && /* @__PURE__ */ jsx(Badge$1, { variant: "secondary", className: "text-xs", children: saveBadges[entry.key] })
2366
+ saveBadges[entry.key] && // `default` (primary), not `secondary`: the toggle is
2367
+ // `bg-muted` with a `bg-background` active tab, and a
2368
+ // secondary badge is the same grey as both — the
2369
+ // saving is the incentive, so it has to carry brand
2370
+ // colour to read at all.
2371
+ /* @__PURE__ */ jsx(Badge$1, { variant: "default", className: "text-xs", children: saveBadges[entry.key] })
2365
2372
  ]
2366
2373
  },
2367
2374
  entry.key
@@ -2391,7 +2398,7 @@ function PricingSection({
2391
2398
  ),
2392
2399
  children: [
2393
2400
  "Annual",
2394
- saveBadge && /* @__PURE__ */ jsx(Badge$1, { variant: "secondary", className: "text-xs", children: saveBadge })
2401
+ saveBadge && /* @__PURE__ */ jsx(Badge$1, { variant: "default", className: "text-xs", children: saveBadge })
2395
2402
  ]
2396
2403
  }
2397
2404
  )
@@ -2410,12 +2417,13 @@ function PricingSection({
2410
2417
  period,
2411
2418
  description: plan.description,
2412
2419
  features: plan.features,
2413
- cta: plan.cta,
2420
+ cta: pendingPlanName === plan.name ? "Redirecting\u2026" : plan.cta,
2414
2421
  highlighted: plan.highlighted,
2415
2422
  disabled: plan.disabled,
2416
- ctaDisabled: plan.ctaDisabled,
2423
+ ctaDisabled: plan.ctaDisabled || pendingPlanName === plan.name,
2417
2424
  badge: badge2,
2418
- footer: renderPlanFooter?.(plan)
2425
+ footer: renderPlanFooter?.(plan),
2426
+ onSelect: onSelectPlan ? () => onSelectPlan(plan, useCadences ? activeCadence : void 0) : void 0
2419
2427
  },
2420
2428
  plan.name
2421
2429
  );