@charisol/plexo-sdk 1.0.16 → 1.0.18

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.js CHANGED
@@ -362,28 +362,31 @@ var t = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
362
362
  }
363
363
  case "textarea": return `<textarea name="${r(c.name || c.fieldName || "field")}" placeholder="${r(c.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${s}"${c.required ? " required" : ""}></textarea>`;
364
364
  case "select": return `<select name="${r(c.name || c.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${s}"${c.required ? " required" : ""}>${(Array.isArray(c.options) ? c.options : []).map((e) => `<option value="${r(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
365
+ case "html": return `<div style="${s}">${c.htmlContent || c.text || ""}</div>`;
365
366
  default: return `<!-- Unsupported block ${e.type} -->`;
366
367
  }
367
368
  }, c = (n) => {
368
369
  if (!n || typeof n != "object") return "";
369
370
  let r = e(n);
370
371
  if (!r) return `\n <!-- ROW SKIPPED (type="${typeof n.type == "string" ? n.type : "unknown"}"${n.id ? `, id="${n.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. -->`;
371
- let a = t(r.style || {}), o = i("id", r.htmlId), c = i("class", r.htmlClass), l = `\n <!-- ROW START: ${r.id || "row"} -->`;
372
- l += `\n <div${o}${c} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${a}">`;
373
- let u = Array.isArray(r.columns) ? r.columns : [];
374
- for (let e of u) {
372
+ let a = t(r.style || {}), o = i("id", r.htmlId), l = i("class", r.htmlClass), u = `\n <!-- ROW START: ${r.id || "row"} -->`;
373
+ u += `\n <div${o}${l} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${a}">`;
374
+ let d = Array.isArray(r.columns) ? r.columns : [];
375
+ for (let e of d) {
375
376
  if (!e) continue;
376
377
  let n = t(e.styles || e.style || {}), r = i("id", e.attrs?.htmlId), a = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "";
377
- l += `\n <!-- COLUMN START: ${e.id || "col"} -->`, l += `\n <div${r} class="plexo-col${a}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${n}">`;
378
+ u += `\n <!-- COLUMN START: ${e.id || "col"} -->`, u += `\n <div${r} class="plexo-col${a}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${n}">`;
378
379
  let o = Array.isArray(e.elements) ? e.elements : [];
379
380
  for (let e of o) {
380
381
  if (!e) continue;
381
- let t = e.attributes || {}, n = typeof t.htmlClassNames == "string" ? t.htmlClassNames : typeof t.htmlClass == "string" ? t.htmlClass : typeof t.className == "string" ? t.className : "", r = i("id", t.htmlId), a = i("class", n);
382
- l += `\n <div${r}${a} style="margin-bottom: 16px;">`, l += `\n ${s(e)}`, l += "\n </div>";
382
+ let t = e.attributes || {}, n = typeof t.htmlClassNames == "string" ? t.htmlClassNames : typeof t.htmlClass == "string" ? t.htmlClass : typeof t.className == "string" ? t.className : "", r = i("id", t.htmlId), a = i("class", n), o = e.style?.display, c = o === "inline-block" || o === "inline" || o === "inline-flex" ? `margin-bottom: 16px; display: ${o}; vertical-align: top;` : "margin-bottom: 16px;";
383
+ u += `\n <div${r}${a} style="${c}">`, u += `\n ${s(e)}`, u += "\n </div>";
383
384
  }
384
- l += "\n </div>";
385
+ let l = Array.isArray(e.nestedRows) ? e.nestedRows : [];
386
+ for (let e of l) u += c(e);
387
+ u += "\n </div>";
385
388
  }
386
- return l += "\n </div>", l;
389
+ return u += "\n </div>", u;
387
390
  }, l = (e) => {
388
391
  if (!e || typeof e != "object") return "<!-- Empty template -->";
389
392
  let n = e.designJson || e.template || e, a = n.body || (Array.isArray(n.rows) ? {
@@ -51,8 +51,8 @@ var e = /* @__PURE__ */ new Set([
51
51
  let n = e.elements.map((e) => s(e, r)).join("");
52
52
  return `<mj-column width="${t(e.width || "100%")}">${n}</mj-column>`;
53
53
  }
54
- let i = n(e.styles || {}), a = e.elements.map((e) => s(e, r)).join("");
55
- return `<div style="width:${t(e.width || "100%")};${i}">${a}</div>`;
54
+ let i = n(e.styles || {}), a = e.elements.map((e) => s(e, r)).join(""), o = (Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => l(e, r)).join("");
55
+ return `<div style="width:${t(e.width || "100%")};${i}">${a}${o}</div>`;
56
56
  }, l = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}">${e.columns.map((e) => c(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${n(e.style || {})}">${e.columns.map((e) => c(e, t)).join("")}</section>`, u = (e, t) => {
57
57
  let r = (e.body?.rows || []).map((e) => l(e, t)).join(""), i = n(e.body?.style || {});
58
58
  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-wrapper css-class="email-root" padding="0"><mj-text css-class="preheader" padding="0" font-size="1px" color="#ffffff">&nbsp;</mj-text></mj-wrapper></mj-column></mj-section>${r}</mj-body></mjml>` : `<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body style="${i}"><main>${r}</main></body></html>`;
@@ -20,6 +20,8 @@ interface TopHeaderProps {
20
20
  htmlTab: React.ReactNode;
21
21
  plainTab: React.ReactNode;
22
22
  };
23
+ headerLeftContent?: React.ReactNode;
24
+ headerRightContent?: React.ReactNode;
23
25
  }
24
26
  export declare const TopHeader: React.FC<TopHeaderProps>;
25
27
  export {};