@builder.io/sdk-react-nextjs 0.7.0 → 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.
Files changed (37) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-7a3bf41a.mjs +657 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-9195e6a5.js +23 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-105e9ef3.js → browser/USE_SERVER_BUNDLE-d7b13097.js} +1 -1
  4. package/lib/browser/USE_SERVER_BUNDLE-e5c2279a.mjs +11 -0
  5. package/lib/browser/{bundle-0fae602b.js → bundle-620ae296.js} +5 -5
  6. package/lib/browser/{bundle-3b073b16.mjs → bundle-7285a09d.mjs} +265 -268
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +7 -7
  9. package/lib/edge/USE_CLIENT_BUNDLE-3cca560e.js +23 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-4a0cfa69.mjs +657 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-d8c698c8.js → edge/USE_SERVER_BUNDLE-3f12faf4.js} +1 -1
  12. package/lib/edge/USE_SERVER_BUNDLE-f184d7eb.mjs +11 -0
  13. package/lib/edge/{bundle-0c1d9099.js → bundle-a0f5cad2.js} +5 -5
  14. package/lib/edge/{bundle-ed178c62.mjs → bundle-a5949d33.mjs} +265 -268
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +7 -7
  17. package/lib/node/USE_CLIENT_BUNDLE-63c7fe77.js +61 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-d9e90ed7.mjs +747 -0
  19. package/lib/node/USE_SERVER_BUNDLE-22e86776.mjs +11 -0
  20. package/lib/{browser/USE_SERVER_BUNDLE-d8c698c8.js → node/USE_SERVER_BUNDLE-cd844269.js} +1 -1
  21. package/lib/node/{bundle-3b073b16.mjs → bundle-0358b224.mjs} +415 -444
  22. package/lib/node/bundle-630ffe6d.js +76 -0
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +23 -22
  25. package/package.json +5 -3
  26. package/types/blocks/image/image.d.ts +1 -1
  27. package/types/constants/sdk-version.d.ts +1 -1
  28. package/lib/browser/USE_CLIENT_BUNDLE-3a41b1ba.js +0 -23
  29. package/lib/browser/USE_CLIENT_BUNDLE-fc8c1bc0.mjs +0 -618
  30. package/lib/browser/USE_SERVER_BUNDLE-226a15ac.mjs +0 -11
  31. package/lib/edge/USE_CLIENT_BUNDLE-0e9f8e67.mjs +0 -618
  32. package/lib/edge/USE_CLIENT_BUNDLE-d48583e8.js +0 -23
  33. package/lib/edge/USE_SERVER_BUNDLE-f6a1e321.mjs +0 -11
  34. package/lib/node/USE_CLIENT_BUNDLE-3a41b1ba.js +0 -23
  35. package/lib/node/USE_CLIENT_BUNDLE-fc8c1bc0.mjs +0 -618
  36. package/lib/node/USE_SERVER_BUNDLE-226a15ac.mjs +0 -11
  37. package/lib/node/bundle-0fae602b.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-fc8c1bc0.mjs";
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-119431c8`,
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-119431c8-2",
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-119431c8 {
740
+ /* @__PURE__ */ l("style", { children: `.div-666689ca {
741
741
  display: flex;
742
742
  line-height: normal;
743
- }.div-119431c8-2 {
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: xn,
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.7.0", Z = {};
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,16 +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 un() {
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
- const O = (e) => C(e) ? e : !0;
1943
- function W(e) {
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) {
1944
2163
  return /* @__PURE__ */ l(
1945
2164
  "script",
1946
2165
  {
@@ -1949,7 +2168,7 @@ function W(e) {
1949
2168
  }
1950
2169
  );
1951
2170
  }
1952
- function oe(e) {
2171
+ function ie(e) {
1953
2172
  var i, r, a, c, s, u, f, g, p;
1954
2173
  const t = yt({
1955
2174
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
@@ -2022,7 +2241,7 @@ function oe(e) {
2022
2241
  showContent: e.showContent,
2023
2242
  builderContextSignal: o,
2024
2243
  children: [
2025
- e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: t }) }) : null,
2244
+ e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: t }) }) : null,
2026
2245
  /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
2027
2246
  Nt,
2028
2247
  {
@@ -2043,102 +2262,7 @@ function oe(e) {
2043
2262
  }
2044
2263
  );
2045
2264
  }
2046
- const dn = "builder.tests", j = (e) => `${dn}.${e}`, mn = ({
2047
- contentId: e
2048
- }) => he({
2049
- name: j(e),
2050
- canTrack: !0
2051
- }), fn = ({
2052
- contentId: e
2053
- }) => fe({
2054
- name: j(e),
2055
- canTrack: !0
2056
- }), hn = ({
2057
- contentId: e,
2058
- value: t
2059
- }) => ge({
2060
- name: j(e),
2061
- value: t,
2062
- canTrack: !0
2063
- }), Se = (e) => C(e.id) && C(e.variations) && Object.keys(e.variations).length > 0, gn = ({
2064
- id: e,
2065
- variations: t
2066
- }) => {
2067
- var i;
2068
- let n = 0;
2069
- const o = Math.random();
2070
- for (const r in t) {
2071
- const a = (i = t[r]) == null ? void 0 : i.testRatio;
2072
- if (n += a, o < n)
2073
- return r;
2074
- }
2075
- return e;
2076
- }, ve = (e) => {
2077
- const t = gn(e);
2078
- return hn({
2079
- contentId: e.id,
2080
- value: t
2081
- }).catch((n) => {
2082
- k.error("could not store A/B test variation: ", n);
2083
- }), t;
2084
- }, ke = ({
2085
- item: e,
2086
- testGroupId: t
2087
- }) => {
2088
- const n = e.variations[t];
2089
- return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
2090
- !n ? {
2091
- testVariationId: e.id,
2092
- testVariationName: "Default"
2093
- } : {
2094
- data: n.data,
2095
- testVariationId: n.id,
2096
- testVariationName: n.name || (n.id === e.id ? "Default" : "")
2097
- };
2098
- }, pn = ({
2099
- item: e,
2100
- canTrack: t
2101
- }) => {
2102
- if (!t)
2103
- return e;
2104
- if (!e)
2105
- return;
2106
- if (!Se(e))
2107
- return e;
2108
- const n = fn({
2109
- contentId: e.id
2110
- }) || ve({
2111
- variations: e.variations,
2112
- id: e.id
2113
- }), o = ke({
2114
- item: e,
2115
- testGroupId: n
2116
- });
2117
- return {
2118
- ...e,
2119
- ...o
2120
- };
2121
- }, bn = async ({
2122
- item: e,
2123
- canTrack: t
2124
- }) => {
2125
- if (!t || !Se(e))
2126
- return e;
2127
- const o = await mn({
2128
- contentId: e.id
2129
- }) || ve({
2130
- variations: e.variations,
2131
- id: e.id
2132
- }), i = ke({
2133
- item: e,
2134
- testGroupId: o
2135
- });
2136
- return {
2137
- ...e,
2138
- ...i
2139
- };
2140
- };
2141
- function we(e) {
2265
+ function Te(e) {
2142
2266
  var r, a, c;
2143
2267
  const t = mt({
2144
2268
  canTrack: O(e.canTrack),
@@ -2159,13 +2283,13 @@ function we(e) {
2159
2283
  return t ? {
2160
2284
  ...e.content,
2161
2285
  testVariationId: (u = e.content) == null ? void 0 : u.id
2162
- } : pn({
2286
+ } : gn({
2163
2287
  item: e.content,
2164
2288
  canTrack: O(e.canTrack)
2165
2289
  });
2166
2290
  };
2167
2291
  return /* @__PURE__ */ w(x, { children: [
2168
- !e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: pt() }) }) : null,
2292
+ !e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: pt() }) }) : null,
2169
2293
  t ? /* @__PURE__ */ w(x, { children: [
2170
2294
  /* @__PURE__ */ l(
2171
2295
  V,
@@ -2174,9 +2298,9 @@ function we(e) {
2174
2298
  styles: o()
2175
2299
  }
2176
2300
  ),
2177
- /* @__PURE__ */ l(W, { scriptStr: n() }),
2301
+ /* @__PURE__ */ l(N, { scriptStr: n() }),
2178
2302
  (a = R(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ l(
2179
- oe,
2303
+ ie,
2180
2304
  {
2181
2305
  content: s,
2182
2306
  showContent: !1,
@@ -2197,7 +2321,7 @@ function we(e) {
2197
2321
  ))
2198
2322
  ] }) : null,
2199
2323
  /* @__PURE__ */ l(
2200
- oe,
2324
+ ie,
2201
2325
  {
2202
2326
  content: i(),
2203
2327
  classNameProp: `variant-${(c = e.content) == null ? void 0 : c.id}`,
@@ -2217,7 +2341,7 @@ function we(e) {
2217
2341
  )
2218
2342
  ] });
2219
2343
  }
2220
- const yn = async ({
2344
+ const Rn = async ({
2221
2345
  builderContextValue: e,
2222
2346
  symbol: t
2223
2347
  }) => {
@@ -2236,7 +2360,7 @@ const yn = async ({
2236
2360
  k.error("Could not fetch symbol content: ", n);
2237
2361
  });
2238
2362
  };
2239
- async function xn(e) {
2363
+ async function En(e) {
2240
2364
  var o, i, r, a;
2241
2365
  const t = function() {
2242
2366
  var s, u;
@@ -2246,12 +2370,12 @@ async function xn(e) {
2246
2370
  (s = e.symbol) != null && s.inline ? "builder-inline-symbol" : void 0,
2247
2371
  (u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2248
2372
  ].filter(Boolean).join(" ");
2249
- }, n = ((o = e.symbol) == null ? void 0 : o.content) || await yn({
2373
+ }, n = ((o = e.symbol) == null ? void 0 : o.content) || await Rn({
2250
2374
  symbol: e.symbol,
2251
2375
  builderContextValue: e.builderContext
2252
2376
  });
2253
2377
  return /* @__PURE__ */ l("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ l(
2254
- we,
2378
+ Te,
2255
2379
  {
2256
2380
  __isNestedRender: !0,
2257
2381
  apiVersion: e.builderContext.apiVersion,
@@ -2268,145 +2392,18 @@ async function xn(e) {
2268
2392
  }
2269
2393
  ) });
2270
2394
  }
2271
- const Kn = _, Hn = we;
2272
- function Dn() {
2273
- return !v() || L() ? !1 : location.search.indexOf("builder.preview=") !== -1;
2274
- }
2275
- const ie = {};
2276
- function zn(e) {
2395
+ const zn = _, qn = Te, re = {};
2396
+ function Gn(e) {
2277
2397
  if (v()) {
2278
- Object.assign(ie, e);
2398
+ Object.assign(re, e);
2279
2399
  const t = {
2280
2400
  type: "builder.settingsChange",
2281
- data: ie
2401
+ data: re
2282
2402
  };
2283
2403
  parent.postMessage(t, "*");
2284
2404
  }
2285
2405
  }
2286
- const Sn = (e) => {
2287
- const t = e.get("preview"), n = e.get("overrides." + t);
2288
- return n || k.warn("No previewed ID found in search params."), n;
2289
- };
2290
- function vn(e) {
2291
- un();
2292
- const t = Sn(e);
2293
- return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
2294
- }
2295
- function N(e, t = null, n = ".") {
2296
- return Object.keys(e).reduce((o, i) => {
2297
- const r = e[i], a = [t, i].filter(Boolean).join(n);
2298
- return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
2299
- ...o,
2300
- ...N(r, a, n)
2301
- } : {
2302
- ...o,
2303
- [a]: r
2304
- };
2305
- }, {});
2306
- }
2307
- const re = "builder.", kn = "options.", wn = (e) => {
2308
- const t = {};
2309
- return e.forEach((n, o) => {
2310
- t[o] = n;
2311
- }), t;
2312
- }, Ce = (e) => {
2313
- if (!e)
2314
- return {};
2315
- const t = Ie(e), n = {};
2316
- return Object.keys(t).forEach((o) => {
2317
- if (o.startsWith(re)) {
2318
- const i = o.replace(re, "").replace(kn, "");
2319
- n[i] = t[o];
2320
- }
2321
- }), n;
2322
- }, Cn = () => {
2323
- if (!v())
2324
- return {};
2325
- const e = new URLSearchParams(window.location.search);
2326
- return Ce(e);
2327
- }, Ie = (e) => e instanceof URLSearchParams ? wn(e) : e, In = "v3", K = (e) => {
2328
- let {
2329
- noTraverse: t = !1
2330
- } = e;
2331
- const {
2332
- limit: n = 30,
2333
- userAttributes: o,
2334
- query: i,
2335
- model: r,
2336
- apiKey: a,
2337
- includeRefs: c = !0,
2338
- enrich: s,
2339
- locale: u,
2340
- apiVersion: f = In
2341
- } = e;
2342
- if (!a)
2343
- throw new Error("Missing API key");
2344
- if (!["v2", "v3"].includes(f))
2345
- throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
2346
- (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
2347
- 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 = {
2348
- ...Cn(),
2349
- ...Ie(e.options || {})
2350
- }, m = N(p);
2351
- for (const h in m)
2352
- g.searchParams.set(h, String(m[h]));
2353
- if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), i) {
2354
- const h = N({
2355
- query: i
2356
- });
2357
- for (const d in h)
2358
- g.searchParams.set(d, JSON.stringify(h[d]));
2359
- }
2360
- return g;
2361
- }, Tn = (e) => "results" in e;
2362
- async function H(e) {
2363
- const t = await Te({
2364
- ...e,
2365
- limit: 1
2366
- });
2367
- return t && t.results[0] || null;
2368
- }
2369
- const qn = H, Rn = async (e) => {
2370
- const t = K(e);
2371
- return await (await jt(t.href)).json();
2372
- }, En = async (e, t, n = K(e)) => {
2373
- const o = O(e.canTrack);
2374
- if (n.search.includes("preview=")) {
2375
- const r = [];
2376
- for (const a of t.results) {
2377
- const c = vn(n.searchParams);
2378
- r.push(c || a);
2379
- }
2380
- t.results = r;
2381
- }
2382
- if (!o || !(v() || I === "reactNative"))
2383
- return t;
2384
- try {
2385
- const r = [];
2386
- for (const a of t.results)
2387
- r.push(await bn({
2388
- item: a,
2389
- canTrack: o
2390
- }));
2391
- t.results = r;
2392
- } catch (r) {
2393
- k.error("Could not process A/B tests. ", r);
2394
- }
2395
- return t;
2396
- };
2397
- async function Te(e) {
2398
- try {
2399
- const t = K(e), n = await Rn(e);
2400
- return Tn(n) ? En(e, n) : (k.error("Error fetching data. ", {
2401
- url: t,
2402
- content: n,
2403
- options: e
2404
- }), null);
2405
- } catch (t) {
2406
- return k.error("Error fetching data. ", t), null;
2407
- }
2408
- }
2409
- const Gn = Te, Jn = async (e) => {
2406
+ const Jn = async (e) => {
2410
2407
  var o, i, r;
2411
2408
  const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((i = e.userAttributes) == null ? void 0 : i.urlPath), n = {
2412
2409
  ...e,
@@ -2418,7 +2415,7 @@ const Gn = Te, Jn = async (e) => {
2418
2415
  urlPath: t
2419
2416
  } : {}
2420
2417
  },
2421
- options: Ce(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
2418
+ options: we(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
2422
2419
  };
2423
2420
  return {
2424
2421
  apiKey: n.apiKey,
@@ -2427,39 +2424,39 @@ const Gn = Te, Jn = async (e) => {
2427
2424
  };
2428
2425
  };
2429
2426
  export {
2430
- Ce as A,
2427
+ we as A,
2431
2428
  _ as B,
2432
- we as C,
2429
+ Te as C,
2433
2430
  Mn as D,
2434
2431
  Jn as E,
2435
- Kn as R,
2436
- xn as S,
2432
+ zn as R,
2433
+ En as S,
2437
2434
  Tt as T,
2438
2435
  rn as _,
2439
2436
  On as a,
2440
2437
  Wn as b,
2441
2438
  Nn as c,
2442
2439
  v as d,
2443
- Ln as e,
2444
- O as f,
2440
+ O as e,
2441
+ Dn as f,
2445
2442
  at as g,
2446
2443
  M as h,
2447
2444
  L as i,
2448
2445
  jn as j,
2449
2446
  A as k,
2450
2447
  k as l,
2451
- jt as m,
2452
- un as n,
2453
- Hn as o,
2454
- lt as p,
2455
- Dn as q,
2448
+ Ln as m,
2449
+ H as n,
2450
+ jt as o,
2451
+ yn as p,
2452
+ qn as q,
2456
2453
  Un as r,
2457
2454
  _n as s,
2458
- sn as t,
2459
- zn as u,
2460
- Te as v,
2461
- H as w,
2462
- Gn as x,
2463
- qn as y,
2464
- En as z
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
2465
2462
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-0fae602b.js"),t=require("./USE_CLIENT_BUNDLE-3a41b1ba.js");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-d8c698c8.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;
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;