@kontakto/email-template-editor 1.6.0 → 2.0.0
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/README.md +60 -4
- package/dist/index.cjs +1346 -727
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -14
- package/dist/index.d.ts +152 -14
- package/dist/index.js +1244 -626
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import DOMPurify from 'dompurify';
|
|
2
2
|
import { marked, Renderer } from 'marked';
|
|
3
|
-
import
|
|
3
|
+
import React60, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useContext, useState, useCallback, Fragment } from 'react';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { renderToStaticMarkup as renderToStaticMarkup$1 } from 'react-dom/server';
|
|
6
6
|
import { createTheme, alpha, lighten, darken } from '@mui/material/styles';
|
|
7
|
-
import { MenuItem, Stack, ThemeProvider, CssBaseline, useTheme, Drawer, Box, Tabs, Tab, Typography,
|
|
7
|
+
import { MenuItem, Stack, ThemeProvider, CssBaseline, useTheme, Drawer, Box, Tabs, Tab, Typography, Tooltip, IconButton, TextField, InputAdornment, Chip, CircularProgress, Alert, Divider as Divider$1, ToggleButtonGroup, ToggleButton, Snackbar, Dialog, DialogTitle, DialogContent, DialogActions, Button as Button$1, InputBase, FormControlLabel, Switch, InputLabel, Menu, Slider, ButtonBase, Paper, Fade } from '@mui/material';
|
|
8
8
|
import { create } from 'zustand';
|
|
9
|
-
import { MonitorOutlined, PhoneIphoneOutlined, EditOutlined, PreviewOutlined, CodeOutlined, SubjectOutlined, DataObjectOutlined, Add, SaveOutlined, LastPageOutlined, AppRegistrationOutlined,
|
|
9
|
+
import { AddOutlined, SearchOutlined, MonitorOutlined, PhoneIphoneOutlined, LibraryAddOutlined, ContentCopyOutlined, DriveFileRenameOutlineOutlined, FileUploadOutlined, FileDownloadOutlined, DeleteOutlined, EditOutlined, PreviewOutlined, CodeOutlined, SubjectOutlined, DataObjectOutlined, Add, SaveOutlined, LastPageOutlined, AppRegistrationOutlined, DeleteOutline, FirstPageOutlined, MenuOutlined, RoundedCornerOutlined, AspectRatioOutlined, HeightOutlined, VerticalAlignTopOutlined, VerticalAlignCenterOutlined, VerticalAlignBottomOutlined, SpaceBarOutlined, CloseOutlined, AlignVerticalTopOutlined, AlignVerticalBottomOutlined, AlignHorizontalLeftOutlined, AlignHorizontalRightOutlined, FormatAlignLeftOutlined, FormatAlignCenterOutlined, FormatAlignRightOutlined, TextFieldsOutlined, ArrowUpwardOutlined, ArrowDownwardOutlined, HMobiledataOutlined, NotesOutlined, SmartButtonOutlined, ImageOutlined, AccountCircleOutlined, ContactMailOutlined, BusinessOutlined, HorizontalRuleOutlined, Crop32Outlined, HtmlOutlined, ViewColumnOutlined } from '@mui/icons-material';
|
|
10
10
|
import { HexColorPicker, HexColorInput } from 'react-colorful';
|
|
11
11
|
import hljs from 'highlight.js';
|
|
12
12
|
import jsonHighlighter from 'highlight.js/lib/languages/json';
|
|
@@ -159,7 +159,7 @@ function renderMarkdownString(str) {
|
|
|
159
159
|
function EmailMarkdown(_a) {
|
|
160
160
|
var _b = _a, { markdown } = _b, props = __objRest(_b, ["markdown"]);
|
|
161
161
|
const data = useMemo(() => renderMarkdownString(markdown), [markdown]);
|
|
162
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ React60.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
|
|
163
163
|
}
|
|
164
164
|
var FONT_FAMILY_SCHEMA = z.enum([
|
|
165
165
|
"MODERN_SANS",
|
|
@@ -235,9 +235,9 @@ function Text({ style, props }) {
|
|
|
235
235
|
};
|
|
236
236
|
const text = (_f = props == null ? void 0 : props.text) != null ? _f : TextPropsDefaults.text;
|
|
237
237
|
if (props == null ? void 0 : props.markdown) {
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ React60.createElement(EmailMarkdown, { style: wStyle, markdown: text });
|
|
239
239
|
}
|
|
240
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle }, text);
|
|
241
241
|
}
|
|
242
242
|
var PADDING_SCHEMA2 = z.object({
|
|
243
243
|
top: z.number(),
|
|
@@ -286,7 +286,7 @@ function Avatar({ style, props }) {
|
|
|
286
286
|
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
287
287
|
padding: getPadding2(style == null ? void 0 : style.padding)
|
|
288
288
|
};
|
|
289
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ React60.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React60.createElement(
|
|
290
290
|
"img",
|
|
291
291
|
{
|
|
292
292
|
alt,
|
|
@@ -434,14 +434,14 @@ function Button({ style, props }) {
|
|
|
434
434
|
padding: `${padding[0]}px ${padding[1]}px`,
|
|
435
435
|
textDecoration: "none"
|
|
436
436
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React60.createElement(
|
|
438
438
|
"span",
|
|
439
439
|
{
|
|
440
440
|
dangerouslySetInnerHTML: {
|
|
441
441
|
__html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
), /* @__PURE__ */
|
|
444
|
+
), /* @__PURE__ */ React60.createElement("span", null, text), /* @__PURE__ */ React60.createElement(
|
|
445
445
|
"span",
|
|
446
446
|
{
|
|
447
447
|
dangerouslySetInnerHTML: {
|
|
@@ -490,7 +490,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
490
490
|
contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
|
|
491
491
|
fixedWidths: props == null ? void 0 : props.fixedWidths
|
|
492
492
|
};
|
|
493
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle }, /* @__PURE__ */ React60.createElement(
|
|
494
494
|
"table",
|
|
495
495
|
{
|
|
496
496
|
align: "center",
|
|
@@ -499,7 +499,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
499
499
|
border: 0,
|
|
500
500
|
style: { tableLayout: "fixed", borderCollapse: "collapse" }
|
|
501
501
|
},
|
|
502
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ React60.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React60.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React60.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React60.createElement(TableCell, { index: 2, props: blockProps, columns })))
|
|
503
503
|
));
|
|
504
504
|
}
|
|
505
505
|
function TableCell({ index, props, columns }) {
|
|
@@ -517,7 +517,7 @@ function TableCell({ index, props, columns }) {
|
|
|
517
517
|
width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
|
|
518
518
|
};
|
|
519
519
|
const children = (_e = columns && columns[index]) != null ? _e : null;
|
|
520
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ React60.createElement("td", { style }, children);
|
|
521
521
|
}
|
|
522
522
|
function getPaddingBefore(index, { columnsGap, columnsCount }) {
|
|
523
523
|
if (index === 0) {
|
|
@@ -579,9 +579,9 @@ function Container({ style, children }) {
|
|
|
579
579
|
padding: getPadding5(style == null ? void 0 : style.padding)
|
|
580
580
|
};
|
|
581
581
|
if (!children) {
|
|
582
|
-
return /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle });
|
|
583
583
|
}
|
|
584
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle }, children);
|
|
585
585
|
}
|
|
586
586
|
var container_default = Container;
|
|
587
587
|
var COLOR_SCHEMA5 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
@@ -615,7 +615,7 @@ function Divider({ style, props }) {
|
|
|
615
615
|
};
|
|
616
616
|
const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
|
|
617
617
|
const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
|
|
618
|
-
return /* @__PURE__ */
|
|
618
|
+
return /* @__PURE__ */ React60.createElement("div", { style: st }, /* @__PURE__ */ React60.createElement(
|
|
619
619
|
"hr",
|
|
620
620
|
{
|
|
621
621
|
style: {
|
|
@@ -705,11 +705,11 @@ function Heading({ props, style }) {
|
|
|
705
705
|
};
|
|
706
706
|
switch (level) {
|
|
707
707
|
case "h1":
|
|
708
|
-
return /* @__PURE__ */
|
|
708
|
+
return /* @__PURE__ */ React60.createElement("h1", { style: hStyle }, text);
|
|
709
709
|
case "h2":
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ React60.createElement("h2", { style: hStyle }, text);
|
|
711
711
|
case "h3":
|
|
712
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React60.createElement("h3", { style: hStyle }, text);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
function getFontSize(level) {
|
|
@@ -791,9 +791,9 @@ function Html({ style, props }) {
|
|
|
791
791
|
padding: getPadding8(style == null ? void 0 : style.padding)
|
|
792
792
|
};
|
|
793
793
|
if (!children) {
|
|
794
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle });
|
|
795
795
|
}
|
|
796
|
-
return /* @__PURE__ */
|
|
796
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
797
797
|
}
|
|
798
798
|
var html_default = Html;
|
|
799
799
|
var PADDING_SCHEMA9 = z.object({
|
|
@@ -829,7 +829,7 @@ function Image({ style, props }) {
|
|
|
829
829
|
const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
|
|
830
830
|
const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
|
|
831
831
|
const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
|
|
832
|
-
const imageElement = /* @__PURE__ */
|
|
832
|
+
const imageElement = /* @__PURE__ */ React60.createElement(
|
|
833
833
|
"img",
|
|
834
834
|
{
|
|
835
835
|
alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
|
|
@@ -849,9 +849,9 @@ function Image({ style, props }) {
|
|
|
849
849
|
}
|
|
850
850
|
);
|
|
851
851
|
if (!linkHref) {
|
|
852
|
-
return /* @__PURE__ */
|
|
852
|
+
return /* @__PURE__ */ React60.createElement("div", { style: sectionStyle }, imageElement);
|
|
853
853
|
}
|
|
854
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React60.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React60.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
|
|
855
855
|
}
|
|
856
856
|
var image_default = Image;
|
|
857
857
|
var FONT_FAMILY_SCHEMA5 = z.enum([
|
|
@@ -997,7 +997,7 @@ function Signature({ style, props }) {
|
|
|
997
997
|
color: linkColor,
|
|
998
998
|
textDecoration: "none"
|
|
999
999
|
};
|
|
1000
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
1000
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React60.createElement(
|
|
1001
1001
|
"img",
|
|
1002
1002
|
{
|
|
1003
1003
|
src: imageUrl,
|
|
@@ -1016,18 +1016,18 @@ function Signature({ style, props }) {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
) : null;
|
|
1018
1018
|
const contactParts = [];
|
|
1019
|
-
if (email) contactParts.push(/* @__PURE__ */
|
|
1020
|
-
if (phone) contactParts.push(/* @__PURE__ */
|
|
1019
|
+
if (email) contactParts.push(/* @__PURE__ */ React60.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
|
|
1020
|
+
if (phone) contactParts.push(/* @__PURE__ */ React60.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
|
|
1021
1021
|
if (website) {
|
|
1022
1022
|
const href = website.startsWith("http") ? website : `https://${website}`;
|
|
1023
|
-
contactParts.push(/* @__PURE__ */
|
|
1023
|
+
contactParts.push(/* @__PURE__ */ React60.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
|
|
1024
1024
|
}
|
|
1025
|
-
const textContent = /* @__PURE__ */
|
|
1026
|
-
const greetingElement = greeting ? /* @__PURE__ */
|
|
1025
|
+
const textContent = /* @__PURE__ */ React60.createElement("div", null, name && /* @__PURE__ */ React60.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React60.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React60.createElement(React60.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React60.createElement("span", { style: detailStyle }, " \xB7 "), part))));
|
|
1026
|
+
const greetingElement = greeting ? /* @__PURE__ */ React60.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
1027
1027
|
if (layout === "vertical") {
|
|
1028
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React60.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
1029
1029
|
}
|
|
1030
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React60.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React60.createElement("tbody", null, /* @__PURE__ */ React60.createElement("tr", null, imageElement && /* @__PURE__ */ React60.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React60.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
1031
1031
|
}
|
|
1032
1032
|
var signature_default = Signature;
|
|
1033
1033
|
var SpacerPropsSchema = z.object({
|
|
@@ -1044,13 +1044,13 @@ function Spacer({ props }) {
|
|
|
1044
1044
|
const style = {
|
|
1045
1045
|
height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
|
|
1046
1046
|
};
|
|
1047
|
-
return /* @__PURE__ */
|
|
1047
|
+
return /* @__PURE__ */ React60.createElement("div", { style });
|
|
1048
1048
|
}
|
|
1049
1049
|
var spacer_default = Spacer;
|
|
1050
1050
|
function buildBlockComponent(blocks) {
|
|
1051
1051
|
return function BlockComponent({ type, data }) {
|
|
1052
1052
|
const Component = blocks[type].Component;
|
|
1053
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ React60.createElement(Component, __spreadValues({}, data));
|
|
1054
1054
|
};
|
|
1055
1055
|
}
|
|
1056
1056
|
function buildBlockConfigurationSchema(blocks) {
|
|
@@ -1087,9 +1087,9 @@ function ColumnsContainerReader({ style, props }) {
|
|
|
1087
1087
|
const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
|
|
1088
1088
|
let cols = void 0;
|
|
1089
1089
|
if (columns) {
|
|
1090
|
-
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */
|
|
1090
|
+
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React60.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1091
1091
|
}
|
|
1092
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ React60.createElement(columns_container_default, { props: restProps, columns: cols, style });
|
|
1093
1093
|
}
|
|
1094
1094
|
var ContainerPropsSchema2 = z.object({
|
|
1095
1095
|
style: ContainerPropsSchema.shape.style,
|
|
@@ -1100,7 +1100,7 @@ var ContainerPropsSchema2 = z.object({
|
|
|
1100
1100
|
function ContainerReader({ style, props }) {
|
|
1101
1101
|
var _a;
|
|
1102
1102
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
1103
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ React60.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React60.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1104
1104
|
}
|
|
1105
1105
|
var COLOR_SCHEMA9 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
1106
1106
|
var FONT_FAMILY_SCHEMA6 = z.enum([
|
|
@@ -1114,6 +1114,10 @@ var FONT_FAMILY_SCHEMA6 = z.enum([
|
|
|
1114
1114
|
"BOOK_SERIF",
|
|
1115
1115
|
"MONOSPACE"
|
|
1116
1116
|
]).nullable().optional();
|
|
1117
|
+
var TemplateVariableSchema = z.object({
|
|
1118
|
+
name: z.string(),
|
|
1119
|
+
description: z.string().optional().nullable()
|
|
1120
|
+
});
|
|
1117
1121
|
var EmailLayoutPropsSchema = z.object({
|
|
1118
1122
|
backdropColor: COLOR_SCHEMA9,
|
|
1119
1123
|
backdropDisabled: z.boolean().optional().nullable(),
|
|
@@ -1122,7 +1126,9 @@ var EmailLayoutPropsSchema = z.object({
|
|
|
1122
1126
|
canvasColor: COLOR_SCHEMA9,
|
|
1123
1127
|
textColor: COLOR_SCHEMA9,
|
|
1124
1128
|
fontFamily: FONT_FAMILY_SCHEMA6,
|
|
1125
|
-
childrenIds: z.array(z.string()).optional().nullable()
|
|
1129
|
+
childrenIds: z.array(z.string()).optional().nullable(),
|
|
1130
|
+
subject: z.string().optional().nullable(),
|
|
1131
|
+
variables: z.array(TemplateVariableSchema).optional().nullable()
|
|
1126
1132
|
});
|
|
1127
1133
|
function getFontFamily6(fontFamily) {
|
|
1128
1134
|
const f = fontFamily != null ? fontFamily : "MODERN_SANS";
|
|
@@ -1166,9 +1172,9 @@ function EmailLayoutReader(props) {
|
|
|
1166
1172
|
margin: "0"
|
|
1167
1173
|
};
|
|
1168
1174
|
if (props.backdropDisabled) {
|
|
1169
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ React60.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React60.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1170
1176
|
}
|
|
1171
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ React60.createElement(
|
|
1172
1178
|
"div",
|
|
1173
1179
|
{
|
|
1174
1180
|
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
@@ -1178,7 +1184,7 @@ function EmailLayoutReader(props) {
|
|
|
1178
1184
|
width: "100%"
|
|
1179
1185
|
})
|
|
1180
1186
|
},
|
|
1181
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ React60.createElement(
|
|
1182
1188
|
"table",
|
|
1183
1189
|
{
|
|
1184
1190
|
align: "center",
|
|
@@ -1196,7 +1202,7 @@ function EmailLayoutReader(props) {
|
|
|
1196
1202
|
cellPadding: "0",
|
|
1197
1203
|
border: 0
|
|
1198
1204
|
},
|
|
1199
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ React60.createElement("tbody", null, /* @__PURE__ */ React60.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React60.createElement(ReaderBlock, { key: childId, id: childId })))))
|
|
1200
1206
|
)
|
|
1201
1207
|
);
|
|
1202
1208
|
}
|
|
@@ -1208,7 +1214,7 @@ function useReaderDocument() {
|
|
|
1208
1214
|
}
|
|
1209
1215
|
function ReaderBlock({ id }) {
|
|
1210
1216
|
const document2 = useReaderDocument();
|
|
1211
|
-
return document2[id] ? /* @__PURE__ */
|
|
1217
|
+
return document2[id] ? /* @__PURE__ */ React60.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1212
1218
|
}
|
|
1213
1219
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1214
1220
|
ColumnsContainer: {
|
|
@@ -1265,13 +1271,13 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
|
1265
1271
|
var ReaderDocumentSchema = z.record(z.string(), ReaderBlockSchema);
|
|
1266
1272
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1267
1273
|
function Reader({ document: document2, rootBlockId }) {
|
|
1268
|
-
return /* @__PURE__ */
|
|
1274
|
+
return /* @__PURE__ */ React60.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React60.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1269
1275
|
}
|
|
1270
1276
|
|
|
1271
1277
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1272
1278
|
function renderToStaticMarkup(document2, { rootBlockId }) {
|
|
1273
1279
|
return "<!DOCTYPE html>" + renderToStaticMarkup$1(
|
|
1274
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ React60.createElement("html", null, /* @__PURE__ */ React60.createElement("body", null, /* @__PURE__ */ React60.createElement(Reader, { document: document2, rootBlockId })))
|
|
1275
1281
|
);
|
|
1276
1282
|
}
|
|
1277
1283
|
|
|
@@ -2012,6 +2018,23 @@ function setSelectedScreenSize(selectedScreenSize) {
|
|
|
2012
2018
|
function setPersistenceEnabled(persistenceEnabled) {
|
|
2013
2019
|
return editorStateStore.setState({ persistenceEnabled });
|
|
2014
2020
|
}
|
|
2021
|
+
|
|
2022
|
+
// src/app/save-payload.ts
|
|
2023
|
+
var ROOT_BLOCK_ID = "root";
|
|
2024
|
+
function buildSavePayload(doc) {
|
|
2025
|
+
var _a, _b;
|
|
2026
|
+
const root = doc.root;
|
|
2027
|
+
const layoutData = root && root.type === "EmailLayout" ? root.data : void 0;
|
|
2028
|
+
return {
|
|
2029
|
+
editorConfig: doc,
|
|
2030
|
+
subject: (_a = layoutData == null ? void 0 : layoutData.subject) != null ? _a : void 0,
|
|
2031
|
+
variables: (_b = layoutData == null ? void 0 : layoutData.variables) != null ? _b : void 0,
|
|
2032
|
+
bodyHtml: renderToStaticMarkup(doc, { rootBlockId: ROOT_BLOCK_ID }),
|
|
2033
|
+
bodyText: renderToText(doc, { rootBlockId: ROOT_BLOCK_ID })
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
// src/app/context.tsx
|
|
2015
2038
|
var EmailEditorContext = createContext(null);
|
|
2016
2039
|
var EmailEditorProvider = ({
|
|
2017
2040
|
children,
|
|
@@ -2021,6 +2044,7 @@ var EmailEditorProvider = ({
|
|
|
2021
2044
|
}) => {
|
|
2022
2045
|
const [currentTemplateId, setCurrentTemplateId] = useState(initialTemplateId);
|
|
2023
2046
|
const [currentTemplateName, setCurrentTemplateName] = useState(initialTemplateName);
|
|
2047
|
+
const [currentTemplateKind, setCurrentTemplateKind] = useState(null);
|
|
2024
2048
|
const saveListenersRef = useRef([]);
|
|
2025
2049
|
const onSaveRef = useRef(onSave);
|
|
2026
2050
|
onSaveRef.current = onSave;
|
|
@@ -2028,21 +2052,27 @@ var EmailEditorProvider = ({
|
|
|
2028
2052
|
const currentDoc = getDocument();
|
|
2029
2053
|
saveListenersRef.current.forEach((listener) => listener(currentDoc));
|
|
2030
2054
|
if (onSaveRef.current) {
|
|
2031
|
-
onSaveRef.current(currentDoc);
|
|
2055
|
+
onSaveRef.current(buildSavePayload(currentDoc));
|
|
2032
2056
|
}
|
|
2033
2057
|
return currentDoc;
|
|
2034
2058
|
}, []);
|
|
2035
|
-
const loadTemplate = useCallback((newTemplate, templateId, templateName) => {
|
|
2059
|
+
const loadTemplate = useCallback((newTemplate, templateId, templateName, kind) => {
|
|
2036
2060
|
if (templateId !== void 0) {
|
|
2037
2061
|
setCurrentTemplateId(templateId);
|
|
2038
2062
|
}
|
|
2039
2063
|
if (templateName !== void 0) {
|
|
2040
2064
|
setCurrentTemplateName(templateName);
|
|
2041
2065
|
}
|
|
2066
|
+
if (kind !== void 0) {
|
|
2067
|
+
setCurrentTemplateKind(kind);
|
|
2068
|
+
}
|
|
2042
2069
|
}, []);
|
|
2043
|
-
const setCurrentTemplate = useCallback((templateId, templateName) => {
|
|
2070
|
+
const setCurrentTemplate = useCallback((templateId, templateName, kind) => {
|
|
2044
2071
|
setCurrentTemplateId(templateId);
|
|
2045
2072
|
setCurrentTemplateName(templateName);
|
|
2073
|
+
if (kind !== void 0) {
|
|
2074
|
+
setCurrentTemplateKind(kind);
|
|
2075
|
+
}
|
|
2046
2076
|
}, []);
|
|
2047
2077
|
const registerSaveListener = useCallback((callback) => {
|
|
2048
2078
|
saveListenersRef.current = [...saveListenersRef.current, callback];
|
|
@@ -2053,12 +2083,13 @@ var EmailEditorProvider = ({
|
|
|
2053
2083
|
const value = useMemo(() => ({
|
|
2054
2084
|
currentTemplateId,
|
|
2055
2085
|
currentTemplateName,
|
|
2086
|
+
currentTemplateKind,
|
|
2056
2087
|
saveTemplate,
|
|
2057
2088
|
loadTemplate,
|
|
2058
2089
|
registerSaveListener,
|
|
2059
2090
|
setCurrentTemplate
|
|
2060
|
-
}), [currentTemplateId, currentTemplateName, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2061
|
-
return /* @__PURE__ */
|
|
2091
|
+
}), [currentTemplateId, currentTemplateName, currentTemplateKind, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2092
|
+
return /* @__PURE__ */ React60.createElement(EmailEditorContext.Provider, { value }, children);
|
|
2062
2093
|
};
|
|
2063
2094
|
var useEmailEditor = () => {
|
|
2064
2095
|
const context = useContext(EmailEditorContext);
|
|
@@ -2068,14 +2099,14 @@ var useEmailEditor = () => {
|
|
|
2068
2099
|
return context;
|
|
2069
2100
|
};
|
|
2070
2101
|
function BaseSidebarPanel({ title, children }) {
|
|
2071
|
-
return /* @__PURE__ */
|
|
2102
|
+
return /* @__PURE__ */ React60.createElement(Box, { p: 2 }, /* @__PURE__ */ React60.createElement(Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React60.createElement(Stack, { spacing: 5, mb: 3 }, children));
|
|
2072
2103
|
}
|
|
2073
2104
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
2074
2105
|
const [value, setValue] = useState(defaultValue);
|
|
2075
2106
|
useEffect(() => {
|
|
2076
2107
|
setValue(defaultValue);
|
|
2077
2108
|
}, [defaultValue]);
|
|
2078
|
-
return /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ React60.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2079
2110
|
ToggleButtonGroup,
|
|
2080
2111
|
{
|
|
2081
2112
|
exclusive: true,
|
|
@@ -2095,7 +2126,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
2095
2126
|
}
|
|
2096
2127
|
function RawSliderInput(_a) {
|
|
2097
2128
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
2098
|
-
return /* @__PURE__ */
|
|
2129
|
+
return /* @__PURE__ */ React60.createElement(Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React60.createElement(Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React60.createElement(
|
|
2099
2130
|
Slider,
|
|
2100
2131
|
__spreadProps(__spreadValues({}, props), {
|
|
2101
2132
|
value,
|
|
@@ -2106,14 +2137,14 @@ function RawSliderInput(_a) {
|
|
|
2106
2137
|
setValue(value2);
|
|
2107
2138
|
}
|
|
2108
2139
|
})
|
|
2109
|
-
), /* @__PURE__ */
|
|
2140
|
+
), /* @__PURE__ */ React60.createElement(Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
|
|
2110
2141
|
}
|
|
2111
2142
|
|
|
2112
2143
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
2113
2144
|
function SliderInput(_a) {
|
|
2114
2145
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
2115
2146
|
const [value, setValue] = useState(defaultValue);
|
|
2116
|
-
return /* @__PURE__ */
|
|
2147
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2117
2148
|
RawSliderInput,
|
|
2118
2149
|
__spreadValues({
|
|
2119
2150
|
value,
|
|
@@ -2130,7 +2161,7 @@ function TextInput({ helperText, label, placeholder, rows, InputProps: InputProp
|
|
|
2130
2161
|
useEffect(() => {
|
|
2131
2162
|
setValue(defaultValue);
|
|
2132
2163
|
}, [defaultValue]);
|
|
2133
|
-
return /* @__PURE__ */
|
|
2164
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2134
2165
|
TextField,
|
|
2135
2166
|
{
|
|
2136
2167
|
fullWidth: true,
|
|
@@ -2156,7 +2187,7 @@ var TILE_BUTTON = {
|
|
|
2156
2187
|
};
|
|
2157
2188
|
function Swatch({ paletteColors, value, onChange }) {
|
|
2158
2189
|
const renderButton2 = (colorValue) => {
|
|
2159
|
-
return /* @__PURE__ */
|
|
2190
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2160
2191
|
Button$1,
|
|
2161
2192
|
{
|
|
2162
2193
|
key: colorValue,
|
|
@@ -2175,7 +2206,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
2175
2206
|
}
|
|
2176
2207
|
);
|
|
2177
2208
|
};
|
|
2178
|
-
return /* @__PURE__ */
|
|
2209
|
+
return /* @__PURE__ */ React60.createElement(Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
|
|
2179
2210
|
}
|
|
2180
2211
|
|
|
2181
2212
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -2242,7 +2273,7 @@ var SX = {
|
|
|
2242
2273
|
}
|
|
2243
2274
|
};
|
|
2244
2275
|
function Picker({ value, onChange }) {
|
|
2245
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React60.createElement(HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React60.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React60.createElement(Box, { pt: 1 }, /* @__PURE__ */ React60.createElement(HexColorInput, { prefixed: true, color: value, onChange })));
|
|
2246
2277
|
}
|
|
2247
2278
|
|
|
2248
2279
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -2267,7 +2298,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2267
2298
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2268
2299
|
return null;
|
|
2269
2300
|
}
|
|
2270
|
-
return /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2271
2302
|
ButtonBase,
|
|
2272
2303
|
{
|
|
2273
2304
|
onClick: () => {
|
|
@@ -2275,16 +2306,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2275
2306
|
onChange(null);
|
|
2276
2307
|
}
|
|
2277
2308
|
},
|
|
2278
|
-
/* @__PURE__ */
|
|
2309
|
+
/* @__PURE__ */ React60.createElement(CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
2279
2310
|
);
|
|
2280
2311
|
};
|
|
2281
2312
|
const renderOpenButton = () => {
|
|
2282
2313
|
if (value) {
|
|
2283
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ React60.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
2284
2315
|
}
|
|
2285
|
-
return /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ React60.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" }));
|
|
2286
2317
|
};
|
|
2287
|
-
return /* @__PURE__ */
|
|
2318
|
+
return /* @__PURE__ */ React60.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React60.createElement(
|
|
2288
2319
|
Menu,
|
|
2289
2320
|
{
|
|
2290
2321
|
anchorEl,
|
|
@@ -2294,7 +2325,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2294
2325
|
sx: { height: "auto", padding: 0 }
|
|
2295
2326
|
}
|
|
2296
2327
|
},
|
|
2297
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ React60.createElement(
|
|
2298
2329
|
Picker,
|
|
2299
2330
|
{
|
|
2300
2331
|
value: value || "",
|
|
@@ -2309,10 +2340,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2309
2340
|
|
|
2310
2341
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
2311
2342
|
function ColorInput2(props) {
|
|
2312
|
-
return /* @__PURE__ */
|
|
2343
|
+
return /* @__PURE__ */ React60.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
2313
2344
|
}
|
|
2314
2345
|
function NullableColorInput(props) {
|
|
2315
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ React60.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
2316
2347
|
}
|
|
2317
2348
|
|
|
2318
2349
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2365,13 +2396,13 @@ var FONT_FAMILIES = [
|
|
|
2365
2396
|
];
|
|
2366
2397
|
|
|
2367
2398
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2368
|
-
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */
|
|
2399
|
+
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React60.createElement(MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
|
|
2369
2400
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2370
2401
|
const [value, setValue] = useState(defaultValue != null ? defaultValue : "inherit");
|
|
2371
2402
|
useEffect(() => {
|
|
2372
2403
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2373
2404
|
}, [defaultValue]);
|
|
2374
|
-
return /* @__PURE__ */
|
|
2405
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2375
2406
|
TextField,
|
|
2376
2407
|
{
|
|
2377
2408
|
select: true,
|
|
@@ -2384,7 +2415,7 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2384
2415
|
onChange(v === null ? null : v);
|
|
2385
2416
|
}
|
|
2386
2417
|
},
|
|
2387
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ React60.createElement(MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2388
2419
|
OPTIONS
|
|
2389
2420
|
);
|
|
2390
2421
|
}
|
|
@@ -2397,10 +2428,10 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2397
2428
|
setValue(value2);
|
|
2398
2429
|
onChange(value2);
|
|
2399
2430
|
};
|
|
2400
|
-
return /* @__PURE__ */
|
|
2431
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2401
2432
|
RawSliderInput,
|
|
2402
2433
|
{
|
|
2403
|
-
iconLabel: /* @__PURE__ */
|
|
2434
|
+
iconLabel: /* @__PURE__ */ React60.createElement(TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2404
2435
|
value,
|
|
2405
2436
|
setValue: handleChange,
|
|
2406
2437
|
units: "px",
|
|
@@ -2415,7 +2446,7 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2415
2446
|
useEffect(() => {
|
|
2416
2447
|
setValue(defaultValue);
|
|
2417
2448
|
}, [defaultValue]);
|
|
2418
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2419
2450
|
RadioGroupInput,
|
|
2420
2451
|
{
|
|
2421
2452
|
label,
|
|
@@ -2425,8 +2456,8 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2425
2456
|
onChange(fontWeight);
|
|
2426
2457
|
}
|
|
2427
2458
|
},
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "normal" }, "Regular"),
|
|
2460
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "bold" }, "Bold")
|
|
2430
2461
|
);
|
|
2431
2462
|
}
|
|
2432
2463
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
@@ -2448,10 +2479,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2448
2479
|
setValue(v);
|
|
2449
2480
|
onChange(v);
|
|
2450
2481
|
}
|
|
2451
|
-
return /* @__PURE__ */
|
|
2482
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2452
2483
|
RawSliderInput,
|
|
2453
2484
|
{
|
|
2454
|
-
iconLabel: /* @__PURE__ */
|
|
2485
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2455
2486
|
value: value.top,
|
|
2456
2487
|
setValue: (num) => handleChange("top", num),
|
|
2457
2488
|
units: "px",
|
|
@@ -2460,10 +2491,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2460
2491
|
max: 80,
|
|
2461
2492
|
marks: true
|
|
2462
2493
|
}
|
|
2463
|
-
), /* @__PURE__ */
|
|
2494
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2464
2495
|
RawSliderInput,
|
|
2465
2496
|
{
|
|
2466
|
-
iconLabel: /* @__PURE__ */
|
|
2497
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2467
2498
|
value: value.bottom,
|
|
2468
2499
|
setValue: (num) => handleChange("bottom", num),
|
|
2469
2500
|
units: "px",
|
|
@@ -2472,10 +2503,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2472
2503
|
max: 80,
|
|
2473
2504
|
marks: true
|
|
2474
2505
|
}
|
|
2475
|
-
), /* @__PURE__ */
|
|
2506
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2476
2507
|
RawSliderInput,
|
|
2477
2508
|
{
|
|
2478
|
-
iconLabel: /* @__PURE__ */
|
|
2509
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2479
2510
|
value: value.left,
|
|
2480
2511
|
setValue: (num) => handleChange("left", num),
|
|
2481
2512
|
units: "px",
|
|
@@ -2484,10 +2515,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2484
2515
|
max: 80,
|
|
2485
2516
|
marks: true
|
|
2486
2517
|
}
|
|
2487
|
-
), /* @__PURE__ */
|
|
2518
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2488
2519
|
RawSliderInput,
|
|
2489
2520
|
{
|
|
2490
|
-
iconLabel: /* @__PURE__ */
|
|
2521
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2491
2522
|
value: value.right,
|
|
2492
2523
|
setValue: (num) => handleChange("right", num),
|
|
2493
2524
|
units: "px",
|
|
@@ -2503,7 +2534,7 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2503
2534
|
useEffect(() => {
|
|
2504
2535
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2505
2536
|
}, [defaultValue]);
|
|
2506
|
-
return /* @__PURE__ */
|
|
2537
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2507
2538
|
RadioGroupInput,
|
|
2508
2539
|
{
|
|
2509
2540
|
label,
|
|
@@ -2513,9 +2544,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2513
2544
|
onChange(value2);
|
|
2514
2545
|
}
|
|
2515
2546
|
},
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2547
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "left" }, /* @__PURE__ */ React60.createElement(FormatAlignLeftOutlined, { fontSize: "small" })),
|
|
2548
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "center" }, /* @__PURE__ */ React60.createElement(FormatAlignCenterOutlined, { fontSize: "small" })),
|
|
2549
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "right" }, /* @__PURE__ */ React60.createElement(FormatAlignRightOutlined, { fontSize: "small" }))
|
|
2519
2550
|
);
|
|
2520
2551
|
}
|
|
2521
2552
|
|
|
@@ -2528,14 +2559,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2528
2559
|
};
|
|
2529
2560
|
switch (name) {
|
|
2530
2561
|
case "backgroundColor":
|
|
2531
|
-
return /* @__PURE__ */
|
|
2562
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
|
|
2532
2563
|
case "borderColor":
|
|
2533
|
-
return /* @__PURE__ */
|
|
2564
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
|
|
2534
2565
|
case "borderRadius":
|
|
2535
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2536
2567
|
SliderInput,
|
|
2537
2568
|
{
|
|
2538
|
-
iconLabel: /* @__PURE__ */
|
|
2569
|
+
iconLabel: /* @__PURE__ */ React60.createElement(RoundedCornerOutlined, null),
|
|
2539
2570
|
units: "px",
|
|
2540
2571
|
step: 4,
|
|
2541
2572
|
marks: true,
|
|
@@ -2547,23 +2578,23 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2547
2578
|
}
|
|
2548
2579
|
);
|
|
2549
2580
|
case "color":
|
|
2550
|
-
return /* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
|
|
2551
2582
|
case "fontFamily":
|
|
2552
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ React60.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
|
|
2553
2584
|
case "fontSize":
|
|
2554
|
-
return /* @__PURE__ */
|
|
2585
|
+
return /* @__PURE__ */ React60.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
|
|
2555
2586
|
case "fontWeight":
|
|
2556
|
-
return /* @__PURE__ */
|
|
2587
|
+
return /* @__PURE__ */ React60.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
|
|
2557
2588
|
case "textAlign":
|
|
2558
|
-
return /* @__PURE__ */
|
|
2589
|
+
return /* @__PURE__ */ React60.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
|
|
2559
2590
|
case "padding":
|
|
2560
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ React60.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
|
|
2561
2592
|
}
|
|
2562
2593
|
}
|
|
2563
2594
|
|
|
2564
2595
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2565
2596
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2566
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, names.map((name) => /* @__PURE__ */ React60.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2567
2598
|
}
|
|
2568
2599
|
|
|
2569
2600
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
@@ -2583,11 +2614,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2583
2614
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2584
2615
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2585
2616
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2586
|
-
return /* @__PURE__ */
|
|
2617
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React60.createElement(
|
|
2587
2618
|
SliderInput,
|
|
2588
2619
|
{
|
|
2589
2620
|
label: "Size",
|
|
2590
|
-
iconLabel: /* @__PURE__ */
|
|
2621
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2591
2622
|
units: "px",
|
|
2592
2623
|
step: 3,
|
|
2593
2624
|
min: 32,
|
|
@@ -2597,7 +2628,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2597
2628
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2598
2629
|
}
|
|
2599
2630
|
}
|
|
2600
|
-
), /* @__PURE__ */
|
|
2631
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2601
2632
|
RadioGroupInput,
|
|
2602
2633
|
{
|
|
2603
2634
|
label: "Shape",
|
|
@@ -2606,10 +2637,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2606
2637
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2607
2638
|
}
|
|
2608
2639
|
},
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2612
|
-
), /* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "circle" }, "Circle"),
|
|
2641
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "square" }, "Square"),
|
|
2642
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "rounded" }, "Rounded")
|
|
2643
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2613
2644
|
TextInput,
|
|
2614
2645
|
{
|
|
2615
2646
|
label: "Image URL",
|
|
@@ -2618,7 +2649,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2618
2649
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2619
2650
|
}
|
|
2620
2651
|
}
|
|
2621
|
-
), /* @__PURE__ */
|
|
2652
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2622
2653
|
TextInput,
|
|
2623
2654
|
{
|
|
2624
2655
|
label: "Alt text",
|
|
@@ -2627,7 +2658,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2627
2658
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2628
2659
|
}
|
|
2629
2660
|
}
|
|
2630
|
-
), /* @__PURE__ */
|
|
2661
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2631
2662
|
MultiStylePropertyPanel,
|
|
2632
2663
|
{
|
|
2633
2664
|
names: ["textAlign", "padding"],
|
|
@@ -2655,65 +2686,65 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2655
2686
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2656
2687
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2657
2688
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2658
|
-
return /* @__PURE__ */
|
|
2689
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React60.createElement(
|
|
2659
2690
|
TextInput,
|
|
2660
2691
|
{
|
|
2661
2692
|
label: "Text",
|
|
2662
2693
|
defaultValue: text,
|
|
2663
2694
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2664
2695
|
}
|
|
2665
|
-
), /* @__PURE__ */
|
|
2696
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2666
2697
|
TextInput,
|
|
2667
2698
|
{
|
|
2668
2699
|
label: "Url",
|
|
2669
2700
|
defaultValue: url,
|
|
2670
2701
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2671
2702
|
}
|
|
2672
|
-
), /* @__PURE__ */
|
|
2703
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2673
2704
|
RadioGroupInput,
|
|
2674
2705
|
{
|
|
2675
2706
|
label: "Width",
|
|
2676
2707
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2677
2708
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2678
2709
|
},
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
), /* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2711
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "AUTO" }, "Auto")
|
|
2712
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2682
2713
|
RadioGroupInput,
|
|
2683
2714
|
{
|
|
2684
2715
|
label: "Size",
|
|
2685
2716
|
defaultValue: size,
|
|
2686
2717
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2687
2718
|
},
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
), /* @__PURE__ */
|
|
2719
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "x-small" }, "Xs"),
|
|
2720
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "small" }, "Sm"),
|
|
2721
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "medium" }, "Md"),
|
|
2722
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "large" }, "Lg")
|
|
2723
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2693
2724
|
RadioGroupInput,
|
|
2694
2725
|
{
|
|
2695
2726
|
label: "Style",
|
|
2696
2727
|
defaultValue: buttonStyle,
|
|
2697
2728
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2698
2729
|
},
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
), /* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "rectangle" }, "Rectangle"),
|
|
2731
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "rounded" }, "Rounded"),
|
|
2732
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "pill" }, "Pill")
|
|
2733
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2703
2734
|
ColorInput2,
|
|
2704
2735
|
{
|
|
2705
2736
|
label: "Text color",
|
|
2706
2737
|
defaultValue: buttonTextColor,
|
|
2707
2738
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2708
2739
|
}
|
|
2709
|
-
), /* @__PURE__ */
|
|
2740
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2710
2741
|
ColorInput2,
|
|
2711
2742
|
{
|
|
2712
2743
|
label: "Button color",
|
|
2713
2744
|
defaultValue: buttonBackgroundColor,
|
|
2714
2745
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2715
2746
|
}
|
|
2716
|
-
), /* @__PURE__ */
|
|
2747
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2717
2748
|
MultiStylePropertyPanel,
|
|
2718
2749
|
{
|
|
2719
2750
|
names: ["backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -2739,7 +2770,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2739
2770
|
const value = parseInt(ev.target.value);
|
|
2740
2771
|
onChange(isNaN(value) ? null : value);
|
|
2741
2772
|
};
|
|
2742
|
-
return /* @__PURE__ */
|
|
2773
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2743
2774
|
TextField,
|
|
2744
2775
|
{
|
|
2745
2776
|
fullWidth: true,
|
|
@@ -2750,7 +2781,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2750
2781
|
placeholder: "auto",
|
|
2751
2782
|
size: "small",
|
|
2752
2783
|
InputProps: {
|
|
2753
|
-
endAdornment: /* @__PURE__ */
|
|
2784
|
+
endAdornment: /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2754
2785
|
}
|
|
2755
2786
|
}
|
|
2756
2787
|
);
|
|
@@ -2772,7 +2803,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2772
2803
|
};
|
|
2773
2804
|
let column3 = null;
|
|
2774
2805
|
{
|
|
2775
|
-
column3 = /* @__PURE__ */
|
|
2806
|
+
column3 = /* @__PURE__ */ React60.createElement(
|
|
2776
2807
|
TextDimensionInput,
|
|
2777
2808
|
{
|
|
2778
2809
|
label: "Column 3",
|
|
@@ -2783,7 +2814,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2783
2814
|
}
|
|
2784
2815
|
);
|
|
2785
2816
|
}
|
|
2786
|
-
return /* @__PURE__ */
|
|
2817
|
+
return /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React60.createElement(
|
|
2787
2818
|
TextDimensionInput,
|
|
2788
2819
|
{
|
|
2789
2820
|
label: "Column 1",
|
|
@@ -2792,7 +2823,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2792
2823
|
setIndexValue(0, v);
|
|
2793
2824
|
}
|
|
2794
2825
|
}
|
|
2795
|
-
), /* @__PURE__ */
|
|
2826
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2796
2827
|
TextDimensionInput,
|
|
2797
2828
|
{
|
|
2798
2829
|
label: "Column 2",
|
|
@@ -2817,7 +2848,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2817
2848
|
setErrors(res.error);
|
|
2818
2849
|
}
|
|
2819
2850
|
};
|
|
2820
|
-
return /* @__PURE__ */
|
|
2851
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React60.createElement(
|
|
2821
2852
|
RadioGroupInput,
|
|
2822
2853
|
{
|
|
2823
2854
|
label: "Number of columns",
|
|
@@ -2826,9 +2857,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2826
2857
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
2827
2858
|
}
|
|
2828
2859
|
},
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2831
|
-
), /* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "2" }, "2"),
|
|
2861
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "3" }, "3")
|
|
2862
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2832
2863
|
ColumnWidthsInput,
|
|
2833
2864
|
{
|
|
2834
2865
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -2836,11 +2867,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2836
2867
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
2837
2868
|
}
|
|
2838
2869
|
}
|
|
2839
|
-
), /* @__PURE__ */
|
|
2870
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2840
2871
|
SliderInput,
|
|
2841
2872
|
{
|
|
2842
2873
|
label: "Columns gap",
|
|
2843
|
-
iconLabel: /* @__PURE__ */
|
|
2874
|
+
iconLabel: /* @__PURE__ */ React60.createElement(SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
2844
2875
|
units: "px",
|
|
2845
2876
|
step: 4,
|
|
2846
2877
|
marks: true,
|
|
@@ -2849,7 +2880,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2849
2880
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
2850
2881
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
2851
2882
|
}
|
|
2852
|
-
), /* @__PURE__ */
|
|
2883
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2853
2884
|
RadioGroupInput,
|
|
2854
2885
|
{
|
|
2855
2886
|
label: "Alignment",
|
|
@@ -2858,10 +2889,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2858
2889
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
2859
2890
|
}
|
|
2860
2891
|
},
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
/* @__PURE__ */
|
|
2864
|
-
), /* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React60.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
2893
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React60.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
2894
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React60.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
2895
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2865
2896
|
MultiStylePropertyPanel,
|
|
2866
2897
|
{
|
|
2867
2898
|
names: ["backgroundColor", "padding"],
|
|
@@ -2890,7 +2921,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2890
2921
|
setErrors(res.error);
|
|
2891
2922
|
}
|
|
2892
2923
|
};
|
|
2893
|
-
return /* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React60.createElement(
|
|
2894
2925
|
MultiStylePropertyPanel,
|
|
2895
2926
|
{
|
|
2896
2927
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -2913,18 +2944,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2913
2944
|
};
|
|
2914
2945
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
2915
2946
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
2916
|
-
return /* @__PURE__ */
|
|
2947
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React60.createElement(
|
|
2917
2948
|
ColorInput2,
|
|
2918
2949
|
{
|
|
2919
2950
|
label: "Color",
|
|
2920
2951
|
defaultValue: lineColor,
|
|
2921
2952
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
2922
2953
|
}
|
|
2923
|
-
), /* @__PURE__ */
|
|
2954
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2924
2955
|
SliderInput,
|
|
2925
2956
|
{
|
|
2926
2957
|
label: "Height",
|
|
2927
|
-
iconLabel: /* @__PURE__ */
|
|
2958
|
+
iconLabel: /* @__PURE__ */ React60.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2928
2959
|
units: "px",
|
|
2929
2960
|
step: 1,
|
|
2930
2961
|
min: 1,
|
|
@@ -2932,7 +2963,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2932
2963
|
defaultValue: lineHeight,
|
|
2933
2964
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
2934
2965
|
}
|
|
2935
|
-
), /* @__PURE__ */
|
|
2966
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2936
2967
|
MultiStylePropertyPanel,
|
|
2937
2968
|
{
|
|
2938
2969
|
names: ["backgroundColor", "padding"],
|
|
@@ -2953,6 +2984,10 @@ var FONT_FAMILY_SCHEMA7 = z.enum([
|
|
|
2953
2984
|
"BOOK_SERIF",
|
|
2954
2985
|
"MONOSPACE"
|
|
2955
2986
|
]).nullable().optional();
|
|
2987
|
+
var TemplateVariableSchema2 = z.object({
|
|
2988
|
+
name: z.string(),
|
|
2989
|
+
description: z.string().optional().nullable()
|
|
2990
|
+
});
|
|
2956
2991
|
var EmailLayoutPropsSchema2 = z.object({
|
|
2957
2992
|
backdropColor: COLOR_SCHEMA10,
|
|
2958
2993
|
backdropDisabled: z.boolean().optional().nullable(),
|
|
@@ -2961,7 +2996,9 @@ var EmailLayoutPropsSchema2 = z.object({
|
|
|
2961
2996
|
canvasColor: COLOR_SCHEMA10,
|
|
2962
2997
|
textColor: COLOR_SCHEMA10,
|
|
2963
2998
|
fontFamily: FONT_FAMILY_SCHEMA7,
|
|
2964
|
-
childrenIds: z.array(z.string()).optional().nullable()
|
|
2999
|
+
childrenIds: z.array(z.string()).optional().nullable(),
|
|
3000
|
+
subject: z.string().optional().nullable(),
|
|
3001
|
+
variables: z.array(TemplateVariableSchema2).optional().nullable()
|
|
2965
3002
|
});
|
|
2966
3003
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
2967
3004
|
function BooleanInput({ label, defaultValue, onChange }) {
|
|
@@ -2969,11 +3006,11 @@ function BooleanInput({ label, defaultValue, onChange }) {
|
|
|
2969
3006
|
useEffect(() => {
|
|
2970
3007
|
setValue(defaultValue);
|
|
2971
3008
|
}, [defaultValue]);
|
|
2972
|
-
return /* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2973
3010
|
FormControlLabel,
|
|
2974
3011
|
{
|
|
2975
3012
|
label,
|
|
2976
|
-
control: /* @__PURE__ */
|
|
3013
|
+
control: /* @__PURE__ */ React60.createElement(
|
|
2977
3014
|
Switch,
|
|
2978
3015
|
{
|
|
2979
3016
|
checked: value,
|
|
@@ -3001,38 +3038,38 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3001
3038
|
}
|
|
3002
3039
|
};
|
|
3003
3040
|
const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
|
|
3004
|
-
return /* @__PURE__ */
|
|
3041
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React60.createElement(
|
|
3005
3042
|
BooleanInput,
|
|
3006
3043
|
{
|
|
3007
3044
|
label: "Disable backdrop",
|
|
3008
3045
|
defaultValue: backdropDisabled,
|
|
3009
3046
|
onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
|
|
3010
3047
|
}
|
|
3011
|
-
), !backdropDisabled && /* @__PURE__ */
|
|
3048
|
+
), !backdropDisabled && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
3012
3049
|
ColorInput2,
|
|
3013
3050
|
{
|
|
3014
3051
|
label: "Backdrop color",
|
|
3015
3052
|
defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
|
|
3016
3053
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
3017
3054
|
}
|
|
3018
|
-
), /* @__PURE__ */
|
|
3055
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3019
3056
|
ColorInput2,
|
|
3020
3057
|
{
|
|
3021
3058
|
label: "Canvas color",
|
|
3022
3059
|
defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
|
|
3023
3060
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
3024
3061
|
}
|
|
3025
|
-
), /* @__PURE__ */
|
|
3062
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3026
3063
|
NullableColorInput,
|
|
3027
3064
|
{
|
|
3028
3065
|
label: "Canvas border color",
|
|
3029
3066
|
defaultValue: (_d = data.borderColor) != null ? _d : null,
|
|
3030
3067
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
3031
3068
|
}
|
|
3032
|
-
), /* @__PURE__ */
|
|
3069
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3033
3070
|
SliderInput,
|
|
3034
3071
|
{
|
|
3035
|
-
iconLabel: /* @__PURE__ */
|
|
3072
|
+
iconLabel: /* @__PURE__ */ React60.createElement(RoundedCornerOutlined, null),
|
|
3036
3073
|
units: "px",
|
|
3037
3074
|
step: 4,
|
|
3038
3075
|
marks: true,
|
|
@@ -3042,14 +3079,14 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3042
3079
|
defaultValue: (_e = data.borderRadius) != null ? _e : 0,
|
|
3043
3080
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
3044
3081
|
}
|
|
3045
|
-
)), /* @__PURE__ */
|
|
3082
|
+
)), /* @__PURE__ */ React60.createElement(
|
|
3046
3083
|
NullableFontFamily,
|
|
3047
3084
|
{
|
|
3048
3085
|
label: "Font family",
|
|
3049
3086
|
defaultValue: "MODERN_SANS",
|
|
3050
3087
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
3051
3088
|
}
|
|
3052
|
-
), /* @__PURE__ */
|
|
3089
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3053
3090
|
ColorInput2,
|
|
3054
3091
|
{
|
|
3055
3092
|
label: "Text color",
|
|
@@ -3070,7 +3107,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3070
3107
|
setErrors(res.error);
|
|
3071
3108
|
}
|
|
3072
3109
|
};
|
|
3073
|
-
return /* @__PURE__ */
|
|
3110
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React60.createElement(
|
|
3074
3111
|
TextInput,
|
|
3075
3112
|
{
|
|
3076
3113
|
label: "Content",
|
|
@@ -3080,7 +3117,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3080
3117
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
3081
3118
|
}
|
|
3082
3119
|
}
|
|
3083
|
-
), /* @__PURE__ */
|
|
3120
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3084
3121
|
RadioGroupInput,
|
|
3085
3122
|
{
|
|
3086
3123
|
label: "Level",
|
|
@@ -3089,10 +3126,10 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3089
3126
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
3090
3127
|
}
|
|
3091
3128
|
},
|
|
3092
|
-
/* @__PURE__ */
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
), /* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "h1" }, "H1"),
|
|
3130
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "h2" }, "H2"),
|
|
3131
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "h3" }, "H3")
|
|
3132
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3096
3133
|
MultiStylePropertyPanel,
|
|
3097
3134
|
{
|
|
3098
3135
|
names: ["color", "backgroundColor", "fontFamily", "fontWeight", "textAlign", "padding"],
|
|
@@ -3113,7 +3150,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3113
3150
|
setErrors(res.error);
|
|
3114
3151
|
}
|
|
3115
3152
|
};
|
|
3116
|
-
return /* @__PURE__ */
|
|
3153
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React60.createElement(
|
|
3117
3154
|
TextInput,
|
|
3118
3155
|
{
|
|
3119
3156
|
label: "Content",
|
|
@@ -3121,7 +3158,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3121
3158
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
3122
3159
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
3123
3160
|
}
|
|
3124
|
-
), /* @__PURE__ */
|
|
3161
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3125
3162
|
MultiStylePropertyPanel,
|
|
3126
3163
|
{
|
|
3127
3164
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -3142,7 +3179,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3142
3179
|
setErrors(res.error);
|
|
3143
3180
|
}
|
|
3144
3181
|
};
|
|
3145
|
-
return /* @__PURE__ */
|
|
3182
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Image block" }, /* @__PURE__ */ React60.createElement(
|
|
3146
3183
|
TextInput,
|
|
3147
3184
|
{
|
|
3148
3185
|
label: "Source URL",
|
|
@@ -3152,14 +3189,14 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3152
3189
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url }) }));
|
|
3153
3190
|
}
|
|
3154
3191
|
}
|
|
3155
|
-
), /* @__PURE__ */
|
|
3192
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3156
3193
|
TextInput,
|
|
3157
3194
|
{
|
|
3158
3195
|
label: "Alt text",
|
|
3159
3196
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
3160
3197
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
3161
3198
|
}
|
|
3162
|
-
), /* @__PURE__ */
|
|
3199
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3163
3200
|
TextInput,
|
|
3164
3201
|
{
|
|
3165
3202
|
label: "Click through URL",
|
|
@@ -3169,31 +3206,31 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3169
3206
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
3170
3207
|
}
|
|
3171
3208
|
}
|
|
3172
|
-
), /* @__PURE__ */
|
|
3209
|
+
), /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60.createElement(
|
|
3173
3210
|
TextDimensionInput,
|
|
3174
3211
|
{
|
|
3175
3212
|
label: "Width",
|
|
3176
3213
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
3177
3214
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
3178
3215
|
}
|
|
3179
|
-
), /* @__PURE__ */
|
|
3216
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3180
3217
|
TextDimensionInput,
|
|
3181
3218
|
{
|
|
3182
3219
|
label: "Height",
|
|
3183
3220
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
3184
3221
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
3185
3222
|
}
|
|
3186
|
-
)), /* @__PURE__ */
|
|
3223
|
+
)), /* @__PURE__ */ React60.createElement(
|
|
3187
3224
|
RadioGroupInput,
|
|
3188
3225
|
{
|
|
3189
3226
|
label: "Alignment",
|
|
3190
3227
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
3191
3228
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
3192
3229
|
},
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
), /* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React60.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3231
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React60.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3232
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React60.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3233
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3197
3234
|
MultiStylePropertyPanel,
|
|
3198
3235
|
{
|
|
3199
3236
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
@@ -3229,74 +3266,74 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3229
3266
|
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3230
3267
|
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3231
3268
|
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3232
|
-
return /* @__PURE__ */
|
|
3269
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React60.createElement(
|
|
3233
3270
|
TextInput,
|
|
3234
3271
|
{
|
|
3235
3272
|
label: "Greeting",
|
|
3236
3273
|
defaultValue: greeting,
|
|
3237
3274
|
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3238
3275
|
}
|
|
3239
|
-
), /* @__PURE__ */
|
|
3276
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3240
3277
|
TextInput,
|
|
3241
3278
|
{
|
|
3242
3279
|
label: "Name",
|
|
3243
3280
|
defaultValue: name,
|
|
3244
3281
|
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3245
3282
|
}
|
|
3246
|
-
), /* @__PURE__ */
|
|
3283
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3247
3284
|
TextInput,
|
|
3248
3285
|
{
|
|
3249
3286
|
label: "Title",
|
|
3250
3287
|
defaultValue: title,
|
|
3251
3288
|
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3252
3289
|
}
|
|
3253
|
-
), /* @__PURE__ */
|
|
3290
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3254
3291
|
TextInput,
|
|
3255
3292
|
{
|
|
3256
3293
|
label: "Company",
|
|
3257
3294
|
defaultValue: company,
|
|
3258
3295
|
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3259
3296
|
}
|
|
3260
|
-
), /* @__PURE__ */
|
|
3297
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3261
3298
|
TextInput,
|
|
3262
3299
|
{
|
|
3263
3300
|
label: "Address",
|
|
3264
3301
|
defaultValue: address,
|
|
3265
3302
|
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3266
3303
|
}
|
|
3267
|
-
), /* @__PURE__ */
|
|
3304
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3268
3305
|
TextInput,
|
|
3269
3306
|
{
|
|
3270
3307
|
label: "Email",
|
|
3271
3308
|
defaultValue: email,
|
|
3272
3309
|
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3273
3310
|
}
|
|
3274
|
-
), /* @__PURE__ */
|
|
3311
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3275
3312
|
TextInput,
|
|
3276
3313
|
{
|
|
3277
3314
|
label: "Phone",
|
|
3278
3315
|
defaultValue: phone,
|
|
3279
3316
|
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3280
3317
|
}
|
|
3281
|
-
), /* @__PURE__ */
|
|
3318
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3282
3319
|
TextInput,
|
|
3283
3320
|
{
|
|
3284
3321
|
label: "Website",
|
|
3285
3322
|
defaultValue: website,
|
|
3286
3323
|
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3287
3324
|
}
|
|
3288
|
-
), /* @__PURE__ */
|
|
3325
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3289
3326
|
TextInput,
|
|
3290
3327
|
{
|
|
3291
3328
|
label: "Image URL",
|
|
3292
3329
|
defaultValue: imageUrl,
|
|
3293
3330
|
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3294
3331
|
}
|
|
3295
|
-
), /* @__PURE__ */
|
|
3332
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3296
3333
|
SliderInput,
|
|
3297
3334
|
{
|
|
3298
3335
|
label: "Image size",
|
|
3299
|
-
iconLabel: /* @__PURE__ */
|
|
3336
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3300
3337
|
units: "px",
|
|
3301
3338
|
step: 4,
|
|
3302
3339
|
min: 32,
|
|
@@ -3304,47 +3341,47 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3304
3341
|
defaultValue: imageSize,
|
|
3305
3342
|
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3306
3343
|
}
|
|
3307
|
-
), /* @__PURE__ */
|
|
3344
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3308
3345
|
RadioGroupInput,
|
|
3309
3346
|
{
|
|
3310
3347
|
label: "Image shape",
|
|
3311
3348
|
defaultValue: imageShape,
|
|
3312
3349
|
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3313
3350
|
},
|
|
3314
|
-
/* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
/* @__PURE__ */
|
|
3317
|
-
), /* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "circle" }, "Circle"),
|
|
3352
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "square" }, "Square"),
|
|
3353
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "rounded" }, "Rounded")
|
|
3354
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3318
3355
|
RadioGroupInput,
|
|
3319
3356
|
{
|
|
3320
3357
|
label: "Layout",
|
|
3321
3358
|
defaultValue: layout,
|
|
3322
3359
|
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3323
3360
|
},
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
), /* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3362
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "vertical" }, "Vertical")
|
|
3363
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3327
3364
|
ColorInput2,
|
|
3328
3365
|
{
|
|
3329
3366
|
label: "Name color",
|
|
3330
3367
|
defaultValue: nameColor,
|
|
3331
3368
|
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3332
3369
|
}
|
|
3333
|
-
), /* @__PURE__ */
|
|
3370
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3334
3371
|
ColorInput2,
|
|
3335
3372
|
{
|
|
3336
3373
|
label: "Text color",
|
|
3337
3374
|
defaultValue: textColor,
|
|
3338
3375
|
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3339
3376
|
}
|
|
3340
|
-
), /* @__PURE__ */
|
|
3377
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3341
3378
|
ColorInput2,
|
|
3342
3379
|
{
|
|
3343
3380
|
label: "Link color",
|
|
3344
3381
|
defaultValue: linkColor,
|
|
3345
3382
|
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3346
3383
|
}
|
|
3347
|
-
), /* @__PURE__ */
|
|
3384
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3348
3385
|
MultiStylePropertyPanel,
|
|
3349
3386
|
{
|
|
3350
3387
|
names: ["backgroundColor", "fontFamily", "padding"],
|
|
@@ -3365,11 +3402,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3365
3402
|
setErrors(res.error);
|
|
3366
3403
|
}
|
|
3367
3404
|
};
|
|
3368
|
-
return /* @__PURE__ */
|
|
3405
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React60.createElement(
|
|
3369
3406
|
SliderInput,
|
|
3370
3407
|
{
|
|
3371
3408
|
label: "Height",
|
|
3372
|
-
iconLabel: /* @__PURE__ */
|
|
3409
|
+
iconLabel: /* @__PURE__ */ React60.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3373
3410
|
units: "px",
|
|
3374
3411
|
step: 4,
|
|
3375
3412
|
min: 4,
|
|
@@ -3391,7 +3428,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3391
3428
|
setErrors(res.error);
|
|
3392
3429
|
}
|
|
3393
3430
|
};
|
|
3394
|
-
return /* @__PURE__ */
|
|
3431
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React60.createElement(
|
|
3395
3432
|
TextInput,
|
|
3396
3433
|
{
|
|
3397
3434
|
label: "Content",
|
|
@@ -3399,14 +3436,14 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3399
3436
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
3400
3437
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
3401
3438
|
}
|
|
3402
|
-
), /* @__PURE__ */
|
|
3439
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3403
3440
|
BooleanInput,
|
|
3404
3441
|
{
|
|
3405
3442
|
label: "Markdown",
|
|
3406
3443
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
3407
3444
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
3408
3445
|
}
|
|
3409
|
-
), /* @__PURE__ */
|
|
3446
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3410
3447
|
MultiStylePropertyPanel,
|
|
3411
3448
|
{
|
|
3412
3449
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -3418,7 +3455,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3418
3455
|
|
|
3419
3456
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
3420
3457
|
function renderMessage(val) {
|
|
3421
|
-
return /* @__PURE__ */
|
|
3458
|
+
return /* @__PURE__ */ React60.createElement(Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React60.createElement(Typography, { color: "text.secondary" }, val));
|
|
3422
3459
|
}
|
|
3423
3460
|
function ConfigurationPanel() {
|
|
3424
3461
|
const document2 = useDocument();
|
|
@@ -3434,55 +3471,55 @@ function ConfigurationPanel() {
|
|
|
3434
3471
|
const { data, type } = block;
|
|
3435
3472
|
switch (type) {
|
|
3436
3473
|
case "Avatar":
|
|
3437
|
-
return /* @__PURE__ */
|
|
3474
|
+
return /* @__PURE__ */ React60.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3438
3475
|
case "Button":
|
|
3439
|
-
return /* @__PURE__ */
|
|
3476
|
+
return /* @__PURE__ */ React60.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3440
3477
|
case "ColumnsContainer":
|
|
3441
|
-
return /* @__PURE__ */
|
|
3478
|
+
return /* @__PURE__ */ React60.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3442
3479
|
case "Container":
|
|
3443
|
-
return /* @__PURE__ */
|
|
3480
|
+
return /* @__PURE__ */ React60.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3444
3481
|
case "Divider":
|
|
3445
|
-
return /* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ React60.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3446
3483
|
case "Heading":
|
|
3447
|
-
return /* @__PURE__ */
|
|
3484
|
+
return /* @__PURE__ */ React60.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3448
3485
|
case "Html":
|
|
3449
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ React60.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3450
3487
|
case "Image":
|
|
3451
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ React60.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3452
3489
|
case "EmailLayout":
|
|
3453
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ React60.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3454
3491
|
case "Spacer":
|
|
3455
|
-
return /* @__PURE__ */
|
|
3492
|
+
return /* @__PURE__ */ React60.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3456
3493
|
case "Signature":
|
|
3457
|
-
return /* @__PURE__ */
|
|
3494
|
+
return /* @__PURE__ */ React60.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3458
3495
|
case "Text":
|
|
3459
|
-
return /* @__PURE__ */
|
|
3496
|
+
return /* @__PURE__ */ React60.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3460
3497
|
default:
|
|
3461
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ React60.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
3462
3499
|
}
|
|
3463
3500
|
}
|
|
3464
3501
|
function StylesPanel() {
|
|
3465
3502
|
const block = useDocument().root;
|
|
3466
3503
|
if (!block) {
|
|
3467
|
-
return /* @__PURE__ */
|
|
3504
|
+
return /* @__PURE__ */ React60.createElement("p", null, "Block not found");
|
|
3468
3505
|
}
|
|
3469
3506
|
const { data, type } = block;
|
|
3470
3507
|
if (type !== "EmailLayout") {
|
|
3471
3508
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
3472
3509
|
}
|
|
3473
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ React60.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
3474
3511
|
}
|
|
3475
3512
|
function TemplateDownloadButton() {
|
|
3476
3513
|
const doc = useDocument();
|
|
3477
3514
|
const href = useMemo(() => {
|
|
3478
3515
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
3479
3516
|
}, [doc]);
|
|
3480
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3481
3518
|
Button$1,
|
|
3482
3519
|
{
|
|
3483
3520
|
variant: "outlined",
|
|
3484
3521
|
color: "primary",
|
|
3485
|
-
startIcon: /* @__PURE__ */
|
|
3522
|
+
startIcon: /* @__PURE__ */ React60.createElement(FileDownloadOutlined, null),
|
|
3486
3523
|
href,
|
|
3487
3524
|
download: "emailTemplate.json",
|
|
3488
3525
|
fullWidth: true
|
|
@@ -3514,9 +3551,9 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3514
3551
|
}
|
|
3515
3552
|
};
|
|
3516
3553
|
if (!currentTemplateId) {
|
|
3517
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
|
|
3518
3555
|
}
|
|
3519
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React60.createElement(Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React60.createElement(
|
|
3520
3557
|
Typography,
|
|
3521
3558
|
{
|
|
3522
3559
|
variant: "body2",
|
|
@@ -3529,29 +3566,110 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3529
3566
|
}
|
|
3530
3567
|
},
|
|
3531
3568
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
3532
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
3569
|
+
), persistenceEnabled && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
3533
3570
|
Button$1,
|
|
3534
3571
|
{
|
|
3535
3572
|
variant: "outlined",
|
|
3536
3573
|
color: "primary",
|
|
3537
|
-
startIcon: /* @__PURE__ */
|
|
3574
|
+
startIcon: /* @__PURE__ */ React60.createElement(ContentCopyOutlined, null),
|
|
3538
3575
|
onClick: handleCopyToSamples,
|
|
3539
3576
|
fullWidth: true,
|
|
3540
3577
|
disabled: !copyTemplate
|
|
3541
3578
|
},
|
|
3542
3579
|
"Save as Sample Template"
|
|
3543
|
-
), /* @__PURE__ */
|
|
3580
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3544
3581
|
Button$1,
|
|
3545
3582
|
{
|
|
3546
3583
|
variant: "outlined",
|
|
3547
3584
|
color: "error",
|
|
3548
|
-
startIcon: /* @__PURE__ */
|
|
3585
|
+
startIcon: /* @__PURE__ */ React60.createElement(DeleteOutlined, null),
|
|
3549
3586
|
onClick: handleDelete,
|
|
3550
3587
|
fullWidth: true,
|
|
3551
3588
|
disabled: !deleteTemplate
|
|
3552
3589
|
},
|
|
3553
3590
|
"Delete Template"
|
|
3554
|
-
)))), persistenceEnabled && /* @__PURE__ */
|
|
3591
|
+
)))), persistenceEnabled && /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React60.createElement(Stack, { spacing: 2 }, /* @__PURE__ */ React60.createElement(TemplateDownloadButton, null))));
|
|
3592
|
+
}
|
|
3593
|
+
var VARIABLE_NAME_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
3594
|
+
function validateName(name, index, all) {
|
|
3595
|
+
if (!name.trim()) return "Name is required";
|
|
3596
|
+
if (!VARIABLE_NAME_RE.test(name)) return "Use letters, digits, underscore; start with a letter or underscore";
|
|
3597
|
+
const duplicate = all.some((v, i) => i !== index && v.name === name);
|
|
3598
|
+
if (duplicate) return "Already declared";
|
|
3599
|
+
return null;
|
|
3600
|
+
}
|
|
3601
|
+
function VariablesPanel() {
|
|
3602
|
+
var _a;
|
|
3603
|
+
const document2 = useDocument();
|
|
3604
|
+
const root = document2.root;
|
|
3605
|
+
if (!root || root.type !== "EmailLayout") {
|
|
3606
|
+
return /* @__PURE__ */ React60.createElement(Box, { p: 2 }, /* @__PURE__ */ React60.createElement(Alert, { severity: "info" }, "Open a template to manage variables."));
|
|
3607
|
+
}
|
|
3608
|
+
const data = root.data;
|
|
3609
|
+
const variables = ((_a = data.variables) != null ? _a : []).map((v) => {
|
|
3610
|
+
var _a2;
|
|
3611
|
+
return {
|
|
3612
|
+
name: v.name,
|
|
3613
|
+
description: (_a2 = v.description) != null ? _a2 : ""
|
|
3614
|
+
};
|
|
3615
|
+
});
|
|
3616
|
+
const commit = (next) => {
|
|
3617
|
+
setDocument({
|
|
3618
|
+
root: __spreadProps(__spreadValues({}, root), {
|
|
3619
|
+
data: __spreadProps(__spreadValues({}, data), {
|
|
3620
|
+
variables: next.map((v) => ({
|
|
3621
|
+
name: v.name,
|
|
3622
|
+
description: v.description ? v.description : void 0
|
|
3623
|
+
}))
|
|
3624
|
+
})
|
|
3625
|
+
})
|
|
3626
|
+
});
|
|
3627
|
+
};
|
|
3628
|
+
const updateAt = (index, patch) => {
|
|
3629
|
+
const next = variables.map((v, i) => i === index ? __spreadValues(__spreadValues({}, v), patch) : v);
|
|
3630
|
+
commit(next);
|
|
3631
|
+
};
|
|
3632
|
+
const add = () => {
|
|
3633
|
+
commit([...variables, { name: "", description: "" }]);
|
|
3634
|
+
};
|
|
3635
|
+
const removeAt = (index) => {
|
|
3636
|
+
commit(variables.filter((_, i) => i !== index));
|
|
3637
|
+
};
|
|
3638
|
+
return /* @__PURE__ */ React60.createElement(Box, { p: 2 }, /* @__PURE__ */ React60.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React60.createElement(Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React60.createElement(Tooltip, { title: "Add variable" }, /* @__PURE__ */ React60.createElement(IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React60.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mb: 2 } }, "Declared variables travel with the template. Reference them in subject and body as", " ", /* @__PURE__ */ React60.createElement(Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), "."), variables.length === 0 ? /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React60.createElement(Stack, { spacing: 2 }, variables.map((v, i) => {
|
|
3639
|
+
var _a2;
|
|
3640
|
+
const nameError = validateName(v.name, i, variables);
|
|
3641
|
+
return /* @__PURE__ */ React60.createElement(Stack, { key: i, spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(
|
|
3642
|
+
TextField,
|
|
3643
|
+
{
|
|
3644
|
+
label: "Name",
|
|
3645
|
+
size: "small",
|
|
3646
|
+
fullWidth: true,
|
|
3647
|
+
value: v.name,
|
|
3648
|
+
onChange: (e) => updateAt(i, { name: e.target.value }),
|
|
3649
|
+
error: Boolean(nameError),
|
|
3650
|
+
helperText: nameError != null ? nameError : " "
|
|
3651
|
+
}
|
|
3652
|
+
), /* @__PURE__ */ React60.createElement(Tooltip, { title: "Remove" }, /* @__PURE__ */ React60.createElement(
|
|
3653
|
+
IconButton,
|
|
3654
|
+
{
|
|
3655
|
+
size: "small",
|
|
3656
|
+
onClick: () => removeAt(i),
|
|
3657
|
+
"aria-label": `Remove ${v.name || "variable"}`,
|
|
3658
|
+
sx: { mt: 0.5 }
|
|
3659
|
+
},
|
|
3660
|
+
/* @__PURE__ */ React60.createElement(DeleteOutline, { fontSize: "small" })
|
|
3661
|
+
))), /* @__PURE__ */ React60.createElement(
|
|
3662
|
+
TextField,
|
|
3663
|
+
{
|
|
3664
|
+
label: "Description",
|
|
3665
|
+
size: "small",
|
|
3666
|
+
fullWidth: true,
|
|
3667
|
+
value: (_a2 = v.description) != null ? _a2 : "",
|
|
3668
|
+
onChange: (e) => updateAt(i, { description: e.target.value }),
|
|
3669
|
+
placeholder: "Optional"
|
|
3670
|
+
}
|
|
3671
|
+
));
|
|
3672
|
+
})));
|
|
3555
3673
|
}
|
|
3556
3674
|
|
|
3557
3675
|
// src/app/inspector-drawer/index.tsx
|
|
@@ -3568,11 +3686,13 @@ function InspectorDrawer({
|
|
|
3568
3686
|
const renderCurrentSidebarPanel = () => {
|
|
3569
3687
|
switch (selectedSidebarTab) {
|
|
3570
3688
|
case "block-configuration":
|
|
3571
|
-
return /* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ React60.createElement(ConfigurationPanel, null);
|
|
3572
3690
|
case "styles":
|
|
3573
|
-
return /* @__PURE__ */
|
|
3691
|
+
return /* @__PURE__ */ React60.createElement(StylesPanel, null);
|
|
3692
|
+
case "variables":
|
|
3693
|
+
return /* @__PURE__ */ React60.createElement(VariablesPanel, null);
|
|
3574
3694
|
case "template-settings":
|
|
3575
|
-
return /* @__PURE__ */
|
|
3695
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3576
3696
|
TemplatePanel,
|
|
3577
3697
|
{
|
|
3578
3698
|
deleteTemplate,
|
|
@@ -3581,7 +3701,7 @@ function InspectorDrawer({
|
|
|
3581
3701
|
);
|
|
3582
3702
|
}
|
|
3583
3703
|
};
|
|
3584
|
-
return /* @__PURE__ */
|
|
3704
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3585
3705
|
Drawer,
|
|
3586
3706
|
{
|
|
3587
3707
|
variant: "persistent",
|
|
@@ -3603,30 +3723,437 @@ function InspectorDrawer({
|
|
|
3603
3723
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
3604
3724
|
}
|
|
3605
3725
|
},
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
|
|
3726
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React60.createElement(Box, { px: 1 }, /* @__PURE__ */ React60.createElement(
|
|
3727
|
+
Tabs,
|
|
3728
|
+
{
|
|
3729
|
+
value: selectedSidebarTab,
|
|
3730
|
+
onChange: (_, v) => setSidebarTab(v),
|
|
3731
|
+
variant: "fullWidth",
|
|
3732
|
+
sx: { "& .MuiTab-root": { minWidth: 0, px: 1, fontSize: 13 } }
|
|
3733
|
+
},
|
|
3734
|
+
/* @__PURE__ */ React60.createElement(Tab, { value: "styles", label: "Styles" }),
|
|
3735
|
+
/* @__PURE__ */ React60.createElement(Tab, { value: "block-configuration", label: "Inspect" }),
|
|
3736
|
+
/* @__PURE__ */ React60.createElement(Tab, { value: "variables", label: "Variables" }),
|
|
3737
|
+
/* @__PURE__ */ React60.createElement(Tab, { value: "template-settings", label: "Settings" })
|
|
3738
|
+
))),
|
|
3739
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
|
|
3608
3740
|
);
|
|
3609
3741
|
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3742
|
+
var SnackbarContext = createContext(null);
|
|
3743
|
+
function useSnackbar() {
|
|
3744
|
+
const context = useContext(SnackbarContext);
|
|
3745
|
+
if (!context) {
|
|
3746
|
+
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
3747
|
+
}
|
|
3748
|
+
return context;
|
|
3749
|
+
}
|
|
3750
|
+
function SnackbarProvider({ children }) {
|
|
3751
|
+
const [message, setMessage] = useState(null);
|
|
3752
|
+
const [duration, setDuration] = useState(3e3);
|
|
3753
|
+
const showMessage = (text, customDuration = 3e3) => {
|
|
3754
|
+
setMessage(text);
|
|
3755
|
+
setDuration(customDuration);
|
|
3756
|
+
};
|
|
3757
|
+
const handleClose = () => {
|
|
3758
|
+
setMessage(null);
|
|
3759
|
+
};
|
|
3760
|
+
return /* @__PURE__ */ React60.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React60.createElement(
|
|
3761
|
+
Snackbar,
|
|
3762
|
+
{
|
|
3763
|
+
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
3764
|
+
open: message !== null,
|
|
3765
|
+
onClose: handleClose,
|
|
3766
|
+
message,
|
|
3767
|
+
autoHideDuration: duration,
|
|
3768
|
+
sx: {
|
|
3769
|
+
zIndex: 1e4,
|
|
3770
|
+
// Very high z-index
|
|
3771
|
+
position: "fixed"
|
|
3772
|
+
// Make sure it's fixed positioned
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
));
|
|
3776
|
+
}
|
|
3777
|
+
function relativeTime(iso) {
|
|
3778
|
+
if (!iso) return null;
|
|
3779
|
+
const date = new Date(iso).getTime();
|
|
3780
|
+
if (Number.isNaN(date)) return null;
|
|
3781
|
+
const diffMs = Date.now() - date;
|
|
3782
|
+
const diffSec = Math.round(diffMs / 1e3);
|
|
3783
|
+
if (diffSec < 60) return "just now";
|
|
3784
|
+
const diffMin = Math.round(diffSec / 60);
|
|
3785
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
3786
|
+
const diffHr = Math.round(diffMin / 60);
|
|
3787
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
3788
|
+
const diffDay = Math.round(diffHr / 24);
|
|
3789
|
+
if (diffDay < 30) return `${diffDay}d ago`;
|
|
3790
|
+
const diffMo = Math.round(diffDay / 30);
|
|
3791
|
+
if (diffMo < 12) return `${diffMo}mo ago`;
|
|
3792
|
+
const diffYr = Math.round(diffMo / 12);
|
|
3793
|
+
return `${diffYr}y ago`;
|
|
3794
|
+
}
|
|
3795
|
+
function TemplateRow({
|
|
3796
|
+
template,
|
|
3797
|
+
isCurrent,
|
|
3613
3798
|
templateLoader,
|
|
3614
|
-
|
|
3799
|
+
onDuplicate,
|
|
3800
|
+
onRename,
|
|
3801
|
+
onDelete,
|
|
3802
|
+
onPromote,
|
|
3803
|
+
onDemote,
|
|
3804
|
+
onDuplicateAsTemplate
|
|
3615
3805
|
}) {
|
|
3616
3806
|
const { setCurrentTemplate } = useEmailEditor();
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3807
|
+
const [hover, setHover] = useState(false);
|
|
3808
|
+
const handleClick = () => __async(null, null, function* () {
|
|
3619
3809
|
try {
|
|
3620
|
-
const
|
|
3621
|
-
if (
|
|
3622
|
-
resetDocument(
|
|
3623
|
-
setCurrentTemplate(
|
|
3810
|
+
const content = yield templateLoader();
|
|
3811
|
+
if (content) {
|
|
3812
|
+
resetDocument(content);
|
|
3813
|
+
setCurrentTemplate(template.id, template.slug, template.kind);
|
|
3624
3814
|
}
|
|
3625
3815
|
} catch (error) {
|
|
3626
3816
|
console.error("Error loading template:", error);
|
|
3627
3817
|
}
|
|
3628
3818
|
});
|
|
3629
|
-
|
|
3819
|
+
const stop = (e) => {
|
|
3820
|
+
e.stopPropagation();
|
|
3821
|
+
};
|
|
3822
|
+
const updated = relativeTime(template.updatedAt);
|
|
3823
|
+
const hasActions = Boolean(
|
|
3824
|
+
onDuplicate || onRename || onDelete || onPromote || onDemote || onDuplicateAsTemplate
|
|
3825
|
+
);
|
|
3826
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3827
|
+
Box,
|
|
3828
|
+
{
|
|
3829
|
+
role: "button",
|
|
3830
|
+
tabIndex: 0,
|
|
3831
|
+
onClick: handleClick,
|
|
3832
|
+
onKeyDown: (e) => {
|
|
3833
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3834
|
+
e.preventDefault();
|
|
3835
|
+
handleClick();
|
|
3836
|
+
}
|
|
3837
|
+
},
|
|
3838
|
+
onMouseEnter: () => setHover(true),
|
|
3839
|
+
onMouseLeave: () => setHover(false),
|
|
3840
|
+
sx: {
|
|
3841
|
+
position: "relative",
|
|
3842
|
+
width: "100%",
|
|
3843
|
+
px: 1.5,
|
|
3844
|
+
py: 1,
|
|
3845
|
+
borderRadius: 1,
|
|
3846
|
+
cursor: "pointer",
|
|
3847
|
+
bgcolor: isCurrent ? "rgba(0, 0, 0, 0.08)" : "transparent",
|
|
3848
|
+
"&:hover": { bgcolor: "rgba(0, 0, 0, 0.04)" },
|
|
3849
|
+
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
3850
|
+
}
|
|
3851
|
+
},
|
|
3852
|
+
/* @__PURE__ */ React60.createElement(Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React60.createElement(Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React60.createElement(Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React60.createElement(
|
|
3853
|
+
Typography,
|
|
3854
|
+
{
|
|
3855
|
+
variant: "body2",
|
|
3856
|
+
sx: {
|
|
3857
|
+
fontWeight: 600,
|
|
3858
|
+
flexGrow: 1,
|
|
3859
|
+
overflow: "hidden",
|
|
3860
|
+
textOverflow: "ellipsis",
|
|
3861
|
+
whiteSpace: "nowrap"
|
|
3862
|
+
},
|
|
3863
|
+
title: template.slug
|
|
3864
|
+
},
|
|
3865
|
+
template.slug
|
|
3866
|
+
), updated && /* @__PURE__ */ React60.createElement(
|
|
3867
|
+
Typography,
|
|
3868
|
+
{
|
|
3869
|
+
variant: "caption",
|
|
3870
|
+
sx: { color: "text.secondary", flexShrink: 0, fontSize: "0.7rem" }
|
|
3871
|
+
},
|
|
3872
|
+
updated
|
|
3873
|
+
)), template.description && /* @__PURE__ */ React60.createElement(
|
|
3874
|
+
Typography,
|
|
3875
|
+
{
|
|
3876
|
+
variant: "caption",
|
|
3877
|
+
sx: {
|
|
3878
|
+
color: "text.secondary",
|
|
3879
|
+
display: "-webkit-box",
|
|
3880
|
+
WebkitLineClamp: 2,
|
|
3881
|
+
WebkitBoxOrient: "vertical",
|
|
3882
|
+
overflow: "hidden",
|
|
3883
|
+
lineHeight: 1.3
|
|
3884
|
+
}
|
|
3885
|
+
},
|
|
3886
|
+
template.description
|
|
3887
|
+
), template.tags && template.tags.length > 0 && /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React60.createElement(
|
|
3888
|
+
Chip,
|
|
3889
|
+
{
|
|
3890
|
+
key: tag,
|
|
3891
|
+
label: tag,
|
|
3892
|
+
size: "small",
|
|
3893
|
+
sx: { height: 18, fontSize: "0.65rem", "& .MuiChip-label": { px: 0.75 } }
|
|
3894
|
+
}
|
|
3895
|
+
))))),
|
|
3896
|
+
hasActions && hover && /* @__PURE__ */ React60.createElement(
|
|
3897
|
+
Stack,
|
|
3898
|
+
{
|
|
3899
|
+
direction: "row",
|
|
3900
|
+
spacing: 0.25,
|
|
3901
|
+
onClick: stop,
|
|
3902
|
+
sx: {
|
|
3903
|
+
position: "absolute",
|
|
3904
|
+
top: 4,
|
|
3905
|
+
right: 4,
|
|
3906
|
+
bgcolor: "background.paper",
|
|
3907
|
+
borderRadius: 1,
|
|
3908
|
+
boxShadow: 1,
|
|
3909
|
+
p: 0.25
|
|
3910
|
+
}
|
|
3911
|
+
},
|
|
3912
|
+
onDuplicateAsTemplate && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Duplicate as template" }, /* @__PURE__ */ React60.createElement(
|
|
3913
|
+
IconButton,
|
|
3914
|
+
{
|
|
3915
|
+
size: "small",
|
|
3916
|
+
onClick: (e) => {
|
|
3917
|
+
stop(e);
|
|
3918
|
+
onDuplicateAsTemplate();
|
|
3919
|
+
}
|
|
3920
|
+
},
|
|
3921
|
+
/* @__PURE__ */ React60.createElement(LibraryAddOutlined, { fontSize: "small" })
|
|
3922
|
+
)),
|
|
3923
|
+
onDuplicate && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Duplicate" }, /* @__PURE__ */ React60.createElement(
|
|
3924
|
+
IconButton,
|
|
3925
|
+
{
|
|
3926
|
+
size: "small",
|
|
3927
|
+
onClick: (e) => {
|
|
3928
|
+
stop(e);
|
|
3929
|
+
onDuplicate();
|
|
3930
|
+
}
|
|
3931
|
+
},
|
|
3932
|
+
/* @__PURE__ */ React60.createElement(ContentCopyOutlined, { fontSize: "small" })
|
|
3933
|
+
)),
|
|
3934
|
+
onRename && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Rename" }, /* @__PURE__ */ React60.createElement(
|
|
3935
|
+
IconButton,
|
|
3936
|
+
{
|
|
3937
|
+
size: "small",
|
|
3938
|
+
onClick: (e) => {
|
|
3939
|
+
stop(e);
|
|
3940
|
+
onRename();
|
|
3941
|
+
}
|
|
3942
|
+
},
|
|
3943
|
+
/* @__PURE__ */ React60.createElement(DriveFileRenameOutlineOutlined, { fontSize: "small" })
|
|
3944
|
+
)),
|
|
3945
|
+
onPromote && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Promote to sample" }, /* @__PURE__ */ React60.createElement(
|
|
3946
|
+
IconButton,
|
|
3947
|
+
{
|
|
3948
|
+
size: "small",
|
|
3949
|
+
onClick: (e) => {
|
|
3950
|
+
stop(e);
|
|
3951
|
+
onPromote();
|
|
3952
|
+
}
|
|
3953
|
+
},
|
|
3954
|
+
/* @__PURE__ */ React60.createElement(FileUploadOutlined, { fontSize: "small" })
|
|
3955
|
+
)),
|
|
3956
|
+
onDemote && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Demote to template" }, /* @__PURE__ */ React60.createElement(
|
|
3957
|
+
IconButton,
|
|
3958
|
+
{
|
|
3959
|
+
size: "small",
|
|
3960
|
+
onClick: (e) => {
|
|
3961
|
+
stop(e);
|
|
3962
|
+
onDemote();
|
|
3963
|
+
}
|
|
3964
|
+
},
|
|
3965
|
+
/* @__PURE__ */ React60.createElement(FileDownloadOutlined, { fontSize: "small" })
|
|
3966
|
+
)),
|
|
3967
|
+
onDelete && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Delete" }, /* @__PURE__ */ React60.createElement(
|
|
3968
|
+
IconButton,
|
|
3969
|
+
{
|
|
3970
|
+
size: "small",
|
|
3971
|
+
onClick: (e) => {
|
|
3972
|
+
stop(e);
|
|
3973
|
+
onDelete();
|
|
3974
|
+
}
|
|
3975
|
+
},
|
|
3976
|
+
/* @__PURE__ */ React60.createElement(DeleteOutlined, { fontSize: "small" })
|
|
3977
|
+
))
|
|
3978
|
+
)
|
|
3979
|
+
);
|
|
3980
|
+
}
|
|
3981
|
+
function RenameDialog({
|
|
3982
|
+
open,
|
|
3983
|
+
currentSlug,
|
|
3984
|
+
existingSlugs,
|
|
3985
|
+
onClose,
|
|
3986
|
+
onSubmit
|
|
3987
|
+
}) {
|
|
3988
|
+
const [value, setValue] = useState(currentSlug);
|
|
3989
|
+
const [error, setError] = useState(null);
|
|
3990
|
+
const [submitting, setSubmitting] = useState(false);
|
|
3991
|
+
useEffect(() => {
|
|
3992
|
+
if (open) {
|
|
3993
|
+
setValue(currentSlug);
|
|
3994
|
+
setError(null);
|
|
3995
|
+
setSubmitting(false);
|
|
3996
|
+
}
|
|
3997
|
+
}, [open, currentSlug]);
|
|
3998
|
+
const handleChange = (e) => {
|
|
3999
|
+
setValue(e.target.value);
|
|
4000
|
+
setError(null);
|
|
4001
|
+
};
|
|
4002
|
+
const handleSubmit = () => __async(null, null, function* () {
|
|
4003
|
+
const trimmed = value.trim();
|
|
4004
|
+
if (!trimmed) {
|
|
4005
|
+
setError("Please enter a name");
|
|
4006
|
+
return;
|
|
4007
|
+
}
|
|
4008
|
+
if (trimmed === currentSlug) {
|
|
4009
|
+
onClose();
|
|
4010
|
+
return;
|
|
4011
|
+
}
|
|
4012
|
+
if (existingSlugs.some((s) => s.toLowerCase() === trimmed.toLowerCase())) {
|
|
4013
|
+
setError("A template with this name already exists");
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
setSubmitting(true);
|
|
4017
|
+
try {
|
|
4018
|
+
yield onSubmit(trimmed);
|
|
4019
|
+
onClose();
|
|
4020
|
+
} catch (e) {
|
|
4021
|
+
console.error("Error renaming template:", e);
|
|
4022
|
+
setError("Failed to rename template");
|
|
4023
|
+
} finally {
|
|
4024
|
+
setSubmitting(false);
|
|
4025
|
+
}
|
|
4026
|
+
});
|
|
4027
|
+
return /* @__PURE__ */ React60.createElement(Dialog, { open, onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React60.createElement(DialogTitle, null, "Rename template"), /* @__PURE__ */ React60.createElement(DialogContent, null, /* @__PURE__ */ React60.createElement(
|
|
4028
|
+
TextField,
|
|
4029
|
+
{
|
|
4030
|
+
autoFocus: true,
|
|
4031
|
+
margin: "dense",
|
|
4032
|
+
label: "Slug",
|
|
4033
|
+
fullWidth: true,
|
|
4034
|
+
variant: "outlined",
|
|
4035
|
+
value,
|
|
4036
|
+
onChange: handleChange,
|
|
4037
|
+
error: !!error,
|
|
4038
|
+
helperText: error,
|
|
4039
|
+
disabled: submitting,
|
|
4040
|
+
onKeyPress: (e) => {
|
|
4041
|
+
if (e.key === "Enter" && !submitting) {
|
|
4042
|
+
handleSubmit();
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
)), /* @__PURE__ */ React60.createElement(DialogActions, null, /* @__PURE__ */ React60.createElement(Button$1, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React60.createElement(
|
|
4047
|
+
Button$1,
|
|
4048
|
+
{
|
|
4049
|
+
onClick: handleSubmit,
|
|
4050
|
+
variant: "contained",
|
|
4051
|
+
disabled: !value.trim() || submitting
|
|
4052
|
+
},
|
|
4053
|
+
submitting ? "Renaming..." : "Rename"
|
|
4054
|
+
)));
|
|
4055
|
+
}
|
|
4056
|
+
function SaveTemplateDialog({
|
|
4057
|
+
open,
|
|
4058
|
+
onClose,
|
|
4059
|
+
onSave,
|
|
4060
|
+
onNameChange,
|
|
4061
|
+
defaultName = "",
|
|
4062
|
+
error: externalError = null
|
|
4063
|
+
}) {
|
|
4064
|
+
const [templateName, setTemplateName] = useState(defaultName);
|
|
4065
|
+
const [internalError, setInternalError] = useState("");
|
|
4066
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
4067
|
+
useEffect(() => {
|
|
4068
|
+
if (open) {
|
|
4069
|
+
setTemplateName(defaultName);
|
|
4070
|
+
setInternalError("");
|
|
4071
|
+
setIsSubmitting(false);
|
|
4072
|
+
}
|
|
4073
|
+
}, [open, defaultName]);
|
|
4074
|
+
const displayError = externalError || internalError;
|
|
4075
|
+
const handleNameChange = (e) => {
|
|
4076
|
+
setTemplateName(e.target.value);
|
|
4077
|
+
if (e.target.value.trim()) {
|
|
4078
|
+
setInternalError("");
|
|
4079
|
+
}
|
|
4080
|
+
if (onNameChange) {
|
|
4081
|
+
onNameChange();
|
|
4082
|
+
}
|
|
4083
|
+
};
|
|
4084
|
+
const handleSave = () => __async(null, null, function* () {
|
|
4085
|
+
if (!templateName.trim()) {
|
|
4086
|
+
setInternalError("Please enter a template name");
|
|
4087
|
+
return;
|
|
4088
|
+
}
|
|
4089
|
+
setIsSubmitting(true);
|
|
4090
|
+
try {
|
|
4091
|
+
const result = onSave(templateName);
|
|
4092
|
+
if (result instanceof Promise) {
|
|
4093
|
+
const success = yield result;
|
|
4094
|
+
if (success) {
|
|
4095
|
+
setTemplateName("");
|
|
4096
|
+
setInternalError("");
|
|
4097
|
+
onClose();
|
|
4098
|
+
}
|
|
4099
|
+
} else if (result !== false) {
|
|
4100
|
+
setTemplateName("");
|
|
4101
|
+
setInternalError("");
|
|
4102
|
+
onClose();
|
|
4103
|
+
}
|
|
4104
|
+
} catch (error) {
|
|
4105
|
+
console.error("Error saving template:", error);
|
|
4106
|
+
} finally {
|
|
4107
|
+
setIsSubmitting(false);
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
const handleCancel = () => {
|
|
4111
|
+
setTemplateName("");
|
|
4112
|
+
setInternalError("");
|
|
4113
|
+
onClose();
|
|
4114
|
+
};
|
|
4115
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4116
|
+
Dialog,
|
|
4117
|
+
{
|
|
4118
|
+
open,
|
|
4119
|
+
onClose: handleCancel,
|
|
4120
|
+
maxWidth: "sm",
|
|
4121
|
+
fullWidth: true
|
|
4122
|
+
},
|
|
4123
|
+
/* @__PURE__ */ React60.createElement(DialogTitle, null, "Save Email Template"),
|
|
4124
|
+
/* @__PURE__ */ React60.createElement(DialogContent, null, /* @__PURE__ */ React60.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React60.createElement(
|
|
4125
|
+
TextField,
|
|
4126
|
+
{
|
|
4127
|
+
autoFocus: true,
|
|
4128
|
+
margin: "dense",
|
|
4129
|
+
id: "template-name",
|
|
4130
|
+
label: "Template Name",
|
|
4131
|
+
type: "text",
|
|
4132
|
+
fullWidth: true,
|
|
4133
|
+
variant: "outlined",
|
|
4134
|
+
value: templateName,
|
|
4135
|
+
onChange: handleNameChange,
|
|
4136
|
+
error: !!displayError,
|
|
4137
|
+
helperText: displayError,
|
|
4138
|
+
onKeyPress: (e) => {
|
|
4139
|
+
if (e.key === "Enter" && templateName.trim() && !displayError && !isSubmitting) {
|
|
4140
|
+
handleSave();
|
|
4141
|
+
}
|
|
4142
|
+
},
|
|
4143
|
+
disabled: isSubmitting
|
|
4144
|
+
}
|
|
4145
|
+
))),
|
|
4146
|
+
/* @__PURE__ */ React60.createElement(DialogActions, null, /* @__PURE__ */ React60.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React60.createElement(
|
|
4147
|
+
Button$1,
|
|
4148
|
+
{
|
|
4149
|
+
onClick: handleSave,
|
|
4150
|
+
variant: "contained",
|
|
4151
|
+
color: "primary",
|
|
4152
|
+
disabled: !templateName.trim() || !!displayError || isSubmitting
|
|
4153
|
+
},
|
|
4154
|
+
isSubmitting ? "Saving..." : "Save Template"
|
|
4155
|
+
))
|
|
4156
|
+
);
|
|
3630
4157
|
}
|
|
3631
4158
|
|
|
3632
4159
|
// sample-templates/empty-email-message.ts
|
|
@@ -3645,12 +4172,29 @@ var EMPTY_EMAIL_MESSAGE = {
|
|
|
3645
4172
|
var empty_email_message_default = EMPTY_EMAIL_MESSAGE;
|
|
3646
4173
|
|
|
3647
4174
|
// src/app/templates-drawer/index.tsx
|
|
3648
|
-
var SAMPLES_DRAWER_WIDTH =
|
|
4175
|
+
var SAMPLES_DRAWER_WIDTH = 320;
|
|
3649
4176
|
var EMPTY_TEMPLATE = {
|
|
3650
4177
|
id: "empty-email",
|
|
3651
|
-
|
|
4178
|
+
slug: "Empty email",
|
|
4179
|
+
kind: "sample",
|
|
3652
4180
|
description: "A blank email template to start from scratch"
|
|
3653
4181
|
};
|
|
4182
|
+
var SORT_OPTIONS = [
|
|
4183
|
+
{ value: "updatedAt", label: "Last updated" },
|
|
4184
|
+
{ value: "createdAt", label: "Recently created" },
|
|
4185
|
+
{ value: "slug", label: "Name (A\u2013Z)" }
|
|
4186
|
+
];
|
|
4187
|
+
function compareTemplates(a, b, key) {
|
|
4188
|
+
if (key === "slug") {
|
|
4189
|
+
return a.slug.localeCompare(b.slug);
|
|
4190
|
+
}
|
|
4191
|
+
const av = a[key];
|
|
4192
|
+
const bv = b[key];
|
|
4193
|
+
if (!av && !bv) return 0;
|
|
4194
|
+
if (!av) return 1;
|
|
4195
|
+
if (!bv) return -1;
|
|
4196
|
+
return new Date(bv).getTime() - new Date(av).getTime();
|
|
4197
|
+
}
|
|
3654
4198
|
function SamplesDrawer({
|
|
3655
4199
|
enterDuration = 225,
|
|
3656
4200
|
exitDuration = 225,
|
|
@@ -3659,13 +4203,27 @@ function SamplesDrawer({
|
|
|
3659
4203
|
loadTemplates,
|
|
3660
4204
|
loadTemplate,
|
|
3661
4205
|
currentTemplateId,
|
|
3662
|
-
deleteTemplate
|
|
4206
|
+
deleteTemplate,
|
|
4207
|
+
copyTemplate,
|
|
4208
|
+
renameTemplate,
|
|
4209
|
+
setTemplateKind,
|
|
4210
|
+
saveAs
|
|
3663
4211
|
}) {
|
|
4212
|
+
var _a;
|
|
3664
4213
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
4214
|
+
const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
|
|
4215
|
+
const { showMessage } = useSnackbar();
|
|
3665
4216
|
const [samples, setSamples] = useState([EMPTY_TEMPLATE]);
|
|
3666
4217
|
const [templates, setTemplates] = useState([]);
|
|
3667
4218
|
const [loadingSamples, setLoadingSamples] = useState(false);
|
|
3668
4219
|
const [loadingTemplates, setLoadingTemplates] = useState(false);
|
|
4220
|
+
const [templatesError, setTemplatesError] = useState(null);
|
|
4221
|
+
const [search, setSearch] = useState("");
|
|
4222
|
+
const [sortKey, setSortKey] = useState("updatedAt");
|
|
4223
|
+
const [activeTags, setActiveTags] = useState([]);
|
|
4224
|
+
const [renameTarget, setRenameTarget] = useState(null);
|
|
4225
|
+
const [pendingSaveAs, setPendingSaveAs] = useState(null);
|
|
4226
|
+
const [newError, setNewError] = useState(null);
|
|
3669
4227
|
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
3670
4228
|
if (templateId === "empty-email") {
|
|
3671
4229
|
return empty_email_message_default;
|
|
@@ -3675,149 +4233,295 @@ function SamplesDrawer({
|
|
|
3675
4233
|
}
|
|
3676
4234
|
return null;
|
|
3677
4235
|
});
|
|
4236
|
+
const withKind = (items, fallback) => items.map((item) => item.kind ? item : __spreadProps(__spreadValues({}, item), { kind: fallback }));
|
|
3678
4237
|
useEffect(() => {
|
|
3679
|
-
if (enabled
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
}).catch((error) => {
|
|
3690
|
-
console.error("Failed to load samples:", error);
|
|
3691
|
-
setSamples([EMPTY_TEMPLATE]);
|
|
3692
|
-
setLoadingSamples(false);
|
|
3693
|
-
});
|
|
3694
|
-
}
|
|
4238
|
+
if (!enabled || !samplesDrawerOpen || !loadSamples) return;
|
|
4239
|
+
setLoadingSamples(true);
|
|
4240
|
+
loadSamples().then((results) => {
|
|
4241
|
+
const normalized = withKind(results, "sample");
|
|
4242
|
+
const existingEmpty = normalized.find((s) => s.id === "empty-email");
|
|
4243
|
+
setSamples(existingEmpty ? normalized : [EMPTY_TEMPLATE, ...normalized]);
|
|
4244
|
+
}).catch((error) => {
|
|
4245
|
+
console.error("Failed to load samples:", error);
|
|
4246
|
+
setSamples([EMPTY_TEMPLATE]);
|
|
4247
|
+
}).finally(() => setLoadingSamples(false));
|
|
3695
4248
|
}, [enabled, samplesDrawerOpen, loadSamples]);
|
|
3696
|
-
|
|
3697
|
-
if (
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
4249
|
+
const refreshTemplates = () => __async(null, null, function* () {
|
|
4250
|
+
if (!loadTemplates) return;
|
|
4251
|
+
setLoadingTemplates(true);
|
|
4252
|
+
setTemplatesError(null);
|
|
4253
|
+
try {
|
|
4254
|
+
const results = yield loadTemplates();
|
|
4255
|
+
setTemplates(withKind(results, "template"));
|
|
4256
|
+
} catch (error) {
|
|
4257
|
+
console.error("Failed to load templates:", error);
|
|
4258
|
+
setTemplatesError("Could not load templates");
|
|
4259
|
+
} finally {
|
|
4260
|
+
setLoadingTemplates(false);
|
|
3706
4261
|
}
|
|
4262
|
+
});
|
|
4263
|
+
useEffect(() => {
|
|
4264
|
+
if (!enabled || !loadTemplates) return;
|
|
4265
|
+
refreshTemplates();
|
|
3707
4266
|
}, [enabled, loadTemplates]);
|
|
3708
4267
|
useEffect(() => {
|
|
3709
|
-
const
|
|
3710
|
-
|
|
4268
|
+
const handler = (e) => {
|
|
4269
|
+
const detail = e.detail;
|
|
4270
|
+
if (Array.isArray(detail)) setTemplates(withKind(detail, "template"));
|
|
3711
4271
|
};
|
|
3712
|
-
window.addEventListener("templateListUpdated",
|
|
3713
|
-
return () => window.removeEventListener("templateListUpdated",
|
|
4272
|
+
window.addEventListener("templateListUpdated", handler);
|
|
4273
|
+
return () => window.removeEventListener("templateListUpdated", handler);
|
|
3714
4274
|
}, []);
|
|
4275
|
+
const { templateRows, sampleRows } = useMemo(() => {
|
|
4276
|
+
const byId = /* @__PURE__ */ new Map();
|
|
4277
|
+
for (const s of samples) byId.set(s.id, s);
|
|
4278
|
+
for (const t of templates) byId.set(t.id, t);
|
|
4279
|
+
const all = Array.from(byId.values());
|
|
4280
|
+
return {
|
|
4281
|
+
templateRows: all.filter((t) => t.kind === "template"),
|
|
4282
|
+
sampleRows: all.filter((t) => t.kind === "sample")
|
|
4283
|
+
};
|
|
4284
|
+
}, [samples, templates]);
|
|
4285
|
+
const allTags = useMemo(() => {
|
|
4286
|
+
var _a2;
|
|
4287
|
+
const set = /* @__PURE__ */ new Set();
|
|
4288
|
+
for (const t of templateRows) {
|
|
4289
|
+
(_a2 = t.tags) == null ? void 0 : _a2.forEach((tag) => set.add(tag));
|
|
4290
|
+
}
|
|
4291
|
+
return Array.from(set).sort();
|
|
4292
|
+
}, [templateRows]);
|
|
4293
|
+
const filteredTemplates = useMemo(() => {
|
|
4294
|
+
const term = search.trim().toLowerCase();
|
|
4295
|
+
const matchSearch = (t) => {
|
|
4296
|
+
if (!term) return true;
|
|
4297
|
+
const haystack = [t.slug, t.description, t.subject].filter(Boolean).join(" ").toLowerCase();
|
|
4298
|
+
return haystack.includes(term);
|
|
4299
|
+
};
|
|
4300
|
+
const matchTags = (t) => {
|
|
4301
|
+
if (activeTags.length === 0) return true;
|
|
4302
|
+
if (!t.tags || t.tags.length === 0) return false;
|
|
4303
|
+
return activeTags.every((tag) => t.tags.includes(tag));
|
|
4304
|
+
};
|
|
4305
|
+
return templateRows.filter((t) => matchSearch(t) && matchTags(t)).slice().sort((a, b) => compareTemplates(a, b, sortKey));
|
|
4306
|
+
}, [templateRows, search, activeTags, sortKey]);
|
|
4307
|
+
const toggleTag = (tag) => {
|
|
4308
|
+
setActiveTags((prev) => prev.includes(tag) ? prev.filter((t) => t !== tag) : [...prev, tag]);
|
|
4309
|
+
};
|
|
4310
|
+
const handleDuplicate = (template) => {
|
|
4311
|
+
if (!copyTemplate) return;
|
|
4312
|
+
(() => __async(null, null, function* () {
|
|
4313
|
+
try {
|
|
4314
|
+
const full = yield handleLoadTemplate(template.id);
|
|
4315
|
+
if (!full) {
|
|
4316
|
+
showMessage("Could not load template to duplicate");
|
|
4317
|
+
return;
|
|
4318
|
+
}
|
|
4319
|
+
copyTemplate(`${template.slug} (Copy)`, full);
|
|
4320
|
+
showMessage("Template duplicated");
|
|
4321
|
+
} catch (e) {
|
|
4322
|
+
console.error("Error duplicating template:", e);
|
|
4323
|
+
showMessage("Error duplicating template");
|
|
4324
|
+
}
|
|
4325
|
+
}))();
|
|
4326
|
+
};
|
|
4327
|
+
const handleDelete = (template) => {
|
|
4328
|
+
if (!deleteTemplate) return;
|
|
4329
|
+
if (!window.confirm(`Delete "${template.slug}"? This cannot be undone.`)) return;
|
|
4330
|
+
deleteTemplate(template.id);
|
|
4331
|
+
showMessage("Template deleted");
|
|
4332
|
+
};
|
|
4333
|
+
const handleRenameSubmit = (newSlug) => __async(null, null, function* () {
|
|
4334
|
+
if (!renameTarget || !renameTemplate) return;
|
|
4335
|
+
yield renameTemplate(renameTarget.id, newSlug);
|
|
4336
|
+
setTemplates(
|
|
4337
|
+
(prev) => prev.map((t) => t.id === renameTarget.id ? __spreadProps(__spreadValues({}, t), { slug: newSlug }) : t)
|
|
4338
|
+
);
|
|
4339
|
+
if (currentTemplateId === renameTarget.id) {
|
|
4340
|
+
setCurrentTemplate(renameTarget.id, newSlug);
|
|
4341
|
+
}
|
|
4342
|
+
showMessage("Template renamed");
|
|
4343
|
+
});
|
|
4344
|
+
const flipKindLocally = (id, kind) => {
|
|
4345
|
+
setTemplates((prev) => prev.map((t) => t.id === id ? __spreadProps(__spreadValues({}, t), { kind }) : t));
|
|
4346
|
+
setSamples((prev) => prev.map((t) => t.id === id ? __spreadProps(__spreadValues({}, t), { kind }) : t));
|
|
4347
|
+
};
|
|
4348
|
+
const handleSetKind = (template, kind) => {
|
|
4349
|
+
if (!setTemplateKind) return;
|
|
4350
|
+
(() => __async(null, null, function* () {
|
|
4351
|
+
try {
|
|
4352
|
+
yield setTemplateKind(template.id, kind);
|
|
4353
|
+
flipKindLocally(template.id, kind);
|
|
4354
|
+
if (currentTemplateId === template.id) {
|
|
4355
|
+
setCurrentTemplate(template.id, template.slug, kind);
|
|
4356
|
+
}
|
|
4357
|
+
showMessage(kind === "sample" ? "Promoted to sample" : "Demoted to template");
|
|
4358
|
+
} catch (e) {
|
|
4359
|
+
console.error("Error updating template kind:", e);
|
|
4360
|
+
showMessage("Error updating template kind");
|
|
4361
|
+
}
|
|
4362
|
+
}))();
|
|
4363
|
+
};
|
|
4364
|
+
const handleDuplicateAsTemplate = (sample) => {
|
|
4365
|
+
if (!saveAs) return;
|
|
4366
|
+
(() => __async(null, null, function* () {
|
|
4367
|
+
try {
|
|
4368
|
+
const content = yield handleLoadTemplate(sample.id);
|
|
4369
|
+
if (!content) {
|
|
4370
|
+
showMessage("Could not load sample");
|
|
4371
|
+
return;
|
|
4372
|
+
}
|
|
4373
|
+
resetDocument(content);
|
|
4374
|
+
setPendingSaveAs({ content, defaultName: `${sample.slug} (Copy)` });
|
|
4375
|
+
} catch (e) {
|
|
4376
|
+
console.error("Error duplicating sample:", e);
|
|
4377
|
+
showMessage("Error duplicating sample");
|
|
4378
|
+
}
|
|
4379
|
+
}))();
|
|
4380
|
+
};
|
|
4381
|
+
const handleSaveAsSubmit = (templateName) => __async(null, null, function* () {
|
|
4382
|
+
if (!saveAs || !pendingSaveAs) return false;
|
|
4383
|
+
const taken = templateRows.some((t) => t.slug.toLowerCase() === templateName.toLowerCase());
|
|
4384
|
+
if (taken) {
|
|
4385
|
+
setNewError("A template with this name already exists");
|
|
4386
|
+
return false;
|
|
4387
|
+
}
|
|
4388
|
+
try {
|
|
4389
|
+
const content = pendingSaveAs.content;
|
|
4390
|
+
const { id, slug } = yield saveAs(templateName, buildSavePayload(content));
|
|
4391
|
+
resetDocument(content);
|
|
4392
|
+
setCurrentTemplate(id, slug, "template");
|
|
4393
|
+
ctxLoadTemplate(content, id, slug, "template");
|
|
4394
|
+
showMessage("New template created!");
|
|
4395
|
+
window.location.hash = `#template/${id}`;
|
|
4396
|
+
yield refreshTemplates();
|
|
4397
|
+
return true;
|
|
4398
|
+
} catch (e) {
|
|
4399
|
+
console.error("Error creating template:", e);
|
|
4400
|
+
showMessage("Error creating template");
|
|
4401
|
+
return false;
|
|
4402
|
+
}
|
|
4403
|
+
});
|
|
4404
|
+
const openNewTemplateDialog = () => {
|
|
4405
|
+
setNewError(null);
|
|
4406
|
+
setPendingSaveAs({ content: empty_email_message_default, defaultName: "New Template" });
|
|
4407
|
+
};
|
|
3715
4408
|
if (!enabled) {
|
|
3716
4409
|
return null;
|
|
3717
4410
|
}
|
|
3718
|
-
|
|
4411
|
+
const existingSlugs = templates.map((t) => t.slug);
|
|
4412
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
3719
4413
|
Drawer,
|
|
3720
4414
|
{
|
|
3721
4415
|
variant: "persistent",
|
|
3722
4416
|
anchor: "left",
|
|
3723
4417
|
open: samplesDrawerOpen,
|
|
3724
|
-
PaperProps: {
|
|
3725
|
-
style: { position: "absolute" }
|
|
3726
|
-
},
|
|
4418
|
+
PaperProps: { style: { position: "absolute" } },
|
|
3727
4419
|
ModalProps: {
|
|
3728
4420
|
container: document.getElementById("drawer-container"),
|
|
3729
4421
|
style: { position: "absolute" },
|
|
3730
4422
|
keepMounted: true
|
|
3731
4423
|
},
|
|
3732
|
-
transitionDuration: {
|
|
3733
|
-
|
|
3734
|
-
exit: exitDuration
|
|
3735
|
-
},
|
|
3736
|
-
sx: {
|
|
3737
|
-
width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0
|
|
3738
|
-
}
|
|
4424
|
+
transitionDuration: { enter: enterDuration, exit: exitDuration },
|
|
4425
|
+
sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
|
|
3739
4426
|
},
|
|
3740
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ React60.createElement(
|
|
3741
4428
|
Stack,
|
|
3742
4429
|
{
|
|
3743
|
-
spacing: 3,
|
|
3744
4430
|
py: 1,
|
|
3745
4431
|
px: 2,
|
|
3746
4432
|
width: SAMPLES_DRAWER_WIDTH,
|
|
3747
|
-
|
|
3748
|
-
|
|
4433
|
+
height: "100%",
|
|
4434
|
+
spacing: 1.5,
|
|
4435
|
+
sx: { overflowY: "auto" }
|
|
3749
4436
|
},
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
|
|
4437
|
+
/* @__PURE__ */ React60.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React60.createElement(Typography, { variant: "h6", component: "h1" }, "Templates"), saveAs && /* @__PURE__ */ React60.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React60.createElement(
|
|
4438
|
+
IconButton,
|
|
3752
4439
|
{
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
4440
|
+
size: "small",
|
|
4441
|
+
onClick: openNewTemplateDialog,
|
|
4442
|
+
"aria-label": "New template"
|
|
4443
|
+
},
|
|
4444
|
+
/* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" })
|
|
4445
|
+
))),
|
|
4446
|
+
loadTemplates && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
4447
|
+
TextField,
|
|
4448
|
+
{
|
|
4449
|
+
size: "small",
|
|
4450
|
+
placeholder: "Search templates",
|
|
4451
|
+
value: search,
|
|
4452
|
+
onChange: (e) => setSearch(e.target.value),
|
|
4453
|
+
InputProps: {
|
|
4454
|
+
startAdornment: /* @__PURE__ */ React60.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React60.createElement(SearchOutlined, { fontSize: "small" }))
|
|
3759
4455
|
}
|
|
4456
|
+
}
|
|
4457
|
+
), /* @__PURE__ */ React60.createElement(
|
|
4458
|
+
TextField,
|
|
4459
|
+
{
|
|
4460
|
+
select: true,
|
|
4461
|
+
size: "small",
|
|
4462
|
+
label: "Sort by",
|
|
4463
|
+
value: sortKey,
|
|
4464
|
+
onChange: (e) => setSortKey(e.target.value)
|
|
3760
4465
|
},
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
"
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
)
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
variant: "body2",
|
|
3798
|
-
sx: { color: "text.secondary", py: 1 }
|
|
3799
|
-
},
|
|
3800
|
-
"No saved templates"
|
|
3801
|
-
), /* @__PURE__ */ React72.createElement(Divider$1, null)),
|
|
3802
|
-
/* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3803
|
-
Typography,
|
|
3804
|
-
{
|
|
3805
|
-
variant: "subtitle2",
|
|
3806
|
-
component: "h2",
|
|
3807
|
-
sx: { fontWeight: "bold", mt: 1 }
|
|
3808
|
-
},
|
|
3809
|
-
"Sample Templates"
|
|
3810
|
-
), loadingSamples ? /* @__PURE__ */ React72.createElement(Stack, { alignItems: "center", width: "100%", py: 1 }, /* @__PURE__ */ React72.createElement(CircularProgress, { size: 24 })) : /* @__PURE__ */ React72.createElement(Stack, { alignItems: "flex-start" }, samples.map((sample) => /* @__PURE__ */ React72.createElement(
|
|
3811
|
-
SidebarButton,
|
|
3812
|
-
{
|
|
3813
|
-
key: sample.id,
|
|
3814
|
-
templateId: sample.id,
|
|
3815
|
-
templateLoader: () => handleLoadTemplate(sample.id)
|
|
3816
|
-
},
|
|
3817
|
-
sample.name
|
|
3818
|
-
))))
|
|
3819
|
-
)
|
|
4466
|
+
SORT_OPTIONS.map((opt) => /* @__PURE__ */ React60.createElement(MenuItem, { key: opt.value, value: opt.value }, opt.label))
|
|
4467
|
+
), allTags.length > 0 && /* @__PURE__ */ React60.createElement(Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, allTags.map((tag) => /* @__PURE__ */ React60.createElement(
|
|
4468
|
+
Chip,
|
|
4469
|
+
{
|
|
4470
|
+
key: tag,
|
|
4471
|
+
label: tag,
|
|
4472
|
+
size: "small",
|
|
4473
|
+
clickable: true,
|
|
4474
|
+
color: activeTags.includes(tag) ? "primary" : "default",
|
|
4475
|
+
variant: activeTags.includes(tag) ? "filled" : "outlined",
|
|
4476
|
+
onClick: () => toggleTag(tag)
|
|
4477
|
+
}
|
|
4478
|
+
))), /* @__PURE__ */ React60.createElement(Box, null, /* @__PURE__ */ React60.createElement(Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Your Templates"), loadingTemplates ? /* @__PURE__ */ React60.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React60.createElement(CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React60.createElement(Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React60.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React60.createElement(
|
|
4479
|
+
TemplateRow,
|
|
4480
|
+
{
|
|
4481
|
+
key: template.id,
|
|
4482
|
+
template,
|
|
4483
|
+
isCurrent: currentTemplateId === template.id,
|
|
4484
|
+
templateLoader: () => handleLoadTemplate(template.id),
|
|
4485
|
+
onDuplicate: copyTemplate ? () => handleDuplicate(template) : void 0,
|
|
4486
|
+
onRename: renameTemplate ? () => setRenameTarget(template) : void 0,
|
|
4487
|
+
onDelete: deleteTemplate ? () => handleDelete(template) : void 0,
|
|
4488
|
+
onPromote: setTemplateKind ? () => handleSetKind(template, "sample") : void 0
|
|
4489
|
+
}
|
|
4490
|
+
))) : /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, templateRows.length === 0 ? "No saved templates yet" : "No templates match your filters")), /* @__PURE__ */ React60.createElement(Divider$1, null)),
|
|
4491
|
+
/* @__PURE__ */ React60.createElement(Box, null, /* @__PURE__ */ React60.createElement(Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Sample Templates"), loadingSamples ? /* @__PURE__ */ React60.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React60.createElement(CircularProgress, { size: 24 })) : sampleRows.length > 0 ? /* @__PURE__ */ React60.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, sampleRows.map((sample) => /* @__PURE__ */ React60.createElement(
|
|
4492
|
+
TemplateRow,
|
|
4493
|
+
{
|
|
4494
|
+
key: sample.id,
|
|
4495
|
+
template: sample,
|
|
4496
|
+
isCurrent: currentTemplateId === sample.id,
|
|
4497
|
+
templateLoader: () => handleLoadTemplate(sample.id),
|
|
4498
|
+
onDuplicateAsTemplate: saveAs ? () => handleDuplicateAsTemplate(sample) : void 0,
|
|
4499
|
+
onDemote: setTemplateKind && sample.id !== "empty-email" ? () => handleSetKind(sample, "template") : void 0
|
|
4500
|
+
}
|
|
4501
|
+
))) : /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, "No samples available"))
|
|
3820
4502
|
)
|
|
4503
|
+
), renameTarget && /* @__PURE__ */ React60.createElement(
|
|
4504
|
+
RenameDialog,
|
|
4505
|
+
{
|
|
4506
|
+
open: !!renameTarget,
|
|
4507
|
+
currentSlug: renameTarget.slug,
|
|
4508
|
+
existingSlugs: existingSlugs.filter((s) => s !== renameTarget.slug),
|
|
4509
|
+
onClose: () => setRenameTarget(null),
|
|
4510
|
+
onSubmit: handleRenameSubmit
|
|
4511
|
+
}
|
|
4512
|
+
), /* @__PURE__ */ React60.createElement(
|
|
4513
|
+
SaveTemplateDialog,
|
|
4514
|
+
{
|
|
4515
|
+
open: !!pendingSaveAs,
|
|
4516
|
+
onClose: () => {
|
|
4517
|
+
setPendingSaveAs(null);
|
|
4518
|
+
setNewError(null);
|
|
4519
|
+
},
|
|
4520
|
+
onSave: handleSaveAsSubmit,
|
|
4521
|
+
onNameChange: () => setNewError(null),
|
|
4522
|
+
defaultName: (_a = pendingSaveAs == null ? void 0 : pendingSaveAs.defaultName) != null ? _a : "New Template",
|
|
4523
|
+
error: newError
|
|
4524
|
+
}
|
|
3821
4525
|
));
|
|
3822
4526
|
}
|
|
3823
4527
|
var BUTTON_SX2 = { p: 1.5, display: "flex", flexDirection: "column" };
|
|
@@ -3832,7 +4536,7 @@ var ICON_SX = {
|
|
|
3832
4536
|
borderColor: "cadet.300"
|
|
3833
4537
|
};
|
|
3834
4538
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
3835
|
-
return /* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3836
4540
|
Button$1,
|
|
3837
4541
|
{
|
|
3838
4542
|
sx: BUTTON_SX2,
|
|
@@ -3841,14 +4545,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
3841
4545
|
onClick();
|
|
3842
4546
|
}
|
|
3843
4547
|
},
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
4548
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: ICON_SX }, icon),
|
|
4549
|
+
/* @__PURE__ */ React60.createElement(Typography, { variant: "body2" }, label)
|
|
3846
4550
|
);
|
|
3847
4551
|
}
|
|
3848
4552
|
var BUTTONS = [
|
|
3849
4553
|
{
|
|
3850
4554
|
label: "Heading",
|
|
3851
|
-
icon: /* @__PURE__ */
|
|
4555
|
+
icon: /* @__PURE__ */ React60.createElement(HMobiledataOutlined, null),
|
|
3852
4556
|
block: () => ({
|
|
3853
4557
|
type: "Heading",
|
|
3854
4558
|
data: {
|
|
@@ -3861,7 +4565,7 @@ var BUTTONS = [
|
|
|
3861
4565
|
},
|
|
3862
4566
|
{
|
|
3863
4567
|
label: "Text",
|
|
3864
|
-
icon: /* @__PURE__ */
|
|
4568
|
+
icon: /* @__PURE__ */ React60.createElement(NotesOutlined, null),
|
|
3865
4569
|
block: () => ({
|
|
3866
4570
|
type: "Text",
|
|
3867
4571
|
data: {
|
|
@@ -3875,7 +4579,7 @@ var BUTTONS = [
|
|
|
3875
4579
|
},
|
|
3876
4580
|
{
|
|
3877
4581
|
label: "Button",
|
|
3878
|
-
icon: /* @__PURE__ */
|
|
4582
|
+
icon: /* @__PURE__ */ React60.createElement(SmartButtonOutlined, null),
|
|
3879
4583
|
block: () => ({
|
|
3880
4584
|
type: "Button",
|
|
3881
4585
|
data: {
|
|
@@ -3889,7 +4593,7 @@ var BUTTONS = [
|
|
|
3889
4593
|
},
|
|
3890
4594
|
{
|
|
3891
4595
|
label: "Image",
|
|
3892
|
-
icon: /* @__PURE__ */
|
|
4596
|
+
icon: /* @__PURE__ */ React60.createElement(ImageOutlined, null),
|
|
3893
4597
|
block: () => ({
|
|
3894
4598
|
type: "Image",
|
|
3895
4599
|
data: {
|
|
@@ -3905,7 +4609,7 @@ var BUTTONS = [
|
|
|
3905
4609
|
},
|
|
3906
4610
|
{
|
|
3907
4611
|
label: "Avatar",
|
|
3908
|
-
icon: /* @__PURE__ */
|
|
4612
|
+
icon: /* @__PURE__ */ React60.createElement(AccountCircleOutlined, null),
|
|
3909
4613
|
block: () => ({
|
|
3910
4614
|
type: "Avatar",
|
|
3911
4615
|
data: {
|
|
@@ -3919,7 +4623,7 @@ var BUTTONS = [
|
|
|
3919
4623
|
},
|
|
3920
4624
|
{
|
|
3921
4625
|
label: "Personal Signature",
|
|
3922
|
-
icon: /* @__PURE__ */
|
|
4626
|
+
icon: /* @__PURE__ */ React60.createElement(ContactMailOutlined, null),
|
|
3923
4627
|
block: () => ({
|
|
3924
4628
|
type: "Signature",
|
|
3925
4629
|
data: {
|
|
@@ -3941,7 +4645,7 @@ var BUTTONS = [
|
|
|
3941
4645
|
},
|
|
3942
4646
|
{
|
|
3943
4647
|
label: "Company Signature",
|
|
3944
|
-
icon: /* @__PURE__ */
|
|
4648
|
+
icon: /* @__PURE__ */ React60.createElement(BusinessOutlined, null),
|
|
3945
4649
|
block: () => ({
|
|
3946
4650
|
type: "Signature",
|
|
3947
4651
|
data: {
|
|
@@ -3961,7 +4665,7 @@ var BUTTONS = [
|
|
|
3961
4665
|
},
|
|
3962
4666
|
{
|
|
3963
4667
|
label: "Divider",
|
|
3964
|
-
icon: /* @__PURE__ */
|
|
4668
|
+
icon: /* @__PURE__ */ React60.createElement(HorizontalRuleOutlined, null),
|
|
3965
4669
|
block: () => ({
|
|
3966
4670
|
type: "Divider",
|
|
3967
4671
|
data: {
|
|
@@ -3974,7 +4678,7 @@ var BUTTONS = [
|
|
|
3974
4678
|
},
|
|
3975
4679
|
{
|
|
3976
4680
|
label: "Spacer",
|
|
3977
|
-
icon: /* @__PURE__ */
|
|
4681
|
+
icon: /* @__PURE__ */ React60.createElement(Crop32Outlined, null),
|
|
3978
4682
|
block: () => ({
|
|
3979
4683
|
type: "Spacer",
|
|
3980
4684
|
data: {}
|
|
@@ -3982,7 +4686,7 @@ var BUTTONS = [
|
|
|
3982
4686
|
},
|
|
3983
4687
|
{
|
|
3984
4688
|
label: "Html",
|
|
3985
|
-
icon: /* @__PURE__ */
|
|
4689
|
+
icon: /* @__PURE__ */ React60.createElement(HtmlOutlined, null),
|
|
3986
4690
|
block: () => ({
|
|
3987
4691
|
type: "Html",
|
|
3988
4692
|
data: {
|
|
@@ -3997,7 +4701,7 @@ var BUTTONS = [
|
|
|
3997
4701
|
},
|
|
3998
4702
|
{
|
|
3999
4703
|
label: "Columns",
|
|
4000
|
-
icon: /* @__PURE__ */
|
|
4704
|
+
icon: /* @__PURE__ */ React60.createElement(ViewColumnOutlined, null),
|
|
4001
4705
|
block: () => ({
|
|
4002
4706
|
type: "ColumnsContainer",
|
|
4003
4707
|
data: {
|
|
@@ -4012,7 +4716,7 @@ var BUTTONS = [
|
|
|
4012
4716
|
},
|
|
4013
4717
|
{
|
|
4014
4718
|
label: "Container",
|
|
4015
|
-
icon: /* @__PURE__ */
|
|
4719
|
+
icon: /* @__PURE__ */ React60.createElement(LibraryAddOutlined, null),
|
|
4016
4720
|
block: () => ({
|
|
4017
4721
|
type: "Container",
|
|
4018
4722
|
data: {
|
|
@@ -4036,7 +4740,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4036
4740
|
if (anchorEl === null) {
|
|
4037
4741
|
return null;
|
|
4038
4742
|
}
|
|
4039
|
-
return /* @__PURE__ */
|
|
4743
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4040
4744
|
Menu,
|
|
4041
4745
|
{
|
|
4042
4746
|
open: true,
|
|
@@ -4045,7 +4749,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4045
4749
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
4046
4750
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
4047
4751
|
},
|
|
4048
|
-
/* @__PURE__ */
|
|
4752
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React60.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
|
|
4049
4753
|
);
|
|
4050
4754
|
}
|
|
4051
4755
|
function DividerButton({ buttonElement, onClick }) {
|
|
@@ -4072,7 +4776,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4072
4776
|
window.removeEventListener("mousemove", listener);
|
|
4073
4777
|
};
|
|
4074
4778
|
}, [buttonElement, setVisible]);
|
|
4075
|
-
return /* @__PURE__ */
|
|
4779
|
+
return /* @__PURE__ */ React60.createElement(Fade, { in: visible }, /* @__PURE__ */ React60.createElement(
|
|
4076
4780
|
IconButton,
|
|
4077
4781
|
{
|
|
4078
4782
|
size: "small",
|
|
@@ -4095,11 +4799,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4095
4799
|
onClick();
|
|
4096
4800
|
}
|
|
4097
4801
|
},
|
|
4098
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" })
|
|
4099
4803
|
));
|
|
4100
4804
|
}
|
|
4101
4805
|
function PlaceholderButton({ onClick }) {
|
|
4102
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4103
4807
|
ButtonBase,
|
|
4104
4808
|
{
|
|
4105
4809
|
onClick: (ev) => {
|
|
@@ -4115,7 +4819,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
4115
4819
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
4116
4820
|
}
|
|
4117
4821
|
},
|
|
4118
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ React60.createElement(
|
|
4119
4823
|
AddOutlined,
|
|
4120
4824
|
{
|
|
4121
4825
|
sx: {
|
|
@@ -4139,12 +4843,12 @@ function AddBlockButton({ onSelect, placeholder }) {
|
|
|
4139
4843
|
};
|
|
4140
4844
|
const renderButton2 = () => {
|
|
4141
4845
|
if (placeholder) {
|
|
4142
|
-
return /* @__PURE__ */
|
|
4846
|
+
return /* @__PURE__ */ React60.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
4143
4847
|
} else {
|
|
4144
|
-
return /* @__PURE__ */
|
|
4848
|
+
return /* @__PURE__ */ React60.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
4145
4849
|
}
|
|
4146
4850
|
};
|
|
4147
|
-
return /* @__PURE__ */
|
|
4851
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React60.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
|
|
4148
4852
|
}
|
|
4149
4853
|
|
|
4150
4854
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -4171,9 +4875,9 @@ function EditorChildrenIds({ childrenIds, onChange }) {
|
|
|
4171
4875
|
});
|
|
4172
4876
|
};
|
|
4173
4877
|
if (!childrenIds || childrenIds.length === 0) {
|
|
4174
|
-
return /* @__PURE__ */
|
|
4878
|
+
return /* @__PURE__ */ React60.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
|
|
4175
4879
|
}
|
|
4176
|
-
return /* @__PURE__ */
|
|
4880
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React60.createElement(Fragment, { key: childId }, /* @__PURE__ */ React60.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), /* @__PURE__ */ React60.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React60.createElement(AddBlockButton, { onSelect: appendBlock }));
|
|
4177
4881
|
}
|
|
4178
4882
|
|
|
4179
4883
|
// src/editor/blocks/columns-container/columns-container-editor.tsx
|
|
@@ -4200,15 +4904,15 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
4200
4904
|
});
|
|
4201
4905
|
setSelectedBlockId(blockId);
|
|
4202
4906
|
};
|
|
4203
|
-
return /* @__PURE__ */
|
|
4907
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4204
4908
|
columns_container_default,
|
|
4205
4909
|
{
|
|
4206
4910
|
props: restProps,
|
|
4207
4911
|
style,
|
|
4208
4912
|
columns: [
|
|
4209
|
-
/* @__PURE__ */
|
|
4210
|
-
/* @__PURE__ */
|
|
4211
|
-
/* @__PURE__ */
|
|
4913
|
+
/* @__PURE__ */ React60.createElement(EditorChildrenIds, { childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds, onChange: (change) => updateColumn(0, change) }),
|
|
4914
|
+
/* @__PURE__ */ React60.createElement(EditorChildrenIds, { childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds, onChange: (change) => updateColumn(1, change) }),
|
|
4915
|
+
/* @__PURE__ */ React60.createElement(EditorChildrenIds, { childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds, onChange: (change) => updateColumn(2, change) })
|
|
4212
4916
|
]
|
|
4213
4917
|
}
|
|
4214
4918
|
);
|
|
@@ -4218,7 +4922,7 @@ function ContainerEditor({ style, props }) {
|
|
|
4218
4922
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
4219
4923
|
const document2 = useDocument();
|
|
4220
4924
|
const currentBlockId = useCurrentBlockId();
|
|
4221
|
-
return /* @__PURE__ */
|
|
4925
|
+
return /* @__PURE__ */ React60.createElement(container_default, { style }, /* @__PURE__ */ React60.createElement(
|
|
4222
4926
|
EditorChildrenIds,
|
|
4223
4927
|
{
|
|
4224
4928
|
childrenIds,
|
|
@@ -4418,7 +5122,7 @@ function EmailLayoutEditor(props) {
|
|
|
4418
5122
|
lineHeight: "1.5",
|
|
4419
5123
|
margin: "0"
|
|
4420
5124
|
};
|
|
4421
|
-
const editorChildren = /* @__PURE__ */
|
|
5125
|
+
const editorChildren = /* @__PURE__ */ React60.createElement(
|
|
4422
5126
|
EditorChildrenIds,
|
|
4423
5127
|
{
|
|
4424
5128
|
childrenIds,
|
|
@@ -4437,7 +5141,7 @@ function EmailLayoutEditor(props) {
|
|
|
4437
5141
|
}
|
|
4438
5142
|
);
|
|
4439
5143
|
if (props.backdropDisabled) {
|
|
4440
|
-
return /* @__PURE__ */
|
|
5144
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4441
5145
|
"div",
|
|
4442
5146
|
{
|
|
4443
5147
|
onClick: () => {
|
|
@@ -4450,10 +5154,10 @@ function EmailLayoutEditor(props) {
|
|
|
4450
5154
|
minHeight: "100%"
|
|
4451
5155
|
})
|
|
4452
5156
|
},
|
|
4453
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ React60.createElement("div", { style: { maxWidth: "600px" } }, editorChildren)
|
|
4454
5158
|
);
|
|
4455
5159
|
}
|
|
4456
|
-
return /* @__PURE__ */
|
|
5160
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4457
5161
|
"div",
|
|
4458
5162
|
{
|
|
4459
5163
|
onClick: () => {
|
|
@@ -4466,7 +5170,7 @@ function EmailLayoutEditor(props) {
|
|
|
4466
5170
|
minHeight: "100%"
|
|
4467
5171
|
})
|
|
4468
5172
|
},
|
|
4469
|
-
/* @__PURE__ */
|
|
5173
|
+
/* @__PURE__ */ React60.createElement(
|
|
4470
5174
|
"table",
|
|
4471
5175
|
{
|
|
4472
5176
|
align: "center",
|
|
@@ -4490,7 +5194,7 @@ function EmailLayoutEditor(props) {
|
|
|
4490
5194
|
cellPadding: "0",
|
|
4491
5195
|
border: 0
|
|
4492
5196
|
},
|
|
4493
|
-
/* @__PURE__ */
|
|
5197
|
+
/* @__PURE__ */ React60.createElement("tbody", null, /* @__PURE__ */ React60.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60.createElement("td", null, editorChildren)))
|
|
4494
5198
|
)
|
|
4495
5199
|
);
|
|
4496
5200
|
}
|
|
@@ -4649,7 +5353,7 @@ function TuneMenu({ blockId }) {
|
|
|
4649
5353
|
resetDocument(nDocument);
|
|
4650
5354
|
setSelectedBlockId(blockId);
|
|
4651
5355
|
};
|
|
4652
|
-
return /* @__PURE__ */
|
|
5356
|
+
return /* @__PURE__ */ React60.createElement(Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React60.createElement(Stack, null, /* @__PURE__ */ React60.createElement(Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React60.createElement(IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React60.createElement(ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60.createElement(Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React60.createElement(IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React60.createElement(ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60.createElement(Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React60.createElement(ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60.createElement(Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React60.createElement(DeleteOutlined, { fontSize: "small" })))));
|
|
4653
5357
|
}
|
|
4654
5358
|
|
|
4655
5359
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
@@ -4667,9 +5371,9 @@ function EditorBlockWrapper({ children }) {
|
|
|
4667
5371
|
if (selectedBlockId !== blockId) {
|
|
4668
5372
|
return null;
|
|
4669
5373
|
}
|
|
4670
|
-
return /* @__PURE__ */
|
|
5374
|
+
return /* @__PURE__ */ React60.createElement(TuneMenu, { blockId });
|
|
4671
5375
|
};
|
|
4672
|
-
return /* @__PURE__ */
|
|
5376
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4673
5377
|
Box,
|
|
4674
5378
|
{
|
|
4675
5379
|
sx: {
|
|
@@ -4799,7 +5503,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4799
5503
|
width: fullWidth ? "100%" : void 0,
|
|
4800
5504
|
textAlign: "center"
|
|
4801
5505
|
});
|
|
4802
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60.createElement(
|
|
4803
5507
|
"input",
|
|
4804
5508
|
{
|
|
4805
5509
|
type: "text",
|
|
@@ -4810,7 +5514,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4810
5514
|
}
|
|
4811
5515
|
));
|
|
4812
5516
|
}
|
|
4813
|
-
return /* @__PURE__ */
|
|
5517
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60.createElement("span", { style: linkStyle }, /* @__PURE__ */ React60.createElement("span", null, text)));
|
|
4814
5518
|
}
|
|
4815
5519
|
function getFontFamily9(fontFamily) {
|
|
4816
5520
|
switch (fontFamily) {
|
|
@@ -4933,7 +5637,7 @@ function HeadingEditor({ style, props }) {
|
|
|
4933
5637
|
}
|
|
4934
5638
|
};
|
|
4935
5639
|
if (isSelected) {
|
|
4936
|
-
return /* @__PURE__ */
|
|
5640
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4937
5641
|
"textarea",
|
|
4938
5642
|
{
|
|
4939
5643
|
value: localText,
|
|
@@ -4948,11 +5652,11 @@ function HeadingEditor({ style, props }) {
|
|
|
4948
5652
|
}
|
|
4949
5653
|
switch (level) {
|
|
4950
5654
|
case "h1":
|
|
4951
|
-
return /* @__PURE__ */
|
|
5655
|
+
return /* @__PURE__ */ React60.createElement("h1", { style: hStyle }, textContent);
|
|
4952
5656
|
case "h2":
|
|
4953
|
-
return /* @__PURE__ */
|
|
5657
|
+
return /* @__PURE__ */ React60.createElement("h2", { style: hStyle }, textContent);
|
|
4954
5658
|
case "h3":
|
|
4955
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ React60.createElement("h3", { style: hStyle }, textContent);
|
|
4956
5660
|
}
|
|
4957
5661
|
}
|
|
4958
5662
|
function HtmlEditor({ style, props }) {
|
|
@@ -5007,7 +5711,7 @@ function HtmlEditor({ style, props }) {
|
|
|
5007
5711
|
margin: 0,
|
|
5008
5712
|
backgroundColor: "transparent"
|
|
5009
5713
|
});
|
|
5010
|
-
return /* @__PURE__ */
|
|
5714
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle }, /* @__PURE__ */ React60.createElement(
|
|
5011
5715
|
"textarea",
|
|
5012
5716
|
{
|
|
5013
5717
|
value: localContents,
|
|
@@ -5021,9 +5725,9 @@ function HtmlEditor({ style, props }) {
|
|
|
5021
5725
|
));
|
|
5022
5726
|
}
|
|
5023
5727
|
if (!contents) {
|
|
5024
|
-
return /* @__PURE__ */
|
|
5728
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle });
|
|
5025
5729
|
}
|
|
5026
|
-
return /* @__PURE__ */
|
|
5730
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
5027
5731
|
}
|
|
5028
5732
|
function getImageBorderRadius2(shape, size) {
|
|
5029
5733
|
switch (shape) {
|
|
@@ -5138,7 +5842,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5138
5842
|
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
5139
5843
|
padding: (style == null ? void 0 : style.padding) ? `${style.padding.top}px ${style.padding.right}px ${style.padding.bottom}px ${style.padding.left}px` : void 0
|
|
5140
5844
|
};
|
|
5141
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
5845
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React60.createElement(
|
|
5142
5846
|
"img",
|
|
5143
5847
|
{
|
|
5144
5848
|
src: imageUrl,
|
|
@@ -5156,7 +5860,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5156
5860
|
}
|
|
5157
5861
|
}
|
|
5158
5862
|
) : null;
|
|
5159
|
-
const greetingElement = isSelected ? /* @__PURE__ */
|
|
5863
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React60.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React60.createElement(
|
|
5160
5864
|
"input",
|
|
5161
5865
|
{
|
|
5162
5866
|
value: localGreeting,
|
|
@@ -5167,8 +5871,8 @@ function SignatureEditor({ style, props }) {
|
|
|
5167
5871
|
placeholder: "Greeting (e.g. Best regards,)",
|
|
5168
5872
|
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
5169
5873
|
}
|
|
5170
|
-
)) : greeting ? /* @__PURE__ */
|
|
5171
|
-
const textContent = isSelected ? /* @__PURE__ */
|
|
5874
|
+
)) : greeting ? /* @__PURE__ */ React60.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
5875
|
+
const textContent = isSelected ? /* @__PURE__ */ React60.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React60.createElement(
|
|
5172
5876
|
"input",
|
|
5173
5877
|
{
|
|
5174
5878
|
value: localName,
|
|
@@ -5179,7 +5883,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5179
5883
|
placeholder: "Name",
|
|
5180
5884
|
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
5181
5885
|
}
|
|
5182
|
-
), /* @__PURE__ */
|
|
5886
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5183
5887
|
"input",
|
|
5184
5888
|
{
|
|
5185
5889
|
value: localTitle,
|
|
@@ -5190,7 +5894,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5190
5894
|
placeholder: "Title",
|
|
5191
5895
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5192
5896
|
}
|
|
5193
|
-
), /* @__PURE__ */
|
|
5897
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5194
5898
|
"input",
|
|
5195
5899
|
{
|
|
5196
5900
|
value: localCompany,
|
|
@@ -5201,7 +5905,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5201
5905
|
placeholder: "Company",
|
|
5202
5906
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5203
5907
|
}
|
|
5204
|
-
), /* @__PURE__ */
|
|
5908
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5205
5909
|
"input",
|
|
5206
5910
|
{
|
|
5207
5911
|
value: localAddress,
|
|
@@ -5212,7 +5916,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5212
5916
|
placeholder: "Address",
|
|
5213
5917
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5214
5918
|
}
|
|
5215
|
-
), /* @__PURE__ */
|
|
5919
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5216
5920
|
"input",
|
|
5217
5921
|
{
|
|
5218
5922
|
value: localEmail,
|
|
@@ -5223,7 +5927,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5223
5927
|
placeholder: "Email",
|
|
5224
5928
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
5225
5929
|
}
|
|
5226
|
-
), /* @__PURE__ */
|
|
5930
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5227
5931
|
"input",
|
|
5228
5932
|
{
|
|
5229
5933
|
value: localPhone,
|
|
@@ -5234,7 +5938,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5234
5938
|
placeholder: "Phone",
|
|
5235
5939
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5236
5940
|
}
|
|
5237
|
-
), /* @__PURE__ */
|
|
5941
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5238
5942
|
"input",
|
|
5239
5943
|
{
|
|
5240
5944
|
value: localWebsite,
|
|
@@ -5245,11 +5949,11 @@ function SignatureEditor({ style, props }) {
|
|
|
5245
5949
|
placeholder: "Website",
|
|
5246
5950
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5247
5951
|
}
|
|
5248
|
-
)) : /* @__PURE__ */
|
|
5952
|
+
)) : /* @__PURE__ */ React60.createElement("div", null, name && /* @__PURE__ */ React60.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React60.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React60.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React60.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React60.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React60.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React60.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React60.createElement("p", { style: detailStyle }, "Click to edit signature"));
|
|
5249
5953
|
if (layout === "vertical") {
|
|
5250
|
-
return /* @__PURE__ */
|
|
5954
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React60.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
5251
5955
|
}
|
|
5252
|
-
return /* @__PURE__ */
|
|
5956
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React60.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React60.createElement("tbody", null, /* @__PURE__ */ React60.createElement("tr", null, imageElement && /* @__PURE__ */ React60.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React60.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
5253
5957
|
}
|
|
5254
5958
|
function getFontFamily10(fontFamily) {
|
|
5255
5959
|
switch (fontFamily) {
|
|
@@ -5364,7 +6068,7 @@ function TextEditor({ style, props }) {
|
|
|
5364
6068
|
}
|
|
5365
6069
|
};
|
|
5366
6070
|
if (isSelected) {
|
|
5367
|
-
return /* @__PURE__ */
|
|
6071
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5368
6072
|
"textarea",
|
|
5369
6073
|
{
|
|
5370
6074
|
value: localText,
|
|
@@ -5378,36 +6082,36 @@ function TextEditor({ style, props }) {
|
|
|
5378
6082
|
);
|
|
5379
6083
|
}
|
|
5380
6084
|
if (isMarkdown) {
|
|
5381
|
-
return /* @__PURE__ */
|
|
6085
|
+
return /* @__PURE__ */ React60.createElement(EmailMarkdown, { style: wStyle, markdown: textContent });
|
|
5382
6086
|
}
|
|
5383
|
-
return /* @__PURE__ */
|
|
6087
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle }, textContent);
|
|
5384
6088
|
}
|
|
5385
6089
|
|
|
5386
6090
|
// src/editor/core.tsx
|
|
5387
6091
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
5388
6092
|
Avatar: {
|
|
5389
6093
|
schema: AvatarPropsSchema,
|
|
5390
|
-
Component: (props) => /* @__PURE__ */
|
|
6094
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(avatar_default, __spreadValues({}, props)))
|
|
5391
6095
|
},
|
|
5392
6096
|
Button: {
|
|
5393
6097
|
schema: ButtonPropsSchema,
|
|
5394
|
-
Component: (props) => /* @__PURE__ */
|
|
6098
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
5395
6099
|
},
|
|
5396
6100
|
Container: {
|
|
5397
6101
|
schema: container_props_schema_default,
|
|
5398
|
-
Component: (props) => /* @__PURE__ */
|
|
6102
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
5399
6103
|
},
|
|
5400
6104
|
ColumnsContainer: {
|
|
5401
6105
|
schema: columns_container_props_schema_default2,
|
|
5402
|
-
Component: (props) => /* @__PURE__ */
|
|
6106
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
5403
6107
|
},
|
|
5404
6108
|
Heading: {
|
|
5405
6109
|
schema: HeadingPropsSchema,
|
|
5406
|
-
Component: (props) => /* @__PURE__ */
|
|
6110
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
5407
6111
|
},
|
|
5408
6112
|
Html: {
|
|
5409
6113
|
schema: HtmlPropsSchema,
|
|
5410
|
-
Component: (props) => /* @__PURE__ */
|
|
6114
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
5411
6115
|
},
|
|
5412
6116
|
Image: {
|
|
5413
6117
|
schema: ImagePropsSchema,
|
|
@@ -5419,28 +6123,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
5419
6123
|
linkHref: null
|
|
5420
6124
|
})
|
|
5421
6125
|
});
|
|
5422
|
-
return /* @__PURE__ */
|
|
6126
|
+
return /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(image_default, __spreadValues({}, props)));
|
|
5423
6127
|
}
|
|
5424
6128
|
},
|
|
5425
6129
|
Text: {
|
|
5426
6130
|
schema: TextPropsSchema,
|
|
5427
|
-
Component: (props) => /* @__PURE__ */
|
|
6131
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(TextEditor, __spreadValues({}, props)))
|
|
5428
6132
|
},
|
|
5429
6133
|
EmailLayout: {
|
|
5430
6134
|
schema: email_layout_props_schema_default,
|
|
5431
|
-
Component: (p) => /* @__PURE__ */
|
|
6135
|
+
Component: (p) => /* @__PURE__ */ React60.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
5432
6136
|
},
|
|
5433
6137
|
Spacer: {
|
|
5434
6138
|
schema: SpacerPropsSchema,
|
|
5435
|
-
Component: (props) => /* @__PURE__ */
|
|
6139
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(spacer_default, __spreadValues({}, props)))
|
|
5436
6140
|
},
|
|
5437
6141
|
Divider: {
|
|
5438
6142
|
schema: DividerPropsSchema,
|
|
5439
|
-
Component: (props) => /* @__PURE__ */
|
|
6143
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(divider_default, __spreadValues({}, props)))
|
|
5440
6144
|
},
|
|
5441
6145
|
Signature: {
|
|
5442
6146
|
schema: SignaturePropsSchema,
|
|
5443
|
-
Component: (props) => /* @__PURE__ */
|
|
6147
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
5444
6148
|
}
|
|
5445
6149
|
});
|
|
5446
6150
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -5456,7 +6160,7 @@ function EditorBlock({ id }) {
|
|
|
5456
6160
|
if (!block) {
|
|
5457
6161
|
throw new Error("Could not find block");
|
|
5458
6162
|
}
|
|
5459
|
-
return /* @__PURE__ */
|
|
6163
|
+
return /* @__PURE__ */ React60.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React60.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
5460
6164
|
}
|
|
5461
6165
|
function ToggleInspectorPanelButton() {
|
|
5462
6166
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -5464,20 +6168,20 @@ function ToggleInspectorPanelButton() {
|
|
|
5464
6168
|
toggleInspectorDrawerOpen();
|
|
5465
6169
|
};
|
|
5466
6170
|
if (inspectorDrawerOpen) {
|
|
5467
|
-
return /* @__PURE__ */
|
|
6171
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React60.createElement(LastPageOutlined, { fontSize: "small" }));
|
|
5468
6172
|
}
|
|
5469
|
-
return /* @__PURE__ */
|
|
6173
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React60.createElement(AppRegistrationOutlined, { fontSize: "small" }));
|
|
5470
6174
|
}
|
|
5471
6175
|
function useIcon() {
|
|
5472
6176
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
5473
6177
|
if (samplesDrawerOpen) {
|
|
5474
|
-
return /* @__PURE__ */
|
|
6178
|
+
return /* @__PURE__ */ React60.createElement(FirstPageOutlined, { fontSize: "small" });
|
|
5475
6179
|
}
|
|
5476
|
-
return /* @__PURE__ */
|
|
6180
|
+
return /* @__PURE__ */ React60.createElement(MenuOutlined, { fontSize: "small" });
|
|
5477
6181
|
}
|
|
5478
6182
|
function ToggleSamplesPanelButton() {
|
|
5479
6183
|
const icon = useIcon();
|
|
5480
|
-
return /* @__PURE__ */
|
|
6184
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
5481
6185
|
}
|
|
5482
6186
|
function formatHtml(html2, spaces = 2) {
|
|
5483
6187
|
try {
|
|
@@ -5539,7 +6243,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5539
6243
|
if (code === null) {
|
|
5540
6244
|
return null;
|
|
5541
6245
|
}
|
|
5542
|
-
return /* @__PURE__ */
|
|
6246
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5543
6247
|
"pre",
|
|
5544
6248
|
{
|
|
5545
6249
|
style: {
|
|
@@ -5565,17 +6269,17 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5565
6269
|
function HtmlPanel() {
|
|
5566
6270
|
const document2 = useDocument();
|
|
5567
6271
|
const code = useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
5568
|
-
return /* @__PURE__ */
|
|
6272
|
+
return /* @__PURE__ */ React60.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
5569
6273
|
}
|
|
5570
6274
|
function JsonPanel() {
|
|
5571
6275
|
const document2 = useDocument();
|
|
5572
6276
|
const code = useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
5573
|
-
return /* @__PURE__ */
|
|
6277
|
+
return /* @__PURE__ */ React60.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
5574
6278
|
}
|
|
5575
6279
|
function TextPanel() {
|
|
5576
6280
|
const document2 = useDocument();
|
|
5577
6281
|
const text = useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
5578
|
-
return /* @__PURE__ */
|
|
6282
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5579
6283
|
"pre",
|
|
5580
6284
|
{
|
|
5581
6285
|
style: {
|
|
@@ -5611,185 +6315,47 @@ function MainTabsGroup() {
|
|
|
5611
6315
|
setSelectedMainTab("editor");
|
|
5612
6316
|
}
|
|
5613
6317
|
};
|
|
5614
|
-
return /* @__PURE__ */
|
|
6318
|
+
return /* @__PURE__ */ React60.createElement(Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React60.createElement(
|
|
5615
6319
|
Tab,
|
|
5616
6320
|
{
|
|
5617
6321
|
value: "editor",
|
|
5618
|
-
label: /* @__PURE__ */
|
|
6322
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Edit" }, /* @__PURE__ */ React60.createElement(EditOutlined, { fontSize: "small" }))
|
|
5619
6323
|
}
|
|
5620
|
-
), /* @__PURE__ */
|
|
6324
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5621
6325
|
Tab,
|
|
5622
6326
|
{
|
|
5623
6327
|
value: "preview",
|
|
5624
|
-
label: /* @__PURE__ */
|
|
6328
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Preview" }, /* @__PURE__ */ React60.createElement(PreviewOutlined, { fontSize: "small" }))
|
|
5625
6329
|
}
|
|
5626
|
-
), /* @__PURE__ */
|
|
6330
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5627
6331
|
Tab,
|
|
5628
6332
|
{
|
|
5629
6333
|
value: "html",
|
|
5630
|
-
label: /* @__PURE__ */
|
|
6334
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "HTML output" }, /* @__PURE__ */ React60.createElement(CodeOutlined, { fontSize: "small" }))
|
|
5631
6335
|
}
|
|
5632
|
-
), /* @__PURE__ */
|
|
6336
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5633
6337
|
Tab,
|
|
5634
6338
|
{
|
|
5635
6339
|
value: "text",
|
|
5636
|
-
label: /* @__PURE__ */
|
|
6340
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React60.createElement(SubjectOutlined, { fontSize: "small" }))
|
|
5637
6341
|
}
|
|
5638
|
-
), /* @__PURE__ */
|
|
6342
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5639
6343
|
Tab,
|
|
5640
6344
|
{
|
|
5641
6345
|
value: "json",
|
|
5642
|
-
label: /* @__PURE__ */
|
|
5643
|
-
}
|
|
5644
|
-
));
|
|
5645
|
-
}
|
|
5646
|
-
var SnackbarContext = createContext(null);
|
|
5647
|
-
function useSnackbar() {
|
|
5648
|
-
const context = useContext(SnackbarContext);
|
|
5649
|
-
if (!context) {
|
|
5650
|
-
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
5651
|
-
}
|
|
5652
|
-
return context;
|
|
5653
|
-
}
|
|
5654
|
-
function SnackbarProvider({ children }) {
|
|
5655
|
-
const [message, setMessage] = useState(null);
|
|
5656
|
-
const [duration, setDuration] = useState(3e3);
|
|
5657
|
-
const showMessage = (text, customDuration = 3e3) => {
|
|
5658
|
-
setMessage(text);
|
|
5659
|
-
setDuration(customDuration);
|
|
5660
|
-
};
|
|
5661
|
-
const handleClose = () => {
|
|
5662
|
-
setMessage(null);
|
|
5663
|
-
};
|
|
5664
|
-
return /* @__PURE__ */ React72.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React72.createElement(
|
|
5665
|
-
Snackbar,
|
|
5666
|
-
{
|
|
5667
|
-
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
5668
|
-
open: message !== null,
|
|
5669
|
-
onClose: handleClose,
|
|
5670
|
-
message,
|
|
5671
|
-
autoHideDuration: duration,
|
|
5672
|
-
sx: {
|
|
5673
|
-
zIndex: 1e4,
|
|
5674
|
-
// Very high z-index
|
|
5675
|
-
position: "fixed"
|
|
5676
|
-
// Make sure it's fixed positioned
|
|
5677
|
-
}
|
|
6346
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "JSON output" }, /* @__PURE__ */ React60.createElement(DataObjectOutlined, { fontSize: "small" }))
|
|
5678
6347
|
}
|
|
5679
6348
|
));
|
|
5680
6349
|
}
|
|
5681
|
-
function SaveTemplateDialog({
|
|
5682
|
-
open,
|
|
5683
|
-
onClose,
|
|
5684
|
-
onSave,
|
|
5685
|
-
onNameChange,
|
|
5686
|
-
defaultName = "",
|
|
5687
|
-
error: externalError = null
|
|
5688
|
-
}) {
|
|
5689
|
-
const [templateName, setTemplateName] = useState(defaultName);
|
|
5690
|
-
const [internalError, setInternalError] = useState("");
|
|
5691
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
5692
|
-
useEffect(() => {
|
|
5693
|
-
if (open) {
|
|
5694
|
-
setTemplateName(defaultName);
|
|
5695
|
-
setInternalError("");
|
|
5696
|
-
setIsSubmitting(false);
|
|
5697
|
-
}
|
|
5698
|
-
}, [open, defaultName]);
|
|
5699
|
-
const displayError = externalError || internalError;
|
|
5700
|
-
const handleNameChange = (e) => {
|
|
5701
|
-
setTemplateName(e.target.value);
|
|
5702
|
-
if (e.target.value.trim()) {
|
|
5703
|
-
setInternalError("");
|
|
5704
|
-
}
|
|
5705
|
-
if (onNameChange) {
|
|
5706
|
-
onNameChange();
|
|
5707
|
-
}
|
|
5708
|
-
};
|
|
5709
|
-
const handleSave = () => __async(null, null, function* () {
|
|
5710
|
-
if (!templateName.trim()) {
|
|
5711
|
-
setInternalError("Please enter a template name");
|
|
5712
|
-
return;
|
|
5713
|
-
}
|
|
5714
|
-
setIsSubmitting(true);
|
|
5715
|
-
try {
|
|
5716
|
-
const result = onSave(templateName);
|
|
5717
|
-
if (result instanceof Promise) {
|
|
5718
|
-
const success = yield result;
|
|
5719
|
-
if (success) {
|
|
5720
|
-
setTemplateName("");
|
|
5721
|
-
setInternalError("");
|
|
5722
|
-
onClose();
|
|
5723
|
-
}
|
|
5724
|
-
} else if (result !== false) {
|
|
5725
|
-
setTemplateName("");
|
|
5726
|
-
setInternalError("");
|
|
5727
|
-
onClose();
|
|
5728
|
-
}
|
|
5729
|
-
} catch (error) {
|
|
5730
|
-
console.error("Error saving template:", error);
|
|
5731
|
-
} finally {
|
|
5732
|
-
setIsSubmitting(false);
|
|
5733
|
-
}
|
|
5734
|
-
});
|
|
5735
|
-
const handleCancel = () => {
|
|
5736
|
-
setTemplateName("");
|
|
5737
|
-
setInternalError("");
|
|
5738
|
-
onClose();
|
|
5739
|
-
};
|
|
5740
|
-
return /* @__PURE__ */ React72.createElement(
|
|
5741
|
-
Dialog,
|
|
5742
|
-
{
|
|
5743
|
-
open,
|
|
5744
|
-
onClose: handleCancel,
|
|
5745
|
-
maxWidth: "sm",
|
|
5746
|
-
fullWidth: true
|
|
5747
|
-
},
|
|
5748
|
-
/* @__PURE__ */ React72.createElement(DialogTitle, null, "Save Email Template"),
|
|
5749
|
-
/* @__PURE__ */ React72.createElement(DialogContent, null, /* @__PURE__ */ React72.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React72.createElement(
|
|
5750
|
-
TextField,
|
|
5751
|
-
{
|
|
5752
|
-
autoFocus: true,
|
|
5753
|
-
margin: "dense",
|
|
5754
|
-
id: "template-name",
|
|
5755
|
-
label: "Template Name",
|
|
5756
|
-
type: "text",
|
|
5757
|
-
fullWidth: true,
|
|
5758
|
-
variant: "outlined",
|
|
5759
|
-
value: templateName,
|
|
5760
|
-
onChange: handleNameChange,
|
|
5761
|
-
error: !!displayError,
|
|
5762
|
-
helperText: displayError,
|
|
5763
|
-
onKeyPress: (e) => {
|
|
5764
|
-
if (e.key === "Enter" && templateName.trim() && !displayError && !isSubmitting) {
|
|
5765
|
-
handleSave();
|
|
5766
|
-
}
|
|
5767
|
-
},
|
|
5768
|
-
disabled: isSubmitting
|
|
5769
|
-
}
|
|
5770
|
-
))),
|
|
5771
|
-
/* @__PURE__ */ React72.createElement(DialogActions, null, /* @__PURE__ */ React72.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React72.createElement(
|
|
5772
|
-
Button$1,
|
|
5773
|
-
{
|
|
5774
|
-
onClick: handleSave,
|
|
5775
|
-
variant: "contained",
|
|
5776
|
-
color: "primary",
|
|
5777
|
-
disabled: !templateName.trim() || !!displayError || isSubmitting
|
|
5778
|
-
},
|
|
5779
|
-
isSubmitting ? "Saving..." : "Save Template"
|
|
5780
|
-
))
|
|
5781
|
-
);
|
|
5782
|
-
}
|
|
5783
|
-
|
|
5784
|
-
// src/app/email-canvas/save-button.tsx
|
|
5785
6350
|
function SaveButton({ loadTemplates, saveAs }) {
|
|
5786
|
-
const { saveTemplate, currentTemplateId, setCurrentTemplate } = useEmailEditor();
|
|
6351
|
+
const { saveTemplate, currentTemplateId, currentTemplateKind, setCurrentTemplate } = useEmailEditor();
|
|
5787
6352
|
const { showMessage } = useSnackbar();
|
|
5788
6353
|
const [saveDialogOpen, setSaveDialogOpen] = useState(false);
|
|
5789
6354
|
const document2 = useDocument();
|
|
6355
|
+
const isSample = currentTemplateKind === "sample";
|
|
5790
6356
|
const handleSave = () => __async(null, null, function* () {
|
|
5791
6357
|
try {
|
|
5792
|
-
if (!currentTemplateId ||
|
|
6358
|
+
if (!currentTemplateId || isSample) {
|
|
5793
6359
|
setSaveDialogOpen(true);
|
|
5794
6360
|
return;
|
|
5795
6361
|
}
|
|
@@ -5806,8 +6372,8 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5806
6372
|
const handleSaveAs = (templateName) => __async(null, null, function* () {
|
|
5807
6373
|
try {
|
|
5808
6374
|
if (saveAs) {
|
|
5809
|
-
const { id: templateId,
|
|
5810
|
-
setCurrentTemplate(templateId,
|
|
6375
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(document2));
|
|
6376
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
5811
6377
|
if (loadTemplates) {
|
|
5812
6378
|
yield loadTemplates();
|
|
5813
6379
|
}
|
|
@@ -5823,7 +6389,7 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5823
6389
|
return false;
|
|
5824
6390
|
}
|
|
5825
6391
|
});
|
|
5826
|
-
return /* @__PURE__ */
|
|
6392
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5827
6393
|
IconButton,
|
|
5828
6394
|
{
|
|
5829
6395
|
onClick: handleSave,
|
|
@@ -5834,14 +6400,14 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5834
6400
|
}
|
|
5835
6401
|
}
|
|
5836
6402
|
},
|
|
5837
|
-
/* @__PURE__ */
|
|
5838
|
-
), /* @__PURE__ */
|
|
6403
|
+
/* @__PURE__ */ React60.createElement(Tooltip, { title: isSample ? "Save as new template" : "Save template" }, /* @__PURE__ */ React60.createElement(SaveOutlined, { fontSize: "small" }))
|
|
6404
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5839
6405
|
SaveTemplateDialog,
|
|
5840
6406
|
{
|
|
5841
6407
|
open: saveDialogOpen,
|
|
5842
6408
|
onClose: () => setSaveDialogOpen(false),
|
|
5843
6409
|
onSave: handleSaveAs,
|
|
5844
|
-
defaultName:
|
|
6410
|
+
defaultName: isSample ? "New Template" : "New Template"
|
|
5845
6411
|
}
|
|
5846
6412
|
));
|
|
5847
6413
|
}
|
|
@@ -5870,7 +6436,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5870
6436
|
});
|
|
5871
6437
|
const validateTemplateName = (name) => {
|
|
5872
6438
|
const nameExists = templates.some(
|
|
5873
|
-
(template) => template.
|
|
6439
|
+
(template) => template.slug.toLowerCase() === name.toLowerCase()
|
|
5874
6440
|
);
|
|
5875
6441
|
if (nameExists) {
|
|
5876
6442
|
setNameError("A template with this name already exists");
|
|
@@ -5888,10 +6454,10 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5888
6454
|
}
|
|
5889
6455
|
try {
|
|
5890
6456
|
if (saveAs) {
|
|
5891
|
-
const { id: templateId,
|
|
6457
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(empty_email_message_default));
|
|
5892
6458
|
resetDocument(empty_email_message_default);
|
|
5893
|
-
setCurrentTemplate(templateId,
|
|
5894
|
-
loadTemplate(empty_email_message_default, templateId,
|
|
6459
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
6460
|
+
loadTemplate(empty_email_message_default, templateId, slug, "template");
|
|
5895
6461
|
if (loadTemplates) {
|
|
5896
6462
|
yield loadTemplates();
|
|
5897
6463
|
}
|
|
@@ -5905,7 +6471,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5905
6471
|
}
|
|
5906
6472
|
return false;
|
|
5907
6473
|
});
|
|
5908
|
-
return /* @__PURE__ */
|
|
6474
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5909
6475
|
IconButton,
|
|
5910
6476
|
{
|
|
5911
6477
|
onClick: handleNewTemplate,
|
|
@@ -5916,8 +6482,8 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5916
6482
|
}
|
|
5917
6483
|
}
|
|
5918
6484
|
},
|
|
5919
|
-
/* @__PURE__ */
|
|
5920
|
-
), /* @__PURE__ */
|
|
6485
|
+
/* @__PURE__ */ React60.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React60.createElement(Add, { fontSize: "small" }))
|
|
6486
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5921
6487
|
SaveTemplateDialog,
|
|
5922
6488
|
{
|
|
5923
6489
|
open: saveDialogOpen,
|
|
@@ -5932,6 +6498,48 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5932
6498
|
}
|
|
5933
6499
|
));
|
|
5934
6500
|
}
|
|
6501
|
+
function SubjectInput() {
|
|
6502
|
+
var _a;
|
|
6503
|
+
const document2 = useDocument();
|
|
6504
|
+
const root = document2.root;
|
|
6505
|
+
if (!root || root.type !== "EmailLayout") return null;
|
|
6506
|
+
const data = root.data;
|
|
6507
|
+
const subject = (_a = data.subject) != null ? _a : "";
|
|
6508
|
+
const handleChange = (value) => {
|
|
6509
|
+
setDocument({
|
|
6510
|
+
root: __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, data), { subject: value }) })
|
|
6511
|
+
});
|
|
6512
|
+
};
|
|
6513
|
+
return /* @__PURE__ */ React60.createElement(
|
|
6514
|
+
Box,
|
|
6515
|
+
{
|
|
6516
|
+
sx: {
|
|
6517
|
+
px: 3,
|
|
6518
|
+
py: 1.25,
|
|
6519
|
+
borderBottom: 1,
|
|
6520
|
+
borderColor: "divider",
|
|
6521
|
+
backgroundColor: "white",
|
|
6522
|
+
position: "sticky",
|
|
6523
|
+
top: 49,
|
|
6524
|
+
zIndex: "appBar",
|
|
6525
|
+
display: "flex",
|
|
6526
|
+
alignItems: "center",
|
|
6527
|
+
gap: 1.5
|
|
6528
|
+
}
|
|
6529
|
+
},
|
|
6530
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
6531
|
+
/* @__PURE__ */ React60.createElement(
|
|
6532
|
+
InputBase,
|
|
6533
|
+
{
|
|
6534
|
+
fullWidth: true,
|
|
6535
|
+
placeholder: "Email subject \u2014 supports {{variables}}",
|
|
6536
|
+
value: subject,
|
|
6537
|
+
onChange: (e) => handleChange(e.target.value),
|
|
6538
|
+
sx: { fontSize: 14 }
|
|
6539
|
+
}
|
|
6540
|
+
)
|
|
6541
|
+
);
|
|
6542
|
+
}
|
|
5935
6543
|
|
|
5936
6544
|
// src/app/email-canvas/index.tsx
|
|
5937
6545
|
function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
|
|
@@ -5964,19 +6572,19 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5964
6572
|
const renderMainPanel = () => {
|
|
5965
6573
|
switch (selectedMainTab) {
|
|
5966
6574
|
case "editor":
|
|
5967
|
-
return /* @__PURE__ */
|
|
6575
|
+
return /* @__PURE__ */ React60.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React60.createElement(EditorBlock, { id: "root" }));
|
|
5968
6576
|
case "preview":
|
|
5969
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ React60.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React60.createElement(Reader, { document: document2, rootBlockId: "root" }));
|
|
5970
6578
|
case "html":
|
|
5971
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ React60.createElement(HtmlPanel, null);
|
|
5972
6580
|
case "text":
|
|
5973
|
-
return /* @__PURE__ */
|
|
6581
|
+
return /* @__PURE__ */ React60.createElement(TextPanel, null);
|
|
5974
6582
|
case "json":
|
|
5975
|
-
return /* @__PURE__ */
|
|
6583
|
+
return /* @__PURE__ */ React60.createElement(JsonPanel, null);
|
|
5976
6584
|
}
|
|
5977
6585
|
};
|
|
5978
6586
|
const showSaveButtons = persistenceEnabled;
|
|
5979
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5980
6588
|
Stack,
|
|
5981
6589
|
{
|
|
5982
6590
|
sx: {
|
|
@@ -5993,10 +6601,10 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5993
6601
|
justifyContent: "space-between",
|
|
5994
6602
|
alignItems: "center"
|
|
5995
6603
|
},
|
|
5996
|
-
samplesDrawerEnabled && /* @__PURE__ */
|
|
5997
|
-
/* @__PURE__ */
|
|
5998
|
-
/* @__PURE__ */
|
|
5999
|
-
), /* @__PURE__ */
|
|
6604
|
+
samplesDrawerEnabled && /* @__PURE__ */ React60.createElement(ToggleSamplesPanelButton, null),
|
|
6605
|
+
/* @__PURE__ */ React60.createElement(Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60.createElement(MainTabsGroup, null)), /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60.createElement(ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React60.createElement(ToggleButton, { value: "desktop" }, /* @__PURE__ */ React60.createElement(Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React60.createElement(MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60.createElement(ToggleButton, { value: "mobile" }, /* @__PURE__ */ React60.createElement(Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React60.createElement(PhoneIphoneOutlined, { fontSize: "small" })))), showSaveButtons && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(NewTemplateButton, { loadTemplates, saveAs }), /* @__PURE__ */ React60.createElement(SaveButton, { loadTemplates, saveAs })))),
|
|
6606
|
+
/* @__PURE__ */ React60.createElement(ToggleInspectorPanelButton, null)
|
|
6607
|
+
), selectedMainTab === "editor" && /* @__PURE__ */ React60.createElement(SubjectInput, null), /* @__PURE__ */ React60.createElement(Box, { sx: {
|
|
6000
6608
|
paddingBottom: "50px",
|
|
6001
6609
|
minWidth: 370
|
|
6002
6610
|
} }, renderMainPanel()));
|
|
@@ -6046,6 +6654,8 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6046
6654
|
loadTemplate,
|
|
6047
6655
|
deleteTemplate,
|
|
6048
6656
|
copyTemplate,
|
|
6657
|
+
renameTemplate,
|
|
6658
|
+
setTemplateKind,
|
|
6049
6659
|
saveAs,
|
|
6050
6660
|
onChange
|
|
6051
6661
|
} = props;
|
|
@@ -6078,7 +6688,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6078
6688
|
return getDocument();
|
|
6079
6689
|
}
|
|
6080
6690
|
}));
|
|
6081
|
-
return /* @__PURE__ */
|
|
6691
|
+
return /* @__PURE__ */ React60.createElement(Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React60.createElement(
|
|
6082
6692
|
InspectorDrawer,
|
|
6083
6693
|
{
|
|
6084
6694
|
enterDuration: drawerEnterDuration,
|
|
@@ -6086,7 +6696,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6086
6696
|
deleteTemplate,
|
|
6087
6697
|
copyTemplate
|
|
6088
6698
|
}
|
|
6089
|
-
), /* @__PURE__ */
|
|
6699
|
+
), /* @__PURE__ */ React60.createElement(
|
|
6090
6700
|
SamplesDrawer,
|
|
6091
6701
|
{
|
|
6092
6702
|
enterDuration: drawerEnterDuration,
|
|
@@ -6096,9 +6706,13 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6096
6706
|
loadTemplates,
|
|
6097
6707
|
loadTemplate,
|
|
6098
6708
|
currentTemplateId,
|
|
6099
|
-
deleteTemplate
|
|
6709
|
+
deleteTemplate,
|
|
6710
|
+
copyTemplate,
|
|
6711
|
+
renameTemplate,
|
|
6712
|
+
setTemplateKind,
|
|
6713
|
+
saveAs
|
|
6100
6714
|
}
|
|
6101
|
-
), /* @__PURE__ */
|
|
6715
|
+
), /* @__PURE__ */ React60.createElement(
|
|
6102
6716
|
Stack,
|
|
6103
6717
|
{
|
|
6104
6718
|
sx: {
|
|
@@ -6107,7 +6721,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6107
6721
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
6108
6722
|
}
|
|
6109
6723
|
},
|
|
6110
|
-
/* @__PURE__ */
|
|
6724
|
+
/* @__PURE__ */ React60.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
6111
6725
|
));
|
|
6112
6726
|
});
|
|
6113
6727
|
var EmailEditor = forwardRef((props, ref) => {
|
|
@@ -6127,6 +6741,8 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6127
6741
|
loadTemplate,
|
|
6128
6742
|
deleteTemplate,
|
|
6129
6743
|
copyTemplate,
|
|
6744
|
+
renameTemplate,
|
|
6745
|
+
setTemplateKind,
|
|
6130
6746
|
saveAs,
|
|
6131
6747
|
theme
|
|
6132
6748
|
} = props;
|
|
@@ -6142,7 +6758,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6142
6758
|
useEffect(() => {
|
|
6143
6759
|
setPersistenceEnabled(persistenceEnabled);
|
|
6144
6760
|
}, [persistenceEnabled]);
|
|
6145
|
-
return /* @__PURE__ */
|
|
6761
|
+
return /* @__PURE__ */ React60.createElement(ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React60.createElement(CssBaseline, null), /* @__PURE__ */ React60.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React60.createElement(SnackbarProvider, null, /* @__PURE__ */ React60.createElement(
|
|
6146
6762
|
EmailEditorProvider,
|
|
6147
6763
|
{
|
|
6148
6764
|
initialTemplate: resolvedTemplate,
|
|
@@ -6151,7 +6767,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6151
6767
|
onSave,
|
|
6152
6768
|
onChange
|
|
6153
6769
|
},
|
|
6154
|
-
/* @__PURE__ */
|
|
6770
|
+
/* @__PURE__ */ React60.createElement(
|
|
6155
6771
|
EmailEditorInternal,
|
|
6156
6772
|
{
|
|
6157
6773
|
ref,
|
|
@@ -6164,6 +6780,8 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6164
6780
|
loadTemplate,
|
|
6165
6781
|
deleteTemplate,
|
|
6166
6782
|
copyTemplate,
|
|
6783
|
+
renameTemplate,
|
|
6784
|
+
setTemplateKind,
|
|
6167
6785
|
saveAs,
|
|
6168
6786
|
onChange
|
|
6169
6787
|
}
|
|
@@ -6173,6 +6791,6 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6173
6791
|
EmailEditor.displayName = "EmailEditor";
|
|
6174
6792
|
EmailEditorInternal.displayName = "EmailEditorInternal";
|
|
6175
6793
|
|
|
6176
|
-
export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, signature_default as Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, theme_default as theme, useEmailEditor };
|
|
6794
|
+
export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, signature_default as Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, TemplateVariableSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, theme_default as theme, useEmailEditor };
|
|
6177
6795
|
//# sourceMappingURL=index.js.map
|
|
6178
6796
|
//# sourceMappingURL=index.js.map
|