@mercurjs/admin 2.2.0-canary.20 → 2.2.0-canary.21

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 (144) hide show
  1. package/dist/{add-campaign-promotions-BNLH6QN5.js → add-campaign-promotions-EB2MYHMZ.js} +3 -3
  2. package/dist/{adjust-inventory-2LHBQAWK.js → adjust-inventory-KNHM7QEV.js} +6 -6
  3. package/dist/{api-key-management-detail-R5QQPNOD.js → api-key-management-detail-ELMPBXEB.js} +7 -7
  4. package/dist/{attribute-create-JW7OXOK2.js → attribute-create-Q3IEGYRG.js} +6 -6
  5. package/dist/{attribute-detail-3Z6MTMJT.js → attribute-detail-SDYWELHS.js} +6 -6
  6. package/dist/{attribute-list-WRTXTFED.js → attribute-list-HW3R6764.js} +6 -6
  7. package/dist/{campaign-detail-ROTJ4SWD.js → campaign-detail-EAARQB3E.js} +10 -10
  8. package/dist/{categories-metadata-EPKUI3R4.js → categories-metadata-INVMU224.js} +6 -6
  9. package/dist/{category-detail-ICACLNJ3.js → category-detail-ABK4MEZP.js} +6 -6
  10. package/dist/{category-products-V4H3B6ML.js → category-products-HTNBFHSW.js} +6 -6
  11. package/dist/{chunk-AGXO2H4E.js → chunk-2KPITPB7.js} +1 -1
  12. package/dist/{chunk-A7RM5JXC.js → chunk-3LYOKDUA.js} +1 -1
  13. package/dist/{chunk-VKOE5J66.js → chunk-3XOE4NV5.js} +11 -2
  14. package/dist/{chunk-SNCZQATG.js → chunk-4GRFDNQQ.js} +2 -2
  15. package/dist/{chunk-4Q5JHL4V.js → chunk-4O7GPTNJ.js} +1 -1
  16. package/dist/{chunk-2NA54XKC.js → chunk-5NQUJQXX.js} +57 -0
  17. package/dist/{chunk-2HMWS5UW.js → chunk-67RX3M6X.js} +154 -23
  18. package/dist/{chunk-IER5BQNC.js → chunk-6YPV4T3R.js} +1 -1
  19. package/dist/{chunk-2MYHGOPY.js → chunk-7IVRL4AF.js} +1 -1
  20. package/dist/{chunk-HR7TFO2X.js → chunk-A3IFGUDD.js} +3 -3
  21. package/dist/{chunk-7VPJ4C6F.js → chunk-AH3KBVKC.js} +1 -1
  22. package/dist/{chunk-CMHI2RPL.js → chunk-AKSUGT5I.js} +21 -0
  23. package/dist/{chunk-7JZVZ5EX.js → chunk-ARN66CDK.js} +1 -1
  24. package/dist/chunk-BN6OOLJA.js +358 -0
  25. package/dist/{chunk-WETV577Q.js → chunk-CPWOVYZE.js} +1 -1
  26. package/dist/{chunk-JQV7CXEC.js → chunk-EDDKIVMF.js} +17 -2
  27. package/dist/{chunk-HI6L7DXI.js → chunk-G66KMUI5.js} +1 -1
  28. package/dist/{chunk-SJKLYS3R.js → chunk-IO5S4RFO.js} +3 -3
  29. package/dist/{chunk-PWFZCT6H.js → chunk-JAPKOO4T.js} +1 -1
  30. package/dist/{chunk-FFNSWUDC.js → chunk-LNPJFQWA.js} +11 -4
  31. package/dist/{chunk-KXIA66EJ.js → chunk-PAEKCYFU.js} +7 -3
  32. package/dist/{chunk-MHVZVF6O.js → chunk-PT3DTHQK.js} +1 -1
  33. package/dist/{chunk-PRBE5CM3.js → chunk-QYDWMBEX.js} +31 -0
  34. package/dist/{chunk-Z3SUMFDT.js → chunk-R2UDZINP.js} +214 -38
  35. package/dist/{chunk-Z2UBJXTU.js → chunk-RDTFLHYO.js} +1 -1
  36. package/dist/{chunk-BGQ7H2KL.js → chunk-SMQM5N45.js} +2 -2
  37. package/dist/{chunk-I5THQVYP.js → chunk-XIFE4VUR.js} +1 -1
  38. package/dist/{chunk-7XBB24GO.js → chunk-YUECTKEY.js} +1 -1
  39. package/dist/{chunk-4VXYPZMT.js → chunk-Z7AXFQPD.js} +2 -2
  40. package/dist/{collection-add-products-PBCIG33C.js → collection-add-products-CKF2VFVK.js} +6 -6
  41. package/dist/{collection-create-7G3MHBVQ.js → collection-create-UNGPKT7H.js} +83 -12
  42. package/dist/{collection-detail-3OLBOV24.js → collection-detail-36QTD3ZU.js} +9 -7
  43. package/dist/collection-icon-edit-V4SNBMD5.js +117 -0
  44. package/dist/{collection-list-S4ICG5T6.js → collection-list-UN7C36DU.js} +15 -12
  45. package/dist/collection-media-ESJUYVF7.js +654 -0
  46. package/dist/{collection-metadata-VUOECEP4.js → collection-metadata-6SD67JUV.js} +6 -6
  47. package/dist/{customer-create-RW63XPQ6.js → customer-create-HZXLOIZH.js} +1 -1
  48. package/dist/{customer-create-address-SZCOIGDP.js → customer-create-address-AEZNVQOG.js} +1 -1
  49. package/dist/{customer-detail-MT2R7DFI.js → customer-detail-3OQ7RSDN.js} +9 -13
  50. package/dist/{customer-edit-ZBIZ4FKT.js → customer-edit-MMRTWOAF.js} +1 -1
  51. package/dist/customer-edit-address-AEYX2LMP.js +302 -0
  52. package/dist/{customer-group-add-customers-SG7EU4D7.js → customer-group-add-customers-4OAYSXWK.js} +2 -2
  53. package/dist/{customer-group-create-LFGY5HR6.js → customer-group-create-25JT74S3.js} +1 -1
  54. package/dist/{customer-group-detail-MCAEXZYM.js → customer-group-detail-CH4UIK3X.js} +8 -8
  55. package/dist/{customer-group-edit-CXWQSMDZ.js → customer-group-edit-AAI47MUL.js} +1 -1
  56. package/dist/{customer-group-list-V4PW33M5.js → customer-group-list-777C2B57.js} +9 -9
  57. package/dist/{customer-group-metadata-J622TR4I.js → customer-group-metadata-ELFKJMYK.js} +6 -6
  58. package/dist/{customer-list-MB6WZFMA.js → customer-list-U7VFBV7E.js} +3 -3
  59. package/dist/{customer-metadata-SFS5VRK5.js → customer-metadata-4H6ADARR.js} +6 -6
  60. package/dist/{customers-add-customer-group-G6FIKKUP.js → customers-add-customer-group-AZ3ILZMA.js} +8 -8
  61. package/dist/{edit-inventory-item-OFPVTJ4I.js → edit-inventory-item-NL5WNNI3.js} +6 -6
  62. package/dist/{edit-inventory-item-attributes-Z37AFIYM.js → edit-inventory-item-attributes-2JEH72WW.js} +6 -6
  63. package/dist/{edit-rules-JG62MLUS.js → edit-rules-XYTK7DQ2.js} +6 -6
  64. package/dist/index.js +156 -144
  65. package/dist/{inventory-create-3IM54ZO3.js → inventory-create-7RQSCNCQ.js} +6 -6
  66. package/dist/{inventory-detail-POKYZVLA.js → inventory-detail-W7BGKWKL.js} +6 -6
  67. package/dist/{inventory-metadata-XXYKRUNP.js → inventory-metadata-ZGLTDSQB.js} +6 -6
  68. package/dist/{inventory-stock-CXPPGARO.js → inventory-stock-US7LGBC4.js} +6 -6
  69. package/dist/{location-detail-PHT367V5.js → location-detail-GAINHCV5.js} +6 -6
  70. package/dist/{location-fulfillment-providers-EZOVLJWL.js → location-fulfillment-providers-6DFBFALS.js} +8 -8
  71. package/dist/{location-list-HVSRDHOW.js → location-list-QXIHD6NJ.js} +6 -6
  72. package/dist/{location-service-zone-shipping-option-create-VZBL7MK6.js → location-service-zone-shipping-option-create-AUNZVIGU.js} +6 -6
  73. package/dist/{login-LJMTSRAG.js → login-NFPUZDAL.js} +6 -6
  74. package/dist/{marketplace-detail-WINAJJDB.js → marketplace-detail-M7DWNMIH.js} +6 -6
  75. package/dist/{marketplace-metadata-CCUK2B4Q.js → marketplace-metadata-FYJ7TJLZ.js} +6 -6
  76. package/dist/{offers-5LSNWJ6B.js → offers-PYM6LQSX.js} +6 -6
  77. package/dist/{order-create-exchange-6IQJFYUK.js → order-create-exchange-4PWNGE6U.js} +6 -6
  78. package/dist/{order-create-refund-DUVGD54U.js → order-create-refund-A4AXOFZC.js} +6 -6
  79. package/dist/{order-detail-Y6SFV44C.js → order-detail-HPYAUA2N.js} +7 -7
  80. package/dist/{order-edit-billing-address-IW6UIARN.js → order-edit-billing-address-R7DOKCV5.js} +7 -7
  81. package/dist/{order-edit-email-D5XIYASI.js → order-edit-email-44O3ARQ4.js} +6 -6
  82. package/dist/{order-edit-shipping-address-4VJDVGKJ.js → order-edit-shipping-address-UI2AHBXW.js} +6 -6
  83. package/dist/{order-list-KWHMMX2M.js → order-list-IVXCYRGB.js} +4 -4
  84. package/dist/{order-metadata-QSTGFW66.js → order-metadata-3U5KT3MW.js} +6 -6
  85. package/dist/{order-request-transfer-GYBTSHU4.js → order-request-transfer-OM3BPIWZ.js} +6 -6
  86. package/dist/pages/index.d.ts +33 -9
  87. package/dist/pages/index.js +91 -90
  88. package/dist/{price-list-configuration-SNL2LNV2.js → price-list-configuration-6LD6DTEQ.js} +6 -5
  89. package/dist/{price-list-create-LPJWSOBP.js → price-list-create-SR24HYH3.js} +11 -11
  90. package/dist/{price-list-detail-7AUDNRSM.js → price-list-detail-QIMJQ6DD.js} +9 -9
  91. package/dist/{price-list-edit-BOEBNVGM.js → price-list-edit-MEM47NGY.js} +2 -2
  92. package/dist/{price-list-list-AX7ZW6LL.js → price-list-list-GIVZGIYW.js} +4 -4
  93. package/dist/{price-list-prices-add-5IOYBCXV.js → price-list-prices-add-VE5RTT5O.js} +7 -7
  94. package/dist/{price-list-prices-edit-DT2DLFTO.js → price-list-prices-edit-R52K4MBL.js} +7 -7
  95. package/dist/{product-add-existing-attributes-LNZK2LHX.js → product-add-existing-attributes-AC4643LI.js} +6 -6
  96. package/dist/{product-create-QYEZHBTC.js → product-create-R5HJ2GYT.js} +9 -9
  97. package/dist/{product-detail-Q6YF7IYX.js → product-detail-77DV4TAW.js} +6 -6
  98. package/dist/{product-list-IDRT4WUK.js → product-list-4JGMM4AF.js} +6 -6
  99. package/dist/{product-media-6H34CVXJ.js → product-media-OL4ETNFW.js} +2 -2
  100. package/dist/{product-metadata-VJMZL753.js → product-metadata-H53ZIWBS.js} +6 -6
  101. package/dist/{product-tag-create-4FYE46PE.js → product-tag-create-4OT4PMCG.js} +6 -6
  102. package/dist/{product-tag-detail-WF34TUQR.js → product-tag-detail-NVTDW7BR.js} +15 -13
  103. package/dist/{product-tag-edit-HRWMMCUC.js → product-tag-edit-RXF6ZZ6E.js} +6 -6
  104. package/dist/{product-tag-list-PK43EMMH.js → product-tag-list-T6BDTH24.js} +15 -13
  105. package/dist/{product-tag-metadata-ONSEQTEW.js → product-tag-metadata-HN5QRCYY.js} +6 -6
  106. package/dist/{product-type-detail-J466AJUQ.js → product-type-detail-KOGHJIMG.js} +6 -6
  107. package/dist/{product-type-metadata-CXYKP2OF.js → product-type-metadata-QUCMB3ZJ.js} +6 -6
  108. package/dist/{product-variant-detail-FXQZLB7Q.js → product-variant-detail-6XBLXEXQ.js} +6 -6
  109. package/dist/{product-variant-edit-CYEISGII.js → product-variant-edit-3KAFS4OC.js} +6 -6
  110. package/dist/{product-variant-metadata-YQ2GKWW7.js → product-variant-metadata-N5H2VPGQ.js} +6 -6
  111. package/dist/{promotion-create-KNK57JWD.js → promotion-create-Y2XVWGAT.js} +6 -6
  112. package/dist/{promotion-detail-EUQ5LK2V.js → promotion-detail-SCS7MWD7.js} +9 -9
  113. package/dist/{promotion-list-M5SAE7A3.js → promotion-list-ZFF4E4ZW.js} +4 -4
  114. package/dist/{refund-reason-create-ANAVZO2N.js → refund-reason-create-CIXYHBRC.js} +6 -6
  115. package/dist/{refund-reason-edit-HKEVJ6A5.js → refund-reason-edit-AXMEDPRT.js} +6 -6
  116. package/dist/{refund-reason-list-FBH43XVP.js → refund-reason-list-F56TJAGR.js} +13 -11
  117. package/dist/{region-metadata-XHT3A6D7.js → region-metadata-QGH7IBQU.js} +6 -6
  118. package/dist/{reservation-detail-T3VHDWP6.js → reservation-detail-7TL2OFEM.js} +6 -6
  119. package/dist/{reservation-metadata-4LVLM4UW.js → reservation-metadata-UXACXYO6.js} +6 -6
  120. package/dist/{reset-password-RF5J4RIU.js → reset-password-Y7HXY2NX.js} +1 -1
  121. package/dist/{return-reason-list-4JWWSFOS.js → return-reason-list-EJ5DLDR2.js} +7 -5
  122. package/dist/{sales-channel-add-products-FNJQKCQQ.js → sales-channel-add-products-7ERGMGJ7.js} +6 -6
  123. package/dist/{sales-channel-detail-HXJAR6M4.js → sales-channel-detail-LWVBJCJQ.js} +6 -6
  124. package/dist/{sales-channel-list-YYIH254X.js → sales-channel-list-I72W2XTH.js} +6 -6
  125. package/dist/{sales-channel-metadata-YF5AV2XX.js → sales-channel-metadata-RD6QDHRW.js} +6 -6
  126. package/dist/{shipping-option-type-create-TOONS7EC.js → shipping-option-type-create-LXYYXNSQ.js} +6 -6
  127. package/dist/{shipping-option-type-detail-VXZ4UQQI.js → shipping-option-type-detail-2IQSQ5BQ.js} +6 -6
  128. package/dist/{shipping-option-type-edit-6WO2XRLE.js → shipping-option-type-edit-4XKXWCN3.js} +6 -6
  129. package/dist/{shipping-option-type-list-S7TW7Q3R.js → shipping-option-type-list-QA2TA7XQ.js} +6 -6
  130. package/dist/{shipping-profile-metadata-SVD3WK7H.js → shipping-profile-metadata-PVNYV7DY.js} +6 -6
  131. package/dist/{store-create-7A5OSRIV.js → store-create-F6W5CSH2.js} +6 -6
  132. package/dist/{store-details-LSGSI4QU.js → store-details-CSHIHCVO.js} +10 -10
  133. package/dist/{store-edit-TP5CQHV7.js → store-edit-YEWQFHHM.js} +2 -2
  134. package/dist/{store-list-KQGPNQQ4.js → store-list-FGLLHZPD.js} +10 -10
  135. package/dist/{tax-region-create-JR7OHOJ5.js → tax-region-create-YQ5YBOC3.js} +7 -7
  136. package/dist/{tax-region-detail-2E56T5C2.js → tax-region-detail-EU5U3SFN.js} +6 -6
  137. package/dist/{tax-region-edit-7SBQFGPY.js → tax-region-edit-XHO3ELVD.js} +6 -6
  138. package/dist/{tax-region-metadata-4NUEQV3N.js → tax-region-metadata-NYTCYO6D.js} +6 -6
  139. package/dist/{tax-region-province-detail-5Q5E5OP7.js → tax-region-province-detail-U4RULBEK.js} +6 -6
  140. package/dist/{tax-region-tax-override-create-S5S5JZEJ.js → tax-region-tax-override-create-5MIAKHY6.js} +15 -13
  141. package/dist/{tax-region-tax-override-edit-JBG3MRNC.js → tax-region-tax-override-edit-EHLIO56A.js} +15 -13
  142. package/dist/{user-metadata-2D552EAR.js → user-metadata-VCWUSKHV.js} +6 -6
  143. package/package.json +1 -1
  144. package/dist/{chunk-WTPWO7KS.js → chunk-KAAUSK5T.js} +3 -3
@@ -0,0 +1,358 @@
1
+ import {
2
+ FileUpload,
3
+ formatFileSize
4
+ } from "./chunk-VSLHL2AZ.js";
5
+ import {
6
+ uploadFilesQuery
7
+ } from "./chunk-ZBWL72TB.js";
8
+
9
+ // src/pages/collections/common/components/collection-image-fields/types.ts
10
+ var COLLECTION_IMAGE_FORMATS = [
11
+ "image/jpeg",
12
+ "image/png",
13
+ "image/gif",
14
+ "image/webp",
15
+ "image/heic",
16
+ "image/svg+xml"
17
+ ];
18
+ var getCollectionGallery = (images) => (images ?? []).filter((image) => !image.type).sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0));
19
+ var getCollectionIcon = (images) => (images ?? []).find((image) => image.type === "icon") ?? null;
20
+
21
+ // src/pages/collections/common/components/collection-image-fields/collection-icon-input.tsx
22
+ import { XMark } from "@medusajs/icons";
23
+ import { IconButton, Text } from "@medusajs/ui";
24
+ import { useTranslation } from "react-i18next";
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ var CollectionIconInput = ({
27
+ value,
28
+ onChange,
29
+ hasError
30
+ }) => {
31
+ const { t } = useTranslation();
32
+ const handleUploaded = (files) => {
33
+ const file = files[0];
34
+ if (file) {
35
+ onChange({ url: file.url, file: file.file });
36
+ }
37
+ };
38
+ if (value) {
39
+ return /* @__PURE__ */ jsxs(
40
+ "div",
41
+ {
42
+ className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
43
+ "data-testid": "collection-icon-input-item",
44
+ children: [
45
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
46
+ /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-base flex h-10 w-[30px] items-center justify-center overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
47
+ "img",
48
+ {
49
+ src: value.url,
50
+ alt: "",
51
+ className: "size-full object-contain object-center"
52
+ }
53
+ ) }),
54
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
55
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: value.file?.name ?? value.url }),
56
+ value.file && /* @__PURE__ */ jsx(
57
+ Text,
58
+ {
59
+ size: "xsmall",
60
+ leading: "compact",
61
+ className: "text-ui-fg-subtle",
62
+ children: formatFileSize(value.file.size)
63
+ }
64
+ )
65
+ ] })
66
+ ] }),
67
+ /* @__PURE__ */ jsx(
68
+ IconButton,
69
+ {
70
+ type: "button",
71
+ size: "small",
72
+ variant: "transparent",
73
+ onClick: () => onChange(null),
74
+ "data-testid": "collection-icon-input-delete",
75
+ children: /* @__PURE__ */ jsx(XMark, {})
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ }
82
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-2", "data-testid": "collection-icon-input", children: /* @__PURE__ */ jsx(
83
+ FileUpload,
84
+ {
85
+ label: t("collections.icon.upload.title"),
86
+ hint: t("collections.icon.upload.hint"),
87
+ multiple: false,
88
+ formats: COLLECTION_IMAGE_FORMATS,
89
+ hasError,
90
+ onUploaded: handleUploaded
91
+ }
92
+ ) });
93
+ };
94
+
95
+ // src/pages/collections/common/components/collection-image-fields/collection-icon-tip.tsx
96
+ import { Text as Text2 } from "@medusajs/ui";
97
+ import { useTranslation as useTranslation2 } from "react-i18next";
98
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
99
+ var CollectionIconTip = () => {
100
+ const { t } = useTranslation2();
101
+ return /* @__PURE__ */ jsxs2(
102
+ "div",
103
+ {
104
+ className: "bg-ui-bg-component shadow-elevation-card-rest flex items-stretch gap-x-3 rounded-lg px-3 py-2",
105
+ "data-testid": "collection-icon-tip",
106
+ children: [
107
+ /* @__PURE__ */ jsx2("div", { className: "bg-ui-border-strong w-[3px] shrink-0 self-stretch rounded-full" }),
108
+ /* @__PURE__ */ jsxs2(Text2, { size: "small", className: "text-ui-fg-subtle", children: [
109
+ /* @__PURE__ */ jsx2("span", { className: "text-ui-fg-base font-medium", children: t("collections.icon.tip.label") }),
110
+ " ",
111
+ t("collections.icon.tip.text")
112
+ ] })
113
+ ]
114
+ }
115
+ );
116
+ };
117
+
118
+ // src/pages/collections/common/components/collection-image-fields/upload-collection-images.ts
119
+ var uploadCollectionImages = async ({
120
+ media,
121
+ icon
122
+ }) => {
123
+ const payload = {};
124
+ if (media !== void 0) {
125
+ payload.media = await Promise.all(
126
+ media.map(async (item, index) => {
127
+ let url = item.url;
128
+ if (item.file) {
129
+ const uploaded = await uploadFilesQuery([{ file: item.file }]);
130
+ url = uploaded.files?.[0]?.url ?? url;
131
+ }
132
+ return {
133
+ url,
134
+ is_thumbnail: item.is_thumbnail,
135
+ is_banner: item.is_banner,
136
+ rank: index
137
+ };
138
+ })
139
+ );
140
+ }
141
+ if (icon !== void 0) {
142
+ if (!icon) {
143
+ payload.icon = null;
144
+ } else if (icon.file) {
145
+ const uploaded = await uploadFilesQuery([{ file: icon.file }]);
146
+ payload.icon = uploaded.files?.[0]?.url ?? icon.url;
147
+ } else {
148
+ payload.icon = icon.url;
149
+ }
150
+ }
151
+ return payload;
152
+ };
153
+
154
+ // src/pages/collections/common/components/collection-image-fields/collection-media-input.tsx
155
+ import {
156
+ EllipsisHorizontal,
157
+ FeaturedBadge,
158
+ InformationCircleSolid,
159
+ Photo,
160
+ ThumbnailBadge,
161
+ Trash,
162
+ XMark as XMark2
163
+ } from "@medusajs/icons";
164
+ import { DropdownMenu, IconButton as IconButton2, Text as Text3, Tooltip, clx } from "@medusajs/ui";
165
+ import { useTranslation as useTranslation3 } from "react-i18next";
166
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
167
+ var CollectionMediaInput = ({
168
+ value,
169
+ onChange,
170
+ hasError
171
+ }) => {
172
+ const { t } = useTranslation3();
173
+ const handleUploaded = (files) => {
174
+ onChange([
175
+ ...value,
176
+ ...files.map((f) => ({
177
+ url: f.url,
178
+ file: f.file,
179
+ is_thumbnail: false,
180
+ is_banner: false,
181
+ field_id: f.id
182
+ }))
183
+ ]);
184
+ };
185
+ const toggleRole = (index, role, on) => {
186
+ onChange(
187
+ value.map((item, i) => ({
188
+ ...item,
189
+ [role]: i === index ? on : on ? false : item[role]
190
+ }))
191
+ );
192
+ };
193
+ const remove = (index) => {
194
+ onChange(value.filter((_, i) => i !== index));
195
+ };
196
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-2", "data-testid": "collection-media-input", children: [
197
+ /* @__PURE__ */ jsx3(
198
+ FileUpload,
199
+ {
200
+ label: t("collections.media.upload.title"),
201
+ hint: t("collections.media.upload.hint"),
202
+ formats: COLLECTION_IMAGE_FORMATS,
203
+ hasError,
204
+ onUploaded: handleUploaded
205
+ }
206
+ ),
207
+ value.length > 0 && /* @__PURE__ */ jsx3(
208
+ "ul",
209
+ {
210
+ className: "flex flex-col gap-y-2",
211
+ "data-testid": "collection-media-input-list",
212
+ children: value.map((item, index) => /* @__PURE__ */ jsxs3(
213
+ "li",
214
+ {
215
+ className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
216
+ "data-testid": `collection-media-input-item-${index}`,
217
+ children: [
218
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-3", children: [
219
+ /* @__PURE__ */ jsx3("div", { className: "bg-ui-bg-base flex h-10 w-[30px] items-center justify-center overflow-hidden rounded-md", children: item.url ? /* @__PURE__ */ jsx3(
220
+ "img",
221
+ {
222
+ src: item.url,
223
+ alt: "",
224
+ className: "size-full object-cover object-center"
225
+ }
226
+ ) : /* @__PURE__ */ jsx3(Photo, { className: "text-ui-fg-muted" }) }),
227
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
228
+ /* @__PURE__ */ jsx3(Text3, { size: "small", leading: "compact", children: item.file?.name ?? item.url }),
229
+ /* @__PURE__ */ jsxs3("div", { className: "text-ui-fg-subtle flex items-center gap-x-1", children: [
230
+ item.is_thumbnail && /* @__PURE__ */ jsx3(ThumbnailBadge, { "data-testid": "collection-media-input-item-thumbnail-badge" }),
231
+ item.is_banner && /* @__PURE__ */ jsx3(
232
+ FeaturedBadge,
233
+ {
234
+ className: "text-ui-fg-interactive",
235
+ "data-testid": "collection-media-input-item-banner-badge"
236
+ }
237
+ ),
238
+ item.file && /* @__PURE__ */ jsx3(
239
+ Text3,
240
+ {
241
+ size: "xsmall",
242
+ leading: "compact",
243
+ className: "text-ui-fg-subtle",
244
+ children: formatFileSize(item.file.size)
245
+ }
246
+ )
247
+ ] })
248
+ ] })
249
+ ] }),
250
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-1", children: [
251
+ /* @__PURE__ */ jsx3(
252
+ CollectionMediaItemMenu,
253
+ {
254
+ item,
255
+ onToggleThumbnail: () => toggleRole(index, "is_thumbnail", !item.is_thumbnail),
256
+ onToggleBanner: () => toggleRole(index, "is_banner", !item.is_banner),
257
+ onDelete: () => remove(index),
258
+ testId: `collection-media-input-item-menu-${index}`
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsx3(
262
+ IconButton2,
263
+ {
264
+ type: "button",
265
+ size: "small",
266
+ variant: "transparent",
267
+ onClick: () => remove(index),
268
+ "data-testid": `collection-media-input-item-delete-${index}`,
269
+ children: /* @__PURE__ */ jsx3(XMark2, {})
270
+ }
271
+ )
272
+ ] })
273
+ ]
274
+ },
275
+ item.field_id ?? `${item.url}-${index}`
276
+ ))
277
+ }
278
+ )
279
+ ] });
280
+ };
281
+ var CollectionMediaItemMenu = ({
282
+ item,
283
+ onToggleThumbnail,
284
+ onToggleBanner,
285
+ onDelete,
286
+ testId
287
+ }) => {
288
+ const { t } = useTranslation3();
289
+ return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
290
+ /* @__PURE__ */ jsx3(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx3(IconButton2, { size: "small", variant: "transparent", "data-testid": testId, children: /* @__PURE__ */ jsx3(EllipsisHorizontal, {}) }) }),
291
+ /* @__PURE__ */ jsxs3(DropdownMenu.Content, { children: [
292
+ /* @__PURE__ */ jsx3(
293
+ MenuItemWithTooltip,
294
+ {
295
+ icon: /* @__PURE__ */ jsx3(ThumbnailBadge, {}),
296
+ label: item.is_thumbnail ? t("collections.media.actions.removeThumbnail") : t("collections.media.actions.setThumbnail"),
297
+ tooltip: t("collections.media.tooltips.thumbnail"),
298
+ onClick: onToggleThumbnail
299
+ }
300
+ ),
301
+ /* @__PURE__ */ jsx3(
302
+ MenuItemWithTooltip,
303
+ {
304
+ icon: /* @__PURE__ */ jsx3(FeaturedBadge, {}),
305
+ label: item.is_banner ? t("collections.media.actions.removeBanner") : t("collections.media.actions.setBanner"),
306
+ tooltip: t("collections.media.tooltips.banner"),
307
+ onClick: onToggleBanner
308
+ }
309
+ ),
310
+ /* @__PURE__ */ jsx3(DropdownMenu.Separator, {}),
311
+ /* @__PURE__ */ jsxs3(
312
+ DropdownMenu.Item,
313
+ {
314
+ className: "[&_svg]:text-ui-fg-subtle flex items-center gap-x-2",
315
+ onClick: onDelete,
316
+ children: [
317
+ /* @__PURE__ */ jsx3(Trash, {}),
318
+ /* @__PURE__ */ jsx3("span", { children: t("actions.delete") })
319
+ ]
320
+ }
321
+ )
322
+ ] })
323
+ ] });
324
+ };
325
+ var MenuItemWithTooltip = ({
326
+ icon,
327
+ label,
328
+ tooltip,
329
+ onClick
330
+ }) => {
331
+ return /* @__PURE__ */ jsxs3(
332
+ DropdownMenu.Item,
333
+ {
334
+ className: clx(
335
+ "[&_svg]:text-ui-fg-subtle flex items-center gap-x-2",
336
+ "justify-between"
337
+ ),
338
+ onClick,
339
+ children: [
340
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
341
+ icon,
342
+ /* @__PURE__ */ jsx3("span", { children: label })
343
+ ] }),
344
+ /* @__PURE__ */ jsx3(Tooltip, { content: tooltip, children: /* @__PURE__ */ jsx3(InformationCircleSolid, { className: "text-ui-fg-muted" }) })
345
+ ]
346
+ }
347
+ );
348
+ };
349
+
350
+ export {
351
+ COLLECTION_IMAGE_FORMATS,
352
+ getCollectionGallery,
353
+ getCollectionIcon,
354
+ CollectionMediaInput,
355
+ CollectionIconInput,
356
+ CollectionIconTip,
357
+ uploadCollectionImages
358
+ };
@@ -106,7 +106,7 @@ import {
106
106
  } from "./chunk-VYMODH6P.js";
107
107
  import {
108
108
  useCustomer
109
- } from "./chunk-PRBE5CM3.js";
109
+ } from "./chunk-QYDWMBEX.js";
110
110
  import {
111
111
  ActionMenu
112
112
  } from "./chunk-BDGZ4EQO.js";
@@ -1,12 +1,18 @@
1
+ import {
2
+ getCollectionGallery
3
+ } from "./chunk-BN6OOLJA.js";
1
4
  import {
2
5
  TextCell
3
6
  } from "./chunk-JHIMVLB2.js";
7
+ import {
8
+ Thumbnail
9
+ } from "./chunk-WIYFXWRI.js";
4
10
 
5
11
  // src/hooks/table/columns/use-collection-table-columns.tsx
6
12
  import { createColumnHelper } from "@tanstack/react-table";
7
13
  import { useMemo } from "react";
8
14
  import { useTranslation } from "react-i18next";
9
- import { jsx } from "react/jsx-runtime";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
10
16
  var columnHelper = createColumnHelper();
11
17
  var useCollectionTableColumns = () => {
12
18
  const { t } = useTranslation();
@@ -14,7 +20,16 @@ var useCollectionTableColumns = () => {
14
20
  () => [
15
21
  columnHelper.accessor("title", {
16
22
  header: t("fields.title"),
17
- cell: ({ getValue }) => /* @__PURE__ */ jsx(TextCell, { text: getValue() })
23
+ cell: ({ getValue, row }) => {
24
+ const gallery = getCollectionGallery(
25
+ row.original.images
26
+ );
27
+ const thumbnailSrc = gallery.find((image) => image.is_thumbnail)?.url ?? gallery[0]?.url ?? null;
28
+ return /* @__PURE__ */ jsxs("div", { className: "flex size-full items-center gap-x-3 overflow-hidden", children: [
29
+ /* @__PURE__ */ jsx(Thumbnail, { src: thumbnailSrc }),
30
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: getValue() })
31
+ ] });
32
+ }
18
33
  }),
19
34
  columnHelper.accessor("handle", {
20
35
  header: t("fields.handle"),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  i18n
3
- } from "./chunk-2NA54XKC.js";
3
+ } from "./chunk-5NQUJQXX.js";
4
4
 
5
5
  // src/lib/promotions.ts
6
6
  var getPromotionStatusMap = () => ({
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4F5GP7J7.js";
4
4
  import {
5
5
  useDeletePriceListAction
6
- } from "./chunk-MHVZVF6O.js";
6
+ } from "./chunk-PT3DTHQK.js";
7
7
  import {
8
8
  getPriceListStatus
9
9
  } from "./chunk-U5MJIHLY.js";
@@ -29,10 +29,10 @@ import {
29
29
  import {
30
30
  usePriceList,
31
31
  usePriceListLinkProducts
32
- } from "./chunk-Z2UBJXTU.js";
32
+ } from "./chunk-RDTFLHYO.js";
33
33
  import {
34
34
  useCustomerGroups
35
- } from "./chunk-PRBE5CM3.js";
35
+ } from "./chunk-QYDWMBEX.js";
36
36
  import {
37
37
  ActionMenu
38
38
  } from "./chunk-BDGZ4EQO.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  usePromotionTableColumns,
3
3
  usePromotionTableQuery
4
- } from "./chunk-7VPJ4C6F.js";
4
+ } from "./chunk-AH3KBVKC.js";
5
5
  import {
6
6
  usePromotionTableFilters
7
7
  } from "./chunk-S2WEYEQR.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useCustomerGroupTableFilters
3
- } from "./chunk-CMHI2RPL.js";
3
+ } from "./chunk-AKSUGT5I.js";
4
4
  import {
5
5
  useCustomerGroupTableQuery
6
- } from "./chunk-VKOE5J66.js";
6
+ } from "./chunk-3XOE4NV5.js";
7
7
  import {
8
8
  _DataTable,
9
9
  useDataTable
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  useCustomerGroups,
19
19
  useDeleteCustomerGroupLazy
20
- } from "./chunk-PRBE5CM3.js";
20
+ } from "./chunk-QYDWMBEX.js";
21
21
  import {
22
22
  ActionMenu
23
23
  } from "./chunk-BDGZ4EQO.js";
@@ -71,7 +71,7 @@ var CustomerGroupListDataTable = () => {
71
71
  const { customer_groups, count, isPending, isError, error } = useCustomerGroups(
72
72
  {
73
73
  ...searchParams,
74
- fields: "id,name,created_at,updated_at,customers.id"
74
+ fields: "id,name,created_at,updated_at,customers.id,seller.id,seller.name"
75
75
  },
76
76
  {
77
77
  placeholderData: keepPreviousData
@@ -202,6 +202,13 @@ var useColumns = () => {
202
202
  return /* @__PURE__ */ jsx("span", { children: row.original.customers?.length ?? 0 });
203
203
  }
204
204
  }),
205
+ columnHelper.display({
206
+ id: "owner",
207
+ header: t("fields.owner"),
208
+ cell: ({ row }) => {
209
+ return /* @__PURE__ */ jsx("span", { "data-testid": `customer-group-owner-${row.original.id}`, children: row.original.seller?.name ?? "-" });
210
+ }
211
+ }),
205
212
  columnHelper.accessor("created_at", {
206
213
  header: t("fields.createdAt"),
207
214
  cell: ({ row }) => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QG6PLWNH.js";
4
4
  import {
5
5
  useCustomerTableFilters
6
- } from "./chunk-I5THQVYP.js";
6
+ } from "./chunk-XIFE4VUR.js";
7
7
  import {
8
8
  useCustomerTableQuery
9
9
  } from "./chunk-PVZBDWLK.js";
@@ -19,7 +19,7 @@ import {
19
19
  useCustomers,
20
20
  useDeleteCustomerGroup,
21
21
  useRemoveCustomersFromGroup
22
- } from "./chunk-PRBE5CM3.js";
22
+ } from "./chunk-QYDWMBEX.js";
23
23
  import {
24
24
  ActionMenu
25
25
  } from "./chunk-BDGZ4EQO.js";
@@ -304,12 +304,16 @@ var CustomerGroupGeneralSection = ({
304
304
  /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", "data-testid": "customer-group-general-section-customers-row", children: [
305
305
  /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", "data-testid": "customer-group-general-section-customers-label", children: t("customers.domain") }),
306
306
  /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", "data-testid": "customer-group-general-section-customers-value", children: group.customers?.length || "-" })
307
+ ] }),
308
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", "data-testid": "customer-group-general-section-owner-row", children: [
309
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", "data-testid": "customer-group-general-section-owner-label", children: t("fields.owner") }),
310
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", "data-testid": "customer-group-general-section-owner-value", children: group.seller?.name || "-" })
307
311
  ] })
308
312
  ] });
309
313
  };
310
314
 
311
315
  // src/pages/customer-groups/customer-group-detail/constants.ts
312
- var CUSTOMER_GROUP_DETAIL_FIELDS = "+customers.id";
316
+ var CUSTOMER_GROUP_DETAIL_FIELDS = "+customers.id,+seller.id,+seller.name";
313
317
 
314
318
  // src/pages/customer-groups/customer-group-detail/customer-group-detail.tsx
315
319
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDeletePriceList
3
- } from "./chunk-Z2UBJXTU.js";
3
+ } from "./chunk-RDTFLHYO.js";
4
4
 
5
5
  // src/pages/price-lists/common/hooks/use-delete-price-list-action.tsx
6
6
  import { toast, usePrompt } from "@medusajs/ui";
@@ -230,6 +230,24 @@ var useCreateCustomerAddress = (id, options) => {
230
230
  ...options
231
231
  });
232
232
  };
233
+ var useUpdateCustomerAddress = (id, addressId, options) => {
234
+ return useMutation2({
235
+ mutationFn: (payload) => sdk.admin.customers.$id.addresses.$addressId.mutate({
236
+ $id: id,
237
+ $addressId: addressId,
238
+ ...payload
239
+ }),
240
+ onSuccess: (data, variables, context) => {
241
+ queryClient.invalidateQueries({ queryKey: customersQueryKeys.lists() });
242
+ queryClient.invalidateQueries({ queryKey: customersQueryKeys.detail(id) });
243
+ queryClient.invalidateQueries({
244
+ queryKey: customerAddressesQueryKeys.list(id)
245
+ });
246
+ options?.onSuccess?.(data, variables, context);
247
+ },
248
+ ...options
249
+ });
250
+ };
233
251
  var useDeleteCustomerAddress = (id, options) => {
234
252
  return useMutation2({
235
253
  mutationFn: (addressId) => sdk.admin.customers.$id.addresses.$addressId.delete({
@@ -247,6 +265,17 @@ var useDeleteCustomerAddress = (id, options) => {
247
265
  ...options
248
266
  });
249
267
  };
268
+ var useCustomerAddress = (id, addressId, options) => {
269
+ const { data, ...rest } = useQuery2({
270
+ queryFn: () => sdk.admin.customers.$id.addresses.$addressId.query({
271
+ $id: id,
272
+ $addressId: addressId
273
+ }),
274
+ queryKey: customerAddressesQueryKeys.detail(id),
275
+ ...options
276
+ });
277
+ return { ...data, ...rest };
278
+ };
250
279
 
251
280
  export {
252
281
  useCustomer,
@@ -256,7 +285,9 @@ export {
256
285
  useDeleteCustomer,
257
286
  useBatchCustomerCustomerGroups,
258
287
  useCreateCustomerAddress,
288
+ useUpdateCustomerAddress,
259
289
  useDeleteCustomerAddress,
290
+ useCustomerAddress,
260
291
  customerGroupsQueryKeys,
261
292
  useCustomerGroup,
262
293
  useCustomerGroups,