@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.
Files changed (56) hide show
  1. package/README.md +153 -4
  2. package/dist/analytics/react.cjs +249 -0
  3. package/dist/analytics/react.cjs.map +1 -0
  4. package/dist/analytics/react.d.cts +8 -0
  5. package/dist/analytics/react.d.ts +8 -0
  6. package/dist/analytics/react.js +228 -0
  7. package/dist/analytics/react.js.map +1 -0
  8. package/dist/analytics.cjs.map +1 -1
  9. package/dist/analytics.js.map +1 -1
  10. package/dist/{const-R3AyqOHY.d.ts → const-Cz9Ki_I7.d.cts} +6 -6
  11. package/dist/{const-CEiFBZMW.d.cts → const-mdQQtIOz.d.ts} +6 -6
  12. package/dist/{image-TT8lTsk5.d.cts → image-BDz2-AaO.d.cts} +1 -1
  13. package/dist/{image-TT8lTsk5.d.ts → image-BDz2-AaO.d.ts} +1 -1
  14. package/dist/index.cjs +97 -10
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +21 -10
  17. package/dist/index.d.ts +21 -10
  18. package/dist/index.js +97 -10
  19. package/dist/index.js.map +1 -1
  20. package/dist/{payload-types-BF8VVFt6.d.cts → payload-types-BrSYb-sh.d.cts} +365 -122
  21. package/dist/{payload-types-BF8VVFt6.d.ts → payload-types-BrSYb-sh.d.ts} +365 -122
  22. package/dist/realtime.cjs.map +1 -1
  23. package/dist/realtime.d.cts +2 -2
  24. package/dist/realtime.d.ts +2 -2
  25. package/dist/realtime.js.map +1 -1
  26. package/dist/{server-DLdbWJVv.d.cts → server-BINWywT8.d.cts} +1 -1
  27. package/dist/{server-DLdbWJVv.d.ts → server-BINWywT8.d.ts} +1 -1
  28. package/dist/{server-CZrUwqDs.d.cts → server-C2Q9R-Lu.d.ts} +251 -9
  29. package/dist/{server-DULueNYi.d.ts → server-D369bCVJ.d.cts} +251 -9
  30. package/dist/server.cjs +79 -4
  31. package/dist/server.cjs.map +1 -1
  32. package/dist/server.d.cts +4 -4
  33. package/dist/server.d.ts +4 -4
  34. package/dist/server.js +79 -4
  35. package/dist/server.js.map +1 -1
  36. package/dist/{types-CZ1laT6s.d.ts → types-BLUb4cYq.d.ts} +1 -1
  37. package/dist/{types-lPRgx_rC.d.cts → types-CW4PaIL7.d.cts} +1 -1
  38. package/dist/ui/canvas/server.cjs.map +1 -1
  39. package/dist/ui/canvas/server.d.cts +1 -1
  40. package/dist/ui/canvas/server.d.ts +1 -1
  41. package/dist/ui/canvas/server.js.map +1 -1
  42. package/dist/ui/canvas.cjs.map +1 -1
  43. package/dist/ui/canvas.d.cts +3 -3
  44. package/dist/ui/canvas.d.ts +3 -3
  45. package/dist/ui/canvas.js.map +1 -1
  46. package/dist/ui/form.d.cts +1 -1
  47. package/dist/ui/form.d.ts +1 -1
  48. package/dist/ui/image.d.cts +1 -1
  49. package/dist/ui/image.d.ts +1 -1
  50. package/dist/ui/video.d.cts +2 -2
  51. package/dist/ui/video.d.ts +2 -2
  52. package/dist/{video-DbLL8yuc.d.cts → video-WR_TFO9a.d.cts} +1 -1
  53. package/dist/{video-DbLL8yuc.d.ts → video-WR_TFO9a.d.ts} +1 -1
  54. package/dist/webhook.d.cts +3 -3
  55. package/dist/webhook.d.ts +3 -3
  56. package/package.json +40 -24
@@ -1,10 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { QueryClient, InfiniteData } from '@tanstack/react-query';
3
- import { O as Order, d as Cart, e as CartItem, f as Product, l as OrderItem, m as Transaction, n as Fulfillment, o as Return } from './payload-types-BF8VVFt6.js';
2
+ import { QueryClient, InfiniteData, UseQueryResult } from '@tanstack/react-query';
3
+ import { O as Order, d as Cart, e as CartItem, f as Product, l as OrderItem, m as Transaction, n as Fulfillment, o as Return } from './payload-types-BrSYb-sh.cjs';
4
4
  import { Sort, Where } from 'payload';
5
5
  import { Metadata } from 'next';
6
- import { C as CollectionType } from './types-CZ1laT6s.js';
7
- import { P as PublicCollection, S as ServerCollection } from './const-R3AyqOHY.js';
6
+ import { C as CollectionType } from './types-CW4PaIL7.cjs';
7
+ import { P as PublicCollection, d as ServerCollection } from './const-Cz9Ki_I7.cjs';
8
8
 
9
9
  declare function resolveApiUrl(): string;
10
10
  interface ClientConfig {
@@ -88,12 +88,51 @@ interface ApiQueryOptions {
88
88
  page?: number;
89
89
  limit?: number;
90
90
  sort?: Sort;
91
+ /**
92
+ * Filter documents. Id-based relation filters (`where: { product: { equals: id } }`) are the
93
+ * most reliable pattern. Dotted-path relation filters (`where: { 'product.slug': { equals } }`)
94
+ * are Payload-native but may silently return empty when access control restricts the related
95
+ * document or when the relation is polymorphic. String shorthand (`where: { slug: 'x' }`)
96
+ * silently matches nothing — always use `{ slug: { equals: 'x' } }`.
97
+ */
91
98
  where?: Where;
99
+ /**
100
+ * Controls how deeply relationship fields are populated. This is the primary control for
101
+ * populating relationships like `category`, `images`, `brand`. The configured Payload default
102
+ * applies when unset.
103
+ */
92
104
  depth?: number;
93
105
  select?: Record<string, boolean>;
94
- /** Per-collection field selection for populated relationships (keyed by collection slug) */
106
+ /**
107
+ * Controls which fields are returned for already-populated relationships, keyed by collection
108
+ * slug. Does NOT control which relationships to populate — that is `depth`.
109
+ *
110
+ * @example
111
+ * // depth: 2 populates category; populate trims which fields come back
112
+ * populate: { categories: { title: true, slug: true } }
113
+ */
95
114
  populate?: Record<string, boolean | Record<string, boolean>>;
96
- /** Join field control: pagination/filter per join, or false to disable */
115
+ /**
116
+ * Controls Payload `type: 'join'` virtual reverse-relation fields only (pagination, sort,
117
+ * filter, count per join field, or `false` to disable all join-field population).
118
+ *
119
+ * Does NOT populate normal relationship fields like `category`, `images`, or `brand`.
120
+ * For normal relationship population use `depth` (and optionally `populate` for field
121
+ * selection).
122
+ *
123
+ * Pass `joins: false` to disable all join-field population — useful for lightweight list
124
+ * queries where join fields are not needed.
125
+ *
126
+ * @example
127
+ * // `article-authors` has a `type: 'join'` field `articles` (reverse-relation)
128
+ * joins: { articles: { limit: 10, sort: '-publishedAt' } }
129
+ *
130
+ * // depth: 2 populates product.category — joins has no effect on this
131
+ * depth: 2
132
+ *
133
+ * // Disable all join-field population
134
+ * joins: false
135
+ */
97
136
  joins?: Record<string, {
98
137
  limit?: number;
99
138
  page?: number;
@@ -998,6 +1037,151 @@ type ProductListingGroupsItem = {
998
1037
  type ProductListingGroupsResponse = {
999
1038
  docs: ProductListingGroupsItem[];
1000
1039
  };
1040
+ type ProductDetailParams = {
1041
+ slug: string;
1042
+ } | {
1043
+ id: string;
1044
+ };
1045
+ interface ProductDetailVariantOptionValue {
1046
+ optionId: string | number;
1047
+ valueId: string | number;
1048
+ value?: string | null;
1049
+ }
1050
+ interface ProductDetailVariant {
1051
+ id: string | number;
1052
+ optionKey: string;
1053
+ title?: string | null;
1054
+ displayName: string;
1055
+ sku?: string | null;
1056
+ price: number;
1057
+ compareAtPrice?: number | null;
1058
+ stock: number;
1059
+ reservedStock: number;
1060
+ isUnlimited: boolean;
1061
+ thumbnail?: unknown | null;
1062
+ images?: unknown[];
1063
+ optionValues: ProductDetailVariantOptionValue[];
1064
+ }
1065
+ interface ProductDetailOptionValue {
1066
+ id: string | number;
1067
+ value: string;
1068
+ swatchColor?: string | null;
1069
+ thumbnail?: unknown | null;
1070
+ }
1071
+ interface ProductDetailOption {
1072
+ id: string | number;
1073
+ title: string;
1074
+ values: ProductDetailOptionValue[];
1075
+ }
1076
+ interface ProductDetailBrand {
1077
+ id: string | number;
1078
+ name: string;
1079
+ slug?: string | null;
1080
+ logo?: unknown | null;
1081
+ }
1082
+ interface ProductDetailCategory {
1083
+ id: string | number;
1084
+ title: string;
1085
+ slug?: string | null;
1086
+ }
1087
+ interface ProductDetailTag {
1088
+ id: string | number;
1089
+ title: string;
1090
+ slug?: string | null;
1091
+ }
1092
+ interface ProductDetailImage {
1093
+ id: string | number;
1094
+ url?: string | null;
1095
+ alt?: string | null;
1096
+ width?: number | null;
1097
+ height?: number | null;
1098
+ }
1099
+ interface ProductDetailVideo {
1100
+ id: string | number;
1101
+ url?: string | null;
1102
+ }
1103
+ interface ProductDetailListing {
1104
+ minPrice?: number | null;
1105
+ maxPrice?: number | null;
1106
+ minCompareAtPrice?: number | null;
1107
+ maxCompareAtPrice?: number | null;
1108
+ isPriceRange?: boolean | null;
1109
+ primaryImage?: unknown | null;
1110
+ availableForSale?: boolean | null;
1111
+ selectionHintVariant?: unknown | null;
1112
+ }
1113
+ interface ProductDetail {
1114
+ product: {
1115
+ id: string | number;
1116
+ slug: string;
1117
+ title: string;
1118
+ subtitle?: string | null;
1119
+ description?: string | null;
1120
+ content?: unknown;
1121
+ publishedAt?: string | null;
1122
+ status: string;
1123
+ totalInventory: number;
1124
+ totalVariants: number;
1125
+ hasOnlyDefaultVariant: boolean;
1126
+ };
1127
+ variants: ProductDetailVariant[];
1128
+ options: ProductDetailOption[];
1129
+ brand: ProductDetailBrand | null;
1130
+ categories: ProductDetailCategory[];
1131
+ tags: ProductDetailTag[];
1132
+ images: ProductDetailImage[];
1133
+ videos: ProductDetailVideo[];
1134
+ listing: ProductDetailListing;
1135
+ }
1136
+ type ProductUpsertOptionValueInput = {
1137
+ id?: string;
1138
+ value: string;
1139
+ slug?: string;
1140
+ swatchColor?: string | null;
1141
+ thumbnail?: string | null;
1142
+ images?: string[];
1143
+ metadata?: unknown;
1144
+ };
1145
+ type ProductUpsertOptionInput = {
1146
+ id?: string;
1147
+ title: string;
1148
+ values: ProductUpsertOptionValueInput[];
1149
+ };
1150
+ type ProductUpsertVariantInput = {
1151
+ id?: string;
1152
+ optionValues?: Record<string, string> | string[];
1153
+ sku?: string | null;
1154
+ title?: string | null;
1155
+ price: number;
1156
+ compareAtPrice?: number | null;
1157
+ stock?: number;
1158
+ isUnlimited?: boolean;
1159
+ weight?: number | null;
1160
+ requiresShipping?: boolean;
1161
+ barcode?: string | null;
1162
+ externalId?: string | null;
1163
+ isActive?: boolean;
1164
+ thumbnail?: string | null;
1165
+ images?: string[];
1166
+ metadata?: unknown;
1167
+ };
1168
+ type ProductUpsertParams = {
1169
+ product: Record<string, unknown> & {
1170
+ id?: string;
1171
+ title?: string;
1172
+ };
1173
+ options?: ProductUpsertOptionInput[];
1174
+ variants?: ProductUpsertVariantInput[];
1175
+ };
1176
+ type ProductUpsertResponse = {
1177
+ ok: true;
1178
+ product: Product;
1179
+ } | {
1180
+ ok: false;
1181
+ failedEntity: 'product' | 'option' | 'option-value' | 'variant';
1182
+ failedIndex?: number;
1183
+ message: string;
1184
+ };
1001
1185
  declare class ProductApi extends BaseApi {
1002
1186
  constructor(options: ProductApiOptions);
1003
1187
  /**
@@ -1007,6 +1191,20 @@ declare class ProductApi extends BaseApi {
1007
1191
  */
1008
1192
  stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
1009
1193
  listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
1194
+ /**
1195
+ * Fetch full product detail by slug or id.
1196
+ * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1197
+ * `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
1198
+ * inspect `client.lastRequestId` against backend logs.
1199
+ */
1200
+ detail(params: ProductDetailParams): Promise<ProductDetail | null>;
1201
+ /**
1202
+ * Atomically create or update a product together with its options,
1203
+ * option-values, and variants in a single transaction. Mirrors Shopify's
1204
+ * `productSet` shape and is the canonical write path for the MCP
1205
+ * `product-upsert` tool.
1206
+ */
1207
+ upsert(params: ProductUpsertParams): Promise<ProductUpsertResponse>;
1010
1208
  }
1011
1209
 
1012
1210
  type DiscountApiOptions = ServerApiOptions;
@@ -1082,6 +1280,27 @@ type UpdateTransactionParams = {
1082
1280
  paymentKey?: string;
1083
1281
  amount?: number;
1084
1282
  };
1283
+ type ConfirmPaymentParams = {
1284
+ orderNumber?: string;
1285
+ pgPaymentId: string;
1286
+ pgProvider: string;
1287
+ pgOrderId?: string;
1288
+ amount: number;
1289
+ currency?: string;
1290
+ paymentMethod?: string;
1291
+ receiptUrl?: string;
1292
+ approvedAt?: string;
1293
+ providerStatus?: string;
1294
+ providerEventId?: string;
1295
+ confirmationSource?: 'provider_webhook' | 'provider_lookup' | 'provider_api_confirm' | 'manual_server';
1296
+ metadata?: Record<string, unknown>;
1297
+ };
1298
+ type ConfirmPaymentResponse = {
1299
+ orderId: string;
1300
+ transactionId: string;
1301
+ status: 'paid';
1302
+ alreadyConfirmed?: boolean;
1303
+ };
1085
1304
  type RestockAction = 'return_to_stock' | 'discard';
1086
1305
  type ReturnWithRefundItem = {
1087
1306
  orderItem: string | number;
@@ -1153,6 +1372,7 @@ declare class OrderApi extends BaseApi {
1153
1372
  createOrder(params: CreateOrderParams): Promise<Order>;
1154
1373
  updateOrder(params: UpdateOrderParams): Promise<Order>;
1155
1374
  updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
1375
+ confirmPayment(params: ConfirmPaymentParams): Promise<ConfirmPaymentResponse>;
1156
1376
  checkout(params: CheckoutParams): Promise<Order>;
1157
1377
  createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
1158
1378
  updateFulfillment(params: UpdateFulfillmentParams): Promise<Fulfillment>;
@@ -1174,6 +1394,8 @@ declare class ServerCommerceClient {
1174
1394
  readonly product: {
1175
1395
  stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
1176
1396
  listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
1397
+ detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
1398
+ upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
1177
1399
  };
1178
1400
  readonly cart: {
1179
1401
  get: (cartId: string) => Promise<Cart>;
@@ -1193,6 +1415,7 @@ declare class ServerCommerceClient {
1193
1415
  create: (params: CreateOrderParams) => Promise<Order>;
1194
1416
  update: (params: UpdateOrderParams) => Promise<Order>;
1195
1417
  updateTransaction: (params: UpdateTransactionParams) => Promise<Transaction>;
1418
+ confirmPayment: (params: ConfirmPaymentParams) => Promise<ConfirmPaymentResponse>;
1196
1419
  createFulfillment: (params: CreateFulfillmentParams) => Promise<Fulfillment>;
1197
1420
  updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
1198
1421
  bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
@@ -1348,9 +1571,15 @@ type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemov
1348
1571
  * Composes CollectionHooks + CustomerHooks into a single API surface.
1349
1572
  * All methods are delegated; no logic lives here.
1350
1573
  */
1574
+ interface ProductDetailCallable {
1575
+ product: {
1576
+ detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
1577
+ };
1578
+ }
1351
1579
  declare class QueryHooks extends CollectionHooks {
1352
1580
  private _customer;
1353
- constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth);
1581
+ private _commerce?;
1582
+ constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth, commerceClient?: ProductDetailCallable);
1354
1583
  useCustomerMe: CustomerHooks['useCustomerMe'];
1355
1584
  useCustomerLogin: CustomerHooks['useCustomerLogin'];
1356
1585
  useCustomerRegister: CustomerHooks['useCustomerRegister'];
@@ -1365,7 +1594,7 @@ declare class QueryHooks extends CollectionHooks {
1365
1594
  setCustomerData: CustomerHooks['setCustomerData'];
1366
1595
  useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
1367
1596
  options?: ProductListingGroupsQueryOptions;
1368
- }, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
1597
+ }, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
1369
1598
  useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
1370
1599
  options?: ProductListingGroupsQueryOptions;
1371
1600
  }, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
@@ -1389,6 +1618,19 @@ declare class QueryHooks extends CollectionHooks {
1389
1618
  pages?: number;
1390
1619
  staleTime?: number;
1391
1620
  }): Promise<void>;
1621
+ useProductDetail(params: {
1622
+ slug: string;
1623
+ } | {
1624
+ id: string;
1625
+ }, options?: {
1626
+ enabled?: boolean;
1627
+ }): UseQueryResult<ProductDetail | null>;
1628
+ useProductDetailBySlug(slug: string, options?: {
1629
+ enabled?: boolean;
1630
+ }): UseQueryResult<ProductDetail | null>;
1631
+ useProductDetailById(id: string, options?: {
1632
+ enabled?: boolean;
1633
+ }): UseQueryResult<ProductDetail | null>;
1392
1634
  }
1393
1635
 
1394
1636
  declare class ServerClient {
@@ -1417,4 +1659,4 @@ declare class ServerClient {
1417
1659
  */
1418
1660
  declare function createServerClient(options: ClientServerConfig): ServerClient;
1419
1661
 
1420
- export { isPermissionError as $, type AddItemParams as A, PermissionError as B, CustomerAuth as C, type DeepPartial as D, type ExtractArrayType as E, NotFoundError as F, GoneError as G, ConflictError as H, RateLimitError as I, isSDKError as J, isNetworkError as K, type ListingGroupsParams as L, isValidationError as M, NetworkError as N, isApiError as O, type ProductListingGroupsResponse as P, isConfigError as Q, type RemoveItemParams as R, type StockCheckParams as S, TimeoutError as T, type UpdateItemParams as U, type ValidateDiscountParams as V, isTimeoutError as W, isGoneError as X, isServiceUnavailableError as Y, isUsageLimitError as Z, isAuthError as _, type CustomerAuthOptions as a, type CustomerRegisterData as a$, isNotFoundError as a0, isConflictError as a1, isRateLimitError as a2, createAuthError as a3, createPermissionError as a4, createNotFoundError as a5, createConflictError as a6, createRateLimitError as a7, createServerClient as a8, ServerClient as a9, type ShippingApiOptions as aA, CartApi as aB, type CartApiOptions as aC, ProductApi as aD, type ProductApiOptions as aE, type ProductListingGroupSummary as aF, type ProductListingGroupsItem as aG, type StockCheckResult as aH, CollectionQueryBuilder as aI, ServerCollectionQueryBuilder as aJ, type ReadOnlyQueryBuilder as aK, CollectionClient as aL, ServerCollectionClient as aM, type GenerateMetadataOptions as aN, ServerCommerceClient as aO, type ServerCommerceClientOptions as aP, type CommunityClientOptions as aQ, type CommunityPost as aR, ModerationApi as aS, type ModerationApiOptions as aT, type CommunityBan as aU, type BanCustomerParams as aV, type UnbanCustomerParams as aW, type CustomerAuthResponse as aX, type CustomerRefreshResponse as aY, type CustomerRegisterResponse as aZ, type CustomerProfile as a_, resolveApiUrl as aa, type ClientServerConfig as ab, type ClientMetadata as ac, type PaginationMeta as ad, type PayloadMutationResponse as ae, BaseApi as af, type ServerApiOptions as ag, type RequestOptions as ah, OrderApi as ai, type OrderApiOptions as aj, type CustomerSnapshot as ak, type ReturnReason as al, type ReturnItem as am, type CreateOrderParams as an, type UpdateOrderParams as ao, type BulkImportFulfillmentsParams as ap, type BulkImportFulfillmentsResponse as aq, type CreateReturnParams as ar, type UpdateReturnParams as as, type UpdateTransactionParams as at, type CreateFulfillmentParams as au, type ReturnWithRefundParams as av, type UpdateFulfillmentParams as aw, DiscountApi as ax, type DiscountApiOptions as ay, ShippingApi as az, type StockCheckResponse as b, type CustomerLoginData as b0, type UpdateProfileData as b1, type CollectionQueryParams as b2, type CollectionDetailQueryParams as b3, type CollectionInfiniteQueryParams as b4, type QueryOptions as b5, type SuspenseQueryOptions as b6, type InfiniteQueryOptions as b7, type SuspenseInfiniteQueryOptions as b8, CollectionHooks as b9, CustomerHooks as ba, QueryHooks as bb, type ProductOptionValueShape as bc, type ProductOptionShape as bd, type ProductVariantShape as be, type ProductListingProductShape as bf, type ProductOptionMatrixValue as bg, type ProductOptionMatrixOption as bh, type ProductOptionMatrixVariant as bi, type ProductOptionMatrix as bj, type ProductListingProjection as bk, type ProductListingGroup as bl, buildProductOptionMatrix as bm, getSelectedValueByOptionId as bn, normalizeSelectedValueIds as bo, getAvailableOptionValues as bp, resolveVariantForSelection as bq, buildProductListingProjection as br, buildProductListingGroupsByOption as bs, type ApplyDiscountParams as c, type RemoveDiscountParams as d, type ClearCartParams as e, type CheckoutParams as f, type PayloadFindResponse as g, type ValidateDiscountResult as h, type CalculateShippingParams as i, type CalculateShippingResult as j, type ApiQueryOptions as k, type ProductListingGroupsQueryOptions as l, type ClientConfig as m, CommunityClient as n, type ReadOnlyQueryHooks as o, ReadOnlyCollectionClient as p, type ClientState as q, type DebugConfig as r, type RetryConfig as s, SDKError as t, ValidationError as u, ApiError as v, ConfigError as w, ServiceUnavailableError as x, UsageLimitError as y, AuthError as z };
1662
+ export { type CustomerAuthResponse as $, type AddItemParams as A, type BanCustomerParams as B, CustomerAuth as C, type ClientMetadata as D, type ClientServerConfig as E, CollectionClient as F, type CollectionDetailQueryParams as G, CollectionHooks as H, type CollectionInfiniteQueryParams as I, CollectionQueryBuilder as J, type CollectionQueryParams as K, type ListingGroupsParams as L, type CommunityBan as M, type CommunityClientOptions as N, type CommunityPost as O, type ProductListingGroupsResponse as P, ConfigError as Q, type RemoveItemParams as R, type StockCheckParams as S, type ConfirmPaymentParams as T, type UpdateItemParams as U, type ValidateDiscountParams as V, type ConfirmPaymentResponse as W, ConflictError as X, type CreateFulfillmentParams as Y, type CreateOrderParams as Z, type CreateReturnParams as _, type CustomerAuthOptions as a, type ServerCommerceClientOptions as a$, CustomerHooks as a0, type CustomerLoginData as a1, type CustomerProfile as a2, type CustomerRefreshResponse as a3, type CustomerRegisterData as a4, type CustomerRegisterResponse as a5, type CustomerSnapshot as a6, type DebugConfig as a7, type DeepPartial as a8, DiscountApi as a9, type ProductListingGroup as aA, type ProductListingGroupSummary as aB, type ProductListingGroupsItem as aC, type ProductListingProductShape as aD, type ProductListingProjection as aE, type ProductOptionMatrix as aF, type ProductOptionMatrixOption as aG, type ProductOptionMatrixValue as aH, type ProductOptionMatrixVariant as aI, type ProductOptionShape as aJ, type ProductOptionValueShape as aK, type ProductVariantShape as aL, QueryHooks as aM, type QueryOptions as aN, RateLimitError as aO, type ReadOnlyQueryBuilder as aP, type RequestOptions as aQ, type RetryConfig as aR, type ReturnItem as aS, type ReturnReason as aT, type ReturnWithRefundParams as aU, SDKError as aV, type ServerApiOptions as aW, ServerClient as aX, ServerCollectionClient as aY, ServerCollectionQueryBuilder as aZ, ServerCommerceClient as a_, type DiscountApiOptions as aa, type ExtractArrayType as ab, type GenerateMetadataOptions as ac, GoneError as ad, type InfiniteQueryOptions as ae, ModerationApi as af, type ModerationApiOptions as ag, NetworkError as ah, NotFoundError as ai, OrderApi as aj, type OrderApiOptions as ak, type PaginationMeta as al, type PayloadMutationResponse as am, PermissionError as an, ProductApi as ao, type ProductApiOptions as ap, type ProductDetailBrand as aq, type ProductDetailCategory as ar, type ProductDetailImage as as, type ProductDetailListing as at, type ProductDetailOption as au, type ProductDetailOptionValue as av, type ProductDetailTag as aw, type ProductDetailVariant as ax, type ProductDetailVariantOptionValue as ay, type ProductDetailVideo as az, type StockCheckResponse as b, ServiceUnavailableError as b0, ShippingApi as b1, type ShippingApiOptions as b2, type StockCheckResult as b3, type SuspenseInfiniteQueryOptions as b4, type SuspenseQueryOptions as b5, TimeoutError as b6, type UnbanCustomerParams as b7, type UpdateFulfillmentParams as b8, type UpdateOrderParams as b9, isServiceUnavailableError as bA, isTimeoutError as bB, isUsageLimitError as bC, isValidationError as bD, normalizeSelectedValueIds as bE, resolveApiUrl as bF, resolveVariantForSelection as bG, type UpdateProfileData as ba, type UpdateReturnParams as bb, type UpdateTransactionParams as bc, UsageLimitError as bd, ValidationError as be, buildProductListingGroupsByOption as bf, buildProductListingProjection as bg, buildProductOptionMatrix as bh, createAuthError as bi, createConflictError as bj, createNotFoundError as bk, createPermissionError as bl, createRateLimitError as bm, createServerClient as bn, getAvailableOptionValues as bo, getSelectedValueByOptionId as bp, isApiError as bq, isAuthError as br, isConfigError as bs, isConflictError as bt, isGoneError as bu, isNetworkError as bv, isNotFoundError as bw, isPermissionError as bx, isRateLimitError as by, isSDKError as bz, type ProductDetailParams as c, type ProductDetail as d, type ApplyDiscountParams as e, type RemoveDiscountParams as f, type ClearCartParams as g, type CheckoutParams as h, type PayloadFindResponse as i, type ValidateDiscountResult as j, type CalculateShippingParams as k, type CalculateShippingResult as l, type ApiQueryOptions as m, type ProductListingGroupsQueryOptions as n, CommunityClient as o, type ReadOnlyQueryHooks as p, ReadOnlyCollectionClient as q, type ClientState as r, type ClientConfig as s, ApiError as t, AuthError as u, BaseApi as v, type BulkImportFulfillmentsParams as w, type BulkImportFulfillmentsResponse as x, CartApi as y, type CartApiOptions as z };
package/dist/server.cjs CHANGED
@@ -1374,6 +1374,32 @@ var ProductApi = class extends BaseApi {
1374
1374
  params
1375
1375
  );
1376
1376
  }
1377
+ /**
1378
+ * Fetch full product detail by slug or id.
1379
+ * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1380
+ * `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
1381
+ * inspect `client.lastRequestId` against backend logs.
1382
+ */
1383
+ async detail(params) {
1384
+ try {
1385
+ return await this.request("/api/products/detail", params);
1386
+ } catch (err) {
1387
+ if (err instanceof NotFoundError) return null;
1388
+ throw err;
1389
+ }
1390
+ }
1391
+ /**
1392
+ * Atomically create or update a product together with its options,
1393
+ * option-values, and variants in a single transaction. Mirrors Shopify's
1394
+ * `productSet` shape and is the canonical write path for the MCP
1395
+ * `product-upsert` tool.
1396
+ */
1397
+ upsert(params) {
1398
+ return this.request(
1399
+ "/api/products/upsert",
1400
+ params
1401
+ );
1402
+ }
1377
1403
  };
1378
1404
 
1379
1405
  // src/core/api/discount-api.ts
@@ -1410,6 +1436,13 @@ var OrderApi = class extends BaseApi {
1410
1436
  updateTransaction(params) {
1411
1437
  return this.request("/api/transactions/update", params);
1412
1438
  }
1439
+ confirmPayment(params) {
1440
+ return this.request(
1441
+ "/api/orders/confirm-payment",
1442
+ params,
1443
+ params.providerEventId ? { headers: { "X-Idempotency-Key": params.providerEventId } } : void 0
1444
+ );
1445
+ }
1413
1446
  checkout(params) {
1414
1447
  return this.request("/api/orders/checkout", params);
1415
1448
  }
@@ -1459,7 +1492,9 @@ var ServerCommerceClient = class {
1459
1492
  const orderApi = new OrderApi(serverOptions);
1460
1493
  this.product = {
1461
1494
  stockCheck: productApi.stockCheck.bind(productApi),
1462
- listingGroups: productApi.listingGroups.bind(productApi)
1495
+ listingGroups: productApi.listingGroups.bind(productApi),
1496
+ detail: productApi.detail.bind(productApi),
1497
+ upsert: productApi.upsert.bind(productApi)
1463
1498
  };
1464
1499
  this.cart = {
1465
1500
  get: cartApi.getCart.bind(cartApi),
@@ -1475,6 +1510,7 @@ var ServerCommerceClient = class {
1475
1510
  create: orderApi.createOrder.bind(orderApi),
1476
1511
  update: orderApi.updateOrder.bind(orderApi),
1477
1512
  updateTransaction: orderApi.updateTransaction.bind(orderApi),
1513
+ confirmPayment: orderApi.confirmPayment.bind(orderApi),
1478
1514
  createFulfillment: orderApi.createFulfillment.bind(orderApi),
1479
1515
  updateFulfillment: orderApi.updateFulfillment.bind(orderApi),
1480
1516
  bulkImportFulfillments: orderApi.bulkImportFulfillments.bind(orderApi),
@@ -1545,10 +1581,24 @@ var customerKeys = {
1545
1581
  };
1546
1582
  var productKeys = {
1547
1583
  listingGroups: (options) => ["products", "listing-groups", "list", options],
1548
- listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options]
1584
+ listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options],
1585
+ detail: (params) => ["products", "detail", params],
1586
+ detailAll: () => ["products", "detail"]
1549
1587
  };
1550
1588
 
1551
1589
  // src/core/query/collection-hooks.ts
1590
+ var PRODUCT_DETAIL_INVALIDATING_COLLECTIONS = /* @__PURE__ */ new Set([
1591
+ "products",
1592
+ "product-variants",
1593
+ "product-options",
1594
+ "product-option-values",
1595
+ "product-categories",
1596
+ "product-tags",
1597
+ "product-collections",
1598
+ "brands",
1599
+ "brand-logos",
1600
+ "images"
1601
+ ]);
1552
1602
  var DEFAULT_PAGE_SIZE = 20;
1553
1603
  var CollectionHooks = class {
1554
1604
  constructor(queryClient, collectionClient) {
@@ -1706,6 +1756,9 @@ var CollectionHooks = class {
1706
1756
  this.queryClient.invalidateQueries({
1707
1757
  queryKey: collectionKeys(collection).all
1708
1758
  });
1759
+ if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
1760
+ this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
1761
+ }
1709
1762
  options?.onSuccess?.(data);
1710
1763
  },
1711
1764
  onError: options?.onError,
@@ -1726,6 +1779,9 @@ var CollectionHooks = class {
1726
1779
  this.queryClient.invalidateQueries({
1727
1780
  queryKey: collectionKeys(collection).all
1728
1781
  });
1782
+ if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
1783
+ this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
1784
+ }
1729
1785
  options?.onSuccess?.(data);
1730
1786
  },
1731
1787
  onError: options?.onError,
@@ -1742,6 +1798,9 @@ var CollectionHooks = class {
1742
1798
  this.queryClient.invalidateQueries({
1743
1799
  queryKey: collectionKeys(collection).all
1744
1800
  });
1801
+ if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
1802
+ this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
1803
+ }
1745
1804
  options?.onSuccess?.(data);
1746
1805
  },
1747
1806
  onError: options?.onError,
@@ -1894,7 +1953,7 @@ var CustomerHooks = class {
1894
1953
 
1895
1954
  // src/core/query/query-hooks.ts
1896
1955
  var QueryHooks = class extends CollectionHooks {
1897
- constructor(queryClient, collectionClient, customerAuth) {
1956
+ constructor(queryClient, collectionClient, customerAuth, commerceClient) {
1898
1957
  super(queryClient, collectionClient);
1899
1958
  // --- Customer hooks delegation ---
1900
1959
  this.useCustomerMe = (...args) => this._customer.useCustomerMe(...args);
@@ -1911,6 +1970,7 @@ var QueryHooks = class extends CollectionHooks {
1911
1970
  this.getCustomerData = () => this._customer.getCustomerData();
1912
1971
  this.setCustomerData = (data) => this._customer.setCustomerData(data);
1913
1972
  this._customer = new CustomerHooks(queryClient, customerAuth);
1973
+ this._commerce = commerceClient;
1914
1974
  }
1915
1975
  useProductListingGroupsQuery(params, options) {
1916
1976
  const queryOptions = params.options;
@@ -2004,6 +2064,21 @@ var QueryHooks = class extends CollectionHooks {
2004
2064
  staleTime: options?.staleTime
2005
2065
  });
2006
2066
  }
2067
+ useProductDetail(params, options) {
2068
+ const discriminator = "slug" in params ? params.slug : params.id;
2069
+ const enabled = options?.enabled !== false && Boolean(discriminator);
2070
+ return (0, import_react_query4.useQuery)({
2071
+ queryKey: productKeys.detail(params),
2072
+ queryFn: () => this._commerce.product.detail(params),
2073
+ enabled
2074
+ });
2075
+ }
2076
+ useProductDetailBySlug(slug, options) {
2077
+ return this.useProductDetail({ slug }, options);
2078
+ }
2079
+ useProductDetailById(id, options) {
2080
+ return this.useProductDetail({ id }, options);
2081
+ }
2007
2082
  };
2008
2083
 
2009
2084
  // src/core/client/client.server.ts
@@ -2054,7 +2129,7 @@ var ServerClient = class {
2054
2129
  onRequestId
2055
2130
  );
2056
2131
  this.queryClient = getQueryClient();
2057
- this.query = new QueryHooks(this.queryClient, this.collections);
2132
+ this.query = new QueryHooks(this.queryClient, this.collections, void 0, this.commerce);
2058
2133
  }
2059
2134
  getState() {
2060
2135
  return { ...this.state };