@builder.io/sdk-react-nextjs 0.6.4 → 0.7.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/USE_CLIENT_BUNDLE-7a3bf41a.mjs +657 -0
- package/lib/browser/USE_CLIENT_BUNDLE-9195e6a5.js +23 -0
- package/lib/{edge/USE_SERVER_BUNDLE-5955a553.js → browser/USE_SERVER_BUNDLE-d7b13097.js} +1 -1
- package/lib/browser/USE_SERVER_BUNDLE-e5c2279a.mjs +11 -0
- package/lib/browser/{bundle-e116a057.js → bundle-620ae296.js} +9 -9
- package/lib/browser/{bundle-6ca5e123.mjs → bundle-7285a09d.mjs} +268 -267
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/edge/USE_CLIENT_BUNDLE-3cca560e.js +23 -0
- package/lib/edge/USE_CLIENT_BUNDLE-4a0cfa69.mjs +657 -0
- package/lib/{node/USE_SERVER_BUNDLE-c4ad0f9f.js → edge/USE_SERVER_BUNDLE-3f12faf4.js} +1 -1
- package/lib/edge/USE_SERVER_BUNDLE-f184d7eb.mjs +11 -0
- package/lib/edge/{bundle-df0d312f.js → bundle-a0f5cad2.js} +25 -25
- package/lib/edge/{bundle-1e4b4476.mjs → bundle-a5949d33.mjs} +1082 -1081
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/node/USE_CLIENT_BUNDLE-63c7fe77.js +61 -0
- package/lib/node/USE_CLIENT_BUNDLE-d9e90ed7.mjs +747 -0
- package/lib/node/USE_SERVER_BUNDLE-22e86776.mjs +11 -0
- package/lib/{browser/USE_SERVER_BUNDLE-c4ad0f9f.js → node/USE_SERVER_BUNDLE-cd844269.js} +1 -1
- package/lib/node/{bundle-6ca5e123.mjs → bundle-0358b224.mjs} +417 -442
- package/lib/node/bundle-630ffe6d.js +76 -0
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +23 -22
- package/package.json +6 -3
- package/types/blocks/image/image.d.ts +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/lib/browser/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
- package/lib/browser/USE_CLIENT_BUNDLE-f8df6014.mjs +0 -620
- package/lib/browser/USE_SERVER_BUNDLE-a9a2d553.mjs +0 -11
- package/lib/edge/USE_CLIENT_BUNDLE-bd1c5cd0.mjs +0 -620
- package/lib/edge/USE_CLIENT_BUNDLE-fc2e4ccd.js +0 -23
- package/lib/edge/USE_SERVER_BUNDLE-079fd7e9.mjs +0 -11
- package/lib/node/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
- package/lib/node/USE_CLIENT_BUNDLE-f8df6014.mjs +0 -620
- package/lib/node/USE_SERVER_BUNDLE-a9a2d553.mjs +0 -11
- package/lib/node/bundle-e116a057.js +0 -76
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache as Re } from "lru-cache";
|
|
2
2
|
import { jsx as l, Fragment as x, jsxs as w } from "react/jsx-runtime";
|
|
3
3
|
import { createElement as Ee } from "react";
|
|
4
|
-
import { I as Ae, B as q, a as Ve, b as $e, C as Be, E as Pe, F as Fe, c as Oe, d as We, S as Ne, V as Le, e as Me } from "./USE_CLIENT_BUNDLE-
|
|
4
|
+
import { I as Ae, B as q, a as Ve, b as $e, C as Be, E as Pe, F as Fe, c as Oe, d as We, S as Ne, V as Le, e as Me } from "./USE_CLIENT_BUNDLE-7a3bf41a.mjs";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const A = (e) => JSON.parse(JSON.stringify(e)), ae = {
|
|
7
7
|
small: {
|
|
@@ -709,14 +709,14 @@ function lt(e) {
|
|
|
709
709
|
/* @__PURE__ */ w(
|
|
710
710
|
"div",
|
|
711
711
|
{
|
|
712
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
712
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-666689ca`,
|
|
713
713
|
style: u(),
|
|
714
714
|
children: [
|
|
715
715
|
/* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(V, { styles: p() }) }),
|
|
716
716
|
(m = e.columns) == null ? void 0 : m.map((h, d) => /* @__PURE__ */ Ee(
|
|
717
717
|
"div",
|
|
718
718
|
{
|
|
719
|
-
className: "builder-column div-
|
|
719
|
+
className: "builder-column div-666689ca-2",
|
|
720
720
|
style: f(d),
|
|
721
721
|
key: d
|
|
722
722
|
},
|
|
@@ -737,10 +737,10 @@ function lt(e) {
|
|
|
737
737
|
]
|
|
738
738
|
}
|
|
739
739
|
),
|
|
740
|
-
/* @__PURE__ */ l("style", { children: `.div-
|
|
740
|
+
/* @__PURE__ */ l("style", { children: `.div-666689ca {
|
|
741
741
|
display: flex;
|
|
742
742
|
line-height: normal;
|
|
743
|
-
}.div-
|
|
743
|
+
}.div-666689ca-2 {
|
|
744
744
|
display: flex;
|
|
745
745
|
flex-direction: column;
|
|
746
746
|
align-items: stretch;
|
|
@@ -1479,7 +1479,7 @@ const Rt = {
|
|
|
1479
1479
|
component: Ne,
|
|
1480
1480
|
...wt
|
|
1481
1481
|
}, {
|
|
1482
|
-
component:
|
|
1482
|
+
component: En,
|
|
1483
1483
|
...Ct
|
|
1484
1484
|
}, {
|
|
1485
1485
|
component: Tt,
|
|
@@ -1788,7 +1788,7 @@ async function rn(e) {
|
|
|
1788
1788
|
const Mn = (e) => rn({
|
|
1789
1789
|
...e,
|
|
1790
1790
|
canTrack: !0
|
|
1791
|
-
}), an = "0.
|
|
1791
|
+
}), an = "0.7.1-0", Z = {};
|
|
1792
1792
|
function sn(e, t) {
|
|
1793
1793
|
let n = Z[e];
|
|
1794
1794
|
if (n || (n = Z[e] = []), n.push(t), v()) {
|
|
@@ -1931,15 +1931,235 @@ const cn = (e, t, n = !0) => {
|
|
|
1931
1931
|
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
1932
1932
|
}
|
|
1933
1933
|
};
|
|
1934
|
+
}, un = "builder.tests", j = (e) => `${un}.${e}`, dn = ({
|
|
1935
|
+
contentId: e
|
|
1936
|
+
}) => he({
|
|
1937
|
+
name: j(e),
|
|
1938
|
+
canTrack: !0
|
|
1939
|
+
}), mn = ({
|
|
1940
|
+
contentId: e
|
|
1941
|
+
}) => fe({
|
|
1942
|
+
name: j(e),
|
|
1943
|
+
canTrack: !0
|
|
1944
|
+
}), fn = ({
|
|
1945
|
+
contentId: e,
|
|
1946
|
+
value: t
|
|
1947
|
+
}) => ge({
|
|
1948
|
+
name: j(e),
|
|
1949
|
+
value: t,
|
|
1950
|
+
canTrack: !0
|
|
1951
|
+
}), Se = (e) => C(e.id) && C(e.variations) && Object.keys(e.variations).length > 0, hn = ({
|
|
1952
|
+
id: e,
|
|
1953
|
+
variations: t
|
|
1954
|
+
}) => {
|
|
1955
|
+
var i;
|
|
1956
|
+
let n = 0;
|
|
1957
|
+
const o = Math.random();
|
|
1958
|
+
for (const r in t) {
|
|
1959
|
+
const a = (i = t[r]) == null ? void 0 : i.testRatio;
|
|
1960
|
+
if (n += a, o < n)
|
|
1961
|
+
return r;
|
|
1962
|
+
}
|
|
1963
|
+
return e;
|
|
1964
|
+
}, ve = (e) => {
|
|
1965
|
+
const t = hn(e);
|
|
1966
|
+
return fn({
|
|
1967
|
+
contentId: e.id,
|
|
1968
|
+
value: t
|
|
1969
|
+
}).catch((n) => {
|
|
1970
|
+
k.error("could not store A/B test variation: ", n);
|
|
1971
|
+
}), t;
|
|
1972
|
+
}, ke = ({
|
|
1973
|
+
item: e,
|
|
1974
|
+
testGroupId: t
|
|
1975
|
+
}) => {
|
|
1976
|
+
const n = e.variations[t];
|
|
1977
|
+
return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
|
|
1978
|
+
!n ? {
|
|
1979
|
+
testVariationId: e.id,
|
|
1980
|
+
testVariationName: "Default"
|
|
1981
|
+
} : {
|
|
1982
|
+
data: n.data,
|
|
1983
|
+
testVariationId: n.id,
|
|
1984
|
+
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
1985
|
+
};
|
|
1986
|
+
}, gn = ({
|
|
1987
|
+
item: e,
|
|
1988
|
+
canTrack: t
|
|
1989
|
+
}) => {
|
|
1990
|
+
if (!t)
|
|
1991
|
+
return e;
|
|
1992
|
+
if (!e)
|
|
1993
|
+
return;
|
|
1994
|
+
if (!Se(e))
|
|
1995
|
+
return e;
|
|
1996
|
+
const n = mn({
|
|
1997
|
+
contentId: e.id
|
|
1998
|
+
}) || ve({
|
|
1999
|
+
variations: e.variations,
|
|
2000
|
+
id: e.id
|
|
2001
|
+
}), o = ke({
|
|
2002
|
+
item: e,
|
|
2003
|
+
testGroupId: n
|
|
2004
|
+
});
|
|
2005
|
+
return {
|
|
2006
|
+
...e,
|
|
2007
|
+
...o
|
|
2008
|
+
};
|
|
2009
|
+
}, pn = async ({
|
|
2010
|
+
item: e,
|
|
2011
|
+
canTrack: t
|
|
2012
|
+
}) => {
|
|
2013
|
+
if (!t || !Se(e))
|
|
2014
|
+
return e;
|
|
2015
|
+
const o = await dn({
|
|
2016
|
+
contentId: e.id
|
|
2017
|
+
}) || ve({
|
|
2018
|
+
variations: e.variations,
|
|
2019
|
+
id: e.id
|
|
2020
|
+
}), i = ke({
|
|
2021
|
+
item: e,
|
|
2022
|
+
testGroupId: o
|
|
2023
|
+
});
|
|
2024
|
+
return {
|
|
2025
|
+
...e,
|
|
2026
|
+
...i
|
|
2027
|
+
};
|
|
2028
|
+
}, O = (e) => C(e) ? e : !0, bn = (e) => {
|
|
2029
|
+
const t = e.get("preview"), n = e.get("overrides." + t);
|
|
2030
|
+
return n || k.warn("No previewed ID found in search params."), n;
|
|
1934
2031
|
};
|
|
1935
|
-
function
|
|
2032
|
+
function yn() {
|
|
1936
2033
|
globalThis._BUILDER_PREVIEW_LRU_CACHE || (globalThis._BUILDER_PREVIEW_LRU_CACHE = new Re({
|
|
1937
2034
|
max: 500,
|
|
1938
2035
|
// how long to live in ms
|
|
1939
2036
|
ttl: 1e3 * 60 * 5
|
|
1940
2037
|
}));
|
|
1941
2038
|
}
|
|
1942
|
-
function
|
|
2039
|
+
function xn(e) {
|
|
2040
|
+
yn();
|
|
2041
|
+
const t = bn(e);
|
|
2042
|
+
return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
|
|
2043
|
+
}
|
|
2044
|
+
function W(e, t = null, n = ".") {
|
|
2045
|
+
return Object.keys(e).reduce((o, i) => {
|
|
2046
|
+
const r = e[i], a = [t, i].filter(Boolean).join(n);
|
|
2047
|
+
return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
|
|
2048
|
+
...o,
|
|
2049
|
+
...W(r, a, n)
|
|
2050
|
+
} : {
|
|
2051
|
+
...o,
|
|
2052
|
+
[a]: r
|
|
2053
|
+
};
|
|
2054
|
+
}, {});
|
|
2055
|
+
}
|
|
2056
|
+
const oe = "builder.", Sn = "options.", vn = (e) => {
|
|
2057
|
+
const t = {};
|
|
2058
|
+
return e.forEach((n, o) => {
|
|
2059
|
+
t[o] = n;
|
|
2060
|
+
}), t;
|
|
2061
|
+
}, we = (e) => {
|
|
2062
|
+
if (!e)
|
|
2063
|
+
return {};
|
|
2064
|
+
const t = Ce(e), n = {};
|
|
2065
|
+
return Object.keys(t).forEach((o) => {
|
|
2066
|
+
if (o.startsWith(oe)) {
|
|
2067
|
+
const i = o.replace(oe, "").replace(Sn, "");
|
|
2068
|
+
n[i] = t[o];
|
|
2069
|
+
}
|
|
2070
|
+
}), n;
|
|
2071
|
+
}, kn = () => {
|
|
2072
|
+
if (!v())
|
|
2073
|
+
return {};
|
|
2074
|
+
const e = new URLSearchParams(window.location.search);
|
|
2075
|
+
return we(e);
|
|
2076
|
+
}, Ce = (e) => e instanceof URLSearchParams ? vn(e) : e, wn = "v3", K = (e) => {
|
|
2077
|
+
let {
|
|
2078
|
+
noTraverse: t = !1
|
|
2079
|
+
} = e;
|
|
2080
|
+
const {
|
|
2081
|
+
limit: n = 30,
|
|
2082
|
+
userAttributes: o,
|
|
2083
|
+
query: i,
|
|
2084
|
+
model: r,
|
|
2085
|
+
apiKey: a,
|
|
2086
|
+
includeRefs: c = !0,
|
|
2087
|
+
enrich: s,
|
|
2088
|
+
locale: u,
|
|
2089
|
+
apiVersion: f = wn
|
|
2090
|
+
} = e;
|
|
2091
|
+
if (!a)
|
|
2092
|
+
throw new Error("Missing API key");
|
|
2093
|
+
if (!["v2", "v3"].includes(f))
|
|
2094
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
|
|
2095
|
+
(e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
|
|
2096
|
+
const g = new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u ? `&locale=${u}` : ""}${s ? `&enrich=${s}` : ""}`), p = {
|
|
2097
|
+
...kn(),
|
|
2098
|
+
...Ce(e.options || {})
|
|
2099
|
+
}, m = W(p);
|
|
2100
|
+
for (const h in m)
|
|
2101
|
+
g.searchParams.set(h, String(m[h]));
|
|
2102
|
+
if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), i) {
|
|
2103
|
+
const h = W({
|
|
2104
|
+
query: i
|
|
2105
|
+
});
|
|
2106
|
+
for (const d in h)
|
|
2107
|
+
g.searchParams.set(d, JSON.stringify(h[d]));
|
|
2108
|
+
}
|
|
2109
|
+
return g;
|
|
2110
|
+
}, Cn = (e) => "results" in e;
|
|
2111
|
+
async function H(e) {
|
|
2112
|
+
const t = await Ie({
|
|
2113
|
+
...e,
|
|
2114
|
+
limit: 1
|
|
2115
|
+
});
|
|
2116
|
+
return t && t.results[0] || null;
|
|
2117
|
+
}
|
|
2118
|
+
const Kn = H, In = async (e) => {
|
|
2119
|
+
const t = K(e);
|
|
2120
|
+
return await (await jt(t.href)).json();
|
|
2121
|
+
}, Tn = async (e, t, n = K(e)) => {
|
|
2122
|
+
const o = O(e.canTrack);
|
|
2123
|
+
if (n.search.includes("preview=")) {
|
|
2124
|
+
const r = [];
|
|
2125
|
+
for (const a of t.results) {
|
|
2126
|
+
const c = xn(n.searchParams);
|
|
2127
|
+
r.push(c || a);
|
|
2128
|
+
}
|
|
2129
|
+
t.results = r;
|
|
2130
|
+
}
|
|
2131
|
+
if (!o || !(v() || I === "reactNative"))
|
|
2132
|
+
return t;
|
|
2133
|
+
try {
|
|
2134
|
+
const r = [];
|
|
2135
|
+
for (const a of t.results)
|
|
2136
|
+
r.push(await pn({
|
|
2137
|
+
item: a,
|
|
2138
|
+
canTrack: o
|
|
2139
|
+
}));
|
|
2140
|
+
t.results = r;
|
|
2141
|
+
} catch (r) {
|
|
2142
|
+
k.error("Could not process A/B tests. ", r);
|
|
2143
|
+
}
|
|
2144
|
+
return t;
|
|
2145
|
+
};
|
|
2146
|
+
async function Ie(e) {
|
|
2147
|
+
try {
|
|
2148
|
+
const t = K(e), n = await In(e);
|
|
2149
|
+
return Cn(n) ? Tn(e, n) : (k.error("Error fetching data. ", {
|
|
2150
|
+
url: t,
|
|
2151
|
+
content: n,
|
|
2152
|
+
options: e
|
|
2153
|
+
}), null);
|
|
2154
|
+
} catch (t) {
|
|
2155
|
+
return k.error("Error fetching data. ", t), null;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
const Hn = Ie;
|
|
2159
|
+
function Dn() {
|
|
2160
|
+
return !v() || L() ? !1 : location.search.indexOf("builder.preview=") !== -1;
|
|
2161
|
+
}
|
|
2162
|
+
function N(e) {
|
|
1943
2163
|
return /* @__PURE__ */ l(
|
|
1944
2164
|
"script",
|
|
1945
2165
|
{
|
|
@@ -1948,7 +2168,7 @@ function O(e) {
|
|
|
1948
2168
|
}
|
|
1949
2169
|
);
|
|
1950
2170
|
}
|
|
1951
|
-
function
|
|
2171
|
+
function ie(e) {
|
|
1952
2172
|
var i, r, a, c, s, u, f, g, p;
|
|
1953
2173
|
const t = yt({
|
|
1954
2174
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
@@ -2021,7 +2241,7 @@ function oe(e) {
|
|
|
2021
2241
|
showContent: e.showContent,
|
|
2022
2242
|
builderContextSignal: o,
|
|
2023
2243
|
children: [
|
|
2024
|
-
e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2244
|
+
e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: t }) }) : null,
|
|
2025
2245
|
/* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2026
2246
|
Nt,
|
|
2027
2247
|
{
|
|
@@ -2042,105 +2262,10 @@ function oe(e) {
|
|
|
2042
2262
|
}
|
|
2043
2263
|
);
|
|
2044
2264
|
}
|
|
2045
|
-
|
|
2046
|
-
contentId: e
|
|
2047
|
-
}) => he({
|
|
2048
|
-
name: j(e),
|
|
2049
|
-
canTrack: !0
|
|
2050
|
-
}), fn = ({
|
|
2051
|
-
contentId: e
|
|
2052
|
-
}) => fe({
|
|
2053
|
-
name: j(e),
|
|
2054
|
-
canTrack: !0
|
|
2055
|
-
}), hn = ({
|
|
2056
|
-
contentId: e,
|
|
2057
|
-
value: t
|
|
2058
|
-
}) => ge({
|
|
2059
|
-
name: j(e),
|
|
2060
|
-
value: t,
|
|
2061
|
-
canTrack: !0
|
|
2062
|
-
}), Se = (e) => C(e.id) && C(e.variations) && Object.keys(e.variations).length > 0, gn = ({
|
|
2063
|
-
id: e,
|
|
2064
|
-
variations: t
|
|
2065
|
-
}) => {
|
|
2066
|
-
var i;
|
|
2067
|
-
let n = 0;
|
|
2068
|
-
const o = Math.random();
|
|
2069
|
-
for (const r in t) {
|
|
2070
|
-
const a = (i = t[r]) == null ? void 0 : i.testRatio;
|
|
2071
|
-
if (n += a, o < n)
|
|
2072
|
-
return r;
|
|
2073
|
-
}
|
|
2074
|
-
return e;
|
|
2075
|
-
}, ve = (e) => {
|
|
2076
|
-
const t = gn(e);
|
|
2077
|
-
return hn({
|
|
2078
|
-
contentId: e.id,
|
|
2079
|
-
value: t
|
|
2080
|
-
}).catch((n) => {
|
|
2081
|
-
k.error("could not store A/B test variation: ", n);
|
|
2082
|
-
}), t;
|
|
2083
|
-
}, ke = ({
|
|
2084
|
-
item: e,
|
|
2085
|
-
testGroupId: t
|
|
2086
|
-
}) => {
|
|
2087
|
-
const n = e.variations[t];
|
|
2088
|
-
return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
|
|
2089
|
-
!n ? {
|
|
2090
|
-
testVariationId: e.id,
|
|
2091
|
-
testVariationName: "Default"
|
|
2092
|
-
} : {
|
|
2093
|
-
data: n.data,
|
|
2094
|
-
testVariationId: n.id,
|
|
2095
|
-
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
2096
|
-
};
|
|
2097
|
-
}, pn = ({
|
|
2098
|
-
item: e,
|
|
2099
|
-
canTrack: t
|
|
2100
|
-
}) => {
|
|
2101
|
-
if (!t)
|
|
2102
|
-
return e;
|
|
2103
|
-
if (!e)
|
|
2104
|
-
return;
|
|
2105
|
-
if (!Se(e))
|
|
2106
|
-
return e;
|
|
2107
|
-
const n = fn({
|
|
2108
|
-
contentId: e.id
|
|
2109
|
-
}) || ve({
|
|
2110
|
-
variations: e.variations,
|
|
2111
|
-
id: e.id
|
|
2112
|
-
}), o = ke({
|
|
2113
|
-
item: e,
|
|
2114
|
-
testGroupId: n
|
|
2115
|
-
});
|
|
2116
|
-
return {
|
|
2117
|
-
...e,
|
|
2118
|
-
...o
|
|
2119
|
-
};
|
|
2120
|
-
}, bn = async ({
|
|
2121
|
-
item: e,
|
|
2122
|
-
canTrack: t
|
|
2123
|
-
}) => {
|
|
2124
|
-
if (!t || !Se(e))
|
|
2125
|
-
return e;
|
|
2126
|
-
const o = await mn({
|
|
2127
|
-
contentId: e.id
|
|
2128
|
-
}) || ve({
|
|
2129
|
-
variations: e.variations,
|
|
2130
|
-
id: e.id
|
|
2131
|
-
}), i = ke({
|
|
2132
|
-
item: e,
|
|
2133
|
-
testGroupId: o
|
|
2134
|
-
});
|
|
2135
|
-
return {
|
|
2136
|
-
...e,
|
|
2137
|
-
...i
|
|
2138
|
-
};
|
|
2139
|
-
};
|
|
2140
|
-
function we(e) {
|
|
2265
|
+
function Te(e) {
|
|
2141
2266
|
var r, a, c;
|
|
2142
2267
|
const t = mt({
|
|
2143
|
-
canTrack:
|
|
2268
|
+
canTrack: O(e.canTrack),
|
|
2144
2269
|
content: e.content
|
|
2145
2270
|
}), n = function() {
|
|
2146
2271
|
var u;
|
|
@@ -2158,13 +2283,13 @@ function we(e) {
|
|
|
2158
2283
|
return t ? {
|
|
2159
2284
|
...e.content,
|
|
2160
2285
|
testVariationId: (u = e.content) == null ? void 0 : u.id
|
|
2161
|
-
} :
|
|
2286
|
+
} : gn({
|
|
2162
2287
|
item: e.content,
|
|
2163
|
-
canTrack:
|
|
2288
|
+
canTrack: O(e.canTrack)
|
|
2164
2289
|
});
|
|
2165
2290
|
};
|
|
2166
2291
|
return /* @__PURE__ */ w(x, { children: [
|
|
2167
|
-
!e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2292
|
+
!e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: pt() }) }) : null,
|
|
2168
2293
|
t ? /* @__PURE__ */ w(x, { children: [
|
|
2169
2294
|
/* @__PURE__ */ l(
|
|
2170
2295
|
V,
|
|
@@ -2173,9 +2298,9 @@ function we(e) {
|
|
|
2173
2298
|
styles: o()
|
|
2174
2299
|
}
|
|
2175
2300
|
),
|
|
2176
|
-
/* @__PURE__ */ l(
|
|
2301
|
+
/* @__PURE__ */ l(N, { scriptStr: n() }),
|
|
2177
2302
|
(a = R(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ l(
|
|
2178
|
-
|
|
2303
|
+
ie,
|
|
2179
2304
|
{
|
|
2180
2305
|
content: s,
|
|
2181
2306
|
showContent: !1,
|
|
@@ -2196,7 +2321,7 @@ function we(e) {
|
|
|
2196
2321
|
))
|
|
2197
2322
|
] }) : null,
|
|
2198
2323
|
/* @__PURE__ */ l(
|
|
2199
|
-
|
|
2324
|
+
ie,
|
|
2200
2325
|
{
|
|
2201
2326
|
content: i(),
|
|
2202
2327
|
classNameProp: `variant-${(c = e.content) == null ? void 0 : c.id}`,
|
|
@@ -2216,7 +2341,7 @@ function we(e) {
|
|
|
2216
2341
|
)
|
|
2217
2342
|
] });
|
|
2218
2343
|
}
|
|
2219
|
-
const
|
|
2344
|
+
const Rn = async ({
|
|
2220
2345
|
builderContextValue: e,
|
|
2221
2346
|
symbol: t
|
|
2222
2347
|
}) => {
|
|
@@ -2235,7 +2360,7 @@ const yn = async ({
|
|
|
2235
2360
|
k.error("Could not fetch symbol content: ", n);
|
|
2236
2361
|
});
|
|
2237
2362
|
};
|
|
2238
|
-
async function
|
|
2363
|
+
async function En(e) {
|
|
2239
2364
|
var o, i, r, a;
|
|
2240
2365
|
const t = function() {
|
|
2241
2366
|
var s, u;
|
|
@@ -2245,12 +2370,12 @@ async function xn(e) {
|
|
|
2245
2370
|
(s = e.symbol) != null && s.inline ? "builder-inline-symbol" : void 0,
|
|
2246
2371
|
(u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2247
2372
|
].filter(Boolean).join(" ");
|
|
2248
|
-
}, n = ((o = e.symbol) == null ? void 0 : o.content) || await
|
|
2373
|
+
}, n = ((o = e.symbol) == null ? void 0 : o.content) || await Rn({
|
|
2249
2374
|
symbol: e.symbol,
|
|
2250
2375
|
builderContextValue: e.builderContext
|
|
2251
2376
|
});
|
|
2252
2377
|
return /* @__PURE__ */ l("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ l(
|
|
2253
|
-
|
|
2378
|
+
Te,
|
|
2254
2379
|
{
|
|
2255
2380
|
__isNestedRender: !0,
|
|
2256
2381
|
apiVersion: e.builderContext.apiVersion,
|
|
@@ -2267,142 +2392,18 @@ async function xn(e) {
|
|
|
2267
2392
|
}
|
|
2268
2393
|
) });
|
|
2269
2394
|
}
|
|
2270
|
-
const
|
|
2271
|
-
function
|
|
2272
|
-
return !v() || L() ? !1 : location.search.indexOf("builder.preview=") !== -1;
|
|
2273
|
-
}
|
|
2274
|
-
const ie = {};
|
|
2275
|
-
function zn(e) {
|
|
2395
|
+
const zn = _, qn = Te, re = {};
|
|
2396
|
+
function Gn(e) {
|
|
2276
2397
|
if (v()) {
|
|
2277
|
-
Object.assign(
|
|
2398
|
+
Object.assign(re, e);
|
|
2278
2399
|
const t = {
|
|
2279
2400
|
type: "builder.settingsChange",
|
|
2280
|
-
data:
|
|
2401
|
+
data: re
|
|
2281
2402
|
};
|
|
2282
2403
|
parent.postMessage(t, "*");
|
|
2283
2404
|
}
|
|
2284
2405
|
}
|
|
2285
|
-
const
|
|
2286
|
-
const t = e.get("preview"), n = e.get("overrides." + t);
|
|
2287
|
-
return n || k.warn("No previewed ID found in search params."), n;
|
|
2288
|
-
};
|
|
2289
|
-
function vn(e) {
|
|
2290
|
-
un();
|
|
2291
|
-
const t = Sn(e);
|
|
2292
|
-
return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
|
|
2293
|
-
}
|
|
2294
|
-
function N(e, t = null, n = ".") {
|
|
2295
|
-
return Object.keys(e).reduce((o, i) => {
|
|
2296
|
-
const r = e[i], a = [t, i].filter(Boolean).join(n);
|
|
2297
|
-
return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
|
|
2298
|
-
...o,
|
|
2299
|
-
...N(r, a, n)
|
|
2300
|
-
} : {
|
|
2301
|
-
...o,
|
|
2302
|
-
[a]: r
|
|
2303
|
-
};
|
|
2304
|
-
}, {});
|
|
2305
|
-
}
|
|
2306
|
-
const re = "builder.", kn = "options.", wn = (e) => {
|
|
2307
|
-
const t = {};
|
|
2308
|
-
return e.forEach((n, o) => {
|
|
2309
|
-
t[o] = n;
|
|
2310
|
-
}), t;
|
|
2311
|
-
}, Ce = (e) => {
|
|
2312
|
-
if (!e)
|
|
2313
|
-
return {};
|
|
2314
|
-
const t = Ie(e), n = {};
|
|
2315
|
-
return Object.keys(t).forEach((o) => {
|
|
2316
|
-
if (o.startsWith(re)) {
|
|
2317
|
-
const i = o.replace(re, "").replace(kn, "");
|
|
2318
|
-
n[i] = t[o];
|
|
2319
|
-
}
|
|
2320
|
-
}), n;
|
|
2321
|
-
}, Cn = () => {
|
|
2322
|
-
if (!v())
|
|
2323
|
-
return {};
|
|
2324
|
-
const e = new URLSearchParams(window.location.search);
|
|
2325
|
-
return Ce(e);
|
|
2326
|
-
}, Ie = (e) => e instanceof URLSearchParams ? wn(e) : e, In = "v3", K = (e) => {
|
|
2327
|
-
const {
|
|
2328
|
-
limit: t = 30,
|
|
2329
|
-
userAttributes: n,
|
|
2330
|
-
query: o,
|
|
2331
|
-
noTraverse: i = !1,
|
|
2332
|
-
model: r,
|
|
2333
|
-
apiKey: a,
|
|
2334
|
-
includeRefs: c = !0,
|
|
2335
|
-
enrich: s,
|
|
2336
|
-
locale: u,
|
|
2337
|
-
apiVersion: f = In
|
|
2338
|
-
} = e;
|
|
2339
|
-
if (!a)
|
|
2340
|
-
throw new Error("Missing API key");
|
|
2341
|
-
if (!["v2", "v3"].includes(f))
|
|
2342
|
-
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
|
|
2343
|
-
const g = new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${t}&noTraverse=${i}&includeRefs=${c}${u ? `&locale=${u}` : ""}${s ? `&enrich=${s}` : ""}`), p = {
|
|
2344
|
-
...Cn(),
|
|
2345
|
-
...Ie(e.options || {})
|
|
2346
|
-
}, m = N(p);
|
|
2347
|
-
for (const h in m)
|
|
2348
|
-
g.searchParams.set(h, String(m[h]));
|
|
2349
|
-
if (n && g.searchParams.set("userAttributes", JSON.stringify(n)), o) {
|
|
2350
|
-
const h = N({
|
|
2351
|
-
query: o
|
|
2352
|
-
});
|
|
2353
|
-
for (const d in h)
|
|
2354
|
-
g.searchParams.set(d, JSON.stringify(h[d]));
|
|
2355
|
-
}
|
|
2356
|
-
return g;
|
|
2357
|
-
}, Tn = (e) => "results" in e;
|
|
2358
|
-
async function H(e) {
|
|
2359
|
-
const t = await Te({
|
|
2360
|
-
...e,
|
|
2361
|
-
limit: 1
|
|
2362
|
-
});
|
|
2363
|
-
return t && t.results[0] || null;
|
|
2364
|
-
}
|
|
2365
|
-
const qn = H, Rn = async (e) => {
|
|
2366
|
-
const t = K(e);
|
|
2367
|
-
return await (await jt(t.href)).json();
|
|
2368
|
-
}, En = async (e, t, n = K(e)) => {
|
|
2369
|
-
const o = W(e.canTrack);
|
|
2370
|
-
if (n.search.includes("preview=")) {
|
|
2371
|
-
const r = [];
|
|
2372
|
-
for (const a of t.results) {
|
|
2373
|
-
const c = vn(n.searchParams);
|
|
2374
|
-
r.push(c || a);
|
|
2375
|
-
}
|
|
2376
|
-
t.results = r;
|
|
2377
|
-
}
|
|
2378
|
-
if (!o || !(v() || I === "reactNative"))
|
|
2379
|
-
return t;
|
|
2380
|
-
try {
|
|
2381
|
-
const r = [];
|
|
2382
|
-
for (const a of t.results)
|
|
2383
|
-
r.push(await bn({
|
|
2384
|
-
item: a,
|
|
2385
|
-
canTrack: o
|
|
2386
|
-
}));
|
|
2387
|
-
t.results = r;
|
|
2388
|
-
} catch (r) {
|
|
2389
|
-
k.error("Could not process A/B tests. ", r);
|
|
2390
|
-
}
|
|
2391
|
-
return t;
|
|
2392
|
-
};
|
|
2393
|
-
async function Te(e) {
|
|
2394
|
-
try {
|
|
2395
|
-
const t = K(e), n = await Rn(e);
|
|
2396
|
-
return Tn(n) ? En(e, n) : (k.error("Error fetching data. ", {
|
|
2397
|
-
url: t,
|
|
2398
|
-
content: n,
|
|
2399
|
-
options: e
|
|
2400
|
-
}), null);
|
|
2401
|
-
} catch (t) {
|
|
2402
|
-
return k.error("Error fetching data. ", t), null;
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
const Gn = Te, Jn = async (e) => {
|
|
2406
|
+
const Jn = async (e) => {
|
|
2406
2407
|
var o, i, r;
|
|
2407
2408
|
const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((i = e.userAttributes) == null ? void 0 : i.urlPath), n = {
|
|
2408
2409
|
...e,
|
|
@@ -2414,7 +2415,7 @@ const Gn = Te, Jn = async (e) => {
|
|
|
2414
2415
|
urlPath: t
|
|
2415
2416
|
} : {}
|
|
2416
2417
|
},
|
|
2417
|
-
options:
|
|
2418
|
+
options: we(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
|
|
2418
2419
|
};
|
|
2419
2420
|
return {
|
|
2420
2421
|
apiKey: n.apiKey,
|
|
@@ -2423,39 +2424,39 @@ const Gn = Te, Jn = async (e) => {
|
|
|
2423
2424
|
};
|
|
2424
2425
|
};
|
|
2425
2426
|
export {
|
|
2426
|
-
|
|
2427
|
+
we as A,
|
|
2427
2428
|
_ as B,
|
|
2428
|
-
|
|
2429
|
+
Te as C,
|
|
2429
2430
|
Mn as D,
|
|
2430
2431
|
Jn as E,
|
|
2431
|
-
|
|
2432
|
-
|
|
2432
|
+
zn as R,
|
|
2433
|
+
En as S,
|
|
2433
2434
|
Tt as T,
|
|
2434
2435
|
rn as _,
|
|
2435
2436
|
On as a,
|
|
2436
2437
|
Wn as b,
|
|
2437
2438
|
Nn as c,
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2439
|
+
v as d,
|
|
2440
|
+
O as e,
|
|
2441
|
+
Dn as f,
|
|
2441
2442
|
at as g,
|
|
2442
2443
|
M as h,
|
|
2443
2444
|
L as i,
|
|
2444
2445
|
jn as j,
|
|
2445
2446
|
A as k,
|
|
2446
2447
|
k as l,
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2448
|
+
Ln as m,
|
|
2449
|
+
H as n,
|
|
2450
|
+
jt as o,
|
|
2451
|
+
yn as p,
|
|
2452
|
+
qn as q,
|
|
2452
2453
|
Un as r,
|
|
2453
2454
|
_n as s,
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2455
|
+
lt as t,
|
|
2456
|
+
sn as u,
|
|
2457
|
+
Gn as v,
|
|
2458
|
+
Ie as w,
|
|
2459
|
+
Hn as x,
|
|
2460
|
+
Kn as y,
|
|
2461
|
+
Tn as z
|
|
2461
2462
|
};
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-620ae296.js"),t=require("./USE_CLIENT_BUNDLE-9195e6a5.js");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-d7b13097.js");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|