@01.software/sdk 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -54
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +1194 -5
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/client.js +1194 -5
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-BroIWHY1.d.ts → collection-client-CKFa99C6.d.ts} +16 -10
- package/dist/{collection-client-B0J9wMNE.d.cts → collection-client-VYwYi6u6.d.cts} +16 -10
- package/dist/const-4BUtUdGU.d.cts +32 -0
- package/dist/const-ymprfiPf.d.ts +32 -0
- package/dist/errors.cjs +4 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +4 -1
- package/dist/errors.js.map +1 -1
- package/dist/{index-BOLQxveo.d.cts → index-Dquv4xTL.d.cts} +3 -3
- package/dist/{index-CSwR2HSg.d.ts → index-w36lpSkU.d.ts} +3 -3
- package/dist/index.cjs +2796 -2651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +2796 -2651
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-m3jjhxk9.d.cts → payload-types-DC0xzR9i.d.cts} +470 -265
- package/dist/{payload-types-m3jjhxk9.d.ts → payload-types-DC0xzR9i.d.ts} +470 -265
- package/dist/query.cjs +241 -58
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +151 -26
- package/dist/query.d.ts +151 -26
- package/dist/query.js +241 -58
- package/dist/query.js.map +1 -1
- package/dist/realtime.cjs +5 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +5 -1
- package/dist/realtime.js.map +1 -1
- package/dist/server.cjs +1117 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +1117 -1
- package/dist/server.js.map +1 -1
- package/dist/storefront-cache.cjs +144 -0
- package/dist/storefront-cache.cjs.map +1 -0
- package/dist/storefront-cache.d.cts +24 -0
- package/dist/storefront-cache.d.ts +24 -0
- package/dist/storefront-cache.js +121 -0
- package/dist/storefront-cache.js.map +1 -0
- package/dist/{types-Cmrd1ezc.d.ts → types-Bh2p-EMc.d.ts} +5 -1
- package/dist/{types-D0ubzQw0.d.cts → types-BvpjooU-.d.cts} +5 -1
- package/dist/{types-D2xYdz4P.d.ts → types-D5uHrPLr.d.cts} +264 -96
- package/dist/{types-CIGscmus.d.cts → types-Umd-YTjM.d.ts} +264 -96
- package/dist/ui/canvas/server.cjs +5 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.js +5 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +5 -1
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.js +5 -1
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +4 -4
- package/dist/webhook.d.ts +4 -4
- package/package.json +13 -3
- package/dist/const-6XHz_jej.d.ts +0 -32
- package/dist/const-B5KT72c7.d.cts +0 -32
package/dist/query.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-D5uHrPLr.cjs';
|
|
4
|
+
import './payload-types-DC0xzR9i.cjs';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-VYwYi6u6.cjs';
|
|
6
|
+
import { S as ServerCollection, P as PublicCollection } from './const-4BUtUdGU.cjs';
|
|
7
|
+
import { C as CollectionType } from './types-BvpjooU-.cjs';
|
|
8
8
|
import { SDKError } from './errors.cjs';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
10
10
|
import './metadata.cjs';
|
|
@@ -17,18 +17,21 @@ declare function getQueryClient(): QueryClient;
|
|
|
17
17
|
*/
|
|
18
18
|
declare function getStorefrontQueryClient(): QueryClient;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type CollectionReadOptions<TCollection extends ServerCollection> = [
|
|
21
|
+
TCollection
|
|
22
|
+
] extends [PublicCollection] ? PublicReadQueryOptions : ApiQueryOptions;
|
|
23
|
+
interface CollectionQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
21
24
|
collection: T;
|
|
22
|
-
options?:
|
|
25
|
+
options?: Options;
|
|
23
26
|
}
|
|
24
|
-
interface CollectionDetailQueryParams<T extends ServerCollection> {
|
|
27
|
+
interface CollectionDetailQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
25
28
|
collection: T;
|
|
26
29
|
id: string;
|
|
27
|
-
options?:
|
|
30
|
+
options?: Options;
|
|
28
31
|
}
|
|
29
|
-
interface CollectionInfiniteQueryParams<T extends ServerCollection> {
|
|
32
|
+
interface CollectionInfiniteQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
30
33
|
collection: T;
|
|
31
|
-
options?: Omit<
|
|
34
|
+
options?: Omit<Options, 'page'>;
|
|
32
35
|
pageSize?: number;
|
|
33
36
|
}
|
|
34
37
|
interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {
|
|
@@ -65,19 +68,19 @@ declare class CollectionHooks<TCollection extends ServerCollection = PublicColle
|
|
|
65
68
|
protected queryClient: QueryClient;
|
|
66
69
|
protected collectionClient: CollectionClient<TCollection>;
|
|
67
70
|
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>);
|
|
68
|
-
useQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T
|
|
69
|
-
useSuspenseQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T
|
|
70
|
-
useQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T
|
|
71
|
-
useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T
|
|
72
|
-
useInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T
|
|
73
|
-
useSuspenseInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T
|
|
74
|
-
prefetchQuery<T extends TCollection>(params: CollectionQueryParams<T
|
|
71
|
+
useQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseQueryResult<TData>;
|
|
72
|
+
useSuspenseQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseSuspenseQueryResult<TData>;
|
|
73
|
+
useQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: QueryOptions<CollectionType<T>, TData>): UseQueryResult<TData>;
|
|
74
|
+
useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): UseSuspenseQueryResult<TData>;
|
|
75
|
+
useInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseInfiniteQueryResult<TData>;
|
|
76
|
+
useSuspenseInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseSuspenseInfiniteQueryResult<TData>;
|
|
77
|
+
prefetchQuery<T extends TCollection>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
75
78
|
staleTime?: number;
|
|
76
79
|
}): Promise<void>;
|
|
77
|
-
prefetchQueryById<T extends TCollection>(params: CollectionDetailQueryParams<T
|
|
80
|
+
prefetchQueryById<T extends TCollection>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
78
81
|
staleTime?: number;
|
|
79
82
|
}): Promise<void>;
|
|
80
|
-
prefetchInfiniteQuery<T extends TCollection>(params: CollectionInfiniteQueryParams<T
|
|
83
|
+
prefetchInfiniteQuery<T extends TCollection>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
81
84
|
pages?: number;
|
|
82
85
|
staleTime?: number;
|
|
83
86
|
}): Promise<void>;
|
|
@@ -148,7 +151,18 @@ declare class CustomerHooks {
|
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
type ProductListingGroupsQueryOptions = Pick<ApiQueryOptions, 'page' | 'limit' | 'sort' | 'where'>;
|
|
151
|
-
type ReadOnlyQueryHooks = Omit<QueryHooks<PublicCollection>, 'useCreate' | 'useUpdate' | 'useRemove'
|
|
154
|
+
type ReadOnlyQueryHooks = Omit<QueryHooks<PublicCollection>, 'useCreate' | 'useUpdate' | 'useRemove' | 'useProductListingGroupsQuery' | 'useSuspenseProductListingGroupsQuery' | 'useInfiniteProductListingGroupsQuery' | 'useSuspenseInfiniteProductListingGroupsQuery' | 'prefetchProductListingGroupsQuery' | 'prefetchInfiniteProductListingGroupsQuery' | 'useProductListingPage' | 'useSuspenseProductListingPage' | 'useInfiniteProductListingPage' | 'prefetchProductListingPage' | 'prefetchInfiniteProductListingPage'> & {
|
|
155
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseQueryResult<TData>;
|
|
156
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
157
|
+
useInfiniteProductListingPage<TData = InfiniteData<ProductListingPageResult<ProductListingGroupsCatalogItem>>>(params?: ProductListingPageCatalogInfiniteParams, options?: InfiniteQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseInfiniteQueryResult<TData>;
|
|
158
|
+
prefetchProductListingPage(params?: ProductListingPageCatalogParams, options?: {
|
|
159
|
+
staleTime?: number;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
prefetchInfiniteProductListingPage(params?: ProductListingPageCatalogInfiniteParams, options?: {
|
|
162
|
+
pages?: number;
|
|
163
|
+
staleTime?: number;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
};
|
|
152
166
|
/**
|
|
153
167
|
* Composes CollectionHooks + CustomerHooks into a single API surface.
|
|
154
168
|
* All methods are delegated; no logic lives here.
|
|
@@ -158,10 +172,79 @@ interface ProductDetailCallable {
|
|
|
158
172
|
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
159
173
|
};
|
|
160
174
|
}
|
|
175
|
+
interface ProductListingPageCatalogCallable {
|
|
176
|
+
product: {
|
|
177
|
+
listingPage: {
|
|
178
|
+
(params?: ProductListingPageCatalogParams): Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface ProductListingPageCallable extends ProductListingPageCatalogCallable {
|
|
183
|
+
product: ProductListingPageCatalogCallable['product'] & {
|
|
184
|
+
listingPage: ProductListingPageCatalogCallable['product']['listingPage'] & {
|
|
185
|
+
(params: ProductListingPageFullParams): Promise<ProductListingPageResult<ProductListingGroupsItem>>;
|
|
186
|
+
(params: ProductListingPageParams): Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
type ProductCommerceCallable = ProductDetailCallable & ProductListingPageCallable;
|
|
191
|
+
type ProductListingPageInfiniteParams = Omit<ProductListingPageBaseParams, 'page' | 'limit'> & {
|
|
192
|
+
mode?: ProductListingPageParams['mode'];
|
|
193
|
+
pageSize?: number;
|
|
194
|
+
};
|
|
195
|
+
type ProductListingPageCatalogInfiniteParams = Omit<ProductListingPageInfiniteParams, 'mode'> & {
|
|
196
|
+
mode?: 'catalog';
|
|
197
|
+
};
|
|
198
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogParams): {
|
|
199
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
200
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
201
|
+
};
|
|
202
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCallable, params: ProductListingPageFullParams): {
|
|
203
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
204
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsItem>>;
|
|
205
|
+
};
|
|
206
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCallable, params: ProductListingPageParams): {
|
|
207
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
208
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
209
|
+
};
|
|
210
|
+
declare function productListingPageInfiniteQueryOptions(commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogInfiniteParams): {
|
|
211
|
+
queryKey: ReturnType<typeof productKeys.listingPageInfinite>;
|
|
212
|
+
queryFn: (args: {
|
|
213
|
+
pageParam: number;
|
|
214
|
+
}) => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
215
|
+
initialPageParam: number;
|
|
216
|
+
getNextPageParam: (lastPage: ProductListingPageResult<ProductListingGroupsCatalogItem>) => number | null | undefined;
|
|
217
|
+
};
|
|
218
|
+
declare function productListingPageInfiniteQueryOptions(commerceClient: ProductListingPageCallable, params?: ProductListingPageInfiniteParams): {
|
|
219
|
+
queryKey: ReturnType<typeof productKeys.listingPageInfinite>;
|
|
220
|
+
queryFn: (args: {
|
|
221
|
+
pageParam: number;
|
|
222
|
+
}) => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
223
|
+
initialPageParam: number;
|
|
224
|
+
getNextPageParam: (lastPage: ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>) => number | null | undefined;
|
|
225
|
+
};
|
|
226
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogParams, options?: {
|
|
227
|
+
staleTime?: number;
|
|
228
|
+
}): Promise<void>;
|
|
229
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params: ProductListingPageFullParams, options?: {
|
|
230
|
+
staleTime?: number;
|
|
231
|
+
}): Promise<void>;
|
|
232
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params: ProductListingPageParams, options?: {
|
|
233
|
+
staleTime?: number;
|
|
234
|
+
}): Promise<void>;
|
|
235
|
+
declare function prefetchInfiniteProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogInfiniteParams, options?: {
|
|
236
|
+
pages?: number;
|
|
237
|
+
staleTime?: number;
|
|
238
|
+
}): Promise<void>;
|
|
239
|
+
declare function prefetchInfiniteProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params?: ProductListingPageInfiniteParams, options?: {
|
|
240
|
+
pages?: number;
|
|
241
|
+
staleTime?: number;
|
|
242
|
+
}): Promise<void>;
|
|
161
243
|
declare class QueryHooks<TCollection extends ServerCollection = PublicCollection> extends CollectionHooks<TCollection> {
|
|
162
244
|
private _customer;
|
|
163
245
|
private _commerce?;
|
|
164
|
-
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>, customerAuth?: CustomerAuth, commerceClient?:
|
|
246
|
+
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>, customerAuth?: CustomerAuth, commerceClient?: ProductCommerceCallable);
|
|
247
|
+
private ensureCommerce;
|
|
165
248
|
useCustomerMe: CustomerHooks['useCustomerMe'];
|
|
166
249
|
useCustomerLogin: CustomerHooks['useCustomerLogin'];
|
|
167
250
|
useCustomerRegister: CustomerHooks['useCustomerRegister'];
|
|
@@ -226,6 +309,26 @@ declare class QueryHooks<TCollection extends ServerCollection = PublicCollection
|
|
|
226
309
|
pages?: number;
|
|
227
310
|
staleTime?: number;
|
|
228
311
|
}): Promise<void>;
|
|
312
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseQueryResult<TData>;
|
|
313
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageFullParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsItem>, TData>): UseQueryResult<TData>;
|
|
314
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>, TData>): UseQueryResult<TData>;
|
|
315
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
316
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageFullParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
317
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
318
|
+
useInfiniteProductListingPage<TData = InfiniteData<ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>>>(params?: ProductListingPageInfiniteParams, options?: InfiniteQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>, TData>): UseInfiniteQueryResult<TData>;
|
|
319
|
+
prefetchProductListingPage(params?: ProductListingPageCatalogParams, options?: {
|
|
320
|
+
staleTime?: number;
|
|
321
|
+
}): Promise<void>;
|
|
322
|
+
prefetchProductListingPage(params: ProductListingPageFullParams, options?: {
|
|
323
|
+
staleTime?: number;
|
|
324
|
+
}): Promise<void>;
|
|
325
|
+
prefetchProductListingPage(params: ProductListingPageParams, options?: {
|
|
326
|
+
staleTime?: number;
|
|
327
|
+
}): Promise<void>;
|
|
328
|
+
prefetchInfiniteProductListingPage(params?: ProductListingPageInfiniteParams, options?: {
|
|
329
|
+
pages?: number;
|
|
330
|
+
staleTime?: number;
|
|
331
|
+
}): Promise<void>;
|
|
229
332
|
useProductDetail(params: {
|
|
230
333
|
slug: string;
|
|
231
334
|
} | {
|
|
@@ -235,6 +338,18 @@ declare class QueryHooks<TCollection extends ServerCollection = PublicCollection
|
|
|
235
338
|
useProductDetailById(id: string, options?: QueryOptions<ProductDetailResult>): UseQueryResult<ProductDetailResult>;
|
|
236
339
|
}
|
|
237
340
|
|
|
341
|
+
type ProductListingPageKeyParams = {
|
|
342
|
+
mode: 'catalog' | 'full';
|
|
343
|
+
page?: number;
|
|
344
|
+
limit?: number;
|
|
345
|
+
search?: string;
|
|
346
|
+
sort?: ProductListingPageParams['sort'];
|
|
347
|
+
filters?: NonNullable<ProductListingPageParams['filters']>;
|
|
348
|
+
basePath?: string;
|
|
349
|
+
trailingSlash?: boolean;
|
|
350
|
+
emit?: ProductListingPageParams['emit'];
|
|
351
|
+
preferCompleteVariantFromHint?: ProductListingPageParams['preferCompleteVariantFromHint'];
|
|
352
|
+
};
|
|
238
353
|
declare function collectionKeys<T extends ServerCollection>(collection: T): {
|
|
239
354
|
all: readonly [T];
|
|
240
355
|
lists: () => readonly [T, "list"];
|
|
@@ -242,7 +357,7 @@ declare function collectionKeys<T extends ServerCollection>(collection: T): {
|
|
|
242
357
|
details: () => readonly [T, "detail"];
|
|
243
358
|
detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
|
|
244
359
|
infinites: () => readonly [T, "infinite"];
|
|
245
|
-
infinite: (options?: Omit<ApiQueryOptions, "page"
|
|
360
|
+
infinite: (options?: Omit<ApiQueryOptions, "page">, pageSize?: number) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
246
361
|
};
|
|
247
362
|
declare const customerKeys: {
|
|
248
363
|
all: readonly ["customer"];
|
|
@@ -251,8 +366,18 @@ declare const customerKeys: {
|
|
|
251
366
|
declare const productKeys: {
|
|
252
367
|
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
253
368
|
listingGroupsCatalog: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "catalog", ProductListingGroupsQueryOptions | undefined];
|
|
254
|
-
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit"
|
|
255
|
-
|
|
369
|
+
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "page" | "limit"> | {
|
|
370
|
+
limit: number;
|
|
371
|
+
sort?: Sort;
|
|
372
|
+
where?: Where;
|
|
373
|
+
} | undefined];
|
|
374
|
+
listingGroupsCatalogInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-groups", "catalog", "infinite", Omit<ProductListingGroupsQueryOptions, "page" | "limit"> | {
|
|
375
|
+
limit: number;
|
|
376
|
+
sort?: Sort;
|
|
377
|
+
where?: Where;
|
|
378
|
+
} | undefined];
|
|
379
|
+
listingPage: (params?: ProductListingPageParams) => readonly ["products", "listing-page", ProductListingPageKeyParams];
|
|
380
|
+
listingPageInfinite: (params?: Omit<ProductListingPageParams, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-page", "infinite", ProductListingPageKeyParams];
|
|
256
381
|
detail: (params: {
|
|
257
382
|
slug: string;
|
|
258
383
|
} | {
|
|
@@ -268,4 +393,4 @@ declare const productKeys: {
|
|
|
268
393
|
declare function createQueryHooks(client: RootClient, queryClient?: QueryClient): ReadOnlyQueryHooks;
|
|
269
394
|
declare function createServerQueryHooks(client: RootServerClient, queryClient?: QueryClient): QueryHooks<ServerCollection>;
|
|
270
395
|
|
|
271
|
-
export { type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, type CollectionQueryParams, CustomerHooks, type InfiniteQueryOptions, type ProductListingGroupsQueryOptions, QueryHooks, type QueryOptions, type ReadOnlyQueryHooks, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, collectionKeys, createQueryHooks, createServerQueryHooks, customerKeys, getQueryClient, getStorefrontQueryClient, productKeys };
|
|
396
|
+
export { type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, type CollectionQueryParams, CustomerHooks, type InfiniteQueryOptions, type ProductListingGroupsQueryOptions, type ProductListingPageCatalogInfiniteParams, type ProductListingPageInfiniteParams, QueryHooks, type QueryOptions, type ReadOnlyQueryHooks, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, collectionKeys, createQueryHooks, createServerQueryHooks, customerKeys, getQueryClient, getStorefrontQueryClient, prefetchInfiniteProductListingPage, prefetchProductListingPage, productKeys, productListingPageInfiniteQueryOptions, productListingPageQueryOptions };
|
package/dist/query.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-Umd-YTjM.js';
|
|
4
|
+
import './payload-types-DC0xzR9i.js';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-CKFa99C6.js';
|
|
6
|
+
import { S as ServerCollection, P as PublicCollection } from './const-ymprfiPf.js';
|
|
7
|
+
import { C as CollectionType } from './types-Bh2p-EMc.js';
|
|
8
8
|
import { SDKError } from './errors.js';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
10
10
|
import './metadata.js';
|
|
@@ -17,18 +17,21 @@ declare function getQueryClient(): QueryClient;
|
|
|
17
17
|
*/
|
|
18
18
|
declare function getStorefrontQueryClient(): QueryClient;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type CollectionReadOptions<TCollection extends ServerCollection> = [
|
|
21
|
+
TCollection
|
|
22
|
+
] extends [PublicCollection] ? PublicReadQueryOptions : ApiQueryOptions;
|
|
23
|
+
interface CollectionQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
21
24
|
collection: T;
|
|
22
|
-
options?:
|
|
25
|
+
options?: Options;
|
|
23
26
|
}
|
|
24
|
-
interface CollectionDetailQueryParams<T extends ServerCollection> {
|
|
27
|
+
interface CollectionDetailQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
25
28
|
collection: T;
|
|
26
29
|
id: string;
|
|
27
|
-
options?:
|
|
30
|
+
options?: Options;
|
|
28
31
|
}
|
|
29
|
-
interface CollectionInfiniteQueryParams<T extends ServerCollection> {
|
|
32
|
+
interface CollectionInfiniteQueryParams<T extends ServerCollection, Options extends ApiQueryOptions = ApiQueryOptions> {
|
|
30
33
|
collection: T;
|
|
31
|
-
options?: Omit<
|
|
34
|
+
options?: Omit<Options, 'page'>;
|
|
32
35
|
pageSize?: number;
|
|
33
36
|
}
|
|
34
37
|
interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {
|
|
@@ -65,19 +68,19 @@ declare class CollectionHooks<TCollection extends ServerCollection = PublicColle
|
|
|
65
68
|
protected queryClient: QueryClient;
|
|
66
69
|
protected collectionClient: CollectionClient<TCollection>;
|
|
67
70
|
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>);
|
|
68
|
-
useQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T
|
|
69
|
-
useSuspenseQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T
|
|
70
|
-
useQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T
|
|
71
|
-
useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T
|
|
72
|
-
useInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T
|
|
73
|
-
useSuspenseInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T
|
|
74
|
-
prefetchQuery<T extends TCollection>(params: CollectionQueryParams<T
|
|
71
|
+
useQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseQueryResult<TData>;
|
|
72
|
+
useSuspenseQuery<T extends TCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseSuspenseQueryResult<TData>;
|
|
73
|
+
useQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: QueryOptions<CollectionType<T>, TData>): UseQueryResult<TData>;
|
|
74
|
+
useSuspenseQueryById<T extends TCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): UseSuspenseQueryResult<TData>;
|
|
75
|
+
useInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseInfiniteQueryResult<TData>;
|
|
76
|
+
useSuspenseInfiniteQuery<T extends TCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): UseSuspenseInfiniteQueryResult<TData>;
|
|
77
|
+
prefetchQuery<T extends TCollection>(params: CollectionQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
75
78
|
staleTime?: number;
|
|
76
79
|
}): Promise<void>;
|
|
77
|
-
prefetchQueryById<T extends TCollection>(params: CollectionDetailQueryParams<T
|
|
80
|
+
prefetchQueryById<T extends TCollection>(params: CollectionDetailQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
78
81
|
staleTime?: number;
|
|
79
82
|
}): Promise<void>;
|
|
80
|
-
prefetchInfiniteQuery<T extends TCollection>(params: CollectionInfiniteQueryParams<T
|
|
83
|
+
prefetchInfiniteQuery<T extends TCollection>(params: CollectionInfiniteQueryParams<T, CollectionReadOptions<TCollection>>, options?: {
|
|
81
84
|
pages?: number;
|
|
82
85
|
staleTime?: number;
|
|
83
86
|
}): Promise<void>;
|
|
@@ -148,7 +151,18 @@ declare class CustomerHooks {
|
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
type ProductListingGroupsQueryOptions = Pick<ApiQueryOptions, 'page' | 'limit' | 'sort' | 'where'>;
|
|
151
|
-
type ReadOnlyQueryHooks = Omit<QueryHooks<PublicCollection>, 'useCreate' | 'useUpdate' | 'useRemove'
|
|
154
|
+
type ReadOnlyQueryHooks = Omit<QueryHooks<PublicCollection>, 'useCreate' | 'useUpdate' | 'useRemove' | 'useProductListingGroupsQuery' | 'useSuspenseProductListingGroupsQuery' | 'useInfiniteProductListingGroupsQuery' | 'useSuspenseInfiniteProductListingGroupsQuery' | 'prefetchProductListingGroupsQuery' | 'prefetchInfiniteProductListingGroupsQuery' | 'useProductListingPage' | 'useSuspenseProductListingPage' | 'useInfiniteProductListingPage' | 'prefetchProductListingPage' | 'prefetchInfiniteProductListingPage'> & {
|
|
155
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseQueryResult<TData>;
|
|
156
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
157
|
+
useInfiniteProductListingPage<TData = InfiniteData<ProductListingPageResult<ProductListingGroupsCatalogItem>>>(params?: ProductListingPageCatalogInfiniteParams, options?: InfiniteQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseInfiniteQueryResult<TData>;
|
|
158
|
+
prefetchProductListingPage(params?: ProductListingPageCatalogParams, options?: {
|
|
159
|
+
staleTime?: number;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
prefetchInfiniteProductListingPage(params?: ProductListingPageCatalogInfiniteParams, options?: {
|
|
162
|
+
pages?: number;
|
|
163
|
+
staleTime?: number;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
};
|
|
152
166
|
/**
|
|
153
167
|
* Composes CollectionHooks + CustomerHooks into a single API surface.
|
|
154
168
|
* All methods are delegated; no logic lives here.
|
|
@@ -158,10 +172,79 @@ interface ProductDetailCallable {
|
|
|
158
172
|
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
159
173
|
};
|
|
160
174
|
}
|
|
175
|
+
interface ProductListingPageCatalogCallable {
|
|
176
|
+
product: {
|
|
177
|
+
listingPage: {
|
|
178
|
+
(params?: ProductListingPageCatalogParams): Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface ProductListingPageCallable extends ProductListingPageCatalogCallable {
|
|
183
|
+
product: ProductListingPageCatalogCallable['product'] & {
|
|
184
|
+
listingPage: ProductListingPageCatalogCallable['product']['listingPage'] & {
|
|
185
|
+
(params: ProductListingPageFullParams): Promise<ProductListingPageResult<ProductListingGroupsItem>>;
|
|
186
|
+
(params: ProductListingPageParams): Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
type ProductCommerceCallable = ProductDetailCallable & ProductListingPageCallable;
|
|
191
|
+
type ProductListingPageInfiniteParams = Omit<ProductListingPageBaseParams, 'page' | 'limit'> & {
|
|
192
|
+
mode?: ProductListingPageParams['mode'];
|
|
193
|
+
pageSize?: number;
|
|
194
|
+
};
|
|
195
|
+
type ProductListingPageCatalogInfiniteParams = Omit<ProductListingPageInfiniteParams, 'mode'> & {
|
|
196
|
+
mode?: 'catalog';
|
|
197
|
+
};
|
|
198
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogParams): {
|
|
199
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
200
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
201
|
+
};
|
|
202
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCallable, params: ProductListingPageFullParams): {
|
|
203
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
204
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsItem>>;
|
|
205
|
+
};
|
|
206
|
+
declare function productListingPageQueryOptions(commerceClient: ProductListingPageCallable, params: ProductListingPageParams): {
|
|
207
|
+
queryKey: ReturnType<typeof productKeys.listingPage>;
|
|
208
|
+
queryFn: () => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
209
|
+
};
|
|
210
|
+
declare function productListingPageInfiniteQueryOptions(commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogInfiniteParams): {
|
|
211
|
+
queryKey: ReturnType<typeof productKeys.listingPageInfinite>;
|
|
212
|
+
queryFn: (args: {
|
|
213
|
+
pageParam: number;
|
|
214
|
+
}) => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem>>;
|
|
215
|
+
initialPageParam: number;
|
|
216
|
+
getNextPageParam: (lastPage: ProductListingPageResult<ProductListingGroupsCatalogItem>) => number | null | undefined;
|
|
217
|
+
};
|
|
218
|
+
declare function productListingPageInfiniteQueryOptions(commerceClient: ProductListingPageCallable, params?: ProductListingPageInfiniteParams): {
|
|
219
|
+
queryKey: ReturnType<typeof productKeys.listingPageInfinite>;
|
|
220
|
+
queryFn: (args: {
|
|
221
|
+
pageParam: number;
|
|
222
|
+
}) => Promise<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>;
|
|
223
|
+
initialPageParam: number;
|
|
224
|
+
getNextPageParam: (lastPage: ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>) => number | null | undefined;
|
|
225
|
+
};
|
|
226
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogParams, options?: {
|
|
227
|
+
staleTime?: number;
|
|
228
|
+
}): Promise<void>;
|
|
229
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params: ProductListingPageFullParams, options?: {
|
|
230
|
+
staleTime?: number;
|
|
231
|
+
}): Promise<void>;
|
|
232
|
+
declare function prefetchProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params: ProductListingPageParams, options?: {
|
|
233
|
+
staleTime?: number;
|
|
234
|
+
}): Promise<void>;
|
|
235
|
+
declare function prefetchInfiniteProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCatalogCallable, params?: ProductListingPageCatalogInfiniteParams, options?: {
|
|
236
|
+
pages?: number;
|
|
237
|
+
staleTime?: number;
|
|
238
|
+
}): Promise<void>;
|
|
239
|
+
declare function prefetchInfiniteProductListingPage(queryClient: QueryClient, commerceClient: ProductListingPageCallable, params?: ProductListingPageInfiniteParams, options?: {
|
|
240
|
+
pages?: number;
|
|
241
|
+
staleTime?: number;
|
|
242
|
+
}): Promise<void>;
|
|
161
243
|
declare class QueryHooks<TCollection extends ServerCollection = PublicCollection> extends CollectionHooks<TCollection> {
|
|
162
244
|
private _customer;
|
|
163
245
|
private _commerce?;
|
|
164
|
-
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>, customerAuth?: CustomerAuth, commerceClient?:
|
|
246
|
+
constructor(queryClient: QueryClient, collectionClient: CollectionClient<TCollection>, customerAuth?: CustomerAuth, commerceClient?: ProductCommerceCallable);
|
|
247
|
+
private ensureCommerce;
|
|
165
248
|
useCustomerMe: CustomerHooks['useCustomerMe'];
|
|
166
249
|
useCustomerLogin: CustomerHooks['useCustomerLogin'];
|
|
167
250
|
useCustomerRegister: CustomerHooks['useCustomerRegister'];
|
|
@@ -226,6 +309,26 @@ declare class QueryHooks<TCollection extends ServerCollection = PublicCollection
|
|
|
226
309
|
pages?: number;
|
|
227
310
|
staleTime?: number;
|
|
228
311
|
}): Promise<void>;
|
|
312
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseQueryResult<TData>;
|
|
313
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageFullParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsItem>, TData>): UseQueryResult<TData>;
|
|
314
|
+
useProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageParams, options?: QueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>, TData>): UseQueryResult<TData>;
|
|
315
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem>>(params?: ProductListingPageCatalogParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
316
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageFullParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
317
|
+
useSuspenseProductListingPage<TData = ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>>(params: ProductListingPageParams, options?: SuspenseQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem> | ProductListingPageResult<ProductListingGroupsItem>, TData>): UseSuspenseQueryResult<TData>;
|
|
318
|
+
useInfiniteProductListingPage<TData = InfiniteData<ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>>>(params?: ProductListingPageInfiniteParams, options?: InfiniteQueryOptions<ProductListingPageResult<ProductListingGroupsCatalogItem | ProductListingGroupsItem>, TData>): UseInfiniteQueryResult<TData>;
|
|
319
|
+
prefetchProductListingPage(params?: ProductListingPageCatalogParams, options?: {
|
|
320
|
+
staleTime?: number;
|
|
321
|
+
}): Promise<void>;
|
|
322
|
+
prefetchProductListingPage(params: ProductListingPageFullParams, options?: {
|
|
323
|
+
staleTime?: number;
|
|
324
|
+
}): Promise<void>;
|
|
325
|
+
prefetchProductListingPage(params: ProductListingPageParams, options?: {
|
|
326
|
+
staleTime?: number;
|
|
327
|
+
}): Promise<void>;
|
|
328
|
+
prefetchInfiniteProductListingPage(params?: ProductListingPageInfiniteParams, options?: {
|
|
329
|
+
pages?: number;
|
|
330
|
+
staleTime?: number;
|
|
331
|
+
}): Promise<void>;
|
|
229
332
|
useProductDetail(params: {
|
|
230
333
|
slug: string;
|
|
231
334
|
} | {
|
|
@@ -235,6 +338,18 @@ declare class QueryHooks<TCollection extends ServerCollection = PublicCollection
|
|
|
235
338
|
useProductDetailById(id: string, options?: QueryOptions<ProductDetailResult>): UseQueryResult<ProductDetailResult>;
|
|
236
339
|
}
|
|
237
340
|
|
|
341
|
+
type ProductListingPageKeyParams = {
|
|
342
|
+
mode: 'catalog' | 'full';
|
|
343
|
+
page?: number;
|
|
344
|
+
limit?: number;
|
|
345
|
+
search?: string;
|
|
346
|
+
sort?: ProductListingPageParams['sort'];
|
|
347
|
+
filters?: NonNullable<ProductListingPageParams['filters']>;
|
|
348
|
+
basePath?: string;
|
|
349
|
+
trailingSlash?: boolean;
|
|
350
|
+
emit?: ProductListingPageParams['emit'];
|
|
351
|
+
preferCompleteVariantFromHint?: ProductListingPageParams['preferCompleteVariantFromHint'];
|
|
352
|
+
};
|
|
238
353
|
declare function collectionKeys<T extends ServerCollection>(collection: T): {
|
|
239
354
|
all: readonly [T];
|
|
240
355
|
lists: () => readonly [T, "list"];
|
|
@@ -242,7 +357,7 @@ declare function collectionKeys<T extends ServerCollection>(collection: T): {
|
|
|
242
357
|
details: () => readonly [T, "detail"];
|
|
243
358
|
detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
|
|
244
359
|
infinites: () => readonly [T, "infinite"];
|
|
245
|
-
infinite: (options?: Omit<ApiQueryOptions, "page"
|
|
360
|
+
infinite: (options?: Omit<ApiQueryOptions, "page">, pageSize?: number) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
246
361
|
};
|
|
247
362
|
declare const customerKeys: {
|
|
248
363
|
all: readonly ["customer"];
|
|
@@ -251,8 +366,18 @@ declare const customerKeys: {
|
|
|
251
366
|
declare const productKeys: {
|
|
252
367
|
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
253
368
|
listingGroupsCatalog: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "catalog", ProductListingGroupsQueryOptions | undefined];
|
|
254
|
-
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit"
|
|
255
|
-
|
|
369
|
+
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "page" | "limit"> | {
|
|
370
|
+
limit: number;
|
|
371
|
+
sort?: Sort;
|
|
372
|
+
where?: Where;
|
|
373
|
+
} | undefined];
|
|
374
|
+
listingGroupsCatalogInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-groups", "catalog", "infinite", Omit<ProductListingGroupsQueryOptions, "page" | "limit"> | {
|
|
375
|
+
limit: number;
|
|
376
|
+
sort?: Sort;
|
|
377
|
+
where?: Where;
|
|
378
|
+
} | undefined];
|
|
379
|
+
listingPage: (params?: ProductListingPageParams) => readonly ["products", "listing-page", ProductListingPageKeyParams];
|
|
380
|
+
listingPageInfinite: (params?: Omit<ProductListingPageParams, "page" | "limit">, pageSize?: number) => readonly ["products", "listing-page", "infinite", ProductListingPageKeyParams];
|
|
256
381
|
detail: (params: {
|
|
257
382
|
slug: string;
|
|
258
383
|
} | {
|
|
@@ -268,4 +393,4 @@ declare const productKeys: {
|
|
|
268
393
|
declare function createQueryHooks(client: RootClient, queryClient?: QueryClient): ReadOnlyQueryHooks;
|
|
269
394
|
declare function createServerQueryHooks(client: RootServerClient, queryClient?: QueryClient): QueryHooks<ServerCollection>;
|
|
270
395
|
|
|
271
|
-
export { type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, type CollectionQueryParams, CustomerHooks, type InfiniteQueryOptions, type ProductListingGroupsQueryOptions, QueryHooks, type QueryOptions, type ReadOnlyQueryHooks, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, collectionKeys, createQueryHooks, createServerQueryHooks, customerKeys, getQueryClient, getStorefrontQueryClient, productKeys };
|
|
396
|
+
export { type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, type CollectionQueryParams, CustomerHooks, type InfiniteQueryOptions, type ProductListingGroupsQueryOptions, type ProductListingPageCatalogInfiniteParams, type ProductListingPageInfiniteParams, QueryHooks, type QueryOptions, type ReadOnlyQueryHooks, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, collectionKeys, createQueryHooks, createServerQueryHooks, customerKeys, getQueryClient, getStorefrontQueryClient, prefetchInfiniteProductListingPage, prefetchProductListingPage, productKeys, productListingPageInfiniteQueryOptions, productListingPageQueryOptions };
|