payload-plugin-newsletter 0.14.1 → 0.14.2

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/dist/index.js CHANGED
@@ -775,8 +775,15 @@ var SignInEmail = (props) => {
775
775
 
776
776
  // src/emails/render.tsx
777
777
  import { jsx as jsx4 } from "react/jsx-runtime";
778
- async function renderEmail(template, data) {
778
+ async function renderEmail(template, data, config) {
779
779
  try {
780
+ if (config?.customTemplates) {
781
+ const customTemplate = config.customTemplates[template];
782
+ if (customTemplate) {
783
+ const CustomComponent = customTemplate;
784
+ return render(/* @__PURE__ */ jsx4(CustomComponent, { ...data }));
785
+ }
786
+ }
780
787
  switch (template) {
781
788
  case "magic-link": {
782
789
  const magicLinkData = data;
@@ -1054,7 +1061,7 @@ var createSubscribersCollection = (pluginConfig) => {
1054
1061
  siteName: settings?.brandSettings?.siteName || "Newsletter",
1055
1062
  preferencesUrl: `${serverURL}/account/preferences`
1056
1063
  // This could be customized
1057
- });
1064
+ }, pluginConfig);
1058
1065
  await emailService.send({
1059
1066
  to: doc.email,
1060
1067
  subject: settings?.brandSettings?.siteName ? `Welcome to ${settings.brandSettings.siteName}!` : "Welcome!",
@@ -2080,7 +2087,7 @@ var createSubscribeEndpoint = (config) => {
2080
2087
  email: updated.email,
2081
2088
  siteName: settings2?.brandSettings?.siteName || "Newsletter",
2082
2089
  siteUrl: req.payload.config.serverURL || ""
2083
- });
2090
+ }, config);
2084
2091
  await emailService.send({
2085
2092
  to: updated.email,
2086
2093
  subject: `Welcome back to ${settings2?.brandSettings?.siteName || "our newsletter"}!`,
@@ -2116,7 +2123,7 @@ var createSubscribeEndpoint = (config) => {
2116
2123
  email: subscriber2.email,
2117
2124
  siteName: settings2?.brandSettings?.siteName || "Newsletter",
2118
2125
  expiresIn: config.auth?.tokenExpiration || "7d"
2119
- });
2126
+ }, config);
2120
2127
  await emailService.send({
2121
2128
  to: subscriber2.email,
2122
2129
  subject: `Sign in to ${settings2?.brandSettings?.siteName || "your account"}`,
@@ -2204,7 +2211,7 @@ var createSubscribeEndpoint = (config) => {
2204
2211
  email: subscriber.email,
2205
2212
  siteName: settings?.brandSettings?.siteName || "Newsletter",
2206
2213
  expiresIn: config.auth?.tokenExpiration || "7d"
2207
- });
2214
+ }, config);
2208
2215
  await emailService.send({
2209
2216
  to: subscriber.email,
2210
2217
  subject: settings?.brandSettings?.siteName ? `Verify your email for ${settings.brandSettings.siteName}` : "Verify your email",
@@ -2328,7 +2335,7 @@ var createVerifyMagicLinkEndpoint = (config) => {
2328
2335
  siteName: settings?.brandSettings?.siteName || "Newsletter",
2329
2336
  preferencesUrl: `${serverURL}/account/preferences`
2330
2337
  // This could be customized
2331
- });
2338
+ }, config);
2332
2339
  await emailService.send({
2333
2340
  to: subscriber.email,
2334
2341
  subject: settings?.brandSettings?.siteName ? `Welcome to ${settings.brandSettings.siteName}!` : "Welcome!",
@@ -2713,7 +2720,7 @@ var createSigninEndpoint = (config) => {
2713
2720
  email: subscriber.email,
2714
2721
  siteName: settings?.brandSettings?.siteName || "Newsletter",
2715
2722
  expiresIn: config.auth?.tokenExpiration || "7d"
2716
- });
2723
+ }, config);
2717
2724
  await emailService.send({
2718
2725
  to: subscriber.email,
2719
2726
  subject: settings?.brandSettings?.siteName ? `Sign in to ${settings.brandSettings.siteName}` : "Sign in to your account",