@contractspec/example.crm-pipeline 3.7.6 → 3.7.7

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 (105) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/AGENTS.md +51 -33
  3. package/README.md +66 -148
  4. package/dist/browser/events/contact.event.js +1 -1
  5. package/dist/browser/events/deal.event.js +1 -1
  6. package/dist/browser/events/index.js +3 -3
  7. package/dist/browser/events/task.event.js +1 -1
  8. package/dist/browser/index.js +293 -293
  9. package/dist/browser/ui/CrmDashboard.js +221 -221
  10. package/dist/browser/ui/CrmDealCard.js +5 -5
  11. package/dist/browser/ui/CrmPipelineBoard.js +13 -13
  12. package/dist/browser/ui/hooks/index.js +2 -2
  13. package/dist/browser/ui/hooks/useDealList.js +1 -1
  14. package/dist/browser/ui/hooks/useDealMutations.js +1 -1
  15. package/dist/browser/ui/index.js +290 -290
  16. package/dist/browser/ui/modals/CreateDealModal.js +12 -12
  17. package/dist/browser/ui/modals/DealActionsModal.js +21 -21
  18. package/dist/browser/ui/modals/index.js +33 -33
  19. package/dist/browser/ui/renderers/index.js +116 -116
  20. package/dist/browser/ui/renderers/pipeline.renderer.js +97 -97
  21. package/dist/deal/index.d.ts +2 -2
  22. package/dist/events/contact.event.js +1 -1
  23. package/dist/events/deal.event.js +1 -1
  24. package/dist/events/index.js +3 -3
  25. package/dist/events/task.event.js +1 -1
  26. package/dist/handlers/index.d.ts +2 -2
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.js +293 -293
  29. package/dist/node/events/contact.event.js +1 -1
  30. package/dist/node/events/deal.event.js +1 -1
  31. package/dist/node/events/index.js +3 -3
  32. package/dist/node/events/task.event.js +1 -1
  33. package/dist/node/index.js +293 -293
  34. package/dist/node/ui/CrmDashboard.js +221 -221
  35. package/dist/node/ui/CrmDealCard.js +5 -5
  36. package/dist/node/ui/CrmPipelineBoard.js +13 -13
  37. package/dist/node/ui/hooks/index.js +2 -2
  38. package/dist/node/ui/hooks/useDealList.js +1 -1
  39. package/dist/node/ui/hooks/useDealMutations.js +1 -1
  40. package/dist/node/ui/index.js +290 -290
  41. package/dist/node/ui/modals/CreateDealModal.js +12 -12
  42. package/dist/node/ui/modals/DealActionsModal.js +21 -21
  43. package/dist/node/ui/modals/index.js +33 -33
  44. package/dist/node/ui/renderers/index.js +116 -116
  45. package/dist/node/ui/renderers/pipeline.renderer.js +97 -97
  46. package/dist/operations/index.d.ts +1 -1
  47. package/dist/ui/CrmDashboard.js +221 -221
  48. package/dist/ui/CrmDealCard.js +5 -5
  49. package/dist/ui/CrmPipelineBoard.js +13 -13
  50. package/dist/ui/hooks/index.d.ts +2 -2
  51. package/dist/ui/hooks/index.js +2 -2
  52. package/dist/ui/hooks/useDealList.js +1 -1
  53. package/dist/ui/hooks/useDealMutations.d.ts +9 -0
  54. package/dist/ui/hooks/useDealMutations.js +1 -1
  55. package/dist/ui/index.d.ts +3 -3
  56. package/dist/ui/index.js +290 -290
  57. package/dist/ui/modals/CreateDealModal.js +12 -12
  58. package/dist/ui/modals/DealActionsModal.js +21 -21
  59. package/dist/ui/modals/index.js +33 -33
  60. package/dist/ui/renderers/index.d.ts +1 -1
  61. package/dist/ui/renderers/index.js +116 -116
  62. package/dist/ui/renderers/pipeline.renderer.d.ts +1 -1
  63. package/dist/ui/renderers/pipeline.renderer.js +97 -97
  64. package/package.json +10 -10
  65. package/src/crm-pipeline.feature.ts +86 -86
  66. package/src/deal/deal.enum.ts +8 -8
  67. package/src/deal/deal.operation.ts +255 -255
  68. package/src/deal/deal.schema.ts +92 -92
  69. package/src/deal/deal.test-spec.ts +48 -48
  70. package/src/deal/index.ts +17 -19
  71. package/src/docs/crm-pipeline.docblock.ts +43 -43
  72. package/src/entities/company.entity.ts +52 -52
  73. package/src/entities/contact.entity.ts +67 -67
  74. package/src/entities/deal.entity.ts +134 -134
  75. package/src/entities/index.ts +27 -27
  76. package/src/entities/task.entity.ts +105 -105
  77. package/src/events/contact.event.ts +22 -22
  78. package/src/events/deal.event.ts +77 -77
  79. package/src/events/task.event.ts +19 -19
  80. package/src/example.ts +32 -32
  81. package/src/handlers/crm.handlers.ts +358 -357
  82. package/src/handlers/deal.handlers.ts +179 -179
  83. package/src/handlers/index.ts +18 -19
  84. package/src/handlers/mock-data.ts +167 -167
  85. package/src/index.ts +11 -11
  86. package/src/operations/index.ts +16 -16
  87. package/src/presentations/dashboard.presentation.ts +45 -45
  88. package/src/presentations/pipeline.presentation.ts +90 -90
  89. package/src/seeders/index.ts +26 -26
  90. package/src/shared/overlay-types.ts +23 -23
  91. package/src/ui/CrmDashboard.tsx +256 -256
  92. package/src/ui/CrmDealCard.tsx +64 -64
  93. package/src/ui/CrmPipelineBoard.tsx +105 -105
  94. package/src/ui/hooks/index.ts +3 -3
  95. package/src/ui/hooks/useDealList.ts +85 -85
  96. package/src/ui/hooks/useDealMutations.ts +151 -150
  97. package/src/ui/index.ts +5 -10
  98. package/src/ui/modals/CreateDealModal.tsx +217 -217
  99. package/src/ui/modals/DealActionsModal.tsx +390 -390
  100. package/src/ui/overlays/demo-overlays.ts +43 -43
  101. package/src/ui/renderers/index.ts +4 -3
  102. package/src/ui/renderers/pipeline.markdown.ts +165 -165
  103. package/src/ui/renderers/pipeline.renderer.tsx +17 -16
  104. package/tsconfig.json +7 -8
  105. package/tsdown.config.js +7 -3
@@ -2,8 +2,8 @@
2
2
  * Pipeline Presentation Descriptors
3
3
  */
4
4
  import {
5
- definePresentation,
6
- StabilityEnum,
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
- 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
- },
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
- 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
- },
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
- 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
- },
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
- 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
- },
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
  });
@@ -1,35 +1,35 @@
1
1
  import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';
2
2
 
3
3
  export async function seedCrmPipeline(params: {
4
- projectId: string;
5
- db: DatabasePort;
4
+ projectId: string;
5
+ db: DatabasePort;
6
6
  }) {
7
- const { projectId, db } = params;
7
+ const { projectId, db } = params;
8
8
 
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;
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
- 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
- );
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
- 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
- ];
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
- 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
- }
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
- overlayId: string;
3
- version: string;
4
- description: string;
5
- appliesTo: Record<string, string>;
6
- modifications: OverlayModification[];
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
- | HideFieldModification
11
- | RenameLabelModification
12
- | AddBadgeModification
13
- | SetLimitModification;
10
+ | HideFieldModification
11
+ | RenameLabelModification
12
+ | AddBadgeModification
13
+ | SetLimitModification;
14
14
 
15
15
  export interface HideFieldModification {
16
- type: 'hideField';
17
- field: string;
18
- reason?: string;
16
+ type: 'hideField';
17
+ field: string;
18
+ reason?: string;
19
19
  }
20
20
 
21
21
  export interface RenameLabelModification {
22
- type: 'renameLabel';
23
- field: string;
24
- newLabel: string;
22
+ type: 'renameLabel';
23
+ field: string;
24
+ newLabel: string;
25
25
  }
26
26
 
27
27
  export interface AddBadgeModification {
28
- type: 'addBadge';
29
- position: 'header' | 'footer';
30
- label: string;
31
- variant: 'warning' | 'info' | 'error' | 'success' | 'default';
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
- type: 'setLimit';
36
- field: string;
37
- max: number;
38
- message: string;
35
+ type: 'setLimit';
36
+ field: string;
37
+ max: number;
38
+ message: string;
39
39
  }