@mercurjs/vendor 2.2.0-canary.2 → 2.2.0-canary.5

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 (145) hide show
  1. package/dist/{[id]-4OBGG7OH.js → [id]-3DXXFPJE.js} +7 -7
  2. package/dist/{[id]-Y2ISCLUD.js → [id]-3QBUXM5P.js} +2 -2
  3. package/dist/{[id]-3EC6HYXL.js → [id]-6I7F2CWX.js} +10 -10
  4. package/dist/{[id]-KJIQTFGE.js → [id]-CLENX4P4.js} +7 -7
  5. package/dist/{[id]-KVWYLDN3.js → [id]-DGWOCCUA.js} +9 -9
  6. package/dist/{[id]-COLO4TQJ.js → [id]-EDPXLUMQ.js} +11 -11
  7. package/dist/{[id]-KRLGIVLR.js → [id]-NWAAHM6N.js} +10 -10
  8. package/dist/{[id]-ZWWMJAKI.js → [id]-WMWGSGD5.js} +3 -3
  9. package/dist/{[id]-7BAKUHUO.js → [id]-WNR2IWCZ.js} +1 -1
  10. package/dist/{[id]-UUUQK22M.js → [id]-YFLMC7AI.js} +190 -70
  11. package/dist/{[id]-LUFRJLAU.js → [id]-ZSTC3MHU.js} +12 -12
  12. package/dist/{[id]-LTNOHLGE.js → [id]-ZUSRD52M.js} +2 -2
  13. package/dist/{[province_id]-H2QAPKVH.js → [province_id]-4O576JMN.js} +7 -7
  14. package/dist/{add-PBZQCIZQ.js → add-4HQSNMRX.js} +4 -4
  15. package/dist/{add-FIWTANZX.js → add-4IUBRHY4.js} +12 -12
  16. package/dist/{add-customer-groups-RAHCP67U.js → add-customer-groups-IIAPH2MB.js} +6 -6
  17. package/dist/{add-products-N3V2MVLD.js → add-products-4LZZZHEQ.js} +10 -10
  18. package/dist/{add-promotions-CSCAJZHV.js → add-promotions-IE6DYFL7.js} +3 -3
  19. package/dist/{address-7F5SN7PV.js → address-D533QSTK.js} +6 -6
  20. package/dist/{adjust-inventory-SZF4W7LR.js → adjust-inventory-AMBE5KGO.js} +1 -1
  21. package/dist/{allocate-items-SDFS5GYN.js → allocate-items-B67DKZZ6.js} +2 -2
  22. package/dist/{attributes-MBZ76HVZ.js → attributes-BB4O7OOS.js} +1 -1
  23. package/dist/{breadcrumb-ZCG2RHIU.js → breadcrumb-BA27PBHV.js} +6 -6
  24. package/dist/{breadcrumb-EDPMEN2P.js → breadcrumb-DW6S4FGG.js} +2 -2
  25. package/dist/{breadcrumb-7PURSRTT.js → breadcrumb-IFYULMOT.js} +6 -6
  26. package/dist/{breadcrumb-65SAGUUL.js → breadcrumb-IZKI3GPT.js} +2 -2
  27. package/dist/{breadcrumb-QV2IAX7N.js → breadcrumb-JZYJV7GG.js} +2 -2
  28. package/dist/{breadcrumb-VWELWDB2.js → breadcrumb-LOKKID7U.js} +1 -1
  29. package/dist/{breadcrumb-HND5FFWC.js → breadcrumb-N2H37QV2.js} +2 -2
  30. package/dist/{breadcrumb-WRG4SITG.js → breadcrumb-R2C6QY4X.js} +7 -7
  31. package/dist/{breadcrumb-FLDHJRVY.js → breadcrumb-THJ2HPRB.js} +1 -1
  32. package/dist/{categories-FUZQKBXV.js → categories-2SA6OUEU.js} +3 -3
  33. package/dist/{chunk-RXZFEFNV.js → chunk-27KRIXMQ.js} +8 -10
  34. package/dist/{chunk-EROX26D4.js → chunk-2RBEV5U4.js} +1 -1
  35. package/dist/{chunk-RTBNJQOV.js → chunk-2Y6AQMWI.js} +9 -9
  36. package/dist/{chunk-CNMY5HVP.js → chunk-44UMMJ5Z.js} +1 -1
  37. package/dist/{chunk-TNVYTMBL.js → chunk-457ZQ52D.js} +2 -2
  38. package/dist/{chunk-LNM2D2I4.js → chunk-4NMY6A5J.js} +2 -2
  39. package/dist/{chunk-WUPJADSO.js → chunk-6DRHR2BA.js} +1 -1
  40. package/dist/{chunk-5L2DCA4W.js → chunk-A3XYCMSV.js} +2 -6
  41. package/dist/{chunk-6Y53VZ3C.js → chunk-BDPQODDX.js} +5 -5
  42. package/dist/{chunk-X2FVFUET.js → chunk-CNT4KVYA.js} +3 -3
  43. package/dist/{chunk-DZIXC7OE.js → chunk-F5H5JZQZ.js} +28 -70
  44. package/dist/{chunk-FJUUGFXL.js → chunk-FIH3RWX2.js} +1 -1
  45. package/dist/{chunk-5ATEALH7.js → chunk-FYA5XFSG.js} +1 -5
  46. package/dist/{chunk-44RQ5PTN.js → chunk-FZHQ4RU7.js} +9 -26
  47. package/dist/{chunk-AIZM66CG.js → chunk-G7BL4L3L.js} +1 -1
  48. package/dist/{chunk-7SLWXX6L.js → chunk-HNT3DMUK.js} +1 -1
  49. package/dist/{chunk-GKZHBXZK.js → chunk-HWE4QOEO.js} +2 -2
  50. package/dist/{chunk-2DXNJURE.js → chunk-IR63FDQO.js} +1 -1
  51. package/dist/{chunk-35G3SZRN.js → chunk-IUI25GGG.js} +1 -1
  52. package/dist/{chunk-6BS2AVGJ.js → chunk-L25QQ2WQ.js} +2 -2
  53. package/dist/{chunk-QS6RWIBL.js → chunk-L2SUH6H5.js} +1 -1
  54. package/dist/{chunk-NSZQERLE.js → chunk-LOWRQKFP.js} +1 -1
  55. package/dist/{chunk-WBHFU3MG.js → chunk-LRIC4B7Z.js} +1 -1
  56. package/dist/{chunk-DDH7ULIQ.js → chunk-NIZ6GG7F.js} +1 -1
  57. package/dist/{chunk-RZLN2Q6G.js → chunk-NJZQGGY3.js} +1 -1
  58. package/dist/{chunk-UCQKXXLD.js → chunk-NXNDOUFK.js} +1 -1
  59. package/dist/{chunk-N4MVIBFM.js → chunk-QZJIDKQR.js} +1 -1
  60. package/dist/{chunk-DIW4GRTI.js → chunk-TTURAYON.js} +14 -14
  61. package/dist/{chunk-K4X324QP.js → chunk-U6PBLMXD.js} +1 -5
  62. package/dist/{chunk-GGWUWT55.js → chunk-VB3FKUFH.js} +1 -1
  63. package/dist/{chunk-NHFEY3EI.js → chunk-VIJRMTAH.js} +1 -1
  64. package/dist/{chunk-7LBY5JLV.js → chunk-VRTUSO6M.js} +1 -1
  65. package/dist/{chunk-PZ44R4AS.js → chunk-WHSE47DM.js} +1 -1
  66. package/dist/{chunk-M7KSRYRI.js → chunk-Y54FXXKC.js} +1 -1
  67. package/dist/{chunk-GXIAIITP.js → chunk-YIZK67RW.js} +0 -15
  68. package/dist/{chunk-NXNJQZCP.js → chunk-ZDQSWX6W.js} +1 -1
  69. package/dist/{chunk-QNNJN4H6.js → chunk-ZNG4GXMP.js} +10 -0
  70. package/dist/{collections-YCAAFGSW.js → collections-YKIAWPJF.js} +10 -10
  71. package/dist/{configuration-UOSNP45I.js → configuration-VYG3W3VY.js} +2 -2
  72. package/dist/{create-FCKGCZSM.js → create-2IURYR3Z.js} +21 -16
  73. package/dist/{create-ORXYT74H.js → create-C7VELTYL.js} +6 -6
  74. package/dist/{create-HI5UI2EZ.js → create-G5XL6G7W.js} +12 -12
  75. package/dist/{create-BJ4OO6LS.js → create-LMBCRUYT.js} +6 -6
  76. package/dist/{create-B5ZXTK3K.js → create-PQXCQKYL.js} +12 -12
  77. package/dist/{create-JDGM5KXE.js → create-R4FU54BA.js} +2 -2
  78. package/dist/{create-XAD5NMSJ.js → create-W6Z57NBD.js} +6 -6
  79. package/dist/{create-YDDBH4VQ.js → create-WFI5UAKV.js} +11 -11
  80. package/dist/{create-35MYQPVM.js → create-WWBEBEX3.js} +6 -6
  81. package/dist/{edit-UGEC27HP.js → edit-465N5P5K.js} +12 -12
  82. package/dist/{edit-VKT62KHG.js → edit-CZZ44QUQ.js} +7 -7
  83. package/dist/{edit-2Q7TRUTL.js → edit-FPM66ECJ.js} +6 -6
  84. package/dist/{edit-REDDBLTA.js → edit-OXMCTPMM.js} +2 -2
  85. package/dist/{edit-SGUY2CCK.js → edit-QADWO547.js} +8 -8
  86. package/dist/{edit-L5ZZLMAY.js → edit-SDUFYPUB.js} +8 -8
  87. package/dist/{edit-FKXIQ6ZI.js → edit-ZEXRHXXH.js} +8 -8
  88. package/dist/{edit-ZCXUG42Q.js → edit-ZTZARH3J.js} +6 -6
  89. package/dist/{edit-inventory-item-6B7ITDGD.js → edit-inventory-item-ULRIERFP.js} +1 -1
  90. package/dist/{edit-inventory-item-attributes-Y7MQZLXI.js → edit-inventory-item-attributes-F4RMFJ7O.js} +1 -1
  91. package/dist/{fulfillment-75Z4H23W.js → fulfillment-SDBS7ZAE.js} +6 -6
  92. package/dist/{fulfillment-providers-DQAU43JZ.js → fulfillment-providers-OLISOIOK.js} +9 -9
  93. package/dist/index.css +3 -0
  94. package/dist/index.js +126 -126
  95. package/dist/{inventory-KAUVPMPZ.js → inventory-SV7OEXA3.js} +2 -2
  96. package/dist/{invite-Q6EYDZVQ.js → invite-4GXOLGBA.js} +7 -7
  97. package/dist/{invite-CI2P4GF6.js → invite-T5E2DRJ3.js} +6 -6
  98. package/dist/{loader-FBB5OQRT.js → loader-VDYPD3RI.js} +1 -1
  99. package/dist/{login-KY342RMK.js → login-F2KYD3HD.js} +6 -6
  100. package/dist/{manage-locations-WNHEBS3A.js → manage-locations-6SJF53Q3.js} +1 -1
  101. package/dist/{media-B6ME2WXY.js → media-GJVAZ23R.js} +10 -10
  102. package/dist/{metadata-2CMH4I6U.js → metadata-3EHFO2QW.js} +6 -6
  103. package/dist/{metadata-TLDUF5KV.js → metadata-46AMJQKQ.js} +6 -6
  104. package/dist/{metadata-GWI6R4ES.js → metadata-MASPEMAH.js} +6 -6
  105. package/dist/{metadata-WR4RFXO5.js → metadata-TYRXTG7D.js} +6 -6
  106. package/dist/{metadata-NUXUC2JA.js → metadata-XRI5S7UL.js} +6 -6
  107. package/dist/{offer-create-page-4Z6L63BU.js → offer-create-page-P6WC35VW.js} +2 -2
  108. package/dist/{offer-detail-page-6MAHNNIO.js → offer-detail-page-J53ZAGPF.js} +7 -3
  109. package/dist/{offer-edit-page-DYQFU6JU.js → offer-edit-page-3MO566RP.js} +1 -1
  110. package/dist/{offer-inventory-batch-page-WKCWNDNK.js → offer-inventory-batch-page-XVL75E72.js} +2 -2
  111. package/dist/{offer-pricing-edit-page-4TYGGSOE.js → offer-pricing-edit-page-WZNP3TWV.js} +8 -4
  112. package/dist/{offers-ZG6OTDZ2.js → offers-V6RBL7JE.js} +4 -4
  113. package/dist/{onboarding-43LQQQGQ.js → onboarding-ZDJEO2PQ.js} +6 -6
  114. package/dist/{orders-ZV4D6L2V.js → orders-HLW2JMX7.js} +10 -10
  115. package/dist/{organization-ZTQGRJWS.js → organization-BV5XORHR.js} +8 -51
  116. package/dist/{organize-K6QMAMEN.js → organize-HLUNMRQ7.js} +3 -3
  117. package/dist/{organize-HNJUHEEG.js → organize-J4AQZLF3.js} +3 -3
  118. package/dist/pages/index.d.ts +14 -14
  119. package/dist/pages/index.js +29 -29
  120. package/dist/{payment-details-64US5XWD.js → payment-details-E7TAR64A.js} +6 -6
  121. package/dist/{price-lists-KBPUVSZI.js → price-lists-LKZFVUNY.js} +4 -4
  122. package/dist/{pricing-DF6C5XK4.js → pricing-IOWXFNPP.js} +6 -6
  123. package/dist/{product-tags-6MZB4W5R.js → product-tags-C4DJBIPX.js} +12 -12
  124. package/dist/{product-variant-detail-RVWEYVPC.js → product-variant-detail-HXEUTD4R.js} +23 -34
  125. package/dist/{product-variant-edit-YYNPHE4L.js → product-variant-edit-CYVK4G4J.js} +32 -24
  126. package/dist/{products-IWKTGZS6.js → products-TUZHQYSU.js} +10 -10
  127. package/dist/{products-MZBU5MEV.js → products-V3SPTJ4A.js} +16 -16
  128. package/dist/{professional-details-5T2VS6MM.js → professional-details-QVJK7GNV.js} +6 -6
  129. package/dist/{profile-6XGHAT7H.js → profile-M4MK4J7N.js} +6 -6
  130. package/dist/{promotions-O7U4BTK6.js → promotions-VAKQ7UYY.js} +4 -4
  131. package/dist/{register-N6WOSMLA.js → register-VLI5C4PI.js} +8 -8
  132. package/dist/{reset-password-EICPAY2N.js → reset-password-NCBLUMJH.js} +1 -1
  133. package/dist/{return-reasons-IX3LIOCU.js → return-reasons-3EFETIWE.js} +3 -3
  134. package/dist/{sales-channels-B6FULRWI.js → sales-channels-MKK3XQGI.js} +1 -1
  135. package/dist/{sales-channels-JW3QUYR7.js → sales-channels-R4JFYTDK.js} +1 -1
  136. package/dist/{settings-MV53ZZ53.js → settings-VOVFCJ4Q.js} +12 -12
  137. package/dist/{shipment-Q33QBMXX.js → shipment-4IGIMGZC.js} +6 -6
  138. package/dist/{shipping-profile-Y4SNEPZX.js → shipping-profile-WK7R2VVW.js} +1 -1
  139. package/dist/{shipping-profiles-2NWKCEJK.js → shipping-profiles-MYE56X3G.js} +6 -6
  140. package/dist/{stock-7CSVEJJU.js → stock-TAGO52GT.js} +6 -6
  141. package/dist/{store-X23G3JCJ.js → store-3U2WDW6T.js} +64 -133
  142. package/dist/{store-closure-P5PD2RSV.js → store-closure-HTK6XTQT.js} +12 -7
  143. package/dist/{store-select-TREPDS3G.js → store-select-N5IA6BQV.js} +7 -7
  144. package/dist/{team-SPP5OY5W.js → team-N4T6P4CT.js} +7 -7
  145. package/package.json +2 -2
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-THHRRYRS.js";
24
24
  import {
25
25
  require_dist
26
- } from "./chunk-DZIXC7OE.js";
26
+ } from "./chunk-F5H5JZQZ.js";
27
27
  import {
28
28
  Thumbnail
29
29
  } from "./chunk-WIYFXWRI.js";
@@ -32,7 +32,7 @@ import {
32
32
  } from "./chunk-INNFZYX2.js";
33
33
  import {
34
34
  useProductTag
35
- } from "./chunk-GXIAIITP.js";
35
+ } from "./chunk-YIZK67RW.js";
36
36
  import "./chunk-F4OJN2F2.js";
37
37
  import "./chunk-LRARA622.js";
38
38
  import "./chunk-M6N4ISXL.js";
@@ -41,7 +41,7 @@ import "./chunk-VXMOPVRH.js";
41
41
  import {
42
42
  useProductType
43
43
  } from "./chunk-VV6IKGCN.js";
44
- import "./chunk-NHFEY3EI.js";
44
+ import "./chunk-VIJRMTAH.js";
45
45
  import "./chunk-BOZJOOGW.js";
46
46
  import "./chunk-LWJF63JW.js";
47
47
  import "./chunk-T6LHVNWO.js";
@@ -51,13 +51,13 @@ import "./chunk-IQWK723D.js";
51
51
  import "./chunk-UORPTGV2.js";
52
52
  import {
53
53
  useCollection
54
- } from "./chunk-NXNJQZCP.js";
54
+ } from "./chunk-ZDQSWX6W.js";
55
55
  import "./chunk-VXWN37PT.js";
56
56
  import {
57
57
  useProductCategory
58
- } from "./chunk-RZLN2Q6G.js";
58
+ } from "./chunk-NJZQGGY3.js";
59
59
  import "./chunk-NBPMNUKZ.js";
60
- import "./chunk-QS6RWIBL.js";
60
+ import "./chunk-L2SUH6H5.js";
61
61
  import {
62
62
  useSalesChannels
63
63
  } from "./chunk-3B34B2M2.js";
@@ -68,18 +68,20 @@ import "./chunk-LAVHRER2.js";
68
68
  import "./chunk-Y7QKP6QU.js";
69
69
  import {
70
70
  PRODUCT_DETAIL_QUERY
71
- } from "./chunk-K4X324QP.js";
71
+ } from "./chunk-U6PBLMXD.js";
72
72
  import {
73
+ productAttributesQueryKeys,
73
74
  productsQueryKeys,
74
75
  useCancelProductEdit,
75
76
  useDeleteProduct,
76
77
  useDeleteVariantLazy,
77
78
  useProduct,
79
+ useProductAttribute,
78
80
  useProductChange,
79
81
  useProductVariants,
80
82
  useRemoveProductAttribute,
81
83
  useUpdateProduct
82
- } from "./chunk-QNNJN4H6.js";
84
+ } from "./chunk-ZNG4GXMP.js";
83
85
  import "./chunk-A5DJIOHN.js";
84
86
  import {
85
87
  queryClient
@@ -127,7 +129,7 @@ import {
127
129
  isReferenceField,
128
130
  partitionProductChangeActions
129
131
  } from "@mercurjs/dashboard-shared";
130
- import { useQuery } from "@tanstack/react-query";
132
+ import { useQueries, useQuery } from "@tanstack/react-query";
131
133
  import { Fragment, useMemo } from "react";
132
134
  import { useTranslation } from "react-i18next";
133
135
  import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
@@ -268,18 +270,105 @@ var FieldRow = ({ diff }) => {
268
270
  )
269
271
  ] });
270
272
  };
271
- var ActionLine = ({ action }) => {
273
+ var AttributeActionLine = ({
274
+ attributeId,
275
+ valueIds
276
+ }) => {
277
+ const { product_attribute } = useProductAttribute(attributeId);
278
+ const name = product_attribute?.name ?? attributeId;
279
+ const values = product_attribute?.values ?? [];
280
+ const selectedNames = valueIds && valueIds.length ? valueIds.map((id) => {
281
+ const match = values.find((v) => v.id === id);
282
+ return match?.name ?? id;
283
+ }) : [];
284
+ return /* @__PURE__ */ jsxs(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
285
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: name }),
286
+ selectedNames.length > 0 && `: ${selectedNames.join(", ")}`
287
+ ] });
288
+ };
289
+ var VariantActionLine = ({
290
+ title,
291
+ images
292
+ }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
293
+ images && images.length > 0 && /* @__PURE__ */ jsx(ImageStrip, { images }),
294
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: title }) })
295
+ ] });
296
+ var ActionLine = ({
297
+ action,
298
+ variantsById
299
+ }) => {
272
300
  const { t } = useTranslation();
301
+ const details = action.details ?? {};
302
+ if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
303
+ if (!details.attribute_id) return null;
304
+ return /* @__PURE__ */ jsx(
305
+ AttributeActionLine,
306
+ {
307
+ attributeId: details.attribute_id,
308
+ valueIds: action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD ? details.attribute_value_ids : void 0
309
+ }
310
+ );
311
+ }
312
+ const variantFallback = t("fields.variant", { defaultValue: "Variant" });
313
+ if (action.action === import_types.ProductChangeActionType.VARIANT_ADD) {
314
+ const title = details.variant?.title || details.variant?.sku || variantFallback;
315
+ return /* @__PURE__ */ jsx(VariantActionLine, { title });
316
+ }
317
+ if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
318
+ const variantId = details.variant_id ?? "";
319
+ const found = variantId ? variantsById.get(variantId) : void 0;
320
+ const title = found?.title || found?.sku || variantId || variantFallback;
321
+ const images = isImageList(found?.images) ? found?.images : void 0;
322
+ return /* @__PURE__ */ jsx(VariantActionLine, { title, images });
323
+ }
273
324
  const label = describeProductChangeAction(action, {
274
- variant: t("fields.variant", { defaultValue: "Variant" })
325
+ variant: variantFallback
275
326
  });
276
327
  return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
277
328
  };
329
+ var VariantUpdateBlock = ({
330
+ variantId,
331
+ diffs,
332
+ variantsById
333
+ }) => {
334
+ const { t } = useTranslation();
335
+ const found = variantsById.get(variantId);
336
+ const title = found?.title || found?.sku || variantId || t("fields.variant", { defaultValue: "Variant" });
337
+ const images = isImageList(found?.images) ? found?.images : void 0;
338
+ return /* @__PURE__ */ jsxs(
339
+ "div",
340
+ {
341
+ className: "flex flex-col gap-y-3",
342
+ "data-testid": `product-active-edit-variant-${variantId}`,
343
+ children: [
344
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
345
+ images && images.length > 0 && /* @__PURE__ */ jsx(ImageStrip, { images }),
346
+ /* @__PURE__ */ jsxs(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
347
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: t("products.edits.panel.variantUpdated", {
348
+ defaultValue: "Variant updated"
349
+ }) }),
350
+ ": ",
351
+ title
352
+ ] })
353
+ ] }),
354
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-4 pl-1", children: diffs.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${variantId}-${diff.field}-${idx}`)) })
355
+ ]
356
+ }
357
+ );
358
+ };
278
359
  var ProductActiveEditSection = ({
279
- productId
360
+ product
280
361
  }) => {
281
362
  const { t } = useTranslation();
282
363
  const prompt = usePrompt();
364
+ const productId = product.id;
365
+ const variantsById = useMemo(() => {
366
+ const map = /* @__PURE__ */ new Map();
367
+ for (const variant of product.variants ?? []) {
368
+ if (variant?.id) map.set(variant.id, variant);
369
+ }
370
+ return map;
371
+ }, [product.variants]);
283
372
  const { product_change, isError } = useProductChange(productId, {
284
373
  retry: false
285
374
  });
@@ -288,6 +377,37 @@ var ProductActiveEditSection = ({
288
377
  () => partitionProductChangeActions(product_change?.actions ?? []),
289
378
  [product_change]
290
379
  );
380
+ const productUpdated = useMemo(
381
+ () => updated.filter((d) => !d.variant_id),
382
+ [updated]
383
+ );
384
+ const variantsUpdated = useMemo(() => {
385
+ const groups = /* @__PURE__ */ new Map();
386
+ for (const diff of updated) {
387
+ if (!diff.variant_id) continue;
388
+ const bucket = groups.get(diff.variant_id) ?? [];
389
+ bucket.push(diff);
390
+ groups.set(diff.variant_id, bucket);
391
+ }
392
+ return groups;
393
+ }, [updated]);
394
+ const attributeIds = useMemo(() => {
395
+ const ids = /* @__PURE__ */ new Set();
396
+ for (const action of [...added, ...removed]) {
397
+ if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
398
+ const details = action.details ?? {};
399
+ if (details.attribute_id) ids.add(details.attribute_id);
400
+ }
401
+ }
402
+ return Array.from(ids);
403
+ }, [added, removed]);
404
+ const attributeQueries = useQueries({
405
+ queries: attributeIds.map((id) => ({
406
+ queryKey: productAttributesQueryKeys.detail(id),
407
+ queryFn: () => sdk.vendor.productAttributes.$id.query({ $id: id })
408
+ }))
409
+ });
410
+ const isLoadingAttributes = attributeQueries.some((q) => q.isPending);
291
411
  const onCancel = async () => {
292
412
  const confirmed = await prompt({
293
413
  title: t("products.edits.panel.cancelTitle"),
@@ -309,7 +429,10 @@ var ProductActiveEditSection = ({
309
429
  if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
310
430
  return null;
311
431
  }
312
- const hasContent = updated.length > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
432
+ if (isLoadingAttributes) {
433
+ return null;
434
+ }
435
+ const hasContent = productUpdated.length > 0 || variantsUpdated.size > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
313
436
  return /* @__PURE__ */ jsxs(
314
437
  Container,
315
438
  {
@@ -322,7 +445,7 @@ var ProductActiveEditSection = ({
322
445
  ] }),
323
446
  /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.edits.panel.description") }) }),
324
447
  hasContent && /* @__PURE__ */ jsxs(Fragment2, { children: [
325
- updated.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
448
+ productUpdated.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
326
449
  /* @__PURE__ */ jsx(
327
450
  Text,
328
451
  {
@@ -333,7 +456,30 @@ var ProductActiveEditSection = ({
333
456
  children: t("labels.updated")
334
457
  }
335
458
  ),
336
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-4", children: updated.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${diff.field}-${idx}`)) })
459
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-4", children: productUpdated.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${diff.field}-${idx}`)) })
460
+ ] }),
461
+ variantsUpdated.size > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
462
+ /* @__PURE__ */ jsx(
463
+ Text,
464
+ {
465
+ size: "small",
466
+ weight: "plus",
467
+ leading: "compact",
468
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
469
+ children: t("labels.updated")
470
+ }
471
+ ),
472
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-6", children: Array.from(variantsUpdated.entries()).map(
473
+ ([variantId, diffs]) => /* @__PURE__ */ jsx(
474
+ VariantUpdateBlock,
475
+ {
476
+ variantId,
477
+ diffs,
478
+ variantsById
479
+ },
480
+ variantId
481
+ )
482
+ ) })
337
483
  ] }),
338
484
  added.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
339
485
  /* @__PURE__ */ jsx(
@@ -346,7 +492,14 @@ var ProductActiveEditSection = ({
346
492
  children: t("labels.added")
347
493
  }
348
494
  ),
349
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx(ActionLine, { action }, action.id)) })
495
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx(
496
+ ActionLine,
497
+ {
498
+ action,
499
+ variantsById
500
+ },
501
+ action.id
502
+ )) })
350
503
  ] }),
351
504
  removed.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
352
505
  /* @__PURE__ */ jsx(
@@ -359,7 +512,14 @@ var ProductActiveEditSection = ({
359
512
  children: t("labels.removed")
360
513
  }
361
514
  ),
362
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx(ActionLine, { action }, action.id)) })
515
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx(
516
+ ActionLine,
517
+ {
518
+ action,
519
+ variantsById
520
+ },
521
+ action.id
522
+ )) })
363
523
  ] }),
364
524
  deleteRequested && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
365
525
  /* @__PURE__ */ jsx(
@@ -423,8 +583,6 @@ var productStatusColor = (status) => {
423
583
  return "green";
424
584
  case "rejected":
425
585
  return "red";
426
- case "requires_action":
427
- return "blue";
428
586
  default:
429
587
  return "grey";
430
588
  }
@@ -870,7 +1028,7 @@ var ProductVariantSection = ({
870
1028
  limit: PAGE_SIZE,
871
1029
  created_at: created_at ? JSON.parse(created_at) : void 0,
872
1030
  updated_at: updated_at ? JSON.parse(updated_at) : void 0,
873
- fields: "title,created_at,updated_at,*attribute_values,*attribute_values.attribute"
1031
+ fields: "title,created_at,updated_at,*options,*options.option"
874
1032
  },
875
1033
  {
876
1034
  placeholderData: keepPreviousData
@@ -950,44 +1108,8 @@ var useColumns = (product) => {
950
1108
  },
951
1109
  [mutateAsync, prompt, t]
952
1110
  );
953
- const optionColumns = useMemo2(() => {
954
- if (!product?.options) {
955
- return [];
956
- }
957
- return product.options.map((option) => {
958
- return columnHelper.display({
959
- id: option.id,
960
- header: option.title,
961
- cell: ({ row }) => {
962
- const variantOpt = row.original.options?.find(
963
- (opt) => opt.option_id === option.id
964
- );
965
- if (!variantOpt) {
966
- return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
967
- }
968
- return /* @__PURE__ */ jsx5(
969
- "div",
970
- {
971
- className: "flex items-center",
972
- "data-testid": `product-variant-option-${option.id}-${row.original.id}`,
973
- children: /* @__PURE__ */ jsx5(Tooltip3, { content: variantOpt.value, children: /* @__PURE__ */ jsx5(
974
- Badge2,
975
- {
976
- size: "2xsmall",
977
- title: variantOpt.value,
978
- className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
979
- "data-testid": `product-variant-option-badge-${option.id}-${row.original.id}-${variantOpt.value}`,
980
- children: variantOpt.value
981
- }
982
- ) })
983
- }
984
- );
985
- }
986
- });
987
- });
988
- }, [product]);
989
1111
  const attributeColumns = useMemo2(() => {
990
- const variantAttributes = product?.variant_attributes?.filter((attr) => attr.is_variant_axis);
1112
+ const variantAttributes = product?.attributes?.filter((attr) => attr.is_variant_axis);
991
1113
  if (!variantAttributes?.length) {
992
1114
  return [];
993
1115
  }
@@ -996,11 +1118,10 @@ var useColumns = (product) => {
996
1118
  id: `attribute-${attribute.id}`,
997
1119
  header: attribute.name,
998
1120
  cell: ({ row }) => {
999
- const variant = row.original;
1000
- const matches = variant.attribute_values?.filter(
1001
- (v) => v.attribute?.id === attribute.id
1002
- ) ?? [];
1003
- if (!matches.length) {
1121
+ const variantOpt = row.original.options?.find(
1122
+ (opt) => opt.option?.title === attribute.name
1123
+ );
1124
+ if (!variantOpt?.value) {
1004
1125
  return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
1005
1126
  }
1006
1127
  return /* @__PURE__ */ jsx5(
@@ -1008,16 +1129,16 @@ var useColumns = (product) => {
1008
1129
  {
1009
1130
  className: "flex flex-wrap items-center gap-1",
1010
1131
  "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1011
- children: matches.map((value) => /* @__PURE__ */ jsx5(Tooltip3, { content: value.name, children: /* @__PURE__ */ jsx5(
1132
+ children: /* @__PURE__ */ jsx5(Tooltip3, { content: variantOpt.value, children: /* @__PURE__ */ jsx5(
1012
1133
  Badge2,
1013
1134
  {
1014
1135
  size: "2xsmall",
1015
- title: value.name,
1136
+ title: variantOpt.value,
1016
1137
  className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1017
- "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${value.name}`,
1018
- children: value.name
1138
+ "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${variantOpt.value}`,
1139
+ children: variantOpt.value
1019
1140
  }
1020
- ) }, value.id))
1141
+ ) })
1021
1142
  }
1022
1143
  );
1023
1144
  }
@@ -1062,14 +1183,13 @@ var useColumns = (product) => {
1062
1183
  sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1063
1184
  sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1064
1185
  }),
1065
- ...optionColumns,
1066
1186
  ...attributeColumns,
1067
1187
  ...dateColumns,
1068
1188
  columnHelper.action({
1069
1189
  actions: getActions
1070
1190
  })
1071
1191
  ];
1072
- }, [t, optionColumns, attributeColumns, dateColumns, getActions]);
1192
+ }, [t, attributeColumns, dateColumns, getActions]);
1073
1193
  };
1074
1194
  var useFilters = () => {
1075
1195
  const dateFilters = useDataTableDateFilters();
@@ -1413,7 +1533,7 @@ var Root = ({ children }) => {
1413
1533
  }
1414
1534
  return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children }) : /* @__PURE__ */ jsxs8(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children: [
1415
1535
  /* @__PURE__ */ jsxs8(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1416
- /* @__PURE__ */ jsx9(ProductActiveEditSection, { productId: product.id }),
1536
+ /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1417
1537
  /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1418
1538
  /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1419
1539
  /* @__PURE__ */ jsx9(ProductVariantSection, { product })
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProductTagDetailBreadcrumb
3
- } from "./chunk-PZ44R4AS.js";
3
+ } from "./chunk-WHSE47DM.js";
4
4
  import "./chunk-N335VHD3.js";
5
5
  import "./chunk-EBZ5VZEO.js";
6
6
  import "./chunk-4F5GP7J7.js";
@@ -24,7 +24,7 @@ import "./chunk-26OOAKQ6.js";
24
24
  import "./chunk-S2WEYEQR.js";
25
25
  import "./chunk-X22KTLZ7.js";
26
26
  import "./chunk-6YA3C4NB.js";
27
- import "./chunk-AIZM66CG.js";
27
+ import "./chunk-G7BL4L3L.js";
28
28
  import "./chunk-CMHI2RPL.js";
29
29
  import "./chunk-HB3BP55W.js";
30
30
  import "./chunk-SYNUA6LQ.js";
@@ -35,15 +35,15 @@ import "./chunk-PXYDR7WQ.js";
35
35
  import "./chunk-JRTZWK77.js";
36
36
  import {
37
37
  useProductTableColumns
38
- } from "./chunk-GGWUWT55.js";
39
- import "./chunk-5ATEALH7.js";
38
+ } from "./chunk-VB3FKUFH.js";
39
+ import "./chunk-FYA5XFSG.js";
40
40
  import {
41
41
  useProductTableQuery
42
42
  } from "./chunk-H6LZ77GX.js";
43
43
  import "./chunk-FQERBIVS.js";
44
44
  import {
45
45
  useProductTableFilters
46
- } from "./chunk-5L2DCA4W.js";
46
+ } from "./chunk-A3XYCMSV.js";
47
47
  import "./chunk-DB6ANJBO.js";
48
48
  import "./chunk-PHOCVOZ5.js";
49
49
  import {
@@ -60,7 +60,7 @@ import {
60
60
  import "./chunk-LRD242C7.js";
61
61
  import "./chunk-QHQWEERJ.js";
62
62
  import "./chunk-THHRRYRS.js";
63
- import "./chunk-DZIXC7OE.js";
63
+ import "./chunk-F5H5JZQZ.js";
64
64
  import "./chunk-WIYFXWRI.js";
65
65
  import {
66
66
  SingleColumnPageSkeleton
@@ -69,14 +69,14 @@ import {
69
69
  productTagsQueryKeys,
70
70
  useDeleteProductTag,
71
71
  useProductTag
72
- } from "./chunk-GXIAIITP.js";
72
+ } from "./chunk-YIZK67RW.js";
73
73
  import "./chunk-F4OJN2F2.js";
74
74
  import "./chunk-LRARA622.js";
75
75
  import "./chunk-M6N4ISXL.js";
76
76
  import "./chunk-S7EKBD2C.js";
77
77
  import "./chunk-VXMOPVRH.js";
78
78
  import "./chunk-VV6IKGCN.js";
79
- import "./chunk-NHFEY3EI.js";
79
+ import "./chunk-VIJRMTAH.js";
80
80
  import "./chunk-BOZJOOGW.js";
81
81
  import "./chunk-LWJF63JW.js";
82
82
  import "./chunk-T6LHVNWO.js";
@@ -84,11 +84,11 @@ import "./chunk-4S6XGIC6.js";
84
84
  import "./chunk-QT7YFHCA.js";
85
85
  import "./chunk-IQWK723D.js";
86
86
  import "./chunk-UORPTGV2.js";
87
- import "./chunk-NXNJQZCP.js";
87
+ import "./chunk-ZDQSWX6W.js";
88
88
  import "./chunk-VXWN37PT.js";
89
- import "./chunk-RZLN2Q6G.js";
89
+ import "./chunk-NJZQGGY3.js";
90
90
  import "./chunk-NBPMNUKZ.js";
91
- import "./chunk-QS6RWIBL.js";
91
+ import "./chunk-L2SUH6H5.js";
92
92
  import "./chunk-3B34B2M2.js";
93
93
  import {
94
94
  ActionMenu
@@ -97,7 +97,7 @@ import "./chunk-LAVHRER2.js";
97
97
  import "./chunk-Y7QKP6QU.js";
98
98
  import {
99
99
  useProducts
100
- } from "./chunk-QNNJN4H6.js";
100
+ } from "./chunk-ZNG4GXMP.js";
101
101
  import "./chunk-A5DJIOHN.js";
102
102
  import {
103
103
  queryClient
@@ -45,13 +45,13 @@ import {
45
45
  useCompleteOrder,
46
46
  useMarkOrderFulfillmentAsDelivered,
47
47
  useOrder
48
- } from "./chunk-QS6RWIBL.js";
48
+ } from "./chunk-L2SUH6H5.js";
49
49
  import {
50
50
  ActionMenu
51
51
  } from "./chunk-BDGZ4EQO.js";
52
52
  import "./chunk-LAVHRER2.js";
53
53
  import "./chunk-Y7QKP6QU.js";
54
- import "./chunk-QNNJN4H6.js";
54
+ import "./chunk-ZNG4GXMP.js";
55
55
  import "./chunk-A5DJIOHN.js";
56
56
  import {
57
57
  queryClient
@@ -2,7 +2,7 @@ import {
2
2
  TaxOverrideTable,
3
3
  TaxRateLine,
4
4
  useTaxOverrideTable
5
- } from "./chunk-M7KSRYRI.js";
5
+ } from "./chunk-Y54FXXKC.js";
6
6
  import "./chunk-Q4UVXS46.js";
7
7
  import {
8
8
  TaxRegionCard
@@ -27,7 +27,7 @@ import "./chunk-THHRRYRS.js";
27
27
  import {
28
28
  SingleColumnPageSkeleton
29
29
  } from "./chunk-INNFZYX2.js";
30
- import "./chunk-GXIAIITP.js";
30
+ import "./chunk-YIZK67RW.js";
31
31
  import "./chunk-F4OJN2F2.js";
32
32
  import {
33
33
  useTaxRates
@@ -39,7 +39,7 @@ import {
39
39
  import "./chunk-S7EKBD2C.js";
40
40
  import "./chunk-VXMOPVRH.js";
41
41
  import "./chunk-VV6IKGCN.js";
42
- import "./chunk-NHFEY3EI.js";
42
+ import "./chunk-VIJRMTAH.js";
43
43
  import "./chunk-BOZJOOGW.js";
44
44
  import "./chunk-LWJF63JW.js";
45
45
  import "./chunk-T6LHVNWO.js";
@@ -47,16 +47,16 @@ import "./chunk-4S6XGIC6.js";
47
47
  import "./chunk-QT7YFHCA.js";
48
48
  import "./chunk-IQWK723D.js";
49
49
  import "./chunk-UORPTGV2.js";
50
- import "./chunk-NXNJQZCP.js";
50
+ import "./chunk-ZDQSWX6W.js";
51
51
  import "./chunk-VXWN37PT.js";
52
- import "./chunk-RZLN2Q6G.js";
52
+ import "./chunk-NJZQGGY3.js";
53
53
  import "./chunk-NBPMNUKZ.js";
54
- import "./chunk-QS6RWIBL.js";
54
+ import "./chunk-L2SUH6H5.js";
55
55
  import "./chunk-3B34B2M2.js";
56
56
  import "./chunk-BDGZ4EQO.js";
57
57
  import "./chunk-LAVHRER2.js";
58
58
  import "./chunk-Y7QKP6QU.js";
59
- import "./chunk-QNNJN4H6.js";
59
+ import "./chunk-ZNG4GXMP.js";
60
60
  import "./chunk-A5DJIOHN.js";
61
61
  import {
62
62
  queryClient
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AttributeValueInput
3
- } from "./chunk-35G3SZRN.js";
3
+ } from "./chunk-IUI25GGG.js";
4
4
  import {
5
5
  useAttributeTableFilters,
6
6
  useAttributeTableQuery
@@ -24,18 +24,18 @@ import {
24
24
  import "./chunk-THHRRYRS.js";
25
25
  import {
26
26
  require_dist
27
- } from "./chunk-DZIXC7OE.js";
27
+ } from "./chunk-F5H5JZQZ.js";
28
28
  import "./chunk-BDGZ4EQO.js";
29
29
  import "./chunk-LAVHRER2.js";
30
30
  import "./chunk-Y7QKP6QU.js";
31
31
  import {
32
32
  PRODUCT_DETAIL_QUERY
33
- } from "./chunk-K4X324QP.js";
33
+ } from "./chunk-U6PBLMXD.js";
34
34
  import {
35
35
  useAddProductAttribute,
36
36
  useProduct,
37
37
  useProductAttributes
38
- } from "./chunk-QNNJN4H6.js";
38
+ } from "./chunk-ZNG4GXMP.js";
39
39
  import "./chunk-A5DJIOHN.js";
40
40
  import "./chunk-RHKRREUU.js";
41
41
  import "./chunk-ZA2KFUFR.js";