payload-plugin-newsletter 0.9.2 → 0.10.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 CHANGED
@@ -1,3 +1,46 @@
1
+ ## [0.10.0] - 2025-07-20
2
+
3
+ ### Changed
4
+ - **BREAKING**: Simplified plugin architecture to single-channel design
5
+ - Removed Channels collection entirely
6
+ - Each Payload instance now connects to a single Broadcast channel
7
+ - Channel is determined by the API token (Broadcast tokens are channel-specific)
8
+ - Removed `channelId` field from Broadcast type
9
+ - Removed channel management methods from providers
10
+ - Updated newsletter management configuration
11
+ - Removed `collections.channels` from plugin config
12
+ - Broadcasts no longer have channel relationships
13
+ - All broadcasts use the global provider configuration
14
+ - Improved provider capabilities
15
+ - Set `supportsMultipleChannels` to `false` for all providers
16
+ - Removed channel-specific error codes (`CHANNEL_NOT_FOUND`, `INVALID_CHANNEL`)
17
+
18
+ ### Added
19
+ - Comprehensive documentation for single-channel architecture (`docs/guides/single-channel-broadcast.md`)
20
+ - Clear migration path from multi-channel to single-channel design
21
+
22
+ ### Removed
23
+ - Channels collection (`src/collections/Channels.ts`)
24
+ - Channel utility functions (`src/providers/utils/getChannelProvider.ts`)
25
+ - Channel type definitions (`src/types/channel.ts`)
26
+ - Channel imports and references throughout the codebase
27
+
28
+ ## [0.9.3] - 2025-07-20
29
+
30
+ ### Changed
31
+ - Simplified Broadcast provider configuration to use a single token instead of separate development/production tokens
32
+ - Changed `tokens: { production, development }` to `token` field
33
+ - Users should now manage different tokens via environment variables
34
+ - Improved settings configuration hierarchy
35
+ - Settings from Payload admin UI now properly override config defaults
36
+ - Added support for configuring `fromAddress`, `fromName`, and `replyTo` in admin UI
37
+ - Enhanced reply-to email handling
38
+ - Broadcast provider now supports fallback chain: request → settings → from address
39
+ - Added `replyTo` field support to match Broadcast API capabilities
40
+
41
+ ### Fixed
42
+ - Fixed Broadcast provider tests to match new single token configuration
43
+
1
44
  ## [0.9.2] - 2025-07-20
2
45
 
3
46
  ### Fixed
package/README.md CHANGED
@@ -587,17 +587,18 @@ providers: {
587
587
  providers: {
588
588
  default: 'broadcast',
589
589
  broadcast: {
590
- apiUrl: 'https://broadcast.yoursite.com',
591
- tokens: {
592
- production: process.env.BROADCAST_TOKEN,
593
- development: process.env.BROADCAST_DEV_TOKEN,
594
- },
590
+ apiUrl: process.env.BROADCAST_API_URL,
591
+ token: process.env.BROADCAST_TOKEN,
592
+ // Optional: These can be set here as defaults or configured in the admin UI
595
593
  fromAddress: 'hello@yoursite.com',
596
594
  fromName: 'Your Newsletter',
595
+ replyTo: 'replies@yoursite.com',
597
596
  },
598
597
  }
599
598
  ```
600
599
 
600
+ **Note**: Settings configured in the Payload admin UI take precedence over these config values. The config values serve as defaults when settings haven't been configured yet.
601
+
601
602
  ## TypeScript
602
603
 
603
604
  The plugin is fully typed. Import types as needed:
@@ -1210,7 +1210,6 @@ var EmailPreview = ({
1210
1210
  content,
1211
1211
  subject,
1212
1212
  preheader,
1213
- channel,
1214
1213
  mode = "desktop",
1215
1214
  onValidation
1216
1215
  }) => {
@@ -1233,7 +1232,7 @@ var EmailPreview = ({
1233
1232
  const personalizedHtml = replacePersonalizationTags(emailHtml, SAMPLE_DATA);
1234
1233
  const previewHtml = addEmailHeader(personalizedHtml, {
1235
1234
  subject,
1236
- from: channel ? `${channel.fromName} <${channel.fromEmail}>` : "Newsletter <noreply@example.com>",
1235
+ from: "Newsletter <noreply@example.com>",
1237
1236
  to: SAMPLE_DATA["subscriber.email"]
1238
1237
  });
1239
1238
  setHtml(previewHtml);
@@ -1248,7 +1247,7 @@ var EmailPreview = ({
1248
1247
  }
1249
1248
  };
1250
1249
  convertContent();
1251
- }, [content, subject, preheader, channel, onValidation]);
1250
+ }, [content, subject, preheader, onValidation]);
1252
1251
  (0, import_react5.useEffect)(() => {
1253
1252
  if (iframeRef.current && html) {
1254
1253
  const doc = iframeRef.current.contentDocument;
@@ -1485,7 +1484,6 @@ var EmailPreviewField = () => {
1485
1484
  content: fields.content?.value || null,
1486
1485
  subject: fields.subject?.value || "Email Subject",
1487
1486
  preheader: fields.preheader?.value,
1488
- channel: fields.channel?.value,
1489
1487
  mode: previewMode,
1490
1488
  onValidation: handleValidation
1491
1489
  }
@@ -1505,8 +1503,7 @@ var BroadcastEditor = (props) => {
1505
1503
  const [validationSummary, setValidationSummary] = (0, import_react7.useState)("");
1506
1504
  const fields = (0, import_ui2.useFormFields)(([fields2]) => ({
1507
1505
  subject: fields2.subject,
1508
- preheader: fields2.preheader,
1509
- channel: fields2.channel
1506
+ preheader: fields2.preheader
1510
1507
  }));
1511
1508
  const handleValidation = (0, import_react7.useCallback)((result) => {
1512
1509
  setIsValid(result.valid);
@@ -1644,7 +1641,6 @@ var BroadcastEditor = (props) => {
1644
1641
  content: value,
1645
1642
  subject: fields.subject?.value || "Email Subject",
1646
1643
  preheader: fields.preheader?.value,
1647
- channel: fields.channel?.value,
1648
1644
  mode: previewMode,
1649
1645
  onValidation: handleValidation
1650
1646
  }