@builder.io/sdk-react 3.0.6 → 4.0.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 (77) hide show
  1. package/lib/browser/blocks-exports.cjs +32 -32
  2. package/lib/browser/blocks-exports.mjs +923 -860
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +1 -1
  5. package/lib/browser/{server-entry-df5e89e5.js → server-entry-422fad84.js} +51 -40
  6. package/lib/browser/server-entry-916191b4.cjs +2 -0
  7. package/lib/browser/server-entry.cjs +1 -1
  8. package/lib/browser/server-entry.mjs +1 -1
  9. package/lib/edge/{accordion-fbfb71f4.cjs → accordion-2f83fc75.cjs} +1 -1
  10. package/lib/edge/{accordion-289f3464.js → accordion-e1b77652.js} +1 -1
  11. package/lib/edge/{blocks-582a7fd7.js → blocks-0885e182.js} +1305 -1280
  12. package/lib/edge/blocks-5165c164.cjs +30 -0
  13. package/lib/edge/blocks-exports.cjs +1 -1
  14. package/lib/edge/blocks-exports.mjs +2 -2
  15. package/lib/edge/{button-da357144.cjs → button-d7197e96.cjs} +1 -1
  16. package/lib/edge/{button-9b112da6.js → button-d878f35c.js} +2 -2
  17. package/lib/edge/{columns-a211113f.cjs → columns-46729516.cjs} +1 -1
  18. package/lib/edge/{columns-aba58dda.js → columns-b365c86a.js} +3 -3
  19. package/lib/edge/{content-variants-08f4371c.js → content-variants-1594c868.js} +281 -279
  20. package/lib/edge/content-variants-c6cab1c3.cjs +134 -0
  21. package/lib/edge/{form-e3a3afd4.cjs → form-9844766c.cjs} +1 -1
  22. package/lib/edge/{form-4d4553c2.js → form-b66c20a3.js} +3 -3
  23. package/lib/edge/{get-class-prop-name-fbe244e3.cjs → get-class-prop-name-0b992cfb.cjs} +1 -1
  24. package/lib/edge/{get-class-prop-name-38c2baca.js → get-class-prop-name-dac81472.js} +1 -1
  25. package/lib/edge/{img-c49066fa.js → img-c4a772a8.js} +1 -1
  26. package/lib/edge/{img-8d549af8.cjs → img-fb35350a.cjs} +1 -1
  27. package/lib/edge/index.cjs +1 -1
  28. package/lib/edge/index.mjs +1 -1
  29. package/lib/edge/{input-1ae3842f.cjs → input-122768ac.cjs} +1 -1
  30. package/lib/edge/{input-e7301f4e.js → input-57c5b097.js} +1 -1
  31. package/lib/edge/{personalization-container-035be6ba.js → personalization-container-7e63edce.js} +4 -4
  32. package/lib/edge/{personalization-container-25cd8b5e.cjs → personalization-container-a17ae615.cjs} +1 -1
  33. package/lib/edge/{select-4187b229.js → select-3d4324ef.js} +1 -1
  34. package/lib/edge/{select-64fdaa79.cjs → select-7f750b70.cjs} +1 -1
  35. package/lib/edge/server-entry-77166102.cjs +2 -0
  36. package/lib/edge/{server-entry-61fca4f7.js → server-entry-c1673af2.js} +55 -44
  37. package/lib/edge/server-entry.cjs +1 -1
  38. package/lib/edge/server-entry.mjs +1 -1
  39. package/lib/edge/{slot-d6c46a42.js → slot-05ef18a0.js} +3 -3
  40. package/lib/edge/{slot-995f63c2.cjs → slot-123c0993.cjs} +1 -1
  41. package/lib/edge/symbol-ee314d5a.cjs +1 -0
  42. package/lib/edge/{symbol-623dc717.js → symbol-f488bea0.js} +25 -25
  43. package/lib/edge/{tabs-12ba41b1.js → tabs-244d53fa.js} +3 -3
  44. package/lib/edge/{tabs-d39499cd.cjs → tabs-edb82022.cjs} +1 -1
  45. package/lib/edge/{video-a3f10439.js → video-52df64e2.js} +54 -17
  46. package/lib/edge/video-cc58dd83.cjs +1 -0
  47. package/lib/node/blocks-exports.cjs +32 -32
  48. package/lib/node/blocks-exports.mjs +912 -849
  49. package/lib/node/index.cjs +1 -1
  50. package/lib/node/index.mjs +3 -3
  51. package/lib/node/init.cjs +1 -1
  52. package/lib/node/init.mjs +3 -3
  53. package/lib/node/{server-entry-27d9d31e.js → server-entry-4df60fc5.js} +51 -40
  54. package/lib/node/server-entry-8ab8c78b.cjs +2 -0
  55. package/lib/node/server-entry.cjs +1 -1
  56. package/lib/node/server-entry.mjs +1 -1
  57. package/lib/node/{setIvm-2dde9074.js → setIvm-0edfc727.js} +1 -1
  58. package/lib/node/{setIvm-784fe19f.cjs → setIvm-6405aa63.cjs} +1 -1
  59. package/lib/node/setIvm.cjs +1 -1
  60. package/lib/node/setIvm.mjs +2 -2
  61. package/lib/node/{should-force-browser-runtime-in-node-cd6baa94.cjs → should-force-browser-runtime-in-node-6d4dbff9.cjs} +1 -1
  62. package/lib/node/{should-force-browser-runtime-in-node-80f081c8.js → should-force-browser-runtime-in-node-7a39b073.js} +1 -1
  63. package/package.json +1 -1
  64. package/types/components/content-variants/content-variants.types.d.ts +2 -2
  65. package/types/constants/device-sizes.d.ts +3 -2
  66. package/types/constants/sdk-version.d.ts +1 -1
  67. package/types/helpers/subscribe-to-editor.d.ts +13 -13
  68. package/types/scripts/init-editing.d.ts +3 -1
  69. package/types/types/builder-block.d.ts +0 -1
  70. package/types/types/builder-content.d.ts +1 -0
  71. package/lib/browser/server-entry-a1c64831.cjs +0 -2
  72. package/lib/edge/blocks-459a090b.cjs +0 -30
  73. package/lib/edge/content-variants-4b5899b5.cjs +0 -134
  74. package/lib/edge/server-entry-2ef4e66a.cjs +0 -2
  75. package/lib/edge/symbol-498daa97.cjs +0 -1
  76. package/lib/edge/video-4ecfd08b.cjs +0 -1
  77. package/lib/node/server-entry-98ebff74.cjs +0 -2
@@ -47,7 +47,7 @@ const I = "[Builder.io]: ", f = {
47
47
  } catch (s) {
48
48
  f.warn("[COOKIE] SET error: ", (s == null ? void 0 : s.message) || s);
49
49
  }
50
- }, B = "builder.userAttributes";
50
+ }, R = "builder.userAttributes";
51
51
  function ut() {
52
52
  let t = !0;
53
53
  const e = /* @__PURE__ */ new Set();
@@ -60,14 +60,14 @@ function ut() {
60
60
  ...n
61
61
  };
62
62
  P({
63
- name: B,
63
+ name: R,
64
64
  value: JSON.stringify(r),
65
65
  canTrack: t
66
66
  }), e.forEach((s) => s(r));
67
67
  },
68
68
  getUserAttributes() {
69
69
  return c() ? JSON.parse(O({
70
- name: B,
70
+ name: R,
71
71
  canTrack: t
72
72
  }) || "{}") : {};
73
73
  },
@@ -129,24 +129,24 @@ function gt(t, e) {
129
129
  }
130
130
  }
131
131
  }
132
- const V = {};
132
+ const N = {};
133
133
  function se(t) {
134
134
  if (c()) {
135
- Object.assign(V, t);
135
+ Object.assign(N, t);
136
136
  const e = {
137
137
  type: "builder.settingsChange",
138
- data: V
138
+ data: N
139
139
  };
140
140
  parent.postMessage(e, "*");
141
141
  }
142
142
  }
143
- const N = "builder.", pt = "options.", $ = (t) => {
143
+ const V = "builder.", pt = "options.", $ = (t) => {
144
144
  if (!t)
145
145
  return {};
146
146
  const e = j(t), n = {};
147
147
  return Object.keys(e).forEach((r) => {
148
- if (r.startsWith(N)) {
149
- const s = r.replace(N, "").replace(pt, "");
148
+ if (r.startsWith(V)) {
149
+ const s = r.replace(V, "").replace(pt, "");
150
150
  n[s] = e[r];
151
151
  }
152
152
  }), n;
@@ -155,7 +155,7 @@ const N = "builder.", pt = "options.", $ = (t) => {
155
155
  return {};
156
156
  const t = new URLSearchParams(window.location.search);
157
157
  return $(t);
158
- }, G = "3.0.6", J = () => ({
158
+ }, G = "4.0.0", J = () => ({
159
159
  "X-Builder-SDK": v,
160
160
  "X-Builder-SDK-GEN": "2",
161
161
  "X-Builder-SDK-Version": G
@@ -166,16 +166,16 @@ function yt() {
166
166
  return (t == "x" ? e : e & 3 | 8).toString(16);
167
167
  });
168
168
  }
169
- function z() {
169
+ function X() {
170
170
  return yt().replace(/-/g, "");
171
171
  }
172
- const H = "builderSessionId", bt = async ({
172
+ const z = "builderSessionId", bt = async ({
173
173
  canTrack: t
174
174
  }) => {
175
175
  if (!t)
176
176
  return;
177
177
  const e = await M({
178
- name: H,
178
+ name: z,
179
179
  canTrack: t
180
180
  });
181
181
  if (y(e))
@@ -187,20 +187,20 @@ const H = "builderSessionId", bt = async ({
187
187
  canTrack: t
188
188
  }), n;
189
189
  }
190
- }, St = () => z(), wt = ({
190
+ }, St = () => X(), wt = ({
191
191
  id: t,
192
192
  canTrack: e
193
193
  }) => P({
194
- name: H,
194
+ name: z,
195
195
  value: t,
196
196
  canTrack: e
197
- }), X = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, vt = ({
197
+ }), H = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, vt = ({
198
198
  key: t,
199
199
  canTrack: e
200
200
  }) => {
201
201
  var n;
202
202
  try {
203
- return e ? (n = X()) == null ? void 0 : n.getItem(t) : void 0;
203
+ return e ? (n = H()) == null ? void 0 : n.getItem(t) : void 0;
204
204
  } catch (r) {
205
205
  console.debug("[LocalStorage] GET error: ", r);
206
206
  return;
@@ -212,7 +212,7 @@ const H = "builderSessionId", bt = async ({
212
212
  }) => {
213
213
  var r;
214
214
  try {
215
- e && ((r = X()) == null || r.setItem(t, n));
215
+ e && ((r = H()) == null || r.setItem(t, n));
216
216
  } catch (s) {
217
217
  console.debug("[LocalStorage] SET error: ", s);
218
218
  }
@@ -234,7 +234,7 @@ const H = "builderSessionId", bt = async ({
234
234
  canTrack: t
235
235
  }), n;
236
236
  }
237
- }, At = () => z(), Et = ({
237
+ }, At = () => X(), Et = ({
238
238
  id: t,
239
239
  canTrack: e
240
240
  }) => It({
@@ -316,7 +316,7 @@ const Pt = () => {
316
316
  ownerId: n
317
317
  }
318
318
  });
319
- async function Rt({
319
+ async function Bt({
320
320
  apiHost: t,
321
321
  ...e
322
322
  }) {
@@ -341,15 +341,15 @@ async function Rt({
341
341
  console.error("Failed to track: ", s);
342
342
  });
343
343
  }
344
- const oe = (t) => Rt({
344
+ const oe = (t) => Bt({
345
345
  ...t,
346
346
  canTrack: !0
347
- }), Bt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
347
+ }), Rt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
348
348
  function Y(t, e) {
349
349
  if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
350
350
  return !1;
351
351
  const n = new URL(e.origin), r = n.hostname;
352
- return (t || Bt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
352
+ return (t || Rt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
353
353
  }
354
354
  const ie = () => {
355
355
  gt("insertMenu", {
@@ -375,7 +375,7 @@ const ie = () => {
375
375
  });
376
376
  };
377
377
  let F = !1;
378
- const Lt = (t = {}) => {
378
+ const Lt = (t) => {
379
379
  var e, n;
380
380
  F || (F = !0, c() && ((e = window.parent) == null || e.postMessage({
381
381
  type: "builder.sdkInfo",
@@ -387,6 +387,9 @@ const Lt = (t = {}) => {
387
387
  // scope our '+ add block' button styling
388
388
  supportsAddBlockScoping: !0,
389
389
  supportsCustomBreakpoints: !0,
390
+ modelName: t.modelName,
391
+ apiKey: t.apiKey,
392
+ supportsXSmallBreakpoint: !0,
390
393
  blockLevelPersonalization: !0
391
394
  }
392
395
  }, "*"), (n = window.parent) == null || n.postMessage({
@@ -437,7 +440,7 @@ const Lt = (t = {}) => {
437
440
  }
438
441
  }
439
442
  })));
440
- }, Vt = ({
443
+ }, Nt = ({
441
444
  model: t,
442
445
  trustedHosts: e,
443
446
  callbacks: n
@@ -463,26 +466,34 @@ const Lt = (t = {}) => {
463
466
  break;
464
467
  }
465
468
  }
466
- }, ae = (t, e, n) => {
469
+ }, ae = ({
470
+ model: t,
471
+ apiKey: e,
472
+ callback: n,
473
+ trustedHosts: r
474
+ }) => {
467
475
  if (!c)
468
476
  return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
469
477
  };
470
- Lt();
471
- const r = Vt({
478
+ Lt({
479
+ modelName: t,
480
+ apiKey: e
481
+ });
482
+ const s = Nt({
472
483
  callbacks: {
473
- contentUpdate: e,
484
+ contentUpdate: n,
474
485
  animation: () => {
475
486
  },
476
487
  configureSdk: () => {
477
488
  }
478
489
  },
479
490
  model: t,
480
- trustedHosts: n == null ? void 0 : n.trustedHosts
491
+ trustedHosts: r
481
492
  });
482
- return window.addEventListener("message", r), () => {
483
- window.removeEventListener("message", r);
493
+ return window.addEventListener("message", s), () => {
494
+ window.removeEventListener("message", s);
484
495
  };
485
- }, Nt = "builder.tests", C = (t) => `${Nt}.${t}`, Ft = ({
496
+ }, Vt = "builder.tests", C = (t) => `${Vt}.${t}`, Ft = ({
486
497
  contentId: t
487
498
  }) => M({
488
499
  name: C(t),
@@ -622,7 +633,7 @@ function Jt(t) {
622
633
  }
623
634
  return e;
624
635
  }
625
- const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t) => {
636
+ const Xt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t) => {
626
637
  const {
627
638
  limit: e = 30,
628
639
  userAttributes: n,
@@ -631,7 +642,7 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
631
642
  apiKey: o,
632
643
  enrich: i,
633
644
  locale: u,
634
- apiVersion: b = zt,
645
+ apiVersion: b = Xt,
635
646
  fields: p,
636
647
  omit: k,
637
648
  offset: l,
@@ -665,11 +676,11 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
665
676
  };
666
677
  m = {
667
678
  ...m,
668
- ...Xt(x)
679
+ ...Ht(x)
669
680
  };
670
- const R = E(x);
671
- for (const d in R)
672
- a.searchParams.set(d, String(R[d]));
681
+ const B = E(x);
682
+ for (const d in B)
683
+ a.searchParams.set(d, String(B[d]));
673
684
  if (Object.keys(m).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(m)), r) {
674
685
  const d = et({
675
686
  query: r
@@ -678,15 +689,15 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
678
689
  a.searchParams.set(w, JSON.stringify(d[w]));
679
690
  }
680
691
  return a;
681
- }, Ht = (t) => {
692
+ }, zt = (t) => {
682
693
  const e = {};
683
694
  for (const n in t)
684
695
  n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
685
696
  return e;
686
- }, Xt = (t) => {
697
+ }, Ht = (t) => {
687
698
  if (c() && t.preview === "BUILDER_STUDIO") {
688
699
  t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
689
- const e = Ht(t), {
700
+ const e = zt(t), {
690
701
  userAttributes: n
691
702
  } = Jt(e);
692
703
  return n;
@@ -760,9 +771,9 @@ const ue = async (t) => {
760
771
  export {
761
772
  v as TARGET,
762
773
  qt as _processContentResult,
763
- Rt as _track,
774
+ Bt as _track,
764
775
  y as checkIsDefined,
765
- Vt as createEditorListener,
776
+ Nt as createEditorListener,
766
777
  re as createRegisterComponentMessage,
767
778
  ue as fetchBuilderProps,
768
779
  te as fetchEntries,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-2ef4e66a.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-77166102.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
@@ -1,4 +1,4 @@
1
- import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-61fca4f7.js";
1
+ import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-c1673af2.js";
2
2
  export {
3
3
  r as _processContentResult,
4
4
  s as createRegisterComponentMessage,
@@ -1,9 +1,9 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { Blocks as m } from "./blocks-582a7fd7.js";
2
+ import { Blocks as m } from "./blocks-0885e182.js";
3
3
  import "react";
4
4
  import "./blocks-exports.mjs";
5
- import "./server-entry-61fca4f7.js";
6
- import "./get-class-prop-name-38c2baca.js";
5
+ import "./server-entry-c1673af2.js";
6
+ import "./get-class-prop-name-dac81472.js";
7
7
  import "./dynamic-renderer-8b343325.js";
8
8
  function c(t) {
9
9
  var e, o, n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("./blocks-459a090b.cjs");require("react");require("./blocks-exports.cjs");require("./server-entry-2ef4e66a.cjs");require("./get-class-prop-name-fbe244e3.cjs");require("./dynamic-renderer-b29b45ca.cjs");function u(e){var t,n,r;return o.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:o.jsx(i.Blocks,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,registeredComponents:e.builderComponents,blocks:(r=e.builderContext.rootState)==null?void 0:r[e.name]})})}exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("./blocks-5165c164.cjs");require("react");require("./blocks-exports.cjs");require("./server-entry-77166102.cjs");require("./get-class-prop-name-0b992cfb.cjs");require("./dynamic-renderer-b29b45ca.cjs");function u(e){var t,n,r;return o.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:o.jsx(i.Blocks,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,registeredComponents:e.builderComponents,blocks:(r=e.builderContext.rootState)==null?void 0:r[e.name]})})}exports.default=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),o=require("react"),v=require("./blocks-exports.cjs"),k=require("./get-class-prop-name-0b992cfb.cjs"),b=require("./server-entry-77166102.cjs"),x=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return b.fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(r=>{b.logger.error("Could not fetch symbol content: ",r)})};function g(e){var c,a,d,u,l;function t(){return"div"}function r(){return"div"}function y(){var n,s;return[e.attributes[k.getClassPropName()],"builder-symbol",(n=e.symbol)!=null&&n.inline?"builder-inline-symbol":void 0,(s=e.symbol)!=null&&s.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")}const[i,f]=o.useState(()=>{var n;return(n=e.symbol)==null?void 0:n.content});function C(){i||x({symbol:e.symbol,builderContextValue:e.builderContext}).then(n=>{n&&f(n)})}return o.useEffect(()=>{},[]),o.useEffect(()=>{C()},[e.symbol]),m.jsx("div",{...e.attributes,className:y(),children:m.jsx(v.Content,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(c=e.builderBlock)==null?void 0:c.id},customComponents:Object.values(e.builderComponents),data:{...(a=e.symbol)==null?void 0:a.data,...e.builderContext.localState,...(d=i==null?void 0:i.data)==null?void 0:d.state},canTrack:e.builderContext.canTrack,model:(l=(u=e.symbol)==null?void 0:u.model)!=null?l:"",content:i,linkComponent:e.builderLinkComponent,blocksWrapper:t(),contentWrapper:r()})})}exports.default=g;
@@ -1,15 +1,15 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useState as s, useEffect as u } from "react";
3
- import { Content as C } from "./blocks-exports.mjs";
4
- import { getClassPropName as v } from "./get-class-prop-name-38c2baca.js";
5
- import { fetchOneEntry as k, logger as h } from "./server-entry-61fca4f7.js";
6
- const x = async ({
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useState as C, useEffect as f } from "react";
3
+ import { Content as v } from "./blocks-exports.mjs";
4
+ import { getClassPropName as k } from "./get-class-prop-name-dac81472.js";
5
+ import { fetchOneEntry as h, logger as x } from "./server-entry-c1673af2.js";
6
+ const K = async ({
7
7
  builderContextValue: e,
8
8
  symbol: t
9
9
  }) => {
10
10
  if (t != null && t.model && // This is a hack, we should not need to check for this, but it is needed for Svelte.
11
11
  (e != null && e.apiKey))
12
- return k({
12
+ return h({
13
13
  model: t.model,
14
14
  apiKey: e.apiKey,
15
15
  apiVersion: e.apiVersion,
@@ -19,43 +19,43 @@ const x = async ({
19
19
  }
20
20
  }
21
21
  }).catch((o) => {
22
- h.error("Could not fetch symbol content: ", o);
22
+ x.error("Could not fetch symbol content: ", o);
23
23
  });
24
24
  };
25
- function j(e) {
26
- var r, a, c, d;
25
+ function B(e) {
26
+ var r, a, c, d, l;
27
27
  function t() {
28
28
  return "div";
29
29
  }
30
30
  function o() {
31
31
  return "div";
32
32
  }
33
- function f() {
34
- var n, l;
33
+ function b() {
34
+ var n, m;
35
35
  return [
36
- e.attributes[v()],
36
+ e.attributes[k()],
37
37
  "builder-symbol",
38
38
  (n = e.symbol) != null && n.inline ? "builder-inline-symbol" : void 0,
39
- (l = e.symbol) != null && l.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
39
+ (m = e.symbol) != null && m.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
40
40
  ].filter(Boolean).join(" ");
41
41
  }
42
- const [i, b] = s(() => {
42
+ const [i, y] = C(() => {
43
43
  var n;
44
44
  return (n = e.symbol) == null ? void 0 : n.content;
45
45
  });
46
- function y() {
47
- i || x({
46
+ function s() {
47
+ i || K({
48
48
  symbol: e.symbol,
49
49
  builderContextValue: e.builderContext
50
50
  }).then((n) => {
51
- n && b(n);
51
+ n && y(n);
52
52
  });
53
53
  }
54
- return u(() => {
55
- }, []), u(() => {
56
- y();
57
- }, [e.symbol]), /* @__PURE__ */ m("div", { ...e.attributes, className: f(), children: /* @__PURE__ */ m(
58
- C,
54
+ return f(() => {
55
+ }, []), f(() => {
56
+ s();
57
+ }, [e.symbol]), /* @__PURE__ */ u("div", { ...e.attributes, className: b(), children: /* @__PURE__ */ u(
58
+ v,
59
59
  {
60
60
  nonce: e.builderContext.nonce,
61
61
  isNestedRender: !0,
@@ -72,7 +72,7 @@ function j(e) {
72
72
  ...(c = i == null ? void 0 : i.data) == null ? void 0 : c.state
73
73
  },
74
74
  canTrack: e.builderContext.canTrack,
75
- model: (d = e.symbol) == null ? void 0 : d.model,
75
+ model: (l = (d = e.symbol) == null ? void 0 : d.model) != null ? l : "",
76
76
  content: i,
77
77
  linkComponent: e.builderLinkComponent,
78
78
  blocksWrapper: t(),
@@ -81,5 +81,5 @@ function j(e) {
81
81
  ) });
82
82
  }
83
83
  export {
84
- j as default
84
+ B as default
85
85
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as d } from "react";
3
- import { Blocks as c } from "./blocks-582a7fd7.js";
3
+ import { Blocks as c } from "./blocks-0885e182.js";
4
4
  import "./blocks-exports.mjs";
5
- import "./server-entry-61fca4f7.js";
6
- import "./get-class-prop-name-38c2baca.js";
5
+ import "./server-entry-c1673af2.js";
6
+ import "./get-class-prop-name-dac81472.js";
7
7
  import "./dynamic-renderer-8b343325.js";
8
8
  function y(t) {
9
9
  var b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),u=require("react"),b=require("./blocks-459a090b.cjs");require("./blocks-exports.cjs");require("./server-entry-2ef4e66a.cjs");require("./get-class-prop-name-fbe244e3.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var o;const[t,a]=u.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function r(n){n===t&&e.collapsible?a(-1):a(n)}return l.jsxs("div",{children:[l.jsx("div",{className:"builder-tabs-wrap",style:{display:"flex",flexDirection:"row",justifyContent:e.tabHeaderLayout||"flex-start",overflow:"auto"},children:(o=e.tabs)==null?void 0:o.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>r(i),children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${i}.label`,blocks:n.label,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})},i))}),c(t)?l.jsx("div",{children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${t}.content`,blocks:c(t),context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]})}exports.default=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),u=require("react"),b=require("./blocks-5165c164.cjs");require("./blocks-exports.cjs");require("./server-entry-77166102.cjs");require("./get-class-prop-name-0b992cfb.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var o;const[t,a]=u.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function r(n){n===t&&e.collapsible?a(-1):a(n)}return l.jsxs("div",{children:[l.jsx("div",{className:"builder-tabs-wrap",style:{display:"flex",flexDirection:"row",justifyContent:e.tabHeaderLayout||"flex-start",overflow:"auto"},children:(o=e.tabs)==null?void 0:o.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>r(i),children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${i}.label`,blocks:n.label,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})},i))}),c(t)?l.jsx("div",{children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${t}.content`,blocks:c(t),context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]})}exports.default=s;
@@ -1,7 +1,9 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- function f(e) {
3
- var i, l, n, o, d, u, a;
4
- function c() {
1
+ import { jsxs as z, jsx as i } from "react/jsx-runtime";
2
+ import { useRef as I, useState as R, useEffect as m } from "react";
3
+ function j(e) {
4
+ var a, c, d, u, s, f, h;
5
+ const n = I(null);
6
+ function b() {
5
7
  return {
6
8
  ...e.autoPlay === !0 ? {
7
9
  autoPlay: !0
@@ -20,28 +22,54 @@ function f(e) {
20
22
  } : {}
21
23
  };
22
24
  }
23
- function r() {
25
+ function g() {
24
26
  return {
25
- ...c()
27
+ ...b()
26
28
  };
27
29
  }
28
- return /* @__PURE__ */ s(
30
+ const [r, x] = R(() => {
31
+ });
32
+ return m(() => {
33
+ if (e.lazyLoad) {
34
+ const l = new IntersectionObserver(function(E) {
35
+ E.forEach(function(v) {
36
+ if (!v.isIntersecting)
37
+ return;
38
+ const o = v.target;
39
+ try {
40
+ Array.from(o.children).filter(
41
+ (t) => t instanceof HTMLElement && t.tagName === "SOURCE"
42
+ ).forEach((t) => {
43
+ const y = t.dataset.src;
44
+ y && (t.src = y);
45
+ }), o.load(), l.unobserve(o);
46
+ } catch (t) {
47
+ console.error("Error loading lazy video:", t);
48
+ }
49
+ });
50
+ });
51
+ n.current && l.observe(n.current), x(l);
52
+ }
53
+ }, []), m(() => () => {
54
+ r && r.disconnect();
55
+ }, []), /* @__PURE__ */ z(
29
56
  "div",
30
57
  {
31
58
  style: {
32
59
  position: "relative"
33
60
  },
34
61
  children: [
35
- /* @__PURE__ */ t(
62
+ /* @__PURE__ */ i(
36
63
  "video",
37
64
  {
38
65
  className: "builder-video",
39
- ...r(),
40
- preload: e.preload || "metadata",
66
+ ...g(),
67
+ ref: n,
68
+ preload: e.lazyLoad ? "none" : e.preload || "metadata",
41
69
  style: {
42
70
  width: "100%",
43
71
  height: "100%",
44
- ...(i = e.attributes) == null ? void 0 : i.style,
72
+ ...(a = e.attributes) == null ? void 0 : a.style,
45
73
  objectFit: e.fit,
46
74
  objectPosition: e.position,
47
75
  // Hack to get object fit to work as expected and
@@ -51,12 +79,21 @@ function f(e) {
51
79
  position: "absolute"
52
80
  } : null
53
81
  },
54
- src: e.video || "no-src",
55
82
  poster: e.posterImage,
56
- children: e.lazyLoad ? null : /* @__PURE__ */ t("source", { type: "video/mp4", src: e.video })
83
+ children: /* @__PURE__ */ i(
84
+ "source",
85
+ {
86
+ type: "video/mp4",
87
+ ...e.lazyLoad ? {
88
+ "data-src": e.video
89
+ } : {
90
+ src: e.video
91
+ }
92
+ }
93
+ )
57
94
  }
58
95
  ),
59
- e.aspectRatio && !(e.fitContent && ((n = (l = e.builderBlock) == null ? void 0 : l.children) != null && n.length)) ? /* @__PURE__ */ t(
96
+ e.aspectRatio && !(e.fitContent && ((d = (c = e.builderBlock) == null ? void 0 : c.children) != null && d.length)) ? /* @__PURE__ */ i(
60
97
  "div",
61
98
  {
62
99
  style: {
@@ -67,7 +104,7 @@ function f(e) {
67
104
  }
68
105
  }
69
106
  ) : null,
70
- (d = (o = e.builderBlock) == null ? void 0 : o.children) != null && d.length && e.fitContent ? /* @__PURE__ */ t(
107
+ (s = (u = e.builderBlock) == null ? void 0 : u.children) != null && s.length && e.fitContent ? /* @__PURE__ */ i(
71
108
  "div",
72
109
  {
73
110
  style: {
@@ -78,7 +115,7 @@ function f(e) {
78
115
  children: e.children
79
116
  }
80
117
  ) : null,
81
- (a = (u = e.builderBlock) == null ? void 0 : u.children) != null && a.length && !e.fitContent ? /* @__PURE__ */ t(
118
+ (h = (f = e.builderBlock) == null ? void 0 : f.children) != null && h.length && !e.fitContent ? /* @__PURE__ */ i(
82
119
  "div",
83
120
  {
84
121
  style: {
@@ -100,5 +137,5 @@ function f(e) {
100
137
  );
101
138
  }
102
139
  export {
103
- f as default
140
+ j as default
104
141
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react");function E(e){var a,d,u,s,f,h,v;const l=n.useRef(null);function m(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...m()}}const[c,x]=n.useState(()=>{});return n.useEffect(()=>{if(e.lazyLoad){const o=new IntersectionObserver(function(j){j.forEach(function(y){if(!y.isIntersecting)return;const r=y.target;try{Array.from(r.children).filter(t=>t instanceof HTMLElement&&t.tagName==="SOURCE").forEach(t=>{const b=t.dataset.src;b&&(t.src=b)}),r.load(),o.unobserve(r)}catch(t){console.error("Error loading lazy video:",t)}})});l.current&&o.observe(l.current),x(o)}},[]),n.useEffect(()=>()=>{c&&c.disconnect()},[]),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("video",{className:"builder-video",...g(),ref:l,preload:e.lazyLoad?"none":e.preload||"metadata",style:{width:"100%",height:"100%",...(a=e.attributes)==null?void 0:a.style,objectFit:e.fit,objectPosition:e.position,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},poster:e.posterImage,children:i.jsx("source",{type:"video/mp4",...e.lazyLoad?{"data-src":e.video}:{src:e.video}})}),e.aspectRatio&&!(e.fitContent&&((u=(d=e.builderBlock)==null?void 0:d.children)!=null&&u.length))?i.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(f=(s=e.builderBlock)==null?void 0:s.children)!=null&&f.length&&e.fitContent?i.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(v=(h=e.builderBlock)==null?void 0:h.children)!=null&&v.length&&!e.fitContent?i.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}exports.default=E;