payload-plugin-newsletter 0.3.2 → 0.4.5
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 +44 -1
- package/CLAUDE.md +31 -19
- package/dist/client.cjs +899 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +52 -0
- package/dist/client.d.ts +52 -0
- package/dist/client.js +867 -0
- package/dist/client.js.map +1 -0
- package/dist/components.cjs +899 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +4 -0
- package/dist/components.d.ts +4 -0
- package/dist/components.js +867 -0
- package/dist/components.js.map +1 -0
- package/dist/index.cjs +2004 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1967 -0
- package/dist/index.js.map +1 -0
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types/index.d.ts → types.d.cts} +19 -17
- package/dist/types.d.ts +350 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -25
- package/dist/.tsbuildinfo +0 -1
- package/dist/collections/NewsletterSettings.d.ts +0 -4
- package/dist/collections/NewsletterSettings.d.ts.map +0 -1
- package/dist/collections/Subscribers.d.ts +0 -4
- package/dist/collections/Subscribers.d.ts.map +0 -1
- package/dist/components/MagicLinkVerify.d.ts +0 -27
- package/dist/components/MagicLinkVerify.d.ts.map +0 -1
- package/dist/components/NewsletterForm.d.ts +0 -5
- package/dist/components/NewsletterForm.d.ts.map +0 -1
- package/dist/components/PreferencesForm.d.ts +0 -5
- package/dist/components/PreferencesForm.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.d.ts.map +0 -1
- package/dist/endpoints/index.d.ts +0 -4
- package/dist/endpoints/index.d.ts.map +0 -1
- package/dist/endpoints/preferences.d.ts +0 -5
- package/dist/endpoints/preferences.d.ts.map +0 -1
- package/dist/endpoints/subscribe.d.ts +0 -4
- package/dist/endpoints/subscribe.d.ts.map +0 -1
- package/dist/endpoints/unsubscribe.d.ts +0 -4
- package/dist/endpoints/unsubscribe.d.ts.map +0 -1
- package/dist/endpoints/verify-magic-link.d.ts +0 -4
- package/dist/endpoints/verify-magic-link.d.ts.map +0 -1
- package/dist/exports/client.d.ts +0 -6
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/components.d.ts +0 -2
- package/dist/exports/components.d.ts.map +0 -1
- package/dist/exports/types.d.ts +0 -2
- package/dist/exports/types.d.ts.map +0 -1
- package/dist/fields/newsletterScheduling.d.ts +0 -4
- package/dist/fields/newsletterScheduling.d.ts.map +0 -1
- package/dist/hooks/useNewsletterAuth.d.ts +0 -16
- package/dist/hooks/useNewsletterAuth.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/broadcast.d.ts +0 -19
- package/dist/providers/broadcast.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -23
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/resend.d.ts +0 -20
- package/dist/providers/resend.d.ts.map +0 -1
- package/dist/providers/types.d.ts +0 -46
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/src/__tests__/fixtures/newsletter-settings.js +0 -41
- package/dist/src/__tests__/fixtures/newsletter-settings.js.map +0 -1
- package/dist/src/__tests__/fixtures/subscribers.js +0 -70
- package/dist/src/__tests__/fixtures/subscribers.js.map +0 -1
- package/dist/src/__tests__/integration/collections/subscriber-hooks.test.js +0 -356
- package/dist/src/__tests__/integration/collections/subscriber-hooks.test.js.map +0 -1
- package/dist/src/__tests__/integration/endpoints/preferences.test.js +0 -266
- package/dist/src/__tests__/integration/endpoints/preferences.test.js.map +0 -1
- package/dist/src/__tests__/integration/endpoints/subscribe.test.js +0 -280
- package/dist/src/__tests__/integration/endpoints/subscribe.test.js.map +0 -1
- package/dist/src/__tests__/integration/endpoints/unsubscribe.test.js +0 -187
- package/dist/src/__tests__/integration/endpoints/unsubscribe.test.js.map +0 -1
- package/dist/src/__tests__/integration/endpoints/verify-magic-link.test.js +0 -188
- package/dist/src/__tests__/integration/endpoints/verify-magic-link.test.js.map +0 -1
- package/dist/src/__tests__/mocks/email-providers.js +0 -153
- package/dist/src/__tests__/mocks/email-providers.js.map +0 -1
- package/dist/src/__tests__/mocks/payload.js +0 -244
- package/dist/src/__tests__/mocks/payload.js.map +0 -1
- package/dist/src/__tests__/security/csrf-protection.test.js +0 -309
- package/dist/src/__tests__/security/csrf-protection.test.js.map +0 -1
- package/dist/src/__tests__/security/settings-access.test.js +0 -204
- package/dist/src/__tests__/security/settings-access.test.js.map +0 -1
- package/dist/src/__tests__/security/subscriber-access.test.js +0 -210
- package/dist/src/__tests__/security/subscriber-access.test.js.map +0 -1
- package/dist/src/__tests__/security/xss-prevention.test.js +0 -305
- package/dist/src/__tests__/security/xss-prevention.test.js.map +0 -1
- package/dist/src/__tests__/setup/integration.setup.js +0 -38
- package/dist/src/__tests__/setup/integration.setup.js.map +0 -1
- package/dist/src/__tests__/setup/unit.setup.js +0 -41
- package/dist/src/__tests__/setup/unit.setup.js.map +0 -1
- package/dist/src/__tests__/unit/utils/access.test.js +0 -116
- package/dist/src/__tests__/unit/utils/access.test.js.map +0 -1
- package/dist/src/__tests__/unit/utils/jwt.test.js +0 -238
- package/dist/src/__tests__/unit/utils/jwt.test.js.map +0 -1
- package/dist/src/collections/NewsletterSettings.js +0 -390
- package/dist/src/collections/NewsletterSettings.js.map +0 -1
- package/dist/src/collections/Subscribers.js +0 -309
- package/dist/src/collections/Subscribers.js.map +0 -1
- package/dist/src/components/MagicLinkVerify.js +0 -180
- package/dist/src/components/MagicLinkVerify.js.map +0 -1
- package/dist/src/components/NewsletterForm.js +0 -326
- package/dist/src/components/NewsletterForm.js.map +0 -1
- package/dist/src/components/PreferencesForm.js +0 -524
- package/dist/src/components/PreferencesForm.js.map +0 -1
- package/dist/src/components/index.js +0 -5
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/endpoints/index.js +0 -17
- package/dist/src/endpoints/index.js.map +0 -1
- package/dist/src/endpoints/preferences.js +0 -136
- package/dist/src/endpoints/preferences.js.map +0 -1
- package/dist/src/endpoints/subscribe.js +0 -151
- package/dist/src/endpoints/subscribe.js.map +0 -1
- package/dist/src/endpoints/unsubscribe.js +0 -105
- package/dist/src/endpoints/unsubscribe.js.map +0 -1
- package/dist/src/endpoints/verify-magic-link.js +0 -103
- package/dist/src/endpoints/verify-magic-link.js.map +0 -1
- package/dist/src/exports/client.js +0 -7
- package/dist/src/exports/client.js.map +0 -1
- package/dist/src/exports/components.js +0 -6
- package/dist/src/exports/components.js.map +0 -1
- package/dist/src/exports/types.js +0 -3
- package/dist/src/exports/types.js.map +0 -1
- package/dist/src/fields/newsletterScheduling.js +0 -195
- package/dist/src/fields/newsletterScheduling.js.map +0 -1
- package/dist/src/hooks/useNewsletterAuth.js +0 -112
- package/dist/src/hooks/useNewsletterAuth.js.map +0 -1
- package/dist/src/index.js +0 -130
- package/dist/src/index.js.map +0 -1
- package/dist/src/providers/broadcast.js +0 -158
- package/dist/src/providers/broadcast.js.map +0 -1
- package/dist/src/providers/index.js +0 -63
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/providers/resend.js +0 -122
- package/dist/src/providers/resend.js.map +0 -1
- package/dist/src/providers/types.js +0 -12
- package/dist/src/providers/types.js.map +0 -1
- package/dist/src/templates/BaseTemplate.js +0 -105
- package/dist/src/templates/BaseTemplate.js.map +0 -1
- package/dist/src/templates/MagicLinkTemplate.js +0 -178
- package/dist/src/templates/MagicLinkTemplate.js.map +0 -1
- package/dist/src/templates/NewsletterTemplate.js +0 -150
- package/dist/src/templates/NewsletterTemplate.js.map +0 -1
- package/dist/src/templates/WelcomeTemplate.js +0 -192
- package/dist/src/templates/WelcomeTemplate.js.map +0 -1
- package/dist/src/templates/index.js +0 -6
- package/dist/src/templates/index.js.map +0 -1
- package/dist/src/types/index.js +0 -3
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/utils/access.js +0 -80
- package/dist/src/utils/access.js.map +0 -1
- package/dist/src/utils/jwt.js +0 -91
- package/dist/src/utils/jwt.js.map +0 -1
- package/dist/src/utils/validation.js +0 -74
- package/dist/src/utils/validation.js.map +0 -1
- package/dist/templates/BaseTemplate.d.ts +0 -45
- package/dist/templates/BaseTemplate.d.ts.map +0 -1
- package/dist/templates/MagicLinkTemplate.d.ts +0 -67
- package/dist/templates/MagicLinkTemplate.d.ts.map +0 -1
- package/dist/templates/NewsletterTemplate.d.ts +0 -112
- package/dist/templates/NewsletterTemplate.d.ts.map +0 -1
- package/dist/templates/WelcomeTemplate.d.ts +0 -55
- package/dist/templates/WelcomeTemplate.d.ts.map +0 -1
- package/dist/templates/index.d.ts +0 -7
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/access.d.ts +0 -15
- package/dist/utils/access.d.ts.map +0 -1
- package/dist/utils/jwt.d.ts +0 -32
- package/dist/utils/jwt.d.ts.map +0 -1
- package/dist/utils/validation.d.ts +0 -25
- package/dist/utils/validation.d.ts.map +0 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { Field } from 'payload';
|
|
2
|
+
|
|
3
|
+
interface NewsletterPluginConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Enable or disable the plugin
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Slug for the subscribers collection
|
|
11
|
+
* @default 'subscribers'
|
|
12
|
+
*/
|
|
13
|
+
subscribersSlug?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Slug for the newsletter settings collection
|
|
16
|
+
* @default 'newsletter-settings'
|
|
17
|
+
*/
|
|
18
|
+
settingsSlug?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Authentication configuration for magic links
|
|
21
|
+
*/
|
|
22
|
+
auth?: {
|
|
23
|
+
/**
|
|
24
|
+
* Enable magic link authentication
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Token expiration time
|
|
30
|
+
* @default '7d'
|
|
31
|
+
*/
|
|
32
|
+
tokenExpiration?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Path where magic link redirects
|
|
35
|
+
* @default '/newsletter/verify'
|
|
36
|
+
*/
|
|
37
|
+
magicLinkPath?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Access control configuration
|
|
41
|
+
*/
|
|
42
|
+
access?: {
|
|
43
|
+
/**
|
|
44
|
+
* Custom function to determine if a user is an admin
|
|
45
|
+
* @param user - The authenticated user object
|
|
46
|
+
* @returns true if the user should have admin access
|
|
47
|
+
*/
|
|
48
|
+
isAdmin?: (user: any) => boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Email provider configuration
|
|
52
|
+
*/
|
|
53
|
+
providers: {
|
|
54
|
+
/**
|
|
55
|
+
* Default provider to use
|
|
56
|
+
*/
|
|
57
|
+
default: 'resend' | 'broadcast' | string;
|
|
58
|
+
/**
|
|
59
|
+
* Resend provider configuration
|
|
60
|
+
*/
|
|
61
|
+
resend?: ResendProviderConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Broadcast provider configuration
|
|
64
|
+
*/
|
|
65
|
+
broadcast?: BroadcastProviderConfig;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Field customization options
|
|
69
|
+
*/
|
|
70
|
+
fields?: {
|
|
71
|
+
/**
|
|
72
|
+
* Override default fields
|
|
73
|
+
*/
|
|
74
|
+
overrides?: (args: {
|
|
75
|
+
defaultFields: Field[];
|
|
76
|
+
}) => Field[];
|
|
77
|
+
/**
|
|
78
|
+
* Additional custom fields
|
|
79
|
+
*/
|
|
80
|
+
additional?: Field[];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Email template components
|
|
84
|
+
*/
|
|
85
|
+
templates?: {
|
|
86
|
+
/**
|
|
87
|
+
* Welcome email template
|
|
88
|
+
*/
|
|
89
|
+
welcome?: React.ComponentType<WelcomeEmailProps>;
|
|
90
|
+
/**
|
|
91
|
+
* Magic link email template
|
|
92
|
+
*/
|
|
93
|
+
magicLink?: React.ComponentType<MagicLinkEmailProps>;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Plugin hooks
|
|
97
|
+
*/
|
|
98
|
+
hooks?: {
|
|
99
|
+
beforeSubscribe?: (args: BeforeSubscribeArgs) => void | Promise<void>;
|
|
100
|
+
afterSubscribe?: (args: AfterSubscribeArgs) => void | Promise<void>;
|
|
101
|
+
beforeUnsubscribe?: (args: BeforeUnsubscribeArgs) => void | Promise<void>;
|
|
102
|
+
afterUnsubscribe?: (args: AfterUnsubscribeArgs) => void | Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* UI component overrides
|
|
106
|
+
*/
|
|
107
|
+
components?: {
|
|
108
|
+
signupForm?: React.ComponentType<SignupFormProps>;
|
|
109
|
+
preferencesForm?: React.ComponentType<PreferencesFormProps>;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Feature flags
|
|
113
|
+
*/
|
|
114
|
+
features?: {
|
|
115
|
+
/**
|
|
116
|
+
* Lead magnet configuration
|
|
117
|
+
*/
|
|
118
|
+
leadMagnets?: {
|
|
119
|
+
enabled?: boolean;
|
|
120
|
+
collection?: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Post-signup survey configuration
|
|
124
|
+
*/
|
|
125
|
+
surveys?: {
|
|
126
|
+
enabled?: boolean;
|
|
127
|
+
questions?: SurveyQuestion[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* UTM tracking configuration
|
|
131
|
+
*/
|
|
132
|
+
utmTracking?: {
|
|
133
|
+
enabled?: boolean;
|
|
134
|
+
fields?: string[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Newsletter scheduling configuration
|
|
138
|
+
*/
|
|
139
|
+
newsletterScheduling?: {
|
|
140
|
+
enabled?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Collections to add newsletter fields to
|
|
143
|
+
* Can be a string for single collection or array for multiple
|
|
144
|
+
* @example 'articles' or ['articles', 'posts', 'updates']
|
|
145
|
+
*/
|
|
146
|
+
collections?: string | string[];
|
|
147
|
+
/**
|
|
148
|
+
* Field configuration
|
|
149
|
+
*/
|
|
150
|
+
fields?: {
|
|
151
|
+
/**
|
|
152
|
+
* Group name for newsletter fields
|
|
153
|
+
* @default 'newsletterScheduling'
|
|
154
|
+
*/
|
|
155
|
+
groupName?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Rich text field name to use for content
|
|
158
|
+
* @default 'content'
|
|
159
|
+
*/
|
|
160
|
+
contentField?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Whether to create a markdown companion field
|
|
163
|
+
* @default true
|
|
164
|
+
*/
|
|
165
|
+
createMarkdownField?: boolean;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Internationalization configuration
|
|
171
|
+
*/
|
|
172
|
+
i18n?: {
|
|
173
|
+
defaultLocale?: string;
|
|
174
|
+
locales?: string[];
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
interface ResendProviderConfig {
|
|
178
|
+
apiKey: string;
|
|
179
|
+
fromAddress?: string;
|
|
180
|
+
fromName?: string;
|
|
181
|
+
audienceIds?: {
|
|
182
|
+
[locale: string]: {
|
|
183
|
+
production?: string;
|
|
184
|
+
development?: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
interface BroadcastProviderConfig {
|
|
189
|
+
apiUrl: string;
|
|
190
|
+
tokens: {
|
|
191
|
+
production?: string;
|
|
192
|
+
development?: string;
|
|
193
|
+
};
|
|
194
|
+
fromAddress?: string;
|
|
195
|
+
fromName?: string;
|
|
196
|
+
}
|
|
197
|
+
interface EmailProvider {
|
|
198
|
+
send(params: SendEmailParams): Promise<void>;
|
|
199
|
+
addContact(contact: Subscriber): Promise<void>;
|
|
200
|
+
updateContact(contact: Subscriber): Promise<void>;
|
|
201
|
+
removeContact(email: string): Promise<void>;
|
|
202
|
+
}
|
|
203
|
+
interface SendEmailParams {
|
|
204
|
+
to: string | string[];
|
|
205
|
+
subject: string;
|
|
206
|
+
html?: string;
|
|
207
|
+
text?: string;
|
|
208
|
+
react?: React.ReactElement;
|
|
209
|
+
}
|
|
210
|
+
interface Subscriber {
|
|
211
|
+
id: string;
|
|
212
|
+
email: string;
|
|
213
|
+
name?: string;
|
|
214
|
+
locale?: string;
|
|
215
|
+
subscriptionStatus: 'active' | 'unsubscribed' | 'pending';
|
|
216
|
+
emailPreferences?: {
|
|
217
|
+
newsletter?: boolean;
|
|
218
|
+
announcements?: boolean;
|
|
219
|
+
[key: string]: boolean | undefined;
|
|
220
|
+
};
|
|
221
|
+
source?: string;
|
|
222
|
+
utmParameters?: {
|
|
223
|
+
source?: string;
|
|
224
|
+
medium?: string;
|
|
225
|
+
campaign?: string;
|
|
226
|
+
content?: string;
|
|
227
|
+
term?: string;
|
|
228
|
+
};
|
|
229
|
+
createdAt: string;
|
|
230
|
+
updatedAt: string;
|
|
231
|
+
}
|
|
232
|
+
interface WelcomeEmailProps {
|
|
233
|
+
subscriber: Subscriber;
|
|
234
|
+
unsubscribeUrl: string;
|
|
235
|
+
preferencesUrl: string;
|
|
236
|
+
}
|
|
237
|
+
interface MagicLinkEmailProps {
|
|
238
|
+
magicLinkUrl: string;
|
|
239
|
+
subscriber: Subscriber;
|
|
240
|
+
}
|
|
241
|
+
interface SignupFormProps {
|
|
242
|
+
onSuccess?: (subscriber: Subscriber) => void;
|
|
243
|
+
onError?: (error: Error) => void;
|
|
244
|
+
showName?: boolean;
|
|
245
|
+
showPreferences?: boolean;
|
|
246
|
+
leadMagnet?: {
|
|
247
|
+
id: string;
|
|
248
|
+
title: string;
|
|
249
|
+
description?: string;
|
|
250
|
+
};
|
|
251
|
+
className?: string;
|
|
252
|
+
styles?: {
|
|
253
|
+
form?: React.CSSProperties;
|
|
254
|
+
inputGroup?: React.CSSProperties;
|
|
255
|
+
label?: React.CSSProperties;
|
|
256
|
+
input?: React.CSSProperties;
|
|
257
|
+
button?: React.CSSProperties;
|
|
258
|
+
buttonDisabled?: React.CSSProperties;
|
|
259
|
+
error?: React.CSSProperties;
|
|
260
|
+
success?: React.CSSProperties;
|
|
261
|
+
checkbox?: React.CSSProperties;
|
|
262
|
+
checkboxInput?: React.CSSProperties;
|
|
263
|
+
checkboxLabel?: React.CSSProperties;
|
|
264
|
+
};
|
|
265
|
+
apiEndpoint?: string;
|
|
266
|
+
buttonText?: string;
|
|
267
|
+
loadingText?: string;
|
|
268
|
+
successMessage?: string;
|
|
269
|
+
placeholders?: {
|
|
270
|
+
email?: string;
|
|
271
|
+
name?: string;
|
|
272
|
+
};
|
|
273
|
+
labels?: {
|
|
274
|
+
email?: string;
|
|
275
|
+
name?: string;
|
|
276
|
+
newsletter?: string;
|
|
277
|
+
announcements?: string;
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
interface PreferencesFormProps {
|
|
281
|
+
subscriber?: Subscriber;
|
|
282
|
+
onSuccess?: (subscriber: Subscriber) => void;
|
|
283
|
+
onError?: (error: Error) => void;
|
|
284
|
+
className?: string;
|
|
285
|
+
styles?: {
|
|
286
|
+
container?: React.CSSProperties;
|
|
287
|
+
heading?: React.CSSProperties;
|
|
288
|
+
form?: React.CSSProperties;
|
|
289
|
+
section?: React.CSSProperties;
|
|
290
|
+
sectionTitle?: React.CSSProperties;
|
|
291
|
+
inputGroup?: React.CSSProperties;
|
|
292
|
+
label?: React.CSSProperties;
|
|
293
|
+
input?: React.CSSProperties;
|
|
294
|
+
select?: React.CSSProperties;
|
|
295
|
+
checkbox?: React.CSSProperties;
|
|
296
|
+
checkboxInput?: React.CSSProperties;
|
|
297
|
+
checkboxLabel?: React.CSSProperties;
|
|
298
|
+
buttonGroup?: React.CSSProperties;
|
|
299
|
+
button?: React.CSSProperties;
|
|
300
|
+
primaryButton?: React.CSSProperties;
|
|
301
|
+
secondaryButton?: React.CSSProperties;
|
|
302
|
+
dangerButton?: React.CSSProperties;
|
|
303
|
+
error?: React.CSSProperties;
|
|
304
|
+
success?: React.CSSProperties;
|
|
305
|
+
info?: React.CSSProperties;
|
|
306
|
+
};
|
|
307
|
+
sessionToken?: string;
|
|
308
|
+
apiEndpoint?: string;
|
|
309
|
+
showUnsubscribe?: boolean;
|
|
310
|
+
locales?: string[];
|
|
311
|
+
labels?: {
|
|
312
|
+
title?: string;
|
|
313
|
+
personalInfo?: string;
|
|
314
|
+
emailPreferences?: string;
|
|
315
|
+
name?: string;
|
|
316
|
+
language?: string;
|
|
317
|
+
newsletter?: string;
|
|
318
|
+
announcements?: string;
|
|
319
|
+
saveButton?: string;
|
|
320
|
+
unsubscribeButton?: string;
|
|
321
|
+
saving?: string;
|
|
322
|
+
saved?: string;
|
|
323
|
+
unsubscribeConfirm?: string;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
interface BeforeSubscribeArgs {
|
|
327
|
+
data: Partial<Subscriber>;
|
|
328
|
+
req: any;
|
|
329
|
+
}
|
|
330
|
+
interface AfterSubscribeArgs {
|
|
331
|
+
doc: Subscriber;
|
|
332
|
+
req: any;
|
|
333
|
+
}
|
|
334
|
+
interface BeforeUnsubscribeArgs {
|
|
335
|
+
email: string;
|
|
336
|
+
req: any;
|
|
337
|
+
}
|
|
338
|
+
interface AfterUnsubscribeArgs {
|
|
339
|
+
doc: Subscriber;
|
|
340
|
+
req: any;
|
|
341
|
+
}
|
|
342
|
+
interface SurveyQuestion {
|
|
343
|
+
id: string;
|
|
344
|
+
question: string;
|
|
345
|
+
type: 'text' | 'select' | 'multiselect' | 'radio';
|
|
346
|
+
options?: string[];
|
|
347
|
+
required?: boolean;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export type { AfterSubscribeArgs, AfterUnsubscribeArgs, BeforeSubscribeArgs, BeforeUnsubscribeArgs, BroadcastProviderConfig, EmailProvider, MagicLinkEmailProps, NewsletterPluginConfig, PreferencesFormProps, ResendProviderConfig, SendEmailParams, SignupFormProps, Subscriber, SurveyQuestion, WelcomeEmailProps };
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,47 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-plugin-newsletter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Complete newsletter management plugin for Payload CMS with subscriber management, magic link authentication, and email service integration",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
7
|
-
"
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"import":
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
13
19
|
},
|
|
14
20
|
"./client": {
|
|
15
|
-
"import":
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/client.d.ts",
|
|
23
|
+
"default": "./dist/client.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/client.d.cts",
|
|
27
|
+
"default": "./dist/client.cjs"
|
|
28
|
+
}
|
|
18
29
|
},
|
|
19
30
|
"./types": {
|
|
20
|
-
"import":
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/types.d.ts",
|
|
33
|
+
"default": "./dist/types.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/types.d.cts",
|
|
37
|
+
"default": "./dist/types.cjs"
|
|
38
|
+
}
|
|
23
39
|
},
|
|
24
40
|
"./components": {
|
|
25
|
-
"import":
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/components.d.ts",
|
|
43
|
+
"default": "./dist/components.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/components.d.cts",
|
|
47
|
+
"default": "./dist/components.cjs"
|
|
48
|
+
}
|
|
28
49
|
}
|
|
29
50
|
},
|
|
30
51
|
"scripts": {
|
|
31
|
-
"build": "
|
|
32
|
-
"build:
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"build:legacy": "bun run build:swc && bun run build:types",
|
|
54
|
+
"build:swc": "swc ./src -d ./dist --copy-files --ignore '**/*.test.ts' --ignore '**/*.test.tsx' --ignore '**/__tests__/**'",
|
|
33
55
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
34
|
-
"dev": "
|
|
56
|
+
"dev": "tsup --watch",
|
|
35
57
|
"clean": "rimraf dist",
|
|
36
58
|
"lint": "eslint src",
|
|
37
59
|
"typecheck": "tsc --noEmit",
|
|
38
|
-
"test": "vitest",
|
|
39
|
-
"test:unit": "vitest run",
|
|
40
|
-
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
41
|
-
"test:security": "vitest run --config vitest.integration.config.ts src/__tests__/security",
|
|
42
|
-
"test:watch": "vitest watch",
|
|
43
|
-
"test:coverage": "vitest run --coverage",
|
|
44
|
-
"test:ui": "vitest --ui",
|
|
60
|
+
"test": "npm exec vitest run",
|
|
61
|
+
"test:unit": "npm exec vitest run",
|
|
62
|
+
"test:integration": "npm exec vitest run -- --config vitest.integration.config.ts",
|
|
63
|
+
"test:security": "npm exec vitest run -- --config vitest.integration.config.ts src/__tests__/security",
|
|
64
|
+
"test:watch": "npm exec vitest watch",
|
|
65
|
+
"test:coverage": "npm exec vitest run -- --coverage",
|
|
66
|
+
"test:ui": "npm exec vitest -- --ui",
|
|
45
67
|
"generate:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
46
68
|
"prepublishOnly": "bun run clean && bun run build",
|
|
47
69
|
"release:patch": "./scripts/release.sh patch",
|
|
@@ -116,6 +138,7 @@
|
|
|
116
138
|
"react": "^18.3.0",
|
|
117
139
|
"react-dom": "^18.3.0",
|
|
118
140
|
"rimraf": "^6.0.0",
|
|
141
|
+
"tsup": "^8.3.5",
|
|
119
142
|
"typescript": "^5.5.0",
|
|
120
143
|
"vitest": "^3.2.3"
|
|
121
144
|
},
|