@mercurjs/vendor 2.2.0-canary.8 → 2.2.0-rc.0
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]-GMJAPZPU.js → [id]-3LNKC5OJ.js} +41 -40
- package/dist/[id]-4HO4S2PX.js +3074 -0
- package/dist/{[id]-QWL6SUOB.js → [id]-4LIIFGET.js} +14 -14
- package/dist/{[id]-5ADOHZ45.js → [id]-5EECCIRP.js} +151 -58
- package/dist/{[id]-K2CT7BXQ.js → [id]-5P5LTATX.js} +3 -3
- package/dist/{[id]-T7USGHIY.js → [id]-AQUUZFRX.js} +11 -11
- package/dist/{[id]-BTGQJ3UD.js → [id]-CUBGVODE.js} +177 -85
- package/dist/{[id]-ZAQYATGN.js → [id]-DCGPICT3.js} +39 -38
- package/dist/{[id]-IWCWVNVI.js → [id]-DT5YJVKG.js} +32 -32
- package/dist/{[id]-L6FD7BRE.js → [id]-IEBZ6V3W.js} +51 -48
- package/dist/{[id]-ZCMSBEVM.js → [id]-N7JEZFXQ.js} +6 -6
- package/dist/[id]-U6FKX5UQ.js +975 -0
- package/dist/{[id]-BPAZLOLW.js → [id]-XB45DY2D.js} +19 -19
- package/dist/[id]-XP5KEMNX.js +602 -0
- package/dist/{[location_id]-NUBXDDJC.js → [location_id]-I4HHUHWY.js} +14 -14
- package/dist/{[province_id]-5KZGMQER.js → [province_id]-OYX4MOCF.js} +31 -31
- package/dist/{add-KMHJ6OC6.js → add-3T4GBFMM.js} +63 -57
- package/dist/{add-Y6GMGLYX.js → add-RPRJWCYU.js} +99 -34
- package/dist/{add-customer-groups-NXSWICFI.js → add-customer-groups-FB5T6PQN.js} +44 -42
- package/dist/{add-products-LXYF57BK.js → add-products-F243SWGD.js} +40 -40
- package/dist/{add-promotions-VTYAEDCN.js → add-promotions-TJDK7HLW.js} +18 -18
- package/dist/{add-to-campaign-DLP7PSQB.js → add-to-campaign-Q6OAJMUJ.js} +6 -6
- package/dist/{address-JFXH3M7D.js → address-XVBSNMFU.js} +24 -24
- package/dist/{adjust-inventory-V2V7NWWH.js → adjust-inventory-IZLRMQXV.js} +4 -4
- package/dist/allocate-items-Q3VALDYT.js +685 -0
- package/dist/{areas-FB63OQAI.js → areas-IYGBRCRH.js} +14 -14
- package/dist/attributes-LGEM2JJW.js +353 -0
- package/dist/breadcrumb-BC6XN2SE.js +13 -0
- package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-BFNJWOJ4.js} +10 -9
- package/dist/{breadcrumb-S4V7MJUM.js → breadcrumb-BXD3SRM7.js} +3 -3
- package/dist/{breadcrumb-HV67K43U.js → breadcrumb-FEYGZFJU.js} +4 -4
- package/dist/{breadcrumb-EG3ANCVO.js → breadcrumb-H45Z2WNG.js} +3 -3
- package/dist/breadcrumb-ILEAQRW7.js +33 -0
- package/dist/breadcrumb-K4HBKZUE.js +28 -0
- package/dist/{breadcrumb-YBBYFQYG.js → breadcrumb-KZPOPXGG.js} +2 -2
- package/dist/{breadcrumb-F3BN5753.js → breadcrumb-L262VPBO.js} +2 -2
- package/dist/{breadcrumb-3Z7KZG62.js → breadcrumb-LEFHXFLT.js} +3 -3
- package/dist/{breadcrumb-D3UDTWGE.js → breadcrumb-MOA2DBOE.js} +2 -2
- package/dist/breadcrumb-NZYOCEEM.js +47 -0
- package/dist/breadcrumb-VY5DNTTJ.js +46 -0
- package/dist/{breadcrumb-UAUX7XCV.js → breadcrumb-WG6TIF4C.js} +2 -2
- package/dist/{breadcrumb-7R6E6G2X.js → breadcrumb-XEZCMI55.js} +2 -2
- package/dist/{breadcrumb-FES7EKUR.js → breadcrumb-XGXKCDYS.js} +4 -4
- package/dist/{breadcrumb-Y5UW3I4C.js → breadcrumb-YOY6Z36F.js} +2 -2
- package/dist/{campaigns-JAQTSA4Z.js → campaigns-DZKRNCA4.js} +9 -9
- package/dist/{categories-6TVMTN62.js → categories-JZJA2IBQ.js} +13 -11
- package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
- package/dist/{chunk-U5XDKYZG.js → chunk-2KA4TGBQ.js} +3 -3
- package/dist/{chunk-6RH3VDF7.js → chunk-2NPD4S55.js} +4 -4
- package/dist/{chunk-M6GKMFTC.js → chunk-3ALBZK4M.js} +1 -1
- package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
- package/dist/{chunk-X4INVIWL.js → chunk-3C2T27YW.js} +3 -3
- package/dist/{chunk-QXLRABYH.js → chunk-3I6ZAMGN.js} +1 -1
- package/dist/{chunk-THMXGEZU.js → chunk-3SH24DGG.js} +2 -2
- package/dist/chunk-3TST3EWQ.js +438 -0
- package/dist/chunk-42R54Z2X.js +8 -0
- package/dist/{chunk-UDJ2I5A2.js → chunk-4IRQSBA7.js} +5 -6
- package/dist/chunk-5ALC4Z2H.js +23 -0
- package/dist/chunk-5BQO3YQP.js +62 -0
- package/dist/{chunk-QGGMG3OU.js → chunk-5BYYDBLS.js} +7 -7
- package/dist/{chunk-4LVP635F.js → chunk-5FBQOAXU.js} +135 -126
- package/dist/{chunk-2BCAQ4BB.js → chunk-5PAUN3PM.js} +3 -3
- package/dist/{chunk-E2HQPY32.js → chunk-5RMLLTR7.js} +5 -5
- package/dist/{chunk-3EF54XFY.js → chunk-634XVU3D.js} +1 -1
- package/dist/{chunk-LJO34DKJ.js → chunk-6FDPVW7Y.js} +35 -21
- package/dist/{chunk-3X3LUKDM.js → chunk-6Q3J6ZMM.js} +5 -5
- package/dist/chunk-7BFQKYCJ.js +127 -0
- package/dist/chunk-7EXKHL5L.js +30 -0
- package/dist/{chunk-M6N4ISXL.js → chunk-7MARNXFG.js} +1 -1
- package/dist/{chunk-WHSE47DM.js → chunk-AOLE7MBM.js} +1 -1
- package/dist/{chunk-YIZK67RW.js → chunk-BQHVM46E.js} +29 -49
- package/dist/chunk-CRYZK4NU.js +185 -0
- package/dist/{chunk-JYPPXAJG.js → chunk-CUAGC54B.js} +33 -35
- package/dist/{chunk-KIFSQOM2.js → chunk-D76WZZSB.js} +5 -5
- package/dist/{chunk-QLBIBLOY.js → chunk-DQ7LZZJX.js} +5 -5
- package/dist/{chunk-UCYSCKZV.js → chunk-DSTHXHJ5.js} +2114 -1699
- package/dist/{chunk-L7QKFC5N.js → chunk-E6W57UP3.js} +32 -122
- package/dist/{chunk-UFFVRF4V.js → chunk-EAAZV3B7.js} +6 -11
- package/dist/chunk-EDV4MTTT.js +434 -0
- package/dist/chunk-EEBJYXWA.js +15 -0
- package/dist/{chunk-UORPTGV2.js → chunk-EPRYM3FA.js} +11 -15
- package/dist/{chunk-YQYRAD5C.js → chunk-FCZJAYMM.js} +1 -1
- package/dist/{chunk-JMRWREVE.js → chunk-FDKFUIYV.js} +23 -36
- package/dist/chunk-FWPGOIFA.js +22 -0
- package/dist/{chunk-B234IELY.js → chunk-G6YNCIVF.js} +24 -41
- package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
- package/dist/chunk-GSH6ZGI6.js +353 -0
- package/dist/{chunk-IQWK723D.js → chunk-GZ4KTAWS.js} +1 -1
- package/dist/{chunk-MJCL3WID.js → chunk-H6LZ77GX.js} +1 -1
- package/dist/{chunk-WLT7K7K7.js → chunk-HDEOZN2Q.js} +21 -24
- package/dist/{chunk-FDR22JMM.js → chunk-HFRHHT36.js} +8 -63
- package/dist/{chunk-GNDFMMC6.js → chunk-IEVN722X.js} +1 -1
- package/dist/{chunk-DARJTN4I.js → chunk-IMJ62GAP.js} +10 -5
- package/dist/{chunk-SGR4DMCW.js → chunk-INYLPVCG.js} +3 -3
- package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
- package/dist/chunk-J6XCRFBW.js +30 -0
- package/dist/{chunk-BLRZB63H.js → chunk-JDNXS37G.js} +61 -62
- package/dist/{chunk-3B34B2M2.js → chunk-JJP6AKMV.js} +1 -1
- package/dist/{chunk-XEU5ZLSB.js → chunk-JK4M3ZKY.js} +5 -5
- package/dist/{chunk-VXMOPVRH.js → chunk-JR7AABT5.js} +2 -2
- package/dist/{chunk-PBD36EZJ.js → chunk-JTHDMXZV.js} +5 -5
- package/dist/{chunk-Q75AC3DZ.js → chunk-JY2XON7H.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-VPKMBJ5B.js → chunk-KG2NUK4J.js} +6 -6
- package/dist/{chunk-VXWN37PT.js → chunk-KIURBTC4.js} +1 -1
- package/dist/{chunk-7LVNAFEI.js → chunk-KTJLJTFO.js} +547 -882
- package/dist/{chunk-FCJ7MLQK.js → chunk-KZQFIPY2.js} +264 -76
- package/dist/chunk-L57USMYC.js +39 -0
- package/dist/{chunk-4KNL46BT.js → chunk-LWFBBTJ3.js} +5 -5
- package/dist/{chunk-RIN4CBRB.js → chunk-LXZXXOJ3.js} +1 -17
- package/dist/chunk-LYYM7H7H.js +59 -0
- package/dist/{chunk-MWQQVKRU.js → chunk-MAVQ636Y.js} +1 -1
- package/dist/{chunk-VDHW6H5F.js → chunk-MAW6ZT3D.js} +4 -4
- package/dist/{chunk-7CMRFP5Q.js → chunk-MJP5V3JN.js} +3 -3
- package/dist/{chunk-S7EKBD2C.js → chunk-MNHP6YRC.js} +3 -3
- package/dist/{chunk-QZJIDKQR.js → chunk-MT6WOKIW.js} +4 -4
- package/dist/chunk-MUGQQY6P.js +315 -0
- package/dist/{chunk-QT7YFHCA.js → chunk-MVEHWM7K.js} +13 -1
- package/dist/{chunk-VV6IKGCN.js → chunk-NTJ3BMOE.js} +1 -1
- package/dist/{chunk-JXQJQYGD.js → chunk-O7BGGWW6.js} +2 -2
- package/dist/{chunk-LWJF63JW.js → chunk-OYUJYPDF.js} +90 -15
- package/dist/{chunk-4S6XGIC6.js → chunk-PUAWN7SS.js} +1 -1
- package/dist/{chunk-U6PBLMXD.js → chunk-Q6SPIHFR.js} +8 -3
- package/dist/{chunk-F4OJN2F2.js → chunk-QIF4QE7T.js} +1 -1
- package/dist/{chunk-X22KTLZ7.js → chunk-QWJTJSIT.js} +1 -1
- package/dist/{chunk-2USXZSTK.js → chunk-QWW6RHZC.js} +5 -5
- package/dist/{chunk-TODJFRLH.js → chunk-RILHLBKW.js} +3 -3
- package/dist/{chunk-PP754CO7.js → chunk-RPU4UOQK.js} +1 -1
- package/dist/{chunk-AVOZ7TX2.js → chunk-RTMMO6IU.js} +6 -6
- package/dist/chunk-S7NGDLZ3.js +173 -0
- package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
- package/dist/chunk-SPFLYPY6.js +6 -0
- package/dist/{chunk-EIUYXS7E.js → chunk-TJKZ5QCJ.js} +4 -4
- package/dist/{chunk-WCSQDWMS.js → chunk-TPGIMZLI.js} +1 -1
- package/dist/chunk-UM7ZR3VU.js +14 -0
- package/dist/{chunk-PGW3VYK4.js → chunk-UNE4VD5U.js} +3 -3
- package/dist/chunk-UX5UYDCY.js +33 -0
- package/dist/{chunk-IXAQNTE7.js → chunk-V5K6HISS.js} +2 -2
- package/dist/chunk-VCUUITW6.js +35 -0
- package/dist/{chunk-T5MJWWDX.js → chunk-VD27SL7H.js} +5 -5
- package/dist/{chunk-LRARA622.js → chunk-VE6GRIIN.js} +2 -2
- package/dist/{chunk-SSUUT5LK.js → chunk-W3UHAQCV.js} +5 -4
- package/dist/{chunk-U5G3AVED.js → chunk-WBCWER26.js} +1 -1
- package/dist/{chunk-PXI47JL5.js → chunk-WCXFUBEF.js} +13 -13
- package/dist/{chunk-AVOIZO63.js → chunk-WFE6CT6M.js} +77 -21
- package/dist/{chunk-E2L5EX5A.js → chunk-WFHGJGCW.js} +7 -6
- package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
- package/dist/{chunk-6YA3C4NB.js → chunk-XBKWFLJG.js} +4 -13
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/{chunk-SS46VQJA.js → chunk-Y4PM3IDZ.js} +1 -1
- package/dist/chunk-YBF45CX5.js +23 -0
- package/dist/{chunk-JQV7CXEC.js → chunk-YNGA3GRX.js} +17 -2
- package/dist/chunk-ZHFFTT3I.js +17 -0
- package/dist/{chunk-BOZJOOGW.js → chunk-ZLHCZ5F2.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/{chunk-ADGVQVHP.js → chunk-ZTOYVPGA.js} +3 -3
- package/dist/collections-XIHCTMSJ.js +70 -0
- package/dist/{configuration-C4IGBNXH.js → configuration-3GCBMM27.js} +3 -3
- package/dist/{configuration-JI22M76Z.js → configuration-FWZTMYXY.js} +5 -5
- package/dist/{create-OXR7WG5F.js → create-2RGNAVVY.js} +32 -32
- package/dist/{create-5QLYFVEK.js → create-32MXB6FD.js} +24 -24
- package/dist/create-3AMFYYI6.js +245 -0
- package/dist/create-AMNH3WXL.js +75 -0
- package/dist/{create-UPYB65PD.js → create-BV3QDTK2.js} +4 -4
- package/dist/{create-POK6SJSZ.js → create-FHIFVCSG.js} +52 -49
- package/dist/{create-EATFT5AB.js → create-GO7APBBU.js} +31 -31
- package/dist/create-HEZYB7RF.js +1179 -0
- package/dist/{create-R7K3ECN6.js → create-K26SM34L.js} +3 -3
- package/dist/{create-6I43IPLO.js → create-N534JQPH.js} +14 -14
- package/dist/create-NEK6JCKR.js +1798 -0
- package/dist/{create-YBF4YGWG.js → create-NF2LPVXA.js} +3 -3
- package/dist/{create-F7IDSSTP.js → create-PJVLJ7T6.js} +50 -45
- package/dist/{create-CK4X357V.js → create-RPBHXU32.js} +28 -28
- package/dist/{create-SFU3W3ZH.js → create-U64NEOEL.js} +3 -3
- package/dist/create-VL7LDTVE.js +1931 -0
- package/dist/{create-XVHOCZHJ.js → create-X5SOAPD3.js} +3 -3
- package/dist/{create-2XZLOG5Z.js → create-XLYGW5PN.js} +69 -41
- package/dist/{create-GB3ZA4LH.js → create-YKYLCEAK.js} +6 -6
- package/dist/customer-group-add-customers-2C53NFBJ.js +251 -0
- package/dist/customer-group-create-75QQEQZF.js +147 -0
- package/dist/customer-group-detail-AOQYYAOG.js +58 -0
- package/dist/customer-group-edit-N77RCW6I.js +138 -0
- package/dist/customer-groups-GNFV7VMT.js +284 -0
- package/dist/{customers-SOLJ2KQQ.js → customers-HNINO6YL.js} +11 -11
- package/dist/{edit-TZ4EXLKJ.js → edit-3DUCWSLA.js} +62 -46
- package/dist/{edit-ORXS3A2Y.js → edit-3V34KJS2.js} +3 -3
- package/dist/{edit-RJ3EZ5CD.js → edit-4PWAJ7A3.js} +25 -25
- package/dist/{edit-ZQP4MNJU.js → edit-7CLOJ3UZ.js} +50 -47
- package/dist/{edit-ZAHCMF5U.js → edit-7SBPHN6P.js} +3 -3
- package/dist/edit-BSD6667Q.js +367 -0
- package/dist/{edit-Q3UQIOLS.js → edit-I2RJUPWV.js} +4 -4
- package/dist/{edit-UUP3BQV3.js → edit-IJ6DCBUU.js} +5 -5
- package/dist/{edit-ZMERG3L7.js → edit-JB7KVBOL.js} +5 -5
- package/dist/{edit-O4JLGKQR.js → edit-NHQJLCAK.js} +4 -4
- package/dist/edit-O65JD54W.js +103 -0
- package/dist/{edit-4OEBCCXJ.js → edit-SIKOSSHF.js} +24 -24
- package/dist/edit-TD7QFM4Z.js +871 -0
- package/dist/{edit-C4OCKQVU.js → edit-UNN3QTEJ.js} +3 -3
- package/dist/{edit-PFAJZUWI.js → edit-WEUFBORT.js} +33 -34
- package/dist/{edit-KAKVPHZZ.js → edit-WN2Q3TOX.js} +4 -4
- package/dist/{edit-QPPMI7MU.js → edit-ZGAOUZYP.js} +33 -34
- package/dist/{edit-522DG3BY.js → edit-ZOLSAIKF.js} +3 -3
- package/dist/{edit-2LGAEKH6.js → edit-ZORE6RUD.js} +25 -25
- package/dist/{edit-budget-L3CCEWNF.js → edit-budget-D22WMVYR.js} +3 -3
- package/dist/{edit-inventory-item-A7KAPATR.js → edit-inventory-item-QMYWEBZ3.js} +3 -3
- package/dist/{edit-inventory-item-attributes-RNBOJR66.js → edit-inventory-item-attributes-HLG6JR6S.js} +3 -3
- package/dist/edit-price-F7ZWM3FN.js +197 -0
- package/dist/edit-stock-ITAZNHPU.js +230 -0
- package/dist/fulfillment-U2GRQ6DD.js +641 -0
- package/dist/{fulfillment-providers-6WDXCGAI.js → fulfillment-providers-CMU2JB5X.js} +40 -40
- package/dist/index.css +120 -24
- package/dist/index.js +355 -235
- package/dist/{offer-inventory-batch-page-4QNXDUWN.js → inventory-4JKLAZ2Q.js} +20 -20
- package/dist/{inventory-IOVM7GDU.js → inventory-FKEXULLT.js} +10 -10
- package/dist/{invite-HRKSQI4B.js → invite-3R2CEWLN.js} +23 -23
- package/dist/{invite-UBH7PYSH.js → invite-MNAX6EUC.js} +39 -39
- package/dist/loader-HTPUNIOS.js +34 -0
- package/dist/loader-MAAMUP2Z.js +33 -0
- package/dist/{locations-INS6FTMJ.js → locations-2VWSMWHL.js} +3 -3
- package/dist/login-YUWOWICV.js +39 -0
- package/dist/{manage-locations-TIYOCOZU.js → manage-locations-RWGDXXJQ.js} +3 -3
- package/dist/{media-EXWUWWNB.js → media-P6WSFHY4.js} +31 -30
- package/dist/media-YB4G5CMV.js +316 -0
- package/dist/{metadata-JIMHXPKE.js → metadata-5Q6FLVX4.js} +27 -27
- package/dist/{metadata-T6MLCEZ2.js → metadata-6OYHLPLA.js} +25 -25
- package/dist/{metadata-JCNPERR3.js → metadata-ADXGD4Y6.js} +25 -25
- package/dist/{metadata-ITS3VPE3.js → metadata-J447GEBP.js} +27 -27
- package/dist/{metadata-YOQEXEGO.js → metadata-VTQ2CGZX.js} +27 -27
- package/dist/{offer-create-page-6YTTQAXZ.js → offer-create-page-ACPKTNHA.js} +245 -266
- package/dist/offer-detail-page-S4R4N5GL.js +584 -0
- package/dist/offer-variant-detail-page-XUMDXZUD.js +402 -0
- package/dist/offers-OTZJBW43.js +54 -0
- package/dist/{onboarding-GCRT6P6M.js → onboarding-TUGXFOA6.js} +23 -23
- package/dist/orders-PJSJNGZS.js +63 -0
- package/dist/{organization-5AFVFFZQ.js → organization-YIOAVFHN.js} +26 -26
- package/dist/{organize-QXDKGP2X.js → organize-BTA7NJD2.js} +4 -4
- package/dist/{organize-AZYAANZM.js → organize-OWT5QSJR.js} +4 -4
- package/dist/pages/index.d.ts +232 -232
- package/dist/pages/index.js +89 -87
- package/dist/{payment-details-ENUWDVGI.js → payment-details-K2XFATEL.js} +24 -24
- package/dist/{payouts-2QBQSNDR.js → payouts-K5IDTJV3.js} +11 -11
- package/dist/{price-lists-2WBNENE7.js → price-lists-DNPIPDAW.js} +13 -13
- package/dist/{offer-pricing-edit-page-WZNP3TWV.js → pricing-5VUPPNKS.js} +21 -19
- package/dist/{pricing-4Y73YJHP.js → pricing-J5FIDZIY.js} +32 -32
- package/dist/{product-tags-DE32PERU.js → product-tags-SJYIGXEV.js} +47 -44
- package/dist/{product-types-PKUEL7X5.js → product-types-4PTJW5DE.js} +10 -10
- package/dist/product-variant-detail-FO6J3RFA.js +371 -0
- package/dist/{product-variant-edit-ESLPI5ES.js → product-variant-edit-55TAIBZO.js} +45 -27
- package/dist/{products-WLGCX6Z7.js → products-EQMANSO6.js} +41 -40
- package/dist/products-XM57LXJK.js +92 -0
- package/dist/{professional-details-OCVQO2MV.js → professional-details-WWZPTXSX.js} +24 -24
- package/dist/{profile-2HW5NX6K.js → profile-5IADQ727.js} +30 -30
- package/dist/{promotions-FPV6QOEQ.js → promotions-BYW6TZ5B.js} +12 -12
- package/dist/receive-MTXKKPKZ.js +578 -0
- package/dist/refund-3IXGYA7W.js +268 -0
- package/dist/{register-PZOHGO7N.js → register-U5PQZATC.js} +25 -25
- package/dist/{reset-password-Q7BNWHHO.js → reset-password-SKUJJLSV.js} +3 -3
- package/dist/{return-reasons-J2WFZOQH.js → return-reasons-QDPSIJG3.js} +22 -19
- package/dist/{sales-channels-I3PR34U5.js → sales-channels-GBSTCWVP.js} +12 -13
- package/dist/{sales-channels-HPG2ND4W.js → sales-channels-N4NE3FXP.js} +14 -15
- package/dist/{settings-RZNYWACF.js → settings-ZUBBFS67.js} +54 -51
- package/dist/shipment-TKSCPC3M.js +241 -0
- package/dist/shipping-DODEUYOQ.js +125 -0
- package/dist/{shipping-profile-M3GGADFI.js → shipping-profile-O4JMJLN7.js} +5 -9
- package/dist/shipping-profiles-4TJ4IH6U.js +46 -0
- package/dist/{stock-3HVQ6FYP.js → stock-GYK2GHJN.js} +27 -27
- package/dist/{store-LDVMG7CV.js → store-XWOALZ5Q.js} +36 -36
- package/dist/{store-closure-EZ2YPOPL.js → store-closure-46B3XZ2I.js} +24 -24
- package/dist/{store-select-AM4AE7AL.js → store-select-E77E3ZY7.js} +24 -24
- package/dist/{tax-regions-HDLBFZVG.js → tax-regions-S2LFRTMP.js} +9 -9
- package/dist/{team-6NTDISM4.js → team-N2C5JPSU.js} +37 -37
- package/package.json +12 -12
- package/dist/[id]-MOOCGOWO.js +0 -480
- package/dist/[id]-UVQXCYXD.js +0 -1219
- package/dist/[id]-VUX4FUOO.js +0 -1557
- package/dist/allocate-items-OK5PVJGR.js +0 -533
- package/dist/attributes-TRAUBTCO.js +0 -278
- package/dist/breadcrumb-6FV7PWEN.js +0 -33
- package/dist/breadcrumb-EX4C3AZY.js +0 -47
- package/dist/breadcrumb-Q3XSG7B2.js +0 -46
- package/dist/chunk-27KRIXMQ.js +0 -71
- package/dist/chunk-432S4FGR.js +0 -0
- package/dist/chunk-BDZOSMAX.js +0 -23
- package/dist/chunk-CFRWIQIZ.js +0 -43
- package/dist/chunk-G7BL4L3L.js +0 -66
- package/dist/chunk-RXV7INUV.js +0 -426
- package/dist/chunk-T6LHVNWO.js +0 -27
- package/dist/collections-DS63FT2E.js +0 -68
- package/dist/create-HR4I33SE.js +0 -73
- package/dist/create-UFHLPXET.js +0 -215
- package/dist/edit-GQNIINRR.js +0 -192
- package/dist/fulfillment-OIIPL7B7.js +0 -559
- package/dist/loader-VDYPD3RI.js +0 -31
- package/dist/login-HON44E3S.js +0 -39
- package/dist/metadata-5BPOBBU2.js +0 -45
- package/dist/offer-detail-page-OMZN2NTA.js +0 -492
- package/dist/offer-edit-page-3MO566RP.js +0 -151
- package/dist/offers-GVN5LCK6.js +0 -32
- package/dist/orders-CHSS4ASB.js +0 -63
- package/dist/product-variant-detail-MWUBPCOP.js +0 -209
- package/dist/products-XOHAQHUJ.js +0 -91
- package/dist/shipment-KWUXQZWK.js +0 -176
- package/dist/shipping-profiles-L27STQ7K.js +0 -46
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
defineTabMeta
|
|
3
|
+
} from "./chunk-LEWA4BPH.js";
|
|
4
4
|
import {
|
|
5
5
|
DataGrid,
|
|
6
6
|
createDataGridHelper
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5FBQOAXU.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
HandleInput
|
|
10
|
+
} from "./chunk-HJ56YXBU.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-4IRQSBA7.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-RPU4UOQK.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-JDNXS37G.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-HDEOZN2Q.js";
|
|
36
|
+
import {
|
|
37
|
+
DataTable
|
|
38
|
+
} from "./chunk-IV57G2CB.js";
|
|
37
39
|
import {
|
|
38
40
|
Combobox
|
|
39
41
|
} from "./chunk-VBRTC2VU.js";
|
|
40
42
|
import {
|
|
41
43
|
TabbedForm,
|
|
42
44
|
useTabbedForm
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-WJ5EU3KW.js";
|
|
44
46
|
import {
|
|
45
47
|
RouteFocusModal,
|
|
46
48
|
StackedFocusModal,
|
|
@@ -50,45 +52,41 @@ import {
|
|
|
50
52
|
import {
|
|
51
53
|
Form
|
|
52
54
|
} from "./chunk-3QSRE5LS.js";
|
|
53
|
-
import {
|
|
54
|
-
DataTable
|
|
55
|
-
} from "./chunk-5T6UWTRU.js";
|
|
56
55
|
import {
|
|
57
56
|
require_dist
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
useFeatureFlags
|
|
61
|
-
} from "./chunk-YIZK67RW.js";
|
|
57
|
+
} from "./chunk-DSTHXHJ5.js";
|
|
62
58
|
import {
|
|
63
59
|
ActionMenu
|
|
64
60
|
} from "./chunk-BDGZ4EQO.js";
|
|
61
|
+
import {
|
|
62
|
+
useFeatureFlags
|
|
63
|
+
} from "./chunk-BQHVM46E.js";
|
|
65
64
|
import {
|
|
66
65
|
useCreateProduct,
|
|
67
66
|
useProductAttributes
|
|
68
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-G6YNCIVF.js";
|
|
69
68
|
import {
|
|
70
|
-
sdk
|
|
71
|
-
|
|
72
|
-
} from "./chunk-RIN4CBRB.js";
|
|
69
|
+
sdk
|
|
70
|
+
} from "./chunk-LXZXXOJ3.js";
|
|
73
71
|
import {
|
|
74
72
|
__toESM
|
|
75
73
|
} from "./chunk-NBMM2TZK.js";
|
|
76
74
|
|
|
77
75
|
// src/pages/products/create/product-create.tsx
|
|
78
76
|
import { Children as Children2 } from "react";
|
|
79
|
-
import { useTranslation as
|
|
77
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
80
78
|
|
|
81
79
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
82
80
|
var import_types6 = __toESM(require_dist(), 1);
|
|
83
81
|
import { Button as Button3, toast } from "@medusajs/ui";
|
|
84
|
-
import { useEffect as useEffect3, useMemo as
|
|
85
|
-
import { useForm, useWatch as
|
|
86
|
-
import { useTranslation as
|
|
82
|
+
import { useEffect as useEffect3, useMemo as useMemo3, Children } from "react";
|
|
83
|
+
import { useForm, useWatch as useWatch2 } from "react-hook-form";
|
|
84
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
87
85
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
88
86
|
|
|
89
87
|
// src/pages/products/create/components/product-create-attributes-form/product-create-attributes-form.tsx
|
|
90
88
|
var import_types = __toESM(require_dist(), 1);
|
|
91
|
-
import {
|
|
89
|
+
import { XMarkMini } from "@medusajs/icons";
|
|
92
90
|
import {
|
|
93
91
|
Button as Button2,
|
|
94
92
|
Heading,
|
|
@@ -100,11 +98,9 @@ import {
|
|
|
100
98
|
Select,
|
|
101
99
|
Switch,
|
|
102
100
|
Text,
|
|
103
|
-
Textarea
|
|
104
|
-
clx
|
|
101
|
+
Textarea
|
|
105
102
|
} from "@medusajs/ui";
|
|
106
|
-
import {
|
|
107
|
-
import { forwardRef, useEffect as useEffect2 } from "react";
|
|
103
|
+
import { useEffect as useEffect2 } from "react";
|
|
108
104
|
import {
|
|
109
105
|
Controller,
|
|
110
106
|
useFieldArray
|
|
@@ -115,9 +111,7 @@ import { useTranslation as useTranslation2 } from "react-i18next";
|
|
|
115
111
|
import {
|
|
116
112
|
Badge,
|
|
117
113
|
Button,
|
|
118
|
-
|
|
119
|
-
createDataTableColumnHelper,
|
|
120
|
-
Tooltip
|
|
114
|
+
createDataTableColumnHelper
|
|
121
115
|
} from "@medusajs/ui";
|
|
122
116
|
import { useEffect, useMemo, useState } from "react";
|
|
123
117
|
import { useTranslation } from "react-i18next";
|
|
@@ -133,10 +127,6 @@ 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();
|
|
@@ -146,11 +136,16 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
146
136
|
{}
|
|
147
137
|
);
|
|
148
138
|
const [state, setState] = useState([]);
|
|
139
|
+
const categoryId = form.watch("category_id");
|
|
149
140
|
const { searchParams } = useAttributeTableQuery({
|
|
150
141
|
pageSize: PAGE_SIZE,
|
|
151
142
|
prefix: ADD_ATTRIBUTES_MODAL_ID
|
|
152
143
|
});
|
|
153
|
-
const
|
|
144
|
+
const attributesQuery = useMemo(
|
|
145
|
+
() => ({ ...searchParams, category_id: categoryId || void 0 }),
|
|
146
|
+
[searchParams, categoryId]
|
|
147
|
+
);
|
|
148
|
+
const { product_attributes, count, isLoading, isError, error } = useProductAttributes(attributesQuery, {
|
|
154
149
|
placeholderData: keepPreviousData
|
|
155
150
|
});
|
|
156
151
|
const open = getIsOpen(ADD_ATTRIBUTES_MODAL_ID);
|
|
@@ -174,7 +169,10 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
174
169
|
values: Array.isArray(a.values) ? a.values : a.values ? [a.values] : [],
|
|
175
170
|
is_variant_axis: a.use_for_variants,
|
|
176
171
|
type: a.type ?? apiAttr?.type ?? "",
|
|
177
|
-
available_values: a.available_values ?? apiAttr?.values?.map((v) => ({
|
|
172
|
+
available_values: a.available_values ?? apiAttr?.values?.map((v) => ({
|
|
173
|
+
id: v.id,
|
|
174
|
+
name: v.name
|
|
175
|
+
})) ?? []
|
|
178
176
|
});
|
|
179
177
|
}
|
|
180
178
|
}
|
|
@@ -252,45 +250,27 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
252
250
|
if (isError) {
|
|
253
251
|
throw error;
|
|
254
252
|
}
|
|
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
253
|
return /* @__PURE__ */ jsxs(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
|
|
265
254
|
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
266
|
-
/* @__PURE__ */ jsx(
|
|
267
|
-
|
|
255
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
256
|
+
DataTable,
|
|
268
257
|
{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
enableRowSelection: (row) => !row.original.is_required
|
|
284
|
-
},
|
|
285
|
-
isLoading,
|
|
286
|
-
layout: "fill",
|
|
287
|
-
prefix: ADD_ATTRIBUTES_MODAL_ID,
|
|
288
|
-
compact: true,
|
|
289
|
-
emptyState
|
|
290
|
-
}
|
|
291
|
-
)
|
|
258
|
+
data: product_attributes,
|
|
259
|
+
columns,
|
|
260
|
+
filters,
|
|
261
|
+
rowCount: count,
|
|
262
|
+
pageSize: PAGE_SIZE,
|
|
263
|
+
getRowId: (row) => row.id,
|
|
264
|
+
rowSelection: {
|
|
265
|
+
state: rowSelection,
|
|
266
|
+
onRowSelectionChange,
|
|
267
|
+
enableRowSelection: (row) => !row.original.is_required
|
|
268
|
+
},
|
|
269
|
+
isLoading,
|
|
270
|
+
layout: "fill",
|
|
271
|
+
prefix: ADD_ATTRIBUTES_MODAL_ID
|
|
292
272
|
}
|
|
293
|
-
),
|
|
273
|
+
) }),
|
|
294
274
|
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
295
275
|
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
|
|
296
276
|
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
|
|
@@ -302,32 +282,7 @@ var useColumns = () => {
|
|
|
302
282
|
const { t } = useTranslation();
|
|
303
283
|
return useMemo(
|
|
304
284
|
() => [
|
|
305
|
-
columnHelper.select(
|
|
306
|
-
cell: (ctx) => {
|
|
307
|
-
const checked = ctx.row.getIsSelected();
|
|
308
|
-
const onChange = ctx.row.getToggleSelectedHandler();
|
|
309
|
-
const disabled = !ctx.row.getCanSelect();
|
|
310
|
-
const checkbox = /* @__PURE__ */ jsx(
|
|
311
|
-
Checkbox,
|
|
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
|
-
);
|
|
327
|
-
}
|
|
328
|
-
return checkbox;
|
|
329
|
-
}
|
|
330
|
-
}),
|
|
285
|
+
columnHelper.select(),
|
|
331
286
|
columnHelper.accessor("name", {
|
|
332
287
|
header: t("attributes.fields.name"),
|
|
333
288
|
enableSorting: false
|
|
@@ -363,7 +318,7 @@ var useColumns = () => {
|
|
|
363
318
|
id: "values",
|
|
364
319
|
header: t("attributes.fields.values"),
|
|
365
320
|
cell: ({ row }) => {
|
|
366
|
-
const values = row.original.values ?? [];
|
|
321
|
+
const values = row.original.type === "toggle" ? [] : row.original.values ?? [];
|
|
367
322
|
if (!values.length) {
|
|
368
323
|
return /* @__PURE__ */ jsx("span", { className: "text-ui-fg-muted", children: "-" });
|
|
369
324
|
}
|
|
@@ -432,6 +387,7 @@ var Root = () => {
|
|
|
432
387
|
variant: "secondary",
|
|
433
388
|
size: "small",
|
|
434
389
|
onClick: handleAddExisting,
|
|
390
|
+
"data-testid": "product-create-attributes-add-existing",
|
|
435
391
|
children: t("products.create.attributes.addExisting")
|
|
436
392
|
}
|
|
437
393
|
),
|
|
@@ -442,124 +398,150 @@ var Root = () => {
|
|
|
442
398
|
variant: "secondary",
|
|
443
399
|
size: "small",
|
|
444
400
|
onClick: handleCreateNew,
|
|
401
|
+
"data-testid": "product-create-attributes-create-new",
|
|
445
402
|
children: t("products.create.attributes.createNew")
|
|
446
403
|
}
|
|
447
404
|
)
|
|
448
405
|
] }),
|
|
449
406
|
fields.some((f) => !f.is_custom && !!f.attribute_id) && /* @__PURE__ */ jsx2(SelectedAttributes, { fields, remove }),
|
|
450
|
-
fields.some((f) => f.is_custom) && /* @__PURE__ */ jsx2(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
) }),
|
|
471
|
-
/* @__PURE__ */ jsx2(
|
|
472
|
-
Input,
|
|
473
|
-
{
|
|
474
|
-
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
475
|
-
...form.register(`attributes.${index}.title`),
|
|
476
|
-
placeholder: t(
|
|
477
|
-
"products.create.attributes.titlePlaceholder"
|
|
478
|
-
)
|
|
479
|
-
}
|
|
480
|
-
),
|
|
481
|
-
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
482
|
-
Label,
|
|
483
|
-
{
|
|
484
|
-
size: "xsmall",
|
|
485
|
-
weight: "plus",
|
|
486
|
-
className: "text-ui-fg-subtle",
|
|
487
|
-
htmlFor: `attributes.${index}.values`,
|
|
488
|
-
children: t("fields.values")
|
|
489
|
-
}
|
|
490
|
-
) }),
|
|
491
|
-
/* @__PURE__ */ jsx2(
|
|
492
|
-
Controller,
|
|
493
|
-
{
|
|
494
|
-
control: form.control,
|
|
495
|
-
name: `attributes.${index}.values`,
|
|
496
|
-
render: ({ field: { onChange, value, ...field2 } }) => useForVariants ? /* @__PURE__ */ jsx2(
|
|
497
|
-
ChipInput,
|
|
407
|
+
fields.some((f) => f.is_custom) && /* @__PURE__ */ jsx2(
|
|
408
|
+
"ul",
|
|
409
|
+
{
|
|
410
|
+
className: "flex flex-col gap-y-4",
|
|
411
|
+
"data-testid": "product-create-attributes-list",
|
|
412
|
+
children: fields.map((field, index) => {
|
|
413
|
+
if (!field.is_custom) return null;
|
|
414
|
+
const useForVariants = form.watch(
|
|
415
|
+
`attributes.${index}.use_for_variants`
|
|
416
|
+
);
|
|
417
|
+
return /* @__PURE__ */ jsxs2(
|
|
418
|
+
"li",
|
|
419
|
+
{
|
|
420
|
+
className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-start gap-1.5 rounded-xl p-1.5",
|
|
421
|
+
"data-testid": `product-create-attribute-row-${index}`,
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
424
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
425
|
+
Label,
|
|
498
426
|
{
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
"products.create.attributes.valuePlaceholder"
|
|
505
|
-
)
|
|
427
|
+
size: "xsmall",
|
|
428
|
+
weight: "plus",
|
|
429
|
+
className: "text-ui-fg-subtle",
|
|
430
|
+
htmlFor: `attributes.${index}.title`,
|
|
431
|
+
children: t("fields.title")
|
|
506
432
|
}
|
|
507
|
-
)
|
|
508
|
-
|
|
433
|
+
) }),
|
|
434
|
+
/* @__PURE__ */ jsx2(
|
|
435
|
+
Input,
|
|
509
436
|
{
|
|
510
|
-
...field2,
|
|
511
437
|
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
512
|
-
|
|
513
|
-
|
|
438
|
+
...form.register(
|
|
439
|
+
`attributes.${index}.title`
|
|
440
|
+
),
|
|
514
441
|
placeholder: t(
|
|
515
|
-
"products.create.attributes.
|
|
442
|
+
"products.create.attributes.titlePlaceholder"
|
|
443
|
+
),
|
|
444
|
+
"data-testid": `product-create-attribute-title-${index}`
|
|
445
|
+
}
|
|
446
|
+
),
|
|
447
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
448
|
+
Label,
|
|
449
|
+
{
|
|
450
|
+
size: "xsmall",
|
|
451
|
+
weight: "plus",
|
|
452
|
+
className: "text-ui-fg-subtle",
|
|
453
|
+
htmlFor: `attributes.${index}.values`,
|
|
454
|
+
children: t("fields.values")
|
|
455
|
+
}
|
|
456
|
+
) }),
|
|
457
|
+
/* @__PURE__ */ jsx2(
|
|
458
|
+
Controller,
|
|
459
|
+
{
|
|
460
|
+
control: form.control,
|
|
461
|
+
name: `attributes.${index}.values`,
|
|
462
|
+
render: ({ field: { onChange, value, ...field2 } }) => useForVariants ? /* @__PURE__ */ jsx2(
|
|
463
|
+
ChipInput,
|
|
464
|
+
{
|
|
465
|
+
...field2,
|
|
466
|
+
variant: "contrast",
|
|
467
|
+
value: Array.isArray(value) ? value : [],
|
|
468
|
+
onChange,
|
|
469
|
+
placeholder: t(
|
|
470
|
+
"products.create.attributes.valuePlaceholder"
|
|
471
|
+
),
|
|
472
|
+
"data-testid": `product-create-attribute-values-${index}`
|
|
473
|
+
}
|
|
474
|
+
) : /* @__PURE__ */ jsx2(
|
|
475
|
+
Textarea,
|
|
476
|
+
{
|
|
477
|
+
...field2,
|
|
478
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
479
|
+
value: Array.isArray(value) ? value[0] ?? "" : value ?? "",
|
|
480
|
+
onChange: (e) => onChange(e.target.value),
|
|
481
|
+
placeholder: t(
|
|
482
|
+
"products.create.attributes.valuePlaceholder"
|
|
483
|
+
),
|
|
484
|
+
"data-testid": `product-create-attribute-values-${index}`
|
|
485
|
+
}
|
|
516
486
|
)
|
|
517
487
|
}
|
|
518
|
-
)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ jsx2("div", {}),
|
|
490
|
+
/* @__PURE__ */ jsx2(
|
|
491
|
+
Form.Field,
|
|
492
|
+
{
|
|
493
|
+
control: form.control,
|
|
494
|
+
name: `attributes.${index}.use_for_variants`,
|
|
495
|
+
render: ({
|
|
496
|
+
field: { value, onChange, ref }
|
|
497
|
+
}) => /* @__PURE__ */ jsx2(Form.Item, { children: /* @__PURE__ */ jsxs2(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
className: "flex items-start gap-x-3 py-1.5",
|
|
501
|
+
"data-testid": `product-create-attribute-use-for-variants-${index}`,
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
|
|
504
|
+
Switch,
|
|
505
|
+
{
|
|
506
|
+
ref,
|
|
507
|
+
className: "shrink-0 rtl:rotate-180",
|
|
508
|
+
checked: value,
|
|
509
|
+
onCheckedChange: onChange
|
|
510
|
+
}
|
|
511
|
+
) }),
|
|
512
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
|
|
513
|
+
/* @__PURE__ */ jsx2(Label, { size: "xsmall", weight: "plus", children: t(
|
|
514
|
+
"products.create.attributes.useForVariants"
|
|
515
|
+
) }),
|
|
516
|
+
/* @__PURE__ */ jsx2(Hint, { className: "!txt-small", children: t(
|
|
517
|
+
"products.create.attributes.useForVariantsDescription"
|
|
518
|
+
) })
|
|
519
|
+
] })
|
|
520
|
+
]
|
|
521
|
+
}
|
|
541
522
|
) })
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
523
|
+
}
|
|
524
|
+
)
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ jsx2(
|
|
527
|
+
IconButton,
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
size: "small",
|
|
531
|
+
variant: "transparent",
|
|
532
|
+
className: "text-ui-fg-muted",
|
|
533
|
+
onClick: () => remove(index),
|
|
534
|
+
"data-testid": `product-create-attribute-remove-${index}`,
|
|
535
|
+
children: /* @__PURE__ */ jsx2(XMarkMini, {})
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
field.id
|
|
541
|
+
);
|
|
542
|
+
})
|
|
543
|
+
}
|
|
544
|
+
),
|
|
563
545
|
/* @__PURE__ */ jsx2(RequiredAttributes, {})
|
|
564
546
|
] })
|
|
565
547
|
]
|
|
@@ -576,171 +558,183 @@ var SelectedAttributes = ({
|
|
|
576
558
|
({ field }) => !field.is_custom && !field.is_required && !!field.attribute_id
|
|
577
559
|
);
|
|
578
560
|
if (!entries.length) return null;
|
|
579
|
-
return /* @__PURE__ */ jsx2(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
"
|
|
584
|
-
{
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
) }),
|
|
597
|
-
/* @__PURE__ */ jsx2(
|
|
598
|
-
Input,
|
|
599
|
-
{
|
|
600
|
-
value: field.title,
|
|
601
|
-
disabled: true,
|
|
602
|
-
className: "bg-ui-bg-field-component"
|
|
603
|
-
}
|
|
604
|
-
),
|
|
605
|
-
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
606
|
-
Label,
|
|
607
|
-
{
|
|
608
|
-
size: "xsmall",
|
|
609
|
-
weight: "plus",
|
|
610
|
-
className: "text-ui-fg-subtle",
|
|
611
|
-
children: t("fields.values")
|
|
612
|
-
}
|
|
613
|
-
) }),
|
|
614
|
-
attrType === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
615
|
-
Controller,
|
|
616
|
-
{
|
|
617
|
-
control: form.control,
|
|
618
|
-
name: `attributes.${index}.values`,
|
|
619
|
-
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
620
|
-
Combobox,
|
|
561
|
+
return /* @__PURE__ */ jsx2(
|
|
562
|
+
"ul",
|
|
563
|
+
{
|
|
564
|
+
className: "flex flex-col gap-y-4",
|
|
565
|
+
"data-testid": "product-create-selected-attributes-list",
|
|
566
|
+
children: entries.map(({ field, index }) => {
|
|
567
|
+
const attrType = field.type;
|
|
568
|
+
const availableValues = field.available_values ?? [];
|
|
569
|
+
return /* @__PURE__ */ jsxs2(
|
|
570
|
+
"li",
|
|
571
|
+
{
|
|
572
|
+
className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-start gap-1.5 rounded-xl p-1.5",
|
|
573
|
+
"data-testid": `product-create-selected-attribute-row-${index}`,
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
576
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
577
|
+
Label,
|
|
621
578
|
{
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
options: availableValues.map((v) => ({
|
|
627
|
-
value: v.name,
|
|
628
|
-
label: v.name
|
|
629
|
-
})),
|
|
630
|
-
placeholder: t("products.create.attributes.selectValues")
|
|
579
|
+
size: "xsmall",
|
|
580
|
+
weight: "plus",
|
|
581
|
+
className: "text-ui-fg-subtle",
|
|
582
|
+
children: t("fields.title")
|
|
631
583
|
}
|
|
632
|
-
)
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
Controller,
|
|
636
|
-
{
|
|
637
|
-
control: form.control,
|
|
638
|
-
name: `attributes.${index}.values`,
|
|
639
|
-
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
640
|
-
Select,
|
|
584
|
+
) }),
|
|
585
|
+
/* @__PURE__ */ jsx2(
|
|
586
|
+
Input,
|
|
641
587
|
{
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
647
|
-
Select.Value,
|
|
648
|
-
{
|
|
649
|
-
placeholder: t(
|
|
650
|
-
"products.create.attributes.selectValues"
|
|
651
|
-
)
|
|
652
|
-
}
|
|
653
|
-
) }),
|
|
654
|
-
/* @__PURE__ */ jsx2(Select.Content, { children: availableValues.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
655
|
-
]
|
|
588
|
+
value: field.title,
|
|
589
|
+
disabled: true,
|
|
590
|
+
className: "bg-ui-bg-field-component",
|
|
591
|
+
"data-testid": `product-create-selected-attribute-title-${index}`
|
|
656
592
|
}
|
|
657
|
-
)
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
595
|
+
Label,
|
|
596
|
+
{
|
|
597
|
+
size: "xsmall",
|
|
598
|
+
weight: "plus",
|
|
599
|
+
className: "text-ui-fg-subtle",
|
|
600
|
+
children: t("fields.values")
|
|
601
|
+
}
|
|
602
|
+
) }),
|
|
603
|
+
attrType === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
604
|
+
Controller,
|
|
666
605
|
{
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
606
|
+
control: form.control,
|
|
607
|
+
name: `attributes.${index}.values`,
|
|
608
|
+
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
609
|
+
Combobox,
|
|
610
|
+
{
|
|
611
|
+
...rest,
|
|
612
|
+
ref,
|
|
613
|
+
value: Array.isArray(value) ? value : [],
|
|
614
|
+
onChange: (val) => onChange(val ?? []),
|
|
615
|
+
options: availableValues.map((v) => ({
|
|
616
|
+
value: v.name,
|
|
617
|
+
label: v.name
|
|
618
|
+
})),
|
|
619
|
+
placeholder: t(
|
|
620
|
+
"products.create.attributes.selectValues"
|
|
621
|
+
)
|
|
622
|
+
}
|
|
673
623
|
)
|
|
674
624
|
}
|
|
675
|
-
)
|
|
676
|
-
|
|
677
|
-
) : attrType === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
678
|
-
Controller,
|
|
679
|
-
{
|
|
680
|
-
control: form.control,
|
|
681
|
-
name: `attributes.${index}.values`,
|
|
682
|
-
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
683
|
-
Select,
|
|
625
|
+
) : attrType === import_types.AttributeType.SINGLE_SELECT ? /* @__PURE__ */ jsx2(
|
|
626
|
+
Controller,
|
|
684
627
|
{
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
628
|
+
control: form.control,
|
|
629
|
+
name: `attributes.${index}.values`,
|
|
630
|
+
render: ({ field: { onChange, value, ref, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
631
|
+
Select,
|
|
632
|
+
{
|
|
633
|
+
...rest,
|
|
634
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
635
|
+
onValueChange: onChange,
|
|
636
|
+
children: [
|
|
637
|
+
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
638
|
+
Select.Value,
|
|
639
|
+
{
|
|
640
|
+
placeholder: t(
|
|
641
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
642
|
+
)
|
|
643
|
+
}
|
|
644
|
+
) }),
|
|
645
|
+
/* @__PURE__ */ jsx2(Select.Content, { children: availableValues.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
)
|
|
702
649
|
}
|
|
703
|
-
)
|
|
704
|
-
|
|
705
|
-
) : /* @__PURE__ */ jsx2(
|
|
706
|
-
Controller,
|
|
707
|
-
{
|
|
708
|
-
control: form.control,
|
|
709
|
-
name: `attributes.${index}.values`,
|
|
710
|
-
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
711
|
-
Input,
|
|
650
|
+
) : attrType === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
651
|
+
Controller,
|
|
712
652
|
{
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
653
|
+
control: form.control,
|
|
654
|
+
name: `attributes.${index}.values`,
|
|
655
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
656
|
+
Textarea,
|
|
657
|
+
{
|
|
658
|
+
...rest,
|
|
659
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
660
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
661
|
+
onChange: (e) => onChange(e.target.value),
|
|
662
|
+
placeholder: t(
|
|
663
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
664
|
+
)
|
|
665
|
+
}
|
|
718
666
|
)
|
|
719
667
|
}
|
|
720
|
-
)
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
668
|
+
) : attrType === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
669
|
+
Controller,
|
|
670
|
+
{
|
|
671
|
+
control: form.control,
|
|
672
|
+
name: `attributes.${index}.values`,
|
|
673
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsxs2(
|
|
674
|
+
Select,
|
|
675
|
+
{
|
|
676
|
+
...rest,
|
|
677
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
678
|
+
onValueChange: onChange,
|
|
679
|
+
children: [
|
|
680
|
+
/* @__PURE__ */ jsx2(Select.Trigger, { children: /* @__PURE__ */ jsx2(
|
|
681
|
+
Select.Value,
|
|
682
|
+
{
|
|
683
|
+
placeholder: t(
|
|
684
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
) }),
|
|
688
|
+
/* @__PURE__ */ jsxs2(Select.Content, { children: [
|
|
689
|
+
/* @__PURE__ */ jsx2(Select.Item, { value: "true", children: t("filters.radio.yes") }),
|
|
690
|
+
/* @__PURE__ */ jsx2(Select.Item, { value: "false", children: t("filters.radio.no") })
|
|
691
|
+
] })
|
|
692
|
+
]
|
|
693
|
+
}
|
|
694
|
+
)
|
|
695
|
+
}
|
|
696
|
+
) : /* @__PURE__ */ jsx2(
|
|
697
|
+
Controller,
|
|
698
|
+
{
|
|
699
|
+
control: form.control,
|
|
700
|
+
name: `attributes.${index}.values`,
|
|
701
|
+
render: ({ field: { onChange, value, ...rest } }) => /* @__PURE__ */ jsx2(
|
|
702
|
+
Input,
|
|
703
|
+
{
|
|
704
|
+
...rest,
|
|
705
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
706
|
+
onChange: (e) => onChange(e.target.value),
|
|
707
|
+
placeholder: t(
|
|
708
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
field.use_for_variants && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
715
|
+
/* @__PURE__ */ jsx2("div", {}),
|
|
716
|
+
/* @__PURE__ */ jsx2(VariantAxisTip, { className: "border-none" })
|
|
717
|
+
] })
|
|
718
|
+
] }),
|
|
719
|
+
/* @__PURE__ */ jsx2(
|
|
720
|
+
IconButton,
|
|
721
|
+
{
|
|
722
|
+
type: "button",
|
|
723
|
+
size: "small",
|
|
724
|
+
variant: "transparent",
|
|
725
|
+
className: "text-ui-fg-muted",
|
|
726
|
+
onClick: () => remove(index),
|
|
727
|
+
"data-testid": `product-create-selected-attribute-remove-${index}`,
|
|
728
|
+
children: /* @__PURE__ */ jsx2(XMarkMini, {})
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
]
|
|
732
|
+
},
|
|
733
|
+
field.id
|
|
734
|
+
);
|
|
735
|
+
})
|
|
736
|
+
}
|
|
737
|
+
);
|
|
744
738
|
};
|
|
745
739
|
var RequiredAttributes = () => {
|
|
746
740
|
const { t } = useTranslation2();
|
|
@@ -757,73 +751,65 @@ var RequiredAttributes = () => {
|
|
|
757
751
|
useEffect2(() => {
|
|
758
752
|
if (!product_attributes) return;
|
|
759
753
|
const currentAttributes = form.getValues("attributes") || [];
|
|
760
|
-
const requiredIds = new Set(
|
|
754
|
+
const requiredIds = new Set(
|
|
755
|
+
product_attributes.map((a) => a.id)
|
|
756
|
+
);
|
|
761
757
|
const otherAttributes = currentAttributes.filter(
|
|
762
758
|
(a) => a.is_custom || !requiredIds.has(a.attribute_id ?? "")
|
|
763
759
|
);
|
|
764
|
-
const requiredAttributes = product_attributes.map(
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
760
|
+
const requiredAttributes = product_attributes.map(
|
|
761
|
+
(attr) => {
|
|
762
|
+
const existing = currentAttributes.find(
|
|
763
|
+
(a) => a.attribute_id === attr.id
|
|
764
|
+
);
|
|
765
|
+
if (existing) return existing;
|
|
766
|
+
return {
|
|
767
|
+
attribute_id: attr.id,
|
|
768
|
+
title: attr.name,
|
|
769
|
+
values: attr.type === import_types.AttributeType.MULTI_SELECT ? [] : attr.type === import_types.AttributeType.TOGGLE ? "false" : "",
|
|
770
|
+
is_custom: false,
|
|
771
|
+
is_required: true,
|
|
772
|
+
use_for_variants: attr.is_variant_axis,
|
|
773
|
+
type: attr.type,
|
|
774
|
+
available_values: attr.values?.map((v) => ({ id: v.id, name: v.name })) ?? []
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
);
|
|
779
778
|
form.setValue("attributes", [...otherAttributes, ...requiredAttributes]);
|
|
780
|
-
}, [product_attributes]);
|
|
779
|
+
}, [product_attributes, form]);
|
|
781
780
|
if (!categoryId || !product_attributes?.length) return null;
|
|
782
781
|
const requiredEntries = attributes.map((attr, index) => ({ attr, index })).filter(({ attr }) => !attr.is_custom);
|
|
783
782
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
784
783
|
/* @__PURE__ */ jsx2("div", { className: "border-ui-border-base border-t border-dashed" }),
|
|
785
|
-
/* @__PURE__ */ jsxs2(
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
784
|
+
/* @__PURE__ */ jsxs2(
|
|
785
|
+
"div",
|
|
786
|
+
{
|
|
787
|
+
className: "flex flex-col gap-y-6",
|
|
788
|
+
"data-testid": "product-create-attributes-required",
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
791
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", weight: "plus", leading: "compact", children: t("products.create.attributes.requiredAttributes") }),
|
|
792
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", className: "text-ui-fg-subtle", children: t("products.create.attributes.requiredAttributesHint") })
|
|
793
|
+
] }),
|
|
794
|
+
requiredEntries.map(({ attr, index }) => {
|
|
795
|
+
const apiAttr = product_attributes.find(
|
|
796
|
+
(a) => a.id === attr.attribute_id
|
|
797
|
+
);
|
|
798
|
+
if (!apiAttr) return null;
|
|
799
|
+
return /* @__PURE__ */ jsx2(
|
|
800
|
+
RequiredAttributeField,
|
|
801
|
+
{
|
|
802
|
+
attribute: apiAttr,
|
|
803
|
+
index
|
|
804
|
+
},
|
|
805
|
+
apiAttr.id
|
|
806
|
+
);
|
|
807
|
+
})
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
)
|
|
805
811
|
] });
|
|
806
812
|
};
|
|
807
|
-
var RadioSelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
808
|
-
RadixSelect.Item,
|
|
809
|
-
{
|
|
810
|
-
ref,
|
|
811
|
-
className: clx(
|
|
812
|
-
"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",
|
|
813
|
-
"focus-visible:bg-ui-bg-component-hover",
|
|
814
|
-
"active:bg-ui-bg-component-pressed",
|
|
815
|
-
"data-[state=checked]:txt-compact-small-plus",
|
|
816
|
-
"disabled:text-ui-fg-disabled",
|
|
817
|
-
className
|
|
818
|
-
),
|
|
819
|
-
...props,
|
|
820
|
-
children: [
|
|
821
|
-
/* @__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, {}) }) }),
|
|
822
|
-
/* @__PURE__ */ jsx2(RadixSelect.ItemText, { className: "flex-1 truncate", children })
|
|
823
|
-
]
|
|
824
|
-
}
|
|
825
|
-
));
|
|
826
|
-
RadioSelectItem.displayName = "RadioSelectItem";
|
|
827
813
|
var RequiredAttributeField = ({
|
|
828
814
|
attribute,
|
|
829
815
|
index
|
|
@@ -852,7 +838,7 @@ var RequiredAttributeField = ({
|
|
|
852
838
|
)
|
|
853
839
|
}
|
|
854
840
|
) }),
|
|
855
|
-
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(
|
|
841
|
+
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(Select.Item, { value: v.name, children: v.name }, v.id)) })
|
|
856
842
|
]
|
|
857
843
|
}
|
|
858
844
|
) : attribute.type === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
@@ -866,10 +852,12 @@ var RequiredAttributeField = ({
|
|
|
866
852
|
value: v.name,
|
|
867
853
|
label: v.name
|
|
868
854
|
})) ?? [],
|
|
869
|
-
placeholder: t(
|
|
855
|
+
placeholder: t(
|
|
856
|
+
"products.create.attributes.selectValues"
|
|
857
|
+
)
|
|
870
858
|
}
|
|
871
859
|
) : attribute.type === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
872
|
-
|
|
860
|
+
Input,
|
|
873
861
|
{
|
|
874
862
|
...field,
|
|
875
863
|
ref,
|
|
@@ -879,26 +867,13 @@ var RequiredAttributeField = ({
|
|
|
879
867
|
"products.create.attributes.enterValuePlaceholder"
|
|
880
868
|
)
|
|
881
869
|
}
|
|
882
|
-
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */
|
|
883
|
-
|
|
870
|
+
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
871
|
+
Switch,
|
|
884
872
|
{
|
|
885
873
|
...field,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
890
|
-
Select.Value,
|
|
891
|
-
{
|
|
892
|
-
placeholder: t(
|
|
893
|
-
"products.create.attributes.selectValuePlaceholder"
|
|
894
|
-
)
|
|
895
|
-
}
|
|
896
|
-
) }),
|
|
897
|
-
/* @__PURE__ */ jsxs2(Select.Content, { children: [
|
|
898
|
-
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "true", children: t("filters.radio.yes") }),
|
|
899
|
-
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "false", children: t("filters.radio.no") })
|
|
900
|
-
] })
|
|
901
|
-
]
|
|
874
|
+
className: "rtl:rotate-180",
|
|
875
|
+
checked: value === "true" || value === true,
|
|
876
|
+
onCheckedChange: (checked) => onChange(String(checked))
|
|
902
877
|
}
|
|
903
878
|
) : /* @__PURE__ */ jsx2(
|
|
904
879
|
Input,
|
|
@@ -918,13 +893,13 @@ var RequiredAttributeField = ({
|
|
|
918
893
|
}
|
|
919
894
|
);
|
|
920
895
|
};
|
|
921
|
-
var VariantAxisTip = () => {
|
|
896
|
+
var VariantAxisTip = ({ className }) => {
|
|
922
897
|
const { t } = useTranslation2();
|
|
923
898
|
return /* @__PURE__ */ jsx2(
|
|
924
899
|
InlineTip,
|
|
925
900
|
{
|
|
901
|
+
className,
|
|
926
902
|
label: t("products.create.attributes.tip"),
|
|
927
|
-
className: "border-none",
|
|
928
903
|
children: t("products.create.attributes.variantAxisTip")
|
|
929
904
|
}
|
|
930
905
|
);
|
|
@@ -937,8 +912,8 @@ Root._tabMeta = defineTabMeta({
|
|
|
937
912
|
var ProductCreateAttributesForm = Root;
|
|
938
913
|
|
|
939
914
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
940
|
-
import { Heading as
|
|
941
|
-
import { useTranslation as
|
|
915
|
+
import { Heading as Heading2 } from "@medusajs/ui";
|
|
916
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
942
917
|
|
|
943
918
|
// src/pages/products/create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
|
|
944
919
|
import { Input as Input2, Textarea as Textarea2 } from "@medusajs/ui";
|
|
@@ -1306,381 +1281,32 @@ function formatFileSize(bytes, decimalPlaces = 2) {
|
|
|
1306
1281
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
|
|
1307
1282
|
}
|
|
1308
1283
|
|
|
1309
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1310
|
-
import {
|
|
1311
|
-
Alert,
|
|
1312
|
-
Checkbox as Checkbox2,
|
|
1313
|
-
clx as clx3,
|
|
1314
|
-
Heading as Heading2,
|
|
1315
|
-
Hint as Hint2,
|
|
1316
|
-
InlineTip as InlineTip2,
|
|
1317
|
-
Label as Label2,
|
|
1318
|
-
Text as Text3
|
|
1319
|
-
} from "@medusajs/ui";
|
|
1320
|
-
import { useFieldArray as useFieldArray3, useWatch } from "react-hook-form";
|
|
1321
|
-
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1322
|
-
import { useMemo as useMemo3 } from "react";
|
|
1323
|
-
|
|
1324
|
-
// src/components/common/sortable-list/sortable-list.tsx
|
|
1325
|
-
import {
|
|
1326
|
-
DndContext as DndContext2,
|
|
1327
|
-
DragOverlay as DragOverlay2,
|
|
1328
|
-
KeyboardSensor as KeyboardSensor2,
|
|
1329
|
-
PointerSensor as PointerSensor2,
|
|
1330
|
-
defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
|
|
1331
|
-
useSensor as useSensor2,
|
|
1332
|
-
useSensors as useSensors2
|
|
1333
|
-
} from "@dnd-kit/core";
|
|
1334
|
-
import {
|
|
1335
|
-
SortableContext as SortableContext2,
|
|
1336
|
-
arrayMove as arrayMove2,
|
|
1337
|
-
sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
|
|
1338
|
-
useSortable as useSortable2
|
|
1339
|
-
} from "@dnd-kit/sortable";
|
|
1340
|
-
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
1341
|
-
import { DotsSix as DotsSix2 } from "@medusajs/icons";
|
|
1342
|
-
import { IconButton as IconButton3, clx as clx2 } from "@medusajs/ui";
|
|
1343
|
-
import {
|
|
1344
|
-
Fragment as Fragment2,
|
|
1345
|
-
createContext,
|
|
1346
|
-
useContext,
|
|
1347
|
-
useMemo as useMemo2,
|
|
1348
|
-
useState as useState3
|
|
1349
|
-
} from "react";
|
|
1350
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1351
|
-
var List = ({
|
|
1352
|
-
items,
|
|
1353
|
-
onChange,
|
|
1354
|
-
renderItem
|
|
1355
|
-
}) => {
|
|
1356
|
-
const [active, setActive] = useState3(null);
|
|
1357
|
-
const [activeItem, activeIndex] = useMemo2(() => {
|
|
1358
|
-
if (active === null) {
|
|
1359
|
-
return [null, null];
|
|
1360
|
-
}
|
|
1361
|
-
const index = items.findIndex(({ id }) => id === active.id);
|
|
1362
|
-
return [items[index], index];
|
|
1363
|
-
}, [active, items]);
|
|
1364
|
-
const sensors = useSensors2(
|
|
1365
|
-
useSensor2(PointerSensor2),
|
|
1366
|
-
useSensor2(KeyboardSensor2, {
|
|
1367
|
-
coordinateGetter: sortableKeyboardCoordinates2
|
|
1368
|
-
})
|
|
1369
|
-
);
|
|
1370
|
-
const handleDragStart = ({ active: active2 }) => {
|
|
1371
|
-
setActive(active2);
|
|
1372
|
-
};
|
|
1373
|
-
const handleDragEnd = ({ active: active2, over }) => {
|
|
1374
|
-
if (over && active2.id !== over.id) {
|
|
1375
|
-
const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
|
|
1376
|
-
const overIndex = items.findIndex(({ id }) => id === over.id);
|
|
1377
|
-
onChange(arrayMove2(items, activeIndex2, overIndex));
|
|
1378
|
-
}
|
|
1379
|
-
setActive(null);
|
|
1380
|
-
};
|
|
1381
|
-
const handleDragCancel = () => {
|
|
1382
|
-
setActive(null);
|
|
1383
|
-
};
|
|
1384
|
-
return /* @__PURE__ */ jsxs5(
|
|
1385
|
-
DndContext2,
|
|
1386
|
-
{
|
|
1387
|
-
sensors,
|
|
1388
|
-
onDragStart: handleDragStart,
|
|
1389
|
-
onDragEnd: handleDragEnd,
|
|
1390
|
-
onDragCancel: handleDragCancel,
|
|
1391
|
-
children: [
|
|
1392
|
-
/* @__PURE__ */ jsx5(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
|
|
1393
|
-
/* @__PURE__ */ jsx5(SortableContext2, { items, children: /* @__PURE__ */ jsx5(
|
|
1394
|
-
"ul",
|
|
1395
|
-
{
|
|
1396
|
-
role: "application",
|
|
1397
|
-
className: "flex list-inside list-none list-image-none flex-col p-0",
|
|
1398
|
-
children: items.map((item, index) => /* @__PURE__ */ jsx5(Fragment2, { children: renderItem(item, index) }, item.id))
|
|
1399
|
-
}
|
|
1400
|
-
) })
|
|
1401
|
-
]
|
|
1402
|
-
}
|
|
1403
|
-
);
|
|
1404
|
-
};
|
|
1405
|
-
var dropAnimationConfig2 = {
|
|
1406
|
-
sideEffects: defaultDropAnimationSideEffects2({
|
|
1407
|
-
styles: {
|
|
1408
|
-
active: {
|
|
1409
|
-
opacity: "0.4"
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
})
|
|
1413
|
-
};
|
|
1414
|
-
var Overlay = ({ children }) => {
|
|
1415
|
-
return /* @__PURE__ */ jsx5(
|
|
1416
|
-
DragOverlay2,
|
|
1417
|
-
{
|
|
1418
|
-
className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
|
|
1419
|
-
dropAnimation: dropAnimationConfig2,
|
|
1420
|
-
children
|
|
1421
|
-
}
|
|
1422
|
-
);
|
|
1423
|
-
};
|
|
1424
|
-
var SortableItemContext = createContext(null);
|
|
1425
|
-
var useSortableItemContext = () => {
|
|
1426
|
-
const context = useContext(SortableItemContext);
|
|
1427
|
-
if (!context) {
|
|
1428
|
-
throw new Error(
|
|
1429
|
-
"useSortableItemContext must be used within a SortableItemContext"
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
|
-
return context;
|
|
1433
|
-
};
|
|
1434
|
-
var Item = ({
|
|
1435
|
-
id,
|
|
1436
|
-
className,
|
|
1437
|
-
children
|
|
1438
|
-
}) => {
|
|
1439
|
-
const {
|
|
1440
|
-
attributes,
|
|
1441
|
-
isDragging,
|
|
1442
|
-
listeners,
|
|
1443
|
-
setNodeRef,
|
|
1444
|
-
setActivatorNodeRef,
|
|
1445
|
-
transform,
|
|
1446
|
-
transition
|
|
1447
|
-
} = useSortable2({ id });
|
|
1448
|
-
const context = useMemo2(
|
|
1449
|
-
() => ({
|
|
1450
|
-
attributes,
|
|
1451
|
-
listeners,
|
|
1452
|
-
ref: setActivatorNodeRef,
|
|
1453
|
-
isDragging
|
|
1454
|
-
}),
|
|
1455
|
-
[attributes, listeners, setActivatorNodeRef, isDragging]
|
|
1456
|
-
);
|
|
1457
|
-
const style = {
|
|
1458
|
-
opacity: isDragging ? 0.4 : void 0,
|
|
1459
|
-
transform: CSS2.Translate.toString(transform),
|
|
1460
|
-
transition
|
|
1461
|
-
};
|
|
1462
|
-
return /* @__PURE__ */ jsx5(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx5(
|
|
1463
|
-
"li",
|
|
1464
|
-
{
|
|
1465
|
-
className: clx2("transition-fg flex flex-1 list-none", className),
|
|
1466
|
-
ref: setNodeRef,
|
|
1467
|
-
style,
|
|
1468
|
-
children
|
|
1469
|
-
}
|
|
1470
|
-
) });
|
|
1471
|
-
};
|
|
1472
|
-
var DragHandle = () => {
|
|
1473
|
-
const { attributes, listeners, ref } = useSortableItemContext();
|
|
1474
|
-
return /* @__PURE__ */ jsx5(
|
|
1475
|
-
IconButton3,
|
|
1476
|
-
{
|
|
1477
|
-
variant: "transparent",
|
|
1478
|
-
size: "small",
|
|
1479
|
-
...attributes,
|
|
1480
|
-
...listeners,
|
|
1481
|
-
ref,
|
|
1482
|
-
className: "cursor-grab touch-none active:cursor-grabbing",
|
|
1483
|
-
children: /* @__PURE__ */ jsx5(DotsSix2, { className: "text-ui-fg-muted" })
|
|
1484
|
-
}
|
|
1485
|
-
);
|
|
1486
|
-
};
|
|
1487
|
-
var SortableList = Object.assign(List, {
|
|
1488
|
-
Item,
|
|
1489
|
-
DragHandle
|
|
1490
|
-
});
|
|
1491
|
-
|
|
1492
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1493
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1494
|
-
var ProductCreateVariantsSection = () => {
|
|
1495
|
-
const form = useTabbedForm();
|
|
1496
|
-
const { t } = useTranslation5();
|
|
1497
|
-
const variants = useFieldArray3({
|
|
1498
|
-
control: form.control,
|
|
1499
|
-
name: "variants"
|
|
1500
|
-
});
|
|
1501
|
-
const watchedAttributes = useWatch({
|
|
1502
|
-
control: form.control,
|
|
1503
|
-
name: "attributes",
|
|
1504
|
-
defaultValue: []
|
|
1505
|
-
});
|
|
1506
|
-
const watchedVariants = useWatch({
|
|
1507
|
-
control: form.control,
|
|
1508
|
-
name: "variants",
|
|
1509
|
-
defaultValue: []
|
|
1510
|
-
});
|
|
1511
|
-
const variantAxes = useMemo3(() => {
|
|
1512
|
-
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants).map((attr) => ({
|
|
1513
|
-
title: attr.title,
|
|
1514
|
-
values: Array.isArray(attr.values) ? attr.values : attr.values ? [attr.values] : []
|
|
1515
|
-
})).filter((axis) => axis.title && axis.values.length > 0);
|
|
1516
|
-
}, [watchedAttributes]);
|
|
1517
|
-
const hasVariantAxes = variantAxes.length > 0;
|
|
1518
|
-
const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
|
|
1519
|
-
const handleRankChange = (items) => {
|
|
1520
|
-
const update = items.map((item, index) => {
|
|
1521
|
-
const variant = watchedVariants.find((v) => v.title === item.title);
|
|
1522
|
-
return {
|
|
1523
|
-
id: item.id,
|
|
1524
|
-
...variant || item,
|
|
1525
|
-
variant_rank: index
|
|
1526
|
-
};
|
|
1527
|
-
});
|
|
1528
|
-
variants.replace(update);
|
|
1529
|
-
};
|
|
1530
|
-
const getCheckboxState = (variants2) => {
|
|
1531
|
-
if (variants2.every((variant) => variant.should_create)) {
|
|
1532
|
-
return true;
|
|
1533
|
-
}
|
|
1534
|
-
if (variants2.some((variant) => variant.should_create)) {
|
|
1535
|
-
return "indeterminate";
|
|
1536
|
-
}
|
|
1537
|
-
return false;
|
|
1538
|
-
};
|
|
1539
|
-
const onCheckboxChange = (value) => {
|
|
1540
|
-
switch (value) {
|
|
1541
|
-
case true: {
|
|
1542
|
-
const update = watchedVariants.map((variant) => ({
|
|
1543
|
-
...variant,
|
|
1544
|
-
should_create: true
|
|
1545
|
-
}));
|
|
1546
|
-
form.setValue("variants", update);
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
-
case false: {
|
|
1550
|
-
const update = watchedVariants.map((variant) => ({
|
|
1551
|
-
...variant,
|
|
1552
|
-
should_create: false
|
|
1553
|
-
}));
|
|
1554
|
-
form.setValue("variants", decorateVariantsWithDefaultValues(update));
|
|
1555
|
-
break;
|
|
1556
|
-
}
|
|
1557
|
-
case "indeterminate":
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
if (!hasVariantAxes) {
|
|
1562
|
-
return null;
|
|
1563
|
-
}
|
|
1564
|
-
return /* @__PURE__ */ jsxs6(
|
|
1565
|
-
"div",
|
|
1566
|
-
{
|
|
1567
|
-
id: "variants",
|
|
1568
|
-
className: "flex flex-col gap-y-8",
|
|
1569
|
-
"data-testid": "product-create-variants-section",
|
|
1570
|
-
children: [
|
|
1571
|
-
/* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx6(Heading2, { level: "h2", children: t("products.create.variants.header") }) }),
|
|
1572
|
-
/* @__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: [
|
|
1573
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
1574
|
-
/* @__PURE__ */ jsx6(Label2, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
|
|
1575
|
-
/* @__PURE__ */ jsx6(Hint2, { children: t("products.create.variants.productVariants.hint") })
|
|
1576
|
-
] }),
|
|
1577
|
-
showInvalidVariantsMessage && /* @__PURE__ */ jsx6(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.variants") }),
|
|
1578
|
-
variants.fields.length > 0 ? /* @__PURE__ */ jsxs6("div", { className: "overflow-hidden rounded-xl border", children: [
|
|
1579
|
-
/* @__PURE__ */ jsxs6(
|
|
1580
|
-
"div",
|
|
1581
|
-
{
|
|
1582
|
-
className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
|
|
1583
|
-
style: {
|
|
1584
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1585
|
-
},
|
|
1586
|
-
children: [
|
|
1587
|
-
/* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(
|
|
1588
|
-
Checkbox2,
|
|
1589
|
-
{
|
|
1590
|
-
className: "relative",
|
|
1591
|
-
checked: getCheckboxState(watchedVariants),
|
|
1592
|
-
onCheckedChange: onCheckboxChange
|
|
1593
|
-
}
|
|
1594
|
-
) }),
|
|
1595
|
-
/* @__PURE__ */ jsx6("div", {}),
|
|
1596
|
-
variantAxes.map((axis, index) => /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", weight: "plus", children: axis.title }) }, index))
|
|
1597
|
-
]
|
|
1598
|
-
}
|
|
1599
|
-
),
|
|
1600
|
-
/* @__PURE__ */ jsx6(
|
|
1601
|
-
SortableList,
|
|
1602
|
-
{
|
|
1603
|
-
items: variants.fields,
|
|
1604
|
-
onChange: handleRankChange,
|
|
1605
|
-
renderItem: (item, index) => {
|
|
1606
|
-
return /* @__PURE__ */ jsx6(
|
|
1607
|
-
SortableList.Item,
|
|
1608
|
-
{
|
|
1609
|
-
id: item.id,
|
|
1610
|
-
className: clx3("bg-ui-bg-base border-b", {
|
|
1611
|
-
"border-b-0": index === variants.fields.length - 1
|
|
1612
|
-
}),
|
|
1613
|
-
children: /* @__PURE__ */ jsxs6(
|
|
1614
|
-
"div",
|
|
1615
|
-
{
|
|
1616
|
-
className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
|
|
1617
|
-
style: {
|
|
1618
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1619
|
-
},
|
|
1620
|
-
children: [
|
|
1621
|
-
/* @__PURE__ */ jsx6(
|
|
1622
|
-
Form.Field,
|
|
1623
|
-
{
|
|
1624
|
-
control: form.control,
|
|
1625
|
-
name: `variants.${index}.should_create`,
|
|
1626
|
-
render: ({
|
|
1627
|
-
field: { value, onChange, ...field }
|
|
1628
|
-
}) => /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
|
|
1629
|
-
Checkbox2,
|
|
1630
|
-
{
|
|
1631
|
-
className: "relative",
|
|
1632
|
-
...field,
|
|
1633
|
-
checked: value,
|
|
1634
|
-
onCheckedChange: onChange
|
|
1635
|
-
}
|
|
1636
|
-
) }) })
|
|
1637
|
-
}
|
|
1638
|
-
),
|
|
1639
|
-
/* @__PURE__ */ jsx6(SortableList.DragHandle, {}),
|
|
1640
|
-
variantAxes.map((axis, i) => /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", children: item.options?.[axis.title] ?? "-" }, i))
|
|
1641
|
-
]
|
|
1642
|
-
}
|
|
1643
|
-
)
|
|
1644
|
-
}
|
|
1645
|
-
);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
)
|
|
1649
|
-
] }) : /* @__PURE__ */ jsx6(Alert, { children: t("products.create.variants.productVariants.alert") }),
|
|
1650
|
-
variants.fields.length > 0 && /* @__PURE__ */ jsx6(InlineTip2, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
|
|
1651
|
-
] }) })
|
|
1652
|
-
]
|
|
1653
|
-
}
|
|
1654
|
-
);
|
|
1655
|
-
};
|
|
1656
|
-
|
|
1657
1284
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
1658
|
-
import { jsx as
|
|
1285
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1659
1286
|
var Root2 = () => {
|
|
1660
|
-
return /* @__PURE__ */
|
|
1287
|
+
return /* @__PURE__ */ jsx5(
|
|
1661
1288
|
"div",
|
|
1662
1289
|
{
|
|
1663
1290
|
className: "flex flex-col items-center p-16",
|
|
1664
1291
|
"data-testid": "product-create-details-form",
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1292
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1666
1293
|
"div",
|
|
1667
1294
|
{
|
|
1668
1295
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1669
1296
|
"data-testid": "product-create-details-form-content",
|
|
1670
1297
|
children: [
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ jsx5(Header, {}),
|
|
1299
|
+
/* @__PURE__ */ jsxs5(
|
|
1673
1300
|
"div",
|
|
1674
1301
|
{
|
|
1675
1302
|
className: "flex flex-col gap-y-6",
|
|
1676
1303
|
"data-testid": "product-create-details-form-sections",
|
|
1677
1304
|
children: [
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
|
|
1306
|
+
/* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
|
|
1680
1307
|
]
|
|
1681
1308
|
}
|
|
1682
|
-
)
|
|
1683
|
-
/* @__PURE__ */ jsx7(ProductCreateVariantsSection, {})
|
|
1309
|
+
)
|
|
1684
1310
|
]
|
|
1685
1311
|
}
|
|
1686
1312
|
)
|
|
@@ -1694,24 +1320,24 @@ Root2._tabMeta = defineTabMeta({
|
|
|
1694
1320
|
});
|
|
1695
1321
|
var ProductCreateDetailsForm = Root2;
|
|
1696
1322
|
var Header = () => {
|
|
1697
|
-
const { t } =
|
|
1698
|
-
return /* @__PURE__ */
|
|
1323
|
+
const { t } = useTranslation5();
|
|
1324
|
+
return /* @__PURE__ */ jsx5(
|
|
1699
1325
|
"div",
|
|
1700
1326
|
{
|
|
1701
1327
|
className: "flex flex-col",
|
|
1702
1328
|
"data-testid": "product-create-details-form-header",
|
|
1703
|
-
children: /* @__PURE__ */
|
|
1329
|
+
children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
|
|
1704
1330
|
}
|
|
1705
1331
|
);
|
|
1706
1332
|
};
|
|
1707
1333
|
|
|
1708
1334
|
// src/pages/products/create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
|
|
1709
|
-
import { Heading as
|
|
1710
|
-
import { useTranslation as
|
|
1711
|
-
import { jsx as
|
|
1335
|
+
import { Heading as Heading3 } from "@medusajs/ui";
|
|
1336
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
1337
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1712
1338
|
var ProductCreateOrganizationSection = () => {
|
|
1713
1339
|
const form = useTabbedForm();
|
|
1714
|
-
const { t } =
|
|
1340
|
+
const { t } = useTranslation6();
|
|
1715
1341
|
const collections = useComboboxData({
|
|
1716
1342
|
queryKey: ["product_collections"],
|
|
1717
1343
|
queryFn: (params) => sdk.vendor.collections.query(params),
|
|
@@ -1736,9 +1362,9 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1736
1362
|
value: tag.id
|
|
1737
1363
|
}))
|
|
1738
1364
|
});
|
|
1739
|
-
return /* @__PURE__ */
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
|
|
1366
|
+
/* @__PURE__ */ jsx6(Heading3, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
|
|
1367
|
+
/* @__PURE__ */ jsx6(
|
|
1742
1368
|
SwitchBox,
|
|
1743
1369
|
{
|
|
1744
1370
|
control: form.control,
|
|
@@ -1748,15 +1374,15 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1748
1374
|
optional: true
|
|
1749
1375
|
}
|
|
1750
1376
|
),
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1377
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
|
|
1378
|
+
/* @__PURE__ */ jsx6(
|
|
1753
1379
|
Form.Field,
|
|
1754
1380
|
{
|
|
1755
1381
|
control: form.control,
|
|
1756
1382
|
name: "category_id",
|
|
1757
1383
|
render: ({ field }) => {
|
|
1758
|
-
return /* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1384
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
|
|
1385
|
+
/* @__PURE__ */ jsx6(
|
|
1760
1386
|
Form.Label,
|
|
1761
1387
|
{
|
|
1762
1388
|
tooltip: t("products.fields.primaryCategory.tooltip"),
|
|
@@ -1764,21 +1390,21 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1764
1390
|
children: t("fields.category")
|
|
1765
1391
|
}
|
|
1766
1392
|
),
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx6(SingleCategoryCombobox, { ...field }) }),
|
|
1394
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1769
1395
|
] });
|
|
1770
1396
|
}
|
|
1771
1397
|
}
|
|
1772
1398
|
),
|
|
1773
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ jsx6(
|
|
1774
1400
|
Form.Field,
|
|
1775
1401
|
{
|
|
1776
1402
|
control: form.control,
|
|
1777
1403
|
name: "collection_id",
|
|
1778
1404
|
render: ({ field }) => {
|
|
1779
|
-
return /* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1405
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
|
|
1406
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
|
|
1407
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx6(
|
|
1782
1408
|
Combobox,
|
|
1783
1409
|
{
|
|
1784
1410
|
...field,
|
|
@@ -1788,22 +1414,22 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1788
1414
|
fetchNextPage: collections.fetchNextPage
|
|
1789
1415
|
}
|
|
1790
1416
|
) }),
|
|
1791
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1792
1418
|
] });
|
|
1793
1419
|
}
|
|
1794
1420
|
}
|
|
1795
1421
|
)
|
|
1796
1422
|
] }),
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
|
|
1424
|
+
/* @__PURE__ */ jsx6(
|
|
1799
1425
|
Form.Field,
|
|
1800
1426
|
{
|
|
1801
1427
|
control: form.control,
|
|
1802
1428
|
name: "type_id",
|
|
1803
1429
|
render: ({ field }) => {
|
|
1804
|
-
return /* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
|
|
1431
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
|
|
1432
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx6(
|
|
1807
1433
|
Combobox,
|
|
1808
1434
|
{
|
|
1809
1435
|
...field,
|
|
@@ -1813,20 +1439,20 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1813
1439
|
fetchNextPage: types.fetchNextPage
|
|
1814
1440
|
}
|
|
1815
1441
|
) }),
|
|
1816
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1817
1443
|
] });
|
|
1818
1444
|
}
|
|
1819
1445
|
}
|
|
1820
1446
|
),
|
|
1821
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ jsx6(
|
|
1822
1448
|
Form.Field,
|
|
1823
1449
|
{
|
|
1824
1450
|
control: form.control,
|
|
1825
1451
|
name: "tags",
|
|
1826
1452
|
render: ({ field }) => {
|
|
1827
|
-
return /* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1453
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
|
|
1454
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
|
|
1455
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx6(
|
|
1830
1456
|
Combobox,
|
|
1831
1457
|
{
|
|
1832
1458
|
...field,
|
|
@@ -1836,7 +1462,7 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1836
1462
|
fetchNextPage: tags.fetchNextPage
|
|
1837
1463
|
}
|
|
1838
1464
|
) }),
|
|
1839
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1840
1466
|
] });
|
|
1841
1467
|
}
|
|
1842
1468
|
}
|
|
@@ -1846,19 +1472,19 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1846
1472
|
};
|
|
1847
1473
|
|
|
1848
1474
|
// src/pages/products/create/components/product-create-organize-form/product-create-organize-form.tsx
|
|
1849
|
-
import { jsx as
|
|
1475
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1850
1476
|
var Root3 = () => {
|
|
1851
|
-
return /* @__PURE__ */
|
|
1477
|
+
return /* @__PURE__ */ jsx7(
|
|
1852
1478
|
"div",
|
|
1853
1479
|
{
|
|
1854
1480
|
className: "flex flex-col items-center p-16",
|
|
1855
1481
|
"data-testid": "product-create-organize-form",
|
|
1856
|
-
children: /* @__PURE__ */
|
|
1482
|
+
children: /* @__PURE__ */ jsx7(
|
|
1857
1483
|
"div",
|
|
1858
1484
|
{
|
|
1859
1485
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1860
1486
|
"data-testid": "product-create-organize-form-content",
|
|
1861
|
-
children: /* @__PURE__ */
|
|
1487
|
+
children: /* @__PURE__ */ jsx7(ProductCreateOrganizationSection, {})
|
|
1862
1488
|
}
|
|
1863
1489
|
)
|
|
1864
1490
|
}
|
|
@@ -1885,30 +1511,33 @@ Root3._tabMeta = defineTabMeta({
|
|
|
1885
1511
|
var ProductCreateOrganizeForm = Root3;
|
|
1886
1512
|
|
|
1887
1513
|
// src/pages/products/create/components/product-create-variants-form/product-create-variants-form.tsx
|
|
1888
|
-
import {
|
|
1889
|
-
import {
|
|
1890
|
-
import {
|
|
1891
|
-
import {
|
|
1514
|
+
import { Input as Input3 } from "@medusajs/ui";
|
|
1515
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
1516
|
+
import { useWatch } from "react-hook-form";
|
|
1517
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1518
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1892
1519
|
var Root4 = () => {
|
|
1520
|
+
const { t } = useTranslation7();
|
|
1893
1521
|
const form = useTabbedForm();
|
|
1894
1522
|
const { setCloseOnEscape } = useRouteModal();
|
|
1895
|
-
const
|
|
1523
|
+
const [search, setSearch] = useState3("");
|
|
1524
|
+
const variants = useWatch({
|
|
1896
1525
|
control: form.control,
|
|
1897
1526
|
name: "variants",
|
|
1898
1527
|
defaultValue: []
|
|
1899
1528
|
});
|
|
1900
|
-
const watchedAttributes =
|
|
1529
|
+
const watchedAttributes = useWatch({
|
|
1901
1530
|
control: form.control,
|
|
1902
1531
|
name: "attributes",
|
|
1903
1532
|
defaultValue: []
|
|
1904
1533
|
});
|
|
1905
|
-
const variantAxes =
|
|
1534
|
+
const variantAxes = useMemo2(() => {
|
|
1906
1535
|
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants && attr.title).map((attr) => ({
|
|
1907
1536
|
title: attr.title
|
|
1908
1537
|
}));
|
|
1909
1538
|
}, [watchedAttributes]);
|
|
1910
1539
|
const columns = useColumns2({ variantAxes });
|
|
1911
|
-
const variantData =
|
|
1540
|
+
const variantData = useMemo2(() => {
|
|
1912
1541
|
const ret = [];
|
|
1913
1542
|
variants.forEach((v, i) => {
|
|
1914
1543
|
if (v.should_create) {
|
|
@@ -1917,20 +1546,56 @@ var Root4 = () => {
|
|
|
1917
1546
|
});
|
|
1918
1547
|
return ret;
|
|
1919
1548
|
}, [variants]);
|
|
1920
|
-
|
|
1549
|
+
const filteredVariantData = useMemo2(() => {
|
|
1550
|
+
const query = search.trim().toLowerCase();
|
|
1551
|
+
if (!query) {
|
|
1552
|
+
return variantData;
|
|
1553
|
+
}
|
|
1554
|
+
return variantData.filter((variant) => {
|
|
1555
|
+
const haystack = [
|
|
1556
|
+
variant.title,
|
|
1557
|
+
variant.sku,
|
|
1558
|
+
...Object.values(variant.options ?? {})
|
|
1559
|
+
];
|
|
1560
|
+
return haystack.some((value) => value?.toLowerCase().includes(query));
|
|
1561
|
+
});
|
|
1562
|
+
}, [variantData, search]);
|
|
1563
|
+
const headerContent = /* @__PURE__ */ jsx8(
|
|
1564
|
+
Input3,
|
|
1565
|
+
{
|
|
1566
|
+
type: "search",
|
|
1567
|
+
size: "small",
|
|
1568
|
+
autoComplete: "off",
|
|
1569
|
+
value: search,
|
|
1570
|
+
onChange: (event) => setSearch(event.target.value),
|
|
1571
|
+
placeholder: t(
|
|
1572
|
+
"products.create.variants.productVariants.searchPlaceholder"
|
|
1573
|
+
),
|
|
1574
|
+
"data-testid": "product-create-variants-search-input"
|
|
1575
|
+
}
|
|
1576
|
+
);
|
|
1577
|
+
return /* @__PURE__ */ jsx8(
|
|
1921
1578
|
"div",
|
|
1922
1579
|
{
|
|
1923
1580
|
className: "flex size-full flex-col divide-y overflow-hidden",
|
|
1924
1581
|
"data-testid": "product-create-variants-form",
|
|
1925
|
-
children: /* @__PURE__ */
|
|
1926
|
-
|
|
1582
|
+
children: /* @__PURE__ */ jsx8(
|
|
1583
|
+
"div",
|
|
1927
1584
|
{
|
|
1928
|
-
|
|
1929
|
-
data:
|
|
1930
|
-
|
|
1931
|
-
|
|
1585
|
+
className: "min-h-0 flex-1 overflow-hidden",
|
|
1586
|
+
"data-testid": "product-create-variants-form-datagrid",
|
|
1587
|
+
children: /* @__PURE__ */ jsx8(
|
|
1588
|
+
DataGrid,
|
|
1589
|
+
{
|
|
1590
|
+
columns,
|
|
1591
|
+
data: filteredVariantData,
|
|
1592
|
+
state: form,
|
|
1593
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing),
|
|
1594
|
+
headerContent
|
|
1595
|
+
}
|
|
1596
|
+
)
|
|
1932
1597
|
}
|
|
1933
|
-
)
|
|
1598
|
+
)
|
|
1934
1599
|
}
|
|
1935
1600
|
);
|
|
1936
1601
|
};
|
|
@@ -1944,14 +1609,14 @@ var columnHelper2 = createDataGridHelper();
|
|
|
1944
1609
|
var useColumns2 = ({
|
|
1945
1610
|
variantAxes
|
|
1946
1611
|
}) => {
|
|
1947
|
-
const { t } =
|
|
1948
|
-
return
|
|
1612
|
+
const { t } = useTranslation7();
|
|
1613
|
+
return useMemo2(
|
|
1949
1614
|
() => [
|
|
1950
1615
|
columnHelper2.column({
|
|
1951
1616
|
id: "attributes",
|
|
1952
|
-
header: () => /* @__PURE__ */
|
|
1617
|
+
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(" / ") }) }),
|
|
1953
1618
|
cell: (context) => {
|
|
1954
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ jsx8(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
|
|
1955
1620
|
},
|
|
1956
1621
|
disableHiding: true
|
|
1957
1622
|
}),
|
|
@@ -1962,7 +1627,7 @@ var useColumns2 = ({
|
|
|
1962
1627
|
field: (context) => `variants.${context.row.original.originalIndex}.title`,
|
|
1963
1628
|
type: "text",
|
|
1964
1629
|
cell: (context) => {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1630
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1966
1631
|
}
|
|
1967
1632
|
}),
|
|
1968
1633
|
columnHelper2.column({
|
|
@@ -1972,7 +1637,7 @@ var useColumns2 = ({
|
|
|
1972
1637
|
field: (context) => `variants.${context.row.original.originalIndex}.sku`,
|
|
1973
1638
|
type: "text",
|
|
1974
1639
|
cell: (context) => {
|
|
1975
|
-
return /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1976
1641
|
}
|
|
1977
1642
|
})
|
|
1978
1643
|
],
|
|
@@ -1981,13 +1646,13 @@ var useColumns2 = ({
|
|
|
1981
1646
|
};
|
|
1982
1647
|
|
|
1983
1648
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
1984
|
-
import { jsx as
|
|
1649
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1985
1650
|
var ProductCreateForm = ({
|
|
1986
1651
|
children,
|
|
1987
1652
|
schema,
|
|
1988
1653
|
defaultValues: extraDefaults
|
|
1989
1654
|
}) => {
|
|
1990
|
-
const { t } =
|
|
1655
|
+
const { t } = useTranslation8();
|
|
1991
1656
|
const { handleSuccess } = useRouteModal();
|
|
1992
1657
|
const form = useForm({
|
|
1993
1658
|
defaultValues: {
|
|
@@ -1999,7 +1664,7 @@ var ProductCreateForm = ({
|
|
|
1999
1664
|
const { mutateAsync, isPending } = useCreateProduct();
|
|
2000
1665
|
const { feature_flags } = useFeatureFlags();
|
|
2001
1666
|
const productRequestEnabled = !!feature_flags?.[import_types6.MercurFeatureFlags.PRODUCT_REQUEST];
|
|
2002
|
-
const watchedAttributes =
|
|
1667
|
+
const watchedAttributes = useWatch2({
|
|
2003
1668
|
control: form.control,
|
|
2004
1669
|
name: "attributes"
|
|
2005
1670
|
});
|
|
@@ -2012,7 +1677,7 @@ var ProductCreateForm = ({
|
|
|
2012
1677
|
if (JSON.stringify(newVariants.map((v) => v.options)) !== JSON.stringify(currentVariants.map((v) => v.options))) {
|
|
2013
1678
|
form.setValue("variants", newVariants);
|
|
2014
1679
|
}
|
|
2015
|
-
}, [watchedAttributes]);
|
|
1680
|
+
}, [watchedAttributes, form]);
|
|
2016
1681
|
const submitProduct = async (values, isDraftSubmission) => {
|
|
2017
1682
|
const media = values.media || [];
|
|
2018
1683
|
const payload = { ...values, media: void 0 };
|
|
@@ -2020,9 +1685,9 @@ var ProductCreateForm = ({
|
|
|
2020
1685
|
try {
|
|
2021
1686
|
const filesToUpload = media.map((m, i) => ({ file: m.file, isThumbnail: m.isThumbnail, index: i })).filter((m) => !!m.file);
|
|
2022
1687
|
if (filesToUpload.length) {
|
|
2023
|
-
const result = await
|
|
2024
|
-
filesToUpload.map(({ file }) =>
|
|
2025
|
-
);
|
|
1688
|
+
const result = await sdk.vendor.uploads.mutate({
|
|
1689
|
+
files: filesToUpload.map(({ file }) => file)
|
|
1690
|
+
});
|
|
2026
1691
|
const uploadedFiles = result?.files ?? [];
|
|
2027
1692
|
uploadedMedia = uploadedFiles.map((file, i) => ({
|
|
2028
1693
|
...file,
|
|
@@ -2070,29 +1735,29 @@ var ProductCreateForm = ({
|
|
|
2070
1735
|
}
|
|
2071
1736
|
await submitProduct(form.getValues(), true);
|
|
2072
1737
|
};
|
|
2073
|
-
const defaultTabs =
|
|
1738
|
+
const defaultTabs = useMemo3(
|
|
2074
1739
|
() => [
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsx9(ProductCreateDetailsForm, {}, "details"),
|
|
1741
|
+
/* @__PURE__ */ jsx9(ProductCreateOrganizeForm, {}, "organize"),
|
|
1742
|
+
/* @__PURE__ */ jsx9(ProductCreateAttributesForm, {}, "attributes"),
|
|
1743
|
+
/* @__PURE__ */ jsx9(ProductCreateVariantsForm, {}, "variants")
|
|
2079
1744
|
],
|
|
2080
1745
|
[]
|
|
2081
1746
|
);
|
|
2082
1747
|
const hasCustomChildren = Children.count(children) > 0;
|
|
2083
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsx9(
|
|
2084
1749
|
TabbedForm,
|
|
2085
1750
|
{
|
|
2086
1751
|
form,
|
|
2087
1752
|
onSubmit: handleSubmit,
|
|
2088
1753
|
isLoading: isPending,
|
|
2089
|
-
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */
|
|
1754
|
+
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs7(
|
|
2090
1755
|
"div",
|
|
2091
1756
|
{
|
|
2092
1757
|
className: "flex items-center justify-end gap-x-2",
|
|
2093
1758
|
"data-testid": "product-create-form-footer-actions",
|
|
2094
1759
|
children: [
|
|
2095
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ jsx9(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
2096
1761
|
Button3,
|
|
2097
1762
|
{
|
|
2098
1763
|
variant: "secondary",
|
|
@@ -2101,7 +1766,7 @@ var ProductCreateForm = ({
|
|
|
2101
1766
|
children: t("actions.cancel")
|
|
2102
1767
|
}
|
|
2103
1768
|
) }),
|
|
2104
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx9(
|
|
2105
1770
|
Button3,
|
|
2106
1771
|
{
|
|
2107
1772
|
variant: "secondary",
|
|
@@ -2114,7 +1779,7 @@ var ProductCreateForm = ({
|
|
|
2114
1779
|
children: t("actions.saveAsDraft")
|
|
2115
1780
|
}
|
|
2116
1781
|
),
|
|
2117
|
-
isLastTab ? /* @__PURE__ */
|
|
1782
|
+
isLastTab ? /* @__PURE__ */ jsx9(
|
|
2118
1783
|
Button3,
|
|
2119
1784
|
{
|
|
2120
1785
|
"data-name": "publish-button",
|
|
@@ -2126,7 +1791,7 @@ var ProductCreateForm = ({
|
|
|
2126
1791
|
children: t("actions.publish")
|
|
2127
1792
|
},
|
|
2128
1793
|
"submit-button"
|
|
2129
|
-
) : /* @__PURE__ */
|
|
1794
|
+
) : /* @__PURE__ */ jsx9(
|
|
2130
1795
|
Button3,
|
|
2131
1796
|
{
|
|
2132
1797
|
type: "button",
|
|
@@ -2147,13 +1812,13 @@ var ProductCreateForm = ({
|
|
|
2147
1812
|
};
|
|
2148
1813
|
|
|
2149
1814
|
// src/pages/products/create/product-create.tsx
|
|
2150
|
-
import { jsx as
|
|
1815
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2151
1816
|
var Root5 = ({ children }) => {
|
|
2152
|
-
const { t } =
|
|
2153
|
-
return /* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
Children2.count(children) > 0 ? children : /* @__PURE__ */
|
|
1817
|
+
const { t } = useTranslation9();
|
|
1818
|
+
return /* @__PURE__ */ jsxs8(RouteFocusModal, { children: [
|
|
1819
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.title") }) }),
|
|
1820
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.description") }) }),
|
|
1821
|
+
Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx10(ProductCreateForm, {})
|
|
2157
1822
|
] });
|
|
2158
1823
|
};
|
|
2159
1824
|
var ProductCreate = Root5;
|