@bpinternal/billing-ui 0.1.0 → 0.2.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.ts CHANGED
@@ -58,6 +58,8 @@ export declare type AddonsSummaryCardProps = {
58
58
  className?: string;
59
59
  };
60
60
 
61
+ export declare const ArrowRightIcon: ({ size, ...props }: IconProps) => JSX.Element;
62
+
61
63
  export declare const Badge: ({ variant, children, className }: BadgeProps) => JSX.Element;
62
64
 
63
65
  export declare type BadgeProps = {
@@ -480,6 +482,44 @@ export declare const NANO_DOLLARS_PER_DOLLAR = 1000000000;
480
482
  */
481
483
  export declare const OutdatedBillingGate: () => JSX.Element;
482
484
 
485
+ /**
486
+ * Free-plan upgrade modal — the proactive nudge shown when a Free workspace is
487
+ * about to run out of its one-time conversation allowance. Frames the upgrade
488
+ * (monthly allowance + packs + more channels) and offers the two self-serve
489
+ * paid tiers (Plus / Team) with the same plan-card language as the pricing
490
+ * table. Mount it once near the app root.
491
+ *
492
+ * Two modes:
493
+ * - **controlled** — pass `open` / `onOpenChange` and drive it yourself.
494
+ * - **auto** (omit `open`) — it opens itself when the workspace is on Free and
495
+ * ≥75% through its conversations, at most once per day per workspace
496
+ * (dismissed via localStorage, same as the usage banner). Returns the next day.
497
+ */
498
+ export declare const OutgrowFreeDialog: ({ open, onOpenChange, onSelectPlan, recommendedPlanId, interval, planFeatures, featureDescriptions, period, }: OutgrowFreeDialogProps) => JSX.Element | null;
499
+
500
+ export declare type OutgrowFreeDialogProps = {
501
+ /**
502
+ * Controlled visibility. Omit to let the dialog manage itself in `auto` mode:
503
+ * it opens on its own when the workspace is on the Free plan and has used
504
+ * ≥75% of its conversation allowance — at most once per day per workspace.
505
+ */
506
+ open?: boolean;
507
+ /** Required in controlled mode; also called when the dialog closes in auto mode. */
508
+ onOpenChange?: (open: boolean) => void;
509
+ /** Called when the user picks a plan — open your CheckoutDialog with these values. */
510
+ onSelectPlan: (planId: string, interval: BillingInterval) => void;
511
+ /** Plan kind (or exact id) to mark Recommended. Default 'team'. */
512
+ recommendedPlanId?: string;
513
+ /** Billing interval the prices are shown at. Default 'year' (annual). */
514
+ interval?: BillingInterval;
515
+ /** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES. */
516
+ planFeatures?: Partial<Record<PlanKind, string[]>>;
517
+ /** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
518
+ featureDescriptions?: Record<string, string>;
519
+ /** Period (any datetime in the billing month) to evaluate usage; defaults to current month. */
520
+ period?: string;
521
+ };
522
+
483
523
  export declare const PaintIcon: ({ size, ...props }: IconProps) => JSX.Element;
484
524
 
485
525
  export declare type PaymentMethod = NonNullable<Awaited<ReturnType<BillingClient['getPaymentMethod']>>['paymentMethod']>;
@@ -723,7 +763,11 @@ export declare type UsageBannerProps = {
723
763
  * checkout so it works with zero host wiring.
724
764
  */
725
765
  onUpgrade?: () => void;
726
- /** Show a dismiss (×) button. The banner reappears on remount. Default true. */
766
+ /**
767
+ * Show a dismiss (×) button. Dismissing hides the banner (for that metric) for
768
+ * the rest of the day via localStorage; it returns the next day or if a
769
+ * different metric crosses the threshold. Default true.
770
+ */
727
771
  dismissible?: boolean;
728
772
  /** CTA label. Default "Upgrade plan". */
729
773
  ctaLabel?: string;
@@ -777,7 +821,7 @@ export declare function usageItems(quotas: WorkspaceUsages | undefined): UsageIt
777
821
  * hover/focus after `delay`. Renders the children plainly on legacy billing
778
822
  * or when there's no usage to show (the popover just never opens).
779
823
  */
780
- export declare const UsagePopover: ({ children, delay, placement, period, className }: UsagePopoverProps) => JSX.Element;
824
+ export declare const UsagePopover: ({ children, delay, placement, period, onUpgrade, block, className, }: UsagePopoverProps) => JSX.Element;
781
825
 
782
826
  export declare type UsagePopoverProps = {
783
827
  /** The trigger — hovering/focusing it reveals the usage popover. */
@@ -788,6 +832,14 @@ export declare type UsagePopoverProps = {
788
832
  placement?: 'top' | 'bottom';
789
833
  /** Period (any datetime in the billing month); defaults to current month. */
790
834
  period?: string;
835
+ /**
836
+ * Upgrade handler. When set, the popover shows a "Need more room?" nudge with a
837
+ * CTA on plans that can move up (e.g. Free). Wire it to your plan picker /
838
+ * billing route — same target as the widget's `onManage`.
839
+ */
840
+ onUpgrade?: () => void;
841
+ /** Stretch the trigger to fill its container (e.g. a full-width sidebar widget). */
842
+ block?: boolean;
791
843
  className?: string;
792
844
  };
793
845