@bpinternal/billing-ui 0.16.0 → 0.18.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
@@ -53,7 +53,7 @@ export declare function addonPrice(addon: Addon, plan: Plan, interval: BillingIn
53
53
  * Clickable summary of active add-ons (current quantities from the live
54
54
  * subscription). Acts as a preview button that opens add-on management.
55
55
  */
56
- export declare const AddonsSummaryCard: ({ onManage, className }: AddonsSummaryCardProps) => JSX.Element;
56
+ export declare const AddonsSummaryCard: ({ onManage, className }: AddonsSummaryCardProps) => JSX.Element | null;
57
57
 
58
58
  export declare type AddonsSummaryCardProps = {
59
59
  /** Opens the manage-add-ons dialog. */
@@ -61,9 +61,11 @@ export declare type AddonsSummaryCardProps = {
61
61
  className?: string;
62
62
  };
63
63
 
64
+ export declare const AgentsIcon: ({ size, ...props }: IconProps) => JSX.Element;
65
+
64
66
  export declare const ArrowRightIcon: ({ size, ...props }: IconProps) => JSX.Element;
65
67
 
66
- export declare const AutoRechargeDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: AutoRechargeDialogProps) => JSX.Element;
68
+ export declare const AutoRechargeDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: AutoRechargeDialogProps) => JSX.Element | null;
67
69
 
68
70
  export declare type AutoRechargeDialogProps = {
69
71
  open: boolean;
@@ -178,10 +180,17 @@ export declare type BillingChangeEvent = {
178
180
  */
179
181
  export declare type BillingClient = Pick<billing.Client, 'listPlans' | 'listAddons' | 'getSubscription' | 'previewSubscriptionUpdate' | 'setPlan' | 'setAddons' | 'getPaymentMethod' | 'createPaymentMethodIntent' | 'setPaymentMethod' | 'getCustomer' | 'setCustomer' | 'listInvoices' | 'getBillingReadonly' | 'getWorkspaceUsages' | 'getAutoRechargeSettings' | 'setAutoRechargeSettings'> &
180
182
  /**
181
- * Per-bot usage breakdown is OPTIONAL: those methods live on the generic
182
- * `@botpress/client` (not the billing client), so a host that wants the per-bot
183
- * view passes a client object that also exposes them. Omit them and the
184
- * UsageDashboard hides the per-bot section. Still type-only — no runtime dep.
183
+ * `getWorkspaceMember` lives on the generic `@botpress/client`, not the
184
+ * billing client, but is REQUIRED here: `useIsAuthorized` depends on it to
185
+ * check the caller's workspace membership. Every host must pass a client
186
+ * object that also exposes it. Still type-only — no runtime dep.
187
+ */
188
+ Pick<Client, 'getWorkspaceMember'> &
189
+ /**
190
+ * Per-bot usage breakdown is OPTIONAL: those methods also live on the
191
+ * generic `@botpress/client`, but only a host that wants the per-bot view
192
+ * needs to pass a client exposing them. Omit them and the UsageDashboard
193
+ * hides the per-bot section.
185
194
  */
186
195
  Partial<Pick<Client, 'breakDownWorkspaceUsageByBot' | 'listBots'>>;
187
196
 
@@ -225,6 +234,7 @@ export declare const billingKeys: {
225
234
  customer: (scope: string) => readonly ["bpb", string, "customer"];
226
235
  invoices: (scope: string) => readonly ["bpb", string, "invoices"];
227
236
  readonly: (scope: string) => readonly ["bpb", string, "billing-readonly"];
237
+ isAuthorized: (scope: string) => readonly ["bpb", string, "is-authorized"];
228
238
  autoRecharge: (scope: string) => readonly ["bpb", string, "auto-recharge"];
229
239
  usages: (scope: string, period: string) => readonly ["bpb", string, "usages", string];
230
240
  bots: (scope: string) => readonly ["bpb", string, "bots"];
@@ -336,7 +346,7 @@ export declare const CheckIcon: ({ size, ...props }: IconProps) => JSX.Element;
336
346
  * the subscribe button share the same Stripe context. The SetupIntent itself is only
337
347
  * requested from CheckoutBody at Subscribe time, not eagerly on open.
338
348
  */
339
- export declare const CheckoutDialog: ({ open, onOpenChange, planId, interval, onBack, onSuccess }: CheckoutDialogProps) => JSX.Element;
349
+ export declare const CheckoutDialog: ({ open, onOpenChange, planId, interval, onBack, onSuccess }: CheckoutDialogProps) => JSX.Element | null;
340
350
 
341
351
  export declare type CheckoutDialogProps = {
342
352
  open: boolean;
@@ -454,6 +464,8 @@ declare type IconProps = SVGProps<SVGSVGElement> & {
454
464
  size?: number;
455
465
  };
456
466
 
467
+ export declare const InboxIcon: ({ size, ...props }: IconProps) => JSX.Element;
468
+
457
469
  export declare const InfinityIcon: ({ size, ...props }: IconProps) => JSX.Element;
458
470
 
459
471
  /**
@@ -484,7 +496,7 @@ export declare type Invoice = Awaited<ReturnType<BillingClient['listInvoices']>>
484
496
  * Read-only billing history. Lists invoices newest-first with status, amount,
485
497
  * period, and a PDF download when Stripe provides one.
486
498
  */
487
- export declare const InvoicesDialog: ({ open, onOpenChange }: InvoicesDialogProps) => JSX.Element;
499
+ export declare const InvoicesDialog: ({ open, onOpenChange }: InvoicesDialogProps) => JSX.Element | null;
488
500
 
489
501
  export declare type InvoicesDialogProps = {
490
502
  open: boolean;
@@ -512,7 +524,7 @@ export declare const LockIcon: ({ size, ...props }: IconProps) => JSX.Element;
512
524
  * first), totals computed client-side, committed as absolute quantities via
513
525
  * setAddons — 0 removes an add-on. No plan change involved.
514
526
  */
515
- export declare const ManageAddonsDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: ManageAddonsDialogProps) => JSX.Element;
527
+ export declare const ManageAddonsDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: ManageAddonsDialogProps) => JSX.Element | null;
516
528
 
517
529
  export declare type ManageAddonsDialogProps = {
518
530
  open: boolean;
@@ -586,7 +598,7 @@ export declare type PaymentMethodCard = NonNullable<PaymentMethod['card']>;
586
598
  * confirmCardSetup (no address required), then persisted; address is saved
587
599
  * independently — matching Desk's separation.
588
600
  */
589
- export declare const PaymentMethodDialog: ({ open, onOpenChange, onSuccess }: PaymentMethodDialogProps) => JSX.Element;
601
+ export declare const PaymentMethodDialog: ({ open, onOpenChange, onSuccess }: PaymentMethodDialogProps) => JSX.Element | null;
590
602
 
591
603
  export declare type PaymentMethodDialogProps = {
592
604
  open: boolean;
@@ -618,6 +630,10 @@ export declare const PLAN_FEATURE_KEYS: {
618
630
  label: "planFeatureBotpressStudioAdk";
619
631
  desc: "planFeatureDescBotpressStudioAdk";
620
632
  };
633
+ 'Botpress Viber': {
634
+ label: "planFeatureBotpressViber";
635
+ desc: "planFeatureDescBotpressViber";
636
+ };
621
637
  'Help center': {
622
638
  label: "planFeatureHelpCenter";
623
639
  desc: "planFeatureDescHelpCenter";
@@ -658,10 +674,6 @@ export declare const PLAN_FEATURE_KEYS: {
658
674
  label: "planFeature5gbVectorDb";
659
675
  desc: "planFeatureDesc5gbVectorDb";
660
676
  };
661
- 'Community support': {
662
- label: "planFeatureCommunitySupport";
663
- desc: "planFeatureDescCommunitySupport";
664
- };
665
677
  'Unlimited AI agents': {
666
678
  label: "planFeatureUnlimitedAiAgents";
667
679
  desc: "planFeatureDescUnlimitedAiAgents";
@@ -721,7 +733,7 @@ export declare const PLAN_ORDER: PlanKind[];
721
733
  * renews (paid, self-serve plans only), plus a manage CTA. On legacy billing
722
734
  * it deep-links to the Dashboard.
723
735
  */
724
- export declare const PlanBanner: ({ onManage, className }: PlanBannerProps) => JSX.Element;
736
+ export declare const PlanBanner: ({ onManage, className }: PlanBannerProps) => JSX.Element | null;
725
737
 
726
738
  export declare type PlanBannerProps = {
727
739
  /** Opens the plan picker / checkout. */
@@ -754,7 +766,7 @@ export declare function planKind(plan: Pick<Plan, 'name' | 'metadata'>): PlanKin
754
766
  * Clickable summary of the current plan — name, interval, price, conversation
755
767
  * allowance. Acts as a preview button that opens the plan-management flow.
756
768
  */
757
- export declare const PlanSummaryCard: ({ onManage, className }: PlanSummaryCardProps) => JSX.Element;
769
+ export declare const PlanSummaryCard: ({ onManage, className }: PlanSummaryCardProps) => JSX.Element | null;
758
770
 
759
771
  export declare type PlanSummaryCardProps = {
760
772
  /** Opens the plan picker / checkout. */
@@ -901,7 +913,7 @@ export declare type TaxId = Customer['taxIds'][number];
901
913
 
902
914
  export declare function toStripeLocale(locale: string): string;
903
915
 
904
- export declare const UpgradePlanDialog: ({ open, onOpenChange, onSelectPlan, recommendedPlanId, defaultInterval, excludePlanIds, planFeatures, featureDescriptions, }: UpgradePlanDialogProps) => JSX.Element;
916
+ export declare const UpgradePlanDialog: ({ open, onOpenChange, onSelectPlan, recommendedPlanId, defaultInterval, excludePlanIds, planFeatures, featureDescriptions, }: UpgradePlanDialogProps) => JSX.Element | null;
905
917
 
906
918
  export declare type UpgradePlanDialogProps = {
907
919
  open: boolean;
@@ -1103,7 +1115,8 @@ export declare function useInvoices(options?: QueryOptions): UseQueryResult<{
1103
1115
  };
1104
1116
  }, Error>;
1105
1117
 
1106
- export declare function useIsAuthorized(): boolean | Error | undefined;
1118
+ /** Whether the caller's role (via `getWorkspaceMember`) has `workspace.manageBilling`. */
1119
+ export declare function useIsAuthorized(options?: QueryOptions): UseQueryResult<boolean, Error>;
1107
1120
 
1108
1121
  export declare function usePaymentMethod(options?: QueryOptions): UseQueryResult<{
1109
1122
  paymentMethod: PaymentMethod | null;
@@ -1155,6 +1168,9 @@ export declare function useUsageByBot(type: string, options?: QueryOptions & {
1155
1168
  period?: string;
1156
1169
  }): UseQueryResult<BotUsageRow[], Error>;
1157
1170
 
1171
+ /** The caller's own workspace membership, as returned by `getWorkspaceMember`. */
1172
+ export declare type WorkspaceMember = Awaited<ReturnType<Client['getWorkspaceMember']>>;
1173
+
1158
1174
  export declare type WorkspaceUsages = Awaited<ReturnType<BillingClient['getWorkspaceUsages']>>['quotas'];
1159
1175
 
1160
1176
  export { }