@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.
- package/.turbo/turbo-build.log +148 -164
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +39 -0
- package/dist/browser/crm-pipeline.feature.js +75 -0
- package/dist/browser/deal/deal.enum.js +18 -0
- package/dist/browser/deal/deal.operation.js +396 -0
- package/dist/browser/deal/deal.schema.js +141 -0
- package/dist/browser/deal/deal.test-spec.js +58 -0
- package/dist/browser/deal/index.js +408 -0
- package/dist/browser/docs/crm-pipeline.docblock.js +113 -0
- package/dist/browser/docs/index.js +113 -0
- package/dist/browser/entities/company.entity.js +52 -0
- package/dist/browser/entities/contact.entity.js +66 -0
- package/dist/browser/entities/deal.entity.js +107 -0
- package/dist/browser/entities/index.js +343 -0
- package/dist/browser/entities/task.entity.js +99 -0
- package/dist/browser/events/contact.event.js +31 -0
- package/dist/browser/events/deal.event.js +101 -0
- package/dist/browser/events/index.js +158 -0
- package/dist/browser/events/task.event.js +28 -0
- package/dist/browser/example.js +39 -0
- package/dist/browser/handlers/crm.handlers.js +160 -0
- package/dist/browser/handlers/deal.handlers.js +293 -0
- package/dist/browser/handlers/index.js +456 -0
- package/dist/browser/handlers/mock-data.js +165 -0
- package/dist/browser/index.js +3279 -0
- package/dist/browser/operations/index.js +407 -0
- package/dist/browser/presentations/dashboard.presentation.js +52 -0
- package/dist/browser/presentations/index.js +284 -0
- package/dist/browser/presentations/pipeline.presentation.js +233 -0
- package/dist/browser/seeders/index.js +22 -0
- package/dist/browser/shared/overlay-types.js +0 -0
- package/dist/browser/ui/CrmDashboard.js +1325 -0
- package/dist/browser/ui/CrmDealCard.js +50 -0
- package/dist/browser/ui/CrmPipelineBoard.js +160 -0
- package/dist/browser/ui/hooks/index.js +186 -0
- package/dist/browser/ui/hooks/useDealList.js +84 -0
- package/dist/browser/ui/hooks/useDealMutations.js +100 -0
- package/dist/browser/ui/index.js +1972 -0
- package/dist/browser/ui/modals/CreateDealModal.js +211 -0
- package/dist/browser/ui/modals/DealActionsModal.js +428 -0
- package/dist/browser/ui/modals/index.js +638 -0
- package/dist/browser/ui/overlays/demo-overlays.js +55 -0
- package/dist/browser/ui/overlays/index.js +55 -0
- package/dist/browser/ui/renderers/index.js +827 -0
- package/dist/browser/ui/renderers/pipeline.markdown.js +564 -0
- package/dist/browser/ui/renderers/pipeline.renderer.js +264 -0
- package/dist/crm-pipeline.feature.d.ts +1 -6
- package/dist/crm-pipeline.feature.d.ts.map +1 -1
- package/dist/crm-pipeline.feature.js +74 -164
- package/dist/deal/deal.enum.d.ts +2 -7
- package/dist/deal/deal.enum.d.ts.map +1 -1
- package/dist/deal/deal.enum.js +16 -22
- package/dist/deal/deal.operation.d.ts +444 -450
- package/dist/deal/deal.operation.d.ts.map +1 -1
- package/dist/deal/deal.operation.js +390 -263
- package/dist/deal/deal.schema.d.ts +251 -256
- package/dist/deal/deal.schema.d.ts.map +1 -1
- package/dist/deal/deal.schema.js +131 -275
- package/dist/deal/deal.test-spec.d.ts +2 -7
- package/dist/deal/deal.test-spec.d.ts.map +1 -1
- package/dist/deal/deal.test-spec.js +56 -62
- package/dist/deal/index.d.ts +7 -4
- package/dist/deal/index.d.ts.map +1 -0
- package/dist/deal/index.js +408 -4
- package/dist/docs/crm-pipeline.docblock.d.ts +2 -1
- package/dist/docs/crm-pipeline.docblock.d.ts.map +1 -0
- package/dist/docs/crm-pipeline.docblock.js +45 -51
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +114 -1
- package/dist/entities/company.entity.d.ts +27 -32
- package/dist/entities/company.entity.d.ts.map +1 -1
- package/dist/entities/company.entity.js +51 -61
- package/dist/entities/contact.entity.d.ts +31 -36
- package/dist/entities/contact.entity.d.ts.map +1 -1
- package/dist/entities/contact.entity.js +65 -76
- package/dist/entities/deal.entity.d.ts +52 -57
- package/dist/entities/deal.entity.d.ts.map +1 -1
- package/dist/entities/deal.entity.js +104 -116
- package/dist/entities/index.d.ts +6 -10
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +342 -31
- package/dist/entities/task.entity.d.ts +42 -47
- package/dist/entities/task.entity.d.ts.map +1 -1
- package/dist/entities/task.entity.js +95 -124
- package/dist/events/contact.event.d.ts +21 -27
- package/dist/events/contact.event.d.ts.map +1 -1
- package/dist/events/contact.event.js +29 -42
- package/dist/events/deal.event.d.ts +100 -106
- package/dist/events/deal.event.d.ts.map +1 -1
- package/dist/events/deal.event.js +93 -163
- package/dist/events/index.d.ts +4 -4
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +158 -4
- package/dist/events/task.event.d.ts +21 -27
- package/dist/events/task.event.d.ts.map +1 -1
- package/dist/events/task.event.js +26 -42
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +38 -50
- package/dist/handlers/crm.handlers.d.ts +80 -78
- package/dist/handlers/crm.handlers.d.ts.map +1 -1
- package/dist/handlers/crm.handlers.js +155 -166
- package/dist/handlers/deal.handlers.d.ts +58 -63
- package/dist/handlers/deal.handlers.d.ts.map +1 -1
- package/dist/handlers/deal.handlers.js +279 -105
- package/dist/handlers/index.d.ts +10 -4
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +456 -4
- package/dist/handlers/mock-data.d.ts +38 -41
- package/dist/handlers/mock-data.d.ts.map +1 -1
- package/dist/handlers/mock-data.js +162 -184
- package/dist/index.d.ts +13 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3277 -53
- package/dist/node/crm-pipeline.feature.js +75 -0
- package/dist/node/deal/deal.enum.js +18 -0
- package/dist/node/deal/deal.operation.js +396 -0
- package/dist/node/deal/deal.schema.js +141 -0
- package/dist/node/deal/deal.test-spec.js +58 -0
- package/dist/node/deal/index.js +408 -0
- package/dist/node/docs/crm-pipeline.docblock.js +113 -0
- package/dist/node/docs/index.js +113 -0
- package/dist/node/entities/company.entity.js +52 -0
- package/dist/node/entities/contact.entity.js +66 -0
- package/dist/node/entities/deal.entity.js +107 -0
- package/dist/node/entities/index.js +343 -0
- package/dist/node/entities/task.entity.js +99 -0
- package/dist/node/events/contact.event.js +31 -0
- package/dist/node/events/deal.event.js +101 -0
- package/dist/node/events/index.js +158 -0
- package/dist/node/events/task.event.js +28 -0
- package/dist/node/example.js +39 -0
- package/dist/node/handlers/crm.handlers.js +160 -0
- package/dist/node/handlers/deal.handlers.js +293 -0
- package/dist/node/handlers/index.js +456 -0
- package/dist/node/handlers/mock-data.js +165 -0
- package/dist/node/index.js +3279 -0
- package/dist/node/operations/index.js +407 -0
- package/dist/node/presentations/dashboard.presentation.js +52 -0
- package/dist/node/presentations/index.js +284 -0
- package/dist/node/presentations/pipeline.presentation.js +233 -0
- package/dist/node/seeders/index.js +22 -0
- package/dist/node/shared/overlay-types.js +0 -0
- package/dist/node/ui/CrmDashboard.js +1325 -0
- package/dist/node/ui/CrmDealCard.js +50 -0
- package/dist/node/ui/CrmPipelineBoard.js +160 -0
- package/dist/node/ui/hooks/index.js +186 -0
- package/dist/node/ui/hooks/useDealList.js +84 -0
- package/dist/node/ui/hooks/useDealMutations.js +100 -0
- package/dist/node/ui/index.js +1972 -0
- package/dist/node/ui/modals/CreateDealModal.js +211 -0
- package/dist/node/ui/modals/DealActionsModal.js +428 -0
- package/dist/node/ui/modals/index.js +638 -0
- package/dist/node/ui/overlays/demo-overlays.js +55 -0
- package/dist/node/ui/overlays/index.js +55 -0
- package/dist/node/ui/renderers/index.js +827 -0
- package/dist/node/ui/renderers/pipeline.markdown.js +564 -0
- package/dist/node/ui/renderers/pipeline.renderer.js +264 -0
- package/dist/operations/index.d.ts +2 -5
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +407 -5
- package/dist/presentations/dashboard.presentation.d.ts +2 -7
- package/dist/presentations/dashboard.presentation.d.ts.map +1 -1
- package/dist/presentations/dashboard.presentation.js +51 -60
- package/dist/presentations/index.d.ts +3 -3
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +284 -3
- package/dist/presentations/pipeline.presentation.d.ts +4 -9
- package/dist/presentations/pipeline.presentation.d.ts.map +1 -1
- package/dist/presentations/pipeline.presentation.js +228 -116
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +21 -45
- package/dist/shared/overlay-types.d.ts +25 -28
- package/dist/shared/overlay-types.d.ts.map +1 -1
- package/dist/shared/overlay-types.js +1 -0
- package/dist/ui/CrmDashboard.d.ts +1 -6
- package/dist/ui/CrmDashboard.d.ts.map +1 -1
- package/dist/ui/CrmDashboard.js +1318 -296
- package/dist/ui/CrmDealCard.d.ts +8 -12
- package/dist/ui/CrmDealCard.d.ts.map +1 -1
- package/dist/ui/CrmDealCard.js +47 -45
- package/dist/ui/CrmPipelineBoard.d.ts +11 -20
- package/dist/ui/CrmPipelineBoard.d.ts.map +1 -1
- package/dist/ui/CrmPipelineBoard.js +157 -94
- package/dist/ui/hooks/index.d.ts +3 -3
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +185 -4
- package/dist/ui/hooks/useDealList.d.ts +28 -32
- package/dist/ui/hooks/useDealList.d.ts.map +1 -1
- package/dist/ui/hooks/useDealList.js +81 -90
- package/dist/ui/hooks/useDealMutations.d.ts +18 -22
- package/dist/ui/hooks/useDealMutations.d.ts.map +1 -1
- package/dist/ui/hooks/useDealMutations.js +97 -155
- package/dist/ui/index.d.ts +8 -14
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +1973 -15
- package/dist/ui/modals/CreateDealModal.d.ts +19 -29
- package/dist/ui/modals/CreateDealModal.d.ts.map +1 -1
- package/dist/ui/modals/CreateDealModal.js +209 -180
- package/dist/ui/modals/DealActionsModal.d.ts +31 -44
- package/dist/ui/modals/DealActionsModal.d.ts.map +1 -1
- package/dist/ui/modals/DealActionsModal.js +424 -367
- package/dist/ui/modals/index.d.ts +3 -3
- package/dist/ui/modals/index.d.ts.map +1 -0
- package/dist/ui/modals/index.js +638 -3
- package/dist/ui/overlays/demo-overlays.d.ts +10 -8
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
- package/dist/ui/overlays/demo-overlays.js +54 -66
- package/dist/ui/overlays/index.d.ts +2 -2
- package/dist/ui/overlays/index.d.ts.map +1 -0
- package/dist/ui/overlays/index.js +56 -3
- package/dist/ui/renderers/index.d.ts +3 -3
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +827 -3
- package/dist/ui/renderers/pipeline.markdown.d.ts +12 -11
- package/dist/ui/renderers/pipeline.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/pipeline.markdown.js +560 -114
- package/dist/ui/renderers/pipeline.renderer.d.ts +9 -7
- package/dist/ui/renderers/pipeline.renderer.d.ts.map +1 -1
- package/dist/ui/renderers/pipeline.renderer.js +261 -24
- package/package.json +476 -90
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -164
- package/dist/crm-pipeline.feature.js.map +0 -1
- package/dist/deal/deal.enum.js.map +0 -1
- package/dist/deal/deal.operation.js.map +0 -1
- package/dist/deal/deal.schema.js.map +0 -1
- package/dist/deal/deal.test-spec.js.map +0 -1
- package/dist/docs/crm-pipeline.docblock.js.map +0 -1
- package/dist/entities/company.entity.js.map +0 -1
- package/dist/entities/contact.entity.js.map +0 -1
- package/dist/entities/deal.entity.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/task.entity.js.map +0 -1
- package/dist/events/contact.event.js.map +0 -1
- package/dist/events/deal.event.js.map +0 -1
- package/dist/events/task.event.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/crm.handlers.js.map +0 -1
- package/dist/handlers/deal.handlers.js.map +0 -1
- package/dist/handlers/mock-data.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/presentations/dashboard.presentation.js.map +0 -1
- package/dist/presentations/pipeline.presentation.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/ui/CrmDashboard.js.map +0 -1
- package/dist/ui/CrmDealCard.js.map +0 -1
- package/dist/ui/CrmPipelineBoard.js.map +0 -1
- package/dist/ui/hooks/useDealList.js.map +0 -1
- package/dist/ui/hooks/useDealMutations.js.map +0 -1
- package/dist/ui/modals/CreateDealModal.js.map +0 -1
- package/dist/ui/modals/DealActionsModal.js.map +0 -1
- package/dist/ui/overlays/demo-overlays.js.map +0 -1
- package/dist/ui/renderers/pipeline.markdown.js.map +0 -1
- package/dist/ui/renderers/pipeline.renderer.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
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 { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
|
|
133
|
+
var CrmDashboardPresentation = definePresentation({
|
|
134
|
+
meta: {
|
|
135
|
+
key: "crm.dashboard",
|
|
136
|
+
version: "1.0.0",
|
|
137
|
+
title: "CRM Dashboard",
|
|
138
|
+
description: "Main CRM dashboard with pipeline overview, deal stats, and activities",
|
|
139
|
+
domain: "crm-pipeline",
|
|
140
|
+
owners: ["@crm-team"],
|
|
141
|
+
tags: ["dashboard", "overview"],
|
|
142
|
+
stability: StabilityEnum.Experimental,
|
|
143
|
+
goal: "Provide a high-level overview of CRM performance and active deals.",
|
|
144
|
+
context: "The landing page for CRM users."
|
|
145
|
+
},
|
|
146
|
+
source: {
|
|
147
|
+
type: "component",
|
|
148
|
+
framework: "react",
|
|
149
|
+
componentKey: "CrmDashboard"
|
|
150
|
+
},
|
|
151
|
+
targets: ["react", "markdown"],
|
|
152
|
+
policy: {
|
|
153
|
+
flags: ["crm.enabled"]
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
var PipelineMetricsPresentation = definePresentation({
|
|
157
|
+
meta: {
|
|
158
|
+
key: "crm.pipeline.metrics",
|
|
159
|
+
version: "1.0.0",
|
|
160
|
+
title: "Pipeline Metrics",
|
|
161
|
+
description: "Pipeline metrics and forecasting view",
|
|
162
|
+
domain: "crm-pipeline",
|
|
163
|
+
owners: ["@crm-team"],
|
|
164
|
+
tags: ["pipeline", "metrics", "forecast"],
|
|
165
|
+
stability: StabilityEnum.Experimental,
|
|
166
|
+
goal: "Track pipeline health and sales forecasts.",
|
|
167
|
+
context: "Data-intensive widget for sales managers."
|
|
168
|
+
},
|
|
169
|
+
source: {
|
|
170
|
+
type: "component",
|
|
171
|
+
framework: "react",
|
|
172
|
+
componentKey: "PipelineMetricsView"
|
|
173
|
+
},
|
|
174
|
+
targets: ["react", "markdown"],
|
|
175
|
+
policy: {
|
|
176
|
+
flags: ["crm.metrics.enabled"]
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// src/presentations/pipeline.presentation.ts
|
|
181
|
+
import { definePresentation as definePresentation2, StabilityEnum as StabilityEnum2 } from "@contractspec/lib.contracts";
|
|
182
|
+
var PipelineKanbanPresentation = definePresentation2({
|
|
183
|
+
meta: {
|
|
184
|
+
key: "crm.pipeline.kanban",
|
|
185
|
+
version: "1.0.0",
|
|
186
|
+
title: "Pipeline Kanban",
|
|
187
|
+
description: "Kanban board view of deals organized by stage",
|
|
188
|
+
domain: "crm-pipeline",
|
|
189
|
+
owners: ["@crm-team"],
|
|
190
|
+
tags: ["pipeline", "kanban", "deals"],
|
|
191
|
+
stability: StabilityEnum2.Experimental,
|
|
192
|
+
goal: "Visualize the sales pipeline status and deal distribution across stages.",
|
|
193
|
+
context: "Used in the sales dashboard and management reports."
|
|
194
|
+
},
|
|
195
|
+
source: {
|
|
196
|
+
type: "component",
|
|
197
|
+
framework: "react",
|
|
198
|
+
componentKey: "PipelineKanbanView",
|
|
199
|
+
props: DealModel
|
|
200
|
+
},
|
|
201
|
+
targets: ["react", "markdown"],
|
|
202
|
+
policy: {
|
|
203
|
+
flags: ["crm.pipeline.enabled"]
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
var DealListPresentation = definePresentation2({
|
|
207
|
+
meta: {
|
|
208
|
+
key: "crm.deal.viewList",
|
|
209
|
+
version: "1.0.0",
|
|
210
|
+
title: "Deal List",
|
|
211
|
+
description: "List view of deals with value, status, and owner info",
|
|
212
|
+
domain: "crm-pipeline",
|
|
213
|
+
owners: ["@crm-team"],
|
|
214
|
+
tags: ["deal", "list"],
|
|
215
|
+
stability: StabilityEnum2.Experimental,
|
|
216
|
+
goal: "Search, filter, and review deal lists.",
|
|
217
|
+
context: "Standard view for deal management and bulk actions."
|
|
218
|
+
},
|
|
219
|
+
source: {
|
|
220
|
+
type: "component",
|
|
221
|
+
framework: "react",
|
|
222
|
+
componentKey: "DealListView",
|
|
223
|
+
props: DealModel
|
|
224
|
+
},
|
|
225
|
+
targets: ["react", "markdown", "application/json"],
|
|
226
|
+
policy: {
|
|
227
|
+
flags: ["crm.deals.enabled"]
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
var DealDetailPresentation = definePresentation2({
|
|
231
|
+
meta: {
|
|
232
|
+
key: "crm.deal.detail",
|
|
233
|
+
version: "1.0.0",
|
|
234
|
+
title: "Deal Details",
|
|
235
|
+
description: "Detailed view of a deal with activities, contacts, and history",
|
|
236
|
+
domain: "crm-pipeline",
|
|
237
|
+
owners: ["@crm-team"],
|
|
238
|
+
tags: ["deal", "detail"],
|
|
239
|
+
stability: StabilityEnum2.Experimental,
|
|
240
|
+
goal: "Deep dive into deal details and historical activities.",
|
|
241
|
+
context: "The main workspace for managing a single deal execution."
|
|
242
|
+
},
|
|
243
|
+
source: {
|
|
244
|
+
type: "component",
|
|
245
|
+
framework: "react",
|
|
246
|
+
componentKey: "DealDetailView"
|
|
247
|
+
},
|
|
248
|
+
targets: ["react", "markdown"],
|
|
249
|
+
policy: {
|
|
250
|
+
flags: ["crm.deals.enabled"]
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
var DealCardPresentation = definePresentation2({
|
|
254
|
+
meta: {
|
|
255
|
+
key: "crm.deal.card",
|
|
256
|
+
version: "1.0.0",
|
|
257
|
+
title: "Deal Card",
|
|
258
|
+
description: "Compact deal card for kanban board display",
|
|
259
|
+
domain: "crm-pipeline",
|
|
260
|
+
owners: ["@crm-team"],
|
|
261
|
+
tags: ["deal", "card", "kanban"],
|
|
262
|
+
stability: StabilityEnum2.Experimental,
|
|
263
|
+
goal: "Provide a quick overview of deal status in the pipeline view.",
|
|
264
|
+
context: "Condensed representation used within the Pipeline Kanban board."
|
|
265
|
+
},
|
|
266
|
+
source: {
|
|
267
|
+
type: "component",
|
|
268
|
+
framework: "react",
|
|
269
|
+
componentKey: "DealCard",
|
|
270
|
+
props: DealModel
|
|
271
|
+
},
|
|
272
|
+
targets: ["react"],
|
|
273
|
+
policy: {
|
|
274
|
+
flags: ["crm.deals.enabled"]
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
export {
|
|
278
|
+
PipelineMetricsPresentation,
|
|
279
|
+
PipelineKanbanPresentation,
|
|
280
|
+
DealListPresentation,
|
|
281
|
+
DealDetailPresentation,
|
|
282
|
+
DealCardPresentation,
|
|
283
|
+
CrmDashboardPresentation
|
|
284
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
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 { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
|
|
133
|
+
var PipelineKanbanPresentation = definePresentation({
|
|
134
|
+
meta: {
|
|
135
|
+
key: "crm.pipeline.kanban",
|
|
136
|
+
version: "1.0.0",
|
|
137
|
+
title: "Pipeline Kanban",
|
|
138
|
+
description: "Kanban board view of deals organized by stage",
|
|
139
|
+
domain: "crm-pipeline",
|
|
140
|
+
owners: ["@crm-team"],
|
|
141
|
+
tags: ["pipeline", "kanban", "deals"],
|
|
142
|
+
stability: StabilityEnum.Experimental,
|
|
143
|
+
goal: "Visualize the sales pipeline status and deal distribution across stages.",
|
|
144
|
+
context: "Used in the sales dashboard and management reports."
|
|
145
|
+
},
|
|
146
|
+
source: {
|
|
147
|
+
type: "component",
|
|
148
|
+
framework: "react",
|
|
149
|
+
componentKey: "PipelineKanbanView",
|
|
150
|
+
props: DealModel
|
|
151
|
+
},
|
|
152
|
+
targets: ["react", "markdown"],
|
|
153
|
+
policy: {
|
|
154
|
+
flags: ["crm.pipeline.enabled"]
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
var DealListPresentation = definePresentation({
|
|
158
|
+
meta: {
|
|
159
|
+
key: "crm.deal.viewList",
|
|
160
|
+
version: "1.0.0",
|
|
161
|
+
title: "Deal List",
|
|
162
|
+
description: "List view of deals with value, status, and owner info",
|
|
163
|
+
domain: "crm-pipeline",
|
|
164
|
+
owners: ["@crm-team"],
|
|
165
|
+
tags: ["deal", "list"],
|
|
166
|
+
stability: StabilityEnum.Experimental,
|
|
167
|
+
goal: "Search, filter, and review deal lists.",
|
|
168
|
+
context: "Standard view for deal management and bulk actions."
|
|
169
|
+
},
|
|
170
|
+
source: {
|
|
171
|
+
type: "component",
|
|
172
|
+
framework: "react",
|
|
173
|
+
componentKey: "DealListView",
|
|
174
|
+
props: DealModel
|
|
175
|
+
},
|
|
176
|
+
targets: ["react", "markdown", "application/json"],
|
|
177
|
+
policy: {
|
|
178
|
+
flags: ["crm.deals.enabled"]
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
var DealDetailPresentation = definePresentation({
|
|
182
|
+
meta: {
|
|
183
|
+
key: "crm.deal.detail",
|
|
184
|
+
version: "1.0.0",
|
|
185
|
+
title: "Deal Details",
|
|
186
|
+
description: "Detailed view of a deal with activities, contacts, and history",
|
|
187
|
+
domain: "crm-pipeline",
|
|
188
|
+
owners: ["@crm-team"],
|
|
189
|
+
tags: ["deal", "detail"],
|
|
190
|
+
stability: StabilityEnum.Experimental,
|
|
191
|
+
goal: "Deep dive into deal details and historical activities.",
|
|
192
|
+
context: "The main workspace for managing a single deal execution."
|
|
193
|
+
},
|
|
194
|
+
source: {
|
|
195
|
+
type: "component",
|
|
196
|
+
framework: "react",
|
|
197
|
+
componentKey: "DealDetailView"
|
|
198
|
+
},
|
|
199
|
+
targets: ["react", "markdown"],
|
|
200
|
+
policy: {
|
|
201
|
+
flags: ["crm.deals.enabled"]
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
var DealCardPresentation = definePresentation({
|
|
205
|
+
meta: {
|
|
206
|
+
key: "crm.deal.card",
|
|
207
|
+
version: "1.0.0",
|
|
208
|
+
title: "Deal Card",
|
|
209
|
+
description: "Compact deal card for kanban board display",
|
|
210
|
+
domain: "crm-pipeline",
|
|
211
|
+
owners: ["@crm-team"],
|
|
212
|
+
tags: ["deal", "card", "kanban"],
|
|
213
|
+
stability: StabilityEnum.Experimental,
|
|
214
|
+
goal: "Provide a quick overview of deal status in the pipeline view.",
|
|
215
|
+
context: "Condensed representation used within the Pipeline Kanban board."
|
|
216
|
+
},
|
|
217
|
+
source: {
|
|
218
|
+
type: "component",
|
|
219
|
+
framework: "react",
|
|
220
|
+
componentKey: "DealCard",
|
|
221
|
+
props: DealModel
|
|
222
|
+
},
|
|
223
|
+
targets: ["react"],
|
|
224
|
+
policy: {
|
|
225
|
+
flags: ["crm.deals.enabled"]
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
export {
|
|
229
|
+
PipelineKanbanPresentation,
|
|
230
|
+
DealListPresentation,
|
|
231
|
+
DealDetailPresentation,
|
|
232
|
+
DealCardPresentation
|
|
233
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
|
File without changes
|