@kasuvia/sdk 0.0.2 → 0.0.5
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 +430 -0
- package/dist/hooks/index.d.ts +430 -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-CxNLI4nw.d.ts +786 -0
- package/dist/index-CzVMyUs4.d.mts +492 -0
- package/dist/index-CzVMyUs4.d.ts +492 -0
- package/dist/index-Dowl5224.d.mts +786 -0
- package/dist/index.d.mts +48 -1739
- package/dist/index.d.ts +48 -1739
- 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-BuarJbeb.d.ts +75 -0
- package/dist/sdk-context-Db8kf1Tv.d.mts +75 -0
- package/dist/services/index.d.mts +2 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2369 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +2252 -0
- package/dist/services/index.mjs.map +1 -0
- package/package.json +11 -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.ts
CHANGED
|
@@ -1,752 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
1
|
+
import { C as CheckoutCustomer, a as ShippingLocation, D as DeliveryAddress, O as Order } from './index-CzVMyUs4.js';
|
|
2
|
+
export { A as Address, B as BackendLanguage, b as BespokeStageKey, c as CartItem, d as CartResponse, e as CmsEntry, f as CmsEntryListResponse, g as CmsField, h as CmsIcon, i as CmsIconListResponse, j as CmsModel, k as CmsModelPermissions, l as CmsModelPublicApiPermissions, m as Collection, n as ConversionQuote, o as CreateCmsEntryParams, p as CreateOrderParams, q as Currency, r as CustomField, s as DVACreateRequest, t as DVADetails, F as FindOrderParams, I as Inventory, L as ListCmsEntriesParams, u as ListParams, v as OrderItem, w as OrderStatus, P as PaginatedResponse, x as PaymentInitiateRequest, y as PaymentInitiateResponse, z as Product, E as ProductType, G as ProductVariant, S as SdkConfig, H as ServiceLocationType, J as ServiceLocationTypeEnum, K as ServiceRecurringInterval, M as ServiceRecurringIntervalEnum, N as ServiceType, Q as ServiceTypeEnum, R as ShippingRate, T as ShippingRatesResponse, U as SupportedCurrenciesResponse, V as SupportedLang, W as SupportedLanguagesResponse, X as TransactionVerifyResponse, Y as UpdateCmsEntryParams, Z as WishlistCheckResponse, _ as WishlistItem, $ as WishlistListResponse } from './index-CzVMyUs4.js';
|
|
3
|
+
export { A as AppContextValue, a as AppState, C as Country, L as LangCode, S as SdkContextValue, b as SdkProvider, c as SdkProviderProps, d as State, T as Theme, u as useSdkContext } from './sdk-context-BuarJbeb.js';
|
|
4
|
+
import { C as CustomerUser } from './index-CxNLI4nw.js';
|
|
5
|
+
export { A as AppointmentStatus, a as AuthContextValue, b as AuthUserResponse, c as AvailableSlot, d as AvatarObject, B as BespokeAvailability, e as BusinessConfig, f as BusinessContext, g as CartItemPayload, h as Consultation, i as ConsultationCreatePayload, j as ConsultationMessage, k as ConsultationMessagePayload, l as ConsultationProductType, m as ConsultationQuoteAcceptPayload, n as ConsultationStatus, o as ContactFormData, p as CustomerAuthResponse, q as CustomerLoginPayload, r as CustomerProfileFields, s as CustomerRegisterPayload, D as DeliverableApprovalPayload, t as DeliverableStatus, u as DeliverableStatusType, L as LogoutPayload, N as NotificationPreferences, O as OTPVerifyPayload, R as RateAddress, v as RefreshTokenResponse, w as ResendOTPPayload, S as ServiceAppointment, x as ServiceAppointmentCreatePayload, y as ServiceDeliverable, z as ShippingRatesRequest, U as UpdateProfilePayload, E as acceptQuote, F as addToCart, G as addToGuestCart, H as addToWishlist, I as approveDeliverable, J as bespokeService, K as bookAppointment, M as cancelAppointment, P as cancelOrder, Q as checkAvailability, T as checkInWishlist, V as clearCart, W as clearGuestCart, X as clearTokens, Y as configService, Z as consultationService, _ as createCmsEntry, $ as createConsultation, a0 as createDedicatedAccount, a1 as createOrder, a2 as deleteCmsEntry, a3 as findOrder, a4 as findOrderByToken, a5 as getAppointment, a6 as getAppointments, a7 as getAuthUser, a8 as getAvailableSlots, a9 as getBusinessConfig, aa as getCart, ab as getCmsEntry, ac as getConsultation, ad as getConsultations, ae as getDeliverables, af as getFeaturedProducts, ag as getGuestCart, ah as getGuestCartCount, ai as getGuestCartProductType, aj as getGuestCartSubtotal, ak as getLatestProducts, al as getLowStockProducts, am as getMe, an as getNewProducts, ao as getOnSaleProducts, ap as getOrders, aq as getPopularProducts, ar as getRecommendedProducts, as as getSellerShippingAddress, at as getShippingRates, au as getStoredTokens, av as getStorefrontCollectionBySlug, aw as getStorefrontCollections, ax as getStorefrontProductBySlug, ay as getStorefrontProducts, az as getSupportedCurrencies, aA as getSupportedLanguages, aB as getTransactionStatus, aC as getWishlist, aD as googleTranslate, aE as initiatePayment, aF as listCmsEntries, aG as loginCustomer, aH as logisticsService, aI as logout, aJ as mapAuthUserToCustomer, aK as mergeGuestCart, aL as mergeGuestCartIfPresent, aM as notificationsService, aN as paymentService, aO as refreshToken, aP as registerCustomer, aQ as rejectQuote, aR as removeFromCart, aS as removeFromGuestCart, aT as removeFromWishlist, aU as removeProductFromWishlist, aV as requestQuote, aW as requestRevision, aX as sendContactConfirmation, aY as sendContactEmail, aZ as sendMessage, a_ as serviceBookingService, a$ as silentRefresh, b0 as storeTokens, b1 as trackOrder, b2 as updateCartItem, b3 as updateCmsEntry, b4 as updateGuestCartItemQuantity, b5 as updateProfile, b6 as validateShippingAddress, b7 as verifySocialToken, b8 as verifyTransaction } from './index-CxNLI4nw.js';
|
|
6
|
+
import 'react';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* SDK Constants
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
* The SDK is client-based and runs in the browser.
|
|
11
|
-
* All backend URLs are bundled with the SDK.
|
|
12
|
-
*
|
|
13
|
-
* SECURITY NOTE: The storefront API key has limited permissions - it only provides
|
|
14
|
-
* customer-based resources from a business owner to customers, not full platform access.
|
|
15
|
-
* This key is safe to expose to the browser as a NEXT_PUBLIC_ environment variable.
|
|
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)
|
|
11
|
+
* Centralized constants to avoid hardcoded strings across the codebase.
|
|
53
12
|
*/
|
|
54
|
-
declare
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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;
|
|
13
|
+
declare const STORAGE_KEYS: {
|
|
14
|
+
readonly ACCESS_TOKEN: "kasuvia_access_token";
|
|
15
|
+
readonly REFRESH_TOKEN: "kasuvia_refresh_token";
|
|
16
|
+
readonly CHECKOUT_STATE: "kasuvia_checkout_state";
|
|
17
|
+
readonly ORDERS_LINKED: "kasuvia_orders_linked";
|
|
18
|
+
readonly STOREFRONT_STATE: "storefront_state_v3";
|
|
87
19
|
};
|
|
88
|
-
/**
|
|
89
|
-
* Perform token refresh with queue-coalescing to avoid parallel refresh races.
|
|
90
|
-
*/
|
|
91
|
-
declare function refreshToken(): Promise<string>;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* GraphQL Client
|
|
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.
|
|
117
|
-
* Customers only need enough to track their orders — no RBAC, MFA, or complex profiles.
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* Media System response object for avatar/profile picture.
|
|
121
|
-
* Stored as JSON in the backend Profile model.
|
|
122
|
-
*/
|
|
123
|
-
interface AvatarObject {
|
|
124
|
-
id: string;
|
|
125
|
-
alt: string;
|
|
126
|
-
url: string;
|
|
127
|
-
}
|
|
128
|
-
interface CustomerProfileFields {
|
|
129
|
-
firstname: string;
|
|
130
|
-
lastname: string;
|
|
131
|
-
phone: string;
|
|
132
|
-
}
|
|
133
|
-
interface CustomerUser {
|
|
134
|
-
id: string;
|
|
135
|
-
email: string;
|
|
136
|
-
firstname?: string;
|
|
137
|
-
lastname?: string;
|
|
138
|
-
phone?: string;
|
|
139
|
-
/** Derived display name — prefer firstname + lastname when available */
|
|
140
|
-
full_name?: string;
|
|
141
|
-
avatar: string | null;
|
|
142
|
-
provider: 'google' | 'facebook' | 'email';
|
|
143
|
-
}
|
|
144
|
-
/** GET/PUT /auth/profile/ — matches luxe-auth UserSerializer */
|
|
145
|
-
interface AuthUserResponse {
|
|
146
|
-
id: string;
|
|
147
|
-
email: string;
|
|
148
|
-
is_google_auth_enabled?: boolean;
|
|
149
|
-
is_facebook_auth_enabled?: boolean;
|
|
150
|
-
profile?: {
|
|
151
|
-
firstname?: string;
|
|
152
|
-
lastname?: string;
|
|
153
|
-
phone?: string;
|
|
154
|
-
profile_picture?: string | null;
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
interface UpdateProfilePayload {
|
|
158
|
-
firstname?: string;
|
|
159
|
-
lastname?: string;
|
|
160
|
-
phone?: string;
|
|
161
|
-
}
|
|
162
|
-
interface NotificationPreferences {
|
|
163
|
-
email_enabled: boolean;
|
|
164
|
-
sms_enabled: boolean;
|
|
165
|
-
whatsapp_enabled: boolean;
|
|
166
|
-
push_enabled: boolean;
|
|
167
|
-
email_order_confirmations: boolean;
|
|
168
|
-
email_delivery_updates: boolean;
|
|
169
|
-
email_low_stock_alerts: boolean;
|
|
170
|
-
email_payment_received: boolean;
|
|
171
|
-
push_order_confirmations: boolean;
|
|
172
|
-
push_delivery_updates: boolean;
|
|
173
|
-
push_low_stock_alerts: boolean;
|
|
174
|
-
push_payment_received: boolean;
|
|
175
|
-
whatsapp_order_confirmations: boolean;
|
|
176
|
-
whatsapp_delivery_updates: boolean;
|
|
177
|
-
whatsapp_payment_received: boolean;
|
|
178
|
-
sms_order_confirmations: boolean;
|
|
179
|
-
sms_delivery_updates: boolean;
|
|
180
|
-
}
|
|
181
|
-
interface BusinessContext {
|
|
182
|
-
id: string;
|
|
183
|
-
business_id: string;
|
|
184
|
-
name: string;
|
|
185
|
-
logo_picture?: string | null;
|
|
186
|
-
display_currency?: string;
|
|
187
|
-
}
|
|
188
|
-
interface CustomerAuthResponse {
|
|
189
|
-
access: string;
|
|
190
|
-
refresh: string;
|
|
191
|
-
user: CustomerUser;
|
|
192
|
-
business: BusinessContext;
|
|
193
|
-
is_new?: boolean;
|
|
194
|
-
}
|
|
195
|
-
interface RefreshTokenResponse {
|
|
196
|
-
access: string;
|
|
197
|
-
refresh?: string;
|
|
198
|
-
}
|
|
199
|
-
/** POST /auth/login/customer/ — field name is `tenant_id` (the business_id) */
|
|
200
|
-
interface CustomerLoginPayload {
|
|
201
|
-
tenant_id: string;
|
|
202
|
-
email: string;
|
|
203
|
-
password: string;
|
|
204
|
-
}
|
|
205
|
-
/** POST /auth/register/customer/ */
|
|
206
|
-
interface CustomerRegisterPayload {
|
|
207
|
-
tenant_id: string;
|
|
208
|
-
/** Full name — backend splits this into firstname and lastname on the Profile */
|
|
209
|
-
full_name: string;
|
|
210
|
-
email: string;
|
|
211
|
-
password: string;
|
|
212
|
-
}
|
|
213
|
-
/** POST /auth/verify-otp/ */
|
|
214
|
-
interface OTPVerifyPayload {
|
|
215
|
-
email: string;
|
|
216
|
-
code: string;
|
|
217
|
-
purpose?: 'verify' | 'password_reset';
|
|
218
|
-
}
|
|
219
|
-
/** POST /auth/resend-otp/ */
|
|
220
|
-
interface ResendOTPPayload {
|
|
221
|
-
email: string;
|
|
222
|
-
}
|
|
223
|
-
/** POST /auth/logout/ */
|
|
224
|
-
interface LogoutPayload {
|
|
225
|
-
refresh?: string;
|
|
226
|
-
}
|
|
227
|
-
interface AuthContextValue {
|
|
228
|
-
customer: CustomerUser | null;
|
|
229
|
-
isLoading: boolean;
|
|
230
|
-
isModalOpen: boolean;
|
|
231
|
-
openModal: () => void;
|
|
232
|
-
closeModal: () => void;
|
|
233
|
-
setCustomer: (user: CustomerUser | null) => void;
|
|
234
|
-
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>;
|
|
499
|
-
}>;
|
|
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
|
-
}
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Consultation types for customer-facing storefront
|
|
623
|
-
*/
|
|
624
|
-
type ConsultationStatus = "pending" | "quoted" | "negotiating" | "deposit_pending" | "deposit_paid" | "converting" | "converted" | "rejected";
|
|
625
|
-
type ConsultationProductType = "bespoke" | "service";
|
|
626
|
-
interface ConsultationMessage {
|
|
627
|
-
id: string;
|
|
628
|
-
consultation_id: string;
|
|
629
|
-
sender_id: string;
|
|
630
|
-
sender_role: "customer" | "merchant" | "system";
|
|
631
|
-
message: string;
|
|
632
|
-
attachments: string[];
|
|
633
|
-
is_read: boolean;
|
|
634
|
-
created_at: string;
|
|
635
|
-
}
|
|
636
|
-
interface Consultation {
|
|
637
|
-
id: string;
|
|
638
|
-
business_id: string;
|
|
639
|
-
customer_id: string;
|
|
640
|
-
product_id: string | null;
|
|
641
|
-
title: string;
|
|
642
|
-
status: ConsultationStatus;
|
|
643
|
-
product_type: ConsultationProductType;
|
|
644
|
-
quote_amount: number | null;
|
|
645
|
-
agreed_price: number | null;
|
|
646
|
-
deposit_amount: number | null;
|
|
647
|
-
deposit_required: boolean;
|
|
648
|
-
is_physical_delivery: boolean;
|
|
649
|
-
expected_delivery_type: string | null;
|
|
650
|
-
structured_details: Record<string, unknown>;
|
|
651
|
-
rejection_reason: string | null;
|
|
652
|
-
converted_order_id: string | null;
|
|
653
|
-
slot_booking_id: string | null;
|
|
654
|
-
capacity_config_id: string | null;
|
|
655
|
-
created_at: string;
|
|
656
|
-
updated_at: string;
|
|
657
|
-
messages: ConsultationMessage[];
|
|
658
|
-
}
|
|
659
|
-
interface ConsultationCreatePayload {
|
|
660
|
-
product_id?: string;
|
|
661
|
-
title: string;
|
|
662
|
-
description: string;
|
|
663
|
-
reference_images?: string[];
|
|
664
|
-
custom_measurements?: Record<string, string | number>;
|
|
665
|
-
preferred_timeline?: string;
|
|
666
|
-
special_instructions?: string;
|
|
667
|
-
product_type?: ConsultationProductType;
|
|
668
|
-
}
|
|
669
|
-
interface ConsultationMessagePayload {
|
|
670
|
-
message: string;
|
|
671
|
-
attachments?: string[];
|
|
672
|
-
}
|
|
673
|
-
interface ConsultationQuoteAcceptPayload {
|
|
674
|
-
agreed_price: number;
|
|
675
|
-
}
|
|
676
|
-
interface BespokeAvailability {
|
|
677
|
-
available_slots: number;
|
|
678
|
-
next_available_date: string | null;
|
|
679
|
-
period_end: string;
|
|
680
|
-
blocked_dates: string[];
|
|
681
|
-
production_days: number;
|
|
682
|
-
is_available: boolean;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
/**
|
|
686
|
-
* Service booking types for customer-facing storefront
|
|
687
|
-
*/
|
|
688
|
-
type ServiceLocationType = "remote" | "physical" | "both";
|
|
689
|
-
type ServiceType = "appointment" | "project" | "recurring";
|
|
690
|
-
type AppointmentStatus = "pending" | "confirmed" | "in_progress" | "completed" | "voided" | "no_show";
|
|
691
|
-
interface AvailableSlot {
|
|
692
|
-
date: string;
|
|
693
|
-
start_time: string;
|
|
694
|
-
end_time: string;
|
|
695
|
-
slots_remaining: number;
|
|
696
|
-
}
|
|
697
|
-
interface ServiceAppointment {
|
|
698
|
-
id: string;
|
|
699
|
-
product_id: string;
|
|
700
|
-
customer_id: string;
|
|
701
|
-
order_id: string | null;
|
|
702
|
-
status: AppointmentStatus;
|
|
703
|
-
appointment_date: string;
|
|
704
|
-
start_time: string;
|
|
705
|
-
end_time: string;
|
|
706
|
-
location_type: ServiceLocationType;
|
|
707
|
-
customer_address: Record<string, unknown> | null;
|
|
708
|
-
meeting_link: string | null;
|
|
709
|
-
customer_notes: string | null;
|
|
710
|
-
price: number;
|
|
711
|
-
created_at: string;
|
|
712
|
-
updated_at: string;
|
|
713
|
-
completed_at: string | null;
|
|
714
|
-
voided_at: string | null;
|
|
715
|
-
cancellation_reason: string | null;
|
|
716
|
-
}
|
|
717
|
-
interface ServiceAppointmentCreatePayload {
|
|
718
|
-
product_id: string;
|
|
719
|
-
scheduled_date: string;
|
|
720
|
-
scheduled_time: string;
|
|
721
|
-
location_type?: ServiceLocationType;
|
|
722
|
-
customer_address?: Record<string, unknown>;
|
|
723
|
-
customer_notes?: string;
|
|
724
|
-
}
|
|
725
|
-
interface DeliverableStatus {
|
|
726
|
-
pending: "pending";
|
|
727
|
-
in_progress: "in_progress";
|
|
728
|
-
review: "review";
|
|
729
|
-
approved: "approved";
|
|
730
|
-
rejected: "rejected";
|
|
731
|
-
}
|
|
732
|
-
type DeliverableStatusType = DeliverableStatus[keyof DeliverableStatus];
|
|
733
|
-
interface ServiceDeliverable {
|
|
734
|
-
id: string;
|
|
735
|
-
order_id: string;
|
|
736
|
-
title: string;
|
|
737
|
-
description: string;
|
|
738
|
-
status: DeliverableStatusType;
|
|
739
|
-
due_date: string | null;
|
|
740
|
-
submitted_at: string | null;
|
|
741
|
-
attachments: string[];
|
|
742
|
-
customer_feedback: string | null;
|
|
743
|
-
created_at: string;
|
|
744
|
-
updated_at: string;
|
|
745
|
-
}
|
|
746
|
-
interface DeliverableApprovalPayload {
|
|
747
|
-
approved: boolean;
|
|
748
|
-
feedback?: string;
|
|
749
|
-
}
|
|
750
20
|
|
|
751
21
|
/**
|
|
752
22
|
* Bespoke slot booking types for customer-facing storefront
|
|
@@ -785,73 +55,6 @@ interface BespokeCapacityConfig {
|
|
|
785
55
|
updated_at: string;
|
|
786
56
|
}
|
|
787
57
|
|
|
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
58
|
/**
|
|
856
59
|
* Media types for the storefront
|
|
857
60
|
*/
|
|
@@ -890,923 +93,6 @@ interface StorageStats {
|
|
|
890
93
|
asset_count: number;
|
|
891
94
|
}
|
|
892
95
|
|
|
893
|
-
interface BusinessConfig {
|
|
894
|
-
business_id: string;
|
|
895
|
-
store_name: string;
|
|
896
|
-
store_currency: string;
|
|
897
|
-
is_active: boolean;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
type Theme = "light" | "dark";
|
|
901
|
-
type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
|
|
902
|
-
interface AppState {
|
|
903
|
-
theme: Theme;
|
|
904
|
-
lang: LangCode;
|
|
905
|
-
currency: string;
|
|
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
|
-
}
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Fetch guest cart from backend (Redis-backed).
|
|
931
|
-
*/
|
|
932
|
-
declare function getGuestCart(): Promise<CartItem[]>;
|
|
933
|
-
/**
|
|
934
|
-
* Add item to guest cart (Redis-backed).
|
|
935
|
-
*/
|
|
936
|
-
declare function addToGuestCart(item: CartItem): Promise<CartItem[]>;
|
|
937
|
-
/**
|
|
938
|
-
* Update quantity of a guest cart item.
|
|
939
|
-
*/
|
|
940
|
-
declare function updateGuestCartItemQuantity(itemId: string, quantity: number): Promise<CartItem[]>;
|
|
941
|
-
/**
|
|
942
|
-
* Remove an item from the guest cart.
|
|
943
|
-
*/
|
|
944
|
-
declare function removeFromGuestCart(itemId: string): Promise<CartItem[]>;
|
|
945
|
-
/**
|
|
946
|
-
* Clear the entire guest cart.
|
|
947
|
-
*/
|
|
948
|
-
declare function clearGuestCart(): Promise<void>;
|
|
949
|
-
/**
|
|
950
|
-
* Fetch authenticated user's cart from backend.
|
|
951
|
-
*/
|
|
952
|
-
declare function getCart(): Promise<CartResponse>;
|
|
953
|
-
/**
|
|
954
|
-
* Add item to authenticated user's cart.
|
|
955
|
-
*/
|
|
956
|
-
declare function addToCart(item: {
|
|
957
|
-
product_id: string;
|
|
958
|
-
product_slug: string;
|
|
959
|
-
product_name: string;
|
|
960
|
-
image?: string;
|
|
961
|
-
variant_id?: string;
|
|
962
|
-
variant_attributes?: string;
|
|
963
|
-
unit_price: number;
|
|
964
|
-
quantity: number;
|
|
965
|
-
custom_measurements?: string;
|
|
966
|
-
is_bespoke: boolean;
|
|
967
|
-
}): Promise<CartResponse>;
|
|
968
|
-
/**
|
|
969
|
-
* Update item quantity in authenticated user's cart.
|
|
970
|
-
*/
|
|
971
|
-
declare function updateCartItem(itemId: string, quantity: number): Promise<CartResponse>;
|
|
972
|
-
/**
|
|
973
|
-
* Remove item from authenticated user's cart.
|
|
974
|
-
*/
|
|
975
|
-
declare function removeFromCart(itemId: string): Promise<CartResponse>;
|
|
976
|
-
/**
|
|
977
|
-
* Clear authenticated user's cart.
|
|
978
|
-
*/
|
|
979
|
-
declare function clearCart(): Promise<void>;
|
|
980
|
-
/**
|
|
981
|
-
* Merge guest cart (from Redis) into authenticated user's DB cart.
|
|
982
|
-
*/
|
|
983
|
-
declare function mergeGuestCart(): Promise<CartResponse>;
|
|
984
|
-
/**
|
|
985
|
-
* Convenience wrapper: merge guest cart if it has items (called post-login).
|
|
986
|
-
*/
|
|
987
|
-
declare function mergeGuestCartIfPresent(): Promise<void>;
|
|
988
|
-
/**
|
|
989
|
-
* Returns 0 — count is now server-driven. Use the hook instead.
|
|
990
|
-
* Kept for backward compatibility.
|
|
991
|
-
*/
|
|
992
|
-
declare function getGuestCartCount(): number;
|
|
993
|
-
/**
|
|
994
|
-
* Returns 0 — subtotal is now server-driven.
|
|
995
|
-
* Kept for backward compatibility.
|
|
996
|
-
*/
|
|
997
|
-
declare function getGuestCartSubtotal(): number;
|
|
998
|
-
/**
|
|
999
|
-
* Derive product type from items (guest cart, no backend lookup needed).
|
|
1000
|
-
*/
|
|
1001
|
-
declare function getGuestCartProductType(): "physical" | "digital" | "bespoke";
|
|
1002
|
-
|
|
1003
|
-
declare function createOrder(payload: CreateOrderParams): Promise<Order>;
|
|
1004
|
-
declare function findOrder(params: FindOrderParams): Promise<Order>;
|
|
1005
|
-
declare function findOrderByToken(token: string): Promise<Order>;
|
|
1006
|
-
declare function getOrders(params?: {
|
|
1007
|
-
email?: string;
|
|
1008
|
-
page?: number;
|
|
1009
|
-
page_size?: number;
|
|
1010
|
-
}): Promise<Order[]>;
|
|
1011
|
-
declare function cancelOrder(orderId: string, reason: string): Promise<Order>;
|
|
1012
|
-
declare function trackOrder(orderId: string, token?: string): Promise<Order>;
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* POST /auth/login/customer/
|
|
1016
|
-
* The `tenant_id` is automatically filled from config.api.storefrontBusinessId.
|
|
1017
|
-
*/
|
|
1018
|
-
declare function loginCustomer(payload: Omit<CustomerLoginPayload, 'tenant_id'>): Promise<CustomerAuthResponse>;
|
|
1019
|
-
/**
|
|
1020
|
-
* POST /auth/register/customer/
|
|
1021
|
-
* The `tenant_id` is automatically filled from config.api.storefrontBusinessId.
|
|
1022
|
-
*/
|
|
1023
|
-
declare function registerCustomer(payload: Omit<CustomerRegisterPayload, 'tenant_id'>): Promise<CustomerAuthResponse>;
|
|
1024
|
-
/** POST /auth/logout/ — revokes the server-side session. Always clears local tokens. */
|
|
1025
|
-
declare function logout(): Promise<void>;
|
|
1026
|
-
/**
|
|
1027
|
-
* Verify a social provider id_token (or access_token for Facebook) with the backend.
|
|
1028
|
-
* The backend validates the token with the provider and creates/finds the customer.
|
|
1029
|
-
*
|
|
1030
|
-
* Industry-standard "ID Token Exchange" pattern:
|
|
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. */
|
|
1038
|
-
declare function mapAuthUserToCustomer(data: AuthUserResponse, provider?: CustomerUser['provider']): CustomerUser;
|
|
1039
|
-
/** GET /auth/profile/ */
|
|
1040
|
-
declare function getMe(): Promise<CustomerUser>;
|
|
1041
|
-
/** GET /auth/profile/ - alias for getMe for backward compatibility */
|
|
1042
|
-
declare function getAuthUser(): Promise<AuthUserResponse>;
|
|
1043
|
-
/** PUT /auth/profile/ — update firstname, lastname, phone */
|
|
1044
|
-
declare function updateProfile(payload: UpdateProfilePayload): Promise<CustomerUser>;
|
|
1045
|
-
/**
|
|
1046
|
-
* Silently refresh the access token on app boot.
|
|
1047
|
-
* Builds CustomerUser from JWT claims — no additional profile API call needed.
|
|
1048
|
-
* 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
|
-
*/
|
|
1057
|
-
declare function silentRefresh(): Promise<{
|
|
1058
|
-
user: CustomerUser;
|
|
1059
|
-
provider: CustomerUser['provider'];
|
|
1060
|
-
} | null>;
|
|
1061
|
-
/** Store tokens after OAuth callback or login/register response. */
|
|
1062
|
-
declare function storeTokens(access: string, refresh: string, remember?: boolean): void;
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* Fetch all active products for the storefront.
|
|
1066
|
-
*/
|
|
1067
|
-
declare function getStorefrontProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1068
|
-
/**
|
|
1069
|
-
* Fetch a single product by slug for the storefront.
|
|
1070
|
-
*/
|
|
1071
|
-
declare function getStorefrontProductBySlug(slug: string): Promise<Product>;
|
|
1072
|
-
/**
|
|
1073
|
-
* Fetch latest products for the storefront.
|
|
1074
|
-
*/
|
|
1075
|
-
declare function getLatestProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1076
|
-
/**
|
|
1077
|
-
* Fetch popular products for the storefront.
|
|
1078
|
-
*/
|
|
1079
|
-
declare function getPopularProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1080
|
-
/**
|
|
1081
|
-
* Fetch featured products for the storefront.
|
|
1082
|
-
*/
|
|
1083
|
-
declare function getFeaturedProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1084
|
-
/**
|
|
1085
|
-
* Fetch new products for the storefront.
|
|
1086
|
-
*/
|
|
1087
|
-
declare function getNewProducts(params?: ListParams): Promise<PaginatedResponse<Product>>;
|
|
1088
|
-
/**
|
|
1089
|
-
* Fetch recommended products for the storefront.
|
|
1090
|
-
* Returns featured, popular, and new products.
|
|
1091
|
-
* Optionally excludes a specific product ID.
|
|
1092
|
-
*/
|
|
1093
|
-
declare function getRecommendedProducts(params?: ListParams & {
|
|
1094
|
-
excludeProductId?: string;
|
|
1095
|
-
}): Promise<PaginatedResponse<Product>>;
|
|
1096
|
-
|
|
1097
|
-
/**
|
|
1098
|
-
* Fetch paginated active collections for the storefront.
|
|
1099
|
-
*/
|
|
1100
|
-
declare function getStorefrontCollections(params?: ListParams): Promise<PaginatedResponse<Collection>>;
|
|
1101
|
-
/**
|
|
1102
|
-
* Fetch a single collection by its slug.
|
|
1103
|
-
*/
|
|
1104
|
-
declare function getStorefrontCollectionBySlug(slug: string): Promise<Collection>;
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Fetch the customer's wishlist for the current business.
|
|
1108
|
-
*/
|
|
1109
|
-
declare function getWishlist(params?: {
|
|
1110
|
-
page?: number;
|
|
1111
|
-
pageSize?: number;
|
|
1112
|
-
}): Promise<WishlistListResponse>;
|
|
1113
|
-
/**
|
|
1114
|
-
* Check if a product is in the customer's wishlist.
|
|
1115
|
-
*/
|
|
1116
|
-
declare function checkInWishlist(productId: string): Promise<WishlistCheckResponse>;
|
|
1117
|
-
/**
|
|
1118
|
-
* Add a product to the customer's wishlist.
|
|
1119
|
-
*/
|
|
1120
|
-
declare function addToWishlist(productId: string, notes?: string): Promise<WishlistItem>;
|
|
1121
|
-
/**
|
|
1122
|
-
* Remove an item from the customer's wishlist by item ID.
|
|
1123
|
-
*/
|
|
1124
|
-
declare function removeFromWishlist(itemId: string): Promise<void>;
|
|
1125
|
-
/**
|
|
1126
|
-
* Remove a product from the customer's wishlist by product ID.
|
|
1127
|
-
*/
|
|
1128
|
-
declare function removeProductFromWishlist(productId: string): Promise<void>;
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* Create a Monnify Dedicated Virtual Account so the customer can pay via
|
|
1132
|
-
* bank transfer. Note: Monnify DVA only supports NGN currency - the backend
|
|
1133
|
-
* will reject non-NGN requests for this payment method.
|
|
1134
|
-
*/
|
|
1135
|
-
declare function createDedicatedAccount(request: DVACreateRequest): Promise<DVADetails>;
|
|
1136
|
-
/**
|
|
1137
|
-
* Initiate a card payment (customer → business owner).
|
|
1138
|
-
* Routes to Monnify (NGN) or Flutterwave (non-NGN) on the backend.
|
|
1139
|
-
* Returns a checkout_url to redirect the customer to the gateway.
|
|
1140
|
-
*/
|
|
1141
|
-
declare function initiatePayment(request: PaymentInitiateRequest): Promise<PaymentInitiateResponse>;
|
|
1142
|
-
/**
|
|
1143
|
-
* Request a 15-minute rate-locked conversion quote for non-NGN transactions.
|
|
1144
|
-
*/
|
|
1145
|
-
declare function requestQuote(amount: number): Promise<ConversionQuote>;
|
|
1146
|
-
/**
|
|
1147
|
-
* Verify a payment after the gateway redirects back to /checkout/verify.
|
|
1148
|
-
*/
|
|
1149
|
-
declare function verifyTransaction(reference: string): Promise<TransactionVerifyResponse>;
|
|
1150
|
-
/**
|
|
1151
|
-
* Poll transaction status by internal transaction ID.
|
|
1152
|
-
*/
|
|
1153
|
-
declare function getTransactionStatus(transactionId: string): Promise<TransactionVerifyResponse>;
|
|
1154
|
-
declare const paymentService: {
|
|
1155
|
-
readonly createDedicatedAccount: typeof createDedicatedAccount;
|
|
1156
|
-
readonly initiatePayment: typeof initiatePayment;
|
|
1157
|
-
readonly requestQuote: typeof requestQuote;
|
|
1158
|
-
readonly verifyTransaction: typeof verifyTransaction;
|
|
1159
|
-
readonly getTransactionStatus: typeof getTransactionStatus;
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
declare function createConsultation(payload: ConsultationCreatePayload): Promise<Consultation>;
|
|
1163
|
-
declare function getConsultations(): Promise<Consultation[]>;
|
|
1164
|
-
declare function getConsultation(id: string): Promise<Consultation>;
|
|
1165
|
-
declare function sendMessage(id: string, payload: ConsultationMessagePayload): Promise<void>;
|
|
1166
|
-
declare function acceptQuote(id: string, payload: ConsultationQuoteAcceptPayload): Promise<Consultation>;
|
|
1167
|
-
declare function rejectQuote(id: string, reason?: string): Promise<Consultation>;
|
|
1168
|
-
declare const consultationService: {
|
|
1169
|
-
createConsultation: typeof createConsultation;
|
|
1170
|
-
getConsultations: typeof getConsultations;
|
|
1171
|
-
getConsultation: typeof getConsultation;
|
|
1172
|
-
sendMessage: typeof sendMessage;
|
|
1173
|
-
acceptQuote: typeof acceptQuote;
|
|
1174
|
-
rejectQuote: typeof rejectQuote;
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
interface CartItemPayload {
|
|
1178
|
-
product: {
|
|
1179
|
-
name: string;
|
|
1180
|
-
price: number;
|
|
1181
|
-
weight: number;
|
|
1182
|
-
};
|
|
1183
|
-
variant: ProductVariant | null;
|
|
1184
|
-
quantity: number;
|
|
1185
|
-
}
|
|
1186
|
-
interface RateAddress {
|
|
1187
|
-
city: string;
|
|
1188
|
-
state: string;
|
|
1189
|
-
country: string;
|
|
1190
|
-
}
|
|
1191
|
-
interface ShippingRatesRequest {
|
|
1192
|
-
cart_items: CartItemPayload[];
|
|
1193
|
-
origin_address: RateAddress;
|
|
1194
|
-
destination_address: RateAddress;
|
|
1195
|
-
currency?: string;
|
|
1196
|
-
}
|
|
1197
|
-
/**
|
|
1198
|
-
* Fetch shipping rates for a cart.
|
|
1199
|
-
*/
|
|
1200
|
-
declare function getShippingRates(payload: ShippingRatesRequest): Promise<ShippingRatesResponse>;
|
|
1201
|
-
/**
|
|
1202
|
-
* Fetch the seller's registered shipping address.
|
|
1203
|
-
*/
|
|
1204
|
-
declare function getSellerShippingAddress(): Promise<{
|
|
1205
|
-
terminal_address_id: string | null;
|
|
1206
|
-
address_details: {
|
|
1207
|
-
city: string;
|
|
1208
|
-
state: string;
|
|
1209
|
-
country: string;
|
|
1210
|
-
line1: string;
|
|
1211
|
-
line2: string;
|
|
1212
|
-
zip: string;
|
|
1213
|
-
} | null;
|
|
1214
|
-
business_id: string;
|
|
1215
|
-
message: string;
|
|
1216
|
-
}>;
|
|
1217
|
-
/**
|
|
1218
|
-
* Validate a shipping address.
|
|
1219
|
-
*/
|
|
1220
|
-
declare function validateShippingAddress(payload: {
|
|
1221
|
-
first_name: string;
|
|
1222
|
-
last_name: string;
|
|
1223
|
-
phone: string;
|
|
1224
|
-
address_line1: string;
|
|
1225
|
-
address_line2?: string;
|
|
1226
|
-
city: string;
|
|
1227
|
-
state: string;
|
|
1228
|
-
country: string;
|
|
1229
|
-
postal_code?: string;
|
|
1230
|
-
}): Promise<{
|
|
1231
|
-
valid: boolean;
|
|
1232
|
-
message?: string;
|
|
1233
|
-
data?: Array<{
|
|
1234
|
-
name: string;
|
|
1235
|
-
city_id: string;
|
|
1236
|
-
stateCode: string;
|
|
1237
|
-
countryCode: string;
|
|
1238
|
-
}>;
|
|
1239
|
-
}>;
|
|
1240
|
-
declare const logisticsService: {
|
|
1241
|
-
getShippingRates: typeof getShippingRates;
|
|
1242
|
-
getSellerShippingAddress: typeof getSellerShippingAddress;
|
|
1243
|
-
validateShippingAddress: typeof validateShippingAddress;
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
declare function checkAvailability(product_id: string): Promise<BespokeAvailability>;
|
|
1247
|
-
declare const bespokeService: {
|
|
1248
|
-
checkAvailability: typeof checkAvailability;
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
|
-
declare function getAvailableSlots(product_id: string, date_from: string, date_to: string): Promise<AvailableSlot[]>;
|
|
1252
|
-
declare function bookAppointment(payload: ServiceAppointmentCreatePayload): Promise<ServiceAppointment>;
|
|
1253
|
-
declare function getAppointments(): Promise<ServiceAppointment[]>;
|
|
1254
|
-
declare function getAppointment(id: string): Promise<ServiceAppointment>;
|
|
1255
|
-
declare function cancelAppointment(id: string): Promise<void>;
|
|
1256
|
-
declare function getDeliverables(order_id: string): Promise<ServiceDeliverable[]>;
|
|
1257
|
-
declare function approveDeliverable(order_id: string, deliverable_id: string): Promise<ServiceDeliverable>;
|
|
1258
|
-
declare function requestRevision(order_id: string, deliverable_id: string, feedback: string): Promise<ServiceDeliverable>;
|
|
1259
|
-
declare const serviceBookingService: {
|
|
1260
|
-
getAvailableSlots: typeof getAvailableSlots;
|
|
1261
|
-
bookAppointment: typeof bookAppointment;
|
|
1262
|
-
getAppointments: typeof getAppointments;
|
|
1263
|
-
getAppointment: typeof getAppointment;
|
|
1264
|
-
cancelAppointment: typeof cancelAppointment;
|
|
1265
|
-
getDeliverables: typeof getDeliverables;
|
|
1266
|
-
approveDeliverable: typeof approveDeliverable;
|
|
1267
|
-
requestRevision: typeof requestRevision;
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
|
-
interface ContactFormData {
|
|
1271
|
-
name: string;
|
|
1272
|
-
email: string;
|
|
1273
|
-
subject: string;
|
|
1274
|
-
message: string;
|
|
1275
|
-
source?: string;
|
|
1276
|
-
company_name?: string;
|
|
1277
|
-
current_year?: number;
|
|
1278
|
-
turnstile_token?: string;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Send contact email to Luxe team.
|
|
1282
|
-
* POST /contact/send-contact-email
|
|
1283
|
-
*/
|
|
1284
|
-
declare function sendContactEmail(payload: ContactFormData): Promise<{
|
|
1285
|
-
detail: string;
|
|
1286
|
-
}>;
|
|
1287
|
-
/**
|
|
1288
|
-
* Send confirmation email to user.
|
|
1289
|
-
* POST /contact/send-contact-confirmation
|
|
1290
|
-
*/
|
|
1291
|
-
declare function sendContactConfirmation(payload: Omit<ContactFormData, 'turnstile_token'>): Promise<{
|
|
1292
|
-
detail: string;
|
|
1293
|
-
}>;
|
|
1294
|
-
declare const notificationsService: {
|
|
1295
|
-
readonly sendContactEmail: typeof sendContactEmail;
|
|
1296
|
-
readonly sendContactConfirmation: typeof sendContactConfirmation;
|
|
1297
|
-
};
|
|
1298
|
-
|
|
1299
|
-
/**
|
|
1300
|
-
* App Service
|
|
1301
|
-
*
|
|
1302
|
-
* Handles translation and other app-level utilities.
|
|
1303
|
-
*/
|
|
1304
|
-
declare function googleTranslate(text: string, target: string, source?: string): Promise<string>;
|
|
1305
|
-
|
|
1306
|
-
/**
|
|
1307
|
-
* Fetch supported languages from the payment system.
|
|
1308
|
-
* Resolves to: {luxePaymentBackendUrl}/config/supported-languages
|
|
1309
|
-
*/
|
|
1310
|
-
declare function getSupportedLanguages(): Promise<SupportedLanguagesResponse>;
|
|
1311
|
-
/**
|
|
1312
|
-
* Fetch supported currencies from the payment system.
|
|
1313
|
-
* Resolves to: {luxePaymentBackendUrl}/config/supported-currencies
|
|
1314
|
-
*/
|
|
1315
|
-
declare function getSupportedCurrencies(): Promise<SupportedCurrenciesResponse>;
|
|
1316
|
-
/**
|
|
1317
|
-
* Fetch the business's public configuration, including store_currency.
|
|
1318
|
-
* Uses publicStoreAxios (X-Storefront-Key + X-Business-ID — no user JWT required).
|
|
1319
|
-
* Resolves to: {luxeStoreBackendUrl}/business/profile
|
|
1320
|
-
*/
|
|
1321
|
-
declare function getBusinessConfig(): Promise<BusinessConfig>;
|
|
1322
|
-
declare const configService: {
|
|
1323
|
-
readonly getSupportedLanguages: typeof getSupportedLanguages;
|
|
1324
|
-
readonly getSupportedCurrencies: typeof getSupportedCurrencies;
|
|
1325
|
-
readonly getBusinessConfig: typeof getBusinessConfig;
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
|
-
/**
|
|
1329
|
-
* List CMS entries for a specific model.
|
|
1330
|
-
* Requires public_api.read permission on the model.
|
|
1331
|
-
*/
|
|
1332
|
-
declare function listCmsEntries(modelSlug: string, params?: ListCmsEntriesParams): Promise<CmsEntryListResponse>;
|
|
1333
|
-
/**
|
|
1334
|
-
* Get a single CMS entry by ID.
|
|
1335
|
-
* Requires public_api.read permission on the model.
|
|
1336
|
-
*/
|
|
1337
|
-
declare function getCmsEntry(modelSlug: string, entryId: string): Promise<CmsEntry>;
|
|
1338
|
-
/**
|
|
1339
|
-
* Create a new CMS entry.
|
|
1340
|
-
* Requires public_api.create permission on the model.
|
|
1341
|
-
*/
|
|
1342
|
-
declare function createCmsEntry(modelSlug: string, params: CreateCmsEntryParams): Promise<CmsEntry>;
|
|
1343
|
-
/**
|
|
1344
|
-
* Update an existing CMS entry.
|
|
1345
|
-
* Requires public_api.update permission on the model.
|
|
1346
|
-
*/
|
|
1347
|
-
declare function updateCmsEntry(modelSlug: string, entryId: string, params: UpdateCmsEntryParams): Promise<CmsEntry>;
|
|
1348
|
-
/**
|
|
1349
|
-
* Delete a CMS entry.
|
|
1350
|
-
* Requires public_api.delete permission on the model.
|
|
1351
|
-
*/
|
|
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;
|
|
1809
|
-
|
|
1810
96
|
/**
|
|
1811
97
|
* Cache Tiers Utility
|
|
1812
98
|
*
|
|
@@ -1908,22 +194,45 @@ declare function enrichCompletedOrder(order: Order, options: {
|
|
|
1908
194
|
|
|
1909
195
|
/**
|
|
1910
196
|
* Type-safe way to extract an error message from an API error.
|
|
197
|
+
* Updated for fetch-based errors (no axios dependency).
|
|
1911
198
|
*/
|
|
1912
199
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
1913
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @file storage.ts
|
|
203
|
+
* @description Centralized tenant-isolated storage utility for sessionStorage and localStorage.
|
|
204
|
+
* Automatically prefixes all keys with the storefront Business ID to guarantee multi-tenant segregation.
|
|
205
|
+
* Stateless - requires businessId parameter.
|
|
206
|
+
*/
|
|
1914
207
|
declare const sessionStore: {
|
|
1915
|
-
get: (
|
|
1916
|
-
set: (
|
|
1917
|
-
remove: (
|
|
1918
|
-
getJSON: <T = unknown>(
|
|
1919
|
-
setJSON: (
|
|
208
|
+
get: (businessIdOrKey: string, key?: string) => string | null;
|
|
209
|
+
set: (businessIdOrKey: string, keyOrVal: string, val?: string) => void;
|
|
210
|
+
remove: (businessIdOrKey: string, key?: string) => void;
|
|
211
|
+
getJSON: <T = unknown>(businessIdOrKey: string, key?: string) => T | null;
|
|
212
|
+
setJSON: (businessIdOrKey: string, keyOrVal: unknown, val?: unknown) => void;
|
|
1920
213
|
};
|
|
1921
214
|
declare const localStore: {
|
|
1922
|
-
get: (
|
|
1923
|
-
set: (
|
|
1924
|
-
remove: (
|
|
1925
|
-
getJSON: <T = unknown>(
|
|
1926
|
-
setJSON: (
|
|
215
|
+
get: (businessIdOrKey: string, key?: string) => string | null;
|
|
216
|
+
set: (businessIdOrKey: string, keyOrVal: string, val?: string) => void;
|
|
217
|
+
remove: (businessIdOrKey: string, key?: string) => void;
|
|
218
|
+
getJSON: <T = unknown>(businessIdOrKey: string, key?: string) => T | null;
|
|
219
|
+
setJSON: (businessIdOrKey: string, keyOrVal: unknown, val?: unknown) => void;
|
|
1927
220
|
};
|
|
1928
221
|
|
|
1929
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Form validation utilities for kasuvia-sdk
|
|
224
|
+
* Provides realtime validation for email, password, name, confirm password, and message fields
|
|
225
|
+
*/
|
|
226
|
+
declare function validateEmail(email: string): string | null;
|
|
227
|
+
declare function validatePassword(password: string): string | null;
|
|
228
|
+
declare function validateName(name: string, fieldName?: string): string | null;
|
|
229
|
+
declare function validateRequired(value: string, fieldName: string): string | null;
|
|
230
|
+
/**
|
|
231
|
+
* Validates the confirm-password field.
|
|
232
|
+
* Returns null (no error) when the field is empty — avoids nagging the user
|
|
233
|
+
* before they've had a chance to type anything.
|
|
234
|
+
*/
|
|
235
|
+
declare function validateConfirmPassword(password: string, confirmPassword: string): string | null;
|
|
236
|
+
declare function validateMessage(message: string): string | null;
|
|
237
|
+
|
|
238
|
+
export { type BespokeCapacityConfig, type BespokeSlotBooking, CheckoutCustomer, CustomerUser, DeliveryAddress, InvalidBaseURLError, type MediaAsset, type MediaAssetUpdatePayload, type MediaUploadParams, Order, STORAGE_KEYS, ShippingLocation, type SlotBookingStatus, type StorageStats, buildDeliveryAddress, buildFullName, enrichCompletedOrder, getCacheTier, getCheckoutCustomerName, getCustomerDisplayName, getErrorMessage, getStorefrontUrl, localStore, logger, sanitizeBaseUrl, sessionStore, setEnvironmentMode, setLoggerEnvironmentMode, splitFullName, validateConfirmPassword, validateEmail, validateMessage, validateName, validatePassword, validateRequired };
|