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/index.cjs
CHANGED
|
@@ -3188,6 +3188,9 @@ var EMAIL_SAFE_CONFIG = {
|
|
|
3188
3188
|
FORBID_ATTR: ["class", "id", "onclick", "onload", "onerror"]
|
|
3189
3189
|
};
|
|
3190
3190
|
async function convertToEmailSafeHtml(editorState, options) {
|
|
3191
|
+
if (!editorState) {
|
|
3192
|
+
return "";
|
|
3193
|
+
}
|
|
3191
3194
|
const rawHtml = await lexicalToEmailHtml(editorState, options?.mediaUrl);
|
|
3192
3195
|
const sanitizedHtml = import_isomorphic_dompurify2.default.sanitize(rawHtml, EMAIL_SAFE_CONFIG);
|
|
3193
3196
|
if (options?.wrapInTemplate) {
|
|
@@ -4394,6 +4397,10 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4394
4397
|
async ({ doc, operation, req, previousDoc }) => {
|
|
4395
4398
|
if (!hasProviders) return doc;
|
|
4396
4399
|
if (operation === "create") {
|
|
4400
|
+
if (!doc.subject || !doc.contentSection?.content) {
|
|
4401
|
+
req.payload.logger.info("Skipping provider sync - broadcast has no subject or content yet");
|
|
4402
|
+
return doc;
|
|
4403
|
+
}
|
|
4397
4404
|
try {
|
|
4398
4405
|
const providerConfig = await getBroadcastConfig(req, pluginConfig);
|
|
4399
4406
|
if (!providerConfig || !providerConfig.token) {
|
|
@@ -4404,6 +4411,10 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4404
4411
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4405
4412
|
req.payload.logger.info("Converting content to HTML...");
|
|
4406
4413
|
const htmlContent = await convertToEmailSafeHtml(doc.contentSection?.content);
|
|
4414
|
+
if (!htmlContent || htmlContent.trim() === "") {
|
|
4415
|
+
req.payload.logger.info("Skipping provider sync - content is empty after conversion");
|
|
4416
|
+
return doc;
|
|
4417
|
+
}
|
|
4407
4418
|
const createData = {
|
|
4408
4419
|
name: doc.subject,
|
|
4409
4420
|
// Use subject as name since we removed the name field
|