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