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