@builder.io/sdk-react-nextjs 0.12.1 → 0.12.3

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