@builder.io/sdk-react-nextjs 0.11.3 → 0.11.5

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 (34) hide show
  1. package/lib/{node/USE_CLIENT_BUNDLE-d5a78124.js → browser/USE_CLIENT_BUNDLE-c1a184f7.js} +189 -174
  2. package/lib/browser/USE_CLIENT_BUNDLE-fd1e8892.cjs +23 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-207cbf86.js → browser/USE_SERVER_BUNDLE-ab38c81e.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-29a862aa.cjs → browser/USE_SERVER_BUNDLE-b4858d5f.cjs} +1 -1
  5. package/lib/browser/{bundle-b781019e.cjs → bundle-c7776ad8.cjs} +3 -3
  6. package/lib/browser/{bundle-062859d6.js → bundle-e5e85e5e.js} +41 -40
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +3 -3
  9. package/lib/{browser/USE_CLIENT_BUNDLE-812d744e.js → edge/USE_CLIENT_BUNDLE-5718fc51.js} +189 -174
  10. package/lib/edge/USE_CLIENT_BUNDLE-e4756b15.cjs +23 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-5a34a612.js → edge/USE_SERVER_BUNDLE-cc60df3b.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-f94a06b5.cjs → edge/USE_SERVER_BUNDLE-e1b937d8.cjs} +1 -1
  13. package/lib/edge/{bundle-24c6dba3.cjs → bundle-66d2c18f.cjs} +3 -3
  14. package/lib/edge/{bundle-52f65e64.js → bundle-8d356121.js} +3 -2
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +3 -3
  17. package/lib/{edge/USE_CLIENT_BUNDLE-dc52931c.js → node/USE_CLIENT_BUNDLE-3ca4914e.js} +189 -174
  18. package/lib/node/USE_CLIENT_BUNDLE-e50e4115.cjs +23 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-7d93f151.js → node/USE_SERVER_BUNDLE-e8cb244e.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-3646ae12.cjs → node/USE_SERVER_BUNDLE-f87d379c.cjs} +1 -1
  21. package/lib/node/{bundle-829842dd.js → bundle-2fa811c7.js} +5 -4
  22. package/lib/node/{bundle-b0598b3a.cjs → bundle-f093f86b.cjs} +3 -3
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +3 -3
  25. package/package.json +5 -97
  26. package/types/cjs/components/content/components/enable-editor.d.ts +1 -1
  27. package/types/cjs/components/content/content.helpers.d.ts +1 -1
  28. package/types/cjs/constants/sdk-version.d.ts +1 -1
  29. package/types/esm/components/content/components/enable-editor.d.ts +1 -1
  30. package/types/esm/components/content/content.helpers.d.ts +1 -1
  31. package/types/esm/constants/sdk-version.d.ts +1 -1
  32. package/lib/browser/USE_CLIENT_BUNDLE-2986f66f.cjs +0 -23
  33. package/lib/edge/USE_CLIENT_BUNDLE-7f127af4.cjs +0 -23
  34. package/lib/node/USE_CLIENT_BUNDLE-c9e8796d.cjs +0 -23
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { jsxs as C, Fragment as m, jsx as i } from "react/jsx-runtime";
3
- import { g as T, a as B, i as E, b as R, c as Y, d as P, e as U, _ as H, f as Z, l as p, h as O, j as ee, k as te, r as ne, s as ie, m as ae, n as ce, o as re } from "./bundle-062859d6.js";
4
- import { useRef as N, useState as k, useEffect as v, createContext as oe, createElement as le } from "react";
5
- import { p as de } from "./USE_SERVER_BUNDLE-7d93f151.js";
2
+ import { jsxs as w, Fragment as g, jsx as i } from "react/jsx-runtime";
3
+ import { g as T, a as B, i as E, b as R, c as Y, d as P, e as U, _ as H, f as Z, l as p, h as O, j as ee, k as te, r as ne, s as ie, m as ae, n as ce, o as le } from "./bundle-8d356121.js";
4
+ import { useRef as N, useState as v, useEffect as b, createContext as oe, createElement as re } from "react";
5
+ import { p as de } from "./USE_SERVER_BUNDLE-cc60df3b.js";
6
6
  import { useRouter as se } from "next/navigation";
7
- function Se(e) {
8
- return /* @__PURE__ */ C(m, { children: [
9
- e.link ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
7
+ function xe(e) {
8
+ return /* @__PURE__ */ w(g, { children: [
9
+ e.link ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
10
10
  "a",
11
11
  {
12
12
  ...e.attributes,
@@ -15,7 +15,7 @@ function Se(e) {
15
15
  role: "button",
16
16
  children: e.text
17
17
  }
18
- ) }) : /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
18
+ ) }) : /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
19
19
  "button",
20
20
  {
21
21
  ...e.attributes,
@@ -29,10 +29,10 @@ function Se(e) {
29
29
  }` })
30
30
  ] });
31
31
  }
32
- function xe(e) {
33
- return /* @__PURE__ */ C(m, { children: [
32
+ function ve(e) {
33
+ return /* @__PURE__ */ w(g, { children: [
34
34
  " ",
35
- e.hasChildren ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ C(
35
+ e.hasChildren ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ w(
36
36
  e.Wrapper,
37
37
  {
38
38
  ...T({
@@ -53,7 +53,7 @@ function xe(e) {
53
53
  " "
54
54
  ]
55
55
  }
56
- ) }) : /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
56
+ ) }) : /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
57
57
  e.Wrapper,
58
58
  {
59
59
  ...T({
@@ -73,7 +73,7 @@ function xe(e) {
73
73
  " "
74
74
  ] });
75
75
  }
76
- function ve(e) {
76
+ function ye(e) {
77
77
  return /* @__PURE__ */ i(
78
78
  e.Wrapper,
79
79
  {
@@ -95,14 +95,14 @@ function ve(e) {
95
95
  }
96
96
  );
97
97
  }
98
- function ye(e) {
99
- function a() {
98
+ function ke(e) {
99
+ function c() {
100
100
  var o;
101
101
  return "builder-blocks" + ((o = e.blocks) != null && o.length ? "" : " no-blocks");
102
102
  }
103
103
  function s() {
104
- var o, h;
105
- E() && !((o = e.blocks) != null && o.length) && ((h = window.parent) == null || h.postMessage(
104
+ var o, u;
105
+ E() && !((o = e.blocks) != null && o.length) && ((u = window.parent) == null || u.postMessage(
106
106
  {
107
107
  type: "builder.clickEmptyBlocks",
108
108
  data: {
@@ -113,9 +113,9 @@ function ye(e) {
113
113
  "*"
114
114
  ));
115
115
  }
116
- function b() {
117
- var o, h;
118
- E() && !((o = e.blocks) != null && o.length) && ((h = window.parent) == null || h.postMessage(
116
+ function x() {
117
+ var o, u;
118
+ E() && !((o = e.blocks) != null && o.length) && ((u = window.parent) == null || u.postMessage(
119
119
  {
120
120
  type: "builder.hoverEmptyBlocks",
121
121
  data: {
@@ -126,16 +126,16 @@ function ye(e) {
126
126
  "*"
127
127
  ));
128
128
  }
129
- return /* @__PURE__ */ C(m, { children: [
129
+ return /* @__PURE__ */ w(g, { children: [
130
130
  /* @__PURE__ */ i(
131
131
  e.BlocksWrapper,
132
132
  {
133
- className: a() + " props-blocks-wrapper-4f2c12d8",
133
+ className: c() + " props-blocks-wrapper-4f2c12d8",
134
134
  "builder-path": e.path,
135
135
  "builder-parent-id": e.parent,
136
136
  style: e.styleProp,
137
137
  onClick: (o) => s(),
138
- onMouseEnter: (o) => b(),
138
+ onMouseEnter: (o) => x(),
139
139
  onKeyPress: (o) => s(),
140
140
  ...e.BlocksWrapperProps,
141
141
  children: e.children
@@ -148,30 +148,30 @@ function ye(e) {
148
148
  }` })
149
149
  ] });
150
150
  }
151
- function ke(e) {
151
+ function Ce(e) {
152
152
  return /* @__PURE__ */ i("span", { children: e.children });
153
153
  }
154
- function Ce(e) {
155
- var o, h, S, x;
156
- function a() {
157
- var g;
158
- const c = e.image || e.src;
159
- if (!c || // We can auto add srcset for cdn.builder.io and shopify
154
+ function we(e) {
155
+ var o, u, S, y;
156
+ function c() {
157
+ var m;
158
+ const r = e.image || e.src;
159
+ if (!r || // We can auto add srcset for cdn.builder.io and shopify
160
160
  // images, otherwise you can supply this prop manually
161
- !(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
161
+ !(r.match(/builder\.io/) || r.match(/cdn\.shopify\.com/)))
162
162
  return e.srcset;
163
- if (e.srcset && ((g = e.image) != null && g.includes("builder.io/api/v1/image"))) {
163
+ if (e.srcset && ((m = e.image) != null && m.includes("builder.io/api/v1/image"))) {
164
164
  if (!e.srcset.includes(e.image.split("?")[0]))
165
- return console.debug("Removed given srcset"), R(c);
165
+ return console.debug("Removed given srcset"), R(r);
166
166
  } else if (e.image && !e.srcset)
167
- return R(c);
168
- return R(c);
167
+ return R(r);
168
+ return R(r);
169
169
  }
170
170
  function s() {
171
171
  var f;
172
- return (f = a == null ? void 0 : a()) != null && f.match(/builder\.io/) && !e.noWebp ? a().replace(/\?/g, "?format=webp&") : "";
172
+ return (f = c == null ? void 0 : c()) != null && f.match(/builder\.io/) && !e.noWebp ? c().replace(/\?/g, "?format=webp&") : "";
173
173
  }
174
- function b() {
174
+ function x() {
175
175
  const f = {
176
176
  position: "absolute",
177
177
  height: "100%",
@@ -181,10 +181,10 @@ function Ce(e) {
181
181
  };
182
182
  return e.aspectRatio ? f : void 0;
183
183
  }
184
- return /* @__PURE__ */ C(m, { children: [
185
- /* @__PURE__ */ C(m, { children: [
186
- /* @__PURE__ */ C("picture", { children: [
187
- s() ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i("source", { type: "image/webp", srcSet: s() }) }) : null,
184
+ return /* @__PURE__ */ w(g, { children: [
185
+ /* @__PURE__ */ w(g, { children: [
186
+ /* @__PURE__ */ w("picture", { children: [
187
+ s() ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i("source", { type: "image/webp", srcSet: s() }) }) : null,
188
188
  /* @__PURE__ */ i(
189
189
  "img",
190
190
  {
@@ -194,16 +194,16 @@ function Ce(e) {
194
194
  style: {
195
195
  objectPosition: e.backgroundPosition || "center",
196
196
  objectFit: e.backgroundSize || "cover",
197
- ...b()
197
+ ...x()
198
198
  },
199
199
  className: "builder-image" + (e.className ? " " + e.className : "") + " img-40c70c9b",
200
200
  src: e.image,
201
- srcSet: a(),
201
+ srcSet: c(),
202
202
  sizes: e.sizes
203
203
  }
204
204
  )
205
205
  ] }),
206
- e.aspectRatio && !((h = (o = e.builderBlock) == null ? void 0 : o.children) != null && h.length && e.fitContent) ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
206
+ e.aspectRatio && !((u = (o = e.builderBlock) == null ? void 0 : o.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
207
207
  "div",
208
208
  {
209
209
  className: "builder-image-sizer div-40c70c9b",
@@ -212,8 +212,8 @@ function Ce(e) {
212
212
  }
213
213
  }
214
214
  ) }) : null,
215
- (x = (S = e.builderBlock) == null ? void 0 : S.children) != null && x.length && e.fitContent ? /* @__PURE__ */ i(m, { children: e.children }) : null,
216
- !e.fitContent && e.children ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
215
+ (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(g, { children: e.children }) : null,
216
+ !e.fitContent && e.children ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
217
217
  ] }),
218
218
  /* @__PURE__ */ i("style", { children: `.img-40c70c9b {
219
219
  opacity: 1;
@@ -234,7 +234,7 @@ function Ce(e) {
234
234
  }` })
235
235
  ] });
236
236
  }
237
- function we(e) {
237
+ function Ee(e) {
238
238
  return /* @__PURE__ */ i(
239
239
  "section",
240
240
  {
@@ -255,76 +255,76 @@ function we(e) {
255
255
  }
256
256
  );
257
257
  }
258
- function Ee(e) {
259
- const a = N(null), [s, b] = k(() => []), [o, h] = k(() => []);
260
- return v(() => {
261
- var x;
262
- if (!((x = a.current) != null && x.getElementsByTagName) || typeof window > "u")
258
+ function Ie(e) {
259
+ const c = N(null), [s, x] = v(() => []), [o, u] = v(() => []);
260
+ return b(() => {
261
+ var y;
262
+ if (!((y = c.current) != null && y.getElementsByTagName) || typeof window > "u")
263
263
  return;
264
- const S = a.current.getElementsByTagName("script");
264
+ const S = c.current.getElementsByTagName("script");
265
265
  for (let f = 0; f < S.length; f++) {
266
- const c = S[f];
267
- if (c.src) {
268
- if (s.includes(c.src))
266
+ const r = S[f];
267
+ if (r.src) {
268
+ if (s.includes(r.src))
269
269
  continue;
270
- s.push(c.src);
271
- const g = document.createElement("script");
272
- g.async = !0, g.src = c.src, document.head.appendChild(g);
273
- } else if (!c.type || [
270
+ s.push(r.src);
271
+ const m = document.createElement("script");
272
+ m.async = !0, m.src = r.src, document.head.appendChild(m);
273
+ } else if (!r.type || [
274
274
  "text/javascript",
275
275
  "application/javascript",
276
276
  "application/ecmascript"
277
- ].includes(c.type)) {
278
- if (o.includes(c.innerText))
277
+ ].includes(r.type)) {
278
+ if (o.includes(r.innerText))
279
279
  continue;
280
280
  try {
281
- o.push(c.innerText), new Function(c.innerText)();
282
- } catch (g) {
283
- console.warn("`CustomCode`: Error running script:", g);
281
+ o.push(r.innerText), new Function(r.innerText)();
282
+ } catch (m) {
283
+ console.warn("`CustomCode`: Error running script:", m);
284
284
  }
285
285
  }
286
286
  }
287
287
  }, []), /* @__PURE__ */ i(
288
288
  "div",
289
289
  {
290
- ref: a,
290
+ ref: c,
291
291
  className: "builder-custom-code" + (e.replaceNodes ? " replace-nodes" : ""),
292
292
  dangerouslySetInnerHTML: { __html: e.code }
293
293
  }
294
294
  );
295
295
  }
296
- function Ie(e) {
297
- const a = N(null), [s, b] = k(() => []), [o, h] = k(() => []), [S, x] = k(() => !1);
296
+ function Re(e) {
297
+ const c = N(null), [s, x] = v(() => []), [o, u] = v(() => []), [S, y] = v(() => !1);
298
298
  function f() {
299
- if (!a.current || !a.current.getElementsByTagName)
299
+ if (!c.current || !c.current.getElementsByTagName)
300
300
  return;
301
- const c = a.current.getElementsByTagName("script");
302
- for (let g = 0; g < c.length; g++) {
303
- const y = c[g];
304
- if (y.src && !s.includes(y.src)) {
305
- s.push(y.src);
306
- const w = document.createElement("script");
307
- w.async = !0, w.src = y.src, document.head.appendChild(w);
308
- } else if (Y(y) && !o.includes(y.innerText))
301
+ const r = c.current.getElementsByTagName("script");
302
+ for (let m = 0; m < r.length; m++) {
303
+ const k = r[m];
304
+ if (k.src && !s.includes(k.src)) {
305
+ s.push(k.src);
306
+ const C = document.createElement("script");
307
+ C.async = !0, C.src = k.src, document.head.appendChild(C);
308
+ } else if (Y(k) && !o.includes(k.innerText))
309
309
  try {
310
- o.push(y.innerText), new Function(y.innerText)();
311
- } catch (w) {
312
- console.warn("`Embed`: Error running script:", w);
310
+ o.push(k.innerText), new Function(k.innerText)();
311
+ } catch (C) {
312
+ console.warn("`Embed`: Error running script:", C);
313
313
  }
314
314
  }
315
315
  }
316
- return v(() => {
317
- a.current && !S && (x(!0), f());
318
- }, [a.current, S]), /* @__PURE__ */ i(
316
+ return b(() => {
317
+ c.current && !S && (y(!0), f());
318
+ }, [c.current, S]), /* @__PURE__ */ i(
319
319
  "div",
320
320
  {
321
321
  className: "builder-embed",
322
- ref: a,
322
+ ref: c,
323
323
  dangerouslySetInnerHTML: { __html: e.content }
324
324
  }
325
325
  );
326
326
  }
327
- function Re(e) {
327
+ function Pe(e) {
328
328
  return /* @__PURE__ */ i(
329
329
  "img",
330
330
  {
@@ -339,9 +339,9 @@ function Re(e) {
339
339
  E() && e.imgSrc || "default-key"
340
340
  );
341
341
  }
342
- function Pe(e) {
343
- var b, o, h, S, x, f, c;
344
- function a() {
342
+ function Te(e) {
343
+ var x, o, u, S, y, f, r;
344
+ function c() {
345
345
  return {
346
346
  ...e.autoPlay === !0 ? {
347
347
  autoPlay: !0
@@ -362,10 +362,10 @@ function Pe(e) {
362
362
  }
363
363
  function s() {
364
364
  return {
365
- ...a()
365
+ ...c()
366
366
  };
367
367
  }
368
- return /* @__PURE__ */ C(
368
+ return /* @__PURE__ */ w(
369
369
  "div",
370
370
  {
371
371
  style: {
@@ -381,7 +381,7 @@ function Pe(e) {
381
381
  style: {
382
382
  width: "100%",
383
383
  height: "100%",
384
- ...(b = e.attributes) == null ? void 0 : b.style,
384
+ ...(x = e.attributes) == null ? void 0 : x.style,
385
385
  objectFit: e.fit,
386
386
  objectPosition: e.position,
387
387
  // Hack to get object fit to work as expected and
@@ -397,7 +397,7 @@ function Pe(e) {
397
397
  children: e.lazyLoad ? null : /* @__PURE__ */ i("source", { type: "video/mp4", src: e.video })
398
398
  }
399
399
  ),
400
- e.aspectRatio && !(e.fitContent && ((h = (o = e.builderBlock) == null ? void 0 : o.children) != null && h.length)) ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
400
+ e.aspectRatio && !(e.fitContent && ((u = (o = e.builderBlock) == null ? void 0 : o.children) != null && u.length)) ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
401
401
  "div",
402
402
  {
403
403
  style: {
@@ -408,7 +408,7 @@ function Pe(e) {
408
408
  }
409
409
  }
410
410
  ) }) : null,
411
- (x = (S = e.builderBlock) == null ? void 0 : S.children) != null && x.length && e.fitContent ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
411
+ (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
412
412
  "div",
413
413
  {
414
414
  style: {
@@ -419,7 +419,7 @@ function Pe(e) {
419
419
  children: e.children
420
420
  }
421
421
  ) }) : null,
422
- (c = (f = e.builderBlock) == null ? void 0 : f.children) != null && c.length && !e.fitContent ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(
422
+ (r = (f = e.builderBlock) == null ? void 0 : f.children) != null && r.length && !e.fitContent ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
423
423
  "div",
424
424
  {
425
425
  style: {
@@ -454,22 +454,31 @@ const ue = oe({
454
454
  BlocksWrapper: "div",
455
455
  BlocksWrapperProps: {}
456
456
  });
457
- function Te(e) {
457
+ function Be(e) {
458
458
  var F, z, M, _, V, q, A;
459
- const a = N(null), [s, b] = k(() => 0);
459
+ const c = N(null), [s, x] = v(() => 0);
460
+ v(() => !0);
460
461
  function o(t) {
461
- var r, l, d, u, D;
462
+ var a, l;
463
+ const n = {
464
+ ...e.builderContextSignal.rootState,
465
+ ...t
466
+ };
467
+ e.builderContextSignal.rootSetState ? (l = (a = e.builderContextSignal).rootSetState) == null || l.call(a, n) : e.builderContextSignal.rootState = n;
468
+ }
469
+ function u(t) {
470
+ var a, l, d, h, D;
462
471
  const n = {
463
472
  ...e.builderContextSignal.content,
464
473
  ...t,
465
474
  data: {
466
- ...(r = e.builderContextSignal.content) == null ? void 0 : r.data,
475
+ ...(a = e.builderContextSignal.content) == null ? void 0 : a.data,
467
476
  ...t == null ? void 0 : t.data
468
477
  },
469
478
  meta: {
470
479
  ...(l = e.builderContextSignal.content) == null ? void 0 : l.meta,
471
480
  ...t == null ? void 0 : t.meta,
472
- breakpoints: ((d = t == null ? void 0 : t.meta) == null ? void 0 : d.breakpoints) || ((D = (u = e.builderContextSignal.content) == null ? void 0 : u.meta) == null ? void 0 : D.breakpoints)
481
+ breakpoints: ((d = t == null ? void 0 : t.meta) == null ? void 0 : d.breakpoints) || ((D = (h = e.builderContextSignal.content) == null ? void 0 : h.meta) == null ? void 0 : D.breakpoints)
473
482
  }
474
483
  };
475
484
  de({
@@ -479,38 +488,38 @@ function Te(e) {
479
488
  X.refresh();
480
489
  });
481
490
  }
482
- k(() => 0);
483
- const [h, S] = k(
491
+ v(() => 0);
492
+ const [S, y] = v(
484
493
  () => !1
485
- ), [x, f] = k(
494
+ ), [f, r] = v(
486
495
  () => e.contentWrapper || "div"
487
496
  );
488
- function c(t) {
489
- var r;
497
+ function m(t) {
498
+ var a;
490
499
  const { data: n } = t;
491
500
  if (n)
492
501
  switch (n.type) {
493
502
  case "builder.configureSdk": {
494
- const l = n.data, { breakpoints: d, contentId: u } = l;
495
- if (!u || u !== ((r = e.builderContextSignal.content) == null ? void 0 : r.id))
503
+ const l = n.data, { breakpoints: d, contentId: h } = l;
504
+ if (!h || h !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id))
496
505
  return;
497
- d && o({
506
+ d && u({
498
507
  meta: {
499
508
  breakpoints: d
500
509
  }
501
- }), b(s + 1);
510
+ }), x(s + 1);
502
511
  break;
503
512
  }
504
513
  case "builder.contentUpdate": {
505
- const l = n.data, d = l.key || l.alias || l.entry || l.modelName, u = l.data;
506
- d === e.model && (o(u), b(s + 1));
514
+ const l = n.data, d = l.key || l.alias || l.entry || l.modelName, h = l.data;
515
+ d === e.model && (u(h), x(s + 1));
507
516
  break;
508
517
  }
509
518
  }
510
519
  }
511
- function g() {
512
- var n, r;
513
- const t = (r = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : r.jsCode;
520
+ function k() {
521
+ var n, a;
522
+ const t = (a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.jsCode;
514
523
  t && O({
515
524
  code: t,
516
525
  context: e.context || {},
@@ -519,11 +528,11 @@ function Te(e) {
519
528
  rootSetState: e.builderContextSignal.rootSetState
520
529
  });
521
530
  }
522
- const [y, w] = k(() => ({})), [L, J] = k(() => !1);
531
+ const [C, me] = v(() => ({})), [L, J] = v(() => !1);
523
532
  function $(t) {
524
- var n, r;
533
+ var n, a;
525
534
  if (e.builderContextSignal.content) {
526
- const l = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (r = e.builderContextSignal.content) == null ? void 0 : r.id;
535
+ const l = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
527
536
  H({
528
537
  type: "click",
529
538
  canTrack: U(e.canTrack),
@@ -539,8 +548,8 @@ function Te(e) {
539
548
  function G(t) {
540
549
  return t.replace(
541
550
  /{{([^}]+)}}/g,
542
- (n, r) => O({
543
- code: r,
551
+ (n, a) => O({
552
+ code: a,
544
553
  context: e.context || {},
545
554
  localState: void 0,
546
555
  rootState: e.builderContextSignal.rootState,
@@ -549,25 +558,25 @@ function Te(e) {
549
558
  );
550
559
  }
551
560
  function Q({ url: t, key: n }) {
552
- re(t).then((r) => r.json()).then((r) => {
553
- var d, u;
561
+ le(t).then((a) => a.json()).then((a) => {
562
+ var d, h;
554
563
  const l = {
555
564
  ...e.builderContextSignal.rootState,
556
- [n]: r
565
+ [n]: a
557
566
  };
558
- (u = (d = e.builderContextSignal).rootSetState) == null || u.call(d, l), y[n] = !0;
559
- }).catch((r) => {
560
- console.error("error fetching dynamic data", t, r);
567
+ (h = (d = e.builderContextSignal).rootSetState) == null || h.call(d, l), C[n] = !0;
568
+ }).catch((a) => {
569
+ console.error("error fetching dynamic data", t, a);
561
570
  });
562
571
  }
563
572
  function j() {
564
- var n, r;
565
- const t = ((r = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : r.httpRequests) ?? {};
573
+ var n, a;
574
+ const t = ((a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.httpRequests) ?? {};
566
575
  Object.entries(t).forEach(([l, d]) => {
567
- if (d && (!y[l] || E())) {
568
- const u = G(d);
576
+ if (d && (!C[l] || E())) {
577
+ const h = G(d);
569
578
  Q({
570
- url: u,
579
+ url: h,
571
580
  key: l
572
581
  });
573
582
  }
@@ -589,7 +598,7 @@ function Te(e) {
589
598
  );
590
599
  }
591
600
  function W(t) {
592
- b(s + 1), window.addEventListener("message", c), ne(), ie({
601
+ x(s + 1), window.addEventListener("message", m), ne(), ie({
593
602
  ...e.locale ? {
594
603
  locale: e.locale
595
604
  } : {},
@@ -603,91 +612,97 @@ function Te(e) {
603
612
  e.builderContextSignal.componentInfos
604
613
  ).forEach((n) => {
605
614
  var l;
606
- const r = ae(n);
607
- (l = window.parent) == null || l.postMessage(r, "*");
615
+ const a = ae(n);
616
+ (l = window.parent) == null || l.postMessage(a, "*");
608
617
  }), window.addEventListener(
609
618
  "builder:component:stateChangeListenerActivated",
610
619
  I
611
620
  );
612
621
  }
613
622
  function K(t) {
614
- const n = new URL(location.href).searchParams, r = n.get("builder.preview"), l = n.get(
615
- `builder.preview.${r}`
623
+ const n = new URL(location.href).searchParams, a = n.get("builder.preview"), l = n.get(
624
+ `builder.preview.${a}`
616
625
  ), d = n.get("apiKey") || n.get("builder.space");
617
- r === e.model && d === e.apiKey && (!e.content || l === e.content.id) && ce({
626
+ a === e.model && d === e.apiKey && (!e.content || l === e.content.id) && ce({
618
627
  model: e.model,
619
628
  apiKey: e.apiKey,
620
629
  apiVersion: e.builderContextSignal.apiVersion
621
- }).then((u) => {
622
- u && o(u);
630
+ }).then((h) => {
631
+ h && u(h);
623
632
  });
624
633
  }
625
634
  const X = se();
626
- return v(() => {
635
+ return b(() => {
627
636
  var t;
628
- return (t = a.current) == null || t.addEventListener(
637
+ return (t = c.current) == null || t.addEventListener(
629
638
  "initeditingbldr",
630
639
  W
631
640
  ), () => {
632
641
  var n;
633
- return (n = a.current) == null ? void 0 : n.removeEventListener(
642
+ return (n = c.current) == null ? void 0 : n.removeEventListener(
634
643
  "initeditingbldr",
635
644
  W
636
645
  );
637
646
  };
638
- }, []), v(() => {
647
+ }, []), b(() => {
639
648
  var t;
640
- return (t = a.current) == null || t.addEventListener(
649
+ return (t = c.current) == null || t.addEventListener(
641
650
  "initpreviewingbldr",
642
651
  K
643
652
  ), () => {
644
653
  var n;
645
- return (n = a.current) == null ? void 0 : n.removeEventListener(
654
+ return (n = c.current) == null ? void 0 : n.removeEventListener(
646
655
  "initpreviewingbldr",
647
656
  K
648
657
  );
649
658
  };
650
- }, []), v(() => {
659
+ }, []), b(() => {
651
660
  var t, n;
652
661
  if (P()) {
653
- if (E() && a.current && a.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && U(e.canTrack)) {
654
- const l = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, d = (n = e.builderContextSignal.content) == null ? void 0 : n.id, u = e.apiKey;
662
+ if (E() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && U(e.canTrack)) {
663
+ const l = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, d = (n = e.builderContextSignal.content) == null ? void 0 : n.id, h = e.apiKey;
655
664
  H({
656
665
  type: "impression",
657
666
  canTrack: !0,
658
667
  contentId: d,
659
- apiKey: u,
668
+ apiKey: h,
660
669
  variationId: l !== d ? l : void 0
661
670
  });
662
671
  }
663
- Z() && a.current;
672
+ Z() && c.current;
664
673
  }
665
- }, []), v(() => {
674
+ }, []), b(() => {
666
675
  e.apiKey || p.error(
667
676
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
668
- ), g(), j(), I();
669
- }, []), v(() => {
670
- }, [e.content]), v(() => {
671
- P() && (window.removeEventListener("message", c), window.addEventListener("message", c));
672
- }, [h]), v(() => {
673
- g();
677
+ ), k(), j(), I();
678
+ }, []), b(() => {
679
+ }, [e.content]), b(() => {
680
+ P() && (window.removeEventListener("message", m), window.addEventListener("message", m));
681
+ }, [S]), b(() => {
682
+ k();
674
683
  }, [
675
684
  (z = (F = e.builderContextSignal.content) == null ? void 0 : F.data) == null ? void 0 : z.jsCode,
676
685
  e.builderContextSignal.rootState
677
- ]), v(() => {
686
+ ]), b(() => {
678
687
  j();
679
- }, [(_ = (M = e.builderContextSignal.content) == null ? void 0 : M.data) == null ? void 0 : _.httpRequests]), v(() => {
688
+ }, [(_ = (M = e.builderContextSignal.content) == null ? void 0 : M.data) == null ? void 0 : _.httpRequests]), b(() => {
680
689
  I();
681
- }, [e.builderContextSignal.rootState]), v(() => () => {
682
- P() && (window.removeEventListener("message", c), window.removeEventListener(
690
+ }, [e.builderContextSignal.rootState]), b(() => {
691
+ e.data && o(e.data);
692
+ }, [e.data]), b(() => {
693
+ e.locale && o({
694
+ locale: e.locale
695
+ });
696
+ }, [e.locale]), b(() => () => {
697
+ P() && (window.removeEventListener("message", m), window.removeEventListener(
683
698
  "builder:component:stateChangeListenerActivated",
684
699
  I
685
700
  ));
686
- }, []), /* @__PURE__ */ i(ue.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(m, { children: /* @__PURE__ */ le(
687
- x,
701
+ }, []), /* @__PURE__ */ i(ue.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ re(
702
+ f,
688
703
  {
689
704
  key: s,
690
- ref: a,
705
+ ref: c,
691
706
  onClick: (t) => $(t),
692
707
  "builder-content-id": (V = e.builderContextSignal.content) == null ? void 0 : V.id,
693
708
  "builder-model": e.model,
@@ -702,16 +717,16 @@ function Te(e) {
702
717
  ) }) : null });
703
718
  }
704
719
  export {
705
- xe as B,
706
- Ee as C,
707
- Ie as E,
708
- ke as F,
709
- ve as I,
710
- we as S,
711
- Pe as V,
712
- ye as a,
713
- Se as b,
714
- Ce as c,
715
- Re as d,
716
- Te as e
720
+ ve as B,
721
+ Ie as C,
722
+ Re as E,
723
+ Ce as F,
724
+ ye as I,
725
+ Ee as S,
726
+ Te as V,
727
+ ke as a,
728
+ xe as b,
729
+ we as c,
730
+ Pe as d,
731
+ Be as e
717
732
  };