@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,364 @@
1
+ -- ============================================================================
2
+ -- Sample data for campaigns table - CRM Theme
3
+ -- Aligned with schema in 001_campaigns_table.sql
4
+ -- Uses users from 999_theme_sample_data.sql
5
+ -- ============================================================================
6
+
7
+ -- Clean existing campaigns data
8
+ DELETE FROM "campaigns" WHERE "teamId" = 'team-crm-company';
9
+
10
+ INSERT INTO "campaigns" (
11
+ id,
12
+ name,
13
+ type,
14
+ status,
15
+ objective,
16
+ description,
17
+ "startDate",
18
+ "endDate",
19
+ budget,
20
+ "actualCost",
21
+ "targetAudience",
22
+ "targetLeads",
23
+ "actualLeads",
24
+ "targetRevenue",
25
+ "actualRevenue",
26
+ roi,
27
+ channel,
28
+ "assignedTo",
29
+ "userId",
30
+ "teamId",
31
+ "createdAt",
32
+ "updatedAt"
33
+ ) VALUES
34
+ -- Active Email Campaigns
35
+ (
36
+ 'camp-crm-001',
37
+ 'Q4 CRM Enterprise Outreach',
38
+ 'email',
39
+ 'active',
40
+ 'Generate enterprise leads through targeted email campaign',
41
+ 'Primary sales pipeline for all standard opportunities',
42
+ DATE(NOW() - INTERVAL '30 days'),
43
+ DATE(NOW() + INTERVAL '30 days'),
44
+ 15000.00,
45
+ 8500.00,
46
+ 'Enterprise CTOs and IT Directors in Technology and Healthcare sectors',
47
+ 100,
48
+ 45,
49
+ 250000.00,
50
+ 125000.00,
51
+ 15.5,
52
+ 'email',
53
+ 'usr-crm-marketing',
54
+ 'usr-crm-ceo',
55
+ 'team-crm-company',
56
+ NOW() - INTERVAL '35 days',
57
+ NOW() - INTERVAL '2 days'
58
+ ),
59
+ (
60
+ 'camp-crm-002',
61
+ 'Healthcare Digital Transformation Series',
62
+ 'email',
63
+ 'active',
64
+ 'Engage healthcare leaders with digital transformation content',
65
+ 'Email series targeting healthcare C-suite with digital transformation insights',
66
+ DATE(NOW() - INTERVAL '20 days'),
67
+ DATE(NOW() + INTERVAL '40 days'),
68
+ 12000.00,
69
+ 7200.00,
70
+ 'Healthcare C-Suite and IT Leaders looking for digital solutions',
71
+ 80,
72
+ 32,
73
+ 200000.00,
74
+ 85000.00,
75
+ 22.3,
76
+ 'email',
77
+ 'usr-crm-marketing',
78
+ 'usr-crm-ceo',
79
+ 'team-crm-company',
80
+ NOW() - INTERVAL '25 days',
81
+ NOW() - INTERVAL '1 day'
82
+ ),
83
+
84
+ -- Social Media Campaigns
85
+ (
86
+ 'camp-crm-003',
87
+ 'LinkedIn Manufacturing Leaders Campaign',
88
+ 'social',
89
+ 'active',
90
+ 'Build brand awareness among manufacturing decision makers',
91
+ 'LinkedIn sponsored content targeting manufacturing executives',
92
+ DATE(NOW() - INTERVAL '15 days'),
93
+ DATE(NOW() + INTERVAL '45 days'),
94
+ 8000.00,
95
+ 5200.00,
96
+ 'Manufacturing executives and operations managers',
97
+ 60,
98
+ 28,
99
+ 150000.00,
100
+ 75000.00,
101
+ 18.7,
102
+ 'social_media',
103
+ 'usr-crm-marketing',
104
+ 'usr-crm-sales-mgr',
105
+ 'team-crm-company',
106
+ NOW() - INTERVAL '20 days',
107
+ NOW() - INTERVAL '3 days'
108
+ ),
109
+ (
110
+ 'camp-crm-004',
111
+ 'Startup Growth Solutions Campaign',
112
+ 'social',
113
+ 'active',
114
+ 'Engage startup founders with growth-focused messaging',
115
+ 'Social media campaign targeting startup founders and growth teams',
116
+ DATE(NOW() - INTERVAL '10 days'),
117
+ DATE(NOW() + INTERVAL '20 days'),
118
+ 5000.00,
119
+ 3800.00,
120
+ 'Startup founders and growth teams in technology sector',
121
+ 40,
122
+ 18,
123
+ 80000.00,
124
+ 35000.00,
125
+ 12.8,
126
+ 'social_media',
127
+ 'usr-crm-marketing',
128
+ 'usr-crm-sales-rep',
129
+ 'team-crm-company',
130
+ NOW() - INTERVAL '15 days',
131
+ NOW() - INTERVAL '1 day'
132
+ ),
133
+
134
+ -- Advertising Campaigns
135
+ (
136
+ 'camp-crm-005',
137
+ 'Google Ads CRM Software Campaign',
138
+ 'advertising',
139
+ 'active',
140
+ 'Capture high-intent CRM software searchers',
141
+ 'PPC campaign on Google targeting CRM-related search terms',
142
+ DATE(NOW() - INTERVAL '25 days'),
143
+ DATE(NOW() + INTERVAL '35 days'),
144
+ 20000.00,
145
+ 12500.00,
146
+ 'Business owners and managers searching for CRM solutions',
147
+ 150,
148
+ 85,
149
+ 350000.00,
150
+ 180000.00,
151
+ 28.5,
152
+ 'web',
153
+ 'usr-crm-marketing',
154
+ 'usr-crm-ceo',
155
+ 'team-crm-company',
156
+ NOW() - INTERVAL '30 days',
157
+ NOW() - INTERVAL '2 days'
158
+ ),
159
+
160
+ -- Webinar Campaigns
161
+ (
162
+ 'camp-crm-006',
163
+ 'CRM Best Practices Webinar Series',
164
+ 'webinar',
165
+ 'planned',
166
+ 'Educate prospects on CRM best practices',
167
+ 'Webinar series covering CRM implementation and optimization best practices',
168
+ DATE(NOW() + INTERVAL '5 days'),
169
+ DATE(NOW() + INTERVAL '65 days'),
170
+ 8500.00,
171
+ 2100.00,
172
+ 'Sales and marketing professionals interested in CRM optimization',
173
+ 75,
174
+ 0,
175
+ 150000.00,
176
+ 0.00,
177
+ NULL,
178
+ 'web',
179
+ 'usr-crm-sales-mgr',
180
+ 'usr-crm-sales-mgr',
181
+ 'team-crm-company',
182
+ NOW() - INTERVAL '10 days',
183
+ NOW() - INTERVAL '1 day'
184
+ ),
185
+
186
+ -- Content Marketing Campaigns
187
+ (
188
+ 'camp-crm-007',
189
+ 'Industry Insights Blog Series',
190
+ 'content',
191
+ 'active',
192
+ 'Establish thought leadership through valuable content',
193
+ 'Blog series with industry insights and best practices for CRM users',
194
+ DATE(NOW() - INTERVAL '45 days'),
195
+ DATE(NOW() + INTERVAL '15 days'),
196
+ 6000.00,
197
+ 3200.00,
198
+ 'Industry professionals seeking insights and best practices',
199
+ 50,
200
+ 55,
201
+ 100000.00,
202
+ 65000.00,
203
+ 35.2,
204
+ 'web',
205
+ 'usr-crm-marketing',
206
+ 'usr-crm-sales-rep',
207
+ 'team-crm-company',
208
+ NOW() - INTERVAL '50 days',
209
+ NOW() - INTERVAL '3 days'
210
+ ),
211
+
212
+ -- Event Campaigns
213
+ (
214
+ 'camp-crm-008',
215
+ 'TechCon 2024 Trade Show',
216
+ 'event',
217
+ 'completed',
218
+ 'Generate qualified leads at major industry event',
219
+ 'Booth presence and demos at TechCon 2024 trade show',
220
+ DATE(NOW() - INTERVAL '90 days'),
221
+ DATE(NOW() - INTERVAL '85 days'),
222
+ 25000.00,
223
+ 24800.00,
224
+ 'Technology executives and decision makers attending TechCon',
225
+ 50,
226
+ 45,
227
+ 500000.00,
228
+ 425000.00,
229
+ 42.5,
230
+ 'other',
231
+ 'usr-crm-sales-mgr',
232
+ 'usr-crm-ceo',
233
+ 'team-crm-company',
234
+ NOW() - INTERVAL '95 days',
235
+ NOW() - INTERVAL '85 days'
236
+ ),
237
+ (
238
+ 'camp-crm-009',
239
+ 'Healthcare Innovation Summit',
240
+ 'event',
241
+ 'completed',
242
+ 'Connect with healthcare innovation leaders',
243
+ 'Participation in Healthcare Innovation Summit with speaking session',
244
+ DATE(NOW() - INTERVAL '60 days'),
245
+ DATE(NOW() - INTERVAL '57 days'),
246
+ 18000.00,
247
+ 17200.00,
248
+ 'Healthcare innovation leaders and technology adopters',
249
+ 35,
250
+ 28,
251
+ 300000.00,
252
+ 215000.00,
253
+ 38.8,
254
+ 'other',
255
+ 'usr-crm-sales-mgr',
256
+ 'usr-crm-ceo',
257
+ 'team-crm-company',
258
+ NOW() - INTERVAL '65 days',
259
+ NOW() - INTERVAL '55 days'
260
+ ),
261
+
262
+ -- Retargeting Campaign (using 'other' type)
263
+ (
264
+ 'camp-crm-010',
265
+ 'Website Visitors Retargeting',
266
+ 'other',
267
+ 'active',
268
+ 'Re-engage website visitors who showed interest',
269
+ 'Retargeting campaign for website visitors who viewed pricing or demo pages',
270
+ DATE(NOW() - INTERVAL '20 days'),
271
+ DATE(NOW() + INTERVAL '25 days'),
272
+ 4500.00,
273
+ 2800.00,
274
+ 'Website visitors who viewed pricing or demo pages',
275
+ 30,
276
+ 22,
277
+ 75000.00,
278
+ 45000.00,
279
+ 25.4,
280
+ 'web',
281
+ 'usr-crm-marketing',
282
+ 'usr-crm-sales-mgr',
283
+ 'team-crm-company',
284
+ NOW() - INTERVAL '25 days',
285
+ NOW() - INTERVAL '2 days'
286
+ ),
287
+
288
+ -- Referral Campaign
289
+ (
290
+ 'camp-crm-011',
291
+ 'Customer Referral Program Q4',
292
+ 'email',
293
+ 'active',
294
+ 'Drive referrals from existing customers',
295
+ 'Customer referral program with incentives for successful referrals',
296
+ DATE(NOW() - INTERVAL '35 days'),
297
+ DATE(NOW() + INTERVAL '25 days'),
298
+ 10000.00,
299
+ 3500.00,
300
+ 'Existing customers with successful CRM implementations',
301
+ 20,
302
+ 12,
303
+ 200000.00,
304
+ 125000.00,
305
+ 45.8,
306
+ 'email',
307
+ 'usr-crm-sales-rep',
308
+ 'usr-crm-sales-rep',
309
+ 'team-crm-company',
310
+ NOW() - INTERVAL '40 days',
311
+ NOW() - INTERVAL '5 days'
312
+ ),
313
+
314
+ -- Completed Campaign (Historical)
315
+ (
316
+ 'camp-crm-012',
317
+ 'Q3 Small Business Email Campaign',
318
+ 'email',
319
+ 'completed',
320
+ 'Target small businesses with affordable CRM options',
321
+ 'Email campaign targeting small business owners with value-focused messaging',
322
+ DATE(NOW() - INTERVAL '120 days'),
323
+ DATE(NOW() - INTERVAL '60 days'),
324
+ 7500.00,
325
+ 7200.00,
326
+ 'Small business owners looking for affordable CRM solutions',
327
+ 60,
328
+ 42,
329
+ 120000.00,
330
+ 85000.00,
331
+ 28.5,
332
+ 'email',
333
+ 'usr-crm-marketing',
334
+ 'usr-crm-sales-mgr',
335
+ 'team-crm-company',
336
+ NOW() - INTERVAL '125 days',
337
+ NOW() - INTERVAL '60 days'
338
+ ),
339
+
340
+ -- Paused Campaign
341
+ (
342
+ 'camp-crm-013',
343
+ 'Winter Holiday Special Promotion',
344
+ 'email',
345
+ 'paused',
346
+ 'Holiday promotion for year-end budget spending',
347
+ 'Special holiday promotion targeting prospects with remaining Q4 budget',
348
+ DATE(NOW() - INTERVAL '10 days'),
349
+ DATE(NOW() + INTERVAL '20 days'),
350
+ 5000.00,
351
+ 1200.00,
352
+ 'Previous prospects and warm leads from Q3 campaigns',
353
+ 25,
354
+ 3,
355
+ 50000.00,
356
+ 8000.00,
357
+ -15.2,
358
+ 'email',
359
+ 'usr-crm-marketing',
360
+ 'usr-crm-ceo',
361
+ 'team-crm-company',
362
+ NOW() - INTERVAL '15 days',
363
+ NOW() - INTERVAL '8 days'
364
+ );
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Companies Entity Configuration - CRM
3
+ *
4
+ * Customer and prospect companies.
5
+ * Updated with team support and granular permissions.
6
+ */
7
+
8
+ import { Building2 } from 'lucide-react'
9
+ import type { EntityConfig } from '@nextsparkjs/core/lib/entities/types'
10
+ import { companiesFields } from './companies.fields'
11
+
12
+ export const companiesEntityConfig: EntityConfig = {
13
+ // ==========================================
14
+ // 1. BASIC IDENTIFICATION
15
+ // ==========================================
16
+ slug: 'companies',
17
+ enabled: true,
18
+ names: {
19
+ singular: 'company',
20
+ plural: 'Companies'
21
+ },
22
+ icon: Building2,
23
+
24
+ // ==========================================
25
+ // 2. ACCESS AND SCOPE CONFIGURATION
26
+ // ==========================================
27
+ access: {
28
+ public: false,
29
+ api: true,
30
+ metadata: true,
31
+ shared: true
32
+ },
33
+
34
+ // ==========================================
35
+ // 3. UI/UX FEATURES
36
+ // ==========================================
37
+ ui: {
38
+ dashboard: {
39
+ showInMenu: true,
40
+ showInTopbar: true
41
+ },
42
+ public: {
43
+ hasArchivePage: false,
44
+ hasSinglePage: false
45
+ },
46
+ features: {
47
+ searchable: true,
48
+ sortable: true,
49
+ filterable: true,
50
+ bulkOperations: true,
51
+ importExport: true
52
+ }
53
+ },
54
+
55
+ // ==========================================
56
+ // FIELDS
57
+ // ==========================================
58
+ fields: companiesFields,
59
+ }
60
+
61
+ export default companiesEntityConfig