@builder.io/sdk-react-nextjs 0.16.18 → 0.16.20

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 (61) hide show
  1. package/lib/browser/blocks/columns/columns.cjs +3 -3
  2. package/lib/browser/blocks/columns/columns.mjs +41 -33
  3. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  4. package/lib/browser/components/content/components/enable-editor.mjs +107 -105
  5. package/lib/browser/components/content/content.cjs +1 -1
  6. package/lib/browser/components/content/content.mjs +23 -21
  7. package/lib/browser/components/content-variants/content-variants.cjs +1 -1
  8. package/lib/browser/components/content-variants/content-variants.mjs +10 -8
  9. package/lib/browser/constants/sdk-version.cjs +1 -1
  10. package/lib/browser/constants/sdk-version.mjs +1 -1
  11. package/lib/browser/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
  12. package/lib/browser/functions/evaluate/node-runtime/node-runtime.mjs +16 -14
  13. package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
  14. package/lib/browser/functions/get-content/generate-content-url.mjs +24 -23
  15. package/lib/browser/functions/track/index.cjs +1 -1
  16. package/lib/browser/functions/track/index.mjs +21 -19
  17. package/lib/edge/blocks/columns/columns.cjs +3 -3
  18. package/lib/edge/blocks/columns/columns.mjs +41 -33
  19. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  20. package/lib/edge/components/content/components/enable-editor.mjs +107 -105
  21. package/lib/edge/components/content/content.cjs +1 -1
  22. package/lib/edge/components/content/content.mjs +23 -21
  23. package/lib/edge/components/content-variants/content-variants.cjs +1 -1
  24. package/lib/edge/components/content-variants/content-variants.mjs +10 -8
  25. package/lib/edge/constants/sdk-version.cjs +1 -1
  26. package/lib/edge/constants/sdk-version.mjs +1 -1
  27. package/lib/edge/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
  28. package/lib/edge/functions/evaluate/node-runtime/node-runtime.mjs +16 -14
  29. package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
  30. package/lib/edge/functions/get-content/generate-content-url.mjs +24 -23
  31. package/lib/edge/functions/track/index.cjs +1 -1
  32. package/lib/edge/functions/track/index.mjs +21 -19
  33. package/lib/node/blocks/columns/columns.cjs +3 -3
  34. package/lib/node/blocks/columns/columns.mjs +41 -33
  35. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  36. package/lib/node/components/content/components/enable-editor.mjs +107 -105
  37. package/lib/node/components/content/content.cjs +1 -1
  38. package/lib/node/components/content/content.mjs +23 -21
  39. package/lib/node/components/content-variants/content-variants.cjs +1 -1
  40. package/lib/node/components/content-variants/content-variants.mjs +10 -8
  41. package/lib/node/constants/sdk-version.cjs +1 -1
  42. package/lib/node/constants/sdk-version.mjs +1 -1
  43. package/lib/node/functions/evaluate/node-runtime/node-runtime.cjs +6 -6
  44. package/lib/node/functions/evaluate/node-runtime/node-runtime.mjs +20 -18
  45. package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
  46. package/lib/node/functions/get-content/generate-content-url.mjs +24 -23
  47. package/lib/node/functions/track/index.cjs +1 -1
  48. package/lib/node/functions/track/index.mjs +21 -19
  49. package/package.json +1 -1
  50. package/types/cjs/components/content/components/enable-editor.d.ts +1 -1
  51. package/types/cjs/components/content-variants/content-variants.types.d.ts +4 -0
  52. package/types/cjs/constants/sdk-version.d.ts +1 -1
  53. package/types/cjs/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
  54. package/types/cjs/functions/get-content/types.d.ts +4 -0
  55. package/types/cjs/functions/track/index.d.ts +3 -1
  56. package/types/esm/components/content/components/enable-editor.d.ts +1 -1
  57. package/types/esm/components/content-variants/content-variants.types.d.ts +4 -0
  58. package/types/esm/constants/sdk-version.d.ts +1 -1
  59. package/types/esm/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
  60. package/types/esm/functions/get-content/types.d.ts +4 -0
  61. package/types/esm/functions/track/index.d.ts +3 -1
@@ -1,4 +1,4 @@
1
- "use strict";const o=require("react/jsx-runtime"),p=require("../../components/blocks/blocks.cjs"),W=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),j=require("../../components/inlined-styles.cjs"),q=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),z=require("../../functions/get-style.cjs"),N=require("./helpers.cjs");function A(e){var g,k;const a=typeof e.space=="number"?e.space||0:20,r=e.columns||[],u=e.stackColumnsAt||"tablet",y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var n;return((n=r[t])==null?void 0:n.width)||100/r.length},x=function(t){const n=S(t),l=a*(r.length-1)*(n/100);return`calc(${n}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:n}){return u==="tablet"?t:n},m=function({stackedStyle:t,desktopStyle:n}){return u==="never"?n:t},d=e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column",C=function(){return{"--flex-dir":d,"--flex-dir-tablet":c({stackedStyle:d,desktopStyle:"row"})}},v=function(t){const n=t===0?0:a,l=x(t),s=`${n}px`,h="100%",f=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:s,"--column-width-mobile":m({stackedStyle:h,desktopStyle:l}),"--column-margin-left-mobile":m({stackedStyle:f,desktopStyle:s}),"--column-width-tablet":c({stackedStyle:h,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:f,desktopStyle:s})}},b=function(t){var l,s;return q.getSizesForBreakpoints(((s=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:s.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
1
+ "use strict";const o=require("react/jsx-runtime"),p=require("../../components/blocks/blocks.cjs"),W=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),j=require("../../components/inlined-styles.cjs"),q=require("../../constants/device-sizes.cjs"),z=require("../../functions/get-class-prop-name.cjs"),B=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var g,f;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},m=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},d=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":d(),"--flex-dir-tablet":c({stackedStyle:d(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,k="100%",h=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:k,desktopStyle:l}),"--column-margin-left-mobile":m({stackedStyle:h,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:k,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:h,desktopStyle:r})}},b=function(t){var l,r;return q.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
2
2
  @media (max-width: ${b("medium")}px) {
3
3
  .${e.builderBlock.id}-breakpoints {
4
4
  flex-direction: var(--flex-dir-tablet);
@@ -22,7 +22,7 @@
22
22
  margin-left: var(--column-margin-left-mobile) !important;
23
23
  }
24
24
  },
25
- `},$=function(t,n){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:z.mapStyleObjToStrIfNeeded(v(n))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:N.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-153273e4",style:C(),children:[o.jsx(j,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(k=e.columns)==null?void 0:k.map((i,t)=>o.jsx(W,{TagName:y(i),actionAttributes:{},attributes:$(i,t),children:o.jsx(p,{path:`component.options.columns.${t}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:i.blocks})},t))]}),o.jsx("style",{children:`.div-153273e4 {
25
+ `},$=function(t,i){return{...t.link?{href:t.link}:{},[z.getClassPropName()]:"builder-column",style:B.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-0e218b6c",style:C(),children:[o.jsx(j,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(f=e.columns)==null?void 0:f.map((n,t)=>o.jsx(W,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(p,{path:`component.options.columns.${t}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks})},t))]}),o.jsx("style",{children:`.div-0e218b6c {
26
26
  display: flex;
27
27
  line-height: normal;
28
- }`})]})}module.exports=A;
28
+ }`})]})}module.exports=N;
@@ -8,63 +8,71 @@ import { mapStyleObjToStrIfNeeded as T } from "../../functions/get-style.mjs";
8
8
  import { getColumnsClass as D } from "./helpers.mjs";
9
9
  function q(e) {
10
10
  var f, g;
11
- const a = typeof e.space == "number" ? e.space || 0 : 20, s = e.columns || [], m = e.stackColumnsAt || "tablet", S = function(t) {
11
+ const a = function() {
12
+ return typeof e.space == "number" ? e.space || 0 : 20;
13
+ }, s = function() {
14
+ return e.columns || [];
15
+ }, m = function() {
16
+ return e.stackColumnsAt || "tablet";
17
+ }, S = function(t) {
12
18
  return t.link ? e.builderLinkComponent || "a" : "div";
13
- }, C = function(t) {
14
- var n;
15
- return ((n = s[t]) == null ? void 0 : n.width) || 100 / s.length;
16
19
  }, x = function(t) {
17
- const n = C(t), l = a * (s.length - 1) * (n / 100);
18
- return `calc(${n}% - ${l}px)`;
20
+ var i;
21
+ return ((i = s()[t]) == null ? void 0 : i.width) || 100 / s().length;
22
+ }, C = function(t) {
23
+ const i = x(t), o = a() * (s().length - 1) * (i / 100);
24
+ return `calc(${i}% - ${o}px)`;
19
25
  }, c = function({
20
26
  stackedStyle: t,
21
- desktopStyle: n
27
+ desktopStyle: i
22
28
  }) {
23
- return m === "tablet" ? t : n;
24
- }, d = function({
29
+ return m() === "tablet" ? t : i;
30
+ }, u = function({
25
31
  stackedStyle: t,
26
- desktopStyle: n
32
+ desktopStyle: i
27
33
  }) {
28
- return m === "never" ? n : t;
29
- }, u = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column", p = function() {
34
+ return m() === "never" ? i : t;
35
+ }, d = function() {
36
+ return e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column";
37
+ }, p = function() {
30
38
  return {
31
- "--flex-dir": u,
39
+ "--flex-dir": d(),
32
40
  "--flex-dir-tablet": c({
33
- stackedStyle: u,
41
+ stackedStyle: d(),
34
42
  desktopStyle: "row"
35
43
  })
36
44
  };
37
45
  }, v = function(t) {
38
- const n = t === 0 ? 0 : a, l = x(t), o = `${n}px`, k = "100%", h = 0;
46
+ const i = t === 0 ? 0 : a(), o = C(t), l = `${i}px`, k = "100%", h = 0;
39
47
  return {
40
48
  ...{
41
49
  display: "flex",
42
50
  flexDirection: "column",
43
51
  alignItems: "stretch"
44
52
  },
45
- width: l,
46
- ["marginLeft"]: o,
47
- "--column-width-mobile": d({
53
+ width: o,
54
+ ["marginLeft"]: l,
55
+ "--column-width-mobile": u({
48
56
  stackedStyle: k,
49
- desktopStyle: l
57
+ desktopStyle: o
50
58
  }),
51
- "--column-margin-left-mobile": d({
59
+ "--column-margin-left-mobile": u({
52
60
  stackedStyle: h,
53
- desktopStyle: o
61
+ desktopStyle: l
54
62
  }),
55
63
  "--column-width-tablet": c({
56
64
  stackedStyle: k,
57
- desktopStyle: l
65
+ desktopStyle: o
58
66
  }),
59
67
  "--column-margin-left-tablet": c({
60
68
  stackedStyle: h,
61
- desktopStyle: o
69
+ desktopStyle: l
62
70
  })
63
71
  };
64
72
  }, b = function(t) {
65
- var l, o;
73
+ var o, l;
66
74
  return L(
67
- ((o = (l = e.builderContext.content) == null ? void 0 : l.meta) == null ? void 0 : o.breakpoints) || {}
75
+ ((l = (o = e.builderContext.content) == null ? void 0 : o.meta) == null ? void 0 : l.breakpoints) || {}
68
76
  )[t].max;
69
77
  }, w = function() {
70
78
  const t = `.${e.builderBlock.id}-breakpoints > .builder-column`;
@@ -93,20 +101,20 @@ function q(e) {
93
101
  }
94
102
  },
95
103
  `;
96
- }, $ = function(t, n) {
104
+ }, $ = function(t, i) {
97
105
  return {
98
106
  ...t.link ? {
99
107
  href: t.link
100
108
  } : {},
101
109
  [N()]: "builder-column",
102
- style: T(v(n))
110
+ style: T(v(i))
103
111
  };
104
112
  };
105
113
  return /* @__PURE__ */ y(B, { children: [
106
114
  /* @__PURE__ */ y(
107
115
  "div",
108
116
  {
109
- className: D((f = e.builderBlock) == null ? void 0 : f.id) + " div-153273e4",
117
+ className: D((f = e.builderBlock) == null ? void 0 : f.id) + " div-0e218b6c",
110
118
  style: p(),
111
119
  children: [
112
120
  /* @__PURE__ */ r(
@@ -117,12 +125,12 @@ function q(e) {
117
125
  nonce: e.builderContext.nonce
118
126
  }
119
127
  ),
120
- (g = e.columns) == null ? void 0 : g.map((i, t) => /* @__PURE__ */ r(
128
+ (g = e.columns) == null ? void 0 : g.map((n, t) => /* @__PURE__ */ r(
121
129
  z,
122
130
  {
123
- TagName: S(i),
131
+ TagName: S(n),
124
132
  actionAttributes: {},
125
- attributes: $(i, t),
133
+ attributes: $(n, t),
126
134
  children: /* @__PURE__ */ r(
127
135
  W,
128
136
  {
@@ -134,7 +142,7 @@ function q(e) {
134
142
  context: e.builderContext,
135
143
  registeredComponents: e.builderComponents,
136
144
  linkComponent: e.builderLinkComponent,
137
- blocks: i.blocks
145
+ blocks: n.blocks
138
146
  }
139
147
  )
140
148
  },
@@ -143,7 +151,7 @@ function q(e) {
143
151
  ]
144
152
  }
145
153
  ),
146
- /* @__PURE__ */ r("style", { children: `.div-153273e4 {
154
+ /* @__PURE__ */ r("style", { children: `.div-0e218b6c {
147
155
  display: flex;
148
156
  line-height: normal;
149
157
  }` })
@@ -1 +1 @@
1
- "use client";"use strict";const k=require("react/jsx-runtime"),o=require("react"),W=require("../../../context/builder.context.cjs"),A=require("../../../functions/evaluate/evaluate.cjs"),B=require("../../../functions/fast-clone.cjs"),D=require("../../../functions/get-content/index.cjs"),P=require("../../../functions/is-browser.cjs"),g=require("../../../functions/is-editing.cjs"),N=require("../../../functions/is-previewing.cjs"),U=require("../../../functions/register-component.cjs"),R=require("../../../functions/track/index.cjs"),O=require("../../../functions/track/interaction.cjs"),y=require("../../../helpers/canTrack.cjs"),F=require("../../../helpers/preview-lru-cache/set.cjs"),$=require("../../../helpers/subscribe-to-editor.cjs"),L=require("../../../scripts/init-editing.cjs"),z=require("../../block/animator.cjs"),G=require("./styles.helpers.cjs"),J=require("next/navigation");function Q(e){var q,w,I;const d=o.useRef(null);function f(n){var r,i;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(i=(r=e.builderContextSignal).rootSetState)==null||i.call(r,t):e.builderContextSignal.rootState=t}function b(n){var r,i,a,c,u;const t={...e.builderContextSignal.content,...n,data:{...(r=e.builderContextSignal.content)==null?void 0:r.data,...n==null?void 0:n.data},meta:{...(i=e.builderContextSignal.content)==null?void 0:i.meta,...n==null?void 0:n.meta,breakpoints:((a=n==null?void 0:n.meta)==null?void 0:a.breakpoints)||((u=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:u.breakpoints)}};F.postPreviewContent({value:t,key:t.id}).then(()=>{V.refresh()})}function K(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[T,X]=o.useState(()=>e.contentWrapper||"div");function S(n){return $.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:r,contentId:i}=t;!i||i!==((a=e.builderContextSignal.content)==null?void 0:a.id)||r&&b({meta:{breakpoints:r}})},animation:t=>{z.triggerAnimation(t)},contentUpdate:t=>{b(t)}}})(n)}const[v,Y]=o.useState(()=>({})),[m,Z]=o.useState(()=>({})),[h,H]=o.useState(()=>!1);function _(n){var t,r;if(e.builderContextSignal.content){const i=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(r=e.builderContextSignal.content)==null?void 0:r.id;R._track({type:"click",canTrack:y.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:i!==a?i:void 0,...O.getInteractionPropertiesForEvent(n),unique:!h})}h||H(!0)}function j(){var t,r,i;const n=(i=(r=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:r.httpRequests)!=null?i:{};Object.entries(n).forEach(([a,c])=>{if(!c||m[a]||v[a]&&!g.isEditing())return;m[a]=!0;const u=c.replace(/{{([^}]+)}}/g,(s,M)=>String(A.evaluate({code:M,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));fetch(u).then(s=>s.json()).then(s=>{f({[a]:s}),v[a]=!0}).catch(s=>{console.error("error fetching dynamic data",c,s)}).finally(()=>{m[a]=!1})})}function l(){g.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:B.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function E(n){window.addEventListener("message",S),L.registerInsertMenu(),L.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(t=>{var i;const r=U.createRegisterComponentMessage(t);(i=window.parent)==null||i.postMessage(r,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",l)}function x(n){const t=new URL(location.href).searchParams,r=t.get("builder.preview"),i=t.get(`builder.overrides.${r}`),a=t.get("apiKey")||t.get("builder.space");r===e.model&&a===e.apiKey&&(!e.content||i===e.content.id)&&D.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(c=>{c&&b(c)})}const V=J.useRouter(),C=o.useRef(!1);return C.current||(j(),l(),C.current=!0),o.useEffect(()=>{var n;return(n=d.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=d.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=d.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=d.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t;if(P.isBrowser()){if(g.isEditing()&&d.current&&d.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&y.getDefaultCanTrack(e.canTrack)){const i=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,a=(t=e.builderContextSignal.content)==null?void 0:t.id,c=e.apiKey;R._track({type:"impression",canTrack:!0,contentId:a,apiKey:c,variationId:i!==a?i:void 0})}N.isPreviewing()&&g.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{l()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&f(e.data)},[e.data]),o.useEffect(()=>{e.locale&&f({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{P.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",l))},[]),k.jsx(W.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?k.jsx(T,{ref:d,onClick:n=>_(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:G.getWrapperClassName(((w=e.content)==null?void 0:w.testVariationId)||((I=e.content)==null?void 0:I.id)),...K(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Q;
1
+ "use client";"use strict";const k=require("react/jsx-runtime"),o=require("react"),N=require("../../../context/builder.context.cjs"),W=require("../../../functions/evaluate/evaluate.cjs"),A=require("../../../functions/fast-clone.cjs"),B=require("../../../functions/get-content/index.cjs"),R=require("../../../functions/is-browser.cjs"),g=require("../../../functions/is-editing.cjs"),D=require("../../../functions/is-previewing.cjs"),U=require("../../../functions/register-component.cjs"),P=require("../../../functions/track/index.cjs"),O=require("../../../functions/track/interaction.cjs"),y=require("../../../helpers/canTrack.cjs"),F=require("../../../helpers/preview-lru-cache/set.cjs"),$=require("../../../helpers/subscribe-to-editor.cjs"),H=require("../../../scripts/init-editing.cjs"),z=require("../../block/animator.cjs"),G=require("./styles.helpers.cjs"),J=require("next/navigation");function Q(e){var q,w,I;const d=o.useRef(null);function f(n){var a,i;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(i=(a=e.builderContextSignal).rootSetState)==null||i.call(a,t):e.builderContextSignal.rootState=t}function b(n){var a,i,r,c,u;const t={...e.builderContextSignal.content,...n,data:{...(a=e.builderContextSignal.content)==null?void 0:a.data,...n==null?void 0:n.data},meta:{...(i=e.builderContextSignal.content)==null?void 0:i.meta,...n==null?void 0:n.meta,breakpoints:((r=n==null?void 0:n.meta)==null?void 0:r.breakpoints)||((u=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:u.breakpoints)}};F.postPreviewContent({value:t,key:t.id}).then(()=>{V.refresh()})}function L(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[K,X]=o.useState(()=>e.contentWrapper||"div");function S(n){return $.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var r;const{breakpoints:a,contentId:i}=t;!i||i!==((r=e.builderContextSignal.content)==null?void 0:r.id)||a&&b({meta:{breakpoints:a}})},animation:t=>{z.triggerAnimation(t)},contentUpdate:t=>{b(t)}}})(n)}const[v,Y]=o.useState(()=>({})),[m,Z]=o.useState(()=>({})),[h,T]=o.useState(()=>!1);function _(n){var t,a;if(e.builderContextSignal.content){const i=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,r=(a=e.builderContextSignal.content)==null?void 0:a.id;P._track({apiHost:e.apiHost,type:"click",canTrack:y.getDefaultCanTrack(e.canTrack),contentId:r,apiKey:e.apiKey,variationId:i!==r?i:void 0,...O.getInteractionPropertiesForEvent(n),unique:!h})}h||T(!0)}function j(){var t,a,i;const n=(i=(a=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:a.httpRequests)!=null?i:{};Object.entries(n).forEach(([r,c])=>{if(!c||m[r]||v[r]&&!g.isEditing())return;m[r]=!0;const u=c.replace(/{{([^}]+)}}/g,(s,M)=>String(W.evaluate({code:M,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));fetch(u).then(s=>s.json()).then(s=>{f({[r]:s}),v[r]=!0}).catch(s=>{console.error("error fetching dynamic data",c,s)}).finally(()=>{m[r]=!1})})}function l(){g.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:A.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function E(n){window.addEventListener("message",S),H.registerInsertMenu(),H.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(t=>{var i;const a=U.createRegisterComponentMessage(t);(i=window.parent)==null||i.postMessage(a,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",l)}function x(n){const t=new URL(location.href).searchParams,a=t.get("builder.preview"),i=t.get(`builder.overrides.${a}`),r=t.get("apiKey")||t.get("builder.space");a===e.model&&r===e.apiKey&&(!e.content||i===e.content.id)&&B.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(c=>{c&&b(c)})}const V=J.useRouter(),C=o.useRef(!1);return C.current||(j(),l(),C.current=!0),o.useEffect(()=>{var n;return(n=d.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=d.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=d.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=d.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t;if(R.isBrowser()){if(g.isEditing()&&!e.isNestedRender&&d.current&&d.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&y.getDefaultCanTrack(e.canTrack)){const i=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,r=(t=e.builderContextSignal.content)==null?void 0:t.id,c=e.apiKey;P._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:r,apiKey:c,variationId:i!==r?i:void 0})}D.isPreviewing()&&g.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{l()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&f(e.data)},[e.data]),o.useEffect(()=>{e.locale&&f({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{R.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",l))},[]),k.jsx(N.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?k.jsx(K,{ref:d,onClick:n=>_(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:G.getWrapperClassName(((w=e.content)==null?void 0:w.testVariationId)||((I=e.content)==null?void 0:I.id)),...L(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Q;
@@ -1,132 +1,133 @@
1
1
  "use client";
2
2
  import { jsx as R } from "react/jsx-runtime";
3
- import { useRef as L, useState as m, useEffect as c } from "react";
4
- import N from "../../../context/builder.context.mjs";
3
+ import { useRef as H, useState as m, useEffect as c } from "react";
4
+ import A from "../../../context/builder.context.mjs";
5
5
  import { evaluate as U } from "../../../functions/evaluate/evaluate.mjs";
6
6
  import { fastClone as _ } from "../../../functions/fast-clone.mjs";
7
7
  import { fetchOneEntry as D } from "../../../functions/get-content/index.mjs";
8
- import { isBrowser as y } from "../../../functions/is-browser.mjs";
8
+ import { isBrowser as L } from "../../../functions/is-browser.mjs";
9
9
  import { isEditing as f } from "../../../functions/is-editing.mjs";
10
10
  import { isPreviewing as O } from "../../../functions/is-previewing.mjs";
11
11
  import { createRegisterComponentMessage as B } from "../../../functions/register-component.mjs";
12
- import { _track as K } from "../../../functions/track/index.mjs";
12
+ import { _track as y } from "../../../functions/track/index.mjs";
13
13
  import { getInteractionPropertiesForEvent as F } from "../../../functions/track/interaction.mjs";
14
- import { getDefaultCanTrack as q } from "../../../helpers/canTrack.mjs";
14
+ import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
15
15
  import { postPreviewContent as z } from "../../../helpers/preview-lru-cache/set.mjs";
16
16
  import { createEditorListener as $ } from "../../../helpers/subscribe-to-editor.mjs";
17
17
  import { registerInsertMenu as G, setupBrowserForEditing as J } from "../../../scripts/init-editing.mjs";
18
18
  import { triggerAnimation as Q } from "../../block/animator.mjs";
19
19
  import { getWrapperClassName as X } from "./styles.helpers.mjs";
20
20
  import { useRouter as Y } from "next/navigation";
21
- function Ce(e) {
21
+ function Ct(t) {
22
22
  var w, k, P;
23
- const d = L(null);
23
+ const d = H(null);
24
24
  function g(n) {
25
- var r, i;
26
- const t = {
27
- ...e.builderContextSignal.rootState,
25
+ var a, i;
26
+ const e = {
27
+ ...t.builderContextSignal.rootState,
28
28
  ...n
29
29
  };
30
- e.builderContextSignal.rootSetState ? (i = (r = e.builderContextSignal).rootSetState) == null || i.call(r, t) : e.builderContextSignal.rootState = t;
30
+ t.builderContextSignal.rootSetState ? (i = (a = t.builderContextSignal).rootSetState) == null || i.call(a, e) : t.builderContextSignal.rootState = e;
31
31
  }
32
32
  function b(n) {
33
- var r, i, a, o, s;
34
- const t = {
35
- ...e.builderContextSignal.content,
33
+ var a, i, r, o, s;
34
+ const e = {
35
+ ...t.builderContextSignal.content,
36
36
  ...n,
37
37
  data: {
38
- ...(r = e.builderContextSignal.content) == null ? void 0 : r.data,
38
+ ...(a = t.builderContextSignal.content) == null ? void 0 : a.data,
39
39
  ...n == null ? void 0 : n.data
40
40
  },
41
41
  meta: {
42
- ...(i = e.builderContextSignal.content) == null ? void 0 : i.meta,
42
+ ...(i = t.builderContextSignal.content) == null ? void 0 : i.meta,
43
43
  ...n == null ? void 0 : n.meta,
44
- breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((s = (o = e.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : s.breakpoints)
44
+ breakpoints: ((r = n == null ? void 0 : n.meta) == null ? void 0 : r.breakpoints) || ((s = (o = t.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : s.breakpoints)
45
45
  }
46
46
  };
47
47
  z({
48
- value: t,
49
- key: t.id
48
+ value: e,
49
+ key: e.id
50
50
  }).then(() => {
51
- j.refresh();
51
+ W.refresh();
52
52
  });
53
53
  }
54
- function H() {
55
- return e.showContent ? {} : {
54
+ function q() {
55
+ return t.showContent ? {} : {
56
56
  hidden: !0,
57
57
  "aria-hidden": !0
58
58
  };
59
59
  }
60
60
  const [T, Z] = m(
61
- () => e.contentWrapper || "div"
61
+ () => t.contentWrapper || "div"
62
62
  );
63
63
  function v(n) {
64
64
  return $({
65
- model: e.model,
66
- trustedHosts: e.trustedHosts,
65
+ model: t.model,
66
+ trustedHosts: t.trustedHosts,
67
67
  callbacks: {
68
- configureSdk: (t) => {
69
- var a;
70
- const { breakpoints: r, contentId: i } = t;
71
- !i || i !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || r && b({
68
+ configureSdk: (e) => {
69
+ var r;
70
+ const { breakpoints: a, contentId: i } = e;
71
+ !i || i !== ((r = t.builderContextSignal.content) == null ? void 0 : r.id) || a && b({
72
72
  meta: {
73
- breakpoints: r
73
+ breakpoints: a
74
74
  }
75
75
  });
76
76
  },
77
- animation: (t) => {
78
- Q(t);
77
+ animation: (e) => {
78
+ Q(e);
79
79
  },
80
- contentUpdate: (t) => {
81
- b(t);
80
+ contentUpdate: (e) => {
81
+ b(e);
82
82
  }
83
83
  }
84
84
  })(n);
85
85
  }
86
- const [h, p] = m(() => ({})), [S, ee] = m(() => ({})), [x, V] = m(() => !1);
86
+ const [h, p] = m(() => ({})), [S, tt] = m(() => ({})), [x, V] = m(() => !1);
87
87
  function M(n) {
88
- var t, r;
89
- if (e.builderContextSignal.content) {
90
- const i = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (r = e.builderContextSignal.content) == null ? void 0 : r.id;
91
- K({
88
+ var e, a;
89
+ if (t.builderContextSignal.content) {
90
+ const i = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId, r = (a = t.builderContextSignal.content) == null ? void 0 : a.id;
91
+ y({
92
+ apiHost: t.apiHost,
92
93
  type: "click",
93
- canTrack: q(e.canTrack),
94
- contentId: a,
95
- apiKey: e.apiKey,
96
- variationId: i !== a ? i : void 0,
94
+ canTrack: K(t.canTrack),
95
+ contentId: r,
96
+ apiKey: t.apiKey,
97
+ variationId: i !== r ? i : void 0,
97
98
  ...F(n),
98
99
  unique: !x
99
100
  });
100
101
  }
101
102
  x || V(!0);
102
103
  }
103
- function W() {
104
- var t, r, i;
105
- const n = (i = (r = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : r.httpRequests) != null ? i : {};
106
- Object.entries(n).forEach(([a, o]) => {
107
- if (!o || S[a] || h[a] && !f())
104
+ function N() {
105
+ var e, a, i;
106
+ const n = (i = (a = (e = t.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : a.httpRequests) != null ? i : {};
107
+ Object.entries(n).forEach(([r, o]) => {
108
+ if (!o || S[r] || h[r] && !f())
108
109
  return;
109
- S[a] = !0;
110
+ S[r] = !0;
110
111
  const s = o.replace(
111
112
  /{{([^}]+)}}/g,
112
- (l, A) => String(
113
+ (l, j) => String(
113
114
  U({
114
- code: A,
115
- context: e.context || {},
115
+ code: j,
116
+ context: t.context || {},
116
117
  localState: void 0,
117
- rootState: e.builderContextSignal.rootState,
118
- rootSetState: e.builderContextSignal.rootSetState
118
+ rootState: t.builderContextSignal.rootState,
119
+ rootSetState: t.builderContextSignal.rootSetState
119
120
  })
120
121
  )
121
122
  );
122
123
  fetch(s).then((l) => l.json()).then((l) => {
123
124
  g({
124
- [a]: l
125
- }), h[a] = !0;
125
+ [r]: l
126
+ }), h[r] = !0;
126
127
  }).catch((l) => {
127
128
  console.error("error fetching dynamic data", o, l);
128
129
  }).finally(() => {
129
- S[a] = !1;
130
+ S[r] = !1;
130
131
  });
131
132
  });
132
133
  }
@@ -136,9 +137,9 @@ function Ce(e) {
136
137
  "builder:component:stateChange",
137
138
  {
138
139
  detail: {
139
- state: _(e.builderContextSignal.rootState),
140
+ state: _(t.builderContextSignal.rootState),
140
141
  ref: {
141
- name: e.model
142
+ name: t.model
142
143
  }
143
144
  }
144
145
  }
@@ -147,47 +148,47 @@ function Ce(e) {
147
148
  }
148
149
  function C(n) {
149
150
  window.addEventListener("message", v), G(), J({
150
- ...e.locale ? {
151
- locale: e.locale
151
+ ...t.locale ? {
152
+ locale: t.locale
152
153
  } : {},
153
- ...e.enrich ? {
154
- enrich: e.enrich
154
+ ...t.enrich ? {
155
+ enrich: t.enrich
155
156
  } : {},
156
- ...e.trustedHosts ? {
157
- trustedHosts: e.trustedHosts
157
+ ...t.trustedHosts ? {
158
+ trustedHosts: t.trustedHosts
158
159
  } : {}
159
160
  }), Object.values(
160
- e.builderContextSignal.componentInfos
161
- ).forEach((t) => {
161
+ t.builderContextSignal.componentInfos
162
+ ).forEach((e) => {
162
163
  var i;
163
- const r = B(t);
164
- (i = window.parent) == null || i.postMessage(r, "*");
164
+ const a = B(e);
165
+ (i = window.parent) == null || i.postMessage(a, "*");
165
166
  }), window.addEventListener(
166
167
  "builder:component:stateChangeListenerActivated",
167
168
  u
168
169
  );
169
170
  }
170
171
  function E(n) {
171
- const t = new URL(location.href).searchParams, r = t.get("builder.preview"), i = t.get(
172
- `builder.overrides.${r}`
173
- ), a = t.get("apiKey") || t.get("builder.space");
174
- r === e.model && a === e.apiKey && (!e.content || i === e.content.id) && D({
175
- model: e.model,
176
- apiKey: e.apiKey,
177
- apiVersion: e.builderContextSignal.apiVersion
172
+ const e = new URL(location.href).searchParams, a = e.get("builder.preview"), i = e.get(
173
+ `builder.overrides.${a}`
174
+ ), r = e.get("apiKey") || e.get("builder.space");
175
+ a === t.model && r === t.apiKey && (!t.content || i === t.content.id) && D({
176
+ model: t.model,
177
+ apiKey: t.apiKey,
178
+ apiVersion: t.builderContextSignal.apiVersion
178
179
  }).then((o) => {
179
180
  o && b(o);
180
181
  });
181
182
  }
182
- const j = Y(), I = L(!1);
183
- return I.current || (W(), u(), I.current = !0), c(() => {
183
+ const W = Y(), I = H(!1);
184
+ return I.current || (N(), u(), I.current = !0), c(() => {
184
185
  var n;
185
186
  return (n = d.current) == null || n.addEventListener(
186
187
  "initeditingbldr",
187
188
  C
188
189
  ), () => {
189
- var t;
190
- return (t = d.current) == null ? void 0 : t.removeEventListener(
190
+ var e;
191
+ return (e = d.current) == null ? void 0 : e.removeEventListener(
191
192
  "initeditingbldr",
192
193
  C
193
194
  );
@@ -198,57 +199,58 @@ function Ce(e) {
198
199
  "initpreviewingbldr",
199
200
  E
200
201
  ), () => {
201
- var t;
202
- return (t = d.current) == null ? void 0 : t.removeEventListener(
202
+ var e;
203
+ return (e = d.current) == null ? void 0 : e.removeEventListener(
203
204
  "initpreviewingbldr",
204
205
  E
205
206
  );
206
207
  };
207
208
  }, []), c(() => {
208
- var n, t;
209
- if (y()) {
210
- if (f() && d.current && d.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && q(e.canTrack)) {
211
- const i = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, a = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
212
- K({
209
+ var n, e;
210
+ if (L()) {
211
+ if (f() && !t.isNestedRender && d.current && d.current.dispatchEvent(new CustomEvent("initeditingbldr")), t.builderContextSignal.content && K(t.canTrack)) {
212
+ const i = (n = t.builderContextSignal.content) == null ? void 0 : n.testVariationId, r = (e = t.builderContextSignal.content) == null ? void 0 : e.id, o = t.apiKey;
213
+ y({
214
+ apiHost: t.apiHost,
213
215
  type: "impression",
214
216
  canTrack: !0,
215
- contentId: a,
217
+ contentId: r,
216
218
  apiKey: o,
217
- variationId: i !== a ? i : void 0
219
+ variationId: i !== r ? i : void 0
218
220
  });
219
221
  }
220
222
  O() && f();
221
223
  }
222
224
  }, []), c(() => {
223
- }, [e.content]), c(() => {
225
+ }, [t.content]), c(() => {
224
226
  u();
225
- }, [e.builderContextSignal.rootState]), c(() => {
226
- e.data && g(e.data);
227
- }, [e.data]), c(() => {
228
- e.locale && g({
229
- locale: e.locale
227
+ }, [t.builderContextSignal.rootState]), c(() => {
228
+ t.data && g(t.data);
229
+ }, [t.data]), c(() => {
230
+ t.locale && g({
231
+ locale: t.locale
230
232
  });
231
- }, [e.locale]), c(() => () => {
232
- y() && (window.removeEventListener("message", v), window.removeEventListener(
233
+ }, [t.locale]), c(() => () => {
234
+ L() && (window.removeEventListener("message", v), window.removeEventListener(
233
235
  "builder:component:stateChangeListenerActivated",
234
236
  u
235
237
  ));
236
- }, []), /* @__PURE__ */ R(N.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ R(
238
+ }, []), /* @__PURE__ */ R(A.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content ? /* @__PURE__ */ R(
237
239
  T,
238
240
  {
239
241
  ref: d,
240
242
  onClick: (n) => M(n),
241
- "builder-content-id": (w = e.builderContextSignal.content) == null ? void 0 : w.id,
242
- "builder-model": e.model,
243
+ "builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
244
+ "builder-model": t.model,
243
245
  className: X(
244
- ((k = e.content) == null ? void 0 : k.testVariationId) || ((P = e.content) == null ? void 0 : P.id)
246
+ ((k = t.content) == null ? void 0 : k.testVariationId) || ((P = t.content) == null ? void 0 : P.id)
245
247
  ),
246
- ...H(),
247
- ...e.contentWrapperProps,
248
- children: e.children
248
+ ...q(),
249
+ ...t.contentWrapperProps,
250
+ children: t.children
249
251
  }
250
252
  ) : null });
251
253
  }
252
254
  export {
253
- Ce as default
255
+ Ct as default
254
256
  };
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime"),y=require("../../constants/builder-registered-components.cjs"),W=require("../../functions/evaluate/evaluate.cjs"),f=require("../../functions/register-component.cjs"),j=require("../../helpers/logger.cjs"),P=require("../blocks/blocks.cjs"),R=require("../content-variants/helpers.cjs"),V=require("../inlined-script.cjs"),K=require("./components/enable-editor.cjs"),T=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function F(e){var a,r,l,s,u,d,g,C,S,m,k,x,b;const v=R.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),I=[...y.getDefaultRegisteredComponents(),...((l=e.customComponents)==null?void 0:l.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:{component:h,...f.serializeIncludingFunctions(o)}}),{}),n={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...y.getDefaultRegisteredComponents(),...((s=e.customComponents)==null?void 0:s.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:f.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""};e.apiKey||j.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const i=(d=(u=n.content)==null?void 0:u.data)==null?void 0:d.jsCode;return i&&W.evaluate({code:i,context:e.context||{},localState:void 0,rootState:n.rootState,rootSetState:t=>{n.rootState=t},isExpression:!1}),c.jsxs(K,{nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:n,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?c.jsx(V,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(T,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(g=n.content)==null?void 0:g.id,cssCode:(S=(C=n.content)==null?void 0:C.data)==null?void 0:S.cssCode,customFonts:(k=(m=n.content)==null?void 0:m.data)==null?void 0:k.customFonts}),c.jsx(P,{blocks:(b=(x=n.content)==null?void 0:x.data)==null?void 0:b.blocks,context:n,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=F;
1
+ "use strict";const i=require("react/jsx-runtime"),y=require("../../constants/builder-registered-components.cjs"),R=require("../../functions/evaluate/evaluate.cjs"),f=require("../../functions/register-component.cjs"),W=require("../../helpers/logger.cjs"),j=require("../blocks/blocks.cjs"),P=require("../content-variants/helpers.cjs"),V=require("../inlined-script.cjs"),K=require("./components/enable-editor.cjs"),T=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function N(e){var a,r,s,l,d,u,g,C,S,m,k,x,b;const v=P.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),I=[...y.getDefaultRegisteredComponents(),...((s=e.customComponents)==null?void 0:s.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:{component:h,...f.serializeIncludingFunctions(o)}}),{}),n={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...y.getDefaultRegisteredComponents(),...((l=e.customComponents)==null?void 0:l.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:f.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""};e.apiKey||W.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const c=(u=(d=n.content)==null?void 0:d.data)==null?void 0:u.jsCode;return c&&R.evaluate({code:c,context:e.context||{},localState:void 0,rootState:n.rootState,rootSetState:t=>{n.rootState=t},isExpression:!1}),i.jsxs(K,{apiHost:e.apiHost,nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:n,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,children:[e.isSsrAbTest?i.jsx(V,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,i.jsx(T,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(g=n.content)==null?void 0:g.id,cssCode:(S=(C=n.content)==null?void 0:C.data)==null?void 0:S.cssCode,customFonts:(k=(m=n.content)==null?void 0:m.data)==null?void 0:k.customFonts}),i.jsx(j,{blocks:(b=(x=n.content)==null?void 0:x.data)==null?void 0:b.blocks,context:n,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=N;