@builder.io/sdk-react-nextjs 0.7.3 → 0.7.4

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