payload-plugin-newsletter 0.25.7 → 0.25.8
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 +11 -0
- package/dist/{broadcast-KSKQRQB6.js → broadcast-TKESOAJN.js} +1 -1
- package/dist/{chunk-KZDNTLVF.js → chunk-KETHRCG7.js} +1 -0
- package/dist/collections.cjs +13 -2
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +13 -2
- package/dist/collections.js.map +1 -1
- package/dist/server.js +19 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
BroadcastApiProvider,
|
|
4
4
|
BroadcastProviderError,
|
|
5
5
|
NewsletterProviderError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KETHRCG7.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/access.ts
|
|
9
9
|
var isAdmin = (user, config) => {
|
|
@@ -4102,7 +4102,7 @@ var createSendBroadcastEndpoint = (config, collectionSlug) => {
|
|
|
4102
4102
|
error: "Broadcast provider not configured in Newsletter Settings or environment variables"
|
|
4103
4103
|
}, { status: 500 });
|
|
4104
4104
|
}
|
|
4105
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
4105
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
4106
4106
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4107
4107
|
const broadcast = await provider.send(broadcastDoc.providerId, data);
|
|
4108
4108
|
await req.payload.update({
|
|
@@ -4205,7 +4205,7 @@ var createScheduleBroadcastEndpoint = (config, collectionSlug) => {
|
|
|
4205
4205
|
error: "Broadcast provider not configured"
|
|
4206
4206
|
}, { status: 500 });
|
|
4207
4207
|
}
|
|
4208
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
4208
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
4209
4209
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4210
4210
|
const broadcast = await provider.schedule(broadcastDoc.providerId, scheduledDate);
|
|
4211
4211
|
await req.payload.update({
|
|
@@ -4838,18 +4838,28 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4838
4838
|
if (!hasProviders) return doc;
|
|
4839
4839
|
if (operation === "create") {
|
|
4840
4840
|
try {
|
|
4841
|
-
req.payload.logger.info("Broadcast afterChange
|
|
4841
|
+
req.payload.logger.info("Broadcast afterChange CREATE hook (sync) - doc info:", {
|
|
4842
4842
|
docId: doc.id,
|
|
4843
4843
|
docIdType: typeof doc.id,
|
|
4844
4844
|
hasDoc: !!doc,
|
|
4845
|
-
operation
|
|
4845
|
+
operation,
|
|
4846
|
+
status: doc._status,
|
|
4847
|
+
hasExternalId: !!doc.externalId,
|
|
4848
|
+
hasProviderId: !!doc.providerId
|
|
4846
4849
|
});
|
|
4850
|
+
if (doc.externalId || doc.providerId) {
|
|
4851
|
+
req.payload.logger.info("Broadcast already has provider IDs, skipping creation", {
|
|
4852
|
+
externalId: doc.externalId,
|
|
4853
|
+
providerId: doc.providerId
|
|
4854
|
+
});
|
|
4855
|
+
return doc;
|
|
4856
|
+
}
|
|
4847
4857
|
const providerConfig = await getBroadcastConfig(req, pluginConfig);
|
|
4848
4858
|
if (!providerConfig || !providerConfig.token) {
|
|
4849
4859
|
req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
|
|
4850
4860
|
return doc;
|
|
4851
4861
|
}
|
|
4852
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
4862
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
4853
4863
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4854
4864
|
const subject = doc.subject || `Draft Broadcast ${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
4855
4865
|
const htmlContent = doc.contentSection?.content ? await convertToEmailSafeHtml(
|
|
@@ -4920,7 +4930,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4920
4930
|
req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
|
|
4921
4931
|
return doc;
|
|
4922
4932
|
}
|
|
4923
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
4933
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
4924
4934
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4925
4935
|
if (!doc.providerId) {
|
|
4926
4936
|
req.payload.logger.warn(`Broadcast ${doc.id} has no providerId - provider sync skipped. This shouldn't happen with immediate creation.`);
|
|
@@ -5026,7 +5036,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
5026
5036
|
return doc;
|
|
5027
5037
|
}
|
|
5028
5038
|
if (broadcastConfig && broadcastConfig.token) {
|
|
5029
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
5039
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
5030
5040
|
const provider = new BroadcastApiProvider2(broadcastConfig);
|
|
5031
5041
|
await provider.send(doc.providerId);
|
|
5032
5042
|
}
|
|
@@ -5077,7 +5087,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
5077
5087
|
req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
|
|
5078
5088
|
return doc;
|
|
5079
5089
|
}
|
|
5080
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
5090
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
5081
5091
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
5082
5092
|
const capabilities = provider.getCapabilities();
|
|
5083
5093
|
if (capabilities.editableStatuses.includes(doc.sendStatus)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-plugin-newsletter",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.8",
|
|
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
6
|
"main": "./dist/index.js",
|