@growflowstudio/growflowbooking-admin-core 1.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.mts +518 -0
- package/dist/index.d.ts +518 -0
- package/dist/index.js +729 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +652 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
/** Generic JSON value type */
|
|
5
|
+
type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
|
6
|
+
type JsonObject = {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
type JsonArray = JsonValue[];
|
|
10
|
+
/** Paginated response wrapper */
|
|
11
|
+
interface PaginatedResponse<T> {
|
|
12
|
+
items: T[];
|
|
13
|
+
total: number;
|
|
14
|
+
page?: number;
|
|
15
|
+
page_size?: number;
|
|
16
|
+
}
|
|
17
|
+
/** HTTP fetcher function type — provided by the host application */
|
|
18
|
+
type Fetcher = (url: string, options?: FetcherOptions) => Promise<unknown>;
|
|
19
|
+
interface FetcherOptions {
|
|
20
|
+
method?: string;
|
|
21
|
+
body?: unknown;
|
|
22
|
+
params?: Record<string, string | number | boolean | undefined>;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Subscription plan tier for a tenant */
|
|
27
|
+
type TenantPlan = 'free' | 'starter' | 'professional' | 'enterprise';
|
|
28
|
+
/** Admin tenant list item */
|
|
29
|
+
interface AdminTenant {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
plan: TenantPlan;
|
|
34
|
+
is_active: boolean;
|
|
35
|
+
owner_email: string;
|
|
36
|
+
logo_url: string | null;
|
|
37
|
+
domain: string | null;
|
|
38
|
+
max_services: number;
|
|
39
|
+
max_staff: number;
|
|
40
|
+
max_locations: number;
|
|
41
|
+
created_at: string;
|
|
42
|
+
updated_at: string;
|
|
43
|
+
}
|
|
44
|
+
/** Admin tenant detail (includes stats) */
|
|
45
|
+
interface AdminTenantDetail extends AdminTenant {
|
|
46
|
+
services_count: number;
|
|
47
|
+
staff_count: number;
|
|
48
|
+
locations_count: number;
|
|
49
|
+
customers_count: number;
|
|
50
|
+
bookings_count: number;
|
|
51
|
+
billing_subscription_id: string | null;
|
|
52
|
+
billing_subscriber_id: string | null;
|
|
53
|
+
}
|
|
54
|
+
/** Tenant resource limits */
|
|
55
|
+
interface TenantLimits {
|
|
56
|
+
max_services: number;
|
|
57
|
+
max_staff: number;
|
|
58
|
+
max_locations: number;
|
|
59
|
+
max_customers: number;
|
|
60
|
+
max_bookings_per_month: number;
|
|
61
|
+
}
|
|
62
|
+
/** Create tenant request */
|
|
63
|
+
interface AdminTenantCreate {
|
|
64
|
+
name: string;
|
|
65
|
+
slug: string;
|
|
66
|
+
owner_email: string;
|
|
67
|
+
plan?: TenantPlan;
|
|
68
|
+
domain?: string;
|
|
69
|
+
max_services?: number;
|
|
70
|
+
max_staff?: number;
|
|
71
|
+
max_locations?: number;
|
|
72
|
+
}
|
|
73
|
+
/** Update tenant request */
|
|
74
|
+
interface AdminTenantUpdate {
|
|
75
|
+
name?: string;
|
|
76
|
+
slug?: string;
|
|
77
|
+
owner_email?: string;
|
|
78
|
+
domain?: string;
|
|
79
|
+
logo_url?: string | null;
|
|
80
|
+
}
|
|
81
|
+
/** Update tenant limits request */
|
|
82
|
+
interface AdminTenantLimitsUpdate {
|
|
83
|
+
max_services?: number;
|
|
84
|
+
max_staff?: number;
|
|
85
|
+
max_locations?: number;
|
|
86
|
+
max_customers?: number;
|
|
87
|
+
max_bookings_per_month?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Customer with tenant info */
|
|
91
|
+
interface CustomerWithTenant {
|
|
92
|
+
id: string;
|
|
93
|
+
tenant_id: string;
|
|
94
|
+
tenant_name: string;
|
|
95
|
+
email: string;
|
|
96
|
+
first_name: string;
|
|
97
|
+
last_name: string;
|
|
98
|
+
phone: string | null;
|
|
99
|
+
is_active: boolean;
|
|
100
|
+
notes: string | null;
|
|
101
|
+
created_at: string;
|
|
102
|
+
updated_at: string;
|
|
103
|
+
}
|
|
104
|
+
/** Create customer request */
|
|
105
|
+
interface AdminCustomerCreate {
|
|
106
|
+
tenant_id: string;
|
|
107
|
+
email: string;
|
|
108
|
+
first_name: string;
|
|
109
|
+
last_name: string;
|
|
110
|
+
phone?: string;
|
|
111
|
+
notes?: string;
|
|
112
|
+
}
|
|
113
|
+
/** Update customer request */
|
|
114
|
+
interface AdminCustomerUpdate {
|
|
115
|
+
email?: string;
|
|
116
|
+
first_name?: string;
|
|
117
|
+
last_name?: string;
|
|
118
|
+
phone?: string;
|
|
119
|
+
is_active?: boolean;
|
|
120
|
+
notes?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Pricing model for subscription plans */
|
|
124
|
+
type PlanPricingModel = 'flat' | 'tiered' | 'usage_based';
|
|
125
|
+
/** Feature included in a subscription plan */
|
|
126
|
+
interface PlanFeature {
|
|
127
|
+
slug: string;
|
|
128
|
+
name: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
included: boolean;
|
|
131
|
+
limit?: number;
|
|
132
|
+
}
|
|
133
|
+
/** Subscription plan (local DB) */
|
|
134
|
+
interface SubscriptionPlan {
|
|
135
|
+
id: string;
|
|
136
|
+
slug: string;
|
|
137
|
+
name: string;
|
|
138
|
+
description: string | null;
|
|
139
|
+
pricing_model: PlanPricingModel;
|
|
140
|
+
price_monthly: number | null;
|
|
141
|
+
price_yearly: number | null;
|
|
142
|
+
currency: string;
|
|
143
|
+
features: PlanFeature[];
|
|
144
|
+
limits: Record<string, number>;
|
|
145
|
+
trial_days: number;
|
|
146
|
+
is_active: boolean;
|
|
147
|
+
sort_order: number;
|
|
148
|
+
created_at: string;
|
|
149
|
+
updated_at: string;
|
|
150
|
+
}
|
|
151
|
+
/** Subscription plan list response */
|
|
152
|
+
interface SubscriptionPlanList {
|
|
153
|
+
items: SubscriptionPlan[];
|
|
154
|
+
total: number;
|
|
155
|
+
}
|
|
156
|
+
/** Create subscription plan request */
|
|
157
|
+
interface SubscriptionPlanCreate {
|
|
158
|
+
slug: string;
|
|
159
|
+
name: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
pricing_model?: PlanPricingModel;
|
|
162
|
+
price_monthly?: number;
|
|
163
|
+
price_yearly?: number;
|
|
164
|
+
currency?: string;
|
|
165
|
+
features?: PlanFeature[];
|
|
166
|
+
limits?: Record<string, number>;
|
|
167
|
+
trial_days?: number;
|
|
168
|
+
is_active?: boolean;
|
|
169
|
+
sort_order?: number;
|
|
170
|
+
}
|
|
171
|
+
/** Update subscription plan request */
|
|
172
|
+
interface SubscriptionPlanUpdate {
|
|
173
|
+
name?: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
pricing_model?: PlanPricingModel;
|
|
176
|
+
price_monthly?: number;
|
|
177
|
+
price_yearly?: number;
|
|
178
|
+
currency?: string;
|
|
179
|
+
features?: PlanFeature[];
|
|
180
|
+
limits?: Record<string, number>;
|
|
181
|
+
trial_days?: number;
|
|
182
|
+
is_active?: boolean;
|
|
183
|
+
sort_order?: number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Billing plan from GrowFlow Billing (proxy) */
|
|
187
|
+
interface BillingPlan {
|
|
188
|
+
id: string;
|
|
189
|
+
slug: string;
|
|
190
|
+
name: string;
|
|
191
|
+
description: string | null;
|
|
192
|
+
pricingModel: string;
|
|
193
|
+
priceMonthly: number | null;
|
|
194
|
+
priceYearly: number | null;
|
|
195
|
+
currency: string;
|
|
196
|
+
limits: Record<string, number>;
|
|
197
|
+
features: string[];
|
|
198
|
+
trialDays: number;
|
|
199
|
+
isActive: boolean;
|
|
200
|
+
contactSales: boolean;
|
|
201
|
+
color: string;
|
|
202
|
+
sortOrder: number;
|
|
203
|
+
stripeMonthlyPriceId: string | null;
|
|
204
|
+
stripeYearlyPriceId: string | null;
|
|
205
|
+
createdAt: string;
|
|
206
|
+
updatedAt: string;
|
|
207
|
+
}
|
|
208
|
+
/** Billing plan list response */
|
|
209
|
+
interface BillingPlanList {
|
|
210
|
+
items: BillingPlan[];
|
|
211
|
+
total: number;
|
|
212
|
+
}
|
|
213
|
+
/** Create billing plan request */
|
|
214
|
+
interface CreateBillingPlanRequest {
|
|
215
|
+
slug: string;
|
|
216
|
+
name: string;
|
|
217
|
+
description?: string;
|
|
218
|
+
pricingModel?: string;
|
|
219
|
+
priceMonthly?: number;
|
|
220
|
+
priceYearly?: number;
|
|
221
|
+
currency?: string;
|
|
222
|
+
limits?: Record<string, number>;
|
|
223
|
+
features?: string[];
|
|
224
|
+
trialDays?: number;
|
|
225
|
+
isActive?: boolean;
|
|
226
|
+
contactSales?: boolean;
|
|
227
|
+
color?: string;
|
|
228
|
+
}
|
|
229
|
+
/** Update billing plan request */
|
|
230
|
+
interface UpdateBillingPlanRequest {
|
|
231
|
+
name?: string;
|
|
232
|
+
description?: string;
|
|
233
|
+
pricingModel?: string;
|
|
234
|
+
priceMonthly?: number;
|
|
235
|
+
priceYearly?: number;
|
|
236
|
+
currency?: string;
|
|
237
|
+
limits?: Record<string, number>;
|
|
238
|
+
features?: string[];
|
|
239
|
+
trialDays?: number;
|
|
240
|
+
isActive?: boolean;
|
|
241
|
+
contactSales?: boolean;
|
|
242
|
+
color?: string;
|
|
243
|
+
}
|
|
244
|
+
/** Billing subscription status */
|
|
245
|
+
type BillingSubscriptionStatus = 'active' | 'trialing' | 'past_due' | 'canceled' | 'unpaid' | 'incomplete';
|
|
246
|
+
/** Billing subscription from GrowFlow Billing (proxy) */
|
|
247
|
+
interface BillingSubscription {
|
|
248
|
+
id: string;
|
|
249
|
+
subscriberId: string;
|
|
250
|
+
subscriberExternalId: string;
|
|
251
|
+
subscriberEmail: string;
|
|
252
|
+
subscriberName: string | null;
|
|
253
|
+
planId: string;
|
|
254
|
+
planSlug: string;
|
|
255
|
+
planName: string;
|
|
256
|
+
stripeSubscriptionId: string | null;
|
|
257
|
+
status: BillingSubscriptionStatus;
|
|
258
|
+
billingCycle: 'monthly' | 'yearly';
|
|
259
|
+
currentPeriodStart: string | null;
|
|
260
|
+
currentPeriodEnd: string | null;
|
|
261
|
+
trialStart: string | null;
|
|
262
|
+
trialEnd: string | null;
|
|
263
|
+
canceledAt: string | null;
|
|
264
|
+
cancelAt: string | null;
|
|
265
|
+
localLimits: Record<string, number> | null;
|
|
266
|
+
createdAt: string;
|
|
267
|
+
updatedAt: string;
|
|
268
|
+
}
|
|
269
|
+
/** Billing subscription list response */
|
|
270
|
+
interface BillingSubscriptionList {
|
|
271
|
+
items: BillingSubscription[];
|
|
272
|
+
total: number;
|
|
273
|
+
}
|
|
274
|
+
/** Create billing subscription request */
|
|
275
|
+
interface CreateBillingSubscriptionRequest {
|
|
276
|
+
subscriberExternalId: string;
|
|
277
|
+
subscriberEmail: string;
|
|
278
|
+
subscriberName?: string;
|
|
279
|
+
planSlug: string;
|
|
280
|
+
billingCycle?: 'monthly' | 'yearly';
|
|
281
|
+
localLimits?: Record<string, number>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** GrowFlow Billing settings for the booking platform */
|
|
285
|
+
interface BillingSettings {
|
|
286
|
+
apiKeyConfigured: boolean;
|
|
287
|
+
apiKeyMasked: string | null;
|
|
288
|
+
webhookSecretConfigured: boolean;
|
|
289
|
+
webhookSecretMasked: string | null;
|
|
290
|
+
mode: string;
|
|
291
|
+
billingUrlTest: string | null;
|
|
292
|
+
billingUrlProduction: string | null;
|
|
293
|
+
clientId: string | null;
|
|
294
|
+
}
|
|
295
|
+
/** Update billing settings request */
|
|
296
|
+
interface UpdateBillingSettingsRequest {
|
|
297
|
+
apiKey?: string;
|
|
298
|
+
webhookSecret?: string;
|
|
299
|
+
mode?: string;
|
|
300
|
+
billingUrlTest?: string;
|
|
301
|
+
billingUrlProduction?: string;
|
|
302
|
+
clientId?: string;
|
|
303
|
+
}
|
|
304
|
+
/** Billing connection test result */
|
|
305
|
+
interface BillingTestResult {
|
|
306
|
+
success: boolean;
|
|
307
|
+
message: string;
|
|
308
|
+
plansCount: number | null;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface BookingAdminApiClientOptions {
|
|
312
|
+
basePath: string;
|
|
313
|
+
fetcher: Fetcher;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Booking Admin API client.
|
|
317
|
+
* Provides typed methods for all booking admin endpoints.
|
|
318
|
+
* Uses a fetcher function provided by the host application (handles auth headers, base URL, etc.).
|
|
319
|
+
*/
|
|
320
|
+
declare class BookingAdminApiClient {
|
|
321
|
+
private basePath;
|
|
322
|
+
private fetcher;
|
|
323
|
+
constructor(options: BookingAdminApiClientOptions);
|
|
324
|
+
private request;
|
|
325
|
+
getTenants(params?: {
|
|
326
|
+
search?: string;
|
|
327
|
+
plan?: TenantPlan;
|
|
328
|
+
is_active?: boolean;
|
|
329
|
+
page?: number;
|
|
330
|
+
page_size?: number;
|
|
331
|
+
}): Promise<PaginatedResponse<AdminTenant>>;
|
|
332
|
+
getTenant(id: string): Promise<AdminTenantDetail>;
|
|
333
|
+
createTenant(data: AdminTenantCreate): Promise<AdminTenant>;
|
|
334
|
+
updateTenant(id: string, data: AdminTenantUpdate): Promise<AdminTenantDetail>;
|
|
335
|
+
deleteTenant(id: string): Promise<void>;
|
|
336
|
+
updateTenantPlan(id: string, plan: TenantPlan): Promise<AdminTenant>;
|
|
337
|
+
updateTenantStatus(id: string, isActive: boolean): Promise<AdminTenant>;
|
|
338
|
+
getTenantLimits(id: string): Promise<TenantLimits>;
|
|
339
|
+
updateTenantLimits(id: string, limits: AdminTenantLimitsUpdate): Promise<TenantLimits>;
|
|
340
|
+
getCustomers(params?: {
|
|
341
|
+
search?: string;
|
|
342
|
+
tenant_id?: string;
|
|
343
|
+
is_active?: boolean;
|
|
344
|
+
page?: number;
|
|
345
|
+
page_size?: number;
|
|
346
|
+
}): Promise<PaginatedResponse<CustomerWithTenant>>;
|
|
347
|
+
createCustomer(data: AdminCustomerCreate): Promise<CustomerWithTenant>;
|
|
348
|
+
updateCustomer(id: string, data: AdminCustomerUpdate): Promise<CustomerWithTenant>;
|
|
349
|
+
deleteCustomer(id: string): Promise<void>;
|
|
350
|
+
getSubscriptionPlans(includeInactive?: boolean): Promise<SubscriptionPlanList>;
|
|
351
|
+
getSubscriptionPlan(id: string): Promise<SubscriptionPlan>;
|
|
352
|
+
createSubscriptionPlan(data: SubscriptionPlanCreate): Promise<SubscriptionPlan>;
|
|
353
|
+
updateSubscriptionPlan(id: string, data: SubscriptionPlanUpdate): Promise<SubscriptionPlan>;
|
|
354
|
+
deleteSubscriptionPlan(id: string): Promise<void>;
|
|
355
|
+
getBillingPlans(isActive?: boolean): Promise<BillingPlanList>;
|
|
356
|
+
createBillingPlan(data: CreateBillingPlanRequest): Promise<BillingPlan>;
|
|
357
|
+
updateBillingPlan(id: string, data: UpdateBillingPlanRequest): Promise<BillingPlan>;
|
|
358
|
+
deleteBillingPlan(id: string): Promise<void>;
|
|
359
|
+
syncBillingPlanToStripe(id: string): Promise<BillingPlan>;
|
|
360
|
+
getBillingSubscriptions(params?: {
|
|
361
|
+
status?: string;
|
|
362
|
+
search?: string;
|
|
363
|
+
limit?: number;
|
|
364
|
+
offset?: number;
|
|
365
|
+
}): Promise<BillingSubscriptionList>;
|
|
366
|
+
getBillingSubscription(id: string): Promise<BillingSubscription>;
|
|
367
|
+
createBillingSubscription(data: CreateBillingSubscriptionRequest): Promise<BillingSubscription>;
|
|
368
|
+
cancelBillingSubscription(id: string, atPeriodEnd?: boolean): Promise<BillingSubscription>;
|
|
369
|
+
changeBillingSubscriptionPlan(id: string, newPlanSlug: string): Promise<BillingSubscription>;
|
|
370
|
+
getBillingSettings(): Promise<BillingSettings>;
|
|
371
|
+
updateBillingSettings(data: UpdateBillingSettingsRequest): Promise<BillingSettings>;
|
|
372
|
+
testBillingConnection(): Promise<BillingTestResult>;
|
|
373
|
+
}
|
|
374
|
+
/** Factory function for creating a BookingAdminApiClient */
|
|
375
|
+
declare function createBookingAdminClient(options: BookingAdminApiClientOptions): BookingAdminApiClient;
|
|
376
|
+
|
|
377
|
+
declare const BookingAdminClientContext: react.Context<BookingAdminApiClient | null>;
|
|
378
|
+
declare function useBookingAdminClient(): BookingAdminApiClient;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Generic hook for managing dialog state with optional associated data.
|
|
382
|
+
*/
|
|
383
|
+
declare function useDialogState<T = undefined>(): {
|
|
384
|
+
isOpen: boolean;
|
|
385
|
+
data: T | undefined;
|
|
386
|
+
open: (initialData?: T) => void;
|
|
387
|
+
close: () => void;
|
|
388
|
+
toggle: () => void;
|
|
389
|
+
setData: react.Dispatch<react.SetStateAction<T | undefined>>;
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
declare function useAdminTenants(params?: {
|
|
393
|
+
search?: string;
|
|
394
|
+
plan?: TenantPlan;
|
|
395
|
+
is_active?: boolean;
|
|
396
|
+
page?: number;
|
|
397
|
+
page_size?: number;
|
|
398
|
+
}): _tanstack_react_query.UseQueryResult<PaginatedResponse<AdminTenant>, Error>;
|
|
399
|
+
declare function useAdminTenant(id: string): _tanstack_react_query.UseQueryResult<AdminTenantDetail, Error>;
|
|
400
|
+
declare function useCreateTenant(): _tanstack_react_query.UseMutationResult<AdminTenant, Error, AdminTenantCreate, unknown>;
|
|
401
|
+
declare function useUpdateTenant(): _tanstack_react_query.UseMutationResult<AdminTenantDetail, Error, {
|
|
402
|
+
id: string;
|
|
403
|
+
data: AdminTenantUpdate;
|
|
404
|
+
}, unknown>;
|
|
405
|
+
declare function useDeleteTenant(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
406
|
+
declare function useUpdateTenantPlan(): _tanstack_react_query.UseMutationResult<AdminTenant, Error, {
|
|
407
|
+
id: string;
|
|
408
|
+
plan: TenantPlan;
|
|
409
|
+
}, unknown>;
|
|
410
|
+
declare function useUpdateTenantStatus(): _tanstack_react_query.UseMutationResult<AdminTenant, Error, {
|
|
411
|
+
id: string;
|
|
412
|
+
isActive: boolean;
|
|
413
|
+
}, unknown>;
|
|
414
|
+
declare function useTenantLimits(id: string): _tanstack_react_query.UseQueryResult<TenantLimits, Error>;
|
|
415
|
+
declare function useUpdateTenantLimits(): _tanstack_react_query.UseMutationResult<TenantLimits, Error, {
|
|
416
|
+
id: string;
|
|
417
|
+
limits: AdminTenantLimitsUpdate;
|
|
418
|
+
}, unknown>;
|
|
419
|
+
|
|
420
|
+
declare function useAdminCustomers(params?: {
|
|
421
|
+
search?: string;
|
|
422
|
+
tenant_id?: string;
|
|
423
|
+
is_active?: boolean;
|
|
424
|
+
page?: number;
|
|
425
|
+
page_size?: number;
|
|
426
|
+
}): _tanstack_react_query.UseQueryResult<PaginatedResponse<CustomerWithTenant>, Error>;
|
|
427
|
+
declare function useCreateCustomer(): _tanstack_react_query.UseMutationResult<CustomerWithTenant, Error, AdminCustomerCreate, unknown>;
|
|
428
|
+
declare function useUpdateCustomer(): _tanstack_react_query.UseMutationResult<CustomerWithTenant, Error, {
|
|
429
|
+
id: string;
|
|
430
|
+
data: AdminCustomerUpdate;
|
|
431
|
+
}, unknown>;
|
|
432
|
+
declare function useDeleteCustomer(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
433
|
+
|
|
434
|
+
declare function useSubscriptionPlans(includeInactive?: boolean): _tanstack_react_query.UseQueryResult<SubscriptionPlanList, Error>;
|
|
435
|
+
declare function useSubscriptionPlan(id: string): _tanstack_react_query.UseQueryResult<SubscriptionPlan, Error>;
|
|
436
|
+
declare function useCreateSubscriptionPlan(): _tanstack_react_query.UseMutationResult<SubscriptionPlan, Error, SubscriptionPlanCreate, unknown>;
|
|
437
|
+
declare function useUpdateSubscriptionPlan(): _tanstack_react_query.UseMutationResult<SubscriptionPlan, Error, {
|
|
438
|
+
id: string;
|
|
439
|
+
data: SubscriptionPlanUpdate;
|
|
440
|
+
}, unknown>;
|
|
441
|
+
declare function useDeleteSubscriptionPlan(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
442
|
+
|
|
443
|
+
declare function useBillingPlans(isActive?: boolean): _tanstack_react_query.UseQueryResult<BillingPlanList, Error>;
|
|
444
|
+
declare function useCreateBillingPlan(): _tanstack_react_query.UseMutationResult<BillingPlan, Error, CreateBillingPlanRequest, unknown>;
|
|
445
|
+
declare function useUpdateBillingPlan(): _tanstack_react_query.UseMutationResult<BillingPlan, Error, {
|
|
446
|
+
id: string;
|
|
447
|
+
data: UpdateBillingPlanRequest;
|
|
448
|
+
}, unknown>;
|
|
449
|
+
declare function useDeleteBillingPlan(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
450
|
+
declare function useSyncBillingPlanToStripe(): _tanstack_react_query.UseMutationResult<BillingPlan, Error, string, unknown>;
|
|
451
|
+
|
|
452
|
+
declare function useBillingSubscriptions(params?: {
|
|
453
|
+
status?: string;
|
|
454
|
+
search?: string;
|
|
455
|
+
limit?: number;
|
|
456
|
+
offset?: number;
|
|
457
|
+
}): _tanstack_react_query.UseQueryResult<BillingSubscriptionList, Error>;
|
|
458
|
+
declare function useBillingSubscription(id: string): _tanstack_react_query.UseQueryResult<BillingSubscription, Error>;
|
|
459
|
+
declare function useCreateBillingSubscription(): _tanstack_react_query.UseMutationResult<BillingSubscription, Error, CreateBillingSubscriptionRequest, unknown>;
|
|
460
|
+
declare function useCancelBillingSubscription(): _tanstack_react_query.UseMutationResult<BillingSubscription, Error, {
|
|
461
|
+
id: string;
|
|
462
|
+
atPeriodEnd?: boolean;
|
|
463
|
+
}, unknown>;
|
|
464
|
+
declare function useChangeBillingSubscriptionPlan(): _tanstack_react_query.UseMutationResult<BillingSubscription, Error, {
|
|
465
|
+
id: string;
|
|
466
|
+
newPlanSlug: string;
|
|
467
|
+
}, unknown>;
|
|
468
|
+
|
|
469
|
+
declare function useBillingSettings(): _tanstack_react_query.UseQueryResult<BillingSettings, Error>;
|
|
470
|
+
declare function useUpdateBillingSettings(): _tanstack_react_query.UseMutationResult<BillingSettings, Error, UpdateBillingSettingsRequest, unknown>;
|
|
471
|
+
declare function useTestBillingConnection(): _tanstack_react_query.UseMutationResult<BillingTestResult, Error, void, unknown>;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Format a currency amount using Intl.NumberFormat.
|
|
475
|
+
*/
|
|
476
|
+
declare function formatCurrency(amount: number, currency?: string, locale?: string): string;
|
|
477
|
+
/**
|
|
478
|
+
* Format amount in cents to currency string.
|
|
479
|
+
*/
|
|
480
|
+
declare function formatCurrencyFromCents(amountCents: number, currency?: string, locale?: string): string;
|
|
481
|
+
/**
|
|
482
|
+
* Format a price, returning "Contattaci" for null values.
|
|
483
|
+
*/
|
|
484
|
+
declare function formatPrice(price: number | null, currency?: string, locale?: string): string;
|
|
485
|
+
/**
|
|
486
|
+
* Format a date string or Date object.
|
|
487
|
+
*/
|
|
488
|
+
declare function formatDate(date: Date | string | undefined | null, locale?: string): string;
|
|
489
|
+
/**
|
|
490
|
+
* Format a Unix timestamp (seconds) to date string.
|
|
491
|
+
*/
|
|
492
|
+
declare function formatTimestamp(timestamp: number | null, includeTime?: boolean, locale?: string): string;
|
|
493
|
+
/**
|
|
494
|
+
* Truncate long IDs for display.
|
|
495
|
+
*/
|
|
496
|
+
declare function truncateId(id: string, maxLength?: number): string;
|
|
497
|
+
|
|
498
|
+
declare const tenantStatusColors: Record<string, string>;
|
|
499
|
+
declare const tenantStatusLabels: Record<string, string>;
|
|
500
|
+
declare const tenantPlanColors: Record<TenantPlan, string>;
|
|
501
|
+
declare const tenantPlanLabels: Record<TenantPlan, string>;
|
|
502
|
+
declare const billingSubscriptionStatusColors: Record<BillingSubscriptionStatus, string>;
|
|
503
|
+
declare const billingSubscriptionStatusLabels: Record<BillingSubscriptionStatus, string>;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Validate a plan slug format.
|
|
507
|
+
*/
|
|
508
|
+
declare function validateSlug(slug: string): string | null;
|
|
509
|
+
/**
|
|
510
|
+
* Validate required string field.
|
|
511
|
+
*/
|
|
512
|
+
declare function validateRequired(value: string, fieldName: string): string | null;
|
|
513
|
+
/**
|
|
514
|
+
* Validate email format.
|
|
515
|
+
*/
|
|
516
|
+
declare function validateEmail(email: string): string | null;
|
|
517
|
+
|
|
518
|
+
export { type AdminCustomerCreate, type AdminCustomerUpdate, type AdminTenant, type AdminTenantCreate, type AdminTenantDetail, type AdminTenantLimitsUpdate, type AdminTenantUpdate, type BillingPlan, type BillingPlanList, type BillingSettings, type BillingSubscription, type BillingSubscriptionList, type BillingSubscriptionStatus, type BillingTestResult, BookingAdminApiClient, type BookingAdminApiClientOptions, BookingAdminClientContext, type CreateBillingPlanRequest, type CreateBillingSubscriptionRequest, type CustomerWithTenant, type Fetcher, type FetcherOptions, type JsonArray, type JsonObject, type JsonValue, type PaginatedResponse, type PlanFeature, type PlanPricingModel, type SubscriptionPlan, type SubscriptionPlanCreate, type SubscriptionPlanList, type SubscriptionPlanUpdate, type TenantLimits, type TenantPlan, type UpdateBillingPlanRequest, type UpdateBillingSettingsRequest, billingSubscriptionStatusColors, billingSubscriptionStatusLabels, createBookingAdminClient, formatCurrency, formatCurrencyFromCents, formatDate, formatPrice, formatTimestamp, tenantPlanColors, tenantPlanLabels, tenantStatusColors, tenantStatusLabels, truncateId, useAdminCustomers, useAdminTenant, useAdminTenants, useBillingPlans, useBillingSettings, useBillingSubscription, useBillingSubscriptions, useBookingAdminClient, useCancelBillingSubscription, useChangeBillingSubscriptionPlan, useCreateBillingPlan, useCreateBillingSubscription, useCreateCustomer, useCreateSubscriptionPlan, useCreateTenant, useDeleteBillingPlan, useDeleteCustomer, useDeleteSubscriptionPlan, useDeleteTenant, useDialogState, useSubscriptionPlan, useSubscriptionPlans, useSyncBillingPlanToStripe, useTenantLimits, useTestBillingConnection, useUpdateBillingPlan, useUpdateBillingSettings, useUpdateCustomer, useUpdateSubscriptionPlan, useUpdateTenant, useUpdateTenantLimits, useUpdateTenantPlan, useUpdateTenantStatus, validateEmail, validateRequired, validateSlug };
|