@mercurjs/admin 2.1.2 → 2.2.0-canary.1
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/[id]-YI7UXOO2.js +499 -0
- package/dist/{add-campaign-promotions-6Z2STQT4.js → add-campaign-promotions-OLNTDP26.js} +14 -16
- package/dist/{adjust-inventory-NVBPZYOF.js → adjust-inventory-CVWSBMHU.js} +13 -12
- package/dist/{api-key-management-create-THDCXGWK.js → api-key-management-create-7RWOCVAO.js} +3 -3
- package/dist/{api-key-management-detail-IRYR6J2I.js → api-key-management-detail-ZIIDMHFI.js} +24 -23
- package/dist/{api-key-management-edit-LTVNXP6T.js → api-key-management-edit-ACH6TJAX.js} +3 -3
- package/dist/{api-key-management-list-4WCDP4B3.js → api-key-management-list-JHBBXGHH.js} +11 -13
- package/dist/{api-key-management-sales-channels-NVFG2ESH.js → api-key-management-sales-channels-XEBTUB5V.js} +15 -15
- package/dist/attribute-create-BYO7BDF5.js +562 -0
- package/dist/attribute-create-possible-value-EXVHC272.js +476 -0
- package/dist/{attribute-detail-R26GDX7Q.js → attribute-detail-36XP35P6.js} +74 -64
- package/dist/attribute-edit-WMJWHT7Z.js +183 -0
- package/dist/attribute-edit-possible-value-KTUZ7YLW.js +164 -0
- package/dist/{attribute-edit-ranking-CEBR5LJ7.js → attribute-edit-ranking-7AAAYEC7.js} +66 -61
- package/dist/{attribute-list-XR7OSL2H.js → attribute-list-OHU2QMUG.js} +24 -26
- package/dist/{campaign-create-AZTR5UZP.js → campaign-create-VFFIIRE4.js} +4 -4
- package/dist/{campaign-detail-TCPO6DTI.js → campaign-detail-AZKBPDLC.js} +27 -28
- package/dist/{campaign-list-DCLVAFEM.js → campaign-list-NQGNOFVZ.js} +10 -12
- package/dist/{categories-metadata-YVUNHMQT.js → categories-metadata-YZUP43OH.js} +17 -16
- package/dist/{category-create-DG3Z5RYE.js → category-create-2MRYTSYM.js} +4 -4
- package/dist/{category-detail-K2UNFPRV.js → category-detail-KTFD3VVR.js} +29 -28
- package/dist/{category-edit-IXU6E3YT.js → category-edit-QLOS2LBA.js} +5 -5
- package/dist/{category-list-2MG37UXJ.js → category-list-U7ZQBSZN.js} +11 -13
- package/dist/{category-organize-CCX2INRS.js → category-organize-TIKTYJFZ.js} +2 -2
- package/dist/{category-products-LKT7564A.js → category-products-7P5DSQN4.js} +30 -29
- package/dist/{chunk-6YGOXPB5.js → chunk-2LQ5SCPB.js} +5 -5
- package/dist/{chunk-ZZO3INVE.js → chunk-2MDGYHWN.js} +128 -25
- package/dist/{chunk-X3YEY2PY.js → chunk-2S6VXFBZ.js} +8 -8
- package/dist/{chunk-5CK6XEFV.js → chunk-2YYXP6XI.js} +183 -111
- package/dist/{chunk-GAD5DQOY.js → chunk-3EDQIZV6.js} +2 -2
- package/dist/{chunk-4IZ2RD3L.js → chunk-3IVTUFBM.js} +8 -8
- package/dist/{chunk-7YHAFHGI.js → chunk-3JSAS7QP.js} +92 -165
- package/dist/{chunk-DVKO4VRC.js → chunk-3P4VTL4S.js} +12 -12
- package/dist/{chunk-GJPGL7RP.js → chunk-3VTAK3S6.js} +108 -28
- package/dist/{chunk-C3WE6EFO.js → chunk-4YWKKCTT.js} +1 -2
- package/dist/chunk-533GMKEG.js +125 -0
- package/dist/chunk-57BHSFNA.js +101 -0
- package/dist/{chunk-AEFDAU3Y.js → chunk-5KGMGL4N.js} +4 -24
- package/dist/{chunk-VGM5UQRA.js → chunk-637OFDFC.js} +809 -306
- package/dist/{chunk-NRJ7F7JW.js → chunk-6AZKWCVL.js} +14 -14
- package/dist/{chunk-JCSPXBS3.js → chunk-6FIU2V6Y.js} +1 -1
- package/dist/chunk-77T2UI6L.js +1671 -0
- package/dist/{chunk-B6SYYKJI.js → chunk-A4UQKKGC.js} +13 -13
- package/dist/{chunk-B6FG7A6W.js → chunk-A772RAKB.js} +1 -1
- package/dist/{chunk-35Q6JF3S.js → chunk-A7JOHU6Q.js} +4 -4
- package/dist/{chunk-N57BOIPU.js → chunk-AB2LHP3M.js} +1 -1
- package/dist/chunk-ABFL4ACD.js +207 -0
- package/dist/{chunk-HY3CV5V6.js → chunk-AKTAFKIU.js} +4 -4
- package/dist/{chunk-N23OD7WS.js → chunk-ALATTLBM.js} +7 -7
- package/dist/{chunk-PBQ5M44A.js → chunk-AXTQMIIK.js} +13 -30
- package/dist/{chunk-TAKEQAZZ.js → chunk-B3EEDC47.js} +2 -2
- package/dist/{chunk-EWMEXGFZ.js → chunk-BCVUMATY.js} +18 -18
- package/dist/{chunk-34I4QIBD.js → chunk-BE6JLTMI.js} +1 -1
- package/dist/{chunk-V7EPLR3E.js → chunk-BFT3CN5L.js} +10 -10
- package/dist/{chunk-O5YFLNSQ.js → chunk-BGGUVHDG.js} +27 -27
- package/dist/{chunk-HGULM6DF.js → chunk-BGQ7H2KL.js} +10 -10
- package/dist/{chunk-3DOCALSU.js → chunk-BHOZKBYY.js} +395 -11
- package/dist/{chunk-KHHMQM2L.js → chunk-BLYJZMNE.js} +5 -5
- package/dist/chunk-CBG4E3M3.js +165 -0
- package/dist/{chunk-5ZBQICCP.js → chunk-CBGXKU7Z.js} +18 -18
- package/dist/{chunk-LFATSJPO.js → chunk-CKACZXMP.js} +9 -9
- package/dist/{chunk-GXRLLA5H.js → chunk-CKD5563X.js} +4 -4
- package/dist/{chunk-E3DLJSYD.js → chunk-COP7NFSJ.js} +1 -1
- package/dist/{chunk-ABUQBBEM.js → chunk-CVFVEDMV.js} +4 -4
- package/dist/chunk-CYGIJOA5.js +79 -0
- package/dist/{chunk-CXO3C3L2.js → chunk-D5T7QOVY.js} +11 -11
- package/dist/{chunk-ARMGWHYU.js → chunk-DOSKHIRH.js} +16 -16
- package/dist/{chunk-UEEYZGM3.js → chunk-DRJAKRTI.js} +46 -17
- package/dist/{chunk-NEN6KWAJ.js → chunk-ED7XNGZD.js} +12 -12
- package/dist/{chunk-W576GZBG.js → chunk-EJTB2SLE.js} +9 -9
- package/dist/{chunk-32OKBVER.js → chunk-ELM74U2R.js} +5 -5
- package/dist/chunk-EREXPX6I.js +348 -0
- package/dist/{chunk-MNYDJXTM.js → chunk-FB7DDNCA.js} +5 -5
- package/dist/{chunk-GZBVMHXS.js → chunk-FFNSWUDC.js} +10 -10
- package/dist/{chunk-YKDEE7ZL.js → chunk-FTAR3BDS.js} +1 -1
- package/dist/{chunk-2OYCT5NO.js → chunk-G4PROEJI.js} +5 -5
- package/dist/{chunk-OQMBWJPH.js → chunk-GKW445WA.js} +1 -1
- package/dist/{chunk-LNAXUDW2.js → chunk-GLPS6QFG.js} +64 -62
- package/dist/{chunk-3IN6MMKV.js → chunk-GNLPUGYK.js} +2 -2
- package/dist/{chunk-3IBSB2U6.js → chunk-H23AKDB2.js} +14 -14
- package/dist/{chunk-Z2QQZOG3.js → chunk-H5PYBIOZ.js} +1 -1
- package/dist/{chunk-63OSYRLS.js → chunk-HR7TFO2X.js} +4 -4
- package/dist/{chunk-XB3HXEZB.js → chunk-HWBUIBJD.js} +77 -72
- package/dist/{chunk-4Q7LZQVY.js → chunk-IAWZQKUH.js} +10 -10
- package/dist/{chunk-2U5BRCQO.js → chunk-IEPNHH7Z.js} +1 -1
- package/dist/chunk-IIFQ7KYL.js +171 -0
- package/dist/{chunk-HNUA6XIW.js → chunk-IRTI3AS3.js} +14 -14
- package/dist/chunk-J65IXAGI.js +292 -0
- package/dist/{chunk-VIGX66F7.js → chunk-JQBSPUH2.js} +1 -1
- package/dist/{chunk-4ZN3D4YS.js → chunk-K4TGNN4P.js} +9 -9
- package/dist/{chunk-R46PKJUT.js → chunk-KXIA66EJ.js} +13 -13
- package/dist/{chunk-CIH5DSU7.js → chunk-LCGLQNOI.js} +11 -11
- package/dist/{chunk-RE3AYHPM.js → chunk-LLOKYZMI.js} +4 -4
- package/dist/chunk-LT3REHJG.js +2355 -0
- package/dist/{chunk-VVWB3GIK.js → chunk-LYZDVZWA.js} +3 -12
- package/dist/{chunk-AZAGUAN4.js → chunk-MN3AEVR7.js} +15 -15
- package/dist/{chunk-J24X54DB.js → chunk-MVNO35S5.js} +7 -7
- package/dist/{chunk-PIZ7FN3L.js → chunk-N2LH7A4X.js} +9 -9
- package/dist/{chunk-SPIVEW2Y.js → chunk-NQBSSM5V.js} +8 -8
- package/dist/{chunk-HKDFWQ6Q.js → chunk-NQEXDLYH.js} +460 -2
- package/dist/{chunk-HO7Z6MC3.js → chunk-NZ2LHIKD.js} +33 -33
- package/dist/{chunk-DBNPVU3L.js → chunk-OSEIN4Y2.js} +1 -1
- package/dist/{chunk-XBHUWCBD.js → chunk-P25PIADJ.js} +1 -1
- package/dist/{chunk-GPKTJXGG.js → chunk-PCLSODMO.js} +32 -32
- package/dist/{chunk-WRRMBJBQ.js → chunk-PXTJJQKJ.js} +1 -1
- package/dist/chunk-PYDRHQTY.js +24 -0
- package/dist/{chunk-ORI7UXS6.js → chunk-Q6I2IKJB.js} +6 -6
- package/dist/{chunk-X4DGVTMC.js → chunk-QIU6DJY6.js} +5 -5
- package/dist/{chunk-F67RRVMJ.js → chunk-RKH3A4O3.js} +13 -13
- package/dist/chunk-RQ4NMLSS.js +8 -0
- package/dist/{chunk-7QWLLYOY.js → chunk-RQPDD3RI.js} +1 -1
- package/dist/{chunk-DL2ZIXBO.js → chunk-S5BJ5CMF.js} +1 -1
- package/dist/chunk-SG76L7C7.js +61 -0
- package/dist/{chunk-3ZSYFPHB.js → chunk-SRDK3XX7.js} +20 -20
- package/dist/{chunk-SJQG3RCN.js → chunk-TGFZ4UBK.js} +19 -19
- package/dist/{chunk-WIQ2HBJG.js → chunk-TITPJHIL.js} +13 -13
- package/dist/{chunk-SOJ4TLWP.js → chunk-TP7L6M7V.js} +5 -5
- package/dist/{chunk-OG4WH7IW.js → chunk-U7XILJH6.js} +35 -32
- package/dist/{chunk-7MTFPHXR.js → chunk-UPNMDPFX.js} +6 -6
- package/dist/{chunk-7XXM72CF.js → chunk-UR6HGBFE.js} +62 -89
- package/dist/{chunk-5OS2MBRB.js → chunk-UXQAHUGZ.js} +8 -8
- package/dist/chunk-V5XHY5LP.js +39 -0
- package/dist/{chunk-NHAOR25V.js → chunk-W7NN2EFL.js} +20 -20
- package/dist/{chunk-YEUUI6JF.js → chunk-WDH5C2NS.js} +1 -1
- package/dist/{chunk-BEU674HI.js → chunk-WKCYMDTV.js} +5 -5
- package/dist/{chunk-M73MP4NC.js → chunk-WNYDGJ3E.js} +19 -19
- package/dist/{chunk-6MJ5HPIP.js → chunk-WS63IRBI.js} +3 -3
- package/dist/chunk-WV4SQ57G.js +141 -0
- package/dist/{chunk-Y3FXVIJO.js → chunk-WVKVPGJW.js} +4 -4
- package/dist/{chunk-GDHF6CT5.js → chunk-X45JKZYW.js} +11 -11
- package/dist/{chunk-GKJLFLGN.js → chunk-XJ3WC4G7.js} +4 -4
- package/dist/{chunk-4LQX5FRH.js → chunk-XODRTI2W.js} +7 -7
- package/dist/{chunk-U7WZYWGA.js → chunk-XZZTC7E5.js} +1 -1
- package/dist/{chunk-7A5WEMNW.js → chunk-Y3NVKGGI.js} +11 -11
- package/dist/{chunk-33XUAKRP.js → chunk-YGAX72XV.js} +3 -1
- package/dist/{chunk-FSPZYOY6.js → chunk-YLKG7W4P.js} +4 -4
- package/dist/{chunk-SESTTUVM.js → chunk-YN3FGNJM.js} +53 -1
- package/dist/{chunk-3T5S5RDO.js → chunk-ZHOI4QMK.js} +4 -4
- package/dist/{chunk-CEG375CR.js → chunk-ZSFJVRRS.js} +4 -4
- package/dist/chunk-ZZ3XFIEM.js +84 -0
- package/dist/{collection-add-products-IRYJ6U6P.js → collection-add-products-XL2TAKQD.js} +30 -29
- package/dist/{collection-create-3BTRORHU.js → collection-create-HUNYHKUJ.js} +2 -2
- package/dist/{collection-detail-263PM4DL.js → collection-detail-2DSZVOI7.js} +28 -27
- package/dist/{collection-edit-L5GPFBBX.js → collection-edit-OQGYTQDO.js} +2 -2
- package/dist/{collection-list-IVPTNBSI.js → collection-list-NGCW7OTG.js} +35 -36
- package/dist/{collection-metadata-KHGPTV5C.js → collection-metadata-47N7TUOH.js} +17 -16
- package/dist/{commission-rate-create-3N6BHEGT.js → commission-rate-create-BQY3UGKV.js} +53 -53
- package/dist/{commission-rate-detail-MY3F2RHR.js → commission-rate-detail-LAZZLZVX.js} +18 -17
- package/dist/{commission-rate-edit-WZDPXLLZ.js → commission-rate-edit-DAFXNYYN.js} +53 -53
- package/dist/{commission-rate-list-JPBOTOTA.js → commission-rate-list-Y5XLEO67.js} +8 -10
- package/dist/{constants-CAwtRicB.d.ts → constants-26tEckuq.d.ts} +3 -3
- package/dist/{customer-detail-2QBJPF7S.js → customer-detail-D5SSLNFT.js} +27 -28
- package/dist/{customer-group-add-customers-JCLAH45C.js → customer-group-add-customers-VJUBEN7M.js} +13 -15
- package/dist/{customer-group-detail-BDKFWKTI.js → customer-group-detail-KRT7E2JA.js} +24 -25
- package/dist/{customer-group-list-3NEEJXQH.js → customer-group-list-KKDIESQ6.js} +24 -25
- package/dist/{customer-group-metadata-YJXZFSFG.js → customer-group-metadata-J6JY7DZ3.js} +17 -16
- package/dist/{customer-list-ZIFNZXO4.js → customer-list-MB6WZFMA.js} +11 -13
- package/dist/{customer-metadata-SG6M7X3Q.js → customer-metadata-AH2LBK4T.js} +17 -16
- package/dist/{customers-add-customer-group-OQIFQZBL.js → customers-add-customer-group-AHGAPEIS.js} +27 -28
- package/dist/{edit-inventory-item-TDG2ZTPM.js → edit-inventory-item-ADNLKLCN.js} +13 -12
- package/dist/{edit-inventory-item-attributes-T56PJTCT.js → edit-inventory-item-attributes-XVR2WLDU.js} +13 -12
- package/dist/{edit-reservation-T6SKOG2F.js → edit-reservation-HQQL42QX.js} +7 -7
- package/dist/{edit-rules-4AHZQGCX.js → edit-rules-YMKM5JPI.js} +17 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.js +824 -598
- package/dist/{inventory-create-P26OGAHD.js → inventory-create-IVESXFSV.js} +19 -18
- package/dist/{inventory-detail-7W7UUWNT.js → inventory-detail-TINIAFVB.js} +26 -27
- package/dist/{inventory-list-PA4B4RWY.js → inventory-list-YLIAKQXI.js} +10 -12
- package/dist/{inventory-metadata-LUGA3KNV.js → inventory-metadata-6INRH2JC.js} +17 -16
- package/dist/{inventory-stock-UZSYXXPX.js → inventory-stock-6YGTATID.js} +21 -20
- package/dist/loader-6KDBTRVR.js +26 -0
- package/dist/{location-detail-RUC2ZP3K.js → location-detail-EK2S7WOK.js} +22 -21
- package/dist/{location-fulfillment-providers-WDET6TJP.js → location-fulfillment-providers-KUUNC2KP.js} +36 -36
- package/dist/{location-list-R7EECG5Z.js → location-list-IV323QW2.js} +19 -19
- package/dist/{location-sales-channels-IS6E3I4S.js → location-sales-channels-EYUXMTW7.js} +12 -12
- package/dist/{location-service-zone-create-HAQVVTKP.js → location-service-zone-create-ZS3UWJAA.js} +8 -11
- package/dist/{location-service-zone-manage-areas-5LCENMAM.js → location-service-zone-manage-areas-S7QZTIFT.js} +8 -11
- package/dist/{location-service-zone-shipping-option-create-FV5Y2PNB.js → location-service-zone-shipping-option-create-36JZFRGY.js} +23 -21
- package/dist/{location-service-zone-shipping-option-edit-PLEDWIY3.js → location-service-zone-shipping-option-edit-3PGSNKYT.js} +8 -7
- package/dist/{location-service-zone-shipping-option-pricing-6QHLZ6IN.js → location-service-zone-shipping-option-pricing-JLGCOZGS.js} +8 -8
- package/dist/{login-EWHQY6G3.js → login-6L3RMREO.js} +13 -12
- package/dist/{manage-locations-TU5HCIKG.js → manage-locations-CFTM6DNH.js} +1 -1
- package/dist/{marketplace-add-currencies-PB73MHM6.js → marketplace-add-currencies-6ANNBGZM.js} +8 -10
- package/dist/{marketplace-detail-3KFGJWQ7.js → marketplace-detail-BAU2MEJT.js} +22 -23
- package/dist/{marketplace-edit-U5B6WA56.js → marketplace-edit-6Q3G2OY5.js} +5 -4
- package/dist/{marketplace-metadata-VYCPYFJD.js → marketplace-metadata-KRCGKOCA.js} +17 -16
- package/dist/offers-IFKM6EQT.js +440 -0
- package/dist/{order-allocate-items-2B6T5JCK.js → order-allocate-items-DJ2V4B7A.js} +11 -11
- package/dist/{order-create-claim-R2SX6YUS.js → order-create-claim-RMDDCUZ6.js} +27 -61
- package/dist/{order-create-edit-G35PDCQ2.js → order-create-edit-PQ54JFZZ.js} +24 -58
- package/dist/{order-create-exchange-7KKMJHXE.js → order-create-exchange-T6DBVS75.js} +41 -48
- package/dist/{order-create-fulfillment-2FTTWTFE.js → order-create-fulfillment-SMSUJSBN.js} +22 -20
- package/dist/{order-create-refund-KWYYLAED.js → order-create-refund-OW3MIXBY.js} +17 -16
- package/dist/{order-create-return-BQFRANNG.js → order-create-return-YCX6C3VP.js} +25 -27
- package/dist/{order-create-shipment-7XP6PDTD.js → order-create-shipment-5ZAWH5CZ.js} +14 -13
- package/dist/{order-detail-BITJD73H.js → order-detail-2OAEGBQG.js} +29 -30
- package/dist/{order-edit-billing-address-FLEI4VDB.js → order-edit-billing-address-VGZBQHF5.js} +15 -14
- package/dist/{order-edit-email-AZIA6X5Q.js → order-edit-email-OOCXVRET.js} +14 -13
- package/dist/{order-edit-shipping-address-GJMUSOPK.js → order-edit-shipping-address-B4F3E5RE.js} +14 -13
- package/dist/{order-list-D2SJOMZ2.js → order-list-DQTMCEFD.js} +25 -27
- package/dist/{order-metadata-RXIJOP4V.js → order-metadata-AN6MPHHT.js} +18 -17
- package/dist/{order-receive-return-JV3X7YHG.js → order-receive-return-DZ4IUOHY.js} +20 -19
- package/dist/{order-request-transfer-6IZVCHGV.js → order-request-transfer-A2NJSQ4H.js} +16 -14
- package/dist/pages/index.d.ts +702 -566
- package/dist/pages/index.js +192 -184
- package/dist/{payout-detail-JWS2Q4TY.js → payout-detail-TWO6HN4E.js} +3 -3
- package/dist/{payout-list-PW6BFT4O.js → payout-list-7WJZFNW5.js} +9 -11
- package/dist/{price-list-configuration-N5D5OFXX.js → price-list-configuration-XAHXLCXR.js} +13 -15
- package/dist/{price-list-create-NQFC2JIJ.js → price-list-create-37SCDSPN.js} +35 -34
- package/dist/{price-list-detail-HRVLVBPS.js → price-list-detail-4Q2HBLAM.js} +30 -29
- package/dist/{price-list-edit-BVVLQ5WV.js → price-list-edit-ZVLD4M5T.js} +5 -5
- package/dist/{price-list-list-K4IJFZYH.js → price-list-list-ER4TOZTY.js} +13 -15
- package/dist/{price-list-prices-add-WXEGEWRA.js → price-list-prices-add-UASPZXKT.js} +31 -30
- package/dist/{price-list-prices-edit-KJEKS6TL.js → price-list-prices-edit-WHCIGSB2.js} +22 -21
- package/dist/product-add-existing-attributes-7HEJUR6J.js +420 -0
- package/dist/{product-attributes-ASPKDH7H.js → product-attributes-MHRXZK5S.js} +4 -4
- package/dist/product-brand-create-B3ZJGHUQ.js +171 -0
- package/dist/product-brand-detail-6MPQ3UFN.js +100 -0
- package/dist/product-brand-edit-3TQDHZNN.js +179 -0
- package/dist/product-brand-list-ZBPBSRQN.js +30 -0
- package/dist/product-brand-metadata-EAMW6PQJ.js +87 -0
- package/dist/product-bulk-edit-J6ZP7GGM.js +287 -0
- package/dist/{product-create-BDQ66ECX.js → product-create-KHJWRSUB.js} +34 -34
- package/dist/product-create-attribute-ZT3VZDNZ.js +196 -0
- package/dist/{product-create-option-B7SV42LO.js → product-create-option-NIAP75EE.js} +6 -24
- package/dist/{product-create-variant-7YAG2YRZ.js → product-create-variant-LCE47YFO.js} +25 -21
- package/dist/{product-detail-DCHR4B4T.js → product-detail-GLISGO65.js} +25 -27
- package/dist/{product-edit-IASCMBET.js → product-edit-EKAZRIJ6.js} +15 -8
- package/dist/product-edit-option-OZUZGMIM.js +166 -0
- package/dist/{product-list-X72QPKOK.js → product-list-2CTGPDDT.js} +31 -30
- package/dist/{product-media-VNSFLCSH.js → product-media-KREKRDOC.js} +15 -8
- package/dist/{product-metadata-GJ7C2UJG.js → product-metadata-O3BAEUYB.js} +20 -19
- package/dist/{product-organization-PN22LYKQ.js → product-organization-SBQY44IF.js} +61 -18
- package/dist/{product-prices-HI4SOTMP.js → product-prices-R5JOHVGS.js} +8 -8
- package/dist/{product-sales-channels-J2ZNRKZT.js → product-sales-channels-TFOGXCMI.js} +15 -15
- package/dist/{product-shipping-profile-G7UPGWYK.js → product-shipping-profile-E4HJ4EYW.js} +6 -5
- package/dist/{product-stock-666D3AMJ.js → product-stock-EIP2XJUR.js} +28 -27
- package/dist/{product-tag-create-PHJICTE4.js → product-tag-create-7JBM6I3V.js} +13 -12
- package/dist/{product-tag-detail-B7JEBNMJ.js → product-tag-detail-MTFAPSG2.js} +51 -51
- package/dist/{product-tag-edit-G4UNGXPT.js → product-tag-edit-O2ADFDD6.js} +13 -12
- package/dist/{product-tag-list-MAUUWH25.js → product-tag-list-EOULJIYQ.js} +51 -51
- package/dist/{product-tag-metadata-I4V6CR6Z.js → product-tag-metadata-SBOUTUXY.js} +17 -16
- package/dist/{product-type-detail-7GHH4ACU.js → product-type-detail-H4CZN27J.js} +28 -27
- package/dist/{product-type-list-LTYTTF4F.js → product-type-list-TM26QMHR.js} +12 -14
- package/dist/{product-type-metadata-KGVRMMTQ.js → product-type-metadata-KN5OXR6J.js} +17 -16
- package/dist/{product-variant-detail-PHGVJWUV.js → product-variant-detail-H2YRFDAU.js} +27 -37
- package/dist/product-variant-edit-6W7LKCEE.js +867 -0
- package/dist/{product-variant-manage-inventory-items-WENX2QCZ.js → product-variant-manage-inventory-items-Q5MJG3EJ.js} +6 -10
- package/dist/{product-variant-metadata-HV72UBCP.js → product-variant-metadata-QESZ7VS2.js} +17 -16
- package/dist/{profile-detail-UQTGEFYF.js → profile-detail-ZRL5SERS.js} +4 -4
- package/dist/{promotion-add-campaign-M4OT6URB.js → promotion-add-campaign-O3RTMS3W.js} +6 -5
- package/dist/{promotion-create-GM37OXEW.js → promotion-create-TGC6BVWF.js} +23 -21
- package/dist/{promotion-detail-PDBRQII7.js → promotion-detail-VYIXZMMD.js} +21 -20
- package/dist/{promotion-list-XW4PNLJF.js → promotion-list-C3SKV5BJ.js} +13 -15
- package/dist/{refund-reason-create-M2CYTCEM.js → refund-reason-create-2KEQFOID.js} +13 -12
- package/dist/{refund-reason-edit-M4XBV633.js → refund-reason-edit-E7CB7SM3.js} +13 -12
- package/dist/{refund-reason-list-2S2MDKBQ.js → refund-reason-list-TAHJK4OX.js} +37 -35
- package/dist/{region-add-countries-T4XZ2CU3.js → region-add-countries-COXN4LP3.js} +7 -9
- package/dist/{region-create-MQXTWBKC.js → region-create-P66Q65XY.js} +14 -15
- package/dist/{region-detail-6OFP76OY.js → region-detail-P2HHBYFV.js} +11 -13
- package/dist/{region-edit-QNJ2HT76.js → region-edit-XFE54SAO.js} +8 -7
- package/dist/{region-list-EYTDREE2.js → region-list-2XXKCDDX.js} +11 -13
- package/dist/{region-metadata-4JWOEGTZ.js → region-metadata-723RQGHS.js} +17 -16
- package/dist/{reservation-create-26QAWABA.js → reservation-create-Y3HG4AZA.js} +4 -4
- package/dist/{reservation-detail-G26K6HZV.js → reservation-detail-HQMADZ56.js} +19 -18
- package/dist/{reservation-list-CHHR6CEV.js → reservation-list-YKC3JJ6K.js} +11 -13
- package/dist/{reservation-metadata-JFLJ27A3.js → reservation-metadata-UG4YTEMY.js} +18 -17
- package/dist/{reset-password-S6IBWG47.js → reset-password-2VNU52CE.js} +1 -1
- package/dist/{return-reason-list-MCGW2JV3.js → return-reason-list-IHFO2LJK.js} +27 -28
- package/dist/{sales-channel-add-products-FH7B7UYR.js → sales-channel-add-products-YZTQ2SDS.js} +31 -30
- package/dist/{sales-channel-create-NSZEHGZE.js → sales-channel-create-BSNCLZWR.js} +2 -2
- package/dist/{sales-channel-detail-KCS472HN.js → sales-channel-detail-67G7K3IE.js} +28 -27
- package/dist/{sales-channel-edit-W6Z2ERBJ.js → sales-channel-edit-FUDXMZYV.js} +2 -2
- package/dist/{sales-channel-list-6HBRUZ2Z.js → sales-channel-list-GYLGH4U7.js} +21 -20
- package/dist/{sales-channel-metadata-NDSKXOGH.js → sales-channel-metadata-H6RSHKVP.js} +17 -16
- package/dist/{shipping-option-type-create-MEL24PGH.js → shipping-option-type-create-QAOW7753.js} +13 -12
- package/dist/{shipping-option-type-detail-IS7CNAYI.js → shipping-option-type-detail-QGWVDTDU.js} +19 -18
- package/dist/{shipping-option-type-edit-IVBHURXR.js → shipping-option-type-edit-WXYBDRNY.js} +13 -12
- package/dist/{shipping-option-type-list-BTPCLBSD.js → shipping-option-type-list-YSWP6DSC.js} +24 -25
- package/dist/{shipping-profile-detail-L3IHPGLL.js → shipping-profile-detail-YAKZHWZI.js} +5 -5
- package/dist/{shipping-profile-metadata-UZPX2PHJ.js → shipping-profile-metadata-UE53IA3J.js} +19 -18
- package/dist/{shipping-profiles-list-2JKVMEZG.js → shipping-profiles-list-JF2SQIQ7.js} +9 -11
- package/dist/{store-bulk-edit-A4ZWZ7HJ.js → store-bulk-edit-UYNQ2CPG.js} +7 -7
- package/dist/{store-create-OQVFVIK4.js → store-create-WNFRHXWR.js} +13 -12
- package/dist/{store-details-BOGWBWE7.js → store-details-R2GQU7HE.js} +44 -44
- package/dist/{store-edit-77WKNZUH.js → store-edit-UW3QOFFX.js} +11 -11
- package/dist/{store-list-2G34KVD5.js → store-list-5CV7VJLO.js} +36 -37
- package/dist/{store-member-invite-4GDKCSTT.js → store-member-invite-M4NVBUXM.js} +3 -3
- package/dist/{tax-region-create-5DDZ23QQ.js → tax-region-create-3KVECMFN.js} +16 -14
- package/dist/{tax-region-detail-VNBNS7FS.js → tax-region-detail-AOT4X4DZ.js} +26 -26
- package/dist/{tax-region-edit-OARZRBVK.js → tax-region-edit-5T7VHKIA.js} +15 -13
- package/dist/{tax-region-list-WCHVLVVC.js → tax-region-list-FIBHEFVD.js} +9 -9
- package/dist/{tax-region-metadata-XJRFOG7I.js → tax-region-metadata-RSZCJGJT.js} +17 -16
- package/dist/{tax-region-province-detail-MXYZMUX7.js → tax-region-province-detail-XEMIX5SQ.js} +24 -24
- package/dist/{tax-region-tax-override-create-VIOPM26G.js → tax-region-tax-override-create-KVVY4AF2.js} +54 -54
- package/dist/{tax-region-tax-override-edit-5FW6YCCW.js → tax-region-tax-override-edit-TVX7SMJD.js} +54 -54
- package/dist/{user-detail-LGIMHLY4.js → user-detail-W7DGVXDZ.js} +6 -6
- package/dist/{user-invite-ZZSWFXFM.js → user-invite-HLZJ7FST.js} +14 -16
- package/dist/{user-list-5QJJS7EA.js → user-list-TR7RSGUO.js} +9 -11
- package/dist/{user-metadata-376YJMY3.js → user-metadata-3AFZX3DM.js} +17 -16
- package/package.json +3 -3
- package/dist/attribute-create-EAOQ6KT6.js +0 -1010
- package/dist/attribute-create-possible-value-BIU2L7AN.js +0 -437
- package/dist/attribute-edit-DRHFOHMK.js +0 -282
- package/dist/attribute-edit-possible-value-G2ON2AE3.js +0 -264
- package/dist/chunk-35NDMIYZ.js +0 -8
- package/dist/chunk-4GPAS5GW.js +0 -36
- package/dist/chunk-4ZTZTIIM.js +0 -69
- package/dist/chunk-7O5NDICV.js +0 -120
- package/dist/chunk-IGTRIAUC.js +0 -84
- package/dist/chunk-KYPPQGGE.js +0 -467
- package/dist/chunk-LBXPX3XC.js +0 -1260
- package/dist/chunk-LO7XX5M7.js +0 -6
- package/dist/chunk-MXGDKEU5.js +0 -248
- package/dist/chunk-QOQSXNEF.js +0 -37
- package/dist/chunk-RSBZREKG.js +0 -144
- package/dist/chunk-WCEMRNW4.js +0 -6
- package/dist/chunk-Z5I2Z6L3.js +0 -160
- package/dist/chunk-ZMC7BKLT.js +0 -56
- package/dist/chunk-ZXYKF4A2.js +0 -2146
- package/dist/product-edit-option-KVTIY5NM.js +0 -156
- package/dist/product-export-E7RBOIO6.js +0 -137
- package/dist/product-import-KOSPPCSW.js +0 -267
- package/dist/product-variant-edit-L77HDGTA.js +0 -547
- package/dist/{chunk-XCANTVXS.js → chunk-CPXK5RSJ.js} +6 -6
- package/dist/{chunk-Y6NK6GBB.js → chunk-GP4J42UD.js} +5 -5
- package/dist/{chunk-L56WFGUN.js → chunk-IMR3MZDP.js} +3 -3
- package/dist/{chunk-OB4NOV4M.js → chunk-LYZT5REU.js} +3 -3
- package/dist/{chunk-ZBJ56XDB.js → chunk-Q2ULPJJ6.js} +3 -3
- package/dist/{chunk-MWX5JCOM.js → chunk-V6OGMYAI.js} +3 -3
- package/dist/{chunk-KCYUY2AI.js → chunk-WQFFCK3R.js} +6 -6
- package/dist/{chunk-ZW34ZAIP.js → chunk-WYA62MUL.js} +8 -8
- package/dist/{chunk-56AUQBQX.js → chunk-YYMACYP6.js} +5 -5
- package/dist/{customer-edit-X4HQOUAE.js → customer-edit-JZ4PQTIN.js} +3 -3
- package/dist/{profile-edit-Y5UUUKVH.js → profile-edit-HQTWYWZ7.js} +6 -6
- package/dist/{promotion-edit-details-E2XKWY7L.js → promotion-edit-details-TKRC5HES.js} +6 -6
|
@@ -1,1010 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AttributeUIComponent,
|
|
3
|
-
CreateAttributeSchema,
|
|
4
|
-
UpdateAttributeSchema
|
|
5
|
-
} from "./chunk-4ZTZTIIM.js";
|
|
6
|
-
import {
|
|
7
|
-
RouteFocusModal,
|
|
8
|
-
useRouteModal
|
|
9
|
-
} from "./chunk-FWJLS7XD.js";
|
|
10
|
-
import {
|
|
11
|
-
Form
|
|
12
|
-
} from "./chunk-3QSRE5LS.js";
|
|
13
|
-
import "./chunk-PBQ5M44A.js";
|
|
14
|
-
import "./chunk-OH4AABUT.js";
|
|
15
|
-
import "./chunk-YKDEE7ZL.js";
|
|
16
|
-
import "./chunk-AEMDNTW5.js";
|
|
17
|
-
import "./chunk-LYD3C73Z.js";
|
|
18
|
-
import {
|
|
19
|
-
useCreateAttribute
|
|
20
|
-
} from "./chunk-7O5NDICV.js";
|
|
21
|
-
import "./chunk-46M463BR.js";
|
|
22
|
-
import "./chunk-YFRC6GEN.js";
|
|
23
|
-
import "./chunk-N6SI4IIT.js";
|
|
24
|
-
import "./chunk-JPNPTILP.js";
|
|
25
|
-
import "./chunk-DAXXLQKB.js";
|
|
26
|
-
import "./chunk-OHOWEMHO.js";
|
|
27
|
-
import "./chunk-GKGLVDDV.js";
|
|
28
|
-
import "./chunk-WJJXUXSO.js";
|
|
29
|
-
import "./chunk-LAPEZATU.js";
|
|
30
|
-
import "./chunk-DBNPVU3L.js";
|
|
31
|
-
import "./chunk-U7WZYWGA.js";
|
|
32
|
-
import "./chunk-ZN7LWXVC.js";
|
|
33
|
-
import "./chunk-VYMODH6P.js";
|
|
34
|
-
import "./chunk-LEG67A2R.js";
|
|
35
|
-
import "./chunk-PRBE5CM3.js";
|
|
36
|
-
import "./chunk-5TRY5IMZ.js";
|
|
37
|
-
import "./chunk-TAKEQAZZ.js";
|
|
38
|
-
import "./chunk-B6FG7A6W.js";
|
|
39
|
-
import "./chunk-EPHVGD5Z.js";
|
|
40
|
-
import "./chunk-ESPLVOFC.js";
|
|
41
|
-
import "./chunk-FXWKGNRV.js";
|
|
42
|
-
import "./chunk-VDKOJ5WD.js";
|
|
43
|
-
import "./chunk-DL2ZIXBO.js";
|
|
44
|
-
import {
|
|
45
|
-
useProductCategories
|
|
46
|
-
} from "./chunk-Z2QQZOG3.js";
|
|
47
|
-
import "./chunk-5CK6XEFV.js";
|
|
48
|
-
import "./chunk-RHKRREUU.js";
|
|
49
|
-
import "./chunk-ZA2KFUFR.js";
|
|
50
|
-
import "./chunk-ZBWL72TB.js";
|
|
51
|
-
import "./chunk-NBMM2TZK.js";
|
|
52
|
-
|
|
53
|
-
// src/pages/attributes/attribute-create/attribute-create.tsx
|
|
54
|
-
import { useRef as useRef2, useState as useState3 } from "react";
|
|
55
|
-
import { Button as Button2, Heading, ProgressTabs, Text as Text3, toast } from "@medusajs/ui";
|
|
56
|
-
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
57
|
-
|
|
58
|
-
// src/pages/attributes/attribute-edit/components/attribute-form.tsx
|
|
59
|
-
import { forwardRef, useEffect as useEffect2, useMemo, useImperativeHandle, useState as useState2 } from "react";
|
|
60
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
61
|
-
import {
|
|
62
|
-
InlineTip,
|
|
63
|
-
Input as Input2,
|
|
64
|
-
Select,
|
|
65
|
-
Switch,
|
|
66
|
-
Text as Text2,
|
|
67
|
-
Textarea
|
|
68
|
-
} from "@medusajs/ui";
|
|
69
|
-
import { FormProvider, useForm, useWatch } from "react-hook-form";
|
|
70
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
71
|
-
|
|
72
|
-
// src/pages/attributes/attribute-create/components/multi-select-category.tsx
|
|
73
|
-
import { useEffect, useRef, useState } from "react";
|
|
74
|
-
import {
|
|
75
|
-
ArrowUturnLeft,
|
|
76
|
-
TriangleRightMini,
|
|
77
|
-
TrianglesMini,
|
|
78
|
-
XMarkMini
|
|
79
|
-
} from "@medusajs/icons";
|
|
80
|
-
import { Badge, Text } from "@medusajs/ui";
|
|
81
|
-
import { useTranslation } from "react-i18next";
|
|
82
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
83
|
-
var MultiSelectCategory = ({
|
|
84
|
-
categories,
|
|
85
|
-
value,
|
|
86
|
-
onChange
|
|
87
|
-
}) => {
|
|
88
|
-
const { t } = useTranslation();
|
|
89
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
90
|
-
const dropdownRef = useRef(null);
|
|
91
|
-
const triggerRef = useRef(null);
|
|
92
|
-
const [currentParentId, setCurrentParentId] = useState(null);
|
|
93
|
-
const [pathHistory, setPathHistory] = useState([]);
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
const handleClickOutside = (event) => {
|
|
96
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
97
|
-
setIsOpen(false);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
101
|
-
return () => {
|
|
102
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
103
|
-
};
|
|
104
|
-
}, []);
|
|
105
|
-
const handleToggle = () => {
|
|
106
|
-
setIsOpen((prev) => !prev);
|
|
107
|
-
};
|
|
108
|
-
const hasChildren = (categoryId) => {
|
|
109
|
-
return categories.some((cat) => cat.parent_category_id === categoryId);
|
|
110
|
-
};
|
|
111
|
-
const handleDrillDown = (category, event) => {
|
|
112
|
-
event.stopPropagation();
|
|
113
|
-
setPathHistory([...pathHistory, currentParentId]);
|
|
114
|
-
setCurrentParentId(category.id);
|
|
115
|
-
};
|
|
116
|
-
const handleGoBack = () => {
|
|
117
|
-
const newPathHistory = [...pathHistory];
|
|
118
|
-
const previousParentId = newPathHistory.pop();
|
|
119
|
-
setPathHistory(newPathHistory);
|
|
120
|
-
setCurrentParentId(previousParentId || null);
|
|
121
|
-
};
|
|
122
|
-
const handleItemClick = (categoryId) => {
|
|
123
|
-
const isSelected = value.includes(categoryId);
|
|
124
|
-
if (isSelected) {
|
|
125
|
-
onChange(value.filter((id) => id !== categoryId));
|
|
126
|
-
} else {
|
|
127
|
-
onChange([...value, categoryId]);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const currentCategories = categories.filter(
|
|
131
|
-
(cat) => cat.parent_category_id === currentParentId
|
|
132
|
-
);
|
|
133
|
-
const getBackButtonText = () => {
|
|
134
|
-
const parentCategory = categories.find((cat) => cat.id === currentParentId);
|
|
135
|
-
return parentCategory?.name || "";
|
|
136
|
-
};
|
|
137
|
-
return /* @__PURE__ */ jsxs(
|
|
138
|
-
"div",
|
|
139
|
-
{
|
|
140
|
-
className: "relative",
|
|
141
|
-
"data-testid": "attribute-form-category-multiselect",
|
|
142
|
-
children: [
|
|
143
|
-
/* @__PURE__ */ jsxs(
|
|
144
|
-
"div",
|
|
145
|
-
{
|
|
146
|
-
ref: triggerRef,
|
|
147
|
-
className: "focus-within:ring-ui-ring-interactive relative flex h-10 w-full cursor-pointer items-center justify-between overflow-hidden rounded-md border border-ui-border-base bg-ui-bg-field text-ui-fg-base shadow-sm transition-colors duration-150 ease-in-out focus-within:border-ui-border-interactive focus-within:ring-1 hover:bg-ui-bg-field-hover",
|
|
148
|
-
onClick: handleToggle,
|
|
149
|
-
"data-testid": "attribute-form-category-multiselect-trigger",
|
|
150
|
-
children: [
|
|
151
|
-
/* @__PURE__ */ jsx(
|
|
152
|
-
"div",
|
|
153
|
-
{
|
|
154
|
-
className: "flex items-center gap-2 px-3 py-2",
|
|
155
|
-
"data-testid": "attribute-form-category-multiselect-trigger-content",
|
|
156
|
-
children: value.length > 0 ? /* @__PURE__ */ jsx(
|
|
157
|
-
"button",
|
|
158
|
-
{
|
|
159
|
-
type: "button",
|
|
160
|
-
onClick: (e) => {
|
|
161
|
-
e.stopPropagation();
|
|
162
|
-
onChange([]);
|
|
163
|
-
},
|
|
164
|
-
"data-testid": "attribute-form-category-multiselect-clear-button",
|
|
165
|
-
children: /* @__PURE__ */ jsxs(
|
|
166
|
-
Badge,
|
|
167
|
-
{
|
|
168
|
-
size: "small",
|
|
169
|
-
className: "w-fit",
|
|
170
|
-
"data-testid": "attribute-form-category-multiselect-badge",
|
|
171
|
-
children: [
|
|
172
|
-
value.length,
|
|
173
|
-
/* @__PURE__ */ jsx(XMarkMini, {})
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
}
|
|
178
|
-
) : /* @__PURE__ */ jsx(
|
|
179
|
-
Text,
|
|
180
|
-
{
|
|
181
|
-
className: "text-ui-fg-subtle",
|
|
182
|
-
"data-testid": "attribute-form-category-multiselect-placeholder",
|
|
183
|
-
children: t("attributes.fields.categories", "Select categories")
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ jsx(
|
|
189
|
-
"span",
|
|
190
|
-
{
|
|
191
|
-
className: "flex h-full w-10 items-center justify-center border-l border-ui-border-base",
|
|
192
|
-
"data-testid": "attribute-form-category-multiselect-icon",
|
|
193
|
-
children: /* @__PURE__ */ jsx(TrianglesMini, {})
|
|
194
|
-
}
|
|
195
|
-
)
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
),
|
|
199
|
-
isOpen && /* @__PURE__ */ jsxs(
|
|
200
|
-
"div",
|
|
201
|
-
{
|
|
202
|
-
ref: dropdownRef,
|
|
203
|
-
className: "absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-md border border-ui-border-base bg-ui-bg-base shadow-lg",
|
|
204
|
-
"data-testid": "attribute-form-category-multiselect-dropdown",
|
|
205
|
-
children: [
|
|
206
|
-
currentParentId !== null && // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
207
|
-
/* @__PURE__ */ jsxs(
|
|
208
|
-
"div",
|
|
209
|
-
{
|
|
210
|
-
className: "flex cursor-pointer items-center gap-3 border-b border-ui-border-base px-3 py-2 text-ui-fg-subtle hover:bg-ui-bg-base-hover",
|
|
211
|
-
onClick: handleGoBack,
|
|
212
|
-
"data-testid": "attribute-form-category-multiselect-back-button",
|
|
213
|
-
children: [
|
|
214
|
-
/* @__PURE__ */ jsx(ArrowUturnLeft, {}),
|
|
215
|
-
/* @__PURE__ */ jsx(Text, { "data-testid": "attribute-form-category-multiselect-back-text", children: getBackButtonText() })
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
),
|
|
219
|
-
currentCategories.length === 0 ? /* @__PURE__ */ jsx(
|
|
220
|
-
"div",
|
|
221
|
-
{
|
|
222
|
-
className: "p-3 text-ui-fg-subtle",
|
|
223
|
-
"data-testid": "attribute-form-category-multiselect-empty",
|
|
224
|
-
children: t("general.noResultsTitle", "No categories found.")
|
|
225
|
-
}
|
|
226
|
-
) : currentCategories.map((category) => {
|
|
227
|
-
const isSelected = value.includes(category.id);
|
|
228
|
-
const hasChildrenNode = hasChildren(category.id);
|
|
229
|
-
return (
|
|
230
|
-
// oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
231
|
-
/* @__PURE__ */ jsxs(
|
|
232
|
-
"div",
|
|
233
|
-
{
|
|
234
|
-
className: "flex cursor-pointer items-center justify-between px-1 py-1",
|
|
235
|
-
onClick: () => handleItemClick(category.id),
|
|
236
|
-
"data-testid": `attribute-form-category-multiselect-item-${category.id}`,
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ jsxs(
|
|
239
|
-
"div",
|
|
240
|
-
{
|
|
241
|
-
className: "relative mr-2 flex flex-1 items-center rounded-md px-2 py-1.5 hover:bg-ui-bg-base-hover",
|
|
242
|
-
"data-testid": `attribute-form-category-multiselect-item-${category.id}-content`,
|
|
243
|
-
children: [
|
|
244
|
-
isSelected && /* @__PURE__ */ jsx(
|
|
245
|
-
"span",
|
|
246
|
-
{
|
|
247
|
-
className: "absolute left-3 top-1/2 h-1 w-1 -translate-y-1/2 rounded-full bg-ui-fg-base",
|
|
248
|
-
"data-testid": `attribute-form-category-multiselect-item-${category.id}-selected-indicator`
|
|
249
|
-
}
|
|
250
|
-
),
|
|
251
|
-
/* @__PURE__ */ jsx(
|
|
252
|
-
Text,
|
|
253
|
-
{
|
|
254
|
-
className: "ml-6",
|
|
255
|
-
"data-testid": `attribute-form-category-multiselect-item-${category.id}-name`,
|
|
256
|
-
children: category.name
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
]
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
hasChildrenNode && // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
263
|
-
/* @__PURE__ */ jsx(
|
|
264
|
-
"div",
|
|
265
|
-
{
|
|
266
|
-
onClick: (e) => handleDrillDown(category, e),
|
|
267
|
-
className: "rounded-md p-2 hover:bg-ui-bg-base-hover",
|
|
268
|
-
"data-testid": `attribute-form-category-multiselect-item-${category.id}-drill-down`,
|
|
269
|
-
children: /* @__PURE__ */ jsx(TriangleRightMini, { className: "mr-1" })
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
]
|
|
273
|
-
},
|
|
274
|
-
category.id
|
|
275
|
-
)
|
|
276
|
-
);
|
|
277
|
-
})
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
)
|
|
281
|
-
]
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// src/pages/attributes/attribute-create/components/possible-values-list.tsx
|
|
287
|
-
import {
|
|
288
|
-
DndContext,
|
|
289
|
-
closestCenter,
|
|
290
|
-
KeyboardSensor,
|
|
291
|
-
PointerSensor,
|
|
292
|
-
useSensor,
|
|
293
|
-
useSensors
|
|
294
|
-
} from "@dnd-kit/core";
|
|
295
|
-
import {
|
|
296
|
-
arrayMove,
|
|
297
|
-
SortableContext,
|
|
298
|
-
sortableKeyboardCoordinates,
|
|
299
|
-
useSortable,
|
|
300
|
-
verticalListSortingStrategy
|
|
301
|
-
} from "@dnd-kit/sortable";
|
|
302
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
303
|
-
import { DotsSix, XMark } from "@medusajs/icons";
|
|
304
|
-
import { Button, Hint, IconButton, Input, Label } from "@medusajs/ui";
|
|
305
|
-
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
306
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
307
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
308
|
-
var SortableItem = ({ id, index, onRemove }) => {
|
|
309
|
-
const {
|
|
310
|
-
register,
|
|
311
|
-
formState: { errors }
|
|
312
|
-
} = useFormContext();
|
|
313
|
-
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });
|
|
314
|
-
const style = {
|
|
315
|
-
transform: CSS.Transform.toString(transform),
|
|
316
|
-
transition
|
|
317
|
-
};
|
|
318
|
-
const possibleValuesErrors = errors?.possible_values;
|
|
319
|
-
const fieldError = Array.isArray(possibleValuesErrors) ? possibleValuesErrors[index]?.value : void 0;
|
|
320
|
-
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
321
|
-
/* @__PURE__ */ jsxs2(
|
|
322
|
-
"div",
|
|
323
|
-
{
|
|
324
|
-
ref: setNodeRef,
|
|
325
|
-
style,
|
|
326
|
-
className: "flex items-center gap-2 p-2 bg-ui-bg-component border border-ui-border-base rounded-xl mb-2",
|
|
327
|
-
"data-testid": `attribute-form-possible-value-item-${index}`,
|
|
328
|
-
children: [
|
|
329
|
-
/* @__PURE__ */ jsx2(
|
|
330
|
-
"button",
|
|
331
|
-
{
|
|
332
|
-
type: "button",
|
|
333
|
-
className: "cursor-grab active:cursor-grabbing",
|
|
334
|
-
...attributes,
|
|
335
|
-
...listeners,
|
|
336
|
-
"data-testid": `attribute-form-possible-value-drag-handle-${index}`,
|
|
337
|
-
children: /* @__PURE__ */ jsx2(DotsSix, { className: "text-ui-fg-subtle" })
|
|
338
|
-
}
|
|
339
|
-
),
|
|
340
|
-
/* @__PURE__ */ jsx2("div", { className: "flex-1", children: /* @__PURE__ */ jsx2(
|
|
341
|
-
Input,
|
|
342
|
-
{
|
|
343
|
-
className: "flex-1",
|
|
344
|
-
"aria-invalid": !!fieldError,
|
|
345
|
-
placeholder: "Enter value",
|
|
346
|
-
...register(`possible_values.${index}.value`),
|
|
347
|
-
"data-testid": `attribute-form-possible-value-input-${index}`
|
|
348
|
-
}
|
|
349
|
-
) }),
|
|
350
|
-
/* @__PURE__ */ jsx2(
|
|
351
|
-
IconButton,
|
|
352
|
-
{
|
|
353
|
-
variant: "transparent",
|
|
354
|
-
size: "small",
|
|
355
|
-
type: "button",
|
|
356
|
-
onClick: onRemove,
|
|
357
|
-
"data-testid": `attribute-form-possible-value-remove-button-${index}`,
|
|
358
|
-
children: /* @__PURE__ */ jsx2(XMark, {})
|
|
359
|
-
}
|
|
360
|
-
)
|
|
361
|
-
]
|
|
362
|
-
}
|
|
363
|
-
),
|
|
364
|
-
fieldError && /* @__PURE__ */ jsx2(
|
|
365
|
-
Hint,
|
|
366
|
-
{
|
|
367
|
-
variant: "error",
|
|
368
|
-
className: "mb-2",
|
|
369
|
-
"data-testid": `attribute-form-possible-value-error-${index}`,
|
|
370
|
-
children: fieldError.message
|
|
371
|
-
}
|
|
372
|
-
)
|
|
373
|
-
] });
|
|
374
|
-
};
|
|
375
|
-
var PossibleValuesList = () => {
|
|
376
|
-
const { t } = useTranslation2();
|
|
377
|
-
const { control, getValues, formState } = useFormContext();
|
|
378
|
-
const { fields, append, remove, update } = useFieldArray({
|
|
379
|
-
control,
|
|
380
|
-
name: "possible_values"
|
|
381
|
-
});
|
|
382
|
-
const sensors = useSensors(
|
|
383
|
-
useSensor(PointerSensor),
|
|
384
|
-
useSensor(KeyboardSensor, {
|
|
385
|
-
coordinateGetter: sortableKeyboardCoordinates
|
|
386
|
-
})
|
|
387
|
-
);
|
|
388
|
-
const handleDragEnd = (event) => {
|
|
389
|
-
const { active, over } = event;
|
|
390
|
-
if (over && active.id !== over.id) {
|
|
391
|
-
const oldIndex = fields.findIndex((field) => field.id === active.id);
|
|
392
|
-
const newIndex = fields.findIndex((field) => field.id === over.id);
|
|
393
|
-
const currentValues = getValues("possible_values");
|
|
394
|
-
const reorderedValues = arrayMove(currentValues, oldIndex, newIndex);
|
|
395
|
-
reorderedValues.forEach((value, index) => {
|
|
396
|
-
update(index, {
|
|
397
|
-
value: value.value,
|
|
398
|
-
rank: index,
|
|
399
|
-
metadata: value.metadata || {}
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
const handleAddValue = (e) => {
|
|
405
|
-
e.preventDefault();
|
|
406
|
-
append({
|
|
407
|
-
value: "",
|
|
408
|
-
rank: fields.length,
|
|
409
|
-
metadata: {}
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
const possibleValuesError = formState.errors.possible_values;
|
|
413
|
-
const shouldShowListError = possibleValuesError && !Array.isArray(possibleValuesError);
|
|
414
|
-
return /* @__PURE__ */ jsxs2("div", { className: "space-y-2", "data-testid": "attribute-form-possible-values-list", children: [
|
|
415
|
-
/* @__PURE__ */ jsxs2(
|
|
416
|
-
"div",
|
|
417
|
-
{
|
|
418
|
-
className: "flex items-center justify-between pb-1",
|
|
419
|
-
"data-testid": "attribute-form-possible-values-header",
|
|
420
|
-
children: [
|
|
421
|
-
/* @__PURE__ */ jsx2(Label, { "data-testid": "attribute-form-possible-values-label", children: t("attributes.fields.possibleValues", "Possible Values") }),
|
|
422
|
-
/* @__PURE__ */ jsx2(
|
|
423
|
-
Button,
|
|
424
|
-
{
|
|
425
|
-
type: "button",
|
|
426
|
-
variant: "secondary",
|
|
427
|
-
size: "small",
|
|
428
|
-
onClick: handleAddValue,
|
|
429
|
-
"data-testid": "attribute-form-possible-values-add-button",
|
|
430
|
-
children: t("actions.add", "Add")
|
|
431
|
-
}
|
|
432
|
-
)
|
|
433
|
-
]
|
|
434
|
-
}
|
|
435
|
-
),
|
|
436
|
-
/* @__PURE__ */ jsx2(
|
|
437
|
-
DndContext,
|
|
438
|
-
{
|
|
439
|
-
sensors,
|
|
440
|
-
collisionDetection: closestCenter,
|
|
441
|
-
onDragEnd: handleDragEnd,
|
|
442
|
-
children: /* @__PURE__ */ jsx2(
|
|
443
|
-
SortableContext,
|
|
444
|
-
{
|
|
445
|
-
items: fields.map((field) => field.id),
|
|
446
|
-
strategy: verticalListSortingStrategy,
|
|
447
|
-
children: fields.map((field, index) => /* @__PURE__ */ jsx2(
|
|
448
|
-
SortableItem,
|
|
449
|
-
{
|
|
450
|
-
id: field.id,
|
|
451
|
-
index,
|
|
452
|
-
onRemove: () => remove(index)
|
|
453
|
-
},
|
|
454
|
-
field.id
|
|
455
|
-
))
|
|
456
|
-
}
|
|
457
|
-
)
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
shouldShowListError && /* @__PURE__ */ jsx2(
|
|
461
|
-
Hint,
|
|
462
|
-
{
|
|
463
|
-
variant: "error",
|
|
464
|
-
"data-testid": "attribute-form-possible-values-list-error",
|
|
465
|
-
children: possibleValuesError.message
|
|
466
|
-
}
|
|
467
|
-
)
|
|
468
|
-
] });
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
// src/pages/attributes/attribute-edit/components/attribute-form.tsx
|
|
472
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
473
|
-
var UI_COMPONENT_LABELS = {
|
|
474
|
-
select: "Single Select",
|
|
475
|
-
multivalue: "Multi Select",
|
|
476
|
-
unit: "Unit",
|
|
477
|
-
toggle: "Toggle",
|
|
478
|
-
text_area: "Text"
|
|
479
|
-
};
|
|
480
|
-
var AttributeForm = forwardRef(
|
|
481
|
-
({
|
|
482
|
-
initialData,
|
|
483
|
-
onSubmit,
|
|
484
|
-
categories,
|
|
485
|
-
mode = "create",
|
|
486
|
-
activeTab = "details",
|
|
487
|
-
onFormStateChange
|
|
488
|
-
}, ref) => {
|
|
489
|
-
const { t } = useTranslation3();
|
|
490
|
-
const [showCategorySection, setShowCategorySection] = useState2(
|
|
491
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
492
|
-
(initialData?.product_categories?.length || 0) > 0
|
|
493
|
-
);
|
|
494
|
-
const form = useForm({
|
|
495
|
-
resolver: zodResolver(
|
|
496
|
-
mode === "create" ? CreateAttributeSchema : UpdateAttributeSchema
|
|
497
|
-
),
|
|
498
|
-
defaultValues: {
|
|
499
|
-
name: initialData?.name ?? "",
|
|
500
|
-
description: initialData?.description ?? "",
|
|
501
|
-
handle: initialData?.handle ?? "",
|
|
502
|
-
ui_component: initialData?.ui_component ?? AttributeUIComponent.SELECT,
|
|
503
|
-
is_filterable: initialData?.is_filterable ?? false,
|
|
504
|
-
is_required: initialData?.is_required ?? false,
|
|
505
|
-
possible_values: initialData?.possible_values?.map((v) => ({
|
|
506
|
-
id: v.id,
|
|
507
|
-
value: v.value,
|
|
508
|
-
rank: v.rank
|
|
509
|
-
})) ?? [],
|
|
510
|
-
product_category_ids: [],
|
|
511
|
-
metadata: {}
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
515
|
-
try {
|
|
516
|
-
await onSubmit(data);
|
|
517
|
-
} catch (error) {
|
|
518
|
-
console.error(error);
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
useImperativeHandle(ref, () => ({
|
|
522
|
-
validateFields: async (fields) => {
|
|
523
|
-
const result = await form.trigger(
|
|
524
|
-
fields
|
|
525
|
-
);
|
|
526
|
-
return result;
|
|
527
|
-
}
|
|
528
|
-
}));
|
|
529
|
-
const [name, description, handle, uiComponent, possibleValues] = useWatch({
|
|
530
|
-
control: form.control,
|
|
531
|
-
name: [
|
|
532
|
-
"name",
|
|
533
|
-
"description",
|
|
534
|
-
"handle",
|
|
535
|
-
"ui_component",
|
|
536
|
-
"possible_values"
|
|
537
|
-
]
|
|
538
|
-
});
|
|
539
|
-
const formStateKey = useMemo(() => {
|
|
540
|
-
return JSON.stringify({
|
|
541
|
-
name,
|
|
542
|
-
description,
|
|
543
|
-
handle,
|
|
544
|
-
uiComponent,
|
|
545
|
-
valuesCount: possibleValues?.length ?? 0
|
|
546
|
-
});
|
|
547
|
-
}, [name, description, handle, uiComponent, possibleValues]);
|
|
548
|
-
useEffect2(() => {
|
|
549
|
-
if (!onFormStateChange) return;
|
|
550
|
-
const hasName = name?.trim();
|
|
551
|
-
const hasDetailsData = description?.trim() || handle?.trim();
|
|
552
|
-
const detailsStatus = hasName ? "completed" : hasDetailsData ? "in-progress" : "not-started";
|
|
553
|
-
const hasTypeData = uiComponent && (possibleValues?.length ?? 0) > 0;
|
|
554
|
-
const typeStatus = hasTypeData ? "completed" : "not-started";
|
|
555
|
-
onFormStateChange({
|
|
556
|
-
detailsStatus,
|
|
557
|
-
typeStatus
|
|
558
|
-
});
|
|
559
|
-
}, [
|
|
560
|
-
formStateKey,
|
|
561
|
-
onFormStateChange,
|
|
562
|
-
uiComponent,
|
|
563
|
-
handle,
|
|
564
|
-
description,
|
|
565
|
-
name,
|
|
566
|
-
possibleValues.length
|
|
567
|
-
]);
|
|
568
|
-
const renderDetailsTab = () => /* @__PURE__ */ jsxs3("div", { className: "grid gap-6", "data-testid": "attribute-form-details-tab", children: [
|
|
569
|
-
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
570
|
-
/* @__PURE__ */ jsx3(
|
|
571
|
-
Form.Field,
|
|
572
|
-
{
|
|
573
|
-
control: form.control,
|
|
574
|
-
name: "name",
|
|
575
|
-
render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "attribute-form-name-field", children: [
|
|
576
|
-
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "attribute-form-name-label", children: t("attributes.fields.name", "Name") }),
|
|
577
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-name-control", children: /* @__PURE__ */ jsx3(
|
|
578
|
-
Input2,
|
|
579
|
-
{
|
|
580
|
-
...field,
|
|
581
|
-
size: "small",
|
|
582
|
-
"data-testid": "attribute-form-name-input"
|
|
583
|
-
}
|
|
584
|
-
) }),
|
|
585
|
-
/* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "attribute-form-name-error" })
|
|
586
|
-
] })
|
|
587
|
-
}
|
|
588
|
-
),
|
|
589
|
-
/* @__PURE__ */ jsx3(
|
|
590
|
-
Form.Field,
|
|
591
|
-
{
|
|
592
|
-
control: form.control,
|
|
593
|
-
name: "handle",
|
|
594
|
-
render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "attribute-form-handle-field", children: [
|
|
595
|
-
/* @__PURE__ */ jsx3(Form.Label, { optional: true, "data-testid": "attribute-form-handle-label", children: t("attributes.fields.handle", "Handle") }),
|
|
596
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-handle-control", children: /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
597
|
-
/* @__PURE__ */ jsx3(
|
|
598
|
-
Input2,
|
|
599
|
-
{
|
|
600
|
-
...field,
|
|
601
|
-
size: "small",
|
|
602
|
-
className: "pl-9",
|
|
603
|
-
"data-testid": "attribute-form-handle-input"
|
|
604
|
-
}
|
|
605
|
-
),
|
|
606
|
-
/* @__PURE__ */ jsx3("div", { className: "z-100 absolute bottom-0 left-0 top-0 flex w-7 items-center justify-center border-r border-ui-border-base px-2 text-ui-fg-muted", children: "/" })
|
|
607
|
-
] }) }),
|
|
608
|
-
/* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "attribute-form-handle-error" })
|
|
609
|
-
] })
|
|
610
|
-
}
|
|
611
|
-
)
|
|
612
|
-
] }),
|
|
613
|
-
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
614
|
-
/* @__PURE__ */ jsx3(
|
|
615
|
-
Form.Field,
|
|
616
|
-
{
|
|
617
|
-
control: form.control,
|
|
618
|
-
name: "description",
|
|
619
|
-
render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "attribute-form-description-field", children: [
|
|
620
|
-
/* @__PURE__ */ jsx3(
|
|
621
|
-
Form.Label,
|
|
622
|
-
{
|
|
623
|
-
optional: true,
|
|
624
|
-
"data-testid": "attribute-form-description-label",
|
|
625
|
-
children: t("attributes.fields.description", "Description")
|
|
626
|
-
}
|
|
627
|
-
),
|
|
628
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-description-control", children: /* @__PURE__ */ jsx3(
|
|
629
|
-
Textarea,
|
|
630
|
-
{
|
|
631
|
-
...field,
|
|
632
|
-
"data-testid": "attribute-form-description-input"
|
|
633
|
-
}
|
|
634
|
-
) }),
|
|
635
|
-
/* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "attribute-form-description-error" })
|
|
636
|
-
] })
|
|
637
|
-
}
|
|
638
|
-
),
|
|
639
|
-
/* @__PURE__ */ jsx3(
|
|
640
|
-
Form.Field,
|
|
641
|
-
{
|
|
642
|
-
control: form.control,
|
|
643
|
-
name: "is_filterable",
|
|
644
|
-
render: ({ field }) => /* @__PURE__ */ jsx3(Form.Item, { "data-testid": "attribute-form-filterable-field", children: /* @__PURE__ */ jsx3("div", { className: "rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest", children: /* @__PURE__ */ jsxs3("div", { className: "flex gap-3", children: [
|
|
645
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-filterable-control", children: /* @__PURE__ */ jsx3(
|
|
646
|
-
Switch,
|
|
647
|
-
{
|
|
648
|
-
checked: field.value,
|
|
649
|
-
onCheckedChange: field.onChange,
|
|
650
|
-
className: "mt-1",
|
|
651
|
-
"data-testid": "attribute-form-filterable-switch"
|
|
652
|
-
}
|
|
653
|
-
) }),
|
|
654
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
655
|
-
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "attribute-form-filterable-label", children: t(
|
|
656
|
-
"attributes.fields.isFilterable",
|
|
657
|
-
"Yes, this is a filterable attribute"
|
|
658
|
-
) }),
|
|
659
|
-
/* @__PURE__ */ jsx3(Text2, { className: "mt-1 text-xs text-ui-fg-subtle", children: t(
|
|
660
|
-
"attributes.fields.isFilterableHint",
|
|
661
|
-
"If checked, buyers will be able to filter products using this attribute."
|
|
662
|
-
) })
|
|
663
|
-
] })
|
|
664
|
-
] }) }) })
|
|
665
|
-
}
|
|
666
|
-
),
|
|
667
|
-
/* @__PURE__ */ jsx3(
|
|
668
|
-
Form.Field,
|
|
669
|
-
{
|
|
670
|
-
control: form.control,
|
|
671
|
-
name: "is_required",
|
|
672
|
-
render: ({ field }) => /* @__PURE__ */ jsx3(Form.Item, { "data-testid": "attribute-form-required-field", children: /* @__PURE__ */ jsx3("div", { className: "rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest", children: /* @__PURE__ */ jsxs3("div", { className: "flex gap-3", children: [
|
|
673
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-required-control", children: /* @__PURE__ */ jsx3(
|
|
674
|
-
Switch,
|
|
675
|
-
{
|
|
676
|
-
checked: field.value,
|
|
677
|
-
onCheckedChange: field.onChange,
|
|
678
|
-
className: "mt-1",
|
|
679
|
-
"data-testid": "attribute-form-required-switch"
|
|
680
|
-
}
|
|
681
|
-
) }),
|
|
682
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
683
|
-
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "attribute-form-required-label", children: t(
|
|
684
|
-
"attributes.fields.isRequired",
|
|
685
|
-
"Yes, this is a required attribute"
|
|
686
|
-
) }),
|
|
687
|
-
/* @__PURE__ */ jsx3(Text2, { className: "mt-1 text-xs text-ui-fg-subtle", children: t(
|
|
688
|
-
"attributes.fields.isRequiredHint",
|
|
689
|
-
"If checked, vendors must set a value to this attribute."
|
|
690
|
-
) })
|
|
691
|
-
] })
|
|
692
|
-
] }) }) })
|
|
693
|
-
}
|
|
694
|
-
),
|
|
695
|
-
/* @__PURE__ */ jsx3(
|
|
696
|
-
Form.Field,
|
|
697
|
-
{
|
|
698
|
-
control: form.control,
|
|
699
|
-
name: "product_category_ids",
|
|
700
|
-
render: ({ field }) => {
|
|
701
|
-
const categoryIds = field.value ?? [];
|
|
702
|
-
const isGlobal = categoryIds.length === 0 && !showCategorySection;
|
|
703
|
-
return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "attribute-form-global-field", children: [
|
|
704
|
-
/* @__PURE__ */ jsx3("div", { className: "rounded-lg bg-ui-bg-component p-4 shadow-elevation-card-rest", children: /* @__PURE__ */ jsxs3("div", { className: "flex gap-3", children: [
|
|
705
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-global-control", children: /* @__PURE__ */ jsx3(
|
|
706
|
-
Switch,
|
|
707
|
-
{
|
|
708
|
-
checked: isGlobal,
|
|
709
|
-
onCheckedChange: (checked) => {
|
|
710
|
-
if (checked) {
|
|
711
|
-
field.onChange([]);
|
|
712
|
-
setShowCategorySection(false);
|
|
713
|
-
} else {
|
|
714
|
-
setShowCategorySection(true);
|
|
715
|
-
}
|
|
716
|
-
},
|
|
717
|
-
className: "mt-1",
|
|
718
|
-
"data-testid": "attribute-form-global-switch"
|
|
719
|
-
}
|
|
720
|
-
) }),
|
|
721
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
722
|
-
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "attribute-form-global-label", children: t(
|
|
723
|
-
"attributes.fields.global",
|
|
724
|
-
"Yes, this is a global attribute"
|
|
725
|
-
) }),
|
|
726
|
-
/* @__PURE__ */ jsx3(Text2, { className: "mt-1 text-xs text-ui-fg-subtle", children: t(
|
|
727
|
-
"attributes.hints.global",
|
|
728
|
-
"When enabled, this attribute applies to all products regardless of category."
|
|
729
|
-
) })
|
|
730
|
-
] })
|
|
731
|
-
] }) }),
|
|
732
|
-
(showCategorySection || categoryIds.length > 0) && /* @__PURE__ */ jsxs3("div", { className: "mt-4", "data-testid": "attribute-form-category-field", children: [
|
|
733
|
-
/* @__PURE__ */ jsx3(
|
|
734
|
-
Form.Label,
|
|
735
|
-
{
|
|
736
|
-
optional: true,
|
|
737
|
-
"data-testid": "attribute-form-category-label",
|
|
738
|
-
children: t("attributes.fields.categories", "Product Categories")
|
|
739
|
-
}
|
|
740
|
-
),
|
|
741
|
-
/* @__PURE__ */ jsx3("div", { className: "mt-1", children: /* @__PURE__ */ jsx3(
|
|
742
|
-
MultiSelectCategory,
|
|
743
|
-
{
|
|
744
|
-
categories: categories ?? [],
|
|
745
|
-
value: categoryIds,
|
|
746
|
-
onChange: (value) => field.onChange(value)
|
|
747
|
-
}
|
|
748
|
-
) }),
|
|
749
|
-
/* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "attribute-form-category-error" }),
|
|
750
|
-
/* @__PURE__ */ jsx3("div", { className: "mt-3", children: /* @__PURE__ */ jsx3(InlineTip, { label: "Warning", variant: "warning", children: t(
|
|
751
|
-
"attributes.hints.categoryInheritance",
|
|
752
|
-
"Child categories will inherit this attribute."
|
|
753
|
-
) }) })
|
|
754
|
-
] })
|
|
755
|
-
] });
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
)
|
|
759
|
-
] })
|
|
760
|
-
] });
|
|
761
|
-
const renderTypeTab = () => /* @__PURE__ */ jsxs3(
|
|
762
|
-
"div",
|
|
763
|
-
{
|
|
764
|
-
className: "grid w-full gap-6",
|
|
765
|
-
"data-testid": "attribute-form-type-tab",
|
|
766
|
-
children: [
|
|
767
|
-
/* @__PURE__ */ jsx3(
|
|
768
|
-
Form.Field,
|
|
769
|
-
{
|
|
770
|
-
control: form.control,
|
|
771
|
-
name: "ui_component",
|
|
772
|
-
render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "attribute-form-ui-component-field", children: [
|
|
773
|
-
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "attribute-form-ui-component-label", children: t("attributes.fields.type", "Type") }),
|
|
774
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "attribute-form-ui-component-control", children: /* @__PURE__ */ jsxs3(
|
|
775
|
-
Select,
|
|
776
|
-
{
|
|
777
|
-
value: field.value,
|
|
778
|
-
onValueChange: field.onChange,
|
|
779
|
-
"data-testid": "attribute-form-ui-component-select",
|
|
780
|
-
children: [
|
|
781
|
-
/* @__PURE__ */ jsx3(
|
|
782
|
-
Select.Trigger,
|
|
783
|
-
{
|
|
784
|
-
className: "mt-1",
|
|
785
|
-
"data-testid": "attribute-form-ui-component-trigger",
|
|
786
|
-
children: /* @__PURE__ */ jsx3(
|
|
787
|
-
Select.Value,
|
|
788
|
-
{
|
|
789
|
-
placeholder: t(
|
|
790
|
-
"attributes.fields.typePlaceholder",
|
|
791
|
-
"Select Type"
|
|
792
|
-
)
|
|
793
|
-
}
|
|
794
|
-
)
|
|
795
|
-
}
|
|
796
|
-
),
|
|
797
|
-
/* @__PURE__ */ jsx3(Select.Content, { "data-testid": "attribute-form-ui-component-content", children: Object.values(AttributeUIComponent).map((component) => /* @__PURE__ */ jsx3(
|
|
798
|
-
Select.Item,
|
|
799
|
-
{
|
|
800
|
-
value: component,
|
|
801
|
-
"data-testid": `attribute-form-ui-component-option-${component}`,
|
|
802
|
-
children: UI_COMPONENT_LABELS[component] ?? component
|
|
803
|
-
},
|
|
804
|
-
component
|
|
805
|
-
)) })
|
|
806
|
-
]
|
|
807
|
-
}
|
|
808
|
-
) }),
|
|
809
|
-
/* @__PURE__ */ jsx3(Form.ErrorMessage, { "data-testid": "attribute-form-ui-component-error" })
|
|
810
|
-
] })
|
|
811
|
-
}
|
|
812
|
-
),
|
|
813
|
-
(uiComponent === AttributeUIComponent.SELECT || uiComponent === AttributeUIComponent.MULTIVALUE) && /* @__PURE__ */ jsx3(InlineTip, { label: "Tip", variant: "info", children: uiComponent === AttributeUIComponent.SELECT ? t(
|
|
814
|
-
"attributes.tips.singleSelect",
|
|
815
|
-
"When creating Single Select vendor will be able to choose only one value. This type of attribute will be good for product specifications."
|
|
816
|
-
) : t(
|
|
817
|
-
"attributes.tips.multiSelect",
|
|
818
|
-
"When creating Multi Select vendor will be able to choose multiple values."
|
|
819
|
-
) }),
|
|
820
|
-
(uiComponent === AttributeUIComponent.SELECT || uiComponent === AttributeUIComponent.MULTIVALUE) && /* @__PURE__ */ jsx3("div", { "data-testid": "attribute-form-possible-values-section", children: /* @__PURE__ */ jsx3(PossibleValuesList, {}) })
|
|
821
|
-
]
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
return /* @__PURE__ */ jsx3(FormProvider, { ...form, children: /* @__PURE__ */ jsxs3(
|
|
825
|
-
"form",
|
|
826
|
-
{
|
|
827
|
-
id: "attribute-form",
|
|
828
|
-
onSubmit: handleSubmit,
|
|
829
|
-
"data-testid": "attribute-form",
|
|
830
|
-
children: [
|
|
831
|
-
activeTab === "details" && renderDetailsTab(),
|
|
832
|
-
activeTab === "type" && renderTypeTab()
|
|
833
|
-
]
|
|
834
|
-
}
|
|
835
|
-
) });
|
|
836
|
-
}
|
|
837
|
-
);
|
|
838
|
-
AttributeForm.displayName = "AttributeForm";
|
|
839
|
-
|
|
840
|
-
// src/pages/attributes/attribute-create/attribute-create.tsx
|
|
841
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
842
|
-
var AttributeCreateInner = () => {
|
|
843
|
-
const { t } = useTranslation4();
|
|
844
|
-
const { handleSuccess } = useRouteModal();
|
|
845
|
-
const formRef = useRef2(null);
|
|
846
|
-
const [activeTab, setActiveTab] = useState3("details");
|
|
847
|
-
const [tabStatuses, setTabStatuses] = useState3({
|
|
848
|
-
detailsStatus: "not-started",
|
|
849
|
-
typeStatus: "not-started"
|
|
850
|
-
});
|
|
851
|
-
const { mutateAsync, isPending } = useCreateAttribute();
|
|
852
|
-
const { product_categories: categories = [] } = useProductCategories({
|
|
853
|
-
limit: 999
|
|
854
|
-
});
|
|
855
|
-
const handleSave = async (data) => {
|
|
856
|
-
await mutateAsync(data, {
|
|
857
|
-
onSuccess: () => {
|
|
858
|
-
toast.success(
|
|
859
|
-
t("attributes.create.successToast", {
|
|
860
|
-
name: data.name
|
|
861
|
-
})
|
|
862
|
-
);
|
|
863
|
-
handleSuccess("/settings/attributes");
|
|
864
|
-
},
|
|
865
|
-
onError: (error) => {
|
|
866
|
-
toast.error(error.message);
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
};
|
|
870
|
-
const handleTabChange = (value) => {
|
|
871
|
-
const newTab = value;
|
|
872
|
-
if (newTab === "type" && tabStatuses.detailsStatus === "not-started") {
|
|
873
|
-
toast.warning(
|
|
874
|
-
t(
|
|
875
|
-
"attributes.create.fillNameWarning",
|
|
876
|
-
"Please fill in the name first."
|
|
877
|
-
)
|
|
878
|
-
);
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
setActiveTab(newTab);
|
|
882
|
-
};
|
|
883
|
-
const handleNext = async () => {
|
|
884
|
-
if (formRef.current) {
|
|
885
|
-
const isValid = await formRef.current.validateFields(["name"]);
|
|
886
|
-
if (isValid) {
|
|
887
|
-
setActiveTab("type");
|
|
888
|
-
}
|
|
889
|
-
} else {
|
|
890
|
-
setActiveTab("type");
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
return /* @__PURE__ */ jsxs4(
|
|
894
|
-
ProgressTabs,
|
|
895
|
-
{
|
|
896
|
-
value: activeTab,
|
|
897
|
-
onValueChange: handleTabChange,
|
|
898
|
-
className: "flex size-full flex-col overflow-hidden",
|
|
899
|
-
"data-testid": "attribute-create-progress-tabs",
|
|
900
|
-
children: [
|
|
901
|
-
/* @__PURE__ */ jsx4(
|
|
902
|
-
RouteFocusModal.Header,
|
|
903
|
-
{
|
|
904
|
-
"data-testid": "attribute-create-modal-header",
|
|
905
|
-
children: /* @__PURE__ */ jsxs4(
|
|
906
|
-
ProgressTabs.List,
|
|
907
|
-
{
|
|
908
|
-
className: "justify-start flex w-full items-center",
|
|
909
|
-
"data-testid": "attribute-create-progress-tabs-list",
|
|
910
|
-
children: [
|
|
911
|
-
/* @__PURE__ */ jsx4(
|
|
912
|
-
ProgressTabs.Trigger,
|
|
913
|
-
{
|
|
914
|
-
value: "details",
|
|
915
|
-
status: tabStatuses.detailsStatus,
|
|
916
|
-
"data-testid": "attribute-create-details-tab",
|
|
917
|
-
children: t("attributes.create.tabs.details", "Details")
|
|
918
|
-
}
|
|
919
|
-
),
|
|
920
|
-
/* @__PURE__ */ jsx4(
|
|
921
|
-
ProgressTabs.Trigger,
|
|
922
|
-
{
|
|
923
|
-
value: "type",
|
|
924
|
-
status: tabStatuses.typeStatus,
|
|
925
|
-
"data-testid": "attribute-create-type-tab",
|
|
926
|
-
children: t("attributes.create.tabs.type", "Type")
|
|
927
|
-
}
|
|
928
|
-
)
|
|
929
|
-
]
|
|
930
|
-
}
|
|
931
|
-
)
|
|
932
|
-
}
|
|
933
|
-
),
|
|
934
|
-
/* @__PURE__ */ jsx4(
|
|
935
|
-
RouteFocusModal.Body,
|
|
936
|
-
{
|
|
937
|
-
className: "flex flex-1 justify-center overflow-auto px-6 py-16",
|
|
938
|
-
"data-testid": "attribute-create-modal-body",
|
|
939
|
-
children: /* @__PURE__ */ jsxs4("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
940
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-1", children: [
|
|
941
|
-
/* @__PURE__ */ jsx4(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx4(Heading, { "data-testid": "attribute-create-modal-heading", children: t("attributes.create.header", "Create Attribute") }) }),
|
|
942
|
-
/* @__PURE__ */ jsx4(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
943
|
-
Text3,
|
|
944
|
-
{
|
|
945
|
-
size: "small",
|
|
946
|
-
className: "text-ui-fg-subtle",
|
|
947
|
-
"data-testid": "attribute-create-modal-subtitle",
|
|
948
|
-
children: t(
|
|
949
|
-
"attributes.create.subtitle",
|
|
950
|
-
"Define a new product attribute."
|
|
951
|
-
)
|
|
952
|
-
}
|
|
953
|
-
) })
|
|
954
|
-
] }),
|
|
955
|
-
/* @__PURE__ */ jsx4(
|
|
956
|
-
AttributeForm,
|
|
957
|
-
{
|
|
958
|
-
ref: formRef,
|
|
959
|
-
onSubmit: handleSave,
|
|
960
|
-
categories,
|
|
961
|
-
mode: "create",
|
|
962
|
-
activeTab,
|
|
963
|
-
onFormStateChange: setTabStatuses
|
|
964
|
-
}
|
|
965
|
-
)
|
|
966
|
-
] })
|
|
967
|
-
}
|
|
968
|
-
),
|
|
969
|
-
/* @__PURE__ */ jsx4(RouteFocusModal.Footer, { "data-testid": "attribute-create-modal-footer", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-2", children: [
|
|
970
|
-
/* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
971
|
-
Button2,
|
|
972
|
-
{
|
|
973
|
-
size: "small",
|
|
974
|
-
variant: "secondary",
|
|
975
|
-
type: "button",
|
|
976
|
-
"data-testid": "attribute-create-modal-cancel-button",
|
|
977
|
-
children: t("actions.cancel", "Cancel")
|
|
978
|
-
}
|
|
979
|
-
) }),
|
|
980
|
-
activeTab === "details" ? /* @__PURE__ */ jsx4(
|
|
981
|
-
Button2,
|
|
982
|
-
{
|
|
983
|
-
size: "small",
|
|
984
|
-
type: "button",
|
|
985
|
-
onClick: handleNext,
|
|
986
|
-
"data-testid": "attribute-create-modal-next-button",
|
|
987
|
-
children: t("actions.continue", "Next")
|
|
988
|
-
}
|
|
989
|
-
) : /* @__PURE__ */ jsx4(
|
|
990
|
-
Button2,
|
|
991
|
-
{
|
|
992
|
-
size: "small",
|
|
993
|
-
type: "submit",
|
|
994
|
-
form: "attribute-form",
|
|
995
|
-
isLoading: isPending,
|
|
996
|
-
"data-testid": "attribute-create-modal-save-button",
|
|
997
|
-
children: t("actions.save", "Save")
|
|
998
|
-
}
|
|
999
|
-
)
|
|
1000
|
-
] }) })
|
|
1001
|
-
]
|
|
1002
|
-
}
|
|
1003
|
-
);
|
|
1004
|
-
};
|
|
1005
|
-
var AttributeCreate = () => {
|
|
1006
|
-
return /* @__PURE__ */ jsx4(RouteFocusModal, { "data-testid": "attribute-create-modal", children: /* @__PURE__ */ jsx4(AttributeCreateInner, {}) });
|
|
1007
|
-
};
|
|
1008
|
-
export {
|
|
1009
|
-
AttributeCreate as Component
|
|
1010
|
-
};
|