@olwiba/ui 0.2.8 → 0.2.9

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";
@@ -2410,12 +2412,13 @@ function PricingSection({
2410
2412
  period,
2411
2413
  description: plan.description,
2412
2414
  features: plan.features,
2413
- cta: plan.cta,
2415
+ cta: pendingPlanName === plan.name ? "Redirecting\u2026" : plan.cta,
2414
2416
  highlighted: plan.highlighted,
2415
2417
  disabled: plan.disabled,
2416
- ctaDisabled: plan.ctaDisabled,
2418
+ ctaDisabled: plan.ctaDisabled || pendingPlanName === plan.name,
2417
2419
  badge: badge2,
2418
- footer: renderPlanFooter?.(plan)
2420
+ footer: renderPlanFooter?.(plan),
2421
+ onSelect: onSelectPlan ? () => onSelectPlan(plan, useCadences ? activeCadence : void 0) : void 0
2419
2422
  },
2420
2423
  plan.name
2421
2424
  );