@mercurjs/vendor 2.2.0-canary.9 → 2.2.0-rc.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]-YPCO3DJV.js → [id]-2LOU4IGP.js} +31 -13
- package/dist/{[id]-GC3ZYPK4.js → [id]-6K5OJU5T.js} +35 -35
- package/dist/{[id]-ZCMSBEVM.js → [id]-6RTJXOT5.js} +8 -7
- package/dist/[id]-7T4JCGCZ.js +639 -0
- package/dist/{[id]-QQU5HVFU.js → [id]-BMW6PEZT.js} +42 -42
- package/dist/[id]-FN47ZDW5.js +515 -0
- package/dist/{[id]-A55T2ORL.js → [id]-KTJU7CRX.js} +432 -390
- package/dist/{[id]-T5ECVBPF.js → [id]-NUH6WK7Y.js} +100 -60
- package/dist/{[id]-J6BZG5PU.js → [id]-RRWUTLTP.js} +145 -47
- package/dist/{[id]-FWCX5PTI.js → [id]-TJF2WSOF.js} +148 -59
- package/dist/{[id]-SHAJTJNZ.js → [id]-UWBLKWZI.js} +57 -56
- package/dist/[id]-VWIZD2JL.js +477 -0
- package/dist/[id]-XRSZYRKI.js +997 -0
- package/dist/{[id]-BC7IKQTQ.js → [id]-YIP2TDVC.js} +130 -52
- package/dist/{[location_id]-NUBXDDJC.js → [location_id]-TUAKRLYQ.js} +17 -16
- package/dist/{[province_id]-6GUA4PV5.js → [province_id]-6VYYS4DZ.js} +34 -34
- package/dist/{add-RU3WL4YB.js → add-KB477RH5.js} +65 -31
- package/dist/{add-NTRYWOJF.js → add-NSLA2RT7.js} +64 -61
- package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-PB4LCA5E.js} +43 -42
- package/dist/{add-products-Q4MMDQKT.js → add-products-O72MJ3N2.js} +38 -40
- package/dist/{add-promotions-KD2CWQPF.js → add-promotions-6X7N3DTU.js} +17 -17
- package/dist/{add-to-campaign-QKYQCSR2.js → add-to-campaign-7WAUGNNI.js} +6 -6
- package/dist/{address-77Y3AOQ3.js → address-ZR4EM2QA.js} +42 -31
- package/dist/{adjust-inventory-AFJLWF5R.js → adjust-inventory-P4X6PFKW.js} +4 -4
- package/dist/allocate-items-NSQOU2QJ.js +685 -0
- package/dist/{areas-XUC5V5UO.js → areas-N4ORDJTD.js} +13 -13
- package/dist/attributes-DRC3WYY6.js +353 -0
- package/dist/{breadcrumb-IK6XCQOQ.js → breadcrumb-4YT6FRUQ.js} +4 -4
- package/dist/{breadcrumb-KTARIL65.js → breadcrumb-BKBSL3PC.js} +4 -4
- package/dist/breadcrumb-ETWGVI34.js +28 -0
- package/dist/{breadcrumb-YBBYFQYG.js → breadcrumb-F4N5CPRD.js} +2 -2
- package/dist/{breadcrumb-FPWBT76A.js → breadcrumb-JGDD7EHO.js} +3 -3
- package/dist/breadcrumb-JWDW3P6C.js +46 -0
- package/dist/{breadcrumb-PBR27GGX.js → breadcrumb-KKWNLFMC.js} +4 -4
- package/dist/{breadcrumb-3Z7KZG62.js → breadcrumb-LEFHXFLT.js} +3 -3
- package/dist/{breadcrumb-D3UDTWGE.js → breadcrumb-MOA2DBOE.js} +2 -2
- package/dist/{breadcrumb-UAUX7XCV.js → breadcrumb-PJOTRHG7.js} +5 -3
- package/dist/breadcrumb-PYLGF3AN.js +47 -0
- package/dist/{breadcrumb-2XA2WOK7.js → breadcrumb-TO45VBVD.js} +2 -2
- package/dist/{breadcrumb-F3BN5753.js → breadcrumb-UEUUMDIY.js} +2 -2
- package/dist/breadcrumb-VCRGVYJR.js +33 -0
- package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-WWLMQQQF.js} +10 -9
- package/dist/breadcrumb-Y7N7L7DM.js +13 -0
- package/dist/{breadcrumb-Y5UW3I4C.js → breadcrumb-YOY6Z36F.js} +2 -2
- package/dist/{campaigns-JAQTSA4Z.js → campaigns-GPLRB2AR.js} +8 -8
- package/dist/{categories-T4QJYX4R.js → categories-53X36JNS.js} +12 -10
- package/dist/{chunk-MZTDRBCR.js → chunk-2INANL6V.js} +61 -62
- package/dist/{chunk-O7VOGTLX.js → chunk-2P5H7EVR.js} +1 -1
- package/dist/{chunk-ADGVQVHP.js → chunk-3F4MUPGR.js} +3 -3
- package/dist/chunk-42R54Z2X.js +8 -0
- package/dist/chunk-432S4FGR.js +0 -0
- package/dist/{chunk-6K6EQOJF.js → chunk-4CNLTLQP.js} +7 -6
- package/dist/{chunk-5QI3NDJG.js → chunk-4EAC3GT7.js} +2 -2
- package/dist/{chunk-S23FD6FA.js → chunk-4NADEZZQ.js} +15 -4
- package/dist/{chunk-HDEOZN2Q.js → chunk-4OQLPIUZ.js} +27 -27
- package/dist/{chunk-VDHW6H5F.js → chunk-55TS752B.js} +4 -4
- package/dist/{chunk-LFX6WU4A.js → chunk-5ALC4Z2H.js} +0 -13
- package/dist/{chunk-4LVP635F.js → chunk-5FBQOAXU.js} +135 -126
- package/dist/{chunk-DDJQRV6E.js → chunk-5NVY7JZC.js} +5 -5
- package/dist/{chunk-E2HQPY32.js → chunk-5RMLLTR7.js} +5 -5
- package/dist/chunk-5SRG2247.js +353 -0
- package/dist/{chunk-L57USMYC.js → chunk-5YZ3G5EZ.js} +1 -1
- package/dist/{chunk-JAUZ73XE.js → chunk-744GLNZW.js} +22 -62
- package/dist/{chunk-463CNCJC.js → chunk-7CQ4RKVV.js} +53 -41
- package/dist/{chunk-U5G3AVED.js → chunk-7HLAOLG7.js} +1 -1
- package/dist/{chunk-M6N4ISXL.js → chunk-7MARNXFG.js} +1 -1
- package/dist/{chunk-SSUUT5LK.js → chunk-7TQNE3E2.js} +5 -4
- package/dist/chunk-7ZNZJIVN.js +30 -0
- package/dist/{chunk-TYESCFYW.js → chunk-AOLE7MBM.js} +1 -1
- package/dist/{chunk-YHIJCI4U.js → chunk-APWPWXWQ.js} +22 -11
- package/dist/{chunk-TBYCZRZ7.js → chunk-BQHVM46E.js} +32 -55
- package/dist/{chunk-UFFVRF4V.js → chunk-BXDN7ZA5.js} +26 -19
- package/dist/{chunk-BXRNZS5K.js → chunk-CLS6PNZY.js} +3 -3
- package/dist/{chunk-7CMRFP5Q.js → chunk-COGWTNSC.js} +3 -3
- package/dist/{chunk-EIZP3XL5.js → chunk-CQRCUQC4.js} +1 -1
- package/dist/{chunk-3EF54XFY.js → chunk-CVXKASWV.js} +2 -2
- package/dist/chunk-EEBJYXWA.js +15 -0
- package/dist/{chunk-TW324MAT.js → chunk-EFKHV25A.js} +2 -2
- package/dist/{chunk-PZEPOPMV.js → chunk-ESXMD6CR.js} +189 -84
- package/dist/{chunk-SPOHNK4X.js → chunk-EX5IIVVN.js} +7 -7
- package/dist/{chunk-YQYRAD5C.js → chunk-FCZJAYMM.js} +1 -1
- package/dist/{chunk-SZBERGA4.js → chunk-FXQWGW2J.js} +4 -4
- package/dist/{chunk-6SJTAE66.js → chunk-GGXGKMYK.js} +1 -1
- package/dist/chunk-GK6X67DV.js +462 -0
- package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
- package/dist/{chunk-IQWK723D.js → chunk-GZ4KTAWS.js} +1 -1
- package/dist/{chunk-3PMM6AMP.js → chunk-GZRCPKO5.js} +20 -9
- package/dist/{chunk-TF6V3TFG.js → chunk-HLAV55RT.js} +2 -2
- package/dist/{chunk-E6W57UP3.js → chunk-HRUO43BZ.js} +2 -2
- package/dist/chunk-I3I5IYHO.js +33 -0
- package/dist/{chunk-M6GKMFTC.js → chunk-ICKOFNHF.js} +6 -3
- package/dist/{chunk-53SII3U2.js → chunk-II2GAEVL.js} +27 -15
- package/dist/{chunk-L4KBTV57.js → chunk-IMJ62GAP.js} +1 -3
- package/dist/{chunk-HXGLPDZW.js → chunk-IMVZFBCM.js} +6 -17
- package/dist/{chunk-SGR4DMCW.js → chunk-INYLPVCG.js} +3 -3
- package/dist/chunk-IPNO77ZJ.js +376 -0
- package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
- package/dist/{chunk-GAE6TKOR.js → chunk-IWF43LO2.js} +5 -6
- package/dist/{chunk-BOZJOOGW.js → chunk-JIXW4WHZ.js} +5 -5
- package/dist/{chunk-3B34B2M2.js → chunk-JJP6AKMV.js} +1 -1
- package/dist/{chunk-2QTNCGKX.js → chunk-JLLFEA23.js} +1 -1
- package/dist/{chunk-VXMOPVRH.js → chunk-JR7AABT5.js} +2 -2
- package/dist/{chunk-6OUPJNYO.js → chunk-KCHYLLVG.js} +2 -2
- package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
- package/dist/{chunk-LARLBYU6.js → chunk-KEXXZLVI.js} +2 -2
- package/dist/{chunk-VXWN37PT.js → chunk-KIURBTC4.js} +1 -1
- package/dist/{chunk-DO4F5FIO.js → chunk-LOBDXF34.js} +5 -5
- package/dist/{chunk-RIN4CBRB.js → chunk-LXZXXOJ3.js} +1 -17
- package/dist/chunk-LYYM7H7H.js +59 -0
- package/dist/{chunk-VZUA5SRD.js → chunk-MABIMRLS.js} +2 -2
- package/dist/{chunk-MWQQVKRU.js → chunk-MAVQ636Y.js} +1 -1
- package/dist/{chunk-YQZBAP3S.js → chunk-MDGTQT5D.js} +77 -23
- package/dist/{chunk-DQKK43PR.js → chunk-MJ4B2OFU.js} +24 -13
- package/dist/{chunk-IBEUR3J7.js → chunk-MK44MYO7.js} +3 -3
- package/dist/{chunk-S7EKBD2C.js → chunk-MNHP6YRC.js} +3 -3
- package/dist/{chunk-VV6IKGCN.js → chunk-NTJ3BMOE.js} +1 -1
- package/dist/{chunk-X4GWB6AT.js → chunk-O4N6UK6M.js} +4 -4
- package/dist/{chunk-K6LOZ4S3.js → chunk-OOK3BD5Z.js} +5 -5
- package/dist/{chunk-6UZERVBI.js → chunk-P3ETXWHD.js} +2 -2
- package/dist/{chunk-KIFSQOM2.js → chunk-P6XBOWET.js} +9 -8
- package/dist/{chunk-4S6XGIC6.js → chunk-PUAWN7SS.js} +1 -1
- package/dist/{chunk-U6PBLMXD.js → chunk-Q6SPIHFR.js} +8 -3
- package/dist/{chunk-MJCL3WID.js → chunk-QGZH3D2P.js} +5 -2
- package/dist/{chunk-F4OJN2F2.js → chunk-QIF4QE7T.js} +1 -1
- package/dist/{chunk-BENED3NB.js → chunk-QMTSINXN.js} +612 -931
- package/dist/{chunk-VCOQ7WQ2.js → chunk-QU444FAP.js} +47 -16
- package/dist/{chunk-PAVZ6FPK.js → chunk-S4ILPAEO.js} +30 -14
- package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
- package/dist/chunk-SPFLYPY6.js +6 -0
- package/dist/{chunk-2USXZSTK.js → chunk-SYWAMZNQ.js} +8 -7
- package/dist/{chunk-LQSLDDPT.js → chunk-T35QBLG7.js} +1 -1
- package/dist/{chunk-T5MJWWDX.js → chunk-TNZMNJRF.js} +10 -9
- package/dist/{chunk-QLBIBLOY.js → chunk-U5MXCMDR.js} +26 -15
- package/dist/{chunk-Y2MQ5EMD.js → chunk-UEPUKWD7.js} +12 -3
- package/dist/{chunk-7IPCLQ5V.js → chunk-UKTJEFMZ.js} +4 -4
- package/dist/{chunk-UORPTGV2.js → chunk-ULEW54ED.js} +11 -15
- package/dist/{chunk-LRARA622.js → chunk-VE6GRIIN.js} +2 -2
- package/dist/{chunk-YUKD5RCX.js → chunk-VR7P4DAZ.js} +1 -1
- package/dist/{chunk-UCYSCKZV.js → chunk-VYSB4CTB.js} +2114 -1699
- package/dist/{chunk-OZ44ATGE.js → chunk-W5LVOEN2.js} +15 -15
- package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
- package/dist/{chunk-BER45EYD.js → chunk-WQQMCV7M.js} +1 -1
- package/dist/chunk-WQTWBXKO.js +23 -0
- package/dist/{chunk-XCIMOIX6.js → chunk-XBKWFLJG.js} +1 -1
- package/dist/{chunk-3BXCPHN6.js → chunk-XCHKUSUU.js} +1 -0
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/{chunk-LWJF63JW.js → chunk-XWHHBJGS.js} +92 -16
- package/dist/{chunk-27WLUOI2.js → chunk-Y6S7K3YB.js} +1 -1
- package/dist/{chunk-6FUIK3PX.js → chunk-YEPZGGUE.js} +43 -21
- package/dist/{chunk-JQV7CXEC.js → chunk-YNGA3GRX.js} +17 -2
- package/dist/{chunk-NBKWY6XN.js → chunk-YRXXO2RT.js} +3 -3
- package/dist/{chunk-LKUW5SV4.js → chunk-YXWZT3PX.js} +3 -3
- package/dist/{chunk-X22KTLZ7.js → chunk-Z3SPAROE.js} +1 -1
- package/dist/{chunk-LHKHQAAY.js → chunk-ZLYGEART.js} +1 -1
- package/dist/{chunk-NBPMNUKZ.js → chunk-ZQCCVCHB.js} +1 -1
- package/dist/collections-AE7QLCFD.js +70 -0
- package/dist/{configuration-C4IGBNXH.js → configuration-I6BUESSG.js} +3 -3
- package/dist/{configuration-7IYZ6GNP.js → configuration-QVMG6LAM.js} +5 -5
- package/dist/{create-JGYG5SBM.js → create-2DXKC5OJ.js} +47 -44
- package/dist/{create-MS6KKFSV.js → create-2WFPJBDQ.js} +31 -32
- package/dist/{create-GGACODDN.js → create-3PIY2COT.js} +55 -38
- package/dist/{create-F5R76QML.js → create-7HXY7U5W.js} +72 -37
- package/dist/{create-A7B3MLJX.js → create-BE2YNVX3.js} +52 -52
- package/dist/{create-UPYB65PD.js → create-BV3QDTK2.js} +4 -4
- package/dist/{create-5PSOIHIT.js → create-C2WABAJU.js} +6 -6
- package/dist/{create-FKRYB7ZS.js → create-EIMV4KCC.js} +67 -53
- package/dist/{create-TKXH5KQY.js → create-F2VZZ7XS.js} +61 -37
- package/dist/{create-R7K3ECN6.js → create-K26SM34L.js} +3 -3
- package/dist/{create-MZYXMGKP.js → create-K7V36IWH.js} +13 -13
- package/dist/{create-JF2OUZQA.js → create-KW6KFXGI.js} +24 -25
- package/dist/create-MW33P4AB.js +245 -0
- package/dist/{create-YBF4YGWG.js → create-NF2LPVXA.js} +3 -3
- package/dist/{create-ODOFJF5N.js → create-RXIY777H.js} +31 -32
- package/dist/{create-O35JRZEF.js → create-TPNH5U7Z.js} +28 -29
- package/dist/{create-SFU3W3ZH.js → create-U64NEOEL.js} +3 -3
- package/dist/{create-XVHOCZHJ.js → create-X5SOAPD3.js} +3 -3
- package/dist/create-ZZBMZZQG.js +79 -0
- package/dist/customer-group-add-customers-DZ3JYD6S.js +251 -0
- package/dist/customer-group-create-6YNGAE2W.js +147 -0
- package/dist/customer-group-detail-VZUHEIRY.js +62 -0
- package/dist/customer-group-edit-UA36663R.js +159 -0
- package/dist/customer-groups-RGHBJV55.js +305 -0
- package/dist/{customers-SOLJ2KQQ.js → customers-7S2MK4VG.js} +10 -10
- package/dist/edit-3RDEZH6V.js +367 -0
- package/dist/{edit-ORXS3A2Y.js → edit-3V34KJS2.js} +3 -3
- package/dist/{edit-5CROKEJE.js → edit-3XGZNC24.js} +53 -53
- package/dist/{edit-2R5QCPTB.js → edit-45TYWHR6.js} +25 -26
- package/dist/{edit-Y2U3KAVB.js → edit-5IQNX7YB.js} +87 -50
- package/dist/{edit-3E4ZO7HT.js → edit-GBTLRL6H.js} +33 -35
- package/dist/{edit-G2E5SNGU.js → edit-HXCSFGP5.js} +24 -25
- package/dist/{edit-Q3UQIOLS.js → edit-I2RJUPWV.js} +4 -4
- package/dist/{edit-ZMERG3L7.js → edit-JB7KVBOL.js} +5 -5
- package/dist/{edit-C4OCKQVU.js → edit-JT4OKP5H.js} +25 -9
- package/dist/{edit-O4JLGKQR.js → edit-NHQJLCAK.js} +4 -4
- package/dist/edit-PIOHPBF5.js +103 -0
- package/dist/{edit-FXNXTVIW.js → edit-UYYI6HIT.js} +30 -13
- package/dist/{edit-VVLITC2E.js → edit-VFHZ6GVR.js} +44 -78
- package/dist/{edit-HTLLYECP.js → edit-W7T5NAFW.js} +33 -35
- package/dist/{edit-KAKVPHZZ.js → edit-WN2Q3TOX.js} +4 -4
- package/dist/{edit-OKU6FMHJ.js → edit-X4DFAW7S.js} +60 -39
- package/dist/{edit-ZAHCMF5U.js → edit-YLWMEXUS.js} +25 -9
- package/dist/{edit-522DG3BY.js → edit-ZOLSAIKF.js} +3 -3
- package/dist/{edit-budget-L3CCEWNF.js → edit-budget-XVJ65KUO.js} +3 -3
- package/dist/{edit-inventory-item-ZKXXL3QK.js → edit-inventory-item-NHSXZ7UB.js} +24 -9
- package/dist/{edit-inventory-item-attributes-GSKUMORD.js → edit-inventory-item-attributes-VTFPTLLT.js} +3 -3
- package/dist/edit-price-XCJDZ4CU.js +197 -0
- package/dist/edit-stock-5SQJH74B.js +230 -0
- package/dist/extension-targets.d.ts +248 -0
- package/dist/extension-targets.js +1 -0
- package/dist/fulfillment-5LEDKCH7.js +650 -0
- package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KUIDFRP4.js} +39 -40
- package/dist/index.css +82 -45
- package/dist/index.d.ts +2 -0
- package/dist/index.js +389 -271
- package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-L26YLIBO.js} +18 -18
- package/dist/{inventory-WSFLTA6Z.js → inventory-ZWZ2SUYW.js} +9 -9
- package/dist/{invite-2673PU4I.js → invite-CQEODMVX.js} +29 -41
- package/dist/{invite-HRXZ5YBP.js → invite-VYXX7ICP.js} +38 -39
- package/dist/loader-CDW7SKZP.js +34 -0
- package/dist/loader-OGR7BCER.js +35 -0
- package/dist/{locations-INS6FTMJ.js → locations-UVMY2QLW.js} +3 -3
- package/dist/login-Z43XSPNR.js +39 -0
- package/dist/{manage-locations-XHH5DVIR.js → manage-locations-WD3WRVMF.js} +3 -3
- package/dist/media-UAAKHWJZ.js +316 -0
- package/dist/{media-J22P2DK4.js → media-VRNKF2TX.js} +31 -31
- package/dist/{metadata-REQIFWWH.js → metadata-6FYHGP2P.js} +27 -28
- package/dist/{metadata-Q74OJWUD.js → metadata-GI4A7XUC.js} +27 -28
- package/dist/{metadata-NIDIBXJT.js → metadata-GR7QS5N6.js} +27 -28
- package/dist/{metadata-YVHJPDLD.js → metadata-MRDVKETB.js} +25 -26
- package/dist/{metadata-D6M66NQK.js → metadata-QZEX5FQH.js} +25 -26
- package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-LRKRHBRT.js} +246 -265
- package/dist/offer-detail-page-RSBA6WJB.js +637 -0
- package/dist/offer-variant-detail-page-KBDN27ZG.js +411 -0
- package/dist/offers-LBJILJQX.js +54 -0
- package/dist/{onboarding-MK2RIFD4.js → onboarding-4DXHB5KY.js} +71 -73
- package/dist/orders-JGKXRRJ6.js +63 -0
- package/dist/{organization-XO3T2K2X.js → organization-NQHWLNES.js} +26 -27
- package/dist/{organize-5XRZWD5C.js → organize-PNLFCNY4.js} +4 -4
- package/dist/{organize-Z7JTTDH4.js → organize-X4IMS4S5.js} +4 -4
- package/dist/pages/index.d.ts +249 -234
- package/dist/pages/index.js +91 -91
- package/dist/{payment-details-CFTX3QDL.js → payment-details-T7CKYYQR.js} +43 -32
- package/dist/{payouts-7Q7D4FET.js → payouts-MGC6Z3AT.js} +10 -10
- package/dist/{price-lists-6TFLA53G.js → price-lists-QJTMWEEP.js} +11 -11
- package/dist/{pricing-ECXV6K7G.js → pricing-CFDZXHIE.js} +29 -30
- package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-LEEEQ2TR.js} +21 -19
- package/dist/{product-tags-5O7ZG6SA.js → product-tags-Z7DOYERG.js} +47 -47
- package/dist/{product-types-PKUEL7X5.js → product-types-F5YH6TBY.js} +9 -9
- package/dist/product-variant-detail-EUWXJWAJ.js +372 -0
- package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-OP7DAKIN.js} +45 -27
- package/dist/{products-BM3IIH5P.js → products-QRYZFYMR.js} +39 -40
- package/dist/products-SGYVJ33I.js +93 -0
- package/dist/{professional-details-ED4HNYXY.js → professional-details-UVRM7GID.js} +42 -31
- package/dist/{profile-6TGCNNUU.js → profile-HYJJLO63.js} +75 -42
- package/dist/{promotions-AZM7JQAJ.js → promotions-TF4GPADY.js} +11 -11
- package/dist/{receive-2GFZTVNC.js → receive-NHOBI4NE.js} +63 -21
- package/dist/{refund-IGMSXQNX.js → refund-6MXXZP2L.js} +78 -54
- package/dist/{register-ADZCPWEV.js → register-SC2R7TDT.js} +26 -27
- package/dist/{reset-password-RGWK33Q7.js → reset-password-OIZAI2US.js} +3 -3
- package/dist/{return-reasons-QJRA2ZX6.js → return-reasons-L5BFL5WW.js} +28 -24
- package/dist/{sales-channels-U55MUDQP.js → sales-channels-57VSC3CU.js} +11 -11
- package/dist/{sales-channels-CZDU7VTE.js → sales-channels-VXOZQKLK.js} +15 -15
- package/dist/{settings-2GCQQTO6.js → settings-UZGHDHAR.js} +54 -54
- package/dist/{shipment-HWQHMX2L.js → shipment-KF4M3RDJ.js} +24 -25
- package/dist/shipping-3KKFZONF.js +125 -0
- package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-ZHE4U2MG.js} +5 -9
- package/dist/shipping-profiles-W6ESWKTU.js +46 -0
- package/dist/{stock-MQA7PRO6.js → stock-JCDE7SMM.js} +27 -28
- package/dist/{store-5ZHZR4JI.js → store-UOOVXKZY.js} +136 -63
- package/dist/{store-closure-H5WHV3LA.js → store-closure-7TG7Y7LW.js} +24 -25
- package/dist/{store-select-PZS556FB.js → store-select-SARJSWL4.js} +45 -27
- package/dist/{tax-regions-HDLBFZVG.js → tax-regions-4NK7L6FA.js} +13 -10
- package/dist/{team-CLKJCZNH.js → team-45IARFMH.js} +40 -40
- package/package.json +23 -18
- package/dist/[id]-B4YZTANM.js +0 -1571
- package/dist/[id]-FE5GYYVZ.js +0 -481
- package/dist/[id]-GBT6VB4S.js +0 -361
- package/dist/[id]-QOEO3JOV.js +0 -384
- package/dist/allocate-items-TCM5A55Y.js +0 -548
- package/dist/attributes-SZP2MM5L.js +0 -278
- package/dist/breadcrumb-5NP23D6X.js +0 -34
- package/dist/breadcrumb-EVZIOB2G.js +0 -47
- package/dist/breadcrumb-TNJSGX4T.js +0 -48
- package/dist/chunk-27KRIXMQ.js +0 -71
- package/dist/chunk-BDZOSMAX.js +0 -23
- package/dist/chunk-CFRWIQIZ.js +0 -43
- package/dist/chunk-FP6U6BPH.js +0 -61
- package/dist/chunk-RXV7INUV.js +0 -426
- package/dist/chunk-T6LHVNWO.js +0 -27
- package/dist/collections-URH2TCWJ.js +0 -69
- package/dist/create-7R6CZU53.js +0 -215
- package/dist/create-Z5VPBELS.js +0 -76
- package/dist/edit-GQNIINRR.js +0 -192
- package/dist/edit-XSICGAVO.js +0 -176
- package/dist/fulfillment-76IVZ266.js +0 -567
- package/dist/loader-VDYPD3RI.js +0 -31
- package/dist/login-TWUBU6I6.js +0 -40
- package/dist/metadata-5BPOBBU2.js +0 -45
- package/dist/offer-detail-page-6SIBQTLP.js +0 -492
- package/dist/offer-edit-page-3MO566RP.js +0 -151
- package/dist/offers-GVN5LCK6.js +0 -32
- package/dist/orders-TVQDR4OJ.js +0 -64
- package/dist/product-variant-detail-PUWOMVHQ.js +0 -210
- package/dist/products-XE5YPQ66.js +0 -93
- package/dist/shipping-profiles-C5WBXWZ2.js +0 -47
- /package/dist/{chunk-HFRHHT36.js → chunk-NWU7EGGF.js} +0 -0
|
@@ -1,46 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineTabMeta
|
|
3
|
+
} from "./chunk-LEWA4BPH.js";
|
|
1
4
|
import {
|
|
2
5
|
DataGrid,
|
|
3
6
|
createDataGridHelper
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5FBQOAXU.js";
|
|
5
8
|
import {
|
|
6
9
|
HandleInput
|
|
7
10
|
} from "./chunk-HJ56YXBU.js";
|
|
8
|
-
import {
|
|
9
|
-
defineTabMeta
|
|
10
|
-
} from "./chunk-LEWA4BPH.js";
|
|
11
11
|
import {
|
|
12
12
|
SwitchBox
|
|
13
13
|
} from "./chunk-YVCBMOJG.js";
|
|
14
14
|
import {
|
|
15
15
|
SingleCategoryCombobox
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IWF43LO2.js";
|
|
17
17
|
import {
|
|
18
18
|
useComboboxData
|
|
19
19
|
} from "./chunk-OVPAOBZB.js";
|
|
20
20
|
import {
|
|
21
21
|
UploadMediaFormItem
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CQRCUQC4.js";
|
|
23
23
|
import {
|
|
24
24
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
25
25
|
ProductCreateSchema,
|
|
26
|
-
decorateVariantsWithDefaultValues,
|
|
27
26
|
generateVariantsFromAttributes,
|
|
28
27
|
normalizeProductFormValues
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-2INANL6V.js";
|
|
30
29
|
import {
|
|
31
30
|
ChipInput
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KDE4HKH2.js";
|
|
33
32
|
import {
|
|
34
33
|
useAttributeTableFilters,
|
|
35
34
|
useAttributeTableQuery
|
|
36
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-4OQLPIUZ.js";
|
|
37
36
|
import {
|
|
38
37
|
Combobox
|
|
39
38
|
} from "./chunk-VBRTC2VU.js";
|
|
40
39
|
import {
|
|
41
40
|
TabbedForm,
|
|
42
41
|
useTabbedForm
|
|
43
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-WJ5EU3KW.js";
|
|
44
43
|
import {
|
|
45
44
|
RouteFocusModal,
|
|
46
45
|
StackedFocusModal,
|
|
@@ -51,44 +50,44 @@ import {
|
|
|
51
50
|
Form
|
|
52
51
|
} from "./chunk-3QSRE5LS.js";
|
|
53
52
|
import {
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
_DataTable,
|
|
54
|
+
useDataTable
|
|
55
|
+
} from "./chunk-7TQNE3E2.js";
|
|
56
56
|
import {
|
|
57
57
|
require_dist
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
useFeatureFlags
|
|
61
|
-
} from "./chunk-TBYCZRZ7.js";
|
|
58
|
+
} from "./chunk-VYSB4CTB.js";
|
|
62
59
|
import {
|
|
63
60
|
ActionMenu
|
|
64
61
|
} from "./chunk-BDGZ4EQO.js";
|
|
62
|
+
import {
|
|
63
|
+
useFeatureFlags
|
|
64
|
+
} from "./chunk-BQHVM46E.js";
|
|
65
65
|
import {
|
|
66
66
|
useCreateProduct,
|
|
67
67
|
useProductAttributes
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-744GLNZW.js";
|
|
69
69
|
import {
|
|
70
|
-
sdk
|
|
71
|
-
|
|
72
|
-
} from "./chunk-RIN4CBRB.js";
|
|
70
|
+
sdk
|
|
71
|
+
} from "./chunk-LXZXXOJ3.js";
|
|
73
72
|
import {
|
|
74
73
|
__toESM
|
|
75
74
|
} from "./chunk-NBMM2TZK.js";
|
|
76
75
|
|
|
77
76
|
// src/pages/products/create/product-create.tsx
|
|
78
77
|
import { Children as Children2 } from "react";
|
|
79
|
-
import { useTranslation as
|
|
78
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
80
79
|
|
|
81
80
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
82
81
|
var import_types6 = __toESM(require_dist(), 1);
|
|
83
82
|
import { Button as Button3, toast } from "@medusajs/ui";
|
|
84
|
-
import { useEffect as useEffect3, useMemo as
|
|
85
|
-
import { useForm, useWatch as
|
|
86
|
-
import { useTranslation as
|
|
83
|
+
import { useEffect as useEffect3, useMemo as useMemo3, Children } from "react";
|
|
84
|
+
import { useForm, useWatch as useWatch2 } from "react-hook-form";
|
|
85
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
87
86
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
88
87
|
|
|
89
88
|
// src/pages/products/create/components/product-create-attributes-form/product-create-attributes-form.tsx
|
|
90
89
|
var import_types = __toESM(require_dist(), 1);
|
|
91
|
-
import {
|
|
90
|
+
import { XMarkMini } from "@medusajs/icons";
|
|
92
91
|
import {
|
|
93
92
|
Button as Button2,
|
|
94
93
|
Heading,
|
|
@@ -100,11 +99,9 @@ import {
|
|
|
100
99
|
Select,
|
|
101
100
|
Switch,
|
|
102
101
|
Text,
|
|
103
|
-
Textarea
|
|
104
|
-
clx
|
|
102
|
+
Textarea
|
|
105
103
|
} from "@medusajs/ui";
|
|
106
|
-
import {
|
|
107
|
-
import { forwardRef, useEffect as useEffect2 } from "react";
|
|
104
|
+
import { useEffect as useEffect2 } from "react";
|
|
108
105
|
import {
|
|
109
106
|
Controller,
|
|
110
107
|
useFieldArray
|
|
@@ -112,16 +109,13 @@ import {
|
|
|
112
109
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
113
110
|
|
|
114
111
|
// src/pages/products/create/components/product-create-attributes-form/product-create-add-attributes-modal.tsx
|
|
112
|
+
import { Badge, Button, Checkbox } from "@medusajs/ui";
|
|
113
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
115
114
|
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Checkbox,
|
|
119
|
-
createDataTableColumnHelper,
|
|
120
|
-
Tooltip
|
|
121
|
-
} from "@medusajs/ui";
|
|
115
|
+
createColumnHelper
|
|
116
|
+
} from "@tanstack/react-table";
|
|
122
117
|
import { useEffect, useMemo, useState } from "react";
|
|
123
118
|
import { useTranslation } from "react-i18next";
|
|
124
|
-
import { keepPreviousData } from "@tanstack/react-query";
|
|
125
119
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
126
120
|
var ADD_ATTRIBUTES_MODAL_ID = "add-attributes";
|
|
127
121
|
var PAGE_SIZE = 20;
|
|
@@ -133,24 +127,23 @@ var ATTRIBUTE_TYPE_LABELS = {
|
|
|
133
127
|
toggle: "attributes.type.toggle",
|
|
134
128
|
text: "attributes.type.text_area"
|
|
135
129
|
};
|
|
136
|
-
var ROW_HIGHLIGHT_CLASSES = [
|
|
137
|
-
"[&_tr:has(button[role=checkbox][data-state=checked]:not([disabled]))>td]:!bg-ui-bg-highlight",
|
|
138
|
-
"[&_tr:has(button[role=checkbox][data-state=checked][disabled])>td]:!bg-ui-bg-subtle"
|
|
139
|
-
].join(" ");
|
|
140
130
|
var ProductCreateAddAttributesModal = () => {
|
|
141
131
|
const form = useTabbedForm();
|
|
142
132
|
const { t } = useTranslation();
|
|
143
133
|
const { getValues, setValue } = form;
|
|
144
134
|
const { setIsOpen, getIsOpen } = useStackedModal();
|
|
145
|
-
const [rowSelection, setRowSelection] = useState(
|
|
146
|
-
|
|
147
|
-
);
|
|
148
|
-
const
|
|
149
|
-
const { searchParams } = useAttributeTableQuery({
|
|
135
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
136
|
+
const [selected, setSelected] = useState([]);
|
|
137
|
+
const categoryId = form.watch("category_id");
|
|
138
|
+
const { searchParams, raw } = useAttributeTableQuery({
|
|
150
139
|
pageSize: PAGE_SIZE,
|
|
151
140
|
prefix: ADD_ATTRIBUTES_MODAL_ID
|
|
152
141
|
});
|
|
153
|
-
const
|
|
142
|
+
const attributesQuery = useMemo(
|
|
143
|
+
() => ({ ...searchParams, category_id: categoryId || void 0 }),
|
|
144
|
+
[searchParams, categoryId]
|
|
145
|
+
);
|
|
146
|
+
const { product_attributes, count, isLoading, isError, error } = useProductAttributes(attributesQuery, {
|
|
154
147
|
placeholderData: keepPreviousData
|
|
155
148
|
});
|
|
156
149
|
const open = getIsOpen(ADD_ATTRIBUTES_MODAL_ID);
|
|
@@ -161,20 +154,23 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
161
154
|
const attributes = getValues("attributes") ?? [];
|
|
162
155
|
const existing = attributes.filter((a) => a.attribute_id);
|
|
163
156
|
const selection = {};
|
|
164
|
-
const
|
|
157
|
+
const entries = [];
|
|
165
158
|
for (const a of existing) {
|
|
166
159
|
if (a.attribute_id) {
|
|
167
160
|
selection[a.attribute_id] = true;
|
|
168
161
|
const apiAttr = product_attributes?.find(
|
|
169
162
|
(pa) => pa.id === a.attribute_id
|
|
170
163
|
);
|
|
171
|
-
|
|
164
|
+
entries.push({
|
|
172
165
|
id: a.attribute_id,
|
|
173
166
|
name: a.title,
|
|
174
167
|
values: Array.isArray(a.values) ? a.values : a.values ? [a.values] : [],
|
|
175
168
|
is_variant_axis: a.use_for_variants,
|
|
176
169
|
type: a.type ?? apiAttr?.type ?? "",
|
|
177
|
-
available_values: a.available_values ?? apiAttr?.values?.map((v) => ({
|
|
170
|
+
available_values: a.available_values ?? apiAttr?.values?.map((v) => ({
|
|
171
|
+
id: v.id,
|
|
172
|
+
name: v.name
|
|
173
|
+
})) ?? []
|
|
178
174
|
});
|
|
179
175
|
}
|
|
180
176
|
}
|
|
@@ -182,7 +178,7 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
182
178
|
for (const attr of product_attributes) {
|
|
183
179
|
if (attr.is_required && !selection[attr.id]) {
|
|
184
180
|
selection[attr.id] = true;
|
|
185
|
-
|
|
181
|
+
entries.push({
|
|
186
182
|
id: attr.id,
|
|
187
183
|
name: attr.name,
|
|
188
184
|
values: [],
|
|
@@ -194,9 +190,10 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
194
190
|
}
|
|
195
191
|
}
|
|
196
192
|
setRowSelection(selection);
|
|
197
|
-
|
|
193
|
+
setSelected(entries);
|
|
198
194
|
}, [open, getValues, product_attributes]);
|
|
199
|
-
const
|
|
195
|
+
const updater = (fn) => {
|
|
196
|
+
const next = typeof fn === "function" ? fn(rowSelection) : fn;
|
|
200
197
|
if (product_attributes) {
|
|
201
198
|
for (const attr of product_attributes) {
|
|
202
199
|
if (attr.is_required) {
|
|
@@ -204,24 +201,20 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
204
201
|
}
|
|
205
202
|
}
|
|
206
203
|
}
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
ids.filter((id) => next[id] && !rowSelection[id])
|
|
204
|
+
const addedIds = new Set(
|
|
205
|
+
Object.keys(next).filter((id) => next[id] && !rowSelection[id])
|
|
210
206
|
);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
setState((prev) => {
|
|
223
|
-
const filteredPrev = prev.filter((a) => next[a.id]);
|
|
224
|
-
return Array.from(/* @__PURE__ */ new Set([...filteredPrev, ...addedAttributes]));
|
|
207
|
+
const addedAttributes = addedIds.size > 0 ? product_attributes?.filter((attr) => addedIds.has(attr.id)).map((attr) => ({
|
|
208
|
+
id: attr.id,
|
|
209
|
+
name: attr.name,
|
|
210
|
+
values: [],
|
|
211
|
+
is_variant_axis: attr.is_variant_axis,
|
|
212
|
+
type: attr.type,
|
|
213
|
+
available_values: attr.values?.map((v) => ({ id: v.id, name: v.name })) ?? []
|
|
214
|
+
})) ?? [] : [];
|
|
215
|
+
setSelected((prev) => {
|
|
216
|
+
const kept = prev.filter((a) => next[a.id]);
|
|
217
|
+
return Array.from(/* @__PURE__ */ new Set([...kept, ...addedAttributes]));
|
|
225
218
|
});
|
|
226
219
|
setRowSelection(next);
|
|
227
220
|
};
|
|
@@ -231,7 +224,7 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
231
224
|
const requiredIds = new Set(
|
|
232
225
|
product_attributes?.filter((a) => a.is_required).map((a) => a.id) ?? []
|
|
233
226
|
);
|
|
234
|
-
const selectedAttributes =
|
|
227
|
+
const selectedAttributes = selected.map((a) => ({
|
|
235
228
|
attribute_id: a.id,
|
|
236
229
|
title: a.name,
|
|
237
230
|
values: a.values,
|
|
@@ -249,112 +242,90 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
249
242
|
};
|
|
250
243
|
const filters = useAttributeTableFilters();
|
|
251
244
|
const columns = useColumns();
|
|
245
|
+
const { table } = useDataTable({
|
|
246
|
+
data: product_attributes ?? [],
|
|
247
|
+
columns,
|
|
248
|
+
count,
|
|
249
|
+
getRowId: (row) => row.id,
|
|
250
|
+
pageSize: PAGE_SIZE,
|
|
251
|
+
enablePagination: true,
|
|
252
|
+
enableRowSelection: (row) => !row.original.is_required,
|
|
253
|
+
rowSelection: { state: rowSelection, updater },
|
|
254
|
+
prefix: ADD_ATTRIBUTES_MODAL_ID
|
|
255
|
+
});
|
|
252
256
|
if (isError) {
|
|
253
257
|
throw error;
|
|
254
258
|
}
|
|
255
|
-
const emptyState = useMemo(
|
|
256
|
-
() => ({
|
|
257
|
-
empty: {
|
|
258
|
-
heading: t("products.create.attributes.noAttributesTitle"),
|
|
259
|
-
description: t("products.create.attributes.noAttributesDescription")
|
|
260
|
-
}
|
|
261
|
-
}),
|
|
262
|
-
[t]
|
|
263
|
-
);
|
|
264
259
|
return /* @__PURE__ */ jsxs(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
|
|
265
260
|
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
266
|
-
/* @__PURE__ */ jsx(
|
|
267
|
-
|
|
261
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex size-full flex-col overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
262
|
+
_DataTable,
|
|
268
263
|
{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
emptyState
|
|
290
|
-
}
|
|
291
|
-
)
|
|
264
|
+
table,
|
|
265
|
+
columns,
|
|
266
|
+
count,
|
|
267
|
+
pageSize: PAGE_SIZE,
|
|
268
|
+
isLoading,
|
|
269
|
+
filters,
|
|
270
|
+
orderBy: [
|
|
271
|
+
{ key: "name", label: t("attributes.fields.name") },
|
|
272
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
273
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
274
|
+
],
|
|
275
|
+
queryObject: raw,
|
|
276
|
+
prefix: ADD_ATTRIBUTES_MODAL_ID,
|
|
277
|
+
layout: "fill",
|
|
278
|
+
pagination: true,
|
|
279
|
+
search: true,
|
|
280
|
+
noRecords: {
|
|
281
|
+
title: t("products.create.attributes.noAttributesTitle"),
|
|
282
|
+
message: t("products.create.attributes.noAttributesDescription")
|
|
283
|
+
}
|
|
292
284
|
}
|
|
293
|
-
),
|
|
285
|
+
) }),
|
|
294
286
|
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
295
287
|
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
|
|
296
288
|
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
|
|
297
289
|
] }) })
|
|
298
290
|
] });
|
|
299
291
|
};
|
|
300
|
-
var columnHelper =
|
|
292
|
+
var columnHelper = createColumnHelper();
|
|
301
293
|
var useColumns = () => {
|
|
302
294
|
const { t } = useTranslation();
|
|
303
295
|
return useMemo(
|
|
304
296
|
() => [
|
|
305
|
-
columnHelper.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
{
|
|
313
|
-
onClick: (e) => e.stopPropagation(),
|
|
314
|
-
checked,
|
|
315
|
-
onCheckedChange: onChange,
|
|
316
|
-
disabled
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
if (disabled) {
|
|
320
|
-
return /* @__PURE__ */ jsx(
|
|
321
|
-
Tooltip,
|
|
322
|
-
{
|
|
323
|
-
content: t("products.create.attributes.requiredTooltip"),
|
|
324
|
-
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: checkbox })
|
|
325
|
-
}
|
|
326
|
-
);
|
|
297
|
+
columnHelper.display({
|
|
298
|
+
id: "select",
|
|
299
|
+
header: ({ table }) => /* @__PURE__ */ jsx(
|
|
300
|
+
Checkbox,
|
|
301
|
+
{
|
|
302
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
303
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
327
304
|
}
|
|
328
|
-
|
|
329
|
-
}
|
|
305
|
+
),
|
|
306
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
307
|
+
Checkbox,
|
|
308
|
+
{
|
|
309
|
+
checked: row.getIsSelected(),
|
|
310
|
+
disabled: !row.getCanSelect(),
|
|
311
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
312
|
+
onClick: (e) => e.stopPropagation()
|
|
313
|
+
}
|
|
314
|
+
)
|
|
330
315
|
}),
|
|
331
316
|
columnHelper.accessor("name", {
|
|
332
|
-
header: t("attributes.fields.
|
|
333
|
-
enableSorting: false
|
|
317
|
+
header: t("attributes.fields.productAttribute")
|
|
334
318
|
}),
|
|
335
319
|
columnHelper.accessor("handle", {
|
|
336
320
|
header: t("attributes.fields.handle"),
|
|
337
321
|
cell: (info) => {
|
|
338
322
|
const handle = info.getValue();
|
|
339
323
|
return handle ? `/${handle}` : "-";
|
|
340
|
-
}
|
|
341
|
-
enableSorting: false
|
|
324
|
+
}
|
|
342
325
|
}),
|
|
343
326
|
columnHelper.accessor("is_required", {
|
|
344
327
|
header: t("attributes.fields.required"),
|
|
345
|
-
cell: (info) =>
|
|
346
|
-
if (info.getValue()) {
|
|
347
|
-
return /* @__PURE__ */ jsx(
|
|
348
|
-
Tooltip,
|
|
349
|
-
{
|
|
350
|
-
content: t("products.create.attributes.requiredTooltip"),
|
|
351
|
-
children: /* @__PURE__ */ jsx("span", { className: "cursor-help underline decoration-dotted underline-offset-2", children: t("filters.radio.yes") })
|
|
352
|
-
}
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
return t("filters.radio.no");
|
|
356
|
-
},
|
|
357
|
-
enableSorting: false
|
|
328
|
+
cell: (info) => info.getValue() ? t("filters.radio.yes") : t("filters.radio.no")
|
|
358
329
|
}),
|
|
359
330
|
columnHelper.accessor("type", {
|
|
360
331
|
header: t("attributes.fields.type"),
|
|
@@ -362,19 +333,17 @@ var useColumns = () => {
|
|
|
362
333
|
const type = info.getValue();
|
|
363
334
|
const labelKey = ATTRIBUTE_TYPE_LABELS[type];
|
|
364
335
|
return labelKey ? t(labelKey) : type;
|
|
365
|
-
}
|
|
366
|
-
enableSorting: false
|
|
336
|
+
}
|
|
367
337
|
}),
|
|
368
338
|
columnHelper.accessor("is_variant_axis", {
|
|
369
339
|
header: t("attributes.fields.variantAxis"),
|
|
370
|
-
cell: (info) => info.getValue() ? t("filters.radio.yes") : t("filters.radio.no")
|
|
371
|
-
enableSorting: false
|
|
340
|
+
cell: (info) => info.getValue() ? t("filters.radio.yes") : t("filters.radio.no")
|
|
372
341
|
}),
|
|
373
342
|
columnHelper.display({
|
|
374
343
|
id: "values",
|
|
375
344
|
header: t("attributes.fields.values"),
|
|
376
345
|
cell: ({ row }) => {
|
|
377
|
-
const values = row.original.values ?? [];
|
|
346
|
+
const values = row.original.type === "toggle" ? [] : row.original.values ?? [];
|
|
378
347
|
if (!values.length) {
|
|
379
348
|
return /* @__PURE__ */ jsx("span", { className: "text-ui-fg-muted", children: "-" });
|
|
380
349
|
}
|
|
@@ -443,6 +412,7 @@ var Root = () => {
|
|
|
443
412
|
variant: "secondary",
|
|
444
413
|
size: "small",
|
|
445
414
|
onClick: handleAddExisting,
|
|
415
|
+
"data-testid": "product-create-attributes-add-existing",
|
|
446
416
|
children: t("products.create.attributes.addExisting")
|
|
447
417
|
}
|
|
448
418
|
),
|
|
@@ -453,124 +423,150 @@ var Root = () => {
|
|
|
453
423
|
variant: "secondary",
|
|
454
424
|
size: "small",
|
|
455
425
|
onClick: handleCreateNew,
|
|
426
|
+
"data-testid": "product-create-attributes-create-new",
|
|
456
427
|
children: t("products.create.attributes.createNew")
|
|
457
428
|
}
|
|
458
429
|
)
|
|
459
430
|
] }),
|
|
460
431
|
fields.some((f) => !f.is_custom && !!f.attribute_id) && /* @__PURE__ */ jsx2(SelectedAttributes, { fields, remove }),
|
|
461
|
-
fields.some((f) => f.is_custom) && /* @__PURE__ */ jsx2(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
) }),
|
|
482
|
-
/* @__PURE__ */ jsx2(
|
|
483
|
-
Input,
|
|
484
|
-
{
|
|
485
|
-
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
486
|
-
...form.register(`attributes.${index}.title`),
|
|
487
|
-
placeholder: t(
|
|
488
|
-
"products.create.attributes.titlePlaceholder"
|
|
489
|
-
)
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
493
|
-
Label,
|
|
494
|
-
{
|
|
495
|
-
size: "xsmall",
|
|
496
|
-
weight: "plus",
|
|
497
|
-
className: "text-ui-fg-subtle",
|
|
498
|
-
htmlFor: `attributes.${index}.values`,
|
|
499
|
-
children: t("fields.values")
|
|
500
|
-
}
|
|
501
|
-
) }),
|
|
502
|
-
/* @__PURE__ */ jsx2(
|
|
503
|
-
Controller,
|
|
504
|
-
{
|
|
505
|
-
control: form.control,
|
|
506
|
-
name: `attributes.${index}.values`,
|
|
507
|
-
render: ({ field: { onChange, value, ...field2 } }) => useForVariants ? /* @__PURE__ */ jsx2(
|
|
508
|
-
ChipInput,
|
|
432
|
+
fields.some((f) => f.is_custom) && /* @__PURE__ */ jsx2(
|
|
433
|
+
"ul",
|
|
434
|
+
{
|
|
435
|
+
className: "flex flex-col gap-y-4",
|
|
436
|
+
"data-testid": "product-create-attributes-list",
|
|
437
|
+
children: fields.map((field, index) => {
|
|
438
|
+
if (!field.is_custom) return null;
|
|
439
|
+
const useForVariants = form.watch(
|
|
440
|
+
`attributes.${index}.use_for_variants`
|
|
441
|
+
);
|
|
442
|
+
return /* @__PURE__ */ jsxs2(
|
|
443
|
+
"li",
|
|
444
|
+
{
|
|
445
|
+
className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-start gap-1.5 rounded-xl p-1.5",
|
|
446
|
+
"data-testid": `product-create-attribute-row-${index}`,
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
449
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
450
|
+
Label,
|
|
509
451
|
{
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
"products.create.attributes.valuePlaceholder"
|
|
516
|
-
)
|
|
452
|
+
size: "xsmall",
|
|
453
|
+
weight: "plus",
|
|
454
|
+
className: "text-ui-fg-subtle",
|
|
455
|
+
htmlFor: `attributes.${index}.title`,
|
|
456
|
+
children: t("fields.title")
|
|
517
457
|
}
|
|
518
|
-
)
|
|
519
|
-
|
|
458
|
+
) }),
|
|
459
|
+
/* @__PURE__ */ jsx2(
|
|
460
|
+
Input,
|
|
520
461
|
{
|
|
521
|
-
...field2,
|
|
522
462
|
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
523
|
-
|
|
524
|
-
|
|
463
|
+
...form.register(
|
|
464
|
+
`attributes.${index}.title`
|
|
465
|
+
),
|
|
525
466
|
placeholder: t(
|
|
526
|
-
"products.create.attributes.
|
|
467
|
+
"products.create.attributes.titlePlaceholder"
|
|
468
|
+
),
|
|
469
|
+
"data-testid": `product-create-attribute-title-${index}`
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
473
|
+
Label,
|
|
474
|
+
{
|
|
475
|
+
size: "xsmall",
|
|
476
|
+
weight: "plus",
|
|
477
|
+
className: "text-ui-fg-subtle",
|
|
478
|
+
htmlFor: `attributes.${index}.values`,
|
|
479
|
+
children: t("fields.values")
|
|
480
|
+
}
|
|
481
|
+
) }),
|
|
482
|
+
/* @__PURE__ */ jsx2(
|
|
483
|
+
Controller,
|
|
484
|
+
{
|
|
485
|
+
control: form.control,
|
|
486
|
+
name: `attributes.${index}.values`,
|
|
487
|
+
render: ({ field: { onChange, value, ...field2 } }) => useForVariants ? /* @__PURE__ */ jsx2(
|
|
488
|
+
ChipInput,
|
|
489
|
+
{
|
|
490
|
+
...field2,
|
|
491
|
+
variant: "contrast",
|
|
492
|
+
value: Array.isArray(value) ? value : [],
|
|
493
|
+
onChange,
|
|
494
|
+
placeholder: t(
|
|
495
|
+
"products.create.attributes.valuePlaceholder"
|
|
496
|
+
),
|
|
497
|
+
"data-testid": `product-create-attribute-values-${index}`
|
|
498
|
+
}
|
|
499
|
+
) : /* @__PURE__ */ jsx2(
|
|
500
|
+
Textarea,
|
|
501
|
+
{
|
|
502
|
+
...field2,
|
|
503
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
504
|
+
value: Array.isArray(value) ? value[0] ?? "" : value ?? "",
|
|
505
|
+
onChange: (e) => onChange(e.target.value),
|
|
506
|
+
placeholder: t(
|
|
507
|
+
"products.create.attributes.valuePlaceholder"
|
|
508
|
+
),
|
|
509
|
+
"data-testid": `product-create-attribute-values-${index}`
|
|
510
|
+
}
|
|
527
511
|
)
|
|
528
512
|
}
|
|
529
|
-
)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
513
|
+
),
|
|
514
|
+
/* @__PURE__ */ jsx2("div", {}),
|
|
515
|
+
/* @__PURE__ */ jsx2(
|
|
516
|
+
Form.Field,
|
|
517
|
+
{
|
|
518
|
+
control: form.control,
|
|
519
|
+
name: `attributes.${index}.use_for_variants`,
|
|
520
|
+
render: ({
|
|
521
|
+
field: { value, onChange, ref }
|
|
522
|
+
}) => /* @__PURE__ */ jsx2(Form.Item, { children: /* @__PURE__ */ jsxs2(
|
|
523
|
+
"div",
|
|
524
|
+
{
|
|
525
|
+
className: "flex items-start gap-x-3 py-1.5",
|
|
526
|
+
"data-testid": `product-create-attribute-use-for-variants-${index}`,
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
|
|
529
|
+
Switch,
|
|
530
|
+
{
|
|
531
|
+
ref,
|
|
532
|
+
className: "shrink-0 rtl:rotate-180",
|
|
533
|
+
checked: value,
|
|
534
|
+
onCheckedChange: onChange
|
|
535
|
+
}
|
|
536
|
+
) }),
|
|
537
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
|
|
538
|
+
/* @__PURE__ */ jsx2(Label, { size: "xsmall", weight: "plus", children: t(
|
|
539
|
+
"products.create.attributes.useForVariants"
|
|
540
|
+
) }),
|
|
541
|
+
/* @__PURE__ */ jsx2(Hint, { className: "!txt-small", children: t(
|
|
542
|
+
"products.create.attributes.useForVariantsDescription"
|
|
543
|
+
) })
|
|
544
|
+
] })
|
|
545
|
+
]
|
|
546
|
+
}
|
|
552
547
|
) })
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
] }),
|
|
551
|
+
/* @__PURE__ */ jsx2(
|
|
552
|
+
IconButton,
|
|
553
|
+
{
|
|
554
|
+
type: "button",
|
|
555
|
+
size: "small",
|
|
556
|
+
variant: "transparent",
|
|
557
|
+
className: "text-ui-fg-muted",
|
|
558
|
+
onClick: () => remove(index),
|
|
559
|
+
"data-testid": `product-create-attribute-remove-${index}`,
|
|
560
|
+
children: /* @__PURE__ */ jsx2(XMarkMini, {})
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
]
|
|
564
|
+
},
|
|
565
|
+
field.id
|
|
566
|
+
);
|
|
567
|
+
})
|
|
568
|
+
}
|
|
569
|
+
),
|
|
574
570
|
/* @__PURE__ */ jsx2(RequiredAttributes, {})
|
|
575
571
|
] })
|
|
576
572
|
]
|
|
@@ -587,171 +583,183 @@ var SelectedAttributes = ({
|
|
|
587
583
|
({ field }) => !field.is_custom && !field.is_required && !!field.attribute_id
|
|
588
584
|
);
|
|
589
585
|
if (!entries.length) return null;
|
|
590
|
-
return /* @__PURE__ */ jsx2(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
"
|
|
595
|
-
{
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
) }),
|
|
608
|
-
/* @__PURE__ */ jsx2(
|
|
609
|
-
Input,
|
|
610
|
-
{
|
|
611
|
-
value: field.title,
|
|
612
|
-
disabled: true,
|
|
613
|
-
className: "bg-ui-bg-field-component"
|
|
614
|
-
}
|
|
615
|
-
),
|
|
616
|
-
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
617
|
-
Label,
|
|
618
|
-
{
|
|
619
|
-
size: "xsmall",
|
|
620
|
-
weight: "plus",
|
|
621
|
-
className: "text-ui-fg-subtle",
|
|
622
|
-
children: t("fields.values")
|
|
623
|
-
}
|
|
624
|
-
) }),
|
|
625
|
-
attrType === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
626
|
-
Controller,
|
|
627
|
-
{
|
|
628
|
-
control: form.control,
|
|
629
|
-
name: `attributes.${index}.values`,
|
|
630
|
-
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
631
|
-
Combobox,
|
|
586
|
+
return /* @__PURE__ */ jsx2(
|
|
587
|
+
"ul",
|
|
588
|
+
{
|
|
589
|
+
className: "flex flex-col gap-y-4",
|
|
590
|
+
"data-testid": "product-create-selected-attributes-list",
|
|
591
|
+
children: entries.map(({ field, index }) => {
|
|
592
|
+
const attrType = field.type;
|
|
593
|
+
const availableValues = field.available_values ?? [];
|
|
594
|
+
return /* @__PURE__ */ jsxs2(
|
|
595
|
+
"li",
|
|
596
|
+
{
|
|
597
|
+
className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-start gap-1.5 rounded-xl p-1.5",
|
|
598
|
+
"data-testid": `product-create-selected-attribute-row-${index}`,
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
601
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
602
|
+
Label,
|
|
632
603
|
{
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
options: availableValues.map((v) => ({
|
|
638
|
-
value: v.name,
|
|
639
|
-
label: v.name
|
|
640
|
-
})),
|
|
641
|
-
placeholder: t("products.create.attributes.selectValues")
|
|
604
|
+
size: "xsmall",
|
|
605
|
+
weight: "plus",
|
|
606
|
+
className: "text-ui-fg-subtle",
|
|
607
|
+
children: t("fields.title")
|
|
642
608
|
}
|
|
643
|
-
)
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
Controller,
|
|
647
|
-
{
|
|
648
|
-
control: form.control,
|
|
649
|
-
name: `attributes.${index}.values`,
|
|
650
|
-
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
651
|
-
Select,
|
|
609
|
+
) }),
|
|
610
|
+
/* @__PURE__ */ jsx2(
|
|
611
|
+
Input,
|
|
652
612
|
{
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
658
|
-
Select.Value,
|
|
659
|
-
{
|
|
660
|
-
placeholder: t(
|
|
661
|
-
"products.create.attributes.selectValues"
|
|
662
|
-
)
|
|
663
|
-
}
|
|
664
|
-
) }),
|
|
665
|
-
/* @__PURE__ */ jsx2(Select.Content, { children: availableValues.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
666
|
-
]
|
|
613
|
+
value: field.title,
|
|
614
|
+
disabled: true,
|
|
615
|
+
className: "bg-ui-bg-field-component",
|
|
616
|
+
"data-testid": `product-create-selected-attribute-title-${index}`
|
|
667
617
|
}
|
|
668
|
-
)
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
Controller,
|
|
672
|
-
{
|
|
673
|
-
control: form.control,
|
|
674
|
-
name: `attributes.${index}.values`,
|
|
675
|
-
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
676
|
-
Textarea,
|
|
618
|
+
),
|
|
619
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
620
|
+
Label,
|
|
677
621
|
{
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
622
|
+
size: "xsmall",
|
|
623
|
+
weight: "plus",
|
|
624
|
+
className: "text-ui-fg-subtle",
|
|
625
|
+
children: t("fields.values")
|
|
626
|
+
}
|
|
627
|
+
) }),
|
|
628
|
+
attrType === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
629
|
+
Controller,
|
|
630
|
+
{
|
|
631
|
+
control: form.control,
|
|
632
|
+
name: `attributes.${index}.values`,
|
|
633
|
+
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
634
|
+
Combobox,
|
|
635
|
+
{
|
|
636
|
+
...rest,
|
|
637
|
+
ref,
|
|
638
|
+
value: Array.isArray(value) ? value : [],
|
|
639
|
+
onChange: (val) => onChange(val ?? []),
|
|
640
|
+
options: availableValues.map((v) => ({
|
|
641
|
+
value: v.name,
|
|
642
|
+
label: v.name
|
|
643
|
+
})),
|
|
644
|
+
placeholder: t(
|
|
645
|
+
"products.create.attributes.selectValues"
|
|
646
|
+
)
|
|
647
|
+
}
|
|
684
648
|
)
|
|
685
649
|
}
|
|
686
|
-
)
|
|
687
|
-
|
|
688
|
-
) : attrType === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
689
|
-
Controller,
|
|
690
|
-
{
|
|
691
|
-
control: form.control,
|
|
692
|
-
name: `attributes.${index}.values`,
|
|
693
|
-
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
694
|
-
Select,
|
|
650
|
+
) : attrType === import_types.AttributeType.SINGLE_SELECT ? /* @__PURE__ */ jsx2(
|
|
651
|
+
Controller,
|
|
695
652
|
{
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
653
|
+
control: form.control,
|
|
654
|
+
name: `attributes.${index}.values`,
|
|
655
|
+
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
656
|
+
Select,
|
|
657
|
+
{
|
|
658
|
+
...rest,
|
|
659
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
660
|
+
onValueChange: onChange,
|
|
661
|
+
children: [
|
|
662
|
+
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
663
|
+
Select.Value,
|
|
664
|
+
{
|
|
665
|
+
placeholder: t(
|
|
666
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
667
|
+
)
|
|
668
|
+
}
|
|
669
|
+
) }),
|
|
670
|
+
/* @__PURE__ */ jsx2(Select.Content, { children: availableValues.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
)
|
|
713
674
|
}
|
|
714
|
-
)
|
|
715
|
-
|
|
716
|
-
) : /* @__PURE__ */ jsx2(
|
|
717
|
-
Controller,
|
|
718
|
-
{
|
|
719
|
-
control: form.control,
|
|
720
|
-
name: `attributes.${index}.values`,
|
|
721
|
-
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
722
|
-
Input,
|
|
675
|
+
) : attrType === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
676
|
+
Controller,
|
|
723
677
|
{
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
678
|
+
control: form.control,
|
|
679
|
+
name: `attributes.${index}.values`,
|
|
680
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
681
|
+
Textarea,
|
|
682
|
+
{
|
|
683
|
+
...rest,
|
|
684
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
685
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
686
|
+
onChange: (e) => onChange(e.target.value),
|
|
687
|
+
placeholder: t(
|
|
688
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
689
|
+
)
|
|
690
|
+
}
|
|
729
691
|
)
|
|
730
692
|
}
|
|
731
|
-
)
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
693
|
+
) : attrType === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
694
|
+
Controller,
|
|
695
|
+
{
|
|
696
|
+
control: form.control,
|
|
697
|
+
name: `attributes.${index}.values`,
|
|
698
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
699
|
+
Select,
|
|
700
|
+
{
|
|
701
|
+
...rest,
|
|
702
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
703
|
+
onValueChange: onChange,
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ jsx2(Select.Trigger, { children: /* @__PURE__ */ jsx2(
|
|
706
|
+
Select.Value,
|
|
707
|
+
{
|
|
708
|
+
placeholder: t(
|
|
709
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
710
|
+
)
|
|
711
|
+
}
|
|
712
|
+
) }),
|
|
713
|
+
/* @__PURE__ */ jsxs2(Select.Content, { children: [
|
|
714
|
+
/* @__PURE__ */ jsx2(Select.Item, { value: "true", children: t("filters.radio.yes") }),
|
|
715
|
+
/* @__PURE__ */ jsx2(Select.Item, { value: "false", children: t("filters.radio.no") })
|
|
716
|
+
] })
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
)
|
|
720
|
+
}
|
|
721
|
+
) : /* @__PURE__ */ jsx2(
|
|
722
|
+
Controller,
|
|
723
|
+
{
|
|
724
|
+
control: form.control,
|
|
725
|
+
name: `attributes.${index}.values`,
|
|
726
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
727
|
+
Input,
|
|
728
|
+
{
|
|
729
|
+
...rest,
|
|
730
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
731
|
+
onChange: (e) => onChange(e.target.value),
|
|
732
|
+
placeholder: t(
|
|
733
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
734
|
+
)
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
field.use_for_variants && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
740
|
+
/* @__PURE__ */ jsx2("div", {}),
|
|
741
|
+
/* @__PURE__ */ jsx2(VariantAxisTip, { className: "border-none" })
|
|
742
|
+
] })
|
|
743
|
+
] }),
|
|
744
|
+
/* @__PURE__ */ jsx2(
|
|
745
|
+
IconButton,
|
|
746
|
+
{
|
|
747
|
+
type: "button",
|
|
748
|
+
size: "small",
|
|
749
|
+
variant: "transparent",
|
|
750
|
+
className: "text-ui-fg-muted",
|
|
751
|
+
onClick: () => remove(index),
|
|
752
|
+
"data-testid": `product-create-selected-attribute-remove-${index}`,
|
|
753
|
+
children: /* @__PURE__ */ jsx2(XMarkMini, {})
|
|
754
|
+
}
|
|
755
|
+
)
|
|
756
|
+
]
|
|
757
|
+
},
|
|
758
|
+
field.id
|
|
759
|
+
);
|
|
760
|
+
})
|
|
761
|
+
}
|
|
762
|
+
);
|
|
755
763
|
};
|
|
756
764
|
var RequiredAttributes = () => {
|
|
757
765
|
const { t } = useTranslation2();
|
|
@@ -768,73 +776,65 @@ var RequiredAttributes = () => {
|
|
|
768
776
|
useEffect2(() => {
|
|
769
777
|
if (!product_attributes) return;
|
|
770
778
|
const currentAttributes = form.getValues("attributes") || [];
|
|
771
|
-
const requiredIds = new Set(
|
|
779
|
+
const requiredIds = new Set(
|
|
780
|
+
product_attributes.map((a) => a.id)
|
|
781
|
+
);
|
|
772
782
|
const otherAttributes = currentAttributes.filter(
|
|
773
783
|
(a) => a.is_custom || !requiredIds.has(a.attribute_id ?? "")
|
|
774
784
|
);
|
|
775
|
-
const requiredAttributes = product_attributes.map(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
785
|
+
const requiredAttributes = product_attributes.map(
|
|
786
|
+
(attr) => {
|
|
787
|
+
const existing = currentAttributes.find(
|
|
788
|
+
(a) => a.attribute_id === attr.id
|
|
789
|
+
);
|
|
790
|
+
if (existing) return existing;
|
|
791
|
+
return {
|
|
792
|
+
attribute_id: attr.id,
|
|
793
|
+
title: attr.name,
|
|
794
|
+
values: attr.type === import_types.AttributeType.MULTI_SELECT ? [] : attr.type === import_types.AttributeType.TOGGLE ? "false" : "",
|
|
795
|
+
is_custom: false,
|
|
796
|
+
is_required: true,
|
|
797
|
+
use_for_variants: attr.is_variant_axis,
|
|
798
|
+
type: attr.type,
|
|
799
|
+
available_values: attr.values?.map((v) => ({ id: v.id, name: v.name })) ?? []
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
);
|
|
790
803
|
form.setValue("attributes", [...otherAttributes, ...requiredAttributes]);
|
|
791
|
-
}, [product_attributes]);
|
|
804
|
+
}, [product_attributes, form]);
|
|
792
805
|
if (!categoryId || !product_attributes?.length) return null;
|
|
793
806
|
const requiredEntries = attributes.map((attr, index) => ({ attr, index })).filter(({ attr }) => !attr.is_custom);
|
|
794
807
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
795
808
|
/* @__PURE__ */ jsx2("div", { className: "border-ui-border-base border-t border-dashed" }),
|
|
796
|
-
/* @__PURE__ */ jsxs2(
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
809
|
+
/* @__PURE__ */ jsxs2(
|
|
810
|
+
"div",
|
|
811
|
+
{
|
|
812
|
+
className: "flex flex-col gap-y-6",
|
|
813
|
+
"data-testid": "product-create-attributes-required",
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
816
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", weight: "plus", leading: "compact", children: t("products.create.attributes.requiredAttributes") }),
|
|
817
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", className: "text-ui-fg-subtle", children: t("products.create.attributes.requiredAttributesHint") })
|
|
818
|
+
] }),
|
|
819
|
+
requiredEntries.map(({ attr, index }) => {
|
|
820
|
+
const apiAttr = product_attributes.find(
|
|
821
|
+
(a) => a.id === attr.attribute_id
|
|
822
|
+
);
|
|
823
|
+
if (!apiAttr) return null;
|
|
824
|
+
return /* @__PURE__ */ jsx2(
|
|
825
|
+
RequiredAttributeField,
|
|
826
|
+
{
|
|
827
|
+
attribute: apiAttr,
|
|
828
|
+
index
|
|
829
|
+
},
|
|
830
|
+
apiAttr.id
|
|
831
|
+
);
|
|
832
|
+
})
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
)
|
|
816
836
|
] });
|
|
817
837
|
};
|
|
818
|
-
var RadioSelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
819
|
-
RadixSelect.Item,
|
|
820
|
-
{
|
|
821
|
-
ref,
|
|
822
|
-
className: clx(
|
|
823
|
-
"bg-ui-bg-component txt-compact-small grid cursor-pointer grid-cols-[15px_1fr] items-center gap-x-2 rounded-[4px] px-2 py-1.5 outline-none transition-colors",
|
|
824
|
-
"focus-visible:bg-ui-bg-component-hover",
|
|
825
|
-
"active:bg-ui-bg-component-pressed",
|
|
826
|
-
"data-[state=checked]:txt-compact-small-plus",
|
|
827
|
-
"disabled:text-ui-fg-disabled",
|
|
828
|
-
className
|
|
829
|
-
),
|
|
830
|
-
...props,
|
|
831
|
-
children: [
|
|
832
|
-
/* @__PURE__ */ jsx2("span", { className: "flex h-[15px] w-[15px] items-center justify-center", children: /* @__PURE__ */ jsx2(RadixSelect.ItemIndicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx2(CircleMiniFilledSolid, {}) }) }),
|
|
833
|
-
/* @__PURE__ */ jsx2(RadixSelect.ItemText, { className: "flex-1 truncate", children })
|
|
834
|
-
]
|
|
835
|
-
}
|
|
836
|
-
));
|
|
837
|
-
RadioSelectItem.displayName = "RadioSelectItem";
|
|
838
838
|
var RequiredAttributeField = ({
|
|
839
839
|
attribute,
|
|
840
840
|
index
|
|
@@ -863,7 +863,7 @@ var RequiredAttributeField = ({
|
|
|
863
863
|
)
|
|
864
864
|
}
|
|
865
865
|
) }),
|
|
866
|
-
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(
|
|
866
|
+
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
867
867
|
]
|
|
868
868
|
}
|
|
869
869
|
) : attribute.type === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
@@ -877,10 +877,12 @@ var RequiredAttributeField = ({
|
|
|
877
877
|
value: v.name,
|
|
878
878
|
label: v.name
|
|
879
879
|
})) ?? [],
|
|
880
|
-
placeholder: t(
|
|
880
|
+
placeholder: t(
|
|
881
|
+
"products.create.attributes.selectValues"
|
|
882
|
+
)
|
|
881
883
|
}
|
|
882
884
|
) : attribute.type === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
883
|
-
|
|
885
|
+
Input,
|
|
884
886
|
{
|
|
885
887
|
...field,
|
|
886
888
|
ref,
|
|
@@ -890,26 +892,13 @@ var RequiredAttributeField = ({
|
|
|
890
892
|
"products.create.attributes.enterValuePlaceholder"
|
|
891
893
|
)
|
|
892
894
|
}
|
|
893
|
-
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */
|
|
894
|
-
|
|
895
|
+
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
896
|
+
Switch,
|
|
895
897
|
{
|
|
896
898
|
...field,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
901
|
-
Select.Value,
|
|
902
|
-
{
|
|
903
|
-
placeholder: t(
|
|
904
|
-
"products.create.attributes.selectValuePlaceholder"
|
|
905
|
-
)
|
|
906
|
-
}
|
|
907
|
-
) }),
|
|
908
|
-
/* @__PURE__ */ jsxs2(Select.Content, { children: [
|
|
909
|
-
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "true", children: t("filters.radio.yes") }),
|
|
910
|
-
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "false", children: t("filters.radio.no") })
|
|
911
|
-
] })
|
|
912
|
-
]
|
|
899
|
+
className: "rtl:rotate-180",
|
|
900
|
+
checked: value === "true" || value === true,
|
|
901
|
+
onCheckedChange: (checked) => onChange(String(checked))
|
|
913
902
|
}
|
|
914
903
|
) : /* @__PURE__ */ jsx2(
|
|
915
904
|
Input,
|
|
@@ -934,8 +923,8 @@ var VariantAxisTip = ({ className }) => {
|
|
|
934
923
|
return /* @__PURE__ */ jsx2(
|
|
935
924
|
InlineTip,
|
|
936
925
|
{
|
|
937
|
-
label: t("products.create.attributes.tip"),
|
|
938
926
|
className,
|
|
927
|
+
label: t("products.create.attributes.tip"),
|
|
939
928
|
children: t("products.create.attributes.variantAxisTip")
|
|
940
929
|
}
|
|
941
930
|
);
|
|
@@ -948,8 +937,8 @@ Root._tabMeta = defineTabMeta({
|
|
|
948
937
|
var ProductCreateAttributesForm = Root;
|
|
949
938
|
|
|
950
939
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
951
|
-
import { Heading as
|
|
952
|
-
import { useTranslation as
|
|
940
|
+
import { Heading as Heading2 } from "@medusajs/ui";
|
|
941
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
953
942
|
|
|
954
943
|
// src/pages/products/create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
|
|
955
944
|
import { Input as Input2, Textarea as Textarea2 } from "@medusajs/ui";
|
|
@@ -1317,381 +1306,32 @@ function formatFileSize(bytes, decimalPlaces = 2) {
|
|
|
1317
1306
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
|
|
1318
1307
|
}
|
|
1319
1308
|
|
|
1320
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1321
|
-
import {
|
|
1322
|
-
Alert,
|
|
1323
|
-
Checkbox as Checkbox2,
|
|
1324
|
-
clx as clx3,
|
|
1325
|
-
Heading as Heading2,
|
|
1326
|
-
Hint as Hint2,
|
|
1327
|
-
InlineTip as InlineTip2,
|
|
1328
|
-
Label as Label2,
|
|
1329
|
-
Text as Text3
|
|
1330
|
-
} from "@medusajs/ui";
|
|
1331
|
-
import { useFieldArray as useFieldArray3, useWatch } from "react-hook-form";
|
|
1332
|
-
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1333
|
-
import { useMemo as useMemo3 } from "react";
|
|
1334
|
-
|
|
1335
|
-
// src/components/common/sortable-list/sortable-list.tsx
|
|
1336
|
-
import {
|
|
1337
|
-
DndContext as DndContext2,
|
|
1338
|
-
DragOverlay as DragOverlay2,
|
|
1339
|
-
KeyboardSensor as KeyboardSensor2,
|
|
1340
|
-
PointerSensor as PointerSensor2,
|
|
1341
|
-
defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
|
|
1342
|
-
useSensor as useSensor2,
|
|
1343
|
-
useSensors as useSensors2
|
|
1344
|
-
} from "@dnd-kit/core";
|
|
1345
|
-
import {
|
|
1346
|
-
SortableContext as SortableContext2,
|
|
1347
|
-
arrayMove as arrayMove2,
|
|
1348
|
-
sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
|
|
1349
|
-
useSortable as useSortable2
|
|
1350
|
-
} from "@dnd-kit/sortable";
|
|
1351
|
-
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
1352
|
-
import { DotsSix as DotsSix2 } from "@medusajs/icons";
|
|
1353
|
-
import { IconButton as IconButton3, clx as clx2 } from "@medusajs/ui";
|
|
1354
|
-
import {
|
|
1355
|
-
Fragment as Fragment2,
|
|
1356
|
-
createContext,
|
|
1357
|
-
useContext,
|
|
1358
|
-
useMemo as useMemo2,
|
|
1359
|
-
useState as useState3
|
|
1360
|
-
} from "react";
|
|
1361
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1362
|
-
var List = ({
|
|
1363
|
-
items,
|
|
1364
|
-
onChange,
|
|
1365
|
-
renderItem
|
|
1366
|
-
}) => {
|
|
1367
|
-
const [active, setActive] = useState3(null);
|
|
1368
|
-
const [activeItem, activeIndex] = useMemo2(() => {
|
|
1369
|
-
if (active === null) {
|
|
1370
|
-
return [null, null];
|
|
1371
|
-
}
|
|
1372
|
-
const index = items.findIndex(({ id }) => id === active.id);
|
|
1373
|
-
return [items[index], index];
|
|
1374
|
-
}, [active, items]);
|
|
1375
|
-
const sensors = useSensors2(
|
|
1376
|
-
useSensor2(PointerSensor2),
|
|
1377
|
-
useSensor2(KeyboardSensor2, {
|
|
1378
|
-
coordinateGetter: sortableKeyboardCoordinates2
|
|
1379
|
-
})
|
|
1380
|
-
);
|
|
1381
|
-
const handleDragStart = ({ active: active2 }) => {
|
|
1382
|
-
setActive(active2);
|
|
1383
|
-
};
|
|
1384
|
-
const handleDragEnd = ({ active: active2, over }) => {
|
|
1385
|
-
if (over && active2.id !== over.id) {
|
|
1386
|
-
const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
|
|
1387
|
-
const overIndex = items.findIndex(({ id }) => id === over.id);
|
|
1388
|
-
onChange(arrayMove2(items, activeIndex2, overIndex));
|
|
1389
|
-
}
|
|
1390
|
-
setActive(null);
|
|
1391
|
-
};
|
|
1392
|
-
const handleDragCancel = () => {
|
|
1393
|
-
setActive(null);
|
|
1394
|
-
};
|
|
1395
|
-
return /* @__PURE__ */ jsxs5(
|
|
1396
|
-
DndContext2,
|
|
1397
|
-
{
|
|
1398
|
-
sensors,
|
|
1399
|
-
onDragStart: handleDragStart,
|
|
1400
|
-
onDragEnd: handleDragEnd,
|
|
1401
|
-
onDragCancel: handleDragCancel,
|
|
1402
|
-
children: [
|
|
1403
|
-
/* @__PURE__ */ jsx5(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
|
|
1404
|
-
/* @__PURE__ */ jsx5(SortableContext2, { items, children: /* @__PURE__ */ jsx5(
|
|
1405
|
-
"ul",
|
|
1406
|
-
{
|
|
1407
|
-
role: "application",
|
|
1408
|
-
className: "flex list-inside list-none list-image-none flex-col p-0",
|
|
1409
|
-
children: items.map((item, index) => /* @__PURE__ */ jsx5(Fragment2, { children: renderItem(item, index) }, item.id))
|
|
1410
|
-
}
|
|
1411
|
-
) })
|
|
1412
|
-
]
|
|
1413
|
-
}
|
|
1414
|
-
);
|
|
1415
|
-
};
|
|
1416
|
-
var dropAnimationConfig2 = {
|
|
1417
|
-
sideEffects: defaultDropAnimationSideEffects2({
|
|
1418
|
-
styles: {
|
|
1419
|
-
active: {
|
|
1420
|
-
opacity: "0.4"
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
})
|
|
1424
|
-
};
|
|
1425
|
-
var Overlay = ({ children }) => {
|
|
1426
|
-
return /* @__PURE__ */ jsx5(
|
|
1427
|
-
DragOverlay2,
|
|
1428
|
-
{
|
|
1429
|
-
className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
|
|
1430
|
-
dropAnimation: dropAnimationConfig2,
|
|
1431
|
-
children
|
|
1432
|
-
}
|
|
1433
|
-
);
|
|
1434
|
-
};
|
|
1435
|
-
var SortableItemContext = createContext(null);
|
|
1436
|
-
var useSortableItemContext = () => {
|
|
1437
|
-
const context = useContext(SortableItemContext);
|
|
1438
|
-
if (!context) {
|
|
1439
|
-
throw new Error(
|
|
1440
|
-
"useSortableItemContext must be used within a SortableItemContext"
|
|
1441
|
-
);
|
|
1442
|
-
}
|
|
1443
|
-
return context;
|
|
1444
|
-
};
|
|
1445
|
-
var Item = ({
|
|
1446
|
-
id,
|
|
1447
|
-
className,
|
|
1448
|
-
children
|
|
1449
|
-
}) => {
|
|
1450
|
-
const {
|
|
1451
|
-
attributes,
|
|
1452
|
-
isDragging,
|
|
1453
|
-
listeners,
|
|
1454
|
-
setNodeRef,
|
|
1455
|
-
setActivatorNodeRef,
|
|
1456
|
-
transform,
|
|
1457
|
-
transition
|
|
1458
|
-
} = useSortable2({ id });
|
|
1459
|
-
const context = useMemo2(
|
|
1460
|
-
() => ({
|
|
1461
|
-
attributes,
|
|
1462
|
-
listeners,
|
|
1463
|
-
ref: setActivatorNodeRef,
|
|
1464
|
-
isDragging
|
|
1465
|
-
}),
|
|
1466
|
-
[attributes, listeners, setActivatorNodeRef, isDragging]
|
|
1467
|
-
);
|
|
1468
|
-
const style = {
|
|
1469
|
-
opacity: isDragging ? 0.4 : void 0,
|
|
1470
|
-
transform: CSS2.Translate.toString(transform),
|
|
1471
|
-
transition
|
|
1472
|
-
};
|
|
1473
|
-
return /* @__PURE__ */ jsx5(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx5(
|
|
1474
|
-
"li",
|
|
1475
|
-
{
|
|
1476
|
-
className: clx2("transition-fg flex flex-1 list-none", className),
|
|
1477
|
-
ref: setNodeRef,
|
|
1478
|
-
style,
|
|
1479
|
-
children
|
|
1480
|
-
}
|
|
1481
|
-
) });
|
|
1482
|
-
};
|
|
1483
|
-
var DragHandle = () => {
|
|
1484
|
-
const { attributes, listeners, ref } = useSortableItemContext();
|
|
1485
|
-
return /* @__PURE__ */ jsx5(
|
|
1486
|
-
IconButton3,
|
|
1487
|
-
{
|
|
1488
|
-
variant: "transparent",
|
|
1489
|
-
size: "small",
|
|
1490
|
-
...attributes,
|
|
1491
|
-
...listeners,
|
|
1492
|
-
ref,
|
|
1493
|
-
className: "cursor-grab touch-none active:cursor-grabbing",
|
|
1494
|
-
children: /* @__PURE__ */ jsx5(DotsSix2, { className: "text-ui-fg-muted" })
|
|
1495
|
-
}
|
|
1496
|
-
);
|
|
1497
|
-
};
|
|
1498
|
-
var SortableList = Object.assign(List, {
|
|
1499
|
-
Item,
|
|
1500
|
-
DragHandle
|
|
1501
|
-
});
|
|
1502
|
-
|
|
1503
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1504
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1505
|
-
var ProductCreateVariantsSection = () => {
|
|
1506
|
-
const form = useTabbedForm();
|
|
1507
|
-
const { t } = useTranslation5();
|
|
1508
|
-
const variants = useFieldArray3({
|
|
1509
|
-
control: form.control,
|
|
1510
|
-
name: "variants"
|
|
1511
|
-
});
|
|
1512
|
-
const watchedAttributes = useWatch({
|
|
1513
|
-
control: form.control,
|
|
1514
|
-
name: "attributes",
|
|
1515
|
-
defaultValue: []
|
|
1516
|
-
});
|
|
1517
|
-
const watchedVariants = useWatch({
|
|
1518
|
-
control: form.control,
|
|
1519
|
-
name: "variants",
|
|
1520
|
-
defaultValue: []
|
|
1521
|
-
});
|
|
1522
|
-
const variantAxes = useMemo3(() => {
|
|
1523
|
-
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants).map((attr) => ({
|
|
1524
|
-
title: attr.title,
|
|
1525
|
-
values: Array.isArray(attr.values) ? attr.values : attr.values ? [attr.values] : []
|
|
1526
|
-
})).filter((axis) => axis.title && axis.values.length > 0);
|
|
1527
|
-
}, [watchedAttributes]);
|
|
1528
|
-
const hasVariantAxes = variantAxes.length > 0;
|
|
1529
|
-
const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
|
|
1530
|
-
const handleRankChange = (items) => {
|
|
1531
|
-
const update = items.map((item, index) => {
|
|
1532
|
-
const variant = watchedVariants.find((v) => v.title === item.title);
|
|
1533
|
-
return {
|
|
1534
|
-
id: item.id,
|
|
1535
|
-
...variant || item,
|
|
1536
|
-
variant_rank: index
|
|
1537
|
-
};
|
|
1538
|
-
});
|
|
1539
|
-
variants.replace(update);
|
|
1540
|
-
};
|
|
1541
|
-
const getCheckboxState = (variants2) => {
|
|
1542
|
-
if (variants2.every((variant) => variant.should_create)) {
|
|
1543
|
-
return true;
|
|
1544
|
-
}
|
|
1545
|
-
if (variants2.some((variant) => variant.should_create)) {
|
|
1546
|
-
return "indeterminate";
|
|
1547
|
-
}
|
|
1548
|
-
return false;
|
|
1549
|
-
};
|
|
1550
|
-
const onCheckboxChange = (value) => {
|
|
1551
|
-
switch (value) {
|
|
1552
|
-
case true: {
|
|
1553
|
-
const update = watchedVariants.map((variant) => ({
|
|
1554
|
-
...variant,
|
|
1555
|
-
should_create: true
|
|
1556
|
-
}));
|
|
1557
|
-
form.setValue("variants", update);
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
case false: {
|
|
1561
|
-
const update = watchedVariants.map((variant) => ({
|
|
1562
|
-
...variant,
|
|
1563
|
-
should_create: false
|
|
1564
|
-
}));
|
|
1565
|
-
form.setValue("variants", decorateVariantsWithDefaultValues(update));
|
|
1566
|
-
break;
|
|
1567
|
-
}
|
|
1568
|
-
case "indeterminate":
|
|
1569
|
-
break;
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
if (!hasVariantAxes) {
|
|
1573
|
-
return null;
|
|
1574
|
-
}
|
|
1575
|
-
return /* @__PURE__ */ jsxs6(
|
|
1576
|
-
"div",
|
|
1577
|
-
{
|
|
1578
|
-
id: "variants",
|
|
1579
|
-
className: "flex flex-col gap-y-8",
|
|
1580
|
-
"data-testid": "product-create-variants-section",
|
|
1581
|
-
children: [
|
|
1582
|
-
/* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx6(Heading2, { level: "h2", children: t("products.create.variants.header") }) }),
|
|
1583
|
-
/* @__PURE__ */ jsx6("div", { className: "grid grid-cols-1 gap-x-4 gap-y-8", children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-y-6", children: [
|
|
1584
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
1585
|
-
/* @__PURE__ */ jsx6(Label2, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
|
|
1586
|
-
/* @__PURE__ */ jsx6(Hint2, { children: t("products.create.variants.productVariants.hint") })
|
|
1587
|
-
] }),
|
|
1588
|
-
showInvalidVariantsMessage && /* @__PURE__ */ jsx6(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.variants") }),
|
|
1589
|
-
variants.fields.length > 0 ? /* @__PURE__ */ jsxs6("div", { className: "overflow-hidden rounded-xl border", children: [
|
|
1590
|
-
/* @__PURE__ */ jsxs6(
|
|
1591
|
-
"div",
|
|
1592
|
-
{
|
|
1593
|
-
className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
|
|
1594
|
-
style: {
|
|
1595
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1596
|
-
},
|
|
1597
|
-
children: [
|
|
1598
|
-
/* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(
|
|
1599
|
-
Checkbox2,
|
|
1600
|
-
{
|
|
1601
|
-
className: "relative",
|
|
1602
|
-
checked: getCheckboxState(watchedVariants),
|
|
1603
|
-
onCheckedChange: onCheckboxChange
|
|
1604
|
-
}
|
|
1605
|
-
) }),
|
|
1606
|
-
/* @__PURE__ */ jsx6("div", {}),
|
|
1607
|
-
variantAxes.map((axis, index) => /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", weight: "plus", children: axis.title }) }, index))
|
|
1608
|
-
]
|
|
1609
|
-
}
|
|
1610
|
-
),
|
|
1611
|
-
/* @__PURE__ */ jsx6(
|
|
1612
|
-
SortableList,
|
|
1613
|
-
{
|
|
1614
|
-
items: variants.fields,
|
|
1615
|
-
onChange: handleRankChange,
|
|
1616
|
-
renderItem: (item, index) => {
|
|
1617
|
-
return /* @__PURE__ */ jsx6(
|
|
1618
|
-
SortableList.Item,
|
|
1619
|
-
{
|
|
1620
|
-
id: item.id,
|
|
1621
|
-
className: clx3("bg-ui-bg-base border-b", {
|
|
1622
|
-
"border-b-0": index === variants.fields.length - 1
|
|
1623
|
-
}),
|
|
1624
|
-
children: /* @__PURE__ */ jsxs6(
|
|
1625
|
-
"div",
|
|
1626
|
-
{
|
|
1627
|
-
className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
|
|
1628
|
-
style: {
|
|
1629
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1630
|
-
},
|
|
1631
|
-
children: [
|
|
1632
|
-
/* @__PURE__ */ jsx6(
|
|
1633
|
-
Form.Field,
|
|
1634
|
-
{
|
|
1635
|
-
control: form.control,
|
|
1636
|
-
name: `variants.${index}.should_create`,
|
|
1637
|
-
render: ({
|
|
1638
|
-
field: { value, onChange, ...field }
|
|
1639
|
-
}) => /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
|
|
1640
|
-
Checkbox2,
|
|
1641
|
-
{
|
|
1642
|
-
className: "relative",
|
|
1643
|
-
...field,
|
|
1644
|
-
checked: value,
|
|
1645
|
-
onCheckedChange: onChange
|
|
1646
|
-
}
|
|
1647
|
-
) }) })
|
|
1648
|
-
}
|
|
1649
|
-
),
|
|
1650
|
-
/* @__PURE__ */ jsx6(SortableList.DragHandle, {}),
|
|
1651
|
-
variantAxes.map((axis, i) => /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", children: item.options?.[axis.title] ?? "-" }, i))
|
|
1652
|
-
]
|
|
1653
|
-
}
|
|
1654
|
-
)
|
|
1655
|
-
}
|
|
1656
|
-
);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
)
|
|
1660
|
-
] }) : /* @__PURE__ */ jsx6(Alert, { children: t("products.create.variants.productVariants.alert") }),
|
|
1661
|
-
variants.fields.length > 0 && /* @__PURE__ */ jsx6(InlineTip2, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
|
|
1662
|
-
] }) })
|
|
1663
|
-
]
|
|
1664
|
-
}
|
|
1665
|
-
);
|
|
1666
|
-
};
|
|
1667
|
-
|
|
1668
1309
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
1669
|
-
import { jsx as
|
|
1310
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1670
1311
|
var Root2 = () => {
|
|
1671
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ jsx5(
|
|
1672
1313
|
"div",
|
|
1673
1314
|
{
|
|
1674
1315
|
className: "flex flex-col items-center p-16",
|
|
1675
1316
|
"data-testid": "product-create-details-form",
|
|
1676
|
-
children: /* @__PURE__ */
|
|
1317
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1677
1318
|
"div",
|
|
1678
1319
|
{
|
|
1679
1320
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1680
1321
|
"data-testid": "product-create-details-form-content",
|
|
1681
1322
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ jsx5(Header, {}),
|
|
1324
|
+
/* @__PURE__ */ jsxs5(
|
|
1684
1325
|
"div",
|
|
1685
1326
|
{
|
|
1686
1327
|
className: "flex flex-col gap-y-6",
|
|
1687
1328
|
"data-testid": "product-create-details-form-sections",
|
|
1688
1329
|
children: [
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
|
|
1331
|
+
/* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
|
|
1691
1332
|
]
|
|
1692
1333
|
}
|
|
1693
|
-
)
|
|
1694
|
-
/* @__PURE__ */ jsx7(ProductCreateVariantsSection, {})
|
|
1334
|
+
)
|
|
1695
1335
|
]
|
|
1696
1336
|
}
|
|
1697
1337
|
)
|
|
@@ -1705,24 +1345,24 @@ Root2._tabMeta = defineTabMeta({
|
|
|
1705
1345
|
});
|
|
1706
1346
|
var ProductCreateDetailsForm = Root2;
|
|
1707
1347
|
var Header = () => {
|
|
1708
|
-
const { t } =
|
|
1709
|
-
return /* @__PURE__ */
|
|
1348
|
+
const { t } = useTranslation5();
|
|
1349
|
+
return /* @__PURE__ */ jsx5(
|
|
1710
1350
|
"div",
|
|
1711
1351
|
{
|
|
1712
1352
|
className: "flex flex-col",
|
|
1713
1353
|
"data-testid": "product-create-details-form-header",
|
|
1714
|
-
children: /* @__PURE__ */
|
|
1354
|
+
children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
|
|
1715
1355
|
}
|
|
1716
1356
|
);
|
|
1717
1357
|
};
|
|
1718
1358
|
|
|
1719
1359
|
// src/pages/products/create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
|
|
1720
|
-
import { Heading as
|
|
1721
|
-
import { useTranslation as
|
|
1722
|
-
import { jsx as
|
|
1360
|
+
import { Heading as Heading3 } from "@medusajs/ui";
|
|
1361
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
1362
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1723
1363
|
var ProductCreateOrganizationSection = () => {
|
|
1724
1364
|
const form = useTabbedForm();
|
|
1725
|
-
const { t } =
|
|
1365
|
+
const { t } = useTranslation6();
|
|
1726
1366
|
const collections = useComboboxData({
|
|
1727
1367
|
queryKey: ["product_collections"],
|
|
1728
1368
|
queryFn: (params) => sdk.vendor.collections.query(params),
|
|
@@ -1747,9 +1387,9 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1747
1387
|
value: tag.id
|
|
1748
1388
|
}))
|
|
1749
1389
|
});
|
|
1750
|
-
return /* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1390
|
+
return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
|
|
1391
|
+
/* @__PURE__ */ jsx6(Heading3, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
|
|
1392
|
+
/* @__PURE__ */ jsx6(
|
|
1753
1393
|
SwitchBox,
|
|
1754
1394
|
{
|
|
1755
1395
|
control: form.control,
|
|
@@ -1759,15 +1399,15 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1759
1399
|
optional: true
|
|
1760
1400
|
}
|
|
1761
1401
|
),
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
/* @__PURE__ */
|
|
1402
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
|
|
1403
|
+
/* @__PURE__ */ jsx6(
|
|
1764
1404
|
Form.Field,
|
|
1765
1405
|
{
|
|
1766
1406
|
control: form.control,
|
|
1767
1407
|
name: "category_id",
|
|
1768
1408
|
render: ({ field }) => {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
|
|
1410
|
+
/* @__PURE__ */ jsx6(
|
|
1771
1411
|
Form.Label,
|
|
1772
1412
|
{
|
|
1773
1413
|
tooltip: t("products.fields.primaryCategory.tooltip"),
|
|
@@ -1775,21 +1415,21 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1775
1415
|
children: t("fields.category")
|
|
1776
1416
|
}
|
|
1777
1417
|
),
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx6(SingleCategoryCombobox, { ...field }) }),
|
|
1419
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1780
1420
|
] });
|
|
1781
1421
|
}
|
|
1782
1422
|
}
|
|
1783
1423
|
),
|
|
1784
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsx6(
|
|
1785
1425
|
Form.Field,
|
|
1786
1426
|
{
|
|
1787
1427
|
control: form.control,
|
|
1788
1428
|
name: "collection_id",
|
|
1789
1429
|
render: ({ field }) => {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
|
|
1431
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
|
|
1432
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx6(
|
|
1793
1433
|
Combobox,
|
|
1794
1434
|
{
|
|
1795
1435
|
...field,
|
|
@@ -1799,22 +1439,22 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1799
1439
|
fetchNextPage: collections.fetchNextPage
|
|
1800
1440
|
}
|
|
1801
1441
|
) }),
|
|
1802
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1803
1443
|
] });
|
|
1804
1444
|
}
|
|
1805
1445
|
}
|
|
1806
1446
|
)
|
|
1807
1447
|
] }),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
|
|
1449
|
+
/* @__PURE__ */ jsx6(
|
|
1810
1450
|
Form.Field,
|
|
1811
1451
|
{
|
|
1812
1452
|
control: form.control,
|
|
1813
1453
|
name: "type_id",
|
|
1814
1454
|
render: ({ field }) => {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
/* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
|
|
1456
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
|
|
1457
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx6(
|
|
1818
1458
|
Combobox,
|
|
1819
1459
|
{
|
|
1820
1460
|
...field,
|
|
@@ -1824,20 +1464,20 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1824
1464
|
fetchNextPage: types.fetchNextPage
|
|
1825
1465
|
}
|
|
1826
1466
|
) }),
|
|
1827
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1828
1468
|
] });
|
|
1829
1469
|
}
|
|
1830
1470
|
}
|
|
1831
1471
|
),
|
|
1832
|
-
/* @__PURE__ */
|
|
1472
|
+
/* @__PURE__ */ jsx6(
|
|
1833
1473
|
Form.Field,
|
|
1834
1474
|
{
|
|
1835
1475
|
control: form.control,
|
|
1836
1476
|
name: "tags",
|
|
1837
1477
|
render: ({ field }) => {
|
|
1838
|
-
return /* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
1478
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
|
|
1479
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
|
|
1480
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx6(
|
|
1841
1481
|
Combobox,
|
|
1842
1482
|
{
|
|
1843
1483
|
...field,
|
|
@@ -1847,7 +1487,7 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1847
1487
|
fetchNextPage: tags.fetchNextPage
|
|
1848
1488
|
}
|
|
1849
1489
|
) }),
|
|
1850
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1851
1491
|
] });
|
|
1852
1492
|
}
|
|
1853
1493
|
}
|
|
@@ -1857,19 +1497,19 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1857
1497
|
};
|
|
1858
1498
|
|
|
1859
1499
|
// src/pages/products/create/components/product-create-organize-form/product-create-organize-form.tsx
|
|
1860
|
-
import { jsx as
|
|
1500
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1861
1501
|
var Root3 = () => {
|
|
1862
|
-
return /* @__PURE__ */
|
|
1502
|
+
return /* @__PURE__ */ jsx7(
|
|
1863
1503
|
"div",
|
|
1864
1504
|
{
|
|
1865
1505
|
className: "flex flex-col items-center p-16",
|
|
1866
1506
|
"data-testid": "product-create-organize-form",
|
|
1867
|
-
children: /* @__PURE__ */
|
|
1507
|
+
children: /* @__PURE__ */ jsx7(
|
|
1868
1508
|
"div",
|
|
1869
1509
|
{
|
|
1870
1510
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1871
1511
|
"data-testid": "product-create-organize-form-content",
|
|
1872
|
-
children: /* @__PURE__ */
|
|
1512
|
+
children: /* @__PURE__ */ jsx7(ProductCreateOrganizationSection, {})
|
|
1873
1513
|
}
|
|
1874
1514
|
)
|
|
1875
1515
|
}
|
|
@@ -1896,30 +1536,33 @@ Root3._tabMeta = defineTabMeta({
|
|
|
1896
1536
|
var ProductCreateOrganizeForm = Root3;
|
|
1897
1537
|
|
|
1898
1538
|
// src/pages/products/create/components/product-create-variants-form/product-create-variants-form.tsx
|
|
1899
|
-
import {
|
|
1900
|
-
import {
|
|
1901
|
-
import {
|
|
1902
|
-
import {
|
|
1539
|
+
import { Input as Input3 } from "@medusajs/ui";
|
|
1540
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
1541
|
+
import { useWatch } from "react-hook-form";
|
|
1542
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1543
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1903
1544
|
var Root4 = () => {
|
|
1545
|
+
const { t } = useTranslation7();
|
|
1904
1546
|
const form = useTabbedForm();
|
|
1905
1547
|
const { setCloseOnEscape } = useRouteModal();
|
|
1906
|
-
const
|
|
1548
|
+
const [search, setSearch] = useState3("");
|
|
1549
|
+
const variants = useWatch({
|
|
1907
1550
|
control: form.control,
|
|
1908
1551
|
name: "variants",
|
|
1909
1552
|
defaultValue: []
|
|
1910
1553
|
});
|
|
1911
|
-
const watchedAttributes =
|
|
1554
|
+
const watchedAttributes = useWatch({
|
|
1912
1555
|
control: form.control,
|
|
1913
1556
|
name: "attributes",
|
|
1914
1557
|
defaultValue: []
|
|
1915
1558
|
});
|
|
1916
|
-
const variantAxes =
|
|
1559
|
+
const variantAxes = useMemo2(() => {
|
|
1917
1560
|
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants && attr.title).map((attr) => ({
|
|
1918
1561
|
title: attr.title
|
|
1919
1562
|
}));
|
|
1920
1563
|
}, [watchedAttributes]);
|
|
1921
1564
|
const columns = useColumns2({ variantAxes });
|
|
1922
|
-
const variantData =
|
|
1565
|
+
const variantData = useMemo2(() => {
|
|
1923
1566
|
const ret = [];
|
|
1924
1567
|
variants.forEach((v, i) => {
|
|
1925
1568
|
if (v.should_create) {
|
|
@@ -1928,20 +1571,56 @@ var Root4 = () => {
|
|
|
1928
1571
|
});
|
|
1929
1572
|
return ret;
|
|
1930
1573
|
}, [variants]);
|
|
1931
|
-
|
|
1574
|
+
const filteredVariantData = useMemo2(() => {
|
|
1575
|
+
const query = search.trim().toLowerCase();
|
|
1576
|
+
if (!query) {
|
|
1577
|
+
return variantData;
|
|
1578
|
+
}
|
|
1579
|
+
return variantData.filter((variant) => {
|
|
1580
|
+
const haystack = [
|
|
1581
|
+
variant.title,
|
|
1582
|
+
variant.sku,
|
|
1583
|
+
...Object.values(variant.options ?? {})
|
|
1584
|
+
];
|
|
1585
|
+
return haystack.some((value) => value?.toLowerCase().includes(query));
|
|
1586
|
+
});
|
|
1587
|
+
}, [variantData, search]);
|
|
1588
|
+
const headerContent = /* @__PURE__ */ jsx8(
|
|
1589
|
+
Input3,
|
|
1590
|
+
{
|
|
1591
|
+
type: "search",
|
|
1592
|
+
size: "small",
|
|
1593
|
+
autoComplete: "off",
|
|
1594
|
+
value: search,
|
|
1595
|
+
onChange: (event) => setSearch(event.target.value),
|
|
1596
|
+
placeholder: t(
|
|
1597
|
+
"products.create.variants.productVariants.searchPlaceholder"
|
|
1598
|
+
),
|
|
1599
|
+
"data-testid": "product-create-variants-search-input"
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
return /* @__PURE__ */ jsx8(
|
|
1932
1603
|
"div",
|
|
1933
1604
|
{
|
|
1934
1605
|
className: "flex size-full flex-col divide-y overflow-hidden",
|
|
1935
1606
|
"data-testid": "product-create-variants-form",
|
|
1936
|
-
children: /* @__PURE__ */
|
|
1937
|
-
|
|
1607
|
+
children: /* @__PURE__ */ jsx8(
|
|
1608
|
+
"div",
|
|
1938
1609
|
{
|
|
1939
|
-
|
|
1940
|
-
data:
|
|
1941
|
-
|
|
1942
|
-
|
|
1610
|
+
className: "min-h-0 flex-1 overflow-hidden",
|
|
1611
|
+
"data-testid": "product-create-variants-form-datagrid",
|
|
1612
|
+
children: /* @__PURE__ */ jsx8(
|
|
1613
|
+
DataGrid,
|
|
1614
|
+
{
|
|
1615
|
+
columns,
|
|
1616
|
+
data: filteredVariantData,
|
|
1617
|
+
state: form,
|
|
1618
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing),
|
|
1619
|
+
headerContent
|
|
1620
|
+
}
|
|
1621
|
+
)
|
|
1943
1622
|
}
|
|
1944
|
-
)
|
|
1623
|
+
)
|
|
1945
1624
|
}
|
|
1946
1625
|
);
|
|
1947
1626
|
};
|
|
@@ -1955,14 +1634,14 @@ var columnHelper2 = createDataGridHelper();
|
|
|
1955
1634
|
var useColumns2 = ({
|
|
1956
1635
|
variantAxes
|
|
1957
1636
|
}) => {
|
|
1958
|
-
const { t } =
|
|
1959
|
-
return
|
|
1637
|
+
const { t } = useTranslation7();
|
|
1638
|
+
return useMemo2(
|
|
1960
1639
|
() => [
|
|
1961
1640
|
columnHelper2.column({
|
|
1962
1641
|
id: "attributes",
|
|
1963
|
-
header: () => /* @__PURE__ */
|
|
1642
|
+
header: () => /* @__PURE__ */ jsx8("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx8("span", { className: "truncate", children: variantAxes.map((a) => a.title).join(" / ") }) }),
|
|
1964
1643
|
cell: (context) => {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ jsx8(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
|
|
1966
1645
|
},
|
|
1967
1646
|
disableHiding: true
|
|
1968
1647
|
}),
|
|
@@ -1973,7 +1652,7 @@ var useColumns2 = ({
|
|
|
1973
1652
|
field: (context) => `variants.${context.row.original.originalIndex}.title`,
|
|
1974
1653
|
type: "text",
|
|
1975
1654
|
cell: (context) => {
|
|
1976
|
-
return /* @__PURE__ */
|
|
1655
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1977
1656
|
}
|
|
1978
1657
|
}),
|
|
1979
1658
|
columnHelper2.column({
|
|
@@ -1983,7 +1662,7 @@ var useColumns2 = ({
|
|
|
1983
1662
|
field: (context) => `variants.${context.row.original.originalIndex}.sku`,
|
|
1984
1663
|
type: "text",
|
|
1985
1664
|
cell: (context) => {
|
|
1986
|
-
return /* @__PURE__ */
|
|
1665
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1987
1666
|
}
|
|
1988
1667
|
})
|
|
1989
1668
|
],
|
|
@@ -1992,13 +1671,13 @@ var useColumns2 = ({
|
|
|
1992
1671
|
};
|
|
1993
1672
|
|
|
1994
1673
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
1995
|
-
import { jsx as
|
|
1674
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1996
1675
|
var ProductCreateForm = ({
|
|
1997
1676
|
children,
|
|
1998
1677
|
schema,
|
|
1999
1678
|
defaultValues: extraDefaults
|
|
2000
1679
|
}) => {
|
|
2001
|
-
const { t } =
|
|
1680
|
+
const { t } = useTranslation8();
|
|
2002
1681
|
const { handleSuccess } = useRouteModal();
|
|
2003
1682
|
const form = useForm({
|
|
2004
1683
|
defaultValues: {
|
|
@@ -2010,7 +1689,7 @@ var ProductCreateForm = ({
|
|
|
2010
1689
|
const { mutateAsync, isPending } = useCreateProduct();
|
|
2011
1690
|
const { feature_flags } = useFeatureFlags();
|
|
2012
1691
|
const productRequestEnabled = !!feature_flags?.[import_types6.MercurFeatureFlags.PRODUCT_REQUEST];
|
|
2013
|
-
const watchedAttributes =
|
|
1692
|
+
const watchedAttributes = useWatch2({
|
|
2014
1693
|
control: form.control,
|
|
2015
1694
|
name: "attributes"
|
|
2016
1695
|
});
|
|
@@ -2023,7 +1702,7 @@ var ProductCreateForm = ({
|
|
|
2023
1702
|
if (JSON.stringify(newVariants.map((v) => v.options)) !== JSON.stringify(currentVariants.map((v) => v.options))) {
|
|
2024
1703
|
form.setValue("variants", newVariants);
|
|
2025
1704
|
}
|
|
2026
|
-
}, [watchedAttributes]);
|
|
1705
|
+
}, [watchedAttributes, form]);
|
|
2027
1706
|
const submitProduct = async (values, isDraftSubmission) => {
|
|
2028
1707
|
const media = values.media || [];
|
|
2029
1708
|
const payload = { ...values, media: void 0 };
|
|
@@ -2031,9 +1710,9 @@ var ProductCreateForm = ({
|
|
|
2031
1710
|
try {
|
|
2032
1711
|
const filesToUpload = media.map((m, i) => ({ file: m.file, isThumbnail: m.isThumbnail, index: i })).filter((m) => !!m.file);
|
|
2033
1712
|
if (filesToUpload.length) {
|
|
2034
|
-
const result = await
|
|
2035
|
-
filesToUpload.map(({ file }) =>
|
|
2036
|
-
);
|
|
1713
|
+
const result = await sdk.vendor.uploads.mutate({
|
|
1714
|
+
files: filesToUpload.map(({ file }) => file)
|
|
1715
|
+
});
|
|
2037
1716
|
const uploadedFiles = result?.files ?? [];
|
|
2038
1717
|
uploadedMedia = uploadedFiles.map((file, i) => ({
|
|
2039
1718
|
...file,
|
|
@@ -2081,29 +1760,31 @@ var ProductCreateForm = ({
|
|
|
2081
1760
|
}
|
|
2082
1761
|
await submitProduct(form.getValues(), true);
|
|
2083
1762
|
};
|
|
2084
|
-
const defaultTabs =
|
|
1763
|
+
const defaultTabs = useMemo3(
|
|
2085
1764
|
() => [
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
1765
|
+
/* @__PURE__ */ jsx9(ProductCreateDetailsForm, {}, "details"),
|
|
1766
|
+
/* @__PURE__ */ jsx9(ProductCreateOrganizeForm, {}, "organize"),
|
|
1767
|
+
/* @__PURE__ */ jsx9(ProductCreateAttributesForm, {}, "attributes"),
|
|
1768
|
+
/* @__PURE__ */ jsx9(ProductCreateVariantsForm, {}, "variants")
|
|
2090
1769
|
],
|
|
2091
1770
|
[]
|
|
2092
1771
|
);
|
|
2093
1772
|
const hasCustomChildren = Children.count(children) > 0;
|
|
2094
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ jsx9(
|
|
2095
1774
|
TabbedForm,
|
|
2096
1775
|
{
|
|
1776
|
+
model: "product",
|
|
1777
|
+
zone: "create",
|
|
2097
1778
|
form,
|
|
2098
1779
|
onSubmit: handleSubmit,
|
|
2099
1780
|
isLoading: isPending,
|
|
2100
|
-
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */
|
|
1781
|
+
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs7(
|
|
2101
1782
|
"div",
|
|
2102
1783
|
{
|
|
2103
1784
|
className: "flex items-center justify-end gap-x-2",
|
|
2104
1785
|
"data-testid": "product-create-form-footer-actions",
|
|
2105
1786
|
children: [
|
|
2106
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx9(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
2107
1788
|
Button3,
|
|
2108
1789
|
{
|
|
2109
1790
|
variant: "secondary",
|
|
@@ -2112,7 +1793,7 @@ var ProductCreateForm = ({
|
|
|
2112
1793
|
children: t("actions.cancel")
|
|
2113
1794
|
}
|
|
2114
1795
|
) }),
|
|
2115
|
-
/* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsx9(
|
|
2116
1797
|
Button3,
|
|
2117
1798
|
{
|
|
2118
1799
|
variant: "secondary",
|
|
@@ -2125,7 +1806,7 @@ var ProductCreateForm = ({
|
|
|
2125
1806
|
children: t("actions.saveAsDraft")
|
|
2126
1807
|
}
|
|
2127
1808
|
),
|
|
2128
|
-
isLastTab ? /* @__PURE__ */
|
|
1809
|
+
isLastTab ? /* @__PURE__ */ jsx9(
|
|
2129
1810
|
Button3,
|
|
2130
1811
|
{
|
|
2131
1812
|
"data-name": "publish-button",
|
|
@@ -2137,7 +1818,7 @@ var ProductCreateForm = ({
|
|
|
2137
1818
|
children: t("actions.publish")
|
|
2138
1819
|
},
|
|
2139
1820
|
"submit-button"
|
|
2140
|
-
) : /* @__PURE__ */
|
|
1821
|
+
) : /* @__PURE__ */ jsx9(
|
|
2141
1822
|
Button3,
|
|
2142
1823
|
{
|
|
2143
1824
|
type: "button",
|
|
@@ -2158,13 +1839,13 @@ var ProductCreateForm = ({
|
|
|
2158
1839
|
};
|
|
2159
1840
|
|
|
2160
1841
|
// src/pages/products/create/product-create.tsx
|
|
2161
|
-
import { jsx as
|
|
1842
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2162
1843
|
var Root5 = ({ children }) => {
|
|
2163
|
-
const { t } =
|
|
2164
|
-
return /* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
Children2.count(children) > 0 ? children : /* @__PURE__ */
|
|
1844
|
+
const { t } = useTranslation9();
|
|
1845
|
+
return /* @__PURE__ */ jsxs8(RouteFocusModal, { children: [
|
|
1846
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.title") }) }),
|
|
1847
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.description") }) }),
|
|
1848
|
+
Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx10(ProductCreateForm, {})
|
|
2168
1849
|
] });
|
|
2169
1850
|
};
|
|
2170
1851
|
var ProductCreate = Root5;
|