@01.software/sdk 0.44.0 → 0.46.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 (80) hide show
  1. package/CHANGELOG.md +366 -2
  2. package/MIGRATION.md +108 -10
  3. package/README.md +486 -98
  4. package/dist/{server-nXOezi4b.d.cts → catalog-mappers-sIshKNb3.d.cts} +14 -3
  5. package/dist/{server-nXOezi4b.d.ts → catalog-mappers-sIshKNb3.d.ts} +14 -3
  6. package/dist/client.cjs +2693 -345
  7. package/dist/client.cjs.map +1 -1
  8. package/dist/client.d.cts +10 -7
  9. package/dist/client.d.ts +10 -7
  10. package/dist/client.js +2693 -345
  11. package/dist/client.js.map +1 -1
  12. package/dist/{collection-client-DWooaiTr.d.ts → collection-client-D6kKrYdq.d.ts} +8 -5
  13. package/dist/{collection-client-Dyl-CDcj.d.cts → collection-client-DolMjCoC.d.cts} +8 -5
  14. package/dist/{const-pGDnsy0o.d.ts → const-BAG0MH0u.d.cts} +13 -10
  15. package/dist/{const-1vleZ6ov.d.cts → const-CaPq2AE4.d.ts} +13 -10
  16. package/dist/errors.cjs +74 -1
  17. package/dist/errors.cjs.map +1 -1
  18. package/dist/errors.d.cts +38 -1
  19. package/dist/errors.d.ts +38 -1
  20. package/dist/errors.js +74 -1
  21. package/dist/errors.js.map +1 -1
  22. package/dist/{index-DUNySyxV.d.ts → index-BNICJxBL.d.ts} +4 -4
  23. package/dist/{index-a6g7vqAD.d.cts → index-YGrZrxNn.d.cts} +4 -4
  24. package/dist/index.cjs +2754 -368
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +18 -19
  27. package/dist/index.d.ts +18 -19
  28. package/dist/index.js +2754 -368
  29. package/dist/index.js.map +1 -1
  30. package/dist/{payload-types-CDsuOEfM.d.cts → payload-types-CJZuXcgF.d.cts} +6671 -4001
  31. package/dist/{payload-types-CDsuOEfM.d.ts → payload-types-CJZuXcgF.d.ts} +6671 -4001
  32. package/dist/query.cjs +558 -101
  33. package/dist/query.cjs.map +1 -1
  34. package/dist/query.d.cts +43 -45
  35. package/dist/query.d.ts +43 -45
  36. package/dist/query.js +558 -101
  37. package/dist/query.js.map +1 -1
  38. package/dist/realtime.cjs.map +1 -1
  39. package/dist/realtime.d.cts +2 -2
  40. package/dist/realtime.d.ts +2 -2
  41. package/dist/realtime.js.map +1 -1
  42. package/dist/server.cjs +2343 -437
  43. package/dist/server.cjs.map +1 -1
  44. package/dist/server.d.cts +11 -10
  45. package/dist/server.d.ts +11 -10
  46. package/dist/server.js +2343 -437
  47. package/dist/server.js.map +1 -1
  48. package/dist/storefront-cache.cjs +65 -1
  49. package/dist/storefront-cache.cjs.map +1 -1
  50. package/dist/storefront-cache.js +65 -1
  51. package/dist/storefront-cache.js.map +1 -1
  52. package/dist/types-BC6rVmJa.d.ts +47 -0
  53. package/dist/{types-CDND3hzq.d.cts → types-C60vHIkY.d.ts} +1134 -509
  54. package/dist/types-D5p7-m1l.d.cts +47 -0
  55. package/dist/{types-Dt9FJisi.d.ts → types-xlqBeW2N.d.cts} +1134 -509
  56. package/dist/ui/canvas/server.cjs +244 -2
  57. package/dist/ui/canvas/server.cjs.map +1 -1
  58. package/dist/ui/canvas/server.d.cts +27 -1
  59. package/dist/ui/canvas/server.d.ts +27 -1
  60. package/dist/ui/canvas/server.js +244 -2
  61. package/dist/ui/canvas/server.js.map +1 -1
  62. package/dist/ui/canvas.cjs +419 -103
  63. package/dist/ui/canvas.cjs.map +1 -1
  64. package/dist/ui/canvas.d.cts +19 -7
  65. package/dist/ui/canvas.d.ts +19 -7
  66. package/dist/ui/canvas.js +419 -103
  67. package/dist/ui/canvas.js.map +1 -1
  68. package/dist/ui/form.d.cts +1 -1
  69. package/dist/ui/form.d.ts +1 -1
  70. package/dist/ui/video.d.cts +1 -1
  71. package/dist/ui/video.d.ts +1 -1
  72. package/dist/webhook.cjs +2 -1
  73. package/dist/webhook.cjs.map +1 -1
  74. package/dist/webhook.d.cts +4 -4
  75. package/dist/webhook.d.ts +4 -4
  76. package/dist/webhook.js +2 -1
  77. package/dist/webhook.js.map +1 -1
  78. package/package.json +10 -9
  79. package/dist/types-SoXsbKhj.d.cts +0 -33
  80. package/dist/types-oiae_LMm.d.ts +0 -33
package/dist/query.cjs CHANGED
@@ -24,6 +24,7 @@ __export(query_exports, {
24
24
  CustomerHooks: () => CustomerHooks,
25
25
  QueryHooks: () => QueryHooks,
26
26
  RealtimeConnection: () => RealtimeConnection,
27
+ canonicalProductListingGroupsQueryOptions: () => canonicalProductListingGroupsQueryOptions,
27
28
  collectionKeys: () => collectionKeys,
28
29
  createQueryHooks: () => createQueryHooks,
29
30
  createServerQueryHooks: () => createServerQueryHooks,
@@ -120,8 +121,14 @@ function canonicalProductListingPageParams(params = {}, limit) {
120
121
  canonicalFilters.availableForSale = filters.availableForSale;
121
122
  }
122
123
  const search = params.search?.trim();
124
+ const market = params.market?.trim();
123
125
  return {
124
126
  mode: params.mode ?? "catalog",
127
+ ...market && { market },
128
+ ...params.locale != null && { locale: params.locale },
129
+ ...params.fallbackLocale !== void 0 && {
130
+ fallbackLocale: params.fallbackLocale
131
+ },
125
132
  ...params.page != null && { page: params.page },
126
133
  ...limit != null ? { limit } : params.limit != null ? { limit: params.limit } : {},
127
134
  ...search && { search },
@@ -130,13 +137,50 @@ function canonicalProductListingPageParams(params = {}, limit) {
130
137
  filters: canonicalFilters
131
138
  },
132
139
  ...params.basePath != null && { basePath: params.basePath },
133
- ...params.trailingSlash != null && { trailingSlash: params.trailingSlash },
140
+ ...params.trailingSlash != null && {
141
+ trailingSlash: params.trailingSlash
142
+ },
134
143
  ...params.emit != null && { emit: params.emit },
135
144
  ...params.preferCompleteVariantFromHint != null && {
136
145
  preferCompleteVariantFromHint: params.preferCompleteVariantFromHint
137
146
  }
138
147
  };
139
148
  }
149
+ function canonicalMarket(value) {
150
+ const market = value?.trim();
151
+ return market || void 0;
152
+ }
153
+ function canonicalProductListingGroupsQueryOptions(options, limit) {
154
+ const { market: rawMarket, ...rest } = options ?? {};
155
+ const market = canonicalMarket(rawMarket);
156
+ const canonical = {
157
+ ...rest,
158
+ ...limit !== void 0 ? { limit } : {},
159
+ ...market ? { market } : {}
160
+ };
161
+ return Object.keys(canonical).length > 0 ? canonical : void 0;
162
+ }
163
+ function canonicalProductDetailParams(params) {
164
+ const market = params.market?.trim();
165
+ const localeOptions = {
166
+ ...params.locale != null && { locale: params.locale },
167
+ ...params.fallbackLocale !== void 0 && {
168
+ fallbackLocale: params.fallbackLocale
169
+ }
170
+ };
171
+ if ("slug" in params) {
172
+ return {
173
+ slug: params.slug,
174
+ ...market ? { market } : {},
175
+ ...localeOptions
176
+ };
177
+ }
178
+ return {
179
+ id: params.id,
180
+ ...market ? { market } : {},
181
+ ...localeOptions
182
+ };
183
+ }
140
184
  function collectionKeys(collection) {
141
185
  return {
142
186
  all: [collection],
@@ -157,22 +201,36 @@ var customerKeys = {
157
201
  me: () => ["customer", "me"]
158
202
  };
159
203
  var productKeys = {
160
- listingGroups: (options) => ["products", "listing-groups", "list", options],
161
- listingGroupsCatalog: (options) => ["products", "listing-groups", "catalog", options],
204
+ listingGroups: (options) => [
205
+ "products",
206
+ "listing-groups",
207
+ "list",
208
+ canonicalProductListingGroupsQueryOptions(options)
209
+ ],
210
+ listingGroupsCatalog: (options) => [
211
+ "products",
212
+ "listing-groups",
213
+ "catalog",
214
+ canonicalProductListingGroupsQueryOptions(options)
215
+ ],
162
216
  listingGroupsInfinite: (options, pageSize) => [
163
217
  "products",
164
218
  "listing-groups",
165
219
  "infinite",
166
- pageSize === void 0 ? options : { ...options, limit: pageSize }
220
+ canonicalProductListingGroupsQueryOptions(options, pageSize)
167
221
  ],
168
222
  listingGroupsCatalogInfinite: (options, pageSize) => [
169
223
  "products",
170
224
  "listing-groups",
171
225
  "catalog",
172
226
  "infinite",
173
- pageSize === void 0 ? options : { ...options, limit: pageSize }
227
+ canonicalProductListingGroupsQueryOptions(options, pageSize)
228
+ ],
229
+ listingPage: (params) => [
230
+ "products",
231
+ "listing-page",
232
+ canonicalProductListingPageParams(params)
174
233
  ],
175
- listingPage: (params) => ["products", "listing-page", canonicalProductListingPageParams(params)],
176
234
  listingPageInfinite: (params, pageSize) => [
177
235
  "products",
178
236
  "listing-page",
@@ -182,7 +240,7 @@ var productKeys = {
182
240
  pageSize
183
241
  )
184
242
  ],
185
- detail: (params) => ["products", "detail", params],
243
+ detail: (params) => ["products", "detail", canonicalProductDetailParams(params)],
186
244
  detailAll: () => ["products", "detail"]
187
245
  };
188
246
 
@@ -471,10 +529,74 @@ var SDKError = class extends Error {
471
529
  details: this.details,
472
530
  userMessage: this.userMessage,
473
531
  suggestion: this.suggestion,
474
- ...this.requestId !== void 0 && { requestId: this.requestId }
532
+ ...this.requestId !== void 0 && { requestId: this.requestId },
533
+ ...this.kind !== void 0 && { kind: this.kind },
534
+ ...this.reason !== void 0 && { reason: this.reason },
535
+ ...this.rawReason !== void 0 && { rawReason: this.rawReason },
536
+ ...this.retryable !== void 0 && { retryable: this.retryable },
537
+ ...this.retryAfter !== void 0 && { retryAfter: this.retryAfter }
475
538
  };
476
539
  }
477
540
  };
541
+ var COMMERCE_ERROR_CODES = [
542
+ "validation_failed",
543
+ "unauthorized",
544
+ "forbidden",
545
+ "token_expired",
546
+ "origin_not_allowed",
547
+ "server_credentials_required",
548
+ "not_found",
549
+ "conflict",
550
+ "cart_revision_conflict",
551
+ "rate_limit_exceeded",
552
+ "usage_limit_exceeded",
553
+ "service_unavailable",
554
+ "idempotency_conflict",
555
+ "idempotency_in_progress",
556
+ "cart_not_active",
557
+ "cart_locked",
558
+ "cart_empty",
559
+ "cart_market_unavailable",
560
+ "cart_market_mismatch",
561
+ "checkout_not_open",
562
+ "payment_slot_held",
563
+ "reservation_expired",
564
+ "payment_session_not_cancelable",
565
+ "provider_identity_mismatch",
566
+ "provider_unavailable",
567
+ "lock_timeout",
568
+ "price_changed",
569
+ "pricing_fact_in_use",
570
+ "insufficient_stock",
571
+ "market_not_found",
572
+ "market_shipping_currency_unsupported",
573
+ "missing_market_rate",
574
+ "missing_shipping_amount",
575
+ "no_enabled_payment_provider",
576
+ "product_market_unavailable",
577
+ "unsupported_currency",
578
+ "missing_price_row",
579
+ "payment_provider_currency_unsupported",
580
+ "discount_code_not_found",
581
+ "discount_not_started",
582
+ "discount_expired",
583
+ "discount_usage_limit",
584
+ "discount_per_customer_limit",
585
+ "discount_customer_required",
586
+ "discount_first_order_only",
587
+ "discount_customer_not_eligible",
588
+ "discount_customer_excluded",
589
+ "discount_items_required",
590
+ "discount_product_not_eligible",
591
+ "discount_product_excluded",
592
+ "discount_min_order_amount",
593
+ "discount_currency_scope_required",
594
+ "discount_allocation_method_unsupported",
595
+ "currency_mismatch"
596
+ ];
597
+ var COMMERCE_ERROR_CODE_SET = new Set(
598
+ COMMERCE_ERROR_CODES
599
+ );
478
600
  var ConfigError = class extends SDKError {
479
601
  constructor(message, details, userMessage, suggestion) {
480
602
  super("CONFIG_ERROR", message, void 0, details, userMessage, suggestion);
@@ -599,100 +721,387 @@ var CustomerHooks = class {
599
721
  // src/core/query/query-hooks.ts
600
722
  var import_react_query4 = require("@tanstack/react-query");
601
723
 
602
- // src/core/api/endpoints.ts
603
- var COMMERCE_ENDPOINTS = {
724
+ // src/core/internal/utils/query-string.ts
725
+ function normalizedMarket(value) {
726
+ const market = value?.trim();
727
+ return market || void 0;
728
+ }
729
+ function appendProductLocaleSearchParams(search, options) {
730
+ if (options?.locale) search.set("locale", options.locale);
731
+ if (options?.fallbackLocale !== void 0) {
732
+ search.set(
733
+ "fallbackLocale",
734
+ options.fallbackLocale === false ? "none" : options.fallbackLocale
735
+ );
736
+ }
737
+ }
738
+ function appendListingGroupsQuerySearchParams(search, options) {
739
+ const market = normalizedMarket(options?.market);
740
+ if (market) search.set("market", market);
741
+ appendProductLocaleSearchParams(search, options);
742
+ if (options?.page != null) search.set("page", String(options.page));
743
+ if (options?.limit != null) search.set("limit", String(options.limit));
744
+ if (options?.sort != null) {
745
+ const sort = options.sort;
746
+ search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
747
+ }
748
+ if (options?.where != null) {
749
+ search.set("whereJson", JSON.stringify(options.where));
750
+ }
751
+ }
752
+ function listingPageSearchParams(options) {
753
+ const search = new URLSearchParams();
754
+ appendListingGroupsQuerySearchParams(search, options);
755
+ return search.toString();
756
+ }
757
+
758
+ // ../../internal/http-contracts/src/index.ts
759
+ var operationBrand = /* @__PURE__ */ Symbol("sdk-http-operation");
760
+ var operation = (collection, method, path) => Object.freeze({
761
+ [operationBrand]: true,
762
+ collection,
763
+ method,
764
+ path
765
+ });
766
+ var COMMERCE_ENDPOINT_OPERATIONS = {
767
+ products: {
768
+ detail: operation("products", "get", "/detail"),
769
+ detailCatalog: operation("products", "get", "/detail/catalog"),
770
+ listingGroups: operation("products", "get", "/listing-groups"),
771
+ listingGroupsCatalog: operation(
772
+ "products",
773
+ "get",
774
+ "/listing-groups/catalog"
775
+ ),
776
+ listingGroupsQuery: operation("products", "post", "/listing-groups/query"),
777
+ listingGroupsQueryGet: operation(
778
+ "products",
779
+ "get",
780
+ "/listing-groups/query"
781
+ ),
782
+ listingGroupsQueryCatalog: operation(
783
+ "products",
784
+ "get",
785
+ "/listing-groups/query/catalog"
786
+ ),
787
+ stockCheck: operation("products", "post", "/stock-check"),
788
+ stockSnapshot: operation("products", "get", "/stock"),
789
+ upsert: operation("products", "post", "/upsert")
790
+ },
604
791
  orders: {
605
- create: "/api/orders/create",
606
- update: "/api/orders/update",
607
- confirmPayment: "/api/orders/confirm-payment",
608
- byPayment: "/api/orders/by-payment",
609
- cancel: "/api/orders/cancel",
610
- resolveCancelRefund: "/api/orders/resolve-cancel-refund",
611
- checkout: "/api/orders/checkout",
612
- createFulfillment: "/api/orders/create-fulfillment",
613
- updateFulfillment: "/api/orders/update-fulfillment"
792
+ create: operation("orders", "post", "/create"),
793
+ update: operation("orders", "post", "/update"),
794
+ confirmPayment: operation("orders", "post", "/confirm-payment"),
795
+ byPayment: operation("orders", "get", "/by-payment"),
796
+ cancel: operation("orders", "post", "/cancel"),
797
+ resolveCancelRefund: operation("orders", "post", "/resolve-cancel-refund"),
798
+ checkout: operation("orders", "post", "/checkout"),
799
+ createFulfillment: operation("orders", "post", "/create-fulfillment"),
800
+ updateFulfillment: operation("orders", "post", "/update-fulfillment")
801
+ },
802
+ checkouts: {
803
+ detail: operation("checkouts", "post", "/detail"),
804
+ query: operation("checkouts", "post", "/query")
614
805
  },
615
806
  transactions: {
616
- update: "/api/transactions/update"
807
+ update: operation("transactions", "post", "/update")
617
808
  },
618
809
  returns: {
619
- create: "/api/returns/create",
620
- update: "/api/returns/update",
621
- returnRefund: "/api/returns/return-refund"
810
+ create: operation("returns", "post", "/create"),
811
+ update: operation("returns", "post", "/update"),
812
+ returnRefund: operation("returns", "post", "/return-refund")
622
813
  },
623
814
  fulfillmentOrders: {
624
- prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
815
+ prepare: operation(
816
+ "fulfillment-orders",
817
+ "post",
818
+ "/prepare-fulfillment-order"
819
+ )
625
820
  },
626
821
  fulfillments: {
627
- bulkImport: "/api/fulfillments/bulk-import"
822
+ bulkImport: operation("fulfillments", "post", "/bulk-import")
628
823
  },
629
824
  carts: {
630
- mine: "/api/carts/mine",
631
- merge: "/api/carts/merge",
632
- addItem: "/api/carts/add-item",
633
- updateItem: "/api/carts/update-item",
634
- removeItem: "/api/carts/remove-item",
635
- applyDiscount: "/api/carts/apply-discount",
636
- removeDiscount: "/api/carts/remove-discount",
637
- clear: "/api/carts/clear"
825
+ create: operation("carts", "post", "/create"),
826
+ retrieve: operation("carts", "post", "/retrieve"),
827
+ mine: operation("carts", "post", "/mine"),
828
+ merge: operation("carts", "post", "/merge"),
829
+ addItem: operation("carts", "post", "/add-item"),
830
+ updateItem: operation("carts", "post", "/update-item"),
831
+ removeItem: operation("carts", "post", "/remove-item"),
832
+ updateDiscountCodes: operation("carts", "post", "/update-discount-codes"),
833
+ updateAttributes: operation("carts", "post", "/update-attributes"),
834
+ clear: operation("carts", "post", "/clear")
638
835
  },
639
- products: {
640
- stockCheck: "/api/products/stock-check",
641
- stockSnapshot: "/api/products/stock",
642
- listingGroups: "/api/products/listing-groups",
643
- listingGroupsCatalog: "/api/products/listing-groups/catalog",
644
- listingGroupsQuery: "/api/products/listing-groups/query",
645
- listingGroupsQueryCatalog: "/api/products/listing-groups/query/catalog",
646
- detail: "/api/products/detail",
647
- detailCatalog: "/api/products/detail/catalog",
648
- upsert: "/api/products/upsert"
836
+ paymentSessions: {
837
+ create: operation("payment-sessions", "post", "/create"),
838
+ retrieve: operation("payment-sessions", "post", "/retrieve"),
839
+ cancel: operation("payment-sessions", "post", "/cancel"),
840
+ server: {
841
+ create: operation("payment-sessions", "post", "/server/create"),
842
+ retrieve: operation("payment-sessions", "post", "/server/retrieve"),
843
+ cancel: operation("payment-sessions", "post", "/server/cancel"),
844
+ confirm: operation("payment-sessions", "post", "/server/confirm")
845
+ },
846
+ custom: {
847
+ create: operation("orders", "post", "/custom-payment-sessions"),
848
+ confirm: operation("orders", "post", "/custom-payment-sessions/confirm")
849
+ }
850
+ },
851
+ shippingPolicies: {
852
+ calculate: operation("shipping-policies", "post", "/calculate")
853
+ },
854
+ discounts: {
855
+ validate: operation("discounts", "post", "/validate")
649
856
  }
650
857
  };
651
- var COMMERCE_ENDPOINT_PATHS = Object.values(
652
- COMMERCE_ENDPOINTS
653
- ).flatMap((group) => Object.values(group));
654
-
655
- // src/core/internal/utils/query-string.ts
656
- function appendListingGroupsQuerySearchParams(search, options) {
657
- if (options?.page != null) search.set("page", String(options.page));
658
- if (options?.limit != null) search.set("limit", String(options.limit));
659
- if (options?.sort != null) {
660
- const sort = options.sort;
661
- search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
858
+ var MEMBERSHIP_ENDPOINT_OPERATIONS = {
859
+ subscribe: operation(null, "post", "/memberships/subscribe"),
860
+ cancel: operation(null, "post", "/memberships/:id/cancel"),
861
+ me: operation(null, "get", "/memberships/me")
862
+ };
863
+ var EVENTS_ENDPOINT_OPERATIONS = {
864
+ occurrences: {
865
+ range: operation("event-occurrences", "get", "/range"),
866
+ admissionAvailability: operation(
867
+ "event-occurrences",
868
+ "get",
869
+ "/admission-availability"
870
+ )
662
871
  }
663
- if (options?.where != null) {
664
- search.set("whereJson", JSON.stringify(options.where));
872
+ };
873
+ function resolveOperationTemplate(descriptor) {
874
+ return descriptor.collection ? `/api/${descriptor.collection}${descriptor.path}` : `/api${descriptor.path}`;
875
+ }
876
+ function resolveOperationPath(descriptor, options) {
877
+ const path = resolveOperationTemplate(descriptor).replace(
878
+ /:([A-Za-z][A-Za-z0-9_]*)/g,
879
+ (_, key) => {
880
+ const value = options?.pathParams?.[key];
881
+ if (value === void 0) {
882
+ throw new TypeError(`Missing path parameter: ${key}`);
883
+ }
884
+ return encodeURIComponent(value);
885
+ }
886
+ );
887
+ const unresolved = path.match(/:([A-Za-z][A-Za-z0-9_]*)/);
888
+ if (unresolved) {
889
+ throw new TypeError(`Missing path parameter: ${unresolved[1]}`);
665
890
  }
891
+ const query = options?.query?.toString().replace(/^\?/, "");
892
+ return query ? `${path}?${query}` : path;
666
893
  }
667
- function listingGroupsQueryCatalogUrl(options) {
668
- const search = new URLSearchParams();
669
- appendListingGroupsQuerySearchParams(search, options);
670
- const query = search.toString();
671
- return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
894
+
895
+ // src/core/api/endpoints.ts
896
+ var endpoint = (method, path) => ({ method, path });
897
+ var sharedEndpoint = (descriptor) => descriptor;
898
+ function resolveOperationPath2(descriptor, options) {
899
+ if ("collection" in descriptor) {
900
+ return resolveOperationPath(descriptor, options);
901
+ }
902
+ const query = options?.query?.toString().replace(/^\?/, "");
903
+ return query ? `${descriptor.path}?${query}` : descriptor.path;
904
+ }
905
+ var COMMERCE_ENDPOINTS = {
906
+ products: {
907
+ detail: endpoint("GET", "/api/products/detail"),
908
+ detailCatalog: endpoint("GET", "/api/products/detail/catalog"),
909
+ listingGroups: endpoint("GET", "/api/products/listing-groups"),
910
+ listingGroupsCatalog: endpoint(
911
+ "GET",
912
+ "/api/products/listing-groups/catalog"
913
+ ),
914
+ listingGroupsQuery: endpoint("GET", "/api/products/listing-groups/query"),
915
+ listingGroupsQueryCatalog: endpoint(
916
+ "GET",
917
+ "/api/products/listing-groups/query/catalog"
918
+ ),
919
+ stockCheck: endpoint("POST", "/api/products/stock-check"),
920
+ stockSnapshot: endpoint("GET", "/api/products/stock"),
921
+ upsert: endpoint("POST", "/api/products/upsert")
922
+ },
923
+ orders: {
924
+ update: endpoint("POST", "/api/orders/update"),
925
+ byPayment: endpoint("GET", "/api/orders/by-payment"),
926
+ cancel: endpoint("POST", "/api/orders/cancel"),
927
+ resolveCancelRefund: endpoint("POST", "/api/orders/resolve-cancel-refund"),
928
+ createFulfillment: endpoint("POST", "/api/orders/create-fulfillment"),
929
+ updateFulfillment: endpoint("POST", "/api/orders/update-fulfillment")
930
+ },
931
+ checkouts: {
932
+ create: endpoint("POST", "/api/orders/checkout"),
933
+ retrieve: endpoint("POST", "/api/checkouts/detail"),
934
+ server: {
935
+ create: endpoint("POST", "/api/orders/checkout"),
936
+ retrieve: endpoint("POST", "/api/checkouts/detail"),
937
+ query: endpoint("POST", "/api/checkouts/query")
938
+ }
939
+ },
940
+ returns: {
941
+ create: endpoint("POST", "/api/returns/create"),
942
+ update: endpoint("POST", "/api/returns/update"),
943
+ returnRefund: endpoint("POST", "/api/returns/return-refund")
944
+ },
945
+ fulfillmentOrders: {
946
+ prepare: endpoint(
947
+ "POST",
948
+ "/api/fulfillment-orders/prepare-fulfillment-order"
949
+ )
950
+ },
951
+ fulfillments: {
952
+ bulkImport: endpoint("POST", "/api/fulfillments/bulk-import")
953
+ },
954
+ carts: {
955
+ create: endpoint("POST", "/api/carts/create"),
956
+ retrieve: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.retrieve),
957
+ mine: endpoint("POST", "/api/carts/mine"),
958
+ merge: endpoint("POST", "/api/carts/merge"),
959
+ server: {
960
+ // Server credentials are an authorization lane, not a second Cart
961
+ // transport. These must stay bound to the registered shared operations.
962
+ create: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.create),
963
+ retrieve: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.retrieve),
964
+ mine: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.mine),
965
+ merge: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.merge),
966
+ addItem: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.addItem),
967
+ updateItem: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.updateItem),
968
+ removeItem: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.removeItem),
969
+ updateDiscountCodes: sharedEndpoint(
970
+ COMMERCE_ENDPOINT_OPERATIONS.carts.updateDiscountCodes
971
+ ),
972
+ updateAttributes: sharedEndpoint(
973
+ COMMERCE_ENDPOINT_OPERATIONS.carts.updateAttributes
974
+ ),
975
+ clear: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.clear)
976
+ },
977
+ addItem: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.addItem),
978
+ updateItem: endpoint("POST", "/api/carts/update-item"),
979
+ removeItem: endpoint("POST", "/api/carts/remove-item"),
980
+ updateDiscountCodes: endpoint("POST", "/api/carts/update-discount-codes"),
981
+ updateAttributes: endpoint("POST", "/api/carts/update-attributes"),
982
+ clear: endpoint("POST", "/api/carts/clear")
983
+ },
984
+ paymentSessions: {
985
+ create: endpoint("POST", "/api/payment-sessions/create"),
986
+ retrieve: endpoint("POST", "/api/payment-sessions/retrieve"),
987
+ cancel: endpoint("POST", "/api/payment-sessions/cancel"),
988
+ custom: {
989
+ create: sharedEndpoint(
990
+ COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.create
991
+ ),
992
+ confirm: sharedEndpoint(
993
+ COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.confirm
994
+ )
995
+ },
996
+ server: {
997
+ create: endpoint("POST", "/api/payment-sessions/server/create"),
998
+ retrieve: endpoint("POST", "/api/payment-sessions/server/retrieve"),
999
+ cancel: endpoint("POST", "/api/payment-sessions/server/cancel"),
1000
+ confirm: endpoint("POST", "/api/payment-sessions/server/confirm")
1001
+ }
1002
+ },
1003
+ shippingPolicies: {
1004
+ calculate: endpoint("POST", "/api/shipping-policies/calculate")
1005
+ }
1006
+ };
1007
+ function isCommerceEndpointDescriptor(value) {
1008
+ if (!value || typeof value !== "object") return false;
1009
+ const candidate = value;
1010
+ return typeof candidate.method === "string" && typeof candidate.path === "string";
672
1011
  }
1012
+ function flattenEndpointPaths(value) {
1013
+ if (isCommerceEndpointDescriptor(value)) return [resolveOperationPath2(value)];
1014
+ if (!value || typeof value !== "object") return [];
1015
+ return Object.values(value).flatMap((entry) => flattenEndpointPaths(entry));
1016
+ }
1017
+ function flattenEndpointDescriptors(value) {
1018
+ if (isCommerceEndpointDescriptor(value)) return [value];
1019
+ if (!value || typeof value !== "object") return [];
1020
+ return Object.values(value).flatMap(
1021
+ (entry) => flattenEndpointDescriptors(entry)
1022
+ );
1023
+ }
1024
+ var COMMERCE_ENDPOINT_PATHS = flattenEndpointPaths(COMMERCE_ENDPOINTS);
1025
+ var COMMERCE_ENDPOINT_DESCRIPTORS = flattenEndpointDescriptors(COMMERCE_ENDPOINTS);
1026
+ var MEMBERSHIP_ENDPOINTS = {
1027
+ subscribe: "/api/memberships/subscribe",
1028
+ cancel: (id) => `/api/memberships/${id}/cancel`,
1029
+ me: "/api/memberships/me"
1030
+ };
1031
+ var MEMBERSHIP_ENDPOINT_PATHS = [
1032
+ MEMBERSHIP_ENDPOINTS.subscribe,
1033
+ MEMBERSHIP_ENDPOINTS.cancel(":id"),
1034
+ MEMBERSHIP_ENDPOINTS.me
1035
+ ];
673
1036
 
674
1037
  // src/core/query/query-hooks.ts
675
- var LISTING_GROUPS_QUERY_PATH = COMMERCE_ENDPOINTS.products.listingGroupsQuery;
1038
+ function normalizeMarket(market) {
1039
+ const normalized = market?.trim();
1040
+ return normalized || void 0;
1041
+ }
1042
+ function requestCommerceFindEndpoint(collectionClient, endpoint2, options) {
1043
+ const path = resolveOperationPath2(endpoint2, { query: options?.query });
1044
+ if (endpoint2.method === "get") {
1045
+ return collectionClient.requestFindEndpointGet(path);
1046
+ }
1047
+ if (endpoint2.method === "post") {
1048
+ return collectionClient.requestFindEndpoint(path, options?.data);
1049
+ }
1050
+ throw new TypeError(`Unsupported find endpoint method: ${endpoint2.method}`);
1051
+ }
1052
+ function withDefaultMarket(params, market) {
1053
+ const defaultMarket = normalizeMarket(market);
1054
+ if (!defaultMarket || normalizeMarket(params?.market)) return params;
1055
+ return { ...params ?? {}, market: defaultMarket };
1056
+ }
1057
+ function resolveProductMarket(commerceClient, context) {
1058
+ return normalizeMarket(context?.market) ?? normalizeMarket(commerceClient.getDefaultMarket?.());
1059
+ }
1060
+ function splitListingGroupsQueryOptions(queryOptions) {
1061
+ const normalized = canonicalProductListingGroupsQueryOptions(queryOptions);
1062
+ if (!normalized) return { market: void 0, options: void 0 };
1063
+ const { market, ...options } = normalized;
1064
+ return {
1065
+ market,
1066
+ options: Object.keys(options).length > 0 ? options : void 0
1067
+ };
1068
+ }
676
1069
  function fetchProductListingGroupsQuery(collectionClient, queryOptions) {
677
- return collectionClient.requestFindEndpoint(
678
- LISTING_GROUPS_QUERY_PATH,
679
- { options: queryOptions }
1070
+ const { market, options } = splitListingGroupsQueryOptions(queryOptions);
1071
+ return requestCommerceFindEndpoint(
1072
+ collectionClient,
1073
+ COMMERCE_ENDPOINT_OPERATIONS.products.listingGroupsQuery,
1074
+ {
1075
+ data: {
1076
+ ...market ? { market } : {},
1077
+ ...options ? { options } : {}
1078
+ }
1079
+ }
680
1080
  );
681
1081
  }
682
1082
  function fetchProductListingGroupsCatalogQuery(collectionClient, queryOptions) {
683
- return collectionClient.requestFindEndpointGet(
684
- listingGroupsQueryCatalogUrl(queryOptions)
1083
+ return requestCommerceFindEndpoint(
1084
+ collectionClient,
1085
+ COMMERCE_ENDPOINT_OPERATIONS.products.listingGroupsQueryCatalog,
1086
+ { query: listingPageSearchParams(queryOptions) }
685
1087
  );
686
1088
  }
687
- function productListingPageQueryOptions(commerceClient, params = {}) {
1089
+ function productListingPageQueryOptions(commerceClient, params = {}, context) {
1090
+ const effectiveParams = withDefaultMarket(
1091
+ params,
1092
+ resolveProductMarket(
1093
+ commerceClient,
1094
+ context
1095
+ )
1096
+ ) ?? params;
688
1097
  return {
689
- queryKey: productKeys.listingPage(params),
1098
+ queryKey: productKeys.listingPage(effectiveParams),
690
1099
  queryFn: () => commerceClient.product.listingPage(
691
- params
1100
+ effectiveParams
692
1101
  )
693
1102
  };
694
1103
  }
695
- function productListingPageInfiniteQueryOptions(commerceClient, params = {}) {
1104
+ function productListingPageInfiniteQueryOptions(commerceClient, params = {}, context) {
696
1105
  const {
697
1106
  pageSize: explicitPageSize,
698
1107
  page: _page,
@@ -700,10 +1109,20 @@ function productListingPageInfiniteQueryOptions(commerceClient, params = {}) {
700
1109
  ...pageParams
701
1110
  } = params;
702
1111
  const pageSize = explicitPageSize ?? 20;
1112
+ const effectivePageParams = withDefaultMarket(
1113
+ pageParams,
1114
+ resolveProductMarket(
1115
+ commerceClient,
1116
+ context
1117
+ )
1118
+ ) ?? pageParams;
703
1119
  return {
704
- queryKey: productKeys.listingPageInfinite(pageParams, explicitPageSize),
1120
+ queryKey: productKeys.listingPageInfinite(
1121
+ effectivePageParams,
1122
+ explicitPageSize
1123
+ ),
705
1124
  queryFn: ({ pageParam }) => commerceClient.product.listingPage({
706
- ...pageParams,
1125
+ ...effectivePageParams,
707
1126
  page: pageParam,
708
1127
  limit: pageSize
709
1128
  }),
@@ -711,27 +1130,29 @@ function productListingPageInfiniteQueryOptions(commerceClient, params = {}) {
711
1130
  getNextPageParam: (lastPage) => lastPage.hasNextPage ? lastPage.nextPage : void 0
712
1131
  };
713
1132
  }
714
- function prefetchProductListingPage(queryClient, commerceClient, params = {}, options) {
1133
+ function prefetchProductListingPage(queryClient, commerceClient, params = {}, options, context) {
715
1134
  return queryClient.prefetchQuery({
716
1135
  ...productListingPageQueryOptions(
717
1136
  commerceClient,
718
- params
1137
+ params,
1138
+ context
719
1139
  ),
720
1140
  ...options
721
1141
  });
722
1142
  }
723
- function prefetchInfiniteProductListingPage(queryClient, commerceClient, params = {}, options) {
1143
+ function prefetchInfiniteProductListingPage(queryClient, commerceClient, params = {}, options, context) {
724
1144
  return queryClient.prefetchInfiniteQuery({
725
1145
  ...productListingPageInfiniteQueryOptions(
726
1146
  commerceClient,
727
- params
1147
+ params,
1148
+ context
728
1149
  ),
729
1150
  pages: options?.pages ?? 1,
730
1151
  staleTime: options?.staleTime
731
1152
  });
732
1153
  }
733
1154
  var QueryHooks = class extends CollectionHooks {
734
- constructor(queryClient, collectionClient, customerAuth, commerceClient) {
1155
+ constructor(queryClient, collectionClient, customerAuth, commerceClient, market) {
735
1156
  super(queryClient, collectionClient);
736
1157
  // --- Customer hooks delegation ---
737
1158
  this.useCustomerMe = (...args) => this._customer.useCustomerMe(...args);
@@ -749,6 +1170,7 @@ var QueryHooks = class extends CollectionHooks {
749
1170
  this.setCustomerData = (data) => this._customer.setCustomerData(data);
750
1171
  this._customer = new CustomerHooks(queryClient, customerAuth);
751
1172
  this._commerce = commerceClient;
1173
+ this.market = normalizeMarket(market);
752
1174
  }
753
1175
  ensureCommerce() {
754
1176
  if (!this._commerce) {
@@ -758,8 +1180,11 @@ var QueryHooks = class extends CollectionHooks {
758
1180
  }
759
1181
  return this._commerce;
760
1182
  }
1183
+ withProductMarket(params) {
1184
+ return withDefaultMarket(params, this.market);
1185
+ }
761
1186
  useProductListingGroupsQuery(params, options) {
762
- const queryOptions = params.options;
1187
+ const queryOptions = this.withProductMarket(params.options);
763
1188
  const { placeholderData, ...restOptions } = options ?? {};
764
1189
  return (0, import_react_query4.useQuery)({
765
1190
  queryKey: productKeys.listingGroups(queryOptions),
@@ -771,7 +1196,7 @@ var QueryHooks = class extends CollectionHooks {
771
1196
  });
772
1197
  }
773
1198
  useProductListingGroupsCatalogQuery(params, options) {
774
- const queryOptions = params.options;
1199
+ const queryOptions = this.withProductMarket(params.options);
775
1200
  const { placeholderData, ...restOptions } = options ?? {};
776
1201
  return (0, import_react_query4.useQuery)({
777
1202
  queryKey: productKeys.listingGroupsCatalog(queryOptions),
@@ -786,7 +1211,7 @@ var QueryHooks = class extends CollectionHooks {
786
1211
  });
787
1212
  }
788
1213
  useSuspenseProductListingGroupsQuery(params, options) {
789
- const queryOptions = params.options;
1214
+ const queryOptions = this.withProductMarket(params.options);
790
1215
  return (0, import_react_query4.useSuspenseQuery)({
791
1216
  queryKey: productKeys.listingGroups(queryOptions),
792
1217
  queryFn: async () => fetchProductListingGroupsQuery(this.collectionClient, queryOptions),
@@ -794,7 +1219,7 @@ var QueryHooks = class extends CollectionHooks {
794
1219
  });
795
1220
  }
796
1221
  useSuspenseProductListingGroupsCatalogQuery(params, options) {
797
- const queryOptions = params.options;
1222
+ const queryOptions = this.withProductMarket(params.options);
798
1223
  return (0, import_react_query4.useSuspenseQuery)({
799
1224
  queryKey: productKeys.listingGroupsCatalog(queryOptions),
800
1225
  queryFn: async () => fetchProductListingGroupsCatalogQuery(
@@ -805,7 +1230,7 @@ var QueryHooks = class extends CollectionHooks {
805
1230
  });
806
1231
  }
807
1232
  useInfiniteProductListingGroupsQuery(params, options) {
808
- const { options: queryOptions } = params;
1233
+ const queryOptions = this.withProductMarket(params.options);
809
1234
  const explicitPageSize = params.pageSize;
810
1235
  const pageSize = explicitPageSize ?? 20;
811
1236
  return (0, import_react_query4.useInfiniteQuery)({
@@ -824,7 +1249,7 @@ var QueryHooks = class extends CollectionHooks {
824
1249
  });
825
1250
  }
826
1251
  useInfiniteProductListingGroupsCatalogQuery(params, options) {
827
- const { options: queryOptions } = params;
1252
+ const queryOptions = this.withProductMarket(params.options);
828
1253
  const explicitPageSize = params.pageSize;
829
1254
  const pageSize = explicitPageSize ?? 20;
830
1255
  return (0, import_react_query4.useInfiniteQuery)({
@@ -843,7 +1268,7 @@ var QueryHooks = class extends CollectionHooks {
843
1268
  });
844
1269
  }
845
1270
  useSuspenseInfiniteProductListingGroupsQuery(params, options) {
846
- const { options: queryOptions } = params;
1271
+ const queryOptions = this.withProductMarket(params.options);
847
1272
  const explicitPageSize = params.pageSize;
848
1273
  const pageSize = explicitPageSize ?? 20;
849
1274
  return (0, import_react_query4.useSuspenseInfiniteQuery)({
@@ -862,7 +1287,7 @@ var QueryHooks = class extends CollectionHooks {
862
1287
  });
863
1288
  }
864
1289
  useSuspenseInfiniteProductListingGroupsCatalogQuery(params, options) {
865
- const { options: queryOptions } = params;
1290
+ const queryOptions = this.withProductMarket(params.options);
866
1291
  const explicitPageSize = params.pageSize;
867
1292
  const pageSize = explicitPageSize ?? 20;
868
1293
  return (0, import_react_query4.useSuspenseInfiniteQuery)({
@@ -881,7 +1306,7 @@ var QueryHooks = class extends CollectionHooks {
881
1306
  });
882
1307
  }
883
1308
  async prefetchProductListingGroupsQuery(params, options) {
884
- const queryOptions = params.options;
1309
+ const queryOptions = this.withProductMarket(params.options);
885
1310
  return this.queryClient.prefetchQuery({
886
1311
  queryKey: productKeys.listingGroups(queryOptions),
887
1312
  queryFn: async () => fetchProductListingGroupsQuery(this.collectionClient, queryOptions),
@@ -889,7 +1314,7 @@ var QueryHooks = class extends CollectionHooks {
889
1314
  });
890
1315
  }
891
1316
  async prefetchProductListingGroupsCatalogQuery(params, options) {
892
- const queryOptions = params.options;
1317
+ const queryOptions = this.withProductMarket(params.options);
893
1318
  return this.queryClient.prefetchQuery({
894
1319
  queryKey: productKeys.listingGroupsCatalog(queryOptions),
895
1320
  queryFn: async () => fetchProductListingGroupsCatalogQuery(
@@ -900,7 +1325,7 @@ var QueryHooks = class extends CollectionHooks {
900
1325
  });
901
1326
  }
902
1327
  async prefetchInfiniteProductListingGroupsQuery(params, options) {
903
- const { options: queryOptions } = params;
1328
+ const queryOptions = this.withProductMarket(params.options);
904
1329
  const explicitPageSize = params.pageSize;
905
1330
  const pageSize = explicitPageSize ?? 20;
906
1331
  return this.queryClient.prefetchInfiniteQuery({
@@ -920,7 +1345,7 @@ var QueryHooks = class extends CollectionHooks {
920
1345
  });
921
1346
  }
922
1347
  async prefetchInfiniteProductListingGroupsCatalogQuery(params, options) {
923
- const { options: queryOptions } = params;
1348
+ const queryOptions = this.withProductMarket(params.options);
924
1349
  const explicitPageSize = params.pageSize;
925
1350
  const pageSize = explicitPageSize ?? 20;
926
1351
  return this.queryClient.prefetchInfiniteQuery({
@@ -942,7 +1367,9 @@ var QueryHooks = class extends CollectionHooks {
942
1367
  useProductListingPage(params = {}, options) {
943
1368
  const { placeholderData, ...restOptions } = options ?? {};
944
1369
  return (0, import_react_query4.useQuery)({
945
- ...productListingPageQueryOptions(this.ensureCommerce(), params),
1370
+ ...productListingPageQueryOptions(this.ensureCommerce(), params, {
1371
+ market: this.market
1372
+ }),
946
1373
  ...restOptions,
947
1374
  ...placeholderData !== void 0 && {
948
1375
  placeholderData
@@ -952,13 +1379,17 @@ var QueryHooks = class extends CollectionHooks {
952
1379
  useSuspenseProductListingPage(params = {}, options) {
953
1380
  const suspenseOptions = options;
954
1381
  return (0, import_react_query4.useSuspenseQuery)({
955
- ...productListingPageQueryOptions(this.ensureCommerce(), params),
1382
+ ...productListingPageQueryOptions(this.ensureCommerce(), params, {
1383
+ market: this.market
1384
+ }),
956
1385
  ...suspenseOptions
957
1386
  });
958
1387
  }
959
1388
  useInfiniteProductListingPage(params = {}, options) {
960
1389
  return (0, import_react_query4.useInfiniteQuery)({
961
- ...productListingPageInfiniteQueryOptions(this.ensureCommerce(), params),
1390
+ ...productListingPageInfiniteQueryOptions(this.ensureCommerce(), params, {
1391
+ market: this.market
1392
+ }),
962
1393
  ...options
963
1394
  });
964
1395
  }
@@ -967,7 +1398,8 @@ var QueryHooks = class extends CollectionHooks {
967
1398
  this.queryClient,
968
1399
  this.ensureCommerce(),
969
1400
  params,
970
- options
1401
+ options,
1402
+ { market: this.market }
971
1403
  );
972
1404
  }
973
1405
  async prefetchInfiniteProductListingPage(params = {}, options) {
@@ -975,25 +1407,45 @@ var QueryHooks = class extends CollectionHooks {
975
1407
  this.queryClient,
976
1408
  this.ensureCommerce(),
977
1409
  params,
978
- options
1410
+ options,
1411
+ { market: this.market }
979
1412
  );
980
1413
  }
981
1414
  useProductDetail(params, options) {
982
1415
  const discriminator = "slug" in params ? params.slug : params.id;
983
1416
  const { enabled, ...restOptions } = options ?? {};
984
1417
  const queryEnabled = enabled !== false && Boolean(discriminator);
1418
+ const effectiveParams = this.withProductMarket(params) ?? params;
985
1419
  return (0, import_react_query4.useQuery)({
986
- queryKey: productKeys.detail(params),
987
- queryFn: () => this._commerce.product.detail(params),
1420
+ queryKey: productKeys.detail(effectiveParams),
1421
+ queryFn: () => this._commerce.product.detail(effectiveParams),
988
1422
  enabled: queryEnabled,
989
1423
  ...restOptions
990
1424
  });
991
1425
  }
992
1426
  useProductDetailBySlug(slug, options) {
993
- return this.useProductDetail({ slug }, options);
1427
+ const { market, locale, fallbackLocale, ...queryOptions } = options ?? {};
1428
+ return this.useProductDetail(
1429
+ {
1430
+ slug,
1431
+ ...market ? { market } : {},
1432
+ ...locale ? { locale } : {},
1433
+ ...fallbackLocale !== void 0 ? { fallbackLocale } : {}
1434
+ },
1435
+ queryOptions
1436
+ );
994
1437
  }
995
1438
  useProductDetailById(id, options) {
996
- return this.useProductDetail({ id }, options);
1439
+ const { market, locale, fallbackLocale, ...queryOptions } = options ?? {};
1440
+ return this.useProductDetail(
1441
+ {
1442
+ id,
1443
+ ...market ? { market } : {},
1444
+ ...locale ? { locale } : {},
1445
+ ...fallbackLocale !== void 0 ? { fallbackLocale } : {}
1446
+ },
1447
+ queryOptions
1448
+ );
997
1449
  }
998
1450
  };
999
1451
 
@@ -1143,6 +1595,9 @@ var RealtimeConnection = class {
1143
1595
  };
1144
1596
 
1145
1597
  // src/core/query/query-client.ts
1598
+ function getClientMarket(client) {
1599
+ return client.getConfig?.().market;
1600
+ }
1146
1601
  function createReadOnlyQueryHooksFacade(hooks) {
1147
1602
  return {
1148
1603
  useQuery: hooks.useQuery.bind(hooks),
@@ -1190,7 +1645,8 @@ function createQueryHooks(client, queryClient = getQueryClient()) {
1190
1645
  queryClient,
1191
1646
  client.collections,
1192
1647
  client.customer.auth,
1193
- client.commerce
1648
+ client.commerce,
1649
+ getClientMarket(client)
1194
1650
  );
1195
1651
  return createReadOnlyQueryHooksFacade(hooks);
1196
1652
  }
@@ -1199,7 +1655,8 @@ function createServerQueryHooks(client, queryClient = getQueryClient()) {
1199
1655
  queryClient,
1200
1656
  client.collections,
1201
1657
  void 0,
1202
- client.commerce
1658
+ client.commerce,
1659
+ getClientMarket(client)
1203
1660
  );
1204
1661
  }
1205
1662
  //# sourceMappingURL=query.cjs.map