@contractspec/example.crm-pipeline 1.46.0 → 1.47.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.
Files changed (141) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +111 -36
  2. package/.turbo/turbo-build.log +109 -34
  3. package/CHANGELOG.md +56 -0
  4. package/dist/crm-pipeline.feature.d.ts +2 -2
  5. package/dist/crm-pipeline.feature.d.ts.map +1 -1
  6. package/dist/crm-pipeline.feature.js +9 -2
  7. package/dist/crm-pipeline.feature.js.map +1 -1
  8. package/dist/deal/deal.enum.d.ts +3 -3
  9. package/dist/deal/deal.enum.d.ts.map +1 -1
  10. package/dist/deal/deal.operation.d.ts +128 -128
  11. package/dist/deal/deal.operation.d.ts.map +1 -1
  12. package/dist/deal/deal.schema.d.ts +71 -71
  13. package/dist/deal/deal.test-spec.d.ts +8 -0
  14. package/dist/deal/deal.test-spec.d.ts.map +1 -0
  15. package/dist/deal/deal.test-spec.js +65 -0
  16. package/dist/deal/deal.test-spec.js.map +1 -0
  17. package/dist/entities/company.entity.d.ts +28 -28
  18. package/dist/entities/company.entity.d.ts.map +1 -1
  19. package/dist/entities/contact.entity.d.ts +32 -32
  20. package/dist/entities/contact.entity.d.ts.map +1 -1
  21. package/dist/entities/deal.entity.d.ts +53 -53
  22. package/dist/entities/index.js.map +1 -1
  23. package/dist/entities/task.entity.d.ts +43 -43
  24. package/dist/entities/task.entity.d.ts.map +1 -1
  25. package/dist/events/contact.event.d.ts +8 -8
  26. package/dist/events/contact.event.d.ts.map +1 -1
  27. package/dist/events/contact.event.js +1 -1
  28. package/dist/events/deal.event.d.ts +30 -30
  29. package/dist/events/deal.event.js +1 -1
  30. package/dist/events/task.event.d.ts +8 -8
  31. package/dist/events/task.event.d.ts.map +1 -1
  32. package/dist/events/task.event.js +1 -1
  33. package/dist/example.d.ts +2 -2
  34. package/dist/example.d.ts.map +1 -1
  35. package/dist/example.js +4 -2
  36. package/dist/example.js.map +1 -1
  37. package/dist/handlers/crm.handlers.d.ts +89 -0
  38. package/dist/handlers/crm.handlers.d.ts.map +1 -0
  39. package/dist/handlers/crm.handlers.js +172 -0
  40. package/dist/handlers/crm.handlers.js.map +1 -0
  41. package/dist/handlers/deal.handlers.js.map +1 -1
  42. package/dist/handlers/index.d.ts +2 -1
  43. package/dist/handlers/index.js +2 -1
  44. package/dist/handlers/mock-data.js.map +1 -1
  45. package/dist/index.d.ts +16 -3
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +14 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/presentations/dashboard.presentation.d.ts +3 -4
  50. package/dist/presentations/dashboard.presentation.d.ts.map +1 -1
  51. package/dist/presentations/dashboard.presentation.js +8 -5
  52. package/dist/presentations/dashboard.presentation.js.map +1 -1
  53. package/dist/presentations/pipeline.presentation.d.ts +5 -6
  54. package/dist/presentations/pipeline.presentation.d.ts.map +1 -1
  55. package/dist/presentations/pipeline.presentation.js +12 -9
  56. package/dist/presentations/pipeline.presentation.js.map +1 -1
  57. package/dist/seeders/index.d.ts +10 -0
  58. package/dist/seeders/index.d.ts.map +1 -0
  59. package/dist/seeders/index.js +47 -0
  60. package/dist/seeders/index.js.map +1 -0
  61. package/dist/shared/overlay-types.d.ts +34 -0
  62. package/dist/shared/overlay-types.d.ts.map +1 -0
  63. package/dist/shared/overlay-types.js +0 -0
  64. package/dist/ui/CrmDashboard.d.ts +7 -0
  65. package/dist/ui/CrmDashboard.d.ts.map +1 -0
  66. package/dist/ui/CrmDashboard.js +304 -0
  67. package/dist/ui/CrmDashboard.js.map +1 -0
  68. package/dist/ui/CrmDealCard.d.ts +15 -0
  69. package/dist/ui/CrmDealCard.d.ts.map +1 -0
  70. package/dist/ui/CrmDealCard.js +49 -0
  71. package/dist/ui/CrmDealCard.js.map +1 -0
  72. package/dist/ui/CrmPipelineBoard.d.ts +23 -0
  73. package/dist/ui/CrmPipelineBoard.d.ts.map +1 -0
  74. package/dist/ui/CrmPipelineBoard.js +98 -0
  75. package/dist/ui/CrmPipelineBoard.js.map +1 -0
  76. package/dist/ui/hooks/index.d.ts +3 -0
  77. package/dist/ui/hooks/index.js +6 -0
  78. package/dist/ui/hooks/useDealList.d.ts +35 -0
  79. package/dist/ui/hooks/useDealList.d.ts.map +1 -0
  80. package/dist/ui/hooks/useDealList.js +94 -0
  81. package/dist/ui/hooks/useDealList.js.map +1 -0
  82. package/dist/ui/hooks/useDealMutations.d.ts +26 -0
  83. package/dist/ui/hooks/useDealMutations.d.ts.map +1 -0
  84. package/dist/ui/hooks/useDealMutations.js +159 -0
  85. package/dist/ui/hooks/useDealMutations.js.map +1 -0
  86. package/dist/ui/index.d.ts +14 -0
  87. package/dist/ui/index.js +15 -0
  88. package/dist/ui/modals/CreateDealModal.d.ts +33 -0
  89. package/dist/ui/modals/CreateDealModal.d.ts.map +1 -0
  90. package/dist/ui/modals/CreateDealModal.js +183 -0
  91. package/dist/ui/modals/CreateDealModal.js.map +1 -0
  92. package/dist/ui/modals/DealActionsModal.d.ts +51 -0
  93. package/dist/ui/modals/DealActionsModal.d.ts.map +1 -0
  94. package/dist/ui/modals/DealActionsModal.js +372 -0
  95. package/dist/ui/modals/DealActionsModal.js.map +1 -0
  96. package/dist/ui/modals/index.d.ts +3 -0
  97. package/dist/ui/modals/index.js +4 -0
  98. package/dist/ui/overlays/demo-overlays.d.ts +19 -0
  99. package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
  100. package/dist/ui/overlays/demo-overlays.js +68 -0
  101. package/dist/ui/overlays/demo-overlays.js.map +1 -0
  102. package/dist/ui/overlays/index.d.ts +2 -0
  103. package/dist/ui/overlays/index.js +3 -0
  104. package/dist/ui/renderers/index.d.ts +3 -0
  105. package/dist/ui/renderers/index.js +4 -0
  106. package/dist/ui/renderers/pipeline.markdown.d.ts +23 -0
  107. package/dist/ui/renderers/pipeline.markdown.d.ts.map +1 -0
  108. package/dist/ui/renderers/pipeline.markdown.js +118 -0
  109. package/dist/ui/renderers/pipeline.markdown.js.map +1 -0
  110. package/dist/ui/renderers/pipeline.renderer.d.ts +9 -0
  111. package/dist/ui/renderers/pipeline.renderer.d.ts.map +1 -0
  112. package/dist/ui/renderers/pipeline.renderer.js +28 -0
  113. package/dist/ui/renderers/pipeline.renderer.js.map +1 -0
  114. package/package.json +38 -13
  115. package/src/crm-pipeline.feature.ts +3 -3
  116. package/src/deal/deal.test-spec.ts +55 -0
  117. package/src/example.ts +3 -3
  118. package/src/handlers/crm.handlers.ts +415 -0
  119. package/src/handlers/index.ts +3 -0
  120. package/src/index.ts +1 -0
  121. package/src/presentations/dashboard.presentation.ts +5 -6
  122. package/src/presentations/pipeline.presentation.ts +9 -10
  123. package/src/seeders/index.ts +35 -0
  124. package/src/shared/overlay-types.ts +39 -0
  125. package/src/ui/CrmDashboard.tsx +311 -0
  126. package/src/ui/CrmDealCard.tsx +83 -0
  127. package/src/ui/CrmPipelineBoard.tsx +136 -0
  128. package/src/ui/hooks/index.ts +10 -0
  129. package/src/ui/hooks/useDealList.ts +113 -0
  130. package/src/ui/hooks/useDealMutations.ts +174 -0
  131. package/src/ui/index.ts +18 -0
  132. package/src/ui/modals/CreateDealModal.tsx +239 -0
  133. package/src/ui/modals/DealActionsModal.tsx +424 -0
  134. package/src/ui/modals/index.ts +2 -0
  135. package/src/ui/overlays/demo-overlays.ts +68 -0
  136. package/src/ui/overlays/index.ts +1 -0
  137. package/src/ui/renderers/index.ts +6 -0
  138. package/src/ui/renderers/pipeline.markdown.ts +198 -0
  139. package/src/ui/renderers/pipeline.renderer.tsx +35 -0
  140. package/tsconfig.json +1 -1
  141. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,118 @@
1
+ import { mockGetPipelineStagesHandler, mockListDealsHandler } from "@contractspec/example.crm-pipeline/handlers";
2
+
3
+ //#region src/ui/renderers/pipeline.markdown.ts
4
+ function formatCurrency(value, currency = "USD") {
5
+ return new Intl.NumberFormat("en-US", {
6
+ style: "currency",
7
+ currency,
8
+ minimumFractionDigits: 0
9
+ }).format(value);
10
+ }
11
+ /**
12
+ * Markdown renderer for CRM Pipeline Kanban view (crm-pipeline.deal.pipeline)
13
+ * Only handles PipelineKanbanView component
14
+ */
15
+ const crmPipelineMarkdownRenderer = {
16
+ target: "markdown",
17
+ render: async (desc, _ctx) => {
18
+ if (desc.source.type !== "component" || desc.source.componentKey !== "PipelineKanbanView") throw new Error("crmPipelineMarkdownRenderer: not PipelineKanbanView");
19
+ const pipelineId = "pipeline-1";
20
+ const [dealsResult, stages] = await Promise.all([mockListDealsHandler({
21
+ pipelineId,
22
+ limit: 50
23
+ }), mockGetPipelineStagesHandler({ pipelineId })]);
24
+ const deals = dealsResult.deals;
25
+ const stageList = stages;
26
+ const dealsByStage = {};
27
+ for (const stage of stageList) dealsByStage[stage.id] = deals.filter((d) => d.stageId === stage.id && d.status === "OPEN");
28
+ const lines = [
29
+ "# CRM Pipeline",
30
+ "",
31
+ `**Total Value**: ${formatCurrency(dealsResult.totalValue)}`,
32
+ `**Total Deals**: ${dealsResult.total}`,
33
+ ""
34
+ ];
35
+ for (const stage of stageList.sort((a, b) => a.position - b.position)) {
36
+ const stageDeals = dealsByStage[stage.id] ?? [];
37
+ const stageValue = stageDeals.reduce((sum, d) => sum + d.value, 0);
38
+ lines.push(`## ${stage.name}`);
39
+ lines.push(`_${stageDeals.length} deals · ${formatCurrency(stageValue)}_`);
40
+ lines.push("");
41
+ if (stageDeals.length === 0) lines.push("_No deals_");
42
+ else for (const deal of stageDeals) lines.push(`- **${deal.name}** - ${formatCurrency(deal.value, deal.currency)}`);
43
+ lines.push("");
44
+ }
45
+ return {
46
+ mimeType: "text/markdown",
47
+ body: lines.join("\n")
48
+ };
49
+ }
50
+ };
51
+ /**
52
+ * Markdown renderer for CRM Dashboard (crm-pipeline.dashboard)
53
+ * Only handles CrmDashboard component
54
+ */
55
+ const crmDashboardMarkdownRenderer = {
56
+ target: "markdown",
57
+ render: async (desc, _ctx) => {
58
+ if (desc.source.type !== "component" || desc.source.componentKey !== "CrmDashboard") throw new Error("crmDashboardMarkdownRenderer: not CrmDashboard");
59
+ const pipelineId = "pipeline-1";
60
+ const [dealsResult, stages] = await Promise.all([mockListDealsHandler({
61
+ pipelineId,
62
+ limit: 100
63
+ }), mockGetPipelineStagesHandler({ pipelineId })]);
64
+ const deals = dealsResult.deals;
65
+ const stageList = stages;
66
+ const openDeals = deals.filter((d) => d.status === "OPEN");
67
+ const wonDeals = deals.filter((d) => d.status === "WON");
68
+ const lostDeals = deals.filter((d) => d.status === "LOST");
69
+ const openValue = openDeals.reduce((sum, d) => sum + d.value, 0);
70
+ const wonValue = wonDeals.reduce((sum, d) => sum + d.value, 0);
71
+ const lines = [
72
+ "# CRM Dashboard",
73
+ "",
74
+ "> Sales pipeline overview and key metrics",
75
+ "",
76
+ "## Summary",
77
+ "",
78
+ "| Metric | Value |",
79
+ "|--------|-------|",
80
+ `| Total Deals | ${dealsResult.total} |`,
81
+ `| Pipeline Value | ${formatCurrency(dealsResult.totalValue)} |`,
82
+ `| Open Deals | ${openDeals.length} (${formatCurrency(openValue)}) |`,
83
+ `| Won Deals | ${wonDeals.length} (${formatCurrency(wonValue)}) |`,
84
+ `| Lost Deals | ${lostDeals.length} |`,
85
+ "",
86
+ "## Pipeline Stages",
87
+ ""
88
+ ];
89
+ lines.push("| Stage | Deals | Value |");
90
+ lines.push("|-------|-------|-------|");
91
+ for (const stage of stageList.sort((a, b) => a.position - b.position)) {
92
+ const stageDeals = openDeals.filter((d) => d.stageId === stage.id);
93
+ const stageValue = stageDeals.reduce((sum, d) => sum + d.value, 0);
94
+ lines.push(`| ${stage.name} | ${stageDeals.length} | ${formatCurrency(stageValue)} |`);
95
+ }
96
+ lines.push("");
97
+ lines.push("## Recent Deals");
98
+ lines.push("");
99
+ const recentDeals = deals.slice(0, 10);
100
+ if (recentDeals.length === 0) lines.push("_No deals yet._");
101
+ else {
102
+ lines.push("| Deal | Value | Stage | Status |");
103
+ lines.push("|------|-------|-------|--------|");
104
+ for (const deal of recentDeals) {
105
+ const stage = stageList.find((s) => s.id === deal.stageId);
106
+ lines.push(`| ${deal.name} | ${formatCurrency(deal.value, deal.currency)} | ${stage?.name ?? "-"} | ${deal.status} |`);
107
+ }
108
+ }
109
+ return {
110
+ mimeType: "text/markdown",
111
+ body: lines.join("\n")
112
+ };
113
+ }
114
+ };
115
+
116
+ //#endregion
117
+ export { crmDashboardMarkdownRenderer, crmPipelineMarkdownRenderer };
118
+ //# sourceMappingURL=pipeline.markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.markdown.js","names":[],"sources":["../../../src/ui/renderers/pipeline.markdown.ts"],"sourcesContent":["/**\n * Markdown renderer for CRM Pipeline presentation\n *\n * Imports handlers from the hooks module to ensure correct build order.\n */\nimport type { PresentationRenderer } from '@contractspec/lib.contracts';\nimport {\n mockListDealsHandler,\n mockGetPipelineStagesHandler,\n} from '@contractspec/example.crm-pipeline/handlers';\n\ninterface DealItem {\n id: string;\n name: string;\n value: number;\n currency: string;\n stageId: string;\n status: string;\n}\n\ninterface StageItem {\n id: string;\n name: string;\n position: number;\n}\n\nfunction formatCurrency(value: number, currency = 'USD'): string {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency,\n minimumFractionDigits: 0,\n }).format(value);\n}\n\n/**\n * Markdown renderer for CRM Pipeline Kanban view (crm-pipeline.deal.pipeline)\n * Only handles PipelineKanbanView component\n */\nexport const crmPipelineMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc, _ctx) => {\n // Only handle PipelineKanbanView\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'PipelineKanbanView'\n ) {\n throw new Error('crmPipelineMarkdownRenderer: not PipelineKanbanView');\n }\n\n const pipelineId = 'pipeline-1';\n const [dealsResult, stages] = await Promise.all([\n mockListDealsHandler({ pipelineId, limit: 50 }),\n mockGetPipelineStagesHandler({ pipelineId }),\n ]);\n\n const deals = dealsResult.deals as DealItem[];\n const stageList = stages as StageItem[];\n\n // Group deals by stage\n const dealsByStage: Record<string, DealItem[]> = {};\n for (const stage of stageList) {\n dealsByStage[stage.id] = deals.filter(\n (d) => d.stageId === stage.id && d.status === 'OPEN'\n );\n }\n\n // Build Markdown\n const lines: string[] = [\n '# CRM Pipeline',\n '',\n `**Total Value**: ${formatCurrency(dealsResult.totalValue)}`,\n `**Total Deals**: ${dealsResult.total}`,\n '',\n ];\n\n for (const stage of stageList.sort((a, b) => a.position - b.position)) {\n const stageDeals = dealsByStage[stage.id] ?? [];\n const stageValue = stageDeals.reduce((sum, d) => sum + d.value, 0);\n\n lines.push(`## ${stage.name}`);\n lines.push(\n `_${stageDeals.length} deals · ${formatCurrency(stageValue)}_`\n );\n lines.push('');\n\n if (stageDeals.length === 0) {\n lines.push('_No deals_');\n } else {\n for (const deal of stageDeals) {\n lines.push(\n `- **${deal.name}** - ${formatCurrency(deal.value, deal.currency)}`\n );\n }\n }\n\n lines.push('');\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n\n/**\n * Markdown renderer for CRM Dashboard (crm-pipeline.dashboard)\n * Only handles CrmDashboard component\n */\nexport const crmDashboardMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc, _ctx) => {\n // Only handle CrmDashboard\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'CrmDashboard'\n ) {\n throw new Error('crmDashboardMarkdownRenderer: not CrmDashboard');\n }\n\n const pipelineId = 'pipeline-1';\n const [dealsResult, stages] = await Promise.all([\n mockListDealsHandler({ pipelineId, limit: 100 }),\n mockGetPipelineStagesHandler({ pipelineId }),\n ]);\n\n const deals = dealsResult.deals as DealItem[];\n const stageList = stages as StageItem[];\n\n // Calculate stats\n const openDeals = deals.filter((d) => d.status === 'OPEN');\n const wonDeals = deals.filter((d) => d.status === 'WON');\n const lostDeals = deals.filter((d) => d.status === 'LOST');\n const openValue = openDeals.reduce((sum, d) => sum + d.value, 0);\n const wonValue = wonDeals.reduce((sum, d) => sum + d.value, 0);\n\n // Build dashboard markdown\n const lines: string[] = [\n '# CRM Dashboard',\n '',\n '> Sales pipeline overview and key metrics',\n '',\n '## Summary',\n '',\n '| Metric | Value |',\n '|--------|-------|',\n `| Total Deals | ${dealsResult.total} |`,\n `| Pipeline Value | ${formatCurrency(dealsResult.totalValue)} |`,\n `| Open Deals | ${openDeals.length} (${formatCurrency(openValue)}) |`,\n `| Won Deals | ${wonDeals.length} (${formatCurrency(wonValue)}) |`,\n `| Lost Deals | ${lostDeals.length} |`,\n '',\n '## Pipeline Stages',\n '',\n ];\n\n // Stage summary table\n lines.push('| Stage | Deals | Value |');\n lines.push('|-------|-------|-------|');\n for (const stage of stageList.sort((a, b) => a.position - b.position)) {\n const stageDeals = openDeals.filter((d) => d.stageId === stage.id);\n const stageValue = stageDeals.reduce((sum, d) => sum + d.value, 0);\n lines.push(\n `| ${stage.name} | ${stageDeals.length} | ${formatCurrency(stageValue)} |`\n );\n }\n\n lines.push('');\n lines.push('## Recent Deals');\n lines.push('');\n\n // Top 10 recent deals\n const recentDeals = deals.slice(0, 10);\n if (recentDeals.length === 0) {\n lines.push('_No deals yet._');\n } else {\n lines.push('| Deal | Value | Stage | Status |');\n lines.push('|------|-------|-------|--------|');\n for (const deal of recentDeals) {\n const stage = stageList.find((s) => s.id === deal.stageId);\n lines.push(\n `| ${deal.name} | ${formatCurrency(deal.value, deal.currency)} | ${stage?.name ?? '-'} | ${deal.status} |`\n );\n }\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n"],"mappings":";;;AA0BA,SAAS,eAAe,OAAe,WAAW,OAAe;AAC/D,QAAO,IAAI,KAAK,aAAa,SAAS;EACpC,OAAO;EACP;EACA,uBAAuB;EACxB,CAAC,CAAC,OAAO,MAAM;;;;;;AAOlB,MAAa,8BAGR;CACH,QAAQ;CACR,QAAQ,OAAO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d,MAAM,cAAc,MAAM,MAAM,GAAG,GAAG;AACtC,MAAI,YAAY,WAAW,EACzB,OAAM,KAAK,kBAAkB;OACxB;AACL,SAAM,KAAK,oCAAoC;AAC/C,SAAM,KAAK,oCAAoC;AAC/C,QAAK,MAAM,QAAQ,aAAa;IAC9B,MAAM,QAAQ,UAAU,MAAM,MAAM,EAAE,OAAO,KAAK,QAAQ;AAC1D,UAAM,KACJ,KAAK,KAAK,KAAK,KAAK,eAAe,KAAK,OAAO,KAAK,SAAS,CAAC,KAAK,OAAO,QAAQ,IAAI,KAAK,KAAK,OAAO,IACxG;;;AAIL,SAAO;GACL,UAAU;GACV,MAAM,MAAM,KAAK,KAAK;GACvB;;CAEJ"}
@@ -0,0 +1,9 @@
1
+ import { PresentationRenderer } from "@contractspec/lib.contracts";
2
+ import * as React from "react";
3
+
4
+ //#region src/ui/renderers/pipeline.renderer.d.ts
5
+
6
+ declare const crmPipelineReactRenderer: PresentationRenderer<React.ReactElement>;
7
+ //#endregion
8
+ export { crmPipelineReactRenderer };
9
+ //# sourceMappingURL=pipeline.renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.renderer.d.ts","names":[],"sources":["../../../src/ui/renderers/pipeline.renderer.tsx"],"sourcesContent":[],"mappings":";;;;;cAmBa,0BAA0B,qBAAqB,KAAA,CAAM"}
@@ -0,0 +1,28 @@
1
+ import { useDealList } from "../hooks/useDealList.js";
2
+ import { CrmPipelineBoard } from "../CrmPipelineBoard.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/ui/renderers/pipeline.renderer.tsx
7
+ /**
8
+ * Wrapper component that provides data to CrmPipelineBoard
9
+ */
10
+ function CrmPipelineBoardWrapper() {
11
+ const { dealsByStage, stages } = useDealList();
12
+ return /* @__PURE__ */ jsx(CrmPipelineBoard, {
13
+ dealsByStage,
14
+ stages
15
+ });
16
+ }
17
+ const crmPipelineReactRenderer = {
18
+ target: "react",
19
+ render: async (desc, _ctx) => {
20
+ if (desc.source.type !== "component") throw new Error("Invalid source type");
21
+ if (desc.source.componentKey !== "CrmPipelineView") throw new Error(`Unknown component: ${desc.source.componentKey}`);
22
+ return /* @__PURE__ */ jsx(CrmPipelineBoardWrapper, {});
23
+ }
24
+ };
25
+
26
+ //#endregion
27
+ export { crmPipelineReactRenderer };
28
+ //# sourceMappingURL=pipeline.renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.renderer.js","names":[],"sources":["../../../src/ui/renderers/pipeline.renderer.tsx"],"sourcesContent":["/**\n * React renderer for CRM Pipeline presentation\n *\n * Renders the CRM pipeline board component.\n * Data is fetched via the CrmPipelineBoard component's internal hooks.\n */\nimport * as React from 'react';\nimport type { PresentationRenderer } from '@contractspec/lib.contracts';\nimport { CrmPipelineBoard } from '../CrmPipelineBoard';\nimport { useDealList } from '../hooks/useDealList';\n\n/**\n * Wrapper component that provides data to CrmPipelineBoard\n */\nfunction CrmPipelineBoardWrapper() {\n const { dealsByStage, stages } = useDealList();\n return <CrmPipelineBoard dealsByStage={dealsByStage} stages={stages} />;\n}\n\nexport const crmPipelineReactRenderer: PresentationRenderer<React.ReactElement> =\n {\n target: 'react',\n render: async (desc, _ctx) => {\n if (desc.source.type !== 'component') {\n throw new Error('Invalid source type');\n }\n\n if (desc.source.componentKey !== 'CrmPipelineView') {\n throw new Error(`Unknown component: ${desc.source.componentKey}`);\n }\n\n // Note: The wrapper component will fetch data internally\n return <CrmPipelineBoardWrapper />;\n },\n };\n"],"mappings":";;;;;;;;;AAcA,SAAS,0BAA0B;CACjC,MAAM,EAAE,cAAc,WAAW,aAAa;AAC9C,QAAO,oBAAC;EAA+B;EAAsB;GAAU;;AAGzE,MAAa,2BACX;CACE,QAAQ;CACR,QAAQ,OAAO,MAAM,SAAS;AAC5B,MAAI,KAAK,OAAO,SAAS,YACvB,OAAM,IAAI,MAAM,sBAAsB;AAGxC,MAAI,KAAK,OAAO,iBAAiB,kBAC/B,OAAM,IAAI,MAAM,sBAAsB,KAAK,OAAO,eAAe;AAInE,SAAO,oBAAC,4BAA0B;;CAErC"}
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@contractspec/example.crm-pipeline",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "CRM Pipeline - Contacts, Companies, Deals, Tasks",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
6
  "types": "./dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": "./dist/index.js",
@@ -12,6 +11,7 @@
12
11
  "./deal/deal.enum": "./dist/deal/deal.enum.js",
13
12
  "./deal/deal.operation": "./dist/deal/deal.operation.js",
14
13
  "./deal/deal.schema": "./dist/deal/deal.schema.js",
14
+ "./deal/deal.test-spec": "./dist/deal/deal.test-spec.js",
15
15
  "./docs": "./dist/docs/index.js",
16
16
  "./docs/crm-pipeline.docblock": "./dist/docs/crm-pipeline.docblock.js",
17
17
  "./entities": "./dist/entities/index.js",
@@ -25,12 +25,30 @@
25
25
  "./events/task.event": "./dist/events/task.event.js",
26
26
  "./example": "./dist/example.js",
27
27
  "./handlers": "./dist/handlers/index.js",
28
+ "./handlers/crm.handlers": "./dist/handlers/crm.handlers.js",
28
29
  "./handlers/deal.handlers": "./dist/handlers/deal.handlers.js",
29
30
  "./handlers/mock-data": "./dist/handlers/mock-data.js",
30
31
  "./operations": "./dist/operations/index.js",
31
32
  "./presentations": "./dist/presentations/index.js",
32
33
  "./presentations/dashboard.presentation": "./dist/presentations/dashboard.presentation.js",
33
34
  "./presentations/pipeline.presentation": "./dist/presentations/pipeline.presentation.js",
35
+ "./seeders": "./dist/seeders/index.js",
36
+ "./shared/overlay-types": "./dist/shared/overlay-types.js",
37
+ "./ui": "./dist/ui/index.js",
38
+ "./ui/CrmDashboard": "./dist/ui/CrmDashboard.js",
39
+ "./ui/CrmDealCard": "./dist/ui/CrmDealCard.js",
40
+ "./ui/CrmPipelineBoard": "./dist/ui/CrmPipelineBoard.js",
41
+ "./ui/hooks": "./dist/ui/hooks/index.js",
42
+ "./ui/hooks/useDealList": "./dist/ui/hooks/useDealList.js",
43
+ "./ui/hooks/useDealMutations": "./dist/ui/hooks/useDealMutations.js",
44
+ "./ui/modals": "./dist/ui/modals/index.js",
45
+ "./ui/modals/CreateDealModal": "./dist/ui/modals/CreateDealModal.js",
46
+ "./ui/modals/DealActionsModal": "./dist/ui/modals/DealActionsModal.js",
47
+ "./ui/overlays": "./dist/ui/overlays/index.js",
48
+ "./ui/overlays/demo-overlays": "./dist/ui/overlays/demo-overlays.js",
49
+ "./ui/renderers": "./dist/ui/renderers/index.js",
50
+ "./ui/renderers/pipeline.markdown": "./dist/ui/renderers/pipeline.markdown.js",
51
+ "./ui/renderers/pipeline.renderer": "./dist/ui/renderers/pipeline.renderer.js",
34
52
  "./*": "./*"
35
53
  },
36
54
  "scripts": {
@@ -44,22 +62,29 @@
44
62
  "lint": "bun lint:fix",
45
63
  "lint:fix": "eslint src --fix",
46
64
  "lint:check": "eslint src",
47
- "test": "bun run"
65
+ "test": "bun test"
48
66
  },
49
67
  "dependencies": {
50
- "@contractspec/lib.schema": "1.46.0",
51
- "@contractspec/lib.contracts": "1.46.0",
52
- "@contractspec/lib.identity-rbac": "1.46.0",
53
- "@contractspec/module.audit-trail": "1.46.0",
54
- "@contractspec/module.notifications": "1.46.0"
68
+ "@contractspec/lib.contracts": "1.47.0",
69
+ "@contractspec/lib.design-system": "1.47.0",
70
+ "@contractspec/lib.example-shared-ui": "1.1.0",
71
+ "@contractspec/lib.identity-rbac": "1.47.0",
72
+ "@contractspec/lib.runtime-sandbox": "0.2.0",
73
+ "@contractspec/lib.schema": "1.47.0",
74
+ "@contractspec/lib.ui-kit-web": "1.47.0",
75
+ "@contractspec/module.audit-trail": "1.47.0",
76
+ "@contractspec/module.notifications": "1.47.0",
77
+ "react": "19.2.3",
78
+ "react-dom": "19.2.3"
55
79
  },
56
80
  "devDependencies": {
57
- "@contractspec/tool.tsdown": "1.46.0",
58
- "@contractspec/tool.typescript": "1.46.0",
59
- "tsdown": "^0.18.3",
60
- "typescript": "^5.9.3"
81
+ "@contractspec/tool.tsdown": "1.47.0",
82
+ "@contractspec/tool.typescript": "1.47.0",
83
+ "tsdown": "^0.19.0",
84
+ "typescript": "^5.9.3",
85
+ "@types/react": "^19.2.8",
86
+ "@types/react-dom": "^19.2.2"
61
87
  },
62
- "module": "./dist/index.js",
63
88
  "publishConfig": {
64
89
  "exports": {
65
90
  ".": "./dist/index.js",
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * Defines the feature module for CRM and sales pipeline capabilities.
5
5
  */
6
- import type { FeatureModuleSpec } from '@contractspec/lib.contracts';
6
+ import { defineFeature } from '@contractspec/lib.contracts';
7
7
 
8
8
  /**
9
9
  * CRM Pipeline feature module that bundles deal management,
10
10
  * pipeline operations, and contact management into an installable feature.
11
11
  */
12
- export const CrmPipelineFeature: FeatureModuleSpec = {
12
+ export const CrmPipelineFeature = defineFeature({
13
13
  meta: {
14
14
  key: 'crm-pipeline',
15
15
  title: 'CRM Pipeline',
@@ -97,4 +97,4 @@ export const CrmPipelineFeature: FeatureModuleSpec = {
97
97
  { key: 'notifications', version: '1.0.0' },
98
98
  ],
99
99
  },
100
- };
100
+ });
@@ -0,0 +1,55 @@
1
+ import { defineTestSpec } from '@contractspec/lib.contracts';
2
+
3
+ export const dealListTest = defineTestSpec({
4
+ meta: {
5
+ key: 'test.crm.deal.list',
6
+ version: '1.0.0',
7
+ owners: ['@example.crm-pipeline'],
8
+ description: 'Test for listing deals',
9
+ stability: 'stable',
10
+ tags: ['test'],
11
+ },
12
+ target: {
13
+ type: 'operation',
14
+ operation: { key: 'crm.deal.list', version: '1.0.0' },
15
+ },
16
+ scenarios: [
17
+ {
18
+ key: 'success',
19
+ when: { operation: { key: 'crm.deal.list' } },
20
+ then: [{ type: 'expectOutput', match: {} }],
21
+ },
22
+ {
23
+ key: 'error',
24
+ when: { operation: { key: 'crm.deal.list' } },
25
+ then: [{ type: 'expectError' }],
26
+ },
27
+ ],
28
+ });
29
+
30
+ export const dealMoveTest = defineTestSpec({
31
+ meta: {
32
+ key: 'test.crm.deal.move',
33
+ version: '1.0.0',
34
+ owners: ['@example.crm-pipeline'],
35
+ description: 'Test for moving deal',
36
+ stability: 'stable',
37
+ tags: ['test'],
38
+ },
39
+ target: {
40
+ type: 'operation',
41
+ operation: { key: 'crm.deal.move', version: '1.0.0' },
42
+ },
43
+ scenarios: [
44
+ {
45
+ key: 'success',
46
+ when: { operation: { key: 'crm.deal.move' } },
47
+ then: [{ type: 'expectOutput', match: {} }],
48
+ },
49
+ {
50
+ key: 'error',
51
+ when: { operation: { key: 'crm.deal.move' } },
52
+ then: [{ type: 'expectError' }],
53
+ },
54
+ ],
55
+ });
package/src/example.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { ExampleSpec } from '@contractspec/lib.contracts';
1
+ import { defineExample } from '@contractspec/lib.contracts';
2
2
 
3
- const example: ExampleSpec = {
3
+ const example = defineExample({
4
4
  meta: {
5
5
  key: 'crm-pipeline',
6
6
  version: '1.0.0',
@@ -33,6 +33,6 @@ const example: ExampleSpec = {
33
33
  studio: { enabled: true, installable: true },
34
34
  mcp: { enabled: true },
35
35
  },
36
- };
36
+ });
37
37
 
38
38
  export default example;