payload-plugin-newsletter 0.14.2 → 0.15.0
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 +33 -0
- package/README.md +45 -0
- package/dist/collections.cjs +1952 -0
- package/dist/collections.cjs.map +1 -0
- package/dist/collections.d.cts +8 -0
- package/dist/collections.d.ts +8 -0
- package/dist/collections.js +1956 -0
- package/dist/collections.js.map +1 -0
- package/dist/fields.cjs +330 -123
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +15 -4
- package/dist/fields.d.ts +15 -4
- package/dist/fields.js +317 -123
- package/dist/fields.js.map +1 -1
- package/dist/index.cjs +146 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +146 -128
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +15 -2
- package/dist/types.d.ts +15 -2
- package/package.json +11 -1
package/dist/index.js
CHANGED
|
@@ -1623,6 +1623,8 @@ var BroadcastProvider = class {
|
|
|
1623
1623
|
body: JSON.stringify({
|
|
1624
1624
|
to: recipients[0],
|
|
1625
1625
|
// Broadcast API expects a single recipient for transactional emails
|
|
1626
|
+
from: `${from.name} <${from.email}>`,
|
|
1627
|
+
// Include from name and email
|
|
1626
1628
|
subject: params.subject,
|
|
1627
1629
|
body: params.html || params.text || "",
|
|
1628
1630
|
reply_to: params.replyTo || this.replyTo || from.email
|
|
@@ -2721,9 +2723,10 @@ var createSigninEndpoint = (config) => {
|
|
|
2721
2723
|
siteName: settings?.brandSettings?.siteName || "Newsletter",
|
|
2722
2724
|
expiresIn: config.auth?.tokenExpiration || "7d"
|
|
2723
2725
|
}, config);
|
|
2726
|
+
const subject = settings?.emailTemplates?.magicLink?.subjectLine || (settings?.brandSettings?.siteName ? `Sign in to ${settings.brandSettings.siteName}` : "Sign in to your account");
|
|
2724
2727
|
await emailService.send({
|
|
2725
2728
|
to: subscriber.email,
|
|
2726
|
-
subject
|
|
2729
|
+
subject,
|
|
2727
2730
|
html
|
|
2728
2731
|
});
|
|
2729
2732
|
} else {
|
|
@@ -3758,143 +3761,152 @@ import {
|
|
|
3758
3761
|
InlineToolbarFeature,
|
|
3759
3762
|
lexicalEditor
|
|
3760
3763
|
} from "@payloadcms/richtext-lexical";
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3764
|
+
var createEmailSafeFeatures = (additionalBlocks) => {
|
|
3765
|
+
const baseBlocks = [
|
|
3766
|
+
{
|
|
3767
|
+
slug: "button",
|
|
3768
|
+
fields: [
|
|
3769
|
+
{
|
|
3770
|
+
name: "text",
|
|
3771
|
+
type: "text",
|
|
3772
|
+
label: "Button Text",
|
|
3773
|
+
required: true
|
|
3774
|
+
},
|
|
3775
|
+
{
|
|
3776
|
+
name: "url",
|
|
3777
|
+
type: "text",
|
|
3778
|
+
label: "Button URL",
|
|
3779
|
+
required: true,
|
|
3780
|
+
admin: {
|
|
3781
|
+
description: "Enter the full URL (including https://)"
|
|
3782
|
+
}
|
|
3783
|
+
},
|
|
3784
|
+
{
|
|
3785
|
+
name: "style",
|
|
3786
|
+
type: "select",
|
|
3787
|
+
label: "Button Style",
|
|
3788
|
+
defaultValue: "primary",
|
|
3789
|
+
options: [
|
|
3790
|
+
{ label: "Primary", value: "primary" },
|
|
3791
|
+
{ label: "Secondary", value: "secondary" },
|
|
3792
|
+
{ label: "Outline", value: "outline" }
|
|
3793
|
+
]
|
|
3781
3794
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
defaultValue: false
|
|
3795
|
+
],
|
|
3796
|
+
interfaceName: "EmailButton",
|
|
3797
|
+
labels: {
|
|
3798
|
+
singular: "Button",
|
|
3799
|
+
plural: "Buttons"
|
|
3788
3800
|
}
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
name: "caption",
|
|
3810
|
-
type: "text",
|
|
3811
|
-
admin: {
|
|
3812
|
-
description: "Optional caption for the image"
|
|
3813
|
-
}
|
|
3814
|
-
},
|
|
3815
|
-
{
|
|
3816
|
-
name: "altText",
|
|
3817
|
-
type: "text",
|
|
3818
|
-
label: "Alt Text",
|
|
3819
|
-
required: true,
|
|
3820
|
-
admin: {
|
|
3821
|
-
description: "Alternative text for accessibility and when image cannot be displayed"
|
|
3822
|
-
}
|
|
3823
|
-
}
|
|
3824
|
-
]
|
|
3801
|
+
},
|
|
3802
|
+
{
|
|
3803
|
+
slug: "divider",
|
|
3804
|
+
fields: [
|
|
3805
|
+
{
|
|
3806
|
+
name: "style",
|
|
3807
|
+
type: "select",
|
|
3808
|
+
label: "Divider Style",
|
|
3809
|
+
defaultValue: "solid",
|
|
3810
|
+
options: [
|
|
3811
|
+
{ label: "Solid", value: "solid" },
|
|
3812
|
+
{ label: "Dashed", value: "dashed" },
|
|
3813
|
+
{ label: "Dotted", value: "dotted" }
|
|
3814
|
+
]
|
|
3815
|
+
}
|
|
3816
|
+
],
|
|
3817
|
+
interfaceName: "EmailDivider",
|
|
3818
|
+
labels: {
|
|
3819
|
+
singular: "Divider",
|
|
3820
|
+
plural: "Dividers"
|
|
3825
3821
|
}
|
|
3826
3822
|
}
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
label: "Button Style",
|
|
3853
|
-
defaultValue: "primary",
|
|
3854
|
-
options: [
|
|
3855
|
-
{ label: "Primary", value: "primary" },
|
|
3856
|
-
{ label: "Secondary", value: "secondary" },
|
|
3857
|
-
{ label: "Outline", value: "outline" }
|
|
3858
|
-
]
|
|
3823
|
+
];
|
|
3824
|
+
const allBlocks = [
|
|
3825
|
+
...baseBlocks,
|
|
3826
|
+
...additionalBlocks || []
|
|
3827
|
+
];
|
|
3828
|
+
return [
|
|
3829
|
+
// Toolbars
|
|
3830
|
+
FixedToolbarFeature(),
|
|
3831
|
+
// Fixed toolbar at the top
|
|
3832
|
+
InlineToolbarFeature(),
|
|
3833
|
+
// Floating toolbar when text is selected
|
|
3834
|
+
// Basic text formatting
|
|
3835
|
+
BoldFeature(),
|
|
3836
|
+
ItalicFeature(),
|
|
3837
|
+
UnderlineFeature(),
|
|
3838
|
+
StrikethroughFeature(),
|
|
3839
|
+
// Links with enhanced configuration
|
|
3840
|
+
LinkFeature({
|
|
3841
|
+
fields: [
|
|
3842
|
+
{
|
|
3843
|
+
name: "url",
|
|
3844
|
+
type: "text",
|
|
3845
|
+
required: true,
|
|
3846
|
+
admin: {
|
|
3847
|
+
description: "Enter the full URL (including https://)"
|
|
3859
3848
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
name: "newTab",
|
|
3852
|
+
type: "checkbox",
|
|
3853
|
+
label: "Open in new tab",
|
|
3854
|
+
defaultValue: false
|
|
3865
3855
|
}
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3856
|
+
]
|
|
3857
|
+
}),
|
|
3858
|
+
// Lists
|
|
3859
|
+
OrderedListFeature(),
|
|
3860
|
+
UnorderedListFeature(),
|
|
3861
|
+
// Headings - limited to h1, h2, h3 for email compatibility
|
|
3862
|
+
HeadingFeature({
|
|
3863
|
+
enabledHeadingSizes: ["h1", "h2", "h3"]
|
|
3864
|
+
}),
|
|
3865
|
+
// Basic paragraph and alignment
|
|
3866
|
+
ParagraphFeature(),
|
|
3867
|
+
AlignFeature(),
|
|
3868
|
+
// Blockquotes
|
|
3869
|
+
BlockquoteFeature(),
|
|
3870
|
+
// Upload feature for images
|
|
3871
|
+
UploadFeature({
|
|
3872
|
+
collections: {
|
|
3873
|
+
media: {
|
|
3874
|
+
fields: [
|
|
3875
|
+
{
|
|
3876
|
+
name: "caption",
|
|
3877
|
+
type: "text",
|
|
3878
|
+
admin: {
|
|
3879
|
+
description: "Optional caption for the image"
|
|
3880
|
+
}
|
|
3881
|
+
},
|
|
3882
|
+
{
|
|
3883
|
+
name: "altText",
|
|
3884
|
+
type: "text",
|
|
3885
|
+
label: "Alt Text",
|
|
3886
|
+
required: true,
|
|
3887
|
+
admin: {
|
|
3888
|
+
description: "Alternative text for accessibility and when image cannot be displayed"
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
]
|
|
3886
3892
|
}
|
|
3887
3893
|
}
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3894
|
+
}),
|
|
3895
|
+
// Custom blocks for email-specific content
|
|
3896
|
+
BlocksFeature({
|
|
3897
|
+
blocks: allBlocks
|
|
3898
|
+
})
|
|
3899
|
+
];
|
|
3900
|
+
};
|
|
3901
|
+
var emailSafeFeatures = createEmailSafeFeatures();
|
|
3891
3902
|
var createEmailContentField = (overrides) => {
|
|
3903
|
+
const features = createEmailSafeFeatures(overrides?.additionalBlocks);
|
|
3892
3904
|
return {
|
|
3893
3905
|
name: "content",
|
|
3894
3906
|
type: "richText",
|
|
3895
3907
|
required: true,
|
|
3896
3908
|
editor: lexicalEditor({
|
|
3897
|
-
features
|
|
3909
|
+
features
|
|
3898
3910
|
}),
|
|
3899
3911
|
admin: {
|
|
3900
3912
|
description: "Email content with limited formatting for compatibility",
|
|
@@ -3920,6 +3932,7 @@ var createBroadcastInlinePreviewField = () => {
|
|
|
3920
3932
|
// src/collections/Broadcasts.ts
|
|
3921
3933
|
var createBroadcastsCollection = (pluginConfig) => {
|
|
3922
3934
|
const hasProviders = !!(pluginConfig.providers?.broadcast || pluginConfig.providers?.resend);
|
|
3935
|
+
const customizations = pluginConfig.customizations?.broadcasts;
|
|
3923
3936
|
return {
|
|
3924
3937
|
slug: "broadcasts",
|
|
3925
3938
|
labels: {
|
|
@@ -3940,6 +3953,8 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
3940
3953
|
description: "Email subject line"
|
|
3941
3954
|
}
|
|
3942
3955
|
},
|
|
3956
|
+
// Add any additional fields from customizations after subject
|
|
3957
|
+
...customizations?.additionalFields || [],
|
|
3943
3958
|
{
|
|
3944
3959
|
type: "row",
|
|
3945
3960
|
fields: [
|
|
@@ -3961,10 +3976,13 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
3961
3976
|
description: "Preview text shown in email clients"
|
|
3962
3977
|
}
|
|
3963
3978
|
},
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3979
|
+
// Apply content field customization if provided
|
|
3980
|
+
customizations?.fieldOverrides?.content ? customizations.fieldOverrides.content(createEmailContentField({
|
|
3981
|
+
admin: { description: "Email content" },
|
|
3982
|
+
additionalBlocks: customizations.customBlocks
|
|
3983
|
+
})) : createEmailContentField({
|
|
3984
|
+
admin: { description: "Email content" },
|
|
3985
|
+
additionalBlocks: customizations?.customBlocks
|
|
3968
3986
|
})
|
|
3969
3987
|
]
|
|
3970
3988
|
},
|