@contractspec/example.crm-pipeline 3.7.6 → 3.7.10
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 +45 -42
- package/AGENTS.md +51 -33
- package/CHANGELOG.md +36 -0
- package/README.md +67 -148
- package/dist/browser/docs/crm-pipeline.docblock.js +1 -1
- package/dist/browser/docs/index.js +1 -1
- package/dist/browser/events/contact.event.js +1 -1
- package/dist/browser/events/deal.event.js +1 -1
- package/dist/browser/events/index.js +3 -3
- package/dist/browser/events/task.event.js +1 -1
- package/dist/browser/handlers/crm.handlers.js +13 -2
- package/dist/browser/handlers/index.js +13 -2
- package/dist/browser/index.js +680 -447
- package/dist/browser/ui/CrmDashboard.js +574 -352
- package/dist/browser/ui/CrmDealCard.js +5 -5
- package/dist/browser/ui/CrmPipelineBoard.js +13 -13
- package/dist/browser/ui/hooks/index.js +21 -10
- package/dist/browser/ui/hooks/useDealList.js +20 -9
- package/dist/browser/ui/hooks/useDealMutations.js +1 -1
- package/dist/browser/ui/index.js +683 -450
- package/dist/browser/ui/modals/CreateDealModal.js +12 -12
- package/dist/browser/ui/modals/DealActionsModal.js +21 -21
- package/dist/browser/ui/modals/index.js +33 -33
- package/dist/browser/ui/renderers/index.js +140 -118
- package/dist/browser/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/browser/ui/renderers/pipeline.renderer.js +108 -97
- package/dist/browser/ui/tables/DealListTab.js +390 -0
- package/dist/deal/index.d.ts +2 -2
- package/dist/docs/crm-pipeline.docblock.js +1 -1
- package/dist/docs/index.js +1 -1
- package/dist/events/contact.event.js +1 -1
- package/dist/events/deal.event.js +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/task.event.js +1 -1
- package/dist/handlers/crm.handlers.d.ts +2 -0
- package/dist/handlers/crm.handlers.js +13 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +13 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +680 -447
- package/dist/node/docs/crm-pipeline.docblock.js +1 -1
- package/dist/node/docs/index.js +1 -1
- package/dist/node/events/contact.event.js +1 -1
- package/dist/node/events/deal.event.js +1 -1
- package/dist/node/events/index.js +3 -3
- package/dist/node/events/task.event.js +1 -1
- package/dist/node/handlers/crm.handlers.js +13 -2
- package/dist/node/handlers/index.js +13 -2
- package/dist/node/index.js +680 -447
- package/dist/node/ui/CrmDashboard.js +574 -352
- package/dist/node/ui/CrmDealCard.js +5 -5
- package/dist/node/ui/CrmPipelineBoard.js +13 -13
- package/dist/node/ui/hooks/index.js +21 -10
- package/dist/node/ui/hooks/useDealList.js +20 -9
- package/dist/node/ui/hooks/useDealMutations.js +1 -1
- package/dist/node/ui/index.js +683 -450
- package/dist/node/ui/modals/CreateDealModal.js +12 -12
- package/dist/node/ui/modals/DealActionsModal.js +21 -21
- package/dist/node/ui/modals/index.js +33 -33
- package/dist/node/ui/renderers/index.js +140 -118
- package/dist/node/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/node/ui/renderers/pipeline.renderer.js +108 -97
- package/dist/node/ui/tables/DealListTab.js +390 -0
- package/dist/operations/index.d.ts +1 -1
- package/dist/ui/CrmDashboard.js +574 -352
- package/dist/ui/CrmDealCard.js +5 -5
- package/dist/ui/CrmPipelineBoard.js +13 -13
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.js +21 -10
- package/dist/ui/hooks/useDealList.d.ts +8 -2
- package/dist/ui/hooks/useDealList.js +20 -9
- package/dist/ui/hooks/useDealMutations.d.ts +9 -0
- package/dist/ui/hooks/useDealMutations.js +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +683 -450
- package/dist/ui/modals/CreateDealModal.js +12 -12
- package/dist/ui/modals/DealActionsModal.js +21 -21
- package/dist/ui/modals/index.js +33 -33
- package/dist/ui/renderers/index.d.ts +1 -1
- package/dist/ui/renderers/index.js +140 -118
- package/dist/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/ui/renderers/pipeline.renderer.d.ts +1 -1
- package/dist/ui/renderers/pipeline.renderer.js +108 -97
- package/dist/ui/tables/DealListTab.d.ts +20 -0
- package/dist/ui/tables/DealListTab.js +391 -0
- package/dist/ui/tables/DealListTab.smoke.test.d.ts +1 -0
- package/package.json +29 -14
- package/src/crm-pipeline.feature.ts +86 -86
- package/src/deal/deal.enum.ts +8 -8
- package/src/deal/deal.operation.ts +255 -255
- package/src/deal/deal.schema.ts +92 -92
- package/src/deal/deal.test-spec.ts +48 -48
- package/src/deal/index.ts +17 -19
- package/src/docs/crm-pipeline.docblock.ts +44 -44
- package/src/entities/company.entity.ts +52 -52
- package/src/entities/contact.entity.ts +67 -67
- package/src/entities/deal.entity.ts +134 -134
- package/src/entities/index.ts +27 -27
- package/src/entities/task.entity.ts +105 -105
- package/src/events/contact.event.ts +22 -22
- package/src/events/deal.event.ts +77 -77
- package/src/events/task.event.ts +19 -19
- package/src/example.ts +32 -32
- package/src/handlers/crm.handlers.ts +375 -357
- package/src/handlers/deal.handlers.ts +179 -179
- package/src/handlers/index.ts +18 -19
- package/src/handlers/mock-data.ts +167 -167
- package/src/index.ts +11 -11
- package/src/operations/index.ts +16 -16
- package/src/presentations/dashboard.presentation.ts +45 -45
- package/src/presentations/pipeline.presentation.ts +90 -90
- package/src/seeders/index.ts +26 -26
- package/src/shared/overlay-types.ts +23 -23
- package/src/ui/CrmDashboard.tsx +210 -279
- package/src/ui/CrmDealCard.tsx +64 -64
- package/src/ui/CrmPipelineBoard.tsx +105 -105
- package/src/ui/hooks/index.ts +3 -3
- package/src/ui/hooks/useDealList.ts +113 -85
- package/src/ui/hooks/useDealMutations.ts +151 -150
- package/src/ui/index.ts +5 -10
- package/src/ui/modals/CreateDealModal.tsx +217 -217
- package/src/ui/modals/DealActionsModal.tsx +390 -390
- package/src/ui/overlays/demo-overlays.ts +43 -43
- package/src/ui/renderers/index.ts +4 -3
- package/src/ui/renderers/pipeline.markdown.ts +165 -165
- package/src/ui/renderers/pipeline.renderer.tsx +17 -16
- package/src/ui/tables/DealListTab.smoke.test.tsx +149 -0
- package/src/ui/tables/DealListTab.tsx +276 -0
- package/tsconfig.json +7 -8
- package/tsdown.config.js +7 -3
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Pipeline Presentation Descriptors
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
definePresentation,
|
|
6
|
+
StabilityEnum,
|
|
7
7
|
} from '@contractspec/lib.contracts-spec';
|
|
8
8
|
import { DealModel } from '../deal/deal.schema';
|
|
9
9
|
|
|
@@ -11,110 +11,110 @@ import { DealModel } from '../deal/deal.schema';
|
|
|
11
11
|
* Kanban board presentation for the sales pipeline.
|
|
12
12
|
*/
|
|
13
13
|
export const PipelineKanbanPresentation = definePresentation({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
meta: {
|
|
15
|
+
key: 'crm.pipeline.kanban',
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
title: 'Pipeline Kanban',
|
|
18
|
+
description: 'Kanban board view of deals organized by stage',
|
|
19
|
+
domain: 'crm-pipeline',
|
|
20
|
+
owners: ['@crm-team'],
|
|
21
|
+
tags: ['pipeline', 'kanban', 'deals'],
|
|
22
|
+
stability: StabilityEnum.Experimental,
|
|
23
|
+
goal: 'Visualize the sales pipeline status and deal distribution across stages.',
|
|
24
|
+
context: 'Used in the sales dashboard and management reports.',
|
|
25
|
+
},
|
|
26
|
+
source: {
|
|
27
|
+
type: 'component',
|
|
28
|
+
framework: 'react',
|
|
29
|
+
componentKey: 'PipelineKanbanView',
|
|
30
|
+
props: DealModel,
|
|
31
|
+
},
|
|
32
|
+
targets: ['react', 'markdown'],
|
|
33
|
+
policy: {
|
|
34
|
+
flags: ['crm.pipeline.enabled'],
|
|
35
|
+
},
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* List view of deals with filtering.
|
|
40
40
|
*/
|
|
41
41
|
export const DealListPresentation = definePresentation({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
meta: {
|
|
43
|
+
key: 'crm.deal.viewList',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
title: 'Deal List',
|
|
46
|
+
description: 'List view of deals with value, status, and owner info',
|
|
47
|
+
domain: 'crm-pipeline',
|
|
48
|
+
owners: ['@crm-team'],
|
|
49
|
+
tags: ['deal', 'list'],
|
|
50
|
+
stability: StabilityEnum.Experimental,
|
|
51
|
+
goal: 'Search, filter, and review deal lists.',
|
|
52
|
+
context: 'Standard view for deal management and bulk actions.',
|
|
53
|
+
},
|
|
54
|
+
source: {
|
|
55
|
+
type: 'component',
|
|
56
|
+
framework: 'react',
|
|
57
|
+
componentKey: 'DealListView',
|
|
58
|
+
props: DealModel,
|
|
59
|
+
},
|
|
60
|
+
targets: ['react', 'markdown', 'application/json'],
|
|
61
|
+
policy: {
|
|
62
|
+
flags: ['crm.deals.enabled'],
|
|
63
|
+
},
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Deal detail presentation.
|
|
68
68
|
*/
|
|
69
69
|
export const DealDetailPresentation = definePresentation({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
70
|
+
meta: {
|
|
71
|
+
key: 'crm.deal.detail',
|
|
72
|
+
version: '1.0.0',
|
|
73
|
+
title: 'Deal Details',
|
|
74
|
+
description:
|
|
75
|
+
'Detailed view of a deal with activities, contacts, and history',
|
|
76
|
+
domain: 'crm-pipeline',
|
|
77
|
+
owners: ['@crm-team'],
|
|
78
|
+
tags: ['deal', 'detail'],
|
|
79
|
+
stability: StabilityEnum.Experimental,
|
|
80
|
+
goal: 'Deep dive into deal details and historical activities.',
|
|
81
|
+
context: 'The main workspace for managing a single deal execution.',
|
|
82
|
+
},
|
|
83
|
+
source: {
|
|
84
|
+
type: 'component',
|
|
85
|
+
framework: 'react',
|
|
86
|
+
componentKey: 'DealDetailView',
|
|
87
|
+
},
|
|
88
|
+
targets: ['react', 'markdown'],
|
|
89
|
+
policy: {
|
|
90
|
+
flags: ['crm.deals.enabled'],
|
|
91
|
+
},
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Deal card for kanban board.
|
|
96
96
|
*/
|
|
97
97
|
export const DealCardPresentation = definePresentation({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
98
|
+
meta: {
|
|
99
|
+
key: 'crm.deal.card',
|
|
100
|
+
version: '1.0.0',
|
|
101
|
+
title: 'Deal Card',
|
|
102
|
+
description: 'Compact deal card for kanban board display',
|
|
103
|
+
domain: 'crm-pipeline',
|
|
104
|
+
owners: ['@crm-team'],
|
|
105
|
+
tags: ['deal', 'card', 'kanban'],
|
|
106
|
+
stability: StabilityEnum.Experimental,
|
|
107
|
+
goal: 'Provide a quick overview of deal status in the pipeline view.',
|
|
108
|
+
context: 'Condensed representation used within the Pipeline Kanban board.',
|
|
109
|
+
},
|
|
110
|
+
source: {
|
|
111
|
+
type: 'component',
|
|
112
|
+
framework: 'react',
|
|
113
|
+
componentKey: 'DealCard',
|
|
114
|
+
props: DealModel,
|
|
115
|
+
},
|
|
116
|
+
targets: ['react'],
|
|
117
|
+
policy: {
|
|
118
|
+
flags: ['crm.deals.enabled'],
|
|
119
|
+
},
|
|
120
120
|
});
|
package/src/seeders/index.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';
|
|
2
2
|
|
|
3
3
|
export async function seedCrmPipeline(params: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
projectId: string;
|
|
5
|
+
db: DatabasePort;
|
|
6
6
|
}) {
|
|
7
|
-
|
|
7
|
+
const { projectId, db } = params;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const existing = await db.query(
|
|
10
|
+
`SELECT COUNT(*) as count FROM crm_pipeline WHERE "projectId" = $1`,
|
|
11
|
+
[projectId]
|
|
12
|
+
);
|
|
13
|
+
if ((existing.rows[0]?.count as number) > 0) return;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const pipelineId = 'pipeline_sales';
|
|
16
|
+
await db.execute(
|
|
17
|
+
`INSERT INTO crm_pipeline (id, "projectId", name) VALUES ($1, $2, $3)`,
|
|
18
|
+
[pipelineId, projectId, 'Sales Pipeline']
|
|
19
|
+
);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const stages = [
|
|
22
|
+
{ id: 'stage_lead', name: 'Lead', position: 1 },
|
|
23
|
+
{ id: 'stage_contact', name: 'Contact Made', position: 2 },
|
|
24
|
+
{ id: 'stage_proposal', name: 'Proposal', position: 3 },
|
|
25
|
+
{ id: 'stage_negotiation', name: 'Negotiation', position: 4 },
|
|
26
|
+
{ id: 'stage_closed', name: 'Closed', position: 5 },
|
|
27
|
+
];
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
for (const stage of stages) {
|
|
30
|
+
await db.execute(
|
|
31
|
+
`INSERT INTO crm_stage (id, "pipelineId", name, position) VALUES ($1, $2, $3, $4)`,
|
|
32
|
+
[stage.id, pipelineId, stage.name, stage.position]
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
35
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
export interface OverlayDefinition {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
overlayId: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description: string;
|
|
5
|
+
appliesTo: Record<string, string>;
|
|
6
|
+
modifications: OverlayModification[];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export type OverlayModification =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
| HideFieldModification
|
|
11
|
+
| RenameLabelModification
|
|
12
|
+
| AddBadgeModification
|
|
13
|
+
| SetLimitModification;
|
|
14
14
|
|
|
15
15
|
export interface HideFieldModification {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
type: 'hideField';
|
|
17
|
+
field: string;
|
|
18
|
+
reason?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface RenameLabelModification {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
type: 'renameLabel';
|
|
23
|
+
field: string;
|
|
24
|
+
newLabel: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface AddBadgeModification {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
type: 'addBadge';
|
|
29
|
+
position: 'header' | 'footer';
|
|
30
|
+
label: string;
|
|
31
|
+
variant: 'warning' | 'info' | 'error' | 'success' | 'default';
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface SetLimitModification {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
type: 'setLimit';
|
|
36
|
+
field: string;
|
|
37
|
+
max: number;
|
|
38
|
+
message: string;
|
|
39
39
|
}
|