@charisol/plexo-sdk 1.0.37 → 1.0.38
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/dist/{compiler-BHUlR0D2.js → compiler-BSPA3AY-.js} +169 -174
- package/dist/compiler.js +1 -1
- package/dist/compilerClient.js +81 -67
- package/dist/iconSvgStatic-JHlo_YyU.js +14986 -0
- package/dist/index.js +44085 -4457
- package/dist/utilities/iconSvgStatic.d.ts +21 -0
- package/dist/utilities/plexoBuilderRuntime.d.ts +1 -1
- package/package.json +2 -1
- package/dist/elementResolvers-qyNepC_f.js +0 -39752
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-BSPA3AY-.js";
|
|
2
2
|
export { c as DEFAULT_BODY_FONT_FAMILY, i as FORM_NON_CSS_STYLE_KEYS, o as collectResponsiveRule, n as compileToHTML, e as compileToHTMLWithStrataAuto, a as compileToPlainText, s as convertSectionRowToPlexoRow, t as getFormDefaultStyle, r as getInlineStylesImportant, l as injectStrataBundle };
|
package/dist/compilerClient.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as u from "react";
|
|
3
|
-
import { renderToStaticMarkup as d } from "react-dom/server";
|
|
1
|
+
import { c as e, d as t, f as n, l as r, n as i, o as a, t as o, u as s } from "./iconSvgStatic-JHlo_YyU.js";
|
|
4
2
|
//#region src/utilities/compilerClient.ts
|
|
5
|
-
var
|
|
3
|
+
var c = {
|
|
6
4
|
facebook: "facebook",
|
|
7
5
|
x: "twitter",
|
|
8
6
|
twitter: "twitter",
|
|
@@ -10,25 +8,25 @@ var f = {
|
|
|
10
8
|
instagram: "instagram",
|
|
11
9
|
youtube: "youtube",
|
|
12
10
|
pinterest: "pinterest"
|
|
13
|
-
},
|
|
11
|
+
}, l = /* @__PURE__ */ new Set([
|
|
14
12
|
"selectable",
|
|
15
13
|
"draggable",
|
|
16
14
|
"duplicatable",
|
|
17
15
|
"deletable",
|
|
18
16
|
"hideable",
|
|
19
17
|
"locked"
|
|
20
|
-
]),
|
|
18
|
+
]), u = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), d = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), f = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), p = (e, t) => {
|
|
21
19
|
let n = { ...e.attributes || {} };
|
|
22
|
-
if (t === "email") for (let e of
|
|
20
|
+
if (t === "email") for (let e of l) delete n[e];
|
|
23
21
|
return n;
|
|
24
|
-
},
|
|
25
|
-
let n =
|
|
22
|
+
}, m = (e, t) => {
|
|
23
|
+
let n = p(e, t), r = d(e.style || {}), i = f(n.htmlClassNames, n.htmlClass, n.validationClass, n.validationClassName), a = u(n.name || n.fieldName || "field"), o = u(n.placeholder || ""), s = n.required ? " required" : "";
|
|
26
24
|
if (t === "email") return `<mj-table><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${r}">${o || a}</td></tr></mj-table>`;
|
|
27
|
-
let c =
|
|
28
|
-
return e.type === "textarea" ? `<textarea${l}${
|
|
29
|
-
},
|
|
30
|
-
let n =
|
|
31
|
-
return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${
|
|
25
|
+
let c = u(n.inputType || n.type || (e.type === "input" ? n.kind || "text" : e.type)), l = n.htmlId ? ` id="${u(n.htmlId)}"` : "", m = i ? ` class="${u(i)}"` : "";
|
|
26
|
+
return e.type === "textarea" ? `<textarea${l}${m} name="${a}" placeholder="${o}" style="${r}"${s}>${u(n.value || "")}</textarea>` : e.type === "select" ? `<select${l}${m} name="${a}" style="${r}"${s}>${(n.options || []).map((e) => `<option value="${u(e.value)}">${u(e.label)}</option>`).join("")}</select>` : `<input${l}${m} type="${c}" name="${a}" placeholder="${o}" value="${u(n.value || "")}" style="${r}"${s} />`;
|
|
27
|
+
}, h = (e, t) => {
|
|
28
|
+
let n = p(e, t), r = d(e.style || {}), i = f(n.htmlClassNames, n.htmlClass), a = n.htmlId ? ` id="${u(n.htmlId)}"` : "", o = i ? ` class="${u(i)}"` : "", s = u(n.actionUrl || n.action || "#"), c = u(n.method || "POST"), l = n.fields || [], h = u(n.submitLabel || "Submit");
|
|
29
|
+
return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${u(e.label || e.name || "Field")}</strong><br/><span style="display:inline-block;margin-top:4px;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;">${u(e.placeholder || "") || " "}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${u(n.href || n.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${h}</a></td></tr></table></td></tr></mj-table>` : `<form${a}${o} action="${s}" method="${c}" style="${r}">${l.map((t) => m({
|
|
32
30
|
id: `${e.id}-${String(t.name || t.label || "field")}`,
|
|
33
31
|
type: t.kind === "textarea" || t.kind === "select" ? t.kind : "input",
|
|
34
32
|
style: {
|
|
@@ -36,72 +34,88 @@ var f = {
|
|
|
36
34
|
...t.style || {}
|
|
37
35
|
},
|
|
38
36
|
attributes: t
|
|
39
|
-
}, "landing_page")).join("")}<button type="submit">${
|
|
40
|
-
},
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
}, "landing_page")).join("")}<button type="submit">${h}</button></form>`;
|
|
38
|
+
}, g = (e = {}, t = {}) => {
|
|
39
|
+
let n = [], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
|
|
40
|
+
return r && n.push(`font-size="${u(String(r))}"`), i && n.push(`font-weight="${u(String(i))}"`), e.color && n.push(`color="${u(String(e.color))}"`), e.fontFamily && n.push(`font-family="${u(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${u(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${u(String(e.letterSpacing))}"`), e.textAlign && n.push(`align="${u(String(e.textAlign))}"`), e.backgroundColor && n.push(`container-background-color="${u(String(e.backgroundColor))}"`), n.join(" ");
|
|
41
|
+
}, _ = (l, _) => {
|
|
42
|
+
let v = p(l, _), y = d(l.style || {}), b = v.htmlId ? ` id="${u(v.htmlId)}"` : "", x = f(v.htmlClassNames, v.htmlClass, _ === "landing_page" && v.hideOnMobile ? "hidden md:block" : ""), S = x ? ` class="${u(x)}"` : "", C = typeof v.customCss == "string" && v.customCss.trim() ? v.customCss.trim() : "", w = C && _ === "landing_page" ? `<style>${C}</style>` : "";
|
|
43
|
+
if (l.type === "form_container") return `${w}${h(l, _)}`;
|
|
44
|
+
if (l.type === "input" || l.type === "select" || l.type === "textarea") return `${w}${m(l, _)}`;
|
|
45
|
+
if (_ === "email") {
|
|
46
|
+
if (l.type === "button") {
|
|
47
|
+
let e = u(v.href || "#"), t = u(v.text || "Button"), n = i(l).width, r = n === "auto" ? "" : ` width="${u(n)}"`;
|
|
48
|
+
return `<mj-button href="${e}" css-class="${v.hideOnDesktop ? "desktop-hide" : ""}" padding="0" inner-padding="10px 16px"${r}>${t}</mj-button>`;
|
|
48
49
|
}
|
|
49
|
-
if (
|
|
50
|
-
let
|
|
51
|
-
return `<mj-image src="${
|
|
50
|
+
if (l.type === "image") {
|
|
51
|
+
let e = a(l), t = e.width && e.width !== "100%" ? ` width="${u(e.width)}"` : "", n = e.height && e.height !== "auto" ? ` height="${u(e.height)}"` : "";
|
|
52
|
+
return `<mj-image src="${u(v.src || "")}" alt="${u(v.alt || "")}"${t}${n} />`;
|
|
52
53
|
}
|
|
53
|
-
if (
|
|
54
|
-
let e =
|
|
55
|
-
return `${
|
|
54
|
+
if (l.type === "social") {
|
|
55
|
+
let e = r(l), t = e.filter((e) => c[e.provider]), n = e.filter((e) => !c[e.provider]);
|
|
56
|
+
return `${t.length ? `<mj-social font-size="13px" icon-size="30px" mode="horizontal">${t.map((e) => `<mj-social-element name="${c[e.provider]}" href="${u(e.url)}" background-color="${u(e.backgroundColor)}" color="${u(e.color)}"></mj-social-element>`).join("")}</mj-social>` : ""}${n.length ? `<mj-text align="center">${n.map((e) => `<a href="${u(e.url)}" style="color: ${u(e.color)}; text-decoration: none; margin: 0 6px;">${u(e.provider)}</a>`).join("")}</mj-text>` : ""}`;
|
|
56
57
|
}
|
|
57
|
-
if (
|
|
58
|
-
if (
|
|
59
|
-
let e =
|
|
58
|
+
if (l.type === "menu") return `<mj-navbar hamburger="hamburger">${e(l).map((e) => `<mj-navbar-link href="${u(e.href)}">${u(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
|
|
59
|
+
if (l.type === "table") {
|
|
60
|
+
let e = s(l), t = l.style || {}, n = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, r = (r, i, a) => {
|
|
60
61
|
let o = a ? "th" : "td", s = a ? t.headerBgColor || "#f8fafc" : e.striped && i % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", c = a ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
|
|
61
|
-
return `<tr>${r.map((e) => `<${o} style="padding: ${t.cellPadding || "8px"}; border: ${n}; background-color: ${s}; color: ${c};">${
|
|
62
|
-
},
|
|
63
|
-
return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${e.enableHeader && e.cells.length > 0 ? `<thead>${r(e.cells[0], 0, !0)}</thead>` : ""}<tbody>${e.cells.slice(
|
|
62
|
+
return `<tr>${r.map((e) => `<${o} style="padding: ${t.cellPadding || "8px"}; border: ${n}; background-color: ${s}; color: ${c};">${u(e) || " "}</${o}>`).join("")}</tr>`;
|
|
63
|
+
}, i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length;
|
|
64
|
+
return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${e.enableHeader && e.cells.length > 0 ? `<thead>${r(e.cells[0], 0, !0)}</thead>` : ""}<tbody>${e.cells.slice(i, Math.max(i, a)).map((e, t) => r(e, t, !1)).join("")}</tbody>${e.enableFooter && e.cells.length > i ? `<tfoot>${r(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : ""}</table></mj-table>`;
|
|
65
|
+
}
|
|
66
|
+
if (l.type === "video") {
|
|
67
|
+
let e = n(v.videoUrl), t = v.linkType === "email" ? `mailto:${v.href || ""}` : v.href || v.videoUrl || "#";
|
|
68
|
+
return `<mj-image src="${u(e.thumbnailUrl)}" href="${u(t)}" alt="${u(v.alt || "Video preview")}" />`;
|
|
69
|
+
}
|
|
70
|
+
if (l.type === "timer") {
|
|
71
|
+
let e = t(v.targetDate), n = v.showLabels !== !1;
|
|
72
|
+
return `<mj-text align="center"><div style="font-size: 28px; font-weight: 800;">${e.days}d ${e.hours}h ${e.minutes}m ${e.seconds}s</div>${n ? `<div style="font-size: 12px; color: #64748b;">Countdown to ${u(v.targetDate || "")}</div>` : ""}</mj-text>`;
|
|
64
73
|
}
|
|
65
|
-
if (
|
|
66
|
-
let e =
|
|
67
|
-
return
|
|
74
|
+
if (l.type === "carousel") {
|
|
75
|
+
let e = Array.isArray(v.images) ? v.images : [];
|
|
76
|
+
return e.length === 0 ? "<mj-text align=\"center\">No images in carousel</mj-text>" : `<mj-carousel>${e.map((e) => `<mj-carousel-image src="${u(e.src)}" alt="${u(e.alt || "")}" />`).join("")}</mj-carousel>`;
|
|
68
77
|
}
|
|
69
|
-
if (
|
|
70
|
-
let e =
|
|
71
|
-
return `<mj-text align="center"
|
|
78
|
+
if (l.type === "icon") {
|
|
79
|
+
let e = parseInt(String(v.iconSize || 48), 10) || 48, t = l.style?.color || "#1e293b";
|
|
80
|
+
return `<mj-text align="center">${o(v.iconName, e, t)}</mj-text>`;
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
let d = v.hideOnDesktop ? "desktop-hide" : "";
|
|
83
|
+
if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
|
|
84
|
+
let e = l.type === "heading" ? {
|
|
85
|
+
fontSize: "24px",
|
|
86
|
+
fontWeight: "700"
|
|
87
|
+
} : { fontSize: "14px" }, t = g(l.style || {}, e);
|
|
88
|
+
return `<mj-text${t ? ` ${t}` : ""} css-class="${d}">${u(v.text || "")}</mj-text>`;
|
|
76
89
|
}
|
|
77
|
-
if (
|
|
78
|
-
let e =
|
|
79
|
-
return `<mj-
|
|
80
|
-
size: t,
|
|
81
|
-
color: n
|
|
82
|
-
}))}</mj-text>`;
|
|
90
|
+
if (l.type === "spacer") {
|
|
91
|
+
let e = l.style?.height || "24px";
|
|
92
|
+
return `<mj-spacer height="${u(String(e))}" />`;
|
|
83
93
|
}
|
|
84
|
-
|
|
94
|
+
if (l.type === "divider") {
|
|
95
|
+
let e = l.style || {};
|
|
96
|
+
return `<mj-divider border-width="${u(String(e.borderWidth || "1px"))}" border-style="${u(String(e.borderStyle || "solid"))}" border-color="${u(String(e.borderColor || "#334155"))}" />`;
|
|
97
|
+
}
|
|
98
|
+
return l.type === "card" ? `<mj-text css-class="${d}"><strong style="display:block;margin-bottom:8px;">${u(v.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${u(v.description || "Card description.")}</span></mj-text>` : l.type === "html" ? `<mj-text css-class="${d}">${v.htmlContent || v.text || ""}</mj-text>` : `<mj-text${b}${S} css-class="${d}">${u(v.text || v.htmlContent || "")}</mj-text>`;
|
|
85
99
|
}
|
|
86
|
-
switch (
|
|
87
|
-
case "heading": return `${
|
|
100
|
+
switch (l.type) {
|
|
101
|
+
case "heading": return `${w}<h2${b}${S} style="${y}">${u(v.text || "Heading")}</h2>`;
|
|
88
102
|
case "paragraph":
|
|
89
|
-
case "text": return `${
|
|
90
|
-
case "button": return `${
|
|
91
|
-
case "image": return `${
|
|
92
|
-
case "html": return `${
|
|
93
|
-
default: return `${
|
|
103
|
+
case "text": return `${w}<p${b}${S} style="${y}">${u(v.text || "")}</p>`;
|
|
104
|
+
case "button": return `${w}<a${b}${S} href="${u(v.href || "#")}" style="${y}">${u(v.text || "Button")}</a>`;
|
|
105
|
+
case "image": return `${w}<img${b}${S} src="${u(v.src || "")}" alt="${u(v.alt || "")}" style="${y}" />`;
|
|
106
|
+
case "html": return `${w}<div${b}${S} style="${y}">${String(v.htmlContent || "")}</div>`;
|
|
107
|
+
default: return `${w}<div${b}${S} style="${y}">${u(v.text || "")}</div>`;
|
|
94
108
|
}
|
|
95
|
-
},
|
|
109
|
+
}, v = (e, t) => {
|
|
96
110
|
if (t === "email") {
|
|
97
|
-
let n = e.elements.map((e) =>
|
|
98
|
-
return `<mj-column width="${
|
|
111
|
+
let n = e.elements.map((e) => _(e, t)).join("");
|
|
112
|
+
return `<mj-column width="${u(e.width || "100%")}">${n}</mj-column>`;
|
|
99
113
|
}
|
|
100
|
-
let n =
|
|
101
|
-
return `<div style="width:${
|
|
102
|
-
},
|
|
103
|
-
let n = (e.body?.rows || []).map((e) =>
|
|
104
|
-
return t === "email" ? `<mjml><mj-head><mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }</mj-style></mj-head><mj-body><mj-section><mj-column><mj-
|
|
114
|
+
let n = d(e.styles || {}), r = e.elements.map((e) => _(e, t)).join(""), i = (Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => y(e, t)).join("");
|
|
115
|
+
return `<div style="width:${u(e.width || "100%")};${n}">${r}${i}</div>`;
|
|
116
|
+
}, y = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}">${e.columns.map((e) => v(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${d(e.style || {})}">${e.columns.map((e) => v(e, t)).join("")}</section>`, b = (e, t) => {
|
|
117
|
+
let n = (e.body?.rows || []).map((e) => y(e, t)).join(""), r = d(e.body?.style || {});
|
|
118
|
+
return t === "email" ? `<mjml><mj-head><mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }</mj-style></mj-head><mj-body><mj-section><mj-column><mj-text css-class="preheader" padding="0" font-size="1px" color="#ffffff"> </mj-text></mj-column></mj-section>${n}</mj-body></mjml>` : `<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body style="${r}"><main>${n}</main></body></html>`;
|
|
105
119
|
};
|
|
106
120
|
//#endregion
|
|
107
|
-
export {
|
|
121
|
+
export { b as parseJsonToTargetFormat };
|