@builder.io/sdk-react-nextjs 0.12.6 → 0.12.8

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 (42) hide show
  1. package/lib/browser/{USE_CLIENT_BUNDLE-4d4e23b4.js → USE_CLIENT_BUNDLE-164b0828.js} +193 -195
  2. package/lib/browser/USE_CLIENT_BUNDLE-a350a268.cjs +21 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-fda604b6.js → browser/USE_SERVER_BUNDLE-5219d3fc.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-19879780.cjs → browser/USE_SERVER_BUNDLE-b1e8364e.cjs} +1 -1
  5. package/lib/browser/{bundle-6e21e129.cjs → bundle-f375f07b.cjs} +21 -21
  6. package/lib/browser/{bundle-b3104268.js → bundle-f83a1ca5.js} +537 -447
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +23 -22
  9. package/lib/{node/USE_CLIENT_BUNDLE-aa8ab44a.js → edge/USE_CLIENT_BUNDLE-b8d07605.js} +193 -195
  10. package/lib/edge/USE_CLIENT_BUNDLE-f1ccd54b.cjs +21 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-cbcb1baf.cjs → edge/USE_SERVER_BUNDLE-2e4c0a0a.cjs} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-2fdc522e.js → edge/USE_SERVER_BUNDLE-cd7a6238.js} +1 -1
  13. package/lib/edge/{bundle-ee1ebe27.js → bundle-3da03df6.js} +574 -484
  14. package/lib/edge/{bundle-f2d4a6db.cjs → bundle-5b207761.cjs} +29 -29
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +23 -22
  17. package/lib/{edge/USE_CLIENT_BUNDLE-41ee32e4.js → node/USE_CLIENT_BUNDLE-e0108fb4.js} +193 -195
  18. package/lib/node/USE_CLIENT_BUNDLE-e31c74cc.cjs +21 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-ccca985e.cjs → node/USE_SERVER_BUNDLE-29398256.cjs} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-2bf0dc28.js → node/USE_SERVER_BUNDLE-3e951ab1.js} +1 -1
  21. package/lib/node/{bundle-99e5b33f.js → bundle-6c5cef2d.js} +268 -178
  22. package/lib/node/{bundle-c799b7fc.cjs → bundle-83186530.cjs} +9 -9
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +23 -22
  25. package/package.json +1 -1
  26. package/types/cjs/components/block/animator.d.ts +5 -0
  27. package/types/cjs/components/content-variants/helpers.d.ts +1 -1
  28. package/types/cjs/constants/sdk-version.d.ts +1 -1
  29. package/types/cjs/helpers/preview-lru-cache/get.d.ts +1 -1
  30. package/types/cjs/helpers/subscribe-to-editor.d.ts +35 -0
  31. package/types/cjs/server-index.d.ts +18 -3
  32. package/types/cjs/types/builder-block.d.ts +18 -1
  33. package/types/esm/components/block/animator.d.ts +5 -0
  34. package/types/esm/components/content-variants/helpers.d.ts +1 -1
  35. package/types/esm/constants/sdk-version.d.ts +1 -1
  36. package/types/esm/helpers/preview-lru-cache/get.d.ts +1 -1
  37. package/types/esm/helpers/subscribe-to-editor.d.ts +35 -0
  38. package/types/esm/server-index.d.ts +18 -3
  39. package/types/esm/types/builder-block.d.ts +18 -1
  40. package/lib/browser/USE_CLIENT_BUNDLE-e5d64246.cjs +0 -21
  41. package/lib/edge/USE_CLIENT_BUNDLE-cc55e91d.cjs +0 -21
  42. package/lib/node/USE_CLIENT_BUNDLE-343cb348.cjs +0 -21
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as i, Fragment as h, jsxs as E } from "react/jsx-runtime";
3
- import { i as p, g as D, a as $, b as O, c as w, d as R, e as ee, f as P, h as H, _ as V, j as te, l as ne, k as ie, m as U, n as ae, o as ce, r as re, s as le, p as oe, q as de, t as se } from "./bundle-99e5b33f.js";
4
- import { useRef as T, useState as x, useEffect as f, createContext as ue, createElement as me } from "react";
5
- import { p as ge } from "./USE_SERVER_BUNDLE-2fdc522e.js";
3
+ import { i as p, g as H, a as $, b as O, c as w, d as R, e as ee, f as P, h as V, _ as D, j as te, l as ne, k as ie, t as ae, m as U, n as ce, o as re, r as le, s as oe, p as de, q as se, u as ue } from "./bundle-3da03df6.js";
4
+ import { useRef as T, useState as x, useEffect as b, createContext as me, createElement as ge } from "react";
5
+ import { p as he } from "./USE_SERVER_BUNDLE-cd7a6238.js";
6
6
  import { useRouter as be } from "next/navigation";
7
7
  function J(e) {
8
8
  return /* @__PURE__ */ i(h, { children: p(e.TagName) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ i(h, { children: typeof e.TagName == "string" ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
9
9
  }
10
- function Ce(e) {
10
+ function we(e) {
11
11
  return /* @__PURE__ */ i(
12
12
  J,
13
13
  {
14
14
  TagName: e.link ? e.builderLinkComponent || "a" : "button",
15
15
  attributes: {
16
16
  ...e.attributes,
17
- [D()]: `${e.link ? "" : "builder-button"} ${e.attributes[D()] || ""}`,
17
+ [H()]: `${e.link ? "" : "builder-button"} ${e.attributes[H()] || ""}`,
18
18
  ...e.link ? {
19
19
  href: e.link,
20
20
  target: e.openLinkInNewTab ? "_blank" : void 0,
@@ -28,7 +28,7 @@ function Ce(e) {
28
28
  }
29
29
  );
30
30
  }
31
- function we(e) {
31
+ function Ee(e) {
32
32
  return /* @__PURE__ */ i(
33
33
  J,
34
34
  {
@@ -49,7 +49,7 @@ function we(e) {
49
49
  }
50
50
  );
51
51
  }
52
- function Ee(e) {
52
+ function Ie(e) {
53
53
  return /* @__PURE__ */ i(
54
54
  e.Wrapper,
55
55
  {
@@ -71,14 +71,14 @@ function Ee(e) {
71
71
  }
72
72
  );
73
73
  }
74
- function Ie(e) {
74
+ function Re(e) {
75
75
  function c() {
76
- var l;
77
- return "builder-blocks" + ((l = e.blocks) != null && l.length ? "" : " no-blocks");
76
+ var r;
77
+ return "builder-blocks" + ((r = e.blocks) != null && r.length ? "" : " no-blocks");
78
78
  }
79
79
  function s() {
80
- var l, u;
81
- w() && !((l = e.blocks) != null && l.length) && ((u = window.parent) == null || u.postMessage(
80
+ var r, u;
81
+ w() && !((r = e.blocks) != null && r.length) && ((u = window.parent) == null || u.postMessage(
82
82
  {
83
83
  type: "builder.clickEmptyBlocks",
84
84
  data: {
@@ -89,9 +89,9 @@ function Ie(e) {
89
89
  "*"
90
90
  ));
91
91
  }
92
- function v() {
93
- var l, u;
94
- w() && !((l = e.blocks) != null && l.length) && ((u = window.parent) == null || u.postMessage(
92
+ function S() {
93
+ var r, u;
94
+ w() && !((r = e.blocks) != null && r.length) && ((u = window.parent) == null || u.postMessage(
95
95
  {
96
96
  type: "builder.hoverEmptyBlocks",
97
97
  data: {
@@ -110,9 +110,9 @@ function Ie(e) {
110
110
  "builder-path": e.path,
111
111
  "builder-parent-id": e.parent,
112
112
  style: e.styleProp,
113
- onClick: (l) => s(),
114
- onMouseEnter: (l) => v(),
115
- onKeyPress: (l) => s(),
113
+ onClick: (r) => s(),
114
+ onMouseEnter: (r) => S(),
115
+ onKeyPress: (r) => s(),
116
116
  ...e.BlocksWrapperProps,
117
117
  children: e.children
118
118
  }
@@ -124,38 +124,38 @@ function Ie(e) {
124
124
  }` })
125
125
  ] });
126
126
  }
127
- function Re(e) {
127
+ function Pe(e) {
128
128
  return /* @__PURE__ */ i("span", { children: e.children });
129
129
  }
130
- function Pe(e) {
131
- var l, u, S, y;
130
+ function Te(e) {
131
+ var r, u, f, y;
132
132
  function c() {
133
133
  var m;
134
- const o = e.image || e.src;
135
- if (!o || // We can auto add srcset for cdn.builder.io and shopify
134
+ const l = e.image || e.src;
135
+ if (!l || // We can auto add srcset for cdn.builder.io and shopify
136
136
  // images, otherwise you can supply this prop manually
137
- !(o.match(/builder\.io/) || o.match(/cdn\.shopify\.com/)))
137
+ !(l.match(/builder\.io/) || l.match(/cdn\.shopify\.com/)))
138
138
  return e.srcset;
139
139
  if (e.srcset && ((m = e.image) != null && m.includes("builder.io/api/v1/image"))) {
140
140
  if (!e.srcset.includes(e.image.split("?")[0]))
141
- return console.debug("Removed given srcset"), R(o);
141
+ return console.debug("Removed given srcset"), R(l);
142
142
  } else if (e.image && !e.srcset)
143
- return R(o);
144
- return R(o);
143
+ return R(l);
144
+ return R(l);
145
145
  }
146
146
  function s() {
147
- var b;
148
- return (b = c == null ? void 0 : c()) != null && b.match(/builder\.io/) && !e.noWebp ? c().replace(/\?/g, "?format=webp&") : "";
147
+ var g;
148
+ return (g = c == null ? void 0 : c()) != null && g.match(/builder\.io/) && !e.noWebp ? c().replace(/\?/g, "?format=webp&") : "";
149
149
  }
150
- function v() {
151
- const b = {
150
+ function S() {
151
+ const g = {
152
152
  position: "absolute",
153
153
  height: "100%",
154
154
  width: "100%",
155
155
  left: "0px",
156
156
  top: "0px"
157
157
  };
158
- return e.aspectRatio ? b : void 0;
158
+ return e.aspectRatio ? g : void 0;
159
159
  }
160
160
  return /* @__PURE__ */ E(h, { children: [
161
161
  /* @__PURE__ */ E(h, { children: [
@@ -170,7 +170,7 @@ function Pe(e) {
170
170
  style: {
171
171
  objectPosition: e.backgroundPosition || "center",
172
172
  objectFit: e.backgroundSize || "cover",
173
- ...v()
173
+ ...S()
174
174
  },
175
175
  className: "builder-image" + (e.className ? " " + e.className : "") + " img-40c70c9b",
176
176
  src: e.image,
@@ -179,7 +179,7 @@ function Pe(e) {
179
179
  }
180
180
  )
181
181
  ] }),
182
- e.aspectRatio && !((u = (l = e.builderBlock) == null ? void 0 : l.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
182
+ e.aspectRatio && !((u = (r = e.builderBlock) == null ? void 0 : r.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
183
183
  "div",
184
184
  {
185
185
  className: "builder-image-sizer div-40c70c9b",
@@ -188,7 +188,7 @@ function Pe(e) {
188
188
  }
189
189
  }
190
190
  ) }) : null,
191
- (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(h, { children: e.children }) : null,
191
+ (y = (f = e.builderBlock) == null ? void 0 : f.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(h, { children: e.children }) : null,
192
192
  !e.fitContent && e.children ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
193
193
  ] }),
194
194
  /* @__PURE__ */ i("style", { children: `.img-40c70c9b {
@@ -210,7 +210,7 @@ function Pe(e) {
210
210
  }` })
211
211
  ] });
212
212
  }
213
- function Te(e) {
213
+ function Ne(e) {
214
214
  return /* @__PURE__ */ i(
215
215
  "section",
216
216
  {
@@ -231,30 +231,30 @@ function Te(e) {
231
231
  }
232
232
  );
233
233
  }
234
- function Ne(e) {
235
- const c = T(null), [s, v] = x(() => []), [l, u] = x(() => []);
236
- return f(() => {
234
+ function Be(e) {
235
+ const c = T(null), [s, S] = x(() => []), [r, u] = x(() => []);
236
+ return b(() => {
237
237
  var y;
238
238
  if (!((y = c.current) != null && y.getElementsByTagName) || typeof window > "u")
239
239
  return;
240
- const S = c.current.getElementsByTagName("script");
241
- for (let b = 0; b < S.length; b++) {
242
- const o = S[b];
243
- if (o.src) {
244
- if (s.includes(o.src))
240
+ const f = c.current.getElementsByTagName("script");
241
+ for (let g = 0; g < f.length; g++) {
242
+ const l = f[g];
243
+ if (l.src) {
244
+ if (s.includes(l.src))
245
245
  continue;
246
- s.push(o.src);
246
+ s.push(l.src);
247
247
  const m = document.createElement("script");
248
- m.async = !0, m.src = o.src, document.head.appendChild(m);
249
- } else if (!o.type || [
248
+ m.async = !0, m.src = l.src, document.head.appendChild(m);
249
+ } else if (!l.type || [
250
250
  "text/javascript",
251
251
  "application/javascript",
252
252
  "application/ecmascript"
253
- ].includes(o.type)) {
254
- if (l.includes(o.innerText))
253
+ ].includes(l.type)) {
254
+ if (r.includes(l.innerText))
255
255
  continue;
256
256
  try {
257
- l.push(o.innerText), new Function(o.innerText)();
257
+ r.push(l.innerText), new Function(l.innerText)();
258
258
  } catch (m) {
259
259
  console.warn("`CustomCode`: Error running script:", m);
260
260
  }
@@ -269,29 +269,29 @@ function Ne(e) {
269
269
  }
270
270
  );
271
271
  }
272
- function Be(e) {
273
- const c = T(null), [s, v] = x(() => []), [l, u] = x(() => []), [S, y] = x(() => !1);
274
- function b() {
272
+ function Le(e) {
273
+ const c = T(null), [s, S] = x(() => []), [r, u] = x(() => []), [f, y] = x(() => !1);
274
+ function g() {
275
275
  if (!c.current || !c.current.getElementsByTagName)
276
276
  return;
277
- const o = c.current.getElementsByTagName("script");
278
- for (let m = 0; m < o.length; m++) {
279
- const k = o[m];
277
+ const l = c.current.getElementsByTagName("script");
278
+ for (let m = 0; m < l.length; m++) {
279
+ const k = l[m];
280
280
  if (k.src && !s.includes(k.src)) {
281
281
  s.push(k.src);
282
282
  const C = document.createElement("script");
283
283
  C.async = !0, C.src = k.src, document.head.appendChild(C);
284
- } else if (ee(k) && !l.includes(k.innerText))
284
+ } else if (ee(k) && !r.includes(k.innerText))
285
285
  try {
286
- l.push(k.innerText), new Function(k.innerText)();
286
+ r.push(k.innerText), new Function(k.innerText)();
287
287
  } catch (C) {
288
288
  console.warn("`Embed`: Error running script:", C);
289
289
  }
290
290
  }
291
291
  }
292
- return f(() => {
293
- c.current && !S && (y(!0), b());
294
- }, [c.current, S]), /* @__PURE__ */ i(
292
+ return b(() => {
293
+ c.current && !f && (y(!0), g());
294
+ }, [c.current, f]), /* @__PURE__ */ i(
295
295
  "div",
296
296
  {
297
297
  className: "builder-embed",
@@ -300,7 +300,7 @@ function Be(e) {
300
300
  }
301
301
  );
302
302
  }
303
- function Le(e) {
303
+ function je(e) {
304
304
  return /* @__PURE__ */ i(
305
305
  "img",
306
306
  {
@@ -315,8 +315,8 @@ function Le(e) {
315
315
  w() && e.imgSrc || "default-key"
316
316
  );
317
317
  }
318
- function je(e) {
319
- var v, l, u, S, y, b, o;
318
+ function We(e) {
319
+ var S, r, u, f, y, g, l;
320
320
  function c() {
321
321
  return {
322
322
  ...e.autoPlay === !0 ? {
@@ -357,7 +357,7 @@ function je(e) {
357
357
  style: {
358
358
  width: "100%",
359
359
  height: "100%",
360
- ...(v = e.attributes) == null ? void 0 : v.style,
360
+ ...(S = e.attributes) == null ? void 0 : S.style,
361
361
  objectFit: e.fit,
362
362
  objectPosition: e.position,
363
363
  // Hack to get object fit to work as expected and
@@ -373,7 +373,7 @@ function je(e) {
373
373
  children: e.lazyLoad ? null : /* @__PURE__ */ i("source", { type: "video/mp4", src: e.video })
374
374
  }
375
375
  ),
376
- e.aspectRatio && !(e.fitContent && ((u = (l = e.builderBlock) == null ? void 0 : l.children) != null && u.length)) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
376
+ e.aspectRatio && !(e.fitContent && ((u = (r = e.builderBlock) == null ? void 0 : r.children) != null && u.length)) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
377
377
  "div",
378
378
  {
379
379
  style: {
@@ -384,7 +384,7 @@ function je(e) {
384
384
  }
385
385
  }
386
386
  ) }) : null,
387
- (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
387
+ (y = (f = e.builderBlock) == null ? void 0 : f.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
388
388
  "div",
389
389
  {
390
390
  style: {
@@ -395,7 +395,7 @@ function je(e) {
395
395
  children: e.children
396
396
  }
397
397
  ) }) : null,
398
- (o = (b = e.builderBlock) == null ? void 0 : b.children) != null && o.length && !e.fitContent ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
398
+ (l = (g = e.builderBlock) == null ? void 0 : g.children) != null && l.length && !e.fitContent ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(
399
399
  "div",
400
400
  {
401
401
  style: {
@@ -416,7 +416,7 @@ function je(e) {
416
416
  }
417
417
  );
418
418
  }
419
- const he = ue({
419
+ const fe = me({
420
420
  content: null,
421
421
  context: {},
422
422
  localState: void 0,
@@ -430,103 +430,101 @@ const he = ue({
430
430
  BlocksWrapper: "div",
431
431
  BlocksWrapperProps: {}
432
432
  });
433
- function We(e) {
434
- var W, F, K, A, z, M, _;
435
- const c = T(null), [s, v] = x(() => 0);
433
+ function Ke(e) {
434
+ var W, K, A, F, z, M, _;
435
+ const c = T(null), [s, S] = x(() => 0);
436
436
  x(() => !0);
437
- function l(t) {
438
- var a, r;
439
- const n = {
437
+ function r(n) {
438
+ var a, o;
439
+ const t = {
440
440
  ...e.builderContextSignal.rootState,
441
- ...t
441
+ ...n
442
442
  };
443
- e.builderContextSignal.rootSetState ? (r = (a = e.builderContextSignal).rootSetState) == null || r.call(a, n) : e.builderContextSignal.rootState = n;
443
+ e.builderContextSignal.rootSetState ? (o = (a = e.builderContextSignal).rootSetState) == null || o.call(a, t) : e.builderContextSignal.rootState = t;
444
444
  }
445
- function u(t) {
446
- var a, r, d, g, q;
447
- const n = {
445
+ function u(n) {
446
+ var a, o, d, v, q;
447
+ const t = {
448
448
  ...e.builderContextSignal.content,
449
- ...t,
449
+ ...n,
450
450
  data: {
451
451
  ...(a = e.builderContextSignal.content) == null ? void 0 : a.data,
452
- ...t == null ? void 0 : t.data
452
+ ...n == null ? void 0 : n.data
453
453
  },
454
454
  meta: {
455
- ...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
456
- ...t == null ? void 0 : t.meta,
457
- breakpoints: ((d = t == null ? void 0 : t.meta) == null ? void 0 : d.breakpoints) || ((q = (g = e.builderContextSignal.content) == null ? void 0 : g.meta) == null ? void 0 : q.breakpoints)
455
+ ...(o = e.builderContextSignal.content) == null ? void 0 : o.meta,
456
+ ...n == null ? void 0 : n.meta,
457
+ breakpoints: ((d = n == null ? void 0 : n.meta) == null ? void 0 : d.breakpoints) || ((q = (v = e.builderContextSignal.content) == null ? void 0 : v.meta) == null ? void 0 : q.breakpoints)
458
458
  }
459
459
  };
460
- ge({
461
- value: n,
462
- key: n.id
460
+ he({
461
+ value: t,
462
+ key: t.id
463
463
  }).then(() => {
464
464
  Z.refresh();
465
465
  });
466
466
  }
467
467
  x(() => 0);
468
- const [S, y] = x(
468
+ const [f, y] = x(
469
469
  () => !1
470
- ), [b, o] = x(
470
+ ), [g, l] = x(
471
471
  () => e.contentWrapper || "div"
472
472
  );
473
- function m(t) {
474
- var a;
475
- if (!ie(e.trustedHosts, t))
476
- return;
477
- const { data: n } = t;
478
- if (n)
479
- switch (n.type) {
480
- case "builder.configureSdk": {
481
- const r = n.data, { breakpoints: d, contentId: g } = r;
482
- if (!g || g !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id))
483
- return;
484
- d && u({
473
+ function m(n) {
474
+ return ie({
475
+ model: e.model,
476
+ trustedHosts: e.trustedHosts,
477
+ callbacks: {
478
+ configureSdk: (t) => {
479
+ var d;
480
+ const { breakpoints: a, contentId: o } = t;
481
+ !o || o !== ((d = e.builderContextSignal.content) == null ? void 0 : d.id) || a && (u({
485
482
  meta: {
486
- breakpoints: d
483
+ breakpoints: a
487
484
  }
488
- }), v(s + 1);
489
- break;
490
- }
491
- case "builder.contentUpdate": {
492
- const r = n.data, d = r.key || r.alias || r.entry || r.modelName, g = r.data;
493
- d === e.model && (u(g), v(s + 1));
494
- break;
485
+ }), S(s + 1));
486
+ },
487
+ animation: (t) => {
488
+ ae(t);
489
+ },
490
+ contentUpdate: (t) => {
491
+ u(t), S(s + 1);
495
492
  }
496
493
  }
494
+ })(n);
497
495
  }
498
496
  function k() {
499
- var n, a;
500
- const t = (a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.jsCode;
501
- t && U({
502
- code: t,
497
+ var t, a;
498
+ const n = (a = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : a.jsCode;
499
+ n && U({
500
+ code: n,
503
501
  context: e.context || {},
504
502
  localState: void 0,
505
503
  rootState: e.builderContextSignal.rootState,
506
504
  rootSetState: e.builderContextSignal.rootSetState
507
505
  });
508
506
  }
509
- const [C, fe] = x(() => ({})), [N, G] = x(() => !1);
510
- function Q(t) {
511
- var n, a;
507
+ const [C, Se] = x(() => ({})), [N, G] = x(() => !1);
508
+ function Q(n) {
509
+ var t, a;
512
510
  if (e.builderContextSignal.content) {
513
- const r = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
514
- V({
511
+ const o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
512
+ D({
515
513
  type: "click",
516
- canTrack: H(e.canTrack),
514
+ canTrack: V(e.canTrack),
517
515
  contentId: d,
518
516
  apiKey: e.apiKey,
519
- variationId: r !== d ? r : void 0,
520
- ...ae(t),
517
+ variationId: o !== d ? o : void 0,
518
+ ...ce(n),
521
519
  unique: !N
522
520
  });
523
521
  }
524
522
  N || G(!0);
525
523
  }
526
- function X(t) {
527
- return t.replace(
524
+ function X(n) {
525
+ return n.replace(
528
526
  /{{([^}]+)}}/g,
529
- (n, a) => U({
527
+ (t, a) => U({
530
528
  code: a,
531
529
  context: e.context || {},
532
530
  localState: void 0,
@@ -535,27 +533,27 @@ function We(e) {
535
533
  })
536
534
  );
537
535
  }
538
- function Y({ url: t, key: n }) {
539
- se(t).then((a) => a.json()).then((a) => {
540
- var d, g;
541
- const r = {
536
+ function Y({ url: n, key: t }) {
537
+ ue(n).then((a) => a.json()).then((a) => {
538
+ var d, v;
539
+ const o = {
542
540
  ...e.builderContextSignal.rootState,
543
- [n]: a
541
+ [t]: a
544
542
  };
545
- (g = (d = e.builderContextSignal).rootSetState) == null || g.call(d, r), C[n] = !0;
543
+ (v = (d = e.builderContextSignal).rootSetState) == null || v.call(d, o), C[t] = !0;
546
544
  }).catch((a) => {
547
- console.error("error fetching dynamic data", t, a);
545
+ console.error("error fetching dynamic data", n, a);
548
546
  });
549
547
  }
550
548
  function B() {
551
- var n, a;
552
- const t = ((a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.httpRequests) ?? {};
553
- Object.entries(t).forEach(([r, d]) => {
554
- if (d && (!C[r] || w())) {
555
- const g = X(d);
549
+ var t, a;
550
+ const n = ((a = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : a.httpRequests) ?? {};
551
+ Object.entries(n).forEach(([o, d]) => {
552
+ if (d && (!C[o] || w())) {
553
+ const v = X(d);
556
554
  Y({
557
- url: g,
558
- key: r
555
+ url: v,
556
+ key: o
559
557
  });
560
558
  }
561
559
  });
@@ -566,7 +564,7 @@ function We(e) {
566
564
  "builder:component:stateChange",
567
565
  {
568
566
  detail: {
569
- state: ce(e.builderContextSignal.rootState),
567
+ state: re(e.builderContextSignal.rootState),
570
568
  ref: {
571
569
  name: e.model
572
570
  }
@@ -575,8 +573,8 @@ function We(e) {
575
573
  )
576
574
  );
577
575
  }
578
- function L(t) {
579
- v(s + 1), window.addEventListener("message", m), re(), le({
576
+ function L(n) {
577
+ S(s + 1), window.addEventListener("message", m), le(), oe({
580
578
  ...e.locale ? {
581
579
  locale: e.locale
582
580
  } : {},
@@ -591,97 +589,97 @@ function We(e) {
591
589
  } : {}
592
590
  }), Object.values(
593
591
  e.builderContextSignal.componentInfos
594
- ).forEach((n) => {
595
- var r;
596
- const a = oe(n);
597
- (r = window.parent) == null || r.postMessage(a, "*");
592
+ ).forEach((t) => {
593
+ var o;
594
+ const a = de(t);
595
+ (o = window.parent) == null || o.postMessage(a, "*");
598
596
  }), window.addEventListener(
599
597
  "builder:component:stateChangeListenerActivated",
600
598
  I
601
599
  );
602
600
  }
603
- function j(t) {
604
- const n = new URL(location.href).searchParams, a = n.get("builder.preview"), r = n.get(
601
+ function j(n) {
602
+ const t = new URL(location.href).searchParams, a = t.get("builder.preview"), o = t.get(
605
603
  `builder.preview.${a}`
606
- ), d = n.get("apiKey") || n.get("builder.space");
607
- a === e.model && d === e.apiKey && (!e.content || r === e.content.id) && de({
604
+ ), d = t.get("apiKey") || t.get("builder.space");
605
+ a === e.model && d === e.apiKey && (!e.content || o === e.content.id) && se({
608
606
  model: e.model,
609
607
  apiKey: e.apiKey,
610
608
  apiVersion: e.builderContextSignal.apiVersion
611
- }).then((g) => {
612
- g && u(g);
609
+ }).then((v) => {
610
+ v && u(v);
613
611
  });
614
612
  }
615
613
  const Z = be();
616
- return f(() => {
617
- var t;
618
- return (t = c.current) == null || t.addEventListener(
614
+ return b(() => {
615
+ var n;
616
+ return (n = c.current) == null || n.addEventListener(
619
617
  "initeditingbldr",
620
618
  L
621
619
  ), () => {
622
- var n;
623
- return (n = c.current) == null ? void 0 : n.removeEventListener(
620
+ var t;
621
+ return (t = c.current) == null ? void 0 : t.removeEventListener(
624
622
  "initeditingbldr",
625
623
  L
626
624
  );
627
625
  };
628
- }, []), f(() => {
629
- var t;
630
- return (t = c.current) == null || t.addEventListener(
626
+ }, []), b(() => {
627
+ var n;
628
+ return (n = c.current) == null || n.addEventListener(
631
629
  "initpreviewingbldr",
632
630
  j
633
631
  ), () => {
634
- var n;
635
- return (n = c.current) == null ? void 0 : n.removeEventListener(
632
+ var t;
633
+ return (t = c.current) == null ? void 0 : t.removeEventListener(
636
634
  "initpreviewingbldr",
637
635
  j
638
636
  );
639
637
  };
640
- }, []), f(() => {
641
- var t, n;
638
+ }, []), b(() => {
639
+ var n, t;
642
640
  if (P()) {
643
- if (w() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && H(e.canTrack)) {
644
- const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, d = (n = e.builderContextSignal.content) == null ? void 0 : n.id, g = e.apiKey;
645
- V({
641
+ if (w() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && V(e.canTrack)) {
642
+ const o = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (t = e.builderContextSignal.content) == null ? void 0 : t.id, v = e.apiKey;
643
+ D({
646
644
  type: "impression",
647
645
  canTrack: !0,
648
646
  contentId: d,
649
- apiKey: g,
650
- variationId: r !== d ? r : void 0
647
+ apiKey: v,
648
+ variationId: o !== d ? o : void 0
651
649
  });
652
650
  }
653
651
  te() && c.current;
654
652
  }
655
- }, []), f(() => {
653
+ }, []), b(() => {
656
654
  e.apiKey || ne.error(
657
655
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
658
656
  ), k(), B(), I();
659
- }, []), f(() => {
660
- }, [e.content]), f(() => {
657
+ }, []), b(() => {
658
+ }, [e.content]), b(() => {
661
659
  P() && (window.removeEventListener("message", m), window.addEventListener("message", m));
662
- }, [S]), f(() => {
660
+ }, [f]), b(() => {
663
661
  k();
664
- }, [(F = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : F.jsCode]), f(() => {
662
+ }, [(K = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : K.jsCode]), b(() => {
665
663
  B();
666
- }, [(A = (K = e.builderContextSignal.content) == null ? void 0 : K.data) == null ? void 0 : A.httpRequests]), f(() => {
664
+ }, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]), b(() => {
667
665
  I();
668
- }, [e.builderContextSignal.rootState]), f(() => {
669
- e.data && l(e.data);
670
- }, [e.data]), f(() => {
671
- e.locale && l({
666
+ }, [e.builderContextSignal.rootState]), b(() => {
667
+ e.data && r(e.data);
668
+ }, [e.data]), b(() => {
669
+ e.locale && r({
672
670
  locale: e.locale
673
671
  });
674
- }, [e.locale]), f(() => () => {
672
+ }, [e.locale]), b(() => () => {
675
673
  P() && (window.removeEventListener("message", m), window.removeEventListener(
676
674
  "builder:component:stateChangeListenerActivated",
677
675
  I
678
676
  ));
679
- }, []), /* @__PURE__ */ i(he.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ me(
680
- b,
677
+ }, []), /* @__PURE__ */ i(fe.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ ge(
678
+ g,
681
679
  {
682
680
  key: s,
683
681
  ref: c,
684
- onClick: (t) => Q(t),
682
+ onClick: (n) => Q(n),
685
683
  "builder-content-id": (z = e.builderContextSignal.content) == null ? void 0 : z.id,
686
684
  "builder-model": e.model,
687
685
  ...e.showContent ? {} : {
@@ -695,17 +693,17 @@ function We(e) {
695
693
  ) }) : null });
696
694
  }
697
695
  export {
698
- we as B,
699
- Ne as C,
696
+ Ee as B,
697
+ Be as C,
700
698
  J as D,
701
- Be as E,
702
- Re as F,
703
- Ee as I,
704
- Te as S,
705
- je as V,
706
- Ie as a,
707
- Ce as b,
708
- Pe as c,
709
- Le as d,
710
- We as e
699
+ Le as E,
700
+ Pe as F,
701
+ Ie as I,
702
+ Ne as S,
703
+ We as V,
704
+ Re as a,
705
+ we as b,
706
+ Te as c,
707
+ je as d,
708
+ Ke as e
711
709
  };