webim-adapter 2.6.1 → 2.6.3

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.
@@ -12415,24 +12415,28 @@ function Vs(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
12415
12415
  var Hs = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), Us = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(Ee(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
12416
12416
  .webim-page[data-webim-mode="dark"] { ${Object.entries(Ee(e.dark)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }`;
12417
12417
  function Ws({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, custom: a, animations: o, tenant: s, apiUrl: l, datasets: d, locale: f, direction: p, settings: m, siteUser: _, param: v }) {
12418
- let b = a?.js?.trim();
12418
+ let b = a?.js?.trim(), x = m && m["site.code"] && typeof m["site.code"] == "object" ? m["site.code"] : null, S = typeof x?.js == "string" ? x.js.trim() : "", C = typeof x?.css == "string" ? x.css.trim() : "";
12419
12419
  if (c(() => {
12420
+ if (!S) return;
12421
+ let e = document.createElement("script");
12422
+ return e.text = S, document.body.appendChild(e), () => e.remove();
12423
+ }, [S]), c(() => {
12420
12424
  if (!b) return;
12421
12425
  let e = document.createElement("script");
12422
12426
  return e.text = b, document.body.appendChild(e), () => e.remove();
12423
12427
  }, [b]), !e?.ROOT) return null;
12424
- let x = {
12428
+ let T = {
12425
12429
  lang: f || void 0,
12426
12430
  dir: y(p, f)
12427
- }, S = ".webim-page, .webim-page *, .webim-page *::before, .webim-page *::after { box-sizing: border-box; }\n" + ve, C = {
12431
+ }, E = ".webim-page, .webim-page *, .webim-page *::before, .webim-page *::after { box-sizing: border-box; }\n" + ve, O = {
12428
12432
  minHeight: "100%",
12429
12433
  display: "flex",
12430
12434
  flexDirection: "column"
12431
- }, T = Vs("ROOT", e, n), E = u(() => ({ render: (t, r) => Vs(t, e, n, void 0, { mapProps: r }) }), [e, n]), O = _e(e, n), k = ge(e, n), A = a?.css?.trim(), j = P(o), M = Te(t), N = [M.font, M.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !q[e]), F = [.../* @__PURE__ */ new Set([...D(e, n), ...N])].map((e) => /* @__PURE__ */ h("link", {
12435
+ }, k = Vs("ROOT", e, n), A = u(() => ({ render: (t, r) => Vs(t, e, n, void 0, { mapProps: r }) }), [e, n]), j = _e(e, n), M = ge(e, n), N = a?.css?.trim(), F = P(o), I = Te(t), L = [I.font, I.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !q[e]), R = [.../* @__PURE__ */ new Set([...D(e, n), ...L])].map((e) => /* @__PURE__ */ h("link", {
12432
12436
  rel: "stylesheet",
12433
12437
  precedence: "default",
12434
12438
  href: w(e)
12435
- }, e)), I = Us(M);
12439
+ }, e)), z = Us(I);
12436
12440
  return r === "auto" ? /* @__PURE__ */ h(Y.Provider, {
12437
12441
  value: {
12438
12442
  tenant: s || "",
@@ -12446,25 +12450,26 @@ function Ws({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
12446
12450
  children: /* @__PURE__ */ h(ht.Provider, {
12447
12451
  value: d ?? null,
12448
12452
  children: /* @__PURE__ */ h(yt.Provider, {
12449
- value: E,
12453
+ value: A,
12450
12454
  children: /* @__PURE__ */ g("div", {
12451
- ...x,
12455
+ ...T,
12452
12456
  className: "webim-page",
12453
12457
  style: {
12454
- ...C,
12458
+ ...O,
12455
12459
  ...De(t),
12456
12460
  ...i
12457
12461
  },
12458
12462
  children: [
12459
- /* @__PURE__ */ h("style", { children: `.webim-page { ${Hs(Ee(M.light))} }
12460
- @media (prefers-color-scheme: dark) { .webim-page { ${Hs(Ee(M.dark))} } }` }),
12461
- /* @__PURE__ */ h("style", { children: I }),
12462
- F,
12463
- /* @__PURE__ */ h("style", { children: S }),
12464
- O && /* @__PURE__ */ h("style", { children: O }),
12465
- k && /* @__PURE__ */ h("style", { children: k }),
12466
- A && /* @__PURE__ */ h("style", { children: A }),
12467
- T
12463
+ /* @__PURE__ */ h("style", { children: `.webim-page { ${Hs(Ee(I.light))} }
12464
+ @media (prefers-color-scheme: dark) { .webim-page { ${Hs(Ee(I.dark))} } }` }),
12465
+ /* @__PURE__ */ h("style", { children: z }),
12466
+ R,
12467
+ /* @__PURE__ */ h("style", { children: E }),
12468
+ j && /* @__PURE__ */ h("style", { children: j }),
12469
+ M && /* @__PURE__ */ h("style", { children: M }),
12470
+ C && /* @__PURE__ */ h("style", { children: C }),
12471
+ N && /* @__PURE__ */ h("style", { children: N }),
12472
+ k
12468
12473
  ]
12469
12474
  })
12470
12475
  })
@@ -12483,25 +12488,26 @@ function Ws({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
12483
12488
  children: /* @__PURE__ */ h(ht.Provider, {
12484
12489
  value: d ?? null,
12485
12490
  children: /* @__PURE__ */ h(yt.Provider, {
12486
- value: E,
12491
+ value: A,
12487
12492
  children: /* @__PURE__ */ g("div", {
12488
- ...x,
12493
+ ...T,
12489
12494
  className: "webim-page",
12490
12495
  style: {
12491
- ...C,
12496
+ ...O,
12492
12497
  ...Ae(t, r),
12493
12498
  ...i
12494
12499
  },
12495
12500
  children: [
12496
- F,
12497
- /* @__PURE__ */ h("style", { children: I }),
12498
- /* @__PURE__ */ h("style", { children: S }),
12499
- O && /* @__PURE__ */ h("style", { children: O }),
12500
- k && /* @__PURE__ */ h("style", { children: k }),
12501
- j && /* @__PURE__ */ h("style", { children: j }),
12501
+ R,
12502
+ /* @__PURE__ */ h("style", { children: z }),
12503
+ /* @__PURE__ */ h("style", { children: E }),
12502
12504
  j && /* @__PURE__ */ h("style", { children: j }),
12503
- A && /* @__PURE__ */ h("style", { children: A }),
12504
- T
12505
+ M && /* @__PURE__ */ h("style", { children: M }),
12506
+ F && /* @__PURE__ */ h("style", { children: F }),
12507
+ F && /* @__PURE__ */ h("style", { children: F }),
12508
+ C && /* @__PURE__ */ h("style", { children: C }),
12509
+ N && /* @__PURE__ */ h("style", { children: N }),
12510
+ k
12505
12511
  ]
12506
12512
  })
12507
12513
  })
@@ -12595,7 +12601,7 @@ function Xs(t, { mode: n = "auto", style: r } = {}) {
12595
12601
  }));
12596
12602
  }
12597
12603
  function Zs(e, { mode: t = "auto", lang: n } = {}) {
12598
- let r = e.seo ?? {}, i = n || e.locale || "en", a = y(e.direction, i), o = Pe(e) || "Page", s = e.custom?.js?.trim(), c = [
12604
+ let r = e.seo ?? {}, i = n || e.locale || "en", a = y(e.direction, i), o = Pe(e) || "Page", s = e.custom?.js?.trim(), c = e.settings?.["site.code"], l = typeof c?.js == "string" ? c.js.trim() : "", u = (e) => `<script>${e.replaceAll("<\/script", "<\\/script")}<\/script>`, d = [
12599
12605
  "<meta charset=\"utf-8\"/>",
12600
12606
  "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>",
12601
12607
  `<title>${Ys(o)}</title>`,
@@ -12608,11 +12614,12 @@ function Zs(e, { mode: t = "auto", lang: n } = {}) {
12608
12614
  return `<!doctype html>
12609
12615
  <html lang="${Ys(i)}"${a ? ` dir="${a}"` : ""}>
12610
12616
  <head>
12611
- ${c}
12617
+ ${d}
12612
12618
  </head>
12613
12619
  <body>
12614
12620
  ${Xs(e, { mode: t })}
12615
- ${s ? `<script>${s.replaceAll("<\/script", "<\\/script")}<\/script>` : ""}
12621
+ ${l ? u(l) : ""}
12622
+ ${s ? u(s) : ""}
12616
12623
  </body>
12617
12624
  </html>`;
12618
12625
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webim-adapter",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "Render Web-IM builder pages inside any React app",
5
5
  "author": "Orhan POLAT",
6
6
  "license": "ISC",