@bpinternal/billing-ui 0.3.1 → 0.5.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 +134 -18
- package/dist/index.js +5925 -2664
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -2
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';
|
|
@@ -145,6 +147,8 @@ export declare type BillingClient = Pick<billing.Client, 'listPlans' | 'listAddo
|
|
|
145
147
|
*/
|
|
146
148
|
Partial<Pick<Client, 'breakDownWorkspaceUsageByBot' | 'listBots'>>;
|
|
147
149
|
|
|
150
|
+
export declare type BillingColorScheme = 'default' | 'neutral';
|
|
151
|
+
|
|
148
152
|
declare type BillingContextValue = {
|
|
149
153
|
client: BillingClient;
|
|
150
154
|
queryClient: QueryClient;
|
|
@@ -152,8 +156,9 @@ declare type BillingContextValue = {
|
|
|
152
156
|
scope: string;
|
|
153
157
|
stripePromise: Promise<Stripe | null>;
|
|
154
158
|
email?: string;
|
|
155
|
-
locale:
|
|
159
|
+
locale: SupportedLocale_2;
|
|
156
160
|
isDark: boolean;
|
|
161
|
+
colorScheme: BillingColorScheme;
|
|
157
162
|
toast: (toast: BillingToast) => void;
|
|
158
163
|
analytics: BillingAnalyticsClient;
|
|
159
164
|
featureLabels?: Record<string, (quantity: number) => string>;
|
|
@@ -188,7 +193,7 @@ export declare const billingKeys: {
|
|
|
188
193
|
usageByBot: (scope: string, type: string, period: string) => readonly ["bpb", string, "usage-by-bot", string, string];
|
|
189
194
|
};
|
|
190
195
|
|
|
191
|
-
export declare const BillingProvider: ({ client, stripePublishableKey, email, locale, theme, onToast, analytics, featureLabels, billingVersion, workspaceId, persist, manageBillingUrl, onBillingChange, refreshInterval, children, }: BillingProviderProps) => JSX.Element;
|
|
196
|
+
export declare const BillingProvider: ({ client, stripePublishableKey, email, locale, theme, colorScheme, onToast, analytics, featureLabels, billingVersion, workspaceId, persist, manageBillingUrl, onBillingChange, refreshInterval, children, }: BillingProviderProps) => JSX.Element;
|
|
192
197
|
|
|
193
198
|
export declare type BillingProviderProps = {
|
|
194
199
|
/** Billing engine client — `@botpress/client`'s `billing.Client` or any compatible adapter */
|
|
@@ -197,8 +202,9 @@ export declare type BillingProviderProps = {
|
|
|
197
202
|
stripePublishableKey: string;
|
|
198
203
|
/** Workspace owner email shown in the checkout contact section */
|
|
199
204
|
email?: string;
|
|
200
|
-
locale?:
|
|
205
|
+
locale?: SupportedLocale_2;
|
|
201
206
|
theme?: BillingTheme;
|
|
207
|
+
colorScheme?: BillingColorScheme;
|
|
202
208
|
onToast?: (toast: BillingToast) => void;
|
|
203
209
|
/**
|
|
204
210
|
* Analytics sink the library captures billing-funnel events into. Pass a
|
|
@@ -334,13 +340,6 @@ export declare function currencySymbol(currency: string): string;
|
|
|
334
340
|
|
|
335
341
|
export declare type Customer = Awaited<ReturnType<BillingClient['getCustomer']>>;
|
|
336
342
|
|
|
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
343
|
/**
|
|
345
344
|
* Human labels for Smaug plan feature keys. Overridable per-key via the
|
|
346
345
|
* BillingProvider `featureLabels` prop.
|
|
@@ -353,7 +352,7 @@ export declare const DEFAULT_FEATURE_LABELS: Record<string, (quantity: number) =
|
|
|
353
352
|
* conversations volume is rendered as the card's headline metric instead.
|
|
354
353
|
* Override per-app via UpgradePlanDialog's `planFeatures` prop.
|
|
355
354
|
*/
|
|
356
|
-
export declare const DEFAULT_PLAN_FEATURES: Record<PlanKind,
|
|
355
|
+
export declare const DEFAULT_PLAN_FEATURES: Record<PlanKind, PlanFeatureId[]>;
|
|
357
356
|
|
|
358
357
|
export declare const Dialog: ({ open, onOpenChange, size, children, className, showClose, ...aria }: DialogProps) => ReactPortal | null;
|
|
359
358
|
|
|
@@ -386,19 +385,16 @@ export declare type Entitlement = {
|
|
|
386
385
|
|
|
387
386
|
export declare const ExternalLinkIcon: ({ size, ...props }: IconProps) => JSX.Element;
|
|
388
387
|
|
|
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
388
|
export declare function featureLabel(key: string, quantity: number, overrides?: Record<string, (quantity: number) => string>): string;
|
|
393
389
|
|
|
394
390
|
/** Human-readable bytes — "10 GB", "1.5 GB", "500 MB". */
|
|
395
391
|
export declare function formatBytes(bytes: number): string;
|
|
396
392
|
|
|
397
|
-
export declare function formatCurrency(amount: number, currency?: string, decimal?: number): string;
|
|
393
|
+
export declare function formatCurrency(amount: number, currency?: string, decimal?: number, locale?: string): string;
|
|
398
394
|
|
|
399
395
|
export declare function formatDate(iso: string, locale?: string): string;
|
|
400
396
|
|
|
401
|
-
export declare function formatQuantity(n: number): string;
|
|
397
|
+
export declare function formatQuantity(n: number, locale?: string): string;
|
|
402
398
|
|
|
403
399
|
export declare function formatUsage(value: number, unit: UsageUnit): string;
|
|
404
400
|
|
|
@@ -528,7 +524,7 @@ export declare type OutgrowFreeDialogProps = {
|
|
|
528
524
|
/** Billing interval the prices are shown at. Default 'year' (annual). */
|
|
529
525
|
interval?: BillingInterval;
|
|
530
526
|
/** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES. */
|
|
531
|
-
planFeatures?: Partial<Record<PlanKind,
|
|
527
|
+
planFeatures?: Partial<Record<PlanKind, PlanFeatureId[]>>;
|
|
532
528
|
/** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
|
|
533
529
|
featureDescriptions?: Record<string, string>;
|
|
534
530
|
/** Period (any datetime in the billing month) to evaluate usage; defaults to current month. */
|
|
@@ -558,6 +554,122 @@ export declare type PaymentMethodDialogProps = {
|
|
|
558
554
|
|
|
559
555
|
export declare type Plan = Awaited<ReturnType<BillingClient['listPlans']>>[number];
|
|
560
556
|
|
|
557
|
+
/** Maps an English feature ID to its i18n label and tooltip description keys. */
|
|
558
|
+
export declare const PLAN_FEATURE_KEYS: {
|
|
559
|
+
'AI usage included': {
|
|
560
|
+
label: "planFeatureAiUsageIncluded";
|
|
561
|
+
desc: "planFeatureDescAiUsageIncluded";
|
|
562
|
+
};
|
|
563
|
+
'3 seats': {
|
|
564
|
+
label: "planFeature3Seats";
|
|
565
|
+
desc: "planFeatureDesc3Seats";
|
|
566
|
+
};
|
|
567
|
+
'3 AI agents': {
|
|
568
|
+
label: "planFeature3AiAgents";
|
|
569
|
+
desc: "planFeatureDesc3AiAgents";
|
|
570
|
+
};
|
|
571
|
+
'Botpress Desk': {
|
|
572
|
+
label: "planFeatureBotpressDesk";
|
|
573
|
+
desc: "planFeatureDescBotpressDesk";
|
|
574
|
+
};
|
|
575
|
+
'Botpress Studio + ADK': {
|
|
576
|
+
label: "planFeatureBotpressStudioAdk";
|
|
577
|
+
desc: "planFeatureDescBotpressStudioAdk";
|
|
578
|
+
};
|
|
579
|
+
'Help center': {
|
|
580
|
+
label: "planFeatureHelpCenter";
|
|
581
|
+
desc: "planFeatureDescHelpCenter";
|
|
582
|
+
};
|
|
583
|
+
'1K table rows': {
|
|
584
|
+
label: "planFeature1kTableRows";
|
|
585
|
+
desc: "planFeatureDesc1kTableRows";
|
|
586
|
+
};
|
|
587
|
+
'100K table rows': {
|
|
588
|
+
label: "planFeature100kTableRows";
|
|
589
|
+
desc: "planFeatureDesc100kTableRows";
|
|
590
|
+
};
|
|
591
|
+
'500K table rows': {
|
|
592
|
+
label: "planFeature500kTableRows";
|
|
593
|
+
desc: "planFeatureDesc500kTableRows";
|
|
594
|
+
};
|
|
595
|
+
'100MB file storage': {
|
|
596
|
+
label: "planFeature100mbFileStorage";
|
|
597
|
+
desc: "planFeatureDesc100mbFileStorage";
|
|
598
|
+
};
|
|
599
|
+
'10GB file storage': {
|
|
600
|
+
label: "planFeature10gbFileStorage";
|
|
601
|
+
desc: "planFeatureDesc10gbFileStorage";
|
|
602
|
+
};
|
|
603
|
+
'50GB file storage': {
|
|
604
|
+
label: "planFeature50gbFileStorage";
|
|
605
|
+
desc: "planFeatureDesc50gbFileStorage";
|
|
606
|
+
};
|
|
607
|
+
'100MB vector DB storage': {
|
|
608
|
+
label: "planFeature100mbVectorDb";
|
|
609
|
+
desc: "planFeatureDesc100mbVectorDb";
|
|
610
|
+
};
|
|
611
|
+
'1GB vector DB storage': {
|
|
612
|
+
label: "planFeature1gbVectorDb";
|
|
613
|
+
desc: "planFeatureDesc1gbVectorDb";
|
|
614
|
+
};
|
|
615
|
+
'5GB vector DB storage': {
|
|
616
|
+
label: "planFeature5gbVectorDb";
|
|
617
|
+
desc: "planFeatureDesc5gbVectorDb";
|
|
618
|
+
};
|
|
619
|
+
'Community support': {
|
|
620
|
+
label: "planFeatureCommunitySupport";
|
|
621
|
+
desc: "planFeatureDescCommunitySupport";
|
|
622
|
+
};
|
|
623
|
+
'Unlimited AI agents': {
|
|
624
|
+
label: "planFeatureUnlimitedAiAgents";
|
|
625
|
+
desc: "planFeatureDescUnlimitedAiAgents";
|
|
626
|
+
};
|
|
627
|
+
'WhatsApp channel': {
|
|
628
|
+
label: "planFeatureWhatsappChannel";
|
|
629
|
+
desc: "planFeatureDescWhatsappChannel";
|
|
630
|
+
};
|
|
631
|
+
'Help Center custom domain': {
|
|
632
|
+
label: "planFeatureHelpCenterCustomDomain";
|
|
633
|
+
desc: "planFeatureDescHelpCenterCustomDomain";
|
|
634
|
+
};
|
|
635
|
+
'Whitelabel webchat': {
|
|
636
|
+
label: "planFeatureWhitelabelWebchat";
|
|
637
|
+
desc: "planFeatureDescWhitelabelWebchat";
|
|
638
|
+
};
|
|
639
|
+
'Technical support via live chat': {
|
|
640
|
+
label: "planFeatureTechnicalSupportLiveChat";
|
|
641
|
+
desc: "planFeatureDescTechnicalSupportLiveChat";
|
|
642
|
+
};
|
|
643
|
+
'Unlimited seats': {
|
|
644
|
+
label: "planFeatureUnlimitedSeats";
|
|
645
|
+
desc: "planFeatureDescUnlimitedSeats";
|
|
646
|
+
};
|
|
647
|
+
'Teams, routing & RBAC': {
|
|
648
|
+
label: "planFeatureTeamsRoutingRbac";
|
|
649
|
+
desc: "planFeatureDescTeamsRoutingRbac";
|
|
650
|
+
};
|
|
651
|
+
'Team-level analytics': {
|
|
652
|
+
label: "planFeatureTeamLevelAnalytics";
|
|
653
|
+
desc: "planFeatureDescTeamLevelAnalytics";
|
|
654
|
+
};
|
|
655
|
+
'Voice channel': {
|
|
656
|
+
label: "planFeatureVoiceChannel";
|
|
657
|
+
desc: "planFeatureDescVoiceChannel";
|
|
658
|
+
};
|
|
659
|
+
'Dedicated support': {
|
|
660
|
+
label: "planFeatureDedicatedSupport";
|
|
661
|
+
desc: "planFeatureDescDedicatedSupport";
|
|
662
|
+
};
|
|
663
|
+
'SLA & security review': {
|
|
664
|
+
label: "planFeatureSlaSecurity";
|
|
665
|
+
desc: "planFeatureDescSlaSecurity";
|
|
666
|
+
};
|
|
667
|
+
'Custom storage': {
|
|
668
|
+
label: "planFeatureCustomStorage";
|
|
669
|
+
desc: "planFeatureDescCustomStorage";
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
|
|
561
673
|
export declare const PLAN_ORDER: PlanKind[];
|
|
562
674
|
|
|
563
675
|
/**
|
|
@@ -585,6 +697,8 @@ export declare function planDisplayName(name: string): string;
|
|
|
585
697
|
*/
|
|
586
698
|
export declare function planEntitlements(plan: Plan | undefined, addons: Addon[] | undefined, quantities: Record<string, number>): Entitlement[];
|
|
587
699
|
|
|
700
|
+
export declare type PlanFeatureId = keyof typeof PLAN_FEATURE_KEYS;
|
|
701
|
+
|
|
588
702
|
/**
|
|
589
703
|
* Canonical plan kinds. Smaug plan ids/names vary by environment, so plans are
|
|
590
704
|
* classified by name — same heuristic as the dashboard's getPlanNameFromId.
|
|
@@ -722,6 +836,8 @@ export declare type SubscriptionUpdate = {
|
|
|
722
836
|
couponCode?: string;
|
|
723
837
|
};
|
|
724
838
|
|
|
839
|
+
export { SupportedLocale }
|
|
840
|
+
|
|
725
841
|
export declare type TaxId = Customer['taxIds'][number];
|
|
726
842
|
|
|
727
843
|
export declare function toStripeLocale(locale: string): string;
|
|
@@ -739,7 +855,7 @@ export declare type UpgradePlanDialogProps = {
|
|
|
739
855
|
/** Additional plan ids to hide. Enterprise + managed are always hidden. */
|
|
740
856
|
excludePlanIds?: string[];
|
|
741
857
|
/** Per-kind marketing feature strings; defaults to DEFAULT_PLAN_FEATURES (Desk copy). */
|
|
742
|
-
planFeatures?: Partial<Record<PlanKind,
|
|
858
|
+
planFeatures?: Partial<Record<PlanKind, PlanFeatureId[]>>;
|
|
743
859
|
/** Feature label → tooltip description; merged over DEFAULT_FEATURE_DESCRIPTIONS. */
|
|
744
860
|
featureDescriptions?: Record<string, string>;
|
|
745
861
|
};
|