payload-plugin-newsletter 0.8.6 → 0.9.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.
- package/CHANGELOG.md +52 -1
- package/CLAUDE.md +13 -2
- package/README.md +86 -0
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/components.cjs +777 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +28 -2
- package/dist/components.d.ts +28 -2
- package/dist/components.js +764 -0
- package/dist/components.js.map +1 -1
- package/dist/fields.cjs +80 -0
- package/dist/fields.cjs.map +1 -0
- package/dist/fields.d.cts +13 -0
- package/dist/fields.d.ts +13 -0
- package/dist/fields.js +65 -0
- package/dist/fields.js.map +1 -0
- package/dist/index.cjs +2228 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2246 -17
- package/dist/index.js.map +1 -1
- package/dist/types.cjs +271 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +622 -9
- package/dist/types.d.ts +622 -9
- package/dist/types.js +255 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +337 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +43 -0
- package/dist/utils.d.ts +43 -0
- package/dist/utils.js +298 -0
- package/dist/utils.js.map +1 -0
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
## [0.
|
|
1
|
+
## [0.9.0] - 2025-07-04
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
- **Email Preview System**: Comprehensive email preview functionality for newsletters
|
|
5
|
+
- Real-time preview with desktop and mobile viewport modes
|
|
6
|
+
- Live validation of email HTML compatibility
|
|
7
|
+
- Test email functionality to preview in actual email clients
|
|
8
|
+
- Split-view editor with side-by-side content and preview
|
|
9
|
+
|
|
10
|
+
- **Email-Safe Rich Text Editor**: Pre-configured Lexical editor for email content
|
|
11
|
+
- Limited to features that work reliably across email clients
|
|
12
|
+
- Supports: bold, italic, underline, strikethrough, links, lists, headings (h1-h3), alignment, blockquotes
|
|
13
|
+
- Excludes: tables, images, videos, JavaScript-dependent features, custom fonts
|
|
14
|
+
|
|
15
|
+
- **Email HTML Utilities**:
|
|
16
|
+
- `convertToEmailSafeHtml()`: Converts Lexical editor state to email-compatible HTML with inline styles
|
|
17
|
+
- `validateEmailHtml()`: Validates HTML for email client compatibility
|
|
18
|
+
- `EMAIL_SAFE_CONFIG`: DOMPurify configuration for email sanitization
|
|
19
|
+
- Full TypeScript support for all utilities
|
|
20
|
+
|
|
21
|
+
- **React Components**:
|
|
22
|
+
- `EmailPreview`: Standalone preview component with validation
|
|
23
|
+
- `EmailPreviewField`: Payload UI field component for forms
|
|
24
|
+
- `BroadcastEditor`: Split-view editor component
|
|
25
|
+
|
|
26
|
+
- **Validation Features**:
|
|
27
|
+
- Checks HTML size limits (Gmail's 102KB limit)
|
|
28
|
+
- Detects unsupported CSS properties (flexbox, grid, positioning)
|
|
29
|
+
- Warns about missing alt text for accessibility
|
|
30
|
+
- Identifies external resources that won't load
|
|
31
|
+
- Catches JavaScript that will be stripped by email clients
|
|
32
|
+
|
|
33
|
+
### Added Test Coverage
|
|
34
|
+
- Comprehensive unit tests for email-safe HTML conversion
|
|
35
|
+
- Validation utility tests with edge cases
|
|
36
|
+
- 100% coverage of critical email processing paths
|
|
37
|
+
|
|
38
|
+
### Documentation
|
|
39
|
+
- New guide: "Email Preview Guide" (`docs/guides/email-preview.md`)
|
|
40
|
+
- New API reference: "Email Utilities" (`docs/api-reference/email-utilities.md`)
|
|
41
|
+
- Updated main documentation with v0.9.0 features
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
- Added `isomorphic-dompurify@2.20.0` for secure HTML sanitization
|
|
45
|
+
|
|
46
|
+
## [0.8.7] - 2025-07-01
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
- Fixed TypeScript errors with ExtendedPayloadRequest interface
|
|
50
|
+
- Added TypeScript checking to CI/CD pipeline to prevent publishing with type errors
|
|
51
|
+
|
|
52
|
+
## [0.8.6] - 2025-07-01
|
|
2
53
|
|
|
3
54
|
### Fixed
|
|
4
55
|
- **Critical**: Fixed all endpoint handlers for Payload v3 compatibility
|
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-
|
|
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
|
|
@@ -144,6 +144,17 @@ This project uses **Bun** as the preferred package manager and runtime.
|
|
|
144
144
|
4. Update documentation
|
|
145
145
|
5. Make progressive commits
|
|
146
146
|
|
|
147
|
+
### When Updating CHANGELOG.md
|
|
148
|
+
1. First check the current date with: `date +"%Y-%m-%d"`
|
|
149
|
+
2. Use the actual current date in changelog entries
|
|
150
|
+
3. Follow semantic versioning principles
|
|
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
|
+
|
|
147
158
|
### When Reviewing Reference Code
|
|
148
159
|
- Extract patterns, not implementations
|
|
149
160
|
- Generalize any specific logic
|
|
@@ -172,4 +183,4 @@ Before implementing any feature, ask:
|
|
|
172
183
|
1. Is this generic enough for any Payload project?
|
|
173
184
|
2. Are there any hardcoded values that should be configurable?
|
|
174
185
|
3. Does this follow Payload's established patterns?
|
|
175
|
-
4. Is this well-documented for users?
|
|
186
|
+
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>;
|