@mercurjs/vendor 2.2.1 → 2.3.0-canary.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]-47SUX5X3.js → [id]-3IFUEMOA.js} +12 -9
- package/dist/{[id]-PIB2DEVI.js → [id]-3NM7G2QP.js} +11 -8
- package/dist/[id]-3TCOLUQH.js +197 -0
- package/dist/{[id]-SKU5SFBG.js → [id]-4IWSF6TW.js} +137 -204
- package/dist/{[id]-BPQNQFVE.js → [id]-AMZFAAJ3.js} +75 -124
- package/dist/[id]-C3TB6V2O.js +286 -0
- package/dist/{[id]-NGRV5I2A.js → [id]-HEDNHQ5Z.js} +8 -6
- package/dist/[id]-KFACDZAI.js +949 -0
- package/dist/{[id]-BHU5BSQT.js → [id]-KFRGBNLH.js} +19 -16
- package/dist/{[id]-OE5TUWNF.js → [id]-OVWD6DNG.js} +8 -6
- package/dist/{[id]-RJRAZN3T.js → [id]-PJ2K4O3C.js} +7 -5
- package/dist/{[id]-ZD5HBP2R.js → [id]-ROMWNPJA.js} +13 -10
- package/dist/[id]-UPNI3OCU.js +697 -0
- package/dist/{[id]-YB3DBBXT.js → [id]-YFLQXZGC.js} +12 -9
- package/dist/{[province_id]-CUWKNPBW.js → [province_id]-IM22PLJP.js} +8 -6
- package/dist/{add-YEUSE5QA.js → add-AUSWWCA3.js} +9 -7
- package/dist/{add-MYV5IOGP.js → add-MBCWT6XT.js} +157 -227
- package/dist/{add-customer-groups-Q3F357F2.js → add-customer-groups-3FD754Z2.js} +7 -5
- package/dist/{add-products-WVNYODC6.js → add-products-IS22SHHN.js} +12 -9
- package/dist/{add-promotions-F62YE3BE.js → add-promotions-VDD5PKMN.js} +27 -9
- package/dist/{add-to-campaign-WBSCTSKW.js → add-to-campaign-B3PGGNFA.js} +3 -2
- package/dist/{address-ZMZ4ST5T.js → address-7HSQSXUS.js} +6 -4
- package/dist/{adjust-inventory-QUGKDXOC.js → adjust-inventory-2OKDFVLK.js} +2 -3
- package/dist/{allocate-items-7NSBGXSF.js → allocate-items-QAYROQMK.js} +4 -2
- package/dist/{areas-EJCZBY2E.js → areas-WQ44GWQO.js} +2 -2
- package/dist/{breadcrumb-M657ZCG6.js → breadcrumb-4I7MU2QY.js} +1 -1
- package/dist/{breadcrumb-KNBZ3JNR.js → breadcrumb-7ZFC43R4.js} +1 -1
- package/dist/{breadcrumb-C7M5PG2Q.js → breadcrumb-IDLCUHX3.js} +6 -4
- package/dist/{breadcrumb-MXYWEBK6.js → breadcrumb-OXRGEOVL.js} +6 -4
- package/dist/{breadcrumb-JWFTKHLE.js → breadcrumb-RQ52GELM.js} +2 -1
- package/dist/{breadcrumb-QPV566YX.js → breadcrumb-UDSK4EUS.js} +7 -5
- package/dist/breadcrumb-XCPUUZUO.js +26 -0
- package/dist/{campaigns-BPLAE6QQ.js → campaigns-LIPKZKI7.js} +5 -4
- package/dist/{categories-H2XAJCGC.js → categories-D2U6VLH5.js} +2 -2
- package/dist/{chunk-4RVWITM2.js → chunk-3JWHERV7.js} +76 -23
- package/dist/{chunk-BCXREBMV.js → chunk-4ATO577Q.js} +1 -1
- package/dist/{chunk-VHFKJLDH.js → chunk-4JVORTN4.js} +1 -1
- package/dist/{chunk-HHD2VUED.js → chunk-4UKAKFKL.js} +1 -1
- package/dist/{chunk-3L7WHWKB.js → chunk-5DRYAIOY.js} +3 -3
- package/dist/{chunk-7TIZP4YG.js → chunk-5RWK4U4V.js} +26 -0
- package/dist/{chunk-UEKRQS5Q.js → chunk-6ECHPZS3.js} +2 -2
- package/dist/{chunk-IWAL74YU.js → chunk-6GQLSWOO.js} +1 -1
- package/dist/{chunk-HCUIYIIY.js → chunk-6OZQTHCR.js} +1 -1
- package/dist/chunk-6XMUN2BZ.js +0 -0
- package/dist/{chunk-RLRWDHME.js → chunk-6YQR2AWM.js} +3 -20
- package/dist/{chunk-26OOAKQ6.js → chunk-7H6NMQ6U.js} +8 -1
- package/dist/{chunk-SVYBMLVN.js → chunk-7J2QRH4V.js} +1 -1
- package/dist/chunk-7LIENHWP.js +26 -0
- package/dist/{chunk-EPSRO7C5.js → chunk-7LIT4GXO.js} +2 -2
- package/dist/chunk-7POOMBIN.js +108 -0
- package/dist/{chunk-SDFZUBS3.js → chunk-CDZALZ5E.js} +1 -1
- package/dist/{chunk-72HQFLZI.js → chunk-CSEB2RNO.js} +1 -1
- package/dist/{chunk-X6ZQMFCT.js → chunk-DAOSTHVB.js} +44 -25
- package/dist/chunk-FKKI62AC.js +282 -0
- package/dist/{chunk-VBKW4GWP.js → chunk-FPBXQIFJ.js} +1 -1
- package/dist/{chunk-SI55QRZ4.js → chunk-G5NNOOHR.js} +59 -6
- package/dist/chunk-G6J5ZKM3.js +31 -0
- package/dist/{chunk-U5V6HNVW.js → chunk-GL3XVUAY.js} +1 -1
- package/dist/{chunk-RJE4MAYB.js → chunk-GYLRZXWS.js} +1 -1
- package/dist/{chunk-3XW55FZY.js → chunk-IYQHEISY.js} +6 -6
- package/dist/chunk-IZI2PKL7.js +27 -0
- package/dist/chunk-JN6MHI6V.js +334 -0
- package/dist/{chunk-YUQA6TUA.js → chunk-JOCO7JOB.js} +3 -3
- package/dist/{chunk-OGUTFP6B.js → chunk-JYUHDM23.js} +13 -51
- package/dist/{chunk-QB7BI4B7.js → chunk-K2DXXPNA.js} +153 -86
- package/dist/{chunk-XG76XXM2.js → chunk-KKMA6VPG.js} +1 -1
- package/dist/chunk-KVAD5JGS.js +11 -0
- package/dist/{chunk-YRZ53SAN.js → chunk-L26J5MO2.js} +2 -2
- package/dist/{chunk-FEVCBT24.js → chunk-LOSVZJXS.js} +2 -2
- package/dist/{chunk-63XYNXUL.js → chunk-LYP7XK5O.js} +1 -1
- package/dist/chunk-MVVFD2JT.js +51 -0
- package/dist/{chunk-RVFPWOR2.js → chunk-MY5H7C3A.js} +2 -2
- package/dist/{chunk-GTNCNKTC.js → chunk-NP5TISFX.js} +1 -1
- package/dist/{chunk-3GSR455R.js → chunk-NQMHP2LC.js} +1 -1
- package/dist/{chunk-2S2WK2OG.js → chunk-NV2RZAHW.js} +1 -10
- package/dist/{chunk-4IIATKG7.js → chunk-O7OWHKWA.js} +6 -6
- package/dist/{chunk-GIKVFOQL.js → chunk-OJCMHDZI.js} +2 -2
- package/dist/chunk-QLOJNFUE.js +53 -0
- package/dist/{chunk-OKJHUQBY.js → chunk-QSS7ATY3.js} +15 -27
- package/dist/{chunk-XVBONKRV.js → chunk-RCMKDW6O.js} +1 -1
- package/dist/{chunk-WJF24CGA.js → chunk-RDLVH6CM.js} +33 -5
- package/dist/chunk-SF5N2HX4.js +268 -0
- package/dist/{chunk-MQR26KYT.js → chunk-SYHA2RVL.js} +1 -1
- package/dist/{chunk-ZXDMPIXN.js → chunk-U3OEGBHH.js} +2 -2
- package/dist/{chunk-EJBOBB4B.js → chunk-V3N2Y4OL.js} +46 -46
- package/dist/{chunk-UUBGLS7U.js → chunk-V43BEBDT.js} +187 -35
- package/dist/{chunk-VBRTC2VU.js → chunk-VAFGNDAP.js} +4 -3
- package/dist/{chunk-4UQMRTSC.js → chunk-VH3TGSWE.js} +46 -2
- package/dist/{chunk-ZEKV7LGF.js → chunk-VV2K3EBF.js} +1 -1
- package/dist/{chunk-S2VYK3YC.js → chunk-WI2ZAFZF.js} +1 -1
- package/dist/chunk-WP3B4NEU.js +32 -0
- package/dist/{chunk-DY3XQPHC.js → chunk-WW2XYOHJ.js} +5 -3
- package/dist/{chunk-IVYIMGQC.js → chunk-X44P463Q.js} +45 -10
- package/dist/{chunk-R5KN6IFB.js → chunk-XHWBTV72.js} +2 -2
- package/dist/{chunk-OVHIUZ3K.js → chunk-XQ47NZJC.js} +1 -1
- package/dist/{chunk-LN7XHEPJ.js → chunk-YT4RAUWM.js} +2 -2
- package/dist/{chunk-6VKJM537.js → chunk-ZK4DIDXG.js} +1 -1
- package/dist/{collections-52DJLHWW.js → collections-3MEKABDT.js} +13 -12
- package/dist/{configuration-UMRBE5RQ.js → configuration-QK2FW2CV.js} +2 -2
- package/dist/{configuration-QEDVL2WF.js → configuration-RYH3VUBV.js} +15 -48
- package/dist/{create-ALUKAFJS.js → create-5M66YUYY.js} +2 -2
- package/dist/{create-ABRPUMHQ.js → create-75C65ZIS.js} +6 -5
- package/dist/{create-6IRD2CVC.js → create-A3CQXIRQ.js} +11 -9
- package/dist/{create-LYNWCP2N.js → create-GYNDVCY2.js} +5 -4
- package/dist/create-ICCAEOSA.js +343 -0
- package/dist/{create-5RQ32XPT.js → create-KBDT33O2.js} +287 -287
- package/dist/{create-GEYXN6SW.js → create-L5HMOVY5.js} +6 -4
- package/dist/{create-MFGMTZ5A.js → create-M2W5N6QV.js} +7 -5
- package/dist/{create-NTZH45DW.js → create-NSJGRO4L.js} +13 -11
- package/dist/{create-H77ZUZG5.js → create-O4K6TO4G.js} +9 -7
- package/dist/{create-S7VYYTUD.js → create-PW5L3MJI.js} +9 -7
- package/dist/{create-7SJ5DSQK.js → create-UQ26QTPQ.js} +19 -16
- package/dist/{create-2I3GAX4C.js → create-WIGBFSRH.js} +15 -6
- package/dist/{create-7FT7N2NH.js → create-WPN3OUJU.js} +3 -2
- package/dist/{create-G76MVCJU.js → create-ZVGYET6W.js} +5 -4
- package/dist/customer-availability-VAOKKCTK.js +164 -0
- package/dist/{customer-group-add-customers-T7OYWJCB.js → customer-group-add-customers-BSMUKWVO.js} +1 -1
- package/dist/{customer-group-detail-E7HRZ3LE.js → customer-group-detail-QCPC2YWK.js} +2 -2
- package/dist/{customer-groups-26HJ55MF.js → customer-groups-6WGUNFHG.js} +2 -2
- package/dist/{customers-EXFRZX5F.js → customers-7OGYQSGA.js} +2 -2
- package/dist/edit-2BKYNGYL.js +262 -0
- package/dist/{edit-M4AP65HO.js → edit-32ZGQUWZ.js} +7 -5
- package/dist/{edit-MPOTIGUY.js → edit-3OXHBHY4.js} +22 -38
- package/dist/{edit-2RN3OT27.js → edit-7T2JMZG3.js} +7 -56
- package/dist/{edit-6VJWRZHQ.js → edit-AFWQY3BZ.js} +6 -4
- package/dist/{edit-NB5VN2E4.js → edit-EDXF3T7F.js} +4 -3
- package/dist/edit-GJCXPD5A.js +81 -0
- package/dist/{edit-WHGYNDEB.js → edit-KOLDPZ4H.js} +19 -16
- package/dist/{edit-TIBQEQVV.js → edit-LZFD3RSY.js} +9 -7
- package/dist/{edit-QBUYHSE7.js → edit-QVK3BEPA.js} +7 -5
- package/dist/{edit-EGBVEWXS.js → edit-ZLZR7F33.js} +8 -6
- package/dist/{edit-H5FJ45ZT.js → edit-ZM7NJVRE.js} +1 -1
- package/dist/{edit-budget-PYPHUJPW.js → edit-budget-MOZETGZV.js} +1 -1
- package/dist/{edit-inventory-item-BCVECCLT.js → edit-inventory-item-HFGHS732.js} +17 -14
- package/dist/{edit-inventory-item-attributes-GWEMP67O.js → edit-inventory-item-attributes-5ORZJF4I.js} +18 -1
- package/dist/edit-reservation-LSYQUDYQ.js +294 -0
- package/dist/extension-targets.d.ts +6 -3
- package/dist/{fulfillment-HDU7GATG.js → fulfillment-TVRF5TID.js} +6 -4
- package/dist/{fulfillment-providers-6RZNNT7U.js → fulfillment-providers-TEV23LGB.js} +11 -10
- package/dist/index.css +14 -14
- package/dist/index.js +252 -146
- package/dist/{inventory-XJ2E6DPC.js → inventory-CMIRAJJY.js} +2 -2
- package/dist/{invite-755AJC3M.js → invite-K3R2GRYF.js} +6 -4
- package/dist/{invite-FD2TXZTW.js → invite-ZMIYLOWJ.js} +9 -7
- package/dist/{login-UGKYRKMD.js → login-LG3XH6B2.js} +8 -6
- package/dist/{manage-locations-PRQI5TI4.js → manage-locations-5B4HP6NQ.js} +24 -5
- package/dist/{media-TGFAHFBV.js → media-DY2XDZYT.js} +7 -5
- package/dist/{media-2KEHXPRU.js → media-OGO6M3CP.js} +10 -8
- package/dist/{metadata-BQQFHVKF.js → metadata-AW5Y72BI.js} +6 -4
- package/dist/metadata-HS6CLO4Z.js +69 -0
- package/dist/{metadata-5TVRCKWX.js → metadata-HXXVD3VP.js} +6 -4
- package/dist/{metadata-7JWZ4VFM.js → metadata-TXNUZBPX.js} +6 -4
- package/dist/{metadata-G73TILNE.js → metadata-UVOHT2VF.js} +6 -4
- package/dist/{metadata-4ZZ4ZIWJ.js → metadata-ZBSZL74N.js} +6 -4
- package/dist/{offer-create-page-PPXRYET4.js → offer-create-page-53P65U2V.js} +11 -8
- package/dist/{offer-detail-page-BFGKAS4L.js → offer-detail-page-BGFLDXO7.js} +1 -1
- package/dist/{offer-variant-detail-page-BLHRF4MK.js → offer-variant-detail-page-DCTRZUTM.js} +1 -1
- package/dist/{offers-7I67VSHI.js → offers-5776XUH5.js} +13 -9
- package/dist/{onboarding-7MURQYXX.js → onboarding-ROLIHG3L.js} +6 -4
- package/dist/{orders-D7NZNDUS.js → orders-VA3HNJAY.js} +12 -11
- package/dist/{organization-T6ZTYMMW.js → organization-UH4IUA62.js} +8 -6
- package/dist/pages/index.d.ts +9 -1
- package/dist/pages/index.js +53 -44
- package/dist/{payment-details-UQ65D5AY.js → payment-details-CD4GZEUL.js} +6 -4
- package/dist/{payouts-A336D2HG.js → payouts-26ZOYDRP.js} +2 -2
- package/dist/{price-lists-3WRT4TR2.js → price-lists-U5ASDHMI.js} +5 -8
- package/dist/{pricing-CPPIL627.js → pricing-SWUZSQL3.js} +8 -6
- package/dist/{product-tags-7DTA73YT.js → product-tags-4V65LOJJ.js} +19 -16
- package/dist/{product-types-OB26NF2D.js → product-types-CMI33S32.js} +3 -4
- package/dist/{product-variant-detail-4DDE6RJ5.js → product-variant-detail-NW3LQZE7.js} +6 -4
- package/dist/{product-variant-edit-SAZUI4E3.js → product-variant-edit-MNYFEZND.js} +9 -7
- package/dist/{products-RYXTZFGT.js → products-L2H6HOL2.js} +18 -15
- package/dist/{products-GJ2KTGBZ.js → products-YIF6FPBO.js} +12 -9
- package/dist/{professional-details-UN5B4YDJ.js → professional-details-QO5BWMRD.js} +6 -4
- package/dist/{profile-6MIDTK52.js → profile-2KKBVKAL.js} +6 -4
- package/dist/{promotions-SQ47TCZL.js → promotions-C5YWXVP5.js} +5 -5
- package/dist/{receive-ZG6FFN7H.js → receive-RRZK3FP2.js} +4 -3
- package/dist/{refund-KJX74N6T.js → refund-FLCZAMPR.js} +3 -2
- package/dist/{register-RDSK4E4D.js → register-SZ2T6QQA.js} +8 -6
- package/dist/reservations-C326XEVA.js +350 -0
- package/dist/{reset-password-C462PDN2.js → reset-password-H66R27K4.js} +1 -1
- package/dist/respond-IPRDCH57.js +132 -0
- package/dist/{return-reasons-MY63HNF6.js → return-reasons-2BUKIQBO.js} +9 -7
- package/dist/reviews-LBLCFBRQ.js +14 -0
- package/dist/{settings-TJ6HPHMK.js → settings-THSRJ5WS.js} +26 -23
- package/dist/{shipment-6CTA2GHU.js → shipment-X2WWJ3AE.js} +6 -4
- package/dist/{shipping-profile-CFISOMTE.js → shipping-profile-7P3RPEIJ.js} +1 -1
- package/dist/{shipping-profiles-5UAZNYKJ.js → shipping-profiles-JPBRRMPD.js} +8 -6
- package/dist/{stock-465GEUY3.js → stock-UMESDWV5.js} +21 -7
- package/dist/{store-2PQB2XWE.js → store-5YMOSKVT.js} +7 -5
- package/dist/{store-closure-DYW54VHB.js → store-closure-EPGDOV7U.js} +6 -4
- package/dist/{store-select-6A5YR7WH.js → store-select-JEEV4V57.js} +7 -5
- package/dist/{team-GXEBC57M.js → team-R6ARMF73.js} +9 -7
- package/package.json +12 -9
- package/dist/[id]-HEVGSOAV.js +0 -598
- package/dist/[id]-MU7A6SZO.js +0 -526
- package/dist/chunk-2ZFELO2L.js +0 -13
- package/dist/chunk-6IJMSVC6.js +0 -16
- package/dist/chunk-BNOKKKUU.js +0 -88
- package/dist/chunk-BX3JE7IE.js +0 -247
- package/dist/edit-4B364HGZ.js +0 -222
- package/dist/edit-SQU5UOGE.js +0 -105
- package/dist/{[location_id]-OXNC5E4F.js → [location_id]-IGPM7LDR.js} +1 -1
- package/dist/{chunk-CYE7HVAV.js → chunk-SCJBJQCL.js} +3 -3
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
PriceListCustomerAvailabilitySelector
|
|
3
|
+
} from "./chunk-FKKI62AC.js";
|
|
4
|
+
import {
|
|
5
|
+
PriceListCreateOffersSchema,
|
|
3
6
|
PriceListRulesSchema,
|
|
4
7
|
usePriceListCurrencyData,
|
|
5
8
|
usePriceListGridColumns
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
exctractPricesFromProducts,
|
|
9
|
-
isProductRow
|
|
10
|
-
} from "./chunk-BNOKKKUU.js";
|
|
11
|
-
import "./chunk-6IJMSVC6.js";
|
|
9
|
+
} from "./chunk-DAOSTHVB.js";
|
|
12
10
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-S2VYK3YC.js";
|
|
11
|
+
extractPricesFromOffers
|
|
12
|
+
} from "./chunk-KVAD5JGS.js";
|
|
16
13
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
collectOfferIds,
|
|
15
|
+
useOfferTableColumns,
|
|
16
|
+
useOfferTableFilters,
|
|
17
|
+
useOfferTableQuery
|
|
18
|
+
} from "./chunk-QSS7ATY3.js";
|
|
19
|
+
import "./chunk-XQUF3WIS.js";
|
|
20
|
+
import "./chunk-VKOE5J66.js";
|
|
21
|
+
import "./chunk-JHIMVLB2.js";
|
|
22
|
+
import "./chunk-CMHI2RPL.js";
|
|
23
|
+
import "./chunk-6XMUN2BZ.js";
|
|
24
|
+
import "./chunk-WI2ZAFZF.js";
|
|
19
25
|
import "./chunk-FWPGOIFA.js";
|
|
20
|
-
import
|
|
21
|
-
useProductTableFilters
|
|
22
|
-
} from "./chunk-ZXDMPIXN.js";
|
|
26
|
+
import "./chunk-U3OEGBHH.js";
|
|
23
27
|
import "./chunk-DB6ANJBO.js";
|
|
24
28
|
import "./chunk-PHOCVOZ5.js";
|
|
25
29
|
import {
|
|
26
30
|
DataGrid
|
|
27
31
|
} from "./chunk-5FBQOAXU.js";
|
|
28
32
|
import "./chunk-IQPN4PZJ.js";
|
|
29
|
-
import "./chunk-SMQT3ZNO.js";
|
|
30
33
|
import "./chunk-TKGWSUEI.js";
|
|
31
34
|
import {
|
|
32
35
|
KeyboundForm
|
|
@@ -42,27 +45,29 @@ import "./chunk-FQERBIVS.js";
|
|
|
42
45
|
import {
|
|
43
46
|
_DataTable,
|
|
44
47
|
useDataTable
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-6GQLSWOO.js";
|
|
46
49
|
import "./chunk-YN3FGNJM.js";
|
|
47
50
|
import "./chunk-KCHYLLVG.js";
|
|
48
51
|
import "./chunk-3EF54XFY.js";
|
|
49
52
|
import "./chunk-THHRRYRS.js";
|
|
50
53
|
import "./chunk-LRD242C7.js";
|
|
51
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-VH3TGSWE.js";
|
|
52
55
|
import "./chunk-WIYFXWRI.js";
|
|
53
56
|
import "./chunk-INNFZYX2.js";
|
|
57
|
+
import "./chunk-BDGZ4EQO.js";
|
|
54
58
|
import "./chunk-LAVHRER2.js";
|
|
55
59
|
import "./chunk-QHQWEERJ.js";
|
|
56
60
|
import "./chunk-Y7QKP6QU.js";
|
|
57
|
-
import "./chunk-
|
|
61
|
+
import "./chunk-6YQR2AWM.js";
|
|
58
62
|
import "./chunk-K5324KIX.js";
|
|
59
63
|
import "./chunk-FV76G2D7.js";
|
|
60
64
|
import "./chunk-GHDLST2P.js";
|
|
61
65
|
import "./chunk-YVYYOBAE.js";
|
|
62
66
|
import "./chunk-L2NJPDUD.js";
|
|
67
|
+
import "./chunk-7LIENHWP.js";
|
|
63
68
|
import {
|
|
64
69
|
useCreatePriceList
|
|
65
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-NV2RZAHW.js";
|
|
66
71
|
import "./chunk-MR6REQKT.js";
|
|
67
72
|
import "./chunk-EPSDO2MJ.js";
|
|
68
73
|
import "./chunk-BHEU34FL.js";
|
|
@@ -73,9 +78,12 @@ import "./chunk-J2XUEO2E.js";
|
|
|
73
78
|
import "./chunk-DETQ6IBQ.js";
|
|
74
79
|
import "./chunk-VWPNMEOE.js";
|
|
75
80
|
import "./chunk-O72AIZUN.js";
|
|
76
|
-
import "./chunk-
|
|
77
|
-
import
|
|
78
|
-
|
|
81
|
+
import "./chunk-GL3XVUAY.js";
|
|
82
|
+
import {
|
|
83
|
+
useOffers
|
|
84
|
+
} from "./chunk-PF7R7LMW.js";
|
|
85
|
+
import "./chunk-JYUHDM23.js";
|
|
86
|
+
import "./chunk-7POOMBIN.js";
|
|
79
87
|
import "./chunk-4U2BLH45.js";
|
|
80
88
|
import {
|
|
81
89
|
useProducts
|
|
@@ -103,20 +111,13 @@ import {
|
|
|
103
111
|
Heading,
|
|
104
112
|
Input,
|
|
105
113
|
RadioGroup,
|
|
106
|
-
Select,
|
|
107
114
|
Text,
|
|
108
115
|
Textarea
|
|
109
116
|
} from "@medusajs/ui";
|
|
110
|
-
import { useFieldArray } from "react-hook-form";
|
|
111
117
|
import { useTranslation } from "react-i18next";
|
|
112
118
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
113
119
|
var PriceListDetailsForm = ({ form }) => {
|
|
114
120
|
const { t } = useTranslation();
|
|
115
|
-
const { remove: _remove } = useFieldArray({
|
|
116
|
-
control: form.control,
|
|
117
|
-
name: "rules.customer_group_id",
|
|
118
|
-
keyName: "cg_id"
|
|
119
|
-
});
|
|
120
121
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 px-8 py-16", children: [
|
|
121
122
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
122
123
|
/* @__PURE__ */ jsx(Heading, { children: t("priceLists.create.header") }),
|
|
@@ -128,227 +129,246 @@ var PriceListDetailsForm = ({ form }) => {
|
|
|
128
129
|
control: form.control,
|
|
129
130
|
name: "type",
|
|
130
131
|
render: ({ field: { onChange, ...rest } }) => {
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */ jsxs("div", {
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ jsx(Form.Hint, { children: t("priceLists.fields.type.hint") })
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
138
|
-
RadioGroup,
|
|
139
|
-
{
|
|
140
|
-
onValueChange: onChange,
|
|
141
|
-
...rest,
|
|
142
|
-
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsx(
|
|
145
|
-
RadioGroup.ChoiceBox,
|
|
146
|
-
{
|
|
147
|
-
value: "sale",
|
|
148
|
-
label: t("priceLists.fields.type.options.sale.label"),
|
|
149
|
-
description: t(
|
|
150
|
-
"priceLists.fields.type.options.sale.description"
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
/* @__PURE__ */ jsx(
|
|
155
|
-
RadioGroup.ChoiceBox,
|
|
156
|
-
{
|
|
157
|
-
value: "override",
|
|
158
|
-
label: t(
|
|
159
|
-
"priceLists.fields.type.options.override.label"
|
|
160
|
-
),
|
|
161
|
-
description: t(
|
|
162
|
-
"priceLists.fields.type.options.override.description"
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
) })
|
|
132
|
+
return /* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
134
|
+
/* @__PURE__ */ jsx(Form.Label, { children: t("priceLists.fields.type.label") }),
|
|
135
|
+
/* @__PURE__ */ jsx(Form.Hint, { children: t("priceLists.fields.type.hint") })
|
|
169
136
|
] }),
|
|
137
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
138
|
+
RadioGroup,
|
|
139
|
+
{
|
|
140
|
+
onValueChange: onChange,
|
|
141
|
+
...rest,
|
|
142
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
RadioGroup.ChoiceBox,
|
|
146
|
+
{
|
|
147
|
+
value: "sale",
|
|
148
|
+
label: t("priceLists.fields.type.options.sale.label"),
|
|
149
|
+
description: t(
|
|
150
|
+
"priceLists.fields.type.options.sale.description"
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
RadioGroup.ChoiceBox,
|
|
156
|
+
{
|
|
157
|
+
value: "override",
|
|
158
|
+
label: t(
|
|
159
|
+
"priceLists.fields.type.options.override.label"
|
|
160
|
+
),
|
|
161
|
+
description: t(
|
|
162
|
+
"priceLists.fields.type.options.override.description"
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
) }),
|
|
170
169
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
171
|
-
] });
|
|
170
|
+
] }) });
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
),
|
|
175
174
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/* @__PURE__ */ jsx(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
Form.Field,
|
|
177
|
+
{
|
|
178
|
+
control: form.control,
|
|
179
|
+
name: "status",
|
|
180
|
+
render: ({ field: { onChange, ...rest } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
181
|
+
/* @__PURE__ */ jsx(Form.Label, { children: t("priceLists.fields.status.label") }),
|
|
182
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
183
|
+
RadioGroup,
|
|
184
|
+
{
|
|
185
|
+
onValueChange: onChange,
|
|
186
|
+
...rest,
|
|
187
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsx(
|
|
190
|
+
RadioGroup.ChoiceBox,
|
|
191
|
+
{
|
|
192
|
+
value: "draft",
|
|
193
|
+
label: t("priceLists.fields.status.options.draft"),
|
|
194
|
+
description: t(
|
|
195
|
+
"priceLists.fields.status.descriptions.draft"
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
RadioGroup.ChoiceBox,
|
|
201
|
+
{
|
|
202
|
+
value: "active",
|
|
203
|
+
label: t("priceLists.fields.status.options.active"),
|
|
204
|
+
description: t(
|
|
205
|
+
"priceLists.fields.status.descriptions.active"
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
) }),
|
|
212
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
213
|
+
] })
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
Form.Field,
|
|
218
|
+
{
|
|
219
|
+
control: form.control,
|
|
220
|
+
name: "title",
|
|
221
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
222
|
+
/* @__PURE__ */ jsx(Form.Label, { children: t("fields.title") }),
|
|
223
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
224
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
225
|
+
] })
|
|
226
|
+
}
|
|
227
|
+
),
|
|
212
228
|
/* @__PURE__ */ jsx(
|
|
213
229
|
Form.Field,
|
|
214
230
|
{
|
|
215
231
|
control: form.control,
|
|
216
232
|
name: "description",
|
|
217
|
-
render: ({ field }) => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
] });
|
|
223
|
-
}
|
|
233
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Form.Label, { children: t("fields.description") }),
|
|
235
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
|
|
236
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
237
|
+
] })
|
|
224
238
|
}
|
|
225
239
|
)
|
|
226
240
|
] }),
|
|
227
241
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
shouldCloseOnSelect: false,
|
|
245
|
-
...field
|
|
246
|
-
}
|
|
247
|
-
) })
|
|
248
|
-
] }),
|
|
242
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
Form.Field,
|
|
245
|
+
{
|
|
246
|
+
control: form.control,
|
|
247
|
+
name: "starts_at",
|
|
248
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx(Form.Label, { optional: true, children: t("priceLists.fields.startsAt.label") }),
|
|
250
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
251
|
+
DatePicker,
|
|
252
|
+
{
|
|
253
|
+
granularity: "minute",
|
|
254
|
+
shouldCloseOnSelect: false,
|
|
255
|
+
...field
|
|
256
|
+
}
|
|
257
|
+
) }),
|
|
249
258
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
250
|
-
] })
|
|
259
|
+
] })
|
|
251
260
|
}
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ jsx(
|
|
263
|
+
Form.Field,
|
|
264
|
+
{
|
|
265
|
+
control: form.control,
|
|
266
|
+
name: "ends_at",
|
|
267
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
268
|
+
/* @__PURE__ */ jsx(Form.Label, { optional: true, children: t("priceLists.fields.endsAt.label") }),
|
|
269
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
270
|
+
DatePicker,
|
|
271
|
+
{
|
|
272
|
+
granularity: "minute",
|
|
273
|
+
shouldCloseOnSelect: false,
|
|
274
|
+
...field
|
|
275
|
+
}
|
|
276
|
+
) }),
|
|
277
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
278
|
+
] })
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
] }),
|
|
254
282
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
255
283
|
/* @__PURE__ */ jsx(
|
|
256
284
|
Form.Field,
|
|
257
285
|
{
|
|
258
286
|
control: form.control,
|
|
259
|
-
name: "
|
|
260
|
-
render: (
|
|
261
|
-
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
) })
|
|
275
|
-
] }),
|
|
276
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
277
|
-
] });
|
|
278
|
-
}
|
|
287
|
+
name: "rules.customer_group_id",
|
|
288
|
+
render: () => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
289
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
290
|
+
/* @__PURE__ */ jsx(Form.Label, { optional: true, children: t("priceLists.fields.customerAvailability.label") }),
|
|
291
|
+
/* @__PURE__ */ jsx(Form.Hint, { children: t("priceLists.fields.customerAvailability.hint") })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
294
|
+
PriceListCustomerAvailabilitySelector,
|
|
295
|
+
{
|
|
296
|
+
control: form.control,
|
|
297
|
+
name: "rules.customer_group_id"
|
|
298
|
+
}
|
|
299
|
+
) }),
|
|
300
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
301
|
+
] })
|
|
279
302
|
}
|
|
280
303
|
)
|
|
281
304
|
] }) });
|
|
282
305
|
};
|
|
283
306
|
|
|
284
307
|
// src/pages/price-lists/create/price-list-create-form/price-list-prices-form.tsx
|
|
285
|
-
import {
|
|
308
|
+
import { buildOfferGridData } from "@mercurjs/dashboard-shared";
|
|
309
|
+
import { useEffect, useMemo } from "react";
|
|
286
310
|
import { useWatch } from "react-hook-form";
|
|
287
311
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
312
|
+
var OFFER_GRID_FIELDS = "id,variant_id,product_id,sku,product.title,product.thumbnail";
|
|
288
313
|
var PriceListPricesForm = ({
|
|
289
314
|
form,
|
|
290
315
|
currencies,
|
|
291
316
|
regions,
|
|
292
317
|
pricePreferences
|
|
293
318
|
}) => {
|
|
294
|
-
const ids = useWatch({
|
|
295
|
-
control: form.control,
|
|
296
|
-
name: "product_ids"
|
|
297
|
-
});
|
|
298
|
-
const existingProducts = useWatch({
|
|
299
|
-
control: form.control,
|
|
300
|
-
name: "products"
|
|
301
|
-
});
|
|
302
|
-
const {
|
|
303
|
-
products: productsRaw,
|
|
304
|
-
isLoading,
|
|
305
|
-
isError,
|
|
306
|
-
error
|
|
307
|
-
} = useProducts({
|
|
308
|
-
fields: "title,thumbnail,*variants,+status,*variants.prices"
|
|
309
|
-
});
|
|
310
|
-
const products = productsRaw?.filter(
|
|
311
|
-
(product) => ids.some((id) => id.id === product.id)
|
|
312
|
-
);
|
|
313
|
-
const { setCloseOnEscape } = useRouteModal();
|
|
314
319
|
const { setValue } = form;
|
|
320
|
+
const { setCloseOnEscape } = useRouteModal();
|
|
321
|
+
const offerIds = useWatch({ control: form.control, name: "offer_ids" });
|
|
322
|
+
const existingOffers = useWatch({ control: form.control, name: "offers" });
|
|
323
|
+
const { offers: selectedOffers } = useOffers(
|
|
324
|
+
{
|
|
325
|
+
id: offerIds,
|
|
326
|
+
limit: offerIds?.length || 1,
|
|
327
|
+
fields: OFFER_GRID_FIELDS
|
|
328
|
+
},
|
|
329
|
+
{ enabled: (offerIds?.length ?? 0) > 0 }
|
|
330
|
+
);
|
|
331
|
+
const productIds = useMemo(
|
|
332
|
+
() => Array.from(
|
|
333
|
+
new Set(
|
|
334
|
+
(selectedOffers ?? []).map((o) => o.product_id)
|
|
335
|
+
)
|
|
336
|
+
),
|
|
337
|
+
[selectedOffers]
|
|
338
|
+
);
|
|
339
|
+
const { products, isLoading } = useProducts(
|
|
340
|
+
{ id: productIds, limit: productIds.length || 1, fields: "id,*variants" },
|
|
341
|
+
{ enabled: productIds.length > 0 }
|
|
342
|
+
);
|
|
343
|
+
const { gridData, variantIdByOffer } = useMemo(
|
|
344
|
+
() => buildOfferGridData(
|
|
345
|
+
selectedOffers ?? [],
|
|
346
|
+
products ?? []
|
|
347
|
+
),
|
|
348
|
+
[selectedOffers, products]
|
|
349
|
+
);
|
|
315
350
|
useEffect(() => {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
...product.variants.reduce((variants, variant) => {
|
|
323
|
-
variants[variant.id] = {
|
|
324
|
-
currency_prices: {},
|
|
325
|
-
region_prices: {}
|
|
326
|
-
};
|
|
327
|
-
return variants;
|
|
328
|
-
}, {})
|
|
351
|
+
for (const [offerId, variantId] of Object.entries(variantIdByOffer)) {
|
|
352
|
+
if (!existingOffers?.[offerId]) {
|
|
353
|
+
setValue(`offers.${offerId}`, {
|
|
354
|
+
variant_id: variantId,
|
|
355
|
+
currency_prices: {},
|
|
356
|
+
region_prices: {}
|
|
329
357
|
});
|
|
330
|
-
}
|
|
358
|
+
}
|
|
331
359
|
}
|
|
332
|
-
}, [
|
|
360
|
+
}, [variantIdByOffer, existingOffers, setValue]);
|
|
333
361
|
const columns = usePriceListGridColumns({
|
|
334
362
|
currencies,
|
|
335
363
|
regions,
|
|
336
364
|
pricePreferences
|
|
337
365
|
});
|
|
338
|
-
if (isError) {
|
|
339
|
-
throw error;
|
|
340
|
-
}
|
|
341
366
|
return /* @__PURE__ */ jsx2("div", { className: "flex size-full flex-col divide-y overflow-hidden", children: /* @__PURE__ */ jsx2(
|
|
342
367
|
DataGrid,
|
|
343
368
|
{
|
|
344
369
|
isLoading,
|
|
345
370
|
columns,
|
|
346
|
-
data:
|
|
347
|
-
getSubRows: (row) => {
|
|
348
|
-
if (isProductRow(row) && row.variants) {
|
|
349
|
-
return row.variants;
|
|
350
|
-
}
|
|
351
|
-
},
|
|
371
|
+
data: gridData,
|
|
352
372
|
state: form,
|
|
353
373
|
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
354
374
|
}
|
|
@@ -361,7 +381,7 @@ import { keepPreviousData } from "@tanstack/react-query";
|
|
|
361
381
|
import {
|
|
362
382
|
createColumnHelper
|
|
363
383
|
} from "@tanstack/react-table";
|
|
364
|
-
import { useMemo, useState } from "react";
|
|
384
|
+
import { useMemo as useMemo2, useRef, useState } from "react";
|
|
365
385
|
import { useWatch as useWatch2 } from "react-hook-form";
|
|
366
386
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
367
387
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
@@ -376,58 +396,47 @@ function getInitialSelection(products) {
|
|
|
376
396
|
var PriceListProductsForm = ({ form }) => {
|
|
377
397
|
const { t } = useTranslation2();
|
|
378
398
|
const { control, setValue } = form;
|
|
379
|
-
const selectedIds = useWatch2({
|
|
380
|
-
control,
|
|
381
|
-
name: "product_ids"
|
|
382
|
-
});
|
|
383
|
-
const productRecords = useWatch2({
|
|
384
|
-
control,
|
|
385
|
-
name: "products"
|
|
386
|
-
});
|
|
399
|
+
const selectedIds = useWatch2({ control, name: "product_ids" });
|
|
387
400
|
const [rowSelection, setRowSelection] = useState(
|
|
388
401
|
getInitialSelection(selectedIds)
|
|
389
402
|
);
|
|
390
|
-
const { searchParams, raw } =
|
|
403
|
+
const { searchParams, raw } = useOfferTableQuery({
|
|
391
404
|
pageSize: PAGE_SIZE,
|
|
392
405
|
prefix: PREFIX
|
|
393
406
|
});
|
|
394
407
|
const { products, count, isLoading, isError, error } = useProducts(
|
|
395
|
-
|
|
396
|
-
{
|
|
397
|
-
placeholderData: keepPreviousData
|
|
398
|
-
}
|
|
408
|
+
searchParams,
|
|
409
|
+
{ placeholderData: keepPreviousData }
|
|
399
410
|
);
|
|
411
|
+
const rows = products ?? [];
|
|
412
|
+
const offerMeta = useRef({});
|
|
413
|
+
for (const row of rows) {
|
|
414
|
+
offerMeta.current[row.id] = collectOfferIds(row);
|
|
415
|
+
}
|
|
400
416
|
const updater = (fn) => {
|
|
401
417
|
const state = typeof fn === "function" ? fn(rowSelection) : fn;
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
});
|
|
415
|
-
setValue("products", updatedRecords, {
|
|
416
|
-
shouldDirty: true,
|
|
417
|
-
shouldTouch: true
|
|
418
|
-
});
|
|
418
|
+
const productIds = Object.keys(state).filter(
|
|
419
|
+
(id) => offerMeta.current[id]
|
|
420
|
+
);
|
|
421
|
+
const offerIds = Array.from(
|
|
422
|
+
new Set(productIds.flatMap((id) => offerMeta.current[id] ?? []))
|
|
423
|
+
);
|
|
424
|
+
setValue(
|
|
425
|
+
"product_ids",
|
|
426
|
+
productIds.map((id) => ({ id })),
|
|
427
|
+
{ shouldDirty: true, shouldTouch: true }
|
|
428
|
+
);
|
|
429
|
+
setValue("offer_ids", offerIds, { shouldDirty: true, shouldTouch: true });
|
|
419
430
|
setRowSelection(state);
|
|
420
431
|
};
|
|
421
432
|
const columns = useColumns();
|
|
422
|
-
const filters =
|
|
433
|
+
const filters = useOfferTableFilters();
|
|
423
434
|
const { table } = useDataTable({
|
|
424
|
-
data:
|
|
435
|
+
data: rows,
|
|
425
436
|
columns,
|
|
426
437
|
count,
|
|
427
438
|
enablePagination: true,
|
|
428
|
-
enableRowSelection: (row) =>
|
|
429
|
-
return !!row.original.variants?.length;
|
|
430
|
-
},
|
|
439
|
+
enableRowSelection: (row) => collectOfferIds(row.original).length > 0,
|
|
431
440
|
getRowId: (row) => row.id,
|
|
432
441
|
rowSelection: {
|
|
433
442
|
state: rowSelection,
|
|
@@ -451,15 +460,8 @@ var PriceListProductsForm = ({ form }) => {
|
|
|
451
460
|
layout: "fill",
|
|
452
461
|
orderBy: [
|
|
453
462
|
{ key: "title", label: t("fields.title") },
|
|
454
|
-
{ key: "
|
|
455
|
-
{
|
|
456
|
-
key: "created_at",
|
|
457
|
-
label: t("fields.createdAt")
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
key: "updated_at",
|
|
461
|
-
label: t("fields.updatedAt")
|
|
462
|
-
}
|
|
463
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
464
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
463
465
|
],
|
|
464
466
|
pagination: true,
|
|
465
467
|
search: true,
|
|
@@ -472,41 +474,34 @@ var PriceListProductsForm = ({ form }) => {
|
|
|
472
474
|
};
|
|
473
475
|
var columnHelper = createColumnHelper();
|
|
474
476
|
var useColumns = () => {
|
|
475
|
-
const base =
|
|
476
|
-
return
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
485
|
-
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
},
|
|
489
|
-
cell: ({ row }) => {
|
|
490
|
-
return /* @__PURE__ */ jsx3(
|
|
491
|
-
Checkbox,
|
|
492
|
-
{
|
|
493
|
-
checked: row.getIsSelected(),
|
|
494
|
-
disabled: !row.getCanSelect(),
|
|
495
|
-
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
496
|
-
onClick: (e) => {
|
|
497
|
-
e.stopPropagation();
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
);
|
|
477
|
+
const base = useOfferTableColumns();
|
|
478
|
+
return useMemo2(() => {
|
|
479
|
+
const selectColumn = columnHelper.display({
|
|
480
|
+
id: "select",
|
|
481
|
+
header: ({ table }) => /* @__PURE__ */ jsx3(
|
|
482
|
+
Checkbox,
|
|
483
|
+
{
|
|
484
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
485
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
501
486
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
487
|
+
),
|
|
488
|
+
cell: ({ row }) => /* @__PURE__ */ jsx3(
|
|
489
|
+
Checkbox,
|
|
490
|
+
{
|
|
491
|
+
checked: row.getIsSelected(),
|
|
492
|
+
disabled: !row.getCanSelect(),
|
|
493
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
494
|
+
onClick: (e) => e.stopPropagation()
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
});
|
|
498
|
+
const informative = base.slice(0, -1);
|
|
499
|
+
return [selectColumn, ...informative];
|
|
500
|
+
}, [base]);
|
|
507
501
|
};
|
|
508
502
|
|
|
509
503
|
// src/pages/price-lists/create/price-list-create-form/schema.ts
|
|
504
|
+
import i18n from "i18next";
|
|
510
505
|
import { z } from "zod";
|
|
511
506
|
var PricingCustomerGroupsArray = z.array(
|
|
512
507
|
z.object({
|
|
@@ -517,12 +512,17 @@ var PricingCustomerGroupsArray = z.array(
|
|
|
517
512
|
var PricingCreateSchema = z.object({
|
|
518
513
|
type: z.enum(["sale", "override"]),
|
|
519
514
|
status: z.enum(["draft", "active"]),
|
|
520
|
-
title: z.string().min(1),
|
|
521
|
-
description: z.string().min(1),
|
|
515
|
+
title: z.string().min(1, i18n.t("priceLists.create.validation.title")),
|
|
516
|
+
description: z.string().min(1, i18n.t("priceLists.create.validation.description")),
|
|
522
517
|
starts_at: z.date().nullish(),
|
|
523
518
|
ends_at: z.date().nullish(),
|
|
524
519
|
product_ids: z.array(z.object({ id: z.string() })).min(1),
|
|
525
|
-
products
|
|
520
|
+
// Offer ids selected in the picker (every variant of the chosen products).
|
|
521
|
+
// The Prices tab hydrates `offers` from these.
|
|
522
|
+
offer_ids: z.array(z.string()).default([]),
|
|
523
|
+
// Offer-keyed prices (offer_id -> { variant_id, prices }), so every price
|
|
524
|
+
// carries its offer_id rule and stays scoped to that offer.
|
|
525
|
+
offers: PriceListCreateOffersSchema.default({}),
|
|
526
526
|
rules: PriceListRulesSchema.nullish()
|
|
527
527
|
});
|
|
528
528
|
var PricingDetailsSchema = PricingCreateSchema.pick({
|
|
@@ -530,8 +530,7 @@ var PricingDetailsSchema = PricingCreateSchema.pick({
|
|
|
530
530
|
title: true,
|
|
531
531
|
description: true,
|
|
532
532
|
starts_at: true,
|
|
533
|
-
ends_at: true
|
|
534
|
-
customer_group_ids: true
|
|
533
|
+
ends_at: true
|
|
535
534
|
});
|
|
536
535
|
var PricingDetailsFields = Object.keys(
|
|
537
536
|
PricingDetailsSchema.shape
|
|
@@ -543,7 +542,7 @@ var PricingProductsFields = Object.keys(
|
|
|
543
542
|
PricingProductsSchema.shape
|
|
544
543
|
);
|
|
545
544
|
var PricingPricesSchema = PricingCreateSchema.pick({
|
|
546
|
-
|
|
545
|
+
offers: true
|
|
547
546
|
});
|
|
548
547
|
var PricingPricesFields = Object.keys(
|
|
549
548
|
PricingPricesSchema.shape
|
|
@@ -569,13 +568,14 @@ var PriceListCreateForm = ({
|
|
|
569
568
|
const form = useForm({
|
|
570
569
|
defaultValues: {
|
|
571
570
|
type: "sale",
|
|
572
|
-
status: "
|
|
571
|
+
status: "draft",
|
|
573
572
|
title: "",
|
|
574
573
|
description: "",
|
|
575
574
|
starts_at: null,
|
|
576
575
|
ends_at: null,
|
|
577
576
|
product_ids: [],
|
|
578
|
-
|
|
577
|
+
offer_ids: [],
|
|
578
|
+
offers: {},
|
|
579
579
|
rules: {
|
|
580
580
|
customer_group_id: []
|
|
581
581
|
}
|
|
@@ -584,9 +584,9 @@ var PriceListCreateForm = ({
|
|
|
584
584
|
});
|
|
585
585
|
const { mutateAsync, isPending } = useCreatePriceList();
|
|
586
586
|
const handleSubmit = form.handleSubmit(async (data) => {
|
|
587
|
-
const { rules,
|
|
587
|
+
const { rules, offers } = data;
|
|
588
588
|
const rulesPayload = rules?.customer_group_id?.length ? { "customer.groups.id": rules.customer_group_id.map((cg) => cg.id) } : void 0;
|
|
589
|
-
const prices =
|
|
589
|
+
const prices = extractPricesFromOffers(offers, regions);
|
|
590
590
|
await mutateAsync(
|
|
591
591
|
{
|
|
592
592
|
title: data.title,
|