@kasuvia/sdk 0.0.2 → 0.0.4
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/hooks/index.d.mts +429 -0
- package/dist/hooks/index.d.ts +429 -0
- package/dist/hooks/index.js +3073 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +2962 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +250 -1161
- package/dist/index.d.ts +250 -1161
- package/dist/index.js +1544 -2359
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1527 -2258
- package/dist/index.mjs.map +1 -1
- package/dist/sdk-context-Cy51kEKT.d.mts +565 -0
- package/dist/sdk-context-Cy51kEKT.d.ts +565 -0
- package/package.json +6 -2
- package/src/config/index.ts +10 -91
- package/src/constants.ts +13 -0
- package/src/context/sdk-context.tsx +70 -0
- package/src/graphql/collections.graphql.ts +2 -10
- package/src/graphql/products.graphql.ts +215 -65
- package/src/graphql/wishlist.graphql.ts +7 -6
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-auth.ts +82 -158
- package/src/hooks/use-bespoke-availability.ts +25 -8
- package/src/hooks/use-cart.ts +222 -119
- package/src/hooks/use-cms.ts +179 -86
- package/src/hooks/use-collections.ts +52 -15
- package/src/hooks/use-consultation-stream.ts +4 -3
- package/src/hooks/use-consultations.ts +120 -51
- package/src/hooks/use-countries.ts +35 -13
- package/src/hooks/use-currencies.ts +26 -13
- package/src/hooks/use-google-translate.ts +22 -8
- package/src/hooks/use-languages.ts +40 -20
- package/src/hooks/use-mobile.ts +23 -0
- package/src/hooks/use-order-stream.ts +9 -5
- package/src/hooks/use-orders.ts +99 -44
- package/src/hooks/use-payment.ts +108 -40
- package/src/hooks/use-products.ts +251 -53
- package/src/hooks/use-service-booking.ts +152 -90
- package/src/hooks/use-states.ts +35 -15
- package/src/hooks/use-wishlist.ts +92 -91
- package/src/index.ts +26 -30
- package/src/services/auth.service.ts +209 -167
- package/src/services/bespoke.service.ts +12 -4
- package/src/services/cart.service.ts +172 -70
- package/src/services/cms.service.ts +70 -35
- package/src/services/collection.service.ts +22 -5
- package/src/services/config.service.ts +34 -14
- package/src/services/consultation.service.ts +72 -18
- package/src/services/logistics.service.ts +35 -11
- package/src/services/notifications.service.ts +27 -12
- package/src/services/order.service.ts +74 -15
- package/src/services/payment.service.ts +86 -31
- package/src/services/product.service.ts +279 -39
- package/src/services/service-booking.service.ts +98 -26
- package/src/services/wishlist.service.ts +69 -25
- package/src/types/auth/index.ts +6 -4
- package/src/types/business/index.ts +7 -2
- package/src/types/payments/index.ts +3 -3
- package/src/types/services/index.ts +2 -5
- package/src/types/store/index.ts +38 -3
- package/src/utils/error-handler.ts +10 -5
- package/src/utils/storage.ts +48 -26
- package/src/utils/validators.ts +85 -0
- package/src/client/authClient.ts +0 -135
- package/src/client/graphqlClient.ts +0 -53
- package/src/client/httpClient.ts +0 -298
package/dist/index.d.mts
CHANGED
|
@@ -1,119 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
1
|
+
import { l as ServiceLocationType, S as SdkConfig, C as CartResponse, a as CartItem, O as Order, m as CreateOrderParams, F as FindOrderParams, L as ListParams, n as PaginatedResponse, P as Product, o as Collection, W as WishlistItem, p as WishlistCheckResponse, q as WishlistListResponse, D as DVACreateRequest, s as DVADetails, T as TransactionVerifyResponse, t as PaymentInitiateRequest, v as PaymentInitiateResponse, w as ConversionQuote, x as ProductVariant, y as ShippingRatesResponse, z as SupportedLanguagesResponse, A as SupportedCurrenciesResponse, g as CreateCmsEntryParams, f as CmsEntry, h as ListCmsEntriesParams, B as CmsEntryListResponse, U as UpdateCmsEntryParams, E as CheckoutCustomer, G as ShippingLocation, H as DeliveryAddress } from './sdk-context-Cy51kEKT.mjs';
|
|
2
|
+
export { I as Address, J as AppContextValue, K as AppState, M as BackendLanguage, N as BespokeStageKey, Q as CmsField, R as CmsIcon, V as CmsIconListResponse, X as CmsModel, Y as CmsModelPermissions, Z as CmsModelPublicApiPermissions, b as Country, e as Currency, _ as CustomField, $ as Inventory, a0 as LangCode, a1 as OrderItem, a2 as OrderStatus, a3 as ProductType, i as SdkContextValue, j as SdkProvider, k as SdkProviderProps, a4 as ServiceLocationTypeEnum, a5 as ServiceRecurringInterval, a6 as ServiceRecurringIntervalEnum, a7 as ServiceType, a8 as ServiceTypeEnum, a9 as ShippingRate, c as State, d as SupportedLang, aa as Theme, u as useSdkContext } from './sdk-context-Cy51kEKT.mjs';
|
|
3
|
+
import 'react';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* SDK Constants
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
interface SdkConfig {
|
|
18
|
-
businessId: string;
|
|
19
|
-
storefrontApiKey: string;
|
|
20
|
-
}
|
|
21
|
-
interface SdkRuntimeConfig {
|
|
22
|
-
businessId: string;
|
|
23
|
-
storefrontApiKey: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Initialize the SDK with runtime credentials
|
|
27
|
-
* This must be called before any SDK operations
|
|
28
|
-
*
|
|
29
|
-
* IMPORTANT: In Next.js, this should be called in layout.tsx (server component)
|
|
30
|
-
* using private environment variables (kasuvia_BUSINESS_ID, kasuvia_STOREFRONT_API_KEY).
|
|
31
|
-
* The config is stored in module scope and will be available to client components
|
|
32
|
-
* through the SDK's bundled code.
|
|
33
|
-
*
|
|
34
|
-
* @param config - SDK configuration including credentials
|
|
35
|
-
*/
|
|
36
|
-
declare function initSdk(config: SdkConfig): void;
|
|
37
|
-
/**
|
|
38
|
-
* Get the current runtime configuration
|
|
39
|
-
* Throws if SDK is not initialized
|
|
40
|
-
*/
|
|
41
|
-
declare function getRuntimeConfig(): SdkRuntimeConfig;
|
|
42
|
-
/**
|
|
43
|
-
* Get backend URL for a specific service
|
|
44
|
-
* Internal use only - never exposed to storefront
|
|
45
|
-
*/
|
|
46
|
-
declare function getBackendUrl(service: 'auth' | 'store' | 'payment' | 'notifications' | 'cms'): string;
|
|
47
|
-
/**
|
|
48
|
-
* Check if SDK is initialized
|
|
49
|
-
*/
|
|
50
|
-
declare function isInitialized(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Reset SDK configuration (mainly for testing)
|
|
53
|
-
*/
|
|
54
|
-
declare function resetConfig(): void;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* HTTP Client - Pre-configured Axios instances
|
|
58
|
-
*
|
|
59
|
-
* Each Axios instance is created with a default baseURL based on the static
|
|
60
|
-
* service URL. The baseURLs are complete URLs including the API version,
|
|
61
|
-
* selected based on the configured environment (development/production).
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
declare function getOrCreateGuestSessionId(): string;
|
|
65
|
-
declare function getGuestSessionId(): string | null;
|
|
66
|
-
declare function clearGuestSessionId(): void;
|
|
67
|
-
declare const storeManagementAxios: AxiosInstance;
|
|
68
|
-
declare const publicStoreAxios: AxiosInstance;
|
|
69
|
-
declare const authAxios: AxiosInstance;
|
|
70
|
-
declare const paymentAxios: AxiosInstance;
|
|
71
|
-
declare const cmsAxios: AxiosInstance;
|
|
72
|
-
/**
|
|
73
|
-
* configureHttpClients()
|
|
74
|
-
* Updates the baseURL of all Axios instances to match the configured environment.
|
|
75
|
-
* This must be called after initSdk() to ensure the correct environment URLs are used.
|
|
76
|
-
*/
|
|
77
|
-
declare function configureHttpClients(): void;
|
|
78
|
-
|
|
79
|
-
declare const tokenStore: {
|
|
80
|
-
readonly getAccessToken: () => string | null;
|
|
81
|
-
readonly setAccessToken: (token: string | null) => void;
|
|
82
|
-
readonly getRefreshToken: () => string | null;
|
|
83
|
-
readonly setRefreshToken: (token: string | null, remember?: boolean) => void;
|
|
84
|
-
readonly clearAll: () => void;
|
|
85
|
-
readonly hasSession: () => boolean;
|
|
86
|
-
readonly isPersistent: () => boolean;
|
|
8
|
+
* Centralized constants to avoid hardcoded strings across the codebase.
|
|
9
|
+
*/
|
|
10
|
+
declare const STORAGE_KEYS: {
|
|
11
|
+
readonly ACCESS_TOKEN: "kasuvia_access_token";
|
|
12
|
+
readonly REFRESH_TOKEN: "kasuvia_refresh_token";
|
|
13
|
+
readonly CHECKOUT_STATE: "kasuvia_checkout_state";
|
|
14
|
+
readonly ORDERS_LINKED: "kasuvia_orders_linked";
|
|
15
|
+
readonly STOREFRONT_STATE: "storefront_state_v3";
|
|
87
16
|
};
|
|
88
|
-
/**
|
|
89
|
-
* Perform token refresh with queue-coalescing to avoid parallel refresh races.
|
|
90
|
-
*/
|
|
91
|
-
declare function refreshToken(): Promise<string>;
|
|
92
17
|
|
|
93
18
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* Provides a GraphQL client with tenant and auth headers for product queries.
|
|
97
|
-
* The endpoint URL is derived from the static BACKEND_URLS constant (eager,
|
|
98
|
-
* module-load safe). Auth headers are injected fresh on each request via a
|
|
99
|
-
* factory so the token is always current.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Returns a GraphQL client instance with up-to-date auth headers.
|
|
104
|
-
* A new client is created on each call so token/config changes take effect
|
|
105
|
-
* immediately without requiring an explicit reset.
|
|
106
|
-
*/
|
|
107
|
-
declare function getGraphQLClient(): GraphQLClient;
|
|
108
|
-
/**
|
|
109
|
-
* No-op — kept for backward compatibility.
|
|
110
|
-
* Clients are now stateless (created fresh on each call), so there is no
|
|
111
|
-
* cached instance to reset.
|
|
112
|
-
*/
|
|
113
|
-
declare function resetGraphQLClient(): void;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Simplified customer auth types for luxe-storefront.
|
|
19
|
+
* Simplified customer auth types for kasuvia-storefront.
|
|
117
20
|
* Customers only need enough to track their orders — no RBAC, MFA, or complex profiles.
|
|
118
21
|
*/
|
|
119
22
|
/**
|
|
@@ -141,7 +44,7 @@ interface CustomerUser {
|
|
|
141
44
|
avatar: string | null;
|
|
142
45
|
provider: 'google' | 'facebook' | 'email';
|
|
143
46
|
}
|
|
144
|
-
/** GET/PUT /auth/profile/ — matches
|
|
47
|
+
/** GET/PUT /auth/profile/ — matches kasuvia-auth UserSerializer */
|
|
145
48
|
interface AuthUserResponse {
|
|
146
49
|
id: string;
|
|
147
50
|
email: string;
|
|
@@ -205,8 +108,8 @@ interface CustomerLoginPayload {
|
|
|
205
108
|
/** POST /auth/register/customer/ */
|
|
206
109
|
interface CustomerRegisterPayload {
|
|
207
110
|
tenant_id: string;
|
|
208
|
-
|
|
209
|
-
|
|
111
|
+
first_name?: string;
|
|
112
|
+
last_name?: string;
|
|
210
113
|
email: string;
|
|
211
114
|
password: string;
|
|
212
115
|
}
|
|
@@ -232,390 +135,10 @@ interface AuthContextValue {
|
|
|
232
135
|
closeModal: () => void;
|
|
233
136
|
setCustomer: (user: CustomerUser | null) => void;
|
|
234
137
|
logout: () => Promise<void>;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
* Shipping and delivery types for the storefront
|
|
239
|
-
*/
|
|
240
|
-
interface ShippingRate {
|
|
241
|
-
id: string;
|
|
242
|
-
carrier_name: string;
|
|
243
|
-
carrier_logo: string;
|
|
244
|
-
carrier_rate_description: string;
|
|
245
|
-
carrier_slug: string;
|
|
246
|
-
amount: number;
|
|
247
|
-
currency: string;
|
|
248
|
-
delivery_time: string;
|
|
249
|
-
delivery_eta: number;
|
|
250
|
-
pickup_time: string;
|
|
251
|
-
pickup_eta: number;
|
|
252
|
-
pickup_available: boolean;
|
|
253
|
-
dropoff_available?: boolean;
|
|
254
|
-
dropoff_required?: boolean;
|
|
255
|
-
}
|
|
256
|
-
interface ShippingRatesResponse {
|
|
257
|
-
status: boolean;
|
|
258
|
-
message: string;
|
|
259
|
-
data: ShippingRate[];
|
|
260
|
-
}
|
|
261
|
-
interface DeliveryAddress {
|
|
262
|
-
first_name: string;
|
|
263
|
-
last_name: string;
|
|
264
|
-
phone: string;
|
|
265
|
-
street: string;
|
|
266
|
-
city: string;
|
|
267
|
-
state: string;
|
|
268
|
-
lga: string;
|
|
269
|
-
country: string;
|
|
270
|
-
postal: string;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
type ProductType = "physical" | "digital" | "service" | "bespoke";
|
|
274
|
-
interface Address {
|
|
275
|
-
street: string;
|
|
276
|
-
city: string;
|
|
277
|
-
state: string;
|
|
278
|
-
country: string;
|
|
279
|
-
zip?: string;
|
|
280
|
-
}
|
|
281
|
-
interface Collection {
|
|
282
|
-
id: string;
|
|
283
|
-
business_id?: string;
|
|
284
|
-
name: string;
|
|
285
|
-
slug: string;
|
|
286
|
-
description?: string;
|
|
287
|
-
image?: {
|
|
288
|
-
url: string;
|
|
289
|
-
alt?: string;
|
|
290
|
-
id?: string;
|
|
291
|
-
};
|
|
292
|
-
collection_type?: string;
|
|
293
|
-
rules?: Record<string, unknown>;
|
|
294
|
-
status?: string;
|
|
295
|
-
sort_order?: number;
|
|
296
|
-
created_at: string;
|
|
297
|
-
updated_at: string;
|
|
298
|
-
}
|
|
299
|
-
interface Inventory {
|
|
300
|
-
id: string;
|
|
301
|
-
product_id: string;
|
|
302
|
-
variant_id?: string;
|
|
303
|
-
quantity: number;
|
|
304
|
-
reserved: number;
|
|
305
|
-
reorder_point: number;
|
|
306
|
-
reorder_quantity: number;
|
|
307
|
-
track_quantity: boolean;
|
|
308
|
-
allow_backorder: boolean;
|
|
309
|
-
available: number;
|
|
310
|
-
is_in_stock: boolean;
|
|
311
|
-
is_low_stock: boolean;
|
|
312
|
-
updated_at: string;
|
|
313
|
-
}
|
|
314
|
-
interface ProductVariant {
|
|
315
|
-
id: string;
|
|
316
|
-
product_id: string;
|
|
317
|
-
sku?: string;
|
|
318
|
-
attributes: Record<string, string>;
|
|
319
|
-
price?: number;
|
|
320
|
-
images: Array<{
|
|
321
|
-
url: string;
|
|
322
|
-
alt?: string;
|
|
323
|
-
id?: string;
|
|
324
|
-
}>;
|
|
325
|
-
weight_kg?: number;
|
|
326
|
-
is_active: boolean;
|
|
327
|
-
inventory?: Inventory;
|
|
328
|
-
created_at: string;
|
|
329
|
-
updated_at: string;
|
|
330
|
-
}
|
|
331
|
-
interface CustomField {
|
|
332
|
-
label: string;
|
|
333
|
-
unit?: string;
|
|
334
|
-
required: boolean;
|
|
335
|
-
type?: string;
|
|
336
|
-
key?: string;
|
|
337
|
-
placeholder?: string;
|
|
338
|
-
}
|
|
339
|
-
interface Product {
|
|
340
|
-
id: string;
|
|
341
|
-
business_id: string;
|
|
342
|
-
name: string;
|
|
343
|
-
slug: string;
|
|
344
|
-
description?: string;
|
|
345
|
-
brand?: string;
|
|
346
|
-
product_type: ProductType;
|
|
347
|
-
requires_shipping: boolean;
|
|
348
|
-
is_consumable: boolean;
|
|
349
|
-
is_bespoke: boolean;
|
|
350
|
-
base_price: number;
|
|
351
|
-
currency: string;
|
|
352
|
-
images: Array<{
|
|
353
|
-
url: string;
|
|
354
|
-
alt?: string;
|
|
355
|
-
id?: string;
|
|
356
|
-
}>;
|
|
357
|
-
tags: string[];
|
|
358
|
-
custom_fields: CustomField[];
|
|
359
|
-
is_published: boolean;
|
|
360
|
-
is_featured: boolean;
|
|
361
|
-
is_popular: boolean;
|
|
362
|
-
is_new: boolean;
|
|
363
|
-
is_temporary: boolean;
|
|
364
|
-
digital_file_key?: string;
|
|
365
|
-
download_limit?: number;
|
|
366
|
-
download_expires_at?: string;
|
|
367
|
-
weight_kg: number;
|
|
368
|
-
length_cm?: number;
|
|
369
|
-
width_cm?: number;
|
|
370
|
-
height_cm?: number;
|
|
371
|
-
created_at: string;
|
|
372
|
-
updated_at: string;
|
|
373
|
-
variants: ProductVariant[];
|
|
374
|
-
collections: Collection[];
|
|
375
|
-
}
|
|
376
|
-
interface ListParams {
|
|
377
|
-
page?: number;
|
|
378
|
-
pageSize?: number;
|
|
379
|
-
search?: string;
|
|
380
|
-
ordering?: string;
|
|
381
|
-
collectionSlug?: string;
|
|
382
|
-
excludeProductId?: string;
|
|
383
|
-
}
|
|
384
|
-
interface PaginatedResponse<T> {
|
|
385
|
-
items: T[];
|
|
386
|
-
total: number;
|
|
387
|
-
page: number;
|
|
388
|
-
page_size: number;
|
|
389
|
-
total_pages: number;
|
|
390
|
-
}
|
|
391
|
-
interface CartItem {
|
|
392
|
-
id: string;
|
|
393
|
-
product_id: string;
|
|
394
|
-
product_slug: string;
|
|
395
|
-
product_name: string;
|
|
396
|
-
image?: string;
|
|
397
|
-
variant_id?: string;
|
|
398
|
-
variant_attributes?: string | Record<string, string>;
|
|
399
|
-
unit_price: number;
|
|
400
|
-
quantity: number;
|
|
401
|
-
custom_measurements?: string;
|
|
402
|
-
is_bespoke: boolean;
|
|
403
|
-
created_at: string;
|
|
404
|
-
updated_at: string;
|
|
405
|
-
}
|
|
406
|
-
interface CartResponse {
|
|
407
|
-
items: CartItem[];
|
|
408
|
-
subtotal: number;
|
|
409
|
-
total: number;
|
|
410
|
-
item_count: number;
|
|
411
|
-
product_type?: string;
|
|
412
|
-
}
|
|
413
|
-
interface WishlistItem {
|
|
414
|
-
id: string;
|
|
415
|
-
product_id: string;
|
|
416
|
-
notes?: string;
|
|
417
|
-
created_at: string;
|
|
418
|
-
product_name?: string;
|
|
419
|
-
product_slug?: string;
|
|
420
|
-
product_price?: number;
|
|
421
|
-
product_image?: string;
|
|
422
|
-
}
|
|
423
|
-
interface WishlistListResponse {
|
|
424
|
-
items: WishlistItem[];
|
|
425
|
-
total: number;
|
|
426
|
-
page: number;
|
|
427
|
-
page_size: number;
|
|
428
|
-
total_pages: number;
|
|
429
|
-
}
|
|
430
|
-
interface WishlistCheckResponse {
|
|
431
|
-
in_wishlist: boolean;
|
|
432
|
-
}
|
|
433
|
-
type OrderStatus = 'pending' | 'confirmed' | 'processing' | 'packed' | 'picked_up' | 'in_transit' | 'shipped' | 'delivered' | 'voided' | 'refunded' | 'failed';
|
|
434
|
-
type BespokeStageKey = "received" | "development" | "finished" | "dispatched";
|
|
435
|
-
interface OrderItem {
|
|
436
|
-
id: string;
|
|
437
|
-
productName: string;
|
|
438
|
-
image: string;
|
|
439
|
-
quantity: number;
|
|
440
|
-
price: number;
|
|
441
|
-
}
|
|
442
|
-
interface Order {
|
|
443
|
-
id: string;
|
|
444
|
-
display_id?: string;
|
|
445
|
-
items: OrderItem[];
|
|
446
|
-
total: number;
|
|
447
|
-
status: OrderStatus;
|
|
448
|
-
customerEmail: string;
|
|
449
|
-
customerName: string;
|
|
450
|
-
createdAt: number;
|
|
451
|
-
updatedAt: number;
|
|
452
|
-
deliveryMethod?: string;
|
|
453
|
-
trackingNumber?: string;
|
|
454
|
-
deliveryAddress?: string;
|
|
455
|
-
shippingAddress?: DeliveryAddress;
|
|
456
|
-
cancellationReason?: string;
|
|
457
|
-
hasBespoke?: boolean;
|
|
458
|
-
bespokeStage?: BespokeStageKey;
|
|
459
|
-
bespokeBrief?: string;
|
|
460
|
-
deliveryStatus?: string;
|
|
461
|
-
carrierName?: string;
|
|
462
|
-
terminalShipmentId?: string;
|
|
463
|
-
guestToken?: string;
|
|
464
|
-
guestEmail?: string;
|
|
465
|
-
guestPhone?: string;
|
|
466
|
-
guestName?: string;
|
|
467
|
-
}
|
|
468
|
-
interface CheckoutCustomer {
|
|
469
|
-
first_name: string;
|
|
470
|
-
last_name: string;
|
|
471
|
-
email: string;
|
|
472
|
-
phone: string;
|
|
473
|
-
}
|
|
474
|
-
interface ShippingLocation {
|
|
475
|
-
street: string;
|
|
476
|
-
city: string;
|
|
477
|
-
state: string;
|
|
478
|
-
lga: string;
|
|
479
|
-
country: string;
|
|
480
|
-
postal: string;
|
|
481
|
-
}
|
|
482
|
-
interface FindOrderParams {
|
|
483
|
-
email: string;
|
|
484
|
-
order_id: string;
|
|
485
|
-
}
|
|
486
|
-
interface CreateOrderParams {
|
|
487
|
-
customer_id?: string | null;
|
|
488
|
-
status?: string;
|
|
489
|
-
shipping_address?: DeliveryAddress;
|
|
490
|
-
checkout_session_id?: string;
|
|
491
|
-
items: Array<{
|
|
492
|
-
product_id: string;
|
|
493
|
-
product_name: string;
|
|
494
|
-
quantity: number;
|
|
495
|
-
unit_price: number;
|
|
496
|
-
variant_id?: string;
|
|
497
|
-
variant_details?: Record<string, unknown>;
|
|
498
|
-
custom_measurements?: Record<string, unknown>;
|
|
138
|
+
login: (payload: Omit<CustomerLoginPayload, 'tenant_id'>) => Promise<void>;
|
|
139
|
+
register: (payload: Omit<CustomerRegisterPayload, 'tenant_id'>) => Promise<{
|
|
140
|
+
requires_verification: boolean;
|
|
499
141
|
}>;
|
|
500
|
-
delivery_method?: string;
|
|
501
|
-
delivery_address?: string;
|
|
502
|
-
total?: number;
|
|
503
|
-
payment_method?: string;
|
|
504
|
-
shipping_rate_id?: string;
|
|
505
|
-
guest_token?: string;
|
|
506
|
-
guest_email?: string;
|
|
507
|
-
guest_phone?: string;
|
|
508
|
-
guest_name?: string;
|
|
509
|
-
product_type?: string;
|
|
510
|
-
bespoke_brief?: string;
|
|
511
|
-
bespoke_reference_images?: string[];
|
|
512
|
-
bespoke_measurements?: Record<string, string>;
|
|
513
|
-
bespoke_preferred_timeline?: string;
|
|
514
|
-
bespoke_special_instructions?: string;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* @file types/payments/index.ts
|
|
519
|
-
* @description All customer-facing payment types for the Luxe Payment System.
|
|
520
|
-
*
|
|
521
|
-
* Auth model:
|
|
522
|
-
* - X-Storefront-Key → identifies the business storefront
|
|
523
|
-
* - X-Business-ID → tenant context
|
|
524
|
-
* No business-owner JWT used here — these are CUSTOMER-facing types.
|
|
525
|
-
*
|
|
526
|
-
* Payment flow:
|
|
527
|
-
* Customer → Business Owner : Monnify (NGN) | Flutterwave (non-NGN)
|
|
528
|
-
* Business Owner → Luxe : Subscription (separate, JWT-auth)
|
|
529
|
-
* Luxe → Business Owner : Payout (separate, JWT-auth)
|
|
530
|
-
*/
|
|
531
|
-
interface Currency {
|
|
532
|
-
code: string;
|
|
533
|
-
name: string;
|
|
534
|
-
symbol: string;
|
|
535
|
-
decimals: number;
|
|
536
|
-
is_active: boolean;
|
|
537
|
-
}
|
|
538
|
-
interface SupportedCurrenciesResponse {
|
|
539
|
-
currencies: Currency[];
|
|
540
|
-
}
|
|
541
|
-
interface BackendLanguage {
|
|
542
|
-
code: string;
|
|
543
|
-
label: string;
|
|
544
|
-
flag: string;
|
|
545
|
-
}
|
|
546
|
-
interface SupportedLang {
|
|
547
|
-
code: string;
|
|
548
|
-
appCode: string;
|
|
549
|
-
label: string;
|
|
550
|
-
native: string;
|
|
551
|
-
flag: string;
|
|
552
|
-
}
|
|
553
|
-
interface SupportedLanguagesResponse {
|
|
554
|
-
languages: BackendLanguage[];
|
|
555
|
-
}
|
|
556
|
-
interface DVACreateRequest {
|
|
557
|
-
order_id?: string;
|
|
558
|
-
amount: number;
|
|
559
|
-
customer_email: string;
|
|
560
|
-
customer_name?: string;
|
|
561
|
-
/** Defaults to NGN — DVA is Monnify-only */
|
|
562
|
-
currency?: string;
|
|
563
|
-
/** Idempotency key to prevent duplicate DVA creation */
|
|
564
|
-
idempotency_key?: string;
|
|
565
|
-
}
|
|
566
|
-
interface PaymentInitiateRequest {
|
|
567
|
-
amount: number;
|
|
568
|
-
currency: string;
|
|
569
|
-
customer_email: string;
|
|
570
|
-
customer_name?: string;
|
|
571
|
-
order_id?: string;
|
|
572
|
-
quote_id?: string;
|
|
573
|
-
/** Window origin of the storefront — used as gateway redirect base URL */
|
|
574
|
-
storefront_origin?: string;
|
|
575
|
-
metadata?: Record<string, string | number | boolean>;
|
|
576
|
-
/** Idempotency key to prevent duplicate payment initiation */
|
|
577
|
-
idempotency_key?: string;
|
|
578
|
-
}
|
|
579
|
-
interface ConversionQuote {
|
|
580
|
-
id: string;
|
|
581
|
-
business_id: string;
|
|
582
|
-
from_currency: string;
|
|
583
|
-
to_currency: string;
|
|
584
|
-
rate: number;
|
|
585
|
-
original_amount: number;
|
|
586
|
-
converted_amount: number;
|
|
587
|
-
is_used: boolean;
|
|
588
|
-
expires_at: string;
|
|
589
|
-
created_at: string;
|
|
590
|
-
}
|
|
591
|
-
interface DVADetails {
|
|
592
|
-
account_number: string;
|
|
593
|
-
bank_name: string;
|
|
594
|
-
account_name: string;
|
|
595
|
-
reference: string;
|
|
596
|
-
amount: number;
|
|
597
|
-
transaction_id: string;
|
|
598
|
-
expires_at: string;
|
|
599
|
-
}
|
|
600
|
-
interface PaymentInitiateResponse {
|
|
601
|
-
id: string;
|
|
602
|
-
gateway_ref: string;
|
|
603
|
-
gateway: string;
|
|
604
|
-
status: string;
|
|
605
|
-
/** Normalised top-level checkout URL for gateway redirect */
|
|
606
|
-
checkout_url: string;
|
|
607
|
-
}
|
|
608
|
-
interface TransactionVerifyResponse {
|
|
609
|
-
id: string;
|
|
610
|
-
status: string;
|
|
611
|
-
amount: number;
|
|
612
|
-
currency: string;
|
|
613
|
-
gateway_ref: string;
|
|
614
|
-
gateway?: string;
|
|
615
|
-
order_id?: string;
|
|
616
|
-
escrow_status?: string;
|
|
617
|
-
escrow_release_date?: string;
|
|
618
|
-
metadata_json?: Record<string, unknown>;
|
|
619
142
|
}
|
|
620
143
|
|
|
621
144
|
/**
|
|
@@ -685,8 +208,6 @@ interface BespokeAvailability {
|
|
|
685
208
|
/**
|
|
686
209
|
* Service booking types for customer-facing storefront
|
|
687
210
|
*/
|
|
688
|
-
type ServiceLocationType = "remote" | "physical" | "both";
|
|
689
|
-
type ServiceType = "appointment" | "project" | "recurring";
|
|
690
211
|
type AppointmentStatus = "pending" | "confirmed" | "in_progress" | "completed" | "voided" | "no_show";
|
|
691
212
|
interface AvailableSlot {
|
|
692
213
|
date: string;
|
|
@@ -785,73 +306,6 @@ interface BespokeCapacityConfig {
|
|
|
785
306
|
updated_at: string;
|
|
786
307
|
}
|
|
787
308
|
|
|
788
|
-
/**
|
|
789
|
-
* CMS Types
|
|
790
|
-
*
|
|
791
|
-
* Types for kasuvia-cms integration - dynamic content models and entries
|
|
792
|
-
*/
|
|
793
|
-
interface CmsField {
|
|
794
|
-
name: string;
|
|
795
|
-
label: string;
|
|
796
|
-
type: string;
|
|
797
|
-
required: boolean;
|
|
798
|
-
config: Record<string, any>;
|
|
799
|
-
sub_fields?: CmsField[];
|
|
800
|
-
}
|
|
801
|
-
interface CmsModelPermissions {
|
|
802
|
-
read: boolean;
|
|
803
|
-
create: boolean;
|
|
804
|
-
update: boolean;
|
|
805
|
-
delete: boolean;
|
|
806
|
-
}
|
|
807
|
-
interface CmsModelPublicApiPermissions {
|
|
808
|
-
public_api: CmsModelPermissions;
|
|
809
|
-
}
|
|
810
|
-
interface CmsModel {
|
|
811
|
-
id: string;
|
|
812
|
-
business_id: string;
|
|
813
|
-
model_slug: string;
|
|
814
|
-
display_name: string;
|
|
815
|
-
description: string | null;
|
|
816
|
-
fields: CmsField[];
|
|
817
|
-
permissions: CmsModelPublicApiPermissions;
|
|
818
|
-
}
|
|
819
|
-
interface CmsEntry {
|
|
820
|
-
id: string;
|
|
821
|
-
business_id: string;
|
|
822
|
-
model_slug: string;
|
|
823
|
-
data: Record<string, any>;
|
|
824
|
-
created_at: string;
|
|
825
|
-
updated_at: string;
|
|
826
|
-
created_by: string | null;
|
|
827
|
-
}
|
|
828
|
-
interface CmsEntryListResponse {
|
|
829
|
-
entries: CmsEntry[];
|
|
830
|
-
total: number;
|
|
831
|
-
page: number;
|
|
832
|
-
page_size: number;
|
|
833
|
-
}
|
|
834
|
-
interface CmsIcon {
|
|
835
|
-
id: string;
|
|
836
|
-
name: string;
|
|
837
|
-
category: string;
|
|
838
|
-
tags: string[];
|
|
839
|
-
}
|
|
840
|
-
interface CmsIconListResponse {
|
|
841
|
-
icons: CmsIcon[];
|
|
842
|
-
total: number;
|
|
843
|
-
}
|
|
844
|
-
interface ListCmsEntriesParams {
|
|
845
|
-
page?: number;
|
|
846
|
-
page_size?: number;
|
|
847
|
-
}
|
|
848
|
-
interface CreateCmsEntryParams {
|
|
849
|
-
data: Record<string, any>;
|
|
850
|
-
}
|
|
851
|
-
interface UpdateCmsEntryParams {
|
|
852
|
-
data: Record<string, any>;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
309
|
/**
|
|
856
310
|
* Media types for the storefront
|
|
857
311
|
*/
|
|
@@ -892,68 +346,51 @@ interface StorageStats {
|
|
|
892
346
|
|
|
893
347
|
interface BusinessConfig {
|
|
894
348
|
business_id: string;
|
|
895
|
-
|
|
896
|
-
|
|
349
|
+
storefront_business_id: string;
|
|
350
|
+
name: string;
|
|
351
|
+
currency: string;
|
|
352
|
+
settlement_currency: string;
|
|
353
|
+
country: string;
|
|
354
|
+
region: string;
|
|
355
|
+
is_verified: boolean;
|
|
897
356
|
is_active: boolean;
|
|
898
357
|
}
|
|
899
358
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
}
|
|
907
|
-
interface AppContextValue extends AppState {
|
|
908
|
-
setTheme: (t: Theme) => void;
|
|
909
|
-
setLang: (l: LangCode) => void;
|
|
910
|
-
setCurrency: (c: string) => void;
|
|
911
|
-
formatPrice: (amount: number, fromCurrency?: string) => string;
|
|
912
|
-
resetAppState: () => void;
|
|
913
|
-
t: (text: string) => string;
|
|
914
|
-
translate: (text: string) => Promise<string>;
|
|
915
|
-
}
|
|
916
|
-
interface Country {
|
|
917
|
-
name: string;
|
|
918
|
-
code: string;
|
|
919
|
-
dial_code: string;
|
|
920
|
-
min_age: number;
|
|
921
|
-
}
|
|
922
|
-
interface State {
|
|
923
|
-
name: string;
|
|
924
|
-
code: string;
|
|
925
|
-
full_iso_code: string;
|
|
926
|
-
type: string;
|
|
927
|
-
}
|
|
359
|
+
/**
|
|
360
|
+
* Cart Service
|
|
361
|
+
*
|
|
362
|
+
* Handles cart operations for both guest and authenticated users.
|
|
363
|
+
* Stateless - all configuration passed as parameters.
|
|
364
|
+
*/
|
|
928
365
|
|
|
929
366
|
/**
|
|
930
367
|
* Fetch guest cart from backend (Redis-backed).
|
|
931
368
|
*/
|
|
932
|
-
declare function getGuestCart(): Promise<CartItem[]>;
|
|
369
|
+
declare function getGuestCart(config: SdkConfig, guestSessionId: string): Promise<CartItem[]>;
|
|
933
370
|
/**
|
|
934
371
|
* Add item to guest cart (Redis-backed).
|
|
935
372
|
*/
|
|
936
|
-
declare function addToGuestCart(item: CartItem): Promise<CartItem[]>;
|
|
373
|
+
declare function addToGuestCart(config: SdkConfig, guestSessionId: string, item: CartItem): Promise<CartItem[]>;
|
|
937
374
|
/**
|
|
938
375
|
* Update quantity of a guest cart item.
|
|
939
376
|
*/
|
|
940
|
-
declare function updateGuestCartItemQuantity(itemId: string, quantity: number): Promise<CartItem[]>;
|
|
377
|
+
declare function updateGuestCartItemQuantity(config: SdkConfig, guestSessionId: string, itemId: string, quantity: number): Promise<CartItem[]>;
|
|
941
378
|
/**
|
|
942
379
|
* Remove an item from the guest cart.
|
|
943
380
|
*/
|
|
944
|
-
declare function removeFromGuestCart(itemId: string): Promise<CartItem[]>;
|
|
381
|
+
declare function removeFromGuestCart(config: SdkConfig, guestSessionId: string, itemId: string): Promise<CartItem[]>;
|
|
945
382
|
/**
|
|
946
383
|
* Clear the entire guest cart.
|
|
947
384
|
*/
|
|
948
|
-
declare function clearGuestCart(): Promise<void>;
|
|
385
|
+
declare function clearGuestCart(config: SdkConfig, guestSessionId: string): Promise<void>;
|
|
949
386
|
/**
|
|
950
387
|
* Fetch authenticated user's cart from backend.
|
|
951
388
|
*/
|
|
952
|
-
declare function getCart(): Promise<CartResponse>;
|
|
389
|
+
declare function getCart(config: SdkConfig, accessToken?: string | null): Promise<CartResponse>;
|
|
953
390
|
/**
|
|
954
391
|
* Add item to authenticated user's cart.
|
|
955
392
|
*/
|
|
956
|
-
declare function addToCart(item: {
|
|
393
|
+
declare function addToCart(config: SdkConfig, accessToken: string, item: {
|
|
957
394
|
product_id: string;
|
|
958
395
|
product_slug: string;
|
|
959
396
|
product_name: string;
|
|
@@ -968,23 +405,23 @@ declare function addToCart(item: {
|
|
|
968
405
|
/**
|
|
969
406
|
* Update item quantity in authenticated user's cart.
|
|
970
407
|
*/
|
|
971
|
-
declare function updateCartItem(itemId: string, quantity: number): Promise<CartResponse>;
|
|
408
|
+
declare function updateCartItem(config: SdkConfig, accessToken: string, itemId: string, quantity: number): Promise<CartResponse>;
|
|
972
409
|
/**
|
|
973
410
|
* Remove item from authenticated user's cart.
|
|
974
411
|
*/
|
|
975
|
-
declare function removeFromCart(itemId: string): Promise<CartResponse>;
|
|
412
|
+
declare function removeFromCart(config: SdkConfig, accessToken: string, itemId: string): Promise<CartResponse>;
|
|
976
413
|
/**
|
|
977
414
|
* Clear authenticated user's cart.
|
|
978
415
|
*/
|
|
979
|
-
declare function clearCart(): Promise<void>;
|
|
416
|
+
declare function clearCart(config: SdkConfig, accessToken: string): Promise<void>;
|
|
980
417
|
/**
|
|
981
418
|
* Merge guest cart (from Redis) into authenticated user's DB cart.
|
|
982
419
|
*/
|
|
983
|
-
declare function mergeGuestCart(): Promise<CartResponse>;
|
|
420
|
+
declare function mergeGuestCart(config: SdkConfig, accessToken: string, guestSessionId: string): Promise<CartResponse>;
|
|
984
421
|
/**
|
|
985
422
|
* Convenience wrapper: merge guest cart if it has items (called post-login).
|
|
986
423
|
*/
|
|
987
|
-
declare function mergeGuestCartIfPresent(): Promise<void>;
|
|
424
|
+
declare function mergeGuestCartIfPresent(config: SdkConfig, accessToken: string, guestSessionId: string): Promise<void>;
|
|
988
425
|
/**
|
|
989
426
|
* Returns 0 — count is now server-driven. Use the hook instead.
|
|
990
427
|
* Kept for backward compatibility.
|
|
@@ -1000,157 +437,191 @@ declare function getGuestCartSubtotal(): number;
|
|
|
1000
437
|
*/
|
|
1001
438
|
declare function getGuestCartProductType(): "physical" | "digital" | "bespoke";
|
|
1002
439
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Order Service
|
|
442
|
+
*
|
|
443
|
+
* Handles order operations including creation, lookup, and tracking.
|
|
444
|
+
* Stateless - all configuration passed as parameters.
|
|
445
|
+
*/
|
|
446
|
+
|
|
447
|
+
declare function createOrder(config: SdkConfig, accessToken: string, payload: CreateOrderParams): Promise<Order>;
|
|
448
|
+
declare function findOrder(config: SdkConfig, params: FindOrderParams & {
|
|
449
|
+
guest_token?: string;
|
|
450
|
+
}): Promise<Order>;
|
|
451
|
+
declare function findOrderByToken(config: SdkConfig, token: string): Promise<Order>;
|
|
452
|
+
declare function getOrders(config: SdkConfig, accessToken: string, params?: {
|
|
1007
453
|
email?: string;
|
|
1008
454
|
page?: number;
|
|
1009
455
|
page_size?: number;
|
|
1010
456
|
}): Promise<Order[]>;
|
|
1011
|
-
declare function cancelOrder(orderId: string, reason: string): Promise<Order>;
|
|
1012
|
-
declare function trackOrder(orderId: string, token?: string): Promise<Order>;
|
|
457
|
+
declare function cancelOrder(config: SdkConfig, accessToken: string, orderId: string, reason: string): Promise<Order>;
|
|
458
|
+
declare function trackOrder(config: SdkConfig, orderId: string, token?: string): Promise<Order>;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Customer auth service — all API calls scoped to this storefront's business tenant.
|
|
462
|
+
* Stateless - all configuration passed as parameters.
|
|
463
|
+
*/
|
|
1013
464
|
|
|
1014
465
|
/**
|
|
1015
466
|
* POST /auth/login/customer/
|
|
1016
|
-
* The `tenant_id` is automatically filled from config.
|
|
467
|
+
* The `tenant_id` is automatically filled from config.businessId.
|
|
1017
468
|
*/
|
|
1018
|
-
declare function loginCustomer(payload: Omit<CustomerLoginPayload, 'tenant_id'>): Promise<CustomerAuthResponse>;
|
|
469
|
+
declare function loginCustomer(config: SdkConfig, payload: Omit<CustomerLoginPayload, 'tenant_id'>): Promise<CustomerAuthResponse>;
|
|
1019
470
|
/**
|
|
1020
471
|
* POST /auth/register/customer/
|
|
1021
|
-
* The `tenant_id` is automatically filled from config.
|
|
472
|
+
* The `tenant_id` is automatically filled from config.businessId.
|
|
473
|
+
*/
|
|
474
|
+
declare function registerCustomer(config: SdkConfig, payload: Omit<CustomerRegisterPayload, 'tenant_id'>): Promise<CustomerAuthResponse>;
|
|
475
|
+
/** POST /auth/token/refresh/
|
|
1022
476
|
*/
|
|
1023
|
-
declare function
|
|
1024
|
-
/** POST /auth/logout/ — revokes the server-side session.
|
|
1025
|
-
declare function logout(): Promise<void>;
|
|
477
|
+
declare function refreshToken(config: SdkConfig, refresh: string): Promise<RefreshTokenResponse>;
|
|
478
|
+
/** POST /auth/logout/ — revokes the server-side session. */
|
|
479
|
+
declare function logout(config: SdkConfig, refresh?: string): Promise<void>;
|
|
1026
480
|
/**
|
|
1027
481
|
* Verify a social provider id_token (or access_token for Facebook) with the backend.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
* 1. Customer completes Google/Facebook sign-in on the storefront
|
|
1032
|
-
* 2. Storefront receives an id_token / access_token from the provider
|
|
1033
|
-
* 3. This function sends it to the backend for server-side verification
|
|
1034
|
-
* 4. Backend returns our JWT tokens
|
|
1035
|
-
*/
|
|
1036
|
-
declare function verifySocialToken(provider: 'google' | 'facebook', token: string): Promise<CustomerAuthResponse>;
|
|
1037
|
-
/** Map luxe-auth UserSerializer response to storefront CustomerUser. */
|
|
482
|
+
*/
|
|
483
|
+
declare function verifySocialToken(config: SdkConfig, provider: 'google' | 'facebook', token: string): Promise<CustomerAuthResponse>;
|
|
484
|
+
/** Map kasuvia-auth UserSerializer response to storefront CustomerUser. */
|
|
1038
485
|
declare function mapAuthUserToCustomer(data: AuthUserResponse, provider?: CustomerUser['provider']): CustomerUser;
|
|
1039
486
|
/** GET /auth/profile/ */
|
|
1040
|
-
declare function getMe(): Promise<CustomerUser>;
|
|
487
|
+
declare function getMe(config?: SdkConfig, accessToken?: string): Promise<CustomerUser>;
|
|
1041
488
|
/** GET /auth/profile/ - alias for getMe for backward compatibility */
|
|
1042
|
-
declare function getAuthUser(): Promise<AuthUserResponse>;
|
|
489
|
+
declare function getAuthUser(config?: SdkConfig, accessToken?: string): Promise<AuthUserResponse>;
|
|
1043
490
|
/** PUT /auth/profile/ — update firstname, lastname, phone */
|
|
1044
|
-
declare function updateProfile(
|
|
491
|
+
declare function updateProfile(configOrPayload: SdkConfig | UpdateProfilePayload, accessTokenOrPayload?: string | UpdateProfilePayload, payloadParam?: UpdateProfilePayload): Promise<CustomerUser>;
|
|
1045
492
|
/**
|
|
1046
493
|
* Silently refresh the access token on app boot.
|
|
1047
494
|
* Builds CustomerUser from JWT claims — no additional profile API call needed.
|
|
1048
495
|
* Returns null if no refresh token exists or if the refresh fails.
|
|
1049
|
-
* Includes a concurrent lock to prevent React Strict Mode from double-firing and blacklisting the token.
|
|
1050
|
-
*
|
|
1051
|
-
* Network error resilience:
|
|
1052
|
-
* - Classifies errors as network vs auth
|
|
1053
|
-
* - Retries transient network errors with exponential backoff
|
|
1054
|
-
* - Immediately fails on auth errors (401/403) to avoid infinite loops
|
|
1055
|
-
* - Clears auth state on any failure to ensure consistent logout behavior
|
|
1056
496
|
*/
|
|
1057
|
-
declare function silentRefresh(): Promise<{
|
|
497
|
+
declare function silentRefresh(config: SdkConfig, refresh: string): Promise<{
|
|
1058
498
|
user: CustomerUser;
|
|
1059
499
|
provider: CustomerUser['provider'];
|
|
500
|
+
newAccessToken: string;
|
|
501
|
+
newRefreshToken: string;
|
|
1060
502
|
} | null>;
|
|
1061
|
-
/**
|
|
1062
|
-
|
|
503
|
+
/**
|
|
504
|
+
* Store tokens in localStorage (client-side utility)
|
|
505
|
+
* This is a convenience function for storefronts to store auth tokens
|
|
506
|
+
*/
|
|
507
|
+
declare function storeTokens(accessToken: string, refreshToken: string): void;
|
|
508
|
+
/**
|
|
509
|
+
* Clear tokens from localStorage (client-side utility)
|
|
510
|
+
*/
|
|
511
|
+
declare function clearTokens(): void;
|
|
512
|
+
/**
|
|
513
|
+
* Get stored tokens from localStorage (client-side utility)
|
|
514
|
+
*/
|
|
515
|
+
declare function getStoredTokens(): {
|
|
516
|
+
accessToken: string | null;
|
|
517
|
+
refreshToken: string | null;
|
|
518
|
+
};
|
|
1063
519
|
|
|
1064
520
|
/**
|
|
1065
521
|
* Fetch all active products for the storefront.
|
|
1066
522
|
*/
|
|
1067
|
-
declare function getStorefrontProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
523
|
+
declare function getStorefrontProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1068
524
|
/**
|
|
1069
525
|
* Fetch a single product by slug for the storefront.
|
|
1070
526
|
*/
|
|
1071
|
-
declare function getStorefrontProductBySlug(slug: string): Promise<Product>;
|
|
527
|
+
declare function getStorefrontProductBySlug(config: SdkConfig, slug: string): Promise<Product>;
|
|
1072
528
|
/**
|
|
1073
529
|
* Fetch latest products for the storefront.
|
|
1074
530
|
*/
|
|
1075
|
-
declare function getLatestProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
531
|
+
declare function getLatestProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1076
532
|
/**
|
|
1077
533
|
* Fetch popular products for the storefront.
|
|
1078
534
|
*/
|
|
1079
|
-
declare function getPopularProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
535
|
+
declare function getPopularProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1080
536
|
/**
|
|
1081
537
|
* Fetch featured products for the storefront.
|
|
1082
538
|
*/
|
|
1083
|
-
declare function getFeaturedProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
539
|
+
declare function getFeaturedProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1084
540
|
/**
|
|
1085
541
|
* Fetch new products for the storefront.
|
|
1086
542
|
*/
|
|
1087
|
-
declare function getNewProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
543
|
+
declare function getNewProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
544
|
+
/**
|
|
545
|
+
* Fetch products currently on sale for the storefront.
|
|
546
|
+
*/
|
|
547
|
+
declare function getOnSaleProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
548
|
+
/**
|
|
549
|
+
* Fetch products with low stock for the storefront.
|
|
550
|
+
*/
|
|
551
|
+
declare function getLowStockProducts(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1088
552
|
/**
|
|
1089
553
|
* Fetch recommended products for the storefront.
|
|
1090
554
|
* Returns featured, popular, and new products.
|
|
1091
555
|
* Optionally excludes a specific product ID.
|
|
1092
556
|
*/
|
|
1093
|
-
declare function getRecommendedProducts(params?: ListParams & {
|
|
557
|
+
declare function getRecommendedProducts(config: SdkConfig, params?: ListParams & {
|
|
1094
558
|
excludeProductId?: string;
|
|
1095
559
|
}): Promise<PaginatedResponse<Product>>;
|
|
1096
560
|
|
|
1097
561
|
/**
|
|
1098
562
|
* Fetch paginated active collections for the storefront.
|
|
1099
563
|
*/
|
|
1100
|
-
declare function getStorefrontCollections(params?: ListParams): Promise<PaginatedResponse<Collection>>;
|
|
564
|
+
declare function getStorefrontCollections(config: SdkConfig, params?: ListParams): Promise<PaginatedResponse<Collection>>;
|
|
1101
565
|
/**
|
|
1102
566
|
* Fetch a single collection by its slug.
|
|
1103
567
|
*/
|
|
1104
|
-
declare function getStorefrontCollectionBySlug(slug: string): Promise<Collection>;
|
|
568
|
+
declare function getStorefrontCollectionBySlug(config: SdkConfig, slug: string): Promise<Collection>;
|
|
1105
569
|
|
|
1106
570
|
/**
|
|
1107
571
|
* Fetch the customer's wishlist for the current business.
|
|
1108
572
|
*/
|
|
1109
|
-
declare function getWishlist(params?: {
|
|
573
|
+
declare function getWishlist(config: SdkConfig, accessToken: string, params?: {
|
|
1110
574
|
page?: number;
|
|
1111
575
|
pageSize?: number;
|
|
1112
576
|
}): Promise<WishlistListResponse>;
|
|
1113
577
|
/**
|
|
1114
578
|
* Check if a product is in the customer's wishlist.
|
|
1115
579
|
*/
|
|
1116
|
-
declare function checkInWishlist(productId: string): Promise<WishlistCheckResponse>;
|
|
580
|
+
declare function checkInWishlist(config: SdkConfig, accessToken: string, productId: string): Promise<WishlistCheckResponse>;
|
|
1117
581
|
/**
|
|
1118
582
|
* Add a product to the customer's wishlist.
|
|
1119
583
|
*/
|
|
1120
|
-
declare function addToWishlist(productId: string, notes?: string): Promise<WishlistItem>;
|
|
584
|
+
declare function addToWishlist(config: SdkConfig, accessToken: string, productId: string, notes?: string): Promise<WishlistItem>;
|
|
1121
585
|
/**
|
|
1122
586
|
* Remove an item from the customer's wishlist by item ID.
|
|
1123
587
|
*/
|
|
1124
|
-
declare function removeFromWishlist(itemId: string): Promise<void>;
|
|
588
|
+
declare function removeFromWishlist(config: SdkConfig, accessToken: string, itemId: string): Promise<void>;
|
|
1125
589
|
/**
|
|
1126
590
|
* Remove a product from the customer's wishlist by product ID.
|
|
1127
591
|
*/
|
|
1128
|
-
declare function removeProductFromWishlist(productId: string): Promise<void>;
|
|
592
|
+
declare function removeProductFromWishlist(config: SdkConfig, accessToken: string, productId: string): Promise<void>;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Payment Service
|
|
596
|
+
*
|
|
597
|
+
* Customer-facing payment API for payment initiation and verification.
|
|
598
|
+
* Stateless - all configuration passed as parameters.
|
|
599
|
+
*/
|
|
1129
600
|
|
|
1130
601
|
/**
|
|
1131
602
|
* Create a Monnify Dedicated Virtual Account so the customer can pay via
|
|
1132
603
|
* bank transfer. Note: Monnify DVA only supports NGN currency - the backend
|
|
1133
604
|
* will reject non-NGN requests for this payment method.
|
|
1134
605
|
*/
|
|
1135
|
-
declare function createDedicatedAccount(request: DVACreateRequest): Promise<DVADetails>;
|
|
606
|
+
declare function createDedicatedAccount(config: SdkConfig, accessToken: string, request: DVACreateRequest): Promise<DVADetails>;
|
|
1136
607
|
/**
|
|
1137
608
|
* Initiate a card payment (customer → business owner).
|
|
1138
609
|
* Routes to Monnify (NGN) or Flutterwave (non-NGN) on the backend.
|
|
1139
610
|
* Returns a checkout_url to redirect the customer to the gateway.
|
|
1140
611
|
*/
|
|
1141
|
-
declare function initiatePayment(request: PaymentInitiateRequest): Promise<PaymentInitiateResponse>;
|
|
612
|
+
declare function initiatePayment(config: SdkConfig, accessToken: string, request: PaymentInitiateRequest): Promise<PaymentInitiateResponse>;
|
|
1142
613
|
/**
|
|
1143
614
|
* Request a 15-minute rate-locked conversion quote for non-NGN transactions.
|
|
1144
615
|
*/
|
|
1145
|
-
declare function requestQuote(amount: number): Promise<ConversionQuote>;
|
|
616
|
+
declare function requestQuote(config: SdkConfig, amount: number): Promise<ConversionQuote>;
|
|
1146
617
|
/**
|
|
1147
618
|
* Verify a payment after the gateway redirects back to /checkout/verify.
|
|
1148
619
|
*/
|
|
1149
|
-
declare function verifyTransaction(
|
|
620
|
+
declare function verifyTransaction(configOrReference: SdkConfig | string, reference?: string): Promise<TransactionVerifyResponse>;
|
|
1150
621
|
/**
|
|
1151
622
|
* Poll transaction status by internal transaction ID.
|
|
1152
623
|
*/
|
|
1153
|
-
declare function getTransactionStatus(transactionId: string): Promise<TransactionVerifyResponse>;
|
|
624
|
+
declare function getTransactionStatus(config: SdkConfig, transactionId: string): Promise<TransactionVerifyResponse>;
|
|
1154
625
|
declare const paymentService: {
|
|
1155
626
|
readonly createDedicatedAccount: typeof createDedicatedAccount;
|
|
1156
627
|
readonly initiatePayment: typeof initiatePayment;
|
|
@@ -1159,12 +630,19 @@ declare const paymentService: {
|
|
|
1159
630
|
readonly getTransactionStatus: typeof getTransactionStatus;
|
|
1160
631
|
};
|
|
1161
632
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
633
|
+
/**
|
|
634
|
+
* Consultation Service
|
|
635
|
+
*
|
|
636
|
+
* Handles consultation operations for bespoke and service products.
|
|
637
|
+
* Stateless - all configuration passed as parameters.
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
declare function createConsultation(config: SdkConfig, accessToken: string, payload: ConsultationCreatePayload): Promise<Consultation>;
|
|
641
|
+
declare function getConsultations(config: SdkConfig, accessToken: string): Promise<Consultation[]>;
|
|
642
|
+
declare function getConsultation(config: SdkConfig, accessToken: string, id: string): Promise<Consultation>;
|
|
643
|
+
declare function sendMessage(config: SdkConfig, accessToken: string, id: string, payload: ConsultationMessagePayload): Promise<void>;
|
|
644
|
+
declare function acceptQuote(config: SdkConfig, accessToken: string, id: string, payload: ConsultationQuoteAcceptPayload): Promise<Consultation>;
|
|
645
|
+
declare function rejectQuote(config: SdkConfig, accessToken: string, id: string, reason?: string): Promise<Consultation>;
|
|
1168
646
|
declare const consultationService: {
|
|
1169
647
|
createConsultation: typeof createConsultation;
|
|
1170
648
|
getConsultations: typeof getConsultations;
|
|
@@ -1174,6 +652,13 @@ declare const consultationService: {
|
|
|
1174
652
|
rejectQuote: typeof rejectQuote;
|
|
1175
653
|
};
|
|
1176
654
|
|
|
655
|
+
/**
|
|
656
|
+
* Logistics Service
|
|
657
|
+
*
|
|
658
|
+
* Handles shipping rates and address validation.
|
|
659
|
+
* Stateless - all configuration passed as parameters.
|
|
660
|
+
*/
|
|
661
|
+
|
|
1177
662
|
interface CartItemPayload {
|
|
1178
663
|
product: {
|
|
1179
664
|
name: string;
|
|
@@ -1197,11 +682,11 @@ interface ShippingRatesRequest {
|
|
|
1197
682
|
/**
|
|
1198
683
|
* Fetch shipping rates for a cart.
|
|
1199
684
|
*/
|
|
1200
|
-
declare function getShippingRates(payload: ShippingRatesRequest): Promise<ShippingRatesResponse>;
|
|
685
|
+
declare function getShippingRates(config: SdkConfig, payload: ShippingRatesRequest): Promise<ShippingRatesResponse>;
|
|
1201
686
|
/**
|
|
1202
687
|
* Fetch the seller's registered shipping address.
|
|
1203
688
|
*/
|
|
1204
|
-
declare function getSellerShippingAddress(): Promise<{
|
|
689
|
+
declare function getSellerShippingAddress(config: SdkConfig): Promise<{
|
|
1205
690
|
terminal_address_id: string | null;
|
|
1206
691
|
address_details: {
|
|
1207
692
|
city: string;
|
|
@@ -1217,7 +702,7 @@ declare function getSellerShippingAddress(): Promise<{
|
|
|
1217
702
|
/**
|
|
1218
703
|
* Validate a shipping address.
|
|
1219
704
|
*/
|
|
1220
|
-
declare function validateShippingAddress(payload: {
|
|
705
|
+
declare function validateShippingAddress(config: SdkConfig, payload: {
|
|
1221
706
|
first_name: string;
|
|
1222
707
|
last_name: string;
|
|
1223
708
|
phone: string;
|
|
@@ -1243,19 +728,33 @@ declare const logisticsService: {
|
|
|
1243
728
|
validateShippingAddress: typeof validateShippingAddress;
|
|
1244
729
|
};
|
|
1245
730
|
|
|
1246
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Bespoke Service
|
|
733
|
+
*
|
|
734
|
+
* Handles bespoke product availability checks.
|
|
735
|
+
* Stateless - all configuration passed as parameters.
|
|
736
|
+
*/
|
|
737
|
+
|
|
738
|
+
declare function checkAvailability(config: SdkConfig, product_id: string): Promise<BespokeAvailability>;
|
|
1247
739
|
declare const bespokeService: {
|
|
1248
740
|
checkAvailability: typeof checkAvailability;
|
|
1249
741
|
};
|
|
1250
742
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
declare function
|
|
743
|
+
/**
|
|
744
|
+
* Service Booking Service
|
|
745
|
+
*
|
|
746
|
+
* Handles service appointments and deliverables.
|
|
747
|
+
* Stateless - all configuration passed as parameters.
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
declare function getAvailableSlots(config: SdkConfig, product_id: string, date_from: string, date_to: string): Promise<AvailableSlot[]>;
|
|
751
|
+
declare function bookAppointment(config: SdkConfig, accessToken: string, payload: ServiceAppointmentCreatePayload): Promise<ServiceAppointment>;
|
|
752
|
+
declare function getAppointments(config: SdkConfig, accessToken: string): Promise<ServiceAppointment[]>;
|
|
753
|
+
declare function getAppointment(config: SdkConfig, accessToken: string, id: string): Promise<ServiceAppointment>;
|
|
754
|
+
declare function cancelAppointment(config: SdkConfig, accessToken: string, id: string): Promise<void>;
|
|
755
|
+
declare function getDeliverables(config: SdkConfig, accessToken: string, order_id: string): Promise<ServiceDeliverable[]>;
|
|
756
|
+
declare function approveDeliverable(config: SdkConfig, accessToken: string, order_id: string, deliverable_id: string): Promise<ServiceDeliverable>;
|
|
757
|
+
declare function requestRevision(config: SdkConfig, accessToken: string, order_id: string, deliverable_id: string, feedback: string): Promise<ServiceDeliverable>;
|
|
1259
758
|
declare const serviceBookingService: {
|
|
1260
759
|
getAvailableSlots: typeof getAvailableSlots;
|
|
1261
760
|
bookAppointment: typeof bookAppointment;
|
|
@@ -1267,6 +766,13 @@ declare const serviceBookingService: {
|
|
|
1267
766
|
requestRevision: typeof requestRevision;
|
|
1268
767
|
};
|
|
1269
768
|
|
|
769
|
+
/**
|
|
770
|
+
* Notification Service
|
|
771
|
+
*
|
|
772
|
+
* Handles contact form submissions and email notifications.
|
|
773
|
+
* Stateless - all configuration passed as parameters.
|
|
774
|
+
*/
|
|
775
|
+
|
|
1270
776
|
interface ContactFormData {
|
|
1271
777
|
name: string;
|
|
1272
778
|
email: string;
|
|
@@ -1278,17 +784,17 @@ interface ContactFormData {
|
|
|
1278
784
|
turnstile_token?: string;
|
|
1279
785
|
}
|
|
1280
786
|
/**
|
|
1281
|
-
* Send contact email to
|
|
787
|
+
* Send contact email to Kasuvia team.
|
|
1282
788
|
* POST /contact/send-contact-email
|
|
1283
789
|
*/
|
|
1284
|
-
declare function sendContactEmail(payload: ContactFormData): Promise<{
|
|
790
|
+
declare function sendContactEmail(config: SdkConfig, payload: ContactFormData): Promise<{
|
|
1285
791
|
detail: string;
|
|
1286
792
|
}>;
|
|
1287
793
|
/**
|
|
1288
794
|
* Send confirmation email to user.
|
|
1289
795
|
* POST /contact/send-contact-confirmation
|
|
1290
796
|
*/
|
|
1291
|
-
declare function sendContactConfirmation(payload: Omit<ContactFormData, 'turnstile_token'>): Promise<{
|
|
797
|
+
declare function sendContactConfirmation(config: SdkConfig, payload: Omit<ContactFormData, 'turnstile_token'>): Promise<{
|
|
1292
798
|
detail: string;
|
|
1293
799
|
}>;
|
|
1294
800
|
declare const notificationsService: {
|
|
@@ -1303,509 +809,69 @@ declare const notificationsService: {
|
|
|
1303
809
|
*/
|
|
1304
810
|
declare function googleTranslate(text: string, target: string, source?: string): Promise<string>;
|
|
1305
811
|
|
|
812
|
+
/**
|
|
813
|
+
* Config Service
|
|
814
|
+
*
|
|
815
|
+
* Handles configuration endpoints (languages, currencies, locales, business config).
|
|
816
|
+
* Stateless - all configuration passed as parameters.
|
|
817
|
+
*/
|
|
818
|
+
|
|
1306
819
|
/**
|
|
1307
820
|
* Fetch supported languages from the payment system.
|
|
1308
|
-
* Resolves to: {
|
|
821
|
+
* Resolves to: {kasuviaPaymentBackendUrl}/config/supported-languages
|
|
1309
822
|
*/
|
|
1310
|
-
declare function getSupportedLanguages(): Promise<SupportedLanguagesResponse>;
|
|
823
|
+
declare function getSupportedLanguages(config: SdkConfig): Promise<SupportedLanguagesResponse>;
|
|
1311
824
|
/**
|
|
1312
825
|
* Fetch supported currencies from the payment system.
|
|
1313
|
-
* Resolves to: {
|
|
826
|
+
* Resolves to: {kasuviaPaymentBackendUrl}/config/supported-currencies
|
|
1314
827
|
*/
|
|
1315
|
-
declare function getSupportedCurrencies(): Promise<SupportedCurrenciesResponse>;
|
|
828
|
+
declare function getSupportedCurrencies(config: SdkConfig): Promise<SupportedCurrenciesResponse>;
|
|
1316
829
|
/**
|
|
1317
830
|
* Fetch the business's public configuration, including store_currency.
|
|
1318
|
-
* Uses
|
|
1319
|
-
* Resolves to: {
|
|
831
|
+
* Uses storefront API key header (X-Storefront-Key).
|
|
832
|
+
* Resolves to: {kasuviaAuthBackendUrl}/internal/businesses/{business_id}/
|
|
833
|
+
* This endpoint is designed for storefronts to fetch business config using their storefront API key.
|
|
1320
834
|
*/
|
|
1321
|
-
declare function getBusinessConfig(): Promise<BusinessConfig>;
|
|
835
|
+
declare function getBusinessConfig(config: SdkConfig): Promise<BusinessConfig>;
|
|
1322
836
|
declare const configService: {
|
|
1323
837
|
readonly getSupportedLanguages: typeof getSupportedLanguages;
|
|
1324
838
|
readonly getSupportedCurrencies: typeof getSupportedCurrencies;
|
|
1325
839
|
readonly getBusinessConfig: typeof getBusinessConfig;
|
|
1326
840
|
};
|
|
1327
841
|
|
|
842
|
+
/**
|
|
843
|
+
* CMS Service
|
|
844
|
+
*
|
|
845
|
+
* Handles CMS model and entry operations using the kasuvia-cms SDK endpoints.
|
|
846
|
+
* Protected by X-Storefront-Key and X-Business-ID headers.
|
|
847
|
+
* Stateless - all configuration passed as parameters.
|
|
848
|
+
*/
|
|
849
|
+
|
|
1328
850
|
/**
|
|
1329
851
|
* List CMS entries for a specific model.
|
|
1330
852
|
* Requires public_api.read permission on the model.
|
|
1331
853
|
*/
|
|
1332
|
-
declare function listCmsEntries(modelSlug: string, params?: ListCmsEntriesParams): Promise<CmsEntryListResponse>;
|
|
854
|
+
declare function listCmsEntries(config: SdkConfig, modelSlug: string, params?: ListCmsEntriesParams): Promise<CmsEntryListResponse>;
|
|
1333
855
|
/**
|
|
1334
856
|
* Get a single CMS entry by ID.
|
|
1335
857
|
* Requires public_api.read permission on the model.
|
|
1336
858
|
*/
|
|
1337
|
-
declare function getCmsEntry(modelSlug: string, entryId: string): Promise<CmsEntry>;
|
|
859
|
+
declare function getCmsEntry(config: SdkConfig, modelSlug: string, entryId: string): Promise<CmsEntry>;
|
|
1338
860
|
/**
|
|
1339
861
|
* Create a new CMS entry.
|
|
1340
862
|
* Requires public_api.create permission on the model.
|
|
1341
863
|
*/
|
|
1342
|
-
declare function createCmsEntry(modelSlug: string, params: CreateCmsEntryParams): Promise<CmsEntry>;
|
|
864
|
+
declare function createCmsEntry(config: SdkConfig, accessToken: string, modelSlug: string, params: CreateCmsEntryParams): Promise<CmsEntry>;
|
|
1343
865
|
/**
|
|
1344
866
|
* Update an existing CMS entry.
|
|
1345
867
|
* Requires public_api.update permission on the model.
|
|
1346
868
|
*/
|
|
1347
|
-
declare function updateCmsEntry(modelSlug: string, entryId: string, params: UpdateCmsEntryParams): Promise<CmsEntry>;
|
|
869
|
+
declare function updateCmsEntry(config: SdkConfig, accessToken: string, modelSlug: string, entryId: string, params: UpdateCmsEntryParams): Promise<CmsEntry>;
|
|
1348
870
|
/**
|
|
1349
871
|
* Delete a CMS entry.
|
|
1350
872
|
* Requires public_api.delete permission on the model.
|
|
1351
873
|
*/
|
|
1352
|
-
declare function deleteCmsEntry(modelSlug: string, entryId: string): Promise<void>;
|
|
1353
|
-
|
|
1354
|
-
/**
|
|
1355
|
-
* Cart Hook & Context Provider
|
|
1356
|
-
*
|
|
1357
|
-
* React Query hooks for cart operations with unified drawer state sharing.
|
|
1358
|
-
*/
|
|
1359
|
-
|
|
1360
|
-
interface UseCartReturn {
|
|
1361
|
-
cart: CartResponse | undefined;
|
|
1362
|
-
items: CartItem[];
|
|
1363
|
-
count: number;
|
|
1364
|
-
isOpen: boolean;
|
|
1365
|
-
setOpen: (open: boolean) => void;
|
|
1366
|
-
isLoading: boolean;
|
|
1367
|
-
error: Error | null;
|
|
1368
|
-
addToCart: (item: {
|
|
1369
|
-
product_id: string;
|
|
1370
|
-
product_slug: string;
|
|
1371
|
-
product_name: string;
|
|
1372
|
-
image?: string;
|
|
1373
|
-
variant_id?: string;
|
|
1374
|
-
variant_attributes?: string;
|
|
1375
|
-
unit_price: number;
|
|
1376
|
-
quantity: number;
|
|
1377
|
-
custom_measurements?: string;
|
|
1378
|
-
is_bespoke: boolean;
|
|
1379
|
-
}) => void;
|
|
1380
|
-
updateCartItem: (variables: {
|
|
1381
|
-
itemId: string;
|
|
1382
|
-
quantity: number;
|
|
1383
|
-
}) => void;
|
|
1384
|
-
removeFromCart: (itemId: string) => void;
|
|
1385
|
-
clearCart: () => void;
|
|
1386
|
-
clear: () => void;
|
|
1387
|
-
mergeGuestCart: () => void;
|
|
1388
|
-
addItem: (product: Product, variantId?: string, quantity?: number, customMeasurements?: Record<string, string>) => void;
|
|
1389
|
-
updateQty: (itemId: string, quantity: number) => void;
|
|
1390
|
-
removeItem: (itemId: string) => void;
|
|
1391
|
-
subtotal: number;
|
|
1392
|
-
productTypeMismatch: {
|
|
1393
|
-
message: string;
|
|
1394
|
-
existing_type: string;
|
|
1395
|
-
new_type: string;
|
|
1396
|
-
} | null;
|
|
1397
|
-
handleClearCartAndAdd: () => void;
|
|
1398
|
-
handleKeepCurrentCart: () => void;
|
|
1399
|
-
}
|
|
1400
|
-
interface CartContextValue {
|
|
1401
|
-
isOpen: boolean;
|
|
1402
|
-
setOpen: (open: boolean) => void;
|
|
1403
|
-
}
|
|
1404
|
-
declare const CartCtx: React.Context<CartContextValue | null> | null;
|
|
1405
|
-
declare function CartProvider({ children }: {
|
|
1406
|
-
children: ReactNode;
|
|
1407
|
-
}): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.FunctionComponentElement<React.ProviderProps<CartContextValue | null>> | null | undefined;
|
|
1408
|
-
declare function useCart(): UseCartReturn;
|
|
1409
|
-
|
|
1410
|
-
declare function useOrders(params?: {
|
|
1411
|
-
email?: string;
|
|
1412
|
-
page?: number;
|
|
1413
|
-
page_size?: number;
|
|
1414
|
-
}): _tanstack_react_query.UseQueryResult<NoInfer<Order[]>, Error>;
|
|
1415
|
-
declare function useOrdersList(params?: {
|
|
1416
|
-
email?: string;
|
|
1417
|
-
page?: number;
|
|
1418
|
-
page_size?: number;
|
|
1419
|
-
}): _tanstack_react_query.UseQueryResult<NoInfer<Order[]>, Error>;
|
|
1420
|
-
declare function useFindOrder(params: FindOrderParams): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
1421
|
-
declare function useOrder(params: FindOrderParams): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
1422
|
-
declare function useOrderTracking(orderId: string, token?: string): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
1423
|
-
declare function useCreateOrder(): _tanstack_react_query.UseMutationResult<Order, Error, CreateOrderParams, unknown>;
|
|
1424
|
-
declare function useCancelOrder(): _tanstack_react_query.UseMutationResult<Order, Error, {
|
|
1425
|
-
orderId: string;
|
|
1426
|
-
reason: string;
|
|
1427
|
-
}, unknown>;
|
|
1428
|
-
|
|
1429
|
-
declare const AuthCtx: React.Context<AuthContextValue | null> | null;
|
|
1430
|
-
declare function AuthProvider({ children }: {
|
|
1431
|
-
children: ReactNode;
|
|
1432
|
-
}): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.FunctionComponentElement<React.ProviderProps<AuthContextValue | null>> | null | undefined;
|
|
1433
|
-
declare function useAuthUser(): _tanstack_react_query.UseQueryResult<NoInfer<AuthUserResponse>, Error>;
|
|
1434
|
-
declare function useLogin(): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, Omit<CustomerLoginPayload, "tenant_id">, unknown>;
|
|
1435
|
-
declare function useRegister(): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, Omit<CustomerRegisterPayload, "tenant_id">, unknown>;
|
|
1436
|
-
declare function useUpdateProfile(): _tanstack_react_query.UseMutationResult<CustomerUser, Error, UpdateProfilePayload, unknown>;
|
|
1437
|
-
declare function useLogout(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
|
|
1438
|
-
/**
|
|
1439
|
-
* useAuth()
|
|
1440
|
-
* Consumes the AuthCtx provider value. Falls back to local hook query if no provider exists.
|
|
1441
|
-
*/
|
|
1442
|
-
declare function useAuth(): AuthContextValue;
|
|
1443
|
-
|
|
1444
|
-
declare function getCountries(): Promise<Country[]>;
|
|
1445
|
-
declare function useCountries(): _tanstack_react_query.UseQueryResult<NoInfer<Country[]>, Error>;
|
|
1446
|
-
|
|
1447
|
-
declare function getStates(countryIso: string): Promise<State[]>;
|
|
1448
|
-
declare function useStates(countryIso: string): _tanstack_react_query.UseQueryResult<NoInfer<State[]>, Error>;
|
|
1449
|
-
|
|
1450
|
-
declare function getSupportedLanguagesList(): Promise<SupportedLang[]>;
|
|
1451
|
-
declare function useSupportedLanguages(): _tanstack_react_query.UseQueryResult<NoInfer<SupportedLang[]>, Error>;
|
|
1452
|
-
|
|
1453
|
-
declare function getSupportedCurrenciesList(): Promise<Currency[]>;
|
|
1454
|
-
declare function useCurrencies(): _tanstack_react_query.UseQueryResult<NoInfer<Currency[]>, Error>;
|
|
1455
|
-
|
|
1456
|
-
/**
|
|
1457
|
-
* Get bespoke availability for a product
|
|
1458
|
-
*/
|
|
1459
|
-
declare function useBespokeAvailability(product_id: string): _tanstack_react_query.UseQueryResult<NoInfer<BespokeAvailability>, Error>;
|
|
1460
|
-
|
|
1461
|
-
declare const collectionKeys: {
|
|
1462
|
-
all: readonly ["core", "collections"];
|
|
1463
|
-
list: (params?: ListParams) => readonly ["core", "collections", "list", ListParams];
|
|
1464
|
-
slug: (slug: string) => readonly ["core", "collections", "slug", string];
|
|
1465
|
-
};
|
|
1466
|
-
/**
|
|
1467
|
-
* Hook to fetch paginated collections for the storefront.
|
|
1468
|
-
*/
|
|
1469
|
-
declare function useStorefrontCollections(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Collection>>, Error>;
|
|
1470
|
-
/**
|
|
1471
|
-
* Hook to fetch a single collection by slug for the storefront.
|
|
1472
|
-
*/
|
|
1473
|
-
declare function useStorefrontCollection(slug: string): _tanstack_react_query.UseQueryResult<NoInfer<Collection>, Error>;
|
|
1474
|
-
|
|
1475
|
-
declare const productKeys: {
|
|
1476
|
-
all: readonly ["products"];
|
|
1477
|
-
list: (params?: ListParams) => readonly ["products", "list", ListParams | undefined];
|
|
1478
|
-
detail: (slug: string) => readonly ["products", "detail", string];
|
|
1479
|
-
recommended: (params?: ListParams) => readonly ["products", "recommended", ListParams | undefined];
|
|
1480
|
-
latest: (params?: ListParams) => readonly ["products", "latest", ListParams | undefined];
|
|
1481
|
-
popular: (params?: ListParams) => readonly ["products", "popular", ListParams | undefined];
|
|
1482
|
-
featured: (params?: ListParams) => readonly ["products", "featured", ListParams | undefined];
|
|
1483
|
-
new: (params?: ListParams) => readonly ["products", "new", ListParams | undefined];
|
|
1484
|
-
};
|
|
1485
|
-
/**
|
|
1486
|
-
* Hook for fetching latest products.
|
|
1487
|
-
*/
|
|
1488
|
-
declare function useLatestProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1489
|
-
/**
|
|
1490
|
-
* Hook for fetching popular products.
|
|
1491
|
-
*/
|
|
1492
|
-
declare function usePopularProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1493
|
-
/**
|
|
1494
|
-
* Hook for fetching featured products.
|
|
1495
|
-
*/
|
|
1496
|
-
declare function useFeaturedProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1497
|
-
/**
|
|
1498
|
-
* Hook for fetching new products.
|
|
1499
|
-
*/
|
|
1500
|
-
declare function useNewProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1501
|
-
/**
|
|
1502
|
-
* Hook for fetching all active storefront products.
|
|
1503
|
-
*/
|
|
1504
|
-
declare function useStorefrontProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1505
|
-
/**
|
|
1506
|
-
* Hook for fetching a single product by slug.
|
|
1507
|
-
*/
|
|
1508
|
-
declare function useProduct(slug: string): _tanstack_react_query.UseQueryResult<NoInfer<Product>, Error>;
|
|
1509
|
-
/**
|
|
1510
|
-
* Hook for fetching recommended products.
|
|
1511
|
-
*/
|
|
1512
|
-
declare function useRecommendedProducts(params?: ListParams): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
1513
|
-
|
|
1514
|
-
declare const wishlistKeys: {
|
|
1515
|
-
all: readonly ["wishlist"];
|
|
1516
|
-
list: () => readonly ["wishlist", "list"];
|
|
1517
|
-
check: (productId: string) => readonly ["wishlist", "check", string];
|
|
1518
|
-
};
|
|
1519
|
-
/**
|
|
1520
|
-
* Hook for fetching the customer's wishlist.
|
|
1521
|
-
* Authentication-gated only - returns empty for unauthenticated users.
|
|
1522
|
-
*/
|
|
1523
|
-
declare function useWishlist(params?: {
|
|
1524
|
-
page?: number;
|
|
1525
|
-
pageSize?: number;
|
|
1526
|
-
}): _tanstack_react_query.UseQueryResult<NoInfer<WishlistListResponse>, Error>;
|
|
1527
|
-
/**
|
|
1528
|
-
* Hook for checking if a product is in the wishlist.
|
|
1529
|
-
* Authentication-gated only - returns false for unauthenticated users.
|
|
1530
|
-
*/
|
|
1531
|
-
declare function useCheckInWishlist(productId: string): _tanstack_react_query.UseQueryResult<NoInfer<WishlistCheckResponse>, Error>;
|
|
1532
|
-
/**
|
|
1533
|
-
* Hook for adding a product to the wishlist.
|
|
1534
|
-
* Authentication-gated only - triggers login modal for unauthenticated users.
|
|
1535
|
-
*/
|
|
1536
|
-
declare function useAddToWishlist(): _tanstack_react_query.UseMutationResult<WishlistItem, Error, {
|
|
1537
|
-
productId: string;
|
|
1538
|
-
notes?: string;
|
|
1539
|
-
}, unknown>;
|
|
1540
|
-
/**
|
|
1541
|
-
* Hook for removing an item from the wishlist by item ID.
|
|
1542
|
-
*/
|
|
1543
|
-
declare function useRemoveFromWishlist(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
1544
|
-
/**
|
|
1545
|
-
* Hook for removing a product from the wishlist by product ID.
|
|
1546
|
-
*/
|
|
1547
|
-
declare function useRemoveProductFromWishlist(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
1548
|
-
/**
|
|
1549
|
-
* Hook for getting wishlist count.
|
|
1550
|
-
* Authentication-gated only - returns 0 for unauthenticated users.
|
|
1551
|
-
*/
|
|
1552
|
-
declare function useWishlistCount(): _tanstack_react_query.UseQueryResult<number, Error>;
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* Get available slots for a service product
|
|
1556
|
-
*/
|
|
1557
|
-
declare function useAvailableSlots(product_id: string, date_from: string, date_to: string): _tanstack_react_query.UseQueryResult<NoInfer<AvailableSlot[]>, Error>;
|
|
1558
|
-
/**
|
|
1559
|
-
* Book a service appointment
|
|
1560
|
-
*/
|
|
1561
|
-
declare function useBookAppointment(): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, ServiceAppointmentCreatePayload, unknown>;
|
|
1562
|
-
/**
|
|
1563
|
-
* Get all appointments for the current user
|
|
1564
|
-
*/
|
|
1565
|
-
declare function useAppointments(): _tanstack_react_query.UseQueryResult<NoInfer<ServiceAppointment[]>, Error>;
|
|
1566
|
-
/**
|
|
1567
|
-
* Get a single appointment by ID
|
|
1568
|
-
*/
|
|
1569
|
-
declare function useAppointment(id: string): _tanstack_react_query.UseQueryResult<NoInfer<ServiceAppointment>, Error>;
|
|
1570
|
-
/**
|
|
1571
|
-
* Cancel an appointment
|
|
1572
|
-
*/
|
|
1573
|
-
declare function useCancelAppointment(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
1574
|
-
/**
|
|
1575
|
-
* Get deliverables for a project-based service order
|
|
1576
|
-
*/
|
|
1577
|
-
declare function useDeliverables(order_id: string): _tanstack_react_query.UseQueryResult<NoInfer<ServiceDeliverable[]>, Error>;
|
|
1578
|
-
/**
|
|
1579
|
-
* Approve a deliverable
|
|
1580
|
-
*/
|
|
1581
|
-
declare function useApproveDeliverable(order_id: string, deliverable_id: string): _tanstack_react_query.UseMutationResult<ServiceDeliverable, Error, void, unknown>;
|
|
1582
|
-
/**
|
|
1583
|
-
* Request revision for a deliverable
|
|
1584
|
-
*/
|
|
1585
|
-
declare function useRequestRevision(order_id: string, deliverable_id: string): _tanstack_react_query.UseMutationResult<ServiceDeliverable, Error, string, unknown>;
|
|
1586
|
-
|
|
1587
|
-
declare function useConsultations(): _tanstack_react_query.UseQueryResult<NoInfer<Consultation[]>, Error>;
|
|
1588
|
-
declare function useConsultation(id: string): _tanstack_react_query.UseQueryResult<NoInfer<Consultation>, Error>;
|
|
1589
|
-
declare function useCreateConsultation(): _tanstack_react_query.UseMutationResult<Consultation, Error, ConsultationCreatePayload, unknown>;
|
|
1590
|
-
declare function useSendMessage(consultationId: string): _tanstack_react_query.UseMutationResult<void, Error, ConsultationMessagePayload, unknown>;
|
|
1591
|
-
declare function useAcceptQuote(consultationId: string): _tanstack_react_query.UseMutationResult<Consultation, Error, ConsultationQuoteAcceptPayload, unknown>;
|
|
1592
|
-
declare function useRejectQuote(consultationId: string): _tanstack_react_query.UseMutationResult<Consultation, Error, string | undefined, unknown>;
|
|
1593
|
-
|
|
1594
|
-
interface ConsultationMessageData {
|
|
1595
|
-
event: string;
|
|
1596
|
-
data: {
|
|
1597
|
-
consultation_id: string;
|
|
1598
|
-
message_id: string;
|
|
1599
|
-
sender_id: string;
|
|
1600
|
-
sender_role: string;
|
|
1601
|
-
message: string;
|
|
1602
|
-
attachments?: Array<{
|
|
1603
|
-
url: string;
|
|
1604
|
-
type: string;
|
|
1605
|
-
name: string;
|
|
1606
|
-
}>;
|
|
1607
|
-
created_at: string;
|
|
1608
|
-
};
|
|
1609
|
-
}
|
|
1610
|
-
interface ConsultationQuoteData {
|
|
1611
|
-
event: string;
|
|
1612
|
-
data: {
|
|
1613
|
-
consultation_id: string;
|
|
1614
|
-
quote_amount: number;
|
|
1615
|
-
deposit_amount?: number;
|
|
1616
|
-
merchant_notes?: string;
|
|
1617
|
-
updated_at: string;
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
interface ConsultationStatusData {
|
|
1621
|
-
event: string;
|
|
1622
|
-
data: {
|
|
1623
|
-
consultation_id: string;
|
|
1624
|
-
status: string;
|
|
1625
|
-
updated_at: string;
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
interface UseConsultationStreamOptions {
|
|
1629
|
-
consultationId: string;
|
|
1630
|
-
onMessage?: (data: ConsultationMessageData) => void;
|
|
1631
|
-
onQuote?: (data: ConsultationQuoteData) => void;
|
|
1632
|
-
onStatusChange?: (data: ConsultationStatusData) => void;
|
|
1633
|
-
onError?: (error: Error) => void;
|
|
1634
|
-
}
|
|
1635
|
-
declare function useConsultationStream({ consultationId, onMessage, onQuote, onStatusChange, onError, }: UseConsultationStreamOptions): {
|
|
1636
|
-
isConnected: boolean;
|
|
1637
|
-
lastEvent: any;
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
interface PaymentSuccessData {
|
|
1641
|
-
event: string;
|
|
1642
|
-
data: {
|
|
1643
|
-
transaction_id: string;
|
|
1644
|
-
order_id: string;
|
|
1645
|
-
amount: number;
|
|
1646
|
-
currency: string;
|
|
1647
|
-
status: string;
|
|
1648
|
-
};
|
|
1649
|
-
}
|
|
1650
|
-
interface DigitalReadyData {
|
|
1651
|
-
event: string;
|
|
1652
|
-
data: {
|
|
1653
|
-
order_id: string;
|
|
1654
|
-
business_id: string;
|
|
1655
|
-
customer_id: string;
|
|
1656
|
-
download_links: Array<{
|
|
1657
|
-
item_id: string;
|
|
1658
|
-
product_name: string;
|
|
1659
|
-
url: string;
|
|
1660
|
-
token: string;
|
|
1661
|
-
expires_at: string;
|
|
1662
|
-
max_downloads: number;
|
|
1663
|
-
}>;
|
|
1664
|
-
fulfilled_at: string;
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
interface BespokeUpdateData {
|
|
1668
|
-
event: string;
|
|
1669
|
-
data: {
|
|
1670
|
-
order_id: string;
|
|
1671
|
-
business_id: string;
|
|
1672
|
-
update_type: string;
|
|
1673
|
-
message: string;
|
|
1674
|
-
stage?: string;
|
|
1675
|
-
updated_at: string;
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
interface ConsultationUpdateData {
|
|
1679
|
-
event: string;
|
|
1680
|
-
data: {
|
|
1681
|
-
consultation_id: string;
|
|
1682
|
-
business_id: string;
|
|
1683
|
-
customer_id: string;
|
|
1684
|
-
status: string;
|
|
1685
|
-
message?: string;
|
|
1686
|
-
updated_at: string;
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
interface ServiceBookingUpdateData {
|
|
1690
|
-
event: string;
|
|
1691
|
-
data: {
|
|
1692
|
-
booking_id: string;
|
|
1693
|
-
order_id: string;
|
|
1694
|
-
business_id: string;
|
|
1695
|
-
customer_id: string;
|
|
1696
|
-
status: string;
|
|
1697
|
-
appointment_date?: string;
|
|
1698
|
-
updated_at: string;
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
interface UseOrderStreamOptions {
|
|
1702
|
-
orderId: string;
|
|
1703
|
-
onPaymentComplete?: (data: PaymentSuccessData) => void;
|
|
1704
|
-
onDigitalReady?: (data: DigitalReadyData) => void;
|
|
1705
|
-
onBespokeUpdate?: (data: BespokeUpdateData) => void;
|
|
1706
|
-
onConsultationUpdate?: (data: ConsultationUpdateData) => void;
|
|
1707
|
-
onServiceBookingUpdate?: (data: ServiceBookingUpdateData) => void;
|
|
1708
|
-
onError?: (error: Error) => void;
|
|
1709
|
-
}
|
|
1710
|
-
declare function useOrderStream({ orderId, onPaymentComplete, onDigitalReady, onBespokeUpdate, onConsultationUpdate, onServiceBookingUpdate, onError }: UseOrderStreamOptions): null;
|
|
1711
|
-
|
|
1712
|
-
declare function useIsMounted(): boolean;
|
|
1713
|
-
|
|
1714
|
-
interface GoogleTranslateOptions {
|
|
1715
|
-
pageLanguage: string;
|
|
1716
|
-
includedLanguages?: string;
|
|
1717
|
-
autoDisplay?: boolean;
|
|
1718
|
-
layout?: number;
|
|
1719
|
-
}
|
|
1720
|
-
interface GoogleTranslateElement {
|
|
1721
|
-
new (options: GoogleTranslateOptions, elementId: string): void;
|
|
1722
|
-
}
|
|
1723
|
-
interface GoogleNamespace {
|
|
1724
|
-
translate?: {
|
|
1725
|
-
TranslateElement: GoogleTranslateElement;
|
|
1726
|
-
};
|
|
1727
|
-
}
|
|
1728
|
-
declare global {
|
|
1729
|
-
interface Window {
|
|
1730
|
-
googleTranslateElementInit?: () => void;
|
|
1731
|
-
google?: GoogleNamespace;
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
declare function useGoogleTranslate(appLang: string): {
|
|
1735
|
-
isLoaded: boolean;
|
|
1736
|
-
};
|
|
1737
|
-
|
|
1738
|
-
/**
|
|
1739
|
-
* Hook for creating a Dedicated Virtual Account (DVA)
|
|
1740
|
-
*/
|
|
1741
|
-
declare function useCreateDVA(): _tanstack_react_query.UseMutationResult<DVADetails, Error, DVACreateRequest, unknown>;
|
|
1742
|
-
/**
|
|
1743
|
-
* Hook for initiating card payment
|
|
1744
|
-
*/
|
|
1745
|
-
declare function useInitiatePayment(): _tanstack_react_query.UseMutationResult<PaymentInitiateResponse, Error, PaymentInitiateRequest, unknown>;
|
|
1746
|
-
/**
|
|
1747
|
-
* Hook for verifying a transaction
|
|
1748
|
-
*/
|
|
1749
|
-
declare function useVerifyTransaction(): _tanstack_react_query.UseMutationResult<TransactionVerifyResponse, Error, string, unknown>;
|
|
1750
|
-
/**
|
|
1751
|
-
* Hook for getting transaction status
|
|
1752
|
-
*/
|
|
1753
|
-
declare function useTransactionStatus(transactionId: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<NoInfer<TransactionVerifyResponse>, Error>;
|
|
1754
|
-
/**
|
|
1755
|
-
* Hook for checking transaction status with automatic polling
|
|
1756
|
-
*/
|
|
1757
|
-
declare function usePollTransactionStatus(reference: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<NoInfer<TransactionVerifyResponse>, Error>;
|
|
1758
|
-
|
|
1759
|
-
interface UseCmsEntriesReturn {
|
|
1760
|
-
entries: CmsEntry[];
|
|
1761
|
-
total: number;
|
|
1762
|
-
page: number;
|
|
1763
|
-
page_size: number;
|
|
1764
|
-
isLoading: boolean;
|
|
1765
|
-
error: Error | null;
|
|
1766
|
-
refetch: () => void;
|
|
1767
|
-
}
|
|
1768
|
-
/**
|
|
1769
|
-
* Hook to list CMS entries for a specific model.
|
|
1770
|
-
*/
|
|
1771
|
-
declare function useCmsEntries(modelSlug: string, params?: ListCmsEntriesParams): UseCmsEntriesReturn;
|
|
1772
|
-
interface UseCmsEntryReturn {
|
|
1773
|
-
entry: CmsEntry | undefined;
|
|
1774
|
-
isLoading: boolean;
|
|
1775
|
-
error: Error | null;
|
|
1776
|
-
refetch: () => void;
|
|
1777
|
-
}
|
|
1778
|
-
/**
|
|
1779
|
-
* Hook to get a single CMS entry by ID.
|
|
1780
|
-
*/
|
|
1781
|
-
declare function useCmsEntry(modelSlug: string, entryId: string): UseCmsEntryReturn;
|
|
1782
|
-
interface UseCreateCmsEntryReturn {
|
|
1783
|
-
createEntry: (params: CreateCmsEntryParams) => void;
|
|
1784
|
-
isLoading: boolean;
|
|
1785
|
-
error: Error | null;
|
|
1786
|
-
}
|
|
1787
|
-
/**
|
|
1788
|
-
* Hook to create a new CMS entry.
|
|
1789
|
-
*/
|
|
1790
|
-
declare function useCreateCmsEntry(modelSlug: string): UseCreateCmsEntryReturn;
|
|
1791
|
-
interface UseUpdateCmsEntryReturn {
|
|
1792
|
-
updateEntry: (entryId: string, params: UpdateCmsEntryParams) => void;
|
|
1793
|
-
isLoading: boolean;
|
|
1794
|
-
error: Error | null;
|
|
1795
|
-
}
|
|
1796
|
-
/**
|
|
1797
|
-
* Hook to update an existing CMS entry.
|
|
1798
|
-
*/
|
|
1799
|
-
declare function useUpdateCmsEntry(modelSlug: string): UseUpdateCmsEntryReturn;
|
|
1800
|
-
interface UseDeleteCmsEntryReturn {
|
|
1801
|
-
deleteEntry: (entryId: string) => void;
|
|
1802
|
-
isLoading: boolean;
|
|
1803
|
-
error: Error | null;
|
|
1804
|
-
}
|
|
1805
|
-
/**
|
|
1806
|
-
* Hook to delete a CMS entry.
|
|
1807
|
-
*/
|
|
1808
|
-
declare function useDeleteCmsEntry(modelSlug: string): UseDeleteCmsEntryReturn;
|
|
874
|
+
declare function deleteCmsEntry(config: SdkConfig, accessToken: string, modelSlug: string, entryId: string): Promise<void>;
|
|
1809
875
|
|
|
1810
876
|
/**
|
|
1811
877
|
* Cache Tiers Utility
|
|
@@ -1908,22 +974,45 @@ declare function enrichCompletedOrder(order: Order, options: {
|
|
|
1908
974
|
|
|
1909
975
|
/**
|
|
1910
976
|
* Type-safe way to extract an error message from an API error.
|
|
977
|
+
* Updated for fetch-based errors (no axios dependency).
|
|
1911
978
|
*/
|
|
1912
979
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
1913
980
|
|
|
981
|
+
/**
|
|
982
|
+
* @file storage.ts
|
|
983
|
+
* @description Centralized tenant-isolated storage utility for sessionStorage and localStorage.
|
|
984
|
+
* Automatically prefixes all keys with the storefront Business ID to guarantee multi-tenant segregation.
|
|
985
|
+
* Stateless - requires businessId parameter.
|
|
986
|
+
*/
|
|
1914
987
|
declare const sessionStore: {
|
|
1915
|
-
get: (
|
|
1916
|
-
set: (
|
|
1917
|
-
remove: (
|
|
1918
|
-
getJSON: <T = unknown>(
|
|
1919
|
-
setJSON: (
|
|
988
|
+
get: (businessIdOrKey: string, key?: string) => string | null;
|
|
989
|
+
set: (businessIdOrKey: string, keyOrVal: string, val?: string) => void;
|
|
990
|
+
remove: (businessIdOrKey: string, key?: string) => void;
|
|
991
|
+
getJSON: <T = unknown>(businessIdOrKey: string, key?: string) => T | null;
|
|
992
|
+
setJSON: (businessIdOrKey: string, keyOrVal: unknown, val?: unknown) => void;
|
|
1920
993
|
};
|
|
1921
994
|
declare const localStore: {
|
|
1922
|
-
get: (
|
|
1923
|
-
set: (
|
|
1924
|
-
remove: (
|
|
1925
|
-
getJSON: <T = unknown>(
|
|
1926
|
-
setJSON: (
|
|
995
|
+
get: (businessIdOrKey: string, key?: string) => string | null;
|
|
996
|
+
set: (businessIdOrKey: string, keyOrVal: string, val?: string) => void;
|
|
997
|
+
remove: (businessIdOrKey: string, key?: string) => void;
|
|
998
|
+
getJSON: <T = unknown>(businessIdOrKey: string, key?: string) => T | null;
|
|
999
|
+
setJSON: (businessIdOrKey: string, keyOrVal: unknown, val?: unknown) => void;
|
|
1927
1000
|
};
|
|
1928
1001
|
|
|
1929
|
-
|
|
1002
|
+
/**
|
|
1003
|
+
* Form validation utilities for kasuvia-sdk
|
|
1004
|
+
* Provides realtime validation for email, password, name, confirm password, and message fields
|
|
1005
|
+
*/
|
|
1006
|
+
declare function validateEmail(email: string): string | null;
|
|
1007
|
+
declare function validatePassword(password: string): string | null;
|
|
1008
|
+
declare function validateName(name: string, fieldName?: string): string | null;
|
|
1009
|
+
declare function validateRequired(value: string, fieldName: string): string | null;
|
|
1010
|
+
/**
|
|
1011
|
+
* Validates the confirm-password field.
|
|
1012
|
+
* Returns null (no error) when the field is empty — avoids nagging the user
|
|
1013
|
+
* before they've had a chance to type anything.
|
|
1014
|
+
*/
|
|
1015
|
+
declare function validateConfirmPassword(password: string, confirmPassword: string): string | null;
|
|
1016
|
+
declare function validateMessage(message: string): string | null;
|
|
1017
|
+
|
|
1018
|
+
export { type AppointmentStatus, type AuthContextValue, type AuthUserResponse, type AvailableSlot, type AvatarObject, type BespokeAvailability, type BespokeCapacityConfig, type BespokeSlotBooking, type BusinessConfig, type BusinessContext, CartItem, type CartItemPayload, CartResponse, CheckoutCustomer, CmsEntry, CmsEntryListResponse, Collection, type Consultation, type ConsultationCreatePayload, type ConsultationMessage, type ConsultationMessagePayload, type ConsultationProductType, type ConsultationQuoteAcceptPayload, type ConsultationStatus, type ContactFormData, ConversionQuote, CreateCmsEntryParams, CreateOrderParams, type CustomerAuthResponse, type CustomerLoginPayload, type CustomerProfileFields, type CustomerRegisterPayload, type CustomerUser, DVACreateRequest, DVADetails, type DeliverableApprovalPayload, type DeliverableStatus, type DeliverableStatusType, DeliveryAddress, FindOrderParams, InvalidBaseURLError, ListCmsEntriesParams, ListParams, type LogoutPayload, type MediaAsset, type MediaAssetUpdatePayload, type MediaUploadParams, type NotificationPreferences, type OTPVerifyPayload, Order, PaginatedResponse, PaymentInitiateRequest, PaymentInitiateResponse, Product, ProductVariant, type RateAddress, type RefreshTokenResponse, type ResendOTPPayload, STORAGE_KEYS, SdkConfig, type ServiceAppointment, type ServiceAppointmentCreatePayload, type ServiceDeliverable, ServiceLocationType, ShippingLocation, type ShippingRatesRequest, ShippingRatesResponse, type SlotBookingStatus, type StorageStats, SupportedCurrenciesResponse, SupportedLanguagesResponse, TransactionVerifyResponse, UpdateCmsEntryParams, type UpdateProfilePayload, WishlistCheckResponse, WishlistItem, WishlistListResponse, acceptQuote, addToCart, addToGuestCart, addToWishlist, approveDeliverable, bespokeService, bookAppointment, buildDeliveryAddress, buildFullName, cancelAppointment, cancelOrder, checkAvailability, checkInWishlist, clearCart, clearGuestCart, clearTokens, configService, consultationService, createCmsEntry, createConsultation, createDedicatedAccount, createOrder, deleteCmsEntry, enrichCompletedOrder, findOrder, findOrderByToken, getAppointment, getAppointments, getAuthUser, getAvailableSlots, getBusinessConfig, getCacheTier, getCart, getCheckoutCustomerName, getCmsEntry, getConsultation, getConsultations, getCustomerDisplayName, getDeliverables, getErrorMessage, getFeaturedProducts, getGuestCart, getGuestCartCount, getGuestCartProductType, getGuestCartSubtotal, getLatestProducts, getLowStockProducts, getMe, getNewProducts, getOnSaleProducts, getOrders, getPopularProducts, getRecommendedProducts, getSellerShippingAddress, getShippingRates, getStoredTokens, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontUrl, getSupportedCurrencies, getSupportedLanguages, getTransactionStatus, getWishlist, googleTranslate, initiatePayment, listCmsEntries, localStore, logger, loginCustomer, logisticsService, logout, mapAuthUserToCustomer, mergeGuestCart, mergeGuestCartIfPresent, notificationsService, paymentService, refreshToken, registerCustomer, rejectQuote, removeFromCart, removeFromGuestCart, removeFromWishlist, removeProductFromWishlist, requestQuote, requestRevision, sanitizeBaseUrl, sendContactConfirmation, sendContactEmail, sendMessage, serviceBookingService, sessionStore, setEnvironmentMode, setLoggerEnvironmentMode, silentRefresh, splitFullName, storeTokens, trackOrder, updateCartItem, updateCmsEntry, updateGuestCartItemQuantity, updateProfile, validateConfirmPassword, validateEmail, validateMessage, validateName, validatePassword, validateRequired, validateShippingAddress, verifySocialToken, verifyTransaction };
|