@bernierllc/email-campaign-management 1.5.15 → 1.5.16

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 (47) hide show
  1. package/package.json +3 -3
  2. package/dist/api/campaigns.d.ts +0 -9
  3. package/dist/api/campaigns.js +0 -38
  4. package/dist/api/client.d.ts +0 -14
  5. package/dist/api/client.js +0 -117
  6. package/dist/components/CampaignBuilder/index.d.ts +0 -8
  7. package/dist/components/CampaignBuilder/index.js +0 -88
  8. package/dist/components/CampaignDashboard/MetricsOverview.d.ts +0 -6
  9. package/dist/components/CampaignDashboard/MetricsOverview.js +0 -34
  10. package/dist/components/CampaignDashboard/PerformanceChart.d.ts +0 -7
  11. package/dist/components/CampaignDashboard/PerformanceChart.js +0 -45
  12. package/dist/components/CampaignDashboard/index.d.ts +0 -5
  13. package/dist/components/CampaignDashboard/index.js +0 -44
  14. package/dist/components/CampaignList/index.d.ts +0 -6
  15. package/dist/components/CampaignList/index.js +0 -68
  16. package/dist/config.d.ts +0 -12
  17. package/dist/config.js +0 -31
  18. package/dist/errors.d.ts +0 -11
  19. package/dist/errors.js +0 -27
  20. package/dist/hooks/useCampaignMetrics.d.ts +0 -2
  21. package/dist/hooks/useCampaignMetrics.js +0 -42
  22. package/dist/hooks/useCampaignStore.d.ts +0 -14
  23. package/dist/hooks/useCampaignStore.js +0 -105
  24. package/dist/hooks/useWorkflowValidation.d.ts +0 -3
  25. package/dist/hooks/useWorkflowValidation.js +0 -17
  26. package/dist/index.d.ts +0 -14
  27. package/dist/index.js +0 -54
  28. package/dist/types/abtest.d.ts +0 -15
  29. package/dist/types/abtest.js +0 -9
  30. package/dist/types/audience.d.ts +0 -18
  31. package/dist/types/audience.js +0 -9
  32. package/dist/types/campaign.d.ts +0 -31
  33. package/dist/types/campaign.js +0 -9
  34. package/dist/types/index.d.ts +0 -6
  35. package/dist/types/index.js +0 -29
  36. package/dist/types/metrics.d.ts +0 -27
  37. package/dist/types/metrics.js +0 -9
  38. package/dist/types/schedule.d.ts +0 -15
  39. package/dist/types/schedule.js +0 -9
  40. package/dist/types/workflow.d.ts +0 -37
  41. package/dist/types/workflow.js +0 -9
  42. package/dist/utils/formatting.d.ts +0 -4
  43. package/dist/utils/formatting.js +0 -28
  44. package/dist/utils/validation.d.ts +0 -8
  45. package/dist/utils/validation.js +0 -81
  46. package/dist/utils/workflow-helpers.d.ts +0 -12
  47. package/dist/utils/workflow-helpers.js +0 -62
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.useCampaignMetrics = useCampaignMetrics;
11
- exports.useEmailMetrics = useEmailMetrics;
12
- const react_query_1 = require("@tanstack/react-query");
13
- const campaigns_1 = require("../api/campaigns");
14
- const config_1 = require("../config");
15
- function useCampaignMetrics(campaignId) {
16
- return (0, react_query_1.useQuery)({
17
- queryKey: ['campaign-metrics', campaignId],
18
- queryFn: async () => {
19
- const response = await (0, campaigns_1.getCampaignMetrics)(campaignId);
20
- if (!response.success) {
21
- throw new Error(response.error || 'Failed to fetch campaign metrics');
22
- }
23
- return response.data;
24
- },
25
- refetchInterval: (0, config_1.getConfig)().metricsRefreshInterval,
26
- enabled: !!campaignId
27
- });
28
- }
29
- function useEmailMetrics(campaignId) {
30
- return (0, react_query_1.useQuery)({
31
- queryKey: ['email-metrics', campaignId],
32
- queryFn: async () => {
33
- const response = await (0, campaigns_1.getEmailMetrics)(campaignId);
34
- if (!response.success) {
35
- throw new Error(response.error || 'Failed to fetch email metrics');
36
- }
37
- return response.data;
38
- },
39
- refetchInterval: (0, config_1.getConfig)().metricsRefreshInterval,
40
- enabled: !!campaignId
41
- });
42
- }
@@ -1,14 +0,0 @@
1
- import { Campaign } from '../types';
2
- interface CampaignStore {
3
- campaigns: Campaign[];
4
- activeCampaign: Campaign | null;
5
- loading: boolean;
6
- error: string | null;
7
- fetchCampaigns: () => Promise<void>;
8
- createCampaign: (campaign: Partial<Campaign>) => Promise<Campaign | null>;
9
- updateCampaign: (id: string, updates: Partial<Campaign>) => Promise<void>;
10
- deleteCampaign: (id: string) => Promise<void>;
11
- setActiveCampaign: (campaign: Campaign | null) => void;
12
- }
13
- export declare const useCampaignStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CampaignStore>>;
14
- export {};
@@ -1,105 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.useCampaignStore = void 0;
44
- const zustand_1 = require("zustand");
45
- const campaignAPI = __importStar(require("../api/campaigns"));
46
- exports.useCampaignStore = (0, zustand_1.create)((set) => ({
47
- campaigns: [],
48
- activeCampaign: null,
49
- loading: false,
50
- error: null,
51
- fetchCampaigns: async () => {
52
- set({ loading: true, error: null });
53
- const response = await campaignAPI.getCampaigns();
54
- if (response.success && response.data) {
55
- set({ campaigns: response.data, loading: false });
56
- }
57
- else {
58
- set({ error: response.error || 'Failed to fetch campaigns', loading: false });
59
- }
60
- },
61
- createCampaign: async (campaign) => {
62
- set({ loading: true, error: null });
63
- const response = await campaignAPI.createCampaign(campaign);
64
- if (response.success && response.data) {
65
- set(state => ({
66
- campaigns: [...state.campaigns, response.data],
67
- loading: false
68
- }));
69
- return response.data;
70
- }
71
- else {
72
- set({ error: response.error || 'Failed to create campaign', loading: false });
73
- return null;
74
- }
75
- },
76
- updateCampaign: async (id, updates) => {
77
- set({ loading: true, error: null });
78
- const response = await campaignAPI.updateCampaign(id, updates);
79
- if (response.success && response.data) {
80
- set(state => ({
81
- campaigns: state.campaigns.map(c => c.id === id ? response.data : c),
82
- activeCampaign: state.activeCampaign?.id === id ? response.data : state.activeCampaign,
83
- loading: false
84
- }));
85
- }
86
- else {
87
- set({ error: response.error || 'Failed to update campaign', loading: false });
88
- }
89
- },
90
- deleteCampaign: async (id) => {
91
- set({ loading: true, error: null });
92
- const response = await campaignAPI.deleteCampaign(id);
93
- if (response.success) {
94
- set(state => ({
95
- campaigns: state.campaigns.filter(c => c.id !== id),
96
- activeCampaign: state.activeCampaign?.id === id ? null : state.activeCampaign,
97
- loading: false
98
- }));
99
- }
100
- else {
101
- set({ error: response.error || 'Failed to delete campaign', loading: false });
102
- }
103
- },
104
- setActiveCampaign: (campaign) => set({ activeCampaign: campaign })
105
- }));
@@ -1,3 +0,0 @@
1
- import { CampaignWorkflow } from '../types';
2
- import { ValidationResult } from '../utils/validation';
3
- export declare function useWorkflowValidation(workflow: CampaignWorkflow): ValidationResult;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.useWorkflowValidation = useWorkflowValidation;
11
- const react_1 = require("react");
12
- const validation_1 = require("../utils/validation");
13
- function useWorkflowValidation(workflow) {
14
- return (0, react_1.useMemo)(() => {
15
- return (0, validation_1.validateWorkflow)(workflow);
16
- }, [workflow]);
17
- }
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export { CampaignDashboard } from './components/CampaignDashboard';
2
- export { CampaignBuilder } from './components/CampaignBuilder';
3
- export { CampaignList } from './components/CampaignList';
4
- export { useCampaignStore } from './hooks/useCampaignStore';
5
- export { useCampaignMetrics, useEmailMetrics } from './hooks/useCampaignMetrics';
6
- export { useWorkflowValidation } from './hooks/useWorkflowValidation';
7
- export * from './types';
8
- export * from './api/campaigns';
9
- export * from './utils/validation';
10
- export * from './utils/formatting';
11
- export * from './utils/workflow-helpers';
12
- export { getConfig, setConfig, resetConfig } from './config';
13
- export type { CampaignUIConfig } from './config';
14
- export { EmailCampaignManagementError, type EmailCampaignManagementErrorCode, type EmailCampaignManagementErrorOptions } from './errors';
package/dist/index.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.EmailCampaignManagementError = exports.resetConfig = exports.setConfig = exports.getConfig = exports.useWorkflowValidation = exports.useEmailMetrics = exports.useCampaignMetrics = exports.useCampaignStore = exports.CampaignList = exports.CampaignBuilder = exports.CampaignDashboard = void 0;
25
- // Components
26
- var CampaignDashboard_1 = require("./components/CampaignDashboard");
27
- Object.defineProperty(exports, "CampaignDashboard", { enumerable: true, get: function () { return CampaignDashboard_1.CampaignDashboard; } });
28
- var CampaignBuilder_1 = require("./components/CampaignBuilder");
29
- Object.defineProperty(exports, "CampaignBuilder", { enumerable: true, get: function () { return CampaignBuilder_1.CampaignBuilder; } });
30
- var CampaignList_1 = require("./components/CampaignList");
31
- Object.defineProperty(exports, "CampaignList", { enumerable: true, get: function () { return CampaignList_1.CampaignList; } });
32
- // Hooks
33
- var useCampaignStore_1 = require("./hooks/useCampaignStore");
34
- Object.defineProperty(exports, "useCampaignStore", { enumerable: true, get: function () { return useCampaignStore_1.useCampaignStore; } });
35
- var useCampaignMetrics_1 = require("./hooks/useCampaignMetrics");
36
- Object.defineProperty(exports, "useCampaignMetrics", { enumerable: true, get: function () { return useCampaignMetrics_1.useCampaignMetrics; } });
37
- Object.defineProperty(exports, "useEmailMetrics", { enumerable: true, get: function () { return useCampaignMetrics_1.useEmailMetrics; } });
38
- var useWorkflowValidation_1 = require("./hooks/useWorkflowValidation");
39
- Object.defineProperty(exports, "useWorkflowValidation", { enumerable: true, get: function () { return useWorkflowValidation_1.useWorkflowValidation; } });
40
- // Types
41
- __exportStar(require("./types"), exports);
42
- // API
43
- __exportStar(require("./api/campaigns"), exports);
44
- // Utils
45
- __exportStar(require("./utils/validation"), exports);
46
- __exportStar(require("./utils/formatting"), exports);
47
- __exportStar(require("./utils/workflow-helpers"), exports);
48
- // Config
49
- var config_1 = require("./config");
50
- Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } });
51
- Object.defineProperty(exports, "setConfig", { enumerable: true, get: function () { return config_1.setConfig; } });
52
- Object.defineProperty(exports, "resetConfig", { enumerable: true, get: function () { return config_1.resetConfig; } });
53
- var errors_1 = require("./errors");
54
- Object.defineProperty(exports, "EmailCampaignManagementError", { enumerable: true, get: function () { return errors_1.EmailCampaignManagementError; } });
@@ -1,15 +0,0 @@
1
- export interface ABTestConfig {
2
- enabled: boolean;
3
- variants: ABTestVariant[];
4
- winnerCriteria: WinnerCriteria;
5
- testDuration: number;
6
- winnerPercentage: number;
7
- }
8
- export type WinnerCriteria = 'open_rate' | 'click_rate' | 'conversion_rate';
9
- export interface ABTestVariant {
10
- id: string;
11
- name: string;
12
- percentage: number;
13
- templateId: string;
14
- subjectLine: string;
15
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,18 +0,0 @@
1
- export interface AudienceConfig {
2
- type: AudienceType;
3
- segmentId?: string;
4
- listId?: string;
5
- dynamicQuery?: DynamicQuery;
6
- estimatedSize?: number;
7
- }
8
- export type AudienceType = 'all' | 'segment' | 'list' | 'dynamic';
9
- export interface DynamicQuery {
10
- filters: AudienceFilter[];
11
- operator: 'AND' | 'OR';
12
- }
13
- export interface AudienceFilter {
14
- field: string;
15
- operator: FilterOperator;
16
- value: unknown;
17
- }
18
- export type FilterOperator = 'equals' | 'contains' | 'gt' | 'lt' | 'in' | 'not_in';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +0,0 @@
1
- import { CampaignWorkflow } from './workflow';
2
- import { AudienceConfig } from './audience';
3
- import { ScheduleConfig } from './schedule';
4
- import { ABTestConfig } from './abtest';
5
- export interface Campaign {
6
- id: string;
7
- name: string;
8
- description?: string;
9
- type: CampaignType;
10
- status: CampaignStatus;
11
- workflow: CampaignWorkflow;
12
- audience: AudienceConfig;
13
- schedule: ScheduleConfig;
14
- abTest?: ABTestConfig;
15
- createdAt: Date;
16
- updatedAt: Date;
17
- createdBy: string;
18
- }
19
- export type CampaignType = 'one-time' | 'drip' | 'welcome' | 'nurture' | 'automated';
20
- export type CampaignStatus = 'draft' | 'scheduled' | 'active' | 'paused' | 'completed';
21
- export interface CampaignResult<T = unknown> {
22
- success: boolean;
23
- data?: T;
24
- error?: CampaignError;
25
- }
26
- export interface CampaignError {
27
- code: string;
28
- message: string;
29
- details?: unknown;
30
- retryable?: boolean;
31
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export * from './campaign';
2
- export * from './workflow';
3
- export * from './audience';
4
- export * from './schedule';
5
- export * from './abtest';
6
- export * from './metrics';
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- __exportStar(require("./campaign"), exports);
25
- __exportStar(require("./workflow"), exports);
26
- __exportStar(require("./audience"), exports);
27
- __exportStar(require("./schedule"), exports);
28
- __exportStar(require("./abtest"), exports);
29
- __exportStar(require("./metrics"), exports);
@@ -1,27 +0,0 @@
1
- export interface CampaignMetrics {
2
- campaignId: string;
3
- sent: number;
4
- delivered: number;
5
- bounced: number;
6
- opened: number;
7
- clicked: number;
8
- converted: number;
9
- unsubscribed: number;
10
- openRate: number;
11
- clickRate: number;
12
- conversionRate: number;
13
- lastUpdated: Date;
14
- }
15
- export interface EmailMetrics {
16
- emailId: string;
17
- nodeId: string;
18
- sent: number;
19
- delivered: number;
20
- bounced: number;
21
- opened: number;
22
- clicked: number;
23
- converted: number;
24
- openRate: number;
25
- clickRate: number;
26
- conversionRate: number;
27
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- export interface ScheduleConfig {
2
- type: ScheduleType;
3
- scheduledAt?: Date;
4
- timezone?: string;
5
- triggerEvent?: string;
6
- recurringRule?: RecurringRule;
7
- }
8
- export type ScheduleType = 'immediate' | 'scheduled' | 'triggered';
9
- export interface RecurringRule {
10
- frequency: RecurringFrequency;
11
- interval: number;
12
- daysOfWeek?: number[];
13
- endDate?: Date;
14
- }
15
- export type RecurringFrequency = 'daily' | 'weekly' | 'monthly';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +0,0 @@
1
- export interface CampaignWorkflow {
2
- id: string;
3
- nodes: WorkflowNode[];
4
- edges: WorkflowEdge[];
5
- }
6
- export interface WorkflowNode {
7
- id: string;
8
- type: NodeType;
9
- data: WorkflowNodeData;
10
- position: Position;
11
- }
12
- export type NodeType = 'email' | 'delay' | 'condition' | 'split' | 'action';
13
- export interface WorkflowNodeData {
14
- templateId?: string;
15
- delayAmount?: number;
16
- delayUnit?: DelayUnit;
17
- condition?: ConditionalLogic;
18
- splitPercentages?: number[];
19
- }
20
- export type DelayUnit = 'minutes' | 'hours' | 'days' | 'weeks';
21
- export interface ConditionalLogic {
22
- field: string;
23
- operator: 'equals' | 'contains' | 'gt' | 'lt' | 'in' | 'not_in';
24
- value: unknown;
25
- }
26
- export interface WorkflowEdge {
27
- id: string;
28
- source: string;
29
- target: string;
30
- type?: EdgeType;
31
- label?: string;
32
- }
33
- export type EdgeType = 'default' | 'conditional';
34
- export interface Position {
35
- x: number;
36
- y: number;
37
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- export declare function formatPercentage(value: number, decimals?: number): string;
2
- export declare function formatNumber(value: number): string;
3
- export declare function formatDate(date: Date, formatString?: string): string;
4
- export declare function formatMetricRate(numerator: number, denominator: number): number;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.formatPercentage = formatPercentage;
11
- exports.formatNumber = formatNumber;
12
- exports.formatDate = formatDate;
13
- exports.formatMetricRate = formatMetricRate;
14
- const date_fns_1 = require("date-fns");
15
- function formatPercentage(value, decimals = 2) {
16
- return `${value.toFixed(decimals)}%`;
17
- }
18
- function formatNumber(value) {
19
- return value.toLocaleString();
20
- }
21
- function formatDate(date, formatString = 'PPpp') {
22
- return (0, date_fns_1.format)(date, formatString);
23
- }
24
- function formatMetricRate(numerator, denominator) {
25
- if (denominator === 0)
26
- return 0;
27
- return (numerator / denominator) * 100;
28
- }
@@ -1,8 +0,0 @@
1
- import { ABTestConfig, CampaignWorkflow } from '../types';
2
- export interface ValidationResult {
3
- valid: boolean;
4
- errors: string[];
5
- }
6
- export declare function validateWorkflow(workflow: CampaignWorkflow): ValidationResult;
7
- export declare function validateABTest(config: ABTestConfig): ValidationResult;
8
- export declare function validateCampaignName(name: string): ValidationResult;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.validateWorkflow = validateWorkflow;
11
- exports.validateABTest = validateABTest;
12
- exports.validateCampaignName = validateCampaignName;
13
- function validateWorkflow(workflow) {
14
- const errors = [];
15
- if (!workflow.nodes || workflow.nodes.length === 0) {
16
- errors.push('Workflow must have at least one node');
17
- }
18
- // Check for disconnected nodes
19
- const connectedNodeIds = new Set();
20
- workflow.edges.forEach(edge => {
21
- connectedNodeIds.add(edge.source);
22
- connectedNodeIds.add(edge.target);
23
- });
24
- const disconnectedNodes = workflow.nodes.filter(node => !connectedNodeIds.has(node.id) && workflow.nodes.length > 1);
25
- if (disconnectedNodes.length > 0) {
26
- errors.push(`Workflow has ${disconnectedNodes.length} disconnected node(s)`);
27
- }
28
- return {
29
- valid: errors.length === 0,
30
- errors
31
- };
32
- }
33
- function validateABTest(config) {
34
- const errors = [];
35
- if (!config.enabled) {
36
- return { valid: true, errors: [] };
37
- }
38
- if (!config.variants || config.variants.length < 2) {
39
- errors.push('A/B test must have at least 2 variants');
40
- }
41
- if (config.variants) {
42
- const totalPercentage = config.variants.reduce((sum, v) => sum + v.percentage, 0);
43
- if (Math.abs(totalPercentage - 100) > 0.01) {
44
- errors.push(`Variant percentages must sum to 100% (currently ${totalPercentage}%)`);
45
- }
46
- config.variants.forEach((variant, index) => {
47
- if (variant.percentage < 0 || variant.percentage > 100) {
48
- errors.push(`Variant ${index + 1} percentage must be between 0 and 100`);
49
- }
50
- if (!variant.templateId) {
51
- errors.push(`Variant ${index + 1} must have a template selected`);
52
- }
53
- if (!variant.subjectLine || variant.subjectLine.trim() === '') {
54
- errors.push(`Variant ${index + 1} must have a subject line`);
55
- }
56
- });
57
- }
58
- if (config.testDuration <= 0) {
59
- errors.push('Test duration must be greater than 0 hours');
60
- }
61
- if (config.winnerPercentage < 0 || config.winnerPercentage > 100) {
62
- errors.push('Winner percentage must be between 0 and 100');
63
- }
64
- return {
65
- valid: errors.length === 0,
66
- errors
67
- };
68
- }
69
- function validateCampaignName(name) {
70
- const errors = [];
71
- if (!name || name.trim() === '') {
72
- errors.push('Campaign name is required');
73
- }
74
- if (name && name.length > 100) {
75
- errors.push('Campaign name must be 100 characters or less');
76
- }
77
- return {
78
- valid: errors.length === 0,
79
- errors
80
- };
81
- }
@@ -1,12 +0,0 @@
1
- import { WorkflowNode, WorkflowEdge, CampaignWorkflow, NodeType } from '../types';
2
- export declare function generateNodeId(): string;
3
- export declare function generateEdgeId(): string;
4
- export declare function createNode(type: NodeType, position: {
5
- x: number;
6
- y: number;
7
- }): WorkflowNode;
8
- export declare function createEdge(source: string, target: string): WorkflowEdge;
9
- export declare function getDefaultWorkflow(): CampaignWorkflow;
10
- export declare function findNodeById(workflow: CampaignWorkflow, nodeId: string): WorkflowNode | undefined;
11
- export declare function removeNode(workflow: CampaignWorkflow, nodeId: string): CampaignWorkflow;
12
- export declare function updateNode(workflow: CampaignWorkflow, nodeId: string, updates: Partial<WorkflowNode>): CampaignWorkflow;