@contractspec/example.marketplace 3.7.7 → 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 +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.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 +64 -8
package/dist/browser/index.js
CHANGED
|
@@ -1358,6 +1358,220 @@ function useMarketplaceData(projectId = "local-project") {
|
|
|
1358
1358
|
// src/ui/hooks/index.ts
|
|
1359
1359
|
"use client";
|
|
1360
1360
|
|
|
1361
|
+
// src/visualizations/catalog.ts
|
|
1362
|
+
import {
|
|
1363
|
+
defineVisualization,
|
|
1364
|
+
VisualizationRegistry
|
|
1365
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
1366
|
+
var ORDER_LIST_REF = {
|
|
1367
|
+
key: "marketplace.order.list",
|
|
1368
|
+
version: "1.0.0"
|
|
1369
|
+
};
|
|
1370
|
+
var PRODUCT_LIST_REF = {
|
|
1371
|
+
key: "marketplace.product.list",
|
|
1372
|
+
version: "1.0.0"
|
|
1373
|
+
};
|
|
1374
|
+
var META = {
|
|
1375
|
+
version: "1.0.0",
|
|
1376
|
+
domain: "marketplace",
|
|
1377
|
+
stability: "experimental",
|
|
1378
|
+
owners: ["@example.marketplace"],
|
|
1379
|
+
tags: ["marketplace", "visualization", "commerce"]
|
|
1380
|
+
};
|
|
1381
|
+
var MarketplaceOrderStatusVisualization = defineVisualization({
|
|
1382
|
+
meta: {
|
|
1383
|
+
...META,
|
|
1384
|
+
key: "marketplace.visualization.order-status",
|
|
1385
|
+
title: "Order Status Breakdown",
|
|
1386
|
+
description: "Distribution of current order states.",
|
|
1387
|
+
goal: "Expose delivery and backlog mix at a glance.",
|
|
1388
|
+
context: "Marketplace operations overview."
|
|
1389
|
+
},
|
|
1390
|
+
source: { primary: ORDER_LIST_REF, resultPath: "data" },
|
|
1391
|
+
visualization: {
|
|
1392
|
+
kind: "pie",
|
|
1393
|
+
nameDimension: "status",
|
|
1394
|
+
valueMeasure: "orders",
|
|
1395
|
+
dimensions: [
|
|
1396
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
1397
|
+
],
|
|
1398
|
+
measures: [
|
|
1399
|
+
{ key: "orders", label: "Orders", dataPath: "orders", format: "number" }
|
|
1400
|
+
],
|
|
1401
|
+
table: { caption: "Order counts by status." }
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
var MarketplaceCategoryValueVisualization = defineVisualization({
|
|
1405
|
+
meta: {
|
|
1406
|
+
...META,
|
|
1407
|
+
key: "marketplace.visualization.category-value",
|
|
1408
|
+
title: "Category Value Comparison",
|
|
1409
|
+
description: "Catalog value by product category derived from current pricing and stock.",
|
|
1410
|
+
goal: "Compare where the marketplace catalog is concentrated.",
|
|
1411
|
+
context: "Merchandising overview."
|
|
1412
|
+
},
|
|
1413
|
+
source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
|
|
1414
|
+
visualization: {
|
|
1415
|
+
kind: "cartesian",
|
|
1416
|
+
variant: "bar",
|
|
1417
|
+
xDimension: "category",
|
|
1418
|
+
yMeasures: ["catalogValue"],
|
|
1419
|
+
dimensions: [
|
|
1420
|
+
{
|
|
1421
|
+
key: "category",
|
|
1422
|
+
label: "Category",
|
|
1423
|
+
dataPath: "category",
|
|
1424
|
+
type: "category"
|
|
1425
|
+
}
|
|
1426
|
+
],
|
|
1427
|
+
measures: [
|
|
1428
|
+
{
|
|
1429
|
+
key: "catalogValue",
|
|
1430
|
+
label: "Catalog Value",
|
|
1431
|
+
dataPath: "catalogValue",
|
|
1432
|
+
format: "currency",
|
|
1433
|
+
color: "#1d4ed8"
|
|
1434
|
+
}
|
|
1435
|
+
],
|
|
1436
|
+
table: { caption: "Catalog value by product category." }
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
var MarketplaceOrderActivityVisualization = defineVisualization({
|
|
1440
|
+
meta: {
|
|
1441
|
+
...META,
|
|
1442
|
+
key: "marketplace.visualization.order-activity",
|
|
1443
|
+
title: "Recent Order Activity",
|
|
1444
|
+
description: "Daily order volume from recent order creation timestamps.",
|
|
1445
|
+
goal: "Show recent order activity trends.",
|
|
1446
|
+
context: "Commerce operations trend monitoring."
|
|
1447
|
+
},
|
|
1448
|
+
source: { primary: ORDER_LIST_REF, resultPath: "data" },
|
|
1449
|
+
visualization: {
|
|
1450
|
+
kind: "cartesian",
|
|
1451
|
+
variant: "line",
|
|
1452
|
+
xDimension: "day",
|
|
1453
|
+
yMeasures: ["orders"],
|
|
1454
|
+
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
1455
|
+
measures: [
|
|
1456
|
+
{
|
|
1457
|
+
key: "orders",
|
|
1458
|
+
label: "Orders",
|
|
1459
|
+
dataPath: "orders",
|
|
1460
|
+
format: "number",
|
|
1461
|
+
color: "#0f766e"
|
|
1462
|
+
}
|
|
1463
|
+
],
|
|
1464
|
+
table: { caption: "Daily order counts." }
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
var MarketplaceVisualizationSpecs = [
|
|
1468
|
+
MarketplaceOrderStatusVisualization,
|
|
1469
|
+
MarketplaceCategoryValueVisualization,
|
|
1470
|
+
MarketplaceOrderActivityVisualization
|
|
1471
|
+
];
|
|
1472
|
+
var MarketplaceVisualizationRegistry = new VisualizationRegistry([
|
|
1473
|
+
...MarketplaceVisualizationSpecs
|
|
1474
|
+
]);
|
|
1475
|
+
var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
|
|
1476
|
+
key: spec.meta.key,
|
|
1477
|
+
version: spec.meta.version
|
|
1478
|
+
}));
|
|
1479
|
+
|
|
1480
|
+
// src/visualizations/selectors.ts
|
|
1481
|
+
function toDayKey(value) {
|
|
1482
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
1483
|
+
return date.toISOString().slice(0, 10);
|
|
1484
|
+
}
|
|
1485
|
+
function createMarketplaceVisualizationItems(products, orders) {
|
|
1486
|
+
const orderStatus = new Map;
|
|
1487
|
+
const orderActivity = new Map;
|
|
1488
|
+
const categoryValue = new Map;
|
|
1489
|
+
for (const order of orders) {
|
|
1490
|
+
orderStatus.set(order.status, (orderStatus.get(order.status) ?? 0) + 1);
|
|
1491
|
+
const day = toDayKey(order.createdAt);
|
|
1492
|
+
orderActivity.set(day, (orderActivity.get(day) ?? 0) + 1);
|
|
1493
|
+
}
|
|
1494
|
+
for (const product of products) {
|
|
1495
|
+
const category = product.category ?? "Uncategorized";
|
|
1496
|
+
categoryValue.set(category, (categoryValue.get(category) ?? 0) + product.price * product.stock);
|
|
1497
|
+
}
|
|
1498
|
+
return [
|
|
1499
|
+
{
|
|
1500
|
+
key: "marketplace-order-status",
|
|
1501
|
+
spec: MarketplaceOrderStatusVisualization,
|
|
1502
|
+
data: {
|
|
1503
|
+
data: Array.from(orderStatus.entries()).map(([status, count]) => ({
|
|
1504
|
+
status,
|
|
1505
|
+
orders: count
|
|
1506
|
+
}))
|
|
1507
|
+
},
|
|
1508
|
+
title: "Order Status Breakdown",
|
|
1509
|
+
description: "Status mix across the current order set.",
|
|
1510
|
+
height: 260
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
key: "marketplace-category-value",
|
|
1514
|
+
spec: MarketplaceCategoryValueVisualization,
|
|
1515
|
+
data: {
|
|
1516
|
+
data: Array.from(categoryValue.entries()).sort(([, left], [, right]) => right - left).map(([category, value]) => ({
|
|
1517
|
+
category,
|
|
1518
|
+
catalogValue: value
|
|
1519
|
+
}))
|
|
1520
|
+
},
|
|
1521
|
+
title: "Category Value Comparison",
|
|
1522
|
+
description: "Derived from current product pricing and stock."
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
key: "marketplace-order-activity",
|
|
1526
|
+
spec: MarketplaceOrderActivityVisualization,
|
|
1527
|
+
data: {
|
|
1528
|
+
data: Array.from(orderActivity.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, orders: count }))
|
|
1529
|
+
},
|
|
1530
|
+
title: "Recent Order Activity",
|
|
1531
|
+
description: "Daily order count from current order history."
|
|
1532
|
+
}
|
|
1533
|
+
];
|
|
1534
|
+
}
|
|
1535
|
+
// src/ui/MarketplaceDashboard.visualizations.tsx
|
|
1536
|
+
import {
|
|
1537
|
+
VisualizationCard,
|
|
1538
|
+
VisualizationGrid
|
|
1539
|
+
} from "@contractspec/lib.design-system";
|
|
1540
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
1541
|
+
"use client";
|
|
1542
|
+
function MarketplaceVisualizationOverview({
|
|
1543
|
+
products,
|
|
1544
|
+
orders
|
|
1545
|
+
}) {
|
|
1546
|
+
const items = createMarketplaceVisualizationItems(products, orders);
|
|
1547
|
+
return /* @__PURE__ */ jsxDEV("section", {
|
|
1548
|
+
className: "space-y-3",
|
|
1549
|
+
children: [
|
|
1550
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
1551
|
+
children: [
|
|
1552
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
1553
|
+
className: "font-semibold text-lg",
|
|
1554
|
+
children: "Commerce Visualizations"
|
|
1555
|
+
}, undefined, false, undefined, this),
|
|
1556
|
+
/* @__PURE__ */ jsxDEV("p", {
|
|
1557
|
+
className: "text-muted-foreground text-sm",
|
|
1558
|
+
children: "Order and catalog trends exposed through shared visualization contracts."
|
|
1559
|
+
}, undefined, false, undefined, this)
|
|
1560
|
+
]
|
|
1561
|
+
}, undefined, true, undefined, this),
|
|
1562
|
+
/* @__PURE__ */ jsxDEV(VisualizationGrid, {
|
|
1563
|
+
children: items.map((item) => /* @__PURE__ */ jsxDEV(VisualizationCard, {
|
|
1564
|
+
data: item.data,
|
|
1565
|
+
description: item.description,
|
|
1566
|
+
height: item.height,
|
|
1567
|
+
spec: item.spec,
|
|
1568
|
+
title: item.title
|
|
1569
|
+
}, item.key, false, undefined, this))
|
|
1570
|
+
}, undefined, false, undefined, this)
|
|
1571
|
+
]
|
|
1572
|
+
}, undefined, true, undefined, this);
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1361
1575
|
// src/ui/MarketplaceDashboard.tsx
|
|
1362
1576
|
import {
|
|
1363
1577
|
Button,
|
|
@@ -1367,7 +1581,7 @@ import {
|
|
|
1367
1581
|
StatCardGroup
|
|
1368
1582
|
} from "@contractspec/lib.design-system";
|
|
1369
1583
|
import { useState as useState2 } from "react";
|
|
1370
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
1584
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
1371
1585
|
"use client";
|
|
1372
1586
|
var STATUS_COLORS = {
|
|
1373
1587
|
ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
@@ -1399,32 +1613,32 @@ function MarketplaceDashboard() {
|
|
|
1399
1613
|
{ id: "orders", label: "Orders", icon: "\uD83D\uDED2" }
|
|
1400
1614
|
];
|
|
1401
1615
|
if (loading) {
|
|
1402
|
-
return /* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ jsxDEV2(LoaderBlock, {
|
|
1403
1617
|
label: "Loading Marketplace..."
|
|
1404
1618
|
}, undefined, false, undefined, this);
|
|
1405
1619
|
}
|
|
1406
1620
|
if (error) {
|
|
1407
|
-
return /* @__PURE__ */
|
|
1621
|
+
return /* @__PURE__ */ jsxDEV2(ErrorState, {
|
|
1408
1622
|
title: "Failed to load Marketplace",
|
|
1409
1623
|
description: error.message,
|
|
1410
1624
|
onRetry: refetch,
|
|
1411
1625
|
retryLabel: "Retry"
|
|
1412
1626
|
}, undefined, false, undefined, this);
|
|
1413
1627
|
}
|
|
1414
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
1415
1629
|
className: "space-y-6",
|
|
1416
1630
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1418
1632
|
className: "flex items-center justify-between",
|
|
1419
1633
|
children: [
|
|
1420
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsxDEV2("h2", {
|
|
1421
1635
|
className: "font-bold text-2xl",
|
|
1422
1636
|
children: "Marketplace"
|
|
1423
1637
|
}, undefined, false, undefined, this),
|
|
1424
|
-
/* @__PURE__ */
|
|
1638
|
+
/* @__PURE__ */ jsxDEV2(Button, {
|
|
1425
1639
|
onClick: () => alert("Create store modal"),
|
|
1426
1640
|
children: [
|
|
1427
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
1428
1642
|
className: "mr-2",
|
|
1429
1643
|
children: "+"
|
|
1430
1644
|
}, undefined, false, undefined, this),
|
|
@@ -1433,108 +1647,112 @@ function MarketplaceDashboard() {
|
|
|
1433
1647
|
}, undefined, true, undefined, this)
|
|
1434
1648
|
]
|
|
1435
1649
|
}, undefined, true, undefined, this),
|
|
1436
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ jsxDEV2(StatCardGroup, {
|
|
1437
1651
|
children: [
|
|
1438
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
1439
1653
|
label: "Stores",
|
|
1440
1654
|
value: stats.totalStores,
|
|
1441
1655
|
hint: `${stats.activeStores} active`
|
|
1442
1656
|
}, undefined, false, undefined, this),
|
|
1443
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
1444
1658
|
label: "Products",
|
|
1445
1659
|
value: stats.totalProducts,
|
|
1446
1660
|
hint: "listed"
|
|
1447
1661
|
}, undefined, false, undefined, this),
|
|
1448
|
-
/* @__PURE__ */
|
|
1662
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
1449
1663
|
label: "Orders",
|
|
1450
1664
|
value: stats.totalOrders,
|
|
1451
1665
|
hint: `${stats.pendingOrders} pending`
|
|
1452
1666
|
}, undefined, false, undefined, this),
|
|
1453
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsxDEV2(StatCard, {
|
|
1454
1668
|
label: "Revenue",
|
|
1455
1669
|
value: formatCurrency(stats.totalRevenue),
|
|
1456
1670
|
hint: "total"
|
|
1457
1671
|
}, undefined, false, undefined, this)
|
|
1458
1672
|
]
|
|
1459
1673
|
}, undefined, true, undefined, this),
|
|
1460
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ jsxDEV2(MarketplaceVisualizationOverview, {
|
|
1675
|
+
orders,
|
|
1676
|
+
products
|
|
1677
|
+
}, undefined, false, undefined, this),
|
|
1678
|
+
/* @__PURE__ */ jsxDEV2("nav", {
|
|
1461
1679
|
className: "flex gap-1 rounded-lg bg-muted p-1",
|
|
1462
1680
|
role: "tablist",
|
|
1463
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
1681
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV2(Button, {
|
|
1464
1682
|
type: "button",
|
|
1465
1683
|
role: "tab",
|
|
1466
1684
|
"aria-selected": activeTab === tab.id,
|
|
1467
1685
|
onClick: () => setActiveTab(tab.id),
|
|
1468
1686
|
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"}`,
|
|
1469
1687
|
children: [
|
|
1470
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
1471
1689
|
children: tab.icon
|
|
1472
1690
|
}, undefined, false, undefined, this),
|
|
1473
1691
|
tab.label
|
|
1474
1692
|
]
|
|
1475
1693
|
}, tab.id, true, undefined, this))
|
|
1476
1694
|
}, undefined, false, undefined, this),
|
|
1477
|
-
/* @__PURE__ */
|
|
1695
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1478
1696
|
className: "min-h-[400px]",
|
|
1479
1697
|
role: "tabpanel",
|
|
1480
1698
|
children: [
|
|
1481
|
-
activeTab === "stores" && /* @__PURE__ */
|
|
1699
|
+
activeTab === "stores" && /* @__PURE__ */ jsxDEV2("div", {
|
|
1482
1700
|
className: "rounded-lg border border-border",
|
|
1483
|
-
children: /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
1484
1702
|
className: "w-full",
|
|
1485
1703
|
children: [
|
|
1486
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
1487
1705
|
className: "border-border border-b bg-muted/30",
|
|
1488
|
-
children: /* @__PURE__ */
|
|
1706
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
1489
1707
|
children: [
|
|
1490
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1491
1709
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1492
1710
|
children: "Store"
|
|
1493
1711
|
}, undefined, false, undefined, this),
|
|
1494
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1495
1713
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1496
1714
|
children: "Status"
|
|
1497
1715
|
}, undefined, false, undefined, this),
|
|
1498
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1499
1717
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1500
1718
|
children: "Rating"
|
|
1501
1719
|
}, undefined, false, undefined, this),
|
|
1502
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1503
1721
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1504
1722
|
children: "Reviews"
|
|
1505
1723
|
}, undefined, false, undefined, this)
|
|
1506
1724
|
]
|
|
1507
1725
|
}, undefined, true, undefined, this)
|
|
1508
1726
|
}, undefined, false, undefined, this),
|
|
1509
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
1510
1728
|
className: "divide-y divide-border",
|
|
1511
1729
|
children: [
|
|
1512
|
-
stores.map((store) => /* @__PURE__ */
|
|
1730
|
+
stores.map((store) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
1513
1731
|
className: "hover:bg-muted/50",
|
|
1514
1732
|
children: [
|
|
1515
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1516
1734
|
className: "px-4 py-3",
|
|
1517
1735
|
children: [
|
|
1518
|
-
/* @__PURE__ */
|
|
1736
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1519
1737
|
className: "font-medium",
|
|
1520
1738
|
children: store.name
|
|
1521
1739
|
}, undefined, false, undefined, this),
|
|
1522
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1523
1741
|
className: "text-muted-foreground text-sm",
|
|
1524
1742
|
children: store.description
|
|
1525
1743
|
}, undefined, false, undefined, this)
|
|
1526
1744
|
]
|
|
1527
1745
|
}, undefined, true, undefined, this),
|
|
1528
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1529
1747
|
className: "px-4 py-3",
|
|
1530
|
-
children: /* @__PURE__ */
|
|
1748
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1531
1749
|
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[store.status] ?? ""}`,
|
|
1532
1750
|
children: store.status
|
|
1533
1751
|
}, undefined, false, undefined, this)
|
|
1534
1752
|
}, undefined, false, undefined, this),
|
|
1535
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1536
1754
|
className: "px-4 py-3",
|
|
1537
|
-
children: /* @__PURE__ */
|
|
1755
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1538
1756
|
className: "flex items-center gap-1",
|
|
1539
1757
|
children: [
|
|
1540
1758
|
"⭐ ",
|
|
@@ -1542,7 +1760,7 @@ function MarketplaceDashboard() {
|
|
|
1542
1760
|
]
|
|
1543
1761
|
}, undefined, true, undefined, this)
|
|
1544
1762
|
}, undefined, false, undefined, this),
|
|
1545
|
-
/* @__PURE__ */
|
|
1763
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1546
1764
|
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
1547
1765
|
children: [
|
|
1548
1766
|
store.reviewCount,
|
|
@@ -1551,8 +1769,8 @@ function MarketplaceDashboard() {
|
|
|
1551
1769
|
}, undefined, true, undefined, this)
|
|
1552
1770
|
]
|
|
1553
1771
|
}, store.id, true, undefined, this)),
|
|
1554
|
-
stores.length === 0 && /* @__PURE__ */
|
|
1555
|
-
children: /* @__PURE__ */
|
|
1772
|
+
stores.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
1773
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
1556
1774
|
colSpan: 4,
|
|
1557
1775
|
className: "px-4 py-8 text-center text-muted-foreground",
|
|
1558
1776
|
children: "No stores found"
|
|
@@ -1563,72 +1781,72 @@ function MarketplaceDashboard() {
|
|
|
1563
1781
|
]
|
|
1564
1782
|
}, undefined, true, undefined, this)
|
|
1565
1783
|
}, undefined, false, undefined, this),
|
|
1566
|
-
activeTab === "products" && /* @__PURE__ */
|
|
1784
|
+
activeTab === "products" && /* @__PURE__ */ jsxDEV2("div", {
|
|
1567
1785
|
className: "rounded-lg border border-border",
|
|
1568
|
-
children: /* @__PURE__ */
|
|
1786
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
1569
1787
|
className: "w-full",
|
|
1570
1788
|
children: [
|
|
1571
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
1572
1790
|
className: "border-border border-b bg-muted/30",
|
|
1573
|
-
children: /* @__PURE__ */
|
|
1791
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
1574
1792
|
children: [
|
|
1575
|
-
/* @__PURE__ */
|
|
1793
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1576
1794
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1577
1795
|
children: "Product"
|
|
1578
1796
|
}, undefined, false, undefined, this),
|
|
1579
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1580
1798
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1581
1799
|
children: "Price"
|
|
1582
1800
|
}, undefined, false, undefined, this),
|
|
1583
|
-
/* @__PURE__ */
|
|
1801
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1584
1802
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1585
1803
|
children: "Stock"
|
|
1586
1804
|
}, undefined, false, undefined, this),
|
|
1587
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1588
1806
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1589
1807
|
children: "Status"
|
|
1590
1808
|
}, undefined, false, undefined, this)
|
|
1591
1809
|
]
|
|
1592
1810
|
}, undefined, true, undefined, this)
|
|
1593
1811
|
}, undefined, false, undefined, this),
|
|
1594
|
-
/* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
1595
1813
|
className: "divide-y divide-border",
|
|
1596
1814
|
children: [
|
|
1597
|
-
products.map((product) => /* @__PURE__ */
|
|
1815
|
+
products.map((product) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
1598
1816
|
className: "hover:bg-muted/50",
|
|
1599
1817
|
children: [
|
|
1600
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1601
1819
|
className: "px-4 py-3",
|
|
1602
1820
|
children: [
|
|
1603
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1604
1822
|
className: "font-medium",
|
|
1605
1823
|
children: product.name
|
|
1606
1824
|
}, undefined, false, undefined, this),
|
|
1607
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
1608
1826
|
className: "text-muted-foreground text-sm",
|
|
1609
1827
|
children: product.category
|
|
1610
1828
|
}, undefined, false, undefined, this)
|
|
1611
1829
|
]
|
|
1612
1830
|
}, undefined, true, undefined, this),
|
|
1613
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1614
1832
|
className: "px-4 py-3 font-mono",
|
|
1615
1833
|
children: formatCurrency(product.price, product.currency)
|
|
1616
1834
|
}, undefined, false, undefined, this),
|
|
1617
|
-
/* @__PURE__ */
|
|
1835
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1618
1836
|
className: "px-4 py-3",
|
|
1619
1837
|
children: product.stock
|
|
1620
1838
|
}, undefined, false, undefined, this),
|
|
1621
|
-
/* @__PURE__ */
|
|
1839
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1622
1840
|
className: "px-4 py-3",
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1841
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1624
1842
|
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[product.status] ?? ""}`,
|
|
1625
1843
|
children: product.status
|
|
1626
1844
|
}, undefined, false, undefined, this)
|
|
1627
1845
|
}, undefined, false, undefined, this)
|
|
1628
1846
|
]
|
|
1629
1847
|
}, product.id, true, undefined, this)),
|
|
1630
|
-
products.length === 0 && /* @__PURE__ */
|
|
1631
|
-
children: /* @__PURE__ */
|
|
1848
|
+
products.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
1849
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
1632
1850
|
colSpan: 4,
|
|
1633
1851
|
className: "px-4 py-8 text-center text-muted-foreground",
|
|
1634
1852
|
children: "No products found"
|
|
@@ -1639,71 +1857,71 @@ function MarketplaceDashboard() {
|
|
|
1639
1857
|
]
|
|
1640
1858
|
}, undefined, true, undefined, this)
|
|
1641
1859
|
}, undefined, false, undefined, this),
|
|
1642
|
-
activeTab === "orders" && /* @__PURE__ */
|
|
1860
|
+
activeTab === "orders" && /* @__PURE__ */ jsxDEV2("div", {
|
|
1643
1861
|
className: "rounded-lg border border-border",
|
|
1644
|
-
children: /* @__PURE__ */
|
|
1862
|
+
children: /* @__PURE__ */ jsxDEV2("table", {
|
|
1645
1863
|
className: "w-full",
|
|
1646
1864
|
children: [
|
|
1647
|
-
/* @__PURE__ */
|
|
1865
|
+
/* @__PURE__ */ jsxDEV2("thead", {
|
|
1648
1866
|
className: "border-border border-b bg-muted/30",
|
|
1649
|
-
children: /* @__PURE__ */
|
|
1867
|
+
children: /* @__PURE__ */ jsxDEV2("tr", {
|
|
1650
1868
|
children: [
|
|
1651
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1652
1870
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1653
1871
|
children: "Order ID"
|
|
1654
1872
|
}, undefined, false, undefined, this),
|
|
1655
|
-
/* @__PURE__ */
|
|
1873
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1656
1874
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1657
1875
|
children: "Customer"
|
|
1658
1876
|
}, undefined, false, undefined, this),
|
|
1659
|
-
/* @__PURE__ */
|
|
1877
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1660
1878
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1661
1879
|
children: "Total"
|
|
1662
1880
|
}, undefined, false, undefined, this),
|
|
1663
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1664
1882
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1665
1883
|
children: "Status"
|
|
1666
1884
|
}, undefined, false, undefined, this),
|
|
1667
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsxDEV2("th", {
|
|
1668
1886
|
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1669
1887
|
children: "Date"
|
|
1670
1888
|
}, undefined, false, undefined, this)
|
|
1671
1889
|
]
|
|
1672
1890
|
}, undefined, true, undefined, this)
|
|
1673
1891
|
}, undefined, false, undefined, this),
|
|
1674
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
1675
1893
|
className: "divide-y divide-border",
|
|
1676
1894
|
children: [
|
|
1677
|
-
orders.map((order) => /* @__PURE__ */
|
|
1895
|
+
orders.map((order) => /* @__PURE__ */ jsxDEV2("tr", {
|
|
1678
1896
|
className: "hover:bg-muted/50",
|
|
1679
1897
|
children: [
|
|
1680
|
-
/* @__PURE__ */
|
|
1898
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1681
1899
|
className: "px-4 py-3 font-mono text-sm",
|
|
1682
1900
|
children: order.id
|
|
1683
1901
|
}, undefined, false, undefined, this),
|
|
1684
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1685
1903
|
className: "px-4 py-3 text-sm",
|
|
1686
1904
|
children: order.customerId
|
|
1687
1905
|
}, undefined, false, undefined, this),
|
|
1688
|
-
/* @__PURE__ */
|
|
1906
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1689
1907
|
className: "px-4 py-3 font-mono",
|
|
1690
1908
|
children: formatCurrency(order.total, order.currency)
|
|
1691
1909
|
}, undefined, false, undefined, this),
|
|
1692
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1693
1911
|
className: "px-4 py-3",
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1912
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1695
1913
|
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[order.status] ?? ""}`,
|
|
1696
1914
|
children: order.status
|
|
1697
1915
|
}, undefined, false, undefined, this)
|
|
1698
1916
|
}, undefined, false, undefined, this),
|
|
1699
|
-
/* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ jsxDEV2("td", {
|
|
1700
1918
|
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
1701
1919
|
children: order.createdAt.toLocaleDateString()
|
|
1702
1920
|
}, undefined, false, undefined, this)
|
|
1703
1921
|
]
|
|
1704
1922
|
}, order.id, true, undefined, this)),
|
|
1705
|
-
orders.length === 0 && /* @__PURE__ */
|
|
1706
|
-
children: /* @__PURE__ */
|
|
1923
|
+
orders.length === 0 && /* @__PURE__ */ jsxDEV2("tr", {
|
|
1924
|
+
children: /* @__PURE__ */ jsxDEV2("td", {
|
|
1707
1925
|
colSpan: 5,
|
|
1708
1926
|
className: "px-4 py-8 text-center text-muted-foreground",
|
|
1709
1927
|
children: "No orders found"
|
|
@@ -1749,6 +1967,7 @@ var mockProducts = [
|
|
|
1749
1967
|
id: "prod-1",
|
|
1750
1968
|
name: "Wireless Earbuds",
|
|
1751
1969
|
storeId: "store-1",
|
|
1970
|
+
category: "Electronics",
|
|
1752
1971
|
price: 79.99,
|
|
1753
1972
|
currency: "USD",
|
|
1754
1973
|
status: "ACTIVE",
|
|
@@ -1758,6 +1977,7 @@ var mockProducts = [
|
|
|
1758
1977
|
id: "prod-2",
|
|
1759
1978
|
name: "Smart Watch",
|
|
1760
1979
|
storeId: "store-1",
|
|
1980
|
+
category: "Wearables",
|
|
1761
1981
|
price: 249.99,
|
|
1762
1982
|
currency: "USD",
|
|
1763
1983
|
status: "ACTIVE",
|
|
@@ -1767,6 +1987,7 @@ var mockProducts = [
|
|
|
1767
1987
|
id: "prod-3",
|
|
1768
1988
|
name: "Garden Tools Set",
|
|
1769
1989
|
storeId: "store-2",
|
|
1990
|
+
category: "Garden",
|
|
1770
1991
|
price: 89.99,
|
|
1771
1992
|
currency: "USD",
|
|
1772
1993
|
status: "ACTIVE",
|
|
@@ -1776,6 +1997,7 @@ var mockProducts = [
|
|
|
1776
1997
|
id: "prod-4",
|
|
1777
1998
|
name: "Indoor Plant Kit",
|
|
1778
1999
|
storeId: "store-2",
|
|
2000
|
+
category: "Garden",
|
|
1779
2001
|
price: 45.99,
|
|
1780
2002
|
currency: "USD",
|
|
1781
2003
|
status: "ACTIVE",
|
|
@@ -1785,6 +2007,7 @@ var mockProducts = [
|
|
|
1785
2007
|
id: "prod-5",
|
|
1786
2008
|
name: "LED Desk Lamp",
|
|
1787
2009
|
storeId: "store-1",
|
|
2010
|
+
category: "Home Office",
|
|
1788
2011
|
price: 34.99,
|
|
1789
2012
|
currency: "USD",
|
|
1790
2013
|
status: "OUT_OF_STOCK",
|
|
@@ -1849,6 +2072,7 @@ var marketplaceDashboardMarkdownRenderer = {
|
|
|
1849
2072
|
const stores = mockStores;
|
|
1850
2073
|
const products = mockProducts;
|
|
1851
2074
|
const orders = mockOrders;
|
|
2075
|
+
const visualizationItems = createMarketplaceVisualizationItems(products, orders);
|
|
1852
2076
|
const activeStores = stores.filter((s) => s.status === "ACTIVE");
|
|
1853
2077
|
const activeProducts = products.filter((p) => p.status === "ACTIVE");
|
|
1854
2078
|
const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
|
|
@@ -1868,11 +2092,17 @@ var marketplaceDashboardMarkdownRenderer = {
|
|
|
1868
2092
|
`| Total Revenue | ${formatCurrency2(totalRevenue)} |`,
|
|
1869
2093
|
`| Pending Orders | ${pendingOrders.length} |`,
|
|
1870
2094
|
"",
|
|
1871
|
-
"##
|
|
1872
|
-
""
|
|
1873
|
-
"| Store | Products | Rating | Status |",
|
|
1874
|
-
"|-------|----------|--------|--------|"
|
|
2095
|
+
"## Visualization Overview",
|
|
2096
|
+
""
|
|
1875
2097
|
];
|
|
2098
|
+
for (const item of visualizationItems) {
|
|
2099
|
+
lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
|
|
2100
|
+
}
|
|
2101
|
+
lines.push("");
|
|
2102
|
+
lines.push("## Top Stores");
|
|
2103
|
+
lines.push("");
|
|
2104
|
+
lines.push("| Store | Products | Rating | Status |");
|
|
2105
|
+
lines.push("|-------|----------|--------|--------|");
|
|
1876
2106
|
for (const store of stores.slice(0, 5)) {
|
|
1877
2107
|
lines.push(`| ${store.name} | ${store.productCount} | ⭐ ${store.rating || "N/A"} | ${store.status} |`);
|
|
1878
2108
|
}
|
|
@@ -1968,6 +2198,7 @@ export {
|
|
|
1968
2198
|
productCatalogMarkdownRenderer,
|
|
1969
2199
|
orderListMarkdownRenderer,
|
|
1970
2200
|
marketplaceDashboardMarkdownRenderer,
|
|
2201
|
+
createMarketplaceVisualizationItems,
|
|
1971
2202
|
createMarketplaceHandlers,
|
|
1972
2203
|
UpdateOrderStatusInputModel,
|
|
1973
2204
|
UpdateOrderStatusContract,
|
|
@@ -1995,7 +2226,13 @@ export {
|
|
|
1995
2226
|
OrderItemModel,
|
|
1996
2227
|
OrderCreatedEvent,
|
|
1997
2228
|
OrderCompletedEvent,
|
|
2229
|
+
MarketplaceVisualizationSpecs,
|
|
2230
|
+
MarketplaceVisualizationRegistry,
|
|
2231
|
+
MarketplaceVisualizationRefs,
|
|
2232
|
+
MarketplaceOrderStatusVisualization,
|
|
2233
|
+
MarketplaceOrderActivityVisualization,
|
|
1998
2234
|
MarketplaceDashboard,
|
|
2235
|
+
MarketplaceCategoryValueVisualization,
|
|
1999
2236
|
ListReviewsOutputModel,
|
|
2000
2237
|
ListReviewsInputModel,
|
|
2001
2238
|
ListReviewsContract,
|