@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
@@ -0,0 +1,336 @@
1
+ /**
2
+ * CRM Theme - Features Configuration
3
+ *
4
+ * Defines all features of the application for this theme.
5
+ * Each feature key becomes a tag: @feat-{key}
6
+ *
7
+ * Features are enriched at build-time with:
8
+ * - Entity metadata (from entity-registry)
9
+ * - Permission details (from permissions-registry)
10
+ * - Documentation links (from docs-registry)
11
+ * - Test coverage (from tags-registry + test files)
12
+ */
13
+
14
+ import { defineFeatures } from '@nextsparkjs/core/lib/config/features-types'
15
+
16
+ export default defineFeatures({
17
+ // ===========================================================================
18
+ // LEAD MANAGEMENT FEATURES
19
+ // Lead capture and qualification
20
+ // ===========================================================================
21
+
22
+ leads: {
23
+ name: 'Leads',
24
+ description: 'Lead capture, qualification, and assignment management',
25
+ category: 'entities',
26
+ icon: 'user-search',
27
+ entities: ['leads'],
28
+ permissions: ['leads.*'],
29
+ docs: [],
30
+ },
31
+
32
+ 'lead-conversion': {
33
+ name: 'Lead Conversion',
34
+ description: 'Convert qualified leads to contacts and companies',
35
+ category: 'leads',
36
+ icon: 'user-check',
37
+ entities: ['leads', 'contacts', 'companies'],
38
+ permissions: ['leads.convert'],
39
+ docs: [],
40
+ },
41
+
42
+ // ===========================================================================
43
+ // CONTACT MANAGEMENT FEATURES
44
+ // Contact and relationship management
45
+ // ===========================================================================
46
+
47
+ contacts: {
48
+ name: 'Contacts',
49
+ description: 'Contact management with company associations and communication history',
50
+ category: 'entities',
51
+ icon: 'users',
52
+ entities: ['contacts'],
53
+ permissions: ['contacts.*'],
54
+ docs: [],
55
+ },
56
+
57
+ companies: {
58
+ name: 'Companies',
59
+ description: 'Company/organization management with contact associations',
60
+ category: 'entities',
61
+ icon: 'building',
62
+ entities: ['companies'],
63
+ permissions: ['companies.*'],
64
+ docs: [],
65
+ },
66
+
67
+ // ===========================================================================
68
+ // SALES PIPELINE FEATURES
69
+ // Opportunity and pipeline management
70
+ // ===========================================================================
71
+
72
+ opportunities: {
73
+ name: 'Opportunities',
74
+ description: 'Sales opportunity tracking with pipeline stages and deal values',
75
+ category: 'entities',
76
+ icon: 'trending-up',
77
+ entities: ['opportunities'],
78
+ permissions: ['opportunities.*'],
79
+ docs: [],
80
+ },
81
+
82
+ pipelines: {
83
+ name: 'Pipelines',
84
+ description: 'Sales pipeline configuration with customizable stages',
85
+ category: 'entities',
86
+ icon: 'git-branch',
87
+ entities: ['pipelines'],
88
+ permissions: ['pipelines.*', 'settings.pipelines'],
89
+ docs: [],
90
+ },
91
+
92
+ 'pipeline-kanban': {
93
+ name: 'Pipeline Kanban',
94
+ description: 'Visual kanban board for managing opportunities across pipeline stages',
95
+ category: 'sales',
96
+ icon: 'layout',
97
+ entities: ['opportunities', 'pipelines'],
98
+ permissions: ['opportunities.*', 'pipelines.read'],
99
+ docs: [],
100
+ },
101
+
102
+ // ===========================================================================
103
+ // ACTIVITY MANAGEMENT FEATURES
104
+ // Tasks, calls, meetings, and notes
105
+ // ===========================================================================
106
+
107
+ activities: {
108
+ name: 'Activities',
109
+ description: 'Schedule and track calls, meetings, emails, and tasks',
110
+ category: 'entities',
111
+ icon: 'calendar',
112
+ entities: ['activities'],
113
+ permissions: ['activities.*'],
114
+ docs: [],
115
+ },
116
+
117
+ notes: {
118
+ name: 'Notes',
119
+ description: 'Add notes and comments to leads, contacts, and opportunities',
120
+ category: 'entities',
121
+ icon: 'file-text',
122
+ entities: ['notes'],
123
+ permissions: ['notes.*'],
124
+ docs: [],
125
+ },
126
+
127
+ // ===========================================================================
128
+ // MARKETING FEATURES
129
+ // Campaign and product management
130
+ // ===========================================================================
131
+
132
+ campaigns: {
133
+ name: 'Campaigns',
134
+ description: 'Marketing campaign management and tracking',
135
+ category: 'entities',
136
+ icon: 'megaphone',
137
+ entities: ['campaigns'],
138
+ permissions: ['campaigns.*'],
139
+ docs: [],
140
+ },
141
+
142
+ products: {
143
+ name: 'Products',
144
+ description: 'Product catalog management for quotes and opportunities',
145
+ category: 'entities',
146
+ icon: 'package',
147
+ entities: ['products'],
148
+ permissions: ['products.*', 'settings.products'],
149
+ docs: [],
150
+ },
151
+
152
+ // ===========================================================================
153
+ // REPORTING FEATURES
154
+ // Analytics and reports
155
+ // ===========================================================================
156
+
157
+ 'sales-reports': {
158
+ name: 'Sales Reports',
159
+ description: 'Sales performance analytics and forecasting',
160
+ category: 'reports',
161
+ icon: 'bar-chart',
162
+ entities: ['opportunities', 'leads'],
163
+ permissions: ['reports.sales', 'reports.export'],
164
+ docs: [],
165
+ },
166
+
167
+ 'marketing-reports': {
168
+ name: 'Marketing Reports',
169
+ description: 'Marketing campaign performance and ROI analysis',
170
+ category: 'reports',
171
+ icon: 'pie-chart',
172
+ entities: ['campaigns', 'leads'],
173
+ permissions: ['reports.marketing', 'reports.export'],
174
+ docs: [],
175
+ },
176
+
177
+ 'pipeline-reports': {
178
+ name: 'Pipeline Reports',
179
+ description: 'Pipeline analysis, conversion rates, and forecasting',
180
+ category: 'reports',
181
+ icon: 'activity',
182
+ entities: ['opportunities', 'pipelines'],
183
+ permissions: ['reports.pipeline', 'reports.export'],
184
+ docs: [],
185
+ },
186
+
187
+ // ===========================================================================
188
+ // DASHBOARD FEATURES
189
+ // Dashboard widgets and metrics
190
+ // ===========================================================================
191
+
192
+ 'sales-forecasting': {
193
+ name: 'Sales Forecasting',
194
+ description: 'Revenue forecasting based on pipeline data',
195
+ category: 'dashboard',
196
+ icon: 'trending-up',
197
+ entities: ['opportunities'],
198
+ permissions: ['dashboard.forecasting'],
199
+ docs: [],
200
+ },
201
+
202
+ 'team-metrics': {
203
+ name: 'Team Metrics',
204
+ description: 'Team performance metrics and KPIs dashboard',
205
+ category: 'dashboard',
206
+ icon: 'users',
207
+ entities: ['leads', 'opportunities', 'activities'],
208
+ permissions: ['dashboard.team_metrics'],
209
+ docs: [],
210
+ },
211
+
212
+ // ===========================================================================
213
+ // BULK OPERATIONS FEATURES
214
+ // Data import/export
215
+ // ===========================================================================
216
+
217
+ 'bulk-import': {
218
+ name: 'Bulk Import',
219
+ description: 'Import data from CSV/Excel files',
220
+ category: 'settings',
221
+ icon: 'upload',
222
+ entities: ['leads', 'contacts', 'companies'],
223
+ permissions: ['bulk.import'],
224
+ docs: [],
225
+ },
226
+
227
+ 'bulk-export': {
228
+ name: 'Bulk Export',
229
+ description: 'Export data to CSV/Excel files',
230
+ category: 'settings',
231
+ icon: 'download',
232
+ entities: ['leads', 'contacts', 'companies', 'opportunities'],
233
+ permissions: ['bulk.export'],
234
+ docs: [],
235
+ },
236
+
237
+ // ===========================================================================
238
+ // CORE FEATURES
239
+ // Platform-level features
240
+ // ===========================================================================
241
+
242
+ auth: {
243
+ name: 'Authentication',
244
+ description: 'User authentication, sessions, and account security',
245
+ category: 'core',
246
+ icon: 'shield',
247
+ entities: [],
248
+ permissions: ['auth.*'],
249
+ docs: [],
250
+ },
251
+
252
+ teams: {
253
+ name: 'Teams',
254
+ description: 'Single-tenant team management with role-based access',
255
+ category: 'core',
256
+ icon: 'users',
257
+ entities: [],
258
+ permissions: ['teams.*', 'members.*', 'invitations.*'],
259
+ docs: [],
260
+ },
261
+
262
+ // ===========================================================================
263
+ // SETTINGS FEATURES
264
+ // User and system settings
265
+ // ===========================================================================
266
+
267
+ users: {
268
+ name: 'User Profile',
269
+ description: 'User profile management and preferences',
270
+ category: 'settings',
271
+ icon: 'user',
272
+ entities: [],
273
+ permissions: ['profile.*'],
274
+ docs: [],
275
+ },
276
+
277
+ 'api-keys': {
278
+ name: 'API Keys',
279
+ description: 'API key generation for integrations',
280
+ category: 'settings',
281
+ icon: 'key',
282
+ entities: [],
283
+ permissions: ['api-keys.*'],
284
+ docs: [],
285
+ },
286
+
287
+ // ===========================================================================
288
+ // BILLING FEATURES
289
+ // Plans, subscriptions, and payments
290
+ // ===========================================================================
291
+
292
+ plans: {
293
+ name: 'Plans',
294
+ description: 'Plan catalog, comparison, and selection',
295
+ category: 'settings',
296
+ icon: 'credit-card',
297
+ entities: [],
298
+ permissions: ['plans.*'],
299
+ docs: [],
300
+ },
301
+
302
+ billing: {
303
+ name: 'Billing',
304
+ description: 'Subscription management, payments, and invoices',
305
+ category: 'settings',
306
+ icon: 'receipt',
307
+ entities: [],
308
+ permissions: ['billing.*', 'subscriptions.*', 'invoices.*'],
309
+ docs: [],
310
+ },
311
+
312
+ // ===========================================================================
313
+ // ADMIN FEATURES
314
+ // Superadmin and developer tools
315
+ // ===========================================================================
316
+
317
+ superadmin: {
318
+ name: 'Superadmin',
319
+ description: 'Superadmin dashboard and system management',
320
+ category: 'admin',
321
+ icon: 'shield-check',
322
+ entities: [],
323
+ permissions: ['superadmin.*'],
324
+ docs: [],
325
+ },
326
+
327
+ devtools: {
328
+ name: 'Developer Tools',
329
+ description: 'Development tools and configuration inspectors',
330
+ category: 'admin',
331
+ icon: 'terminal',
332
+ entities: [],
333
+ permissions: ['developer.*'],
334
+ docs: [],
335
+ },
336
+ })