payload-plugin-newsletter 0.1.0 → 0.3.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/ANNOUNCEMENT.md +66 -0
- package/CHANGELOG.md +49 -1
- package/README.md +46 -15
- package/dist/.tsbuildinfo +1 -1
- package/dist/collections/NewsletterSettings.d.ts +4 -0
- package/dist/collections/NewsletterSettings.d.ts.map +1 -0
- package/dist/collections/Subscribers.d.ts.map +1 -1
- package/dist/endpoints/preferences.d.ts.map +1 -1
- package/dist/endpoints/subscribe.d.ts.map +1 -1
- package/dist/endpoints/unsubscribe.d.ts.map +1 -1
- package/dist/endpoints/verify-magic-link.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/src/collections/NewsletterSettings.js +389 -0
- package/dist/src/collections/NewsletterSettings.js.map +1 -0
- package/dist/src/collections/Subscribers.js.map +1 -1
- package/dist/src/components/MagicLinkVerify.js +1 -1
- package/dist/src/components/MagicLinkVerify.js.map +1 -1
- package/dist/src/endpoints/preferences.js +16 -4
- package/dist/src/endpoints/preferences.js.map +1 -1
- package/dist/src/endpoints/subscribe.js +14 -3
- package/dist/src/endpoints/subscribe.js.map +1 -1
- package/dist/src/endpoints/unsubscribe.js +10 -2
- package/dist/src/endpoints/unsubscribe.js.map +1 -1
- package/dist/src/endpoints/verify-magic-link.js +13 -3
- package/dist/src/endpoints/verify-magic-link.js.map +1 -1
- package/dist/src/index.js +18 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/templates/NewsletterTemplate.js.map +1 -1
- package/dist/src/templates/WelcomeTemplate.js.map +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/templates/NewsletterTemplate.d.ts.map +1 -1
- package/dist/templates/WelcomeTemplate.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +9 -28
- package/CLAUDE.md +0 -110
- package/dist/globals/EmailSettings.d.ts +0 -4
- package/dist/globals/EmailSettings.d.ts.map +0 -1
- package/dist/src/globals/EmailSettings.js +0 -252
- package/dist/src/globals/EmailSettings.js.map +0 -1
package/ANNOUNCEMENT.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 🎉 Payload Newsletter Plugin v0.1.0 Released!
|
|
2
|
+
|
|
3
|
+
We're excited to announce the first release of the Payload Newsletter Plugin - a complete newsletter management solution for Payload CMS!
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
The plugin is now available on npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install payload-plugin-newsletter
|
|
11
|
+
# or
|
|
12
|
+
bun add payload-plugin-newsletter
|
|
13
|
+
# or
|
|
14
|
+
yarn add payload-plugin-newsletter
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## ✨ Key Features
|
|
18
|
+
|
|
19
|
+
- **📧 Complete Subscriber Management** - Ready-to-use subscriber collection with all essential fields
|
|
20
|
+
- **🔐 Magic Link Authentication** - Passwordless authentication for subscribers (separate from Payload auth)
|
|
21
|
+
- **📨 Email Service Integration** - Built-in support for Resend and Broadcast
|
|
22
|
+
- **📅 Newsletter Scheduling** - Schedule newsletters from your articles collection
|
|
23
|
+
- **⚛️ React Components** - Pre-built signup forms and preference management UI
|
|
24
|
+
- **🌍 Internationalization** - Multi-language support built-in
|
|
25
|
+
- **📊 Analytics Ready** - UTM tracking and signup metadata collection
|
|
26
|
+
|
|
27
|
+
## 🚀 Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { buildConfig } from 'payload/config'
|
|
31
|
+
import { newsletterPlugin } from 'payload-plugin-newsletter'
|
|
32
|
+
|
|
33
|
+
export default buildConfig({
|
|
34
|
+
plugins: [
|
|
35
|
+
newsletterPlugin({
|
|
36
|
+
providers: {
|
|
37
|
+
default: 'resend',
|
|
38
|
+
resend: {
|
|
39
|
+
apiKey: process.env.RESEND_API_KEY,
|
|
40
|
+
fromAddress: 'hello@yoursite.com',
|
|
41
|
+
fromName: 'Your Newsletter',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 📚 Resources
|
|
50
|
+
|
|
51
|
+
- **npm**: https://www.npmjs.com/package/payload-plugin-newsletter
|
|
52
|
+
- **GitHub**: https://github.com/aniketpanjwani/payload-plugin-email-newsletter
|
|
53
|
+
- **Documentation**: [README.md](https://github.com/aniketpanjwani/payload-plugin-email-newsletter#readme)
|
|
54
|
+
- **Issues**: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/issues
|
|
55
|
+
|
|
56
|
+
## 🤝 Contributing
|
|
57
|
+
|
|
58
|
+
We welcome contributions! Check out our [FEEDBACK.md](https://github.com/aniketpanjwani/payload-plugin-email-newsletter/blob/main/FEEDBACK.md) for areas where we'd love community input.
|
|
59
|
+
|
|
60
|
+
## 🙏 Acknowledgments
|
|
61
|
+
|
|
62
|
+
Special thanks to the Payload CMS team for creating such an extensible platform!
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
Made with ❤️ by [Aniket Panjwani](https://github.com/aniketpanjwani)
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0] - 2025-06-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Comprehensive security improvements to respect Payload access control
|
|
12
|
+
- Synthetic user pattern for subscriber self-service operations
|
|
13
|
+
- Admin verification for newsletter settings modifications
|
|
14
|
+
- Security documentation in README
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- All API endpoints now properly implement `overrideAccess` and `user` parameters
|
|
18
|
+
- Preferences endpoint now ensures subscribers can only access their own data
|
|
19
|
+
- Unsubscribe endpoint validates ownership through tokens
|
|
20
|
+
- Magic link verification uses synthetic users for updates
|
|
21
|
+
- Newsletter settings modifications now require admin authentication
|
|
22
|
+
|
|
23
|
+
### Security
|
|
24
|
+
- Implemented proper access control for all Payload Local API operations
|
|
25
|
+
- Added user context validation for authenticated endpoints
|
|
26
|
+
- Restricted settings access to admin users only
|
|
27
|
+
- Enhanced protection against unauthorized data access
|
|
28
|
+
|
|
29
|
+
## [0.2.0] - 2025-06-15
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- **BREAKING**: Changed newsletter settings from a global to a collection
|
|
33
|
+
- Allows multiple configurations (e.g., dev/staging/prod)
|
|
34
|
+
- Only one configuration can be active at a time
|
|
35
|
+
- Migrate existing settings by creating a new configuration in the collection
|
|
36
|
+
- Updated README to clarify the settings collection usage
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- Support for multiple email configurations
|
|
40
|
+
- Automatic deactivation of other configs when activating one
|
|
41
|
+
- Configuration name field for better organization
|
|
42
|
+
|
|
43
|
+
## [0.1.1] - 2025-06-15
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Updated README to reflect npm availability
|
|
47
|
+
- Fixed package.json warnings for npm publishing
|
|
48
|
+
|
|
8
49
|
## [0.1.0] - 2025-06-15
|
|
9
50
|
|
|
10
51
|
### Added
|
|
@@ -32,4 +73,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
32
73
|
- Domain restriction options
|
|
33
74
|
- Input validation and sanitization
|
|
34
75
|
|
|
35
|
-
[0.
|
|
76
|
+
[0.3.0]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.3.0
|
|
77
|
+
[0.2.0]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.2.0
|
|
78
|
+
[0.1.1]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.1.1
|
|
79
|
+
[0.1.0]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.1.0
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
**npm**: https://www.npmjs.com/package/payload-plugin-newsletter
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Payload Newsletter Plugin
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/payload-plugin-newsletter)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
3
6
|
A complete newsletter management plugin for Payload CMS that provides subscriber management, magic link authentication, and email service integration out of the box.
|
|
4
7
|
|
|
5
8
|
## Features
|
|
@@ -17,23 +20,14 @@ A complete newsletter management plugin for Payload CMS that provides subscriber
|
|
|
17
20
|
|
|
18
21
|
### 1. Install the plugin
|
|
19
22
|
|
|
20
|
-
**Note: This plugin is not yet published to npm. Install directly from GitHub:**
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
bun add github:aniketpanjwani/payload-plugin-email-newsletter
|
|
24
|
-
# or
|
|
25
|
-
npm install github:aniketpanjwani/payload-plugin-email-newsletter
|
|
26
|
-
# or
|
|
27
|
-
yarn add github:aniketpanjwani/payload-plugin-email-newsletter
|
|
28
|
-
# or
|
|
29
|
-
pnpm add github:aniketpanjwani/payload-plugin-email-newsletter
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Once published to npm, you'll be able to install with:
|
|
33
23
|
```bash
|
|
34
24
|
bun add payload-plugin-newsletter
|
|
35
25
|
# or
|
|
36
26
|
npm install payload-plugin-newsletter
|
|
27
|
+
# or
|
|
28
|
+
yarn add payload-plugin-newsletter
|
|
29
|
+
# or
|
|
30
|
+
pnpm add payload-plugin-newsletter
|
|
37
31
|
```
|
|
38
32
|
|
|
39
33
|
### 2. Add to your Payload config
|
|
@@ -70,7 +64,7 @@ export default buildConfig({
|
|
|
70
64
|
|
|
71
65
|
The plugin automatically adds:
|
|
72
66
|
- A `subscribers` collection to manage your subscribers
|
|
73
|
-
- A `newsletter-settings`
|
|
67
|
+
- A `newsletter-settings` collection for email configurations (supports multiple environments)
|
|
74
68
|
- API endpoints for subscription and authentication
|
|
75
69
|
- Newsletter scheduling fields to your articles (optional)
|
|
76
70
|
|
|
@@ -117,12 +111,32 @@ Subscribers can be managed through the Payload admin panel at `/admin/collection
|
|
|
117
111
|
|
|
118
112
|
### Email Settings
|
|
119
113
|
|
|
120
|
-
After setup, configure email settings at `/admin/
|
|
114
|
+
After setup, configure email settings at `/admin/collections/newsletter-settings` in your admin panel. You can:
|
|
115
|
+
- Create multiple configurations (e.g., for different environments or purposes)
|
|
116
|
+
- Set one configuration as active at a time
|
|
121
117
|
- Switch between email providers
|
|
122
118
|
- Update API keys and settings
|
|
123
119
|
- Customize email templates
|
|
124
120
|
- Set subscription preferences
|
|
125
121
|
|
|
122
|
+
**Note**: Only one configuration can be active at a time. The plugin will use the active configuration for sending emails.
|
|
123
|
+
|
|
124
|
+
## Initial Setup
|
|
125
|
+
|
|
126
|
+
After installing the plugin, you'll need to:
|
|
127
|
+
|
|
128
|
+
1. **Create an email configuration**:
|
|
129
|
+
- Go to `/admin/collections/newsletter-settings`
|
|
130
|
+
- Click "Create New"
|
|
131
|
+
- Give it a name (e.g., "Production" or "Development")
|
|
132
|
+
- Configure your email provider settings
|
|
133
|
+
- Set it as "Active"
|
|
134
|
+
- Save
|
|
135
|
+
|
|
136
|
+
2. **Start collecting subscribers**:
|
|
137
|
+
- Subscribers will appear in `/admin/collections/subscribers`
|
|
138
|
+
- Use the provided React components or API endpoints
|
|
139
|
+
|
|
126
140
|
## Configuration Options
|
|
127
141
|
|
|
128
142
|
### Minimal Configuration
|
|
@@ -400,6 +414,23 @@ newsletterPlugin({
|
|
|
400
414
|
- Check the email provider's dashboard for errors
|
|
401
415
|
- Ensure from address is verified with your provider
|
|
402
416
|
|
|
417
|
+
## Security
|
|
418
|
+
|
|
419
|
+
### Access Control
|
|
420
|
+
|
|
421
|
+
Starting from v0.3.0, the plugin implements proper access control for all operations:
|
|
422
|
+
|
|
423
|
+
- **Subscriber data**: Users can only access and modify their own data via magic link authentication
|
|
424
|
+
- **Newsletter settings**: Only admin users can modify email provider settings and configurations
|
|
425
|
+
- **API endpoints**: All endpoints respect Payload's access control rules
|
|
426
|
+
|
|
427
|
+
### Best Practices
|
|
428
|
+
|
|
429
|
+
- Always use environment variables for sensitive data (API keys, JWT secrets)
|
|
430
|
+
- Enable double opt-in for GDPR compliance
|
|
431
|
+
- Configure allowed domains to prevent spam subscriptions
|
|
432
|
+
- Set reasonable rate limits for subscriptions per IP
|
|
433
|
+
|
|
403
434
|
## Migration Guide
|
|
404
435
|
|
|
405
436
|
Coming from another newsletter system? The plugin stores subscribers in a standard Payload collection, making it easy to import existing data:
|