@builder.io/sdk-react 0.8.1 → 0.9.0

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.
@@ -2,7 +2,7 @@
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { createContext, useState, useContext, createElement, useRef, useEffect } from "react";
4
4
  import { i as isEditing, j as isBrowser, k as getUserAttributes, l as fastClone, m as logger, n as checkIsDefined, T as TARGET, r as register, o as getDefaultCanTrack, p as _track, a as isPreviewing, c as createRegisterComponentMessage, b as fetchOneEntry, q as fetch$1, u as components, v as serializeComponentInfo, w as handleABTestingSync } from "./server-entry-e4cd1e05.js";
5
- import { _ as W, h as O, f as U, g as H, e as K, d as z, s as q, t as Y } from "./server-entry-e4cd1e05.js";
5
+ import { _ as U, h as H, f as K, g as z, e as q, d as Y, s as G, t as J } from "./server-entry-e4cd1e05.js";
6
6
  import { createRequire } from "node:module";
7
7
  function Button(e) {
8
8
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -39,7 +39,9 @@ const builderContext = createContext({
39
39
  apiKey: null,
40
40
  apiVersion: void 0,
41
41
  componentInfos: {},
42
- inheritedStyles: {}
42
+ inheritedStyles: {},
43
+ BlocksWrapper: "div",
44
+ BlocksWrapperProps: {}
43
45
  }), ComponentsContext = createContext({ registeredComponents: {} });
44
46
  function getBlockComponentOptions(e) {
45
47
  var t;
@@ -182,28 +184,28 @@ output;
182
184
  event: i,
183
185
  state: l
184
186
  }), s = getIsolateContext(), d = s.global;
185
- d.setSync("global", d.derefInto()), d.setSync("log", function(...y) {
186
- console.log(...y);
187
- }), d.setSync(BUILDER_SET_STATE_NAME, function(y, f) {
188
- set(r, y, f), a == null || a(r);
189
- }), c.forEach(([y, f]) => {
190
- const S = typeof f == "object" ? new ivm.Reference(
187
+ d.setSync("global", d.derefInto()), d.setSync("log", function(...S) {
188
+ console.log(...S);
189
+ }), d.setSync(BUILDER_SET_STATE_NAME, function(S, f) {
190
+ set(r, S, f), a == null || a(r);
191
+ }), c.forEach(([S, f]) => {
192
+ const p = typeof f == "object" ? new ivm.Reference(
191
193
  // workaround: methods with default values for arguments is not being cloned over
192
- y === "builder" ? {
194
+ S === "builder" ? {
193
195
  ...f,
194
196
  getUserAttributes: () => f.getUserAttributes()
195
197
  } : f
196
198
  ) : null;
197
- d.setSync(getSyncValName(y), S);
199
+ d.setSync(getSyncValName(S), p);
198
200
  }), d.setSync(INJECTED_IVM_GLOBAL, ivm);
199
201
  const g = processCode({
200
202
  code: e,
201
203
  args: c
202
- }), b = s.evalSync(g);
204
+ }), x = s.evalSync(g);
203
205
  try {
204
- return JSON.parse(b);
206
+ return JSON.parse(x);
205
207
  } catch {
206
- return b;
208
+ return x;
207
209
  }
208
210
  }, chooseBrowserOrServerEval = (e) => isBrowser() ? runInBrowser(e) : runInNode(e);
209
211
  function evaluate({
@@ -434,14 +436,14 @@ function BlockStyles(e) {
434
436
  const g = l ? createCssClass({
435
437
  className: d,
436
438
  styles: l
437
- }) : "", b = c ? createCssClass({
439
+ }) : "", x = c ? createCssClass({
438
440
  className: d,
439
441
  styles: c,
440
442
  mediaQuery: getMaxWidthQueryForSize(
441
443
  "medium",
442
444
  r
443
445
  )
444
- }) : "", y = s ? createCssClass({
446
+ }) : "", S = s ? createCssClass({
445
447
  className: d,
446
448
  styles: s,
447
449
  mediaQuery: getMaxWidthQueryForSize(
@@ -449,7 +451,7 @@ function BlockStyles(e) {
449
451
  r
450
452
  )
451
453
  }) : "";
452
- return [g, b, y].join(" ");
454
+ return [g, x, S].join(" ");
453
455
  }
454
456
  return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
455
457
  }
@@ -486,7 +488,9 @@ function getBlockActions(e) {
486
488
  }
487
489
  return t;
488
490
  }
489
- function transformBlockProperties(e) {
491
+ function transformBlockProperties({
492
+ properties: e
493
+ }) {
490
494
  return e.className = e.class, delete e.class, e;
491
495
  }
492
496
  const extractRelevantRootBlockProperties = (e) => ({
@@ -504,7 +508,11 @@ function getBlockProperties({
504
508
  style: e.style ? getStyleAttribute(e.style) : void 0,
505
509
  class: [e.id, "builder-block", e.class, (i = e.properties) == null ? void 0 : i.class].filter(Boolean).join(" ")
506
510
  };
507
- return transformBlockProperties(n);
511
+ return transformBlockProperties({
512
+ properties: n,
513
+ context: t,
514
+ block: e
515
+ });
508
516
  }
509
517
  function getStyleAttribute(e) {
510
518
  switch (TARGET) {
@@ -663,7 +671,7 @@ function RepeatedBlock(e) {
663
671
  ) });
664
672
  }
665
673
  function Block(e) {
666
- var d, g, b, y;
674
+ var d, g, x, S;
667
675
  function t() {
668
676
  return getComponent({
669
677
  block: e.block,
@@ -692,32 +700,32 @@ function Block(e) {
692
700
  return e.block.tagName || "div";
693
701
  }
694
702
  function a() {
695
- var k, C;
696
- if ((k = e.block.repeat) != null && k.collection)
697
- return !!((C = n == null ? void 0 : n()) != null && C.length);
703
+ var C, E;
704
+ if ((C = e.block.repeat) != null && C.collection)
705
+ return !!((E = n == null ? void 0 : n()) != null && E.length);
698
706
  const f = "hide" in i() ? i().hide : !1;
699
707
  return ("show" in i() ? i().show : !0) && !f;
700
708
  }
701
709
  function r() {
702
- var S;
703
- return !((S = t == null ? void 0 : t()) != null && S.component) && !n() ? i().children ?? [] : [];
710
+ var p;
711
+ return !((p = t == null ? void 0 : t()) != null && p.component) && !n() ? i().children ?? [] : [];
704
712
  }
705
713
  function l() {
706
- var f, S, k, C, v;
714
+ var f, p, C, E, v;
707
715
  return {
708
716
  blockChildren: i().children ?? [],
709
717
  componentRef: (f = t == null ? void 0 : t()) == null ? void 0 : f.component,
710
718
  componentOptions: {
711
719
  ...getBlockComponentOptions(i()),
712
720
  builderContext: e.context,
713
- ...((S = t == null ? void 0 : t()) == null ? void 0 : S.name) === "Symbol" || ((k = t == null ? void 0 : t()) == null ? void 0 : k.name) === "Columns" ? {
721
+ ...((p = t == null ? void 0 : t()) == null ? void 0 : p.name) === "Symbol" || ((C = t == null ? void 0 : t()) == null ? void 0 : C.name) === "Columns" ? {
714
722
  builderComponents: e.registeredComponents
715
723
  } : {}
716
724
  },
717
725
  context: c,
718
726
  registeredComponents: e.registeredComponents,
719
727
  builderBlock: i(),
720
- includeBlockProps: ((C = t == null ? void 0 : t()) == null ? void 0 : C.noWrap) === !0,
728
+ includeBlockProps: ((E = t == null ? void 0 : t()) == null ? void 0 : E.noWrap) === !0,
721
729
  isInteractive: !((v = t == null ? void 0 : t()) != null && v.isRSC)
722
730
  };
723
731
  }
@@ -744,14 +752,14 @@ function Block(e) {
744
752
  hasChildren: !1
745
753
  }
746
754
  ) }) : null,
747
- !isEmptyHtmlElement(o()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (g = n()) == null ? void 0 : g.map((f, S) => /* @__PURE__ */ jsx(
755
+ !isEmptyHtmlElement(o()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (g = n()) == null ? void 0 : g.map((f, p) => /* @__PURE__ */ jsx(
748
756
  RepeatedBlock,
749
757
  {
750
758
  repeatContext: f.context,
751
759
  block: f.block,
752
760
  registeredComponents: e.registeredComponents
753
761
  },
754
- S
762
+ p
755
763
  )) }) : null,
756
764
  !isEmptyHtmlElement(o()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
757
765
  BlockWrapper,
@@ -774,7 +782,7 @@ function Block(e) {
774
782
  isInteractive: l().isInteractive
775
783
  }
776
784
  ),
777
- (b = r()) == null ? void 0 : b.map((f) => /* @__PURE__ */ jsx(
785
+ (x = r()) == null ? void 0 : x.map((f) => /* @__PURE__ */ jsx(
778
786
  Block,
779
787
  {
780
788
  block: f,
@@ -783,7 +791,7 @@ function Block(e) {
783
791
  },
784
792
  "block-" + f.id
785
793
  )),
786
- (y = r()) == null ? void 0 : y.map((f) => /* @__PURE__ */ jsx(
794
+ (S = r()) == null ? void 0 : S.map((f) => /* @__PURE__ */ jsx(
787
795
  BlockStyles,
788
796
  {
789
797
  block: f,
@@ -829,19 +837,20 @@ function BlocksWrapper(e) {
829
837
  }
830
838
  return /* @__PURE__ */ jsxs(Fragment, { children: [
831
839
  /* @__PURE__ */ jsx(
832
- "div",
840
+ e.BlocksWrapper,
833
841
  {
834
- className: t() + " div-02c7a115",
842
+ className: t() + " props-blocks-wrapper-4f2c12d8",
835
843
  "builder-path": e.path,
836
844
  "builder-parent-id": e.parent,
837
845
  style: e.styleProp,
838
846
  onClick: (o) => n(),
839
847
  onMouseEnter: (o) => i(),
840
848
  onKeyPress: (o) => n(),
849
+ ...e.BlocksWrapperProps,
841
850
  children: e.children
842
851
  }
843
852
  ),
844
- /* @__PURE__ */ jsx("style", { children: `.div-02c7a115 {
853
+ /* @__PURE__ */ jsx("style", { children: `.props-blocks-wrapper-4f2c12d8 {
845
854
  display: flex;
846
855
  flex-direction: column;
847
856
  align-items: stretch;
@@ -849,7 +858,7 @@ function BlocksWrapper(e) {
849
858
  ] });
850
859
  }
851
860
  function Blocks(e) {
852
- var i, o;
861
+ var i, o, a, r;
853
862
  const t = useContext(builderContext), n = useContext(ComponentsContext);
854
863
  return /* @__PURE__ */ jsxs(
855
864
  BlocksWrapper,
@@ -858,59 +867,61 @@ function Blocks(e) {
858
867
  parent: e.parent,
859
868
  path: e.path,
860
869
  styleProp: e.styleProp,
870
+ BlocksWrapper: (i = e.context) == null ? void 0 : i.BlocksWrapper,
871
+ BlocksWrapperProps: (o = e.context) == null ? void 0 : o.BlocksWrapperProps,
861
872
  children: [
862
- e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (i = e.blocks) == null ? void 0 : i.map((a) => /* @__PURE__ */ jsx(
873
+ e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (a = e.blocks) == null ? void 0 : a.map((l) => /* @__PURE__ */ jsx(
863
874
  Block,
864
875
  {
865
- block: a,
876
+ block: l,
866
877
  context: e.context || t,
867
878
  registeredComponents: e.registeredComponents || n.registeredComponents
868
879
  },
869
- "render-block-" + a.id
880
+ "render-block-" + l.id
870
881
  )) }) : null,
871
- e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (o = e.blocks) == null ? void 0 : o.map((a) => /* @__PURE__ */ jsx(
882
+ e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (r = e.blocks) == null ? void 0 : r.map((l) => /* @__PURE__ */ jsx(
872
883
  BlockStyles,
873
884
  {
874
- block: a,
885
+ block: l,
875
886
  context: e.context || t
876
887
  },
877
- "block-style-" + a.id
888
+ "block-style-" + l.id
878
889
  )) }) : null
879
890
  ]
880
891
  }
881
892
  );
882
893
  }
883
894
  function Columns(e) {
884
- var C;
895
+ var E;
885
896
  const [t, n] = useState(
886
897
  () => typeof e.space == "number" ? e.space || 0 : 20
887
898
  ), [i, o] = useState(() => e.columns || []), [a, r] = useState(
888
899
  () => e.stackColumnsAt || "tablet"
889
900
  );
890
901
  function l(v) {
891
- var I;
892
- return ((I = i[v]) == null ? void 0 : I.width) || 100 / i.length;
902
+ var k;
903
+ return ((k = i[v]) == null ? void 0 : k.width) || 100 / i.length;
893
904
  }
894
905
  function c(v) {
895
- const I = t * (i.length - 1) / i.length;
896
- return `calc(${l(v)}% - ${I}px)`;
906
+ const k = t * (i.length - 1) / i.length;
907
+ return `calc(${l(v)}% - ${k}px)`;
897
908
  }
898
909
  function s({
899
910
  stackedStyle: v,
900
- desktopStyle: I
911
+ desktopStyle: k
901
912
  }) {
902
- return a === "tablet" ? v : I;
913
+ return a === "tablet" ? v : k;
903
914
  }
904
915
  function d({
905
916
  stackedStyle: v,
906
- desktopStyle: I
917
+ desktopStyle: k
907
918
  }) {
908
- return a === "never" ? I : v;
919
+ return a === "never" ? k : v;
909
920
  }
910
- const [g, b] = useState(
921
+ const [g, x] = useState(
911
922
  () => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
912
923
  );
913
- function y() {
924
+ function S() {
914
925
  return {
915
926
  "--flex-dir": g,
916
927
  "--flex-dir-tablet": s({
@@ -920,7 +931,7 @@ function Columns(e) {
920
931
  };
921
932
  }
922
933
  function f(v) {
923
- const I = v === 0 ? 0 : t, T = c(v), w = `${I}px`, R = "100%", j = 0;
934
+ const k = v === 0 ? 0 : t, T = c(v), w = `${k}px`, R = "100%", j = 0;
924
935
  return {
925
936
  width: T,
926
937
  ["marginLeft"]: w,
@@ -942,15 +953,15 @@ function Columns(e) {
942
953
  })
943
954
  };
944
955
  }
945
- function S(v) {
956
+ function p(v) {
946
957
  var T, w;
947
958
  return getSizesForBreakpoints(
948
959
  ((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
949
960
  )[v].max;
950
961
  }
951
- function k() {
962
+ function C() {
952
963
  return `
953
- @media (max-width: ${S("medium")}px) {
964
+ @media (max-width: ${p("medium")}px) {
954
965
  .${e.builderBlock.id}-breakpoints {
955
966
  flex-direction: var(--flex-dir-tablet);
956
967
  align-items: stretch;
@@ -962,7 +973,7 @@ function Columns(e) {
962
973
  }
963
974
  }
964
975
 
965
- @media (max-width: ${S("small")}px) {
976
+ @media (max-width: ${p("small")}px) {
966
977
  .${e.builderBlock.id}-breakpoints {
967
978
  flex-direction: var(--flex-dir);
968
979
  align-items: stretch;
@@ -980,20 +991,20 @@ function Columns(e) {
980
991
  "div",
981
992
  {
982
993
  className: `builder-columns ${e.builderBlock.id}-breakpoints div-53636e90`,
983
- style: y(),
994
+ style: S(),
984
995
  children: [
985
- /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: k() }) }),
986
- (C = e.columns) == null ? void 0 : C.map((v, I) => /* @__PURE__ */ createElement(
996
+ /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: C() }) }),
997
+ (E = e.columns) == null ? void 0 : E.map((v, k) => /* @__PURE__ */ createElement(
987
998
  "div",
988
999
  {
989
1000
  className: "builder-column div-53636e90-2",
990
- style: f(I),
991
- key: I
1001
+ style: f(k),
1002
+ key: k
992
1003
  },
993
1004
  /* @__PURE__ */ jsx(
994
1005
  Blocks,
995
1006
  {
996
- path: `component.options.columns.${I}.blocks`,
1007
+ path: `component.options.columns.${k}.blocks`,
997
1008
  parent: e.builderBlock.id,
998
1009
  styleProp: {
999
1010
  flexGrow: "1"
@@ -1485,13 +1496,13 @@ function Embed(e) {
1485
1496
  const g = s[d];
1486
1497
  if (g.src && !n.includes(g.src)) {
1487
1498
  n.push(g.src);
1488
- const b = document.createElement("script");
1489
- b.async = !0, b.src = g.src, document.head.appendChild(b);
1499
+ const x = document.createElement("script");
1500
+ x.async = !0, x.src = g.src, document.head.appendChild(x);
1490
1501
  } else if (isJsScript(g) && !o.includes(g.innerText))
1491
1502
  try {
1492
1503
  o.push(g.innerText), new Function(g.innerText)();
1493
- } catch (b) {
1494
- console.warn("`Embed`: Error running script:", b);
1504
+ } catch (x) {
1505
+ console.warn("`Embed`: Error running script:", x);
1495
1506
  }
1496
1507
  }
1497
1508
  }
@@ -1538,8 +1549,8 @@ const componentInfo$6 = {
1538
1549
  let g = !1;
1539
1550
  d.onload = () => {
1540
1551
  g = !0, c(d);
1541
- }, d.addEventListener("error", (b) => {
1542
- console.warn("Image load failed", b.error), s(b.error);
1552
+ }, d.addEventListener("error", (x) => {
1553
+ console.warn("Image load failed", x.error), s(x.error);
1543
1554
  }), d.src = r, setTimeout(() => {
1544
1555
  g || s(new Error("Image load timed out"));
1545
1556
  }, l);
@@ -2122,7 +2133,7 @@ const findParentElement = (e, t, n = !0) => {
2122
2133
  builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
2123
2134
  }
2124
2135
  };
2125
- }, SDK_VERSION = "0.8.1", registerInsertMenu = () => {
2136
+ }, SDK_VERSION = "0.9.0", registerInsertMenu = () => {
2126
2137
  register("insertMenu", {
2127
2138
  name: "_default",
2128
2139
  default: !0,
@@ -2175,8 +2186,8 @@ const setupBrowserForEditing = (e = {}) => {
2175
2186
  let d, g = null;
2176
2187
  try {
2177
2188
  d = s.apply(null, l);
2178
- } catch (b) {
2179
- g = b;
2189
+ } catch (x) {
2190
+ g = x;
2180
2191
  }
2181
2192
  g ? (o = window.parent) == null || o.postMessage({
2182
2193
  type: "builder.evaluateError",
@@ -2184,13 +2195,13 @@ const setupBrowserForEditing = (e = {}) => {
2184
2195
  id: c,
2185
2196
  error: g.message
2186
2197
  }
2187
- }, "*") : d && typeof d.then == "function" ? d.then((b) => {
2188
- var y;
2189
- (y = window.parent) == null || y.postMessage({
2198
+ }, "*") : d && typeof d.then == "function" ? d.then((x) => {
2199
+ var S;
2200
+ (S = window.parent) == null || S.postMessage({
2190
2201
  type: "builder.evaluateResult",
2191
2202
  data: {
2192
2203
  id: c,
2193
- result: b
2204
+ result: x
2194
2205
  }
2195
2206
  }, "*");
2196
2207
  }).catch(console.error) : (a = window.parent) == null || a.postMessage({
@@ -2206,10 +2217,10 @@ const setupBrowserForEditing = (e = {}) => {
2206
2217
  })));
2207
2218
  };
2208
2219
  function EnableEditor(e) {
2209
- var T, w, R, j, B, A, P;
2220
+ var R, j, B, P, A, F, _;
2210
2221
  const t = useRef(null), [n, i] = useState(() => 0);
2211
2222
  function o(u) {
2212
- var h, x, p, E, F;
2223
+ var h, b, y, I, V;
2213
2224
  const m = {
2214
2225
  ...e.builderContextSignal.content,
2215
2226
  ...u,
@@ -2218,44 +2229,46 @@ function EnableEditor(e) {
2218
2229
  ...u == null ? void 0 : u.data
2219
2230
  },
2220
2231
  meta: {
2221
- ...(x = e.builderContextSignal.content) == null ? void 0 : x.meta,
2232
+ ...(b = e.builderContextSignal.content) == null ? void 0 : b.meta,
2222
2233
  ...u == null ? void 0 : u.meta,
2223
- breakpoints: ((p = u == null ? void 0 : u.meta) == null ? void 0 : p.breakpoints) || ((F = (E = e.builderContextSignal.content) == null ? void 0 : E.meta) == null ? void 0 : F.breakpoints)
2234
+ breakpoints: ((y = u == null ? void 0 : u.meta) == null ? void 0 : y.breakpoints) || ((V = (I = e.builderContextSignal.content) == null ? void 0 : I.meta) == null ? void 0 : V.breakpoints)
2224
2235
  }
2225
2236
  };
2226
- e.setBuilderContextSignal((_) => ({
2227
- ..._,
2237
+ e.setBuilderContextSignal((W) => ({
2238
+ ...W,
2228
2239
  content: m
2229
2240
  }));
2230
2241
  }
2231
2242
  useState(() => 0);
2232
2243
  const [a, r] = useState(
2233
2244
  () => !1
2245
+ ), [l, c] = useState(
2246
+ () => e.contentWrapper || "div"
2234
2247
  );
2235
- function l(u) {
2248
+ function s(u) {
2236
2249
  var h;
2237
2250
  const { data: m } = u;
2238
2251
  if (m)
2239
2252
  switch (m.type) {
2240
2253
  case "builder.configureSdk": {
2241
- const x = m.data, { breakpoints: p, contentId: E } = x;
2242
- if (!E || E !== ((h = e.builderContextSignal.content) == null ? void 0 : h.id))
2254
+ const b = m.data, { breakpoints: y, contentId: I } = b;
2255
+ if (!I || I !== ((h = e.builderContextSignal.content) == null ? void 0 : h.id))
2243
2256
  return;
2244
- p && o({
2257
+ y && o({
2245
2258
  meta: {
2246
- breakpoints: p
2259
+ breakpoints: y
2247
2260
  }
2248
2261
  }), i(n + 1);
2249
2262
  break;
2250
2263
  }
2251
2264
  case "builder.contentUpdate": {
2252
- const x = m.data, p = x.key || x.alias || x.entry || x.modelName, E = x.data;
2253
- p === e.model && (o(E), i(n + 1));
2265
+ const b = m.data, y = b.key || b.alias || b.entry || b.modelName, I = b.data;
2266
+ y === e.model && (o(I), i(n + 1));
2254
2267
  break;
2255
2268
  }
2256
2269
  }
2257
2270
  }
2258
- function c() {
2271
+ function d() {
2259
2272
  var m, h;
2260
2273
  const u = (h = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : h.jsCode;
2261
2274
  u && evaluate({
@@ -2266,24 +2279,24 @@ function EnableEditor(e) {
2266
2279
  rootSetState: e.builderContextSignal.rootSetState
2267
2280
  });
2268
2281
  }
2269
- const [s, d] = useState(() => ({})), [g, b] = useState(() => !1);
2270
- function y(u) {
2282
+ const [g, x] = useState(() => ({})), [S, f] = useState(() => !1);
2283
+ function p(u) {
2271
2284
  var m, h;
2272
2285
  if (e.builderContextSignal.content) {
2273
- const x = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, p = (h = e.builderContextSignal.content) == null ? void 0 : h.id;
2286
+ const b = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, y = (h = e.builderContextSignal.content) == null ? void 0 : h.id;
2274
2287
  _track({
2275
2288
  type: "click",
2276
2289
  canTrack: getDefaultCanTrack(e.canTrack),
2277
- contentId: p,
2290
+ contentId: y,
2278
2291
  apiKey: e.apiKey,
2279
- variationId: x !== p ? x : void 0,
2292
+ variationId: b !== y ? b : void 0,
2280
2293
  ...getInteractionPropertiesForEvent(u),
2281
- unique: !g
2294
+ unique: !S
2282
2295
  });
2283
2296
  }
2284
- g || b(!0);
2297
+ S || f(!0);
2285
2298
  }
2286
- function f(u) {
2299
+ function C(u) {
2287
2300
  return u.replace(
2288
2301
  /{{([^}]+)}}/g,
2289
2302
  (m, h) => evaluate({
@@ -2295,32 +2308,32 @@ function EnableEditor(e) {
2295
2308
  })
2296
2309
  );
2297
2310
  }
2298
- function S({ url: u, key: m }) {
2311
+ function E({ url: u, key: m }) {
2299
2312
  fetch$1(u).then((h) => h.json()).then((h) => {
2300
- var p, E;
2301
- const x = {
2313
+ var y, I;
2314
+ const b = {
2302
2315
  ...e.builderContextSignal.rootState,
2303
2316
  [m]: h
2304
2317
  };
2305
- (E = (p = e.builderContextSignal).rootSetState) == null || E.call(p, x), s[m] = !0;
2318
+ (I = (y = e.builderContextSignal).rootSetState) == null || I.call(y, b), g[m] = !0;
2306
2319
  }).catch((h) => {
2307
2320
  console.error("error fetching dynamic data", u, h);
2308
2321
  });
2309
2322
  }
2310
- function k() {
2323
+ function v() {
2311
2324
  var m, h;
2312
2325
  const u = ((h = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : h.httpRequests) ?? {};
2313
- Object.entries(u).forEach(([x, p]) => {
2314
- if (p && (!s[x] || isEditing())) {
2315
- const E = f(p);
2316
- S({
2317
- url: E,
2318
- key: x
2326
+ Object.entries(u).forEach(([b, y]) => {
2327
+ if (y && (!g[b] || isEditing())) {
2328
+ const I = C(y);
2329
+ E({
2330
+ url: I,
2331
+ key: b
2319
2332
  });
2320
2333
  }
2321
2334
  });
2322
2335
  }
2323
- function C() {
2336
+ function k() {
2324
2337
  isEditing() && window.dispatchEvent(
2325
2338
  new CustomEvent(
2326
2339
  "builder:component:stateChange",
@@ -2335,8 +2348,8 @@ function EnableEditor(e) {
2335
2348
  )
2336
2349
  );
2337
2350
  }
2338
- function v(u) {
2339
- i(n + 1), window.addEventListener("message", l), registerInsertMenu(), setupBrowserForEditing({
2351
+ function T(u) {
2352
+ i(n + 1), window.addEventListener("message", s), registerInsertMenu(), setupBrowserForEditing({
2340
2353
  ...e.locale ? {
2341
2354
  locale: e.locale
2342
2355
  } : {},
@@ -2349,61 +2362,61 @@ function EnableEditor(e) {
2349
2362
  }), Object.values(
2350
2363
  e.builderContextSignal.componentInfos
2351
2364
  ).forEach((m) => {
2352
- var x;
2365
+ var b;
2353
2366
  const h = createRegisterComponentMessage(m);
2354
- (x = window.parent) == null || x.postMessage(h, "*");
2367
+ (b = window.parent) == null || b.postMessage(h, "*");
2355
2368
  }), window.addEventListener(
2356
2369
  "builder:component:stateChangeListenerActivated",
2357
- C
2370
+ k
2358
2371
  );
2359
2372
  }
2360
- function I(u) {
2361
- const m = new URL(location.href).searchParams, h = m.get("builder.preview"), x = m.get(
2373
+ function w(u) {
2374
+ const m = new URL(location.href).searchParams, h = m.get("builder.preview"), b = m.get(
2362
2375
  `builder.preview.${h}`
2363
- ), p = m.get("apiKey") || m.get("builder.space");
2364
- h === e.model && p === e.apiKey && (!e.content || x === e.content.id) && fetchOneEntry({
2376
+ ), y = m.get("apiKey") || m.get("builder.space");
2377
+ h === e.model && y === e.apiKey && (!e.content || b === e.content.id) && fetchOneEntry({
2365
2378
  model: e.model,
2366
2379
  apiKey: e.apiKey,
2367
2380
  apiVersion: e.builderContextSignal.apiVersion
2368
- }).then((E) => {
2369
- E && o(E);
2381
+ }).then((I) => {
2382
+ I && o(I);
2370
2383
  });
2371
2384
  }
2372
2385
  return useEffect(() => {
2373
2386
  var u;
2374
2387
  return (u = t.current) == null || u.addEventListener(
2375
2388
  "initeditingbldr",
2376
- v
2389
+ T
2377
2390
  ), () => {
2378
2391
  var m;
2379
2392
  return (m = t.current) == null ? void 0 : m.removeEventListener(
2380
2393
  "initeditingbldr",
2381
- v
2394
+ T
2382
2395
  );
2383
2396
  };
2384
2397
  }, []), useEffect(() => {
2385
2398
  var u;
2386
2399
  return (u = t.current) == null || u.addEventListener(
2387
2400
  "initpreviewingbldr",
2388
- I
2401
+ w
2389
2402
  ), () => {
2390
2403
  var m;
2391
2404
  return (m = t.current) == null ? void 0 : m.removeEventListener(
2392
2405
  "initpreviewingbldr",
2393
- I
2406
+ w
2394
2407
  );
2395
2408
  };
2396
2409
  }, []), useEffect(() => {
2397
2410
  var u, m;
2398
2411
  if (isBrowser()) {
2399
2412
  if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
2400
- const x = (u = e.builderContextSignal.content) == null ? void 0 : u.testVariationId, p = (m = e.builderContextSignal.content) == null ? void 0 : m.id, E = e.apiKey;
2413
+ const b = (u = e.builderContextSignal.content) == null ? void 0 : u.testVariationId, y = (m = e.builderContextSignal.content) == null ? void 0 : m.id, I = e.apiKey;
2401
2414
  _track({
2402
2415
  type: "impression",
2403
2416
  canTrack: !0,
2404
- contentId: p,
2405
- apiKey: E,
2406
- variationId: x !== p ? x : void 0
2417
+ contentId: y,
2418
+ apiKey: I,
2419
+ variationId: b !== y ? b : void 0
2407
2420
  });
2408
2421
  }
2409
2422
  isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
@@ -2411,37 +2424,38 @@ function EnableEditor(e) {
2411
2424
  }, []), useEffect(() => {
2412
2425
  e.apiKey || logger.error(
2413
2426
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
2414
- ), c(), k(), C();
2427
+ ), d(), v(), k();
2415
2428
  }, []), useEffect(() => {
2416
2429
  e.content && o(e.content);
2417
2430
  }, [e.content]), useEffect(() => {
2418
2431
  }, [a]), useEffect(() => {
2419
- c();
2432
+ d();
2420
2433
  }, [
2421
- (w = (T = e.builderContextSignal.content) == null ? void 0 : T.data) == null ? void 0 : w.jsCode,
2434
+ (j = (R = e.builderContextSignal.content) == null ? void 0 : R.data) == null ? void 0 : j.jsCode,
2422
2435
  e.builderContextSignal.rootState
2423
2436
  ]), useEffect(() => {
2437
+ v();
2438
+ }, [(P = (B = e.builderContextSignal.content) == null ? void 0 : B.data) == null ? void 0 : P.httpRequests]), useEffect(() => {
2424
2439
  k();
2425
- }, [(j = (R = e.builderContextSignal.content) == null ? void 0 : R.data) == null ? void 0 : j.httpRequests]), useEffect(() => {
2426
- C();
2427
2440
  }, [e.builderContextSignal.rootState]), useEffect(() => () => {
2428
- isBrowser() && (window.removeEventListener("message", l), window.removeEventListener(
2441
+ isBrowser() && (window.removeEventListener("message", s), window.removeEventListener(
2429
2442
  "builder:component:stateChangeListenerActivated",
2430
- C
2443
+ k
2431
2444
  ));
2432
2445
  }, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
2433
- "div",
2446
+ l,
2434
2447
  {
2435
2448
  key: n,
2436
2449
  ref: t,
2437
- onClick: (u) => y(u),
2438
- "builder-content-id": (B = e.builderContextSignal.content) == null ? void 0 : B.id,
2450
+ onClick: (u) => p(u),
2451
+ "builder-content-id": (A = e.builderContextSignal.content) == null ? void 0 : A.id,
2439
2452
  "builder-model": e.model,
2440
2453
  ...e.showContent ? {} : {
2441
2454
  hidden: !0,
2442
2455
  "aria-hidden": !0
2443
2456
  },
2444
- className: `variant-${((A = e.content) == null ? void 0 : A.testVariationId) || ((P = e.content) == null ? void 0 : P.id)}`
2457
+ ...e.contentWrapperProps,
2458
+ className: `variant-${((F = e.content) == null ? void 0 : F.testVariationId) || ((_ = e.content) == null ? void 0 : _.id)}`
2445
2459
  },
2446
2460
  e.children
2447
2461
  ) }) : null });
@@ -2537,22 +2551,22 @@ const getContextStateInitialValue = ({
2537
2551
  meta: e == null ? void 0 : e.meta
2538
2552
  } : void 0;
2539
2553
  function ContentComponent(e) {
2540
- var c, s, d, g, b, y, f;
2554
+ var c, s, d, g, x, S, f;
2541
2555
  const [t, n] = useState(
2542
2556
  () => {
2543
- var S, k;
2557
+ var p, C;
2544
2558
  return getUpdateVariantVisibilityScript({
2545
2559
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2546
- variationId: (S = e.content) == null ? void 0 : S.testVariationId,
2560
+ variationId: (p = e.content) == null ? void 0 : p.testVariationId,
2547
2561
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2548
- contentId: (k = e.content) == null ? void 0 : k.id
2562
+ contentId: (C = e.content) == null ? void 0 : C.id
2549
2563
  });
2550
2564
  }
2551
2565
  );
2552
- function i(S) {
2553
- l((k) => ({
2554
- ...k,
2555
- rootState: S
2566
+ function i(p) {
2567
+ l((C) => ({
2568
+ ...C,
2569
+ rootState: p
2556
2570
  }));
2557
2571
  }
2558
2572
  const [o, a] = useState(
@@ -2566,11 +2580,11 @@ function ContentComponent(e) {
2566
2580
  ...components,
2567
2581
  ...e.customComponents || []
2568
2582
  ].reduce(
2569
- (S, { component: k, ...C }) => ({
2570
- ...S,
2571
- [C.name]: {
2572
- component: k,
2573
- ...serializeComponentInfo(C)
2583
+ (p, { component: C, ...E }) => ({
2584
+ ...p,
2585
+ [E.name]: {
2586
+ component: C,
2587
+ ...serializeComponentInfo(E)
2574
2588
  }
2575
2589
  }),
2576
2590
  {}
@@ -2600,13 +2614,15 @@ function ContentComponent(e) {
2600
2614
  ...components,
2601
2615
  ...e.customComponents || []
2602
2616
  ].reduce(
2603
- (S, { component: k, ...C }) => ({
2604
- ...S,
2605
- [C.name]: serializeComponentInfo(C)
2617
+ (p, { component: C, ...E }) => ({
2618
+ ...p,
2619
+ [E.name]: serializeComponentInfo(E)
2606
2620
  }),
2607
2621
  {}
2608
2622
  ),
2609
- inheritedStyles: {}
2623
+ inheritedStyles: {},
2624
+ BlocksWrapper: e.blocksWrapper || "div",
2625
+ BlocksWrapperProps: e.blocksWrapperProps || {}
2610
2626
  }));
2611
2627
  return /* @__PURE__ */ jsx(
2612
2628
  ComponentsContext.Provider,
@@ -2627,6 +2643,8 @@ function ContentComponent(e) {
2627
2643
  enrich: e.enrich,
2628
2644
  showContent: e.showContent,
2629
2645
  builderContextSignal: r,
2646
+ contentWrapper: e.contentWrapper,
2647
+ contentWrapperProps: e.contentWrapperProps,
2630
2648
  setBuilderContextSignal: l,
2631
2649
  children: [
2632
2650
  e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
@@ -2635,13 +2653,13 @@ function ContentComponent(e) {
2635
2653
  {
2636
2654
  contentId: (c = r.content) == null ? void 0 : c.id,
2637
2655
  cssCode: (d = (s = r.content) == null ? void 0 : s.data) == null ? void 0 : d.cssCode,
2638
- customFonts: (b = (g = r.content) == null ? void 0 : g.data) == null ? void 0 : b.customFonts
2656
+ customFonts: (x = (g = r.content) == null ? void 0 : g.data) == null ? void 0 : x.customFonts
2639
2657
  }
2640
2658
  ) }),
2641
2659
  /* @__PURE__ */ jsx(
2642
2660
  Blocks,
2643
2661
  {
2644
- blocks: (f = (y = r.content) == null ? void 0 : y.data) == null ? void 0 : f.blocks,
2662
+ blocks: (f = (S = r.content) == null ? void 0 : S.data) == null ? void 0 : f.blocks,
2645
2663
  context: r,
2646
2664
  registeredComponents: o
2647
2665
  }
@@ -2710,7 +2728,11 @@ function ContentVariants(e) {
2710
2728
  locale: e.locale,
2711
2729
  includeRefs: e.includeRefs,
2712
2730
  enrich: e.enrich,
2713
- isSsrAbTest: t
2731
+ isSsrAbTest: t,
2732
+ blocksWrapper: e.blocksWrapper,
2733
+ blocksWrapperProps: e.blocksWrapperProps,
2734
+ contentWrapper: e.contentWrapper,
2735
+ contentWrapperProps: e.contentWrapperProps
2714
2736
  },
2715
2737
  c.testVariationId
2716
2738
  ))
@@ -2730,7 +2752,11 @@ function ContentVariants(e) {
2730
2752
  locale: e.locale,
2731
2753
  includeRefs: e.includeRefs,
2732
2754
  enrich: e.enrich,
2733
- isSsrAbTest: t
2755
+ isSsrAbTest: t,
2756
+ blocksWrapper: e.blocksWrapper,
2757
+ blocksWrapperProps: e.blocksWrapperProps,
2758
+ contentWrapper: e.contentWrapper,
2759
+ contentWrapperProps: e.contentWrapperProps
2734
2760
  }
2735
2761
  )
2736
2762
  ] });
@@ -2812,17 +2838,17 @@ export {
2812
2838
  Symbol$1 as Symbol,
2813
2839
  Text,
2814
2840
  Video,
2815
- W as _processContentResult,
2841
+ U as _processContentResult,
2816
2842
  createRegisterComponentMessage,
2817
- O as fetchBuilderProps,
2818
- U as fetchEntries,
2843
+ H as fetchBuilderProps,
2844
+ K as fetchEntries,
2819
2845
  fetchOneEntry,
2820
- H as getAllContent,
2821
- K as getBuilderSearchParams,
2822
- z as getContent,
2846
+ z as getAllContent,
2847
+ q as getBuilderSearchParams,
2848
+ Y as getContent,
2823
2849
  isEditing,
2824
2850
  isPreviewing,
2825
2851
  register,
2826
- q as setEditorSettings,
2827
- Y as track
2852
+ G as setEditorSettings,
2853
+ J as track
2828
2854
  };