payload-plugin-newsletter 0.8.7 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,58 @@
1
+ ## [0.9.1] - 2025-07-04
2
+
3
+ ### Fixed
4
+ - Resolved all ESLint errors in the codebase
5
+ - Fixed unused variable errors by prefixing with underscore convention
6
+ - Removed unused imports (BroadcastStatus from SendBroadcastModal)
7
+ - Fixed unused catch block parameters
8
+ - All 22 ESLint errors resolved, only warnings remain
9
+ - Improved code quality for better maintainability
10
+
11
+ ## [0.9.0] - 2025-07-04
12
+
13
+ ### Added
14
+ - **Email Preview System**: Comprehensive email preview functionality for newsletters
15
+ - Real-time preview with desktop and mobile viewport modes
16
+ - Live validation of email HTML compatibility
17
+ - Test email functionality to preview in actual email clients
18
+ - Split-view editor with side-by-side content and preview
19
+
20
+ - **Email-Safe Rich Text Editor**: Pre-configured Lexical editor for email content
21
+ - Limited to features that work reliably across email clients
22
+ - Supports: bold, italic, underline, strikethrough, links, lists, headings (h1-h3), alignment, blockquotes
23
+ - Excludes: tables, images, videos, JavaScript-dependent features, custom fonts
24
+
25
+ - **Email HTML Utilities**:
26
+ - `convertToEmailSafeHtml()`: Converts Lexical editor state to email-compatible HTML with inline styles
27
+ - `validateEmailHtml()`: Validates HTML for email client compatibility
28
+ - `EMAIL_SAFE_CONFIG`: DOMPurify configuration for email sanitization
29
+ - Full TypeScript support for all utilities
30
+
31
+ - **React Components**:
32
+ - `EmailPreview`: Standalone preview component with validation
33
+ - `EmailPreviewField`: Payload UI field component for forms
34
+ - `BroadcastEditor`: Split-view editor component
35
+
36
+ - **Validation Features**:
37
+ - Checks HTML size limits (Gmail's 102KB limit)
38
+ - Detects unsupported CSS properties (flexbox, grid, positioning)
39
+ - Warns about missing alt text for accessibility
40
+ - Identifies external resources that won't load
41
+ - Catches JavaScript that will be stripped by email clients
42
+
43
+ ### Added Test Coverage
44
+ - Comprehensive unit tests for email-safe HTML conversion
45
+ - Validation utility tests with edge cases
46
+ - 100% coverage of critical email processing paths
47
+
48
+ ### Documentation
49
+ - New guide: "Email Preview Guide" (`docs/guides/email-preview.md`)
50
+ - New API reference: "Email Utilities" (`docs/api-reference/email-utilities.md`)
51
+ - Updated main documentation with v0.9.0 features
52
+
53
+ ### Dependencies
54
+ - Added `isomorphic-dompurify@2.20.0` for secure HTML sanitization
55
+
1
56
  ## [0.8.7] - 2025-07-01
2
57
 
3
58
  ### Fixed
package/CLAUDE.md CHANGED
@@ -72,7 +72,7 @@ Use these resources for understanding patterns and best practices:
72
72
 
73
73
  1. **Plugin Documentation**:
74
74
  - Check `docs/` directory for comprehensive plugin documentation
75
- - `docs/references/broadcast-api-docs.md` - Complete Broadcast API reference (sendbroadcast.net)
75
+ - `docs/references/broadcast-docs-compiled.md` - Complete Broadcast API reference (sendbroadcast.net)
76
76
  - `docs/guides/email-providers.md` - Email provider setup and comparison
77
77
  - `docs/development/context7-setup.md` - How to set up context7 MCP for current docs
78
78
  - `docs/architecture/` - Plugin architecture and design decisions
@@ -149,6 +149,12 @@ This project uses **Bun** as the preferred package manager and runtime.
149
149
  2. Use the actual current date in changelog entries
150
150
  3. Follow semantic versioning principles
151
151
 
152
+ ### When Updating tracking.md or Any Progress Tracking
153
+ 1. Always check the current date first with: `date +"%Y-%m-%d"`
154
+ 2. Use the actual current date for "Started" and "Completed" columns
155
+ 3. Never use placeholder dates or guess dates
156
+ 4. Format dates as YYYY-MM-DD for consistency
157
+
152
158
  ### When Reviewing Reference Code
153
159
  - Extract patterns, not implementations
154
160
  - Generalize any specific logic
@@ -171,10 +177,28 @@ JWT_SECRET=your_jwt_secret_here
171
177
  3. Push regularly to: https://github.com/aniketpanjwani/payload-plugin-email-newsletter
172
178
  4. Keep sensitive information in gitignored directories
173
179
 
180
+ ### Release Process
181
+
182
+ **IMPORTANT**: Do NOT create git tags manually when releasing new versions!
183
+
184
+ The release process is fully automated via GitHub Actions:
185
+ 1. Update the version in `package.json` (e.g., `0.9.0` → `0.9.1`)
186
+ 2. Update `CHANGELOG.md` with the changes for the new version
187
+ 3. Commit and push these changes to main
188
+ 4. GitHub Actions will automatically:
189
+ - Detect the new version
190
+ - Run tests and type checking
191
+ - Build the project
192
+ - Create the git tag (e.g., `v0.9.1`)
193
+ - Publish to npm
194
+ - Create a GitHub release
195
+
196
+ If you manually create tags, the workflow will fail because it tries to create the same tag. Let the automation handle all tag creation and publishing.
197
+
174
198
  ## Questions to Always Consider
175
199
 
176
200
  Before implementing any feature, ask:
177
201
  1. Is this generic enough for any Payload project?
178
202
  2. Are there any hardcoded values that should be configurable?
179
203
  3. Does this follow Payload's established patterns?
180
- 4. Is this well-documented for users?
204
+ 4. Is this well-documented for users?
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  A complete newsletter management plugin for [Payload CMS](https://github.com/payloadcms/payload) that provides subscriber management, magic link authentication, and email service integration out of the box.
7
7
 
8
+ > **Important**: Version 0.8.7+ includes critical fixes for Payload v3 compatibility. If you're using Payload v3, please ensure you're on at least version 0.8.7 of this plugin.
9
+
8
10
  ## Features
9
11
 
10
12
  - 📧 **Complete Subscriber Management** - Ready-to-use subscriber collection with all essential fields
@@ -16,6 +18,9 @@ A complete newsletter management plugin for [Payload CMS](https://github.com/pay
16
18
  - 📊 **Analytics Ready** - UTM tracking and signup metadata collection
17
19
  - ⚙️ **Admin UI Configuration** - Manage email settings through Payload admin panel
18
20
  - 🔄 **Bidirectional Sync** - Sync unsubscribes from email services back to Payload
21
+ - 👁️ **Email Preview** - Real-time preview with desktop/mobile views (v0.9.0+)
22
+ - ✅ **Email Validation** - Built-in validation for email client compatibility (v0.9.0+)
23
+ - 📝 **Email-Safe Editor** - Rich text editor limited to email-compatible features (v0.9.0+)
19
24
 
20
25
  ## Quick Start
21
26
 
@@ -138,6 +143,87 @@ After installing the plugin, you'll need to:
138
143
  - Subscribers will appear in `/admin/collections/subscribers`
139
144
  - Use the provided React components or API endpoints
140
145
 
146
+ ## Email Preview Features (v0.9.0+)
147
+
148
+ The plugin includes comprehensive email preview functionality to ensure your newsletters look great across all email clients.
149
+
150
+ ### Email-Safe Rich Text Editor
151
+
152
+ The plugin provides a pre-configured Lexical editor with only email-compatible features:
153
+
154
+ ```typescript
155
+ import { createEmailContentField } from 'payload-plugin-newsletter/fields'
156
+
157
+ const BroadcastsCollection = {
158
+ fields: [
159
+ createEmailContentField({
160
+ name: 'content',
161
+ required: true,
162
+ })
163
+ ]
164
+ }
165
+ ```
166
+
167
+ Features included:
168
+ - Basic text formatting (bold, italic, underline, strikethrough)
169
+ - Simple links
170
+ - Ordered and unordered lists
171
+ - Headings (H1, H2, H3)
172
+ - Text alignment
173
+ - Blockquotes
174
+
175
+ ### Real-Time Email Preview
176
+
177
+ The plugin includes a preview component that shows how your email will look:
178
+
179
+ ```typescript
180
+ {
181
+ name: 'preview',
182
+ type: 'ui',
183
+ admin: {
184
+ components: {
185
+ Field: 'payload-plugin-newsletter/components/EmailPreviewField'
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ Preview features:
192
+ - **Desktop & Mobile Views** - Switch between viewport sizes
193
+ - **Live Updates** - See changes as you type
194
+ - **Validation Warnings** - Catch compatibility issues before sending
195
+ - **Test Email** - Send a test to your inbox
196
+
197
+ ### Email HTML Validation
198
+
199
+ Built-in validation checks for:
200
+ - HTML size limits (Gmail's 102KB limit)
201
+ - Unsupported CSS properties
202
+ - Missing alt text on images
203
+ - External resources that won't load
204
+ - JavaScript that will be stripped
205
+
206
+ ### Utilities
207
+
208
+ Convert Lexical content to email-safe HTML:
209
+
210
+ ```typescript
211
+ import { convertToEmailSafeHtml } from 'payload-plugin-newsletter/utils'
212
+
213
+ const html = await convertToEmailSafeHtml(editorState)
214
+ ```
215
+
216
+ Validate any HTML for email compatibility:
217
+
218
+ ```typescript
219
+ import { validateEmailHtml } from 'payload-plugin-newsletter/utils'
220
+
221
+ const result = validateEmailHtml(html)
222
+ if (!result.valid) {
223
+ console.error('Email issues:', result.errors)
224
+ }
225
+ ```
226
+
141
227
  ## Configuration Options
142
228
 
143
229
  ### Minimal Configuration
package/dist/client.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { SignupFormProps, PreferencesFormProps, Subscriber } from './types.cjs';
2
1
  import React from 'react';
2
+ import { SignupFormProps, PreferencesFormProps, Subscriber } from './types.cjs';
3
3
  import 'payload';
4
4
 
5
5
  declare const NewsletterForm: React.FC<SignupFormProps>;
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { SignupFormProps, PreferencesFormProps, Subscriber } from './types.js';
2
1
  import React from 'react';
2
+ import { SignupFormProps, PreferencesFormProps, Subscriber } from './types.js';
3
3
  import 'payload';
4
4
 
5
5
  declare const NewsletterForm: React.FC<SignupFormProps>;