@01.software/sdk 0.10.1 → 0.12.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 +1 -1
- package/dist/{const-Cv2Wikcq.d.ts → const-CWbOFesW.d.ts} +2 -2
- package/dist/{const-RfHA7d5C.d.cts → const-DBZBjsZH.d.cts} +2 -2
- package/dist/index.cjs +362 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +161 -7
- package/dist/index.d.ts +161 -7
- package/dist/index.js +367 -2
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-Bz2HCi4m.d.cts → payload-types-BX9al1wy.d.cts} +22 -88
- package/dist/{payload-types-Bz2HCi4m.d.ts → payload-types-BX9al1wy.d.ts} +22 -88
- 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.map +1 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs.map +1 -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-DRFCvRt5.d.cts → webhook-Bqek9sBP.d.cts} +2 -2
- package/dist/{webhook-DmO6DslJ.d.ts → webhook-I-iZO5-K.d.ts} +2 -2
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-
|
|
1
|
+
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-BX9al1wy.cjs';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-BX9al1wy.cjs';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export { a as COLLECTIONS, C as Collection } from './const-
|
|
9
|
-
import { C as CollectionType } from './webhook-
|
|
10
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection } from './const-DBZBjsZH.cjs';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-DBZBjsZH.cjs';
|
|
9
|
+
import { C as CollectionType } from './webhook-Bqek9sBP.cjs';
|
|
10
|
+
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Bqek9sBP.cjs';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
|
|
@@ -309,6 +309,111 @@ declare class CartApi {
|
|
|
309
309
|
}>;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
type EntityID = string;
|
|
313
|
+
type RelationshipValue = string | number | null | undefined | {
|
|
314
|
+
id?: string | number | null;
|
|
315
|
+
};
|
|
316
|
+
type MediaValue = {
|
|
317
|
+
id?: EntityID | null;
|
|
318
|
+
} | EntityID | null | undefined;
|
|
319
|
+
interface ProductOptionValueShape {
|
|
320
|
+
id?: string | number | null;
|
|
321
|
+
option?: RelationshipValue;
|
|
322
|
+
value?: string | null;
|
|
323
|
+
slug?: string | null;
|
|
324
|
+
_order?: string | null;
|
|
325
|
+
'_product-option-values_values_order'?: string | null;
|
|
326
|
+
}
|
|
327
|
+
interface ProductOptionShape {
|
|
328
|
+
id?: string | number | null;
|
|
329
|
+
title?: string | null;
|
|
330
|
+
_order?: string | null;
|
|
331
|
+
'_product-options_options_order'?: string | null;
|
|
332
|
+
values?: {
|
|
333
|
+
docs?: unknown[];
|
|
334
|
+
} | null;
|
|
335
|
+
}
|
|
336
|
+
interface ProductVariantShape {
|
|
337
|
+
id?: string | number | null;
|
|
338
|
+
optionValues?: unknown[] | null;
|
|
339
|
+
price?: number | null;
|
|
340
|
+
compareAtPrice?: number | null;
|
|
341
|
+
stock?: number | null;
|
|
342
|
+
isUnlimited?: boolean | null;
|
|
343
|
+
isActive?: boolean | null;
|
|
344
|
+
thumbnail?: MediaValue;
|
|
345
|
+
images?: MediaValue[] | null;
|
|
346
|
+
_order?: string | null;
|
|
347
|
+
}
|
|
348
|
+
interface ProductListingProductShape {
|
|
349
|
+
id?: EntityID;
|
|
350
|
+
thumbnail?: MediaValue;
|
|
351
|
+
images?: MediaValue[] | null;
|
|
352
|
+
}
|
|
353
|
+
type ProductOptionMatrixValue = {
|
|
354
|
+
id: string;
|
|
355
|
+
optionId: string;
|
|
356
|
+
label: string;
|
|
357
|
+
slug: string | null;
|
|
358
|
+
order: string;
|
|
359
|
+
};
|
|
360
|
+
type ProductOptionMatrixOption = {
|
|
361
|
+
id: string;
|
|
362
|
+
title: string;
|
|
363
|
+
order: string;
|
|
364
|
+
values: ProductOptionMatrixValue[];
|
|
365
|
+
};
|
|
366
|
+
type ProductOptionMatrixVariant<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
367
|
+
id: string;
|
|
368
|
+
optionValueIds: string[];
|
|
369
|
+
optionValueByOptionId: Map<string, string>;
|
|
370
|
+
source: TVariant;
|
|
371
|
+
};
|
|
372
|
+
type ProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
373
|
+
options: ProductOptionMatrixOption[];
|
|
374
|
+
optionIds: string[];
|
|
375
|
+
optionById: Map<string, ProductOptionMatrixOption>;
|
|
376
|
+
valueById: Map<string, ProductOptionMatrixValue>;
|
|
377
|
+
valueToOptionId: Map<string, string>;
|
|
378
|
+
variants: ProductOptionMatrixVariant<TVariant>[];
|
|
379
|
+
};
|
|
380
|
+
type ProductListingProjection = {
|
|
381
|
+
selectionHintVariant: EntityID | null;
|
|
382
|
+
primaryImage: EntityID | null;
|
|
383
|
+
minPrice: number | null;
|
|
384
|
+
maxPrice: number | null;
|
|
385
|
+
minCompareAtPrice: number | null;
|
|
386
|
+
maxCompareAtPrice: number | null;
|
|
387
|
+
isPriceRange: boolean;
|
|
388
|
+
availableForSale: boolean;
|
|
389
|
+
};
|
|
390
|
+
type ProductListingGroup<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
391
|
+
optionId: EntityID;
|
|
392
|
+
optionTitle: string;
|
|
393
|
+
optionValueId: EntityID;
|
|
394
|
+
optionValueLabel: string;
|
|
395
|
+
optionValueSlug: string | null;
|
|
396
|
+
variantIds: EntityID[];
|
|
397
|
+
variantCount: number;
|
|
398
|
+
variants: TVariant[];
|
|
399
|
+
listing: ProductListingProjection;
|
|
400
|
+
};
|
|
401
|
+
declare function buildProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape>({ options, variants, }: {
|
|
402
|
+
options: ProductOptionShape[];
|
|
403
|
+
variants?: TVariant[];
|
|
404
|
+
}): ProductOptionMatrix<TVariant>;
|
|
405
|
+
declare function getSelectedValueByOptionId<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): Map<string, string>;
|
|
406
|
+
declare function normalizeSelectedValueIds<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): string[];
|
|
407
|
+
declare function getAvailableOptionValues<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, optionId: string, selectedValueIds: Iterable<unknown>): ProductOptionMatrixValue[];
|
|
408
|
+
declare function resolveVariantForSelection<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): ProductOptionMatrixVariant<TVariant> | undefined;
|
|
409
|
+
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
410
|
+
declare function buildProductListingGroupsByOption<TVariant extends ProductVariantShape = ProductVariantShape>(args: {
|
|
411
|
+
product: ProductListingProductShape | null | undefined;
|
|
412
|
+
options: ProductOptionShape[];
|
|
413
|
+
variants: TVariant[];
|
|
414
|
+
primaryOptionId?: string | null;
|
|
415
|
+
}): ProductListingGroup<TVariant>[];
|
|
416
|
+
|
|
312
417
|
type ProductApiOptions = ServerApiOptions;
|
|
313
418
|
type StockCheckParams = {
|
|
314
419
|
items: Array<{
|
|
@@ -327,9 +432,22 @@ type StockCheckResponse = {
|
|
|
327
432
|
results: StockCheckResult[];
|
|
328
433
|
allAvailable: boolean;
|
|
329
434
|
};
|
|
435
|
+
type ListingGroupsParams = {
|
|
436
|
+
productIds: string[];
|
|
437
|
+
};
|
|
438
|
+
type ProductListingGroupSummary = Omit<ProductListingGroup, 'variants'>;
|
|
439
|
+
type ProductListingGroupsItem = {
|
|
440
|
+
product: Product;
|
|
441
|
+
primaryOptionId: string | null;
|
|
442
|
+
groups: ProductListingGroupSummary[];
|
|
443
|
+
};
|
|
444
|
+
type ProductListingGroupsResponse = {
|
|
445
|
+
docs: ProductListingGroupsItem[];
|
|
446
|
+
};
|
|
330
447
|
declare class ProductApi extends BaseApi {
|
|
331
448
|
constructor(options: ProductApiOptions);
|
|
332
449
|
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
450
|
+
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
333
451
|
}
|
|
334
452
|
|
|
335
453
|
interface GenerateMetadataOptions {
|
|
@@ -380,6 +498,11 @@ declare class CollectionClient extends HttpClient {
|
|
|
380
498
|
* GET /api/{collection}
|
|
381
499
|
*/
|
|
382
500
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
501
|
+
/**
|
|
502
|
+
* Find-like response from a custom endpoint
|
|
503
|
+
* POST /api/...custom-endpoint
|
|
504
|
+
*/
|
|
505
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
383
506
|
/**
|
|
384
507
|
* Find document by ID
|
|
385
508
|
* GET /api/{collection}/{id}
|
|
@@ -1064,7 +1187,12 @@ declare const customerKeys: {
|
|
|
1064
1187
|
all: readonly ["customer"];
|
|
1065
1188
|
me: () => readonly ["customer", "me"];
|
|
1066
1189
|
};
|
|
1190
|
+
declare const productKeys: {
|
|
1191
|
+
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
1192
|
+
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "limit" | "page"> | undefined];
|
|
1193
|
+
};
|
|
1067
1194
|
|
|
1195
|
+
type ProductListingGroupsQueryOptions = Pick<ApiQueryOptions, 'page' | 'limit' | 'sort' | 'where'>;
|
|
1068
1196
|
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1069
1197
|
/**
|
|
1070
1198
|
* Composes CollectionHooks + CustomerHooks into a single API surface.
|
|
@@ -1086,6 +1214,32 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1086
1214
|
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1087
1215
|
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1088
1216
|
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1217
|
+
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1218
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1219
|
+
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1220
|
+
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1221
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1222
|
+
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1223
|
+
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1224
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1225
|
+
pageSize?: number;
|
|
1226
|
+
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1227
|
+
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1228
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1229
|
+
pageSize?: number;
|
|
1230
|
+
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1231
|
+
prefetchProductListingGroupsQuery(params: {
|
|
1232
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1233
|
+
}, options?: {
|
|
1234
|
+
staleTime?: number;
|
|
1235
|
+
}): Promise<void>;
|
|
1236
|
+
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1237
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1238
|
+
pageSize?: number;
|
|
1239
|
+
}, options?: {
|
|
1240
|
+
pages?: number;
|
|
1241
|
+
staleTime?: number;
|
|
1242
|
+
}): Promise<void>;
|
|
1089
1243
|
}
|
|
1090
1244
|
|
|
1091
1245
|
declare class Client {
|
|
@@ -1150,4 +1304,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1150
1304
|
*/
|
|
1151
1305
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1152
1306
|
|
|
1153
|
-
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|
|
1307
|
+
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, type ListingGroupsParams, NetworkError, Order, OrderApi, type OrderApiOptions, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, type ProductListingGroup, type ProductListingGroupSummary, type ProductListingGroupsItem, type ProductListingGroupsQueryOptions, type ProductListingGroupsResponse, type ProductListingProductShape, type ProductListingProjection, type ProductOptionMatrix, type ProductOptionMatrixOption, type ProductOptionMatrixValue, type ProductOptionMatrixVariant, type ProductOptionShape, type ProductOptionValueShape, type ProductVariantShape, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, buildProductListingGroupsByOption, buildProductListingProjection, buildProductOptionMatrix, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getAvailableOptionValues, getQueryClient, getSelectedValueByOptionId, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, normalizeSelectedValueIds, productKeys, resolveApiUrl, resolveRelation, resolveVariantForSelection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-
|
|
1
|
+
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-BX9al1wy.js';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-BX9al1wy.js';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export { a as COLLECTIONS, C as Collection } from './const-
|
|
9
|
-
import { C as CollectionType } from './webhook-
|
|
10
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection } from './const-CWbOFesW.js';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-CWbOFesW.js';
|
|
9
|
+
import { C as CollectionType } from './webhook-I-iZO5-K.js';
|
|
10
|
+
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-I-iZO5-K.js';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
|
|
@@ -309,6 +309,111 @@ declare class CartApi {
|
|
|
309
309
|
}>;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
type EntityID = string;
|
|
313
|
+
type RelationshipValue = string | number | null | undefined | {
|
|
314
|
+
id?: string | number | null;
|
|
315
|
+
};
|
|
316
|
+
type MediaValue = {
|
|
317
|
+
id?: EntityID | null;
|
|
318
|
+
} | EntityID | null | undefined;
|
|
319
|
+
interface ProductOptionValueShape {
|
|
320
|
+
id?: string | number | null;
|
|
321
|
+
option?: RelationshipValue;
|
|
322
|
+
value?: string | null;
|
|
323
|
+
slug?: string | null;
|
|
324
|
+
_order?: string | null;
|
|
325
|
+
'_product-option-values_values_order'?: string | null;
|
|
326
|
+
}
|
|
327
|
+
interface ProductOptionShape {
|
|
328
|
+
id?: string | number | null;
|
|
329
|
+
title?: string | null;
|
|
330
|
+
_order?: string | null;
|
|
331
|
+
'_product-options_options_order'?: string | null;
|
|
332
|
+
values?: {
|
|
333
|
+
docs?: unknown[];
|
|
334
|
+
} | null;
|
|
335
|
+
}
|
|
336
|
+
interface ProductVariantShape {
|
|
337
|
+
id?: string | number | null;
|
|
338
|
+
optionValues?: unknown[] | null;
|
|
339
|
+
price?: number | null;
|
|
340
|
+
compareAtPrice?: number | null;
|
|
341
|
+
stock?: number | null;
|
|
342
|
+
isUnlimited?: boolean | null;
|
|
343
|
+
isActive?: boolean | null;
|
|
344
|
+
thumbnail?: MediaValue;
|
|
345
|
+
images?: MediaValue[] | null;
|
|
346
|
+
_order?: string | null;
|
|
347
|
+
}
|
|
348
|
+
interface ProductListingProductShape {
|
|
349
|
+
id?: EntityID;
|
|
350
|
+
thumbnail?: MediaValue;
|
|
351
|
+
images?: MediaValue[] | null;
|
|
352
|
+
}
|
|
353
|
+
type ProductOptionMatrixValue = {
|
|
354
|
+
id: string;
|
|
355
|
+
optionId: string;
|
|
356
|
+
label: string;
|
|
357
|
+
slug: string | null;
|
|
358
|
+
order: string;
|
|
359
|
+
};
|
|
360
|
+
type ProductOptionMatrixOption = {
|
|
361
|
+
id: string;
|
|
362
|
+
title: string;
|
|
363
|
+
order: string;
|
|
364
|
+
values: ProductOptionMatrixValue[];
|
|
365
|
+
};
|
|
366
|
+
type ProductOptionMatrixVariant<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
367
|
+
id: string;
|
|
368
|
+
optionValueIds: string[];
|
|
369
|
+
optionValueByOptionId: Map<string, string>;
|
|
370
|
+
source: TVariant;
|
|
371
|
+
};
|
|
372
|
+
type ProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
373
|
+
options: ProductOptionMatrixOption[];
|
|
374
|
+
optionIds: string[];
|
|
375
|
+
optionById: Map<string, ProductOptionMatrixOption>;
|
|
376
|
+
valueById: Map<string, ProductOptionMatrixValue>;
|
|
377
|
+
valueToOptionId: Map<string, string>;
|
|
378
|
+
variants: ProductOptionMatrixVariant<TVariant>[];
|
|
379
|
+
};
|
|
380
|
+
type ProductListingProjection = {
|
|
381
|
+
selectionHintVariant: EntityID | null;
|
|
382
|
+
primaryImage: EntityID | null;
|
|
383
|
+
minPrice: number | null;
|
|
384
|
+
maxPrice: number | null;
|
|
385
|
+
minCompareAtPrice: number | null;
|
|
386
|
+
maxCompareAtPrice: number | null;
|
|
387
|
+
isPriceRange: boolean;
|
|
388
|
+
availableForSale: boolean;
|
|
389
|
+
};
|
|
390
|
+
type ProductListingGroup<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
391
|
+
optionId: EntityID;
|
|
392
|
+
optionTitle: string;
|
|
393
|
+
optionValueId: EntityID;
|
|
394
|
+
optionValueLabel: string;
|
|
395
|
+
optionValueSlug: string | null;
|
|
396
|
+
variantIds: EntityID[];
|
|
397
|
+
variantCount: number;
|
|
398
|
+
variants: TVariant[];
|
|
399
|
+
listing: ProductListingProjection;
|
|
400
|
+
};
|
|
401
|
+
declare function buildProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape>({ options, variants, }: {
|
|
402
|
+
options: ProductOptionShape[];
|
|
403
|
+
variants?: TVariant[];
|
|
404
|
+
}): ProductOptionMatrix<TVariant>;
|
|
405
|
+
declare function getSelectedValueByOptionId<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): Map<string, string>;
|
|
406
|
+
declare function normalizeSelectedValueIds<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): string[];
|
|
407
|
+
declare function getAvailableOptionValues<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, optionId: string, selectedValueIds: Iterable<unknown>): ProductOptionMatrixValue[];
|
|
408
|
+
declare function resolveVariantForSelection<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): ProductOptionMatrixVariant<TVariant> | undefined;
|
|
409
|
+
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
410
|
+
declare function buildProductListingGroupsByOption<TVariant extends ProductVariantShape = ProductVariantShape>(args: {
|
|
411
|
+
product: ProductListingProductShape | null | undefined;
|
|
412
|
+
options: ProductOptionShape[];
|
|
413
|
+
variants: TVariant[];
|
|
414
|
+
primaryOptionId?: string | null;
|
|
415
|
+
}): ProductListingGroup<TVariant>[];
|
|
416
|
+
|
|
312
417
|
type ProductApiOptions = ServerApiOptions;
|
|
313
418
|
type StockCheckParams = {
|
|
314
419
|
items: Array<{
|
|
@@ -327,9 +432,22 @@ type StockCheckResponse = {
|
|
|
327
432
|
results: StockCheckResult[];
|
|
328
433
|
allAvailable: boolean;
|
|
329
434
|
};
|
|
435
|
+
type ListingGroupsParams = {
|
|
436
|
+
productIds: string[];
|
|
437
|
+
};
|
|
438
|
+
type ProductListingGroupSummary = Omit<ProductListingGroup, 'variants'>;
|
|
439
|
+
type ProductListingGroupsItem = {
|
|
440
|
+
product: Product;
|
|
441
|
+
primaryOptionId: string | null;
|
|
442
|
+
groups: ProductListingGroupSummary[];
|
|
443
|
+
};
|
|
444
|
+
type ProductListingGroupsResponse = {
|
|
445
|
+
docs: ProductListingGroupsItem[];
|
|
446
|
+
};
|
|
330
447
|
declare class ProductApi extends BaseApi {
|
|
331
448
|
constructor(options: ProductApiOptions);
|
|
332
449
|
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
450
|
+
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
333
451
|
}
|
|
334
452
|
|
|
335
453
|
interface GenerateMetadataOptions {
|
|
@@ -380,6 +498,11 @@ declare class CollectionClient extends HttpClient {
|
|
|
380
498
|
* GET /api/{collection}
|
|
381
499
|
*/
|
|
382
500
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
501
|
+
/**
|
|
502
|
+
* Find-like response from a custom endpoint
|
|
503
|
+
* POST /api/...custom-endpoint
|
|
504
|
+
*/
|
|
505
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
383
506
|
/**
|
|
384
507
|
* Find document by ID
|
|
385
508
|
* GET /api/{collection}/{id}
|
|
@@ -1064,7 +1187,12 @@ declare const customerKeys: {
|
|
|
1064
1187
|
all: readonly ["customer"];
|
|
1065
1188
|
me: () => readonly ["customer", "me"];
|
|
1066
1189
|
};
|
|
1190
|
+
declare const productKeys: {
|
|
1191
|
+
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
1192
|
+
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "limit" | "page"> | undefined];
|
|
1193
|
+
};
|
|
1067
1194
|
|
|
1195
|
+
type ProductListingGroupsQueryOptions = Pick<ApiQueryOptions, 'page' | 'limit' | 'sort' | 'where'>;
|
|
1068
1196
|
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1069
1197
|
/**
|
|
1070
1198
|
* Composes CollectionHooks + CustomerHooks into a single API surface.
|
|
@@ -1086,6 +1214,32 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1086
1214
|
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1087
1215
|
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1088
1216
|
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1217
|
+
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1218
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1219
|
+
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1220
|
+
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1221
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1222
|
+
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1223
|
+
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1224
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1225
|
+
pageSize?: number;
|
|
1226
|
+
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1227
|
+
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1228
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1229
|
+
pageSize?: number;
|
|
1230
|
+
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1231
|
+
prefetchProductListingGroupsQuery(params: {
|
|
1232
|
+
options?: ProductListingGroupsQueryOptions;
|
|
1233
|
+
}, options?: {
|
|
1234
|
+
staleTime?: number;
|
|
1235
|
+
}): Promise<void>;
|
|
1236
|
+
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1237
|
+
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1238
|
+
pageSize?: number;
|
|
1239
|
+
}, options?: {
|
|
1240
|
+
pages?: number;
|
|
1241
|
+
staleTime?: number;
|
|
1242
|
+
}): Promise<void>;
|
|
1089
1243
|
}
|
|
1090
1244
|
|
|
1091
1245
|
declare class Client {
|
|
@@ -1150,4 +1304,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1150
1304
|
*/
|
|
1151
1305
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1152
1306
|
|
|
1153
|
-
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|
|
1307
|
+
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, type ListingGroupsParams, NetworkError, Order, OrderApi, type OrderApiOptions, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, type ProductListingGroup, type ProductListingGroupSummary, type ProductListingGroupsItem, type ProductListingGroupsQueryOptions, type ProductListingGroupsResponse, type ProductListingProductShape, type ProductListingProjection, type ProductOptionMatrix, type ProductOptionMatrixOption, type ProductOptionMatrixValue, type ProductOptionMatrixVariant, type ProductOptionShape, type ProductOptionValueShape, type ProductVariantShape, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, buildProductListingGroupsByOption, buildProductListingProjection, buildProductOptionMatrix, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getAvailableOptionValues, getQueryClient, getSelectedValueByOptionId, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, normalizeSelectedValueIds, productKeys, resolveApiUrl, resolveRelation, resolveVariantForSelection };
|