payload-plugin-newsletter 0.19.0 → 0.20.1
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 +55 -0
- package/README.md +97 -0
- package/dist/collections.cjs +11 -2
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +11 -2
- package/dist/collections.js.map +1 -1
- package/dist/components.cjs +148 -125
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +2 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +85 -62
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +35 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +23 -0
- package/dist/types.d.ts +23 -0
- package/dist/utils.cjs +6 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/ESM_FIX_SUMMARY.md +0 -74
package/dist/collections.js
CHANGED
|
@@ -963,6 +963,12 @@ async function convertToEmailSafeHtml(editorState, options) {
|
|
|
963
963
|
const rawHtml = await lexicalToEmailHtml(editorState, options?.mediaUrl, options?.customBlockConverter);
|
|
964
964
|
const sanitizedHtml = DOMPurify.sanitize(rawHtml, EMAIL_SAFE_CONFIG);
|
|
965
965
|
if (options?.wrapInTemplate) {
|
|
966
|
+
if (options.customWrapper) {
|
|
967
|
+
return await Promise.resolve(options.customWrapper(sanitizedHtml, {
|
|
968
|
+
preheader: options.preheader,
|
|
969
|
+
subject: options.subject
|
|
970
|
+
}));
|
|
971
|
+
}
|
|
966
972
|
return wrapInEmailTemplate(sanitizedHtml, options.preheader);
|
|
967
973
|
}
|
|
968
974
|
return sanitizedHtml;
|
|
@@ -1857,11 +1863,14 @@ var createBroadcastPreviewEndpoint = (config, _collectionSlug) => {
|
|
|
1857
1863
|
const mediaUrl = req.payload.config.serverURL ? `${req.payload.config.serverURL}/api/media` : "/api/media";
|
|
1858
1864
|
req.payload.logger?.info("Populating media fields for email preview...");
|
|
1859
1865
|
const populatedContent = await populateMediaFields(content, req.payload, config);
|
|
1866
|
+
const emailPreviewConfig = config.customizations?.broadcasts?.emailPreview;
|
|
1860
1867
|
const htmlContent = await convertToEmailSafeHtml(populatedContent, {
|
|
1861
|
-
wrapInTemplate: true,
|
|
1868
|
+
wrapInTemplate: emailPreviewConfig?.wrapInTemplate ?? true,
|
|
1862
1869
|
preheader,
|
|
1870
|
+
subject,
|
|
1863
1871
|
mediaUrl,
|
|
1864
|
-
customBlockConverter: config.customizations?.broadcasts?.customBlockConverter
|
|
1872
|
+
customBlockConverter: config.customizations?.broadcasts?.customBlockConverter,
|
|
1873
|
+
customWrapper: emailPreviewConfig?.customWrapper
|
|
1865
1874
|
});
|
|
1866
1875
|
return Response.json({
|
|
1867
1876
|
success: true,
|