@mercurjs/vendor 2.2.0-canary.9 → 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]-T5ECVBPF.js → [id]-3LNKC5OJ.js} +38 -39
- package/dist/{[id]-A55T2ORL.js → [id]-4HO4S2PX.js} +481 -473
- package/dist/{[id]-FWCX5PTI.js → [id]-4LIIFGET.js} +13 -13
- package/dist/{[id]-GBT6VB4S.js → [id]-5EECCIRP.js} +148 -57
- package/dist/{[id]-YPCO3DJV.js → [id]-5P5LTATX.js} +2 -2
- package/dist/{[id]-J6BZG5PU.js → [id]-AQUUZFRX.js} +9 -9
- package/dist/{[id]-QOEO3JOV.js → [id]-CUBGVODE.js} +175 -85
- package/dist/{[id]-QQU5HVFU.js → [id]-DCGPICT3.js} +36 -37
- package/dist/{[id]-GC3ZYPK4.js → [id]-DT5YJVKG.js} +32 -33
- package/dist/{[id]-SHAJTJNZ.js → [id]-IEBZ6V3W.js} +46 -46
- package/dist/{[id]-ZCMSBEVM.js → [id]-N7JEZFXQ.js} +6 -6
- package/dist/[id]-U6FKX5UQ.js +975 -0
- package/dist/{[id]-BC7IKQTQ.js → [id]-XB45DY2D.js} +18 -18
- package/dist/[id]-XP5KEMNX.js +602 -0
- package/dist/{[location_id]-NUBXDDJC.js → [location_id]-I4HHUHWY.js} +14 -14
- package/dist/{[province_id]-6GUA4PV5.js → [province_id]-OYX4MOCF.js} +31 -32
- package/dist/{add-NTRYWOJF.js → add-3T4GBFMM.js} +59 -56
- package/dist/{add-RU3WL4YB.js → add-RPRJWCYU.js} +63 -30
- package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-FB5T6PQN.js} +43 -42
- package/dist/{add-products-Q4MMDQKT.js → add-products-F243SWGD.js} +38 -40
- package/dist/{add-promotions-KD2CWQPF.js → add-promotions-TJDK7HLW.js} +17 -17
- package/dist/{add-to-campaign-QKYQCSR2.js → add-to-campaign-Q6OAJMUJ.js} +6 -6
- package/dist/{address-77Y3AOQ3.js → address-XVBSNMFU.js} +24 -25
- package/dist/{adjust-inventory-AFJLWF5R.js → adjust-inventory-IZLRMQXV.js} +4 -4
- package/dist/allocate-items-Q3VALDYT.js +685 -0
- package/dist/{areas-XUC5V5UO.js → areas-IYGBRCRH.js} +13 -13
- 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-FPWBT76A.js → breadcrumb-BXD3SRM7.js} +3 -3
- package/dist/{breadcrumb-PBR27GGX.js → breadcrumb-FEYGZFJU.js} +4 -4
- package/dist/{breadcrumb-KTARIL65.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-2XA2WOK7.js → breadcrumb-XEZCMI55.js} +2 -2
- package/dist/{breadcrumb-IK6XCQOQ.js → breadcrumb-XGXKCDYS.js} +4 -4
- package/dist/{breadcrumb-Y5UW3I4C.js → breadcrumb-YOY6Z36F.js} +2 -2
- package/dist/{campaigns-JAQTSA4Z.js → campaigns-DZKRNCA4.js} +7 -7
- package/dist/{categories-T4QJYX4R.js → categories-JZJA2IBQ.js} +11 -9
- package/dist/{chunk-3PMM6AMP.js → chunk-2KA4TGBQ.js} +2 -2
- package/dist/{chunk-X4GWB6AT.js → chunk-2NPD4S55.js} +4 -4
- package/dist/{chunk-M6GKMFTC.js → chunk-3ALBZK4M.js} +1 -1
- package/dist/{chunk-LKUW5SV4.js → chunk-3C2T27YW.js} +2 -2
- package/dist/{chunk-O7VOGTLX.js → chunk-3I6ZAMGN.js} +1 -1
- package/dist/{chunk-5QI3NDJG.js → chunk-3SH24DGG.js} +2 -2
- package/dist/{chunk-TF6V3TFG.js → chunk-3TST3EWQ.js} +2 -2
- package/dist/chunk-42R54Z2X.js +8 -0
- package/dist/{chunk-GAE6TKOR.js → chunk-4IRQSBA7.js} +5 -6
- package/dist/{chunk-LFX6WU4A.js → chunk-5ALC4Z2H.js} +0 -13
- package/dist/{chunk-VZUA5SRD.js → chunk-5BQO3YQP.js} +2 -2
- package/dist/{chunk-SPOHNK4X.js → chunk-5BYYDBLS.js} +7 -7
- package/dist/{chunk-4LVP635F.js → chunk-5FBQOAXU.js} +135 -126
- package/dist/{chunk-BXRNZS5K.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-Y2MQ5EMD.js → chunk-6FDPVW7Y.js} +12 -3
- package/dist/{chunk-6FUIK3PX.js → chunk-6Q3J6ZMM.js} +5 -5
- package/dist/{chunk-LARLBYU6.js → chunk-7BFQKYCJ.js} +2 -2
- package/dist/chunk-7EXKHL5L.js +30 -0
- package/dist/{chunk-M6N4ISXL.js → chunk-7MARNXFG.js} +1 -1
- package/dist/{chunk-TYESCFYW.js → chunk-AOLE7MBM.js} +1 -1
- package/dist/{chunk-TBYCZRZ7.js → chunk-BQHVM46E.js} +32 -55
- package/dist/{chunk-TW324MAT.js → chunk-CRYZK4NU.js} +2 -2
- package/dist/{chunk-463CNCJC.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-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-BER45EYD.js → chunk-FDKFUIYV.js} +1 -1
- package/dist/{chunk-JAUZ73XE.js → chunk-G6YNCIVF.js} +21 -61
- 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-2QTNCGKX.js → chunk-IEVN722X.js} +1 -1
- package/dist/{chunk-L4KBTV57.js → chunk-IMJ62GAP.js} +1 -3
- package/dist/{chunk-SGR4DMCW.js → chunk-INYLPVCG.js} +3 -3
- package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
- package/dist/{chunk-MZTDRBCR.js → chunk-JDNXS37G.js} +61 -62
- package/dist/{chunk-3B34B2M2.js → chunk-JJP6AKMV.js} +1 -1
- package/dist/{chunk-K6LOZ4S3.js → chunk-JK4M3ZKY.js} +5 -5
- package/dist/{chunk-VXMOPVRH.js → chunk-JR7AABT5.js} +2 -2
- package/dist/{chunk-DO4F5FIO.js → chunk-JTHDMXZV.js} +5 -5
- package/dist/{chunk-6K6EQOJF.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-VCOQ7WQ2.js → chunk-KG2NUK4J.js} +6 -6
- package/dist/{chunk-VXWN37PT.js → chunk-KIURBTC4.js} +1 -1
- package/dist/{chunk-BENED3NB.js → chunk-KTJLJTFO.js} +545 -891
- package/dist/{chunk-PZEPOPMV.js → chunk-KZQFIPY2.js} +178 -81
- package/dist/{chunk-DQKK43PR.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-7IPCLQ5V.js → chunk-MT6WOKIW.js} +4 -4
- package/dist/chunk-MUGQQY6P.js +315 -0
- package/dist/{chunk-S23FD6FA.js → chunk-MVEHWM7K.js} +1 -1
- package/dist/{chunk-VV6IKGCN.js → chunk-NTJ3BMOE.js} +1 -1
- package/dist/{chunk-DDJQRV6E.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-NBKWY6XN.js → chunk-RILHLBKW.js} +3 -3
- package/dist/{chunk-EIZP3XL5.js → chunk-RPU4UOQK.js} +1 -1
- package/dist/{chunk-53SII3U2.js → chunk-RTMMO6IU.js} +6 -6
- package/dist/{chunk-IBEUR3J7.js → chunk-S7NGDLZ3.js} +3 -3
- package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
- package/dist/chunk-SPFLYPY6.js +6 -0
- package/dist/{chunk-SZBERGA4.js → chunk-TJKZ5QCJ.js} +4 -4
- package/dist/{chunk-YUKD5RCX.js → chunk-TPGIMZLI.js} +1 -1
- package/dist/{chunk-YHIJCI4U.js → chunk-UNE4VD5U.js} +3 -3
- package/dist/chunk-UX5UYDCY.js +33 -0
- package/dist/{chunk-6UZERVBI.js → chunk-V5K6HISS.js} +2 -2
- 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-OZ44ATGE.js → chunk-WCXFUBEF.js} +15 -15
- package/dist/{chunk-YQZBAP3S.js → chunk-WFE6CT6M.js} +76 -22
- package/dist/{chunk-PAVZ6FPK.js → chunk-WFHGJGCW.js} +5 -4
- package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
- package/dist/{chunk-XCIMOIX6.js → chunk-XBKWFLJG.js} +1 -1
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/{chunk-6SJTAE66.js → chunk-Y4PM3IDZ.js} +1 -1
- package/dist/{chunk-JQV7CXEC.js → chunk-YNGA3GRX.js} +17 -2
- 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-7IYZ6GNP.js → configuration-FWZTMYXY.js} +5 -5
- package/dist/{create-MS6KKFSV.js → create-2RGNAVVY.js} +31 -32
- package/dist/{create-JF2OUZQA.js → create-32MXB6FD.js} +24 -25
- 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-A7B3MLJX.js → create-FHIFVCSG.js} +47 -47
- package/dist/{create-ODOFJF5N.js → create-GO7APBBU.js} +30 -31
- package/dist/{create-F5R76QML.js → create-HEZYB7RF.js} +24 -23
- package/dist/{create-R7K3ECN6.js → create-K26SM34L.js} +3 -3
- package/dist/{create-MZYXMGKP.js → create-N534JQPH.js} +13 -13
- package/dist/{create-FKRYB7ZS.js → create-NEK6JCKR.js} +65 -51
- package/dist/{create-YBF4YGWG.js → create-NF2LPVXA.js} +3 -3
- package/dist/{create-JGYG5SBM.js → create-PJVLJ7T6.js} +47 -44
- package/dist/{create-O35JRZEF.js → create-RPBHXU32.js} +28 -29
- package/dist/{create-SFU3W3ZH.js → create-U64NEOEL.js} +3 -3
- package/dist/{create-GGACODDN.js → create-VL7LDTVE.js} +53 -36
- package/dist/{create-XVHOCZHJ.js → create-X5SOAPD3.js} +3 -3
- package/dist/{create-TKXH5KQY.js → create-XLYGW5PN.js} +61 -37
- package/dist/{create-5PSOIHIT.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} +9 -9
- package/dist/{edit-Y2U3KAVB.js → edit-3DUCWSLA.js} +34 -30
- package/dist/{edit-ORXS3A2Y.js → edit-3V34KJS2.js} +3 -3
- package/dist/{edit-2R5QCPTB.js → edit-4PWAJ7A3.js} +25 -26
- package/dist/{edit-5CROKEJE.js → edit-7CLOJ3UZ.js} +48 -48
- 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-FXNXTVIW.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-G2E5SNGU.js → edit-SIKOSSHF.js} +24 -25
- package/dist/{edit-VVLITC2E.js → edit-TD7QFM4Z.js} +36 -75
- package/dist/{edit-C4OCKQVU.js → edit-UNN3QTEJ.js} +3 -3
- package/dist/{edit-HTLLYECP.js → edit-WEUFBORT.js} +33 -35
- package/dist/{edit-KAKVPHZZ.js → edit-WN2Q3TOX.js} +4 -4
- package/dist/{edit-3E4ZO7HT.js → edit-ZGAOUZYP.js} +33 -35
- package/dist/{edit-522DG3BY.js → edit-ZOLSAIKF.js} +3 -3
- package/dist/{edit-OKU6FMHJ.js → edit-ZORE6RUD.js} +25 -26
- package/dist/{edit-budget-L3CCEWNF.js → edit-budget-D22WMVYR.js} +3 -3
- package/dist/{edit-inventory-item-ZKXXL3QK.js → edit-inventory-item-QMYWEBZ3.js} +3 -3
- package/dist/{edit-inventory-item-attributes-GSKUMORD.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-G2L6LEVO.js → fulfillment-providers-CMU2JB5X.js} +39 -40
- package/dist/index.css +64 -33
- package/dist/index.js +334 -243
- package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-4JKLAZ2Q.js} +18 -18
- package/dist/{inventory-WSFLTA6Z.js → inventory-FKEXULLT.js} +8 -8
- package/dist/{invite-2673PU4I.js → invite-3R2CEWLN.js} +23 -24
- package/dist/{invite-HRXZ5YBP.js → invite-MNAX6EUC.js} +38 -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-XHH5DVIR.js → manage-locations-RWGDXXJQ.js} +3 -3
- package/dist/{media-J22P2DK4.js → media-P6WSFHY4.js} +31 -31
- package/dist/media-YB4G5CMV.js +316 -0
- package/dist/{metadata-Q74OJWUD.js → metadata-5Q6FLVX4.js} +27 -28
- package/dist/{metadata-D6M66NQK.js → metadata-6OYHLPLA.js} +25 -26
- package/dist/{metadata-YVHJPDLD.js → metadata-ADXGD4Y6.js} +25 -26
- package/dist/{metadata-REQIFWWH.js → metadata-J447GEBP.js} +27 -28
- package/dist/{metadata-NIDIBXJT.js → metadata-VTQ2CGZX.js} +27 -28
- package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-ACPKTNHA.js} +244 -265
- 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-MK2RIFD4.js → onboarding-TUGXFOA6.js} +23 -24
- package/dist/orders-PJSJNGZS.js +63 -0
- package/dist/{organization-XO3T2K2X.js → organization-YIOAVFHN.js} +26 -27
- package/dist/{organize-Z7JTTDH4.js → organize-BTA7NJD2.js} +4 -4
- package/dist/{organize-5XRZWD5C.js → organize-OWT5QSJR.js} +4 -4
- package/dist/pages/index.d.ts +232 -232
- package/dist/pages/index.js +81 -82
- package/dist/{payment-details-CFTX3QDL.js → payment-details-K2XFATEL.js} +24 -25
- package/dist/{payouts-7Q7D4FET.js → payouts-K5IDTJV3.js} +8 -8
- package/dist/{price-lists-6TFLA53G.js → price-lists-DNPIPDAW.js} +11 -11
- package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-5VUPPNKS.js} +21 -19
- package/dist/{pricing-ECXV6K7G.js → pricing-J5FIDZIY.js} +28 -29
- package/dist/{product-tags-5O7ZG6SA.js → product-tags-SJYIGXEV.js} +42 -42
- package/dist/{product-types-PKUEL7X5.js → product-types-4PTJW5DE.js} +8 -8
- package/dist/product-variant-detail-FO6J3RFA.js +371 -0
- package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-55TAIBZO.js} +45 -27
- package/dist/{products-BM3IIH5P.js → products-EQMANSO6.js} +39 -40
- package/dist/products-XM57LXJK.js +92 -0
- package/dist/{professional-details-ED4HNYXY.js → professional-details-WWZPTXSX.js} +24 -25
- package/dist/{profile-6TGCNNUU.js → profile-5IADQ727.js} +27 -28
- package/dist/{promotions-AZM7JQAJ.js → promotions-BYW6TZ5B.js} +10 -10
- package/dist/{receive-2GFZTVNC.js → receive-MTXKKPKZ.js} +62 -20
- package/dist/{refund-IGMSXQNX.js → refund-3IXGYA7W.js} +8 -8
- package/dist/{register-ADZCPWEV.js → register-U5PQZATC.js} +25 -26
- package/dist/{reset-password-RGWK33Q7.js → reset-password-SKUJJLSV.js} +3 -3
- package/dist/{return-reasons-QJRA2ZX6.js → return-reasons-QDPSIJG3.js} +16 -15
- package/dist/{sales-channels-U55MUDQP.js → sales-channels-GBSTCWVP.js} +10 -11
- package/dist/{sales-channels-CZDU7VTE.js → sales-channels-N4NE3FXP.js} +14 -15
- package/dist/{settings-2GCQQTO6.js → settings-ZUBBFS67.js} +49 -49
- package/dist/{shipment-HWQHMX2L.js → shipment-TKSCPC3M.js} +24 -25
- package/dist/shipping-DODEUYOQ.js +125 -0
- package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-O4JMJLN7.js} +5 -9
- package/dist/shipping-profiles-4TJ4IH6U.js +46 -0
- package/dist/{stock-MQA7PRO6.js → stock-GYK2GHJN.js} +27 -28
- package/dist/{store-5ZHZR4JI.js → store-XWOALZ5Q.js} +34 -35
- package/dist/{store-closure-H5WHV3LA.js → store-closure-46B3XZ2I.js} +24 -25
- package/dist/{store-select-PZS556FB.js → store-select-E77E3ZY7.js} +24 -25
- package/dist/{tax-regions-HDLBFZVG.js → tax-regions-S2LFRTMP.js} +9 -9
- package/dist/{team-CLKJCZNH.js → team-N2C5JPSU.js} +35 -36
- package/package.json +12 -12
- package/dist/[id]-B4YZTANM.js +0 -1571
- package/dist/[id]-FE5GYYVZ.js +0 -481
- 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
|
@@ -1,46 +1,48 @@
|
|
|
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-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
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-TBYCZRZ7.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
|
|
@@ -342,18 +297,7 @@ var useColumns = () => {
|
|
|
342
297
|
}),
|
|
343
298
|
columnHelper.accessor("is_required", {
|
|
344
299
|
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
|
-
},
|
|
300
|
+
cell: (info) => info.getValue() ? t("filters.radio.yes") : t("filters.radio.no"),
|
|
357
301
|
enableSorting: false
|
|
358
302
|
}),
|
|
359
303
|
columnHelper.accessor("type", {
|
|
@@ -374,7 +318,7 @@ var useColumns = () => {
|
|
|
374
318
|
id: "values",
|
|
375
319
|
header: t("attributes.fields.values"),
|
|
376
320
|
cell: ({ row }) => {
|
|
377
|
-
const values = row.original.values ?? [];
|
|
321
|
+
const values = row.original.type === "toggle" ? [] : row.original.values ?? [];
|
|
378
322
|
if (!values.length) {
|
|
379
323
|
return /* @__PURE__ */ jsx("span", { className: "text-ui-fg-muted", children: "-" });
|
|
380
324
|
}
|
|
@@ -443,6 +387,7 @@ var Root = () => {
|
|
|
443
387
|
variant: "secondary",
|
|
444
388
|
size: "small",
|
|
445
389
|
onClick: handleAddExisting,
|
|
390
|
+
"data-testid": "product-create-attributes-add-existing",
|
|
446
391
|
children: t("products.create.attributes.addExisting")
|
|
447
392
|
}
|
|
448
393
|
),
|
|
@@ -453,124 +398,150 @@ var Root = () => {
|
|
|
453
398
|
variant: "secondary",
|
|
454
399
|
size: "small",
|
|
455
400
|
onClick: handleCreateNew,
|
|
401
|
+
"data-testid": "product-create-attributes-create-new",
|
|
456
402
|
children: t("products.create.attributes.createNew")
|
|
457
403
|
}
|
|
458
404
|
)
|
|
459
405
|
] }),
|
|
460
406
|
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,
|
|
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,
|
|
509
426
|
{
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
"products.create.attributes.valuePlaceholder"
|
|
516
|
-
)
|
|
427
|
+
size: "xsmall",
|
|
428
|
+
weight: "plus",
|
|
429
|
+
className: "text-ui-fg-subtle",
|
|
430
|
+
htmlFor: `attributes.${index}.title`,
|
|
431
|
+
children: t("fields.title")
|
|
517
432
|
}
|
|
518
|
-
)
|
|
519
|
-
|
|
433
|
+
) }),
|
|
434
|
+
/* @__PURE__ */ jsx2(
|
|
435
|
+
Input,
|
|
520
436
|
{
|
|
521
|
-
...field2,
|
|
522
437
|
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
523
|
-
|
|
524
|
-
|
|
438
|
+
...form.register(
|
|
439
|
+
`attributes.${index}.title`
|
|
440
|
+
),
|
|
525
441
|
placeholder: t(
|
|
526
|
-
"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
|
+
}
|
|
527
486
|
)
|
|
528
487
|
}
|
|
529
|
-
)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
+
}
|
|
552
522
|
) })
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
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
|
+
),
|
|
574
545
|
/* @__PURE__ */ jsx2(RequiredAttributes, {})
|
|
575
546
|
] })
|
|
576
547
|
]
|
|
@@ -587,171 +558,183 @@ var SelectedAttributes = ({
|
|
|
587
558
|
({ field }) => !field.is_custom && !field.is_required && !!field.attribute_id
|
|
588
559
|
);
|
|
589
560
|
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,
|
|
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,
|
|
632
578
|
{
|
|
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")
|
|
579
|
+
size: "xsmall",
|
|
580
|
+
weight: "plus",
|
|
581
|
+
className: "text-ui-fg-subtle",
|
|
582
|
+
children: t("fields.title")
|
|
642
583
|
}
|
|
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,
|
|
584
|
+
) }),
|
|
585
|
+
/* @__PURE__ */ jsx2(
|
|
586
|
+
Input,
|
|
652
587
|
{
|
|
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
|
-
]
|
|
588
|
+
value: field.title,
|
|
589
|
+
disabled: true,
|
|
590
|
+
className: "bg-ui-bg-field-component",
|
|
591
|
+
"data-testid": `product-create-selected-attribute-title-${index}`
|
|
667
592
|
}
|
|
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,
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx2(
|
|
595
|
+
Label,
|
|
677
596
|
{
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
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,
|
|
605
|
+
{
|
|
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
|
+
}
|
|
684
623
|
)
|
|
685
624
|
}
|
|
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,
|
|
625
|
+
) : attrType === import_types.AttributeType.SINGLE_SELECT ? /* @__PURE__ */ jsx2(
|
|
626
|
+
Controller,
|
|
695
627
|
{
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
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
|
+
)
|
|
713
649
|
}
|
|
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,
|
|
650
|
+
) : attrType === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
651
|
+
Controller,
|
|
723
652
|
{
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
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
|
+
}
|
|
729
666
|
)
|
|
730
667
|
}
|
|
731
|
-
)
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
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
|
+
);
|
|
755
738
|
};
|
|
756
739
|
var RequiredAttributes = () => {
|
|
757
740
|
const { t } = useTranslation2();
|
|
@@ -768,73 +751,65 @@ var RequiredAttributes = () => {
|
|
|
768
751
|
useEffect2(() => {
|
|
769
752
|
if (!product_attributes) return;
|
|
770
753
|
const currentAttributes = form.getValues("attributes") || [];
|
|
771
|
-
const requiredIds = new Set(
|
|
754
|
+
const requiredIds = new Set(
|
|
755
|
+
product_attributes.map((a) => a.id)
|
|
756
|
+
);
|
|
772
757
|
const otherAttributes = currentAttributes.filter(
|
|
773
758
|
(a) => a.is_custom || !requiredIds.has(a.attribute_id ?? "")
|
|
774
759
|
);
|
|
775
|
-
const requiredAttributes = product_attributes.map(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
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
|
+
);
|
|
790
778
|
form.setValue("attributes", [...otherAttributes, ...requiredAttributes]);
|
|
791
|
-
}, [product_attributes]);
|
|
779
|
+
}, [product_attributes, form]);
|
|
792
780
|
if (!categoryId || !product_attributes?.length) return null;
|
|
793
781
|
const requiredEntries = attributes.map((attr, index) => ({ attr, index })).filter(({ attr }) => !attr.is_custom);
|
|
794
782
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
795
783
|
/* @__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
|
-
|
|
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
|
+
)
|
|
816
811
|
] });
|
|
817
812
|
};
|
|
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
813
|
var RequiredAttributeField = ({
|
|
839
814
|
attribute,
|
|
840
815
|
index
|
|
@@ -863,7 +838,7 @@ var RequiredAttributeField = ({
|
|
|
863
838
|
)
|
|
864
839
|
}
|
|
865
840
|
) }),
|
|
866
|
-
/* @__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)) })
|
|
867
842
|
]
|
|
868
843
|
}
|
|
869
844
|
) : attribute.type === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
@@ -877,10 +852,12 @@ var RequiredAttributeField = ({
|
|
|
877
852
|
value: v.name,
|
|
878
853
|
label: v.name
|
|
879
854
|
})) ?? [],
|
|
880
|
-
placeholder: t(
|
|
855
|
+
placeholder: t(
|
|
856
|
+
"products.create.attributes.selectValues"
|
|
857
|
+
)
|
|
881
858
|
}
|
|
882
859
|
) : attribute.type === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
883
|
-
|
|
860
|
+
Input,
|
|
884
861
|
{
|
|
885
862
|
...field,
|
|
886
863
|
ref,
|
|
@@ -890,26 +867,13 @@ var RequiredAttributeField = ({
|
|
|
890
867
|
"products.create.attributes.enterValuePlaceholder"
|
|
891
868
|
)
|
|
892
869
|
}
|
|
893
|
-
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */
|
|
894
|
-
|
|
870
|
+
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsx2(
|
|
871
|
+
Switch,
|
|
895
872
|
{
|
|
896
873
|
...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
|
-
]
|
|
874
|
+
className: "rtl:rotate-180",
|
|
875
|
+
checked: value === "true" || value === true,
|
|
876
|
+
onCheckedChange: (checked) => onChange(String(checked))
|
|
913
877
|
}
|
|
914
878
|
) : /* @__PURE__ */ jsx2(
|
|
915
879
|
Input,
|
|
@@ -934,8 +898,8 @@ var VariantAxisTip = ({ className }) => {
|
|
|
934
898
|
return /* @__PURE__ */ jsx2(
|
|
935
899
|
InlineTip,
|
|
936
900
|
{
|
|
937
|
-
label: t("products.create.attributes.tip"),
|
|
938
901
|
className,
|
|
902
|
+
label: t("products.create.attributes.tip"),
|
|
939
903
|
children: t("products.create.attributes.variantAxisTip")
|
|
940
904
|
}
|
|
941
905
|
);
|
|
@@ -948,8 +912,8 @@ Root._tabMeta = defineTabMeta({
|
|
|
948
912
|
var ProductCreateAttributesForm = Root;
|
|
949
913
|
|
|
950
914
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
951
|
-
import { Heading as
|
|
952
|
-
import { useTranslation as
|
|
915
|
+
import { Heading as Heading2 } from "@medusajs/ui";
|
|
916
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
953
917
|
|
|
954
918
|
// src/pages/products/create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
|
|
955
919
|
import { Input as Input2, Textarea as Textarea2 } from "@medusajs/ui";
|
|
@@ -1317,381 +1281,32 @@ function formatFileSize(bytes, decimalPlaces = 2) {
|
|
|
1317
1281
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
|
|
1318
1282
|
}
|
|
1319
1283
|
|
|
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
1284
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
1669
|
-
import { jsx as
|
|
1285
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1670
1286
|
var Root2 = () => {
|
|
1671
|
-
return /* @__PURE__ */
|
|
1287
|
+
return /* @__PURE__ */ jsx5(
|
|
1672
1288
|
"div",
|
|
1673
1289
|
{
|
|
1674
1290
|
className: "flex flex-col items-center p-16",
|
|
1675
1291
|
"data-testid": "product-create-details-form",
|
|
1676
|
-
children: /* @__PURE__ */
|
|
1292
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1677
1293
|
"div",
|
|
1678
1294
|
{
|
|
1679
1295
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1680
1296
|
"data-testid": "product-create-details-form-content",
|
|
1681
1297
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ jsx5(Header, {}),
|
|
1299
|
+
/* @__PURE__ */ jsxs5(
|
|
1684
1300
|
"div",
|
|
1685
1301
|
{
|
|
1686
1302
|
className: "flex flex-col gap-y-6",
|
|
1687
1303
|
"data-testid": "product-create-details-form-sections",
|
|
1688
1304
|
children: [
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
|
|
1306
|
+
/* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
|
|
1691
1307
|
]
|
|
1692
1308
|
}
|
|
1693
|
-
)
|
|
1694
|
-
/* @__PURE__ */ jsx7(ProductCreateVariantsSection, {})
|
|
1309
|
+
)
|
|
1695
1310
|
]
|
|
1696
1311
|
}
|
|
1697
1312
|
)
|
|
@@ -1705,24 +1320,24 @@ Root2._tabMeta = defineTabMeta({
|
|
|
1705
1320
|
});
|
|
1706
1321
|
var ProductCreateDetailsForm = Root2;
|
|
1707
1322
|
var Header = () => {
|
|
1708
|
-
const { t } =
|
|
1709
|
-
return /* @__PURE__ */
|
|
1323
|
+
const { t } = useTranslation5();
|
|
1324
|
+
return /* @__PURE__ */ jsx5(
|
|
1710
1325
|
"div",
|
|
1711
1326
|
{
|
|
1712
1327
|
className: "flex flex-col",
|
|
1713
1328
|
"data-testid": "product-create-details-form-header",
|
|
1714
|
-
children: /* @__PURE__ */
|
|
1329
|
+
children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
|
|
1715
1330
|
}
|
|
1716
1331
|
);
|
|
1717
1332
|
};
|
|
1718
1333
|
|
|
1719
1334
|
// 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
|
|
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";
|
|
1723
1338
|
var ProductCreateOrganizationSection = () => {
|
|
1724
1339
|
const form = useTabbedForm();
|
|
1725
|
-
const { t } =
|
|
1340
|
+
const { t } = useTranslation6();
|
|
1726
1341
|
const collections = useComboboxData({
|
|
1727
1342
|
queryKey: ["product_collections"],
|
|
1728
1343
|
queryFn: (params) => sdk.vendor.collections.query(params),
|
|
@@ -1747,9 +1362,9 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1747
1362
|
value: tag.id
|
|
1748
1363
|
}))
|
|
1749
1364
|
});
|
|
1750
|
-
return /* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__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(
|
|
1753
1368
|
SwitchBox,
|
|
1754
1369
|
{
|
|
1755
1370
|
control: form.control,
|
|
@@ -1759,15 +1374,15 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1759
1374
|
optional: true
|
|
1760
1375
|
}
|
|
1761
1376
|
),
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
/* @__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(
|
|
1764
1379
|
Form.Field,
|
|
1765
1380
|
{
|
|
1766
1381
|
control: form.control,
|
|
1767
1382
|
name: "category_id",
|
|
1768
1383
|
render: ({ field }) => {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1384
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
|
|
1385
|
+
/* @__PURE__ */ jsx6(
|
|
1771
1386
|
Form.Label,
|
|
1772
1387
|
{
|
|
1773
1388
|
tooltip: t("products.fields.primaryCategory.tooltip"),
|
|
@@ -1775,21 +1390,21 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1775
1390
|
children: t("fields.category")
|
|
1776
1391
|
}
|
|
1777
1392
|
),
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx6(SingleCategoryCombobox, { ...field }) }),
|
|
1394
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1780
1395
|
] });
|
|
1781
1396
|
}
|
|
1782
1397
|
}
|
|
1783
1398
|
),
|
|
1784
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ jsx6(
|
|
1785
1400
|
Form.Field,
|
|
1786
1401
|
{
|
|
1787
1402
|
control: form.control,
|
|
1788
1403
|
name: "collection_id",
|
|
1789
1404
|
render: ({ field }) => {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__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(
|
|
1793
1408
|
Combobox,
|
|
1794
1409
|
{
|
|
1795
1410
|
...field,
|
|
@@ -1799,22 +1414,22 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1799
1414
|
fetchNextPage: collections.fetchNextPage
|
|
1800
1415
|
}
|
|
1801
1416
|
) }),
|
|
1802
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1803
1418
|
] });
|
|
1804
1419
|
}
|
|
1805
1420
|
}
|
|
1806
1421
|
)
|
|
1807
1422
|
] }),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__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(
|
|
1810
1425
|
Form.Field,
|
|
1811
1426
|
{
|
|
1812
1427
|
control: form.control,
|
|
1813
1428
|
name: "type_id",
|
|
1814
1429
|
render: ({ field }) => {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
/* @__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(
|
|
1818
1433
|
Combobox,
|
|
1819
1434
|
{
|
|
1820
1435
|
...field,
|
|
@@ -1824,20 +1439,20 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1824
1439
|
fetchNextPage: types.fetchNextPage
|
|
1825
1440
|
}
|
|
1826
1441
|
) }),
|
|
1827
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1828
1443
|
] });
|
|
1829
1444
|
}
|
|
1830
1445
|
}
|
|
1831
1446
|
),
|
|
1832
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ jsx6(
|
|
1833
1448
|
Form.Field,
|
|
1834
1449
|
{
|
|
1835
1450
|
control: form.control,
|
|
1836
1451
|
name: "tags",
|
|
1837
1452
|
render: ({ field }) => {
|
|
1838
|
-
return /* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__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(
|
|
1841
1456
|
Combobox,
|
|
1842
1457
|
{
|
|
1843
1458
|
...field,
|
|
@@ -1847,7 +1462,7 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1847
1462
|
fetchNextPage: tags.fetchNextPage
|
|
1848
1463
|
}
|
|
1849
1464
|
) }),
|
|
1850
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1851
1466
|
] });
|
|
1852
1467
|
}
|
|
1853
1468
|
}
|
|
@@ -1857,19 +1472,19 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1857
1472
|
};
|
|
1858
1473
|
|
|
1859
1474
|
// src/pages/products/create/components/product-create-organize-form/product-create-organize-form.tsx
|
|
1860
|
-
import { jsx as
|
|
1475
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1861
1476
|
var Root3 = () => {
|
|
1862
|
-
return /* @__PURE__ */
|
|
1477
|
+
return /* @__PURE__ */ jsx7(
|
|
1863
1478
|
"div",
|
|
1864
1479
|
{
|
|
1865
1480
|
className: "flex flex-col items-center p-16",
|
|
1866
1481
|
"data-testid": "product-create-organize-form",
|
|
1867
|
-
children: /* @__PURE__ */
|
|
1482
|
+
children: /* @__PURE__ */ jsx7(
|
|
1868
1483
|
"div",
|
|
1869
1484
|
{
|
|
1870
1485
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1871
1486
|
"data-testid": "product-create-organize-form-content",
|
|
1872
|
-
children: /* @__PURE__ */
|
|
1487
|
+
children: /* @__PURE__ */ jsx7(ProductCreateOrganizationSection, {})
|
|
1873
1488
|
}
|
|
1874
1489
|
)
|
|
1875
1490
|
}
|
|
@@ -1896,30 +1511,33 @@ Root3._tabMeta = defineTabMeta({
|
|
|
1896
1511
|
var ProductCreateOrganizeForm = Root3;
|
|
1897
1512
|
|
|
1898
1513
|
// src/pages/products/create/components/product-create-variants-form/product-create-variants-form.tsx
|
|
1899
|
-
import {
|
|
1900
|
-
import {
|
|
1901
|
-
import {
|
|
1902
|
-
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";
|
|
1903
1519
|
var Root4 = () => {
|
|
1520
|
+
const { t } = useTranslation7();
|
|
1904
1521
|
const form = useTabbedForm();
|
|
1905
1522
|
const { setCloseOnEscape } = useRouteModal();
|
|
1906
|
-
const
|
|
1523
|
+
const [search, setSearch] = useState3("");
|
|
1524
|
+
const variants = useWatch({
|
|
1907
1525
|
control: form.control,
|
|
1908
1526
|
name: "variants",
|
|
1909
1527
|
defaultValue: []
|
|
1910
1528
|
});
|
|
1911
|
-
const watchedAttributes =
|
|
1529
|
+
const watchedAttributes = useWatch({
|
|
1912
1530
|
control: form.control,
|
|
1913
1531
|
name: "attributes",
|
|
1914
1532
|
defaultValue: []
|
|
1915
1533
|
});
|
|
1916
|
-
const variantAxes =
|
|
1534
|
+
const variantAxes = useMemo2(() => {
|
|
1917
1535
|
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants && attr.title).map((attr) => ({
|
|
1918
1536
|
title: attr.title
|
|
1919
1537
|
}));
|
|
1920
1538
|
}, [watchedAttributes]);
|
|
1921
1539
|
const columns = useColumns2({ variantAxes });
|
|
1922
|
-
const variantData =
|
|
1540
|
+
const variantData = useMemo2(() => {
|
|
1923
1541
|
const ret = [];
|
|
1924
1542
|
variants.forEach((v, i) => {
|
|
1925
1543
|
if (v.should_create) {
|
|
@@ -1928,20 +1546,56 @@ var Root4 = () => {
|
|
|
1928
1546
|
});
|
|
1929
1547
|
return ret;
|
|
1930
1548
|
}, [variants]);
|
|
1931
|
-
|
|
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(
|
|
1932
1578
|
"div",
|
|
1933
1579
|
{
|
|
1934
1580
|
className: "flex size-full flex-col divide-y overflow-hidden",
|
|
1935
1581
|
"data-testid": "product-create-variants-form",
|
|
1936
|
-
children: /* @__PURE__ */
|
|
1937
|
-
|
|
1582
|
+
children: /* @__PURE__ */ jsx8(
|
|
1583
|
+
"div",
|
|
1938
1584
|
{
|
|
1939
|
-
|
|
1940
|
-
data:
|
|
1941
|
-
|
|
1942
|
-
|
|
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
|
+
)
|
|
1943
1597
|
}
|
|
1944
|
-
)
|
|
1598
|
+
)
|
|
1945
1599
|
}
|
|
1946
1600
|
);
|
|
1947
1601
|
};
|
|
@@ -1955,14 +1609,14 @@ var columnHelper2 = createDataGridHelper();
|
|
|
1955
1609
|
var useColumns2 = ({
|
|
1956
1610
|
variantAxes
|
|
1957
1611
|
}) => {
|
|
1958
|
-
const { t } =
|
|
1959
|
-
return
|
|
1612
|
+
const { t } = useTranslation7();
|
|
1613
|
+
return useMemo2(
|
|
1960
1614
|
() => [
|
|
1961
1615
|
columnHelper2.column({
|
|
1962
1616
|
id: "attributes",
|
|
1963
|
-
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(" / ") }) }),
|
|
1964
1618
|
cell: (context) => {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ jsx8(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
|
|
1966
1620
|
},
|
|
1967
1621
|
disableHiding: true
|
|
1968
1622
|
}),
|
|
@@ -1973,7 +1627,7 @@ var useColumns2 = ({
|
|
|
1973
1627
|
field: (context) => `variants.${context.row.original.originalIndex}.title`,
|
|
1974
1628
|
type: "text",
|
|
1975
1629
|
cell: (context) => {
|
|
1976
|
-
return /* @__PURE__ */
|
|
1630
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1977
1631
|
}
|
|
1978
1632
|
}),
|
|
1979
1633
|
columnHelper2.column({
|
|
@@ -1983,7 +1637,7 @@ var useColumns2 = ({
|
|
|
1983
1637
|
field: (context) => `variants.${context.row.original.originalIndex}.sku`,
|
|
1984
1638
|
type: "text",
|
|
1985
1639
|
cell: (context) => {
|
|
1986
|
-
return /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1987
1641
|
}
|
|
1988
1642
|
})
|
|
1989
1643
|
],
|
|
@@ -1992,13 +1646,13 @@ var useColumns2 = ({
|
|
|
1992
1646
|
};
|
|
1993
1647
|
|
|
1994
1648
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
1995
|
-
import { jsx as
|
|
1649
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1996
1650
|
var ProductCreateForm = ({
|
|
1997
1651
|
children,
|
|
1998
1652
|
schema,
|
|
1999
1653
|
defaultValues: extraDefaults
|
|
2000
1654
|
}) => {
|
|
2001
|
-
const { t } =
|
|
1655
|
+
const { t } = useTranslation8();
|
|
2002
1656
|
const { handleSuccess } = useRouteModal();
|
|
2003
1657
|
const form = useForm({
|
|
2004
1658
|
defaultValues: {
|
|
@@ -2010,7 +1664,7 @@ var ProductCreateForm = ({
|
|
|
2010
1664
|
const { mutateAsync, isPending } = useCreateProduct();
|
|
2011
1665
|
const { feature_flags } = useFeatureFlags();
|
|
2012
1666
|
const productRequestEnabled = !!feature_flags?.[import_types6.MercurFeatureFlags.PRODUCT_REQUEST];
|
|
2013
|
-
const watchedAttributes =
|
|
1667
|
+
const watchedAttributes = useWatch2({
|
|
2014
1668
|
control: form.control,
|
|
2015
1669
|
name: "attributes"
|
|
2016
1670
|
});
|
|
@@ -2023,7 +1677,7 @@ var ProductCreateForm = ({
|
|
|
2023
1677
|
if (JSON.stringify(newVariants.map((v) => v.options)) !== JSON.stringify(currentVariants.map((v) => v.options))) {
|
|
2024
1678
|
form.setValue("variants", newVariants);
|
|
2025
1679
|
}
|
|
2026
|
-
}, [watchedAttributes]);
|
|
1680
|
+
}, [watchedAttributes, form]);
|
|
2027
1681
|
const submitProduct = async (values, isDraftSubmission) => {
|
|
2028
1682
|
const media = values.media || [];
|
|
2029
1683
|
const payload = { ...values, media: void 0 };
|
|
@@ -2031,9 +1685,9 @@ var ProductCreateForm = ({
|
|
|
2031
1685
|
try {
|
|
2032
1686
|
const filesToUpload = media.map((m, i) => ({ file: m.file, isThumbnail: m.isThumbnail, index: i })).filter((m) => !!m.file);
|
|
2033
1687
|
if (filesToUpload.length) {
|
|
2034
|
-
const result = await
|
|
2035
|
-
filesToUpload.map(({ file }) =>
|
|
2036
|
-
);
|
|
1688
|
+
const result = await sdk.vendor.uploads.mutate({
|
|
1689
|
+
files: filesToUpload.map(({ file }) => file)
|
|
1690
|
+
});
|
|
2037
1691
|
const uploadedFiles = result?.files ?? [];
|
|
2038
1692
|
uploadedMedia = uploadedFiles.map((file, i) => ({
|
|
2039
1693
|
...file,
|
|
@@ -2081,29 +1735,29 @@ var ProductCreateForm = ({
|
|
|
2081
1735
|
}
|
|
2082
1736
|
await submitProduct(form.getValues(), true);
|
|
2083
1737
|
};
|
|
2084
|
-
const defaultTabs =
|
|
1738
|
+
const defaultTabs = useMemo3(
|
|
2085
1739
|
() => [
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsx9(ProductCreateDetailsForm, {}, "details"),
|
|
1741
|
+
/* @__PURE__ */ jsx9(ProductCreateOrganizeForm, {}, "organize"),
|
|
1742
|
+
/* @__PURE__ */ jsx9(ProductCreateAttributesForm, {}, "attributes"),
|
|
1743
|
+
/* @__PURE__ */ jsx9(ProductCreateVariantsForm, {}, "variants")
|
|
2090
1744
|
],
|
|
2091
1745
|
[]
|
|
2092
1746
|
);
|
|
2093
1747
|
const hasCustomChildren = Children.count(children) > 0;
|
|
2094
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsx9(
|
|
2095
1749
|
TabbedForm,
|
|
2096
1750
|
{
|
|
2097
1751
|
form,
|
|
2098
1752
|
onSubmit: handleSubmit,
|
|
2099
1753
|
isLoading: isPending,
|
|
2100
|
-
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */
|
|
1754
|
+
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs7(
|
|
2101
1755
|
"div",
|
|
2102
1756
|
{
|
|
2103
1757
|
className: "flex items-center justify-end gap-x-2",
|
|
2104
1758
|
"data-testid": "product-create-form-footer-actions",
|
|
2105
1759
|
children: [
|
|
2106
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ jsx9(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
2107
1761
|
Button3,
|
|
2108
1762
|
{
|
|
2109
1763
|
variant: "secondary",
|
|
@@ -2112,7 +1766,7 @@ var ProductCreateForm = ({
|
|
|
2112
1766
|
children: t("actions.cancel")
|
|
2113
1767
|
}
|
|
2114
1768
|
) }),
|
|
2115
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx9(
|
|
2116
1770
|
Button3,
|
|
2117
1771
|
{
|
|
2118
1772
|
variant: "secondary",
|
|
@@ -2125,7 +1779,7 @@ var ProductCreateForm = ({
|
|
|
2125
1779
|
children: t("actions.saveAsDraft")
|
|
2126
1780
|
}
|
|
2127
1781
|
),
|
|
2128
|
-
isLastTab ? /* @__PURE__ */
|
|
1782
|
+
isLastTab ? /* @__PURE__ */ jsx9(
|
|
2129
1783
|
Button3,
|
|
2130
1784
|
{
|
|
2131
1785
|
"data-name": "publish-button",
|
|
@@ -2137,7 +1791,7 @@ var ProductCreateForm = ({
|
|
|
2137
1791
|
children: t("actions.publish")
|
|
2138
1792
|
},
|
|
2139
1793
|
"submit-button"
|
|
2140
|
-
) : /* @__PURE__ */
|
|
1794
|
+
) : /* @__PURE__ */ jsx9(
|
|
2141
1795
|
Button3,
|
|
2142
1796
|
{
|
|
2143
1797
|
type: "button",
|
|
@@ -2158,13 +1812,13 @@ var ProductCreateForm = ({
|
|
|
2158
1812
|
};
|
|
2159
1813
|
|
|
2160
1814
|
// src/pages/products/create/product-create.tsx
|
|
2161
|
-
import { jsx as
|
|
1815
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2162
1816
|
var Root5 = ({ children }) => {
|
|
2163
|
-
const { t } =
|
|
2164
|
-
return /* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
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, {})
|
|
2168
1822
|
] });
|
|
2169
1823
|
};
|
|
2170
1824
|
var ProductCreate = Root5;
|