@nextsparkjs/theme-crm 0.1.0-beta.1

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 (140) hide show
  1. package/CRM_PLAN.md +343 -0
  2. package/about.md +122 -0
  3. package/config/app.config.ts +185 -0
  4. package/config/billing.config.ts +187 -0
  5. package/config/dashboard.config.ts +372 -0
  6. package/config/dev.config.ts +55 -0
  7. package/config/features.config.ts +336 -0
  8. package/config/flows.config.ts +511 -0
  9. package/config/permissions.config.ts +297 -0
  10. package/config/theme.config.ts +111 -0
  11. package/entities/activities/activities.config.ts +61 -0
  12. package/entities/activities/activities.fields.ts +362 -0
  13. package/entities/activities/activities.service.ts +503 -0
  14. package/entities/activities/activities.types.ts +117 -0
  15. package/entities/activities/messages/en.json +123 -0
  16. package/entities/activities/messages/es.json +123 -0
  17. package/entities/activities/migrations/020_activities_table.sql +123 -0
  18. package/entities/activities/migrations/021_activities_metas.sql +114 -0
  19. package/entities/activities/migrations/022_activities_sample_data.sql +420 -0
  20. package/entities/campaigns/campaigns.config.ts +61 -0
  21. package/entities/campaigns/campaigns.fields.ts +413 -0
  22. package/entities/campaigns/campaigns.service.ts +426 -0
  23. package/entities/campaigns/campaigns.types.ts +124 -0
  24. package/entities/campaigns/messages/en.json +145 -0
  25. package/entities/campaigns/messages/es.json +145 -0
  26. package/entities/campaigns/migrations/001_campaigns_table.sql +127 -0
  27. package/entities/campaigns/migrations/002_campaigns_metas.sql +114 -0
  28. package/entities/campaigns/migrations/003_campaigns_sample_data.sql +364 -0
  29. package/entities/companies/companies.config.ts +61 -0
  30. package/entities/companies/companies.fields.ts +429 -0
  31. package/entities/companies/companies.service.ts +566 -0
  32. package/entities/companies/companies.types.ts +125 -0
  33. package/entities/companies/messages/en.json +146 -0
  34. package/entities/companies/messages/es.json +146 -0
  35. package/entities/companies/migrations/001_companies_table.sql +150 -0
  36. package/entities/companies/migrations/002_companies_metas.sql +114 -0
  37. package/entities/companies/migrations/003_companies_sample_data.sql +246 -0
  38. package/entities/contacts/contacts.config.ts +61 -0
  39. package/entities/contacts/contacts.fields.ts +359 -0
  40. package/entities/contacts/contacts.service.ts +509 -0
  41. package/entities/contacts/contacts.types.ts +108 -0
  42. package/entities/contacts/messages/en.json +117 -0
  43. package/entities/contacts/messages/es.json +117 -0
  44. package/entities/contacts/migrations/001_contacts_table.sql +134 -0
  45. package/entities/contacts/migrations/002_contacts_metas.sql +114 -0
  46. package/entities/contacts/migrations/003_contacts_sample_data.sql +421 -0
  47. package/entities/leads/leads.config.ts +61 -0
  48. package/entities/leads/leads.fields.ts +336 -0
  49. package/entities/leads/leads.service.ts +496 -0
  50. package/entities/leads/leads.types.ts +114 -0
  51. package/entities/leads/messages/en.json +132 -0
  52. package/entities/leads/messages/es.json +132 -0
  53. package/entities/leads/migrations/001_leads_table.sql +150 -0
  54. package/entities/leads/migrations/002_leads_metas.sql +120 -0
  55. package/entities/leads/migrations/003_leads_sample_data.sql +242 -0
  56. package/entities/notes/messages/en.json +114 -0
  57. package/entities/notes/messages/es.json +114 -0
  58. package/entities/notes/migrations/020_notes_table.sql +118 -0
  59. package/entities/notes/migrations/021_notes_metas.sql +114 -0
  60. package/entities/notes/migrations/022_notes_sample_data.sql +275 -0
  61. package/entities/notes/notes.config.ts +61 -0
  62. package/entities/notes/notes.fields.ts +283 -0
  63. package/entities/notes/notes.service.ts +320 -0
  64. package/entities/notes/notes.types.ts +102 -0
  65. package/entities/opportunities/messages/en.json +107 -0
  66. package/entities/opportunities/messages/es.json +107 -0
  67. package/entities/opportunities/migrations/010_opportunities_table.sql +145 -0
  68. package/entities/opportunities/migrations/011_opportunities_metas.sql +114 -0
  69. package/entities/opportunities/migrations/012_opportunities_sample_data.sql +438 -0
  70. package/entities/opportunities/opportunities.config.ts +61 -0
  71. package/entities/opportunities/opportunities.fields.ts +416 -0
  72. package/entities/opportunities/opportunities.service.ts +525 -0
  73. package/entities/opportunities/opportunities.types.ts +135 -0
  74. package/entities/pipelines/messages/en.json +115 -0
  75. package/entities/pipelines/messages/es.json +115 -0
  76. package/entities/pipelines/migrations/001_pipelines_table.sql +106 -0
  77. package/entities/pipelines/migrations/002_pipelines_metas.sql +114 -0
  78. package/entities/pipelines/migrations/003_pipelines_sample_data.sql +91 -0
  79. package/entities/pipelines/pipelines.config.ts +62 -0
  80. package/entities/pipelines/pipelines.fields.ts +193 -0
  81. package/entities/pipelines/pipelines.service.ts +383 -0
  82. package/entities/pipelines/pipelines.types.ts +78 -0
  83. package/entities/products/messages/en.json +135 -0
  84. package/entities/products/messages/es.json +135 -0
  85. package/entities/products/migrations/001_products_table.sql +117 -0
  86. package/entities/products/migrations/002_products_metas.sql +114 -0
  87. package/entities/products/migrations/003_products_sample_data.sql +247 -0
  88. package/entities/products/products.config.ts +62 -0
  89. package/entities/products/products.fields.ts +361 -0
  90. package/entities/products/products.service.ts +437 -0
  91. package/entities/products/products.types.ts +125 -0
  92. package/lib/crm-constants.ts +77 -0
  93. package/lib/crm-utils.ts +185 -0
  94. package/lib/selectors.ts +333 -0
  95. package/messages/en.json +131 -0
  96. package/messages/es.json +131 -0
  97. package/migrations/999_theme_sample_data.sql +473 -0
  98. package/package.json +18 -0
  99. package/pendings.md +205 -0
  100. package/permissions-matrix.md +216 -0
  101. package/styles/components.css +414 -0
  102. package/styles/crm-theme.css +358 -0
  103. package/styles/globals.css +576 -0
  104. package/styles/variables.css +111 -0
  105. package/templates/dashboard/(main)/activities/components/ActivityCard.tsx +169 -0
  106. package/templates/dashboard/(main)/activities/components/ActivityTimeline.tsx +165 -0
  107. package/templates/dashboard/(main)/activities/page.tsx +297 -0
  108. package/templates/dashboard/(main)/campaigns/page.tsx +373 -0
  109. package/templates/dashboard/(main)/companies/page.tsx +296 -0
  110. package/templates/dashboard/(main)/contacts/page.tsx +347 -0
  111. package/templates/dashboard/(main)/layout.tsx +98 -0
  112. package/templates/dashboard/(main)/leads/page.tsx +335 -0
  113. package/templates/dashboard/(main)/opportunities/[id]/edit/page.tsx +95 -0
  114. package/templates/dashboard/(main)/opportunities/create/page.tsx +94 -0
  115. package/templates/dashboard/(main)/opportunities/page.tsx +350 -0
  116. package/templates/dashboard/(main)/pipelines/[id]/edit/page.tsx +95 -0
  117. package/templates/dashboard/(main)/pipelines/[id]/page.tsx +143 -0
  118. package/templates/dashboard/(main)/pipelines/create/page.tsx +94 -0
  119. package/templates/dashboard/(main)/pipelines/page.tsx +234 -0
  120. package/templates/dashboard/(main)/products/[id]/edit/page.tsx +97 -0
  121. package/templates/dashboard/(main)/products/[id]/page.tsx +509 -0
  122. package/templates/dashboard/(main)/products/create/page.tsx +96 -0
  123. package/templates/dashboard/(main)/products/page.tsx +308 -0
  124. package/templates/shared/ActionButtons.tsx +41 -0
  125. package/templates/shared/CRMDashboard.tsx +519 -0
  126. package/templates/shared/CRMDataTable.tsx +441 -0
  127. package/templates/shared/CRMMetricCard.tsx +76 -0
  128. package/templates/shared/CRMMobileNav.tsx +172 -0
  129. package/templates/shared/CRMSidebar.tsx +346 -0
  130. package/templates/shared/CRMTopBar.tsx +265 -0
  131. package/templates/shared/DealCard.tsx +123 -0
  132. package/templates/shared/EntityCard.tsx +58 -0
  133. package/templates/shared/OpportunityForm.tsx +649 -0
  134. package/templates/shared/PipelineForm.tsx +367 -0
  135. package/templates/shared/PipelineKanban.tsx +194 -0
  136. package/templates/shared/QuickFilters.tsx +47 -0
  137. package/templates/shared/StageColumn.tsx +175 -0
  138. package/templates/shared/StageSelect.tsx +177 -0
  139. package/templates/shared/StagesRepeater.tsx +317 -0
  140. package/templates/shared/index.ts +9 -0
package/pendings.md ADDED
@@ -0,0 +1,205 @@
1
+ # CRM Theme - Phase 3 Pending Items
2
+
3
+ > **Status**: Deferred - Not working on this phase yet
4
+ > **Last Updated**: 2024-11-28
5
+
6
+ ## Overview
7
+
8
+ This document tracks pending UI/UX components and customizations needed for the CRM theme to be production-ready. These items are deferred after completing:
9
+ - Phase 1: SQL migrations corrections
10
+ - Phase 2: Permission validation with generic UI
11
+
12
+ ---
13
+
14
+ ## 1. Custom Components (Priority: High)
15
+
16
+ ### 1.1 Pipeline Kanban Board
17
+ - [ ] Create `components/PipelineBoard.tsx` - Drag & drop board for opportunities
18
+ - [ ] Show opportunities grouped by pipeline stages
19
+ - [ ] Display deal value, probability, and close date on cards
20
+ - [ ] Support drag between stages with `opportunities.move_stage` permission
21
+ - [ ] Show pipeline value totals per stage
22
+ - [ ] Add quick actions: edit, view activities, mark as won/lost
23
+
24
+ ### 1.2 Lead Conversion Flow
25
+ - [ ] Create `components/LeadConversionModal.tsx`
26
+ - [ ] Wizard-style flow: Lead → Contact + Company + Opportunity
27
+ - [ ] Pre-fill data from lead
28
+ - [ ] Require `leads.convert` permission
29
+ - [ ] Track conversion in lead record
30
+
31
+ ### 1.3 Activity Timeline
32
+ - [ ] Create `components/ActivityTimeline.tsx`
33
+ - [ ] Polymorphic timeline for any entity (lead, contact, company, opportunity)
34
+ - [ ] Show activities, notes, and system events
35
+ - [ ] Support quick activity creation
36
+ - [ ] Filter by activity type
37
+
38
+ ### 1.4 Contact/Company 360 View
39
+ - [ ] Create `components/EntityDetailView.tsx`
40
+ - [ ] Show related entities (contacts for company, opportunities, activities)
41
+ - [ ] Quick access to communication history
42
+ - [ ] Display key metrics and scores
43
+
44
+ ---
45
+
46
+ ## 2. Dashboard Widgets (Priority: High)
47
+
48
+ ### 2.1 Sales Dashboard
49
+ - [ ] Pipeline funnel visualization
50
+ - [ ] Revenue forecast chart
51
+ - [ ] Won/Lost ratio
52
+ - [ ] Top opportunities list
53
+ - [ ] Activities due today
54
+
55
+ ### 2.2 Marketing Dashboard
56
+ - [ ] Campaign performance metrics
57
+ - [ ] Lead source breakdown
58
+ - [ ] Conversion rates by source
59
+ - [ ] ROI calculations
60
+
61
+ ### 2.3 Team Performance (owner/admin only)
62
+ - [ ] Sales rep leaderboard
63
+ - [ ] Activity completion rates
64
+ - [ ] Opportunity by rep
65
+ - [ ] Pipeline coverage
66
+
67
+ ---
68
+
69
+ ## 3. Template Overrides (Priority: Medium)
70
+
71
+ ### 3.1 Entity List Views
72
+ - [ ] `templates/app/dashboard/(main)/leads/page.tsx`
73
+ - Custom columns: score badge, source icon, status chip
74
+ - Quick convert action
75
+
76
+ - [ ] `templates/app/dashboard/(main)/opportunities/page.tsx`
77
+ - Toggle between list and Kanban view
78
+ - Quick stage change
79
+
80
+ - [ ] `templates/app/dashboard/(main)/activities/page.tsx`
81
+ - Calendar view option
82
+ - Due date highlighting
83
+
84
+ ### 3.2 Entity Detail Views
85
+ - [ ] `templates/app/dashboard/(main)/[entity]/[id]/page.tsx`
86
+ - Related entities sidebar
87
+ - Activity timeline
88
+ - Quick actions based on entity type
89
+
90
+ ### 3.3 Entity Create/Edit Forms
91
+ - [ ] Lead form with score calculator
92
+ - [ ] Opportunity form with pipeline/stage selector
93
+ - [ ] Activity form with entity picker
94
+
95
+ ---
96
+
97
+ ## 4. Settings Pages (Priority: Medium)
98
+
99
+ ### 4.1 Pipeline Configuration
100
+ - [ ] `templates/app/dashboard/settings/pipelines/page.tsx`
101
+ - [ ] CRUD for pipelines (owner only)
102
+ - [ ] Stage editor with drag reorder
103
+ - [ ] Probability per stage configuration
104
+ - [ ] Default pipeline selection
105
+
106
+ ### 4.2 Product Catalog
107
+ - [ ] `templates/app/dashboard/settings/products/page.tsx`
108
+ - [ ] Product CRUD (owner only)
109
+ - [ ] Categories and pricing tiers
110
+ - [ ] Product-opportunity association
111
+
112
+ ### 4.3 Import/Export
113
+ - [ ] Bulk import wizard for leads, contacts, companies
114
+ - [ ] CSV/Excel template downloads
115
+ - [ ] Field mapping UI
116
+ - [ ] Requires `bulk.import` permission
117
+
118
+ ---
119
+
120
+ ## 5. Reports (Priority: Low)
121
+
122
+ ### 5.1 Sales Reports
123
+ - [ ] Pipeline analysis report
124
+ - [ ] Win/loss analysis
125
+ - [ ] Sales cycle duration
126
+ - [ ] Requires `reports.sales` permission
127
+
128
+ ### 5.2 Marketing Reports
129
+ - [ ] Campaign ROI
130
+ - [ ] Lead source analysis
131
+ - [ ] Conversion funnel
132
+ - [ ] Requires `reports.marketing` permission
133
+
134
+ ### 5.3 Export Functionality
135
+ - [ ] PDF export for reports
136
+ - [ ] Excel export for data
137
+ - [ ] Requires `reports.export` permission
138
+
139
+ ---
140
+
141
+ ## 6. Mobile Optimizations (Priority: Low)
142
+
143
+ - [ ] Mobile-friendly pipeline view
144
+ - [ ] Swipe actions for activities
145
+ - [ ] Quick call/email actions
146
+ - [ ] Offline activity logging
147
+
148
+ ---
149
+
150
+ ## 7. Integrations (Priority: Future)
151
+
152
+ - [ ] Email integration (Gmail, Outlook)
153
+ - [ ] Calendar sync
154
+ - [ ] Phone/VoIP integration
155
+ - [ ] Social media enrichment
156
+
157
+ ---
158
+
159
+ ## Technical Notes
160
+
161
+ ### Component Structure
162
+ ```
163
+ contents/themes/crm/
164
+ ├── components/
165
+ │ ├── PipelineBoard.tsx
166
+ │ ├── LeadConversionModal.tsx
167
+ │ ├── ActivityTimeline.tsx
168
+ │ ├── EntityDetailView.tsx
169
+ │ └── widgets/
170
+ │ ├── SalesDashboard.tsx
171
+ │ ├── MarketingDashboard.tsx
172
+ │ └── TeamPerformance.tsx
173
+ ├── templates/
174
+ │ └── app/
175
+ │ └── dashboard/
176
+ │ ├── (main)/
177
+ │ │ ├── leads/
178
+ │ │ ├── opportunities/
179
+ │ │ └── activities/
180
+ │ └── settings/
181
+ │ ├── pipelines/
182
+ │ └── products/
183
+ └── styles/
184
+ ├── globals.css
185
+ └── components.css
186
+ ```
187
+
188
+ ### Permission Gates Required
189
+ All custom components must use `PermissionGate` for:
190
+ - `leads.convert`
191
+ - `opportunities.move_stage`
192
+ - `opportunities.close`
193
+ - `activities.complete`
194
+ - `campaigns.launch`
195
+ - `campaigns.pause`
196
+ - `reports.*`
197
+ - `bulk.*`
198
+ - `settings.pipelines`
199
+ - `settings.products`
200
+
201
+ ### Design Guidelines
202
+ - Use CRM theme colors (teal/cyan primary)
203
+ - Professional, data-centric aesthetic
204
+ - Consistent with existing dashboard patterns
205
+ - Follow shadcn/ui component patterns
@@ -0,0 +1,216 @@
1
+ # CRM Theme - Permissions Matrix
2
+
3
+ ## Teams Mode: `single-tenant`
4
+
5
+ One work team created at signup. Owner can invite multiple members.
6
+
7
+ ## Roles
8
+
9
+ | Role | Description |
10
+ |------|-------------|
11
+ | owner | CRM Administrator - full control |
12
+ | admin | Sales/Marketing Manager - team management + reports |
13
+ | member | Sales/Marketing Rep - daily operations |
14
+ | viewer | Read-only access to CRM data |
15
+
16
+ ---
17
+
18
+ ## Entity Permissions
19
+
20
+ ### Leads
21
+
22
+ | Action | owner | admin | member | viewer |
23
+ |--------|-------|-------|--------|--------|
24
+ | create | ✅ | ✅ | ✅ | ❌ |
25
+ | read | ✅ | ✅ | ✅ | ✅ |
26
+ | list | ✅ | ✅ | ✅ | ✅ |
27
+ | update | ✅ | ✅ | ✅ | ❌ |
28
+ | delete | ✅ | ✅ | ❌ | ❌ |
29
+ | assign | ✅ | ✅ | ❌ | ❌ |
30
+ | import | ✅ | ✅ | ❌ | ❌ |
31
+ | export | ✅ | ✅ | ❌ | ❌ |
32
+ | convert | ✅ | ✅ | ✅ | ❌ |
33
+
34
+ ### Contacts
35
+
36
+ | Action | owner | admin | member | viewer |
37
+ |--------|-------|-------|--------|--------|
38
+ | create | ✅ | ✅ | ✅ | ❌ |
39
+ | read | ✅ | ✅ | ✅ | ✅ |
40
+ | list | ✅ | ✅ | ✅ | ✅ |
41
+ | update | ✅ | ✅ | ✅ | ❌ |
42
+ | delete | ✅ | ✅ | ❌ | ❌ |
43
+ | import | ✅ | ✅ | ❌ | ❌ |
44
+ | export | ✅ | ✅ | ❌ | ❌ |
45
+
46
+ ### Companies
47
+
48
+ | Action | owner | admin | member | viewer |
49
+ |--------|-------|-------|--------|--------|
50
+ | create | ✅ | ✅ | ✅ | ❌ |
51
+ | read | ✅ | ✅ | ✅ | ✅ |
52
+ | list | ✅ | ✅ | ✅ | ✅ |
53
+ | update | ✅ | ✅ | ✅ | ❌ |
54
+ | delete | ✅ | ✅ | ❌ | ❌ |
55
+ | import | ✅ | ✅ | ❌ | ❌ |
56
+ | export | ✅ | ✅ | ❌ | ❌ |
57
+
58
+ ### Opportunities
59
+
60
+ | Action | owner | admin | member | viewer |
61
+ |--------|-------|-------|--------|--------|
62
+ | create | ✅ | ✅ | ✅ | ❌ |
63
+ | read | ✅ | ✅ | ✅ | ✅ |
64
+ | list | ✅ | ✅ | ✅ | ✅ |
65
+ | update | ✅ | ✅ | ✅ | ❌ |
66
+ | delete | ✅ | ✅ | ❌ | ❌ |
67
+ | assign | ✅ | ✅ | ❌ | ❌ |
68
+ | import | ✅ | ✅ | ❌ | ❌ |
69
+ | export | ✅ | ✅ | ❌ | ❌ |
70
+ | move_stage | ✅ | ✅ | ✅ | ❌ |
71
+ | close | ✅ | ✅ | ✅ | ❌ |
72
+
73
+ ### Activities
74
+
75
+ | Action | owner | admin | member | viewer |
76
+ |--------|-------|-------|--------|--------|
77
+ | create | ✅ | ✅ | ✅ | ❌ |
78
+ | read | ✅ | ✅ | ✅ | ✅ |
79
+ | list | ✅ | ✅ | ✅ | ✅ |
80
+ | update | ✅ | ✅ | ✅ | ❌ |
81
+ | delete | ✅ | ✅ | ✅ | ❌ |
82
+ | assign | ✅ | ✅ | ❌ | ❌ |
83
+ | complete | ✅ | ✅ | ✅ | ❌ |
84
+
85
+ ### Notes
86
+
87
+ | Action | owner | admin | member | viewer |
88
+ |--------|-------|-------|--------|--------|
89
+ | create | ✅ | ✅ | ✅ | ❌ |
90
+ | read | ✅ | ✅ | ✅ | ✅ |
91
+ | list | ✅ | ✅ | ✅ | ✅ |
92
+ | update | ✅ | ✅ | ✅ | ❌ |
93
+ | delete | ✅ | ✅ | ✅ | ❌ |
94
+
95
+ > Note: Private notes (`isPrivate: true`) are only visible to their creator.
96
+
97
+ ### Campaigns
98
+
99
+ | Action | owner | admin | member | viewer |
100
+ |--------|-------|-------|--------|--------|
101
+ | create | ✅ | ✅ | ✅ | ❌ |
102
+ | read | ✅ | ✅ | ✅ | ✅ |
103
+ | list | ✅ | ✅ | ✅ | ✅ |
104
+ | update | ✅ | ✅ | ✅ | ❌ |
105
+ | delete | ✅ | ✅ | ✅ | ❌ |
106
+ | launch | ✅ | ✅ | ❌ | ❌ |
107
+ | pause | ✅ | ✅ | ❌ | ❌ |
108
+
109
+ ### Pipelines (Configuration)
110
+
111
+ | Action | owner | admin | member | viewer |
112
+ |--------|-------|-------|--------|--------|
113
+ | create | ✅ | ❌ | ❌ | ❌ |
114
+ | read | ✅ | ✅ | ✅ | ✅ |
115
+ | list | ✅ | ✅ | ✅ | ✅ |
116
+ | update | ✅ | ❌ | ❌ | ❌ |
117
+ | delete | ✅ | ❌ | ❌ | ❌ |
118
+
119
+ ### Products (Configuration)
120
+
121
+ | Action | owner | admin | member | viewer |
122
+ |--------|-------|-------|--------|--------|
123
+ | create | ✅ | ❌ | ❌ | ❌ |
124
+ | read | ✅ | ✅ | ✅ | ✅ |
125
+ | list | ✅ | ✅ | ✅ | ✅ |
126
+ | update | ✅ | ❌ | ❌ | ❌ |
127
+ | delete | ✅ | ❌ | ❌ | ❌ |
128
+
129
+ ---
130
+
131
+ ## Theme Features
132
+
133
+ | Feature | owner | admin | member | viewer | Description |
134
+ |---------|-------|-------|--------|--------|-------------|
135
+ | `reports.sales` | ✅ | ✅ | ❌ | ❌ | Sales performance reports |
136
+ | `reports.marketing` | ✅ | ✅ | ❌ | ❌ | Marketing campaign reports |
137
+ | `reports.pipeline` | ✅ | ✅ | ❌ | ❌ | Pipeline analysis |
138
+ | `reports.export` | ✅ | ✅ | ❌ | ❌ | Export reports |
139
+ | `dashboard.forecasting` | ✅ | ✅ | ❌ | ❌ | Sales forecasting |
140
+ | `dashboard.team_metrics` | ✅ | ✅ | ❌ | ❌ | Team performance KPIs |
141
+ | `bulk.import` | ✅ | ✅ | ❌ | ❌ | Bulk data import |
142
+ | `bulk.export` | ✅ | ✅ | ❌ | ❌ | Bulk data export |
143
+ | `leads.convert` | ✅ | ✅ | ✅ | ❌ | Convert leads to contacts |
144
+ | `settings.pipelines` | ✅ | ❌ | ❌ | ❌ | Pipeline configuration |
145
+ | `settings.products` | ✅ | ❌ | ❌ | ❌ | Product catalog management |
146
+
147
+ ---
148
+
149
+ ## Team Permissions
150
+
151
+ | Permission | owner | admin | member | viewer |
152
+ |------------|-------|-------|--------|--------|
153
+ | `teams.invite` | ✅ | ✅ | ❌ | ❌ |
154
+ | `teams.remove_member` | ✅ | ✅ | ❌ | ❌ |
155
+ | `teams.change_roles` | ✅ | ❌ | ❌ | ❌ |
156
+ | `teams.settings` | ✅ | ❌ | ❌ | ❌ |
157
+
158
+ ---
159
+
160
+ ## Disabled Core Permissions
161
+
162
+ - `teams.delete` - Cannot delete organization in single-tenant mode
163
+
164
+ ---
165
+
166
+ ## Test Scenarios
167
+
168
+ ### Owner (CRM Administrator)
169
+
170
+ 1. ✅ Full CRUD on all entities
171
+ 2. ✅ Can assign leads/opportunities
172
+ 3. ✅ Can convert leads
173
+ 4. ✅ Can access all reports
174
+ 5. ✅ Can see forecasting and team metrics
175
+ 6. ✅ Can bulk import/export
176
+ 7. ✅ Can manage pipelines and products
177
+ 8. ✅ Can invite all roles (admin, member, viewer)
178
+ 9. ✅ Can remove any member
179
+ 10. ✅ Can change member roles
180
+
181
+ ### Admin (Manager)
182
+
183
+ 1. ✅ Full CRUD on operational entities (leads, contacts, companies, opportunities)
184
+ 2. ✅ Can assign leads/opportunities
185
+ 3. ✅ Can convert leads
186
+ 4. ✅ Can access all reports
187
+ 5. ✅ Can see forecasting and team metrics
188
+ 6. ✅ Can bulk import/export
189
+ 7. ❌ Cannot manage pipelines
190
+ 8. ❌ Cannot manage products
191
+ 9. ✅ Can invite members and viewers
192
+ 10. ✅ Can remove members and viewers
193
+ 11. ❌ Cannot change roles
194
+
195
+ ### Member (Representative)
196
+
197
+ 1. ✅ Can create/update on operational entities
198
+ 2. ❌ Cannot delete leads, contacts, companies, opportunities
199
+ 3. ✅ Can delete own activities, notes, campaigns
200
+ 4. ✅ Can convert leads
201
+ 5. ❌ Cannot assign leads/opportunities
202
+ 6. ❌ Cannot access reports
203
+ 7. ❌ Cannot see forecasting
204
+ 8. ❌ Cannot bulk import/export
205
+ 9. ❌ Cannot manage pipelines/products
206
+ 10. ❌ Cannot invite members
207
+
208
+ ### Viewer
209
+
210
+ 1. ❌ Cannot create anything
211
+ 2. ✅ Can view all entities
212
+ 3. ❌ Cannot update anything
213
+ 4. ❌ Cannot delete anything
214
+ 5. ❌ Cannot access reports
215
+ 6. ❌ Cannot see forecasting
216
+