best-email-builder 0.11.0 → 0.13.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/CHANGELOG.md +22 -0
- package/dist/ai-server.js +3 -3
- package/dist/ai.js +6 -6
- package/dist/builder.js +8 -8
- package/dist/{chunk-NV6IV4CU.js → chunk-2KOI5SWV.js} +2 -2
- package/dist/{chunk-ACAQ2QTU.js → chunk-6QTSXJG4.js} +26 -5
- package/dist/chunk-6QTSXJG4.js.map +1 -0
- package/dist/{chunk-PFGTD5CS.js → chunk-A4KF7NMP.js} +2 -2
- package/dist/{chunk-7HDOSA5G.js → chunk-G7G3TRWG.js} +671 -441
- package/dist/chunk-G7G3TRWG.js.map +1 -0
- package/dist/{chunk-SQJ3TKEL.js → chunk-JJ56652Y.js} +27 -17
- package/dist/chunk-JJ56652Y.js.map +1 -0
- package/dist/{chunk-COZXOBR3.js → chunk-LSOR4OII.js} +3 -3
- package/dist/{chunk-YQGPBUZ3.js → chunk-Q2ZUJFOY.js} +2 -2
- package/dist/{chunk-47WQSNER.js → chunk-Q5UPFM7J.js} +3 -3
- package/dist/{chunk-47WQSNER.js.map → chunk-Q5UPFM7J.js.map} +1 -1
- package/dist/{chunk-ONYPTZFK.js → chunk-UGF3YJ64.js} +2 -2
- package/dist/{chunk-PYD5FOL2.js → chunk-XF25DLD4.js} +3 -3
- package/dist/{chunk-A2MEYOR3.js → chunk-ZTUW25BG.js} +13 -7
- package/dist/chunk-ZTUW25BG.js.map +1 -0
- package/dist/index.js +10 -10
- package/dist/library.js +5 -5
- package/dist/server.js +5 -5
- package/dist/styles.css +1 -1
- package/dist/types/core/EmailEditor.d.ts +16 -4
- package/dist/types/core/constants.d.ts +1 -1
- package/dist/types/engine/NativeAdapter.d.ts +1 -1
- package/dist/types/engine/canvas/CanvasView.d.ts +3 -0
- package/dist/types/engine/canvas/canvasStyles.d.ts +1 -1
- package/dist/types/features/variables/VariablesBar.d.ts +16 -0
- package/dist/types/ui/primitives/misc.d.ts +20 -4
- package/package.json +1 -1
- package/dist/chunk-7HDOSA5G.js.map +0 -1
- package/dist/chunk-A2MEYOR3.js.map +0 -1
- package/dist/chunk-ACAQ2QTU.js.map +0 -1
- package/dist/chunk-SQJ3TKEL.js.map +0 -1
- /package/dist/{chunk-NV6IV4CU.js.map → chunk-2KOI5SWV.js.map} +0 -0
- /package/dist/{chunk-PFGTD5CS.js.map → chunk-A4KF7NMP.js.map} +0 -0
- /package/dist/{chunk-COZXOBR3.js.map → chunk-LSOR4OII.js.map} +0 -0
- /package/dist/{chunk-YQGPBUZ3.js.map → chunk-Q2ZUJFOY.js.map} +0 -0
- /package/dist/{chunk-ONYPTZFK.js.map → chunk-UGF3YJ64.js.map} +0 -0
- /package/dist/{chunk-PYD5FOL2.js.map → chunk-XF25DLD4.js.map} +0 -0
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
useLayoutWidth,
|
|
7
7
|
useSearchShortcut,
|
|
8
8
|
withThumbnailImages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LSOR4OII.js";
|
|
10
10
|
import {
|
|
11
11
|
BRAND_NOTES,
|
|
12
12
|
countImagesWithoutPicture,
|
|
13
13
|
logoWidthFor
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Q2ZUJFOY.js";
|
|
15
15
|
import {
|
|
16
16
|
cleanRichText,
|
|
17
17
|
escapeText,
|
|
18
18
|
textOfHtml
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UGF3YJ64.js";
|
|
20
20
|
import {
|
|
21
21
|
Button,
|
|
22
22
|
Dialog,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
DialogHeader,
|
|
26
26
|
DialogTitle,
|
|
27
27
|
FilterChip,
|
|
28
|
+
FilterReset,
|
|
28
29
|
Input,
|
|
29
30
|
Label,
|
|
30
31
|
NoticeArea,
|
|
@@ -50,7 +51,7 @@ import {
|
|
|
50
51
|
createHttpStorage,
|
|
51
52
|
useT,
|
|
52
53
|
useUi
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-6QTSXJG4.js";
|
|
54
55
|
import {
|
|
55
56
|
DEFAULT_BUTTON_URL,
|
|
56
57
|
EMAIL_BUILDER_VERSION,
|
|
@@ -93,10 +94,10 @@ import {
|
|
|
93
94
|
setAttributes,
|
|
94
95
|
setContent,
|
|
95
96
|
toProject
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-Q5UPFM7J.js";
|
|
97
98
|
import {
|
|
98
99
|
isSafeUrl
|
|
99
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-A4KF7NMP.js";
|
|
100
101
|
import {
|
|
101
102
|
CUSTOM_GROUP,
|
|
102
103
|
DEFAULT_VARIABLES,
|
|
@@ -109,7 +110,7 @@ import {
|
|
|
109
110
|
tokenOf,
|
|
110
111
|
translatorFor,
|
|
111
112
|
validateCustomVariable
|
|
112
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-ZTUW25BG.js";
|
|
113
114
|
|
|
114
115
|
// src/core/events.js
|
|
115
116
|
function createEmitter({ onError } = {}) {
|
|
@@ -449,6 +450,19 @@ function createEmailEditor({ adapter, blocks, features = null, t = identity }) {
|
|
|
449
450
|
requireReady("insertLink");
|
|
450
451
|
return adapter.insertLink(String(href || ""), String(label || href || ""));
|
|
451
452
|
},
|
|
453
|
+
/**
|
|
454
|
+
* Shows a text where `insertText` would put it, without inserting it (a
|
|
455
|
+
* variable under the pointer). False if nothing would take it, or if the
|
|
456
|
+
* engine cannot preview. Not ready yet: nothing to show, no error.
|
|
457
|
+
*/
|
|
458
|
+
previewText(text) {
|
|
459
|
+
if (status !== "ready" || !adapter.previewText) return false;
|
|
460
|
+
return adapter.previewText(String(text ?? ""));
|
|
461
|
+
},
|
|
462
|
+
/** Takes the previewed text away. */
|
|
463
|
+
clearPreview() {
|
|
464
|
+
if (status === "ready") adapter.clearPreview?.();
|
|
465
|
+
},
|
|
452
466
|
undo() {
|
|
453
467
|
requireReady("undo");
|
|
454
468
|
adapter.undo();
|
|
@@ -1423,21 +1437,113 @@ var versionsFeature = {
|
|
|
1423
1437
|
toolbar: VersionsMenu
|
|
1424
1438
|
};
|
|
1425
1439
|
|
|
1440
|
+
// src/features/variables/VariablesBar.jsx
|
|
1441
|
+
import { useId, useState as useState2 } from "react";
|
|
1442
|
+
import { Braces, ChevronDown } from "lucide-react";
|
|
1443
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1444
|
+
function VariablesBar({ context }) {
|
|
1445
|
+
const { editor, ready, variables } = context;
|
|
1446
|
+
const { t, notify } = useUi();
|
|
1447
|
+
const [hovered, setHovered] = useState2(false);
|
|
1448
|
+
const [open, setOpen] = useState2(false);
|
|
1449
|
+
const listId = useId();
|
|
1450
|
+
const fields = variables.filter((v) => v.kind !== "link");
|
|
1451
|
+
if (!fields.length) return null;
|
|
1452
|
+
const expanded = hovered || open;
|
|
1453
|
+
const insert = (variable) => {
|
|
1454
|
+
if (!editor.insertText(tokenOf(variable))) notify("info", t("Select a text or a button first."));
|
|
1455
|
+
};
|
|
1456
|
+
return /* @__PURE__ */ jsx2("div", { className: "eb:relative eb:z-10 eb:h-6 eb:shrink-0", "data-testid": "eb-variables-bar", children: /* @__PURE__ */ jsxs2(
|
|
1457
|
+
"div",
|
|
1458
|
+
{
|
|
1459
|
+
className: cn(
|
|
1460
|
+
"eb:absolute eb:inset-x-0 eb:top-0 eb:border-b eb:border-border eb:bg-background eb:transition-shadow",
|
|
1461
|
+
expanded && "eb:shadow-md"
|
|
1462
|
+
),
|
|
1463
|
+
"data-expanded": expanded,
|
|
1464
|
+
onMouseEnter: () => setHovered(true),
|
|
1465
|
+
onMouseLeave: () => setHovered(false),
|
|
1466
|
+
onKeyDown: (e) => e.key === "Escape" && open && setOpen(false),
|
|
1467
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1468
|
+
children: [
|
|
1469
|
+
/* @__PURE__ */ jsxs2(
|
|
1470
|
+
"button",
|
|
1471
|
+
{
|
|
1472
|
+
type: "button",
|
|
1473
|
+
"aria-expanded": expanded,
|
|
1474
|
+
"aria-controls": listId,
|
|
1475
|
+
onClick: () => setOpen((value) => !value),
|
|
1476
|
+
className: "eb:flex eb:h-6 eb:w-full eb:items-center eb:gap-1.5 eb:px-3 eb:text-[11px] eb:font-medium eb:text-foreground-lighter eb:outline-none eb:hover:text-foreground eb:focus-visible:ring-2 eb:focus-visible:ring-ring/40 eb:focus-visible:ring-inset",
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ jsx2(Braces, { className: "eb:size-3", "aria-hidden": "true" }),
|
|
1479
|
+
t("Personalization fields"),
|
|
1480
|
+
/* @__PURE__ */ jsx2("span", { className: "eb:text-foreground-muted", children: fields.length }),
|
|
1481
|
+
/* @__PURE__ */ jsx2(ChevronDown, { className: cn("eb:ml-auto eb:size-3.5 eb:transition-transform", expanded && "eb:rotate-180"), "aria-hidden": "true" })
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
),
|
|
1485
|
+
/* @__PURE__ */ jsx2(
|
|
1486
|
+
"div",
|
|
1487
|
+
{
|
|
1488
|
+
id: listId,
|
|
1489
|
+
className: cn(
|
|
1490
|
+
"eb:grid eb:transition-[grid-template-rows,visibility] eb:duration-200 eb:ease-out",
|
|
1491
|
+
expanded ? "eb:visible eb:grid-rows-[1fr]" : "eb:invisible eb:grid-rows-[0fr]"
|
|
1492
|
+
),
|
|
1493
|
+
children: /* @__PURE__ */ jsx2("div", { className: "eb:min-h-0 eb:overflow-hidden", children: /* @__PURE__ */ jsx2(
|
|
1494
|
+
"div",
|
|
1495
|
+
{
|
|
1496
|
+
role: "group",
|
|
1497
|
+
"aria-label": t("Personalization fields"),
|
|
1498
|
+
className: "eb:flex eb:max-h-24 eb:flex-wrap eb:gap-1 eb:overflow-y-auto eb:px-3 eb:pt-0.5 eb:pb-2",
|
|
1499
|
+
children: fields.map((variable) => /* @__PURE__ */ jsx2(
|
|
1500
|
+
TooltipWrap,
|
|
1501
|
+
{
|
|
1502
|
+
label: /* @__PURE__ */ jsx2("code", { className: "eb:font-mono", children: tokenOf(variable) }),
|
|
1503
|
+
delayDuration: 100,
|
|
1504
|
+
hoverable: false,
|
|
1505
|
+
children: /* @__PURE__ */ jsx2(
|
|
1506
|
+
"button",
|
|
1507
|
+
{
|
|
1508
|
+
type: "button",
|
|
1509
|
+
disabled: !ready,
|
|
1510
|
+
"data-variable": variable.key,
|
|
1511
|
+
onMouseEnter: () => editor.previewText(tokenOf(variable)),
|
|
1512
|
+
onMouseLeave: () => editor.clearPreview(),
|
|
1513
|
+
onFocus: () => editor.previewText(tokenOf(variable)),
|
|
1514
|
+
onBlur: () => editor.clearPreview(),
|
|
1515
|
+
onClick: () => insert(variable),
|
|
1516
|
+
className: "eb:inline-flex eb:h-5.5 eb:items-center eb:rounded-full eb:border eb:border-border eb:bg-surface-75 eb:px-2 eb:text-[11px] eb:font-medium eb:text-foreground eb:transition-colors eb:outline-none eb:hover:border-primary/50 eb:hover:bg-primary/5 eb:hover:text-primary eb:focus-visible:ring-2 eb:focus-visible:ring-ring/50 eb:disabled:opacity-50",
|
|
1517
|
+
children: variable.custom ? variable.label : t(variable.label)
|
|
1518
|
+
}
|
|
1519
|
+
)
|
|
1520
|
+
},
|
|
1521
|
+
variable.key
|
|
1522
|
+
))
|
|
1523
|
+
}
|
|
1524
|
+
) })
|
|
1525
|
+
}
|
|
1526
|
+
)
|
|
1527
|
+
]
|
|
1528
|
+
}
|
|
1529
|
+
) });
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1426
1532
|
// src/features/variables/VariablesMenu.jsx
|
|
1427
|
-
import { useState as
|
|
1428
|
-
import { Braces as
|
|
1533
|
+
import { useState as useState5 } from "react";
|
|
1534
|
+
import { Braces as Braces3 } from "lucide-react";
|
|
1429
1535
|
|
|
1430
1536
|
// src/features/variables/VariableDialog.jsx
|
|
1431
|
-
import { useEffect, useMemo, useState as
|
|
1432
|
-
import { Braces, Loader2, Trash2 } from "lucide-react";
|
|
1433
|
-
import { jsx as
|
|
1537
|
+
import { useEffect, useMemo, useState as useState3 } from "react";
|
|
1538
|
+
import { Braces as Braces2, Loader2, Trash2 } from "lucide-react";
|
|
1539
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1434
1540
|
function VariableDialog({ open, onOpenChange, variable = null, initialLabel = "", variables, storage, onSaved, onDeleted }) {
|
|
1435
1541
|
const { t, notify, confirm } = useUi();
|
|
1436
1542
|
const editing = Boolean(variable);
|
|
1437
|
-
const [form, setForm] =
|
|
1438
|
-
const [keyTouched, setKeyTouched] =
|
|
1439
|
-
const [errors, setErrors] =
|
|
1440
|
-
const [busy, setBusy] =
|
|
1543
|
+
const [form, setForm] = useState3({ label: "", key: "", group: "", sample: "", fallback: "" });
|
|
1544
|
+
const [keyTouched, setKeyTouched] = useState3(false);
|
|
1545
|
+
const [errors, setErrors] = useState3({});
|
|
1546
|
+
const [busy, setBusy] = useState3(false);
|
|
1441
1547
|
useEffect(() => {
|
|
1442
1548
|
if (!open) return;
|
|
1443
1549
|
setForm(
|
|
@@ -1504,9 +1610,9 @@ function VariableDialog({ open, onOpenChange, variable = null, initialLabel = ""
|
|
|
1504
1610
|
setBusy(false);
|
|
1505
1611
|
}
|
|
1506
1612
|
};
|
|
1507
|
-
const field = (name, label, props = {}, hint = null) => /* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1613
|
+
const field = (name, label, props = {}, hint = null) => /* @__PURE__ */ jsxs3("div", { className: "eb:space-y-1.5", children: [
|
|
1614
|
+
/* @__PURE__ */ jsx3(Label, { htmlFor: `eb-var-${name}`, children: label }),
|
|
1615
|
+
/* @__PURE__ */ jsx3(
|
|
1510
1616
|
Input,
|
|
1511
1617
|
{
|
|
1512
1618
|
id: `eb-var-${name}`,
|
|
@@ -1517,23 +1623,23 @@ function VariableDialog({ open, onOpenChange, variable = null, initialLabel = ""
|
|
|
1517
1623
|
...props
|
|
1518
1624
|
}
|
|
1519
1625
|
),
|
|
1520
|
-
(errors[name] || hint) && /* @__PURE__ */
|
|
1626
|
+
(errors[name] || hint) && /* @__PURE__ */ jsx3("p", { id: `eb-var-${name}-hint`, className: errors[name] ? "eb:text-[12px] eb:text-destructive" : "eb:text-[11px] eb:text-foreground-muted", children: errors[name] || hint })
|
|
1521
1627
|
] });
|
|
1522
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsx3(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(
|
|
1523
1629
|
DialogContent,
|
|
1524
1630
|
{
|
|
1525
1631
|
className: "eb:sm:max-w-[440px]",
|
|
1526
1632
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1527
1633
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1528
1634
|
children: [
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
/* @__PURE__ */
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1635
|
+
/* @__PURE__ */ jsx3(DialogHeader, { children: /* @__PURE__ */ jsxs3("div", { className: "eb:flex eb:items-center eb:gap-3", children: [
|
|
1636
|
+
/* @__PURE__ */ jsx3("span", { className: "eb:flex eb:size-10 eb:shrink-0 eb:items-center eb:justify-center eb:rounded-lg2 eb:bg-primary/10 eb:text-primary", children: /* @__PURE__ */ jsx3(Braces2, { className: "eb:size-5" }) }),
|
|
1637
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1638
|
+
/* @__PURE__ */ jsx3(DialogTitle, { className: "eb:text-base eb:font-normal", children: editing ? t("Edit variable") : t("New variable") }),
|
|
1639
|
+
/* @__PURE__ */ jsx3(DialogDescription, { className: "eb:text-[13px]", children: t("Available in every template.") })
|
|
1534
1640
|
] })
|
|
1535
1641
|
] }) }),
|
|
1536
|
-
/* @__PURE__ */
|
|
1642
|
+
/* @__PURE__ */ jsxs3("form", { onSubmit: submit, className: "eb:space-y-3", noValidate: true, children: [
|
|
1537
1643
|
field("label", t("Name"), { autoFocus: true, maxLength: VARIABLE_LIMITS.label, placeholder: t("Order number") }),
|
|
1538
1644
|
field(
|
|
1539
1645
|
"key",
|
|
@@ -1541,9 +1647,9 @@ function VariableDialog({ open, onOpenChange, variable = null, initialLabel = ""
|
|
|
1541
1647
|
{ disabled: editing, maxLength: VARIABLE_LIMITS.key, className: "eb:font-mono eb:text-[12px]" },
|
|
1542
1648
|
form.key ? `{{${form.key}}}` : null
|
|
1543
1649
|
),
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ jsxs3("div", { className: "eb:space-y-1.5", children: [
|
|
1651
|
+
/* @__PURE__ */ jsx3(Label, { htmlFor: "eb-var-group", children: t("Group") }),
|
|
1652
|
+
/* @__PURE__ */ jsx3(
|
|
1547
1653
|
Input,
|
|
1548
1654
|
{
|
|
1549
1655
|
id: "eb-var-group",
|
|
@@ -1554,21 +1660,21 @@ function VariableDialog({ open, onOpenChange, variable = null, initialLabel = ""
|
|
|
1554
1660
|
placeholder: t(CUSTOM_GROUP)
|
|
1555
1661
|
}
|
|
1556
1662
|
),
|
|
1557
|
-
/* @__PURE__ */
|
|
1663
|
+
/* @__PURE__ */ jsx3("datalist", { id: "eb-var-groups", children: groups.map((g) => /* @__PURE__ */ jsx3("option", { value: g }, g)) })
|
|
1558
1664
|
] }),
|
|
1559
|
-
/* @__PURE__ */
|
|
1665
|
+
/* @__PURE__ */ jsxs3("div", { className: "eb:grid eb:grid-cols-2 eb:gap-3", children: [
|
|
1560
1666
|
field("sample", t("Sample value"), { maxLength: VARIABLE_LIMITS.sample, placeholder: "CMD-1042" }, t("Preview and tests")),
|
|
1561
1667
|
field("fallback", t("Value if empty"), { maxLength: VARIABLE_LIMITS.fallback }, t("When a recipient has none"))
|
|
1562
1668
|
] }),
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
editing && /* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ jsxs3("div", { className: "eb:flex eb:items-center eb:gap-2 eb:pt-1", children: [
|
|
1670
|
+
editing && /* @__PURE__ */ jsxs3(Button, { variant: "ghost", className: "eb:text-destructive eb:hover:text-destructive", onClick: remove, disabled: busy, children: [
|
|
1671
|
+
/* @__PURE__ */ jsx3(Trash2, {}),
|
|
1566
1672
|
t("Delete")
|
|
1567
1673
|
] }),
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
busy && /* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ jsxs3("div", { className: "eb:ml-auto eb:flex eb:gap-2", children: [
|
|
1675
|
+
/* @__PURE__ */ jsx3(Button, { variant: "outline", onClick: () => onOpenChange(false), disabled: busy, children: t("Cancel") }),
|
|
1676
|
+
/* @__PURE__ */ jsxs3(Button, { type: "submit", disabled: busy, children: [
|
|
1677
|
+
busy && /* @__PURE__ */ jsx3(Loader2, { className: "eb:animate-spin" }),
|
|
1572
1678
|
editing ? t("Save") : t("Create")
|
|
1573
1679
|
] })
|
|
1574
1680
|
] })
|
|
@@ -1580,13 +1686,13 @@ function VariableDialog({ open, onOpenChange, variable = null, initialLabel = ""
|
|
|
1580
1686
|
}
|
|
1581
1687
|
|
|
1582
1688
|
// src/features/variables/VariablePicker.jsx
|
|
1583
|
-
import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as
|
|
1689
|
+
import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState4 } from "react";
|
|
1584
1690
|
import { Pencil, Plus, Search } from "lucide-react";
|
|
1585
|
-
import { jsx as
|
|
1691
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1586
1692
|
function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, filter }) {
|
|
1587
1693
|
const t = useT();
|
|
1588
|
-
const [query, setQuery] =
|
|
1589
|
-
const [active, setActive] =
|
|
1694
|
+
const [query, setQuery] = useState4("");
|
|
1695
|
+
const [active, setActive] = useState4(0);
|
|
1590
1696
|
const listRef = useRef(null);
|
|
1591
1697
|
const searchRef = useRef(
|
|
1592
1698
|
/** @type {HTMLInputElement|null} */
|
|
@@ -1618,10 +1724,10 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1618
1724
|
else if (onCreate && query.trim()) onCreate(query.trim());
|
|
1619
1725
|
}
|
|
1620
1726
|
};
|
|
1621
|
-
return /* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsxs4("div", { className: "eb:flex eb:max-h-[min(440px,70vh)] eb:flex-col", "data-testid": "variable-picker", children: [
|
|
1728
|
+
/* @__PURE__ */ jsxs4("div", { className: "eb:relative eb:border-b eb:border-border eb:p-2", children: [
|
|
1729
|
+
/* @__PURE__ */ jsx4(Search, { className: "eb:pointer-events-none eb:absolute eb:top-1/2 eb:left-4 eb:size-3.5 eb:-translate-y-1/2 eb:text-foreground-muted" }),
|
|
1730
|
+
/* @__PURE__ */ jsx4(
|
|
1625
1731
|
"input",
|
|
1626
1732
|
{
|
|
1627
1733
|
ref: searchRef,
|
|
@@ -1635,29 +1741,29 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1635
1741
|
className: "eb:h-8 eb:w-full eb:rounded-md eb:bg-surface-75 eb:pr-14 eb:pl-7 eb:text-[13px] eb:text-foreground eb:outline-none eb:placeholder:text-foreground-muted eb:focus-visible:ring-2 eb:focus-visible:ring-ring/40"
|
|
1636
1742
|
}
|
|
1637
1743
|
),
|
|
1638
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ jsx4(SearchKeyHint, { className: "eb:absolute eb:top-1/2 eb:right-4 eb:-translate-y-1/2" })
|
|
1639
1745
|
] }),
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
ordered.length === 0 && /* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
onCreate && query.trim() && /* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsxs4("div", { ref: listRef, role: "listbox", "aria-label": t("Variables"), className: "eb:min-h-0 eb:flex-1 eb:overflow-y-auto eb:p-1", children: [
|
|
1747
|
+
ordered.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "eb:px-2 eb:py-3 eb:text-center eb:text-[12px] eb:text-foreground-muted", children: [
|
|
1748
|
+
/* @__PURE__ */ jsx4("p", { children: t("No variable found.") }),
|
|
1749
|
+
onCreate && query.trim() && /* @__PURE__ */ jsxs4(
|
|
1644
1750
|
"button",
|
|
1645
1751
|
{
|
|
1646
1752
|
type: "button",
|
|
1647
1753
|
onClick: () => onCreate(query.trim()),
|
|
1648
1754
|
className: "eb:mt-2 eb:inline-flex eb:items-center eb:gap-1 eb:rounded-md eb:px-2 eb:py-1 eb:text-[12px] eb:font-medium eb:text-primary eb:hover:bg-accent",
|
|
1649
1755
|
children: [
|
|
1650
|
-
/* @__PURE__ */
|
|
1756
|
+
/* @__PURE__ */ jsx4(Plus, { className: "eb:size-3.5" }),
|
|
1651
1757
|
t("Create \u201C{name}\u201D", { name: query.trim() })
|
|
1652
1758
|
]
|
|
1653
1759
|
}
|
|
1654
1760
|
)
|
|
1655
1761
|
] }),
|
|
1656
|
-
groups.map((group) => /* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1762
|
+
groups.map((group) => /* @__PURE__ */ jsxs4("div", { role: "group", "aria-label": t(group), children: [
|
|
1763
|
+
/* @__PURE__ */ jsx4("p", { className: "eb:px-2 eb:pt-2 eb:pb-1 eb:text-[11px] eb:text-foreground-muted", children: t(group) }),
|
|
1658
1764
|
ordered.filter((v) => v.group === group).map((variable) => {
|
|
1659
1765
|
const index = ordered.indexOf(variable);
|
|
1660
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ jsxs4(
|
|
1661
1767
|
"div",
|
|
1662
1768
|
{
|
|
1663
1769
|
"data-active": index === active,
|
|
@@ -1667,7 +1773,7 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1667
1773
|
),
|
|
1668
1774
|
onMouseEnter: () => setActive(index),
|
|
1669
1775
|
children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ jsxs4(
|
|
1671
1777
|
"button",
|
|
1672
1778
|
{
|
|
1673
1779
|
type: "button",
|
|
@@ -1678,12 +1784,12 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1678
1784
|
className: "eb:flex eb:min-w-0 eb:flex-1 eb:items-center eb:gap-2 eb:px-2 eb:py-1.5 eb:text-left eb:text-[13px]",
|
|
1679
1785
|
title: variable.description || void 0,
|
|
1680
1786
|
children: [
|
|
1681
|
-
/* @__PURE__ */
|
|
1682
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx4("span", { className: "eb:min-w-0 eb:flex-1 eb:truncate", children: variable.custom ? variable.label : t(variable.label) }),
|
|
1788
|
+
/* @__PURE__ */ jsx4("code", { className: "eb:shrink-0 eb:font-mono eb:text-[10.5px] eb:text-foreground-muted", children: tokenOf(variable) })
|
|
1683
1789
|
]
|
|
1684
1790
|
}
|
|
1685
1791
|
),
|
|
1686
|
-
onEdit && variable.custom && /* @__PURE__ */
|
|
1792
|
+
onEdit && variable.custom && /* @__PURE__ */ jsx4(
|
|
1687
1793
|
"button",
|
|
1688
1794
|
{
|
|
1689
1795
|
type: "button",
|
|
@@ -1691,7 +1797,7 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1691
1797
|
title: t("Edit"),
|
|
1692
1798
|
onClick: () => onEdit(variable),
|
|
1693
1799
|
className: "eb:mr-1 eb:flex eb:size-6 eb:shrink-0 eb:items-center eb:justify-center eb:rounded-md eb:text-foreground-muted eb:opacity-0 eb:group-hover/var:opacity-100 eb:hover:bg-background eb:hover:text-foreground eb:focus-visible:opacity-100",
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1800
|
+
children: /* @__PURE__ */ jsx4(Pencil, { className: "eb:size-3" })
|
|
1695
1801
|
}
|
|
1696
1802
|
)
|
|
1697
1803
|
]
|
|
@@ -1701,14 +1807,14 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1701
1807
|
})
|
|
1702
1808
|
] }, group))
|
|
1703
1809
|
] }),
|
|
1704
|
-
onCreate && /* @__PURE__ */
|
|
1810
|
+
onCreate && /* @__PURE__ */ jsx4("div", { className: "eb:border-t eb:border-border eb:p-1", children: /* @__PURE__ */ jsxs4(
|
|
1705
1811
|
"button",
|
|
1706
1812
|
{
|
|
1707
1813
|
type: "button",
|
|
1708
1814
|
onClick: () => onCreate(query.trim()),
|
|
1709
1815
|
className: "eb:flex eb:w-full eb:items-center eb:gap-2 eb:rounded-md eb:px-2 eb:py-1.5 eb:text-left eb:text-[13px] eb:font-medium eb:text-primary eb:hover:bg-accent",
|
|
1710
1816
|
children: [
|
|
1711
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsx4(Plus, { className: "eb:size-4" }),
|
|
1712
1818
|
t("New variable")
|
|
1713
1819
|
]
|
|
1714
1820
|
}
|
|
@@ -1717,12 +1823,12 @@ function VariablePicker({ variables, onPick, onCreate = null, onEdit = null, fil
|
|
|
1717
1823
|
}
|
|
1718
1824
|
|
|
1719
1825
|
// src/features/variables/VariablesMenu.jsx
|
|
1720
|
-
import { Fragment, jsx as
|
|
1826
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1721
1827
|
function VariablesMenu({ context }) {
|
|
1722
1828
|
const { editor, ready, variables, storage, canManageVariables, reloadVariables } = context;
|
|
1723
1829
|
const { t, notify } = useUi();
|
|
1724
|
-
const [open, setOpen] =
|
|
1725
|
-
const [dialog, setDialog] =
|
|
1830
|
+
const [open, setOpen] = useState5(false);
|
|
1831
|
+
const [dialog, setDialog] = useState5(null);
|
|
1726
1832
|
const insert = (variable) => {
|
|
1727
1833
|
setOpen(false);
|
|
1728
1834
|
const done = variable.kind === "link" ? editor.insertLink(tokenOf(variable), t("Unsubscribe")) : editor.insertText(tokenOf(variable));
|
|
@@ -1739,9 +1845,9 @@ function VariablesMenu({ context }) {
|
|
|
1739
1845
|
setDialog({ variable, label: "" });
|
|
1740
1846
|
}
|
|
1741
1847
|
} : {};
|
|
1742
|
-
return /* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
1848
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1849
|
+
/* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
|
|
1850
|
+
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
|
|
1745
1851
|
Button,
|
|
1746
1852
|
{
|
|
1747
1853
|
variant: "outline",
|
|
@@ -1749,23 +1855,23 @@ function VariablesMenu({ context }) {
|
|
|
1749
1855
|
disabled: !ready,
|
|
1750
1856
|
onPointerDown: (e) => e.pointerType === "mouse" && e.preventDefault(),
|
|
1751
1857
|
children: [
|
|
1752
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ jsx5(Braces3, {}),
|
|
1753
1859
|
t("Variables")
|
|
1754
1860
|
]
|
|
1755
1861
|
}
|
|
1756
1862
|
) }),
|
|
1757
|
-
/* @__PURE__ */
|
|
1863
|
+
/* @__PURE__ */ jsx5(
|
|
1758
1864
|
PopoverContent,
|
|
1759
1865
|
{
|
|
1760
1866
|
align: "end",
|
|
1761
1867
|
className: "eb:w-80 eb:p-0",
|
|
1762
1868
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1763
1869
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1764
|
-
children: /* @__PURE__ */
|
|
1870
|
+
children: /* @__PURE__ */ jsx5(VariablePicker, { variables, onPick: insert, ...manage })
|
|
1765
1871
|
}
|
|
1766
1872
|
)
|
|
1767
1873
|
] }),
|
|
1768
|
-
canManageVariables && /* @__PURE__ */
|
|
1874
|
+
canManageVariables && /* @__PURE__ */ jsx5(
|
|
1769
1875
|
VariableDialog,
|
|
1770
1876
|
{
|
|
1771
1877
|
open: Boolean(dialog),
|
|
@@ -1800,7 +1906,8 @@ var variablesFeature = {
|
|
|
1800
1906
|
id: "variables",
|
|
1801
1907
|
label: "Variables",
|
|
1802
1908
|
order: 10,
|
|
1803
|
-
toolbar: VariablesMenu
|
|
1909
|
+
toolbar: VariablesMenu,
|
|
1910
|
+
canvasBar: VariablesBar
|
|
1804
1911
|
};
|
|
1805
1912
|
|
|
1806
1913
|
// src/features/preview/index.js
|
|
@@ -1813,9 +1920,9 @@ var previewFeature = {
|
|
|
1813
1920
|
};
|
|
1814
1921
|
|
|
1815
1922
|
// src/features/test-email/TestEmailButton.jsx
|
|
1816
|
-
import { useState as
|
|
1923
|
+
import { useState as useState6 } from "react";
|
|
1817
1924
|
import { CheckCircle2, Loader2 as Loader22, Send, XCircle } from "lucide-react";
|
|
1818
|
-
import { Fragment as Fragment2, jsx as
|
|
1925
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1819
1926
|
var KEY = "best-email-builder:test-addresses";
|
|
1820
1927
|
function readAddresses(fallback) {
|
|
1821
1928
|
try {
|
|
@@ -1833,10 +1940,10 @@ function rememberAddresses(value) {
|
|
|
1833
1940
|
function TestEmailButton({ context }) {
|
|
1834
1941
|
const { editor, ready, meta, storage, testRecipients = [] } = context;
|
|
1835
1942
|
const { t, notify } = useUi();
|
|
1836
|
-
const [open, setOpen] =
|
|
1837
|
-
const [addresses, setAddresses] =
|
|
1838
|
-
const [sending, setSending] =
|
|
1839
|
-
const [report, setReport] =
|
|
1943
|
+
const [open, setOpen] = useState6(false);
|
|
1944
|
+
const [addresses, setAddresses] = useState6("");
|
|
1945
|
+
const [sending, setSending] = useState6(false);
|
|
1946
|
+
const [report, setReport] = useState6(null);
|
|
1840
1947
|
const emails = addresses.split(/[,;\s]+/).map((a) => a.trim()).filter(Boolean);
|
|
1841
1948
|
const send = async () => {
|
|
1842
1949
|
if (!emails.length) return;
|
|
@@ -1859,8 +1966,8 @@ function TestEmailButton({ context }) {
|
|
|
1859
1966
|
setSending(false);
|
|
1860
1967
|
}
|
|
1861
1968
|
};
|
|
1862
|
-
return /* @__PURE__ */
|
|
1863
|
-
/* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1970
|
+
/* @__PURE__ */ jsxs6(
|
|
1864
1971
|
Button,
|
|
1865
1972
|
{
|
|
1866
1973
|
variant: "outline",
|
|
@@ -1872,22 +1979,22 @@ function TestEmailButton({ context }) {
|
|
|
1872
1979
|
setOpen(true);
|
|
1873
1980
|
},
|
|
1874
1981
|
children: [
|
|
1875
|
-
/* @__PURE__ */
|
|
1982
|
+
/* @__PURE__ */ jsx6(Send, {}),
|
|
1876
1983
|
t("Test")
|
|
1877
1984
|
]
|
|
1878
1985
|
}
|
|
1879
1986
|
),
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsx6(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs6(DialogContent, { className: "eb:sm:max-w-[460px]", children: [
|
|
1988
|
+
/* @__PURE__ */ jsx6(DialogHeader, { children: /* @__PURE__ */ jsxs6("div", { className: "eb:flex eb:items-center eb:gap-3", children: [
|
|
1989
|
+
/* @__PURE__ */ jsx6("span", { className: "eb:flex eb:size-10 eb:shrink-0 eb:items-center eb:justify-center eb:rounded-lg2 eb:bg-primary/10 eb:text-primary", children: /* @__PURE__ */ jsx6(Send, { className: "eb:size-5" }) }),
|
|
1990
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1991
|
+
/* @__PURE__ */ jsx6(DialogTitle, { className: "eb:text-base eb:font-normal", children: t("Send a test") }),
|
|
1992
|
+
/* @__PURE__ */ jsx6(DialogDescription, { className: "eb:text-[13px]", children: t("The email on screen, to reviewers\u2019 addresses.") })
|
|
1886
1993
|
] })
|
|
1887
1994
|
] }) }),
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */
|
|
1995
|
+
/* @__PURE__ */ jsxs6("div", { className: "eb:space-y-2", children: [
|
|
1996
|
+
/* @__PURE__ */ jsx6(Label, { htmlFor: "eb-test-addresses", children: t("Addresses") }),
|
|
1997
|
+
/* @__PURE__ */ jsx6(
|
|
1891
1998
|
Textarea,
|
|
1892
1999
|
{
|
|
1893
2000
|
id: "eb-test-addresses",
|
|
@@ -1898,20 +2005,20 @@ function TestEmailButton({ context }) {
|
|
|
1898
2005
|
}
|
|
1899
2006
|
)
|
|
1900
2007
|
] }),
|
|
1901
|
-
report && /* @__PURE__ */
|
|
1902
|
-
report.results.map((r) => /* @__PURE__ */
|
|
1903
|
-
r.ok ? /* @__PURE__ */
|
|
1904
|
-
/* @__PURE__ */
|
|
2008
|
+
report && /* @__PURE__ */ jsxs6("ul", { className: "eb:space-y-1", "aria-label": t("Results"), children: [
|
|
2009
|
+
report.results.map((r) => /* @__PURE__ */ jsxs6("li", { className: "eb:flex eb:items-start eb:gap-1.5 eb:text-[12px] eb:text-foreground", children: [
|
|
2010
|
+
r.ok ? /* @__PURE__ */ jsx6(CheckCircle2, { className: "eb:mt-0.5 eb:size-3.5 eb:shrink-0 eb:text-success", "aria-hidden": "true" }) : /* @__PURE__ */ jsx6(XCircle, { className: "eb:mt-0.5 eb:size-3.5 eb:shrink-0 eb:text-destructive", "aria-hidden": "true" }),
|
|
2011
|
+
/* @__PURE__ */ jsxs6("span", { className: "eb:min-w-0 eb:break-all", children: [
|
|
1905
2012
|
r.email,
|
|
1906
2013
|
r.error ? ` \u2014 ${r.error}` : ""
|
|
1907
2014
|
] })
|
|
1908
2015
|
] }, r.email)),
|
|
1909
|
-
report.invalid.map((email2) => /* @__PURE__ */
|
|
2016
|
+
report.invalid.map((email2) => /* @__PURE__ */ jsx6("li", { className: "eb:text-[12px] eb:text-foreground-muted", children: t("Ignored (invalid): {email}", { email: email2 }) }, `invalid-${email2}`))
|
|
1910
2017
|
] }),
|
|
1911
|
-
/* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
sending ? /* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ jsxs6("div", { className: "eb:flex eb:justify-end eb:gap-2", children: [
|
|
2019
|
+
/* @__PURE__ */ jsx6(Button, { variant: "outline", onClick: () => setOpen(false), children: t("Close") }),
|
|
2020
|
+
/* @__PURE__ */ jsxs6(Button, { onClick: send, disabled: sending || !emails.length, children: [
|
|
2021
|
+
sending ? /* @__PURE__ */ jsx6(Loader22, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx6(Send, {}),
|
|
1915
2022
|
t("Send")
|
|
1916
2023
|
] })
|
|
1917
2024
|
] })
|
|
@@ -1929,9 +2036,9 @@ var testEmailFeature = {
|
|
|
1929
2036
|
};
|
|
1930
2037
|
|
|
1931
2038
|
// src/features/templates/TemplateGallery.jsx
|
|
1932
|
-
import { useEffect as useEffect3, useMemo as useMemo3, useState as
|
|
2039
|
+
import { useEffect as useEffect3, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1933
2040
|
import { LayoutTemplate, Search as Search2, X } from "lucide-react";
|
|
1934
|
-
import { Fragment as Fragment3, jsx as
|
|
2041
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1935
2042
|
var THUMBNAIL_SCALE = 0.38;
|
|
1936
2043
|
var EMAIL_WIDTH = 600;
|
|
1937
2044
|
var FADE_LINE = "eb:block eb:overflow-hidden eb:whitespace-nowrap eb:[mask-image:linear-gradient(to_right,#000_calc(100%-2.5rem),transparent)]";
|
|
@@ -1939,12 +2046,12 @@ var NO_SCROLLBAR = "<style>html,body{overflow:hidden!important;scrollbar-width:n
|
|
|
1939
2046
|
var withoutScrollbar = (html) => !html ? html : /<\/head>/i.test(html) ? html.replace(/<\/head>/i, `${NO_SCROLLBAR}</head>`) : NO_SCROLLBAR + html;
|
|
1940
2047
|
var fold = (text) => String(text || "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
1941
2048
|
function Thumbnail({ html, title }) {
|
|
1942
|
-
return /* @__PURE__ */
|
|
2049
|
+
return /* @__PURE__ */ jsx7(
|
|
1943
2050
|
"div",
|
|
1944
2051
|
{
|
|
1945
2052
|
className: "eb:relative eb:h-[220px] eb:shrink-0 eb:overflow-hidden eb:rounded-md eb:border eb:border-border eb:bg-surface-75",
|
|
1946
2053
|
"aria-hidden": "true",
|
|
1947
|
-
children: /* @__PURE__ */
|
|
2054
|
+
children: /* @__PURE__ */ jsx7(
|
|
1948
2055
|
"iframe",
|
|
1949
2056
|
{
|
|
1950
2057
|
title,
|
|
@@ -1966,10 +2073,10 @@ function Thumbnail({ html, title }) {
|
|
|
1966
2073
|
function TemplateGalleryButton({ context }) {
|
|
1967
2074
|
const { editor, ready, templates, isDirty, markDirty, template, setMeta } = context;
|
|
1968
2075
|
const { t, confirm, notify } = useUi();
|
|
1969
|
-
const [open, setOpen] =
|
|
1970
|
-
const [query, setQuery] =
|
|
1971
|
-
const [chosen, setChosen] =
|
|
1972
|
-
const [rendered, setRendered] =
|
|
2076
|
+
const [open, setOpen] = useState7(false);
|
|
2077
|
+
const [query, setQuery] = useState7("");
|
|
2078
|
+
const [chosen, setChosen] = useState7(() => /* @__PURE__ */ new Set());
|
|
2079
|
+
const [rendered, setRendered] = useState7({});
|
|
1973
2080
|
useEffect3(() => {
|
|
1974
2081
|
if (!open || !ready) return void 0;
|
|
1975
2082
|
let alive = true;
|
|
@@ -2026,8 +2133,8 @@ function TemplateGalleryButton({ context }) {
|
|
|
2026
2133
|
setOpen(false);
|
|
2027
2134
|
notify("success", t("\u201C{name}\u201D template applied.", { name: entry.name }));
|
|
2028
2135
|
};
|
|
2029
|
-
return /* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
2136
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsxs7(
|
|
2031
2138
|
Button,
|
|
2032
2139
|
{
|
|
2033
2140
|
variant: "outline",
|
|
@@ -2039,12 +2146,12 @@ function TemplateGalleryButton({ context }) {
|
|
|
2039
2146
|
setOpen(true);
|
|
2040
2147
|
},
|
|
2041
2148
|
children: [
|
|
2042
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ jsx7(LayoutTemplate, {}),
|
|
2043
2150
|
t("Templates")
|
|
2044
2151
|
]
|
|
2045
2152
|
}
|
|
2046
2153
|
),
|
|
2047
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsx7(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs7(
|
|
2048
2155
|
DialogContent,
|
|
2049
2156
|
{
|
|
2050
2157
|
className: "eb:flex eb:h-[min(48rem,calc(100dvh-2rem))] eb:flex-col eb:sm:max-w-4xl",
|
|
@@ -2056,14 +2163,14 @@ function TemplateGalleryButton({ context }) {
|
|
|
2056
2163
|
}
|
|
2057
2164
|
},
|
|
2058
2165
|
children: [
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsxs7(DialogHeader, { children: [
|
|
2167
|
+
/* @__PURE__ */ jsx7(DialogTitle, { children: t("Start from a template") }),
|
|
2168
|
+
/* @__PURE__ */ jsx7(DialogDescription, { children: t("Picking a template replaces the email being edited.") })
|
|
2062
2169
|
] }),
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsxs7("div", { className: "eb:flex eb:shrink-0 eb:flex-col eb:gap-3", children: [
|
|
2171
|
+
/* @__PURE__ */ jsxs7("div", { className: "eb:relative", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx7(Search2, { className: "eb:pointer-events-none eb:absolute eb:top-1/2 eb:left-2.5 eb:size-3.5 eb:-translate-y-1/2 eb:text-foreground-muted" }),
|
|
2173
|
+
/* @__PURE__ */ jsx7(
|
|
2067
2174
|
Input,
|
|
2068
2175
|
{
|
|
2069
2176
|
type: "search",
|
|
@@ -2074,23 +2181,31 @@ function TemplateGalleryButton({ context }) {
|
|
|
2074
2181
|
className: "eb:pr-8 eb:pl-8 eb:[&::-webkit-search-cancel-button]:hidden"
|
|
2075
2182
|
}
|
|
2076
2183
|
),
|
|
2077
|
-
query && /* @__PURE__ */
|
|
2184
|
+
query && /* @__PURE__ */ jsx7(
|
|
2078
2185
|
"button",
|
|
2079
2186
|
{
|
|
2080
2187
|
type: "button",
|
|
2081
2188
|
onClick: () => setQuery(""),
|
|
2082
2189
|
"aria-label": t("Clear the search"),
|
|
2083
2190
|
className: "eb:absolute eb:top-1/2 eb:right-2.5 eb:-translate-y-1/2 eb:cursor-pointer",
|
|
2084
|
-
children: /* @__PURE__ */
|
|
2191
|
+
children: /* @__PURE__ */ jsx7(X, { className: "eb:size-3.5 eb:text-foreground-muted eb:hover:text-foreground" })
|
|
2085
2192
|
}
|
|
2086
2193
|
)
|
|
2087
2194
|
] }),
|
|
2088
|
-
tags.length > 0 && /* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2090
|
-
|
|
2195
|
+
tags.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "eb:flex eb:items-start eb:gap-1.5", children: [
|
|
2196
|
+
/* @__PURE__ */ jsx7("div", { role: "group", "aria-label": t("Filter by tag"), className: "eb:flex eb:min-w-0 eb:flex-1 eb:flex-wrap eb:gap-1.5", "data-testid": "eb-gallery-tags", children: tags.map((tag) => /* @__PURE__ */ jsx7(FilterChip, { pressed: chosen.has(tag), onClick: () => toggle(tag), children: tag }, tag)) }),
|
|
2197
|
+
/* @__PURE__ */ jsx7(
|
|
2198
|
+
FilterReset,
|
|
2199
|
+
{
|
|
2200
|
+
label: t("Clear the tag filters"),
|
|
2201
|
+
active: chosen.size > 0,
|
|
2202
|
+
onClick: () => setChosen(/* @__PURE__ */ new Set()),
|
|
2203
|
+
"data-testid": "eb-gallery-tag-reset"
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2091
2206
|
] })
|
|
2092
2207
|
] }),
|
|
2093
|
-
/* @__PURE__ */
|
|
2208
|
+
/* @__PURE__ */ jsx7("div", { className: "eb:-m-1 eb:min-h-0 eb:flex-1 eb:overflow-y-auto eb:p-1", children: shown.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "eb:m-0 eb:py-10 eb:text-center eb:text-[13px] eb:text-foreground-muted", children: t("Nothing matches \u201C{query}\u201D.", { query: query.trim() }) }) : /* @__PURE__ */ jsx7("ul", { className: "eb:m-0 eb:grid eb:list-none eb:grid-cols-1 eb:gap-3 eb:p-0 eb:sm:grid-cols-2 eb:md:grid-cols-3", children: shown.map((card) => /* @__PURE__ */ jsx7("li", { className: "eb:min-w-0", children: /* @__PURE__ */ jsxs7(
|
|
2094
2209
|
"button",
|
|
2095
2210
|
{
|
|
2096
2211
|
type: "button",
|
|
@@ -2099,10 +2214,10 @@ function TemplateGalleryButton({ context }) {
|
|
|
2099
2214
|
title: card.description,
|
|
2100
2215
|
className: "eb:group eb:flex eb:h-full eb:w-full eb:flex-col eb:gap-2 eb:rounded-lg2 eb:border eb:border-border eb:bg-background eb:p-2 eb:text-left eb:transition-colors eb:hover:border-primary/50 eb:hover:bg-primary/5 eb:focus-visible:outline-none eb:focus-visible:ring-2 eb:focus-visible:ring-ring/50",
|
|
2101
2216
|
children: [
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2217
|
+
/* @__PURE__ */ jsx7(Thumbnail, { html: card.html, title: card.name }),
|
|
2218
|
+
/* @__PURE__ */ jsxs7("span", { className: "eb:block eb:min-w-0 eb:px-1", children: [
|
|
2219
|
+
/* @__PURE__ */ jsx7("span", { className: cn(FADE_LINE, "eb:text-[13px] eb:font-medium eb:text-foreground"), children: card.name }),
|
|
2220
|
+
/* @__PURE__ */ jsx7("span", { className: cn(FADE_LINE, "eb:text-[12px] eb:text-foreground-muted"), children: card.description })
|
|
2106
2221
|
] })
|
|
2107
2222
|
]
|
|
2108
2223
|
}
|
|
@@ -2123,14 +2238,14 @@ var templatesFeature = {
|
|
|
2123
2238
|
};
|
|
2124
2239
|
|
|
2125
2240
|
// src/features/brand/BrandButton.jsx
|
|
2126
|
-
import { useEffect as useEffect4, useRef as useRef2, useState as
|
|
2241
|
+
import { useEffect as useEffect4, useRef as useRef2, useState as useState9 } from "react";
|
|
2127
2242
|
import { Globe, ImageOff, Loader2 as Loader23, Palette, Trash2 as Trash22, TriangleAlert, Upload, WandSparkles } from "lucide-react";
|
|
2128
2243
|
|
|
2129
2244
|
// src/ui/primitives/color-picker.jsx
|
|
2130
|
-
import { useState as
|
|
2245
|
+
import { useState as useState8 } from "react";
|
|
2131
2246
|
import { HexAlphaColorPicker } from "react-colorful";
|
|
2132
2247
|
import { Check } from "lucide-react";
|
|
2133
|
-
import { jsx as
|
|
2248
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2134
2249
|
var PRESET_COLORS = [
|
|
2135
2250
|
"#8B5CF6",
|
|
2136
2251
|
"#A78BFA",
|
|
@@ -2161,20 +2276,20 @@ function normalizeHex(v) {
|
|
|
2161
2276
|
}
|
|
2162
2277
|
function ColorPicker({ value, onChange, id, className, placeholder = "" }) {
|
|
2163
2278
|
const t = useT();
|
|
2164
|
-
const [open, setOpen] =
|
|
2279
|
+
const [open, setOpen] = useState8(false);
|
|
2165
2280
|
const valid = isValidHex(value);
|
|
2166
2281
|
const normalized = valid ? normalizeHex(value) : "";
|
|
2167
2282
|
const emit = (hex) => onChange(normalizeHex(hex));
|
|
2168
|
-
return /* @__PURE__ */
|
|
2169
|
-
/* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2283
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("eb:flex eb:gap-2", className), children: [
|
|
2284
|
+
/* @__PURE__ */ jsxs8(Popover, { open, onOpenChange: setOpen, children: [
|
|
2285
|
+
/* @__PURE__ */ jsx8(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
2171
2286
|
"button",
|
|
2172
2287
|
{
|
|
2173
2288
|
type: "button",
|
|
2174
2289
|
"aria-label": t("Pick a colour"),
|
|
2175
2290
|
title: t("Pick a colour"),
|
|
2176
2291
|
className: "eb-checker eb:relative eb:h-8 eb:w-[44px] eb:shrink-0 eb:overflow-hidden eb:rounded-lg2 eb:shadow-sm eb:ring-1 eb:ring-black/10 eb:ring-inset eb:transition-transform eb:hover:scale-[1.04]",
|
|
2177
|
-
children: /* @__PURE__ */
|
|
2292
|
+
children: /* @__PURE__ */ jsx8(
|
|
2178
2293
|
"span",
|
|
2179
2294
|
{
|
|
2180
2295
|
className: "eb:absolute eb:inset-0",
|
|
@@ -2184,18 +2299,18 @@ function ColorPicker({ value, onChange, id, className, placeholder = "" }) {
|
|
|
2184
2299
|
)
|
|
2185
2300
|
}
|
|
2186
2301
|
) }),
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
2190
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsxs8(PopoverContent, { align: "start", className: "eb:w-64 eb:space-y-3 eb:p-3", children: [
|
|
2303
|
+
/* @__PURE__ */ jsx8("div", { className: "eb-picker", children: /* @__PURE__ */ jsx8(HexAlphaColorPicker, { color: valid ? value : FALLBACK_COLOR, onChange: emit }) }),
|
|
2304
|
+
/* @__PURE__ */ jsxs8("div", { className: "eb:flex eb:items-center eb:gap-2", children: [
|
|
2305
|
+
/* @__PURE__ */ jsx8(
|
|
2191
2306
|
"span",
|
|
2192
2307
|
{
|
|
2193
2308
|
className: "eb-checker eb:relative eb:size-8 eb:shrink-0 eb:overflow-hidden eb:rounded-lg2 eb:ring-1 eb:ring-black/10 eb:ring-inset",
|
|
2194
2309
|
"aria-hidden": true,
|
|
2195
|
-
children: /* @__PURE__ */
|
|
2310
|
+
children: /* @__PURE__ */ jsx8("span", { className: "eb:absolute eb:inset-0", style: { backgroundColor: valid ? value : "transparent" } })
|
|
2196
2311
|
}
|
|
2197
2312
|
),
|
|
2198
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsx8(
|
|
2199
2314
|
Input,
|
|
2200
2315
|
{
|
|
2201
2316
|
value: value || "",
|
|
@@ -2207,7 +2322,7 @@ function ColorPicker({ value, onChange, id, className, placeholder = "" }) {
|
|
|
2207
2322
|
}
|
|
2208
2323
|
)
|
|
2209
2324
|
] }),
|
|
2210
|
-
/* @__PURE__ */
|
|
2325
|
+
/* @__PURE__ */ jsx8("div", { className: "eb:grid eb:grid-cols-6 eb:gap-1.5 eb:border-t eb:border-border eb:pt-2.5", children: PRESET_COLORS.map((c) => /* @__PURE__ */ jsx8(
|
|
2211
2326
|
"button",
|
|
2212
2327
|
{
|
|
2213
2328
|
type: "button",
|
|
@@ -2216,13 +2331,13 @@ function ColorPicker({ value, onChange, id, className, placeholder = "" }) {
|
|
|
2216
2331
|
"aria-label": c,
|
|
2217
2332
|
className: "eb:relative eb:size-6 eb:rounded-lg2 eb:ring-1 eb:ring-black/10 eb:ring-inset eb:transition-transform eb:hover:scale-110",
|
|
2218
2333
|
style: { backgroundColor: c },
|
|
2219
|
-
children: normalized === c && /* @__PURE__ */
|
|
2334
|
+
children: normalized === c && /* @__PURE__ */ jsx8(Check, { className: "eb:absolute eb:inset-0 eb:m-auto eb:size-3.5 eb:text-white eb:drop-shadow-[0_1px_1px_rgba(0,0,0,0.6)]" })
|
|
2220
2335
|
},
|
|
2221
2336
|
c
|
|
2222
2337
|
)) })
|
|
2223
2338
|
] })
|
|
2224
2339
|
] }),
|
|
2225
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx8(
|
|
2226
2341
|
Input,
|
|
2227
2342
|
{
|
|
2228
2343
|
id,
|
|
@@ -2237,7 +2352,7 @@ function ColorPicker({ value, onChange, id, className, placeholder = "" }) {
|
|
|
2237
2352
|
}
|
|
2238
2353
|
|
|
2239
2354
|
// src/features/brand/BrandButton.jsx
|
|
2240
|
-
import { Fragment as Fragment4, jsx as
|
|
2355
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2241
2356
|
var toForm = (brand) => ({
|
|
2242
2357
|
name: brand.name || "",
|
|
2243
2358
|
logoUrl: brand.logoUrl || "",
|
|
@@ -2251,18 +2366,18 @@ var isLogoUrl = (url) => !url || url.startsWith("/") || /^https:\/\//i.test(url)
|
|
|
2251
2366
|
function BrandButton({ context }) {
|
|
2252
2367
|
const { editor, ready, storage, brand, setBrand, hostSender } = context;
|
|
2253
2368
|
const { t, notify } = useUi();
|
|
2254
|
-
const [open, setOpen] =
|
|
2255
|
-
const [form, setForm] =
|
|
2256
|
-
const [applyNow, setApplyNow] =
|
|
2257
|
-
const [reading, setReading] =
|
|
2258
|
-
const [readError, setReadError] =
|
|
2259
|
-
const [notes, setNotes] =
|
|
2369
|
+
const [open, setOpen] = useState9(false);
|
|
2370
|
+
const [form, setForm] = useState9(() => toForm(brand || {}));
|
|
2371
|
+
const [applyNow, setApplyNow] = useState9(true);
|
|
2372
|
+
const [reading, setReading] = useState9(false);
|
|
2373
|
+
const [readError, setReadError] = useState9("");
|
|
2374
|
+
const [notes, setNotes] = useState9(
|
|
2260
2375
|
/** @type {string[]} */
|
|
2261
2376
|
[]
|
|
2262
2377
|
);
|
|
2263
|
-
const [uploading, setUploading] =
|
|
2264
|
-
const [saving, setSaving] =
|
|
2265
|
-
const [error, setError] =
|
|
2378
|
+
const [uploading, setUploading] = useState9(false);
|
|
2379
|
+
const [saving, setSaving] = useState9(false);
|
|
2380
|
+
const [error, setError] = useState9("");
|
|
2266
2381
|
const abortRef = useRef2(
|
|
2267
2382
|
/** @type {AbortController|null} */
|
|
2268
2383
|
null
|
|
@@ -2384,11 +2499,11 @@ function BrandButton({ context }) {
|
|
|
2384
2499
|
}
|
|
2385
2500
|
};
|
|
2386
2501
|
const swatch = brand?.primary;
|
|
2387
|
-
return /* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2503
|
+
/* @__PURE__ */ jsxs9(Button, { variant: "outline", size: "sm-compact", disabled: !ready, onClick: openDialog, "data-testid": "eb-brand-button", children: [
|
|
2504
|
+
/* @__PURE__ */ jsx9(Palette, {}),
|
|
2390
2505
|
t("Brand"),
|
|
2391
|
-
swatch && /* @__PURE__ */
|
|
2506
|
+
swatch && /* @__PURE__ */ jsx9(
|
|
2392
2507
|
"span",
|
|
2393
2508
|
{
|
|
2394
2509
|
"aria-hidden": "true",
|
|
@@ -2397,18 +2512,18 @@ function BrandButton({ context }) {
|
|
|
2397
2512
|
}
|
|
2398
2513
|
)
|
|
2399
2514
|
] }),
|
|
2400
|
-
/* @__PURE__ */
|
|
2515
|
+
/* @__PURE__ */ jsx9(Dialog, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs9(
|
|
2401
2516
|
DialogContent,
|
|
2402
2517
|
{
|
|
2403
2518
|
className: "eb:flex eb:max-h-[calc(100dvh-2rem)] eb:flex-col eb:gap-0 eb:p-0 eb:sm:max-w-2xl",
|
|
2404
2519
|
"data-testid": "eb-brand",
|
|
2405
2520
|
children: [
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ jsxs9(DialogHeader, { className: "eb:gap-1.5 eb:px-6 eb:pt-6 eb:pb-4", children: [
|
|
2522
|
+
/* @__PURE__ */ jsx9(DialogTitle, { children: t("Your brand") }),
|
|
2523
|
+
/* @__PURE__ */ jsx9(DialogDescription, { children: t("Set it once: new emails, templates and blocks take your logo, colors and font.") })
|
|
2409
2524
|
] }),
|
|
2410
|
-
/* @__PURE__ */
|
|
2411
|
-
canRead && /* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:min-h-0 eb:flex-1 eb:overflow-y-auto eb:border-y eb:border-border eb:px-6 eb:py-5", children: [
|
|
2526
|
+
canRead && /* @__PURE__ */ jsxs9(
|
|
2412
2527
|
"form",
|
|
2413
2528
|
{
|
|
2414
2529
|
className: "eb:mb-5 eb:flex eb:flex-col eb:gap-1.5",
|
|
@@ -2417,11 +2532,11 @@ function BrandButton({ context }) {
|
|
|
2417
2532
|
readWebsite();
|
|
2418
2533
|
},
|
|
2419
2534
|
children: [
|
|
2420
|
-
/* @__PURE__ */
|
|
2421
|
-
/* @__PURE__ */
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2535
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-website", children: t("Your website") }),
|
|
2536
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-2 eb:sm:flex-row", children: [
|
|
2537
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:relative eb:min-w-0 eb:flex-1", children: [
|
|
2538
|
+
/* @__PURE__ */ jsx9(Globe, { className: "eb:pointer-events-none eb:absolute eb:top-1/2 eb:left-2.5 eb:size-3.5 eb:-translate-y-1/2 eb:text-foreground-muted", "aria-hidden": "true" }),
|
|
2539
|
+
/* @__PURE__ */ jsx9(
|
|
2425
2540
|
Input,
|
|
2426
2541
|
{
|
|
2427
2542
|
id: "eb-brand-website",
|
|
@@ -2435,28 +2550,28 @@ function BrandButton({ context }) {
|
|
|
2435
2550
|
}
|
|
2436
2551
|
)
|
|
2437
2552
|
] }),
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
reading ? /* @__PURE__ */
|
|
2553
|
+
/* @__PURE__ */ jsxs9(Button, { type: "submit", size: "sm", disabled: reading || !form.website.trim(), children: [
|
|
2554
|
+
reading ? /* @__PURE__ */ jsx9(Loader23, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx9(WandSparkles, {}),
|
|
2440
2555
|
t("Get my brand")
|
|
2441
2556
|
] })
|
|
2442
2557
|
] }),
|
|
2443
|
-
reading ? /* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2558
|
+
reading ? /* @__PURE__ */ jsx9("p", { role: "status", className: "eb:text-[12px] eb:text-foreground-muted", children: t("Reading the website\u2026") }) : readError ? /* @__PURE__ */ jsxs9("p", { role: "alert", className: "eb:flex eb:items-start eb:gap-1.5 eb:text-[12px] eb:text-destructive", children: [
|
|
2559
|
+
/* @__PURE__ */ jsx9(TriangleAlert, { className: "eb:mt-px eb:size-3.5 eb:shrink-0", "aria-hidden": "true" }),
|
|
2445
2560
|
readError
|
|
2446
|
-
] }) : notes.length ? /* @__PURE__ */
|
|
2561
|
+
] }) : notes.length ? /* @__PURE__ */ jsx9("ul", { className: "eb:flex eb:flex-col eb:gap-1 eb:text-[12px] eb:text-foreground-muted", "data-testid": "eb-brand-notes", children: notes.map((note) => /* @__PURE__ */ jsx9("li", { children: t(BRAND_NOTES[note]) }, note)) }) : /* @__PURE__ */ jsx9("p", { className: "eb:text-[12px] eb:text-foreground-muted", children: t("The logo, colors and font are read from it. You can change them before saving.") })
|
|
2447
2562
|
]
|
|
2448
2563
|
}
|
|
2449
2564
|
),
|
|
2450
|
-
/* @__PURE__ */
|
|
2451
|
-
/* @__PURE__ */
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
canUpload && /* @__PURE__ */
|
|
2459
|
-
/* @__PURE__ */
|
|
2565
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:grid eb:gap-6 eb:sm:grid-cols-[minmax(0,1fr)_220px]", children: [
|
|
2566
|
+
/* @__PURE__ */ jsxs9("fieldset", { disabled: reading, className: "eb:m-0 eb:flex eb:min-w-0 eb:flex-col eb:gap-4 eb:border-0 eb:p-0", children: [
|
|
2567
|
+
/* @__PURE__ */ jsx9("legend", { className: "eb:sr-only", children: t("Your brand") }),
|
|
2568
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2569
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-logo", children: t("Logo") }),
|
|
2570
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:items-center eb:gap-3", children: [
|
|
2571
|
+
/* @__PURE__ */ jsx9("div", { className: "eb-checker eb:flex eb:h-12 eb:w-24 eb:shrink-0 eb:items-center eb:justify-center eb:overflow-hidden eb:rounded-lg2 eb:ring-1 eb:ring-border eb:ring-inset", children: form.logoUrl && !logoInvalid ? /* @__PURE__ */ jsx9("img", { src: form.logoUrl, alt: t("Logo"), className: "eb:max-h-10 eb:max-w-20 eb:object-contain" }) : /* @__PURE__ */ jsx9(ImageOff, { className: "eb:size-4 eb:text-foreground-muted", "aria-hidden": "true" }) }),
|
|
2572
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-wrap eb:gap-2", children: [
|
|
2573
|
+
canUpload && /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2574
|
+
/* @__PURE__ */ jsx9(
|
|
2460
2575
|
"input",
|
|
2461
2576
|
{
|
|
2462
2577
|
ref: fileRef,
|
|
@@ -2469,18 +2584,18 @@ function BrandButton({ context }) {
|
|
|
2469
2584
|
onChange: pickLogo
|
|
2470
2585
|
}
|
|
2471
2586
|
),
|
|
2472
|
-
/* @__PURE__ */
|
|
2473
|
-
uploading ? /* @__PURE__ */
|
|
2587
|
+
/* @__PURE__ */ jsxs9(Button, { type: "button", variant: "outline", size: "sm", disabled: uploading, onClick: () => fileRef.current?.click(), children: [
|
|
2588
|
+
uploading ? /* @__PURE__ */ jsx9(Loader23, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx9(Upload, {}),
|
|
2474
2589
|
t("Upload")
|
|
2475
2590
|
] })
|
|
2476
2591
|
] }),
|
|
2477
|
-
form.logoUrl && /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2592
|
+
form.logoUrl && /* @__PURE__ */ jsxs9(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => set({ logoUrl: "", logoWidth: 0 }), children: [
|
|
2593
|
+
/* @__PURE__ */ jsx9(Trash22, {}),
|
|
2479
2594
|
t("Remove")
|
|
2480
2595
|
] })
|
|
2481
2596
|
] })
|
|
2482
2597
|
] }),
|
|
2483
|
-
/* @__PURE__ */
|
|
2598
|
+
/* @__PURE__ */ jsx9(
|
|
2484
2599
|
Input,
|
|
2485
2600
|
{
|
|
2486
2601
|
id: "eb-brand-logo",
|
|
@@ -2491,11 +2606,11 @@ function BrandButton({ context }) {
|
|
|
2491
2606
|
className: "eb:text-[12px]"
|
|
2492
2607
|
}
|
|
2493
2608
|
),
|
|
2494
|
-
logoInvalid && /* @__PURE__ */
|
|
2609
|
+
logoInvalid && /* @__PURE__ */ jsx9("p", { className: "eb:text-[12px] eb:text-destructive", children: t("An https:// address is required") })
|
|
2495
2610
|
] }),
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2612
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-name", children: t("Company name") }),
|
|
2613
|
+
/* @__PURE__ */ jsx9(
|
|
2499
2614
|
Input,
|
|
2500
2615
|
{
|
|
2501
2616
|
id: "eb-brand-name",
|
|
@@ -2506,36 +2621,36 @@ function BrandButton({ context }) {
|
|
|
2506
2621
|
}
|
|
2507
2622
|
)
|
|
2508
2623
|
] }),
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
/* @__PURE__ */
|
|
2624
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:grid eb:gap-4 eb:sm:grid-cols-2", children: [
|
|
2625
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2626
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-primary", children: t("Main color") }),
|
|
2627
|
+
/* @__PURE__ */ jsx9(ColorPicker, { id: "eb-brand-primary", value: form.primary, onChange: (primary) => set({ primary }), placeholder: PALETTE.navy }),
|
|
2628
|
+
/* @__PURE__ */ jsx9("p", { className: "eb:text-[11px] eb:text-foreground-muted", children: t("Buttons, banners, links") })
|
|
2514
2629
|
] }),
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2631
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-heading", children: t("Headings color") }),
|
|
2632
|
+
/* @__PURE__ */ jsx9(ColorPicker, { id: "eb-brand-heading", value: form.heading, onChange: (heading2) => set({ heading: heading2 }), placeholder: PALETTE.navy })
|
|
2518
2633
|
] })
|
|
2519
2634
|
] }),
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2636
|
+
/* @__PURE__ */ jsx9(Label, { htmlFor: "eb-brand-font", children: t("Font") }),
|
|
2637
|
+
/* @__PURE__ */ jsxs9(Select, { value: form.font || FONT_STACK, onValueChange: (font) => set({ font }), children: [
|
|
2638
|
+
/* @__PURE__ */ jsx9(SelectTrigger, { id: "eb-brand-font", children: /* @__PURE__ */ jsx9(SelectValue, {}) }),
|
|
2639
|
+
/* @__PURE__ */ jsx9(SelectContent, { children: FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx9(SelectItem, { value: option.value, children: /* @__PURE__ */ jsx9("span", { style: { fontFamily: option.value }, children: option.label }) }, option.value)) })
|
|
2525
2640
|
] })
|
|
2526
2641
|
] })
|
|
2527
2642
|
] }),
|
|
2528
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsx9(BrandPreview, { brand: draft, fallbackName: hostSender?.name || t("Your company") })
|
|
2529
2644
|
] })
|
|
2530
2645
|
] }),
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
error && /* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2646
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-3 eb:px-6 eb:pt-3 eb:pb-6", children: [
|
|
2647
|
+
error && /* @__PURE__ */ jsxs9("p", { role: "alert", className: "eb:flex eb:items-start eb:gap-1.5 eb:text-[12px] eb:text-destructive", children: [
|
|
2648
|
+
/* @__PURE__ */ jsx9(TriangleAlert, { className: "eb:mt-px eb:size-3.5 eb:shrink-0", "aria-hidden": "true" }),
|
|
2534
2649
|
error
|
|
2535
2650
|
] }),
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-3 eb:sm:flex-row eb:sm:items-center", children: [
|
|
2652
|
+
/* @__PURE__ */ jsxs9("label", { className: "eb:flex eb:cursor-pointer eb:items-center eb:gap-2 eb:text-[13px] eb:sm:mr-auto", children: [
|
|
2653
|
+
/* @__PURE__ */ jsx9(
|
|
2539
2654
|
"input",
|
|
2540
2655
|
{
|
|
2541
2656
|
type: "checkbox",
|
|
@@ -2547,10 +2662,10 @@ function BrandButton({ context }) {
|
|
|
2547
2662
|
),
|
|
2548
2663
|
t("Also apply to this email")
|
|
2549
2664
|
] }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2551
|
-
/* @__PURE__ */
|
|
2552
|
-
/* @__PURE__ */
|
|
2553
|
-
saving && /* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:justify-end eb:gap-2", children: [
|
|
2666
|
+
/* @__PURE__ */ jsx9(Button, { variant: "outline", size: "sm", onClick: () => close(false), children: t("Cancel") }),
|
|
2667
|
+
/* @__PURE__ */ jsxs9(Button, { size: "sm", onClick: save, disabled: saving || reading || uploading || logoInvalid, "data-testid": "eb-brand-save", children: [
|
|
2668
|
+
saving && /* @__PURE__ */ jsx9(Loader23, { className: "eb:animate-spin" }),
|
|
2554
2669
|
t("Save")
|
|
2555
2670
|
] })
|
|
2556
2671
|
] })
|
|
@@ -2569,30 +2684,30 @@ function BrandPreview({ brand, fallbackName }) {
|
|
|
2569
2684
|
const link2 = contrastRatio(primary, PALETTE.white) >= 3 ? primary : heading2;
|
|
2570
2685
|
const font = brand.font || FONT_STACK;
|
|
2571
2686
|
const name = brand.name || fallbackName;
|
|
2572
|
-
return /* @__PURE__ */
|
|
2573
|
-
/* @__PURE__ */
|
|
2574
|
-
/* @__PURE__ */
|
|
2687
|
+
return /* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5", children: [
|
|
2688
|
+
/* @__PURE__ */ jsx9("span", { className: "eb:text-[12px] eb:font-medium eb:text-foreground-muted", children: t("Preview") }),
|
|
2689
|
+
/* @__PURE__ */ jsx9(
|
|
2575
2690
|
"div",
|
|
2576
2691
|
{
|
|
2577
2692
|
className: "eb:overflow-hidden eb:rounded-lg2 eb:p-2.5 eb:ring-1 eb:ring-border",
|
|
2578
2693
|
style: { backgroundColor: PALETTE.canvas, fontFamily: font },
|
|
2579
2694
|
"data-testid": "eb-brand-preview",
|
|
2580
2695
|
"aria-hidden": "true",
|
|
2581
|
-
children: /* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2585
|
-
/* @__PURE__ */
|
|
2696
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "eb:overflow-hidden eb:rounded-[3px]", style: { backgroundColor: PALETTE.white }, children: [
|
|
2697
|
+
/* @__PURE__ */ jsx9("div", { className: "eb:px-3 eb:pt-3 eb:pb-2", children: brand.logoUrl ? /* @__PURE__ */ jsx9("img", { src: brand.logoUrl, alt: "", style: { width: Math.round((brand.logoWidth || 140) * 0.45), maxWidth: "100%" } }) : /* @__PURE__ */ jsx9("span", { className: "eb:text-[11px] eb:font-bold", style: { color: PALETTE.ink }, children: name }) }),
|
|
2698
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:px-3 eb:py-4 eb:text-center", style: { backgroundColor: primary, color: onPrimary }, children: [
|
|
2699
|
+
/* @__PURE__ */ jsx9("div", { className: "eb:text-[13px] eb:leading-tight eb:font-bold", children: t("Big news") }),
|
|
2700
|
+
/* @__PURE__ */ jsx9("div", { className: "eb:mt-1 eb:text-[9px] eb:opacity-90", children: t("A short line under the title.") })
|
|
2586
2701
|
] }),
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:flex eb:flex-col eb:gap-1.5 eb:px-3 eb:py-3", children: [
|
|
2703
|
+
/* @__PURE__ */ jsx9("div", { className: "eb:text-[11px] eb:leading-tight eb:font-bold", style: { color: heading2 }, children: t("A headline") }),
|
|
2704
|
+
/* @__PURE__ */ jsxs9("div", { className: "eb:text-[9px] eb:leading-snug", style: { color: PALETTE.ink }, children: [
|
|
2590
2705
|
t("Some text, with"),
|
|
2591
2706
|
" ",
|
|
2592
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsx9("span", { className: "eb:underline", style: { color: link2 }, children: t("a link") }),
|
|
2593
2708
|
"."
|
|
2594
2709
|
] }),
|
|
2595
|
-
/* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ jsx9(
|
|
2596
2711
|
"span",
|
|
2597
2712
|
{
|
|
2598
2713
|
className: cn("eb:mt-1 eb:self-start eb:rounded-[3px] eb:px-2.5 eb:py-1 eb:text-[9px] eb:font-bold"),
|
|
@@ -2601,7 +2716,7 @@ function BrandPreview({ brand, fallbackName }) {
|
|
|
2601
2716
|
}
|
|
2602
2717
|
)
|
|
2603
2718
|
] }),
|
|
2604
|
-
/* @__PURE__ */
|
|
2719
|
+
/* @__PURE__ */ jsx9("div", { className: "eb:px-3 eb:pb-2.5 eb:text-center eb:text-[7px]", style: { color: "#6d7484" }, children: name })
|
|
2605
2720
|
] })
|
|
2606
2721
|
}
|
|
2607
2722
|
)
|
|
@@ -2912,6 +3027,9 @@ body { margin: 0; }
|
|
|
2912
3027
|
.eb-node a { cursor: pointer; }
|
|
2913
3028
|
[contenteditable="true"] { outline: none; cursor: text; caret-color: ${PRIMARY}; }
|
|
2914
3029
|
td.eb-placeholder { outline: 1.5px dashed #c3cad6; outline-offset: -8px; }
|
|
3030
|
+
.eb-preview-text[data-typing]::after { content: ''; display: inline-block; width: 1.5px; height: 1em; margin-left: 1px;
|
|
3031
|
+
vertical-align: -0.12em; background: currentColor; animation: eb-preview-caret 0.7s steps(1) infinite; }
|
|
3032
|
+
@keyframes eb-preview-caret { 50% { opacity: 0; } }
|
|
2915
3033
|
.eb-placeholder { user-select: none; }
|
|
2916
3034
|
|
|
2917
3035
|
#eb-ui { position: absolute; top: 0; left: 0; width: 0; height: 0; z-index: 2147483000;
|
|
@@ -3196,6 +3314,7 @@ function createCanvasView(options) {
|
|
|
3196
3314
|
}
|
|
3197
3315
|
syncAttributes(doc.body, parsed.body);
|
|
3198
3316
|
morphChildren(doc.body, parsed.body, (element) => element === editingEl);
|
|
3317
|
+
if (preview && !preview.el.isConnected) dropPreview();
|
|
3199
3318
|
if (editingId && editingEl && !editingEl.isConnected) {
|
|
3200
3319
|
const again = editableOf(editingId);
|
|
3201
3320
|
if (again) {
|
|
@@ -3355,6 +3474,7 @@ function createCanvasView(options) {
|
|
|
3355
3474
|
function startEditing(id, at = null) {
|
|
3356
3475
|
if (editingId === id) return;
|
|
3357
3476
|
finishEditing();
|
|
3477
|
+
dropPreview();
|
|
3358
3478
|
const el = editableOf(id);
|
|
3359
3479
|
if (!el) return;
|
|
3360
3480
|
editingId = id;
|
|
@@ -3371,10 +3491,18 @@ function createCanvasView(options) {
|
|
|
3371
3491
|
refreshOverlays();
|
|
3372
3492
|
}
|
|
3373
3493
|
function contentOfEditing() {
|
|
3374
|
-
|
|
3494
|
+
if (!editingEl) return "";
|
|
3495
|
+
let source = editingEl;
|
|
3496
|
+
if (preview && editingEl.contains(preview.el)) {
|
|
3497
|
+
source = /** @type {HTMLElement} */
|
|
3498
|
+
editingEl.cloneNode(true);
|
|
3499
|
+
source.querySelectorAll(`.${PREVIEW_CLASS}`).forEach((el) => el.remove());
|
|
3500
|
+
}
|
|
3501
|
+
return cleanRichText(source.innerHTML, doc);
|
|
3375
3502
|
}
|
|
3376
3503
|
function finishEditing() {
|
|
3377
3504
|
if (!editingId || !editingEl) return;
|
|
3505
|
+
dropPreview();
|
|
3378
3506
|
const id = editingId;
|
|
3379
3507
|
const html = contentOfEditing();
|
|
3380
3508
|
editingEl.removeAttribute("contenteditable");
|
|
@@ -3430,6 +3558,90 @@ function createCanvasView(options) {
|
|
|
3430
3558
|
} else placeCaret(null);
|
|
3431
3559
|
return true;
|
|
3432
3560
|
}
|
|
3561
|
+
let preview = null;
|
|
3562
|
+
const PREVIEW_CLASS = "eb-preview-text";
|
|
3563
|
+
function previewSpot() {
|
|
3564
|
+
if (editingEl) {
|
|
3565
|
+
const range = savedRange && editingEl.contains(savedRange.commonAncestorContainer) ? savedRange.cloneRange() : null;
|
|
3566
|
+
if (range) {
|
|
3567
|
+
range.collapse(false);
|
|
3568
|
+
return { range, prefix: "" };
|
|
3569
|
+
}
|
|
3570
|
+
return { parent: editingEl, prefix: "" };
|
|
3571
|
+
}
|
|
3572
|
+
const tag = selectedId ? info(selectedId)?.tag : null;
|
|
3573
|
+
if (!selectedId || tag !== "mj-text" && tag !== "mj-button") return null;
|
|
3574
|
+
const parent = tag === "mj-text" ? editableOf(selectedId) : elementOf(selectedId)?.querySelector("a, p");
|
|
3575
|
+
return parent ? { parent, prefix: " " } : null;
|
|
3576
|
+
}
|
|
3577
|
+
function stepPreview() {
|
|
3578
|
+
if (!preview) return;
|
|
3579
|
+
const current = preview;
|
|
3580
|
+
const { shown, target } = current;
|
|
3581
|
+
const next = !target.startsWith(shown) ? shown.slice(0, -1) : shown.length < target.length ? target.slice(0, shown.length + 1) : null;
|
|
3582
|
+
if (next === null) {
|
|
3583
|
+
current.timer = 0;
|
|
3584
|
+
current.el.removeAttribute("data-typing");
|
|
3585
|
+
if (!target) dropPreview();
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
current.shown = next;
|
|
3589
|
+
current.el.textContent = next;
|
|
3590
|
+
current.el.setAttribute("data-typing", "");
|
|
3591
|
+
current.timer = win.setTimeout(stepPreview, next.length < shown.length ? 12 : 22);
|
|
3592
|
+
scheduleOverlays();
|
|
3593
|
+
}
|
|
3594
|
+
function animatePreview() {
|
|
3595
|
+
if (!preview || preview.timer) return;
|
|
3596
|
+
if (win.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
|
|
3597
|
+
preview.shown = preview.target;
|
|
3598
|
+
preview.el.textContent = preview.target;
|
|
3599
|
+
if (!preview.target) dropPreview();
|
|
3600
|
+
scheduleOverlays();
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
stepPreview();
|
|
3604
|
+
}
|
|
3605
|
+
function previewText(text) {
|
|
3606
|
+
if (!text) {
|
|
3607
|
+
hidePreview();
|
|
3608
|
+
return false;
|
|
3609
|
+
}
|
|
3610
|
+
if (preview && !preview.el.isConnected) dropPreview();
|
|
3611
|
+
if (!preview) {
|
|
3612
|
+
const spot = previewSpot();
|
|
3613
|
+
if (!spot) return false;
|
|
3614
|
+
const el = doc.createElement("span");
|
|
3615
|
+
el.className = PREVIEW_CLASS;
|
|
3616
|
+
el.setAttribute("contenteditable", "false");
|
|
3617
|
+
el.setAttribute("data-testid", "eb-canvas-preview");
|
|
3618
|
+
if (spot.range) spot.range.insertNode(el);
|
|
3619
|
+
else spot.parent?.appendChild(el);
|
|
3620
|
+
preview = { el, prefix: spot.prefix, shown: "", target: "", timer: 0 };
|
|
3621
|
+
}
|
|
3622
|
+
preview.target = preview.prefix + text;
|
|
3623
|
+
animatePreview();
|
|
3624
|
+
return true;
|
|
3625
|
+
}
|
|
3626
|
+
function hidePreview() {
|
|
3627
|
+
if (!preview) return;
|
|
3628
|
+
preview.target = "";
|
|
3629
|
+
animatePreview();
|
|
3630
|
+
}
|
|
3631
|
+
function dropPreview() {
|
|
3632
|
+
if (!preview) return;
|
|
3633
|
+
win.clearTimeout(preview.timer);
|
|
3634
|
+
preview.el.remove();
|
|
3635
|
+
preview = null;
|
|
3636
|
+
scheduleOverlays();
|
|
3637
|
+
}
|
|
3638
|
+
function settlePreview() {
|
|
3639
|
+
if (!preview) return;
|
|
3640
|
+
win.clearTimeout(preview.timer);
|
|
3641
|
+
preview.el.textContent = preview.target;
|
|
3642
|
+
preview.el.removeAttribute("data-typing");
|
|
3643
|
+
preview = null;
|
|
3644
|
+
}
|
|
3433
3645
|
const TEXT_BUTTONS = [
|
|
3434
3646
|
["bold", t("Bold (Ctrl+B)")],
|
|
3435
3647
|
["italic", t("Italic (Ctrl+I)")],
|
|
@@ -3751,6 +3963,7 @@ function createCanvasView(options) {
|
|
|
3751
3963
|
/** @param {string|null} id */
|
|
3752
3964
|
setSelection(id) {
|
|
3753
3965
|
if (editingId && editingId !== id) finishEditing();
|
|
3966
|
+
if (id !== selectedId) dropPreview();
|
|
3754
3967
|
selectedId = id;
|
|
3755
3968
|
refreshOverlays();
|
|
3756
3969
|
if (id) {
|
|
@@ -3783,6 +3996,7 @@ function createCanvasView(options) {
|
|
|
3783
3996
|
editingId: () => editingId,
|
|
3784
3997
|
/** @param {string} text */
|
|
3785
3998
|
insertText(text) {
|
|
3999
|
+
dropPreview();
|
|
3786
4000
|
if (!restoreCaret()) return false;
|
|
3787
4001
|
doc.execCommand("insertText", false, text);
|
|
3788
4002
|
options.onEditInput(
|
|
@@ -3794,6 +4008,7 @@ function createCanvasView(options) {
|
|
|
3794
4008
|
},
|
|
3795
4009
|
/** @param {string} html */
|
|
3796
4010
|
insertHtml(html) {
|
|
4011
|
+
dropPreview();
|
|
3797
4012
|
if (!restoreCaret()) return false;
|
|
3798
4013
|
doc.execCommand("insertHTML", false, html);
|
|
3799
4014
|
options.onEditInput(
|
|
@@ -3803,8 +4018,12 @@ function createCanvasView(options) {
|
|
|
3803
4018
|
);
|
|
3804
4019
|
return true;
|
|
3805
4020
|
},
|
|
4021
|
+
previewText,
|
|
4022
|
+
hidePreview,
|
|
4023
|
+
settlePreview,
|
|
3806
4024
|
destroy() {
|
|
3807
4025
|
destroyed = true;
|
|
4026
|
+
dropPreview();
|
|
3808
4027
|
cancelDrag();
|
|
3809
4028
|
resizeObserver.disconnect();
|
|
3810
4029
|
if (overlayFrame) win.cancelAnimationFrame(overlayFrame);
|
|
@@ -4349,9 +4568,16 @@ function createNativeAdapter({ loadCompiler = defaultLoadCompiler } = {}) {
|
|
|
4349
4568
|
if (view.editingId()) return view.insertText(text);
|
|
4350
4569
|
const node = selectedId ? findNode(root, selectedId) : null;
|
|
4351
4570
|
if (!node || !TEXT_TAGS.has(node.tag)) return false;
|
|
4571
|
+
view.settlePreview();
|
|
4352
4572
|
commit(setContent(root, node.id, `${node.content || ""} ${escapeText(text)}`));
|
|
4353
4573
|
return true;
|
|
4354
4574
|
},
|
|
4575
|
+
previewText(text) {
|
|
4576
|
+
return view ? view.previewText(text) : false;
|
|
4577
|
+
},
|
|
4578
|
+
clearPreview() {
|
|
4579
|
+
view?.hidePreview();
|
|
4580
|
+
},
|
|
4355
4581
|
insertLink(href, label) {
|
|
4356
4582
|
if (!view || !root) return false;
|
|
4357
4583
|
const safeHref = escapeText(href).replace(/"/g, """);
|
|
@@ -4447,7 +4673,7 @@ function createDefaultEmailEditor(options = {}) {
|
|
|
4447
4673
|
|
|
4448
4674
|
// src/ui/EmailCanvas.jsx
|
|
4449
4675
|
import { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
4450
|
-
import { jsx as
|
|
4676
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
4451
4677
|
function EmailCanvas({ editor, document = null, onReady, onError, className }) {
|
|
4452
4678
|
const ref = useRef3(null);
|
|
4453
4679
|
const documentRef = useRef3(document);
|
|
@@ -4466,15 +4692,15 @@ function EmailCanvas({ editor, document = null, onReady, onError, className }) {
|
|
|
4466
4692
|
editor.destroy();
|
|
4467
4693
|
};
|
|
4468
4694
|
}, [editor]);
|
|
4469
|
-
return /* @__PURE__ */
|
|
4695
|
+
return /* @__PURE__ */ jsx10("div", { ref, className: cn("eb-canvas eb:h-full eb:w-full", className), "data-testid": "eb-canvas" });
|
|
4470
4696
|
}
|
|
4471
4697
|
|
|
4472
4698
|
// src/ui/EmailBuilder.jsx
|
|
4473
|
-
import { useCallback as useCallback3, useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as
|
|
4699
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as useState14 } from "react";
|
|
4474
4700
|
import { AlertTriangle, Loader2 as Loader25, Plus as Plus2, Save, SlidersHorizontal } from "lucide-react";
|
|
4475
4701
|
|
|
4476
4702
|
// src/features/brand/useBrand.js
|
|
4477
|
-
import { useCallback, useEffect as useEffect6, useState as
|
|
4703
|
+
import { useCallback, useEffect as useEffect6, useState as useState10 } from "react";
|
|
4478
4704
|
var entries = /* @__PURE__ */ new WeakMap();
|
|
4479
4705
|
function brandOf(storage) {
|
|
4480
4706
|
let entry = entries.get(storage);
|
|
@@ -4495,7 +4721,7 @@ function brandOf(storage) {
|
|
|
4495
4721
|
return created;
|
|
4496
4722
|
}
|
|
4497
4723
|
function useBrand(storage) {
|
|
4498
|
-
const [brand, setState] =
|
|
4724
|
+
const [brand, setState] = useState10(() => brandOf(storage).value);
|
|
4499
4725
|
useEffect6(() => {
|
|
4500
4726
|
const entry = brandOf(storage);
|
|
4501
4727
|
setState(entry.value);
|
|
@@ -4624,7 +4850,7 @@ import {
|
|
|
4624
4850
|
Type
|
|
4625
4851
|
} from "lucide-react";
|
|
4626
4852
|
import { useRef as useRef4 } from "react";
|
|
4627
|
-
import { jsx as
|
|
4853
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4628
4854
|
var DRAG_THRESHOLD = 5;
|
|
4629
4855
|
var ICONS2 = {
|
|
4630
4856
|
Heading,
|
|
@@ -4650,7 +4876,7 @@ function BlockTile({ block, disabled, onAdd, onDragStart }) {
|
|
|
4650
4876
|
const t = useT();
|
|
4651
4877
|
const Icon = ICONS2[block.icon] || Square;
|
|
4652
4878
|
const press = useRef4(null);
|
|
4653
|
-
return /* @__PURE__ */
|
|
4879
|
+
return /* @__PURE__ */ jsx11(TooltipWrap, { label: block.description ? t(block.description) : block.description, children: /* @__PURE__ */ jsxs10(
|
|
4654
4880
|
"button",
|
|
4655
4881
|
{
|
|
4656
4882
|
type: "button",
|
|
@@ -4690,8 +4916,8 @@ function BlockTile({ block, disabled, onAdd, onDragStart }) {
|
|
|
4690
4916
|
disabled && "eb:cursor-not-allowed eb:opacity-50"
|
|
4691
4917
|
),
|
|
4692
4918
|
children: [
|
|
4693
|
-
/* @__PURE__ */
|
|
4694
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsx11(Icon, { className: "eb:h-5 eb:w-5 eb:text-foreground-lighter", "aria-hidden": "true" }),
|
|
4920
|
+
/* @__PURE__ */ jsx11("span", { className: "eb:text-[12px] eb:text-foreground", children: t(block.label) })
|
|
4695
4921
|
]
|
|
4696
4922
|
}
|
|
4697
4923
|
) });
|
|
@@ -4699,12 +4925,12 @@ function BlockTile({ block, disabled, onAdd, onDragStart }) {
|
|
|
4699
4925
|
function BlockSidebar({ editor, disabled = false, onAdded }) {
|
|
4700
4926
|
const t = useT();
|
|
4701
4927
|
const blocks = editor.listBlocks();
|
|
4702
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx11("aside", { "aria-label": t("Blocks"), className: "eb:min-h-0 eb:space-y-5 eb:overflow-y-auto eb:border-r eb:border-border eb:p-3", children: GROUPS2.map((group) => {
|
|
4703
4929
|
const items = blocks.filter((b) => b.kind === group.kind && b.mjml);
|
|
4704
4930
|
if (!items.length) return null;
|
|
4705
|
-
return /* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
4707
|
-
/* @__PURE__ */
|
|
4931
|
+
return /* @__PURE__ */ jsxs10("section", { className: "eb:space-y-2", children: [
|
|
4932
|
+
/* @__PURE__ */ jsx11(SectionLabel, { children: t(group.title) }),
|
|
4933
|
+
/* @__PURE__ */ jsx11("div", { className: "eb:grid eb:grid-cols-2 eb:gap-2", children: items.map((block) => /* @__PURE__ */ jsx11(
|
|
4708
4934
|
BlockTile,
|
|
4709
4935
|
{
|
|
4710
4936
|
block,
|
|
@@ -4722,15 +4948,15 @@ function BlockSidebar({ editor, disabled = false, onAdded }) {
|
|
|
4722
4948
|
|
|
4723
4949
|
// src/ui/ElementActions.jsx
|
|
4724
4950
|
import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Copy, Trash2 as Trash23 } from "lucide-react";
|
|
4725
|
-
import { jsx as
|
|
4951
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4726
4952
|
function ElementActions({ editor, selection }) {
|
|
4727
4953
|
const t = useT();
|
|
4728
4954
|
if (!selection || !selection.canRemove && !selection.canDuplicate) return null;
|
|
4729
4955
|
const horizontal = selection.tagName === "mj-column";
|
|
4730
4956
|
const [Prev, Next] = horizontal ? [ArrowLeft, ArrowRight] : [ArrowUp, ArrowDown];
|
|
4731
4957
|
const [prevLabel, nextLabel] = horizontal ? [t("Move left"), t("Move right")] : [t("Move up"), t("Move down")];
|
|
4732
|
-
return /* @__PURE__ */
|
|
4733
|
-
/* @__PURE__ */
|
|
4958
|
+
return /* @__PURE__ */ jsxs11("div", { className: "eb:flex eb:items-center eb:gap-0.5 eb:border-b eb:border-border eb:px-3 eb:py-1.5", role: "toolbar", "aria-label": t("Element actions"), children: [
|
|
4959
|
+
/* @__PURE__ */ jsx12(TooltipWrap, { label: prevLabel, children: /* @__PURE__ */ jsx12(
|
|
4734
4960
|
Button,
|
|
4735
4961
|
{
|
|
4736
4962
|
variant: "ghost",
|
|
@@ -4738,10 +4964,10 @@ function ElementActions({ editor, selection }) {
|
|
|
4738
4964
|
"aria-label": prevLabel,
|
|
4739
4965
|
disabled: !selection.canMoveUp,
|
|
4740
4966
|
onClick: () => editor.move(-1, selection.id),
|
|
4741
|
-
children: /* @__PURE__ */
|
|
4967
|
+
children: /* @__PURE__ */ jsx12(Prev, {})
|
|
4742
4968
|
}
|
|
4743
4969
|
) }),
|
|
4744
|
-
/* @__PURE__ */
|
|
4970
|
+
/* @__PURE__ */ jsx12(TooltipWrap, { label: nextLabel, children: /* @__PURE__ */ jsx12(
|
|
4745
4971
|
Button,
|
|
4746
4972
|
{
|
|
4747
4973
|
variant: "ghost",
|
|
@@ -4749,10 +4975,10 @@ function ElementActions({ editor, selection }) {
|
|
|
4749
4975
|
"aria-label": nextLabel,
|
|
4750
4976
|
disabled: !selection.canMoveDown,
|
|
4751
4977
|
onClick: () => editor.move(1, selection.id),
|
|
4752
|
-
children: /* @__PURE__ */
|
|
4978
|
+
children: /* @__PURE__ */ jsx12(Next, {})
|
|
4753
4979
|
}
|
|
4754
4980
|
) }),
|
|
4755
|
-
/* @__PURE__ */
|
|
4981
|
+
/* @__PURE__ */ jsx12(TooltipWrap, { label: t("Duplicate"), children: /* @__PURE__ */ jsx12(
|
|
4756
4982
|
Button,
|
|
4757
4983
|
{
|
|
4758
4984
|
variant: "ghost",
|
|
@@ -4760,10 +4986,10 @@ function ElementActions({ editor, selection }) {
|
|
|
4760
4986
|
"aria-label": t("Duplicate"),
|
|
4761
4987
|
disabled: !selection.canDuplicate,
|
|
4762
4988
|
onClick: () => editor.duplicate(selection.id),
|
|
4763
|
-
children: /* @__PURE__ */
|
|
4989
|
+
children: /* @__PURE__ */ jsx12(Copy, {})
|
|
4764
4990
|
}
|
|
4765
4991
|
) }),
|
|
4766
|
-
/* @__PURE__ */
|
|
4992
|
+
/* @__PURE__ */ jsx12(TooltipWrap, { label: t("Delete (Del)"), children: /* @__PURE__ */ jsx12(
|
|
4767
4993
|
Button,
|
|
4768
4994
|
{
|
|
4769
4995
|
variant: "ghost",
|
|
@@ -4772,7 +4998,7 @@ function ElementActions({ editor, selection }) {
|
|
|
4772
4998
|
disabled: !selection.canRemove,
|
|
4773
4999
|
onClick: () => editor.remove(selection.id),
|
|
4774
5000
|
className: "eb:ml-auto eb:text-foreground-muted eb:hover:bg-destructive/10 eb:hover:text-destructive",
|
|
4775
|
-
children: /* @__PURE__ */
|
|
5001
|
+
children: /* @__PURE__ */ jsx12(Trash23, {})
|
|
4776
5002
|
}
|
|
4777
5003
|
) })
|
|
4778
5004
|
] });
|
|
@@ -4783,9 +5009,9 @@ import { useMemo as useMemo4, useRef as useRef6 } from "react";
|
|
|
4783
5009
|
import { X as X2 } from "lucide-react";
|
|
4784
5010
|
|
|
4785
5011
|
// src/ui/fields.jsx
|
|
4786
|
-
import { useEffect as useEffect7, useRef as useRef5, useState as
|
|
5012
|
+
import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
|
|
4787
5013
|
import { AlignCenter, AlignJustify, AlignLeft, AlignRight, Loader2 as Loader24, Upload as Upload2 } from "lucide-react";
|
|
4788
|
-
import { Fragment as Fragment5, jsx as
|
|
5014
|
+
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4789
5015
|
var COLOR_DEBOUNCE_MS = 250;
|
|
4790
5016
|
function emailColor(value) {
|
|
4791
5017
|
const v = String(value || "").trim();
|
|
@@ -4794,7 +5020,7 @@ function emailColor(value) {
|
|
|
4794
5020
|
return null;
|
|
4795
5021
|
}
|
|
4796
5022
|
function useDraft(value, toDraft) {
|
|
4797
|
-
const [draft, setDraft] =
|
|
5023
|
+
const [draft, setDraft] = useState11(() => toDraft(value));
|
|
4798
5024
|
const ref = useRef5(null);
|
|
4799
5025
|
const convert = useRef5(toDraft);
|
|
4800
5026
|
convert.current = toDraft;
|
|
@@ -4807,10 +5033,10 @@ function useDraft(value, toDraft) {
|
|
|
4807
5033
|
}
|
|
4808
5034
|
var asText = (v) => v || "";
|
|
4809
5035
|
function FieldLabel({ id, children }) {
|
|
4810
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ jsx13(Label, { htmlFor: id, className: "eb:text-[12px] eb:font-normal eb:text-foreground-lighter", children });
|
|
4811
5037
|
}
|
|
4812
5038
|
function FieldError({ children }) {
|
|
4813
|
-
return children ? /* @__PURE__ */
|
|
5039
|
+
return children ? /* @__PURE__ */ jsx13("p", { className: "eb:text-[12px] eb:text-destructive", children }) : null;
|
|
4814
5040
|
}
|
|
4815
5041
|
function TextField({ id, property, value, fallback = "", onCommit, addon = null, error = null }) {
|
|
4816
5042
|
const t = useT();
|
|
@@ -4841,13 +5067,13 @@ function TextField({ id, property, value, fallback = "", onCommit, addon = null,
|
|
|
4841
5067
|
onKeyDown: keyDown,
|
|
4842
5068
|
"aria-invalid": invalid || void 0
|
|
4843
5069
|
};
|
|
4844
|
-
return /* @__PURE__ */
|
|
4845
|
-
/* @__PURE__ */
|
|
4846
|
-
property.type === "textarea" ? /* @__PURE__ */
|
|
4847
|
-
/* @__PURE__ */
|
|
5070
|
+
return /* @__PURE__ */ jsxs12("div", { ref, className: "eb:space-y-1.5", children: [
|
|
5071
|
+
/* @__PURE__ */ jsx13(FieldLabel, { id, children: t(property.label) }),
|
|
5072
|
+
property.type === "textarea" ? /* @__PURE__ */ jsx13(Textarea, { rows: 3, ...shared }) : addon ? /* @__PURE__ */ jsxs12("div", { className: "eb:flex eb:gap-2", children: [
|
|
5073
|
+
/* @__PURE__ */ jsx13(Input, { ...shared, className: "eb:min-w-0 eb:flex-1" }),
|
|
4848
5074
|
addon
|
|
4849
|
-
] }) : /* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
5075
|
+
] }) : /* @__PURE__ */ jsx13(Input, { ...shared }),
|
|
5076
|
+
/* @__PURE__ */ jsx13(FieldError, { children: invalid ? kind === "image" ? t("An https:// address is required") : t("Address not allowed") : error })
|
|
4851
5077
|
] });
|
|
4852
5078
|
}
|
|
4853
5079
|
function ImageField({ id, property, value, onCommit, services }) {
|
|
@@ -4856,8 +5082,8 @@ function ImageField({ id, property, value, onCommit, services }) {
|
|
|
4856
5082
|
/** @type {HTMLInputElement|null} */
|
|
4857
5083
|
null
|
|
4858
5084
|
);
|
|
4859
|
-
const [busy, setBusy] =
|
|
4860
|
-
const [error, setError] =
|
|
5085
|
+
const [busy, setBusy] = useState11(false);
|
|
5086
|
+
const [error, setError] = useState11(
|
|
4861
5087
|
/** @type {string|null} */
|
|
4862
5088
|
null
|
|
4863
5089
|
);
|
|
@@ -4879,8 +5105,8 @@ function ImageField({ id, property, value, onCommit, services }) {
|
|
|
4879
5105
|
setBusy(false);
|
|
4880
5106
|
}
|
|
4881
5107
|
};
|
|
4882
|
-
const addon = upload ? /* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
5108
|
+
const addon = upload ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
5109
|
+
/* @__PURE__ */ jsx13(
|
|
4884
5110
|
"input",
|
|
4885
5111
|
{
|
|
4886
5112
|
ref: inputRef,
|
|
@@ -4893,7 +5119,7 @@ function ImageField({ id, property, value, onCommit, services }) {
|
|
|
4893
5119
|
onChange: pick
|
|
4894
5120
|
}
|
|
4895
5121
|
),
|
|
4896
|
-
/* @__PURE__ */
|
|
5122
|
+
/* @__PURE__ */ jsxs12(
|
|
4897
5123
|
Button,
|
|
4898
5124
|
{
|
|
4899
5125
|
type: "button",
|
|
@@ -4902,13 +5128,13 @@ function ImageField({ id, property, value, onCommit, services }) {
|
|
|
4902
5128
|
disabled: busy,
|
|
4903
5129
|
onClick: () => inputRef.current?.click(),
|
|
4904
5130
|
children: [
|
|
4905
|
-
busy ? /* @__PURE__ */
|
|
5131
|
+
busy ? /* @__PURE__ */ jsx13(Loader24, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx13(Upload2, {}),
|
|
4906
5132
|
t("Upload")
|
|
4907
5133
|
]
|
|
4908
5134
|
}
|
|
4909
5135
|
)
|
|
4910
5136
|
] }) : null;
|
|
4911
|
-
return /* @__PURE__ */
|
|
5137
|
+
return /* @__PURE__ */ jsx13(TextField, { id, property, value, onCommit, addon, error });
|
|
4912
5138
|
}
|
|
4913
5139
|
var asNumber = (v) => {
|
|
4914
5140
|
const n = Number.parseFloat(String(v || ""));
|
|
@@ -4930,10 +5156,10 @@ function SizeField({ id, property, value, fallback = "", onCommit }) {
|
|
|
4930
5156
|
const next = `${n}${property.unit || "px"}`;
|
|
4931
5157
|
if (next !== value) onCommit(next);
|
|
4932
5158
|
};
|
|
4933
|
-
return /* @__PURE__ */
|
|
4934
|
-
/* @__PURE__ */
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
5159
|
+
return /* @__PURE__ */ jsxs12("div", { ref, className: "eb:space-y-1.5", children: [
|
|
5160
|
+
/* @__PURE__ */ jsx13(FieldLabel, { id, children: t(property.label) }),
|
|
5161
|
+
/* @__PURE__ */ jsxs12("div", { className: "eb:relative", children: [
|
|
5162
|
+
/* @__PURE__ */ jsx13(
|
|
4937
5163
|
Input,
|
|
4938
5164
|
{
|
|
4939
5165
|
id,
|
|
@@ -4952,7 +5178,7 @@ function SizeField({ id, property, value, fallback = "", onCommit }) {
|
|
|
4952
5178
|
className: "eb:pr-9 eb:tabular-nums"
|
|
4953
5179
|
}
|
|
4954
5180
|
),
|
|
4955
|
-
/* @__PURE__ */
|
|
5181
|
+
/* @__PURE__ */ jsx13("span", { className: "eb:pointer-events-none eb:absolute eb:right-3 eb:top-1/2 eb:-translate-y-1/2 eb:text-[12px] eb:text-foreground-muted", children: property.unit || "px" })
|
|
4956
5182
|
] })
|
|
4957
5183
|
] });
|
|
4958
5184
|
}
|
|
@@ -4975,9 +5201,9 @@ function ColorField({ id, property, value, fallback = "", onCommit }) {
|
|
|
4975
5201
|
}
|
|
4976
5202
|
}, COLOR_DEBOUNCE_MS);
|
|
4977
5203
|
};
|
|
4978
|
-
return /* @__PURE__ */
|
|
4979
|
-
/* @__PURE__ */
|
|
4980
|
-
/* @__PURE__ */
|
|
5204
|
+
return /* @__PURE__ */ jsxs12("div", { ref, className: "eb:space-y-1.5", children: [
|
|
5205
|
+
/* @__PURE__ */ jsx13(FieldLabel, { id, children: t(property.label) }),
|
|
5206
|
+
/* @__PURE__ */ jsx13(ColorPicker, { id, value: draft, placeholder: emailColor(fallback) || "", onChange: change })
|
|
4981
5207
|
] });
|
|
4982
5208
|
}
|
|
4983
5209
|
var DEFAULT_OPTION = "__default__";
|
|
@@ -4987,9 +5213,9 @@ function SelectField({ id, property, value, fallback = "", onCommit }) {
|
|
|
4987
5213
|
const words = (v) => String(v || "").trim().split(/\s+/).sort().join(" ");
|
|
4988
5214
|
const fallbackOption = (property.options || []).find((o) => o.value && words(o.value) === words(fallback));
|
|
4989
5215
|
const defaultLabel = fallbackOption ? t("Default ({value})", { value: t(fallbackOption.label) }) : t("Default");
|
|
4990
|
-
return /* @__PURE__ */
|
|
4991
|
-
/* @__PURE__ */
|
|
4992
|
-
/* @__PURE__ */
|
|
5216
|
+
return /* @__PURE__ */ jsxs12("div", { className: "eb:space-y-1.5", children: [
|
|
5217
|
+
/* @__PURE__ */ jsx13(FieldLabel, { id, children: t(property.label) }),
|
|
5218
|
+
/* @__PURE__ */ jsxs12(
|
|
4993
5219
|
Select,
|
|
4994
5220
|
{
|
|
4995
5221
|
value: current,
|
|
@@ -4998,10 +5224,10 @@ function SelectField({ id, property, value, fallback = "", onCommit }) {
|
|
|
4998
5224
|
if (v !== (value || "")) onCommit(v || null);
|
|
4999
5225
|
},
|
|
5000
5226
|
children: [
|
|
5001
|
-
/* @__PURE__ */
|
|
5002
|
-
/* @__PURE__ */
|
|
5003
|
-
!(property.options || []).some((o) => !o.value) && /* @__PURE__ */
|
|
5004
|
-
(property.options || []).map((o) => /* @__PURE__ */
|
|
5227
|
+
/* @__PURE__ */ jsx13(SelectTrigger, { id, className: "eb:w-full", children: /* @__PURE__ */ jsx13(SelectValue, { placeholder: defaultLabel }) }),
|
|
5228
|
+
/* @__PURE__ */ jsxs12(SelectContent, { children: [
|
|
5229
|
+
!(property.options || []).some((o) => !o.value) && /* @__PURE__ */ jsx13(SelectItem, { value: DEFAULT_OPTION, children: defaultLabel }),
|
|
5230
|
+
(property.options || []).map((o) => /* @__PURE__ */ jsx13(SelectItem, { value: o.value || DEFAULT_OPTION, children: t(o.label) }, o.value || DEFAULT_OPTION))
|
|
5005
5231
|
] })
|
|
5006
5232
|
]
|
|
5007
5233
|
}
|
|
@@ -5011,9 +5237,9 @@ function SelectField({ id, property, value, fallback = "", onCommit }) {
|
|
|
5011
5237
|
var ALIGN_ICONS = { left: AlignLeft, center: AlignCenter, right: AlignRight, justify: AlignJustify };
|
|
5012
5238
|
function AlignField({ id, property, value, fallback = "", onCommit }) {
|
|
5013
5239
|
const t = useT();
|
|
5014
|
-
return /* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ jsxs12("div", { className: "eb:space-y-1.5", children: [
|
|
5241
|
+
/* @__PURE__ */ jsx13(FieldLabel, { id, children: t(property.label) }),
|
|
5242
|
+
/* @__PURE__ */ jsx13(
|
|
5017
5243
|
"div",
|
|
5018
5244
|
{
|
|
5019
5245
|
id,
|
|
@@ -5023,7 +5249,7 @@ function AlignField({ id, property, value, fallback = "", onCommit }) {
|
|
|
5023
5249
|
children: (property.options || []).map((option) => {
|
|
5024
5250
|
const Icon = ALIGN_ICONS[option.value] || AlignLeft;
|
|
5025
5251
|
const active = (value || fallback) === option.value;
|
|
5026
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ jsx13(TooltipWrap, { label: t(option.label), children: /* @__PURE__ */ jsx13(
|
|
5027
5253
|
"button",
|
|
5028
5254
|
{
|
|
5029
5255
|
type: "button",
|
|
@@ -5035,7 +5261,7 @@ function AlignField({ id, property, value, fallback = "", onCommit }) {
|
|
|
5035
5261
|
"eb:inline-flex eb:h-7 eb:w-7 eb:items-center eb:justify-center eb:rounded-lg2 eb:transition-colors",
|
|
5036
5262
|
active ? "eb:bg-primary eb:text-primary-foreground" : "eb:text-foreground-lighter eb:hover:bg-surface-200 eb:hover:text-foreground"
|
|
5037
5263
|
),
|
|
5038
|
-
children: /* @__PURE__ */
|
|
5264
|
+
children: /* @__PURE__ */ jsx13(Icon, { className: "eb:h-3.5 eb:w-3.5" })
|
|
5039
5265
|
}
|
|
5040
5266
|
) }, option.value);
|
|
5041
5267
|
})
|
|
@@ -5064,10 +5290,10 @@ function SpacingField({ id, property, value, fallback = "", onCommit }) {
|
|
|
5064
5290
|
);
|
|
5065
5291
|
if (next !== (value || "")) onCommit(next);
|
|
5066
5292
|
};
|
|
5067
|
-
return /* @__PURE__ */
|
|
5068
|
-
/* @__PURE__ */
|
|
5069
|
-
/* @__PURE__ */
|
|
5070
|
-
/* @__PURE__ */
|
|
5293
|
+
return /* @__PURE__ */ jsxs12("fieldset", { ref, className: "eb:space-y-1.5", children: [
|
|
5294
|
+
/* @__PURE__ */ jsx13("legend", { className: "eb:mb-1.5 eb:text-[12px] eb:text-foreground-lighter", children: t(property.label) }),
|
|
5295
|
+
/* @__PURE__ */ jsx13("div", { className: "eb:grid eb:grid-cols-4 eb:gap-1.5", children: SIDE_LABELS.map(([side, label], i) => /* @__PURE__ */ jsxs12("div", { className: "eb:space-y-1", children: [
|
|
5296
|
+
/* @__PURE__ */ jsx13(
|
|
5071
5297
|
Input,
|
|
5072
5298
|
{
|
|
5073
5299
|
id: `${id}-${side}`,
|
|
@@ -5086,7 +5312,7 @@ function SpacingField({ id, property, value, fallback = "", onCommit }) {
|
|
|
5086
5312
|
className: "eb:px-2 eb:text-center eb:tabular-nums"
|
|
5087
5313
|
}
|
|
5088
5314
|
),
|
|
5089
|
-
/* @__PURE__ */
|
|
5315
|
+
/* @__PURE__ */ jsx13("span", { className: "eb:block eb:text-center eb:text-[10.5px] eb:text-foreground-muted", children: t(label) })
|
|
5090
5316
|
] }, side)) })
|
|
5091
5317
|
] });
|
|
5092
5318
|
}
|
|
@@ -5104,15 +5330,15 @@ var FIELDS = {
|
|
|
5104
5330
|
function PropertyField({ property, value, fallback = "", onCommit, idPrefix = "eb", services = null }) {
|
|
5105
5331
|
const Field = FIELDS[property.type] || TextField;
|
|
5106
5332
|
const id = `${idPrefix}-${property.key}`;
|
|
5107
|
-
return /* @__PURE__ */
|
|
5333
|
+
return /* @__PURE__ */ jsx13(Field, { id, property, value, fallback, onCommit, services });
|
|
5108
5334
|
}
|
|
5109
5335
|
|
|
5110
5336
|
// src/features/variables/VariableInsertButton.jsx
|
|
5111
|
-
import { useState as
|
|
5112
|
-
import { Braces as
|
|
5113
|
-
import { jsx as
|
|
5337
|
+
import { useState as useState12 } from "react";
|
|
5338
|
+
import { Braces as Braces4 } from "lucide-react";
|
|
5339
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5114
5340
|
function VariableInsertButton({ variables, inputRef, value, onChange, label }) {
|
|
5115
|
-
const [open, setOpen] =
|
|
5341
|
+
const [open, setOpen] = useState12(false);
|
|
5116
5342
|
const insert = (variable) => {
|
|
5117
5343
|
const input = inputRef.current;
|
|
5118
5344
|
const text = String(value || "");
|
|
@@ -5128,14 +5354,14 @@ function VariableInsertButton({ variables, inputRef, value, onChange, label }) {
|
|
|
5128
5354
|
input.setSelectionRange(start + token.length, start + token.length);
|
|
5129
5355
|
});
|
|
5130
5356
|
};
|
|
5131
|
-
return /* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5357
|
+
return /* @__PURE__ */ jsxs13(Popover, { open, onOpenChange: setOpen, children: [
|
|
5358
|
+
/* @__PURE__ */ jsx14(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(Button, { variant: "ghost", size: "icon-xs", "aria-label": label, title: label, children: /* @__PURE__ */ jsx14(Braces4, {}) }) }),
|
|
5359
|
+
/* @__PURE__ */ jsx14(PopoverContent, { align: "end", className: "eb:w-72 eb:p-0", onCloseAutoFocus: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx14(VariablePicker, { variables, onPick: insert, filter: (v) => v.kind !== "link" }) })
|
|
5134
5360
|
] });
|
|
5135
5361
|
}
|
|
5136
5362
|
|
|
5137
5363
|
// src/ui/PropertiesPanel.jsx
|
|
5138
|
-
import { Fragment as Fragment6, jsx as
|
|
5364
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5139
5365
|
var GROUP_ORDER = Object.values(GROUPS);
|
|
5140
5366
|
function grouped(properties) {
|
|
5141
5367
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -5149,9 +5375,9 @@ function grouped(properties) {
|
|
|
5149
5375
|
}
|
|
5150
5376
|
function PropertyGroups({ editor, element, block, idPrefix, services = null }) {
|
|
5151
5377
|
const t = useT();
|
|
5152
|
-
return grouped(block?.properties || []).map(([group, properties]) => /* @__PURE__ */
|
|
5153
|
-
/* @__PURE__ */
|
|
5154
|
-
properties.map((property) => /* @__PURE__ */
|
|
5378
|
+
return grouped(block?.properties || []).map(([group, properties]) => /* @__PURE__ */ jsxs14("section", { className: "eb:space-y-3", children: [
|
|
5379
|
+
/* @__PURE__ */ jsx15(SectionLabel, { children: t(group) }),
|
|
5380
|
+
properties.map((property) => /* @__PURE__ */ jsx15(
|
|
5155
5381
|
PropertyField,
|
|
5156
5382
|
{
|
|
5157
5383
|
idPrefix,
|
|
@@ -5169,9 +5395,9 @@ var LABEL_PROPERTY = { key: "content", label: "Label", type: "text", group: GROU
|
|
|
5169
5395
|
var REWRITABLE_TAGS = /* @__PURE__ */ new Set(["mj-text", "mj-button"]);
|
|
5170
5396
|
function PanelHeader({ title, onClose, closeLabel = "Deselect" }) {
|
|
5171
5397
|
const t = useT();
|
|
5172
|
-
return /* @__PURE__ */
|
|
5173
|
-
/* @__PURE__ */
|
|
5174
|
-
onClose && /* @__PURE__ */
|
|
5398
|
+
return /* @__PURE__ */ jsxs14("header", { className: "eb:sticky eb:top-0 eb:z-10 eb:flex eb:h-11 eb:shrink-0 eb:items-center eb:gap-2 eb:border-b eb:border-border eb:bg-background eb:px-4", children: [
|
|
5399
|
+
/* @__PURE__ */ jsx15("h3", { className: "eb:min-w-0 eb:flex-1 eb:text-[13px] eb:font-medium eb:text-foreground", children: /* @__PURE__ */ jsx15(TruncatedText, { children: title }) }),
|
|
5400
|
+
onClose && /* @__PURE__ */ jsx15(Button, { variant: "ghost", size: "icon-sm-compact", onClick: onClose, "aria-label": t(closeLabel), children: /* @__PURE__ */ jsx15(X2, {}) })
|
|
5175
5401
|
] });
|
|
5176
5402
|
}
|
|
5177
5403
|
function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, variables = null, ai = null, onDismiss = null }) {
|
|
@@ -5182,18 +5408,18 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5182
5408
|
const root = useMemo4(() => rootId ? editor.getElement(rootId) : null, [editor, rootId, changes]);
|
|
5183
5409
|
const bodyBlock2 = root?.blockId ? editor.getBlock(root.blockId) : null;
|
|
5184
5410
|
const field = (key) => (e) => onMetaChange({ ...meta, [key]: e.target.value });
|
|
5185
|
-
return /* @__PURE__ */
|
|
5186
|
-
/* @__PURE__ */
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
/* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5411
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
5412
|
+
/* @__PURE__ */ jsx15(PanelHeader, { title: t("Email"), onClose: onDismiss, closeLabel: "Close" }),
|
|
5413
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:space-y-5 eb:p-4", children: [
|
|
5414
|
+
/* @__PURE__ */ jsxs14("section", { className: "eb:space-y-3", children: [
|
|
5415
|
+
/* @__PURE__ */ jsx15(SectionLabel, { children: t("Template") }),
|
|
5416
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:space-y-1.5", children: [
|
|
5417
|
+
/* @__PURE__ */ jsxs14(Label, { htmlFor: "eb-meta-name", className: "eb:text-[12px] eb:font-normal eb:text-foreground-lighter", children: [
|
|
5192
5418
|
t("Name"),
|
|
5193
5419
|
" ",
|
|
5194
|
-
/* @__PURE__ */
|
|
5420
|
+
/* @__PURE__ */ jsx15("span", { className: "eb:text-destructive", children: "*" })
|
|
5195
5421
|
] }),
|
|
5196
|
-
/* @__PURE__ */
|
|
5422
|
+
/* @__PURE__ */ jsx15(
|
|
5197
5423
|
Input,
|
|
5198
5424
|
{
|
|
5199
5425
|
id: "eb-meta-name",
|
|
@@ -5203,12 +5429,12 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5203
5429
|
"aria-invalid": showErrors && !meta.name.trim() || void 0
|
|
5204
5430
|
}
|
|
5205
5431
|
),
|
|
5206
|
-
showErrors && !meta.name.trim() && /* @__PURE__ */
|
|
5432
|
+
showErrors && !meta.name.trim() && /* @__PURE__ */ jsx15("p", { className: "eb:text-[12px] eb:text-destructive", children: t("Name is required") })
|
|
5207
5433
|
] }),
|
|
5208
|
-
/* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5211
|
-
variables && /* @__PURE__ */
|
|
5434
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:space-y-1.5", children: [
|
|
5435
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:flex eb:h-6 eb:items-center eb:justify-between", children: [
|
|
5436
|
+
/* @__PURE__ */ jsx15(Label, { htmlFor: "eb-meta-subject", className: "eb:text-[12px] eb:font-normal eb:text-foreground-lighter", children: t("Subject") }),
|
|
5437
|
+
variables && /* @__PURE__ */ jsx15(
|
|
5212
5438
|
VariableInsertButton,
|
|
5213
5439
|
{
|
|
5214
5440
|
variables,
|
|
@@ -5219,8 +5445,8 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5219
5445
|
}
|
|
5220
5446
|
)
|
|
5221
5447
|
] }),
|
|
5222
|
-
/* @__PURE__ */
|
|
5223
|
-
ai?.suggestSubjects && /* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx15(Input, { ref: subjectRef, id: "eb-meta-subject", maxLength: 250, value: meta.subject, onChange: field("subject") }),
|
|
5449
|
+
ai?.suggestSubjects && /* @__PURE__ */ jsx15(
|
|
5224
5450
|
ai.components.Subjects,
|
|
5225
5451
|
{
|
|
5226
5452
|
editor,
|
|
@@ -5231,10 +5457,10 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5231
5457
|
}
|
|
5232
5458
|
)
|
|
5233
5459
|
] }),
|
|
5234
|
-
/* @__PURE__ */
|
|
5235
|
-
/* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
variables && /* @__PURE__ */
|
|
5460
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:space-y-1.5", children: [
|
|
5461
|
+
/* @__PURE__ */ jsxs14("div", { className: "eb:flex eb:h-6 eb:items-center eb:justify-between", children: [
|
|
5462
|
+
/* @__PURE__ */ jsx15(Label, { htmlFor: "eb-meta-preheader", className: "eb:text-[12px] eb:font-normal eb:text-foreground-lighter", children: t("Preview text") }),
|
|
5463
|
+
variables && /* @__PURE__ */ jsx15(
|
|
5238
5464
|
VariableInsertButton,
|
|
5239
5465
|
{
|
|
5240
5466
|
variables,
|
|
@@ -5245,7 +5471,7 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5245
5471
|
}
|
|
5246
5472
|
)
|
|
5247
5473
|
] }),
|
|
5248
|
-
/* @__PURE__ */
|
|
5474
|
+
/* @__PURE__ */ jsx15(
|
|
5249
5475
|
Textarea,
|
|
5250
5476
|
{
|
|
5251
5477
|
ref: preheaderRef,
|
|
@@ -5259,7 +5485,7 @@ function TemplateSettings({ editor, meta, onMetaChange, changes, showErrors, var
|
|
|
5259
5485
|
)
|
|
5260
5486
|
] })
|
|
5261
5487
|
] }),
|
|
5262
|
-
root && bodyBlock2 && /* @__PURE__ */
|
|
5488
|
+
root && bodyBlock2 && /* @__PURE__ */ jsx15(PropertyGroups, { editor, element: root, block: bodyBlock2, idPrefix: "eb-page" })
|
|
5263
5489
|
] })
|
|
5264
5490
|
] });
|
|
5265
5491
|
}
|
|
@@ -5278,7 +5504,7 @@ function PropertiesPanel({
|
|
|
5278
5504
|
}) {
|
|
5279
5505
|
const t = useT();
|
|
5280
5506
|
const block = selection?.blockId ? editor.getBlock(selection.blockId) : null;
|
|
5281
|
-
return /* @__PURE__ */
|
|
5507
|
+
return /* @__PURE__ */ jsx15("aside", { "aria-label": t("Properties"), className: "eb:min-h-0 eb:overflow-y-auto eb:border-l eb:border-border", "data-testid": "eb-properties", children: !selection ? /* @__PURE__ */ jsx15(
|
|
5282
5508
|
TemplateSettings,
|
|
5283
5509
|
{
|
|
5284
5510
|
editor,
|
|
@@ -5290,8 +5516,8 @@ function PropertiesPanel({
|
|
|
5290
5516
|
ai,
|
|
5291
5517
|
onDismiss
|
|
5292
5518
|
}
|
|
5293
|
-
) : /* @__PURE__ */
|
|
5294
|
-
/* @__PURE__ */
|
|
5519
|
+
) : /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
5520
|
+
/* @__PURE__ */ jsx15(
|
|
5295
5521
|
PanelHeader,
|
|
5296
5522
|
{
|
|
5297
5523
|
title: t(selection.label),
|
|
@@ -5300,12 +5526,12 @@ function PropertiesPanel({
|
|
|
5300
5526
|
}
|
|
5301
5527
|
),
|
|
5302
5528
|
actions,
|
|
5303
|
-
selection.multiple ? /* @__PURE__ */
|
|
5529
|
+
selection.multiple ? /* @__PURE__ */ jsx15("p", { className: "eb:p-4 eb:text-[13px] eb:leading-relaxed eb:text-foreground-lighter", "data-testid": "eb-select-all", children: t("{count} sections selected. Press Delete to remove them (Ctrl+Z brings them back).", {
|
|
5304
5530
|
count: selection.multiple
|
|
5305
|
-
}) }) : /* @__PURE__ */
|
|
5306
|
-
selection.content !== null && selection.content !== void 0 && /* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5308
|
-
/* @__PURE__ */
|
|
5531
|
+
}) }) : /* @__PURE__ */ jsxs14("div", { className: "eb:space-y-5 eb:p-4", children: [
|
|
5532
|
+
selection.content !== null && selection.content !== void 0 && /* @__PURE__ */ jsxs14("section", { className: "eb:space-y-3", children: [
|
|
5533
|
+
/* @__PURE__ */ jsx15(SectionLabel, { children: t(GROUPS.content) }),
|
|
5534
|
+
/* @__PURE__ */ jsx15(
|
|
5309
5535
|
PropertyField,
|
|
5310
5536
|
{
|
|
5311
5537
|
idPrefix: "eb-prop",
|
|
@@ -5316,16 +5542,16 @@ function PropertiesPanel({
|
|
|
5316
5542
|
`${selection.id}:content`
|
|
5317
5543
|
)
|
|
5318
5544
|
] }),
|
|
5319
|
-
selection.tagName === "mj-text" && /* @__PURE__ */
|
|
5320
|
-
ai?.rewrite && REWRITABLE_TAGS.has(selection.tagName) && /* @__PURE__ */
|
|
5321
|
-
/* @__PURE__ */
|
|
5545
|
+
selection.tagName === "mj-text" && /* @__PURE__ */ jsx15("p", { className: "eb:text-[12px] eb:text-foreground-muted", children: t("Double-click the text to edit it.") }),
|
|
5546
|
+
ai?.rewrite && REWRITABLE_TAGS.has(selection.tagName) && /* @__PURE__ */ jsx15(ai.components.Rewrite, { editor, selection, rewrite: ai.rewrite }, selection.id),
|
|
5547
|
+
/* @__PURE__ */ jsx15(PropertyGroups, { editor, element: selection, block, idPrefix: "eb-prop", services })
|
|
5322
5548
|
] })
|
|
5323
5549
|
] }) });
|
|
5324
5550
|
}
|
|
5325
5551
|
|
|
5326
5552
|
// src/ui/Toolbar.jsx
|
|
5327
5553
|
import { ArrowLeft as ArrowLeft2, Monitor, Redo2, Smartphone, Undo2 } from "lucide-react";
|
|
5328
|
-
import { Fragment as Fragment7, jsx as
|
|
5554
|
+
import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5329
5555
|
function Toolbar({
|
|
5330
5556
|
title,
|
|
5331
5557
|
status,
|
|
@@ -5342,8 +5568,8 @@ function Toolbar({
|
|
|
5342
5568
|
compact = false
|
|
5343
5569
|
}) {
|
|
5344
5570
|
const t = useT();
|
|
5345
|
-
const identity2 = /* @__PURE__ */
|
|
5346
|
-
/* @__PURE__ */
|
|
5571
|
+
const identity2 = /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
5572
|
+
/* @__PURE__ */ jsxs15(
|
|
5347
5573
|
Button,
|
|
5348
5574
|
{
|
|
5349
5575
|
variant: "ghost",
|
|
@@ -5351,50 +5577,50 @@ function Toolbar({
|
|
|
5351
5577
|
onClick: onBack,
|
|
5352
5578
|
"aria-label": compact ? t("Back") : void 0,
|
|
5353
5579
|
children: [
|
|
5354
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsx16(ArrowLeft2, {}),
|
|
5355
5581
|
!compact && t("Back")
|
|
5356
5582
|
]
|
|
5357
5583
|
}
|
|
5358
5584
|
),
|
|
5359
|
-
/* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
/* @__PURE__ */
|
|
5362
|
-
/* @__PURE__ */
|
|
5585
|
+
/* @__PURE__ */ jsx16(Separator, { orientation: "vertical", className: "eb:h-5" }),
|
|
5586
|
+
/* @__PURE__ */ jsxs15("div", { className: cn("eb:min-w-0 eb:flex-1", !compact && "eb:max-w-[320px]"), children: [
|
|
5587
|
+
/* @__PURE__ */ jsx16("p", { className: "eb:text-[13px] eb:font-medium eb:text-foreground", children: /* @__PURE__ */ jsx16(TruncatedText, { children: title || t("New template") }) }),
|
|
5588
|
+
/* @__PURE__ */ jsx16("p", { className: "eb:text-[11px] eb:text-foreground-muted", role: "status", "aria-live": "polite", children: status })
|
|
5363
5589
|
] })
|
|
5364
5590
|
] });
|
|
5365
|
-
const editing = /* @__PURE__ */
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5591
|
+
const editing = /* @__PURE__ */ jsxs15("div", { className: "eb:flex eb:shrink-0 eb:items-center eb:gap-2", children: [
|
|
5592
|
+
/* @__PURE__ */ jsxs15("div", { className: "eb:flex eb:items-center eb:gap-0.5", children: [
|
|
5593
|
+
/* @__PURE__ */ jsx16(TooltipWrap, { label: t("Undo (Ctrl+Z)"), children: /* @__PURE__ */ jsx16(Button, { variant: "ghost", size: "icon-sm-compact", onClick: onUndo, disabled: !ready || !canUndo, "aria-label": t("Undo"), children: /* @__PURE__ */ jsx16(Undo2, {}) }) }),
|
|
5594
|
+
/* @__PURE__ */ jsx16(TooltipWrap, { label: t("Redo (Ctrl+Y)"), children: /* @__PURE__ */ jsx16(Button, { variant: "ghost", size: "icon-sm-compact", onClick: onRedo, disabled: !ready || !canRedo, "aria-label": t("Redo"), children: /* @__PURE__ */ jsx16(Redo2, {}) }) })
|
|
5369
5595
|
] }),
|
|
5370
|
-
/* @__PURE__ */
|
|
5371
|
-
/* @__PURE__ */
|
|
5372
|
-
/* @__PURE__ */
|
|
5596
|
+
/* @__PURE__ */ jsx16(Tabs, { value: device, onValueChange: onDeviceChange, children: /* @__PURE__ */ jsxs15(TabsList, { "aria-label": t("Device"), children: [
|
|
5597
|
+
/* @__PURE__ */ jsxs15(TabsTrigger, { value: "desktop", disabled: !ready, "aria-label": compact ? t("Desktop") : void 0, children: [
|
|
5598
|
+
/* @__PURE__ */ jsx16(Monitor, {}),
|
|
5373
5599
|
!compact && t("Desktop")
|
|
5374
5600
|
] }),
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsxs15(TabsTrigger, { value: "mobile", disabled: !ready, "aria-label": compact ? t("Mobile") : void 0, children: [
|
|
5602
|
+
/* @__PURE__ */ jsx16(Smartphone, {}),
|
|
5377
5603
|
!compact && t("Mobile")
|
|
5378
5604
|
] })
|
|
5379
5605
|
] }) })
|
|
5380
5606
|
] });
|
|
5381
5607
|
if (compact) {
|
|
5382
|
-
return /* @__PURE__ */
|
|
5383
|
-
/* @__PURE__ */
|
|
5608
|
+
return /* @__PURE__ */ jsxs15("div", { className: "eb:shrink-0 eb:border-b eb:border-border", "data-layout": "compact", children: [
|
|
5609
|
+
/* @__PURE__ */ jsxs15("div", { className: "eb:flex eb:h-12 eb:items-center eb:gap-2 eb:px-2", children: [
|
|
5384
5610
|
identity2,
|
|
5385
5611
|
primary
|
|
5386
5612
|
] }),
|
|
5387
|
-
/* @__PURE__ */
|
|
5613
|
+
/* @__PURE__ */ jsxs15("div", { className: "eb:flex eb:items-center eb:gap-2 eb:overflow-x-auto eb:px-2 eb:pb-2", "data-testid": "eb-toolbar-actions", children: [
|
|
5388
5614
|
editing,
|
|
5389
|
-
/* @__PURE__ */
|
|
5390
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsx16(Separator, { orientation: "vertical", className: "eb:h-5 eb:shrink-0" }),
|
|
5616
|
+
/* @__PURE__ */ jsx16("div", { className: "eb:flex eb:shrink-0 eb:items-center eb:gap-2", children: actions })
|
|
5391
5617
|
] })
|
|
5392
5618
|
] });
|
|
5393
5619
|
}
|
|
5394
|
-
return /* @__PURE__ */
|
|
5620
|
+
return /* @__PURE__ */ jsxs15("div", { className: "eb:flex eb:h-12 eb:shrink-0 eb:items-center eb:gap-3 eb:border-b eb:border-border eb:px-3", children: [
|
|
5395
5621
|
identity2,
|
|
5396
5622
|
editing,
|
|
5397
|
-
/* @__PURE__ */
|
|
5623
|
+
/* @__PURE__ */ jsxs15("div", { className: "eb:ml-auto eb:flex eb:items-center eb:gap-2", "data-testid": "eb-toolbar-actions", children: [
|
|
5398
5624
|
actions,
|
|
5399
5625
|
primary
|
|
5400
5626
|
] })
|
|
@@ -5404,7 +5630,7 @@ function Toolbar({
|
|
|
5404
5630
|
// src/ui/Drawer.jsx
|
|
5405
5631
|
import { useEffect as useEffect8 } from "react";
|
|
5406
5632
|
import { X as X3 } from "lucide-react";
|
|
5407
|
-
import { jsx as
|
|
5633
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5408
5634
|
function Drawer({ open, side = "left", title, onClose, children, testId, header: header2 = true }) {
|
|
5409
5635
|
const t = useT();
|
|
5410
5636
|
useEffect8(() => {
|
|
@@ -5415,9 +5641,9 @@ function Drawer({ open, side = "left", title, onClose, children, testId, header:
|
|
|
5415
5641
|
window.addEventListener("keydown", onKey);
|
|
5416
5642
|
return () => window.removeEventListener("keydown", onKey);
|
|
5417
5643
|
}, [open, onClose]);
|
|
5418
|
-
return /* @__PURE__ */
|
|
5419
|
-
/* @__PURE__ */
|
|
5420
|
-
/* @__PURE__ */
|
|
5644
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("eb:absolute eb:inset-0 eb:z-20", !open && "eb:hidden"), "data-testid": testId, "data-open": open ? "true" : "false", children: [
|
|
5645
|
+
/* @__PURE__ */ jsx17("div", { className: "eb:absolute eb:inset-0 eb:bg-black/30", onClick: onClose, "aria-hidden": "true" }),
|
|
5646
|
+
/* @__PURE__ */ jsxs16(
|
|
5421
5647
|
"section",
|
|
5422
5648
|
{
|
|
5423
5649
|
role: "dialog",
|
|
@@ -5427,11 +5653,11 @@ function Drawer({ open, side = "left", title, onClose, children, testId, header:
|
|
|
5427
5653
|
side === "left" ? "eb:left-0 eb:border-r eb:border-border" : "eb:right-0 eb:border-l eb:border-border"
|
|
5428
5654
|
),
|
|
5429
5655
|
children: [
|
|
5430
|
-
header2 && /* @__PURE__ */
|
|
5431
|
-
/* @__PURE__ */
|
|
5432
|
-
/* @__PURE__ */
|
|
5656
|
+
header2 && /* @__PURE__ */ jsxs16("header", { className: "eb:flex eb:h-10 eb:shrink-0 eb:items-center eb:justify-between eb:border-b eb:border-border eb:px-3", children: [
|
|
5657
|
+
/* @__PURE__ */ jsx17("h3", { className: "eb:text-[13px] eb:font-medium eb:text-foreground", children: title }),
|
|
5658
|
+
/* @__PURE__ */ jsx17(Button, { variant: "ghost", size: "icon-sm-compact", onClick: onClose, "aria-label": t("Close"), children: /* @__PURE__ */ jsx17(X3, {}) })
|
|
5433
5659
|
] }),
|
|
5434
|
-
/* @__PURE__ */
|
|
5660
|
+
/* @__PURE__ */ jsx17("div", { className: "eb:grid eb:min-h-0 eb:flex-1", children })
|
|
5435
5661
|
]
|
|
5436
5662
|
}
|
|
5437
5663
|
)
|
|
@@ -5439,10 +5665,10 @@ function Drawer({ open, side = "left", title, onClose, children, testId, header:
|
|
|
5439
5665
|
}
|
|
5440
5666
|
|
|
5441
5667
|
// src/ui/useEmailEditorState.js
|
|
5442
|
-
import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef7, useState as
|
|
5668
|
+
import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef7, useState as useState13 } from "react";
|
|
5443
5669
|
var DIRTY_CHECK_MS = 150;
|
|
5444
5670
|
function useEmailEditorState(editor) {
|
|
5445
|
-
const [state, setState] =
|
|
5671
|
+
const [state, setState] = useState13(() => ({
|
|
5446
5672
|
status: editor?.status || "idle",
|
|
5447
5673
|
selection: null,
|
|
5448
5674
|
canUndo: false,
|
|
@@ -5523,7 +5749,7 @@ function useEmailEditorState(editor) {
|
|
|
5523
5749
|
}
|
|
5524
5750
|
|
|
5525
5751
|
// src/ui/EmailBuilder.jsx
|
|
5526
|
-
import { Fragment as Fragment8, jsx as
|
|
5752
|
+
import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5527
5753
|
var EMPTY_META = { name: "", subject: "", preheader: "", description: "" };
|
|
5528
5754
|
function metaOf(template) {
|
|
5529
5755
|
return {
|
|
@@ -5561,7 +5787,7 @@ function Builder({
|
|
|
5561
5787
|
);
|
|
5562
5788
|
const storage = useMemo5(() => injectedStorage || createHttpStorage(), [injectedStorage]);
|
|
5563
5789
|
const systemVariables = useMemo5(() => defineVariables(variablesProp || DEFAULT_VARIABLES), [variablesProp]);
|
|
5564
|
-
const [customVariables, setCustomVariables] =
|
|
5790
|
+
const [customVariables, setCustomVariables] = useState14([]);
|
|
5565
5791
|
const variables = useMemo5(() => mergeVariables(systemVariables, customVariables), [systemVariables, customVariables]);
|
|
5566
5792
|
const canManageVariables = typeof storage.saveVariable === "function" && typeof storage.listVariables === "function";
|
|
5567
5793
|
const reloadVariables = useCallback3(async () => {
|
|
@@ -5595,20 +5821,20 @@ function Builder({
|
|
|
5595
5821
|
const state = useEmailEditorState(editor);
|
|
5596
5822
|
const autosaveOn = isFeatureEnabled("autosave");
|
|
5597
5823
|
const autosaveOptions = emailBuilderFeatures.get("autosave")?.options || {};
|
|
5598
|
-
const [template, setTemplate] =
|
|
5599
|
-
const [boot, setBoot] =
|
|
5600
|
-
const [meta, setMeta] =
|
|
5601
|
-
const [savedMeta, setSavedMeta] =
|
|
5602
|
-
const [saving, setSaving] =
|
|
5603
|
-
const [showErrors, setShowErrors] =
|
|
5604
|
-
const [autosaveBlocked, setAutosaveBlocked] =
|
|
5605
|
-
const [engineError, setEngineError] =
|
|
5606
|
-
const [attempt, setAttempt] =
|
|
5824
|
+
const [template, setTemplate] = useState14({ id: initialTemplateId, revision: null, savedAt: null, auto: false });
|
|
5825
|
+
const [boot, setBoot] = useState14({ status: "loading", document: null, mjml: null, draft: false, message: null });
|
|
5826
|
+
const [meta, setMeta] = useState14(EMPTY_META);
|
|
5827
|
+
const [savedMeta, setSavedMeta] = useState14(EMPTY_META);
|
|
5828
|
+
const [saving, setSaving] = useState14(null);
|
|
5829
|
+
const [showErrors, setShowErrors] = useState14(false);
|
|
5830
|
+
const [autosaveBlocked, setAutosaveBlocked] = useState14(null);
|
|
5831
|
+
const [engineError, setEngineError] = useState14(null);
|
|
5832
|
+
const [attempt, setAttempt] = useState14(0);
|
|
5607
5833
|
const rootRef = useRef8(null);
|
|
5608
5834
|
const layout2 = useLayoutWidth(rootRef);
|
|
5609
5835
|
const compact = layout2 !== "wide";
|
|
5610
5836
|
const blocksInDrawer = layout2 === "narrow";
|
|
5611
|
-
const [drawer, setDrawer] =
|
|
5837
|
+
const [drawer, setDrawer] = useState14(null);
|
|
5612
5838
|
const closeDrawer = useCallback3(() => setDrawer(null), []);
|
|
5613
5839
|
useEffect10(() => {
|
|
5614
5840
|
if (!compact) setDrawer(null);
|
|
@@ -5874,10 +6100,10 @@ function Builder({
|
|
|
5874
6100
|
setBrand,
|
|
5875
6101
|
ai
|
|
5876
6102
|
};
|
|
5877
|
-
const
|
|
5878
|
-
|
|
5879
|
-
);
|
|
5880
|
-
const properties = /* @__PURE__ */
|
|
6103
|
+
const featuresWith = (slot) => emailBuilderFeatures.list((f) => f.enabled !== false && Boolean(f[slot]) && (f.isAvailable ? f.isAvailable(featureContext) : true));
|
|
6104
|
+
const toolbarFeatures = featuresWith("toolbar");
|
|
6105
|
+
const canvasBars = featuresWith("canvasBar");
|
|
6106
|
+
const properties = /* @__PURE__ */ jsx18(
|
|
5881
6107
|
PropertiesPanel,
|
|
5882
6108
|
{
|
|
5883
6109
|
onDismiss: compact ? closeDrawer : null,
|
|
@@ -5887,13 +6113,13 @@ function Builder({
|
|
|
5887
6113
|
onMetaChange: setMeta,
|
|
5888
6114
|
changes: state.changes,
|
|
5889
6115
|
showErrors,
|
|
5890
|
-
actions: /* @__PURE__ */
|
|
6116
|
+
actions: /* @__PURE__ */ jsx18(ElementActions, { editor, selection: state.selection }),
|
|
5891
6117
|
services,
|
|
5892
6118
|
ai,
|
|
5893
6119
|
variables
|
|
5894
6120
|
}
|
|
5895
6121
|
);
|
|
5896
|
-
return /* @__PURE__ */
|
|
6122
|
+
return /* @__PURE__ */ jsxs17(
|
|
5897
6123
|
"div",
|
|
5898
6124
|
{
|
|
5899
6125
|
ref: rootRef,
|
|
@@ -5903,7 +6129,7 @@ function Builder({
|
|
|
5903
6129
|
"data-layout": layout2,
|
|
5904
6130
|
"data-template-id": template.id || "",
|
|
5905
6131
|
children: [
|
|
5906
|
-
/* @__PURE__ */
|
|
6132
|
+
/* @__PURE__ */ jsx18(
|
|
5907
6133
|
Toolbar,
|
|
5908
6134
|
{
|
|
5909
6135
|
title: meta.name,
|
|
@@ -5919,19 +6145,19 @@ function Builder({
|
|
|
5919
6145
|
compact,
|
|
5920
6146
|
actions: [
|
|
5921
6147
|
// The AI module's button first, when the host gave the module.
|
|
5922
|
-
ai?.proofread && /* @__PURE__ */
|
|
6148
|
+
ai?.proofread && /* @__PURE__ */ jsx18(ai.components.Proofread, { context: featureContext, proofread: ai.proofread }, "ai-proofread"),
|
|
5923
6149
|
...toolbarFeatures.map((feature) => {
|
|
5924
6150
|
const Action = feature.toolbar;
|
|
5925
|
-
return /* @__PURE__ */
|
|
6151
|
+
return /* @__PURE__ */ jsx18(Action, { context: featureContext }, feature.id);
|
|
5926
6152
|
})
|
|
5927
6153
|
].filter(Boolean),
|
|
5928
|
-
primary: /* @__PURE__ */
|
|
5929
|
-
saving === "manual" ? /* @__PURE__ */
|
|
6154
|
+
primary: /* @__PURE__ */ jsxs17(Button, { size: "sm-compact", onClick: () => save(), disabled: !ready || saving !== null, children: [
|
|
6155
|
+
saving === "manual" ? /* @__PURE__ */ jsx18(Loader25, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx18(Save, {}),
|
|
5930
6156
|
t("Save")
|
|
5931
6157
|
] })
|
|
5932
6158
|
}
|
|
5933
6159
|
),
|
|
5934
|
-
/* @__PURE__ */
|
|
6160
|
+
/* @__PURE__ */ jsxs17(
|
|
5935
6161
|
"div",
|
|
5936
6162
|
{
|
|
5937
6163
|
className: cn(
|
|
@@ -5941,12 +6167,12 @@ function Builder({
|
|
|
5941
6167
|
layout2 === "narrow" && "eb:grid-cols-1"
|
|
5942
6168
|
),
|
|
5943
6169
|
children: [
|
|
5944
|
-
!blocksInDrawer && /* @__PURE__ */
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
/* @__PURE__ */
|
|
5947
|
-
/* @__PURE__ */
|
|
5948
|
-
/* @__PURE__ */
|
|
5949
|
-
engineError && /* @__PURE__ */
|
|
6170
|
+
!blocksInDrawer && /* @__PURE__ */ jsx18(BlockSidebar, { editor, disabled: !ready, onAdded: compact ? () => setDrawer("properties") : void 0 }),
|
|
6171
|
+
/* @__PURE__ */ jsx18("div", { className: "eb:relative eb:flex eb:min-w-0 eb:flex-col eb:bg-surface-75", "aria-busy": !ready, children: boot.status === "error" || engineError ? /* @__PURE__ */ jsxs17("div", { role: "alert", className: "eb:flex eb:h-full eb:flex-col eb:items-center eb:justify-center eb:gap-2 eb:p-6 eb:text-center", children: [
|
|
6172
|
+
/* @__PURE__ */ jsx18(AlertTriangle, { className: "eb:size-6 eb:text-destructive", "aria-hidden": "true" }),
|
|
6173
|
+
/* @__PURE__ */ jsx18("p", { className: "eb:text-[13px] eb:text-foreground", children: boot.status === "error" ? t("The template could not be loaded.") : t("The builder could not start.") }),
|
|
6174
|
+
/* @__PURE__ */ jsx18("p", { className: "eb:max-w-sm eb:text-[12px] eb:text-foreground-muted", children: boot.message || engineError }),
|
|
6175
|
+
engineError && /* @__PURE__ */ jsx18(
|
|
5950
6176
|
Button,
|
|
5951
6177
|
{
|
|
5952
6178
|
variant: "outline",
|
|
@@ -5958,8 +6184,12 @@ function Builder({
|
|
|
5958
6184
|
children: t("Retry")
|
|
5959
6185
|
}
|
|
5960
6186
|
)
|
|
5961
|
-
] }) : /* @__PURE__ */
|
|
5962
|
-
|
|
6187
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
6188
|
+
canvasBars.map((feature) => {
|
|
6189
|
+
const Bar = feature.canvasBar;
|
|
6190
|
+
return /* @__PURE__ */ jsx18(Bar, { context: featureContext }, feature.id);
|
|
6191
|
+
}),
|
|
6192
|
+
/* @__PURE__ */ jsx18("div", { className: "eb:relative eb:min-h-0 eb:flex-1", children: boot.status === "ready" && /* @__PURE__ */ jsx18(
|
|
5963
6193
|
EmailCanvas,
|
|
5964
6194
|
{
|
|
5965
6195
|
editor,
|
|
@@ -5968,15 +6198,15 @@ function Builder({
|
|
|
5968
6198
|
onError: (error) => setEngineError(error.message)
|
|
5969
6199
|
},
|
|
5970
6200
|
attempt
|
|
5971
|
-
),
|
|
5972
|
-
!ready && /* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
/* @__PURE__ */
|
|
6201
|
+
) }),
|
|
6202
|
+
!ready && /* @__PURE__ */ jsxs17("div", { className: "eb:absolute eb:inset-0 eb:flex eb:items-center eb:justify-center eb:bg-surface-75", role: "status", "aria-live": "polite", children: [
|
|
6203
|
+
/* @__PURE__ */ jsx18(Loader25, { className: "eb:size-6 eb:animate-spin eb:text-foreground-muted", "aria-hidden": "true" }),
|
|
6204
|
+
/* @__PURE__ */ jsx18("span", { className: "eb:sr-only", children: t("Loading the builder") })
|
|
5975
6205
|
] })
|
|
5976
6206
|
] }) }),
|
|
5977
6207
|
!compact && properties,
|
|
5978
|
-
blocksInDrawer && /* @__PURE__ */
|
|
5979
|
-
compact && /* @__PURE__ */
|
|
6208
|
+
blocksInDrawer && /* @__PURE__ */ jsx18(Drawer, { open: drawer === "blocks", side: "left", title: t("Add a block"), onClose: closeDrawer, testId: "eb-blocks-drawer", children: /* @__PURE__ */ jsx18(BlockSidebar, { editor, disabled: !ready, onAdded: () => setDrawer("properties") }) }),
|
|
6209
|
+
compact && /* @__PURE__ */ jsx18(
|
|
5980
6210
|
Drawer,
|
|
5981
6211
|
{
|
|
5982
6212
|
open: drawer === "properties",
|
|
@@ -5991,12 +6221,12 @@ function Builder({
|
|
|
5991
6221
|
]
|
|
5992
6222
|
}
|
|
5993
6223
|
),
|
|
5994
|
-
compact && /* @__PURE__ */
|
|
5995
|
-
blocksInDrawer && /* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
6224
|
+
compact && /* @__PURE__ */ jsxs17("div", { className: "eb:flex eb:shrink-0 eb:items-center eb:gap-2 eb:border-t eb:border-border eb:px-2 eb:py-2", "data-testid": "eb-compact-bar", children: [
|
|
6225
|
+
blocksInDrawer && /* @__PURE__ */ jsxs17(Button, { variant: "outline", size: "sm-compact", disabled: !ready, onClick: () => setDrawer("blocks"), children: [
|
|
6226
|
+
/* @__PURE__ */ jsx18(Plus2, {}),
|
|
5997
6227
|
t("Add a block")
|
|
5998
6228
|
] }),
|
|
5999
|
-
/* @__PURE__ */
|
|
6229
|
+
/* @__PURE__ */ jsxs17(
|
|
6000
6230
|
Button,
|
|
6001
6231
|
{
|
|
6002
6232
|
variant: state.selection ? "default" : "outline",
|
|
@@ -6005,14 +6235,14 @@ function Builder({
|
|
|
6005
6235
|
disabled: !ready,
|
|
6006
6236
|
onClick: () => setDrawer("properties"),
|
|
6007
6237
|
children: [
|
|
6008
|
-
/* @__PURE__ */
|
|
6009
|
-
/* @__PURE__ */
|
|
6238
|
+
/* @__PURE__ */ jsx18(SlidersHorizontal, {}),
|
|
6239
|
+
/* @__PURE__ */ jsx18("span", { className: "eb:truncate", children: ready && state.selection ? t("Edit: {element}", { element: t(state.selection.label) }) : t("Email settings") })
|
|
6010
6240
|
]
|
|
6011
6241
|
}
|
|
6012
6242
|
)
|
|
6013
6243
|
] }),
|
|
6014
|
-
/* @__PURE__ */
|
|
6015
|
-
ai?.key && ai.components.Connect && /* @__PURE__ */
|
|
6244
|
+
/* @__PURE__ */ jsx18(NoticeArea, {}),
|
|
6245
|
+
ai?.key && ai.components.Connect && /* @__PURE__ */ jsx18(ai.components.Connect, { aiKey: ai.key })
|
|
6016
6246
|
]
|
|
6017
6247
|
}
|
|
6018
6248
|
);
|
|
@@ -6023,7 +6253,7 @@ function EmailBuilder({ locale = "en", messages, onNotify, ai: aiProp = null, ..
|
|
|
6023
6253
|
() => ai ? { ...messagesOf(ai.messages, locale), ...messages } : messages,
|
|
6024
6254
|
[ai, locale, messages]
|
|
6025
6255
|
);
|
|
6026
|
-
return /* @__PURE__ */
|
|
6256
|
+
return /* @__PURE__ */ jsx18(UiProvider, { locale, messages: allMessages, onNotify, children: /* @__PURE__ */ jsx18(Builder, { ...props, ai, templateId: props.templateId ?? null }) });
|
|
6027
6257
|
}
|
|
6028
6258
|
function useAiModule(value) {
|
|
6029
6259
|
const valid = Boolean(value && typeof value === "object" && /** @type {any} */
|
|
@@ -6042,7 +6272,7 @@ function useAiModule(value) {
|
|
|
6042
6272
|
// src/ui/EmailBuilderBoundary.jsx
|
|
6043
6273
|
import { Component } from "react";
|
|
6044
6274
|
import { AlertTriangle as AlertTriangle2, ArrowLeft as ArrowLeft3, RefreshCw } from "lucide-react";
|
|
6045
|
-
import { jsx as
|
|
6275
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6046
6276
|
var isChunkError = (error) => error?.name === "ChunkLoadError" || /Loading (CSS )?chunk .* failed/i.test(String(error?.message || ""));
|
|
6047
6277
|
var english = (text) => text;
|
|
6048
6278
|
var EmailBuilderBoundary = class extends Component {
|
|
@@ -6067,23 +6297,23 @@ var EmailBuilderBoundary = class extends Component {
|
|
|
6067
6297
|
const { error, attempt } = this.state;
|
|
6068
6298
|
const t = this.props.t || english;
|
|
6069
6299
|
if (!error) {
|
|
6070
|
-
return /* @__PURE__ */
|
|
6300
|
+
return /* @__PURE__ */ jsx19("div", { style: { height: "100%" }, children: this.props.children }, attempt);
|
|
6071
6301
|
}
|
|
6072
|
-
return /* @__PURE__ */
|
|
6302
|
+
return /* @__PURE__ */ jsxs18(
|
|
6073
6303
|
"div",
|
|
6074
6304
|
{
|
|
6075
6305
|
role: "alert",
|
|
6076
6306
|
className: "eb-root eb:flex eb:h-full eb:flex-col eb:items-center eb:justify-center eb:gap-3 eb:p-6 eb:text-center",
|
|
6077
6307
|
children: [
|
|
6078
|
-
/* @__PURE__ */
|
|
6079
|
-
/* @__PURE__ */
|
|
6080
|
-
/* @__PURE__ */
|
|
6081
|
-
this.props.onClose && /* @__PURE__ */
|
|
6082
|
-
/* @__PURE__ */
|
|
6308
|
+
/* @__PURE__ */ jsx19(AlertTriangle2, { className: "eb:size-6 eb:text-destructive", "aria-hidden": "true" }),
|
|
6309
|
+
/* @__PURE__ */ jsx19("p", { className: "eb:text-[13px] eb:text-foreground", children: t("The builder could not load.") }),
|
|
6310
|
+
/* @__PURE__ */ jsxs18("div", { className: "eb:flex eb:gap-2", children: [
|
|
6311
|
+
this.props.onClose && /* @__PURE__ */ jsxs18(Button, { variant: "outline", size: "sm", onClick: this.props.onClose, children: [
|
|
6312
|
+
/* @__PURE__ */ jsx19(ArrowLeft3, {}),
|
|
6083
6313
|
t("Back")
|
|
6084
6314
|
] }),
|
|
6085
|
-
/* @__PURE__ */
|
|
6086
|
-
/* @__PURE__ */
|
|
6315
|
+
/* @__PURE__ */ jsxs18(Button, { size: "sm", onClick: this.retry, children: [
|
|
6316
|
+
/* @__PURE__ */ jsx19(RefreshCw, {}),
|
|
6087
6317
|
t("Retry")
|
|
6088
6318
|
] })
|
|
6089
6319
|
] })
|
|
@@ -6111,4 +6341,4 @@ export {
|
|
|
6111
6341
|
EmailBuilder,
|
|
6112
6342
|
EmailBuilderBoundary
|
|
6113
6343
|
};
|
|
6114
|
-
//# sourceMappingURL=chunk-
|
|
6344
|
+
//# sourceMappingURL=chunk-G7G3TRWG.js.map
|