@mercurjs/admin 2.2.0-canary.19 → 2.2.0-canary.20
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.
- package/dist/{add-campaign-promotions-KK4JMLSK.js → add-campaign-promotions-BNLH6QN5.js} +3 -3
- package/dist/{attribute-create-TJRNP5SK.js → attribute-create-JW7OXOK2.js} +8 -8
- package/dist/{attribute-detail-7I2SQCDK.js → attribute-detail-3Z6MTMJT.js} +7 -7
- package/dist/{attribute-edit-UBG6SMUF.js → attribute-edit-4YPWXZRX.js} +2 -2
- package/dist/{attribute-edit-possible-value-3BYEPC4X.js → attribute-edit-possible-value-YHEWXK6L.js} +2 -2
- package/dist/{campaign-detail-H32E6EDD.js → campaign-detail-ROTJ4SWD.js} +10 -10
- package/dist/{category-create-S3K54WKP.js → category-create-AR33DJYX.js} +4 -1
- package/dist/{category-detail-5MRHPG6T.js → category-detail-ICACLNJ3.js} +14 -12
- package/dist/category-icon-edit-4GXAK4JZ.js +117 -0
- package/dist/{category-list-4YSI36HW.js → category-list-PFOINLTU.js} +4 -1
- package/dist/category-media-7SLAXXXM.js +654 -0
- package/dist/{category-products-3KYY662O.js → category-products-V4H3B6ML.js} +12 -12
- package/dist/{chunk-UT2O7IS7.js → chunk-2HMWS5UW.js} +2 -2
- package/dist/{chunk-HYQPZADS.js → chunk-2L4W75VS.js} +1 -1
- package/dist/{chunk-ZDJWTF64.js → chunk-2MYHGOPY.js} +2 -2
- package/dist/{chunk-O63MLTQV.js → chunk-2NA54XKC.js} +51 -0
- package/dist/{chunk-GFUCELIZ.js → chunk-3JN4WUVU.js} +1 -1
- package/dist/{chunk-RV7DWZZB.js → chunk-4UWPTSZK.js} +1 -1
- package/dist/{chunk-5GXPXVVD.js → chunk-4VXYPZMT.js} +2 -2
- package/dist/{chunk-Y7FNFQCU.js → chunk-6FLSBL4Q.js} +1 -0
- package/dist/{chunk-3F6U44M6.js → chunk-7JZVZ5EX.js} +1 -1
- package/dist/{chunk-EASE3NLF.js → chunk-7VPJ4C6F.js} +1 -1
- package/dist/{chunk-UCHVBAUB.js → chunk-7XBB24GO.js} +2 -2
- package/dist/{chunk-MFIT2RX5.js → chunk-A7RM5JXC.js} +1 -1
- package/dist/{chunk-ZG6DNI7O.js → chunk-AGXO2H4E.js} +1 -1
- package/dist/{chunk-4DYSSDAA.js → chunk-EAC3J2Z4.js} +2 -2
- package/dist/{chunk-B7HIZN4V.js → chunk-FNGPOGDR.js} +2 -2
- package/dist/{chunk-CFBEBAQS.js → chunk-FWWPSH6V.js} +1 -1
- package/dist/{chunk-X4N7EMFO.js → chunk-FZHLRCBV.js} +2 -2
- package/dist/{chunk-X7E65HM2.js → chunk-HI6L7DXI.js} +1 -1
- package/dist/{chunk-3N7QXAMO.js → chunk-IER5BQNC.js} +1 -1
- package/dist/{chunk-GNWWL47L.js → chunk-JZBVDH6A.js} +1 -1
- package/dist/{chunk-YLK2WZU3.js → chunk-KNZ6ICKB.js} +2 -2
- package/dist/{chunk-LKW2KWJ4.js → chunk-LLHYICP5.js} +14 -2
- package/dist/{chunk-LVCIAKJI.js → chunk-LYCKVPWQ.js} +1 -1
- package/dist/{chunk-ESZN3ELN.js → chunk-M3YII6OB.js} +71 -18
- package/dist/{chunk-6AYGDFNE.js → chunk-MASXQMJY.js} +1 -1
- package/dist/{chunk-OA24YN34.js → chunk-N6R2WOJ7.js} +1 -1
- package/dist/{chunk-T53YX34K.js → chunk-NEZ35LWM.js} +3 -3
- package/dist/{chunk-AXVZ56UD.js → chunk-ORENI3LP.js} +2 -2
- package/dist/{chunk-UVYWKQJF.js → chunk-POSHDM4L.js} +1 -1
- package/dist/{chunk-GA4ZFAOV.js → chunk-PWFZCT6H.js} +1 -1
- package/dist/chunk-PZ27H46M.js +358 -0
- package/dist/{chunk-WHIYSLYW.js → chunk-QPLEFEOZ.js} +1 -1
- package/dist/{chunk-TH6W26RC.js → chunk-RWW3TAJQ.js} +4 -4
- package/dist/{chunk-YI7I7JFX.js → chunk-S6E7XAWX.js} +2 -2
- package/dist/{chunk-XKD67CD4.js → chunk-SJKLYS3R.js} +2 -2
- package/dist/{chunk-O62SUNK2.js → chunk-V3ATA433.js} +3 -3
- package/dist/{chunk-JWE2IW4R.js → chunk-WTPWO7KS.js} +7 -7
- package/dist/chunk-Y3RABQC4.js +33 -0
- package/dist/{chunk-OXONMLRP.js → chunk-ZLETFDWJ.js} +200 -105
- package/dist/{collection-add-products-4EZ6W4N6.js → collection-add-products-PBCIG33C.js} +11 -11
- package/dist/{collection-detail-X22ZIM5S.js → collection-detail-3OLBOV24.js} +12 -12
- package/dist/{collection-list-6CUEOLUU.js → collection-list-S4ICG5T6.js} +10 -10
- package/dist/{customer-detail-6MBW3FHO.js → customer-detail-MT2R7DFI.js} +10 -10
- package/dist/index.js +161 -153
- package/dist/{inventory-detail-ZWHSLLLI.js → inventory-detail-POKYZVLA.js} +7 -7
- package/dist/{location-detail-QS7HM2KG.js → location-detail-PHT367V5.js} +10 -10
- package/dist/{location-fulfillment-providers-6RUGYQ3W.js → location-fulfillment-providers-EZOVLJWL.js} +9 -9
- package/dist/{offers-WYAJB75N.js → offers-5LSNWJ6B.js} +8 -8
- package/dist/{order-detail-FZT74HMD.js → order-detail-Y6SFV44C.js} +12 -12
- package/dist/{order-edit-billing-address-OJZICMBN.js → order-edit-billing-address-IW6UIARN.js} +8 -8
- package/dist/{order-list-C5YOR6B5.js → order-list-KWHMMX2M.js} +2 -2
- package/dist/pages/index.d.ts +92 -0
- package/dist/pages/index.js +118 -115
- package/dist/{price-list-create-XQWV352E.js → price-list-create-LPJWSOBP.js} +13 -13
- package/dist/{price-list-detail-347UU3LU.js → price-list-detail-7AUDNRSM.js} +12 -12
- package/dist/{price-list-prices-add-R656I6QF.js → price-list-prices-add-5IOYBCXV.js} +12 -12
- package/dist/{product-add-existing-attributes-MNGWZFGD.js → product-add-existing-attributes-LNZK2LHX.js} +8 -8
- package/dist/{product-create-LMYR36NA.js → product-create-QYEZHBTC.js} +11 -11
- package/dist/{product-create-variant-XETT2WJC.js → product-create-variant-FQSREC66.js} +3 -3
- package/dist/{product-detail-WSL4PXKK.js → product-detail-Q6YF7IYX.js} +8 -8
- package/dist/{product-edit-attribute-XEYHQJ6D.js → product-edit-attribute-WW4LCYD7.js} +2 -2
- package/dist/{product-list-7YPGRGHX.js → product-list-IDRT4WUK.js} +12 -12
- package/dist/{product-media-H6SYBNLI.js → product-media-6H34CVXJ.js} +2 -2
- package/dist/{product-tag-detail-AUNKJJLP.js → product-tag-detail-WF34TUQR.js} +19 -19
- package/dist/{product-tag-list-IKL46JZT.js → product-tag-list-PK43EMMH.js} +19 -19
- package/dist/{product-type-detail-DKHKFADI.js → product-type-detail-J466AJUQ.js} +12 -12
- package/dist/{product-variant-edit-THZLEOGL.js → product-variant-edit-CYEISGII.js} +8 -8
- package/dist/{promotion-create-RB3AA5GE.js → promotion-create-KNK57JWD.js} +8 -8
- package/dist/{promotion-detail-PEDTLXZ4.js → promotion-detail-EUQ5LK2V.js} +9 -9
- package/dist/{promotion-list-MCYWN5TF.js → promotion-list-M5SAE7A3.js} +4 -4
- package/dist/{refund-reason-list-GPDRI2QM.js → refund-reason-list-FBH43XVP.js} +17 -17
- package/dist/region-list-2XXKCDDX.js +1 -1
- package/dist/{reservation-detail-WTYOR6IB.js → reservation-detail-T3VHDWP6.js} +7 -7
- package/dist/{reservation-list-3OKWSHWH.js → reservation-list-RGD6O4RY.js} +2 -2
- package/dist/{reset-password-2NVKH6QA.js → reset-password-RF5J4RIU.js} +1 -1
- package/dist/{return-reason-list-E6L7VJY7.js → return-reason-list-4JWWSFOS.js} +14 -14
- package/dist/{sales-channel-add-products-BKT3CFLY.js → sales-channel-add-products-FNJQKCQQ.js} +11 -11
- package/dist/{sales-channel-detail-MUBMJGQV.js → sales-channel-detail-HXJAR6M4.js} +12 -12
- package/dist/{store-bulk-edit-WML2DUA4.js → store-bulk-edit-JAOT5GY2.js} +1 -1
- package/dist/{store-details-3HWOCRYI.js → store-details-LSGSI4QU.js} +15 -15
- package/dist/{store-edit-5WWOOSHT.js → store-edit-TP5CQHV7.js} +3 -3
- package/dist/{store-list-YEEKX2AV.js → store-list-KQGPNQQ4.js} +10 -10
- package/dist/{store-member-invite-TULPI3N5.js → store-member-invite-MNRTPHUB.js} +1 -1
- package/dist/{tax-region-create-X2LAHX27.js → tax-region-create-JR7OHOJ5.js} +7 -7
- package/dist/{tax-region-detail-3X3TNFJA.js → tax-region-detail-2E56T5C2.js} +11 -11
- package/dist/{tax-region-province-detail-DIV5AAFQ.js → tax-region-province-detail-5Q5E5OP7.js} +10 -10
- package/dist/{tax-region-tax-override-create-BV4O3QCU.js → tax-region-tax-override-create-S5S5JZEJ.js} +19 -19
- package/dist/{tax-region-tax-override-edit-QUA77YTI.js → tax-region-tax-override-edit-JBG3MRNC.js} +20 -20
- package/package.json +1 -1
- package/dist/{adjust-inventory-F3OTF6O6.js → adjust-inventory-2LHBQAWK.js} +7 -7
- package/dist/{api-key-management-detail-JMWPGN6M.js → api-key-management-detail-R5QQPNOD.js} +6 -6
- package/dist/{attribute-list-EFU4DPB5.js → attribute-list-WRTXTFED.js} +6 -6
- package/dist/{categories-metadata-V37DXTVZ.js → categories-metadata-EPKUI3R4.js} +6 -6
- package/dist/{chunk-FYCIGKVG.js → chunk-3FN3YH2F.js} +3 -3
- package/dist/{chunk-D77BYNTQ.js → chunk-47TXYMFT.js} +3 -3
- package/dist/{chunk-3EUF5GRT.js → chunk-CKQPO2SN.js} +3 -3
- package/dist/{chunk-3KCXKGHX.js → chunk-KNB55WE4.js} +3 -3
- package/dist/{chunk-4IKESXD3.js → chunk-LTAQZW2L.js} +3 -3
- package/dist/{chunk-W6J4SJ3Y.js → chunk-SEY52XON.js} +6 -6
- package/dist/{chunk-BJQ4UBK7.js → chunk-WETV577Q.js} +18 -18
- package/dist/{chunk-EM5TF7YZ.js → chunk-Z3SUMFDT.js} +6 -6
- package/dist/{collection-metadata-AWJYPZKR.js → collection-metadata-VUOECEP4.js} +6 -6
- package/dist/{customer-group-detail-G53RB6EA.js → customer-group-detail-MCAEXZYM.js} +6 -6
- package/dist/{customer-group-list-XDNCZ4K6.js → customer-group-list-V4PW33M5.js} +6 -6
- package/dist/{customer-group-metadata-FWLKUHIZ.js → customer-group-metadata-J622TR4I.js} +6 -6
- package/dist/{customer-metadata-KU4YWD3R.js → customer-metadata-SFS5VRK5.js} +6 -6
- package/dist/{customers-add-customer-group-5Y5XPN7C.js → customers-add-customer-group-G6FIKKUP.js} +6 -6
- package/dist/{edit-inventory-item-MBLHBGBH.js → edit-inventory-item-OFPVTJ4I.js} +6 -6
- package/dist/{edit-inventory-item-attributes-GTTGNBO4.js → edit-inventory-item-attributes-Z37AFIYM.js} +6 -6
- package/dist/{edit-reservation-C3NXAKSE.js → edit-reservation-TBZL2REV.js} +3 -3
- package/dist/{edit-rules-UFGKSAJV.js → edit-rules-JG62MLUS.js} +6 -6
- package/dist/{inventory-create-4O4L6NXK.js → inventory-create-3IM54ZO3.js} +6 -6
- package/dist/{inventory-metadata-GZYYWU3S.js → inventory-metadata-XXYKRUNP.js} +6 -6
- package/dist/{inventory-stock-S5B6ZZQW.js → inventory-stock-CXPPGARO.js} +7 -7
- package/dist/{location-list-7RTDLHGR.js → location-list-HVSRDHOW.js} +6 -6
- package/dist/{location-service-zone-shipping-option-create-UKULBDGM.js → location-service-zone-shipping-option-create-VZBL7MK6.js} +6 -6
- package/dist/{location-service-zone-shipping-option-edit-O3B3H5OC.js → location-service-zone-shipping-option-edit-WRSLBO23.js} +3 -3
- package/dist/{login-SFGV4QGP.js → login-LJMTSRAG.js} +6 -6
- package/dist/{marketplace-detail-7VPTFUPB.js → marketplace-detail-WINAJJDB.js} +6 -6
- package/dist/{marketplace-metadata-E25VT5TH.js → marketplace-metadata-CCUK2B4Q.js} +6 -6
- package/dist/{order-create-claim-3AQK3FH2.js → order-create-claim-2MO3LM6J.js} +5 -5
- package/dist/{order-create-exchange-QCYD3DC4.js → order-create-exchange-6IQJFYUK.js} +12 -12
- package/dist/{order-create-refund-TR4XMHRY.js → order-create-refund-DUVGD54U.js} +7 -7
- package/dist/{order-edit-email-TH26N5HK.js → order-edit-email-D5XIYASI.js} +7 -7
- package/dist/{order-edit-shipping-address-GBOUGZPD.js → order-edit-shipping-address-4VJDVGKJ.js} +7 -7
- package/dist/{order-metadata-RT3BVTYZ.js → order-metadata-QSTGFW66.js} +7 -7
- package/dist/{order-request-transfer-3HTFPYFD.js → order-request-transfer-GYBTSHU4.js} +7 -7
- package/dist/{price-list-prices-edit-BOKBTLEI.js → price-list-prices-edit-DT2DLFTO.js} +6 -6
- package/dist/{product-metadata-MGLJJ7QG.js → product-metadata-VJMZL753.js} +6 -6
- package/dist/{product-tag-create-JCYAG42N.js → product-tag-create-4FYE46PE.js} +6 -6
- package/dist/{product-tag-edit-2FREKKVN.js → product-tag-edit-HRWMMCUC.js} +6 -6
- package/dist/{product-tag-metadata-UV3TBPXS.js → product-tag-metadata-ONSEQTEW.js} +6 -6
- package/dist/{product-type-metadata-22OACFMD.js → product-type-metadata-CXYKP2OF.js} +6 -6
- package/dist/{product-variant-detail-MNMJBYIP.js → product-variant-detail-FXQZLB7Q.js} +6 -6
- package/dist/{product-variant-metadata-7N7PL7WY.js → product-variant-metadata-YQ2GKWW7.js} +6 -6
- package/dist/{refund-reason-create-YWA5XP4J.js → refund-reason-create-ANAVZO2N.js} +6 -6
- package/dist/{refund-reason-edit-MBG5WL43.js → refund-reason-edit-HKEVJ6A5.js} +6 -6
- package/dist/{region-metadata-WDZ7DRGU.js → region-metadata-XHT3A6D7.js} +6 -6
- package/dist/{reservation-create-NPR2FMPA.js → reservation-create-F6YDCLCG.js} +3 -3
- package/dist/{reservation-metadata-PJVHEJRU.js → reservation-metadata-4LVLM4UW.js} +6 -6
- package/dist/{sales-channel-list-O5SFOGMA.js → sales-channel-list-YYIH254X.js} +6 -6
- package/dist/{sales-channel-metadata-67RGBA7X.js → sales-channel-metadata-YF5AV2XX.js} +6 -6
- package/dist/{shipping-option-type-create-OBF6GG5W.js → shipping-option-type-create-TOONS7EC.js} +6 -6
- package/dist/{shipping-option-type-detail-TJC2GBUA.js → shipping-option-type-detail-VXZ4UQQI.js} +6 -6
- package/dist/{shipping-option-type-edit-INKLJRSH.js → shipping-option-type-edit-6WO2XRLE.js} +6 -6
- package/dist/{shipping-option-type-list-WKA64NYE.js → shipping-option-type-list-S7TW7Q3R.js} +6 -6
- package/dist/{shipping-profile-metadata-RI6Y2N6V.js → shipping-profile-metadata-SVD3WK7H.js} +6 -6
- package/dist/{store-create-AGF2LZWR.js → store-create-7A5OSRIV.js} +6 -6
- package/dist/{tax-region-edit-7ECYGXEA.js → tax-region-edit-7SBQFGPY.js} +6 -6
- package/dist/{tax-region-metadata-FQLEYY2R.js → tax-region-metadata-4NUEQV3N.js} +6 -6
- package/dist/{user-metadata-64LX64QI.js → user-metadata-2D552EAR.js} +6 -6
|
@@ -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/categories/common/components/category-image-fields/types.ts
|
|
10
|
+
var CATEGORY_IMAGE_FORMATS = [
|
|
11
|
+
"image/jpeg",
|
|
12
|
+
"image/png",
|
|
13
|
+
"image/gif",
|
|
14
|
+
"image/webp",
|
|
15
|
+
"image/heic",
|
|
16
|
+
"image/svg+xml"
|
|
17
|
+
];
|
|
18
|
+
var getCategoryGallery = (images) => (images ?? []).filter((image) => !image.type).sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0));
|
|
19
|
+
var getCategoryIcon = (images) => (images ?? []).find((image) => image.type === "icon") ?? null;
|
|
20
|
+
|
|
21
|
+
// src/pages/categories/common/components/category-image-fields/category-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 CategoryIconInput = ({
|
|
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": "category-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": "category-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": "category-icon-input", children: /* @__PURE__ */ jsx(
|
|
83
|
+
FileUpload,
|
|
84
|
+
{
|
|
85
|
+
label: t("categories.icon.upload.title"),
|
|
86
|
+
hint: t("categories.icon.upload.hint"),
|
|
87
|
+
multiple: false,
|
|
88
|
+
formats: CATEGORY_IMAGE_FORMATS,
|
|
89
|
+
hasError,
|
|
90
|
+
onUploaded: handleUploaded
|
|
91
|
+
}
|
|
92
|
+
) });
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/pages/categories/common/components/category-image-fields/category-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 CategoryIconTip = () => {
|
|
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": "category-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("categories.icon.tip.label") }),
|
|
110
|
+
" ",
|
|
111
|
+
t("categories.icon.tip.text")
|
|
112
|
+
] })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// src/pages/categories/common/components/category-image-fields/upload-category-images.ts
|
|
119
|
+
var uploadCategoryImages = 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/categories/common/components/category-image-fields/category-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 CategoryMediaInput = ({
|
|
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": "category-media-input", children: [
|
|
197
|
+
/* @__PURE__ */ jsx3(
|
|
198
|
+
FileUpload,
|
|
199
|
+
{
|
|
200
|
+
label: t("categories.media.upload.title"),
|
|
201
|
+
hint: t("categories.media.upload.hint"),
|
|
202
|
+
formats: CATEGORY_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": "category-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": `category-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": "category-media-input-item-thumbnail-badge" }),
|
|
231
|
+
item.is_banner && /* @__PURE__ */ jsx3(
|
|
232
|
+
FeaturedBadge,
|
|
233
|
+
{
|
|
234
|
+
className: "text-ui-fg-interactive",
|
|
235
|
+
"data-testid": "category-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
|
+
CategoryMediaItemMenu,
|
|
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: `category-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": `category-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 CategoryMediaItemMenu = ({
|
|
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("categories.media.actions.removeThumbnail") : t("categories.media.actions.setThumbnail"),
|
|
297
|
+
tooltip: t("categories.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("categories.media.actions.removeBanner") : t("categories.media.actions.setBanner"),
|
|
306
|
+
tooltip: t("categories.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
|
+
CATEGORY_IMAGE_FORMATS,
|
|
352
|
+
getCategoryGallery,
|
|
353
|
+
getCategoryIcon,
|
|
354
|
+
CategoryMediaInput,
|
|
355
|
+
CategoryIconInput,
|
|
356
|
+
CategoryIconTip,
|
|
357
|
+
uploadCategoryImages
|
|
358
|
+
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
TaxOverrideTable,
|
|
3
3
|
TaxRateLine,
|
|
4
4
|
useTaxOverrideTable
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3FN3YH2F.js";
|
|
6
6
|
import {
|
|
7
7
|
TaxRegionTable,
|
|
8
8
|
useTaxRegionTable
|
|
@@ -13,15 +13,15 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getCountryProvinceObjectByIso2
|
|
15
15
|
} from "./chunk-N2TQXB44.js";
|
|
16
|
+
import {
|
|
17
|
+
formatProvider
|
|
18
|
+
} from "./chunk-VW56KWO2.js";
|
|
16
19
|
import {
|
|
17
20
|
useTaxRateTableQuery
|
|
18
21
|
} from "./chunk-MG4GKUJW.js";
|
|
19
22
|
import {
|
|
20
23
|
useTaxRegionTableQuery
|
|
21
24
|
} from "./chunk-AYVH6Q5O.js";
|
|
22
|
-
import {
|
|
23
|
-
formatProvider
|
|
24
|
-
} from "./chunk-VW56KWO2.js";
|
|
25
25
|
import {
|
|
26
26
|
SingleColumnPage
|
|
27
27
|
} from "./chunk-H6MYB7GB.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KOURHC2N.js";
|
|
4
4
|
import {
|
|
5
5
|
useSellersTableQuery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2L4W75VS.js";
|
|
7
7
|
import {
|
|
8
8
|
DateCell
|
|
9
9
|
} from "./chunk-25LYVP3C.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-H6MYB7GB.js";
|
|
20
20
|
import {
|
|
21
21
|
require_dist
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6FLSBL4Q.js";
|
|
23
23
|
import {
|
|
24
24
|
useSellers
|
|
25
25
|
} from "./chunk-LEG67A2R.js";
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
} from "./chunk-RK5N3XIX.js";
|
|
13
13
|
import {
|
|
14
14
|
useProductTableColumns
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FWWPSH6V.js";
|
|
16
16
|
import {
|
|
17
17
|
useProductTableFilters
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3JN4WUVU.js";
|
|
19
19
|
import {
|
|
20
20
|
useProductTableQuery
|
|
21
21
|
} from "./chunk-LYZDVZWA.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-HC25LNX7.js";
|
|
16
16
|
import {
|
|
17
17
|
useShippingOptionTableQuery
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2L4W75VS.js";
|
|
19
19
|
import {
|
|
20
20
|
useProductTypeTableQuery
|
|
21
21
|
} from "./chunk-VOHEQ7B5.js";
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
} from "./chunk-JHIMVLB2.js";
|
|
28
28
|
import {
|
|
29
29
|
useProductTableColumns
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FWWPSH6V.js";
|
|
31
31
|
import {
|
|
32
32
|
useProductTableFilters
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3JN4WUVU.js";
|
|
34
34
|
import {
|
|
35
35
|
useProductTableQuery
|
|
36
36
|
} from "./chunk-LYZDVZWA.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-J3AMUGGZ.js";
|
|
10
10
|
import {
|
|
11
11
|
useMemberTableQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2L4W75VS.js";
|
|
13
13
|
import {
|
|
14
14
|
useOrderTableQuery
|
|
15
15
|
} from "./chunk-QUHSHIAC.js";
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
} from "./chunk-MDABSESI.js";
|
|
22
22
|
import {
|
|
23
23
|
useProductTableColumns
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-FWWPSH6V.js";
|
|
25
25
|
import {
|
|
26
26
|
useProductTableFilters
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3JN4WUVU.js";
|
|
28
28
|
import {
|
|
29
29
|
useProductTableQuery
|
|
30
30
|
} from "./chunk-LYZDVZWA.js";
|
|
@@ -43,7 +43,10 @@ import {
|
|
|
43
43
|
} from "./chunk-E74OUNA3.js";
|
|
44
44
|
import {
|
|
45
45
|
require_dist
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-6FLSBL4Q.js";
|
|
47
|
+
import {
|
|
48
|
+
useOrders
|
|
49
|
+
} from "./chunk-RMAQKNBA.js";
|
|
47
50
|
import {
|
|
48
51
|
useApproveSeller,
|
|
49
52
|
useDeleteSellerInvite,
|
|
@@ -55,9 +58,6 @@ import {
|
|
|
55
58
|
useSellerProducts,
|
|
56
59
|
useSuspendSeller
|
|
57
60
|
} from "./chunk-LEG67A2R.js";
|
|
58
|
-
import {
|
|
59
|
-
useOrders
|
|
60
|
-
} from "./chunk-RMAQKNBA.js";
|
|
61
61
|
import {
|
|
62
62
|
ActionMenu
|
|
63
63
|
} from "./chunk-BDGZ4EQO.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/pages/categories/category-create/components/create-category-form/schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var CategoryMediaSchema = z.object({
|
|
4
|
+
url: z.string(),
|
|
5
|
+
file: z.any().nullable(),
|
|
6
|
+
// File
|
|
7
|
+
is_thumbnail: z.boolean(),
|
|
8
|
+
is_banner: z.boolean(),
|
|
9
|
+
field_id: z.string().optional()
|
|
10
|
+
});
|
|
11
|
+
var CategoryIconSchema = z.object({
|
|
12
|
+
url: z.string(),
|
|
13
|
+
file: z.any().nullable()
|
|
14
|
+
// File
|
|
15
|
+
});
|
|
16
|
+
var CreateCategoryDetailsSchema = z.object({
|
|
17
|
+
name: z.string().min(1),
|
|
18
|
+
description: z.string().optional(),
|
|
19
|
+
handle: z.string().optional(),
|
|
20
|
+
status: z.enum(["active", "inactive"]),
|
|
21
|
+
visibility: z.enum(["public", "internal"]),
|
|
22
|
+
media: z.array(CategoryMediaSchema).optional(),
|
|
23
|
+
icon: CategoryIconSchema.nullable().optional()
|
|
24
|
+
});
|
|
25
|
+
var CreateCategorySchema = z.object({
|
|
26
|
+
rank: z.number().nullable(),
|
|
27
|
+
parent_category_id: z.string().nullable()
|
|
28
|
+
}).merge(CreateCategoryDetailsSchema);
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
CategoryIconSchema,
|
|
32
|
+
CreateCategorySchema
|
|
33
|
+
};
|