@builder.io/sdk-react-nextjs 0.12.0 → 0.12.2

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 (50) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-4b1b3c99.cjs +23 -0
  2. package/lib/browser/{USE_CLIENT_BUNDLE-109dedea.js → USE_CLIENT_BUNDLE-550679f9.js} +250 -265
  3. package/lib/{edge/USE_SERVER_BUNDLE-35036883.js → browser/USE_SERVER_BUNDLE-464dccd7.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-ab530745.cjs → browser/USE_SERVER_BUNDLE-6234c5ea.cjs} +1 -1
  5. package/lib/browser/bundle-1d763be7.cjs +168 -0
  6. package/lib/browser/{bundle-f769d53a.js → bundle-d905bf70.js} +614 -572
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +17 -17
  9. package/lib/{node/USE_CLIENT_BUNDLE-f1c14740.js → edge/USE_CLIENT_BUNDLE-aa38a343.js} +250 -265
  10. package/lib/edge/USE_CLIENT_BUNDLE-edb18eb8.cjs +23 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-a546a48c.js → edge/USE_SERVER_BUNDLE-70c27ea1.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-ce3684c3.cjs → edge/USE_SERVER_BUNDLE-f0eeb33e.cjs} +1 -1
  13. package/lib/edge/{bundle-593d3883.cjs → bundle-25fa71b1.cjs} +31 -31
  14. package/lib/edge/{bundle-80ec9a4d.js → bundle-834dbf29.js} +873 -831
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +17 -17
  17. package/lib/{edge/USE_CLIENT_BUNDLE-bffeb179.js → node/USE_CLIENT_BUNDLE-d30db795.js} +250 -265
  18. package/lib/node/USE_CLIENT_BUNDLE-def5165a.cjs +23 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-a36e67c3.js → node/USE_SERVER_BUNDLE-610c83b3.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-7d41532a.cjs → node/USE_SERVER_BUNDLE-a5db98bc.cjs} +1 -1
  21. package/lib/node/{bundle-fd27db7d.js → bundle-1f73ead0.js} +236 -194
  22. package/lib/node/bundle-4efd9623.cjs +208 -0
  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/blocks/slot/component-info.d.ts +2 -0
  27. package/types/cjs/blocks/slot/slot.d.ts +11 -0
  28. package/types/cjs/components/block/block.helpers.d.ts +0 -1
  29. package/types/cjs/components/block/components/block-wrapper.d.ts +2 -6
  30. package/types/cjs/components/content-variants/content-variants.types.d.ts +4 -0
  31. package/types/cjs/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  32. package/types/cjs/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  33. package/types/cjs/constants/sdk-version.d.ts +1 -1
  34. package/types/cjs/functions/is-from-trusted-host.d.ts +3 -0
  35. package/types/cjs/scripts/init-editing.d.ts +1 -0
  36. package/types/esm/blocks/slot/component-info.d.ts +2 -0
  37. package/types/esm/blocks/slot/slot.d.ts +11 -0
  38. package/types/esm/components/block/block.helpers.d.ts +0 -1
  39. package/types/esm/components/block/components/block-wrapper.d.ts +2 -6
  40. package/types/esm/components/content-variants/content-variants.types.d.ts +4 -0
  41. package/types/esm/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  42. package/types/esm/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  43. package/types/esm/constants/sdk-version.d.ts +1 -1
  44. package/types/esm/functions/is-from-trusted-host.d.ts +3 -0
  45. package/types/esm/scripts/init-editing.d.ts +1 -0
  46. package/lib/browser/USE_CLIENT_BUNDLE-c6f253a6.cjs +0 -23
  47. package/lib/browser/bundle-ff1186e7.cjs +0 -168
  48. package/lib/edge/USE_CLIENT_BUNDLE-23097d3f.cjs +0 -23
  49. package/lib/node/USE_CLIENT_BUNDLE-ff4465dc.cjs +0 -23
  50. package/lib/node/bundle-6e88a55c.cjs +0 -208
@@ -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-f1c14740.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-d30db795.js";
5
5
  import "next/navigation";
6
6
  function getBlockComponentOptions(e) {
7
7
  var t;
@@ -187,25 +187,25 @@ output;
187
187
  context: n,
188
188
  event: o,
189
189
  state: s
190
- }), u = getIsolateContext(), m = u.global;
191
- m.setSync("global", m.derefInto()), m.setSync("log", function(...d) {
190
+ }), m = getIsolateContext(), f = m.global;
191
+ f.setSync("global", f.derefInto()), f.setSync("log", function(...d) {
192
192
  console.log(...d);
193
- }), m.setSync(BUILDER_SET_STATE_NAME, function(d, f) {
194
- set(a, d, f), i == null || i(a);
195
- }), c.forEach(([d, f]) => {
196
- const l = typeof f == "object" ? new ivm.Reference(
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
198
  d === "builder" ? {
199
- ...f,
200
- getUserAttributes: () => f.getUserAttributes()
201
- } : f
199
+ ...u,
200
+ getUserAttributes: () => u.getUserAttributes()
201
+ } : u
202
202
  ) : null;
203
- m.setSync(getSyncValName(d), l);
204
- }), m.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
208
- }), g = u.evalSync(p);
208
+ }), g = m.evalSync(p);
209
209
  try {
210
210
  return JSON.parse(g);
211
211
  } catch {
@@ -267,14 +267,14 @@ const evaluateBindings = ({
267
267
  }
268
268
  };
269
269
  for (const s in e.bindings) {
270
- const c = e.bindings[s], u = evaluate({
270
+ const c = e.bindings[s], m = evaluate({
271
271
  code: c,
272
272
  localState: n,
273
273
  rootState: o,
274
274
  rootSetState: r,
275
275
  context: t
276
276
  });
277
- set(a, s, u);
277
+ set(a, s, m);
278
278
  }
279
279
  return a;
280
280
  };
@@ -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
@@ -337,15 +337,15 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
337
337
  if (!Array.isArray(r))
338
338
  return;
339
339
  const i = n.collection.split(".").pop(), a = n.itemName || (i ? i + "Item" : "item");
340
- return r.map((c, u) => ({
340
+ return r.map((c, m) => ({
341
341
  context: {
342
342
  ...t,
343
343
  localState: {
344
344
  ...t.localState,
345
- $index: u,
345
+ $index: m,
346
346
  $item: c,
347
347
  [a]: c,
348
- [`$${a}Index`]: u
348
+ [`$${a}Index`]: m
349
349
  }
350
350
  },
351
351
  block: o
@@ -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, u = i == null ? void 0 : i.medium, m = 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
- }) : "", d = u ? createCssClass({
442
+ }) : "", d = m ? createCssClass({
443
443
  className: p,
444
- styles: u,
444
+ styles: m,
445
445
  mediaQuery: getMaxWidthQueryForSize(
446
446
  "medium",
447
447
  s
448
448
  )
449
- }) : "", f = m ? createCssClass({
449
+ }) : "", u = f ? createCssClass({
450
450
  className: p,
451
- styles: m,
451
+ styles: f,
452
452
  mediaQuery: getMaxWidthQueryForSize(
453
453
  "small",
454
454
  s
455
455
  )
456
456
  }) : "";
457
- return [g, d, 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 u, m, p;
601
+ var m, f, p;
602
602
  const t = function() {
603
603
  return getComponent({
604
604
  block: e.block,
@@ -629,17 +629,17 @@ function Block(e) {
629
629
  const d = "hide" in o() ? o().hide : !1;
630
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 d, f, l, h, y;
635
+ var d, u, l, h, y;
636
636
  return {
637
637
  blockChildren: o().children ?? [],
638
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
  },
@@ -652,7 +652,7 @@ function Block(e) {
652
652
  }, c = e.context;
653
653
  return /* @__PURE__ */ jsx(Fragment, { children: i() ? /* @__PURE__ */ jsxs(Fragment, { children: [
654
654
  /* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
655
- (u = t()) != null && u.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
655
+ (m = t()) != null && m.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
656
656
  ComponentRef,
657
657
  {
658
658
  componentRef: s().componentRef,
@@ -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: (m = n()) == null ? void 0 : m.map((g, d) => /* @__PURE__ */ jsx(
678
- RepeatedBlock,
679
- {
680
- repeatContext: g.context,
681
- block: g.block,
682
- registeredComponents: e.registeredComponents
683
- },
684
- d
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) {
@@ -760,7 +747,7 @@ function Columns(e) {
760
747
  desktopStyle: h
761
748
  }) {
762
749
  return o === "never" ? h : l;
763
- }, c = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column", u = function() {
750
+ }, c = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column", m = function() {
764
751
  return {
765
752
  "--flex-dir": c,
766
753
  "--flex-dir-tablet": a({
@@ -768,13 +755,13 @@ function Columns(e) {
768
755
  desktopStyle: "row"
769
756
  })
770
757
  };
771
- }, m = 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({
@@ -827,14 +814,14 @@ function Columns(e) {
827
814
  "div",
828
815
  {
829
816
  className: `builder-columns ${e.builderBlock.id}-breakpoints div-39daef82`,
830
- style: u(),
817
+ style: m(),
831
818
  children: [
832
819
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: g() }) }),
833
- (d = e.columns) == null ? void 0 : d.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: m(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
  ))
@@ -1029,7 +1016,7 @@ const getTopLevelDomain = (e) => {
1029
1016
  ...e,
1030
1017
  ...r
1031
1018
  };
1032
- }, getDefaultCanTrack = (e) => checkIsDefined(e) ? e : !0, componentInfo$a = {
1019
+ }, getDefaultCanTrack = (e) => checkIsDefined(e) ? e : !0, componentInfo$b = {
1033
1020
  name: "Core:Button",
1034
1021
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
1035
1022
  defaultStyles: {
@@ -1062,7 +1049,7 @@ const getTopLevelDomain = (e) => {
1062
1049
  }],
1063
1050
  static: !0,
1064
1051
  noWrap: !0
1065
- }, componentInfo$9 = {
1052
+ }, componentInfo$a = {
1066
1053
  // TODO: ways to statically preprocess JSON for references, functions, etc
1067
1054
  name: "Columns",
1068
1055
  isRSC: !0,
@@ -1263,7 +1250,7 @@ const getTopLevelDomain = (e) => {
1263
1250
  helperText: "When stacking columns for mobile devices, reverse the ordering",
1264
1251
  advanced: !0
1265
1252
  }]
1266
- }, componentInfo$8 = {
1253
+ }, componentInfo$9 = {
1267
1254
  name: "Custom Code",
1268
1255
  static: !0,
1269
1256
  requiredPermissions: ["editCode"],
@@ -1285,7 +1272,7 @@ const getTopLevelDomain = (e) => {
1285
1272
  helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
1286
1273
  advanced: !0
1287
1274
  }]
1288
- }, componentInfo$7 = {
1275
+ }, componentInfo$8 = {
1289
1276
  name: "Embed",
1290
1277
  static: !0,
1291
1278
  inputs: [{
@@ -1310,13 +1297,13 @@ const getTopLevelDomain = (e) => {
1310
1297
  defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
1311
1298
  hideFromUI: !0
1312
1299
  }]
1313
- }, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type), componentInfo$6 = {
1300
+ }, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type), componentInfo$7 = {
1314
1301
  name: "Fragment",
1315
1302
  static: !0,
1316
1303
  hidden: !0,
1317
1304
  canHaveChildren: !0,
1318
1305
  noWrap: !0
1319
- }, componentInfo$5 = {
1306
+ }, componentInfo$6 = {
1320
1307
  name: "Image",
1321
1308
  static: !0,
1322
1309
  image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
@@ -1337,15 +1324,15 @@ const getTopLevelDomain = (e) => {
1337
1324
  onChange: (e) => {
1338
1325
  e.delete("srcset"), e.delete("noWebp");
1339
1326
  function n(a, s = 6e4) {
1340
- return new Promise((c, u) => {
1341
- const m = document.createElement("img");
1327
+ return new Promise((c, m) => {
1328
+ const f = document.createElement("img");
1342
1329
  let p = !1;
1343
- m.onload = () => {
1344
- p = !0, c(m);
1345
- }, m.addEventListener("error", (g) => {
1346
- console.warn("Image load failed", g.error), u(g.error);
1347
- }), m.src = a, setTimeout(() => {
1348
- p || u(new Error("Image load timed out"));
1330
+ f.onload = () => {
1331
+ p = !0, c(f);
1332
+ }, f.addEventListener("error", (g) => {
1333
+ console.warn("Image load failed", g.error), m(g.error);
1334
+ }), f.src = a, setTimeout(() => {
1335
+ p || m(new Error("Image load timed out"));
1349
1336
  }, s);
1350
1337
  });
1351
1338
  }
@@ -1416,7 +1403,7 @@ const getTopLevelDomain = (e) => {
1416
1403
  advanced: !0,
1417
1404
  defaultValue: 0.7041
1418
1405
  }]
1419
- }, componentInfo$4 = {
1406
+ }, componentInfo$5 = {
1420
1407
  // friendlyName?
1421
1408
  name: "Raw:Img",
1422
1409
  hideFromInsertMenu: !0,
@@ -1430,7 +1417,7 @@ const getTopLevelDomain = (e) => {
1430
1417
  }],
1431
1418
  noWrap: !0,
1432
1419
  static: !0
1433
- }, componentInfo$3 = {
1420
+ }, componentInfo$4 = {
1434
1421
  name: "Core:Section",
1435
1422
  static: !0,
1436
1423
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
@@ -1469,7 +1456,44 @@ const getTopLevelDomain = (e) => {
1469
1456
  }
1470
1457
  }
1471
1458
  }]
1472
- }, componentInfo$2 = {
1459
+ }, componentInfo$3 = {
1460
+ name: "Slot",
1461
+ isRSC: !0,
1462
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
1463
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
1464
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
1465
+ // Maybe wrap this for canHaveChildren so bind children to this hm
1466
+ inputs: [{
1467
+ name: "name",
1468
+ type: "string",
1469
+ required: !0,
1470
+ defaultValue: "children"
1471
+ }]
1472
+ };
1473
+ function Slot(e) {
1474
+ var t, n, o;
1475
+ return /* @__PURE__ */ jsx(
1476
+ "div",
1477
+ {
1478
+ style: {
1479
+ pointerEvents: "auto"
1480
+ },
1481
+ ...!((t = e.builderContext.context) != null && t.symbolId) && {
1482
+ "builder-slot": e.name
1483
+ },
1484
+ children: /* @__PURE__ */ jsx(
1485
+ Blocks,
1486
+ {
1487
+ parent: (n = e.builderContext.context) == null ? void 0 : n.symbolId,
1488
+ path: `symbol.data.${e.name}`,
1489
+ context: e.builderContext,
1490
+ blocks: (o = e.builderContext.rootState) == null ? void 0 : o[e.name]
1491
+ }
1492
+ )
1493
+ }
1494
+ );
1495
+ }
1496
+ const componentInfo$2 = {
1473
1497
  name: "Symbol",
1474
1498
  noWrap: !0,
1475
1499
  static: !0,
@@ -1617,28 +1641,28 @@ const componentInfo = {
1617
1641
  }]
1618
1642
  }, getDefaultRegisteredComponents = () => [{
1619
1643
  component: Button,
1620
- ...componentInfo$a
1644
+ ...componentInfo$b
1621
1645
  }, {
1622
1646
  component: Columns,
1623
- ...componentInfo$9
1647
+ ...componentInfo$a
1624
1648
  }, {
1625
1649
  component: CustomCode,
1626
- ...componentInfo$8
1650
+ ...componentInfo$9
1627
1651
  }, {
1628
1652
  component: Embed,
1629
- ...componentInfo$7
1653
+ ...componentInfo$8
1630
1654
  }, {
1631
1655
  component: FragmentComponent,
1632
- ...componentInfo$6
1656
+ ...componentInfo$7
1633
1657
  }, {
1634
1658
  component: Image,
1635
- ...componentInfo$5
1659
+ ...componentInfo$6
1636
1660
  }, {
1637
1661
  component: ImgComponent,
1638
- ...componentInfo$4
1662
+ ...componentInfo$5
1639
1663
  }, {
1640
1664
  component: SectionComponent,
1641
- ...componentInfo$3
1665
+ ...componentInfo$4
1642
1666
  }, {
1643
1667
  component: Symbol$1,
1644
1668
  ...componentInfo$2
@@ -1648,6 +1672,9 @@ const componentInfo = {
1648
1672
  }, {
1649
1673
  component: Video,
1650
1674
  ...componentInfo
1675
+ }, {
1676
+ component: Slot,
1677
+ ...componentInfo$3
1651
1678
  }], components = [], createRegisterComponentMessage = (e) => ({
1652
1679
  type: "builder.registerComponent",
1653
1680
  data: serializeComponentInfo(e)
@@ -1852,33 +1879,33 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
1852
1879
  apiKey: a,
1853
1880
  includeRefs: s = !0,
1854
1881
  enrich: c,
1855
- locale: u,
1856
- apiVersion: m = DEFAULT_API_VERSION,
1882
+ locale: m,
1883
+ apiVersion: f = DEFAULT_API_VERSION,
1857
1884
  fields: p,
1858
1885
  omit: g,
1859
1886
  offset: d,
1860
- cacheSeconds: f,
1887
+ cacheSeconds: u,
1861
1888
  staleCacheSeconds: l,
1862
1889
  sort: h,
1863
1890
  includeUnpublished: y
1864
1891
  } = e;
1865
1892
  if (!a)
1866
1893
  throw new Error("Missing API key");
1867
- if (!["v2", "v3"].includes(m))
1868
- throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${m}'`);
1894
+ if (!["v2", "v3"].includes(f))
1895
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
1869
1896
  (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
1870
- const b = new URL(`https://cdn.builder.io/api/${m}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${u ? `&locale=${u}` : ""}${c ? `&enrich=${c}` : ""}`);
1871
- 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)), 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) {
1872
1899
  const S = flatten({
1873
1900
  sort: h
1874
1901
  });
1875
1902
  for (const C in S)
1876
1903
  b.searchParams.set(C, JSON.stringify(S[C]));
1877
1904
  }
1878
- const v = {
1905
+ const I = {
1879
1906
  ...getBuilderSearchParamsFromWindow(),
1880
1907
  ...normalizeSearchParams(e.options || {})
1881
- }, x = flatten(v);
1908
+ }, x = flatten(I);
1882
1909
  for (const S in x)
1883
1910
  b.searchParams.set(S, String(x[S]));
1884
1911
  if (o && b.searchParams.set("userAttributes", JSON.stringify(o)), r) {
@@ -1937,7 +1964,11 @@ async function fetchEntries(e) {
1937
1964
  return logger.error("Error fetching data. ", t), null;
1938
1965
  }
1939
1966
  }
1940
- 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
+ }
1941
1972
  function isPreviewing() {
1942
1973
  return !isBrowser() || isEditing() ? !1 : location.search.indexOf("builder.preview=") !== -1;
1943
1974
  }
@@ -2125,7 +2156,7 @@ const findParentElement = (e, t, n = !0) => {
2125
2156
  builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
2126
2157
  }
2127
2158
  };
2128
- }, SDK_VERSION = "0.12.0", registry = {};
2159
+ }, SDK_VERSION = "0.12.2", registry = {};
2129
2160
  function register(e, t) {
2130
2161
  let n = registry[e];
2131
2162
  if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
@@ -2185,40 +2216,43 @@ const setupBrowserForEditing = (e = {}) => {
2185
2216
  data: {
2186
2217
  options: e
2187
2218
  }
2188
- }, "*"), window.addEventListener("message", ({
2189
- data: o
2190
- }) => {
2191
- var r, i;
2192
- if (o != null && o.type)
2193
- 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) {
2194
2228
  case "builder.evaluate": {
2195
- const a = o.data.text, s = o.data.arguments || [], c = o.data.id, u = new Function(a);
2196
- let m, 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;
2197
2231
  try {
2198
- m = u.apply(null, s);
2199
- } catch (g) {
2200
- p = g;
2232
+ p = f.apply(null, c);
2233
+ } catch (d) {
2234
+ g = d;
2201
2235
  }
2202
- p ? (r = window.parent) == null || r.postMessage({
2236
+ g ? (i = window.parent) == null || i.postMessage({
2203
2237
  type: "builder.evaluateError",
2204
2238
  data: {
2205
- id: c,
2206
- error: p.message
2239
+ id: m,
2240
+ error: g.message
2207
2241
  }
2208
- }, "*") : m && typeof m.then == "function" ? m.then((g) => {
2209
- var d;
2210
- (d = window.parent) == null || d.postMessage({
2242
+ }, "*") : p && typeof p.then == "function" ? p.then((d) => {
2243
+ var u;
2244
+ (u = window.parent) == null || u.postMessage({
2211
2245
  type: "builder.evaluateResult",
2212
2246
  data: {
2213
- id: c,
2214
- result: g
2247
+ id: m,
2248
+ result: d
2215
2249
  }
2216
2250
  }, "*");
2217
- }).catch(console.error) : (i = window.parent) == null || i.postMessage({
2251
+ }).catch(console.error) : (a = window.parent) == null || a.postMessage({
2218
2252
  type: "builder.evaluateResult",
2219
2253
  data: {
2220
- result: m,
2221
- id: c
2254
+ result: p,
2255
+ id: m
2222
2256
  }
2223
2257
  }, "*");
2224
2258
  break;
@@ -2314,7 +2348,7 @@ const getRootStateInitialValue = ({
2314
2348
  meta: e == null ? void 0 : e.meta
2315
2349
  } : void 0;
2316
2350
  function ContentComponent(e) {
2317
- var r, i, a, s, c, u, m, p, g;
2351
+ var r, i, a, s, c, m, f, p, g;
2318
2352
  const t = getUpdateVariantVisibilityScript({
2319
2353
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2320
2354
  variationId: (r = e.content) == null ? void 0 : r.testVariationId,
@@ -2330,10 +2364,10 @@ function ContentComponent(e) {
2330
2364
  ...components,
2331
2365
  ...e.customComponents || []
2332
2366
  ].reduce(
2333
- (d, { component: f, ...l }) => ({
2367
+ (d, { component: u, ...l }) => ({
2334
2368
  ...d,
2335
2369
  [l.name]: {
2336
- component: f,
2370
+ component: u,
2337
2371
  ...serializeComponentInfo(l)
2338
2372
  }
2339
2373
  }),
@@ -2363,7 +2397,7 @@ function ContentComponent(e) {
2363
2397
  ...components,
2364
2398
  ...e.customComponents || []
2365
2399
  ].reduce(
2366
- (d, { component: f, ...l }) => ({
2400
+ (d, { component: u, ...l }) => ({
2367
2401
  ...d,
2368
2402
  [l.name]: serializeComponentInfo(l)
2369
2403
  }),
@@ -2389,6 +2423,7 @@ function ContentComponent(e) {
2389
2423
  builderContextSignal: o,
2390
2424
  contentWrapper: e.contentWrapper,
2391
2425
  contentWrapperProps: e.contentWrapperProps,
2426
+ trustedHosts: e.trustedHosts,
2392
2427
  children: [
2393
2428
  e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
2394
2429
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
@@ -2396,7 +2431,7 @@ function ContentComponent(e) {
2396
2431
  {
2397
2432
  contentId: (a = o.content) == null ? void 0 : a.id,
2398
2433
  cssCode: (c = (s = o.content) == null ? void 0 : s.data) == null ? void 0 : c.cssCode,
2399
- customFonts: (m = (u = o.content) == null ? void 0 : u.data) == null ? void 0 : m.customFonts
2434
+ customFonts: (f = (m = o.content) == null ? void 0 : m.data) == null ? void 0 : f.customFonts
2400
2435
  }
2401
2436
  ) }),
2402
2437
  /* @__PURE__ */ jsx(
@@ -2419,9 +2454,9 @@ function ContentVariants(e) {
2419
2454
  }), n = function() {
2420
2455
  var c;
2421
2456
  return getUpdateCookieAndStylesScript(
2422
- getVariants(e.content).map((u) => ({
2423
- id: u.testVariationId,
2424
- testRatio: u.testRatio
2457
+ getVariants(e.content).map((m) => ({
2458
+ id: m.testVariationId,
2459
+ testRatio: m.testRatio
2425
2460
  })),
2426
2461
  ((c = e.content) == null ? void 0 : c.id) || ""
2427
2462
  );
@@ -2467,7 +2502,8 @@ function ContentVariants(e) {
2467
2502
  blocksWrapper: e.blocksWrapper,
2468
2503
  blocksWrapperProps: e.blocksWrapperProps,
2469
2504
  contentWrapper: e.contentWrapper,
2470
- contentWrapperProps: e.contentWrapperProps
2505
+ contentWrapperProps: e.contentWrapperProps,
2506
+ trustedHosts: e.trustedHosts
2471
2507
  },
2472
2508
  s.testVariationId
2473
2509
  ))
@@ -2491,7 +2527,8 @@ function ContentVariants(e) {
2491
2527
  blocksWrapper: e.blocksWrapper,
2492
2528
  blocksWrapperProps: e.blocksWrapperProps,
2493
2529
  contentWrapper: e.contentWrapper,
2494
- contentWrapperProps: e.contentWrapperProps
2530
+ contentWrapperProps: e.contentWrapperProps,
2531
+ trustedHosts: e.trustedHosts
2495
2532
  }
2496
2533
  )
2497
2534
  ] });
@@ -2516,14 +2553,14 @@ const fetchSymbolContent = async ({
2516
2553
  });
2517
2554
  };
2518
2555
  async function Symbol$1(e) {
2519
- var o, r, i, a;
2556
+ var o, r, i, a, s;
2520
2557
  const t = function() {
2521
- var c, u;
2558
+ var m, f;
2522
2559
  return [
2523
2560
  e.attributes.className,
2524
2561
  "builder-symbol",
2525
- (c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
2526
- (u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2562
+ (m = e.symbol) != null && m.inline ? "builder-inline-symbol" : void 0,
2563
+ (f = e.symbol) != null && f.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2527
2564
  ].filter(Boolean).join(" ");
2528
2565
  }, n = ((o = e.symbol) == null ? void 0 : o.content) || await fetchSymbolContent({
2529
2566
  symbol: e.symbol,
@@ -2535,14 +2572,17 @@ async function Symbol$1(e) {
2535
2572
  __isNestedRender: !0,
2536
2573
  apiVersion: e.builderContext.apiVersion,
2537
2574
  apiKey: e.builderContext.apiKey,
2538
- context: e.builderContext.context,
2575
+ context: {
2576
+ ...e.builderContext.context,
2577
+ symbolId: (r = e.builderBlock) == null ? void 0 : r.id
2578
+ },
2539
2579
  customComponents: Object.values(e.builderComponents),
2540
2580
  data: {
2541
- ...(r = e.symbol) == null ? void 0 : r.data,
2581
+ ...(i = e.symbol) == null ? void 0 : i.data,
2542
2582
  ...e.builderContext.localState,
2543
- ...(i = n == null ? void 0 : n.data) == null ? void 0 : i.state
2583
+ ...(a = n == null ? void 0 : n.data) == null ? void 0 : a.state
2544
2584
  },
2545
- model: (a = e.symbol) == null ? void 0 : a.model,
2585
+ model: (s = e.symbol) == null ? void 0 : s.model,
2546
2586
  content: n
2547
2587
  }
2548
2588
  ) });
@@ -2579,39 +2619,41 @@ const fetchBuilderProps = async (e) => {
2579
2619
  };
2580
2620
  };
2581
2621
  export {
2582
- getBuilderSearchParams as A,
2622
+ getAllContent as A,
2583
2623
  Blocks as B,
2584
2624
  ContentVariants as C,
2585
- track as D,
2586
- fetchBuilderProps as E,
2625
+ getContent as D,
2626
+ getBuilderSearchParams as E,
2627
+ track as F,
2628
+ fetchBuilderProps as G,
2587
2629
  RenderBlocks as R,
2588
2630
  Symbol$1 as S,
2589
2631
  Text as T,
2590
2632
  _track as _,
2591
2633
  getBlockActions as a,
2592
- getSrcSet as b,
2593
- isJsScript as c,
2594
- isBrowser as d,
2595
- getDefaultCanTrack as e,
2596
- isPreviewing as f,
2634
+ isEditing as b,
2635
+ getSrcSet as c,
2636
+ isJsScript as d,
2637
+ isBrowser as e,
2638
+ getDefaultCanTrack as f,
2597
2639
  getBlockProperties as g,
2598
- evaluate as h,
2599
- isEditing as i,
2600
- getInteractionPropertiesForEvent as j,
2601
- fastClone as k,
2640
+ isPreviewing as h,
2641
+ isEmptyElement as i,
2642
+ isFromTrustedHost as j,
2643
+ evaluate as k,
2602
2644
  logger as l,
2603
- createRegisterComponentMessage as m,
2604
- fetchOneEntry as n,
2605
- fetch$1 as o,
2606
- init as p,
2607
- RenderContent as q,
2645
+ getInteractionPropertiesForEvent as m,
2646
+ fastClone as n,
2647
+ createRegisterComponentMessage as o,
2648
+ fetchOneEntry as p,
2649
+ fetch$1 as q,
2608
2650
  registerInsertMenu as r,
2609
2651
  setupBrowserForEditing as s,
2610
- Columns as t,
2611
- register as u,
2612
- setEditorSettings as v,
2613
- _processContentResult as w,
2614
- fetchEntries as x,
2615
- getAllContent as y,
2616
- getContent as z
2652
+ init as t,
2653
+ RenderContent as u,
2654
+ Columns as v,
2655
+ register as w,
2656
+ setEditorSettings as x,
2657
+ _processContentResult as y,
2658
+ fetchEntries as z
2617
2659
  };