@bernierllc/email-campaign-management 1.3.2 → 1.5.0

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 (45) hide show
  1. package/dist/api/client.js +1 -0
  2. package/dist/errors.d.ts +11 -0
  3. package/dist/errors.js +27 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +3 -1
  6. package/package.json +8 -4
  7. package/.eslintrc.cjs +0 -45
  8. package/CHANGELOG.md +0 -168
  9. package/__tests__/api/campaigns.test.ts +0 -217
  10. package/__tests__/api/client.test.ts +0 -330
  11. package/__tests__/components/CampaignBuilder.test.tsx +0 -103
  12. package/__tests__/components/CampaignDashboard.test.tsx +0 -89
  13. package/__tests__/components/CampaignList.test.tsx +0 -144
  14. package/__tests__/components/MetricsOverview.test.tsx +0 -200
  15. package/__tests__/components/PerformanceChart.test.tsx +0 -206
  16. package/__tests__/hooks/useCampaignStore.test.ts +0 -450
  17. package/__tests__/hooks/useWorkflowValidation.test.ts +0 -176
  18. package/__tests__/utils/formatting.test.ts +0 -48
  19. package/__tests__/utils/validation.test.ts +0 -199
  20. package/__tests__/utils/workflow-helpers.test.ts +0 -134
  21. package/jest.config.cjs +0 -33
  22. package/jest.setup.cjs +0 -9
  23. package/src/api/campaigns.ts +0 -38
  24. package/src/api/client.ts +0 -131
  25. package/src/components/CampaignBuilder/index.tsx +0 -123
  26. package/src/components/CampaignDashboard/MetricsOverview.tsx +0 -41
  27. package/src/components/CampaignDashboard/PerformanceChart.tsx +0 -49
  28. package/src/components/CampaignDashboard/index.tsx +0 -52
  29. package/src/components/CampaignList/index.tsx +0 -53
  30. package/src/config.ts +0 -39
  31. package/src/hooks/useCampaignMetrics.ts +0 -41
  32. package/src/hooks/useCampaignStore.ts +0 -86
  33. package/src/hooks/useWorkflowValidation.ts +0 -17
  34. package/src/index.ts +0 -32
  35. package/src/types/abtest.ts +0 -25
  36. package/src/types/audience.ts +0 -30
  37. package/src/types/campaign.ts +0 -44
  38. package/src/types/index.ts +0 -14
  39. package/src/types/metrics.ts +0 -36
  40. package/src/types/schedule.ts +0 -26
  41. package/src/types/workflow.ts +0 -53
  42. package/src/utils/formatting.ts +0 -26
  43. package/src/utils/validation.ts +0 -103
  44. package/src/utils/workflow-helpers.ts +0 -64
  45. package/tsconfig.json +0 -24
@@ -1,199 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- import { validateWorkflow, validateABTest, validateCampaignName } from '../../src/utils/validation';
10
- import { CampaignWorkflow, ABTestConfig } from '../../src/types';
11
-
12
- describe('Validation Utils', () => {
13
- describe('validateWorkflow', () => {
14
- it('should reject empty workflow', () => {
15
- const workflow: CampaignWorkflow = {
16
- id: 'workflow-1',
17
- nodes: [],
18
- edges: []
19
- };
20
-
21
- const result = validateWorkflow(workflow);
22
- expect(result.valid).toBe(false);
23
- expect(result.errors).toContain('Workflow must have at least one node');
24
- });
25
-
26
- it('should accept single node workflow', () => {
27
- const workflow: CampaignWorkflow = {
28
- id: 'workflow-1',
29
- nodes: [
30
- { id: 'node-1', type: 'email', data: {}, position: { x: 0, y: 0 } }
31
- ],
32
- edges: []
33
- };
34
-
35
- const result = validateWorkflow(workflow);
36
- expect(result.valid).toBe(true);
37
- expect(result.errors).toHaveLength(0);
38
- });
39
-
40
- it('should detect disconnected nodes', () => {
41
- const workflow: CampaignWorkflow = {
42
- id: 'workflow-1',
43
- nodes: [
44
- { id: 'node-1', type: 'email', data: {}, position: { x: 0, y: 0 } },
45
- { id: 'node-2', type: 'delay', data: {}, position: { x: 100, y: 0 } }
46
- ],
47
- edges: []
48
- };
49
-
50
- const result = validateWorkflow(workflow);
51
- expect(result.valid).toBe(false);
52
- expect(result.errors[0]).toContain('disconnected');
53
- });
54
-
55
- it('should accept connected workflow', () => {
56
- const workflow: CampaignWorkflow = {
57
- id: 'workflow-1',
58
- nodes: [
59
- { id: 'node-1', type: 'email', data: {}, position: { x: 0, y: 0 } },
60
- { id: 'node-2', type: 'delay', data: {}, position: { x: 100, y: 0 } }
61
- ],
62
- edges: [
63
- { id: 'edge-1', source: 'node-1', target: 'node-2' }
64
- ]
65
- };
66
-
67
- const result = validateWorkflow(workflow);
68
- expect(result.valid).toBe(true);
69
- expect(result.errors).toHaveLength(0);
70
- });
71
- });
72
-
73
- describe('validateABTest', () => {
74
- it('should accept disabled A/B test', () => {
75
- const config: ABTestConfig = {
76
- enabled: false,
77
- variants: [],
78
- winnerCriteria: 'open_rate',
79
- testDuration: 24,
80
- winnerPercentage: 100
81
- };
82
-
83
- const result = validateABTest(config);
84
- expect(result.valid).toBe(true);
85
- expect(result.errors).toHaveLength(0);
86
- });
87
-
88
- it('should require at least 2 variants', () => {
89
- const config: ABTestConfig = {
90
- enabled: true,
91
- variants: [
92
- { id: 'v1', name: 'Variant A', percentage: 100, templateId: 'template-1', subjectLine: 'Subject' }
93
- ],
94
- winnerCriteria: 'open_rate',
95
- testDuration: 24,
96
- winnerPercentage: 100
97
- };
98
-
99
- const result = validateABTest(config);
100
- expect(result.valid).toBe(false);
101
- expect(result.errors).toContain('A/B test must have at least 2 variants');
102
- });
103
-
104
- it('should require percentages to sum to 100', () => {
105
- const config: ABTestConfig = {
106
- enabled: true,
107
- variants: [
108
- { id: 'v1', name: 'Variant A', percentage: 60, templateId: 'template-1', subjectLine: 'Subject A' },
109
- { id: 'v2', name: 'Variant B', percentage: 50, templateId: 'template-2', subjectLine: 'Subject B' }
110
- ],
111
- winnerCriteria: 'open_rate',
112
- testDuration: 24,
113
- winnerPercentage: 100
114
- };
115
-
116
- const result = validateABTest(config);
117
- expect(result.valid).toBe(false);
118
- expect(result.errors[0]).toContain('must sum to 100');
119
- });
120
-
121
- it('should accept valid A/B test configuration', () => {
122
- const config: ABTestConfig = {
123
- enabled: true,
124
- variants: [
125
- { id: 'v1', name: 'Variant A', percentage: 50, templateId: 'template-1', subjectLine: 'Subject A' },
126
- { id: 'v2', name: 'Variant B', percentage: 50, templateId: 'template-2', subjectLine: 'Subject B' }
127
- ],
128
- winnerCriteria: 'open_rate',
129
- testDuration: 24,
130
- winnerPercentage: 100
131
- };
132
-
133
- const result = validateABTest(config);
134
- expect(result.valid).toBe(true);
135
- expect(result.errors).toHaveLength(0);
136
- });
137
-
138
- it('should require template for each variant', () => {
139
- const config: ABTestConfig = {
140
- enabled: true,
141
- variants: [
142
- { id: 'v1', name: 'Variant A', percentage: 50, templateId: '', subjectLine: 'Subject A' },
143
- { id: 'v2', name: 'Variant B', percentage: 50, templateId: 'template-2', subjectLine: 'Subject B' }
144
- ],
145
- winnerCriteria: 'open_rate',
146
- testDuration: 24,
147
- winnerPercentage: 100
148
- };
149
-
150
- const result = validateABTest(config);
151
- expect(result.valid).toBe(false);
152
- expect(result.errors[0]).toContain('must have a template');
153
- });
154
-
155
- it('should require subject line for each variant', () => {
156
- const config: ABTestConfig = {
157
- enabled: true,
158
- variants: [
159
- { id: 'v1', name: 'Variant A', percentage: 50, templateId: 'template-1', subjectLine: '' },
160
- { id: 'v2', name: 'Variant B', percentage: 50, templateId: 'template-2', subjectLine: 'Subject B' }
161
- ],
162
- winnerCriteria: 'open_rate',
163
- testDuration: 24,
164
- winnerPercentage: 100
165
- };
166
-
167
- const result = validateABTest(config);
168
- expect(result.valid).toBe(false);
169
- expect(result.errors[0]).toContain('must have a subject line');
170
- });
171
- });
172
-
173
- describe('validateCampaignName', () => {
174
- it('should reject empty name', () => {
175
- const result = validateCampaignName('');
176
- expect(result.valid).toBe(false);
177
- expect(result.errors).toContain('Campaign name is required');
178
- });
179
-
180
- it('should reject whitespace-only name', () => {
181
- const result = validateCampaignName(' ');
182
- expect(result.valid).toBe(false);
183
- expect(result.errors).toContain('Campaign name is required');
184
- });
185
-
186
- it('should reject names over 100 characters', () => {
187
- const longName = 'a'.repeat(101);
188
- const result = validateCampaignName(longName);
189
- expect(result.valid).toBe(false);
190
- expect(result.errors[0]).toContain('100 characters');
191
- });
192
-
193
- it('should accept valid campaign name', () => {
194
- const result = validateCampaignName('Welcome Series Campaign');
195
- expect(result.valid).toBe(true);
196
- expect(result.errors).toHaveLength(0);
197
- });
198
- });
199
- });
@@ -1,134 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- import {
10
- generateNodeId,
11
- generateEdgeId,
12
- createNode,
13
- createEdge,
14
- getDefaultWorkflow,
15
- findNodeById,
16
- removeNode,
17
- updateNode
18
- } from '../../src/utils/workflow-helpers';
19
-
20
- describe('Workflow Helpers', () => {
21
- describe('ID generation', () => {
22
- it('should generate unique node IDs', () => {
23
- const id1 = generateNodeId();
24
- const id2 = generateNodeId();
25
- expect(id1).not.toBe(id2);
26
- expect(id1).toMatch(/^node_/);
27
- });
28
-
29
- it('should generate unique edge IDs', () => {
30
- const id1 = generateEdgeId();
31
- const id2 = generateEdgeId();
32
- expect(id1).not.toBe(id2);
33
- expect(id1).toMatch(/^edge_/);
34
- });
35
- });
36
-
37
- describe('createNode', () => {
38
- it('should create email node with position', () => {
39
- const node = createNode('email', { x: 100, y: 200 });
40
- expect(node.type).toBe('email');
41
- expect(node.position).toEqual({ x: 100, y: 200 });
42
- expect(node.id).toBeTruthy();
43
- expect(node.data).toEqual({});
44
- });
45
-
46
- it('should create delay node', () => {
47
- const node = createNode('delay', { x: 0, y: 0 });
48
- expect(node.type).toBe('delay');
49
- });
50
- });
51
-
52
- describe('createEdge', () => {
53
- it('should create edge with source and target', () => {
54
- const edge = createEdge('node-1', 'node-2');
55
- expect(edge.source).toBe('node-1');
56
- expect(edge.target).toBe('node-2');
57
- expect(edge.type).toBe('default');
58
- expect(edge.id).toBeTruthy();
59
- });
60
- });
61
-
62
- describe('getDefaultWorkflow', () => {
63
- it('should create empty workflow', () => {
64
- const workflow = getDefaultWorkflow();
65
- expect(workflow.nodes).toEqual([]);
66
- expect(workflow.edges).toEqual([]);
67
- expect(workflow.id).toBeTruthy();
68
- expect(workflow.id).toMatch(/^workflow_/);
69
- });
70
- });
71
-
72
- describe('findNodeById', () => {
73
- it('should find existing node', () => {
74
- const workflow = getDefaultWorkflow();
75
- const node = createNode('email', { x: 0, y: 0 });
76
- workflow.nodes.push(node);
77
-
78
- const found = findNodeById(workflow, node.id);
79
- expect(found).toBe(node);
80
- });
81
-
82
- it('should return undefined for non-existent node', () => {
83
- const workflow = getDefaultWorkflow();
84
- const found = findNodeById(workflow, 'non-existent');
85
- expect(found).toBeUndefined();
86
- });
87
- });
88
-
89
- describe('removeNode', () => {
90
- it('should remove node and connected edges', () => {
91
- const workflow = getDefaultWorkflow();
92
- const node1 = createNode('email', { x: 0, y: 0 });
93
- const node2 = createNode('delay', { x: 100, y: 0 });
94
- const edge = createEdge(node1.id, node2.id);
95
-
96
- workflow.nodes.push(node1, node2);
97
- workflow.edges.push(edge);
98
-
99
- const updated = removeNode(workflow, node1.id);
100
- expect(updated.nodes).toHaveLength(1);
101
- expect(updated.edges).toHaveLength(0);
102
- });
103
- });
104
-
105
- describe('updateNode', () => {
106
- it('should update node data', () => {
107
- const workflow = getDefaultWorkflow();
108
- const node = createNode('email', { x: 0, y: 0 });
109
- workflow.nodes.push(node);
110
-
111
- const updated = updateNode(workflow, node.id, {
112
- data: { templateId: 'template-123' }
113
- });
114
-
115
- const updatedNode = findNodeById(updated, node.id);
116
- expect(updatedNode?.data.templateId).toBe('template-123');
117
- });
118
-
119
- it('should not modify other nodes', () => {
120
- const workflow = getDefaultWorkflow();
121
- const node1 = createNode('email', { x: 0, y: 0 });
122
- const node2 = createNode('delay', { x: 100, y: 0 });
123
- workflow.nodes.push(node1, node2);
124
-
125
- const updated = updateNode(workflow, node1.id, {
126
- data: { templateId: 'template-123' }
127
- });
128
-
129
- expect(updated.nodes).toHaveLength(2);
130
- const node2Updated = findNodeById(updated, node2.id);
131
- expect(node2Updated?.data).toEqual({});
132
- });
133
- });
134
- });
package/jest.config.cjs DELETED
@@ -1,33 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- module.exports = {
10
- preset: 'ts-jest',
11
- testEnvironment: 'jsdom',
12
- collectCoverageFrom: [
13
- 'src/**/*.{ts,tsx}',
14
- '!src/**/*.d.ts',
15
- '!src/index.ts'
16
- ],
17
- coverageThreshold: {
18
- global: {
19
- branches: 80,
20
- functions: 80,
21
- lines: 80,
22
- statements: 80
23
- }
24
- },
25
- setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
26
- moduleNameMapper: {
27
- '\\.(css|less|scss|sass)$': 'identity-obj-proxy'
28
- },
29
- testMatch: [
30
- '**/__tests__/**/*.test.ts',
31
- '**/__tests__/**/*.test.tsx'
32
- ]
33
- };
package/jest.setup.cjs DELETED
@@ -1,9 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- require('@testing-library/jest-dom');
@@ -1,38 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- import { apiClient, APIResponse } from './client';
10
- import { Campaign, CampaignMetrics, EmailMetrics } from '../types';
11
-
12
- export async function getCampaigns(): Promise<APIResponse<Campaign[]>> {
13
- return apiClient.get<Campaign[]>('/campaigns');
14
- }
15
-
16
- export async function getCampaign(id: string): Promise<APIResponse<Campaign>> {
17
- return apiClient.get<Campaign>(`/campaigns/${id}`);
18
- }
19
-
20
- export async function createCampaign(campaign: Partial<Campaign>): Promise<APIResponse<Campaign>> {
21
- return apiClient.post<Campaign>('/campaigns', campaign);
22
- }
23
-
24
- export async function updateCampaign(id: string, updates: Partial<Campaign>): Promise<APIResponse<Campaign>> {
25
- return apiClient.put<Campaign>(`/campaigns/${id}`, updates);
26
- }
27
-
28
- export async function deleteCampaign(id: string): Promise<APIResponse<void>> {
29
- return apiClient.delete<void>(`/campaigns/${id}`);
30
- }
31
-
32
- export async function getCampaignMetrics(campaignId: string): Promise<APIResponse<CampaignMetrics>> {
33
- return apiClient.get<CampaignMetrics>(`/campaigns/${campaignId}/metrics`);
34
- }
35
-
36
- export async function getEmailMetrics(campaignId: string): Promise<APIResponse<EmailMetrics[]>> {
37
- return apiClient.get<EmailMetrics[]>(`/campaigns/${campaignId}/emails/metrics`);
38
- }
package/src/api/client.ts DELETED
@@ -1,131 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- import { getConfig } from '../config';
10
-
11
- export interface APIResponse<T = unknown> {
12
- success: boolean;
13
- data?: T;
14
- error?: string;
15
- }
16
-
17
- export class APIClient {
18
- private baseUrl: string;
19
-
20
- constructor(baseUrl?: string) {
21
- this.baseUrl = baseUrl || getConfig().apiUrl;
22
- }
23
-
24
- async get<T>(endpoint: string): Promise<APIResponse<T>> {
25
- try {
26
- const response = await fetch(`${this.baseUrl}${endpoint}`, {
27
- method: 'GET',
28
- headers: {
29
- 'Content-Type': 'application/json'
30
- }
31
- });
32
-
33
- if (!response.ok) {
34
- return {
35
- success: false,
36
- error: `HTTP ${response.status}: ${response.statusText}`
37
- };
38
- }
39
-
40
- const data = await response.json();
41
- return { success: true, data };
42
- } catch (error) {
43
- return {
44
- success: false,
45
- error: error instanceof Error ? error.message : 'Unknown error'
46
- };
47
- }
48
- }
49
-
50
- async post<T>(endpoint: string, body: unknown): Promise<APIResponse<T>> {
51
- try {
52
- const response = await fetch(`${this.baseUrl}${endpoint}`, {
53
- method: 'POST',
54
- headers: {
55
- 'Content-Type': 'application/json'
56
- },
57
- body: JSON.stringify(body)
58
- });
59
-
60
- if (!response.ok) {
61
- return {
62
- success: false,
63
- error: `HTTP ${response.status}: ${response.statusText}`
64
- };
65
- }
66
-
67
- const data = await response.json();
68
- return { success: true, data };
69
- } catch (error) {
70
- return {
71
- success: false,
72
- error: error instanceof Error ? error.message : 'Unknown error'
73
- };
74
- }
75
- }
76
-
77
- async put<T>(endpoint: string, body: unknown): Promise<APIResponse<T>> {
78
- try {
79
- const response = await fetch(`${this.baseUrl}${endpoint}`, {
80
- method: 'PUT',
81
- headers: {
82
- 'Content-Type': 'application/json'
83
- },
84
- body: JSON.stringify(body)
85
- });
86
-
87
- if (!response.ok) {
88
- return {
89
- success: false,
90
- error: `HTTP ${response.status}: ${response.statusText}`
91
- };
92
- }
93
-
94
- const data = await response.json();
95
- return { success: true, data };
96
- } catch (error) {
97
- return {
98
- success: false,
99
- error: error instanceof Error ? error.message : 'Unknown error'
100
- };
101
- }
102
- }
103
-
104
- async delete<T>(endpoint: string): Promise<APIResponse<T>> {
105
- try {
106
- const response = await fetch(`${this.baseUrl}${endpoint}`, {
107
- method: 'DELETE',
108
- headers: {
109
- 'Content-Type': 'application/json'
110
- }
111
- });
112
-
113
- if (!response.ok) {
114
- return {
115
- success: false,
116
- error: `HTTP ${response.status}: ${response.statusText}`
117
- };
118
- }
119
-
120
- const data = await response.json();
121
- return { success: true, data };
122
- } catch (error) {
123
- return {
124
- success: false,
125
- error: error instanceof Error ? error.message : 'Unknown error'
126
- };
127
- }
128
- }
129
- }
130
-
131
- export const apiClient = new APIClient();
@@ -1,123 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
-
9
- import React, { useState } from 'react';
10
- import { Campaign, CampaignWorkflow } from '../../types';
11
- import { getDefaultWorkflow } from '../../utils/workflow-helpers';
12
-
13
- export interface CampaignBuilderProps {
14
- campaign?: Campaign;
15
- onSave: (campaign: Partial<Campaign>) => void;
16
- onPublish?: (campaign: Campaign) => void;
17
- }
18
-
19
- export const CampaignBuilder: React.FC<CampaignBuilderProps> = ({
20
- campaign,
21
- onSave,
22
- onPublish
23
- }) => {
24
- const [name, setName] = useState(campaign?.name || '');
25
- const [description, setDescription] = useState(campaign?.description || '');
26
- const [workflow] = useState<CampaignWorkflow>(
27
- campaign?.workflow || getDefaultWorkflow()
28
- );
29
- const [activeTab, setActiveTab] = useState<'workflow' | 'audience' | 'schedule' | 'abtest'>('workflow');
30
-
31
- const handleSave = () => {
32
- onSave({
33
- name,
34
- description,
35
- workflow,
36
- type: 'one-time',
37
- status: 'draft'
38
- });
39
- };
40
-
41
- return (
42
- <div className="campaign-builder">
43
- <div className="campaign-header">
44
- <input
45
- type="text"
46
- value={name}
47
- onChange={(e) => setName(e.target.value)}
48
- placeholder="Campaign Name"
49
- className="campaign-name-input"
50
- />
51
- <textarea
52
- value={description}
53
- onChange={(e) => setDescription(e.target.value)}
54
- placeholder="Campaign Description"
55
- className="campaign-description-input"
56
- />
57
- </div>
58
-
59
- <div className="campaign-tabs">
60
- <button
61
- className={activeTab === 'workflow' ? 'active' : ''}
62
- onClick={() => setActiveTab('workflow')}
63
- >
64
- Workflow
65
- </button>
66
- <button
67
- className={activeTab === 'audience' ? 'active' : ''}
68
- onClick={() => setActiveTab('audience')}
69
- >
70
- Audience
71
- </button>
72
- <button
73
- className={activeTab === 'schedule' ? 'active' : ''}
74
- onClick={() => setActiveTab('schedule')}
75
- >
76
- Schedule
77
- </button>
78
- <button
79
- className={activeTab === 'abtest' ? 'active' : ''}
80
- onClick={() => setActiveTab('abtest')}
81
- >
82
- A/B Test
83
- </button>
84
- </div>
85
-
86
- <div className="campaign-content">
87
- {activeTab === 'workflow' && (
88
- <div className="workflow-tab">
89
- <p>Workflow editor placeholder</p>
90
- <p>Nodes: {workflow.nodes.length}</p>
91
- <p>Edges: {workflow.edges.length}</p>
92
- </div>
93
- )}
94
- {activeTab === 'audience' && (
95
- <div className="audience-tab">
96
- <p>Audience selector placeholder</p>
97
- </div>
98
- )}
99
- {activeTab === 'schedule' && (
100
- <div className="schedule-tab">
101
- <p>Schedule settings placeholder</p>
102
- </div>
103
- )}
104
- {activeTab === 'abtest' && (
105
- <div className="abtest-tab">
106
- <p>A/B test configuration placeholder</p>
107
- </div>
108
- )}
109
- </div>
110
-
111
- <div className="campaign-actions">
112
- <button onClick={handleSave} className="btn-save">
113
- Save Campaign
114
- </button>
115
- {onPublish && campaign && (
116
- <button onClick={() => onPublish(campaign)} className="btn-publish">
117
- Publish Campaign
118
- </button>
119
- )}
120
- </div>
121
- </div>
122
- );
123
- };