@carlonicora/nextjs-jsonapi 2.4.0 → 3.0.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.
Files changed (128) hide show
  1. package/dist/{BlockNoteEditor-7WGCH2KB.js → BlockNoteEditor-CDTU6DRN.js} +19 -19
  2. package/dist/{BlockNoteEditor-7WGCH2KB.js.map → BlockNoteEditor-CDTU6DRN.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-GWAV5ESO.mjs → BlockNoteEditor-VVAY73V2.mjs} +4 -4
  4. package/dist/billing/index.d.mts +127 -46
  5. package/dist/billing/index.d.ts +127 -46
  6. package/dist/billing/index.js +1243 -1084
  7. package/dist/billing/index.js.map +1 -1
  8. package/dist/billing/index.mjs +983 -824
  9. package/dist/billing/index.mjs.map +1 -1
  10. package/dist/{chunk-V66AZWPG.js → chunk-53B6NPGA.js} +278 -8
  11. package/dist/chunk-53B6NPGA.js.map +1 -0
  12. package/dist/{chunk-M2EGUO2F.mjs → chunk-J54546YC.mjs} +1608 -1419
  13. package/dist/chunk-J54546YC.mjs.map +1 -0
  14. package/dist/{chunk-TOKHHZSP.js → chunk-JKGEJGSD.js} +7 -7
  15. package/dist/{chunk-TOKHHZSP.js.map → chunk-JKGEJGSD.js.map} +1 -1
  16. package/dist/{chunk-3LVSA7IM.mjs → chunk-PHEFWL6L.mjs} +2 -2
  17. package/dist/{chunk-LCCRUWWY.mjs → chunk-TWXKAY34.mjs} +273 -3
  18. package/dist/chunk-TWXKAY34.mjs.map +1 -0
  19. package/dist/{chunk-GYGMEDVS.js → chunk-UGNLKDI6.js} +1012 -823
  20. package/dist/chunk-UGNLKDI6.js.map +1 -0
  21. package/dist/client/index.js +4 -4
  22. package/dist/client/index.mjs +3 -3
  23. package/dist/components/index.d.mts +16 -1
  24. package/dist/components/index.d.ts +16 -1
  25. package/dist/components/index.js +4 -4
  26. package/dist/components/index.mjs +3 -3
  27. package/dist/{tokenusage-admin.module-5wJ_tZTj.d.ts → config-BIjrg5wd.d.ts} +39 -1
  28. package/dist/{tokenusage-admin.module-DQVT4O4j.d.mts → config-BRUjtCd1.d.mts} +39 -1
  29. package/dist/contexts/index.js +4 -4
  30. package/dist/contexts/index.mjs +3 -3
  31. package/dist/core/index.d.mts +22 -3
  32. package/dist/core/index.d.ts +22 -3
  33. package/dist/core/index.js +12 -2
  34. package/dist/core/index.js.map +1 -1
  35. package/dist/core/index.mjs +11 -1
  36. package/dist/features/help/index.js +37 -37
  37. package/dist/features/help/index.mjs +3 -3
  38. package/dist/features/tokenusage/index.d.mts +413 -14
  39. package/dist/features/tokenusage/index.d.ts +413 -14
  40. package/dist/features/tokenusage/index.js +481 -120
  41. package/dist/features/tokenusage/index.js.map +1 -1
  42. package/dist/features/tokenusage/index.mjs +431 -70
  43. package/dist/features/tokenusage/index.mjs.map +1 -1
  44. package/dist/index.d.mts +3 -3
  45. package/dist/index.d.ts +3 -3
  46. package/dist/index.js +13 -3
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +12 -2
  49. package/dist/server/index.js +3 -3
  50. package/dist/server/index.mjs +1 -1
  51. package/package.json +1 -1
  52. package/src/client/index.ts +4 -0
  53. package/src/core/index.ts +10 -0
  54. package/src/core/registry/ModuleRegistry.ts +4 -0
  55. package/src/features/administration/components/AdminIndexContainer.tsx +1 -1
  56. package/src/features/administration/components/__tests__/AdminIndexContainer.spec.tsx +1 -1
  57. package/src/features/billing/contexts/PriceContext.tsx +202 -0
  58. package/src/features/billing/contexts/ProductContext.tsx +185 -0
  59. package/src/features/billing/contexts/__tests__/PriceContext.spec.tsx +89 -0
  60. package/src/features/billing/contexts/__tests__/ProductContext.spec.tsx +81 -0
  61. package/src/features/billing/contexts/index.ts +2 -1
  62. package/src/features/billing/i18n-keys.ts +88 -0
  63. package/src/features/billing/stripe-price/components/containers/PriceContainer.tsx +21 -0
  64. package/src/features/billing/stripe-price/components/containers/index.ts +1 -0
  65. package/src/features/billing/stripe-price/components/details/PriceDetails.tsx +131 -0
  66. package/src/features/billing/stripe-price/components/details/index.ts +1 -0
  67. package/src/features/billing/stripe-price/components/forms/PriceArchiver.tsx +55 -0
  68. package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +307 -374
  69. package/src/features/billing/stripe-price/components/forms/index.ts +3 -1
  70. package/src/features/billing/stripe-price/components/index.ts +2 -0
  71. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +49 -267
  72. package/src/features/billing/stripe-price/data/index.ts +1 -0
  73. package/src/features/billing/stripe-price/data/stripe-price.fields.ts +8 -0
  74. package/src/features/billing/stripe-price/hooks/useStripePriceTableStructure.tsx +119 -0
  75. package/src/features/billing/stripe-price/stripe-price.module.ts +5 -1
  76. package/src/features/billing/stripe-product/components/containers/ProductContainer.tsx +45 -0
  77. package/src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx +27 -0
  78. package/src/features/billing/stripe-product/components/containers/index.ts +2 -2
  79. package/src/features/billing/stripe-product/components/details/ProductDetails.tsx +45 -0
  80. package/src/features/billing/stripe-product/components/details/index.ts +1 -0
  81. package/src/features/billing/stripe-product/components/forms/ProductArchiver.tsx +55 -0
  82. package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +92 -81
  83. package/src/features/billing/stripe-product/components/forms/index.ts +3 -1
  84. package/src/features/billing/stripe-product/components/index.ts +1 -0
  85. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +45 -187
  86. package/src/features/billing/stripe-product/data/index.ts +1 -0
  87. package/src/features/billing/stripe-product/data/stripe-product.fields.ts +6 -0
  88. package/src/features/billing/stripe-product/hooks/useStripeProductTableStructure.tsx +80 -0
  89. package/src/features/billing/stripe-product/stripe-product.module.ts +5 -1
  90. package/src/features/tokenusage/components/TokenUsageAdminContainer.tsx +20 -4
  91. package/src/features/tokenusage/components/TokenUsageAdminTiles.tsx +31 -18
  92. package/src/features/tokenusage/components/TokenUsageBreakdownTable.tsx +13 -13
  93. package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +24 -7
  94. package/src/features/tokenusage/components/TokenUsageReportContainer.tsx +102 -0
  95. package/src/features/tokenusage/components/TokenUsageReportFilterBar.tsx +34 -0
  96. package/src/features/tokenusage/components/TokenUsageReportTiles.tsx +161 -0
  97. package/src/features/tokenusage/components/TokenUsageTimelineChart.tsx +15 -13
  98. package/src/features/tokenusage/components/__tests__/TokenUsageAdminTiles.spec.tsx +4 -2
  99. package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +3 -1
  100. package/src/features/tokenusage/contexts/TokenUsageAdminContext.tsx +6 -3
  101. package/src/features/tokenusage/contexts/TokenUsageReportContext.tsx +199 -0
  102. package/src/features/tokenusage/data/TokenUsageReportService.ts +65 -0
  103. package/src/features/tokenusage/data/index.ts +9 -0
  104. package/src/features/tokenusage/data/tokenusage-report-breakdown.interface.ts +12 -0
  105. package/src/features/tokenusage/data/tokenusage-report-breakdown.ts +94 -0
  106. package/src/features/tokenusage/data/tokenusage-report-summary.interface.ts +12 -0
  107. package/src/features/tokenusage/data/tokenusage-report-summary.ts +87 -0
  108. package/src/features/tokenusage/data/tokenusage-report-timeline.interface.ts +13 -0
  109. package/src/features/tokenusage/data/tokenusage-report-timeline.ts +94 -0
  110. package/src/features/tokenusage/data/tokenusage-report.types.ts +51 -0
  111. package/src/features/tokenusage/i18n-keys.ts +28 -0
  112. package/src/features/tokenusage/index.ts +18 -0
  113. package/src/features/tokenusage/lib/config.ts +22 -0
  114. package/src/features/tokenusage/lib/formatters.ts +100 -0
  115. package/src/features/tokenusage/lib/metrics.ts +8 -26
  116. package/src/features/tokenusage/lib/palette.ts +41 -14
  117. package/src/features/tokenusage/tokenusage-admin.module.ts +4 -0
  118. package/src/features/tokenusage/tokenusage.modules.ts +40 -0
  119. package/src/shadcnui/ui/chart.tsx +30 -3
  120. package/dist/chunk-GYGMEDVS.js.map +0 -1
  121. package/dist/chunk-LCCRUWWY.mjs.map +0 -1
  122. package/dist/chunk-M2EGUO2F.mjs.map +0 -1
  123. package/dist/chunk-V66AZWPG.js.map +0 -1
  124. package/src/features/billing/contexts/BillingContext.tsx +0 -95
  125. package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +0 -98
  126. package/src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx +0 -27
  127. /package/dist/{BlockNoteEditor-GWAV5ESO.mjs.map → BlockNoteEditor-VVAY73V2.mjs.map} +0 -0
  128. /package/dist/{chunk-3LVSA7IM.mjs.map → chunk-PHEFWL6L.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { j as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, o as MeterSummaryInterface, d as StripePriceInterface, I as InvoiceStatus, g as StripeProductInterface, b as ProrationPreviewInterface, i as SubscriptionStatus, n as StripeUsageInterface, q as PromotionCodeValidationResult } from '../stripe-promotion-code.interface-ClZ7DxS9.mjs';
4
- import '../ApiDataInterface-BcZeXy5X.mjs';
3
+ import { j as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, o as MeterSummaryInterface, d as StripePriceInterface, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, n as StripeUsageInterface, q as PromotionCodeValidationResult } from '../stripe-promotion-code.interface-ClZ7DxS9.mjs';
4
+ import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.mjs';
5
5
  import '../feature.interface-CXb1-vNq.mjs';
6
6
 
7
7
  type SubscriptionSummaryCardProps = {
@@ -89,35 +89,65 @@ type BillingAlertBannerProps = {
89
89
  };
90
90
  declare function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }: BillingAlertBannerProps): React.JSX.Element | null;
91
91
 
92
- interface BillingContextType {
92
+ interface PriceContextType {
93
+ price: StripePriceInterface | undefined;
94
+ setPrice: (value: StripePriceInterface | undefined) => void;
95
+ reloadPrice: () => Promise<void>;
96
+ createPrice: (input: StripePriceInput) => Promise<StripePriceInterface>;
97
+ updatePrice: (input: StripePriceInput) => Promise<StripePriceInterface>;
98
+ archivePrice: (id?: string) => Promise<void>;
99
+ restorePrice: (id?: string) => Promise<void>;
100
+ /** Bumped by every mutation. Mounted lists re-fetch on it. */
101
+ priceVersion: number;
102
+ refreshPrices: () => void;
103
+ /** Product a newly created price attaches to. Set in list mode (prices tab). */
104
+ productId: string | undefined;
105
+ }
106
+ type PriceProviderProps = {
107
+ children: ReactNode;
108
+ dehydratedPrice?: JsonApiHydratedDataInterface;
93
109
  /**
94
- * Bumped every time the provider's own actions change the product catalogue.
95
- * ProductsAdminContainer reloads on it the create action lives up here in
96
- * the page title bar, so it cannot call the container's loader directly.
110
+ * Publish breadcrumbs + title into SharedProvider. Pass `false` when this
111
+ * provider is mounted INSIDE another entity's page (the prices tab mounts
112
+ * PriceProvider that way): SharedProvider replaces its value for the subtree
113
+ * rather than merging (SharedContext.tsx:35-37), so a nested provider that
114
+ * publishes chrome would blank the host page's title.
97
115
  */
98
- refreshToken: number;
99
- refresh: () => void;
116
+ publishChrome?: boolean;
117
+ /** Required in list mode (the prices tab) so new prices attach to the right product. */
118
+ productId?: string;
119
+ };
120
+ /** Human label for a price: its nickname, else amount + interval. */
121
+ declare function priceLabel(price: StripePriceInterface): string;
122
+ declare const PriceProvider: ({ children, dehydratedPrice, publishChrome, productId: productIdProp, }: PriceProviderProps) => React.JSX.Element;
123
+ declare const usePriceContext: () => PriceContextType;
124
+
125
+ interface ProductContextType {
126
+ product: StripeProductInterface | undefined;
127
+ setProduct: (value: StripeProductInterface | undefined) => void;
128
+ reloadProduct: () => Promise<void>;
129
+ createProduct: (input: StripeProductInput) => Promise<StripeProductInterface>;
130
+ updateProduct: (input: StripeProductInput) => Promise<StripeProductInterface>;
131
+ archiveProduct: (id?: string) => Promise<void>;
132
+ restoreProduct: (id?: string) => Promise<void>;
133
+ /** Bumped by every mutation. Mounted lists re-fetch on it. */
134
+ catalogueVersion: number;
135
+ refreshCatalogue: () => void;
100
136
  }
101
- type BillingProviderProps = {
137
+ type ProductProviderProps = {
102
138
  children: ReactNode;
139
+ dehydratedProduct?: JsonApiHydratedDataInterface;
140
+ /**
141
+ * Publish breadcrumbs + title into SharedProvider. Pass `false` when this
142
+ * provider is mounted INSIDE another entity's page (the prices tab mounts
143
+ * PriceProvider that way): SharedProvider replaces its value for the subtree
144
+ * rather than merging (SharedContext.tsx:35-37), so a nested provider that
145
+ * publishes chrome would blank the host page's title.
146
+ */
147
+ publishChrome?: boolean;
103
148
  };
104
- /**
105
- * Page chrome for the administrative billing surface (Stripe products, prices
106
- * and their credit allowances).
107
- *
108
- * Billing gets its own provider rather than borrowing AdministrationProvider so
109
- * the page carries its own name — and, like CompanyProvider with CompanyEditor,
110
- * it owns the page's ACTIONS: the create-product control is published through
111
- * `title.functions`, which RoundPageContainerTitle renders in the header bar.
112
- * That is where every other page in this codebase puts its primary action.
113
- */
114
- declare const BillingProvider: ({ children }: BillingProviderProps) => React.JSX.Element;
115
- declare const useBillingContext: () => BillingContextType;
116
- /**
117
- * Non-throwing variant. ProductsAdminContainer predates this provider and is
118
- * still mounted bare by other consumers, so it must keep working without one.
119
- */
120
- declare const useOptionalBillingContext: () => BillingContextType | undefined;
149
+ declare const ProductProvider: ({ children, dehydratedProduct, publishChrome }: ProductProviderProps) => React.JSX.Element;
150
+ declare const useProductContext: () => ProductContextType;
121
151
 
122
152
  declare function PaymentMethodsContainer(): React.JSX.Element;
123
153
 
@@ -168,45 +198,96 @@ type InvoiceStatusBadgeProps = {
168
198
  };
169
199
  declare function InvoiceStatusBadge({ status }: InvoiceStatusBadgeProps): React.JSX.Element;
170
200
 
201
+ declare function PriceContainer(): React.JSX.Element | null;
202
+
203
+ declare function PriceDetails(): React.JSX.Element | null;
204
+
205
+ type PriceArchiverProps = {
206
+ price: StripePriceInterface;
207
+ };
208
+ /**
209
+ * Archive / restore control for a price. Built on ConfirmDialog, which is
210
+ * controlled and trigger-less by design — the caller owns the trigger button,
211
+ * so none of Base UI's trigger-composition pitfalls apply (no asChild, no
212
+ * nested <button>).
213
+ */
214
+ declare function PriceArchiver({ price }: PriceArchiverProps): React.JSX.Element;
215
+
171
216
  type PriceEditorProps = {
172
- productId: string;
217
+ productId?: string;
173
218
  price?: StripePriceInterface;
174
- open: boolean;
175
- onOpenChange: (open: boolean) => void;
176
- onSuccess: () => void;
219
+ propagateChanges?: (price: StripePriceInterface) => void;
220
+ onSuccess?: () => void | Promise<void>;
221
+ trigger?: ReactNode;
222
+ forceShow?: boolean;
223
+ onClose?: () => void;
224
+ dialogOpen?: boolean;
225
+ onDialogOpenChange?: (open: boolean) => void;
177
226
  };
178
- declare function PriceEditor({ productId, price, open, onOpenChange, onSuccess }: PriceEditorProps): React.JSX.Element;
227
+ declare function PriceEditor(props: PriceEditorProps): React.JSX.Element;
179
228
 
180
229
  type PricesListProps = {
181
230
  productId: string;
182
- onPricesChange: () => void;
231
+ /**
232
+ * Only when the list IS the page's own content inside a `RoundPageContainer
233
+ * fullWidth`. Inside a tab panel leave it unset, or ContentListTable drops its
234
+ * own `rounded-md border` and the table floats borderless in the panel.
235
+ * Mirrors ThreatList, which is rendered both ways.
236
+ */
237
+ fullWidth?: boolean;
183
238
  };
184
- declare function PricesList({ productId, onPricesChange }: PricesListProps): React.JSX.Element;
239
+ declare function PricesList({ productId, fullWidth }: PricesListProps): React.JSX.Element;
185
240
 
186
- declare function ProductsAdminContainer(): React.JSX.Element;
241
+ declare function ProductContainer(): React.JSX.Element | null;
187
242
 
188
243
  /**
189
- * Page shell around the Stripe product/price administration surface.
244
+ * Page container for the administrative product list.
190
245
  *
191
246
  * Client component by necessity: `module={Modules.StripeProduct}` is a registry
192
- * entry with an icon component and methods, which a Server Component cannot pass
193
- * across the boundary.
247
+ * entry carrying an icon component and methods, which a Server Component cannot
248
+ * pass across the boundary. Routes mount this container instead — the same
249
+ * shape as every other list page.
250
+ *
251
+ * No `forceHeader`: ContentListTable draws its own header row with the title
252
+ * and the create action, exactly as the company and user list pages do.
194
253
  */
195
- declare function ProductsAdminPageContainer(): React.JSX.Element;
254
+ declare function ProductsListContainer(): React.JSX.Element;
255
+
256
+ declare function ProductDetails(): React.JSX.Element | null;
257
+
258
+ type ProductArchiverProps = {
259
+ product: StripeProductInterface;
260
+ };
261
+ /**
262
+ * Archive / restore control for a product. Built on ConfirmDialog, which is
263
+ * controlled and trigger-less by design — the caller owns the trigger button,
264
+ * so none of Base UI's trigger-composition pitfalls apply (no asChild, no
265
+ * nested <button>).
266
+ */
267
+ declare function ProductArchiver({ product }: ProductArchiverProps): React.JSX.Element;
196
268
 
197
269
  type ProductEditorProps = {
198
270
  product?: StripeProductInterface;
199
- open: boolean;
200
- onOpenChange: (open: boolean) => void;
201
- onSuccess: () => void;
271
+ propagateChanges?: (product: StripeProductInterface) => void;
272
+ onSuccess?: () => void | Promise<void>;
273
+ trigger?: ReactNode;
274
+ forceShow?: boolean;
275
+ onClose?: () => void;
276
+ dialogOpen?: boolean;
277
+ onDialogOpenChange?: (open: boolean) => void;
202
278
  };
203
- declare function ProductEditor({ product, open, onOpenChange, onSuccess }: ProductEditorProps): React.JSX.Element;
279
+ declare function ProductEditor(props: ProductEditorProps): React.JSX.Element;
204
280
 
205
281
  type ProductsListProps = {
206
- products: StripeProductInterface[];
207
- onProductsChange: () => void;
282
+ /**
283
+ * Pass this whenever the list is the page's own content inside a
284
+ * `RoundPageContainer fullWidth`. Without it ContentListTable wraps itself in
285
+ * `rounded-md border`, drawing a second bordered card inside the page's
286
+ * rounded shell.
287
+ */
288
+ fullWidth?: boolean;
208
289
  };
209
- declare function ProductsList({ products, onProductsChange }: ProductsListProps): React.JSX.Element;
290
+ declare function ProductsList({ fullWidth }?: ProductsListProps): React.JSX.Element;
210
291
 
211
292
  type SubscriptionsContainerProps = {
212
293
  onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
@@ -328,4 +409,4 @@ type PromoCodeInputProps = {
328
409
  };
329
410
  declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
330
411
 
331
- export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingProvider, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor, PricesList, PricingCard, type PricingCardProps, ProductEditor, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductsAdminContainer, ProductsAdminPageContainer, ProductsList, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured, useBillingContext, useOptionalBillingContext };
412
+ export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceArchiver, PriceContainer, type PriceContextType, PriceDetails, PriceEditor, type PriceEditorProps, PriceProvider, type PriceProviderProps, PricesList, PricingCard, type PricingCardProps, ProductArchiver, ProductContainer, type ProductContextType, ProductDetails, ProductEditor, type ProductEditorProps, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductProvider, type ProductProviderProps, ProductsList, ProductsListContainer, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured, priceLabel, usePriceContext, useProductContext };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { j as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, o as MeterSummaryInterface, d as StripePriceInterface, I as InvoiceStatus, g as StripeProductInterface, b as ProrationPreviewInterface, i as SubscriptionStatus, n as StripeUsageInterface, q as PromotionCodeValidationResult } from '../stripe-promotion-code.interface-C3qqh3mi.js';
4
- import '../ApiDataInterface-BcZeXy5X.js';
3
+ import { j as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, o as MeterSummaryInterface, d as StripePriceInterface, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, n as StripeUsageInterface, q as PromotionCodeValidationResult } from '../stripe-promotion-code.interface-C3qqh3mi.js';
4
+ import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.js';
5
5
  import '../feature.interface-BO25VLlx.js';
6
6
 
7
7
  type SubscriptionSummaryCardProps = {
@@ -89,35 +89,65 @@ type BillingAlertBannerProps = {
89
89
  };
90
90
  declare function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }: BillingAlertBannerProps): React.JSX.Element | null;
91
91
 
92
- interface BillingContextType {
92
+ interface PriceContextType {
93
+ price: StripePriceInterface | undefined;
94
+ setPrice: (value: StripePriceInterface | undefined) => void;
95
+ reloadPrice: () => Promise<void>;
96
+ createPrice: (input: StripePriceInput) => Promise<StripePriceInterface>;
97
+ updatePrice: (input: StripePriceInput) => Promise<StripePriceInterface>;
98
+ archivePrice: (id?: string) => Promise<void>;
99
+ restorePrice: (id?: string) => Promise<void>;
100
+ /** Bumped by every mutation. Mounted lists re-fetch on it. */
101
+ priceVersion: number;
102
+ refreshPrices: () => void;
103
+ /** Product a newly created price attaches to. Set in list mode (prices tab). */
104
+ productId: string | undefined;
105
+ }
106
+ type PriceProviderProps = {
107
+ children: ReactNode;
108
+ dehydratedPrice?: JsonApiHydratedDataInterface;
93
109
  /**
94
- * Bumped every time the provider's own actions change the product catalogue.
95
- * ProductsAdminContainer reloads on it the create action lives up here in
96
- * the page title bar, so it cannot call the container's loader directly.
110
+ * Publish breadcrumbs + title into SharedProvider. Pass `false` when this
111
+ * provider is mounted INSIDE another entity's page (the prices tab mounts
112
+ * PriceProvider that way): SharedProvider replaces its value for the subtree
113
+ * rather than merging (SharedContext.tsx:35-37), so a nested provider that
114
+ * publishes chrome would blank the host page's title.
97
115
  */
98
- refreshToken: number;
99
- refresh: () => void;
116
+ publishChrome?: boolean;
117
+ /** Required in list mode (the prices tab) so new prices attach to the right product. */
118
+ productId?: string;
119
+ };
120
+ /** Human label for a price: its nickname, else amount + interval. */
121
+ declare function priceLabel(price: StripePriceInterface): string;
122
+ declare const PriceProvider: ({ children, dehydratedPrice, publishChrome, productId: productIdProp, }: PriceProviderProps) => React.JSX.Element;
123
+ declare const usePriceContext: () => PriceContextType;
124
+
125
+ interface ProductContextType {
126
+ product: StripeProductInterface | undefined;
127
+ setProduct: (value: StripeProductInterface | undefined) => void;
128
+ reloadProduct: () => Promise<void>;
129
+ createProduct: (input: StripeProductInput) => Promise<StripeProductInterface>;
130
+ updateProduct: (input: StripeProductInput) => Promise<StripeProductInterface>;
131
+ archiveProduct: (id?: string) => Promise<void>;
132
+ restoreProduct: (id?: string) => Promise<void>;
133
+ /** Bumped by every mutation. Mounted lists re-fetch on it. */
134
+ catalogueVersion: number;
135
+ refreshCatalogue: () => void;
100
136
  }
101
- type BillingProviderProps = {
137
+ type ProductProviderProps = {
102
138
  children: ReactNode;
139
+ dehydratedProduct?: JsonApiHydratedDataInterface;
140
+ /**
141
+ * Publish breadcrumbs + title into SharedProvider. Pass `false` when this
142
+ * provider is mounted INSIDE another entity's page (the prices tab mounts
143
+ * PriceProvider that way): SharedProvider replaces its value for the subtree
144
+ * rather than merging (SharedContext.tsx:35-37), so a nested provider that
145
+ * publishes chrome would blank the host page's title.
146
+ */
147
+ publishChrome?: boolean;
103
148
  };
104
- /**
105
- * Page chrome for the administrative billing surface (Stripe products, prices
106
- * and their credit allowances).
107
- *
108
- * Billing gets its own provider rather than borrowing AdministrationProvider so
109
- * the page carries its own name — and, like CompanyProvider with CompanyEditor,
110
- * it owns the page's ACTIONS: the create-product control is published through
111
- * `title.functions`, which RoundPageContainerTitle renders in the header bar.
112
- * That is where every other page in this codebase puts its primary action.
113
- */
114
- declare const BillingProvider: ({ children }: BillingProviderProps) => React.JSX.Element;
115
- declare const useBillingContext: () => BillingContextType;
116
- /**
117
- * Non-throwing variant. ProductsAdminContainer predates this provider and is
118
- * still mounted bare by other consumers, so it must keep working without one.
119
- */
120
- declare const useOptionalBillingContext: () => BillingContextType | undefined;
149
+ declare const ProductProvider: ({ children, dehydratedProduct, publishChrome }: ProductProviderProps) => React.JSX.Element;
150
+ declare const useProductContext: () => ProductContextType;
121
151
 
122
152
  declare function PaymentMethodsContainer(): React.JSX.Element;
123
153
 
@@ -168,45 +198,96 @@ type InvoiceStatusBadgeProps = {
168
198
  };
169
199
  declare function InvoiceStatusBadge({ status }: InvoiceStatusBadgeProps): React.JSX.Element;
170
200
 
201
+ declare function PriceContainer(): React.JSX.Element | null;
202
+
203
+ declare function PriceDetails(): React.JSX.Element | null;
204
+
205
+ type PriceArchiverProps = {
206
+ price: StripePriceInterface;
207
+ };
208
+ /**
209
+ * Archive / restore control for a price. Built on ConfirmDialog, which is
210
+ * controlled and trigger-less by design — the caller owns the trigger button,
211
+ * so none of Base UI's trigger-composition pitfalls apply (no asChild, no
212
+ * nested <button>).
213
+ */
214
+ declare function PriceArchiver({ price }: PriceArchiverProps): React.JSX.Element;
215
+
171
216
  type PriceEditorProps = {
172
- productId: string;
217
+ productId?: string;
173
218
  price?: StripePriceInterface;
174
- open: boolean;
175
- onOpenChange: (open: boolean) => void;
176
- onSuccess: () => void;
219
+ propagateChanges?: (price: StripePriceInterface) => void;
220
+ onSuccess?: () => void | Promise<void>;
221
+ trigger?: ReactNode;
222
+ forceShow?: boolean;
223
+ onClose?: () => void;
224
+ dialogOpen?: boolean;
225
+ onDialogOpenChange?: (open: boolean) => void;
177
226
  };
178
- declare function PriceEditor({ productId, price, open, onOpenChange, onSuccess }: PriceEditorProps): React.JSX.Element;
227
+ declare function PriceEditor(props: PriceEditorProps): React.JSX.Element;
179
228
 
180
229
  type PricesListProps = {
181
230
  productId: string;
182
- onPricesChange: () => void;
231
+ /**
232
+ * Only when the list IS the page's own content inside a `RoundPageContainer
233
+ * fullWidth`. Inside a tab panel leave it unset, or ContentListTable drops its
234
+ * own `rounded-md border` and the table floats borderless in the panel.
235
+ * Mirrors ThreatList, which is rendered both ways.
236
+ */
237
+ fullWidth?: boolean;
183
238
  };
184
- declare function PricesList({ productId, onPricesChange }: PricesListProps): React.JSX.Element;
239
+ declare function PricesList({ productId, fullWidth }: PricesListProps): React.JSX.Element;
185
240
 
186
- declare function ProductsAdminContainer(): React.JSX.Element;
241
+ declare function ProductContainer(): React.JSX.Element | null;
187
242
 
188
243
  /**
189
- * Page shell around the Stripe product/price administration surface.
244
+ * Page container for the administrative product list.
190
245
  *
191
246
  * Client component by necessity: `module={Modules.StripeProduct}` is a registry
192
- * entry with an icon component and methods, which a Server Component cannot pass
193
- * across the boundary.
247
+ * entry carrying an icon component and methods, which a Server Component cannot
248
+ * pass across the boundary. Routes mount this container instead — the same
249
+ * shape as every other list page.
250
+ *
251
+ * No `forceHeader`: ContentListTable draws its own header row with the title
252
+ * and the create action, exactly as the company and user list pages do.
194
253
  */
195
- declare function ProductsAdminPageContainer(): React.JSX.Element;
254
+ declare function ProductsListContainer(): React.JSX.Element;
255
+
256
+ declare function ProductDetails(): React.JSX.Element | null;
257
+
258
+ type ProductArchiverProps = {
259
+ product: StripeProductInterface;
260
+ };
261
+ /**
262
+ * Archive / restore control for a product. Built on ConfirmDialog, which is
263
+ * controlled and trigger-less by design — the caller owns the trigger button,
264
+ * so none of Base UI's trigger-composition pitfalls apply (no asChild, no
265
+ * nested <button>).
266
+ */
267
+ declare function ProductArchiver({ product }: ProductArchiverProps): React.JSX.Element;
196
268
 
197
269
  type ProductEditorProps = {
198
270
  product?: StripeProductInterface;
199
- open: boolean;
200
- onOpenChange: (open: boolean) => void;
201
- onSuccess: () => void;
271
+ propagateChanges?: (product: StripeProductInterface) => void;
272
+ onSuccess?: () => void | Promise<void>;
273
+ trigger?: ReactNode;
274
+ forceShow?: boolean;
275
+ onClose?: () => void;
276
+ dialogOpen?: boolean;
277
+ onDialogOpenChange?: (open: boolean) => void;
202
278
  };
203
- declare function ProductEditor({ product, open, onOpenChange, onSuccess }: ProductEditorProps): React.JSX.Element;
279
+ declare function ProductEditor(props: ProductEditorProps): React.JSX.Element;
204
280
 
205
281
  type ProductsListProps = {
206
- products: StripeProductInterface[];
207
- onProductsChange: () => void;
282
+ /**
283
+ * Pass this whenever the list is the page's own content inside a
284
+ * `RoundPageContainer fullWidth`. Without it ContentListTable wraps itself in
285
+ * `rounded-md border`, drawing a second bordered card inside the page's
286
+ * rounded shell.
287
+ */
288
+ fullWidth?: boolean;
208
289
  };
209
- declare function ProductsList({ products, onProductsChange }: ProductsListProps): React.JSX.Element;
290
+ declare function ProductsList({ fullWidth }?: ProductsListProps): React.JSX.Element;
210
291
 
211
292
  type SubscriptionsContainerProps = {
212
293
  onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
@@ -328,4 +409,4 @@ type PromoCodeInputProps = {
328
409
  };
329
410
  declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
330
411
 
331
- export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingProvider, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceEditor, PricesList, PricingCard, type PricingCardProps, ProductEditor, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductsAdminContainer, ProductsAdminPageContainer, ProductsList, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured, useBillingContext, useOptionalBillingContext };
412
+ export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceArchiver, PriceContainer, type PriceContextType, PriceDetails, PriceEditor, type PriceEditorProps, PriceProvider, type PriceProviderProps, PricesList, PricingCard, type PricingCardProps, ProductArchiver, ProductContainer, type ProductContextType, ProductDetails, ProductEditor, type ProductEditorProps, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductProvider, type ProductProviderProps, ProductsList, ProductsListContainer, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, formatCurrency, formatDate, formatInterval, isStripeConfigured, priceLabel, usePriceContext, useProductContext };