@builder.io/sdk-react 0.8.0 → 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.
Files changed (30) hide show
  1. package/lib/browser/index.cjs +28 -28
  2. package/lib/browser/index.mjs +415 -389
  3. package/lib/browser/server-entry.cjs +1 -1
  4. package/lib/browser/server-entry.mjs +1 -1
  5. package/lib/edge/index.cjs +21 -21
  6. package/lib/edge/index.mjs +963 -937
  7. package/lib/edge/server-entry.cjs +1 -1
  8. package/lib/edge/server-entry.mjs +1 -1
  9. package/lib/node/index.cjs +11 -11
  10. package/lib/node/index.mjs +205 -173
  11. package/lib/node/server-entry.cjs +1 -1
  12. package/lib/node/server-entry.mjs +1 -1
  13. package/package.json +2 -1
  14. package/types/components/blocks/blocks-wrapper.d.ts +8 -0
  15. package/types/components/blocks/blocks.d.ts +1 -1
  16. package/types/components/content/components/enable-editor.d.ts +1 -1
  17. package/types/components/content-variants/content-variants.types.d.ts +16 -0
  18. package/types/constants/sdk-version.d.ts +1 -1
  19. package/types/context/types.d.ts +2 -1
  20. package/types/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +0 -10
  21. package/types/functions/transform-block-properties.d.ts +5 -1
  22. package/types/types/enforced-partials.d.ts +7 -2
  23. package/types/functions/get-react-native-block-styles.d.ts +0 -7
  24. package/types/functions/sanitize-react-native-block-styles.d.ts +0 -3
  25. /package/lib/browser/{server-entry-0aebe4be.mjs → server-entry-0aebe4be.js} +0 -0
  26. /package/lib/browser/{server-entry-a5d2c777.js → server-entry-a5d2c777.cjs} +0 -0
  27. /package/lib/edge/{server-entry-0aebe4be.mjs → server-entry-0aebe4be.js} +0 -0
  28. /package/lib/edge/{server-entry-a5d2c777.js → server-entry-a5d2c777.cjs} +0 -0
  29. /package/lib/node/{server-entry-a5d2c777.js → server-entry-a5d2c777.cjs} +0 -0
  30. /package/lib/node/{server-entry-e4cd1e05.mjs → server-entry-e4cd1e05.js} +0 -0
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { createContext, useState, useContext, createElement, useRef, useEffect } from "react";
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.mjs";
5
- import { _ as L, h as W, f as O, g as U, e as H, d as K, s as z, t as q } from "./server-entry-e4cd1e05.mjs";
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 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
+ import { createRequire } from "node:module";
6
7
  function Button(e) {
7
8
  return /* @__PURE__ */ jsxs(Fragment, { children: [
8
9
  e.link ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
@@ -38,7 +39,9 @@ const builderContext = createContext({
38
39
  apiKey: null,
39
40
  apiVersion: void 0,
40
41
  componentInfos: {},
41
- inheritedStyles: {}
42
+ inheritedStyles: {},
43
+ BlocksWrapper: "div",
44
+ BlocksWrapperProps: {}
42
45
  }), ComponentsContext = createContext({ registeredComponents: {} });
43
46
  function getBlockComponentOptions(e) {
44
47
  var t;
@@ -104,11 +107,16 @@ const set = (e, t, n) => {
104
107
  return e;
105
108
  const i = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
106
109
  return i.slice(0, -1).reduce((o, a, r) => Object(o[a]) === o[a] ? o[a] : o[a] = Math.abs(Number(i[r + 1])) >> 0 === +i[r + 1] ? [] : {}, e)[i[i.length - 1]] = n, e;
107
- }, noop = () => null;
110
+ }, noop = () => {
111
+ };
108
112
  let safeDynamicRequire = noop;
109
113
  try {
110
- safeDynamicRequire = eval("require");
111
- } catch (e) {
114
+ safeDynamicRequire = createRequire(import.meta.url);
115
+ } catch (error) {
116
+ try {
117
+ safeDynamicRequire = eval("require");
118
+ } catch (e) {
119
+ }
112
120
  }
113
121
  const ivm = safeDynamicRequire("isolated-vm"), getSyncValName = (e) => `bldr_${e}_sync`, BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE", INJECTED_IVM_GLOBAL = "BUILDER_IVM", REF_TO_PROXY_FN = `
114
122
  var refToProxy = (obj) => {
@@ -176,28 +184,28 @@ output;
176
184
  event: i,
177
185
  state: l
178
186
  }), s = getIsolateContext(), d = s.global;
179
- d.setSync("global", d.derefInto()), d.setSync("log", function(...y) {
180
- console.log(...y);
181
- }), d.setSync(BUILDER_SET_STATE_NAME, function(y, f) {
182
- set(r, y, f), a == null || a(r);
183
- }), c.forEach(([y, f]) => {
184
- 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(
185
193
  // workaround: methods with default values for arguments is not being cloned over
186
- y === "builder" ? {
194
+ S === "builder" ? {
187
195
  ...f,
188
196
  getUserAttributes: () => f.getUserAttributes()
189
197
  } : f
190
198
  ) : null;
191
- d.setSync(getSyncValName(y), S);
199
+ d.setSync(getSyncValName(S), p);
192
200
  }), d.setSync(INJECTED_IVM_GLOBAL, ivm);
193
201
  const g = processCode({
194
202
  code: e,
195
203
  args: c
196
- }), b = s.evalSync(g);
204
+ }), x = s.evalSync(g);
197
205
  try {
198
- return JSON.parse(b);
206
+ return JSON.parse(x);
199
207
  } catch {
200
- return b;
208
+ return x;
201
209
  }
202
210
  }, chooseBrowserOrServerEval = (e) => isBrowser() ? runInBrowser(e) : runInNode(e);
203
211
  function evaluate({
@@ -428,14 +436,14 @@ function BlockStyles(e) {
428
436
  const g = l ? createCssClass({
429
437
  className: d,
430
438
  styles: l
431
- }) : "", b = c ? createCssClass({
439
+ }) : "", x = c ? createCssClass({
432
440
  className: d,
433
441
  styles: c,
434
442
  mediaQuery: getMaxWidthQueryForSize(
435
443
  "medium",
436
444
  r
437
445
  )
438
- }) : "", y = s ? createCssClass({
446
+ }) : "", S = s ? createCssClass({
439
447
  className: d,
440
448
  styles: s,
441
449
  mediaQuery: getMaxWidthQueryForSize(
@@ -443,7 +451,7 @@ function BlockStyles(e) {
443
451
  r
444
452
  )
445
453
  }) : "";
446
- return [g, b, y].join(" ");
454
+ return [g, x, S].join(" ");
447
455
  }
448
456
  return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
449
457
  }
@@ -480,7 +488,9 @@ function getBlockActions(e) {
480
488
  }
481
489
  return t;
482
490
  }
483
- function transformBlockProperties(e) {
491
+ function transformBlockProperties({
492
+ properties: e
493
+ }) {
484
494
  return e.className = e.class, delete e.class, e;
485
495
  }
486
496
  const extractRelevantRootBlockProperties = (e) => ({
@@ -498,7 +508,11 @@ function getBlockProperties({
498
508
  style: e.style ? getStyleAttribute(e.style) : void 0,
499
509
  class: [e.id, "builder-block", e.class, (i = e.properties) == null ? void 0 : i.class].filter(Boolean).join(" ")
500
510
  };
501
- return transformBlockProperties(n);
511
+ return transformBlockProperties({
512
+ properties: n,
513
+ context: t,
514
+ block: e
515
+ });
502
516
  }
503
517
  function getStyleAttribute(e) {
504
518
  switch (TARGET) {
@@ -657,7 +671,7 @@ function RepeatedBlock(e) {
657
671
  ) });
658
672
  }
659
673
  function Block(e) {
660
- var d, g, b, y;
674
+ var d, g, x, S;
661
675
  function t() {
662
676
  return getComponent({
663
677
  block: e.block,
@@ -686,32 +700,32 @@ function Block(e) {
686
700
  return e.block.tagName || "div";
687
701
  }
688
702
  function a() {
689
- var k, C;
690
- if ((k = e.block.repeat) != null && k.collection)
691
- 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);
692
706
  const f = "hide" in i() ? i().hide : !1;
693
707
  return ("show" in i() ? i().show : !0) && !f;
694
708
  }
695
709
  function r() {
696
- var S;
697
- 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 ?? [] : [];
698
712
  }
699
713
  function l() {
700
- var f, S, k, C, v;
714
+ var f, p, C, E, v;
701
715
  return {
702
716
  blockChildren: i().children ?? [],
703
717
  componentRef: (f = t == null ? void 0 : t()) == null ? void 0 : f.component,
704
718
  componentOptions: {
705
719
  ...getBlockComponentOptions(i()),
706
720
  builderContext: e.context,
707
- ...((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" ? {
708
722
  builderComponents: e.registeredComponents
709
723
  } : {}
710
724
  },
711
725
  context: c,
712
726
  registeredComponents: e.registeredComponents,
713
727
  builderBlock: i(),
714
- 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,
715
729
  isInteractive: !((v = t == null ? void 0 : t()) != null && v.isRSC)
716
730
  };
717
731
  }
@@ -738,14 +752,14 @@ function Block(e) {
738
752
  hasChildren: !1
739
753
  }
740
754
  ) }) : null,
741
- !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(
742
756
  RepeatedBlock,
743
757
  {
744
758
  repeatContext: f.context,
745
759
  block: f.block,
746
760
  registeredComponents: e.registeredComponents
747
761
  },
748
- S
762
+ p
749
763
  )) }) : null,
750
764
  !isEmptyHtmlElement(o()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
751
765
  BlockWrapper,
@@ -768,7 +782,7 @@ function Block(e) {
768
782
  isInteractive: l().isInteractive
769
783
  }
770
784
  ),
771
- (b = r()) == null ? void 0 : b.map((f) => /* @__PURE__ */ jsx(
785
+ (x = r()) == null ? void 0 : x.map((f) => /* @__PURE__ */ jsx(
772
786
  Block,
773
787
  {
774
788
  block: f,
@@ -777,7 +791,7 @@ function Block(e) {
777
791
  },
778
792
  "block-" + f.id
779
793
  )),
780
- (y = r()) == null ? void 0 : y.map((f) => /* @__PURE__ */ jsx(
794
+ (S = r()) == null ? void 0 : S.map((f) => /* @__PURE__ */ jsx(
781
795
  BlockStyles,
782
796
  {
783
797
  block: f,
@@ -823,19 +837,20 @@ function BlocksWrapper(e) {
823
837
  }
824
838
  return /* @__PURE__ */ jsxs(Fragment, { children: [
825
839
  /* @__PURE__ */ jsx(
826
- "div",
840
+ e.BlocksWrapper,
827
841
  {
828
- className: t() + " div-02c7a115",
842
+ className: t() + " props-blocks-wrapper-4f2c12d8",
829
843
  "builder-path": e.path,
830
844
  "builder-parent-id": e.parent,
831
845
  style: e.styleProp,
832
846
  onClick: (o) => n(),
833
847
  onMouseEnter: (o) => i(),
834
848
  onKeyPress: (o) => n(),
849
+ ...e.BlocksWrapperProps,
835
850
  children: e.children
836
851
  }
837
852
  ),
838
- /* @__PURE__ */ jsx("style", { children: `.div-02c7a115 {
853
+ /* @__PURE__ */ jsx("style", { children: `.props-blocks-wrapper-4f2c12d8 {
839
854
  display: flex;
840
855
  flex-direction: column;
841
856
  align-items: stretch;
@@ -843,7 +858,7 @@ function BlocksWrapper(e) {
843
858
  ] });
844
859
  }
845
860
  function Blocks(e) {
846
- var i, o;
861
+ var i, o, a, r;
847
862
  const t = useContext(builderContext), n = useContext(ComponentsContext);
848
863
  return /* @__PURE__ */ jsxs(
849
864
  BlocksWrapper,
@@ -852,59 +867,61 @@ function Blocks(e) {
852
867
  parent: e.parent,
853
868
  path: e.path,
854
869
  styleProp: e.styleProp,
870
+ BlocksWrapper: (i = e.context) == null ? void 0 : i.BlocksWrapper,
871
+ BlocksWrapperProps: (o = e.context) == null ? void 0 : o.BlocksWrapperProps,
855
872
  children: [
856
- 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(
857
874
  Block,
858
875
  {
859
- block: a,
876
+ block: l,
860
877
  context: e.context || t,
861
878
  registeredComponents: e.registeredComponents || n.registeredComponents
862
879
  },
863
- "render-block-" + a.id
880
+ "render-block-" + l.id
864
881
  )) }) : null,
865
- 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(
866
883
  BlockStyles,
867
884
  {
868
- block: a,
885
+ block: l,
869
886
  context: e.context || t
870
887
  },
871
- "block-style-" + a.id
888
+ "block-style-" + l.id
872
889
  )) }) : null
873
890
  ]
874
891
  }
875
892
  );
876
893
  }
877
894
  function Columns(e) {
878
- var C;
895
+ var E;
879
896
  const [t, n] = useState(
880
897
  () => typeof e.space == "number" ? e.space || 0 : 20
881
898
  ), [i, o] = useState(() => e.columns || []), [a, r] = useState(
882
899
  () => e.stackColumnsAt || "tablet"
883
900
  );
884
901
  function l(v) {
885
- var I;
886
- 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;
887
904
  }
888
905
  function c(v) {
889
- const I = t * (i.length - 1) / i.length;
890
- return `calc(${l(v)}% - ${I}px)`;
906
+ const k = t * (i.length - 1) / i.length;
907
+ return `calc(${l(v)}% - ${k}px)`;
891
908
  }
892
909
  function s({
893
910
  stackedStyle: v,
894
- desktopStyle: I
911
+ desktopStyle: k
895
912
  }) {
896
- return a === "tablet" ? v : I;
913
+ return a === "tablet" ? v : k;
897
914
  }
898
915
  function d({
899
916
  stackedStyle: v,
900
- desktopStyle: I
917
+ desktopStyle: k
901
918
  }) {
902
- return a === "never" ? I : v;
919
+ return a === "never" ? k : v;
903
920
  }
904
- const [g, b] = useState(
921
+ const [g, x] = useState(
905
922
  () => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
906
923
  );
907
- function y() {
924
+ function S() {
908
925
  return {
909
926
  "--flex-dir": g,
910
927
  "--flex-dir-tablet": s({
@@ -914,7 +931,7 @@ function Columns(e) {
914
931
  };
915
932
  }
916
933
  function f(v) {
917
- 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;
918
935
  return {
919
936
  width: T,
920
937
  ["marginLeft"]: w,
@@ -936,15 +953,15 @@ function Columns(e) {
936
953
  })
937
954
  };
938
955
  }
939
- function S(v) {
956
+ function p(v) {
940
957
  var T, w;
941
958
  return getSizesForBreakpoints(
942
959
  ((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
943
960
  )[v].max;
944
961
  }
945
- function k() {
962
+ function C() {
946
963
  return `
947
- @media (max-width: ${S("medium")}px) {
964
+ @media (max-width: ${p("medium")}px) {
948
965
  .${e.builderBlock.id}-breakpoints {
949
966
  flex-direction: var(--flex-dir-tablet);
950
967
  align-items: stretch;
@@ -956,7 +973,7 @@ function Columns(e) {
956
973
  }
957
974
  }
958
975
 
959
- @media (max-width: ${S("small")}px) {
976
+ @media (max-width: ${p("small")}px) {
960
977
  .${e.builderBlock.id}-breakpoints {
961
978
  flex-direction: var(--flex-dir);
962
979
  align-items: stretch;
@@ -974,20 +991,20 @@ function Columns(e) {
974
991
  "div",
975
992
  {
976
993
  className: `builder-columns ${e.builderBlock.id}-breakpoints div-53636e90`,
977
- style: y(),
994
+ style: S(),
978
995
  children: [
979
- /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: k() }) }),
980
- (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(
981
998
  "div",
982
999
  {
983
1000
  className: "builder-column div-53636e90-2",
984
- style: f(I),
985
- key: I
1001
+ style: f(k),
1002
+ key: k
986
1003
  },
987
1004
  /* @__PURE__ */ jsx(
988
1005
  Blocks,
989
1006
  {
990
- path: `component.options.columns.${I}.blocks`,
1007
+ path: `component.options.columns.${k}.blocks`,
991
1008
  parent: e.builderBlock.id,
992
1009
  styleProp: {
993
1010
  flexGrow: "1"
@@ -1479,13 +1496,13 @@ function Embed(e) {
1479
1496
  const g = s[d];
1480
1497
  if (g.src && !n.includes(g.src)) {
1481
1498
  n.push(g.src);
1482
- const b = document.createElement("script");
1483
- 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);
1484
1501
  } else if (isJsScript(g) && !o.includes(g.innerText))
1485
1502
  try {
1486
1503
  o.push(g.innerText), new Function(g.innerText)();
1487
- } catch (b) {
1488
- console.warn("`Embed`: Error running script:", b);
1504
+ } catch (x) {
1505
+ console.warn("`Embed`: Error running script:", x);
1489
1506
  }
1490
1507
  }
1491
1508
  }
@@ -1532,8 +1549,8 @@ const componentInfo$6 = {
1532
1549
  let g = !1;
1533
1550
  d.onload = () => {
1534
1551
  g = !0, c(d);
1535
- }, d.addEventListener("error", (b) => {
1536
- 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);
1537
1554
  }), d.src = r, setTimeout(() => {
1538
1555
  g || s(new Error("Image load timed out"));
1539
1556
  }, l);
@@ -2116,7 +2133,7 @@ const findParentElement = (e, t, n = !0) => {
2116
2133
  builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
2117
2134
  }
2118
2135
  };
2119
- }, SDK_VERSION = "0.8.0", registerInsertMenu = () => {
2136
+ }, SDK_VERSION = "0.9.0", registerInsertMenu = () => {
2120
2137
  register("insertMenu", {
2121
2138
  name: "_default",
2122
2139
  default: !0,
@@ -2169,8 +2186,8 @@ const setupBrowserForEditing = (e = {}) => {
2169
2186
  let d, g = null;
2170
2187
  try {
2171
2188
  d = s.apply(null, l);
2172
- } catch (b) {
2173
- g = b;
2189
+ } catch (x) {
2190
+ g = x;
2174
2191
  }
2175
2192
  g ? (o = window.parent) == null || o.postMessage({
2176
2193
  type: "builder.evaluateError",
@@ -2178,13 +2195,13 @@ const setupBrowserForEditing = (e = {}) => {
2178
2195
  id: c,
2179
2196
  error: g.message
2180
2197
  }
2181
- }, "*") : d && typeof d.then == "function" ? d.then((b) => {
2182
- var y;
2183
- (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({
2184
2201
  type: "builder.evaluateResult",
2185
2202
  data: {
2186
2203
  id: c,
2187
- result: b
2204
+ result: x
2188
2205
  }
2189
2206
  }, "*");
2190
2207
  }).catch(console.error) : (a = window.parent) == null || a.postMessage({
@@ -2200,10 +2217,10 @@ const setupBrowserForEditing = (e = {}) => {
2200
2217
  })));
2201
2218
  };
2202
2219
  function EnableEditor(e) {
2203
- var T, w, R, j, B, A, P;
2220
+ var R, j, B, P, A, F, _;
2204
2221
  const t = useRef(null), [n, i] = useState(() => 0);
2205
2222
  function o(u) {
2206
- var h, x, p, E, F;
2223
+ var h, b, y, I, V;
2207
2224
  const m = {
2208
2225
  ...e.builderContextSignal.content,
2209
2226
  ...u,
@@ -2212,44 +2229,46 @@ function EnableEditor(e) {
2212
2229
  ...u == null ? void 0 : u.data
2213
2230
  },
2214
2231
  meta: {
2215
- ...(x = e.builderContextSignal.content) == null ? void 0 : x.meta,
2232
+ ...(b = e.builderContextSignal.content) == null ? void 0 : b.meta,
2216
2233
  ...u == null ? void 0 : u.meta,
2217
- 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)
2218
2235
  }
2219
2236
  };
2220
- e.setBuilderContextSignal((_) => ({
2221
- ..._,
2237
+ e.setBuilderContextSignal((W) => ({
2238
+ ...W,
2222
2239
  content: m
2223
2240
  }));
2224
2241
  }
2225
2242
  useState(() => 0);
2226
2243
  const [a, r] = useState(
2227
2244
  () => !1
2245
+ ), [l, c] = useState(
2246
+ () => e.contentWrapper || "div"
2228
2247
  );
2229
- function l(u) {
2248
+ function s(u) {
2230
2249
  var h;
2231
2250
  const { data: m } = u;
2232
2251
  if (m)
2233
2252
  switch (m.type) {
2234
2253
  case "builder.configureSdk": {
2235
- const x = m.data, { breakpoints: p, contentId: E } = x;
2236
- 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))
2237
2256
  return;
2238
- p && o({
2257
+ y && o({
2239
2258
  meta: {
2240
- breakpoints: p
2259
+ breakpoints: y
2241
2260
  }
2242
2261
  }), i(n + 1);
2243
2262
  break;
2244
2263
  }
2245
2264
  case "builder.contentUpdate": {
2246
- const x = m.data, p = x.key || x.alias || x.entry || x.modelName, E = x.data;
2247
- 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));
2248
2267
  break;
2249
2268
  }
2250
2269
  }
2251
2270
  }
2252
- function c() {
2271
+ function d() {
2253
2272
  var m, h;
2254
2273
  const u = (h = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : h.jsCode;
2255
2274
  u && evaluate({
@@ -2260,24 +2279,24 @@ function EnableEditor(e) {
2260
2279
  rootSetState: e.builderContextSignal.rootSetState
2261
2280
  });
2262
2281
  }
2263
- const [s, d] = useState(() => ({})), [g, b] = useState(() => !1);
2264
- function y(u) {
2282
+ const [g, x] = useState(() => ({})), [S, f] = useState(() => !1);
2283
+ function p(u) {
2265
2284
  var m, h;
2266
2285
  if (e.builderContextSignal.content) {
2267
- 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;
2268
2287
  _track({
2269
2288
  type: "click",
2270
2289
  canTrack: getDefaultCanTrack(e.canTrack),
2271
- contentId: p,
2290
+ contentId: y,
2272
2291
  apiKey: e.apiKey,
2273
- variationId: x !== p ? x : void 0,
2292
+ variationId: b !== y ? b : void 0,
2274
2293
  ...getInteractionPropertiesForEvent(u),
2275
- unique: !g
2294
+ unique: !S
2276
2295
  });
2277
2296
  }
2278
- g || b(!0);
2297
+ S || f(!0);
2279
2298
  }
2280
- function f(u) {
2299
+ function C(u) {
2281
2300
  return u.replace(
2282
2301
  /{{([^}]+)}}/g,
2283
2302
  (m, h) => evaluate({
@@ -2289,32 +2308,32 @@ function EnableEditor(e) {
2289
2308
  })
2290
2309
  );
2291
2310
  }
2292
- function S({ url: u, key: m }) {
2311
+ function E({ url: u, key: m }) {
2293
2312
  fetch$1(u).then((h) => h.json()).then((h) => {
2294
- var p, E;
2295
- const x = {
2313
+ var y, I;
2314
+ const b = {
2296
2315
  ...e.builderContextSignal.rootState,
2297
2316
  [m]: h
2298
2317
  };
2299
- (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;
2300
2319
  }).catch((h) => {
2301
2320
  console.error("error fetching dynamic data", u, h);
2302
2321
  });
2303
2322
  }
2304
- function k() {
2323
+ function v() {
2305
2324
  var m, h;
2306
2325
  const u = ((h = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : h.httpRequests) ?? {};
2307
- Object.entries(u).forEach(([x, p]) => {
2308
- if (p && (!s[x] || isEditing())) {
2309
- const E = f(p);
2310
- S({
2311
- url: E,
2312
- 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
2313
2332
  });
2314
2333
  }
2315
2334
  });
2316
2335
  }
2317
- function C() {
2336
+ function k() {
2318
2337
  isEditing() && window.dispatchEvent(
2319
2338
  new CustomEvent(
2320
2339
  "builder:component:stateChange",
@@ -2329,8 +2348,8 @@ function EnableEditor(e) {
2329
2348
  )
2330
2349
  );
2331
2350
  }
2332
- function v(u) {
2333
- i(n + 1), window.addEventListener("message", l), registerInsertMenu(), setupBrowserForEditing({
2351
+ function T(u) {
2352
+ i(n + 1), window.addEventListener("message", s), registerInsertMenu(), setupBrowserForEditing({
2334
2353
  ...e.locale ? {
2335
2354
  locale: e.locale
2336
2355
  } : {},
@@ -2343,61 +2362,61 @@ function EnableEditor(e) {
2343
2362
  }), Object.values(
2344
2363
  e.builderContextSignal.componentInfos
2345
2364
  ).forEach((m) => {
2346
- var x;
2365
+ var b;
2347
2366
  const h = createRegisterComponentMessage(m);
2348
- (x = window.parent) == null || x.postMessage(h, "*");
2367
+ (b = window.parent) == null || b.postMessage(h, "*");
2349
2368
  }), window.addEventListener(
2350
2369
  "builder:component:stateChangeListenerActivated",
2351
- C
2370
+ k
2352
2371
  );
2353
2372
  }
2354
- function I(u) {
2355
- 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(
2356
2375
  `builder.preview.${h}`
2357
- ), p = m.get("apiKey") || m.get("builder.space");
2358
- 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({
2359
2378
  model: e.model,
2360
2379
  apiKey: e.apiKey,
2361
2380
  apiVersion: e.builderContextSignal.apiVersion
2362
- }).then((E) => {
2363
- E && o(E);
2381
+ }).then((I) => {
2382
+ I && o(I);
2364
2383
  });
2365
2384
  }
2366
2385
  return useEffect(() => {
2367
2386
  var u;
2368
2387
  return (u = t.current) == null || u.addEventListener(
2369
2388
  "initeditingbldr",
2370
- v
2389
+ T
2371
2390
  ), () => {
2372
2391
  var m;
2373
2392
  return (m = t.current) == null ? void 0 : m.removeEventListener(
2374
2393
  "initeditingbldr",
2375
- v
2394
+ T
2376
2395
  );
2377
2396
  };
2378
2397
  }, []), useEffect(() => {
2379
2398
  var u;
2380
2399
  return (u = t.current) == null || u.addEventListener(
2381
2400
  "initpreviewingbldr",
2382
- I
2401
+ w
2383
2402
  ), () => {
2384
2403
  var m;
2385
2404
  return (m = t.current) == null ? void 0 : m.removeEventListener(
2386
2405
  "initpreviewingbldr",
2387
- I
2406
+ w
2388
2407
  );
2389
2408
  };
2390
2409
  }, []), useEffect(() => {
2391
2410
  var u, m;
2392
2411
  if (isBrowser()) {
2393
2412
  if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
2394
- 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;
2395
2414
  _track({
2396
2415
  type: "impression",
2397
2416
  canTrack: !0,
2398
- contentId: p,
2399
- apiKey: E,
2400
- variationId: x !== p ? x : void 0
2417
+ contentId: y,
2418
+ apiKey: I,
2419
+ variationId: b !== y ? b : void 0
2401
2420
  });
2402
2421
  }
2403
2422
  isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
@@ -2405,37 +2424,38 @@ function EnableEditor(e) {
2405
2424
  }, []), useEffect(() => {
2406
2425
  e.apiKey || logger.error(
2407
2426
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
2408
- ), c(), k(), C();
2427
+ ), d(), v(), k();
2409
2428
  }, []), useEffect(() => {
2410
2429
  e.content && o(e.content);
2411
2430
  }, [e.content]), useEffect(() => {
2412
2431
  }, [a]), useEffect(() => {
2413
- c();
2432
+ d();
2414
2433
  }, [
2415
- (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,
2416
2435
  e.builderContextSignal.rootState
2417
2436
  ]), useEffect(() => {
2437
+ v();
2438
+ }, [(P = (B = e.builderContextSignal.content) == null ? void 0 : B.data) == null ? void 0 : P.httpRequests]), useEffect(() => {
2418
2439
  k();
2419
- }, [(j = (R = e.builderContextSignal.content) == null ? void 0 : R.data) == null ? void 0 : j.httpRequests]), useEffect(() => {
2420
- C();
2421
2440
  }, [e.builderContextSignal.rootState]), useEffect(() => () => {
2422
- isBrowser() && (window.removeEventListener("message", l), window.removeEventListener(
2441
+ isBrowser() && (window.removeEventListener("message", s), window.removeEventListener(
2423
2442
  "builder:component:stateChangeListenerActivated",
2424
- C
2443
+ k
2425
2444
  ));
2426
2445
  }, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
2427
- "div",
2446
+ l,
2428
2447
  {
2429
2448
  key: n,
2430
2449
  ref: t,
2431
- onClick: (u) => y(u),
2432
- "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,
2433
2452
  "builder-model": e.model,
2434
2453
  ...e.showContent ? {} : {
2435
2454
  hidden: !0,
2436
2455
  "aria-hidden": !0
2437
2456
  },
2438
- 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)}`
2439
2459
  },
2440
2460
  e.children
2441
2461
  ) }) : null });
@@ -2531,22 +2551,22 @@ const getContextStateInitialValue = ({
2531
2551
  meta: e == null ? void 0 : e.meta
2532
2552
  } : void 0;
2533
2553
  function ContentComponent(e) {
2534
- var c, s, d, g, b, y, f;
2554
+ var c, s, d, g, x, S, f;
2535
2555
  const [t, n] = useState(
2536
2556
  () => {
2537
- var S, k;
2557
+ var p, C;
2538
2558
  return getUpdateVariantVisibilityScript({
2539
2559
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2540
- variationId: (S = e.content) == null ? void 0 : S.testVariationId,
2560
+ variationId: (p = e.content) == null ? void 0 : p.testVariationId,
2541
2561
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2542
- contentId: (k = e.content) == null ? void 0 : k.id
2562
+ contentId: (C = e.content) == null ? void 0 : C.id
2543
2563
  });
2544
2564
  }
2545
2565
  );
2546
- function i(S) {
2547
- l((k) => ({
2548
- ...k,
2549
- rootState: S
2566
+ function i(p) {
2567
+ l((C) => ({
2568
+ ...C,
2569
+ rootState: p
2550
2570
  }));
2551
2571
  }
2552
2572
  const [o, a] = useState(
@@ -2560,11 +2580,11 @@ function ContentComponent(e) {
2560
2580
  ...components,
2561
2581
  ...e.customComponents || []
2562
2582
  ].reduce(
2563
- (S, { component: k, ...C }) => ({
2564
- ...S,
2565
- [C.name]: {
2566
- component: k,
2567
- ...serializeComponentInfo(C)
2583
+ (p, { component: C, ...E }) => ({
2584
+ ...p,
2585
+ [E.name]: {
2586
+ component: C,
2587
+ ...serializeComponentInfo(E)
2568
2588
  }
2569
2589
  }),
2570
2590
  {}
@@ -2594,13 +2614,15 @@ function ContentComponent(e) {
2594
2614
  ...components,
2595
2615
  ...e.customComponents || []
2596
2616
  ].reduce(
2597
- (S, { component: k, ...C }) => ({
2598
- ...S,
2599
- [C.name]: serializeComponentInfo(C)
2617
+ (p, { component: C, ...E }) => ({
2618
+ ...p,
2619
+ [E.name]: serializeComponentInfo(E)
2600
2620
  }),
2601
2621
  {}
2602
2622
  ),
2603
- inheritedStyles: {}
2623
+ inheritedStyles: {},
2624
+ BlocksWrapper: e.blocksWrapper || "div",
2625
+ BlocksWrapperProps: e.blocksWrapperProps || {}
2604
2626
  }));
2605
2627
  return /* @__PURE__ */ jsx(
2606
2628
  ComponentsContext.Provider,
@@ -2621,6 +2643,8 @@ function ContentComponent(e) {
2621
2643
  enrich: e.enrich,
2622
2644
  showContent: e.showContent,
2623
2645
  builderContextSignal: r,
2646
+ contentWrapper: e.contentWrapper,
2647
+ contentWrapperProps: e.contentWrapperProps,
2624
2648
  setBuilderContextSignal: l,
2625
2649
  children: [
2626
2650
  e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
@@ -2629,13 +2653,13 @@ function ContentComponent(e) {
2629
2653
  {
2630
2654
  contentId: (c = r.content) == null ? void 0 : c.id,
2631
2655
  cssCode: (d = (s = r.content) == null ? void 0 : s.data) == null ? void 0 : d.cssCode,
2632
- 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
2633
2657
  }
2634
2658
  ) }),
2635
2659
  /* @__PURE__ */ jsx(
2636
2660
  Blocks,
2637
2661
  {
2638
- 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,
2639
2663
  context: r,
2640
2664
  registeredComponents: o
2641
2665
  }
@@ -2704,7 +2728,11 @@ function ContentVariants(e) {
2704
2728
  locale: e.locale,
2705
2729
  includeRefs: e.includeRefs,
2706
2730
  enrich: e.enrich,
2707
- isSsrAbTest: t
2731
+ isSsrAbTest: t,
2732
+ blocksWrapper: e.blocksWrapper,
2733
+ blocksWrapperProps: e.blocksWrapperProps,
2734
+ contentWrapper: e.contentWrapper,
2735
+ contentWrapperProps: e.contentWrapperProps
2708
2736
  },
2709
2737
  c.testVariationId
2710
2738
  ))
@@ -2724,7 +2752,11 @@ function ContentVariants(e) {
2724
2752
  locale: e.locale,
2725
2753
  includeRefs: e.includeRefs,
2726
2754
  enrich: e.enrich,
2727
- isSsrAbTest: t
2755
+ isSsrAbTest: t,
2756
+ blocksWrapper: e.blocksWrapper,
2757
+ blocksWrapperProps: e.blocksWrapperProps,
2758
+ contentWrapper: e.contentWrapper,
2759
+ contentWrapperProps: e.contentWrapperProps
2728
2760
  }
2729
2761
  )
2730
2762
  ] });
@@ -2806,17 +2838,17 @@ export {
2806
2838
  Symbol$1 as Symbol,
2807
2839
  Text,
2808
2840
  Video,
2809
- L as _processContentResult,
2841
+ U as _processContentResult,
2810
2842
  createRegisterComponentMessage,
2811
- W as fetchBuilderProps,
2812
- O as fetchEntries,
2843
+ H as fetchBuilderProps,
2844
+ K as fetchEntries,
2813
2845
  fetchOneEntry,
2814
- U as getAllContent,
2815
- H as getBuilderSearchParams,
2816
- K as getContent,
2846
+ z as getAllContent,
2847
+ q as getBuilderSearchParams,
2848
+ Y as getContent,
2817
2849
  isEditing,
2818
2850
  isPreviewing,
2819
2851
  register,
2820
- z as setEditorSettings,
2821
- q as track
2852
+ G as setEditorSettings,
2853
+ J as track
2822
2854
  };