@builder.io/sdk-react 4.2.4 → 5.0.1
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 +10 -10
- package/lib/browser/blocks-exports.mjs +51 -50
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-1c122812.js → server-entry-48d8b908.js} +1 -1
- package/lib/browser/{server-entry-4452b993.cjs → server-entry-54562695.cjs} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-48a5b362.js → accordion-66ebf67c.js} +1 -1
- package/lib/edge/{accordion-3f30d417.cjs → accordion-8b1f60fc.cjs} +1 -1
- package/lib/edge/{blocks-3024bb2c.cjs → blocks-1dc43011.cjs} +1 -1
- package/lib/edge/{blocks-729e6331.js → blocks-c00ca88f.js} +2 -2
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-36cacb47.js → button-041e711c.js} +2 -2
- package/lib/edge/{button-8ab624e2.cjs → button-1984c901.cjs} +1 -1
- package/lib/edge/{columns-0d6d8b29.cjs → columns-2b2cf661.cjs} +1 -1
- package/lib/edge/{columns-597b4a0e.js → columns-92e5946e.js} +3 -3
- package/lib/edge/{content-variants-b2c99976.cjs → content-variants-bc4a2651.cjs} +8 -8
- package/lib/edge/{content-variants-78e04173.js → content-variants-cce99ed6.js} +35 -34
- package/lib/edge/{custom-code-1d8040fe.cjs → custom-code-1f128470.cjs} +1 -1
- package/lib/edge/{custom-code-0a11f81d.js → custom-code-f7e6cd68.js} +1 -1
- package/lib/edge/{embed-5b2461a4.js → embed-52205349.js} +1 -1
- package/lib/edge/{embed-89e540df.cjs → embed-bc36f168.cjs} +1 -1
- package/lib/edge/{form-4f5ea678.js → form-3df2f242.js} +3 -3
- package/lib/edge/{form-46264810.cjs → form-5786e8d3.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-a8c4e896.cjs → get-class-prop-name-0276175d.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-e31571bf.js → get-class-prop-name-219095c0.js} +1 -1
- package/lib/edge/{img-194b08ce.js → img-b5312e74.js} +2 -2
- package/lib/edge/{img-821534bf.cjs → img-e7eefcb8.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-cfd5294a.js → input-0ae31d0b.js} +1 -1
- package/lib/edge/{input-6d65470b.cjs → input-46b7c2f4.cjs} +1 -1
- package/lib/edge/{personalization-container-0d92ab21.js → personalization-container-31c5a316.js} +4 -4
- package/lib/edge/{personalization-container-74138dc4.cjs → personalization-container-8000ecb8.cjs} +1 -1
- package/lib/edge/{select-d665e4e4.js → select-b32b2a7b.js} +1 -1
- package/lib/edge/{select-cec6b7d9.cjs → select-c02d2710.cjs} +1 -1
- package/lib/edge/{server-entry-fec7344c.js → server-entry-406d9576.js} +1 -1
- package/lib/edge/{server-entry-d79ba493.cjs → server-entry-5edd9be5.cjs} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-f2279693.js → slot-63da11c0.js} +3 -3
- package/lib/edge/{slot-4ad8e165.cjs → slot-d9dad534.cjs} +1 -1
- package/lib/edge/{symbol-064c9433.cjs → symbol-9c9940fb.cjs} +1 -1
- package/lib/edge/{symbol-93b85799.js → symbol-a6bc073a.js} +2 -2
- package/lib/edge/{tabs-f81e3a59.cjs → tabs-57b3f986.cjs} +1 -1
- package/lib/edge/{tabs-d87f99ab.js → tabs-bb475169.js} +3 -3
- package/lib/node/blocks-exports.cjs +11 -11
- package/lib/node/blocks-exports.mjs +53 -52
- 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-fec6b9d9.cjs → server-entry-92d43cb8.cjs} +1 -1
- package/lib/node/{server-entry-b75016aa.js → server-entry-f9e5ab97.js} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-9ebbab5f.cjs → setIvm-b11f9172.cjs} +1 -1
- package/lib/node/{setIvm-6290921a.js → setIvm-fb14c72b.js} +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-4ca1840a.js → should-force-browser-runtime-in-node-7a57d156.js} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-209c023a.cjs → should-force-browser-runtime-in-node-e9c386f7.cjs} +1 -1
- package/package.json +2 -2
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/types/input.d.ts +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TARGET as O, isEditing as _, isBrowser as J, getUserAttributes as ut, checkIsDefined as oe, logger as Q, isPreviewing as le, userAttributesService as Te, getDefaultCanTrack as ee, logFetch as Le, setupBrowserForEditing as dt, createRegisterComponentMessage as mt, getCookieSync as ft, _track as Ie, fetchOneEntry as _e, createEditorListener as ht, serializeIncludingFunctions as we, handleABTestingSync as gt } from "./server-entry-
|
|
3
|
-
import { setClientUserAttributes as Mi } from "./server-entry-
|
|
2
|
+
import { TARGET as O, isEditing as _, isBrowser as J, getUserAttributes as ut, checkIsDefined as oe, logger as Q, isPreviewing as le, userAttributesService as Te, getDefaultCanTrack as ee, logFetch as Le, setupBrowserForEditing as dt, createRegisterComponentMessage as mt, getCookieSync as ft, _track as Ie, fetchOneEntry as _e, createEditorListener as ht, serializeIncludingFunctions as we, handleABTestingSync as gt } from "./server-entry-48d8b908.js";
|
|
3
|
+
import { setClientUserAttributes as Mi } from "./server-entry-48d8b908.js";
|
|
4
4
|
import { jsx as s, Fragment as w, jsxs as D } from "react/jsx-runtime";
|
|
5
5
|
import * as bt from "react";
|
|
6
|
-
import { createContext as Ue, useEffect as
|
|
6
|
+
import { createContext as Ue, useEffect as B, useState as k, useContext as ye, useRef as z, createElement as He } from "react";
|
|
7
7
|
const yt = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), pt = (e) => typeof e == "string" && yt.has(e.toLowerCase());
|
|
8
8
|
function ve(e) {
|
|
9
9
|
return /* @__PURE__ */ s(w, { children: pt(e.TagName) ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ s(w, { children: typeof e.TagName == "string" ? /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
@@ -633,7 +633,7 @@ function rn(e) {
|
|
|
633
633
|
);
|
|
634
634
|
}
|
|
635
635
|
function on(e) {
|
|
636
|
-
return
|
|
636
|
+
return B(() => {
|
|
637
637
|
}, []), /* @__PURE__ */ s(w, { children: e.children });
|
|
638
638
|
}
|
|
639
639
|
function an(e) {
|
|
@@ -657,7 +657,7 @@ function an(e) {
|
|
|
657
657
|
function n() {
|
|
658
658
|
return e.wrapperProps;
|
|
659
659
|
}
|
|
660
|
-
return
|
|
660
|
+
return B(() => {
|
|
661
661
|
}, [e.wrapperProps, (r = (i = e.block) == null ? void 0 : i.component) == null ? void 0 : r.options]), /* @__PURE__ */ s(w, { children: e.Wrapper.load ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(
|
|
662
662
|
on,
|
|
663
663
|
{
|
|
@@ -733,7 +733,7 @@ function Pe(e) {
|
|
|
733
733
|
}
|
|
734
734
|
function Ve(e) {
|
|
735
735
|
const [t, n] = k(() => e.repeatContext);
|
|
736
|
-
return
|
|
736
|
+
return B(() => {
|
|
737
737
|
n(e.repeatContext);
|
|
738
738
|
}, [e.repeatContext]), /* @__PURE__ */ s(se.Provider, { value: t, children: /* @__PURE__ */ s(
|
|
739
739
|
ue,
|
|
@@ -886,7 +886,7 @@ function Ae(e) {
|
|
|
886
886
|
function sn(e) {
|
|
887
887
|
k(() => !1);
|
|
888
888
|
const [t, n] = k(() => !1);
|
|
889
|
-
return ye(se),
|
|
889
|
+
return ye(se), B(() => {
|
|
890
890
|
}, []), /* @__PURE__ */ s(w, { children: t ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(Ae, { block: e.block, context: e.context }) }) }) : /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(Ae, { block: e.block, context: e.context }) }) });
|
|
891
891
|
}
|
|
892
892
|
function ue(e) {
|
|
@@ -960,7 +960,7 @@ function ue(e) {
|
|
|
960
960
|
isInteractive: !((g = o == null ? void 0 : o()) != null && g.isRSC && O === "rsc")
|
|
961
961
|
};
|
|
962
962
|
}
|
|
963
|
-
return
|
|
963
|
+
return B(() => {
|
|
964
964
|
const f = r().id, m = r().animations;
|
|
965
965
|
m && f && _t(
|
|
966
966
|
m.map((y) => ({
|
|
@@ -968,7 +968,7 @@ function ue(e) {
|
|
|
968
968
|
elementId: f
|
|
969
969
|
}))
|
|
970
970
|
);
|
|
971
|
-
}, []),
|
|
971
|
+
}, []), B(() => {
|
|
972
972
|
n.update = !0;
|
|
973
973
|
}), /* @__PURE__ */ s(w, { children: l() ? /* @__PURE__ */ D(w, { children: [
|
|
974
974
|
/* @__PURE__ */ s(
|
|
@@ -1089,8 +1089,8 @@ function cn(e) {
|
|
|
1089
1089
|
"*"
|
|
1090
1090
|
));
|
|
1091
1091
|
}
|
|
1092
|
-
return
|
|
1093
|
-
}, []),
|
|
1092
|
+
return B(() => {
|
|
1093
|
+
}, []), B(() => {
|
|
1094
1094
|
}, [e.blocks]), /* @__PURE__ */ D(w, { children: [
|
|
1095
1095
|
/* @__PURE__ */ s("style", { children: `.props-blocks-wrapper-b46bf284 {
|
|
1096
1096
|
display: flex;
|
|
@@ -1374,7 +1374,7 @@ function gn(e) {
|
|
|
1374
1374
|
};
|
|
1375
1375
|
return e.aspectRatio ? h : void 0;
|
|
1376
1376
|
}
|
|
1377
|
-
return
|
|
1377
|
+
return B(() => {
|
|
1378
1378
|
}, []), /* @__PURE__ */ D(w, { children: [
|
|
1379
1379
|
/* @__PURE__ */ s("style", { children: `.img-3cc22d08 {
|
|
1380
1380
|
opacity: 1;
|
|
@@ -2380,20 +2380,20 @@ function $n(e) {
|
|
|
2380
2380
|
() => Te.getUserAttributes()
|
|
2381
2381
|
), [r, o] = k(
|
|
2382
2382
|
() => {
|
|
2383
|
-
var I,
|
|
2383
|
+
var I, N, C;
|
|
2384
2384
|
return In(
|
|
2385
2385
|
e.variants,
|
|
2386
2386
|
((I = e.builderBlock) == null ? void 0 : I.id) || "none",
|
|
2387
|
-
(C = (
|
|
2387
|
+
(C = (N = e.builderContext) == null ? void 0 : N.rootState) == null ? void 0 : C.locale
|
|
2388
2388
|
);
|
|
2389
2389
|
}
|
|
2390
2390
|
), [a, l] = k(
|
|
2391
2391
|
() => {
|
|
2392
|
-
var I,
|
|
2392
|
+
var I, N, C;
|
|
2393
2393
|
return wn(
|
|
2394
2394
|
e.variants,
|
|
2395
2395
|
((I = e.builderBlock) == null ? void 0 : I.id) || "none",
|
|
2396
|
-
(C = (
|
|
2396
|
+
(C = (N = e.builderContext) == null ? void 0 : N.rootState) == null ? void 0 : C.locale
|
|
2397
2397
|
);
|
|
2398
2398
|
}
|
|
2399
2399
|
), [c, d] = k(() => []), [h, b] = k(
|
|
@@ -2413,10 +2413,10 @@ function $n(e) {
|
|
|
2413
2413
|
}
|
|
2414
2414
|
function m() {
|
|
2415
2415
|
return (e.variants || []).filter((I) => {
|
|
2416
|
-
var
|
|
2416
|
+
var N, C, $, F;
|
|
2417
2417
|
return yn(
|
|
2418
2418
|
{
|
|
2419
|
-
...(C = (
|
|
2419
|
+
...(C = (N = e.builderContext) == null ? void 0 : N.rootState) != null && C.locale ? {
|
|
2420
2420
|
locale: (F = ($ = e.builderContext) == null ? void 0 : $.rootState) == null ? void 0 : F.locale
|
|
2421
2421
|
} : {},
|
|
2422
2422
|
...n
|
|
@@ -2439,14 +2439,14 @@ function $n(e) {
|
|
|
2439
2439
|
}
|
|
2440
2440
|
function g() {
|
|
2441
2441
|
return (e.variants || []).map(
|
|
2442
|
-
(I,
|
|
2442
|
+
(I, N) => {
|
|
2443
2443
|
var C;
|
|
2444
|
-
return `div[data-variant-id="${(C = e.builderBlock) == null ? void 0 : C.id}-${
|
|
2444
|
+
return `div[data-variant-id="${(C = e.builderBlock) == null ? void 0 : C.id}-${N}"] { display: none !important; } `;
|
|
2445
2445
|
}
|
|
2446
2446
|
).join("");
|
|
2447
2447
|
}
|
|
2448
|
-
return
|
|
2449
|
-
var
|
|
2448
|
+
return B(() => {
|
|
2449
|
+
var N;
|
|
2450
2450
|
x(!0);
|
|
2451
2451
|
const I = Te.subscribeOnUserAttributesChange(
|
|
2452
2452
|
(C) => {
|
|
@@ -2462,7 +2462,7 @@ function $n(e) {
|
|
|
2462
2462
|
new CustomEvent("builder.variantLoaded", {
|
|
2463
2463
|
detail: {
|
|
2464
2464
|
variant: C || ne,
|
|
2465
|
-
content: (
|
|
2465
|
+
content: (N = e.builderContext) == null ? void 0 : N.content
|
|
2466
2466
|
},
|
|
2467
2467
|
bubbles: !0
|
|
2468
2468
|
})
|
|
@@ -2482,7 +2482,7 @@ function $n(e) {
|
|
|
2482
2482
|
}).observe(t.current));
|
|
2483
2483
|
}
|
|
2484
2484
|
c.push(I);
|
|
2485
|
-
}, []),
|
|
2485
|
+
}, []), B(() => () => {
|
|
2486
2486
|
c.forEach((I) => I());
|
|
2487
2487
|
}, []), /* @__PURE__ */ D("div", { ref: t, ...f(), children: [
|
|
2488
2488
|
u && ie.includes(O) ? /* @__PURE__ */ s(
|
|
@@ -2517,7 +2517,7 @@ function $n(e) {
|
|
|
2517
2517
|
id: `variants-visibility-script-${(p = e.builderBlock) == null ? void 0 : p.id}`
|
|
2518
2518
|
}
|
|
2519
2519
|
),
|
|
2520
|
-
(v = e.variants) == null ? void 0 : v.map((I,
|
|
2520
|
+
(v = e.variants) == null ? void 0 : v.map((I, N) => {
|
|
2521
2521
|
var C, $, F, L, j, Ce;
|
|
2522
2522
|
return /* @__PURE__ */ s(
|
|
2523
2523
|
M,
|
|
@@ -2526,11 +2526,11 @@ function $n(e) {
|
|
|
2526
2526
|
...(C = e.builderContext) == null ? void 0 : C.BlocksWrapperProps,
|
|
2527
2527
|
"aria-hidden": !0,
|
|
2528
2528
|
hidden: !0,
|
|
2529
|
-
"data-variant-id": `${($ = e.builderBlock) == null ? void 0 : $.id}-${
|
|
2529
|
+
"data-variant-id": `${($ = e.builderBlock) == null ? void 0 : $.id}-${N}`
|
|
2530
2530
|
},
|
|
2531
2531
|
blocks: I.blocks,
|
|
2532
2532
|
parent: (F = e.builderBlock) == null ? void 0 : F.id,
|
|
2533
|
-
path: `component.options.variants.${
|
|
2533
|
+
path: `component.options.variants.${N}.blocks`,
|
|
2534
2534
|
context: e.builderContext,
|
|
2535
2535
|
registeredComponents: e.builderComponents,
|
|
2536
2536
|
children: /* @__PURE__ */ s(
|
|
@@ -2538,11 +2538,11 @@ function $n(e) {
|
|
|
2538
2538
|
{
|
|
2539
2539
|
nonce: ((L = e.builderContext) == null ? void 0 : L.nonce) || "",
|
|
2540
2540
|
scriptStr: r,
|
|
2541
|
-
id: `variants-script-${(j = e.builderBlock) == null ? void 0 : j.id}-${
|
|
2541
|
+
id: `variants-script-${(j = e.builderBlock) == null ? void 0 : j.id}-${N}`
|
|
2542
2542
|
}
|
|
2543
2543
|
)
|
|
2544
2544
|
},
|
|
2545
|
-
`${(Ce = e.builderBlock) == null ? void 0 : Ce.id}-${
|
|
2545
|
+
`${(Ce = e.builderBlock) == null ? void 0 : Ce.id}-${N}`
|
|
2546
2546
|
);
|
|
2547
2547
|
})
|
|
2548
2548
|
] }) : null,
|
|
@@ -2981,9 +2981,9 @@ function jn(e) {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
2983
2983
|
}
|
|
2984
|
-
return
|
|
2984
|
+
return B(() => {
|
|
2985
2985
|
a();
|
|
2986
|
-
}, []),
|
|
2986
|
+
}, []), B(() => {
|
|
2987
2987
|
_() && a();
|
|
2988
2988
|
}, [e.code]), /* @__PURE__ */ s(
|
|
2989
2989
|
"div",
|
|
@@ -3030,7 +3030,7 @@ function Gn(e) {
|
|
|
3030
3030
|
}
|
|
3031
3031
|
}
|
|
3032
3032
|
}
|
|
3033
|
-
return
|
|
3033
|
+
return B(() => {
|
|
3034
3034
|
t.current && !a && (l(!0), c());
|
|
3035
3035
|
}, [t.current, a]), /* @__PURE__ */ s(
|
|
3036
3036
|
"div",
|
|
@@ -3841,7 +3841,7 @@ function di(e) {
|
|
|
3841
3841
|
}
|
|
3842
3842
|
const [r, o] = k(() => {
|
|
3843
3843
|
});
|
|
3844
|
-
return
|
|
3844
|
+
return B(() => {
|
|
3845
3845
|
if (e.lazyLoad) {
|
|
3846
3846
|
const x = new IntersectionObserver(function(f) {
|
|
3847
3847
|
f.forEach(function(m) {
|
|
@@ -3862,7 +3862,7 @@ function di(e) {
|
|
|
3862
3862
|
});
|
|
3863
3863
|
t.current && x.observe(t.current), o(x);
|
|
3864
3864
|
}
|
|
3865
|
-
}, []),
|
|
3865
|
+
}, []), B(() => () => {
|
|
3866
3866
|
r && r.disconnect();
|
|
3867
3867
|
}, []), /* @__PURE__ */ D(
|
|
3868
3868
|
"div",
|
|
@@ -4236,7 +4236,7 @@ function Ai(e) {
|
|
|
4236
4236
|
}));
|
|
4237
4237
|
}
|
|
4238
4238
|
function l(v, V) {
|
|
4239
|
-
var W, R, P, I,
|
|
4239
|
+
var W, R, P, I, N;
|
|
4240
4240
|
const A = {
|
|
4241
4241
|
...e.builderContextSignal.content,
|
|
4242
4242
|
...v,
|
|
@@ -4247,7 +4247,7 @@ function Ai(e) {
|
|
|
4247
4247
|
meta: {
|
|
4248
4248
|
...(R = e.builderContextSignal.content) == null ? void 0 : R.meta,
|
|
4249
4249
|
...v == null ? void 0 : v.meta,
|
|
4250
|
-
breakpoints: ((P = v == null ? void 0 : v.meta) == null ? void 0 : P.breakpoints) || ((
|
|
4250
|
+
breakpoints: ((P = v == null ? void 0 : v.meta) == null ? void 0 : P.breakpoints) || ((N = (I = e.builderContextSignal.content) == null ? void 0 : I.meta) == null ? void 0 : N.breakpoints)
|
|
4251
4251
|
}
|
|
4252
4252
|
};
|
|
4253
4253
|
e.setBuilderContextSignal((C) => ({
|
|
@@ -4318,9 +4318,9 @@ function Ai(e) {
|
|
|
4318
4318
|
const I = typeof P == "object" && P["@type"] === "@builder.io/core:Request";
|
|
4319
4319
|
if (f[R] || u[R] && !_())
|
|
4320
4320
|
return;
|
|
4321
|
-
const
|
|
4321
|
+
const N = I ? P.request.url : P;
|
|
4322
4322
|
f[R] = !0;
|
|
4323
|
-
const C =
|
|
4323
|
+
const C = N.replace(
|
|
4324
4324
|
/{{([^}]+)}}/g,
|
|
4325
4325
|
(L, j) => String(
|
|
4326
4326
|
Y({
|
|
@@ -4378,7 +4378,7 @@ function Ai(e) {
|
|
|
4378
4378
|
);
|
|
4379
4379
|
}
|
|
4380
4380
|
const U = z(!1);
|
|
4381
|
-
return U.current || (T(), E(), U.current = !0),
|
|
4381
|
+
return U.current || (T(), E(), U.current = !0), B(() => {
|
|
4382
4382
|
var v, V, A, W, R;
|
|
4383
4383
|
if (J()) {
|
|
4384
4384
|
_() && !e.isNestedRender && (window.addEventListener("message", b), dt({
|
|
@@ -4408,8 +4408,8 @@ function Ai(e) {
|
|
|
4408
4408
|
const P = e.builderContextSignal.content && ee(e.canTrack), I = ft({
|
|
4409
4409
|
name: `builder.tests.${(V = e.builderContextSignal.content) == null ? void 0 : V.id}`,
|
|
4410
4410
|
canTrack: !0
|
|
4411
|
-
}),
|
|
4412
|
-
if (P &&
|
|
4411
|
+
}), N = (A = e.builderContextSignal.content) == null ? void 0 : A.testVariationId;
|
|
4412
|
+
if (P && N === I) {
|
|
4413
4413
|
const C = (W = e.builderContextSignal.content) == null ? void 0 : W.id, $ = e.apiKey;
|
|
4414
4414
|
Ie({
|
|
4415
4415
|
apiHost: e.apiHost,
|
|
@@ -4438,17 +4438,17 @@ function Ai(e) {
|
|
|
4438
4438
|
});
|
|
4439
4439
|
}
|
|
4440
4440
|
}
|
|
4441
|
-
}, []),
|
|
4441
|
+
}, []), B(() => {
|
|
4442
4442
|
e.content && l(e.content);
|
|
4443
|
-
}, [e.content]),
|
|
4443
|
+
}, [e.content]), B(() => {
|
|
4444
4444
|
E();
|
|
4445
|
-
}, [e.builderContextSignal.rootState]),
|
|
4445
|
+
}, [e.builderContextSignal.rootState]), B(() => {
|
|
4446
4446
|
if (e.data) {
|
|
4447
4447
|
if (n === e.data)
|
|
4448
4448
|
return;
|
|
4449
4449
|
a(e.data), i(e.data);
|
|
4450
4450
|
}
|
|
4451
|
-
}, [e.data]),
|
|
4451
|
+
}, [e.data]), B(() => {
|
|
4452
4452
|
if (e.locale) {
|
|
4453
4453
|
if (r === e.locale)
|
|
4454
4454
|
return;
|
|
@@ -4456,7 +4456,7 @@ function Ai(e) {
|
|
|
4456
4456
|
locale: e.locale
|
|
4457
4457
|
}), o(e.locale);
|
|
4458
4458
|
}
|
|
4459
|
-
}, [e.locale]),
|
|
4459
|
+
}, [e.locale]), B(() => () => {
|
|
4460
4460
|
J() && (window.removeEventListener("message", b), window.removeEventListener(
|
|
4461
4461
|
"builder:component:stateChangeListenerActivated",
|
|
4462
4462
|
E
|
|
@@ -4611,7 +4611,8 @@ function Fe(e) {
|
|
|
4611
4611
|
isExpression: !1
|
|
4612
4612
|
}), c.current = !0;
|
|
4613
4613
|
}
|
|
4614
|
-
return
|
|
4614
|
+
return B(() => {
|
|
4615
|
+
}, [e.content, e.data, e.locale]), /* @__PURE__ */ s(
|
|
4615
4616
|
Me.Provider,
|
|
4616
4617
|
{
|
|
4617
4618
|
value: {
|
|
@@ -4702,7 +4703,7 @@ function $i(e) {
|
|
|
4702
4703
|
canTrack: ee(e.canTrack)
|
|
4703
4704
|
});
|
|
4704
4705
|
}
|
|
4705
|
-
return
|
|
4706
|
+
return B(() => {
|
|
4706
4707
|
}, []), /* @__PURE__ */ D(w, { children: [
|
|
4707
4708
|
!e.isNestedRender && O !== "reactNative" ? /* @__PURE__ */ D(w, { children: [
|
|
4708
4709
|
/* @__PURE__ */ s(
|
|
@@ -4851,8 +4852,8 @@ function Oi(e) {
|
|
|
4851
4852
|
y && (a(y), c((g = e.symbol) == null ? void 0 : g.entry));
|
|
4852
4853
|
});
|
|
4853
4854
|
}
|
|
4854
|
-
return
|
|
4855
|
-
}, []),
|
|
4855
|
+
return B(() => {
|
|
4856
|
+
}, []), B(() => {
|
|
4856
4857
|
d();
|
|
4857
4858
|
}, [e.symbol]), /* @__PURE__ */ s("div", { ...e.attributes, className: r(), children: /* @__PURE__ */ s(
|
|
4858
4859
|
$i,
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-54562695.cjs");require("react/jsx-runtime");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;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.registerAction=e.registerAction;exports.setClientUserAttributes=e.setClientUserAttributes;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as o, BuilderContext as s, Button as n, Columns as c, Content as g, Fragment as m, Image as a, Section as l, Symbol as u, Text as d, Video as p } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, registerAction as y, setClientUserAttributes as A, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-
|
|
2
|
+
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, registerAction as y, setClientUserAttributes as A, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-48d8b908.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
|
@@ -122,7 +122,7 @@ const L = "builder.", ht = "options.", j = (t) => {
|
|
|
122
122
|
return {};
|
|
123
123
|
const t = new URLSearchParams(window.location.search);
|
|
124
124
|
return j(t);
|
|
125
|
-
}, $ = "
|
|
125
|
+
}, $ = "5.0.1", G = () => ({
|
|
126
126
|
"X-Builder-SDK": b,
|
|
127
127
|
"X-Builder-SDK-GEN": "2",
|
|
128
128
|
"X-Builder-SDK-Version": $
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const b="react",I="[Builder.io]: ",f={log:(...t)=>console.log(I,...t),error:(...t)=>console.error(I,...t),warn:(...t)=>console.warn(I,...t),debug:(...t)=>console.debug(I,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}const St=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},j=t=>t instanceof URLSearchParams?St(t):t,$=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return a()&&window.self!==window.top}function G(t){return bt()&&$(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},mt=()=>typeof navigator=="object"&&navigator.userAgent||"",J=()=>{const t=mt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||b==="reactNative"}},r=t.match(/Tablet|iPad/i),n=yt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},S=t=>t!=null;function wt(t){const e=t||(a()?window.location.search:void 0);return e?$(e).indexOf("builder.preview=")!==-1:!1}const Et=t=>({type:"builder.registerComponent",data:U(t)}),At=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function U(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?At(r):r))}const N={};function It(t,e){t==="plugin"&&(e=U(e));let r=N[t];if(r||(r=N[t]=[]),r.push(e),a()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}function vt(t){var e;if(a()){const r=JSON.parse(JSON.stringify(t));t.action&&(r.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:r},"*")}}const V={};function kt(t){if(a()){Object.assign(V,t);const e={type:"builder.settingsChange",data:V};parent.postMessage(e,"*")}}const D="builder.",Tt="options.",O=t=>{if(!t)return{};const e=j(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(D)){const s=n.replace(D,"").replace(Tt,"");r[s]=e[n]}}),r},Ut=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return O(t)},z="4.2.4",X=()=>({"X-Builder-SDK":b,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z}),Ot=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){f.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},H=async t=>v(t),Pt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(S).join("; "),Rt=[["secure",""],["SameSite","None"]],Ct=({name:t,value:e,expires:r})=>{const s=(a()?location.protocol==="https:":!0)?Rt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Ot(window.location.hostname)],...s];return Pt(i)},P=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=Ct({name:t,value:e,expires:r});document.cookie=s}catch(s){f.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Bt().replace(/-/g,"")}const Y="builderSessionId",xt=async({canTrack:t})=>{if(!t)return;const e=await H({name:Y,canTrack:t});if(S(e))return e;{const r=_t();return Lt({id:r,canTrack:t}),r}},_t=()=>Q(),Lt=({id:t,canTrack:e})=>P({name:Y,value:t,canTrack:e}),Z=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Nt=({key:t,canTrack:e})=>{var r;try{return e?(r=Z())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Vt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Z())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Dt=({canTrack:t})=>{if(!t)return;const e=Nt({key:q,canTrack:t});if(S(e))return e;{const r=Ft();return Mt({id:r,canTrack:t}),r}},Ft=()=>Q(),Mt=({id:t,canTrack:e})=>Vt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&f.log(t)}const Kt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await xt({canTrack:t}),r=Dt({canTrack:t});return{sessionId:e,visitorId:r}},Wt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Kt({canTrack:e}),userAttributes:J(),ownerId:r}});async function et({apiHost:t,...e}){if(!e.apiKey){f.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||G()||!(a()||b==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await Wt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const jt=t=>et({...t,canTrack:!0}),$t=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||$t).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let F=!1;const nt=t=>{var e,r;F||(F=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:b,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!rt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,l=s.data.arguments||[],y=s.data.id,m=new Function(u);let d,h=null;try{d=m.apply(null,l)}catch(p){h=p}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:h.message}},"*"):d&&typeof d.then=="function"?d.then(p=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:y,result:p}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:y}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!rt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state,l=o.editType;i===t&&u&&r.stateUpdate(u,l);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data,l=o.editType;i===t&&r.contentUpdate(u,l);break}}},Gt=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!a)return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};nt({modelName:t,apiKey:e});const s=st({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Jt="builder.tests",R=t=>`${Jt}.${t}`,zt=({contentId:t})=>H({name:R(t),canTrack:!0}),Xt=({contentId:t})=>v({name:R(t),canTrack:!0}),Ht=({contentId:t,value:e})=>P({name:R(t),value:e,canTrack:!0}),ot=t=>S(t.id)&&S(t.variations)&&Object.keys(t.variations).length>0,Qt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},it=t=>{const e=Qt(t);return Ht({contentId:t.id,value:e}).catch(r=>{f.error("could not store A/B test variation: ",r)}),e},at=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Yt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const r=Xt({contentId:t.id})||it({variations:t.variations,id:t.id}),n=at({item:t,testGroupId:r});return{...t,...n}},Zt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const n=await zt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:n});return{...t,...s}};const M="builder.userAttributes";function K(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!a())return;const n={...this.getUserAttributes(),...r};P({name:M,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return a()?JSON.parse(v({name:M,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let k;a()&&b==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=K()),k=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):k=K();const C=k,qt=t=>{C.setUserAttributes(t)},ct=t=>{const e=S(t)?t:!0;return C.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
1
|
+
"use strict";const b="react",I="[Builder.io]: ",f={log:(...t)=>console.log(I,...t),error:(...t)=>console.error(I,...t),warn:(...t)=>console.warn(I,...t),debug:(...t)=>console.debug(I,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}const St=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},j=t=>t instanceof URLSearchParams?St(t):t,$=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return a()&&window.self!==window.top}function G(t){return bt()&&$(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},mt=()=>typeof navigator=="object"&&navigator.userAgent||"",J=()=>{const t=mt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||b==="reactNative"}},r=t.match(/Tablet|iPad/i),n=yt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},S=t=>t!=null;function wt(t){const e=t||(a()?window.location.search:void 0);return e?$(e).indexOf("builder.preview=")!==-1:!1}const Et=t=>({type:"builder.registerComponent",data:U(t)}),At=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function U(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?At(r):r))}const N={};function It(t,e){t==="plugin"&&(e=U(e));let r=N[t];if(r||(r=N[t]=[]),r.push(e),a()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}function vt(t){var e;if(a()){const r=JSON.parse(JSON.stringify(t));t.action&&(r.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:r},"*")}}const V={};function kt(t){if(a()){Object.assign(V,t);const e={type:"builder.settingsChange",data:V};parent.postMessage(e,"*")}}const D="builder.",Tt="options.",O=t=>{if(!t)return{};const e=j(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(D)){const s=n.replace(D,"").replace(Tt,"");r[s]=e[n]}}),r},Ut=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return O(t)},z="5.0.1",X=()=>({"X-Builder-SDK":b,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z}),Ot=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){f.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},H=async t=>v(t),Pt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(S).join("; "),Rt=[["secure",""],["SameSite","None"]],Ct=({name:t,value:e,expires:r})=>{const s=(a()?location.protocol==="https:":!0)?Rt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Ot(window.location.hostname)],...s];return Pt(i)},P=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=Ct({name:t,value:e,expires:r});document.cookie=s}catch(s){f.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Bt().replace(/-/g,"")}const Y="builderSessionId",xt=async({canTrack:t})=>{if(!t)return;const e=await H({name:Y,canTrack:t});if(S(e))return e;{const r=_t();return Lt({id:r,canTrack:t}),r}},_t=()=>Q(),Lt=({id:t,canTrack:e})=>P({name:Y,value:t,canTrack:e}),Z=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Nt=({key:t,canTrack:e})=>{var r;try{return e?(r=Z())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Vt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Z())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Dt=({canTrack:t})=>{if(!t)return;const e=Nt({key:q,canTrack:t});if(S(e))return e;{const r=Ft();return Mt({id:r,canTrack:t}),r}},Ft=()=>Q(),Mt=({id:t,canTrack:e})=>Vt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&f.log(t)}const Kt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await xt({canTrack:t}),r=Dt({canTrack:t});return{sessionId:e,visitorId:r}},Wt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Kt({canTrack:e}),userAttributes:J(),ownerId:r}});async function et({apiHost:t,...e}){if(!e.apiKey){f.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||G()||!(a()||b==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await Wt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const jt=t=>et({...t,canTrack:!0}),$t=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||$t).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let F=!1;const nt=t=>{var e,r;F||(F=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:b,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!rt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,l=s.data.arguments||[],y=s.data.id,m=new Function(u);let d,h=null;try{d=m.apply(null,l)}catch(p){h=p}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:h.message}},"*"):d&&typeof d.then=="function"?d.then(p=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:y,result:p}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:y}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!rt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state,l=o.editType;i===t&&u&&r.stateUpdate(u,l);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data,l=o.editType;i===t&&r.contentUpdate(u,l);break}}},Gt=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!a)return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};nt({modelName:t,apiKey:e});const s=st({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Jt="builder.tests",R=t=>`${Jt}.${t}`,zt=({contentId:t})=>H({name:R(t),canTrack:!0}),Xt=({contentId:t})=>v({name:R(t),canTrack:!0}),Ht=({contentId:t,value:e})=>P({name:R(t),value:e,canTrack:!0}),ot=t=>S(t.id)&&S(t.variations)&&Object.keys(t.variations).length>0,Qt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},it=t=>{const e=Qt(t);return Ht({contentId:t.id,value:e}).catch(r=>{f.error("could not store A/B test variation: ",r)}),e},at=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Yt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const r=Xt({contentId:t.id})||it({variations:t.variations,id:t.id}),n=at({item:t,testGroupId:r});return{...t,...n}},Zt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const n=await zt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:n});return{...t,...s}};const M="builder.userAttributes";function K(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!a())return;const n={...this.getUserAttributes(),...r};P({name:M,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return a()?JSON.parse(v({name:M,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let k;a()&&b==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=K()),k=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):k=K();const C=k,qt=t=>{C.setUserAttributes(t)},ct=t=>{const e=S(t)?t:!0;return C.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="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
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 t}const re=ee();function T(t,e=null,r="."){return Object.keys(t).reduce((n,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(r);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...n,...T(o,i,r)}:{...n,[i]:o}},{})}function ut(t,e,r={}){for(const n in t){const s=t[n],o=e?e+"."+n:n;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?ut(s,o,r):r[o]=s}return r}function ne(t){const e={};for(const r in t){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){const i=n[o];o===n.length-1?s[i]=t[r]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",W=t=>typeof t=="number"&&!isNaN(t)&&t>=0,B=t=>{const{limit:e=30,userAttributes:r,query:n,model:s,apiKey:o,enrich:i,locale:u,apiVersion:l=se,fields:y,omit:m,offset:d,cacheSeconds:h,staleCacheSeconds:p,sort:w,includeUnpublished:x,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const ht=e!==1,pt=gt||"https://cdn.builder.io",c=new URL(`${pt}/api/${l}/content/${s}`);c.searchParams.set("apiKey",o),c.searchParams.set("limit",String(e)),c.searchParams.set("noTraverse",String(ht)),c.searchParams.set("includeRefs",String(!0)),u&&c.searchParams.set("locale",u);let A=r||{};if(i&&c.searchParams.set("enrich",String(i)),c.searchParams.set("omit",m!=null?m:"meta.componentsUsed"),y&&c.searchParams.set("fields",y),Number.isFinite(d)&&d>-1&&c.searchParams.set("offset",String(Math.floor(d))),typeof x=="boolean"&&c.searchParams.set("includeUnpublished",String(x)),h&&W(h)&&c.searchParams.set("cacheSeconds",String(h)),p&&W(p)&&c.searchParams.set("staleCacheSeconds",String(p)),w){const g=T({sort:w});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}const _={...Ut(),...j(t.options||{})};A={...A,...ie(_)};const L=T(_);for(const g in L)c.searchParams.set(g,String(L[g]));if(Object.keys(A).length>0&&c.searchParams.set("userAttributes",JSON.stringify(A)),n){const g=ut({query:n});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}return c},oe=t=>{const e={};for(const r in t)r.startsWith("userAttributes.")&&(e[r]=t[r],delete t[r]);return e},ie=t=>{if(a()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:r}=ne(e);return r}return{}},ae=t=>"results"in t;async function lt(t){var n;const e=t.locale||((n=t.userAttributes)==null?void 0:n.locale);e&&(t.locale=e,t.userAttributes={locale:e,...t.userAttributes});const r=await ft({...t,limit:1});return r&&r[0]||null}const ce=async t=>{var i,u;const e=B(t),r=(i=t.fetch)!=null?i:re,n={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...X()}};return await(await r(e.href,n)).json()},dt=async(t,e,r=B(t))=>{const n=ct(t.canTrack);if(r.search.includes("preview="),!n||!(a()||b==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await Zt({item:o,canTrack:n}));e.results=s}catch(s){f.error("Could not process A/B tests. ",s)}return e.results};async function ft(t){const e=B(t),r=await ce(t);if(!ae(r))throw f.error("Error fetching data. ",{url:e,content:r,options:t}),r;return dt(t,r)}const ue=async t=>{var n,s,o;const e=t.path||((n=t.url)==null?void 0:n.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),r={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:O(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:r.apiKey,model:r.model,content:await lt(r)}};exports.TARGET=b;exports._processContentResult=dt;exports._track=et;exports.checkIsDefined=S;exports.createEditorListener=st;exports.createRegisterComponentMessage=Et;exports.fetchBuilderProps=ue;exports.fetchEntries=ft;exports.fetchOneEntry=lt;exports.getBuilderSearchParams=O;exports.getCookieSync=v;exports.getDefaultCanTrack=ct;exports.getUserAttributes=J;exports.handleABTestingSync=Yt;exports.isBrowser=a;exports.isEditing=G;exports.isPreviewing=wt;exports.logFetch=tt;exports.logger=f;exports.register=It;exports.registerAction=vt;exports.serializeIncludingFunctions=U;exports.setClientUserAttributes=qt;exports.setEditorSettings=kt;exports.setupBrowserForEditing=nt;exports.subscribeToEditor=Gt;exports.track=jt;exports.userAttributesService=C;
|
|
@@ -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-54562695.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.registerAction=e.registerAction;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as i, fetchBuilderProps as s, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, registerAction as E, setEditorSettings as f, subscribeToEditor as h, track as p } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as i, fetchBuilderProps as s, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, registerAction as E, setEditorSettings as f, subscribeToEditor as h, track as p } from "./server-entry-48d8b908.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
i as createRegisterComponentMessage,
|
|
@@ -2,7 +2,7 @@ import { jsx as l, jsxs as j } from "react/jsx-runtime";
|
|
|
2
2
|
import * as p from "react";
|
|
3
3
|
import { useState as x } from "react";
|
|
4
4
|
import { Blocks as g } from "./blocks-exports.mjs";
|
|
5
|
-
import "./server-entry-
|
|
5
|
+
import "./server-entry-406d9576.js";
|
|
6
6
|
const y = (t) => t.toString();
|
|
7
7
|
function B(t) {
|
|
8
8
|
var a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),j=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),j=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-5edd9be5.cjs");function S(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return i.default=e,Object.freeze(i)}const v=S(j),y=e=>e.toString();function p(e){var u;const[i,r]=j.useState(()=>[]);function s(){return!!(e.grid||e.oneAtATime)}function O(){return{display:"flex",alignItems:"stretch",flexDirection:"column",...e.grid&&{flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap"}}}function C(){const n={...{display:"flex",flexDirection:"column"},alignItems:"stretch",cursor:"pointer"};return Object.fromEntries(Object.entries(n).filter(([l,a])=>a!==void 0))}function h(t){return`builder-accordion-title builder-accordion-title-${i.includes(t)?"open":"closed"}`}function k(t){return`builder-accordion-detail builder-accordion-detail-${i.includes(t)?"open":"closed"}`}function d(){let t=null;if(e.grid&&i.length&&document){const l=i[0];let o=document.querySelector(`.builder-accordion-title[data-index="${l}"]`);if(t=l,o){let m=o.getBoundingClientRect();for(;o=o&&o.nextElementSibling;)if(o){if(o.classList.contains("builder-accordion-detail"))continue;const f=o.getBoundingClientRect();if(f.left>m.left){const b=parseInt(o.getAttribute("data-index")||"",10);isNaN(b)||(m=f,t=b)}else break}}}return typeof t=="number"&&(t=t+1),t}function I(){const t={order:typeof d()=="number"?d():void 0,...e.grid&&{width:"100%"}};return Object.fromEntries(Object.entries(t).filter(([n,l])=>l!==void 0))}function x(t){i.includes(t)?r(s()?[]:i.filter(n=>n!==t)):r(s()?[t]:i.concat(t))}return c.jsx("div",{className:"builder-accordion",style:O(),children:(u=e.items)==null?void 0:u.map((t,n)=>c.jsxs(v.Fragment,{children:[c.jsx("div",{className:h(n),style:{...C(),...e.grid&&{width:e.gridRowWidth,order:d()!==null?y(n):y(n+1)}},"data-index":n,onClick:l=>x(n),children:c.jsx(g.Blocks,{blocks:t.title,path:`items.${n}.title`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}),i.includes(n)?c.jsx("div",{className:k(n),style:I(),children:c.jsx(g.Blocks,{blocks:t.detail,path:`items.${n}.detail`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]},n))})}exports.default=p;
|