payload-plugin-newsletter 0.25.3 → 0.25.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [0.25.5] - 2025-08-18
2
+
3
+ ### Fixed
4
+ - Fixed "document not found" error when creating broadcasts by removing unnecessary update call during creation
5
+ - The afterChange hook now properly returns the modified document instead of trying to update it
6
+ - Added debug logging to help diagnose provider sync issues
7
+ - Ensures smooth broadcast creation without transaction conflicts
8
+
9
+ ## [0.25.4] - 2025-08-18
10
+
11
+ ### Fixed
12
+ - Fixed External ID not being populated when creating broadcasts, preventing webhook updates from syncing
13
+ - Both `providerId` and `externalId` are now set when creating broadcasts in the provider
14
+ - Webhooks can now properly find and update broadcasts by External ID
15
+ - Ensures full bidirectional sync between Payload CMS and Broadcast software
16
+
1
17
  ## [0.25.3] - 2025-08-16
2
18
 
3
19
  ### Added
@@ -2294,6 +2294,12 @@ var createBroadcastsCollection = (pluginConfig) => {
2294
2294
  if (!hasProviders) return doc;
2295
2295
  if (operation === "create") {
2296
2296
  try {
2297
+ req.payload.logger.info("Broadcast afterChange create hook - doc info:", {
2298
+ docId: doc.id,
2299
+ docIdType: typeof doc.id,
2300
+ hasDoc: !!doc,
2301
+ operation
2302
+ });
2297
2303
  const providerConfig = await getBroadcastConfig(req, pluginConfig);
2298
2304
  if (!providerConfig || !providerConfig.token) {
2299
2305
  req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
@@ -2329,19 +2335,18 @@ var createBroadcastsCollection = (pluginConfig) => {
2329
2335
  hasActualContent: !!doc.contentSection?.content
2330
2336
  });
2331
2337
  const providerBroadcast = await provider.create(createData);
2332
- await req.payload.update({
2333
- collection: "broadcasts",
2334
- id: doc.id,
2335
- data: {
2336
- providerId: providerBroadcast.id,
2337
- providerData: providerBroadcast.providerData
2338
- },
2339
- req
2338
+ req.payload.logger.info("Provider broadcast created:", {
2339
+ providerBroadcastId: providerBroadcast.id,
2340
+ providerBroadcastIdType: typeof providerBroadcast.id,
2341
+ docId: doc.id,
2342
+ docIdType: typeof doc.id
2340
2343
  });
2341
2344
  req.payload.logger.info(`Broadcast ${doc.id} created in provider with ID ${providerBroadcast.id}`);
2342
2345
  return {
2343
2346
  ...doc,
2344
2347
  providerId: providerBroadcast.id,
2348
+ externalId: providerBroadcast.id,
2349
+ // Include externalId in return value
2345
2350
  providerData: providerBroadcast.providerData
2346
2351
  };
2347
2352
  } catch (error) {