payload-plugin-newsletter 0.3.2 → 0.4.5

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 (180) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/CLAUDE.md +31 -19
  3. package/dist/client.cjs +899 -0
  4. package/dist/client.cjs.map +1 -0
  5. package/dist/client.d.cts +52 -0
  6. package/dist/client.d.ts +52 -0
  7. package/dist/client.js +867 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/components.cjs +899 -0
  10. package/dist/components.cjs.map +1 -0
  11. package/dist/components.d.cts +4 -0
  12. package/dist/components.d.ts +4 -0
  13. package/dist/components.js +867 -0
  14. package/dist/components.js.map +1 -0
  15. package/dist/index.cjs +2004 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.cts +11 -0
  18. package/dist/index.d.ts +6 -5
  19. package/dist/index.js +1967 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/types.cjs +19 -0
  22. package/dist/types.cjs.map +1 -0
  23. package/dist/{types/index.d.ts → types.d.cts} +19 -17
  24. package/dist/types.d.ts +350 -0
  25. package/dist/types.js +1 -0
  26. package/dist/types.js.map +1 -0
  27. package/package.json +48 -25
  28. package/dist/.tsbuildinfo +0 -1
  29. package/dist/collections/NewsletterSettings.d.ts +0 -4
  30. package/dist/collections/NewsletterSettings.d.ts.map +0 -1
  31. package/dist/collections/Subscribers.d.ts +0 -4
  32. package/dist/collections/Subscribers.d.ts.map +0 -1
  33. package/dist/components/MagicLinkVerify.d.ts +0 -27
  34. package/dist/components/MagicLinkVerify.d.ts.map +0 -1
  35. package/dist/components/NewsletterForm.d.ts +0 -5
  36. package/dist/components/NewsletterForm.d.ts.map +0 -1
  37. package/dist/components/PreferencesForm.d.ts +0 -5
  38. package/dist/components/PreferencesForm.d.ts.map +0 -1
  39. package/dist/components/index.d.ts +0 -5
  40. package/dist/components/index.d.ts.map +0 -1
  41. package/dist/endpoints/index.d.ts +0 -4
  42. package/dist/endpoints/index.d.ts.map +0 -1
  43. package/dist/endpoints/preferences.d.ts +0 -5
  44. package/dist/endpoints/preferences.d.ts.map +0 -1
  45. package/dist/endpoints/subscribe.d.ts +0 -4
  46. package/dist/endpoints/subscribe.d.ts.map +0 -1
  47. package/dist/endpoints/unsubscribe.d.ts +0 -4
  48. package/dist/endpoints/unsubscribe.d.ts.map +0 -1
  49. package/dist/endpoints/verify-magic-link.d.ts +0 -4
  50. package/dist/endpoints/verify-magic-link.d.ts.map +0 -1
  51. package/dist/exports/client.d.ts +0 -6
  52. package/dist/exports/client.d.ts.map +0 -1
  53. package/dist/exports/components.d.ts +0 -2
  54. package/dist/exports/components.d.ts.map +0 -1
  55. package/dist/exports/types.d.ts +0 -2
  56. package/dist/exports/types.d.ts.map +0 -1
  57. package/dist/fields/newsletterScheduling.d.ts +0 -4
  58. package/dist/fields/newsletterScheduling.d.ts.map +0 -1
  59. package/dist/hooks/useNewsletterAuth.d.ts +0 -16
  60. package/dist/hooks/useNewsletterAuth.d.ts.map +0 -1
  61. package/dist/index.d.ts.map +0 -1
  62. package/dist/providers/broadcast.d.ts +0 -19
  63. package/dist/providers/broadcast.d.ts.map +0 -1
  64. package/dist/providers/index.d.ts +0 -23
  65. package/dist/providers/index.d.ts.map +0 -1
  66. package/dist/providers/resend.d.ts +0 -20
  67. package/dist/providers/resend.d.ts.map +0 -1
  68. package/dist/providers/types.d.ts +0 -46
  69. package/dist/providers/types.d.ts.map +0 -1
  70. package/dist/src/__tests__/fixtures/newsletter-settings.js +0 -41
  71. package/dist/src/__tests__/fixtures/newsletter-settings.js.map +0 -1
  72. package/dist/src/__tests__/fixtures/subscribers.js +0 -70
  73. package/dist/src/__tests__/fixtures/subscribers.js.map +0 -1
  74. package/dist/src/__tests__/integration/collections/subscriber-hooks.test.js +0 -356
  75. package/dist/src/__tests__/integration/collections/subscriber-hooks.test.js.map +0 -1
  76. package/dist/src/__tests__/integration/endpoints/preferences.test.js +0 -266
  77. package/dist/src/__tests__/integration/endpoints/preferences.test.js.map +0 -1
  78. package/dist/src/__tests__/integration/endpoints/subscribe.test.js +0 -280
  79. package/dist/src/__tests__/integration/endpoints/subscribe.test.js.map +0 -1
  80. package/dist/src/__tests__/integration/endpoints/unsubscribe.test.js +0 -187
  81. package/dist/src/__tests__/integration/endpoints/unsubscribe.test.js.map +0 -1
  82. package/dist/src/__tests__/integration/endpoints/verify-magic-link.test.js +0 -188
  83. package/dist/src/__tests__/integration/endpoints/verify-magic-link.test.js.map +0 -1
  84. package/dist/src/__tests__/mocks/email-providers.js +0 -153
  85. package/dist/src/__tests__/mocks/email-providers.js.map +0 -1
  86. package/dist/src/__tests__/mocks/payload.js +0 -244
  87. package/dist/src/__tests__/mocks/payload.js.map +0 -1
  88. package/dist/src/__tests__/security/csrf-protection.test.js +0 -309
  89. package/dist/src/__tests__/security/csrf-protection.test.js.map +0 -1
  90. package/dist/src/__tests__/security/settings-access.test.js +0 -204
  91. package/dist/src/__tests__/security/settings-access.test.js.map +0 -1
  92. package/dist/src/__tests__/security/subscriber-access.test.js +0 -210
  93. package/dist/src/__tests__/security/subscriber-access.test.js.map +0 -1
  94. package/dist/src/__tests__/security/xss-prevention.test.js +0 -305
  95. package/dist/src/__tests__/security/xss-prevention.test.js.map +0 -1
  96. package/dist/src/__tests__/setup/integration.setup.js +0 -38
  97. package/dist/src/__tests__/setup/integration.setup.js.map +0 -1
  98. package/dist/src/__tests__/setup/unit.setup.js +0 -41
  99. package/dist/src/__tests__/setup/unit.setup.js.map +0 -1
  100. package/dist/src/__tests__/unit/utils/access.test.js +0 -116
  101. package/dist/src/__tests__/unit/utils/access.test.js.map +0 -1
  102. package/dist/src/__tests__/unit/utils/jwt.test.js +0 -238
  103. package/dist/src/__tests__/unit/utils/jwt.test.js.map +0 -1
  104. package/dist/src/collections/NewsletterSettings.js +0 -390
  105. package/dist/src/collections/NewsletterSettings.js.map +0 -1
  106. package/dist/src/collections/Subscribers.js +0 -309
  107. package/dist/src/collections/Subscribers.js.map +0 -1
  108. package/dist/src/components/MagicLinkVerify.js +0 -180
  109. package/dist/src/components/MagicLinkVerify.js.map +0 -1
  110. package/dist/src/components/NewsletterForm.js +0 -326
  111. package/dist/src/components/NewsletterForm.js.map +0 -1
  112. package/dist/src/components/PreferencesForm.js +0 -524
  113. package/dist/src/components/PreferencesForm.js.map +0 -1
  114. package/dist/src/components/index.js +0 -5
  115. package/dist/src/components/index.js.map +0 -1
  116. package/dist/src/endpoints/index.js +0 -17
  117. package/dist/src/endpoints/index.js.map +0 -1
  118. package/dist/src/endpoints/preferences.js +0 -136
  119. package/dist/src/endpoints/preferences.js.map +0 -1
  120. package/dist/src/endpoints/subscribe.js +0 -151
  121. package/dist/src/endpoints/subscribe.js.map +0 -1
  122. package/dist/src/endpoints/unsubscribe.js +0 -105
  123. package/dist/src/endpoints/unsubscribe.js.map +0 -1
  124. package/dist/src/endpoints/verify-magic-link.js +0 -103
  125. package/dist/src/endpoints/verify-magic-link.js.map +0 -1
  126. package/dist/src/exports/client.js +0 -7
  127. package/dist/src/exports/client.js.map +0 -1
  128. package/dist/src/exports/components.js +0 -6
  129. package/dist/src/exports/components.js.map +0 -1
  130. package/dist/src/exports/types.js +0 -3
  131. package/dist/src/exports/types.js.map +0 -1
  132. package/dist/src/fields/newsletterScheduling.js +0 -195
  133. package/dist/src/fields/newsletterScheduling.js.map +0 -1
  134. package/dist/src/hooks/useNewsletterAuth.js +0 -112
  135. package/dist/src/hooks/useNewsletterAuth.js.map +0 -1
  136. package/dist/src/index.js +0 -130
  137. package/dist/src/index.js.map +0 -1
  138. package/dist/src/providers/broadcast.js +0 -158
  139. package/dist/src/providers/broadcast.js.map +0 -1
  140. package/dist/src/providers/index.js +0 -63
  141. package/dist/src/providers/index.js.map +0 -1
  142. package/dist/src/providers/resend.js +0 -122
  143. package/dist/src/providers/resend.js.map +0 -1
  144. package/dist/src/providers/types.js +0 -12
  145. package/dist/src/providers/types.js.map +0 -1
  146. package/dist/src/templates/BaseTemplate.js +0 -105
  147. package/dist/src/templates/BaseTemplate.js.map +0 -1
  148. package/dist/src/templates/MagicLinkTemplate.js +0 -178
  149. package/dist/src/templates/MagicLinkTemplate.js.map +0 -1
  150. package/dist/src/templates/NewsletterTemplate.js +0 -150
  151. package/dist/src/templates/NewsletterTemplate.js.map +0 -1
  152. package/dist/src/templates/WelcomeTemplate.js +0 -192
  153. package/dist/src/templates/WelcomeTemplate.js.map +0 -1
  154. package/dist/src/templates/index.js +0 -6
  155. package/dist/src/templates/index.js.map +0 -1
  156. package/dist/src/types/index.js +0 -3
  157. package/dist/src/types/index.js.map +0 -1
  158. package/dist/src/utils/access.js +0 -80
  159. package/dist/src/utils/access.js.map +0 -1
  160. package/dist/src/utils/jwt.js +0 -91
  161. package/dist/src/utils/jwt.js.map +0 -1
  162. package/dist/src/utils/validation.js +0 -74
  163. package/dist/src/utils/validation.js.map +0 -1
  164. package/dist/templates/BaseTemplate.d.ts +0 -45
  165. package/dist/templates/BaseTemplate.d.ts.map +0 -1
  166. package/dist/templates/MagicLinkTemplate.d.ts +0 -67
  167. package/dist/templates/MagicLinkTemplate.d.ts.map +0 -1
  168. package/dist/templates/NewsletterTemplate.d.ts +0 -112
  169. package/dist/templates/NewsletterTemplate.d.ts.map +0 -1
  170. package/dist/templates/WelcomeTemplate.d.ts +0 -55
  171. package/dist/templates/WelcomeTemplate.d.ts.map +0 -1
  172. package/dist/templates/index.d.ts +0 -7
  173. package/dist/templates/index.d.ts.map +0 -1
  174. package/dist/types/index.d.ts.map +0 -1
  175. package/dist/utils/access.d.ts +0 -15
  176. package/dist/utils/access.d.ts.map +0 -1
  177. package/dist/utils/jwt.d.ts +0 -32
  178. package/dist/utils/jwt.d.ts.map +0 -1
  179. package/dist/utils/validation.d.ts +0 -25
  180. package/dist/utils/validation.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,53 @@
1
- # Changelog
1
+ ## [0.4.5] - 2025-06-19
2
+
3
+ - fix: add tsup build system for proper ESM/CJS dual package support
4
+
2
5
 
3
6
  All notable changes to this project will be documented in this file.
4
7
 
5
8
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
9
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
10
 
11
+ ## [0.4.4] - 2025-06-16
12
+
13
+ ### Fixed
14
+ - Fixed all ESLint errors across the codebase (56 errors resolved)
15
+ - Fixed test failures by restoring mock data seeding
16
+ - Fixed import paths in test files
17
+ - Fixed unused variable and parameter warnings
18
+ - Fixed regex escape character issues
19
+
20
+ ### Added
21
+ - Added comprehensive CI/CD workflows for automatic testing and releases
22
+ - Added CI workflow that runs on every push to main and PRs
23
+ - Added auto-release workflow with smart version bumping based on commit messages
24
+ - Auto-release workflow now skips test-only and documentation-only changes
25
+
26
+ ### Changed
27
+ - Improved auto-release workflow to check for significant changes before releasing
28
+ - Test files now properly import and use mock data fixtures
29
+
30
+ ## [0.4.3] - 2025-06-16
31
+
32
+ ### Fixed
33
+ - Resolved all 76 failing tests by fixing test runner configuration
34
+ - Fixed duplicate test execution issue (tests were running from both src/ and dist/)
35
+ - Fixed React component test timeouts by applying Happy DOM timer patch
36
+ - Corrected newsletter settings access control to allow public read access
37
+ - Fixed subscribe endpoint to properly access nested subscriptionSettings fields
38
+ - Excluded test files from build output to prevent test code in production
39
+
40
+ ### Changed
41
+ - Switched from `bun test` to `bun run test` to properly use Vitest
42
+ - Updated build configuration to exclude test files from TypeScript and SWC compilation
43
+ - Added .npmignore file to ensure dist/ folder is included in npm package
44
+ - Skipped rate-limiting tests due to Vitest mocking incompatibilities
45
+
46
+ ### Developer Experience
47
+ - All 287 tests now pass (17 skipped)
48
+ - Cleaner npm package without test files
49
+ - Proper separation of source and distribution code
50
+
8
51
  ## [0.3.2] - 2025-06-16
9
52
 
10
53
  ### Security
package/CLAUDE.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This file contains development guidelines and reference information for Claude when working on the Payload Newsletter Plugin.
4
4
 
5
+ **Note**: This plugin is developed by Aniket Panjwani, who uses Broadcast (sendbroadcast.net) for newsletter management.
6
+
5
7
  ## Important Security Guidelines
6
8
 
7
9
  **NEVER include any of the following in the repository:**
@@ -11,25 +13,35 @@ This file contains development guidelines and reference information for Claude w
11
13
  - Production URLs or endpoints
12
14
  - Any credentials or sensitive configuration
13
15
 
14
- ## Reference Repositories
15
-
16
- These local repositories contain reference implementations and examples:
17
-
18
- 1. **Medellin Newsletter Implementation** (source for newsletter logic):
19
- - Location: `/Users/aniketpanjwani/Projects/medellin_newsletter/medellin_insider`
20
- - Use for: Understanding newsletter implementation patterns
21
- - DO NOT: Copy any specific business logic, API keys, or Medellin-specific references
22
-
23
- 2. **Payload CMS Source**:
24
- - Location: `/Users/aniketpanjwani/Projects/reference_repos/payload`
25
- - Docs: `/Users/aniketpanjwani/Projects/reference_repos/payload/docs`
26
- - Templates: `/Users/aniketpanjwani/Projects/reference_repos/payload/templates`
27
- - Use for: Understanding Payload patterns and best practices
28
-
29
- 3. **Official Payload Plugins** (examples to follow):
30
- - SEO Plugin: `/Users/aniketpanjwani/Projects/reference_repos/payload/packages/plugin-seo`
31
- - Form Builder: `/Users/aniketpanjwani/Projects/reference_repos/payload/packages/plugin-form-builder`
32
- - Use for: Plugin architecture patterns and conventions
16
+ ## Reference Documentation
17
+
18
+ Use these resources for understanding patterns and best practices:
19
+
20
+ 1. **Plugin Documentation**:
21
+ - Check `docs/` directory for comprehensive plugin documentation
22
+ - `docs/references/broadcast-api-docs.md` - Complete Broadcast API reference (sendbroadcast.net)
23
+ - `docs/guides/email-providers.md` - Email provider setup and comparison
24
+ - `docs/development/context7-setup.md` - How to set up context7 MCP for current docs
25
+ - `docs/architecture/` - Plugin architecture and design decisions
26
+
27
+ 2. **Context7 MCP Setup**:
28
+ - Install context7 MCP in your editor (see `docs/development/context7-setup.md`)
29
+ - Add "use context7" to prompts for up-to-date documentation
30
+ - Essential library IDs:
31
+ - `/payloadcms/payload` - Payload CMS docs
32
+ - `/resend/resend-node` - Resend API docs
33
+ - `/vercel/next.js` - Next.js docs
34
+ - `/microsoft/typescript` - TypeScript docs
35
+
36
+ 3. **Email Provider Information**:
37
+ - **Resend**: Managed service, easy setup, higher cost per email
38
+ - **Broadcast**: Self-hosted at sendbroadcast.net, cost-effective (license + VPS + SES), requires setup
39
+ - Follow provider-agnostic patterns in `src/types/index.ts`
40
+
41
+ 4. **Development Resources**:
42
+ - `docs/development/` - Contributing guidelines and setup
43
+ - `docs/api-reference/` - Complete API documentation
44
+ - `docs/getting-started/` - Quick start guides
33
45
 
34
46
  ## Development Setup
35
47