@bpinternal/billing-ui 0.3.0 → 0.4.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
@@ -14,6 +14,8 @@ import { ReactPortal } from 'react';
14
14
  import { SelectHTMLAttributes } from 'react';
15
15
  import { Stripe } from '@stripe/stripe-js';
16
16
  import { StripeCardElementOptions } from '@stripe/stripe-js';
17
+ import { SupportedLocale } from './i18n';
18
+ import { SupportedLocale as SupportedLocale_2 } from '../i18n';
17
19
  import { SVGProps } from 'react';
18
20
  import { UseMutationResult } from '@tanstack/react-query';
19
21
  import { UseQueryResult } from '@tanstack/react-query';
@@ -152,7 +154,7 @@ declare type BillingContextValue = {
152
154
  scope: string;
153
155
  stripePromise: Promise<Stripe | null>;
154
156
  email?: string;
155
- locale: string;
157
+ locale: SupportedLocale_2;
156
158
  isDark: boolean;
157
159
  toast: (toast: BillingToast) => void;
158
160
  analytics: BillingAnalyticsClient;
@@ -197,7 +199,7 @@ export declare type BillingProviderProps = {
197
199
  stripePublishableKey: string;
198
200
  /** Workspace owner email shown in the checkout contact section */
199
201
  email?: string;
200
- locale?: string;
202
+ locale?: SupportedLocale_2;
201
203
  theme?: BillingTheme;
202
204
  onToast?: (toast: BillingToast) => void;
203
205
  /**
@@ -334,13 +336,6 @@ export declare function currencySymbol(currency: string): string;
334
336
 
335
337
  export declare type Customer = Awaited<ReturnType<BillingClient['getCustomer']>>;
336
338
 
337
- /**
338
- * Plain-language explanations of what each plan feature means, keyed by the exact
339
- * marketing label above. Shown as a hover tooltip in the pricing table. Override
340
- * per-app via UpgradePlanDialog's `featureDescriptions` prop.
341
- */
342
- export declare const DEFAULT_FEATURE_DESCRIPTIONS: Record<string, string>;
343
-
344
339
  /**
345
340
  * Human labels for Smaug plan feature keys. Overridable per-key via the
346
341
  * BillingProvider `featureLabels` prop.
@@ -353,7 +348,7 @@ export declare const DEFAULT_FEATURE_LABELS: Record<string, (quantity: number) =
353
348
  * conversations volume is rendered as the card's headline metric instead.
354
349
  * Override per-app via UpgradePlanDialog's `planFeatures` prop.
355
350
  */
356
- export declare const DEFAULT_PLAN_FEATURES: Record<PlanKind, string[]>;
351
+ export declare const DEFAULT_PLAN_FEATURES: Record<PlanKind, PlanFeatureId[]>;
357
352
 
358
353
  export declare const Dialog: ({ open, onOpenChange, size, children, className, showClose, ...aria }: DialogProps) => ReactPortal | null;
359
354
 
@@ -386,19 +381,16 @@ export declare type Entitlement = {
386
381
 
387
382
  export declare const ExternalLinkIcon: ({ size, ...props }: IconProps) => JSX.Element;
388
383
 
389
- /** Description for a feature label — exact map first, then a keyword fallback for templated quota labels. */
390
- export declare function featureDescription(label: string, overrides?: Record<string, string>): string | undefined;
391
-
392
384
  export declare function featureLabel(key: string, quantity: number, overrides?: Record<string, (quantity: number) => string>): string;
393
385
 
394
386
  /** Human-readable bytes — "10 GB", "1.5 GB", "500 MB". */
395
387
  export declare function formatBytes(bytes: number): string;
396
388
 
397
- export declare function formatCurrency(amount: number, currency?: string, decimal?: number): string;
389
+ export declare function formatCurrency(amount: number, currency?: string, decimal?: number, locale?: string): string;
398
390
 
399
391
  export declare function formatDate(iso: string, locale?: string): string;
400
392
 
401
- export declare function formatQuantity(n: number): string;
393
+ export declare function formatQuantity(n: number, locale?: string): string;
402
394
 
403
395
  export declare function formatUsage(value: number, unit: UsageUnit): string;
404
396
 
@@ -528,7 +520,7 @@ export declare type OutgrowFreeDialogProps = {
528
520
  /** Billing interval the prices are shown at. Default 'year' (annual). */
529
521
  interval?: BillingInterval;
530
522
  /** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES. */
531
- planFeatures?: Partial<Record<PlanKind, string[]>>;
523
+ planFeatures?: Partial<Record<PlanKind, PlanFeatureId[]>>;
532
524
  /** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
533
525
  featureDescriptions?: Record<string, string>;
534
526
  /** Period (any datetime in the billing month) to evaluate usage; defaults to current month. */
@@ -558,6 +550,122 @@ export declare type PaymentMethodDialogProps = {
558
550
 
559
551
  export declare type Plan = Awaited<ReturnType<BillingClient['listPlans']>>[number];
560
552
 
553
+ /** Maps an English feature ID to its i18n label and tooltip description keys. */
554
+ export declare const PLAN_FEATURE_KEYS: {
555
+ 'AI usage included': {
556
+ label: "planFeatureAiUsageIncluded";
557
+ desc: "planFeatureDescAiUsageIncluded";
558
+ };
559
+ '3 seats': {
560
+ label: "planFeature3Seats";
561
+ desc: "planFeatureDesc3Seats";
562
+ };
563
+ '3 AI agents': {
564
+ label: "planFeature3AiAgents";
565
+ desc: "planFeatureDesc3AiAgents";
566
+ };
567
+ 'Botpress Desk': {
568
+ label: "planFeatureBotpressDesk";
569
+ desc: "planFeatureDescBotpressDesk";
570
+ };
571
+ 'Botpress Studio + ADK': {
572
+ label: "planFeatureBotpressStudioAdk";
573
+ desc: "planFeatureDescBotpressStudioAdk";
574
+ };
575
+ 'Help center': {
576
+ label: "planFeatureHelpCenter";
577
+ desc: "planFeatureDescHelpCenter";
578
+ };
579
+ '1K table rows': {
580
+ label: "planFeature1kTableRows";
581
+ desc: "planFeatureDesc1kTableRows";
582
+ };
583
+ '100K table rows': {
584
+ label: "planFeature100kTableRows";
585
+ desc: "planFeatureDesc100kTableRows";
586
+ };
587
+ '500K table rows': {
588
+ label: "planFeature500kTableRows";
589
+ desc: "planFeatureDesc500kTableRows";
590
+ };
591
+ '100MB file storage': {
592
+ label: "planFeature100mbFileStorage";
593
+ desc: "planFeatureDesc100mbFileStorage";
594
+ };
595
+ '10GB file storage': {
596
+ label: "planFeature10gbFileStorage";
597
+ desc: "planFeatureDesc10gbFileStorage";
598
+ };
599
+ '50GB file storage': {
600
+ label: "planFeature50gbFileStorage";
601
+ desc: "planFeatureDesc50gbFileStorage";
602
+ };
603
+ '100MB vector DB storage': {
604
+ label: "planFeature100mbVectorDb";
605
+ desc: "planFeatureDesc100mbVectorDb";
606
+ };
607
+ '1GB vector DB storage': {
608
+ label: "planFeature1gbVectorDb";
609
+ desc: "planFeatureDesc1gbVectorDb";
610
+ };
611
+ '5GB vector DB storage': {
612
+ label: "planFeature5gbVectorDb";
613
+ desc: "planFeatureDesc5gbVectorDb";
614
+ };
615
+ 'Community support': {
616
+ label: "planFeatureCommunitySupport";
617
+ desc: "planFeatureDescCommunitySupport";
618
+ };
619
+ 'Unlimited AI agents': {
620
+ label: "planFeatureUnlimitedAiAgents";
621
+ desc: "planFeatureDescUnlimitedAiAgents";
622
+ };
623
+ 'WhatsApp channel': {
624
+ label: "planFeatureWhatsappChannel";
625
+ desc: "planFeatureDescWhatsappChannel";
626
+ };
627
+ 'Help Center custom domain': {
628
+ label: "planFeatureHelpCenterCustomDomain";
629
+ desc: "planFeatureDescHelpCenterCustomDomain";
630
+ };
631
+ 'Whitelabel webchat': {
632
+ label: "planFeatureWhitelabelWebchat";
633
+ desc: "planFeatureDescWhitelabelWebchat";
634
+ };
635
+ 'Technical support via live chat': {
636
+ label: "planFeatureTechnicalSupportLiveChat";
637
+ desc: "planFeatureDescTechnicalSupportLiveChat";
638
+ };
639
+ 'Unlimited seats': {
640
+ label: "planFeatureUnlimitedSeats";
641
+ desc: "planFeatureDescUnlimitedSeats";
642
+ };
643
+ 'Teams, routing & RBAC': {
644
+ label: "planFeatureTeamsRoutingRbac";
645
+ desc: "planFeatureDescTeamsRoutingRbac";
646
+ };
647
+ 'Team-level analytics': {
648
+ label: "planFeatureTeamLevelAnalytics";
649
+ desc: "planFeatureDescTeamLevelAnalytics";
650
+ };
651
+ 'Voice channel': {
652
+ label: "planFeatureVoiceChannel";
653
+ desc: "planFeatureDescVoiceChannel";
654
+ };
655
+ 'Dedicated support': {
656
+ label: "planFeatureDedicatedSupport";
657
+ desc: "planFeatureDescDedicatedSupport";
658
+ };
659
+ 'SLA & security review': {
660
+ label: "planFeatureSlaSecurity";
661
+ desc: "planFeatureDescSlaSecurity";
662
+ };
663
+ 'Custom storage': {
664
+ label: "planFeatureCustomStorage";
665
+ desc: "planFeatureDescCustomStorage";
666
+ };
667
+ };
668
+
561
669
  export declare const PLAN_ORDER: PlanKind[];
562
670
 
563
671
  /**
@@ -585,6 +693,8 @@ export declare function planDisplayName(name: string): string;
585
693
  */
586
694
  export declare function planEntitlements(plan: Plan | undefined, addons: Addon[] | undefined, quantities: Record<string, number>): Entitlement[];
587
695
 
696
+ export declare type PlanFeatureId = keyof typeof PLAN_FEATURE_KEYS;
697
+
588
698
  /**
589
699
  * Canonical plan kinds. Smaug plan ids/names vary by environment, so plans are
590
700
  * classified by name — same heuristic as the dashboard's getPlanNameFromId.
@@ -722,6 +832,8 @@ export declare type SubscriptionUpdate = {
722
832
  couponCode?: string;
723
833
  };
724
834
 
835
+ export { SupportedLocale }
836
+
725
837
  export declare type TaxId = Customer['taxIds'][number];
726
838
 
727
839
  export declare function toStripeLocale(locale: string): string;
@@ -739,7 +851,7 @@ export declare type UpgradePlanDialogProps = {
739
851
  /** Additional plan ids to hide. Enterprise + managed are always hidden. */
740
852
  excludePlanIds?: string[];
741
853
  /** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES (Desk copy). */
742
- planFeatures?: Partial<Record<PlanKind, string[]>>;
854
+ planFeatures?: Partial<Record<PlanKind, PlanFeatureId[]>>;
743
855
  /** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
744
856
  featureDescriptions?: Record<string, string>;
745
857
  };