payload-plugin-newsletter 0.25.9 → 0.25.11
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 +9 -0
- package/dist/collections.cjs +29 -61
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +29 -61
- package/dist/collections.js.map +1 -1
- package/dist/fields.cjs +4 -38
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.js +4 -38
- package/dist/fields.js.map +1 -1
- package/dist/server.js +29 -61
- package/dist/utils.cjs +2 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.25.11] - 2025-12-11
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
- Fixed LinkFeature configuration causing URLs to disappear in the Lexical editor link drawer
|
|
5
|
+
- The custom `fields` array was replacing Payload's default fields, removing the crucial `linkType` field
|
|
6
|
+
- Now uses default LinkFeature fields which include all required fields for the drawer UI to work correctly
|
|
7
|
+
- Fixed TypeScript errors with Payload logger API (pino signature requires object first, then message)
|
|
8
|
+
- Fixed `relationTo` type errors where `string | string[]` was passed to `findByID`
|
|
9
|
+
|
|
1
10
|
## [0.25.9] - 2025-08-19
|
|
2
11
|
|
|
3
12
|
### Fixed
|
package/dist/collections.cjs
CHANGED
|
@@ -754,25 +754,8 @@ var createEmailSafeFeatures = (additionalBlocks) => {
|
|
|
754
754
|
(0, import_richtext_lexical.ItalicFeature)(),
|
|
755
755
|
(0, import_richtext_lexical.UnderlineFeature)(),
|
|
756
756
|
(0, import_richtext_lexical.StrikethroughFeature)(),
|
|
757
|
-
// Links
|
|
758
|
-
(0, import_richtext_lexical.LinkFeature)(
|
|
759
|
-
fields: [
|
|
760
|
-
{
|
|
761
|
-
name: "url",
|
|
762
|
-
type: "text",
|
|
763
|
-
required: true,
|
|
764
|
-
admin: {
|
|
765
|
-
description: "Enter the full URL (including https://)"
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
{
|
|
769
|
-
name: "newTab",
|
|
770
|
-
type: "checkbox",
|
|
771
|
-
label: "Open in new tab",
|
|
772
|
-
defaultValue: false
|
|
773
|
-
}
|
|
774
|
-
]
|
|
775
|
-
}),
|
|
757
|
+
// Links - use default fields to ensure drawer UI works correctly
|
|
758
|
+
(0, import_richtext_lexical.LinkFeature)(),
|
|
776
759
|
// Lists
|
|
777
760
|
(0, import_richtext_lexical.OrderedListFeature)(),
|
|
778
761
|
(0, import_richtext_lexical.UnorderedListFeature)(),
|
|
@@ -828,25 +811,8 @@ var createEmailLexicalEditor = (customBlocks = []) => {
|
|
|
828
811
|
(0, import_richtext_lexical.ItalicFeature)(),
|
|
829
812
|
(0, import_richtext_lexical.UnderlineFeature)(),
|
|
830
813
|
(0, import_richtext_lexical.StrikethroughFeature)(),
|
|
831
|
-
// Links
|
|
832
|
-
(0, import_richtext_lexical.LinkFeature)(
|
|
833
|
-
fields: [
|
|
834
|
-
{
|
|
835
|
-
name: "url",
|
|
836
|
-
type: "text",
|
|
837
|
-
required: true,
|
|
838
|
-
admin: {
|
|
839
|
-
description: "Enter the full URL (including https://)"
|
|
840
|
-
}
|
|
841
|
-
},
|
|
842
|
-
{
|
|
843
|
-
name: "newTab",
|
|
844
|
-
type: "checkbox",
|
|
845
|
-
label: "Open in new tab",
|
|
846
|
-
defaultValue: false
|
|
847
|
-
}
|
|
848
|
-
]
|
|
849
|
-
}),
|
|
814
|
+
// Links - use default fields to ensure drawer UI works correctly
|
|
815
|
+
(0, import_richtext_lexical.LinkFeature)(),
|
|
850
816
|
// Lists
|
|
851
817
|
(0, import_richtext_lexical.OrderedListFeature)(),
|
|
852
818
|
(0, import_richtext_lexical.UnorderedListFeature)(),
|
|
@@ -1414,7 +1380,7 @@ async function getBroadcastConfig(req, pluginConfig) {
|
|
|
1414
1380
|
}
|
|
1415
1381
|
return pluginConfig.providers?.broadcast || null;
|
|
1416
1382
|
} catch (error) {
|
|
1417
|
-
req.payload.logger.error("Failed to get broadcast config from settings
|
|
1383
|
+
req.payload.logger.error({ error: String(error) }, "Failed to get broadcast config from settings");
|
|
1418
1384
|
return pluginConfig.providers?.broadcast || null;
|
|
1419
1385
|
}
|
|
1420
1386
|
}
|
|
@@ -1811,23 +1777,24 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
1811
1777
|
for (const field of blockConfig.fields) {
|
|
1812
1778
|
if (field.type === "upload" && field.relationTo && node.fields[field.name]) {
|
|
1813
1779
|
const fieldValue = node.fields[field.name];
|
|
1780
|
+
const collectionName = Array.isArray(field.relationTo) ? field.relationTo[0] : field.relationTo;
|
|
1814
1781
|
if (typeof fieldValue === "string" && fieldValue.match(/^[a-f0-9]{24}$/i)) {
|
|
1815
1782
|
try {
|
|
1816
1783
|
const media = await payload.findByID({
|
|
1817
|
-
collection:
|
|
1784
|
+
collection: collectionName,
|
|
1818
1785
|
id: fieldValue,
|
|
1819
1786
|
depth: 0
|
|
1820
1787
|
});
|
|
1821
1788
|
if (media) {
|
|
1822
1789
|
node.fields[field.name] = media;
|
|
1823
|
-
payload.logger?.info(
|
|
1790
|
+
payload.logger?.info({
|
|
1824
1791
|
mediaId: fieldValue,
|
|
1825
1792
|
mediaUrl: media.url,
|
|
1826
1793
|
filename: media.filename
|
|
1827
|
-
});
|
|
1794
|
+
}, `Populated ${field.name} for block ${blockType}`);
|
|
1828
1795
|
}
|
|
1829
1796
|
} catch (error) {
|
|
1830
|
-
payload.logger?.error(`Failed to populate ${field.name} for block ${blockType}
|
|
1797
|
+
payload.logger?.error({ error: String(error) }, `Failed to populate ${field.name} for block ${blockType}`);
|
|
1831
1798
|
}
|
|
1832
1799
|
}
|
|
1833
1800
|
}
|
|
@@ -1839,23 +1806,24 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
1839
1806
|
for (const arrayField of field.fields) {
|
|
1840
1807
|
if (arrayField.type === "upload" && arrayField.relationTo && arrayItem[arrayField.name]) {
|
|
1841
1808
|
const arrayFieldValue = arrayItem[arrayField.name];
|
|
1809
|
+
const arrayCollectionName = Array.isArray(arrayField.relationTo) ? arrayField.relationTo[0] : arrayField.relationTo;
|
|
1842
1810
|
if (typeof arrayFieldValue === "string" && arrayFieldValue.match(/^[a-f0-9]{24}$/i)) {
|
|
1843
1811
|
try {
|
|
1844
1812
|
const media = await payload.findByID({
|
|
1845
|
-
collection:
|
|
1813
|
+
collection: arrayCollectionName,
|
|
1846
1814
|
id: arrayFieldValue,
|
|
1847
1815
|
depth: 0
|
|
1848
1816
|
});
|
|
1849
1817
|
if (media) {
|
|
1850
1818
|
arrayItem[arrayField.name] = media;
|
|
1851
|
-
payload.logger?.info(
|
|
1819
|
+
payload.logger?.info({
|
|
1852
1820
|
mediaId: arrayFieldValue,
|
|
1853
1821
|
mediaUrl: media.url,
|
|
1854
1822
|
filename: media.filename
|
|
1855
|
-
});
|
|
1823
|
+
}, `Populated array ${arrayField.name} for block ${blockType}`);
|
|
1856
1824
|
}
|
|
1857
1825
|
} catch (error) {
|
|
1858
|
-
payload.logger?.error(`Failed to populate array ${arrayField.name} for block ${blockType}
|
|
1826
|
+
payload.logger?.error({ error: String(error) }, `Failed to populate array ${arrayField.name} for block ${blockType}`);
|
|
1859
1827
|
}
|
|
1860
1828
|
}
|
|
1861
1829
|
}
|
|
@@ -1899,14 +1867,14 @@ async function populateRichTextUploads(content, payload) {
|
|
|
1899
1867
|
});
|
|
1900
1868
|
if (media) {
|
|
1901
1869
|
node.value = media;
|
|
1902
|
-
payload.logger?.info(
|
|
1870
|
+
payload.logger?.info({
|
|
1903
1871
|
mediaId: node.value,
|
|
1904
1872
|
mediaUrl: media.url,
|
|
1905
1873
|
filename: media.filename
|
|
1906
|
-
});
|
|
1874
|
+
}, "Populated rich text upload node");
|
|
1907
1875
|
}
|
|
1908
1876
|
} catch (error) {
|
|
1909
|
-
payload.logger?.error(`Failed to populate rich text upload ${node.value}
|
|
1877
|
+
payload.logger?.error({ error: String(error) }, `Failed to populate rich text upload ${node.value}`);
|
|
1910
1878
|
}
|
|
1911
1879
|
}
|
|
1912
1880
|
if (node.children && Array.isArray(node.children)) {
|
|
@@ -2310,7 +2278,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2310
2278
|
return doc;
|
|
2311
2279
|
}
|
|
2312
2280
|
if (operation === "update") {
|
|
2313
|
-
req.payload.logger.info(
|
|
2281
|
+
req.payload.logger.info({
|
|
2314
2282
|
operation,
|
|
2315
2283
|
hasProviderId: !!doc.providerId,
|
|
2316
2284
|
hasExternalId: !!doc.externalId,
|
|
@@ -2318,7 +2286,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2318
2286
|
publishStatus: doc._status,
|
|
2319
2287
|
hasSubject: !!doc.subject,
|
|
2320
2288
|
hasContent: !!doc.contentSection?.content
|
|
2321
|
-
});
|
|
2289
|
+
}, "Broadcast afterChange update hook triggered");
|
|
2322
2290
|
try {
|
|
2323
2291
|
const providerConfig = await getBroadcastConfig(req, pluginConfig);
|
|
2324
2292
|
if (!providerConfig || !providerConfig.token) {
|
|
@@ -2405,10 +2373,10 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2405
2373
|
if (JSON.stringify(doc.audienceIds) !== JSON.stringify(previousDoc?.audienceIds)) {
|
|
2406
2374
|
updates.audienceIds = doc.audienceIds?.map((a) => a.audienceId);
|
|
2407
2375
|
}
|
|
2408
|
-
req.payload.logger.info(
|
|
2376
|
+
req.payload.logger.info({
|
|
2409
2377
|
providerId: doc.providerId,
|
|
2410
2378
|
updates
|
|
2411
|
-
});
|
|
2379
|
+
}, "Syncing broadcast updates to provider");
|
|
2412
2380
|
await provider.update(doc.providerId, updates);
|
|
2413
2381
|
req.payload.logger.info(`Broadcast ${doc.id} synced to provider successfully`);
|
|
2414
2382
|
} else {
|
|
@@ -2430,18 +2398,18 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2430
2398
|
...error.statusText
|
|
2431
2399
|
});
|
|
2432
2400
|
} else if (typeof error === "string") {
|
|
2433
|
-
req.payload.logger.error("Error is a string
|
|
2401
|
+
req.payload.logger.error({ errorValue: error }, "Error is a string");
|
|
2434
2402
|
} else if (error && typeof error === "object") {
|
|
2435
|
-
req.payload.logger.error(
|
|
2403
|
+
req.payload.logger.error({ errorValue: JSON.stringify(error, null, 2) }, "Error is an object");
|
|
2436
2404
|
} else {
|
|
2437
|
-
req.payload.logger.error("Unknown error type
|
|
2405
|
+
req.payload.logger.error({ errorType: typeof error }, "Unknown error type");
|
|
2438
2406
|
}
|
|
2439
|
-
req.payload.logger.error(
|
|
2407
|
+
req.payload.logger.error({
|
|
2440
2408
|
id: doc.id,
|
|
2441
2409
|
subject: doc.subject,
|
|
2442
2410
|
hasContent: !!doc.contentSection?.content,
|
|
2443
2411
|
contentType: doc.contentSection?.content ? typeof doc.contentSection.content : "none"
|
|
2444
|
-
});
|
|
2412
|
+
}, "Failed broadcast document (update operation)");
|
|
2445
2413
|
}
|
|
2446
2414
|
}
|
|
2447
2415
|
return doc;
|
|
@@ -2487,7 +2455,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2487
2455
|
...error.details
|
|
2488
2456
|
});
|
|
2489
2457
|
} else {
|
|
2490
|
-
req.payload.logger.error(`Failed to send broadcast ${doc.id}
|
|
2458
|
+
req.payload.logger.error({ error: String(error) }, `Failed to send broadcast ${doc.id}`);
|
|
2491
2459
|
}
|
|
2492
2460
|
await req.payload.update({
|
|
2493
2461
|
collection: "broadcasts",
|
|
@@ -2530,7 +2498,7 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2530
2498
|
...error.details
|
|
2531
2499
|
});
|
|
2532
2500
|
} else {
|
|
2533
|
-
req.payload.logger.error("Failed to delete broadcast from provider
|
|
2501
|
+
req.payload.logger.error({ error: String(error) }, "Failed to delete broadcast from provider");
|
|
2534
2502
|
}
|
|
2535
2503
|
}
|
|
2536
2504
|
return doc;
|