@metrifox/react-sdk 0.0.20 → 2.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.
package/dist/index.d.ts CHANGED
@@ -1,20 +1,48 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType } from 'react';
3
3
 
4
+ /**
5
+ * Pricing Table theme. All properties are optional.
6
+ * The theme follows the same structure as CustomerPortalTheme:
7
+ * - Plan-related keys (planCards, planButton, etc.) are nested under `plans`
8
+ * - Additional top-level keys: `tabs`, `checkoutBar`
9
+ */
4
10
  interface PricingTableTheme {
5
- card?: CardTheme;
6
- button?: ButtonTheme;
7
- featureList?: FeatureListTheme;
11
+ general?: {
12
+ fontFamily?: string;
13
+ };
14
+ plans?: PricingTablePlansTheme;
8
15
  tabs?: TabsTheme;
9
- intervalToggle?: IntervalToggleTheme;
10
- currentSubscriptionCard?: CurrentSubscriptionCard;
11
- freeTrialTag?: FreeTrialTheme;
16
+ select?: SelectTheme;
12
17
  checkoutBar?: CheckoutBarTheme;
13
18
  }
14
- interface CardTheme {
19
+ interface SelectTheme {
15
20
  background?: string;
16
21
  borderColor?: string;
17
- descriptionColor?: string;
22
+ textColor?: string;
23
+ placeholderColor?: string;
24
+ /** Color of the dropdown arrow (caret) icon */
25
+ caretColor?: string;
26
+ dropdownBackground?: string;
27
+ dropdownBorderColor?: string;
28
+ optionTextColor?: string;
29
+ optionHoverBackground?: string;
30
+ }
31
+ interface PricingTablePlansTheme {
32
+ currentPlanCard?: CurrentSubscriptionCard;
33
+ planCards?: CardTheme;
34
+ planFeatures?: FeatureListTheme;
35
+ planButton?: PlanButtonTheme;
36
+ planToggle?: IntervalToggleTheme;
37
+ planTags?: PlanTagsTheme;
38
+ }
39
+ interface CardTheme {
40
+ background?: string;
41
+ border?: {
42
+ color?: string;
43
+ width?: string;
44
+ radius?: string;
45
+ };
18
46
  header?: CardHeaderTheme;
19
47
  description?: CardDescriptionTheme;
20
48
  price?: CardPriceTheme;
@@ -31,11 +59,10 @@ interface CardPriceTheme {
31
59
  amountColor?: string;
32
60
  primaryTextColor?: string;
33
61
  secondaryTextColor?: string;
34
- textButtonColor?: string;
35
62
  background?: string;
36
63
  borderColor?: string;
37
64
  }
38
- interface ButtonTheme {
65
+ interface PlanButtonTheme {
39
66
  background?: string;
40
67
  textColor?: string;
41
68
  secondaryBackground?: string;
@@ -61,10 +88,12 @@ interface IntervalToggleTheme {
61
88
  interface CurrentSubscriptionCard {
62
89
  header: CardHeaderTheme;
63
90
  gradientColor?: string;
91
+ description?: CardDescriptionTheme;
92
+ borderRadius?: string;
64
93
  }
65
- interface FreeTrialTheme {
66
- background?: string;
67
- textColor?: string;
94
+ interface PlanTagsTheme {
95
+ freeTrialBackground?: string;
96
+ freeTrialText?: string;
68
97
  }
69
98
  interface CheckoutBarTheme {
70
99
  background?: string;
@@ -74,61 +103,247 @@ interface CheckoutBarTheme {
74
103
  buttonTextColor?: string;
75
104
  }
76
105
 
106
+ /**
107
+ * Customer Portal theme. All properties are optional.
108
+ * This shape matches what is defined in defaultCustomerPortalTheme and what
109
+ * customerPortalThemeToCssVars maps to CSS variables. Only theme groups
110
+ * that exist in the default theme or are supported by the helper are included.
111
+ */
77
112
  type CustomerPortalTheme = {
113
+ general?: {
114
+ linkColor?: string;
115
+ fontFamily?: string;
116
+ borderRadius?: string;
117
+ backgroundColor?: string;
118
+ containerPadding?: string;
119
+ };
78
120
  tabs?: {
121
+ tabBackground?: string;
122
+ tabBorderColor?: string;
123
+ activeTabBackground?: string;
124
+ activeTabTextColor?: string;
125
+ inactiveTabTextColor?: string;
126
+ };
127
+ select?: {
79
128
  background?: string;
80
129
  borderColor?: string;
81
- activeBackground?: string;
82
- activeTextColor?: string;
83
- inactiveTextColor?: string;
130
+ textColor?: string;
131
+ /** Color of the dropdown arrow (caret) icon */
132
+ caretColor?: string;
133
+ dropdownBackground?: string;
134
+ dropdownBorderColor?: string;
135
+ optionTextColor?: string;
136
+ optionHoverBackground?: string;
84
137
  };
85
- section?: {
138
+ sections?: {
86
139
  background?: string;
87
- titleTextColor?: string;
88
- contentBackground?: string;
140
+ padding?: string;
141
+ borderColor?: string;
142
+ borderRadius?: string;
143
+ content?: {
144
+ background?: string;
145
+ padding?: string;
146
+ borderColor?: string;
147
+ borderRadius?: string;
148
+ };
149
+ summaryBalance?: {
150
+ background?: string;
151
+ padding?: string;
152
+ borderColor?: string;
153
+ borderRadius?: string;
154
+ label?: {
155
+ fontSize?: string;
156
+ fontWeight?: string;
157
+ color?: string;
158
+ };
159
+ value?: {
160
+ fontSize?: string;
161
+ fontWeight?: string;
162
+ color?: string;
163
+ };
164
+ unit?: {
165
+ fontSize?: string;
166
+ fontWeight?: string;
167
+ color?: string;
168
+ };
169
+ };
170
+ header?: {
171
+ fontSize?: string;
172
+ fontWeight?: string;
173
+ color?: string;
174
+ };
175
+ label?: {
176
+ fontSize?: string;
177
+ fontWeight?: string;
178
+ color?: string;
179
+ };
180
+ value?: {
181
+ fontSize?: string;
182
+ fontWeight?: string;
183
+ color?: string;
184
+ };
89
185
  iconBackground?: string;
90
186
  iconColor?: string;
91
187
  emptyTextColor?: string;
188
+ usage?: {
189
+ barColor?: string;
190
+ trackColor?: string;
191
+ };
92
192
  };
93
- card?: {
94
- titleBackground?: string;
95
- contentBackground?: string;
96
- titleColor?: string;
97
- details?: {
98
- labelColor?: string;
99
- valueColor?: string;
193
+ buttons?: {
194
+ primary?: {
195
+ backgroundColor?: string;
196
+ border?: {
197
+ color?: string;
198
+ width?: string;
199
+ radius?: string;
200
+ };
201
+ typography?: {
202
+ fontSize?: string;
203
+ fontWeight?: string;
204
+ color?: string;
205
+ };
206
+ };
207
+ secondary?: {
208
+ backgroundColor?: string;
209
+ border?: {
210
+ color?: string;
211
+ width?: string;
212
+ radius?: string;
213
+ };
214
+ typography?: {
215
+ fontSize?: string;
216
+ fontWeight?: string;
217
+ color?: string;
218
+ };
100
219
  };
101
220
  };
102
- subscription?: {
103
- items?: {
221
+ lineItems?: {
222
+ parentRow?: {
104
223
  background?: string;
105
224
  borderColor?: string;
106
- textColor?: string;
225
+ borderRadius?: string;
226
+ typography?: {
227
+ label?: {
228
+ fontSize?: string;
229
+ fontWeight?: string;
230
+ color?: string;
231
+ };
232
+ quantity?: {
233
+ fontSize?: string;
234
+ color?: string;
235
+ };
236
+ };
237
+ spacing?: {
238
+ paddingTop?: string;
239
+ paddingRight?: string;
240
+ paddingBottom?: string;
241
+ paddingLeft?: string;
242
+ };
243
+ expandIconColor?: string;
244
+ expandIconSize?: string;
245
+ };
246
+ childRow?: {
247
+ background?: string;
248
+ borderColor?: string;
249
+ borderRadius?: string;
250
+ typography?: {
251
+ label?: {
252
+ fontSize?: string;
253
+ fontWeight?: string;
254
+ color?: string;
255
+ };
256
+ quantity?: {
257
+ fontSize?: string;
258
+ color?: string;
259
+ };
260
+ };
261
+ spacing?: {
262
+ paddingTop?: string;
263
+ paddingRight?: string;
264
+ paddingBottom?: string;
265
+ paddingLeft?: string;
266
+ };
107
267
  };
108
268
  };
109
- table?: {
269
+ tables?: {
270
+ headerBackground?: string;
110
271
  headerTextColor?: string;
111
- textColor?: string;
272
+ rowBackgroundOdd?: string;
273
+ rowBackgroundEven?: string;
274
+ rowTextColor?: string;
275
+ borderColor?: string;
276
+ cellPadding?: string;
277
+ expandIconColor?: string;
278
+ typography?: {
279
+ fontSize?: string;
280
+ fontWeight?: string;
281
+ headerFontSize?: string;
282
+ headerFontWeight?: string;
283
+ };
284
+ pagination?: {
285
+ background?: string;
286
+ activeBackground?: string;
287
+ textColor?: string;
288
+ activeTextColor?: string;
289
+ borderColor?: string;
290
+ borderRadius?: string;
291
+ };
112
292
  };
113
- button?: {
293
+ modals?: {
294
+ overlayColor?: string;
114
295
  background?: string;
115
- textColor?: string;
116
- };
117
- filter?: {
118
- border?: string;
119
- activeBackground?: string;
120
- inactiveBackground?: string;
121
- activeTextColor?: string;
122
- inactiveTextColor?: string;
123
- countBackground?: string;
124
- countTextColor?: string;
296
+ borderColor?: string;
297
+ borderRadius?: string;
298
+ closeButtonColor?: string;
299
+ header?: {
300
+ fontSize?: string;
301
+ fontWeight?: string;
302
+ color?: string;
303
+ };
304
+ title?: {
305
+ fontSize?: string;
306
+ fontWeight?: string;
307
+ color?: string;
308
+ };
309
+ description?: {
310
+ fontSize?: string;
311
+ fontWeight?: string;
312
+ color?: string;
313
+ };
314
+ footer?: {
315
+ primary?: {
316
+ backgroundColor?: string;
317
+ textColor?: string;
318
+ borderColor?: string;
319
+ borderWidth?: string;
320
+ borderRadius?: string;
321
+ };
322
+ secondary?: {
323
+ backgroundColor?: string;
324
+ textColor?: string;
325
+ borderColor?: string;
326
+ borderWidth?: string;
327
+ borderRadius?: string;
328
+ };
329
+ };
125
330
  };
126
- linkColor?: string;
127
- plan?: {
128
- card?: {
331
+ plans?: {
332
+ currentPlanCard?: {
333
+ header?: {
334
+ background?: string;
335
+ textColor?: string;
336
+ };
337
+ gradientColor?: string;
338
+ borderRadius?: string;
339
+ };
340
+ planCards?: {
129
341
  background?: string;
130
- borderColor?: string;
131
- descriptionColor?: string;
342
+ border?: {
343
+ color?: string;
344
+ width?: string;
345
+ radius?: string;
346
+ };
132
347
  header?: {
133
348
  background?: string;
134
349
  textColor?: string;
@@ -141,38 +356,61 @@ type CustomerPortalTheme = {
141
356
  amountColor?: string;
142
357
  primaryTextColor?: string;
143
358
  secondaryTextColor?: string;
144
- textButtonColor?: string;
145
359
  background?: string;
146
360
  borderColor?: string;
147
361
  };
148
362
  };
149
- button?: {
150
- background?: string;
363
+ planFeatures?: {
151
364
  textColor?: string;
152
- secondaryBackground?: string;
153
- secondaryTextColor?: string;
154
- textButtonColor?: string;
365
+ iconColor?: string;
155
366
  };
156
- featureList?: {
367
+ planButton?: {
368
+ background?: string;
157
369
  textColor?: string;
158
- iconColor?: string;
159
370
  };
160
- intervalToggle?: {
371
+ planToggle?: {
161
372
  background?: string;
162
373
  activeBackground?: string;
163
374
  activeText?: string;
164
375
  inactiveText?: string;
165
376
  };
166
- currentSubscriptionCard?: {
167
- header?: {
168
- background?: string;
169
- textColor?: string;
170
- };
171
- gradientColor?: string;
377
+ planTags?: {
378
+ freeTrialBackground?: string;
379
+ freeTrialText?: string;
172
380
  };
173
- freeTrialTag?: {
381
+ };
382
+ /** Banner variants (e.g. info banner for scheduled change / undo cancellation). */
383
+ banners?: {
384
+ info?: {
174
385
  background?: string;
175
386
  textColor?: string;
387
+ borderRadius?: string;
388
+ buttonBorderColor?: string;
389
+ buttonTextColor?: string;
390
+ };
391
+ };
392
+ /** Used by e.g. subscription line-item actions. Not set in default theme; pass to override. */
393
+ popover?: {
394
+ trigger?: {
395
+ background?: string;
396
+ iconColor?: string;
397
+ borderColor?: string;
398
+ borderRadius?: string;
399
+ };
400
+ menu?: {
401
+ background?: string;
402
+ borderColor?: string;
403
+ borderRadius?: string;
404
+ /** Padding applied to each menu item (e.g. "0.25rem 1rem"). */
405
+ itemPadding?: string;
406
+ itemHoverBackground?: string;
407
+ itemDividerColor?: string;
408
+ typography?: {
409
+ fontSize?: string;
410
+ fontWeight?: string;
411
+ color?: string;
412
+ dangerColor?: string;
413
+ };
176
414
  };
177
415
  };
178
416
  };
@@ -235,11 +473,17 @@ declare enum OneOffType {
235
473
  FLAT = "flat",
236
474
  PERCENTAGE = "percentage"
237
475
  }
476
+ declare enum ScheduledChangeType {
477
+ UPGRADE = "upgrade",
478
+ DOWNGRADE = "downgrade",
479
+ ADDON_REMOVE = "addon_remove"
480
+ }
238
481
 
239
482
  type SectionKey = "upcomingInvoice" | "subscription" | "creditBalance" | "entitlementUsage" | "paymentOverview" | "billingHistory" | "plan";
240
483
  interface CustomerPortalProps {
241
484
  customerKey: string;
242
485
  sectionsConfig?: SectionConfig[];
486
+ theme?: CustomerPortalTheme;
243
487
  }
244
488
  interface SectionConfig {
245
489
  key: SectionKey;
@@ -298,6 +542,7 @@ interface SubscriptionProps {
298
542
  subscription_items: ISubscriptionItems[];
299
543
  upcoming_invoice: IUpcomingInvoice | null;
300
544
  can_update_quantities: boolean;
545
+ scheduled_change?: ScheduledChangeType | null;
301
546
  }
302
547
  interface ISubscriptionItems {
303
548
  price_option_id: string;
@@ -380,6 +625,8 @@ interface Offering {
380
625
  base_entitlements_plan_name: string;
381
626
  version_id: string;
382
627
  is_invoiceable: boolean;
628
+ product_key?: string;
629
+ product_currency_code?: string;
383
630
  }
384
631
  interface PriceOption {
385
632
  metadata: Record<string, string>;
@@ -525,7 +772,7 @@ interface Feature {
525
772
  created_at: string;
526
773
  }
527
774
 
528
- declare const CustomerPortal: ({ customerKey, sectionsConfig }: CustomerPortalProps) => react_jsx_runtime.JSX.Element;
775
+ declare const CustomerPortal: ({ customerKey, sectionsConfig, theme }: CustomerPortalProps) => react_jsx_runtime.JSX.Element;
529
776
 
530
777
  declare const PriceCard: ({ plan, interval, featureOrderMap, isPricePage, isCustomerPortal, statusTag, addPriceButton, buttonText, isCurrentPlan, planActions, cardAction, buttonAction, }: {
531
778
  plan: Offering;
@@ -542,12 +789,15 @@ declare const PriceCard: ({ plan, interval, featureOrderMap, isPricePage, isCust
542
789
  buttonAction?: () => void;
543
790
  }) => react_jsx_runtime.JSX.Element | null;
544
791
 
545
- declare const PricingTable: ({ checkoutUsername, productKey, plansOnly, singlePurchasesOnly, showTabHeader, }: {
792
+ declare const PricingTable: ({ checkoutUsername, productKey, plansOnly, singlePurchasesOnly, showTabHeader, theme: themeOverride, currentPlanOfferingKey, }: {
546
793
  checkoutUsername: string;
547
794
  productKey: string;
548
795
  plansOnly?: boolean;
549
796
  singlePurchasesOnly?: boolean;
550
797
  showTabHeader?: boolean;
798
+ theme?: PricingTableTheme;
799
+ /** When set, the plan with this offering_key is rendered as the current plan (shows currentPlanCard theme + gradient). Use in demo/Storybook to preview gradient. */
800
+ currentPlanOfferingKey?: string;
551
801
  }) => react_jsx_runtime.JSX.Element;
552
802
 
553
803
  declare const useCheckoutUrl: () => {