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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-4b1b3c99.cjs +23 -0
  2. package/lib/browser/{USE_CLIENT_BUNDLE-109dedea.js → USE_CLIENT_BUNDLE-550679f9.js} +250 -265
  3. package/lib/{edge/USE_SERVER_BUNDLE-35036883.js → browser/USE_SERVER_BUNDLE-464dccd7.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-ab530745.cjs → browser/USE_SERVER_BUNDLE-6234c5ea.cjs} +1 -1
  5. package/lib/browser/bundle-1d763be7.cjs +168 -0
  6. package/lib/browser/{bundle-f769d53a.js → bundle-d905bf70.js} +614 -572
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +17 -17
  9. package/lib/{node/USE_CLIENT_BUNDLE-f1c14740.js → edge/USE_CLIENT_BUNDLE-aa38a343.js} +250 -265
  10. package/lib/edge/USE_CLIENT_BUNDLE-edb18eb8.cjs +23 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-a546a48c.js → edge/USE_SERVER_BUNDLE-70c27ea1.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-ce3684c3.cjs → edge/USE_SERVER_BUNDLE-f0eeb33e.cjs} +1 -1
  13. package/lib/edge/{bundle-593d3883.cjs → bundle-25fa71b1.cjs} +31 -31
  14. package/lib/edge/{bundle-80ec9a4d.js → bundle-834dbf29.js} +873 -831
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +17 -17
  17. package/lib/{edge/USE_CLIENT_BUNDLE-bffeb179.js → node/USE_CLIENT_BUNDLE-d30db795.js} +250 -265
  18. package/lib/node/USE_CLIENT_BUNDLE-def5165a.cjs +23 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-a36e67c3.js → node/USE_SERVER_BUNDLE-610c83b3.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-7d41532a.cjs → node/USE_SERVER_BUNDLE-a5db98bc.cjs} +1 -1
  21. package/lib/node/{bundle-fd27db7d.js → bundle-1f73ead0.js} +236 -194
  22. package/lib/node/bundle-4efd9623.cjs +208 -0
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +17 -17
  25. package/package.json +1 -1
  26. package/types/cjs/blocks/slot/component-info.d.ts +2 -0
  27. package/types/cjs/blocks/slot/slot.d.ts +11 -0
  28. package/types/cjs/components/block/block.helpers.d.ts +0 -1
  29. package/types/cjs/components/block/components/block-wrapper.d.ts +2 -6
  30. package/types/cjs/components/content-variants/content-variants.types.d.ts +4 -0
  31. package/types/cjs/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  32. package/types/cjs/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  33. package/types/cjs/constants/sdk-version.d.ts +1 -1
  34. package/types/cjs/functions/is-from-trusted-host.d.ts +3 -0
  35. package/types/cjs/scripts/init-editing.d.ts +1 -0
  36. package/types/esm/blocks/slot/component-info.d.ts +2 -0
  37. package/types/esm/blocks/slot/slot.d.ts +11 -0
  38. package/types/esm/components/block/block.helpers.d.ts +0 -1
  39. package/types/esm/components/block/components/block-wrapper.d.ts +2 -6
  40. package/types/esm/components/content-variants/content-variants.types.d.ts +4 -0
  41. package/types/esm/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  42. package/types/esm/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  43. package/types/esm/constants/sdk-version.d.ts +1 -1
  44. package/types/esm/functions/is-from-trusted-host.d.ts +3 -0
  45. package/types/esm/scripts/init-editing.d.ts +1 -0
  46. package/lib/browser/USE_CLIENT_BUNDLE-c6f253a6.cjs +0 -23
  47. package/lib/browser/bundle-ff1186e7.cjs +0 -168
  48. package/lib/edge/USE_CLIENT_BUNDLE-23097d3f.cjs +0 -23
  49. package/lib/node/USE_CLIENT_BUNDLE-ff4465dc.cjs +0 -23
  50. package/lib/node/bundle-6e88a55c.cjs +0 -208
@@ -1,12 +1,12 @@
1
1
  "use client";
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-f769d53a.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-a36e67c3.js";
6
- import { useRouter as se } from "next/navigation";
7
- function xe(e) {
8
- return /* @__PURE__ */ w(g, { children: [
9
- e.link ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
2
+ import { jsxs as w, Fragment as s, jsx as t } from "react/jsx-runtime";
3
+ import { i as Y, g as U, a as O, b as E, c as R, d as Z, e as P, f as H, _ as V, h as p, l as ee, j as te, k as D, m as ne, n as ie, r as ae, s as ce, o as le, p as re, q as oe } from "./bundle-d905bf70.js";
4
+ import { useRef as T, useState as x, useEffect as f, createContext as de, createElement as se } from "react";
5
+ import { p as ue } from "./USE_SERVER_BUNDLE-464dccd7.js";
6
+ import { useRouter as me } from "next/navigation";
7
+ function ke(e) {
8
+ return /* @__PURE__ */ w(s, { children: [
9
+ e.link ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
10
10
  "a",
11
11
  {
12
12
  ...e.attributes,
@@ -15,7 +15,7 @@ function xe(e) {
15
15
  role: "button",
16
16
  children: e.text
17
17
  }
18
- ) }) : /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
18
+ ) }) : /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
19
19
  "button",
20
20
  {
21
21
  ...e.attributes,
@@ -24,66 +24,46 @@ function xe(e) {
24
24
  children: e.text
25
25
  }
26
26
  ) }),
27
- /* @__PURE__ */ i("style", { children: `.button-fdf49de0 {
27
+ /* @__PURE__ */ t("style", { children: `.button-fdf49de0 {
28
28
  all: unset;
29
29
  }` })
30
30
  ] });
31
31
  }
32
- function ve(e) {
33
- return /* @__PURE__ */ w(g, { children: [
34
- " ",
35
- e.hasChildren ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ w(
36
- e.Wrapper,
37
- {
38
- ...T({
39
- block: e.block,
40
- context: e.context
41
- }),
42
- ...B({
43
- block: e.block,
44
- rootState: e.context.rootState,
45
- rootSetState: e.context.rootSetState,
46
- localState: e.context.localState,
47
- context: e.context.context,
48
- stripPrefix: !0
49
- }),
50
- children: [
51
- " ",
52
- e.children,
53
- " "
54
- ]
55
- }
56
- ) }) : /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
57
- e.Wrapper,
58
- {
59
- ...T({
60
- block: e.block,
61
- context: e.context
62
- }),
63
- ...B({
64
- block: e.block,
65
- rootState: e.context.rootState,
66
- rootSetState: e.context.rootSetState,
67
- localState: e.context.localState,
68
- context: e.context.context,
69
- stripPrefix: !0
70
- })
71
- }
72
- ) }),
73
- " "
74
- ] });
32
+ function ge(e) {
33
+ return /* @__PURE__ */ t(s, { children: Y(e.TagName) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ t(s, { children: typeof e.TagName == "string" ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
75
34
  }
76
- function ye(e) {
77
- return /* @__PURE__ */ i(
35
+ function Ce(e) {
36
+ return /* @__PURE__ */ t(
37
+ ge,
38
+ {
39
+ TagName: e.Wrapper,
40
+ attributes: U({
41
+ block: e.block,
42
+ context: e.context
43
+ }),
44
+ actionAttributes: O({
45
+ block: e.block,
46
+ rootState: e.context.rootState,
47
+ rootSetState: e.context.rootSetState,
48
+ localState: e.context.localState,
49
+ context: e.context.context,
50
+ stripPrefix: !0
51
+ }),
52
+ children: e.children
53
+ }
54
+ );
55
+ }
56
+ function we(e) {
57
+ return /* @__PURE__ */ t(
78
58
  e.Wrapper,
79
59
  {
80
60
  ...e.wrapperProps,
81
61
  attributes: e.includeBlockProps ? {
82
- ...T({
62
+ ...U({
83
63
  block: e.block,
84
64
  context: e.context
85
65
  }),
86
- ...B({
66
+ ...O({
87
67
  block: e.block,
88
68
  rootState: e.context.rootState,
89
69
  rootSetState: e.context.rootSetState,
@@ -95,14 +75,14 @@ function ye(e) {
95
75
  }
96
76
  );
97
77
  }
98
- function ke(e) {
78
+ function Ee(e) {
99
79
  function c() {
100
- var o;
101
- return "builder-blocks" + ((o = e.blocks) != null && o.length ? "" : " no-blocks");
80
+ var r;
81
+ return "builder-blocks" + ((r = e.blocks) != null && r.length ? "" : " no-blocks");
102
82
  }
103
- function s() {
104
- var o, u;
105
- E() && !((o = e.blocks) != null && o.length) && ((u = window.parent) == null || u.postMessage(
83
+ function u() {
84
+ var r, m;
85
+ E() && !((r = e.blocks) != null && r.length) && ((m = window.parent) == null || m.postMessage(
106
86
  {
107
87
  type: "builder.clickEmptyBlocks",
108
88
  data: {
@@ -113,9 +93,9 @@ function ke(e) {
113
93
  "*"
114
94
  ));
115
95
  }
116
- function x() {
117
- var o, u;
118
- E() && !((o = e.blocks) != null && o.length) && ((u = window.parent) == null || u.postMessage(
96
+ function v() {
97
+ var r, m;
98
+ E() && !((r = e.blocks) != null && r.length) && ((m = window.parent) == null || m.postMessage(
119
99
  {
120
100
  type: "builder.hoverEmptyBlocks",
121
101
  data: {
@@ -126,66 +106,66 @@ function ke(e) {
126
106
  "*"
127
107
  ));
128
108
  }
129
- return /* @__PURE__ */ w(g, { children: [
130
- /* @__PURE__ */ i(
109
+ return /* @__PURE__ */ w(s, { children: [
110
+ /* @__PURE__ */ t(
131
111
  e.BlocksWrapper,
132
112
  {
133
113
  className: c() + " props-blocks-wrapper-4f2c12d8",
134
114
  "builder-path": e.path,
135
115
  "builder-parent-id": e.parent,
136
116
  style: e.styleProp,
137
- onClick: (o) => s(),
138
- onMouseEnter: (o) => x(),
139
- onKeyPress: (o) => s(),
117
+ onClick: (r) => u(),
118
+ onMouseEnter: (r) => v(),
119
+ onKeyPress: (r) => u(),
140
120
  ...e.BlocksWrapperProps,
141
121
  children: e.children
142
122
  }
143
123
  ),
144
- /* @__PURE__ */ i("style", { children: `.props-blocks-wrapper-4f2c12d8 {
124
+ /* @__PURE__ */ t("style", { children: `.props-blocks-wrapper-4f2c12d8 {
145
125
  display: flex;
146
126
  flex-direction: column;
147
127
  align-items: stretch;
148
128
  }` })
149
129
  ] });
150
130
  }
151
- function Ce(e) {
152
- return /* @__PURE__ */ i("span", { children: e.children });
131
+ function Ie(e) {
132
+ return /* @__PURE__ */ t("span", { children: e.children });
153
133
  }
154
- function we(e) {
155
- var o, u, S, y;
134
+ function Re(e) {
135
+ var r, m, S, y;
156
136
  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
137
+ var g;
138
+ const o = e.image || e.src;
139
+ if (!o || // We can auto add srcset for cdn.builder.io and shopify
160
140
  // images, otherwise you can supply this prop manually
161
- !(r.match(/builder\.io/) || r.match(/cdn\.shopify\.com/)))
141
+ !(o.match(/builder\.io/) || o.match(/cdn\.shopify\.com/)))
162
142
  return e.srcset;
163
- if (e.srcset && ((m = e.image) != null && m.includes("builder.io/api/v1/image"))) {
143
+ if (e.srcset && ((g = e.image) != null && g.includes("builder.io/api/v1/image"))) {
164
144
  if (!e.srcset.includes(e.image.split("?")[0]))
165
- return console.debug("Removed given srcset"), R(r);
145
+ return console.debug("Removed given srcset"), R(o);
166
146
  } else if (e.image && !e.srcset)
167
- return R(r);
168
- return R(r);
147
+ return R(o);
148
+ return R(o);
169
149
  }
170
- function s() {
171
- var f;
172
- return (f = c == null ? void 0 : c()) != null && f.match(/builder\.io/) && !e.noWebp ? c().replace(/\?/g, "?format=webp&") : "";
150
+ function u() {
151
+ var b;
152
+ return (b = c == null ? void 0 : c()) != null && b.match(/builder\.io/) && !e.noWebp ? c().replace(/\?/g, "?format=webp&") : "";
173
153
  }
174
- function x() {
175
- const f = {
154
+ function v() {
155
+ const b = {
176
156
  position: "absolute",
177
157
  height: "100%",
178
158
  width: "100%",
179
159
  left: "0px",
180
160
  top: "0px"
181
161
  };
182
- return e.aspectRatio ? f : void 0;
162
+ return e.aspectRatio ? b : void 0;
183
163
  }
184
- return /* @__PURE__ */ w(g, { children: [
185
- /* @__PURE__ */ w(g, { children: [
164
+ return /* @__PURE__ */ w(s, { children: [
165
+ /* @__PURE__ */ w(s, { children: [
186
166
  /* @__PURE__ */ w("picture", { children: [
187
- s() ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i("source", { type: "image/webp", srcSet: s() }) }) : null,
188
- /* @__PURE__ */ i(
167
+ u() ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t("source", { type: "image/webp", srcSet: u() }) }) : null,
168
+ /* @__PURE__ */ t(
189
169
  "img",
190
170
  {
191
171
  loading: "lazy",
@@ -194,7 +174,7 @@ function we(e) {
194
174
  style: {
195
175
  objectPosition: e.backgroundPosition || "center",
196
176
  objectFit: e.backgroundSize || "cover",
197
- ...x()
177
+ ...v()
198
178
  },
199
179
  className: "builder-image" + (e.className ? " " + e.className : "") + " img-40c70c9b",
200
180
  src: e.image,
@@ -203,7 +183,7 @@ function we(e) {
203
183
  }
204
184
  )
205
185
  ] }),
206
- e.aspectRatio && !((u = (o = e.builderBlock) == null ? void 0 : o.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
186
+ e.aspectRatio && !((m = (r = e.builderBlock) == null ? void 0 : r.children) != null && m.length && e.fitContent) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
207
187
  "div",
208
188
  {
209
189
  className: "builder-image-sizer div-40c70c9b",
@@ -212,10 +192,10 @@ function we(e) {
212
192
  }
213
193
  }
214
194
  ) }) : 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
195
+ (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ t(s, { children: e.children }) : null,
196
+ !e.fitContent && e.children ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
217
197
  ] }),
218
- /* @__PURE__ */ i("style", { children: `.img-40c70c9b {
198
+ /* @__PURE__ */ t("style", { children: `.img-40c70c9b {
219
199
  opacity: 1;
220
200
  transition: opacity 0.2s ease-in-out;
221
201
  }.div-40c70c9b {
@@ -234,8 +214,8 @@ function we(e) {
234
214
  }` })
235
215
  ] });
236
216
  }
237
- function Ee(e) {
238
- return /* @__PURE__ */ i(
217
+ function Pe(e) {
218
+ return /* @__PURE__ */ t(
239
219
  "section",
240
220
  {
241
221
  ...e.attributes,
@@ -255,36 +235,36 @@ function Ee(e) {
255
235
  }
256
236
  );
257
237
  }
258
- function Ie(e) {
259
- const c = N(null), [s, x] = v(() => []), [o, u] = v(() => []);
260
- return b(() => {
238
+ function Te(e) {
239
+ const c = T(null), [u, v] = x(() => []), [r, m] = x(() => []);
240
+ return f(() => {
261
241
  var y;
262
242
  if (!((y = c.current) != null && y.getElementsByTagName) || typeof window > "u")
263
243
  return;
264
244
  const S = c.current.getElementsByTagName("script");
265
- for (let f = 0; f < S.length; f++) {
266
- const r = S[f];
267
- if (r.src) {
268
- if (s.includes(r.src))
245
+ for (let b = 0; b < S.length; b++) {
246
+ const o = S[b];
247
+ if (o.src) {
248
+ if (u.includes(o.src))
269
249
  continue;
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 || [
250
+ u.push(o.src);
251
+ const g = document.createElement("script");
252
+ g.async = !0, g.src = o.src, document.head.appendChild(g);
253
+ } else if (!o.type || [
274
254
  "text/javascript",
275
255
  "application/javascript",
276
256
  "application/ecmascript"
277
- ].includes(r.type)) {
278
- if (o.includes(r.innerText))
257
+ ].includes(o.type)) {
258
+ if (r.includes(o.innerText))
279
259
  continue;
280
260
  try {
281
- o.push(r.innerText), new Function(r.innerText)();
282
- } catch (m) {
283
- console.warn("`CustomCode`: Error running script:", m);
261
+ r.push(o.innerText), new Function(o.innerText)();
262
+ } catch (g) {
263
+ console.warn("`CustomCode`: Error running script:", g);
284
264
  }
285
265
  }
286
266
  }
287
- }, []), /* @__PURE__ */ i(
267
+ }, []), /* @__PURE__ */ t(
288
268
  "div",
289
269
  {
290
270
  ref: c,
@@ -293,29 +273,29 @@ function Ie(e) {
293
273
  }
294
274
  );
295
275
  }
296
- function Re(e) {
297
- const c = N(null), [s, x] = v(() => []), [o, u] = v(() => []), [S, y] = v(() => !1);
298
- function f() {
276
+ function Ne(e) {
277
+ const c = T(null), [u, v] = x(() => []), [r, m] = x(() => []), [S, y] = x(() => !1);
278
+ function b() {
299
279
  if (!c.current || !c.current.getElementsByTagName)
300
280
  return;
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);
281
+ const o = c.current.getElementsByTagName("script");
282
+ for (let g = 0; g < o.length; g++) {
283
+ const k = o[g];
284
+ if (k.src && !u.includes(k.src)) {
285
+ u.push(k.src);
306
286
  const C = document.createElement("script");
307
287
  C.async = !0, C.src = k.src, document.head.appendChild(C);
308
- } else if (Y(k) && !o.includes(k.innerText))
288
+ } else if (Z(k) && !r.includes(k.innerText))
309
289
  try {
310
- o.push(k.innerText), new Function(k.innerText)();
290
+ r.push(k.innerText), new Function(k.innerText)();
311
291
  } catch (C) {
312
292
  console.warn("`Embed`: Error running script:", C);
313
293
  }
314
294
  }
315
295
  }
316
- return b(() => {
317
- c.current && !S && (y(!0), f());
318
- }, [c.current, S]), /* @__PURE__ */ i(
296
+ return f(() => {
297
+ c.current && !S && (y(!0), b());
298
+ }, [c.current, S]), /* @__PURE__ */ t(
319
299
  "div",
320
300
  {
321
301
  className: "builder-embed",
@@ -324,8 +304,8 @@ function Re(e) {
324
304
  }
325
305
  );
326
306
  }
327
- function Pe(e) {
328
- return /* @__PURE__ */ i(
307
+ function Be(e) {
308
+ return /* @__PURE__ */ t(
329
309
  "img",
330
310
  {
331
311
  style: {
@@ -339,8 +319,8 @@ function Pe(e) {
339
319
  E() && e.imgSrc || "default-key"
340
320
  );
341
321
  }
342
- function Te(e) {
343
- var x, o, u, S, y, f, r;
322
+ function Le(e) {
323
+ var v, r, m, S, y, b, o;
344
324
  function c() {
345
325
  return {
346
326
  ...e.autoPlay === !0 ? {
@@ -360,7 +340,7 @@ function Te(e) {
360
340
  } : {}
361
341
  };
362
342
  }
363
- function s() {
343
+ function u() {
364
344
  return {
365
345
  ...c()
366
346
  };
@@ -372,16 +352,16 @@ function Te(e) {
372
352
  position: "relative"
373
353
  },
374
354
  children: [
375
- /* @__PURE__ */ i(
355
+ /* @__PURE__ */ t(
376
356
  "video",
377
357
  {
378
358
  className: "builder-video",
379
- ...s(),
359
+ ...u(),
380
360
  preload: e.preload || "metadata",
381
361
  style: {
382
362
  width: "100%",
383
363
  height: "100%",
384
- ...(x = e.attributes) == null ? void 0 : x.style,
364
+ ...(v = e.attributes) == null ? void 0 : v.style,
385
365
  objectFit: e.fit,
386
366
  objectPosition: e.position,
387
367
  // Hack to get object fit to work as expected and
@@ -394,10 +374,10 @@ function Te(e) {
394
374
  },
395
375
  src: e.video || "no-src",
396
376
  poster: e.posterImage,
397
- children: e.lazyLoad ? null : /* @__PURE__ */ i("source", { type: "video/mp4", src: e.video })
377
+ children: e.lazyLoad ? null : /* @__PURE__ */ t("source", { type: "video/mp4", src: e.video })
398
378
  }
399
379
  ),
400
- e.aspectRatio && !(e.fitContent && ((u = (o = e.builderBlock) == null ? void 0 : o.children) != null && u.length)) ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
380
+ e.aspectRatio && !(e.fitContent && ((m = (r = e.builderBlock) == null ? void 0 : r.children) != null && m.length)) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
401
381
  "div",
402
382
  {
403
383
  style: {
@@ -408,7 +388,7 @@ function Te(e) {
408
388
  }
409
389
  }
410
390
  ) }) : null,
411
- (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
391
+ (y = (S = e.builderBlock) == null ? void 0 : S.children) != null && y.length && e.fitContent ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
412
392
  "div",
413
393
  {
414
394
  style: {
@@ -419,7 +399,7 @@ function Te(e) {
419
399
  children: e.children
420
400
  }
421
401
  ) }) : null,
422
- (r = (f = e.builderBlock) == null ? void 0 : f.children) != null && r.length && !e.fitContent ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
402
+ (o = (b = e.builderBlock) == null ? void 0 : b.children) != null && o.length && !e.fitContent ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
423
403
  "div",
424
404
  {
425
405
  style: {
@@ -440,7 +420,7 @@ function Te(e) {
440
420
  }
441
421
  );
442
422
  }
443
- const ue = oe({
423
+ const he = de({
444
424
  content: null,
445
425
  context: {},
446
426
  localState: void 0,
@@ -454,101 +434,103 @@ const ue = oe({
454
434
  BlocksWrapper: "div",
455
435
  BlocksWrapperProps: {}
456
436
  });
457
- function Be(e) {
458
- var F, z, M, _, V, q, A;
459
- const c = N(null), [s, x] = v(() => 0);
460
- v(() => !0);
461
- function o(t) {
437
+ function je(e) {
438
+ var W, F, K, z, A, M, _;
439
+ const c = T(null), [u, v] = x(() => 0);
440
+ x(() => !0);
441
+ function r(n) {
462
442
  var a, l;
463
- const n = {
443
+ const i = {
464
444
  ...e.builderContextSignal.rootState,
465
- ...t
445
+ ...n
466
446
  };
467
- e.builderContextSignal.rootSetState ? (l = (a = e.builderContextSignal).rootSetState) == null || l.call(a, n) : e.builderContextSignal.rootState = n;
447
+ e.builderContextSignal.rootSetState ? (l = (a = e.builderContextSignal).rootSetState) == null || l.call(a, i) : e.builderContextSignal.rootState = i;
468
448
  }
469
- function u(t) {
470
- var a, l, d, h, D;
471
- const n = {
449
+ function m(n) {
450
+ var a, l, d, h, q;
451
+ const i = {
472
452
  ...e.builderContextSignal.content,
473
- ...t,
453
+ ...n,
474
454
  data: {
475
455
  ...(a = e.builderContextSignal.content) == null ? void 0 : a.data,
476
- ...t == null ? void 0 : t.data
456
+ ...n == null ? void 0 : n.data
477
457
  },
478
458
  meta: {
479
459
  ...(l = e.builderContextSignal.content) == null ? void 0 : l.meta,
480
- ...t == null ? void 0 : t.meta,
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)
460
+ ...n == null ? void 0 : n.meta,
461
+ breakpoints: ((d = n == null ? void 0 : n.meta) == null ? void 0 : d.breakpoints) || ((q = (h = e.builderContextSignal.content) == null ? void 0 : h.meta) == null ? void 0 : q.breakpoints)
482
462
  }
483
463
  };
484
- de({
485
- value: n,
486
- key: n.id
464
+ ue({
465
+ value: i,
466
+ key: i.id
487
467
  }).then(() => {
488
468
  X.refresh();
489
469
  });
490
470
  }
491
- v(() => 0);
492
- const [S, y] = v(
471
+ x(() => 0);
472
+ const [S, y] = x(
493
473
  () => !1
494
- ), [f, r] = v(
474
+ ), [b, o] = x(
495
475
  () => e.contentWrapper || "div"
496
476
  );
497
- function m(t) {
477
+ function g(n) {
498
478
  var a;
499
- const { data: n } = t;
500
- if (n)
501
- switch (n.type) {
479
+ if (!te(e.trustedHosts, n))
480
+ return;
481
+ const { data: i } = n;
482
+ if (i)
483
+ switch (i.type) {
502
484
  case "builder.configureSdk": {
503
- const l = n.data, { breakpoints: d, contentId: h } = l;
485
+ const l = i.data, { breakpoints: d, contentId: h } = l;
504
486
  if (!h || h !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id))
505
487
  return;
506
- d && u({
488
+ d && m({
507
489
  meta: {
508
490
  breakpoints: d
509
491
  }
510
- }), x(s + 1);
492
+ }), v(u + 1);
511
493
  break;
512
494
  }
513
495
  case "builder.contentUpdate": {
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));
496
+ const l = i.data, d = l.key || l.alias || l.entry || l.modelName, h = l.data;
497
+ d === e.model && (m(h), v(u + 1));
516
498
  break;
517
499
  }
518
500
  }
519
501
  }
520
502
  function k() {
521
- var n, a;
522
- const t = (a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.jsCode;
523
- t && O({
524
- code: t,
503
+ var i, a;
504
+ const n = (a = (i = e.builderContextSignal.content) == null ? void 0 : i.data) == null ? void 0 : a.jsCode;
505
+ n && D({
506
+ code: n,
525
507
  context: e.context || {},
526
508
  localState: void 0,
527
509
  rootState: e.builderContextSignal.rootState,
528
510
  rootSetState: e.builderContextSignal.rootSetState
529
511
  });
530
512
  }
531
- const [C, me] = v(() => ({})), [L, J] = v(() => !1);
532
- function $(t) {
533
- var n, a;
513
+ const [C, be] = x(() => ({})), [N, J] = x(() => !1);
514
+ function $(n) {
515
+ var i, a;
534
516
  if (e.builderContextSignal.content) {
535
- const l = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
536
- H({
517
+ const l = (i = e.builderContextSignal.content) == null ? void 0 : i.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
518
+ V({
537
519
  type: "click",
538
- canTrack: U(e.canTrack),
520
+ canTrack: H(e.canTrack),
539
521
  contentId: d,
540
522
  apiKey: e.apiKey,
541
523
  variationId: l !== d ? l : void 0,
542
- ...ee(t),
543
- unique: !L
524
+ ...ne(n),
525
+ unique: !N
544
526
  });
545
527
  }
546
- L || J(!0);
528
+ N || J(!0);
547
529
  }
548
- function G(t) {
549
- return t.replace(
530
+ function G(n) {
531
+ return n.replace(
550
532
  /{{([^}]+)}}/g,
551
- (n, a) => O({
533
+ (i, a) => D({
552
534
  code: a,
553
535
  context: e.context || {},
554
536
  localState: void 0,
@@ -557,22 +539,22 @@ function Be(e) {
557
539
  })
558
540
  );
559
541
  }
560
- function Q({ url: t, key: n }) {
561
- le(t).then((a) => a.json()).then((a) => {
542
+ function Q({ url: n, key: i }) {
543
+ oe(n).then((a) => a.json()).then((a) => {
562
544
  var d, h;
563
545
  const l = {
564
546
  ...e.builderContextSignal.rootState,
565
- [n]: a
547
+ [i]: a
566
548
  };
567
- (h = (d = e.builderContextSignal).rootSetState) == null || h.call(d, l), C[n] = !0;
549
+ (h = (d = e.builderContextSignal).rootSetState) == null || h.call(d, l), C[i] = !0;
568
550
  }).catch((a) => {
569
- console.error("error fetching dynamic data", t, a);
551
+ console.error("error fetching dynamic data", n, a);
570
552
  });
571
553
  }
572
- function j() {
573
- var n, a;
574
- const t = ((a = (n = e.builderContextSignal.content) == null ? void 0 : n.data) == null ? void 0 : a.httpRequests) ?? {};
575
- Object.entries(t).forEach(([l, d]) => {
554
+ function B() {
555
+ var i, a;
556
+ const n = ((a = (i = e.builderContextSignal.content) == null ? void 0 : i.data) == null ? void 0 : a.httpRequests) ?? {};
557
+ Object.entries(n).forEach(([l, d]) => {
576
558
  if (d && (!C[l] || E())) {
577
559
  const h = G(d);
578
560
  Q({
@@ -588,7 +570,7 @@ function Be(e) {
588
570
  "builder:component:stateChange",
589
571
  {
590
572
  detail: {
591
- state: te(e.builderContextSignal.rootState),
573
+ state: ie(e.builderContextSignal.rootState),
592
574
  ref: {
593
575
  name: e.model
594
576
  }
@@ -597,8 +579,8 @@ function Be(e) {
597
579
  )
598
580
  );
599
581
  }
600
- function W(t) {
601
- x(s + 1), window.addEventListener("message", m), ne(), ie({
582
+ function L(n) {
583
+ v(u + 1), window.addEventListener("message", g), ae(), ce({
602
584
  ...e.locale ? {
603
585
  locale: e.locale
604
586
  } : {},
@@ -607,61 +589,64 @@ function Be(e) {
607
589
  } : {},
608
590
  ...e.enrich ? {
609
591
  enrich: e.enrich
592
+ } : {},
593
+ ...e.trustedHosts ? {
594
+ trustedHosts: e.trustedHosts
610
595
  } : {}
611
596
  }), Object.values(
612
597
  e.builderContextSignal.componentInfos
613
- ).forEach((n) => {
598
+ ).forEach((i) => {
614
599
  var l;
615
- const a = ae(n);
600
+ const a = le(i);
616
601
  (l = window.parent) == null || l.postMessage(a, "*");
617
602
  }), window.addEventListener(
618
603
  "builder:component:stateChangeListenerActivated",
619
604
  I
620
605
  );
621
606
  }
622
- function K(t) {
623
- const n = new URL(location.href).searchParams, a = n.get("builder.preview"), l = n.get(
607
+ function j(n) {
608
+ const i = new URL(location.href).searchParams, a = i.get("builder.preview"), l = i.get(
624
609
  `builder.preview.${a}`
625
- ), d = n.get("apiKey") || n.get("builder.space");
626
- a === e.model && d === e.apiKey && (!e.content || l === e.content.id) && ce({
610
+ ), d = i.get("apiKey") || i.get("builder.space");
611
+ a === e.model && d === e.apiKey && (!e.content || l === e.content.id) && re({
627
612
  model: e.model,
628
613
  apiKey: e.apiKey,
629
614
  apiVersion: e.builderContextSignal.apiVersion
630
615
  }).then((h) => {
631
- h && u(h);
616
+ h && m(h);
632
617
  });
633
618
  }
634
- const X = se();
635
- return b(() => {
636
- var t;
637
- return (t = c.current) == null || t.addEventListener(
619
+ const X = me();
620
+ return f(() => {
621
+ var n;
622
+ return (n = c.current) == null || n.addEventListener(
638
623
  "initeditingbldr",
639
- W
624
+ L
640
625
  ), () => {
641
- var n;
642
- return (n = c.current) == null ? void 0 : n.removeEventListener(
626
+ var i;
627
+ return (i = c.current) == null ? void 0 : i.removeEventListener(
643
628
  "initeditingbldr",
644
- W
629
+ L
645
630
  );
646
631
  };
647
- }, []), b(() => {
648
- var t;
649
- return (t = c.current) == null || t.addEventListener(
632
+ }, []), f(() => {
633
+ var n;
634
+ return (n = c.current) == null || n.addEventListener(
650
635
  "initpreviewingbldr",
651
- K
636
+ j
652
637
  ), () => {
653
- var n;
654
- return (n = c.current) == null ? void 0 : n.removeEventListener(
638
+ var i;
639
+ return (i = c.current) == null ? void 0 : i.removeEventListener(
655
640
  "initpreviewingbldr",
656
- K
641
+ j
657
642
  );
658
643
  };
659
- }, []), b(() => {
660
- var t, n;
644
+ }, []), f(() => {
645
+ var n, i;
661
646
  if (P()) {
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;
664
- H({
647
+ if (E() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && H(e.canTrack)) {
648
+ const l = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (i = e.builderContextSignal.content) == null ? void 0 : i.id, h = e.apiKey;
649
+ V({
665
650
  type: "impression",
666
651
  canTrack: !0,
667
652
  contentId: d,
@@ -669,64 +654,64 @@ function Be(e) {
669
654
  variationId: l !== d ? l : void 0
670
655
  });
671
656
  }
672
- Z() && c.current;
657
+ p() && c.current;
673
658
  }
674
- }, []), b(() => {
675
- e.apiKey || p.error(
659
+ }, []), f(() => {
660
+ e.apiKey || ee.error(
676
661
  "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
677
- ), k(), j(), I();
678
- }, []), b(() => {
679
- }, [e.content]), b(() => {
680
- P() && (window.removeEventListener("message", m), window.addEventListener("message", m));
681
- }, [S]), b(() => {
662
+ ), k(), B(), I();
663
+ }, []), f(() => {
664
+ }, [e.content]), f(() => {
665
+ P() && (window.removeEventListener("message", g), window.addEventListener("message", g));
666
+ }, [S]), f(() => {
682
667
  k();
683
668
  }, [
684
- (z = (F = e.builderContextSignal.content) == null ? void 0 : F.data) == null ? void 0 : z.jsCode,
669
+ (F = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : F.jsCode,
685
670
  e.builderContextSignal.rootState
686
- ]), b(() => {
687
- j();
688
- }, [(_ = (M = e.builderContextSignal.content) == null ? void 0 : M.data) == null ? void 0 : _.httpRequests]), b(() => {
671
+ ]), f(() => {
672
+ B();
673
+ }, [(z = (K = e.builderContextSignal.content) == null ? void 0 : K.data) == null ? void 0 : z.httpRequests]), f(() => {
689
674
  I();
690
- }, [e.builderContextSignal.rootState]), b(() => {
691
- e.data && o(e.data);
692
- }, [e.data]), b(() => {
693
- e.locale && o({
675
+ }, [e.builderContextSignal.rootState]), f(() => {
676
+ e.data && r(e.data);
677
+ }, [e.data]), f(() => {
678
+ e.locale && r({
694
679
  locale: e.locale
695
680
  });
696
- }, [e.locale]), b(() => () => {
697
- P() && (window.removeEventListener("message", m), window.removeEventListener(
681
+ }, [e.locale]), f(() => () => {
682
+ P() && (window.removeEventListener("message", g), window.removeEventListener(
698
683
  "builder:component:stateChangeListenerActivated",
699
684
  I
700
685
  ));
701
- }, []), /* @__PURE__ */ i(ue.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(g, { children: /* @__PURE__ */ re(
702
- f,
686
+ }, []), /* @__PURE__ */ t(he.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ se(
687
+ b,
703
688
  {
704
- key: s,
689
+ key: u,
705
690
  ref: c,
706
- onClick: (t) => $(t),
707
- "builder-content-id": (V = e.builderContextSignal.content) == null ? void 0 : V.id,
691
+ onClick: (n) => $(n),
692
+ "builder-content-id": (A = e.builderContextSignal.content) == null ? void 0 : A.id,
708
693
  "builder-model": e.model,
709
694
  ...e.showContent ? {} : {
710
695
  hidden: !0,
711
696
  "aria-hidden": !0
712
697
  },
713
698
  ...e.contentWrapperProps,
714
- className: `variant-${((q = e.content) == null ? void 0 : q.testVariationId) || ((A = e.content) == null ? void 0 : A.id)}`
699
+ className: `variant-${((M = e.content) == null ? void 0 : M.testVariationId) || ((_ = e.content) == null ? void 0 : _.id)}`
715
700
  },
716
701
  e.children
717
702
  ) }) : null });
718
703
  }
719
704
  export {
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
705
+ Ce as B,
706
+ Te as C,
707
+ Ne as E,
708
+ Ie as F,
709
+ we as I,
710
+ Pe as S,
711
+ Le as V,
712
+ Ee as a,
713
+ ke as b,
714
+ Re as c,
715
+ Be as d,
716
+ je as e
732
717
  };