@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,3656 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProgressBar
|
|
3
|
+
} from "./chunk-QSGR43JM.js";
|
|
4
|
+
import {
|
|
5
|
+
isClientError
|
|
6
|
+
} from "./chunk-C6SUTRP2.js";
|
|
7
|
+
import "./chunk-FMFVTERD.js";
|
|
8
|
+
import {
|
|
9
|
+
TabbedForm,
|
|
10
|
+
useTabbedForm
|
|
11
|
+
} from "./chunk-FGCKXH45.js";
|
|
12
|
+
import {
|
|
13
|
+
I18n
|
|
14
|
+
} from "./chunk-QUNDGPF7.js";
|
|
15
|
+
import "./chunk-TKGWSUEI.js";
|
|
16
|
+
import "./chunk-U2ZFCAPX.js";
|
|
17
|
+
import "./chunk-3CK6OINO.js";
|
|
18
|
+
import "./chunk-3QSRE5LS.js";
|
|
19
|
+
import {
|
|
20
|
+
Thumbnail
|
|
21
|
+
} from "./chunk-WIYFXWRI.js";
|
|
22
|
+
import {
|
|
23
|
+
ConditionalTooltip
|
|
24
|
+
} from "./chunk-LAVHRER2.js";
|
|
25
|
+
import {
|
|
26
|
+
useDocumentDirection
|
|
27
|
+
} from "./chunk-Y7QKP6QU.js";
|
|
28
|
+
import {
|
|
29
|
+
Skeleton
|
|
30
|
+
} from "./chunk-INNFZYX2.js";
|
|
31
|
+
import {
|
|
32
|
+
useMe,
|
|
33
|
+
useProductTags
|
|
34
|
+
} from "./chunk-OSFOX7MG.js";
|
|
35
|
+
import {
|
|
36
|
+
useLogout
|
|
37
|
+
} from "./chunk-W4KHJ4D6.js";
|
|
38
|
+
import "./chunk-VGJTARSA.js";
|
|
39
|
+
import "./chunk-DYUTYBAQ.js";
|
|
40
|
+
import "./chunk-Y4VBOHAP.js";
|
|
41
|
+
import "./chunk-JKXAL7WR.js";
|
|
42
|
+
import "./chunk-DC2K6CFQ.js";
|
|
43
|
+
import {
|
|
44
|
+
useProductTypes
|
|
45
|
+
} from "./chunk-VDWGP2U6.js";
|
|
46
|
+
import {
|
|
47
|
+
usePriceLists
|
|
48
|
+
} from "./chunk-RE7YXVFG.js";
|
|
49
|
+
import {
|
|
50
|
+
useCampaigns,
|
|
51
|
+
usePromotions
|
|
52
|
+
} from "./chunk-HUNGNEPY.js";
|
|
53
|
+
import {
|
|
54
|
+
useCustomers
|
|
55
|
+
} from "./chunk-PADOWAXM.js";
|
|
56
|
+
import {
|
|
57
|
+
useCollections
|
|
58
|
+
} from "./chunk-LWVBKUUL.js";
|
|
59
|
+
import "./chunk-RIILGKYR.js";
|
|
60
|
+
import "./chunk-6EYGH3TB.js";
|
|
61
|
+
import "./chunk-GTUR4HSV.js";
|
|
62
|
+
import {
|
|
63
|
+
useStockLocations
|
|
64
|
+
} from "./chunk-SI4ALL7W.js";
|
|
65
|
+
import {
|
|
66
|
+
useOrders
|
|
67
|
+
} from "./chunk-ZFFA36DB.js";
|
|
68
|
+
import "./chunk-VHMGJUYN.js";
|
|
69
|
+
import {
|
|
70
|
+
useProductCategories
|
|
71
|
+
} from "./chunk-ASVMGV2B.js";
|
|
72
|
+
import {
|
|
73
|
+
useInventoryItems,
|
|
74
|
+
useProducts
|
|
75
|
+
} from "./chunk-WPFTRRWV.js";
|
|
76
|
+
import "./chunk-A5DJIOHN.js";
|
|
77
|
+
import {
|
|
78
|
+
queryClient
|
|
79
|
+
} from "./chunk-RHKRREUU.js";
|
|
80
|
+
import "./chunk-ZA2KFUFR.js";
|
|
81
|
+
import "./chunk-Y224F4UU.js";
|
|
82
|
+
import "./chunk-PKBMQBKP.js";
|
|
83
|
+
|
|
84
|
+
// src/app.tsx
|
|
85
|
+
import { customRoutes } from "virtual:mercur/routes";
|
|
86
|
+
import { HelmetProvider } from "react-helmet-async";
|
|
87
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
88
|
+
|
|
89
|
+
// src/providers/theme-provider/theme-provider.tsx
|
|
90
|
+
import { useEffect, useState } from "react";
|
|
91
|
+
|
|
92
|
+
// src/providers/theme-provider/theme-context.tsx
|
|
93
|
+
import { createContext } from "react";
|
|
94
|
+
var ThemeContext = createContext(null);
|
|
95
|
+
|
|
96
|
+
// src/providers/theme-provider/theme-provider.tsx
|
|
97
|
+
import { jsx } from "react/jsx-runtime";
|
|
98
|
+
var THEME_KEY = "medusa_admin_theme";
|
|
99
|
+
function getDefaultValue() {
|
|
100
|
+
const persisted = localStorage?.getItem(THEME_KEY);
|
|
101
|
+
if (persisted) {
|
|
102
|
+
return persisted;
|
|
103
|
+
}
|
|
104
|
+
return "system";
|
|
105
|
+
}
|
|
106
|
+
function getThemeValue(selected) {
|
|
107
|
+
if (selected === "system") {
|
|
108
|
+
if (window !== void 0) {
|
|
109
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
110
|
+
}
|
|
111
|
+
return "light";
|
|
112
|
+
}
|
|
113
|
+
return selected;
|
|
114
|
+
}
|
|
115
|
+
var ThemeProvider = ({ children }) => {
|
|
116
|
+
const [state, setState] = useState(getDefaultValue());
|
|
117
|
+
const [value, setValue] = useState(getThemeValue(state));
|
|
118
|
+
const setTheme = (theme) => {
|
|
119
|
+
localStorage.setItem(THEME_KEY, theme);
|
|
120
|
+
const themeValue = getThemeValue(theme);
|
|
121
|
+
setState(theme);
|
|
122
|
+
setValue(themeValue);
|
|
123
|
+
};
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const html = document.querySelector("html");
|
|
126
|
+
if (html) {
|
|
127
|
+
const css = document.createElement("style");
|
|
128
|
+
css.appendChild(
|
|
129
|
+
document.createTextNode(
|
|
130
|
+
`* {
|
|
131
|
+
-webkit-transition: none !important;
|
|
132
|
+
-moz-transition: none !important;
|
|
133
|
+
-o-transition: none !important;
|
|
134
|
+
-ms-transition: none !important;
|
|
135
|
+
transition: none !important;
|
|
136
|
+
}`
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
document.head.appendChild(css);
|
|
140
|
+
html.classList.remove(value === "light" ? "dark" : "light");
|
|
141
|
+
html.classList.add(value);
|
|
142
|
+
html.style.colorScheme = value;
|
|
143
|
+
window.getComputedStyle(css).opacity;
|
|
144
|
+
document.head.removeChild(css);
|
|
145
|
+
}
|
|
146
|
+
}, [value]);
|
|
147
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme: state, setTheme }, children });
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/providers/theme-provider/use-theme.tsx
|
|
151
|
+
import { useContext } from "react";
|
|
152
|
+
var useTheme = () => {
|
|
153
|
+
const context = useContext(ThemeContext);
|
|
154
|
+
if (!context) {
|
|
155
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
156
|
+
}
|
|
157
|
+
return context;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
161
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
162
|
+
import { useLocation } from "react-router-dom";
|
|
163
|
+
|
|
164
|
+
// src/providers/sidebar-provider/sidebar-context.tsx
|
|
165
|
+
import { createContext as createContext2 } from "react";
|
|
166
|
+
var SidebarContext = createContext2(null);
|
|
167
|
+
|
|
168
|
+
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
169
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
170
|
+
var SidebarProvider = ({ children }) => {
|
|
171
|
+
const [desktop, setDesktop] = useState2(true);
|
|
172
|
+
const [mobile, setMobile] = useState2(false);
|
|
173
|
+
const { pathname } = useLocation();
|
|
174
|
+
const toggle = (view) => {
|
|
175
|
+
if (view === "desktop") {
|
|
176
|
+
setDesktop(!desktop);
|
|
177
|
+
} else {
|
|
178
|
+
setMobile(!mobile);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
useEffect2(() => {
|
|
182
|
+
setMobile(false);
|
|
183
|
+
}, [pathname]);
|
|
184
|
+
return /* @__PURE__ */ jsx2(SidebarContext.Provider, { value: { desktop, mobile, toggle }, children });
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/providers/sidebar-provider/use-sidebar.tsx
|
|
188
|
+
import { useContext as useContext2 } from "react";
|
|
189
|
+
var useSidebar = () => {
|
|
190
|
+
const context = useContext2(SidebarContext);
|
|
191
|
+
if (!context) {
|
|
192
|
+
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
193
|
+
}
|
|
194
|
+
return context;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/providers/keybind-provider/hooks.tsx
|
|
198
|
+
import { default as debounceFn } from "lodash.debounce";
|
|
199
|
+
import { useCallback, useContext as useContext3, useEffect as useEffect3, useState as useState3 } from "react";
|
|
200
|
+
import { useTranslation } from "react-i18next";
|
|
201
|
+
import { useNavigate } from "react-router-dom";
|
|
202
|
+
|
|
203
|
+
// src/providers/keybind-provider/keybind-context.tsx
|
|
204
|
+
import { createContext as createContext3 } from "react";
|
|
205
|
+
var KeybindContext = createContext3(null);
|
|
206
|
+
|
|
207
|
+
// src/providers/keybind-provider/utils.ts
|
|
208
|
+
var findFirstPlatformMatch = (keys) => {
|
|
209
|
+
const match = Object.entries(keys).filter(
|
|
210
|
+
([, value]) => value.length > 0
|
|
211
|
+
)[0] ?? [];
|
|
212
|
+
return match.length ? {
|
|
213
|
+
platform: match[0],
|
|
214
|
+
keys: match[1]
|
|
215
|
+
} : null;
|
|
216
|
+
};
|
|
217
|
+
var getShortcutKeys = (shortcut) => {
|
|
218
|
+
const platform = "Mac";
|
|
219
|
+
const keys = shortcut.keys[platform];
|
|
220
|
+
if (!keys) {
|
|
221
|
+
const defaultPlatform = findFirstPlatformMatch(shortcut.keys);
|
|
222
|
+
console.warn(
|
|
223
|
+
`No keys found for platform "${platform}" in "${shortcut.label}" ${defaultPlatform ? `using keys for platform "${defaultPlatform.platform}"` : ""}`
|
|
224
|
+
);
|
|
225
|
+
return defaultPlatform ? defaultPlatform.keys : [];
|
|
226
|
+
}
|
|
227
|
+
return keys;
|
|
228
|
+
};
|
|
229
|
+
var keysMatch = (keys1, keys2) => {
|
|
230
|
+
return keys1.length === keys2.length && keys1.every(
|
|
231
|
+
(key, index) => key.toLowerCase() === keys2[index].toLowerCase()
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
var findShortcutIndex = (shortcuts, keys) => {
|
|
235
|
+
if (!keys.length) {
|
|
236
|
+
return -1;
|
|
237
|
+
}
|
|
238
|
+
let index = 0;
|
|
239
|
+
for (const shortcut of shortcuts) {
|
|
240
|
+
const shortcutKeys = getShortcutKeys(shortcut);
|
|
241
|
+
if (keysMatch(shortcutKeys, keys)) {
|
|
242
|
+
return index;
|
|
243
|
+
}
|
|
244
|
+
index++;
|
|
245
|
+
}
|
|
246
|
+
return -1;
|
|
247
|
+
};
|
|
248
|
+
var findShortcut = (shortcuts, keys) => {
|
|
249
|
+
const shortcutIndex = findShortcutIndex(shortcuts, keys);
|
|
250
|
+
return shortcutIndex > -1 ? shortcuts[shortcutIndex] : null;
|
|
251
|
+
};
|
|
252
|
+
var getShortcutWithDefaultValues = (shortcut, platform = "Mac") => {
|
|
253
|
+
const platforms = ["Mac", "Windows", "Linux"];
|
|
254
|
+
const defaultKeys = Object.values(shortcut.keys)[0] ?? shortcut.keys[platform];
|
|
255
|
+
const keys = platforms.reduce((acc, curr) => {
|
|
256
|
+
return {
|
|
257
|
+
...acc,
|
|
258
|
+
[curr]: shortcut.keys[curr] ?? defaultKeys
|
|
259
|
+
};
|
|
260
|
+
}, {});
|
|
261
|
+
return {
|
|
262
|
+
...shortcut,
|
|
263
|
+
keys,
|
|
264
|
+
_defaultKeys: shortcut.keys
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/providers/keybind-provider/hooks.tsx
|
|
269
|
+
var useShortcuts = ({
|
|
270
|
+
shortcuts = [],
|
|
271
|
+
debounce
|
|
272
|
+
}) => {
|
|
273
|
+
const [keys, setKeys] = useState3([]);
|
|
274
|
+
const navigate = useNavigate();
|
|
275
|
+
const removeKeys = useCallback(
|
|
276
|
+
debounceFn(() => setKeys([]), debounce),
|
|
277
|
+
[]
|
|
278
|
+
);
|
|
279
|
+
const invokeShortcut = useCallback(
|
|
280
|
+
debounceFn((shortcut) => {
|
|
281
|
+
if (shortcut && shortcut.callback) {
|
|
282
|
+
shortcut.callback();
|
|
283
|
+
setKeys([]);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (shortcut && shortcut.to) {
|
|
287
|
+
navigate(shortcut.to);
|
|
288
|
+
setKeys([]);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
}, debounce / 2),
|
|
292
|
+
[]
|
|
293
|
+
);
|
|
294
|
+
useEffect3(() => {
|
|
295
|
+
if (keys.length > 0 && shortcuts.length > 0) {
|
|
296
|
+
const shortcut = findShortcut(shortcuts, keys);
|
|
297
|
+
invokeShortcut(shortcut);
|
|
298
|
+
}
|
|
299
|
+
return () => invokeShortcut.cancel();
|
|
300
|
+
}, [keys, shortcuts, invokeShortcut]);
|
|
301
|
+
useEffect3(() => {
|
|
302
|
+
const listener = (event) => {
|
|
303
|
+
const target = event.target;
|
|
304
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.contentEditable === "true") {
|
|
305
|
+
removeKeys();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
setKeys((oldKeys) => [...oldKeys, event.key]);
|
|
309
|
+
removeKeys();
|
|
310
|
+
};
|
|
311
|
+
window.addEventListener("keydown", listener);
|
|
312
|
+
return () => {
|
|
313
|
+
window.removeEventListener("keydown", listener);
|
|
314
|
+
};
|
|
315
|
+
}, [removeKeys]);
|
|
316
|
+
};
|
|
317
|
+
var useGlobalShortcuts = () => {
|
|
318
|
+
const { t: t2 } = useTranslation();
|
|
319
|
+
const navigate = useNavigate();
|
|
320
|
+
const { mutateAsync } = useLogout();
|
|
321
|
+
const handleLogout = async () => {
|
|
322
|
+
await mutateAsync(void 0, {
|
|
323
|
+
onSuccess: () => {
|
|
324
|
+
queryClient.clear();
|
|
325
|
+
navigate("/login");
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
const globalShortcuts = [
|
|
330
|
+
// Pages
|
|
331
|
+
{
|
|
332
|
+
keys: {
|
|
333
|
+
Mac: ["G", "O"]
|
|
334
|
+
},
|
|
335
|
+
label: t2("app.keyboardShortcuts.navigation.goToOrders"),
|
|
336
|
+
type: "pageShortcut",
|
|
337
|
+
to: "/orders"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
keys: {
|
|
341
|
+
Mac: ["G", "P"]
|
|
342
|
+
},
|
|
343
|
+
label: t2("app.keyboardShortcuts.navigation.goToProducts"),
|
|
344
|
+
type: "pageShortcut",
|
|
345
|
+
to: "/products"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
keys: {
|
|
349
|
+
Mac: ["G", "C"]
|
|
350
|
+
},
|
|
351
|
+
label: t2("app.keyboardShortcuts.navigation.goToCollections"),
|
|
352
|
+
type: "pageShortcut",
|
|
353
|
+
to: "/collections"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
keys: {
|
|
357
|
+
Mac: ["G", "A"]
|
|
358
|
+
},
|
|
359
|
+
label: t2("app.keyboardShortcuts.navigation.goToCategories"),
|
|
360
|
+
type: "pageShortcut",
|
|
361
|
+
to: "/categories"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
keys: {
|
|
365
|
+
Mac: ["G", "U"]
|
|
366
|
+
},
|
|
367
|
+
label: t2("app.keyboardShortcuts.navigation.goToCustomers"),
|
|
368
|
+
type: "pageShortcut",
|
|
369
|
+
to: "/customers"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
keys: {
|
|
373
|
+
Mac: ["G", "I"]
|
|
374
|
+
},
|
|
375
|
+
label: t2("app.keyboardShortcuts.navigation.goToInventory"),
|
|
376
|
+
type: "pageShortcut",
|
|
377
|
+
to: "/inventory"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
keys: {
|
|
381
|
+
Mac: ["G", "L"]
|
|
382
|
+
},
|
|
383
|
+
label: t2("app.keyboardShortcuts.navigation.goToPriceLists"),
|
|
384
|
+
type: "pageShortcut",
|
|
385
|
+
to: "/price-lists"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
keys: {
|
|
389
|
+
Mac: ["G", "M"]
|
|
390
|
+
},
|
|
391
|
+
label: t2("app.keyboardShortcuts.navigation.goToPromotions"),
|
|
392
|
+
type: "pageShortcut",
|
|
393
|
+
to: "/promotions"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
keys: {
|
|
397
|
+
Mac: ["G", "K"]
|
|
398
|
+
},
|
|
399
|
+
label: t2("app.keyboardShortcuts.navigation.goToCampaigns"),
|
|
400
|
+
type: "pageShortcut",
|
|
401
|
+
to: "/campaigns"
|
|
402
|
+
},
|
|
403
|
+
// Settings
|
|
404
|
+
{
|
|
405
|
+
keys: {
|
|
406
|
+
Mac: ["G", ","]
|
|
407
|
+
},
|
|
408
|
+
label: t2("app.keyboardShortcuts.settings.goToSettings"),
|
|
409
|
+
type: "settingShortcut",
|
|
410
|
+
to: "/settings"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
keys: {
|
|
414
|
+
Mac: ["G", ",", "S"]
|
|
415
|
+
},
|
|
416
|
+
label: t2("app.keyboardShortcuts.settings.goToSeller"),
|
|
417
|
+
type: "settingShortcut",
|
|
418
|
+
to: "/settings/seller"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
keys: {
|
|
422
|
+
Mac: ["G", ",", "P"]
|
|
423
|
+
},
|
|
424
|
+
label: t2("app.keyboardShortcuts.settings.goToProductTypes"),
|
|
425
|
+
type: "settingShortcut",
|
|
426
|
+
to: "/settings/product-types"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
keys: {
|
|
430
|
+
Mac: ["G", ",", "L"]
|
|
431
|
+
},
|
|
432
|
+
label: t2("app.keyboardShortcuts.settings.goToLocations"),
|
|
433
|
+
type: "settingShortcut",
|
|
434
|
+
to: "/settings/locations"
|
|
435
|
+
},
|
|
436
|
+
// Commands
|
|
437
|
+
{
|
|
438
|
+
keys: {
|
|
439
|
+
Mac: ["B", "Y", "E"]
|
|
440
|
+
},
|
|
441
|
+
label: t2("actions.logout"),
|
|
442
|
+
type: "commandShortcut",
|
|
443
|
+
callback: () => handleLogout()
|
|
444
|
+
}
|
|
445
|
+
];
|
|
446
|
+
return globalShortcuts;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/providers/keybind-provider/keybind-provider.tsx
|
|
450
|
+
import { useCallback as useCallback2, useMemo, useState as useState4 } from "react";
|
|
451
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
452
|
+
var KeybindProvider = ({
|
|
453
|
+
shortcuts,
|
|
454
|
+
debounce = 500,
|
|
455
|
+
children
|
|
456
|
+
}) => {
|
|
457
|
+
const [storeShortcuts, setStoreCommands] = useState4(
|
|
458
|
+
shortcuts.map((shr) => getShortcutWithDefaultValues(shr))
|
|
459
|
+
);
|
|
460
|
+
const registerShortcut = useCallback2(
|
|
461
|
+
(shortcut) => {
|
|
462
|
+
setStoreCommands((prevShortcuts) => {
|
|
463
|
+
const idx = findShortcutIndex(shortcuts, getShortcutKeys(shortcut));
|
|
464
|
+
const newShortcuts = [...prevShortcuts];
|
|
465
|
+
if (idx > -1) {
|
|
466
|
+
newShortcuts[idx] = getShortcutWithDefaultValues(shortcut);
|
|
467
|
+
return prevShortcuts;
|
|
468
|
+
}
|
|
469
|
+
return [...prevShortcuts, getShortcutWithDefaultValues(shortcut)];
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
[shortcuts]
|
|
473
|
+
);
|
|
474
|
+
const getKeysByPlatform = useCallback2((command) => {
|
|
475
|
+
return findFirstPlatformMatch(command.keys);
|
|
476
|
+
}, []);
|
|
477
|
+
useShortcuts({ shortcuts: storeShortcuts, debounce });
|
|
478
|
+
const commandsContext = useMemo(
|
|
479
|
+
() => ({
|
|
480
|
+
shortcuts: storeShortcuts,
|
|
481
|
+
registerShortcut,
|
|
482
|
+
getKeysByPlatform
|
|
483
|
+
}),
|
|
484
|
+
[storeShortcuts, registerShortcut, getKeysByPlatform]
|
|
485
|
+
);
|
|
486
|
+
return /* @__PURE__ */ jsx3(KeybindContext.Provider, { value: commandsContext, children });
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// src/providers/search-provider/search-provider.tsx
|
|
490
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
491
|
+
|
|
492
|
+
// src/components/search/search.tsx
|
|
493
|
+
import {
|
|
494
|
+
Badge,
|
|
495
|
+
Button,
|
|
496
|
+
clx,
|
|
497
|
+
DropdownMenu,
|
|
498
|
+
IconButton,
|
|
499
|
+
Kbd,
|
|
500
|
+
Text
|
|
501
|
+
} from "@medusajs/ui";
|
|
502
|
+
import { Command } from "cmdk";
|
|
503
|
+
import { Dialog as RadixDialog } from "radix-ui";
|
|
504
|
+
import {
|
|
505
|
+
Children,
|
|
506
|
+
forwardRef,
|
|
507
|
+
Fragment,
|
|
508
|
+
useCallback as useCallback4,
|
|
509
|
+
useEffect as useEffect5,
|
|
510
|
+
useImperativeHandle,
|
|
511
|
+
useMemo as useMemo3,
|
|
512
|
+
useRef,
|
|
513
|
+
useState as useState6
|
|
514
|
+
} from "react";
|
|
515
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
516
|
+
import { useLocation as useLocation2, useNavigate as useNavigate2 } from "react-router-dom";
|
|
517
|
+
import {
|
|
518
|
+
ArrowUturnLeft,
|
|
519
|
+
MagnifyingGlass,
|
|
520
|
+
Plus,
|
|
521
|
+
Spinner,
|
|
522
|
+
TriangleDownMini
|
|
523
|
+
} from "@medusajs/icons";
|
|
524
|
+
import { matchSorter } from "match-sorter";
|
|
525
|
+
|
|
526
|
+
// src/components/search/constants.ts
|
|
527
|
+
var SEARCH_AREAS = [
|
|
528
|
+
"all",
|
|
529
|
+
"order",
|
|
530
|
+
"product",
|
|
531
|
+
"collection",
|
|
532
|
+
"category",
|
|
533
|
+
"inventory",
|
|
534
|
+
"customer",
|
|
535
|
+
"promotion",
|
|
536
|
+
"campaign",
|
|
537
|
+
"priceList",
|
|
538
|
+
"productType",
|
|
539
|
+
"productTag",
|
|
540
|
+
"location",
|
|
541
|
+
"command",
|
|
542
|
+
"navigation"
|
|
543
|
+
];
|
|
544
|
+
var DEFAULT_SEARCH_LIMIT = 3;
|
|
545
|
+
var SEARCH_LIMIT_INCREMENT = 20;
|
|
546
|
+
|
|
547
|
+
// src/components/search/use-search-results.tsx
|
|
548
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
549
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useState as useState5 } from "react";
|
|
550
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
551
|
+
var useSearchResults = ({
|
|
552
|
+
q,
|
|
553
|
+
limit,
|
|
554
|
+
area = "all"
|
|
555
|
+
}) => {
|
|
556
|
+
const staticResults = useStaticSearchResults(area);
|
|
557
|
+
const { dynamicResults, isFetching } = useDynamicSearchResults(area, limit, q);
|
|
558
|
+
return {
|
|
559
|
+
staticResults,
|
|
560
|
+
dynamicResults,
|
|
561
|
+
isFetching
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
var useStaticSearchResults = (currentArea) => {
|
|
565
|
+
const globalCommands = useGlobalShortcuts();
|
|
566
|
+
const results = useMemo2(() => {
|
|
567
|
+
const groups = /* @__PURE__ */ new Map();
|
|
568
|
+
globalCommands.forEach((command) => {
|
|
569
|
+
const group = groups.get(command.type) || [];
|
|
570
|
+
group.push(command);
|
|
571
|
+
groups.set(command.type, group);
|
|
572
|
+
});
|
|
573
|
+
let filteredGroups;
|
|
574
|
+
switch (currentArea) {
|
|
575
|
+
case "all":
|
|
576
|
+
filteredGroups = Array.from(groups);
|
|
577
|
+
break;
|
|
578
|
+
case "navigation":
|
|
579
|
+
filteredGroups = Array.from(groups).filter(
|
|
580
|
+
([type]) => type === "pageShortcut" || type === "settingShortcut"
|
|
581
|
+
);
|
|
582
|
+
break;
|
|
583
|
+
case "command":
|
|
584
|
+
filteredGroups = Array.from(groups).filter(
|
|
585
|
+
([type]) => type === "commandShortcut"
|
|
586
|
+
);
|
|
587
|
+
break;
|
|
588
|
+
default:
|
|
589
|
+
filteredGroups = [];
|
|
590
|
+
}
|
|
591
|
+
return filteredGroups.map(([title, items]) => ({
|
|
592
|
+
title,
|
|
593
|
+
items
|
|
594
|
+
}));
|
|
595
|
+
}, [globalCommands, currentArea]);
|
|
596
|
+
return results;
|
|
597
|
+
};
|
|
598
|
+
var useDynamicSearchResults = (currentArea, limit, q) => {
|
|
599
|
+
const { t: t2 } = useTranslation2();
|
|
600
|
+
const debouncedSearch = useDebouncedSearch(q, 300);
|
|
601
|
+
const orderResponse = useOrders(
|
|
602
|
+
{
|
|
603
|
+
q: debouncedSearch?.replace(/^#/, ""),
|
|
604
|
+
// Since we display the ID with a # prefix, it's natural for the user to include it in the search. This will however cause no results to be returned, so we remove the # prefix from the search query.
|
|
605
|
+
limit,
|
|
606
|
+
fields: "id,display_id,email"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
enabled: isAreaEnabled(currentArea, "order"),
|
|
610
|
+
placeholderData: keepPreviousData
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
const productResponse = useProducts(
|
|
614
|
+
{
|
|
615
|
+
q: debouncedSearch,
|
|
616
|
+
limit,
|
|
617
|
+
// TODO: Remove exclusion once we avoid including unnecessary relations by default in the query config
|
|
618
|
+
fields: "id,title,thumbnail,-type,-collection,-options,-tags,-images,-variants,-sales_channels"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
enabled: isAreaEnabled(currentArea, "product"),
|
|
622
|
+
placeholderData: keepPreviousData
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
const categoryResponse = useProductCategories(
|
|
626
|
+
{
|
|
627
|
+
// TODO: Remove the OR condition once the list endpoint does not throw when q equals an empty string
|
|
628
|
+
q: debouncedSearch || void 0,
|
|
629
|
+
limit,
|
|
630
|
+
fields: "id,name"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
enabled: isAreaEnabled(currentArea, "category"),
|
|
634
|
+
placeholderData: keepPreviousData
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
const collectionResponse = useCollections(
|
|
638
|
+
{
|
|
639
|
+
q: debouncedSearch,
|
|
640
|
+
limit,
|
|
641
|
+
fields: "id,title"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
enabled: isAreaEnabled(currentArea, "collection"),
|
|
645
|
+
placeholderData: keepPreviousData
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
const customerResponse = useCustomers(
|
|
649
|
+
{
|
|
650
|
+
q: debouncedSearch,
|
|
651
|
+
limit,
|
|
652
|
+
fields: "id,email,first_name,last_name"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
enabled: isAreaEnabled(currentArea, "customer"),
|
|
656
|
+
placeholderData: keepPreviousData
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
const inventoryResponse = useInventoryItems(
|
|
660
|
+
{
|
|
661
|
+
q: debouncedSearch,
|
|
662
|
+
limit,
|
|
663
|
+
fields: "id,title,sku"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
enabled: isAreaEnabled(currentArea, "inventory"),
|
|
667
|
+
placeholderData: keepPreviousData
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
const promotionResponse = usePromotions(
|
|
671
|
+
{
|
|
672
|
+
q: debouncedSearch,
|
|
673
|
+
limit,
|
|
674
|
+
fields: "id,code,status"
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
enabled: isAreaEnabled(currentArea, "promotion"),
|
|
678
|
+
placeholderData: keepPreviousData
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
const campaignResponse = useCampaigns(
|
|
682
|
+
{
|
|
683
|
+
q: debouncedSearch,
|
|
684
|
+
limit,
|
|
685
|
+
fields: "id,name"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
enabled: isAreaEnabled(currentArea, "campaign"),
|
|
689
|
+
placeholderData: keepPreviousData
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
const priceListResponse = usePriceLists(
|
|
693
|
+
{
|
|
694
|
+
q: debouncedSearch,
|
|
695
|
+
limit,
|
|
696
|
+
fields: "id,title"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
enabled: isAreaEnabled(currentArea, "priceList"),
|
|
700
|
+
placeholderData: keepPreviousData
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
const productTypeResponse = useProductTypes(
|
|
704
|
+
{
|
|
705
|
+
q: debouncedSearch,
|
|
706
|
+
limit,
|
|
707
|
+
fields: "id,value"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
enabled: isAreaEnabled(currentArea, "productType"),
|
|
711
|
+
placeholderData: keepPreviousData
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
const productTagResponse = useProductTags(
|
|
715
|
+
{
|
|
716
|
+
q: debouncedSearch,
|
|
717
|
+
limit,
|
|
718
|
+
fields: "id,value"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
enabled: isAreaEnabled(currentArea, "productTag"),
|
|
722
|
+
placeholderData: keepPreviousData
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
const locationResponse = useStockLocations(
|
|
726
|
+
{
|
|
727
|
+
q: debouncedSearch,
|
|
728
|
+
limit,
|
|
729
|
+
fields: "id,name"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
enabled: isAreaEnabled(currentArea, "location"),
|
|
733
|
+
placeholderData: keepPreviousData
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
const responseMap = useMemo2(
|
|
737
|
+
() => ({
|
|
738
|
+
order: orderResponse,
|
|
739
|
+
product: productResponse,
|
|
740
|
+
collection: collectionResponse,
|
|
741
|
+
category: categoryResponse,
|
|
742
|
+
inventory: inventoryResponse,
|
|
743
|
+
customer: customerResponse,
|
|
744
|
+
promotion: promotionResponse,
|
|
745
|
+
campaign: campaignResponse,
|
|
746
|
+
priceList: priceListResponse,
|
|
747
|
+
productType: productTypeResponse,
|
|
748
|
+
productTag: productTagResponse,
|
|
749
|
+
location: locationResponse
|
|
750
|
+
}),
|
|
751
|
+
[
|
|
752
|
+
orderResponse,
|
|
753
|
+
productResponse,
|
|
754
|
+
inventoryResponse,
|
|
755
|
+
categoryResponse,
|
|
756
|
+
collectionResponse,
|
|
757
|
+
customerResponse,
|
|
758
|
+
promotionResponse,
|
|
759
|
+
campaignResponse,
|
|
760
|
+
priceListResponse,
|
|
761
|
+
productTypeResponse,
|
|
762
|
+
productTagResponse,
|
|
763
|
+
locationResponse
|
|
764
|
+
]
|
|
765
|
+
);
|
|
766
|
+
const results = useMemo2(() => {
|
|
767
|
+
const groups = Object.entries(responseMap).map(([key, response]) => {
|
|
768
|
+
const area = key;
|
|
769
|
+
if (isAreaEnabled(currentArea, area) || currentArea === "all") {
|
|
770
|
+
return transformDynamicSearchResults(area, limit, t2, response);
|
|
771
|
+
}
|
|
772
|
+
return null;
|
|
773
|
+
}).filter(Boolean);
|
|
774
|
+
return groups;
|
|
775
|
+
}, [responseMap, currentArea, limit, t2]);
|
|
776
|
+
const isAreaFetching = useCallback3(
|
|
777
|
+
(area) => {
|
|
778
|
+
if (area === "all") {
|
|
779
|
+
return Object.values(responseMap).some(
|
|
780
|
+
(response) => response.isFetching
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
return isAreaEnabled(currentArea, area) && responseMap[area]?.isFetching;
|
|
784
|
+
},
|
|
785
|
+
[currentArea, responseMap]
|
|
786
|
+
);
|
|
787
|
+
const isFetching = useMemo2(() => {
|
|
788
|
+
return isAreaFetching(currentArea);
|
|
789
|
+
}, [currentArea, isAreaFetching]);
|
|
790
|
+
const dynamicResults = q ? results.filter(
|
|
791
|
+
(group) => !!group && group.items.length > 0
|
|
792
|
+
) : [];
|
|
793
|
+
return {
|
|
794
|
+
dynamicResults,
|
|
795
|
+
isFetching
|
|
796
|
+
};
|
|
797
|
+
};
|
|
798
|
+
var useDebouncedSearch = (value, delay) => {
|
|
799
|
+
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
800
|
+
useEffect4(() => {
|
|
801
|
+
const handler = setTimeout(() => {
|
|
802
|
+
setDebouncedValue(value);
|
|
803
|
+
}, delay);
|
|
804
|
+
return () => {
|
|
805
|
+
clearTimeout(handler);
|
|
806
|
+
};
|
|
807
|
+
}, [value, delay]);
|
|
808
|
+
return debouncedValue;
|
|
809
|
+
};
|
|
810
|
+
function isAreaEnabled(area, currentArea) {
|
|
811
|
+
if (area === "all") {
|
|
812
|
+
return true;
|
|
813
|
+
}
|
|
814
|
+
if (area === currentArea) {
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
var transformMap = {
|
|
820
|
+
order: {
|
|
821
|
+
dataKey: "orders",
|
|
822
|
+
transform: (order) => ({
|
|
823
|
+
id: order.id,
|
|
824
|
+
title: `#${order.display_id}`,
|
|
825
|
+
subtitle: order.email ?? void 0,
|
|
826
|
+
to: `/orders/${order.id}`,
|
|
827
|
+
value: `order:${order.id}`
|
|
828
|
+
})
|
|
829
|
+
},
|
|
830
|
+
product: {
|
|
831
|
+
dataKey: "products",
|
|
832
|
+
transform: (product) => ({
|
|
833
|
+
id: product.id,
|
|
834
|
+
title: product.title,
|
|
835
|
+
to: `/products/${product.id}`,
|
|
836
|
+
thumbnail: product.thumbnail ?? void 0,
|
|
837
|
+
value: `product:${product.id}`
|
|
838
|
+
})
|
|
839
|
+
},
|
|
840
|
+
category: {
|
|
841
|
+
dataKey: "product_categories",
|
|
842
|
+
transform: (category) => ({
|
|
843
|
+
id: category.id,
|
|
844
|
+
title: category.name,
|
|
845
|
+
to: `/categories/${category.id}`,
|
|
846
|
+
value: `category:${category.id}`
|
|
847
|
+
})
|
|
848
|
+
},
|
|
849
|
+
inventory: {
|
|
850
|
+
dataKey: "inventory_items",
|
|
851
|
+
transform: (inventory) => ({
|
|
852
|
+
id: inventory.id,
|
|
853
|
+
title: inventory.title ?? "",
|
|
854
|
+
subtitle: inventory.sku ?? void 0,
|
|
855
|
+
to: `/inventory/${inventory.id}`,
|
|
856
|
+
value: `inventory:${inventory.id}`
|
|
857
|
+
})
|
|
858
|
+
},
|
|
859
|
+
customer: {
|
|
860
|
+
dataKey: "customers",
|
|
861
|
+
transform: (customer) => {
|
|
862
|
+
const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
863
|
+
return {
|
|
864
|
+
id: customer.id,
|
|
865
|
+
title: name || customer.email,
|
|
866
|
+
subtitle: name ? customer.email : void 0,
|
|
867
|
+
to: `/customers/${customer.id}`,
|
|
868
|
+
value: `customer:${customer.id}`
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
collection: {
|
|
873
|
+
dataKey: "collections",
|
|
874
|
+
transform: (collection) => ({
|
|
875
|
+
id: collection.id,
|
|
876
|
+
title: collection.title,
|
|
877
|
+
to: `/collections/${collection.id}`,
|
|
878
|
+
value: `collection:${collection.id}`
|
|
879
|
+
})
|
|
880
|
+
},
|
|
881
|
+
promotion: {
|
|
882
|
+
dataKey: "promotions",
|
|
883
|
+
transform: (promotion) => ({
|
|
884
|
+
id: promotion.id,
|
|
885
|
+
title: promotion.code,
|
|
886
|
+
to: `/promotions/${promotion.id}`,
|
|
887
|
+
value: `promotion:${promotion.id}`
|
|
888
|
+
})
|
|
889
|
+
},
|
|
890
|
+
campaign: {
|
|
891
|
+
dataKey: "campaigns",
|
|
892
|
+
transform: (campaign) => ({
|
|
893
|
+
id: campaign.id,
|
|
894
|
+
title: campaign.name,
|
|
895
|
+
to: `/campaigns/${campaign.id}`,
|
|
896
|
+
value: `campaign:${campaign.id}`
|
|
897
|
+
})
|
|
898
|
+
},
|
|
899
|
+
priceList: {
|
|
900
|
+
dataKey: "price_lists",
|
|
901
|
+
transform: (priceList) => ({
|
|
902
|
+
id: priceList.id,
|
|
903
|
+
title: priceList.title,
|
|
904
|
+
to: `/price-lists/${priceList.id}`,
|
|
905
|
+
value: `priceList:${priceList.id}`
|
|
906
|
+
})
|
|
907
|
+
},
|
|
908
|
+
productType: {
|
|
909
|
+
dataKey: "product_types",
|
|
910
|
+
transform: (productType) => ({
|
|
911
|
+
id: productType.id,
|
|
912
|
+
title: productType.value,
|
|
913
|
+
to: `/product-types/${productType.id}`,
|
|
914
|
+
value: `productType:${productType.id}`
|
|
915
|
+
})
|
|
916
|
+
},
|
|
917
|
+
productTag: {
|
|
918
|
+
dataKey: "product_tags",
|
|
919
|
+
transform: (productTag) => ({
|
|
920
|
+
id: productTag.id,
|
|
921
|
+
title: productTag.value,
|
|
922
|
+
to: `/product-tags/${productTag.id}`,
|
|
923
|
+
value: `productTag:${productTag.id}`
|
|
924
|
+
})
|
|
925
|
+
},
|
|
926
|
+
location: {
|
|
927
|
+
dataKey: "stock_locations",
|
|
928
|
+
transform: (location) => ({
|
|
929
|
+
id: location.id,
|
|
930
|
+
title: location.name,
|
|
931
|
+
to: `/locations/${location.id}`,
|
|
932
|
+
value: `location:${location.id}`
|
|
933
|
+
})
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
function transformDynamicSearchResults(type, limit, t2, response) {
|
|
937
|
+
if (!response || !transformMap[type]) {
|
|
938
|
+
return void 0;
|
|
939
|
+
}
|
|
940
|
+
const { dataKey, transform } = transformMap[type];
|
|
941
|
+
const data = response[dataKey];
|
|
942
|
+
if (!data || !Array.isArray(data)) {
|
|
943
|
+
return void 0;
|
|
944
|
+
}
|
|
945
|
+
return {
|
|
946
|
+
title: t2(`app.search.groups.${type}`),
|
|
947
|
+
area: type,
|
|
948
|
+
hasMore: response.count > limit,
|
|
949
|
+
count: response.count,
|
|
950
|
+
items: data.map(transform)
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// src/components/search/search.tsx
|
|
955
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
956
|
+
var Search = () => {
|
|
957
|
+
const [area, setArea] = useState6("all");
|
|
958
|
+
const [search, setSearch] = useState6("");
|
|
959
|
+
const [limit, setLimit] = useState6(DEFAULT_SEARCH_LIMIT);
|
|
960
|
+
const { open, onOpenChange } = useSearch();
|
|
961
|
+
const location = useLocation2();
|
|
962
|
+
const { t: t2 } = useTranslation3();
|
|
963
|
+
const navigate = useNavigate2();
|
|
964
|
+
const inputRef = useRef(null);
|
|
965
|
+
const listRef = useRef(null);
|
|
966
|
+
const { staticResults, dynamicResults, isFetching } = useSearchResults({
|
|
967
|
+
area,
|
|
968
|
+
limit,
|
|
969
|
+
q: search
|
|
970
|
+
});
|
|
971
|
+
const handleReset = useCallback4(() => {
|
|
972
|
+
setArea("all");
|
|
973
|
+
setSearch("");
|
|
974
|
+
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
975
|
+
}, [setLimit]);
|
|
976
|
+
const handleBack = () => {
|
|
977
|
+
handleReset();
|
|
978
|
+
inputRef.current?.focus();
|
|
979
|
+
};
|
|
980
|
+
const handleOpenChange = useCallback4(
|
|
981
|
+
(open2) => {
|
|
982
|
+
if (!open2) {
|
|
983
|
+
handleReset();
|
|
984
|
+
}
|
|
985
|
+
onOpenChange(open2);
|
|
986
|
+
},
|
|
987
|
+
[onOpenChange, handleReset]
|
|
988
|
+
);
|
|
989
|
+
useEffect5(() => {
|
|
990
|
+
handleOpenChange(false);
|
|
991
|
+
}, [location.pathname, handleOpenChange]);
|
|
992
|
+
const handleSelect = (item) => {
|
|
993
|
+
handleOpenChange(false);
|
|
994
|
+
if (item.to) {
|
|
995
|
+
navigate(item.to);
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
if (item.callback) {
|
|
999
|
+
item.callback();
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
const handleShowMore = (area2) => {
|
|
1004
|
+
if (area2 === "all") {
|
|
1005
|
+
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
1006
|
+
} else {
|
|
1007
|
+
setLimit(SEARCH_LIMIT_INCREMENT);
|
|
1008
|
+
}
|
|
1009
|
+
setArea(area2);
|
|
1010
|
+
inputRef.current?.focus();
|
|
1011
|
+
};
|
|
1012
|
+
const handleLoadMore = () => {
|
|
1013
|
+
setLimit((l) => l + SEARCH_LIMIT_INCREMENT);
|
|
1014
|
+
};
|
|
1015
|
+
const filteredStaticResults = useMemo3(() => {
|
|
1016
|
+
const filteredResults = [];
|
|
1017
|
+
staticResults.forEach((group) => {
|
|
1018
|
+
const filteredItems = matchSorter(group.items, search, {
|
|
1019
|
+
keys: ["label"]
|
|
1020
|
+
});
|
|
1021
|
+
if (filteredItems.length === 0) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
filteredResults.push({
|
|
1025
|
+
...group,
|
|
1026
|
+
items: filteredItems
|
|
1027
|
+
});
|
|
1028
|
+
});
|
|
1029
|
+
return filteredResults;
|
|
1030
|
+
}, [staticResults, search]);
|
|
1031
|
+
const handleSearch = (q) => {
|
|
1032
|
+
setSearch(q);
|
|
1033
|
+
listRef.current?.scrollTo({ top: 0 });
|
|
1034
|
+
};
|
|
1035
|
+
const showLoading = useMemo3(() => {
|
|
1036
|
+
return isFetching && !dynamicResults.length && !filteredStaticResults.length;
|
|
1037
|
+
}, [isFetching, dynamicResults, filteredStaticResults]);
|
|
1038
|
+
return /* @__PURE__ */ jsxs(CommandDialog, { open, onOpenChange: handleOpenChange, children: [
|
|
1039
|
+
/* @__PURE__ */ jsx4(
|
|
1040
|
+
CommandInput,
|
|
1041
|
+
{
|
|
1042
|
+
isFetching,
|
|
1043
|
+
ref: inputRef,
|
|
1044
|
+
area,
|
|
1045
|
+
setArea,
|
|
1046
|
+
value: search,
|
|
1047
|
+
onValueChange: handleSearch,
|
|
1048
|
+
onBack: area !== "all" ? handleBack : void 0,
|
|
1049
|
+
placeholder: t2("app.search.placeholder")
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ jsxs(CommandList, { ref: listRef, children: [
|
|
1053
|
+
showLoading && /* @__PURE__ */ jsx4(CommandLoading, {}),
|
|
1054
|
+
dynamicResults.map((group) => {
|
|
1055
|
+
return /* @__PURE__ */ jsxs(CommandGroup, { heading: group.title, children: [
|
|
1056
|
+
group.items.map((item) => {
|
|
1057
|
+
return /* @__PURE__ */ jsx4(
|
|
1058
|
+
CommandItem,
|
|
1059
|
+
{
|
|
1060
|
+
onSelect: () => handleSelect(item),
|
|
1061
|
+
value: item.value,
|
|
1062
|
+
className: "flex items-center justify-between",
|
|
1063
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
1064
|
+
item.thumbnail && /* @__PURE__ */ jsx4(
|
|
1065
|
+
Thumbnail,
|
|
1066
|
+
{
|
|
1067
|
+
alt: item.title,
|
|
1068
|
+
src: item.thumbnail,
|
|
1069
|
+
size: "small"
|
|
1070
|
+
}
|
|
1071
|
+
),
|
|
1072
|
+
/* @__PURE__ */ jsx4("span", { children: item.title }),
|
|
1073
|
+
item.subtitle && /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted", children: item.subtitle })
|
|
1074
|
+
] })
|
|
1075
|
+
},
|
|
1076
|
+
item.id
|
|
1077
|
+
);
|
|
1078
|
+
}),
|
|
1079
|
+
group.hasMore && area === "all" && /* @__PURE__ */ jsx4(
|
|
1080
|
+
CommandItem,
|
|
1081
|
+
{
|
|
1082
|
+
onSelect: () => handleShowMore(group.area),
|
|
1083
|
+
hidden: true,
|
|
1084
|
+
value: `${group.title}:show:more`,
|
|
1085
|
+
children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
|
|
1086
|
+
/* @__PURE__ */ jsx4(Plus, {}),
|
|
1087
|
+
/* @__PURE__ */ jsx4(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.showMore") })
|
|
1088
|
+
] })
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
group.hasMore && area === group.area && /* @__PURE__ */ jsx4(
|
|
1092
|
+
CommandItem,
|
|
1093
|
+
{
|
|
1094
|
+
onSelect: handleLoadMore,
|
|
1095
|
+
hidden: true,
|
|
1096
|
+
value: `${group.title}:load:more`,
|
|
1097
|
+
children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
|
|
1098
|
+
/* @__PURE__ */ jsx4(Plus, {}),
|
|
1099
|
+
/* @__PURE__ */ jsx4(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.loadMore", {
|
|
1100
|
+
count: Math.min(
|
|
1101
|
+
SEARCH_LIMIT_INCREMENT,
|
|
1102
|
+
group.count - limit
|
|
1103
|
+
)
|
|
1104
|
+
}) })
|
|
1105
|
+
] })
|
|
1106
|
+
}
|
|
1107
|
+
)
|
|
1108
|
+
] }, group.title);
|
|
1109
|
+
}),
|
|
1110
|
+
filteredStaticResults.map((group) => {
|
|
1111
|
+
return /* @__PURE__ */ jsx4(
|
|
1112
|
+
CommandGroup,
|
|
1113
|
+
{
|
|
1114
|
+
heading: t2(`app.keyboardShortcuts.${group.title}`),
|
|
1115
|
+
children: group.items.map((item) => {
|
|
1116
|
+
return /* @__PURE__ */ jsxs(
|
|
1117
|
+
CommandItem,
|
|
1118
|
+
{
|
|
1119
|
+
onSelect: () => handleSelect(item),
|
|
1120
|
+
className: "flex items-center justify-between",
|
|
1121
|
+
children: [
|
|
1122
|
+
/* @__PURE__ */ jsx4("span", { children: item.label }),
|
|
1123
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center gap-x-1.5", children: item.keys.Mac?.map((key, index) => {
|
|
1124
|
+
return /* @__PURE__ */ jsxs(
|
|
1125
|
+
"div",
|
|
1126
|
+
{
|
|
1127
|
+
className: "flex items-center gap-x-1",
|
|
1128
|
+
children: [
|
|
1129
|
+
/* @__PURE__ */ jsx4(Kbd, { children: key }),
|
|
1130
|
+
index < (item.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx4("span", { className: "txt-compact-xsmall text-ui-fg-subtle", children: t2("app.keyboardShortcuts.then") })
|
|
1131
|
+
]
|
|
1132
|
+
},
|
|
1133
|
+
index
|
|
1134
|
+
);
|
|
1135
|
+
}) })
|
|
1136
|
+
]
|
|
1137
|
+
},
|
|
1138
|
+
item.label
|
|
1139
|
+
);
|
|
1140
|
+
})
|
|
1141
|
+
},
|
|
1142
|
+
group.title
|
|
1143
|
+
);
|
|
1144
|
+
}),
|
|
1145
|
+
!showLoading && /* @__PURE__ */ jsx4(CommandEmpty, { q: search })
|
|
1146
|
+
] })
|
|
1147
|
+
] });
|
|
1148
|
+
};
|
|
1149
|
+
var CommandPalette = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
1150
|
+
Command,
|
|
1151
|
+
{
|
|
1152
|
+
shouldFilter: false,
|
|
1153
|
+
ref,
|
|
1154
|
+
className: clx(
|
|
1155
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1156
|
+
className
|
|
1157
|
+
),
|
|
1158
|
+
...props
|
|
1159
|
+
}
|
|
1160
|
+
));
|
|
1161
|
+
CommandPalette.displayName = Command.displayName;
|
|
1162
|
+
var CommandDialog = ({ children, ...props }) => {
|
|
1163
|
+
const { t: t2 } = useTranslation3();
|
|
1164
|
+
const preserveHeight = useMemo3(() => {
|
|
1165
|
+
return props.isLoading && Children.count(children) === 0;
|
|
1166
|
+
}, [props.isLoading, children]);
|
|
1167
|
+
return /* @__PURE__ */ jsx4(RadixDialog.Root, { ...props, children: /* @__PURE__ */ jsxs(RadixDialog.Portal, { children: [
|
|
1168
|
+
/* @__PURE__ */ jsx4(RadixDialog.Overlay, { className: "bg-ui-bg-overlay fixed inset-0" }),
|
|
1169
|
+
/* @__PURE__ */ jsxs(
|
|
1170
|
+
RadixDialog.Content,
|
|
1171
|
+
{
|
|
1172
|
+
className: clx(
|
|
1173
|
+
"bg-ui-bg-base shadow-elevation-modal fixed left-[50%] top-[50%] flex max-h-[calc(100%-16px)] w-[calc(100%-16px)] min-w-0 max-w-2xl translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl p-0",
|
|
1174
|
+
{
|
|
1175
|
+
"h-[300px]": preserveHeight
|
|
1176
|
+
// Prevents the dialog from collapsing when loading async results and before the no results message is displayed
|
|
1177
|
+
}
|
|
1178
|
+
),
|
|
1179
|
+
children: [
|
|
1180
|
+
/* @__PURE__ */ jsx4(RadixDialog.Title, { className: "sr-only", children: t2("app.search.title") }),
|
|
1181
|
+
/* @__PURE__ */ jsx4(RadixDialog.Description, { className: "sr-only", children: t2("app.search.description") }),
|
|
1182
|
+
/* @__PURE__ */ jsx4(CommandPalette, { className: "[&_[cmdk-group-heading]]:text-muted-foreground flex h-full flex-col overflow-hidden [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0", children }),
|
|
1183
|
+
/* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-field text-ui-fg-subtle flex items-center justify-end border-t px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
1185
|
+
/* @__PURE__ */ jsx4(Text, { size: "xsmall", leading: "compact", children: t2("app.search.navigation") }),
|
|
1186
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
|
|
1187
|
+
/* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u2193" }),
|
|
1188
|
+
/* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u2191" })
|
|
1189
|
+
] })
|
|
1190
|
+
] }),
|
|
1191
|
+
/* @__PURE__ */ jsx4("div", { className: "bg-ui-border-strong h-3 w-px" }),
|
|
1192
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
1193
|
+
/* @__PURE__ */ jsx4(Text, { size: "xsmall", leading: "compact", children: t2("app.search.openResult") }),
|
|
1194
|
+
/* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u21B5" })
|
|
1195
|
+
] })
|
|
1196
|
+
] }) })
|
|
1197
|
+
]
|
|
1198
|
+
}
|
|
1199
|
+
)
|
|
1200
|
+
] }) });
|
|
1201
|
+
};
|
|
1202
|
+
var CommandInput = forwardRef(
|
|
1203
|
+
({
|
|
1204
|
+
className,
|
|
1205
|
+
value,
|
|
1206
|
+
onValueChange,
|
|
1207
|
+
area,
|
|
1208
|
+
setArea,
|
|
1209
|
+
isFetching,
|
|
1210
|
+
onBack,
|
|
1211
|
+
...props
|
|
1212
|
+
}, ref) => {
|
|
1213
|
+
const { t: t2 } = useTranslation3();
|
|
1214
|
+
const innerRef = useRef(null);
|
|
1215
|
+
const direction = useDocumentDirection();
|
|
1216
|
+
useImperativeHandle(
|
|
1217
|
+
ref,
|
|
1218
|
+
() => innerRef.current
|
|
1219
|
+
);
|
|
1220
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col border-b", children: [
|
|
1221
|
+
/* @__PURE__ */ jsx4("div", { className: "px-4 pt-4", children: /* @__PURE__ */ jsxs(DropdownMenu, { dir: direction, children: [
|
|
1222
|
+
/* @__PURE__ */ jsx4(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1223
|
+
Badge,
|
|
1224
|
+
{
|
|
1225
|
+
size: "2xsmall",
|
|
1226
|
+
className: "hover:bg-ui-bg-base-pressed transition-fg cursor-pointer",
|
|
1227
|
+
children: [
|
|
1228
|
+
t2(`app.search.groups.${area}`),
|
|
1229
|
+
/* @__PURE__ */ jsx4(TriangleDownMini, { className: "text-ui-fg-muted" })
|
|
1230
|
+
]
|
|
1231
|
+
}
|
|
1232
|
+
) }),
|
|
1233
|
+
/* @__PURE__ */ jsx4(
|
|
1234
|
+
DropdownMenu.Content,
|
|
1235
|
+
{
|
|
1236
|
+
align: "start",
|
|
1237
|
+
className: "h-full max-h-[360px] overflow-auto",
|
|
1238
|
+
onCloseAutoFocus: (e) => {
|
|
1239
|
+
e.preventDefault();
|
|
1240
|
+
innerRef.current?.focus();
|
|
1241
|
+
},
|
|
1242
|
+
children: /* @__PURE__ */ jsx4(
|
|
1243
|
+
DropdownMenu.RadioGroup,
|
|
1244
|
+
{
|
|
1245
|
+
value: area,
|
|
1246
|
+
onValueChange: (v) => setArea(v),
|
|
1247
|
+
children: SEARCH_AREAS.map((area2) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1248
|
+
area2 === "command" && /* @__PURE__ */ jsx4(DropdownMenu.Separator, {}),
|
|
1249
|
+
/* @__PURE__ */ jsx4(DropdownMenu.RadioItem, { value: area2, children: t2(`app.search.groups.${area2}`) }),
|
|
1250
|
+
area2 === "all" && /* @__PURE__ */ jsx4(DropdownMenu.Separator, {})
|
|
1251
|
+
] }, area2))
|
|
1252
|
+
}
|
|
1253
|
+
)
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
] }) }),
|
|
1257
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-2 px-4 py-3", children: [
|
|
1258
|
+
onBack && /* @__PURE__ */ jsx4(
|
|
1259
|
+
IconButton,
|
|
1260
|
+
{
|
|
1261
|
+
type: "button",
|
|
1262
|
+
size: "small",
|
|
1263
|
+
variant: "transparent",
|
|
1264
|
+
onClick: onBack,
|
|
1265
|
+
children: /* @__PURE__ */ jsx4(ArrowUturnLeft, { className: "text-ui-fg-muted" })
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
/* @__PURE__ */ jsx4(
|
|
1269
|
+
Command.Input,
|
|
1270
|
+
{
|
|
1271
|
+
ref: innerRef,
|
|
1272
|
+
value,
|
|
1273
|
+
onValueChange,
|
|
1274
|
+
className: clx(
|
|
1275
|
+
"placeholder:text-ui-fg-muted flex !h-6 w-full rounded-md bg-transparent text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
1276
|
+
className
|
|
1277
|
+
),
|
|
1278
|
+
...props
|
|
1279
|
+
}
|
|
1280
|
+
),
|
|
1281
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute end-4 top-1/2 flex -translate-y-1/2 items-center justify-end gap-x-2", children: [
|
|
1282
|
+
isFetching && /* @__PURE__ */ jsx4(Spinner, { className: "text-ui-fg-muted animate-spin" }),
|
|
1283
|
+
value && /* @__PURE__ */ jsx4(
|
|
1284
|
+
Button,
|
|
1285
|
+
{
|
|
1286
|
+
variant: "transparent",
|
|
1287
|
+
size: "small",
|
|
1288
|
+
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
1289
|
+
type: "button",
|
|
1290
|
+
onClick: () => {
|
|
1291
|
+
onValueChange?.("");
|
|
1292
|
+
innerRef.current?.focus();
|
|
1293
|
+
},
|
|
1294
|
+
children: t2("actions.clear")
|
|
1295
|
+
}
|
|
1296
|
+
)
|
|
1297
|
+
] })
|
|
1298
|
+
] })
|
|
1299
|
+
] });
|
|
1300
|
+
}
|
|
1301
|
+
);
|
|
1302
|
+
CommandInput.displayName = Command.Input.displayName;
|
|
1303
|
+
var CommandList = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
1304
|
+
Command.List,
|
|
1305
|
+
{
|
|
1306
|
+
ref,
|
|
1307
|
+
className: clx(
|
|
1308
|
+
"max-h-[300px] flex-1 overflow-y-auto overflow-x-hidden px-2 pb-4",
|
|
1309
|
+
className
|
|
1310
|
+
),
|
|
1311
|
+
...props
|
|
1312
|
+
}
|
|
1313
|
+
));
|
|
1314
|
+
CommandList.displayName = Command.List.displayName;
|
|
1315
|
+
var CommandEmpty = forwardRef((props, ref) => {
|
|
1316
|
+
const { t: t2 } = useTranslation3();
|
|
1317
|
+
return /* @__PURE__ */ jsx4(Command.Empty, { ref, className: "py-6 text-center text-sm", ...props, children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex min-h-[236px] flex-col items-center justify-center gap-y-3", children: [
|
|
1318
|
+
/* @__PURE__ */ jsx4(MagnifyingGlass, { className: "text-ui-fg-subtle" }),
|
|
1319
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
1320
|
+
/* @__PURE__ */ jsx4(Text, { size: "small", weight: "plus", leading: "compact", children: props.q ? t2("app.search.noResultsTitle") : t2("app.search.emptySearchTitle") }),
|
|
1321
|
+
/* @__PURE__ */ jsx4(Text, { size: "small", className: "text-ui-fg-muted", children: props.q ? t2("app.search.noResultsMessage") : t2("app.search.emptySearchMessage") })
|
|
1322
|
+
] })
|
|
1323
|
+
] }) });
|
|
1324
|
+
});
|
|
1325
|
+
CommandEmpty.displayName = Command.Empty.displayName;
|
|
1326
|
+
var CommandLoading = forwardRef((props, ref) => {
|
|
1327
|
+
return /* @__PURE__ */ jsxs(
|
|
1328
|
+
Command.Loading,
|
|
1329
|
+
{
|
|
1330
|
+
ref,
|
|
1331
|
+
...props,
|
|
1332
|
+
className: "bg-ui-bg-base flex flex-col",
|
|
1333
|
+
children: [
|
|
1334
|
+
/* @__PURE__ */ jsx4("div", { className: "w-full px-2 pb-1 pt-3", children: /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-10" }) }),
|
|
1335
|
+
Array.from({ length: 7 }).map((_, index) => /* @__PURE__ */ jsx4("div", { className: "w-full p-2", children: /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-full" }) }, index))
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
);
|
|
1339
|
+
});
|
|
1340
|
+
CommandLoading.displayName = Command.Loading.displayName;
|
|
1341
|
+
var CommandGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
1342
|
+
Command.Group,
|
|
1343
|
+
{
|
|
1344
|
+
ref,
|
|
1345
|
+
className: clx(
|
|
1346
|
+
"text-ui-fg-base [&_[cmdk-group-heading]]:text-ui-fg-muted [&_[cmdk-group-heading]]:txt-compact-xsmall-plus overflow-hidden [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-item]]:py-2",
|
|
1347
|
+
className
|
|
1348
|
+
),
|
|
1349
|
+
...props
|
|
1350
|
+
}
|
|
1351
|
+
));
|
|
1352
|
+
CommandGroup.displayName = Command.Group.displayName;
|
|
1353
|
+
var CommandSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
1354
|
+
Command.Separator,
|
|
1355
|
+
{
|
|
1356
|
+
ref,
|
|
1357
|
+
className: clx("bg-border -mx-1 h-px", className),
|
|
1358
|
+
...props
|
|
1359
|
+
}
|
|
1360
|
+
));
|
|
1361
|
+
CommandSeparator.displayName = Command.Separator.displayName;
|
|
1362
|
+
var CommandItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
1363
|
+
Command.Item,
|
|
1364
|
+
{
|
|
1365
|
+
ref,
|
|
1366
|
+
className: clx(
|
|
1367
|
+
"aria-selected:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-hover txt-compact-small [&>svg]:text-ui-fg-subtle relative flex cursor-pointer select-none items-center gap-x-3 rounded-md p-2 outline-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
1368
|
+
className
|
|
1369
|
+
),
|
|
1370
|
+
...props
|
|
1371
|
+
}
|
|
1372
|
+
));
|
|
1373
|
+
CommandItem.displayName = Command.Item.displayName;
|
|
1374
|
+
|
|
1375
|
+
// src/providers/search-provider/search-context.tsx
|
|
1376
|
+
import { createContext as createContext4 } from "react";
|
|
1377
|
+
var SearchContext = createContext4(null);
|
|
1378
|
+
|
|
1379
|
+
// src/providers/search-provider/search-provider.tsx
|
|
1380
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1381
|
+
var SearchProvider = ({ children }) => {
|
|
1382
|
+
const [open, setOpen] = useState7(false);
|
|
1383
|
+
const { mobile, toggle } = useSidebar();
|
|
1384
|
+
const toggleSearch = () => {
|
|
1385
|
+
const update = !open;
|
|
1386
|
+
if (update && mobile) {
|
|
1387
|
+
toggle("mobile");
|
|
1388
|
+
}
|
|
1389
|
+
setOpen(update);
|
|
1390
|
+
};
|
|
1391
|
+
useEffect6(() => {
|
|
1392
|
+
const onKeyDown = (e) => {
|
|
1393
|
+
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
1394
|
+
setOpen((prev) => !prev);
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1398
|
+
return () => {
|
|
1399
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1400
|
+
};
|
|
1401
|
+
}, []);
|
|
1402
|
+
return /* @__PURE__ */ jsxs2(
|
|
1403
|
+
SearchContext.Provider,
|
|
1404
|
+
{
|
|
1405
|
+
value: {
|
|
1406
|
+
open,
|
|
1407
|
+
onOpenChange: setOpen,
|
|
1408
|
+
toggleSearch
|
|
1409
|
+
},
|
|
1410
|
+
children: [
|
|
1411
|
+
children,
|
|
1412
|
+
/* @__PURE__ */ jsx5(Search, {})
|
|
1413
|
+
]
|
|
1414
|
+
}
|
|
1415
|
+
);
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
// src/providers/search-provider/use-search.tsx
|
|
1419
|
+
import { useContext as useContext4 } from "react";
|
|
1420
|
+
var useSearch = () => {
|
|
1421
|
+
const context = useContext4(SearchContext);
|
|
1422
|
+
if (!context) {
|
|
1423
|
+
throw new Error("useSearch must be used within a SearchProvider");
|
|
1424
|
+
}
|
|
1425
|
+
return context;
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
// src/app.tsx
|
|
1429
|
+
import { I18nProvider, Toaster, TooltipProvider } from "@medusajs/ui";
|
|
1430
|
+
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
1431
|
+
|
|
1432
|
+
// src/get-route-map.tsx
|
|
1433
|
+
import { t } from "i18next";
|
|
1434
|
+
import { Outlet as Outlet4 } from "react-router-dom";
|
|
1435
|
+
|
|
1436
|
+
// src/components/authentication/protected-route/protected-route.tsx
|
|
1437
|
+
import { Spinner as Spinner2 } from "@medusajs/icons";
|
|
1438
|
+
import { Navigate, Outlet, useLocation as useLocation3 } from "react-router-dom";
|
|
1439
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1440
|
+
var ProtectedRoute = () => {
|
|
1441
|
+
const { seller, isLoading } = useMe();
|
|
1442
|
+
const location = useLocation3();
|
|
1443
|
+
if (isLoading) {
|
|
1444
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsx6(Spinner2, { className: "text-ui-fg-interactive animate-spin" }) });
|
|
1445
|
+
}
|
|
1446
|
+
if (!seller) {
|
|
1447
|
+
return /* @__PURE__ */ jsx6(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
1448
|
+
}
|
|
1449
|
+
return /* @__PURE__ */ jsx6(SidebarProvider, { children: /* @__PURE__ */ jsx6(SearchProvider, { children: /* @__PURE__ */ jsx6(Outlet, {}) }) });
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
// src/components/layout/main-layout/main-layout.tsx
|
|
1453
|
+
import {
|
|
1454
|
+
BuildingStorefront,
|
|
1455
|
+
Buildings,
|
|
1456
|
+
CogSixTooth,
|
|
1457
|
+
CurrencyDollar,
|
|
1458
|
+
CreditCardRefresh,
|
|
1459
|
+
EllipsisHorizontal as EllipsisHorizontal2,
|
|
1460
|
+
MagnifyingGlass as MagnifyingGlass2,
|
|
1461
|
+
OpenRectArrowOut as OpenRectArrowOut2,
|
|
1462
|
+
ReceiptPercent,
|
|
1463
|
+
ShoppingCart,
|
|
1464
|
+
Tag,
|
|
1465
|
+
Users
|
|
1466
|
+
} from "@medusajs/icons";
|
|
1467
|
+
import { Avatar as Avatar2, Divider, DropdownMenu as DropdownMenu3, Text as Text5, clx as clx5 } from "@medusajs/ui";
|
|
1468
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1469
|
+
|
|
1470
|
+
// src/components/layout/nav-item/nav-item.tsx
|
|
1471
|
+
import { Kbd as Kbd2, Text as Text2, clx as clx2 } from "@medusajs/ui";
|
|
1472
|
+
import { Collapsible as RadixCollapsible } from "radix-ui";
|
|
1473
|
+
import {
|
|
1474
|
+
useCallback as useCallback5,
|
|
1475
|
+
useEffect as useEffect7,
|
|
1476
|
+
useState as useState8
|
|
1477
|
+
} from "react";
|
|
1478
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
1479
|
+
import { NavLink, useLocation as useLocation4 } from "react-router-dom";
|
|
1480
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1481
|
+
var BASE_NAV_LINK_CLASSES = "text-ui-fg-subtle transition-fg hover:bg-ui-bg-subtle-hover flex items-center gap-x-2 rounded-md py-0.5 pl-0.5 pr-2 outline-none [&>svg]:text-ui-fg-subtle focus-visible:shadow-borders-focus";
|
|
1482
|
+
var ACTIVE_NAV_LINK_CLASSES = "bg-ui-bg-base shadow-elevation-card-rest text-ui-fg-base hover:bg-ui-bg-base";
|
|
1483
|
+
var NESTED_NAV_LINK_CLASSES = "pl-[34px] pr-2 py-1 w-full text-ui-fg-muted";
|
|
1484
|
+
var SETTING_NAV_LINK_CLASSES = "pl-2 py-1";
|
|
1485
|
+
var getIsOpen = (to, items, pathname) => {
|
|
1486
|
+
return [to, ...items?.map((i) => i.to) ?? []].some(
|
|
1487
|
+
(p) => pathname.startsWith(p)
|
|
1488
|
+
);
|
|
1489
|
+
};
|
|
1490
|
+
var NavItemTooltip = ({
|
|
1491
|
+
to,
|
|
1492
|
+
children
|
|
1493
|
+
}) => {
|
|
1494
|
+
const { t: t2 } = useTranslation4();
|
|
1495
|
+
const globalShortcuts = useGlobalShortcuts();
|
|
1496
|
+
const shortcut = globalShortcuts.find((s) => s.to === to);
|
|
1497
|
+
return /* @__PURE__ */ jsx7(
|
|
1498
|
+
ConditionalTooltip,
|
|
1499
|
+
{
|
|
1500
|
+
showTooltip: !!shortcut,
|
|
1501
|
+
maxWidth: 9999,
|
|
1502
|
+
content: /* @__PURE__ */ jsxs3("div", { className: "txt-compact-xsmall flex h-5 items-center justify-between gap-x-2 whitespace-nowrap", children: [
|
|
1503
|
+
/* @__PURE__ */ jsx7("span", { children: shortcut?.label }),
|
|
1504
|
+
/* @__PURE__ */ jsx7("div", { className: "flex items-center gap-x-1", children: shortcut?.keys.Mac?.map((key, index) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-1", children: [
|
|
1505
|
+
/* @__PURE__ */ jsx7(Kbd2, { children: key }, key),
|
|
1506
|
+
index < (shortcut.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx7("span", { className: "text-ui-fg-muted txt-compact-xsmall", children: t2("app.keyboardShortcuts.then") })
|
|
1507
|
+
] }, index)) })
|
|
1508
|
+
] }),
|
|
1509
|
+
side: "right",
|
|
1510
|
+
delayDuration: 1500,
|
|
1511
|
+
children: /* @__PURE__ */ jsx7("div", { className: "w-full", children })
|
|
1512
|
+
}
|
|
1513
|
+
);
|
|
1514
|
+
};
|
|
1515
|
+
var NavItem = ({
|
|
1516
|
+
icon,
|
|
1517
|
+
label,
|
|
1518
|
+
to,
|
|
1519
|
+
items,
|
|
1520
|
+
type = "core",
|
|
1521
|
+
from,
|
|
1522
|
+
translationNs
|
|
1523
|
+
}) => {
|
|
1524
|
+
const { t: t2 } = useTranslation4(translationNs);
|
|
1525
|
+
const { pathname } = useLocation4();
|
|
1526
|
+
const [open, setOpen] = useState8(getIsOpen(to, items, pathname));
|
|
1527
|
+
const displayLabel = translationNs ? t2(label) : label;
|
|
1528
|
+
useEffect7(() => {
|
|
1529
|
+
setOpen(getIsOpen(to, items, pathname));
|
|
1530
|
+
}, [pathname, to, items]);
|
|
1531
|
+
const navLinkClassNames = useCallback5(
|
|
1532
|
+
({
|
|
1533
|
+
to: to2,
|
|
1534
|
+
isActive,
|
|
1535
|
+
isNested = false,
|
|
1536
|
+
isSetting: isSetting2 = false
|
|
1537
|
+
}) => {
|
|
1538
|
+
if (["core", "setting"].includes(type)) {
|
|
1539
|
+
isActive = pathname.startsWith(to2);
|
|
1540
|
+
}
|
|
1541
|
+
return clx2(BASE_NAV_LINK_CLASSES, {
|
|
1542
|
+
[NESTED_NAV_LINK_CLASSES]: isNested,
|
|
1543
|
+
[ACTIVE_NAV_LINK_CLASSES]: isActive,
|
|
1544
|
+
[SETTING_NAV_LINK_CLASSES]: isSetting2
|
|
1545
|
+
});
|
|
1546
|
+
},
|
|
1547
|
+
[type, pathname]
|
|
1548
|
+
);
|
|
1549
|
+
const isSetting = type === "setting";
|
|
1550
|
+
return /* @__PURE__ */ jsxs3("div", { className: "px-3", children: [
|
|
1551
|
+
/* @__PURE__ */ jsx7(NavItemTooltip, { to, children: /* @__PURE__ */ jsxs3(
|
|
1552
|
+
NavLink,
|
|
1553
|
+
{
|
|
1554
|
+
to,
|
|
1555
|
+
end: items?.some((i) => i.to === pathname),
|
|
1556
|
+
state: from ? {
|
|
1557
|
+
from
|
|
1558
|
+
} : void 0,
|
|
1559
|
+
className: ({ isActive }) => {
|
|
1560
|
+
return clx2(navLinkClassNames({ isActive, isSetting, to }), {
|
|
1561
|
+
"max-lg:hidden": !!items?.length
|
|
1562
|
+
});
|
|
1563
|
+
},
|
|
1564
|
+
children: [
|
|
1565
|
+
type !== "setting" && /* @__PURE__ */ jsx7("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
|
|
1566
|
+
/* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: displayLabel })
|
|
1567
|
+
]
|
|
1568
|
+
}
|
|
1569
|
+
) }),
|
|
1570
|
+
items && items.length > 0 && /* @__PURE__ */ jsxs3(RadixCollapsible.Root, { open, onOpenChange: setOpen, children: [
|
|
1571
|
+
/* @__PURE__ */ jsxs3(
|
|
1572
|
+
RadixCollapsible.Trigger,
|
|
1573
|
+
{
|
|
1574
|
+
className: clx2(
|
|
1575
|
+
"text-ui-fg-subtle hover:text-ui-fg-base transition-fg hover:bg-ui-bg-subtle-hover flex w-full items-center gap-x-2 rounded-md py-0.5 pl-0.5 pr-2 outline-none lg:hidden",
|
|
1576
|
+
{ "pl-2": isSetting }
|
|
1577
|
+
),
|
|
1578
|
+
children: [
|
|
1579
|
+
/* @__PURE__ */ jsx7("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
|
|
1580
|
+
/* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: displayLabel })
|
|
1581
|
+
]
|
|
1582
|
+
}
|
|
1583
|
+
),
|
|
1584
|
+
/* @__PURE__ */ jsx7(RadixCollapsible.Content, { children: /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-y-0.5 pb-2 pt-0.5", children: /* @__PURE__ */ jsxs3("ul", { className: "flex flex-col gap-y-0.5", children: [
|
|
1585
|
+
/* @__PURE__ */ jsx7("li", { className: "flex w-full items-center gap-x-1 lg:hidden", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to, children: /* @__PURE__ */ jsx7(
|
|
1586
|
+
NavLink,
|
|
1587
|
+
{
|
|
1588
|
+
to,
|
|
1589
|
+
end: true,
|
|
1590
|
+
className: ({ isActive }) => {
|
|
1591
|
+
return clx2(
|
|
1592
|
+
navLinkClassNames({
|
|
1593
|
+
to,
|
|
1594
|
+
isActive,
|
|
1595
|
+
isSetting,
|
|
1596
|
+
isNested: true
|
|
1597
|
+
})
|
|
1598
|
+
);
|
|
1599
|
+
},
|
|
1600
|
+
children: /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: displayLabel })
|
|
1601
|
+
}
|
|
1602
|
+
) }) }),
|
|
1603
|
+
items.map((item) => {
|
|
1604
|
+
const { t: itemT } = useTranslation4(item.translationNs);
|
|
1605
|
+
const itemLabel = item.translationNs ? itemT(item.label) : item.label;
|
|
1606
|
+
return /* @__PURE__ */ jsx7("li", { className: "flex h-7 items-center", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to: item.to, children: /* @__PURE__ */ jsx7(
|
|
1607
|
+
NavLink,
|
|
1608
|
+
{
|
|
1609
|
+
to: item.to,
|
|
1610
|
+
end: true,
|
|
1611
|
+
className: ({ isActive }) => {
|
|
1612
|
+
return clx2(
|
|
1613
|
+
navLinkClassNames({
|
|
1614
|
+
to: item.to,
|
|
1615
|
+
isActive,
|
|
1616
|
+
isSetting,
|
|
1617
|
+
isNested: true
|
|
1618
|
+
})
|
|
1619
|
+
);
|
|
1620
|
+
},
|
|
1621
|
+
children: /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: itemLabel })
|
|
1622
|
+
}
|
|
1623
|
+
) }) }, item.to);
|
|
1624
|
+
})
|
|
1625
|
+
] }) }) })
|
|
1626
|
+
] })
|
|
1627
|
+
] });
|
|
1628
|
+
};
|
|
1629
|
+
var Icon = ({ icon, type }) => {
|
|
1630
|
+
if (!icon) {
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
return type === "extension" ? /* @__PURE__ */ jsx7("div", { className: "shadow-borders-base bg-ui-bg-base flex h-5 w-5 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx7("div", { className: "h-[15px] w-[15px] overflow-hidden rounded-sm", children: icon }) }) : icon;
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1636
|
+
// src/components/layout/shell/shell.tsx
|
|
1637
|
+
import { SidebarLeft, TriangleRightMini, XMark } from "@medusajs/icons";
|
|
1638
|
+
import { IconButton as IconButton2, clx as clx3 } from "@medusajs/ui";
|
|
1639
|
+
import { AnimatePresence } from "motion/react";
|
|
1640
|
+
import { Dialog as RadixDialog2 } from "radix-ui";
|
|
1641
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
1642
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1643
|
+
import {
|
|
1644
|
+
Link,
|
|
1645
|
+
Outlet as Outlet2,
|
|
1646
|
+
useMatches,
|
|
1647
|
+
useNavigation
|
|
1648
|
+
} from "react-router-dom";
|
|
1649
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1650
|
+
var Shell = ({ children }) => {
|
|
1651
|
+
const globalShortcuts = useGlobalShortcuts();
|
|
1652
|
+
const navigation = useNavigation();
|
|
1653
|
+
const loading = navigation.state === "loading";
|
|
1654
|
+
return /* @__PURE__ */ jsx8(KeybindProvider, { shortcuts: globalShortcuts, children: /* @__PURE__ */ jsxs4("div", { className: "relative flex h-screen flex-col items-start overflow-hidden lg:flex-row", children: [
|
|
1655
|
+
/* @__PURE__ */ jsx8(NavigationBar, { loading }),
|
|
1656
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1657
|
+
/* @__PURE__ */ jsx8(MobileSidebarContainer, { children }),
|
|
1658
|
+
/* @__PURE__ */ jsx8(DesktopSidebarContainer, { children })
|
|
1659
|
+
] }),
|
|
1660
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex h-screen w-full flex-col overflow-auto", children: [
|
|
1661
|
+
/* @__PURE__ */ jsx8(Topbar, {}),
|
|
1662
|
+
/* @__PURE__ */ jsx8(
|
|
1663
|
+
"main",
|
|
1664
|
+
{
|
|
1665
|
+
className: clx3(
|
|
1666
|
+
"flex h-full w-full flex-col items-center overflow-y-auto transition-opacity delay-200 duration-200",
|
|
1667
|
+
{
|
|
1668
|
+
"opacity-25": loading
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1671
|
+
children: /* @__PURE__ */ jsx8(Gutter, { children: /* @__PURE__ */ jsx8(Outlet2, {}) })
|
|
1672
|
+
}
|
|
1673
|
+
)
|
|
1674
|
+
] })
|
|
1675
|
+
] }) });
|
|
1676
|
+
};
|
|
1677
|
+
var NavigationBar = ({ loading }) => {
|
|
1678
|
+
const [showBar, setShowBar] = useState9(false);
|
|
1679
|
+
useEffect8(() => {
|
|
1680
|
+
let timeout;
|
|
1681
|
+
if (loading) {
|
|
1682
|
+
timeout = setTimeout(() => {
|
|
1683
|
+
setShowBar(true);
|
|
1684
|
+
}, 200);
|
|
1685
|
+
} else {
|
|
1686
|
+
setShowBar(false);
|
|
1687
|
+
}
|
|
1688
|
+
return () => {
|
|
1689
|
+
clearTimeout(timeout);
|
|
1690
|
+
};
|
|
1691
|
+
}, [loading]);
|
|
1692
|
+
return /* @__PURE__ */ jsx8("div", { className: "fixed inset-x-0 top-0 z-50 h-1", children: /* @__PURE__ */ jsx8(AnimatePresence, { children: showBar ? /* @__PURE__ */ jsx8(ProgressBar, {}) : null }) });
|
|
1693
|
+
};
|
|
1694
|
+
var Gutter = ({ children }) => {
|
|
1695
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex w-full max-w-[1600px] flex-col gap-y-2 p-3", children });
|
|
1696
|
+
};
|
|
1697
|
+
var Breadcrumbs = () => {
|
|
1698
|
+
const matches = useMatches();
|
|
1699
|
+
const crumbs = matches.filter((match) => match.handle?.breadcrumb).map((match) => {
|
|
1700
|
+
const handle = match.handle;
|
|
1701
|
+
let label = void 0;
|
|
1702
|
+
try {
|
|
1703
|
+
label = handle.breadcrumb?.(match);
|
|
1704
|
+
} catch (error) {
|
|
1705
|
+
}
|
|
1706
|
+
if (!label) {
|
|
1707
|
+
return null;
|
|
1708
|
+
}
|
|
1709
|
+
return {
|
|
1710
|
+
label,
|
|
1711
|
+
path: match.pathname
|
|
1712
|
+
};
|
|
1713
|
+
}).filter(Boolean);
|
|
1714
|
+
return /* @__PURE__ */ jsx8(
|
|
1715
|
+
"ol",
|
|
1716
|
+
{
|
|
1717
|
+
className: clx3(
|
|
1718
|
+
"text-ui-fg-muted txt-compact-small-plus flex select-none items-center"
|
|
1719
|
+
),
|
|
1720
|
+
children: crumbs.map((crumb, index) => {
|
|
1721
|
+
const isLast = index === crumbs.length - 1;
|
|
1722
|
+
const isSingle = crumbs.length === 1;
|
|
1723
|
+
return /* @__PURE__ */ jsxs4("li", { className: clx3("flex items-center"), children: [
|
|
1724
|
+
!isLast ? /* @__PURE__ */ jsx8(
|
|
1725
|
+
Link,
|
|
1726
|
+
{
|
|
1727
|
+
className: "transition-fg hover:text-ui-fg-subtle",
|
|
1728
|
+
to: crumb.path,
|
|
1729
|
+
children: crumb.label
|
|
1730
|
+
}
|
|
1731
|
+
) : /* @__PURE__ */ jsxs4("div", { children: [
|
|
1732
|
+
!isSingle && /* @__PURE__ */ jsx8("span", { className: "block lg:hidden", children: "..." }),
|
|
1733
|
+
/* @__PURE__ */ jsx8(
|
|
1734
|
+
"span",
|
|
1735
|
+
{
|
|
1736
|
+
className: clx3({
|
|
1737
|
+
"hidden lg:block": !isSingle
|
|
1738
|
+
}),
|
|
1739
|
+
children: crumb.label
|
|
1740
|
+
},
|
|
1741
|
+
index
|
|
1742
|
+
)
|
|
1743
|
+
] }),
|
|
1744
|
+
!isLast && /* @__PURE__ */ jsx8("span", { className: "mx-2", children: /* @__PURE__ */ jsx8(TriangleRightMini, { className: "rtl:rotate-180" }) })
|
|
1745
|
+
] }, index);
|
|
1746
|
+
})
|
|
1747
|
+
}
|
|
1748
|
+
);
|
|
1749
|
+
};
|
|
1750
|
+
var ToggleSidebar = () => {
|
|
1751
|
+
const { toggle } = useSidebar();
|
|
1752
|
+
return /* @__PURE__ */ jsxs4("div", { children: [
|
|
1753
|
+
/* @__PURE__ */ jsx8(
|
|
1754
|
+
IconButton2,
|
|
1755
|
+
{
|
|
1756
|
+
className: "hidden lg:flex",
|
|
1757
|
+
variant: "transparent",
|
|
1758
|
+
onClick: () => toggle("desktop"),
|
|
1759
|
+
size: "small",
|
|
1760
|
+
children: /* @__PURE__ */ jsx8(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
|
|
1761
|
+
}
|
|
1762
|
+
),
|
|
1763
|
+
/* @__PURE__ */ jsx8(
|
|
1764
|
+
IconButton2,
|
|
1765
|
+
{
|
|
1766
|
+
className: "hidden max-lg:flex",
|
|
1767
|
+
variant: "transparent",
|
|
1768
|
+
onClick: () => toggle("mobile"),
|
|
1769
|
+
size: "small",
|
|
1770
|
+
children: /* @__PURE__ */ jsx8(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
|
|
1771
|
+
}
|
|
1772
|
+
)
|
|
1773
|
+
] });
|
|
1774
|
+
};
|
|
1775
|
+
var Topbar = () => {
|
|
1776
|
+
return /* @__PURE__ */ jsxs4("div", { className: "grid w-full grid-cols-2 border-b p-3", children: [
|
|
1777
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-1.5", children: [
|
|
1778
|
+
/* @__PURE__ */ jsx8(ToggleSidebar, {}),
|
|
1779
|
+
/* @__PURE__ */ jsx8(Breadcrumbs, {})
|
|
1780
|
+
] }),
|
|
1781
|
+
/* @__PURE__ */ jsx8("div", { className: "flex items-center justify-end gap-x-3" })
|
|
1782
|
+
] });
|
|
1783
|
+
};
|
|
1784
|
+
var DesktopSidebarContainer = ({ children }) => {
|
|
1785
|
+
const { desktop } = useSidebar();
|
|
1786
|
+
return /* @__PURE__ */ jsx8(
|
|
1787
|
+
"div",
|
|
1788
|
+
{
|
|
1789
|
+
className: clx3("hidden h-screen w-[220px] border-e", {
|
|
1790
|
+
"lg:flex": desktop
|
|
1791
|
+
}),
|
|
1792
|
+
children
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
};
|
|
1796
|
+
var MobileSidebarContainer = ({ children }) => {
|
|
1797
|
+
const { t: t2 } = useTranslation5();
|
|
1798
|
+
const { mobile, toggle } = useSidebar();
|
|
1799
|
+
return /* @__PURE__ */ jsx8(RadixDialog2.Root, { open: mobile, onOpenChange: () => toggle("mobile"), children: /* @__PURE__ */ jsxs4(RadixDialog2.Portal, { children: [
|
|
1800
|
+
/* @__PURE__ */ jsx8(
|
|
1801
|
+
RadixDialog2.Overlay,
|
|
1802
|
+
{
|
|
1803
|
+
className: clx3(
|
|
1804
|
+
"bg-ui-bg-overlay fixed inset-0",
|
|
1805
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
1806
|
+
)
|
|
1807
|
+
}
|
|
1808
|
+
),
|
|
1809
|
+
/* @__PURE__ */ jsxs4(
|
|
1810
|
+
RadixDialog2.Content,
|
|
1811
|
+
{
|
|
1812
|
+
className: clx3(
|
|
1813
|
+
"bg-ui-bg-subtle shadow-elevation-modal fixed inset-y-2 start-2 flex w-full max-w-[304px] flex-col overflow-hidden rounded-lg border-r",
|
|
1814
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-start-1/2 data-[state=open]:slide-in-from-start-1/2 duration-200"
|
|
1815
|
+
),
|
|
1816
|
+
children: [
|
|
1817
|
+
/* @__PURE__ */ jsxs4("div", { className: "p-3", children: [
|
|
1818
|
+
/* @__PURE__ */ jsx8(RadixDialog2.Close, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1819
|
+
IconButton2,
|
|
1820
|
+
{
|
|
1821
|
+
size: "small",
|
|
1822
|
+
variant: "transparent",
|
|
1823
|
+
className: "text-ui-fg-subtle",
|
|
1824
|
+
children: /* @__PURE__ */ jsx8(XMark, {})
|
|
1825
|
+
}
|
|
1826
|
+
) }),
|
|
1827
|
+
/* @__PURE__ */ jsx8(RadixDialog2.Title, { className: "sr-only", children: t2("app.nav.accessibility.title") }),
|
|
1828
|
+
/* @__PURE__ */ jsx8(RadixDialog2.Description, { className: "sr-only", children: t2("app.nav.accessibility.description") })
|
|
1829
|
+
] }),
|
|
1830
|
+
children
|
|
1831
|
+
]
|
|
1832
|
+
}
|
|
1833
|
+
)
|
|
1834
|
+
] }) });
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1837
|
+
// src/components/layout/main-layout/main-layout.tsx
|
|
1838
|
+
import { Link as Link3, useLocation as useLocation7, useNavigate as useNavigate4 } from "react-router-dom";
|
|
1839
|
+
|
|
1840
|
+
// src/components/layout/user-menu/user-menu.tsx
|
|
1841
|
+
import {
|
|
1842
|
+
BookOpen,
|
|
1843
|
+
CircleHalfSolid,
|
|
1844
|
+
EllipsisHorizontal,
|
|
1845
|
+
Keyboard,
|
|
1846
|
+
OpenRectArrowOut,
|
|
1847
|
+
TimelineVertical,
|
|
1848
|
+
User as UserIcon,
|
|
1849
|
+
XMark as XMark2
|
|
1850
|
+
} from "@medusajs/icons";
|
|
1851
|
+
import {
|
|
1852
|
+
Avatar,
|
|
1853
|
+
DropdownMenu as DropdownMenu2,
|
|
1854
|
+
Heading,
|
|
1855
|
+
IconButton as IconButton3,
|
|
1856
|
+
Input,
|
|
1857
|
+
Kbd as Kbd3,
|
|
1858
|
+
Text as Text3,
|
|
1859
|
+
clx as clx4
|
|
1860
|
+
} from "@medusajs/ui";
|
|
1861
|
+
import { Dialog as RadixDialog3 } from "radix-ui";
|
|
1862
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
1863
|
+
import { useState as useState10 } from "react";
|
|
1864
|
+
import { Link as Link2, useLocation as useLocation5, useNavigate as useNavigate3 } from "react-router-dom";
|
|
1865
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1866
|
+
var ThemeToggle = () => {
|
|
1867
|
+
const { t: t2 } = useTranslation6();
|
|
1868
|
+
const { theme, setTheme } = useTheme();
|
|
1869
|
+
return /* @__PURE__ */ jsxs5(DropdownMenu2.SubMenu, { children: [
|
|
1870
|
+
/* @__PURE__ */ jsxs5(
|
|
1871
|
+
DropdownMenu2.SubMenuTrigger,
|
|
1872
|
+
{
|
|
1873
|
+
dir: "ltr",
|
|
1874
|
+
className: "rounded-md rtl:rotate-180",
|
|
1875
|
+
children: [
|
|
1876
|
+
/* @__PURE__ */ jsx9(CircleHalfSolid, { className: "text-ui-fg-subtle me-2" }),
|
|
1877
|
+
/* @__PURE__ */ jsx9("span", { className: "rtl:rotate-180", children: t2("app.menus.user.theme.label") })
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
),
|
|
1881
|
+
/* @__PURE__ */ jsx9(DropdownMenu2.SubMenuContent, { children: /* @__PURE__ */ jsxs5(DropdownMenu2.RadioGroup, { value: theme, children: [
|
|
1882
|
+
/* @__PURE__ */ jsx9(
|
|
1883
|
+
DropdownMenu2.RadioItem,
|
|
1884
|
+
{
|
|
1885
|
+
value: "system",
|
|
1886
|
+
onClick: (e) => {
|
|
1887
|
+
e.preventDefault();
|
|
1888
|
+
setTheme("system");
|
|
1889
|
+
},
|
|
1890
|
+
children: t2("app.menus.user.theme.system")
|
|
1891
|
+
}
|
|
1892
|
+
),
|
|
1893
|
+
/* @__PURE__ */ jsx9(
|
|
1894
|
+
DropdownMenu2.RadioItem,
|
|
1895
|
+
{
|
|
1896
|
+
value: "light",
|
|
1897
|
+
onClick: (e) => {
|
|
1898
|
+
e.preventDefault();
|
|
1899
|
+
setTheme("light");
|
|
1900
|
+
},
|
|
1901
|
+
children: t2("app.menus.user.theme.light")
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
/* @__PURE__ */ jsx9(
|
|
1905
|
+
DropdownMenu2.RadioItem,
|
|
1906
|
+
{
|
|
1907
|
+
value: "dark",
|
|
1908
|
+
onClick: (e) => {
|
|
1909
|
+
e.preventDefault();
|
|
1910
|
+
setTheme("dark");
|
|
1911
|
+
},
|
|
1912
|
+
children: t2("app.menus.user.theme.dark")
|
|
1913
|
+
}
|
|
1914
|
+
)
|
|
1915
|
+
] }) })
|
|
1916
|
+
] });
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
// src/components/layout/main-layout/main-layout.tsx
|
|
1920
|
+
import components from "virtual:mercur/components";
|
|
1921
|
+
import menuItemsModule from "virtual:mercur/menu-items";
|
|
1922
|
+
|
|
1923
|
+
// src/components/utilities/error-boundary/error-boundary.tsx
|
|
1924
|
+
import { ExclamationCircle } from "@medusajs/icons";
|
|
1925
|
+
import { Text as Text4 } from "@medusajs/ui";
|
|
1926
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1927
|
+
import { Navigate as Navigate2, useLocation as useLocation6, useRouteError } from "react-router-dom";
|
|
1928
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1929
|
+
var ErrorBoundary = () => {
|
|
1930
|
+
const error = useRouteError();
|
|
1931
|
+
const location = useLocation6();
|
|
1932
|
+
const { t: t2 } = useTranslation7();
|
|
1933
|
+
let code = null;
|
|
1934
|
+
if (isClientError(error)) {
|
|
1935
|
+
if (error.status === 401) {
|
|
1936
|
+
return /* @__PURE__ */ jsx10(Navigate2, { to: "/login", state: { from: location }, replace: true });
|
|
1937
|
+
}
|
|
1938
|
+
code = error.status ?? null;
|
|
1939
|
+
}
|
|
1940
|
+
if (process.env.NODE_ENV === "development") {
|
|
1941
|
+
console.error(error);
|
|
1942
|
+
}
|
|
1943
|
+
let title;
|
|
1944
|
+
let message;
|
|
1945
|
+
switch (code) {
|
|
1946
|
+
case 400:
|
|
1947
|
+
title = t2("errorBoundary.badRequestTitle");
|
|
1948
|
+
message = t2("errorBoundary.badRequestMessage");
|
|
1949
|
+
break;
|
|
1950
|
+
case 404:
|
|
1951
|
+
title = t2("errorBoundary.notFoundTitle");
|
|
1952
|
+
message = t2("errorBoundary.notFoundMessage");
|
|
1953
|
+
break;
|
|
1954
|
+
case 500:
|
|
1955
|
+
title = t2("errorBoundary.internalServerErrorTitle");
|
|
1956
|
+
message = t2("errorBoundary.internalServerErrorMessage");
|
|
1957
|
+
break;
|
|
1958
|
+
default:
|
|
1959
|
+
title = t2("errorBoundary.defaultTitle");
|
|
1960
|
+
message = t2("errorBoundary.defaultMessage");
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex size-full min-h-[calc(100vh-57px-24px)] items-center justify-center", children: /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxs6("div", { className: "text-ui-fg-subtle flex flex-col items-center gap-y-3", children: [
|
|
1964
|
+
/* @__PURE__ */ jsx10(ExclamationCircle, {}),
|
|
1965
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
1966
|
+
/* @__PURE__ */ jsx10(Text4, { size: "small", leading: "compact", weight: "plus", children: title }),
|
|
1967
|
+
/* @__PURE__ */ jsx10(
|
|
1968
|
+
Text4,
|
|
1969
|
+
{
|
|
1970
|
+
size: "small",
|
|
1971
|
+
className: "text-ui-fg-muted text-balance text-center",
|
|
1972
|
+
children: message
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1975
|
+
] })
|
|
1976
|
+
] }) }) });
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
// src/utils/routes.ts
|
|
1980
|
+
var createBranchRoute = (segment) => ({
|
|
1981
|
+
path: segment,
|
|
1982
|
+
children: []
|
|
1983
|
+
});
|
|
1984
|
+
var createLeafRoute = (Component, loader, handle, path = "") => ({
|
|
1985
|
+
path,
|
|
1986
|
+
ErrorBoundary,
|
|
1987
|
+
async lazy() {
|
|
1988
|
+
const result = { Component };
|
|
1989
|
+
if (loader) {
|
|
1990
|
+
result.loader = loader;
|
|
1991
|
+
}
|
|
1992
|
+
if (handle) {
|
|
1993
|
+
result.handle = handle;
|
|
1994
|
+
}
|
|
1995
|
+
return result;
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
var createParallelRoute = (path, Component, loader, handle) => ({
|
|
1999
|
+
path,
|
|
2000
|
+
async lazy() {
|
|
2001
|
+
const result = { Component };
|
|
2002
|
+
if (loader) {
|
|
2003
|
+
result.loader = loader;
|
|
2004
|
+
}
|
|
2005
|
+
if (handle) {
|
|
2006
|
+
result.handle = handle;
|
|
2007
|
+
}
|
|
2008
|
+
return result;
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
var processParallelRoutes = (parallelRoutes, currentFullPath) => {
|
|
2012
|
+
return parallelRoutes?.map(({ path, Component, loader, handle }) => {
|
|
2013
|
+
const childPath = path?.replace(currentFullPath, "").replace(/^\/+/, "");
|
|
2014
|
+
if (!childPath) {
|
|
2015
|
+
return null;
|
|
2016
|
+
}
|
|
2017
|
+
return createParallelRoute(childPath, Component, loader, handle);
|
|
2018
|
+
}).filter(Boolean);
|
|
2019
|
+
};
|
|
2020
|
+
var addRoute = (pathSegments, Component, currentLevel, loader, handle, parallelRoutes, fullPath, componentPath) => {
|
|
2021
|
+
if (!pathSegments.length) {
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
const [currentSegment, ...remainingSegments] = pathSegments;
|
|
2025
|
+
let route = currentLevel.find((r) => r.path === currentSegment);
|
|
2026
|
+
if (!route) {
|
|
2027
|
+
route = createBranchRoute(currentSegment);
|
|
2028
|
+
currentLevel.push(route);
|
|
2029
|
+
}
|
|
2030
|
+
const currentFullPath = fullPath ? `${fullPath}/${currentSegment}` : currentSegment;
|
|
2031
|
+
const isComponentSegment = currentFullPath === componentPath;
|
|
2032
|
+
if (isComponentSegment || remainingSegments.length === 0) {
|
|
2033
|
+
route.children || (route.children = []);
|
|
2034
|
+
if (handle) {
|
|
2035
|
+
route.handle = handle;
|
|
2036
|
+
}
|
|
2037
|
+
if (loader) {
|
|
2038
|
+
route.loader = loader;
|
|
2039
|
+
}
|
|
2040
|
+
if (currentSegment === "*?" || currentSegment === "*") {
|
|
2041
|
+
const leaf = createLeafRoute(Component, loader, handle, currentSegment);
|
|
2042
|
+
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
|
|
2043
|
+
Object.assign(route, leaf);
|
|
2044
|
+
} else {
|
|
2045
|
+
const leaf = createLeafRoute(Component, loader);
|
|
2046
|
+
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
|
|
2047
|
+
route.children.push(leaf);
|
|
2048
|
+
}
|
|
2049
|
+
if (remainingSegments.length > 0) {
|
|
2050
|
+
addRoute(
|
|
2051
|
+
remainingSegments,
|
|
2052
|
+
Component,
|
|
2053
|
+
route.children,
|
|
2054
|
+
void 0,
|
|
2055
|
+
void 0,
|
|
2056
|
+
void 0,
|
|
2057
|
+
currentFullPath
|
|
2058
|
+
);
|
|
2059
|
+
}
|
|
2060
|
+
} else {
|
|
2061
|
+
route.children || (route.children = []);
|
|
2062
|
+
addRoute(
|
|
2063
|
+
remainingSegments,
|
|
2064
|
+
Component,
|
|
2065
|
+
route.children,
|
|
2066
|
+
loader,
|
|
2067
|
+
handle,
|
|
2068
|
+
parallelRoutes,
|
|
2069
|
+
currentFullPath,
|
|
2070
|
+
componentPath
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
var createRouteMap = (routes, ignore) => {
|
|
2075
|
+
const root = [];
|
|
2076
|
+
routes.forEach(({ path, Component, loader, handle, children }) => {
|
|
2077
|
+
const cleanedPath = ignore ? path.replace(ignore, "").replace(/^\/+/, "") : path.replace(/^\/+/, "");
|
|
2078
|
+
const pathSegments = cleanedPath.split("/").filter(Boolean);
|
|
2079
|
+
addRoute(
|
|
2080
|
+
pathSegments,
|
|
2081
|
+
Component,
|
|
2082
|
+
root,
|
|
2083
|
+
loader,
|
|
2084
|
+
handle,
|
|
2085
|
+
children,
|
|
2086
|
+
void 0,
|
|
2087
|
+
path
|
|
2088
|
+
);
|
|
2089
|
+
});
|
|
2090
|
+
return root;
|
|
2091
|
+
};
|
|
2092
|
+
var settingsRouteRegex = /^\/settings\//;
|
|
2093
|
+
var getRoutesByType = (routes, type) => {
|
|
2094
|
+
return routes.filter((route) => {
|
|
2095
|
+
if (type === "settings") {
|
|
2096
|
+
return settingsRouteRegex.test(route.path);
|
|
2097
|
+
}
|
|
2098
|
+
return !settingsRouteRegex.test(route.path);
|
|
2099
|
+
});
|
|
2100
|
+
};
|
|
2101
|
+
var getMenuItemsByType = (menuItems, type) => {
|
|
2102
|
+
return menuItems.filter((item) => {
|
|
2103
|
+
if (item.nested) {
|
|
2104
|
+
return false;
|
|
2105
|
+
}
|
|
2106
|
+
if (type === "settings") {
|
|
2107
|
+
return settingsRouteRegex.test(item.path);
|
|
2108
|
+
}
|
|
2109
|
+
return !settingsRouteRegex.test(item.path);
|
|
2110
|
+
});
|
|
2111
|
+
};
|
|
2112
|
+
var getNestedMenuItems = (menuItems, parentPath) => {
|
|
2113
|
+
return menuItems.filter((item) => item.nested === parentPath).sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0));
|
|
2114
|
+
};
|
|
2115
|
+
|
|
2116
|
+
// src/components/layout/main-layout/main-layout.tsx
|
|
2117
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2118
|
+
var MainLayout = () => {
|
|
2119
|
+
const Sidebar = components.MainSidebar ? components.MainSidebar : MainSidebar;
|
|
2120
|
+
return /* @__PURE__ */ jsx11(Shell, { children: /* @__PURE__ */ jsx11(Sidebar, {}) });
|
|
2121
|
+
};
|
|
2122
|
+
var allMenuItems = menuItemsModule.menuItems ?? [];
|
|
2123
|
+
var addNestedItems = (to, items) => {
|
|
2124
|
+
const nestedItems = getNestedMenuItems(allMenuItems, to);
|
|
2125
|
+
if (nestedItems.length === 0) {
|
|
2126
|
+
return items;
|
|
2127
|
+
}
|
|
2128
|
+
const nestedNavItems = nestedItems.map((item) => ({
|
|
2129
|
+
label: item.label,
|
|
2130
|
+
to: item.path,
|
|
2131
|
+
translationNs: item.translationNs
|
|
2132
|
+
}));
|
|
2133
|
+
return [...items ?? [], ...nestedNavItems];
|
|
2134
|
+
};
|
|
2135
|
+
var MainSidebar = () => {
|
|
2136
|
+
const coreRoutes = useCoreRoutes();
|
|
2137
|
+
const customMenuItems = getMenuItemsByType(allMenuItems, "main");
|
|
2138
|
+
const routesWithNested = coreRoutes.map((route) => ({
|
|
2139
|
+
...route,
|
|
2140
|
+
items: addNestedItems(route.to, route.items)
|
|
2141
|
+
}));
|
|
2142
|
+
const customRoutesWithNested = customMenuItems.sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0)).map((item) => {
|
|
2143
|
+
const Icon2 = item.icon;
|
|
2144
|
+
return {
|
|
2145
|
+
label: item.label,
|
|
2146
|
+
to: item.path,
|
|
2147
|
+
icon: Icon2 ? /* @__PURE__ */ jsx11(Icon2, {}) : void 0,
|
|
2148
|
+
translationNs: item.translationNs,
|
|
2149
|
+
items: addNestedItems(item.path)
|
|
2150
|
+
};
|
|
2151
|
+
});
|
|
2152
|
+
return /* @__PURE__ */ jsx11("aside", { className: "flex flex-1 flex-col justify-between overflow-y-auto", children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col", children: [
|
|
2153
|
+
/* @__PURE__ */ jsxs7("div", { className: "bg-ui-bg-subtle sticky top-0", children: [
|
|
2154
|
+
/* @__PURE__ */ jsx11(Header, {}),
|
|
2155
|
+
/* @__PURE__ */ jsx11("div", { className: "px-3", children: /* @__PURE__ */ jsx11(Divider, { variant: "dashed" }) })
|
|
2156
|
+
] }),
|
|
2157
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col justify-between", children: [
|
|
2158
|
+
/* @__PURE__ */ jsx11("div", { className: "flex flex-1 flex-col", children: /* @__PURE__ */ jsxs7("nav", { className: "flex flex-col gap-y-1 py-3", children: [
|
|
2159
|
+
/* @__PURE__ */ jsx11(Searchbar, {}),
|
|
2160
|
+
routesWithNested.map((route) => {
|
|
2161
|
+
return /* @__PURE__ */ jsx11(NavItem, { ...route }, route.to);
|
|
2162
|
+
}),
|
|
2163
|
+
customRoutesWithNested.map((route) => /* @__PURE__ */ jsx11(NavItem, { ...route }, route.to))
|
|
2164
|
+
] }) }),
|
|
2165
|
+
/* @__PURE__ */ jsx11(UtilitySection, {})
|
|
2166
|
+
] })
|
|
2167
|
+
] }) });
|
|
2168
|
+
};
|
|
2169
|
+
var Logout = () => {
|
|
2170
|
+
const { t: t2 } = useTranslation8();
|
|
2171
|
+
const navigate = useNavigate4();
|
|
2172
|
+
const { mutateAsync: logoutMutation } = useLogout();
|
|
2173
|
+
const handleLogout = async () => {
|
|
2174
|
+
await logoutMutation(void 0, {
|
|
2175
|
+
onSuccess: () => {
|
|
2176
|
+
queryClient.clear();
|
|
2177
|
+
navigate("/login");
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
};
|
|
2181
|
+
return /* @__PURE__ */ jsx11(DropdownMenu3.Item, { onClick: handleLogout, children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-x-2", children: [
|
|
2182
|
+
/* @__PURE__ */ jsx11(OpenRectArrowOut2, { className: "text-ui-fg-subtle" }),
|
|
2183
|
+
/* @__PURE__ */ jsx11("span", { children: t2("app.menus.actions.logout") })
|
|
2184
|
+
] }) });
|
|
2185
|
+
};
|
|
2186
|
+
var Header = () => {
|
|
2187
|
+
const { t: t2 } = useTranslation8();
|
|
2188
|
+
const { seller, isPending, isError, error } = useMe();
|
|
2189
|
+
const direction = useDocumentDirection();
|
|
2190
|
+
const name = seller?.name;
|
|
2191
|
+
const fallback = seller?.name?.slice(0, 1).toUpperCase();
|
|
2192
|
+
const isLoaded = !isPending && !!seller && !!name && !!fallback;
|
|
2193
|
+
if (isError) {
|
|
2194
|
+
throw error;
|
|
2195
|
+
}
|
|
2196
|
+
return /* @__PURE__ */ jsx11("div", { className: "w-full p-3", children: /* @__PURE__ */ jsxs7(DropdownMenu3, { dir: direction, children: [
|
|
2197
|
+
/* @__PURE__ */ jsxs7(
|
|
2198
|
+
DropdownMenu3.Trigger,
|
|
2199
|
+
{
|
|
2200
|
+
disabled: !isLoaded,
|
|
2201
|
+
className: clx5(
|
|
2202
|
+
"bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
|
|
2203
|
+
"hover:bg-ui-bg-subtle-hover",
|
|
2204
|
+
"data-[state=open]:bg-ui-bg-subtle-hover",
|
|
2205
|
+
"focus-visible:shadow-borders-focus"
|
|
2206
|
+
),
|
|
2207
|
+
children: [
|
|
2208
|
+
fallback ? /* @__PURE__ */ jsx11(Avatar2, { variant: "squared", size: "xsmall", fallback }) : /* @__PURE__ */ jsx11(Skeleton, { className: "h-6 w-6 rounded-md" }),
|
|
2209
|
+
/* @__PURE__ */ jsx11("div", { className: "block overflow-hidden text-start", children: name ? /* @__PURE__ */ jsx11(
|
|
2210
|
+
Text5,
|
|
2211
|
+
{
|
|
2212
|
+
size: "small",
|
|
2213
|
+
weight: "plus",
|
|
2214
|
+
leading: "compact",
|
|
2215
|
+
className: "truncate",
|
|
2216
|
+
children: seller.name
|
|
2217
|
+
}
|
|
2218
|
+
) : /* @__PURE__ */ jsx11(Skeleton, { className: "h-[9px] w-[120px]" }) }),
|
|
2219
|
+
/* @__PURE__ */ jsx11(EllipsisHorizontal2, { className: "text-ui-fg-muted" })
|
|
2220
|
+
]
|
|
2221
|
+
}
|
|
2222
|
+
),
|
|
2223
|
+
isLoaded && /* @__PURE__ */ jsxs7(DropdownMenu3.Content, { className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0", children: [
|
|
2224
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-x-3 px-2 py-1", children: [
|
|
2225
|
+
/* @__PURE__ */ jsx11(Avatar2, { variant: "squared", size: "small", fallback }),
|
|
2226
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col overflow-hidden", children: [
|
|
2227
|
+
/* @__PURE__ */ jsx11(
|
|
2228
|
+
Text5,
|
|
2229
|
+
{
|
|
2230
|
+
size: "small",
|
|
2231
|
+
weight: "plus",
|
|
2232
|
+
leading: "compact",
|
|
2233
|
+
className: "truncate",
|
|
2234
|
+
children: name
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
/* @__PURE__ */ jsx11(
|
|
2238
|
+
Text5,
|
|
2239
|
+
{
|
|
2240
|
+
size: "xsmall",
|
|
2241
|
+
leading: "compact",
|
|
2242
|
+
className: "text-ui-fg-subtle",
|
|
2243
|
+
children: t2("app.menus.seller.label")
|
|
2244
|
+
}
|
|
2245
|
+
)
|
|
2246
|
+
] })
|
|
2247
|
+
] }),
|
|
2248
|
+
/* @__PURE__ */ jsx11(DropdownMenu3.Separator, {}),
|
|
2249
|
+
/* @__PURE__ */ jsx11(DropdownMenu3.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ jsxs7(Link3, { to: "/settings/seller", children: [
|
|
2250
|
+
/* @__PURE__ */ jsx11(BuildingStorefront, { className: "text-ui-fg-subtle" }),
|
|
2251
|
+
t2("app.menus.seller.editSeller")
|
|
2252
|
+
] }) }),
|
|
2253
|
+
/* @__PURE__ */ jsx11(DropdownMenu3.Separator, {}),
|
|
2254
|
+
/* @__PURE__ */ jsx11(ThemeToggle, {}),
|
|
2255
|
+
/* @__PURE__ */ jsx11(DropdownMenu3.Separator, {}),
|
|
2256
|
+
/* @__PURE__ */ jsx11(Logout, {})
|
|
2257
|
+
] })
|
|
2258
|
+
] }) });
|
|
2259
|
+
};
|
|
2260
|
+
var useCoreRoutes = () => {
|
|
2261
|
+
const { t: t2 } = useTranslation8();
|
|
2262
|
+
return [
|
|
2263
|
+
{
|
|
2264
|
+
icon: /* @__PURE__ */ jsx11(ShoppingCart, {}),
|
|
2265
|
+
label: t2("orders.domain"),
|
|
2266
|
+
to: "/orders",
|
|
2267
|
+
items: [
|
|
2268
|
+
// TODO: Enable when domin is introduced
|
|
2269
|
+
// {
|
|
2270
|
+
// label: t("draftOrders.domain"),
|
|
2271
|
+
// to: "/draft-orders",
|
|
2272
|
+
// },
|
|
2273
|
+
]
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
icon: /* @__PURE__ */ jsx11(Tag, {}),
|
|
2277
|
+
label: t2("products.domain"),
|
|
2278
|
+
to: "/products",
|
|
2279
|
+
items: [
|
|
2280
|
+
{
|
|
2281
|
+
label: t2("collections.domain"),
|
|
2282
|
+
to: "/collections"
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
label: t2("categories.domain"),
|
|
2286
|
+
to: "/categories"
|
|
2287
|
+
}
|
|
2288
|
+
// TODO: Enable when domin is introduced
|
|
2289
|
+
// {
|
|
2290
|
+
// label: t("giftCards.domain"),
|
|
2291
|
+
// to: "/gift-cards",
|
|
2292
|
+
// },
|
|
2293
|
+
]
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
icon: /* @__PURE__ */ jsx11(Buildings, {}),
|
|
2297
|
+
label: t2("inventory.domain"),
|
|
2298
|
+
to: "/inventory",
|
|
2299
|
+
items: []
|
|
2300
|
+
},
|
|
2301
|
+
{
|
|
2302
|
+
icon: /* @__PURE__ */ jsx11(Users, {}),
|
|
2303
|
+
label: t2("customers.domain"),
|
|
2304
|
+
to: "/customers",
|
|
2305
|
+
items: []
|
|
2306
|
+
},
|
|
2307
|
+
{
|
|
2308
|
+
icon: /* @__PURE__ */ jsx11(ReceiptPercent, {}),
|
|
2309
|
+
label: t2("promotions.domain"),
|
|
2310
|
+
to: "/promotions",
|
|
2311
|
+
items: [
|
|
2312
|
+
{
|
|
2313
|
+
label: t2("campaigns.domain"),
|
|
2314
|
+
to: "/campaigns"
|
|
2315
|
+
}
|
|
2316
|
+
]
|
|
2317
|
+
},
|
|
2318
|
+
{
|
|
2319
|
+
icon: /* @__PURE__ */ jsx11(CurrencyDollar, {}),
|
|
2320
|
+
label: t2("priceLists.domain"),
|
|
2321
|
+
to: "/price-lists"
|
|
2322
|
+
},
|
|
2323
|
+
{
|
|
2324
|
+
icon: /* @__PURE__ */ jsx11(CreditCardRefresh, {}),
|
|
2325
|
+
label: "Payouts",
|
|
2326
|
+
to: "/payouts"
|
|
2327
|
+
}
|
|
2328
|
+
];
|
|
2329
|
+
};
|
|
2330
|
+
var Searchbar = () => {
|
|
2331
|
+
const { t: t2 } = useTranslation8();
|
|
2332
|
+
const { toggleSearch } = useSearch();
|
|
2333
|
+
return /* @__PURE__ */ jsx11("div", { className: "px-3", children: /* @__PURE__ */ jsxs7(
|
|
2334
|
+
"button",
|
|
2335
|
+
{
|
|
2336
|
+
onClick: toggleSearch,
|
|
2337
|
+
className: clx5(
|
|
2338
|
+
"bg-ui-bg-subtle text-ui-fg-subtle flex w-full items-center gap-x-2.5 rounded-md px-2 py-1 outline-none",
|
|
2339
|
+
"hover:bg-ui-bg-subtle-hover",
|
|
2340
|
+
"focus-visible:shadow-borders-focus"
|
|
2341
|
+
),
|
|
2342
|
+
children: [
|
|
2343
|
+
/* @__PURE__ */ jsx11(MagnifyingGlass2, {}),
|
|
2344
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1 text-start", children: /* @__PURE__ */ jsx11(Text5, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.label") }) }),
|
|
2345
|
+
/* @__PURE__ */ jsx11(Text5, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: "\u2318K" })
|
|
2346
|
+
]
|
|
2347
|
+
}
|
|
2348
|
+
) });
|
|
2349
|
+
};
|
|
2350
|
+
var UtilitySection = () => {
|
|
2351
|
+
const location = useLocation7();
|
|
2352
|
+
const { t: t2 } = useTranslation8();
|
|
2353
|
+
return /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-y-0.5 py-3", children: /* @__PURE__ */ jsx11(
|
|
2354
|
+
NavItem,
|
|
2355
|
+
{
|
|
2356
|
+
label: t2("app.nav.settings.header"),
|
|
2357
|
+
to: "/settings",
|
|
2358
|
+
from: location.pathname,
|
|
2359
|
+
icon: /* @__PURE__ */ jsx11(CogSixTooth, {})
|
|
2360
|
+
}
|
|
2361
|
+
) });
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
// src/components/layout/public-layout/public-layout.tsx
|
|
2365
|
+
import { Outlet as Outlet3 } from "react-router-dom";
|
|
2366
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2367
|
+
var PublicLayout = () => {
|
|
2368
|
+
return /* @__PURE__ */ jsx12(Outlet3, {});
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
// src/components/layout/settings-layout/settings-layout.tsx
|
|
2372
|
+
import { ArrowUturnLeft as ArrowUturnLeft2, MinusMini } from "@medusajs/icons";
|
|
2373
|
+
import { clx as clx6, Divider as Divider2, IconButton as IconButton4, Text as Text6 } from "@medusajs/ui";
|
|
2374
|
+
import { Collapsible as RadixCollapsible2 } from "radix-ui";
|
|
2375
|
+
import { useEffect as useEffect9, useMemo as useMemo4, useState as useState11 } from "react";
|
|
2376
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
2377
|
+
import { Link as Link4, useLocation as useLocation8 } from "react-router-dom";
|
|
2378
|
+
import components2 from "virtual:mercur/components";
|
|
2379
|
+
import menuItemsModule2 from "virtual:mercur/menu-items";
|
|
2380
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2381
|
+
var SettingsLayout = () => {
|
|
2382
|
+
const Sidebar = components2.SettingsSidebar ? components2.SettingsSidebar : SettingsSidebar;
|
|
2383
|
+
return /* @__PURE__ */ jsx13(Shell, { children: /* @__PURE__ */ jsx13(Sidebar, {}) });
|
|
2384
|
+
};
|
|
2385
|
+
var allMenuItems2 = menuItemsModule2.menuItems ?? [];
|
|
2386
|
+
var customSettingsItems = getMenuItemsByType(allMenuItems2, "settings");
|
|
2387
|
+
var extensionNavItems = customSettingsItems.sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0)).map((item) => ({
|
|
2388
|
+
label: item.label,
|
|
2389
|
+
to: item.path,
|
|
2390
|
+
translationNs: item.translationNs
|
|
2391
|
+
}));
|
|
2392
|
+
var useSettingRoutes = () => {
|
|
2393
|
+
const { t: t2 } = useTranslation9();
|
|
2394
|
+
return useMemo4(
|
|
2395
|
+
() => [
|
|
2396
|
+
{
|
|
2397
|
+
label: t2("seller.domain", "Seller"),
|
|
2398
|
+
to: "/settings/seller"
|
|
2399
|
+
},
|
|
2400
|
+
// {
|
|
2401
|
+
// label: t("users.domain"),
|
|
2402
|
+
// to: "/settings/users",
|
|
2403
|
+
// },
|
|
2404
|
+
{
|
|
2405
|
+
label: t2("productTypes.domain"),
|
|
2406
|
+
to: "/settings/product-types"
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
label: t2("productTags.domain"),
|
|
2410
|
+
to: "/settings/product-tags"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
label: t2("stockLocations.domain"),
|
|
2414
|
+
to: "/settings/locations"
|
|
2415
|
+
},
|
|
2416
|
+
...extensionNavItems
|
|
2417
|
+
],
|
|
2418
|
+
[t2]
|
|
2419
|
+
);
|
|
2420
|
+
};
|
|
2421
|
+
var getSafeFromValue = (from) => {
|
|
2422
|
+
if (from.startsWith("/settings")) {
|
|
2423
|
+
return "/orders";
|
|
2424
|
+
}
|
|
2425
|
+
return from;
|
|
2426
|
+
};
|
|
2427
|
+
var SettingsSidebar = () => {
|
|
2428
|
+
const generalRoutes = useSettingRoutes();
|
|
2429
|
+
const { t: t2 } = useTranslation9();
|
|
2430
|
+
return /* @__PURE__ */ jsxs8("aside", { className: "relative flex flex-1 flex-col justify-between overflow-y-auto", children: [
|
|
2431
|
+
/* @__PURE__ */ jsxs8("div", { className: "bg-ui-bg-subtle sticky top-0", children: [
|
|
2432
|
+
/* @__PURE__ */ jsx13(Header2, {}),
|
|
2433
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) })
|
|
2434
|
+
] }),
|
|
2435
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-1 flex-col", children: [
|
|
2436
|
+
/* @__PURE__ */ jsx13("div", { className: "flex flex-1 flex-col overflow-y-auto", children: /* @__PURE__ */ jsx13(
|
|
2437
|
+
RadixCollapsibleSection,
|
|
2438
|
+
{
|
|
2439
|
+
label: t2("app.nav.settings.general"),
|
|
2440
|
+
items: generalRoutes
|
|
2441
|
+
}
|
|
2442
|
+
) }),
|
|
2443
|
+
/* @__PURE__ */ jsx13("div", { className: "bg-ui-bg-subtle sticky bottom-0", children: /* @__PURE__ */ jsx13(UserSection, {}) })
|
|
2444
|
+
] })
|
|
2445
|
+
] });
|
|
2446
|
+
};
|
|
2447
|
+
var Header2 = () => {
|
|
2448
|
+
const [from, setFrom] = useState11("/orders");
|
|
2449
|
+
const { t: t2 } = useTranslation9();
|
|
2450
|
+
const location = useLocation8();
|
|
2451
|
+
useEffect9(() => {
|
|
2452
|
+
if (location.state?.from) {
|
|
2453
|
+
setFrom(getSafeFromValue(location.state.from));
|
|
2454
|
+
}
|
|
2455
|
+
}, [location]);
|
|
2456
|
+
return /* @__PURE__ */ jsx13("div", { className: "bg-ui-bg-subtle p-3", children: /* @__PURE__ */ jsx13(
|
|
2457
|
+
Link4,
|
|
2458
|
+
{
|
|
2459
|
+
to: from,
|
|
2460
|
+
replace: true,
|
|
2461
|
+
className: clx6(
|
|
2462
|
+
"bg-ui-bg-subtle transition-fg flex items-center rounded-md outline-none",
|
|
2463
|
+
"hover:bg-ui-bg-subtle-hover",
|
|
2464
|
+
"focus-visible:shadow-borders-focus"
|
|
2465
|
+
),
|
|
2466
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-x-2.5 px-2 py-1", children: [
|
|
2467
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx13(ArrowUturnLeft2, { className: "text-ui-fg-subtle" }) }),
|
|
2468
|
+
/* @__PURE__ */ jsx13(Text6, { leading: "compact", weight: "plus", size: "small", children: t2("app.nav.settings.header") })
|
|
2469
|
+
] })
|
|
2470
|
+
}
|
|
2471
|
+
) });
|
|
2472
|
+
};
|
|
2473
|
+
var RadixCollapsibleSection = ({
|
|
2474
|
+
label,
|
|
2475
|
+
items
|
|
2476
|
+
}) => {
|
|
2477
|
+
return /* @__PURE__ */ jsxs8(RadixCollapsible2.Root, { defaultOpen: true, className: "py-3", children: [
|
|
2478
|
+
/* @__PURE__ */ jsx13("div", { className: "px-3", children: /* @__PURE__ */ jsxs8("div", { className: "text-ui-fg-muted flex h-7 items-center justify-between px-2", children: [
|
|
2479
|
+
/* @__PURE__ */ jsx13(Text6, { size: "small", leading: "compact", children: label }),
|
|
2480
|
+
/* @__PURE__ */ jsx13(RadixCollapsible2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx13(IconButton4, { size: "2xsmall", variant: "transparent", className: "static", children: /* @__PURE__ */ jsx13(MinusMini, { className: "text-ui-fg-muted" }) }) })
|
|
2481
|
+
] }) }),
|
|
2482
|
+
/* @__PURE__ */ jsx13(RadixCollapsible2.Content, { children: /* @__PURE__ */ jsx13("div", { className: "pt-0.5", children: /* @__PURE__ */ jsx13("nav", { className: "flex flex-col gap-y-0.5", children: items.map((setting) => /* @__PURE__ */ jsx13(NavItem, { type: "setting", ...setting }, setting.to)) }) }) })
|
|
2483
|
+
] });
|
|
2484
|
+
};
|
|
2485
|
+
var UserSection = () => {
|
|
2486
|
+
return /* @__PURE__ */ jsxs8("div", { children: [
|
|
2487
|
+
/* @__PURE__ */ jsx13("div", { className: "px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) }),
|
|
2488
|
+
/* @__PURE__ */ jsx13(Header, {})
|
|
2489
|
+
] });
|
|
2490
|
+
};
|
|
2491
|
+
|
|
2492
|
+
// src/get-route-map.tsx
|
|
2493
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2494
|
+
function mergeRoutes(baseRoutes, customRoutes2) {
|
|
2495
|
+
const result = baseRoutes.map((route) => ({ ...route }));
|
|
2496
|
+
for (const customRoute of customRoutes2) {
|
|
2497
|
+
const customPath = customRoute.path?.replace(/^\/+/, "");
|
|
2498
|
+
const existingIndex = result.findIndex(
|
|
2499
|
+
(r) => r.path != null && r.path.replace(/^\/+/, "") === customPath
|
|
2500
|
+
);
|
|
2501
|
+
if (existingIndex !== -1) {
|
|
2502
|
+
const { children: customChildren, ...customRest } = customRoute;
|
|
2503
|
+
result[existingIndex] = {
|
|
2504
|
+
...result[existingIndex],
|
|
2505
|
+
...customRest,
|
|
2506
|
+
path: result[existingIndex].path,
|
|
2507
|
+
children: customChildren ? mergeRoutes(result[existingIndex].children ?? [], customChildren) : result[existingIndex].children
|
|
2508
|
+
};
|
|
2509
|
+
} else {
|
|
2510
|
+
result.push(customRoute);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
return result;
|
|
2514
|
+
}
|
|
2515
|
+
function getRouteMap({
|
|
2516
|
+
settingsRoutes: customSettingsRoutes,
|
|
2517
|
+
mainRoutes: customMainRoutes
|
|
2518
|
+
}) {
|
|
2519
|
+
return [
|
|
2520
|
+
// PROTECTED - MAIN LAYOUT
|
|
2521
|
+
{
|
|
2522
|
+
element: /* @__PURE__ */ jsx14(ProtectedRoute, {}),
|
|
2523
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2524
|
+
children: [
|
|
2525
|
+
{
|
|
2526
|
+
element: /* @__PURE__ */ jsx14(MainLayout, {}),
|
|
2527
|
+
children: mergeRoutes(
|
|
2528
|
+
[
|
|
2529
|
+
{
|
|
2530
|
+
path: "/",
|
|
2531
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2532
|
+
lazy: () => import("./home-PP7YYCSB.js")
|
|
2533
|
+
},
|
|
2534
|
+
{
|
|
2535
|
+
path: "/products",
|
|
2536
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2537
|
+
handle: { breadcrumb: () => t("products.domain") },
|
|
2538
|
+
children: [
|
|
2539
|
+
{
|
|
2540
|
+
path: "",
|
|
2541
|
+
lazy: async () => {
|
|
2542
|
+
const { ProductListPage } = await import("./products-RFYNEY57.js");
|
|
2543
|
+
return {
|
|
2544
|
+
Component: ProductListPage
|
|
2545
|
+
};
|
|
2546
|
+
},
|
|
2547
|
+
children: [
|
|
2548
|
+
{
|
|
2549
|
+
path: "create",
|
|
2550
|
+
lazy: async () => {
|
|
2551
|
+
const { ProductCreatePage } = await import("./create-G4UJOJJ6.js");
|
|
2552
|
+
return {
|
|
2553
|
+
Component: ProductCreatePage
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
]
|
|
2558
|
+
},
|
|
2559
|
+
{
|
|
2560
|
+
path: ":id",
|
|
2561
|
+
lazy: async () => {
|
|
2562
|
+
const { loader } = await import("./[id]-HHZ3BSXV.js");
|
|
2563
|
+
const { Breadcrumb } = await import("./breadcrumb-EOYLR3IQ.js");
|
|
2564
|
+
return {
|
|
2565
|
+
Component: Outlet4,
|
|
2566
|
+
loader,
|
|
2567
|
+
handle: {
|
|
2568
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
},
|
|
2572
|
+
children: [
|
|
2573
|
+
{
|
|
2574
|
+
path: "",
|
|
2575
|
+
lazy: async () => {
|
|
2576
|
+
const { ProductDetailPage } = await import("./[id]-HHZ3BSXV.js");
|
|
2577
|
+
return {
|
|
2578
|
+
Component: ProductDetailPage
|
|
2579
|
+
};
|
|
2580
|
+
},
|
|
2581
|
+
children: [
|
|
2582
|
+
{
|
|
2583
|
+
path: "edit",
|
|
2584
|
+
lazy: () => import("./edit-LOKLQGM2.js")
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
path: "sales-channels",
|
|
2588
|
+
lazy: () => import("./sales-channels-ZKA62EAW.js")
|
|
2589
|
+
},
|
|
2590
|
+
{
|
|
2591
|
+
path: "organization",
|
|
2592
|
+
lazy: () => import("./organization-VQXCKHCN.js")
|
|
2593
|
+
},
|
|
2594
|
+
{
|
|
2595
|
+
path: "media",
|
|
2596
|
+
lazy: () => import("./media-PL477QJO.js")
|
|
2597
|
+
},
|
|
2598
|
+
{
|
|
2599
|
+
path: "attributes",
|
|
2600
|
+
lazy: () => import("./attributes-UEM2VJKV.js")
|
|
2601
|
+
},
|
|
2602
|
+
{
|
|
2603
|
+
path: "additional-attributes",
|
|
2604
|
+
lazy: () => import("./additional-attributes-E36EZX4V.js")
|
|
2605
|
+
},
|
|
2606
|
+
{
|
|
2607
|
+
path: "metadata",
|
|
2608
|
+
lazy: () => import("./metadata-NX3LEEB3.js")
|
|
2609
|
+
},
|
|
2610
|
+
{
|
|
2611
|
+
path: "shipping-profile",
|
|
2612
|
+
lazy: () => import("./shipping-profile-7FTHSPY2.js")
|
|
2613
|
+
},
|
|
2614
|
+
{
|
|
2615
|
+
path: "prices",
|
|
2616
|
+
lazy: () => import("./prices-EW7KBY6R.js")
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
path: "options/create",
|
|
2620
|
+
lazy: () => import("./create-MKBBF2V3.js")
|
|
2621
|
+
},
|
|
2622
|
+
{
|
|
2623
|
+
path: "variants/create",
|
|
2624
|
+
lazy: () => import("./create-TMTZDKII.js")
|
|
2625
|
+
}
|
|
2626
|
+
]
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
path: "stock",
|
|
2630
|
+
lazy: () => import("./stock-ENMBCZRY.js")
|
|
2631
|
+
}
|
|
2632
|
+
]
|
|
2633
|
+
}
|
|
2634
|
+
]
|
|
2635
|
+
},
|
|
2636
|
+
// ORDERS
|
|
2637
|
+
{
|
|
2638
|
+
path: "/orders",
|
|
2639
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2640
|
+
handle: { breadcrumb: () => t("orders.domain") },
|
|
2641
|
+
children: [
|
|
2642
|
+
{
|
|
2643
|
+
path: "",
|
|
2644
|
+
lazy: async () => {
|
|
2645
|
+
const { OrderListPage } = await import("./orders-2KHCHNO5.js");
|
|
2646
|
+
return { Component: OrderListPage };
|
|
2647
|
+
}
|
|
2648
|
+
},
|
|
2649
|
+
{
|
|
2650
|
+
path: ":id",
|
|
2651
|
+
lazy: async () => {
|
|
2652
|
+
const { loader } = await import("./[id]-2VBOAZM4.js");
|
|
2653
|
+
const { Breadcrumb } = await import("./breadcrumb-5OTOCYNL.js");
|
|
2654
|
+
return {
|
|
2655
|
+
Component: Outlet4,
|
|
2656
|
+
loader,
|
|
2657
|
+
handle: {
|
|
2658
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2659
|
+
}
|
|
2660
|
+
};
|
|
2661
|
+
},
|
|
2662
|
+
children: [
|
|
2663
|
+
{
|
|
2664
|
+
path: "",
|
|
2665
|
+
lazy: async () => {
|
|
2666
|
+
const { OrderDetailPage } = await import("./[id]-2VBOAZM4.js");
|
|
2667
|
+
return { Component: OrderDetailPage };
|
|
2668
|
+
},
|
|
2669
|
+
children: [
|
|
2670
|
+
{
|
|
2671
|
+
path: "fulfillment",
|
|
2672
|
+
lazy: () => import("./fulfillment-SKXAF3BZ.js")
|
|
2673
|
+
},
|
|
2674
|
+
{
|
|
2675
|
+
path: "allocate-items",
|
|
2676
|
+
lazy: () => import("./allocate-items-QAS5PZLR.js")
|
|
2677
|
+
}
|
|
2678
|
+
]
|
|
2679
|
+
}
|
|
2680
|
+
// {
|
|
2681
|
+
// path: "fulfillments/:f_id/shipment",
|
|
2682
|
+
// lazy: () => import("./pages/orders/[id]/shipment"),
|
|
2683
|
+
// },
|
|
2684
|
+
]
|
|
2685
|
+
}
|
|
2686
|
+
]
|
|
2687
|
+
},
|
|
2688
|
+
// PAYOUTS
|
|
2689
|
+
{
|
|
2690
|
+
path: "/payouts",
|
|
2691
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2692
|
+
handle: { breadcrumb: () => "Payouts" },
|
|
2693
|
+
children: [
|
|
2694
|
+
{
|
|
2695
|
+
path: "",
|
|
2696
|
+
lazy: async () => {
|
|
2697
|
+
const { PayoutListPage } = await import("./payouts-3BY73LZ3.js");
|
|
2698
|
+
return { Component: PayoutListPage };
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
{
|
|
2702
|
+
path: ":id",
|
|
2703
|
+
lazy: async () => {
|
|
2704
|
+
const { Breadcrumb } = await import("./breadcrumb-ASB2YCNV.js");
|
|
2705
|
+
return {
|
|
2706
|
+
Component: Outlet4,
|
|
2707
|
+
handle: {
|
|
2708
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2709
|
+
}
|
|
2710
|
+
};
|
|
2711
|
+
},
|
|
2712
|
+
children: [
|
|
2713
|
+
{
|
|
2714
|
+
path: "",
|
|
2715
|
+
lazy: async () => {
|
|
2716
|
+
const { PayoutDetailPage } = await import("./[id]-VTFOP3BF.js");
|
|
2717
|
+
return { Component: PayoutDetailPage };
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
]
|
|
2721
|
+
}
|
|
2722
|
+
]
|
|
2723
|
+
},
|
|
2724
|
+
// CATEGORIES
|
|
2725
|
+
{
|
|
2726
|
+
path: "/categories",
|
|
2727
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2728
|
+
handle: { breadcrumb: () => t("categories.domain") },
|
|
2729
|
+
children: [
|
|
2730
|
+
{
|
|
2731
|
+
path: "",
|
|
2732
|
+
lazy: async () => {
|
|
2733
|
+
const { CategoryListPage } = await import("./categories-CKKIUMYG.js");
|
|
2734
|
+
return {
|
|
2735
|
+
Component: CategoryListPage
|
|
2736
|
+
};
|
|
2737
|
+
},
|
|
2738
|
+
children: [
|
|
2739
|
+
{
|
|
2740
|
+
path: "organize",
|
|
2741
|
+
lazy: () => import("./organize-3F5ZUIGB.js")
|
|
2742
|
+
}
|
|
2743
|
+
]
|
|
2744
|
+
},
|
|
2745
|
+
{
|
|
2746
|
+
path: ":id",
|
|
2747
|
+
lazy: async () => {
|
|
2748
|
+
const { loader } = await import("./[id]-TI2MOR2C.js");
|
|
2749
|
+
const { Breadcrumb } = await import("./breadcrumb-RIXJ5QSX.js");
|
|
2750
|
+
return {
|
|
2751
|
+
Component: Outlet4,
|
|
2752
|
+
loader,
|
|
2753
|
+
handle: {
|
|
2754
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2755
|
+
}
|
|
2756
|
+
};
|
|
2757
|
+
},
|
|
2758
|
+
children: [
|
|
2759
|
+
{
|
|
2760
|
+
path: "",
|
|
2761
|
+
lazy: async () => {
|
|
2762
|
+
const { CategoryDetailPage } = await import("./[id]-TI2MOR2C.js");
|
|
2763
|
+
return {
|
|
2764
|
+
Component: CategoryDetailPage
|
|
2765
|
+
};
|
|
2766
|
+
},
|
|
2767
|
+
children: [
|
|
2768
|
+
{
|
|
2769
|
+
path: "products",
|
|
2770
|
+
lazy: () => import("./products-GSN4I7BT.js")
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
path: "organize",
|
|
2774
|
+
lazy: () => import("./organize-WPWEPCF7.js")
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
path: "metadata",
|
|
2778
|
+
lazy: () => import("./metadata-RBDSM567.js")
|
|
2779
|
+
}
|
|
2780
|
+
]
|
|
2781
|
+
}
|
|
2782
|
+
]
|
|
2783
|
+
}
|
|
2784
|
+
]
|
|
2785
|
+
},
|
|
2786
|
+
// COLLECTIONS
|
|
2787
|
+
{
|
|
2788
|
+
path: "/collections",
|
|
2789
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2790
|
+
handle: { breadcrumb: () => t("collections.domain") },
|
|
2791
|
+
children: [
|
|
2792
|
+
{
|
|
2793
|
+
path: "",
|
|
2794
|
+
lazy: async () => {
|
|
2795
|
+
const { CollectionListPage } = await import("./collections-TREF67TO.js");
|
|
2796
|
+
return {
|
|
2797
|
+
Component: CollectionListPage
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
path: ":id",
|
|
2803
|
+
lazy: async () => {
|
|
2804
|
+
const { loader } = await import("./[id]-UMFGLDM2.js");
|
|
2805
|
+
const { Breadcrumb } = await import("./breadcrumb-NCBGPQML.js");
|
|
2806
|
+
return {
|
|
2807
|
+
Component: Outlet4,
|
|
2808
|
+
loader,
|
|
2809
|
+
handle: {
|
|
2810
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
},
|
|
2814
|
+
children: [
|
|
2815
|
+
{
|
|
2816
|
+
path: "",
|
|
2817
|
+
lazy: async () => {
|
|
2818
|
+
const { CollectionDetailPage } = await import("./[id]-UMFGLDM2.js");
|
|
2819
|
+
return {
|
|
2820
|
+
Component: CollectionDetailPage
|
|
2821
|
+
};
|
|
2822
|
+
},
|
|
2823
|
+
children: [
|
|
2824
|
+
{
|
|
2825
|
+
path: "add-products",
|
|
2826
|
+
lazy: () => import("./add-products-2VB57KXV.js")
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
path: "metadata",
|
|
2830
|
+
lazy: () => import("./metadata-42MU3H7T.js")
|
|
2831
|
+
}
|
|
2832
|
+
]
|
|
2833
|
+
}
|
|
2834
|
+
]
|
|
2835
|
+
}
|
|
2836
|
+
]
|
|
2837
|
+
},
|
|
2838
|
+
// CUSTOMERS
|
|
2839
|
+
{
|
|
2840
|
+
path: "/customers",
|
|
2841
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2842
|
+
handle: { breadcrumb: () => t("customers.domain") },
|
|
2843
|
+
children: [
|
|
2844
|
+
{
|
|
2845
|
+
path: "",
|
|
2846
|
+
lazy: async () => {
|
|
2847
|
+
const { CustomerListPage } = await import("./customers-4QWR5UOL.js");
|
|
2848
|
+
return {
|
|
2849
|
+
Component: CustomerListPage
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
},
|
|
2853
|
+
{
|
|
2854
|
+
path: ":id",
|
|
2855
|
+
lazy: async () => {
|
|
2856
|
+
const { loader } = await import("./[id]-FXKSI52D.js");
|
|
2857
|
+
const { Breadcrumb } = await import("./breadcrumb-WP34OXGQ.js");
|
|
2858
|
+
return {
|
|
2859
|
+
Component: Outlet4,
|
|
2860
|
+
loader,
|
|
2861
|
+
handle: {
|
|
2862
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
},
|
|
2866
|
+
children: [
|
|
2867
|
+
{
|
|
2868
|
+
path: "",
|
|
2869
|
+
lazy: async () => {
|
|
2870
|
+
const { CustomerDetailPage } = await import("./[id]-FXKSI52D.js");
|
|
2871
|
+
return {
|
|
2872
|
+
Component: CustomerDetailPage
|
|
2873
|
+
};
|
|
2874
|
+
},
|
|
2875
|
+
children: [
|
|
2876
|
+
{
|
|
2877
|
+
path: "edit",
|
|
2878
|
+
lazy: () => import("./edit-J3LD76JS.js")
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
path: "add-customer-groups",
|
|
2882
|
+
lazy: () => import("./add-customer-groups-JA346MTF.js")
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
path: "metadata",
|
|
2886
|
+
lazy: () => import("./metadata-DIJTVDF7.js")
|
|
2887
|
+
}
|
|
2888
|
+
]
|
|
2889
|
+
}
|
|
2890
|
+
]
|
|
2891
|
+
}
|
|
2892
|
+
]
|
|
2893
|
+
},
|
|
2894
|
+
// CUSTOMER GROUPS - disabled
|
|
2895
|
+
// {
|
|
2896
|
+
// path: "/customer-groups",
|
|
2897
|
+
// ...
|
|
2898
|
+
// },
|
|
2899
|
+
// INVENTORY
|
|
2900
|
+
{
|
|
2901
|
+
path: "/inventory",
|
|
2902
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2903
|
+
handle: { breadcrumb: () => t("inventory.domain") },
|
|
2904
|
+
children: [
|
|
2905
|
+
{
|
|
2906
|
+
path: "",
|
|
2907
|
+
lazy: async () => {
|
|
2908
|
+
const { InventoryListPage } = await import("./inventory-AIRQ2KNS.js");
|
|
2909
|
+
return {
|
|
2910
|
+
Component: InventoryListPage
|
|
2911
|
+
};
|
|
2912
|
+
},
|
|
2913
|
+
children: [
|
|
2914
|
+
{
|
|
2915
|
+
path: "create",
|
|
2916
|
+
lazy: () => import("./create-LOBCFTCT.js")
|
|
2917
|
+
},
|
|
2918
|
+
{
|
|
2919
|
+
path: "stock",
|
|
2920
|
+
lazy: () => import("./stock-VYDJY46S.js")
|
|
2921
|
+
}
|
|
2922
|
+
]
|
|
2923
|
+
},
|
|
2924
|
+
{
|
|
2925
|
+
path: ":id",
|
|
2926
|
+
lazy: async () => {
|
|
2927
|
+
const { loader } = await import("./[id]-RGDXOC7T.js");
|
|
2928
|
+
const { Breadcrumb } = await import("./breadcrumb-MOQ7GI3Z.js");
|
|
2929
|
+
return {
|
|
2930
|
+
Component: Outlet4,
|
|
2931
|
+
loader,
|
|
2932
|
+
handle: {
|
|
2933
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
},
|
|
2937
|
+
children: [
|
|
2938
|
+
{
|
|
2939
|
+
path: "",
|
|
2940
|
+
lazy: async () => {
|
|
2941
|
+
const { InventoryDetailPage } = await import("./[id]-RGDXOC7T.js");
|
|
2942
|
+
return {
|
|
2943
|
+
Component: InventoryDetailPage
|
|
2944
|
+
};
|
|
2945
|
+
},
|
|
2946
|
+
children: [
|
|
2947
|
+
{
|
|
2948
|
+
path: "edit",
|
|
2949
|
+
lazy: () => import("./edit-inventory-item-YFW2AFRD.js")
|
|
2950
|
+
},
|
|
2951
|
+
{
|
|
2952
|
+
path: "attributes",
|
|
2953
|
+
lazy: () => import("./edit-inventory-item-attributes-IYAMJDTB.js")
|
|
2954
|
+
},
|
|
2955
|
+
{
|
|
2956
|
+
path: "metadata",
|
|
2957
|
+
lazy: () => import("./metadata-VZTWNZPG.js")
|
|
2958
|
+
},
|
|
2959
|
+
{
|
|
2960
|
+
path: "locations",
|
|
2961
|
+
lazy: () => import("./manage-locations-4PQS4QY7.js")
|
|
2962
|
+
},
|
|
2963
|
+
{
|
|
2964
|
+
path: "locations/:location_id",
|
|
2965
|
+
lazy: () => import("./adjust-inventory-P7AB7VIB.js")
|
|
2966
|
+
}
|
|
2967
|
+
]
|
|
2968
|
+
}
|
|
2969
|
+
]
|
|
2970
|
+
}
|
|
2971
|
+
]
|
|
2972
|
+
},
|
|
2973
|
+
// PROMOTIONS
|
|
2974
|
+
{
|
|
2975
|
+
path: "/promotions",
|
|
2976
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
2977
|
+
handle: { breadcrumb: () => t("promotions.domain") },
|
|
2978
|
+
children: [
|
|
2979
|
+
{
|
|
2980
|
+
path: "",
|
|
2981
|
+
lazy: async () => {
|
|
2982
|
+
const { PromotionListPage } = await import("./promotions-CIZIDQ64.js");
|
|
2983
|
+
return {
|
|
2984
|
+
Component: PromotionListPage
|
|
2985
|
+
};
|
|
2986
|
+
},
|
|
2987
|
+
children: [
|
|
2988
|
+
{
|
|
2989
|
+
path: "create",
|
|
2990
|
+
lazy: () => import("./create-YAAK7JQ3.js")
|
|
2991
|
+
}
|
|
2992
|
+
]
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
path: ":id",
|
|
2996
|
+
lazy: async () => {
|
|
2997
|
+
const { loader } = await import("./[id]-23D3HY3G.js");
|
|
2998
|
+
const { Breadcrumb } = await import("./breadcrumb-LENACUAA.js");
|
|
2999
|
+
return {
|
|
3000
|
+
Component: Outlet4,
|
|
3001
|
+
loader,
|
|
3002
|
+
handle: {
|
|
3003
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
},
|
|
3007
|
+
children: [
|
|
3008
|
+
{
|
|
3009
|
+
path: "",
|
|
3010
|
+
lazy: async () => {
|
|
3011
|
+
const { PromotionDetailPage } = await import("./[id]-23D3HY3G.js");
|
|
3012
|
+
return {
|
|
3013
|
+
Component: PromotionDetailPage
|
|
3014
|
+
};
|
|
3015
|
+
},
|
|
3016
|
+
children: [
|
|
3017
|
+
{
|
|
3018
|
+
path: "edit",
|
|
3019
|
+
lazy: () => import("./edit-BYXHU3IG.js")
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
path: "add-to-campaign",
|
|
3023
|
+
lazy: () => import("./add-to-campaign-V6D7JKRS.js")
|
|
3024
|
+
},
|
|
3025
|
+
{
|
|
3026
|
+
path: ":ruleType/edit",
|
|
3027
|
+
lazy: () => import("./edit-AQAPYMDY.js")
|
|
3028
|
+
}
|
|
3029
|
+
]
|
|
3030
|
+
}
|
|
3031
|
+
]
|
|
3032
|
+
}
|
|
3033
|
+
]
|
|
3034
|
+
},
|
|
3035
|
+
// CAMPAIGNS
|
|
3036
|
+
{
|
|
3037
|
+
path: "/campaigns",
|
|
3038
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3039
|
+
handle: { breadcrumb: () => t("campaigns.domain") },
|
|
3040
|
+
children: [
|
|
3041
|
+
{
|
|
3042
|
+
path: "",
|
|
3043
|
+
lazy: async () => {
|
|
3044
|
+
const { CampaignListPage } = await import("./campaigns-PMVKUFEA.js");
|
|
3045
|
+
return {
|
|
3046
|
+
Component: CampaignListPage
|
|
3047
|
+
};
|
|
3048
|
+
},
|
|
3049
|
+
children: [
|
|
3050
|
+
{
|
|
3051
|
+
path: "create",
|
|
3052
|
+
lazy: () => import("./create-EJM5C2XP.js")
|
|
3053
|
+
}
|
|
3054
|
+
]
|
|
3055
|
+
},
|
|
3056
|
+
{
|
|
3057
|
+
path: ":id",
|
|
3058
|
+
lazy: async () => {
|
|
3059
|
+
const { loader } = await import("./[id]-QSRIPPIP.js");
|
|
3060
|
+
const { Breadcrumb } = await import("./breadcrumb-OVMEC5OZ.js");
|
|
3061
|
+
return {
|
|
3062
|
+
Component: Outlet4,
|
|
3063
|
+
loader,
|
|
3064
|
+
handle: {
|
|
3065
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
},
|
|
3069
|
+
children: [
|
|
3070
|
+
{
|
|
3071
|
+
path: "",
|
|
3072
|
+
lazy: async () => {
|
|
3073
|
+
const { CampaignDetailPage } = await import("./[id]-QSRIPPIP.js");
|
|
3074
|
+
return {
|
|
3075
|
+
Component: CampaignDetailPage
|
|
3076
|
+
};
|
|
3077
|
+
},
|
|
3078
|
+
children: [
|
|
3079
|
+
{
|
|
3080
|
+
path: "edit",
|
|
3081
|
+
lazy: () => import("./edit-XU33IVZH.js")
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
path: "configuration",
|
|
3085
|
+
lazy: () => import("./configuration-KWAL2QZ5.js")
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
path: "edit-budget",
|
|
3089
|
+
lazy: () => import("./edit-budget-Z5USV462.js")
|
|
3090
|
+
},
|
|
3091
|
+
{
|
|
3092
|
+
path: "add-promotions",
|
|
3093
|
+
lazy: async () => {
|
|
3094
|
+
const { AddPromotionsPage } = await import("./add-promotions-KVKEP6EO.js");
|
|
3095
|
+
return {
|
|
3096
|
+
Component: AddPromotionsPage
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
]
|
|
3101
|
+
}
|
|
3102
|
+
]
|
|
3103
|
+
}
|
|
3104
|
+
]
|
|
3105
|
+
},
|
|
3106
|
+
// PRICE LISTS
|
|
3107
|
+
{
|
|
3108
|
+
path: "/price-lists",
|
|
3109
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3110
|
+
handle: { breadcrumb: () => t("priceLists.domain") },
|
|
3111
|
+
children: [
|
|
3112
|
+
{
|
|
3113
|
+
path: "",
|
|
3114
|
+
lazy: async () => {
|
|
3115
|
+
const { PriceListListPage } = await import("./price-lists-G256JJN7.js");
|
|
3116
|
+
return { Component: PriceListListPage };
|
|
3117
|
+
},
|
|
3118
|
+
children: [
|
|
3119
|
+
{
|
|
3120
|
+
path: "create",
|
|
3121
|
+
lazy: () => import("./create-F7OMPGZV.js")
|
|
3122
|
+
}
|
|
3123
|
+
]
|
|
3124
|
+
},
|
|
3125
|
+
{
|
|
3126
|
+
path: ":id",
|
|
3127
|
+
lazy: async () => {
|
|
3128
|
+
const { loader } = await import("./[id]-ZYF75L6G.js");
|
|
3129
|
+
const { Breadcrumb } = await import("./breadcrumb-3QTVWXZB.js");
|
|
3130
|
+
return {
|
|
3131
|
+
Component: Outlet4,
|
|
3132
|
+
loader,
|
|
3133
|
+
handle: {
|
|
3134
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3135
|
+
}
|
|
3136
|
+
};
|
|
3137
|
+
},
|
|
3138
|
+
children: [
|
|
3139
|
+
{
|
|
3140
|
+
path: "",
|
|
3141
|
+
lazy: async () => {
|
|
3142
|
+
const { PriceListDetailPage } = await import("./[id]-ZYF75L6G.js");
|
|
3143
|
+
return { Component: PriceListDetailPage };
|
|
3144
|
+
},
|
|
3145
|
+
children: [
|
|
3146
|
+
{
|
|
3147
|
+
path: "edit",
|
|
3148
|
+
lazy: () => import("./edit-J6WCPHDS.js")
|
|
3149
|
+
},
|
|
3150
|
+
{
|
|
3151
|
+
path: "configuration",
|
|
3152
|
+
lazy: () => import("./configuration-RNWBTRAH.js")
|
|
3153
|
+
},
|
|
3154
|
+
{
|
|
3155
|
+
path: "products/add",
|
|
3156
|
+
lazy: () => import("./add-KNDQL6YN.js")
|
|
3157
|
+
},
|
|
3158
|
+
{
|
|
3159
|
+
path: "products/edit",
|
|
3160
|
+
lazy: () => import("./edit-MDTTTB33.js")
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
path: "products/:variant_id/edit",
|
|
3164
|
+
lazy: () => import("./edit-RHNZWNXD.js")
|
|
3165
|
+
}
|
|
3166
|
+
]
|
|
3167
|
+
}
|
|
3168
|
+
]
|
|
3169
|
+
}
|
|
3170
|
+
]
|
|
3171
|
+
},
|
|
3172
|
+
// RESERVATIONS - disabled
|
|
3173
|
+
// {
|
|
3174
|
+
// path: "/reservations",
|
|
3175
|
+
// ...
|
|
3176
|
+
// },
|
|
3177
|
+
// PRODUCT VARIANTS (standalone routes)
|
|
3178
|
+
{
|
|
3179
|
+
path: "/products/:product_id/variants/:variant_id",
|
|
3180
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3181
|
+
lazy: async () => {
|
|
3182
|
+
const { loader } = await import("./product-variant-detail-EYTE7PHL.js");
|
|
3183
|
+
return {
|
|
3184
|
+
Component: Outlet4,
|
|
3185
|
+
loader
|
|
3186
|
+
};
|
|
3187
|
+
},
|
|
3188
|
+
children: [
|
|
3189
|
+
{
|
|
3190
|
+
path: "",
|
|
3191
|
+
lazy: () => import("./product-variant-detail-EYTE7PHL.js"),
|
|
3192
|
+
children: [
|
|
3193
|
+
{
|
|
3194
|
+
path: "edit",
|
|
3195
|
+
lazy: async () => {
|
|
3196
|
+
const { ProductVariantEdit } = await import("./product-variant-edit-PW7W5J5E.js");
|
|
3197
|
+
return { Component: ProductVariantEdit };
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
{
|
|
3201
|
+
path: "prices",
|
|
3202
|
+
lazy: () => import("./prices-EW7KBY6R.js")
|
|
3203
|
+
}
|
|
3204
|
+
]
|
|
3205
|
+
}
|
|
3206
|
+
]
|
|
3207
|
+
}
|
|
3208
|
+
],
|
|
3209
|
+
customMainRoutes
|
|
3210
|
+
)
|
|
3211
|
+
}
|
|
3212
|
+
]
|
|
3213
|
+
},
|
|
3214
|
+
// PROTECTED - SETTINGS LAYOUT
|
|
3215
|
+
{
|
|
3216
|
+
element: /* @__PURE__ */ jsx14(ProtectedRoute, {}),
|
|
3217
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3218
|
+
children: [
|
|
3219
|
+
{
|
|
3220
|
+
path: "/settings",
|
|
3221
|
+
element: /* @__PURE__ */ jsx14(SettingsLayout, {}),
|
|
3222
|
+
children: mergeRoutes(
|
|
3223
|
+
[
|
|
3224
|
+
{
|
|
3225
|
+
index: true,
|
|
3226
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3227
|
+
lazy: () => import("./settings-NP2IAID5.js")
|
|
3228
|
+
},
|
|
3229
|
+
// STORE
|
|
3230
|
+
{
|
|
3231
|
+
path: "seller",
|
|
3232
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3233
|
+
handle: {
|
|
3234
|
+
breadcrumb: () => t("seller.domain", "Seller")
|
|
3235
|
+
},
|
|
3236
|
+
children: [
|
|
3237
|
+
{
|
|
3238
|
+
path: "",
|
|
3239
|
+
lazy: async () => {
|
|
3240
|
+
const { SellerDetailPage } = await import("./seller-ZFDLKF5Y.js");
|
|
3241
|
+
return { Component: SellerDetailPage };
|
|
3242
|
+
},
|
|
3243
|
+
children: [
|
|
3244
|
+
{
|
|
3245
|
+
path: "edit",
|
|
3246
|
+
lazy: () => import("./edit-NFSU2K3O.js")
|
|
3247
|
+
}
|
|
3248
|
+
]
|
|
3249
|
+
}
|
|
3250
|
+
]
|
|
3251
|
+
},
|
|
3252
|
+
// LOCATIONS
|
|
3253
|
+
{
|
|
3254
|
+
path: "locations",
|
|
3255
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3256
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3257
|
+
handle: { breadcrumb: () => t("locations.domain") },
|
|
3258
|
+
children: [
|
|
3259
|
+
{
|
|
3260
|
+
path: "",
|
|
3261
|
+
lazy: async () => {
|
|
3262
|
+
const { LocationListPage } = await import("./locations-SQKM7JWN.js");
|
|
3263
|
+
return { Component: LocationListPage };
|
|
3264
|
+
},
|
|
3265
|
+
children: [
|
|
3266
|
+
{
|
|
3267
|
+
path: "create",
|
|
3268
|
+
lazy: () => import("./create-XGF6DB5F.js")
|
|
3269
|
+
}
|
|
3270
|
+
]
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
path: "shipping-profiles",
|
|
3274
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3275
|
+
handle: {
|
|
3276
|
+
breadcrumb: () => t("shippingProfile.domain")
|
|
3277
|
+
},
|
|
3278
|
+
children: [
|
|
3279
|
+
{
|
|
3280
|
+
path: "",
|
|
3281
|
+
lazy: async () => {
|
|
3282
|
+
const { ShippingProfileListPage } = await import("./shipping-profiles-7R6L65WG.js");
|
|
3283
|
+
return { Component: ShippingProfileListPage };
|
|
3284
|
+
},
|
|
3285
|
+
children: [
|
|
3286
|
+
{
|
|
3287
|
+
path: "create",
|
|
3288
|
+
lazy: () => import("./create-7UEEO5TM.js")
|
|
3289
|
+
}
|
|
3290
|
+
]
|
|
3291
|
+
},
|
|
3292
|
+
{
|
|
3293
|
+
path: ":shipping_profile_id",
|
|
3294
|
+
lazy: async () => {
|
|
3295
|
+
const { shippingProfileLoader: loader } = await import("./[id]-MIV4U5UW.js");
|
|
3296
|
+
const {
|
|
3297
|
+
ShippingProfileDetailBreadcrumb: Breadcrumb
|
|
3298
|
+
} = await import("./breadcrumb-CIGKLKKS.js");
|
|
3299
|
+
return {
|
|
3300
|
+
Component: Outlet4,
|
|
3301
|
+
loader,
|
|
3302
|
+
handle: {
|
|
3303
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3304
|
+
}
|
|
3305
|
+
};
|
|
3306
|
+
},
|
|
3307
|
+
children: [
|
|
3308
|
+
{
|
|
3309
|
+
path: "",
|
|
3310
|
+
lazy: async () => {
|
|
3311
|
+
const { ShippingProfileDetailPage } = await import("./[id]-MIV4U5UW.js");
|
|
3312
|
+
return {
|
|
3313
|
+
Component: ShippingProfileDetailPage
|
|
3314
|
+
};
|
|
3315
|
+
},
|
|
3316
|
+
children: [
|
|
3317
|
+
{
|
|
3318
|
+
path: "metadata/edit",
|
|
3319
|
+
lazy: () => import("./metadata-X3XGQ563.js")
|
|
3320
|
+
}
|
|
3321
|
+
]
|
|
3322
|
+
}
|
|
3323
|
+
]
|
|
3324
|
+
}
|
|
3325
|
+
]
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
path: ":location_id",
|
|
3329
|
+
lazy: async () => {
|
|
3330
|
+
const { loader } = await import("./[location_id]-4UIEW5KM.js");
|
|
3331
|
+
const { LocationDetailBreadcrumb: Breadcrumb } = await import("./breadcrumb-6NAAOPIY.js");
|
|
3332
|
+
return {
|
|
3333
|
+
Component: Outlet4,
|
|
3334
|
+
loader,
|
|
3335
|
+
handle: {
|
|
3336
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3337
|
+
}
|
|
3338
|
+
};
|
|
3339
|
+
},
|
|
3340
|
+
children: [
|
|
3341
|
+
{
|
|
3342
|
+
path: "",
|
|
3343
|
+
lazy: async () => {
|
|
3344
|
+
const { LocationDetailPage } = await import("./[location_id]-4UIEW5KM.js");
|
|
3345
|
+
return { Component: LocationDetailPage };
|
|
3346
|
+
},
|
|
3347
|
+
children: [
|
|
3348
|
+
{
|
|
3349
|
+
path: "edit",
|
|
3350
|
+
lazy: () => import("./edit-5BUGSOTL.js")
|
|
3351
|
+
},
|
|
3352
|
+
{
|
|
3353
|
+
path: "sales-channels",
|
|
3354
|
+
lazy: () => import("./sales-channels-MBWVM3X2.js")
|
|
3355
|
+
},
|
|
3356
|
+
{
|
|
3357
|
+
path: "fulfillment-providers",
|
|
3358
|
+
lazy: () => import("./fulfillment-providers-ACERVITQ.js")
|
|
3359
|
+
},
|
|
3360
|
+
{
|
|
3361
|
+
path: "fulfillment-set/:fset_id/service-zones/create",
|
|
3362
|
+
lazy: () => import("./create-IE6MYOIY.js")
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
path: "fulfillment-set/:fset_id/service-zone/:zone_id/edit",
|
|
3366
|
+
lazy: () => import("./edit-BQLSTFTQ.js")
|
|
3367
|
+
},
|
|
3368
|
+
{
|
|
3369
|
+
path: "fulfillment-set/:fset_id/service-zone/:zone_id/areas",
|
|
3370
|
+
lazy: () => import("./areas-Y7VDWH7G.js")
|
|
3371
|
+
},
|
|
3372
|
+
{
|
|
3373
|
+
path: "fulfillment-set/:fset_id/service-zone/:zone_id/shipping-option/create",
|
|
3374
|
+
lazy: () => import("./create-DTCDJMIT.js")
|
|
3375
|
+
},
|
|
3376
|
+
{
|
|
3377
|
+
path: "fulfillment-set/:fset_id/service-zone/:zone_id/shipping-option/:so_id/edit",
|
|
3378
|
+
lazy: () => import("./edit-DG3MY3ZH.js")
|
|
3379
|
+
},
|
|
3380
|
+
{
|
|
3381
|
+
path: "fulfillment-set/:fset_id/service-zone/:zone_id/shipping-option/:so_id/pricing",
|
|
3382
|
+
lazy: () => import("./pricing-3PUJDOZN.js")
|
|
3383
|
+
}
|
|
3384
|
+
]
|
|
3385
|
+
}
|
|
3386
|
+
]
|
|
3387
|
+
}
|
|
3388
|
+
]
|
|
3389
|
+
},
|
|
3390
|
+
// TAX REGIONS
|
|
3391
|
+
{
|
|
3392
|
+
path: "tax-regions",
|
|
3393
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3394
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3395
|
+
handle: { breadcrumb: () => t("taxRegions.domain") },
|
|
3396
|
+
children: [
|
|
3397
|
+
{
|
|
3398
|
+
path: "",
|
|
3399
|
+
lazy: () => import("./tax-regions-V6G6244H.js"),
|
|
3400
|
+
children: [
|
|
3401
|
+
{
|
|
3402
|
+
path: "create",
|
|
3403
|
+
lazy: () => import("./create-L23TGTBH.js")
|
|
3404
|
+
}
|
|
3405
|
+
]
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
path: ":id",
|
|
3409
|
+
lazy: async () => {
|
|
3410
|
+
const { Component, Breadcrumb, loader } = await import("./[id]-A4FSDRER.js");
|
|
3411
|
+
return {
|
|
3412
|
+
Component,
|
|
3413
|
+
loader,
|
|
3414
|
+
handle: {
|
|
3415
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
},
|
|
3419
|
+
children: [
|
|
3420
|
+
{
|
|
3421
|
+
path: "tax-rates/create",
|
|
3422
|
+
lazy: () => import("./create-YPCVTXAK.js")
|
|
3423
|
+
},
|
|
3424
|
+
{
|
|
3425
|
+
path: "tax-rates/:tax_rate_id/edit",
|
|
3426
|
+
lazy: () => import("./edit-7LQATDUD.js")
|
|
3427
|
+
},
|
|
3428
|
+
{
|
|
3429
|
+
path: "tax-overrides/create",
|
|
3430
|
+
lazy: () => import("./create-DYDRAY6V.js")
|
|
3431
|
+
},
|
|
3432
|
+
{
|
|
3433
|
+
path: "tax-overrides/:tax_rate_id/edit",
|
|
3434
|
+
lazy: () => import("./edit-2QA5BVOY.js")
|
|
3435
|
+
},
|
|
3436
|
+
{
|
|
3437
|
+
path: "provinces/create",
|
|
3438
|
+
lazy: () => import("./create-ZU362U3B.js")
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
path: "provinces/:province_id",
|
|
3442
|
+
lazy: async () => {
|
|
3443
|
+
const { Component, Breadcrumb, loader } = await import("./[province_id]-ZCHPXXQN.js");
|
|
3444
|
+
return {
|
|
3445
|
+
Component,
|
|
3446
|
+
loader,
|
|
3447
|
+
handle: {
|
|
3448
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3449
|
+
}
|
|
3450
|
+
};
|
|
3451
|
+
},
|
|
3452
|
+
children: [
|
|
3453
|
+
{
|
|
3454
|
+
path: "tax-rates/create",
|
|
3455
|
+
lazy: () => import("./create-YPCVTXAK.js")
|
|
3456
|
+
},
|
|
3457
|
+
{
|
|
3458
|
+
path: "tax-rates/:tax_rate_id/edit",
|
|
3459
|
+
lazy: () => import("./edit-7LQATDUD.js")
|
|
3460
|
+
},
|
|
3461
|
+
{
|
|
3462
|
+
path: "tax-overrides/create",
|
|
3463
|
+
lazy: () => import("./create-DYDRAY6V.js")
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
path: "tax-overrides/:tax_rate_id/edit",
|
|
3467
|
+
lazy: () => import("./edit-2QA5BVOY.js")
|
|
3468
|
+
}
|
|
3469
|
+
]
|
|
3470
|
+
}
|
|
3471
|
+
]
|
|
3472
|
+
}
|
|
3473
|
+
]
|
|
3474
|
+
},
|
|
3475
|
+
// PRODUCT TAGS
|
|
3476
|
+
{
|
|
3477
|
+
path: "product-tags",
|
|
3478
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3479
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3480
|
+
handle: { breadcrumb: () => t("productTags.domain") },
|
|
3481
|
+
children: [
|
|
3482
|
+
{
|
|
3483
|
+
path: "",
|
|
3484
|
+
lazy: async () => {
|
|
3485
|
+
const { ProductTagListPage } = await import("./product-tags-PI3RENEX.js");
|
|
3486
|
+
return { Component: ProductTagListPage };
|
|
3487
|
+
}
|
|
3488
|
+
},
|
|
3489
|
+
{
|
|
3490
|
+
path: ":id",
|
|
3491
|
+
lazy: async () => {
|
|
3492
|
+
const { loader } = await import("./[id]-U5DT2ZLS.js");
|
|
3493
|
+
const { ProductTagDetailBreadcrumb: Breadcrumb } = await import("./breadcrumb-TZB6EWNC.js");
|
|
3494
|
+
return {
|
|
3495
|
+
Component: Outlet4,
|
|
3496
|
+
loader,
|
|
3497
|
+
handle: {
|
|
3498
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
},
|
|
3502
|
+
children: [
|
|
3503
|
+
{
|
|
3504
|
+
path: "",
|
|
3505
|
+
lazy: async () => {
|
|
3506
|
+
const { ProductTagDetailPage } = await import("./[id]-U5DT2ZLS.js");
|
|
3507
|
+
return { Component: ProductTagDetailPage };
|
|
3508
|
+
},
|
|
3509
|
+
children: [
|
|
3510
|
+
{
|
|
3511
|
+
path: "edit",
|
|
3512
|
+
lazy: () => import("./edit-KCZVZLSZ.js")
|
|
3513
|
+
}
|
|
3514
|
+
]
|
|
3515
|
+
}
|
|
3516
|
+
]
|
|
3517
|
+
}
|
|
3518
|
+
]
|
|
3519
|
+
},
|
|
3520
|
+
// PRODUCT TYPES
|
|
3521
|
+
{
|
|
3522
|
+
path: "product-types",
|
|
3523
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3524
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3525
|
+
handle: { breadcrumb: () => t("productTypes.domain") },
|
|
3526
|
+
children: [
|
|
3527
|
+
{
|
|
3528
|
+
path: "",
|
|
3529
|
+
lazy: async () => {
|
|
3530
|
+
const { ProductTypeListPage } = await import("./product-types-WJPLJI7H.js");
|
|
3531
|
+
return { Component: ProductTypeListPage };
|
|
3532
|
+
},
|
|
3533
|
+
children: [
|
|
3534
|
+
// TODO: Enable when request product type flow is implemented
|
|
3535
|
+
// {
|
|
3536
|
+
// path: "create",
|
|
3537
|
+
// lazy: () =>
|
|
3538
|
+
// import("./pages/settings/product-types/create"),
|
|
3539
|
+
// },
|
|
3540
|
+
]
|
|
3541
|
+
},
|
|
3542
|
+
{
|
|
3543
|
+
path: ":id",
|
|
3544
|
+
lazy: async () => {
|
|
3545
|
+
const { productTypeLoader: loader } = await import("./[id]-E45G2SDA.js");
|
|
3546
|
+
const { ProductTypeDetailBreadcrumb: Breadcrumb } = await import("./breadcrumb-LIXGWUQF.js");
|
|
3547
|
+
return {
|
|
3548
|
+
Component: Outlet4,
|
|
3549
|
+
loader,
|
|
3550
|
+
handle: {
|
|
3551
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx14(Breadcrumb, { ...match })
|
|
3552
|
+
}
|
|
3553
|
+
};
|
|
3554
|
+
},
|
|
3555
|
+
children: [
|
|
3556
|
+
{
|
|
3557
|
+
path: "",
|
|
3558
|
+
lazy: async () => {
|
|
3559
|
+
const { ProductTypeDetailPage } = await import("./[id]-E45G2SDA.js");
|
|
3560
|
+
return { Component: ProductTypeDetailPage };
|
|
3561
|
+
},
|
|
3562
|
+
children: [
|
|
3563
|
+
{
|
|
3564
|
+
path: "edit",
|
|
3565
|
+
lazy: () => import("./edit-ZMINDMGM.js")
|
|
3566
|
+
}
|
|
3567
|
+
]
|
|
3568
|
+
}
|
|
3569
|
+
]
|
|
3570
|
+
}
|
|
3571
|
+
]
|
|
3572
|
+
},
|
|
3573
|
+
// RETURN REASONS
|
|
3574
|
+
{
|
|
3575
|
+
path: "return-reasons",
|
|
3576
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3577
|
+
element: /* @__PURE__ */ jsx14(Outlet4, {}),
|
|
3578
|
+
handle: { breadcrumb: () => t("returnReasons.domain") },
|
|
3579
|
+
children: [
|
|
3580
|
+
{
|
|
3581
|
+
path: "",
|
|
3582
|
+
lazy: () => import("./return-reasons-4V2KVSRI.js"),
|
|
3583
|
+
children: [
|
|
3584
|
+
{
|
|
3585
|
+
path: "create",
|
|
3586
|
+
lazy: () => import("./create-TFDUNJSI.js")
|
|
3587
|
+
},
|
|
3588
|
+
{
|
|
3589
|
+
path: ":id/edit",
|
|
3590
|
+
lazy: () => import("./edit-47I7VVNB.js")
|
|
3591
|
+
}
|
|
3592
|
+
]
|
|
3593
|
+
}
|
|
3594
|
+
]
|
|
3595
|
+
}
|
|
3596
|
+
],
|
|
3597
|
+
customSettingsRoutes?.[0]?.children || []
|
|
3598
|
+
)
|
|
3599
|
+
}
|
|
3600
|
+
]
|
|
3601
|
+
},
|
|
3602
|
+
// PUBLIC LAYOUT
|
|
3603
|
+
{
|
|
3604
|
+
element: /* @__PURE__ */ jsx14(PublicLayout, {}),
|
|
3605
|
+
children: [
|
|
3606
|
+
{
|
|
3607
|
+
errorElement: /* @__PURE__ */ jsx14(ErrorBoundary, {}),
|
|
3608
|
+
children: [
|
|
3609
|
+
{
|
|
3610
|
+
path: "/login",
|
|
3611
|
+
lazy: async () => {
|
|
3612
|
+
const { LoginPage } = await import("./login-LKFCRHXN.js");
|
|
3613
|
+
return { Component: LoginPage };
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
path: "/reset-password",
|
|
3618
|
+
lazy: () => import("./reset-password-OFUSH363.js")
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
path: "*",
|
|
3622
|
+
lazy: () => import("./no-match-BO2NNLCM.js")
|
|
3623
|
+
}
|
|
3624
|
+
]
|
|
3625
|
+
}
|
|
3626
|
+
]
|
|
3627
|
+
}
|
|
3628
|
+
];
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
// src/app.tsx
|
|
3632
|
+
import { useMemo as useMemo5 } from "react";
|
|
3633
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3634
|
+
function App() {
|
|
3635
|
+
const routes = useMemo5(() => {
|
|
3636
|
+
return {
|
|
3637
|
+
settingsRoutes: createRouteMap(getRoutesByType(customRoutes, "settings")),
|
|
3638
|
+
mainRoutes: createRouteMap(getRoutesByType(customRoutes, "main"))
|
|
3639
|
+
};
|
|
3640
|
+
}, [customRoutes]);
|
|
3641
|
+
return /* @__PURE__ */ jsx15(TooltipProvider, { children: /* @__PURE__ */ jsx15(HelmetProvider, { children: /* @__PURE__ */ jsx15(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs9(ThemeProvider, { children: [
|
|
3642
|
+
/* @__PURE__ */ jsx15(I18n, {}),
|
|
3643
|
+
/* @__PURE__ */ jsx15(I18nProvider, { children: /* @__PURE__ */ jsx15(
|
|
3644
|
+
RouterProvider,
|
|
3645
|
+
{
|
|
3646
|
+
router: createBrowserRouter(getRouteMap(routes))
|
|
3647
|
+
}
|
|
3648
|
+
) }),
|
|
3649
|
+
/* @__PURE__ */ jsx15(Toaster, {})
|
|
3650
|
+
] }) }) }) });
|
|
3651
|
+
}
|
|
3652
|
+
export {
|
|
3653
|
+
TabbedForm,
|
|
3654
|
+
App as default,
|
|
3655
|
+
useTabbedForm
|
|
3656
|
+
};
|