@kasuvia/sdk 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -15
- package/dist/AddressAutocomplete-CjcqPElD.d.mts +46 -0
- package/dist/AddressAutocomplete-CvJHuRkf.d.ts +46 -0
- package/dist/components/index.d.mts +497 -0
- package/dist/components/index.d.ts +497 -0
- package/dist/components/index.js +4217 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +4194 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/server.d.mts +26 -0
- package/dist/config/server.d.ts +26 -0
- package/dist/config/server.js +38 -0
- package/dist/config/server.js.map +1 -0
- package/dist/config/server.mjs +13 -0
- package/dist/config/server.mjs.map +1 -0
- package/dist/hooks/index.d.mts +393 -160
- package/dist/hooks/index.d.ts +393 -160
- package/dist/hooks/index.js +2792 -2137
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2734 -2121
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index-CNW_LINy.d.mts +578 -0
- package/dist/index-CNW_LINy.d.ts +578 -0
- package/dist/{index-C1chUA3P.d.mts → index-F7N6UItS.d.mts} +1 -1
- package/dist/{index-C1chUA3P.d.ts → index-F7N6UItS.d.ts} +1 -1
- package/dist/index-NkI10J_E.d.mts +40 -0
- package/dist/index-NkI10J_E.d.ts +40 -0
- package/dist/index.d.mts +20437 -103
- package/dist/index.d.ts +20437 -103
- package/dist/index.js +2111 -1802
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2006 -1786
- package/dist/index.mjs.map +1 -1
- package/dist/media.service-Cx7dQjzX.d.mts +1393 -0
- package/dist/media.service-mrBFJ2UQ.d.ts +1393 -0
- package/dist/services/index.d.mts +908 -2
- package/dist/services/index.d.ts +908 -2
- package/dist/services/index.js +1492 -1686
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +1431 -1670
- package/dist/services/index.mjs.map +1 -1
- package/package.json +46 -6
- package/src/components/bespoke/BespokeAvailabilityBadge.tsx +32 -0
- package/src/components/bespoke/BespokeProgressTracker.tsx +58 -0
- package/src/components/bespoke/index.ts +3 -0
- package/src/components/booking/SlotPicker.tsx +97 -0
- package/src/components/booking/index.ts +1 -0
- package/src/components/cart/CartItem.tsx +81 -0
- package/src/components/cart/CartSidebar.tsx +115 -0
- package/src/components/cart/CartTypeMismatchBanner.tsx +55 -0
- package/src/components/cart/index.ts +3 -0
- package/src/components/index.ts +8 -0
- package/src/components/orders/DeliverableReviewer.tsx +139 -0
- package/src/components/orders/index.ts +1 -0
- package/src/components/product/ProductCard.tsx +350 -0
- package/src/components/product/ProductGrid.tsx +84 -0
- package/src/components/product/index.ts +2 -0
- package/src/components/shared/AddressAutocomplete.tsx +212 -0
- package/src/components/shared/AnalyticsScripts.tsx +56 -0
- package/src/components/shared/CookieConsentBanner.tsx +98 -0
- package/src/components/shared/ImageEditorModal.tsx +1066 -0
- package/src/components/shared/ImageViewerModal.tsx +598 -0
- package/src/components/shared/LucideReactIcon.tsx +52 -0
- package/src/components/shared/MapPinDrop.tsx +101 -0
- package/src/components/shared/MultiSelectPicker.tsx +193 -0
- package/src/components/shared/OfflineBanner.tsx +46 -0
- package/src/components/shared/SearchableInput.tsx +153 -0
- package/src/components/shared/SearchablePopover.tsx +166 -0
- package/src/components/shared/SmartImage.tsx +311 -0
- package/src/components/shared/TruncatedValue.tsx +27 -0
- package/src/components/shared/UnsavedChangesGuard.tsx +138 -0
- package/src/components/shared/index.ts +15 -0
- package/src/components/skeletons/CardSkeleton.tsx +26 -0
- package/src/components/skeletons/CartItemSkeleton.tsx +26 -0
- package/src/components/skeletons/OrderItemSkeleton.tsx +26 -0
- package/src/components/skeletons/ProductCardSkeleton.tsx +26 -0
- package/src/components/skeletons/TableSkeleton.tsx +42 -0
- package/src/components/skeletons/index.ts +5 -0
- package/src/config/index.ts +22 -4
- package/src/config/server.ts +45 -0
- package/src/context/sdk-context.tsx +5 -2
- package/src/generated/auth-openapi.ts +2935 -0
- package/src/generated/cart-openapi.ts +652 -0
- package/src/generated/cms-openapi.ts +1668 -0
- package/src/generated/crm-openapi.ts +986 -0
- package/src/generated/graphql.ts +126 -0
- package/src/generated/index.ts +11 -0
- package/src/generated/media-openapi.ts +613 -0
- package/src/generated/notification-openapi.ts +862 -0
- package/src/generated/payment-openapi.ts +2713 -0
- package/src/generated/store-openapi.ts +9510 -0
- package/src/graphql/operations/collections.graphql +32 -0
- package/src/graphql/operations/products.graphql +197 -0
- package/src/graphql/operations/wishlist.graphql +25 -0
- package/src/hooks/index.ts +9 -2
- package/src/hooks/use-auth.ts +163 -69
- package/src/hooks/use-bespoke-availability.ts +39 -22
- package/src/hooks/use-business-config.ts +51 -0
- package/src/hooks/use-cart.ts +310 -238
- package/src/hooks/use-cms.ts +107 -127
- package/src/hooks/use-collections.ts +35 -55
- package/src/hooks/use-consultations.ts +9 -136
- package/src/hooks/use-countries.ts +19 -28
- package/src/hooks/use-currencies.ts +8 -20
- package/src/hooks/use-customer-address.ts +64 -0
- package/src/hooks/use-feedback.ts +34 -0
- package/src/hooks/use-languages.ts +26 -39
- package/src/hooks/use-media-upload.ts +23 -0
- package/src/hooks/use-notification-stream.ts +88 -0
- package/src/hooks/use-notifications.ts +163 -0
- package/src/hooks/use-order-stream.ts +29 -29
- package/src/hooks/use-orders.ts +91 -73
- package/src/hooks/use-payment.ts +116 -84
- package/src/hooks/use-products.ts +65 -269
- package/src/hooks/use-push-notifications.ts +122 -0
- package/src/hooks/use-reviews.ts +175 -0
- package/src/hooks/use-service-booking.ts +109 -132
- package/src/hooks/use-states.ts +16 -30
- package/src/hooks/use-wishlist.ts +44 -69
- package/src/index.ts +15 -11
- package/src/services/auth.service.ts +422 -132
- package/src/services/bespoke.service.ts +69 -10
- package/src/services/cart.service.ts +155 -186
- package/src/services/cms.service.ts +41 -50
- package/src/services/collection.service.ts +25 -63
- package/src/services/config.service.ts +10 -21
- package/src/services/consultation.service.ts +36 -93
- package/src/services/feedback.service.ts +76 -0
- package/src/services/index.ts +7 -1
- package/src/services/legal.service.ts +62 -0
- package/src/services/logistics.service.ts +235 -53
- package/src/services/media.service.ts +115 -0
- package/src/services/notifications.service.ts +204 -20
- package/src/services/order.service.ts +498 -127
- package/src/services/payment.service.ts +149 -100
- package/src/services/product.service.ts +157 -814
- package/src/services/review.service.ts +211 -0
- package/src/services/service-booking.service.ts +198 -99
- package/src/services/wishlist.service.ts +27 -74
- package/src/types/auth/index.ts +161 -18
- package/src/types/business/index.ts +9 -1
- package/src/types/cms/index.ts +91 -6
- package/src/types/cms/legal.ts +18 -0
- package/src/types/consultations/index.ts +60 -68
- package/src/types/index.ts +5 -3
- package/src/types/media/index.ts +35 -3
- package/src/types/payments/index.ts +80 -16
- package/src/types/reviews/index.ts +116 -0
- package/src/types/services/index.ts +113 -38
- package/src/types/store/checkout.ts +53 -0
- package/src/types/store/index.ts +273 -52
- package/src/types/store/invoice.ts +31 -0
- package/src/types/store/shipping.ts +84 -3
- package/src/types/ui/index.ts +1 -1
- package/src/utils/checkout.ts +19 -3
- package/src/utils/cookieConsent.ts +34 -0
- package/src/utils/format.ts +408 -0
- package/src/utils/geolocation.ts +134 -0
- package/src/utils/graphql-url.ts +47 -0
- package/src/utils/guest-session.ts +59 -0
- package/src/utils/http-client.ts +147 -0
- package/src/utils/index.ts +11 -4
- package/src/utils/status-colors.ts +79 -0
- package/src/utils/token-refresh.ts +115 -0
- package/src/utils/validators.ts +13 -0
- package/src/utils/youtube.ts +18 -0
- package/dist/index-C5YO9gTl.d.mts +0 -507
- package/dist/index-C5YO9gTl.d.ts +0 -507
- package/dist/index-CefG7_xq.d.mts +0 -793
- package/dist/index-DeHCf3zI.d.ts +0 -793
- package/src/graphql/collections.graphql.ts +0 -48
- package/src/graphql/index.ts +0 -7
- package/src/graphql/products.graphql.ts +0 -860
- package/src/graphql/wishlist.graphql.ts +0 -34
- package/src/hooks/use-consultation-stream.ts +0 -142
- package/src/types/bespoke/index.ts +0 -39
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import { b as CartResponse, a as CartItem, P as Product, O as Order, C as CreateOrderParams, F as FindOrderParams, L as ListParams, c as Collection, d as PaginatedResponse, W as WishlistItem, e as WishlistCheckResponse, f as WishlistListResponse } from '../index-CNW_LINy.js';
|
|
3
|
+
import { S as SdkConfig } from '../index-NkI10J_E.js';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
5
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
6
|
+
import { C as CreateBespokeOrderParams, a as CreateServiceBookingOrderParams, b as Consultation, c as CreateConsultationParams, F as Feedback, d as CreateFeedbackParams, e as FeedbackListResponse, f as CustomerAddress, g as CreateCustomerAddressPayload, U as UpdateCustomerAddressPayload, A as AuthUserResponse, h as ChangePasswordPayload, D as DeactivateAccountResult, i as CustomerDeactivatePayload, j as CustomerForgotPasswordPayload, k as CustomerReactivatePayload, l as CustomerReactivateVerifyPayload, m as CustomerResetPasswordPayload, n as CustomerAuthResponse, o as CustomerLoginPayload, p as CustomerRegisterPayload, q as CustomerPasswordlessRequestPayload, S as StorefrontBusinessInfo, r as CustomerUser, s as UpdateProfilePayload, t as CustomerPasswordlessVerifyPayload, u as SupportedLang, v as Currency, B as BespokeDeliverableStatus, w as BespokeAvailability, x as ServiceAppointment, y as ServiceBookingsPage, z as ServiceMilestone, E as ApproveMilestonePayload, G as AvailableSlotsResponse, H as ServiceAppointmentCreatePayload, I as CancelAppointmentPayload, J as ConfirmAppointmentPayload, K as DisputeAppointmentPayload, R as RescheduleAppointmentPayload, L as Comment, M as CommentCreate, N as Review, O as ReviewCreate, P as MerchantReplyCreate, Q as CommentModerationAction, T as ReviewModerationAction, V as ProductCommentsResponse, W as ProductReviewsResponse, X as CommentUpdate, Y as ReviewUpdate, Z as GatewayMethods, _ as WalletBalanceResponse, $ as DVADetails, a0 as DVACreateRequest, a1 as PaymentInitiateResponse, a2 as PaymentInitiateRequest, a3 as TransactionVerifyResponse, a4 as WalletLedgerResponse, a5 as CmsEntry, a6 as CreateCmsEntryParams, a7 as UpdateCmsEntryParams, a8 as ListCmsEntriesParams, a9 as BusinessConfig, aa as NotificationInboxResponse, ab as NotificationPreferences, ac as ContactFormData, ad as SubscribeToPushParams, ae as VapidPublicKeyResponse, af as MediaAsset, ag as UploadMediaFileParams, ah as UploadMediaFilesResult } from '../media.service-mrBFJ2UQ.js';
|
|
7
|
+
import { C as Country, S as State } from '../index-F7N6UItS.js';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Cart Hook & Context Provider
|
|
8
11
|
*
|
|
9
12
|
* React Query hooks for cart operations with unified drawer state sharing.
|
|
10
|
-
*
|
|
13
|
+
* All cart operations route directly to kasuvia-cart-management via the SDK
|
|
14
|
+
* service functions — never through framework-coupled proxy routes.
|
|
15
|
+
*
|
|
16
|
+
* - Authenticated users: use Authorization Bearer token
|
|
17
|
+
* - Guest users: use guestSessionId (X-Guest-Session header)
|
|
18
|
+
*
|
|
19
|
+
* config and accessToken are optional — if omitted they are read from SdkContext.
|
|
11
20
|
*/
|
|
12
21
|
|
|
13
22
|
interface UseCartReturn {
|
|
@@ -20,15 +29,15 @@ interface UseCartReturn {
|
|
|
20
29
|
error: Error | null;
|
|
21
30
|
addToCart: (item: {
|
|
22
31
|
product_id: string;
|
|
23
|
-
product_slug
|
|
24
|
-
product_name
|
|
32
|
+
product_slug?: string;
|
|
33
|
+
product_name?: string;
|
|
25
34
|
image?: string;
|
|
26
35
|
variant_id?: string;
|
|
27
36
|
variant_attributes?: string;
|
|
28
|
-
unit_price
|
|
37
|
+
unit_price?: number;
|
|
29
38
|
quantity: number;
|
|
30
39
|
custom_measurements?: string;
|
|
31
|
-
is_bespoke
|
|
40
|
+
is_bespoke?: boolean;
|
|
32
41
|
}) => void;
|
|
33
42
|
updateCartItem: (variables: {
|
|
34
43
|
itemId: string;
|
|
@@ -39,63 +48,150 @@ interface UseCartReturn {
|
|
|
39
48
|
clear: () => void;
|
|
40
49
|
mergeGuestCart: (guestSessionId: string) => void;
|
|
41
50
|
addItem: (product: Product, variantId?: string, quantity?: number, customMeasurements?: Record<string, string>) => void;
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
/** Rejects with the real backend error on failure — the optimistic UI update it made is already rolled back by then; catch this to show why. */
|
|
52
|
+
updateQty: (itemId: string, quantity: number) => Promise<CartResponse>;
|
|
53
|
+
/** Rejects with the real backend error on failure — the optimistic UI update it made is already rolled back by then; catch this to show why. */
|
|
54
|
+
removeItem: (itemId: string) => Promise<void>;
|
|
44
55
|
subtotal: number;
|
|
45
|
-
productTypeMismatch:
|
|
46
|
-
message: string;
|
|
47
|
-
existing_type: string;
|
|
48
|
-
new_type: string;
|
|
49
|
-
} | null;
|
|
56
|
+
productTypeMismatch: ProductTypeMismatchDetail | null;
|
|
50
57
|
handleClearCartAndAdd: () => void;
|
|
51
58
|
handleKeepCurrentCart: () => void;
|
|
52
59
|
}
|
|
60
|
+
interface ProductTypeMismatchDetail {
|
|
61
|
+
message: string;
|
|
62
|
+
existing_type: string;
|
|
63
|
+
new_type: string;
|
|
64
|
+
}
|
|
53
65
|
interface CartContextValue {
|
|
54
66
|
isOpen: boolean;
|
|
55
67
|
setOpen: (open: boolean) => void;
|
|
68
|
+
productTypeMismatch: ProductTypeMismatchDetail | null;
|
|
69
|
+
setProductTypeMismatch: (detail: ProductTypeMismatchDetail | null) => void;
|
|
56
70
|
}
|
|
57
|
-
declare const CartCtx:
|
|
71
|
+
declare const CartCtx: React__default.Context<CartContextValue | null> | null;
|
|
58
72
|
declare function CartProvider({ children }: {
|
|
59
73
|
children: ReactNode;
|
|
60
|
-
}): string | number | bigint | boolean |
|
|
61
|
-
declare function useCart(config?: SdkConfig, accessToken?: string | null): UseCartReturn;
|
|
74
|
+
}): string | number | bigint | boolean | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | React__default.FunctionComponentElement<React__default.ProviderProps<CartContextValue | null>> | null | undefined;
|
|
75
|
+
declare function useCart(config?: SdkConfig, accessToken?: string | null, guestSessionId?: string | null): UseCartReturn;
|
|
62
76
|
|
|
63
77
|
declare function useOrders(arg1?: SdkConfig | {
|
|
64
78
|
page?: number;
|
|
65
|
-
|
|
79
|
+
page_size?: number;
|
|
66
80
|
}, arg2?: string | null, arg3?: {
|
|
67
81
|
page?: number;
|
|
68
|
-
|
|
69
|
-
}):
|
|
70
|
-
declare function useOrdersList(arg1?:
|
|
71
|
-
declare function useFindOrder(arg1?: SdkConfig | string | FindOrderParams, arg2?: FindOrderParams):
|
|
72
|
-
declare function useOrder(arg1?: SdkConfig | string | FindOrderParams, arg2?: FindOrderParams):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
page_size?: number;
|
|
83
|
+
}): _tanstack_react_query.UseQueryResult<NoInfer<Order[]>, Error>;
|
|
84
|
+
declare function useOrdersList(arg1?: unknown, arg2?: unknown, arg3?: unknown): _tanstack_react_query.UseQueryResult<NoInfer<Order[]>, Error>;
|
|
85
|
+
declare function useFindOrder(arg1?: SdkConfig | string | FindOrderParams, arg2?: FindOrderParams): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
86
|
+
declare function useOrder(arg1?: SdkConfig | string | FindOrderParams, arg2?: FindOrderParams): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
87
|
+
/**
|
|
88
|
+
* REAL BUG FIXED (2026-09-22): took an arbitrary "guestToken" string —
|
|
89
|
+
* trackOrder's real backend endpoint (GET /orders/{id}) has no guest-token
|
|
90
|
+
* concept at all, it requires a genuine authenticated JWT belonging to the
|
|
91
|
+
* order's own customer (see trackOrder's doc comment). Resolves a real
|
|
92
|
+
* accessToken from SdkContext like every other authenticated hook instead.
|
|
93
|
+
*/
|
|
94
|
+
declare function useOrderTracking(config?: SdkConfig, accessToken?: string | null, orderId?: string): _tanstack_react_query.UseQueryResult<NoInfer<Order>, Error>;
|
|
95
|
+
/**
|
|
96
|
+
* REAL BUG FIXED (2026-09-22): passed `token || ''` — an empty string
|
|
97
|
+
* `accessToken`, which used to produce a malformed `Authorization: Bearer `
|
|
98
|
+
* header instead of genuinely omitting it. Combined with createOrder's own
|
|
99
|
+
* fix (see its doc comment), guest checkout through this hook has never
|
|
100
|
+
* actually worked even though the real backend endpoint was built to
|
|
101
|
+
* support it via X-Guest-Session — the same guestSessionId SdkContext
|
|
102
|
+
* already resolves for every useCart() call site now also reaches here.
|
|
103
|
+
*/
|
|
104
|
+
declare function useCreateOrder(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Order, Error, CreateOrderParams, unknown>;
|
|
105
|
+
declare function useCreateBespokeOrder(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Order, Error, CreateBespokeOrderParams, unknown>;
|
|
106
|
+
declare function useCreateServiceBookingOrder(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Order, Error, CreateServiceBookingOrderParams, unknown>;
|
|
107
|
+
declare function useCancelOrder(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Order, Error, {
|
|
108
|
+
orderId: string;
|
|
109
|
+
reason?: string;
|
|
110
|
+
}, unknown>;
|
|
111
|
+
|
|
112
|
+
declare function useCreateConsultation(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Consultation, Error, CreateConsultationParams, unknown>;
|
|
76
113
|
|
|
77
|
-
declare function
|
|
78
|
-
declare function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
114
|
+
declare function useCreateFeedback(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<Feedback, Error, CreateFeedbackParams, unknown>;
|
|
115
|
+
declare function useMyFeedback(params?: {
|
|
116
|
+
page?: number;
|
|
117
|
+
page_size?: number;
|
|
118
|
+
}, config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseQueryResult<NoInfer<FeedbackListResponse>, Error>;
|
|
119
|
+
|
|
120
|
+
declare function useCustomerAddresses(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseQueryResult<NoInfer<CustomerAddress[]>, Error>;
|
|
121
|
+
declare function useCreateCustomerAddress(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<CustomerAddress, Error, CreateCustomerAddressPayload, unknown>;
|
|
122
|
+
declare function useUpdateCustomerAddress(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<CustomerAddress, Error, {
|
|
123
|
+
addressId: string;
|
|
124
|
+
payload: UpdateCustomerAddressPayload;
|
|
125
|
+
}, unknown>;
|
|
126
|
+
declare function useDeleteCustomerAddress(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
82
127
|
|
|
128
|
+
declare function useAuthUser(config?: SdkConfig, accessToken?: string): _tanstack_react_query.UseQueryResult<NoInfer<AuthUserResponse>, Error>;
|
|
129
|
+
/**
|
|
130
|
+
* Real gap fixed 2026-09-17: GET /auth/storefront/business-info/ had no SDK
|
|
131
|
+
* hook — public/unauthenticated (only needs the storefront key), so unlike
|
|
132
|
+
* useAuthUser this is always enabled, never gated on an access token.
|
|
133
|
+
*/
|
|
134
|
+
declare function useStorefrontBusinessInfo(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontBusinessInfo>, Error>;
|
|
135
|
+
declare function useLogin(config?: SdkConfig): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, CustomerLoginPayload, unknown>;
|
|
136
|
+
declare function useRegister(config?: SdkConfig): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, CustomerRegisterPayload, unknown>;
|
|
137
|
+
declare function useRequestOtp(config?: SdkConfig): _tanstack_react_query.UseMutationResult<void, Error, CustomerPasswordlessRequestPayload, unknown>;
|
|
138
|
+
declare function useVerifyOtp(config?: SdkConfig): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, CustomerPasswordlessVerifyPayload, unknown>;
|
|
139
|
+
declare function useCustomerForgotPassword(config?: SdkConfig): _tanstack_react_query.UseMutationResult<{
|
|
140
|
+
detail: string;
|
|
141
|
+
}, Error, CustomerForgotPasswordPayload, unknown>;
|
|
142
|
+
declare function useCustomerResetPassword(config?: SdkConfig): _tanstack_react_query.UseMutationResult<{
|
|
143
|
+
detail: string;
|
|
144
|
+
}, Error, CustomerResetPasswordPayload, unknown>;
|
|
145
|
+
declare function useCustomerDeactivateAccount(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<DeactivateAccountResult, Error, CustomerDeactivatePayload | undefined, unknown>;
|
|
146
|
+
declare function useCustomerReactivateRequest(config?: SdkConfig): _tanstack_react_query.UseMutationResult<{
|
|
147
|
+
detail: string;
|
|
148
|
+
}, Error, CustomerReactivatePayload, unknown>;
|
|
149
|
+
declare function useCustomerReactivateVerify(config?: SdkConfig): _tanstack_react_query.UseMutationResult<{
|
|
150
|
+
detail: string;
|
|
151
|
+
}, Error, CustomerReactivateVerifyPayload, unknown>;
|
|
152
|
+
declare function useUpdateProfile(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<CustomerUser, Error, UpdateProfilePayload, unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* POST /auth/change-password/ — REAL GAP FIXED (2026-09-20): this endpoint
|
|
155
|
+
* is fully customer-reachable on the real backend (ChangePasswordView
|
|
156
|
+
* branches on identity_mode) but had zero SDK coverage at all until now —
|
|
157
|
+
* no storefront customer had any way to change their password once logged
|
|
158
|
+
* in (only the logged-out forgot/reset-password OTP flow existed).
|
|
159
|
+
*/
|
|
160
|
+
declare function useChangePassword(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
161
|
+
detail: string;
|
|
162
|
+
}, Error, ChangePasswordPayload, unknown>;
|
|
163
|
+
declare function useLogout(config?: SdkConfig, refreshToken?: string): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* REAL BUG FIXED (2026-09-22): raw fetch() with a generic `HTTP ${status}`
|
|
167
|
+
* error — this file predates apiRequest and was missed when every other
|
|
168
|
+
* REST call site in the SDK was migrated onto it (it lives in a hook file,
|
|
169
|
+
* not services/*.ts, which is how the original migration pass missed it).
|
|
170
|
+
*/
|
|
83
171
|
declare function getCountries(config: SdkConfig): Promise<Country[]>;
|
|
84
|
-
declare function useCountries(config?: SdkConfig):
|
|
172
|
+
declare function useCountries(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<Country[]>, Error>;
|
|
85
173
|
|
|
174
|
+
/** Raw fetch() -> apiRequest, same fix as use-countries.ts. */
|
|
86
175
|
declare function getStates(config: SdkConfig, countryIso: string): Promise<State[]>;
|
|
87
|
-
declare function useStates(countryIso: string, config?: SdkConfig):
|
|
176
|
+
declare function useStates(countryIso: string, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<State[]>, Error>;
|
|
88
177
|
|
|
89
178
|
declare function getSupportedLanguagesList(config: SdkConfig): Promise<SupportedLang[]>;
|
|
90
179
|
declare function useSupportedLanguages(config?: SdkConfig): UseQueryResult<SupportedLang[], Error>;
|
|
91
180
|
|
|
92
181
|
declare function getSupportedCurrenciesList(config: SdkConfig): Promise<Currency[]>;
|
|
93
|
-
declare function useCurrencies(config?: SdkConfig):
|
|
182
|
+
declare function useCurrencies(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<Currency[]>, Error>;
|
|
94
183
|
|
|
95
184
|
/**
|
|
96
185
|
* Get bespoke availability for a product
|
|
97
186
|
*/
|
|
98
|
-
declare function useBespokeAvailability(product_id: string, config?: SdkConfig):
|
|
187
|
+
declare function useBespokeAvailability(product_id: string, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<BespokeAvailability>, Error>;
|
|
188
|
+
/** Buyer approves a bespoke order's submitted deliverable. */
|
|
189
|
+
declare function useApproveBespokeDeliverable(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<BespokeDeliverableStatus, Error, string, unknown>;
|
|
190
|
+
/** Buyer requests a revision on a bespoke order's submitted deliverable. */
|
|
191
|
+
declare function useRequestBespokeRevision(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<BespokeDeliverableStatus, Error, {
|
|
192
|
+
orderId: string;
|
|
193
|
+
notes: string;
|
|
194
|
+
}, unknown>;
|
|
99
195
|
|
|
100
196
|
declare const collectionKeys: {
|
|
101
197
|
all: readonly ["core", "collections"];
|
|
@@ -104,72 +200,45 @@ declare const collectionKeys: {
|
|
|
104
200
|
};
|
|
105
201
|
/**
|
|
106
202
|
* Hook to fetch paginated collections for the storefront.
|
|
107
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
108
203
|
*/
|
|
109
|
-
declare function useStorefrontCollections(params?: ListParams):
|
|
204
|
+
declare function useStorefrontCollections(params?: ListParams, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Collection>>, Error>;
|
|
110
205
|
/**
|
|
111
206
|
* Hook to fetch a single collection by slug for the storefront.
|
|
112
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
113
207
|
*/
|
|
114
|
-
declare function useStorefrontCollection(slug: string):
|
|
208
|
+
declare function useStorefrontCollection(slug: string, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<Collection>, Error>;
|
|
115
209
|
|
|
116
210
|
declare const productKeys: {
|
|
117
211
|
all: readonly ["products"];
|
|
118
212
|
list: (params?: ListParams) => readonly ["products", "list", ListParams | undefined];
|
|
119
213
|
detail: (slug: string) => readonly ["products", "detail", string];
|
|
120
214
|
recommended: (params?: ListParams) => readonly ["products", "recommended", ListParams | undefined];
|
|
121
|
-
latest: (params?: ListParams) => readonly ["products", "latest", ListParams | undefined];
|
|
122
215
|
popular: (params?: ListParams) => readonly ["products", "popular", ListParams | undefined];
|
|
123
216
|
featured: (params?: ListParams) => readonly ["products", "featured", ListParams | undefined];
|
|
124
217
|
new: (params?: ListParams) => readonly ["products", "new", ListParams | undefined];
|
|
125
218
|
onSale: (params?: ListParams) => readonly ["products", "onSale", ListParams | undefined];
|
|
126
|
-
lowStock: (params?: ListParams) => readonly ["products", "lowStock", ListParams | undefined];
|
|
127
219
|
};
|
|
128
|
-
/**
|
|
129
|
-
* Hook for fetching latest products.
|
|
130
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
131
|
-
*/
|
|
132
|
-
declare function useLatestProducts(params?: ListParams): any;
|
|
133
220
|
/**
|
|
134
221
|
* Hook for fetching popular products.
|
|
135
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
136
222
|
*/
|
|
137
|
-
declare function usePopularProducts(params?: ListParams):
|
|
223
|
+
declare function usePopularProducts(params?: ListParams, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
138
224
|
/**
|
|
139
225
|
* Hook for fetching featured products.
|
|
140
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
141
226
|
*/
|
|
142
|
-
declare function useFeaturedProducts(params?: ListParams):
|
|
227
|
+
declare function useFeaturedProducts(params?: ListParams, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
143
228
|
/**
|
|
144
229
|
* Hook for fetching new products.
|
|
145
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
146
230
|
*/
|
|
147
|
-
declare function useNewProducts(params?: ListParams):
|
|
231
|
+
declare function useNewProducts(params?: ListParams, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
148
232
|
/**
|
|
149
233
|
* Hook for fetching products currently on sale.
|
|
150
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
151
234
|
*/
|
|
152
|
-
declare function useOnSaleProducts(params?: ListParams):
|
|
153
|
-
/**
|
|
154
|
-
* Hook for fetching products with low stock.
|
|
155
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
156
|
-
*/
|
|
157
|
-
declare function useLowStockProducts(params?: ListParams): any;
|
|
158
|
-
/**
|
|
159
|
-
* Hook for fetching all active storefront products.
|
|
160
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
161
|
-
*/
|
|
162
|
-
declare function useStorefrontProducts(params?: ListParams): any;
|
|
163
|
-
/**
|
|
164
|
-
* Hook for fetching a single product by slug.
|
|
165
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
166
|
-
*/
|
|
167
|
-
declare function useProduct(slug: string): any;
|
|
235
|
+
declare function useOnSaleProducts(params?: ListParams, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
168
236
|
/**
|
|
169
237
|
* Hook for fetching recommended products.
|
|
170
|
-
* Fetches from Next.js API route to avoid exposing backend URLs.
|
|
171
238
|
*/
|
|
172
|
-
declare function useRecommendedProducts(params?: ListParams
|
|
239
|
+
declare function useRecommendedProducts(params?: ListParams & {
|
|
240
|
+
excludeProductId?: string;
|
|
241
|
+
}, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<Product>>, Error>;
|
|
173
242
|
|
|
174
243
|
declare const wishlistKeys: {
|
|
175
244
|
all: readonly ["wishlist"];
|
|
@@ -182,83 +251,68 @@ declare function useWishlist(arg1?: SdkConfig | {
|
|
|
182
251
|
}, arg2?: string | null, arg3?: {
|
|
183
252
|
page?: number;
|
|
184
253
|
pageSize?: number;
|
|
185
|
-
}):
|
|
186
|
-
declare function useCheckInWishlist(arg1?: SdkConfig | string, arg2?: string | null, arg3?: string):
|
|
187
|
-
declare function useAddToWishlist(config?: SdkConfig, accessToken?: string | null):
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
declare function
|
|
192
|
-
declare function
|
|
193
|
-
declare function useAppointments(config?: SdkConfig, accessToken?: string | null): any;
|
|
194
|
-
declare function useAppointment(arg1?: SdkConfig | string, arg2?: string | null, arg3?: string): any;
|
|
195
|
-
declare function useCancelAppointment(config?: SdkConfig, accessToken?: string | null): any;
|
|
196
|
-
declare function useDeliverables(arg1?: SdkConfig | string, arg2?: string | null, arg3?: string): any;
|
|
197
|
-
declare function useApproveDeliverable(config?: SdkConfig, accessToken?: string | null, order_id?: string, deliverable_id?: string): any;
|
|
198
|
-
declare function useRequestRevision(config?: SdkConfig, accessToken?: string | null, order_id?: string, deliverable_id?: string): any;
|
|
254
|
+
}): _tanstack_react_query.UseQueryResult<NoInfer<WishlistListResponse>, Error>;
|
|
255
|
+
declare function useCheckInWishlist(arg1?: SdkConfig | string, arg2?: string | null, arg3?: string): _tanstack_react_query.UseQueryResult<NoInfer<WishlistCheckResponse>, Error>;
|
|
256
|
+
declare function useAddToWishlist(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<WishlistItem, Error, {
|
|
257
|
+
productId: string;
|
|
258
|
+
notes?: string;
|
|
259
|
+
}, unknown>;
|
|
260
|
+
declare function useRemoveFromWishlist(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
261
|
+
declare function useRemoveProductFromWishlist(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
199
262
|
|
|
200
|
-
declare function
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
263
|
+
declare function useAvailableSlots(config: SdkConfig | undefined, productId: string | undefined, date: string | undefined, params?: {
|
|
264
|
+
staffId?: string;
|
|
265
|
+
locationId?: string;
|
|
266
|
+
customerLatitude?: number;
|
|
267
|
+
customerLongitude?: number;
|
|
268
|
+
}): _tanstack_react_query.UseQueryResult<NoInfer<AvailableSlotsResponse>, Error>;
|
|
269
|
+
declare function useBookAppointment(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, ServiceAppointmentCreatePayload, unknown>;
|
|
270
|
+
declare function useAppointments(config?: SdkConfig, accessToken?: string | null, params?: {
|
|
271
|
+
status?: ServiceAppointment['status'];
|
|
272
|
+
page?: number;
|
|
273
|
+
page_size?: number;
|
|
274
|
+
}): _tanstack_react_query.UseQueryResult<NoInfer<ServiceBookingsPage>, Error>;
|
|
275
|
+
declare function useAppointment(config: SdkConfig | undefined, accessToken: string | null | undefined, id: string | undefined): _tanstack_react_query.UseQueryResult<NoInfer<ServiceAppointment>, Error>;
|
|
276
|
+
declare function useCancelAppointment(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, {
|
|
277
|
+
id: string;
|
|
278
|
+
payload?: CancelAppointmentPayload;
|
|
279
|
+
}, unknown>;
|
|
280
|
+
declare function useRescheduleAppointment(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, {
|
|
281
|
+
id: string;
|
|
282
|
+
payload: RescheduleAppointmentPayload;
|
|
283
|
+
}, unknown>;
|
|
284
|
+
declare function useDisputeAppointment(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, {
|
|
285
|
+
id: string;
|
|
286
|
+
payload: DisputeAppointmentPayload;
|
|
287
|
+
}, unknown>;
|
|
288
|
+
declare function useConfirmAppointmentCompletion(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceAppointment, Error, {
|
|
289
|
+
id: string;
|
|
290
|
+
payload?: ConfirmAppointmentPayload;
|
|
291
|
+
}, unknown>;
|
|
292
|
+
declare function useMilestones(config: SdkConfig | undefined, accessToken: string | null | undefined, bookingId: string | undefined): _tanstack_react_query.UseQueryResult<NoInfer<ServiceMilestone[]>, Error>;
|
|
293
|
+
declare function useApproveMilestone(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<ServiceMilestone, Error, {
|
|
294
|
+
bookingId: string;
|
|
295
|
+
milestoneId: string;
|
|
296
|
+
payload?: ApproveMilestonePayload;
|
|
297
|
+
}, unknown>;
|
|
206
298
|
|
|
207
|
-
interface
|
|
208
|
-
event: string;
|
|
209
|
-
data: {
|
|
210
|
-
consultation_id: string;
|
|
211
|
-
message_id: string;
|
|
212
|
-
sender_id: string;
|
|
213
|
-
sender_role: string;
|
|
214
|
-
message: string;
|
|
215
|
-
attachments?: Array<{
|
|
216
|
-
url: string;
|
|
217
|
-
type: string;
|
|
218
|
-
name: string;
|
|
219
|
-
}>;
|
|
220
|
-
created_at: string;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
interface ConsultationQuoteData {
|
|
224
|
-
event: string;
|
|
225
|
-
data: {
|
|
226
|
-
consultation_id: string;
|
|
227
|
-
quote_amount: number;
|
|
228
|
-
deposit_amount?: number;
|
|
229
|
-
merchant_notes?: string;
|
|
230
|
-
updated_at: string;
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
interface ConsultationStatusData {
|
|
299
|
+
interface PaymentSuccessData {
|
|
234
300
|
event: string;
|
|
235
301
|
data: {
|
|
236
|
-
|
|
302
|
+
transaction_id: string;
|
|
303
|
+
order_id: string;
|
|
304
|
+
amount: number;
|
|
305
|
+
currency: string;
|
|
237
306
|
status: string;
|
|
238
|
-
updated_at: string;
|
|
239
307
|
};
|
|
240
308
|
}
|
|
241
|
-
interface
|
|
242
|
-
config: SdkConfig;
|
|
243
|
-
consultationId: string;
|
|
244
|
-
onMessage?: (data: ConsultationMessageData) => void;
|
|
245
|
-
onQuote?: (data: ConsultationQuoteData) => void;
|
|
246
|
-
onStatusChange?: (data: ConsultationStatusData) => void;
|
|
247
|
-
onError?: (error: Error) => void;
|
|
248
|
-
}
|
|
249
|
-
declare function useConsultationStream({ config, consultationId, onMessage, onQuote, onStatusChange, onError, }: UseConsultationStreamOptions): {
|
|
250
|
-
isConnected: boolean;
|
|
251
|
-
lastEvent: any;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
interface PaymentSuccessData {
|
|
309
|
+
interface PaymentFailedData {
|
|
255
310
|
event: string;
|
|
256
311
|
data: {
|
|
257
312
|
transaction_id: string;
|
|
258
313
|
order_id: string;
|
|
259
|
-
amount: number;
|
|
260
|
-
currency: string;
|
|
261
314
|
status: string;
|
|
315
|
+
gateway: string;
|
|
262
316
|
};
|
|
263
317
|
}
|
|
264
318
|
interface DigitalReadyData {
|
|
@@ -289,17 +343,6 @@ interface BespokeUpdateData {
|
|
|
289
343
|
updated_at: string;
|
|
290
344
|
};
|
|
291
345
|
}
|
|
292
|
-
interface ConsultationUpdateData {
|
|
293
|
-
event: string;
|
|
294
|
-
data: {
|
|
295
|
-
consultation_id: string;
|
|
296
|
-
business_id: string;
|
|
297
|
-
customer_id: string;
|
|
298
|
-
status: string;
|
|
299
|
-
message?: string;
|
|
300
|
-
updated_at: string;
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
346
|
interface ServiceBookingUpdateData {
|
|
304
347
|
event: string;
|
|
305
348
|
data: {
|
|
@@ -316,13 +359,80 @@ interface UseOrderStreamOptions {
|
|
|
316
359
|
config?: SdkConfig;
|
|
317
360
|
orderId: string;
|
|
318
361
|
onPaymentComplete?: (data: PaymentSuccessData) => void;
|
|
362
|
+
/** Fires on a real "payment.failed" event from the order-scoped stream (kasuvia-payment-system-go's webhook services now publish this — see monnify_webhook_service.go/flutterwave_webhook_service.go). */
|
|
363
|
+
onPaymentFailed?: (data: PaymentFailedData) => void;
|
|
319
364
|
onDigitalReady?: (data: DigitalReadyData) => void;
|
|
320
365
|
onBespokeUpdate?: (data: BespokeUpdateData) => void;
|
|
321
|
-
onConsultationUpdate?: (data: ConsultationUpdateData) => void;
|
|
322
366
|
onServiceBookingUpdate?: (data: ServiceBookingUpdateData) => void;
|
|
323
367
|
onError?: (error: Error) => void;
|
|
324
368
|
}
|
|
325
|
-
declare function useOrderStream({ config: explicitConfig, orderId, onPaymentComplete, onDigitalReady, onBespokeUpdate,
|
|
369
|
+
declare function useOrderStream({ config: explicitConfig, orderId, onPaymentComplete, onPaymentFailed, onDigitalReady, onBespokeUpdate, onServiceBookingUpdate, onError }: UseOrderStreamOptions): null;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Hook to create a new review
|
|
373
|
+
*/
|
|
374
|
+
declare function useCreateReview(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Review, Error, ReviewCreate, unknown>;
|
|
375
|
+
/**
|
|
376
|
+
* Hook to update an existing review
|
|
377
|
+
*/
|
|
378
|
+
declare function useUpdateReview(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Review, Error, {
|
|
379
|
+
reviewId: string;
|
|
380
|
+
reviewData: ReviewUpdate;
|
|
381
|
+
}, unknown>;
|
|
382
|
+
/**
|
|
383
|
+
* Hook to get product reviews
|
|
384
|
+
*/
|
|
385
|
+
declare function useProductReviews(productId: string, params?: {
|
|
386
|
+
page?: number;
|
|
387
|
+
page_size?: number;
|
|
388
|
+
}, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<ProductReviewsResponse>, Error>;
|
|
389
|
+
/**
|
|
390
|
+
* Hook to create a new comment
|
|
391
|
+
*/
|
|
392
|
+
declare function useCreateComment(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Comment, Error, CommentCreate, unknown>;
|
|
393
|
+
/**
|
|
394
|
+
* Hook to update an existing comment
|
|
395
|
+
*/
|
|
396
|
+
declare function useUpdateComment(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Comment, Error, {
|
|
397
|
+
commentId: string;
|
|
398
|
+
commentData: CommentUpdate;
|
|
399
|
+
}, unknown>;
|
|
400
|
+
/**
|
|
401
|
+
* Hook to get product comments
|
|
402
|
+
*/
|
|
403
|
+
declare function useProductComments(productId: string, params?: {
|
|
404
|
+
page?: number;
|
|
405
|
+
page_size?: number;
|
|
406
|
+
}, config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<ProductCommentsResponse>, Error>;
|
|
407
|
+
/**
|
|
408
|
+
* Hook to get pending reviews (merchant/staff only)
|
|
409
|
+
*/
|
|
410
|
+
declare function usePendingReviews(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<Review[]>, Error>;
|
|
411
|
+
/**
|
|
412
|
+
* Hook to get pending comments (merchant/staff only)
|
|
413
|
+
*/
|
|
414
|
+
declare function usePendingComments(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<Comment[]>, Error>;
|
|
415
|
+
/**
|
|
416
|
+
* Hook to moderate a review (merchant/staff only)
|
|
417
|
+
*/
|
|
418
|
+
declare function useModerateReview(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Review, Error, {
|
|
419
|
+
reviewId: string;
|
|
420
|
+
action: ReviewModerationAction;
|
|
421
|
+
}, unknown>;
|
|
422
|
+
/**
|
|
423
|
+
* Hook to moderate a comment (merchant/staff only)
|
|
424
|
+
*/
|
|
425
|
+
declare function useModerateComment(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Comment, Error, {
|
|
426
|
+
commentId: string;
|
|
427
|
+
action: CommentModerationAction;
|
|
428
|
+
}, unknown>;
|
|
429
|
+
/**
|
|
430
|
+
* Hook to post a merchant reply to a review (merchant/staff only)
|
|
431
|
+
*/
|
|
432
|
+
declare function useMerchantReplyToReview(config?: SdkConfig): _tanstack_react_query.UseMutationResult<Review, Error, {
|
|
433
|
+
reviewId: string;
|
|
434
|
+
replyData: MerchantReplyCreate;
|
|
435
|
+
}, unknown>;
|
|
326
436
|
|
|
327
437
|
declare function useIsMounted(): boolean;
|
|
328
438
|
|
|
@@ -352,37 +462,63 @@ declare function useGoogleTranslate(configOrLang?: SdkConfig | string, appLang?:
|
|
|
352
462
|
isLoaded: boolean;
|
|
353
463
|
};
|
|
354
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Hook for fetching available payment methods for a region.
|
|
467
|
+
*
|
|
468
|
+
* `currency`/`countryCode` are optional with no SDK-level default — see
|
|
469
|
+
* getAvailablePaymentMethods' doc comment: the real backend already
|
|
470
|
+
* declares its own default for this route, so leaving them unset here
|
|
471
|
+
* lets that be the single source of truth instead of risking a second,
|
|
472
|
+
* independently-hardcoded copy drifting out of sync with it.
|
|
473
|
+
*/
|
|
474
|
+
declare function useAvailablePaymentMethods(config?: SdkConfig, currency?: string, countryCode?: string): _tanstack_react_query.UseQueryResult<NoInfer<GatewayMethods[]>, Error>;
|
|
475
|
+
/**
|
|
476
|
+
* Hook for fetching authenticated customer's wallet balance.
|
|
477
|
+
*/
|
|
478
|
+
declare function useWalletBalance(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseQueryResult<NoInfer<WalletBalanceResponse>, Error>;
|
|
479
|
+
/**
|
|
480
|
+
* Hook for fetching authenticated customer's wallet ledger history.
|
|
481
|
+
*/
|
|
482
|
+
declare function useWalletLedger(config?: SdkConfig, accessToken?: string | null, params?: {
|
|
483
|
+
page?: number;
|
|
484
|
+
page_size?: number;
|
|
485
|
+
}): _tanstack_react_query.UseQueryResult<NoInfer<WalletLedgerResponse>, Error>;
|
|
486
|
+
/**
|
|
487
|
+
* Hook for claiming pending guest wallet credit into customer's wallet.
|
|
488
|
+
*/
|
|
489
|
+
declare function useClaimWalletCredit(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<WalletBalanceResponse, Error, string, unknown>;
|
|
355
490
|
/**
|
|
356
491
|
* Hook for creating a Dedicated Virtual Account (DVA)
|
|
357
|
-
*
|
|
492
|
+
* Supports both authenticated users and guest checkout.
|
|
358
493
|
*/
|
|
359
|
-
declare function useCreateDVA(config?: SdkConfig, accessToken?: string | null):
|
|
494
|
+
declare function useCreateDVA(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<DVADetails, Error, DVACreateRequest, unknown>;
|
|
360
495
|
/**
|
|
361
|
-
* Hook for initiating card
|
|
362
|
-
*
|
|
496
|
+
* Hook for initiating payment (card, transfer, etc.)
|
|
497
|
+
* Supports both authenticated users and guest checkout.
|
|
363
498
|
*/
|
|
364
|
-
declare function useInitiatePayment(config?: SdkConfig, accessToken?: string | null):
|
|
499
|
+
declare function useInitiatePayment(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<PaymentInitiateResponse, Error, PaymentInitiateRequest, unknown>;
|
|
365
500
|
/**
|
|
366
501
|
* Hook for verifying a transaction
|
|
367
502
|
* Optional config — read from SdkContext if omitted.
|
|
368
503
|
*/
|
|
369
|
-
declare function useVerifyTransaction(config?: SdkConfig):
|
|
504
|
+
declare function useVerifyTransaction(config?: SdkConfig): _tanstack_react_query.UseMutationResult<TransactionVerifyResponse, Error, string, unknown>;
|
|
370
505
|
/**
|
|
371
506
|
* Hook for getting transaction status
|
|
372
507
|
* Optional config — read from SdkContext if omitted.
|
|
373
508
|
*/
|
|
374
|
-
declare function useTransactionStatus(arg1?: SdkConfig | string, arg2?: string | boolean, arg3?: boolean):
|
|
509
|
+
declare function useTransactionStatus(arg1?: SdkConfig | string, arg2?: string | boolean, arg3?: boolean): _tanstack_react_query.UseQueryResult<NoInfer<TransactionVerifyResponse>, Error>;
|
|
375
510
|
/**
|
|
376
511
|
* Hook for checking transaction status with automatic polling
|
|
377
512
|
* Optional config — read from SdkContext if omitted.
|
|
378
513
|
*/
|
|
379
|
-
declare function usePollTransactionStatus(arg1?: SdkConfig | string, arg2?: string | boolean, arg3?: boolean):
|
|
514
|
+
declare function usePollTransactionStatus(arg1?: SdkConfig | string, arg2?: string | boolean, arg3?: boolean): _tanstack_react_query.UseQueryResult<NoInfer<TransactionVerifyResponse>, Error>;
|
|
380
515
|
|
|
381
516
|
interface UseCmsEntriesReturn {
|
|
382
517
|
entries: CmsEntry[];
|
|
383
518
|
total: number;
|
|
384
519
|
page: number;
|
|
385
520
|
page_size: number;
|
|
521
|
+
total_pages: number;
|
|
386
522
|
isLoading: boolean;
|
|
387
523
|
error: Error | null;
|
|
388
524
|
refetch: () => void;
|
|
@@ -426,6 +562,100 @@ interface UseDeleteCmsEntryReturn {
|
|
|
426
562
|
}
|
|
427
563
|
declare function useDeleteCmsEntry(config?: SdkConfig, accessToken?: string | null, modelSlug?: string): UseDeleteCmsEntryReturn;
|
|
428
564
|
|
|
565
|
+
declare function useBusinessConfig(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<BusinessConfig>, Error>;
|
|
566
|
+
/**
|
|
567
|
+
* REAL GAP FIXED (2026-09-22): `formatPrice(amount, currency)` is stateless
|
|
568
|
+
* and requires the caller to already have the real business currency in
|
|
569
|
+
* hand — every consuming app was left to resolve that currency itself, and
|
|
570
|
+
* kasuvia-storefront's `AppProvider` ended up hand-rolling its own,
|
|
571
|
+
* slightly different copy of the same `Intl.NumberFormat` currency logic
|
|
572
|
+
* (silently falling back to a bare number instead of formatPrice's
|
|
573
|
+
* explicit "N/A" marker when currency is unresolved). This hook is the one
|
|
574
|
+
* real, complete answer: resolves the business's currency via
|
|
575
|
+
* `useBusinessConfig` and returns a ready-to-call formatter, so no
|
|
576
|
+
* consuming app ever needs to reimplement currency formatting again.
|
|
577
|
+
*/
|
|
578
|
+
declare function useFormatPrice(config?: SdkConfig): {
|
|
579
|
+
formatPrice: (amount: number | null | undefined) => string;
|
|
580
|
+
currency: string | null;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
declare function useNotificationPreferences(config?: SdkConfig, accessToken?: string): _tanstack_react_query.UseQueryResult<NoInfer<NotificationPreferences>, Error>;
|
|
584
|
+
declare function useUpdateNotificationPreferences(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<NotificationPreferences, Error, Partial<NotificationPreferences>, unknown>;
|
|
585
|
+
declare function useVapidPublicKey(config?: SdkConfig): _tanstack_react_query.UseQueryResult<NoInfer<VapidPublicKeyResponse>, Error>;
|
|
586
|
+
declare function useSubscribeToPush(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
587
|
+
status: string;
|
|
588
|
+
subscription_id: string;
|
|
589
|
+
vapid_key_version: number;
|
|
590
|
+
}, Error, SubscribeToPushParams, unknown>;
|
|
591
|
+
declare function useUnsubscribeFromPush(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
592
|
+
status: string;
|
|
593
|
+
}, Error, string, unknown>;
|
|
594
|
+
declare function useNotificationInbox(params?: {
|
|
595
|
+
page?: number;
|
|
596
|
+
limit?: number;
|
|
597
|
+
unread_only?: boolean;
|
|
598
|
+
}, config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseQueryResult<NoInfer<NotificationInboxResponse>, Error>;
|
|
599
|
+
declare function useMarkNotificationRead(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
600
|
+
status: string;
|
|
601
|
+
}, Error, string, unknown>;
|
|
602
|
+
declare function useMarkAllNotificationsRead(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
603
|
+
status: string;
|
|
604
|
+
}, Error, void, unknown>;
|
|
605
|
+
declare function useTrackNotificationClick(config?: SdkConfig, accessToken?: string | null): _tanstack_react_query.UseMutationResult<{
|
|
606
|
+
status: string;
|
|
607
|
+
}, Error, string, unknown>;
|
|
608
|
+
/**
|
|
609
|
+
* Submit contact form hook — sends contact email to merchant and confirmation to sender.
|
|
610
|
+
*/
|
|
611
|
+
declare function useSubmitContactForm(config?: SdkConfig): _tanstack_react_query.UseMutationResult<{
|
|
612
|
+
detail: string;
|
|
613
|
+
}, Error, ContactFormData, unknown>;
|
|
614
|
+
|
|
615
|
+
interface NotificationStreamMessage {
|
|
616
|
+
type: string;
|
|
617
|
+
title?: string;
|
|
618
|
+
body?: string;
|
|
619
|
+
data?: Record<string, unknown>;
|
|
620
|
+
timestamp?: string;
|
|
621
|
+
}
|
|
622
|
+
interface UseNotificationStreamOptions {
|
|
623
|
+
config?: SdkConfig;
|
|
624
|
+
accessToken?: string | null;
|
|
625
|
+
onNotification?: (message: NotificationStreamMessage) => void;
|
|
626
|
+
onError?: (error: Error) => void;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Live connection to the authenticated customer's real-time notification
|
|
630
|
+
* stream (kasuvia-notification-system-go's /notifications/sse — now
|
|
631
|
+
* Authorization-header-gated, see realtime.go's 2026-09-21 fix). Mirrors
|
|
632
|
+
* use-order-stream.ts's proven fetch-event-source pattern exactly.
|
|
633
|
+
*/
|
|
634
|
+
declare function useNotificationStream({ config: explicitConfig, accessToken: explicitToken, onNotification, onError, }: UseNotificationStreamOptions): void;
|
|
635
|
+
|
|
636
|
+
type PushPermissionState = 'unsupported' | 'default' | 'granted' | 'denied';
|
|
637
|
+
/**
|
|
638
|
+
* Orchestrates the full Web Push subscribe/unsubscribe flow: registers
|
|
639
|
+
* /sw.js (the storefront app's own service worker — see its doc comment),
|
|
640
|
+
* requests Notification permission, subscribes via PushManager with the
|
|
641
|
+
* real VAPID key from the backend, and POSTs the subscription to
|
|
642
|
+
* kasuvia-notification-system-go. Returns current state + trigger functions
|
|
643
|
+
* — no UI of its own, so any storefront can build its own "enable
|
|
644
|
+
* notifications" affordance around it.
|
|
645
|
+
*/
|
|
646
|
+
declare function usePushNotifications(config?: SdkConfig, accessToken?: string | null): {
|
|
647
|
+
permission: PushPermissionState;
|
|
648
|
+
isSubscribed: boolean;
|
|
649
|
+
isBusy: boolean;
|
|
650
|
+
subscribe: () => Promise<void>;
|
|
651
|
+
unsubscribe: () => Promise<void>;
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
declare function useUploadMediaFile(): _tanstack_react_query.UseMutationResult<MediaAsset, Error, UploadMediaFileParams, unknown>;
|
|
655
|
+
declare function useUploadMediaFiles(): _tanstack_react_query.UseMutationResult<UploadMediaFilesResult, Error, Omit<UploadMediaFileParams, "file"> & {
|
|
656
|
+
files: File[];
|
|
657
|
+
}, unknown>;
|
|
658
|
+
|
|
429
659
|
/**
|
|
430
660
|
* SdkContext
|
|
431
661
|
*
|
|
@@ -446,13 +676,16 @@ declare function useDeleteCmsEntry(config?: SdkConfig, accessToken?: string | nu
|
|
|
446
676
|
interface SdkContextValue {
|
|
447
677
|
config: SdkConfig;
|
|
448
678
|
accessToken: string | null;
|
|
679
|
+
/** Current browser's guest cart session id (see utils/guest-session.ts) — null when unauthenticated context hasn't resolved one yet, or when the caller is authenticated and doesn't need one. */
|
|
680
|
+
guestSessionId?: string | null;
|
|
449
681
|
}
|
|
450
682
|
interface SdkProviderProps {
|
|
451
683
|
config: SdkConfig;
|
|
452
684
|
accessToken: string | null;
|
|
685
|
+
guestSessionId?: string | null;
|
|
453
686
|
children: ReactNode;
|
|
454
687
|
}
|
|
455
|
-
declare function SdkProvider({ config, accessToken, children }: SdkProviderProps):
|
|
688
|
+
declare function SdkProvider({ config, accessToken, guestSessionId, children }: SdkProviderProps): React__default.JSX.Element;
|
|
456
689
|
/**
|
|
457
690
|
* Returns the SdkContext value, or null if no SdkProvider is present.
|
|
458
691
|
* SDK hooks use this internally to fall back to context when explicit
|
|
@@ -468,4 +701,4 @@ declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicit
|
|
|
468
701
|
accessToken: string | null;
|
|
469
702
|
};
|
|
470
703
|
|
|
471
|
-
export { type CartContextValue, CartCtx, CartProvider, type SdkContextValue, SdkProvider, type SdkProviderProps, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseOrderStreamOptions, type UseUpdateCmsEntryReturn, collectionKeys, getCountries, getStates, getSupportedCurrenciesList, getSupportedLanguagesList, productKeys, resolveHookArgs,
|
|
704
|
+
export { type CartContextValue, CartCtx, CartProvider, type ProductTypeMismatchDetail, type PushPermissionState, type SdkContextValue, SdkProvider, type SdkProviderProps, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseNotificationStreamOptions, type UseOrderStreamOptions, type UseUpdateCmsEntryReturn, collectionKeys, getCountries, getStates, getSupportedCurrenciesList, getSupportedLanguagesList, productKeys, resolveHookArgs, useAddToWishlist, useAppointment, useAppointments, useApproveBespokeDeliverable, useApproveMilestone, useAuthUser, useAvailablePaymentMethods, useAvailableSlots, useBespokeAvailability, useBookAppointment, useBusinessConfig, useCancelAppointment, useCancelOrder, useCart, useChangePassword, useCheckInWishlist, useClaimWalletCredit, useCmsEntries, useCmsEntry, useConfirmAppointmentCompletion, useCountries, useCreateBespokeOrder, useCreateCmsEntry, useCreateComment, useCreateConsultation, useCreateCustomerAddress, useCreateDVA, useCreateFeedback, useCreateOrder, useCreateReview, useCreateServiceBookingOrder, useCurrencies, useCustomerAddresses, useCustomerDeactivateAccount, useCustomerForgotPassword, useCustomerReactivateRequest, useCustomerReactivateVerify, useCustomerResetPassword, useDeleteCmsEntry, useDeleteCustomerAddress, useDisputeAppointment, useFeaturedProducts, useFindOrder, useFormatPrice, useGoogleTranslate, useInitiatePayment, useIsMobile, useIsMounted, useLogin, useLogout, useMarkAllNotificationsRead, useMarkNotificationRead, useMerchantReplyToReview, useMilestones, useModerateComment, useModerateReview, useMyFeedback, useNewProducts, useNotificationInbox, useNotificationPreferences, useNotificationStream, useOnSaleProducts, useOrder, useOrderStream, useOrderTracking, useOrders, useOrdersList, usePendingComments, usePendingReviews, usePollTransactionStatus, usePopularProducts, useProductComments, useProductReviews, usePushNotifications, useRecommendedProducts, useRegister, useRemoveFromWishlist, useRemoveProductFromWishlist, useRequestBespokeRevision, useRequestOtp, useRescheduleAppointment, useSdkContext, useStates, useStorefrontBusinessInfo, useStorefrontCollection, useStorefrontCollections, useSubmitContactForm, useSubscribeToPush, useSupportedLanguages, useTrackNotificationClick, useTransactionStatus, useUnsubscribeFromPush, useUpdateCmsEntry, useUpdateComment, useUpdateCustomerAddress, useUpdateNotificationPreferences, useUpdateProfile, useUpdateReview, useUploadMediaFile, useUploadMediaFiles, useVapidPublicKey, useVerifyOtp, useVerifyTransaction, useWalletBalance, useWalletLedger, useWishlist, wishlistKeys };
|