@mercurjs/vendor 2.0.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]-23D3HY3G.js +444 -0
- package/dist/[id]-2VBOAZM4.js +1215 -0
- package/dist/[id]-A4FSDRER.js +325 -0
- package/dist/[id]-E45G2SDA.js +213 -0
- package/dist/[id]-FXKSI52D.js +477 -0
- package/dist/[id]-HHZ3BSXV.js +1166 -0
- package/dist/[id]-MIV4U5UW.js +137 -0
- package/dist/[id]-QSRIPPIP.js +612 -0
- package/dist/[id]-RGDXOC7T.js +499 -0
- package/dist/[id]-TI2MOR2C.js +377 -0
- package/dist/[id]-U5DT2ZLS.js +301 -0
- package/dist/[id]-UMFGLDM2.js +354 -0
- package/dist/[id]-VTFOP3BF.js +97 -0
- package/dist/[id]-ZYF75L6G.js +479 -0
- package/dist/[location_id]-4UIEW5KM.js +685 -0
- package/dist/[province_id]-ZCHPXXQN.js +205 -0
- package/dist/add-KNDQL6YN.js +660 -0
- package/dist/add-customer-groups-JA346MTF.js +275 -0
- package/dist/add-products-2VB57KXV.js +273 -0
- package/dist/add-promotions-KVKEP6EO.js +260 -0
- package/dist/add-to-campaign-V6D7JKRS.js +44 -0
- package/dist/additional-attributes-E36EZX4V.js +219 -0
- package/dist/adjust-inventory-P7AB7VIB.js +228 -0
- package/dist/allocate-items-QAS5PZLR.js +529 -0
- package/dist/areas-Y7VDWH7G.js +151 -0
- package/dist/attributes-UEM2VJKV.js +277 -0
- package/dist/breadcrumb-3QTVWXZB.js +27 -0
- package/dist/breadcrumb-5OTOCYNL.js +38 -0
- package/dist/breadcrumb-6NAAOPIY.js +11 -0
- package/dist/breadcrumb-ASB2YCNV.js +25 -0
- package/dist/breadcrumb-CIGKLKKS.js +28 -0
- package/dist/breadcrumb-EOYLR3IQ.js +22 -0
- package/dist/breadcrumb-LENACUAA.js +22 -0
- package/dist/breadcrumb-LIXGWUQF.js +44 -0
- package/dist/breadcrumb-MOQ7GI3Z.js +27 -0
- package/dist/breadcrumb-NCBGPQML.js +23 -0
- package/dist/breadcrumb-OVMEC5OZ.js +33 -0
- package/dist/breadcrumb-RIXJ5QSX.js +45 -0
- package/dist/breadcrumb-TZB6EWNC.js +31 -0
- package/dist/breadcrumb-WP34OXGQ.js +23 -0
- package/dist/campaigns-PMVKUFEA.js +28 -0
- package/dist/categories-CKKIUMYG.js +27 -0
- package/dist/chunk-26OOAKQ6.js +18 -0
- package/dist/chunk-2C3HUJ3Z.js +222 -0
- package/dist/chunk-2F3H6ORE.js +36 -0
- package/dist/chunk-2ZFELO2L.js +13 -0
- package/dist/chunk-3CK6OINO.js +448 -0
- package/dist/chunk-3EF54XFY.js +64 -0
- package/dist/chunk-3LPVUPZZ.js +74 -0
- package/dist/chunk-3QSRE5LS.js +161 -0
- package/dist/chunk-3SIDRPKT.js +185 -0
- package/dist/chunk-4F5GP7J7.js +45 -0
- package/dist/chunk-4GPAS5GW.js +36 -0
- package/dist/chunk-4MFMCZEJ.js +70 -0
- package/dist/chunk-4TBDDMFP.js +425 -0
- package/dist/chunk-4TLP3TAA.js +34 -0
- package/dist/chunk-54TMLQH3.js +9 -0
- package/dist/chunk-5NF4OTVV.js +169 -0
- package/dist/chunk-66V3GFSW.js +138 -0
- package/dist/chunk-6EYGH3TB.js +26 -0
- package/dist/chunk-6IJMSVC6.js +16 -0
- package/dist/chunk-6YA3C4NB.js +55 -0
- package/dist/chunk-7AV5EJJ5.js +29 -0
- package/dist/chunk-7RPRNVBS.js +45 -0
- package/dist/chunk-A2SY5L5G.js +183 -0
- package/dist/chunk-A5DJIOHN.js +4 -0
- package/dist/chunk-AIFLEWO2.js +56 -0
- package/dist/chunk-ASVMGV2B.js +80 -0
- package/dist/chunk-AW77UWCZ.js +363 -0
- package/dist/chunk-AYUG34XF.js +84 -0
- package/dist/chunk-AYVH6Q5O.js +31 -0
- package/dist/chunk-B2RVONU7.js +160 -0
- package/dist/chunk-BCU3FKP2.js +18 -0
- package/dist/chunk-BDGZ4EQO.js +86 -0
- package/dist/chunk-BDZOSMAX.js +23 -0
- package/dist/chunk-C6SUTRP2.js +13 -0
- package/dist/chunk-CDIZEXFJ.js +145 -0
- package/dist/chunk-CFETU5BI.js +261 -0
- package/dist/chunk-CMHI2RPL.js +20 -0
- package/dist/chunk-CP5IL4P6.js +98 -0
- package/dist/chunk-CUO22GTM.js +96 -0
- package/dist/chunk-CVVYQI5F.js +41 -0
- package/dist/chunk-DARJTN4I.js +60 -0
- package/dist/chunk-DB6ANJBO.js +35 -0
- package/dist/chunk-DC2K6CFQ.js +86 -0
- package/dist/chunk-DDEIH66R.js +123 -0
- package/dist/chunk-DY3XQPHC.js +31 -0
- package/dist/chunk-DYUTYBAQ.js +67 -0
- package/dist/chunk-E3MNEQID.js +24 -0
- package/dist/chunk-FBZHM2QZ.js +247 -0
- package/dist/chunk-FDZC3TFZ.js +717 -0
- package/dist/chunk-FGCKXH45.js +263 -0
- package/dist/chunk-FMFVTERD.js +0 -0
- package/dist/chunk-FOMEBUX6.js +89 -0
- package/dist/chunk-FQERBIVS.js +0 -0
- package/dist/chunk-GC33DBKG.js +143 -0
- package/dist/chunk-GDMNHL7E.js +144 -0
- package/dist/chunk-GTUR4HSV.js +53 -0
- package/dist/chunk-H35HHFTB.js +225 -0
- package/dist/chunk-HB3BP55W.js +25 -0
- package/dist/chunk-HHD2VUED.js +29 -0
- package/dist/chunk-HUNGNEPY.js +312 -0
- package/dist/chunk-HUZG6A3X.js +127 -0
- package/dist/chunk-INNFZYX2.js +183 -0
- package/dist/chunk-IQPN4PZJ.js +749 -0
- package/dist/chunk-IZ5RG5XI.js +72 -0
- package/dist/chunk-J2XP7VRG.js +1080 -0
- package/dist/chunk-JHIMVLB2.js +42 -0
- package/dist/chunk-JKXAL7WR.js +92 -0
- package/dist/chunk-JRTZWK77.js +1764 -0
- package/dist/chunk-JVBLYMY2.js +268 -0
- package/dist/chunk-JXP5YZ77.js +86 -0
- package/dist/chunk-KAZ5BYTQ.js +132 -0
- package/dist/chunk-KHHY7EEM.js +267 -0
- package/dist/chunk-LAVHRER2.js +17 -0
- package/dist/chunk-LQSLDDPT.js +67 -0
- package/dist/chunk-LWVBKUUL.js +77 -0
- package/dist/chunk-LYUCDASZ.js +115 -0
- package/dist/chunk-LZ7QV42C.js +37 -0
- package/dist/chunk-MAEP2UCK.js +110 -0
- package/dist/chunk-MG4GKUJW.js +31 -0
- package/dist/chunk-N2TQXB44.js +1280 -0
- package/dist/chunk-N3T24SEK.js +32 -0
- package/dist/chunk-NANYVBFI.js +106 -0
- package/dist/chunk-NCMUZ6BQ.js +0 -0
- package/dist/chunk-NCYTM57J.js +160 -0
- package/dist/chunk-NX26QE2O.js +47 -0
- package/dist/chunk-NYDJTWRL.js +389 -0
- package/dist/chunk-O5LRZEG6.js +253 -0
- package/dist/chunk-O6PRBSFL.js +115 -0
- package/dist/chunk-OJCDB3N5.js +539 -0
- package/dist/chunk-OSFOX7MG.js +176 -0
- package/dist/chunk-OVPAOBZB.js +110 -0
- package/dist/chunk-PADOWAXM.js +118 -0
- package/dist/chunk-PHOCVOZ5.js +9 -0
- package/dist/chunk-PKBMQBKP.js +7 -0
- package/dist/chunk-PLSJ74T2.js +298 -0
- package/dist/chunk-PVZBDWLK.js +41 -0
- package/dist/chunk-PWZKFTJS.js +247 -0
- package/dist/chunk-PXYDR7WQ.js +48 -0
- package/dist/chunk-PYQJ5N25.js +191 -0
- package/dist/chunk-Q4UVXS46.js +14 -0
- package/dist/chunk-QDPLZDMX.js +17 -0
- package/dist/chunk-QSGR43JM.js +30 -0
- package/dist/chunk-QUNDGPF7.js +92801 -0
- package/dist/chunk-R65A4P4H.js +136 -0
- package/dist/chunk-RE7YXVFG.js +128 -0
- package/dist/chunk-RETT6WME.js +37 -0
- package/dist/chunk-RHKRREUU.js +15 -0
- package/dist/chunk-RIILGKYR.js +32 -0
- package/dist/chunk-RM5RSDYP.js +353 -0
- package/dist/chunk-RNC4NFVK.js +170 -0
- package/dist/chunk-RSMZHZI2.js +2078 -0
- package/dist/chunk-RXM4B6HR.js +8 -0
- package/dist/chunk-S2WEYEQR.js +14 -0
- package/dist/chunk-S3PQKKNV.js +49 -0
- package/dist/chunk-S5GQ2SES.js +276 -0
- package/dist/chunk-SECZTXSU.js +31 -0
- package/dist/chunk-SI4ALL7W.js +180 -0
- package/dist/chunk-SID3COTK.js +21 -0
- package/dist/chunk-SMQT3ZNO.js +8 -0
- package/dist/chunk-SOZMJA7V.js +61 -0
- package/dist/chunk-TG3TCIL6.js +207 -0
- package/dist/chunk-THHRRYRS.js +16 -0
- package/dist/chunk-TKGWSUEI.js +0 -0
- package/dist/chunk-TTFCO5HU.js +173 -0
- package/dist/chunk-TXEPCJEQ.js +430 -0
- package/dist/chunk-U2EI2ZLM.js +32 -0
- package/dist/chunk-U2ZFCAPX.js +34 -0
- package/dist/chunk-U3X4DNV6.js +179 -0
- package/dist/chunk-UXKKD4AD.js +437 -0
- package/dist/chunk-UYJ65N46.js +261 -0
- package/dist/chunk-VDWGP2U6.js +71 -0
- package/dist/chunk-VGJTARSA.js +89 -0
- package/dist/chunk-VHMGJUYN.js +28 -0
- package/dist/chunk-VKC3XKFF.js +283 -0
- package/dist/chunk-VKOE5J66.js +31 -0
- package/dist/chunk-VOHEQ7B5.js +31 -0
- package/dist/chunk-VW56KWO2.js +9 -0
- package/dist/chunk-W4KHJ4D6.js +74 -0
- package/dist/chunk-W6Y3PPU5.js +73 -0
- package/dist/chunk-W6ZVQJYB.js +311 -0
- package/dist/chunk-WA3IVAUC.js +123 -0
- package/dist/chunk-WHTS4G5K.js +1551 -0
- package/dist/chunk-WIYFXWRI.js +30 -0
- package/dist/chunk-WPFTRRWV.js +455 -0
- package/dist/chunk-WQZ4ONQV.js +6 -0
- package/dist/chunk-WS652CCV.js +893 -0
- package/dist/chunk-XG4PTPRM.js +0 -0
- package/dist/chunk-XRNDVICA.js +85 -0
- package/dist/chunk-XXZJISPX.js +48 -0
- package/dist/chunk-Y224F4UU.js +81 -0
- package/dist/chunk-Y3FR5JC7.js +437 -0
- package/dist/chunk-Y4VBOHAP.js +111 -0
- package/dist/chunk-Y7QKP6QU.js +35 -0
- package/dist/chunk-YVCBMOJG.js +50 -0
- package/dist/chunk-Z2WPXJ6J.js +146 -0
- package/dist/chunk-ZA2KFUFR.js +19 -0
- package/dist/chunk-ZEKV7LGF.js +6 -0
- package/dist/chunk-ZFFA36DB.js +186 -0
- package/dist/chunk-ZPGWTLF2.js +499 -0
- package/dist/chunk-ZVT2QSWR.js +263 -0
- package/dist/chunk-ZZ7VKT2S.js +4113 -0
- package/dist/collections-TREF67TO.js +63 -0
- package/dist/configuration-KWAL2QZ5.js +152 -0
- package/dist/configuration-RNWBTRAH.js +205 -0
- package/dist/create-7UEEO5TM.js +125 -0
- package/dist/create-DTCDJMIT.js +634 -0
- package/dist/create-DYDRAY6V.js +622 -0
- package/dist/create-EJM5C2XP.js +27 -0
- package/dist/create-F7OMPGZV.js +853 -0
- package/dist/create-G4UJOJJ6.js +69 -0
- package/dist/create-IE6MYOIY.js +170 -0
- package/dist/create-L23TGTBH.js +225 -0
- package/dist/create-LOBCFTCT.js +583 -0
- package/dist/create-MKBBF2V3.js +150 -0
- package/dist/create-TFDUNJSI.js +163 -0
- package/dist/create-TMTZDKII.js +711 -0
- package/dist/create-XGF6DB5F.js +239 -0
- package/dist/create-YAAK7JQ3.js +1052 -0
- package/dist/create-YPCVTXAK.js +194 -0
- package/dist/create-ZU362U3B.js +310 -0
- package/dist/customers-4QWR5UOL.js +27 -0
- package/dist/edit-2QA5BVOY.js +735 -0
- package/dist/edit-47I7VVNB.js +167 -0
- package/dist/edit-5BUGSOTL.js +255 -0
- package/dist/edit-7LQATDUD.js +193 -0
- package/dist/edit-AQAPYMDY.js +260 -0
- package/dist/edit-BQLSTFTQ.js +138 -0
- package/dist/edit-BYXHU3IG.js +308 -0
- package/dist/edit-DG3MY3ZH.js +244 -0
- package/dist/edit-J3LD76JS.js +192 -0
- package/dist/edit-J6WCPHDS.js +205 -0
- package/dist/edit-KCZVZLSZ.js +131 -0
- package/dist/edit-LOKLQGM2.js +181 -0
- package/dist/edit-MDTTTB33.js +104 -0
- package/dist/edit-NFSU2K3O.js +413 -0
- package/dist/edit-RHNZWNXD.js +89 -0
- package/dist/edit-XU33IVZH.js +204 -0
- package/dist/edit-ZMINDMGM.js +116 -0
- package/dist/edit-budget-Z5USV462.js +145 -0
- package/dist/edit-inventory-item-YFW2AFRD.js +128 -0
- package/dist/edit-inventory-item-attributes-IYAMJDTB.js +278 -0
- package/dist/fulfillment-SKXAF3BZ.js +545 -0
- package/dist/fulfillment-providers-ACERVITQ.js +279 -0
- package/dist/home-PP7YYCSB.js +16 -0
- package/dist/index.css +6 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +3656 -0
- package/dist/inventory-AIRQ2KNS.js +26 -0
- package/dist/locations-SQKM7JWN.js +23 -0
- package/dist/login-LKFCRHXN.js +35 -0
- package/dist/manage-locations-4PQS4QY7.js +195 -0
- package/dist/media-PL477QJO.js +703 -0
- package/dist/metadata-42MU3H7T.js +60 -0
- package/dist/metadata-DIJTVDF7.js +45 -0
- package/dist/metadata-NX3LEEB3.js +64 -0
- package/dist/metadata-RBDSM567.js +65 -0
- package/dist/metadata-VZTWNZPG.js +66 -0
- package/dist/metadata-X3XGQ563.js +67 -0
- package/dist/no-match-BO2NNLCM.js +33 -0
- package/dist/orders-2KHCHNO5.js +59 -0
- package/dist/organization-VQXCKHCN.js +233 -0
- package/dist/organize-3F5ZUIGB.js +23 -0
- package/dist/organize-WPWEPCF7.js +23 -0
- package/dist/pages/index.d.ts +1153 -0
- package/dist/pages/index.js +198 -0
- package/dist/payouts-3BY73LZ3.js +27 -0
- package/dist/price-lists-G256JJN7.js +34 -0
- package/dist/prices-EW7KBY6R.js +269 -0
- package/dist/pricing-3PUJDOZN.js +313 -0
- package/dist/product-tags-PI3RENEX.js +80 -0
- package/dist/product-types-WJPLJI7H.js +32 -0
- package/dist/product-variant-detail-EYTE7PHL.js +377 -0
- package/dist/product-variant-edit-PW7W5J5E.js +402 -0
- package/dist/products-GSN4I7BT.js +272 -0
- package/dist/products-RFYNEY57.js +85 -0
- package/dist/promotions-CIZIDQ64.js +31 -0
- package/dist/reset-password-OFUSH363.js +299 -0
- package/dist/return-reasons-4V2KVSRI.js +52 -0
- package/dist/sales-channels-MBWVM3X2.js +184 -0
- package/dist/sales-channels-ZKA62EAW.js +156 -0
- package/dist/seller-ZFDLKF5Y.js +36 -0
- package/dist/settings-NP2IAID5.js +111 -0
- package/dist/shipping-profile-7FTHSPY2.js +145 -0
- package/dist/shipping-profiles-7R6L65WG.js +43 -0
- package/dist/stock-ENMBCZRY.js +502 -0
- package/dist/stock-VYDJY46S.js +278 -0
- package/dist/tax-regions-V6G6244H.js +87 -0
- package/package.json +87 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DisplayIdCell,
|
|
3
|
+
DisplayIdHeader
|
|
4
|
+
} from "./chunk-HB3BP55W.js";
|
|
5
|
+
import {
|
|
6
|
+
DateCell,
|
|
7
|
+
DateHeader
|
|
8
|
+
} from "./chunk-LZ7QV42C.js";
|
|
9
|
+
import {
|
|
10
|
+
getOrderFulfillmentStatus,
|
|
11
|
+
getOrderPaymentStatus
|
|
12
|
+
} from "./chunk-LQSLDDPT.js";
|
|
13
|
+
import {
|
|
14
|
+
getStylizedAmount
|
|
15
|
+
} from "./chunk-PXYDR7WQ.js";
|
|
16
|
+
import {
|
|
17
|
+
StatusCell
|
|
18
|
+
} from "./chunk-DB6ANJBO.js";
|
|
19
|
+
import {
|
|
20
|
+
PlaceholderCell
|
|
21
|
+
} from "./chunk-PHOCVOZ5.js";
|
|
22
|
+
import {
|
|
23
|
+
countries
|
|
24
|
+
} from "./chunk-JRTZWK77.js";
|
|
25
|
+
|
|
26
|
+
// src/hooks/table/columns/use-order-table-columns.tsx
|
|
27
|
+
import {
|
|
28
|
+
createColumnHelper
|
|
29
|
+
} from "@tanstack/react-table";
|
|
30
|
+
import { useMemo } from "react";
|
|
31
|
+
|
|
32
|
+
// src/components/table/table-cells/order/country-cell/country-cell.tsx
|
|
33
|
+
import { Tooltip } from "@medusajs/ui";
|
|
34
|
+
import ReactCountryFlag from "react-country-flag";
|
|
35
|
+
import { jsx } from "react/jsx-runtime";
|
|
36
|
+
var CountryCell = ({
|
|
37
|
+
country
|
|
38
|
+
}) => {
|
|
39
|
+
if (!country) {
|
|
40
|
+
return /* @__PURE__ */ jsx(PlaceholderCell, {});
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsx("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx(Tooltip, { content: country.display_name, children: /* @__PURE__ */ jsx("div", { className: "flex size-4 items-center justify-center overflow-hidden rounded-sm", children: /* @__PURE__ */ jsx(
|
|
43
|
+
ReactCountryFlag,
|
|
44
|
+
{
|
|
45
|
+
countryCode: country.iso_2.toUpperCase(),
|
|
46
|
+
svg: true,
|
|
47
|
+
style: {
|
|
48
|
+
width: "16px",
|
|
49
|
+
height: "16px"
|
|
50
|
+
},
|
|
51
|
+
"aria-label": country.display_name
|
|
52
|
+
}
|
|
53
|
+
) }) }) });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/components/table/table-cells/order/customer-cell/customer-cell.tsx
|
|
57
|
+
import { useTranslation } from "react-i18next";
|
|
58
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
59
|
+
var CustomerCell = ({
|
|
60
|
+
customer
|
|
61
|
+
}) => {
|
|
62
|
+
if (!customer) {
|
|
63
|
+
return /* @__PURE__ */ jsx2("span", { className: "text-ui-fg-muted", children: "-" });
|
|
64
|
+
}
|
|
65
|
+
const { first_name, last_name, email } = customer;
|
|
66
|
+
const name = [first_name, last_name].filter(Boolean).join(" ");
|
|
67
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx2("span", { className: "truncate", children: name || email }) });
|
|
68
|
+
};
|
|
69
|
+
var CustomerHeader = () => {
|
|
70
|
+
const { t } = useTranslation();
|
|
71
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx2("span", { className: "truncate", children: t("fields.customer") }) });
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/components/table/table-cells/order/fulfillment-status-cell/fulfillment-status-cell.tsx
|
|
75
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
76
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
77
|
+
var FulfillmentStatusCell = ({
|
|
78
|
+
status
|
|
79
|
+
}) => {
|
|
80
|
+
const { t } = useTranslation2();
|
|
81
|
+
if (!status) {
|
|
82
|
+
return "-";
|
|
83
|
+
}
|
|
84
|
+
const { label, color } = getOrderFulfillmentStatus(t, status);
|
|
85
|
+
return /* @__PURE__ */ jsx3(StatusCell, { color, children: label });
|
|
86
|
+
};
|
|
87
|
+
var FulfillmentStatusHeader = () => {
|
|
88
|
+
const { t } = useTranslation2();
|
|
89
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx3("span", { className: "truncate", children: t("fields.fulfillment") }) });
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// src/components/table/table-cells/order/payment-status-cell/payment-status-cell.tsx
|
|
93
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
94
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
95
|
+
var PaymentStatusCell = ({ status }) => {
|
|
96
|
+
const { t } = useTranslation3();
|
|
97
|
+
const { label, color } = getOrderPaymentStatus(t, status);
|
|
98
|
+
return /* @__PURE__ */ jsx4(StatusCell, { color, children: label });
|
|
99
|
+
};
|
|
100
|
+
var PaymentStatusHeader = () => {
|
|
101
|
+
const { t } = useTranslation3();
|
|
102
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx4("span", { className: "truncate", children: t("fields.payment") }) });
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/components/table/table-cells/order/sales-channel-cell/sales-channel-cell.tsx
|
|
106
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
107
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
108
|
+
var SalesChannelCell = ({
|
|
109
|
+
channel
|
|
110
|
+
}) => {
|
|
111
|
+
if (!channel) {
|
|
112
|
+
return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
|
|
113
|
+
}
|
|
114
|
+
const { name } = channel;
|
|
115
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx5("span", { className: "truncate", children: name }) });
|
|
116
|
+
};
|
|
117
|
+
var SalesChannelHeader = () => {
|
|
118
|
+
const { t } = useTranslation4();
|
|
119
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx5("span", { className: "truncate", children: t("fields.salesChannel") }) });
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/components/table/table-cells/order/total-cell/total-cell.tsx
|
|
123
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
124
|
+
|
|
125
|
+
// src/components/table/table-cells/common/money-amount-cell/money-amount-cell.tsx
|
|
126
|
+
import { clx } from "@medusajs/ui";
|
|
127
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
128
|
+
var MoneyAmountCell = ({
|
|
129
|
+
currencyCode,
|
|
130
|
+
amount,
|
|
131
|
+
align = "left",
|
|
132
|
+
className
|
|
133
|
+
}) => {
|
|
134
|
+
if (typeof amount === "undefined" || amount === null) {
|
|
135
|
+
return /* @__PURE__ */ jsx6(PlaceholderCell, {});
|
|
136
|
+
}
|
|
137
|
+
const formatted = getStylizedAmount(amount, currencyCode);
|
|
138
|
+
return /* @__PURE__ */ jsx6(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
className: clx(
|
|
142
|
+
"flex h-full w-full items-center overflow-hidden",
|
|
143
|
+
{
|
|
144
|
+
"justify-start text-left": align === "left",
|
|
145
|
+
"justify-end text-right": align === "right"
|
|
146
|
+
},
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
children: /* @__PURE__ */ jsx6("span", { className: "truncate", children: formatted })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/components/table/table-cells/order/total-cell/total-cell.tsx
|
|
155
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
156
|
+
var TotalCell = ({ currencyCode, total, className }) => {
|
|
157
|
+
if (!total) {
|
|
158
|
+
return /* @__PURE__ */ jsx7(PlaceholderCell, {});
|
|
159
|
+
}
|
|
160
|
+
return /* @__PURE__ */ jsx7(MoneyAmountCell, { currencyCode, amount: total, className, align: "right" });
|
|
161
|
+
};
|
|
162
|
+
var TotalHeader = () => {
|
|
163
|
+
const { t } = useTranslation5();
|
|
164
|
+
return /* @__PURE__ */ jsx7("div", { className: "flex h-full w-full items-center justify-end", children: /* @__PURE__ */ jsx7("span", { className: "truncate", children: t("fields.total") }) });
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/hooks/table/columns/use-order-table-columns.tsx
|
|
168
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
169
|
+
var columnHelper = createColumnHelper();
|
|
170
|
+
var useOrderTableColumns = (props) => {
|
|
171
|
+
const { exclude = [] } = props ?? {};
|
|
172
|
+
const columns = useMemo(
|
|
173
|
+
() => [
|
|
174
|
+
columnHelper.accessor("display_id", {
|
|
175
|
+
header: () => /* @__PURE__ */ jsx8(DisplayIdHeader, {}),
|
|
176
|
+
cell: ({ getValue }) => {
|
|
177
|
+
const id = getValue();
|
|
178
|
+
return /* @__PURE__ */ jsx8(DisplayIdCell, { displayId: id });
|
|
179
|
+
}
|
|
180
|
+
}),
|
|
181
|
+
columnHelper.accessor("created_at", {
|
|
182
|
+
header: () => /* @__PURE__ */ jsx8(DateHeader, {}),
|
|
183
|
+
cell: ({ getValue }) => {
|
|
184
|
+
const date = new Date(getValue());
|
|
185
|
+
return /* @__PURE__ */ jsx8(DateCell, { date });
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
columnHelper.accessor("customer", {
|
|
189
|
+
header: () => /* @__PURE__ */ jsx8(CustomerHeader, {}),
|
|
190
|
+
cell: ({ getValue }) => {
|
|
191
|
+
const customer = getValue();
|
|
192
|
+
return /* @__PURE__ */ jsx8(CustomerCell, { customer });
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
columnHelper.accessor("sales_channel", {
|
|
196
|
+
header: () => /* @__PURE__ */ jsx8(SalesChannelHeader, {}),
|
|
197
|
+
cell: ({ getValue }) => {
|
|
198
|
+
const channel = getValue();
|
|
199
|
+
return /* @__PURE__ */ jsx8(SalesChannelCell, { channel });
|
|
200
|
+
}
|
|
201
|
+
}),
|
|
202
|
+
columnHelper.accessor("payment_status", {
|
|
203
|
+
header: () => /* @__PURE__ */ jsx8(PaymentStatusHeader, {}),
|
|
204
|
+
cell: ({ getValue }) => {
|
|
205
|
+
const status = getValue();
|
|
206
|
+
return /* @__PURE__ */ jsx8(PaymentStatusCell, { status });
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
columnHelper.accessor("fulfillment_status", {
|
|
210
|
+
header: () => /* @__PURE__ */ jsx8(FulfillmentStatusHeader, {}),
|
|
211
|
+
cell: ({ getValue }) => {
|
|
212
|
+
const status = getValue();
|
|
213
|
+
return /* @__PURE__ */ jsx8(FulfillmentStatusCell, { status });
|
|
214
|
+
}
|
|
215
|
+
}),
|
|
216
|
+
columnHelper.accessor("total", {
|
|
217
|
+
header: () => /* @__PURE__ */ jsx8(TotalHeader, {}),
|
|
218
|
+
cell: ({ getValue, row }) => {
|
|
219
|
+
const isFullyRefunded = row.original.payment_status === "refunded";
|
|
220
|
+
const total = !isFullyRefunded ? getValue() : row.original.payment_collections?.reduce(
|
|
221
|
+
(acc, payCol) => acc + (payCol.refunded_amount ?? 0),
|
|
222
|
+
0
|
|
223
|
+
) || 0;
|
|
224
|
+
const currencyCode = row.original.currency_code;
|
|
225
|
+
return /* @__PURE__ */ jsx8(
|
|
226
|
+
TotalCell,
|
|
227
|
+
{
|
|
228
|
+
currencyCode,
|
|
229
|
+
total,
|
|
230
|
+
className: isFullyRefunded ? "text-ui-fg-muted line-through" : ""
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}),
|
|
235
|
+
columnHelper.display({
|
|
236
|
+
id: "actions",
|
|
237
|
+
cell: ({ row }) => {
|
|
238
|
+
const countryCode = row.original.shipping_address?.country_code;
|
|
239
|
+
const country = countries.find((c) => c.iso_2 === countryCode);
|
|
240
|
+
return /* @__PURE__ */ jsx8(CountryCell, { country });
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
],
|
|
244
|
+
[]
|
|
245
|
+
);
|
|
246
|
+
const isAccessorColumnDef = (c) => {
|
|
247
|
+
return c.accessorKey !== void 0;
|
|
248
|
+
};
|
|
249
|
+
const isDisplayColumnDef = (c) => {
|
|
250
|
+
return c.id !== void 0;
|
|
251
|
+
};
|
|
252
|
+
const shouldExclude = (c) => {
|
|
253
|
+
if (isAccessorColumnDef(c)) {
|
|
254
|
+
return exclude.includes(c.accessorKey);
|
|
255
|
+
} else if (isDisplayColumnDef(c)) {
|
|
256
|
+
return exclude.includes(c.id);
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
};
|
|
260
|
+
return columns.filter(
|
|
261
|
+
(c) => !shouldExclude(c)
|
|
262
|
+
);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
useOrderTableColumns
|
|
267
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/components/common/conditional-tooltip/conditional-tooltip.tsx
|
|
2
|
+
import { Tooltip } from "@medusajs/ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var ConditionalTooltip = ({
|
|
5
|
+
children,
|
|
6
|
+
showTooltip = false,
|
|
7
|
+
...props
|
|
8
|
+
}) => {
|
|
9
|
+
if (showTooltip) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Tooltip, { ...props, children });
|
|
11
|
+
}
|
|
12
|
+
return children;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
ConditionalTooltip
|
|
17
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// src/lib/order-helpers.ts
|
|
2
|
+
var getCanceledOrderStatus = (t, status) => {
|
|
3
|
+
if (status === "canceled") {
|
|
4
|
+
return { label: t("orders.status.canceled"), color: "red" };
|
|
5
|
+
}
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
8
|
+
var getOrderPaymentStatus = (t, status) => {
|
|
9
|
+
const statusMap = {
|
|
10
|
+
not_paid: [t("orders.payment.status.notPaid"), "red"],
|
|
11
|
+
authorized: [t("orders.payment.status.authorized"), "orange"],
|
|
12
|
+
partially_authorized: [
|
|
13
|
+
t("orders.payment.status.partiallyAuthorized"),
|
|
14
|
+
"red"
|
|
15
|
+
],
|
|
16
|
+
awaiting: [t("orders.payment.status.awaiting"), "orange"],
|
|
17
|
+
captured: [t("orders.payment.status.captured"), "green"],
|
|
18
|
+
refunded: [t("orders.payment.status.refunded"), "red"],
|
|
19
|
+
partially_refunded: [
|
|
20
|
+
t("orders.payment.status.partiallyRefunded"),
|
|
21
|
+
"orange"
|
|
22
|
+
],
|
|
23
|
+
partially_captured: [
|
|
24
|
+
t("orders.payment.status.partiallyCaptured"),
|
|
25
|
+
"orange"
|
|
26
|
+
],
|
|
27
|
+
canceled: [t("orders.payment.status.canceled"), "red"],
|
|
28
|
+
requires_action: [t("orders.payment.status.requiresAction"), "orange"]
|
|
29
|
+
};
|
|
30
|
+
const [label, color] = statusMap[status] ?? [status ?? "-", "red"];
|
|
31
|
+
return { label, color };
|
|
32
|
+
};
|
|
33
|
+
var getOrderFulfillmentStatus = (t, status) => {
|
|
34
|
+
const statusMap = {
|
|
35
|
+
not_fulfilled: [t("orders.fulfillment.status.notFulfilled"), "red"],
|
|
36
|
+
partially_fulfilled: [
|
|
37
|
+
t("orders.fulfillment.status.partiallyFulfilled"),
|
|
38
|
+
"orange"
|
|
39
|
+
],
|
|
40
|
+
fulfilled: [t("orders.fulfillment.status.fulfilled"), "green"],
|
|
41
|
+
partially_shipped: [
|
|
42
|
+
t("orders.fulfillment.status.partiallyShipped"),
|
|
43
|
+
"orange"
|
|
44
|
+
],
|
|
45
|
+
shipped: [t("orders.fulfillment.status.shipped"), "green"],
|
|
46
|
+
delivered: [t("orders.fulfillment.status.delivered"), "green"],
|
|
47
|
+
partially_delivered: [
|
|
48
|
+
t("orders.fulfillment.status.partiallyDelivered"),
|
|
49
|
+
"orange"
|
|
50
|
+
],
|
|
51
|
+
partially_returned: [
|
|
52
|
+
t("orders.fulfillment.status.partiallyReturned"),
|
|
53
|
+
"orange"
|
|
54
|
+
],
|
|
55
|
+
returned: [t("orders.fulfillment.status.returned"), "green"],
|
|
56
|
+
canceled: [t("orders.fulfillment.status.canceled"), "red"],
|
|
57
|
+
requires_action: [t("orders.fulfillment.status.requiresAction"), "orange"]
|
|
58
|
+
};
|
|
59
|
+
const [label, color] = statusMap[status] ?? [status ?? "-", "red"];
|
|
60
|
+
return { label, color };
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
getCanceledOrderStatus,
|
|
65
|
+
getOrderPaymentStatus,
|
|
66
|
+
getOrderFulfillmentStatus
|
|
67
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
productsQueryKeys
|
|
3
|
+
} from "./chunk-WPFTRRWV.js";
|
|
4
|
+
import {
|
|
5
|
+
queryClient
|
|
6
|
+
} from "./chunk-RHKRREUU.js";
|
|
7
|
+
import {
|
|
8
|
+
queryKeysFactory
|
|
9
|
+
} from "./chunk-ZA2KFUFR.js";
|
|
10
|
+
import {
|
|
11
|
+
sdk
|
|
12
|
+
} from "./chunk-Y224F4UU.js";
|
|
13
|
+
|
|
14
|
+
// src/hooks/api/collections.tsx
|
|
15
|
+
import {
|
|
16
|
+
useMutation,
|
|
17
|
+
useQuery
|
|
18
|
+
} from "@tanstack/react-query";
|
|
19
|
+
var COLLECTION_QUERY_KEY = "collections";
|
|
20
|
+
var collectionsQueryKeys = queryKeysFactory(COLLECTION_QUERY_KEY);
|
|
21
|
+
var useCollection = (id, options) => {
|
|
22
|
+
const { data, ...rest } = useQuery({
|
|
23
|
+
queryKey: collectionsQueryKeys.detail(id),
|
|
24
|
+
queryFn: async () => sdk.vendor.collections.$id.query({ $id: id }),
|
|
25
|
+
...options
|
|
26
|
+
});
|
|
27
|
+
return { ...data, ...rest };
|
|
28
|
+
};
|
|
29
|
+
var useCollections = (query, options) => {
|
|
30
|
+
const { data, ...rest } = useQuery({
|
|
31
|
+
queryKey: collectionsQueryKeys.list(query),
|
|
32
|
+
queryFn: async () => sdk.vendor.collections.query({ ...query }),
|
|
33
|
+
...options
|
|
34
|
+
});
|
|
35
|
+
return { ...data, ...rest };
|
|
36
|
+
};
|
|
37
|
+
var useUpdateCollection = (id, options) => {
|
|
38
|
+
return useMutation({
|
|
39
|
+
mutationFn: (payload) => sdk.vendor.collections.$id.mutate({ $id: id, ...payload }),
|
|
40
|
+
onSuccess: (data, variables, context) => {
|
|
41
|
+
queryClient.invalidateQueries({
|
|
42
|
+
queryKey: collectionsQueryKeys.lists()
|
|
43
|
+
});
|
|
44
|
+
queryClient.invalidateQueries({
|
|
45
|
+
queryKey: collectionsQueryKeys.detail(id)
|
|
46
|
+
});
|
|
47
|
+
options?.onSuccess?.(data, variables, context);
|
|
48
|
+
},
|
|
49
|
+
...options
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var useUpdateCollectionProducts = (id, options) => {
|
|
53
|
+
return useMutation({
|
|
54
|
+
mutationFn: (payload) => sdk.vendor.collections.$id.products.mutate({ $id: id, ...payload }),
|
|
55
|
+
onSuccess: (data, variables, context) => {
|
|
56
|
+
queryClient.invalidateQueries({
|
|
57
|
+
queryKey: collectionsQueryKeys.lists()
|
|
58
|
+
});
|
|
59
|
+
queryClient.invalidateQueries({
|
|
60
|
+
queryKey: collectionsQueryKeys.detail(id)
|
|
61
|
+
});
|
|
62
|
+
queryClient.invalidateQueries({
|
|
63
|
+
queryKey: productsQueryKeys.lists()
|
|
64
|
+
});
|
|
65
|
+
options?.onSuccess?.(data, variables, context);
|
|
66
|
+
},
|
|
67
|
+
...options
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
collectionsQueryKeys,
|
|
73
|
+
useCollection,
|
|
74
|
+
useCollections,
|
|
75
|
+
useUpdateCollection,
|
|
76
|
+
useUpdateCollectionProducts
|
|
77
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// src/components/table/data-table/data-table-search/data-table-search.tsx
|
|
2
|
+
import { Input } from "@medusajs/ui";
|
|
3
|
+
import { useCallback, useEffect } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import debounce from "lodash.debounce";
|
|
6
|
+
|
|
7
|
+
// src/components/table/data-table/hooks.tsx
|
|
8
|
+
import { useSearchParams } from "react-router-dom";
|
|
9
|
+
var useSelectedParams = ({
|
|
10
|
+
param,
|
|
11
|
+
prefix,
|
|
12
|
+
multiple = false
|
|
13
|
+
}) => {
|
|
14
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
15
|
+
const identifier = prefix ? `${prefix}_${param}` : param;
|
|
16
|
+
const offsetKey = prefix ? `${prefix}_offset` : "offset";
|
|
17
|
+
const add = (value) => {
|
|
18
|
+
setSearchParams((prev) => {
|
|
19
|
+
const newValue = new URLSearchParams(prev);
|
|
20
|
+
const updateMultipleValues = () => {
|
|
21
|
+
const existingValues = newValue.get(identifier)?.split(",") || [];
|
|
22
|
+
if (!existingValues.includes(value)) {
|
|
23
|
+
existingValues.push(value);
|
|
24
|
+
newValue.set(identifier, existingValues.join(","));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const updateSingleValue = () => {
|
|
28
|
+
newValue.set(identifier, value);
|
|
29
|
+
};
|
|
30
|
+
multiple ? updateMultipleValues() : updateSingleValue();
|
|
31
|
+
newValue.delete(offsetKey);
|
|
32
|
+
return newValue;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const deleteParam = (value) => {
|
|
36
|
+
const deleteMultipleValues = (prev) => {
|
|
37
|
+
const existingValues = prev.get(identifier)?.split(",") || [];
|
|
38
|
+
const index = existingValues.indexOf(value || "");
|
|
39
|
+
if (index > -1) {
|
|
40
|
+
existingValues.splice(index, 1);
|
|
41
|
+
prev.set(identifier, existingValues.join(","));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const deleteSingleValue = (prev) => {
|
|
45
|
+
prev.delete(identifier);
|
|
46
|
+
};
|
|
47
|
+
setSearchParams((prev) => {
|
|
48
|
+
if (value) {
|
|
49
|
+
multiple ? deleteMultipleValues(prev) : deleteSingleValue(prev);
|
|
50
|
+
if (!prev.get(identifier)) {
|
|
51
|
+
prev.delete(identifier);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
prev.delete(identifier);
|
|
55
|
+
}
|
|
56
|
+
prev.delete(offsetKey);
|
|
57
|
+
return prev;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const get = () => {
|
|
61
|
+
return searchParams.get(identifier)?.split(",").filter(Boolean) || [];
|
|
62
|
+
};
|
|
63
|
+
return { add, delete: deleteParam, get };
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/components/table/data-table/data-table-search/data-table-search.tsx
|
|
67
|
+
import { jsx } from "react/jsx-runtime";
|
|
68
|
+
var DataTableSearch = ({
|
|
69
|
+
placeholder,
|
|
70
|
+
prefix,
|
|
71
|
+
autofocus
|
|
72
|
+
}) => {
|
|
73
|
+
const { t } = useTranslation();
|
|
74
|
+
const placeholderText = placeholder || t("general.search");
|
|
75
|
+
const selectedParams = useSelectedParams({
|
|
76
|
+
param: "q",
|
|
77
|
+
prefix,
|
|
78
|
+
multiple: false
|
|
79
|
+
});
|
|
80
|
+
const query = selectedParams.get();
|
|
81
|
+
const debouncedOnChange = useCallback(
|
|
82
|
+
debounce((e) => {
|
|
83
|
+
const value = e.target.value;
|
|
84
|
+
if (!value) {
|
|
85
|
+
selectedParams.delete();
|
|
86
|
+
} else {
|
|
87
|
+
selectedParams.add(value);
|
|
88
|
+
}
|
|
89
|
+
}, 500),
|
|
90
|
+
[selectedParams]
|
|
91
|
+
);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
return () => {
|
|
94
|
+
debouncedOnChange.cancel();
|
|
95
|
+
};
|
|
96
|
+
}, [debouncedOnChange]);
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
Input,
|
|
99
|
+
{
|
|
100
|
+
autoComplete: "off",
|
|
101
|
+
name: "q",
|
|
102
|
+
type: "search",
|
|
103
|
+
size: "small",
|
|
104
|
+
autoFocus: autofocus,
|
|
105
|
+
defaultValue: query?.[0] || void 0,
|
|
106
|
+
onChange: debouncedOnChange,
|
|
107
|
+
placeholder: placeholderText
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
useSelectedParams,
|
|
114
|
+
DataTableSearch
|
|
115
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PlaceholderCell
|
|
3
|
+
} from "./chunk-PHOCVOZ5.js";
|
|
4
|
+
import {
|
|
5
|
+
useDate
|
|
6
|
+
} from "./chunk-CFETU5BI.js";
|
|
7
|
+
|
|
8
|
+
// src/components/table/table-cells/common/date-cell/date-cell.tsx
|
|
9
|
+
import { Tooltip } from "@medusajs/ui";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var DateCell = ({ date }) => {
|
|
13
|
+
const { getFullDate } = useDate();
|
|
14
|
+
if (!date) {
|
|
15
|
+
return /* @__PURE__ */ jsx(PlaceholderCell, {});
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
18
|
+
Tooltip,
|
|
19
|
+
{
|
|
20
|
+
className: "z-10",
|
|
21
|
+
content: /* @__PURE__ */ jsx("span", { className: "text-pretty", children: `${getFullDate({
|
|
22
|
+
date,
|
|
23
|
+
includeTime: true
|
|
24
|
+
})}` }),
|
|
25
|
+
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: getFullDate({ date, includeTime: false }) })
|
|
26
|
+
}
|
|
27
|
+
) });
|
|
28
|
+
};
|
|
29
|
+
var DateHeader = () => {
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.date") }) });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
DateCell,
|
|
36
|
+
DateHeader
|
|
37
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// src/components/inputs/percentage-input/percentage-input.tsx
|
|
2
|
+
import { clx, Input, Text } from "@medusajs/ui";
|
|
3
|
+
|
|
4
|
+
// src/lib/number-helper.ts
|
|
5
|
+
function getNumberOfDecimalPlaces(num) {
|
|
6
|
+
const str = num.toString();
|
|
7
|
+
if (str.indexOf(".") === -1) {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
return str.split(".")[1].length;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/components/inputs/percentage-input/percentage-input.tsx
|
|
14
|
+
import {
|
|
15
|
+
forwardRef
|
|
16
|
+
} from "react";
|
|
17
|
+
import Primitive from "react-currency-input-field";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var MIN_DECIMAL_SCALE = 2;
|
|
20
|
+
function resolveDecimalScale(value) {
|
|
21
|
+
if (value == null || Array.isArray(value)) {
|
|
22
|
+
return MIN_DECIMAL_SCALE;
|
|
23
|
+
}
|
|
24
|
+
return Math.max(
|
|
25
|
+
getNumberOfDecimalPlaces(parseFloat(value.toString())),
|
|
26
|
+
MIN_DECIMAL_SCALE
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
var DeprecatedPercentageInput = forwardRef(({ min = 0, max = 100, step = 1e-4, ...props }, ref) => {
|
|
30
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
31
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 z-10 flex w-8 items-center justify-center border-r", children: /* @__PURE__ */ jsx(
|
|
32
|
+
Text,
|
|
33
|
+
{
|
|
34
|
+
className: "text-ui-fg-muted",
|
|
35
|
+
size: "small",
|
|
36
|
+
leading: "compact",
|
|
37
|
+
weight: "plus",
|
|
38
|
+
children: "%"
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Input,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
type: "number",
|
|
46
|
+
min,
|
|
47
|
+
max,
|
|
48
|
+
step,
|
|
49
|
+
...props,
|
|
50
|
+
className: "pl-10"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
});
|
|
55
|
+
DeprecatedPercentageInput.displayName = "PercentageInput";
|
|
56
|
+
var PercentageInput = forwardRef(
|
|
57
|
+
({
|
|
58
|
+
min = 0,
|
|
59
|
+
max = 100,
|
|
60
|
+
decimalScale,
|
|
61
|
+
decimalsLimit,
|
|
62
|
+
value,
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}, ref) => {
|
|
66
|
+
const resolvedDecimalScale = decimalScale ?? resolveDecimalScale(value);
|
|
67
|
+
const resolvedDecimalsLimit = decimalsLimit ?? resolvedDecimalScale;
|
|
68
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Primitive,
|
|
71
|
+
{
|
|
72
|
+
ref,
|
|
73
|
+
min,
|
|
74
|
+
max,
|
|
75
|
+
autoComplete: "off",
|
|
76
|
+
decimalScale: resolvedDecimalScale,
|
|
77
|
+
decimalsLimit: resolvedDecimalsLimit,
|
|
78
|
+
value,
|
|
79
|
+
...props,
|
|
80
|
+
className: clx(
|
|
81
|
+
"caret-ui-fg-base bg-ui-bg-field shadow-buttons-neutral transition-fg txt-compact-small flex w-full select-none appearance-none items-center justify-between rounded-md px-2 py-1.5 pl-10 text-left outline-none",
|
|
82
|
+
"placeholder:text-ui-fg-muted text-ui-fg-base",
|
|
83
|
+
"hover:bg-ui-bg-field-hover",
|
|
84
|
+
"focus-visible:shadow-borders-interactive-with-active data-[state=open]:!shadow-borders-interactive-with-active",
|
|
85
|
+
"aria-[invalid=true]:border-ui-border-error aria-[invalid=true]:shadow-borders-error",
|
|
86
|
+
"invalid::border-ui-border-error invalid:shadow-borders-error",
|
|
87
|
+
"disabled:!bg-ui-bg-disabled disabled:!text-ui-fg-disabled",
|
|
88
|
+
className
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 z-10 flex w-8 items-center justify-center border-r", children: /* @__PURE__ */ jsx(
|
|
93
|
+
Text,
|
|
94
|
+
{
|
|
95
|
+
className: "text-ui-fg-muted",
|
|
96
|
+
size: "small",
|
|
97
|
+
leading: "compact",
|
|
98
|
+
weight: "plus",
|
|
99
|
+
children: "%"
|
|
100
|
+
}
|
|
101
|
+
) })
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
PercentageInput.displayName = "PercentageInput";
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
DeprecatedPercentageInput,
|
|
109
|
+
PercentageInput
|
|
110
|
+
};
|