@01.software/sdk 0.27.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 +125 -1
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/{const-D-xucnw4.d.ts → const-Cz9Ki_I7.d.cts} +4 -4
- package/dist/{const-C0GlmeJ_.d.cts → const-mdQQtIOz.d.ts} +4 -4
- package/dist/index.cjs +84 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +84 -7
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BPvUmPAq.d.cts → payload-types-BrSYb-sh.d.cts} +145 -70
- package/dist/{payload-types-BPvUmPAq.d.ts → payload-types-BrSYb-sh.d.ts} +145 -70
- 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-_zvihptw.d.ts → server-C2Q9R-Lu.d.ts} +228 -9
- package/dist/{server-n3xK4Nks.d.cts → server-D369bCVJ.d.cts} +228 -9
- package/dist/server.cjs +71 -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 +71 -4
- package/dist/server.js.map +1 -1
- package/dist/{types-BLdthWiW.d.ts → types-BLUb4cYq.d.ts} +1 -1
- package/dist/{types-DzWNu9pw.d.cts → types-CW4PaIL7.d.cts} +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.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 { 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-
|
|
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
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';
|
|
@@ -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,11 +1,11 @@
|
|
|
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 { 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-
|
|
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
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';
|
|
@@ -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",
|
|
@@ -1851,7 +1852,15 @@ var CommerceClient = class {
|
|
|
1851
1852
|
};
|
|
1852
1853
|
this.product = {
|
|
1853
1854
|
stockCheck: (params) => execute("/api/products/stock-check", params),
|
|
1854
|
-
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
|
+
}
|
|
1855
1864
|
};
|
|
1856
1865
|
this.cart = {
|
|
1857
1866
|
get: cartApi.getCart.bind(cartApi),
|
|
@@ -1894,6 +1903,32 @@ var ProductApi = class extends BaseApi {
|
|
|
1894
1903
|
params
|
|
1895
1904
|
);
|
|
1896
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
|
+
}
|
|
1897
1932
|
};
|
|
1898
1933
|
|
|
1899
1934
|
// src/core/api/discount-api.ts
|
|
@@ -1986,7 +2021,9 @@ var ServerCommerceClient = class {
|
|
|
1986
2021
|
const orderApi = new OrderApi(serverOptions);
|
|
1987
2022
|
this.product = {
|
|
1988
2023
|
stockCheck: productApi.stockCheck.bind(productApi),
|
|
1989
|
-
listingGroups: productApi.listingGroups.bind(productApi)
|
|
2024
|
+
listingGroups: productApi.listingGroups.bind(productApi),
|
|
2025
|
+
detail: productApi.detail.bind(productApi),
|
|
2026
|
+
upsert: productApi.upsert.bind(productApi)
|
|
1990
2027
|
};
|
|
1991
2028
|
this.cart = {
|
|
1992
2029
|
get: cartApi.getCart.bind(cartApi),
|
|
@@ -2088,10 +2125,24 @@ var customerKeys = {
|
|
|
2088
2125
|
};
|
|
2089
2126
|
var productKeys = {
|
|
2090
2127
|
listingGroups: (options) => ["products", "listing-groups", "list", options],
|
|
2091
|
-
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"]
|
|
2092
2131
|
};
|
|
2093
2132
|
|
|
2094
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
|
+
]);
|
|
2095
2146
|
var DEFAULT_PAGE_SIZE = 20;
|
|
2096
2147
|
var CollectionHooks = class {
|
|
2097
2148
|
constructor(queryClient, collectionClient) {
|
|
@@ -2249,6 +2300,9 @@ var CollectionHooks = class {
|
|
|
2249
2300
|
this.queryClient.invalidateQueries({
|
|
2250
2301
|
queryKey: collectionKeys(collection).all
|
|
2251
2302
|
});
|
|
2303
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2304
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2305
|
+
}
|
|
2252
2306
|
options?.onSuccess?.(data);
|
|
2253
2307
|
},
|
|
2254
2308
|
onError: options?.onError,
|
|
@@ -2269,6 +2323,9 @@ var CollectionHooks = class {
|
|
|
2269
2323
|
this.queryClient.invalidateQueries({
|
|
2270
2324
|
queryKey: collectionKeys(collection).all
|
|
2271
2325
|
});
|
|
2326
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2327
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2328
|
+
}
|
|
2272
2329
|
options?.onSuccess?.(data);
|
|
2273
2330
|
},
|
|
2274
2331
|
onError: options?.onError,
|
|
@@ -2285,6 +2342,9 @@ var CollectionHooks = class {
|
|
|
2285
2342
|
this.queryClient.invalidateQueries({
|
|
2286
2343
|
queryKey: collectionKeys(collection).all
|
|
2287
2344
|
});
|
|
2345
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
2346
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
2347
|
+
}
|
|
2288
2348
|
options?.onSuccess?.(data);
|
|
2289
2349
|
},
|
|
2290
2350
|
onError: options?.onError,
|
|
@@ -2440,7 +2500,7 @@ var CustomerHooks = class {
|
|
|
2440
2500
|
|
|
2441
2501
|
// src/core/query/query-hooks.ts
|
|
2442
2502
|
var QueryHooks = class extends CollectionHooks {
|
|
2443
|
-
constructor(queryClient, collectionClient, customerAuth) {
|
|
2503
|
+
constructor(queryClient, collectionClient, customerAuth, commerceClient) {
|
|
2444
2504
|
super(queryClient, collectionClient);
|
|
2445
2505
|
// --- Customer hooks delegation ---
|
|
2446
2506
|
this.useCustomerMe = (...args) => this._customer.useCustomerMe(...args);
|
|
@@ -2457,6 +2517,7 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
2457
2517
|
this.getCustomerData = () => this._customer.getCustomerData();
|
|
2458
2518
|
this.setCustomerData = (data) => this._customer.setCustomerData(data);
|
|
2459
2519
|
this._customer = new CustomerHooks(queryClient, customerAuth);
|
|
2520
|
+
this._commerce = commerceClient;
|
|
2460
2521
|
}
|
|
2461
2522
|
useProductListingGroupsQuery(params, options) {
|
|
2462
2523
|
const queryOptions = params.options;
|
|
@@ -2550,6 +2611,21 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
2550
2611
|
staleTime: options?.staleTime
|
|
2551
2612
|
});
|
|
2552
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
|
+
}
|
|
2553
2629
|
};
|
|
2554
2630
|
|
|
2555
2631
|
// src/core/client/client.ts
|
|
@@ -2612,7 +2688,8 @@ var Client = class {
|
|
|
2612
2688
|
this.query = new QueryHooks(
|
|
2613
2689
|
this.queryClient,
|
|
2614
2690
|
collectionClient,
|
|
2615
|
-
this.customer.auth
|
|
2691
|
+
this.customer.auth,
|
|
2692
|
+
this.commerce
|
|
2616
2693
|
);
|
|
2617
2694
|
}
|
|
2618
2695
|
getState() {
|
|
@@ -2674,7 +2751,7 @@ var ServerClient = class {
|
|
|
2674
2751
|
onRequestId
|
|
2675
2752
|
);
|
|
2676
2753
|
this.queryClient = getQueryClient();
|
|
2677
|
-
this.query = new QueryHooks(this.queryClient, this.collections);
|
|
2754
|
+
this.query = new QueryHooks(this.queryClient, this.collections, void 0, this.commerce);
|
|
2678
2755
|
}
|
|
2679
2756
|
getState() {
|
|
2680
2757
|
return { ...this.state };
|