payload-plugin-newsletter 0.25.2 → 0.25.4
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 +17 -0
- package/dist/collections.cjs +48 -0
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +48 -0
- package/dist/collections.js.map +1 -1
- package/dist/server.js +48 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -4395,6 +4395,10 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
4395
4395
|
}
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
|
+
if (field.type === "richText" && node.fields[field.name]) {
|
|
4399
|
+
await populateRichTextUploads(node.fields[field.name], payload);
|
|
4400
|
+
payload.logger?.info(`Processed rich text field ${field.name} for upload nodes`);
|
|
4401
|
+
}
|
|
4398
4402
|
}
|
|
4399
4403
|
}
|
|
4400
4404
|
}
|
|
@@ -4404,6 +4408,46 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
4404
4408
|
}
|
|
4405
4409
|
}
|
|
4406
4410
|
}
|
|
4411
|
+
async function populateRichTextUploads(content, payload) {
|
|
4412
|
+
if (!content || typeof content !== "object") return;
|
|
4413
|
+
if (content.root?.children) {
|
|
4414
|
+
await processNodeArray(content.root.children);
|
|
4415
|
+
}
|
|
4416
|
+
if (Array.isArray(content)) {
|
|
4417
|
+
await processNodeArray(content);
|
|
4418
|
+
}
|
|
4419
|
+
async function processNodeArray(nodes) {
|
|
4420
|
+
await Promise.all(nodes.map(processNode));
|
|
4421
|
+
}
|
|
4422
|
+
async function processNode(node) {
|
|
4423
|
+
if (!node || typeof node !== "object") return;
|
|
4424
|
+
if (node.type === "upload" && node.relationTo === "media" && typeof node.value === "string" && node.value.match(/^[a-f0-9]{24}$/i)) {
|
|
4425
|
+
try {
|
|
4426
|
+
const media = await payload.findByID({
|
|
4427
|
+
collection: "media",
|
|
4428
|
+
id: node.value,
|
|
4429
|
+
depth: 0
|
|
4430
|
+
});
|
|
4431
|
+
if (media) {
|
|
4432
|
+
node.value = media;
|
|
4433
|
+
payload.logger?.info(`Populated rich text upload node:`, {
|
|
4434
|
+
mediaId: node.value,
|
|
4435
|
+
mediaUrl: media.url,
|
|
4436
|
+
filename: media.filename
|
|
4437
|
+
});
|
|
4438
|
+
}
|
|
4439
|
+
} catch (error) {
|
|
4440
|
+
payload.logger?.error(`Failed to populate rich text upload ${node.value}:`, error);
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
if (node.children && Array.isArray(node.children)) {
|
|
4444
|
+
await processNodeArray(node.children);
|
|
4445
|
+
}
|
|
4446
|
+
if (node.root?.children && Array.isArray(node.root.children)) {
|
|
4447
|
+
await processNodeArray(node.root.children);
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4407
4451
|
var createBroadcastPreviewEndpoint = (config, _collectionSlug) => {
|
|
4408
4452
|
return {
|
|
4409
4453
|
path: "/preview",
|
|
@@ -4834,6 +4878,8 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4834
4878
|
id: doc.id,
|
|
4835
4879
|
data: {
|
|
4836
4880
|
providerId: providerBroadcast.id,
|
|
4881
|
+
externalId: providerBroadcast.id,
|
|
4882
|
+
// Set externalId to match providerId for webhook lookup
|
|
4837
4883
|
providerData: providerBroadcast.providerData
|
|
4838
4884
|
},
|
|
4839
4885
|
req
|
|
@@ -4842,6 +4888,8 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4842
4888
|
return {
|
|
4843
4889
|
...doc,
|
|
4844
4890
|
providerId: providerBroadcast.id,
|
|
4891
|
+
externalId: providerBroadcast.id,
|
|
4892
|
+
// Include externalId in return value
|
|
4845
4893
|
providerData: providerBroadcast.providerData
|
|
4846
4894
|
};
|
|
4847
4895
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-plugin-newsletter",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.4",
|
|
4
4
|
"description": "Complete newsletter management plugin for Payload CMS with subscriber management, magic link authentication, and email service integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|