@builder.io/sdk-react 2.0.28 → 2.0.30
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/blocks-exports.cjs +18 -18
- package/lib/browser/blocks-exports.mjs +819 -814
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-ffd47885.js → server-entry-d133a206.js} +104 -95
- package/lib/browser/server-entry-d4ea1a12.cjs +2 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-616460c1.js → accordion-359367e6.js} +5 -3
- package/lib/edge/{accordion-7ef6a928.cjs → accordion-93512a19.cjs} +1 -1
- package/lib/edge/{blocks-896a56b0.cjs → blocks-44a0617b.cjs} +3 -3
- package/lib/edge/{blocks-dd91ae28.js → blocks-d7ba8f6a.js} +63 -57
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-1fa8b647.cjs → button-0ae65c1d.cjs} +1 -1
- package/lib/edge/{button-f917a1c0.js → button-ae26a553.js} +2 -2
- package/lib/edge/{columns-dacb342b.js → columns-957c0468.js} +20 -20
- package/lib/edge/{columns-5756d7b8.cjs → columns-f7da8908.cjs} +3 -3
- package/lib/edge/{content-variants-afc4a718.cjs → content-variants-9bb0b7e9.cjs} +4 -4
- package/lib/edge/{content-variants-cd80b703.js → content-variants-d8a859a2.js} +118 -118
- package/lib/edge/{evaluate-2fcda9ec.cjs → evaluate-21c48a1d.cjs} +1 -1
- package/lib/edge/{evaluate-17c2cadd.js → evaluate-8e8c9fec.js} +1 -1
- package/lib/edge/form-0b09120c.cjs +1 -0
- package/lib/edge/{form-dc7f56c9.js → form-68fc4d5a.js} +30 -33
- package/lib/edge/{get-class-prop-name-5437ca23.js → get-class-prop-name-a6f0f92d.js} +1 -1
- package/lib/edge/{get-class-prop-name-2ce20e98.cjs → get-class-prop-name-ffeda28e.cjs} +1 -1
- package/lib/edge/{img-35a1343f.cjs → img-89e32a84.cjs} +1 -1
- package/lib/edge/{img-d187da14.js → img-912b190b.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-9a6498fd.cjs → input-5ff8ae2e.cjs} +1 -1
- package/lib/edge/{input-38f565ce.js → input-96ba83eb.js} +1 -1
- package/lib/edge/{select-135b7397.cjs → select-5f5fed1c.cjs} +1 -1
- package/lib/edge/{select-6cb0b4b7.js → select-f66026e1.js} +1 -1
- package/lib/edge/{server-entry-216eb1bf.js → server-entry-e26008c1.js} +110 -101
- package/lib/edge/server-entry-f09ee4f4.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-d692126c.js → slot-d09faa0a.js} +4 -4
- package/lib/edge/{slot-b0728030.cjs → slot-d3473421.cjs} +1 -1
- package/lib/edge/{symbol-df30241a.js → symbol-285d196c.js} +2 -2
- package/lib/edge/{symbol-0ac2655e.cjs → symbol-ebccca9b.cjs} +1 -1
- package/lib/edge/{tabs-b925777d.js → tabs-39d86f86.js} +15 -15
- package/lib/edge/tabs-61c59e0f.cjs +1 -0
- package/lib/edge/{text-0f85a76c.cjs → text-40a616f5.cjs} +1 -1
- package/lib/edge/{text-337389ba.js → text-dce27428.js} +2 -2
- package/lib/node/blocks-exports.cjs +20 -20
- package/lib/node/blocks-exports.mjs +802 -797
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-8e901e75.cjs +2 -0
- package/lib/node/{server-entry-ca0dcb45.js → server-entry-c7147616.js} +104 -95
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-2100f4f5.js → setIvm-5ab140ad.js} +1 -1
- package/lib/node/{setIvm-2d47478e.cjs → setIvm-a85e255e.cjs} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-fd3ca2a8.cjs → should-force-browser-runtime-in-node-16ceec99.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-a77d7cfc.js → should-force-browser-runtime-in-node-1d3a044a.js} +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/log-fetch.d.ts +1 -0
- package/lib/browser/server-entry-7260e494.cjs +0 -2
- package/lib/edge/form-efce5c78.cjs +0 -1
- package/lib/edge/server-entry-3e6518b6.cjs +0 -2
- package/lib/edge/tabs-47ed7dde.cjs +0 -1
- package/lib/node/server-entry-3e017173.cjs +0 -2
|
@@ -3,7 +3,7 @@ const b = "react", te = (e) => {
|
|
|
3
3
|
return e.forEach((n, r) => {
|
|
4
4
|
t[r] = n;
|
|
5
5
|
}), t;
|
|
6
|
-
},
|
|
6
|
+
}, U = (e) => e instanceof URLSearchParams ? te(e) : e, L = (e) => typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : new URLSearchParams(e).toString();
|
|
7
7
|
function c() {
|
|
8
8
|
return typeof window != "undefined" && typeof document != "undefined";
|
|
9
9
|
}
|
|
@@ -12,13 +12,13 @@ function ne() {
|
|
|
12
12
|
}
|
|
13
13
|
function re(e) {
|
|
14
14
|
return ne() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
15
|
-
|
|
15
|
+
L(e || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Xe(e) {
|
|
18
18
|
const t = e || (c() ? window.location.search : void 0);
|
|
19
|
-
return t ?
|
|
19
|
+
return t ? L(t).indexOf("builder.preview=") !== -1 : !1;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Je = (e) => ({
|
|
22
22
|
type: "builder.registerComponent",
|
|
23
23
|
data: V(e)
|
|
24
24
|
}), oe = (e) => {
|
|
@@ -48,7 +48,7 @@ function se(e, t) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
const A = {};
|
|
51
|
-
function
|
|
51
|
+
function ze(e) {
|
|
52
52
|
if (c()) {
|
|
53
53
|
Object.assign(A, e);
|
|
54
54
|
const t = {
|
|
@@ -58,10 +58,10 @@ function Je(e) {
|
|
|
58
58
|
parent.postMessage(t, "*");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
const T = "builder.", ie = "options.",
|
|
61
|
+
const T = "builder.", ie = "options.", F = (e) => {
|
|
62
62
|
if (!e)
|
|
63
63
|
return {};
|
|
64
|
-
const t =
|
|
64
|
+
const t = U(e), n = {};
|
|
65
65
|
return Object.keys(t).forEach((r) => {
|
|
66
66
|
if (r.startsWith(T)) {
|
|
67
67
|
const o = r.replace(T, "").replace(ie, "");
|
|
@@ -72,16 +72,16 @@ const T = "builder.", ie = "options.", M = (e) => {
|
|
|
72
72
|
if (!c())
|
|
73
73
|
return {};
|
|
74
74
|
const e = new URLSearchParams(window.location.search);
|
|
75
|
-
return
|
|
76
|
-
}, v = "[Builder.io]: ",
|
|
75
|
+
return F(e);
|
|
76
|
+
}, v = "[Builder.io]: ", l = {
|
|
77
77
|
log: (...e) => console.log(v, ...e),
|
|
78
78
|
error: (...e) => console.error(v, ...e),
|
|
79
79
|
warn: (...e) => console.warn(v, ...e),
|
|
80
80
|
debug: (...e) => console.debug(v, ...e)
|
|
81
|
-
},
|
|
81
|
+
}, M = "2.0.30", N = () => ({
|
|
82
82
|
"X-Builder-SDK": b,
|
|
83
83
|
"X-Builder-SDK-GEN": "2",
|
|
84
|
-
"X-Builder-SDK-Version":
|
|
84
|
+
"X-Builder-SDK-Version": M
|
|
85
85
|
}), m = (e) => e != null, ce = (e) => {
|
|
86
86
|
if (e === "localhost" || e === "127.0.0.1")
|
|
87
87
|
return e;
|
|
@@ -95,7 +95,7 @@ const T = "builder.", ie = "options.", M = (e) => {
|
|
|
95
95
|
try {
|
|
96
96
|
return t ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${e}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
97
97
|
} catch (r) {
|
|
98
|
-
|
|
98
|
+
l.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
}, K = async (e) => D(e), ue = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(m).join("; "), de = [["secure", ""], ["SameSite", "None"]], le = ({
|
|
@@ -121,7 +121,7 @@ const T = "builder.", ie = "options.", M = (e) => {
|
|
|
121
121
|
});
|
|
122
122
|
document.cookie = o;
|
|
123
123
|
} catch (o) {
|
|
124
|
-
|
|
124
|
+
l.warn("[COOKIE] SET error: ", (o == null ? void 0 : o.message) || o);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
function fe() {
|
|
@@ -158,13 +158,13 @@ const $ = "builderSessionId", he = async ({
|
|
|
158
158
|
name: $,
|
|
159
159
|
value: e,
|
|
160
160
|
canTrack: t
|
|
161
|
-
}),
|
|
161
|
+
}), G = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, me = ({
|
|
162
162
|
key: e,
|
|
163
163
|
canTrack: t
|
|
164
164
|
}) => {
|
|
165
165
|
var n;
|
|
166
166
|
try {
|
|
167
|
-
return t ? (n =
|
|
167
|
+
return t ? (n = G()) == null ? void 0 : n.getItem(e) : void 0;
|
|
168
168
|
} catch (r) {
|
|
169
169
|
console.debug("[LocalStorage] GET error: ", r);
|
|
170
170
|
return;
|
|
@@ -176,17 +176,17 @@ const $ = "builderSessionId", he = async ({
|
|
|
176
176
|
}) => {
|
|
177
177
|
var r;
|
|
178
178
|
try {
|
|
179
|
-
t && ((r =
|
|
179
|
+
t && ((r = G()) == null || r.setItem(e, n));
|
|
180
180
|
} catch (o) {
|
|
181
181
|
console.debug("[LocalStorage] SET error: ", o);
|
|
182
182
|
}
|
|
183
|
-
},
|
|
183
|
+
}, _ = "builderVisitorId", Se = ({
|
|
184
184
|
canTrack: e
|
|
185
185
|
}) => {
|
|
186
186
|
if (!e)
|
|
187
187
|
return;
|
|
188
188
|
const t = me({
|
|
189
|
-
key:
|
|
189
|
+
key: _,
|
|
190
190
|
canTrack: e
|
|
191
191
|
});
|
|
192
192
|
if (m(t))
|
|
@@ -202,17 +202,22 @@ const $ = "builderSessionId", he = async ({
|
|
|
202
202
|
id: e,
|
|
203
203
|
canTrack: t
|
|
204
204
|
}) => ye({
|
|
205
|
-
key:
|
|
205
|
+
key: _,
|
|
206
206
|
value: e,
|
|
207
207
|
canTrack: t
|
|
208
|
-
})
|
|
208
|
+
});
|
|
209
|
+
function ve(e) {
|
|
210
|
+
var t;
|
|
211
|
+
typeof process != "undefined" && ((t = process.env) != null && t.DEBUG) && String(process.env.DEBUG) == "true" && l.log(e);
|
|
212
|
+
}
|
|
213
|
+
const Ie = () => {
|
|
209
214
|
if (c()) {
|
|
210
215
|
const e = new URL(location.href);
|
|
211
216
|
return e.pathname === "" && (e.pathname = "/"), e;
|
|
212
217
|
} else
|
|
213
218
|
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
214
|
-
},
|
|
215
|
-
const e =
|
|
219
|
+
}, ke = () => typeof navigator == "object" && navigator.userAgent || "", Ee = () => {
|
|
220
|
+
const e = ke(), t = {
|
|
216
221
|
Android() {
|
|
217
222
|
return e.match(/Android/i);
|
|
218
223
|
},
|
|
@@ -231,13 +236,13 @@ const $ = "builderSessionId", he = async ({
|
|
|
231
236
|
any() {
|
|
232
237
|
return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || b === "reactNative";
|
|
233
238
|
}
|
|
234
|
-
}, n = e.match(/Tablet|iPad/i), r =
|
|
239
|
+
}, n = e.match(/Tablet|iPad/i), r = Ie();
|
|
235
240
|
return {
|
|
236
241
|
urlPath: r == null ? void 0 : r.pathname,
|
|
237
242
|
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
238
243
|
device: n ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
239
244
|
};
|
|
240
|
-
},
|
|
245
|
+
}, Oe = async ({
|
|
241
246
|
canTrack: e
|
|
242
247
|
}) => {
|
|
243
248
|
if (!e)
|
|
@@ -254,7 +259,7 @@ const $ = "builderSessionId", he = async ({
|
|
|
254
259
|
sessionId: t,
|
|
255
260
|
visitorId: n
|
|
256
261
|
};
|
|
257
|
-
},
|
|
262
|
+
}, Pe = async ({
|
|
258
263
|
type: e,
|
|
259
264
|
canTrack: t,
|
|
260
265
|
apiKey: n,
|
|
@@ -268,46 +273,49 @@ const $ = "builderSessionId", he = async ({
|
|
|
268
273
|
url: location.href,
|
|
269
274
|
...r
|
|
270
275
|
},
|
|
271
|
-
...await
|
|
276
|
+
...await Oe({
|
|
272
277
|
canTrack: t
|
|
273
278
|
}),
|
|
274
|
-
userAttributes:
|
|
279
|
+
userAttributes: Ee(),
|
|
275
280
|
ownerId: n
|
|
276
281
|
}
|
|
277
282
|
});
|
|
278
|
-
async function
|
|
283
|
+
async function Ce({
|
|
279
284
|
apiHost: e,
|
|
280
285
|
...t
|
|
281
286
|
}) {
|
|
282
287
|
if (!t.apiKey) {
|
|
283
|
-
|
|
288
|
+
l.error("Missing API key for track call. Please provide your API key.");
|
|
284
289
|
return;
|
|
285
290
|
}
|
|
286
|
-
|
|
291
|
+
if (!t.canTrack || re() || !(c() || b === "reactNative"))
|
|
292
|
+
return;
|
|
293
|
+
const r = `${e || "https://cdn.builder.io"}/api/v1/track`;
|
|
294
|
+
return ve(r), fetch(r, {
|
|
287
295
|
method: "POST",
|
|
288
296
|
body: JSON.stringify({
|
|
289
|
-
events: [await
|
|
297
|
+
events: [await Pe(t)]
|
|
290
298
|
}),
|
|
291
299
|
headers: {
|
|
292
300
|
"content-type": "application/json",
|
|
293
|
-
...
|
|
301
|
+
...N()
|
|
294
302
|
},
|
|
295
303
|
mode: "cors"
|
|
296
|
-
}).catch((
|
|
297
|
-
console.error("Failed to track: ",
|
|
304
|
+
}).catch((o) => {
|
|
305
|
+
console.error("Failed to track: ", o);
|
|
298
306
|
});
|
|
299
307
|
}
|
|
300
|
-
const
|
|
308
|
+
const qe = (e) => Ce({
|
|
301
309
|
...e,
|
|
302
310
|
canTrack: !0
|
|
303
|
-
}),
|
|
311
|
+
}), xe = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
304
312
|
function H(e, t) {
|
|
305
313
|
if (!t.origin.startsWith("http") && !t.origin.startsWith("https"))
|
|
306
314
|
return !1;
|
|
307
315
|
const n = new URL(t.origin), r = n.hostname;
|
|
308
|
-
return (e ||
|
|
316
|
+
return (e || xe).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
309
317
|
}
|
|
310
|
-
const
|
|
318
|
+
const Qe = () => {
|
|
311
319
|
se("insertMenu", {
|
|
312
320
|
name: "_default",
|
|
313
321
|
default: !0,
|
|
@@ -330,14 +338,14 @@ const qe = () => {
|
|
|
330
338
|
}]
|
|
331
339
|
});
|
|
332
340
|
};
|
|
333
|
-
let
|
|
334
|
-
const
|
|
341
|
+
let B = !1;
|
|
342
|
+
const Ae = (e = {}) => {
|
|
335
343
|
var t, n;
|
|
336
|
-
|
|
344
|
+
B || (B = !0, c() && ((t = window.parent) == null || t.postMessage({
|
|
337
345
|
type: "builder.sdkInfo",
|
|
338
346
|
data: {
|
|
339
347
|
target: b,
|
|
340
|
-
version:
|
|
348
|
+
version: M,
|
|
341
349
|
supportsPatchUpdates: !1,
|
|
342
350
|
// Supports builder-model="..." attribute which is needed to
|
|
343
351
|
// scope our '+ add block' button styling
|
|
@@ -392,7 +400,7 @@ const xe = (e = {}) => {
|
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
402
|
})));
|
|
395
|
-
},
|
|
403
|
+
}, Te = ({
|
|
396
404
|
model: e,
|
|
397
405
|
trustedHosts: t,
|
|
398
406
|
callbacks: n
|
|
@@ -418,12 +426,12 @@ const xe = (e = {}) => {
|
|
|
418
426
|
break;
|
|
419
427
|
}
|
|
420
428
|
}
|
|
421
|
-
},
|
|
429
|
+
}, Ye = (e, t, n) => {
|
|
422
430
|
if (!c)
|
|
423
|
-
return
|
|
431
|
+
return l.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
424
432
|
};
|
|
425
|
-
|
|
426
|
-
const r =
|
|
433
|
+
Ae();
|
|
434
|
+
const r = Te({
|
|
427
435
|
callbacks: {
|
|
428
436
|
contentUpdate: t,
|
|
429
437
|
animation: () => {
|
|
@@ -437,12 +445,12 @@ const xe = (e = {}) => {
|
|
|
437
445
|
return window.addEventListener("message", r), () => {
|
|
438
446
|
window.removeEventListener("message", r);
|
|
439
447
|
};
|
|
440
|
-
},
|
|
448
|
+
}, Be = "builder.tests", E = (e) => `${Be}.${e}`, Re = ({
|
|
441
449
|
contentId: e
|
|
442
450
|
}) => K({
|
|
443
451
|
name: E(e),
|
|
444
452
|
canTrack: !0
|
|
445
|
-
}),
|
|
453
|
+
}), Ue = ({
|
|
446
454
|
contentId: e
|
|
447
455
|
}) => D({
|
|
448
456
|
name: E(e),
|
|
@@ -454,7 +462,7 @@ const xe = (e = {}) => {
|
|
|
454
462
|
name: E(e),
|
|
455
463
|
value: t,
|
|
456
464
|
canTrack: !0
|
|
457
|
-
}), X = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0,
|
|
465
|
+
}), X = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0, Ve = ({
|
|
458
466
|
id: e,
|
|
459
467
|
variations: t
|
|
460
468
|
}) => {
|
|
@@ -468,12 +476,12 @@ const xe = (e = {}) => {
|
|
|
468
476
|
}
|
|
469
477
|
return e;
|
|
470
478
|
}, J = (e) => {
|
|
471
|
-
const t =
|
|
479
|
+
const t = Ve(e);
|
|
472
480
|
return Le({
|
|
473
481
|
contentId: e.id,
|
|
474
482
|
value: t
|
|
475
483
|
}).catch((n) => {
|
|
476
|
-
|
|
484
|
+
l.error("could not store A/B test variation: ", n);
|
|
477
485
|
}), t;
|
|
478
486
|
}, z = ({
|
|
479
487
|
item: e,
|
|
@@ -489,7 +497,7 @@ const xe = (e = {}) => {
|
|
|
489
497
|
testVariationId: n.id,
|
|
490
498
|
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
491
499
|
};
|
|
492
|
-
},
|
|
500
|
+
}, Ze = ({
|
|
493
501
|
item: e,
|
|
494
502
|
canTrack: t
|
|
495
503
|
}) => {
|
|
@@ -499,7 +507,7 @@ const xe = (e = {}) => {
|
|
|
499
507
|
return;
|
|
500
508
|
if (!X(e))
|
|
501
509
|
return e;
|
|
502
|
-
const n =
|
|
510
|
+
const n = Ue({
|
|
503
511
|
contentId: e.id
|
|
504
512
|
}) || J({
|
|
505
513
|
variations: e.variations,
|
|
@@ -512,7 +520,7 @@ const xe = (e = {}) => {
|
|
|
512
520
|
...e,
|
|
513
521
|
...r
|
|
514
522
|
};
|
|
515
|
-
},
|
|
523
|
+
}, Fe = async ({
|
|
516
524
|
item: e,
|
|
517
525
|
canTrack: t
|
|
518
526
|
}) => {
|
|
@@ -535,14 +543,14 @@ const xe = (e = {}) => {
|
|
|
535
543
|
function Ne() {
|
|
536
544
|
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
537
545
|
}
|
|
538
|
-
function
|
|
546
|
+
function De() {
|
|
539
547
|
const e = Ne().fetch;
|
|
540
548
|
if (typeof e == "undefined")
|
|
541
549
|
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
542
550
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
543
551
|
return e;
|
|
544
552
|
}
|
|
545
|
-
const
|
|
553
|
+
const Ke = De();
|
|
546
554
|
function k(e, t = null, n = ".") {
|
|
547
555
|
return Object.keys(e).reduce((r, o) => {
|
|
548
556
|
const s = e[o], i = [t, o].filter(Boolean).join(n);
|
|
@@ -562,7 +570,7 @@ function q(e, t, n = {}) {
|
|
|
562
570
|
}
|
|
563
571
|
return n;
|
|
564
572
|
}
|
|
565
|
-
const
|
|
573
|
+
const je = "v3", R = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e) => {
|
|
566
574
|
const {
|
|
567
575
|
limit: t = 30,
|
|
568
576
|
userAttributes: n,
|
|
@@ -571,7 +579,7 @@ const Ke = "v3", B = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e)
|
|
|
571
579
|
apiKey: s,
|
|
572
580
|
enrich: i,
|
|
573
581
|
locale: u,
|
|
574
|
-
apiVersion: y =
|
|
582
|
+
apiVersion: y = je,
|
|
575
583
|
fields: p,
|
|
576
584
|
omit: I,
|
|
577
585
|
offset: d,
|
|
@@ -586,42 +594,42 @@ const Ke = "v3", B = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e)
|
|
|
586
594
|
if (!["v3"].includes(y))
|
|
587
595
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);
|
|
588
596
|
const Y = t !== 1, Z = Q || "https://cdn.builder.io", a = new URL(`${Z}/api/${y}/content/${o}`);
|
|
589
|
-
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(Y)), a.searchParams.set("includeRefs", String(!0)), u && a.searchParams.set("locale", u), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", I || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(d) && d > -1 && a.searchParams.set("offset", String(Math.floor(d))), typeof P == "boolean" && a.searchParams.set("includeUnpublished", String(P)), h &&
|
|
590
|
-
const
|
|
597
|
+
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(Y)), a.searchParams.set("includeRefs", String(!0)), u && a.searchParams.set("locale", u), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", I || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(d) && d > -1 && a.searchParams.set("offset", String(Math.floor(d))), typeof P == "boolean" && a.searchParams.set("includeUnpublished", String(P)), h && R(h) && a.searchParams.set("cacheSeconds", String(h)), g && R(g) && a.searchParams.set("staleCacheSeconds", String(g)), S) {
|
|
598
|
+
const f = k({
|
|
591
599
|
sort: S
|
|
592
600
|
});
|
|
593
|
-
for (const w in
|
|
594
|
-
a.searchParams.set(w, JSON.stringify(
|
|
601
|
+
for (const w in f)
|
|
602
|
+
a.searchParams.set(w, JSON.stringify(f[w]));
|
|
595
603
|
}
|
|
596
604
|
const ee = {
|
|
597
605
|
...ae(),
|
|
598
|
-
...
|
|
606
|
+
...U(e.options || {})
|
|
599
607
|
}, C = k(ee);
|
|
600
|
-
for (const
|
|
601
|
-
a.searchParams.set(
|
|
608
|
+
for (const f in C)
|
|
609
|
+
a.searchParams.set(f, String(C[f]));
|
|
602
610
|
if (n && a.searchParams.set("userAttributes", JSON.stringify(n)), r) {
|
|
603
|
-
const
|
|
611
|
+
const f = q({
|
|
604
612
|
query: r
|
|
605
613
|
});
|
|
606
|
-
for (const w in
|
|
607
|
-
a.searchParams.set(w, JSON.stringify(
|
|
614
|
+
for (const w in f)
|
|
615
|
+
a.searchParams.set(w, JSON.stringify(f[w]));
|
|
608
616
|
}
|
|
609
617
|
return a;
|
|
610
|
-
},
|
|
611
|
-
async function
|
|
612
|
-
const t = await
|
|
618
|
+
}, We = (e) => "results" in e;
|
|
619
|
+
async function $e(e) {
|
|
620
|
+
const t = await He({
|
|
613
621
|
...e,
|
|
614
622
|
limit: 1
|
|
615
623
|
});
|
|
616
624
|
return t && t[0] || null;
|
|
617
625
|
}
|
|
618
|
-
const
|
|
626
|
+
const Ge = async (e) => {
|
|
619
627
|
var i, u;
|
|
620
|
-
const t = O(e), n = (i = e.fetch) != null ? i :
|
|
628
|
+
const t = O(e), n = (i = e.fetch) != null ? i : Ke, r = {
|
|
621
629
|
...e.fetchOptions,
|
|
622
630
|
headers: {
|
|
623
631
|
...(u = e.fetchOptions) == null ? void 0 : u.headers,
|
|
624
|
-
...
|
|
632
|
+
...N()
|
|
625
633
|
}
|
|
626
634
|
};
|
|
627
635
|
return await (await n(t.href, r)).json();
|
|
@@ -632,29 +640,29 @@ const $e = async (e) => {
|
|
|
632
640
|
try {
|
|
633
641
|
const o = [];
|
|
634
642
|
for (const s of t.results)
|
|
635
|
-
o.push(await
|
|
643
|
+
o.push(await Fe({
|
|
636
644
|
item: s,
|
|
637
645
|
canTrack: r
|
|
638
646
|
}));
|
|
639
647
|
t.results = o;
|
|
640
648
|
} catch (o) {
|
|
641
|
-
|
|
649
|
+
l.error("Could not process A/B tests. ", o);
|
|
642
650
|
}
|
|
643
651
|
return t.results;
|
|
644
652
|
};
|
|
645
|
-
async function
|
|
653
|
+
async function He(e) {
|
|
646
654
|
try {
|
|
647
|
-
const t = O(e), n = await
|
|
648
|
-
return
|
|
655
|
+
const t = O(e), n = await Ge(e);
|
|
656
|
+
return We(n) ? _e(e, n) : (l.error("Error fetching data. ", {
|
|
649
657
|
url: t,
|
|
650
658
|
content: n,
|
|
651
659
|
options: e
|
|
652
660
|
}), null);
|
|
653
661
|
} catch (t) {
|
|
654
|
-
return
|
|
662
|
+
return l.error("Error fetching data. ", t), null;
|
|
655
663
|
}
|
|
656
664
|
}
|
|
657
|
-
const
|
|
665
|
+
const et = async (e) => {
|
|
658
666
|
var r, o, s;
|
|
659
667
|
const t = e.path || ((r = e.url) == null ? void 0 : r.pathname) || ((o = e.userAttributes) == null ? void 0 : o.urlPath), n = {
|
|
660
668
|
...e,
|
|
@@ -666,37 +674,38 @@ const Ze = async (e) => {
|
|
|
666
674
|
urlPath: t
|
|
667
675
|
} : {}
|
|
668
676
|
},
|
|
669
|
-
options:
|
|
677
|
+
options: F(e.searchParams || ((s = e.url) == null ? void 0 : s.searchParams) || e.options)
|
|
670
678
|
};
|
|
671
679
|
return {
|
|
672
680
|
apiKey: n.apiKey,
|
|
673
681
|
model: n.model,
|
|
674
|
-
content: await
|
|
682
|
+
content: await $e(n)
|
|
675
683
|
};
|
|
676
684
|
};
|
|
677
685
|
export {
|
|
678
686
|
b as TARGET,
|
|
679
687
|
_e as _processContentResult,
|
|
680
|
-
|
|
688
|
+
Ce as _track,
|
|
681
689
|
m as checkIsDefined,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
690
|
+
Te as createEditorListener,
|
|
691
|
+
Je as createRegisterComponentMessage,
|
|
692
|
+
et as fetchBuilderProps,
|
|
693
|
+
He as fetchEntries,
|
|
694
|
+
$e as fetchOneEntry,
|
|
695
|
+
F as getBuilderSearchParams,
|
|
688
696
|
Me as getDefaultCanTrack,
|
|
689
|
-
|
|
690
|
-
|
|
697
|
+
Ee as getUserAttributes,
|
|
698
|
+
Ze as handleABTestingSync,
|
|
691
699
|
c as isBrowser,
|
|
692
700
|
re as isEditing,
|
|
693
|
-
|
|
694
|
-
|
|
701
|
+
Xe as isPreviewing,
|
|
702
|
+
ve as logFetch,
|
|
703
|
+
l as logger,
|
|
695
704
|
se as register,
|
|
696
|
-
|
|
705
|
+
Qe as registerInsertMenu,
|
|
697
706
|
V as serializeIncludingFunctions,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
707
|
+
ze as setEditorSettings,
|
|
708
|
+
Ae as setupBrowserForEditing,
|
|
709
|
+
Ye as subscribeToEditor,
|
|
710
|
+
qe as track
|
|
702
711
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const y="react",fe=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},V=e=>e instanceof URLSearchParams?fe(e):e,F=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function c(){return typeof window!="undefined"&&typeof document!="undefined"}function ge(){return c()&&window.self!==window.top}function M(e){return ge()&&F(e||window.location.search).indexOf("builder.frameEditing=")!==-1}function he(e){const t=e||(c()?window.location.search:void 0);return t?F(t).indexOf("builder.preview=")!==-1:!1}const pe=e=>({type:"builder.registerComponent",data:k(e)}),me=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`};function k(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?me(n):n))}const x={};function D(e,t){e==="plugin"&&(t=k(t));let n=x[e];if(n||(n=x[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const B={};function ye(e){if(c()){Object.assign(B,e);const t={type:"builder.settingsChange",data:B};parent.postMessage(t,"*")}}const R="builder.",Se="options.",P=e=>{if(!e)return{};const t=V(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(R)){const o=r.replace(R,"").replace(Se,"");n[o]=t[r]}}),n},we=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},v="[Builder.io]: ",d={log:(...e)=>console.log(v,...e),error:(...e)=>console.error(v,...e),warn:(...e)=>console.warn(v,...e),debug:(...e)=>console.debug(v,...e)},N="2.0.30",K=()=>({"X-Builder-SDK":y,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":N}),p=e=>e!=null,be=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},j=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},W=async e=>j(e),ve=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),Ie=[["secure",""],["SameSite","None"]],Ee=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?Ie:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",be(window.location.hostname)],...o];return ve(i)},$=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Ee({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function ke(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function G(){return ke().replace(/-/g,"")}const _="builderSessionId",Pe=async({canTrack:e})=>{if(!e)return;const t=await W({name:_,canTrack:e});if(p(t))return t;{const n=Oe();return Ce({id:n,canTrack:e}),n}},Oe=()=>G(),Ce=({id:e,canTrack:t})=>$({name:_,value:e,canTrack:t}),H=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Ae=({key:e,canTrack:t})=>{var n;try{return t?(n=H())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Te=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=H())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},X="builderVisitorId",xe=({canTrack:e})=>{if(!e)return;const t=Ae({key:X,canTrack:e});if(p(t))return t;{const n=Be();return Re({id:n,canTrack:e}),n}},Be=()=>G(),Re=({id:e,canTrack:t})=>Te({key:X,value:e,canTrack:t});function z(e){var t;typeof process!="undefined"&&((t=process.env)!=null&&t.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(e)}const Ue=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Le=()=>typeof navigator=="object"&&navigator.userAgent||"",J=()=>{const e=Le(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||y==="reactNative"}},n=e.match(/Tablet|iPad/i),r=Ue();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},Ve=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Pe({canTrack:e}),n=xe({canTrack:e});return{sessionId:t,visitorId:n}},Fe=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Ve({canTrack:t}),userAttributes:J(),ownerId:n}});async function q({apiHost:e,...t}){if(!t.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!t.canTrack||M()||!(c()||y==="reactNative"))return;const r=`${e||"https://cdn.builder.io"}/api/v1/track`;return z(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await Fe(t)]}),headers:{"content-type":"application/json",...K()},mode:"cors"}).catch(o=>{console.error("Failed to track: ",o)})}const Me=e=>q({...e,canTrack:!0}),De=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Q(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||De).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Ne=()=>{D("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let U=!1;const Y=(e={})=>{var t,n;U||(U=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:y,version:N,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,i;if(!Q(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,S=o.data.arguments||[],m=o.data.id,I=new Function(u);let l,g=null;try{l=I.apply(null,S)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:m}},"*");break}}})))},Z=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!Q(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,i=s.key||s.alias||s.entry||s.modelName,u=s.data;i===e&&n.contentUpdate(u);break}}},Ke=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};Y();const r=Z({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},je="builder.tests",O=e=>`${je}.${e}`,We=({contentId:e})=>W({name:O(e),canTrack:!0}),$e=({contentId:e})=>j({name:O(e),canTrack:!0}),Ge=({contentId:e,value:t})=>$({name:O(e),value:t,canTrack:!0}),ee=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,_e=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const i=(o=t[s])==null?void 0:o.testRatio;if(n+=i,r<n)return s}return e},te=e=>{const t=_e(e);return Ge({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},ne=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},He=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!ee(e))return e;const n=$e({contentId:e.id})||te({variations:e.variations,id:e.id}),r=ne({item:e,testGroupId:n});return{...e,...r}},Xe=async({item:e,canTrack:t})=>{if(!t||!ee(e))return e;const r=await We({contentId:e.id})||te({variations:e.variations,id:e.id}),o=ne({item:e,testGroupId:r});return{...e,...o}},re=e=>p(e)?e:!0;function ze(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Je(){const e=ze().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const qe=Je();function E(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],i=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...E(s,i,n)}:{...r,[i]:s}},{})}function oe(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(i=>i.startsWith("$"))?oe(o,s,n):n[s]=o}return n}const Qe="v3",L=e=>typeof e=="number"&&!isNaN(e)&&e>=0,C=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:S=Qe,fields:m,omit:I,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:A,apiHost:ce}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ue=t!==1,de=ce||"https://cdn.builder.io",a=new URL(`${de}/api/${S}/content/${o}`);if(a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(ue)),a.searchParams.set("includeRefs",String(!0)),u&&a.searchParams.set("locale",u),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",I||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof A=="boolean"&&a.searchParams.set("includeUnpublished",String(A)),g&&L(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&L(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=E({sort:w});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}const le={...we(),...V(e.options||{})},T=E(le);for(const f in T)a.searchParams.set(f,String(T[f]));if(n&&a.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=oe({query:r});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}return a},Ye=e=>"results"in e;async function se(e){const t=await ae({...e,limit:1});return t&&t[0]||null}const Ze=async e=>{var i,u;const t=C(e),n=(i=e.fetch)!=null?i:qe,r={...e.fetchOptions,headers:{...(u=e.fetchOptions)==null?void 0:u.headers,...K()}};return await(await n(t.href,r)).json()},ie=async(e,t,n=C(e))=>{const r=re(e.canTrack);if(n.search.includes("preview="),!r||!(c()||y==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await Xe({item:s,canTrack:r}));t.results=o}catch(o){d.error("Could not process A/B tests. ",o)}return t.results};async function ae(e){try{const t=C(e),n=await Ze(e);return Ye(n)?ie(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}const et=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:P(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await se(n)}};exports.TARGET=y;exports._processContentResult=ie;exports._track=q;exports.checkIsDefined=p;exports.createEditorListener=Z;exports.createRegisterComponentMessage=pe;exports.fetchBuilderProps=et;exports.fetchEntries=ae;exports.fetchOneEntry=se;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=re;exports.getUserAttributes=J;exports.handleABTestingSync=He;exports.isBrowser=c;exports.isEditing=M;exports.isPreviewing=he;exports.logFetch=z;exports.logger=d;exports.register=D;exports.registerInsertMenu=Ne;exports.serializeIncludingFunctions=k;exports.setEditorSettings=ye;exports.setupBrowserForEditing=Y;exports.subscribeToEditor=Ke;exports.track=Me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-f09ee4f4.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-e26008c1.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
s as createRegisterComponentMessage,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { Blocks as m } from "./blocks-
|
|
2
|
+
import { Blocks as m } from "./blocks-d7ba8f6a.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./blocks-exports.mjs";
|
|
5
|
-
import "./server-entry-
|
|
6
|
-
import "./evaluate-
|
|
7
|
-
import "./get-class-prop-name-
|
|
5
|
+
import "./server-entry-e26008c1.js";
|
|
6
|
+
import "./evaluate-8e8c9fec.js";
|
|
7
|
+
import "./get-class-prop-name-a6f0f92d.js";
|
|
8
8
|
import "./dynamic-renderer-8b343325.js";
|
|
9
9
|
function s(t) {
|
|
10
10
|
var e, o, n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("./blocks-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("./blocks-44a0617b.cjs");require("react");require("./blocks-exports.cjs");require("./server-entry-f09ee4f4.cjs");require("./evaluate-21c48a1d.cjs");require("./get-class-prop-name-ffeda28e.cjs");require("./dynamic-renderer-b29b45ca.cjs");function u(e){var t,r,n;return i.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:i.jsx(o.Blocks,{parent:(r=e.builderContext.context)==null?void 0:r.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,registeredComponents:e.builderComponents,blocks:(n=e.builderContext.rootState)==null?void 0:n[e.name]})})}exports.default=u;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { useState as s, useEffect as u } from "react";
|
|
3
3
|
import { Content as C } from "./blocks-exports.mjs";
|
|
4
|
-
import { getClassPropName as v } from "./get-class-prop-name-
|
|
5
|
-
import { fetchOneEntry as k, logger as h } from "./server-entry-
|
|
4
|
+
import { getClassPropName as v } from "./get-class-prop-name-a6f0f92d.js";
|
|
5
|
+
import { fetchOneEntry as k, logger as h } from "./server-entry-e26008c1.js";
|
|
6
6
|
const x = async ({
|
|
7
7
|
builderContextValue: e,
|
|
8
8
|
symbol: t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),C=require("./blocks-exports.cjs"),v=require("./get-class-prop-name-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),C=require("./blocks-exports.cjs"),v=require("./get-class-prop-name-ffeda28e.cjs"),m=require("./server-entry-f09ee4f4.cjs"),k=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return m.fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(r=>{m.logger.error("Could not fetch symbol content: ",r)})};function x(e){var c,a,d,u;function t(){return"div"}function r(){return"div"}function b(){var n,l;return[e.attributes[v.getClassPropName()],"builder-symbol",(n=e.symbol)!=null&&n.inline?"builder-inline-symbol":void 0,(l=e.symbol)!=null&&l.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")}const[i,y]=o.useState(()=>{var n;return(n=e.symbol)==null?void 0:n.content});function f(){i||k({symbol:e.symbol,builderContextValue:e.builderContext}).then(n=>{n&&y(n)})}return o.useEffect(()=>{},[]),o.useEffect(()=>{f()},[e.symbol]),s.jsx("div",{...e.attributes,className:b(),children:s.jsx(C.Content,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(c=e.builderBlock)==null?void 0:c.id},customComponents:Object.values(e.builderComponents),data:{...(a=e.symbol)==null?void 0:a.data,...e.builderContext.localState,...(d=i==null?void 0:i.data)==null?void 0:d.state},canTrack:e.builderContext.canTrack,model:(u=e.symbol)==null?void 0:u.model,content:i,linkComponent:e.builderLinkComponent,blocksWrapper:t(),contentWrapper:r()})})}exports.default=x;
|