@kontakto/email-template-editor 1.5.1 → 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 +1513 -859
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -14
- package/dist/index.d.ts +164 -14
- package/dist/index.js +1420 -767
- 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,14 +1114,21 @@ 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,
|
|
1123
|
+
backdropDisabled: z.boolean().optional().nullable(),
|
|
1119
1124
|
borderColor: COLOR_SCHEMA9,
|
|
1120
1125
|
borderRadius: z.number().optional().nullable(),
|
|
1121
1126
|
canvasColor: COLOR_SCHEMA9,
|
|
1122
1127
|
textColor: COLOR_SCHEMA9,
|
|
1123
1128
|
fontFamily: FONT_FAMILY_SCHEMA6,
|
|
1124
|
-
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()
|
|
1125
1132
|
});
|
|
1126
1133
|
function getFontFamily6(fontFamily) {
|
|
1127
1134
|
const f = fontFamily != null ? fontFamily : "MODERN_SANS";
|
|
@@ -1155,24 +1162,29 @@ function getBorder2({ borderColor }) {
|
|
|
1155
1162
|
function EmailLayoutReader(props) {
|
|
1156
1163
|
var _a, _b, _c, _d, _e;
|
|
1157
1164
|
const childrenIds = (_a = props.childrenIds) != null ? _a : [];
|
|
1158
|
-
|
|
1165
|
+
const baseStyle = {
|
|
1166
|
+
color: (_b = props.textColor) != null ? _b : "#262626",
|
|
1167
|
+
fontFamily: getFontFamily6(props.fontFamily),
|
|
1168
|
+
fontSize: "16px",
|
|
1169
|
+
fontWeight: "400",
|
|
1170
|
+
letterSpacing: "0.15008px",
|
|
1171
|
+
lineHeight: "1.5",
|
|
1172
|
+
margin: "0"
|
|
1173
|
+
};
|
|
1174
|
+
if (props.backdropDisabled) {
|
|
1175
|
+
return /* @__PURE__ */ React60.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React60.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1176
|
+
}
|
|
1177
|
+
return /* @__PURE__ */ React60.createElement(
|
|
1159
1178
|
"div",
|
|
1160
1179
|
{
|
|
1161
|
-
style: {
|
|
1162
|
-
backgroundColor: (
|
|
1163
|
-
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
1164
|
-
fontFamily: getFontFamily6(props.fontFamily),
|
|
1165
|
-
fontSize: "16px",
|
|
1166
|
-
fontWeight: "400",
|
|
1167
|
-
letterSpacing: "0.15008px",
|
|
1168
|
-
lineHeight: "1.5",
|
|
1169
|
-
margin: "0",
|
|
1180
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
1181
|
+
backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
|
|
1170
1182
|
padding: "32px 0",
|
|
1171
1183
|
minHeight: "100%",
|
|
1172
1184
|
width: "100%"
|
|
1173
|
-
}
|
|
1185
|
+
})
|
|
1174
1186
|
},
|
|
1175
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ React60.createElement(
|
|
1176
1188
|
"table",
|
|
1177
1189
|
{
|
|
1178
1190
|
align: "center",
|
|
@@ -1182,6 +1194,7 @@ function EmailLayoutReader(props) {
|
|
|
1182
1194
|
maxWidth: "600px",
|
|
1183
1195
|
backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
|
|
1184
1196
|
borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
|
|
1197
|
+
overflow: props.borderRadius ? "hidden" : void 0,
|
|
1185
1198
|
border: getBorder2(props)
|
|
1186
1199
|
},
|
|
1187
1200
|
role: "presentation",
|
|
@@ -1189,7 +1202,7 @@ function EmailLayoutReader(props) {
|
|
|
1189
1202
|
cellPadding: "0",
|
|
1190
1203
|
border: 0
|
|
1191
1204
|
},
|
|
1192
|
-
/* @__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 })))))
|
|
1193
1206
|
)
|
|
1194
1207
|
);
|
|
1195
1208
|
}
|
|
@@ -1201,7 +1214,7 @@ function useReaderDocument() {
|
|
|
1201
1214
|
}
|
|
1202
1215
|
function ReaderBlock({ id }) {
|
|
1203
1216
|
const document2 = useReaderDocument();
|
|
1204
|
-
return document2[id] ? /* @__PURE__ */
|
|
1217
|
+
return document2[id] ? /* @__PURE__ */ React60.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1205
1218
|
}
|
|
1206
1219
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1207
1220
|
ColumnsContainer: {
|
|
@@ -1258,13 +1271,13 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
|
1258
1271
|
var ReaderDocumentSchema = z.record(z.string(), ReaderBlockSchema);
|
|
1259
1272
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1260
1273
|
function Reader({ document: document2, rootBlockId }) {
|
|
1261
|
-
return /* @__PURE__ */
|
|
1274
|
+
return /* @__PURE__ */ React60.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React60.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1262
1275
|
}
|
|
1263
1276
|
|
|
1264
1277
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1265
1278
|
function renderToStaticMarkup(document2, { rootBlockId }) {
|
|
1266
1279
|
return "<!DOCTYPE html>" + renderToStaticMarkup$1(
|
|
1267
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ React60.createElement("html", null, /* @__PURE__ */ React60.createElement("body", null, /* @__PURE__ */ React60.createElement(Reader, { document: document2, rootBlockId })))
|
|
1268
1281
|
);
|
|
1269
1282
|
}
|
|
1270
1283
|
|
|
@@ -2005,6 +2018,23 @@ function setSelectedScreenSize(selectedScreenSize) {
|
|
|
2005
2018
|
function setPersistenceEnabled(persistenceEnabled) {
|
|
2006
2019
|
return editorStateStore.setState({ persistenceEnabled });
|
|
2007
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
|
|
2008
2038
|
var EmailEditorContext = createContext(null);
|
|
2009
2039
|
var EmailEditorProvider = ({
|
|
2010
2040
|
children,
|
|
@@ -2014,6 +2044,7 @@ var EmailEditorProvider = ({
|
|
|
2014
2044
|
}) => {
|
|
2015
2045
|
const [currentTemplateId, setCurrentTemplateId] = useState(initialTemplateId);
|
|
2016
2046
|
const [currentTemplateName, setCurrentTemplateName] = useState(initialTemplateName);
|
|
2047
|
+
const [currentTemplateKind, setCurrentTemplateKind] = useState(null);
|
|
2017
2048
|
const saveListenersRef = useRef([]);
|
|
2018
2049
|
const onSaveRef = useRef(onSave);
|
|
2019
2050
|
onSaveRef.current = onSave;
|
|
@@ -2021,21 +2052,27 @@ var EmailEditorProvider = ({
|
|
|
2021
2052
|
const currentDoc = getDocument();
|
|
2022
2053
|
saveListenersRef.current.forEach((listener) => listener(currentDoc));
|
|
2023
2054
|
if (onSaveRef.current) {
|
|
2024
|
-
onSaveRef.current(currentDoc);
|
|
2055
|
+
onSaveRef.current(buildSavePayload(currentDoc));
|
|
2025
2056
|
}
|
|
2026
2057
|
return currentDoc;
|
|
2027
2058
|
}, []);
|
|
2028
|
-
const loadTemplate = useCallback((newTemplate, templateId, templateName) => {
|
|
2059
|
+
const loadTemplate = useCallback((newTemplate, templateId, templateName, kind) => {
|
|
2029
2060
|
if (templateId !== void 0) {
|
|
2030
2061
|
setCurrentTemplateId(templateId);
|
|
2031
2062
|
}
|
|
2032
2063
|
if (templateName !== void 0) {
|
|
2033
2064
|
setCurrentTemplateName(templateName);
|
|
2034
2065
|
}
|
|
2066
|
+
if (kind !== void 0) {
|
|
2067
|
+
setCurrentTemplateKind(kind);
|
|
2068
|
+
}
|
|
2035
2069
|
}, []);
|
|
2036
|
-
const setCurrentTemplate = useCallback((templateId, templateName) => {
|
|
2070
|
+
const setCurrentTemplate = useCallback((templateId, templateName, kind) => {
|
|
2037
2071
|
setCurrentTemplateId(templateId);
|
|
2038
2072
|
setCurrentTemplateName(templateName);
|
|
2073
|
+
if (kind !== void 0) {
|
|
2074
|
+
setCurrentTemplateKind(kind);
|
|
2075
|
+
}
|
|
2039
2076
|
}, []);
|
|
2040
2077
|
const registerSaveListener = useCallback((callback) => {
|
|
2041
2078
|
saveListenersRef.current = [...saveListenersRef.current, callback];
|
|
@@ -2046,12 +2083,13 @@ var EmailEditorProvider = ({
|
|
|
2046
2083
|
const value = useMemo(() => ({
|
|
2047
2084
|
currentTemplateId,
|
|
2048
2085
|
currentTemplateName,
|
|
2086
|
+
currentTemplateKind,
|
|
2049
2087
|
saveTemplate,
|
|
2050
2088
|
loadTemplate,
|
|
2051
2089
|
registerSaveListener,
|
|
2052
2090
|
setCurrentTemplate
|
|
2053
|
-
}), [currentTemplateId, currentTemplateName, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2054
|
-
return /* @__PURE__ */
|
|
2091
|
+
}), [currentTemplateId, currentTemplateName, currentTemplateKind, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2092
|
+
return /* @__PURE__ */ React60.createElement(EmailEditorContext.Provider, { value }, children);
|
|
2055
2093
|
};
|
|
2056
2094
|
var useEmailEditor = () => {
|
|
2057
2095
|
const context = useContext(EmailEditorContext);
|
|
@@ -2061,14 +2099,14 @@ var useEmailEditor = () => {
|
|
|
2061
2099
|
return context;
|
|
2062
2100
|
};
|
|
2063
2101
|
function BaseSidebarPanel({ title, children }) {
|
|
2064
|
-
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));
|
|
2065
2103
|
}
|
|
2066
2104
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
2067
2105
|
const [value, setValue] = useState(defaultValue);
|
|
2068
2106
|
useEffect(() => {
|
|
2069
2107
|
setValue(defaultValue);
|
|
2070
2108
|
}, [defaultValue]);
|
|
2071
|
-
return /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ React60.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2072
2110
|
ToggleButtonGroup,
|
|
2073
2111
|
{
|
|
2074
2112
|
exclusive: true,
|
|
@@ -2088,7 +2126,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
2088
2126
|
}
|
|
2089
2127
|
function RawSliderInput(_a) {
|
|
2090
2128
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
2091
|
-
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(
|
|
2092
2130
|
Slider,
|
|
2093
2131
|
__spreadProps(__spreadValues({}, props), {
|
|
2094
2132
|
value,
|
|
@@ -2099,14 +2137,14 @@ function RawSliderInput(_a) {
|
|
|
2099
2137
|
setValue(value2);
|
|
2100
2138
|
}
|
|
2101
2139
|
})
|
|
2102
|
-
), /* @__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)));
|
|
2103
2141
|
}
|
|
2104
2142
|
|
|
2105
2143
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
2106
2144
|
function SliderInput(_a) {
|
|
2107
2145
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
2108
2146
|
const [value, setValue] = useState(defaultValue);
|
|
2109
|
-
return /* @__PURE__ */
|
|
2147
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2110
2148
|
RawSliderInput,
|
|
2111
2149
|
__spreadValues({
|
|
2112
2150
|
value,
|
|
@@ -2123,7 +2161,7 @@ function TextInput({ helperText, label, placeholder, rows, InputProps: InputProp
|
|
|
2123
2161
|
useEffect(() => {
|
|
2124
2162
|
setValue(defaultValue);
|
|
2125
2163
|
}, [defaultValue]);
|
|
2126
|
-
return /* @__PURE__ */
|
|
2164
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2127
2165
|
TextField,
|
|
2128
2166
|
{
|
|
2129
2167
|
fullWidth: true,
|
|
@@ -2149,7 +2187,7 @@ var TILE_BUTTON = {
|
|
|
2149
2187
|
};
|
|
2150
2188
|
function Swatch({ paletteColors, value, onChange }) {
|
|
2151
2189
|
const renderButton2 = (colorValue) => {
|
|
2152
|
-
return /* @__PURE__ */
|
|
2190
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2153
2191
|
Button$1,
|
|
2154
2192
|
{
|
|
2155
2193
|
key: colorValue,
|
|
@@ -2168,7 +2206,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
2168
2206
|
}
|
|
2169
2207
|
);
|
|
2170
2208
|
};
|
|
2171
|
-
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)));
|
|
2172
2210
|
}
|
|
2173
2211
|
|
|
2174
2212
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -2235,7 +2273,7 @@ var SX = {
|
|
|
2235
2273
|
}
|
|
2236
2274
|
};
|
|
2237
2275
|
function Picker({ value, onChange }) {
|
|
2238
|
-
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 })));
|
|
2239
2277
|
}
|
|
2240
2278
|
|
|
2241
2279
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -2260,7 +2298,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2260
2298
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2261
2299
|
return null;
|
|
2262
2300
|
}
|
|
2263
|
-
return /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2264
2302
|
ButtonBase,
|
|
2265
2303
|
{
|
|
2266
2304
|
onClick: () => {
|
|
@@ -2268,16 +2306,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2268
2306
|
onChange(null);
|
|
2269
2307
|
}
|
|
2270
2308
|
},
|
|
2271
|
-
/* @__PURE__ */
|
|
2309
|
+
/* @__PURE__ */ React60.createElement(CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
2272
2310
|
);
|
|
2273
2311
|
};
|
|
2274
2312
|
const renderOpenButton = () => {
|
|
2275
2313
|
if (value) {
|
|
2276
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ React60.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
2277
2315
|
}
|
|
2278
|
-
return /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ React60.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" }));
|
|
2279
2317
|
};
|
|
2280
|
-
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(
|
|
2281
2319
|
Menu,
|
|
2282
2320
|
{
|
|
2283
2321
|
anchorEl,
|
|
@@ -2287,7 +2325,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2287
2325
|
sx: { height: "auto", padding: 0 }
|
|
2288
2326
|
}
|
|
2289
2327
|
},
|
|
2290
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ React60.createElement(
|
|
2291
2329
|
Picker,
|
|
2292
2330
|
{
|
|
2293
2331
|
value: value || "",
|
|
@@ -2302,10 +2340,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2302
2340
|
|
|
2303
2341
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
2304
2342
|
function ColorInput2(props) {
|
|
2305
|
-
return /* @__PURE__ */
|
|
2343
|
+
return /* @__PURE__ */ React60.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
2306
2344
|
}
|
|
2307
2345
|
function NullableColorInput(props) {
|
|
2308
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ React60.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
2309
2347
|
}
|
|
2310
2348
|
|
|
2311
2349
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2358,13 +2396,13 @@ var FONT_FAMILIES = [
|
|
|
2358
2396
|
];
|
|
2359
2397
|
|
|
2360
2398
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2361
|
-
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));
|
|
2362
2400
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2363
2401
|
const [value, setValue] = useState(defaultValue != null ? defaultValue : "inherit");
|
|
2364
2402
|
useEffect(() => {
|
|
2365
2403
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2366
2404
|
}, [defaultValue]);
|
|
2367
|
-
return /* @__PURE__ */
|
|
2405
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2368
2406
|
TextField,
|
|
2369
2407
|
{
|
|
2370
2408
|
select: true,
|
|
@@ -2377,7 +2415,7 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2377
2415
|
onChange(v === null ? null : v);
|
|
2378
2416
|
}
|
|
2379
2417
|
},
|
|
2380
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ React60.createElement(MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2381
2419
|
OPTIONS
|
|
2382
2420
|
);
|
|
2383
2421
|
}
|
|
@@ -2390,10 +2428,10 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2390
2428
|
setValue(value2);
|
|
2391
2429
|
onChange(value2);
|
|
2392
2430
|
};
|
|
2393
|
-
return /* @__PURE__ */
|
|
2431
|
+
return /* @__PURE__ */ React60.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React60.createElement(
|
|
2394
2432
|
RawSliderInput,
|
|
2395
2433
|
{
|
|
2396
|
-
iconLabel: /* @__PURE__ */
|
|
2434
|
+
iconLabel: /* @__PURE__ */ React60.createElement(TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2397
2435
|
value,
|
|
2398
2436
|
setValue: handleChange,
|
|
2399
2437
|
units: "px",
|
|
@@ -2408,7 +2446,7 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2408
2446
|
useEffect(() => {
|
|
2409
2447
|
setValue(defaultValue);
|
|
2410
2448
|
}, [defaultValue]);
|
|
2411
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2412
2450
|
RadioGroupInput,
|
|
2413
2451
|
{
|
|
2414
2452
|
label,
|
|
@@ -2418,8 +2456,8 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2418
2456
|
onChange(fontWeight);
|
|
2419
2457
|
}
|
|
2420
2458
|
},
|
|
2421
|
-
/* @__PURE__ */
|
|
2422
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "normal" }, "Regular"),
|
|
2460
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "bold" }, "Bold")
|
|
2423
2461
|
);
|
|
2424
2462
|
}
|
|
2425
2463
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
@@ -2441,10 +2479,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2441
2479
|
setValue(v);
|
|
2442
2480
|
onChange(v);
|
|
2443
2481
|
}
|
|
2444
|
-
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(
|
|
2445
2483
|
RawSliderInput,
|
|
2446
2484
|
{
|
|
2447
|
-
iconLabel: /* @__PURE__ */
|
|
2485
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2448
2486
|
value: value.top,
|
|
2449
2487
|
setValue: (num) => handleChange("top", num),
|
|
2450
2488
|
units: "px",
|
|
@@ -2453,10 +2491,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2453
2491
|
max: 80,
|
|
2454
2492
|
marks: true
|
|
2455
2493
|
}
|
|
2456
|
-
), /* @__PURE__ */
|
|
2494
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2457
2495
|
RawSliderInput,
|
|
2458
2496
|
{
|
|
2459
|
-
iconLabel: /* @__PURE__ */
|
|
2497
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2460
2498
|
value: value.bottom,
|
|
2461
2499
|
setValue: (num) => handleChange("bottom", num),
|
|
2462
2500
|
units: "px",
|
|
@@ -2465,10 +2503,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2465
2503
|
max: 80,
|
|
2466
2504
|
marks: true
|
|
2467
2505
|
}
|
|
2468
|
-
), /* @__PURE__ */
|
|
2506
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2469
2507
|
RawSliderInput,
|
|
2470
2508
|
{
|
|
2471
|
-
iconLabel: /* @__PURE__ */
|
|
2509
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2472
2510
|
value: value.left,
|
|
2473
2511
|
setValue: (num) => handleChange("left", num),
|
|
2474
2512
|
units: "px",
|
|
@@ -2477,10 +2515,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2477
2515
|
max: 80,
|
|
2478
2516
|
marks: true
|
|
2479
2517
|
}
|
|
2480
|
-
), /* @__PURE__ */
|
|
2518
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2481
2519
|
RawSliderInput,
|
|
2482
2520
|
{
|
|
2483
|
-
iconLabel: /* @__PURE__ */
|
|
2521
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2484
2522
|
value: value.right,
|
|
2485
2523
|
setValue: (num) => handleChange("right", num),
|
|
2486
2524
|
units: "px",
|
|
@@ -2496,7 +2534,7 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2496
2534
|
useEffect(() => {
|
|
2497
2535
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2498
2536
|
}, [defaultValue]);
|
|
2499
|
-
return /* @__PURE__ */
|
|
2537
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2500
2538
|
RadioGroupInput,
|
|
2501
2539
|
{
|
|
2502
2540
|
label,
|
|
@@ -2506,9 +2544,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2506
2544
|
onChange(value2);
|
|
2507
2545
|
}
|
|
2508
2546
|
},
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__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" }))
|
|
2512
2550
|
);
|
|
2513
2551
|
}
|
|
2514
2552
|
|
|
@@ -2521,14 +2559,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2521
2559
|
};
|
|
2522
2560
|
switch (name) {
|
|
2523
2561
|
case "backgroundColor":
|
|
2524
|
-
return /* @__PURE__ */
|
|
2562
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
|
|
2525
2563
|
case "borderColor":
|
|
2526
|
-
return /* @__PURE__ */
|
|
2564
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
|
|
2527
2565
|
case "borderRadius":
|
|
2528
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2529
2567
|
SliderInput,
|
|
2530
2568
|
{
|
|
2531
|
-
iconLabel: /* @__PURE__ */
|
|
2569
|
+
iconLabel: /* @__PURE__ */ React60.createElement(RoundedCornerOutlined, null),
|
|
2532
2570
|
units: "px",
|
|
2533
2571
|
step: 4,
|
|
2534
2572
|
marks: true,
|
|
@@ -2540,23 +2578,23 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2540
2578
|
}
|
|
2541
2579
|
);
|
|
2542
2580
|
case "color":
|
|
2543
|
-
return /* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ React60.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
|
|
2544
2582
|
case "fontFamily":
|
|
2545
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ React60.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
|
|
2546
2584
|
case "fontSize":
|
|
2547
|
-
return /* @__PURE__ */
|
|
2585
|
+
return /* @__PURE__ */ React60.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
|
|
2548
2586
|
case "fontWeight":
|
|
2549
|
-
return /* @__PURE__ */
|
|
2587
|
+
return /* @__PURE__ */ React60.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
|
|
2550
2588
|
case "textAlign":
|
|
2551
|
-
return /* @__PURE__ */
|
|
2589
|
+
return /* @__PURE__ */ React60.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
|
|
2552
2590
|
case "padding":
|
|
2553
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ React60.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
|
|
2554
2592
|
}
|
|
2555
2593
|
}
|
|
2556
2594
|
|
|
2557
2595
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2558
2596
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2559
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, names.map((name) => /* @__PURE__ */ React60.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2560
2598
|
}
|
|
2561
2599
|
|
|
2562
2600
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
@@ -2576,11 +2614,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2576
2614
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2577
2615
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2578
2616
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2579
|
-
return /* @__PURE__ */
|
|
2617
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React60.createElement(
|
|
2580
2618
|
SliderInput,
|
|
2581
2619
|
{
|
|
2582
2620
|
label: "Size",
|
|
2583
|
-
iconLabel: /* @__PURE__ */
|
|
2621
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2584
2622
|
units: "px",
|
|
2585
2623
|
step: 3,
|
|
2586
2624
|
min: 32,
|
|
@@ -2590,7 +2628,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2590
2628
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2591
2629
|
}
|
|
2592
2630
|
}
|
|
2593
|
-
), /* @__PURE__ */
|
|
2631
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2594
2632
|
RadioGroupInput,
|
|
2595
2633
|
{
|
|
2596
2634
|
label: "Shape",
|
|
@@ -2599,10 +2637,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2599
2637
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2600
2638
|
}
|
|
2601
2639
|
},
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
/* @__PURE__ */
|
|
2604
|
-
/* @__PURE__ */
|
|
2605
|
-
), /* @__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(
|
|
2606
2644
|
TextInput,
|
|
2607
2645
|
{
|
|
2608
2646
|
label: "Image URL",
|
|
@@ -2611,7 +2649,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2611
2649
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2612
2650
|
}
|
|
2613
2651
|
}
|
|
2614
|
-
), /* @__PURE__ */
|
|
2652
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2615
2653
|
TextInput,
|
|
2616
2654
|
{
|
|
2617
2655
|
label: "Alt text",
|
|
@@ -2620,7 +2658,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2620
2658
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2621
2659
|
}
|
|
2622
2660
|
}
|
|
2623
|
-
), /* @__PURE__ */
|
|
2661
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2624
2662
|
MultiStylePropertyPanel,
|
|
2625
2663
|
{
|
|
2626
2664
|
names: ["textAlign", "padding"],
|
|
@@ -2648,65 +2686,65 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2648
2686
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2649
2687
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2650
2688
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2651
|
-
return /* @__PURE__ */
|
|
2689
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React60.createElement(
|
|
2652
2690
|
TextInput,
|
|
2653
2691
|
{
|
|
2654
2692
|
label: "Text",
|
|
2655
2693
|
defaultValue: text,
|
|
2656
2694
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2657
2695
|
}
|
|
2658
|
-
), /* @__PURE__ */
|
|
2696
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2659
2697
|
TextInput,
|
|
2660
2698
|
{
|
|
2661
2699
|
label: "Url",
|
|
2662
2700
|
defaultValue: url,
|
|
2663
2701
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2664
2702
|
}
|
|
2665
|
-
), /* @__PURE__ */
|
|
2703
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2666
2704
|
RadioGroupInput,
|
|
2667
2705
|
{
|
|
2668
2706
|
label: "Width",
|
|
2669
2707
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2670
2708
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2671
2709
|
},
|
|
2672
|
-
/* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
), /* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2711
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "AUTO" }, "Auto")
|
|
2712
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2675
2713
|
RadioGroupInput,
|
|
2676
2714
|
{
|
|
2677
2715
|
label: "Size",
|
|
2678
2716
|
defaultValue: size,
|
|
2679
2717
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2680
2718
|
},
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
), /* @__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(
|
|
2686
2724
|
RadioGroupInput,
|
|
2687
2725
|
{
|
|
2688
2726
|
label: "Style",
|
|
2689
2727
|
defaultValue: buttonStyle,
|
|
2690
2728
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2691
2729
|
},
|
|
2692
|
-
/* @__PURE__ */
|
|
2693
|
-
/* @__PURE__ */
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
), /* @__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(
|
|
2696
2734
|
ColorInput2,
|
|
2697
2735
|
{
|
|
2698
2736
|
label: "Text color",
|
|
2699
2737
|
defaultValue: buttonTextColor,
|
|
2700
2738
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2701
2739
|
}
|
|
2702
|
-
), /* @__PURE__ */
|
|
2740
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2703
2741
|
ColorInput2,
|
|
2704
2742
|
{
|
|
2705
2743
|
label: "Button color",
|
|
2706
2744
|
defaultValue: buttonBackgroundColor,
|
|
2707
2745
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2708
2746
|
}
|
|
2709
|
-
), /* @__PURE__ */
|
|
2747
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2710
2748
|
MultiStylePropertyPanel,
|
|
2711
2749
|
{
|
|
2712
2750
|
names: ["backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -2732,7 +2770,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2732
2770
|
const value = parseInt(ev.target.value);
|
|
2733
2771
|
onChange(isNaN(value) ? null : value);
|
|
2734
2772
|
};
|
|
2735
|
-
return /* @__PURE__ */
|
|
2773
|
+
return /* @__PURE__ */ React60.createElement(
|
|
2736
2774
|
TextField,
|
|
2737
2775
|
{
|
|
2738
2776
|
fullWidth: true,
|
|
@@ -2743,7 +2781,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2743
2781
|
placeholder: "auto",
|
|
2744
2782
|
size: "small",
|
|
2745
2783
|
InputProps: {
|
|
2746
|
-
endAdornment: /* @__PURE__ */
|
|
2784
|
+
endAdornment: /* @__PURE__ */ React60.createElement(Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2747
2785
|
}
|
|
2748
2786
|
}
|
|
2749
2787
|
);
|
|
@@ -2765,7 +2803,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2765
2803
|
};
|
|
2766
2804
|
let column3 = null;
|
|
2767
2805
|
{
|
|
2768
|
-
column3 = /* @__PURE__ */
|
|
2806
|
+
column3 = /* @__PURE__ */ React60.createElement(
|
|
2769
2807
|
TextDimensionInput,
|
|
2770
2808
|
{
|
|
2771
2809
|
label: "Column 3",
|
|
@@ -2776,7 +2814,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2776
2814
|
}
|
|
2777
2815
|
);
|
|
2778
2816
|
}
|
|
2779
|
-
return /* @__PURE__ */
|
|
2817
|
+
return /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React60.createElement(
|
|
2780
2818
|
TextDimensionInput,
|
|
2781
2819
|
{
|
|
2782
2820
|
label: "Column 1",
|
|
@@ -2785,7 +2823,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2785
2823
|
setIndexValue(0, v);
|
|
2786
2824
|
}
|
|
2787
2825
|
}
|
|
2788
|
-
), /* @__PURE__ */
|
|
2826
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2789
2827
|
TextDimensionInput,
|
|
2790
2828
|
{
|
|
2791
2829
|
label: "Column 2",
|
|
@@ -2810,7 +2848,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2810
2848
|
setErrors(res.error);
|
|
2811
2849
|
}
|
|
2812
2850
|
};
|
|
2813
|
-
return /* @__PURE__ */
|
|
2851
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React60.createElement(
|
|
2814
2852
|
RadioGroupInput,
|
|
2815
2853
|
{
|
|
2816
2854
|
label: "Number of columns",
|
|
@@ -2819,9 +2857,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2819
2857
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
2820
2858
|
}
|
|
2821
2859
|
},
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
), /* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "2" }, "2"),
|
|
2861
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "3" }, "3")
|
|
2862
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2825
2863
|
ColumnWidthsInput,
|
|
2826
2864
|
{
|
|
2827
2865
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -2829,11 +2867,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2829
2867
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
2830
2868
|
}
|
|
2831
2869
|
}
|
|
2832
|
-
), /* @__PURE__ */
|
|
2870
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2833
2871
|
SliderInput,
|
|
2834
2872
|
{
|
|
2835
2873
|
label: "Columns gap",
|
|
2836
|
-
iconLabel: /* @__PURE__ */
|
|
2874
|
+
iconLabel: /* @__PURE__ */ React60.createElement(SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
2837
2875
|
units: "px",
|
|
2838
2876
|
step: 4,
|
|
2839
2877
|
marks: true,
|
|
@@ -2842,7 +2880,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2842
2880
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
2843
2881
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
2844
2882
|
}
|
|
2845
|
-
), /* @__PURE__ */
|
|
2883
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2846
2884
|
RadioGroupInput,
|
|
2847
2885
|
{
|
|
2848
2886
|
label: "Alignment",
|
|
@@ -2851,10 +2889,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2851
2889
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
2852
2890
|
}
|
|
2853
2891
|
},
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
), /* @__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(
|
|
2858
2896
|
MultiStylePropertyPanel,
|
|
2859
2897
|
{
|
|
2860
2898
|
names: ["backgroundColor", "padding"],
|
|
@@ -2883,7 +2921,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2883
2921
|
setErrors(res.error);
|
|
2884
2922
|
}
|
|
2885
2923
|
};
|
|
2886
|
-
return /* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React60.createElement(
|
|
2887
2925
|
MultiStylePropertyPanel,
|
|
2888
2926
|
{
|
|
2889
2927
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -2906,18 +2944,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2906
2944
|
};
|
|
2907
2945
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
2908
2946
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
2909
|
-
return /* @__PURE__ */
|
|
2947
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React60.createElement(
|
|
2910
2948
|
ColorInput2,
|
|
2911
2949
|
{
|
|
2912
2950
|
label: "Color",
|
|
2913
2951
|
defaultValue: lineColor,
|
|
2914
2952
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
2915
2953
|
}
|
|
2916
|
-
), /* @__PURE__ */
|
|
2954
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2917
2955
|
SliderInput,
|
|
2918
2956
|
{
|
|
2919
2957
|
label: "Height",
|
|
2920
|
-
iconLabel: /* @__PURE__ */
|
|
2958
|
+
iconLabel: /* @__PURE__ */ React60.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2921
2959
|
units: "px",
|
|
2922
2960
|
step: 1,
|
|
2923
2961
|
min: 1,
|
|
@@ -2925,7 +2963,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2925
2963
|
defaultValue: lineHeight,
|
|
2926
2964
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
2927
2965
|
}
|
|
2928
|
-
), /* @__PURE__ */
|
|
2966
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2929
2967
|
MultiStylePropertyPanel,
|
|
2930
2968
|
{
|
|
2931
2969
|
names: ["backgroundColor", "padding"],
|
|
@@ -2946,20 +2984,49 @@ var FONT_FAMILY_SCHEMA7 = z.enum([
|
|
|
2946
2984
|
"BOOK_SERIF",
|
|
2947
2985
|
"MONOSPACE"
|
|
2948
2986
|
]).nullable().optional();
|
|
2987
|
+
var TemplateVariableSchema2 = z.object({
|
|
2988
|
+
name: z.string(),
|
|
2989
|
+
description: z.string().optional().nullable()
|
|
2990
|
+
});
|
|
2949
2991
|
var EmailLayoutPropsSchema2 = z.object({
|
|
2950
2992
|
backdropColor: COLOR_SCHEMA10,
|
|
2993
|
+
backdropDisabled: z.boolean().optional().nullable(),
|
|
2951
2994
|
borderColor: COLOR_SCHEMA10,
|
|
2952
2995
|
borderRadius: z.number().optional().nullable(),
|
|
2953
2996
|
canvasColor: COLOR_SCHEMA10,
|
|
2954
2997
|
textColor: COLOR_SCHEMA10,
|
|
2955
2998
|
fontFamily: FONT_FAMILY_SCHEMA7,
|
|
2956
|
-
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()
|
|
2957
3002
|
});
|
|
2958
3003
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
3004
|
+
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3005
|
+
const [value, setValue] = useState(defaultValue);
|
|
3006
|
+
useEffect(() => {
|
|
3007
|
+
setValue(defaultValue);
|
|
3008
|
+
}, [defaultValue]);
|
|
3009
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3010
|
+
FormControlLabel,
|
|
3011
|
+
{
|
|
3012
|
+
label,
|
|
3013
|
+
control: /* @__PURE__ */ React60.createElement(
|
|
3014
|
+
Switch,
|
|
3015
|
+
{
|
|
3016
|
+
checked: value,
|
|
3017
|
+
onChange: (_, checked) => {
|
|
3018
|
+
setValue(checked);
|
|
3019
|
+
onChange(checked);
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
)
|
|
3023
|
+
}
|
|
3024
|
+
);
|
|
3025
|
+
}
|
|
2959
3026
|
|
|
2960
3027
|
// src/app/inspector-drawer/configuration-panel/input-panels/email-layout-sidebar-panel.tsx
|
|
2961
3028
|
function EmailLayoutSidebarFields({ data, setData }) {
|
|
2962
|
-
var _a, _b, _c, _d, _e;
|
|
3029
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2963
3030
|
const [, setErrors] = useState(null);
|
|
2964
3031
|
const updateData = (d) => {
|
|
2965
3032
|
const res = email_layout_props_schema_default.safeParse(d);
|
|
@@ -2970,52 +3037,60 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
2970
3037
|
setErrors(res.error);
|
|
2971
3038
|
}
|
|
2972
3039
|
};
|
|
2973
|
-
|
|
3040
|
+
const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
|
|
3041
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React60.createElement(
|
|
3042
|
+
BooleanInput,
|
|
3043
|
+
{
|
|
3044
|
+
label: "Disable backdrop",
|
|
3045
|
+
defaultValue: backdropDisabled,
|
|
3046
|
+
onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
|
|
3047
|
+
}
|
|
3048
|
+
), !backdropDisabled && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
2974
3049
|
ColorInput2,
|
|
2975
3050
|
{
|
|
2976
3051
|
label: "Backdrop color",
|
|
2977
|
-
defaultValue: (
|
|
3052
|
+
defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
|
|
2978
3053
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
2979
3054
|
}
|
|
2980
|
-
), /* @__PURE__ */
|
|
3055
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2981
3056
|
ColorInput2,
|
|
2982
3057
|
{
|
|
2983
3058
|
label: "Canvas color",
|
|
2984
|
-
defaultValue: (
|
|
3059
|
+
defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
|
|
2985
3060
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
2986
3061
|
}
|
|
2987
|
-
), /* @__PURE__ */
|
|
3062
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2988
3063
|
NullableColorInput,
|
|
2989
3064
|
{
|
|
2990
3065
|
label: "Canvas border color",
|
|
2991
|
-
defaultValue: (
|
|
3066
|
+
defaultValue: (_d = data.borderColor) != null ? _d : null,
|
|
2992
3067
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
2993
3068
|
}
|
|
2994
|
-
), /* @__PURE__ */
|
|
3069
|
+
), /* @__PURE__ */ React60.createElement(
|
|
2995
3070
|
SliderInput,
|
|
2996
3071
|
{
|
|
2997
|
-
iconLabel: /* @__PURE__ */
|
|
3072
|
+
iconLabel: /* @__PURE__ */ React60.createElement(RoundedCornerOutlined, null),
|
|
2998
3073
|
units: "px",
|
|
2999
3074
|
step: 4,
|
|
3000
3075
|
marks: true,
|
|
3001
3076
|
min: 0,
|
|
3002
3077
|
max: 48,
|
|
3003
3078
|
label: "Canvas border radius",
|
|
3004
|
-
defaultValue: (
|
|
3079
|
+
defaultValue: (_e = data.borderRadius) != null ? _e : 0,
|
|
3005
3080
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
3006
3081
|
}
|
|
3007
|
-
), /* @__PURE__ */
|
|
3082
|
+
)), /* @__PURE__ */ React60.createElement(
|
|
3008
3083
|
NullableFontFamily,
|
|
3009
3084
|
{
|
|
3010
3085
|
label: "Font family",
|
|
3011
3086
|
defaultValue: "MODERN_SANS",
|
|
3012
3087
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
3013
3088
|
}
|
|
3014
|
-
), /* @__PURE__ */
|
|
3089
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3015
3090
|
ColorInput2,
|
|
3016
3091
|
{
|
|
3017
3092
|
label: "Text color",
|
|
3018
|
-
defaultValue: (
|
|
3093
|
+
defaultValue: (_f = data.textColor) != null ? _f : "#262626",
|
|
3019
3094
|
onChange: (textColor) => updateData(__spreadProps(__spreadValues({}, data), { textColor }))
|
|
3020
3095
|
}
|
|
3021
3096
|
));
|
|
@@ -3032,7 +3107,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3032
3107
|
setErrors(res.error);
|
|
3033
3108
|
}
|
|
3034
3109
|
};
|
|
3035
|
-
return /* @__PURE__ */
|
|
3110
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React60.createElement(
|
|
3036
3111
|
TextInput,
|
|
3037
3112
|
{
|
|
3038
3113
|
label: "Content",
|
|
@@ -3042,7 +3117,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3042
3117
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
3043
3118
|
}
|
|
3044
3119
|
}
|
|
3045
|
-
), /* @__PURE__ */
|
|
3120
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3046
3121
|
RadioGroupInput,
|
|
3047
3122
|
{
|
|
3048
3123
|
label: "Level",
|
|
@@ -3051,10 +3126,10 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3051
3126
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
3052
3127
|
}
|
|
3053
3128
|
},
|
|
3054
|
-
/* @__PURE__ */
|
|
3055
|
-
/* @__PURE__ */
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
), /* @__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(
|
|
3058
3133
|
MultiStylePropertyPanel,
|
|
3059
3134
|
{
|
|
3060
3135
|
names: ["color", "backgroundColor", "fontFamily", "fontWeight", "textAlign", "padding"],
|
|
@@ -3075,7 +3150,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3075
3150
|
setErrors(res.error);
|
|
3076
3151
|
}
|
|
3077
3152
|
};
|
|
3078
|
-
return /* @__PURE__ */
|
|
3153
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React60.createElement(
|
|
3079
3154
|
TextInput,
|
|
3080
3155
|
{
|
|
3081
3156
|
label: "Content",
|
|
@@ -3083,7 +3158,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3083
3158
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
3084
3159
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
3085
3160
|
}
|
|
3086
|
-
), /* @__PURE__ */
|
|
3161
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3087
3162
|
MultiStylePropertyPanel,
|
|
3088
3163
|
{
|
|
3089
3164
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -3104,7 +3179,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3104
3179
|
setErrors(res.error);
|
|
3105
3180
|
}
|
|
3106
3181
|
};
|
|
3107
|
-
return /* @__PURE__ */
|
|
3182
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Image block" }, /* @__PURE__ */ React60.createElement(
|
|
3108
3183
|
TextInput,
|
|
3109
3184
|
{
|
|
3110
3185
|
label: "Source URL",
|
|
@@ -3114,14 +3189,14 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3114
3189
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url }) }));
|
|
3115
3190
|
}
|
|
3116
3191
|
}
|
|
3117
|
-
), /* @__PURE__ */
|
|
3192
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3118
3193
|
TextInput,
|
|
3119
3194
|
{
|
|
3120
3195
|
label: "Alt text",
|
|
3121
3196
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
3122
3197
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
3123
3198
|
}
|
|
3124
|
-
), /* @__PURE__ */
|
|
3199
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3125
3200
|
TextInput,
|
|
3126
3201
|
{
|
|
3127
3202
|
label: "Click through URL",
|
|
@@ -3131,31 +3206,31 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3131
3206
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
3132
3207
|
}
|
|
3133
3208
|
}
|
|
3134
|
-
), /* @__PURE__ */
|
|
3209
|
+
), /* @__PURE__ */ React60.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60.createElement(
|
|
3135
3210
|
TextDimensionInput,
|
|
3136
3211
|
{
|
|
3137
3212
|
label: "Width",
|
|
3138
3213
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
3139
3214
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
3140
3215
|
}
|
|
3141
|
-
), /* @__PURE__ */
|
|
3216
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3142
3217
|
TextDimensionInput,
|
|
3143
3218
|
{
|
|
3144
3219
|
label: "Height",
|
|
3145
3220
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
3146
3221
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
3147
3222
|
}
|
|
3148
|
-
)), /* @__PURE__ */
|
|
3223
|
+
)), /* @__PURE__ */ React60.createElement(
|
|
3149
3224
|
RadioGroupInput,
|
|
3150
3225
|
{
|
|
3151
3226
|
label: "Alignment",
|
|
3152
3227
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
3153
3228
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
3154
3229
|
},
|
|
3155
|
-
/* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
), /* @__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(
|
|
3159
3234
|
MultiStylePropertyPanel,
|
|
3160
3235
|
{
|
|
3161
3236
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
@@ -3191,74 +3266,74 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3191
3266
|
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3192
3267
|
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3193
3268
|
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3194
|
-
return /* @__PURE__ */
|
|
3269
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React60.createElement(
|
|
3195
3270
|
TextInput,
|
|
3196
3271
|
{
|
|
3197
3272
|
label: "Greeting",
|
|
3198
3273
|
defaultValue: greeting,
|
|
3199
3274
|
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3200
3275
|
}
|
|
3201
|
-
), /* @__PURE__ */
|
|
3276
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3202
3277
|
TextInput,
|
|
3203
3278
|
{
|
|
3204
3279
|
label: "Name",
|
|
3205
3280
|
defaultValue: name,
|
|
3206
3281
|
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3207
3282
|
}
|
|
3208
|
-
), /* @__PURE__ */
|
|
3283
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3209
3284
|
TextInput,
|
|
3210
3285
|
{
|
|
3211
3286
|
label: "Title",
|
|
3212
3287
|
defaultValue: title,
|
|
3213
3288
|
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3214
3289
|
}
|
|
3215
|
-
), /* @__PURE__ */
|
|
3290
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3216
3291
|
TextInput,
|
|
3217
3292
|
{
|
|
3218
3293
|
label: "Company",
|
|
3219
3294
|
defaultValue: company,
|
|
3220
3295
|
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3221
3296
|
}
|
|
3222
|
-
), /* @__PURE__ */
|
|
3297
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3223
3298
|
TextInput,
|
|
3224
3299
|
{
|
|
3225
3300
|
label: "Address",
|
|
3226
3301
|
defaultValue: address,
|
|
3227
3302
|
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3228
3303
|
}
|
|
3229
|
-
), /* @__PURE__ */
|
|
3304
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3230
3305
|
TextInput,
|
|
3231
3306
|
{
|
|
3232
3307
|
label: "Email",
|
|
3233
3308
|
defaultValue: email,
|
|
3234
3309
|
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3235
3310
|
}
|
|
3236
|
-
), /* @__PURE__ */
|
|
3311
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3237
3312
|
TextInput,
|
|
3238
3313
|
{
|
|
3239
3314
|
label: "Phone",
|
|
3240
3315
|
defaultValue: phone,
|
|
3241
3316
|
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3242
3317
|
}
|
|
3243
|
-
), /* @__PURE__ */
|
|
3318
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3244
3319
|
TextInput,
|
|
3245
3320
|
{
|
|
3246
3321
|
label: "Website",
|
|
3247
3322
|
defaultValue: website,
|
|
3248
3323
|
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3249
3324
|
}
|
|
3250
|
-
), /* @__PURE__ */
|
|
3325
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3251
3326
|
TextInput,
|
|
3252
3327
|
{
|
|
3253
3328
|
label: "Image URL",
|
|
3254
3329
|
defaultValue: imageUrl,
|
|
3255
3330
|
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3256
3331
|
}
|
|
3257
|
-
), /* @__PURE__ */
|
|
3332
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3258
3333
|
SliderInput,
|
|
3259
3334
|
{
|
|
3260
3335
|
label: "Image size",
|
|
3261
|
-
iconLabel: /* @__PURE__ */
|
|
3336
|
+
iconLabel: /* @__PURE__ */ React60.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3262
3337
|
units: "px",
|
|
3263
3338
|
step: 4,
|
|
3264
3339
|
min: 32,
|
|
@@ -3266,47 +3341,47 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3266
3341
|
defaultValue: imageSize,
|
|
3267
3342
|
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3268
3343
|
}
|
|
3269
|
-
), /* @__PURE__ */
|
|
3344
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3270
3345
|
RadioGroupInput,
|
|
3271
3346
|
{
|
|
3272
3347
|
label: "Image shape",
|
|
3273
3348
|
defaultValue: imageShape,
|
|
3274
3349
|
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3275
3350
|
},
|
|
3276
|
-
/* @__PURE__ */
|
|
3277
|
-
/* @__PURE__ */
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
), /* @__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(
|
|
3280
3355
|
RadioGroupInput,
|
|
3281
3356
|
{
|
|
3282
3357
|
label: "Layout",
|
|
3283
3358
|
defaultValue: layout,
|
|
3284
3359
|
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3285
3360
|
},
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
), /* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3362
|
+
/* @__PURE__ */ React60.createElement(ToggleButton, { value: "vertical" }, "Vertical")
|
|
3363
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3289
3364
|
ColorInput2,
|
|
3290
3365
|
{
|
|
3291
3366
|
label: "Name color",
|
|
3292
3367
|
defaultValue: nameColor,
|
|
3293
3368
|
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3294
3369
|
}
|
|
3295
|
-
), /* @__PURE__ */
|
|
3370
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3296
3371
|
ColorInput2,
|
|
3297
3372
|
{
|
|
3298
3373
|
label: "Text color",
|
|
3299
3374
|
defaultValue: textColor,
|
|
3300
3375
|
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3301
3376
|
}
|
|
3302
|
-
), /* @__PURE__ */
|
|
3377
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3303
3378
|
ColorInput2,
|
|
3304
3379
|
{
|
|
3305
3380
|
label: "Link color",
|
|
3306
3381
|
defaultValue: linkColor,
|
|
3307
3382
|
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3308
3383
|
}
|
|
3309
|
-
), /* @__PURE__ */
|
|
3384
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3310
3385
|
MultiStylePropertyPanel,
|
|
3311
3386
|
{
|
|
3312
3387
|
names: ["backgroundColor", "fontFamily", "padding"],
|
|
@@ -3327,11 +3402,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3327
3402
|
setErrors(res.error);
|
|
3328
3403
|
}
|
|
3329
3404
|
};
|
|
3330
|
-
return /* @__PURE__ */
|
|
3405
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React60.createElement(
|
|
3331
3406
|
SliderInput,
|
|
3332
3407
|
{
|
|
3333
3408
|
label: "Height",
|
|
3334
|
-
iconLabel: /* @__PURE__ */
|
|
3409
|
+
iconLabel: /* @__PURE__ */ React60.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3335
3410
|
units: "px",
|
|
3336
3411
|
step: 4,
|
|
3337
3412
|
min: 4,
|
|
@@ -3341,30 +3416,6 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3341
3416
|
}
|
|
3342
3417
|
));
|
|
3343
3418
|
}
|
|
3344
|
-
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3345
|
-
const [value, setValue] = useState(defaultValue);
|
|
3346
|
-
useEffect(() => {
|
|
3347
|
-
setValue(defaultValue);
|
|
3348
|
-
}, [defaultValue]);
|
|
3349
|
-
return /* @__PURE__ */ React72.createElement(
|
|
3350
|
-
FormControlLabel,
|
|
3351
|
-
{
|
|
3352
|
-
label,
|
|
3353
|
-
control: /* @__PURE__ */ React72.createElement(
|
|
3354
|
-
Switch,
|
|
3355
|
-
{
|
|
3356
|
-
checked: value,
|
|
3357
|
-
onChange: (_, checked) => {
|
|
3358
|
-
setValue(checked);
|
|
3359
|
-
onChange(checked);
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
|
-
)
|
|
3363
|
-
}
|
|
3364
|
-
);
|
|
3365
|
-
}
|
|
3366
|
-
|
|
3367
|
-
// src/app/inspector-drawer/configuration-panel/input-panels/text-sidebar-panel.tsx
|
|
3368
3419
|
function TextSidebarPanel({ data, setData }) {
|
|
3369
3420
|
var _a, _b, _c, _d;
|
|
3370
3421
|
const [, setErrors] = useState(null);
|
|
@@ -3377,7 +3428,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3377
3428
|
setErrors(res.error);
|
|
3378
3429
|
}
|
|
3379
3430
|
};
|
|
3380
|
-
return /* @__PURE__ */
|
|
3431
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React60.createElement(
|
|
3381
3432
|
TextInput,
|
|
3382
3433
|
{
|
|
3383
3434
|
label: "Content",
|
|
@@ -3385,14 +3436,14 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3385
3436
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
3386
3437
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
3387
3438
|
}
|
|
3388
|
-
), /* @__PURE__ */
|
|
3439
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3389
3440
|
BooleanInput,
|
|
3390
3441
|
{
|
|
3391
3442
|
label: "Markdown",
|
|
3392
3443
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
3393
3444
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
3394
3445
|
}
|
|
3395
|
-
), /* @__PURE__ */
|
|
3446
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3396
3447
|
MultiStylePropertyPanel,
|
|
3397
3448
|
{
|
|
3398
3449
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -3404,7 +3455,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3404
3455
|
|
|
3405
3456
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
3406
3457
|
function renderMessage(val) {
|
|
3407
|
-
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));
|
|
3408
3459
|
}
|
|
3409
3460
|
function ConfigurationPanel() {
|
|
3410
3461
|
const document2 = useDocument();
|
|
@@ -3420,55 +3471,55 @@ function ConfigurationPanel() {
|
|
|
3420
3471
|
const { data, type } = block;
|
|
3421
3472
|
switch (type) {
|
|
3422
3473
|
case "Avatar":
|
|
3423
|
-
return /* @__PURE__ */
|
|
3474
|
+
return /* @__PURE__ */ React60.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3424
3475
|
case "Button":
|
|
3425
|
-
return /* @__PURE__ */
|
|
3476
|
+
return /* @__PURE__ */ React60.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3426
3477
|
case "ColumnsContainer":
|
|
3427
|
-
return /* @__PURE__ */
|
|
3478
|
+
return /* @__PURE__ */ React60.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3428
3479
|
case "Container":
|
|
3429
|
-
return /* @__PURE__ */
|
|
3480
|
+
return /* @__PURE__ */ React60.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3430
3481
|
case "Divider":
|
|
3431
|
-
return /* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ React60.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3432
3483
|
case "Heading":
|
|
3433
|
-
return /* @__PURE__ */
|
|
3484
|
+
return /* @__PURE__ */ React60.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3434
3485
|
case "Html":
|
|
3435
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ React60.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3436
3487
|
case "Image":
|
|
3437
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ React60.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3438
3489
|
case "EmailLayout":
|
|
3439
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ React60.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3440
3491
|
case "Spacer":
|
|
3441
|
-
return /* @__PURE__ */
|
|
3492
|
+
return /* @__PURE__ */ React60.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3442
3493
|
case "Signature":
|
|
3443
|
-
return /* @__PURE__ */
|
|
3494
|
+
return /* @__PURE__ */ React60.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3444
3495
|
case "Text":
|
|
3445
|
-
return /* @__PURE__ */
|
|
3496
|
+
return /* @__PURE__ */ React60.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3446
3497
|
default:
|
|
3447
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ React60.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
3448
3499
|
}
|
|
3449
3500
|
}
|
|
3450
3501
|
function StylesPanel() {
|
|
3451
3502
|
const block = useDocument().root;
|
|
3452
3503
|
if (!block) {
|
|
3453
|
-
return /* @__PURE__ */
|
|
3504
|
+
return /* @__PURE__ */ React60.createElement("p", null, "Block not found");
|
|
3454
3505
|
}
|
|
3455
3506
|
const { data, type } = block;
|
|
3456
3507
|
if (type !== "EmailLayout") {
|
|
3457
3508
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
3458
3509
|
}
|
|
3459
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ React60.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
3460
3511
|
}
|
|
3461
3512
|
function TemplateDownloadButton() {
|
|
3462
3513
|
const doc = useDocument();
|
|
3463
3514
|
const href = useMemo(() => {
|
|
3464
3515
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
3465
3516
|
}, [doc]);
|
|
3466
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3467
3518
|
Button$1,
|
|
3468
3519
|
{
|
|
3469
3520
|
variant: "outlined",
|
|
3470
3521
|
color: "primary",
|
|
3471
|
-
startIcon: /* @__PURE__ */
|
|
3522
|
+
startIcon: /* @__PURE__ */ React60.createElement(FileDownloadOutlined, null),
|
|
3472
3523
|
href,
|
|
3473
3524
|
download: "emailTemplate.json",
|
|
3474
3525
|
fullWidth: true
|
|
@@ -3500,9 +3551,9 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3500
3551
|
}
|
|
3501
3552
|
};
|
|
3502
3553
|
if (!currentTemplateId) {
|
|
3503
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ React60.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
|
|
3504
3555
|
}
|
|
3505
|
-
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(
|
|
3506
3557
|
Typography,
|
|
3507
3558
|
{
|
|
3508
3559
|
variant: "body2",
|
|
@@ -3515,29 +3566,110 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3515
3566
|
}
|
|
3516
3567
|
},
|
|
3517
3568
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
3518
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
3569
|
+
), persistenceEnabled && /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
3519
3570
|
Button$1,
|
|
3520
3571
|
{
|
|
3521
3572
|
variant: "outlined",
|
|
3522
3573
|
color: "primary",
|
|
3523
|
-
startIcon: /* @__PURE__ */
|
|
3574
|
+
startIcon: /* @__PURE__ */ React60.createElement(ContentCopyOutlined, null),
|
|
3524
3575
|
onClick: handleCopyToSamples,
|
|
3525
3576
|
fullWidth: true,
|
|
3526
3577
|
disabled: !copyTemplate
|
|
3527
3578
|
},
|
|
3528
3579
|
"Save as Sample Template"
|
|
3529
|
-
), /* @__PURE__ */
|
|
3580
|
+
), /* @__PURE__ */ React60.createElement(
|
|
3530
3581
|
Button$1,
|
|
3531
3582
|
{
|
|
3532
3583
|
variant: "outlined",
|
|
3533
3584
|
color: "error",
|
|
3534
|
-
startIcon: /* @__PURE__ */
|
|
3585
|
+
startIcon: /* @__PURE__ */ React60.createElement(DeleteOutlined, null),
|
|
3535
3586
|
onClick: handleDelete,
|
|
3536
3587
|
fullWidth: true,
|
|
3537
3588
|
disabled: !deleteTemplate
|
|
3538
3589
|
},
|
|
3539
3590
|
"Delete Template"
|
|
3540
|
-
)))), 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
|
+
})));
|
|
3541
3673
|
}
|
|
3542
3674
|
|
|
3543
3675
|
// src/app/inspector-drawer/index.tsx
|
|
@@ -3554,11 +3686,13 @@ function InspectorDrawer({
|
|
|
3554
3686
|
const renderCurrentSidebarPanel = () => {
|
|
3555
3687
|
switch (selectedSidebarTab) {
|
|
3556
3688
|
case "block-configuration":
|
|
3557
|
-
return /* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ React60.createElement(ConfigurationPanel, null);
|
|
3558
3690
|
case "styles":
|
|
3559
|
-
return /* @__PURE__ */
|
|
3691
|
+
return /* @__PURE__ */ React60.createElement(StylesPanel, null);
|
|
3692
|
+
case "variables":
|
|
3693
|
+
return /* @__PURE__ */ React60.createElement(VariablesPanel, null);
|
|
3560
3694
|
case "template-settings":
|
|
3561
|
-
return /* @__PURE__ */
|
|
3695
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3562
3696
|
TemplatePanel,
|
|
3563
3697
|
{
|
|
3564
3698
|
deleteTemplate,
|
|
@@ -3567,7 +3701,7 @@ function InspectorDrawer({
|
|
|
3567
3701
|
);
|
|
3568
3702
|
}
|
|
3569
3703
|
};
|
|
3570
|
-
return /* @__PURE__ */
|
|
3704
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3571
3705
|
Drawer,
|
|
3572
3706
|
{
|
|
3573
3707
|
variant: "persistent",
|
|
@@ -3589,236 +3723,820 @@ function InspectorDrawer({
|
|
|
3589
3723
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
3590
3724
|
}
|
|
3591
3725
|
},
|
|
3592
|
-
/* @__PURE__ */
|
|
3593
|
-
|
|
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())
|
|
3594
3740
|
);
|
|
3595
3741
|
}
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
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,
|
|
3599
3798
|
templateLoader,
|
|
3600
|
-
|
|
3799
|
+
onDuplicate,
|
|
3800
|
+
onRename,
|
|
3801
|
+
onDelete,
|
|
3802
|
+
onPromote,
|
|
3803
|
+
onDemote,
|
|
3804
|
+
onDuplicateAsTemplate
|
|
3601
3805
|
}) {
|
|
3602
3806
|
const { setCurrentTemplate } = useEmailEditor();
|
|
3603
|
-
const
|
|
3604
|
-
|
|
3807
|
+
const [hover, setHover] = useState(false);
|
|
3808
|
+
const handleClick = () => __async(null, null, function* () {
|
|
3605
3809
|
try {
|
|
3606
|
-
const
|
|
3607
|
-
if (
|
|
3608
|
-
resetDocument(
|
|
3609
|
-
setCurrentTemplate(
|
|
3810
|
+
const content = yield templateLoader();
|
|
3811
|
+
if (content) {
|
|
3812
|
+
resetDocument(content);
|
|
3813
|
+
setCurrentTemplate(template.id, template.slug, template.kind);
|
|
3610
3814
|
}
|
|
3611
3815
|
} catch (error) {
|
|
3612
3816
|
console.error("Error loading template:", error);
|
|
3613
3817
|
}
|
|
3614
3818
|
});
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
canvasColor: "#FFFFFF",
|
|
3625
|
-
textColor: "#262626",
|
|
3626
|
-
fontFamily: "MODERN_SANS",
|
|
3627
|
-
childrenIds: []
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
};
|
|
3631
|
-
var empty_email_message_default = EMPTY_EMAIL_MESSAGE;
|
|
3632
|
-
|
|
3633
|
-
// src/app/templates-drawer/index.tsx
|
|
3634
|
-
var SAMPLES_DRAWER_WIDTH = 240;
|
|
3635
|
-
var EMPTY_TEMPLATE = {
|
|
3636
|
-
id: "empty-email",
|
|
3637
|
-
name: "Empty email",
|
|
3638
|
-
description: "A blank email template to start from scratch"
|
|
3639
|
-
};
|
|
3640
|
-
function SamplesDrawer({
|
|
3641
|
-
enterDuration = 225,
|
|
3642
|
-
exitDuration = 225,
|
|
3643
|
-
enabled = true,
|
|
3644
|
-
loadSamples,
|
|
3645
|
-
loadTemplates,
|
|
3646
|
-
loadTemplate,
|
|
3647
|
-
currentTemplateId,
|
|
3648
|
-
deleteTemplate
|
|
3649
|
-
}) {
|
|
3650
|
-
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
3651
|
-
const [samples, setSamples] = useState([EMPTY_TEMPLATE]);
|
|
3652
|
-
const [templates, setTemplates] = useState([]);
|
|
3653
|
-
const [loadingSamples, setLoadingSamples] = useState(false);
|
|
3654
|
-
const [loadingTemplates, setLoadingTemplates] = useState(false);
|
|
3655
|
-
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
3656
|
-
if (templateId === "empty-email") {
|
|
3657
|
-
return empty_email_message_default;
|
|
3658
|
-
}
|
|
3659
|
-
if (loadTemplate) {
|
|
3660
|
-
return loadTemplate(templateId);
|
|
3661
|
-
}
|
|
3662
|
-
return null;
|
|
3663
|
-
});
|
|
3664
|
-
useEffect(() => {
|
|
3665
|
-
if (enabled && samplesDrawerOpen && loadSamples) {
|
|
3666
|
-
setLoadingSamples(true);
|
|
3667
|
-
loadSamples().then((results) => {
|
|
3668
|
-
const existingEmptyTemplate = results.find((sample) => sample.id === "empty-email");
|
|
3669
|
-
if (!existingEmptyTemplate) {
|
|
3670
|
-
setSamples([EMPTY_TEMPLATE, ...results]);
|
|
3671
|
-
} else {
|
|
3672
|
-
setSamples(results);
|
|
3673
|
-
}
|
|
3674
|
-
setLoadingSamples(false);
|
|
3675
|
-
}).catch((error) => {
|
|
3676
|
-
console.error("Failed to load samples:", error);
|
|
3677
|
-
setSamples([EMPTY_TEMPLATE]);
|
|
3678
|
-
setLoadingSamples(false);
|
|
3679
|
-
});
|
|
3680
|
-
}
|
|
3681
|
-
}, [enabled, samplesDrawerOpen, loadSamples]);
|
|
3682
|
-
useEffect(() => {
|
|
3683
|
-
if (enabled && loadTemplates) {
|
|
3684
|
-
setLoadingTemplates(true);
|
|
3685
|
-
loadTemplates().then((results) => {
|
|
3686
|
-
setTemplates(results);
|
|
3687
|
-
setLoadingTemplates(false);
|
|
3688
|
-
}).catch((error) => {
|
|
3689
|
-
console.error("Failed to load templates:", error);
|
|
3690
|
-
setLoadingTemplates(false);
|
|
3691
|
-
});
|
|
3692
|
-
}
|
|
3693
|
-
}, [enabled, loadTemplates]);
|
|
3694
|
-
useEffect(() => {
|
|
3695
|
-
const handleTemplateListUpdate = (e) => {
|
|
3696
|
-
setTemplates(e.detail);
|
|
3697
|
-
};
|
|
3698
|
-
window.addEventListener("templateListUpdated", handleTemplateListUpdate);
|
|
3699
|
-
return () => window.removeEventListener("templateListUpdated", handleTemplateListUpdate);
|
|
3700
|
-
}, []);
|
|
3701
|
-
if (!enabled) {
|
|
3702
|
-
return null;
|
|
3703
|
-
}
|
|
3704
|
-
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3705
|
-
Drawer,
|
|
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,
|
|
3706
3828
|
{
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
style: { position: "absolute" },
|
|
3716
|
-
keepMounted: true
|
|
3717
|
-
},
|
|
3718
|
-
transitionDuration: {
|
|
3719
|
-
enter: enterDuration,
|
|
3720
|
-
exit: exitDuration
|
|
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
|
+
}
|
|
3721
3837
|
},
|
|
3838
|
+
onMouseEnter: () => setHover(true),
|
|
3839
|
+
onMouseLeave: () => setHover(false),
|
|
3722
3840
|
sx: {
|
|
3723
|
-
|
|
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" }
|
|
3724
3850
|
}
|
|
3725
3851
|
},
|
|
3726
|
-
/* @__PURE__ */
|
|
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(
|
|
3727
3897
|
Stack,
|
|
3728
3898
|
{
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
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
|
+
}
|
|
3735
3911
|
},
|
|
3736
|
-
/* @__PURE__ */
|
|
3737
|
-
|
|
3912
|
+
onDuplicateAsTemplate && /* @__PURE__ */ React60.createElement(Tooltip, { title: "Duplicate as template" }, /* @__PURE__ */ React60.createElement(
|
|
3913
|
+
IconButton,
|
|
3738
3914
|
{
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
justifyContent: "flex-start"
|
|
3744
|
-
}
|
|
3915
|
+
size: "small",
|
|
3916
|
+
onClick: (e) => {
|
|
3917
|
+
stop(e);
|
|
3918
|
+
onDuplicateAsTemplate();
|
|
3745
3919
|
}
|
|
3746
3920
|
},
|
|
3747
|
-
/* @__PURE__ */
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
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
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
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
|
+
);
|
|
4157
|
+
}
|
|
4158
|
+
|
|
4159
|
+
// sample-templates/empty-email-message.ts
|
|
4160
|
+
var EMPTY_EMAIL_MESSAGE = {
|
|
4161
|
+
root: {
|
|
4162
|
+
type: "EmailLayout",
|
|
4163
|
+
data: {
|
|
4164
|
+
backdropColor: "#F5F5F5",
|
|
4165
|
+
canvasColor: "#FFFFFF",
|
|
4166
|
+
textColor: "#262626",
|
|
4167
|
+
fontFamily: "MODERN_SANS",
|
|
4168
|
+
childrenIds: []
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
};
|
|
4172
|
+
var empty_email_message_default = EMPTY_EMAIL_MESSAGE;
|
|
4173
|
+
|
|
4174
|
+
// src/app/templates-drawer/index.tsx
|
|
4175
|
+
var SAMPLES_DRAWER_WIDTH = 320;
|
|
4176
|
+
var EMPTY_TEMPLATE = {
|
|
4177
|
+
id: "empty-email",
|
|
4178
|
+
slug: "Empty email",
|
|
4179
|
+
kind: "sample",
|
|
4180
|
+
description: "A blank email template to start from scratch"
|
|
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
|
+
}
|
|
4198
|
+
function SamplesDrawer({
|
|
4199
|
+
enterDuration = 225,
|
|
4200
|
+
exitDuration = 225,
|
|
4201
|
+
enabled = true,
|
|
4202
|
+
loadSamples,
|
|
4203
|
+
loadTemplates,
|
|
4204
|
+
loadTemplate,
|
|
4205
|
+
currentTemplateId,
|
|
4206
|
+
deleteTemplate,
|
|
4207
|
+
copyTemplate,
|
|
4208
|
+
renameTemplate,
|
|
4209
|
+
setTemplateKind,
|
|
4210
|
+
saveAs
|
|
4211
|
+
}) {
|
|
4212
|
+
var _a;
|
|
4213
|
+
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
4214
|
+
const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
|
|
4215
|
+
const { showMessage } = useSnackbar();
|
|
4216
|
+
const [samples, setSamples] = useState([EMPTY_TEMPLATE]);
|
|
4217
|
+
const [templates, setTemplates] = useState([]);
|
|
4218
|
+
const [loadingSamples, setLoadingSamples] = useState(false);
|
|
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);
|
|
4227
|
+
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
4228
|
+
if (templateId === "empty-email") {
|
|
4229
|
+
return empty_email_message_default;
|
|
4230
|
+
}
|
|
4231
|
+
if (loadTemplate) {
|
|
4232
|
+
return loadTemplate(templateId);
|
|
4233
|
+
}
|
|
4234
|
+
return null;
|
|
4235
|
+
});
|
|
4236
|
+
const withKind = (items, fallback) => items.map((item) => item.kind ? item : __spreadProps(__spreadValues({}, item), { kind: fallback }));
|
|
4237
|
+
useEffect(() => {
|
|
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));
|
|
4248
|
+
}, [enabled, samplesDrawerOpen, loadSamples]);
|
|
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);
|
|
4261
|
+
}
|
|
4262
|
+
});
|
|
4263
|
+
useEffect(() => {
|
|
4264
|
+
if (!enabled || !loadTemplates) return;
|
|
4265
|
+
refreshTemplates();
|
|
4266
|
+
}, [enabled, loadTemplates]);
|
|
4267
|
+
useEffect(() => {
|
|
4268
|
+
const handler = (e) => {
|
|
4269
|
+
const detail = e.detail;
|
|
4270
|
+
if (Array.isArray(detail)) setTemplates(withKind(detail, "template"));
|
|
4271
|
+
};
|
|
4272
|
+
window.addEventListener("templateListUpdated", handler);
|
|
4273
|
+
return () => window.removeEventListener("templateListUpdated", handler);
|
|
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
|
+
};
|
|
4408
|
+
if (!enabled) {
|
|
4409
|
+
return null;
|
|
4410
|
+
}
|
|
4411
|
+
const existingSlugs = templates.map((t) => t.slug);
|
|
4412
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
4413
|
+
Drawer,
|
|
4414
|
+
{
|
|
4415
|
+
variant: "persistent",
|
|
4416
|
+
anchor: "left",
|
|
4417
|
+
open: samplesDrawerOpen,
|
|
4418
|
+
PaperProps: { style: { position: "absolute" } },
|
|
4419
|
+
ModalProps: {
|
|
4420
|
+
container: document.getElementById("drawer-container"),
|
|
4421
|
+
style: { position: "absolute" },
|
|
4422
|
+
keepMounted: true
|
|
4423
|
+
},
|
|
4424
|
+
transitionDuration: { enter: enterDuration, exit: exitDuration },
|
|
4425
|
+
sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
|
|
4426
|
+
},
|
|
4427
|
+
/* @__PURE__ */ React60.createElement(
|
|
4428
|
+
Stack,
|
|
4429
|
+
{
|
|
4430
|
+
py: 1,
|
|
4431
|
+
px: 2,
|
|
4432
|
+
width: SAMPLES_DRAWER_WIDTH,
|
|
4433
|
+
height: "100%",
|
|
4434
|
+
spacing: 1.5,
|
|
4435
|
+
sx: { overflowY: "auto" }
|
|
4436
|
+
},
|
|
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,
|
|
4439
|
+
{
|
|
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" }))
|
|
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)
|
|
4465
|
+
},
|
|
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"))
|
|
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
|
+
}
|
|
4525
|
+
));
|
|
4526
|
+
}
|
|
4527
|
+
var BUTTON_SX2 = { p: 1.5, display: "flex", flexDirection: "column" };
|
|
4528
|
+
var ICON_SX = {
|
|
4529
|
+
mb: 0.75,
|
|
4530
|
+
width: "100%",
|
|
4531
|
+
bgcolor: "cadet.200",
|
|
4532
|
+
display: "flex",
|
|
4533
|
+
justifyContent: "center",
|
|
4534
|
+
p: 1,
|
|
4535
|
+
border: "1px solid",
|
|
4536
|
+
borderColor: "cadet.300"
|
|
3819
4537
|
};
|
|
3820
4538
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
3821
|
-
return /* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ React60.createElement(
|
|
3822
4540
|
Button$1,
|
|
3823
4541
|
{
|
|
3824
4542
|
sx: BUTTON_SX2,
|
|
@@ -3827,14 +4545,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
3827
4545
|
onClick();
|
|
3828
4546
|
}
|
|
3829
4547
|
},
|
|
3830
|
-
/* @__PURE__ */
|
|
3831
|
-
/* @__PURE__ */
|
|
4548
|
+
/* @__PURE__ */ React60.createElement(Box, { sx: ICON_SX }, icon),
|
|
4549
|
+
/* @__PURE__ */ React60.createElement(Typography, { variant: "body2" }, label)
|
|
3832
4550
|
);
|
|
3833
4551
|
}
|
|
3834
4552
|
var BUTTONS = [
|
|
3835
4553
|
{
|
|
3836
4554
|
label: "Heading",
|
|
3837
|
-
icon: /* @__PURE__ */
|
|
4555
|
+
icon: /* @__PURE__ */ React60.createElement(HMobiledataOutlined, null),
|
|
3838
4556
|
block: () => ({
|
|
3839
4557
|
type: "Heading",
|
|
3840
4558
|
data: {
|
|
@@ -3847,11 +4565,11 @@ var BUTTONS = [
|
|
|
3847
4565
|
},
|
|
3848
4566
|
{
|
|
3849
4567
|
label: "Text",
|
|
3850
|
-
icon: /* @__PURE__ */
|
|
4568
|
+
icon: /* @__PURE__ */ React60.createElement(NotesOutlined, null),
|
|
3851
4569
|
block: () => ({
|
|
3852
4570
|
type: "Text",
|
|
3853
4571
|
data: {
|
|
3854
|
-
props: { text: "My new text block" },
|
|
4572
|
+
props: { text: "My new text block", markdown: true },
|
|
3855
4573
|
style: {
|
|
3856
4574
|
padding: { top: 16, bottom: 16, left: 24, right: 24 },
|
|
3857
4575
|
fontWeight: "normal"
|
|
@@ -3861,13 +4579,13 @@ var BUTTONS = [
|
|
|
3861
4579
|
},
|
|
3862
4580
|
{
|
|
3863
4581
|
label: "Button",
|
|
3864
|
-
icon: /* @__PURE__ */
|
|
4582
|
+
icon: /* @__PURE__ */ React60.createElement(SmartButtonOutlined, null),
|
|
3865
4583
|
block: () => ({
|
|
3866
4584
|
type: "Button",
|
|
3867
4585
|
data: {
|
|
3868
4586
|
props: {
|
|
3869
4587
|
text: "Button",
|
|
3870
|
-
url: "https://
|
|
4588
|
+
url: "https://example.com"
|
|
3871
4589
|
},
|
|
3872
4590
|
style: { padding: { top: 16, bottom: 16, left: 24, right: 24 } }
|
|
3873
4591
|
}
|
|
@@ -3875,12 +4593,12 @@ var BUTTONS = [
|
|
|
3875
4593
|
},
|
|
3876
4594
|
{
|
|
3877
4595
|
label: "Image",
|
|
3878
|
-
icon: /* @__PURE__ */
|
|
4596
|
+
icon: /* @__PURE__ */ React60.createElement(ImageOutlined, null),
|
|
3879
4597
|
block: () => ({
|
|
3880
4598
|
type: "Image",
|
|
3881
4599
|
data: {
|
|
3882
4600
|
props: {
|
|
3883
|
-
url: "https://
|
|
4601
|
+
url: "https://placehold.co/600x400/EEE/999?text=Sample+Image",
|
|
3884
4602
|
alt: "Sample product",
|
|
3885
4603
|
contentAlignment: "middle",
|
|
3886
4604
|
linkHref: null
|
|
@@ -3891,7 +4609,7 @@ var BUTTONS = [
|
|
|
3891
4609
|
},
|
|
3892
4610
|
{
|
|
3893
4611
|
label: "Avatar",
|
|
3894
|
-
icon: /* @__PURE__ */
|
|
4612
|
+
icon: /* @__PURE__ */ React60.createElement(AccountCircleOutlined, null),
|
|
3895
4613
|
block: () => ({
|
|
3896
4614
|
type: "Avatar",
|
|
3897
4615
|
data: {
|
|
@@ -3905,7 +4623,7 @@ var BUTTONS = [
|
|
|
3905
4623
|
},
|
|
3906
4624
|
{
|
|
3907
4625
|
label: "Personal Signature",
|
|
3908
|
-
icon: /* @__PURE__ */
|
|
4626
|
+
icon: /* @__PURE__ */ React60.createElement(ContactMailOutlined, null),
|
|
3909
4627
|
block: () => ({
|
|
3910
4628
|
type: "Signature",
|
|
3911
4629
|
data: {
|
|
@@ -3927,7 +4645,7 @@ var BUTTONS = [
|
|
|
3927
4645
|
},
|
|
3928
4646
|
{
|
|
3929
4647
|
label: "Company Signature",
|
|
3930
|
-
icon: /* @__PURE__ */
|
|
4648
|
+
icon: /* @__PURE__ */ React60.createElement(BusinessOutlined, null),
|
|
3931
4649
|
block: () => ({
|
|
3932
4650
|
type: "Signature",
|
|
3933
4651
|
data: {
|
|
@@ -3947,7 +4665,7 @@ var BUTTONS = [
|
|
|
3947
4665
|
},
|
|
3948
4666
|
{
|
|
3949
4667
|
label: "Divider",
|
|
3950
|
-
icon: /* @__PURE__ */
|
|
4668
|
+
icon: /* @__PURE__ */ React60.createElement(HorizontalRuleOutlined, null),
|
|
3951
4669
|
block: () => ({
|
|
3952
4670
|
type: "Divider",
|
|
3953
4671
|
data: {
|
|
@@ -3960,7 +4678,7 @@ var BUTTONS = [
|
|
|
3960
4678
|
},
|
|
3961
4679
|
{
|
|
3962
4680
|
label: "Spacer",
|
|
3963
|
-
icon: /* @__PURE__ */
|
|
4681
|
+
icon: /* @__PURE__ */ React60.createElement(Crop32Outlined, null),
|
|
3964
4682
|
block: () => ({
|
|
3965
4683
|
type: "Spacer",
|
|
3966
4684
|
data: {}
|
|
@@ -3968,7 +4686,7 @@ var BUTTONS = [
|
|
|
3968
4686
|
},
|
|
3969
4687
|
{
|
|
3970
4688
|
label: "Html",
|
|
3971
|
-
icon: /* @__PURE__ */
|
|
4689
|
+
icon: /* @__PURE__ */ React60.createElement(HtmlOutlined, null),
|
|
3972
4690
|
block: () => ({
|
|
3973
4691
|
type: "Html",
|
|
3974
4692
|
data: {
|
|
@@ -3983,7 +4701,7 @@ var BUTTONS = [
|
|
|
3983
4701
|
},
|
|
3984
4702
|
{
|
|
3985
4703
|
label: "Columns",
|
|
3986
|
-
icon: /* @__PURE__ */
|
|
4704
|
+
icon: /* @__PURE__ */ React60.createElement(ViewColumnOutlined, null),
|
|
3987
4705
|
block: () => ({
|
|
3988
4706
|
type: "ColumnsContainer",
|
|
3989
4707
|
data: {
|
|
@@ -3998,7 +4716,7 @@ var BUTTONS = [
|
|
|
3998
4716
|
},
|
|
3999
4717
|
{
|
|
4000
4718
|
label: "Container",
|
|
4001
|
-
icon: /* @__PURE__ */
|
|
4719
|
+
icon: /* @__PURE__ */ React60.createElement(LibraryAddOutlined, null),
|
|
4002
4720
|
block: () => ({
|
|
4003
4721
|
type: "Container",
|
|
4004
4722
|
data: {
|
|
@@ -4022,7 +4740,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4022
4740
|
if (anchorEl === null) {
|
|
4023
4741
|
return null;
|
|
4024
4742
|
}
|
|
4025
|
-
return /* @__PURE__ */
|
|
4743
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4026
4744
|
Menu,
|
|
4027
4745
|
{
|
|
4028
4746
|
open: true,
|
|
@@ -4031,7 +4749,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4031
4749
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
4032
4750
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
4033
4751
|
},
|
|
4034
|
-
/* @__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()) })))
|
|
4035
4753
|
);
|
|
4036
4754
|
}
|
|
4037
4755
|
function DividerButton({ buttonElement, onClick }) {
|
|
@@ -4058,7 +4776,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4058
4776
|
window.removeEventListener("mousemove", listener);
|
|
4059
4777
|
};
|
|
4060
4778
|
}, [buttonElement, setVisible]);
|
|
4061
|
-
return /* @__PURE__ */
|
|
4779
|
+
return /* @__PURE__ */ React60.createElement(Fade, { in: visible }, /* @__PURE__ */ React60.createElement(
|
|
4062
4780
|
IconButton,
|
|
4063
4781
|
{
|
|
4064
4782
|
size: "small",
|
|
@@ -4081,11 +4799,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4081
4799
|
onClick();
|
|
4082
4800
|
}
|
|
4083
4801
|
},
|
|
4084
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ React60.createElement(AddOutlined, { fontSize: "small" })
|
|
4085
4803
|
));
|
|
4086
4804
|
}
|
|
4087
4805
|
function PlaceholderButton({ onClick }) {
|
|
4088
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4089
4807
|
ButtonBase,
|
|
4090
4808
|
{
|
|
4091
4809
|
onClick: (ev) => {
|
|
@@ -4101,7 +4819,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
4101
4819
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
4102
4820
|
}
|
|
4103
4821
|
},
|
|
4104
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ React60.createElement(
|
|
4105
4823
|
AddOutlined,
|
|
4106
4824
|
{
|
|
4107
4825
|
sx: {
|
|
@@ -4125,12 +4843,12 @@ function AddBlockButton({ onSelect, placeholder }) {
|
|
|
4125
4843
|
};
|
|
4126
4844
|
const renderButton2 = () => {
|
|
4127
4845
|
if (placeholder) {
|
|
4128
|
-
return /* @__PURE__ */
|
|
4846
|
+
return /* @__PURE__ */ React60.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
4129
4847
|
} else {
|
|
4130
|
-
return /* @__PURE__ */
|
|
4848
|
+
return /* @__PURE__ */ React60.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
4131
4849
|
}
|
|
4132
4850
|
};
|
|
4133
|
-
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 }));
|
|
4134
4852
|
}
|
|
4135
4853
|
|
|
4136
4854
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -4157,9 +4875,9 @@ function EditorChildrenIds({ childrenIds, onChange }) {
|
|
|
4157
4875
|
});
|
|
4158
4876
|
};
|
|
4159
4877
|
if (!childrenIds || childrenIds.length === 0) {
|
|
4160
|
-
return /* @__PURE__ */
|
|
4878
|
+
return /* @__PURE__ */ React60.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
|
|
4161
4879
|
}
|
|
4162
|
-
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 }));
|
|
4163
4881
|
}
|
|
4164
4882
|
|
|
4165
4883
|
// src/editor/blocks/columns-container/columns-container-editor.tsx
|
|
@@ -4186,15 +4904,15 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
4186
4904
|
});
|
|
4187
4905
|
setSelectedBlockId(blockId);
|
|
4188
4906
|
};
|
|
4189
|
-
return /* @__PURE__ */
|
|
4907
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4190
4908
|
columns_container_default,
|
|
4191
4909
|
{
|
|
4192
4910
|
props: restProps,
|
|
4193
4911
|
style,
|
|
4194
4912
|
columns: [
|
|
4195
|
-
/* @__PURE__ */
|
|
4196
|
-
/* @__PURE__ */
|
|
4197
|
-
/* @__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) })
|
|
4198
4916
|
]
|
|
4199
4917
|
}
|
|
4200
4918
|
);
|
|
@@ -4204,7 +4922,7 @@ function ContainerEditor({ style, props }) {
|
|
|
4204
4922
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
4205
4923
|
const document2 = useDocument();
|
|
4206
4924
|
const currentBlockId = useCurrentBlockId();
|
|
4207
|
-
return /* @__PURE__ */
|
|
4925
|
+
return /* @__PURE__ */ React60.createElement(container_default, { style }, /* @__PURE__ */ React60.createElement(
|
|
4208
4926
|
EditorChildrenIds,
|
|
4209
4927
|
{
|
|
4210
4928
|
childrenIds,
|
|
@@ -4395,27 +5113,64 @@ function EmailLayoutEditor(props) {
|
|
|
4395
5113
|
window.removeEventListener("paste", handlePaste);
|
|
4396
5114
|
};
|
|
4397
5115
|
}, [handleDelete, handleCopy, handlePaste]);
|
|
4398
|
-
|
|
5116
|
+
const baseStyle = {
|
|
5117
|
+
color: (_b = props.textColor) != null ? _b : "#262626",
|
|
5118
|
+
fontFamily: getFontFamily7(props.fontFamily),
|
|
5119
|
+
fontSize: "16px",
|
|
5120
|
+
fontWeight: "400",
|
|
5121
|
+
letterSpacing: "0.15008px",
|
|
5122
|
+
lineHeight: "1.5",
|
|
5123
|
+
margin: "0"
|
|
5124
|
+
};
|
|
5125
|
+
const editorChildren = /* @__PURE__ */ React60.createElement(
|
|
5126
|
+
EditorChildrenIds,
|
|
5127
|
+
{
|
|
5128
|
+
childrenIds,
|
|
5129
|
+
onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
|
|
5130
|
+
setDocument({
|
|
5131
|
+
[blockId]: block,
|
|
5132
|
+
[currentBlockId]: {
|
|
5133
|
+
type: "EmailLayout",
|
|
5134
|
+
data: __spreadProps(__spreadValues({}, document2[currentBlockId].data), {
|
|
5135
|
+
childrenIds: childrenIds2
|
|
5136
|
+
})
|
|
5137
|
+
}
|
|
5138
|
+
});
|
|
5139
|
+
setSelectedBlockId(blockId);
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
);
|
|
5143
|
+
if (props.backdropDisabled) {
|
|
5144
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5145
|
+
"div",
|
|
5146
|
+
{
|
|
5147
|
+
onClick: () => {
|
|
5148
|
+
setSelectedBlockId(null);
|
|
5149
|
+
},
|
|
5150
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
5151
|
+
backgroundColor: "#F5F5F5",
|
|
5152
|
+
padding: "32px",
|
|
5153
|
+
width: "100%",
|
|
5154
|
+
minHeight: "100%"
|
|
5155
|
+
})
|
|
5156
|
+
},
|
|
5157
|
+
/* @__PURE__ */ React60.createElement("div", { style: { maxWidth: "600px" } }, editorChildren)
|
|
5158
|
+
);
|
|
5159
|
+
}
|
|
5160
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4399
5161
|
"div",
|
|
4400
5162
|
{
|
|
4401
5163
|
onClick: () => {
|
|
4402
5164
|
setSelectedBlockId(null);
|
|
4403
5165
|
},
|
|
4404
|
-
style: {
|
|
4405
|
-
backgroundColor: (
|
|
4406
|
-
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
4407
|
-
fontFamily: getFontFamily7(props.fontFamily),
|
|
4408
|
-
fontSize: "16px",
|
|
4409
|
-
fontWeight: "400",
|
|
4410
|
-
letterSpacing: "0.15008px",
|
|
4411
|
-
lineHeight: "1.5",
|
|
4412
|
-
margin: "0",
|
|
5166
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
5167
|
+
backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
|
|
4413
5168
|
padding: "32px 0",
|
|
4414
5169
|
width: "100%",
|
|
4415
5170
|
minHeight: "100%"
|
|
4416
|
-
}
|
|
5171
|
+
})
|
|
4417
5172
|
},
|
|
4418
|
-
/* @__PURE__ */
|
|
5173
|
+
/* @__PURE__ */ React60.createElement(
|
|
4419
5174
|
"table",
|
|
4420
5175
|
{
|
|
4421
5176
|
align: "center",
|
|
@@ -4425,6 +5180,7 @@ function EmailLayoutEditor(props) {
|
|
|
4425
5180
|
maxWidth: "600px",
|
|
4426
5181
|
backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
|
|
4427
5182
|
borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
|
|
5183
|
+
overflow: props.borderRadius ? "hidden" : void 0,
|
|
4428
5184
|
border: (() => {
|
|
4429
5185
|
const v = props.borderColor;
|
|
4430
5186
|
if (!v) {
|
|
@@ -4438,24 +5194,7 @@ function EmailLayoutEditor(props) {
|
|
|
4438
5194
|
cellPadding: "0",
|
|
4439
5195
|
border: 0
|
|
4440
5196
|
},
|
|
4441
|
-
/* @__PURE__ */
|
|
4442
|
-
EditorChildrenIds,
|
|
4443
|
-
{
|
|
4444
|
-
childrenIds,
|
|
4445
|
-
onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
|
|
4446
|
-
setDocument({
|
|
4447
|
-
[blockId]: block,
|
|
4448
|
-
[currentBlockId]: {
|
|
4449
|
-
type: "EmailLayout",
|
|
4450
|
-
data: __spreadProps(__spreadValues({}, document2[currentBlockId].data), {
|
|
4451
|
-
childrenIds: childrenIds2
|
|
4452
|
-
})
|
|
4453
|
-
}
|
|
4454
|
-
});
|
|
4455
|
-
setSelectedBlockId(blockId);
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
))))
|
|
5197
|
+
/* @__PURE__ */ React60.createElement("tbody", null, /* @__PURE__ */ React60.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60.createElement("td", null, editorChildren)))
|
|
4459
5198
|
)
|
|
4460
5199
|
);
|
|
4461
5200
|
}
|
|
@@ -4614,7 +5353,7 @@ function TuneMenu({ blockId }) {
|
|
|
4614
5353
|
resetDocument(nDocument);
|
|
4615
5354
|
setSelectedBlockId(blockId);
|
|
4616
5355
|
};
|
|
4617
|
-
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" })))));
|
|
4618
5357
|
}
|
|
4619
5358
|
|
|
4620
5359
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
@@ -4632,9 +5371,9 @@ function EditorBlockWrapper({ children }) {
|
|
|
4632
5371
|
if (selectedBlockId !== blockId) {
|
|
4633
5372
|
return null;
|
|
4634
5373
|
}
|
|
4635
|
-
return /* @__PURE__ */
|
|
5374
|
+
return /* @__PURE__ */ React60.createElement(TuneMenu, { blockId });
|
|
4636
5375
|
};
|
|
4637
|
-
return /* @__PURE__ */
|
|
5376
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4638
5377
|
Box,
|
|
4639
5378
|
{
|
|
4640
5379
|
sx: {
|
|
@@ -4764,7 +5503,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4764
5503
|
width: fullWidth ? "100%" : void 0,
|
|
4765
5504
|
textAlign: "center"
|
|
4766
5505
|
});
|
|
4767
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60.createElement(
|
|
4768
5507
|
"input",
|
|
4769
5508
|
{
|
|
4770
5509
|
type: "text",
|
|
@@ -4775,7 +5514,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4775
5514
|
}
|
|
4776
5515
|
));
|
|
4777
5516
|
}
|
|
4778
|
-
return /* @__PURE__ */
|
|
5517
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60.createElement("span", { style: linkStyle }, /* @__PURE__ */ React60.createElement("span", null, text)));
|
|
4779
5518
|
}
|
|
4780
5519
|
function getFontFamily9(fontFamily) {
|
|
4781
5520
|
switch (fontFamily) {
|
|
@@ -4898,7 +5637,7 @@ function HeadingEditor({ style, props }) {
|
|
|
4898
5637
|
}
|
|
4899
5638
|
};
|
|
4900
5639
|
if (isSelected) {
|
|
4901
|
-
return /* @__PURE__ */
|
|
5640
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4902
5641
|
"textarea",
|
|
4903
5642
|
{
|
|
4904
5643
|
value: localText,
|
|
@@ -4913,11 +5652,11 @@ function HeadingEditor({ style, props }) {
|
|
|
4913
5652
|
}
|
|
4914
5653
|
switch (level) {
|
|
4915
5654
|
case "h1":
|
|
4916
|
-
return /* @__PURE__ */
|
|
5655
|
+
return /* @__PURE__ */ React60.createElement("h1", { style: hStyle }, textContent);
|
|
4917
5656
|
case "h2":
|
|
4918
|
-
return /* @__PURE__ */
|
|
5657
|
+
return /* @__PURE__ */ React60.createElement("h2", { style: hStyle }, textContent);
|
|
4919
5658
|
case "h3":
|
|
4920
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ React60.createElement("h3", { style: hStyle }, textContent);
|
|
4921
5660
|
}
|
|
4922
5661
|
}
|
|
4923
5662
|
function HtmlEditor({ style, props }) {
|
|
@@ -4972,7 +5711,7 @@ function HtmlEditor({ style, props }) {
|
|
|
4972
5711
|
margin: 0,
|
|
4973
5712
|
backgroundColor: "transparent"
|
|
4974
5713
|
});
|
|
4975
|
-
return /* @__PURE__ */
|
|
5714
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle }, /* @__PURE__ */ React60.createElement(
|
|
4976
5715
|
"textarea",
|
|
4977
5716
|
{
|
|
4978
5717
|
value: localContents,
|
|
@@ -4986,9 +5725,9 @@ function HtmlEditor({ style, props }) {
|
|
|
4986
5725
|
));
|
|
4987
5726
|
}
|
|
4988
5727
|
if (!contents) {
|
|
4989
|
-
return /* @__PURE__ */
|
|
5728
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle });
|
|
4990
5729
|
}
|
|
4991
|
-
return /* @__PURE__ */
|
|
5730
|
+
return /* @__PURE__ */ React60.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
4992
5731
|
}
|
|
4993
5732
|
function getImageBorderRadius2(shape, size) {
|
|
4994
5733
|
switch (shape) {
|
|
@@ -5103,7 +5842,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5103
5842
|
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
5104
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
|
|
5105
5844
|
};
|
|
5106
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
5845
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React60.createElement(
|
|
5107
5846
|
"img",
|
|
5108
5847
|
{
|
|
5109
5848
|
src: imageUrl,
|
|
@@ -5121,7 +5860,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5121
5860
|
}
|
|
5122
5861
|
}
|
|
5123
5862
|
) : null;
|
|
5124
|
-
const greetingElement = isSelected ? /* @__PURE__ */
|
|
5863
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React60.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React60.createElement(
|
|
5125
5864
|
"input",
|
|
5126
5865
|
{
|
|
5127
5866
|
value: localGreeting,
|
|
@@ -5132,8 +5871,8 @@ function SignatureEditor({ style, props }) {
|
|
|
5132
5871
|
placeholder: "Greeting (e.g. Best regards,)",
|
|
5133
5872
|
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
5134
5873
|
}
|
|
5135
|
-
)) : greeting ? /* @__PURE__ */
|
|
5136
|
-
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(
|
|
5137
5876
|
"input",
|
|
5138
5877
|
{
|
|
5139
5878
|
value: localName,
|
|
@@ -5144,7 +5883,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5144
5883
|
placeholder: "Name",
|
|
5145
5884
|
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
5146
5885
|
}
|
|
5147
|
-
), /* @__PURE__ */
|
|
5886
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5148
5887
|
"input",
|
|
5149
5888
|
{
|
|
5150
5889
|
value: localTitle,
|
|
@@ -5155,7 +5894,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5155
5894
|
placeholder: "Title",
|
|
5156
5895
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5157
5896
|
}
|
|
5158
|
-
), /* @__PURE__ */
|
|
5897
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5159
5898
|
"input",
|
|
5160
5899
|
{
|
|
5161
5900
|
value: localCompany,
|
|
@@ -5166,7 +5905,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5166
5905
|
placeholder: "Company",
|
|
5167
5906
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5168
5907
|
}
|
|
5169
|
-
), /* @__PURE__ */
|
|
5908
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5170
5909
|
"input",
|
|
5171
5910
|
{
|
|
5172
5911
|
value: localAddress,
|
|
@@ -5177,7 +5916,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5177
5916
|
placeholder: "Address",
|
|
5178
5917
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5179
5918
|
}
|
|
5180
|
-
), /* @__PURE__ */
|
|
5919
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5181
5920
|
"input",
|
|
5182
5921
|
{
|
|
5183
5922
|
value: localEmail,
|
|
@@ -5188,7 +5927,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5188
5927
|
placeholder: "Email",
|
|
5189
5928
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
5190
5929
|
}
|
|
5191
|
-
), /* @__PURE__ */
|
|
5930
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5192
5931
|
"input",
|
|
5193
5932
|
{
|
|
5194
5933
|
value: localPhone,
|
|
@@ -5199,7 +5938,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5199
5938
|
placeholder: "Phone",
|
|
5200
5939
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5201
5940
|
}
|
|
5202
|
-
), /* @__PURE__ */
|
|
5941
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5203
5942
|
"input",
|
|
5204
5943
|
{
|
|
5205
5944
|
value: localWebsite,
|
|
@@ -5210,11 +5949,11 @@ function SignatureEditor({ style, props }) {
|
|
|
5210
5949
|
placeholder: "Website",
|
|
5211
5950
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5212
5951
|
}
|
|
5213
|
-
)) : /* @__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"));
|
|
5214
5953
|
if (layout === "vertical") {
|
|
5215
|
-
return /* @__PURE__ */
|
|
5954
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React60.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
5216
5955
|
}
|
|
5217
|
-
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)))));
|
|
5218
5957
|
}
|
|
5219
5958
|
function getFontFamily10(fontFamily) {
|
|
5220
5959
|
switch (fontFamily) {
|
|
@@ -5328,8 +6067,8 @@ function TextEditor({ style, props }) {
|
|
|
5328
6067
|
element.style.height = `${element.scrollHeight}px`;
|
|
5329
6068
|
}
|
|
5330
6069
|
};
|
|
5331
|
-
if (isSelected
|
|
5332
|
-
return /* @__PURE__ */
|
|
6070
|
+
if (isSelected) {
|
|
6071
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5333
6072
|
"textarea",
|
|
5334
6073
|
{
|
|
5335
6074
|
value: localText,
|
|
@@ -5343,36 +6082,36 @@ function TextEditor({ style, props }) {
|
|
|
5343
6082
|
);
|
|
5344
6083
|
}
|
|
5345
6084
|
if (isMarkdown) {
|
|
5346
|
-
return /* @__PURE__ */
|
|
6085
|
+
return /* @__PURE__ */ React60.createElement(EmailMarkdown, { style: wStyle, markdown: textContent });
|
|
5347
6086
|
}
|
|
5348
|
-
return /* @__PURE__ */
|
|
6087
|
+
return /* @__PURE__ */ React60.createElement("div", { style: wStyle }, textContent);
|
|
5349
6088
|
}
|
|
5350
6089
|
|
|
5351
6090
|
// src/editor/core.tsx
|
|
5352
6091
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
5353
6092
|
Avatar: {
|
|
5354
6093
|
schema: AvatarPropsSchema,
|
|
5355
|
-
Component: (props) => /* @__PURE__ */
|
|
6094
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(avatar_default, __spreadValues({}, props)))
|
|
5356
6095
|
},
|
|
5357
6096
|
Button: {
|
|
5358
6097
|
schema: ButtonPropsSchema,
|
|
5359
|
-
Component: (props) => /* @__PURE__ */
|
|
6098
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
5360
6099
|
},
|
|
5361
6100
|
Container: {
|
|
5362
6101
|
schema: container_props_schema_default,
|
|
5363
|
-
Component: (props) => /* @__PURE__ */
|
|
6102
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
5364
6103
|
},
|
|
5365
6104
|
ColumnsContainer: {
|
|
5366
6105
|
schema: columns_container_props_schema_default2,
|
|
5367
|
-
Component: (props) => /* @__PURE__ */
|
|
6106
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
5368
6107
|
},
|
|
5369
6108
|
Heading: {
|
|
5370
6109
|
schema: HeadingPropsSchema,
|
|
5371
|
-
Component: (props) => /* @__PURE__ */
|
|
6110
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
5372
6111
|
},
|
|
5373
6112
|
Html: {
|
|
5374
6113
|
schema: HtmlPropsSchema,
|
|
5375
|
-
Component: (props) => /* @__PURE__ */
|
|
6114
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
5376
6115
|
},
|
|
5377
6116
|
Image: {
|
|
5378
6117
|
schema: ImagePropsSchema,
|
|
@@ -5384,28 +6123,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
5384
6123
|
linkHref: null
|
|
5385
6124
|
})
|
|
5386
6125
|
});
|
|
5387
|
-
return /* @__PURE__ */
|
|
6126
|
+
return /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(image_default, __spreadValues({}, props)));
|
|
5388
6127
|
}
|
|
5389
6128
|
},
|
|
5390
6129
|
Text: {
|
|
5391
6130
|
schema: TextPropsSchema,
|
|
5392
|
-
Component: (props) => /* @__PURE__ */
|
|
6131
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(TextEditor, __spreadValues({}, props)))
|
|
5393
6132
|
},
|
|
5394
6133
|
EmailLayout: {
|
|
5395
6134
|
schema: email_layout_props_schema_default,
|
|
5396
|
-
Component: (p) => /* @__PURE__ */
|
|
6135
|
+
Component: (p) => /* @__PURE__ */ React60.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
5397
6136
|
},
|
|
5398
6137
|
Spacer: {
|
|
5399
6138
|
schema: SpacerPropsSchema,
|
|
5400
|
-
Component: (props) => /* @__PURE__ */
|
|
6139
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(spacer_default, __spreadValues({}, props)))
|
|
5401
6140
|
},
|
|
5402
6141
|
Divider: {
|
|
5403
6142
|
schema: DividerPropsSchema,
|
|
5404
|
-
Component: (props) => /* @__PURE__ */
|
|
6143
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(divider_default, __spreadValues({}, props)))
|
|
5405
6144
|
},
|
|
5406
6145
|
Signature: {
|
|
5407
6146
|
schema: SignaturePropsSchema,
|
|
5408
|
-
Component: (props) => /* @__PURE__ */
|
|
6147
|
+
Component: (props) => /* @__PURE__ */ React60.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
5409
6148
|
}
|
|
5410
6149
|
});
|
|
5411
6150
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -5421,7 +6160,7 @@ function EditorBlock({ id }) {
|
|
|
5421
6160
|
if (!block) {
|
|
5422
6161
|
throw new Error("Could not find block");
|
|
5423
6162
|
}
|
|
5424
|
-
return /* @__PURE__ */
|
|
6163
|
+
return /* @__PURE__ */ React60.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React60.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
5425
6164
|
}
|
|
5426
6165
|
function ToggleInspectorPanelButton() {
|
|
5427
6166
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -5429,20 +6168,20 @@ function ToggleInspectorPanelButton() {
|
|
|
5429
6168
|
toggleInspectorDrawerOpen();
|
|
5430
6169
|
};
|
|
5431
6170
|
if (inspectorDrawerOpen) {
|
|
5432
|
-
return /* @__PURE__ */
|
|
6171
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React60.createElement(LastPageOutlined, { fontSize: "small" }));
|
|
5433
6172
|
}
|
|
5434
|
-
return /* @__PURE__ */
|
|
6173
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React60.createElement(AppRegistrationOutlined, { fontSize: "small" }));
|
|
5435
6174
|
}
|
|
5436
6175
|
function useIcon() {
|
|
5437
6176
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
5438
6177
|
if (samplesDrawerOpen) {
|
|
5439
|
-
return /* @__PURE__ */
|
|
6178
|
+
return /* @__PURE__ */ React60.createElement(FirstPageOutlined, { fontSize: "small" });
|
|
5440
6179
|
}
|
|
5441
|
-
return /* @__PURE__ */
|
|
6180
|
+
return /* @__PURE__ */ React60.createElement(MenuOutlined, { fontSize: "small" });
|
|
5442
6181
|
}
|
|
5443
6182
|
function ToggleSamplesPanelButton() {
|
|
5444
6183
|
const icon = useIcon();
|
|
5445
|
-
return /* @__PURE__ */
|
|
6184
|
+
return /* @__PURE__ */ React60.createElement(IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
5446
6185
|
}
|
|
5447
6186
|
function formatHtml(html2, spaces = 2) {
|
|
5448
6187
|
try {
|
|
@@ -5504,7 +6243,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5504
6243
|
if (code === null) {
|
|
5505
6244
|
return null;
|
|
5506
6245
|
}
|
|
5507
|
-
return /* @__PURE__ */
|
|
6246
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5508
6247
|
"pre",
|
|
5509
6248
|
{
|
|
5510
6249
|
style: {
|
|
@@ -5530,17 +6269,17 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5530
6269
|
function HtmlPanel() {
|
|
5531
6270
|
const document2 = useDocument();
|
|
5532
6271
|
const code = useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
5533
|
-
return /* @__PURE__ */
|
|
6272
|
+
return /* @__PURE__ */ React60.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
5534
6273
|
}
|
|
5535
6274
|
function JsonPanel() {
|
|
5536
6275
|
const document2 = useDocument();
|
|
5537
6276
|
const code = useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
5538
|
-
return /* @__PURE__ */
|
|
6277
|
+
return /* @__PURE__ */ React60.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
5539
6278
|
}
|
|
5540
6279
|
function TextPanel() {
|
|
5541
6280
|
const document2 = useDocument();
|
|
5542
6281
|
const text = useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
5543
|
-
return /* @__PURE__ */
|
|
6282
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5544
6283
|
"pre",
|
|
5545
6284
|
{
|
|
5546
6285
|
style: {
|
|
@@ -5576,185 +6315,47 @@ function MainTabsGroup() {
|
|
|
5576
6315
|
setSelectedMainTab("editor");
|
|
5577
6316
|
}
|
|
5578
6317
|
};
|
|
5579
|
-
return /* @__PURE__ */
|
|
6318
|
+
return /* @__PURE__ */ React60.createElement(Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React60.createElement(
|
|
5580
6319
|
Tab,
|
|
5581
6320
|
{
|
|
5582
6321
|
value: "editor",
|
|
5583
|
-
label: /* @__PURE__ */
|
|
6322
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Edit" }, /* @__PURE__ */ React60.createElement(EditOutlined, { fontSize: "small" }))
|
|
5584
6323
|
}
|
|
5585
|
-
), /* @__PURE__ */
|
|
6324
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5586
6325
|
Tab,
|
|
5587
6326
|
{
|
|
5588
6327
|
value: "preview",
|
|
5589
|
-
label: /* @__PURE__ */
|
|
6328
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Preview" }, /* @__PURE__ */ React60.createElement(PreviewOutlined, { fontSize: "small" }))
|
|
5590
6329
|
}
|
|
5591
|
-
), /* @__PURE__ */
|
|
6330
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5592
6331
|
Tab,
|
|
5593
6332
|
{
|
|
5594
6333
|
value: "html",
|
|
5595
|
-
label: /* @__PURE__ */
|
|
6334
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "HTML output" }, /* @__PURE__ */ React60.createElement(CodeOutlined, { fontSize: "small" }))
|
|
5596
6335
|
}
|
|
5597
|
-
), /* @__PURE__ */
|
|
6336
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5598
6337
|
Tab,
|
|
5599
6338
|
{
|
|
5600
6339
|
value: "text",
|
|
5601
|
-
label: /* @__PURE__ */
|
|
6340
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React60.createElement(SubjectOutlined, { fontSize: "small" }))
|
|
5602
6341
|
}
|
|
5603
|
-
), /* @__PURE__ */
|
|
6342
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5604
6343
|
Tab,
|
|
5605
6344
|
{
|
|
5606
6345
|
value: "json",
|
|
5607
|
-
label: /* @__PURE__ */
|
|
5608
|
-
}
|
|
5609
|
-
));
|
|
5610
|
-
}
|
|
5611
|
-
var SnackbarContext = createContext(null);
|
|
5612
|
-
function useSnackbar() {
|
|
5613
|
-
const context = useContext(SnackbarContext);
|
|
5614
|
-
if (!context) {
|
|
5615
|
-
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
5616
|
-
}
|
|
5617
|
-
return context;
|
|
5618
|
-
}
|
|
5619
|
-
function SnackbarProvider({ children }) {
|
|
5620
|
-
const [message, setMessage] = useState(null);
|
|
5621
|
-
const [duration, setDuration] = useState(3e3);
|
|
5622
|
-
const showMessage = (text, customDuration = 3e3) => {
|
|
5623
|
-
setMessage(text);
|
|
5624
|
-
setDuration(customDuration);
|
|
5625
|
-
};
|
|
5626
|
-
const handleClose = () => {
|
|
5627
|
-
setMessage(null);
|
|
5628
|
-
};
|
|
5629
|
-
return /* @__PURE__ */ React72.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React72.createElement(
|
|
5630
|
-
Snackbar,
|
|
5631
|
-
{
|
|
5632
|
-
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
5633
|
-
open: message !== null,
|
|
5634
|
-
onClose: handleClose,
|
|
5635
|
-
message,
|
|
5636
|
-
autoHideDuration: duration,
|
|
5637
|
-
sx: {
|
|
5638
|
-
zIndex: 1e4,
|
|
5639
|
-
// Very high z-index
|
|
5640
|
-
position: "fixed"
|
|
5641
|
-
// Make sure it's fixed positioned
|
|
5642
|
-
}
|
|
6346
|
+
label: /* @__PURE__ */ React60.createElement(Tooltip, { title: "JSON output" }, /* @__PURE__ */ React60.createElement(DataObjectOutlined, { fontSize: "small" }))
|
|
5643
6347
|
}
|
|
5644
6348
|
));
|
|
5645
6349
|
}
|
|
5646
|
-
function SaveTemplateDialog({
|
|
5647
|
-
open,
|
|
5648
|
-
onClose,
|
|
5649
|
-
onSave,
|
|
5650
|
-
onNameChange,
|
|
5651
|
-
defaultName = "",
|
|
5652
|
-
error: externalError = null
|
|
5653
|
-
}) {
|
|
5654
|
-
const [templateName, setTemplateName] = useState(defaultName);
|
|
5655
|
-
const [internalError, setInternalError] = useState("");
|
|
5656
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
5657
|
-
useEffect(() => {
|
|
5658
|
-
if (open) {
|
|
5659
|
-
setTemplateName(defaultName);
|
|
5660
|
-
setInternalError("");
|
|
5661
|
-
setIsSubmitting(false);
|
|
5662
|
-
}
|
|
5663
|
-
}, [open, defaultName]);
|
|
5664
|
-
const displayError = externalError || internalError;
|
|
5665
|
-
const handleNameChange = (e) => {
|
|
5666
|
-
setTemplateName(e.target.value);
|
|
5667
|
-
if (e.target.value.trim()) {
|
|
5668
|
-
setInternalError("");
|
|
5669
|
-
}
|
|
5670
|
-
if (onNameChange) {
|
|
5671
|
-
onNameChange();
|
|
5672
|
-
}
|
|
5673
|
-
};
|
|
5674
|
-
const handleSave = () => __async(null, null, function* () {
|
|
5675
|
-
if (!templateName.trim()) {
|
|
5676
|
-
setInternalError("Please enter a template name");
|
|
5677
|
-
return;
|
|
5678
|
-
}
|
|
5679
|
-
setIsSubmitting(true);
|
|
5680
|
-
try {
|
|
5681
|
-
const result = onSave(templateName);
|
|
5682
|
-
if (result instanceof Promise) {
|
|
5683
|
-
const success = yield result;
|
|
5684
|
-
if (success) {
|
|
5685
|
-
setTemplateName("");
|
|
5686
|
-
setInternalError("");
|
|
5687
|
-
onClose();
|
|
5688
|
-
}
|
|
5689
|
-
} else if (result !== false) {
|
|
5690
|
-
setTemplateName("");
|
|
5691
|
-
setInternalError("");
|
|
5692
|
-
onClose();
|
|
5693
|
-
}
|
|
5694
|
-
} catch (error) {
|
|
5695
|
-
console.error("Error saving template:", error);
|
|
5696
|
-
} finally {
|
|
5697
|
-
setIsSubmitting(false);
|
|
5698
|
-
}
|
|
5699
|
-
});
|
|
5700
|
-
const handleCancel = () => {
|
|
5701
|
-
setTemplateName("");
|
|
5702
|
-
setInternalError("");
|
|
5703
|
-
onClose();
|
|
5704
|
-
};
|
|
5705
|
-
return /* @__PURE__ */ React72.createElement(
|
|
5706
|
-
Dialog,
|
|
5707
|
-
{
|
|
5708
|
-
open,
|
|
5709
|
-
onClose: handleCancel,
|
|
5710
|
-
maxWidth: "sm",
|
|
5711
|
-
fullWidth: true
|
|
5712
|
-
},
|
|
5713
|
-
/* @__PURE__ */ React72.createElement(DialogTitle, null, "Save Email Template"),
|
|
5714
|
-
/* @__PURE__ */ React72.createElement(DialogContent, null, /* @__PURE__ */ React72.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React72.createElement(
|
|
5715
|
-
TextField,
|
|
5716
|
-
{
|
|
5717
|
-
autoFocus: true,
|
|
5718
|
-
margin: "dense",
|
|
5719
|
-
id: "template-name",
|
|
5720
|
-
label: "Template Name",
|
|
5721
|
-
type: "text",
|
|
5722
|
-
fullWidth: true,
|
|
5723
|
-
variant: "outlined",
|
|
5724
|
-
value: templateName,
|
|
5725
|
-
onChange: handleNameChange,
|
|
5726
|
-
error: !!displayError,
|
|
5727
|
-
helperText: displayError,
|
|
5728
|
-
onKeyPress: (e) => {
|
|
5729
|
-
if (e.key === "Enter" && templateName.trim() && !displayError && !isSubmitting) {
|
|
5730
|
-
handleSave();
|
|
5731
|
-
}
|
|
5732
|
-
},
|
|
5733
|
-
disabled: isSubmitting
|
|
5734
|
-
}
|
|
5735
|
-
))),
|
|
5736
|
-
/* @__PURE__ */ React72.createElement(DialogActions, null, /* @__PURE__ */ React72.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React72.createElement(
|
|
5737
|
-
Button$1,
|
|
5738
|
-
{
|
|
5739
|
-
onClick: handleSave,
|
|
5740
|
-
variant: "contained",
|
|
5741
|
-
color: "primary",
|
|
5742
|
-
disabled: !templateName.trim() || !!displayError || isSubmitting
|
|
5743
|
-
},
|
|
5744
|
-
isSubmitting ? "Saving..." : "Save Template"
|
|
5745
|
-
))
|
|
5746
|
-
);
|
|
5747
|
-
}
|
|
5748
|
-
|
|
5749
|
-
// src/app/email-canvas/save-button.tsx
|
|
5750
6350
|
function SaveButton({ loadTemplates, saveAs }) {
|
|
5751
|
-
const { saveTemplate, currentTemplateId, setCurrentTemplate } = useEmailEditor();
|
|
6351
|
+
const { saveTemplate, currentTemplateId, currentTemplateKind, setCurrentTemplate } = useEmailEditor();
|
|
5752
6352
|
const { showMessage } = useSnackbar();
|
|
5753
6353
|
const [saveDialogOpen, setSaveDialogOpen] = useState(false);
|
|
5754
6354
|
const document2 = useDocument();
|
|
6355
|
+
const isSample = currentTemplateKind === "sample";
|
|
5755
6356
|
const handleSave = () => __async(null, null, function* () {
|
|
5756
6357
|
try {
|
|
5757
|
-
if (!currentTemplateId ||
|
|
6358
|
+
if (!currentTemplateId || isSample) {
|
|
5758
6359
|
setSaveDialogOpen(true);
|
|
5759
6360
|
return;
|
|
5760
6361
|
}
|
|
@@ -5771,8 +6372,8 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5771
6372
|
const handleSaveAs = (templateName) => __async(null, null, function* () {
|
|
5772
6373
|
try {
|
|
5773
6374
|
if (saveAs) {
|
|
5774
|
-
const { id: templateId,
|
|
5775
|
-
setCurrentTemplate(templateId,
|
|
6375
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(document2));
|
|
6376
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
5776
6377
|
if (loadTemplates) {
|
|
5777
6378
|
yield loadTemplates();
|
|
5778
6379
|
}
|
|
@@ -5788,7 +6389,7 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5788
6389
|
return false;
|
|
5789
6390
|
}
|
|
5790
6391
|
});
|
|
5791
|
-
return /* @__PURE__ */
|
|
6392
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5792
6393
|
IconButton,
|
|
5793
6394
|
{
|
|
5794
6395
|
onClick: handleSave,
|
|
@@ -5799,14 +6400,14 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5799
6400
|
}
|
|
5800
6401
|
}
|
|
5801
6402
|
},
|
|
5802
|
-
/* @__PURE__ */
|
|
5803
|
-
), /* @__PURE__ */
|
|
6403
|
+
/* @__PURE__ */ React60.createElement(Tooltip, { title: isSample ? "Save as new template" : "Save template" }, /* @__PURE__ */ React60.createElement(SaveOutlined, { fontSize: "small" }))
|
|
6404
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5804
6405
|
SaveTemplateDialog,
|
|
5805
6406
|
{
|
|
5806
6407
|
open: saveDialogOpen,
|
|
5807
6408
|
onClose: () => setSaveDialogOpen(false),
|
|
5808
6409
|
onSave: handleSaveAs,
|
|
5809
|
-
defaultName:
|
|
6410
|
+
defaultName: isSample ? "New Template" : "New Template"
|
|
5810
6411
|
}
|
|
5811
6412
|
));
|
|
5812
6413
|
}
|
|
@@ -5835,7 +6436,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5835
6436
|
});
|
|
5836
6437
|
const validateTemplateName = (name) => {
|
|
5837
6438
|
const nameExists = templates.some(
|
|
5838
|
-
(template) => template.
|
|
6439
|
+
(template) => template.slug.toLowerCase() === name.toLowerCase()
|
|
5839
6440
|
);
|
|
5840
6441
|
if (nameExists) {
|
|
5841
6442
|
setNameError("A template with this name already exists");
|
|
@@ -5853,10 +6454,10 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5853
6454
|
}
|
|
5854
6455
|
try {
|
|
5855
6456
|
if (saveAs) {
|
|
5856
|
-
const { id: templateId,
|
|
6457
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(empty_email_message_default));
|
|
5857
6458
|
resetDocument(empty_email_message_default);
|
|
5858
|
-
setCurrentTemplate(templateId,
|
|
5859
|
-
loadTemplate(empty_email_message_default, templateId,
|
|
6459
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
6460
|
+
loadTemplate(empty_email_message_default, templateId, slug, "template");
|
|
5860
6461
|
if (loadTemplates) {
|
|
5861
6462
|
yield loadTemplates();
|
|
5862
6463
|
}
|
|
@@ -5870,7 +6471,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5870
6471
|
}
|
|
5871
6472
|
return false;
|
|
5872
6473
|
});
|
|
5873
|
-
return /* @__PURE__ */
|
|
6474
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5874
6475
|
IconButton,
|
|
5875
6476
|
{
|
|
5876
6477
|
onClick: handleNewTemplate,
|
|
@@ -5881,8 +6482,8 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5881
6482
|
}
|
|
5882
6483
|
}
|
|
5883
6484
|
},
|
|
5884
|
-
/* @__PURE__ */
|
|
5885
|
-
), /* @__PURE__ */
|
|
6485
|
+
/* @__PURE__ */ React60.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React60.createElement(Add, { fontSize: "small" }))
|
|
6486
|
+
), /* @__PURE__ */ React60.createElement(
|
|
5886
6487
|
SaveTemplateDialog,
|
|
5887
6488
|
{
|
|
5888
6489
|
open: saveDialogOpen,
|
|
@@ -5897,6 +6498,48 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5897
6498
|
}
|
|
5898
6499
|
));
|
|
5899
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
|
+
}
|
|
5900
6543
|
|
|
5901
6544
|
// src/app/email-canvas/index.tsx
|
|
5902
6545
|
function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
|
|
@@ -5929,19 +6572,19 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5929
6572
|
const renderMainPanel = () => {
|
|
5930
6573
|
switch (selectedMainTab) {
|
|
5931
6574
|
case "editor":
|
|
5932
|
-
return /* @__PURE__ */
|
|
6575
|
+
return /* @__PURE__ */ React60.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React60.createElement(EditorBlock, { id: "root" }));
|
|
5933
6576
|
case "preview":
|
|
5934
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ React60.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React60.createElement(Reader, { document: document2, rootBlockId: "root" }));
|
|
5935
6578
|
case "html":
|
|
5936
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ React60.createElement(HtmlPanel, null);
|
|
5937
6580
|
case "text":
|
|
5938
|
-
return /* @__PURE__ */
|
|
6581
|
+
return /* @__PURE__ */ React60.createElement(TextPanel, null);
|
|
5939
6582
|
case "json":
|
|
5940
|
-
return /* @__PURE__ */
|
|
6583
|
+
return /* @__PURE__ */ React60.createElement(JsonPanel, null);
|
|
5941
6584
|
}
|
|
5942
6585
|
};
|
|
5943
6586
|
const showSaveButtons = persistenceEnabled;
|
|
5944
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement(
|
|
5945
6588
|
Stack,
|
|
5946
6589
|
{
|
|
5947
6590
|
sx: {
|
|
@@ -5958,10 +6601,10 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5958
6601
|
justifyContent: "space-between",
|
|
5959
6602
|
alignItems: "center"
|
|
5960
6603
|
},
|
|
5961
|
-
samplesDrawerEnabled && /* @__PURE__ */
|
|
5962
|
-
/* @__PURE__ */
|
|
5963
|
-
/* @__PURE__ */
|
|
5964
|
-
), /* @__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: {
|
|
5965
6608
|
paddingBottom: "50px",
|
|
5966
6609
|
minWidth: 370
|
|
5967
6610
|
} }, renderMainPanel()));
|
|
@@ -6011,6 +6654,8 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6011
6654
|
loadTemplate,
|
|
6012
6655
|
deleteTemplate,
|
|
6013
6656
|
copyTemplate,
|
|
6657
|
+
renameTemplate,
|
|
6658
|
+
setTemplateKind,
|
|
6014
6659
|
saveAs,
|
|
6015
6660
|
onChange
|
|
6016
6661
|
} = props;
|
|
@@ -6043,7 +6688,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6043
6688
|
return getDocument();
|
|
6044
6689
|
}
|
|
6045
6690
|
}));
|
|
6046
|
-
return /* @__PURE__ */
|
|
6691
|
+
return /* @__PURE__ */ React60.createElement(Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React60.createElement(
|
|
6047
6692
|
InspectorDrawer,
|
|
6048
6693
|
{
|
|
6049
6694
|
enterDuration: drawerEnterDuration,
|
|
@@ -6051,7 +6696,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6051
6696
|
deleteTemplate,
|
|
6052
6697
|
copyTemplate
|
|
6053
6698
|
}
|
|
6054
|
-
), /* @__PURE__ */
|
|
6699
|
+
), /* @__PURE__ */ React60.createElement(
|
|
6055
6700
|
SamplesDrawer,
|
|
6056
6701
|
{
|
|
6057
6702
|
enterDuration: drawerEnterDuration,
|
|
@@ -6061,9 +6706,13 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6061
6706
|
loadTemplates,
|
|
6062
6707
|
loadTemplate,
|
|
6063
6708
|
currentTemplateId,
|
|
6064
|
-
deleteTemplate
|
|
6709
|
+
deleteTemplate,
|
|
6710
|
+
copyTemplate,
|
|
6711
|
+
renameTemplate,
|
|
6712
|
+
setTemplateKind,
|
|
6713
|
+
saveAs
|
|
6065
6714
|
}
|
|
6066
|
-
), /* @__PURE__ */
|
|
6715
|
+
), /* @__PURE__ */ React60.createElement(
|
|
6067
6716
|
Stack,
|
|
6068
6717
|
{
|
|
6069
6718
|
sx: {
|
|
@@ -6072,7 +6721,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
6072
6721
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
6073
6722
|
}
|
|
6074
6723
|
},
|
|
6075
|
-
/* @__PURE__ */
|
|
6724
|
+
/* @__PURE__ */ React60.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
6076
6725
|
));
|
|
6077
6726
|
});
|
|
6078
6727
|
var EmailEditor = forwardRef((props, ref) => {
|
|
@@ -6092,6 +6741,8 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6092
6741
|
loadTemplate,
|
|
6093
6742
|
deleteTemplate,
|
|
6094
6743
|
copyTemplate,
|
|
6744
|
+
renameTemplate,
|
|
6745
|
+
setTemplateKind,
|
|
6095
6746
|
saveAs,
|
|
6096
6747
|
theme
|
|
6097
6748
|
} = props;
|
|
@@ -6107,7 +6758,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6107
6758
|
useEffect(() => {
|
|
6108
6759
|
setPersistenceEnabled(persistenceEnabled);
|
|
6109
6760
|
}, [persistenceEnabled]);
|
|
6110
|
-
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(
|
|
6111
6762
|
EmailEditorProvider,
|
|
6112
6763
|
{
|
|
6113
6764
|
initialTemplate: resolvedTemplate,
|
|
@@ -6116,7 +6767,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6116
6767
|
onSave,
|
|
6117
6768
|
onChange
|
|
6118
6769
|
},
|
|
6119
|
-
/* @__PURE__ */
|
|
6770
|
+
/* @__PURE__ */ React60.createElement(
|
|
6120
6771
|
EmailEditorInternal,
|
|
6121
6772
|
{
|
|
6122
6773
|
ref,
|
|
@@ -6129,6 +6780,8 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6129
6780
|
loadTemplate,
|
|
6130
6781
|
deleteTemplate,
|
|
6131
6782
|
copyTemplate,
|
|
6783
|
+
renameTemplate,
|
|
6784
|
+
setTemplateKind,
|
|
6132
6785
|
saveAs,
|
|
6133
6786
|
onChange
|
|
6134
6787
|
}
|
|
@@ -6138,6 +6791,6 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
6138
6791
|
EmailEditor.displayName = "EmailEditor";
|
|
6139
6792
|
EmailEditorInternal.displayName = "EmailEditorInternal";
|
|
6140
6793
|
|
|
6141
|
-
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 };
|
|
6142
6795
|
//# sourceMappingURL=index.js.map
|
|
6143
6796
|
//# sourceMappingURL=index.js.map
|