@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.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/index.js +316 -79
  3. package/dist/browser/marketplace.feature.js +175 -0
  4. package/dist/browser/ui/MarketplaceDashboard.js +293 -75
  5. package/dist/browser/ui/MarketplaceDashboard.visualizations.js +216 -0
  6. package/dist/browser/ui/index.js +309 -79
  7. package/dist/browser/ui/renderers/index.js +190 -4
  8. package/dist/browser/ui/renderers/marketplace.markdown.js +190 -4
  9. package/dist/browser/visualizations/catalog.js +126 -0
  10. package/dist/browser/visualizations/index.js +183 -0
  11. package/dist/browser/visualizations/selectors.js +177 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +316 -79
  14. package/dist/marketplace.feature.js +175 -0
  15. package/dist/node/index.js +316 -79
  16. package/dist/node/marketplace.feature.js +175 -0
  17. package/dist/node/ui/MarketplaceDashboard.js +293 -75
  18. package/dist/node/ui/MarketplaceDashboard.visualizations.js +216 -0
  19. package/dist/node/ui/index.js +309 -79
  20. package/dist/node/ui/renderers/index.js +190 -4
  21. package/dist/node/ui/renderers/marketplace.markdown.js +190 -4
  22. package/dist/node/visualizations/catalog.js +126 -0
  23. package/dist/node/visualizations/index.js +183 -0
  24. package/dist/node/visualizations/selectors.js +177 -0
  25. package/dist/ui/MarketplaceDashboard.js +293 -75
  26. package/dist/ui/MarketplaceDashboard.visualizations.d.ts +5 -0
  27. package/dist/ui/MarketplaceDashboard.visualizations.js +217 -0
  28. package/dist/ui/index.js +309 -79
  29. package/dist/ui/renderers/index.js +190 -4
  30. package/dist/ui/renderers/marketplace.markdown.js +190 -4
  31. package/dist/visualizations/catalog.d.ts +10 -0
  32. package/dist/visualizations/catalog.js +127 -0
  33. package/dist/visualizations/index.d.ts +2 -0
  34. package/dist/visualizations/index.js +184 -0
  35. package/dist/visualizations/selectors.d.ts +11 -0
  36. package/dist/visualizations/selectors.js +178 -0
  37. package/dist/visualizations/selectors.test.d.ts +1 -0
  38. package/package.json +64 -8
@@ -1,4 +1,178 @@
1
1
  // @bun
2
+ // src/visualizations/catalog.ts
3
+ import {
4
+ defineVisualization,
5
+ VisualizationRegistry
6
+ } from "@contractspec/lib.contracts-spec/visualizations";
7
+ var ORDER_LIST_REF = {
8
+ key: "marketplace.order.list",
9
+ version: "1.0.0"
10
+ };
11
+ var PRODUCT_LIST_REF = {
12
+ key: "marketplace.product.list",
13
+ version: "1.0.0"
14
+ };
15
+ var META = {
16
+ version: "1.0.0",
17
+ domain: "marketplace",
18
+ stability: "experimental",
19
+ owners: ["@example.marketplace"],
20
+ tags: ["marketplace", "visualization", "commerce"]
21
+ };
22
+ var MarketplaceOrderStatusVisualization = defineVisualization({
23
+ meta: {
24
+ ...META,
25
+ key: "marketplace.visualization.order-status",
26
+ title: "Order Status Breakdown",
27
+ description: "Distribution of current order states.",
28
+ goal: "Expose delivery and backlog mix at a glance.",
29
+ context: "Marketplace operations overview."
30
+ },
31
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
32
+ visualization: {
33
+ kind: "pie",
34
+ nameDimension: "status",
35
+ valueMeasure: "orders",
36
+ dimensions: [
37
+ { key: "status", label: "Status", dataPath: "status", type: "category" }
38
+ ],
39
+ measures: [
40
+ { key: "orders", label: "Orders", dataPath: "orders", format: "number" }
41
+ ],
42
+ table: { caption: "Order counts by status." }
43
+ }
44
+ });
45
+ var MarketplaceCategoryValueVisualization = defineVisualization({
46
+ meta: {
47
+ ...META,
48
+ key: "marketplace.visualization.category-value",
49
+ title: "Category Value Comparison",
50
+ description: "Catalog value by product category derived from current pricing and stock.",
51
+ goal: "Compare where the marketplace catalog is concentrated.",
52
+ context: "Merchandising overview."
53
+ },
54
+ source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
55
+ visualization: {
56
+ kind: "cartesian",
57
+ variant: "bar",
58
+ xDimension: "category",
59
+ yMeasures: ["catalogValue"],
60
+ dimensions: [
61
+ {
62
+ key: "category",
63
+ label: "Category",
64
+ dataPath: "category",
65
+ type: "category"
66
+ }
67
+ ],
68
+ measures: [
69
+ {
70
+ key: "catalogValue",
71
+ label: "Catalog Value",
72
+ dataPath: "catalogValue",
73
+ format: "currency",
74
+ color: "#1d4ed8"
75
+ }
76
+ ],
77
+ table: { caption: "Catalog value by product category." }
78
+ }
79
+ });
80
+ var MarketplaceOrderActivityVisualization = defineVisualization({
81
+ meta: {
82
+ ...META,
83
+ key: "marketplace.visualization.order-activity",
84
+ title: "Recent Order Activity",
85
+ description: "Daily order volume from recent order creation timestamps.",
86
+ goal: "Show recent order activity trends.",
87
+ context: "Commerce operations trend monitoring."
88
+ },
89
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
90
+ visualization: {
91
+ kind: "cartesian",
92
+ variant: "line",
93
+ xDimension: "day",
94
+ yMeasures: ["orders"],
95
+ dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
96
+ measures: [
97
+ {
98
+ key: "orders",
99
+ label: "Orders",
100
+ dataPath: "orders",
101
+ format: "number",
102
+ color: "#0f766e"
103
+ }
104
+ ],
105
+ table: { caption: "Daily order counts." }
106
+ }
107
+ });
108
+ var MarketplaceVisualizationSpecs = [
109
+ MarketplaceOrderStatusVisualization,
110
+ MarketplaceCategoryValueVisualization,
111
+ MarketplaceOrderActivityVisualization
112
+ ];
113
+ var MarketplaceVisualizationRegistry = new VisualizationRegistry([
114
+ ...MarketplaceVisualizationSpecs
115
+ ]);
116
+ var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
117
+ key: spec.meta.key,
118
+ version: spec.meta.version
119
+ }));
120
+
121
+ // src/visualizations/selectors.ts
122
+ function toDayKey(value) {
123
+ const date = value instanceof Date ? value : new Date(value);
124
+ return date.toISOString().slice(0, 10);
125
+ }
126
+ function createMarketplaceVisualizationItems(products, orders) {
127
+ const orderStatus = new Map;
128
+ const orderActivity = new Map;
129
+ const categoryValue = new Map;
130
+ for (const order of orders) {
131
+ orderStatus.set(order.status, (orderStatus.get(order.status) ?? 0) + 1);
132
+ const day = toDayKey(order.createdAt);
133
+ orderActivity.set(day, (orderActivity.get(day) ?? 0) + 1);
134
+ }
135
+ for (const product of products) {
136
+ const category = product.category ?? "Uncategorized";
137
+ categoryValue.set(category, (categoryValue.get(category) ?? 0) + product.price * product.stock);
138
+ }
139
+ return [
140
+ {
141
+ key: "marketplace-order-status",
142
+ spec: MarketplaceOrderStatusVisualization,
143
+ data: {
144
+ data: Array.from(orderStatus.entries()).map(([status, count]) => ({
145
+ status,
146
+ orders: count
147
+ }))
148
+ },
149
+ title: "Order Status Breakdown",
150
+ description: "Status mix across the current order set.",
151
+ height: 260
152
+ },
153
+ {
154
+ key: "marketplace-category-value",
155
+ spec: MarketplaceCategoryValueVisualization,
156
+ data: {
157
+ data: Array.from(categoryValue.entries()).sort(([, left], [, right]) => right - left).map(([category, value]) => ({
158
+ category,
159
+ catalogValue: value
160
+ }))
161
+ },
162
+ title: "Category Value Comparison",
163
+ description: "Derived from current product pricing and stock."
164
+ },
165
+ {
166
+ key: "marketplace-order-activity",
167
+ spec: MarketplaceOrderActivityVisualization,
168
+ data: {
169
+ data: Array.from(orderActivity.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, orders: count }))
170
+ },
171
+ title: "Recent Order Activity",
172
+ description: "Daily order count from current order history."
173
+ }
174
+ ];
175
+ }
2
176
  // src/ui/renderers/marketplace.markdown.ts
3
177
  var mockStores = [
4
178
  {
@@ -28,6 +202,7 @@ var mockProducts = [
28
202
  id: "prod-1",
29
203
  name: "Wireless Earbuds",
30
204
  storeId: "store-1",
205
+ category: "Electronics",
31
206
  price: 79.99,
32
207
  currency: "USD",
33
208
  status: "ACTIVE",
@@ -37,6 +212,7 @@ var mockProducts = [
37
212
  id: "prod-2",
38
213
  name: "Smart Watch",
39
214
  storeId: "store-1",
215
+ category: "Wearables",
40
216
  price: 249.99,
41
217
  currency: "USD",
42
218
  status: "ACTIVE",
@@ -46,6 +222,7 @@ var mockProducts = [
46
222
  id: "prod-3",
47
223
  name: "Garden Tools Set",
48
224
  storeId: "store-2",
225
+ category: "Garden",
49
226
  price: 89.99,
50
227
  currency: "USD",
51
228
  status: "ACTIVE",
@@ -55,6 +232,7 @@ var mockProducts = [
55
232
  id: "prod-4",
56
233
  name: "Indoor Plant Kit",
57
234
  storeId: "store-2",
235
+ category: "Garden",
58
236
  price: 45.99,
59
237
  currency: "USD",
60
238
  status: "ACTIVE",
@@ -64,6 +242,7 @@ var mockProducts = [
64
242
  id: "prod-5",
65
243
  name: "LED Desk Lamp",
66
244
  storeId: "store-1",
245
+ category: "Home Office",
67
246
  price: 34.99,
68
247
  currency: "USD",
69
248
  status: "OUT_OF_STOCK",
@@ -128,6 +307,7 @@ var marketplaceDashboardMarkdownRenderer = {
128
307
  const stores = mockStores;
129
308
  const products = mockProducts;
130
309
  const orders = mockOrders;
310
+ const visualizationItems = createMarketplaceVisualizationItems(products, orders);
131
311
  const activeStores = stores.filter((s) => s.status === "ACTIVE");
132
312
  const activeProducts = products.filter((p) => p.status === "ACTIVE");
133
313
  const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
@@ -147,11 +327,17 @@ var marketplaceDashboardMarkdownRenderer = {
147
327
  `| Total Revenue | ${formatCurrency(totalRevenue)} |`,
148
328
  `| Pending Orders | ${pendingOrders.length} |`,
149
329
  "",
150
- "## Top Stores",
151
- "",
152
- "| Store | Products | Rating | Status |",
153
- "|-------|----------|--------|--------|"
330
+ "## Visualization Overview",
331
+ ""
154
332
  ];
333
+ for (const item of visualizationItems) {
334
+ lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
335
+ }
336
+ lines.push("");
337
+ lines.push("## Top Stores");
338
+ lines.push("");
339
+ lines.push("| Store | Products | Rating | Status |");
340
+ lines.push("|-------|----------|--------|--------|");
155
341
  for (const store of stores.slice(0, 5)) {
156
342
  lines.push(`| ${store.name} | ${store.productCount} | \u2B50 ${store.rating || "N/A"} | ${store.status} |`);
157
343
  }
@@ -1,4 +1,178 @@
1
1
  // @bun
2
+ // src/visualizations/catalog.ts
3
+ import {
4
+ defineVisualization,
5
+ VisualizationRegistry
6
+ } from "@contractspec/lib.contracts-spec/visualizations";
7
+ var ORDER_LIST_REF = {
8
+ key: "marketplace.order.list",
9
+ version: "1.0.0"
10
+ };
11
+ var PRODUCT_LIST_REF = {
12
+ key: "marketplace.product.list",
13
+ version: "1.0.0"
14
+ };
15
+ var META = {
16
+ version: "1.0.0",
17
+ domain: "marketplace",
18
+ stability: "experimental",
19
+ owners: ["@example.marketplace"],
20
+ tags: ["marketplace", "visualization", "commerce"]
21
+ };
22
+ var MarketplaceOrderStatusVisualization = defineVisualization({
23
+ meta: {
24
+ ...META,
25
+ key: "marketplace.visualization.order-status",
26
+ title: "Order Status Breakdown",
27
+ description: "Distribution of current order states.",
28
+ goal: "Expose delivery and backlog mix at a glance.",
29
+ context: "Marketplace operations overview."
30
+ },
31
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
32
+ visualization: {
33
+ kind: "pie",
34
+ nameDimension: "status",
35
+ valueMeasure: "orders",
36
+ dimensions: [
37
+ { key: "status", label: "Status", dataPath: "status", type: "category" }
38
+ ],
39
+ measures: [
40
+ { key: "orders", label: "Orders", dataPath: "orders", format: "number" }
41
+ ],
42
+ table: { caption: "Order counts by status." }
43
+ }
44
+ });
45
+ var MarketplaceCategoryValueVisualization = defineVisualization({
46
+ meta: {
47
+ ...META,
48
+ key: "marketplace.visualization.category-value",
49
+ title: "Category Value Comparison",
50
+ description: "Catalog value by product category derived from current pricing and stock.",
51
+ goal: "Compare where the marketplace catalog is concentrated.",
52
+ context: "Merchandising overview."
53
+ },
54
+ source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
55
+ visualization: {
56
+ kind: "cartesian",
57
+ variant: "bar",
58
+ xDimension: "category",
59
+ yMeasures: ["catalogValue"],
60
+ dimensions: [
61
+ {
62
+ key: "category",
63
+ label: "Category",
64
+ dataPath: "category",
65
+ type: "category"
66
+ }
67
+ ],
68
+ measures: [
69
+ {
70
+ key: "catalogValue",
71
+ label: "Catalog Value",
72
+ dataPath: "catalogValue",
73
+ format: "currency",
74
+ color: "#1d4ed8"
75
+ }
76
+ ],
77
+ table: { caption: "Catalog value by product category." }
78
+ }
79
+ });
80
+ var MarketplaceOrderActivityVisualization = defineVisualization({
81
+ meta: {
82
+ ...META,
83
+ key: "marketplace.visualization.order-activity",
84
+ title: "Recent Order Activity",
85
+ description: "Daily order volume from recent order creation timestamps.",
86
+ goal: "Show recent order activity trends.",
87
+ context: "Commerce operations trend monitoring."
88
+ },
89
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
90
+ visualization: {
91
+ kind: "cartesian",
92
+ variant: "line",
93
+ xDimension: "day",
94
+ yMeasures: ["orders"],
95
+ dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
96
+ measures: [
97
+ {
98
+ key: "orders",
99
+ label: "Orders",
100
+ dataPath: "orders",
101
+ format: "number",
102
+ color: "#0f766e"
103
+ }
104
+ ],
105
+ table: { caption: "Daily order counts." }
106
+ }
107
+ });
108
+ var MarketplaceVisualizationSpecs = [
109
+ MarketplaceOrderStatusVisualization,
110
+ MarketplaceCategoryValueVisualization,
111
+ MarketplaceOrderActivityVisualization
112
+ ];
113
+ var MarketplaceVisualizationRegistry = new VisualizationRegistry([
114
+ ...MarketplaceVisualizationSpecs
115
+ ]);
116
+ var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
117
+ key: spec.meta.key,
118
+ version: spec.meta.version
119
+ }));
120
+
121
+ // src/visualizations/selectors.ts
122
+ function toDayKey(value) {
123
+ const date = value instanceof Date ? value : new Date(value);
124
+ return date.toISOString().slice(0, 10);
125
+ }
126
+ function createMarketplaceVisualizationItems(products, orders) {
127
+ const orderStatus = new Map;
128
+ const orderActivity = new Map;
129
+ const categoryValue = new Map;
130
+ for (const order of orders) {
131
+ orderStatus.set(order.status, (orderStatus.get(order.status) ?? 0) + 1);
132
+ const day = toDayKey(order.createdAt);
133
+ orderActivity.set(day, (orderActivity.get(day) ?? 0) + 1);
134
+ }
135
+ for (const product of products) {
136
+ const category = product.category ?? "Uncategorized";
137
+ categoryValue.set(category, (categoryValue.get(category) ?? 0) + product.price * product.stock);
138
+ }
139
+ return [
140
+ {
141
+ key: "marketplace-order-status",
142
+ spec: MarketplaceOrderStatusVisualization,
143
+ data: {
144
+ data: Array.from(orderStatus.entries()).map(([status, count]) => ({
145
+ status,
146
+ orders: count
147
+ }))
148
+ },
149
+ title: "Order Status Breakdown",
150
+ description: "Status mix across the current order set.",
151
+ height: 260
152
+ },
153
+ {
154
+ key: "marketplace-category-value",
155
+ spec: MarketplaceCategoryValueVisualization,
156
+ data: {
157
+ data: Array.from(categoryValue.entries()).sort(([, left], [, right]) => right - left).map(([category, value]) => ({
158
+ category,
159
+ catalogValue: value
160
+ }))
161
+ },
162
+ title: "Category Value Comparison",
163
+ description: "Derived from current product pricing and stock."
164
+ },
165
+ {
166
+ key: "marketplace-order-activity",
167
+ spec: MarketplaceOrderActivityVisualization,
168
+ data: {
169
+ data: Array.from(orderActivity.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, orders: count }))
170
+ },
171
+ title: "Recent Order Activity",
172
+ description: "Daily order count from current order history."
173
+ }
174
+ ];
175
+ }
2
176
  // src/ui/renderers/marketplace.markdown.ts
3
177
  var mockStores = [
4
178
  {
@@ -28,6 +202,7 @@ var mockProducts = [
28
202
  id: "prod-1",
29
203
  name: "Wireless Earbuds",
30
204
  storeId: "store-1",
205
+ category: "Electronics",
31
206
  price: 79.99,
32
207
  currency: "USD",
33
208
  status: "ACTIVE",
@@ -37,6 +212,7 @@ var mockProducts = [
37
212
  id: "prod-2",
38
213
  name: "Smart Watch",
39
214
  storeId: "store-1",
215
+ category: "Wearables",
40
216
  price: 249.99,
41
217
  currency: "USD",
42
218
  status: "ACTIVE",
@@ -46,6 +222,7 @@ var mockProducts = [
46
222
  id: "prod-3",
47
223
  name: "Garden Tools Set",
48
224
  storeId: "store-2",
225
+ category: "Garden",
49
226
  price: 89.99,
50
227
  currency: "USD",
51
228
  status: "ACTIVE",
@@ -55,6 +232,7 @@ var mockProducts = [
55
232
  id: "prod-4",
56
233
  name: "Indoor Plant Kit",
57
234
  storeId: "store-2",
235
+ category: "Garden",
58
236
  price: 45.99,
59
237
  currency: "USD",
60
238
  status: "ACTIVE",
@@ -64,6 +242,7 @@ var mockProducts = [
64
242
  id: "prod-5",
65
243
  name: "LED Desk Lamp",
66
244
  storeId: "store-1",
245
+ category: "Home Office",
67
246
  price: 34.99,
68
247
  currency: "USD",
69
248
  status: "OUT_OF_STOCK",
@@ -128,6 +307,7 @@ var marketplaceDashboardMarkdownRenderer = {
128
307
  const stores = mockStores;
129
308
  const products = mockProducts;
130
309
  const orders = mockOrders;
310
+ const visualizationItems = createMarketplaceVisualizationItems(products, orders);
131
311
  const activeStores = stores.filter((s) => s.status === "ACTIVE");
132
312
  const activeProducts = products.filter((p) => p.status === "ACTIVE");
133
313
  const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
@@ -147,11 +327,17 @@ var marketplaceDashboardMarkdownRenderer = {
147
327
  `| Total Revenue | ${formatCurrency(totalRevenue)} |`,
148
328
  `| Pending Orders | ${pendingOrders.length} |`,
149
329
  "",
150
- "## Top Stores",
151
- "",
152
- "| Store | Products | Rating | Status |",
153
- "|-------|----------|--------|--------|"
330
+ "## Visualization Overview",
331
+ ""
154
332
  ];
333
+ for (const item of visualizationItems) {
334
+ lines.push(`- **${item.title}** via \`${item.spec.meta.key}\``);
335
+ }
336
+ lines.push("");
337
+ lines.push("## Top Stores");
338
+ lines.push("");
339
+ lines.push("| Store | Products | Rating | Status |");
340
+ lines.push("|-------|----------|--------|--------|");
155
341
  for (const store of stores.slice(0, 5)) {
156
342
  lines.push(`| ${store.name} | ${store.productCount} | \u2B50 ${store.rating || "N/A"} | ${store.status} |`);
157
343
  }
@@ -0,0 +1,10 @@
1
+ import { VisualizationRegistry } from '@contractspec/lib.contracts-spec/visualizations';
2
+ export declare const MarketplaceOrderStatusVisualization: import("@contractspec/lib.contracts-spec").VisualizationSpec;
3
+ export declare const MarketplaceCategoryValueVisualization: import("@contractspec/lib.contracts-spec").VisualizationSpec;
4
+ export declare const MarketplaceOrderActivityVisualization: import("@contractspec/lib.contracts-spec").VisualizationSpec;
5
+ export declare const MarketplaceVisualizationSpecs: readonly [import("@contractspec/lib.contracts-spec").VisualizationSpec, import("@contractspec/lib.contracts-spec").VisualizationSpec, import("@contractspec/lib.contracts-spec").VisualizationSpec];
6
+ export declare const MarketplaceVisualizationRegistry: VisualizationRegistry;
7
+ export declare const MarketplaceVisualizationRefs: {
8
+ key: string;
9
+ version: string;
10
+ }[];
@@ -0,0 +1,127 @@
1
+ // @bun
2
+ // src/visualizations/catalog.ts
3
+ import {
4
+ defineVisualization,
5
+ VisualizationRegistry
6
+ } from "@contractspec/lib.contracts-spec/visualizations";
7
+ var ORDER_LIST_REF = {
8
+ key: "marketplace.order.list",
9
+ version: "1.0.0"
10
+ };
11
+ var PRODUCT_LIST_REF = {
12
+ key: "marketplace.product.list",
13
+ version: "1.0.0"
14
+ };
15
+ var META = {
16
+ version: "1.0.0",
17
+ domain: "marketplace",
18
+ stability: "experimental",
19
+ owners: ["@example.marketplace"],
20
+ tags: ["marketplace", "visualization", "commerce"]
21
+ };
22
+ var MarketplaceOrderStatusVisualization = defineVisualization({
23
+ meta: {
24
+ ...META,
25
+ key: "marketplace.visualization.order-status",
26
+ title: "Order Status Breakdown",
27
+ description: "Distribution of current order states.",
28
+ goal: "Expose delivery and backlog mix at a glance.",
29
+ context: "Marketplace operations overview."
30
+ },
31
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
32
+ visualization: {
33
+ kind: "pie",
34
+ nameDimension: "status",
35
+ valueMeasure: "orders",
36
+ dimensions: [
37
+ { key: "status", label: "Status", dataPath: "status", type: "category" }
38
+ ],
39
+ measures: [
40
+ { key: "orders", label: "Orders", dataPath: "orders", format: "number" }
41
+ ],
42
+ table: { caption: "Order counts by status." }
43
+ }
44
+ });
45
+ var MarketplaceCategoryValueVisualization = defineVisualization({
46
+ meta: {
47
+ ...META,
48
+ key: "marketplace.visualization.category-value",
49
+ title: "Category Value Comparison",
50
+ description: "Catalog value by product category derived from current pricing and stock.",
51
+ goal: "Compare where the marketplace catalog is concentrated.",
52
+ context: "Merchandising overview."
53
+ },
54
+ source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
55
+ visualization: {
56
+ kind: "cartesian",
57
+ variant: "bar",
58
+ xDimension: "category",
59
+ yMeasures: ["catalogValue"],
60
+ dimensions: [
61
+ {
62
+ key: "category",
63
+ label: "Category",
64
+ dataPath: "category",
65
+ type: "category"
66
+ }
67
+ ],
68
+ measures: [
69
+ {
70
+ key: "catalogValue",
71
+ label: "Catalog Value",
72
+ dataPath: "catalogValue",
73
+ format: "currency",
74
+ color: "#1d4ed8"
75
+ }
76
+ ],
77
+ table: { caption: "Catalog value by product category." }
78
+ }
79
+ });
80
+ var MarketplaceOrderActivityVisualization = defineVisualization({
81
+ meta: {
82
+ ...META,
83
+ key: "marketplace.visualization.order-activity",
84
+ title: "Recent Order Activity",
85
+ description: "Daily order volume from recent order creation timestamps.",
86
+ goal: "Show recent order activity trends.",
87
+ context: "Commerce operations trend monitoring."
88
+ },
89
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
90
+ visualization: {
91
+ kind: "cartesian",
92
+ variant: "line",
93
+ xDimension: "day",
94
+ yMeasures: ["orders"],
95
+ dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
96
+ measures: [
97
+ {
98
+ key: "orders",
99
+ label: "Orders",
100
+ dataPath: "orders",
101
+ format: "number",
102
+ color: "#0f766e"
103
+ }
104
+ ],
105
+ table: { caption: "Daily order counts." }
106
+ }
107
+ });
108
+ var MarketplaceVisualizationSpecs = [
109
+ MarketplaceOrderStatusVisualization,
110
+ MarketplaceCategoryValueVisualization,
111
+ MarketplaceOrderActivityVisualization
112
+ ];
113
+ var MarketplaceVisualizationRegistry = new VisualizationRegistry([
114
+ ...MarketplaceVisualizationSpecs
115
+ ]);
116
+ var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
117
+ key: spec.meta.key,
118
+ version: spec.meta.version
119
+ }));
120
+ export {
121
+ MarketplaceVisualizationSpecs,
122
+ MarketplaceVisualizationRegistry,
123
+ MarketplaceVisualizationRefs,
124
+ MarketplaceOrderStatusVisualization,
125
+ MarketplaceOrderActivityVisualization,
126
+ MarketplaceCategoryValueVisualization
127
+ };
@@ -0,0 +1,2 @@
1
+ export * from './catalog';
2
+ export * from './selectors';