@bernierllc/email 1.0.0 → 1.1.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 (64) hide show
  1. package/README.md +76 -217
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +28 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/simple-email-service.d.ts +58 -0
  7. package/dist/simple-email-service.d.ts.map +1 -0
  8. package/dist/simple-email-service.js +416 -0
  9. package/dist/simple-email-service.js.map +1 -0
  10. package/dist/types.d.ts +311 -0
  11. package/dist/types.d.ts.map +1 -0
  12. package/dist/types.js +33 -0
  13. package/dist/types.js.map +1 -0
  14. package/package.json +53 -22
  15. package/.eslintrc.json +0 -112
  16. package/.flake8 +0 -18
  17. package/.github/workflows/ci.yml +0 -300
  18. package/EXTRACTION_SUMMARY.md +0 -265
  19. package/IMPLEMENTATION_STATUS.md +0 -159
  20. package/OPEN_SOURCE_SETUP.md +0 -420
  21. package/PACKAGE_USAGE.md +0 -471
  22. package/examples/fastapi-example/main.py +0 -257
  23. package/examples/nextjs-example/next-env.d.ts +0 -13
  24. package/examples/nextjs-example/package.json +0 -26
  25. package/examples/nextjs-example/pages/admin/templates.tsx +0 -157
  26. package/examples/nextjs-example/tsconfig.json +0 -28
  27. package/packages/core/package.json +0 -70
  28. package/packages/core/rollup.config.js +0 -37
  29. package/packages/core/specification.md +0 -416
  30. package/packages/core/src/adapters/supabase.ts +0 -291
  31. package/packages/core/src/core/scheduler.ts +0 -356
  32. package/packages/core/src/core/template-manager.ts +0 -388
  33. package/packages/core/src/index.ts +0 -30
  34. package/packages/core/src/providers/base.ts +0 -104
  35. package/packages/core/src/providers/sendgrid.ts +0 -368
  36. package/packages/core/src/types/provider.ts +0 -91
  37. package/packages/core/src/types/scheduled.ts +0 -78
  38. package/packages/core/src/types/template.ts +0 -97
  39. package/packages/core/tsconfig.json +0 -23
  40. package/packages/python/README.md +0 -106
  41. package/packages/python/email_template_manager/__init__.py +0 -66
  42. package/packages/python/email_template_manager/config.py +0 -98
  43. package/packages/python/email_template_manager/core/magic_links.py +0 -245
  44. package/packages/python/email_template_manager/core/manager.py +0 -344
  45. package/packages/python/email_template_manager/core/scheduler.py +0 -473
  46. package/packages/python/email_template_manager/exceptions.py +0 -67
  47. package/packages/python/email_template_manager/models/magic_link.py +0 -59
  48. package/packages/python/email_template_manager/models/scheduled.py +0 -78
  49. package/packages/python/email_template_manager/models/template.py +0 -90
  50. package/packages/python/email_template_manager/providers/aws_ses.py +0 -44
  51. package/packages/python/email_template_manager/providers/base.py +0 -94
  52. package/packages/python/email_template_manager/providers/sendgrid.py +0 -325
  53. package/packages/python/email_template_manager/providers/smtp.py +0 -44
  54. package/packages/python/pyproject.toml +0 -133
  55. package/packages/python/setup.py +0 -93
  56. package/packages/python/specification.md +0 -930
  57. package/packages/react/README.md +0 -13
  58. package/packages/react/package.json +0 -105
  59. package/packages/react/rollup.config.js +0 -37
  60. package/packages/react/specification.md +0 -569
  61. package/packages/react/src/index.ts +0 -20
  62. package/packages/react/tsconfig.json +0 -24
  63. package/src/index.js +0 -1
  64. package/test_package.py +0 -125
@@ -1,13 +0,0 @@
1
- ## Monorepo Workspaces & Dependency Management
2
-
3
- This package is part of a monorepo using npm workspaces. All dependencies are hoisted to the root. Always run `npm install` from the root directory.
4
-
5
- ## React 19 and Testing Library Compatibility
6
-
7
- This package uses React 19.1.0. If you see peer dependency warnings with Testing Library, use:
8
-
9
- ```bash
10
- npm install --legacy-peer-deps
11
- ```
12
-
13
- This is a temporary workaround until official support is released.
@@ -1,105 +0,0 @@
1
- {
2
- "name": "@email-template-manager/react",
3
- "version": "1.0.0",
4
- "description": "React components for email template management",
5
- "main": "dist/index.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist",
10
- "README.md"
11
- ],
12
- "scripts": {
13
- "build": "rollup -c",
14
- "build:watch": "rollup -c -w",
15
- "test": "jest",
16
- "test:watch": "jest --watch",
17
- "test:coverage": "jest --coverage",
18
- "lint": "eslint src --ext .ts,.tsx",
19
- "lint:fix": "eslint src --ext .ts,.tsx --fix",
20
- "type-check": "tsc --noEmit",
21
- "clean": "rimraf dist",
22
- "dev": "npm run build:watch",
23
- "prepublishOnly": "npm run clean && npm run build",
24
- "storybook": "storybook dev -p 6006",
25
- "build-storybook": "storybook build"
26
- },
27
- "keywords": [
28
- "react",
29
- "email",
30
- "templates",
31
- "components",
32
- "ui",
33
- "typescript"
34
- ],
35
- "author": "Matt Bernier <matt@example.com>",
36
- "license": "MIT",
37
- "repository": {
38
- "type": "git",
39
- "url": "https://github.com/mattbernier/email-template-manager.git",
40
- "directory": "packages/react"
41
- },
42
- "homepage": "https://github.com/mattbernier/email-template-manager#readme",
43
- "bugs": {
44
- "url": "https://github.com/mattbernier/email-template-manager/issues"
45
- },
46
- "dependencies": {
47
- "@email-template-manager/core": "^1.0.0",
48
- "@radix-ui/react-dialog": "^1.0.5",
49
- "@radix-ui/react-dropdown-menu": "^2.0.6",
50
- "@radix-ui/react-label": "^2.0.2",
51
- "@radix-ui/react-select": "^2.0.0",
52
- "@radix-ui/react-slot": "^1.0.2",
53
- "@radix-ui/react-tabs": "^1.0.4",
54
- "@radix-ui/react-toast": "^1.1.5",
55
- "class-variance-authority": "^0.7.0",
56
- "clsx": "^2.0.0",
57
- "lucide-react": "^0.294.0",
58
- "react-hook-form": "^7.48.2",
59
- "tailwind-merge": "^2.0.0"
60
- },
61
- "devDependencies": {
62
- "@rollup/plugin-commonjs": "^25.0.7",
63
- "@rollup/plugin-node-resolve": "^15.2.3",
64
- "@rollup/plugin-typescript": "^11.1.5",
65
- "@storybook/addon-essentials": "^7.5.3",
66
- "@storybook/addon-interactions": "^7.5.3",
67
- "@storybook/addon-links": "^7.5.3",
68
- "@storybook/addon-onboarding": "^1.0.8",
69
- "@storybook/blocks": "^7.5.3",
70
- "@storybook/react": "^7.5.3",
71
- "@storybook/react-vite": "^7.5.3",
72
- "@storybook/testing-library": "^0.2.2",
73
- "@testing-library/jest-dom": "^6.1.4",
74
- "@testing-library/react": "^14.1.2",
75
- "@testing-library/user-event": "^14.5.1",
76
- "@types/jest": "^29.5.8",
77
- "@types/react": "^19.0.0",
78
- "@types/react-dom": "^19.0.0",
79
- "@typescript-eslint/eslint-plugin": "^6.11.0",
80
- "@typescript-eslint/parser": "^6.11.0",
81
- "eslint": "^8.54.0",
82
- "eslint-plugin-react": "^7.33.2",
83
- "eslint-plugin-react-hooks": "^4.6.0",
84
- "jest": "^29.7.0",
85
- "jest-environment-jsdom": "^29.7.0",
86
- "postcss": "^8.4.31",
87
- "rimraf": "^5.0.5",
88
- "rollup": "^4.5.0",
89
- "rollup-plugin-postcss": "^4.0.2",
90
- "storybook": "^7.5.3",
91
- "tailwindcss": "^3.3.6",
92
- "ts-jest": "^29.1.1",
93
- "typescript": "^5.2.2"
94
- },
95
- "peerDependencies": {
96
- "react": "^19.1.0",
97
- "react-dom": "^19.1.0"
98
- },
99
- "engines": {
100
- "node": ">=16.0.0"
101
- },
102
- "publishConfig": {
103
- "access": "public"
104
- }
105
- }
@@ -1,37 +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 resolve from '@rollup/plugin-node-resolve';
10
- import commonjs from '@rollup/plugin-commonjs';
11
- import typescript from '@rollup/plugin-typescript';
12
-
13
- export default {
14
- input: 'src/index.ts',
15
- output: [
16
- {
17
- file: 'dist/index.js',
18
- format: 'cjs',
19
- sourcemap: true,
20
- },
21
- {
22
- file: 'dist/index.esm.js',
23
- format: 'esm',
24
- sourcemap: true,
25
- },
26
- ],
27
- external: ['react', 'react-dom', '@email-template-manager/core'],
28
- plugins: [
29
- resolve(),
30
- commonjs(),
31
- typescript({
32
- tsconfig: './tsconfig.json',
33
- declaration: true,
34
- declarationDir: './dist',
35
- }),
36
- ],
37
- };
@@ -1,569 +0,0 @@
1
- # @email-template-manager/react - React Components Specification
2
-
3
- ## Overview
4
-
5
- A comprehensive React component library for email template management, providing ready-to-use UI components that integrate with the core library. Built with TypeScript, Tailwind CSS, and modern React patterns.
6
-
7
- ## Component Architecture
8
-
9
- ### Core Components
10
-
11
- #### EmailTemplateEditor
12
-
13
- ```typescript
14
- interface EmailTemplateEditorProps {
15
- template?: EmailTemplate;
16
- onSave: (template: EmailTemplate) => Promise<void>;
17
- onCancel: () => void;
18
- variables?: TemplateVariable[];
19
- previewData?: Record<string, any>;
20
- readOnly?: boolean;
21
- className?: string;
22
- }
23
-
24
- const EmailTemplateEditor: React.FC<EmailTemplateEditorProps>;
25
- ```
26
-
27
- **Features:**
28
-
29
- - Rich HTML editor with WYSIWYG capabilities
30
- - Side-by-side HTML/preview layout
31
- - Variable insertion UI with autocomplete
32
- - Liquid template syntax highlighting
33
- - Real-time preview with test data
34
- - Validation feedback
35
- - Mobile-responsive design
36
-
37
- #### TemplateVariableManager
38
-
39
- ```typescript
40
- interface TemplateVariableManagerProps {
41
- variables: TemplateVariable[];
42
- onChange: (variables: TemplateVariable[]) => void;
43
- availableTypes: string[];
44
- readOnly?: boolean;
45
- className?: string;
46
- }
47
-
48
- const TemplateVariableManager: React.FC<TemplateVariableManagerProps>;
49
- ```
50
-
51
- **Features:**
52
-
53
- - Add/remove/edit template variables
54
- - Variable type selection with validation
55
- - Default value configuration
56
- - Required field toggles
57
- - Drag-and-drop reordering
58
-
59
- #### EmailTemplateList
60
-
61
- ```typescript
62
- interface EmailTemplateListProps {
63
- templates: EmailTemplate[];
64
- onSelect: (template: EmailTemplate) => void;
65
- onEdit: (template: EmailTemplate) => void;
66
- onDelete: (templateId: string) => Promise<void>;
67
- onDuplicate: (template: EmailTemplate) => Promise<void>;
68
- searchQuery?: string;
69
- onSearchChange: (query: string) => void;
70
- filters?: TemplateFilters;
71
- onFiltersChange: (filters: TemplateFilters) => void;
72
- loading?: boolean;
73
- className?: string;
74
- }
75
-
76
- const EmailTemplateList: React.FC<EmailTemplateListProps>;
77
- ```
78
-
79
- **Features:**
80
-
81
- - Sortable table with template details
82
- - Search and filtering capabilities
83
- - Bulk actions (delete, export)
84
- - Template status indicators
85
- - Pagination support
86
- - Empty state handling
87
-
88
- #### ScheduledEmailsManager
89
-
90
- ```typescript
91
- interface ScheduledEmailsManagerProps {
92
- scheduledEmails: ScheduledEmail[];
93
- onPause: (emailId: string) => Promise<void>;
94
- onResume: (emailId: string) => Promise<void>;
95
- onCancel: (emailId: string) => Promise<void>;
96
- onRetry: (emailId: string) => Promise<void>;
97
- onRefresh: () => Promise<void>;
98
- filters?: SchedulingFilters;
99
- onFiltersChange: (filters: SchedulingFilters) => void;
100
- className?: string;
101
- }
102
-
103
- const ScheduledEmailsManager: React.FC<ScheduledEmailsManagerProps>;
104
- ```
105
-
106
- **Features:**
107
-
108
- - Email queue visualization
109
- - Status filtering and search
110
- - Bulk pause/resume/cancel actions
111
- - Retry failed emails
112
- - Real-time status updates
113
- - Timeline view option
114
-
115
- ### Form Components
116
-
117
- #### EmailTemplateForm
118
-
119
- ```typescript
120
- interface EmailTemplateFormProps {
121
- initialValues?: Partial<EmailTemplate>;
122
- onSubmit: (values: EmailTemplate) => Promise<void>;
123
- onCancel: () => void;
124
- validationSchema?: any;
125
- children?: React.ReactNode;
126
- className?: string;
127
- }
128
-
129
- const EmailTemplateForm: React.FC<EmailTemplateFormProps>;
130
- ```
131
-
132
- #### ScheduleEmailForm
133
-
134
- ```typescript
135
- interface ScheduleEmailFormProps {
136
- templates: EmailTemplate[];
137
- initialValues?: Partial<ScheduledEmail>;
138
- onSubmit: (values: ScheduledEmail) => Promise<void>;
139
- onCancel: () => void;
140
- className?: string;
141
- }
142
-
143
- const ScheduleEmailForm: React.FC<ScheduleEmailFormProps>;
144
- ```
145
-
146
- #### MagicLinkForm
147
-
148
- ```typescript
149
- interface MagicLinkFormProps {
150
- onGenerate: (
151
- email: string,
152
- type: string,
153
- payload: Record<string, any>
154
- ) => Promise<MagicLink>;
155
- linkTypes: Array<{ value: string; label: string }>;
156
- className?: string;
157
- }
158
-
159
- const MagicLinkForm: React.FC<MagicLinkFormProps>;
160
- ```
161
-
162
- ### UI Components (Based on shadcn/ui)
163
-
164
- #### Button Variants
165
-
166
- ```typescript
167
- interface ButtonProps {
168
- variant: "primary" | "secondary" | "danger" | "ghost" | "outline";
169
- size: "sm" | "md" | "lg";
170
- loading?: boolean;
171
- disabled?: boolean;
172
- children: React.ReactNode;
173
- className?: string;
174
- onClick?: () => void;
175
- }
176
-
177
- const Button: React.FC<ButtonProps>;
178
- ```
179
-
180
- #### StatusBadge
181
-
182
- ```typescript
183
- interface StatusBadgeProps {
184
- status:
185
- | "pending"
186
- | "sent"
187
- | "failed"
188
- | "cancelled"
189
- | "paused"
190
- | "active"
191
- | "inactive";
192
- size?: "sm" | "md" | "lg";
193
- showIcon?: boolean;
194
- className?: string;
195
- }
196
-
197
- const StatusBadge: React.FC<StatusBadgeProps>;
198
- ```
199
-
200
- #### DataTable
201
-
202
- ```typescript
203
- interface DataTableProps<T> {
204
- data: T[];
205
- columns: Column<T>[];
206
- pagination?: PaginationOptions;
207
- sorting?: SortingOptions;
208
- selection?: SelectionOptions;
209
- loading?: boolean;
210
- emptyMessage?: string;
211
- className?: string;
212
- }
213
-
214
- const DataTable: React.FC<DataTableProps<T>>;
215
- ```
216
-
217
- #### Modal Components
218
-
219
- ```typescript
220
- const ConfirmDialog: React.FC<{
221
- open: boolean;
222
- title: string;
223
- message: string;
224
- confirmText?: string;
225
- cancelText?: string;
226
- onConfirm: () => void;
227
- onCancel: () => void;
228
- variant?: "danger" | "warning" | "info";
229
- }>;
230
-
231
- const Dialog: React.FC<{
232
- open: boolean;
233
- onClose: () => void;
234
- title: string;
235
- children: React.ReactNode;
236
- size?: "sm" | "md" | "lg" | "xl";
237
- }>;
238
- ```
239
-
240
- ### Specialized Components
241
-
242
- #### RichTextEditor
243
-
244
- ```typescript
245
- interface RichTextEditorProps {
246
- value: string;
247
- onChange: (value: string) => void;
248
- placeholder?: string;
249
- readOnly?: boolean;
250
- toolbar?: ToolbarConfig;
251
- variables?: TemplateVariable[];
252
- onInsertVariable?: (variable: string) => void;
253
- className?: string;
254
- }
255
-
256
- const RichTextEditor: React.FC<RichTextEditorProps>;
257
- ```
258
-
259
- **Features:**
260
-
261
- - Rich text editing with formatting toolbar
262
- - Variable insertion with autocomplete
263
- - HTML source code view
264
- - Undo/redo functionality
265
- - Custom toolbar configuration
266
-
267
- #### EmailPreview
268
-
269
- ```typescript
270
- interface EmailPreviewProps {
271
- template: EmailTemplate;
272
- variables: Record<string, any>;
273
- mode: "html" | "text" | "both";
274
- onModeChange: (mode: "html" | "text" | "both") => void;
275
- className?: string;
276
- }
277
-
278
- const EmailPreview: React.FC<EmailPreviewProps>;
279
- ```
280
-
281
- #### VariableInserter
282
-
283
- ```typescript
284
- interface VariableInserterProps {
285
- variables: TemplateVariable[];
286
- onInsert: (variable: string) => void;
287
- searchable?: boolean;
288
- grouped?: boolean;
289
- className?: string;
290
- }
291
-
292
- const VariableInserter: React.FC<VariableInserterProps>;
293
- ```
294
-
295
- ## Hooks
296
-
297
- ### Core Hooks
298
-
299
- #### useEmailTemplates
300
-
301
- ```typescript
302
- interface UseEmailTemplatesResult {
303
- templates: EmailTemplate[];
304
- loading: boolean;
305
- error: Error | null;
306
- createTemplate: (template: Partial<EmailTemplate>) => Promise<EmailTemplate>;
307
- updateTemplate: (
308
- id: string,
309
- updates: Partial<EmailTemplate>
310
- ) => Promise<EmailTemplate>;
311
- deleteTemplate: (id: string) => Promise<void>;
312
- duplicateTemplate: (id: string) => Promise<EmailTemplate>;
313
- refetch: () => Promise<void>;
314
- }
315
-
316
- function useEmailTemplates(filters?: TemplateFilters): UseEmailTemplatesResult;
317
- ```
318
-
319
- #### useScheduledEmails
320
-
321
- ```typescript
322
- interface UseScheduledEmailsResult {
323
- scheduledEmails: ScheduledEmail[];
324
- loading: boolean;
325
- error: Error | null;
326
- scheduleEmail: (email: Partial<ScheduledEmail>) => Promise<ScheduledEmail>;
327
- pauseEmail: (id: string) => Promise<void>;
328
- resumeEmail: (id: string) => Promise<void>;
329
- cancelEmail: (id: string) => Promise<void>;
330
- retryEmail: (id: string) => Promise<void>;
331
- refetch: () => Promise<void>;
332
- }
333
-
334
- function useScheduledEmails(
335
- filters?: SchedulingFilters
336
- ): UseScheduledEmailsResult;
337
- ```
338
-
339
- #### useMagicLinks
340
-
341
- ```typescript
342
- interface UseMagicLinksResult {
343
- generateLink: (
344
- email: string,
345
- type: string,
346
- payload: Record<string, any>
347
- ) => Promise<MagicLink>;
348
- validateLink: (token: string) => Promise<MagicLink | null>;
349
- revokeLink: (token: string) => Promise<void>;
350
- loading: boolean;
351
- error: Error | null;
352
- }
353
-
354
- function useMagicLinks(): UseMagicLinksResult;
355
- ```
356
-
357
- ### Utility Hooks
358
-
359
- #### useTemplateValidation
360
-
361
- ```typescript
362
- function useTemplateValidation(template: EmailTemplate): {
363
- isValid: boolean;
364
- errors: ValidationError[];
365
- warnings: ValidationWarning[];
366
- validateVariable: (name: string, value: any) => ValidationResult;
367
- };
368
- ```
369
-
370
- #### useEmailPreview
371
-
372
- ```typescript
373
- function useEmailPreview(
374
- template: EmailTemplate,
375
- variables: Record<string, any>
376
- ): {
377
- htmlPreview: string;
378
- textPreview: string;
379
- loading: boolean;
380
- error: Error | null;
381
- };
382
- ```
383
-
384
- #### useDebounce
385
-
386
- ```typescript
387
- function useDebounce<T>(value: T, delay: number): T;
388
- ```
389
-
390
- ## Context Providers
391
-
392
- ### EmailTemplateProvider
393
-
394
- ```typescript
395
- interface EmailTemplateContextValue {
396
- manager: EmailTemplateManager;
397
- scheduler: EmailScheduler;
398
- magicLinkManager: MagicLinkManager;
399
- config: EmailManagerConfig;
400
- }
401
-
402
- const EmailTemplateProvider: React.FC<{
403
- config: EmailManagerConfig;
404
- children: React.ReactNode;
405
- }>;
406
-
407
- function useEmailTemplateContext(): EmailTemplateContextValue;
408
- ```
409
-
410
- ### NotificationProvider
411
-
412
- ```typescript
413
- interface NotificationContextValue {
414
- showNotification: (
415
- message: string,
416
- type: "success" | "error" | "warning" | "info"
417
- ) => void;
418
- hideNotification: (id: string) => void;
419
- notifications: Notification[];
420
- }
421
-
422
- const NotificationProvider: React.FC<{ children: React.ReactNode }>;
423
- ```
424
-
425
- ## Styling and Theming
426
-
427
- ### Theme Configuration
428
-
429
- ```typescript
430
- interface EmailManagerTheme {
431
- colors: {
432
- primary: string;
433
- secondary: string;
434
- success: string;
435
- warning: string;
436
- error: string;
437
- info: string;
438
- background: string;
439
- surface: string;
440
- text: string;
441
- textMuted: string;
442
- };
443
- fonts: {
444
- body: string;
445
- heading: string;
446
- mono: string;
447
- };
448
- spacing: Record<string, string>;
449
- borderRadius: Record<string, string>;
450
- shadows: Record<string, string>;
451
- }
452
-
453
- const ThemeProvider: React.FC<{
454
- theme: EmailManagerTheme;
455
- children: React.ReactNode;
456
- }>;
457
- ```
458
-
459
- ### CSS Classes and Tailwind Integration
460
-
461
- ```css
462
- /* Base utility classes */
463
- .email-manager-container {
464
- /* ... */
465
- }
466
- .email-template-editor {
467
- /* ... */
468
- }
469
- .email-preview {
470
- /* ... */
471
- }
472
- .variable-inserter {
473
- /* ... */
474
- }
475
-
476
- /* Component-specific styles */
477
- .email-template-list {
478
- /* ... */
479
- }
480
- .scheduled-emails-table {
481
- /* ... */
482
- }
483
- .rich-text-editor {
484
- /* ... */
485
- }
486
- ```
487
-
488
- ## Integration Examples
489
-
490
- ### Basic Setup
491
-
492
- ```typescript
493
- import {
494
- EmailTemplateProvider,
495
- EmailTemplateList,
496
- EmailTemplateEditor,
497
- } from "@email-template-manager/react";
498
- import { EmailTemplateManager } from "@email-template-manager/core";
499
-
500
- function App() {
501
- const config = {
502
- // ... configuration
503
- };
504
-
505
- return (
506
- <EmailTemplateProvider config={config}>
507
- <div className="email-manager-app">
508
- <EmailTemplateList />
509
- <EmailTemplateEditor />
510
- </div>
511
- </EmailTemplateProvider>
512
- );
513
- }
514
- ```
515
-
516
- ### Custom Component
517
-
518
- ```typescript
519
- import {
520
- useEmailTemplates,
521
- Button,
522
- Dialog,
523
- } from "@email-template-manager/react";
524
-
525
- function CustomTemplateManager() {
526
- const { templates, createTemplate, loading } = useEmailTemplates();
527
-
528
- return (
529
- <div>
530
- {templates.map((template) => (
531
- <div key={template.id}>
532
- <h3>{template.name}</h3>
533
- <Button onClick={() => editTemplate(template)}>Edit Template</Button>
534
- </div>
535
- ))}
536
- </div>
537
- );
538
- }
539
- ```
540
-
541
- ## Testing Support
542
-
543
- ### Test Utilities
544
-
545
- ```typescript
546
- // Testing utilities and mock components
547
- export const MockEmailTemplateProvider: React.FC<{ children: React.ReactNode }>;
548
- export const mockEmailTemplate: (
549
- overrides?: Partial<EmailTemplate>
550
- ) => EmailTemplate;
551
- export const mockScheduledEmail: (
552
- overrides?: Partial<ScheduledEmail>
553
- ) => ScheduledEmail;
554
-
555
- // Component testing helpers
556
- export function renderWithEmailManager(
557
- component: React.ReactElement,
558
- options?: { config?: EmailManagerConfig }
559
- ): RenderResult;
560
- ```
561
-
562
- ## Bundle Size Optimization
563
-
564
- - Tree-shakable exports
565
- - Lazy loading for heavy components
566
- - Optional dependencies for different editors
567
- - Minimal core bundle with plugin architecture
568
-
569
- This React package provides a complete UI solution for email template management while maintaining flexibility and customization options for different use cases.