@flexprice/flexprice-ui 0.1.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/README.md +73 -0
- package/dist/flexprice-ui.cjs +223 -0
- package/dist/flexprice-ui.cjs.map +1 -0
- package/dist/flexprice-ui.d.mts +330 -0
- package/dist/flexprice-ui.mjs +14071 -0
- package/dist/flexprice-ui.mjs.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { CreditGrant } from '../models';
|
|
2
|
+
import { EntitlementResponse } from '../types';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { PlanResponse } from '../types';
|
|
5
|
+
import { PlanType } from '../constants/planTypes';
|
|
6
|
+
import { PriceResponse } from '../types';
|
|
7
|
+
import { default as PricingCard } from '../components/molecules/PricingCard/PricingCard';
|
|
8
|
+
import { PricingCardProps } from '../components/molecules/PricingCard/PricingCard';
|
|
9
|
+
import { UsageCharge } from '../components/molecules/PricingCard/PricingCard';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
/** Map one filtered plan (+ its credit grants) into a presentational `Plan` (PricingCardProps). */
|
|
13
|
+
export declare function adaptPlanToCard(plan: PlanWithData, grants: CreditGrant[]): Plan;
|
|
14
|
+
|
|
15
|
+
/** A per-plan credit grant line. */
|
|
16
|
+
export declare type CreditGrantLine = NonNullable<PricingCardProps['creditGrants']>[number];
|
|
17
|
+
|
|
18
|
+
declare interface CurrencyPeriodOptions {
|
|
19
|
+
allCurrencyOptions: PricingOption[];
|
|
20
|
+
allPeriodOptions: PricingOption[];
|
|
21
|
+
availableCurrencyOptions: PricingOption[];
|
|
22
|
+
availablePeriodOptions: PricingOption[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Collect currency / period options and narrow them by the current selection. */
|
|
26
|
+
export declare function deriveCurrencyPeriodOptions(plans: PlanWithData[], selectedCurrency: string, selectedBillingPeriod: string): CurrencyPeriodOptions;
|
|
27
|
+
|
|
28
|
+
/** An entitlement (feature) line as rendered by the widget. */
|
|
29
|
+
export declare type Feature = PricingCardProps['entitlements'][number];
|
|
30
|
+
|
|
31
|
+
/** Filter each plan's prices to the active currency + period, drop empty plans, and sort for display. */
|
|
32
|
+
export declare function filterAndSortPlans(plans: PlanWithData[], selectedCurrency: string, selectedBillingPeriod: string): PlanWithData[];
|
|
33
|
+
|
|
34
|
+
/** Pick the currency + billing period that shows the most plans (preferring recurring pricing). */
|
|
35
|
+
export declare const findBestPriceCombination: (plans: PlanWithData[], availableCurrencyOptions: Array<{
|
|
36
|
+
value: string;
|
|
37
|
+
}>, availablePeriodOptions: Array<{
|
|
38
|
+
value: string;
|
|
39
|
+
}>) => {
|
|
40
|
+
currency: string;
|
|
41
|
+
period: string;
|
|
42
|
+
hasPreferred: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export declare const getPriceDisplayType: (prices: PriceLike[]) => PlanType;
|
|
46
|
+
|
|
47
|
+
export declare const isRecurringPrice: (price: PriceLike) => boolean;
|
|
48
|
+
|
|
49
|
+
export declare const isUsageBasedPrice: (price: PriceLike) => boolean;
|
|
50
|
+
|
|
51
|
+
export declare function mapCreditGrantToCardProps(grant: CreditGrant): NonNullable<Plan['creditGrants']>[number];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Validate + normalize an unknown `plans` input into safe `Plan[]`.
|
|
55
|
+
* - Non-array input → `[]` (reported).
|
|
56
|
+
* - Each entry is coerced where possible; entries without a usable `id` are dropped.
|
|
57
|
+
* - Invalid entries are reported through `onValidationError` (default: `console.warn` in dev).
|
|
58
|
+
*/
|
|
59
|
+
export declare function normalizePlans(input: unknown, onValidationError?: (issue: PlanValidationIssue) => void): Plan[];
|
|
60
|
+
|
|
61
|
+
/** A single, fully-presentational plan the widget renders. Alias of the card's prop shape. */
|
|
62
|
+
export declare type Plan = PricingCardProps;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A single plan. `.passthrough()` preserves consumer-supplied callback props (onSelectPlan,
|
|
66
|
+
* getFeatureHref, flags) untouched while the data-bearing fields are validated/coerced.
|
|
67
|
+
* `id` is the only truly required field — without it a plan can't be keyed or selected, so it's
|
|
68
|
+
* dropped rather than repaired.
|
|
69
|
+
*/
|
|
70
|
+
export declare const PlanSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
73
|
+
description: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
74
|
+
price: z.ZodCatch<z.ZodObject<{
|
|
75
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
76
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
77
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
78
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
79
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
80
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
81
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
82
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
83
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
84
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
85
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
86
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
87
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
88
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
89
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
90
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
91
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
92
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
93
|
+
usageCharges: z.ZodCatch<z.ZodArray<z.ZodUnknown, "many">>;
|
|
94
|
+
entitlements: z.ZodCatch<z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
96
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
97
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
98
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
99
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
100
|
+
description: z.ZodOptional<z.ZodString>;
|
|
101
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
103
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
104
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
105
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
106
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
107
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
108
|
+
description: z.ZodOptional<z.ZodString>;
|
|
109
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
111
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
112
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
113
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
114
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
115
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
116
|
+
description: z.ZodOptional<z.ZodString>;
|
|
117
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
119
|
+
creditGrants: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
120
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
121
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
122
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
123
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
125
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
126
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
127
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
128
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
130
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
131
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
132
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
133
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>>;
|
|
135
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
138
|
+
description: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
139
|
+
price: z.ZodCatch<z.ZodObject<{
|
|
140
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
141
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
142
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
143
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
144
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
145
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
146
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
147
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
148
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
149
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
150
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
151
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
152
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
153
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
154
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
155
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
156
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
157
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
158
|
+
usageCharges: z.ZodCatch<z.ZodArray<z.ZodUnknown, "many">>;
|
|
159
|
+
entitlements: z.ZodCatch<z.ZodArray<z.ZodObject<{
|
|
160
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
161
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
162
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
163
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
164
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
168
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
169
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
170
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
171
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
172
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
173
|
+
description: z.ZodOptional<z.ZodString>;
|
|
174
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
176
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
177
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
178
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
179
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
180
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
181
|
+
description: z.ZodOptional<z.ZodString>;
|
|
182
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
184
|
+
creditGrants: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
186
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
187
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
188
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
190
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
191
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
192
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
193
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
195
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
196
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
197
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
198
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
199
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>>;
|
|
200
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
201
|
+
id: z.ZodString;
|
|
202
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
203
|
+
description: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
204
|
+
price: z.ZodCatch<z.ZodObject<{
|
|
205
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
206
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
207
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
208
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
209
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
210
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
211
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
212
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
213
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
214
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
215
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
216
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
217
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
218
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
219
|
+
billingPeriod: z.ZodOptional<z.ZodString>;
|
|
220
|
+
type: z.ZodOptional<z.ZodUnknown>;
|
|
221
|
+
displayType: z.ZodCatch<z.ZodNativeEnum<typeof PlanType>>;
|
|
222
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
223
|
+
usageCharges: z.ZodCatch<z.ZodArray<z.ZodUnknown, "many">>;
|
|
224
|
+
entitlements: z.ZodCatch<z.ZodArray<z.ZodObject<{
|
|
225
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
226
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
227
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
228
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
229
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
230
|
+
description: z.ZodOptional<z.ZodString>;
|
|
231
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
232
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
233
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
234
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
235
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
236
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
237
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
238
|
+
description: z.ZodOptional<z.ZodString>;
|
|
239
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
240
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
241
|
+
id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
242
|
+
feature_id: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
243
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
244
|
+
type: z.ZodCatch<z.ZodEnum<["STATIC", "BOOLEAN", "METERED", "CONFIG"]>>;
|
|
245
|
+
value: z.ZodCatch<z.ZodNullable<z.ZodUnknown>>;
|
|
246
|
+
description: z.ZodOptional<z.ZodString>;
|
|
247
|
+
usage_reset_period: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
249
|
+
creditGrants: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
250
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
251
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
252
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
253
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
254
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
255
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
256
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
257
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
258
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
259
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
260
|
+
name: z.ZodCatch<z.ZodEffects<z.ZodString, string, unknown>>;
|
|
261
|
+
credits: z.ZodCatch<z.ZodNumber>;
|
|
262
|
+
cadence: z.ZodCatch<z.ZodEnum<["onetime", "recurring"]>>;
|
|
263
|
+
period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>>;
|
|
265
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
266
|
+
|
|
267
|
+
export { PlanType }
|
|
268
|
+
|
|
269
|
+
export declare interface PlanValidationIssue {
|
|
270
|
+
index: number;
|
|
271
|
+
issues: z.ZodIssue[];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export declare type PlanWithData = PlanResponse & {
|
|
275
|
+
prices: PriceResponse[];
|
|
276
|
+
entitlements: EntitlementResponse[];
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
declare type PriceLike = Pick<PriceResponse, 'currency' | 'billing_period' | 'billing_model' | 'type' | 'amount' | 'tiers' | 'meter' | 'invoice_cadence'>;
|
|
280
|
+
|
|
281
|
+
export { PricingCard }
|
|
282
|
+
|
|
283
|
+
export { PricingCardProps }
|
|
284
|
+
|
|
285
|
+
/** A `{ label, value }` option for the currency / billing-period selectors. */
|
|
286
|
+
export declare interface PricingOption {
|
|
287
|
+
label: string;
|
|
288
|
+
value: string;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Prop-only pricing grid — no fetching, no auth, no routing. Renders the currency /
|
|
293
|
+
* billing-period selectors and a responsive grid of {@link PricingCard}s. Consumers supply
|
|
294
|
+
* already-filtered `plans` plus controlled selector state and callbacks.
|
|
295
|
+
*/
|
|
296
|
+
export declare const PricingTable: FC<PricingTableProps>;
|
|
297
|
+
|
|
298
|
+
/** Props for the prop-only `<PricingTable />` — no fetching, no auth, no routing. */
|
|
299
|
+
export declare interface PricingTableProps {
|
|
300
|
+
/** Plans to render, already filtered to the active currency + billing period. */
|
|
301
|
+
plans: Plan[];
|
|
302
|
+
/** Controlled billing-period selection. */
|
|
303
|
+
billingPeriod: string;
|
|
304
|
+
onBillingPeriodChange: (value: string) => void;
|
|
305
|
+
billingPeriodOptions: PricingOption[];
|
|
306
|
+
/** Placeholder for the billing-period selector (pass a translated string). */
|
|
307
|
+
billingPeriodPlaceholder?: string;
|
|
308
|
+
/** Controlled currency selection. */
|
|
309
|
+
currency: string;
|
|
310
|
+
onCurrencyChange: (value: string) => void;
|
|
311
|
+
currencyOptions: PricingOption[];
|
|
312
|
+
/** Placeholder for the currency selector (pass a translated string). */
|
|
313
|
+
currencyPlaceholder?: string;
|
|
314
|
+
/** Invoked when a plan's CTA is clicked. Consumers wire their own navigation/checkout. */
|
|
315
|
+
onSelectPlan?: (planId: string) => void;
|
|
316
|
+
/** Optional link target for a feature name; return undefined for plain text (default). */
|
|
317
|
+
getFeatureHref?: (featureId: string) => string | undefined;
|
|
318
|
+
/** Hide the currency / billing-period selectors (e.g. single-currency embeds). */
|
|
319
|
+
hideFilters?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Called for each `plans` entry that failed runtime validation (dropped) or was coerced.
|
|
322
|
+
* Use it to log/report bad SDK input. Defaults to a dev-only `console.warn`.
|
|
323
|
+
*/
|
|
324
|
+
onValidationError?: (issue: PlanValidationIssue) => void;
|
|
325
|
+
className?: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export { UsageCharge }
|
|
329
|
+
|
|
330
|
+
export { }
|