@charisol/plexo-sdk 1.4.32 → 1.4.34
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.
|
@@ -509,7 +509,16 @@ function R(e, t) {
|
|
|
509
509
|
justifyContent: n
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
|
-
|
|
512
|
+
function z(e, t, n, r) {
|
|
513
|
+
if (!r || r.textAlign === void 0 || t.type !== "button" && t.type !== "icon") return;
|
|
514
|
+
let i = `${t.id}-align`;
|
|
515
|
+
if (t.type === "button") {
|
|
516
|
+
L(e, i, void 0, n, { textAlign: r.textAlign });
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
L(e, i, void 0, n, { justifyContent: r.textAlign === "right" ? "flex-end" : r.textAlign === "left" ? "flex-start" : "center" });
|
|
520
|
+
}
|
|
521
|
+
var B = () => ({
|
|
513
522
|
backgroundColor: "#ffffff",
|
|
514
523
|
borderRadius: "20px",
|
|
515
524
|
width: "100%",
|
|
@@ -532,11 +541,11 @@ var z = () => ({
|
|
|
532
541
|
buttonPaddingRight: "14px",
|
|
533
542
|
buttonFontSize: "13px",
|
|
534
543
|
buttonFontWeight: "700"
|
|
535
|
-
}),
|
|
544
|
+
}), V = (e) => (e || "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), H = (e, t) => {
|
|
536
545
|
if (typeof t != "string") return "";
|
|
537
546
|
let n = t.trim();
|
|
538
|
-
return n ? ` ${e}="${
|
|
539
|
-
},
|
|
547
|
+
return n ? ` ${e}="${V(n)}"` : "";
|
|
548
|
+
}, U = [
|
|
540
549
|
"fieldSpacing",
|
|
541
550
|
"buttonBackgroundColor",
|
|
542
551
|
"buttonTextColor",
|
|
@@ -556,36 +565,36 @@ var z = () => ({
|
|
|
556
565
|
"buttonWidth",
|
|
557
566
|
"buttonHeight",
|
|
558
567
|
"buttonAlign"
|
|
559
|
-
],
|
|
560
|
-
function
|
|
561
|
-
let t = (e = "90px") => `<div style="width:100%;height:${e};background:linear-gradient(135deg,${
|
|
568
|
+
], W = "#cbd5e1", G = "#e2e8f0", K = "#1e293b", q = "#64748b", J = (e) => `<span style="display:block;font-family:monospace;font-size:10px;letter-spacing:0.06em;text-transform:uppercase;color:#94a3b8;margin-bottom:8px;">${e} (live once published)</span>`, Y = (e, t = G, n = "8px") => `<div style="width:${e};height:${n};background:${t};border-radius:3px;"></div>`;
|
|
569
|
+
function te(e) {
|
|
570
|
+
let t = (e = "90px") => `<div style="width:100%;height:${e};background:linear-gradient(135deg,${G},${W});border-radius:6px;"></div>`, n = () => `<div style="flex:1;display:flex;flex-direction:column;gap:6px;">${t("64px")}${Y("75%")}${Y("40%", W)}</div>`;
|
|
562
571
|
switch (e) {
|
|
563
|
-
case "product": return `${
|
|
564
|
-
case "booking": return `${
|
|
572
|
+
case "product": return `${J("Product")}<div style="display:flex;flex-direction:column;gap:8px;">${t()}<div style="font-weight:600;font-size:14px;color:${K};">Sample Product Name</div><div style="font-size:13px;color:${q};">$29.99</div><div style="background:${K};color:#fff;text-align:center;padding:8px;border-radius:6px;font-size:13px;font-weight:600;">Add to Cart</div></div>`;
|
|
573
|
+
case "booking": return `${J("Booking")}<div style="font-weight:600;font-size:14px;color:${K};margin-bottom:8px;">Select a time</div><div style="display:flex;gap:6px;flex-wrap:wrap;">${[
|
|
565
574
|
"9:00 AM",
|
|
566
575
|
"10:00 AM",
|
|
567
576
|
"11:30 AM",
|
|
568
577
|
"2:00 PM"
|
|
569
|
-
].map((e) => `<span style="border:1px solid ${
|
|
570
|
-
case "shop_grid": return `${
|
|
578
|
+
].map((e) => `<span style="border:1px solid ${W};border-radius:6px;padding:6px 10px;font-size:12px;color:${K};">${e}</span>`).join("")}</div>`;
|
|
579
|
+
case "shop_grid": return `${J("Shop Grid")}<div style="display:flex;gap:10px;">${n()}${n()}${n()}</div>`;
|
|
571
580
|
case "cart_summary": {
|
|
572
|
-
let e = `<div style="width:36px;height:36px;flex-shrink:0;background:linear-gradient(135deg,${
|
|
573
|
-
return `${
|
|
581
|
+
let e = `<div style="width:36px;height:36px;flex-shrink:0;background:linear-gradient(135deg,${G},${W});border-radius:4px;"></div>`, t = () => `<div style="display:flex;gap:8px;align-items:center;">${e}<div style="flex:1;">${Y("80%")}</div>${Y("30px")}</div>`;
|
|
582
|
+
return `${J("Cart Summary")}<div style="display:flex;flex-direction:column;gap:10px;">${t()}${t()}<div style="border-top:1px solid ${G};padding-top:8px;display:flex;justify-content:space-between;font-size:13px;font-weight:600;color:${K};"><span>Subtotal</span><span>$59.98</span></div></div>`;
|
|
574
583
|
}
|
|
575
|
-
case "checkout_flow": return `${
|
|
576
|
-
case "order_confirmation": return `${
|
|
577
|
-
case "order_tracking": return `${
|
|
584
|
+
case "checkout_flow": return `${J("Checkout")}<div style="display:flex;gap:12px;"><div style="flex:1;display:flex;flex-direction:column;gap:8px;">${Y("50%", W, "10px")}<div style="height:32px;background:#fff;border:1px solid ${G};border-radius:6px;"></div><div style="height:32px;background:#fff;border:1px solid ${G};border-radius:6px;"></div></div><div style="width:120px;flex-shrink:0;border:1px solid ${G};border-radius:6px;padding:10px;background:#fff;display:flex;flex-direction:column;gap:8px;">${Y("70%", W)}${Y("50%")}<div style="height:26px;background:${K};border-radius:4px;margin-top:4px;"></div></div></div>`;
|
|
585
|
+
case "order_confirmation": return `${J("Order Confirmation")}<div style="text-align:center;padding:12px 0;"><div style="width:40px;height:40px;border-radius:100px;background:#dcfce7;color:#16a34a;display:flex;align-items:center;justify-content:center;margin:0 auto 10px;font-size:20px;line-height:1;">✓</div><div style="font-weight:600;font-size:15px;color:${K};">Thank you for your order</div><div style="font-size:12px;color:${q};margin-top:4px;">Order #10482</div></div>`;
|
|
586
|
+
case "order_tracking": return `${J("Order Tracking")}<div style="display:flex;gap:8px;margin-bottom:16px;"><div style="flex:1;height:32px;background:#fff;border:1px solid ${G};border-radius:6px;"></div><div style="width:76px;height:32px;background:${K};border-radius:6px;flex-shrink:0;"></div></div><div style="display:flex;justify-content:space-between;">${[
|
|
578
587
|
["Placed", !0],
|
|
579
588
|
["Processing", !1],
|
|
580
589
|
["Shipped", !1],
|
|
581
590
|
["Delivered", !1]
|
|
582
|
-
].map(([e, t]) => `<div style="display:flex;flex-direction:column;align-items:center;gap:4px;"><div style="width:10px;height:10px;border-radius:100px;background:${t ? "#16a34a" :
|
|
591
|
+
].map(([e, t]) => `<div style="display:flex;flex-direction:column;align-items:center;gap:4px;"><div style="width:10px;height:10px;border-radius:100px;background:${t ? "#16a34a" : W};"></div><span style="font-size:9px;color:${q};">${e}</span></div>`).join("")}</div>`;
|
|
583
592
|
default: return "";
|
|
584
593
|
}
|
|
585
594
|
}
|
|
586
|
-
var
|
|
595
|
+
var ne = (e) => {
|
|
587
596
|
if (!e || typeof e != "object") return "";
|
|
588
|
-
let t = e.kind || "text", n =
|
|
597
|
+
let t = e.kind || "text", n = V(e.name || e.id || "field"), r = e.required ? " required" : "", i = P({
|
|
589
598
|
fontSize: e.fontSize || "13px",
|
|
590
599
|
borderRadius: e.borderRadius || "12px",
|
|
591
600
|
borderWidth: e.borderWidth || "1px",
|
|
@@ -593,14 +602,14 @@ var te = (e) => {
|
|
|
593
602
|
borderStyle: "solid",
|
|
594
603
|
color: e.inputTextColor
|
|
595
604
|
}), a = e.showLabel === !1 ? "" : `<label style="display: block; margin-bottom: 4px; font-size: ${e.fontSize || "12px"}; font-weight: ${e.labelFontWeight || "700"}; color: ${e.labelColor || "inherit"};">${e.label || ""}${e.required ? " <span style=\"color:#e11d48;\">*</span>" : ""}</label>`;
|
|
596
|
-
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${
|
|
605
|
+
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${V(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}></textarea>` : t === "select" ? `${a}<select name="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}>${(Array.isArray(e.options) ? e.options : []).map((e) => `<option value="${V(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>` : t === "radio" || t === "checkbox" ? `${a}<div style="display: flex; flex-wrap: wrap; gap: 8px;">${(Array.isArray(e.options) && e.options.length > 0 ? e.options : [{
|
|
597
606
|
label: e.label || "Option",
|
|
598
607
|
value: e.name || "option"
|
|
599
|
-
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${
|
|
608
|
+
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${V(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${V(t)}" name="${n}" placeholder="${V(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
|
|
600
609
|
};
|
|
601
|
-
function
|
|
610
|
+
function re(e, t, n) {
|
|
602
611
|
if (e === "none") return "";
|
|
603
|
-
let r =
|
|
612
|
+
let r = V(t);
|
|
604
613
|
return e === "plus" ? `<span data-acc-icon style="font-size: 14px; line-height: 1; font-weight: 700; color: ${r};">${n ? "−" : "+"}</span>` : e === "arrow" ? `<span data-acc-icon style="font-size: 14px; line-height: 1; display: inline-block; color: ${r}; transform: ${n ? "rotate(90deg)" : "none"}; transition: transform 0.2s ease;">›</span>` : `<svg data-acc-icon width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${r}" stroke-width="2.5" style="flex-shrink: 0; transform: ${n ? "rotate(180deg)" : "none"}; transition: transform 0.2s ease;"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5"/></svg>`;
|
|
605
614
|
}
|
|
606
615
|
function X(e, t, n, r, i = []) {
|
|
@@ -632,19 +641,19 @@ function X(e, t, n, r, i = []) {
|
|
|
632
641
|
color: t.contentTextColor || "#475569",
|
|
633
642
|
fontSize: t.contentFontSize || "13px",
|
|
634
643
|
whiteSpace: "pre-wrap"
|
|
635
|
-
}), p =
|
|
636
|
-
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${
|
|
644
|
+
}), p = re(n.iconStyle, t.iconColor || "#64748b", !!a.defaultOpen), m = V(a.title), h = V(a.content), g = a.children.length ? `<div class="plexo-acc-group" style="margin-top: 10px;">${X(a.children, t, n, r, s)}</div>` : "";
|
|
645
|
+
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${V(r)}|${s.join(".")}"`} data-acc-header data-acc-open="${a.defaultOpen ? "1" : "0"}" style="${u}"><span style="flex: 1;">${m}</span>${p}</button><div data-acc-panel style="${d}"><div style="overflow: hidden;"><div style="${f}">${h}${g}</div></div></div></div>`;
|
|
637
646
|
}).join("");
|
|
638
647
|
}
|
|
639
|
-
function
|
|
648
|
+
function ie(e) {
|
|
640
649
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
641
650
|
}
|
|
642
|
-
var
|
|
651
|
+
var ae = (g, _ = !1) => {
|
|
643
652
|
if (!g || typeof g != "object") return "";
|
|
644
653
|
let v = g.style || {}, y = g.type === "heading" || g.type === "paragraph" || g.type === "text", b = y ? c(g).autoWidth : !1, x = b ? Object.fromEntries(Object.entries(v).filter(([e]) => e !== "width")) : v, S = P(g.type === "form_container" ? {
|
|
645
|
-
...
|
|
654
|
+
...B(),
|
|
646
655
|
...v
|
|
647
|
-
} : x), C = g.attributes || {}, w = ` data-plexo-id="${
|
|
656
|
+
} : x), C = g.attributes || {}, w = ` data-plexo-id="${V(g.id)}"`, T = String(C.boxAlign || "left"), E = y && (b || !!v.width), D = (e) => E ? `<div style="text-align: ${T};">${e}</div>` : e, O = `${E ? "display: inline-block; " : ""}${y && v.height ? "overflow: hidden; " : ""}`;
|
|
648
657
|
switch (g.type) {
|
|
649
658
|
case "heading": return D(`<h2${w} style="margin-top: 0; margin-bottom: 8px; ${O}${S}">${C.text || "Heading"}</h2>`);
|
|
650
659
|
case "paragraph": return D(`<p${w} style="margin-top: 0; margin-bottom: 12px; ${O}${S}">${C.text || "Paragraph text content."}</p>`);
|
|
@@ -655,7 +664,7 @@ var ie = (g, _ = !1) => {
|
|
|
655
664
|
width: e.width,
|
|
656
665
|
height: e.height
|
|
657
666
|
});
|
|
658
|
-
return `<div style="text-align: ${v.textAlign || "center"};"><a${w} href="${C.href || "#"}" target="${C.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; box-sizing: border-box; ${t}">${C.text || "Button"}</a></div>`;
|
|
667
|
+
return `<div data-plexo-id="${V(String(g.id))}-align" style="text-align: ${v.textAlign || "center"};"><a${w} href="${C.href || "#"}" target="${C.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; box-sizing: border-box; ${t}">${C.text || "Button"}</a></div>`;
|
|
659
668
|
}
|
|
660
669
|
case "image": {
|
|
661
670
|
let e = h(g), t = v.textAlign === "center" ? "margin: 0 auto; display: block;" : v.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;", n = P({
|
|
@@ -673,19 +682,19 @@ var ie = (g, _ = !1) => {
|
|
|
673
682
|
</div>`;
|
|
674
683
|
case "form_container": {
|
|
675
684
|
if (C.provider === "maildrip" && typeof C.maildripPageId == "string" && C.maildripPageId.trim()) {
|
|
676
|
-
let e =
|
|
685
|
+
let e = V(C.maildripPageId.trim());
|
|
677
686
|
return `<div${w} style="${P({
|
|
678
687
|
...v,
|
|
679
688
|
height: p(g)
|
|
680
689
|
})}"><opt-in-embed-form page-id="${e}"></opt-in-embed-form></div>`;
|
|
681
690
|
}
|
|
682
691
|
let n = {
|
|
683
|
-
...
|
|
692
|
+
...B(),
|
|
684
693
|
...v
|
|
685
694
|
}, r = {};
|
|
686
|
-
for (let e of Object.keys(n))
|
|
695
|
+
for (let e of Object.keys(n)) U.includes(e) || (r[e] = n[e]);
|
|
687
696
|
r.height = p(g);
|
|
688
|
-
let i = P(r), a = l(t(Array.isArray(C.fields) ? C.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${
|
|
697
|
+
let i = P(r), a = l(t(Array.isArray(C.fields) ? C.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${ne(e)}</div>`).join(""), c = C.buttonAutoWidth === !1 ? n.buttonWidth || "100%" : "auto", u = n.buttonAlign === "left" ? "flex-start" : n.buttonAlign === "right" ? "flex-end" : "center", d = C.buttonAutoHeight === !1 && n.buttonHeight || "auto", f = P({
|
|
689
698
|
backgroundColor: n.buttonBackgroundColor,
|
|
690
699
|
color: n.buttonTextColor,
|
|
691
700
|
borderRadius: n.buttonBorderRadius,
|
|
@@ -702,14 +711,14 @@ var ie = (g, _ = !1) => {
|
|
|
702
711
|
width: c,
|
|
703
712
|
height: d
|
|
704
713
|
});
|
|
705
|
-
return `<form${w} action="${
|
|
714
|
+
return `<form${w} action="${V(C.actionUrl || C.action || "#")}" method="${V(C.method || "POST")}" style="${i}">${s}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${f}">${C.submitLabel || "Submit"}</button></div></form>`;
|
|
706
715
|
}
|
|
707
716
|
case "input": {
|
|
708
|
-
let e = C.inputType || C.type || "text", t =
|
|
709
|
-
return `<input${w} type="${
|
|
717
|
+
let e = C.inputType || C.type || "text", t = V(C.name || C.fieldName || "field"), n = V(C.placeholder || ""), r = C.required ? " required" : "";
|
|
718
|
+
return `<input${w} type="${V(e)}" name="${t}" placeholder="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${r} />`;
|
|
710
719
|
}
|
|
711
|
-
case "textarea": return `<textarea${w} name="${
|
|
712
|
-
case "select": return `<select${w} name="${
|
|
720
|
+
case "textarea": return `<textarea${w} name="${V(C.name || C.fieldName || "field")}" placeholder="${V(C.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${C.required ? " required" : ""}></textarea>`;
|
|
721
|
+
case "select": return `<select${w} name="${V(C.name || C.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${C.required ? " required" : ""}>${(Array.isArray(C.options) ? C.options : []).map((e) => `<option value="${V(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
|
|
713
722
|
case "html": return `<div${w} style="${P({
|
|
714
723
|
...v,
|
|
715
724
|
height: s(g, "auto")
|
|
@@ -723,7 +732,7 @@ var ie = (g, _ = !1) => {
|
|
|
723
732
|
case "blog_comments":
|
|
724
733
|
case "blog_post_list": {
|
|
725
734
|
let e = g.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = P(v);
|
|
726
|
-
return `<div${w} data-plexo-blog-${e}="true"${
|
|
735
|
+
return `<div${w} data-plexo-blog-${e}="true"${H("data-plexo-blog-prefix", C.prefix)} style="${t}"></div>`;
|
|
727
736
|
}
|
|
728
737
|
case "product":
|
|
729
738
|
case "booking":
|
|
@@ -733,7 +742,7 @@ var ie = (g, _ = !1) => {
|
|
|
733
742
|
case "order_confirmation":
|
|
734
743
|
case "order_tracking": {
|
|
735
744
|
let e = g.type.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = P(v);
|
|
736
|
-
return `<div${w} data-plexo-commerce-${e}="true"${
|
|
745
|
+
return `<div${w} data-plexo-commerce-${e}="true"${H("data-plexo-product-id", C.productId)}${H("data-plexo-service-id", C.serviceId)}${H("data-plexo-commerce-mode", C.mode)}${C.storeMode === !1 ? " data-plexo-commerce-store-mode=\"false\"" : ""}${H("data-plexo-commerce-limit", C.limit)}${H("data-plexo-commerce-category", C.category)}${H("data-plexo-commerce-sort", C.sort)}${H("data-plexo-commerce-items-per-row", C.itemsPerRow)}${H("data-plexo-commerce-items-per-page", C.itemsPerPage)}${C.paginated ? " data-plexo-commerce-paginated=\"true\"" : ""} style="${t}">${_ ? `<div style="padding: 12px; box-sizing: border-box; height: 100%;">${te(g.type)}</div>` : ""}</div>`;
|
|
737
746
|
}
|
|
738
747
|
case "social": {
|
|
739
748
|
let e = r(g), t = v.textAlign === "center" ? "center" : v.textAlign === "right" ? "flex-end" : "flex-start";
|
|
@@ -757,7 +766,7 @@ var ie = (g, _ = !1) => {
|
|
|
757
766
|
justifyContent: "center",
|
|
758
767
|
overflow: "hidden"
|
|
759
768
|
});
|
|
760
|
-
return `<a href="${
|
|
769
|
+
return `<a href="${V(e.url)}" style="${t} text-decoration: none;">${f(e.provider, e.color)}</a>`;
|
|
761
770
|
}).join("")}</div>`;
|
|
762
771
|
}
|
|
763
772
|
case "menu": {
|
|
@@ -768,7 +777,7 @@ var ie = (g, _ = !1) => {
|
|
|
768
777
|
flexWrap: "wrap",
|
|
769
778
|
gap: "16px",
|
|
770
779
|
justifyContent: t
|
|
771
|
-
})}">${e.map((e) => `<a href="${
|
|
780
|
+
})}">${e.map((e) => `<a href="${V(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${v.fontWeight || 600};">${V(e.label)}</a>`).join("")}</div>`;
|
|
772
781
|
}
|
|
773
782
|
case "icon": {
|
|
774
783
|
let e = v.fontSize || `${C.iconSize || 48}px`, t = v.color || "#1e293b", n = parseInt(String(e), 10) || 48, r = m(C.iconName, n, t), i = v.textAlign === "right" ? "flex-end" : v.textAlign === "left" ? "flex-start" : "center", a = P({
|
|
@@ -776,8 +785,8 @@ var ie = (g, _ = !1) => {
|
|
|
776
785
|
margin: v.margin,
|
|
777
786
|
display: "flex",
|
|
778
787
|
justifyContent: i
|
|
779
|
-
}), o = typeof C.href == "string" ? C.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`;
|
|
780
|
-
return `<div
|
|
788
|
+
}), o = typeof C.href == "string" ? C.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`, c = o ? `<a${w} href="${V(o)}" target="${C.openInNewTab ? "_blank" : "_self"}" style="text-decoration: none;">${s}</a>` : `<span${w}>${s}</span>`;
|
|
789
|
+
return `<div data-plexo-id="${V(String(g.id))}-align" style="${a}">${c}</div>`;
|
|
781
790
|
}
|
|
782
791
|
case "table": {
|
|
783
792
|
let e = d(g), t = `${v.borderWidth || "1px"} ${v.borderStyle || "solid"} ${v.borderColor || "#cbd5e1"}`, n = (n, r, i, a) => {
|
|
@@ -792,7 +801,7 @@ var ie = (g, _ = !1) => {
|
|
|
792
801
|
lineHeight: v.contentLineHeight,
|
|
793
802
|
letterSpacing: v.contentLetterSpacing,
|
|
794
803
|
fontWeight: a ? "700" : void 0
|
|
795
|
-
}), u = ` data-plexo-cell="${
|
|
804
|
+
}), u = ` data-plexo-cell="${V(g.id)}|${i}-${n}"`;
|
|
796
805
|
return `<${o}${u} style="${r}">${e || " "}</${o}>`;
|
|
797
806
|
}).join("")}</tr>`;
|
|
798
807
|
}, r = e.enableHeader && e.cells.length > 0 ? `<thead>${n(e.cells[0], 0, 0, !0)}</thead>` : "", i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length, o = e.cells.slice(i, Math.max(i, a)).map((e, t) => n(e, t, i + t, !1)).join(""), s = e.enableFooter && e.cells.length > i ? `<tfoot>${n(e.cells[e.cells.length - 1], e.cells.length - 1, e.cells.length - 1, !1)}</tfoot>` : "", c = P({
|
|
@@ -812,7 +821,7 @@ var ie = (g, _ = !1) => {
|
|
|
812
821
|
margin: v.margin,
|
|
813
822
|
borderRadius: v.borderRadius,
|
|
814
823
|
overflow: "hidden"
|
|
815
|
-
})}"><a href="${
|
|
824
|
+
})}"><a href="${V(t)}" target="${V(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${V(e.thumbnailUrl)}" alt="${V(C.alt || "Video preview")}" style="width: 100%; display: block;" /><span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 9999px; background: rgba(15, 23, 42, 0.75); display: flex; align-items: center; justify-content: center;"><span style="width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 16px solid #ffffff; margin-left: 4px;"></span></span></a></div>`;
|
|
816
825
|
}
|
|
817
826
|
case "timer": {
|
|
818
827
|
let e = C.showLabels !== !1, t = P({
|
|
@@ -829,7 +838,7 @@ var ie = (g, _ = !1) => {
|
|
|
829
838
|
borderRadius: v.borderRadius || "8px",
|
|
830
839
|
padding: v.padding || "16px",
|
|
831
840
|
textAlign: "center"
|
|
832
|
-
}), i = (r, i, a) => `<div style="display: inline-flex; flex-direction: column; align-items: center; padding: 0 10px;"><span data-unit="${r}" style="${t}">${a}</span>${e ? `<span style="${n}">${i}</span>` : ""}</div>`, o = a(C.targetDate, C.timezone), s =
|
|
841
|
+
}), i = (r, i, a) => `<div style="display: inline-flex; flex-direction: column; align-items: center; padding: 0 10px;"><span data-unit="${r}" style="${t}">${a}</span>${e ? `<span style="${n}">${i}</span>` : ""}</div>`, o = a(C.targetDate, C.timezone), s = V(new Date(o.targetTimestamp).toISOString()), c = `<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${g.id}"]`)});if(!wrap)return;var target=new Date(wrap.getAttribute('data-plexo-target')).getTime();function pad(n){return String(n).padStart(2,'0');}function tick(){var diff=target-Date.now();var d=wrap.querySelector('[data-unit="days"]'),h=wrap.querySelector('[data-unit="hours"]'),m=wrap.querySelector('[data-unit="minutes"]'),s=wrap.querySelector('[data-unit="seconds"]');if(diff<=0){[d,h,m,s].forEach(function(n){if(n)n.textContent='00';});clearInterval(iv);return;}var total=Math.floor(diff/1000);if(d)d.textContent=pad(Math.floor(total/86400));if(h)h.textContent=pad(Math.floor(total%86400/3600));if(m)m.textContent=pad(Math.floor(total%3600/60));if(s)s.textContent=pad(total%60);}tick();var iv=setInterval(tick,1000);})();<\/script>`;
|
|
833
842
|
return `<div${w} data-plexo-target="${s}" style="${r}"><div>${i("days", "Days", o.days)}${i("hours", "Hours", o.hours)}${i("minutes", "Mins", o.minutes)}${i("seconds", "Secs", o.seconds)}</div>${c}</div>`;
|
|
834
843
|
}
|
|
835
844
|
case "carousel": {
|
|
@@ -845,7 +854,7 @@ var ie = (g, _ = !1) => {
|
|
|
845
854
|
if (e.length === 0) return `<div${w} style="${n}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
846
855
|
let r = Math.min(e.length - 1, Math.max(0, parseInt(String(C.activeIdx), 10) || 0)), i = e.map((t, n) => (n - r + e.length) % e.length), a = e.length * 5, o = .6, s = e.map((n, r) => {
|
|
847
856
|
let o = i[r] * 5, s = e.length > 1 ? ` animation: ${t}-fade ${a}s ease-in-out infinite; animation-delay: ${o}s;` : "";
|
|
848
|
-
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${
|
|
857
|
+
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${V(n.src)}" alt="${V(n.alt || n.caption || "")}" style="width: 100%; height: 100%; object-fit: cover; display: block;" />${n.caption ? `<div class="${t}-caption" style="padding: 8px; text-align: center; background: rgba(15, 23, 42, 0.8); color: #fff; font-size: 12px; font-weight: 600;">${V(n.caption)}</div>` : ""}</div>`;
|
|
849
858
|
}).join(""), c = e.some((e) => !!e.caption) ? "38px" : "10px", l = e.length > 1 ? `<div class="${t}-dots" style="display: flex; gap: 6px; justify-content: center;">${e.map((e, n) => {
|
|
850
859
|
let r = i[n] * 5;
|
|
851
860
|
return `<span style="width: 6px; height: 6px; border-radius: 9999px; background: #cbd5e1; animation: ${t}-dot ${a}s ease-in-out infinite; animation-delay: ${r}s;"></span>`;
|
|
@@ -866,45 +875,45 @@ var ie = (g, _ = !1) => {
|
|
|
866
875
|
animated: a
|
|
867
876
|
}, g.id)}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${g.id}"]`)});if(!root)return;var mode=root.getAttribute('data-acc-mode')||'single';var iconStyle=root.getAttribute('data-acc-icon-style')||'chevron';function setIconState(icon,open){if(!icon)return;if(iconStyle==='plus'){icon.textContent=open?'−':'+';}else if(iconStyle==='arrow'){icon.style.transform=open?'rotate(90deg)':'';}else if(iconStyle==='chevron'){icon.style.transform=open?'rotate(180deg)':'';}}var headers=root.querySelectorAll('[data-acc-header]');headers.forEach(function(header){header.addEventListener('click',function(){var item=header.parentElement;var group=item.parentElement;var panel=item.children[1];var isOpen=header.getAttribute('data-acc-open')==='1';if(mode!=='multi'&&group){Array.prototype.forEach.call(group.children,function(sib){if(sib===item)return;var sh=sib.children[0];var sp=sib.children[1];if(sh){sh.setAttribute('data-acc-open','0');setIconState(sh.querySelector('[data-acc-icon]'),false);}if(sp)sp.style.gridTemplateRows='0fr';});}var next=!isOpen;header.setAttribute('data-acc-open',next?'1':'0');panel.style.gridTemplateRows=next?'1fr':'0fr';setIconState(header.querySelector('[data-acc-icon]'),next);});});})();<\/script>`}</div>`;
|
|
868
877
|
}
|
|
869
|
-
default: return
|
|
878
|
+
default: return ie(g.type);
|
|
870
879
|
}
|
|
871
880
|
}, Z = (e, t, n) => {
|
|
872
881
|
if (!e || typeof e != "object") return "";
|
|
873
882
|
let r = j(e);
|
|
874
883
|
if (!r) return `\n <!-- ROW SKIPPED (type="${typeof e.type == "string" ? e.type : "unknown"}"${e.id ? `, id="${e.id}"` : ""}): this row has no 'columns' array and its shorthand content (e.g. a list of items/links) can't be auto-converted without losing data. Provide a fully hydrated row with 'columns' and 'elements' instead. -->`;
|
|
875
|
-
let i = r.style?.columnGap, a = typeof i == "number" ? `${i}px` : typeof i == "string" ? i.trim() : "", o = a !== "" && a !== "0" && a !== "0px", s = { ...r.style || {} };
|
|
876
|
-
delete
|
|
877
|
-
let
|
|
878
|
-
L(t,
|
|
879
|
-
let
|
|
880
|
-
|
|
881
|
-
let
|
|
882
|
-
for (let e of
|
|
884
|
+
let i = r.style?.columnGap, a = typeof i == "number" ? `${i}px` : typeof i == "string" ? i.trim() : "", o = a !== "" && a !== "0" && a !== "0px", s = r.style?.gap, c = typeof s == "number" ? `${s}px` : typeof s == "string" ? s.trim() : "", l = c !== "" && c !== "0" && c !== "0px", u = { ...r.style || {} };
|
|
885
|
+
delete u.columnGap;
|
|
886
|
+
let d = P(u), f = H("id", r.htmlId), p = H("class", r.htmlClass), m = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
|
|
887
|
+
L(t, m, r.style, "tablet", r.styleTablet), L(t, m, r.style, "mobile", r.styleMobile), (o || l) && t.mobile.push(`[data-plexo-id="${m}"] > .plexo-col { margin-bottom: 0; }`);
|
|
888
|
+
let h = `\n <!-- ROW START: ${r.id || "row"} -->`, _ = o ? `gap: ${a}; margin-left: 0; margin-right: 0;` : "margin-left: -8px; margin-right: -8px;";
|
|
889
|
+
h += `\n <div data-plexo-id="${m}"${f}${p} class="plexo-row" style="display: flex; flex-wrap: wrap; ${_} ${d}">`;
|
|
890
|
+
let v = Array.isArray(r.columns) ? r.columns : [], y = o && v.length > 1 ? `(${a} * ${v.length - 1} / ${v.length})` : "";
|
|
891
|
+
for (let e of v) {
|
|
883
892
|
if (!e) continue;
|
|
884
|
-
let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", s =
|
|
893
|
+
let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", s = H("id", e.attrs?.htmlId), c = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
|
|
885
894
|
L(t, l, r, "tablet", e.stylesTablet), L(t, l, r, "mobile", e.stylesMobile);
|
|
886
|
-
let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [],
|
|
887
|
-
|
|
888
|
-
let b = new Map(u.map((e) => [e.id, e])), x = new Map(d.map((e) => [e.id, e]))
|
|
889
|
-
for (let r of g({
|
|
895
|
+
let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [], f = n && u.length === 0 && d.length === 0 ? "min-height: 148px; " : "", p = e.width || "100%", m = typeof p == "string" && /^\s*\d+(\.\d+)?\s*%\s*$/.test(p), _ = o && m && y ? `calc(${p.trim()} - ${y})` : p, v = o ? "padding-left: 0; padding-right: 0;" : "padding-left: 8px; padding-right: 8px;";
|
|
896
|
+
h += `\n <!-- COLUMN START: ${e.id || "col"} -->`, h += `\n <div data-plexo-id="${l}"${s} class="plexo-col${c}" style="box-sizing: border-box; ${v} width: ${_}; --plexo-col-gap: ${a}; ${f}${i}">`;
|
|
897
|
+
let b = new Map(u.map((e) => [e.id, e])), x = new Map(d.map((e) => [e.id, e])), S = g({
|
|
890
898
|
...e,
|
|
891
899
|
elements: u,
|
|
892
900
|
nestedRows: d
|
|
893
|
-
})
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
901
|
+
}), C = S[S.length - 1];
|
|
902
|
+
for (let e of S) {
|
|
903
|
+
let r = b.get(e);
|
|
904
|
+
if (r) {
|
|
905
|
+
let i = r.attributes || {}, o = typeof i.htmlClassNames == "string" ? i.htmlClassNames : typeof i.htmlClass == "string" ? i.htmlClass : typeof i.className == "string" ? i.className : "", s = H("id", i.htmlId), c = H("class", o), l = r.style?.display, u = l === "inline-block" || l === "inline" || l === "inline-flex", d = e === C ? "" : `margin-bottom: ${a};`, f = u ? `${d}${d ? " " : ""}display: ${l}; vertical-align: top;` : d;
|
|
906
|
+
L(t, r.id, r.style, "tablet", R(r, r.styleTablet)), L(t, r.id, r.style, "mobile", R(r, r.styleMobile)), z(t, r, "tablet", r.styleTablet), z(t, r, "mobile", r.styleMobile), h += `\n <div${s}${c} style="${f}">`, h += `\n ${ae(r, n)}`, h += "\n </div>";
|
|
898
907
|
continue;
|
|
899
908
|
}
|
|
900
|
-
let i = x.get(
|
|
901
|
-
i && (
|
|
909
|
+
let i = x.get(e);
|
|
910
|
+
i && (h += Z(i, t, n));
|
|
902
911
|
}
|
|
903
|
-
|
|
912
|
+
h += "\n </div>";
|
|
904
913
|
}
|
|
905
|
-
return
|
|
914
|
+
return h += "\n </div>", h;
|
|
906
915
|
};
|
|
907
|
-
function
|
|
916
|
+
function oe(e) {
|
|
908
917
|
let t = /* @__PURE__ */ new Set(), n = 0, r = (e) => {
|
|
909
918
|
let r;
|
|
910
919
|
do
|
|
@@ -971,7 +980,7 @@ var Q = (e, t) => {
|
|
|
971
980
|
"ogImageUrl"
|
|
972
981
|
], s = {};
|
|
973
982
|
for (let e of Object.keys(a)) o.includes(e) || (s[e] = a[e]);
|
|
974
|
-
let c = P(s), l = typeof a.htmlTitle == "string" && a.htmlTitle.trim() ? a.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", u =
|
|
983
|
+
let c = P(s), l = typeof a.htmlTitle == "string" && a.htmlTitle.trim() ? a.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", u = H("id", a.htmlId), d = H("class", a.htmlClass), f = typeof a.customCss == "string" && a.customCss.trim() ? a.customCss.trim() : "", p = typeof a.customJs == "string" && a.customJs.trim() ? a.customJs.trim() : "", m = typeof a.favicon == "string" && a.favicon.trim() ? a.favicon.trim() : "", h = typeof a.metaDescription == "string" && a.metaDescription.trim() ? a.metaDescription.trim() : "", g = typeof a.ogImageUrl == "string" && a.ogImageUrl.trim() ? a.ogImageUrl.trim() : "", v = typeof a.contentMaxWidth == "string" && a.contentMaxWidth.trim() ? a.contentMaxWidth.trim() : "1200px", y = oe(Array.isArray(i.rows) ? i.rows : Array.isArray(r.rows) ? r.rows : Array.isArray(e.rows) ? e.rows : []), b = N(M(y, [a.fontFamily])), x = {
|
|
975
984
|
tablet: [],
|
|
976
985
|
mobile: []
|
|
977
986
|
}, S = "";
|
|
@@ -980,17 +989,17 @@ var Q = (e, t) => {
|
|
|
980
989
|
<html>
|
|
981
990
|
<head>
|
|
982
991
|
<meta charset="utf-8">
|
|
983
|
-
<title>${
|
|
984
|
-
${h ? `<meta name="description" content="${
|
|
985
|
-
${m ? `<link rel="icon" href="${
|
|
992
|
+
<title>${V(l)}</title>
|
|
993
|
+
${h ? `<meta name="description" content="${V(h)}">` : ""}
|
|
994
|
+
${m ? `<link rel="icon" href="${V(m)}">` : ""}
|
|
986
995
|
<meta property="og:type" content="website">
|
|
987
|
-
<meta property="og:title" content="${
|
|
988
|
-
${h ? `<meta property="og:description" content="${
|
|
989
|
-
${g ? `<meta property="og:image" content="${
|
|
996
|
+
<meta property="og:title" content="${V(l)}">
|
|
997
|
+
${h ? `<meta property="og:description" content="${V(h)}">` : ""}
|
|
998
|
+
${g ? `<meta property="og:image" content="${V(g)}">` : ""}
|
|
990
999
|
<meta name="twitter:card" content="${g ? "summary_large_image" : "summary"}">
|
|
991
|
-
<meta name="twitter:title" content="${
|
|
992
|
-
${h ? `<meta name="twitter:description" content="${
|
|
993
|
-
${g ? `<meta name="twitter:image" content="${
|
|
1000
|
+
<meta name="twitter:title" content="${V(l)}">
|
|
1001
|
+
${h ? `<meta name="twitter:description" content="${V(h)}">` : ""}
|
|
1002
|
+
${g ? `<meta name="twitter:image" content="${V(g)}">` : ""}
|
|
994
1003
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
995
1004
|
${b ? `<link rel="stylesheet" href="${b}">` : ""}
|
|
996
1005
|
${S.includes("<opt-in-embed-form") ? `<script type="module" src="${_}"><\/script>` : ""}
|
|
@@ -1029,6 +1038,19 @@ var Q = (e, t) => {
|
|
|
1029
1038
|
.plexo-col {
|
|
1030
1039
|
width: 100% !important;
|
|
1031
1040
|
max-width: 100% !important;
|
|
1041
|
+
}
|
|
1042
|
+
/* :not(:last-child) -- a stacked column's margin-bottom exists to space it apart from
|
|
1043
|
+
the sibling stacked below it; the LAST column in a row has no such sibling, so that
|
|
1044
|
+
same margin only ever adds unwanted trailing space after it. Ordinarily harmless (a
|
|
1045
|
+
page's next section still starts in roughly the right place), but a *single-column*
|
|
1046
|
+
row is 100% last-children -- every column in it picks up this trailing margin with
|
|
1047
|
+
literally nothing to justify it. Confirmed live: a header built from two single-
|
|
1048
|
+
column utility rows (each just carrying an injected <style> tag, otherwise 0-height)
|
|
1049
|
+
stacked 16px of pure margin apiece above the visible nav bar, and the nav bar's own
|
|
1050
|
+
single-column wrapper added a third 16px below it -- two of the exact "wide empty
|
|
1051
|
+
space above/below the header" gaps reported, with nothing in the row/column content
|
|
1052
|
+
itself explaining them. */
|
|
1053
|
+
.plexo-col:not(:last-child) {
|
|
1032
1054
|
margin-bottom: var(--plexo-col-gap, 16px);
|
|
1033
1055
|
}${w}
|
|
1034
1056
|
}
|
|
@@ -1045,14 +1067,14 @@ ${p ? ` <script>\n${p}\n <\/script>` : ""}
|
|
|
1045
1067
|
function $(e) {
|
|
1046
1068
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1047
1069
|
}
|
|
1048
|
-
function
|
|
1070
|
+
function se(e) {
|
|
1049
1071
|
return $(Q(e));
|
|
1050
1072
|
}
|
|
1051
|
-
function
|
|
1073
|
+
function ce(e) {
|
|
1052
1074
|
return Q(e);
|
|
1053
1075
|
}
|
|
1054
|
-
function
|
|
1076
|
+
function le(e) {
|
|
1055
1077
|
return e;
|
|
1056
1078
|
}
|
|
1057
1079
|
//#endregion
|
|
1058
|
-
export {
|
|
1080
|
+
export { ce as a, B as c, le as d, k as f, Q as i, F as l, U as n, se as o, L as r, j as s, A as t, $ as u };
|
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./compiler-
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./compiler-BOsCUhY-.js";
|
|
2
2
|
export { l as DEFAULT_BODY_FONT_FAMILY, a as FORM_NON_CSS_STYLE_KEYS, s as collectResponsiveRule, r as compileToHTML, e as compileToHTMLWithStrataAuto, o as compileToPlainText, c as convertSectionRowToPlexoRow, t as getFormDefaultStyle, i as getInlineStylesImportant, u as htmlToPlainText, n as injectStrataBundle };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as e, n as t, o as n, r, s as i, t as a } from "./sanitizeCompiledHtml-D3k1f2jT.js";
|
|
2
2
|
import { S as o, _ as s, a as c, b as l, c as u, f as d, h as f, i as p, l as m, o as h, p as g, s as _, u as v, x as y, y as b } from "./iconSvgStatic-CGue7nyp.js";
|
|
3
|
-
import { a as x, d as S, f as C, i as ee, o as te, u as w } from "./compiler-
|
|
3
|
+
import { a as x, d as S, f as C, i as ee, o as te, u as w } from "./compiler-BOsCUhY-.js";
|
|
4
4
|
import { t as ne } from "./compilerClient-BIrZIgfG.js";
|
|
5
5
|
import T, { createContext as E, createElement as re, forwardRef as ie, useCallback as ae, useContext as oe, useEffect as D, useImperativeHandle as se, useMemo as O, useRef as k, useState as A } from "react";
|
|
6
6
|
import { DndContext as ce, DragOverlay as le, MeasuringStrategy as ue, PointerSensor as de, TouchSensor as fe, pointerWithin as pe, rectIntersection as me, useDraggable as j, useDroppable as he, useSensor as M, useSensors as ge } from "@dnd-kit/core";
|
package/package.json
CHANGED