@mercurjs/vendor 2.2.0-canary.11 → 2.2.0-canary.13

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 (121) hide show
  1. package/dist/{[id]-EKLRGVBA.js → [id]-ET35KT2M.js} +3 -3
  2. package/dist/{[id]-A55T2ORL.js → [id]-FALIOGXK.js} +3 -4
  3. package/dist/{[id]-GC3ZYPK4.js → [id]-GY5R652O.js} +5 -6
  4. package/dist/{[id]-GBT6VB4S.js → [id]-IGQTT3AM.js} +4 -5
  5. package/dist/{[id]-SHAJTJNZ.js → [id]-IW2AZE77.js} +5 -6
  6. package/dist/{[id]-FE5GYYVZ.js → [id]-OTK2NOXT.js} +3 -4
  7. package/dist/{[id]-U5KZEQDR.js → [id]-PEUI67SP.js} +2 -2
  8. package/dist/{[id]-T5ECVBPF.js → [id]-RFEYRBLI.js} +4 -5
  9. package/dist/{[id]-B4YZTANM.js → [id]-US6IULL2.js} +205 -484
  10. package/dist/{[id]-QOEO3JOV.js → [id]-YZSVSJWU.js} +3 -4
  11. package/dist/{[id]-QQU5HVFU.js → [id]-ZMLS73X5.js} +4 -5
  12. package/dist/{[province_id]-6GUA4PV5.js → [province_id]-J3OB2LZ4.js} +5 -6
  13. package/dist/{add-NTRYWOJF.js → add-XEUXK63F.js} +6 -7
  14. package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-HZNWWRVG.js} +3 -4
  15. package/dist/{add-products-Q4MMDQKT.js → add-products-E5GULF6B.js} +4 -5
  16. package/dist/{add-promotions-3AYXQXTP.js → add-promotions-KW5YZHLS.js} +3 -3
  17. package/dist/{address-77Y3AOQ3.js → address-6T4H6P7O.js} +3 -4
  18. package/dist/{breadcrumb-EVZIOB2G.js → breadcrumb-5HYIEPCL.js} +3 -4
  19. package/dist/{breadcrumb-TNJSGX4T.js → breadcrumb-HL7NKNX4.js} +3 -4
  20. package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-L3MFH4I2.js} +9 -8
  21. package/dist/{breadcrumb-5NP23D6X.js → breadcrumb-LKLWHB63.js} +4 -5
  22. package/dist/breadcrumb-ZMACILH3.js +28 -0
  23. package/dist/chunk-4WCPN4OA.js +315 -0
  24. package/dist/{chunk-LDZCCWJB.js → chunk-5YCDZ4AU.js} +1 -1
  25. package/dist/{chunk-OYKUQXJX.js → chunk-A6QH53CS.js} +21 -10
  26. package/dist/{chunk-GN6KB75Z.js → chunk-AQTEEQWX.js} +1 -1
  27. package/dist/{chunk-K6LOZ4S3.js → chunk-DEJIBIQZ.js} +1 -1
  28. package/dist/{chunk-4LVP635F.js → chunk-DNEPOMOX.js} +125 -125
  29. package/dist/{chunk-25E4KME5.js → chunk-J7ZU2HZZ.js} +1 -1
  30. package/dist/{chunk-OZ44ATGE.js → chunk-KJWVLGXG.js} +2 -2
  31. package/dist/{chunk-LKUW5SV4.js → chunk-LDX23XPT.js} +1 -1
  32. package/dist/{chunk-XP23ZVQT.js → chunk-MVYAN2RR.js} +4 -4
  33. package/dist/{chunk-TBYCZRZ7.js → chunk-R5QZO3QY.js} +14 -5
  34. package/dist/{chunk-UORPTGV2.js → chunk-SIEEMXNZ.js} +10 -14
  35. package/dist/chunk-SJT6A4AV.js +354 -0
  36. package/dist/{chunk-FWS4YJ4B.js → chunk-STWHJLVV.js} +1 -1
  37. package/dist/{chunk-TYESCFYW.js → chunk-UDOBGAP7.js} +1 -1
  38. package/dist/{chunk-6K6EQOJF.js → chunk-VAOJVT7R.js} +1 -1
  39. package/dist/{chunk-VCOQ7WQ2.js → chunk-VMFC2UDJ.js} +1 -1
  40. package/dist/chunk-XQUF3WIS.js +159 -0
  41. package/dist/{chunk-7IPCLQ5V.js → chunk-YPTJETJQ.js} +2 -2
  42. package/dist/{chunk-X4GWB6AT.js → chunk-ZBSFGCWY.js} +2 -2
  43. package/dist/{chunk-YGJCJBPM.js → chunk-ZPH3WXJ6.js} +1 -1
  44. package/dist/{collections-URH2TCWJ.js → collections-HO2F62RN.js} +4 -5
  45. package/dist/{create-FKRYB7ZS.js → create-7EVR4N6N.js} +1 -1
  46. package/dist/{create-JF2OUZQA.js → create-DB4EYPJ5.js} +3 -4
  47. package/dist/{create-JGYG5SBM.js → create-EFMCNOR5.js} +6 -7
  48. package/dist/{create-MS6KKFSV.js → create-FBPPNBLQ.js} +3 -4
  49. package/dist/{create-ODOFJF5N.js → create-J5OLH7OJ.js} +7 -8
  50. package/dist/{create-O35JRZEF.js → create-QAEOARJO.js} +4 -5
  51. package/dist/{create-HVZYJ3YC.js → create-QZBCYHHQ.js} +8 -9
  52. package/dist/{create-A7B3MLJX.js → create-SLJ2BMH7.js} +5 -6
  53. package/dist/{create-7R6CZU53.js → create-WBZJFMA7.js} +12 -3
  54. package/dist/{create-GGACODDN.js → create-WQ5TM5IZ.js} +1 -1
  55. package/dist/{edit-4G5D7TES.js → edit-3O6WVIMM.js} +5 -6
  56. package/dist/{edit-VVLITC2E.js → edit-G57GESSR.js} +1 -1
  57. package/dist/edit-PUZ23M7V.js +102 -0
  58. package/dist/{edit-G2E5SNGU.js → edit-PVJ3S4TW.js} +3 -4
  59. package/dist/{edit-2R5QCPTB.js → edit-RJE7L3PH.js} +3 -4
  60. package/dist/{edit-HTLLYECP.js → edit-TIRMXOLT.js} +6 -7
  61. package/dist/{edit-5CROKEJE.js → edit-W6WKYNOG.js} +5 -6
  62. package/dist/{edit-OKU6FMHJ.js → edit-WPX2ANVI.js} +3 -4
  63. package/dist/{edit-3E4ZO7HT.js → edit-YW4RBDPH.js} +6 -7
  64. package/dist/edit-price-5ICQPJ42.js +196 -0
  65. package/dist/edit-stock-KS2NFC2Z.js +229 -0
  66. package/dist/{fulfillment-76IVZ266.js → fulfillment-ZV2R43N2.js} +3 -4
  67. package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KKCL25KA.js} +4 -5
  68. package/dist/index.css +6 -6
  69. package/dist/index.js +142 -106
  70. package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-5UNDKYDL.js} +12 -12
  71. package/dist/{invite-2673PU4I.js → invite-KKIJNMER.js} +6 -7
  72. package/dist/{invite-HRXZ5YBP.js → invite-P7I5BGOJ.js} +3 -4
  73. package/dist/loader-UZTTBKYF.js +33 -0
  74. package/dist/loader-WEJZTX5Q.js +34 -0
  75. package/dist/{login-TWUBU6I6.js → login-A65IAXSI.js} +4 -5
  76. package/dist/{media-Z4N5MKFG.js → media-EM3K4AWO.js} +6 -7
  77. package/dist/{metadata-Q74OJWUD.js → metadata-A5XZKPL4.js} +4 -5
  78. package/dist/{metadata-D6M66NQK.js → metadata-JFLFWXOS.js} +3 -4
  79. package/dist/{metadata-YVHJPDLD.js → metadata-SFO3J5O5.js} +3 -4
  80. package/dist/{metadata-NIDIBXJT.js → metadata-USXOQUIX.js} +3 -4
  81. package/dist/{metadata-REQIFWWH.js → metadata-WJ4CNB6I.js} +3 -4
  82. package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-3PIJXHWZ.js} +169 -173
  83. package/dist/offer-detail-page-SPHP3XKC.js +580 -0
  84. package/dist/{offer-detail-page-6SIBQTLP.js → offer-variant-detail-page-KTHKV6WW.js} +144 -215
  85. package/dist/offers-GWMIEPCM.js +54 -0
  86. package/dist/{onboarding-MK2RIFD4.js → onboarding-JOGRNDPI.js} +3 -4
  87. package/dist/{orders-TVQDR4OJ.js → orders-Q2IKEJIM.js} +4 -5
  88. package/dist/{organization-XO3T2K2X.js → organization-HRYDC66D.js} +3 -4
  89. package/dist/pages/index.js +25 -27
  90. package/dist/{payment-details-CFTX3QDL.js → payment-details-YLPIR52N.js} +3 -4
  91. package/dist/{pricing-ECXV6K7G.js → pricing-ECJH4VXZ.js} +5 -6
  92. package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-EPNQ63NT.js} +15 -13
  93. package/dist/{product-tags-5O7ZG6SA.js → product-tags-WMC7G3C4.js} +5 -6
  94. package/dist/{product-variant-detail-PUWOMVHQ.js → product-variant-detail-BQL2NGVE.js} +3 -4
  95. package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-GACQHD46.js} +9 -20
  96. package/dist/{products-CPTRYL2Z.js → products-LGQMESEZ.js} +10 -11
  97. package/dist/{products-BM3IIH5P.js → products-PQ3FG5KC.js} +4 -5
  98. package/dist/{professional-details-ED4HNYXY.js → professional-details-AASVGTUO.js} +3 -4
  99. package/dist/{profile-6TGCNNUU.js → profile-ZNQEDSDM.js} +3 -4
  100. package/dist/{promotions-4336KI7E.js → promotions-MFAFFHF3.js} +4 -4
  101. package/dist/{register-OZ5CRANZ.js → register-3A6G6QNI.js} +5 -6
  102. package/dist/{reset-password-5UHZU4D3.js → reset-password-FV5762CA.js} +1 -1
  103. package/dist/{settings-2GCQQTO6.js → settings-OKNGWUKL.js} +12 -13
  104. package/dist/{shipment-HWQHMX2L.js → shipment-ZF7IRKKS.js} +3 -4
  105. package/dist/shipping-HWJPX34K.js +113 -0
  106. package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-3QKTQI6L.js} +2 -6
  107. package/dist/{shipping-profiles-C5WBXWZ2.js → shipping-profiles-FZCKGCBU.js} +3 -4
  108. package/dist/{stock-MQA7PRO6.js → stock-FI5WXVWN.js} +4 -5
  109. package/dist/{store-5ZHZR4JI.js → store-VFRKJYMD.js} +3 -4
  110. package/dist/{store-closure-H5WHV3LA.js → store-closure-WZIWGESD.js} +3 -4
  111. package/dist/{store-select-PZS556FB.js → store-select-GKRDFGEY.js} +4 -5
  112. package/dist/{team-CLKJCZNH.js → team-CXEAYN7O.js} +3 -4
  113. package/package.json +1 -1
  114. package/dist/chunk-27KRIXMQ.js +0 -71
  115. package/dist/chunk-CFRWIQIZ.js +0 -43
  116. package/dist/chunk-RXV7INUV.js +0 -426
  117. package/dist/chunk-T6LHVNWO.js +0 -27
  118. package/dist/loader-VDYPD3RI.js +0 -31
  119. package/dist/offer-edit-page-3MO566RP.js +0 -151
  120. package/dist/offers-GVN5LCK6.js +0 -32
  121. package/dist/{chunk-SPOHNK4X.js → chunk-BPVMJN2D.js} +3 -3
@@ -4,7 +4,17 @@ import {
4
4
  ProductStatusCell,
5
5
  ProductStatusHeader
6
6
  } from "./chunk-U5G3AVED.js";
7
+ import {
8
+ useProductTableQuery
9
+ } from "./chunk-MJCL3WID.js";
10
+ import {
11
+ ProductCell,
12
+ ProductHeader
13
+ } from "./chunk-FWPGOIFA.js";
7
14
  import "./chunk-FQERBIVS.js";
15
+ import {
16
+ useProductTableFilters
17
+ } from "./chunk-DEJIBIQZ.js";
8
18
  import "./chunk-DB6ANJBO.js";
9
19
  import {
10
20
  PlaceholderCell
@@ -21,7 +31,7 @@ import {
21
31
  createDataGridHelper,
22
32
  createDataGridLocationStockColumns,
23
33
  createDataGridPriceColumns
24
- } from "./chunk-4LVP635F.js";
34
+ } from "./chunk-DNEPOMOX.js";
25
35
  import {
26
36
  defineTabMeta
27
37
  } from "./chunk-LEWA4BPH.js";
@@ -36,36 +46,50 @@ import {
36
46
  useRouteModal
37
47
  } from "./chunk-GDWBOQI5.js";
38
48
  import "./chunk-3QSRE5LS.js";
39
- import {
40
- useQueryParams
41
- } from "./chunk-THHRRYRS.js";
49
+ import "./chunk-THHRRYRS.js";
42
50
  import "./chunk-LRD242C7.js";
43
51
  import "./chunk-UCYSCKZV.js";
44
52
  import {
45
53
  Thumbnail
46
54
  } from "./chunk-WIYFXWRI.js";
47
55
  import "./chunk-INNFZYX2.js";
56
+ import "./chunk-R5QZO3QY.js";
57
+ import "./chunk-F4OJN2F2.js";
58
+ import "./chunk-LRARA622.js";
59
+ import "./chunk-M6N4ISXL.js";
60
+ import "./chunk-S7EKBD2C.js";
61
+ import "./chunk-VV6IKGCN.js";
62
+ import "./chunk-BXRNZS5K.js";
63
+ import "./chunk-BOZJOOGW.js";
48
64
  import {
49
- useVariants
50
- } from "./chunk-T6LHVNWO.js";
65
+ useShippingProfiles
66
+ } from "./chunk-IQWK723D.js";
51
67
  import {
52
68
  usePricePreferences
53
69
  } from "./chunk-4S6XGIC6.js";
54
70
  import {
55
71
  useCurrentSeller
56
72
  } from "./chunk-S23FD6FA.js";
57
- import {
58
- useShippingProfiles
59
- } from "./chunk-IQWK723D.js";
73
+ import "./chunk-DDJQRV6E.js";
74
+ import "./chunk-LWJF63JW.js";
75
+ import "./chunk-VXWN37PT.js";
76
+ import "./chunk-5QI3NDJG.js";
77
+ import "./chunk-VZUA5SRD.js";
78
+ import "./chunk-VXMOPVRH.js";
60
79
  import {
61
80
  useStockLocations
62
81
  } from "./chunk-NBPMNUKZ.js";
63
82
  import {
64
83
  useBulkCreateOffers
65
- } from "./chunk-UORPTGV2.js";
84
+ } from "./chunk-SIEEMXNZ.js";
85
+ import "./chunk-Y2MQ5EMD.js";
86
+ import "./chunk-3B34B2M2.js";
66
87
  import "./chunk-LAVHRER2.js";
67
88
  import "./chunk-QHQWEERJ.js";
68
89
  import "./chunk-Y7QKP6QU.js";
90
+ import {
91
+ useProducts
92
+ } from "./chunk-JAUZ73XE.js";
69
93
  import "./chunk-A5DJIOHN.js";
70
94
  import "./chunk-RHKRREUU.js";
71
95
  import "./chunk-ZA2KFUFR.js";
@@ -80,7 +104,7 @@ import { useForm } from "react-hook-form";
80
104
  import { useTranslation as useTranslation3 } from "react-i18next";
81
105
 
82
106
  // src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
83
- import { Checkbox } from "@medusajs/ui";
107
+ import { Checkbox, Text } from "@medusajs/ui";
84
108
  import { keepPreviousData } from "@tanstack/react-query";
85
109
  import {
86
110
  createColumnHelper
@@ -88,81 +112,23 @@ import {
88
112
  import { useEffect, useMemo, useState } from "react";
89
113
  import { useFormContext } from "react-hook-form";
90
114
  import { useTranslation } from "react-i18next";
91
-
92
- // src/hooks/table/query/use-product-variants-table-query.tsx
93
- var DEFAULT_FIELDS = "*options,*inventory_items,*inventory_items.inventory,*inventory_items.inventory.location_levels";
94
- var useProductVariantsTableQuery = ({
95
- prefix,
96
- pageSize = 10
97
- }) => {
98
- const queryObject = useQueryParams(
99
- [
100
- "offset",
101
- "order",
102
- "q",
103
- "id",
104
- "sku",
105
- "title",
106
- "manage_inventory",
107
- "allow_backorder",
108
- "created_at",
109
- "updated_at"
110
- ],
111
- prefix
112
- );
113
- const {
114
- offset,
115
- order,
116
- q,
117
- id,
118
- sku,
119
- title,
120
- manage_inventory,
121
- allow_backorder,
122
- created_at,
123
- updated_at
124
- } = queryObject;
125
- const searchParams = {
126
- limit: pageSize,
127
- offset: offset ? Number(offset) : 0,
128
- fields: DEFAULT_FIELDS,
129
- order,
130
- q,
131
- id: id ? id.split(",") : void 0,
132
- sku: sku ? sku.split(",") : void 0,
133
- title: title ? title.split(",") : void 0,
134
- manage_inventory: manage_inventory ? manage_inventory === "true" : void 0,
135
- allow_backorder: allow_backorder ? allow_backorder === "true" : void 0,
136
- created_at: created_at ? JSON.parse(created_at) : void 0,
137
- updated_at: updated_at ? JSON.parse(updated_at) : void 0
138
- };
139
- return {
140
- searchParams,
141
- raw: queryObject
142
- };
143
- };
144
-
145
- // src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
146
115
  import { jsx, jsxs } from "react/jsx-runtime";
147
116
  var PAGE_SIZE = 10;
148
117
  var FIELDS = [
149
118
  "id",
150
119
  "title",
151
- "sku",
152
- "ean",
153
- "upc",
154
- "product_id",
155
- "product.id",
156
- "product.title",
157
- "product.thumbnail",
158
- "product.status",
159
- "product.categories.id",
160
- "product.categories.name"
120
+ "handle",
121
+ "status",
122
+ "thumbnail",
123
+ "*collection",
124
+ "categories.id",
125
+ "categories.name",
126
+ "variants.id"
161
127
  ].join(",");
162
128
  var Root = () => {
163
129
  const { t } = useTranslation();
164
130
  const form = useFormContext();
165
- const initialSelection = (form.getValues("selected_variant_ids") ?? []).reduce(
131
+ const initialSelection = (form.getValues("selected_product_ids") ?? []).reduce(
166
132
  (acc, id) => {
167
133
  acc[id] = true;
168
134
  return acc;
@@ -174,28 +140,21 @@ var Root = () => {
174
140
  const state = typeof fn === "function" ? fn(rowSelection) : fn;
175
141
  setRowSelection(state);
176
142
  const ids = Object.keys(state);
177
- form.setValue("selected_variant_ids", ids, {
143
+ form.setValue("selected_product_ids", ids, {
178
144
  shouldDirty: true,
179
145
  shouldTouch: true,
180
146
  shouldValidate: true
181
147
  });
182
148
  };
183
- const { searchParams, raw } = useProductVariantsTableQuery({
184
- pageSize: PAGE_SIZE
185
- });
186
- const {
187
- variants,
188
- count,
189
- isPending: isLoading,
190
- isError,
191
- error
192
- } = useVariants(
149
+ const { searchParams, raw } = useProductTableQuery({ pageSize: PAGE_SIZE });
150
+ const { products, count, isLoading, isError, error } = useProducts(
193
151
  { ...searchParams, fields: FIELDS },
194
152
  { placeholderData: keepPreviousData }
195
153
  );
154
+ const filters = useProductTableFilters();
196
155
  const columns = useColumns();
197
156
  const { table } = useDataTable({
198
- data: variants ?? [],
157
+ data: products ?? [],
199
158
  columns,
200
159
  enablePagination: true,
201
160
  enableRowSelection: true,
@@ -208,7 +167,7 @@ var Root = () => {
208
167
  }
209
168
  });
210
169
  useEffect(() => {
211
- void form.trigger("selected_variant_ids");
170
+ void form.trigger("selected_product_ids");
212
171
  }, [rowSelection, form]);
213
172
  if (isError) {
214
173
  throw error;
@@ -227,6 +186,7 @@ var Root = () => {
227
186
  columns,
228
187
  pageSize: PAGE_SIZE,
229
188
  isLoading,
189
+ filters,
230
190
  orderBy: [
231
191
  { key: "title", label: t("fields.title") },
232
192
  { key: "created_at", label: t("fields.createdAt") },
@@ -238,7 +198,11 @@ var Root = () => {
238
198
  search: "autofocus"
239
199
  }
240
200
  ),
241
- /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle text-ui-fg-subtle border-t px-6 py-4", children: /* @__PURE__ */ jsx("span", { className: "txt-small", children: t("offers.create.tip") }) })
201
+ /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle border-t px-6 py-4", children: /* @__PURE__ */ jsxs("p", { className: "border-ui-border-strong txt-small text-ui-fg-subtle border-l-2 pl-3", children: [
202
+ /* @__PURE__ */ jsx("span", { className: "text-ui-fg-base font-medium", children: t("offers.create.tipLabel") }),
203
+ " ",
204
+ t("offers.create.tip")
205
+ ] }) })
242
206
  ]
243
207
  }
244
208
  );
@@ -269,52 +233,44 @@ var useColumns = () => {
269
233
  )
270
234
  }),
271
235
  columnHelper.display({
272
- id: "title",
273
- header: t("fields.title"),
274
- cell: ({ row }) => {
275
- const variant = row.original;
276
- const title = variant.title ?? "";
277
- if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
278
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[320px] items-center gap-x-3 overflow-hidden", children: [
279
- /* @__PURE__ */ jsx("div", { className: "w-fit flex-shrink-0", children: /* @__PURE__ */ jsx(Thumbnail, { src: variant.product?.thumbnail ?? null }) }),
280
- /* @__PURE__ */ jsx("span", { className: "truncate", title, children: title })
281
- ] });
282
- }
236
+ id: "product",
237
+ header: () => /* @__PURE__ */ jsx(ProductHeader, {}),
238
+ cell: ({ row }) => /* @__PURE__ */ jsx(
239
+ ProductCell,
240
+ {
241
+ product: {
242
+ title: row.original.title ?? "",
243
+ thumbnail: row.original.thumbnail ?? null
244
+ }
245
+ }
246
+ )
283
247
  }),
284
248
  columnHelper.display({
285
249
  id: "categories",
286
250
  header: () => /* @__PURE__ */ jsx(CategoryHeader, {}),
287
- cell: ({ row }) => /* @__PURE__ */ jsx(CategoryCell, { categories: row.original.product?.categories })
251
+ cell: ({ row }) => /* @__PURE__ */ jsx(CategoryCell, { categories: row.original.categories })
288
252
  }),
289
- columnHelper.accessor("sku", {
290
- header: t("fields.sku"),
291
- cell: ({ getValue }) => {
292
- const sku = getValue();
293
- if (!sku) return /* @__PURE__ */ jsx(PlaceholderCell, {});
294
- return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: sku }) });
295
- }
296
- }),
297
- columnHelper.accessor("ean", {
298
- header: t("offers.fields.ean"),
299
- cell: ({ getValue }) => {
300
- const value = getValue();
301
- if (!value) return /* @__PURE__ */ jsx(PlaceholderCell, {});
302
- return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: value }) });
253
+ columnHelper.display({
254
+ id: "collection",
255
+ header: t("fields.collection"),
256
+ cell: ({ row }) => {
257
+ const title = row.original.collection?.title;
258
+ if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
259
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: title });
303
260
  }
304
261
  }),
305
- columnHelper.accessor("upc", {
306
- header: t("offers.fields.upc"),
307
- cell: ({ getValue }) => {
308
- const value = getValue();
309
- if (!value) return /* @__PURE__ */ jsx(PlaceholderCell, {});
310
- return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: value }) });
311
- }
262
+ columnHelper.display({
263
+ id: "variants",
264
+ header: t("offers.fields.variants"),
265
+ cell: ({ row }) => /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: t("offers.fields.variantsCount", {
266
+ count: row.original.variants?.length ?? 0
267
+ }) })
312
268
  }),
313
269
  columnHelper.display({
314
270
  id: "status",
315
271
  header: () => /* @__PURE__ */ jsx(ProductStatusHeader, {}),
316
272
  cell: ({ row }) => {
317
- const status = row.original.product?.status;
273
+ const status = row.original.status;
318
274
  if (!status) return /* @__PURE__ */ jsx(PlaceholderCell, {});
319
275
  return /* @__PURE__ */ jsx(ProductStatusCell, { status });
320
276
  }
@@ -326,7 +282,7 @@ var useColumns = () => {
326
282
  Root._tabMeta = defineTabMeta({
327
283
  id: "catalogue",
328
284
  labelKey: "offers.create.tabs.catalogue",
329
- validationFields: ["selected_variant_ids"]
285
+ validationFields: ["selected_product_ids"]
330
286
  });
331
287
  var CreateOfferCatalogueTab = Root;
332
288
 
@@ -335,6 +291,7 @@ import { useMemo as useMemo2 } from "react";
335
291
  import { useFormContext as useFormContext2, useWatch } from "react-hook-form";
336
292
  import { useTranslation as useTranslation2 } from "react-i18next";
337
293
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
294
+ var isGroup = (row) => row.__group === true;
338
295
  var Root2 = () => {
339
296
  const form = useFormContext2();
340
297
  const { setCloseOnEscape } = useRouteModal();
@@ -346,6 +303,22 @@ var Root2 = () => {
346
303
  control: form.control,
347
304
  name: "variants"
348
305
  });
306
+ const gridData = useMemo2(() => {
307
+ const rows = [];
308
+ let lastProductId;
309
+ (variants ?? []).forEach((variant, index) => {
310
+ if (variant.product_id !== lastProductId) {
311
+ rows.push({
312
+ __group: true,
313
+ id: `group-${variant.product_id}`,
314
+ product_title: variant.product_title
315
+ });
316
+ lastProductId = variant.product_id;
317
+ }
318
+ rows.push({ ...variant, __group: false, __formIndex: index });
319
+ });
320
+ return rows;
321
+ }, [variants]);
349
322
  const columns = useColumns2({
350
323
  currencyCode: currency_code,
351
324
  stockLocations: stock_locations,
@@ -361,7 +334,7 @@ var Root2 = () => {
361
334
  DataGrid,
362
335
  {
363
336
  columns,
364
- data: variants ?? [],
337
+ data: gridData,
365
338
  state: form,
366
339
  onEditingChange: (editing) => setCloseOnEscape(!editing)
367
340
  }
@@ -388,10 +361,20 @@ var useColumns2 = ({
388
361
  id: "title",
389
362
  header: t("fields.title"),
390
363
  cell: (context) => {
391
- const entity = context.row.original;
392
- const title = entity.variant_title || "";
364
+ const row = context.row.original;
365
+ if (isGroup(row)) {
366
+ return /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsx2(
367
+ "span",
368
+ {
369
+ className: "text-ui-fg-subtle truncate font-medium",
370
+ title: row.product_title,
371
+ children: row.product_title
372
+ }
373
+ ) });
374
+ }
375
+ const title = row.variant_title || "";
393
376
  return /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsxs2("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
394
- /* @__PURE__ */ jsx2(Thumbnail, { src: entity.product_thumbnail ?? null }),
377
+ /* @__PURE__ */ jsx2(Thumbnail, { src: row.product_thumbnail ?? null }),
395
378
  /* @__PURE__ */ jsx2("span", { className: "truncate", title, children: title })
396
379
  ] }) });
397
380
  },
@@ -401,40 +384,52 @@ var useColumns2 = ({
401
384
  id: "sku",
402
385
  name: t("fields.sku"),
403
386
  header: t("fields.sku"),
404
- field: (context) => `variants.${context.row.index}.sku`,
387
+ field: (context) => {
388
+ const row = context.row.original;
389
+ return isGroup(row) ? null : `variants.${row.__formIndex}.sku`;
390
+ },
405
391
  type: "text",
406
- cell: (context) => /* @__PURE__ */ jsx2(DataGrid.TextCell, { context })
392
+ cell: (context) => isGroup(context.row.original) ? /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context }) : /* @__PURE__ */ jsx2(DataGrid.TextCell, { context })
407
393
  }),
408
394
  columnHelper2.column({
409
395
  id: "shipping_profile",
410
- name: t("shippingProfile.domain"),
411
- header: t("shippingProfile.domain"),
412
- field: (context) => `variants.${context.row.index}.shipping_profile_id`,
396
+ name: t("offers.fields.shippingProfile"),
397
+ header: t("offers.fields.shippingProfile"),
398
+ field: (context) => {
399
+ const row = context.row.original;
400
+ return isGroup(row) ? null : `variants.${row.__formIndex}.shipping_profile_id`;
401
+ },
413
402
  type: "select",
414
- cell: (context) => /* @__PURE__ */ jsx2(
403
+ cell: (context) => isGroup(context.row.original) ? /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context }) : /* @__PURE__ */ jsx2(
415
404
  DataGrid.SelectCell,
416
405
  {
417
406
  context,
418
407
  options: shippingProfileOptions,
419
- placeholder: t("shippingProfile.domain")
408
+ placeholder: ""
420
409
  }
421
410
  )
422
411
  }),
423
412
  ...createDataGridLocationStockColumns({
424
413
  stockLocations,
414
+ isReadyOnly: (context) => isGroup(context.row.original),
425
415
  getFieldName: (context, index) => {
416
+ const row = context.row.original;
417
+ if (isGroup(row)) return null;
426
418
  const location = stockLocations[index];
427
419
  if (!location) return null;
428
- return `variants.${context.row.index}.inventory.${location.id}`;
420
+ return `variants.${row.__formIndex}.inventory.${location.id}`;
429
421
  },
430
422
  t
431
423
  }),
432
424
  ...createDataGridPriceColumns({
433
425
  currencies,
434
426
  pricePreferences,
427
+ isReadyOnly: (context) => isGroup(context.row.original),
435
428
  getFieldName: (context, value) => {
429
+ const row = context.row.original;
430
+ if (isGroup(row)) return null;
436
431
  if (context.column.id?.startsWith("currency_prices")) {
437
- return `variants.${context.row.index}.prices.${value}`;
432
+ return `variants.${row.__formIndex}.prices.${value}`;
438
433
  }
439
434
  return null;
440
435
  },
@@ -471,7 +466,9 @@ var VariantRowSchema = z.object({
471
466
  ).default({})
472
467
  });
473
468
  var CreateOfferSchema = z.object({
474
- selected_variant_ids: z.array(z.string().min(1)).min(1),
469
+ // The catalogue tab selects whole products (SPEC-009); the stock &
470
+ // prices tab fans them out to their variants.
471
+ selected_product_ids: z.array(z.string().min(1)).min(1),
475
472
  variants: z.array(VariantRowSchema).min(1)
476
473
  });
477
474
  var numericOrZero = (v) => {
@@ -502,7 +499,7 @@ var variantRowRequiresSku = (row) => {
502
499
  // src/pages/offers/create/create-offer-form/create-offer-form.tsx
503
500
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
504
501
  var DEFAULTS = {
505
- selected_variant_ids: [],
502
+ selected_product_ids: [],
506
503
  variants: []
507
504
  };
508
505
  var numericOrZero2 = (v) => {
@@ -540,19 +537,18 @@ var CreateOfferForm = () => {
540
537
  const { currency_code } = useCurrentSeller();
541
538
  const { stock_locations } = useStockLocations({ limit: 100 });
542
539
  const locationIds = (stock_locations ?? []).map((l) => l.id);
543
- const selectedVariantIds = form.watch("selected_variant_ids") ?? [];
544
- const selectedVariantIdsKey = selectedVariantIds.join(",");
540
+ const selectedProductIds = form.watch("selected_product_ids") ?? [];
541
+ const selectedProductIdsKey = selectedProductIds.join(",");
545
542
  const locationsKey = locationIds.join(",");
546
- const { variants: fetchedVariants } = useVariants(
543
+ const { products: fetchedProducts } = useProducts(
547
544
  {
548
- id: selectedVariantIds,
549
- limit: selectedVariantIds.length || 1,
550
- fields: "id,title,sku,product_id,product.id,product.title,product.thumbnail"
545
+ id: selectedProductIds,
546
+ limit: selectedProductIds.length || 1,
547
+ fields: "id,title,thumbnail,variants.id,variants.title,variants.sku"
551
548
  },
552
- { enabled: selectedVariantIds.length > 0 }
549
+ { enabled: selectedProductIds.length > 0 }
553
550
  );
554
551
  useEffect2(() => {
555
- const ids = selectedVariantIdsKey ? selectedVariantIdsKey.split(",") : [];
556
552
  const locIds = locationsKey ? locationsKey.split(",") : [];
557
553
  const emptyPrices = currency_code ? { [currency_code]: "" } : {};
558
554
  const emptyInventory = locIds.reduce((acc, locId) => {
@@ -564,35 +560,35 @@ var CreateOfferForm = () => {
564
560
  existing.map((row) => [row.variant_id, row])
565
561
  );
566
562
  const next = [];
567
- for (const variantId of ids) {
568
- const previous = existingByVariantId.get(variantId);
569
- if (previous) {
563
+ for (const product of fetchedProducts ?? []) {
564
+ for (const variant of product.variants ?? []) {
565
+ const previous = existingByVariantId.get(variant.id);
566
+ if (previous) {
567
+ next.push({
568
+ ...previous,
569
+ prices: { ...emptyPrices, ...previous.prices ?? {} },
570
+ inventory: { ...emptyInventory, ...previous.inventory ?? {} }
571
+ });
572
+ continue;
573
+ }
570
574
  next.push({
571
- ...previous,
572
- prices: { ...emptyPrices, ...previous.prices ?? {} },
573
- inventory: { ...emptyInventory, ...previous.inventory ?? {} }
575
+ variant_id: variant.id,
576
+ product_id: product.id ?? "",
577
+ product_title: product.title ?? "",
578
+ variant_title: variant.title ?? variant.id,
579
+ product_thumbnail: product.thumbnail ?? null,
580
+ variant_sku: variant.sku ?? null,
581
+ sku: variant.sku ?? "",
582
+ shipping_profile_id: "",
583
+ prices: { ...emptyPrices },
584
+ inventory: { ...emptyInventory }
574
585
  });
575
- continue;
576
586
  }
577
- const fetched = (fetchedVariants ?? []).find((v) => v.id === variantId);
578
- if (!fetched) continue;
579
- next.push({
580
- variant_id: variantId,
581
- product_id: fetched.product_id ?? fetched.product?.id ?? "",
582
- product_title: fetched.product?.title ?? "",
583
- variant_title: fetched.title ?? variantId,
584
- product_thumbnail: fetched.product?.thumbnail ?? null,
585
- variant_sku: fetched.sku ?? null,
586
- sku: fetched.sku ?? "",
587
- shipping_profile_id: "",
588
- prices: { ...emptyPrices },
589
- inventory: { ...emptyInventory }
590
- });
591
587
  }
592
588
  form.setValue("variants", next, { shouldDirty: false });
593
589
  }, [
594
- selectedVariantIdsKey,
595
- fetchedVariants,
590
+ selectedProductIdsKey,
591
+ fetchedProducts,
596
592
  currency_code,
597
593
  locationsKey,
598
594
  form
@@ -715,7 +711,7 @@ var CreateOfferForm = () => {
715
711
  variant: "primary",
716
712
  size: "small",
717
713
  onClick: () => onNext(),
718
- disabled: (form.watch("selected_variant_ids")?.length ?? 0) === 0,
714
+ disabled: (form.watch("selected_product_ids")?.length ?? 0) === 0,
719
715
  children: t("actions.continue")
720
716
  },
721
717
  "next-button"