@nozle-js/react 0.11.0 → 0.12.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.d.cts CHANGED
@@ -448,25 +448,169 @@ interface SortablePlan {
448
448
  */
449
449
  declare function sortPlansByPrice<T extends SortablePlan>(plans: T[]): T[];
450
450
 
451
- interface Plan {
451
+ type PricingInterval = "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
452
+ type PricingPrivilege = CatalogPrivilege;
453
+ type PricingEntitlement = CatalogEntitlement;
454
+ interface PricingPlan {
452
455
  code: string;
453
456
  name: string;
454
457
  amount_cents: number;
455
458
  amount_currency: string;
456
- interval: string;
459
+ interval: PricingInterval | (string & {});
457
460
  description?: string | null;
458
- /** The public catalog also returns these. They are absent from an older or reduced response. */
459
- entitlements?: CatalogEntitlement[];
461
+ pending_deletion?: boolean;
462
+ plan_family_code?: string | null;
463
+ /** Present in the public catalog. Absent from an older or reduced response. */
464
+ entitlements?: PricingEntitlement[];
460
465
  credit_grant_rules?: CatalogCreditGrantRule[];
461
466
  charges?: CatalogCharge[];
462
467
  }
463
- /** The public plan catalog, read with the publishable key and cached by TanStack Query. */
468
+ /** Display settings of one feature on a family's pricing card. */
469
+ interface PricingFamilyFeature {
470
+ code: string;
471
+ name?: string | null;
472
+ description?: string | null;
473
+ show_on_pricing?: boolean;
474
+ show_description?: boolean;
475
+ display_position?: number | null;
476
+ }
477
+ interface PricingFamily {
478
+ code: string;
479
+ name: string;
480
+ description?: string | null;
481
+ show_on_pricing?: boolean;
482
+ pricing_position?: number | null;
483
+ pricing_highlighted?: boolean;
484
+ badge_text?: string | null;
485
+ cta_text?: string | null;
486
+ /** Codes of the family's plans, ordered weekly to yearly. */
487
+ plan_codes: string[];
488
+ features?: PricingFamilyFeature[];
489
+ }
490
+ /** The `GET /api/v1/plans` payload. `families` is absent on older APIs. */
491
+ interface PricingCatalog {
492
+ plans: PricingPlan[];
493
+ families?: PricingFamily[] | null;
494
+ }
495
+ interface PricingFeature {
496
+ label: string;
497
+ description?: string | null;
498
+ }
499
+ /**
500
+ * Feature overrides: a record keyed by family code or plan code, or an array
501
+ * aligned to the cards in display order.
502
+ */
503
+ type PricingFeatureOverrides = Record<string, Array<string | PricingFeature>> | Array<Array<string | PricingFeature> | undefined>;
504
+ interface PricingIntervalOption {
505
+ interval: PricingInterval;
506
+ label: string;
507
+ /** Best whole-percent saving of any visible family against its monthly plan. */
508
+ savingsPercent: number | null;
509
+ }
510
+ interface PricingCard {
511
+ /** Family code, or the plan code when the catalog has no families. */
512
+ key: string;
513
+ /** Null when the catalog has no families (older APIs). */
514
+ family: PricingFamily | null;
515
+ /** The family's live plans, ordered weekly to yearly. */
516
+ plans: PricingPlan[];
517
+ /** The plan shown, checked out and passed to `onSelect`. */
518
+ plan: PricingPlan;
519
+ /** True when the family has no plan for the requested interval. */
520
+ isFallbackInterval: boolean;
521
+ name: string;
522
+ description: string | null;
523
+ /**
524
+ * Family cards: the per-month equivalent of the plan's price, for example
525
+ * "$40.83". Without families: the plan's price, for example "$14.99".
526
+ */
527
+ price: string;
528
+ /** "/mo" on family cards; the plan's own interval ("/quarter") without families. */
529
+ pricePeriod: string;
530
+ /**
531
+ * Family cards: for example "Billed $490 yearly · save 17%" or "Billed
532
+ * monthly". Empty without families.
533
+ */
534
+ billing: string;
535
+ /** Whole-percent saving against the family's monthly plan, when positive. */
536
+ savingsPercent: number | null;
537
+ features: PricingFeature[];
538
+ highlighted: boolean;
539
+ /** Badge text when highlighted, otherwise null. */
540
+ badge: string | null;
541
+ /** Call-to-action text (family `cta_text` or "Get {name}"). */
542
+ cta: string;
543
+ /** The family code or one of its plan codes is listed in `contactSales`. */
544
+ enterprise: boolean;
545
+ }
546
+ interface GetPricingCardsOptions {
547
+ /**
548
+ * Interval to show ("annual" is accepted for "yearly"). Defaults to
549
+ * monthly when offered, else the first available interval. Without
550
+ * families, plans of other intervals are left out only when an interval
551
+ * is given.
552
+ */
553
+ interval?: PricingInterval | "annual" | null;
554
+ locale?: string;
555
+ /** Family code or plan code to highlight instead of `pricing_highlighted`. */
556
+ highlight?: string | null;
557
+ /**
558
+ * Badge on the highlighted card, replacing the family's `badge_text`
559
+ * (default "Most Popular"). `null` shows no badge.
560
+ */
561
+ badge?: string | null;
562
+ features?: PricingFeatureOverrides;
563
+ /**
564
+ * Codes of families or plans sold on request. Their card's `enterprise` is
565
+ * true. Without families they also stay visible whatever the interval and
566
+ * come last.
567
+ */
568
+ contactSales?: readonly string[];
569
+ /**
570
+ * Orders the plans of a catalog without families. By default they are
571
+ * sorted by base price, cheapest first, with `contactSales` plans last.
572
+ * Families are ordered by `pricing_position`.
573
+ */
574
+ sort?: (a: PricingPlan, b: PricingPlan) => number;
575
+ }
576
+ /** Intervals offered by the visible cards, ordered weekly to yearly. */
577
+ declare function getAvailableIntervals(catalog: PricingCatalog): PricingInterval[];
578
+ /**
579
+ * Options for an interval switch: each available interval with its label
580
+ * and the best family saving against the family's monthly plan.
581
+ */
582
+ declare function getPricingIntervalOptions(catalog: PricingCatalog): PricingIntervalOption[];
583
+ /**
584
+ * The interval to show first: `preferred` ("annual" means "yearly") when it
585
+ * is available, otherwise monthly when available, otherwise the first one.
586
+ */
587
+ declare function getDefaultInterval(catalog: PricingCatalog, preferred?: string | null): PricingInterval | null;
588
+ /**
589
+ * Pricing cards in display order for one interval: the selected plan of each
590
+ * visible family (or the nearest interval's plan when the family has none for
591
+ * it), its per-month price and billing line, its features, the highlight,
592
+ * badge and call to action. Without families each live plan is a card.
593
+ */
594
+ declare function getPricingCards(catalog: PricingCatalog, options?: GetPricingCardsOptions): PricingCard[];
595
+
596
+ /**
597
+ * A plan from the public catalog (`GET /api/v1/plans`). The catalog also returns entitlements, credit
598
+ * grants and charges; they are absent from an older or reduced response.
599
+ */
600
+ type Plan = PricingPlan;
601
+ /**
602
+ * The public plan catalog, read with the publishable key and cached by TanStack Query. `families` is
603
+ * null when the API returns no `families` key (older APIs); pass `{ plans, families }` to
604
+ * `getPricingCards` either way.
605
+ */
464
606
  declare function usePlans(): {
465
- plans: Plan[];
607
+ plans: PricingPlan[];
608
+ families: PricingFamily[] | null;
466
609
  isLoading: boolean;
467
610
  error: Error | null;
468
611
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
469
- plans: Plan[];
612
+ plans: PricingPlan[];
613
+ families: PricingFamily[] | null;
470
614
  nozleBranding: boolean;
471
615
  }, Error>>;
472
616
  };
@@ -888,57 +1032,64 @@ interface UseCheckoutResult$1 {
888
1032
  }
889
1033
  declare function useCheckout$1(): UseCheckoutResult$1;
890
1034
 
891
- interface PricingPlan {
892
- code: string;
893
- name: string;
894
- amount_cents: number;
895
- amount_currency: string;
896
- interval: string;
897
- description?: string | null;
898
- /** Present in the public catalog. The table turns these into each card's feature list. */
899
- entitlements?: CatalogEntitlement[];
900
- credit_grant_rules?: CatalogCreditGrantRule[];
901
- charges?: CatalogCharge[];
902
- }
903
1035
  interface PricingTableProps {
904
1036
  currentPlanCode?: string;
1037
+ /** Plans to show instead of fetching the catalog. */
905
1038
  plans?: PricingPlan[];
906
1039
  /**
907
- * Optional. By default each card lists what its plan gives, read from the catalog. Pass an array
908
- * (aligned to the rendered plan order) or an object keyed by plan code to replace the lines of
909
- * a plan.
1040
+ * Plan families for `plans`. When omitted with `plans`, each plan is its
1041
+ * own card, as with older APIs.
1042
+ */
1043
+ families?: PricingFamily[] | null;
1044
+ /**
1045
+ * Optional. By default each card lists its family's features with values
1046
+ * from the selected plan, or, without families, what the plan gives. Pass
1047
+ * an object keyed by family code or plan code, or an array aligned to the
1048
+ * rendered cards, to replace the lines of a card.
910
1049
  */
911
- features?: string[][] | Record<string, string[]>;
1050
+ features?: PricingFeatureOverrides;
912
1051
  /**
913
- * Optional. Orders the plans. By default they are sorted by base price, cheapest first, with
914
- * `contactSalesPlans` last.
1052
+ * Optional. Orders the plans of a catalog without families. By default
1053
+ * they are sorted by base price, cheapest first, with `contactSalesPlans`
1054
+ * last. Families are ordered by their `pricing_position`.
915
1055
  */
916
1056
  sort?: (a: PricingPlan, b: PricingPlan) => number;
917
- onSelect?: (plan: PricingPlan) => void;
1057
+ /** Called with the selected interval's plan and its family (null without families). */
1058
+ onSelect?: (plan: PricingPlan, family: PricingFamily | null) => void;
918
1059
  returnUrl?: string;
919
1060
  onStripeClientSecret?: (clientSecret: string) => void;
920
1061
  onCheckoutResult?: (result: CheckoutResult) => void;
921
1062
  onCheckoutError?: (error: Error) => void;
1063
+ /** Show the interval switch when several intervals exist. Defaults to true. */
922
1064
  showToggle?: boolean;
923
- /** Code of the plan to highlight. */
1065
+ /** Interval shown first ("annual" is accepted for "yearly"). Defaults to monthly when offered. */
1066
+ defaultInterval?: PricingInterval | 'annual';
1067
+ /** Family code or plan code to highlight. Overrides the family's `pricing_highlighted`. */
924
1068
  highlightPlan?: string;
925
1069
  /**
926
1070
  * How the highlighted card stands out: `outline` (default) draws a border in `colorHighlight`;
927
1071
  * `filled` paints the card in `colorHighlight` and its text and button in `colorHighlightForeground`.
928
1072
  */
929
1073
  highlightStyle?: 'outline' | 'filled';
930
- /** Badge on the highlighted card. Default "Most Popular"; pass `null` for no badge. */
1074
+ /**
1075
+ * Badge on the highlighted card. Replaces the family's `badge_text`; without either it is
1076
+ * "Most Popular". Pass `null` for no badge.
1077
+ */
931
1078
  highlightLabel?: string | null;
932
1079
  className?: string;
933
1080
  /**
934
- * Codes of plans sold on request. Their card shows "Custom" instead of a price and a "Contact Sales"
935
- * button, which opens `enterpriseEmail` when set.
1081
+ * Codes of plans (or plan families) sold on request. Their card shows "Custom" instead of a price
1082
+ * and a "Contact Sales" button, which opens `enterpriseEmail` when set.
936
1083
  */
937
1084
  contactSalesPlans?: string[];
938
1085
  enterpriseEmail?: string;
1086
+ /** Text next to the Annual option, replacing the computed "Save N%". */
1087
+ annualDiscountLabel?: string;
1088
+ /** Locale for prices and feature values. Defaults to `en-US`. */
1089
+ locale?: string;
939
1090
  appearance?: Appearance;
940
1091
  }
941
- declare function PricingTable({ currentPlanCode, plans: propPlans, features, sort, onSelect, returnUrl, onStripeClientSecret, onCheckoutResult, onCheckoutError, showToggle, highlightPlan, highlightStyle, highlightLabel, className, contactSalesPlans, enterpriseEmail, appearance, }: PricingTableProps): React__default.ReactElement;
1092
+ declare function PricingTable({ currentPlanCode, plans: propPlans, families: propFamilies, features, sort, onSelect, returnUrl, onStripeClientSecret, onCheckoutResult, onCheckoutError, showToggle, defaultInterval, highlightPlan, highlightStyle, highlightLabel, className, contactSalesPlans, enterpriseEmail, annualDiscountLabel, locale: localeProp, appearance, }: PricingTableProps): React__default.ReactElement;
942
1093
 
943
1094
  /**
944
1095
  * PlanCard — Individual pricing plan card component.
@@ -1412,4 +1563,4 @@ interface UsageTrendProps {
1412
1563
  }
1413
1564
  declare function UsageTrend({ periods, featureCode, isLoading, error, emptyMessage, appearance, }: UsageTrendProps): React__default.ReactElement;
1414
1565
 
1415
- export { Appearance, BillingContext, type BillingContextValue, type BillingFetch, BillingPortal, BillingPortalError, type BillingPortalProps, type BillingPortalSession, BillingProvider, type BillingProviderProps, BillingRequestError, type BillingSubscription, type CancellationActions, type CancellationApplyInput, CancellationControl, type CancellationControlProps, type CancellationInput, type CancellationOperation, type CancellationPreview, type CancellationSubscription, type CatalogCharge, type CatalogCreditGrantRule, type CatalogEntitlement, type Plan as CatalogPlan, type CatalogPrivilege, type ChargeUsageData, Checkout, CheckoutButton, type CheckoutButtonProps, type CheckoutProps, type CheckoutResult, type CheckoutStatus, type CheckoutSubscriptionResult, type ComparisonFeature, type ComparisonRow, type CompletedCheckoutResult, type CreateBillingPortalSession, type CreateCheckout, type CreateCheckoutInput, CreditBalance, type CreditBalanceData, type CreditBalanceProps, type CreditBalanceSource, CreditHistory, type CreditHistoryProps, type CreditOperationData, CurrentPlan, type CurrentPlanDetail, type CurrentPlanProps, type CustomerUsageData, ElementKey, type ElementProps, type EntitlementResult, FeatureGate, type FeatureGateProps, type GetCheckoutStatus, type HostedCheckoutResult, type InvoiceData, type InvoicePageData, LockedOverlay, type LockedOverlayProps, type NozleClient, type PaymentMethod, PaymentMethodDisplay, type PaymentMethodDisplayProps, PlanBadge, type PlanBadgeProps, PlanCard, type PlanCardProps, type PlanChangeActions, type PlanChangeApplyInput, PlanChangeControl, type PlanChangeControlProps, type PlanChangeInput, type PlanChangeOperation, type PlanChangePreview, type PlanChangePreviewInput, type PlanChangeState, type PlanChangeWithdrawInput, PlanComparison, type PlanComparisonProps, PlanGate, type PlanGateProps, type PortalPlan, PoweredByNozle, type PricingPlan, PricingTable, type PricingTableProps, type ProcessingCheckoutResult, type ProrationPreview, type RazorpayCheckoutResult, type RazorpayVerification, type ScheduledCheckoutResult, UpgradeButton, type UpgradeButtonProps, UpgradeModal, type UpgradeModalProps, type UpgradePreview, UpgradePrompt, type UpgradePromptProps, UsageAlert, type UsageAlertFeature, type UsageAlertProps, UsageBreakdown, type UsageBreakdownProps, UsageDashboard, type UsageDashboardFeature, type UsageDashboardProps, UsageGate, type UsageGateProps, UsageMeter, type UsageMeterProps, type UsageResult, UsageTrend, type UsageTrendProps, type UseAppearance, type UseCheckoutResult, type UseCheckoutResult$1 as UseCheckoutSessionResult, type VerifyCheckout, comparisonRows, currentPlanMeters, getUsageMeterColor, planFeatures, sortPlansByPrice, usageItems, useAppearance, useBillingContext, useBillingRefresh, useCheckout, useCheckout$1 as useCheckoutSession, useCreditBalance, useCreditHistory, useEntitlement, useInvoiceDownload, useInvoices, useNozleBranding, useNozleClient, useOptionalBillingContext, usePlans, useSubscription, useUpgradePreview, useUsage };
1566
+ export { Appearance, BillingContext, type BillingContextValue, type BillingFetch, BillingPortal, BillingPortalError, type BillingPortalProps, type BillingPortalSession, BillingProvider, type BillingProviderProps, BillingRequestError, type BillingSubscription, type CancellationActions, type CancellationApplyInput, CancellationControl, type CancellationControlProps, type CancellationInput, type CancellationOperation, type CancellationPreview, type CancellationSubscription, type CatalogCharge, type CatalogCreditGrantRule, type CatalogEntitlement, type Plan as CatalogPlan, type CatalogPrivilege, type ChargeUsageData, Checkout, CheckoutButton, type CheckoutButtonProps, type CheckoutProps, type CheckoutResult, type CheckoutStatus, type CheckoutSubscriptionResult, type ComparisonFeature, type ComparisonRow, type CompletedCheckoutResult, type CreateBillingPortalSession, type CreateCheckout, type CreateCheckoutInput, CreditBalance, type CreditBalanceData, type CreditBalanceProps, type CreditBalanceSource, CreditHistory, type CreditHistoryProps, type CreditOperationData, CurrentPlan, type CurrentPlanDetail, type CurrentPlanProps, type CustomerUsageData, ElementKey, type ElementProps, type EntitlementResult, FeatureGate, type FeatureGateProps, type GetCheckoutStatus, type GetPricingCardsOptions, type HostedCheckoutResult, type InvoiceData, type InvoicePageData, LockedOverlay, type LockedOverlayProps, type NozleClient, type PaymentMethod, PaymentMethodDisplay, type PaymentMethodDisplayProps, PlanBadge, type PlanBadgeProps, PlanCard, type PlanCardProps, type PlanChangeActions, type PlanChangeApplyInput, PlanChangeControl, type PlanChangeControlProps, type PlanChangeInput, type PlanChangeOperation, type PlanChangePreview, type PlanChangePreviewInput, type PlanChangeState, type PlanChangeWithdrawInput, PlanComparison, type PlanComparisonProps, PlanGate, type PlanGateProps, type PortalPlan, PoweredByNozle, type PricingCard, type PricingCatalog, type PricingEntitlement, type PricingFamily, type PricingFamilyFeature, type PricingFeature, type PricingFeatureOverrides, type PricingInterval, type PricingIntervalOption, type PricingPlan, type PricingPrivilege, PricingTable, type PricingTableProps, type ProcessingCheckoutResult, type ProrationPreview, type RazorpayCheckoutResult, type RazorpayVerification, type ScheduledCheckoutResult, UpgradeButton, type UpgradeButtonProps, UpgradeModal, type UpgradeModalProps, type UpgradePreview, UpgradePrompt, type UpgradePromptProps, UsageAlert, type UsageAlertFeature, type UsageAlertProps, UsageBreakdown, type UsageBreakdownProps, UsageDashboard, type UsageDashboardFeature, type UsageDashboardProps, UsageGate, type UsageGateProps, UsageMeter, type UsageMeterProps, type UsageResult, UsageTrend, type UsageTrendProps, type UseAppearance, type UseCheckoutResult, type UseCheckoutResult$1 as UseCheckoutSessionResult, type VerifyCheckout, comparisonRows, currentPlanMeters, getAvailableIntervals, getDefaultInterval, getPricingCards, getPricingIntervalOptions, getUsageMeterColor, planFeatures, sortPlansByPrice, usageItems, useAppearance, useBillingContext, useBillingRefresh, useCheckout, useCheckout$1 as useCheckoutSession, useCreditBalance, useCreditHistory, useEntitlement, useInvoiceDownload, useInvoices, useNozleBranding, useNozleClient, useOptionalBillingContext, usePlans, useSubscription, useUpgradePreview, useUsage };
package/dist/index.d.ts CHANGED
@@ -448,25 +448,169 @@ interface SortablePlan {
448
448
  */
449
449
  declare function sortPlansByPrice<T extends SortablePlan>(plans: T[]): T[];
450
450
 
451
- interface Plan {
451
+ type PricingInterval = "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
452
+ type PricingPrivilege = CatalogPrivilege;
453
+ type PricingEntitlement = CatalogEntitlement;
454
+ interface PricingPlan {
452
455
  code: string;
453
456
  name: string;
454
457
  amount_cents: number;
455
458
  amount_currency: string;
456
- interval: string;
459
+ interval: PricingInterval | (string & {});
457
460
  description?: string | null;
458
- /** The public catalog also returns these. They are absent from an older or reduced response. */
459
- entitlements?: CatalogEntitlement[];
461
+ pending_deletion?: boolean;
462
+ plan_family_code?: string | null;
463
+ /** Present in the public catalog. Absent from an older or reduced response. */
464
+ entitlements?: PricingEntitlement[];
460
465
  credit_grant_rules?: CatalogCreditGrantRule[];
461
466
  charges?: CatalogCharge[];
462
467
  }
463
- /** The public plan catalog, read with the publishable key and cached by TanStack Query. */
468
+ /** Display settings of one feature on a family's pricing card. */
469
+ interface PricingFamilyFeature {
470
+ code: string;
471
+ name?: string | null;
472
+ description?: string | null;
473
+ show_on_pricing?: boolean;
474
+ show_description?: boolean;
475
+ display_position?: number | null;
476
+ }
477
+ interface PricingFamily {
478
+ code: string;
479
+ name: string;
480
+ description?: string | null;
481
+ show_on_pricing?: boolean;
482
+ pricing_position?: number | null;
483
+ pricing_highlighted?: boolean;
484
+ badge_text?: string | null;
485
+ cta_text?: string | null;
486
+ /** Codes of the family's plans, ordered weekly to yearly. */
487
+ plan_codes: string[];
488
+ features?: PricingFamilyFeature[];
489
+ }
490
+ /** The `GET /api/v1/plans` payload. `families` is absent on older APIs. */
491
+ interface PricingCatalog {
492
+ plans: PricingPlan[];
493
+ families?: PricingFamily[] | null;
494
+ }
495
+ interface PricingFeature {
496
+ label: string;
497
+ description?: string | null;
498
+ }
499
+ /**
500
+ * Feature overrides: a record keyed by family code or plan code, or an array
501
+ * aligned to the cards in display order.
502
+ */
503
+ type PricingFeatureOverrides = Record<string, Array<string | PricingFeature>> | Array<Array<string | PricingFeature> | undefined>;
504
+ interface PricingIntervalOption {
505
+ interval: PricingInterval;
506
+ label: string;
507
+ /** Best whole-percent saving of any visible family against its monthly plan. */
508
+ savingsPercent: number | null;
509
+ }
510
+ interface PricingCard {
511
+ /** Family code, or the plan code when the catalog has no families. */
512
+ key: string;
513
+ /** Null when the catalog has no families (older APIs). */
514
+ family: PricingFamily | null;
515
+ /** The family's live plans, ordered weekly to yearly. */
516
+ plans: PricingPlan[];
517
+ /** The plan shown, checked out and passed to `onSelect`. */
518
+ plan: PricingPlan;
519
+ /** True when the family has no plan for the requested interval. */
520
+ isFallbackInterval: boolean;
521
+ name: string;
522
+ description: string | null;
523
+ /**
524
+ * Family cards: the per-month equivalent of the plan's price, for example
525
+ * "$40.83". Without families: the plan's price, for example "$14.99".
526
+ */
527
+ price: string;
528
+ /** "/mo" on family cards; the plan's own interval ("/quarter") without families. */
529
+ pricePeriod: string;
530
+ /**
531
+ * Family cards: for example "Billed $490 yearly · save 17%" or "Billed
532
+ * monthly". Empty without families.
533
+ */
534
+ billing: string;
535
+ /** Whole-percent saving against the family's monthly plan, when positive. */
536
+ savingsPercent: number | null;
537
+ features: PricingFeature[];
538
+ highlighted: boolean;
539
+ /** Badge text when highlighted, otherwise null. */
540
+ badge: string | null;
541
+ /** Call-to-action text (family `cta_text` or "Get {name}"). */
542
+ cta: string;
543
+ /** The family code or one of its plan codes is listed in `contactSales`. */
544
+ enterprise: boolean;
545
+ }
546
+ interface GetPricingCardsOptions {
547
+ /**
548
+ * Interval to show ("annual" is accepted for "yearly"). Defaults to
549
+ * monthly when offered, else the first available interval. Without
550
+ * families, plans of other intervals are left out only when an interval
551
+ * is given.
552
+ */
553
+ interval?: PricingInterval | "annual" | null;
554
+ locale?: string;
555
+ /** Family code or plan code to highlight instead of `pricing_highlighted`. */
556
+ highlight?: string | null;
557
+ /**
558
+ * Badge on the highlighted card, replacing the family's `badge_text`
559
+ * (default "Most Popular"). `null` shows no badge.
560
+ */
561
+ badge?: string | null;
562
+ features?: PricingFeatureOverrides;
563
+ /**
564
+ * Codes of families or plans sold on request. Their card's `enterprise` is
565
+ * true. Without families they also stay visible whatever the interval and
566
+ * come last.
567
+ */
568
+ contactSales?: readonly string[];
569
+ /**
570
+ * Orders the plans of a catalog without families. By default they are
571
+ * sorted by base price, cheapest first, with `contactSales` plans last.
572
+ * Families are ordered by `pricing_position`.
573
+ */
574
+ sort?: (a: PricingPlan, b: PricingPlan) => number;
575
+ }
576
+ /** Intervals offered by the visible cards, ordered weekly to yearly. */
577
+ declare function getAvailableIntervals(catalog: PricingCatalog): PricingInterval[];
578
+ /**
579
+ * Options for an interval switch: each available interval with its label
580
+ * and the best family saving against the family's monthly plan.
581
+ */
582
+ declare function getPricingIntervalOptions(catalog: PricingCatalog): PricingIntervalOption[];
583
+ /**
584
+ * The interval to show first: `preferred` ("annual" means "yearly") when it
585
+ * is available, otherwise monthly when available, otherwise the first one.
586
+ */
587
+ declare function getDefaultInterval(catalog: PricingCatalog, preferred?: string | null): PricingInterval | null;
588
+ /**
589
+ * Pricing cards in display order for one interval: the selected plan of each
590
+ * visible family (or the nearest interval's plan when the family has none for
591
+ * it), its per-month price and billing line, its features, the highlight,
592
+ * badge and call to action. Without families each live plan is a card.
593
+ */
594
+ declare function getPricingCards(catalog: PricingCatalog, options?: GetPricingCardsOptions): PricingCard[];
595
+
596
+ /**
597
+ * A plan from the public catalog (`GET /api/v1/plans`). The catalog also returns entitlements, credit
598
+ * grants and charges; they are absent from an older or reduced response.
599
+ */
600
+ type Plan = PricingPlan;
601
+ /**
602
+ * The public plan catalog, read with the publishable key and cached by TanStack Query. `families` is
603
+ * null when the API returns no `families` key (older APIs); pass `{ plans, families }` to
604
+ * `getPricingCards` either way.
605
+ */
464
606
  declare function usePlans(): {
465
- plans: Plan[];
607
+ plans: PricingPlan[];
608
+ families: PricingFamily[] | null;
466
609
  isLoading: boolean;
467
610
  error: Error | null;
468
611
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
469
- plans: Plan[];
612
+ plans: PricingPlan[];
613
+ families: PricingFamily[] | null;
470
614
  nozleBranding: boolean;
471
615
  }, Error>>;
472
616
  };
@@ -888,57 +1032,64 @@ interface UseCheckoutResult$1 {
888
1032
  }
889
1033
  declare function useCheckout$1(): UseCheckoutResult$1;
890
1034
 
891
- interface PricingPlan {
892
- code: string;
893
- name: string;
894
- amount_cents: number;
895
- amount_currency: string;
896
- interval: string;
897
- description?: string | null;
898
- /** Present in the public catalog. The table turns these into each card's feature list. */
899
- entitlements?: CatalogEntitlement[];
900
- credit_grant_rules?: CatalogCreditGrantRule[];
901
- charges?: CatalogCharge[];
902
- }
903
1035
  interface PricingTableProps {
904
1036
  currentPlanCode?: string;
1037
+ /** Plans to show instead of fetching the catalog. */
905
1038
  plans?: PricingPlan[];
906
1039
  /**
907
- * Optional. By default each card lists what its plan gives, read from the catalog. Pass an array
908
- * (aligned to the rendered plan order) or an object keyed by plan code to replace the lines of
909
- * a plan.
1040
+ * Plan families for `plans`. When omitted with `plans`, each plan is its
1041
+ * own card, as with older APIs.
1042
+ */
1043
+ families?: PricingFamily[] | null;
1044
+ /**
1045
+ * Optional. By default each card lists its family's features with values
1046
+ * from the selected plan, or, without families, what the plan gives. Pass
1047
+ * an object keyed by family code or plan code, or an array aligned to the
1048
+ * rendered cards, to replace the lines of a card.
910
1049
  */
911
- features?: string[][] | Record<string, string[]>;
1050
+ features?: PricingFeatureOverrides;
912
1051
  /**
913
- * Optional. Orders the plans. By default they are sorted by base price, cheapest first, with
914
- * `contactSalesPlans` last.
1052
+ * Optional. Orders the plans of a catalog without families. By default
1053
+ * they are sorted by base price, cheapest first, with `contactSalesPlans`
1054
+ * last. Families are ordered by their `pricing_position`.
915
1055
  */
916
1056
  sort?: (a: PricingPlan, b: PricingPlan) => number;
917
- onSelect?: (plan: PricingPlan) => void;
1057
+ /** Called with the selected interval's plan and its family (null without families). */
1058
+ onSelect?: (plan: PricingPlan, family: PricingFamily | null) => void;
918
1059
  returnUrl?: string;
919
1060
  onStripeClientSecret?: (clientSecret: string) => void;
920
1061
  onCheckoutResult?: (result: CheckoutResult) => void;
921
1062
  onCheckoutError?: (error: Error) => void;
1063
+ /** Show the interval switch when several intervals exist. Defaults to true. */
922
1064
  showToggle?: boolean;
923
- /** Code of the plan to highlight. */
1065
+ /** Interval shown first ("annual" is accepted for "yearly"). Defaults to monthly when offered. */
1066
+ defaultInterval?: PricingInterval | 'annual';
1067
+ /** Family code or plan code to highlight. Overrides the family's `pricing_highlighted`. */
924
1068
  highlightPlan?: string;
925
1069
  /**
926
1070
  * How the highlighted card stands out: `outline` (default) draws a border in `colorHighlight`;
927
1071
  * `filled` paints the card in `colorHighlight` and its text and button in `colorHighlightForeground`.
928
1072
  */
929
1073
  highlightStyle?: 'outline' | 'filled';
930
- /** Badge on the highlighted card. Default "Most Popular"; pass `null` for no badge. */
1074
+ /**
1075
+ * Badge on the highlighted card. Replaces the family's `badge_text`; without either it is
1076
+ * "Most Popular". Pass `null` for no badge.
1077
+ */
931
1078
  highlightLabel?: string | null;
932
1079
  className?: string;
933
1080
  /**
934
- * Codes of plans sold on request. Their card shows "Custom" instead of a price and a "Contact Sales"
935
- * button, which opens `enterpriseEmail` when set.
1081
+ * Codes of plans (or plan families) sold on request. Their card shows "Custom" instead of a price
1082
+ * and a "Contact Sales" button, which opens `enterpriseEmail` when set.
936
1083
  */
937
1084
  contactSalesPlans?: string[];
938
1085
  enterpriseEmail?: string;
1086
+ /** Text next to the Annual option, replacing the computed "Save N%". */
1087
+ annualDiscountLabel?: string;
1088
+ /** Locale for prices and feature values. Defaults to `en-US`. */
1089
+ locale?: string;
939
1090
  appearance?: Appearance;
940
1091
  }
941
- declare function PricingTable({ currentPlanCode, plans: propPlans, features, sort, onSelect, returnUrl, onStripeClientSecret, onCheckoutResult, onCheckoutError, showToggle, highlightPlan, highlightStyle, highlightLabel, className, contactSalesPlans, enterpriseEmail, appearance, }: PricingTableProps): React__default.ReactElement;
1092
+ declare function PricingTable({ currentPlanCode, plans: propPlans, families: propFamilies, features, sort, onSelect, returnUrl, onStripeClientSecret, onCheckoutResult, onCheckoutError, showToggle, defaultInterval, highlightPlan, highlightStyle, highlightLabel, className, contactSalesPlans, enterpriseEmail, annualDiscountLabel, locale: localeProp, appearance, }: PricingTableProps): React__default.ReactElement;
942
1093
 
943
1094
  /**
944
1095
  * PlanCard — Individual pricing plan card component.
@@ -1412,4 +1563,4 @@ interface UsageTrendProps {
1412
1563
  }
1413
1564
  declare function UsageTrend({ periods, featureCode, isLoading, error, emptyMessage, appearance, }: UsageTrendProps): React__default.ReactElement;
1414
1565
 
1415
- export { Appearance, BillingContext, type BillingContextValue, type BillingFetch, BillingPortal, BillingPortalError, type BillingPortalProps, type BillingPortalSession, BillingProvider, type BillingProviderProps, BillingRequestError, type BillingSubscription, type CancellationActions, type CancellationApplyInput, CancellationControl, type CancellationControlProps, type CancellationInput, type CancellationOperation, type CancellationPreview, type CancellationSubscription, type CatalogCharge, type CatalogCreditGrantRule, type CatalogEntitlement, type Plan as CatalogPlan, type CatalogPrivilege, type ChargeUsageData, Checkout, CheckoutButton, type CheckoutButtonProps, type CheckoutProps, type CheckoutResult, type CheckoutStatus, type CheckoutSubscriptionResult, type ComparisonFeature, type ComparisonRow, type CompletedCheckoutResult, type CreateBillingPortalSession, type CreateCheckout, type CreateCheckoutInput, CreditBalance, type CreditBalanceData, type CreditBalanceProps, type CreditBalanceSource, CreditHistory, type CreditHistoryProps, type CreditOperationData, CurrentPlan, type CurrentPlanDetail, type CurrentPlanProps, type CustomerUsageData, ElementKey, type ElementProps, type EntitlementResult, FeatureGate, type FeatureGateProps, type GetCheckoutStatus, type HostedCheckoutResult, type InvoiceData, type InvoicePageData, LockedOverlay, type LockedOverlayProps, type NozleClient, type PaymentMethod, PaymentMethodDisplay, type PaymentMethodDisplayProps, PlanBadge, type PlanBadgeProps, PlanCard, type PlanCardProps, type PlanChangeActions, type PlanChangeApplyInput, PlanChangeControl, type PlanChangeControlProps, type PlanChangeInput, type PlanChangeOperation, type PlanChangePreview, type PlanChangePreviewInput, type PlanChangeState, type PlanChangeWithdrawInput, PlanComparison, type PlanComparisonProps, PlanGate, type PlanGateProps, type PortalPlan, PoweredByNozle, type PricingPlan, PricingTable, type PricingTableProps, type ProcessingCheckoutResult, type ProrationPreview, type RazorpayCheckoutResult, type RazorpayVerification, type ScheduledCheckoutResult, UpgradeButton, type UpgradeButtonProps, UpgradeModal, type UpgradeModalProps, type UpgradePreview, UpgradePrompt, type UpgradePromptProps, UsageAlert, type UsageAlertFeature, type UsageAlertProps, UsageBreakdown, type UsageBreakdownProps, UsageDashboard, type UsageDashboardFeature, type UsageDashboardProps, UsageGate, type UsageGateProps, UsageMeter, type UsageMeterProps, type UsageResult, UsageTrend, type UsageTrendProps, type UseAppearance, type UseCheckoutResult, type UseCheckoutResult$1 as UseCheckoutSessionResult, type VerifyCheckout, comparisonRows, currentPlanMeters, getUsageMeterColor, planFeatures, sortPlansByPrice, usageItems, useAppearance, useBillingContext, useBillingRefresh, useCheckout, useCheckout$1 as useCheckoutSession, useCreditBalance, useCreditHistory, useEntitlement, useInvoiceDownload, useInvoices, useNozleBranding, useNozleClient, useOptionalBillingContext, usePlans, useSubscription, useUpgradePreview, useUsage };
1566
+ export { Appearance, BillingContext, type BillingContextValue, type BillingFetch, BillingPortal, BillingPortalError, type BillingPortalProps, type BillingPortalSession, BillingProvider, type BillingProviderProps, BillingRequestError, type BillingSubscription, type CancellationActions, type CancellationApplyInput, CancellationControl, type CancellationControlProps, type CancellationInput, type CancellationOperation, type CancellationPreview, type CancellationSubscription, type CatalogCharge, type CatalogCreditGrantRule, type CatalogEntitlement, type Plan as CatalogPlan, type CatalogPrivilege, type ChargeUsageData, Checkout, CheckoutButton, type CheckoutButtonProps, type CheckoutProps, type CheckoutResult, type CheckoutStatus, type CheckoutSubscriptionResult, type ComparisonFeature, type ComparisonRow, type CompletedCheckoutResult, type CreateBillingPortalSession, type CreateCheckout, type CreateCheckoutInput, CreditBalance, type CreditBalanceData, type CreditBalanceProps, type CreditBalanceSource, CreditHistory, type CreditHistoryProps, type CreditOperationData, CurrentPlan, type CurrentPlanDetail, type CurrentPlanProps, type CustomerUsageData, ElementKey, type ElementProps, type EntitlementResult, FeatureGate, type FeatureGateProps, type GetCheckoutStatus, type GetPricingCardsOptions, type HostedCheckoutResult, type InvoiceData, type InvoicePageData, LockedOverlay, type LockedOverlayProps, type NozleClient, type PaymentMethod, PaymentMethodDisplay, type PaymentMethodDisplayProps, PlanBadge, type PlanBadgeProps, PlanCard, type PlanCardProps, type PlanChangeActions, type PlanChangeApplyInput, PlanChangeControl, type PlanChangeControlProps, type PlanChangeInput, type PlanChangeOperation, type PlanChangePreview, type PlanChangePreviewInput, type PlanChangeState, type PlanChangeWithdrawInput, PlanComparison, type PlanComparisonProps, PlanGate, type PlanGateProps, type PortalPlan, PoweredByNozle, type PricingCard, type PricingCatalog, type PricingEntitlement, type PricingFamily, type PricingFamilyFeature, type PricingFeature, type PricingFeatureOverrides, type PricingInterval, type PricingIntervalOption, type PricingPlan, type PricingPrivilege, PricingTable, type PricingTableProps, type ProcessingCheckoutResult, type ProrationPreview, type RazorpayCheckoutResult, type RazorpayVerification, type ScheduledCheckoutResult, UpgradeButton, type UpgradeButtonProps, UpgradeModal, type UpgradeModalProps, type UpgradePreview, UpgradePrompt, type UpgradePromptProps, UsageAlert, type UsageAlertFeature, type UsageAlertProps, UsageBreakdown, type UsageBreakdownProps, UsageDashboard, type UsageDashboardFeature, type UsageDashboardProps, UsageGate, type UsageGateProps, UsageMeter, type UsageMeterProps, type UsageResult, UsageTrend, type UsageTrendProps, type UseAppearance, type UseCheckoutResult, type UseCheckoutResult$1 as UseCheckoutSessionResult, type VerifyCheckout, comparisonRows, currentPlanMeters, getAvailableIntervals, getDefaultInterval, getPricingCards, getPricingIntervalOptions, getUsageMeterColor, planFeatures, sortPlansByPrice, usageItems, useAppearance, useBillingContext, useBillingRefresh, useCheckout, useCheckout$1 as useCheckoutSession, useCreditBalance, useCreditHistory, useEntitlement, useInvoiceDownload, useInvoices, useNozleBranding, useNozleClient, useOptionalBillingContext, usePlans, useSubscription, useUpgradePreview, useUsage };