@nextsparkjs/theme-crm 0.1.0-beta.44 → 0.1.0-beta.45

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.
@@ -0,0 +1,146 @@
1
+ # Activities API
2
+
3
+ Manage tasks and activities related to CRM records. Activities track calls, emails, meetings, and other interactions with contacts, companies, and opportunities.
4
+
5
+ ## Overview
6
+
7
+ The Activities API allows you to create, read, update, and delete activity records. Activities help teams track their interactions and tasks across all CRM entities.
8
+
9
+ ## Authentication
10
+
11
+ All endpoints require authentication via:
12
+ - **Session cookie** (for browser-based requests)
13
+ - **API Key** header (for server-to-server requests)
14
+
15
+ ## Endpoints
16
+
17
+ ### List Activities
18
+ `GET /api/v1/activities`
19
+
20
+ Returns a paginated list of activities.
21
+
22
+ **Query Parameters:**
23
+ - `limit` (number, optional): Maximum records to return. Default: 20
24
+ - `offset` (number, optional): Number of records to skip. Default: 0
25
+ - `type` (string, optional): Filter by type (call, email, meeting, task, note, demo, presentation)
26
+ - `status` (string, optional): Filter by status (scheduled, in_progress, completed, cancelled, overdue)
27
+ - `contactId` (string, optional): Filter by contact
28
+ - `companyId` (string, optional): Filter by company
29
+ - `opportunityId` (string, optional): Filter by opportunity
30
+ - `search` (string, optional): Search by subject
31
+ - `sortBy` (string, optional): Field to sort by
32
+ - `sortOrder` (string, optional): Sort direction (asc, desc)
33
+
34
+ **Example Response:**
35
+ ```json
36
+ {
37
+ "data": [
38
+ {
39
+ "id": "activity_abc123",
40
+ "type": "meeting",
41
+ "subject": "Product Demo",
42
+ "description": "Demo of new features",
43
+ "status": "scheduled",
44
+ "priority": "high",
45
+ "dueDate": "2024-01-20T14:00:00Z",
46
+ "duration": 60,
47
+ "location": "Zoom",
48
+ "contactId": "contact_456",
49
+ "companyId": "company_xyz",
50
+ "assignedTo": "user_789",
51
+ "createdAt": "2024-01-15T10:30:00Z"
52
+ }
53
+ ],
54
+ "pagination": {
55
+ "total": 156,
56
+ "limit": 20,
57
+ "offset": 0
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Get Single Activity
63
+ `GET /api/v1/activities/[id]`
64
+
65
+ Returns a single activity by ID.
66
+
67
+ ### Create Activity
68
+ `POST /api/v1/activities`
69
+
70
+ Create a new activity record.
71
+
72
+ **Request Body:**
73
+ ```json
74
+ {
75
+ "type": "call",
76
+ "subject": "Follow-up call",
77
+ "description": "Discuss proposal",
78
+ "status": "scheduled",
79
+ "priority": "medium",
80
+ "dueDate": "2024-01-22T10:00:00Z",
81
+ "duration": 30,
82
+ "contactId": "contact_456"
83
+ }
84
+ ```
85
+
86
+ ### Update Activity
87
+ `PATCH /api/v1/activities/[id]`
88
+
89
+ Update an existing activity. Supports partial updates.
90
+
91
+ ### Delete Activity
92
+ `DELETE /api/v1/activities/[id]`
93
+
94
+ Delete an activity record.
95
+
96
+ ## Fields
97
+
98
+ | Field | Type | Required | Description |
99
+ |-------|------|----------|-------------|
100
+ | type | select | Yes | Type: call, email, meeting, task, note, demo, presentation |
101
+ | subject | text | Yes | Activity subject or title |
102
+ | description | textarea | No | Detailed description |
103
+ | status | select | No | Status: scheduled, in_progress, completed, cancelled, overdue |
104
+ | priority | select | No | Priority: low, medium, high, urgent |
105
+ | dueDate | datetime | No | When activity is due |
106
+ | completedAt | datetime | Auto | When activity was completed |
107
+ | duration | number | No | Duration in minutes |
108
+ | outcome | textarea | No | Activity outcome or result |
109
+ | location | text | No | Location for meetings |
110
+ | contactId | relation | No | Related contact (→ contacts) |
111
+ | companyId | relation | No | Related company (→ companies) |
112
+ | opportunityId | relation | No | Related opportunity (→ opportunities) |
113
+ | assignedTo | user | No | User assigned |
114
+ | createdAt | datetime | Auto | Creation timestamp |
115
+ | updatedAt | datetime | Auto | Last update timestamp |
116
+
117
+ ## Relationships
118
+
119
+ | Relation | Entity | Description |
120
+ |----------|--------|-------------|
121
+ | contactId | contacts | Related contact |
122
+ | companyId | companies | Related company |
123
+ | opportunityId | opportunities | Related opportunity |
124
+
125
+ ## Features
126
+
127
+ - **Searchable**: subject, description, outcome, location
128
+ - **Sortable**: Most fields
129
+ - **Bulk Operations**: Supported
130
+ - **Metadata**: Supported
131
+
132
+ ## Error Responses
133
+
134
+ | Status | Description |
135
+ |--------|-------------|
136
+ | 400 | Bad Request - Invalid parameters |
137
+ | 401 | Unauthorized - Missing or invalid auth |
138
+ | 403 | Forbidden - Insufficient permissions |
139
+ | 404 | Not Found - Activity doesn't exist |
140
+ | 422 | Validation Error - Invalid data |
141
+
142
+ ## Related APIs
143
+
144
+ - **[Contacts](/api/v1/contacts)** - Related contact
145
+ - **[Companies](/api/v1/companies)** - Related company
146
+ - **[Opportunities](/api/v1/opportunities)** - Related opportunity
@@ -0,0 +1,132 @@
1
+ /**
2
+ * API Presets for Activities Entity
3
+ */
4
+
5
+ import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
6
+
7
+ export default defineApiEndpoint({
8
+ summary: 'Track calls, meetings, tasks, and emails',
9
+ presets: [
10
+ {
11
+ id: 'list-all',
12
+ title: 'List All Activities',
13
+ description: 'Get all activities with pagination',
14
+ method: 'GET',
15
+ params: {
16
+ limit: 20
17
+ },
18
+ tags: ['read', 'list']
19
+ },
20
+ {
21
+ id: 'list-upcoming',
22
+ title: 'List Upcoming',
23
+ description: 'Get scheduled activities sorted by due date',
24
+ method: 'GET',
25
+ params: {
26
+ status: 'scheduled',
27
+ sortBy: 'dueDate',
28
+ sortOrder: 'asc'
29
+ },
30
+ tags: ['read', 'filter', 'priority']
31
+ },
32
+ {
33
+ id: 'list-overdue',
34
+ title: 'List Overdue',
35
+ description: 'Get overdue activities',
36
+ method: 'GET',
37
+ params: {
38
+ status: 'overdue'
39
+ },
40
+ tags: ['read', 'filter', 'priority']
41
+ },
42
+ {
43
+ id: 'list-by-type',
44
+ title: 'List by Type',
45
+ description: 'Get activities of a specific type',
46
+ method: 'GET',
47
+ params: {
48
+ type: '{{type}}'
49
+ },
50
+ tags: ['read', 'filter']
51
+ },
52
+ {
53
+ id: 'list-by-contact',
54
+ title: 'List by Contact',
55
+ description: 'Get activities for a specific contact',
56
+ method: 'GET',
57
+ params: {
58
+ contactId: '{{contactId}}'
59
+ },
60
+ tags: ['read', 'filter']
61
+ },
62
+ {
63
+ id: 'list-by-company',
64
+ title: 'List by Company',
65
+ description: 'Get activities for a specific company',
66
+ method: 'GET',
67
+ params: {
68
+ companyId: '{{companyId}}'
69
+ },
70
+ tags: ['read', 'filter']
71
+ },
72
+ {
73
+ id: 'list-by-opportunity',
74
+ title: 'List by Opportunity',
75
+ description: 'Get activities for a specific opportunity',
76
+ method: 'GET',
77
+ params: {
78
+ opportunityId: '{{opportunityId}}'
79
+ },
80
+ tags: ['read', 'filter']
81
+ },
82
+ {
83
+ id: 'create-call',
84
+ title: 'Create Call',
85
+ description: 'Create a new call activity',
86
+ method: 'POST',
87
+ payload: {
88
+ type: 'call',
89
+ subject: 'Follow-up call',
90
+ status: 'scheduled',
91
+ priority: 'medium'
92
+ },
93
+ tags: ['write', 'create']
94
+ },
95
+ {
96
+ id: 'create-meeting',
97
+ title: 'Create Meeting',
98
+ description: 'Create a new meeting activity',
99
+ method: 'POST',
100
+ payload: {
101
+ type: 'meeting',
102
+ subject: 'Meeting',
103
+ status: 'scheduled',
104
+ duration: 60
105
+ },
106
+ tags: ['write', 'create']
107
+ },
108
+ {
109
+ id: 'mark-completed',
110
+ title: 'Mark Completed',
111
+ description: 'Mark an activity as completed',
112
+ method: 'PATCH',
113
+ pathParams: {
114
+ id: '{{id}}'
115
+ },
116
+ payload: {
117
+ status: 'completed'
118
+ },
119
+ tags: ['write', 'update']
120
+ },
121
+ {
122
+ id: 'delete-activity',
123
+ title: 'Delete Activity',
124
+ description: 'Delete an activity record',
125
+ method: 'DELETE',
126
+ pathParams: {
127
+ id: '{{id}}'
128
+ },
129
+ tags: ['write', 'delete']
130
+ }
131
+ ]
132
+ })
@@ -0,0 +1,140 @@
1
+ # Campaigns API
2
+
3
+ Manage marketing campaigns with budget tracking, lead generation metrics, and ROI analysis.
4
+
5
+ ## Overview
6
+
7
+ The Campaigns API allows you to create, read, update, and delete campaign records. Campaigns track marketing efforts and their effectiveness in generating leads and revenue.
8
+
9
+ ## Authentication
10
+
11
+ All endpoints require authentication via:
12
+ - **Session cookie** (for browser-based requests)
13
+ - **API Key** header (for server-to-server requests)
14
+
15
+ ## Endpoints
16
+
17
+ ### List Campaigns
18
+ `GET /api/v1/campaigns`
19
+
20
+ Returns a paginated list of campaigns.
21
+
22
+ **Query Parameters:**
23
+ - `limit` (number, optional): Maximum records to return. Default: 20
24
+ - `offset` (number, optional): Number of records to skip. Default: 0
25
+ - `type` (string, optional): Filter by type (email, social, event, webinar, advertising, content, other)
26
+ - `status` (string, optional): Filter by status (planned, active, paused, completed, cancelled)
27
+ - `search` (string, optional): Search by name, objective
28
+ - `sortBy` (string, optional): Field to sort by
29
+ - `sortOrder` (string, optional): Sort direction (asc, desc)
30
+
31
+ **Example Response:**
32
+ ```json
33
+ {
34
+ "data": [
35
+ {
36
+ "id": "campaign_abc123",
37
+ "name": "Q1 Email Campaign",
38
+ "type": "email",
39
+ "status": "active",
40
+ "objective": "Generate leads for new product launch",
41
+ "startDate": "2024-01-01",
42
+ "endDate": "2024-03-31",
43
+ "budget": 10000,
44
+ "actualCost": 7500,
45
+ "targetLeads": 500,
46
+ "actualLeads": 350,
47
+ "targetRevenue": 100000,
48
+ "actualRevenue": 75000,
49
+ "roi": 900,
50
+ "channel": "email",
51
+ "assignedTo": "user_456",
52
+ "createdAt": "2024-01-15T10:30:00Z"
53
+ }
54
+ ],
55
+ "pagination": {
56
+ "total": 15,
57
+ "limit": 20,
58
+ "offset": 0
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Get Single Campaign
64
+ `GET /api/v1/campaigns/[id]`
65
+
66
+ Returns a single campaign by ID.
67
+
68
+ ### Create Campaign
69
+ `POST /api/v1/campaigns`
70
+
71
+ Create a new campaign record.
72
+
73
+ **Request Body:**
74
+ ```json
75
+ {
76
+ "name": "New Product Launch",
77
+ "type": "social",
78
+ "status": "planned",
79
+ "objective": "Create awareness for new product",
80
+ "startDate": "2024-04-01",
81
+ "endDate": "2024-05-31",
82
+ "budget": 15000,
83
+ "targetLeads": 300,
84
+ "channel": "social_media"
85
+ }
86
+ ```
87
+
88
+ ### Update Campaign
89
+ `PATCH /api/v1/campaigns/[id]`
90
+
91
+ Update an existing campaign. Supports partial updates.
92
+
93
+ ### Delete Campaign
94
+ `DELETE /api/v1/campaigns/[id]`
95
+
96
+ Delete a campaign record.
97
+
98
+ ## Fields
99
+
100
+ | Field | Type | Required | Description |
101
+ |-------|------|----------|-------------|
102
+ | name | text | Yes | Campaign name |
103
+ | type | select | No | Type: email, social, event, webinar, advertising, content, other |
104
+ | status | select | No | Status: planned, active, paused, completed, cancelled |
105
+ | objective | text | No | Campaign objective |
106
+ | description | textarea | No | Detailed campaign description |
107
+ | startDate | date | Yes | Campaign start date |
108
+ | endDate | date | Yes | Campaign end date |
109
+ | budget | number | No | Campaign budget |
110
+ | actualCost | number | No | Actual cost spent |
111
+ | targetAudience | text | No | Target audience description |
112
+ | targetLeads | number | No | Target number of leads |
113
+ | actualLeads | number | No | Actual leads generated |
114
+ | targetRevenue | number | No | Target revenue to generate |
115
+ | actualRevenue | number | No | Actual revenue generated |
116
+ | roi | number | Auto | Return on investment percentage |
117
+ | channel | select | No | Main channel: email, social_media, web, print, tv, radio, other |
118
+ | assignedTo | user | No | Campaign manager assigned |
119
+ | createdAt | datetime | Auto | Creation timestamp |
120
+ | updatedAt | datetime | Auto | Last update timestamp |
121
+
122
+ ## Features
123
+
124
+ - **Searchable**: name, objective, description, target audience
125
+ - **Sortable**: Most fields
126
+ - **Metadata**: Supported
127
+
128
+ ## Error Responses
129
+
130
+ | Status | Description |
131
+ |--------|-------------|
132
+ | 400 | Bad Request - Invalid parameters |
133
+ | 401 | Unauthorized - Missing or invalid auth |
134
+ | 403 | Forbidden - Insufficient permissions |
135
+ | 404 | Not Found - Campaign doesn't exist |
136
+ | 422 | Validation Error - Invalid data |
137
+
138
+ ## Related APIs
139
+
140
+ - **[Leads](/api/v1/leads)** - Leads generated by campaigns
@@ -0,0 +1,147 @@
1
+ /**
2
+ * API Presets for Campaigns Entity
3
+ */
4
+
5
+ import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
6
+
7
+ export default defineApiEndpoint({
8
+ summary: 'Manage marketing campaigns with budget and ROI tracking',
9
+ presets: [
10
+ {
11
+ id: 'list-all',
12
+ title: 'List All Campaigns',
13
+ description: 'Get all campaigns with pagination',
14
+ method: 'GET',
15
+ params: {
16
+ limit: 20
17
+ },
18
+ tags: ['read', 'list']
19
+ },
20
+ {
21
+ id: 'list-active',
22
+ title: 'List Active Campaigns',
23
+ description: 'Get all active campaigns',
24
+ method: 'GET',
25
+ params: {
26
+ status: 'active'
27
+ },
28
+ tags: ['read', 'filter']
29
+ },
30
+ {
31
+ id: 'list-planned',
32
+ title: 'List Planned Campaigns',
33
+ description: 'Get all planned campaigns',
34
+ method: 'GET',
35
+ params: {
36
+ status: 'planned'
37
+ },
38
+ tags: ['read', 'filter']
39
+ },
40
+ {
41
+ id: 'list-completed',
42
+ title: 'List Completed Campaigns',
43
+ description: 'Get all completed campaigns',
44
+ method: 'GET',
45
+ params: {
46
+ status: 'completed'
47
+ },
48
+ tags: ['read', 'filter']
49
+ },
50
+ {
51
+ id: 'list-by-type',
52
+ title: 'List by Type',
53
+ description: 'Get campaigns of a specific type',
54
+ method: 'GET',
55
+ params: {
56
+ type: '{{type}}'
57
+ },
58
+ tags: ['read', 'filter']
59
+ },
60
+ {
61
+ id: 'list-email',
62
+ title: 'List Email Campaigns',
63
+ description: 'Get all email campaigns',
64
+ method: 'GET',
65
+ params: {
66
+ type: 'email'
67
+ },
68
+ tags: ['read', 'filter']
69
+ },
70
+ {
71
+ id: 'search-by-name',
72
+ title: 'Search by Name',
73
+ description: 'Search campaigns by name',
74
+ method: 'GET',
75
+ params: {
76
+ search: '{{name}}'
77
+ },
78
+ tags: ['read', 'search']
79
+ },
80
+ {
81
+ id: 'create-campaign',
82
+ title: 'Create Campaign',
83
+ description: 'Create a new campaign',
84
+ method: 'POST',
85
+ payload: {
86
+ name: 'New Campaign',
87
+ type: 'email',
88
+ status: 'planned',
89
+ startDate: '2024-01-01',
90
+ endDate: '2024-03-31',
91
+ budget: 5000
92
+ },
93
+ tags: ['write', 'create']
94
+ },
95
+ {
96
+ id: 'update-metrics',
97
+ title: 'Update Metrics',
98
+ description: 'Update campaign performance metrics',
99
+ method: 'PATCH',
100
+ pathParams: {
101
+ id: '{{id}}'
102
+ },
103
+ payload: {
104
+ actualLeads: '{{leads}}',
105
+ actualRevenue: '{{revenue}}',
106
+ actualCost: '{{cost}}'
107
+ },
108
+ tags: ['write', 'update']
109
+ },
110
+ {
111
+ id: 'activate',
112
+ title: 'Activate Campaign',
113
+ description: 'Set campaign status to active',
114
+ method: 'PATCH',
115
+ pathParams: {
116
+ id: '{{id}}'
117
+ },
118
+ payload: {
119
+ status: 'active'
120
+ },
121
+ tags: ['write', 'update']
122
+ },
123
+ {
124
+ id: 'complete',
125
+ title: 'Complete Campaign',
126
+ description: 'Mark campaign as completed',
127
+ method: 'PATCH',
128
+ pathParams: {
129
+ id: '{{id}}'
130
+ },
131
+ payload: {
132
+ status: 'completed'
133
+ },
134
+ tags: ['write', 'update']
135
+ },
136
+ {
137
+ id: 'delete-campaign',
138
+ title: 'Delete Campaign',
139
+ description: 'Delete a campaign record',
140
+ method: 'DELETE',
141
+ pathParams: {
142
+ id: '{{id}}'
143
+ },
144
+ tags: ['write', 'delete']
145
+ }
146
+ ]
147
+ })
@@ -0,0 +1,139 @@
1
+ # Companies API
2
+
3
+ Manage customer and prospect companies. Companies serve as the central entity linking contacts, opportunities, and activities.
4
+
5
+ ## Overview
6
+
7
+ The Companies API allows you to create, read, update, and delete company records. Companies represent organizations that your team works with and can be categorized by type (prospect, customer, partner, etc.).
8
+
9
+ ## Authentication
10
+
11
+ All endpoints require authentication via:
12
+ - **Session cookie** (for browser-based requests)
13
+ - **API Key** header (for server-to-server requests)
14
+
15
+ ## Endpoints
16
+
17
+ ### List Companies
18
+ `GET /api/v1/companies`
19
+
20
+ Returns a paginated list of companies.
21
+
22
+ **Query Parameters:**
23
+ - `limit` (number, optional): Maximum records to return. Default: 20
24
+ - `offset` (number, optional): Number of records to skip. Default: 0
25
+ - `type` (string, optional): Filter by type (prospect, customer, partner, competitor, vendor, other)
26
+ - `rating` (string, optional): Filter by rating (hot, warm, cold)
27
+ - `search` (string, optional): Search by name, email, industry
28
+ - `sortBy` (string, optional): Field to sort by
29
+ - `sortOrder` (string, optional): Sort direction (asc, desc)
30
+
31
+ **Example Response:**
32
+ ```json
33
+ {
34
+ "data": [
35
+ {
36
+ "id": "company_abc123",
37
+ "name": "Acme Corporation",
38
+ "legalName": "Acme Corp Inc.",
39
+ "website": "https://acme.com",
40
+ "email": "info@acme.com",
41
+ "phone": "+1-555-0100",
42
+ "industry": "Technology",
43
+ "type": "customer",
44
+ "size": "201-500",
45
+ "rating": "hot",
46
+ "country": "US",
47
+ "assignedTo": "user_456",
48
+ "createdAt": "2024-01-15T10:30:00Z"
49
+ }
50
+ ],
51
+ "pagination": {
52
+ "total": 89,
53
+ "limit": 20,
54
+ "offset": 0
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Get Single Company
60
+ `GET /api/v1/companies/[id]`
61
+
62
+ Returns a single company by ID.
63
+
64
+ ### Create Company
65
+ `POST /api/v1/companies`
66
+
67
+ Create a new company record.
68
+
69
+ **Request Body:**
70
+ ```json
71
+ {
72
+ "name": "New Tech Inc",
73
+ "email": "info@newtech.com",
74
+ "website": "https://newtech.com",
75
+ "industry": "Software",
76
+ "type": "prospect",
77
+ "size": "51-200"
78
+ }
79
+ ```
80
+
81
+ ### Update Company
82
+ `PATCH /api/v1/companies/[id]`
83
+
84
+ Update an existing company. Supports partial updates.
85
+
86
+ ### Delete Company
87
+ `DELETE /api/v1/companies/[id]`
88
+
89
+ Delete a company record.
90
+
91
+ ## Fields
92
+
93
+ | Field | Type | Required | Description |
94
+ |-------|------|----------|-------------|
95
+ | name | text | Yes | Company display name |
96
+ | legalName | text | No | Legal registered name |
97
+ | taxId | text | No | Tax identification number |
98
+ | website | url | No | Company website URL |
99
+ | email | email | No | General company email |
100
+ | phone | text | No | Main phone number |
101
+ | industry | text | No | Industry sector |
102
+ | type | select | No | Type: prospect, customer, partner, competitor, vendor, other |
103
+ | size | select | No | Size: 1-10, 11-50, 51-200, 201-500, 500+ |
104
+ | annualRevenue | number | No | Annual revenue |
105
+ | address | textarea | No | Street address |
106
+ | city | text | No | City |
107
+ | state | text | No | State or province |
108
+ | country | text | No | Country |
109
+ | postalCode | text | No | Postal or ZIP code |
110
+ | logo | url | No | Company logo URL |
111
+ | rating | select | No | Sales rating: hot, warm, cold |
112
+ | assignedTo | user | No | Account manager assigned |
113
+ | createdAt | datetime | Auto | Creation timestamp |
114
+ | updatedAt | datetime | Auto | Last update timestamp |
115
+
116
+ ## Features
117
+
118
+ - **Searchable**: name, legal name, tax ID, email, phone, industry, address, city, state, country, postal code
119
+ - **Sortable**: Most fields
120
+ - **Bulk Operations**: Supported
121
+ - **Import/Export**: Supported
122
+ - **Metadata**: Supported
123
+
124
+ ## Error Responses
125
+
126
+ | Status | Description |
127
+ |--------|-------------|
128
+ | 400 | Bad Request - Invalid parameters |
129
+ | 401 | Unauthorized - Missing or invalid auth |
130
+ | 403 | Forbidden - Insufficient permissions |
131
+ | 404 | Not Found - Company doesn't exist |
132
+ | 422 | Validation Error - Invalid data |
133
+
134
+ ## Related APIs
135
+
136
+ - **[Contacts](/api/v1/contacts)** - People at this company
137
+ - **[Opportunities](/api/v1/opportunities)** - Sales opportunities
138
+ - **[Activities](/api/v1/activities)** - Activities with this company
139
+ - **[Notes](/api/v1/notes)** - Notes about this company