payload-plugin-newsletter 0.14.3 → 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 +27 -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 +142 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +142 -127
- 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.cjs
CHANGED
|
@@ -3761,143 +3761,152 @@ init_types();
|
|
|
3761
3761
|
|
|
3762
3762
|
// src/fields/emailContent.ts
|
|
3763
3763
|
var import_richtext_lexical = require("@payloadcms/richtext-lexical");
|
|
3764
|
-
var
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
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
|
+
]
|
|
3784
3794
|
}
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
defaultValue: false
|
|
3795
|
+
],
|
|
3796
|
+
interfaceName: "EmailButton",
|
|
3797
|
+
labels: {
|
|
3798
|
+
singular: "Button",
|
|
3799
|
+
plural: "Buttons"
|
|
3791
3800
|
}
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
name: "caption",
|
|
3813
|
-
type: "text",
|
|
3814
|
-
admin: {
|
|
3815
|
-
description: "Optional caption for the image"
|
|
3816
|
-
}
|
|
3817
|
-
},
|
|
3818
|
-
{
|
|
3819
|
-
name: "altText",
|
|
3820
|
-
type: "text",
|
|
3821
|
-
label: "Alt Text",
|
|
3822
|
-
required: true,
|
|
3823
|
-
admin: {
|
|
3824
|
-
description: "Alternative text for accessibility and when image cannot be displayed"
|
|
3825
|
-
}
|
|
3826
|
-
}
|
|
3827
|
-
]
|
|
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"
|
|
3828
3821
|
}
|
|
3829
3822
|
}
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
label: "Button Style",
|
|
3856
|
-
defaultValue: "primary",
|
|
3857
|
-
options: [
|
|
3858
|
-
{ label: "Primary", value: "primary" },
|
|
3859
|
-
{ label: "Secondary", value: "secondary" },
|
|
3860
|
-
{ label: "Outline", value: "outline" }
|
|
3861
|
-
]
|
|
3823
|
+
];
|
|
3824
|
+
const allBlocks = [
|
|
3825
|
+
...baseBlocks,
|
|
3826
|
+
...additionalBlocks || []
|
|
3827
|
+
];
|
|
3828
|
+
return [
|
|
3829
|
+
// Toolbars
|
|
3830
|
+
(0, import_richtext_lexical.FixedToolbarFeature)(),
|
|
3831
|
+
// Fixed toolbar at the top
|
|
3832
|
+
(0, import_richtext_lexical.InlineToolbarFeature)(),
|
|
3833
|
+
// Floating toolbar when text is selected
|
|
3834
|
+
// Basic text formatting
|
|
3835
|
+
(0, import_richtext_lexical.BoldFeature)(),
|
|
3836
|
+
(0, import_richtext_lexical.ItalicFeature)(),
|
|
3837
|
+
(0, import_richtext_lexical.UnderlineFeature)(),
|
|
3838
|
+
(0, import_richtext_lexical.StrikethroughFeature)(),
|
|
3839
|
+
// Links with enhanced configuration
|
|
3840
|
+
(0, import_richtext_lexical.LinkFeature)({
|
|
3841
|
+
fields: [
|
|
3842
|
+
{
|
|
3843
|
+
name: "url",
|
|
3844
|
+
type: "text",
|
|
3845
|
+
required: true,
|
|
3846
|
+
admin: {
|
|
3847
|
+
description: "Enter the full URL (including https://)"
|
|
3862
3848
|
}
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
name: "newTab",
|
|
3852
|
+
type: "checkbox",
|
|
3853
|
+
label: "Open in new tab",
|
|
3854
|
+
defaultValue: false
|
|
3868
3855
|
}
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3856
|
+
]
|
|
3857
|
+
}),
|
|
3858
|
+
// Lists
|
|
3859
|
+
(0, import_richtext_lexical.OrderedListFeature)(),
|
|
3860
|
+
(0, import_richtext_lexical.UnorderedListFeature)(),
|
|
3861
|
+
// Headings - limited to h1, h2, h3 for email compatibility
|
|
3862
|
+
(0, import_richtext_lexical.HeadingFeature)({
|
|
3863
|
+
enabledHeadingSizes: ["h1", "h2", "h3"]
|
|
3864
|
+
}),
|
|
3865
|
+
// Basic paragraph and alignment
|
|
3866
|
+
(0, import_richtext_lexical.ParagraphFeature)(),
|
|
3867
|
+
(0, import_richtext_lexical.AlignFeature)(),
|
|
3868
|
+
// Blockquotes
|
|
3869
|
+
(0, import_richtext_lexical.BlockquoteFeature)(),
|
|
3870
|
+
// Upload feature for images
|
|
3871
|
+
(0, import_richtext_lexical.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
|
+
]
|
|
3889
3892
|
}
|
|
3890
3893
|
}
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
+
}),
|
|
3895
|
+
// Custom blocks for email-specific content
|
|
3896
|
+
(0, import_richtext_lexical.BlocksFeature)({
|
|
3897
|
+
blocks: allBlocks
|
|
3898
|
+
})
|
|
3899
|
+
];
|
|
3900
|
+
};
|
|
3901
|
+
var emailSafeFeatures = createEmailSafeFeatures();
|
|
3894
3902
|
var createEmailContentField = (overrides) => {
|
|
3903
|
+
const features = createEmailSafeFeatures(overrides?.additionalBlocks);
|
|
3895
3904
|
return {
|
|
3896
3905
|
name: "content",
|
|
3897
3906
|
type: "richText",
|
|
3898
3907
|
required: true,
|
|
3899
3908
|
editor: (0, import_richtext_lexical.lexicalEditor)({
|
|
3900
|
-
features
|
|
3909
|
+
features
|
|
3901
3910
|
}),
|
|
3902
3911
|
admin: {
|
|
3903
3912
|
description: "Email content with limited formatting for compatibility",
|
|
@@ -3923,6 +3932,7 @@ var createBroadcastInlinePreviewField = () => {
|
|
|
3923
3932
|
// src/collections/Broadcasts.ts
|
|
3924
3933
|
var createBroadcastsCollection = (pluginConfig) => {
|
|
3925
3934
|
const hasProviders = !!(pluginConfig.providers?.broadcast || pluginConfig.providers?.resend);
|
|
3935
|
+
const customizations = pluginConfig.customizations?.broadcasts;
|
|
3926
3936
|
return {
|
|
3927
3937
|
slug: "broadcasts",
|
|
3928
3938
|
labels: {
|
|
@@ -3943,6 +3953,8 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
3943
3953
|
description: "Email subject line"
|
|
3944
3954
|
}
|
|
3945
3955
|
},
|
|
3956
|
+
// Add any additional fields from customizations after subject
|
|
3957
|
+
...customizations?.additionalFields || [],
|
|
3946
3958
|
{
|
|
3947
3959
|
type: "row",
|
|
3948
3960
|
fields: [
|
|
@@ -3964,10 +3976,13 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
3964
3976
|
description: "Preview text shown in email clients"
|
|
3965
3977
|
}
|
|
3966
3978
|
},
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
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
|
|
3971
3986
|
})
|
|
3972
3987
|
]
|
|
3973
3988
|
},
|