@contractspec/example.crm-pipeline 1.57.0 → 1.59.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 (259) hide show
  1. package/.turbo/turbo-build.log +148 -164
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +39 -0
  4. package/dist/browser/crm-pipeline.feature.js +75 -0
  5. package/dist/browser/deal/deal.enum.js +18 -0
  6. package/dist/browser/deal/deal.operation.js +396 -0
  7. package/dist/browser/deal/deal.schema.js +141 -0
  8. package/dist/browser/deal/deal.test-spec.js +58 -0
  9. package/dist/browser/deal/index.js +408 -0
  10. package/dist/browser/docs/crm-pipeline.docblock.js +113 -0
  11. package/dist/browser/docs/index.js +113 -0
  12. package/dist/browser/entities/company.entity.js +52 -0
  13. package/dist/browser/entities/contact.entity.js +66 -0
  14. package/dist/browser/entities/deal.entity.js +107 -0
  15. package/dist/browser/entities/index.js +343 -0
  16. package/dist/browser/entities/task.entity.js +99 -0
  17. package/dist/browser/events/contact.event.js +31 -0
  18. package/dist/browser/events/deal.event.js +101 -0
  19. package/dist/browser/events/index.js +158 -0
  20. package/dist/browser/events/task.event.js +28 -0
  21. package/dist/browser/example.js +39 -0
  22. package/dist/browser/handlers/crm.handlers.js +160 -0
  23. package/dist/browser/handlers/deal.handlers.js +293 -0
  24. package/dist/browser/handlers/index.js +456 -0
  25. package/dist/browser/handlers/mock-data.js +165 -0
  26. package/dist/browser/index.js +3279 -0
  27. package/dist/browser/operations/index.js +407 -0
  28. package/dist/browser/presentations/dashboard.presentation.js +52 -0
  29. package/dist/browser/presentations/index.js +284 -0
  30. package/dist/browser/presentations/pipeline.presentation.js +233 -0
  31. package/dist/browser/seeders/index.js +22 -0
  32. package/dist/browser/shared/overlay-types.js +0 -0
  33. package/dist/browser/ui/CrmDashboard.js +1325 -0
  34. package/dist/browser/ui/CrmDealCard.js +50 -0
  35. package/dist/browser/ui/CrmPipelineBoard.js +160 -0
  36. package/dist/browser/ui/hooks/index.js +186 -0
  37. package/dist/browser/ui/hooks/useDealList.js +84 -0
  38. package/dist/browser/ui/hooks/useDealMutations.js +100 -0
  39. package/dist/browser/ui/index.js +1972 -0
  40. package/dist/browser/ui/modals/CreateDealModal.js +211 -0
  41. package/dist/browser/ui/modals/DealActionsModal.js +428 -0
  42. package/dist/browser/ui/modals/index.js +638 -0
  43. package/dist/browser/ui/overlays/demo-overlays.js +55 -0
  44. package/dist/browser/ui/overlays/index.js +55 -0
  45. package/dist/browser/ui/renderers/index.js +827 -0
  46. package/dist/browser/ui/renderers/pipeline.markdown.js +564 -0
  47. package/dist/browser/ui/renderers/pipeline.renderer.js +264 -0
  48. package/dist/crm-pipeline.feature.d.ts +1 -6
  49. package/dist/crm-pipeline.feature.d.ts.map +1 -1
  50. package/dist/crm-pipeline.feature.js +74 -164
  51. package/dist/deal/deal.enum.d.ts +2 -7
  52. package/dist/deal/deal.enum.d.ts.map +1 -1
  53. package/dist/deal/deal.enum.js +16 -22
  54. package/dist/deal/deal.operation.d.ts +444 -450
  55. package/dist/deal/deal.operation.d.ts.map +1 -1
  56. package/dist/deal/deal.operation.js +390 -263
  57. package/dist/deal/deal.schema.d.ts +251 -256
  58. package/dist/deal/deal.schema.d.ts.map +1 -1
  59. package/dist/deal/deal.schema.js +131 -275
  60. package/dist/deal/deal.test-spec.d.ts +2 -7
  61. package/dist/deal/deal.test-spec.d.ts.map +1 -1
  62. package/dist/deal/deal.test-spec.js +56 -62
  63. package/dist/deal/index.d.ts +7 -4
  64. package/dist/deal/index.d.ts.map +1 -0
  65. package/dist/deal/index.js +408 -4
  66. package/dist/docs/crm-pipeline.docblock.d.ts +2 -1
  67. package/dist/docs/crm-pipeline.docblock.d.ts.map +1 -0
  68. package/dist/docs/crm-pipeline.docblock.js +45 -51
  69. package/dist/docs/index.d.ts +2 -1
  70. package/dist/docs/index.d.ts.map +1 -0
  71. package/dist/docs/index.js +114 -1
  72. package/dist/entities/company.entity.d.ts +27 -32
  73. package/dist/entities/company.entity.d.ts.map +1 -1
  74. package/dist/entities/company.entity.js +51 -61
  75. package/dist/entities/contact.entity.d.ts +31 -36
  76. package/dist/entities/contact.entity.d.ts.map +1 -1
  77. package/dist/entities/contact.entity.js +65 -76
  78. package/dist/entities/deal.entity.d.ts +52 -57
  79. package/dist/entities/deal.entity.d.ts.map +1 -1
  80. package/dist/entities/deal.entity.js +104 -116
  81. package/dist/entities/index.d.ts +6 -10
  82. package/dist/entities/index.d.ts.map +1 -1
  83. package/dist/entities/index.js +342 -31
  84. package/dist/entities/task.entity.d.ts +42 -47
  85. package/dist/entities/task.entity.d.ts.map +1 -1
  86. package/dist/entities/task.entity.js +95 -124
  87. package/dist/events/contact.event.d.ts +21 -27
  88. package/dist/events/contact.event.d.ts.map +1 -1
  89. package/dist/events/contact.event.js +29 -42
  90. package/dist/events/deal.event.d.ts +100 -106
  91. package/dist/events/deal.event.d.ts.map +1 -1
  92. package/dist/events/deal.event.js +93 -163
  93. package/dist/events/index.d.ts +4 -4
  94. package/dist/events/index.d.ts.map +1 -0
  95. package/dist/events/index.js +158 -4
  96. package/dist/events/task.event.d.ts +21 -27
  97. package/dist/events/task.event.d.ts.map +1 -1
  98. package/dist/events/task.event.js +26 -42
  99. package/dist/example.d.ts +2 -6
  100. package/dist/example.d.ts.map +1 -1
  101. package/dist/example.js +38 -50
  102. package/dist/handlers/crm.handlers.d.ts +80 -78
  103. package/dist/handlers/crm.handlers.d.ts.map +1 -1
  104. package/dist/handlers/crm.handlers.js +155 -166
  105. package/dist/handlers/deal.handlers.d.ts +58 -63
  106. package/dist/handlers/deal.handlers.d.ts.map +1 -1
  107. package/dist/handlers/deal.handlers.js +279 -105
  108. package/dist/handlers/index.d.ts +10 -4
  109. package/dist/handlers/index.d.ts.map +1 -0
  110. package/dist/handlers/index.js +456 -4
  111. package/dist/handlers/mock-data.d.ts +38 -41
  112. package/dist/handlers/mock-data.d.ts.map +1 -1
  113. package/dist/handlers/mock-data.js +162 -184
  114. package/dist/index.d.ts +13 -42
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +3277 -53
  117. package/dist/node/crm-pipeline.feature.js +75 -0
  118. package/dist/node/deal/deal.enum.js +18 -0
  119. package/dist/node/deal/deal.operation.js +396 -0
  120. package/dist/node/deal/deal.schema.js +141 -0
  121. package/dist/node/deal/deal.test-spec.js +58 -0
  122. package/dist/node/deal/index.js +408 -0
  123. package/dist/node/docs/crm-pipeline.docblock.js +113 -0
  124. package/dist/node/docs/index.js +113 -0
  125. package/dist/node/entities/company.entity.js +52 -0
  126. package/dist/node/entities/contact.entity.js +66 -0
  127. package/dist/node/entities/deal.entity.js +107 -0
  128. package/dist/node/entities/index.js +343 -0
  129. package/dist/node/entities/task.entity.js +99 -0
  130. package/dist/node/events/contact.event.js +31 -0
  131. package/dist/node/events/deal.event.js +101 -0
  132. package/dist/node/events/index.js +158 -0
  133. package/dist/node/events/task.event.js +28 -0
  134. package/dist/node/example.js +39 -0
  135. package/dist/node/handlers/crm.handlers.js +160 -0
  136. package/dist/node/handlers/deal.handlers.js +293 -0
  137. package/dist/node/handlers/index.js +456 -0
  138. package/dist/node/handlers/mock-data.js +165 -0
  139. package/dist/node/index.js +3279 -0
  140. package/dist/node/operations/index.js +407 -0
  141. package/dist/node/presentations/dashboard.presentation.js +52 -0
  142. package/dist/node/presentations/index.js +284 -0
  143. package/dist/node/presentations/pipeline.presentation.js +233 -0
  144. package/dist/node/seeders/index.js +22 -0
  145. package/dist/node/shared/overlay-types.js +0 -0
  146. package/dist/node/ui/CrmDashboard.js +1325 -0
  147. package/dist/node/ui/CrmDealCard.js +50 -0
  148. package/dist/node/ui/CrmPipelineBoard.js +160 -0
  149. package/dist/node/ui/hooks/index.js +186 -0
  150. package/dist/node/ui/hooks/useDealList.js +84 -0
  151. package/dist/node/ui/hooks/useDealMutations.js +100 -0
  152. package/dist/node/ui/index.js +1972 -0
  153. package/dist/node/ui/modals/CreateDealModal.js +211 -0
  154. package/dist/node/ui/modals/DealActionsModal.js +428 -0
  155. package/dist/node/ui/modals/index.js +638 -0
  156. package/dist/node/ui/overlays/demo-overlays.js +55 -0
  157. package/dist/node/ui/overlays/index.js +55 -0
  158. package/dist/node/ui/renderers/index.js +827 -0
  159. package/dist/node/ui/renderers/pipeline.markdown.js +564 -0
  160. package/dist/node/ui/renderers/pipeline.renderer.js +264 -0
  161. package/dist/operations/index.d.ts +2 -5
  162. package/dist/operations/index.d.ts.map +1 -0
  163. package/dist/operations/index.js +407 -5
  164. package/dist/presentations/dashboard.presentation.d.ts +2 -7
  165. package/dist/presentations/dashboard.presentation.d.ts.map +1 -1
  166. package/dist/presentations/dashboard.presentation.js +51 -60
  167. package/dist/presentations/index.d.ts +3 -3
  168. package/dist/presentations/index.d.ts.map +1 -0
  169. package/dist/presentations/index.js +284 -3
  170. package/dist/presentations/pipeline.presentation.d.ts +4 -9
  171. package/dist/presentations/pipeline.presentation.d.ts.map +1 -1
  172. package/dist/presentations/pipeline.presentation.js +228 -116
  173. package/dist/seeders/index.d.ts +4 -8
  174. package/dist/seeders/index.d.ts.map +1 -1
  175. package/dist/seeders/index.js +21 -45
  176. package/dist/shared/overlay-types.d.ts +25 -28
  177. package/dist/shared/overlay-types.d.ts.map +1 -1
  178. package/dist/shared/overlay-types.js +1 -0
  179. package/dist/ui/CrmDashboard.d.ts +1 -6
  180. package/dist/ui/CrmDashboard.d.ts.map +1 -1
  181. package/dist/ui/CrmDashboard.js +1318 -296
  182. package/dist/ui/CrmDealCard.d.ts +8 -12
  183. package/dist/ui/CrmDealCard.d.ts.map +1 -1
  184. package/dist/ui/CrmDealCard.js +47 -45
  185. package/dist/ui/CrmPipelineBoard.d.ts +11 -20
  186. package/dist/ui/CrmPipelineBoard.d.ts.map +1 -1
  187. package/dist/ui/CrmPipelineBoard.js +157 -94
  188. package/dist/ui/hooks/index.d.ts +3 -3
  189. package/dist/ui/hooks/index.d.ts.map +1 -0
  190. package/dist/ui/hooks/index.js +185 -4
  191. package/dist/ui/hooks/useDealList.d.ts +28 -32
  192. package/dist/ui/hooks/useDealList.d.ts.map +1 -1
  193. package/dist/ui/hooks/useDealList.js +81 -90
  194. package/dist/ui/hooks/useDealMutations.d.ts +18 -22
  195. package/dist/ui/hooks/useDealMutations.d.ts.map +1 -1
  196. package/dist/ui/hooks/useDealMutations.js +97 -155
  197. package/dist/ui/index.d.ts +8 -14
  198. package/dist/ui/index.d.ts.map +1 -0
  199. package/dist/ui/index.js +1973 -15
  200. package/dist/ui/modals/CreateDealModal.d.ts +19 -29
  201. package/dist/ui/modals/CreateDealModal.d.ts.map +1 -1
  202. package/dist/ui/modals/CreateDealModal.js +209 -180
  203. package/dist/ui/modals/DealActionsModal.d.ts +31 -44
  204. package/dist/ui/modals/DealActionsModal.d.ts.map +1 -1
  205. package/dist/ui/modals/DealActionsModal.js +424 -367
  206. package/dist/ui/modals/index.d.ts +3 -3
  207. package/dist/ui/modals/index.d.ts.map +1 -0
  208. package/dist/ui/modals/index.js +638 -3
  209. package/dist/ui/overlays/demo-overlays.d.ts +10 -8
  210. package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
  211. package/dist/ui/overlays/demo-overlays.js +54 -66
  212. package/dist/ui/overlays/index.d.ts +2 -2
  213. package/dist/ui/overlays/index.d.ts.map +1 -0
  214. package/dist/ui/overlays/index.js +56 -3
  215. package/dist/ui/renderers/index.d.ts +3 -3
  216. package/dist/ui/renderers/index.d.ts.map +1 -0
  217. package/dist/ui/renderers/index.js +827 -3
  218. package/dist/ui/renderers/pipeline.markdown.d.ts +12 -11
  219. package/dist/ui/renderers/pipeline.markdown.d.ts.map +1 -1
  220. package/dist/ui/renderers/pipeline.markdown.js +560 -114
  221. package/dist/ui/renderers/pipeline.renderer.d.ts +9 -7
  222. package/dist/ui/renderers/pipeline.renderer.d.ts.map +1 -1
  223. package/dist/ui/renderers/pipeline.renderer.js +261 -24
  224. package/package.json +476 -90
  225. package/tsdown.config.js +1 -2
  226. package/.turbo/turbo-build$colon$bundle.log +0 -164
  227. package/dist/crm-pipeline.feature.js.map +0 -1
  228. package/dist/deal/deal.enum.js.map +0 -1
  229. package/dist/deal/deal.operation.js.map +0 -1
  230. package/dist/deal/deal.schema.js.map +0 -1
  231. package/dist/deal/deal.test-spec.js.map +0 -1
  232. package/dist/docs/crm-pipeline.docblock.js.map +0 -1
  233. package/dist/entities/company.entity.js.map +0 -1
  234. package/dist/entities/contact.entity.js.map +0 -1
  235. package/dist/entities/deal.entity.js.map +0 -1
  236. package/dist/entities/index.js.map +0 -1
  237. package/dist/entities/task.entity.js.map +0 -1
  238. package/dist/events/contact.event.js.map +0 -1
  239. package/dist/events/deal.event.js.map +0 -1
  240. package/dist/events/task.event.js.map +0 -1
  241. package/dist/example.js.map +0 -1
  242. package/dist/handlers/crm.handlers.js.map +0 -1
  243. package/dist/handlers/deal.handlers.js.map +0 -1
  244. package/dist/handlers/mock-data.js.map +0 -1
  245. package/dist/index.js.map +0 -1
  246. package/dist/presentations/dashboard.presentation.js.map +0 -1
  247. package/dist/presentations/pipeline.presentation.js.map +0 -1
  248. package/dist/seeders/index.js.map +0 -1
  249. package/dist/ui/CrmDashboard.js.map +0 -1
  250. package/dist/ui/CrmDealCard.js.map +0 -1
  251. package/dist/ui/CrmPipelineBoard.js.map +0 -1
  252. package/dist/ui/hooks/useDealList.js.map +0 -1
  253. package/dist/ui/hooks/useDealMutations.js.map +0 -1
  254. package/dist/ui/modals/CreateDealModal.js.map +0 -1
  255. package/dist/ui/modals/DealActionsModal.js.map +0 -1
  256. package/dist/ui/overlays/demo-overlays.js.map +0 -1
  257. package/dist/ui/renderers/pipeline.markdown.js.map +0 -1
  258. package/dist/ui/renderers/pipeline.renderer.js.map +0 -1
  259. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,264 @@
1
+ // src/ui/hooks/useDealList.ts
2
+ import { useCallback, useEffect, useMemo, useState } from "react";
3
+ import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ "use client";
5
+ function useDealList(options = {}) {
6
+ const { handlers, projectId } = useTemplateRuntime();
7
+ const { crm } = handlers;
8
+ const [data, setData] = useState(null);
9
+ const [dealsByStage, setDealsByStage] = useState({});
10
+ const [stages, setStages] = useState([]);
11
+ const [loading, setLoading] = useState(true);
12
+ const [error, setError] = useState(null);
13
+ const [page, setPage] = useState(1);
14
+ const pipelineId = options.pipelineId ?? "pipeline-1";
15
+ const fetchData = useCallback(async () => {
16
+ setLoading(true);
17
+ setError(null);
18
+ try {
19
+ const [dealsResult, stageDealsResult, stagesResult] = await Promise.all([
20
+ crm.listDeals({
21
+ projectId,
22
+ pipelineId,
23
+ stageId: options.stageId,
24
+ status: options.status === "all" ? undefined : options.status,
25
+ search: options.search,
26
+ limit: options.limit ?? 50,
27
+ offset: (page - 1) * (options.limit ?? 50)
28
+ }),
29
+ crm.getDealsByStage({ projectId, pipelineId }),
30
+ crm.getPipelineStages({ pipelineId })
31
+ ]);
32
+ setData(dealsResult);
33
+ setDealsByStage(stageDealsResult);
34
+ setStages(stagesResult);
35
+ } catch (err) {
36
+ setError(err instanceof Error ? err : new Error("Unknown error"));
37
+ } finally {
38
+ setLoading(false);
39
+ }
40
+ }, [
41
+ crm,
42
+ projectId,
43
+ pipelineId,
44
+ options.stageId,
45
+ options.status,
46
+ options.search,
47
+ options.limit,
48
+ page
49
+ ]);
50
+ useEffect(() => {
51
+ fetchData();
52
+ }, [fetchData]);
53
+ const stats = useMemo(() => {
54
+ if (!data)
55
+ return null;
56
+ const open = data.deals.filter((d) => d.status === "OPEN");
57
+ const won = data.deals.filter((d) => d.status === "WON");
58
+ const lost = data.deals.filter((d) => d.status === "LOST");
59
+ return {
60
+ total: data.total,
61
+ totalValue: data.totalValue,
62
+ openCount: open.length,
63
+ openValue: open.reduce((sum, d) => sum + d.value, 0),
64
+ wonCount: won.length,
65
+ wonValue: won.reduce((sum, d) => sum + d.value, 0),
66
+ lostCount: lost.length
67
+ };
68
+ }, [data]);
69
+ return {
70
+ data,
71
+ dealsByStage,
72
+ stages,
73
+ loading,
74
+ error,
75
+ stats,
76
+ page,
77
+ refetch: fetchData,
78
+ nextPage: () => setPage((p) => p + 1),
79
+ prevPage: () => page > 1 && setPage((p) => p - 1)
80
+ };
81
+ }
82
+
83
+ // src/ui/CrmDealCard.tsx
84
+ import { jsxDEV } from "react/jsx-dev-runtime";
85
+ "use client";
86
+ function formatCurrency(value, currency) {
87
+ return new Intl.NumberFormat("en-US", {
88
+ style: "currency",
89
+ currency,
90
+ minimumFractionDigits: 0,
91
+ maximumFractionDigits: 0
92
+ }).format(value);
93
+ }
94
+ function CrmDealCard({ deal, onClick }) {
95
+ const daysUntilClose = deal.expectedCloseDate ? Math.ceil((deal.expectedCloseDate.getTime() - Date.now()) / (1000 * 60 * 60 * 24)) : null;
96
+ return /* @__PURE__ */ jsxDEV("div", {
97
+ onClick,
98
+ className: "border-border bg-card cursor-pointer rounded-lg border p-3 shadow-sm transition-shadow hover:shadow-md",
99
+ role: "button",
100
+ tabIndex: 0,
101
+ onKeyDown: (e) => {
102
+ if (e.key === "Enter" || e.key === " ")
103
+ onClick?.();
104
+ },
105
+ children: [
106
+ /* @__PURE__ */ jsxDEV("h4", {
107
+ className: "leading-snug font-medium",
108
+ children: deal.name
109
+ }, undefined, false, undefined, this),
110
+ /* @__PURE__ */ jsxDEV("div", {
111
+ className: "text-primary mt-2 text-lg font-semibold",
112
+ children: formatCurrency(deal.value, deal.currency)
113
+ }, undefined, false, undefined, this),
114
+ /* @__PURE__ */ jsxDEV("div", {
115
+ className: "text-muted-foreground mt-3 flex items-center justify-between text-xs",
116
+ children: [
117
+ daysUntilClose !== null && /* @__PURE__ */ jsxDEV("span", {
118
+ className: daysUntilClose < 0 ? "text-red-500" : daysUntilClose <= 7 ? "text-yellow-600 dark:text-yellow-500" : "",
119
+ children: daysUntilClose < 0 ? `${Math.abs(daysUntilClose)}d overdue` : daysUntilClose === 0 ? "Due today" : `${daysUntilClose}d left`
120
+ }, undefined, false, undefined, this),
121
+ /* @__PURE__ */ jsxDEV("span", {
122
+ className: `rounded px-1.5 py-0.5 text-xs font-medium ${deal.status === "WON" ? "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" : deal.status === "LOST" ? "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400" : "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,
123
+ children: deal.status
124
+ }, undefined, false, undefined, this)
125
+ ]
126
+ }, undefined, true, undefined, this)
127
+ ]
128
+ }, undefined, true, undefined, this);
129
+ }
130
+
131
+ // src/ui/CrmPipelineBoard.tsx
132
+ import { useState as useState2 } from "react";
133
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
134
+ "use client";
135
+ function formatCurrency2(value) {
136
+ if (value >= 1e6)
137
+ return `$${(value / 1e6).toFixed(1)}M`;
138
+ if (value >= 1000)
139
+ return `$${(value / 1000).toFixed(0)}K`;
140
+ return `$${value}`;
141
+ }
142
+ function CrmPipelineBoard({
143
+ dealsByStage,
144
+ stages,
145
+ onDealClick,
146
+ onDealMove
147
+ }) {
148
+ const [quickMoveOpen, setQuickMoveOpen] = useState2(null);
149
+ const sortedStages = [...stages].sort((a, b) => a.position - b.position);
150
+ const handleQuickMove = (dealId, toStageId) => {
151
+ onDealMove?.(dealId, toStageId);
152
+ setQuickMoveOpen(null);
153
+ };
154
+ return /* @__PURE__ */ jsxDEV2("div", {
155
+ className: "flex gap-4 overflow-x-auto pb-4",
156
+ children: sortedStages.map((stage) => {
157
+ const deals = dealsByStage[stage.id] ?? [];
158
+ const stageValue = deals.reduce((sum, d) => sum + d.value, 0);
159
+ return /* @__PURE__ */ jsxDEV2("div", {
160
+ className: "bg-muted/30 flex w-72 flex-shrink-0 flex-col rounded-lg",
161
+ children: [
162
+ /* @__PURE__ */ jsxDEV2("div", {
163
+ className: "border-border flex items-center justify-between border-b px-3 py-2",
164
+ children: [
165
+ /* @__PURE__ */ jsxDEV2("div", {
166
+ children: [
167
+ /* @__PURE__ */ jsxDEV2("h3", {
168
+ className: "font-medium",
169
+ children: stage.name
170
+ }, undefined, false, undefined, this),
171
+ /* @__PURE__ */ jsxDEV2("p", {
172
+ className: "text-muted-foreground text-xs",
173
+ children: [
174
+ deals.length,
175
+ " deals · ",
176
+ formatCurrency2(stageValue)
177
+ ]
178
+ }, undefined, true, undefined, this)
179
+ ]
180
+ }, undefined, true, undefined, this),
181
+ /* @__PURE__ */ jsxDEV2("span", {
182
+ className: "bg-muted flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",
183
+ children: deals.length
184
+ }, undefined, false, undefined, this)
185
+ ]
186
+ }, undefined, true, undefined, this),
187
+ /* @__PURE__ */ jsxDEV2("div", {
188
+ className: "flex flex-1 flex-col gap-2 p-2",
189
+ children: deals.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
190
+ className: "border-muted-foreground/20 text-muted-foreground flex h-24 items-center justify-center rounded-md border-2 border-dashed text-xs",
191
+ children: "No deals"
192
+ }, undefined, false, undefined, this) : deals.map((deal) => /* @__PURE__ */ jsxDEV2("div", {
193
+ className: "group relative",
194
+ children: [
195
+ /* @__PURE__ */ jsxDEV2(CrmDealCard, {
196
+ deal,
197
+ onClick: () => onDealClick?.(deal.id)
198
+ }, undefined, false, undefined, this),
199
+ deal.status === "OPEN" && onDealMove && /* @__PURE__ */ jsxDEV2("div", {
200
+ className: "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100",
201
+ children: [
202
+ /* @__PURE__ */ jsxDEV2("button", {
203
+ type: "button",
204
+ onClick: (e) => {
205
+ e.stopPropagation();
206
+ setQuickMoveOpen(quickMoveOpen === deal.id ? null : deal.id);
207
+ },
208
+ className: "bg-background border-border hover:bg-muted flex h-6 w-6 items-center justify-center rounded border text-xs shadow-sm",
209
+ title: "Quick move",
210
+ children: "➡️"
211
+ }, undefined, false, undefined, this),
212
+ quickMoveOpen === deal.id && /* @__PURE__ */ jsxDEV2("div", {
213
+ className: "bg-card border-border absolute top-7 right-0 z-20 min-w-[140px] rounded-lg border py-1 shadow-lg",
214
+ children: [
215
+ /* @__PURE__ */ jsxDEV2("p", {
216
+ className: "text-muted-foreground px-3 py-1 text-xs font-medium",
217
+ children: "Move to:"
218
+ }, undefined, false, undefined, this),
219
+ sortedStages.filter((s) => s.id !== deal.stageId).map((s) => /* @__PURE__ */ jsxDEV2("button", {
220
+ type: "button",
221
+ onClick: (e) => {
222
+ e.stopPropagation();
223
+ handleQuickMove(deal.id, s.id);
224
+ },
225
+ className: "hover:bg-muted w-full px-3 py-1.5 text-left text-sm",
226
+ children: s.name
227
+ }, s.id, false, undefined, this))
228
+ ]
229
+ }, undefined, true, undefined, this)
230
+ ]
231
+ }, undefined, true, undefined, this)
232
+ ]
233
+ }, deal.id, true, undefined, this))
234
+ }, undefined, false, undefined, this)
235
+ ]
236
+ }, stage.id, true, undefined, this);
237
+ })
238
+ }, undefined, false, undefined, this);
239
+ }
240
+
241
+ // src/ui/renderers/pipeline.renderer.tsx
242
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
243
+ function CrmPipelineBoardWrapper() {
244
+ const { dealsByStage, stages } = useDealList();
245
+ return /* @__PURE__ */ jsxDEV3(CrmPipelineBoard, {
246
+ dealsByStage,
247
+ stages
248
+ }, undefined, false, undefined, this);
249
+ }
250
+ var crmPipelineReactRenderer = {
251
+ target: "react",
252
+ render: async (desc, _ctx) => {
253
+ if (desc.source.type !== "component") {
254
+ throw new Error("Invalid source type");
255
+ }
256
+ if (desc.source.componentKey !== "CrmPipelineView") {
257
+ throw new Error(`Unknown component: ${desc.source.componentKey}`);
258
+ }
259
+ return /* @__PURE__ */ jsxDEV3(CrmPipelineBoardWrapper, {}, undefined, false, undefined, this);
260
+ }
261
+ };
262
+ export {
263
+ crmPipelineReactRenderer
264
+ };
@@ -1,11 +1,6 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
-
3
- //#region src/crm-pipeline.feature.d.ts
4
1
  /**
5
2
  * CRM Pipeline feature module that bundles deal management,
6
3
  * pipeline operations, and contact management into an installable feature.
7
4
  */
8
- declare const CrmPipelineFeature: _contractspec_lib_contracts0.FeatureModuleSpec;
9
- //#endregion
10
- export { CrmPipelineFeature };
5
+ export declare const CrmPipelineFeature: import("@contractspec/lib.contracts").FeatureModuleSpec;
11
6
  //# sourceMappingURL=crm-pipeline.feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crm-pipeline.feature.d.ts","names":[],"sources":["../src/crm-pipeline.feature.ts"],"mappings":";;;;;;AAWA;cAAa,kBAAA,EAwFX,4BAAA,CAxF6B,iBAAA"}
1
+ {"version":3,"file":"crm-pipeline.feature.d.ts","sourceRoot":"","sources":["../src/crm-pipeline.feature.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,yDAwF7B,CAAC"}
@@ -1,166 +1,76 @@
1
+ // @bun
2
+ // src/crm-pipeline.feature.ts
1
3
  import { defineFeature } from "@contractspec/lib.contracts";
2
-
3
- //#region src/crm-pipeline.feature.ts
4
- /**
5
- * CRM Pipeline Feature Module Specification
6
- *
7
- * Defines the feature module for CRM and sales pipeline capabilities.
8
- */
9
- /**
10
- * CRM Pipeline feature module that bundles deal management,
11
- * pipeline operations, and contact management into an installable feature.
12
- */
13
- const CrmPipelineFeature = defineFeature({
14
- meta: {
15
- key: "crm-pipeline",
16
- title: "CRM Pipeline",
17
- description: "CRM and sales pipeline management with deals, contacts, and companies",
18
- domain: "crm",
19
- owners: ["@crm-team"],
20
- tags: [
21
- "crm",
22
- "sales",
23
- "pipeline",
24
- "deals"
25
- ],
26
- stability: "experimental",
27
- version: "1.0.0"
28
- },
29
- operations: [
30
- {
31
- key: "crm.deal.create",
32
- version: "1.0.0"
33
- },
34
- {
35
- key: "crm.deal.move",
36
- version: "1.0.0"
37
- },
38
- {
39
- key: "crm.deal.win",
40
- version: "1.0.0"
41
- },
42
- {
43
- key: "crm.deal.lose",
44
- version: "1.0.0"
45
- },
46
- {
47
- key: "crm.deal.list",
48
- version: "1.0.0"
49
- }
50
- ],
51
- events: [
52
- {
53
- key: "deal.created",
54
- version: "1.0.0"
55
- },
56
- {
57
- key: "deal.moved",
58
- version: "1.0.0"
59
- },
60
- {
61
- key: "deal.won",
62
- version: "1.0.0"
63
- },
64
- {
65
- key: "deal.lost",
66
- version: "1.0.0"
67
- },
68
- {
69
- key: "contact.created",
70
- version: "1.0.0"
71
- },
72
- {
73
- key: "task.completed",
74
- version: "1.0.0"
75
- }
76
- ],
77
- presentations: [
78
- {
79
- key: "crm.dashboard",
80
- version: "1.0.0"
81
- },
82
- {
83
- key: "crm.pipeline.kanban",
84
- version: "1.0.0"
85
- },
86
- {
87
- key: "crm.deal.viewList",
88
- version: "1.0.0"
89
- },
90
- {
91
- key: "crm.deal.detail",
92
- version: "1.0.0"
93
- },
94
- {
95
- key: "crm.deal.card",
96
- version: "1.0.0"
97
- },
98
- {
99
- key: "crm.pipeline.metrics",
100
- version: "1.0.0"
101
- }
102
- ],
103
- opToPresentation: [{
104
- op: {
105
- key: "crm.deal.list",
106
- version: "1.0.0"
107
- },
108
- pres: {
109
- key: "crm.pipeline.kanban",
110
- version: "1.0.0"
111
- }
112
- }, {
113
- op: {
114
- key: "crm.deal.move",
115
- version: "1.0.0"
116
- },
117
- pres: {
118
- key: "crm.pipeline.kanban",
119
- version: "1.0.0"
120
- }
121
- }],
122
- presentationsTargets: [
123
- {
124
- key: "crm.dashboard",
125
- version: "1.0.0",
126
- targets: ["react", "markdown"]
127
- },
128
- {
129
- key: "crm.pipeline.kanban",
130
- version: "1.0.0",
131
- targets: ["react", "markdown"]
132
- },
133
- {
134
- key: "crm.deal.viewList",
135
- version: "1.0.0",
136
- targets: [
137
- "react",
138
- "markdown",
139
- "application/json"
140
- ]
141
- },
142
- {
143
- key: "crm.pipeline.metrics",
144
- version: "1.0.0",
145
- targets: ["react", "markdown"]
146
- }
147
- ],
148
- capabilities: { requires: [
149
- {
150
- key: "identity",
151
- version: "1.0.0"
152
- },
153
- {
154
- key: "audit-trail",
155
- version: "1.0.0"
156
- },
157
- {
158
- key: "notifications",
159
- version: "1.0.0"
160
- }
161
- ] }
4
+ var CrmPipelineFeature = defineFeature({
5
+ meta: {
6
+ key: "crm-pipeline",
7
+ title: "CRM Pipeline",
8
+ description: "CRM and sales pipeline management with deals, contacts, and companies",
9
+ domain: "crm",
10
+ owners: ["@crm-team"],
11
+ tags: ["crm", "sales", "pipeline", "deals"],
12
+ stability: "experimental",
13
+ version: "1.0.0"
14
+ },
15
+ operations: [
16
+ { key: "crm.deal.create", version: "1.0.0" },
17
+ { key: "crm.deal.move", version: "1.0.0" },
18
+ { key: "crm.deal.win", version: "1.0.0" },
19
+ { key: "crm.deal.lose", version: "1.0.0" },
20
+ { key: "crm.deal.list", version: "1.0.0" }
21
+ ],
22
+ events: [
23
+ { key: "deal.created", version: "1.0.0" },
24
+ { key: "deal.moved", version: "1.0.0" },
25
+ { key: "deal.won", version: "1.0.0" },
26
+ { key: "deal.lost", version: "1.0.0" },
27
+ { key: "contact.created", version: "1.0.0" },
28
+ { key: "task.completed", version: "1.0.0" }
29
+ ],
30
+ presentations: [
31
+ { key: "crm.dashboard", version: "1.0.0" },
32
+ { key: "crm.pipeline.kanban", version: "1.0.0" },
33
+ { key: "crm.deal.viewList", version: "1.0.0" },
34
+ { key: "crm.deal.detail", version: "1.0.0" },
35
+ { key: "crm.deal.card", version: "1.0.0" },
36
+ { key: "crm.pipeline.metrics", version: "1.0.0" }
37
+ ],
38
+ opToPresentation: [
39
+ {
40
+ op: { key: "crm.deal.list", version: "1.0.0" },
41
+ pres: { key: "crm.pipeline.kanban", version: "1.0.0" }
42
+ },
43
+ {
44
+ op: { key: "crm.deal.move", version: "1.0.0" },
45
+ pres: { key: "crm.pipeline.kanban", version: "1.0.0" }
46
+ }
47
+ ],
48
+ presentationsTargets: [
49
+ { key: "crm.dashboard", version: "1.0.0", targets: ["react", "markdown"] },
50
+ {
51
+ key: "crm.pipeline.kanban",
52
+ version: "1.0.0",
53
+ targets: ["react", "markdown"]
54
+ },
55
+ {
56
+ key: "crm.deal.viewList",
57
+ version: "1.0.0",
58
+ targets: ["react", "markdown", "application/json"]
59
+ },
60
+ {
61
+ key: "crm.pipeline.metrics",
62
+ version: "1.0.0",
63
+ targets: ["react", "markdown"]
64
+ }
65
+ ],
66
+ capabilities: {
67
+ requires: [
68
+ { key: "identity", version: "1.0.0" },
69
+ { key: "audit-trail", version: "1.0.0" },
70
+ { key: "notifications", version: "1.0.0" }
71
+ ]
72
+ }
162
73
  });
163
-
164
- //#endregion
165
- export { CrmPipelineFeature };
166
- //# sourceMappingURL=crm-pipeline.feature.js.map
74
+ export {
75
+ CrmPipelineFeature
76
+ };
@@ -1,14 +1,9 @@
1
- import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
2
-
3
- //#region src/deal/deal.enum.d.ts
4
1
  /**
5
2
  * Deal status enum.
6
3
  */
7
- declare const DealStatusEnum: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
4
+ export declare const DealStatusEnum: import("@contractspec/lib.schema").EnumType<[string, string, string, string]>;
8
5
  /**
9
6
  * Deal status filter enum.
10
7
  */
11
- declare const DealStatusFilterEnum: _contractspec_lib_schema0.EnumType<[string, string, string, string]>;
12
- //#endregion
13
- export { DealStatusEnum, DealStatusFilterEnum };
8
+ export declare const DealStatusFilterEnum: import("@contractspec/lib.schema").EnumType<[string, string, string, string]>;
14
9
  //# sourceMappingURL=deal.enum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deal.enum.d.ts","names":[],"sources":["../../src/deal/deal.enum.ts"],"mappings":";;;;;;cAKa,cAAA,EAKX,yBAAA,CALyB,QAAA;;;;cAUd,oBAAA,EAKX,yBAAA,CAL+B,QAAA"}
1
+ {"version":3,"file":"deal.enum.d.ts","sourceRoot":"","sources":["../../src/deal/deal.enum.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,cAAc,+EAKzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,+EAK/B,CAAC"}
@@ -1,25 +1,19 @@
1
+ // @bun
2
+ // src/deal/deal.enum.ts
1
3
  import { defineEnum } from "@contractspec/lib.schema";
2
-
3
- //#region src/deal/deal.enum.ts
4
- /**
5
- * Deal status enum.
6
- */
7
- const DealStatusEnum = defineEnum("DealStatus", [
8
- "OPEN",
9
- "WON",
10
- "LOST",
11
- "STALE"
4
+ var DealStatusEnum = defineEnum("DealStatus", [
5
+ "OPEN",
6
+ "WON",
7
+ "LOST",
8
+ "STALE"
12
9
  ]);
13
- /**
14
- * Deal status filter enum.
15
- */
16
- const DealStatusFilterEnum = defineEnum("DealStatusFilter", [
17
- "OPEN",
18
- "WON",
19
- "LOST",
20
- "all"
10
+ var DealStatusFilterEnum = defineEnum("DealStatusFilter", [
11
+ "OPEN",
12
+ "WON",
13
+ "LOST",
14
+ "all"
21
15
  ]);
22
-
23
- //#endregion
24
- export { DealStatusEnum, DealStatusFilterEnum };
25
- //# sourceMappingURL=deal.enum.js.map
16
+ export {
17
+ DealStatusFilterEnum,
18
+ DealStatusEnum
19
+ };