@bpinternal/billing-ui 0.1.0 → 0.3.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
@@ -3,6 +3,7 @@ import { billing } from '@botpress/client';
3
3
  import { ButtonHTMLAttributes } from 'react';
4
4
  import { ClassValue } from 'clsx';
5
5
  import { Client } from '@botpress/client';
6
+ import { ComponentType } from 'react';
6
7
  import { CSSProperties } from 'react';
7
8
  import { InputHTMLAttributes } from 'react';
8
9
  import { JSX } from 'react/jsx-runtime';
@@ -58,6 +59,8 @@ export declare type AddonsSummaryCardProps = {
58
59
  className?: string;
59
60
  };
60
61
 
62
+ export declare const ArrowRightIcon: ({ size, ...props }: IconProps) => JSX.Element;
63
+
61
64
  export declare const Badge: ({ variant, children, className }: BadgeProps) => JSX.Element;
62
65
 
63
66
  export declare type BadgeProps = {
@@ -86,6 +89,18 @@ export declare const BILLING_EVENTS: {
86
89
  readonly UPGRADE_CTA_CLICKED: "billing_upgrade_cta_clicked";
87
90
  };
88
91
 
92
+ export declare const BillingActionCard: ({ Icon, title, description, onClick, className }: BillingActionCardProps) => JSX.Element;
93
+
94
+ export declare type BillingActionCardProps = {
95
+ Icon: ComponentType<SVGProps<SVGSVGElement> & {
96
+ size?: number;
97
+ }>;
98
+ title: ReactNode;
99
+ description: ReactNode;
100
+ onClick: () => void;
101
+ className?: string;
102
+ };
103
+
89
104
  export declare type BillingAddress = {
90
105
  lineOne: string;
91
106
  lineTwo?: string;
@@ -459,12 +474,14 @@ export declare const LockIcon: ({ size, ...props }: IconProps) => JSX.Element;
459
474
  * first), totals computed client-side, committed as absolute quantities via
460
475
  * setAddons — 0 removes an add-on. No plan change involved.
461
476
  */
462
- export declare const ManageAddonsDialog: ({ open, onOpenChange, onSuccess }: ManageAddonsDialogProps) => JSX.Element;
477
+ export declare const ManageAddonsDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: ManageAddonsDialogProps) => JSX.Element;
463
478
 
464
479
  export declare type ManageAddonsDialogProps = {
465
480
  open: boolean;
466
481
  onOpenChange: (open: boolean) => void;
467
482
  onSuccess?: () => void;
483
+ /** Called when the user clicks "Upgrade plan" from the add-ons-unavailable state. */
484
+ onUpgrade?: () => void;
468
485
  };
469
486
 
470
487
  export declare const MessageIcon: ({ size, ...props }: IconProps) => JSX.Element;
@@ -480,6 +497,44 @@ export declare const NANO_DOLLARS_PER_DOLLAR = 1000000000;
480
497
  */
481
498
  export declare const OutdatedBillingGate: () => JSX.Element;
482
499
 
500
+ /**
501
+ * Free-plan upgrade modal — the proactive nudge shown when a Free workspace is
502
+ * about to run out of its one-time conversation allowance. Frames the upgrade
503
+ * (monthly allowance + packs + more channels) and offers the two self-serve
504
+ * paid tiers (Plus / Team) with the same plan-card language as the pricing
505
+ * table. Mount it once near the app root.
506
+ *
507
+ * Two modes:
508
+ * - **controlled** — pass `open` / `onOpenChange` and drive it yourself.
509
+ * - **auto** (omit `open`) — it opens itself when the workspace is on Free and
510
+ * ≥75% through its conversations, at most once per day per workspace
511
+ * (dismissed via localStorage, same as the usage banner). Returns the next day.
512
+ */
513
+ export declare const OutgrowFreeDialog: ({ open, onOpenChange, onSelectPlan, recommendedPlanId, interval, planFeatures, featureDescriptions, period, }: OutgrowFreeDialogProps) => JSX.Element | null;
514
+
515
+ export declare type OutgrowFreeDialogProps = {
516
+ /**
517
+ * Controlled visibility. Omit to let the dialog manage itself in `auto` mode:
518
+ * it opens on its own when the workspace is on the Free plan and has used
519
+ * ≥75% of its conversation allowance — at most once per day per workspace.
520
+ */
521
+ open?: boolean;
522
+ /** Required in controlled mode; also called when the dialog closes in auto mode. */
523
+ onOpenChange?: (open: boolean) => void;
524
+ /** Called when the user picks a plan — open your CheckoutDialog with these values. */
525
+ onSelectPlan: (planId: string, interval: BillingInterval) => void;
526
+ /** Plan kind (or exact id) to mark Recommended. Default 'team'. */
527
+ recommendedPlanId?: string;
528
+ /** Billing interval the prices are shown at. Default 'year' (annual). */
529
+ interval?: BillingInterval;
530
+ /** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES. */
531
+ planFeatures?: Partial<Record<PlanKind, string[]>>;
532
+ /** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
533
+ featureDescriptions?: Record<string, string>;
534
+ /** Period (any datetime in the billing month) to evaluate usage; defaults to current month. */
535
+ period?: string;
536
+ };
537
+
483
538
  export declare const PaintIcon: ({ size, ...props }: IconProps) => JSX.Element;
484
539
 
485
540
  export declare type PaymentMethod = NonNullable<Awaited<ReturnType<BillingClient['getPaymentMethod']>>['paymentMethod']>;
@@ -723,7 +778,11 @@ export declare type UsageBannerProps = {
723
778
  * checkout so it works with zero host wiring.
724
779
  */
725
780
  onUpgrade?: () => void;
726
- /** Show a dismiss (×) button. The banner reappears on remount. Default true. */
781
+ /**
782
+ * Show a dismiss (×) button. Dismissing hides the banner (for that metric) for
783
+ * the rest of the day via localStorage; it returns the next day or if a
784
+ * different metric crosses the threshold. Default true.
785
+ */
727
786
  dismissible?: boolean;
728
787
  /** CTA label. Default "Upgrade plan". */
729
788
  ctaLabel?: string;
@@ -777,7 +836,7 @@ export declare function usageItems(quotas: WorkspaceUsages | undefined): UsageIt
777
836
  * hover/focus after `delay`. Renders the children plainly on legacy billing
778
837
  * or when there's no usage to show (the popover just never opens).
779
838
  */
780
- export declare const UsagePopover: ({ children, delay, placement, period, className }: UsagePopoverProps) => JSX.Element;
839
+ export declare const UsagePopover: ({ children, delay, placement, period, onUpgrade, block, className, }: UsagePopoverProps) => JSX.Element;
781
840
 
782
841
  export declare type UsagePopoverProps = {
783
842
  /** The trigger — hovering/focusing it reveals the usage popover. */
@@ -788,6 +847,14 @@ export declare type UsagePopoverProps = {
788
847
  placement?: 'top' | 'bottom';
789
848
  /** Period (any datetime in the billing month); defaults to current month. */
790
849
  period?: string;
850
+ /**
851
+ * Upgrade handler. When set, the popover shows a "Need more room?" nudge with a
852
+ * CTA on plans that can move up (e.g. Free). Wire it to your plan picker /
853
+ * billing route — same target as the widget's `onManage`.
854
+ */
855
+ onUpgrade?: () => void;
856
+ /** Stretch the trigger to fill its container (e.g. a full-width sidebar widget). */
857
+ block?: boolean;
791
858
  className?: string;
792
859
  };
793
860