@builder.io/sdk-react-nextjs 0.12.7 → 0.13.0
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.
- package/lib/browser/USE_CLIENT_BUNDLE-159cd63c.cjs +21 -0
- package/lib/browser/{USE_CLIENT_BUNDLE-456ca2b5.js → USE_CLIENT_BUNDLE-21701cae.js} +169 -175
- package/lib/{edge/USE_SERVER_BUNDLE-dbf92938.cjs → browser/USE_SERVER_BUNDLE-316838af.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-dffaa191.js → browser/USE_SERVER_BUNDLE-37ad955b.js} +1 -1
- package/lib/browser/{bundle-56e0b400.js → bundle-2b431a2f.js} +347 -300
- package/lib/browser/{bundle-a408994f.cjs → bundle-f3f9789e.cjs} +19 -19
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +20 -19
- package/lib/{node/USE_CLIENT_BUNDLE-499aeaa2.js → edge/USE_CLIENT_BUNDLE-45eaf3a0.js} +169 -175
- package/lib/edge/USE_CLIENT_BUNDLE-4cfda43e.cjs +21 -0
- package/lib/{node/USE_SERVER_BUNDLE-b3ad9a89.cjs → edge/USE_SERVER_BUNDLE-b7a4b5c9.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-e3da6caa.js → edge/USE_SERVER_BUNDLE-e82f4d04.js} +1 -1
- package/lib/edge/{bundle-97ad81d1.cjs → bundle-27694b25.cjs} +25 -25
- package/lib/edge/{bundle-4bf88f38.js → bundle-85928e24.js} +388 -341
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +20 -19
- package/lib/{edge/USE_CLIENT_BUNDLE-789e694f.js → node/USE_CLIENT_BUNDLE-354a3b9c.js} +169 -175
- package/lib/node/USE_CLIENT_BUNDLE-79508098.cjs +21 -0
- package/lib/{browser/USE_SERVER_BUNDLE-ee4a5d19.cjs → node/USE_SERVER_BUNDLE-2d5ccb94.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-e0f1c15b.js → node/USE_SERVER_BUNDLE-81b76cf3.js} +1 -1
- package/lib/node/{bundle-97b4832a.cjs → bundle-48c4d422.cjs} +9 -9
- package/lib/node/{bundle-d3f89e99.js → bundle-7efdf8b6.js} +64 -17
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +20 -19
- package/package.json +1 -1
- package/types/cjs/components/content-variants/helpers.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/get-content/types.d.ts +2 -2
- package/types/cjs/helpers/preview-lru-cache/get.d.ts +1 -1
- package/types/cjs/helpers/subscribe-to-editor.d.ts +35 -0
- package/types/cjs/server-index.d.ts +18 -3
- package/types/cjs/types/api-version.d.ts +1 -1
- package/types/esm/components/content-variants/helpers.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/get-content/types.d.ts +2 -2
- package/types/esm/helpers/preview-lru-cache/get.d.ts +1 -1
- package/types/esm/helpers/subscribe-to-editor.d.ts +35 -0
- package/types/esm/server-index.d.ts +18 -3
- package/types/esm/types/api-version.d.ts +1 -1
- package/lib/browser/USE_CLIENT_BUNDLE-9d2b983d.cjs +0 -21
- package/lib/edge/USE_CLIENT_BUNDLE-a6a0becc.cjs +0 -21
- package/lib/node/USE_CLIENT_BUNDLE-b2f9be29.cjs +0 -21
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
4
|
-
import { useRef as T, useState as x, useEffect as
|
|
5
|
-
import { p as
|
|
6
|
-
import { useRouter as
|
|
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-85928e24.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-e82f4d04.js";
|
|
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
|
}
|
|
@@ -14,7 +14,7 @@ function we(e) {
|
|
|
14
14
|
TagName: e.link ? e.builderLinkComponent || "a" : "button",
|
|
15
15
|
attributes: {
|
|
16
16
|
...e.attributes,
|
|
17
|
-
[
|
|
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,
|
|
@@ -73,12 +73,12 @@ function Ie(e) {
|
|
|
73
73
|
}
|
|
74
74
|
function Re(e) {
|
|
75
75
|
function c() {
|
|
76
|
-
var
|
|
77
|
-
return "builder-blocks" + ((
|
|
76
|
+
var r;
|
|
77
|
+
return "builder-blocks" + ((r = e.blocks) != null && r.length ? "" : " no-blocks");
|
|
78
78
|
}
|
|
79
79
|
function s() {
|
|
80
|
-
var
|
|
81
|
-
w() && !((
|
|
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 Re(e) {
|
|
|
89
89
|
"*"
|
|
90
90
|
));
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
var
|
|
94
|
-
w() && !((
|
|
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 Re(e) {
|
|
|
110
110
|
"builder-path": e.path,
|
|
111
111
|
"builder-parent-id": e.parent,
|
|
112
112
|
style: e.styleProp,
|
|
113
|
-
onClick: (
|
|
114
|
-
onMouseEnter: (
|
|
115
|
-
onKeyPress: (
|
|
113
|
+
onClick: (r) => s(),
|
|
114
|
+
onMouseEnter: (r) => S(),
|
|
115
|
+
onKeyPress: (r) => s(),
|
|
116
116
|
...e.BlocksWrapperProps,
|
|
117
117
|
children: e.children
|
|
118
118
|
}
|
|
@@ -128,34 +128,34 @@ function Pe(e) {
|
|
|
128
128
|
return /* @__PURE__ */ i("span", { children: e.children });
|
|
129
129
|
}
|
|
130
130
|
function Te(e) {
|
|
131
|
-
var
|
|
131
|
+
var r, u, f, y;
|
|
132
132
|
function c() {
|
|
133
133
|
var m;
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
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
|
-
!(
|
|
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(
|
|
141
|
+
return console.debug("Removed given srcset"), R(l);
|
|
142
142
|
} else if (e.image && !e.srcset)
|
|
143
|
-
return R(
|
|
144
|
-
return R(
|
|
143
|
+
return R(l);
|
|
144
|
+
return R(l);
|
|
145
145
|
}
|
|
146
146
|
function s() {
|
|
147
|
-
var
|
|
148
|
-
return (
|
|
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
|
|
151
|
-
const
|
|
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 ?
|
|
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 Te(e) {
|
|
|
170
170
|
style: {
|
|
171
171
|
objectPosition: e.backgroundPosition || "center",
|
|
172
172
|
objectFit: e.backgroundSize || "cover",
|
|
173
|
-
...
|
|
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 Te(e) {
|
|
|
179
179
|
}
|
|
180
180
|
)
|
|
181
181
|
] }),
|
|
182
|
-
e.aspectRatio && !((u = (
|
|
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 Te(e) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
) }) : null,
|
|
191
|
-
(y = (
|
|
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 {
|
|
@@ -232,29 +232,29 @@ function Ne(e) {
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
function Be(e) {
|
|
235
|
-
const c = T(null), [s,
|
|
236
|
-
return
|
|
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
|
|
241
|
-
for (let
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
if (s.includes(
|
|
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(
|
|
246
|
+
s.push(l.src);
|
|
247
247
|
const m = document.createElement("script");
|
|
248
|
-
m.async = !0, m.src =
|
|
249
|
-
} else if (!
|
|
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(
|
|
254
|
-
if (
|
|
253
|
+
].includes(l.type)) {
|
|
254
|
+
if (r.includes(l.innerText))
|
|
255
255
|
continue;
|
|
256
256
|
try {
|
|
257
|
-
|
|
257
|
+
r.push(l.innerText), new Function(l.innerText)();
|
|
258
258
|
} catch (m) {
|
|
259
259
|
console.warn("`CustomCode`: Error running script:", m);
|
|
260
260
|
}
|
|
@@ -270,28 +270,28 @@ function Be(e) {
|
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
function Le(e) {
|
|
273
|
-
const c = T(null), [s,
|
|
274
|
-
function
|
|
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
|
|
278
|
-
for (let m = 0; m <
|
|
279
|
-
const k =
|
|
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) && !
|
|
284
|
+
} else if (ee(k) && !r.includes(k.innerText))
|
|
285
285
|
try {
|
|
286
|
-
|
|
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
|
|
293
|
-
c.current && !
|
|
294
|
-
}, [c.current,
|
|
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",
|
|
@@ -316,7 +316,7 @@ function je(e) {
|
|
|
316
316
|
);
|
|
317
317
|
}
|
|
318
318
|
function We(e) {
|
|
319
|
-
var
|
|
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 We(e) {
|
|
|
357
357
|
style: {
|
|
358
358
|
width: "100%",
|
|
359
359
|
height: "100%",
|
|
360
|
-
...(
|
|
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 We(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 = (
|
|
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 We(e) {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
) }) : null,
|
|
387
|
-
(y = (
|
|
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 We(e) {
|
|
|
395
395
|
children: e.children
|
|
396
396
|
}
|
|
397
397
|
) }) : null,
|
|
398
|
-
(
|
|
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: {
|
|
@@ -430,80 +430,74 @@ const fe = me({
|
|
|
430
430
|
BlocksWrapper: "div",
|
|
431
431
|
BlocksWrapperProps: {}
|
|
432
432
|
});
|
|
433
|
-
function
|
|
434
|
-
var W, A, F,
|
|
435
|
-
const c = T(null), [s,
|
|
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
|
|
438
|
-
var a,
|
|
439
|
-
const
|
|
437
|
+
function r(n) {
|
|
438
|
+
var a, o;
|
|
439
|
+
const t = {
|
|
440
440
|
...e.builderContextSignal.rootState,
|
|
441
|
-
...
|
|
441
|
+
...n
|
|
442
442
|
};
|
|
443
|
-
e.builderContextSignal.rootSetState ? (
|
|
443
|
+
e.builderContextSignal.rootSetState ? (o = (a = e.builderContextSignal).rootSetState) == null || o.call(a, t) : e.builderContextSignal.rootState = t;
|
|
444
444
|
}
|
|
445
|
-
function u(
|
|
446
|
-
var a,
|
|
447
|
-
const
|
|
445
|
+
function u(n) {
|
|
446
|
+
var a, o, d, v, q;
|
|
447
|
+
const t = {
|
|
448
448
|
...e.builderContextSignal.content,
|
|
449
|
-
...
|
|
449
|
+
...n,
|
|
450
450
|
data: {
|
|
451
451
|
...(a = e.builderContextSignal.content) == null ? void 0 : a.data,
|
|
452
|
-
...
|
|
452
|
+
...n == null ? void 0 : n.data
|
|
453
453
|
},
|
|
454
454
|
meta: {
|
|
455
|
-
...(
|
|
456
|
-
...
|
|
457
|
-
breakpoints: ((d =
|
|
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
|
-
|
|
461
|
-
value:
|
|
462
|
-
key:
|
|
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 [
|
|
468
|
+
const [f, y] = x(
|
|
469
469
|
() => !1
|
|
470
|
-
), [
|
|
470
|
+
), [g, l] = x(
|
|
471
471
|
() => e.contentWrapper || "div"
|
|
472
472
|
);
|
|
473
|
-
function m(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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:
|
|
483
|
+
breakpoints: a
|
|
487
484
|
}
|
|
488
|
-
}),
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
case "builder.contentUpdate": {
|
|
496
|
-
const r = n.data, d = r.key || r.alias || r.entry || r.modelName, g = r.data;
|
|
497
|
-
d === e.model && (u(g), v(s + 1));
|
|
498
|
-
break;
|
|
485
|
+
}), S(s + 1));
|
|
486
|
+
},
|
|
487
|
+
animation: (t) => {
|
|
488
|
+
ae(t);
|
|
489
|
+
},
|
|
490
|
+
contentUpdate: (t) => {
|
|
491
|
+
u(t), S(s + 1);
|
|
499
492
|
}
|
|
500
493
|
}
|
|
494
|
+
})(n);
|
|
501
495
|
}
|
|
502
496
|
function k() {
|
|
503
|
-
var
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
code:
|
|
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,
|
|
507
501
|
context: e.context || {},
|
|
508
502
|
localState: void 0,
|
|
509
503
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -511,26 +505,26 @@ function Ae(e) {
|
|
|
511
505
|
});
|
|
512
506
|
}
|
|
513
507
|
const [C, Se] = x(() => ({})), [N, G] = x(() => !1);
|
|
514
|
-
function Q(
|
|
515
|
-
var
|
|
508
|
+
function Q(n) {
|
|
509
|
+
var t, a;
|
|
516
510
|
if (e.builderContextSignal.content) {
|
|
517
|
-
const
|
|
518
|
-
|
|
511
|
+
const o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
|
|
512
|
+
D({
|
|
519
513
|
type: "click",
|
|
520
|
-
canTrack:
|
|
514
|
+
canTrack: V(e.canTrack),
|
|
521
515
|
contentId: d,
|
|
522
516
|
apiKey: e.apiKey,
|
|
523
|
-
variationId:
|
|
524
|
-
...ce(
|
|
517
|
+
variationId: o !== d ? o : void 0,
|
|
518
|
+
...ce(n),
|
|
525
519
|
unique: !N
|
|
526
520
|
});
|
|
527
521
|
}
|
|
528
522
|
N || G(!0);
|
|
529
523
|
}
|
|
530
|
-
function X(
|
|
531
|
-
return
|
|
524
|
+
function X(n) {
|
|
525
|
+
return n.replace(
|
|
532
526
|
/{{([^}]+)}}/g,
|
|
533
|
-
(
|
|
527
|
+
(t, a) => U({
|
|
534
528
|
code: a,
|
|
535
529
|
context: e.context || {},
|
|
536
530
|
localState: void 0,
|
|
@@ -539,27 +533,27 @@ function Ae(e) {
|
|
|
539
533
|
})
|
|
540
534
|
);
|
|
541
535
|
}
|
|
542
|
-
function Y({ url:
|
|
543
|
-
ue(
|
|
544
|
-
var d,
|
|
545
|
-
const
|
|
536
|
+
function Y({ url: n, key: t }) {
|
|
537
|
+
ue(n).then((a) => a.json()).then((a) => {
|
|
538
|
+
var d, v;
|
|
539
|
+
const o = {
|
|
546
540
|
...e.builderContextSignal.rootState,
|
|
547
|
-
[
|
|
541
|
+
[t]: a
|
|
548
542
|
};
|
|
549
|
-
(
|
|
543
|
+
(v = (d = e.builderContextSignal).rootSetState) == null || v.call(d, o), C[t] = !0;
|
|
550
544
|
}).catch((a) => {
|
|
551
|
-
console.error("error fetching dynamic data",
|
|
545
|
+
console.error("error fetching dynamic data", n, a);
|
|
552
546
|
});
|
|
553
547
|
}
|
|
554
548
|
function B() {
|
|
555
|
-
var
|
|
556
|
-
const
|
|
557
|
-
Object.entries(
|
|
558
|
-
if (d && (!C[
|
|
559
|
-
const
|
|
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);
|
|
560
554
|
Y({
|
|
561
|
-
url:
|
|
562
|
-
key:
|
|
555
|
+
url: v,
|
|
556
|
+
key: o
|
|
563
557
|
});
|
|
564
558
|
}
|
|
565
559
|
});
|
|
@@ -579,8 +573,8 @@ function Ae(e) {
|
|
|
579
573
|
)
|
|
580
574
|
);
|
|
581
575
|
}
|
|
582
|
-
function L(
|
|
583
|
-
|
|
576
|
+
function L(n) {
|
|
577
|
+
S(s + 1), window.addEventListener("message", m), le(), oe({
|
|
584
578
|
...e.locale ? {
|
|
585
579
|
locale: e.locale
|
|
586
580
|
} : {},
|
|
@@ -595,97 +589,97 @@ function Ae(e) {
|
|
|
595
589
|
} : {}
|
|
596
590
|
}), Object.values(
|
|
597
591
|
e.builderContextSignal.componentInfos
|
|
598
|
-
).forEach((
|
|
599
|
-
var
|
|
600
|
-
const a = de(
|
|
601
|
-
(
|
|
592
|
+
).forEach((t) => {
|
|
593
|
+
var o;
|
|
594
|
+
const a = de(t);
|
|
595
|
+
(o = window.parent) == null || o.postMessage(a, "*");
|
|
602
596
|
}), window.addEventListener(
|
|
603
597
|
"builder:component:stateChangeListenerActivated",
|
|
604
598
|
I
|
|
605
599
|
);
|
|
606
600
|
}
|
|
607
|
-
function j(
|
|
608
|
-
const
|
|
601
|
+
function j(n) {
|
|
602
|
+
const t = new URL(location.href).searchParams, a = t.get("builder.preview"), o = t.get(
|
|
609
603
|
`builder.preview.${a}`
|
|
610
|
-
), d =
|
|
611
|
-
a === e.model && d === e.apiKey && (!e.content ||
|
|
604
|
+
), d = t.get("apiKey") || t.get("builder.space");
|
|
605
|
+
a === e.model && d === e.apiKey && (!e.content || o === e.content.id) && se({
|
|
612
606
|
model: e.model,
|
|
613
607
|
apiKey: e.apiKey,
|
|
614
608
|
apiVersion: e.builderContextSignal.apiVersion
|
|
615
|
-
}).then((
|
|
616
|
-
|
|
609
|
+
}).then((v) => {
|
|
610
|
+
v && u(v);
|
|
617
611
|
});
|
|
618
612
|
}
|
|
619
|
-
const Z =
|
|
620
|
-
return
|
|
621
|
-
var
|
|
622
|
-
return (
|
|
613
|
+
const Z = be();
|
|
614
|
+
return b(() => {
|
|
615
|
+
var n;
|
|
616
|
+
return (n = c.current) == null || n.addEventListener(
|
|
623
617
|
"initeditingbldr",
|
|
624
618
|
L
|
|
625
619
|
), () => {
|
|
626
|
-
var
|
|
627
|
-
return (
|
|
620
|
+
var t;
|
|
621
|
+
return (t = c.current) == null ? void 0 : t.removeEventListener(
|
|
628
622
|
"initeditingbldr",
|
|
629
623
|
L
|
|
630
624
|
);
|
|
631
625
|
};
|
|
632
|
-
}, []),
|
|
633
|
-
var
|
|
634
|
-
return (
|
|
626
|
+
}, []), b(() => {
|
|
627
|
+
var n;
|
|
628
|
+
return (n = c.current) == null || n.addEventListener(
|
|
635
629
|
"initpreviewingbldr",
|
|
636
630
|
j
|
|
637
631
|
), () => {
|
|
638
|
-
var
|
|
639
|
-
return (
|
|
632
|
+
var t;
|
|
633
|
+
return (t = c.current) == null ? void 0 : t.removeEventListener(
|
|
640
634
|
"initpreviewingbldr",
|
|
641
635
|
j
|
|
642
636
|
);
|
|
643
637
|
};
|
|
644
|
-
}, []),
|
|
645
|
-
var
|
|
638
|
+
}, []), b(() => {
|
|
639
|
+
var n, t;
|
|
646
640
|
if (P()) {
|
|
647
|
-
if (w() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content &&
|
|
648
|
-
const
|
|
649
|
-
|
|
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({
|
|
650
644
|
type: "impression",
|
|
651
645
|
canTrack: !0,
|
|
652
646
|
contentId: d,
|
|
653
|
-
apiKey:
|
|
654
|
-
variationId:
|
|
647
|
+
apiKey: v,
|
|
648
|
+
variationId: o !== d ? o : void 0
|
|
655
649
|
});
|
|
656
650
|
}
|
|
657
651
|
te() && c.current;
|
|
658
652
|
}
|
|
659
|
-
}, []),
|
|
653
|
+
}, []), b(() => {
|
|
660
654
|
e.apiKey || ne.error(
|
|
661
655
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
662
656
|
), k(), B(), I();
|
|
663
|
-
}, []),
|
|
664
|
-
}, [e.content]),
|
|
657
|
+
}, []), b(() => {
|
|
658
|
+
}, [e.content]), b(() => {
|
|
665
659
|
P() && (window.removeEventListener("message", m), window.addEventListener("message", m));
|
|
666
|
-
}, [
|
|
660
|
+
}, [f]), b(() => {
|
|
667
661
|
k();
|
|
668
|
-
}, [(
|
|
662
|
+
}, [(K = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : K.jsCode]), b(() => {
|
|
669
663
|
B();
|
|
670
|
-
}, [(
|
|
664
|
+
}, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]), b(() => {
|
|
671
665
|
I();
|
|
672
|
-
}, [e.builderContextSignal.rootState]),
|
|
673
|
-
e.data &&
|
|
674
|
-
}, [e.data]),
|
|
675
|
-
e.locale &&
|
|
666
|
+
}, [e.builderContextSignal.rootState]), b(() => {
|
|
667
|
+
e.data && r(e.data);
|
|
668
|
+
}, [e.data]), b(() => {
|
|
669
|
+
e.locale && r({
|
|
676
670
|
locale: e.locale
|
|
677
671
|
});
|
|
678
|
-
}, [e.locale]),
|
|
672
|
+
}, [e.locale]), b(() => () => {
|
|
679
673
|
P() && (window.removeEventListener("message", m), window.removeEventListener(
|
|
680
674
|
"builder:component:stateChangeListenerActivated",
|
|
681
675
|
I
|
|
682
676
|
));
|
|
683
677
|
}, []), /* @__PURE__ */ i(fe.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ ge(
|
|
684
|
-
|
|
678
|
+
g,
|
|
685
679
|
{
|
|
686
680
|
key: s,
|
|
687
681
|
ref: c,
|
|
688
|
-
onClick: (
|
|
682
|
+
onClick: (n) => Q(n),
|
|
689
683
|
"builder-content-id": (z = e.builderContextSignal.content) == null ? void 0 : z.id,
|
|
690
684
|
"builder-model": e.model,
|
|
691
685
|
...e.showContent ? {} : {
|
|
@@ -711,5 +705,5 @@ export {
|
|
|
711
705
|
we as b,
|
|
712
706
|
Te as c,
|
|
713
707
|
je as d,
|
|
714
|
-
|
|
708
|
+
Ke as e
|
|
715
709
|
};
|