@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
|
@@ -758,7 +758,7 @@ var SelectFilter = ({
|
|
|
758
758
|
return /* @__PURE__ */ jsxs4(
|
|
759
759
|
Command.Item,
|
|
760
760
|
{
|
|
761
|
-
className: "bg-ui-bg-base hover:bg-ui-bg-base-hover aria-selected:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled]:text-ui-fg-disabled txt-compact-small relative flex cursor-pointer select-none items-center gap-x-2 rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled]:pointer-events-none",
|
|
761
|
+
className: "bg-ui-bg-base hover:bg-ui-bg-base-hover aria-selected:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed text-ui-fg-base data-[disabled=true]:text-ui-fg-disabled txt-compact-small relative flex cursor-pointer select-none items-center gap-x-2 rounded-md px-2 py-1.5 outline-none transition-colors data-[disabled=true]:pointer-events-none",
|
|
762
762
|
value: option.label,
|
|
763
763
|
onSelect: () => {
|
|
764
764
|
handleSelect(option.value);
|
|
File without changes
|
|
@@ -155,34 +155,18 @@ var productVariantQueryKeys = queryKeysFactory(
|
|
|
155
155
|
PRODUCT_VARIANT_QUERY_KEY
|
|
156
156
|
);
|
|
157
157
|
|
|
158
|
-
// src/hooks/api/
|
|
158
|
+
// src/hooks/api/shipping-option-types.tsx
|
|
159
159
|
import {
|
|
160
160
|
useMutation as useMutation4,
|
|
161
161
|
useQuery as useQuery7
|
|
162
162
|
} from "@tanstack/react-query";
|
|
163
|
-
var REGIONS_QUERY_KEY = "regions";
|
|
164
|
-
var regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY);
|
|
165
|
-
var useRegions = (query, options) => {
|
|
166
|
-
const { data, ...rest } = useQuery7({
|
|
167
|
-
queryFn: () => sdk.vendor.regions.query({ ...query }),
|
|
168
|
-
queryKey: regionsQueryKeys.list(query),
|
|
169
|
-
...options
|
|
170
|
-
});
|
|
171
|
-
return { ...data, ...rest };
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// src/hooks/api/shipping-option-types.tsx
|
|
175
|
-
import {
|
|
176
|
-
useMutation as useMutation5,
|
|
177
|
-
useQuery as useQuery8
|
|
178
|
-
} from "@tanstack/react-query";
|
|
179
163
|
var SHIPPING_OPTION_TYPES_QUERY_KEY = "shipping_option_types";
|
|
180
164
|
var shippingOptionTypesQueryKeys = queryKeysFactory(
|
|
181
165
|
SHIPPING_OPTION_TYPES_QUERY_KEY
|
|
182
166
|
);
|
|
183
167
|
|
|
184
168
|
// src/hooks/api/store.tsx
|
|
185
|
-
import { useQuery as
|
|
169
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
186
170
|
import { ClientError } from "@mercurjs/client";
|
|
187
171
|
var STORE_QUERY_KEY = "store";
|
|
188
172
|
var storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
@@ -195,7 +179,7 @@ async function retrieveActiveStore(query) {
|
|
|
195
179
|
return { store: activeStore };
|
|
196
180
|
}
|
|
197
181
|
var useStore = (query, options) => {
|
|
198
|
-
const { data, ...rest } =
|
|
182
|
+
const { data, ...rest } = useQuery8({
|
|
199
183
|
queryFn: () => retrieveActiveStore(query),
|
|
200
184
|
queryKey: storeQueryKeys.details(),
|
|
201
185
|
...options
|
|
@@ -213,7 +197,6 @@ export {
|
|
|
213
197
|
useCreateInvite,
|
|
214
198
|
notificationQueryKeys,
|
|
215
199
|
useNotifications,
|
|
216
|
-
useRegions,
|
|
217
200
|
storeQueryKeys,
|
|
218
201
|
retrieveActiveStore,
|
|
219
202
|
useStore,
|
|
@@ -13,6 +13,13 @@ var useDateTableFilters = () => {
|
|
|
13
13
|
return dateFilters;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
// src/hooks/table/filters/use-product-type-table-filters.tsx
|
|
17
|
+
var useProductTypeTableFilters = () => {
|
|
18
|
+
const dateFilters = useDateTableFilters();
|
|
19
|
+
return dateFilters;
|
|
20
|
+
};
|
|
21
|
+
|
|
16
22
|
export {
|
|
17
|
-
useDateTableFilters
|
|
23
|
+
useDateTableFilters,
|
|
24
|
+
useProductTypeTableFilters
|
|
18
25
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryKeysFactory
|
|
3
|
+
} from "./chunk-ZA2KFUFR.js";
|
|
4
|
+
import {
|
|
5
|
+
sdk
|
|
6
|
+
} from "./chunk-DTGEFKK4.js";
|
|
7
|
+
|
|
8
|
+
// src/hooks/api/regions.tsx
|
|
9
|
+
import {
|
|
10
|
+
useMutation,
|
|
11
|
+
useQuery
|
|
12
|
+
} from "@tanstack/react-query";
|
|
13
|
+
var REGIONS_QUERY_KEY = "regions";
|
|
14
|
+
var regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY);
|
|
15
|
+
var useRegions = (query, options) => {
|
|
16
|
+
const { data, ...rest } = useQuery({
|
|
17
|
+
queryFn: () => sdk.vendor.regions.query({ ...query }),
|
|
18
|
+
queryKey: regionsQueryKeys.list(query),
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
return { ...data, ...rest };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
useRegions
|
|
26
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inventoryItemLevelsQueryKeys,
|
|
3
|
+
inventoryItemsQueryKeys
|
|
4
|
+
} from "./chunk-EMUCGKHP.js";
|
|
5
|
+
import {
|
|
6
|
+
queryClient
|
|
7
|
+
} from "./chunk-RHKRREUU.js";
|
|
8
|
+
import {
|
|
9
|
+
queryKeysFactory
|
|
10
|
+
} from "./chunk-ZA2KFUFR.js";
|
|
11
|
+
import {
|
|
12
|
+
sdk
|
|
13
|
+
} from "./chunk-DTGEFKK4.js";
|
|
14
|
+
|
|
15
|
+
// src/hooks/api/reservations.tsx
|
|
16
|
+
import {
|
|
17
|
+
useMutation,
|
|
18
|
+
useQuery
|
|
19
|
+
} from "@tanstack/react-query";
|
|
20
|
+
var RESERVATION_ITEMS_QUERY_KEY = "reservation_items";
|
|
21
|
+
var reservationItemsQueryKeys = queryKeysFactory(
|
|
22
|
+
RESERVATION_ITEMS_QUERY_KEY
|
|
23
|
+
);
|
|
24
|
+
var useReservationItem = (id, query, options) => {
|
|
25
|
+
const { data, ...rest } = useQuery({
|
|
26
|
+
queryKey: reservationItemsQueryKeys.detail(id, query),
|
|
27
|
+
queryFn: async () => sdk.vendor.reservations.$id.query({ $id: id, ...query }),
|
|
28
|
+
...options
|
|
29
|
+
});
|
|
30
|
+
return { ...data, ...rest };
|
|
31
|
+
};
|
|
32
|
+
var useReservationItems = (query, options) => {
|
|
33
|
+
const { data, ...rest } = useQuery({
|
|
34
|
+
queryFn: () => sdk.vendor.reservations.query({ ...query }),
|
|
35
|
+
queryKey: reservationItemsQueryKeys.list(query),
|
|
36
|
+
...options
|
|
37
|
+
});
|
|
38
|
+
return { ...data, ...rest };
|
|
39
|
+
};
|
|
40
|
+
var useUpdateReservationItem = (id, options) => {
|
|
41
|
+
return useMutation({
|
|
42
|
+
mutationFn: (payload) => sdk.vendor.reservations.$id.mutate({ $id: id, ...payload }),
|
|
43
|
+
onSuccess: (data, variables, context) => {
|
|
44
|
+
queryClient.invalidateQueries({
|
|
45
|
+
queryKey: reservationItemsQueryKeys.detail(id)
|
|
46
|
+
});
|
|
47
|
+
queryClient.invalidateQueries({
|
|
48
|
+
queryKey: reservationItemsQueryKeys.lists()
|
|
49
|
+
});
|
|
50
|
+
queryClient.invalidateQueries({
|
|
51
|
+
queryKey: inventoryItemsQueryKeys.details()
|
|
52
|
+
});
|
|
53
|
+
queryClient.invalidateQueries({
|
|
54
|
+
queryKey: inventoryItemLevelsQueryKeys.details()
|
|
55
|
+
});
|
|
56
|
+
options?.onSuccess?.(data, variables, context);
|
|
57
|
+
},
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var useCreateReservationItem = (options) => {
|
|
62
|
+
return useMutation({
|
|
63
|
+
mutationFn: (payload) => sdk.vendor.reservations.mutate(payload),
|
|
64
|
+
onSuccess: (data, variables, context) => {
|
|
65
|
+
queryClient.invalidateQueries({
|
|
66
|
+
queryKey: reservationItemsQueryKeys.lists()
|
|
67
|
+
});
|
|
68
|
+
queryClient.invalidateQueries({
|
|
69
|
+
queryKey: inventoryItemsQueryKeys.details()
|
|
70
|
+
});
|
|
71
|
+
queryClient.invalidateQueries({
|
|
72
|
+
queryKey: inventoryItemLevelsQueryKeys.details()
|
|
73
|
+
});
|
|
74
|
+
options?.onSuccess?.(data, variables, context);
|
|
75
|
+
},
|
|
76
|
+
...options
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
var useDeleteReservationItem = (id, options) => {
|
|
80
|
+
return useMutation({
|
|
81
|
+
mutationFn: () => sdk.vendor.reservations.$id.delete({ $id: id }),
|
|
82
|
+
onSuccess: (data, variables, context) => {
|
|
83
|
+
queryClient.invalidateQueries({
|
|
84
|
+
queryKey: reservationItemsQueryKeys.lists()
|
|
85
|
+
});
|
|
86
|
+
queryClient.invalidateQueries({
|
|
87
|
+
queryKey: reservationItemsQueryKeys.detail(id)
|
|
88
|
+
});
|
|
89
|
+
queryClient.invalidateQueries({
|
|
90
|
+
queryKey: inventoryItemsQueryKeys.details()
|
|
91
|
+
});
|
|
92
|
+
queryClient.invalidateQueries({
|
|
93
|
+
queryKey: inventoryItemLevelsQueryKeys.details()
|
|
94
|
+
});
|
|
95
|
+
options?.onSuccess?.(data, variables, context);
|
|
96
|
+
},
|
|
97
|
+
...options
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
reservationItemsQueryKeys,
|
|
103
|
+
useReservationItem,
|
|
104
|
+
useReservationItems,
|
|
105
|
+
useUpdateReservationItem,
|
|
106
|
+
useCreateReservationItem,
|
|
107
|
+
useDeleteReservationItem
|
|
108
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isProductRow
|
|
3
|
-
} from "./chunk-BNOKKKUU.js";
|
|
4
1
|
import {
|
|
5
2
|
DataGrid,
|
|
6
3
|
createDataGridHelper,
|
|
@@ -11,7 +8,7 @@ import {
|
|
|
11
8
|
} from "./chunk-WIYFXWRI.js";
|
|
12
9
|
import {
|
|
13
10
|
useRegions
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7LIENHWP.js";
|
|
15
12
|
import {
|
|
16
13
|
usePricePreferences
|
|
17
14
|
} from "./chunk-BHEU34FL.js";
|
|
@@ -67,53 +64,63 @@ var usePriceListCurrencyData = () => {
|
|
|
67
64
|
// src/pages/price-lists/common/hooks/use-price-list-grid-columns.tsx
|
|
68
65
|
import { useMemo } from "react";
|
|
69
66
|
import { useTranslation } from "react-i18next";
|
|
67
|
+
import {
|
|
68
|
+
isPriceListGroupRow
|
|
69
|
+
} from "@mercurjs/dashboard-shared";
|
|
70
70
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
71
71
|
var columnHelper = createDataGridHelper();
|
|
72
72
|
var usePriceListGridColumns = ({
|
|
73
73
|
currencies = [],
|
|
74
|
-
regions
|
|
74
|
+
regions = [],
|
|
75
75
|
pricePreferences = []
|
|
76
76
|
}) => {
|
|
77
77
|
const { t } = useTranslation();
|
|
78
78
|
const colDefs = useMemo(() => {
|
|
79
79
|
return [
|
|
80
80
|
columnHelper.column({
|
|
81
|
-
id: t("fields.
|
|
82
|
-
header: t("fields.
|
|
81
|
+
id: t("priceLists.fields.offerVariant"),
|
|
82
|
+
header: t("priceLists.fields.offerVariant"),
|
|
83
83
|
cell: (context) => {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
84
|
+
const row = context.row.original;
|
|
85
|
+
if (isPriceListGroupRow(row)) {
|
|
86
86
|
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
|
|
87
|
-
/* @__PURE__ */ jsx(Thumbnail, { src:
|
|
88
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children:
|
|
87
|
+
/* @__PURE__ */ jsx(Thumbnail, { src: row.product_thumbnail, size: "small" }),
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: row.product_title })
|
|
89
89
|
] }) });
|
|
90
90
|
}
|
|
91
|
-
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, color: "normal", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children:
|
|
91
|
+
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, color: "normal", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: row.variant_title }) }) });
|
|
92
92
|
},
|
|
93
93
|
disableHiding: true
|
|
94
94
|
}),
|
|
95
|
+
columnHelper.column({
|
|
96
|
+
id: "offer_sku",
|
|
97
|
+
name: t("fields.sku"),
|
|
98
|
+
header: t("fields.sku"),
|
|
99
|
+
cell: (context) => {
|
|
100
|
+
const row = context.row.original;
|
|
101
|
+
const sku = isPriceListGroupRow(row) ? "" : row.sku;
|
|
102
|
+
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsx("span", { className: "text-ui-fg-subtle truncate", children: sku }) });
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
95
105
|
...createDataGridPriceColumns({
|
|
96
106
|
currencies,
|
|
107
|
+
regions,
|
|
97
108
|
pricePreferences,
|
|
98
|
-
isReadyOnly: (context) =>
|
|
99
|
-
const entity = context.row.original;
|
|
100
|
-
return isProductRow(entity);
|
|
101
|
-
},
|
|
109
|
+
isReadyOnly: (context) => isPriceListGroupRow(context.row.original),
|
|
102
110
|
getFieldName: (context, value) => {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
111
|
+
const row = context.row.original;
|
|
112
|
+
if (isPriceListGroupRow(row)) {
|
|
105
113
|
return null;
|
|
106
114
|
}
|
|
107
115
|
if (context.column.id?.startsWith("currency_prices")) {
|
|
108
|
-
return `
|
|
116
|
+
return `offers.${row.offer_id}.currency_prices.${value}.amount`;
|
|
109
117
|
}
|
|
110
|
-
return `
|
|
118
|
+
return `offers.${row.offer_id}.region_prices.${value}.amount`;
|
|
111
119
|
},
|
|
112
|
-
t
|
|
113
|
-
showCurrentPriceCell: true
|
|
120
|
+
t
|
|
114
121
|
})
|
|
115
122
|
];
|
|
116
|
-
}, [t, currencies, pricePreferences]);
|
|
123
|
+
}, [t, currencies, regions, pricePreferences]);
|
|
117
124
|
return colDefs;
|
|
118
125
|
};
|
|
119
126
|
|
|
@@ -144,6 +151,12 @@ var PriceListCreateProductsSchema = z.record(
|
|
|
144
151
|
variants: PriceListCreateProductVariantsSchema
|
|
145
152
|
})
|
|
146
153
|
);
|
|
154
|
+
var PriceListCreateOfferSchema = z.object({
|
|
155
|
+
variant_id: z.string(),
|
|
156
|
+
currency_prices: z.record(PriceListCreateCurrencyPriceSchema.optional()),
|
|
157
|
+
region_prices: z.record(PriceListCreateRegionPriceSchema.optional())
|
|
158
|
+
});
|
|
159
|
+
var PriceListCreateOffersSchema = z.record(PriceListCreateOfferSchema);
|
|
147
160
|
var PriceListUpdateCurrencyPriceSchema = z.object({
|
|
148
161
|
amount: z.string().or(z.number()).optional(),
|
|
149
162
|
id: z.string().nullish()
|
|
@@ -163,11 +176,17 @@ var PriceListUpdateProductsSchema = z.record(
|
|
|
163
176
|
variants: PriceListUpdateProductVariantsSchema
|
|
164
177
|
})
|
|
165
178
|
);
|
|
179
|
+
var PriceListUpdateOfferSchema = z.object({
|
|
180
|
+
variant_id: z.string(),
|
|
181
|
+
currency_prices: z.record(PriceListUpdateCurrencyPriceSchema.optional()),
|
|
182
|
+
region_prices: z.record(PriceListUpdateRegionPriceSchema.optional())
|
|
183
|
+
});
|
|
184
|
+
var PriceListUpdateOffersSchema = z.record(PriceListUpdateOfferSchema);
|
|
166
185
|
|
|
167
186
|
export {
|
|
168
187
|
usePriceListCurrencyData,
|
|
169
188
|
usePriceListGridColumns,
|
|
170
189
|
PriceListRulesSchema,
|
|
171
|
-
|
|
172
|
-
|
|
190
|
+
PriceListCreateOffersSchema,
|
|
191
|
+
PriceListUpdateOffersSchema
|
|
173
192
|
};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCustomerGroupTableQuery
|
|
3
|
+
} from "./chunk-VKOE5J66.js";
|
|
4
|
+
import {
|
|
5
|
+
TextCell,
|
|
6
|
+
TextHeader
|
|
7
|
+
} from "./chunk-JHIMVLB2.js";
|
|
8
|
+
import {
|
|
9
|
+
useCustomerGroupTableFilters
|
|
10
|
+
} from "./chunk-CMHI2RPL.js";
|
|
11
|
+
import {
|
|
12
|
+
StackedDrawer,
|
|
13
|
+
StackedFocusModal,
|
|
14
|
+
useStackedModal
|
|
15
|
+
} from "./chunk-GDWBOQI5.js";
|
|
16
|
+
import {
|
|
17
|
+
_DataTable,
|
|
18
|
+
useDataTable
|
|
19
|
+
} from "./chunk-6GQLSWOO.js";
|
|
20
|
+
import {
|
|
21
|
+
useCustomerGroups
|
|
22
|
+
} from "./chunk-II3CLUXA.js";
|
|
23
|
+
|
|
24
|
+
// src/pages/price-lists/common/components/price-list-customer-availability-selector/price-list-customer-availability-selector.tsx
|
|
25
|
+
import { MagnifyingGlass, XMarkMini } from "@medusajs/icons";
|
|
26
|
+
import { Button as Button2, Divider, IconButton, Text, clx } from "@medusajs/ui";
|
|
27
|
+
import { useFieldArray } from "react-hook-form";
|
|
28
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
29
|
+
|
|
30
|
+
// src/pages/price-lists/common/components/price-list-customer-group-rule-form/price-list-customer-group-rule-form.tsx
|
|
31
|
+
import { Button, Checkbox } from "@medusajs/ui";
|
|
32
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
33
|
+
import {
|
|
34
|
+
createColumnHelper
|
|
35
|
+
} from "@tanstack/react-table";
|
|
36
|
+
import { useEffect, useMemo, useState } from "react";
|
|
37
|
+
import { useTranslation } from "react-i18next";
|
|
38
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
|
+
var PAGE_SIZE = 50;
|
|
40
|
+
var PREFIX = "cg";
|
|
41
|
+
var initRowSelection = (state) => {
|
|
42
|
+
return state.reduce((acc, group) => {
|
|
43
|
+
acc[group.id] = true;
|
|
44
|
+
return acc;
|
|
45
|
+
}, {});
|
|
46
|
+
};
|
|
47
|
+
var PriceListCustomerGroupRuleForm = ({
|
|
48
|
+
state,
|
|
49
|
+
setState,
|
|
50
|
+
type
|
|
51
|
+
}) => {
|
|
52
|
+
const { t } = useTranslation();
|
|
53
|
+
const [rowSelection, setRowSelection] = useState(
|
|
54
|
+
initRowSelection(state)
|
|
55
|
+
);
|
|
56
|
+
const [intermediate, setIntermediate] = useState(state);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setRowSelection(initRowSelection(state));
|
|
59
|
+
setIntermediate(state);
|
|
60
|
+
}, [state]);
|
|
61
|
+
const { searchParams, raw } = useCustomerGroupTableQuery({
|
|
62
|
+
pageSize: PAGE_SIZE,
|
|
63
|
+
prefix: PREFIX
|
|
64
|
+
});
|
|
65
|
+
const sortParam = raw.order ? raw.order.startsWith("-") ? raw.order : raw.order : void 0;
|
|
66
|
+
const { customer_groups: customerGroupsData, count, isLoading, isError, error } = useCustomerGroups(
|
|
67
|
+
{ ...searchParams, fields: "id,name,customers.id" },
|
|
68
|
+
{
|
|
69
|
+
placeholderData: keepPreviousData
|
|
70
|
+
},
|
|
71
|
+
sortParam ? { sort: sortParam } : void 0
|
|
72
|
+
);
|
|
73
|
+
const customerGroups = customerGroupsData;
|
|
74
|
+
const updater = (value) => {
|
|
75
|
+
const state2 = typeof value === "function" ? value(rowSelection) : value;
|
|
76
|
+
const currentIds = Object.keys(rowSelection);
|
|
77
|
+
const ids = Object.keys(state2);
|
|
78
|
+
const newIds = ids.filter((id) => !currentIds.includes(id));
|
|
79
|
+
const removedIds = currentIds.filter((id) => !ids.includes(id));
|
|
80
|
+
const newCustomerGroups = customerGroups?.filter((cg) => newIds.includes(cg.id)).map((cg) => ({
|
|
81
|
+
id: cg.id,
|
|
82
|
+
name: cg.name
|
|
83
|
+
})) || [];
|
|
84
|
+
const filteredIntermediate = intermediate.filter(
|
|
85
|
+
(cg) => !removedIds.includes(cg.id)
|
|
86
|
+
);
|
|
87
|
+
setIntermediate([...filteredIntermediate, ...newCustomerGroups]);
|
|
88
|
+
setRowSelection(state2);
|
|
89
|
+
};
|
|
90
|
+
const handleSave = () => {
|
|
91
|
+
setState(intermediate);
|
|
92
|
+
};
|
|
93
|
+
const filters = useCustomerGroupTableFilters();
|
|
94
|
+
const columns = useColumns();
|
|
95
|
+
const { table } = useDataTable({
|
|
96
|
+
data: customerGroups || [],
|
|
97
|
+
columns,
|
|
98
|
+
count,
|
|
99
|
+
enablePagination: true,
|
|
100
|
+
enableRowSelection: true,
|
|
101
|
+
getRowId: (row) => row.id,
|
|
102
|
+
rowSelection: {
|
|
103
|
+
state: rowSelection,
|
|
104
|
+
updater
|
|
105
|
+
},
|
|
106
|
+
pageSize: PAGE_SIZE,
|
|
107
|
+
prefix: PREFIX
|
|
108
|
+
});
|
|
109
|
+
const Component = type === "focus" ? StackedFocusModal : StackedDrawer;
|
|
110
|
+
if (isError) {
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col overflow-hidden", children: [
|
|
114
|
+
/* @__PURE__ */ jsx(Component.Body, { className: "min-h-0 p-0", children: /* @__PURE__ */ jsx(
|
|
115
|
+
_DataTable,
|
|
116
|
+
{
|
|
117
|
+
table,
|
|
118
|
+
columns,
|
|
119
|
+
pageSize: PAGE_SIZE,
|
|
120
|
+
count,
|
|
121
|
+
isLoading,
|
|
122
|
+
filters,
|
|
123
|
+
layout: "fill",
|
|
124
|
+
pagination: true,
|
|
125
|
+
search: true,
|
|
126
|
+
prefix: PREFIX,
|
|
127
|
+
queryObject: raw,
|
|
128
|
+
orderBy: [
|
|
129
|
+
{ key: "name", label: t("fields.name") },
|
|
130
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
131
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
) }),
|
|
135
|
+
/* @__PURE__ */ jsxs(Component.Footer, { children: [
|
|
136
|
+
/* @__PURE__ */ jsx(Component.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", type: "button", children: t("actions.cancel") }) }),
|
|
137
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "small", onClick: handleSave, children: t("actions.save") })
|
|
138
|
+
] })
|
|
139
|
+
] });
|
|
140
|
+
};
|
|
141
|
+
var columnHelper = createColumnHelper();
|
|
142
|
+
var useColumns = () => {
|
|
143
|
+
const { t } = useTranslation();
|
|
144
|
+
return useMemo(
|
|
145
|
+
() => [
|
|
146
|
+
columnHelper.display({
|
|
147
|
+
id: "select",
|
|
148
|
+
header: ({ table }) => {
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
|
+
Checkbox,
|
|
151
|
+
{
|
|
152
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
153
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
cell: ({ row }) => {
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
Checkbox,
|
|
160
|
+
{
|
|
161
|
+
checked: row.getIsSelected(),
|
|
162
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
163
|
+
onClick: (e) => {
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
columnHelper.accessor("name", {
|
|
171
|
+
header: () => /* @__PURE__ */ jsx(TextHeader, { text: t("fields.name") }),
|
|
172
|
+
cell: ({ row }) => {
|
|
173
|
+
return /* @__PURE__ */ jsx(
|
|
174
|
+
TextCell,
|
|
175
|
+
{
|
|
176
|
+
text: row.original?.name || "-"
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
],
|
|
182
|
+
[t]
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/pages/price-lists/common/components/price-list-customer-availability-selector/price-list-customer-availability-selector.tsx
|
|
187
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
188
|
+
var PriceListCustomerAvailabilitySelector = ({
|
|
189
|
+
control,
|
|
190
|
+
name,
|
|
191
|
+
stackedId = "cg"
|
|
192
|
+
}) => {
|
|
193
|
+
const { t } = useTranslation2();
|
|
194
|
+
const { setIsOpen } = useStackedModal();
|
|
195
|
+
const { fields, append, remove } = useFieldArray({
|
|
196
|
+
control,
|
|
197
|
+
name,
|
|
198
|
+
keyName: "cg_id"
|
|
199
|
+
});
|
|
200
|
+
const selected = fields;
|
|
201
|
+
const handleAdd = (groups) => {
|
|
202
|
+
const newIds = groups.map((group) => group.id);
|
|
203
|
+
const fieldsToAdd = groups.filter(
|
|
204
|
+
(group) => !selected.some((field) => field.id === group.id)
|
|
205
|
+
);
|
|
206
|
+
for (const field of selected) {
|
|
207
|
+
if (!newIds.includes(field.id)) {
|
|
208
|
+
remove(selected.indexOf(field));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
append(fieldsToAdd);
|
|
212
|
+
setIsOpen(stackedId, false);
|
|
213
|
+
};
|
|
214
|
+
return /* @__PURE__ */ jsxs2(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: clx(
|
|
218
|
+
"bg-ui-bg-component shadow-elevation-card-rest transition-fg grid gap-1.5 rounded-xl py-1.5",
|
|
219
|
+
"aria-[invalid='true']:shadow-borders-error"
|
|
220
|
+
),
|
|
221
|
+
role: "application",
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid gap-1.5 px-1.5 md:grid-cols-2", children: [
|
|
224
|
+
/* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: t("priceLists.fields.customerAvailability.attribute") }),
|
|
225
|
+
/* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: t("operators.in") })
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center gap-1.5 px-1.5", children: /* @__PURE__ */ jsxs2(StackedFocusModal, { id: stackedId, children: [
|
|
228
|
+
/* @__PURE__ */ jsx2(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs2(
|
|
229
|
+
"button",
|
|
230
|
+
{
|
|
231
|
+
type: "button",
|
|
232
|
+
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover shadow-borders-base txt-compact-small text-ui-fg-muted transition-fg focus-visible:shadow-borders-interactive-with-active flex flex-1 items-center gap-x-2 rounded-md px-2 py-1.5 outline-none",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx2(MagnifyingGlass, {}),
|
|
235
|
+
t("priceLists.fields.customerAvailability.placeholder")
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
) }),
|
|
239
|
+
/* @__PURE__ */ jsx2(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx2(Button2, { variant: "secondary", children: t("actions.browse") }) }),
|
|
240
|
+
/* @__PURE__ */ jsxs2(StackedFocusModal.Content, { children: [
|
|
241
|
+
/* @__PURE__ */ jsx2(StackedFocusModal.Header, {}),
|
|
242
|
+
/* @__PURE__ */ jsx2(
|
|
243
|
+
PriceListCustomerGroupRuleForm,
|
|
244
|
+
{
|
|
245
|
+
state: selected,
|
|
246
|
+
setState: handleAdd,
|
|
247
|
+
type: "focus"
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] })
|
|
251
|
+
] }) }),
|
|
252
|
+
selected.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
253
|
+
/* @__PURE__ */ jsx2(Divider, { variant: "dashed" }),
|
|
254
|
+
/* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-1.5 px-1.5", children: selected.map((field, index) => /* @__PURE__ */ jsxs2(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
className: "bg-ui-bg-field-component shadow-borders-base flex items-center justify-between gap-2 rounded-md px-2 py-0.5",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: field.name }),
|
|
260
|
+
/* @__PURE__ */ jsx2(
|
|
261
|
+
IconButton,
|
|
262
|
+
{
|
|
263
|
+
size: "small",
|
|
264
|
+
variant: "transparent",
|
|
265
|
+
type: "button",
|
|
266
|
+
onClick: () => remove(index),
|
|
267
|
+
children: /* @__PURE__ */ jsx2(XMarkMini, {})
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
field.cg_id
|
|
273
|
+
)) })
|
|
274
|
+
] }) : null
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export {
|
|
281
|
+
PriceListCustomerAvailabilitySelector
|
|
282
|
+
};
|