@01.software/sdk 0.10.0 → 0.11.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-Dmgge6oQ.d.ts → const-CWbOFesW.d.ts} +2 -2
- package/dist/{const-k0fqIBda.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 +165 -7
- package/dist/index.d.ts +165 -7
- package/dist/index.js +367 -2
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-D0zFPijW.d.cts → payload-types-BX9al1wy.d.cts} +45 -88
- package/dist/{payload-types-D0zFPijW.d.ts → payload-types-BX9al1wy.d.ts} +45 -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-DXr8B9E6.d.cts → webhook-Bqek9sBP.d.cts} +2 -2
- package/dist/{webhook-caDRhnd7.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,27 @@ 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: {
|
|
441
|
+
id: string;
|
|
442
|
+
title?: string | null;
|
|
443
|
+
slug?: string | null;
|
|
444
|
+
handle?: string | null;
|
|
445
|
+
};
|
|
446
|
+
primaryOptionId: string | null;
|
|
447
|
+
groups: ProductListingGroupSummary[];
|
|
448
|
+
};
|
|
449
|
+
type ProductListingGroupsResponse = {
|
|
450
|
+
docs: ProductListingGroupsItem[];
|
|
451
|
+
};
|
|
330
452
|
declare class ProductApi extends BaseApi {
|
|
331
453
|
constructor(options: ProductApiOptions);
|
|
332
454
|
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
455
|
+
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
333
456
|
}
|
|
334
457
|
|
|
335
458
|
interface GenerateMetadataOptions {
|
|
@@ -380,6 +503,11 @@ declare class CollectionClient extends HttpClient {
|
|
|
380
503
|
* GET /api/{collection}
|
|
381
504
|
*/
|
|
382
505
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
506
|
+
/**
|
|
507
|
+
* Find-like response from a custom endpoint
|
|
508
|
+
* POST /api/...custom-endpoint
|
|
509
|
+
*/
|
|
510
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
383
511
|
/**
|
|
384
512
|
* Find document by ID
|
|
385
513
|
* GET /api/{collection}/{id}
|
|
@@ -1064,6 +1192,10 @@ declare const customerKeys: {
|
|
|
1064
1192
|
all: readonly ["customer"];
|
|
1065
1193
|
me: () => readonly ["customer", "me"];
|
|
1066
1194
|
};
|
|
1195
|
+
declare const productKeys: {
|
|
1196
|
+
listingGroups: (options?: ApiQueryOptions) => readonly ["products", "listing-groups", "list", ApiQueryOptions | undefined];
|
|
1197
|
+
listingGroupsInfinite: (options?: Omit<ApiQueryOptions, "page">) => readonly ["products", "listing-groups", "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
1198
|
+
};
|
|
1067
1199
|
|
|
1068
1200
|
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1069
1201
|
/**
|
|
@@ -1086,6 +1218,32 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1086
1218
|
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1087
1219
|
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1088
1220
|
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1221
|
+
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1222
|
+
options?: ApiQueryOptions;
|
|
1223
|
+
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1224
|
+
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1225
|
+
options?: ApiQueryOptions;
|
|
1226
|
+
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1227
|
+
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1228
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1229
|
+
pageSize?: number;
|
|
1230
|
+
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1231
|
+
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1232
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1233
|
+
pageSize?: number;
|
|
1234
|
+
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1235
|
+
prefetchProductListingGroupsQuery(params: {
|
|
1236
|
+
options?: ApiQueryOptions;
|
|
1237
|
+
}, options?: {
|
|
1238
|
+
staleTime?: number;
|
|
1239
|
+
}): Promise<void>;
|
|
1240
|
+
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1241
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1242
|
+
pageSize?: number;
|
|
1243
|
+
}, options?: {
|
|
1244
|
+
pages?: number;
|
|
1245
|
+
staleTime?: number;
|
|
1246
|
+
}): Promise<void>;
|
|
1089
1247
|
}
|
|
1090
1248
|
|
|
1091
1249
|
declare class Client {
|
|
@@ -1150,4 +1308,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1150
1308
|
*/
|
|
1151
1309
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1152
1310
|
|
|
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 };
|
|
1311
|
+
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 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,27 @@ 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: {
|
|
441
|
+
id: string;
|
|
442
|
+
title?: string | null;
|
|
443
|
+
slug?: string | null;
|
|
444
|
+
handle?: string | null;
|
|
445
|
+
};
|
|
446
|
+
primaryOptionId: string | null;
|
|
447
|
+
groups: ProductListingGroupSummary[];
|
|
448
|
+
};
|
|
449
|
+
type ProductListingGroupsResponse = {
|
|
450
|
+
docs: ProductListingGroupsItem[];
|
|
451
|
+
};
|
|
330
452
|
declare class ProductApi extends BaseApi {
|
|
331
453
|
constructor(options: ProductApiOptions);
|
|
332
454
|
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
455
|
+
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
333
456
|
}
|
|
334
457
|
|
|
335
458
|
interface GenerateMetadataOptions {
|
|
@@ -380,6 +503,11 @@ declare class CollectionClient extends HttpClient {
|
|
|
380
503
|
* GET /api/{collection}
|
|
381
504
|
*/
|
|
382
505
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
506
|
+
/**
|
|
507
|
+
* Find-like response from a custom endpoint
|
|
508
|
+
* POST /api/...custom-endpoint
|
|
509
|
+
*/
|
|
510
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
383
511
|
/**
|
|
384
512
|
* Find document by ID
|
|
385
513
|
* GET /api/{collection}/{id}
|
|
@@ -1064,6 +1192,10 @@ declare const customerKeys: {
|
|
|
1064
1192
|
all: readonly ["customer"];
|
|
1065
1193
|
me: () => readonly ["customer", "me"];
|
|
1066
1194
|
};
|
|
1195
|
+
declare const productKeys: {
|
|
1196
|
+
listingGroups: (options?: ApiQueryOptions) => readonly ["products", "listing-groups", "list", ApiQueryOptions | undefined];
|
|
1197
|
+
listingGroupsInfinite: (options?: Omit<ApiQueryOptions, "page">) => readonly ["products", "listing-groups", "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
1198
|
+
};
|
|
1067
1199
|
|
|
1068
1200
|
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1069
1201
|
/**
|
|
@@ -1086,6 +1218,32 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1086
1218
|
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1087
1219
|
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1088
1220
|
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1221
|
+
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1222
|
+
options?: ApiQueryOptions;
|
|
1223
|
+
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1224
|
+
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1225
|
+
options?: ApiQueryOptions;
|
|
1226
|
+
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1227
|
+
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1228
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1229
|
+
pageSize?: number;
|
|
1230
|
+
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1231
|
+
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1232
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1233
|
+
pageSize?: number;
|
|
1234
|
+
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1235
|
+
prefetchProductListingGroupsQuery(params: {
|
|
1236
|
+
options?: ApiQueryOptions;
|
|
1237
|
+
}, options?: {
|
|
1238
|
+
staleTime?: number;
|
|
1239
|
+
}): Promise<void>;
|
|
1240
|
+
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1241
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1242
|
+
pageSize?: number;
|
|
1243
|
+
}, options?: {
|
|
1244
|
+
pages?: number;
|
|
1245
|
+
staleTime?: number;
|
|
1246
|
+
}): Promise<void>;
|
|
1089
1247
|
}
|
|
1090
1248
|
|
|
1091
1249
|
declare class Client {
|
|
@@ -1150,4 +1308,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1150
1308
|
*/
|
|
1151
1309
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1152
1310
|
|
|
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 };
|
|
1311
|
+
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 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 };
|