payload-plugin-newsletter 0.25.6 → 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 +18 -0
- package/dist/{broadcast-7DI2WOB3.js → broadcast-TKESOAJN.js} +1 -1
- package/dist/{chunk-LLPN5SQN.js → chunk-KETHRCG7.js} +2 -1
- package/dist/collections.cjs +15 -6
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +15 -6
- package/dist/collections.js.map +1 -1
- package/dist/server.js +20 -12
- 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(
|
|
@@ -4899,9 +4909,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4899
4909
|
req.payload.logger.error("Error details:", {
|
|
4900
4910
|
message: error.message,
|
|
4901
4911
|
stack: error.stack,
|
|
4902
|
-
name: error.name
|
|
4903
|
-
// Check for any additional properties
|
|
4904
|
-
...error
|
|
4912
|
+
name: error.name
|
|
4905
4913
|
});
|
|
4906
4914
|
} else {
|
|
4907
4915
|
req.payload.logger.error("Raw error:", error);
|
|
@@ -4922,7 +4930,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
4922
4930
|
req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
|
|
4923
4931
|
return doc;
|
|
4924
4932
|
}
|
|
4925
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
4933
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
4926
4934
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
4927
4935
|
if (!doc.providerId) {
|
|
4928
4936
|
req.payload.logger.warn(`Broadcast ${doc.id} has no providerId - provider sync skipped. This shouldn't happen with immediate creation.`);
|
|
@@ -5028,7 +5036,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
5028
5036
|
return doc;
|
|
5029
5037
|
}
|
|
5030
5038
|
if (broadcastConfig && broadcastConfig.token) {
|
|
5031
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
5039
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
5032
5040
|
const provider = new BroadcastApiProvider2(broadcastConfig);
|
|
5033
5041
|
await provider.send(doc.providerId);
|
|
5034
5042
|
}
|
|
@@ -5079,7 +5087,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
5079
5087
|
req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
|
|
5080
5088
|
return doc;
|
|
5081
5089
|
}
|
|
5082
|
-
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-
|
|
5090
|
+
const { BroadcastApiProvider: BroadcastApiProvider2 } = await import("./broadcast-TKESOAJN.js");
|
|
5083
5091
|
const provider = new BroadcastApiProvider2(providerConfig);
|
|
5084
5092
|
const capabilities = provider.getCapabilities();
|
|
5085
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",
|