@contractspec/example.marketplace 1.56.1 → 1.58.0
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/dist/browser/docs/index.js +103 -0
- package/dist/browser/docs/marketplace.docblock.js +103 -0
- package/dist/browser/entities/index.js +721 -0
- package/dist/browser/entities/order.js +167 -0
- package/dist/browser/entities/payout.js +142 -0
- package/dist/browser/entities/product.js +152 -0
- package/dist/browser/entities/review.js +129 -0
- package/dist/browser/entities/store.js +97 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +303 -0
- package/dist/browser/handlers/marketplace.handlers.js +303 -0
- package/dist/browser/index.js +2016 -0
- package/dist/browser/marketplace.capability.js +40 -0
- package/dist/browser/marketplace.feature.js +137 -0
- package/dist/browser/order/index.js +307 -0
- package/dist/browser/order/order.enum.js +17 -0
- package/dist/browser/order/order.event.js +131 -0
- package/dist/browser/order/order.operations.js +172 -0
- package/dist/browser/order/order.presentation.js +153 -0
- package/dist/browser/order/order.schema.js +79 -0
- package/dist/browser/payout/index.js +152 -0
- package/dist/browser/payout/payout.enum.js +12 -0
- package/dist/browser/payout/payout.event.js +55 -0
- package/dist/browser/payout/payout.operations.js +94 -0
- package/dist/browser/payout/payout.presentation.js +111 -0
- package/dist/browser/payout/payout.schema.js +61 -0
- package/dist/browser/product/index.js +249 -0
- package/dist/browser/product/product.enum.js +13 -0
- package/dist/browser/product/product.event.js +74 -0
- package/dist/browser/product/product.operations.js +171 -0
- package/dist/browser/product/product.presentation.js +158 -0
- package/dist/browser/product/product.schema.js +84 -0
- package/dist/browser/review/index.js +206 -0
- package/dist/browser/review/review.enum.js +11 -0
- package/dist/browser/review/review.event.js +50 -0
- package/dist/browser/review/review.operations.js +152 -0
- package/dist/browser/review/review.presentation.js +123 -0
- package/dist/browser/review/review.schema.js +74 -0
- package/dist/browser/seeders/index.js +12 -0
- package/dist/browser/store/index.js +142 -0
- package/dist/browser/store/store.enum.js +11 -0
- package/dist/browser/store/store.event.js +52 -0
- package/dist/browser/store/store.operations.js +88 -0
- package/dist/browser/store/store.presentation.js +94 -0
- package/dist/browser/store/store.schema.js +43 -0
- package/dist/browser/tests/operations.test-spec.js +139 -0
- package/dist/browser/ui/MarketplaceDashboard.js +418 -0
- package/dist/browser/ui/hooks/index.js +59 -0
- package/dist/browser/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/browser/ui/index.js +668 -0
- package/dist/browser/ui/renderers/index.js +248 -0
- package/dist/browser/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +104 -1
- package/dist/docs/marketplace.docblock.d.ts +2 -1
- package/dist/docs/marketplace.docblock.d.ts.map +1 -0
- package/dist/docs/marketplace.docblock.js +46 -57
- package/dist/entities/index.d.ts +302 -307
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +719 -43
- package/dist/entities/order.d.ts +77 -82
- package/dist/entities/order.d.ts.map +1 -1
- package/dist/entities/order.js +162 -167
- package/dist/entities/payout.d.ts +64 -69
- package/dist/entities/payout.d.ts.map +1 -1
- package/dist/entities/payout.js +137 -156
- package/dist/entities/product.d.ts +69 -74
- package/dist/entities/product.d.ts.map +1 -1
- package/dist/entities/product.js +148 -156
- package/dist/entities/review.d.ts +55 -60
- package/dist/entities/review.d.ts.map +1 -1
- package/dist/entities/review.js +124 -146
- package/dist/entities/store.d.ts +40 -45
- package/dist/entities/store.d.ts.map +1 -1
- package/dist/entities/store.js +94 -106
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +40 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +304 -3
- package/dist/handlers/marketplace.handlers.d.ts +138 -138
- package/dist/handlers/marketplace.handlers.d.ts.map +1 -1
- package/dist/handlers/marketplace.handlers.js +284 -309
- package/dist/index.d.ts +13 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2017 -32
- package/dist/marketplace.capability.d.ts +3 -8
- package/dist/marketplace.capability.d.ts.map +1 -1
- package/dist/marketplace.capability.js +41 -34
- package/dist/marketplace.feature.d.ts +1 -7
- package/dist/marketplace.feature.d.ts.map +1 -1
- package/dist/marketplace.feature.js +136 -313
- package/dist/node/docs/index.js +103 -0
- package/dist/node/docs/marketplace.docblock.js +103 -0
- package/dist/node/entities/index.js +721 -0
- package/dist/node/entities/order.js +167 -0
- package/dist/node/entities/payout.js +142 -0
- package/dist/node/entities/product.js +152 -0
- package/dist/node/entities/review.js +129 -0
- package/dist/node/entities/store.js +97 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +303 -0
- package/dist/node/handlers/marketplace.handlers.js +303 -0
- package/dist/node/index.js +2016 -0
- package/dist/node/marketplace.capability.js +40 -0
- package/dist/node/marketplace.feature.js +137 -0
- package/dist/node/order/index.js +307 -0
- package/dist/node/order/order.enum.js +17 -0
- package/dist/node/order/order.event.js +131 -0
- package/dist/node/order/order.operations.js +172 -0
- package/dist/node/order/order.presentation.js +153 -0
- package/dist/node/order/order.schema.js +79 -0
- package/dist/node/payout/index.js +152 -0
- package/dist/node/payout/payout.enum.js +12 -0
- package/dist/node/payout/payout.event.js +55 -0
- package/dist/node/payout/payout.operations.js +94 -0
- package/dist/node/payout/payout.presentation.js +111 -0
- package/dist/node/payout/payout.schema.js +61 -0
- package/dist/node/product/index.js +249 -0
- package/dist/node/product/product.enum.js +13 -0
- package/dist/node/product/product.event.js +74 -0
- package/dist/node/product/product.operations.js +171 -0
- package/dist/node/product/product.presentation.js +158 -0
- package/dist/node/product/product.schema.js +84 -0
- package/dist/node/review/index.js +206 -0
- package/dist/node/review/review.enum.js +11 -0
- package/dist/node/review/review.event.js +50 -0
- package/dist/node/review/review.operations.js +152 -0
- package/dist/node/review/review.presentation.js +123 -0
- package/dist/node/review/review.schema.js +74 -0
- package/dist/node/seeders/index.js +12 -0
- package/dist/node/store/index.js +142 -0
- package/dist/node/store/store.enum.js +11 -0
- package/dist/node/store/store.event.js +52 -0
- package/dist/node/store/store.operations.js +88 -0
- package/dist/node/store/store.presentation.js +94 -0
- package/dist/node/store/store.schema.js +43 -0
- package/dist/node/tests/operations.test-spec.js +139 -0
- package/dist/node/ui/MarketplaceDashboard.js +418 -0
- package/dist/node/ui/hooks/index.js +59 -0
- package/dist/node/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/node/ui/index.js +668 -0
- package/dist/node/ui/renderers/index.js +248 -0
- package/dist/node/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/order/index.d.ts +8 -5
- package/dist/order/index.d.ts.map +1 -0
- package/dist/order/index.js +307 -5
- package/dist/order/order.enum.d.ts +1 -6
- package/dist/order/order.enum.d.ts.map +1 -1
- package/dist/order/order.enum.js +16 -20
- package/dist/order/order.event.d.ts +133 -139
- package/dist/order/order.event.d.ts.map +1 -1
- package/dist/order/order.event.js +121 -205
- package/dist/order/order.operations.d.ts +291 -297
- package/dist/order/order.operations.d.ts.map +1 -1
- package/dist/order/order.operations.js +169 -115
- package/dist/order/order.presentation.d.ts +3 -8
- package/dist/order/order.presentation.d.ts.map +1 -1
- package/dist/order/order.presentation.js +149 -81
- package/dist/order/order.schema.d.ts +143 -148
- package/dist/order/order.schema.d.ts.map +1 -1
- package/dist/order/order.schema.js +75 -150
- package/dist/payout/index.d.ts +8 -5
- package/dist/payout/index.d.ts.map +1 -0
- package/dist/payout/index.js +152 -5
- package/dist/payout/payout.enum.d.ts +1 -6
- package/dist/payout/payout.enum.d.ts.map +1 -1
- package/dist/payout/payout.enum.js +11 -15
- package/dist/payout/payout.event.d.ts +54 -60
- package/dist/payout/payout.event.d.ts.map +1 -1
- package/dist/payout/payout.event.js +51 -87
- package/dist/payout/payout.operations.d.ts +82 -88
- package/dist/payout/payout.operations.d.ts.map +1 -1
- package/dist/payout/payout.operations.js +92 -50
- package/dist/payout/payout.presentation.d.ts +2 -7
- package/dist/payout/payout.presentation.d.ts.map +1 -1
- package/dist/payout/payout.presentation.js +108 -56
- package/dist/payout/payout.schema.d.ts +139 -144
- package/dist/payout/payout.schema.d.ts.map +1 -1
- package/dist/payout/payout.schema.js +58 -112
- package/dist/product/index.d.ts +8 -5
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +249 -5
- package/dist/product/product.enum.d.ts +1 -6
- package/dist/product/product.enum.d.ts.map +1 -1
- package/dist/product/product.enum.js +12 -16
- package/dist/product/product.event.d.ts +63 -69
- package/dist/product/product.event.d.ts.map +1 -1
- package/dist/product/product.event.js +68 -113
- package/dist/product/product.operations.d.ts +225 -231
- package/dist/product/product.operations.d.ts.map +1 -1
- package/dist/product/product.operations.js +168 -104
- package/dist/product/product.presentation.d.ts +3 -8
- package/dist/product/product.presentation.d.ts.map +1 -1
- package/dist/product/product.presentation.js +154 -81
- package/dist/product/product.schema.d.ts +196 -201
- package/dist/product/product.schema.d.ts.map +1 -1
- package/dist/product/product.schema.js +80 -171
- package/dist/review/index.d.ts +8 -5
- package/dist/review/index.d.ts.map +1 -0
- package/dist/review/index.js +206 -5
- package/dist/review/review.enum.d.ts +1 -6
- package/dist/review/review.enum.d.ts.map +1 -1
- package/dist/review/review.enum.js +10 -14
- package/dist/review/review.event.d.ts +46 -52
- package/dist/review/review.event.d.ts.map +1 -1
- package/dist/review/review.event.js +46 -79
- package/dist/review/review.operations.d.ts +190 -196
- package/dist/review/review.operations.d.ts.map +1 -1
- package/dist/review/review.operations.js +149 -102
- package/dist/review/review.presentation.d.ts +2 -7
- package/dist/review/review.presentation.d.ts.map +1 -1
- package/dist/review/review.presentation.js +120 -56
- package/dist/review/review.schema.d.ts +164 -169
- package/dist/review/review.schema.d.ts.map +1 -1
- package/dist/review/review.schema.js +70 -151
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +11 -16
- package/dist/store/index.d.ts +8 -5
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +142 -5
- package/dist/store/store.enum.d.ts +1 -6
- package/dist/store/store.enum.d.ts.map +1 -1
- package/dist/store/store.enum.js +10 -14
- package/dist/store/store.event.d.ts +42 -48
- package/dist/store/store.event.d.ts.map +1 -1
- package/dist/store/store.event.js +48 -75
- package/dist/store/store.operations.d.ts +98 -104
- package/dist/store/store.operations.d.ts.map +1 -1
- package/dist/store/store.operations.js +86 -58
- package/dist/store/store.presentation.d.ts +2 -7
- package/dist/store/store.presentation.d.ts.map +1 -1
- package/dist/store/store.presentation.js +91 -56
- package/dist/store/store.schema.d.ts +70 -75
- package/dist/store/store.schema.d.ts.map +1 -1
- package/dist/store/store.schema.js +41 -90
- package/dist/tests/operations.test-spec.d.ts +5 -10
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +134 -146
- package/dist/ui/MarketplaceDashboard.d.ts +1 -6
- package/dist/ui/MarketplaceDashboard.d.ts.map +1 -1
- package/dist/ui/MarketplaceDashboard.js +413 -313
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +59 -4
- package/dist/ui/hooks/useMarketplaceData.d.ts +16 -20
- package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -1
- package/dist/ui/hooks/useMarketplaceData.js +53 -60
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +668 -5
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +249 -3
- package/dist/ui/renderers/marketplace.markdown.d.ts +13 -15
- package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/marketplace.markdown.js +241 -236
- package/package.json +529 -110
- package/dist/docs/marketplace.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/order.js.map +0 -1
- package/dist/entities/payout.js.map +0 -1
- package/dist/entities/product.js.map +0 -1
- package/dist/entities/review.js.map +0 -1
- package/dist/entities/store.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/marketplace.handlers.js.map +0 -1
- package/dist/marketplace.capability.js.map +0 -1
- package/dist/marketplace.feature.js.map +0 -1
- package/dist/order/order.enum.js.map +0 -1
- package/dist/order/order.event.js.map +0 -1
- package/dist/order/order.operations.js.map +0 -1
- package/dist/order/order.presentation.js.map +0 -1
- package/dist/order/order.schema.js.map +0 -1
- package/dist/payout/payout.enum.js.map +0 -1
- package/dist/payout/payout.event.js.map +0 -1
- package/dist/payout/payout.operations.js.map +0 -1
- package/dist/payout/payout.presentation.js.map +0 -1
- package/dist/payout/payout.schema.js.map +0 -1
- package/dist/product/product.enum.js.map +0 -1
- package/dist/product/product.event.js.map +0 -1
- package/dist/product/product.operations.js.map +0 -1
- package/dist/product/product.presentation.js.map +0 -1
- package/dist/product/product.schema.js.map +0 -1
- package/dist/review/review.enum.js.map +0 -1
- package/dist/review/review.event.js.map +0 -1
- package/dist/review/review.operations.js.map +0 -1
- package/dist/review/review.presentation.js.map +0 -1
- package/dist/review/review.schema.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/store/store.enum.js.map +0 -1
- package/dist/store/store.event.js.map +0 -1
- package/dist/store/store.operations.js.map +0 -1
- package/dist/store/store.presentation.js.map +0 -1
- package/dist/store/store.schema.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/MarketplaceDashboard.js.map +0 -1
- package/dist/ui/hooks/useMarketplaceData.js.map +0 -1
- package/dist/ui/renderers/marketplace.markdown.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,669 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/renderers/marketplace.markdown.ts
|
|
3
|
+
var mockStores = [
|
|
4
|
+
{
|
|
5
|
+
id: "store-1",
|
|
6
|
+
name: "Tech Gadgets Store",
|
|
7
|
+
status: "ACTIVE",
|
|
8
|
+
productCount: 45,
|
|
9
|
+
rating: 4.8
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "store-2",
|
|
13
|
+
name: "Home & Garden",
|
|
14
|
+
status: "ACTIVE",
|
|
15
|
+
productCount: 120,
|
|
16
|
+
rating: 4.5
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "store-3",
|
|
20
|
+
name: "Fashion Boutique",
|
|
21
|
+
status: "PENDING",
|
|
22
|
+
productCount: 0,
|
|
23
|
+
rating: 0
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
var mockProducts = [
|
|
27
|
+
{
|
|
28
|
+
id: "prod-1",
|
|
29
|
+
name: "Wireless Earbuds",
|
|
30
|
+
storeId: "store-1",
|
|
31
|
+
price: 79.99,
|
|
32
|
+
currency: "USD",
|
|
33
|
+
status: "ACTIVE",
|
|
34
|
+
stock: 150
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "prod-2",
|
|
38
|
+
name: "Smart Watch",
|
|
39
|
+
storeId: "store-1",
|
|
40
|
+
price: 249.99,
|
|
41
|
+
currency: "USD",
|
|
42
|
+
status: "ACTIVE",
|
|
43
|
+
stock: 50
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "prod-3",
|
|
47
|
+
name: "Garden Tools Set",
|
|
48
|
+
storeId: "store-2",
|
|
49
|
+
price: 89.99,
|
|
50
|
+
currency: "USD",
|
|
51
|
+
status: "ACTIVE",
|
|
52
|
+
stock: 30
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "prod-4",
|
|
56
|
+
name: "Indoor Plant Kit",
|
|
57
|
+
storeId: "store-2",
|
|
58
|
+
price: 45.99,
|
|
59
|
+
currency: "USD",
|
|
60
|
+
status: "ACTIVE",
|
|
61
|
+
stock: 75
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "prod-5",
|
|
65
|
+
name: "LED Desk Lamp",
|
|
66
|
+
storeId: "store-1",
|
|
67
|
+
price: 34.99,
|
|
68
|
+
currency: "USD",
|
|
69
|
+
status: "OUT_OF_STOCK",
|
|
70
|
+
stock: 0
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
var mockOrders = [
|
|
74
|
+
{
|
|
75
|
+
id: "ord-1",
|
|
76
|
+
storeId: "store-1",
|
|
77
|
+
customerId: "cust-1",
|
|
78
|
+
total: 329.98,
|
|
79
|
+
currency: "USD",
|
|
80
|
+
status: "DELIVERED",
|
|
81
|
+
itemCount: 2,
|
|
82
|
+
createdAt: "2024-01-15T10:00:00Z"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "ord-2",
|
|
86
|
+
storeId: "store-2",
|
|
87
|
+
customerId: "cust-2",
|
|
88
|
+
total: 135.98,
|
|
89
|
+
currency: "USD",
|
|
90
|
+
status: "SHIPPED",
|
|
91
|
+
itemCount: 2,
|
|
92
|
+
createdAt: "2024-01-14T14:00:00Z"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "ord-3",
|
|
96
|
+
storeId: "store-1",
|
|
97
|
+
customerId: "cust-3",
|
|
98
|
+
total: 79.99,
|
|
99
|
+
currency: "USD",
|
|
100
|
+
status: "PROCESSING",
|
|
101
|
+
itemCount: 1,
|
|
102
|
+
createdAt: "2024-01-16T08:00:00Z"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "ord-4",
|
|
106
|
+
storeId: "store-2",
|
|
107
|
+
customerId: "cust-4",
|
|
108
|
+
total: 45.99,
|
|
109
|
+
currency: "USD",
|
|
110
|
+
status: "PENDING",
|
|
111
|
+
itemCount: 1,
|
|
112
|
+
createdAt: "2024-01-16T12:00:00Z"
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
function formatCurrency(value, currency = "USD") {
|
|
116
|
+
return new Intl.NumberFormat("en-US", {
|
|
117
|
+
style: "currency",
|
|
118
|
+
currency,
|
|
119
|
+
minimumFractionDigits: 2
|
|
120
|
+
}).format(value);
|
|
121
|
+
}
|
|
122
|
+
var marketplaceDashboardMarkdownRenderer = {
|
|
123
|
+
target: "markdown",
|
|
124
|
+
render: async (desc) => {
|
|
125
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "MarketplaceDashboard") {
|
|
126
|
+
throw new Error("marketplaceDashboardMarkdownRenderer: not MarketplaceDashboard");
|
|
127
|
+
}
|
|
128
|
+
const stores = mockStores;
|
|
129
|
+
const products = mockProducts;
|
|
130
|
+
const orders = mockOrders;
|
|
131
|
+
const activeStores = stores.filter((s) => s.status === "ACTIVE");
|
|
132
|
+
const activeProducts = products.filter((p) => p.status === "ACTIVE");
|
|
133
|
+
const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
|
|
134
|
+
const pendingOrders = orders.filter((o) => o.status === "PENDING" || o.status === "PROCESSING");
|
|
135
|
+
const lines = [
|
|
136
|
+
"# Marketplace Dashboard",
|
|
137
|
+
"",
|
|
138
|
+
"> Two-sided marketplace overview",
|
|
139
|
+
"",
|
|
140
|
+
"## Summary",
|
|
141
|
+
"",
|
|
142
|
+
"| Metric | Value |",
|
|
143
|
+
"|--------|-------|",
|
|
144
|
+
`| Active Stores | ${activeStores.length} |`,
|
|
145
|
+
`| Active Products | ${activeProducts.length} |`,
|
|
146
|
+
`| Total Orders | ${orders.length} |`,
|
|
147
|
+
`| Total Revenue | ${formatCurrency(totalRevenue)} |`,
|
|
148
|
+
`| Pending Orders | ${pendingOrders.length} |`,
|
|
149
|
+
"",
|
|
150
|
+
"## Top Stores",
|
|
151
|
+
"",
|
|
152
|
+
"| Store | Products | Rating | Status |",
|
|
153
|
+
"|-------|----------|--------|--------|"
|
|
154
|
+
];
|
|
155
|
+
for (const store of stores.slice(0, 5)) {
|
|
156
|
+
lines.push(`| ${store.name} | ${store.productCount} | \u2B50 ${store.rating || "N/A"} | ${store.status} |`);
|
|
157
|
+
}
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push("## Recent Orders");
|
|
160
|
+
lines.push("");
|
|
161
|
+
lines.push("| Order | Items | Total | Status | Date |");
|
|
162
|
+
lines.push("|-------|-------|-------|--------|------|");
|
|
163
|
+
for (const order of orders.slice(0, 10)) {
|
|
164
|
+
const date = new Date(order.createdAt).toLocaleDateString();
|
|
165
|
+
lines.push(`| ${order.id} | ${order.itemCount} | ${formatCurrency(order.total, order.currency)} | ${order.status} | ${date} |`);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
mimeType: "text/markdown",
|
|
169
|
+
body: lines.join(`
|
|
170
|
+
`)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
var productCatalogMarkdownRenderer = {
|
|
175
|
+
target: "markdown",
|
|
176
|
+
render: async (desc) => {
|
|
177
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "ProductCatalog") {
|
|
178
|
+
throw new Error("productCatalogMarkdownRenderer: not ProductCatalog");
|
|
179
|
+
}
|
|
180
|
+
const products = mockProducts;
|
|
181
|
+
const stores = mockStores;
|
|
182
|
+
const lines = [
|
|
183
|
+
"# Product Catalog",
|
|
184
|
+
"",
|
|
185
|
+
"> Browse products across all marketplace stores",
|
|
186
|
+
""
|
|
187
|
+
];
|
|
188
|
+
for (const store of stores.filter((s) => s.status === "ACTIVE")) {
|
|
189
|
+
const storeProducts = products.filter((p) => p.storeId === store.id);
|
|
190
|
+
if (storeProducts.length === 0)
|
|
191
|
+
continue;
|
|
192
|
+
lines.push(`## ${store.name}`);
|
|
193
|
+
lines.push("");
|
|
194
|
+
lines.push("| Product | Price | Stock | Status |");
|
|
195
|
+
lines.push("|---------|-------|-------|--------|");
|
|
196
|
+
for (const product of storeProducts) {
|
|
197
|
+
const stockStatus = product.stock > 0 ? `${product.stock} in stock` : "Out of stock";
|
|
198
|
+
lines.push(`| ${product.name} | ${formatCurrency(product.price, product.currency)} | ${stockStatus} | ${product.status} |`);
|
|
199
|
+
}
|
|
200
|
+
lines.push("");
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
mimeType: "text/markdown",
|
|
204
|
+
body: lines.join(`
|
|
205
|
+
`)
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var orderListMarkdownRenderer = {
|
|
210
|
+
target: "markdown",
|
|
211
|
+
render: async (desc) => {
|
|
212
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "OrderList") {
|
|
213
|
+
throw new Error("orderListMarkdownRenderer: not OrderList");
|
|
214
|
+
}
|
|
215
|
+
const orders = mockOrders;
|
|
216
|
+
const stores = mockStores;
|
|
217
|
+
const lines = [
|
|
218
|
+
"# Orders",
|
|
219
|
+
"",
|
|
220
|
+
"> Manage marketplace orders",
|
|
221
|
+
"",
|
|
222
|
+
"| Order ID | Store | Items | Total | Status | Created |",
|
|
223
|
+
"|----------|-------|-------|-------|--------|---------|"
|
|
224
|
+
];
|
|
225
|
+
for (const order of orders) {
|
|
226
|
+
const store = stores.find((s) => s.id === order.storeId);
|
|
227
|
+
const date = new Date(order.createdAt).toLocaleDateString();
|
|
228
|
+
lines.push(`| ${order.id} | ${store?.name ?? "Unknown"} | ${order.itemCount} | ${formatCurrency(order.total, order.currency)} | ${order.status} | ${date} |`);
|
|
229
|
+
}
|
|
230
|
+
lines.push("");
|
|
231
|
+
lines.push("## Order Status Legend");
|
|
232
|
+
lines.push("");
|
|
233
|
+
lines.push("- **PENDING**: Awaiting payment confirmation");
|
|
234
|
+
lines.push("- **PROCESSING**: Being prepared");
|
|
235
|
+
lines.push("- **SHIPPED**: In transit");
|
|
236
|
+
lines.push("- **DELIVERED**: Order completed");
|
|
237
|
+
lines.push("- **CANCELLED**: Order cancelled");
|
|
238
|
+
return {
|
|
239
|
+
mimeType: "text/markdown",
|
|
240
|
+
body: lines.join(`
|
|
241
|
+
`)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
// src/ui/hooks/useMarketplaceData.ts
|
|
246
|
+
import { useCallback, useEffect, useState } from "react";
|
|
247
|
+
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
248
|
+
"use client";
|
|
249
|
+
function useMarketplaceData(projectId = "local-project") {
|
|
250
|
+
const { handlers } = useTemplateRuntime();
|
|
251
|
+
const marketplace = handlers.marketplace;
|
|
252
|
+
const [stores, setStores] = useState([]);
|
|
253
|
+
const [products, setProducts] = useState([]);
|
|
254
|
+
const [orders, setOrders] = useState([]);
|
|
255
|
+
const [loading, setLoading] = useState(true);
|
|
256
|
+
const [error, setError] = useState(null);
|
|
257
|
+
const [totalRevenue, setTotalRevenue] = useState(0);
|
|
258
|
+
const fetchData = useCallback(async () => {
|
|
259
|
+
try {
|
|
260
|
+
setLoading(true);
|
|
261
|
+
setError(null);
|
|
262
|
+
const [storeResult, productResult, orderResult] = await Promise.all([
|
|
263
|
+
marketplace.listStores({ projectId, limit: 100 }),
|
|
264
|
+
marketplace.listProducts({ limit: 100 }),
|
|
265
|
+
marketplace.listOrders({ projectId, limit: 100 })
|
|
266
|
+
]);
|
|
267
|
+
setStores(storeResult.stores);
|
|
268
|
+
setProducts(productResult.products);
|
|
269
|
+
setOrders(orderResult.orders);
|
|
270
|
+
setTotalRevenue(orderResult.totalRevenue);
|
|
271
|
+
} catch (err) {
|
|
272
|
+
setError(err instanceof Error ? err : new Error("Failed to load marketplace"));
|
|
273
|
+
} finally {
|
|
274
|
+
setLoading(false);
|
|
275
|
+
}
|
|
276
|
+
}, [marketplace, projectId]);
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
fetchData();
|
|
279
|
+
}, [fetchData]);
|
|
280
|
+
const stats = {
|
|
281
|
+
totalStores: stores.length,
|
|
282
|
+
activeStores: stores.filter((s) => s.status === "ACTIVE").length,
|
|
283
|
+
totalProducts: products.length,
|
|
284
|
+
totalOrders: orders.length,
|
|
285
|
+
totalRevenue,
|
|
286
|
+
pendingOrders: orders.filter((o) => o.status === "PENDING").length
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
stores,
|
|
290
|
+
products,
|
|
291
|
+
orders,
|
|
292
|
+
loading,
|
|
293
|
+
error,
|
|
294
|
+
stats,
|
|
295
|
+
refetch: fetchData
|
|
296
|
+
};
|
|
297
|
+
}
|
|
5
298
|
|
|
6
|
-
|
|
299
|
+
// src/ui/MarketplaceDashboard.tsx
|
|
300
|
+
import { useState as useState2 } from "react";
|
|
301
|
+
import {
|
|
302
|
+
Button,
|
|
303
|
+
ErrorState,
|
|
304
|
+
LoaderBlock,
|
|
305
|
+
StatCard,
|
|
306
|
+
StatCardGroup
|
|
307
|
+
} from "@contractspec/lib.design-system";
|
|
308
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
309
|
+
"use client";
|
|
310
|
+
var STATUS_COLORS = {
|
|
311
|
+
ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
312
|
+
PENDING: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
313
|
+
SUSPENDED: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
|
314
|
+
DRAFT: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
|
|
315
|
+
OUT_OF_STOCK: "bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",
|
|
316
|
+
ARCHIVED: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
|
|
317
|
+
CONFIRMED: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",
|
|
318
|
+
PROCESSING: "bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400",
|
|
319
|
+
SHIPPED: "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",
|
|
320
|
+
DELIVERED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
321
|
+
CANCELLED: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"
|
|
322
|
+
};
|
|
323
|
+
function formatCurrency2(value, currency = "USD") {
|
|
324
|
+
return new Intl.NumberFormat("en-US", {
|
|
325
|
+
style: "currency",
|
|
326
|
+
currency,
|
|
327
|
+
minimumFractionDigits: 0,
|
|
328
|
+
maximumFractionDigits: 2
|
|
329
|
+
}).format(value);
|
|
330
|
+
}
|
|
331
|
+
function MarketplaceDashboard() {
|
|
332
|
+
const [activeTab, setActiveTab] = useState2("stores");
|
|
333
|
+
const { stores, products, orders, loading, error, stats, refetch } = useMarketplaceData();
|
|
334
|
+
const tabs = [
|
|
335
|
+
{ id: "stores", label: "Stores", icon: "\uD83C\uDFEA" },
|
|
336
|
+
{ id: "products", label: "Products", icon: "\uD83D\uDCE6" },
|
|
337
|
+
{ id: "orders", label: "Orders", icon: "\uD83D\uDED2" }
|
|
338
|
+
];
|
|
339
|
+
if (loading) {
|
|
340
|
+
return /* @__PURE__ */ jsxDEV(LoaderBlock, {
|
|
341
|
+
label: "Loading Marketplace..."
|
|
342
|
+
}, undefined, false, undefined, this);
|
|
343
|
+
}
|
|
344
|
+
if (error) {
|
|
345
|
+
return /* @__PURE__ */ jsxDEV(ErrorState, {
|
|
346
|
+
title: "Failed to load Marketplace",
|
|
347
|
+
description: error.message,
|
|
348
|
+
onRetry: refetch,
|
|
349
|
+
retryLabel: "Retry"
|
|
350
|
+
}, undefined, false, undefined, this);
|
|
351
|
+
}
|
|
352
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
353
|
+
className: "space-y-6",
|
|
354
|
+
children: [
|
|
355
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
356
|
+
className: "flex items-center justify-between",
|
|
357
|
+
children: [
|
|
358
|
+
/* @__PURE__ */ jsxDEV("h2", {
|
|
359
|
+
className: "text-2xl font-bold",
|
|
360
|
+
children: "Marketplace"
|
|
361
|
+
}, undefined, false, undefined, this),
|
|
362
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
363
|
+
onClick: () => alert("Create store modal"),
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
366
|
+
className: "mr-2",
|
|
367
|
+
children: "+"
|
|
368
|
+
}, undefined, false, undefined, this),
|
|
369
|
+
" New Store"
|
|
370
|
+
]
|
|
371
|
+
}, undefined, true, undefined, this)
|
|
372
|
+
]
|
|
373
|
+
}, undefined, true, undefined, this),
|
|
374
|
+
/* @__PURE__ */ jsxDEV(StatCardGroup, {
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
377
|
+
label: "Stores",
|
|
378
|
+
value: stats.totalStores,
|
|
379
|
+
hint: `${stats.activeStores} active`
|
|
380
|
+
}, undefined, false, undefined, this),
|
|
381
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
382
|
+
label: "Products",
|
|
383
|
+
value: stats.totalProducts,
|
|
384
|
+
hint: "listed"
|
|
385
|
+
}, undefined, false, undefined, this),
|
|
386
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
387
|
+
label: "Orders",
|
|
388
|
+
value: stats.totalOrders,
|
|
389
|
+
hint: `${stats.pendingOrders} pending`
|
|
390
|
+
}, undefined, false, undefined, this),
|
|
391
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
392
|
+
label: "Revenue",
|
|
393
|
+
value: formatCurrency2(stats.totalRevenue),
|
|
394
|
+
hint: "total"
|
|
395
|
+
}, undefined, false, undefined, this)
|
|
396
|
+
]
|
|
397
|
+
}, undefined, true, undefined, this),
|
|
398
|
+
/* @__PURE__ */ jsxDEV("nav", {
|
|
399
|
+
className: "bg-muted flex gap-1 rounded-lg p-1",
|
|
400
|
+
role: "tablist",
|
|
401
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV(Button, {
|
|
402
|
+
type: "button",
|
|
403
|
+
role: "tab",
|
|
404
|
+
"aria-selected": activeTab === tab.id,
|
|
405
|
+
onClick: () => setActiveTab(tab.id),
|
|
406
|
+
className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
409
|
+
children: tab.icon
|
|
410
|
+
}, undefined, false, undefined, this),
|
|
411
|
+
tab.label
|
|
412
|
+
]
|
|
413
|
+
}, tab.id, true, undefined, this))
|
|
414
|
+
}, undefined, false, undefined, this),
|
|
415
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
416
|
+
className: "min-h-[400px]",
|
|
417
|
+
role: "tabpanel",
|
|
418
|
+
children: [
|
|
419
|
+
activeTab === "stores" && /* @__PURE__ */ jsxDEV("div", {
|
|
420
|
+
className: "border-border rounded-lg border",
|
|
421
|
+
children: /* @__PURE__ */ jsxDEV("table", {
|
|
422
|
+
className: "w-full",
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ jsxDEV("thead", {
|
|
425
|
+
className: "border-border bg-muted/30 border-b",
|
|
426
|
+
children: /* @__PURE__ */ jsxDEV("tr", {
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
429
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
430
|
+
children: "Store"
|
|
431
|
+
}, undefined, false, undefined, this),
|
|
432
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
433
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
434
|
+
children: "Status"
|
|
435
|
+
}, undefined, false, undefined, this),
|
|
436
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
437
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
438
|
+
children: "Rating"
|
|
439
|
+
}, undefined, false, undefined, this),
|
|
440
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
441
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
442
|
+
children: "Reviews"
|
|
443
|
+
}, undefined, false, undefined, this)
|
|
444
|
+
]
|
|
445
|
+
}, undefined, true, undefined, this)
|
|
446
|
+
}, undefined, false, undefined, this),
|
|
447
|
+
/* @__PURE__ */ jsxDEV("tbody", {
|
|
448
|
+
className: "divide-border divide-y",
|
|
449
|
+
children: [
|
|
450
|
+
stores.map((store) => /* @__PURE__ */ jsxDEV("tr", {
|
|
451
|
+
className: "hover:bg-muted/50",
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
454
|
+
className: "px-4 py-3",
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
457
|
+
className: "font-medium",
|
|
458
|
+
children: store.name
|
|
459
|
+
}, undefined, false, undefined, this),
|
|
460
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
461
|
+
className: "text-muted-foreground text-sm",
|
|
462
|
+
children: store.description
|
|
463
|
+
}, undefined, false, undefined, this)
|
|
464
|
+
]
|
|
465
|
+
}, undefined, true, undefined, this),
|
|
466
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
467
|
+
className: "px-4 py-3",
|
|
468
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
469
|
+
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[store.status] ?? ""}`,
|
|
470
|
+
children: store.status
|
|
471
|
+
}, undefined, false, undefined, this)
|
|
472
|
+
}, undefined, false, undefined, this),
|
|
473
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
474
|
+
className: "px-4 py-3",
|
|
475
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
476
|
+
className: "flex items-center gap-1",
|
|
477
|
+
children: [
|
|
478
|
+
"\u2B50 ",
|
|
479
|
+
store.rating.toFixed(1)
|
|
480
|
+
]
|
|
481
|
+
}, undefined, true, undefined, this)
|
|
482
|
+
}, undefined, false, undefined, this),
|
|
483
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
484
|
+
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
485
|
+
children: [
|
|
486
|
+
store.reviewCount,
|
|
487
|
+
" reviews"
|
|
488
|
+
]
|
|
489
|
+
}, undefined, true, undefined, this)
|
|
490
|
+
]
|
|
491
|
+
}, store.id, true, undefined, this)),
|
|
492
|
+
stores.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
|
|
493
|
+
children: /* @__PURE__ */ jsxDEV("td", {
|
|
494
|
+
colSpan: 4,
|
|
495
|
+
className: "text-muted-foreground px-4 py-8 text-center",
|
|
496
|
+
children: "No stores found"
|
|
497
|
+
}, undefined, false, undefined, this)
|
|
498
|
+
}, undefined, false, undefined, this)
|
|
499
|
+
]
|
|
500
|
+
}, undefined, true, undefined, this)
|
|
501
|
+
]
|
|
502
|
+
}, undefined, true, undefined, this)
|
|
503
|
+
}, undefined, false, undefined, this),
|
|
504
|
+
activeTab === "products" && /* @__PURE__ */ jsxDEV("div", {
|
|
505
|
+
className: "border-border rounded-lg border",
|
|
506
|
+
children: /* @__PURE__ */ jsxDEV("table", {
|
|
507
|
+
className: "w-full",
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ jsxDEV("thead", {
|
|
510
|
+
className: "border-border bg-muted/30 border-b",
|
|
511
|
+
children: /* @__PURE__ */ jsxDEV("tr", {
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
514
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
515
|
+
children: "Product"
|
|
516
|
+
}, undefined, false, undefined, this),
|
|
517
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
518
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
519
|
+
children: "Price"
|
|
520
|
+
}, undefined, false, undefined, this),
|
|
521
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
522
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
523
|
+
children: "Stock"
|
|
524
|
+
}, undefined, false, undefined, this),
|
|
525
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
526
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
527
|
+
children: "Status"
|
|
528
|
+
}, undefined, false, undefined, this)
|
|
529
|
+
]
|
|
530
|
+
}, undefined, true, undefined, this)
|
|
531
|
+
}, undefined, false, undefined, this),
|
|
532
|
+
/* @__PURE__ */ jsxDEV("tbody", {
|
|
533
|
+
className: "divide-border divide-y",
|
|
534
|
+
children: [
|
|
535
|
+
products.map((product) => /* @__PURE__ */ jsxDEV("tr", {
|
|
536
|
+
className: "hover:bg-muted/50",
|
|
537
|
+
children: [
|
|
538
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
539
|
+
className: "px-4 py-3",
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
542
|
+
className: "font-medium",
|
|
543
|
+
children: product.name
|
|
544
|
+
}, undefined, false, undefined, this),
|
|
545
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
546
|
+
className: "text-muted-foreground text-sm",
|
|
547
|
+
children: product.category
|
|
548
|
+
}, undefined, false, undefined, this)
|
|
549
|
+
]
|
|
550
|
+
}, undefined, true, undefined, this),
|
|
551
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
552
|
+
className: "px-4 py-3 font-mono",
|
|
553
|
+
children: formatCurrency2(product.price, product.currency)
|
|
554
|
+
}, undefined, false, undefined, this),
|
|
555
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
556
|
+
className: "px-4 py-3",
|
|
557
|
+
children: product.stock
|
|
558
|
+
}, undefined, false, undefined, this),
|
|
559
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
560
|
+
className: "px-4 py-3",
|
|
561
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
562
|
+
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[product.status] ?? ""}`,
|
|
563
|
+
children: product.status
|
|
564
|
+
}, undefined, false, undefined, this)
|
|
565
|
+
}, undefined, false, undefined, this)
|
|
566
|
+
]
|
|
567
|
+
}, product.id, true, undefined, this)),
|
|
568
|
+
products.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
|
|
569
|
+
children: /* @__PURE__ */ jsxDEV("td", {
|
|
570
|
+
colSpan: 4,
|
|
571
|
+
className: "text-muted-foreground px-4 py-8 text-center",
|
|
572
|
+
children: "No products found"
|
|
573
|
+
}, undefined, false, undefined, this)
|
|
574
|
+
}, undefined, false, undefined, this)
|
|
575
|
+
]
|
|
576
|
+
}, undefined, true, undefined, this)
|
|
577
|
+
]
|
|
578
|
+
}, undefined, true, undefined, this)
|
|
579
|
+
}, undefined, false, undefined, this),
|
|
580
|
+
activeTab === "orders" && /* @__PURE__ */ jsxDEV("div", {
|
|
581
|
+
className: "border-border rounded-lg border",
|
|
582
|
+
children: /* @__PURE__ */ jsxDEV("table", {
|
|
583
|
+
className: "w-full",
|
|
584
|
+
children: [
|
|
585
|
+
/* @__PURE__ */ jsxDEV("thead", {
|
|
586
|
+
className: "border-border bg-muted/30 border-b",
|
|
587
|
+
children: /* @__PURE__ */ jsxDEV("tr", {
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
590
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
591
|
+
children: "Order ID"
|
|
592
|
+
}, undefined, false, undefined, this),
|
|
593
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
594
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
595
|
+
children: "Customer"
|
|
596
|
+
}, undefined, false, undefined, this),
|
|
597
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
598
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
599
|
+
children: "Total"
|
|
600
|
+
}, undefined, false, undefined, this),
|
|
601
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
602
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
603
|
+
children: "Status"
|
|
604
|
+
}, undefined, false, undefined, this),
|
|
605
|
+
/* @__PURE__ */ jsxDEV("th", {
|
|
606
|
+
className: "px-4 py-3 text-left text-sm font-medium",
|
|
607
|
+
children: "Date"
|
|
608
|
+
}, undefined, false, undefined, this)
|
|
609
|
+
]
|
|
610
|
+
}, undefined, true, undefined, this)
|
|
611
|
+
}, undefined, false, undefined, this),
|
|
612
|
+
/* @__PURE__ */ jsxDEV("tbody", {
|
|
613
|
+
className: "divide-border divide-y",
|
|
614
|
+
children: [
|
|
615
|
+
orders.map((order) => /* @__PURE__ */ jsxDEV("tr", {
|
|
616
|
+
className: "hover:bg-muted/50",
|
|
617
|
+
children: [
|
|
618
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
619
|
+
className: "px-4 py-3 font-mono text-sm",
|
|
620
|
+
children: order.id
|
|
621
|
+
}, undefined, false, undefined, this),
|
|
622
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
623
|
+
className: "px-4 py-3 text-sm",
|
|
624
|
+
children: order.customerId
|
|
625
|
+
}, undefined, false, undefined, this),
|
|
626
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
627
|
+
className: "px-4 py-3 font-mono",
|
|
628
|
+
children: formatCurrency2(order.total, order.currency)
|
|
629
|
+
}, undefined, false, undefined, this),
|
|
630
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
631
|
+
className: "px-4 py-3",
|
|
632
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
633
|
+
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[order.status] ?? ""}`,
|
|
634
|
+
children: order.status
|
|
635
|
+
}, undefined, false, undefined, this)
|
|
636
|
+
}, undefined, false, undefined, this),
|
|
637
|
+
/* @__PURE__ */ jsxDEV("td", {
|
|
638
|
+
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
639
|
+
children: order.createdAt.toLocaleDateString()
|
|
640
|
+
}, undefined, false, undefined, this)
|
|
641
|
+
]
|
|
642
|
+
}, order.id, true, undefined, this)),
|
|
643
|
+
orders.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
|
|
644
|
+
children: /* @__PURE__ */ jsxDEV("td", {
|
|
645
|
+
colSpan: 5,
|
|
646
|
+
className: "text-muted-foreground px-4 py-8 text-center",
|
|
647
|
+
children: "No orders found"
|
|
648
|
+
}, undefined, false, undefined, this)
|
|
649
|
+
}, undefined, false, undefined, this)
|
|
650
|
+
]
|
|
651
|
+
}, undefined, true, undefined, this)
|
|
652
|
+
]
|
|
653
|
+
}, undefined, true, undefined, this)
|
|
654
|
+
}, undefined, false, undefined, this)
|
|
655
|
+
]
|
|
656
|
+
}, undefined, true, undefined, this)
|
|
657
|
+
]
|
|
658
|
+
}, undefined, true, undefined, this);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// src/ui/hooks/index.ts
|
|
662
|
+
"use client";
|
|
663
|
+
export {
|
|
664
|
+
useMarketplaceData,
|
|
665
|
+
productCatalogMarkdownRenderer,
|
|
666
|
+
orderListMarkdownRenderer,
|
|
667
|
+
marketplaceDashboardMarkdownRenderer,
|
|
668
|
+
MarketplaceDashboard
|
|
669
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { marketplaceDashboardMarkdownRenderer, productCatalogMarkdownRenderer, orderListMarkdownRenderer, } from './marketplace.markdown';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/renderers/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oCAAoC,EACpC,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC"}
|