@builder.io/sdk-react-nextjs 0.12.1 → 0.12.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.
Files changed (48) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-64b6ec10.cjs +21 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-e89d3175.js +713 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-231b55dd.js → browser/USE_SERVER_BUNDLE-d6bec4ec.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-24df6623.cjs → browser/USE_SERVER_BUNDLE-f34c0814.cjs} +1 -1
  5. package/lib/browser/bundle-50ff23eb.cjs +172 -0
  6. package/lib/browser/{bundle-7e2a44d9.js → bundle-f3e8cd29.js} +576 -573
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +17 -17
  9. package/lib/edge/USE_CLIENT_BUNDLE-2aed408a.cjs +21 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-a3258a60.js +713 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-33c309df.js → edge/USE_SERVER_BUNDLE-4e9af8f5.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-93366161.cjs → edge/USE_SERVER_BUNDLE-e79e6b55.cjs} +1 -1
  13. package/lib/edge/{bundle-44392f6d.js → bundle-cb191300.js} +811 -808
  14. package/lib/edge/{bundle-6d55a6a7.cjs → bundle-d4f509a3.cjs} +37 -33
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +17 -17
  17. package/lib/node/USE_CLIENT_BUNDLE-98a4fbf4.js +713 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-990b655a.cjs +21 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-153f7d4b.js → node/USE_SERVER_BUNDLE-b231d861.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-a0bf6d8f.cjs → node/USE_SERVER_BUNDLE-c86a1fb8.cjs} +1 -1
  21. package/lib/node/{bundle-217b5738.js → bundle-11daeaca.js} +166 -163
  22. package/lib/node/{bundle-b9af39ec.cjs → bundle-b2d68b60.cjs} +11 -7
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +17 -17
  25. package/package.json +1 -1
  26. package/types/cjs/components/block/block.helpers.d.ts +0 -1
  27. package/types/cjs/components/block/components/block-wrapper.d.ts +2 -6
  28. package/types/cjs/components/content-variants/content-variants.types.d.ts +4 -0
  29. package/types/cjs/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  30. package/types/cjs/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  31. package/types/cjs/constants/sdk-version.d.ts +1 -1
  32. package/types/cjs/functions/is-from-trusted-host.d.ts +3 -0
  33. package/types/cjs/scripts/init-editing.d.ts +1 -0
  34. package/types/esm/components/block/block.helpers.d.ts +0 -1
  35. package/types/esm/components/block/components/block-wrapper.d.ts +2 -6
  36. package/types/esm/components/content-variants/content-variants.types.d.ts +4 -0
  37. package/types/esm/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  38. package/types/esm/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  39. package/types/esm/constants/sdk-version.d.ts +1 -1
  40. package/types/esm/functions/is-from-trusted-host.d.ts +3 -0
  41. package/types/esm/scripts/init-editing.d.ts +1 -0
  42. package/lib/browser/USE_CLIENT_BUNDLE-5457b97e.cjs +0 -23
  43. package/lib/browser/USE_CLIENT_BUNDLE-ac9ba054.js +0 -732
  44. package/lib/browser/bundle-6435b7fb.cjs +0 -168
  45. package/lib/edge/USE_CLIENT_BUNDLE-3049fd56.js +0 -732
  46. package/lib/edge/USE_CLIENT_BUNDLE-8922846d.cjs +0 -23
  47. package/lib/node/USE_CLIENT_BUNDLE-09122ff1.cjs +0 -23
  48. package/lib/node/USE_CLIENT_BUNDLE-f4804af3.js +0 -732
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from "lru-cache";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import { createElement } from "react";
4
- import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-f4804af3.js";
4
+ import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-98a4fbf4.js";
5
5
  import "next/navigation";
6
6
  function getBlockComponentOptions(e) {
7
7
  var t;
@@ -187,21 +187,21 @@ output;
187
187
  context: n,
188
188
  event: o,
189
189
  state: s
190
- }), m = getIsolateContext(), d = m.global;
191
- d.setSync("global", d.derefInto()), d.setSync("log", function(...u) {
192
- console.log(...u);
193
- }), d.setSync(BUILDER_SET_STATE_NAME, function(u, f) {
194
- set(a, u, f), i == null || i(a);
195
- }), c.forEach(([u, f]) => {
196
- const l = typeof f == "object" ? new ivm.Reference(
190
+ }), m = getIsolateContext(), f = m.global;
191
+ f.setSync("global", f.derefInto()), f.setSync("log", function(...d) {
192
+ console.log(...d);
193
+ }), f.setSync(BUILDER_SET_STATE_NAME, function(d, u) {
194
+ set(a, d, u), i == null || i(a);
195
+ }), c.forEach(([d, u]) => {
196
+ const l = typeof u == "object" ? new ivm.Reference(
197
197
  // workaround: methods with default values for arguments is not being cloned over
198
- u === "builder" ? {
199
- ...f,
200
- getUserAttributes: () => f.getUserAttributes()
201
- } : f
198
+ d === "builder" ? {
199
+ ...u,
200
+ getUserAttributes: () => u.getUserAttributes()
201
+ } : u
202
202
  ) : null;
203
- d.setSync(getSyncValName(u), l);
204
- }), d.setSync(INJECTED_IVM_GLOBAL, ivm);
203
+ f.setSync(getSyncValName(d), l);
204
+ }), f.setSync(INJECTED_IVM_GLOBAL, ivm);
205
205
  const p = processCode({
206
206
  code: e,
207
207
  args: c
@@ -295,7 +295,7 @@ function getProcessedBlock({
295
295
  context: t
296
296
  }) : a;
297
297
  }
298
- const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"], isEmptyHtmlElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.includes(e.toLowerCase()), getComponent = ({
298
+ const getComponent = ({
299
299
  block: e,
300
300
  context: t,
301
301
  registeredComponents: n
@@ -433,28 +433,28 @@ function BlockStyles(e) {
433
433
  shouldEvaluateBindings: !0
434
434
  }), i = r.responsiveStyles, a = e.context.content, s = getSizesForBreakpoints(
435
435
  ((l = a == null ? void 0 : a.meta) == null ? void 0 : l.breakpoints) || {}
436
- ), c = i == null ? void 0 : i.large, m = i == null ? void 0 : i.medium, d = i == null ? void 0 : i.small, p = r.id;
436
+ ), c = i == null ? void 0 : i.large, m = i == null ? void 0 : i.medium, f = i == null ? void 0 : i.small, p = r.id;
437
437
  if (!p)
438
438
  return "";
439
439
  const g = c ? createCssClass({
440
440
  className: p,
441
441
  styles: c
442
- }) : "", u = m ? createCssClass({
442
+ }) : "", d = m ? createCssClass({
443
443
  className: p,
444
444
  styles: m,
445
445
  mediaQuery: getMaxWidthQueryForSize(
446
446
  "medium",
447
447
  s
448
448
  )
449
- }) : "", f = d ? createCssClass({
449
+ }) : "", u = f ? createCssClass({
450
450
  className: p,
451
- styles: d,
451
+ styles: f,
452
452
  mediaQuery: getMaxWidthQueryForSize(
453
453
  "small",
454
454
  s
455
455
  )
456
456
  }) : "";
457
- return [g, u, f].join(" ");
457
+ return [g, d, u].join(" ");
458
458
  };
459
459
  return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
460
460
  }
@@ -529,7 +529,7 @@ function getStyleAttribute(e) {
529
529
  return e;
530
530
  }
531
531
  }
532
- const getWrapperProps = ({
532
+ const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase()), getWrapperProps = ({
533
533
  componentOptions: e,
534
534
  builderBlock: t,
535
535
  context: n,
@@ -598,7 +598,7 @@ function RepeatedBlock(e) {
598
598
  );
599
599
  }
600
600
  function Block(e) {
601
- var m, d, p;
601
+ var m, f, p;
602
602
  const t = function() {
603
603
  return getComponent({
604
604
  block: e.block,
@@ -611,8 +611,8 @@ function Block(e) {
611
611
  context: e.context
612
612
  });
613
613
  }, o = function() {
614
- var u;
615
- return (u = e.block.repeat) != null && u.collection ? e.block : getProcessedBlock({
614
+ var d;
615
+ return (d = e.block.repeat) != null && d.collection ? e.block : getProcessedBlock({
616
616
  block: e.block,
617
617
  localState: e.context.localState,
618
618
  rootState: e.context.rootState,
@@ -626,20 +626,20 @@ function Block(e) {
626
626
  var l, h;
627
627
  if ((l = e.block.repeat) != null && l.collection)
628
628
  return !!((h = n()) != null && h.length);
629
- const u = "hide" in o() ? o().hide : !1;
630
- return ("show" in o() ? o().show : !0) && !u;
629
+ const d = "hide" in o() ? o().hide : !1;
630
+ return ("show" in o() ? o().show : !0) && !d;
631
631
  }, a = function() {
632
- var f;
633
- return !((f = t()) != null && f.component) && !n() ? o().children ?? [] : [];
632
+ var u;
633
+ return !((u = t()) != null && u.component) && !n() ? o().children ?? [] : [];
634
634
  }, s = function() {
635
- var u, f, l, h, y;
635
+ var d, u, l, h, y;
636
636
  return {
637
637
  blockChildren: o().children ?? [],
638
- componentRef: (u = t()) == null ? void 0 : u.component,
638
+ componentRef: (d = t()) == null ? void 0 : d.component,
639
639
  componentOptions: {
640
640
  ...getBlockComponentOptions(o()),
641
641
  builderContext: e.context,
642
- ...((f = t()) == null ? void 0 : f.name) === "Symbol" || ((l = t()) == null ? void 0 : l.name) === "Columns" ? {
642
+ ...((u = t()) == null ? void 0 : u.name) === "Symbol" || ((l = t()) == null ? void 0 : l.name) === "Columns" ? {
643
643
  builderComponents: e.registeredComponents
644
644
  } : {}
645
645
  },
@@ -664,59 +664,46 @@ function Block(e) {
664
664
  includeBlockProps: s().includeBlockProps,
665
665
  isInteractive: s().isInteractive
666
666
  }
667
- ) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
668
- isEmptyHtmlElement(r()) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
669
- BlockWrapper,
670
- {
671
- Wrapper: r(),
672
- block: o(),
673
- context: e.context,
674
- hasChildren: !1
675
- }
676
- ) }) : null,
677
- !isEmptyHtmlElement(r()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (d = n()) == null ? void 0 : d.map((g, u) => /* @__PURE__ */ jsx(
678
- RepeatedBlock,
679
- {
680
- repeatContext: g.context,
681
- block: g.block,
682
- registeredComponents: e.registeredComponents
683
- },
684
- u
685
- )) }) : null,
686
- !isEmptyHtmlElement(r()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
687
- BlockWrapper,
688
- {
689
- Wrapper: r(),
690
- block: o(),
691
- context: e.context,
692
- hasChildren: !0,
693
- children: [
694
- /* @__PURE__ */ jsx(
695
- ComponentRef,
696
- {
697
- componentRef: s().componentRef,
698
- componentOptions: s().componentOptions,
699
- blockChildren: s().blockChildren,
700
- context: s().context,
701
- registeredComponents: s().registeredComponents,
702
- builderBlock: s().builderBlock,
703
- includeBlockProps: s().includeBlockProps,
704
- isInteractive: s().isInteractive
705
- }
706
- ),
707
- (p = a()) == null ? void 0 : p.map((g) => /* @__PURE__ */ jsx(
708
- Block,
709
- {
710
- block: g,
711
- context: c,
712
- registeredComponents: e.registeredComponents
713
- },
714
- g.id
715
- ))
716
- ]
717
- }
718
- ) }) : null
719
- ] })
667
+ ) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (p = n()) == null ? void 0 : p.map((g, d) => /* @__PURE__ */ jsx(
668
+ RepeatedBlock,
669
+ {
670
+ repeatContext: g.context,
671
+ block: g.block,
672
+ registeredComponents: e.registeredComponents
673
+ },
674
+ d
675
+ )) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
676
+ BlockWrapper,
677
+ {
678
+ Wrapper: r(),
679
+ block: o(),
680
+ context: e.context,
681
+ children: [
682
+ /* @__PURE__ */ jsx(
683
+ ComponentRef,
684
+ {
685
+ componentRef: s().componentRef,
686
+ componentOptions: s().componentOptions,
687
+ blockChildren: s().blockChildren,
688
+ context: s().context,
689
+ registeredComponents: s().registeredComponents,
690
+ builderBlock: s().builderBlock,
691
+ includeBlockProps: s().includeBlockProps,
692
+ isInteractive: s().isInteractive
693
+ }
694
+ ),
695
+ (f = a()) == null ? void 0 : f.map((g) => /* @__PURE__ */ jsx(
696
+ Block,
697
+ {
698
+ block: g,
699
+ context: c,
700
+ registeredComponents: e.registeredComponents
701
+ },
702
+ g.id
703
+ ))
704
+ ]
705
+ }
706
+ ) }) })
720
707
  ] }) : null });
721
708
  }
722
709
  function Blocks(e) {
@@ -743,7 +730,7 @@ function Blocks(e) {
743
730
  );
744
731
  }
745
732
  function Columns(e) {
746
- var u;
733
+ var d;
747
734
  const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(l) {
748
735
  var h;
749
736
  return ((h = n[l]) == null ? void 0 : h.width) || 100 / n.length;
@@ -768,13 +755,13 @@ function Columns(e) {
768
755
  desktopStyle: "row"
769
756
  })
770
757
  };
771
- }, d = function(l) {
772
- const h = l === 0 ? 0 : t, y = i(l), b = `${h}px`, v = "100%", x = 0;
758
+ }, f = function(l) {
759
+ const h = l === 0 ? 0 : t, y = i(l), b = `${h}px`, I = "100%", x = 0;
773
760
  return {
774
761
  width: y,
775
762
  ["marginLeft"]: b,
776
763
  "--column-width-mobile": s({
777
- stackedStyle: v,
764
+ stackedStyle: I,
778
765
  desktopStyle: y
779
766
  }),
780
767
  "--column-margin-left-mobile": s({
@@ -782,7 +769,7 @@ function Columns(e) {
782
769
  desktopStyle: b
783
770
  }),
784
771
  "--column-width-tablet": a({
785
- stackedStyle: v,
772
+ stackedStyle: I,
786
773
  desktopStyle: y
787
774
  }),
788
775
  "--column-margin-left-tablet": a({
@@ -830,11 +817,11 @@ function Columns(e) {
830
817
  style: m(),
831
818
  children: [
832
819
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: g() }) }),
833
- (u = e.columns) == null ? void 0 : u.map((f, l) => /* @__PURE__ */ createElement(
820
+ (d = e.columns) == null ? void 0 : d.map((u, l) => /* @__PURE__ */ createElement(
834
821
  "div",
835
822
  {
836
823
  className: "builder-column div-39daef82-2",
837
- style: d(l),
824
+ style: f(l),
838
825
  key: l
839
826
  },
840
827
  /* @__PURE__ */ jsx(
@@ -847,7 +834,7 @@ function Columns(e) {
847
834
  },
848
835
  context: e.builderContext,
849
836
  registeredComponents: e.builderComponents,
850
- blocks: f.blocks
837
+ blocks: u.blocks
851
838
  }
852
839
  )
853
840
  ))
@@ -1338,13 +1325,13 @@ const getTopLevelDomain = (e) => {
1338
1325
  e.delete("srcset"), e.delete("noWebp");
1339
1326
  function n(a, s = 6e4) {
1340
1327
  return new Promise((c, m) => {
1341
- const d = document.createElement("img");
1328
+ const f = document.createElement("img");
1342
1329
  let p = !1;
1343
- d.onload = () => {
1344
- p = !0, c(d);
1345
- }, d.addEventListener("error", (g) => {
1330
+ f.onload = () => {
1331
+ p = !0, c(f);
1332
+ }, f.addEventListener("error", (g) => {
1346
1333
  console.warn("Image load failed", g.error), m(g.error);
1347
- }), d.src = a, setTimeout(() => {
1334
+ }), f.src = a, setTimeout(() => {
1348
1335
  p || m(new Error("Image load timed out"));
1349
1336
  }, s);
1350
1337
  });
@@ -1893,32 +1880,32 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
1893
1880
  includeRefs: s = !0,
1894
1881
  enrich: c,
1895
1882
  locale: m,
1896
- apiVersion: d = DEFAULT_API_VERSION,
1883
+ apiVersion: f = DEFAULT_API_VERSION,
1897
1884
  fields: p,
1898
1885
  omit: g,
1899
- offset: u,
1900
- cacheSeconds: f,
1886
+ offset: d,
1887
+ cacheSeconds: u,
1901
1888
  staleCacheSeconds: l,
1902
1889
  sort: h,
1903
1890
  includeUnpublished: y
1904
1891
  } = e;
1905
1892
  if (!a)
1906
1893
  throw new Error("Missing API key");
1907
- if (!["v2", "v3"].includes(d))
1908
- throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${d}'`);
1894
+ if (!["v2", "v3"].includes(f))
1895
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
1909
1896
  (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
1910
- const b = new URL(`https://cdn.builder.io/api/${d}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m ? `&locale=${m}` : ""}${c ? `&enrich=${c}` : ""}`);
1911
- if (b.searchParams.set("omit", g || "meta.componentsUsed"), p && b.searchParams.set("fields", p), Number.isFinite(u) && u > -1 && b.searchParams.set("offset", String(Math.floor(u))), typeof y == "boolean" && b.searchParams.set("includeUnpublished", String(y)), f && isPositiveNumber(f) && b.searchParams.set("cacheSeconds", String(f)), l && isPositiveNumber(l) && b.searchParams.set("staleCacheSeconds", String(l)), h) {
1897
+ const b = new URL(`https://cdn.builder.io/api/${f}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m ? `&locale=${m}` : ""}${c ? `&enrich=${c}` : ""}`);
1898
+ if (b.searchParams.set("omit", g || "meta.componentsUsed"), p && b.searchParams.set("fields", p), Number.isFinite(d) && d > -1 && b.searchParams.set("offset", String(Math.floor(d))), typeof y == "boolean" && b.searchParams.set("includeUnpublished", String(y)), u && isPositiveNumber(u) && b.searchParams.set("cacheSeconds", String(u)), l && isPositiveNumber(l) && b.searchParams.set("staleCacheSeconds", String(l)), h) {
1912
1899
  const S = flatten({
1913
1900
  sort: h
1914
1901
  });
1915
1902
  for (const C in S)
1916
1903
  b.searchParams.set(C, JSON.stringify(S[C]));
1917
1904
  }
1918
- const v = {
1905
+ const I = {
1919
1906
  ...getBuilderSearchParamsFromWindow(),
1920
1907
  ...normalizeSearchParams(e.options || {})
1921
- }, x = flatten(v);
1908
+ }, x = flatten(I);
1922
1909
  for (const S in x)
1923
1910
  b.searchParams.set(S, String(x[S]));
1924
1911
  if (o && b.searchParams.set("userAttributes", JSON.stringify(o)), r) {
@@ -1977,7 +1964,11 @@ async function fetchEntries(e) {
1977
1964
  return logger.error("Error fetching data. ", t), null;
1978
1965
  }
1979
1966
  }
1980
- const getAllContent = fetchEntries;
1967
+ const getAllContent = fetchEntries, DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
1968
+ function isFromTrustedHost(e, t) {
1969
+ const n = new URL(t.origin), o = n.hostname;
1970
+ return (e || DEFAULT_TRUSTED_HOSTS).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
1971
+ }
1981
1972
  function isPreviewing() {
1982
1973
  return !isBrowser() || isEditing() ? !1 : location.search.indexOf("builder.preview=") !== -1;
1983
1974
  }
@@ -2165,7 +2156,7 @@ const findParentElement = (e, t, n = !0) => {
2165
2156
  builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
2166
2157
  }
2167
2158
  };
2168
- }, SDK_VERSION = "0.12.1", registry = {};
2159
+ }, SDK_VERSION = "0.12.3", registry = {};
2169
2160
  function register(e, t) {
2170
2161
  let n = registry[e];
2171
2162
  if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
@@ -2225,40 +2216,43 @@ const setupBrowserForEditing = (e = {}) => {
2225
2216
  data: {
2226
2217
  options: e
2227
2218
  }
2228
- }, "*"), window.addEventListener("message", ({
2229
- data: o
2230
- }) => {
2231
- var r, i;
2232
- if (o != null && o.type)
2233
- switch (o.type) {
2219
+ }, "*"), window.addEventListener("message", (o) => {
2220
+ var i, a;
2221
+ if (!isFromTrustedHost(e.trustedHosts, o))
2222
+ return;
2223
+ const {
2224
+ data: r
2225
+ } = o;
2226
+ if (r != null && r.type)
2227
+ switch (r.type) {
2234
2228
  case "builder.evaluate": {
2235
- const a = o.data.text, s = o.data.arguments || [], c = o.data.id, m = new Function(a);
2236
- let d, p = null;
2229
+ const s = r.data.text, c = r.data.arguments || [], m = r.data.id, f = new Function(s);
2230
+ let p, g = null;
2237
2231
  try {
2238
- d = m.apply(null, s);
2239
- } catch (g) {
2240
- p = g;
2232
+ p = f.apply(null, c);
2233
+ } catch (d) {
2234
+ g = d;
2241
2235
  }
2242
- p ? (r = window.parent) == null || r.postMessage({
2236
+ g ? (i = window.parent) == null || i.postMessage({
2243
2237
  type: "builder.evaluateError",
2244
2238
  data: {
2245
- id: c,
2246
- error: p.message
2239
+ id: m,
2240
+ error: g.message
2247
2241
  }
2248
- }, "*") : d && typeof d.then == "function" ? d.then((g) => {
2242
+ }, "*") : p && typeof p.then == "function" ? p.then((d) => {
2249
2243
  var u;
2250
2244
  (u = window.parent) == null || u.postMessage({
2251
2245
  type: "builder.evaluateResult",
2252
2246
  data: {
2253
- id: c,
2254
- result: g
2247
+ id: m,
2248
+ result: d
2255
2249
  }
2256
2250
  }, "*");
2257
- }).catch(console.error) : (i = window.parent) == null || i.postMessage({
2251
+ }).catch(console.error) : (a = window.parent) == null || a.postMessage({
2258
2252
  type: "builder.evaluateResult",
2259
2253
  data: {
2260
- result: d,
2261
- id: c
2254
+ result: p,
2255
+ id: m
2262
2256
  }
2263
2257
  }, "*");
2264
2258
  break;
@@ -2310,6 +2304,10 @@ ${getFontCss({
2310
2304
  customFonts: e.customFonts
2311
2305
  })}
2312
2306
 
2307
+ .builder-button {
2308
+ all: unset;
2309
+ }
2310
+
2313
2311
  .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
2314
2312
  margin: 0;
2315
2313
  }
@@ -2354,7 +2352,7 @@ const getRootStateInitialValue = ({
2354
2352
  meta: e == null ? void 0 : e.meta
2355
2353
  } : void 0;
2356
2354
  function ContentComponent(e) {
2357
- var r, i, a, s, c, m, d, p, g;
2355
+ var r, i, a, s, c, m, f, p, g;
2358
2356
  const t = getUpdateVariantVisibilityScript({
2359
2357
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2360
2358
  variationId: (r = e.content) == null ? void 0 : r.testVariationId,
@@ -2370,10 +2368,10 @@ function ContentComponent(e) {
2370
2368
  ...components,
2371
2369
  ...e.customComponents || []
2372
2370
  ].reduce(
2373
- (u, { component: f, ...l }) => ({
2374
- ...u,
2371
+ (d, { component: u, ...l }) => ({
2372
+ ...d,
2375
2373
  [l.name]: {
2376
- component: f,
2374
+ component: u,
2377
2375
  ...serializeComponentInfo(l)
2378
2376
  }
2379
2377
  }),
@@ -2403,8 +2401,8 @@ function ContentComponent(e) {
2403
2401
  ...components,
2404
2402
  ...e.customComponents || []
2405
2403
  ].reduce(
2406
- (u, { component: f, ...l }) => ({
2407
- ...u,
2404
+ (d, { component: u, ...l }) => ({
2405
+ ...d,
2408
2406
  [l.name]: serializeComponentInfo(l)
2409
2407
  }),
2410
2408
  {}
@@ -2429,6 +2427,7 @@ function ContentComponent(e) {
2429
2427
  builderContextSignal: o,
2430
2428
  contentWrapper: e.contentWrapper,
2431
2429
  contentWrapperProps: e.contentWrapperProps,
2430
+ trustedHosts: e.trustedHosts,
2432
2431
  children: [
2433
2432
  e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
2434
2433
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
@@ -2436,7 +2435,7 @@ function ContentComponent(e) {
2436
2435
  {
2437
2436
  contentId: (a = o.content) == null ? void 0 : a.id,
2438
2437
  cssCode: (c = (s = o.content) == null ? void 0 : s.data) == null ? void 0 : c.cssCode,
2439
- customFonts: (d = (m = o.content) == null ? void 0 : m.data) == null ? void 0 : d.customFonts
2438
+ customFonts: (f = (m = o.content) == null ? void 0 : m.data) == null ? void 0 : f.customFonts
2440
2439
  }
2441
2440
  ) }),
2442
2441
  /* @__PURE__ */ jsx(
@@ -2507,7 +2506,8 @@ function ContentVariants(e) {
2507
2506
  blocksWrapper: e.blocksWrapper,
2508
2507
  blocksWrapperProps: e.blocksWrapperProps,
2509
2508
  contentWrapper: e.contentWrapper,
2510
- contentWrapperProps: e.contentWrapperProps
2509
+ contentWrapperProps: e.contentWrapperProps,
2510
+ trustedHosts: e.trustedHosts
2511
2511
  },
2512
2512
  s.testVariationId
2513
2513
  ))
@@ -2531,7 +2531,8 @@ function ContentVariants(e) {
2531
2531
  blocksWrapper: e.blocksWrapper,
2532
2532
  blocksWrapperProps: e.blocksWrapperProps,
2533
2533
  contentWrapper: e.contentWrapper,
2534
- contentWrapperProps: e.contentWrapperProps
2534
+ contentWrapperProps: e.contentWrapperProps,
2535
+ trustedHosts: e.trustedHosts
2535
2536
  }
2536
2537
  )
2537
2538
  ] });
@@ -2558,12 +2559,12 @@ const fetchSymbolContent = async ({
2558
2559
  async function Symbol$1(e) {
2559
2560
  var o, r, i, a, s;
2560
2561
  const t = function() {
2561
- var m, d;
2562
+ var m, f;
2562
2563
  return [
2563
2564
  e.attributes.className,
2564
2565
  "builder-symbol",
2565
2566
  (m = e.symbol) != null && m.inline ? "builder-inline-symbol" : void 0,
2566
- (d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2567
+ (f = e.symbol) != null && f.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2567
2568
  ].filter(Boolean).join(" ");
2568
2569
  }, n = ((o = e.symbol) == null ? void 0 : o.content) || await fetchSymbolContent({
2569
2570
  symbol: e.symbol,
@@ -2622,39 +2623,41 @@ const fetchBuilderProps = async (e) => {
2622
2623
  };
2623
2624
  };
2624
2625
  export {
2625
- getBuilderSearchParams as A,
2626
+ getAllContent as A,
2626
2627
  Blocks as B,
2627
2628
  ContentVariants as C,
2628
- track as D,
2629
- fetchBuilderProps as E,
2629
+ getContent as D,
2630
+ getBuilderSearchParams as E,
2631
+ track as F,
2632
+ fetchBuilderProps as G,
2630
2633
  RenderBlocks as R,
2631
2634
  Symbol$1 as S,
2632
2635
  Text as T,
2633
2636
  _track as _,
2634
2637
  getBlockActions as a,
2635
- getSrcSet as b,
2636
- isJsScript as c,
2637
- isBrowser as d,
2638
- getDefaultCanTrack as e,
2639
- isPreviewing as f,
2638
+ isEditing as b,
2639
+ getSrcSet as c,
2640
+ isJsScript as d,
2641
+ isBrowser as e,
2642
+ getDefaultCanTrack as f,
2640
2643
  getBlockProperties as g,
2641
- evaluate as h,
2642
- isEditing as i,
2643
- getInteractionPropertiesForEvent as j,
2644
- fastClone as k,
2644
+ isPreviewing as h,
2645
+ isEmptyElement as i,
2646
+ isFromTrustedHost as j,
2647
+ evaluate as k,
2645
2648
  logger as l,
2646
- createRegisterComponentMessage as m,
2647
- fetchOneEntry as n,
2648
- fetch$1 as o,
2649
- init as p,
2650
- RenderContent as q,
2649
+ getInteractionPropertiesForEvent as m,
2650
+ fastClone as n,
2651
+ createRegisterComponentMessage as o,
2652
+ fetchOneEntry as p,
2653
+ fetch$1 as q,
2651
2654
  registerInsertMenu as r,
2652
2655
  setupBrowserForEditing as s,
2653
- Columns as t,
2654
- register as u,
2655
- setEditorSettings as v,
2656
- _processContentResult as w,
2657
- fetchEntries as x,
2658
- getAllContent as y,
2659
- getContent as z
2656
+ init as t,
2657
+ RenderContent as u,
2658
+ Columns as v,
2659
+ register as w,
2660
+ setEditorSettings as x,
2661
+ _processContentResult as y,
2662
+ fetchEntries as z
2660
2663
  };