@mercurjs/admin 2.3.6-canary.8 → 2.3.6-canary.9
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.
|
@@ -98,7 +98,12 @@ var storeDetailLoader = async ({ params }) => {
|
|
|
98
98
|
import { Children as Children3, useState as useState3 } from "react";
|
|
99
99
|
import { useParams } from "react-router-dom";
|
|
100
100
|
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
101
|
-
import {
|
|
101
|
+
import {
|
|
102
|
+
WidgetZone,
|
|
103
|
+
useLinkQuery,
|
|
104
|
+
usePermissions,
|
|
105
|
+
useWidgetTabs
|
|
106
|
+
} from "@mercurjs/dashboard-shared";
|
|
102
107
|
var import_types3 = __toESM(require_dist(), 1);
|
|
103
108
|
|
|
104
109
|
// src/pages/stores/store-details/components/store-general-section.tsx
|
|
@@ -1144,19 +1149,12 @@ var StoreOffersSection = ({ sellerId }) => {
|
|
|
1144
1149
|
|
|
1145
1150
|
// src/pages/stores/store-details/components/store-details.tsx
|
|
1146
1151
|
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1147
|
-
var TABS = ["orders", "offers", "users", "timeOff"];
|
|
1148
1152
|
var TabBar = ({
|
|
1149
1153
|
tabs,
|
|
1150
1154
|
activeTab,
|
|
1151
1155
|
onTabChange
|
|
1152
1156
|
}) => {
|
|
1153
1157
|
const { t } = useTranslation12();
|
|
1154
|
-
const labels = {
|
|
1155
|
-
orders: t("orders.domain"),
|
|
1156
|
-
users: t("users.domain"),
|
|
1157
|
-
offers: t("offers.domain"),
|
|
1158
|
-
timeOff: t("store.timeOff.header")
|
|
1159
|
-
};
|
|
1160
1158
|
return /* @__PURE__ */ jsx12(
|
|
1161
1159
|
"div",
|
|
1162
1160
|
{
|
|
@@ -1164,22 +1162,22 @@ var TabBar = ({
|
|
|
1164
1162
|
"aria-label": t("stores.domain"),
|
|
1165
1163
|
className: "mt-1 flex flex-wrap items-center gap-x-2",
|
|
1166
1164
|
"data-testid": "store-detail-tabs",
|
|
1167
|
-
children: tabs.map((
|
|
1168
|
-
const isActive = activeTab ===
|
|
1165
|
+
children: tabs.map(({ id, label }) => {
|
|
1166
|
+
const isActive = activeTab === id;
|
|
1169
1167
|
return /* @__PURE__ */ jsx12(
|
|
1170
1168
|
"button",
|
|
1171
1169
|
{
|
|
1172
1170
|
type: "button",
|
|
1173
|
-
onClick: () => onTabChange(
|
|
1171
|
+
onClick: () => onTabChange(id),
|
|
1174
1172
|
role: "tab",
|
|
1175
1173
|
"aria-selected": isActive,
|
|
1176
|
-
"aria-controls": `store-detail-tab-panel-${
|
|
1177
|
-
id: `store-detail-tab-${
|
|
1178
|
-
"data-testid": `store-detail-tab-${
|
|
1174
|
+
"aria-controls": `store-detail-tab-panel-${id}`,
|
|
1175
|
+
id: `store-detail-tab-${id}`,
|
|
1176
|
+
"data-testid": `store-detail-tab-${id}`,
|
|
1179
1177
|
className: `txt-compact-small-plus rounded-full px-3 py-1.5 transition-colors ${isActive ? "border-ui-border-base bg-ui-bg-base shadow-borders-base text-ui-fg-base" : "text-ui-fg-subtle hover:text-ui-fg-base"}`,
|
|
1180
|
-
children:
|
|
1178
|
+
children: label
|
|
1181
1179
|
},
|
|
1182
|
-
|
|
1180
|
+
id
|
|
1183
1181
|
);
|
|
1184
1182
|
})
|
|
1185
1183
|
}
|
|
@@ -1187,21 +1185,10 @@ var TabBar = ({
|
|
|
1187
1185
|
};
|
|
1188
1186
|
var Root = ({ children }) => {
|
|
1189
1187
|
const { id } = useParams();
|
|
1188
|
+
const { t } = useTranslation12();
|
|
1190
1189
|
const [selectedTab, setActiveTab] = useState3("orders");
|
|
1191
1190
|
const { can } = usePermissions();
|
|
1192
|
-
const
|
|
1193
|
-
if (tab === "orders") {
|
|
1194
|
-
return can("orders");
|
|
1195
|
-
}
|
|
1196
|
-
if (tab === "offers") {
|
|
1197
|
-
return can("offers");
|
|
1198
|
-
}
|
|
1199
|
-
if (tab === "users") {
|
|
1200
|
-
return can("members");
|
|
1201
|
-
}
|
|
1202
|
-
return true;
|
|
1203
|
-
});
|
|
1204
|
-
const activeTab = tabs.includes(selectedTab) ? selectedTab : tabs[0];
|
|
1191
|
+
const customTabs = useWidgetTabs("stores.detail.tabs");
|
|
1205
1192
|
const query = useLinkQuery("seller", STORE_DETAIL_FIELDS);
|
|
1206
1193
|
const { seller, isLoading, isError, error } = useSeller(id, query);
|
|
1207
1194
|
if (isLoading || !seller) {
|
|
@@ -1213,46 +1200,56 @@ var Root = ({ children }) => {
|
|
|
1213
1200
|
if (Children3.count(children) > 0) {
|
|
1214
1201
|
return /* @__PURE__ */ jsx12(TwoColumnPage, { data: seller, hasOutlet: true, "data-testid": "store-detail-page", children });
|
|
1215
1202
|
}
|
|
1203
|
+
const toTab = ({ id: id2, label, Component }) => ({
|
|
1204
|
+
id: id2,
|
|
1205
|
+
label: t(label, { defaultValue: label }),
|
|
1206
|
+
content: /* @__PURE__ */ jsx12(Component, { data: seller })
|
|
1207
|
+
});
|
|
1208
|
+
const tabs = [
|
|
1209
|
+
...customTabs.before.map(toTab),
|
|
1210
|
+
...can("orders") ? [
|
|
1211
|
+
{
|
|
1212
|
+
id: "orders",
|
|
1213
|
+
label: t("orders.domain"),
|
|
1214
|
+
content: /* @__PURE__ */ jsx12(StoreOrdersSection, { sellerId: seller.id })
|
|
1215
|
+
}
|
|
1216
|
+
] : [],
|
|
1217
|
+
...can("offers") ? [
|
|
1218
|
+
{
|
|
1219
|
+
id: "offers",
|
|
1220
|
+
label: t("offers.domain"),
|
|
1221
|
+
content: /* @__PURE__ */ jsx12(StoreOffersSection, { sellerId: seller.id })
|
|
1222
|
+
}
|
|
1223
|
+
] : [],
|
|
1224
|
+
...can("members") ? [
|
|
1225
|
+
{
|
|
1226
|
+
id: "users",
|
|
1227
|
+
label: t("users.domain"),
|
|
1228
|
+
content: /* @__PURE__ */ jsx12(StoreMembersSection, { sellerId: seller.id })
|
|
1229
|
+
}
|
|
1230
|
+
] : [],
|
|
1231
|
+
{
|
|
1232
|
+
id: "timeOff",
|
|
1233
|
+
label: t("store.timeOff.header"),
|
|
1234
|
+
content: /* @__PURE__ */ jsx12(StoreConfigurationSection, { seller })
|
|
1235
|
+
},
|
|
1236
|
+
...customTabs.after.map(toTab)
|
|
1237
|
+
];
|
|
1238
|
+
const activeTab = tabs.find((tab) => tab.id === selectedTab) ?? tabs[0];
|
|
1216
1239
|
return /* @__PURE__ */ jsxs12(TwoColumnPage, { data: seller, hasOutlet: true, "data-testid": "store-detail-page", children: [
|
|
1217
1240
|
/* @__PURE__ */ jsx12(TwoColumnPage.Main, { children: /* @__PURE__ */ jsxs12(WidgetZone, { id: "stores.detail.main", data: seller, children: [
|
|
1218
1241
|
seller.status === import_types3.SellerStatus.PENDING_APPROVAL && !seller.approved_at && !seller.rejected_at && /* @__PURE__ */ jsx12(StoreRequestSection, { seller }),
|
|
1219
1242
|
/* @__PURE__ */ jsx12(StoreGeneralSection, { seller }),
|
|
1220
|
-
/* @__PURE__ */ jsx12(TabBar, { tabs, activeTab, onTabChange: setActiveTab }),
|
|
1221
|
-
|
|
1243
|
+
/* @__PURE__ */ jsx12(TabBar, { tabs, activeTab: activeTab.id, onTabChange: setActiveTab }),
|
|
1244
|
+
/* @__PURE__ */ jsx12(
|
|
1222
1245
|
"div",
|
|
1223
1246
|
{
|
|
1224
1247
|
role: "tabpanel",
|
|
1225
|
-
id:
|
|
1226
|
-
"aria-labelledby":
|
|
1227
|
-
children:
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
activeTab === "users" && /* @__PURE__ */ jsx12(
|
|
1231
|
-
"div",
|
|
1232
|
-
{
|
|
1233
|
-
role: "tabpanel",
|
|
1234
|
-
id: "store-detail-tab-panel-users",
|
|
1235
|
-
"aria-labelledby": "store-detail-tab-users",
|
|
1236
|
-
children: /* @__PURE__ */ jsx12(StoreMembersSection, { sellerId: seller.id })
|
|
1237
|
-
}
|
|
1238
|
-
),
|
|
1239
|
-
activeTab === "offers" && /* @__PURE__ */ jsx12(
|
|
1240
|
-
"div",
|
|
1241
|
-
{
|
|
1242
|
-
role: "tabpanel",
|
|
1243
|
-
id: "store-detail-tab-panel-offers",
|
|
1244
|
-
"aria-labelledby": "store-detail-tab-offers",
|
|
1245
|
-
children: /* @__PURE__ */ jsx12(StoreOffersSection, { sellerId: seller.id })
|
|
1246
|
-
}
|
|
1247
|
-
),
|
|
1248
|
-
activeTab === "timeOff" && /* @__PURE__ */ jsx12(
|
|
1249
|
-
"div",
|
|
1250
|
-
{
|
|
1251
|
-
role: "tabpanel",
|
|
1252
|
-
id: "store-detail-tab-panel-timeOff",
|
|
1253
|
-
"aria-labelledby": "store-detail-tab-timeOff",
|
|
1254
|
-
children: /* @__PURE__ */ jsx12(StoreConfigurationSection, { seller })
|
|
1255
|
-
}
|
|
1248
|
+
id: `store-detail-tab-panel-${activeTab.id}`,
|
|
1249
|
+
"aria-labelledby": `store-detail-tab-${activeTab.id}`,
|
|
1250
|
+
children: activeTab.content
|
|
1251
|
+
},
|
|
1252
|
+
activeTab.id
|
|
1256
1253
|
)
|
|
1257
1254
|
] }) }),
|
|
1258
1255
|
/* @__PURE__ */ jsx12(TwoColumnPage.Sidebar, { children: /* @__PURE__ */ jsxs12(WidgetZone, { id: "stores.detail.side", data: seller, children: [
|
|
@@ -140,6 +140,8 @@ declare module "@mercurjs/dashboard-sdk" {
|
|
|
140
140
|
"stores.detail.main.before": true
|
|
141
141
|
"stores.detail.side.after": true
|
|
142
142
|
"stores.detail.side.before": true
|
|
143
|
+
"stores.detail.tabs.after": true
|
|
144
|
+
"stores.detail.tabs.before": true
|
|
143
145
|
"stores.list.after": true
|
|
144
146
|
"stores.list.before": true
|
|
145
147
|
"tax-regions.detail.main.after": true
|
package/dist/index.js
CHANGED
|
@@ -1011,7 +1011,7 @@ function getRouteMap({
|
|
|
1011
1011
|
{
|
|
1012
1012
|
path: ":id",
|
|
1013
1013
|
lazy: async () => {
|
|
1014
|
-
const { Breadcrumb } = await import("./store-details-
|
|
1014
|
+
const { Breadcrumb } = await import("./store-details-P2P54QUC.js");
|
|
1015
1015
|
return {
|
|
1016
1016
|
Component: Outlet3,
|
|
1017
1017
|
handle: {
|
|
@@ -1022,7 +1022,7 @@ function getRouteMap({
|
|
|
1022
1022
|
children: [
|
|
1023
1023
|
{
|
|
1024
1024
|
path: "",
|
|
1025
|
-
lazy: () => import("./store-details-
|
|
1025
|
+
lazy: () => import("./store-details-P2P54QUC.js").then(withLoaderPermission("sellers:view")),
|
|
1026
1026
|
children: [
|
|
1027
1027
|
{
|
|
1028
1028
|
path: "edit",
|
package/dist/pages/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercurjs/admin",
|
|
3
|
-
"version": "2.3.6-canary.
|
|
3
|
+
"version": "2.3.6-canary.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"lint": "oxlint --max-warnings 0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@mercurjs/dashboard-shared": "2.3.6-canary.
|
|
38
|
-
"@mercurjs/client": "2.3.6-canary.
|
|
37
|
+
"@mercurjs/dashboard-shared": "2.3.6-canary.9",
|
|
38
|
+
"@mercurjs/client": "2.3.6-canary.9",
|
|
39
39
|
"@ariakit/react": "^0.4.15",
|
|
40
40
|
"@babel/runtime": "^8.0.0",
|
|
41
41
|
"@dnd-kit/core": "^6.1.0",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"tsup": "^8.0.2",
|
|
89
89
|
"typescript": "5.9.3",
|
|
90
90
|
"@medusajs/types": "2.21.0",
|
|
91
|
-
"@mercurjs/core": "2.3.6-canary.
|
|
92
|
-
"@mercurjs/dashboard-sdk": "2.3.6-canary.
|
|
93
|
-
"@mercurjs/types": "2.3.6-canary.
|
|
91
|
+
"@mercurjs/core": "2.3.6-canary.9",
|
|
92
|
+
"@mercurjs/dashboard-sdk": "2.3.6-canary.9",
|
|
93
|
+
"@mercurjs/types": "2.3.6-canary.9",
|
|
94
94
|
"react-router-dom": "7.18.1"
|
|
95
95
|
}
|
|
96
96
|
}
|