@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.
Files changed (130) hide show
  1. package/.turbo/turbo-build.log +45 -42
  2. package/AGENTS.md +51 -33
  3. package/CHANGELOG.md +36 -0
  4. package/README.md +67 -148
  5. package/dist/browser/docs/crm-pipeline.docblock.js +1 -1
  6. package/dist/browser/docs/index.js +1 -1
  7. package/dist/browser/events/contact.event.js +1 -1
  8. package/dist/browser/events/deal.event.js +1 -1
  9. package/dist/browser/events/index.js +3 -3
  10. package/dist/browser/events/task.event.js +1 -1
  11. package/dist/browser/handlers/crm.handlers.js +13 -2
  12. package/dist/browser/handlers/index.js +13 -2
  13. package/dist/browser/index.js +680 -447
  14. package/dist/browser/ui/CrmDashboard.js +574 -352
  15. package/dist/browser/ui/CrmDealCard.js +5 -5
  16. package/dist/browser/ui/CrmPipelineBoard.js +13 -13
  17. package/dist/browser/ui/hooks/index.js +21 -10
  18. package/dist/browser/ui/hooks/useDealList.js +20 -9
  19. package/dist/browser/ui/hooks/useDealMutations.js +1 -1
  20. package/dist/browser/ui/index.js +683 -450
  21. package/dist/browser/ui/modals/CreateDealModal.js +12 -12
  22. package/dist/browser/ui/modals/DealActionsModal.js +21 -21
  23. package/dist/browser/ui/modals/index.js +33 -33
  24. package/dist/browser/ui/renderers/index.js +140 -118
  25. package/dist/browser/ui/renderers/pipeline.markdown.js +13 -2
  26. package/dist/browser/ui/renderers/pipeline.renderer.js +108 -97
  27. package/dist/browser/ui/tables/DealListTab.js +390 -0
  28. package/dist/deal/index.d.ts +2 -2
  29. package/dist/docs/crm-pipeline.docblock.js +1 -1
  30. package/dist/docs/index.js +1 -1
  31. package/dist/events/contact.event.js +1 -1
  32. package/dist/events/deal.event.js +1 -1
  33. package/dist/events/index.js +3 -3
  34. package/dist/events/task.event.js +1 -1
  35. package/dist/handlers/crm.handlers.d.ts +2 -0
  36. package/dist/handlers/crm.handlers.js +13 -2
  37. package/dist/handlers/index.d.ts +2 -2
  38. package/dist/handlers/index.js +13 -2
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +680 -447
  41. package/dist/node/docs/crm-pipeline.docblock.js +1 -1
  42. package/dist/node/docs/index.js +1 -1
  43. package/dist/node/events/contact.event.js +1 -1
  44. package/dist/node/events/deal.event.js +1 -1
  45. package/dist/node/events/index.js +3 -3
  46. package/dist/node/events/task.event.js +1 -1
  47. package/dist/node/handlers/crm.handlers.js +13 -2
  48. package/dist/node/handlers/index.js +13 -2
  49. package/dist/node/index.js +680 -447
  50. package/dist/node/ui/CrmDashboard.js +574 -352
  51. package/dist/node/ui/CrmDealCard.js +5 -5
  52. package/dist/node/ui/CrmPipelineBoard.js +13 -13
  53. package/dist/node/ui/hooks/index.js +21 -10
  54. package/dist/node/ui/hooks/useDealList.js +20 -9
  55. package/dist/node/ui/hooks/useDealMutations.js +1 -1
  56. package/dist/node/ui/index.js +683 -450
  57. package/dist/node/ui/modals/CreateDealModal.js +12 -12
  58. package/dist/node/ui/modals/DealActionsModal.js +21 -21
  59. package/dist/node/ui/modals/index.js +33 -33
  60. package/dist/node/ui/renderers/index.js +140 -118
  61. package/dist/node/ui/renderers/pipeline.markdown.js +13 -2
  62. package/dist/node/ui/renderers/pipeline.renderer.js +108 -97
  63. package/dist/node/ui/tables/DealListTab.js +390 -0
  64. package/dist/operations/index.d.ts +1 -1
  65. package/dist/ui/CrmDashboard.js +574 -352
  66. package/dist/ui/CrmDealCard.js +5 -5
  67. package/dist/ui/CrmPipelineBoard.js +13 -13
  68. package/dist/ui/hooks/index.d.ts +2 -2
  69. package/dist/ui/hooks/index.js +21 -10
  70. package/dist/ui/hooks/useDealList.d.ts +8 -2
  71. package/dist/ui/hooks/useDealList.js +20 -9
  72. package/dist/ui/hooks/useDealMutations.d.ts +9 -0
  73. package/dist/ui/hooks/useDealMutations.js +1 -1
  74. package/dist/ui/index.d.ts +3 -3
  75. package/dist/ui/index.js +683 -450
  76. package/dist/ui/modals/CreateDealModal.js +12 -12
  77. package/dist/ui/modals/DealActionsModal.js +21 -21
  78. package/dist/ui/modals/index.js +33 -33
  79. package/dist/ui/renderers/index.d.ts +1 -1
  80. package/dist/ui/renderers/index.js +140 -118
  81. package/dist/ui/renderers/pipeline.markdown.js +13 -2
  82. package/dist/ui/renderers/pipeline.renderer.d.ts +1 -1
  83. package/dist/ui/renderers/pipeline.renderer.js +108 -97
  84. package/dist/ui/tables/DealListTab.d.ts +20 -0
  85. package/dist/ui/tables/DealListTab.js +391 -0
  86. package/dist/ui/tables/DealListTab.smoke.test.d.ts +1 -0
  87. package/package.json +29 -14
  88. package/src/crm-pipeline.feature.ts +86 -86
  89. package/src/deal/deal.enum.ts +8 -8
  90. package/src/deal/deal.operation.ts +255 -255
  91. package/src/deal/deal.schema.ts +92 -92
  92. package/src/deal/deal.test-spec.ts +48 -48
  93. package/src/deal/index.ts +17 -19
  94. package/src/docs/crm-pipeline.docblock.ts +44 -44
  95. package/src/entities/company.entity.ts +52 -52
  96. package/src/entities/contact.entity.ts +67 -67
  97. package/src/entities/deal.entity.ts +134 -134
  98. package/src/entities/index.ts +27 -27
  99. package/src/entities/task.entity.ts +105 -105
  100. package/src/events/contact.event.ts +22 -22
  101. package/src/events/deal.event.ts +77 -77
  102. package/src/events/task.event.ts +19 -19
  103. package/src/example.ts +32 -32
  104. package/src/handlers/crm.handlers.ts +375 -357
  105. package/src/handlers/deal.handlers.ts +179 -179
  106. package/src/handlers/index.ts +18 -19
  107. package/src/handlers/mock-data.ts +167 -167
  108. package/src/index.ts +11 -11
  109. package/src/operations/index.ts +16 -16
  110. package/src/presentations/dashboard.presentation.ts +45 -45
  111. package/src/presentations/pipeline.presentation.ts +90 -90
  112. package/src/seeders/index.ts +26 -26
  113. package/src/shared/overlay-types.ts +23 -23
  114. package/src/ui/CrmDashboard.tsx +210 -279
  115. package/src/ui/CrmDealCard.tsx +64 -64
  116. package/src/ui/CrmPipelineBoard.tsx +105 -105
  117. package/src/ui/hooks/index.ts +3 -3
  118. package/src/ui/hooks/useDealList.ts +113 -85
  119. package/src/ui/hooks/useDealMutations.ts +151 -150
  120. package/src/ui/index.ts +5 -10
  121. package/src/ui/modals/CreateDealModal.tsx +217 -217
  122. package/src/ui/modals/DealActionsModal.tsx +390 -390
  123. package/src/ui/overlays/demo-overlays.ts +43 -43
  124. package/src/ui/renderers/index.ts +4 -3
  125. package/src/ui/renderers/pipeline.markdown.ts +165 -165
  126. package/src/ui/renderers/pipeline.renderer.tsx +17 -16
  127. package/src/ui/tables/DealListTab.smoke.test.tsx +149 -0
  128. package/src/ui/tables/DealListTab.tsx +276 -0
  129. package/tsconfig.json +7 -8
  130. 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
  }