payload-plugin-newsletter 0.16.7 → 0.16.8
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 +15 -0
- package/dist/collections.cjs +11 -0
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +11 -0
- package/dist/collections.js.map +1 -1
- package/dist/components.cjs +3 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +3 -0
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +3 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/collections.js
CHANGED
|
@@ -947,6 +947,9 @@ var EMAIL_SAFE_CONFIG = {
|
|
|
947
947
|
FORBID_ATTR: ["class", "id", "onclick", "onload", "onerror"]
|
|
948
948
|
};
|
|
949
949
|
async function convertToEmailSafeHtml(editorState, options) {
|
|
950
|
+
if (!editorState) {
|
|
951
|
+
return "";
|
|
952
|
+
}
|
|
950
953
|
const rawHtml = await lexicalToEmailHtml(editorState, options?.mediaUrl);
|
|
951
954
|
const sanitizedHtml = DOMPurify.sanitize(rawHtml, EMAIL_SAFE_CONFIG);
|
|
952
955
|
if (options?.wrapInTemplate) {
|
|
@@ -1444,6 +1447,10 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
1444
1447
|
async ({ doc, operation, req, previousDoc }) => {
|
|
1445
1448
|
if (!hasProviders) return doc;
|
|
1446
1449
|
if (operation === "create") {
|
|
1450
|
+
if (!doc.subject || !doc.contentSection?.content) {
|
|
1451
|
+
req.payload.logger.info("Skipping provider sync - broadcast has no subject or content yet");
|
|
1452
|
+
return doc;
|
|
1453
|
+
}
|
|
1447
1454
|
try {
|
|
1448
1455
|
const providerConfig = await getBroadcastConfig(req, pluginConfig);
|
|
1449
1456
|
if (!providerConfig || !providerConfig.token) {
|
|
@@ -1454,6 +1461,10 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
1454
1461
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
1455
1462
|
req.payload.logger.info("Converting content to HTML...");
|
|
1456
1463
|
const htmlContent = await convertToEmailSafeHtml(doc.contentSection?.content);
|
|
1464
|
+
if (!htmlContent || htmlContent.trim() === "") {
|
|
1465
|
+
req.payload.logger.info("Skipping provider sync - content is empty after conversion");
|
|
1466
|
+
return doc;
|
|
1467
|
+
}
|
|
1457
1468
|
const createData = {
|
|
1458
1469
|
name: doc.subject,
|
|
1459
1470
|
// Use subject as name since we removed the name field
|