@contractspec/example.marketplace 3.7.5 → 3.7.7

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.
Files changed (60) hide show
  1. package/README.md +63 -131
  2. package/dist/browser/entities/index.js +470 -470
  3. package/dist/browser/index.js +945 -944
  4. package/dist/browser/order/index.js +155 -155
  5. package/dist/browser/order/order.event.js +1 -1
  6. package/dist/browser/payout/index.js +71 -71
  7. package/dist/browser/payout/payout.event.js +1 -1
  8. package/dist/browser/product/index.js +104 -104
  9. package/dist/browser/product/product.event.js +1 -1
  10. package/dist/browser/review/index.js +75 -75
  11. package/dist/browser/review/review.event.js +1 -1
  12. package/dist/browser/store/index.js +68 -68
  13. package/dist/browser/store/store.event.js +1 -1
  14. package/dist/browser/ui/MarketplaceDashboard.js +35 -35
  15. package/dist/browser/ui/hooks/index.js +1 -1
  16. package/dist/browser/ui/hooks/useMarketplaceData.js +1 -1
  17. package/dist/browser/ui/index.js +285 -284
  18. package/dist/entities/index.d.ts +110 -110
  19. package/dist/entities/index.js +470 -470
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +945 -944
  22. package/dist/node/entities/index.js +470 -470
  23. package/dist/node/index.js +945 -944
  24. package/dist/node/order/index.js +155 -155
  25. package/dist/node/order/order.event.js +1 -1
  26. package/dist/node/payout/index.js +71 -71
  27. package/dist/node/payout/payout.event.js +1 -1
  28. package/dist/node/product/index.js +104 -104
  29. package/dist/node/product/product.event.js +1 -1
  30. package/dist/node/review/index.js +75 -75
  31. package/dist/node/review/review.event.js +1 -1
  32. package/dist/node/store/index.js +68 -68
  33. package/dist/node/store/store.event.js +1 -1
  34. package/dist/node/ui/MarketplaceDashboard.js +35 -35
  35. package/dist/node/ui/hooks/index.js +1 -1
  36. package/dist/node/ui/hooks/useMarketplaceData.js +1 -1
  37. package/dist/node/ui/index.js +285 -284
  38. package/dist/order/index.d.ts +2 -2
  39. package/dist/order/index.js +155 -155
  40. package/dist/order/order.event.js +1 -1
  41. package/dist/payout/index.d.ts +2 -2
  42. package/dist/payout/index.js +71 -71
  43. package/dist/payout/payout.event.js +1 -1
  44. package/dist/product/index.d.ts +2 -2
  45. package/dist/product/index.js +104 -104
  46. package/dist/product/product.event.js +1 -1
  47. package/dist/review/index.d.ts +2 -2
  48. package/dist/review/index.js +75 -75
  49. package/dist/review/review.event.js +1 -1
  50. package/dist/store/index.d.ts +2 -2
  51. package/dist/store/index.js +68 -68
  52. package/dist/store/store.event.js +1 -1
  53. package/dist/ui/MarketplaceDashboard.js +35 -35
  54. package/dist/ui/hooks/index.d.ts +1 -1
  55. package/dist/ui/hooks/index.js +1 -1
  56. package/dist/ui/hooks/useMarketplaceData.js +1 -1
  57. package/dist/ui/index.d.ts +2 -2
  58. package/dist/ui/index.js +285 -284
  59. package/dist/ui/renderers/index.d.ts +1 -1
  60. package/package.json +10 -10
package/dist/ui/index.js CHANGED
@@ -1,250 +1,7 @@
1
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
2
  // src/ui/hooks/useMarketplaceData.ts
246
- import { useCallback, useEffect, useState } from "react";
247
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useState } from "react";
248
5
  "use client";
249
6
  function useMarketplaceData(projectId = "local-project") {
250
7
  const { handlers } = useTemplateRuntime();
@@ -296,8 +53,10 @@ function useMarketplaceData(projectId = "local-project") {
296
53
  };
297
54
  }
298
55
 
56
+ // src/ui/hooks/index.ts
57
+ "use client";
58
+
299
59
  // src/ui/MarketplaceDashboard.tsx
300
- import { useState as useState2 } from "react";
301
60
  import {
302
61
  Button,
303
62
  ErrorState,
@@ -305,6 +64,7 @@ import {
305
64
  StatCard,
306
65
  StatCardGroup
307
66
  } from "@contractspec/lib.design-system";
67
+ import { useState as useState2 } from "react";
308
68
  import { jsxDEV } from "react/jsx-dev-runtime";
309
69
  "use client";
310
70
  var STATUS_COLORS = {
@@ -320,7 +80,7 @@ var STATUS_COLORS = {
320
80
  DELIVERED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
321
81
  CANCELLED: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"
322
82
  };
323
- function formatCurrency2(value, currency = "USD") {
83
+ function formatCurrency(value, currency = "USD") {
324
84
  return new Intl.NumberFormat("en-US", {
325
85
  style: "currency",
326
86
  currency,
@@ -356,7 +116,7 @@ function MarketplaceDashboard() {
356
116
  className: "flex items-center justify-between",
357
117
  children: [
358
118
  /* @__PURE__ */ jsxDEV("h2", {
359
- className: "text-2xl font-bold",
119
+ className: "font-bold text-2xl",
360
120
  children: "Marketplace"
361
121
  }, undefined, false, undefined, this),
362
122
  /* @__PURE__ */ jsxDEV(Button, {
@@ -390,20 +150,20 @@ function MarketplaceDashboard() {
390
150
  }, undefined, false, undefined, this),
391
151
  /* @__PURE__ */ jsxDEV(StatCard, {
392
152
  label: "Revenue",
393
- value: formatCurrency2(stats.totalRevenue),
153
+ value: formatCurrency(stats.totalRevenue),
394
154
  hint: "total"
395
155
  }, undefined, false, undefined, this)
396
156
  ]
397
157
  }, undefined, true, undefined, this),
398
158
  /* @__PURE__ */ jsxDEV("nav", {
399
- className: "bg-muted flex gap-1 rounded-lg p-1",
159
+ className: "flex gap-1 rounded-lg bg-muted p-1",
400
160
  role: "tablist",
401
161
  children: tabs.map((tab) => /* @__PURE__ */ jsxDEV(Button, {
402
162
  type: "button",
403
163
  role: "tab",
404
164
  "aria-selected": activeTab === tab.id,
405
165
  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"}`,
166
+ 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"}`,
407
167
  children: [
408
168
  /* @__PURE__ */ jsxDEV("span", {
409
169
  children: tab.icon
@@ -417,35 +177,35 @@ function MarketplaceDashboard() {
417
177
  role: "tabpanel",
418
178
  children: [
419
179
  activeTab === "stores" && /* @__PURE__ */ jsxDEV("div", {
420
- className: "border-border rounded-lg border",
180
+ className: "rounded-lg border border-border",
421
181
  children: /* @__PURE__ */ jsxDEV("table", {
422
182
  className: "w-full",
423
183
  children: [
424
184
  /* @__PURE__ */ jsxDEV("thead", {
425
- className: "border-border bg-muted/30 border-b",
185
+ className: "border-border border-b bg-muted/30",
426
186
  children: /* @__PURE__ */ jsxDEV("tr", {
427
187
  children: [
428
188
  /* @__PURE__ */ jsxDEV("th", {
429
- className: "px-4 py-3 text-left text-sm font-medium",
189
+ className: "px-4 py-3 text-left font-medium text-sm",
430
190
  children: "Store"
431
191
  }, undefined, false, undefined, this),
432
192
  /* @__PURE__ */ jsxDEV("th", {
433
- className: "px-4 py-3 text-left text-sm font-medium",
193
+ className: "px-4 py-3 text-left font-medium text-sm",
434
194
  children: "Status"
435
195
  }, undefined, false, undefined, this),
436
196
  /* @__PURE__ */ jsxDEV("th", {
437
- className: "px-4 py-3 text-left text-sm font-medium",
197
+ className: "px-4 py-3 text-left font-medium text-sm",
438
198
  children: "Rating"
439
199
  }, undefined, false, undefined, this),
440
200
  /* @__PURE__ */ jsxDEV("th", {
441
- className: "px-4 py-3 text-left text-sm font-medium",
201
+ className: "px-4 py-3 text-left font-medium text-sm",
442
202
  children: "Reviews"
443
203
  }, undefined, false, undefined, this)
444
204
  ]
445
205
  }, undefined, true, undefined, this)
446
206
  }, undefined, false, undefined, this),
447
207
  /* @__PURE__ */ jsxDEV("tbody", {
448
- className: "divide-border divide-y",
208
+ className: "divide-y divide-border",
449
209
  children: [
450
210
  stores.map((store) => /* @__PURE__ */ jsxDEV("tr", {
451
211
  className: "hover:bg-muted/50",
@@ -466,7 +226,7 @@ function MarketplaceDashboard() {
466
226
  /* @__PURE__ */ jsxDEV("td", {
467
227
  className: "px-4 py-3",
468
228
  children: /* @__PURE__ */ jsxDEV("span", {
469
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[store.status] ?? ""}`,
229
+ className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[store.status] ?? ""}`,
470
230
  children: store.status
471
231
  }, undefined, false, undefined, this)
472
232
  }, undefined, false, undefined, this),
@@ -481,7 +241,7 @@ function MarketplaceDashboard() {
481
241
  }, undefined, true, undefined, this)
482
242
  }, undefined, false, undefined, this),
483
243
  /* @__PURE__ */ jsxDEV("td", {
484
- className: "text-muted-foreground px-4 py-3 text-sm",
244
+ className: "px-4 py-3 text-muted-foreground text-sm",
485
245
  children: [
486
246
  store.reviewCount,
487
247
  " reviews"
@@ -492,7 +252,7 @@ function MarketplaceDashboard() {
492
252
  stores.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
493
253
  children: /* @__PURE__ */ jsxDEV("td", {
494
254
  colSpan: 4,
495
- className: "text-muted-foreground px-4 py-8 text-center",
255
+ className: "px-4 py-8 text-center text-muted-foreground",
496
256
  children: "No stores found"
497
257
  }, undefined, false, undefined, this)
498
258
  }, undefined, false, undefined, this)
@@ -502,35 +262,35 @@ function MarketplaceDashboard() {
502
262
  }, undefined, true, undefined, this)
503
263
  }, undefined, false, undefined, this),
504
264
  activeTab === "products" && /* @__PURE__ */ jsxDEV("div", {
505
- className: "border-border rounded-lg border",
265
+ className: "rounded-lg border border-border",
506
266
  children: /* @__PURE__ */ jsxDEV("table", {
507
267
  className: "w-full",
508
268
  children: [
509
269
  /* @__PURE__ */ jsxDEV("thead", {
510
- className: "border-border bg-muted/30 border-b",
270
+ className: "border-border border-b bg-muted/30",
511
271
  children: /* @__PURE__ */ jsxDEV("tr", {
512
272
  children: [
513
273
  /* @__PURE__ */ jsxDEV("th", {
514
- className: "px-4 py-3 text-left text-sm font-medium",
274
+ className: "px-4 py-3 text-left font-medium text-sm",
515
275
  children: "Product"
516
276
  }, undefined, false, undefined, this),
517
277
  /* @__PURE__ */ jsxDEV("th", {
518
- className: "px-4 py-3 text-left text-sm font-medium",
278
+ className: "px-4 py-3 text-left font-medium text-sm",
519
279
  children: "Price"
520
280
  }, undefined, false, undefined, this),
521
281
  /* @__PURE__ */ jsxDEV("th", {
522
- className: "px-4 py-3 text-left text-sm font-medium",
282
+ className: "px-4 py-3 text-left font-medium text-sm",
523
283
  children: "Stock"
524
284
  }, undefined, false, undefined, this),
525
285
  /* @__PURE__ */ jsxDEV("th", {
526
- className: "px-4 py-3 text-left text-sm font-medium",
286
+ className: "px-4 py-3 text-left font-medium text-sm",
527
287
  children: "Status"
528
288
  }, undefined, false, undefined, this)
529
289
  ]
530
290
  }, undefined, true, undefined, this)
531
291
  }, undefined, false, undefined, this),
532
292
  /* @__PURE__ */ jsxDEV("tbody", {
533
- className: "divide-border divide-y",
293
+ className: "divide-y divide-border",
534
294
  children: [
535
295
  products.map((product) => /* @__PURE__ */ jsxDEV("tr", {
536
296
  className: "hover:bg-muted/50",
@@ -550,7 +310,7 @@ function MarketplaceDashboard() {
550
310
  }, undefined, true, undefined, this),
551
311
  /* @__PURE__ */ jsxDEV("td", {
552
312
  className: "px-4 py-3 font-mono",
553
- children: formatCurrency2(product.price, product.currency)
313
+ children: formatCurrency(product.price, product.currency)
554
314
  }, undefined, false, undefined, this),
555
315
  /* @__PURE__ */ jsxDEV("td", {
556
316
  className: "px-4 py-3",
@@ -559,7 +319,7 @@ function MarketplaceDashboard() {
559
319
  /* @__PURE__ */ jsxDEV("td", {
560
320
  className: "px-4 py-3",
561
321
  children: /* @__PURE__ */ jsxDEV("span", {
562
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[product.status] ?? ""}`,
322
+ className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[product.status] ?? ""}`,
563
323
  children: product.status
564
324
  }, undefined, false, undefined, this)
565
325
  }, undefined, false, undefined, this)
@@ -568,7 +328,7 @@ function MarketplaceDashboard() {
568
328
  products.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
569
329
  children: /* @__PURE__ */ jsxDEV("td", {
570
330
  colSpan: 4,
571
- className: "text-muted-foreground px-4 py-8 text-center",
331
+ className: "px-4 py-8 text-center text-muted-foreground",
572
332
  children: "No products found"
573
333
  }, undefined, false, undefined, this)
574
334
  }, undefined, false, undefined, this)
@@ -578,39 +338,39 @@ function MarketplaceDashboard() {
578
338
  }, undefined, true, undefined, this)
579
339
  }, undefined, false, undefined, this),
580
340
  activeTab === "orders" && /* @__PURE__ */ jsxDEV("div", {
581
- className: "border-border rounded-lg border",
341
+ className: "rounded-lg border border-border",
582
342
  children: /* @__PURE__ */ jsxDEV("table", {
583
343
  className: "w-full",
584
344
  children: [
585
345
  /* @__PURE__ */ jsxDEV("thead", {
586
- className: "border-border bg-muted/30 border-b",
346
+ className: "border-border border-b bg-muted/30",
587
347
  children: /* @__PURE__ */ jsxDEV("tr", {
588
348
  children: [
589
349
  /* @__PURE__ */ jsxDEV("th", {
590
- className: "px-4 py-3 text-left text-sm font-medium",
350
+ className: "px-4 py-3 text-left font-medium text-sm",
591
351
  children: "Order ID"
592
352
  }, undefined, false, undefined, this),
593
353
  /* @__PURE__ */ jsxDEV("th", {
594
- className: "px-4 py-3 text-left text-sm font-medium",
354
+ className: "px-4 py-3 text-left font-medium text-sm",
595
355
  children: "Customer"
596
356
  }, undefined, false, undefined, this),
597
357
  /* @__PURE__ */ jsxDEV("th", {
598
- className: "px-4 py-3 text-left text-sm font-medium",
358
+ className: "px-4 py-3 text-left font-medium text-sm",
599
359
  children: "Total"
600
360
  }, undefined, false, undefined, this),
601
361
  /* @__PURE__ */ jsxDEV("th", {
602
- className: "px-4 py-3 text-left text-sm font-medium",
362
+ className: "px-4 py-3 text-left font-medium text-sm",
603
363
  children: "Status"
604
364
  }, undefined, false, undefined, this),
605
365
  /* @__PURE__ */ jsxDEV("th", {
606
- className: "px-4 py-3 text-left text-sm font-medium",
366
+ className: "px-4 py-3 text-left font-medium text-sm",
607
367
  children: "Date"
608
368
  }, undefined, false, undefined, this)
609
369
  ]
610
370
  }, undefined, true, undefined, this)
611
371
  }, undefined, false, undefined, this),
612
372
  /* @__PURE__ */ jsxDEV("tbody", {
613
- className: "divide-border divide-y",
373
+ className: "divide-y divide-border",
614
374
  children: [
615
375
  orders.map((order) => /* @__PURE__ */ jsxDEV("tr", {
616
376
  className: "hover:bg-muted/50",
@@ -625,17 +385,17 @@ function MarketplaceDashboard() {
625
385
  }, undefined, false, undefined, this),
626
386
  /* @__PURE__ */ jsxDEV("td", {
627
387
  className: "px-4 py-3 font-mono",
628
- children: formatCurrency2(order.total, order.currency)
388
+ children: formatCurrency(order.total, order.currency)
629
389
  }, undefined, false, undefined, this),
630
390
  /* @__PURE__ */ jsxDEV("td", {
631
391
  className: "px-4 py-3",
632
392
  children: /* @__PURE__ */ jsxDEV("span", {
633
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[order.status] ?? ""}`,
393
+ className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${STATUS_COLORS[order.status] ?? ""}`,
634
394
  children: order.status
635
395
  }, undefined, false, undefined, this)
636
396
  }, undefined, false, undefined, this),
637
397
  /* @__PURE__ */ jsxDEV("td", {
638
- className: "text-muted-foreground px-4 py-3 text-sm",
398
+ className: "px-4 py-3 text-muted-foreground text-sm",
639
399
  children: order.createdAt.toLocaleDateString()
640
400
  }, undefined, false, undefined, this)
641
401
  ]
@@ -643,7 +403,7 @@ function MarketplaceDashboard() {
643
403
  orders.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
644
404
  children: /* @__PURE__ */ jsxDEV("td", {
645
405
  colSpan: 5,
646
- className: "text-muted-foreground px-4 py-8 text-center",
406
+ className: "px-4 py-8 text-center text-muted-foreground",
647
407
  children: "No orders found"
648
408
  }, undefined, false, undefined, this)
649
409
  }, undefined, false, undefined, this)
@@ -658,8 +418,249 @@ function MarketplaceDashboard() {
658
418
  }, undefined, true, undefined, this);
659
419
  }
660
420
 
661
- // src/ui/hooks/index.ts
662
- "use client";
421
+ // src/ui/renderers/marketplace.markdown.ts
422
+ var mockStores = [
423
+ {
424
+ id: "store-1",
425
+ name: "Tech Gadgets Store",
426
+ status: "ACTIVE",
427
+ productCount: 45,
428
+ rating: 4.8
429
+ },
430
+ {
431
+ id: "store-2",
432
+ name: "Home & Garden",
433
+ status: "ACTIVE",
434
+ productCount: 120,
435
+ rating: 4.5
436
+ },
437
+ {
438
+ id: "store-3",
439
+ name: "Fashion Boutique",
440
+ status: "PENDING",
441
+ productCount: 0,
442
+ rating: 0
443
+ }
444
+ ];
445
+ var mockProducts = [
446
+ {
447
+ id: "prod-1",
448
+ name: "Wireless Earbuds",
449
+ storeId: "store-1",
450
+ price: 79.99,
451
+ currency: "USD",
452
+ status: "ACTIVE",
453
+ stock: 150
454
+ },
455
+ {
456
+ id: "prod-2",
457
+ name: "Smart Watch",
458
+ storeId: "store-1",
459
+ price: 249.99,
460
+ currency: "USD",
461
+ status: "ACTIVE",
462
+ stock: 50
463
+ },
464
+ {
465
+ id: "prod-3",
466
+ name: "Garden Tools Set",
467
+ storeId: "store-2",
468
+ price: 89.99,
469
+ currency: "USD",
470
+ status: "ACTIVE",
471
+ stock: 30
472
+ },
473
+ {
474
+ id: "prod-4",
475
+ name: "Indoor Plant Kit",
476
+ storeId: "store-2",
477
+ price: 45.99,
478
+ currency: "USD",
479
+ status: "ACTIVE",
480
+ stock: 75
481
+ },
482
+ {
483
+ id: "prod-5",
484
+ name: "LED Desk Lamp",
485
+ storeId: "store-1",
486
+ price: 34.99,
487
+ currency: "USD",
488
+ status: "OUT_OF_STOCK",
489
+ stock: 0
490
+ }
491
+ ];
492
+ var mockOrders = [
493
+ {
494
+ id: "ord-1",
495
+ storeId: "store-1",
496
+ customerId: "cust-1",
497
+ total: 329.98,
498
+ currency: "USD",
499
+ status: "DELIVERED",
500
+ itemCount: 2,
501
+ createdAt: "2024-01-15T10:00:00Z"
502
+ },
503
+ {
504
+ id: "ord-2",
505
+ storeId: "store-2",
506
+ customerId: "cust-2",
507
+ total: 135.98,
508
+ currency: "USD",
509
+ status: "SHIPPED",
510
+ itemCount: 2,
511
+ createdAt: "2024-01-14T14:00:00Z"
512
+ },
513
+ {
514
+ id: "ord-3",
515
+ storeId: "store-1",
516
+ customerId: "cust-3",
517
+ total: 79.99,
518
+ currency: "USD",
519
+ status: "PROCESSING",
520
+ itemCount: 1,
521
+ createdAt: "2024-01-16T08:00:00Z"
522
+ },
523
+ {
524
+ id: "ord-4",
525
+ storeId: "store-2",
526
+ customerId: "cust-4",
527
+ total: 45.99,
528
+ currency: "USD",
529
+ status: "PENDING",
530
+ itemCount: 1,
531
+ createdAt: "2024-01-16T12:00:00Z"
532
+ }
533
+ ];
534
+ function formatCurrency2(value, currency = "USD") {
535
+ return new Intl.NumberFormat("en-US", {
536
+ style: "currency",
537
+ currency,
538
+ minimumFractionDigits: 2
539
+ }).format(value);
540
+ }
541
+ var marketplaceDashboardMarkdownRenderer = {
542
+ target: "markdown",
543
+ render: async (desc) => {
544
+ if (desc.source.type !== "component" || desc.source.componentKey !== "MarketplaceDashboard") {
545
+ throw new Error("marketplaceDashboardMarkdownRenderer: not MarketplaceDashboard");
546
+ }
547
+ const stores = mockStores;
548
+ const products = mockProducts;
549
+ const orders = mockOrders;
550
+ const activeStores = stores.filter((s) => s.status === "ACTIVE");
551
+ const activeProducts = products.filter((p) => p.status === "ACTIVE");
552
+ const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
553
+ const pendingOrders = orders.filter((o) => o.status === "PENDING" || o.status === "PROCESSING");
554
+ const lines = [
555
+ "# Marketplace Dashboard",
556
+ "",
557
+ "> Two-sided marketplace overview",
558
+ "",
559
+ "## Summary",
560
+ "",
561
+ "| Metric | Value |",
562
+ "|--------|-------|",
563
+ `| Active Stores | ${activeStores.length} |`,
564
+ `| Active Products | ${activeProducts.length} |`,
565
+ `| Total Orders | ${orders.length} |`,
566
+ `| Total Revenue | ${formatCurrency2(totalRevenue)} |`,
567
+ `| Pending Orders | ${pendingOrders.length} |`,
568
+ "",
569
+ "## Top Stores",
570
+ "",
571
+ "| Store | Products | Rating | Status |",
572
+ "|-------|----------|--------|--------|"
573
+ ];
574
+ for (const store of stores.slice(0, 5)) {
575
+ lines.push(`| ${store.name} | ${store.productCount} | \u2B50 ${store.rating || "N/A"} | ${store.status} |`);
576
+ }
577
+ lines.push("");
578
+ lines.push("## Recent Orders");
579
+ lines.push("");
580
+ lines.push("| Order | Items | Total | Status | Date |");
581
+ lines.push("|-------|-------|-------|--------|------|");
582
+ for (const order of orders.slice(0, 10)) {
583
+ const date = new Date(order.createdAt).toLocaleDateString();
584
+ lines.push(`| ${order.id} | ${order.itemCount} | ${formatCurrency2(order.total, order.currency)} | ${order.status} | ${date} |`);
585
+ }
586
+ return {
587
+ mimeType: "text/markdown",
588
+ body: lines.join(`
589
+ `)
590
+ };
591
+ }
592
+ };
593
+ var productCatalogMarkdownRenderer = {
594
+ target: "markdown",
595
+ render: async (desc) => {
596
+ if (desc.source.type !== "component" || desc.source.componentKey !== "ProductCatalog") {
597
+ throw new Error("productCatalogMarkdownRenderer: not ProductCatalog");
598
+ }
599
+ const products = mockProducts;
600
+ const stores = mockStores;
601
+ const lines = [
602
+ "# Product Catalog",
603
+ "",
604
+ "> Browse products across all marketplace stores",
605
+ ""
606
+ ];
607
+ for (const store of stores.filter((s) => s.status === "ACTIVE")) {
608
+ const storeProducts = products.filter((p) => p.storeId === store.id);
609
+ if (storeProducts.length === 0)
610
+ continue;
611
+ lines.push(`## ${store.name}`);
612
+ lines.push("");
613
+ lines.push("| Product | Price | Stock | Status |");
614
+ lines.push("|---------|-------|-------|--------|");
615
+ for (const product of storeProducts) {
616
+ const stockStatus = product.stock > 0 ? `${product.stock} in stock` : "Out of stock";
617
+ lines.push(`| ${product.name} | ${formatCurrency2(product.price, product.currency)} | ${stockStatus} | ${product.status} |`);
618
+ }
619
+ lines.push("");
620
+ }
621
+ return {
622
+ mimeType: "text/markdown",
623
+ body: lines.join(`
624
+ `)
625
+ };
626
+ }
627
+ };
628
+ var orderListMarkdownRenderer = {
629
+ target: "markdown",
630
+ render: async (desc) => {
631
+ if (desc.source.type !== "component" || desc.source.componentKey !== "OrderList") {
632
+ throw new Error("orderListMarkdownRenderer: not OrderList");
633
+ }
634
+ const orders = mockOrders;
635
+ const stores = mockStores;
636
+ const lines = [
637
+ "# Orders",
638
+ "",
639
+ "> Manage marketplace orders",
640
+ "",
641
+ "| Order ID | Store | Items | Total | Status | Created |",
642
+ "|----------|-------|-------|-------|--------|---------|"
643
+ ];
644
+ for (const order of orders) {
645
+ const store = stores.find((s) => s.id === order.storeId);
646
+ const date = new Date(order.createdAt).toLocaleDateString();
647
+ lines.push(`| ${order.id} | ${store?.name ?? "Unknown"} | ${order.itemCount} | ${formatCurrency2(order.total, order.currency)} | ${order.status} | ${date} |`);
648
+ }
649
+ lines.push("");
650
+ lines.push("## Order Status Legend");
651
+ lines.push("");
652
+ lines.push("- **PENDING**: Awaiting payment confirmation");
653
+ lines.push("- **PROCESSING**: Being prepared");
654
+ lines.push("- **SHIPPED**: In transit");
655
+ lines.push("- **DELIVERED**: Order completed");
656
+ lines.push("- **CANCELLED**: Order cancelled");
657
+ return {
658
+ mimeType: "text/markdown",
659
+ body: lines.join(`
660
+ `)
661
+ };
662
+ }
663
+ };
663
664
  export {
664
665
  useMarketplaceData,
665
666
  productCatalogMarkdownRenderer,