@contractspec/example.crm-pipeline 3.7.17 → 3.7.18

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 (135) hide show
  1. package/.turbo/turbo-build.log +135 -135
  2. package/CHANGELOG.md +20 -0
  3. package/dist/browser/crm-pipeline.feature.js +1 -82
  4. package/dist/browser/deal/deal.enum.js +1 -18
  5. package/dist/browser/deal/deal.operation.js +1 -396
  6. package/dist/browser/deal/deal.schema.js +1 -141
  7. package/dist/browser/deal/deal.test-spec.js +1 -58
  8. package/dist/browser/deal/index.js +1 -408
  9. package/dist/browser/docs/crm-pipeline.docblock.js +5 -49
  10. package/dist/browser/docs/index.js +5 -49
  11. package/dist/browser/entities/company.entity.js +1 -52
  12. package/dist/browser/entities/contact.entity.js +1 -66
  13. package/dist/browser/entities/deal.entity.js +1 -107
  14. package/dist/browser/entities/index.js +1 -343
  15. package/dist/browser/entities/task.entity.js +1 -99
  16. package/dist/browser/events/contact.event.js +1 -31
  17. package/dist/browser/events/deal.event.js +1 -101
  18. package/dist/browser/events/index.js +1 -158
  19. package/dist/browser/events/task.event.js +1 -28
  20. package/dist/browser/example.js +1 -39
  21. package/dist/browser/handlers/crm.handlers.js +2 -171
  22. package/dist/browser/handlers/deal.handlers.js +1 -293
  23. package/dist/browser/handlers/index.js +2 -467
  24. package/dist/browser/handlers/mock-data.js +1 -165
  25. package/dist/browser/index.js +8 -3461
  26. package/dist/browser/operations/index.js +1 -407
  27. package/dist/browser/presentations/dashboard.presentation.js +1 -55
  28. package/dist/browser/presentations/index.js +1 -290
  29. package/dist/browser/presentations/pipeline.presentation.js +1 -236
  30. package/dist/browser/seeders/index.js +1 -22
  31. package/dist/browser/ui/CrmDashboard.js +1 -1547
  32. package/dist/browser/ui/CrmDealCard.js +1 -50
  33. package/dist/browser/ui/CrmPipelineBoard.js +1 -160
  34. package/dist/browser/ui/hooks/index.js +1 -197
  35. package/dist/browser/ui/hooks/useDealList.js +1 -95
  36. package/dist/browser/ui/hooks/useDealMutations.js +1 -100
  37. package/dist/browser/ui/index.js +4 -2205
  38. package/dist/browser/ui/modals/CreateDealModal.js +1 -211
  39. package/dist/browser/ui/modals/DealActionsModal.js +1 -428
  40. package/dist/browser/ui/modals/index.js +1 -638
  41. package/dist/browser/ui/overlays/demo-overlays.js +1 -55
  42. package/dist/browser/ui/overlays/index.js +1 -55
  43. package/dist/browser/ui/renderers/index.js +4 -849
  44. package/dist/browser/ui/renderers/pipeline.markdown.js +4 -575
  45. package/dist/browser/ui/renderers/pipeline.renderer.js +1 -275
  46. package/dist/browser/ui/tables/DealListTab.js +1 -390
  47. package/dist/crm-pipeline.feature.js +1 -82
  48. package/dist/deal/deal.enum.js +1 -18
  49. package/dist/deal/deal.operation.js +1 -396
  50. package/dist/deal/deal.schema.js +1 -141
  51. package/dist/deal/deal.test-spec.js +1 -58
  52. package/dist/deal/index.js +1 -408
  53. package/dist/docs/crm-pipeline.docblock.js +5 -49
  54. package/dist/docs/index.js +5 -49
  55. package/dist/entities/company.entity.js +1 -52
  56. package/dist/entities/contact.entity.js +1 -66
  57. package/dist/entities/deal.entity.js +1 -107
  58. package/dist/entities/index.js +1 -343
  59. package/dist/entities/task.entity.js +1 -99
  60. package/dist/events/contact.event.js +1 -31
  61. package/dist/events/deal.event.js +1 -101
  62. package/dist/events/index.js +1 -158
  63. package/dist/events/task.event.js +1 -28
  64. package/dist/example.js +1 -39
  65. package/dist/handlers/crm.handlers.js +2 -171
  66. package/dist/handlers/deal.handlers.js +1 -293
  67. package/dist/handlers/index.js +2 -467
  68. package/dist/handlers/mock-data.js +1 -165
  69. package/dist/index.js +8 -3461
  70. package/dist/node/crm-pipeline.feature.js +1 -82
  71. package/dist/node/deal/deal.enum.js +1 -18
  72. package/dist/node/deal/deal.operation.js +1 -396
  73. package/dist/node/deal/deal.schema.js +1 -141
  74. package/dist/node/deal/deal.test-spec.js +1 -58
  75. package/dist/node/deal/index.js +1 -408
  76. package/dist/node/docs/crm-pipeline.docblock.js +5 -49
  77. package/dist/node/docs/index.js +5 -49
  78. package/dist/node/entities/company.entity.js +1 -52
  79. package/dist/node/entities/contact.entity.js +1 -66
  80. package/dist/node/entities/deal.entity.js +1 -107
  81. package/dist/node/entities/index.js +1 -343
  82. package/dist/node/entities/task.entity.js +1 -99
  83. package/dist/node/events/contact.event.js +1 -31
  84. package/dist/node/events/deal.event.js +1 -101
  85. package/dist/node/events/index.js +1 -158
  86. package/dist/node/events/task.event.js +1 -28
  87. package/dist/node/example.js +1 -39
  88. package/dist/node/handlers/crm.handlers.js +2 -171
  89. package/dist/node/handlers/deal.handlers.js +1 -293
  90. package/dist/node/handlers/index.js +2 -467
  91. package/dist/node/handlers/mock-data.js +1 -165
  92. package/dist/node/index.js +8 -3461
  93. package/dist/node/operations/index.js +1 -407
  94. package/dist/node/presentations/dashboard.presentation.js +1 -55
  95. package/dist/node/presentations/index.js +1 -290
  96. package/dist/node/presentations/pipeline.presentation.js +1 -236
  97. package/dist/node/seeders/index.js +1 -22
  98. package/dist/node/ui/CrmDashboard.js +1 -1547
  99. package/dist/node/ui/CrmDealCard.js +1 -50
  100. package/dist/node/ui/CrmPipelineBoard.js +1 -160
  101. package/dist/node/ui/hooks/index.js +1 -197
  102. package/dist/node/ui/hooks/useDealList.js +1 -95
  103. package/dist/node/ui/hooks/useDealMutations.js +1 -100
  104. package/dist/node/ui/index.js +4 -2205
  105. package/dist/node/ui/modals/CreateDealModal.js +1 -211
  106. package/dist/node/ui/modals/DealActionsModal.js +1 -428
  107. package/dist/node/ui/modals/index.js +1 -638
  108. package/dist/node/ui/overlays/demo-overlays.js +1 -55
  109. package/dist/node/ui/overlays/index.js +1 -55
  110. package/dist/node/ui/renderers/index.js +4 -849
  111. package/dist/node/ui/renderers/pipeline.markdown.js +4 -575
  112. package/dist/node/ui/renderers/pipeline.renderer.js +1 -275
  113. package/dist/node/ui/tables/DealListTab.js +1 -390
  114. package/dist/operations/index.js +1 -407
  115. package/dist/presentations/dashboard.presentation.js +1 -55
  116. package/dist/presentations/index.js +1 -290
  117. package/dist/presentations/pipeline.presentation.js +1 -236
  118. package/dist/seeders/index.js +1 -22
  119. package/dist/ui/CrmDashboard.js +1 -1547
  120. package/dist/ui/CrmDealCard.js +1 -50
  121. package/dist/ui/CrmPipelineBoard.js +1 -160
  122. package/dist/ui/hooks/index.js +1 -197
  123. package/dist/ui/hooks/useDealList.js +1 -95
  124. package/dist/ui/hooks/useDealMutations.js +1 -100
  125. package/dist/ui/index.js +4 -2205
  126. package/dist/ui/modals/CreateDealModal.js +1 -211
  127. package/dist/ui/modals/DealActionsModal.js +1 -428
  128. package/dist/ui/modals/index.js +1 -638
  129. package/dist/ui/overlays/demo-overlays.js +1 -55
  130. package/dist/ui/overlays/index.js +1 -55
  131. package/dist/ui/renderers/index.js +4 -849
  132. package/dist/ui/renderers/pipeline.markdown.js +4 -575
  133. package/dist/ui/renderers/pipeline.renderer.js +1 -275
  134. package/dist/ui/tables/DealListTab.js +1 -390
  135. package/package.json +13 -13
@@ -1,290 +1 @@
1
- // src/deal/deal.enum.ts
2
- import { defineEnum } from "@contractspec/lib.schema";
3
- var DealStatusEnum = defineEnum("DealStatus", [
4
- "OPEN",
5
- "WON",
6
- "LOST",
7
- "STALE"
8
- ]);
9
- var DealStatusFilterEnum = defineEnum("DealStatusFilter", [
10
- "OPEN",
11
- "WON",
12
- "LOST",
13
- "all"
14
- ]);
15
-
16
- // src/deal/deal.schema.ts
17
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
18
- var DealModel = defineSchemaModel({
19
- name: "Deal",
20
- description: "A deal in the CRM pipeline",
21
- fields: {
22
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
25
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
- status: { type: DealStatusEnum, isOptional: false },
29
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
30
- companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
31
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
32
- expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
33
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
34
- updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
35
- }
36
- });
37
- var CreateDealInputModel = defineSchemaModel({
38
- name: "CreateDealInput",
39
- description: "Input for creating a deal",
40
- fields: {
41
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
42
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
43
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
44
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
45
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
46
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
47
- companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
48
- expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true }
49
- }
50
- });
51
- var MoveDealInputModel = defineSchemaModel({
52
- name: "MoveDealInput",
53
- description: "Input for moving a deal to another stage",
54
- fields: {
55
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
56
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
57
- position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
58
- }
59
- });
60
- var DealMovedPayloadModel = defineSchemaModel({
61
- name: "DealMovedPayload",
62
- fields: {
63
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
64
- fromStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
65
- toStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
66
- }
67
- });
68
- var WinDealInputModel = defineSchemaModel({
69
- name: "WinDealInput",
70
- description: "Input for marking a deal as won",
71
- fields: {
72
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
73
- wonSource: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
74
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
75
- }
76
- });
77
- var DealWonPayloadModel = defineSchemaModel({
78
- name: "DealWonPayload",
79
- fields: {
80
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
81
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
82
- }
83
- });
84
- var LoseDealInputModel = defineSchemaModel({
85
- name: "LoseDealInput",
86
- description: "Input for marking a deal as lost",
87
- fields: {
88
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
89
- lostReason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
90
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
91
- }
92
- });
93
- var DealLostPayloadModel = defineSchemaModel({
94
- name: "DealLostPayload",
95
- fields: {
96
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
97
- reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
98
- }
99
- });
100
- var ListDealsInputModel = defineSchemaModel({
101
- name: "ListDealsInput",
102
- description: "Input for listing deals",
103
- fields: {
104
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
105
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
106
- status: { type: DealStatusFilterEnum, isOptional: true },
107
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
108
- search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
109
- limit: {
110
- type: ScalarTypeEnum.Int_unsecure(),
111
- isOptional: true,
112
- defaultValue: 20
113
- },
114
- offset: {
115
- type: ScalarTypeEnum.Int_unsecure(),
116
- isOptional: true,
117
- defaultValue: 0
118
- }
119
- }
120
- });
121
- var ListDealsOutputModel = defineSchemaModel({
122
- name: "ListDealsOutput",
123
- description: "Output for listing deals",
124
- fields: {
125
- deals: { type: DealModel, isArray: true, isOptional: false },
126
- total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
127
- totalValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
128
- }
129
- });
130
-
131
- // src/presentations/dashboard.presentation.ts
132
- import {
133
- definePresentation,
134
- StabilityEnum
135
- } from "@contractspec/lib.contracts-spec";
136
- var CrmDashboardPresentation = definePresentation({
137
- meta: {
138
- key: "crm.dashboard",
139
- version: "1.0.0",
140
- title: "CRM Dashboard",
141
- description: "Main CRM dashboard with pipeline overview, deal stats, and activities",
142
- domain: "crm-pipeline",
143
- owners: ["@crm-team"],
144
- tags: ["dashboard", "overview"],
145
- stability: StabilityEnum.Experimental,
146
- goal: "Provide a high-level overview of CRM performance and active deals.",
147
- context: "The landing page for CRM users."
148
- },
149
- source: {
150
- type: "component",
151
- framework: "react",
152
- componentKey: "CrmDashboard"
153
- },
154
- targets: ["react", "markdown"],
155
- policy: {
156
- flags: ["crm.enabled"]
157
- }
158
- });
159
- var PipelineMetricsPresentation = definePresentation({
160
- meta: {
161
- key: "crm.pipeline.metrics",
162
- version: "1.0.0",
163
- title: "Pipeline Metrics",
164
- description: "Pipeline metrics and forecasting view",
165
- domain: "crm-pipeline",
166
- owners: ["@crm-team"],
167
- tags: ["pipeline", "metrics", "forecast"],
168
- stability: StabilityEnum.Experimental,
169
- goal: "Track pipeline health and sales forecasts.",
170
- context: "Data-intensive widget for sales managers."
171
- },
172
- source: {
173
- type: "component",
174
- framework: "react",
175
- componentKey: "PipelineMetricsView"
176
- },
177
- targets: ["react", "markdown"],
178
- policy: {
179
- flags: ["crm.metrics.enabled"]
180
- }
181
- });
182
-
183
- // src/presentations/pipeline.presentation.ts
184
- import {
185
- definePresentation as definePresentation2,
186
- StabilityEnum as StabilityEnum2
187
- } from "@contractspec/lib.contracts-spec";
188
- var PipelineKanbanPresentation = definePresentation2({
189
- meta: {
190
- key: "crm.pipeline.kanban",
191
- version: "1.0.0",
192
- title: "Pipeline Kanban",
193
- description: "Kanban board view of deals organized by stage",
194
- domain: "crm-pipeline",
195
- owners: ["@crm-team"],
196
- tags: ["pipeline", "kanban", "deals"],
197
- stability: StabilityEnum2.Experimental,
198
- goal: "Visualize the sales pipeline status and deal distribution across stages.",
199
- context: "Used in the sales dashboard and management reports."
200
- },
201
- source: {
202
- type: "component",
203
- framework: "react",
204
- componentKey: "PipelineKanbanView",
205
- props: DealModel
206
- },
207
- targets: ["react", "markdown"],
208
- policy: {
209
- flags: ["crm.pipeline.enabled"]
210
- }
211
- });
212
- var DealListPresentation = definePresentation2({
213
- meta: {
214
- key: "crm.deal.viewList",
215
- version: "1.0.0",
216
- title: "Deal List",
217
- description: "List view of deals with value, status, and owner info",
218
- domain: "crm-pipeline",
219
- owners: ["@crm-team"],
220
- tags: ["deal", "list"],
221
- stability: StabilityEnum2.Experimental,
222
- goal: "Search, filter, and review deal lists.",
223
- context: "Standard view for deal management and bulk actions."
224
- },
225
- source: {
226
- type: "component",
227
- framework: "react",
228
- componentKey: "DealListView",
229
- props: DealModel
230
- },
231
- targets: ["react", "markdown", "application/json"],
232
- policy: {
233
- flags: ["crm.deals.enabled"]
234
- }
235
- });
236
- var DealDetailPresentation = definePresentation2({
237
- meta: {
238
- key: "crm.deal.detail",
239
- version: "1.0.0",
240
- title: "Deal Details",
241
- description: "Detailed view of a deal with activities, contacts, and history",
242
- domain: "crm-pipeline",
243
- owners: ["@crm-team"],
244
- tags: ["deal", "detail"],
245
- stability: StabilityEnum2.Experimental,
246
- goal: "Deep dive into deal details and historical activities.",
247
- context: "The main workspace for managing a single deal execution."
248
- },
249
- source: {
250
- type: "component",
251
- framework: "react",
252
- componentKey: "DealDetailView"
253
- },
254
- targets: ["react", "markdown"],
255
- policy: {
256
- flags: ["crm.deals.enabled"]
257
- }
258
- });
259
- var DealCardPresentation = definePresentation2({
260
- meta: {
261
- key: "crm.deal.card",
262
- version: "1.0.0",
263
- title: "Deal Card",
264
- description: "Compact deal card for kanban board display",
265
- domain: "crm-pipeline",
266
- owners: ["@crm-team"],
267
- tags: ["deal", "card", "kanban"],
268
- stability: StabilityEnum2.Experimental,
269
- goal: "Provide a quick overview of deal status in the pipeline view.",
270
- context: "Condensed representation used within the Pipeline Kanban board."
271
- },
272
- source: {
273
- type: "component",
274
- framework: "react",
275
- componentKey: "DealCard",
276
- props: DealModel
277
- },
278
- targets: ["react"],
279
- policy: {
280
- flags: ["crm.deals.enabled"]
281
- }
282
- });
283
- export {
284
- PipelineMetricsPresentation,
285
- PipelineKanbanPresentation,
286
- DealListPresentation,
287
- DealDetailPresentation,
288
- DealCardPresentation,
289
- CrmDashboardPresentation
290
- };
1
+ import{defineEnum as w}from"@contractspec/lib.schema";var z=w("DealStatus",["OPEN","WON","LOST","STALE"]),A=w("DealStatusFilter",["OPEN","WON","LOST","all"]);import{defineSchemaModel as j,ScalarTypeEnum as x}from"@contractspec/lib.schema";var k=j({name:"Deal",description:"A deal in the CRM pipeline",fields:{id:{type:x.String_unsecure(),isOptional:!1},name:{type:x.String_unsecure(),isOptional:!1},value:{type:x.Float_unsecure(),isOptional:!1},currency:{type:x.String_unsecure(),isOptional:!1},pipelineId:{type:x.String_unsecure(),isOptional:!1},stageId:{type:x.String_unsecure(),isOptional:!1},status:{type:z,isOptional:!1},contactId:{type:x.String_unsecure(),isOptional:!0},companyId:{type:x.String_unsecure(),isOptional:!0},ownerId:{type:x.String_unsecure(),isOptional:!1},expectedCloseDate:{type:x.DateTime(),isOptional:!0},createdAt:{type:x.DateTime(),isOptional:!1},updatedAt:{type:x.DateTime(),isOptional:!1}}}),K=j({name:"CreateDealInput",description:"Input for creating a deal",fields:{name:{type:x.NonEmptyString(),isOptional:!1},value:{type:x.Float_unsecure(),isOptional:!1},currency:{type:x.String_unsecure(),isOptional:!0},pipelineId:{type:x.String_unsecure(),isOptional:!1},stageId:{type:x.String_unsecure(),isOptional:!1},contactId:{type:x.String_unsecure(),isOptional:!0},companyId:{type:x.String_unsecure(),isOptional:!0},expectedCloseDate:{type:x.DateTime(),isOptional:!0}}}),L=j({name:"MoveDealInput",description:"Input for moving a deal to another stage",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},stageId:{type:x.String_unsecure(),isOptional:!1},position:{type:x.Int_unsecure(),isOptional:!0}}}),N=j({name:"DealMovedPayload",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},fromStage:{type:x.String_unsecure(),isOptional:!1},toStage:{type:x.String_unsecure(),isOptional:!1}}}),Q=j({name:"WinDealInput",description:"Input for marking a deal as won",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},wonSource:{type:x.String_unsecure(),isOptional:!0},notes:{type:x.String_unsecure(),isOptional:!0}}}),R=j({name:"DealWonPayload",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},value:{type:x.Float_unsecure(),isOptional:!1}}}),U=j({name:"LoseDealInput",description:"Input for marking a deal as lost",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},lostReason:{type:x.String_unsecure(),isOptional:!1},notes:{type:x.String_unsecure(),isOptional:!0}}}),V=j({name:"DealLostPayload",fields:{dealId:{type:x.String_unsecure(),isOptional:!1},reason:{type:x.String_unsecure(),isOptional:!1}}}),W=j({name:"ListDealsInput",description:"Input for listing deals",fields:{pipelineId:{type:x.String_unsecure(),isOptional:!0},stageId:{type:x.String_unsecure(),isOptional:!0},status:{type:A,isOptional:!0},ownerId:{type:x.String_unsecure(),isOptional:!0},search:{type:x.String_unsecure(),isOptional:!0},limit:{type:x.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:x.Int_unsecure(),isOptional:!0,defaultValue:0}}}),X=j({name:"ListDealsOutput",description:"Output for listing deals",fields:{deals:{type:k,isArray:!0,isOptional:!1},total:{type:x.Int_unsecure(),isOptional:!1},totalValue:{type:x.Float_unsecure(),isOptional:!1}}});import{definePresentation as B,StabilityEnum as C}from"@contractspec/lib.contracts-spec";var _=B({meta:{key:"crm.dashboard",version:"1.0.0",title:"CRM Dashboard",description:"Main CRM dashboard with pipeline overview, deal stats, and activities",domain:"crm-pipeline",owners:["@crm-team"],tags:["dashboard","overview"],stability:C.Experimental,goal:"Provide a high-level overview of CRM performance and active deals.",context:"The landing page for CRM users."},source:{type:"component",framework:"react",componentKey:"CrmDashboard"},targets:["react","markdown"],policy:{flags:["crm.enabled"]}}),$=B({meta:{key:"crm.pipeline.metrics",version:"1.0.0",title:"Pipeline Metrics",description:"Pipeline metrics and forecasting view",domain:"crm-pipeline",owners:["@crm-team"],tags:["pipeline","metrics","forecast"],stability:C.Experimental,goal:"Track pipeline health and sales forecasts.",context:"Data-intensive widget for sales managers."},source:{type:"component",framework:"react",componentKey:"PipelineMetricsView"},targets:["react","markdown"],policy:{flags:["crm.metrics.enabled"]}});import{definePresentation as q,StabilityEnum as v}from"@contractspec/lib.contracts-spec";var P=q({meta:{key:"crm.pipeline.kanban",version:"1.0.0",title:"Pipeline Kanban",description:"Kanban board view of deals organized by stage",domain:"crm-pipeline",owners:["@crm-team"],tags:["pipeline","kanban","deals"],stability:v.Experimental,goal:"Visualize the sales pipeline status and deal distribution across stages.",context:"Used in the sales dashboard and management reports."},source:{type:"component",framework:"react",componentKey:"PipelineKanbanView",props:k},targets:["react","markdown"],policy:{flags:["crm.pipeline.enabled"]}}),D=q({meta:{key:"crm.deal.viewList",version:"1.0.0",title:"Deal List",description:"List view of deals with value, status, and owner info",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","list"],stability:v.Experimental,goal:"Search, filter, and review deal lists.",context:"Standard view for deal management and bulk actions."},source:{type:"component",framework:"react",componentKey:"DealListView",props:k},targets:["react","markdown","application/json"],policy:{flags:["crm.deals.enabled"]}}),b=q({meta:{key:"crm.deal.detail",version:"1.0.0",title:"Deal Details",description:"Detailed view of a deal with activities, contacts, and history",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","detail"],stability:v.Experimental,goal:"Deep dive into deal details and historical activities.",context:"The main workspace for managing a single deal execution."},source:{type:"component",framework:"react",componentKey:"DealDetailView"},targets:["react","markdown"],policy:{flags:["crm.deals.enabled"]}}),h=q({meta:{key:"crm.deal.card",version:"1.0.0",title:"Deal Card",description:"Compact deal card for kanban board display",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","card","kanban"],stability:v.Experimental,goal:"Provide a quick overview of deal status in the pipeline view.",context:"Condensed representation used within the Pipeline Kanban board."},source:{type:"component",framework:"react",componentKey:"DealCard",props:k},targets:["react"],policy:{flags:["crm.deals.enabled"]}});export{$ as PipelineMetricsPresentation,P as PipelineKanbanPresentation,D as DealListPresentation,b as DealDetailPresentation,h as DealCardPresentation,_ as CrmDashboardPresentation};
@@ -1,236 +1 @@
1
- // src/deal/deal.enum.ts
2
- import { defineEnum } from "@contractspec/lib.schema";
3
- var DealStatusEnum = defineEnum("DealStatus", [
4
- "OPEN",
5
- "WON",
6
- "LOST",
7
- "STALE"
8
- ]);
9
- var DealStatusFilterEnum = defineEnum("DealStatusFilter", [
10
- "OPEN",
11
- "WON",
12
- "LOST",
13
- "all"
14
- ]);
15
-
16
- // src/deal/deal.schema.ts
17
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
18
- var DealModel = defineSchemaModel({
19
- name: "Deal",
20
- description: "A deal in the CRM pipeline",
21
- fields: {
22
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
25
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
- status: { type: DealStatusEnum, isOptional: false },
29
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
30
- companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
31
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
32
- expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
33
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
34
- updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
35
- }
36
- });
37
- var CreateDealInputModel = defineSchemaModel({
38
- name: "CreateDealInput",
39
- description: "Input for creating a deal",
40
- fields: {
41
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
42
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
43
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
44
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
45
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
46
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
47
- companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
48
- expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true }
49
- }
50
- });
51
- var MoveDealInputModel = defineSchemaModel({
52
- name: "MoveDealInput",
53
- description: "Input for moving a deal to another stage",
54
- fields: {
55
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
56
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
57
- position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
58
- }
59
- });
60
- var DealMovedPayloadModel = defineSchemaModel({
61
- name: "DealMovedPayload",
62
- fields: {
63
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
64
- fromStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
65
- toStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
66
- }
67
- });
68
- var WinDealInputModel = defineSchemaModel({
69
- name: "WinDealInput",
70
- description: "Input for marking a deal as won",
71
- fields: {
72
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
73
- wonSource: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
74
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
75
- }
76
- });
77
- var DealWonPayloadModel = defineSchemaModel({
78
- name: "DealWonPayload",
79
- fields: {
80
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
81
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
82
- }
83
- });
84
- var LoseDealInputModel = defineSchemaModel({
85
- name: "LoseDealInput",
86
- description: "Input for marking a deal as lost",
87
- fields: {
88
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
89
- lostReason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
90
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
91
- }
92
- });
93
- var DealLostPayloadModel = defineSchemaModel({
94
- name: "DealLostPayload",
95
- fields: {
96
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
97
- reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
98
- }
99
- });
100
- var ListDealsInputModel = defineSchemaModel({
101
- name: "ListDealsInput",
102
- description: "Input for listing deals",
103
- fields: {
104
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
105
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
106
- status: { type: DealStatusFilterEnum, isOptional: true },
107
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
108
- search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
109
- limit: {
110
- type: ScalarTypeEnum.Int_unsecure(),
111
- isOptional: true,
112
- defaultValue: 20
113
- },
114
- offset: {
115
- type: ScalarTypeEnum.Int_unsecure(),
116
- isOptional: true,
117
- defaultValue: 0
118
- }
119
- }
120
- });
121
- var ListDealsOutputModel = defineSchemaModel({
122
- name: "ListDealsOutput",
123
- description: "Output for listing deals",
124
- fields: {
125
- deals: { type: DealModel, isArray: true, isOptional: false },
126
- total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
127
- totalValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
128
- }
129
- });
130
-
131
- // src/presentations/pipeline.presentation.ts
132
- import {
133
- definePresentation,
134
- StabilityEnum
135
- } from "@contractspec/lib.contracts-spec";
136
- var PipelineKanbanPresentation = definePresentation({
137
- meta: {
138
- key: "crm.pipeline.kanban",
139
- version: "1.0.0",
140
- title: "Pipeline Kanban",
141
- description: "Kanban board view of deals organized by stage",
142
- domain: "crm-pipeline",
143
- owners: ["@crm-team"],
144
- tags: ["pipeline", "kanban", "deals"],
145
- stability: StabilityEnum.Experimental,
146
- goal: "Visualize the sales pipeline status and deal distribution across stages.",
147
- context: "Used in the sales dashboard and management reports."
148
- },
149
- source: {
150
- type: "component",
151
- framework: "react",
152
- componentKey: "PipelineKanbanView",
153
- props: DealModel
154
- },
155
- targets: ["react", "markdown"],
156
- policy: {
157
- flags: ["crm.pipeline.enabled"]
158
- }
159
- });
160
- var DealListPresentation = definePresentation({
161
- meta: {
162
- key: "crm.deal.viewList",
163
- version: "1.0.0",
164
- title: "Deal List",
165
- description: "List view of deals with value, status, and owner info",
166
- domain: "crm-pipeline",
167
- owners: ["@crm-team"],
168
- tags: ["deal", "list"],
169
- stability: StabilityEnum.Experimental,
170
- goal: "Search, filter, and review deal lists.",
171
- context: "Standard view for deal management and bulk actions."
172
- },
173
- source: {
174
- type: "component",
175
- framework: "react",
176
- componentKey: "DealListView",
177
- props: DealModel
178
- },
179
- targets: ["react", "markdown", "application/json"],
180
- policy: {
181
- flags: ["crm.deals.enabled"]
182
- }
183
- });
184
- var DealDetailPresentation = definePresentation({
185
- meta: {
186
- key: "crm.deal.detail",
187
- version: "1.0.0",
188
- title: "Deal Details",
189
- description: "Detailed view of a deal with activities, contacts, and history",
190
- domain: "crm-pipeline",
191
- owners: ["@crm-team"],
192
- tags: ["deal", "detail"],
193
- stability: StabilityEnum.Experimental,
194
- goal: "Deep dive into deal details and historical activities.",
195
- context: "The main workspace for managing a single deal execution."
196
- },
197
- source: {
198
- type: "component",
199
- framework: "react",
200
- componentKey: "DealDetailView"
201
- },
202
- targets: ["react", "markdown"],
203
- policy: {
204
- flags: ["crm.deals.enabled"]
205
- }
206
- });
207
- var DealCardPresentation = definePresentation({
208
- meta: {
209
- key: "crm.deal.card",
210
- version: "1.0.0",
211
- title: "Deal Card",
212
- description: "Compact deal card for kanban board display",
213
- domain: "crm-pipeline",
214
- owners: ["@crm-team"],
215
- tags: ["deal", "card", "kanban"],
216
- stability: StabilityEnum.Experimental,
217
- goal: "Provide a quick overview of deal status in the pipeline view.",
218
- context: "Condensed representation used within the Pipeline Kanban board."
219
- },
220
- source: {
221
- type: "component",
222
- framework: "react",
223
- componentKey: "DealCard",
224
- props: DealModel
225
- },
226
- targets: ["react"],
227
- policy: {
228
- flags: ["crm.deals.enabled"]
229
- }
230
- });
231
- export {
232
- PipelineKanbanPresentation,
233
- DealListPresentation,
234
- DealDetailPresentation,
235
- DealCardPresentation
236
- };
1
+ import{defineEnum as x}from"@contractspec/lib.schema";var z=x("DealStatus",["OPEN","WON","LOST","STALE"]),A=x("DealStatusFilter",["OPEN","WON","LOST","all"]);import{defineSchemaModel as k,ScalarTypeEnum as j}from"@contractspec/lib.schema";var q=k({name:"Deal",description:"A deal in the CRM pipeline",fields:{id:{type:j.String_unsecure(),isOptional:!1},name:{type:j.String_unsecure(),isOptional:!1},value:{type:j.Float_unsecure(),isOptional:!1},currency:{type:j.String_unsecure(),isOptional:!1},pipelineId:{type:j.String_unsecure(),isOptional:!1},stageId:{type:j.String_unsecure(),isOptional:!1},status:{type:z,isOptional:!1},contactId:{type:j.String_unsecure(),isOptional:!0},companyId:{type:j.String_unsecure(),isOptional:!0},ownerId:{type:j.String_unsecure(),isOptional:!1},expectedCloseDate:{type:j.DateTime(),isOptional:!0},createdAt:{type:j.DateTime(),isOptional:!1},updatedAt:{type:j.DateTime(),isOptional:!1}}}),I=k({name:"CreateDealInput",description:"Input for creating a deal",fields:{name:{type:j.NonEmptyString(),isOptional:!1},value:{type:j.Float_unsecure(),isOptional:!1},currency:{type:j.String_unsecure(),isOptional:!0},pipelineId:{type:j.String_unsecure(),isOptional:!1},stageId:{type:j.String_unsecure(),isOptional:!1},contactId:{type:j.String_unsecure(),isOptional:!0},companyId:{type:j.String_unsecure(),isOptional:!0},expectedCloseDate:{type:j.DateTime(),isOptional:!0}}}),J=k({name:"MoveDealInput",description:"Input for moving a deal to another stage",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},stageId:{type:j.String_unsecure(),isOptional:!1},position:{type:j.Int_unsecure(),isOptional:!0}}}),K=k({name:"DealMovedPayload",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},fromStage:{type:j.String_unsecure(),isOptional:!1},toStage:{type:j.String_unsecure(),isOptional:!1}}}),L=k({name:"WinDealInput",description:"Input for marking a deal as won",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},wonSource:{type:j.String_unsecure(),isOptional:!0},notes:{type:j.String_unsecure(),isOptional:!0}}}),N=k({name:"DealWonPayload",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},value:{type:j.Float_unsecure(),isOptional:!1}}}),Q=k({name:"LoseDealInput",description:"Input for marking a deal as lost",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},lostReason:{type:j.String_unsecure(),isOptional:!1},notes:{type:j.String_unsecure(),isOptional:!0}}}),R=k({name:"DealLostPayload",fields:{dealId:{type:j.String_unsecure(),isOptional:!1},reason:{type:j.String_unsecure(),isOptional:!1}}}),U=k({name:"ListDealsInput",description:"Input for listing deals",fields:{pipelineId:{type:j.String_unsecure(),isOptional:!0},stageId:{type:j.String_unsecure(),isOptional:!0},status:{type:A,isOptional:!0},ownerId:{type:j.String_unsecure(),isOptional:!0},search:{type:j.String_unsecure(),isOptional:!0},limit:{type:j.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:j.Int_unsecure(),isOptional:!0,defaultValue:0}}}),V=k({name:"ListDealsOutput",description:"Output for listing deals",fields:{deals:{type:q,isArray:!0,isOptional:!1},total:{type:j.Int_unsecure(),isOptional:!1},totalValue:{type:j.Float_unsecure(),isOptional:!1}}});import{definePresentation as v,StabilityEnum as w}from"@contractspec/lib.contracts-spec";var Z=v({meta:{key:"crm.pipeline.kanban",version:"1.0.0",title:"Pipeline Kanban",description:"Kanban board view of deals organized by stage",domain:"crm-pipeline",owners:["@crm-team"],tags:["pipeline","kanban","deals"],stability:w.Experimental,goal:"Visualize the sales pipeline status and deal distribution across stages.",context:"Used in the sales dashboard and management reports."},source:{type:"component",framework:"react",componentKey:"PipelineKanbanView",props:q},targets:["react","markdown"],policy:{flags:["crm.pipeline.enabled"]}}),_=v({meta:{key:"crm.deal.viewList",version:"1.0.0",title:"Deal List",description:"List view of deals with value, status, and owner info",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","list"],stability:w.Experimental,goal:"Search, filter, and review deal lists.",context:"Standard view for deal management and bulk actions."},source:{type:"component",framework:"react",componentKey:"DealListView",props:q},targets:["react","markdown","application/json"],policy:{flags:["crm.deals.enabled"]}}),$=v({meta:{key:"crm.deal.detail",version:"1.0.0",title:"Deal Details",description:"Detailed view of a deal with activities, contacts, and history",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","detail"],stability:w.Experimental,goal:"Deep dive into deal details and historical activities.",context:"The main workspace for managing a single deal execution."},source:{type:"component",framework:"react",componentKey:"DealDetailView"},targets:["react","markdown"],policy:{flags:["crm.deals.enabled"]}}),g=v({meta:{key:"crm.deal.card",version:"1.0.0",title:"Deal Card",description:"Compact deal card for kanban board display",domain:"crm-pipeline",owners:["@crm-team"],tags:["deal","card","kanban"],stability:w.Experimental,goal:"Provide a quick overview of deal status in the pipeline view.",context:"Condensed representation used within the Pipeline Kanban board."},source:{type:"component",framework:"react",componentKey:"DealCard",props:q},targets:["react"],policy:{flags:["crm.deals.enabled"]}});export{Z as PipelineKanbanPresentation,_ as DealListPresentation,$ as DealDetailPresentation,g as DealCardPresentation};
@@ -1,22 +1 @@
1
- // src/seeders/index.ts
2
- async function seedCrmPipeline(params) {
3
- const { projectId, db } = params;
4
- const existing = await db.query(`SELECT COUNT(*) as count FROM crm_pipeline WHERE "projectId" = $1`, [projectId]);
5
- if (existing.rows[0]?.count > 0)
6
- return;
7
- const pipelineId = "pipeline_sales";
8
- await db.execute(`INSERT INTO crm_pipeline (id, "projectId", name) VALUES ($1, $2, $3)`, [pipelineId, projectId, "Sales Pipeline"]);
9
- const stages = [
10
- { id: "stage_lead", name: "Lead", position: 1 },
11
- { id: "stage_contact", name: "Contact Made", position: 2 },
12
- { id: "stage_proposal", name: "Proposal", position: 3 },
13
- { id: "stage_negotiation", name: "Negotiation", position: 4 },
14
- { id: "stage_closed", name: "Closed", position: 5 }
15
- ];
16
- for (const stage of stages) {
17
- await db.execute(`INSERT INTO crm_stage (id, "pipelineId", name, position) VALUES ($1, $2, $3, $4)`, [stage.id, pipelineId, stage.name, stage.position]);
18
- }
19
- }
20
- export {
21
- seedCrmPipeline
22
- };
1
+ async function p(n){let{projectId:i,db:e}=n;if((await e.query('SELECT COUNT(*) as count FROM crm_pipeline WHERE "projectId" = $1',[i])).rows[0]?.count>0)return;let o="pipeline_sales";await e.execute('INSERT INTO crm_pipeline (id, "projectId", name) VALUES ($1, $2, $3)',[o,i,"Sales Pipeline"]);let a=[{id:"stage_lead",name:"Lead",position:1},{id:"stage_contact",name:"Contact Made",position:2},{id:"stage_proposal",name:"Proposal",position:3},{id:"stage_negotiation",name:"Negotiation",position:4},{id:"stage_closed",name:"Closed",position:5}];for(let t of a)await e.execute('INSERT INTO crm_stage (id, "pipelineId", name, position) VALUES ($1, $2, $3, $4)',[t.id,o,t.name,t.position])}export{p as seedCrmPipeline};