@contractspec/example.marketplace 3.7.6 → 3.8.2
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/README.md +64 -131
- package/dist/browser/entities/index.js +470 -470
- package/dist/browser/index.js +1257 -1019
- package/dist/browser/marketplace.feature.js +175 -0
- package/dist/browser/order/index.js +155 -155
- package/dist/browser/order/order.event.js +1 -1
- package/dist/browser/payout/index.js +71 -71
- package/dist/browser/payout/payout.event.js +1 -1
- package/dist/browser/product/index.js +104 -104
- package/dist/browser/product/product.event.js +1 -1
- package/dist/browser/review/index.js +75 -75
- package/dist/browser/review/review.event.js +1 -1
- package/dist/browser/store/index.js +68 -68
- package/dist/browser/store/store.event.js +1 -1
- package/dist/browser/ui/MarketplaceDashboard.js +328 -110
- package/dist/browser/ui/MarketplaceDashboard.visualizations.js +216 -0
- package/dist/browser/ui/hooks/index.js +1 -1
- package/dist/browser/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/browser/ui/index.js +590 -359
- package/dist/browser/ui/renderers/index.js +190 -4
- package/dist/browser/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/browser/visualizations/catalog.js +126 -0
- package/dist/browser/visualizations/index.js +183 -0
- package/dist/browser/visualizations/selectors.js +177 -0
- package/dist/entities/index.d.ts +110 -110
- package/dist/entities/index.js +470 -470
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1257 -1019
- package/dist/marketplace.feature.js +175 -0
- package/dist/node/entities/index.js +470 -470
- package/dist/node/index.js +1257 -1019
- package/dist/node/marketplace.feature.js +175 -0
- package/dist/node/order/index.js +155 -155
- package/dist/node/order/order.event.js +1 -1
- package/dist/node/payout/index.js +71 -71
- package/dist/node/payout/payout.event.js +1 -1
- package/dist/node/product/index.js +104 -104
- package/dist/node/product/product.event.js +1 -1
- package/dist/node/review/index.js +75 -75
- package/dist/node/review/review.event.js +1 -1
- package/dist/node/store/index.js +68 -68
- package/dist/node/store/store.event.js +1 -1
- package/dist/node/ui/MarketplaceDashboard.js +328 -110
- package/dist/node/ui/MarketplaceDashboard.visualizations.js +216 -0
- package/dist/node/ui/hooks/index.js +1 -1
- package/dist/node/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/node/ui/index.js +590 -359
- package/dist/node/ui/renderers/index.js +190 -4
- package/dist/node/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/node/visualizations/catalog.js +126 -0
- package/dist/node/visualizations/index.js +183 -0
- package/dist/node/visualizations/selectors.js +177 -0
- package/dist/order/index.d.ts +2 -2
- package/dist/order/index.js +155 -155
- package/dist/order/order.event.js +1 -1
- package/dist/payout/index.d.ts +2 -2
- package/dist/payout/index.js +71 -71
- package/dist/payout/payout.event.js +1 -1
- package/dist/product/index.d.ts +2 -2
- package/dist/product/index.js +104 -104
- package/dist/product/product.event.js +1 -1
- package/dist/review/index.d.ts +2 -2
- package/dist/review/index.js +75 -75
- package/dist/review/review.event.js +1 -1
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +68 -68
- package/dist/store/store.event.js +1 -1
- package/dist/ui/MarketplaceDashboard.js +328 -110
- package/dist/ui/MarketplaceDashboard.visualizations.d.ts +5 -0
- package/dist/ui/MarketplaceDashboard.visualizations.js +217 -0
- package/dist/ui/hooks/index.d.ts +1 -1
- package/dist/ui/hooks/index.js +1 -1
- package/dist/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +590 -359
- package/dist/ui/renderers/index.d.ts +1 -1
- package/dist/ui/renderers/index.js +190 -4
- package/dist/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/visualizations/catalog.d.ts +10 -0
- package/dist/visualizations/catalog.js +127 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +184 -0
- package/dist/visualizations/selectors.d.ts +11 -0
- package/dist/visualizations/selectors.js +178 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +66 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/useMarketplaceData.ts
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function useMarketplaceData(projectId = "local-project") {
|
|
7
7
|
const { handlers } = useTemplateRuntime();
|
|
@@ -53,8 +53,221 @@ function useMarketplaceData(projectId = "local-project") {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// src/visualizations/catalog.ts
|
|
57
|
+
import {
|
|
58
|
+
defineVisualization,
|
|
59
|
+
VisualizationRegistry
|
|
60
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
61
|
+
var ORDER_LIST_REF = {
|
|
62
|
+
key: "marketplace.order.list",
|
|
63
|
+
version: "1.0.0"
|
|
64
|
+
};
|
|
65
|
+
var PRODUCT_LIST_REF = {
|
|
66
|
+
key: "marketplace.product.list",
|
|
67
|
+
version: "1.0.0"
|
|
68
|
+
};
|
|
69
|
+
var META = {
|
|
70
|
+
version: "1.0.0",
|
|
71
|
+
domain: "marketplace",
|
|
72
|
+
stability: "experimental",
|
|
73
|
+
owners: ["@example.marketplace"],
|
|
74
|
+
tags: ["marketplace", "visualization", "commerce"]
|
|
75
|
+
};
|
|
76
|
+
var MarketplaceOrderStatusVisualization = defineVisualization({
|
|
77
|
+
meta: {
|
|
78
|
+
...META,
|
|
79
|
+
key: "marketplace.visualization.order-status",
|
|
80
|
+
title: "Order Status Breakdown",
|
|
81
|
+
description: "Distribution of current order states.",
|
|
82
|
+
goal: "Expose delivery and backlog mix at a glance.",
|
|
83
|
+
context: "Marketplace operations overview."
|
|
84
|
+
},
|
|
85
|
+
source: { primary: ORDER_LIST_REF, resultPath: "data" },
|
|
86
|
+
visualization: {
|
|
87
|
+
kind: "pie",
|
|
88
|
+
nameDimension: "status",
|
|
89
|
+
valueMeasure: "orders",
|
|
90
|
+
dimensions: [
|
|
91
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
92
|
+
],
|
|
93
|
+
measures: [
|
|
94
|
+
{ key: "orders", label: "Orders", dataPath: "orders", format: "number" }
|
|
95
|
+
],
|
|
96
|
+
table: { caption: "Order counts by status." }
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
var MarketplaceCategoryValueVisualization = defineVisualization({
|
|
100
|
+
meta: {
|
|
101
|
+
...META,
|
|
102
|
+
key: "marketplace.visualization.category-value",
|
|
103
|
+
title: "Category Value Comparison",
|
|
104
|
+
description: "Catalog value by product category derived from current pricing and stock.",
|
|
105
|
+
goal: "Compare where the marketplace catalog is concentrated.",
|
|
106
|
+
context: "Merchandising overview."
|
|
107
|
+
},
|
|
108
|
+
source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
|
|
109
|
+
visualization: {
|
|
110
|
+
kind: "cartesian",
|
|
111
|
+
variant: "bar",
|
|
112
|
+
xDimension: "category",
|
|
113
|
+
yMeasures: ["catalogValue"],
|
|
114
|
+
dimensions: [
|
|
115
|
+
{
|
|
116
|
+
key: "category",
|
|
117
|
+
label: "Category",
|
|
118
|
+
dataPath: "category",
|
|
119
|
+
type: "category"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
measures: [
|
|
123
|
+
{
|
|
124
|
+
key: "catalogValue",
|
|
125
|
+
label: "Catalog Value",
|
|
126
|
+
dataPath: "catalogValue",
|
|
127
|
+
format: "currency",
|
|
128
|
+
color: "#1d4ed8"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
table: { caption: "Catalog value by product category." }
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var MarketplaceOrderActivityVisualization = defineVisualization({
|
|
135
|
+
meta: {
|
|
136
|
+
...META,
|
|
137
|
+
key: "marketplace.visualization.order-activity",
|
|
138
|
+
title: "Recent Order Activity",
|
|
139
|
+
description: "Daily order volume from recent order creation timestamps.",
|
|
140
|
+
goal: "Show recent order activity trends.",
|
|
141
|
+
context: "Commerce operations trend monitoring."
|
|
142
|
+
},
|
|
143
|
+
source: { primary: ORDER_LIST_REF, resultPath: "data" },
|
|
144
|
+
visualization: {
|
|
145
|
+
kind: "cartesian",
|
|
146
|
+
variant: "line",
|
|
147
|
+
xDimension: "day",
|
|
148
|
+
yMeasures: ["orders"],
|
|
149
|
+
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
150
|
+
measures: [
|
|
151
|
+
{
|
|
152
|
+
key: "orders",
|
|
153
|
+
label: "Orders",
|
|
154
|
+
dataPath: "orders",
|
|
155
|
+
format: "number",
|
|
156
|
+
color: "#0f766e"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
table: { caption: "Daily order counts." }
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
var MarketplaceVisualizationSpecs = [
|
|
163
|
+
MarketplaceOrderStatusVisualization,
|
|
164
|
+
MarketplaceCategoryValueVisualization,
|
|
165
|
+
MarketplaceOrderActivityVisualization
|
|
166
|
+
];
|
|
167
|
+
var MarketplaceVisualizationRegistry = new VisualizationRegistry([
|
|
168
|
+
...MarketplaceVisualizationSpecs
|
|
169
|
+
]);
|
|
170
|
+
var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
|
|
171
|
+
key: spec.meta.key,
|
|
172
|
+
version: spec.meta.version
|
|
173
|
+
}));
|
|
174
|
+
|
|
175
|
+
// src/visualizations/selectors.ts
|
|
176
|
+
function toDayKey(value) {
|
|
177
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
178
|
+
return date.toISOString().slice(0, 10);
|
|
179
|
+
}
|
|
180
|
+
function createMarketplaceVisualizationItems(products, orders) {
|
|
181
|
+
const orderStatus = new Map;
|
|
182
|
+
const orderActivity = new Map;
|
|
183
|
+
const categoryValue = new Map;
|
|
184
|
+
for (const order of orders) {
|
|
185
|
+
orderStatus.set(order.status, (orderStatus.get(order.status) ?? 0) + 1);
|
|
186
|
+
const day = toDayKey(order.createdAt);
|
|
187
|
+
orderActivity.set(day, (orderActivity.get(day) ?? 0) + 1);
|
|
188
|
+
}
|
|
189
|
+
for (const product of products) {
|
|
190
|
+
const category = product.category ?? "Uncategorized";
|
|
191
|
+
categoryValue.set(category, (categoryValue.get(category) ?? 0) + product.price * product.stock);
|
|
192
|
+
}
|
|
193
|
+
return [
|
|
194
|
+
{
|
|
195
|
+
key: "marketplace-order-status",
|
|
196
|
+
spec: MarketplaceOrderStatusVisualization,
|
|
197
|
+
data: {
|
|
198
|
+
data: Array.from(orderStatus.entries()).map(([status, count]) => ({
|
|
199
|
+
status,
|
|
200
|
+
orders: count
|
|
201
|
+
}))
|
|
202
|
+
},
|
|
203
|
+
title: "Order Status Breakdown",
|
|
204
|
+
description: "Status mix across the current order set.",
|
|
205
|
+
height: 260
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "marketplace-category-value",
|
|
209
|
+
spec: MarketplaceCategoryValueVisualization,
|
|
210
|
+
data: {
|
|
211
|
+
data: Array.from(categoryValue.entries()).sort(([, left], [, right]) => right - left).map(([category, value]) => ({
|
|
212
|
+
category,
|
|
213
|
+
catalogValue: value
|
|
214
|
+
}))
|
|
215
|
+
},
|
|
216
|
+
title: "Category Value Comparison",
|
|
217
|
+
description: "Derived from current product pricing and stock."
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
key: "marketplace-order-activity",
|
|
221
|
+
spec: MarketplaceOrderActivityVisualization,
|
|
222
|
+
data: {
|
|
223
|
+
data: Array.from(orderActivity.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, orders: count }))
|
|
224
|
+
},
|
|
225
|
+
title: "Recent Order Activity",
|
|
226
|
+
description: "Daily order count from current order history."
|
|
227
|
+
}
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
// src/ui/MarketplaceDashboard.visualizations.tsx
|
|
231
|
+
import {
|
|
232
|
+
VisualizationCard,
|
|
233
|
+
VisualizationGrid
|
|
234
|
+
} from "@contractspec/lib.design-system";
|
|
235
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
236
|
+
"use client";
|
|
237
|
+
function MarketplaceVisualizationOverview({
|
|
238
|
+
products,
|
|
239
|
+
orders
|
|
240
|
+
}) {
|
|
241
|
+
const items = createMarketplaceVisualizationItems(products, orders);
|
|
242
|
+
return /* @__PURE__ */ jsxDEV("section", {
|
|
243
|
+
className: "space-y-3",
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
248
|
+
className: "font-semibold text-lg",
|
|
249
|
+
children: "Commerce Visualizations"
|
|
250
|
+
}, undefined, false, undefined, this),
|
|
251
|
+
/* @__PURE__ */ jsxDEV("p", {
|
|
252
|
+
className: "text-muted-foreground text-sm",
|
|
253
|
+
children: "Order and catalog trends exposed through shared visualization contracts."
|
|
254
|
+
}, undefined, false, undefined, this)
|
|
255
|
+
]
|
|
256
|
+
}, undefined, true, undefined, this),
|
|
257
|
+
/* @__PURE__ */ jsxDEV(VisualizationGrid, {
|
|
258
|
+
children: items.map((item) => /* @__PURE__ */ jsxDEV(VisualizationCard, {
|
|
259
|
+
data: item.data,
|
|
260
|
+
description: item.description,
|
|
261
|
+
height: item.height,
|
|
262
|
+
spec: item.spec,
|
|
263
|
+
title: item.title
|
|
264
|
+
}, item.key, false, undefined, this))
|
|
265
|
+
}, undefined, false, undefined, this)
|
|
266
|
+
]
|
|
267
|
+
}, undefined, true, undefined, this);
|
|
268
|
+
}
|
|
269
|
+
|
|
56
270
|
// src/ui/MarketplaceDashboard.tsx
|
|
57
|
-
import { useState as useState2 } from "react";
|
|
58
271
|
import {
|
|
59
272
|
Button,
|
|
60
273
|
ErrorState,
|
|
@@ -62,7 +275,8 @@ import {
|
|
|
62
275
|
StatCard,
|
|
63
276
|
StatCardGroup
|
|
64
277
|
} from "@contractspec/lib.design-system";
|
|
65
|
-
import {
|
|
278
|
+
import { useState as useState2 } from "react";
|
|
279
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
66
280
|
"use client";
|
|
67
281
|
var STATUS_COLORS = {
|
|
68
282
|
ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
@@ -94,32 +308,32 @@ function MarketplaceDashboard() {
|
|
|
94
308
|
{ id: "orders", label: "Orders", icon: "\uD83D\uDED2" }
|
|
95
309
|
];
|
|
96
310
|
if (loading) {
|
|
97
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ jsxDEV2(LoaderBlock, {
|
|
98
312
|
label: "Loading Marketplace..."
|
|
99
313
|
}, undefined, false, undefined, this);
|
|
100
314
|
}
|
|
101
315
|
if (error) {
|
|
102
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ jsxDEV2(ErrorState, {
|
|
103
317
|
title: "Failed to load Marketplace",
|
|
104
318
|
description: error.message,
|
|
105
319
|
onRetry: refetch,
|
|
106
320
|
retryLabel: "Retry"
|
|
107
321
|
}, undefined, false, undefined, this);
|
|
108
322
|
}
|
|
109
|
-
return /* @__PURE__ */
|
|
323
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
110
324
|
className: "space-y-6",
|
|
111
325
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
113
327
|
className: "flex items-center justify-between",
|
|
114
328
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
className: "text-2xl
|
|
329
|
+
/* @__PURE__ */ jsxDEV2("h2", {
|
|
330
|
+
className: "font-bold text-2xl",
|
|
117
331
|
children: "Marketplace"
|
|
118
332
|
}, undefined, false, undefined, this),
|
|
119
|
-
/* @__PURE__ */
|
|
333
|
+
/* @__PURE__ */ jsxDEV2(Button, {
|
|
120
334
|
onClick: () => alert("Create store modal"),
|
|
121
335
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
123
337
|
className: "mr-2",
|
|
124
338
|
children: "+"
|
|
125
339
|
}, undefined, false, undefined, this),
|
|
@@ -128,108 +342,112 @@ function MarketplaceDashboard() {
|
|
|
128
342
|
}, undefined, true, undefined, this)
|
|
129
343
|
]
|
|
130
344
|
}, undefined, true, undefined, this),
|
|
131
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ jsxDEV2(StatCardGroup, {
|
|
132
346
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
134
348
|
label: "Stores",
|
|
135
349
|
value: stats.totalStores,
|
|
136
350
|
hint: `${stats.activeStores} active`
|
|
137
351
|
}, undefined, false, undefined, this),
|
|
138
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
139
353
|
label: "Products",
|
|
140
354
|
value: stats.totalProducts,
|
|
141
355
|
hint: "listed"
|
|
142
356
|
}, undefined, false, undefined, this),
|
|
143
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
144
358
|
label: "Orders",
|
|
145
359
|
value: stats.totalOrders,
|
|
146
360
|
hint: `${stats.pendingOrders} pending`
|
|
147
361
|
}, undefined, false, undefined, this),
|
|
148
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
149
363
|
label: "Revenue",
|
|
150
364
|
value: formatCurrency(stats.totalRevenue),
|
|
151
365
|
hint: "total"
|
|
152
366
|
}, undefined, false, undefined, this)
|
|
153
367
|
]
|
|
154
368
|
}, undefined, true, undefined, this),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
|
|
369
|
+
/* @__PURE__ */ jsxDEV2(MarketplaceVisualizationOverview, {
|
|
370
|
+
orders,
|
|
371
|
+
products
|
|
372
|
+
}, undefined, false, undefined, this),
|
|
373
|
+
/* @__PURE__ */ jsxDEV2("nav", {
|
|
374
|
+
className: "flex gap-1 rounded-lg bg-muted p-1",
|
|
157
375
|
role: "tablist",
|
|
158
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
376
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV2(Button, {
|
|
159
377
|
type: "button",
|
|
160
378
|
role: "tab",
|
|
161
379
|
"aria-selected": activeTab === tab.id,
|
|
162
380
|
onClick: () => setActiveTab(tab.id),
|
|
163
|
-
className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm
|
|
381
|
+
className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 font-medium text-sm transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
164
382
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
166
384
|
children: tab.icon
|
|
167
385
|
}, undefined, false, undefined, this),
|
|
168
386
|
tab.label
|
|
169
387
|
]
|
|
170
388
|
}, tab.id, true, undefined, this))
|
|
171
389
|
}, undefined, false, undefined, this),
|
|
172
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
173
391
|
className: "min-h-[400px]",
|
|
174
392
|
role: "tabpanel",
|
|
175
393
|
children: [
|
|
176
|
-
activeTab === "stores" && /* @__PURE__ */
|
|
177
|
-
className: "
|
|
178
|
-
children: /* @__PURE__ */
|
|
394
|
+
activeTab === "stores" && /* @__PURE__ */ jsxDEV2("div", {
|
|
395
|
+
className: "rounded-lg border border-border",
|
|
396
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
179
397
|
className: "w-full",
|
|
180
398
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
className: "border-border bg-muted/30
|
|
183
|
-
children: /* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
400
|
+
className: "border-border border-b bg-muted/30",
|
|
401
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
184
402
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
className: "px-4 py-3 text-left text-sm
|
|
403
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
404
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
187
405
|
children: "Store"
|
|
188
406
|
}, undefined, false, undefined, this),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
className: "px-4 py-3 text-left text-sm
|
|
407
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
408
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
191
409
|
children: "Status"
|
|
192
410
|
}, undefined, false, undefined, this),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
className: "px-4 py-3 text-left text-sm
|
|
411
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
412
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
195
413
|
children: "Rating"
|
|
196
414
|
}, undefined, false, undefined, this),
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
className: "px-4 py-3 text-left text-sm
|
|
415
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
416
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
199
417
|
children: "Reviews"
|
|
200
418
|
}, undefined, false, undefined, this)
|
|
201
419
|
]
|
|
202
420
|
}, undefined, true, undefined, this)
|
|
203
421
|
}, undefined, false, undefined, this),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
className: "divide-
|
|
422
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
423
|
+
className: "divide-y divide-border",
|
|
206
424
|
children: [
|
|
207
|
-
stores.map((store) => /* @__PURE__ */
|
|
425
|
+
stores.map((store) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
208
426
|
className: "hover:bg-muted/50",
|
|
209
427
|
children: [
|
|
210
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
211
429
|
className: "px-4 py-3",
|
|
212
430
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
214
432
|
className: "font-medium",
|
|
215
433
|
children: store.name
|
|
216
434
|
}, undefined, false, undefined, this),
|
|
217
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
218
436
|
className: "text-muted-foreground text-sm",
|
|
219
437
|
children: store.description
|
|
220
438
|
}, undefined, false, undefined, this)
|
|
221
439
|
]
|
|
222
440
|
}, undefined, true, undefined, this),
|
|
223
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
224
442
|
className: "px-4 py-3",
|
|
225
|
-
children: /* @__PURE__ */
|
|
226
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs
|
|
443
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
444
|
+
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[store.status] ?? ""}`,
|
|
227
445
|
children: store.status
|
|
228
446
|
}, undefined, false, undefined, this)
|
|
229
447
|
}, undefined, false, undefined, this),
|
|
230
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
231
449
|
className: "px-4 py-3",
|
|
232
|
-
children: /* @__PURE__ */
|
|
450
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
233
451
|
className: "flex items-center gap-1",
|
|
234
452
|
children: [
|
|
235
453
|
"\u2B50 ",
|
|
@@ -237,8 +455,8 @@ function MarketplaceDashboard() {
|
|
|
237
455
|
]
|
|
238
456
|
}, undefined, true, undefined, this)
|
|
239
457
|
}, undefined, false, undefined, this),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
className: "
|
|
458
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
459
|
+
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
242
460
|
children: [
|
|
243
461
|
store.reviewCount,
|
|
244
462
|
" reviews"
|
|
@@ -246,10 +464,10 @@ function MarketplaceDashboard() {
|
|
|
246
464
|
}, undefined, true, undefined, this)
|
|
247
465
|
]
|
|
248
466
|
}, store.id, true, undefined, this)),
|
|
249
|
-
stores.length === 0 && /* @__PURE__ */
|
|
250
|
-
children: /* @__PURE__ */
|
|
467
|
+
stores.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
468
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
251
469
|
colSpan: 4,
|
|
252
|
-
className: "
|
|
470
|
+
className: "px-4 py-8 text-center text-muted-foreground",
|
|
253
471
|
children: "No stores found"
|
|
254
472
|
}, undefined, false, undefined, this)
|
|
255
473
|
}, undefined, false, undefined, this)
|
|
@@ -258,74 +476,74 @@ function MarketplaceDashboard() {
|
|
|
258
476
|
]
|
|
259
477
|
}, undefined, true, undefined, this)
|
|
260
478
|
}, undefined, false, undefined, this),
|
|
261
|
-
activeTab === "products" && /* @__PURE__ */
|
|
262
|
-
className: "
|
|
263
|
-
children: /* @__PURE__ */
|
|
479
|
+
activeTab === "products" && /* @__PURE__ */ jsxDEV2("div", {
|
|
480
|
+
className: "rounded-lg border border-border",
|
|
481
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
264
482
|
className: "w-full",
|
|
265
483
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
className: "border-border bg-muted/30
|
|
268
|
-
children: /* @__PURE__ */
|
|
484
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
485
|
+
className: "border-border border-b bg-muted/30",
|
|
486
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
269
487
|
children: [
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
className: "px-4 py-3 text-left text-sm
|
|
488
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
489
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
272
490
|
children: "Product"
|
|
273
491
|
}, undefined, false, undefined, this),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
className: "px-4 py-3 text-left text-sm
|
|
492
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
493
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
276
494
|
children: "Price"
|
|
277
495
|
}, undefined, false, undefined, this),
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
className: "px-4 py-3 text-left text-sm
|
|
496
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
497
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
280
498
|
children: "Stock"
|
|
281
499
|
}, undefined, false, undefined, this),
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
className: "px-4 py-3 text-left text-sm
|
|
500
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
501
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
284
502
|
children: "Status"
|
|
285
503
|
}, undefined, false, undefined, this)
|
|
286
504
|
]
|
|
287
505
|
}, undefined, true, undefined, this)
|
|
288
506
|
}, undefined, false, undefined, this),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
className: "divide-
|
|
507
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
508
|
+
className: "divide-y divide-border",
|
|
291
509
|
children: [
|
|
292
|
-
products.map((product) => /* @__PURE__ */
|
|
510
|
+
products.map((product) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
293
511
|
className: "hover:bg-muted/50",
|
|
294
512
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
296
514
|
className: "px-4 py-3",
|
|
297
515
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
299
517
|
className: "font-medium",
|
|
300
518
|
children: product.name
|
|
301
519
|
}, undefined, false, undefined, this),
|
|
302
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
303
521
|
className: "text-muted-foreground text-sm",
|
|
304
522
|
children: product.category
|
|
305
523
|
}, undefined, false, undefined, this)
|
|
306
524
|
]
|
|
307
525
|
}, undefined, true, undefined, this),
|
|
308
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
309
527
|
className: "px-4 py-3 font-mono",
|
|
310
528
|
children: formatCurrency(product.price, product.currency)
|
|
311
529
|
}, undefined, false, undefined, this),
|
|
312
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
313
531
|
className: "px-4 py-3",
|
|
314
532
|
children: product.stock
|
|
315
533
|
}, undefined, false, undefined, this),
|
|
316
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
317
535
|
className: "px-4 py-3",
|
|
318
|
-
children: /* @__PURE__ */
|
|
319
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs
|
|
536
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
537
|
+
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[product.status] ?? ""}`,
|
|
320
538
|
children: product.status
|
|
321
539
|
}, undefined, false, undefined, this)
|
|
322
540
|
}, undefined, false, undefined, this)
|
|
323
541
|
]
|
|
324
542
|
}, product.id, true, undefined, this)),
|
|
325
|
-
products.length === 0 && /* @__PURE__ */
|
|
326
|
-
children: /* @__PURE__ */
|
|
543
|
+
products.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
544
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
327
545
|
colSpan: 4,
|
|
328
|
-
className: "
|
|
546
|
+
className: "px-4 py-8 text-center text-muted-foreground",
|
|
329
547
|
children: "No products found"
|
|
330
548
|
}, undefined, false, undefined, this)
|
|
331
549
|
}, undefined, false, undefined, this)
|
|
@@ -334,73 +552,73 @@ function MarketplaceDashboard() {
|
|
|
334
552
|
]
|
|
335
553
|
}, undefined, true, undefined, this)
|
|
336
554
|
}, undefined, false, undefined, this),
|
|
337
|
-
activeTab === "orders" && /* @__PURE__ */
|
|
338
|
-
className: "
|
|
339
|
-
children: /* @__PURE__ */
|
|
555
|
+
activeTab === "orders" && /* @__PURE__ */ jsxDEV2("div", {
|
|
556
|
+
className: "rounded-lg border border-border",
|
|
557
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
340
558
|
className: "w-full",
|
|
341
559
|
children: [
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
className: "border-border bg-muted/30
|
|
344
|
-
children: /* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
561
|
+
className: "border-border border-b bg-muted/30",
|
|
562
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
345
563
|
children: [
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
className: "px-4 py-3 text-left text-sm
|
|
564
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
565
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
348
566
|
children: "Order ID"
|
|
349
567
|
}, undefined, false, undefined, this),
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
className: "px-4 py-3 text-left text-sm
|
|
568
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
569
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
352
570
|
children: "Customer"
|
|
353
571
|
}, undefined, false, undefined, this),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
className: "px-4 py-3 text-left text-sm
|
|
572
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
573
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
356
574
|
children: "Total"
|
|
357
575
|
}, undefined, false, undefined, this),
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
className: "px-4 py-3 text-left text-sm
|
|
576
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
577
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
360
578
|
children: "Status"
|
|
361
579
|
}, undefined, false, undefined, this),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
className: "px-4 py-3 text-left text-sm
|
|
580
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
581
|
+
className: "px-4 py-3 text-left font-medium text-sm",
|
|
364
582
|
children: "Date"
|
|
365
583
|
}, undefined, false, undefined, this)
|
|
366
584
|
]
|
|
367
585
|
}, undefined, true, undefined, this)
|
|
368
586
|
}, undefined, false, undefined, this),
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
className: "divide-
|
|
587
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
588
|
+
className: "divide-y divide-border",
|
|
371
589
|
children: [
|
|
372
|
-
orders.map((order) => /* @__PURE__ */
|
|
590
|
+
orders.map((order) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
373
591
|
className: "hover:bg-muted/50",
|
|
374
592
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
376
594
|
className: "px-4 py-3 font-mono text-sm",
|
|
377
595
|
children: order.id
|
|
378
596
|
}, undefined, false, undefined, this),
|
|
379
|
-
/* @__PURE__ */
|
|
597
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
380
598
|
className: "px-4 py-3 text-sm",
|
|
381
599
|
children: order.customerId
|
|
382
600
|
}, undefined, false, undefined, this),
|
|
383
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
384
602
|
className: "px-4 py-3 font-mono",
|
|
385
603
|
children: formatCurrency(order.total, order.currency)
|
|
386
604
|
}, undefined, false, undefined, this),
|
|
387
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
388
606
|
className: "px-4 py-3",
|
|
389
|
-
children: /* @__PURE__ */
|
|
390
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs
|
|
607
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
608
|
+
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[order.status] ?? ""}`,
|
|
391
609
|
children: order.status
|
|
392
610
|
}, undefined, false, undefined, this)
|
|
393
611
|
}, undefined, false, undefined, this),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
className: "
|
|
612
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
613
|
+
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
396
614
|
children: order.createdAt.toLocaleDateString()
|
|
397
615
|
}, undefined, false, undefined, this)
|
|
398
616
|
]
|
|
399
617
|
}, order.id, true, undefined, this)),
|
|
400
|
-
orders.length === 0 && /* @__PURE__ */
|
|
401
|
-
children: /* @__PURE__ */
|
|
618
|
+
orders.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
619
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
402
620
|
colSpan: 5,
|
|
403
|
-
className: "
|
|
621
|
+
className: "px-4 py-8 text-center text-muted-foreground",
|
|
404
622
|
children: "No orders found"
|
|
405
623
|
}, undefined, false, undefined, this)
|
|
406
624
|
}, undefined, false, undefined, this)
|