@builder.io/sdk-react 1.0.0 → 1.0.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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
- import { T as TARGET, i as isEditing, h as isBrowser, j as getUserAttributes, k as fastClone, l as checkIsDefined, m as logger, n as getDefaultCanTrack, o as _track, a as isPreviewing, p as createEditorListener, q as registerInsertMenu, u as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, v as fetch$1, w as serializeComponentInfo, x as handleABTestingSync } from "./server-entry-9bde547c.js";
4
- import { _ as H, f as K, d as q, g as z, r as J, s as Y, b as G, t as Q } from "./server-entry-9bde547c.js";
3
+ import { T as TARGET, i as isEditing, h as isBrowser, j as getUserAttributes, k as fastClone, l as checkIsDefined, m as logger, n as getDefaultCanTrack, o as _track, a as isPreviewing, p as createEditorListener, q as registerInsertMenu, u as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, v as fetch$1, w as serializeComponentInfo, x as handleABTestingSync } from "./server-entry-c2b6d198.js";
4
+ import { _ as H, f as K, d as q, g as z, r as J, s as Y, b as G, t as Q } from "./server-entry-c2b6d198.js";
5
5
  import { createContext, useState, useEffect, useContext, useRef, createElement } from "react";
6
6
  import { createRequire } from "node:module";
7
7
  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());
@@ -25,7 +25,6 @@ function Button(e) {
25
25
  return /* @__PURE__ */ jsx(
26
26
  DynamicRenderer,
27
27
  {
28
- TagName: e.link ? e.builderLinkComponent || "a" : "button",
29
28
  attributes: {
30
29
  ...e.attributes,
31
30
  [getClassPropName()]: `${e.link ? "" : "builder-button"} ${e.attributes[getClassPropName()] || ""}`,
@@ -37,6 +36,7 @@ function Button(e) {
37
36
  role: "button"
38
37
  }
39
38
  },
39
+ TagName: e.link ? e.builderLinkComponent || "a" : "button",
40
40
  actionAttributes: {},
41
41
  children: e.text
42
42
  }
@@ -148,7 +148,7 @@ try {
148
148
  } catch (e) {
149
149
  }
150
150
  }
151
- 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 = `
151
+ const getSyncValName = (e) => `bldr_${e}_sync`, BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE", INJECTED_IVM_GLOBAL = "BUILDER_IVM", REF_TO_PROXY_FN = `
152
152
  var refToProxy = (obj) => {
153
153
  if (typeof obj !== 'object' || obj === null) {
154
154
  return obj;
@@ -194,9 +194,12 @@ if (typeof output === 'object' && output !== null) {
194
194
 
195
195
  output;
196
196
  `;
197
- }, getIsolateContext = () => new ivm.Isolate({
198
- memoryLimit: 128
199
- }).createContextSync(), runInNode = ({
197
+ }, getIsolateContext = () => {
198
+ const e = safeDynamicRequire("isolated-vm");
199
+ return new e.Isolate({
200
+ memoryLimit: 128
201
+ }).createContextSync();
202
+ }, runInNode = ({
200
203
  code: e,
201
204
  builder: t,
202
205
  context: n,
@@ -205,37 +208,37 @@ output;
205
208
  rootSetState: a,
206
209
  rootState: r
207
210
  }) => {
208
- const s = fastClone({
211
+ const s = safeDynamicRequire("isolated-vm"), l = fastClone({
209
212
  ...r,
210
213
  ...o
211
- }), l = getFunctionArguments({
214
+ }), c = getFunctionArguments({
212
215
  builder: t,
213
216
  context: n,
214
217
  event: i,
215
- state: s
216
- }), c = getIsolateContext(), u = c.global;
217
- u.setSync("global", u.derefInto()), u.setSync("log", function(...d) {
218
+ state: l
219
+ }), u = getIsolateContext(), y = u.global;
220
+ y.setSync("global", y.derefInto()), y.setSync("log", function(...d) {
218
221
  console.log(...d);
219
- }), u.setSync(BUILDER_SET_STATE_NAME, function(d, m) {
220
- set(r, d, m), a == null || a(r);
221
- }), l.forEach(([d, m]) => {
222
- const b = typeof m == "object" ? new ivm.Reference(
222
+ }), y.setSync(BUILDER_SET_STATE_NAME, function(d, f) {
223
+ set(r, d, f), a == null || a(r);
224
+ }), c.forEach(([d, f]) => {
225
+ const v = typeof f == "object" ? new s.Reference(
223
226
  // workaround: methods with default values for arguments is not being cloned over
224
227
  d === "builder" ? {
225
- ...m,
226
- getUserAttributes: () => m.getUserAttributes()
227
- } : m
228
+ ...f,
229
+ getUserAttributes: () => f.getUserAttributes()
230
+ } : f
228
231
  ) : null;
229
- u.setSync(getSyncValName(d), b);
230
- }), u.setSync(INJECTED_IVM_GLOBAL, ivm);
231
- const y = processCode({
232
+ y.setSync(getSyncValName(d), v);
233
+ }), y.setSync(INJECTED_IVM_GLOBAL, s);
234
+ const x = processCode({
232
235
  code: e,
233
- args: l
234
- }), x = c.evalSync(y);
236
+ args: c
237
+ }), m = u.evalSync(x);
235
238
  try {
236
- return JSON.parse(x);
239
+ return JSON.parse(m);
237
240
  } catch {
238
- return x;
241
+ return m;
239
242
  }
240
243
  };
241
244
  function isNodeRuntime() {
@@ -439,8 +442,8 @@ function bindScrollInViewAnimation(e) {
439
442
  leading: !1
440
443
  });
441
444
  function s(u) {
442
- const y = u.getBoundingClientRect(), x = window.innerHeight, m = (e.thresholdPercent || 0) / 100 * x;
443
- return y.bottom > m && y.top < x - m;
445
+ const y = u.getBoundingClientRect(), x = window.innerHeight, d = (e.thresholdPercent || 0) / 100 * x;
446
+ return y.bottom > d && y.top < x - d;
444
447
  }
445
448
  const l = e.steps[0].styles;
446
449
  function c() {
@@ -583,7 +586,7 @@ function BlockStyles(e) {
583
586
  return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
584
587
  }
585
588
  function n() {
586
- var m;
589
+ var d;
587
590
  const i = getProcessedBlock({
588
591
  block: e.block,
589
592
  localState: e.context.localState,
@@ -592,7 +595,7 @@ function BlockStyles(e) {
592
595
  context: e.context.context,
593
596
  shouldEvaluateBindings: !0
594
597
  }), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
595
- ((m = a == null ? void 0 : a.meta) == null ? void 0 : m.breakpoints) || {}
598
+ ((d = a == null ? void 0 : a.meta) == null ? void 0 : d.breakpoints) || {}
596
599
  ), s = o == null ? void 0 : o.large, l = o == null ? void 0 : o.medium, c = o == null ? void 0 : o.small, u = i.id;
597
600
  if (!u)
598
601
  return "";
@@ -606,7 +609,7 @@ function BlockStyles(e) {
606
609
  "medium",
607
610
  r
608
611
  )
609
- }) : "", d = c ? createCssClass({
612
+ }) : "", m = c ? createCssClass({
610
613
  className: u,
611
614
  styles: c,
612
615
  mediaQuery: getMaxWidthQueryForSize(
@@ -614,7 +617,7 @@ function BlockStyles(e) {
614
617
  r
615
618
  )
616
619
  }) : "";
617
- return [y, x, d].join(" ");
620
+ return [y, x, m].join(" ");
618
621
  }
619
622
  return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
620
623
  }
@@ -838,8 +841,8 @@ function Block(e) {
838
841
  });
839
842
  }
840
843
  function i() {
841
- var d;
842
- return (d = e.block.repeat) != null && d.collection ? e.block : getProcessedBlock({
844
+ var m;
845
+ return (m = e.block.repeat) != null && m.collection ? e.block : getProcessedBlock({
843
846
  block: e.block,
844
847
  localState: e.context.localState,
845
848
  rootState: e.context.rootState,
@@ -849,32 +852,32 @@ function Block(e) {
849
852
  });
850
853
  }
851
854
  function o() {
852
- var m;
853
- return e.block.tagName === "a" || ((m = i().properties) == null ? void 0 : m.href) || i().href ? e.linkComponent || "a" : e.block.tagName || "div";
855
+ var d;
856
+ return e.block.tagName === "a" || ((d = i().properties) == null ? void 0 : d.href) || i().href ? e.linkComponent || "a" : e.block.tagName || "div";
854
857
  }
855
858
  function a() {
856
- var b, I;
857
- if ((b = e.block.repeat) != null && b.collection)
858
- return !!((I = n == null ? void 0 : n()) != null && I.length);
859
- const d = "hide" in i() ? i().hide : !1;
860
- return ("show" in i() ? i().show : !0) && !d;
859
+ var f, v;
860
+ if ((f = e.block.repeat) != null && f.collection)
861
+ return !!((v = n == null ? void 0 : n()) != null && v.length);
862
+ const m = "hide" in i() ? i().hide : !1;
863
+ return ("show" in i() ? i().show : !0) && !m;
861
864
  }
862
865
  function r() {
863
- var m, b;
864
- return !((m = t == null ? void 0 : t()) != null && m.component) && !n() ? (b = i().children) != null ? b : [] : [];
866
+ var d, f;
867
+ return !((d = t == null ? void 0 : t()) != null && d.component) && !n() ? (f = i().children) != null ? f : [] : [];
865
868
  }
866
869
  function s() {
867
- var d, m, b, I, R, S, k, w, E, B, F;
870
+ var m, d, f, v, R, S, C, w, E, B, F;
868
871
  return {
869
- blockChildren: (d = i().children) != null ? d : [],
870
- componentRef: (m = t == null ? void 0 : t()) == null ? void 0 : m.component,
872
+ blockChildren: (m = i().children) != null ? m : [],
873
+ componentRef: (d = t == null ? void 0 : t()) == null ? void 0 : d.component,
871
874
  componentOptions: {
872
875
  ...getBlockComponentOptions(i()),
873
876
  builderContext: e.context,
874
- ...((b = t == null ? void 0 : t()) == null ? void 0 : b.name) === "Core:Button" || ((I = t == null ? void 0 : t()) == null ? void 0 : I.name) === "Symbol" || ((R = t == null ? void 0 : t()) == null ? void 0 : R.name) === "Columns" || ((S = t == null ? void 0 : t()) == null ? void 0 : S.name) === "Form:Form" ? {
877
+ ...((f = t == null ? void 0 : t()) == null ? void 0 : f.name) === "Core:Button" || ((v = t == null ? void 0 : t()) == null ? void 0 : v.name) === "Symbol" || ((R = t == null ? void 0 : t()) == null ? void 0 : R.name) === "Columns" || ((S = t == null ? void 0 : t()) == null ? void 0 : S.name) === "Form:Form" ? {
875
878
  builderLinkComponent: e.linkComponent
876
879
  } : {},
877
- ...((k = t == null ? void 0 : t()) == null ? void 0 : k.name) === "Symbol" || ((w = t == null ? void 0 : t()) == null ? void 0 : w.name) === "Columns" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Form:Form" ? {
880
+ ...((C = t == null ? void 0 : t()) == null ? void 0 : C.name) === "Symbol" || ((w = t == null ? void 0 : t()) == null ? void 0 : w.name) === "Columns" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Form:Form" ? {
878
881
  builderComponents: e.registeredComponents
879
882
  } : {}
880
883
  },
@@ -888,11 +891,11 @@ function Block(e) {
888
891
  }
889
892
  const [l, c] = useState(() => e.context);
890
893
  return useEffect(() => {
891
- const d = i().id, m = i().animations;
892
- m && d && bindAnimations(
893
- m.filter((b) => b.trigger !== "hover").map((b) => ({
894
- ...b,
895
- elementId: d
894
+ const m = i().id, d = i().animations;
895
+ d && m && bindAnimations(
896
+ d.filter((f) => f.trigger !== "hover").map((f) => ({
897
+ ...f,
898
+ elementId: m
896
899
  }))
897
900
  );
898
901
  }, []), /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -910,15 +913,15 @@ function Block(e) {
910
913
  includeBlockProps: s().includeBlockProps,
911
914
  isInteractive: s().isInteractive
912
915
  }
913
- ) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((d, m) => /* @__PURE__ */ jsx(
916
+ ) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((m, d) => /* @__PURE__ */ jsx(
914
917
  RepeatedBlock,
915
918
  {
916
- repeatContext: d.context,
917
- block: d.block,
919
+ repeatContext: m.context,
920
+ block: m.block,
918
921
  registeredComponents: e.registeredComponents,
919
922
  linkComponent: e.linkComponent
920
923
  },
921
- m
924
+ d
922
925
  )) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
923
926
  BlockWrapper,
924
927
  {
@@ -941,15 +944,15 @@ function Block(e) {
941
944
  isInteractive: s().isInteractive
942
945
  }
943
946
  ),
944
- (y = r()) == null ? void 0 : y.map((d) => /* @__PURE__ */ jsx(
947
+ (y = r()) == null ? void 0 : y.map((m) => /* @__PURE__ */ jsx(
945
948
  Block,
946
949
  {
947
- block: d,
950
+ block: m,
948
951
  context: l,
949
952
  registeredComponents: e.registeredComponents,
950
953
  linkComponent: e.linkComponent
951
954
  },
952
- d.id
955
+ m.id
953
956
  ))
954
957
  ]
955
958
  }
@@ -1042,29 +1045,29 @@ function Columns(e) {
1042
1045
  () => e.stackColumnsAt || "tablet"
1043
1046
  );
1044
1047
  function s(S) {
1045
- var k;
1046
- return ((k = i[S]) == null ? void 0 : k.width) || 100 / i.length;
1048
+ var C;
1049
+ return ((C = i[S]) == null ? void 0 : C.width) || 100 / i.length;
1047
1050
  }
1048
1051
  function l(S) {
1049
- const k = t * (i.length - 1) / i.length;
1050
- return `calc(${s(S)}% - ${k}px)`;
1052
+ const C = t * (i.length - 1) / i.length;
1053
+ return `calc(${s(S)}% - ${C}px)`;
1051
1054
  }
1052
1055
  function c({
1053
1056
  stackedStyle: S,
1054
- desktopStyle: k
1057
+ desktopStyle: C
1055
1058
  }) {
1056
- return a === "tablet" ? S : k;
1059
+ return a === "tablet" ? S : C;
1057
1060
  }
1058
1061
  function u({
1059
1062
  stackedStyle: S,
1060
- desktopStyle: k
1063
+ desktopStyle: C
1061
1064
  }) {
1062
- return a === "never" ? k : S;
1065
+ return a === "never" ? C : S;
1063
1066
  }
1064
1067
  const [y, x] = useState(
1065
1068
  () => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
1066
1069
  );
1067
- function d() {
1070
+ function m() {
1068
1071
  return {
1069
1072
  "--flex-dir": y,
1070
1073
  "--flex-dir-tablet": c({
@@ -1073,8 +1076,8 @@ function Columns(e) {
1073
1076
  })
1074
1077
  };
1075
1078
  }
1076
- function m(S) {
1077
- const k = S === 0 ? 0 : t, w = l(S), E = `${k}px`, B = "100%", F = 0;
1079
+ function d(S) {
1080
+ const C = S === 0 ? 0 : t, w = l(S), E = `${C}px`, B = "100%", F = 0;
1078
1081
  return {
1079
1082
  ...{
1080
1083
  display: "flex",
@@ -1101,15 +1104,15 @@ function Columns(e) {
1101
1104
  })
1102
1105
  };
1103
1106
  }
1104
- function b(S) {
1107
+ function f(S) {
1105
1108
  var w, E;
1106
1109
  return getSizesForBreakpoints(
1107
1110
  ((E = (w = e.builderContext.content) == null ? void 0 : w.meta) == null ? void 0 : E.breakpoints) || {}
1108
1111
  )[S].max;
1109
1112
  }
1110
- function I() {
1113
+ function v() {
1111
1114
  return `
1112
- @media (max-width: ${b("medium")}px) {
1115
+ @media (max-width: ${f("medium")}px) {
1113
1116
  .${e.builderBlock.id}-breakpoints {
1114
1117
  flex-direction: var(--flex-dir-tablet);
1115
1118
  align-items: stretch;
@@ -1121,7 +1124,7 @@ function Columns(e) {
1121
1124
  }
1122
1125
  }
1123
1126
 
1124
- @media (max-width: ${b("small")}px) {
1127
+ @media (max-width: ${f("small")}px) {
1125
1128
  .${e.builderBlock.id}-breakpoints {
1126
1129
  flex-direction: var(--flex-dir);
1127
1130
  align-items: stretch;
@@ -1138,11 +1141,11 @@ function Columns(e) {
1138
1141
  /* @__PURE__ */ jsxs(
1139
1142
  "div",
1140
1143
  {
1141
- className: `builder-columns ${e.builderBlock.id}-breakpoints div-1046d78c`,
1142
- style: d(),
1144
+ className: `builder-columns ${e.builderBlock.id}-breakpoints div-f5024694`,
1145
+ style: m(),
1143
1146
  children: [
1144
- /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: I() }) }),
1145
- (R = e.columns) == null ? void 0 : R.map((S, k) => /* @__PURE__ */ jsx(
1147
+ /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: v() }) }),
1148
+ (R = e.columns) == null ? void 0 : R.map((S, C) => /* @__PURE__ */ jsx(
1146
1149
  DynamicRenderer,
1147
1150
  {
1148
1151
  TagName: S.link ? e.builderLinkComponent || "a" : "div",
@@ -1152,12 +1155,12 @@ function Columns(e) {
1152
1155
  href: S.link
1153
1156
  } : {},
1154
1157
  [getClassPropName()]: "builder-column",
1155
- style: mapStyleObjToStrIfNeeded(m(k))
1158
+ style: mapStyleObjToStrIfNeeded(d(C))
1156
1159
  },
1157
1160
  children: /* @__PURE__ */ jsx(
1158
1161
  Blocks,
1159
1162
  {
1160
- path: `component.options.columns.${k}.blocks`,
1163
+ path: `component.options.columns.${C}.blocks`,
1161
1164
  parent: e.builderBlock.id,
1162
1165
  styleProp: {
1163
1166
  flexGrow: "1"
@@ -1169,12 +1172,12 @@ function Columns(e) {
1169
1172
  }
1170
1173
  )
1171
1174
  },
1172
- k
1175
+ C
1173
1176
  ))
1174
1177
  ]
1175
1178
  }
1176
1179
  ),
1177
- /* @__PURE__ */ jsx("style", { children: `.div-1046d78c {
1180
+ /* @__PURE__ */ jsx("style", { children: `.div-f5024694 {
1178
1181
  display: flex;
1179
1182
  line-height: normal;
1180
1183
  }` })
@@ -2157,68 +2160,68 @@ const componentInfo$5 = {
2157
2160
  function FormComponent(e) {
2158
2161
  var y, x;
2159
2162
  const t = useRef(null), [n, i] = useState(() => "unsubmitted"), [o, a] = useState(() => null), [r, s] = useState(() => "");
2160
- function l(d) {
2161
- var b, I;
2162
- const m = {
2163
+ function l(m) {
2164
+ var f, v;
2165
+ const d = {
2163
2166
  ...e.builderContext.rootState,
2164
- ...d
2167
+ ...m
2165
2168
  };
2166
- e.builderContext.rootSetState ? (I = (b = e.builderContext).rootSetState) == null || I.call(b, m) : e.builderContext.rootState = m;
2169
+ e.builderContext.rootSetState ? (v = (f = e.builderContext).rootSetState) == null || v.call(f, d) : e.builderContext.rootState = d;
2167
2170
  }
2168
2171
  function c() {
2169
2172
  return isEditing() && e.previewState || n;
2170
2173
  }
2171
- function u(d) {
2172
- var b;
2173
- const m = e.sendWithJs || e.sendSubmissionsTo === "email";
2174
+ function u(m) {
2175
+ var f;
2176
+ const d = e.sendWithJs || e.sendSubmissionsTo === "email";
2174
2177
  if (e.sendSubmissionsTo === "zapier")
2175
- d.preventDefault();
2176
- else if (m) {
2178
+ m.preventDefault();
2179
+ else if (d) {
2177
2180
  if (!(e.action || e.sendSubmissionsTo === "email")) {
2178
- d.preventDefault();
2181
+ m.preventDefault();
2179
2182
  return;
2180
2183
  }
2181
- d.preventDefault();
2182
- const I = d.currentTarget, R = e.customHeaders || {};
2184
+ m.preventDefault();
2185
+ const v = m.currentTarget, R = e.customHeaders || {};
2183
2186
  let S;
2184
- const k = new FormData(I), w = Array.from(
2185
- d.currentTarget.querySelectorAll("input,select,textarea")
2186
- ).filter((f) => !!f.name).map((f) => {
2187
- let C;
2188
- const A = f.name;
2189
- if (f instanceof HTMLInputElement)
2190
- if (f.type === "radio") {
2191
- if (f.checked)
2192
- return C = f.name, {
2187
+ const C = new FormData(v), w = Array.from(
2188
+ m.currentTarget.querySelectorAll("input,select,textarea")
2189
+ ).filter((g) => !!g.name).map((g) => {
2190
+ let I;
2191
+ const A = g.name;
2192
+ if (g instanceof HTMLInputElement)
2193
+ if (g.type === "radio") {
2194
+ if (g.checked)
2195
+ return I = g.name, {
2193
2196
  key: A,
2194
- value: C
2197
+ value: I
2195
2198
  };
2196
- } else if (f.type === "checkbox")
2197
- C = f.checked;
2198
- else if (f.type === "number" || f.type === "range") {
2199
- const j = f.valueAsNumber;
2200
- isNaN(j) || (C = j);
2199
+ } else if (g.type === "checkbox")
2200
+ I = g.checked;
2201
+ else if (g.type === "number" || g.type === "range") {
2202
+ const j = g.valueAsNumber;
2203
+ isNaN(j) || (I = j);
2201
2204
  } else
2202
- f.type === "file" ? C = f.files : C = f.value;
2205
+ g.type === "file" ? I = g.files : I = g.value;
2203
2206
  else
2204
- C = f.value;
2207
+ I = g.value;
2205
2208
  return {
2206
2209
  key: A,
2207
- value: C
2210
+ value: I
2208
2211
  };
2209
2212
  });
2210
2213
  let E = e.contentType;
2211
- if (e.sendSubmissionsTo === "email" && (E = "multipart/form-data"), Array.from(w).forEach(({ value: f }) => {
2212
- (f instanceof File || Array.isArray(f) && f[0] instanceof File || f instanceof FileList) && (E = "multipart/form-data");
2214
+ if (e.sendSubmissionsTo === "email" && (E = "multipart/form-data"), Array.from(w).forEach(({ value: g }) => {
2215
+ (g instanceof File || Array.isArray(g) && g[0] instanceof File || g instanceof FileList) && (E = "multipart/form-data");
2213
2216
  }), E !== "application/json")
2214
- S = k;
2217
+ S = C;
2215
2218
  else {
2216
- const f = {};
2217
- Array.from(w).forEach(({ value: C, key: A }) => {
2218
- set(f, A, C);
2219
- }), S = JSON.stringify(f);
2219
+ const g = {};
2220
+ Array.from(w).forEach(({ value: I, key: A }) => {
2221
+ set(g, A, I);
2222
+ }), S = JSON.stringify(g);
2220
2223
  }
2221
- E && E !== "multipart/form-data" && (m && ((b = e.action) != null && b.includes("zapier.com")) || (R["content-type"] = E));
2224
+ E && E !== "multipart/form-data" && (d && ((f = e.action) != null && f.includes("zapier.com")) || (R["content-type"] = E));
2222
2225
  const B = new CustomEvent("presubmit", { detail: { body: S } });
2223
2226
  if (t.current && (t.current.dispatchEvent(B), B.defaultPrevented))
2224
2227
  return;
@@ -2230,16 +2233,16 @@ function FormComponent(e) {
2230
2233
  e.sendSubmissionsTo === "email" ? F : e.action,
2231
2234
  { body: S, headers: R, method: e.method || "post" }
2232
2235
  ).then(
2233
- async (f) => {
2234
- let C;
2235
- const A = f.headers.get("content-type");
2236
- if (A && A.indexOf("application/json") !== -1 ? C = await f.json() : C = await f.text(), !f.ok && e.errorMessagePath) {
2237
- let j = get(C, e.errorMessagePath);
2236
+ async (g) => {
2237
+ let I;
2238
+ const A = g.headers.get("content-type");
2239
+ if (A && A.indexOf("application/json") !== -1 ? I = await g.json() : I = await g.text(), !g.ok && e.errorMessagePath) {
2240
+ let j = get(I, e.errorMessagePath);
2238
2241
  j && (typeof j != "string" && (j = JSON.stringify(j)), s(j), l({ formErrorMessage: j }));
2239
2242
  }
2240
- if (a(C), i(f.ok ? "success" : "error"), f.ok) {
2243
+ if (a(I), i(g.ok ? "success" : "error"), g.ok) {
2241
2244
  const j = new CustomEvent("submit:success", {
2242
- detail: { res: f, body: C }
2245
+ detail: { res: g, body: I }
2243
2246
  });
2244
2247
  if (t.current) {
2245
2248
  if (t.current.dispatchEvent(j), j.defaultPrevented)
@@ -2256,11 +2259,11 @@ function FormComponent(e) {
2256
2259
  location.href = e.successUrl;
2257
2260
  }
2258
2261
  },
2259
- (f) => {
2260
- const C = new CustomEvent("submit:error", {
2261
- detail: { error: f }
2262
+ (g) => {
2263
+ const I = new CustomEvent("submit:error", {
2264
+ detail: { error: g }
2262
2265
  });
2263
- t.current && (t.current.dispatchEvent(C), C.defaultPrevented) || (a(f), i("error"));
2266
+ t.current && (t.current.dispatchEvent(I), I.defaultPrevented) || (a(g), i("error"));
2264
2267
  }
2265
2268
  );
2266
2269
  }
@@ -2275,19 +2278,19 @@ function FormComponent(e) {
2275
2278
  action: !e.sendWithJs && e.action,
2276
2279
  method: e.method,
2277
2280
  name: e.name,
2278
- onSubmit: (d) => u(d),
2281
+ onSubmit: (m) => u(m),
2279
2282
  ...e.attributes,
2280
2283
  children: [
2281
2284
  " ",
2282
- e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ jsx(Fragment, { children: (x = (y = e.builderBlock) == null ? void 0 : y.children) == null ? void 0 : x.map((d, m) => /* @__PURE__ */ jsx(
2285
+ e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ jsx(Fragment, { children: (x = (y = e.builderBlock) == null ? void 0 : y.children) == null ? void 0 : x.map((m, d) => /* @__PURE__ */ jsx(
2283
2286
  Block,
2284
2287
  {
2285
- block: d,
2288
+ block: m,
2286
2289
  context: e.builderContext,
2287
2290
  registeredComponents: e.builderComponents,
2288
2291
  linkComponent: e.builderLinkComponent
2289
2292
  },
2290
- `form-block-${m}`
2293
+ `form-block-${d}`
2291
2294
  )) }) : null,
2292
2295
  " ",
2293
2296
  c() === "error" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
@@ -2907,38 +2910,38 @@ const findParentElement = (e, t, n = !0) => {
2907
2910
  };
2908
2911
  };
2909
2912
  function EnableEditor(e) {
2910
- var F, f, C, A, j, V, $;
2913
+ var F, g, I, A, j, V, $;
2911
2914
  const t = useRef(null), [n, i] = useState(() => 0);
2912
2915
  useState(() => !0);
2913
- function o(g) {
2914
- var p, v;
2915
- const h = {
2916
+ function o(h) {
2917
+ var p, k;
2918
+ const b = {
2916
2919
  ...e.builderContextSignal.rootState,
2917
- ...g
2920
+ ...h
2918
2921
  };
2919
- e.builderContextSignal.rootSetState ? (v = (p = e.builderContextSignal).rootSetState) == null || v.call(p, h) : e.setBuilderContextSignal((T) => ({
2922
+ e.builderContextSignal.rootSetState ? (k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, b) : e.setBuilderContextSignal((T) => ({
2920
2923
  ...T,
2921
- rootState: h
2924
+ rootState: b
2922
2925
  }));
2923
2926
  }
2924
- function a(g) {
2925
- var p, v, T, P, N;
2926
- const h = {
2927
+ function a(h) {
2928
+ var p, k, T, P, N;
2929
+ const b = {
2927
2930
  ...e.builderContextSignal.content,
2928
- ...g,
2931
+ ...h,
2929
2932
  data: {
2930
2933
  ...(p = e.builderContextSignal.content) == null ? void 0 : p.data,
2931
- ...g == null ? void 0 : g.data
2934
+ ...h == null ? void 0 : h.data
2932
2935
  },
2933
2936
  meta: {
2934
- ...(v = e.builderContextSignal.content) == null ? void 0 : v.meta,
2935
- ...g == null ? void 0 : g.meta,
2936
- breakpoints: ((T = g == null ? void 0 : g.meta) == null ? void 0 : T.breakpoints) || ((N = (P = e.builderContextSignal.content) == null ? void 0 : P.meta) == null ? void 0 : N.breakpoints)
2937
+ ...(k = e.builderContextSignal.content) == null ? void 0 : k.meta,
2938
+ ...h == null ? void 0 : h.meta,
2939
+ breakpoints: ((T = h == null ? void 0 : h.meta) == null ? void 0 : T.breakpoints) || ((N = (P = e.builderContextSignal.content) == null ? void 0 : P.meta) == null ? void 0 : N.breakpoints)
2937
2940
  }
2938
2941
  };
2939
2942
  e.setBuilderContextSignal((W) => ({
2940
2943
  ...W,
2941
- content: h
2944
+ content: b
2942
2945
  }));
2943
2946
  }
2944
2947
  useState(() => 0);
@@ -2947,61 +2950,61 @@ function EnableEditor(e) {
2947
2950
  ), [l, c] = useState(
2948
2951
  () => e.contentWrapper || "div"
2949
2952
  );
2950
- function u(g) {
2953
+ function u(h) {
2951
2954
  return createEditorListener({
2952
2955
  model: e.model,
2953
2956
  trustedHosts: e.trustedHosts,
2954
2957
  callbacks: {
2955
- configureSdk: (h) => {
2958
+ configureSdk: (b) => {
2956
2959
  var T;
2957
- const { breakpoints: p, contentId: v } = h;
2958
- !v || v !== ((T = e.builderContextSignal.content) == null ? void 0 : T.id) || p && (a({
2960
+ const { breakpoints: p, contentId: k } = b;
2961
+ !k || k !== ((T = e.builderContextSignal.content) == null ? void 0 : T.id) || p && (a({
2959
2962
  meta: {
2960
2963
  breakpoints: p
2961
2964
  }
2962
2965
  }), i(n + 1));
2963
2966
  },
2964
- animation: (h) => {
2965
- triggerAnimation(h);
2967
+ animation: (b) => {
2968
+ triggerAnimation(b);
2966
2969
  },
2967
- contentUpdate: (h) => {
2968
- a(h), i(n + 1);
2970
+ contentUpdate: (b) => {
2971
+ a(b), i(n + 1);
2969
2972
  }
2970
2973
  }
2971
- })(g);
2974
+ })(h);
2972
2975
  }
2973
2976
  function y() {
2974
- var h, p;
2975
- const g = (p = (h = e.builderContextSignal.content) == null ? void 0 : h.data) == null ? void 0 : p.jsCode;
2976
- g && evaluate({
2977
- code: g,
2977
+ var b, p;
2978
+ const h = (p = (b = e.builderContextSignal.content) == null ? void 0 : b.data) == null ? void 0 : p.jsCode;
2979
+ h && evaluate({
2980
+ code: h,
2978
2981
  context: e.context || {},
2979
2982
  localState: void 0,
2980
2983
  rootState: e.builderContextSignal.rootState,
2981
2984
  rootSetState: e.builderContextSignal.rootSetState
2982
2985
  });
2983
2986
  }
2984
- const [x, d] = useState(() => ({})), [m, b] = useState(() => !1);
2985
- function I(g) {
2986
- var h, p;
2987
+ const [x, m] = useState(() => ({})), [d, f] = useState(() => !1);
2988
+ function v(h) {
2989
+ var b, p;
2987
2990
  if (e.builderContextSignal.content) {
2988
- const v = (h = e.builderContextSignal.content) == null ? void 0 : h.testVariationId, T = (p = e.builderContextSignal.content) == null ? void 0 : p.id;
2991
+ const k = (b = e.builderContextSignal.content) == null ? void 0 : b.testVariationId, T = (p = e.builderContextSignal.content) == null ? void 0 : p.id;
2989
2992
  _track({
2990
2993
  type: "click",
2991
2994
  canTrack: getDefaultCanTrack(e.canTrack),
2992
2995
  contentId: T,
2993
2996
  apiKey: e.apiKey,
2994
- variationId: v !== T ? v : void 0,
2995
- ...getInteractionPropertiesForEvent(g),
2996
- unique: !m
2997
+ variationId: k !== T ? k : void 0,
2998
+ ...getInteractionPropertiesForEvent(h),
2999
+ unique: !d
2997
3000
  });
2998
3001
  }
2999
- m || b(!0);
3002
+ d || f(!0);
3000
3003
  }
3001
- function R(g) {
3002
- return g.replace(
3004
+ function R(h) {
3005
+ return h.replace(
3003
3006
  /{{([^}]+)}}/g,
3004
- (h, p) => evaluate({
3007
+ (b, p) => evaluate({
3005
3008
  code: p,
3006
3009
  context: e.context || {},
3007
3010
  localState: void 0,
@@ -3010,22 +3013,22 @@ function EnableEditor(e) {
3010
3013
  })
3011
3014
  );
3012
3015
  }
3013
- function S({ url: g, key: h }) {
3014
- fetch$1(g).then((p) => p.json()).then((p) => {
3016
+ function S({ url: h, key: b }) {
3017
+ fetch$1(h).then((p) => p.json()).then((p) => {
3015
3018
  var T, P;
3016
- const v = {
3019
+ const k = {
3017
3020
  ...e.builderContextSignal.rootState,
3018
- [h]: p
3021
+ [b]: p
3019
3022
  };
3020
- (P = (T = e.builderContextSignal).rootSetState) == null || P.call(T, v), x[h] = !0;
3023
+ (P = (T = e.builderContextSignal).rootSetState) == null || P.call(T, k), x[b] = !0;
3021
3024
  }).catch((p) => {
3022
- console.error("error fetching dynamic data", g, p);
3025
+ console.error("error fetching dynamic data", h, p);
3023
3026
  });
3024
3027
  }
3025
- function k() {
3026
- var h, p, v;
3027
- const g = (v = (p = (h = e.builderContextSignal.content) == null ? void 0 : h.data) == null ? void 0 : p.httpRequests) != null ? v : {};
3028
- Object.entries(g).forEach(([T, P]) => {
3028
+ function C() {
3029
+ var b, p, k;
3030
+ const h = (k = (p = (b = e.builderContextSignal.content) == null ? void 0 : b.data) == null ? void 0 : p.httpRequests) != null ? k : {};
3031
+ Object.entries(h).forEach(([T, P]) => {
3029
3032
  if (P && (!x[T] || isEditing())) {
3030
3033
  const N = R(P);
3031
3034
  S({
@@ -3050,7 +3053,7 @@ function EnableEditor(e) {
3050
3053
  )
3051
3054
  );
3052
3055
  }
3053
- function E(g) {
3056
+ function E(h) {
3054
3057
  i(n + 1), window.addEventListener("message", u), registerInsertMenu(), setupBrowserForEditing({
3055
3058
  ...e.locale ? {
3056
3059
  locale: e.locale
@@ -3063,20 +3066,20 @@ function EnableEditor(e) {
3063
3066
  } : {}
3064
3067
  }), Object.values(
3065
3068
  e.builderContextSignal.componentInfos
3066
- ).forEach((h) => {
3067
- var v;
3068
- const p = createRegisterComponentMessage(h);
3069
- (v = window.parent) == null || v.postMessage(p, "*");
3069
+ ).forEach((b) => {
3070
+ var k;
3071
+ const p = createRegisterComponentMessage(b);
3072
+ (k = window.parent) == null || k.postMessage(p, "*");
3070
3073
  }), window.addEventListener(
3071
3074
  "builder:component:stateChangeListenerActivated",
3072
3075
  w
3073
3076
  );
3074
3077
  }
3075
- function B(g) {
3076
- const h = new URL(location.href).searchParams, p = h.get("builder.preview"), v = h.get(
3078
+ function B(h) {
3079
+ const b = new URL(location.href).searchParams, p = b.get("builder.preview"), k = b.get(
3077
3080
  `builder.preview.${p}`
3078
- ), T = h.get("apiKey") || h.get("builder.space");
3079
- p === e.model && T === e.apiKey && (!e.content || v === e.content.id) && fetchOneEntry({
3081
+ ), T = b.get("apiKey") || b.get("builder.space");
3082
+ p === e.model && T === e.apiKey && (!e.content || k === e.content.id) && fetchOneEntry({
3080
3083
  model: e.model,
3081
3084
  apiKey: e.apiKey,
3082
3085
  apiVersion: e.builderContextSignal.apiVersion
@@ -3085,40 +3088,40 @@ function EnableEditor(e) {
3085
3088
  });
3086
3089
  }
3087
3090
  return useEffect(() => {
3088
- var g;
3089
- return (g = t.current) == null || g.addEventListener(
3091
+ var h;
3092
+ return (h = t.current) == null || h.addEventListener(
3090
3093
  "initeditingbldr",
3091
3094
  E
3092
3095
  ), () => {
3093
- var h;
3094
- return (h = t.current) == null ? void 0 : h.removeEventListener(
3096
+ var b;
3097
+ return (b = t.current) == null ? void 0 : b.removeEventListener(
3095
3098
  "initeditingbldr",
3096
3099
  E
3097
3100
  );
3098
3101
  };
3099
3102
  }, []), useEffect(() => {
3100
- var g;
3101
- return (g = t.current) == null || g.addEventListener(
3103
+ var h;
3104
+ return (h = t.current) == null || h.addEventListener(
3102
3105
  "initpreviewingbldr",
3103
3106
  B
3104
3107
  ), () => {
3105
- var h;
3106
- return (h = t.current) == null ? void 0 : h.removeEventListener(
3108
+ var b;
3109
+ return (b = t.current) == null ? void 0 : b.removeEventListener(
3107
3110
  "initpreviewingbldr",
3108
3111
  B
3109
3112
  );
3110
3113
  };
3111
3114
  }, []), useEffect(() => {
3112
- var g, h;
3115
+ var h, b;
3113
3116
  if (isBrowser()) {
3114
3117
  if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
3115
- const v = (g = e.builderContextSignal.content) == null ? void 0 : g.testVariationId, T = (h = e.builderContextSignal.content) == null ? void 0 : h.id, P = e.apiKey;
3118
+ const k = (h = e.builderContextSignal.content) == null ? void 0 : h.testVariationId, T = (b = e.builderContextSignal.content) == null ? void 0 : b.id, P = e.apiKey;
3116
3119
  _track({
3117
3120
  type: "impression",
3118
3121
  canTrack: !0,
3119
3122
  contentId: T,
3120
3123
  apiKey: P,
3121
- variationId: v !== T ? v : void 0
3124
+ variationId: k !== T ? k : void 0
3122
3125
  });
3123
3126
  }
3124
3127
  isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
@@ -3126,15 +3129,15 @@ function EnableEditor(e) {
3126
3129
  }, []), useEffect(() => {
3127
3130
  e.apiKey || logger.error(
3128
3131
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
3129
- ), y(), k(), w();
3132
+ ), y(), C(), w();
3130
3133
  }, []), useEffect(() => {
3131
3134
  e.content && a(e.content);
3132
3135
  }, [e.content]), useEffect(() => {
3133
3136
  }, [r]), useEffect(() => {
3134
3137
  y();
3135
- }, [(f = (F = e.builderContextSignal.content) == null ? void 0 : F.data) == null ? void 0 : f.jsCode]), useEffect(() => {
3136
- k();
3137
- }, [(A = (C = e.builderContextSignal.content) == null ? void 0 : C.data) == null ? void 0 : A.httpRequests]), useEffect(() => {
3138
+ }, [(g = (F = e.builderContextSignal.content) == null ? void 0 : F.data) == null ? void 0 : g.jsCode]), useEffect(() => {
3139
+ C();
3140
+ }, [(A = (I = e.builderContextSignal.content) == null ? void 0 : I.data) == null ? void 0 : A.httpRequests]), useEffect(() => {
3138
3141
  w();
3139
3142
  }, [e.builderContextSignal.rootState]), useEffect(() => {
3140
3143
  e.data && o(e.data);
@@ -3152,7 +3155,7 @@ function EnableEditor(e) {
3152
3155
  {
3153
3156
  key: n,
3154
3157
  ref: t,
3155
- onClick: (g) => I(g),
3158
+ onClick: (h) => v(h),
3156
3159
  "builder-content-id": (j = e.builderContextSignal.content) == null ? void 0 : j.id,
3157
3160
  "builder-model": e.model,
3158
3161
  ...e.showContent ? {} : {
@@ -3260,22 +3263,22 @@ const getRootStateInitialValue = ({
3260
3263
  meta: e == null ? void 0 : e.meta
3261
3264
  } : void 0;
3262
3265
  function ContentComponent(e) {
3263
- var l, c, u, y, x, d, m;
3266
+ var l, c, u, y, x, m, d;
3264
3267
  const [t, n] = useState(
3265
3268
  () => {
3266
- var b, I;
3269
+ var f, v;
3267
3270
  return getUpdateVariantVisibilityScript({
3268
3271
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3269
- variationId: (b = e.content) == null ? void 0 : b.testVariationId,
3272
+ variationId: (f = e.content) == null ? void 0 : f.testVariationId,
3270
3273
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3271
- contentId: (I = e.content) == null ? void 0 : I.id
3274
+ contentId: (v = e.content) == null ? void 0 : v.id
3272
3275
  });
3273
3276
  }
3274
3277
  );
3275
- function i(b) {
3276
- s((I) => ({
3277
- ...I,
3278
- rootState: b
3278
+ function i(f) {
3279
+ s((v) => ({
3280
+ ...v,
3281
+ rootState: f
3279
3282
  }));
3280
3283
  }
3281
3284
  const [o, a] = useState(
@@ -3283,10 +3286,10 @@ function ContentComponent(e) {
3283
3286
  ...getDefaultRegisteredComponents(),
3284
3287
  ...e.customComponents || []
3285
3288
  ].reduce(
3286
- (b, { component: I, ...R }) => ({
3287
- ...b,
3289
+ (f, { component: v, ...R }) => ({
3290
+ ...f,
3288
3291
  [R.name]: {
3289
- component: I,
3292
+ component: v,
3290
3293
  ...serializeComponentInfo(R)
3291
3294
  }
3292
3295
  }),
@@ -3311,8 +3314,8 @@ function ContentComponent(e) {
3311
3314
  ...getDefaultRegisteredComponents(),
3312
3315
  ...e.customComponents || []
3313
3316
  ].reduce(
3314
- (b, { component: I, ...R }) => ({
3315
- ...b,
3317
+ (f, { component: v, ...R }) => ({
3318
+ ...f,
3316
3319
  [R.name]: serializeComponentInfo(R)
3317
3320
  }),
3318
3321
  {}
@@ -3358,7 +3361,7 @@ function ContentComponent(e) {
3358
3361
  /* @__PURE__ */ jsx(
3359
3362
  Blocks,
3360
3363
  {
3361
- blocks: (m = (d = r.content) == null ? void 0 : d.data) == null ? void 0 : m.blocks,
3364
+ blocks: (d = (m = r.content) == null ? void 0 : m.data) == null ? void 0 : d.blocks,
3362
3365
  context: r,
3363
3366
  registeredComponents: o,
3364
3367
  linkComponent: e.linkComponent