@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 qr } from "lru-cache";
2
2
  import { jsx as I, Fragment as _, jsxs as ce } from "react/jsx-runtime";
3
3
  import { createElement as Zr } from "react";
4
- import { I as Qr, B as Wn, a as eo, b as to, C as no, E as ro, F as oo, c as io, d as ao, S as so, V as lo, e as co } from "./USE_CLIENT_BUNDLE-0e9f8e67.mjs";
4
+ import { I as Qr, B as Wn, a as eo, b as to, C as no, E as ro, F as oo, c as io, d as ao, S as so, V as lo, e as co } from "./USE_CLIENT_BUNDLE-4a0cfa69.mjs";
5
5
  import "next/navigation";
6
6
  const lt = (e) => JSON.parse(JSON.stringify(e)), lr = {
7
7
  small: {
@@ -3153,14 +3153,14 @@ function Jo(e) {
3153
3153
  /* @__PURE__ */ ce(
3154
3154
  "div",
3155
3155
  {
3156
- className: `builder-columns ${e.builderBlock.id}-breakpoints div-119431c8`,
3156
+ className: `builder-columns ${e.builderBlock.id}-breakpoints div-666689ca`,
3157
3157
  style: m(),
3158
3158
  children: [
3159
3159
  /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(ft, { styles: P() }) }),
3160
3160
  (E = e.columns) == null ? void 0 : E.map((S, v) => /* @__PURE__ */ Zr(
3161
3161
  "div",
3162
3162
  {
3163
- className: "builder-column div-119431c8-2",
3163
+ className: "builder-column div-666689ca-2",
3164
3164
  style: g(v),
3165
3165
  key: v
3166
3166
  },
@@ -3181,10 +3181,10 @@ function Jo(e) {
3181
3181
  ]
3182
3182
  }
3183
3183
  ),
3184
- /* @__PURE__ */ I("style", { children: `.div-119431c8 {
3184
+ /* @__PURE__ */ I("style", { children: `.div-666689ca {
3185
3185
  display: flex;
3186
3186
  line-height: normal;
3187
- }.div-119431c8-2 {
3187
+ }.div-666689ca-2 {
3188
3188
  display: flex;
3189
3189
  flex-direction: column;
3190
3190
  align-items: stretch;
@@ -3923,7 +3923,7 @@ const hi = {
3923
3923
  component: so,
3924
3924
  ...ci
3925
3925
  }, {
3926
- component: oa,
3926
+ component: ha,
3927
3927
  ...ui
3928
3928
  }, {
3929
3929
  component: pi,
@@ -4232,7 +4232,7 @@ async function Hi(e) {
4232
4232
  const ka = (e) => Hi({
4233
4233
  ...e,
4234
4234
  canTrack: !0
4235
- }), Ki = "0.7.0", tr = {};
4235
+ }), Ki = "0.7.1-0", tr = {};
4236
4236
  function Gi(e, t) {
4237
4237
  let r = tr[e];
4238
4238
  if (r || (r = tr[e] = []), r.push(t), J()) {
@@ -4375,16 +4375,235 @@ const Xi = (e, t, r = !0) => {
4375
4375
  builderElementIndex: r && n ? [].slice.call(document.getElementsByClassName(n)).indexOf(r) : void 0
4376
4376
  }
4377
4377
  };
4378
+ }, Ji = "builder.tests", cn = (e) => `${Ji}.${e}`, Yi = ({
4379
+ contentId: e
4380
+ }) => br({
4381
+ name: cn(e),
4382
+ canTrack: !0
4383
+ }), qi = ({
4384
+ contentId: e
4385
+ }) => Sr({
4386
+ name: cn(e),
4387
+ canTrack: !0
4388
+ }), Zi = ({
4389
+ contentId: e,
4390
+ value: t
4391
+ }) => kr({
4392
+ name: cn(e),
4393
+ value: t,
4394
+ canTrack: !0
4395
+ }), Ar = (e) => fe(e.id) && fe(e.variations) && Object.keys(e.variations).length > 0, Qi = ({
4396
+ id: e,
4397
+ variations: t
4398
+ }) => {
4399
+ var o;
4400
+ let r = 0;
4401
+ const n = Math.random();
4402
+ for (const a in t) {
4403
+ const s = (o = t[a]) == null ? void 0 : o.testRatio;
4404
+ if (r += s, n < r)
4405
+ return a;
4406
+ }
4407
+ return e;
4408
+ }, jr = (e) => {
4409
+ const t = Qi(e);
4410
+ return Zi({
4411
+ contentId: e.id,
4412
+ value: t
4413
+ }).catch((r) => {
4414
+ q.error("could not store A/B test variation: ", r);
4415
+ }), t;
4416
+ }, Or = ({
4417
+ item: e,
4418
+ testGroupId: t
4419
+ }) => {
4420
+ const r = e.variations[t];
4421
+ return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
4422
+ !r ? {
4423
+ testVariationId: e.id,
4424
+ testVariationName: "Default"
4425
+ } : {
4426
+ data: r.data,
4427
+ testVariationId: r.id,
4428
+ testVariationName: r.name || (r.id === e.id ? "Default" : "")
4429
+ };
4430
+ }, ea = ({
4431
+ item: e,
4432
+ canTrack: t
4433
+ }) => {
4434
+ if (!t)
4435
+ return e;
4436
+ if (!e)
4437
+ return;
4438
+ if (!Ar(e))
4439
+ return e;
4440
+ const r = qi({
4441
+ contentId: e.id
4442
+ }) || jr({
4443
+ variations: e.variations,
4444
+ id: e.id
4445
+ }), n = Or({
4446
+ item: e,
4447
+ testGroupId: r
4448
+ });
4449
+ return {
4450
+ ...e,
4451
+ ...n
4452
+ };
4453
+ }, ta = async ({
4454
+ item: e,
4455
+ canTrack: t
4456
+ }) => {
4457
+ if (!t || !Ar(e))
4458
+ return e;
4459
+ const n = await Yi({
4460
+ contentId: e.id
4461
+ }) || jr({
4462
+ variations: e.variations,
4463
+ id: e.id
4464
+ }), o = Or({
4465
+ item: e,
4466
+ testGroupId: n
4467
+ });
4468
+ return {
4469
+ ...e,
4470
+ ...o
4471
+ };
4472
+ }, Ht = (e) => fe(e) ? e : !0, na = (e) => {
4473
+ const t = e.get("preview"), r = e.get("overrides." + t);
4474
+ return r || q.warn("No previewed ID found in search params."), r;
4378
4475
  };
4379
- function Ji() {
4476
+ function ra() {
4380
4477
  globalThis._BUILDER_PREVIEW_LRU_CACHE || (globalThis._BUILDER_PREVIEW_LRU_CACHE = new qr({
4381
4478
  max: 500,
4382
4479
  // how long to live in ms
4383
4480
  ttl: 1e3 * 60 * 5
4384
4481
  }));
4385
4482
  }
4386
- const Ht = (e) => fe(e) ? e : !0;
4387
- function Kt(e) {
4483
+ function oa(e) {
4484
+ ra();
4485
+ const t = na(e);
4486
+ return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
4487
+ }
4488
+ function Kt(e, t = null, r = ".") {
4489
+ return Object.keys(e).reduce((n, o) => {
4490
+ const a = e[o], s = [t, o].filter(Boolean).join(r);
4491
+ return [typeof a == "object", a !== null, !(Array.isArray(a) && a.length === 0)].every(Boolean) ? {
4492
+ ...n,
4493
+ ...Kt(a, s, r)
4494
+ } : {
4495
+ ...n,
4496
+ [s]: a
4497
+ };
4498
+ }, {});
4499
+ }
4500
+ const ir = "builder.", ia = "options.", aa = (e) => {
4501
+ const t = {};
4502
+ return e.forEach((r, n) => {
4503
+ t[n] = r;
4504
+ }), t;
4505
+ }, Rr = (e) => {
4506
+ if (!e)
4507
+ return {};
4508
+ const t = Pr(e), r = {};
4509
+ return Object.keys(t).forEach((n) => {
4510
+ if (n.startsWith(ir)) {
4511
+ const o = n.replace(ir, "").replace(ia, "");
4512
+ r[o] = t[n];
4513
+ }
4514
+ }), r;
4515
+ }, sa = () => {
4516
+ if (!J())
4517
+ return {};
4518
+ const e = new URLSearchParams(window.location.search);
4519
+ return Rr(e);
4520
+ }, Pr = (e) => e instanceof URLSearchParams ? aa(e) : e, la = "v3", un = (e) => {
4521
+ let {
4522
+ noTraverse: t = !1
4523
+ } = e;
4524
+ const {
4525
+ limit: r = 30,
4526
+ userAttributes: n,
4527
+ query: o,
4528
+ model: a,
4529
+ apiKey: s,
4530
+ includeRefs: f = !0,
4531
+ enrich: h,
4532
+ locale: m,
4533
+ apiVersion: g = la
4534
+ } = e;
4535
+ if (!s)
4536
+ throw new Error("Missing API key");
4537
+ if (!["v2", "v3"].includes(g))
4538
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${g}'`);
4539
+ (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
4540
+ const y = new URL(`https://cdn.builder.io/api/${g}/content/${a}?apiKey=${s}&limit=${r}&noTraverse=${t}&includeRefs=${f}${m ? `&locale=${m}` : ""}${h ? `&enrich=${h}` : ""}`), P = {
4541
+ ...sa(),
4542
+ ...Pr(e.options || {})
4543
+ }, E = Kt(P);
4544
+ for (const S in E)
4545
+ y.searchParams.set(S, String(E[S]));
4546
+ if (n && y.searchParams.set("userAttributes", JSON.stringify(n)), o) {
4547
+ const S = Kt({
4548
+ query: o
4549
+ });
4550
+ for (const v in S)
4551
+ y.searchParams.set(v, JSON.stringify(S[v]));
4552
+ }
4553
+ return y;
4554
+ }, ca = (e) => "results" in e;
4555
+ async function fn(e) {
4556
+ const t = await Nr({
4557
+ ...e,
4558
+ limit: 1
4559
+ });
4560
+ return t && t.results[0] || null;
4561
+ }
4562
+ const Ta = fn, ua = async (e) => {
4563
+ const t = un(e);
4564
+ return await (await Ai(t.href)).json();
4565
+ }, fa = async (e, t, r = un(e)) => {
4566
+ const n = Ht(e.canTrack);
4567
+ if (r.search.includes("preview=")) {
4568
+ const a = [];
4569
+ for (const s of t.results) {
4570
+ const f = oa(r.searchParams);
4571
+ a.push(f || s);
4572
+ }
4573
+ t.results = a;
4574
+ }
4575
+ if (!n || !(J() || ge === "reactNative"))
4576
+ return t;
4577
+ try {
4578
+ const a = [];
4579
+ for (const s of t.results)
4580
+ a.push(await ta({
4581
+ item: s,
4582
+ canTrack: n
4583
+ }));
4584
+ t.results = a;
4585
+ } catch (a) {
4586
+ q.error("Could not process A/B tests. ", a);
4587
+ }
4588
+ return t;
4589
+ };
4590
+ async function Nr(e) {
4591
+ try {
4592
+ const t = un(e), r = await ua(e);
4593
+ return ca(r) ? fa(e, r) : (q.error("Error fetching data. ", {
4594
+ url: t,
4595
+ content: r,
4596
+ options: e
4597
+ }), null);
4598
+ } catch (t) {
4599
+ return q.error("Error fetching data. ", t), null;
4600
+ }
4601
+ }
4602
+ const Aa = Nr;
4603
+ function ja() {
4604
+ return !J() || Xt() ? !1 : location.search.indexOf("builder.preview=") !== -1;
4605
+ }
4606
+ function Gt(e) {
4388
4607
  return /* @__PURE__ */ I(
4389
4608
  "script",
4390
4609
  {
@@ -4393,7 +4612,7 @@ function Kt(e) {
4393
4612
  }
4394
4613
  );
4395
4614
  }
4396
- function ir(e) {
4615
+ function ar(e) {
4397
4616
  var o, a, s, f, h, m, g, y, P;
4398
4617
  const t = oi({
4399
4618
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
@@ -4466,7 +4685,7 @@ function ir(e) {
4466
4685
  showContent: e.showContent,
4467
4686
  builderContextSignal: n,
4468
4687
  children: [
4469
- e.isSsrAbTest ? /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(Kt, { scriptStr: t }) }) : null,
4688
+ e.isSsrAbTest ? /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(Gt, { scriptStr: t }) }) : null,
4470
4689
  /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(
4471
4690
  ki,
4472
4691
  {
@@ -4487,102 +4706,7 @@ function ir(e) {
4487
4706
  }
4488
4707
  );
4489
4708
  }
4490
- const Yi = "builder.tests", cn = (e) => `${Yi}.${e}`, qi = ({
4491
- contentId: e
4492
- }) => br({
4493
- name: cn(e),
4494
- canTrack: !0
4495
- }), Zi = ({
4496
- contentId: e
4497
- }) => Sr({
4498
- name: cn(e),
4499
- canTrack: !0
4500
- }), Qi = ({
4501
- contentId: e,
4502
- value: t
4503
- }) => kr({
4504
- name: cn(e),
4505
- value: t,
4506
- canTrack: !0
4507
- }), Ar = (e) => fe(e.id) && fe(e.variations) && Object.keys(e.variations).length > 0, ea = ({
4508
- id: e,
4509
- variations: t
4510
- }) => {
4511
- var o;
4512
- let r = 0;
4513
- const n = Math.random();
4514
- for (const a in t) {
4515
- const s = (o = t[a]) == null ? void 0 : o.testRatio;
4516
- if (r += s, n < r)
4517
- return a;
4518
- }
4519
- return e;
4520
- }, jr = (e) => {
4521
- const t = ea(e);
4522
- return Qi({
4523
- contentId: e.id,
4524
- value: t
4525
- }).catch((r) => {
4526
- q.error("could not store A/B test variation: ", r);
4527
- }), t;
4528
- }, Or = ({
4529
- item: e,
4530
- testGroupId: t
4531
- }) => {
4532
- const r = e.variations[t];
4533
- return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
4534
- !r ? {
4535
- testVariationId: e.id,
4536
- testVariationName: "Default"
4537
- } : {
4538
- data: r.data,
4539
- testVariationId: r.id,
4540
- testVariationName: r.name || (r.id === e.id ? "Default" : "")
4541
- };
4542
- }, ta = ({
4543
- item: e,
4544
- canTrack: t
4545
- }) => {
4546
- if (!t)
4547
- return e;
4548
- if (!e)
4549
- return;
4550
- if (!Ar(e))
4551
- return e;
4552
- const r = Zi({
4553
- contentId: e.id
4554
- }) || jr({
4555
- variations: e.variations,
4556
- id: e.id
4557
- }), n = Or({
4558
- item: e,
4559
- testGroupId: r
4560
- });
4561
- return {
4562
- ...e,
4563
- ...n
4564
- };
4565
- }, na = async ({
4566
- item: e,
4567
- canTrack: t
4568
- }) => {
4569
- if (!t || !Ar(e))
4570
- return e;
4571
- const n = await qi({
4572
- contentId: e.id
4573
- }) || jr({
4574
- variations: e.variations,
4575
- id: e.id
4576
- }), o = Or({
4577
- item: e,
4578
- testGroupId: n
4579
- });
4580
- return {
4581
- ...e,
4582
- ...o
4583
- };
4584
- };
4585
- function Rr(e) {
4709
+ function Mr(e) {
4586
4710
  var a, s, f;
4587
4711
  const t = Zo({
4588
4712
  canTrack: Ht(e.canTrack),
@@ -4603,13 +4727,13 @@ function Rr(e) {
4603
4727
  return t ? {
4604
4728
  ...e.content,
4605
4729
  testVariationId: (m = e.content) == null ? void 0 : m.id
4606
- } : ta({
4730
+ } : ea({
4607
4731
  item: e.content,
4608
4732
  canTrack: Ht(e.canTrack)
4609
4733
  });
4610
4734
  };
4611
4735
  return /* @__PURE__ */ ce(_, { children: [
4612
- !e.__isNestedRender && ge !== "reactNative" ? /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(Kt, { scriptStr: ni() }) }) : null,
4736
+ !e.__isNestedRender && ge !== "reactNative" ? /* @__PURE__ */ I(_, { children: /* @__PURE__ */ I(Gt, { scriptStr: ni() }) }) : null,
4613
4737
  t ? /* @__PURE__ */ ce(_, { children: [
4614
4738
  /* @__PURE__ */ I(
4615
4739
  ft,
@@ -4618,9 +4742,9 @@ function Rr(e) {
4618
4742
  styles: n()
4619
4743
  }
4620
4744
  ),
4621
- /* @__PURE__ */ I(Kt, { scriptStr: r() }),
4745
+ /* @__PURE__ */ I(Gt, { scriptStr: r() }),
4622
4746
  (s = at(e.content)) == null ? void 0 : s.map((h) => /* @__PURE__ */ I(
4623
- ir,
4747
+ ar,
4624
4748
  {
4625
4749
  content: h,
4626
4750
  showContent: !1,
@@ -4641,7 +4765,7 @@ function Rr(e) {
4641
4765
  ))
4642
4766
  ] }) : null,
4643
4767
  /* @__PURE__ */ I(
4644
- ir,
4768
+ ar,
4645
4769
  {
4646
4770
  content: o(),
4647
4771
  classNameProp: `variant-${(f = e.content) == null ? void 0 : f.id}`,
@@ -4661,7 +4785,7 @@ function Rr(e) {
4661
4785
  )
4662
4786
  ] });
4663
4787
  }
4664
- const ra = async ({
4788
+ const pa = async ({
4665
4789
  builderContextValue: e,
4666
4790
  symbol: t
4667
4791
  }) => {
@@ -4680,7 +4804,7 @@ const ra = async ({
4680
4804
  q.error("Could not fetch symbol content: ", r);
4681
4805
  });
4682
4806
  };
4683
- async function oa(e) {
4807
+ async function ha(e) {
4684
4808
  var n, o, a, s;
4685
4809
  const t = function() {
4686
4810
  var h, m;
@@ -4690,12 +4814,12 @@ async function oa(e) {
4690
4814
  (h = e.symbol) != null && h.inline ? "builder-inline-symbol" : void 0,
4691
4815
  (m = e.symbol) != null && m.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
4692
4816
  ].filter(Boolean).join(" ");
4693
- }, r = ((n = e.symbol) == null ? void 0 : n.content) || await ra({
4817
+ }, r = ((n = e.symbol) == null ? void 0 : n.content) || await pa({
4694
4818
  symbol: e.symbol,
4695
4819
  builderContextValue: e.builderContext
4696
4820
  });
4697
4821
  return /* @__PURE__ */ I("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ I(
4698
- Rr,
4822
+ Mr,
4699
4823
  {
4700
4824
  __isNestedRender: !0,
4701
4825
  apiVersion: e.builderContext.apiVersion,
@@ -4712,145 +4836,18 @@ async function oa(e) {
4712
4836
  }
4713
4837
  ) });
4714
4838
  }
4715
- const Ta = ln, Aa = Rr;
4716
- function ja() {
4717
- return !J() || Xt() ? !1 : location.search.indexOf("builder.preview=") !== -1;
4718
- }
4719
- const ar = {};
4720
- function Oa(e) {
4839
+ const Oa = ln, Ra = Mr, sr = {};
4840
+ function Pa(e) {
4721
4841
  if (J()) {
4722
- Object.assign(ar, e);
4842
+ Object.assign(sr, e);
4723
4843
  const t = {
4724
4844
  type: "builder.settingsChange",
4725
- data: ar
4845
+ data: sr
4726
4846
  };
4727
4847
  parent.postMessage(t, "*");
4728
4848
  }
4729
4849
  }
4730
- const ia = (e) => {
4731
- const t = e.get("preview"), r = e.get("overrides." + t);
4732
- return r || q.warn("No previewed ID found in search params."), r;
4733
- };
4734
- function aa(e) {
4735
- Ji();
4736
- const t = ia(e);
4737
- return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
4738
- }
4739
- function Gt(e, t = null, r = ".") {
4740
- return Object.keys(e).reduce((n, o) => {
4741
- const a = e[o], s = [t, o].filter(Boolean).join(r);
4742
- return [typeof a == "object", a !== null, !(Array.isArray(a) && a.length === 0)].every(Boolean) ? {
4743
- ...n,
4744
- ...Gt(a, s, r)
4745
- } : {
4746
- ...n,
4747
- [s]: a
4748
- };
4749
- }, {});
4750
- }
4751
- const sr = "builder.", sa = "options.", la = (e) => {
4752
- const t = {};
4753
- return e.forEach((r, n) => {
4754
- t[n] = r;
4755
- }), t;
4756
- }, Pr = (e) => {
4757
- if (!e)
4758
- return {};
4759
- const t = Nr(e), r = {};
4760
- return Object.keys(t).forEach((n) => {
4761
- if (n.startsWith(sr)) {
4762
- const o = n.replace(sr, "").replace(sa, "");
4763
- r[o] = t[n];
4764
- }
4765
- }), r;
4766
- }, ca = () => {
4767
- if (!J())
4768
- return {};
4769
- const e = new URLSearchParams(window.location.search);
4770
- return Pr(e);
4771
- }, Nr = (e) => e instanceof URLSearchParams ? la(e) : e, ua = "v3", un = (e) => {
4772
- let {
4773
- noTraverse: t = !1
4774
- } = e;
4775
- const {
4776
- limit: r = 30,
4777
- userAttributes: n,
4778
- query: o,
4779
- model: a,
4780
- apiKey: s,
4781
- includeRefs: f = !0,
4782
- enrich: h,
4783
- locale: m,
4784
- apiVersion: g = ua
4785
- } = e;
4786
- if (!s)
4787
- throw new Error("Missing API key");
4788
- if (!["v2", "v3"].includes(g))
4789
- throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${g}'`);
4790
- (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
4791
- const y = new URL(`https://cdn.builder.io/api/${g}/content/${a}?apiKey=${s}&limit=${r}&noTraverse=${t}&includeRefs=${f}${m ? `&locale=${m}` : ""}${h ? `&enrich=${h}` : ""}`), P = {
4792
- ...ca(),
4793
- ...Nr(e.options || {})
4794
- }, E = Gt(P);
4795
- for (const S in E)
4796
- y.searchParams.set(S, String(E[S]));
4797
- if (n && y.searchParams.set("userAttributes", JSON.stringify(n)), o) {
4798
- const S = Gt({
4799
- query: o
4800
- });
4801
- for (const v in S)
4802
- y.searchParams.set(v, JSON.stringify(S[v]));
4803
- }
4804
- return y;
4805
- }, fa = (e) => "results" in e;
4806
- async function fn(e) {
4807
- const t = await Mr({
4808
- ...e,
4809
- limit: 1
4810
- });
4811
- return t && t.results[0] || null;
4812
- }
4813
- const Ra = fn, pa = async (e) => {
4814
- const t = un(e);
4815
- return await (await Ai(t.href)).json();
4816
- }, ha = async (e, t, r = un(e)) => {
4817
- const n = Ht(e.canTrack);
4818
- if (r.search.includes("preview=")) {
4819
- const a = [];
4820
- for (const s of t.results) {
4821
- const f = aa(r.searchParams);
4822
- a.push(f || s);
4823
- }
4824
- t.results = a;
4825
- }
4826
- if (!n || !(J() || ge === "reactNative"))
4827
- return t;
4828
- try {
4829
- const a = [];
4830
- for (const s of t.results)
4831
- a.push(await na({
4832
- item: s,
4833
- canTrack: n
4834
- }));
4835
- t.results = a;
4836
- } catch (a) {
4837
- q.error("Could not process A/B tests. ", a);
4838
- }
4839
- return t;
4840
- };
4841
- async function Mr(e) {
4842
- try {
4843
- const t = un(e), r = await pa(e);
4844
- return fa(r) ? ha(e, r) : (q.error("Error fetching data. ", {
4845
- url: t,
4846
- content: r,
4847
- options: e
4848
- }), null);
4849
- } catch (t) {
4850
- return q.error("Error fetching data. ", t), null;
4851
- }
4852
- }
4853
- const Pa = Mr, Na = async (e) => {
4850
+ const Na = async (e) => {
4854
4851
  var n, o, a;
4855
4852
  const t = e.path || ((n = e.url) == null ? void 0 : n.pathname) || ((o = e.userAttributes) == null ? void 0 : o.urlPath), r = {
4856
4853
  ...e,
@@ -4862,7 +4859,7 @@ const Pa = Mr, Na = async (e) => {
4862
4859
  urlPath: t
4863
4860
  } : {}
4864
4861
  },
4865
- options: Pr(e.searchParams || ((a = e.url) == null ? void 0 : a.searchParams) || e.options)
4862
+ options: Rr(e.searchParams || ((a = e.url) == null ? void 0 : a.searchParams) || e.options)
4866
4863
  };
4867
4864
  return {
4868
4865
  apiKey: r.apiKey,
@@ -4871,39 +4868,39 @@ const Pa = Mr, Na = async (e) => {
4871
4868
  };
4872
4869
  };
4873
4870
  export {
4874
- Pr as A,
4871
+ Rr as A,
4875
4872
  ln as B,
4876
- Rr as C,
4873
+ Mr as C,
4877
4874
  ka as D,
4878
4875
  Na as E,
4879
- Ta as R,
4880
- oa as S,
4876
+ Oa as R,
4877
+ ha as S,
4881
4878
  pi as T,
4882
4879
  Hi as _,
4883
4880
  xa as a,
4884
4881
  wa as b,
4885
4882
  Sa as c,
4886
4883
  J as d,
4887
- ba as e,
4888
- Ht as f,
4884
+ Ht as e,
4885
+ ja as f,
4889
4886
  Go as g,
4890
4887
  an as h,
4891
4888
  Xt as i,
4892
4889
  Ia as j,
4893
4890
  lt as k,
4894
4891
  q as l,
4895
- Ai as m,
4896
- Ji as n,
4897
- Aa as o,
4898
- Jo as p,
4899
- ja as q,
4892
+ ba as m,
4893
+ fn as n,
4894
+ Ai as o,
4895
+ ra as p,
4896
+ Ra as q,
4900
4897
  Ca as r,
4901
4898
  Ea as s,
4902
- Gi as t,
4903
- Oa as u,
4904
- Mr as v,
4905
- fn as w,
4906
- Pa as x,
4907
- Ra as y,
4908
- ha as z
4899
+ Jo as t,
4900
+ Gi as u,
4901
+ Pa as v,
4902
+ Nr as w,
4903
+ Aa as x,
4904
+ Ta as y,
4905
+ fa as z
4909
4906
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-0c1d9099.js"),t=require("./USE_CLIENT_BUNDLE-d48583e8.js");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-105e9ef3.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-a0f5cad2.js"),t=require("./USE_CLIENT_BUNDLE-3cca560e.js");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-3f12faf4.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;