@mercurjs/admin 2.3.6-canary.5 → 2.3.6-canary.6
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/{api-key-management-detail-P5C3F2D7.js → api-key-management-detail-ULNXV7YJ.js} +2 -2
- package/dist/{api-key-management-list-XV66E2LA.js → api-key-management-list-KPWCB7NX.js} +2 -2
- package/dist/attribute-list-FLTRNSFI.js +1 -1
- package/dist/{campaign-detail-4IEM5BGI.js → campaign-detail-WBWGUSMW.js} +2 -2
- package/dist/{campaign-list-ZRUBHJEA.js → campaign-list-M24QK43I.js} +2 -2
- package/dist/category-detail-3YY7FVY4.js +2 -2
- package/dist/{category-list-LESUC6ZK.js → category-list-AT66O7HI.js} +2 -2
- package/dist/{chunk-AZMXFIDY.js → chunk-7Y7YN7KG.js} +4 -4
- package/dist/{chunk-6ZMSV6PN.js → chunk-B4MSCLHO.js} +1 -1
- package/dist/{chunk-DUFGVZ6H.js → chunk-G4L2EPKT.js} +2 -2
- package/dist/{chunk-GDFMWKL6.js → chunk-HBQ7EHHM.js} +1 -1
- package/dist/{chunk-O3RDRDCO.js → chunk-QOMIRTO4.js} +4 -4
- package/dist/chunk-RX7RU7VV.js +2852 -0
- package/dist/{chunk-HGFMHWPB.js → chunk-SJEMUTO2.js} +1 -1
- package/dist/{chunk-RFENVF7Y.js → chunk-TXEOM3WC.js} +3 -3
- package/dist/{chunk-YM5X7CQL.js → chunk-VWK3K2CI.js} +4 -4
- package/dist/{chunk-VYSTJIAD.js → chunk-ZSXF4PEE.js} +1 -1
- package/dist/{collection-detail-CTXO7RMM.js → collection-detail-N7VZKBIJ.js} +3 -3
- package/dist/{collection-list-MWXFS7UY.js → collection-list-QQJAESFN.js} +3 -3
- package/dist/{commission-rule-detail-LFEZ5U6V.js → commission-rule-detail-CIE6TPXW.js} +2 -2
- package/dist/{commissions-list-PQUFPRZK.js → commissions-list-US6OMDVL.js} +2 -2
- package/dist/{customer-detail-ZYETGMFF.js → customer-detail-CGKGZE2N.js} +2 -2
- package/dist/{customer-group-detail-RPDRZGPZ.js → customer-group-detail-JMBR3D72.js} +2 -2
- package/dist/{customer-group-list-MZ7H4XLD.js → customer-group-list-GYEQ2GTL.js} +2 -2
- package/dist/{customer-list-46W5PJR3.js → customer-list-6X6RQDLK.js} +2 -2
- package/dist/home-RT4EIJFM.js +64 -0
- package/dist/index.js +415 -3196
- package/dist/{inventory-detail-MMONC625.js → inventory-detail-PMJN4E2D.js} +3 -3
- package/dist/{inventory-list-FN7FCI4W.js → inventory-list-XS3OFHLW.js} +2 -2
- package/dist/{location-detail-74247BA4.js → location-detail-DKBNATDD.js} +2 -2
- package/dist/location-list-JJN42JSH.js +1 -1
- package/dist/{marketplace-detail-JSUMZVZS.js → marketplace-detail-UYBZIFQW.js} +2 -2
- package/dist/{offers-6MDVGCJK.js → offers-RS4UORI3.js} +3 -3
- package/dist/{order-detail-U3HDRBBG.js → order-detail-XYHRY25Y.js} +3 -3
- package/dist/pages/index.js +53 -53
- package/dist/{price-list-create-RNVWVB5D.js → price-list-create-DRKZIV2D.js} +3 -3
- package/dist/{price-list-detail-WHJKFDYZ.js → price-list-detail-AML5XNDJ.js} +4 -4
- package/dist/{price-list-list-AM2GMQ7P.js → price-list-list-FPCLLS33.js} +2 -2
- package/dist/{price-list-prices-add-ZDKNOJRU.js → price-list-prices-add-HAYZV2XV.js} +3 -3
- package/dist/product-add-existing-attributes-VWM3LNIO.js +1 -1
- package/dist/{product-create-NVAKRIPS.js → product-create-73WXVANY.js} +2 -2
- package/dist/{product-detail-DZRYNPRT.js → product-detail-ZKQXB7PH.js} +3 -3
- package/dist/product-list-SYMPZR6W.js +2 -2
- package/dist/{product-tag-detail-HM2AWFGU.js → product-tag-detail-Q3CKJBVX.js} +3 -3
- package/dist/{product-tag-list-OBV7CZZL.js → product-tag-list-BNNJS67H.js} +3 -3
- package/dist/{product-type-detail-D3OYCXGR.js → product-type-detail-WZLA27WI.js} +3 -3
- package/dist/{product-type-list-LCLWJPIT.js → product-type-list-PAAE6ZSR.js} +2 -2
- package/dist/product-variant-detail-7B26FRNG.js +1 -1
- package/dist/{profile-detail-TQWGKYRK.js → profile-detail-GDQQJUWF.js} +2 -2
- package/dist/{promotion-detail-IC5LHRSY.js → promotion-detail-HOXUK5VG.js} +2 -2
- package/dist/{promotion-list-TVTDBBJ3.js → promotion-list-LJKKLZNU.js} +2 -2
- package/dist/{region-detail-IBLHFR57.js → region-detail-YTB7OEQU.js} +2 -2
- package/dist/{region-list-JTR3SEWI.js → region-list-JP3CZISQ.js} +2 -2
- package/dist/{reservation-detail-OCIIVYIN.js → reservation-detail-M42OB6BC.js} +2 -2
- package/dist/{reservation-list-JQFVSRW5.js → reservation-list-FQAWE7S5.js} +2 -2
- package/dist/return-reason-list-PKAJDA6A.js +1 -1
- package/dist/{review-list-E56WE7VS.js → review-list-5NGJJH23.js} +2 -2
- package/dist/sales-channel-detail-7GAGHWEP.js +2 -2
- package/dist/sales-channel-list-BCL62DTX.js +1 -1
- package/dist/{shipping-option-type-detail-BKMYJMQY.js → shipping-option-type-detail-2VDQWYDS.js} +2 -2
- package/dist/{shipping-option-type-list-R76AQI26.js → shipping-option-type-list-2XUYXURQ.js} +2 -2
- package/dist/{shipping-profile-detail-KPRFJE4V.js → shipping-profile-detail-7SE5GLQZ.js} +2 -2
- package/dist/{shipping-profiles-list-W25ZUWGV.js → shipping-profiles-list-GC6AK77V.js} +2 -2
- package/dist/{store-details-5FBLCWOV.js → store-details-MPTCI4VG.js} +4 -4
- package/dist/{store-list-MAT74WSB.js → store-list-LPKSZF2E.js} +2 -2
- package/dist/{tax-region-detail-O4DZFMT5.js → tax-region-detail-3CMIPIKA.js} +5 -5
- package/dist/{tax-region-list-ETNXAC2A.js → tax-region-list-U5JRCQZI.js} +4 -4
- package/dist/{tax-region-province-detail-LOOLLFNO.js → tax-region-province-detail-XTPJ6DZZ.js} +4 -4
- package/dist/{user-detail-MJ3ITMNK.js → user-detail-RD3T5WQT.js} +2 -2
- package/dist/{user-list-6IYBI6HY.js → user-list-X6UZ6UZM.js} +2 -2
- package/package.json +6 -6
- package/dist/home-I3OILW5Z.js +0 -16
- package/dist/{api-key-management-sales-channels-FS3KXQQ6.js → api-key-management-sales-channels-RBK66ZGC.js} +1 -1
- package/dist/{attribute-detail-KUJ337KW.js → attribute-detail-7PIMBKEE.js} +3 -3
- package/dist/{chunk-QK3HIMET.js → chunk-2IPSJDRD.js} +3 -3
- package/dist/{chunk-5EGLQSSH.js → chunk-36C3CNJC.js} +3 -3
- package/dist/{chunk-5VHQX7Q3.js → chunk-3CLWBE4O.js} +3 -3
- package/dist/{chunk-24JEBPKI.js → chunk-3JXOVOJI.js} +3 -3
- package/dist/{chunk-S4WDCOQD.js → chunk-4CYHJ72Y.js} +3 -3
- package/dist/{chunk-ZFPASY4R.js → chunk-4EQSS3YZ.js} +3 -3
- package/dist/{chunk-FS4E6GS6.js → chunk-4OCANHUL.js} +3 -3
- package/dist/{chunk-YHWDMARX.js → chunk-4RKWEFNY.js} +3 -3
- package/dist/{chunk-PFQO7UQG.js → chunk-545HIUP3.js} +3 -3
- package/dist/{chunk-DJ73BQSS.js → chunk-5H4KS6M3.js} +3 -3
- package/dist/{chunk-XGB456O5.js → chunk-5KTSSLBG.js} +3 -3
- package/dist/{chunk-EWDBPCX7.js → chunk-5LK5NAGN.js} +3 -3
- package/dist/{chunk-UXA6RZMP.js → chunk-7SHPS72O.js} +3 -3
- package/dist/{chunk-MQFPD5J4.js → chunk-AJCCPN5R.js} +3 -3
- package/dist/{chunk-26WXQ6LI.js → chunk-AUTG5JEE.js} +3 -3
- package/dist/{chunk-7ASAC2FM.js → chunk-B6XGTGMP.js} +3 -3
- package/dist/{chunk-OZKHBVDV.js → chunk-BVKPOXLT.js} +3 -3
- package/dist/{chunk-LXW3L56Z.js → chunk-CBLCX5UK.js} +3 -3
- package/dist/{chunk-KYVPZH3D.js → chunk-ESVFENTS.js} +3 -3
- package/dist/{chunk-JCRDVMIA.js → chunk-FV7B2OWJ.js} +3 -3
- package/dist/{chunk-DDZPK7BW.js → chunk-GWOZSV7A.js} +3 -3
- package/dist/{chunk-XXYVUV5F.js → chunk-HUJIVGX3.js} +3 -3
- package/dist/{chunk-LFFWPZQK.js → chunk-IAMX7JMM.js} +3 -3
- package/dist/{chunk-AGQ2BWD4.js → chunk-JODADMJ6.js} +3 -3
- package/dist/{chunk-I6HCTKMK.js → chunk-L3GVDREC.js} +3 -3
- package/dist/{chunk-ZGNLAPV6.js → chunk-LMBIFEA5.js} +3 -3
- package/dist/{chunk-VC2GAWL4.js → chunk-MKVEDGJ2.js} +3 -3
- package/dist/{chunk-G7444ISU.js → chunk-NOK2356Y.js} +3 -3
- package/dist/{chunk-FCOYAYQE.js → chunk-NUMVOUQQ.js} +3 -3
- package/dist/{chunk-NIDM2VQO.js → chunk-PH7TEL5B.js} +3 -3
- package/dist/{chunk-GR7S7WTT.js → chunk-QFYTIG3H.js} +3 -3
- package/dist/{chunk-5CKBM4RI.js → chunk-QPHY3XXC.js} +3 -3
- package/dist/{chunk-XAF7FKWZ.js → chunk-T3AKFW7T.js} +3 -3
- package/dist/{chunk-V6UH5UQT.js → chunk-TN3HCAJ2.js} +3 -3
- package/dist/{chunk-DOEBGZMA.js → chunk-UFFLSUK4.js} +3 -3
- package/dist/{chunk-IKDIEJZC.js → chunk-UZ2FWDJO.js} +3 -3
- package/dist/{chunk-XABVCD7R.js → chunk-VKDZAXLK.js} +3 -3
- package/dist/{chunk-ACEEFNIX.js → chunk-VM35P6LF.js} +3 -3
- package/dist/{chunk-LBFX6AVE.js → chunk-WJPWYQYV.js} +3 -3
- package/dist/{chunk-7QZFRDTU.js → chunk-X22JPPG6.js} +3 -3
- package/dist/{chunk-VTXMQTXK.js → chunk-YJJ6YXFA.js} +3 -3
- package/dist/{chunk-IHTYHAOC.js → chunk-ZPNRNL4X.js} +3 -3
- package/dist/{invite-6WUERQLW.js → invite-IZ2YTVPF.js} +1 -1
- package/dist/{location-sales-channels-TNP3C7UW.js → location-sales-channels-FT6TFVXJ.js} +1 -1
- package/dist/{login-2NBVRH4U.js → login-72TAMW53.js} +1 -1
- package/dist/{offer-detail-page-JGS52M66.js → offer-detail-page-XU6XK6YR.js} +4 -4
- package/dist/{order-create-claim-4CIL76V5.js → order-create-claim-PPUQXVYH.js} +3 -3
- package/dist/{order-create-edit-BFE4N7RN.js → order-create-edit-QH25BOIU.js} +3 -3
- package/dist/{order-create-exchange-CBQ5PA6M.js → order-create-exchange-5PCJ25LK.js} +3 -3
- package/dist/{order-create-return-USO7AS7R.js → order-create-return-ECGHPLEZ.js} +3 -3
- package/dist/{refund-reason-list-G5QJEYPW.js → refund-reason-list-3YLXKHJX.js} +2 -2
- package/dist/{user-invite-YVLFH6HU.js → user-invite-4JFF3NRW.js} +6 -6
package/dist/index.js
CHANGED
|
@@ -3,11 +3,25 @@ import {
|
|
|
3
3
|
taxRegionLoader
|
|
4
4
|
} from "./chunk-ASFCRSBA.js";
|
|
5
5
|
import "./chunk-QR3GYYX6.js";
|
|
6
|
-
import {
|
|
7
|
-
isClientError
|
|
8
|
-
} from "./chunk-C6SUTRP2.js";
|
|
9
6
|
import "./chunk-FMFVTERD.js";
|
|
10
7
|
import "./chunk-JRTZWK77.js";
|
|
8
|
+
import {
|
|
9
|
+
ErrorBoundary,
|
|
10
|
+
MainLayout,
|
|
11
|
+
NavItem,
|
|
12
|
+
SearchProvider,
|
|
13
|
+
Shell,
|
|
14
|
+
SidebarProvider,
|
|
15
|
+
ThemeProvider,
|
|
16
|
+
UserMenu,
|
|
17
|
+
createRouteMap,
|
|
18
|
+
filterMenuItemsByPermissions,
|
|
19
|
+
getMenuItemsByType,
|
|
20
|
+
getRoutePermission,
|
|
21
|
+
getRoutesByType,
|
|
22
|
+
useExpandedSidebar
|
|
23
|
+
} from "./chunk-RX7RU7VV.js";
|
|
24
|
+
import "./chunk-C6SUTRP2.js";
|
|
11
25
|
import {
|
|
12
26
|
TabbedForm,
|
|
13
27
|
defineTabMeta,
|
|
@@ -35,2969 +49,174 @@ import {
|
|
|
35
49
|
PRODUCT_DETAIL_FIELDS,
|
|
36
50
|
PRODUCT_DETAIL_QUERY
|
|
37
51
|
} from "./chunk-6BAPAIQM.js";
|
|
38
|
-
import {
|
|
39
|
-
Thumbnail
|
|
40
|
-
} from "./chunk-U3I6S3RO.js";
|
|
41
52
|
import {
|
|
42
53
|
SingleColumnPage
|
|
43
|
-
} from "./chunk-H6MYB7GB.js";
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import
|
|
46
|
-
_DataTable,
|
|
47
|
-
useDataTable
|
|
48
|
-
} from "./chunk-ZOU25JF6.js";
|
|
49
|
-
import "./chunk-YN3FGNJM.js";
|
|
50
|
-
import "./chunk-ZAOEFQ6K.js";
|
|
51
|
-
import "./chunk-IKAUNMRC.js";
|
|
52
|
-
import "./chunk-EIWPJWKF.js";
|
|
53
|
-
import "./chunk-46WEBDVJ.js";
|
|
54
|
-
import {
|
|
55
|
-
useProductTags
|
|
56
|
-
} from "./chunk-W5U6NPSN.js";
|
|
57
|
-
import {
|
|
58
|
-
useLogout
|
|
59
|
-
} from "./chunk-DSQRFZCO.js";
|
|
60
|
-
import "./chunk-LHE6LM6S.js";
|
|
61
|
-
import "./chunk-BOPIWKTU.js";
|
|
62
|
-
import "./chunk-ALJIXUKL.js";
|
|
63
|
-
import "./chunk-QWT3GCLC.js";
|
|
64
|
-
import "./chunk-EVNTT2M3.js";
|
|
65
|
-
import "./chunk-AQHEU7OA.js";
|
|
66
|
-
import "./chunk-JW5SGRFC.js";
|
|
67
|
-
import {
|
|
68
|
-
useProductTypes
|
|
69
|
-
} from "./chunk-AEBQQ2EG.js";
|
|
70
|
-
import "./chunk-CMVQ5SAG.js";
|
|
71
|
-
import {
|
|
72
|
-
useMe
|
|
73
|
-
} from "./chunk-62YRQVR7.js";
|
|
74
|
-
import "./chunk-2SCR7R3C.js";
|
|
75
|
-
import "./chunk-YMMREB3P.js";
|
|
76
|
-
import "./chunk-UNS2F7DK.js";
|
|
77
|
-
import {
|
|
78
|
-
usePriceLists
|
|
79
|
-
} from "./chunk-56XMCNDS.js";
|
|
80
|
-
import {
|
|
81
|
-
useCollections
|
|
82
|
-
} from "./chunk-I4WBDDWN.js";
|
|
83
|
-
import {
|
|
84
|
-
useStore
|
|
85
|
-
} from "./chunk-3JN6NCCN.js";
|
|
86
|
-
import "./chunk-FHZHKIWI.js";
|
|
87
|
-
import {
|
|
88
|
-
useCampaigns,
|
|
89
|
-
usePromotions
|
|
90
|
-
} from "./chunk-E5PC2WDZ.js";
|
|
91
|
-
import "./chunk-SCLV2T6Z.js";
|
|
92
|
-
import {
|
|
93
|
-
useStockLocations
|
|
94
|
-
} from "./chunk-H5E3CGD7.js";
|
|
95
|
-
import "./chunk-S7TEUVP7.js";
|
|
96
|
-
import {
|
|
97
|
-
useOrders
|
|
98
|
-
} from "./chunk-DYCCRR7B.js";
|
|
99
|
-
import "./chunk-OQ2J45XW.js";
|
|
100
|
-
import {
|
|
101
|
-
useCustomers
|
|
102
|
-
} from "./chunk-XWOFQSGH.js";
|
|
103
|
-
import {
|
|
104
|
-
useSellers
|
|
105
|
-
} from "./chunk-HRMANL53.js";
|
|
106
|
-
import {
|
|
107
|
-
ActionMenu
|
|
108
|
-
} from "./chunk-BDGZ4EQO.js";
|
|
109
|
-
import "./chunk-JC2FFAMW.js";
|
|
110
|
-
import "./chunk-OFW63WXL.js";
|
|
111
|
-
import {
|
|
112
|
-
useProductCategories
|
|
113
|
-
} from "./chunk-SQ7J4KTS.js";
|
|
114
|
-
import {
|
|
115
|
-
ConditionalTooltip
|
|
116
|
-
} from "./chunk-LAVHRER2.js";
|
|
117
|
-
import {
|
|
118
|
-
useDocumentDirection
|
|
119
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
120
|
-
import {
|
|
121
|
-
Skeleton
|
|
122
|
-
} from "./chunk-INNFZYX2.js";
|
|
123
|
-
import {
|
|
124
|
-
useInventoryItems,
|
|
125
|
-
useProducts
|
|
126
|
-
} from "./chunk-Z476HUMI.js";
|
|
127
|
-
import {
|
|
128
|
-
queryClient
|
|
129
|
-
} from "./chunk-RHKRREUU.js";
|
|
130
|
-
import "./chunk-ZA2KFUFR.js";
|
|
131
|
-
import {
|
|
132
|
-
fetchQuery
|
|
133
|
-
} from "./chunk-DTGEFKK4.js";
|
|
134
|
-
import "./chunk-NBMM2TZK.js";
|
|
135
|
-
|
|
136
|
-
// src/app.tsx
|
|
137
|
-
import { customRoutes } from "virtual:mercur/routes";
|
|
138
|
-
import widgets from "virtual:mercur/widgets";
|
|
139
|
-
import navigation from "virtual:mercur/navigation";
|
|
140
|
-
import customFields from "virtual:mercur/custom-fields";
|
|
141
|
-
import { HelmetProvider } from "react-helmet-async";
|
|
142
|
-
import { QueryClientProvider } from "@tanstack/react-query";
|
|
143
|
-
import { ExtensionProvider } from "@mercurjs/dashboard-shared";
|
|
144
|
-
|
|
145
|
-
// src/providers/theme-provider/theme-provider.tsx
|
|
146
|
-
import { useEffect, useState } from "react";
|
|
147
|
-
|
|
148
|
-
// src/providers/theme-provider/theme-context.tsx
|
|
149
|
-
import { createContext } from "react";
|
|
150
|
-
var ThemeContext = createContext(null);
|
|
151
|
-
|
|
152
|
-
// src/providers/theme-provider/theme-provider.tsx
|
|
153
|
-
import { jsx } from "react/jsx-runtime";
|
|
154
|
-
var THEME_KEY = "medusa_admin_theme";
|
|
155
|
-
function getDefaultValue() {
|
|
156
|
-
const persisted = localStorage?.getItem(THEME_KEY);
|
|
157
|
-
if (persisted) {
|
|
158
|
-
return persisted;
|
|
159
|
-
}
|
|
160
|
-
return "system";
|
|
161
|
-
}
|
|
162
|
-
function getThemeValue(selected) {
|
|
163
|
-
if (selected === "system") {
|
|
164
|
-
if (window !== void 0) {
|
|
165
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
166
|
-
}
|
|
167
|
-
return "light";
|
|
168
|
-
}
|
|
169
|
-
return selected;
|
|
170
|
-
}
|
|
171
|
-
var ThemeProvider = ({ children }) => {
|
|
172
|
-
const [state, setState] = useState(getDefaultValue());
|
|
173
|
-
const [value, setValue] = useState(getThemeValue(state));
|
|
174
|
-
const setTheme = (theme) => {
|
|
175
|
-
localStorage.setItem(THEME_KEY, theme);
|
|
176
|
-
const themeValue = getThemeValue(theme);
|
|
177
|
-
setState(theme);
|
|
178
|
-
setValue(themeValue);
|
|
179
|
-
};
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
const html = document.querySelector("html");
|
|
182
|
-
if (html) {
|
|
183
|
-
const css = document.createElement("style");
|
|
184
|
-
css.appendChild(
|
|
185
|
-
document.createTextNode(
|
|
186
|
-
`* {
|
|
187
|
-
-webkit-transition: none !important;
|
|
188
|
-
-moz-transition: none !important;
|
|
189
|
-
-o-transition: none !important;
|
|
190
|
-
-ms-transition: none !important;
|
|
191
|
-
transition: none !important;
|
|
192
|
-
}`
|
|
193
|
-
)
|
|
194
|
-
);
|
|
195
|
-
document.head.appendChild(css);
|
|
196
|
-
html.classList.remove(value === "light" ? "dark" : "light");
|
|
197
|
-
html.classList.add(value);
|
|
198
|
-
html.style.colorScheme = value;
|
|
199
|
-
void window.getComputedStyle(css).opacity;
|
|
200
|
-
document.head.removeChild(css);
|
|
201
|
-
}
|
|
202
|
-
}, [value]);
|
|
203
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme: state, setTheme }, children });
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// src/providers/theme-provider/use-theme.tsx
|
|
207
|
-
import { useContext } from "react";
|
|
208
|
-
var useTheme = () => {
|
|
209
|
-
const context = useContext(ThemeContext);
|
|
210
|
-
if (!context) {
|
|
211
|
-
throw new Error("useTheme must be used within a ThemeProvider");
|
|
212
|
-
}
|
|
213
|
-
return context;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// src/providers/sidebar-provider/index.ts
|
|
217
|
-
import {
|
|
218
|
-
SIDEBAR_MENU_CONTENT,
|
|
219
|
-
SIDEBAR_RAIL_FADE,
|
|
220
|
-
SidebarProvider,
|
|
221
|
-
useCollapsedSidebar,
|
|
222
|
-
useExpandedSidebar,
|
|
223
|
-
useSidebar,
|
|
224
|
-
useSidebarMenuPlacement
|
|
225
|
-
} from "@mercurjs/dashboard-shared";
|
|
226
|
-
|
|
227
|
-
// src/providers/keybind-provider/hooks.tsx
|
|
228
|
-
import { default as debounceFn } from "lodash.debounce";
|
|
229
|
-
import { useCallback, useContext as useContext2, useEffect as useEffect2, useState as useState2 } from "react";
|
|
230
|
-
import { useTranslation } from "react-i18next";
|
|
231
|
-
import { useNavigate } from "react-router-dom";
|
|
232
|
-
|
|
233
|
-
// src/providers/keybind-provider/keybind-context.tsx
|
|
234
|
-
import { createContext as createContext2 } from "react";
|
|
235
|
-
var KeybindContext = createContext2(null);
|
|
236
|
-
|
|
237
|
-
// src/providers/keybind-provider/utils.ts
|
|
238
|
-
var findFirstPlatformMatch = (keys) => {
|
|
239
|
-
const match = Object.entries(keys).filter(
|
|
240
|
-
([, value]) => value.length > 0
|
|
241
|
-
)[0] ?? [];
|
|
242
|
-
return match.length ? {
|
|
243
|
-
platform: match[0],
|
|
244
|
-
keys: match[1]
|
|
245
|
-
} : null;
|
|
246
|
-
};
|
|
247
|
-
var getShortcutKeys = (shortcut) => {
|
|
248
|
-
const platform = "Mac";
|
|
249
|
-
const keys = shortcut.keys[platform];
|
|
250
|
-
if (!keys) {
|
|
251
|
-
const defaultPlatform = findFirstPlatformMatch(shortcut.keys);
|
|
252
|
-
console.warn(
|
|
253
|
-
`No keys found for platform "${platform}" in "${shortcut.label}" ${defaultPlatform ? `using keys for platform "${defaultPlatform.platform}"` : ""}`
|
|
254
|
-
);
|
|
255
|
-
return defaultPlatform ? defaultPlatform.keys : [];
|
|
256
|
-
}
|
|
257
|
-
return keys;
|
|
258
|
-
};
|
|
259
|
-
var keysMatch = (keys1, keys2) => {
|
|
260
|
-
return keys1.length === keys2.length && keys1.every(
|
|
261
|
-
(key, index) => key.toLowerCase() === keys2[index].toLowerCase()
|
|
262
|
-
);
|
|
263
|
-
};
|
|
264
|
-
var findShortcutIndex = (shortcuts, keys) => {
|
|
265
|
-
if (!keys.length) {
|
|
266
|
-
return -1;
|
|
267
|
-
}
|
|
268
|
-
let index = 0;
|
|
269
|
-
for (const shortcut of shortcuts) {
|
|
270
|
-
const shortcutKeys = getShortcutKeys(shortcut);
|
|
271
|
-
if (keysMatch(shortcutKeys, keys)) {
|
|
272
|
-
return index;
|
|
273
|
-
}
|
|
274
|
-
index++;
|
|
275
|
-
}
|
|
276
|
-
return -1;
|
|
277
|
-
};
|
|
278
|
-
var findShortcut = (shortcuts, keys) => {
|
|
279
|
-
const shortcutIndex = findShortcutIndex(shortcuts, keys);
|
|
280
|
-
return shortcutIndex > -1 ? shortcuts[shortcutIndex] : null;
|
|
281
|
-
};
|
|
282
|
-
var getShortcutWithDefaultValues = (shortcut, platform = "Mac") => {
|
|
283
|
-
const platforms = ["Mac", "Windows", "Linux"];
|
|
284
|
-
const defaultKeys = Object.values(shortcut.keys)[0] ?? shortcut.keys[platform];
|
|
285
|
-
const keys = platforms.reduce((acc, curr) => {
|
|
286
|
-
return {
|
|
287
|
-
...acc,
|
|
288
|
-
[curr]: shortcut.keys[curr] ?? defaultKeys
|
|
289
|
-
};
|
|
290
|
-
}, {});
|
|
291
|
-
return {
|
|
292
|
-
...shortcut,
|
|
293
|
-
keys,
|
|
294
|
-
_defaultKeys: shortcut.keys
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
// src/providers/keybind-provider/hooks.tsx
|
|
299
|
-
var useShortcuts = ({
|
|
300
|
-
shortcuts = [],
|
|
301
|
-
debounce
|
|
302
|
-
}) => {
|
|
303
|
-
const [keys, setKeys] = useState2([]);
|
|
304
|
-
const navigate = useNavigate();
|
|
305
|
-
const removeKeys = useCallback(
|
|
306
|
-
debounceFn(() => setKeys([]), debounce),
|
|
307
|
-
[]
|
|
308
|
-
);
|
|
309
|
-
const invokeShortcut = useCallback(
|
|
310
|
-
debounceFn((shortcut) => {
|
|
311
|
-
if (shortcut && shortcut.callback) {
|
|
312
|
-
shortcut.callback();
|
|
313
|
-
setKeys([]);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
if (shortcut && shortcut.to) {
|
|
317
|
-
navigate(shortcut.to);
|
|
318
|
-
setKeys([]);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}, debounce / 2),
|
|
322
|
-
[]
|
|
323
|
-
);
|
|
324
|
-
useEffect2(() => {
|
|
325
|
-
if (keys.length > 0 && shortcuts.length > 0) {
|
|
326
|
-
const shortcut = findShortcut(shortcuts, keys);
|
|
327
|
-
invokeShortcut(shortcut);
|
|
328
|
-
}
|
|
329
|
-
return () => invokeShortcut.cancel();
|
|
330
|
-
}, [keys, shortcuts, invokeShortcut]);
|
|
331
|
-
useEffect2(() => {
|
|
332
|
-
const listener = (event) => {
|
|
333
|
-
const target = event.target;
|
|
334
|
-
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.contentEditable === "true") {
|
|
335
|
-
removeKeys();
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
setKeys((oldKeys) => [...oldKeys, event.key]);
|
|
339
|
-
removeKeys();
|
|
340
|
-
};
|
|
341
|
-
window.addEventListener("keydown", listener);
|
|
342
|
-
return () => {
|
|
343
|
-
window.removeEventListener("keydown", listener);
|
|
344
|
-
};
|
|
345
|
-
}, [removeKeys]);
|
|
346
|
-
};
|
|
347
|
-
var useGlobalShortcuts = () => {
|
|
348
|
-
const { t: t2 } = useTranslation();
|
|
349
|
-
const navigate = useNavigate();
|
|
350
|
-
const { mutateAsync } = useLogout();
|
|
351
|
-
const handleLogout = async () => {
|
|
352
|
-
await mutateAsync(void 0, {
|
|
353
|
-
onSuccess: () => {
|
|
354
|
-
queryClient.clear();
|
|
355
|
-
navigate("/login");
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
const globalShortcuts = [
|
|
360
|
-
// Pages
|
|
361
|
-
{
|
|
362
|
-
keys: {
|
|
363
|
-
Mac: ["G", "O"]
|
|
364
|
-
},
|
|
365
|
-
label: t2("app.keyboardShortcuts.navigation.goToOrders"),
|
|
366
|
-
type: "pageShortcut",
|
|
367
|
-
to: "/orders"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
keys: {
|
|
371
|
-
Mac: ["G", "P"]
|
|
372
|
-
},
|
|
373
|
-
label: t2("app.keyboardShortcuts.navigation.goToProducts"),
|
|
374
|
-
type: "pageShortcut",
|
|
375
|
-
to: "/products"
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
keys: {
|
|
379
|
-
Mac: ["G", "C"]
|
|
380
|
-
},
|
|
381
|
-
label: t2("app.keyboardShortcuts.navigation.goToCollections"),
|
|
382
|
-
type: "pageShortcut",
|
|
383
|
-
to: "/collections"
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
keys: {
|
|
387
|
-
Mac: ["G", "A"]
|
|
388
|
-
},
|
|
389
|
-
label: t2("app.keyboardShortcuts.navigation.goToCategories"),
|
|
390
|
-
type: "pageShortcut",
|
|
391
|
-
to: "/categories"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
keys: {
|
|
395
|
-
Mac: ["G", "U"]
|
|
396
|
-
},
|
|
397
|
-
label: t2("app.keyboardShortcuts.navigation.goToCustomers"),
|
|
398
|
-
type: "pageShortcut",
|
|
399
|
-
to: "/customers"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
keys: {
|
|
403
|
-
Mac: ["G", "I"]
|
|
404
|
-
},
|
|
405
|
-
label: t2("app.keyboardShortcuts.navigation.goToInventory"),
|
|
406
|
-
type: "pageShortcut",
|
|
407
|
-
to: "/inventory"
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
keys: {
|
|
411
|
-
Mac: ["G", "L"]
|
|
412
|
-
},
|
|
413
|
-
label: t2("app.keyboardShortcuts.navigation.goToPriceLists"),
|
|
414
|
-
type: "pageShortcut",
|
|
415
|
-
to: "/price-lists"
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
keys: {
|
|
419
|
-
Mac: ["G", "M"]
|
|
420
|
-
},
|
|
421
|
-
label: t2("app.keyboardShortcuts.navigation.goToPromotions"),
|
|
422
|
-
type: "pageShortcut",
|
|
423
|
-
to: "/promotions"
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
keys: {
|
|
427
|
-
Mac: ["G", "K"]
|
|
428
|
-
},
|
|
429
|
-
label: t2("app.keyboardShortcuts.navigation.goToCampaigns"),
|
|
430
|
-
type: "pageShortcut",
|
|
431
|
-
to: "/campaigns"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
keys: {
|
|
435
|
-
Mac: ["G", "S"]
|
|
436
|
-
},
|
|
437
|
-
label: t2("app.keyboardShortcuts.navigation.goToSellers"),
|
|
438
|
-
type: "pageShortcut",
|
|
439
|
-
to: "/sellers"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
keys: {
|
|
443
|
-
Mac: ["G", "Y"]
|
|
444
|
-
},
|
|
445
|
-
label: t2("app.keyboardShortcuts.navigation.goToPayouts"),
|
|
446
|
-
type: "pageShortcut",
|
|
447
|
-
to: "/payouts"
|
|
448
|
-
},
|
|
449
|
-
// Settings
|
|
450
|
-
{
|
|
451
|
-
keys: {
|
|
452
|
-
Mac: ["G", ","]
|
|
453
|
-
},
|
|
454
|
-
label: t2("app.keyboardShortcuts.settings.goToSettings"),
|
|
455
|
-
type: "settingShortcut",
|
|
456
|
-
to: "/settings"
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
keys: {
|
|
460
|
-
Mac: ["G", ",", "P"]
|
|
461
|
-
},
|
|
462
|
-
label: t2("app.keyboardShortcuts.settings.goToProductTypes"),
|
|
463
|
-
type: "settingShortcut",
|
|
464
|
-
to: "/settings/product-types"
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
keys: {
|
|
468
|
-
Mac: ["G", ",", "L"]
|
|
469
|
-
},
|
|
470
|
-
label: t2("app.keyboardShortcuts.settings.goToLocations"),
|
|
471
|
-
type: "settingShortcut",
|
|
472
|
-
to: "/settings/locations"
|
|
473
|
-
},
|
|
474
|
-
// Commands
|
|
475
|
-
{
|
|
476
|
-
keys: {
|
|
477
|
-
Mac: ["B", "Y", "E"]
|
|
478
|
-
},
|
|
479
|
-
label: t2("actions.logout"),
|
|
480
|
-
type: "commandShortcut",
|
|
481
|
-
callback: () => handleLogout()
|
|
482
|
-
}
|
|
483
|
-
];
|
|
484
|
-
return globalShortcuts;
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
// src/providers/keybind-provider/keybind-provider.tsx
|
|
488
|
-
import { useCallback as useCallback2, useMemo, useState as useState3 } from "react";
|
|
489
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
490
|
-
var KeybindProvider = ({
|
|
491
|
-
shortcuts,
|
|
492
|
-
debounce = 500,
|
|
493
|
-
children
|
|
494
|
-
}) => {
|
|
495
|
-
const [storeShortcuts, setStoreCommands] = useState3(
|
|
496
|
-
shortcuts.map((shr) => getShortcutWithDefaultValues(shr))
|
|
497
|
-
);
|
|
498
|
-
const registerShortcut = useCallback2(
|
|
499
|
-
(shortcut) => {
|
|
500
|
-
setStoreCommands((prevShortcuts) => {
|
|
501
|
-
const idx = findShortcutIndex(shortcuts, getShortcutKeys(shortcut));
|
|
502
|
-
const newShortcuts = [...prevShortcuts];
|
|
503
|
-
if (idx > -1) {
|
|
504
|
-
newShortcuts[idx] = getShortcutWithDefaultValues(shortcut);
|
|
505
|
-
return prevShortcuts;
|
|
506
|
-
}
|
|
507
|
-
return [...prevShortcuts, getShortcutWithDefaultValues(shortcut)];
|
|
508
|
-
});
|
|
509
|
-
},
|
|
510
|
-
[shortcuts]
|
|
511
|
-
);
|
|
512
|
-
const getKeysByPlatform = useCallback2((command) => {
|
|
513
|
-
return findFirstPlatformMatch(command.keys);
|
|
514
|
-
}, []);
|
|
515
|
-
useShortcuts({ shortcuts: storeShortcuts, debounce });
|
|
516
|
-
const commandsContext = useMemo(
|
|
517
|
-
() => ({
|
|
518
|
-
shortcuts: storeShortcuts,
|
|
519
|
-
registerShortcut,
|
|
520
|
-
getKeysByPlatform
|
|
521
|
-
}),
|
|
522
|
-
[storeShortcuts, registerShortcut, getKeysByPlatform]
|
|
523
|
-
);
|
|
524
|
-
return /* @__PURE__ */ jsx2(KeybindContext.Provider, { value: commandsContext, children });
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
// src/providers/search-provider/search-provider.tsx
|
|
528
|
-
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
529
|
-
|
|
530
|
-
// src/components/search/search.tsx
|
|
531
|
-
import {
|
|
532
|
-
Badge,
|
|
533
|
-
Button,
|
|
534
|
-
clx,
|
|
535
|
-
DropdownMenu,
|
|
536
|
-
IconButton,
|
|
537
|
-
Kbd,
|
|
538
|
-
Text
|
|
539
|
-
} from "@medusajs/ui";
|
|
540
|
-
import { Command } from "cmdk";
|
|
541
|
-
import { Dialog as RadixDialog } from "radix-ui";
|
|
542
|
-
import {
|
|
543
|
-
Children,
|
|
544
|
-
forwardRef,
|
|
545
|
-
Fragment,
|
|
546
|
-
useCallback as useCallback4,
|
|
547
|
-
useEffect as useEffect4,
|
|
548
|
-
useImperativeHandle,
|
|
549
|
-
useMemo as useMemo3,
|
|
550
|
-
useRef,
|
|
551
|
-
useState as useState5
|
|
552
|
-
} from "react";
|
|
553
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
554
|
-
import { useLocation, useNavigate as useNavigate2 } from "react-router-dom";
|
|
555
|
-
import {
|
|
556
|
-
ArrowUturnLeft,
|
|
557
|
-
MagnifyingGlass,
|
|
558
|
-
Plus,
|
|
559
|
-
Spinner,
|
|
560
|
-
TriangleDownMini
|
|
561
|
-
} from "@medusajs/icons";
|
|
562
|
-
import { matchSorter } from "match-sorter";
|
|
563
|
-
|
|
564
|
-
// src/components/search/constants.ts
|
|
565
|
-
var SEARCH_AREAS = [
|
|
566
|
-
"all",
|
|
567
|
-
"order",
|
|
568
|
-
"product",
|
|
569
|
-
"collection",
|
|
570
|
-
"category",
|
|
571
|
-
"inventory",
|
|
572
|
-
"customer",
|
|
573
|
-
"seller",
|
|
574
|
-
"promotion",
|
|
575
|
-
"campaign",
|
|
576
|
-
"priceList",
|
|
577
|
-
"productType",
|
|
578
|
-
"productTag",
|
|
579
|
-
"location",
|
|
580
|
-
"command",
|
|
581
|
-
"navigation"
|
|
582
|
-
];
|
|
583
|
-
var DEFAULT_SEARCH_LIMIT = 3;
|
|
584
|
-
var SEARCH_LIMIT_INCREMENT = 20;
|
|
585
|
-
|
|
586
|
-
// src/components/search/use-search-results.tsx
|
|
587
|
-
import { keepPreviousData } from "@tanstack/react-query";
|
|
588
|
-
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
|
|
589
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
590
|
-
var useSearchResults = ({
|
|
591
|
-
q,
|
|
592
|
-
limit,
|
|
593
|
-
area = "all"
|
|
594
|
-
}) => {
|
|
595
|
-
const staticResults = useStaticSearchResults(area);
|
|
596
|
-
const { dynamicResults, isFetching } = useDynamicSearchResults(area, limit, q);
|
|
597
|
-
return {
|
|
598
|
-
staticResults,
|
|
599
|
-
dynamicResults,
|
|
600
|
-
isFetching
|
|
601
|
-
};
|
|
602
|
-
};
|
|
603
|
-
var useStaticSearchResults = (currentArea) => {
|
|
604
|
-
const globalCommands = useGlobalShortcuts();
|
|
605
|
-
const results = useMemo2(() => {
|
|
606
|
-
const groups = /* @__PURE__ */ new Map();
|
|
607
|
-
globalCommands.forEach((command) => {
|
|
608
|
-
const group = groups.get(command.type) || [];
|
|
609
|
-
group.push(command);
|
|
610
|
-
groups.set(command.type, group);
|
|
611
|
-
});
|
|
612
|
-
let filteredGroups;
|
|
613
|
-
switch (currentArea) {
|
|
614
|
-
case "all":
|
|
615
|
-
filteredGroups = Array.from(groups);
|
|
616
|
-
break;
|
|
617
|
-
case "navigation":
|
|
618
|
-
filteredGroups = Array.from(groups).filter(
|
|
619
|
-
([type]) => type === "pageShortcut" || type === "settingShortcut"
|
|
620
|
-
);
|
|
621
|
-
break;
|
|
622
|
-
case "command":
|
|
623
|
-
filteredGroups = Array.from(groups).filter(
|
|
624
|
-
([type]) => type === "commandShortcut"
|
|
625
|
-
);
|
|
626
|
-
break;
|
|
627
|
-
default:
|
|
628
|
-
filteredGroups = [];
|
|
629
|
-
}
|
|
630
|
-
return filteredGroups.map(([title, items]) => ({
|
|
631
|
-
title,
|
|
632
|
-
items
|
|
633
|
-
}));
|
|
634
|
-
}, [globalCommands, currentArea]);
|
|
635
|
-
return results;
|
|
636
|
-
};
|
|
637
|
-
var useDynamicSearchResults = (currentArea, limit, q) => {
|
|
638
|
-
const { t: t2 } = useTranslation2();
|
|
639
|
-
const debouncedSearch = useDebouncedSearch(q, 300);
|
|
640
|
-
const isSearchEnabled = Boolean(debouncedSearch);
|
|
641
|
-
const orderResponse = useOrders(
|
|
642
|
-
{
|
|
643
|
-
q: debouncedSearch?.replace(/^#/, ""),
|
|
644
|
-
// 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.
|
|
645
|
-
limit,
|
|
646
|
-
fields: "id,display_id,email"
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "order"),
|
|
650
|
-
placeholderData: keepPreviousData
|
|
651
|
-
}
|
|
652
|
-
);
|
|
653
|
-
const productResponse = useProducts(
|
|
654
|
-
{
|
|
655
|
-
q: debouncedSearch,
|
|
656
|
-
limit,
|
|
657
|
-
// TODO: Remove exclusion once we avoid including unnecessary relations by default in the query config
|
|
658
|
-
fields: "id,title,thumbnail,-type,-collection,-options,-tags,-images,-variants,-sales_channels"
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "product"),
|
|
662
|
-
placeholderData: keepPreviousData
|
|
663
|
-
}
|
|
664
|
-
);
|
|
665
|
-
const categoryResponse = useProductCategories(
|
|
666
|
-
{
|
|
667
|
-
// TODO: Remove the OR condition once the list endpoint does not throw when q equals an empty string
|
|
668
|
-
q: debouncedSearch || void 0,
|
|
669
|
-
limit,
|
|
670
|
-
fields: "id,name"
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "category"),
|
|
674
|
-
placeholderData: keepPreviousData
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
const collectionResponse = useCollections(
|
|
678
|
-
{
|
|
679
|
-
q: debouncedSearch,
|
|
680
|
-
limit,
|
|
681
|
-
fields: "id,title"
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "collection"),
|
|
685
|
-
placeholderData: keepPreviousData
|
|
686
|
-
}
|
|
687
|
-
);
|
|
688
|
-
const customerResponse = useCustomers(
|
|
689
|
-
{
|
|
690
|
-
q: debouncedSearch,
|
|
691
|
-
limit,
|
|
692
|
-
fields: "id,email,first_name,last_name"
|
|
693
|
-
},
|
|
694
|
-
{
|
|
695
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "customer"),
|
|
696
|
-
placeholderData: keepPreviousData
|
|
697
|
-
}
|
|
698
|
-
);
|
|
699
|
-
const sellerResponse = useSellers(
|
|
700
|
-
{
|
|
701
|
-
q: debouncedSearch,
|
|
702
|
-
limit,
|
|
703
|
-
fields: "id,name"
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "seller"),
|
|
707
|
-
placeholderData: keepPreviousData
|
|
708
|
-
}
|
|
709
|
-
);
|
|
710
|
-
const inventoryResponse = useInventoryItems(
|
|
711
|
-
{
|
|
712
|
-
q: debouncedSearch,
|
|
713
|
-
limit,
|
|
714
|
-
fields: "id,title,sku"
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "inventory"),
|
|
718
|
-
placeholderData: keepPreviousData
|
|
719
|
-
}
|
|
720
|
-
);
|
|
721
|
-
const promotionResponse = usePromotions(
|
|
722
|
-
{
|
|
723
|
-
q: debouncedSearch,
|
|
724
|
-
limit,
|
|
725
|
-
fields: "id,code,status"
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "promotion"),
|
|
729
|
-
placeholderData: keepPreviousData
|
|
730
|
-
}
|
|
731
|
-
);
|
|
732
|
-
const campaignResponse = useCampaigns(
|
|
733
|
-
{
|
|
734
|
-
q: debouncedSearch,
|
|
735
|
-
limit,
|
|
736
|
-
fields: "id,name"
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "campaign"),
|
|
740
|
-
placeholderData: keepPreviousData
|
|
741
|
-
}
|
|
742
|
-
);
|
|
743
|
-
const priceListResponse = usePriceLists(
|
|
744
|
-
{
|
|
745
|
-
q: debouncedSearch,
|
|
746
|
-
limit,
|
|
747
|
-
fields: "id,title"
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "priceList"),
|
|
751
|
-
placeholderData: keepPreviousData
|
|
752
|
-
}
|
|
753
|
-
);
|
|
754
|
-
const productTypeResponse = useProductTypes(
|
|
755
|
-
{
|
|
756
|
-
q: debouncedSearch,
|
|
757
|
-
limit,
|
|
758
|
-
fields: "id,value"
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "productType"),
|
|
762
|
-
placeholderData: keepPreviousData
|
|
763
|
-
}
|
|
764
|
-
);
|
|
765
|
-
const productTagResponse = useProductTags(
|
|
766
|
-
{
|
|
767
|
-
q: debouncedSearch,
|
|
768
|
-
limit,
|
|
769
|
-
fields: "id,value"
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "productTag"),
|
|
773
|
-
placeholderData: keepPreviousData
|
|
774
|
-
}
|
|
775
|
-
);
|
|
776
|
-
const locationResponse = useStockLocations(
|
|
777
|
-
{
|
|
778
|
-
q: debouncedSearch,
|
|
779
|
-
limit,
|
|
780
|
-
fields: "id,name"
|
|
781
|
-
},
|
|
782
|
-
{
|
|
783
|
-
enabled: isSearchEnabled && isAreaEnabled(currentArea, "location"),
|
|
784
|
-
placeholderData: keepPreviousData
|
|
785
|
-
}
|
|
786
|
-
);
|
|
787
|
-
const responseMap = useMemo2(
|
|
788
|
-
() => ({
|
|
789
|
-
order: orderResponse,
|
|
790
|
-
product: productResponse,
|
|
791
|
-
collection: collectionResponse,
|
|
792
|
-
category: categoryResponse,
|
|
793
|
-
inventory: inventoryResponse,
|
|
794
|
-
customer: customerResponse,
|
|
795
|
-
seller: sellerResponse,
|
|
796
|
-
promotion: promotionResponse,
|
|
797
|
-
campaign: campaignResponse,
|
|
798
|
-
priceList: priceListResponse,
|
|
799
|
-
productType: productTypeResponse,
|
|
800
|
-
productTag: productTagResponse,
|
|
801
|
-
location: locationResponse
|
|
802
|
-
}),
|
|
803
|
-
[
|
|
804
|
-
orderResponse,
|
|
805
|
-
productResponse,
|
|
806
|
-
inventoryResponse,
|
|
807
|
-
categoryResponse,
|
|
808
|
-
collectionResponse,
|
|
809
|
-
customerResponse,
|
|
810
|
-
sellerResponse,
|
|
811
|
-
promotionResponse,
|
|
812
|
-
campaignResponse,
|
|
813
|
-
priceListResponse,
|
|
814
|
-
productTypeResponse,
|
|
815
|
-
productTagResponse,
|
|
816
|
-
locationResponse
|
|
817
|
-
]
|
|
818
|
-
);
|
|
819
|
-
const results = useMemo2(() => {
|
|
820
|
-
const groups = Object.entries(responseMap).map(([key, response]) => {
|
|
821
|
-
const area = key;
|
|
822
|
-
if (isAreaEnabled(currentArea, area) || currentArea === "all") {
|
|
823
|
-
return transformDynamicSearchResults(area, limit, t2, response);
|
|
824
|
-
}
|
|
825
|
-
return null;
|
|
826
|
-
}).filter(Boolean);
|
|
827
|
-
return groups;
|
|
828
|
-
}, [responseMap, currentArea, limit, t2]);
|
|
829
|
-
const isAreaFetching = useCallback3(
|
|
830
|
-
(area) => {
|
|
831
|
-
if (area === "all") {
|
|
832
|
-
return Object.values(responseMap).some(
|
|
833
|
-
(response) => response.isFetching
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
return isAreaEnabled(currentArea, area) && responseMap[area]?.isFetching;
|
|
837
|
-
},
|
|
838
|
-
[currentArea, responseMap]
|
|
839
|
-
);
|
|
840
|
-
const isFetching = useMemo2(() => {
|
|
841
|
-
return isAreaFetching(currentArea);
|
|
842
|
-
}, [currentArea, isAreaFetching]);
|
|
843
|
-
const dynamicResults = q ? results.filter(
|
|
844
|
-
(group) => !!group && group.items.length > 0
|
|
845
|
-
) : [];
|
|
846
|
-
return {
|
|
847
|
-
dynamicResults,
|
|
848
|
-
isFetching
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
var useDebouncedSearch = (value, delay) => {
|
|
852
|
-
const [debouncedValue, setDebouncedValue] = useState4(value);
|
|
853
|
-
useEffect3(() => {
|
|
854
|
-
const handler = setTimeout(() => {
|
|
855
|
-
setDebouncedValue(value);
|
|
856
|
-
}, delay);
|
|
857
|
-
return () => {
|
|
858
|
-
clearTimeout(handler);
|
|
859
|
-
};
|
|
860
|
-
}, [value, delay]);
|
|
861
|
-
return debouncedValue;
|
|
862
|
-
};
|
|
863
|
-
function isAreaEnabled(area, currentArea) {
|
|
864
|
-
if (area === "all") {
|
|
865
|
-
return true;
|
|
866
|
-
}
|
|
867
|
-
if (area === currentArea) {
|
|
868
|
-
return true;
|
|
869
|
-
}
|
|
870
|
-
return false;
|
|
871
|
-
}
|
|
872
|
-
var transformMap = {
|
|
873
|
-
order: {
|
|
874
|
-
dataKey: "orders",
|
|
875
|
-
transform: (order) => ({
|
|
876
|
-
id: order.id,
|
|
877
|
-
title: `#${order.display_id}`,
|
|
878
|
-
subtitle: order.email ?? void 0,
|
|
879
|
-
to: `/orders/${order.id}`,
|
|
880
|
-
value: `order:${order.id}`
|
|
881
|
-
})
|
|
882
|
-
},
|
|
883
|
-
product: {
|
|
884
|
-
dataKey: "products",
|
|
885
|
-
transform: (product) => ({
|
|
886
|
-
id: product.id,
|
|
887
|
-
title: product.title,
|
|
888
|
-
to: `/products/${product.id}`,
|
|
889
|
-
thumbnail: product.thumbnail ?? void 0,
|
|
890
|
-
value: `product:${product.id}`
|
|
891
|
-
})
|
|
892
|
-
},
|
|
893
|
-
category: {
|
|
894
|
-
dataKey: "product_categories",
|
|
895
|
-
transform: (category) => ({
|
|
896
|
-
id: category.id,
|
|
897
|
-
title: category.name,
|
|
898
|
-
to: `/categories/${category.id}`,
|
|
899
|
-
value: `category:${category.id}`
|
|
900
|
-
})
|
|
901
|
-
},
|
|
902
|
-
inventory: {
|
|
903
|
-
dataKey: "inventory_items",
|
|
904
|
-
transform: (inventory) => ({
|
|
905
|
-
id: inventory.id,
|
|
906
|
-
title: inventory.title ?? "",
|
|
907
|
-
subtitle: inventory.sku ?? void 0,
|
|
908
|
-
to: `/inventory/${inventory.id}`,
|
|
909
|
-
value: `inventory:${inventory.id}`
|
|
910
|
-
})
|
|
911
|
-
},
|
|
912
|
-
customer: {
|
|
913
|
-
dataKey: "customers",
|
|
914
|
-
transform: (customer) => {
|
|
915
|
-
const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
916
|
-
return {
|
|
917
|
-
id: customer.id,
|
|
918
|
-
title: name || customer.email,
|
|
919
|
-
subtitle: name ? customer.email : void 0,
|
|
920
|
-
to: `/customers/${customer.id}`,
|
|
921
|
-
value: `customer:${customer.id}`
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
},
|
|
925
|
-
seller: {
|
|
926
|
-
dataKey: "sellers",
|
|
927
|
-
transform: (seller) => ({
|
|
928
|
-
id: seller.id,
|
|
929
|
-
title: seller.name,
|
|
930
|
-
to: `/stores/${seller.id}`,
|
|
931
|
-
value: `seller:${seller.id}`
|
|
932
|
-
})
|
|
933
|
-
},
|
|
934
|
-
collection: {
|
|
935
|
-
dataKey: "collections",
|
|
936
|
-
transform: (collection) => ({
|
|
937
|
-
id: collection.id,
|
|
938
|
-
title: collection.title,
|
|
939
|
-
to: `/collections/${collection.id}`,
|
|
940
|
-
value: `collection:${collection.id}`
|
|
941
|
-
})
|
|
942
|
-
},
|
|
943
|
-
promotion: {
|
|
944
|
-
dataKey: "promotions",
|
|
945
|
-
transform: (promotion) => ({
|
|
946
|
-
id: promotion.id,
|
|
947
|
-
title: promotion.code,
|
|
948
|
-
to: `/promotions/${promotion.id}`,
|
|
949
|
-
value: `promotion:${promotion.id}`
|
|
950
|
-
})
|
|
951
|
-
},
|
|
952
|
-
campaign: {
|
|
953
|
-
dataKey: "campaigns",
|
|
954
|
-
transform: (campaign) => ({
|
|
955
|
-
id: campaign.id,
|
|
956
|
-
title: campaign.name,
|
|
957
|
-
to: `/campaigns/${campaign.id}`,
|
|
958
|
-
value: `campaign:${campaign.id}`
|
|
959
|
-
})
|
|
960
|
-
},
|
|
961
|
-
priceList: {
|
|
962
|
-
dataKey: "price_lists",
|
|
963
|
-
transform: (priceList) => ({
|
|
964
|
-
id: priceList.id,
|
|
965
|
-
title: priceList.title,
|
|
966
|
-
to: `/price-lists/${priceList.id}`,
|
|
967
|
-
value: `priceList:${priceList.id}`
|
|
968
|
-
})
|
|
969
|
-
},
|
|
970
|
-
productType: {
|
|
971
|
-
dataKey: "product_types",
|
|
972
|
-
transform: (productType) => ({
|
|
973
|
-
id: productType.id,
|
|
974
|
-
title: productType.value,
|
|
975
|
-
to: `/product-types/${productType.id}`,
|
|
976
|
-
value: `productType:${productType.id}`
|
|
977
|
-
})
|
|
978
|
-
},
|
|
979
|
-
productTag: {
|
|
980
|
-
dataKey: "product_tags",
|
|
981
|
-
transform: (productTag) => ({
|
|
982
|
-
id: productTag.id,
|
|
983
|
-
title: productTag.value,
|
|
984
|
-
to: `/product-tags/${productTag.id}`,
|
|
985
|
-
value: `productTag:${productTag.id}`
|
|
986
|
-
})
|
|
987
|
-
},
|
|
988
|
-
location: {
|
|
989
|
-
dataKey: "stock_locations",
|
|
990
|
-
transform: (location) => ({
|
|
991
|
-
id: location.id,
|
|
992
|
-
title: location.name,
|
|
993
|
-
to: `/locations/${location.id}`,
|
|
994
|
-
value: `location:${location.id}`
|
|
995
|
-
})
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
function transformDynamicSearchResults(type, limit, t2, response) {
|
|
999
|
-
if (!response || !transformMap[type]) {
|
|
1000
|
-
return void 0;
|
|
1001
|
-
}
|
|
1002
|
-
const { dataKey, transform } = transformMap[type];
|
|
1003
|
-
const data = response[dataKey];
|
|
1004
|
-
if (!data || !Array.isArray(data)) {
|
|
1005
|
-
return void 0;
|
|
1006
|
-
}
|
|
1007
|
-
return {
|
|
1008
|
-
title: t2(`app.search.groups.${type}`),
|
|
1009
|
-
area: type,
|
|
1010
|
-
hasMore: response.count > limit,
|
|
1011
|
-
count: response.count,
|
|
1012
|
-
items: data.map(transform)
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
// src/components/search/search.tsx
|
|
1017
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1018
|
-
var Search = () => {
|
|
1019
|
-
const [area, setArea] = useState5("all");
|
|
1020
|
-
const [search, setSearch] = useState5("");
|
|
1021
|
-
const [limit, setLimit] = useState5(DEFAULT_SEARCH_LIMIT);
|
|
1022
|
-
const { open, onOpenChange } = useSearch();
|
|
1023
|
-
const location = useLocation();
|
|
1024
|
-
const { t: t2 } = useTranslation3();
|
|
1025
|
-
const navigate = useNavigate2();
|
|
1026
|
-
const inputRef = useRef(null);
|
|
1027
|
-
const listRef = useRef(null);
|
|
1028
|
-
const { staticResults, dynamicResults, isFetching } = useSearchResults({
|
|
1029
|
-
area,
|
|
1030
|
-
limit,
|
|
1031
|
-
q: search
|
|
1032
|
-
});
|
|
1033
|
-
const handleReset = useCallback4(() => {
|
|
1034
|
-
setArea("all");
|
|
1035
|
-
setSearch("");
|
|
1036
|
-
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
1037
|
-
}, [setLimit]);
|
|
1038
|
-
const handleBack = () => {
|
|
1039
|
-
handleReset();
|
|
1040
|
-
inputRef.current?.focus();
|
|
1041
|
-
};
|
|
1042
|
-
const handleOpenChange = useCallback4(
|
|
1043
|
-
(open2) => {
|
|
1044
|
-
if (!open2) {
|
|
1045
|
-
handleReset();
|
|
1046
|
-
}
|
|
1047
|
-
onOpenChange(open2);
|
|
1048
|
-
},
|
|
1049
|
-
[onOpenChange, handleReset]
|
|
1050
|
-
);
|
|
1051
|
-
useEffect4(() => {
|
|
1052
|
-
handleOpenChange(false);
|
|
1053
|
-
}, [location.pathname, handleOpenChange]);
|
|
1054
|
-
const handleSelect = (item) => {
|
|
1055
|
-
handleOpenChange(false);
|
|
1056
|
-
if (item.to) {
|
|
1057
|
-
navigate(item.to);
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if (item.callback) {
|
|
1061
|
-
item.callback();
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
const handleShowMore = (area2) => {
|
|
1066
|
-
if (area2 === "all") {
|
|
1067
|
-
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
1068
|
-
} else {
|
|
1069
|
-
setLimit(SEARCH_LIMIT_INCREMENT);
|
|
1070
|
-
}
|
|
1071
|
-
setArea(area2);
|
|
1072
|
-
inputRef.current?.focus();
|
|
1073
|
-
};
|
|
1074
|
-
const handleLoadMore = () => {
|
|
1075
|
-
setLimit((l) => l + SEARCH_LIMIT_INCREMENT);
|
|
1076
|
-
};
|
|
1077
|
-
const filteredStaticResults = useMemo3(() => {
|
|
1078
|
-
const filteredResults = [];
|
|
1079
|
-
staticResults.forEach((group) => {
|
|
1080
|
-
const filteredItems = matchSorter(group.items, search, {
|
|
1081
|
-
keys: ["label"]
|
|
1082
|
-
});
|
|
1083
|
-
if (filteredItems.length === 0) {
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
filteredResults.push({
|
|
1087
|
-
...group,
|
|
1088
|
-
items: filteredItems
|
|
1089
|
-
});
|
|
1090
|
-
});
|
|
1091
|
-
return filteredResults;
|
|
1092
|
-
}, [staticResults, search]);
|
|
1093
|
-
const handleSearch = (q) => {
|
|
1094
|
-
setSearch(q);
|
|
1095
|
-
listRef.current?.scrollTo({ top: 0 });
|
|
1096
|
-
};
|
|
1097
|
-
const showLoading = useMemo3(() => {
|
|
1098
|
-
return isFetching && !dynamicResults.length && !filteredStaticResults.length;
|
|
1099
|
-
}, [isFetching, dynamicResults, filteredStaticResults]);
|
|
1100
|
-
return /* @__PURE__ */ jsxs(CommandDialog, { open, onOpenChange: handleOpenChange, children: [
|
|
1101
|
-
/* @__PURE__ */ jsx3(
|
|
1102
|
-
CommandInput,
|
|
1103
|
-
{
|
|
1104
|
-
isFetching,
|
|
1105
|
-
ref: inputRef,
|
|
1106
|
-
area,
|
|
1107
|
-
setArea,
|
|
1108
|
-
value: search,
|
|
1109
|
-
onValueChange: handleSearch,
|
|
1110
|
-
onBack: area !== "all" ? handleBack : void 0,
|
|
1111
|
-
placeholder: t2("app.search.placeholder")
|
|
1112
|
-
}
|
|
1113
|
-
),
|
|
1114
|
-
/* @__PURE__ */ jsxs(CommandList, { ref: listRef, children: [
|
|
1115
|
-
showLoading && /* @__PURE__ */ jsx3(CommandLoading, {}),
|
|
1116
|
-
dynamicResults.map((group) => {
|
|
1117
|
-
return /* @__PURE__ */ jsxs(CommandGroup, { heading: group.title, children: [
|
|
1118
|
-
group.items.map((item) => {
|
|
1119
|
-
return /* @__PURE__ */ jsx3(
|
|
1120
|
-
CommandItem,
|
|
1121
|
-
{
|
|
1122
|
-
onSelect: () => handleSelect(item),
|
|
1123
|
-
value: item.value,
|
|
1124
|
-
className: "flex items-center justify-between",
|
|
1125
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
1126
|
-
item.thumbnail && /* @__PURE__ */ jsx3(
|
|
1127
|
-
Thumbnail,
|
|
1128
|
-
{
|
|
1129
|
-
alt: item.title,
|
|
1130
|
-
src: item.thumbnail,
|
|
1131
|
-
size: "small"
|
|
1132
|
-
}
|
|
1133
|
-
),
|
|
1134
|
-
/* @__PURE__ */ jsx3("span", { children: item.title }),
|
|
1135
|
-
item.subtitle && /* @__PURE__ */ jsx3("span", { className: "text-ui-fg-muted", children: item.subtitle })
|
|
1136
|
-
] })
|
|
1137
|
-
},
|
|
1138
|
-
item.id
|
|
1139
|
-
);
|
|
1140
|
-
}),
|
|
1141
|
-
group.hasMore && area === "all" && /* @__PURE__ */ jsx3(
|
|
1142
|
-
CommandItem,
|
|
1143
|
-
{
|
|
1144
|
-
onSelect: () => handleShowMore(group.area),
|
|
1145
|
-
hidden: true,
|
|
1146
|
-
value: `${group.title}:show:more`,
|
|
1147
|
-
children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
|
|
1148
|
-
/* @__PURE__ */ jsx3(Plus, {}),
|
|
1149
|
-
/* @__PURE__ */ jsx3(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.showMore") })
|
|
1150
|
-
] })
|
|
1151
|
-
}
|
|
1152
|
-
),
|
|
1153
|
-
group.hasMore && area === group.area && /* @__PURE__ */ jsx3(
|
|
1154
|
-
CommandItem,
|
|
1155
|
-
{
|
|
1156
|
-
onSelect: handleLoadMore,
|
|
1157
|
-
hidden: true,
|
|
1158
|
-
value: `${group.title}:load:more`,
|
|
1159
|
-
children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
|
|
1160
|
-
/* @__PURE__ */ jsx3(Plus, {}),
|
|
1161
|
-
/* @__PURE__ */ jsx3(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.loadMore", {
|
|
1162
|
-
count: Math.min(
|
|
1163
|
-
SEARCH_LIMIT_INCREMENT,
|
|
1164
|
-
group.count - limit
|
|
1165
|
-
)
|
|
1166
|
-
}) })
|
|
1167
|
-
] })
|
|
1168
|
-
}
|
|
1169
|
-
)
|
|
1170
|
-
] }, group.title);
|
|
1171
|
-
}),
|
|
1172
|
-
filteredStaticResults.map((group) => {
|
|
1173
|
-
return /* @__PURE__ */ jsx3(
|
|
1174
|
-
CommandGroup,
|
|
1175
|
-
{
|
|
1176
|
-
heading: t2(`app.keyboardShortcuts.${group.title}`),
|
|
1177
|
-
children: group.items.map((item) => {
|
|
1178
|
-
return /* @__PURE__ */ jsxs(
|
|
1179
|
-
CommandItem,
|
|
1180
|
-
{
|
|
1181
|
-
onSelect: () => handleSelect(item),
|
|
1182
|
-
className: "flex items-center justify-between",
|
|
1183
|
-
children: [
|
|
1184
|
-
/* @__PURE__ */ jsx3("span", { children: item.label }),
|
|
1185
|
-
/* @__PURE__ */ jsx3("div", { className: "flex items-center gap-x-1.5", children: item.keys.Mac?.map((key, index) => {
|
|
1186
|
-
return /* @__PURE__ */ jsxs(
|
|
1187
|
-
"div",
|
|
1188
|
-
{
|
|
1189
|
-
className: "flex items-center gap-x-1",
|
|
1190
|
-
children: [
|
|
1191
|
-
/* @__PURE__ */ jsx3(Kbd, { children: key }),
|
|
1192
|
-
index < (item.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx3("span", { className: "txt-compact-xsmall text-ui-fg-subtle", children: t2("app.keyboardShortcuts.then") })
|
|
1193
|
-
]
|
|
1194
|
-
},
|
|
1195
|
-
index
|
|
1196
|
-
);
|
|
1197
|
-
}) })
|
|
1198
|
-
]
|
|
1199
|
-
},
|
|
1200
|
-
item.label
|
|
1201
|
-
);
|
|
1202
|
-
})
|
|
1203
|
-
},
|
|
1204
|
-
group.title
|
|
1205
|
-
);
|
|
1206
|
-
}),
|
|
1207
|
-
!showLoading && /* @__PURE__ */ jsx3(CommandEmpty, { q: search })
|
|
1208
|
-
] })
|
|
1209
|
-
] });
|
|
1210
|
-
};
|
|
1211
|
-
var CommandPalette = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
1212
|
-
Command,
|
|
1213
|
-
{
|
|
1214
|
-
shouldFilter: false,
|
|
1215
|
-
ref,
|
|
1216
|
-
className: clx(
|
|
1217
|
-
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1218
|
-
className
|
|
1219
|
-
),
|
|
1220
|
-
...props
|
|
1221
|
-
}
|
|
1222
|
-
));
|
|
1223
|
-
CommandPalette.displayName = Command.displayName;
|
|
1224
|
-
var CommandDialog = ({ children, ...props }) => {
|
|
1225
|
-
const { t: t2 } = useTranslation3();
|
|
1226
|
-
const preserveHeight = useMemo3(() => {
|
|
1227
|
-
return props.isLoading && Children.count(children) === 0;
|
|
1228
|
-
}, [props.isLoading, children]);
|
|
1229
|
-
return /* @__PURE__ */ jsx3(RadixDialog.Root, { ...props, children: /* @__PURE__ */ jsxs(RadixDialog.Portal, { children: [
|
|
1230
|
-
/* @__PURE__ */ jsx3(RadixDialog.Overlay, { className: "bg-ui-bg-overlay fixed inset-0" }),
|
|
1231
|
-
/* @__PURE__ */ jsxs(
|
|
1232
|
-
RadixDialog.Content,
|
|
1233
|
-
{
|
|
1234
|
-
className: clx(
|
|
1235
|
-
"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",
|
|
1236
|
-
{
|
|
1237
|
-
"h-[300px]": preserveHeight
|
|
1238
|
-
// Prevents the dialog from collapsing when loading async results and before the no results message is displayed
|
|
1239
|
-
}
|
|
1240
|
-
),
|
|
1241
|
-
children: [
|
|
1242
|
-
/* @__PURE__ */ jsx3(RadixDialog.Title, { className: "sr-only", children: t2("app.search.title") }),
|
|
1243
|
-
/* @__PURE__ */ jsx3(RadixDialog.Description, { className: "sr-only", children: t2("app.search.description") }),
|
|
1244
|
-
/* @__PURE__ */ jsx3(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 }),
|
|
1245
|
-
/* @__PURE__ */ jsx3("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: [
|
|
1246
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
1247
|
-
/* @__PURE__ */ jsx3(Text, { size: "xsmall", leading: "compact", children: t2("app.search.navigation") }),
|
|
1248
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
|
|
1249
|
-
/* @__PURE__ */ jsx3(Kbd, { className: "bg-ui-bg-field-component", children: "\u2193" }),
|
|
1250
|
-
/* @__PURE__ */ jsx3(Kbd, { className: "bg-ui-bg-field-component", children: "\u2191" })
|
|
1251
|
-
] })
|
|
1252
|
-
] }),
|
|
1253
|
-
/* @__PURE__ */ jsx3("div", { className: "bg-ui-border-strong h-3 w-px" }),
|
|
1254
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
1255
|
-
/* @__PURE__ */ jsx3(Text, { size: "xsmall", leading: "compact", children: t2("app.search.openResult") }),
|
|
1256
|
-
/* @__PURE__ */ jsx3(Kbd, { className: "bg-ui-bg-field-component", children: "\u21B5" })
|
|
1257
|
-
] })
|
|
1258
|
-
] }) })
|
|
1259
|
-
]
|
|
1260
|
-
}
|
|
1261
|
-
)
|
|
1262
|
-
] }) });
|
|
1263
|
-
};
|
|
1264
|
-
var CommandInput = forwardRef(
|
|
1265
|
-
({
|
|
1266
|
-
className,
|
|
1267
|
-
value,
|
|
1268
|
-
onValueChange,
|
|
1269
|
-
area,
|
|
1270
|
-
setArea,
|
|
1271
|
-
isFetching,
|
|
1272
|
-
onBack,
|
|
1273
|
-
...props
|
|
1274
|
-
}, ref) => {
|
|
1275
|
-
const { t: t2 } = useTranslation3();
|
|
1276
|
-
const innerRef = useRef(null);
|
|
1277
|
-
const direction = useDocumentDirection();
|
|
1278
|
-
useImperativeHandle(
|
|
1279
|
-
ref,
|
|
1280
|
-
() => innerRef.current
|
|
1281
|
-
);
|
|
1282
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col border-b", children: [
|
|
1283
|
-
/* @__PURE__ */ jsx3("div", { className: "px-4 pt-4", children: /* @__PURE__ */ jsxs(DropdownMenu, { dir: direction, children: [
|
|
1284
|
-
/* @__PURE__ */ jsx3(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1285
|
-
Badge,
|
|
1286
|
-
{
|
|
1287
|
-
size: "2xsmall",
|
|
1288
|
-
className: "hover:bg-ui-bg-base-pressed transition-fg cursor-pointer",
|
|
1289
|
-
children: [
|
|
1290
|
-
t2(`app.search.groups.${area}`),
|
|
1291
|
-
/* @__PURE__ */ jsx3(TriangleDownMini, { className: "text-ui-fg-muted" })
|
|
1292
|
-
]
|
|
1293
|
-
}
|
|
1294
|
-
) }),
|
|
1295
|
-
/* @__PURE__ */ jsx3(
|
|
1296
|
-
DropdownMenu.Content,
|
|
1297
|
-
{
|
|
1298
|
-
align: "start",
|
|
1299
|
-
className: "h-full max-h-[360px] overflow-auto",
|
|
1300
|
-
onCloseAutoFocus: (e) => {
|
|
1301
|
-
e.preventDefault();
|
|
1302
|
-
innerRef.current?.focus();
|
|
1303
|
-
},
|
|
1304
|
-
children: /* @__PURE__ */ jsx3(
|
|
1305
|
-
DropdownMenu.RadioGroup,
|
|
1306
|
-
{
|
|
1307
|
-
value: area,
|
|
1308
|
-
onValueChange: (v) => setArea(v),
|
|
1309
|
-
children: SEARCH_AREAS.map((area2) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1310
|
-
area2 === "command" && /* @__PURE__ */ jsx3(DropdownMenu.Separator, {}),
|
|
1311
|
-
/* @__PURE__ */ jsx3(DropdownMenu.RadioItem, { value: area2, children: t2(`app.search.groups.${area2}`) }),
|
|
1312
|
-
area2 === "all" && /* @__PURE__ */ jsx3(DropdownMenu.Separator, {})
|
|
1313
|
-
] }, area2))
|
|
1314
|
-
}
|
|
1315
|
-
)
|
|
1316
|
-
}
|
|
1317
|
-
)
|
|
1318
|
-
] }) }),
|
|
1319
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-2 px-4 py-3", children: [
|
|
1320
|
-
onBack && /* @__PURE__ */ jsx3(
|
|
1321
|
-
IconButton,
|
|
1322
|
-
{
|
|
1323
|
-
type: "button",
|
|
1324
|
-
size: "small",
|
|
1325
|
-
variant: "transparent",
|
|
1326
|
-
onClick: onBack,
|
|
1327
|
-
children: /* @__PURE__ */ jsx3(ArrowUturnLeft, { className: "text-ui-fg-muted" })
|
|
1328
|
-
}
|
|
1329
|
-
),
|
|
1330
|
-
/* @__PURE__ */ jsx3(
|
|
1331
|
-
Command.Input,
|
|
1332
|
-
{
|
|
1333
|
-
ref: innerRef,
|
|
1334
|
-
value,
|
|
1335
|
-
onValueChange,
|
|
1336
|
-
className: clx(
|
|
1337
|
-
"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",
|
|
1338
|
-
className
|
|
1339
|
-
),
|
|
1340
|
-
...props
|
|
1341
|
-
}
|
|
1342
|
-
),
|
|
1343
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute end-4 top-1/2 flex -translate-y-1/2 items-center justify-end gap-x-2", children: [
|
|
1344
|
-
isFetching && /* @__PURE__ */ jsx3(Spinner, { className: "text-ui-fg-muted animate-spin" }),
|
|
1345
|
-
value && /* @__PURE__ */ jsx3(
|
|
1346
|
-
Button,
|
|
1347
|
-
{
|
|
1348
|
-
variant: "transparent",
|
|
1349
|
-
size: "small",
|
|
1350
|
-
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
1351
|
-
type: "button",
|
|
1352
|
-
onClick: () => {
|
|
1353
|
-
onValueChange?.("");
|
|
1354
|
-
innerRef.current?.focus();
|
|
1355
|
-
},
|
|
1356
|
-
children: t2("actions.clear")
|
|
1357
|
-
}
|
|
1358
|
-
)
|
|
1359
|
-
] })
|
|
1360
|
-
] })
|
|
1361
|
-
] });
|
|
1362
|
-
}
|
|
1363
|
-
);
|
|
1364
|
-
CommandInput.displayName = Command.Input.displayName;
|
|
1365
|
-
var CommandList = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
1366
|
-
Command.List,
|
|
1367
|
-
{
|
|
1368
|
-
ref,
|
|
1369
|
-
className: clx(
|
|
1370
|
-
"max-h-[300px] flex-1 overflow-y-auto overflow-x-hidden px-2 pb-4",
|
|
1371
|
-
className
|
|
1372
|
-
),
|
|
1373
|
-
...props
|
|
1374
|
-
}
|
|
1375
|
-
));
|
|
1376
|
-
CommandList.displayName = Command.List.displayName;
|
|
1377
|
-
var CommandEmpty = forwardRef((props, ref) => {
|
|
1378
|
-
const { t: t2 } = useTranslation3();
|
|
1379
|
-
return /* @__PURE__ */ jsx3(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: [
|
|
1380
|
-
/* @__PURE__ */ jsx3(MagnifyingGlass, { className: "text-ui-fg-subtle" }),
|
|
1381
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
1382
|
-
/* @__PURE__ */ jsx3(Text, { size: "small", weight: "plus", leading: "compact", children: props.q ? t2("app.search.noResultsTitle") : t2("app.search.emptySearchTitle") }),
|
|
1383
|
-
/* @__PURE__ */ jsx3(Text, { size: "small", className: "text-ui-fg-muted", children: props.q ? t2("app.search.noResultsMessage") : t2("app.search.emptySearchMessage") })
|
|
1384
|
-
] })
|
|
1385
|
-
] }) });
|
|
1386
|
-
});
|
|
1387
|
-
CommandEmpty.displayName = Command.Empty.displayName;
|
|
1388
|
-
var CommandLoading = forwardRef((props, ref) => {
|
|
1389
|
-
return /* @__PURE__ */ jsxs(
|
|
1390
|
-
Command.Loading,
|
|
1391
|
-
{
|
|
1392
|
-
ref,
|
|
1393
|
-
...props,
|
|
1394
|
-
className: "bg-ui-bg-base flex flex-col",
|
|
1395
|
-
children: [
|
|
1396
|
-
/* @__PURE__ */ jsx3("div", { className: "w-full px-2 pb-1 pt-3", children: /* @__PURE__ */ jsx3(Skeleton, { className: "h-5 w-10" }) }),
|
|
1397
|
-
Array.from({ length: 7 }).map((_, index) => /* @__PURE__ */ jsx3("div", { className: "w-full p-2", children: /* @__PURE__ */ jsx3(Skeleton, { className: "h-5 w-full" }) }, index))
|
|
1398
|
-
]
|
|
1399
|
-
}
|
|
1400
|
-
);
|
|
1401
|
-
});
|
|
1402
|
-
CommandLoading.displayName = Command.Loading.displayName;
|
|
1403
|
-
var CommandGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
1404
|
-
Command.Group,
|
|
1405
|
-
{
|
|
1406
|
-
ref,
|
|
1407
|
-
className: clx(
|
|
1408
|
-
"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",
|
|
1409
|
-
className
|
|
1410
|
-
),
|
|
1411
|
-
...props
|
|
1412
|
-
}
|
|
1413
|
-
));
|
|
1414
|
-
CommandGroup.displayName = Command.Group.displayName;
|
|
1415
|
-
var CommandSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
1416
|
-
Command.Separator,
|
|
1417
|
-
{
|
|
1418
|
-
ref,
|
|
1419
|
-
className: clx("bg-border -mx-1 h-px", className),
|
|
1420
|
-
...props
|
|
1421
|
-
}
|
|
1422
|
-
));
|
|
1423
|
-
CommandSeparator.displayName = Command.Separator.displayName;
|
|
1424
|
-
var CommandItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
1425
|
-
Command.Item,
|
|
1426
|
-
{
|
|
1427
|
-
ref,
|
|
1428
|
-
className: clx(
|
|
1429
|
-
"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=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
1430
|
-
className
|
|
1431
|
-
),
|
|
1432
|
-
...props
|
|
1433
|
-
}
|
|
1434
|
-
));
|
|
1435
|
-
CommandItem.displayName = Command.Item.displayName;
|
|
1436
|
-
|
|
1437
|
-
// src/providers/search-provider/search-context.tsx
|
|
1438
|
-
import { createContext as createContext3 } from "react";
|
|
1439
|
-
var SearchContext = createContext3(null);
|
|
1440
|
-
|
|
1441
|
-
// src/providers/search-provider/search-provider.tsx
|
|
1442
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1443
|
-
var SearchProvider = ({ children }) => {
|
|
1444
|
-
const [open, setOpen] = useState6(false);
|
|
1445
|
-
const { mobile, toggle } = useSidebar();
|
|
1446
|
-
const toggleSearch = () => {
|
|
1447
|
-
const update = !open;
|
|
1448
|
-
if (update && mobile) {
|
|
1449
|
-
toggle("mobile");
|
|
1450
|
-
}
|
|
1451
|
-
setOpen(update);
|
|
1452
|
-
};
|
|
1453
|
-
useEffect5(() => {
|
|
1454
|
-
const onKeyDown = (e) => {
|
|
1455
|
-
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
1456
|
-
setOpen((prev) => !prev);
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
document.addEventListener("keydown", onKeyDown);
|
|
1460
|
-
return () => {
|
|
1461
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
1462
|
-
};
|
|
1463
|
-
}, []);
|
|
1464
|
-
return /* @__PURE__ */ jsxs2(
|
|
1465
|
-
SearchContext.Provider,
|
|
1466
|
-
{
|
|
1467
|
-
value: {
|
|
1468
|
-
open,
|
|
1469
|
-
onOpenChange: setOpen,
|
|
1470
|
-
toggleSearch
|
|
1471
|
-
},
|
|
1472
|
-
children: [
|
|
1473
|
-
children,
|
|
1474
|
-
/* @__PURE__ */ jsx4(Search, {})
|
|
1475
|
-
]
|
|
1476
|
-
}
|
|
1477
|
-
);
|
|
1478
|
-
};
|
|
1479
|
-
|
|
1480
|
-
// src/providers/search-provider/use-search.tsx
|
|
1481
|
-
import { useContext as useContext3 } from "react";
|
|
1482
|
-
var useSearch = () => {
|
|
1483
|
-
const context = useContext3(SearchContext);
|
|
1484
|
-
if (!context) {
|
|
1485
|
-
throw new Error("useSearch must be used within a SearchProvider");
|
|
1486
|
-
}
|
|
1487
|
-
return context;
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
// src/providers/feature-flag-provider/index.tsx
|
|
1491
|
-
import { createContext as createContext4, useCallback as useCallback5, useContext as useContext4, useMemo as useMemo4 } from "react";
|
|
1492
|
-
|
|
1493
|
-
// src/hooks/api/feature-flags.tsx
|
|
1494
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1495
|
-
var useFeatureFlags = () => {
|
|
1496
|
-
return useQuery({
|
|
1497
|
-
queryKey: ["admin", "feature-flags"],
|
|
1498
|
-
queryFn: async () => {
|
|
1499
|
-
const response = await fetchQuery("/admin/feature-flags", {
|
|
1500
|
-
method: "GET"
|
|
1501
|
-
});
|
|
1502
|
-
return response.feature_flags;
|
|
1503
|
-
},
|
|
1504
|
-
staleTime: 5 * 60 * 1e3,
|
|
1505
|
-
gcTime: 10 * 60 * 1e3
|
|
1506
|
-
});
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
|
-
// src/providers/feature-flag-provider/index.tsx
|
|
1510
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1511
|
-
var FeatureFlagContext = createContext4(null);
|
|
1512
|
-
var FeatureFlagProvider = ({
|
|
1513
|
-
children
|
|
1514
|
-
}) => {
|
|
1515
|
-
const { data: flags = {}, isLoading } = useFeatureFlags();
|
|
1516
|
-
const isFeatureEnabled = useCallback5(
|
|
1517
|
-
(flag) => {
|
|
1518
|
-
return flags[flag] === true;
|
|
1519
|
-
},
|
|
1520
|
-
[flags]
|
|
1521
|
-
);
|
|
1522
|
-
const value = useMemo4(
|
|
1523
|
-
() => ({ flags, isLoading, isFeatureEnabled }),
|
|
1524
|
-
[flags, isLoading, isFeatureEnabled]
|
|
1525
|
-
);
|
|
1526
|
-
return /* @__PURE__ */ jsx5(FeatureFlagContext.Provider, { value, children });
|
|
1527
|
-
};
|
|
1528
|
-
|
|
1529
|
-
// src/app.tsx
|
|
1530
|
-
import { I18nProvider, Toaster, TooltipProvider } from "@medusajs/ui";
|
|
1531
|
-
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
1532
|
-
|
|
1533
|
-
// src/get-route-map.tsx
|
|
1534
|
-
import { t } from "i18next";
|
|
1535
|
-
import { Outlet as Outlet4 } from "react-router-dom";
|
|
1536
|
-
|
|
1537
|
-
// src/components/authentication/protected-route/protected-route.tsx
|
|
1538
|
-
import { Spinner as Spinner2 } from "@medusajs/icons";
|
|
1539
|
-
import { Navigate, Outlet, useLocation as useLocation2 } from "react-router-dom";
|
|
1540
|
-
import { PermissionsProvider } from "@mercurjs/dashboard-shared";
|
|
1541
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1542
|
-
var ProtectedRoute = () => {
|
|
1543
|
-
const location = useLocation2();
|
|
1544
|
-
const { user, isLoading: isLoadingUser } = useMe();
|
|
1545
|
-
if (isLoadingUser) {
|
|
1546
|
-
return /* @__PURE__ */ jsx6("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsx6(Spinner2, { className: "text-ui-fg-interactive animate-spin" }) });
|
|
1547
|
-
}
|
|
1548
|
-
if (!user) {
|
|
1549
|
-
return /* @__PURE__ */ jsx6(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
1550
|
-
}
|
|
1551
|
-
return /* @__PURE__ */ jsx6(
|
|
1552
|
-
PermissionsProvider,
|
|
1553
|
-
{
|
|
1554
|
-
permissions: user.permissions ?? null,
|
|
1555
|
-
children: /* @__PURE__ */ jsx6(SidebarProvider, { children: /* @__PURE__ */ jsx6(SearchProvider, { children: /* @__PURE__ */ jsx6(Outlet, {}) }) })
|
|
1556
|
-
}
|
|
1557
|
-
);
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
// src/components/layout/main-layout/main-layout.tsx
|
|
1561
|
-
import {
|
|
1562
|
-
BuildingStorefront,
|
|
1563
|
-
Buildings,
|
|
1564
|
-
CogSixTooth,
|
|
1565
|
-
CreditCardRefresh,
|
|
1566
|
-
CurrencyDollar,
|
|
1567
|
-
EllipsisHorizontal as EllipsisHorizontal2,
|
|
1568
|
-
MagnifyingGlass as MagnifyingGlass2,
|
|
1569
|
-
OpenRectArrowOut as OpenRectArrowOut2,
|
|
1570
|
-
ReceiptPercent,
|
|
1571
|
-
ShoppingCart,
|
|
1572
|
-
Tag,
|
|
1573
|
-
Users
|
|
1574
|
-
} from "@medusajs/icons";
|
|
1575
|
-
import { Avatar as Avatar2, Divider, DropdownMenu as DropdownMenu3, Text as Text5, clx as clx5 } from "@medusajs/ui";
|
|
1576
|
-
import { useMemo as useMemo5 } from "react";
|
|
1577
|
-
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1578
|
-
import { Link as Link3, useLocation as useLocation6, useNavigate as useNavigate4 } from "react-router-dom";
|
|
1579
|
-
|
|
1580
|
-
// src/components/layout/nav-item/nav-item.tsx
|
|
1581
|
-
import {
|
|
1582
|
-
useCallback as useCallback6,
|
|
1583
|
-
useEffect as useEffect6,
|
|
1584
|
-
useState as useState7
|
|
1585
|
-
} from "react";
|
|
1586
|
-
import { Kbd as Kbd2, Text as Text2, Tooltip, clx as clx2 } from "@medusajs/ui";
|
|
1587
|
-
import { Collapsible as RadixCollapsible } from "radix-ui";
|
|
1588
|
-
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
1589
|
-
import { NavLink, useLocation as useLocation3 } from "react-router-dom";
|
|
1590
|
-
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1591
|
-
var NestedNavLabel = ({
|
|
1592
|
-
label,
|
|
1593
|
-
translationNs
|
|
1594
|
-
}) => {
|
|
1595
|
-
const { t: t2 } = useTranslation4(translationNs);
|
|
1596
|
-
return /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: translationNs ? t2(label) : label });
|
|
1597
|
-
};
|
|
1598
|
-
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";
|
|
1599
|
-
var ACTIVE_NAV_LINK_CLASSES = "bg-ui-bg-base shadow-elevation-card-rest text-ui-fg-base hover:bg-ui-bg-base";
|
|
1600
|
-
var NESTED_NAV_LINK_CLASSES = "pl-[34px] pr-2 py-1 w-full text-ui-fg-muted";
|
|
1601
|
-
var SETTING_NAV_LINK_CLASSES = "pl-2 py-1";
|
|
1602
|
-
var getIsOpen = (to, items, pathname) => {
|
|
1603
|
-
return [to, ...items?.map((i) => i.to) ?? []].some(
|
|
1604
|
-
(p) => pathname.startsWith(p)
|
|
1605
|
-
);
|
|
1606
|
-
};
|
|
1607
|
-
var NavItemTooltip = ({
|
|
1608
|
-
to,
|
|
1609
|
-
label,
|
|
1610
|
-
children
|
|
1611
|
-
}) => {
|
|
1612
|
-
const { t: t2 } = useTranslation4();
|
|
1613
|
-
const { state } = useSidebar();
|
|
1614
|
-
const globalShortcuts = useGlobalShortcuts();
|
|
1615
|
-
const shortcut = globalShortcuts.find((s) => s.to === to);
|
|
1616
|
-
if (state === "collapsed" && label) {
|
|
1617
|
-
return /* @__PURE__ */ jsx7(Tooltip, { content: label, side: "right", delayDuration: 0, children: /* @__PURE__ */ jsx7("div", { className: "w-full", children }) });
|
|
1618
|
-
}
|
|
1619
|
-
return /* @__PURE__ */ jsx7(
|
|
1620
|
-
ConditionalTooltip,
|
|
1621
|
-
{
|
|
1622
|
-
showTooltip: !!shortcut,
|
|
1623
|
-
maxWidth: 9999,
|
|
1624
|
-
content: /* @__PURE__ */ jsxs3("div", { className: "txt-compact-xsmall flex h-5 items-center justify-between gap-x-2 whitespace-nowrap", children: [
|
|
1625
|
-
/* @__PURE__ */ jsx7("span", { children: shortcut?.label }),
|
|
1626
|
-
/* @__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: [
|
|
1627
|
-
/* @__PURE__ */ jsx7(Kbd2, { children: key }, key),
|
|
1628
|
-
index < (shortcut.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx7("span", { className: "txt-compact-xsmall text-ui-fg-muted", children: t2("app.keyboardShortcuts.then") })
|
|
1629
|
-
] }, index)) })
|
|
1630
|
-
] }),
|
|
1631
|
-
side: "right",
|
|
1632
|
-
delayDuration: 1500,
|
|
1633
|
-
children: /* @__PURE__ */ jsx7("div", { className: "w-full", children })
|
|
1634
|
-
}
|
|
1635
|
-
);
|
|
1636
|
-
};
|
|
1637
|
-
var NavItem = ({
|
|
1638
|
-
icon,
|
|
1639
|
-
label,
|
|
1640
|
-
to,
|
|
1641
|
-
items,
|
|
1642
|
-
type = "core",
|
|
1643
|
-
from,
|
|
1644
|
-
translationNs
|
|
1645
|
-
}) => {
|
|
1646
|
-
const { t: t2 } = useTranslation4(translationNs);
|
|
1647
|
-
const { pathname } = useLocation3();
|
|
1648
|
-
const displayLabel = translationNs ? t2(label) : label;
|
|
1649
|
-
const [open, setOpen] = useState7(getIsOpen(to, items, pathname));
|
|
1650
|
-
useEffect6(() => {
|
|
1651
|
-
setOpen(getIsOpen(to, items, pathname));
|
|
1652
|
-
}, [pathname, to, items]);
|
|
1653
|
-
const navLinkClassNames = useCallback6(
|
|
1654
|
-
({
|
|
1655
|
-
to: to2,
|
|
1656
|
-
isActive,
|
|
1657
|
-
isNested = false,
|
|
1658
|
-
isSetting: isSetting2 = false
|
|
1659
|
-
}) => {
|
|
1660
|
-
if (["core", "setting"].includes(type)) {
|
|
1661
|
-
isActive = pathname.startsWith(to2);
|
|
1662
|
-
if (isActive && !isNested && items?.length) {
|
|
1663
|
-
const nestedIsActive = items.some(
|
|
1664
|
-
(item) => pathname.startsWith(item.to)
|
|
1665
|
-
);
|
|
1666
|
-
if (nestedIsActive) {
|
|
1667
|
-
isActive = false;
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
return clx2(BASE_NAV_LINK_CLASSES, {
|
|
1672
|
-
[NESTED_NAV_LINK_CLASSES]: isNested,
|
|
1673
|
-
[ACTIVE_NAV_LINK_CLASSES]: isActive,
|
|
1674
|
-
[SETTING_NAV_LINK_CLASSES]: isSetting2
|
|
1675
|
-
});
|
|
1676
|
-
},
|
|
1677
|
-
[type, pathname, items]
|
|
1678
|
-
);
|
|
1679
|
-
const isSetting = type === "setting";
|
|
1680
|
-
return /* @__PURE__ */ jsxs3(
|
|
1681
|
-
"div",
|
|
1682
|
-
{
|
|
1683
|
-
className: "px-3",
|
|
1684
|
-
"data-testid": `sidebar-nav-item-${to.replace(/\//g, "-").replace(/^-/, "")}`,
|
|
1685
|
-
children: [
|
|
1686
|
-
/* @__PURE__ */ jsx7(NavItemTooltip, { to, label: displayLabel, children: /* @__PURE__ */ jsxs3(
|
|
1687
|
-
NavLink,
|
|
1688
|
-
{
|
|
1689
|
-
to,
|
|
1690
|
-
end: items?.some((i) => i.to === pathname),
|
|
1691
|
-
state: from ? {
|
|
1692
|
-
from
|
|
1693
|
-
} : void 0,
|
|
1694
|
-
className: ({ isActive }) => {
|
|
1695
|
-
return clx2(navLinkClassNames({ isActive, isSetting, to }), {
|
|
1696
|
-
"max-lg:hidden": !!items?.length
|
|
1697
|
-
});
|
|
1698
|
-
},
|
|
1699
|
-
"data-testid": `sidebar-nav-link-${to.replace(/\//g, "-").replace(/^-/, "")}`,
|
|
1700
|
-
children: [
|
|
1701
|
-
type !== "setting" && /* @__PURE__ */ jsx7("div", { className: "flex size-6 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
|
|
1702
|
-
/* @__PURE__ */ jsx7(
|
|
1703
|
-
Text2,
|
|
1704
|
-
{
|
|
1705
|
-
size: "small",
|
|
1706
|
-
weight: "plus",
|
|
1707
|
-
leading: "compact",
|
|
1708
|
-
className: clx2("shrink-0 whitespace-nowrap", SIDEBAR_RAIL_FADE),
|
|
1709
|
-
children: displayLabel
|
|
1710
|
-
}
|
|
1711
|
-
)
|
|
1712
|
-
]
|
|
1713
|
-
}
|
|
1714
|
-
) }),
|
|
1715
|
-
items && items.length > 0 && /* @__PURE__ */ jsxs3(
|
|
1716
|
-
RadixCollapsible.Root,
|
|
1717
|
-
{
|
|
1718
|
-
open,
|
|
1719
|
-
onOpenChange: setOpen,
|
|
1720
|
-
className: "group-data-[state=collapsed]/sidebar:hidden",
|
|
1721
|
-
children: [
|
|
1722
|
-
/* @__PURE__ */ jsxs3(
|
|
1723
|
-
RadixCollapsible.Trigger,
|
|
1724
|
-
{
|
|
1725
|
-
className: clx2(
|
|
1726
|
-
"flex w-full items-center gap-x-2 rounded-md py-0.5 pl-0.5 pr-2 text-ui-fg-subtle outline-none transition-fg hover:bg-ui-bg-subtle-hover hover:text-ui-fg-base lg:hidden",
|
|
1727
|
-
{ "pl-2": isSetting }
|
|
1728
|
-
),
|
|
1729
|
-
children: [
|
|
1730
|
-
/* @__PURE__ */ jsx7("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
|
|
1731
|
-
/* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: displayLabel })
|
|
1732
|
-
]
|
|
1733
|
-
}
|
|
1734
|
-
),
|
|
1735
|
-
/* @__PURE__ */ jsx7(RadixCollapsible.Content, { children: /* @__PURE__ */ jsx7(
|
|
1736
|
-
"div",
|
|
1737
|
-
{
|
|
1738
|
-
className: "flex flex-col gap-y-0.5 pb-2 pt-0.5",
|
|
1739
|
-
"data-testid": `sidebar-nav-nested-items-${to.replace(/\//g, "-").replace(/^-/, "")}`,
|
|
1740
|
-
children: /* @__PURE__ */ jsxs3("ul", { className: "flex flex-col gap-y-0.5", children: [
|
|
1741
|
-
/* @__PURE__ */ jsx7("li", { className: "flex w-full items-center gap-x-1 lg:hidden", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to, children: /* @__PURE__ */ jsx7(
|
|
1742
|
-
NavLink,
|
|
1743
|
-
{
|
|
1744
|
-
to,
|
|
1745
|
-
end: true,
|
|
1746
|
-
className: ({ isActive }) => {
|
|
1747
|
-
return clx2(
|
|
1748
|
-
navLinkClassNames({
|
|
1749
|
-
to,
|
|
1750
|
-
isActive,
|
|
1751
|
-
isSetting,
|
|
1752
|
-
isNested: true
|
|
1753
|
-
})
|
|
1754
|
-
);
|
|
1755
|
-
},
|
|
1756
|
-
"data-testid": `sidebar-nav-link-nested-${to.replace(/\//g, "-").replace(/^-/, "")}`,
|
|
1757
|
-
children: /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: displayLabel })
|
|
1758
|
-
}
|
|
1759
|
-
) }) }),
|
|
1760
|
-
items.map((item) => {
|
|
1761
|
-
return /* @__PURE__ */ jsx7("li", { className: "flex h-7 items-center", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to: item.to, children: /* @__PURE__ */ jsx7(
|
|
1762
|
-
NavLink,
|
|
1763
|
-
{
|
|
1764
|
-
to: item.to,
|
|
1765
|
-
end: true,
|
|
1766
|
-
className: ({ isActive }) => {
|
|
1767
|
-
return clx2(
|
|
1768
|
-
navLinkClassNames({
|
|
1769
|
-
to: item.to,
|
|
1770
|
-
isActive,
|
|
1771
|
-
isSetting,
|
|
1772
|
-
isNested: true
|
|
1773
|
-
})
|
|
1774
|
-
);
|
|
1775
|
-
},
|
|
1776
|
-
"data-testid": `sidebar-nav-link-nested-${item.to.replace(/\//g, "-").replace(/^-/, "")}`,
|
|
1777
|
-
children: /* @__PURE__ */ jsx7(
|
|
1778
|
-
NestedNavLabel,
|
|
1779
|
-
{
|
|
1780
|
-
label: item.label,
|
|
1781
|
-
translationNs: item.translationNs
|
|
1782
|
-
}
|
|
1783
|
-
)
|
|
1784
|
-
}
|
|
1785
|
-
) }) }, item.to);
|
|
1786
|
-
})
|
|
1787
|
-
] })
|
|
1788
|
-
}
|
|
1789
|
-
) })
|
|
1790
|
-
]
|
|
1791
|
-
}
|
|
1792
|
-
)
|
|
1793
|
-
]
|
|
1794
|
-
}
|
|
1795
|
-
);
|
|
1796
|
-
};
|
|
1797
|
-
var Icon = ({ icon, type }) => {
|
|
1798
|
-
if (!icon) {
|
|
1799
|
-
return null;
|
|
1800
|
-
}
|
|
1801
|
-
return type === "extension" ? /* @__PURE__ */ jsx7("div", { className: "flex h-5 w-5 items-center justify-center rounded-[4px] bg-ui-bg-base shadow-borders-base", children: /* @__PURE__ */ jsx7("div", { className: "h-[15px] w-[15px] overflow-hidden rounded-sm", children: icon }) }) : icon;
|
|
1802
|
-
};
|
|
1803
|
-
|
|
1804
|
-
// src/components/layout/shell/shell.tsx
|
|
1805
|
-
import { SidebarLeft, TriangleRightMini, XMark } from "@medusajs/icons";
|
|
1806
|
-
import { IconButton as IconButton2, clx as clx3 } from "@medusajs/ui";
|
|
1807
|
-
import { AnimatePresence } from "motion/react";
|
|
1808
|
-
import { Dialog as RadixDialog2 } from "radix-ui";
|
|
1809
|
-
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
1810
|
-
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1811
|
-
import {
|
|
1812
|
-
Link,
|
|
1813
|
-
Outlet as Outlet2,
|
|
1814
|
-
useMatches,
|
|
1815
|
-
useNavigation
|
|
1816
|
-
} from "react-router-dom";
|
|
1817
|
-
import { WidgetZone } from "@mercurjs/dashboard-shared";
|
|
1818
|
-
|
|
1819
|
-
// src/components/common/progress-bar/progress-bar.tsx
|
|
1820
|
-
import { motion } from "motion/react";
|
|
1821
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1822
|
-
var ProgressBar = ({ duration = 2 }) => {
|
|
1823
|
-
return /* @__PURE__ */ jsx8(
|
|
1824
|
-
motion.div,
|
|
1825
|
-
{
|
|
1826
|
-
className: "bg-ui-fg-subtle size-full",
|
|
1827
|
-
initial: {
|
|
1828
|
-
width: "0%"
|
|
1829
|
-
},
|
|
1830
|
-
transition: {
|
|
1831
|
-
delay: 0.2,
|
|
1832
|
-
duration,
|
|
1833
|
-
ease: "linear"
|
|
1834
|
-
},
|
|
1835
|
-
animate: {
|
|
1836
|
-
width: "90%"
|
|
1837
|
-
},
|
|
1838
|
-
exit: {
|
|
1839
|
-
width: "100%",
|
|
1840
|
-
transition: { duration: 0.2, ease: "linear" }
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
);
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
// src/components/layout/shell/shell.tsx
|
|
1847
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1848
|
-
var Shell = ({ children, rail = true }) => {
|
|
1849
|
-
const globalShortcuts = useGlobalShortcuts();
|
|
1850
|
-
const navigation2 = useNavigation();
|
|
1851
|
-
const loading = navigation2.state === "loading";
|
|
1852
|
-
return /* @__PURE__ */ jsx9(KeybindProvider, { shortcuts: globalShortcuts, children: /* @__PURE__ */ jsxs4("div", { className: "relative flex h-screen flex-col items-start overflow-hidden lg:flex-row", children: [
|
|
1853
|
-
/* @__PURE__ */ jsx9(NavigationBar, { loading }),
|
|
1854
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1855
|
-
/* @__PURE__ */ jsx9(MobileSidebarContainer, { children }),
|
|
1856
|
-
/* @__PURE__ */ jsx9(DesktopSidebarContainer, { rail, children })
|
|
1857
|
-
] }),
|
|
1858
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex h-screen w-full flex-col overflow-auto", children: [
|
|
1859
|
-
/* @__PURE__ */ jsx9(Topbar, {}),
|
|
1860
|
-
/* @__PURE__ */ jsx9(
|
|
1861
|
-
"main",
|
|
1862
|
-
{
|
|
1863
|
-
className: clx3(
|
|
1864
|
-
"flex h-full w-full flex-col items-center overflow-y-auto transition-opacity delay-200 duration-200",
|
|
1865
|
-
{
|
|
1866
|
-
"opacity-25": loading
|
|
1867
|
-
}
|
|
1868
|
-
),
|
|
1869
|
-
children: /* @__PURE__ */ jsx9(Gutter, { children: /* @__PURE__ */ jsx9(Outlet2, {}) })
|
|
1870
|
-
}
|
|
1871
|
-
)
|
|
1872
|
-
] })
|
|
1873
|
-
] }) });
|
|
1874
|
-
};
|
|
1875
|
-
var NavigationBar = ({ loading }) => {
|
|
1876
|
-
const [showBar, setShowBar] = useState8(false);
|
|
1877
|
-
useEffect7(() => {
|
|
1878
|
-
let timeout;
|
|
1879
|
-
if (loading) {
|
|
1880
|
-
timeout = setTimeout(() => {
|
|
1881
|
-
setShowBar(true);
|
|
1882
|
-
}, 200);
|
|
1883
|
-
} else {
|
|
1884
|
-
setShowBar(false);
|
|
1885
|
-
}
|
|
1886
|
-
return () => {
|
|
1887
|
-
clearTimeout(timeout);
|
|
1888
|
-
};
|
|
1889
|
-
}, [loading]);
|
|
1890
|
-
return /* @__PURE__ */ jsx9("div", { className: "fixed inset-x-0 top-0 z-50 h-1", children: /* @__PURE__ */ jsx9(AnimatePresence, { children: showBar ? /* @__PURE__ */ jsx9(ProgressBar, {}) : null }) });
|
|
1891
|
-
};
|
|
1892
|
-
var Gutter = ({ children }) => {
|
|
1893
|
-
return /* @__PURE__ */ jsx9("div", { className: "flex w-full max-w-[1600px] flex-col gap-y-2 p-3", children });
|
|
1894
|
-
};
|
|
1895
|
-
var Breadcrumbs = () => {
|
|
1896
|
-
const matches = useMatches();
|
|
1897
|
-
const crumbs = matches.filter((match) => match.handle?.breadcrumb).map((match) => {
|
|
1898
|
-
const handle = match.handle;
|
|
1899
|
-
let label = void 0;
|
|
1900
|
-
try {
|
|
1901
|
-
label = handle.breadcrumb?.(match);
|
|
1902
|
-
} catch {
|
|
1903
|
-
}
|
|
1904
|
-
if (!label) {
|
|
1905
|
-
return null;
|
|
1906
|
-
}
|
|
1907
|
-
return {
|
|
1908
|
-
label,
|
|
1909
|
-
path: match.pathname
|
|
1910
|
-
};
|
|
1911
|
-
}).filter(Boolean);
|
|
1912
|
-
return /* @__PURE__ */ jsx9(
|
|
1913
|
-
"ol",
|
|
1914
|
-
{
|
|
1915
|
-
className: clx3(
|
|
1916
|
-
"text-ui-fg-muted txt-compact-small-plus flex select-none items-center"
|
|
1917
|
-
),
|
|
1918
|
-
children: crumbs.map((crumb, index) => {
|
|
1919
|
-
const isLast = index === crumbs.length - 1;
|
|
1920
|
-
const isSingle = crumbs.length === 1;
|
|
1921
|
-
return /* @__PURE__ */ jsxs4("li", { className: clx3("flex items-center"), children: [
|
|
1922
|
-
!isLast ? /* @__PURE__ */ jsx9(
|
|
1923
|
-
Link,
|
|
1924
|
-
{
|
|
1925
|
-
className: "transition-fg hover:text-ui-fg-subtle",
|
|
1926
|
-
to: crumb.path,
|
|
1927
|
-
children: crumb.label
|
|
1928
|
-
}
|
|
1929
|
-
) : /* @__PURE__ */ jsxs4("div", { children: [
|
|
1930
|
-
!isSingle && /* @__PURE__ */ jsx9("span", { className: "block lg:hidden", children: "..." }),
|
|
1931
|
-
/* @__PURE__ */ jsx9(
|
|
1932
|
-
"span",
|
|
1933
|
-
{
|
|
1934
|
-
className: clx3({
|
|
1935
|
-
"hidden lg:block": !isSingle
|
|
1936
|
-
}),
|
|
1937
|
-
children: crumb.label
|
|
1938
|
-
},
|
|
1939
|
-
index
|
|
1940
|
-
)
|
|
1941
|
-
] }),
|
|
1942
|
-
!isLast && /* @__PURE__ */ jsx9("span", { className: "mx-2", children: /* @__PURE__ */ jsx9(TriangleRightMini, { className: "rtl:rotate-180" }) })
|
|
1943
|
-
] }, index);
|
|
1944
|
-
})
|
|
1945
|
-
}
|
|
1946
|
-
);
|
|
1947
|
-
};
|
|
1948
|
-
var ToggleSidebar = () => {
|
|
1949
|
-
const { toggle, state } = useSidebar();
|
|
1950
|
-
return /* @__PURE__ */ jsxs4("div", { children: [
|
|
1951
|
-
/* @__PURE__ */ jsx9(
|
|
1952
|
-
IconButton2,
|
|
1953
|
-
{
|
|
1954
|
-
className: "hidden lg:flex",
|
|
1955
|
-
variant: "transparent",
|
|
1956
|
-
onClick: () => toggle("desktop"),
|
|
1957
|
-
size: "small",
|
|
1958
|
-
"aria-expanded": state === "expanded",
|
|
1959
|
-
children: /* @__PURE__ */ jsx9(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
|
|
1960
|
-
}
|
|
1961
|
-
),
|
|
1962
|
-
/* @__PURE__ */ jsx9(
|
|
1963
|
-
IconButton2,
|
|
1964
|
-
{
|
|
1965
|
-
className: "hidden max-lg:flex",
|
|
1966
|
-
variant: "transparent",
|
|
1967
|
-
onClick: () => toggle("mobile"),
|
|
1968
|
-
size: "small",
|
|
1969
|
-
children: /* @__PURE__ */ jsx9(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
|
|
1970
|
-
}
|
|
1971
|
-
)
|
|
1972
|
-
] });
|
|
1973
|
-
};
|
|
1974
|
-
var Topbar = () => {
|
|
1975
|
-
return /* @__PURE__ */ jsxs4("div", { className: "grid w-full grid-cols-2 border-b p-3", children: [
|
|
1976
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-1.5", children: [
|
|
1977
|
-
/* @__PURE__ */ jsx9(ToggleSidebar, {}),
|
|
1978
|
-
/* @__PURE__ */ jsx9(Breadcrumbs, {})
|
|
1979
|
-
] }),
|
|
1980
|
-
/* @__PURE__ */ jsx9("div", { className: "flex items-center justify-end gap-x-3", children: /* @__PURE__ */ jsx9(WidgetZone, { id: "topbar" }) })
|
|
1981
|
-
] });
|
|
1982
|
-
};
|
|
1983
|
-
var DesktopSidebarContainer = ({
|
|
1984
|
-
children,
|
|
1985
|
-
rail
|
|
1986
|
-
}) => {
|
|
1987
|
-
const { state } = useSidebar();
|
|
1988
|
-
return /* @__PURE__ */ jsx9(
|
|
1989
|
-
"div",
|
|
1990
|
-
{
|
|
1991
|
-
"data-state": state,
|
|
1992
|
-
className: clx3(
|
|
1993
|
-
"group/sidebar hidden h-screen w-[220px] shrink-0 overflow-x-hidden border-e lg:flex",
|
|
1994
|
-
"transition-[width] duration-200 ease-sidebar motion-reduce:transition-none",
|
|
1995
|
-
rail ? "data-[state=collapsed]:w-[52px]" : "data-[state=collapsed]:w-0 data-[state=collapsed]:border-e-0"
|
|
1996
|
-
),
|
|
1997
|
-
children: rail ? children : /* @__PURE__ */ jsx9("div", { className: "flex w-[220px] shrink-0", children })
|
|
1998
|
-
}
|
|
1999
|
-
);
|
|
2000
|
-
};
|
|
2001
|
-
var MobileSidebarContainer = ({ children }) => {
|
|
2002
|
-
const { t: t2 } = useTranslation5();
|
|
2003
|
-
const { mobile, toggle } = useSidebar();
|
|
2004
|
-
return /* @__PURE__ */ jsx9(RadixDialog2.Root, { open: mobile, onOpenChange: () => toggle("mobile"), children: /* @__PURE__ */ jsxs4(RadixDialog2.Portal, { children: [
|
|
2005
|
-
/* @__PURE__ */ jsx9(
|
|
2006
|
-
RadixDialog2.Overlay,
|
|
2007
|
-
{
|
|
2008
|
-
className: clx3(
|
|
2009
|
-
"bg-ui-bg-overlay fixed inset-0",
|
|
2010
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
2011
|
-
)
|
|
2012
|
-
}
|
|
2013
|
-
),
|
|
2014
|
-
/* @__PURE__ */ jsxs4(
|
|
2015
|
-
RadixDialog2.Content,
|
|
2016
|
-
{
|
|
2017
|
-
className: clx3(
|
|
2018
|
-
"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",
|
|
2019
|
-
"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"
|
|
2020
|
-
),
|
|
2021
|
-
children: [
|
|
2022
|
-
/* @__PURE__ */ jsxs4("div", { className: "p-3", children: [
|
|
2023
|
-
/* @__PURE__ */ jsx9(RadixDialog2.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
2024
|
-
IconButton2,
|
|
2025
|
-
{
|
|
2026
|
-
size: "small",
|
|
2027
|
-
variant: "transparent",
|
|
2028
|
-
className: "text-ui-fg-subtle",
|
|
2029
|
-
children: /* @__PURE__ */ jsx9(XMark, {})
|
|
2030
|
-
}
|
|
2031
|
-
) }),
|
|
2032
|
-
/* @__PURE__ */ jsx9(RadixDialog2.Title, { className: "sr-only", children: t2("app.nav.accessibility.title") }),
|
|
2033
|
-
/* @__PURE__ */ jsx9(RadixDialog2.Description, { className: "sr-only", children: t2("app.nav.accessibility.description") })
|
|
2034
|
-
] }),
|
|
2035
|
-
children
|
|
2036
|
-
]
|
|
2037
|
-
}
|
|
2038
|
-
)
|
|
2039
|
-
] }) });
|
|
2040
|
-
};
|
|
2041
|
-
|
|
2042
|
-
// src/components/layout/user-menu/user-menu.tsx
|
|
2043
|
-
import {
|
|
2044
|
-
BookOpen,
|
|
2045
|
-
CircleHalfSolid,
|
|
2046
|
-
EllipsisHorizontal,
|
|
2047
|
-
Keyboard,
|
|
2048
|
-
OpenRectArrowOut,
|
|
2049
|
-
TimelineVertical,
|
|
2050
|
-
User as UserIcon,
|
|
2051
|
-
XMark as XMark2
|
|
2052
|
-
} from "@medusajs/icons";
|
|
2053
|
-
import {
|
|
2054
|
-
Avatar,
|
|
2055
|
-
DropdownMenu as DropdownMenu2,
|
|
2056
|
-
Heading,
|
|
2057
|
-
IconButton as IconButton3,
|
|
2058
|
-
Input,
|
|
2059
|
-
Kbd as Kbd3,
|
|
2060
|
-
Text as Text3,
|
|
2061
|
-
clx as clx4
|
|
2062
|
-
} from "@medusajs/ui";
|
|
2063
|
-
import { Dialog as RadixDialog3 } from "radix-ui";
|
|
2064
|
-
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
2065
|
-
import { useState as useState9 } from "react";
|
|
2066
|
-
import { Link as Link2, useLocation as useLocation4, useNavigate as useNavigate3 } from "react-router-dom";
|
|
2067
|
-
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2068
|
-
var UserMenu = () => {
|
|
2069
|
-
const { t: t2 } = useTranslation6();
|
|
2070
|
-
const location = useLocation4();
|
|
2071
|
-
const direction = useDocumentDirection();
|
|
2072
|
-
const menuPlacement = useSidebarMenuPlacement("end");
|
|
2073
|
-
const [openMenu, setOpenMenu] = useState9(false);
|
|
2074
|
-
const [openModal, setOpenModal] = useState9(false);
|
|
2075
|
-
const toggleModal = () => {
|
|
2076
|
-
setOpenMenu(false);
|
|
2077
|
-
setOpenModal(!openModal);
|
|
2078
|
-
};
|
|
2079
|
-
return /* @__PURE__ */ jsxs5("div", { "data-testid": "sidebar-user-menu", children: [
|
|
2080
|
-
/* @__PURE__ */ jsxs5(DropdownMenu2, { dir: direction, open: openMenu, onOpenChange: setOpenMenu, "data-testid": "sidebar-user-menu-dropdown", children: [
|
|
2081
|
-
/* @__PURE__ */ jsx10(UserBadge, {}),
|
|
2082
|
-
/* @__PURE__ */ jsxs5(DropdownMenu2.Content, { ...menuPlacement, className: SIDEBAR_MENU_CONTENT, "data-testid": "sidebar-user-menu-content", children: [
|
|
2083
|
-
/* @__PURE__ */ jsx10(UserItem, {}),
|
|
2084
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-1" }),
|
|
2085
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-profile-settings", children: /* @__PURE__ */ jsxs5(Link2, { to: "/settings/profile", state: { from: location.pathname }, children: [
|
|
2086
|
-
/* @__PURE__ */ jsx10(UserIcon, { className: "text-ui-fg-subtle me-2" }),
|
|
2087
|
-
t2("app.menus.user.profileSettings")
|
|
2088
|
-
] }) }),
|
|
2089
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-2" }),
|
|
2090
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-documentation", children: /* @__PURE__ */ jsxs5(Link2, { to: "https://docs.mercurjs.com/welcome", target: "_blank", children: [
|
|
2091
|
-
/* @__PURE__ */ jsx10(BookOpen, { className: "text-ui-fg-subtle me-2" }),
|
|
2092
|
-
t2("app.menus.user.documentation")
|
|
2093
|
-
] }) }),
|
|
2094
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-changelog", children: /* @__PURE__ */ jsxs5(Link2, { to: "https://www.mercurjs.com/updates", target: "_blank", children: [
|
|
2095
|
-
/* @__PURE__ */ jsx10(TimelineVertical, { className: "text-ui-fg-subtle me-2" }),
|
|
2096
|
-
t2("app.menus.user.changelog")
|
|
2097
|
-
] }) }),
|
|
2098
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-3" }),
|
|
2099
|
-
/* @__PURE__ */ jsxs5(DropdownMenu2.Item, { onClick: toggleModal, "data-testid": "sidebar-user-menu-shortcuts", children: [
|
|
2100
|
-
/* @__PURE__ */ jsx10(Keyboard, { className: "text-ui-fg-subtle me-2" }),
|
|
2101
|
-
t2("app.menus.user.shortcuts")
|
|
2102
|
-
] }),
|
|
2103
|
-
/* @__PURE__ */ jsx10(ThemeToggle, {}),
|
|
2104
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-4" }),
|
|
2105
|
-
/* @__PURE__ */ jsx10(Logout, {})
|
|
2106
|
-
] })
|
|
2107
|
-
] }),
|
|
2108
|
-
/* @__PURE__ */ jsx10(GlobalKeybindsModal, { open: openModal, onOpenChange: setOpenModal })
|
|
2109
|
-
] });
|
|
2110
|
-
};
|
|
2111
|
-
var UserBadge = () => {
|
|
2112
|
-
const { user, isPending, isError, error } = useMe();
|
|
2113
|
-
const name = [user?.first_name, user?.last_name].filter(Boolean).join(" ");
|
|
2114
|
-
const displayName = name || user?.email;
|
|
2115
|
-
const fallback = displayName ? displayName[0].toUpperCase() : null;
|
|
2116
|
-
if (isPending) {
|
|
2117
|
-
return /* @__PURE__ */ jsxs5("button", { className: "shadow-borders-base flex max-w-[192px] select-none items-center gap-x-2 overflow-hidden text-ellipsis whitespace-nowrap rounded-full py-1 ps-1 pe-2.5", children: [
|
|
2118
|
-
/* @__PURE__ */ jsx10(Skeleton, { className: "h-5 w-5 rounded-full" }),
|
|
2119
|
-
/* @__PURE__ */ jsx10(Skeleton, { className: "h-[9px] w-[70px]" })
|
|
2120
|
-
] });
|
|
2121
|
-
}
|
|
2122
|
-
if (isError) {
|
|
2123
|
-
throw error;
|
|
2124
|
-
}
|
|
2125
|
-
return /* @__PURE__ */ jsx10("div", { className: "p-3", "data-testid": "sidebar-user-menu-badge", children: /* @__PURE__ */ jsxs5(
|
|
2126
|
-
DropdownMenu2.Trigger,
|
|
2127
|
-
{
|
|
2128
|
-
disabled: !user,
|
|
2129
|
-
className: clx4(
|
|
2130
|
-
"bg-ui-bg-subtle grid w-full cursor-pointer grid-cols-[24px_1fr_15px] items-center gap-2 rounded-md py-1 ps-0.5 pe-2 outline-none",
|
|
2131
|
-
"hover:bg-ui-bg-subtle-hover",
|
|
2132
|
-
"data-[state=open]:bg-ui-bg-subtle-hover",
|
|
2133
|
-
"focus-visible:shadow-borders-focus"
|
|
2134
|
-
),
|
|
2135
|
-
"data-testid": "sidebar-user-menu-trigger",
|
|
2136
|
-
children: [
|
|
2137
|
-
/* @__PURE__ */ jsx10("div", { className: "flex size-6 shrink-0 items-center justify-center", "data-testid": "sidebar-user-menu-avatar-container", children: fallback ? /* @__PURE__ */ jsx10(Avatar, { size: "xsmall", fallback, "data-testid": "sidebar-user-menu-avatar" }) : /* @__PURE__ */ jsx10(Skeleton, { className: "h-6 w-6 rounded-full" }) }),
|
|
2138
|
-
/* @__PURE__ */ jsx10("div", { className: clx4("flex items-center overflow-hidden whitespace-nowrap", SIDEBAR_RAIL_FADE), "data-testid": "sidebar-user-menu-name-container", children: displayName ? /* @__PURE__ */ jsx10(
|
|
2139
|
-
Text3,
|
|
2140
|
-
{
|
|
2141
|
-
size: "xsmall",
|
|
2142
|
-
weight: "plus",
|
|
2143
|
-
leading: "compact",
|
|
2144
|
-
className: "truncate",
|
|
2145
|
-
"data-testid": "sidebar-user-menu-name",
|
|
2146
|
-
children: displayName
|
|
2147
|
-
}
|
|
2148
|
-
) : /* @__PURE__ */ jsx10(Skeleton, { className: "h-[9px] w-[70px]" }) }),
|
|
2149
|
-
/* @__PURE__ */ jsx10(EllipsisHorizontal, { className: clx4("text-ui-fg-muted", SIDEBAR_RAIL_FADE) })
|
|
2150
|
-
]
|
|
2151
|
-
}
|
|
2152
|
-
) });
|
|
2153
|
-
};
|
|
2154
|
-
var ThemeToggle = () => {
|
|
2155
|
-
const { t: t2 } = useTranslation6();
|
|
2156
|
-
const { theme, setTheme } = useTheme();
|
|
2157
|
-
return /* @__PURE__ */ jsxs5(DropdownMenu2.SubMenu, { "data-testid": "sidebar-user-menu-theme-toggle", children: [
|
|
2158
|
-
/* @__PURE__ */ jsxs5(DropdownMenu2.SubMenuTrigger, { dir: "ltr", className: "rounded-md rtl:rotate-180", "data-testid": "sidebar-user-menu-theme-trigger", children: [
|
|
2159
|
-
/* @__PURE__ */ jsx10(CircleHalfSolid, { className: "text-ui-fg-subtle me-2" }),
|
|
2160
|
-
/* @__PURE__ */ jsx10("span", { className: "rtl:rotate-180", children: t2("app.menus.user.theme.label") })
|
|
2161
|
-
] }),
|
|
2162
|
-
/* @__PURE__ */ jsx10(DropdownMenu2.SubMenuContent, { "data-testid": "sidebar-user-menu-theme-content", children: /* @__PURE__ */ jsxs5(DropdownMenu2.RadioGroup, { value: theme, "data-testid": "sidebar-user-menu-theme-radio-group", children: [
|
|
2163
|
-
/* @__PURE__ */ jsx10(
|
|
2164
|
-
DropdownMenu2.RadioItem,
|
|
2165
|
-
{
|
|
2166
|
-
value: "system",
|
|
2167
|
-
onClick: (e) => {
|
|
2168
|
-
e.preventDefault();
|
|
2169
|
-
setTheme("system");
|
|
2170
|
-
},
|
|
2171
|
-
"data-testid": "sidebar-user-menu-theme-system",
|
|
2172
|
-
children: t2("app.menus.user.theme.system")
|
|
2173
|
-
}
|
|
2174
|
-
),
|
|
2175
|
-
/* @__PURE__ */ jsx10(
|
|
2176
|
-
DropdownMenu2.RadioItem,
|
|
2177
|
-
{
|
|
2178
|
-
value: "light",
|
|
2179
|
-
onClick: (e) => {
|
|
2180
|
-
e.preventDefault();
|
|
2181
|
-
setTheme("light");
|
|
2182
|
-
},
|
|
2183
|
-
"data-testid": "sidebar-user-menu-theme-light",
|
|
2184
|
-
children: t2("app.menus.user.theme.light")
|
|
2185
|
-
}
|
|
2186
|
-
),
|
|
2187
|
-
/* @__PURE__ */ jsx10(
|
|
2188
|
-
DropdownMenu2.RadioItem,
|
|
2189
|
-
{
|
|
2190
|
-
value: "dark",
|
|
2191
|
-
onClick: (e) => {
|
|
2192
|
-
e.preventDefault();
|
|
2193
|
-
setTheme("dark");
|
|
2194
|
-
},
|
|
2195
|
-
"data-testid": "sidebar-user-menu-theme-dark",
|
|
2196
|
-
children: t2("app.menus.user.theme.dark")
|
|
2197
|
-
}
|
|
2198
|
-
)
|
|
2199
|
-
] }) })
|
|
2200
|
-
] });
|
|
2201
|
-
};
|
|
2202
|
-
var Logout = () => {
|
|
2203
|
-
const { t: t2 } = useTranslation6();
|
|
2204
|
-
const navigate = useNavigate3();
|
|
2205
|
-
const { mutateAsync: logoutMutation } = useLogout();
|
|
2206
|
-
const handleLogout = async () => {
|
|
2207
|
-
await logoutMutation(void 0, {
|
|
2208
|
-
onSuccess: () => {
|
|
2209
|
-
queryClient.clear();
|
|
2210
|
-
navigate("/login");
|
|
2211
|
-
}
|
|
2212
|
-
});
|
|
2213
|
-
};
|
|
2214
|
-
return /* @__PURE__ */ jsx10(DropdownMenu2.Item, { onClick: handleLogout, "data-testid": "sidebar-user-menu-logout", children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-2", children: [
|
|
2215
|
-
/* @__PURE__ */ jsx10(OpenRectArrowOut, { className: "text-ui-fg-subtle" }),
|
|
2216
|
-
/* @__PURE__ */ jsx10("span", { children: t2("app.menus.actions.logout") })
|
|
2217
|
-
] }) });
|
|
2218
|
-
};
|
|
2219
|
-
var GlobalKeybindsModal = (props) => {
|
|
2220
|
-
const { t: t2 } = useTranslation6();
|
|
2221
|
-
const globalShortcuts = useGlobalShortcuts();
|
|
2222
|
-
const [searchValue, onSearchValueChange] = useState9("");
|
|
2223
|
-
const searchResults = searchValue ? globalShortcuts.filter((shortcut) => {
|
|
2224
|
-
return shortcut.label.toLowerCase().includes(searchValue?.toLowerCase());
|
|
2225
|
-
}) : globalShortcuts;
|
|
2226
|
-
return /* @__PURE__ */ jsx10(RadixDialog3.Root, { ...props, "data-testid": "shortcuts-modal", children: /* @__PURE__ */ jsxs5(RadixDialog3.Portal, { children: [
|
|
2227
|
-
/* @__PURE__ */ jsx10(RadixDialog3.Overlay, { className: "bg-ui-bg-overlay fixed inset-0", "data-testid": "shortcuts-modal-overlay" }),
|
|
2228
|
-
/* @__PURE__ */ jsxs5(RadixDialog3.Content, { className: "bg-ui-bg-subtle shadow-elevation-modal fixed left-[50%] top-[50%] flex h-full max-h-[612px] w-full max-w-[560px] translate-x-[-50%] translate-y-[-50%] flex-col divide-y overflow-hidden rounded-lg", "data-testid": "shortcuts-modal-content", children: [
|
|
2229
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-3 px-6 py-4", "data-testid": "shortcuts-modal-header", children: [
|
|
2230
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", "data-testid": "shortcuts-modal-header-top", children: [
|
|
2231
|
-
/* @__PURE__ */ jsxs5("div", { "data-testid": "shortcuts-modal-title-container", children: [
|
|
2232
|
-
/* @__PURE__ */ jsx10(RadixDialog3.Title, { asChild: true, children: /* @__PURE__ */ jsx10(Heading, { "data-testid": "shortcuts-modal-title", children: t2("app.menus.user.shortcuts") }) }),
|
|
2233
|
-
/* @__PURE__ */ jsx10(RadixDialog3.Description, { className: "sr-only", "data-testid": "shortcuts-modal-description" })
|
|
2234
|
-
] }),
|
|
2235
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-2", "data-testid": "shortcuts-modal-close-container", children: [
|
|
2236
|
-
/* @__PURE__ */ jsx10(Kbd3, { "data-testid": "shortcuts-modal-close-hint", children: "esc" }),
|
|
2237
|
-
/* @__PURE__ */ jsx10(RadixDialog3.Close, { asChild: true, children: /* @__PURE__ */ jsx10(IconButton3, { variant: "transparent", size: "small", "data-testid": "shortcuts-modal-close-button", children: /* @__PURE__ */ jsx10(XMark2, {}) }) })
|
|
2238
|
-
] })
|
|
2239
|
-
] }),
|
|
2240
|
-
/* @__PURE__ */ jsx10("div", { "data-testid": "shortcuts-modal-search-container", children: /* @__PURE__ */ jsx10(
|
|
2241
|
-
Input,
|
|
2242
|
-
{
|
|
2243
|
-
type: "search",
|
|
2244
|
-
value: searchValue,
|
|
2245
|
-
onChange: (e) => onSearchValueChange(e.target.value),
|
|
2246
|
-
"data-testid": "shortcuts-modal-search"
|
|
2247
|
-
}
|
|
2248
|
-
) })
|
|
2249
|
-
] }),
|
|
2250
|
-
/* @__PURE__ */ jsx10("div", { className: "flex flex-col divide-y overflow-y-auto", "data-testid": "shortcuts-modal-list", children: searchResults.map((shortcut, index) => {
|
|
2251
|
-
return /* @__PURE__ */ jsxs5(
|
|
2252
|
-
"div",
|
|
2253
|
-
{
|
|
2254
|
-
className: "text-ui-fg-subtle flex items-center justify-between px-6 py-3",
|
|
2255
|
-
"data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}`,
|
|
2256
|
-
children: [
|
|
2257
|
-
/* @__PURE__ */ jsx10(Text3, { size: "small", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-label`, children: shortcut.label }),
|
|
2258
|
-
/* @__PURE__ */ jsx10("div", { className: "flex items-center gap-x-1", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-keys`, children: shortcut.keys.Mac?.map((key, index2) => {
|
|
2259
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-1", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-key-${index2}`, children: [
|
|
2260
|
-
/* @__PURE__ */ jsx10(Kbd3, { "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-kbd-${index2}`, children: key }),
|
|
2261
|
-
index2 < (shortcut.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx10("span", { className: "txt-compact-xsmall text-ui-fg-subtle", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-separator-${index2}`, children: t2("app.keyboardShortcuts.then") })
|
|
2262
|
-
] }, index2);
|
|
2263
|
-
}) })
|
|
2264
|
-
]
|
|
2265
|
-
},
|
|
2266
|
-
index
|
|
2267
|
-
);
|
|
2268
|
-
}) })
|
|
2269
|
-
] })
|
|
2270
|
-
] }) });
|
|
2271
|
-
};
|
|
2272
|
-
var UserItem = () => {
|
|
2273
|
-
const { user, isPending, isError, error } = useMe();
|
|
2274
|
-
const loaded = !isPending && !!user;
|
|
2275
|
-
if (!loaded) {
|
|
2276
|
-
return /* @__PURE__ */ jsx10("div", {});
|
|
2277
|
-
}
|
|
2278
|
-
const name = [user.first_name, user.last_name].filter(Boolean).join(" ");
|
|
2279
|
-
const email = user.email;
|
|
2280
|
-
const fallback = name ? name[0].toUpperCase() : email[0].toUpperCase();
|
|
2281
|
-
const avatar = user.avatar_url;
|
|
2282
|
-
if (isError) {
|
|
2283
|
-
throw error;
|
|
2284
|
-
}
|
|
2285
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-3 overflow-hidden px-2 py-1", "data-testid": "sidebar-user-menu-item", children: [
|
|
2286
|
-
/* @__PURE__ */ jsx10(
|
|
2287
|
-
Avatar,
|
|
2288
|
-
{
|
|
2289
|
-
size: "small",
|
|
2290
|
-
variant: "rounded",
|
|
2291
|
-
src: avatar || void 0,
|
|
2292
|
-
fallback,
|
|
2293
|
-
"data-testid": "sidebar-user-menu-item-avatar"
|
|
2294
|
-
}
|
|
2295
|
-
),
|
|
2296
|
-
/* @__PURE__ */ jsxs5("div", { className: "block w-full min-w-0 max-w-[187px] overflow-hidden whitespace-nowrap", "data-testid": "sidebar-user-menu-item-details", children: [
|
|
2297
|
-
/* @__PURE__ */ jsx10(
|
|
2298
|
-
Text3,
|
|
2299
|
-
{
|
|
2300
|
-
size: "small",
|
|
2301
|
-
weight: "plus",
|
|
2302
|
-
leading: "compact",
|
|
2303
|
-
className: "overflow-hidden text-ellipsis whitespace-nowrap",
|
|
2304
|
-
"data-testid": "sidebar-user-menu-item-name",
|
|
2305
|
-
children: name || email
|
|
2306
|
-
}
|
|
2307
|
-
),
|
|
2308
|
-
!!name && /* @__PURE__ */ jsx10(
|
|
2309
|
-
Text3,
|
|
2310
|
-
{
|
|
2311
|
-
size: "xsmall",
|
|
2312
|
-
leading: "compact",
|
|
2313
|
-
className: "text-ui-fg-subtle overflow-hidden text-ellipsis whitespace-nowrap",
|
|
2314
|
-
"data-testid": "sidebar-user-menu-item-email",
|
|
2315
|
-
children: email
|
|
2316
|
-
}
|
|
2317
|
-
)
|
|
2318
|
-
] })
|
|
2319
|
-
] });
|
|
2320
|
-
};
|
|
2321
|
-
|
|
2322
|
-
// src/components/layout/main-layout/main-layout.tsx
|
|
2323
|
-
import menuItemsModule from "virtual:mercur/menu-items";
|
|
54
|
+
} from "./chunk-H6MYB7GB.js";
|
|
55
|
+
import "./chunk-U3I6S3RO.js";
|
|
56
|
+
import "./chunk-FQERBIVS.js";
|
|
2324
57
|
import {
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
58
|
+
_DataTable,
|
|
59
|
+
useDataTable
|
|
60
|
+
} from "./chunk-ZOU25JF6.js";
|
|
61
|
+
import "./chunk-YN3FGNJM.js";
|
|
62
|
+
import "./chunk-ZAOEFQ6K.js";
|
|
63
|
+
import "./chunk-IKAUNMRC.js";
|
|
64
|
+
import "./chunk-EIWPJWKF.js";
|
|
65
|
+
import "./chunk-46WEBDVJ.js";
|
|
66
|
+
import {
|
|
67
|
+
ActionMenu
|
|
68
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
69
|
+
import "./chunk-W5U6NPSN.js";
|
|
70
|
+
import "./chunk-DSQRFZCO.js";
|
|
71
|
+
import "./chunk-LHE6LM6S.js";
|
|
72
|
+
import "./chunk-BOPIWKTU.js";
|
|
73
|
+
import "./chunk-ALJIXUKL.js";
|
|
74
|
+
import "./chunk-QWT3GCLC.js";
|
|
75
|
+
import "./chunk-EVNTT2M3.js";
|
|
76
|
+
import "./chunk-AQHEU7OA.js";
|
|
77
|
+
import "./chunk-JW5SGRFC.js";
|
|
78
|
+
import "./chunk-AEBQQ2EG.js";
|
|
79
|
+
import "./chunk-CMVQ5SAG.js";
|
|
80
|
+
import {
|
|
81
|
+
useMe
|
|
82
|
+
} from "./chunk-62YRQVR7.js";
|
|
83
|
+
import "./chunk-2SCR7R3C.js";
|
|
84
|
+
import "./chunk-YMMREB3P.js";
|
|
85
|
+
import "./chunk-UNS2F7DK.js";
|
|
86
|
+
import "./chunk-56XMCNDS.js";
|
|
87
|
+
import "./chunk-I4WBDDWN.js";
|
|
88
|
+
import "./chunk-3JN6NCCN.js";
|
|
89
|
+
import "./chunk-FHZHKIWI.js";
|
|
90
|
+
import "./chunk-E5PC2WDZ.js";
|
|
91
|
+
import "./chunk-SCLV2T6Z.js";
|
|
92
|
+
import "./chunk-H5E3CGD7.js";
|
|
93
|
+
import "./chunk-S7TEUVP7.js";
|
|
94
|
+
import "./chunk-DYCCRR7B.js";
|
|
95
|
+
import "./chunk-OQ2J45XW.js";
|
|
96
|
+
import "./chunk-XWOFQSGH.js";
|
|
97
|
+
import "./chunk-HRMANL53.js";
|
|
98
|
+
import "./chunk-JC2FFAMW.js";
|
|
99
|
+
import "./chunk-OFW63WXL.js";
|
|
100
|
+
import "./chunk-SQ7J4KTS.js";
|
|
101
|
+
import "./chunk-LAVHRER2.js";
|
|
102
|
+
import "./chunk-Y7QKP6QU.js";
|
|
103
|
+
import "./chunk-INNFZYX2.js";
|
|
104
|
+
import "./chunk-Z476HUMI.js";
|
|
105
|
+
import {
|
|
106
|
+
queryClient
|
|
107
|
+
} from "./chunk-RHKRREUU.js";
|
|
108
|
+
import "./chunk-ZA2KFUFR.js";
|
|
109
|
+
import {
|
|
110
|
+
fetchQuery
|
|
111
|
+
} from "./chunk-DTGEFKK4.js";
|
|
112
|
+
import "./chunk-NBMM2TZK.js";
|
|
2329
113
|
|
|
2330
|
-
// src/
|
|
2331
|
-
import {
|
|
2332
|
-
import
|
|
2333
|
-
import
|
|
2334
|
-
import
|
|
2335
|
-
import {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
const location = useLocation5();
|
|
2339
|
-
const { t: t2 } = useTranslation7();
|
|
2340
|
-
let code = null;
|
|
2341
|
-
if (isClientError(error)) {
|
|
2342
|
-
if (error.status === 401) {
|
|
2343
|
-
return /* @__PURE__ */ jsx11(Navigate2, { to: "/login", state: { from: location }, replace: true });
|
|
2344
|
-
}
|
|
2345
|
-
code = error.status ?? null;
|
|
2346
|
-
}
|
|
2347
|
-
if (process.env.NODE_ENV === "development") {
|
|
2348
|
-
console.error(error);
|
|
2349
|
-
}
|
|
2350
|
-
let title;
|
|
2351
|
-
let message;
|
|
2352
|
-
switch (code) {
|
|
2353
|
-
case 400:
|
|
2354
|
-
title = t2("errorBoundary.badRequestTitle");
|
|
2355
|
-
message = t2("errorBoundary.badRequestMessage");
|
|
2356
|
-
break;
|
|
2357
|
-
case 404:
|
|
2358
|
-
title = t2("errorBoundary.notFoundTitle");
|
|
2359
|
-
message = t2("errorBoundary.notFoundMessage");
|
|
2360
|
-
break;
|
|
2361
|
-
case 500:
|
|
2362
|
-
title = t2("errorBoundary.internalServerErrorTitle");
|
|
2363
|
-
message = t2("errorBoundary.internalServerErrorMessage");
|
|
2364
|
-
break;
|
|
2365
|
-
default:
|
|
2366
|
-
title = t2("errorBoundary.defaultTitle");
|
|
2367
|
-
message = t2("errorBoundary.defaultMessage");
|
|
2368
|
-
break;
|
|
2369
|
-
}
|
|
2370
|
-
return /* @__PURE__ */ jsx11("div", { className: "flex size-full min-h-[calc(100vh-57px-24px)] items-center justify-center", children: /* @__PURE__ */ jsx11("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: [
|
|
2371
|
-
/* @__PURE__ */ jsx11(ExclamationCircle, {}),
|
|
2372
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
|
|
2373
|
-
/* @__PURE__ */ jsx11(Text4, { size: "small", leading: "compact", weight: "plus", children: title }),
|
|
2374
|
-
/* @__PURE__ */ jsx11(
|
|
2375
|
-
Text4,
|
|
2376
|
-
{
|
|
2377
|
-
size: "small",
|
|
2378
|
-
className: "text-ui-fg-muted text-balance text-center",
|
|
2379
|
-
children: message
|
|
2380
|
-
}
|
|
2381
|
-
)
|
|
2382
|
-
] })
|
|
2383
|
-
] }) }) });
|
|
2384
|
-
};
|
|
114
|
+
// src/app.tsx
|
|
115
|
+
import { customRoutes } from "virtual:mercur/routes";
|
|
116
|
+
import widgets from "virtual:mercur/widgets";
|
|
117
|
+
import navigation from "virtual:mercur/navigation";
|
|
118
|
+
import customFields from "virtual:mercur/custom-fields";
|
|
119
|
+
import { HelmetProvider } from "react-helmet-async";
|
|
120
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
121
|
+
import { ExtensionProvider } from "@mercurjs/dashboard-shared";
|
|
2385
122
|
|
|
2386
|
-
// src/
|
|
2387
|
-
|
|
2388
|
-
path: segment,
|
|
2389
|
-
children: []
|
|
2390
|
-
});
|
|
2391
|
-
var hoistBreadcrumb = (branch, handle, isIndex) => {
|
|
2392
|
-
const branchHandle = branch.handle;
|
|
2393
|
-
if (!isIndex || !handle?.breadcrumb || branchHandle?.breadcrumb) {
|
|
2394
|
-
return handle;
|
|
2395
|
-
}
|
|
2396
|
-
branch.handle = { ...branchHandle, breadcrumb: handle.breadcrumb };
|
|
2397
|
-
const { breadcrumb: _breadcrumb, ...rest } = handle;
|
|
2398
|
-
return Object.keys(rest).length ? rest : void 0;
|
|
2399
|
-
};
|
|
2400
|
-
var createLeafRoute = (Component, loader, handle, path = "") => ({
|
|
2401
|
-
path,
|
|
2402
|
-
ErrorBoundary,
|
|
2403
|
-
async lazy() {
|
|
2404
|
-
const result = { Component };
|
|
2405
|
-
if (loader) {
|
|
2406
|
-
result.loader = loader;
|
|
2407
|
-
}
|
|
2408
|
-
if (handle) {
|
|
2409
|
-
result.handle = handle;
|
|
2410
|
-
}
|
|
2411
|
-
return result;
|
|
2412
|
-
}
|
|
2413
|
-
});
|
|
2414
|
-
var createParallelRoute = (path, Component, loader, handle) => ({
|
|
2415
|
-
path,
|
|
2416
|
-
async lazy() {
|
|
2417
|
-
const result = { Component };
|
|
2418
|
-
if (loader) {
|
|
2419
|
-
result.loader = loader;
|
|
2420
|
-
}
|
|
2421
|
-
if (handle) {
|
|
2422
|
-
result.handle = handle;
|
|
2423
|
-
}
|
|
2424
|
-
return result;
|
|
2425
|
-
}
|
|
2426
|
-
});
|
|
2427
|
-
var processParallelRoutes = (parallelRoutes, currentFullPath) => {
|
|
2428
|
-
return parallelRoutes?.map(({ path, Component, loader, handle }) => {
|
|
2429
|
-
const childPath = path?.replace(currentFullPath, "").replace(/^\/+/, "");
|
|
2430
|
-
if (!childPath) {
|
|
2431
|
-
return null;
|
|
2432
|
-
}
|
|
2433
|
-
return createParallelRoute(childPath, Component, loader, handle);
|
|
2434
|
-
}).filter(Boolean);
|
|
2435
|
-
};
|
|
2436
|
-
var addRoute = (pathSegments, Component, currentLevel, loader, handle, parallelRoutes, fullPath, componentPath) => {
|
|
2437
|
-
if (!pathSegments.length) {
|
|
2438
|
-
return;
|
|
2439
|
-
}
|
|
2440
|
-
const [currentSegment, ...remainingSegments] = pathSegments;
|
|
2441
|
-
let route = currentLevel.find((r) => r.path === currentSegment);
|
|
2442
|
-
if (!route) {
|
|
2443
|
-
route = createBranchRoute(currentSegment);
|
|
2444
|
-
currentLevel.push(route);
|
|
2445
|
-
}
|
|
2446
|
-
const currentFullPath = fullPath ? `${fullPath}/${currentSegment}` : currentSegment;
|
|
2447
|
-
const isComponentSegment = currentFullPath === componentPath;
|
|
2448
|
-
if (isComponentSegment || remainingSegments.length === 0) {
|
|
2449
|
-
route.children || (route.children = []);
|
|
2450
|
-
if (loader) {
|
|
2451
|
-
route.loader = loader;
|
|
2452
|
-
}
|
|
2453
|
-
if (currentSegment === "*?" || currentSegment === "*") {
|
|
2454
|
-
const leaf = createLeafRoute(Component, loader, handle, currentSegment);
|
|
2455
|
-
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
|
|
2456
|
-
Object.assign(route, leaf);
|
|
2457
|
-
} else {
|
|
2458
|
-
const leafHandle = hoistBreadcrumb(route, handle, remainingSegments.length === 0);
|
|
2459
|
-
const leaf = createLeafRoute(Component, loader, leafHandle);
|
|
2460
|
-
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
|
|
2461
|
-
route.children.push(leaf);
|
|
2462
|
-
}
|
|
2463
|
-
if (remainingSegments.length > 0) {
|
|
2464
|
-
addRoute(
|
|
2465
|
-
remainingSegments,
|
|
2466
|
-
Component,
|
|
2467
|
-
route.children,
|
|
2468
|
-
void 0,
|
|
2469
|
-
void 0,
|
|
2470
|
-
void 0,
|
|
2471
|
-
currentFullPath
|
|
2472
|
-
);
|
|
2473
|
-
}
|
|
2474
|
-
} else {
|
|
2475
|
-
route.children || (route.children = []);
|
|
2476
|
-
addRoute(
|
|
2477
|
-
remainingSegments,
|
|
2478
|
-
Component,
|
|
2479
|
-
route.children,
|
|
2480
|
-
loader,
|
|
2481
|
-
handle,
|
|
2482
|
-
parallelRoutes,
|
|
2483
|
-
currentFullPath,
|
|
2484
|
-
componentPath
|
|
2485
|
-
);
|
|
2486
|
-
}
|
|
2487
|
-
};
|
|
2488
|
-
var createRouteMap = (routes, ignore) => {
|
|
2489
|
-
const root = [];
|
|
2490
|
-
routes.forEach(({ path, Component, loader, handle, children }) => {
|
|
2491
|
-
const cleanedPath = ignore ? path.replace(ignore, "").replace(/^\/+/, "") : path.replace(/^\/+/, "");
|
|
2492
|
-
const pathSegments = cleanedPath.split("/").filter(Boolean);
|
|
2493
|
-
addRoute(
|
|
2494
|
-
pathSegments,
|
|
2495
|
-
Component,
|
|
2496
|
-
root,
|
|
2497
|
-
loader,
|
|
2498
|
-
handle,
|
|
2499
|
-
children,
|
|
2500
|
-
void 0,
|
|
2501
|
-
path
|
|
2502
|
-
);
|
|
2503
|
-
});
|
|
2504
|
-
return root;
|
|
2505
|
-
};
|
|
2506
|
-
var settingsRouteRegex = /^\/settings\//;
|
|
2507
|
-
var getRoutesByType = (routes, type) => {
|
|
2508
|
-
return routes.filter((route) => {
|
|
2509
|
-
if (type === "public") {
|
|
2510
|
-
return route.isPublic === true;
|
|
2511
|
-
}
|
|
2512
|
-
if (type === "settings") {
|
|
2513
|
-
return !route.isPublic && settingsRouteRegex.test(route.path);
|
|
2514
|
-
}
|
|
2515
|
-
return !route.isPublic && !settingsRouteRegex.test(route.path);
|
|
2516
|
-
});
|
|
2517
|
-
};
|
|
2518
|
-
var getMenuItemsByType = (menuItems, type) => {
|
|
2519
|
-
return menuItems.filter((item) => {
|
|
2520
|
-
if (item.nested) {
|
|
2521
|
-
return false;
|
|
2522
|
-
}
|
|
2523
|
-
if (type === "settings") {
|
|
2524
|
-
return settingsRouteRegex.test(item.path);
|
|
2525
|
-
}
|
|
2526
|
-
return !settingsRouteRegex.test(item.path);
|
|
2527
|
-
});
|
|
2528
|
-
};
|
|
2529
|
-
var filterMenuItemsByPermissions = (menuItems, { hasAnyPermission, hasAllPermissions }) => {
|
|
2530
|
-
return menuItems.filter((item) => {
|
|
2531
|
-
if (!item.permissions?.length) {
|
|
2532
|
-
return true;
|
|
2533
|
-
}
|
|
2534
|
-
return item.requireAll ? hasAllPermissions(item.permissions) : hasAnyPermission(item.permissions);
|
|
2535
|
-
});
|
|
2536
|
-
};
|
|
2537
|
-
var getNestedMenuItems = (menuItems, parentPath) => {
|
|
2538
|
-
return menuItems.filter((item) => item.nested === parentPath).sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0));
|
|
2539
|
-
};
|
|
123
|
+
// src/providers/feature-flag-provider/index.tsx
|
|
124
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
2540
125
|
|
|
2541
|
-
// src/
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
"/stores": "sellers:view",
|
|
2556
|
-
"/reviews": "reviews:view",
|
|
2557
|
-
"/payouts": "payouts:view",
|
|
2558
|
-
"/settings/regions": "regions:view",
|
|
2559
|
-
"/settings/marketplace": "store:view",
|
|
2560
|
-
"/settings/commissions": "commission_rates:view",
|
|
2561
|
-
"/settings/users": "users:view",
|
|
2562
|
-
"/settings/sales-channels": "sales_channels:view",
|
|
2563
|
-
"/settings/locations": "stock_locations:view",
|
|
2564
|
-
"/settings/product-tags": "product_tags:view",
|
|
2565
|
-
"/settings/product-types": "product_types:view",
|
|
2566
|
-
"/settings/attributes": "product_attributes:view",
|
|
2567
|
-
"/settings/shipping-profiles": "shipping_profiles:view",
|
|
2568
|
-
"/settings/shipping-option-types": "shipping_options:view",
|
|
2569
|
-
"/settings/return-reasons": "return_reasons:view",
|
|
2570
|
-
"/settings/refund-reasons": "refund_reasons:view",
|
|
2571
|
-
"/settings/tax-regions": "tax_regions:view",
|
|
2572
|
-
"/settings/publishable-api-keys": "api_keys:view",
|
|
2573
|
-
"/settings/secret-api-keys": "api_keys:view"
|
|
126
|
+
// src/hooks/api/feature-flags.tsx
|
|
127
|
+
import { useQuery } from "@tanstack/react-query";
|
|
128
|
+
var useFeatureFlags = () => {
|
|
129
|
+
return useQuery({
|
|
130
|
+
queryKey: ["admin", "feature-flags"],
|
|
131
|
+
queryFn: async () => {
|
|
132
|
+
const response = await fetchQuery("/admin/feature-flags", {
|
|
133
|
+
method: "GET"
|
|
134
|
+
});
|
|
135
|
+
return response.feature_flags;
|
|
136
|
+
},
|
|
137
|
+
staleTime: 5 * 60 * 1e3,
|
|
138
|
+
gcTime: 10 * 60 * 1e3
|
|
139
|
+
});
|
|
2574
140
|
};
|
|
2575
|
-
var getRoutePermission = (path) => ROUTE_PERMISSIONS[path];
|
|
2576
141
|
|
|
2577
|
-
// src/
|
|
2578
|
-
import { jsx
|
|
2579
|
-
var
|
|
2580
|
-
var
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
}))
|
|
2590
|
-
});
|
|
2591
|
-
var MainLayout = () => {
|
|
2592
|
-
return /* @__PURE__ */ jsx12(Shell, { children: /* @__PURE__ */ jsx12(MainSidebar, {}) });
|
|
2593
|
-
};
|
|
2594
|
-
var allMenuItems = menuItemsModule.menuItems ?? [];
|
|
2595
|
-
var addNestedItems = (to, menuItems, items) => {
|
|
2596
|
-
const nestedItems = getNestedMenuItems(menuItems, to);
|
|
2597
|
-
if (nestedItems.length === 0) {
|
|
2598
|
-
return items;
|
|
2599
|
-
}
|
|
2600
|
-
const nestedNavItems = nestedItems.map((item) => ({
|
|
2601
|
-
label: item.label,
|
|
2602
|
-
to: item.path,
|
|
2603
|
-
translationNs: item.translationNs
|
|
2604
|
-
}));
|
|
2605
|
-
return [...items ?? [], ...nestedNavItems];
|
|
2606
|
-
};
|
|
2607
|
-
var MainSidebar = () => {
|
|
2608
|
-
const coreRoutes = useCoreRoutes();
|
|
2609
|
-
const navOverrides = useExtension().getNavOverrides();
|
|
2610
|
-
const { hasAnyPermission, hasAllPermissions, hasPermission } = usePermissions();
|
|
2611
|
-
const canReach = ({ to }) => {
|
|
2612
|
-
const permission = getRoutePermission(to);
|
|
2613
|
-
return !permission || hasPermission(permission);
|
|
2614
|
-
};
|
|
2615
|
-
const visibleMenuItems = useMemo5(
|
|
2616
|
-
() => filterMenuItemsByPermissions(allMenuItems, {
|
|
2617
|
-
hasAnyPermission,
|
|
2618
|
-
hasAllPermissions
|
|
2619
|
-
}),
|
|
2620
|
-
[hasAnyPermission, hasAllPermissions]
|
|
2621
|
-
);
|
|
2622
|
-
const customMenuItems = getMenuItemsByType(visibleMenuItems, "main");
|
|
2623
|
-
const routesWithNested = applyNavOverrides(
|
|
2624
|
-
coreRoutes.map(toCoreNavItem),
|
|
2625
|
-
navOverrides
|
|
2626
|
-
).filter(canReach).map((route) => ({
|
|
2627
|
-
...route,
|
|
2628
|
-
items: addNestedItems(route.to, visibleMenuItems, route.items)?.filter(
|
|
2629
|
-
canReach
|
|
2630
|
-
)
|
|
2631
|
-
}));
|
|
2632
|
-
const customRoutesWithNested = customMenuItems.sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0)).map((item) => ({
|
|
2633
|
-
label: item.label,
|
|
2634
|
-
to: item.path,
|
|
2635
|
-
icon: item.icon ? /* @__PURE__ */ jsx12(item.icon, {}) : void 0,
|
|
2636
|
-
translationNs: item.translationNs,
|
|
2637
|
-
items: addNestedItems(item.path, visibleMenuItems)
|
|
2638
|
-
}));
|
|
2639
|
-
return /* @__PURE__ */ jsx12(
|
|
2640
|
-
"aside",
|
|
2641
|
-
{
|
|
2642
|
-
className: "flex flex-1 flex-col justify-between overflow-y-auto overflow-x-hidden",
|
|
2643
|
-
"data-testid": "sidebar",
|
|
2644
|
-
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col", children: [
|
|
2645
|
-
/* @__PURE__ */ jsxs7(
|
|
2646
|
-
"div",
|
|
2647
|
-
{
|
|
2648
|
-
className: "sticky top-0 bg-ui-bg-subtle",
|
|
2649
|
-
"data-testid": "sidebar-header-section",
|
|
2650
|
-
children: [
|
|
2651
|
-
/* @__PURE__ */ jsx12(Header, {}),
|
|
2652
|
-
/* @__PURE__ */ jsx12("div", { className: "px-3", children: /* @__PURE__ */ jsx12(Divider, { variant: "dashed" }) })
|
|
2653
|
-
]
|
|
2654
|
-
}
|
|
2655
|
-
),
|
|
2656
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col justify-between", children: [
|
|
2657
|
-
/* @__PURE__ */ jsx12("div", { className: "flex flex-1 flex-col", children: /* @__PURE__ */ jsxs7(
|
|
2658
|
-
"nav",
|
|
2659
|
-
{
|
|
2660
|
-
className: "flex flex-col gap-y-1 py-3",
|
|
2661
|
-
"data-testid": "sidebar-core-routes",
|
|
2662
|
-
children: [
|
|
2663
|
-
/* @__PURE__ */ jsx12(Searchbar, {}),
|
|
2664
|
-
routesWithNested.map((route) => {
|
|
2665
|
-
return /* @__PURE__ */ jsx12(NavItem, { ...route }, route.to);
|
|
2666
|
-
}),
|
|
2667
|
-
customRoutesWithNested.map((route) => /* @__PURE__ */ jsx12(NavItem, { ...route }, route.to))
|
|
2668
|
-
]
|
|
2669
|
-
}
|
|
2670
|
-
) }),
|
|
2671
|
-
/* @__PURE__ */ jsx12(UtilitySection, {})
|
|
2672
|
-
] }),
|
|
2673
|
-
/* @__PURE__ */ jsx12(
|
|
2674
|
-
"div",
|
|
2675
|
-
{
|
|
2676
|
-
className: "sticky bottom-0 bg-ui-bg-subtle",
|
|
2677
|
-
"data-testid": "sidebar-user-section",
|
|
2678
|
-
children: /* @__PURE__ */ jsx12(UserSection, {})
|
|
2679
|
-
}
|
|
2680
|
-
)
|
|
2681
|
-
] })
|
|
2682
|
-
}
|
|
142
|
+
// src/providers/feature-flag-provider/index.tsx
|
|
143
|
+
import { jsx } from "react/jsx-runtime";
|
|
144
|
+
var FeatureFlagContext = createContext(null);
|
|
145
|
+
var FeatureFlagProvider = ({
|
|
146
|
+
children
|
|
147
|
+
}) => {
|
|
148
|
+
const { data: flags = {}, isLoading } = useFeatureFlags();
|
|
149
|
+
const isFeatureEnabled = useCallback(
|
|
150
|
+
(flag) => {
|
|
151
|
+
return flags[flag] === true;
|
|
152
|
+
},
|
|
153
|
+
[flags]
|
|
2683
154
|
);
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
const navigate = useNavigate4();
|
|
2688
|
-
const { mutateAsync: logoutMutation } = useLogout();
|
|
2689
|
-
const handleLogout = async () => {
|
|
2690
|
-
await logoutMutation(void 0, {
|
|
2691
|
-
onSuccess: () => {
|
|
2692
|
-
queryClient.clear();
|
|
2693
|
-
navigate("/login");
|
|
2694
|
-
}
|
|
2695
|
-
});
|
|
2696
|
-
};
|
|
2697
|
-
return /* @__PURE__ */ jsx12(
|
|
2698
|
-
DropdownMenu3.Item,
|
|
2699
|
-
{
|
|
2700
|
-
onClick: handleLogout,
|
|
2701
|
-
"data-testid": "sidebar-header-dropdown-logout",
|
|
2702
|
-
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-x-2", children: [
|
|
2703
|
-
/* @__PURE__ */ jsx12(OpenRectArrowOut2, { className: "text-ui-fg-subtle" }),
|
|
2704
|
-
/* @__PURE__ */ jsx12("span", { children: t2("app.menus.actions.logout") })
|
|
2705
|
-
] })
|
|
2706
|
-
}
|
|
155
|
+
const value = useMemo(
|
|
156
|
+
() => ({ flags, isLoading, isFeatureEnabled }),
|
|
157
|
+
[flags, isLoading, isFeatureEnabled]
|
|
2707
158
|
);
|
|
159
|
+
return /* @__PURE__ */ jsx(FeatureFlagContext.Provider, { value, children });
|
|
2708
160
|
};
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
161
|
+
|
|
162
|
+
// src/app.tsx
|
|
163
|
+
import { I18nProvider, Toaster, TooltipProvider } from "@medusajs/ui";
|
|
164
|
+
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
165
|
+
|
|
166
|
+
// src/get-route-map.tsx
|
|
167
|
+
import { t } from "i18next";
|
|
168
|
+
import { Outlet as Outlet3 } from "react-router-dom";
|
|
169
|
+
|
|
170
|
+
// src/components/authentication/protected-route/protected-route.tsx
|
|
171
|
+
import { Spinner } from "@medusajs/icons";
|
|
172
|
+
import { Navigate, Outlet, useLocation } from "react-router-dom";
|
|
173
|
+
import { PermissionsProvider } from "@mercurjs/dashboard-shared";
|
|
174
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
175
|
+
var ProtectedRoute = () => {
|
|
176
|
+
const location = useLocation();
|
|
177
|
+
const { user, isLoading: isLoadingUser } = useMe();
|
|
178
|
+
if (isLoadingUser) {
|
|
179
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsx2(Spinner, { className: "text-ui-fg-interactive animate-spin" }) });
|
|
2719
180
|
}
|
|
2720
|
-
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
className: clx5(
|
|
2726
|
-
"grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md bg-ui-bg-subtle p-0.5 pe-2 outline-none transition-fg",
|
|
2727
|
-
"hover:bg-ui-bg-subtle-hover",
|
|
2728
|
-
"data-[state=open]:bg-ui-bg-subtle-hover",
|
|
2729
|
-
"focus-visible:shadow-borders-focus"
|
|
2730
|
-
),
|
|
2731
|
-
"data-testid": "sidebar-header-dropdown-trigger",
|
|
2732
|
-
children: [
|
|
2733
|
-
fallback ? /* @__PURE__ */ jsx12(
|
|
2734
|
-
Avatar2,
|
|
2735
|
-
{
|
|
2736
|
-
variant: "squared",
|
|
2737
|
-
size: "xsmall",
|
|
2738
|
-
fallback,
|
|
2739
|
-
"data-testid": "sidebar-header-dropdown-avatar"
|
|
2740
|
-
}
|
|
2741
|
-
) : /* @__PURE__ */ jsx12(Skeleton, { className: "h-6 w-6 rounded-md" }),
|
|
2742
|
-
/* @__PURE__ */ jsx12(
|
|
2743
|
-
"div",
|
|
2744
|
-
{
|
|
2745
|
-
className: clx5("block overflow-hidden whitespace-nowrap text-start", SIDEBAR_RAIL_FADE),
|
|
2746
|
-
"data-testid": "sidebar-header-dropdown-store-name",
|
|
2747
|
-
children: name ? /* @__PURE__ */ jsx12(
|
|
2748
|
-
Text5,
|
|
2749
|
-
{
|
|
2750
|
-
size: "small",
|
|
2751
|
-
weight: "plus",
|
|
2752
|
-
leading: "compact",
|
|
2753
|
-
className: "truncate",
|
|
2754
|
-
children: store.name
|
|
2755
|
-
}
|
|
2756
|
-
) : /* @__PURE__ */ jsx12(Skeleton, { className: "h-[9px] w-[120px]" })
|
|
2757
|
-
}
|
|
2758
|
-
),
|
|
2759
|
-
/* @__PURE__ */ jsx12(EllipsisHorizontal2, { className: clx5("text-ui-fg-muted", SIDEBAR_RAIL_FADE) })
|
|
2760
|
-
]
|
|
2761
|
-
}
|
|
2762
|
-
),
|
|
2763
|
-
isLoaded && /* @__PURE__ */ jsxs7(
|
|
2764
|
-
DropdownMenu3.Content,
|
|
2765
|
-
{
|
|
2766
|
-
...menuPlacement,
|
|
2767
|
-
className: SIDEBAR_MENU_CONTENT,
|
|
2768
|
-
"data-testid": "sidebar-header-dropdown-content",
|
|
2769
|
-
children: [
|
|
2770
|
-
/* @__PURE__ */ jsxs7(
|
|
2771
|
-
"div",
|
|
2772
|
-
{
|
|
2773
|
-
className: "flex items-center gap-x-3 px-2 py-1",
|
|
2774
|
-
"data-testid": "sidebar-header-dropdown-user-info",
|
|
2775
|
-
children: [
|
|
2776
|
-
/* @__PURE__ */ jsx12(
|
|
2777
|
-
Avatar2,
|
|
2778
|
-
{
|
|
2779
|
-
variant: "squared",
|
|
2780
|
-
size: "small",
|
|
2781
|
-
fallback,
|
|
2782
|
-
"data-testid": "sidebar-header-dropdown-user-avatar"
|
|
2783
|
-
}
|
|
2784
|
-
),
|
|
2785
|
-
/* @__PURE__ */ jsxs7(
|
|
2786
|
-
"div",
|
|
2787
|
-
{
|
|
2788
|
-
className: "flex flex-col overflow-hidden",
|
|
2789
|
-
"data-testid": "sidebar-header-dropdown-user-details",
|
|
2790
|
-
children: [
|
|
2791
|
-
/* @__PURE__ */ jsx12(
|
|
2792
|
-
Text5,
|
|
2793
|
-
{
|
|
2794
|
-
size: "small",
|
|
2795
|
-
weight: "plus",
|
|
2796
|
-
leading: "compact",
|
|
2797
|
-
className: "truncate",
|
|
2798
|
-
"data-testid": "sidebar-header-dropdown-user-name",
|
|
2799
|
-
children: name
|
|
2800
|
-
}
|
|
2801
|
-
),
|
|
2802
|
-
/* @__PURE__ */ jsx12(
|
|
2803
|
-
Text5,
|
|
2804
|
-
{
|
|
2805
|
-
size: "xsmall",
|
|
2806
|
-
leading: "compact",
|
|
2807
|
-
className: "text-ui-fg-subtle",
|
|
2808
|
-
"data-testid": "sidebar-header-dropdown-store-label",
|
|
2809
|
-
children: t2("app.nav.main.marketplace")
|
|
2810
|
-
}
|
|
2811
|
-
)
|
|
2812
|
-
]
|
|
2813
|
-
}
|
|
2814
|
-
)
|
|
2815
|
-
]
|
|
2816
|
-
}
|
|
2817
|
-
),
|
|
2818
|
-
/* @__PURE__ */ jsx12(DropdownMenu3.Separator, { "data-testid": "sidebar-header-dropdown-separator-1" }),
|
|
2819
|
-
/* @__PURE__ */ jsx12(
|
|
2820
|
-
DropdownMenu3.Item,
|
|
2821
|
-
{
|
|
2822
|
-
className: "gap-x-2",
|
|
2823
|
-
asChild: true,
|
|
2824
|
-
"data-testid": "sidebar-header-dropdown-store-settings",
|
|
2825
|
-
children: /* @__PURE__ */ jsxs7(Link3, { to: "/settings/marketplace", children: [
|
|
2826
|
-
/* @__PURE__ */ jsx12(BuildingStorefront, { className: "text-ui-fg-subtle" }),
|
|
2827
|
-
t2("app.nav.main.marketplaceSettings")
|
|
2828
|
-
] })
|
|
2829
|
-
}
|
|
2830
|
-
),
|
|
2831
|
-
/* @__PURE__ */ jsx12(DropdownMenu3.Separator, { "data-testid": "sidebar-header-dropdown-separator-2" }),
|
|
2832
|
-
/* @__PURE__ */ jsx12(Logout2, {})
|
|
2833
|
-
]
|
|
2834
|
-
}
|
|
2835
|
-
)
|
|
2836
|
-
] }) });
|
|
2837
|
-
};
|
|
2838
|
-
var useCoreRoutes = () => {
|
|
2839
|
-
const { t: t2 } = useTranslation8();
|
|
2840
|
-
return [
|
|
2841
|
-
{
|
|
2842
|
-
icon: /* @__PURE__ */ jsx12(ShoppingCart, {}),
|
|
2843
|
-
label: t2("orders.domain"),
|
|
2844
|
-
to: "/orders",
|
|
2845
|
-
items: [
|
|
2846
|
-
// TODO: Enable when domin is introduced
|
|
2847
|
-
// {
|
|
2848
|
-
// label: t("draftOrders.domain"),
|
|
2849
|
-
// to: "/draft-orders",
|
|
2850
|
-
// },
|
|
2851
|
-
]
|
|
2852
|
-
},
|
|
2853
|
-
{
|
|
2854
|
-
icon: /* @__PURE__ */ jsx12(Tag, {}),
|
|
2855
|
-
label: t2("products.domain"),
|
|
2856
|
-
to: "/products",
|
|
2857
|
-
items: [
|
|
2858
|
-
{
|
|
2859
|
-
label: t2("offers.domain"),
|
|
2860
|
-
to: "/offers"
|
|
2861
|
-
},
|
|
2862
|
-
{
|
|
2863
|
-
label: t2("collections.domain"),
|
|
2864
|
-
to: "/collections"
|
|
2865
|
-
},
|
|
2866
|
-
{
|
|
2867
|
-
label: t2("categories.domain"),
|
|
2868
|
-
to: "/categories"
|
|
2869
|
-
}
|
|
2870
|
-
// TODO: Enable when domin is introduced
|
|
2871
|
-
// {
|
|
2872
|
-
// label: t("giftCards.domain"),
|
|
2873
|
-
// to: "/gift-cards",
|
|
2874
|
-
// },
|
|
2875
|
-
]
|
|
2876
|
-
},
|
|
2877
|
-
{
|
|
2878
|
-
icon: /* @__PURE__ */ jsx12(Buildings, {}),
|
|
2879
|
-
label: t2("inventory.domain"),
|
|
2880
|
-
to: "/inventory",
|
|
2881
|
-
items: [
|
|
2882
|
-
{
|
|
2883
|
-
label: t2("reservations.domain"),
|
|
2884
|
-
to: "/reservations"
|
|
2885
|
-
}
|
|
2886
|
-
]
|
|
2887
|
-
},
|
|
2888
|
-
{
|
|
2889
|
-
icon: /* @__PURE__ */ jsx12(Users, {}),
|
|
2890
|
-
label: t2("customers.domain"),
|
|
2891
|
-
to: "/customers",
|
|
2892
|
-
items: [
|
|
2893
|
-
{
|
|
2894
|
-
label: t2("customerGroups.domain"),
|
|
2895
|
-
to: "/customer-groups"
|
|
2896
|
-
}
|
|
2897
|
-
]
|
|
2898
|
-
},
|
|
2899
|
-
{
|
|
2900
|
-
icon: /* @__PURE__ */ jsx12(ReceiptPercent, {}),
|
|
2901
|
-
label: t2("promotions.domain"),
|
|
2902
|
-
to: "/promotions",
|
|
2903
|
-
items: [
|
|
2904
|
-
{
|
|
2905
|
-
label: t2("campaigns.domain"),
|
|
2906
|
-
to: "/campaigns"
|
|
2907
|
-
}
|
|
2908
|
-
]
|
|
2909
|
-
},
|
|
2910
|
-
{
|
|
2911
|
-
icon: /* @__PURE__ */ jsx12(CurrencyDollar, {}),
|
|
2912
|
-
label: t2("priceLists.domain"),
|
|
2913
|
-
to: "/price-lists"
|
|
2914
|
-
},
|
|
2915
|
-
{
|
|
2916
|
-
icon: /* @__PURE__ */ jsx12(BuildingStorefront, {}),
|
|
2917
|
-
label: t2("stores.domain"),
|
|
2918
|
-
to: "/stores",
|
|
2919
|
-
items: [
|
|
2920
|
-
{
|
|
2921
|
-
label: t2("reviews.domain"),
|
|
2922
|
-
to: "/reviews"
|
|
2923
|
-
}
|
|
2924
|
-
]
|
|
2925
|
-
},
|
|
2926
|
-
{
|
|
2927
|
-
icon: /* @__PURE__ */ jsx12(CreditCardRefresh, {}),
|
|
2928
|
-
label: t2("payouts.domain"),
|
|
2929
|
-
to: "/payouts"
|
|
2930
|
-
}
|
|
2931
|
-
];
|
|
2932
|
-
};
|
|
2933
|
-
var Searchbar = () => {
|
|
2934
|
-
const { t: t2 } = useTranslation8();
|
|
2935
|
-
const { toggleSearch } = useSearch();
|
|
2936
|
-
return /* @__PURE__ */ jsx12("div", { className: "px-3", "data-testid": "sidebar-search", children: /* @__PURE__ */ jsxs7(
|
|
2937
|
-
"button",
|
|
2938
|
-
{
|
|
2939
|
-
onClick: toggleSearch,
|
|
2940
|
-
className: clx5(
|
|
2941
|
-
"flex w-full items-center gap-x-2.5 rounded-md bg-ui-bg-subtle px-2 py-1 text-ui-fg-subtle outline-none transition-[padding] duration-200 ease-sidebar motion-reduce:transition-none group-data-[state=collapsed]/sidebar:px-1",
|
|
2942
|
-
"hover:bg-ui-bg-subtle-hover",
|
|
2943
|
-
"focus-visible:shadow-borders-focus"
|
|
2944
|
-
),
|
|
2945
|
-
"data-testid": "sidebar-search-button",
|
|
2946
|
-
children: [
|
|
2947
|
-
/* @__PURE__ */ jsx12(MagnifyingGlass2, { className: "shrink-0" }),
|
|
2948
|
-
/* @__PURE__ */ jsx12("div", { className: clx5("flex-1 whitespace-nowrap text-start", SIDEBAR_RAIL_FADE), children: /* @__PURE__ */ jsx12(Text5, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.label") }) }),
|
|
2949
|
-
/* @__PURE__ */ jsx12(Text5, { size: "small", leading: "compact", className: clx5("text-ui-fg-muted", SIDEBAR_RAIL_FADE), children: "\u2318K" })
|
|
2950
|
-
]
|
|
2951
|
-
}
|
|
2952
|
-
) });
|
|
2953
|
-
};
|
|
2954
|
-
var UtilitySection = () => {
|
|
2955
|
-
const location = useLocation6();
|
|
2956
|
-
const { t: t2 } = useTranslation8();
|
|
2957
|
-
return /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-y-0.5 py-3", children: /* @__PURE__ */ jsx12(
|
|
2958
|
-
NavItem,
|
|
181
|
+
if (!user) {
|
|
182
|
+
return /* @__PURE__ */ jsx2(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
183
|
+
}
|
|
184
|
+
return /* @__PURE__ */ jsx2(
|
|
185
|
+
PermissionsProvider,
|
|
2959
186
|
{
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
from: location.pathname,
|
|
2963
|
-
icon: /* @__PURE__ */ jsx12(CogSixTooth, {})
|
|
187
|
+
permissions: user.permissions ?? null,
|
|
188
|
+
children: /* @__PURE__ */ jsx2(SidebarProvider, { children: /* @__PURE__ */ jsx2(SearchProvider, { children: /* @__PURE__ */ jsx2(Outlet, {}) }) })
|
|
2964
189
|
}
|
|
2965
|
-
)
|
|
2966
|
-
};
|
|
2967
|
-
var UserSection = () => {
|
|
2968
|
-
return /* @__PURE__ */ jsxs7("div", { children: [
|
|
2969
|
-
/* @__PURE__ */ jsx12("div", { className: "px-3", children: /* @__PURE__ */ jsx12(Divider, { variant: "dashed" }) }),
|
|
2970
|
-
/* @__PURE__ */ jsx12(UserMenu, {})
|
|
2971
|
-
] });
|
|
190
|
+
);
|
|
2972
191
|
};
|
|
2973
192
|
|
|
2974
193
|
// src/components/layout/public-layout/public-layout.tsx
|
|
2975
|
-
import { Outlet as
|
|
2976
|
-
import { jsx as
|
|
194
|
+
import { Outlet as Outlet2 } from "react-router-dom";
|
|
195
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2977
196
|
var PublicLayout = () => {
|
|
2978
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ jsx3(Outlet2, {});
|
|
2979
198
|
};
|
|
2980
199
|
|
|
2981
200
|
// src/components/layout/settings-layout/settings-layout.tsx
|
|
2982
|
-
import { useEffect
|
|
2983
|
-
import { ArrowUturnLeft
|
|
2984
|
-
import { Divider
|
|
2985
|
-
import { Collapsible as
|
|
2986
|
-
import { useTranslation
|
|
2987
|
-
import { Link
|
|
2988
|
-
import
|
|
2989
|
-
import { usePermissions
|
|
2990
|
-
import { jsx as
|
|
201
|
+
import { useEffect, useMemo as useMemo2, useState } from "react";
|
|
202
|
+
import { ArrowUturnLeft, MinusMini } from "@medusajs/icons";
|
|
203
|
+
import { Divider, IconButton, Text, clx } from "@medusajs/ui";
|
|
204
|
+
import { Collapsible as RadixCollapsible } from "radix-ui";
|
|
205
|
+
import { useTranslation } from "react-i18next";
|
|
206
|
+
import { Link, useLocation as useLocation2 } from "react-router-dom";
|
|
207
|
+
import menuItemsModule from "virtual:mercur/menu-items";
|
|
208
|
+
import { usePermissions } from "@mercurjs/dashboard-shared";
|
|
209
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
2991
210
|
var SettingsLayout = () => {
|
|
2992
211
|
useExpandedSidebar();
|
|
2993
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ jsx4(Shell, { rail: false, children: /* @__PURE__ */ jsx4(SettingsSidebar, {}) });
|
|
2994
213
|
};
|
|
2995
|
-
var
|
|
214
|
+
var allMenuItems = menuItemsModule.menuItems ?? [];
|
|
2996
215
|
var useExtensionNavItems = () => {
|
|
2997
|
-
const { hasAnyPermission, hasAllPermissions } =
|
|
2998
|
-
return
|
|
216
|
+
const { hasAnyPermission, hasAllPermissions } = usePermissions();
|
|
217
|
+
return useMemo2(
|
|
2999
218
|
() => getMenuItemsByType(
|
|
3000
|
-
filterMenuItemsByPermissions(
|
|
219
|
+
filterMenuItemsByPermissions(allMenuItems, {
|
|
3001
220
|
hasAnyPermission,
|
|
3002
221
|
hasAllPermissions
|
|
3003
222
|
}),
|
|
@@ -3011,9 +230,9 @@ var useExtensionNavItems = () => {
|
|
|
3011
230
|
);
|
|
3012
231
|
};
|
|
3013
232
|
var useSettingRoutes = () => {
|
|
3014
|
-
const { t: t2 } =
|
|
233
|
+
const { t: t2 } = useTranslation();
|
|
3015
234
|
const extensionNavItems = useExtensionNavItems();
|
|
3016
|
-
return
|
|
235
|
+
return useMemo2(
|
|
3017
236
|
() => [
|
|
3018
237
|
{
|
|
3019
238
|
label: t2("marketplace.domain"),
|
|
@@ -3069,8 +288,8 @@ var useSettingRoutes = () => {
|
|
|
3069
288
|
);
|
|
3070
289
|
};
|
|
3071
290
|
var useDeveloperRoutes = () => {
|
|
3072
|
-
const { t: t2 } =
|
|
3073
|
-
return
|
|
291
|
+
const { t: t2 } = useTranslation();
|
|
292
|
+
return useMemo2(
|
|
3074
293
|
() => [
|
|
3075
294
|
{
|
|
3076
295
|
label: t2("apiKeyManagement.domain.publishable"),
|
|
@@ -3085,8 +304,8 @@ var useDeveloperRoutes = () => {
|
|
|
3085
304
|
);
|
|
3086
305
|
};
|
|
3087
306
|
var useMyAccountRoutes = () => {
|
|
3088
|
-
const { t: t2 } =
|
|
3089
|
-
return
|
|
307
|
+
const { t: t2 } = useTranslation();
|
|
308
|
+
return useMemo2(
|
|
3090
309
|
() => [
|
|
3091
310
|
{
|
|
3092
311
|
label: t2("profile.domain"),
|
|
@@ -3103,7 +322,7 @@ var getSafeFromValue = (from) => {
|
|
|
3103
322
|
return from;
|
|
3104
323
|
};
|
|
3105
324
|
var SettingsSidebar = () => {
|
|
3106
|
-
const { hasPermission } =
|
|
325
|
+
const { hasPermission } = usePermissions();
|
|
3107
326
|
const canReach = ({ to }) => {
|
|
3108
327
|
const permission = getRoutePermission(to);
|
|
3109
328
|
return !permission || hasPermission(permission);
|
|
@@ -3111,31 +330,31 @@ var SettingsSidebar = () => {
|
|
|
3111
330
|
const routes = useSettingRoutes().filter(canReach);
|
|
3112
331
|
const developerRoutes = useDeveloperRoutes().filter(canReach);
|
|
3113
332
|
const myAccountRoutes = useMyAccountRoutes();
|
|
3114
|
-
const { t: t2 } =
|
|
3115
|
-
return /* @__PURE__ */
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
/* @__PURE__ */
|
|
333
|
+
const { t: t2 } = useTranslation();
|
|
334
|
+
return /* @__PURE__ */ jsxs("aside", { className: "relative flex flex-1 flex-col justify-between overflow-y-auto", children: [
|
|
335
|
+
/* @__PURE__ */ jsxs("div", { className: "sticky top-0 bg-ui-bg-subtle", children: [
|
|
336
|
+
/* @__PURE__ */ jsx4(Header, {}),
|
|
337
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx4(Divider, { variant: "dashed" }) })
|
|
3119
338
|
] }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3122
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col", children: [
|
|
340
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-y-auto", children: [
|
|
341
|
+
/* @__PURE__ */ jsx4(
|
|
3123
342
|
RadixCollapsibleSection,
|
|
3124
343
|
{
|
|
3125
344
|
label: t2("app.nav.settings.general"),
|
|
3126
345
|
items: routes
|
|
3127
346
|
}
|
|
3128
347
|
),
|
|
3129
|
-
/* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx4(Divider, { variant: "dashed" }) }),
|
|
349
|
+
/* @__PURE__ */ jsx4(
|
|
3131
350
|
RadixCollapsibleSection,
|
|
3132
351
|
{
|
|
3133
352
|
label: t2("app.nav.settings.developer"),
|
|
3134
353
|
items: developerRoutes
|
|
3135
354
|
}
|
|
3136
355
|
),
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx4(Divider, { variant: "dashed" }) }),
|
|
357
|
+
/* @__PURE__ */ jsx4(
|
|
3139
358
|
RadixCollapsibleSection,
|
|
3140
359
|
{
|
|
3141
360
|
label: t2("app.nav.settings.myAccount"),
|
|
@@ -3143,32 +362,32 @@ var SettingsSidebar = () => {
|
|
|
3143
362
|
}
|
|
3144
363
|
)
|
|
3145
364
|
] }),
|
|
3146
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ jsx4("div", { className: "sticky bottom-0 bg-ui-bg-subtle", children: /* @__PURE__ */ jsx4(UserSection, {}) })
|
|
3147
366
|
] })
|
|
3148
367
|
] });
|
|
3149
368
|
};
|
|
3150
|
-
var
|
|
3151
|
-
const [from, setFrom] =
|
|
3152
|
-
const { t: t2 } =
|
|
3153
|
-
const location =
|
|
3154
|
-
|
|
369
|
+
var Header = () => {
|
|
370
|
+
const [from, setFrom] = useState("/orders");
|
|
371
|
+
const { t: t2 } = useTranslation();
|
|
372
|
+
const location = useLocation2();
|
|
373
|
+
useEffect(() => {
|
|
3155
374
|
if (location.state?.from) {
|
|
3156
375
|
setFrom(getSafeFromValue(location.state.from));
|
|
3157
376
|
}
|
|
3158
377
|
}, [location]);
|
|
3159
|
-
return /* @__PURE__ */
|
|
3160
|
-
|
|
378
|
+
return /* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-subtle p-3", children: /* @__PURE__ */ jsx4(
|
|
379
|
+
Link,
|
|
3161
380
|
{
|
|
3162
381
|
to: from,
|
|
3163
382
|
replace: true,
|
|
3164
|
-
className:
|
|
383
|
+
className: clx(
|
|
3165
384
|
"flex items-center rounded-md bg-ui-bg-subtle outline-none transition-fg",
|
|
3166
385
|
"hover:bg-ui-bg-subtle-hover",
|
|
3167
386
|
"focus-visible:shadow-borders-focus"
|
|
3168
387
|
),
|
|
3169
|
-
children: /* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
388
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2.5 px-2 py-1", children: [
|
|
389
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx4(ArrowUturnLeft, { className: "text-ui-fg-subtle" }) }),
|
|
390
|
+
/* @__PURE__ */ jsx4(Text, { leading: "compact", weight: "plus", size: "small", children: t2("app.nav.settings.header") })
|
|
3172
391
|
] })
|
|
3173
392
|
}
|
|
3174
393
|
) });
|
|
@@ -3177,24 +396,24 @@ var RadixCollapsibleSection = ({
|
|
|
3177
396
|
label,
|
|
3178
397
|
items
|
|
3179
398
|
}) => {
|
|
3180
|
-
return /* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
399
|
+
return /* @__PURE__ */ jsxs(RadixCollapsible.Root, { defaultOpen: true, className: "py-3", children: [
|
|
400
|
+
/* @__PURE__ */ jsx4("div", { className: "px-3", children: /* @__PURE__ */ jsxs("div", { className: "flex h-7 items-center justify-between px-2 text-ui-fg-muted", children: [
|
|
401
|
+
/* @__PURE__ */ jsx4(Text, { size: "small", leading: "compact", children: label }),
|
|
402
|
+
/* @__PURE__ */ jsx4(RadixCollapsible.Trigger, { asChild: true, children: /* @__PURE__ */ jsx4(IconButton, { size: "2xsmall", variant: "transparent", className: "static", children: /* @__PURE__ */ jsx4(MinusMini, { className: "text-ui-fg-muted" }) }) })
|
|
3184
403
|
] }) }),
|
|
3185
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ jsx4(RadixCollapsible.Content, { children: /* @__PURE__ */ jsx4("div", { className: "pt-0.5", children: /* @__PURE__ */ jsx4("nav", { className: "flex flex-col gap-y-0.5", children: items.map((setting) => /* @__PURE__ */ jsx4(NavItem, { type: "setting", ...setting }, setting.to)) }) }) })
|
|
3186
405
|
] });
|
|
3187
406
|
};
|
|
3188
|
-
var
|
|
3189
|
-
return /* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
407
|
+
var UserSection = () => {
|
|
408
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
409
|
+
/* @__PURE__ */ jsx4("div", { className: "px-3", children: /* @__PURE__ */ jsx4(Divider, { variant: "dashed" }) }),
|
|
410
|
+
/* @__PURE__ */ jsx4(UserMenu, {})
|
|
3192
411
|
] });
|
|
3193
412
|
};
|
|
3194
413
|
|
|
3195
414
|
// src/get-route-map.tsx
|
|
3196
415
|
import { RoutePermissionGuard } from "@mercurjs/dashboard-shared";
|
|
3197
|
-
import { jsx as
|
|
416
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3198
417
|
function mergeRoutes(baseRoutes, customRoutes2) {
|
|
3199
418
|
const result = baseRoutes.map((route) => ({ ...route }));
|
|
3200
419
|
for (const customRoute of customRoutes2) {
|
|
@@ -3228,27 +447,27 @@ function getRouteMap({
|
|
|
3228
447
|
}) {
|
|
3229
448
|
return [
|
|
3230
449
|
{
|
|
3231
|
-
element: /* @__PURE__ */
|
|
3232
|
-
errorElement: /* @__PURE__ */
|
|
450
|
+
element: /* @__PURE__ */ jsx5(ProtectedRoute, {}),
|
|
451
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3233
452
|
children: [
|
|
3234
453
|
{
|
|
3235
|
-
element: /* @__PURE__ */
|
|
454
|
+
element: /* @__PURE__ */ jsx5(MainLayout, {}),
|
|
3236
455
|
children: [
|
|
3237
456
|
{
|
|
3238
457
|
// Pathless wrapper so every route below — including extension
|
|
3239
458
|
// routes merged in from virtual:mercur/routes — is enforced
|
|
3240
459
|
// without each one wiring its own guard element.
|
|
3241
|
-
element: /* @__PURE__ */
|
|
460
|
+
element: /* @__PURE__ */ jsx5(RoutePermissionGuard, {}),
|
|
3242
461
|
children: mergeRoutes(
|
|
3243
462
|
[
|
|
3244
463
|
{
|
|
3245
464
|
path: "/",
|
|
3246
|
-
errorElement: /* @__PURE__ */
|
|
3247
|
-
lazy: () => import("./home-
|
|
465
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
466
|
+
lazy: () => import("./home-RT4EIJFM.js")
|
|
3248
467
|
},
|
|
3249
468
|
{
|
|
3250
469
|
path: "/products",
|
|
3251
|
-
errorElement: /* @__PURE__ */
|
|
470
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3252
471
|
handle: {
|
|
3253
472
|
breadcrumb: () => t("products.domain"),
|
|
3254
473
|
permissions: "products:view"
|
|
@@ -3261,7 +480,7 @@ function getRouteMap({
|
|
|
3261
480
|
{
|
|
3262
481
|
path: "create",
|
|
3263
482
|
handle: { permissions: "products:edit" },
|
|
3264
|
-
lazy: () => import("./product-create-
|
|
483
|
+
lazy: () => import("./product-create-73WXVANY.js")
|
|
3265
484
|
},
|
|
3266
485
|
{
|
|
3267
486
|
path: "bulk-edit",
|
|
@@ -3271,21 +490,21 @@ function getRouteMap({
|
|
|
3271
490
|
},
|
|
3272
491
|
{
|
|
3273
492
|
path: ":id",
|
|
3274
|
-
errorElement: /* @__PURE__ */
|
|
493
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3275
494
|
lazy: async () => {
|
|
3276
|
-
const { Breadcrumb, loader } = await import("./product-detail-
|
|
495
|
+
const { Breadcrumb, loader } = await import("./product-detail-ZKQXB7PH.js");
|
|
3277
496
|
return {
|
|
3278
|
-
Component:
|
|
497
|
+
Component: Outlet3,
|
|
3279
498
|
loader,
|
|
3280
499
|
handle: {
|
|
3281
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
500
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3282
501
|
}
|
|
3283
502
|
};
|
|
3284
503
|
},
|
|
3285
504
|
children: [
|
|
3286
505
|
{
|
|
3287
506
|
path: "",
|
|
3288
|
-
lazy: () => import("./product-detail-
|
|
507
|
+
lazy: () => import("./product-detail-ZKQXB7PH.js"),
|
|
3289
508
|
children: [
|
|
3290
509
|
{
|
|
3291
510
|
path: "edit",
|
|
@@ -3343,10 +562,10 @@ function getRouteMap({
|
|
|
3343
562
|
lazy: async () => {
|
|
3344
563
|
const { Breadcrumb, loader } = await import("./product-variant-detail-7B26FRNG.js");
|
|
3345
564
|
return {
|
|
3346
|
-
Component:
|
|
565
|
+
Component: Outlet3,
|
|
3347
566
|
loader,
|
|
3348
567
|
handle: {
|
|
3349
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
568
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3350
569
|
}
|
|
3351
570
|
};
|
|
3352
571
|
},
|
|
@@ -3374,7 +593,7 @@ function getRouteMap({
|
|
|
3374
593
|
},
|
|
3375
594
|
{
|
|
3376
595
|
path: "/categories",
|
|
3377
|
-
errorElement: /* @__PURE__ */
|
|
596
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3378
597
|
handle: {
|
|
3379
598
|
breadcrumb: () => t("categories.domain"),
|
|
3380
599
|
permissions: "product_categories:view"
|
|
@@ -3382,7 +601,7 @@ function getRouteMap({
|
|
|
3382
601
|
children: [
|
|
3383
602
|
{
|
|
3384
603
|
path: "",
|
|
3385
|
-
lazy: () => import("./category-list-
|
|
604
|
+
lazy: () => import("./category-list-AT66O7HI.js"),
|
|
3386
605
|
children: [
|
|
3387
606
|
{
|
|
3388
607
|
path: "create",
|
|
@@ -3400,10 +619,10 @@ function getRouteMap({
|
|
|
3400
619
|
lazy: async () => {
|
|
3401
620
|
const { Breadcrumb, loader } = await import("./category-detail-3YY7FVY4.js");
|
|
3402
621
|
return {
|
|
3403
|
-
Component:
|
|
622
|
+
Component: Outlet3,
|
|
3404
623
|
loader,
|
|
3405
624
|
handle: {
|
|
3406
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
625
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3407
626
|
}
|
|
3408
627
|
};
|
|
3409
628
|
},
|
|
@@ -3445,7 +664,7 @@ function getRouteMap({
|
|
|
3445
664
|
},
|
|
3446
665
|
{
|
|
3447
666
|
path: "/orders",
|
|
3448
|
-
errorElement: /* @__PURE__ */
|
|
667
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3449
668
|
handle: {
|
|
3450
669
|
breadcrumb: () => t("orders.domain"),
|
|
3451
670
|
permissions: "orders:view"
|
|
@@ -3458,35 +677,35 @@ function getRouteMap({
|
|
|
3458
677
|
{
|
|
3459
678
|
path: ":id",
|
|
3460
679
|
lazy: async () => {
|
|
3461
|
-
const { Breadcrumb, loader } = await import("./order-detail-
|
|
680
|
+
const { Breadcrumb, loader } = await import("./order-detail-XYHRY25Y.js");
|
|
3462
681
|
return {
|
|
3463
|
-
Component:
|
|
682
|
+
Component: Outlet3,
|
|
3464
683
|
loader,
|
|
3465
684
|
handle: {
|
|
3466
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
685
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3467
686
|
}
|
|
3468
687
|
};
|
|
3469
688
|
},
|
|
3470
689
|
children: [
|
|
3471
690
|
{
|
|
3472
691
|
path: "",
|
|
3473
|
-
lazy: () => import("./order-detail-
|
|
692
|
+
lazy: () => import("./order-detail-XYHRY25Y.js"),
|
|
3474
693
|
children: [
|
|
3475
694
|
{
|
|
3476
695
|
path: "returns",
|
|
3477
|
-
lazy: () => import("./order-create-return-
|
|
696
|
+
lazy: () => import("./order-create-return-ECGHPLEZ.js")
|
|
3478
697
|
},
|
|
3479
698
|
{
|
|
3480
699
|
path: "claims",
|
|
3481
|
-
lazy: () => import("./order-create-claim-
|
|
700
|
+
lazy: () => import("./order-create-claim-PPUQXVYH.js")
|
|
3482
701
|
},
|
|
3483
702
|
{
|
|
3484
703
|
path: "exchanges",
|
|
3485
|
-
lazy: () => import("./order-create-exchange-
|
|
704
|
+
lazy: () => import("./order-create-exchange-5PCJ25LK.js")
|
|
3486
705
|
},
|
|
3487
706
|
{
|
|
3488
707
|
path: "edits",
|
|
3489
|
-
lazy: () => import("./order-create-edit-
|
|
708
|
+
lazy: () => import("./order-create-edit-QH25BOIU.js")
|
|
3490
709
|
},
|
|
3491
710
|
{
|
|
3492
711
|
path: "refund",
|
|
@@ -3520,7 +739,7 @@ function getRouteMap({
|
|
|
3520
739
|
},
|
|
3521
740
|
{
|
|
3522
741
|
path: "/promotions",
|
|
3523
|
-
errorElement: /* @__PURE__ */
|
|
742
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3524
743
|
handle: {
|
|
3525
744
|
breadcrumb: () => t("promotions.domain"),
|
|
3526
745
|
permissions: "promotions:view"
|
|
@@ -3528,7 +747,7 @@ function getRouteMap({
|
|
|
3528
747
|
children: [
|
|
3529
748
|
{
|
|
3530
749
|
path: "",
|
|
3531
|
-
lazy: () => import("./promotion-list-
|
|
750
|
+
lazy: () => import("./promotion-list-LJKKLZNU.js")
|
|
3532
751
|
},
|
|
3533
752
|
{
|
|
3534
753
|
path: "create",
|
|
@@ -3538,19 +757,19 @@ function getRouteMap({
|
|
|
3538
757
|
{
|
|
3539
758
|
path: ":id",
|
|
3540
759
|
lazy: async () => {
|
|
3541
|
-
const { Breadcrumb, loader } = await import("./promotion-detail-
|
|
760
|
+
const { Breadcrumb, loader } = await import("./promotion-detail-HOXUK5VG.js");
|
|
3542
761
|
return {
|
|
3543
|
-
Component:
|
|
762
|
+
Component: Outlet3,
|
|
3544
763
|
loader,
|
|
3545
764
|
handle: {
|
|
3546
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
765
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3547
766
|
}
|
|
3548
767
|
};
|
|
3549
768
|
},
|
|
3550
769
|
children: [
|
|
3551
770
|
{
|
|
3552
771
|
path: "",
|
|
3553
|
-
lazy: () => import("./promotion-detail-
|
|
772
|
+
lazy: () => import("./promotion-detail-HOXUK5VG.js"),
|
|
3554
773
|
children: [
|
|
3555
774
|
{
|
|
3556
775
|
path: "edit",
|
|
@@ -3573,7 +792,7 @@ function getRouteMap({
|
|
|
3573
792
|
},
|
|
3574
793
|
{
|
|
3575
794
|
path: "/campaigns",
|
|
3576
|
-
errorElement: /* @__PURE__ */
|
|
795
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3577
796
|
handle: {
|
|
3578
797
|
breadcrumb: () => t("campaigns.domain"),
|
|
3579
798
|
permissions: "campaigns:view"
|
|
@@ -3581,7 +800,7 @@ function getRouteMap({
|
|
|
3581
800
|
children: [
|
|
3582
801
|
{
|
|
3583
802
|
path: "",
|
|
3584
|
-
lazy: () => import("./campaign-list-
|
|
803
|
+
lazy: () => import("./campaign-list-M24QK43I.js"),
|
|
3585
804
|
children: []
|
|
3586
805
|
},
|
|
3587
806
|
{
|
|
@@ -3592,19 +811,19 @@ function getRouteMap({
|
|
|
3592
811
|
{
|
|
3593
812
|
path: ":id",
|
|
3594
813
|
lazy: async () => {
|
|
3595
|
-
const { Breadcrumb, loader } = await import("./campaign-detail-
|
|
814
|
+
const { Breadcrumb, loader } = await import("./campaign-detail-WBWGUSMW.js");
|
|
3596
815
|
return {
|
|
3597
|
-
Component:
|
|
816
|
+
Component: Outlet3,
|
|
3598
817
|
loader,
|
|
3599
818
|
handle: {
|
|
3600
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
819
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3601
820
|
}
|
|
3602
821
|
};
|
|
3603
822
|
},
|
|
3604
823
|
children: [
|
|
3605
824
|
{
|
|
3606
825
|
path: "",
|
|
3607
|
-
lazy: () => import("./campaign-detail-
|
|
826
|
+
lazy: () => import("./campaign-detail-WBWGUSMW.js"),
|
|
3608
827
|
children: [
|
|
3609
828
|
{
|
|
3610
829
|
path: "edit",
|
|
@@ -3631,7 +850,7 @@ function getRouteMap({
|
|
|
3631
850
|
},
|
|
3632
851
|
{
|
|
3633
852
|
path: "/reviews",
|
|
3634
|
-
errorElement: /* @__PURE__ */
|
|
853
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3635
854
|
handle: {
|
|
3636
855
|
breadcrumb: () => t("reviews.domain"),
|
|
3637
856
|
permissions: "reviews:view"
|
|
@@ -3639,7 +858,7 @@ function getRouteMap({
|
|
|
3639
858
|
children: [
|
|
3640
859
|
{
|
|
3641
860
|
path: "",
|
|
3642
|
-
lazy: () => import("./review-list-
|
|
861
|
+
lazy: () => import("./review-list-5NGJJH23.js"),
|
|
3643
862
|
children: []
|
|
3644
863
|
},
|
|
3645
864
|
{
|
|
@@ -3647,10 +866,10 @@ function getRouteMap({
|
|
|
3647
866
|
lazy: async () => {
|
|
3648
867
|
const { Breadcrumb, loader } = await import("./review-detail-K555FECH.js");
|
|
3649
868
|
return {
|
|
3650
|
-
Component:
|
|
869
|
+
Component: Outlet3,
|
|
3651
870
|
loader,
|
|
3652
871
|
handle: {
|
|
3653
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
872
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3654
873
|
}
|
|
3655
874
|
};
|
|
3656
875
|
},
|
|
@@ -3676,7 +895,7 @@ function getRouteMap({
|
|
|
3676
895
|
},
|
|
3677
896
|
{
|
|
3678
897
|
path: "/collections",
|
|
3679
|
-
errorElement: /* @__PURE__ */
|
|
898
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3680
899
|
handle: {
|
|
3681
900
|
breadcrumb: () => t("collections.domain"),
|
|
3682
901
|
permissions: "product_collections:view"
|
|
@@ -3684,7 +903,7 @@ function getRouteMap({
|
|
|
3684
903
|
children: [
|
|
3685
904
|
{
|
|
3686
905
|
path: "",
|
|
3687
|
-
lazy: () => import("./collection-list-
|
|
906
|
+
lazy: () => import("./collection-list-QQJAESFN.js"),
|
|
3688
907
|
children: [
|
|
3689
908
|
{
|
|
3690
909
|
path: "create",
|
|
@@ -3696,19 +915,19 @@ function getRouteMap({
|
|
|
3696
915
|
{
|
|
3697
916
|
path: ":id",
|
|
3698
917
|
lazy: async () => {
|
|
3699
|
-
const { Breadcrumb, loader } = await import("./collection-detail-
|
|
918
|
+
const { Breadcrumb, loader } = await import("./collection-detail-N7VZKBIJ.js");
|
|
3700
919
|
return {
|
|
3701
|
-
Component:
|
|
920
|
+
Component: Outlet3,
|
|
3702
921
|
loader,
|
|
3703
922
|
handle: {
|
|
3704
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
923
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3705
924
|
}
|
|
3706
925
|
};
|
|
3707
926
|
},
|
|
3708
927
|
children: [
|
|
3709
928
|
{
|
|
3710
929
|
path: "",
|
|
3711
|
-
lazy: () => import("./collection-detail-
|
|
930
|
+
lazy: () => import("./collection-detail-N7VZKBIJ.js"),
|
|
3712
931
|
children: [
|
|
3713
932
|
{
|
|
3714
933
|
path: "edit",
|
|
@@ -3739,7 +958,7 @@ function getRouteMap({
|
|
|
3739
958
|
},
|
|
3740
959
|
{
|
|
3741
960
|
path: "/price-lists",
|
|
3742
|
-
errorElement: /* @__PURE__ */
|
|
961
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3743
962
|
handle: {
|
|
3744
963
|
breadcrumb: () => t("priceLists.domain"),
|
|
3745
964
|
permissions: "price_lists:view"
|
|
@@ -3747,31 +966,31 @@ function getRouteMap({
|
|
|
3747
966
|
children: [
|
|
3748
967
|
{
|
|
3749
968
|
path: "",
|
|
3750
|
-
lazy: () => import("./price-list-list-
|
|
969
|
+
lazy: () => import("./price-list-list-FPCLLS33.js"),
|
|
3751
970
|
children: [
|
|
3752
971
|
{
|
|
3753
972
|
path: "create",
|
|
3754
973
|
handle: { permissions: "price_lists:edit" },
|
|
3755
|
-
lazy: () => import("./price-list-create-
|
|
974
|
+
lazy: () => import("./price-list-create-DRKZIV2D.js")
|
|
3756
975
|
}
|
|
3757
976
|
]
|
|
3758
977
|
},
|
|
3759
978
|
{
|
|
3760
979
|
path: ":id",
|
|
3761
980
|
lazy: async () => {
|
|
3762
|
-
const { Breadcrumb, loader } = await import("./price-list-detail-
|
|
981
|
+
const { Breadcrumb, loader } = await import("./price-list-detail-AML5XNDJ.js");
|
|
3763
982
|
return {
|
|
3764
|
-
Component:
|
|
983
|
+
Component: Outlet3,
|
|
3765
984
|
loader,
|
|
3766
985
|
handle: {
|
|
3767
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
986
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3768
987
|
}
|
|
3769
988
|
};
|
|
3770
989
|
},
|
|
3771
990
|
children: [
|
|
3772
991
|
{
|
|
3773
992
|
path: "",
|
|
3774
|
-
lazy: () => import("./price-list-detail-
|
|
993
|
+
lazy: () => import("./price-list-detail-AML5XNDJ.js"),
|
|
3775
994
|
children: [
|
|
3776
995
|
{
|
|
3777
996
|
path: "edit",
|
|
@@ -3788,7 +1007,7 @@ function getRouteMap({
|
|
|
3788
1007
|
},
|
|
3789
1008
|
{
|
|
3790
1009
|
path: "products/add",
|
|
3791
|
-
lazy: () => import("./price-list-prices-add-
|
|
1010
|
+
lazy: () => import("./price-list-prices-add-HAYZV2XV.js")
|
|
3792
1011
|
},
|
|
3793
1012
|
{
|
|
3794
1013
|
path: "products/edit",
|
|
@@ -3802,7 +1021,7 @@ function getRouteMap({
|
|
|
3802
1021
|
},
|
|
3803
1022
|
{
|
|
3804
1023
|
path: "/customers",
|
|
3805
|
-
errorElement: /* @__PURE__ */
|
|
1024
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3806
1025
|
handle: {
|
|
3807
1026
|
breadcrumb: () => t("customers.domain"),
|
|
3808
1027
|
permissions: "customers:view"
|
|
@@ -3810,7 +1029,7 @@ function getRouteMap({
|
|
|
3810
1029
|
children: [
|
|
3811
1030
|
{
|
|
3812
1031
|
path: "",
|
|
3813
|
-
lazy: () => import("./customer-list-
|
|
1032
|
+
lazy: () => import("./customer-list-6X6RQDLK.js"),
|
|
3814
1033
|
children: [
|
|
3815
1034
|
{
|
|
3816
1035
|
path: "create",
|
|
@@ -3822,19 +1041,19 @@ function getRouteMap({
|
|
|
3822
1041
|
{
|
|
3823
1042
|
path: ":id",
|
|
3824
1043
|
lazy: async () => {
|
|
3825
|
-
const { Breadcrumb, loader } = await import("./customer-detail-
|
|
1044
|
+
const { Breadcrumb, loader } = await import("./customer-detail-CGKGZE2N.js");
|
|
3826
1045
|
return {
|
|
3827
|
-
Component:
|
|
1046
|
+
Component: Outlet3,
|
|
3828
1047
|
loader,
|
|
3829
1048
|
handle: {
|
|
3830
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1049
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3831
1050
|
}
|
|
3832
1051
|
};
|
|
3833
1052
|
},
|
|
3834
1053
|
children: [
|
|
3835
1054
|
{
|
|
3836
1055
|
path: "",
|
|
3837
|
-
lazy: () => import("./customer-detail-
|
|
1056
|
+
lazy: () => import("./customer-detail-CGKGZE2N.js"),
|
|
3838
1057
|
children: [
|
|
3839
1058
|
{
|
|
3840
1059
|
path: "edit",
|
|
@@ -3869,7 +1088,7 @@ function getRouteMap({
|
|
|
3869
1088
|
},
|
|
3870
1089
|
{
|
|
3871
1090
|
path: "/customer-groups",
|
|
3872
|
-
errorElement: /* @__PURE__ */
|
|
1091
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3873
1092
|
handle: {
|
|
3874
1093
|
breadcrumb: () => t("customerGroups.domain"),
|
|
3875
1094
|
permissions: "customer_groups:view"
|
|
@@ -3877,7 +1096,7 @@ function getRouteMap({
|
|
|
3877
1096
|
children: [
|
|
3878
1097
|
{
|
|
3879
1098
|
path: "",
|
|
3880
|
-
lazy: () => import("./customer-group-list-
|
|
1099
|
+
lazy: () => import("./customer-group-list-GYEQ2GTL.js"),
|
|
3881
1100
|
children: [
|
|
3882
1101
|
{
|
|
3883
1102
|
path: "create",
|
|
@@ -3889,19 +1108,19 @@ function getRouteMap({
|
|
|
3889
1108
|
{
|
|
3890
1109
|
path: ":id",
|
|
3891
1110
|
lazy: async () => {
|
|
3892
|
-
const { Breadcrumb, loader } = await import("./customer-group-detail-
|
|
1111
|
+
const { Breadcrumb, loader } = await import("./customer-group-detail-JMBR3D72.js");
|
|
3893
1112
|
return {
|
|
3894
|
-
Component:
|
|
1113
|
+
Component: Outlet3,
|
|
3895
1114
|
loader,
|
|
3896
1115
|
handle: {
|
|
3897
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1116
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3898
1117
|
}
|
|
3899
1118
|
};
|
|
3900
1119
|
},
|
|
3901
1120
|
children: [
|
|
3902
1121
|
{
|
|
3903
1122
|
path: "",
|
|
3904
|
-
lazy: () => import("./customer-group-detail-
|
|
1123
|
+
lazy: () => import("./customer-group-detail-JMBR3D72.js"),
|
|
3905
1124
|
children: [
|
|
3906
1125
|
{
|
|
3907
1126
|
path: "edit",
|
|
@@ -3924,7 +1143,7 @@ function getRouteMap({
|
|
|
3924
1143
|
},
|
|
3925
1144
|
{
|
|
3926
1145
|
path: "/stores",
|
|
3927
|
-
errorElement: /* @__PURE__ */
|
|
1146
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3928
1147
|
handle: {
|
|
3929
1148
|
breadcrumb: () => t("stores.domain"),
|
|
3930
1149
|
permissions: "sellers:view"
|
|
@@ -3932,7 +1151,7 @@ function getRouteMap({
|
|
|
3932
1151
|
children: [
|
|
3933
1152
|
{
|
|
3934
1153
|
path: "",
|
|
3935
|
-
lazy: () => import("./store-list-
|
|
1154
|
+
lazy: () => import("./store-list-LPKSZF2E.js"),
|
|
3936
1155
|
children: [
|
|
3937
1156
|
{
|
|
3938
1157
|
path: "create",
|
|
@@ -3948,18 +1167,18 @@ function getRouteMap({
|
|
|
3948
1167
|
{
|
|
3949
1168
|
path: ":id",
|
|
3950
1169
|
lazy: async () => {
|
|
3951
|
-
const { Breadcrumb } = await import("./store-details-
|
|
1170
|
+
const { Breadcrumb } = await import("./store-details-MPTCI4VG.js");
|
|
3952
1171
|
return {
|
|
3953
|
-
Component:
|
|
1172
|
+
Component: Outlet3,
|
|
3954
1173
|
handle: {
|
|
3955
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1174
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
3956
1175
|
}
|
|
3957
1176
|
};
|
|
3958
1177
|
},
|
|
3959
1178
|
children: [
|
|
3960
1179
|
{
|
|
3961
1180
|
path: "",
|
|
3962
|
-
lazy: () => import("./store-details-
|
|
1181
|
+
lazy: () => import("./store-details-MPTCI4VG.js"),
|
|
3963
1182
|
children: [
|
|
3964
1183
|
{
|
|
3965
1184
|
path: "edit",
|
|
@@ -3994,7 +1213,7 @@ function getRouteMap({
|
|
|
3994
1213
|
},
|
|
3995
1214
|
{
|
|
3996
1215
|
path: "/payouts",
|
|
3997
|
-
errorElement: /* @__PURE__ */
|
|
1216
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
3998
1217
|
handle: {
|
|
3999
1218
|
breadcrumb: () => "Payouts",
|
|
4000
1219
|
permissions: "payouts:view"
|
|
@@ -4009,10 +1228,10 @@ function getRouteMap({
|
|
|
4009
1228
|
lazy: async () => {
|
|
4010
1229
|
const { Breadcrumb, loader } = await import("./payout-detail-UTFO6U4H.js");
|
|
4011
1230
|
return {
|
|
4012
|
-
Component:
|
|
1231
|
+
Component: Outlet3,
|
|
4013
1232
|
loader,
|
|
4014
1233
|
handle: {
|
|
4015
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1234
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4016
1235
|
}
|
|
4017
1236
|
};
|
|
4018
1237
|
},
|
|
@@ -4027,7 +1246,7 @@ function getRouteMap({
|
|
|
4027
1246
|
},
|
|
4028
1247
|
{
|
|
4029
1248
|
path: "/reservations",
|
|
4030
|
-
errorElement: /* @__PURE__ */
|
|
1249
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
4031
1250
|
handle: {
|
|
4032
1251
|
breadcrumb: () => t("reservations.domain"),
|
|
4033
1252
|
permissions: "reservations:view"
|
|
@@ -4035,7 +1254,7 @@ function getRouteMap({
|
|
|
4035
1254
|
children: [
|
|
4036
1255
|
{
|
|
4037
1256
|
path: "",
|
|
4038
|
-
lazy: () => import("./reservation-list-
|
|
1257
|
+
lazy: () => import("./reservation-list-FQAWE7S5.js"),
|
|
4039
1258
|
children: [
|
|
4040
1259
|
{
|
|
4041
1260
|
path: "create",
|
|
@@ -4047,19 +1266,19 @@ function getRouteMap({
|
|
|
4047
1266
|
{
|
|
4048
1267
|
path: ":id",
|
|
4049
1268
|
lazy: async () => {
|
|
4050
|
-
const { Breadcrumb, loader } = await import("./reservation-detail-
|
|
1269
|
+
const { Breadcrumb, loader } = await import("./reservation-detail-M42OB6BC.js");
|
|
4051
1270
|
return {
|
|
4052
|
-
Component:
|
|
1271
|
+
Component: Outlet3,
|
|
4053
1272
|
loader,
|
|
4054
1273
|
handle: {
|
|
4055
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1274
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4056
1275
|
}
|
|
4057
1276
|
};
|
|
4058
1277
|
},
|
|
4059
1278
|
children: [
|
|
4060
1279
|
{
|
|
4061
1280
|
path: "",
|
|
4062
|
-
lazy: () => import("./reservation-detail-
|
|
1281
|
+
lazy: () => import("./reservation-detail-M42OB6BC.js"),
|
|
4063
1282
|
children: [
|
|
4064
1283
|
{
|
|
4065
1284
|
path: "edit",
|
|
@@ -4078,7 +1297,7 @@ function getRouteMap({
|
|
|
4078
1297
|
},
|
|
4079
1298
|
{
|
|
4080
1299
|
path: "/offers",
|
|
4081
|
-
errorElement: /* @__PURE__ */
|
|
1300
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
4082
1301
|
handle: {
|
|
4083
1302
|
breadcrumb: () => t("offers.domain"),
|
|
4084
1303
|
permissions: "offers:view"
|
|
@@ -4087,7 +1306,7 @@ function getRouteMap({
|
|
|
4087
1306
|
{
|
|
4088
1307
|
path: "",
|
|
4089
1308
|
lazy: async () => {
|
|
4090
|
-
const { OfferListPage } = await import("./offers-
|
|
1309
|
+
const { OfferListPage } = await import("./offers-RS4UORI3.js");
|
|
4091
1310
|
return { Component: OfferListPage };
|
|
4092
1311
|
}
|
|
4093
1312
|
},
|
|
@@ -4097,10 +1316,10 @@ function getRouteMap({
|
|
|
4097
1316
|
const { loader } = await import("./loader-3VTBJUA2.js");
|
|
4098
1317
|
const { Breadcrumb } = await import("./breadcrumb-KOE4ZWGU.js");
|
|
4099
1318
|
return {
|
|
4100
|
-
Component:
|
|
1319
|
+
Component: Outlet3,
|
|
4101
1320
|
loader,
|
|
4102
1321
|
handle: {
|
|
4103
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1322
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4104
1323
|
}
|
|
4105
1324
|
};
|
|
4106
1325
|
},
|
|
@@ -4108,7 +1327,7 @@ function getRouteMap({
|
|
|
4108
1327
|
{
|
|
4109
1328
|
path: "",
|
|
4110
1329
|
lazy: async () => {
|
|
4111
|
-
const { OfferDetailPage } = await import("./offer-detail-page-
|
|
1330
|
+
const { OfferDetailPage } = await import("./offer-detail-page-XU6XK6YR.js");
|
|
4112
1331
|
return { Component: OfferDetailPage };
|
|
4113
1332
|
}
|
|
4114
1333
|
},
|
|
@@ -4118,10 +1337,10 @@ function getRouteMap({
|
|
|
4118
1337
|
const { loader } = await import("./loader-G2ECT6LC.js");
|
|
4119
1338
|
const { Breadcrumb } = await import("./breadcrumb-TCQDZXGC.js");
|
|
4120
1339
|
return {
|
|
4121
|
-
Component:
|
|
1340
|
+
Component: Outlet3,
|
|
4122
1341
|
loader,
|
|
4123
1342
|
handle: {
|
|
4124
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1343
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4125
1344
|
}
|
|
4126
1345
|
};
|
|
4127
1346
|
},
|
|
@@ -4141,7 +1360,7 @@ function getRouteMap({
|
|
|
4141
1360
|
},
|
|
4142
1361
|
{
|
|
4143
1362
|
path: "/inventory",
|
|
4144
|
-
errorElement: /* @__PURE__ */
|
|
1363
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
4145
1364
|
handle: {
|
|
4146
1365
|
breadcrumb: () => t("inventory.domain"),
|
|
4147
1366
|
permissions: "inventory_items:view"
|
|
@@ -4149,7 +1368,7 @@ function getRouteMap({
|
|
|
4149
1368
|
children: [
|
|
4150
1369
|
{
|
|
4151
1370
|
path: "",
|
|
4152
|
-
lazy: () => import("./inventory-list-
|
|
1371
|
+
lazy: () => import("./inventory-list-XS3OFHLW.js"),
|
|
4153
1372
|
children: [
|
|
4154
1373
|
{
|
|
4155
1374
|
path: "stock",
|
|
@@ -4160,19 +1379,19 @@ function getRouteMap({
|
|
|
4160
1379
|
{
|
|
4161
1380
|
path: ":id",
|
|
4162
1381
|
lazy: async () => {
|
|
4163
|
-
const { Breadcrumb, loader } = await import("./inventory-detail-
|
|
1382
|
+
const { Breadcrumb, loader } = await import("./inventory-detail-PMJN4E2D.js");
|
|
4164
1383
|
return {
|
|
4165
|
-
Component:
|
|
1384
|
+
Component: Outlet3,
|
|
4166
1385
|
loader,
|
|
4167
1386
|
handle: {
|
|
4168
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1387
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4169
1388
|
}
|
|
4170
1389
|
};
|
|
4171
1390
|
},
|
|
4172
1391
|
children: [
|
|
4173
1392
|
{
|
|
4174
1393
|
path: "",
|
|
4175
|
-
lazy: () => import("./inventory-detail-
|
|
1394
|
+
lazy: () => import("./inventory-detail-PMJN4E2D.js"),
|
|
4176
1395
|
children: [
|
|
4177
1396
|
{
|
|
4178
1397
|
path: "edit",
|
|
@@ -4210,36 +1429,36 @@ function getRouteMap({
|
|
|
4210
1429
|
]
|
|
4211
1430
|
},
|
|
4212
1431
|
{
|
|
4213
|
-
element: /* @__PURE__ */
|
|
4214
|
-
errorElement: /* @__PURE__ */
|
|
1432
|
+
element: /* @__PURE__ */ jsx5(ProtectedRoute, {}),
|
|
1433
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
4215
1434
|
children: [
|
|
4216
1435
|
{
|
|
4217
1436
|
path: "/settings",
|
|
4218
1437
|
handle: {
|
|
4219
1438
|
breadcrumb: () => t("app.nav.settings.header")
|
|
4220
1439
|
},
|
|
4221
|
-
element: /* @__PURE__ */
|
|
1440
|
+
element: /* @__PURE__ */ jsx5(SettingsLayout, {}),
|
|
4222
1441
|
children: [
|
|
4223
1442
|
{
|
|
4224
|
-
element: /* @__PURE__ */
|
|
1443
|
+
element: /* @__PURE__ */ jsx5(RoutePermissionGuard, {}),
|
|
4225
1444
|
children: mergeRoutes(
|
|
4226
1445
|
[
|
|
4227
1446
|
{
|
|
4228
1447
|
index: true,
|
|
4229
|
-
errorElement: /* @__PURE__ */
|
|
1448
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
4230
1449
|
lazy: () => import("./settings-AVE3VCCM.js")
|
|
4231
1450
|
},
|
|
4232
1451
|
{
|
|
4233
1452
|
path: "profile",
|
|
4234
|
-
errorElement: /* @__PURE__ */
|
|
4235
|
-
element: /* @__PURE__ */
|
|
1453
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1454
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4236
1455
|
handle: {
|
|
4237
1456
|
breadcrumb: () => t("profile.domain")
|
|
4238
1457
|
},
|
|
4239
1458
|
children: [
|
|
4240
1459
|
{
|
|
4241
1460
|
path: "",
|
|
4242
|
-
lazy: () => import("./profile-detail-
|
|
1461
|
+
lazy: () => import("./profile-detail-GDQQJUWF.js"),
|
|
4243
1462
|
children: [
|
|
4244
1463
|
{
|
|
4245
1464
|
path: "edit",
|
|
@@ -4251,8 +1470,8 @@ function getRouteMap({
|
|
|
4251
1470
|
},
|
|
4252
1471
|
{
|
|
4253
1472
|
path: "regions",
|
|
4254
|
-
errorElement: /* @__PURE__ */
|
|
4255
|
-
element: /* @__PURE__ */
|
|
1473
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1474
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4256
1475
|
handle: {
|
|
4257
1476
|
breadcrumb: () => t("regions.domain"),
|
|
4258
1477
|
permissions: "regions:view"
|
|
@@ -4260,7 +1479,7 @@ function getRouteMap({
|
|
|
4260
1479
|
children: [
|
|
4261
1480
|
{
|
|
4262
1481
|
path: "",
|
|
4263
|
-
lazy: () => import("./region-list-
|
|
1482
|
+
lazy: () => import("./region-list-JP3CZISQ.js"),
|
|
4264
1483
|
children: [
|
|
4265
1484
|
{
|
|
4266
1485
|
path: "create",
|
|
@@ -4272,19 +1491,19 @@ function getRouteMap({
|
|
|
4272
1491
|
{
|
|
4273
1492
|
path: ":id",
|
|
4274
1493
|
lazy: async () => {
|
|
4275
|
-
const { Breadcrumb, loader } = await import("./region-detail-
|
|
1494
|
+
const { Breadcrumb, loader } = await import("./region-detail-YTB7OEQU.js");
|
|
4276
1495
|
return {
|
|
4277
|
-
Component:
|
|
1496
|
+
Component: Outlet3,
|
|
4278
1497
|
loader,
|
|
4279
1498
|
handle: {
|
|
4280
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1499
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4281
1500
|
}
|
|
4282
1501
|
};
|
|
4283
1502
|
},
|
|
4284
1503
|
children: [
|
|
4285
1504
|
{
|
|
4286
1505
|
path: "",
|
|
4287
|
-
lazy: () => import("./region-detail-
|
|
1506
|
+
lazy: () => import("./region-detail-YTB7OEQU.js"),
|
|
4288
1507
|
children: [
|
|
4289
1508
|
{
|
|
4290
1509
|
path: "edit",
|
|
@@ -4307,8 +1526,8 @@ function getRouteMap({
|
|
|
4307
1526
|
},
|
|
4308
1527
|
{
|
|
4309
1528
|
path: "marketplace",
|
|
4310
|
-
errorElement: /* @__PURE__ */
|
|
4311
|
-
element: /* @__PURE__ */
|
|
1529
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1530
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4312
1531
|
handle: {
|
|
4313
1532
|
breadcrumb: () => t("marketplace.domain"),
|
|
4314
1533
|
permissions: "store:view"
|
|
@@ -4316,7 +1535,7 @@ function getRouteMap({
|
|
|
4316
1535
|
children: [
|
|
4317
1536
|
{
|
|
4318
1537
|
path: "",
|
|
4319
|
-
lazy: () => import("./marketplace-detail-
|
|
1538
|
+
lazy: () => import("./marketplace-detail-UYBZIFQW.js"),
|
|
4320
1539
|
children: [
|
|
4321
1540
|
{
|
|
4322
1541
|
path: "edit",
|
|
@@ -4337,8 +1556,8 @@ function getRouteMap({
|
|
|
4337
1556
|
},
|
|
4338
1557
|
{
|
|
4339
1558
|
path: "commissions",
|
|
4340
|
-
errorElement: /* @__PURE__ */
|
|
4341
|
-
element: /* @__PURE__ */
|
|
1559
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1560
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4342
1561
|
handle: {
|
|
4343
1562
|
breadcrumb: () => t("commissions.domain"),
|
|
4344
1563
|
permissions: "commission_rates:view"
|
|
@@ -4346,7 +1565,7 @@ function getRouteMap({
|
|
|
4346
1565
|
children: [
|
|
4347
1566
|
{
|
|
4348
1567
|
path: "",
|
|
4349
|
-
lazy: () => import("./commissions-list-
|
|
1568
|
+
lazy: () => import("./commissions-list-US6OMDVL.js"),
|
|
4350
1569
|
children: [
|
|
4351
1570
|
{
|
|
4352
1571
|
path: "create",
|
|
@@ -4362,18 +1581,18 @@ function getRouteMap({
|
|
|
4362
1581
|
{
|
|
4363
1582
|
path: ":id",
|
|
4364
1583
|
lazy: async () => {
|
|
4365
|
-
const { Breadcrumb } = await import("./commission-rule-detail-
|
|
1584
|
+
const { Breadcrumb } = await import("./commission-rule-detail-CIE6TPXW.js");
|
|
4366
1585
|
return {
|
|
4367
|
-
Component:
|
|
1586
|
+
Component: Outlet3,
|
|
4368
1587
|
handle: {
|
|
4369
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1588
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4370
1589
|
}
|
|
4371
1590
|
};
|
|
4372
1591
|
},
|
|
4373
1592
|
children: [
|
|
4374
1593
|
{
|
|
4375
1594
|
path: "",
|
|
4376
|
-
lazy: () => import("./commission-rule-detail-
|
|
1595
|
+
lazy: () => import("./commission-rule-detail-CIE6TPXW.js"),
|
|
4377
1596
|
children: [
|
|
4378
1597
|
{
|
|
4379
1598
|
path: "edit",
|
|
@@ -4392,8 +1611,8 @@ function getRouteMap({
|
|
|
4392
1611
|
},
|
|
4393
1612
|
{
|
|
4394
1613
|
path: "users",
|
|
4395
|
-
errorElement: /* @__PURE__ */
|
|
4396
|
-
element: /* @__PURE__ */
|
|
1614
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1615
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4397
1616
|
handle: {
|
|
4398
1617
|
breadcrumb: () => t("users.domain"),
|
|
4399
1618
|
permissions: "users:view"
|
|
@@ -4401,31 +1620,31 @@ function getRouteMap({
|
|
|
4401
1620
|
children: [
|
|
4402
1621
|
{
|
|
4403
1622
|
path: "",
|
|
4404
|
-
lazy: () => import("./user-list-
|
|
1623
|
+
lazy: () => import("./user-list-X6UZ6UZM.js"),
|
|
4405
1624
|
children: [
|
|
4406
1625
|
{
|
|
4407
1626
|
path: "invite",
|
|
4408
1627
|
handle: { permissions: "users:edit" },
|
|
4409
|
-
lazy: () => import("./user-invite-
|
|
1628
|
+
lazy: () => import("./user-invite-4JFF3NRW.js")
|
|
4410
1629
|
}
|
|
4411
1630
|
]
|
|
4412
1631
|
},
|
|
4413
1632
|
{
|
|
4414
1633
|
path: ":id",
|
|
4415
1634
|
lazy: async () => {
|
|
4416
|
-
const { Breadcrumb, loader } = await import("./user-detail-
|
|
1635
|
+
const { Breadcrumb, loader } = await import("./user-detail-RD3T5WQT.js");
|
|
4417
1636
|
return {
|
|
4418
|
-
Component:
|
|
1637
|
+
Component: Outlet3,
|
|
4419
1638
|
loader,
|
|
4420
1639
|
handle: {
|
|
4421
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1640
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4422
1641
|
}
|
|
4423
1642
|
};
|
|
4424
1643
|
},
|
|
4425
1644
|
children: [
|
|
4426
1645
|
{
|
|
4427
1646
|
path: "",
|
|
4428
|
-
lazy: () => import("./user-detail-
|
|
1647
|
+
lazy: () => import("./user-detail-RD3T5WQT.js"),
|
|
4429
1648
|
children: [
|
|
4430
1649
|
{
|
|
4431
1650
|
path: "edit",
|
|
@@ -4444,8 +1663,8 @@ function getRouteMap({
|
|
|
4444
1663
|
},
|
|
4445
1664
|
{
|
|
4446
1665
|
path: "sales-channels",
|
|
4447
|
-
errorElement: /* @__PURE__ */
|
|
4448
|
-
element: /* @__PURE__ */
|
|
1666
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1667
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4449
1668
|
handle: {
|
|
4450
1669
|
breadcrumb: () => t("salesChannels.domain"),
|
|
4451
1670
|
permissions: "sales_channels:view"
|
|
@@ -4467,10 +1686,10 @@ function getRouteMap({
|
|
|
4467
1686
|
lazy: async () => {
|
|
4468
1687
|
const { Breadcrumb, loader } = await import("./sales-channel-detail-7GAGHWEP.js");
|
|
4469
1688
|
return {
|
|
4470
|
-
Component:
|
|
1689
|
+
Component: Outlet3,
|
|
4471
1690
|
loader,
|
|
4472
1691
|
handle: {
|
|
4473
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1692
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4474
1693
|
}
|
|
4475
1694
|
};
|
|
4476
1695
|
},
|
|
@@ -4500,8 +1719,8 @@ function getRouteMap({
|
|
|
4500
1719
|
},
|
|
4501
1720
|
{
|
|
4502
1721
|
path: "locations",
|
|
4503
|
-
errorElement: /* @__PURE__ */
|
|
4504
|
-
element: /* @__PURE__ */
|
|
1722
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1723
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4505
1724
|
handle: {
|
|
4506
1725
|
breadcrumb: () => t("locations.domain"),
|
|
4507
1726
|
permissions: "stock_locations:view"
|
|
@@ -4518,7 +1737,7 @@ function getRouteMap({
|
|
|
4518
1737
|
},
|
|
4519
1738
|
{
|
|
4520
1739
|
path: "shipping-profiles",
|
|
4521
|
-
element: /* @__PURE__ */
|
|
1740
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4522
1741
|
handle: {
|
|
4523
1742
|
breadcrumb: () => t("shippingProfile.domain"),
|
|
4524
1743
|
permissions: "shipping_profiles:view"
|
|
@@ -4526,7 +1745,7 @@ function getRouteMap({
|
|
|
4526
1745
|
children: [
|
|
4527
1746
|
{
|
|
4528
1747
|
path: "",
|
|
4529
|
-
lazy: () => import("./shipping-profiles-list-
|
|
1748
|
+
lazy: () => import("./shipping-profiles-list-GC6AK77V.js"),
|
|
4530
1749
|
children: [
|
|
4531
1750
|
{
|
|
4532
1751
|
path: "create",
|
|
@@ -4538,19 +1757,19 @@ function getRouteMap({
|
|
|
4538
1757
|
{
|
|
4539
1758
|
path: ":shipping_profile_id",
|
|
4540
1759
|
lazy: async () => {
|
|
4541
|
-
const { Breadcrumb, loader } = await import("./shipping-profile-detail-
|
|
1760
|
+
const { Breadcrumb, loader } = await import("./shipping-profile-detail-7SE5GLQZ.js");
|
|
4542
1761
|
return {
|
|
4543
|
-
Component:
|
|
1762
|
+
Component: Outlet3,
|
|
4544
1763
|
loader,
|
|
4545
1764
|
handle: {
|
|
4546
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1765
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4547
1766
|
}
|
|
4548
1767
|
};
|
|
4549
1768
|
},
|
|
4550
1769
|
children: [
|
|
4551
1770
|
{
|
|
4552
1771
|
path: "",
|
|
4553
|
-
lazy: () => import("./shipping-profile-detail-
|
|
1772
|
+
lazy: () => import("./shipping-profile-detail-7SE5GLQZ.js"),
|
|
4554
1773
|
children: [
|
|
4555
1774
|
{
|
|
4556
1775
|
path: "metadata/edit",
|
|
@@ -4564,8 +1783,8 @@ function getRouteMap({
|
|
|
4564
1783
|
},
|
|
4565
1784
|
{
|
|
4566
1785
|
path: "shipping-option-types",
|
|
4567
|
-
errorElement: /* @__PURE__ */
|
|
4568
|
-
element: /* @__PURE__ */
|
|
1786
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1787
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4569
1788
|
handle: {
|
|
4570
1789
|
breadcrumb: () => t("shippingOptionTypes.domain"),
|
|
4571
1790
|
permissions: "shipping_options:view"
|
|
@@ -4573,7 +1792,7 @@ function getRouteMap({
|
|
|
4573
1792
|
children: [
|
|
4574
1793
|
{
|
|
4575
1794
|
path: "",
|
|
4576
|
-
lazy: () => import("./shipping-option-type-list-
|
|
1795
|
+
lazy: () => import("./shipping-option-type-list-2XUYXURQ.js"),
|
|
4577
1796
|
children: [
|
|
4578
1797
|
{
|
|
4579
1798
|
path: "create",
|
|
@@ -4585,19 +1804,19 @@ function getRouteMap({
|
|
|
4585
1804
|
{
|
|
4586
1805
|
path: ":id",
|
|
4587
1806
|
lazy: async () => {
|
|
4588
|
-
const { Breadcrumb, loader } = await import("./shipping-option-type-detail-
|
|
1807
|
+
const { Breadcrumb, loader } = await import("./shipping-option-type-detail-2VDQWYDS.js");
|
|
4589
1808
|
return {
|
|
4590
|
-
Component:
|
|
1809
|
+
Component: Outlet3,
|
|
4591
1810
|
loader,
|
|
4592
1811
|
handle: {
|
|
4593
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1812
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4594
1813
|
}
|
|
4595
1814
|
};
|
|
4596
1815
|
},
|
|
4597
1816
|
children: [
|
|
4598
1817
|
{
|
|
4599
1818
|
path: "",
|
|
4600
|
-
lazy: () => import("./shipping-option-type-detail-
|
|
1819
|
+
lazy: () => import("./shipping-option-type-detail-2VDQWYDS.js"),
|
|
4601
1820
|
children: [
|
|
4602
1821
|
{
|
|
4603
1822
|
path: "edit",
|
|
@@ -4613,19 +1832,19 @@ function getRouteMap({
|
|
|
4613
1832
|
{
|
|
4614
1833
|
path: ":location_id",
|
|
4615
1834
|
lazy: async () => {
|
|
4616
|
-
const { Breadcrumb, loader } = await import("./location-detail-
|
|
1835
|
+
const { Breadcrumb, loader } = await import("./location-detail-DKBNATDD.js");
|
|
4617
1836
|
return {
|
|
4618
|
-
Component:
|
|
1837
|
+
Component: Outlet3,
|
|
4619
1838
|
loader,
|
|
4620
1839
|
handle: {
|
|
4621
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1840
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4622
1841
|
}
|
|
4623
1842
|
};
|
|
4624
1843
|
},
|
|
4625
1844
|
children: [
|
|
4626
1845
|
{
|
|
4627
1846
|
path: "",
|
|
4628
|
-
lazy: () => import("./location-detail-
|
|
1847
|
+
lazy: () => import("./location-detail-DKBNATDD.js"),
|
|
4629
1848
|
children: [
|
|
4630
1849
|
{
|
|
4631
1850
|
path: "edit",
|
|
@@ -4634,7 +1853,7 @@ function getRouteMap({
|
|
|
4634
1853
|
},
|
|
4635
1854
|
{
|
|
4636
1855
|
path: "sales-channels",
|
|
4637
|
-
lazy: () => import("./location-sales-channels-
|
|
1856
|
+
lazy: () => import("./location-sales-channels-FT6TFVXJ.js")
|
|
4638
1857
|
},
|
|
4639
1858
|
{
|
|
4640
1859
|
path: "fulfillment-providers",
|
|
@@ -4695,8 +1914,8 @@ function getRouteMap({
|
|
|
4695
1914
|
},
|
|
4696
1915
|
{
|
|
4697
1916
|
path: "product-tags",
|
|
4698
|
-
errorElement: /* @__PURE__ */
|
|
4699
|
-
element: /* @__PURE__ */
|
|
1917
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1918
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4700
1919
|
handle: {
|
|
4701
1920
|
breadcrumb: () => t("productTags.domain"),
|
|
4702
1921
|
permissions: "product_tags:view"
|
|
@@ -4704,7 +1923,7 @@ function getRouteMap({
|
|
|
4704
1923
|
children: [
|
|
4705
1924
|
{
|
|
4706
1925
|
path: "",
|
|
4707
|
-
lazy: () => import("./product-tag-list-
|
|
1926
|
+
lazy: () => import("./product-tag-list-BNNJS67H.js"),
|
|
4708
1927
|
children: [
|
|
4709
1928
|
{
|
|
4710
1929
|
path: "create",
|
|
@@ -4716,19 +1935,19 @@ function getRouteMap({
|
|
|
4716
1935
|
{
|
|
4717
1936
|
path: ":id",
|
|
4718
1937
|
lazy: async () => {
|
|
4719
|
-
const { Breadcrumb, loader } = await import("./product-tag-detail-
|
|
1938
|
+
const { Breadcrumb, loader } = await import("./product-tag-detail-Q3CKJBVX.js");
|
|
4720
1939
|
return {
|
|
4721
|
-
Component:
|
|
1940
|
+
Component: Outlet3,
|
|
4722
1941
|
loader,
|
|
4723
1942
|
handle: {
|
|
4724
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1943
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4725
1944
|
}
|
|
4726
1945
|
};
|
|
4727
1946
|
},
|
|
4728
1947
|
children: [
|
|
4729
1948
|
{
|
|
4730
1949
|
path: "",
|
|
4731
|
-
lazy: () => import("./product-tag-detail-
|
|
1950
|
+
lazy: () => import("./product-tag-detail-Q3CKJBVX.js"),
|
|
4732
1951
|
children: [
|
|
4733
1952
|
{
|
|
4734
1953
|
path: "edit",
|
|
@@ -4747,8 +1966,8 @@ function getRouteMap({
|
|
|
4747
1966
|
},
|
|
4748
1967
|
{
|
|
4749
1968
|
path: "attributes",
|
|
4750
|
-
errorElement: /* @__PURE__ */
|
|
4751
|
-
element: /* @__PURE__ */
|
|
1969
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
1970
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4752
1971
|
handle: {
|
|
4753
1972
|
breadcrumb: () => t("attributes.domain"),
|
|
4754
1973
|
permissions: "product_attributes:view"
|
|
@@ -4768,19 +1987,19 @@ function getRouteMap({
|
|
|
4768
1987
|
{
|
|
4769
1988
|
path: ":id",
|
|
4770
1989
|
lazy: async () => {
|
|
4771
|
-
const { Breadcrumb, loader } = await import("./attribute-detail-
|
|
1990
|
+
const { Breadcrumb, loader } = await import("./attribute-detail-7PIMBKEE.js");
|
|
4772
1991
|
return {
|
|
4773
|
-
Component:
|
|
1992
|
+
Component: Outlet3,
|
|
4774
1993
|
loader,
|
|
4775
1994
|
handle: {
|
|
4776
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
1995
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4777
1996
|
}
|
|
4778
1997
|
};
|
|
4779
1998
|
},
|
|
4780
1999
|
children: [
|
|
4781
2000
|
{
|
|
4782
2001
|
path: "",
|
|
4783
|
-
lazy: () => import("./attribute-detail-
|
|
2002
|
+
lazy: () => import("./attribute-detail-7PIMBKEE.js"),
|
|
4784
2003
|
children: [
|
|
4785
2004
|
{
|
|
4786
2005
|
path: "edit",
|
|
@@ -4807,8 +2026,8 @@ function getRouteMap({
|
|
|
4807
2026
|
},
|
|
4808
2027
|
{
|
|
4809
2028
|
path: "product-types",
|
|
4810
|
-
errorElement: /* @__PURE__ */
|
|
4811
|
-
element: /* @__PURE__ */
|
|
2029
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
2030
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4812
2031
|
handle: {
|
|
4813
2032
|
breadcrumb: () => t("productTypes.domain"),
|
|
4814
2033
|
permissions: "product_types:view"
|
|
@@ -4816,7 +2035,7 @@ function getRouteMap({
|
|
|
4816
2035
|
children: [
|
|
4817
2036
|
{
|
|
4818
2037
|
path: "",
|
|
4819
|
-
lazy: () => import("./product-type-list-
|
|
2038
|
+
lazy: () => import("./product-type-list-PAAE6ZSR.js"),
|
|
4820
2039
|
children: [
|
|
4821
2040
|
{
|
|
4822
2041
|
path: "create",
|
|
@@ -4828,19 +2047,19 @@ function getRouteMap({
|
|
|
4828
2047
|
{
|
|
4829
2048
|
path: ":id",
|
|
4830
2049
|
lazy: async () => {
|
|
4831
|
-
const { Breadcrumb, loader } = await import("./product-type-detail-
|
|
2050
|
+
const { Breadcrumb, loader } = await import("./product-type-detail-WZLA27WI.js");
|
|
4832
2051
|
return {
|
|
4833
|
-
Component:
|
|
2052
|
+
Component: Outlet3,
|
|
4834
2053
|
loader,
|
|
4835
2054
|
handle: {
|
|
4836
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
2055
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4837
2056
|
}
|
|
4838
2057
|
};
|
|
4839
2058
|
},
|
|
4840
2059
|
children: [
|
|
4841
2060
|
{
|
|
4842
2061
|
path: "",
|
|
4843
|
-
lazy: () => import("./product-type-detail-
|
|
2062
|
+
lazy: () => import("./product-type-detail-WZLA27WI.js"),
|
|
4844
2063
|
children: [
|
|
4845
2064
|
{
|
|
4846
2065
|
path: "edit",
|
|
@@ -4859,7 +2078,7 @@ function getRouteMap({
|
|
|
4859
2078
|
},
|
|
4860
2079
|
{
|
|
4861
2080
|
path: "publishable-api-keys",
|
|
4862
|
-
element: /* @__PURE__ */
|
|
2081
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4863
2082
|
handle: {
|
|
4864
2083
|
breadcrumb: () => t("apiKeyManagement.domain.publishable"),
|
|
4865
2084
|
permissions: "api_keys:view"
|
|
@@ -4867,11 +2086,11 @@ function getRouteMap({
|
|
|
4867
2086
|
children: [
|
|
4868
2087
|
{
|
|
4869
2088
|
path: "",
|
|
4870
|
-
element: /* @__PURE__ */
|
|
2089
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4871
2090
|
children: [
|
|
4872
2091
|
{
|
|
4873
2092
|
path: "",
|
|
4874
|
-
lazy: () => import("./api-key-management-list-
|
|
2093
|
+
lazy: () => import("./api-key-management-list-KPWCB7NX.js"),
|
|
4875
2094
|
children: [
|
|
4876
2095
|
{
|
|
4877
2096
|
path: "create",
|
|
@@ -4885,19 +2104,19 @@ function getRouteMap({
|
|
|
4885
2104
|
{
|
|
4886
2105
|
path: ":id",
|
|
4887
2106
|
lazy: async () => {
|
|
4888
|
-
const { Breadcrumb, loader } = await import("./api-key-management-detail-
|
|
2107
|
+
const { Breadcrumb, loader } = await import("./api-key-management-detail-ULNXV7YJ.js");
|
|
4889
2108
|
return {
|
|
4890
|
-
Component:
|
|
2109
|
+
Component: Outlet3,
|
|
4891
2110
|
loader,
|
|
4892
2111
|
handle: {
|
|
4893
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
2112
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4894
2113
|
}
|
|
4895
2114
|
};
|
|
4896
2115
|
},
|
|
4897
2116
|
children: [
|
|
4898
2117
|
{
|
|
4899
2118
|
path: "",
|
|
4900
|
-
lazy: () => import("./api-key-management-detail-
|
|
2119
|
+
lazy: () => import("./api-key-management-detail-ULNXV7YJ.js"),
|
|
4901
2120
|
children: [
|
|
4902
2121
|
{
|
|
4903
2122
|
path: "edit",
|
|
@@ -4906,7 +2125,7 @@ function getRouteMap({
|
|
|
4906
2125
|
},
|
|
4907
2126
|
{
|
|
4908
2127
|
path: "sales-channels",
|
|
4909
|
-
lazy: () => import("./api-key-management-sales-channels-
|
|
2128
|
+
lazy: () => import("./api-key-management-sales-channels-RBK66ZGC.js")
|
|
4910
2129
|
}
|
|
4911
2130
|
]
|
|
4912
2131
|
}
|
|
@@ -4916,7 +2135,7 @@ function getRouteMap({
|
|
|
4916
2135
|
},
|
|
4917
2136
|
{
|
|
4918
2137
|
path: "secret-api-keys",
|
|
4919
|
-
element: /* @__PURE__ */
|
|
2138
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4920
2139
|
handle: {
|
|
4921
2140
|
breadcrumb: () => t("apiKeyManagement.domain.secret"),
|
|
4922
2141
|
permissions: "api_keys:view"
|
|
@@ -4924,11 +2143,11 @@ function getRouteMap({
|
|
|
4924
2143
|
children: [
|
|
4925
2144
|
{
|
|
4926
2145
|
path: "",
|
|
4927
|
-
element: /* @__PURE__ */
|
|
2146
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4928
2147
|
children: [
|
|
4929
2148
|
{
|
|
4930
2149
|
path: "",
|
|
4931
|
-
lazy: () => import("./api-key-management-list-
|
|
2150
|
+
lazy: () => import("./api-key-management-list-KPWCB7NX.js"),
|
|
4932
2151
|
children: [
|
|
4933
2152
|
{
|
|
4934
2153
|
path: "create",
|
|
@@ -4942,19 +2161,19 @@ function getRouteMap({
|
|
|
4942
2161
|
{
|
|
4943
2162
|
path: ":id",
|
|
4944
2163
|
lazy: async () => {
|
|
4945
|
-
const { Breadcrumb, loader } = await import("./api-key-management-detail-
|
|
2164
|
+
const { Breadcrumb, loader } = await import("./api-key-management-detail-ULNXV7YJ.js");
|
|
4946
2165
|
return {
|
|
4947
|
-
Component:
|
|
2166
|
+
Component: Outlet3,
|
|
4948
2167
|
loader,
|
|
4949
2168
|
handle: {
|
|
4950
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
2169
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
4951
2170
|
}
|
|
4952
2171
|
};
|
|
4953
2172
|
},
|
|
4954
2173
|
children: [
|
|
4955
2174
|
{
|
|
4956
2175
|
path: "",
|
|
4957
|
-
lazy: () => import("./api-key-management-detail-
|
|
2176
|
+
lazy: () => import("./api-key-management-detail-ULNXV7YJ.js"),
|
|
4958
2177
|
children: [
|
|
4959
2178
|
{
|
|
4960
2179
|
path: "edit",
|
|
@@ -4969,7 +2188,7 @@ function getRouteMap({
|
|
|
4969
2188
|
},
|
|
4970
2189
|
{
|
|
4971
2190
|
path: "tax-regions",
|
|
4972
|
-
element: /* @__PURE__ */
|
|
2191
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
4973
2192
|
handle: {
|
|
4974
2193
|
breadcrumb: () => t("taxRegions.domain"),
|
|
4975
2194
|
permissions: "tax_regions:view"
|
|
@@ -4977,7 +2196,7 @@ function getRouteMap({
|
|
|
4977
2196
|
children: [
|
|
4978
2197
|
{
|
|
4979
2198
|
path: "",
|
|
4980
|
-
lazy: () => import("./tax-region-list-
|
|
2199
|
+
lazy: () => import("./tax-region-list-U5JRCQZI.js"),
|
|
4981
2200
|
children: [
|
|
4982
2201
|
{
|
|
4983
2202
|
path: "create",
|
|
@@ -4988,16 +2207,16 @@ function getRouteMap({
|
|
|
4988
2207
|
},
|
|
4989
2208
|
{
|
|
4990
2209
|
path: ":id",
|
|
4991
|
-
Component:
|
|
2210
|
+
Component: Outlet3,
|
|
4992
2211
|
loader: taxRegionLoader,
|
|
4993
2212
|
handle: {
|
|
4994
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
2213
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(TaxRegionDetailBreadcrumb, { ...match })
|
|
4995
2214
|
},
|
|
4996
2215
|
children: [
|
|
4997
2216
|
{
|
|
4998
2217
|
path: "",
|
|
4999
2218
|
lazy: async () => {
|
|
5000
|
-
const { Component } = await import("./tax-region-detail-
|
|
2219
|
+
const { Component } = await import("./tax-region-detail-3CMIPIKA.js");
|
|
5001
2220
|
return {
|
|
5002
2221
|
Component
|
|
5003
2222
|
};
|
|
@@ -5037,19 +2256,19 @@ function getRouteMap({
|
|
|
5037
2256
|
{
|
|
5038
2257
|
path: "provinces/:province_id",
|
|
5039
2258
|
lazy: async () => {
|
|
5040
|
-
const { Breadcrumb, loader } = await import("./tax-region-province-detail-
|
|
2259
|
+
const { Breadcrumb, loader } = await import("./tax-region-province-detail-XTPJ6DZZ.js");
|
|
5041
2260
|
return {
|
|
5042
|
-
Component:
|
|
2261
|
+
Component: Outlet3,
|
|
5043
2262
|
loader,
|
|
5044
2263
|
handle: {
|
|
5045
|
-
breadcrumb: (match) => /* @__PURE__ */
|
|
2264
|
+
breadcrumb: (match) => /* @__PURE__ */ jsx5(Breadcrumb, { ...match })
|
|
5046
2265
|
}
|
|
5047
2266
|
};
|
|
5048
2267
|
},
|
|
5049
2268
|
children: [
|
|
5050
2269
|
{
|
|
5051
2270
|
path: "",
|
|
5052
|
-
lazy: () => import("./tax-region-province-detail-
|
|
2271
|
+
lazy: () => import("./tax-region-province-detail-XTPJ6DZZ.js"),
|
|
5053
2272
|
children: [
|
|
5054
2273
|
{
|
|
5055
2274
|
path: "tax-rates/create",
|
|
@@ -5077,7 +2296,7 @@ function getRouteMap({
|
|
|
5077
2296
|
},
|
|
5078
2297
|
{
|
|
5079
2298
|
path: "return-reasons",
|
|
5080
|
-
element: /* @__PURE__ */
|
|
2299
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
5081
2300
|
handle: {
|
|
5082
2301
|
breadcrumb: () => t("returnReasons.domain"),
|
|
5083
2302
|
permissions: "return_reasons:view"
|
|
@@ -5108,7 +2327,7 @@ function getRouteMap({
|
|
|
5108
2327
|
},
|
|
5109
2328
|
{
|
|
5110
2329
|
path: "refund-reasons",
|
|
5111
|
-
element: /* @__PURE__ */
|
|
2330
|
+
element: /* @__PURE__ */ jsx5(Outlet3, {}),
|
|
5112
2331
|
handle: {
|
|
5113
2332
|
breadcrumb: () => t("refundReasons.domain"),
|
|
5114
2333
|
permissions: "refund_reasons:view"
|
|
@@ -5116,7 +2335,7 @@ function getRouteMap({
|
|
|
5116
2335
|
children: [
|
|
5117
2336
|
{
|
|
5118
2337
|
path: "",
|
|
5119
|
-
lazy: () => import("./refund-reason-list-
|
|
2338
|
+
lazy: () => import("./refund-reason-list-3YLXKHJX.js"),
|
|
5120
2339
|
children: [
|
|
5121
2340
|
{
|
|
5122
2341
|
path: "create",
|
|
@@ -5146,14 +2365,14 @@ function getRouteMap({
|
|
|
5146
2365
|
]
|
|
5147
2366
|
},
|
|
5148
2367
|
{
|
|
5149
|
-
element: /* @__PURE__ */
|
|
2368
|
+
element: /* @__PURE__ */ jsx5(PublicLayout, {}),
|
|
5150
2369
|
children: [
|
|
5151
2370
|
{
|
|
5152
|
-
errorElement: /* @__PURE__ */
|
|
2371
|
+
errorElement: /* @__PURE__ */ jsx5(ErrorBoundary, {}),
|
|
5153
2372
|
children: [
|
|
5154
2373
|
{
|
|
5155
2374
|
path: "/login",
|
|
5156
|
-
lazy: () => import("./login-
|
|
2375
|
+
lazy: () => import("./login-72TAMW53.js")
|
|
5157
2376
|
},
|
|
5158
2377
|
{
|
|
5159
2378
|
path: "/reset-password",
|
|
@@ -5161,7 +2380,7 @@ function getRouteMap({
|
|
|
5161
2380
|
},
|
|
5162
2381
|
{
|
|
5163
2382
|
path: "/invite",
|
|
5164
|
-
lazy: () => import("./invite-
|
|
2383
|
+
lazy: () => import("./invite-IZ2YTVPF.js")
|
|
5165
2384
|
},
|
|
5166
2385
|
...customPublicRoutes,
|
|
5167
2386
|
{
|
|
@@ -5176,25 +2395,25 @@ function getRouteMap({
|
|
|
5176
2395
|
}
|
|
5177
2396
|
|
|
5178
2397
|
// src/app.tsx
|
|
5179
|
-
import { useMemo as
|
|
5180
|
-
import { jsx as
|
|
2398
|
+
import { useMemo as useMemo3 } from "react";
|
|
2399
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5181
2400
|
function App() {
|
|
5182
|
-
const routes =
|
|
2401
|
+
const routes = useMemo3(() => {
|
|
5183
2402
|
return {
|
|
5184
2403
|
settingsRoutes: createRouteMap(getRoutesByType(customRoutes, "settings")),
|
|
5185
2404
|
mainRoutes: createRouteMap(getRoutesByType(customRoutes, "main")),
|
|
5186
2405
|
publicRoutes: createRouteMap(getRoutesByType(customRoutes, "public"))
|
|
5187
2406
|
};
|
|
5188
2407
|
}, []);
|
|
5189
|
-
return /* @__PURE__ */
|
|
2408
|
+
return /* @__PURE__ */ jsx6(TooltipProvider, { children: /* @__PURE__ */ jsx6(HelmetProvider, { children: /* @__PURE__ */ jsx6(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx6(ThemeProvider, { children: /* @__PURE__ */ jsx6(FeatureFlagProvider, { children: /* @__PURE__ */ jsxs2(
|
|
5190
2409
|
ExtensionProvider,
|
|
5191
2410
|
{
|
|
5192
2411
|
widgets,
|
|
5193
2412
|
navigation,
|
|
5194
2413
|
customFields,
|
|
5195
2414
|
children: [
|
|
5196
|
-
/* @__PURE__ */
|
|
5197
|
-
/* @__PURE__ */
|
|
2415
|
+
/* @__PURE__ */ jsx6(I18n, {}),
|
|
2416
|
+
/* @__PURE__ */ jsx6(I18nProvider, { children: /* @__PURE__ */ jsx6(
|
|
5198
2417
|
RouterProvider,
|
|
5199
2418
|
{
|
|
5200
2419
|
router: createBrowserRouter(getRouteMap(routes), {
|
|
@@ -5202,7 +2421,7 @@ function App() {
|
|
|
5202
2421
|
})
|
|
5203
2422
|
}
|
|
5204
2423
|
) }),
|
|
5205
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ jsx6(Toaster, {})
|
|
5206
2425
|
]
|
|
5207
2426
|
}
|
|
5208
2427
|
) }) }) }) }) });
|
|
@@ -5213,7 +2432,7 @@ import {
|
|
|
5213
2432
|
PermissionGuard,
|
|
5214
2433
|
PermissionsProvider as PermissionsProvider2,
|
|
5215
2434
|
RoutePermissionGuard as RoutePermissionGuard2,
|
|
5216
|
-
usePermissions as
|
|
2435
|
+
usePermissions as usePermissions2,
|
|
5217
2436
|
useResourcePermissions
|
|
5218
2437
|
} from "@mercurjs/dashboard-shared";
|
|
5219
2438
|
export {
|
|
@@ -5233,7 +2452,7 @@ export {
|
|
|
5233
2452
|
App as default,
|
|
5234
2453
|
defineTabMeta,
|
|
5235
2454
|
useDataTable,
|
|
5236
|
-
|
|
2455
|
+
usePermissions2 as usePermissions,
|
|
5237
2456
|
useResourcePermissions,
|
|
5238
2457
|
useTabbedForm
|
|
5239
2458
|
};
|