@mercurjs/vendor 2.2.0-canary.2 → 2.2.0-canary.21
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]-KRLGIVLR.js → [id]-3JICOSAI.js} +133 -41
- package/dist/[id]-CR76L5TG.js +3102 -0
- package/dist/{[id]-7BAKUHUO.js → [id]-DDGHFRSB.js} +5 -5
- package/dist/{[id]-KVWYLDN3.js → [id]-E7DYRMMO.js} +162 -71
- package/dist/{[id]-4OBGG7OH.js → [id]-FIP4UMQ4.js} +197 -105
- package/dist/{[id]-3EC6HYXL.js → [id]-FZRXOJWL.js} +22 -21
- package/dist/{[id]-ZWWMJAKI.js → [id]-PD3ISUL5.js} +7 -7
- package/dist/{[id]-UUUQK22M.js → [id]-Q5AXQ5XO.js} +460 -581
- package/dist/{[id]-KJIQTFGE.js → [id]-VSNA6SV5.js} +15 -15
- package/dist/{[id]-Y2ISCLUD.js → [id]-XUKQKCDN.js} +3 -3
- package/dist/{[id]-K2CT7BXQ.js → [id]-YPCO3DJV.js} +1 -1
- package/dist/{[id]-LUFRJLAU.js → [id]-ZEFQ7FQQ.js} +36 -33
- package/dist/{[id]-COLO4TQJ.js → [id]-ZW7TBWDU.js} +24 -23
- package/dist/{[province_id]-H2QAPKVH.js → [province_id]-CHOO7ERP.js} +14 -14
- package/dist/{add-FIWTANZX.js → add-GYXNRUAE.js} +40 -37
- package/dist/{add-PBZQCIZQ.js → add-IC5R27X3.js} +95 -32
- package/dist/{add-customer-groups-RAHCP67U.js → add-customer-groups-KIGBZT5G.js} +20 -23
- package/dist/{add-products-N3V2MVLD.js → add-products-ALJVIFXU.js} +23 -22
- package/dist/{add-promotions-CSCAJZHV.js → add-promotions-EQ5MMQKG.js} +8 -8
- package/dist/{add-to-campaign-DLP7PSQB.js → add-to-campaign-C6JDNB6F.js} +4 -4
- package/dist/{address-7F5SN7PV.js → address-UKLDTSTP.js} +13 -13
- package/dist/{adjust-inventory-SZF4W7LR.js → adjust-inventory-5XPGE44Y.js} +2 -2
- package/dist/allocate-items-URVRAFPS.js +685 -0
- package/dist/{areas-7Y6BVS5A.js → areas-64VXOFYS.js} +6 -6
- package/dist/{attributes-MBZ76HVZ.js → attributes-YQNW5JBY.js} +2 -2
- package/dist/{breadcrumb-HND5FFWC.js → breadcrumb-26G7BS3Q.js} +3 -3
- package/dist/{breadcrumb-7PURSRTT.js → breadcrumb-2AYN2SV7.js} +12 -12
- package/dist/{breadcrumb-ZCG2RHIU.js → breadcrumb-4KKLMVC3.js} +12 -12
- package/dist/{breadcrumb-WRG4SITG.js → breadcrumb-4XSHX5RV.js} +13 -13
- package/dist/{breadcrumb-QV2IAX7N.js → breadcrumb-E5OF4L2J.js} +2 -2
- package/dist/breadcrumb-JC5FUQYF.js +28 -0
- package/dist/{breadcrumb-YBBYFQYG.js → breadcrumb-LBO2I4OJ.js} +1 -1
- package/dist/breadcrumb-PIDJ23EZ.js +13 -0
- package/dist/{breadcrumb-65SAGUUL.js → breadcrumb-RWYEU5JK.js} +3 -3
- package/dist/{breadcrumb-VWELWDB2.js → breadcrumb-VXKAO6GP.js} +1 -1
- package/dist/{breadcrumb-FLDHJRVY.js → breadcrumb-WMNG4P6C.js} +9 -8
- package/dist/{breadcrumb-EDPMEN2P.js → breadcrumb-XPQETVMM.js} +2 -2
- package/dist/{campaigns-L6ULR6KR.js → campaigns-4I2T6EDZ.js} +5 -5
- package/dist/{categories-FUZQKBXV.js → categories-3P2DRH5V.js} +10 -8
- package/dist/{chunk-EZ3JOAUS.js → chunk-22CIYLKO.js} +1 -1
- package/dist/{chunk-RZLN2Q6G.js → chunk-247L47JD.js} +1 -1
- package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
- package/dist/{chunk-M7KSRYRI.js → chunk-2ECD67FO.js} +2 -2
- package/dist/{chunk-36L54SQQ.js → chunk-2H4FGZ4U.js} +1 -1
- package/dist/{chunk-X2FVFUET.js → chunk-2NUZTTBU.js} +27 -8
- package/dist/chunk-2OY4NW7L.js +185 -0
- package/dist/{chunk-K4X324QP.js → chunk-36WXPGD2.js} +6 -5
- package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
- package/dist/chunk-3EDZQSKG.js +33 -0
- package/dist/{chunk-2DXNJURE.js → chunk-3L2DVCOC.js} +1 -1
- package/dist/chunk-42R54Z2X.js +8 -0
- package/dist/{chunk-CNMY5HVP.js → chunk-4EQIJMQT.js} +3 -3
- package/dist/{chunk-UAF2S447.js → chunk-4OIOYUQE.js} +3 -3
- package/dist/{chunk-UORPTGV2.js → chunk-4R5GESED.js} +10 -14
- package/dist/{chunk-WUPJADSO.js → chunk-4RFPRO2W.js} +2 -2
- package/dist/chunk-4YWKKCTT.js +32 -0
- package/dist/{chunk-XFQJU6FA.js → chunk-5QG6P6EU.js} +1 -1
- package/dist/{chunk-N4MVIBFM.js → chunk-5Y6RDTW2.js} +3 -3
- package/dist/{chunk-DZIXC7OE.js → chunk-6FLSBL4Q.js} +30 -85
- package/dist/{chunk-DVEKYLPV.js → chunk-6QS6IZC6.js} +1 -1
- package/dist/chunk-6ZGQ3SOR.js +127 -0
- package/dist/{chunk-NXNJQZCP.js → chunk-7FIPNQM2.js} +1 -1
- package/dist/{chunk-NSZQERLE.js → chunk-7GGWRJJF.js} +2 -2
- package/dist/{chunk-QS6RWIBL.js → chunk-7RGUD6PI.js} +34 -20
- package/dist/{chunk-5L2DCA4W.js → chunk-7ZPJGL4C.js} +57 -6
- package/dist/{chunk-KD7RYE6R.js → chunk-AG6KIAUD.js} +2 -2
- package/dist/{chunk-UCQKXXLD.js → chunk-AKKIZD2P.js} +32 -34
- package/dist/chunk-CHBURL76.js +438 -0
- package/dist/{chunk-PBD36EZJ.js → chunk-CI4YXVQF.js} +2 -2
- package/dist/{chunk-7LBY5JLV.js → chunk-DAV7WS53.js} +1 -1
- package/dist/{chunk-6BS2AVGJ.js → chunk-DNXMONCL.js} +6 -6
- package/dist/{chunk-TNVYTMBL.js → chunk-E4O5PARZ.js} +4 -4
- package/dist/{chunk-L7QKFC5N.js → chunk-E6W57UP3.js} +32 -122
- package/dist/chunk-EEBJYXWA.js +15 -0
- package/dist/chunk-FP6U6BPH.js +61 -0
- package/dist/{chunk-SGR4DMCW.js → chunk-FRYZRBLA.js} +1 -1
- package/dist/chunk-FWPGOIFA.js +22 -0
- package/dist/chunk-GL7F6NDU.js +30 -0
- package/dist/chunk-H7BVANDX.js +407 -0
- package/dist/{chunk-FDR22JMM.js → chunk-HFRHHT36.js} +8 -63
- package/dist/{chunk-FJUUGFXL.js → chunk-HOUDNM5M.js} +1 -1
- package/dist/{chunk-6Y53VZ3C.js → chunk-HZCSJLGH.js} +11 -11
- package/dist/chunk-I75SROQZ.js +315 -0
- package/dist/{chunk-JQV7CXEC.js → chunk-II3ACSV2.js} +17 -2
- package/dist/{chunk-DARJTN4I.js → chunk-IMJ62GAP.js} +10 -5
- package/dist/{chunk-PPLC4IKI.js → chunk-IV57G2CB.js} +14 -1
- package/dist/{chunk-7SLWXX6L.js → chunk-J434WDD3.js} +5 -6
- package/dist/chunk-J6XCRFBW.js +30 -0
- package/dist/{chunk-KAZ5BYTQ.js → chunk-KCHYLLVG.js} +6 -4
- package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
- package/dist/{chunk-GXIAIITP.js → chunk-KZYRC3WR.js} +36 -39
- package/dist/chunk-L57USMYC.js +39 -0
- package/dist/chunk-LFX6WU4A.js +36 -0
- package/dist/{chunk-EROX26D4.js → chunk-LRMWYKSF.js} +1 -1
- package/dist/{chunk-LWJF63JW.js → chunk-LTQQRVZG.js} +89 -14
- package/dist/chunk-LYYM7H7H.js +59 -0
- package/dist/{chunk-NHFEY3EI.js → chunk-M3YUT5AY.js} +2 -2
- package/dist/{chunk-H6LZ77GX.js → chunk-MJCL3WID.js} +1 -1
- package/dist/{chunk-X4INVIWL.js → chunk-MZRZVLWD.js} +3 -3
- package/dist/{chunk-DDH7ULIQ.js → chunk-N6MGVXXQ.js} +1 -1
- package/dist/{chunk-QXLRABYH.js → chunk-O7VOGTLX.js} +1 -1
- package/dist/{chunk-35G3SZRN.js → chunk-P3SOE76R.js} +1 -1
- package/dist/{chunk-PZ44R4AS.js → chunk-P7Q5ZSZD.js} +1 -1
- package/dist/{chunk-5ATEALH7.js → chunk-PFJFS3F4.js} +1 -5
- package/dist/chunk-POOTMH3K.js +62 -0
- package/dist/{chunk-GGWUWT55.js → chunk-QJI4OET7.js} +23 -36
- package/dist/{chunk-NJMNYS7G.js → chunk-QS35HWC5.js} +1 -1
- package/dist/{chunk-RTBNJQOV.js → chunk-R4JLYNUA.js} +419 -538
- package/dist/{chunk-DIW4GRTI.js → chunk-RT3G3GEK.js} +47 -31
- package/dist/{chunk-QT7YFHCA.js → chunk-S23FD6FA.js} +12 -0
- package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
- package/dist/chunk-SPFLYPY6.js +6 -0
- package/dist/{chunk-EIUYXS7E.js → chunk-SZBERGA4.js} +1 -1
- package/dist/chunk-T6DSYOY5.js +173 -0
- package/dist/{chunk-4LVP635F.js → chunk-TKSKCYM3.js} +128 -126
- package/dist/{chunk-QNNJN4H6.js → chunk-TSTUAL6N.js} +59 -0
- package/dist/{chunk-LNM2D2I4.js → chunk-TZMNEN7A.js} +7 -6
- package/dist/chunk-UM7ZR3VU.js +14 -0
- package/dist/{chunk-X22KTLZ7.js → chunk-UO6IX5Y7.js} +1 -1
- package/dist/chunk-VCUUITW6.js +35 -0
- package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
- package/dist/{chunk-AIF2KTEE.js → chunk-WKRW5OPL.js} +12 -2
- package/dist/{chunk-6YA3C4NB.js → chunk-XBKWFLJG.js} +4 -13
- package/dist/{chunk-WBHFU3MG.js → chunk-XJYQ4SW5.js} +2 -2
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/chunk-YBF45CX5.js +23 -0
- package/dist/{chunk-AVOIZO63.js → chunk-YQZBAP3S.js} +4 -2
- package/dist/chunk-ZHFFTT3I.js +17 -0
- package/dist/{chunk-TODJFRLH.js → chunk-ZHR77OQI.js} +2 -2
- package/dist/chunk-ZUHIKMQL.js +353 -0
- package/dist/{chunk-44RQ5PTN.js → chunk-ZZIJSTXN.js} +225 -90
- package/dist/{collections-YCAAFGSW.js → collections-7M7O23NO.js} +28 -26
- package/dist/{configuration-UOSNP45I.js → configuration-5IDQRYJQ.js} +4 -4
- package/dist/{configuration-C4IGBNXH.js → configuration-TXRAYMI4.js} +1 -1
- package/dist/{create-BJ4OO6LS.js → create-2N73Y6FO.js} +14 -14
- package/dist/{create-R7K3ECN6.js → create-3MUVY3UY.js} +1 -1
- package/dist/{create-SFU3W3ZH.js → create-6DRXGPYA.js} +1 -1
- package/dist/{create-XAD5NMSJ.js → create-6KM5AZCG.js} +20 -20
- package/dist/{create-YDDBH4VQ.js → create-A6CPQMMH.js} +27 -26
- package/dist/create-B4EWCX7X.js +1798 -0
- package/dist/{create-YBF4YGWG.js → create-BHSMHOFN.js} +1 -1
- package/dist/{create-XVHOCZHJ.js → create-BVUZWMET.js} +1 -1
- package/dist/create-CJEZCYN6.js +1179 -0
- package/dist/create-DAVMJNC2.js +1931 -0
- package/dist/{create-35MYQPVM.js → create-E4HTVPP7.js} +17 -17
- package/dist/{create-JDGM5KXE.js → create-G4TF2M7G.js} +88 -42
- package/dist/{create-UQNYMVBM.js → create-LOP7AF5N.js} +6 -6
- package/dist/{create-UPYB65PD.js → create-MKFDE32U.js} +1 -1
- package/dist/{create-B5ZXTK3K.js → create-NR7ULWQS.js} +37 -34
- package/dist/{create-HI5UI2EZ.js → create-SJSLOXOW.js} +31 -26
- package/dist/{create-GB3ZA4LH.js → create-SYI6DVKM.js} +4 -4
- package/dist/{create-ORXYT74H.js → create-ZAGMLDR4.js} +13 -13
- package/dist/create-ZP4LSJYQ.js +216 -0
- package/dist/customer-group-add-customers-GTM556QA.js +251 -0
- package/dist/customer-group-create-OYHAXX2T.js +140 -0
- package/dist/customer-group-detail-KW62TLWA.js +58 -0
- package/dist/customer-group-edit-WH7O4N4L.js +137 -0
- package/dist/customer-groups-UJFZBZ2B.js +276 -0
- package/dist/{customers-ETXVNM3G.js → customers-4WKIFPUU.js} +7 -7
- package/dist/{edit-UGEC27HP.js → edit-3EN2H52W.js} +39 -36
- package/dist/{edit-ZMERG3L7.js → edit-3VNT35DW.js} +1 -1
- package/dist/{edit-ORXS3A2Y.js → edit-6DUTTLEV.js} +1 -1
- package/dist/edit-6K3NSVI7.js +103 -0
- package/dist/{edit-REDDBLTA.js → edit-6Z6RIJRZ.js} +4 -4
- package/dist/{edit-2Q7TRUTL.js → edit-CVSO5CX7.js} +14 -14
- package/dist/{edit-ZAHCMF5U.js → edit-FQDSESVI.js} +1 -1
- package/dist/edit-GZXLWSTL.js +176 -0
- package/dist/edit-LLNKSZR4.js +871 -0
- package/dist/{edit-O4JLGKQR.js → edit-MKVDAUA5.js} +1 -1
- package/dist/{edit-ZCXUG42Q.js → edit-NDUSRTWY.js} +13 -13
- package/dist/{edit-522DG3BY.js → edit-RBREBAQQ.js} +1 -1
- package/dist/{edit-Q3UQIOLS.js → edit-RQHOHZR6.js} +1 -1
- package/dist/{edit-VKT62KHG.js → edit-SAB6F3ZG.js} +36 -15
- package/dist/{edit-C4OCKQVU.js → edit-SM2GHVKW.js} +1 -1
- package/dist/{edit-KAKVPHZZ.js → edit-UVY3TEHD.js} +1 -1
- package/dist/{edit-SGUY2CCK.js → edit-V7WLYLOQ.js} +16 -16
- package/dist/{edit-FKXIQ6ZI.js → edit-XMZSLH4O.js} +16 -16
- package/dist/{edit-L5ZZLMAY.js → edit-YTS77SJS.js} +43 -32
- package/dist/{edit-budget-L3CCEWNF.js → edit-budget-4JMGEPNF.js} +1 -1
- package/dist/{edit-inventory-item-6B7ITDGD.js → edit-inventory-item-G22KFCYY.js} +2 -2
- package/dist/{edit-inventory-item-attributes-Y7MQZLXI.js → edit-inventory-item-attributes-RJSM4MEI.js} +2 -2
- package/dist/edit-price-K6K2FTMF.js +196 -0
- package/dist/edit-stock-6TUSJD5R.js +229 -0
- package/dist/fulfillment-VEF6HG6D.js +641 -0
- package/dist/{fulfillment-providers-DQAU43JZ.js → fulfillment-providers-VKBWFH45.js} +24 -24
- package/dist/index.css +107 -10
- package/dist/index.js +302 -183
- package/dist/{inventory-KAUVPMPZ.js → inventory-OCIGVZ4V.js} +6 -6
- package/dist/{offer-inventory-batch-page-WKCWNDNK.js → inventory-T7BRSFKY.js} +16 -16
- package/dist/{invite-CI2P4GF6.js → invite-J6L3Q7MQ.js} +12 -12
- package/dist/{invite-Q6EYDZVQ.js → invite-VWNUFOFI.js} +21 -21
- package/dist/loader-2EQ4ROTD.js +34 -0
- package/dist/loader-HYUC2XZX.js +33 -0
- package/dist/{login-KY342RMK.js → login-WOZMCEFY.js} +12 -12
- package/dist/{manage-locations-WNHEBS3A.js → manage-locations-R3ASMF5B.js} +1 -1
- package/dist/{media-B6ME2WXY.js → media-KIIJ6WSZ.js} +18 -17
- package/dist/media-RJHUSBXL.js +315 -0
- package/dist/{metadata-WR4RFXO5.js → metadata-45S6CFKY.js} +14 -14
- package/dist/{metadata-2CMH4I6U.js → metadata-FCATUWIZ.js} +14 -14
- package/dist/{metadata-GWI6R4ES.js → metadata-L5GBBXC4.js} +14 -14
- package/dist/{metadata-TLDUF5KV.js → metadata-R4ZRMAO6.js} +14 -14
- package/dist/{metadata-NUXUC2JA.js → metadata-RM5VVAOS.js} +14 -14
- package/dist/{offer-create-page-4Z6L63BU.js → offer-create-page-DV4JCIL2.js} +190 -195
- package/dist/offer-detail-page-TIBYGQBS.js +590 -0
- package/dist/offer-variant-detail-page-ORH56HZI.js +421 -0
- package/dist/offers-VA63KV3C.js +54 -0
- package/dist/{onboarding-43LQQQGQ.js → onboarding-L5RRKT65.js} +12 -12
- package/dist/{orders-ZV4D6L2V.js → orders-KKJD6EWZ.js} +27 -27
- package/dist/{organization-ZTQGRJWS.js → organization-6YPU2RQP.js} +53 -89
- package/dist/{organize-K6QMAMEN.js → organize-LR7FWK2J.js} +3 -3
- package/dist/{organize-HNJUHEEG.js → organize-SUG4SGVR.js} +3 -3
- package/dist/pages/index.d.ts +40 -16
- package/dist/pages/index.js +73 -73
- package/dist/{payment-details-64US5XWD.js → payment-details-UVEIHQA5.js} +13 -13
- package/dist/{payouts-UXJDTXDL.js → payouts-D4A4CILI.js} +8 -8
- package/dist/{price-lists-KBPUVSZI.js → price-lists-WJFXFGEV.js} +10 -10
- package/dist/{pricing-DF6C5XK4.js → pricing-QEVR2Z4K.js} +19 -19
- package/dist/{offer-pricing-edit-page-4TYGGSOE.js → pricing-XJUUCYL5.js} +24 -18
- package/dist/{product-tags-6MZB4W5R.js → product-tags-MW2JMRFY.js} +36 -33
- package/dist/{product-types-UUHBV4IZ.js → product-types-XXU7X42K.js} +6 -6
- package/dist/product-variant-detail-XZWTSH3H.js +369 -0
- package/dist/{product-variant-edit-YYNPHE4L.js → product-variant-edit-A2KO3E7B.js} +41 -44
- package/dist/{products-MZBU5MEV.js → products-TZS2OPK3.js} +37 -37
- package/dist/{products-IWKTGZS6.js → products-XSXEUKIB.js} +23 -22
- package/dist/{professional-details-5T2VS6MM.js → professional-details-ELUEJPOH.js} +13 -13
- package/dist/{profile-6XGHAT7H.js → profile-EDVGIBW6.js} +16 -16
- package/dist/{promotions-O7U4BTK6.js → promotions-JYO23G6N.js} +8 -8
- package/dist/receive-47SMYKIJ.js +578 -0
- package/dist/refund-IU7B77FV.js +268 -0
- package/dist/{register-N6WOSMLA.js → register-SR2SYX4Q.js} +14 -14
- package/dist/{reset-password-EICPAY2N.js → reset-password-N22YRMR3.js} +1 -1
- package/dist/{return-reasons-IX3LIOCU.js → return-reasons-POR5YPTF.js} +18 -15
- package/dist/{sales-channels-JW3QUYR7.js → sales-channels-ETB6QRRY.js} +8 -8
- package/dist/{sales-channels-B6FULRWI.js → sales-channels-YXRRARDL.js} +7 -7
- package/dist/{settings-MV53ZZ53.js → settings-MHBYIZ2I.js} +38 -35
- package/dist/shipment-ZX6PQ32L.js +241 -0
- package/dist/shipping-W4SPR3JO.js +122 -0
- package/dist/{shipping-profile-Y4SNEPZX.js → shipping-profile-L5CFXVEE.js} +4 -8
- package/dist/{shipping-profiles-2NWKCEJK.js → shipping-profiles-QBJUWXVQ.js} +17 -17
- package/dist/{stock-7CSVEJJU.js → stock-FW4DOVFV.js} +14 -14
- package/dist/{store-X23G3JCJ.js → store-NWWBV2UO.js} +75 -144
- package/dist/{store-closure-P5PD2RSV.js → store-closure-O3CBSOJD.js} +19 -14
- package/dist/{store-select-TREPDS3G.js → store-select-C7GI5MKK.js} +13 -13
- package/dist/{tax-regions-YXZW7UVX.js → tax-regions-2JCIB4T7.js} +2 -2
- package/dist/{team-SPP5OY5W.js → team-MY24J5WO.js} +20 -20
- package/package.json +2 -2
- package/dist/[id]-LTNOHLGE.js +0 -1219
- package/dist/allocate-items-SDFS5GYN.js +0 -533
- package/dist/chunk-432S4FGR.js +0 -0
- package/dist/chunk-AIZM66CG.js +0 -66
- package/dist/chunk-BDZOSMAX.js +0 -23
- package/dist/chunk-CFRWIQIZ.js +0 -43
- package/dist/chunk-GKZHBXZK.js +0 -426
- package/dist/chunk-RXZFEFNV.js +0 -73
- package/dist/chunk-T6LHVNWO.js +0 -27
- package/dist/chunk-WLT7K7K7.js +0 -63
- package/dist/create-FCKGCZSM.js +0 -210
- package/dist/edit-GQNIINRR.js +0 -192
- package/dist/fulfillment-75Z4H23W.js +0 -559
- package/dist/loader-FBB5OQRT.js +0 -31
- package/dist/metadata-5BPOBBU2.js +0 -45
- package/dist/offer-detail-page-6MAHNNIO.js +0 -488
- package/dist/offer-edit-page-DYQFU6JU.js +0 -151
- package/dist/offers-ZG6OTDZ2.js +0 -32
- package/dist/product-variant-detail-RVWEYVPC.js +0 -220
- package/dist/shipment-Q33QBMXX.js +0 -176
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
defineTabMeta
|
|
3
|
+
} from "./chunk-LEWA4BPH.js";
|
|
4
4
|
import {
|
|
5
5
|
DataGrid,
|
|
6
6
|
createDataGridHelper
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TKSKCYM3.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
HandleInput
|
|
10
|
+
} from "./chunk-HJ56YXBU.js";
|
|
11
|
+
import {
|
|
12
|
+
useDateTableFilters
|
|
13
|
+
} from "./chunk-26OOAKQ6.js";
|
|
14
|
+
import {
|
|
15
|
+
_DataTable,
|
|
16
|
+
useDataTable
|
|
17
|
+
} from "./chunk-WKRW5OPL.js";
|
|
11
18
|
import {
|
|
12
19
|
SwitchBox
|
|
13
20
|
} from "./chunk-YVCBMOJG.js";
|
|
14
21
|
import {
|
|
15
22
|
SingleCategoryCombobox
|
|
16
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-J434WDD3.js";
|
|
17
24
|
import {
|
|
18
25
|
useComboboxData
|
|
19
26
|
} from "./chunk-OVPAOBZB.js";
|
|
20
27
|
import {
|
|
21
28
|
UploadMediaFormItem
|
|
22
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-3L2DVCOC.js";
|
|
23
30
|
import {
|
|
24
31
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
25
32
|
ProductCreateSchema,
|
|
26
|
-
decorateVariantsWithDefaultValues,
|
|
27
33
|
generateVariantsFromAttributes,
|
|
28
34
|
normalizeProductFormValues
|
|
29
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-RT3G3GEK.js";
|
|
30
36
|
import {
|
|
31
37
|
ChipInput
|
|
32
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-KDE4HKH2.js";
|
|
33
39
|
import {
|
|
34
|
-
useAttributeTableFilters,
|
|
35
40
|
useAttributeTableQuery
|
|
36
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4YWKKCTT.js";
|
|
37
42
|
import {
|
|
38
43
|
Combobox
|
|
39
44
|
} from "./chunk-VBRTC2VU.js";
|
|
40
45
|
import {
|
|
41
46
|
TabbedForm,
|
|
42
47
|
useTabbedForm
|
|
43
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-WJ5EU3KW.js";
|
|
44
49
|
import {
|
|
45
50
|
RouteFocusModal,
|
|
46
51
|
StackedFocusModal,
|
|
@@ -50,22 +55,19 @@ import {
|
|
|
50
55
|
import {
|
|
51
56
|
Form
|
|
52
57
|
} from "./chunk-3QSRE5LS.js";
|
|
53
|
-
import {
|
|
54
|
-
DataTable
|
|
55
|
-
} from "./chunk-PPLC4IKI.js";
|
|
56
58
|
import {
|
|
57
59
|
require_dist
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-6FLSBL4Q.js";
|
|
59
61
|
import {
|
|
60
62
|
useFeatureFlags
|
|
61
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-KZYRC3WR.js";
|
|
62
64
|
import {
|
|
63
65
|
ActionMenu
|
|
64
66
|
} from "./chunk-BDGZ4EQO.js";
|
|
65
67
|
import {
|
|
66
68
|
useCreateProduct,
|
|
67
69
|
useProductAttributes
|
|
68
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-TSTUAL6N.js";
|
|
69
71
|
import {
|
|
70
72
|
sdk,
|
|
71
73
|
uploadFilesQuery
|
|
@@ -76,19 +78,19 @@ import {
|
|
|
76
78
|
|
|
77
79
|
// src/pages/products/create/product-create.tsx
|
|
78
80
|
import { Children as Children2 } from "react";
|
|
79
|
-
import { useTranslation as
|
|
81
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
80
82
|
|
|
81
83
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
82
84
|
var import_types6 = __toESM(require_dist(), 1);
|
|
83
85
|
import { Button as Button3, toast } from "@medusajs/ui";
|
|
84
|
-
import { useEffect as useEffect3, useMemo as
|
|
85
|
-
import { useForm, useWatch as
|
|
86
|
-
import { useTranslation as
|
|
86
|
+
import { useEffect as useEffect3, useMemo as useMemo3, Children } from "react";
|
|
87
|
+
import { useForm, useWatch as useWatch2 } from "react-hook-form";
|
|
88
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
87
89
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
88
90
|
|
|
89
91
|
// src/pages/products/create/components/product-create-attributes-form/product-create-attributes-form.tsx
|
|
90
92
|
var import_types = __toESM(require_dist(), 1);
|
|
91
|
-
import { XMarkMini } from "@medusajs/icons";
|
|
93
|
+
import { EllipseMiniSolid, XMarkMini } from "@medusajs/icons";
|
|
92
94
|
import {
|
|
93
95
|
Button as Button2,
|
|
94
96
|
Heading,
|
|
@@ -100,21 +102,79 @@ import {
|
|
|
100
102
|
Select,
|
|
101
103
|
Switch,
|
|
102
104
|
Text,
|
|
103
|
-
Textarea
|
|
105
|
+
Textarea,
|
|
106
|
+
clx
|
|
104
107
|
} from "@medusajs/ui";
|
|
105
|
-
import {
|
|
108
|
+
import { Select as RadixSelect } from "radix-ui";
|
|
109
|
+
import { forwardRef, useEffect as useEffect2 } from "react";
|
|
106
110
|
import {
|
|
107
111
|
Controller,
|
|
108
112
|
useFieldArray
|
|
109
113
|
} from "react-hook-form";
|
|
110
114
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
111
115
|
|
|
116
|
+
// src/pages/products/create/components/product-create-attributes-form/attribute-merge.ts
|
|
117
|
+
var MULTI_SELECT = "multi_select";
|
|
118
|
+
var buildRequiredEntry = (attr) => ({
|
|
119
|
+
attribute_id: attr.id,
|
|
120
|
+
title: attr.name,
|
|
121
|
+
values: attr.type === MULTI_SELECT ? [] : "",
|
|
122
|
+
is_custom: false,
|
|
123
|
+
is_required: true,
|
|
124
|
+
use_for_variants: !!attr.is_variant_axis,
|
|
125
|
+
type: attr.type
|
|
126
|
+
});
|
|
127
|
+
var mergeRequiredAttributes = (current, productAttributes) => {
|
|
128
|
+
const requiredById = new Map(productAttributes.map((a) => [a.id, a]));
|
|
129
|
+
const present = /* @__PURE__ */ new Set();
|
|
130
|
+
let changed = false;
|
|
131
|
+
const next = current.map((entry) => {
|
|
132
|
+
if (!entry.is_custom && entry.attribute_id && requiredById.has(entry.attribute_id)) {
|
|
133
|
+
present.add(entry.attribute_id);
|
|
134
|
+
if (!entry.is_required) {
|
|
135
|
+
changed = true;
|
|
136
|
+
return { ...entry, is_required: true };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return entry;
|
|
140
|
+
});
|
|
141
|
+
for (const attr of productAttributes) {
|
|
142
|
+
if (!present.has(attr.id)) {
|
|
143
|
+
next.push(buildRequiredEntry(attr));
|
|
144
|
+
changed = true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return changed ? next : current;
|
|
148
|
+
};
|
|
149
|
+
var mergeSelectedAttributes = (current, selected) => {
|
|
150
|
+
const selectedById = new Map(
|
|
151
|
+
selected.filter((a) => a.attribute_id).map((a) => [a.attribute_id, a])
|
|
152
|
+
);
|
|
153
|
+
const next = [];
|
|
154
|
+
for (const entry of current) {
|
|
155
|
+
if (entry.is_custom) {
|
|
156
|
+
next.push(entry);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (entry.attribute_id && selectedById.has(entry.attribute_id)) {
|
|
160
|
+
next.push(selectedById.get(entry.attribute_id));
|
|
161
|
+
selectedById.delete(entry.attribute_id);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
for (const attr of selected) {
|
|
165
|
+
if (attr.attribute_id && selectedById.has(attr.attribute_id)) {
|
|
166
|
+
next.push(attr);
|
|
167
|
+
selectedById.delete(attr.attribute_id);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return next;
|
|
171
|
+
};
|
|
172
|
+
|
|
112
173
|
// src/pages/products/create/components/product-create-attributes-form/product-create-add-attributes-modal.tsx
|
|
174
|
+
import { Badge, Button, Checkbox, Tooltip } from "@medusajs/ui";
|
|
113
175
|
import {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
createDataTableColumnHelper
|
|
117
|
-
} from "@medusajs/ui";
|
|
176
|
+
createColumnHelper
|
|
177
|
+
} from "@tanstack/react-table";
|
|
118
178
|
import { useEffect, useMemo, useState } from "react";
|
|
119
179
|
import { useTranslation } from "react-i18next";
|
|
120
180
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
@@ -129,16 +189,18 @@ var ATTRIBUTE_TYPE_LABELS = {
|
|
|
129
189
|
toggle: "attributes.type.toggle",
|
|
130
190
|
text: "attributes.type.text_area"
|
|
131
191
|
};
|
|
192
|
+
var ROW_HIGHLIGHT_CLASSES = [
|
|
193
|
+
"[&_tr:has(button[role=checkbox][data-state=checked]:not([disabled]))>td]:!bg-ui-bg-highlight",
|
|
194
|
+
"[&_tr:has(button[role=checkbox][data-state=checked][disabled])>td]:!bg-ui-bg-subtle"
|
|
195
|
+
].join(" ");
|
|
132
196
|
var ProductCreateAddAttributesModal = () => {
|
|
133
197
|
const form = useTabbedForm();
|
|
134
198
|
const { t } = useTranslation();
|
|
135
199
|
const { getValues, setValue } = form;
|
|
136
200
|
const { setIsOpen, getIsOpen } = useStackedModal();
|
|
137
|
-
const [rowSelection, setRowSelection] = useState(
|
|
138
|
-
{}
|
|
139
|
-
);
|
|
201
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
140
202
|
const [state, setState] = useState([]);
|
|
141
|
-
const { searchParams } = useAttributeTableQuery({
|
|
203
|
+
const { searchParams, raw } = useAttributeTableQuery({
|
|
142
204
|
pageSize: PAGE_SIZE,
|
|
143
205
|
prefix: ADD_ATTRIBUTES_MODAL_ID
|
|
144
206
|
});
|
|
@@ -188,7 +250,7 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
188
250
|
setRowSelection(selection);
|
|
189
251
|
setState(stateEntries);
|
|
190
252
|
}, [open, getValues, product_attributes]);
|
|
191
|
-
const
|
|
253
|
+
const applySelectionChange = (next) => {
|
|
192
254
|
if (product_attributes) {
|
|
193
255
|
for (const attr of product_attributes) {
|
|
194
256
|
if (attr.is_required) {
|
|
@@ -217,9 +279,12 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
217
279
|
});
|
|
218
280
|
setRowSelection(next);
|
|
219
281
|
};
|
|
282
|
+
const onRowSelectionChange = (updater) => {
|
|
283
|
+
const next = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
284
|
+
applySelectionChange({ ...next });
|
|
285
|
+
};
|
|
220
286
|
const handleAdd = () => {
|
|
221
287
|
const currentAttributes = getValues("attributes") ?? [];
|
|
222
|
-
const customAttributes = currentAttributes.filter((a) => a.is_custom);
|
|
223
288
|
const requiredIds = new Set(
|
|
224
289
|
product_attributes?.filter((a) => a.is_required).map((a) => a.id) ?? []
|
|
225
290
|
);
|
|
@@ -233,50 +298,127 @@ var ProductCreateAddAttributesModal = () => {
|
|
|
233
298
|
type: a.type,
|
|
234
299
|
available_values: a.available_values
|
|
235
300
|
}));
|
|
236
|
-
setValue(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
301
|
+
setValue(
|
|
302
|
+
"attributes",
|
|
303
|
+
mergeSelectedAttributes(currentAttributes, selectedAttributes),
|
|
304
|
+
{
|
|
305
|
+
shouldDirty: true,
|
|
306
|
+
shouldTouch: true
|
|
307
|
+
}
|
|
308
|
+
);
|
|
240
309
|
setIsOpen(ADD_ATTRIBUTES_MODAL_ID, false);
|
|
241
310
|
};
|
|
242
|
-
const
|
|
311
|
+
const dateFilters = useDateTableFilters();
|
|
312
|
+
const filters = useMemo(
|
|
313
|
+
() => [
|
|
314
|
+
{
|
|
315
|
+
key: "is_filterable",
|
|
316
|
+
label: t("attributes.fields.filterable"),
|
|
317
|
+
type: "select",
|
|
318
|
+
options: [
|
|
319
|
+
{ label: t("filters.radio.yes"), value: "true" },
|
|
320
|
+
{ label: t("filters.radio.no"), value: "false" }
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
...dateFilters
|
|
324
|
+
],
|
|
325
|
+
[t, dateFilters]
|
|
326
|
+
);
|
|
243
327
|
const columns = useColumns();
|
|
328
|
+
const { table } = useDataTable({
|
|
329
|
+
data: product_attributes ?? [],
|
|
330
|
+
columns,
|
|
331
|
+
count,
|
|
332
|
+
pageSize: PAGE_SIZE,
|
|
333
|
+
prefix: ADD_ATTRIBUTES_MODAL_ID,
|
|
334
|
+
getRowId: (row) => row.id,
|
|
335
|
+
enableRowSelection: true,
|
|
336
|
+
rowSelection: {
|
|
337
|
+
state: rowSelection,
|
|
338
|
+
updater: onRowSelectionChange
|
|
339
|
+
},
|
|
340
|
+
enablePagination: true
|
|
341
|
+
});
|
|
244
342
|
if (isError) {
|
|
245
343
|
throw error;
|
|
246
344
|
}
|
|
247
345
|
return /* @__PURE__ */ jsxs(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
|
|
248
346
|
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
249
|
-
/* @__PURE__ */ jsx(
|
|
250
|
-
|
|
347
|
+
/* @__PURE__ */ jsx(
|
|
348
|
+
StackedFocusModal.Body,
|
|
251
349
|
{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
350
|
+
className: `flex-1 overflow-hidden ${ROW_HIGHLIGHT_CLASSES}`,
|
|
351
|
+
"data-testid": "product-create-add-attributes-table",
|
|
352
|
+
children: /* @__PURE__ */ jsx(
|
|
353
|
+
_DataTable,
|
|
354
|
+
{
|
|
355
|
+
table,
|
|
356
|
+
columns,
|
|
357
|
+
filters,
|
|
358
|
+
count,
|
|
359
|
+
pageSize: PAGE_SIZE,
|
|
360
|
+
queryObject: raw,
|
|
361
|
+
isLoading,
|
|
362
|
+
layout: "fill",
|
|
363
|
+
prefix: ADD_ATTRIBUTES_MODAL_ID,
|
|
364
|
+
pagination: true,
|
|
365
|
+
search: "autofocus",
|
|
366
|
+
orderBy: [
|
|
367
|
+
{ key: "name", label: t("attributes.fields.name") },
|
|
368
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
369
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
370
|
+
],
|
|
371
|
+
noRecords: {
|
|
372
|
+
title: t("products.create.attributes.noAttributesTitle"),
|
|
373
|
+
message: t("products.create.attributes.noAttributesDescription")
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
)
|
|
266
377
|
}
|
|
267
|
-
)
|
|
378
|
+
),
|
|
268
379
|
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
269
380
|
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
|
|
270
381
|
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
|
|
271
382
|
] }) })
|
|
272
383
|
] });
|
|
273
384
|
};
|
|
274
|
-
var columnHelper =
|
|
385
|
+
var columnHelper = createColumnHelper();
|
|
275
386
|
var useColumns = () => {
|
|
276
387
|
const { t } = useTranslation();
|
|
277
388
|
return useMemo(
|
|
278
389
|
() => [
|
|
279
|
-
columnHelper.
|
|
390
|
+
columnHelper.display({
|
|
391
|
+
id: "select",
|
|
392
|
+
header: ({ table }) => /* @__PURE__ */ jsx(
|
|
393
|
+
Checkbox,
|
|
394
|
+
{
|
|
395
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
396
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
cell: ({ row }) => {
|
|
400
|
+
const isRequired = row.original.is_required;
|
|
401
|
+
const checkbox = /* @__PURE__ */ jsx(
|
|
402
|
+
Checkbox,
|
|
403
|
+
{
|
|
404
|
+
onClick: (e) => e.stopPropagation(),
|
|
405
|
+
checked: row.getIsSelected() || isRequired,
|
|
406
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
407
|
+
disabled: isRequired
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
if (isRequired) {
|
|
411
|
+
return /* @__PURE__ */ jsx(
|
|
412
|
+
Tooltip,
|
|
413
|
+
{
|
|
414
|
+
content: t("products.create.attributes.requiredTooltip"),
|
|
415
|
+
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: checkbox })
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
return checkbox;
|
|
420
|
+
}
|
|
421
|
+
}),
|
|
280
422
|
columnHelper.accessor("name", {
|
|
281
423
|
header: t("attributes.fields.name"),
|
|
282
424
|
enableSorting: false
|
|
@@ -291,7 +433,18 @@ var useColumns = () => {
|
|
|
291
433
|
}),
|
|
292
434
|
columnHelper.accessor("is_required", {
|
|
293
435
|
header: t("attributes.fields.required"),
|
|
294
|
-
cell: (info) =>
|
|
436
|
+
cell: (info) => {
|
|
437
|
+
if (info.getValue()) {
|
|
438
|
+
return /* @__PURE__ */ jsx(
|
|
439
|
+
Tooltip,
|
|
440
|
+
{
|
|
441
|
+
content: t("products.create.attributes.requiredTooltip"),
|
|
442
|
+
children: /* @__PURE__ */ jsx("span", { className: "cursor-help underline decoration-dotted underline-offset-2", children: t("filters.radio.yes") })
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
return t("filters.radio.no");
|
|
447
|
+
},
|
|
295
448
|
enableSorting: false
|
|
296
449
|
}),
|
|
297
450
|
columnHelper.accessor("type", {
|
|
@@ -671,7 +824,7 @@ var SelectedAttributes = ({
|
|
|
671
824
|
),
|
|
672
825
|
field.use_for_variants && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
673
826
|
/* @__PURE__ */ jsx2("div", {}),
|
|
674
|
-
/* @__PURE__ */ jsx2(VariantAxisTip, {})
|
|
827
|
+
/* @__PURE__ */ jsx2(VariantAxisTip, { className: "border-none" })
|
|
675
828
|
] })
|
|
676
829
|
] }),
|
|
677
830
|
/* @__PURE__ */ jsx2(
|
|
@@ -706,26 +859,14 @@ var RequiredAttributes = () => {
|
|
|
706
859
|
useEffect2(() => {
|
|
707
860
|
if (!product_attributes) return;
|
|
708
861
|
const currentAttributes = form.getValues("attributes") || [];
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
862
|
+
const nextAttributes = mergeRequiredAttributes(
|
|
863
|
+
currentAttributes,
|
|
864
|
+
product_attributes
|
|
712
865
|
);
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
if (existing) return existing;
|
|
718
|
-
return {
|
|
719
|
-
attribute_id: attr.id,
|
|
720
|
-
title: attr.name,
|
|
721
|
-
values: attr.type === import_types.AttributeType.MULTI_SELECT ? [] : "",
|
|
722
|
-
is_custom: false,
|
|
723
|
-
is_required: true,
|
|
724
|
-
use_for_variants: attr.is_variant_axis
|
|
725
|
-
};
|
|
726
|
-
});
|
|
727
|
-
form.setValue("attributes", [...otherAttributes, ...requiredAttributes]);
|
|
728
|
-
}, [product_attributes]);
|
|
866
|
+
if (nextAttributes !== currentAttributes) {
|
|
867
|
+
form.setValue("attributes", nextAttributes);
|
|
868
|
+
}
|
|
869
|
+
}, [product_attributes, form]);
|
|
729
870
|
if (!categoryId || !product_attributes?.length) return null;
|
|
730
871
|
const requiredEntries = attributes.map((attr, index) => ({ attr, index })).filter(({ attr }) => !attr.is_custom);
|
|
731
872
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
@@ -752,6 +893,26 @@ var RequiredAttributes = () => {
|
|
|
752
893
|
] })
|
|
753
894
|
] });
|
|
754
895
|
};
|
|
896
|
+
var RadioSelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
897
|
+
RadixSelect.Item,
|
|
898
|
+
{
|
|
899
|
+
ref,
|
|
900
|
+
className: clx(
|
|
901
|
+
"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",
|
|
902
|
+
"focus-visible:bg-ui-bg-component-hover",
|
|
903
|
+
"active:bg-ui-bg-component-pressed",
|
|
904
|
+
"data-[state=checked]:txt-compact-small-plus",
|
|
905
|
+
"disabled:text-ui-fg-disabled",
|
|
906
|
+
className
|
|
907
|
+
),
|
|
908
|
+
...props,
|
|
909
|
+
children: [
|
|
910
|
+
/* @__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(EllipseMiniSolid, {}) }) }),
|
|
911
|
+
/* @__PURE__ */ jsx2(RadixSelect.ItemText, { className: "flex-1 truncate", children })
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
));
|
|
915
|
+
RadioSelectItem.displayName = "RadioSelectItem";
|
|
755
916
|
var RequiredAttributeField = ({
|
|
756
917
|
attribute,
|
|
757
918
|
index
|
|
@@ -776,11 +937,11 @@ var RequiredAttributeField = ({
|
|
|
776
937
|
Select.Value,
|
|
777
938
|
{
|
|
778
939
|
placeholder: t(
|
|
779
|
-
"products.create.attributes.
|
|
940
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
780
941
|
)
|
|
781
942
|
}
|
|
782
943
|
) }),
|
|
783
|
-
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(
|
|
944
|
+
/* @__PURE__ */ jsx2(Select.Content, { children: attribute.values?.map((v) => /* @__PURE__ */ jsx2(RadioSelectItem, { value: v.name, children: v.name }, v.id)) })
|
|
784
945
|
]
|
|
785
946
|
}
|
|
786
947
|
) : attribute.type === import_types.AttributeType.MULTI_SELECT ? /* @__PURE__ */ jsx2(
|
|
@@ -797,21 +958,36 @@ var RequiredAttributeField = ({
|
|
|
797
958
|
placeholder: t("products.create.attributes.selectValues")
|
|
798
959
|
}
|
|
799
960
|
) : attribute.type === import_types.AttributeType.TEXT ? /* @__PURE__ */ jsx2(
|
|
800
|
-
|
|
961
|
+
Textarea,
|
|
801
962
|
{
|
|
802
963
|
...field,
|
|
803
964
|
ref,
|
|
804
965
|
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
805
966
|
onChange: (e) => onChange(e.target.value),
|
|
806
|
-
placeholder: t(
|
|
967
|
+
placeholder: t(
|
|
968
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
969
|
+
)
|
|
807
970
|
}
|
|
808
|
-
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */
|
|
809
|
-
|
|
971
|
+
) : attribute.type === import_types.AttributeType.TOGGLE ? /* @__PURE__ */ jsxs2(
|
|
972
|
+
Select,
|
|
810
973
|
{
|
|
811
974
|
...field,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
975
|
+
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
976
|
+
onValueChange: onChange,
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ jsx2(Select.Trigger, { ref, children: /* @__PURE__ */ jsx2(
|
|
979
|
+
Select.Value,
|
|
980
|
+
{
|
|
981
|
+
placeholder: t(
|
|
982
|
+
"products.create.attributes.selectValuePlaceholder"
|
|
983
|
+
)
|
|
984
|
+
}
|
|
985
|
+
) }),
|
|
986
|
+
/* @__PURE__ */ jsxs2(Select.Content, { children: [
|
|
987
|
+
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "true", children: t("filters.radio.yes") }),
|
|
988
|
+
/* @__PURE__ */ jsx2(RadioSelectItem, { value: "false", children: t("filters.radio.no") })
|
|
989
|
+
] })
|
|
990
|
+
]
|
|
815
991
|
}
|
|
816
992
|
) : /* @__PURE__ */ jsx2(
|
|
817
993
|
Input,
|
|
@@ -820,7 +996,9 @@ var RequiredAttributeField = ({
|
|
|
820
996
|
ref,
|
|
821
997
|
value: typeof value === "string" ? value : value?.[0] ?? "",
|
|
822
998
|
onChange: (e) => onChange(e.target.value),
|
|
823
|
-
placeholder: t(
|
|
999
|
+
placeholder: t(
|
|
1000
|
+
"products.create.attributes.enterValuePlaceholder"
|
|
1001
|
+
)
|
|
824
1002
|
}
|
|
825
1003
|
) }),
|
|
826
1004
|
/* @__PURE__ */ jsx2(Form.ErrorMessage, {}),
|
|
@@ -829,9 +1007,16 @@ var RequiredAttributeField = ({
|
|
|
829
1007
|
}
|
|
830
1008
|
);
|
|
831
1009
|
};
|
|
832
|
-
var VariantAxisTip = () => {
|
|
1010
|
+
var VariantAxisTip = ({ className }) => {
|
|
833
1011
|
const { t } = useTranslation2();
|
|
834
|
-
return /* @__PURE__ */ jsx2(
|
|
1012
|
+
return /* @__PURE__ */ jsx2(
|
|
1013
|
+
InlineTip,
|
|
1014
|
+
{
|
|
1015
|
+
label: t("products.create.attributes.tip"),
|
|
1016
|
+
className,
|
|
1017
|
+
children: t("products.create.attributes.variantAxisTip")
|
|
1018
|
+
}
|
|
1019
|
+
);
|
|
835
1020
|
};
|
|
836
1021
|
Root._tabMeta = defineTabMeta({
|
|
837
1022
|
id: "attributes",
|
|
@@ -841,8 +1026,8 @@ Root._tabMeta = defineTabMeta({
|
|
|
841
1026
|
var ProductCreateAttributesForm = Root;
|
|
842
1027
|
|
|
843
1028
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
844
|
-
import { Heading as
|
|
845
|
-
import { useTranslation as
|
|
1029
|
+
import { Heading as Heading2 } from "@medusajs/ui";
|
|
1030
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
846
1031
|
|
|
847
1032
|
// src/pages/products/create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
|
|
848
1033
|
import { Input as Input2, Textarea as Textarea2 } from "@medusajs/ui";
|
|
@@ -861,7 +1046,8 @@ var ProductCreateGeneralSection = () => {
|
|
|
861
1046
|
render: ({ field }) => {
|
|
862
1047
|
return /* @__PURE__ */ jsxs3(Form.Item, { "data-testid": "product-create-general-section-title-item", children: [
|
|
863
1048
|
/* @__PURE__ */ jsx3(Form.Label, { "data-testid": "product-create-general-section-title-label", children: t("products.fields.title.label") }),
|
|
864
|
-
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-title-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.title.placeholder"), "data-testid": "product-create-general-section-title-input" }) })
|
|
1049
|
+
/* @__PURE__ */ jsx3(Form.Control, { "data-testid": "product-create-general-section-title-control", children: /* @__PURE__ */ jsx3(Input2, { ...field, placeholder: t("products.fields.title.placeholder"), "data-testid": "product-create-general-section-title-input" }) }),
|
|
1050
|
+
/* @__PURE__ */ jsx3(Form.ErrorMessage, {})
|
|
865
1051
|
] });
|
|
866
1052
|
}
|
|
867
1053
|
}
|
|
@@ -1209,381 +1395,32 @@ function formatFileSize(bytes, decimalPlaces = 2) {
|
|
|
1209
1395
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
|
|
1210
1396
|
}
|
|
1211
1397
|
|
|
1212
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1213
|
-
import {
|
|
1214
|
-
Alert,
|
|
1215
|
-
Checkbox,
|
|
1216
|
-
clx as clx2,
|
|
1217
|
-
Heading as Heading2,
|
|
1218
|
-
Hint as Hint2,
|
|
1219
|
-
InlineTip as InlineTip2,
|
|
1220
|
-
Label as Label2,
|
|
1221
|
-
Text as Text3
|
|
1222
|
-
} from "@medusajs/ui";
|
|
1223
|
-
import { useFieldArray as useFieldArray3, useWatch } from "react-hook-form";
|
|
1224
|
-
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1225
|
-
import { useMemo as useMemo3 } from "react";
|
|
1226
|
-
|
|
1227
|
-
// src/components/common/sortable-list/sortable-list.tsx
|
|
1228
|
-
import {
|
|
1229
|
-
DndContext as DndContext2,
|
|
1230
|
-
DragOverlay as DragOverlay2,
|
|
1231
|
-
KeyboardSensor as KeyboardSensor2,
|
|
1232
|
-
PointerSensor as PointerSensor2,
|
|
1233
|
-
defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
|
|
1234
|
-
useSensor as useSensor2,
|
|
1235
|
-
useSensors as useSensors2
|
|
1236
|
-
} from "@dnd-kit/core";
|
|
1237
|
-
import {
|
|
1238
|
-
SortableContext as SortableContext2,
|
|
1239
|
-
arrayMove as arrayMove2,
|
|
1240
|
-
sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
|
|
1241
|
-
useSortable as useSortable2
|
|
1242
|
-
} from "@dnd-kit/sortable";
|
|
1243
|
-
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
1244
|
-
import { DotsSix as DotsSix2 } from "@medusajs/icons";
|
|
1245
|
-
import { IconButton as IconButton3, clx } from "@medusajs/ui";
|
|
1246
|
-
import {
|
|
1247
|
-
Fragment as Fragment2,
|
|
1248
|
-
createContext,
|
|
1249
|
-
useContext,
|
|
1250
|
-
useMemo as useMemo2,
|
|
1251
|
-
useState as useState3
|
|
1252
|
-
} from "react";
|
|
1253
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1254
|
-
var List = ({
|
|
1255
|
-
items,
|
|
1256
|
-
onChange,
|
|
1257
|
-
renderItem
|
|
1258
|
-
}) => {
|
|
1259
|
-
const [active, setActive] = useState3(null);
|
|
1260
|
-
const [activeItem, activeIndex] = useMemo2(() => {
|
|
1261
|
-
if (active === null) {
|
|
1262
|
-
return [null, null];
|
|
1263
|
-
}
|
|
1264
|
-
const index = items.findIndex(({ id }) => id === active.id);
|
|
1265
|
-
return [items[index], index];
|
|
1266
|
-
}, [active, items]);
|
|
1267
|
-
const sensors = useSensors2(
|
|
1268
|
-
useSensor2(PointerSensor2),
|
|
1269
|
-
useSensor2(KeyboardSensor2, {
|
|
1270
|
-
coordinateGetter: sortableKeyboardCoordinates2
|
|
1271
|
-
})
|
|
1272
|
-
);
|
|
1273
|
-
const handleDragStart = ({ active: active2 }) => {
|
|
1274
|
-
setActive(active2);
|
|
1275
|
-
};
|
|
1276
|
-
const handleDragEnd = ({ active: active2, over }) => {
|
|
1277
|
-
if (over && active2.id !== over.id) {
|
|
1278
|
-
const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
|
|
1279
|
-
const overIndex = items.findIndex(({ id }) => id === over.id);
|
|
1280
|
-
onChange(arrayMove2(items, activeIndex2, overIndex));
|
|
1281
|
-
}
|
|
1282
|
-
setActive(null);
|
|
1283
|
-
};
|
|
1284
|
-
const handleDragCancel = () => {
|
|
1285
|
-
setActive(null);
|
|
1286
|
-
};
|
|
1287
|
-
return /* @__PURE__ */ jsxs5(
|
|
1288
|
-
DndContext2,
|
|
1289
|
-
{
|
|
1290
|
-
sensors,
|
|
1291
|
-
onDragStart: handleDragStart,
|
|
1292
|
-
onDragEnd: handleDragEnd,
|
|
1293
|
-
onDragCancel: handleDragCancel,
|
|
1294
|
-
children: [
|
|
1295
|
-
/* @__PURE__ */ jsx5(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
|
|
1296
|
-
/* @__PURE__ */ jsx5(SortableContext2, { items, children: /* @__PURE__ */ jsx5(
|
|
1297
|
-
"ul",
|
|
1298
|
-
{
|
|
1299
|
-
role: "application",
|
|
1300
|
-
className: "flex list-inside list-none list-image-none flex-col p-0",
|
|
1301
|
-
children: items.map((item, index) => /* @__PURE__ */ jsx5(Fragment2, { children: renderItem(item, index) }, item.id))
|
|
1302
|
-
}
|
|
1303
|
-
) })
|
|
1304
|
-
]
|
|
1305
|
-
}
|
|
1306
|
-
);
|
|
1307
|
-
};
|
|
1308
|
-
var dropAnimationConfig2 = {
|
|
1309
|
-
sideEffects: defaultDropAnimationSideEffects2({
|
|
1310
|
-
styles: {
|
|
1311
|
-
active: {
|
|
1312
|
-
opacity: "0.4"
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
})
|
|
1316
|
-
};
|
|
1317
|
-
var Overlay = ({ children }) => {
|
|
1318
|
-
return /* @__PURE__ */ jsx5(
|
|
1319
|
-
DragOverlay2,
|
|
1320
|
-
{
|
|
1321
|
-
className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
|
|
1322
|
-
dropAnimation: dropAnimationConfig2,
|
|
1323
|
-
children
|
|
1324
|
-
}
|
|
1325
|
-
);
|
|
1326
|
-
};
|
|
1327
|
-
var SortableItemContext = createContext(null);
|
|
1328
|
-
var useSortableItemContext = () => {
|
|
1329
|
-
const context = useContext(SortableItemContext);
|
|
1330
|
-
if (!context) {
|
|
1331
|
-
throw new Error(
|
|
1332
|
-
"useSortableItemContext must be used within a SortableItemContext"
|
|
1333
|
-
);
|
|
1334
|
-
}
|
|
1335
|
-
return context;
|
|
1336
|
-
};
|
|
1337
|
-
var Item = ({
|
|
1338
|
-
id,
|
|
1339
|
-
className,
|
|
1340
|
-
children
|
|
1341
|
-
}) => {
|
|
1342
|
-
const {
|
|
1343
|
-
attributes,
|
|
1344
|
-
isDragging,
|
|
1345
|
-
listeners,
|
|
1346
|
-
setNodeRef,
|
|
1347
|
-
setActivatorNodeRef,
|
|
1348
|
-
transform,
|
|
1349
|
-
transition
|
|
1350
|
-
} = useSortable2({ id });
|
|
1351
|
-
const context = useMemo2(
|
|
1352
|
-
() => ({
|
|
1353
|
-
attributes,
|
|
1354
|
-
listeners,
|
|
1355
|
-
ref: setActivatorNodeRef,
|
|
1356
|
-
isDragging
|
|
1357
|
-
}),
|
|
1358
|
-
[attributes, listeners, setActivatorNodeRef, isDragging]
|
|
1359
|
-
);
|
|
1360
|
-
const style = {
|
|
1361
|
-
opacity: isDragging ? 0.4 : void 0,
|
|
1362
|
-
transform: CSS2.Translate.toString(transform),
|
|
1363
|
-
transition
|
|
1364
|
-
};
|
|
1365
|
-
return /* @__PURE__ */ jsx5(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx5(
|
|
1366
|
-
"li",
|
|
1367
|
-
{
|
|
1368
|
-
className: clx("transition-fg flex flex-1 list-none", className),
|
|
1369
|
-
ref: setNodeRef,
|
|
1370
|
-
style,
|
|
1371
|
-
children
|
|
1372
|
-
}
|
|
1373
|
-
) });
|
|
1374
|
-
};
|
|
1375
|
-
var DragHandle = () => {
|
|
1376
|
-
const { attributes, listeners, ref } = useSortableItemContext();
|
|
1377
|
-
return /* @__PURE__ */ jsx5(
|
|
1378
|
-
IconButton3,
|
|
1379
|
-
{
|
|
1380
|
-
variant: "transparent",
|
|
1381
|
-
size: "small",
|
|
1382
|
-
...attributes,
|
|
1383
|
-
...listeners,
|
|
1384
|
-
ref,
|
|
1385
|
-
className: "cursor-grab touch-none active:cursor-grabbing",
|
|
1386
|
-
children: /* @__PURE__ */ jsx5(DotsSix2, { className: "text-ui-fg-muted" })
|
|
1387
|
-
}
|
|
1388
|
-
);
|
|
1389
|
-
};
|
|
1390
|
-
var SortableList = Object.assign(List, {
|
|
1391
|
-
Item,
|
|
1392
|
-
DragHandle
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1395
|
-
// src/pages/products/create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
1396
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1397
|
-
var ProductCreateVariantsSection = () => {
|
|
1398
|
-
const form = useTabbedForm();
|
|
1399
|
-
const { t } = useTranslation5();
|
|
1400
|
-
const variants = useFieldArray3({
|
|
1401
|
-
control: form.control,
|
|
1402
|
-
name: "variants"
|
|
1403
|
-
});
|
|
1404
|
-
const watchedAttributes = useWatch({
|
|
1405
|
-
control: form.control,
|
|
1406
|
-
name: "attributes",
|
|
1407
|
-
defaultValue: []
|
|
1408
|
-
});
|
|
1409
|
-
const watchedVariants = useWatch({
|
|
1410
|
-
control: form.control,
|
|
1411
|
-
name: "variants",
|
|
1412
|
-
defaultValue: []
|
|
1413
|
-
});
|
|
1414
|
-
const variantAxes = useMemo3(() => {
|
|
1415
|
-
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants).map((attr) => ({
|
|
1416
|
-
title: attr.title,
|
|
1417
|
-
values: Array.isArray(attr.values) ? attr.values : attr.values ? [attr.values] : []
|
|
1418
|
-
})).filter((axis) => axis.title && axis.values.length > 0);
|
|
1419
|
-
}, [watchedAttributes]);
|
|
1420
|
-
const hasVariantAxes = variantAxes.length > 0;
|
|
1421
|
-
const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
|
|
1422
|
-
const handleRankChange = (items) => {
|
|
1423
|
-
const update = items.map((item, index) => {
|
|
1424
|
-
const variant = watchedVariants.find((v) => v.title === item.title);
|
|
1425
|
-
return {
|
|
1426
|
-
id: item.id,
|
|
1427
|
-
...variant || item,
|
|
1428
|
-
variant_rank: index
|
|
1429
|
-
};
|
|
1430
|
-
});
|
|
1431
|
-
variants.replace(update);
|
|
1432
|
-
};
|
|
1433
|
-
const getCheckboxState = (variants2) => {
|
|
1434
|
-
if (variants2.every((variant) => variant.should_create)) {
|
|
1435
|
-
return true;
|
|
1436
|
-
}
|
|
1437
|
-
if (variants2.some((variant) => variant.should_create)) {
|
|
1438
|
-
return "indeterminate";
|
|
1439
|
-
}
|
|
1440
|
-
return false;
|
|
1441
|
-
};
|
|
1442
|
-
const onCheckboxChange = (value) => {
|
|
1443
|
-
switch (value) {
|
|
1444
|
-
case true: {
|
|
1445
|
-
const update = watchedVariants.map((variant) => ({
|
|
1446
|
-
...variant,
|
|
1447
|
-
should_create: true
|
|
1448
|
-
}));
|
|
1449
|
-
form.setValue("variants", update);
|
|
1450
|
-
break;
|
|
1451
|
-
}
|
|
1452
|
-
case false: {
|
|
1453
|
-
const update = watchedVariants.map((variant) => ({
|
|
1454
|
-
...variant,
|
|
1455
|
-
should_create: false
|
|
1456
|
-
}));
|
|
1457
|
-
form.setValue("variants", decorateVariantsWithDefaultValues(update));
|
|
1458
|
-
break;
|
|
1459
|
-
}
|
|
1460
|
-
case "indeterminate":
|
|
1461
|
-
break;
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1464
|
-
if (!hasVariantAxes) {
|
|
1465
|
-
return null;
|
|
1466
|
-
}
|
|
1467
|
-
return /* @__PURE__ */ jsxs6(
|
|
1468
|
-
"div",
|
|
1469
|
-
{
|
|
1470
|
-
id: "variants",
|
|
1471
|
-
className: "flex flex-col gap-y-8",
|
|
1472
|
-
"data-testid": "product-create-variants-section",
|
|
1473
|
-
children: [
|
|
1474
|
-
/* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx6(Heading2, { level: "h2", children: t("products.create.variants.header") }) }),
|
|
1475
|
-
/* @__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: [
|
|
1476
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
1477
|
-
/* @__PURE__ */ jsx6(Label2, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
|
|
1478
|
-
/* @__PURE__ */ jsx6(Hint2, { children: t("products.create.variants.productVariants.hint") })
|
|
1479
|
-
] }),
|
|
1480
|
-
showInvalidVariantsMessage && /* @__PURE__ */ jsx6(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.variants") }),
|
|
1481
|
-
variants.fields.length > 0 ? /* @__PURE__ */ jsxs6("div", { className: "overflow-hidden rounded-xl border", children: [
|
|
1482
|
-
/* @__PURE__ */ jsxs6(
|
|
1483
|
-
"div",
|
|
1484
|
-
{
|
|
1485
|
-
className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
|
|
1486
|
-
style: {
|
|
1487
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1488
|
-
},
|
|
1489
|
-
children: [
|
|
1490
|
-
/* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(
|
|
1491
|
-
Checkbox,
|
|
1492
|
-
{
|
|
1493
|
-
className: "relative",
|
|
1494
|
-
checked: getCheckboxState(watchedVariants),
|
|
1495
|
-
onCheckedChange: onCheckboxChange
|
|
1496
|
-
}
|
|
1497
|
-
) }),
|
|
1498
|
-
/* @__PURE__ */ jsx6("div", {}),
|
|
1499
|
-
variantAxes.map((axis, index) => /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", weight: "plus", children: axis.title }) }, index))
|
|
1500
|
-
]
|
|
1501
|
-
}
|
|
1502
|
-
),
|
|
1503
|
-
/* @__PURE__ */ jsx6(
|
|
1504
|
-
SortableList,
|
|
1505
|
-
{
|
|
1506
|
-
items: variants.fields,
|
|
1507
|
-
onChange: handleRankChange,
|
|
1508
|
-
renderItem: (item, index) => {
|
|
1509
|
-
return /* @__PURE__ */ jsx6(
|
|
1510
|
-
SortableList.Item,
|
|
1511
|
-
{
|
|
1512
|
-
id: item.id,
|
|
1513
|
-
className: clx2("bg-ui-bg-base border-b", {
|
|
1514
|
-
"border-b-0": index === variants.fields.length - 1
|
|
1515
|
-
}),
|
|
1516
|
-
children: /* @__PURE__ */ jsxs6(
|
|
1517
|
-
"div",
|
|
1518
|
-
{
|
|
1519
|
-
className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
|
|
1520
|
-
style: {
|
|
1521
|
-
gridTemplateColumns: `20px 28px repeat(${variantAxes.length}, 1fr)`
|
|
1522
|
-
},
|
|
1523
|
-
children: [
|
|
1524
|
-
/* @__PURE__ */ jsx6(
|
|
1525
|
-
Form.Field,
|
|
1526
|
-
{
|
|
1527
|
-
control: form.control,
|
|
1528
|
-
name: `variants.${index}.should_create`,
|
|
1529
|
-
render: ({
|
|
1530
|
-
field: { value, onChange, ...field }
|
|
1531
|
-
}) => /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
|
|
1532
|
-
Checkbox,
|
|
1533
|
-
{
|
|
1534
|
-
className: "relative",
|
|
1535
|
-
...field,
|
|
1536
|
-
checked: value,
|
|
1537
|
-
onCheckedChange: onChange
|
|
1538
|
-
}
|
|
1539
|
-
) }) })
|
|
1540
|
-
}
|
|
1541
|
-
),
|
|
1542
|
-
/* @__PURE__ */ jsx6(SortableList.DragHandle, {}),
|
|
1543
|
-
variantAxes.map((axis, i) => /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", children: item.attribute_values?.[axis.title] ?? "-" }, i))
|
|
1544
|
-
]
|
|
1545
|
-
}
|
|
1546
|
-
)
|
|
1547
|
-
}
|
|
1548
|
-
);
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
)
|
|
1552
|
-
] }) : /* @__PURE__ */ jsx6(Alert, { children: t("products.create.variants.productVariants.alert") }),
|
|
1553
|
-
variants.fields.length > 0 && /* @__PURE__ */ jsx6(InlineTip2, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
|
|
1554
|
-
] }) })
|
|
1555
|
-
]
|
|
1556
|
-
}
|
|
1557
|
-
);
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
1398
|
// src/pages/products/create/components/product-create-details-form/product-create-details-form.tsx
|
|
1561
|
-
import { jsx as
|
|
1399
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1562
1400
|
var Root2 = () => {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsx5(
|
|
1564
1402
|
"div",
|
|
1565
1403
|
{
|
|
1566
1404
|
className: "flex flex-col items-center p-16",
|
|
1567
1405
|
"data-testid": "product-create-details-form",
|
|
1568
|
-
children: /* @__PURE__ */
|
|
1406
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1569
1407
|
"div",
|
|
1570
1408
|
{
|
|
1571
1409
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1572
1410
|
"data-testid": "product-create-details-form-content",
|
|
1573
1411
|
children: [
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ jsx5(Header, {}),
|
|
1413
|
+
/* @__PURE__ */ jsxs5(
|
|
1576
1414
|
"div",
|
|
1577
1415
|
{
|
|
1578
1416
|
className: "flex flex-col gap-y-6",
|
|
1579
1417
|
"data-testid": "product-create-details-form-sections",
|
|
1580
1418
|
children: [
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
|
|
1420
|
+
/* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
|
|
1583
1421
|
]
|
|
1584
1422
|
}
|
|
1585
|
-
)
|
|
1586
|
-
/* @__PURE__ */ jsx7(ProductCreateVariantsSection, {})
|
|
1423
|
+
)
|
|
1587
1424
|
]
|
|
1588
1425
|
}
|
|
1589
1426
|
)
|
|
@@ -1597,24 +1434,24 @@ Root2._tabMeta = defineTabMeta({
|
|
|
1597
1434
|
});
|
|
1598
1435
|
var ProductCreateDetailsForm = Root2;
|
|
1599
1436
|
var Header = () => {
|
|
1600
|
-
const { t } =
|
|
1601
|
-
return /* @__PURE__ */
|
|
1437
|
+
const { t } = useTranslation5();
|
|
1438
|
+
return /* @__PURE__ */ jsx5(
|
|
1602
1439
|
"div",
|
|
1603
1440
|
{
|
|
1604
1441
|
className: "flex flex-col",
|
|
1605
1442
|
"data-testid": "product-create-details-form-header",
|
|
1606
|
-
children: /* @__PURE__ */
|
|
1443
|
+
children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
|
|
1607
1444
|
}
|
|
1608
1445
|
);
|
|
1609
1446
|
};
|
|
1610
1447
|
|
|
1611
1448
|
// src/pages/products/create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
|
|
1612
|
-
import { Heading as
|
|
1613
|
-
import { useTranslation as
|
|
1614
|
-
import { jsx as
|
|
1449
|
+
import { Heading as Heading3 } from "@medusajs/ui";
|
|
1450
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
1451
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1615
1452
|
var ProductCreateOrganizationSection = () => {
|
|
1616
1453
|
const form = useTabbedForm();
|
|
1617
|
-
const { t } =
|
|
1454
|
+
const { t } = useTranslation6();
|
|
1618
1455
|
const collections = useComboboxData({
|
|
1619
1456
|
queryKey: ["product_collections"],
|
|
1620
1457
|
queryFn: (params) => sdk.vendor.collections.query(params),
|
|
@@ -1639,9 +1476,9 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1639
1476
|
value: tag.id
|
|
1640
1477
|
}))
|
|
1641
1478
|
});
|
|
1642
|
-
return /* @__PURE__ */
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
|
|
1480
|
+
/* @__PURE__ */ jsx6(Heading3, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
|
|
1481
|
+
/* @__PURE__ */ jsx6(
|
|
1645
1482
|
SwitchBox,
|
|
1646
1483
|
{
|
|
1647
1484
|
control: form.control,
|
|
@@ -1651,30 +1488,37 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1651
1488
|
optional: true
|
|
1652
1489
|
}
|
|
1653
1490
|
),
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-category-collection", children: [
|
|
1492
|
+
/* @__PURE__ */ jsx6(
|
|
1656
1493
|
Form.Field,
|
|
1657
1494
|
{
|
|
1658
1495
|
control: form.control,
|
|
1659
1496
|
name: "category_id",
|
|
1660
1497
|
render: ({ field }) => {
|
|
1661
|
-
return /* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
|
|
1664
|
-
|
|
1498
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-category-item", children: [
|
|
1499
|
+
/* @__PURE__ */ jsx6(
|
|
1500
|
+
Form.Label,
|
|
1501
|
+
{
|
|
1502
|
+
tooltip: t("products.fields.primaryCategory.tooltip"),
|
|
1503
|
+
"data-testid": "product-create-organize-section-category-label",
|
|
1504
|
+
children: t("fields.category")
|
|
1505
|
+
}
|
|
1506
|
+
),
|
|
1507
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-category-control", children: /* @__PURE__ */ jsx6(SingleCategoryCombobox, { ...field }) }),
|
|
1508
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1665
1509
|
] });
|
|
1666
1510
|
}
|
|
1667
1511
|
}
|
|
1668
1512
|
),
|
|
1669
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ jsx6(
|
|
1670
1514
|
Form.Field,
|
|
1671
1515
|
{
|
|
1672
1516
|
control: form.control,
|
|
1673
1517
|
name: "collection_id",
|
|
1674
1518
|
render: ({ field }) => {
|
|
1675
|
-
return /* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
|
|
1520
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
|
|
1521
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx6(
|
|
1678
1522
|
Combobox,
|
|
1679
1523
|
{
|
|
1680
1524
|
...field,
|
|
@@ -1684,22 +1528,22 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1684
1528
|
fetchNextPage: collections.fetchNextPage
|
|
1685
1529
|
}
|
|
1686
1530
|
) }),
|
|
1687
|
-
/* @__PURE__ */
|
|
1531
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1688
1532
|
] });
|
|
1689
1533
|
}
|
|
1690
1534
|
}
|
|
1691
1535
|
)
|
|
1692
1536
|
] }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-tags", children: [
|
|
1538
|
+
/* @__PURE__ */ jsx6(
|
|
1695
1539
|
Form.Field,
|
|
1696
1540
|
{
|
|
1697
1541
|
control: form.control,
|
|
1698
1542
|
name: "type_id",
|
|
1699
1543
|
render: ({ field }) => {
|
|
1700
|
-
return /* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1544
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
|
|
1545
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
|
|
1546
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx6(
|
|
1703
1547
|
Combobox,
|
|
1704
1548
|
{
|
|
1705
1549
|
...field,
|
|
@@ -1709,20 +1553,20 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1709
1553
|
fetchNextPage: types.fetchNextPage
|
|
1710
1554
|
}
|
|
1711
1555
|
) }),
|
|
1712
|
-
/* @__PURE__ */
|
|
1556
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1713
1557
|
] });
|
|
1714
1558
|
}
|
|
1715
1559
|
}
|
|
1716
1560
|
),
|
|
1717
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ jsx6(
|
|
1718
1562
|
Form.Field,
|
|
1719
1563
|
{
|
|
1720
1564
|
control: form.control,
|
|
1721
1565
|
name: "tags",
|
|
1722
1566
|
render: ({ field }) => {
|
|
1723
|
-
return /* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
|
|
1568
|
+
/* @__PURE__ */ jsx6(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
|
|
1569
|
+
/* @__PURE__ */ jsx6(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx6(
|
|
1726
1570
|
Combobox,
|
|
1727
1571
|
{
|
|
1728
1572
|
...field,
|
|
@@ -1732,7 +1576,7 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1732
1576
|
fetchNextPage: tags.fetchNextPage
|
|
1733
1577
|
}
|
|
1734
1578
|
) }),
|
|
1735
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ jsx6(Form.ErrorMessage, {})
|
|
1736
1580
|
] });
|
|
1737
1581
|
}
|
|
1738
1582
|
}
|
|
@@ -1742,19 +1586,19 @@ var ProductCreateOrganizationSection = () => {
|
|
|
1742
1586
|
};
|
|
1743
1587
|
|
|
1744
1588
|
// src/pages/products/create/components/product-create-organize-form/product-create-organize-form.tsx
|
|
1745
|
-
import { jsx as
|
|
1589
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1746
1590
|
var Root3 = () => {
|
|
1747
|
-
return /* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ jsx7(
|
|
1748
1592
|
"div",
|
|
1749
1593
|
{
|
|
1750
1594
|
className: "flex flex-col items-center p-16",
|
|
1751
1595
|
"data-testid": "product-create-organize-form",
|
|
1752
|
-
children: /* @__PURE__ */
|
|
1596
|
+
children: /* @__PURE__ */ jsx7(
|
|
1753
1597
|
"div",
|
|
1754
1598
|
{
|
|
1755
1599
|
className: "flex w-full max-w-[720px] flex-col gap-y-8",
|
|
1756
1600
|
"data-testid": "product-create-organize-form-content",
|
|
1757
|
-
children: /* @__PURE__ */
|
|
1601
|
+
children: /* @__PURE__ */ jsx7(ProductCreateOrganizationSection, {})
|
|
1758
1602
|
}
|
|
1759
1603
|
)
|
|
1760
1604
|
}
|
|
@@ -1781,30 +1625,33 @@ Root3._tabMeta = defineTabMeta({
|
|
|
1781
1625
|
var ProductCreateOrganizeForm = Root3;
|
|
1782
1626
|
|
|
1783
1627
|
// src/pages/products/create/components/product-create-variants-form/product-create-variants-form.tsx
|
|
1784
|
-
import {
|
|
1785
|
-
import {
|
|
1786
|
-
import {
|
|
1787
|
-
import {
|
|
1628
|
+
import { Input as Input3 } from "@medusajs/ui";
|
|
1629
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
1630
|
+
import { useWatch } from "react-hook-form";
|
|
1631
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1632
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1788
1633
|
var Root4 = () => {
|
|
1634
|
+
const { t } = useTranslation7();
|
|
1789
1635
|
const form = useTabbedForm();
|
|
1790
1636
|
const { setCloseOnEscape } = useRouteModal();
|
|
1791
|
-
const
|
|
1637
|
+
const [search, setSearch] = useState3("");
|
|
1638
|
+
const variants = useWatch({
|
|
1792
1639
|
control: form.control,
|
|
1793
1640
|
name: "variants",
|
|
1794
1641
|
defaultValue: []
|
|
1795
1642
|
});
|
|
1796
|
-
const watchedAttributes =
|
|
1643
|
+
const watchedAttributes = useWatch({
|
|
1797
1644
|
control: form.control,
|
|
1798
1645
|
name: "attributes",
|
|
1799
1646
|
defaultValue: []
|
|
1800
1647
|
});
|
|
1801
|
-
const variantAxes =
|
|
1648
|
+
const variantAxes = useMemo2(() => {
|
|
1802
1649
|
return (watchedAttributes ?? []).filter((attr) => attr.use_for_variants && attr.title).map((attr) => ({
|
|
1803
1650
|
title: attr.title
|
|
1804
1651
|
}));
|
|
1805
1652
|
}, [watchedAttributes]);
|
|
1806
1653
|
const columns = useColumns2({ variantAxes });
|
|
1807
|
-
const variantData =
|
|
1654
|
+
const variantData = useMemo2(() => {
|
|
1808
1655
|
const ret = [];
|
|
1809
1656
|
variants.forEach((v, i) => {
|
|
1810
1657
|
if (v.should_create) {
|
|
@@ -1813,18 +1660,47 @@ var Root4 = () => {
|
|
|
1813
1660
|
});
|
|
1814
1661
|
return ret;
|
|
1815
1662
|
}, [variants]);
|
|
1816
|
-
|
|
1663
|
+
const filteredVariantData = useMemo2(() => {
|
|
1664
|
+
const query = search.trim().toLowerCase();
|
|
1665
|
+
if (!query) {
|
|
1666
|
+
return variantData;
|
|
1667
|
+
}
|
|
1668
|
+
return variantData.filter((variant) => {
|
|
1669
|
+
const haystack = [
|
|
1670
|
+
variant.title,
|
|
1671
|
+
variant.sku,
|
|
1672
|
+
...Object.values(variant.options ?? {})
|
|
1673
|
+
];
|
|
1674
|
+
return haystack.some((value) => value?.toLowerCase().includes(query));
|
|
1675
|
+
});
|
|
1676
|
+
}, [variantData, search]);
|
|
1677
|
+
const headerContent = /* @__PURE__ */ jsx8(
|
|
1678
|
+
Input3,
|
|
1679
|
+
{
|
|
1680
|
+
type: "search",
|
|
1681
|
+
size: "small",
|
|
1682
|
+
autoComplete: "off",
|
|
1683
|
+
value: search,
|
|
1684
|
+
onChange: (event) => setSearch(event.target.value),
|
|
1685
|
+
placeholder: t(
|
|
1686
|
+
"products.create.variants.productVariants.searchPlaceholder"
|
|
1687
|
+
),
|
|
1688
|
+
"data-testid": "product-create-variants-search-input"
|
|
1689
|
+
}
|
|
1690
|
+
);
|
|
1691
|
+
return /* @__PURE__ */ jsx8(
|
|
1817
1692
|
"div",
|
|
1818
1693
|
{
|
|
1819
1694
|
className: "flex size-full flex-col divide-y overflow-hidden",
|
|
1820
1695
|
"data-testid": "product-create-variants-form",
|
|
1821
|
-
children: /* @__PURE__ */
|
|
1696
|
+
children: /* @__PURE__ */ jsx8("div", { "data-testid": "product-create-variants-form-datagrid", children: /* @__PURE__ */ jsx8(
|
|
1822
1697
|
DataGrid,
|
|
1823
1698
|
{
|
|
1824
1699
|
columns,
|
|
1825
|
-
data:
|
|
1700
|
+
data: filteredVariantData,
|
|
1826
1701
|
state: form,
|
|
1827
|
-
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
1702
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing),
|
|
1703
|
+
headerContent
|
|
1828
1704
|
}
|
|
1829
1705
|
) })
|
|
1830
1706
|
}
|
|
@@ -1840,14 +1716,14 @@ var columnHelper2 = createDataGridHelper();
|
|
|
1840
1716
|
var useColumns2 = ({
|
|
1841
1717
|
variantAxes
|
|
1842
1718
|
}) => {
|
|
1843
|
-
const { t } =
|
|
1844
|
-
return
|
|
1719
|
+
const { t } = useTranslation7();
|
|
1720
|
+
return useMemo2(
|
|
1845
1721
|
() => [
|
|
1846
1722
|
columnHelper2.column({
|
|
1847
1723
|
id: "attributes",
|
|
1848
|
-
header: () => /* @__PURE__ */
|
|
1724
|
+
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(" / ") }) }),
|
|
1849
1725
|
cell: (context) => {
|
|
1850
|
-
return /* @__PURE__ */
|
|
1726
|
+
return /* @__PURE__ */ jsx8(DataGrid.ReadonlyCell, { context, children: variantAxes.map((a) => context.row.original.options?.[a.title]).join(" / ") });
|
|
1851
1727
|
},
|
|
1852
1728
|
disableHiding: true
|
|
1853
1729
|
}),
|
|
@@ -1858,7 +1734,7 @@ var useColumns2 = ({
|
|
|
1858
1734
|
field: (context) => `variants.${context.row.original.originalIndex}.title`,
|
|
1859
1735
|
type: "text",
|
|
1860
1736
|
cell: (context) => {
|
|
1861
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1862
1738
|
}
|
|
1863
1739
|
}),
|
|
1864
1740
|
columnHelper2.column({
|
|
@@ -1868,7 +1744,7 @@ var useColumns2 = ({
|
|
|
1868
1744
|
field: (context) => `variants.${context.row.original.originalIndex}.sku`,
|
|
1869
1745
|
type: "text",
|
|
1870
1746
|
cell: (context) => {
|
|
1871
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx8(DataGrid.TextCell, { context });
|
|
1872
1748
|
}
|
|
1873
1749
|
})
|
|
1874
1750
|
],
|
|
@@ -1877,14 +1753,13 @@ var useColumns2 = ({
|
|
|
1877
1753
|
};
|
|
1878
1754
|
|
|
1879
1755
|
// src/pages/products/create/components/product-create-form/product-create-form.tsx
|
|
1880
|
-
import { jsx as
|
|
1881
|
-
var SAVE_DRAFT_BUTTON = "save-draft-button";
|
|
1756
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1882
1757
|
var ProductCreateForm = ({
|
|
1883
1758
|
children,
|
|
1884
1759
|
schema,
|
|
1885
1760
|
defaultValues: extraDefaults
|
|
1886
1761
|
}) => {
|
|
1887
|
-
const { t } =
|
|
1762
|
+
const { t } = useTranslation8();
|
|
1888
1763
|
const { handleSuccess } = useRouteModal();
|
|
1889
1764
|
const form = useForm({
|
|
1890
1765
|
defaultValues: {
|
|
@@ -1896,7 +1771,7 @@ var ProductCreateForm = ({
|
|
|
1896
1771
|
const { mutateAsync, isPending } = useCreateProduct();
|
|
1897
1772
|
const { feature_flags } = useFeatureFlags();
|
|
1898
1773
|
const productRequestEnabled = !!feature_flags?.[import_types6.MercurFeatureFlags.PRODUCT_REQUEST];
|
|
1899
|
-
const watchedAttributes =
|
|
1774
|
+
const watchedAttributes = useWatch2({
|
|
1900
1775
|
control: form.control,
|
|
1901
1776
|
name: "attributes"
|
|
1902
1777
|
});
|
|
@@ -1906,16 +1781,11 @@ var ProductCreateForm = ({
|
|
|
1906
1781
|
watchedAttributes ?? [],
|
|
1907
1782
|
currentVariants
|
|
1908
1783
|
);
|
|
1909
|
-
if (JSON.stringify(newVariants.map((v) => v.
|
|
1784
|
+
if (JSON.stringify(newVariants.map((v) => v.options)) !== JSON.stringify(currentVariants.map((v) => v.options))) {
|
|
1910
1785
|
form.setValue("variants", newVariants);
|
|
1911
1786
|
}
|
|
1912
|
-
}, [watchedAttributes]);
|
|
1913
|
-
const
|
|
1914
|
-
let isDraftSubmission = false;
|
|
1915
|
-
if (e?.nativeEvent instanceof SubmitEvent) {
|
|
1916
|
-
const submitter = e?.nativeEvent?.submitter;
|
|
1917
|
-
isDraftSubmission = submitter?.dataset?.name === SAVE_DRAFT_BUTTON;
|
|
1918
|
-
}
|
|
1787
|
+
}, [watchedAttributes, form]);
|
|
1788
|
+
const submitProduct = async (values, isDraftSubmission) => {
|
|
1919
1789
|
const media = values.media || [];
|
|
1920
1790
|
const payload = { ...values, media: void 0 };
|
|
1921
1791
|
let uploadedMedia = [];
|
|
@@ -1961,30 +1831,40 @@ var ProductCreateForm = ({
|
|
|
1961
1831
|
}
|
|
1962
1832
|
}
|
|
1963
1833
|
);
|
|
1834
|
+
};
|
|
1835
|
+
const handleSubmit = form.handleSubmit(async (values) => {
|
|
1836
|
+
await submitProduct(values, false);
|
|
1964
1837
|
});
|
|
1965
|
-
const
|
|
1838
|
+
const handleSaveAsDraft = async () => {
|
|
1839
|
+
const titleValid = await form.trigger("title");
|
|
1840
|
+
if (!titleValid) {
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
await submitProduct(form.getValues(), true);
|
|
1844
|
+
};
|
|
1845
|
+
const defaultTabs = useMemo3(
|
|
1966
1846
|
() => [
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
/* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ jsx9(ProductCreateDetailsForm, {}, "details"),
|
|
1848
|
+
/* @__PURE__ */ jsx9(ProductCreateOrganizeForm, {}, "organize"),
|
|
1849
|
+
/* @__PURE__ */ jsx9(ProductCreateAttributesForm, {}, "attributes"),
|
|
1850
|
+
/* @__PURE__ */ jsx9(ProductCreateVariantsForm, {}, "variants")
|
|
1971
1851
|
],
|
|
1972
1852
|
[]
|
|
1973
1853
|
);
|
|
1974
1854
|
const hasCustomChildren = Children.count(children) > 0;
|
|
1975
|
-
return /* @__PURE__ */
|
|
1855
|
+
return /* @__PURE__ */ jsx9(
|
|
1976
1856
|
TabbedForm,
|
|
1977
1857
|
{
|
|
1978
1858
|
form,
|
|
1979
1859
|
onSubmit: handleSubmit,
|
|
1980
1860
|
isLoading: isPending,
|
|
1981
|
-
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */
|
|
1861
|
+
footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs7(
|
|
1982
1862
|
"div",
|
|
1983
1863
|
{
|
|
1984
1864
|
className: "flex items-center justify-end gap-x-2",
|
|
1985
1865
|
"data-testid": "product-create-form-footer-actions",
|
|
1986
1866
|
children: [
|
|
1987
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsx9(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
1988
1868
|
Button3,
|
|
1989
1869
|
{
|
|
1990
1870
|
variant: "secondary",
|
|
@@ -1993,19 +1873,20 @@ var ProductCreateForm = ({
|
|
|
1993
1873
|
children: t("actions.cancel")
|
|
1994
1874
|
}
|
|
1995
1875
|
) }),
|
|
1996
|
-
/* @__PURE__ */
|
|
1876
|
+
/* @__PURE__ */ jsx9(
|
|
1997
1877
|
Button3,
|
|
1998
1878
|
{
|
|
1999
|
-
"
|
|
1879
|
+
variant: "secondary",
|
|
2000
1880
|
size: "small",
|
|
2001
|
-
type: "
|
|
1881
|
+
type: "button",
|
|
1882
|
+
onClick: handleSaveAsDraft,
|
|
2002
1883
|
isLoading,
|
|
2003
1884
|
className: "whitespace-nowrap",
|
|
2004
1885
|
"data-testid": "product-create-form-save-draft-button",
|
|
2005
1886
|
children: t("actions.saveAsDraft")
|
|
2006
1887
|
}
|
|
2007
1888
|
),
|
|
2008
|
-
isLastTab ? /* @__PURE__ */
|
|
1889
|
+
isLastTab ? /* @__PURE__ */ jsx9(
|
|
2009
1890
|
Button3,
|
|
2010
1891
|
{
|
|
2011
1892
|
"data-name": "publish-button",
|
|
@@ -2017,7 +1898,7 @@ var ProductCreateForm = ({
|
|
|
2017
1898
|
children: t("actions.publish")
|
|
2018
1899
|
},
|
|
2019
1900
|
"submit-button"
|
|
2020
|
-
) : /* @__PURE__ */
|
|
1901
|
+
) : /* @__PURE__ */ jsx9(
|
|
2021
1902
|
Button3,
|
|
2022
1903
|
{
|
|
2023
1904
|
type: "button",
|
|
@@ -2038,13 +1919,13 @@ var ProductCreateForm = ({
|
|
|
2038
1919
|
};
|
|
2039
1920
|
|
|
2040
1921
|
// src/pages/products/create/product-create.tsx
|
|
2041
|
-
import { jsx as
|
|
1922
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2042
1923
|
var Root5 = ({ children }) => {
|
|
2043
|
-
const { t } =
|
|
2044
|
-
return /* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2046
|
-
/* @__PURE__ */
|
|
2047
|
-
Children2.count(children) > 0 ? children : /* @__PURE__ */
|
|
1924
|
+
const { t } = useTranslation9();
|
|
1925
|
+
return /* @__PURE__ */ jsxs8(RouteFocusModal, { children: [
|
|
1926
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.title") }) }),
|
|
1927
|
+
/* @__PURE__ */ jsx10(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx10("span", { className: "sr-only", children: t("products.create.description") }) }),
|
|
1928
|
+
Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx10(ProductCreateForm, {})
|
|
2048
1929
|
] });
|
|
2049
1930
|
};
|
|
2050
1931
|
var ProductCreate = Root5;
|