payload-plugin-newsletter 0.19.0 → 0.20.1

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.
@@ -1,4 +1,5 @@
1
1
  export { MagicLinkVerify, MagicLinkVerifyProps, NewsletterForm, PreferencesForm, UseNewsletterAuthOptions, UseNewsletterAuthReturn, createMagicLinkVerify, createNewsletterForm, createPreferencesForm, useNewsletterAuth } from './client.cjs';
2
+ import { NewsletterPluginConfig } from './types.cjs';
2
3
  export { PreferencesFormProps, SignupFormProps, Subscriber } from './types.cjs';
3
4
  import React from 'react';
4
5
  import { SerializedEditorState } from 'lexical';
@@ -14,6 +15,7 @@ interface EmailPreviewProps {
14
15
  warnings: string[];
15
16
  errors: string[];
16
17
  }) => void;
18
+ pluginConfig?: NewsletterPluginConfig;
17
19
  }
18
20
  declare const EmailPreview: React.FC<EmailPreviewProps>;
19
21
 
@@ -1,4 +1,5 @@
1
1
  export { MagicLinkVerify, MagicLinkVerifyProps, NewsletterForm, PreferencesForm, UseNewsletterAuthOptions, UseNewsletterAuthReturn, createMagicLinkVerify, createNewsletterForm, createPreferencesForm, useNewsletterAuth } from './client.js';
2
+ import { NewsletterPluginConfig } from './types.js';
2
3
  export { PreferencesFormProps, SignupFormProps, Subscriber } from './types.js';
3
4
  import React from 'react';
4
5
  import { SerializedEditorState } from 'lexical';
@@ -14,6 +15,7 @@ interface EmailPreviewProps {
14
15
  warnings: string[];
15
16
  errors: string[];
16
17
  }) => void;
18
+ pluginConfig?: NewsletterPluginConfig;
17
19
  }
18
20
  declare const EmailPreview: React.FC<EmailPreviewProps>;
19
21
 
@@ -920,6 +920,12 @@ async function convertToEmailSafeHtml(editorState, options) {
920
920
  const rawHtml = await lexicalToEmailHtml(editorState, options?.mediaUrl, options?.customBlockConverter);
921
921
  const sanitizedHtml = DOMPurify.sanitize(rawHtml, EMAIL_SAFE_CONFIG);
922
922
  if (options?.wrapInTemplate) {
923
+ if (options.customWrapper) {
924
+ return await Promise.resolve(options.customWrapper(sanitizedHtml, {
925
+ preheader: options.preheader,
926
+ subject: options.subject
927
+ }));
928
+ }
923
929
  return wrapInEmailTemplate(sanitizedHtml, options.preheader);
924
930
  }
925
931
  return sanitizedHtml;
@@ -1415,8 +1421,16 @@ function validateEmailHtml(html) {
1415
1421
  };
1416
1422
  }
1417
1423
 
1424
+ // src/contexts/PluginConfigContext.tsx
1425
+ import { createContext, useContext } from "react";
1426
+ import { jsx as jsx4 } from "react/jsx-runtime";
1427
+ var PluginConfigContext = createContext(null);
1428
+ var usePluginConfigOptional = () => {
1429
+ return useContext(PluginConfigContext);
1430
+ };
1431
+
1418
1432
  // src/components/Broadcasts/EmailPreview.tsx
1419
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1433
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1420
1434
  var SAMPLE_DATA = {
1421
1435
  "subscriber.name": "John Doe",
1422
1436
  "subscriber.firstName": "John",
@@ -1432,8 +1446,11 @@ var EmailPreview = ({
1432
1446
  subject,
1433
1447
  preheader,
1434
1448
  mode = "desktop",
1435
- onValidation
1449
+ onValidation,
1450
+ pluginConfig: propPluginConfig
1436
1451
  }) => {
1452
+ const contextPluginConfig = usePluginConfigOptional();
1453
+ const pluginConfig = propPluginConfig || contextPluginConfig;
1437
1454
  const [html, setHtml] = useState5("");
1438
1455
  const [loading, setLoading] = useState5(false);
1439
1456
  const [validationResult, setValidationResult] = useState5(null);
@@ -1446,9 +1463,13 @@ var EmailPreview = ({
1446
1463
  }
1447
1464
  setLoading(true);
1448
1465
  try {
1466
+ const emailPreviewConfig = pluginConfig?.customizations?.broadcasts?.emailPreview;
1449
1467
  const emailHtml = await convertToEmailSafeHtml(content, {
1450
- wrapInTemplate: true,
1451
- preheader
1468
+ wrapInTemplate: emailPreviewConfig?.wrapInTemplate ?? true,
1469
+ preheader,
1470
+ subject,
1471
+ customWrapper: emailPreviewConfig?.customWrapper,
1472
+ customBlockConverter: pluginConfig?.customizations?.broadcasts?.customBlockConverter
1452
1473
  });
1453
1474
  const personalizedHtml = replacePersonalizationTags(emailHtml, SAMPLE_DATA);
1454
1475
  const previewHtml = addEmailHeader(personalizedHtml, {
@@ -1468,7 +1489,7 @@ var EmailPreview = ({
1468
1489
  }
1469
1490
  };
1470
1491
  convertContent();
1471
- }, [content, subject, preheader, onValidation]);
1492
+ }, [content, subject, preheader, onValidation, pluginConfig]);
1472
1493
  useEffect4(() => {
1473
1494
  if (iframeRef.current && html) {
1474
1495
  const doc = iframeRef.current.contentDocument;
@@ -1488,7 +1509,7 @@ var EmailPreview = ({
1488
1509
  validationResult.errors.length,
1489
1510
  ")"
1490
1511
  ] }),
1491
- /* @__PURE__ */ jsx4("ul", { style: { margin: 0, paddingLeft: "20px", fontSize: "13px", color: "#dc2626" }, children: validationResult.errors.map((error, index) => /* @__PURE__ */ jsx4("li", { children: error }, index)) })
1512
+ /* @__PURE__ */ jsx5("ul", { style: { margin: 0, paddingLeft: "20px", fontSize: "13px", color: "#dc2626" }, children: validationResult.errors.map((error, index) => /* @__PURE__ */ jsx5("li", { children: error }, index)) })
1492
1513
  ] }),
1493
1514
  validationResult.warnings.length > 0 && /* @__PURE__ */ jsxs4("div", { children: [
1494
1515
  /* @__PURE__ */ jsxs4("h4", { style: { color: "#d97706", margin: "0 0 8px 0", fontSize: "14px" }, children: [
@@ -1496,10 +1517,10 @@ var EmailPreview = ({
1496
1517
  validationResult.warnings.length,
1497
1518
  ")"
1498
1519
  ] }),
1499
- /* @__PURE__ */ jsx4("ul", { style: { margin: 0, paddingLeft: "20px", fontSize: "13px", color: "#d97706" }, children: validationResult.warnings.map((warning, index) => /* @__PURE__ */ jsx4("li", { children: warning }, index)) })
1520
+ /* @__PURE__ */ jsx5("ul", { style: { margin: 0, paddingLeft: "20px", fontSize: "13px", color: "#d97706" }, children: validationResult.warnings.map((warning, index) => /* @__PURE__ */ jsx5("li", { children: warning }, index)) })
1500
1521
  ] })
1501
1522
  ] }),
1502
- /* @__PURE__ */ jsx4("div", { style: {
1523
+ /* @__PURE__ */ jsx5("div", { style: {
1503
1524
  flex: 1,
1504
1525
  display: "flex",
1505
1526
  alignItems: "center",
@@ -1507,14 +1528,14 @@ var EmailPreview = ({
1507
1528
  backgroundColor: "#f3f4f6",
1508
1529
  padding: "20px",
1509
1530
  overflow: "auto"
1510
- }, children: loading ? /* @__PURE__ */ jsx4("div", { style: { textAlign: "center", color: "#6b7280" }, children: /* @__PURE__ */ jsx4("p", { children: "Loading preview..." }) }) : html ? /* @__PURE__ */ jsx4("div", { style: {
1531
+ }, children: loading ? /* @__PURE__ */ jsx5("div", { style: { textAlign: "center", color: "#6b7280" }, children: /* @__PURE__ */ jsx5("p", { children: "Loading preview..." }) }) : html ? /* @__PURE__ */ jsx5("div", { style: {
1511
1532
  backgroundColor: "white",
1512
1533
  boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
1513
1534
  borderRadius: "8px",
1514
1535
  overflow: "hidden",
1515
1536
  transform: `scale(${viewport.scale})`,
1516
1537
  transformOrigin: "top center"
1517
- }, children: /* @__PURE__ */ jsx4(
1538
+ }, children: /* @__PURE__ */ jsx5(
1518
1539
  "iframe",
1519
1540
  {
1520
1541
  ref: iframeRef,
@@ -1527,7 +1548,7 @@ var EmailPreview = ({
1527
1548
  },
1528
1549
  sandbox: "allow-same-origin"
1529
1550
  }
1530
- ) }) : /* @__PURE__ */ jsx4("div", { style: { textAlign: "center", color: "#6b7280" }, children: /* @__PURE__ */ jsx4("p", { children: "Start typing to see the email preview" }) }) }),
1551
+ ) }) : /* @__PURE__ */ jsx5("div", { style: { textAlign: "center", color: "#6b7280" }, children: /* @__PURE__ */ jsx5("p", { children: "Start typing to see the email preview" }) }) }),
1531
1552
  validationResult && /* @__PURE__ */ jsxs4("div", { style: {
1532
1553
  padding: "12px 16px",
1533
1554
  borderTop: "1px solid #e5e7eb",
@@ -1575,11 +1596,12 @@ function escapeHtml2(text) {
1575
1596
  // src/components/Broadcasts/EmailPreviewField.tsx
1576
1597
  import { useState as useState6 } from "react";
1577
1598
  import { useFormFields } from "@payloadcms/ui";
1578
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1599
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1579
1600
  var EmailPreviewField = () => {
1580
1601
  const [previewMode, setPreviewMode] = useState6("desktop");
1581
1602
  const [isValid, setIsValid] = useState6(true);
1582
1603
  const [validationSummary, setValidationSummary] = useState6("");
1604
+ const pluginConfig = usePluginConfigOptional();
1583
1605
  const fields = useFormFields(([fields2]) => ({
1584
1606
  content: fields2["contentSection.content"],
1585
1607
  subject: fields2["subject"],
@@ -1636,9 +1658,9 @@ var EmailPreviewField = () => {
1636
1658
  backgroundColor: "#f9fafb"
1637
1659
  }, children: [
1638
1660
  /* @__PURE__ */ jsxs5("div", { style: { display: "flex", alignItems: "center", gap: "16px" }, children: [
1639
- /* @__PURE__ */ jsx5("h3", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Email Preview" }),
1661
+ /* @__PURE__ */ jsx6("h3", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Email Preview" }),
1640
1662
  /* @__PURE__ */ jsxs5("div", { style: { display: "flex", gap: "8px" }, children: [
1641
- /* @__PURE__ */ jsx5(
1663
+ /* @__PURE__ */ jsx6(
1642
1664
  "button",
1643
1665
  {
1644
1666
  type: "button",
@@ -1655,7 +1677,7 @@ var EmailPreviewField = () => {
1655
1677
  children: "Desktop"
1656
1678
  }
1657
1679
  ),
1658
- /* @__PURE__ */ jsx5(
1680
+ /* @__PURE__ */ jsx6(
1659
1681
  "button",
1660
1682
  {
1661
1683
  type: "button",
@@ -1673,7 +1695,7 @@ var EmailPreviewField = () => {
1673
1695
  }
1674
1696
  )
1675
1697
  ] }),
1676
- validationSummary && /* @__PURE__ */ jsx5("div", { style: {
1698
+ validationSummary && /* @__PURE__ */ jsx6("div", { style: {
1677
1699
  padding: "6px 12px",
1678
1700
  backgroundColor: isValid ? "#fef3c7" : "#fee2e2",
1679
1701
  color: isValid ? "#92400e" : "#991b1b",
@@ -1681,7 +1703,7 @@ var EmailPreviewField = () => {
1681
1703
  fontSize: "13px"
1682
1704
  }, children: validationSummary })
1683
1705
  ] }),
1684
- /* @__PURE__ */ jsx5(
1706
+ /* @__PURE__ */ jsx6(
1685
1707
  "button",
1686
1708
  {
1687
1709
  type: "button",
@@ -1699,14 +1721,15 @@ var EmailPreviewField = () => {
1699
1721
  }
1700
1722
  )
1701
1723
  ] }),
1702
- /* @__PURE__ */ jsx5("div", { style: { height: "600px" }, children: /* @__PURE__ */ jsx5(
1724
+ /* @__PURE__ */ jsx6("div", { style: { height: "600px" }, children: /* @__PURE__ */ jsx6(
1703
1725
  EmailPreview,
1704
1726
  {
1705
1727
  content: fields.content?.value || null,
1706
1728
  subject: fields.subject?.value || "Email Subject",
1707
1729
  preheader: fields.preheader?.value,
1708
1730
  mode: previewMode,
1709
- onValidation: handleValidation
1731
+ onValidation: handleValidation,
1732
+ pluginConfig: pluginConfig || void 0
1710
1733
  }
1711
1734
  ) })
1712
1735
  ] });
@@ -1715,7 +1738,7 @@ var EmailPreviewField = () => {
1715
1738
  // src/components/Broadcasts/BroadcastEditor.tsx
1716
1739
  import { useState as useState7, useCallback as useCallback2 } from "react";
1717
1740
  import { useField, useFormFields as useFormFields2 } from "@payloadcms/ui";
1718
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1741
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1719
1742
  var BroadcastEditor = (props) => {
1720
1743
  const { value } = useField({ path: props.path });
1721
1744
  const [showPreview, setShowPreview] = useState7(true);
@@ -1771,7 +1794,7 @@ var BroadcastEditor = (props) => {
1771
1794
  backgroundColor: "#f9fafb"
1772
1795
  }, children: [
1773
1796
  /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", gap: "16px" }, children: [
1774
- /* @__PURE__ */ jsx6(
1797
+ /* @__PURE__ */ jsx7(
1775
1798
  "button",
1776
1799
  {
1777
1800
  type: "button",
@@ -1789,7 +1812,7 @@ var BroadcastEditor = (props) => {
1789
1812
  }
1790
1813
  ),
1791
1814
  showPreview && /* @__PURE__ */ jsxs6("div", { style: { display: "flex", gap: "8px" }, children: [
1792
- /* @__PURE__ */ jsx6(
1815
+ /* @__PURE__ */ jsx7(
1793
1816
  "button",
1794
1817
  {
1795
1818
  type: "button",
@@ -1806,7 +1829,7 @@ var BroadcastEditor = (props) => {
1806
1829
  children: "Desktop"
1807
1830
  }
1808
1831
  ),
1809
- /* @__PURE__ */ jsx6(
1832
+ /* @__PURE__ */ jsx7(
1810
1833
  "button",
1811
1834
  {
1812
1835
  type: "button",
@@ -1824,7 +1847,7 @@ var BroadcastEditor = (props) => {
1824
1847
  }
1825
1848
  )
1826
1849
  ] }),
1827
- showPreview && validationSummary && /* @__PURE__ */ jsx6("div", { style: {
1850
+ showPreview && validationSummary && /* @__PURE__ */ jsx7("div", { style: {
1828
1851
  padding: "6px 12px",
1829
1852
  backgroundColor: isValid ? "#fef3c7" : "#fee2e2",
1830
1853
  color: isValid ? "#92400e" : "#991b1b",
@@ -1832,7 +1855,7 @@ var BroadcastEditor = (props) => {
1832
1855
  fontSize: "13px"
1833
1856
  }, children: validationSummary })
1834
1857
  ] }),
1835
- showPreview && /* @__PURE__ */ jsx6(
1858
+ showPreview && /* @__PURE__ */ jsx7(
1836
1859
  "button",
1837
1860
  {
1838
1861
  type: "button",
@@ -1851,12 +1874,12 @@ var BroadcastEditor = (props) => {
1851
1874
  )
1852
1875
  ] }),
1853
1876
  /* @__PURE__ */ jsxs6("div", { style: { flex: 1, display: "flex", overflow: "hidden" }, children: [
1854
- /* @__PURE__ */ jsx6("div", { style: {
1877
+ /* @__PURE__ */ jsx7("div", { style: {
1855
1878
  flex: showPreview ? "0 0 50%" : "1",
1856
1879
  overflow: "auto",
1857
1880
  borderRight: showPreview ? "1px solid #e5e7eb" : "none"
1858
- }, children: /* @__PURE__ */ jsx6("div", { style: { padding: "16px" }, children: /* @__PURE__ */ jsx6("div", { className: "rich-text-lexical" }) }) }),
1859
- showPreview && /* @__PURE__ */ jsx6("div", { style: { flex: "0 0 50%", overflow: "hidden" }, children: /* @__PURE__ */ jsx6(
1881
+ }, children: /* @__PURE__ */ jsx7("div", { style: { padding: "16px" }, children: /* @__PURE__ */ jsx7("div", { className: "rich-text-lexical" }) }) }),
1882
+ showPreview && /* @__PURE__ */ jsx7("div", { style: { flex: "0 0 50%", overflow: "hidden" }, children: /* @__PURE__ */ jsx7(
1860
1883
  EmailPreview,
1861
1884
  {
1862
1885
  content: value,
@@ -1875,7 +1898,7 @@ import { useState as useState8, useCallback as useCallback3 } from "react";
1875
1898
  import { useFormFields as useFormFields3 } from "@payloadcms/ui";
1876
1899
 
1877
1900
  // src/components/Broadcasts/PreviewControls.tsx
1878
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1901
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1879
1902
  var PreviewControls = ({
1880
1903
  onUpdate,
1881
1904
  device,
@@ -1918,7 +1941,7 @@ var PreviewControls = ({
1918
1941
  fontSize: "14px"
1919
1942
  });
1920
1943
  return /* @__PURE__ */ jsxs7("div", { style: controlsStyle, children: [
1921
- /* @__PURE__ */ jsx7(
1944
+ /* @__PURE__ */ jsx8(
1922
1945
  "button",
1923
1946
  {
1924
1947
  style: updateButtonStyle,
@@ -1936,9 +1959,9 @@ var PreviewControls = ({
1936
1959
  "aria-label": "Desktop view",
1937
1960
  children: [
1938
1961
  /* @__PURE__ */ jsxs7("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1939
- /* @__PURE__ */ jsx7("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", ry: "2" }),
1940
- /* @__PURE__ */ jsx7("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1941
- /* @__PURE__ */ jsx7("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1962
+ /* @__PURE__ */ jsx8("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", ry: "2" }),
1963
+ /* @__PURE__ */ jsx8("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1964
+ /* @__PURE__ */ jsx8("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1942
1965
  ] }),
1943
1966
  "Desktop"
1944
1967
  ]
@@ -1952,8 +1975,8 @@ var PreviewControls = ({
1952
1975
  "aria-label": "Mobile view",
1953
1976
  children: [
1954
1977
  /* @__PURE__ */ jsxs7("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1955
- /* @__PURE__ */ jsx7("rect", { x: "5", y: "2", width: "14", height: "20", rx: "2", ry: "2" }),
1956
- /* @__PURE__ */ jsx7("line", { x1: "12", y1: "18", x2: "12", y2: "18" })
1978
+ /* @__PURE__ */ jsx8("rect", { x: "5", y: "2", width: "14", height: "20", rx: "2", ry: "2" }),
1979
+ /* @__PURE__ */ jsx8("line", { x1: "12", y1: "18", x2: "12", y2: "18" })
1957
1980
  ] }),
1958
1981
  "Mobile"
1959
1982
  ]
@@ -1964,7 +1987,7 @@ var PreviewControls = ({
1964
1987
  };
1965
1988
 
1966
1989
  // src/components/Broadcasts/BroadcastInlinePreview.tsx
1967
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1990
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1968
1991
  var BroadcastInlinePreview = () => {
1969
1992
  const [device, setDevice] = useState8("desktop");
1970
1993
  const [isLoading, setIsLoading] = useState8(false);
@@ -2053,8 +2076,8 @@ var BroadcastInlinePreview = () => {
2053
2076
  };
2054
2077
  return /* @__PURE__ */ jsxs8("div", { style: containerStyle, children: [
2055
2078
  /* @__PURE__ */ jsxs8("div", { style: headerStyle, children: [
2056
- /* @__PURE__ */ jsx8("h3", { style: titleStyle, children: "Email Preview" }),
2057
- /* @__PURE__ */ jsx8(
2079
+ /* @__PURE__ */ jsx9("h3", { style: titleStyle, children: "Email Preview" }),
2080
+ /* @__PURE__ */ jsx9(
2058
2081
  "button",
2059
2082
  {
2060
2083
  onClick: () => showPreview ? setShowPreview(false) : updatePreview(),
@@ -2064,9 +2087,9 @@ var BroadcastInlinePreview = () => {
2064
2087
  }
2065
2088
  )
2066
2089
  ] }),
2067
- showPreview && /* @__PURE__ */ jsx8("div", { style: previewContainerStyle, children: error ? /* @__PURE__ */ jsxs8("div", { style: errorStyle, children: [
2068
- /* @__PURE__ */ jsx8("p", { style: { color: "#ef4444", margin: "0 0 1rem" }, children: error.message }),
2069
- /* @__PURE__ */ jsx8(
2090
+ showPreview && /* @__PURE__ */ jsx9("div", { style: previewContainerStyle, children: error ? /* @__PURE__ */ jsxs8("div", { style: errorStyle, children: [
2091
+ /* @__PURE__ */ jsx9("p", { style: { color: "#ef4444", margin: "0 0 1rem" }, children: error.message }),
2092
+ /* @__PURE__ */ jsx9(
2070
2093
  "button",
2071
2094
  {
2072
2095
  onClick: updatePreview,
@@ -2082,7 +2105,7 @@ var BroadcastInlinePreview = () => {
2082
2105
  }
2083
2106
  )
2084
2107
  ] }) : previewHtml ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
2085
- /* @__PURE__ */ jsx8(
2108
+ /* @__PURE__ */ jsx9(
2086
2109
  PreviewControls,
2087
2110
  {
2088
2111
  onUpdate: updatePreview,
@@ -2091,7 +2114,7 @@ var BroadcastInlinePreview = () => {
2091
2114
  isLoading
2092
2115
  }
2093
2116
  ),
2094
- /* @__PURE__ */ jsx8(
2117
+ /* @__PURE__ */ jsx9(
2095
2118
  "div",
2096
2119
  {
2097
2120
  style: {
@@ -2101,7 +2124,7 @@ var BroadcastInlinePreview = () => {
2101
2124
  justifyContent: "center",
2102
2125
  overflow: "auto"
2103
2126
  },
2104
- children: /* @__PURE__ */ jsx8(
2127
+ children: /* @__PURE__ */ jsx9(
2105
2128
  "div",
2106
2129
  {
2107
2130
  style: {
@@ -2112,7 +2135,7 @@ var BroadcastInlinePreview = () => {
2112
2135
  borderRadius: "8px",
2113
2136
  overflow: "hidden"
2114
2137
  },
2115
- children: /* @__PURE__ */ jsx8(
2138
+ children: /* @__PURE__ */ jsx9(
2116
2139
  "iframe",
2117
2140
  {
2118
2141
  srcDoc: previewHtml,
@@ -2134,9 +2157,9 @@ var BroadcastInlinePreview = () => {
2134
2157
  };
2135
2158
 
2136
2159
  // src/components/Broadcasts/BroadcastPreviewField.tsx
2137
- import { jsx as jsx9 } from "react/jsx-runtime";
2160
+ import { jsx as jsx10 } from "react/jsx-runtime";
2138
2161
  var BroadcastPreviewField = () => {
2139
- return /* @__PURE__ */ jsx9("div", { style: {
2162
+ return /* @__PURE__ */ jsx10("div", { style: {
2140
2163
  padding: "1rem",
2141
2164
  background: "#f9fafb",
2142
2165
  borderRadius: "4px",
@@ -2148,7 +2171,7 @@ var BroadcastPreviewField = () => {
2148
2171
  // src/components/Broadcasts/EmailRenderer.tsx
2149
2172
  import { useEffect as useEffect5, useState as useState9, useCallback as useCallback4, useRef as useRef2 } from "react";
2150
2173
  import { render } from "@react-email/render";
2151
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2174
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2152
2175
  var EmailRenderer = ({
2153
2176
  template,
2154
2177
  data,
@@ -2161,7 +2184,7 @@ var EmailRenderer = ({
2161
2184
  const renderEmail = useCallback4(async () => {
2162
2185
  try {
2163
2186
  const TemplateComponent = template;
2164
- const element = /* @__PURE__ */ jsx10(TemplateComponent, { ...data });
2187
+ const element = /* @__PURE__ */ jsx11(TemplateComponent, { ...data });
2165
2188
  const html = await render(element, {
2166
2189
  pretty: true
2167
2190
  });
@@ -2216,8 +2239,8 @@ var EmailRenderer = ({
2216
2239
  };
2217
2240
  if (error) {
2218
2241
  return /* @__PURE__ */ jsxs9("div", { style: errorStyle, children: [
2219
- /* @__PURE__ */ jsx10("h3", { style: { color: "#ef4444", margin: "0 0 1rem" }, children: "Template Render Error" }),
2220
- /* @__PURE__ */ jsx10("pre", { style: {
2242
+ /* @__PURE__ */ jsx11("h3", { style: { color: "#ef4444", margin: "0 0 1rem" }, children: "Template Render Error" }),
2243
+ /* @__PURE__ */ jsx11("pre", { style: {
2221
2244
  background: "#f9fafb",
2222
2245
  padding: "1rem",
2223
2246
  borderRadius: "4px",
@@ -2228,7 +2251,7 @@ var EmailRenderer = ({
2228
2251
  }, children: error.message })
2229
2252
  ] });
2230
2253
  }
2231
- return /* @__PURE__ */ jsx10("div", { style: containerStyle, children: /* @__PURE__ */ jsx10(
2254
+ return /* @__PURE__ */ jsx11("div", { style: containerStyle, children: /* @__PURE__ */ jsx11(
2232
2255
  "iframe",
2233
2256
  {
2234
2257
  ref: iframeRef,
@@ -2240,7 +2263,7 @@ var EmailRenderer = ({
2240
2263
  };
2241
2264
 
2242
2265
  // src/components/Broadcasts/StatusBadge.tsx
2243
- import { jsx as jsx11 } from "react/jsx-runtime";
2266
+ import { jsx as jsx12 } from "react/jsx-runtime";
2244
2267
  var statusConfig = {
2245
2268
  ["draft" /* DRAFT */]: {
2246
2269
  label: "Draft",
@@ -2288,7 +2311,7 @@ var statusConfig = {
2288
2311
  var StatusBadge = ({ cellData }) => {
2289
2312
  const status = cellData;
2290
2313
  const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
2291
- return /* @__PURE__ */ jsx11(
2314
+ return /* @__PURE__ */ jsx12(
2292
2315
  "span",
2293
2316
  {
2294
2317
  style: {
@@ -2323,21 +2346,21 @@ import {
2323
2346
  Section,
2324
2347
  Text
2325
2348
  } from "@react-email/components";
2326
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2349
+ import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
2327
2350
  var DefaultBroadcastTemplate = ({
2328
2351
  subject,
2329
2352
  preheader,
2330
2353
  content
2331
2354
  }) => {
2332
2355
  return /* @__PURE__ */ jsxs10(Html, { children: [
2333
- /* @__PURE__ */ jsx12(Head, {}),
2334
- /* @__PURE__ */ jsx12(Preview, { children: preheader || subject }),
2335
- /* @__PURE__ */ jsx12(Body, { style: main, children: /* @__PURE__ */ jsxs10(Container, { style: container, children: [
2336
- /* @__PURE__ */ jsx12(Section, { style: contentSection, children: /* @__PURE__ */ jsx12("div", { dangerouslySetInnerHTML: { __html: content } }) }),
2337
- /* @__PURE__ */ jsx12(Hr, { style: divider }),
2356
+ /* @__PURE__ */ jsx13(Head, {}),
2357
+ /* @__PURE__ */ jsx13(Preview, { children: preheader || subject }),
2358
+ /* @__PURE__ */ jsx13(Body, { style: main, children: /* @__PURE__ */ jsxs10(Container, { style: container, children: [
2359
+ /* @__PURE__ */ jsx13(Section, { style: contentSection, children: /* @__PURE__ */ jsx13("div", { dangerouslySetInnerHTML: { __html: content } }) }),
2360
+ /* @__PURE__ */ jsx13(Hr, { style: divider }),
2338
2361
  /* @__PURE__ */ jsxs10(Section, { style: footer, children: [
2339
- /* @__PURE__ */ jsx12(Text, { style: footerText, children: "You're receiving this email because you subscribed to our newsletter." }),
2340
- /* @__PURE__ */ jsx12(Text, { style: footerText, children: /* @__PURE__ */ jsx12(Link, { href: "{{unsubscribe_url}}", style: footerLink, children: "Unsubscribe" }) })
2362
+ /* @__PURE__ */ jsx13(Text, { style: footerText, children: "You're receiving this email because you subscribed to our newsletter." }),
2363
+ /* @__PURE__ */ jsx13(Text, { style: footerText, children: /* @__PURE__ */ jsx13(Link, { href: "{{unsubscribe_url}}", style: footerLink, children: "Unsubscribe" }) })
2341
2364
  ] })
2342
2365
  ] }) })
2343
2366
  ] });