@01.software/sdk 0.26.0 → 0.28.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 +153 -4
- package/dist/analytics/react.cjs +249 -0
- package/dist/analytics/react.cjs.map +1 -0
- package/dist/analytics/react.d.cts +8 -0
- package/dist/analytics/react.d.ts +8 -0
- package/dist/analytics/react.js +228 -0
- package/dist/analytics/react.js.map +1 -0
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/{const-R3AyqOHY.d.ts → const-Cz9Ki_I7.d.cts} +6 -6
- package/dist/{const-CEiFBZMW.d.cts → const-mdQQtIOz.d.ts} +6 -6
- package/dist/{image-TT8lTsk5.d.cts → image-BDz2-AaO.d.cts} +1 -1
- package/dist/{image-TT8lTsk5.d.ts → image-BDz2-AaO.d.ts} +1 -1
- package/dist/index.cjs +97 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +97 -10
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BF8VVFt6.d.cts → payload-types-BrSYb-sh.d.cts} +365 -122
- package/dist/{payload-types-BF8VVFt6.d.ts → payload-types-BrSYb-sh.d.ts} +365 -122
- 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/{server-DLdbWJVv.d.cts → server-BINWywT8.d.cts} +1 -1
- package/dist/{server-DLdbWJVv.d.ts → server-BINWywT8.d.ts} +1 -1
- package/dist/{server-CZrUwqDs.d.cts → server-C2Q9R-Lu.d.ts} +251 -9
- package/dist/{server-DULueNYi.d.ts → server-D369bCVJ.d.cts} +251 -9
- package/dist/server.cjs +79 -4
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +79 -4
- package/dist/server.js.map +1 -1
- package/dist/{types-CZ1laT6s.d.ts → types-BLUb4cYq.d.ts} +1 -1
- package/dist/{types-lPRgx_rC.d.cts → types-CW4PaIL7.d.cts} +1 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -1
- package/dist/ui/canvas/server.d.ts +1 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +3 -3
- package/dist/ui/canvas.d.ts +3 -3
- 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/image.d.cts +1 -1
- package/dist/ui/image.d.ts +1 -1
- package/dist/ui/video.d.cts +2 -2
- package/dist/ui/video.d.ts +2 -2
- package/dist/{video-DbLL8yuc.d.cts → video-WR_TFO9a.d.cts} +1 -1
- package/dist/{video-DbLL8yuc.d.ts → video-WR_TFO9a.d.ts} +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +40 -24
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-
|
|
2
|
-
export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-
|
|
3
|
-
import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams,
|
|
4
|
-
export {
|
|
1
|
+
import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-BrSYb-sh.cjs';
|
|
2
|
+
export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-BrSYb-sh.cjs';
|
|
3
|
+
import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, c as ProductDetailParams, d as ProductDetail, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, e as ApplyDiscountParams, f as RemoveDiscountParams, g as ClearCartParams, h as CheckoutParams, i as PayloadFindResponse, V as ValidateDiscountParams, j as ValidateDiscountResult, k as CalculateShippingParams, l as CalculateShippingResult, m as ApiQueryOptions, n as ProductListingGroupsQueryOptions, o as CommunityClient, p as ReadOnlyQueryHooks, q as ReadOnlyCollectionClient, r as ClientState, s as ClientConfig } from './server-D369bCVJ.cjs';
|
|
4
|
+
export { t as ApiError, u as AuthError, B as BanCustomerParams, v as BaseApi, w as BulkImportFulfillmentsParams, x as BulkImportFulfillmentsResponse, y as CartApi, z as CartApiOptions, D as ClientMetadata, E as ClientServerConfig, F as CollectionClient, G as CollectionDetailQueryParams, H as CollectionHooks, I as CollectionInfiniteQueryParams, J as CollectionQueryBuilder, K as CollectionQueryParams, M as CommunityBan, N as CommunityClientOptions, O as CommunityPost, Q as ConfigError, T as ConfirmPaymentParams, W as ConfirmPaymentResponse, X as ConflictError, Y as CreateFulfillmentParams, Z as CreateOrderParams, _ as CreateReturnParams, $ as CustomerAuthResponse, a0 as CustomerHooks, a1 as CustomerLoginData, a2 as CustomerProfile, a3 as CustomerRefreshResponse, a4 as CustomerRegisterData, a5 as CustomerRegisterResponse, a6 as CustomerSnapshot, a7 as DebugConfig, a8 as DeepPartial, a9 as DiscountApi, aa as DiscountApiOptions, ab as ExtractArrayType, ac as GenerateMetadataOptions, ad as GoneError, ae as InfiniteQueryOptions, af as ModerationApi, ag as ModerationApiOptions, ah as NetworkError, ai as NotFoundError, aj as OrderApi, ak as OrderApiOptions, al as PaginationMeta, am as PayloadMutationResponse, an as PermissionError, ao as ProductApi, ap as ProductApiOptions, aq as ProductDetailBrand, ar as ProductDetailCategory, as as ProductDetailImage, at as ProductDetailListing, au as ProductDetailOption, av as ProductDetailOptionValue, aw as ProductDetailTag, ax as ProductDetailVariant, ay as ProductDetailVariantOptionValue, az as ProductDetailVideo, aA as ProductListingGroup, aB as ProductListingGroupSummary, aC as ProductListingGroupsItem, aD as ProductListingProductShape, aE as ProductListingProjection, aF as ProductOptionMatrix, aG as ProductOptionMatrixOption, aH as ProductOptionMatrixValue, aI as ProductOptionMatrixVariant, aJ as ProductOptionShape, aK as ProductOptionValueShape, aL as ProductVariantShape, aM as QueryHooks, aN as QueryOptions, aO as RateLimitError, aP as ReadOnlyQueryBuilder, aQ as RequestOptions, aR as RetryConfig, aS as ReturnItem, aT as ReturnReason, aU as ReturnWithRefundParams, aV as SDKError, aW as ServerApiOptions, aX as ServerClient, aX as ServerClientType, aY as ServerCollectionClient, aZ as ServerCollectionQueryBuilder, a_ as ServerCommerceClient, a$ as ServerCommerceClientOptions, b0 as ServiceUnavailableError, b1 as ShippingApi, b2 as ShippingApiOptions, b3 as StockCheckResult, b4 as SuspenseInfiniteQueryOptions, b5 as SuspenseQueryOptions, b6 as TimeoutError, b7 as UnbanCustomerParams, b8 as UpdateFulfillmentParams, b9 as UpdateOrderParams, ba as UpdateProfileData, bb as UpdateReturnParams, bc as UpdateTransactionParams, bd as UsageLimitError, be as ValidationError, bf as buildProductListingGroupsByOption, bg as buildProductListingProjection, bh as buildProductOptionMatrix, bi as createAuthError, bj as createConflictError, bk as createNotFoundError, bl as createPermissionError, bm as createRateLimitError, bn as createServerClient, bo as getAvailableOptionValues, bp as getSelectedValueByOptionId, bq as isApiError, br as isAuthError, bs as isConfigError, bt as isConflictError, bu as isGoneError, bv as isNetworkError, bw as isNotFoundError, bx as isPermissionError, by as isRateLimitError, bz as isSDKError, bA as isServiceUnavailableError, bB as isTimeoutError, bC as isUsageLimitError, bD as isValidationError, bE as normalizeSelectedValueIds, bF as resolveApiUrl, bG as resolveVariantForSelection } from './server-D369bCVJ.cjs';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
export { C as CollectionType } from './types-
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export {
|
|
6
|
+
export { C as CollectionType } from './types-CW4PaIL7.cjs';
|
|
7
|
+
import { P as PublicCollection } from './const-Cz9Ki_I7.cjs';
|
|
8
|
+
export { C as COLLECTIONS, a as Collection, I as INTERNAL_COLLECTIONS, b as InternalCollection, S as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS, d as ServerCollection, e as ServerOnlyCollection } from './const-Cz9Ki_I7.cjs';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
10
10
|
export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.cjs';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
11
|
+
export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.cjs';
|
|
12
|
+
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.cjs';
|
|
13
13
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.cjs';
|
|
14
14
|
import 'payload';
|
|
15
15
|
import 'next';
|
|
@@ -34,6 +34,7 @@ declare class CommerceClient {
|
|
|
34
34
|
readonly product: {
|
|
35
35
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
36
36
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
37
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
|
|
37
38
|
};
|
|
38
39
|
readonly cart: {
|
|
39
40
|
get: (cartId: string) => Promise<Cart>;
|
|
@@ -81,6 +82,16 @@ declare const customerKeys: {
|
|
|
81
82
|
declare const productKeys: {
|
|
82
83
|
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
83
84
|
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "limit" | "page"> | undefined];
|
|
85
|
+
detail: (params: {
|
|
86
|
+
slug: string;
|
|
87
|
+
} | {
|
|
88
|
+
id: string;
|
|
89
|
+
}) => readonly ["products", "detail", {
|
|
90
|
+
slug: string;
|
|
91
|
+
} | {
|
|
92
|
+
id: string;
|
|
93
|
+
}];
|
|
94
|
+
detailAll: () => readonly ["products", "detail"];
|
|
84
95
|
};
|
|
85
96
|
|
|
86
97
|
declare class Client {
|
|
@@ -124,4 +135,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
124
135
|
*/
|
|
125
136
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
126
137
|
|
|
127
|
-
export { AddItemParams, ApiQueryOptions, ApplyDiscountParams, CalculateShippingParams, CalculateShippingResult, Cart, CartItem, CheckoutParams, ClearCartParams, Client, ClientConfig, ClientState, Client as ClientType, CommerceClient, type CommerceClientOptions, CommunityClient, CustomerAuth, CustomerAuthOptions, CustomerNamespace, ListingGroupsParams, Order, PayloadFindResponse, Product, ProductListingGroupsQueryOptions, ProductListingGroupsResponse, PublicCollection, ReadOnlyCollectionClient, ReadOnlyQueryHooks, RemoveDiscountParams, RemoveItemParams, StockCheckParams, StockCheckResponse, UpdateItemParams, ValidateDiscountParams, ValidateDiscountResult, collectionKeys, createClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, productKeys, resolveRelation };
|
|
138
|
+
export { AddItemParams, ApiQueryOptions, ApplyDiscountParams, CalculateShippingParams, CalculateShippingResult, Cart, CartItem, CheckoutParams, ClearCartParams, Client, ClientConfig, ClientState, Client as ClientType, CommerceClient, type CommerceClientOptions, CommunityClient, CustomerAuth, CustomerAuthOptions, CustomerNamespace, ListingGroupsParams, Order, PayloadFindResponse, Product, ProductDetail, ProductDetailParams, ProductListingGroupsQueryOptions, ProductListingGroupsResponse, PublicCollection, ReadOnlyCollectionClient, ReadOnlyQueryHooks, RemoveDiscountParams, RemoveItemParams, StockCheckParams, StockCheckResponse, UpdateItemParams, ValidateDiscountParams, ValidateDiscountResult, collectionKeys, createClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, productKeys, resolveRelation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-
|
|
2
|
-
export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-
|
|
3
|
-
import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams,
|
|
4
|
-
export {
|
|
1
|
+
import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-BrSYb-sh.js';
|
|
2
|
+
export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-BrSYb-sh.js';
|
|
3
|
+
import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, c as ProductDetailParams, d as ProductDetail, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, e as ApplyDiscountParams, f as RemoveDiscountParams, g as ClearCartParams, h as CheckoutParams, i as PayloadFindResponse, V as ValidateDiscountParams, j as ValidateDiscountResult, k as CalculateShippingParams, l as CalculateShippingResult, m as ApiQueryOptions, n as ProductListingGroupsQueryOptions, o as CommunityClient, p as ReadOnlyQueryHooks, q as ReadOnlyCollectionClient, r as ClientState, s as ClientConfig } from './server-C2Q9R-Lu.js';
|
|
4
|
+
export { t as ApiError, u as AuthError, B as BanCustomerParams, v as BaseApi, w as BulkImportFulfillmentsParams, x as BulkImportFulfillmentsResponse, y as CartApi, z as CartApiOptions, D as ClientMetadata, E as ClientServerConfig, F as CollectionClient, G as CollectionDetailQueryParams, H as CollectionHooks, I as CollectionInfiniteQueryParams, J as CollectionQueryBuilder, K as CollectionQueryParams, M as CommunityBan, N as CommunityClientOptions, O as CommunityPost, Q as ConfigError, T as ConfirmPaymentParams, W as ConfirmPaymentResponse, X as ConflictError, Y as CreateFulfillmentParams, Z as CreateOrderParams, _ as CreateReturnParams, $ as CustomerAuthResponse, a0 as CustomerHooks, a1 as CustomerLoginData, a2 as CustomerProfile, a3 as CustomerRefreshResponse, a4 as CustomerRegisterData, a5 as CustomerRegisterResponse, a6 as CustomerSnapshot, a7 as DebugConfig, a8 as DeepPartial, a9 as DiscountApi, aa as DiscountApiOptions, ab as ExtractArrayType, ac as GenerateMetadataOptions, ad as GoneError, ae as InfiniteQueryOptions, af as ModerationApi, ag as ModerationApiOptions, ah as NetworkError, ai as NotFoundError, aj as OrderApi, ak as OrderApiOptions, al as PaginationMeta, am as PayloadMutationResponse, an as PermissionError, ao as ProductApi, ap as ProductApiOptions, aq as ProductDetailBrand, ar as ProductDetailCategory, as as ProductDetailImage, at as ProductDetailListing, au as ProductDetailOption, av as ProductDetailOptionValue, aw as ProductDetailTag, ax as ProductDetailVariant, ay as ProductDetailVariantOptionValue, az as ProductDetailVideo, aA as ProductListingGroup, aB as ProductListingGroupSummary, aC as ProductListingGroupsItem, aD as ProductListingProductShape, aE as ProductListingProjection, aF as ProductOptionMatrix, aG as ProductOptionMatrixOption, aH as ProductOptionMatrixValue, aI as ProductOptionMatrixVariant, aJ as ProductOptionShape, aK as ProductOptionValueShape, aL as ProductVariantShape, aM as QueryHooks, aN as QueryOptions, aO as RateLimitError, aP as ReadOnlyQueryBuilder, aQ as RequestOptions, aR as RetryConfig, aS as ReturnItem, aT as ReturnReason, aU as ReturnWithRefundParams, aV as SDKError, aW as ServerApiOptions, aX as ServerClient, aX as ServerClientType, aY as ServerCollectionClient, aZ as ServerCollectionQueryBuilder, a_ as ServerCommerceClient, a$ as ServerCommerceClientOptions, b0 as ServiceUnavailableError, b1 as ShippingApi, b2 as ShippingApiOptions, b3 as StockCheckResult, b4 as SuspenseInfiniteQueryOptions, b5 as SuspenseQueryOptions, b6 as TimeoutError, b7 as UnbanCustomerParams, b8 as UpdateFulfillmentParams, b9 as UpdateOrderParams, ba as UpdateProfileData, bb as UpdateReturnParams, bc as UpdateTransactionParams, bd as UsageLimitError, be as ValidationError, bf as buildProductListingGroupsByOption, bg as buildProductListingProjection, bh as buildProductOptionMatrix, bi as createAuthError, bj as createConflictError, bk as createNotFoundError, bl as createPermissionError, bm as createRateLimitError, bn as createServerClient, bo as getAvailableOptionValues, bp as getSelectedValueByOptionId, bq as isApiError, br as isAuthError, bs as isConfigError, bt as isConflictError, bu as isGoneError, bv as isNetworkError, bw as isNotFoundError, bx as isPermissionError, by as isRateLimitError, bz as isSDKError, bA as isServiceUnavailableError, bB as isTimeoutError, bC as isUsageLimitError, bD as isValidationError, bE as normalizeSelectedValueIds, bF as resolveApiUrl, bG as resolveVariantForSelection } from './server-C2Q9R-Lu.js';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
export { C as CollectionType } from './types-
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export {
|
|
6
|
+
export { C as CollectionType } from './types-BLUb4cYq.js';
|
|
7
|
+
import { P as PublicCollection } from './const-mdQQtIOz.js';
|
|
8
|
+
export { C as COLLECTIONS, a as Collection, I as INTERNAL_COLLECTIONS, b as InternalCollection, S as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS, d as ServerCollection, e as ServerOnlyCollection } from './const-mdQQtIOz.js';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
10
10
|
export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.js';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
11
|
+
export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.js';
|
|
12
|
+
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.js';
|
|
13
13
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.js';
|
|
14
14
|
import 'payload';
|
|
15
15
|
import 'next';
|
|
@@ -34,6 +34,7 @@ declare class CommerceClient {
|
|
|
34
34
|
readonly product: {
|
|
35
35
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
36
36
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
37
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
|
|
37
38
|
};
|
|
38
39
|
readonly cart: {
|
|
39
40
|
get: (cartId: string) => Promise<Cart>;
|
|
@@ -81,6 +82,16 @@ declare const customerKeys: {
|
|
|
81
82
|
declare const productKeys: {
|
|
82
83
|
listingGroups: (options?: ProductListingGroupsQueryOptions) => readonly ["products", "listing-groups", "list", ProductListingGroupsQueryOptions | undefined];
|
|
83
84
|
listingGroupsInfinite: (options?: Omit<ProductListingGroupsQueryOptions, "page" | "limit">) => readonly ["products", "listing-groups", "infinite", Omit<ProductListingGroupsQueryOptions, "limit" | "page"> | undefined];
|
|
85
|
+
detail: (params: {
|
|
86
|
+
slug: string;
|
|
87
|
+
} | {
|
|
88
|
+
id: string;
|
|
89
|
+
}) => readonly ["products", "detail", {
|
|
90
|
+
slug: string;
|
|
91
|
+
} | {
|
|
92
|
+
id: string;
|
|
93
|
+
}];
|
|
94
|
+
detailAll: () => readonly ["products", "detail"];
|
|
84
95
|
};
|
|
85
96
|
|
|
86
97
|
declare class Client {
|
|
@@ -124,4 +135,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
124
135
|
*/
|
|
125
136
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
126
137
|
|
|
127
|
-
export { AddItemParams, ApiQueryOptions, ApplyDiscountParams, CalculateShippingParams, CalculateShippingResult, Cart, CartItem, CheckoutParams, ClearCartParams, Client, ClientConfig, ClientState, Client as ClientType, CommerceClient, type CommerceClientOptions, CommunityClient, CustomerAuth, CustomerAuthOptions, CustomerNamespace, ListingGroupsParams, Order, PayloadFindResponse, Product, ProductListingGroupsQueryOptions, ProductListingGroupsResponse, PublicCollection, ReadOnlyCollectionClient, ReadOnlyQueryHooks, RemoveDiscountParams, RemoveItemParams, StockCheckParams, StockCheckResponse, UpdateItemParams, ValidateDiscountParams, ValidateDiscountResult, collectionKeys, createClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, productKeys, resolveRelation };
|
|
138
|
+
export { AddItemParams, ApiQueryOptions, ApplyDiscountParams, CalculateShippingParams, CalculateShippingResult, Cart, CartItem, CheckoutParams, ClearCartParams, Client, ClientConfig, ClientState, Client as ClientType, CommerceClient, type CommerceClientOptions, CommunityClient, CustomerAuth, CustomerAuthOptions, CustomerNamespace, ListingGroupsParams, Order, PayloadFindResponse, Product, ProductDetail, ProductDetailParams, ProductListingGroupsQueryOptions, ProductListingGroupsResponse, PublicCollection, ReadOnlyCollectionClient, ReadOnlyQueryHooks, RemoveDiscountParams, RemoveItemParams, StockCheckParams, StockCheckResponse, UpdateItemParams, ValidateDiscountParams, ValidateDiscountResult, collectionKeys, createClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, productKeys, resolveRelation };
|
package/dist/index.js
CHANGED
|
@@ -1141,6 +1141,7 @@ var INTERNAL_COLLECTIONS = [
|
|
|
1141
1141
|
"analytics-event-schemas",
|
|
1142
1142
|
"subscriptions",
|
|
1143
1143
|
"billing-history",
|
|
1144
|
+
"inventory-reservations",
|
|
1144
1145
|
"order-status-logs",
|
|
1145
1146
|
"api-keys",
|
|
1146
1147
|
"personal-access-tokens",
|
|
@@ -1181,8 +1182,8 @@ var COLLECTIONS = [
|
|
|
1181
1182
|
"carts",
|
|
1182
1183
|
"cart-items",
|
|
1183
1184
|
"discounts",
|
|
1184
|
-
"promotions",
|
|
1185
1185
|
"shipping-policies",
|
|
1186
|
+
"shipping-zones",
|
|
1186
1187
|
"documents",
|
|
1187
1188
|
"document-categories",
|
|
1188
1189
|
"document-types",
|
|
@@ -1224,8 +1225,6 @@ var COLLECTIONS = [
|
|
|
1224
1225
|
"reaction-types",
|
|
1225
1226
|
"bookmarks",
|
|
1226
1227
|
"post-categories",
|
|
1227
|
-
"reports",
|
|
1228
|
-
"community-bans",
|
|
1229
1228
|
// Events
|
|
1230
1229
|
"event-calendars",
|
|
1231
1230
|
"events",
|
|
@@ -1233,7 +1232,11 @@ var COLLECTIONS = [
|
|
|
1233
1232
|
"event-occurrences",
|
|
1234
1233
|
"event-tags"
|
|
1235
1234
|
];
|
|
1236
|
-
var SERVER_ONLY_COLLECTIONS = [
|
|
1235
|
+
var SERVER_ONLY_COLLECTIONS = [
|
|
1236
|
+
"customer-groups",
|
|
1237
|
+
"reports",
|
|
1238
|
+
"community-bans"
|
|
1239
|
+
];
|
|
1237
1240
|
var SERVER_COLLECTIONS = [
|
|
1238
1241
|
...COLLECTIONS,
|
|
1239
1242
|
...SERVER_ONLY_COLLECTIONS
|
|
@@ -1849,7 +1852,15 @@ var CommerceClient = class {
|
|
|
1849
1852
|
};
|
|
1850
1853
|
this.product = {
|
|
1851
1854
|
stockCheck: (params) => execute("/api/products/stock-check", params),
|
|
1852
|
-
listingGroups: (params) => execute("/api/products/listing-groups", params)
|
|
1855
|
+
listingGroups: (params) => execute("/api/products/listing-groups", params),
|
|
1856
|
+
detail: async (params) => {
|
|
1857
|
+
try {
|
|
1858
|
+
return await execute("/api/products/detail", params);
|
|
1859
|
+
} catch (err) {
|
|
1860
|
+
if (err instanceof NotFoundError) return null;
|
|
1861
|
+
throw err;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1853
1864
|
};
|
|
1854
1865
|
this.cart = {
|
|
1855
1866
|
get: cartApi.getCart.bind(cartApi),
|
|
@@ -1892,6 +1903,32 @@ var ProductApi = class extends BaseApi {
|
|
|
1892
1903
|
params
|
|
1893
1904
|
);
|
|
1894
1905
|
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Fetch full product detail by slug or id.
|
|
1908
|
+
* Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
|
|
1909
|
+
* `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
|
|
1910
|
+
* inspect `client.lastRequestId` against backend logs.
|
|
1911
|
+
*/
|
|
1912
|
+
async detail(params) {
|
|
1913
|
+
try {
|
|
1914
|
+
return await this.request("/api/products/detail", params);
|
|
1915
|
+
} catch (err) {
|
|
1916
|
+
if (err instanceof NotFoundError) return null;
|
|
1917
|
+
throw err;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Atomically create or update a product together with its options,
|
|
1922
|
+
* option-values, and variants in a single transaction. Mirrors Shopify's
|
|
1923
|
+
* `productSet` shape and is the canonical write path for the MCP
|
|
1924
|
+
* `product-upsert` tool.
|
|
1925
|
+
*/
|
|
1926
|
+
upsert(params) {
|
|
1927
|
+
return this.request(
|
|
1928
|
+
"/api/products/upsert",
|
|
1929
|
+
params
|
|
1930
|
+
);
|
|
1931
|
+
}
|
|
1895
1932
|
};
|
|
1896
1933
|
|
|
1897
1934
|
// src/core/api/discount-api.ts
|
|
@@ -1928,6 +1965,13 @@ var OrderApi = class extends BaseApi {
|
|
|
1928
1965
|
updateTransaction(params) {
|
|
1929
1966
|
return this.request("/api/transactions/update", params);
|
|
1930
1967
|
}
|
|
1968
|
+
confirmPayment(params) {
|
|
1969
|
+
return this.request(
|
|
1970
|
+
"/api/orders/confirm-payment",
|
|
1971
|
+
params,
|
|
1972
|
+
params.providerEventId ? { headers: { "X-Idempotency-Key": params.providerEventId } } : void 0
|
|
1973
|
+
);
|
|
1974
|
+
}
|
|
1931
1975
|
checkout(params) {
|
|
1932
1976
|
return this.request("/api/orders/checkout", params);
|
|
1933
1977
|
}
|
|
@@ -1977,7 +2021,9 @@ var ServerCommerceClient = class {
|
|
|
1977
2021
|
const orderApi = new OrderApi(serverOptions);
|
|
1978
2022
|
this.product = {
|
|
1979
2023
|
stockCheck: productApi.stockCheck.bind(productApi),
|
|
1980
|
-
listingGroups: productApi.listingGroups.bind(productApi)
|
|
2024
|
+
listingGroups: productApi.listingGroups.bind(productApi),
|
|
2025
|
+
detail: productApi.detail.bind(productApi),
|
|
2026
|
+
upsert: productApi.upsert.bind(productApi)
|
|
1981
2027
|
};
|
|
1982
2028
|
this.cart = {
|
|
1983
2029
|
get: cartApi.getCart.bind(cartApi),
|
|
@@ -1993,6 +2039,7 @@ var ServerCommerceClient = class {
|
|
|
1993
2039
|
create: orderApi.createOrder.bind(orderApi),
|
|
1994
2040
|
update: orderApi.updateOrder.bind(orderApi),
|
|
1995
2041
|
updateTransaction: orderApi.updateTransaction.bind(orderApi),
|
|
2042
|
+
confirmPayment: orderApi.confirmPayment.bind(orderApi),
|
|
1996
2043
|
createFulfillment: orderApi.createFulfillment.bind(orderApi),
|
|
1997
2044
|
updateFulfillment: orderApi.updateFulfillment.bind(orderApi),
|
|
1998
2045
|
bulkImportFulfillments: orderApi.bulkImportFulfillments.bind(orderApi),
|
|
@@ -2078,10 +2125,24 @@ var customerKeys = {
|
|
|
2078
2125
|
};
|
|
2079
2126
|
var productKeys = {
|
|
2080
2127
|
listingGroups: (options) => ["products", "listing-groups", "list", options],
|
|
2081
|
-
listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options]
|
|
2128
|
+
listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options],
|
|
2129
|
+
detail: (params) => ["products", "detail", params],
|
|
2130
|
+
detailAll: () => ["products", "detail"]
|
|
2082
2131
|
};
|
|
2083
2132
|
|
|
2084
2133
|
// src/core/query/collection-hooks.ts
|
|
2134
|
+
var PRODUCT_DETAIL_INVALIDATING_COLLECTIONS = /* @__PURE__ */ new Set([
|
|
2135
|
+
"products",
|
|
2136
|
+
"product-variants",
|
|
2137
|
+
"product-options",
|
|
2138
|
+
"product-option-values",
|
|
2139
|
+
"product-categories",
|
|
2140
|
+
"product-tags",
|
|
2141
|
+
"product-collections",
|
|
2142
|
+
"brands",
|
|
2143
|
+
"brand-logos",
|
|
2144
|
+
"images"
|
|
2145
|
+
]);
|
|
2085
2146
|
var DEFAULT_PAGE_SIZE = 20;
|
|
2086
2147
|
var CollectionHooks = class {
|
|
2087
2148
|
constructor(queryClient, collectionClient) {
|
|
@@ -2239,6 +2300,9 @@ var CollectionHooks = class {
|
|
|
2239
2300
|
this.queryClient.invalidateQueries({
|
|
2240
2301
|
queryKey: collectionKeys(collection).all
|
|
2241
2302
|
});
|
|
2303
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2304
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2305
|
+
}
|
|
2242
2306
|
options?.onSuccess?.(data);
|
|
2243
2307
|
},
|
|
2244
2308
|
onError: options?.onError,
|
|
@@ -2259,6 +2323,9 @@ var CollectionHooks = class {
|
|
|
2259
2323
|
this.queryClient.invalidateQueries({
|
|
2260
2324
|
queryKey: collectionKeys(collection).all
|
|
2261
2325
|
});
|
|
2326
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2327
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2328
|
+
}
|
|
2262
2329
|
options?.onSuccess?.(data);
|
|
2263
2330
|
},
|
|
2264
2331
|
onError: options?.onError,
|
|
@@ -2275,6 +2342,9 @@ var CollectionHooks = class {
|
|
|
2275
2342
|
this.queryClient.invalidateQueries({
|
|
2276
2343
|
queryKey: collectionKeys(collection).all
|
|
2277
2344
|
});
|
|
2345
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2346
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2347
|
+
}
|
|
2278
2348
|
options?.onSuccess?.(data);
|
|
2279
2349
|
},
|
|
2280
2350
|
onError: options?.onError,
|
|
@@ -2430,7 +2500,7 @@ var CustomerHooks = class {
|
|
|
2430
2500
|
|
|
2431
2501
|
// src/core/query/query-hooks.ts
|
|
2432
2502
|
var QueryHooks = class extends CollectionHooks {
|
|
2433
|
-
constructor(queryClient, collectionClient, customerAuth) {
|
|
2503
|
+
constructor(queryClient, collectionClient, customerAuth, commerceClient) {
|
|
2434
2504
|
super(queryClient, collectionClient);
|
|
2435
2505
|
// --- Customer hooks delegation ---
|
|
2436
2506
|
this.useCustomerMe = (...args) => this._customer.useCustomerMe(...args);
|
|
@@ -2447,6 +2517,7 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
2447
2517
|
this.getCustomerData = () => this._customer.getCustomerData();
|
|
2448
2518
|
this.setCustomerData = (data) => this._customer.setCustomerData(data);
|
|
2449
2519
|
this._customer = new CustomerHooks(queryClient, customerAuth);
|
|
2520
|
+
this._commerce = commerceClient;
|
|
2450
2521
|
}
|
|
2451
2522
|
useProductListingGroupsQuery(params, options) {
|
|
2452
2523
|
const queryOptions = params.options;
|
|
@@ -2540,6 +2611,21 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
2540
2611
|
staleTime: options?.staleTime
|
|
2541
2612
|
});
|
|
2542
2613
|
}
|
|
2614
|
+
useProductDetail(params, options) {
|
|
2615
|
+
const discriminator = "slug" in params ? params.slug : params.id;
|
|
2616
|
+
const enabled = options?.enabled !== false && Boolean(discriminator);
|
|
2617
|
+
return useQueryOriginal3({
|
|
2618
|
+
queryKey: productKeys.detail(params),
|
|
2619
|
+
queryFn: () => this._commerce.product.detail(params),
|
|
2620
|
+
enabled
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
2623
|
+
useProductDetailBySlug(slug, options) {
|
|
2624
|
+
return this.useProductDetail({ slug }, options);
|
|
2625
|
+
}
|
|
2626
|
+
useProductDetailById(id, options) {
|
|
2627
|
+
return this.useProductDetail({ id }, options);
|
|
2628
|
+
}
|
|
2543
2629
|
};
|
|
2544
2630
|
|
|
2545
2631
|
// src/core/client/client.ts
|
|
@@ -2602,7 +2688,8 @@ var Client = class {
|
|
|
2602
2688
|
this.query = new QueryHooks(
|
|
2603
2689
|
this.queryClient,
|
|
2604
2690
|
collectionClient,
|
|
2605
|
-
this.customer.auth
|
|
2691
|
+
this.customer.auth,
|
|
2692
|
+
this.commerce
|
|
2606
2693
|
);
|
|
2607
2694
|
}
|
|
2608
2695
|
getState() {
|
|
@@ -2664,7 +2751,7 @@ var ServerClient = class {
|
|
|
2664
2751
|
onRequestId
|
|
2665
2752
|
);
|
|
2666
2753
|
this.queryClient = getQueryClient();
|
|
2667
|
-
this.query = new QueryHooks(this.queryClient, this.collections);
|
|
2754
|
+
this.query = new QueryHooks(this.queryClient, this.collections, void 0, this.commerce);
|
|
2668
2755
|
}
|
|
2669
2756
|
getState() {
|
|
2670
2757
|
return { ...this.state };
|