@builder.io/sdk-react-nextjs 0.18.8 → 0.18.10

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 (35) hide show
  1. package/lib/browser/blocks/columns/columns.cjs +3 -2
  2. package/lib/browser/blocks/columns/columns.mjs +7 -6
  3. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  4. package/lib/browser/components/content/components/enable-editor.mjs +125 -125
  5. package/lib/browser/constants/sdk-version.cjs +1 -1
  6. package/lib/browser/constants/sdk-version.mjs +1 -1
  7. package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
  8. package/lib/browser/functions/get-content/generate-content-url.mjs +30 -30
  9. package/lib/browser/helpers/preview-lru-cache/set.cjs +1 -1
  10. package/lib/browser/helpers/preview-lru-cache/set.mjs +7 -5
  11. package/lib/edge/blocks/columns/columns.cjs +3 -2
  12. package/lib/edge/blocks/columns/columns.mjs +7 -6
  13. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  14. package/lib/edge/components/content/components/enable-editor.mjs +125 -125
  15. package/lib/edge/constants/sdk-version.cjs +1 -1
  16. package/lib/edge/constants/sdk-version.mjs +1 -1
  17. package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
  18. package/lib/edge/functions/get-content/generate-content-url.mjs +30 -30
  19. package/lib/edge/helpers/preview-lru-cache/set.cjs +1 -1
  20. package/lib/edge/helpers/preview-lru-cache/set.mjs +7 -5
  21. package/lib/node/blocks/columns/columns.cjs +3 -2
  22. package/lib/node/blocks/columns/columns.mjs +7 -6
  23. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  24. package/lib/node/components/content/components/enable-editor.mjs +125 -125
  25. package/lib/node/constants/sdk-version.cjs +1 -1
  26. package/lib/node/constants/sdk-version.mjs +1 -1
  27. package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
  28. package/lib/node/functions/get-content/generate-content-url.mjs +30 -30
  29. package/lib/node/helpers/preview-lru-cache/set.cjs +1 -1
  30. package/lib/node/helpers/preview-lru-cache/set.mjs +7 -5
  31. package/package.json +1 -1
  32. package/types/cjs/constants/sdk-version.d.ts +1 -1
  33. package/types/cjs/helpers/preview-lru-cache/set.d.ts +3 -4
  34. package/types/esm/constants/sdk-version.d.ts +1 -1
  35. package/types/esm/helpers/preview-lru-cache/set.d.ts +3 -4
@@ -1,59 +1,59 @@
1
- import { flatten as U, flattenMongoQuery as E, unflatten as F } from "../../helpers/flatten.mjs";
1
+ import { flatten as w, flattenMongoQuery as E, unflatten as F } from "../../helpers/flatten.mjs";
2
2
  import { normalizeSearchParams as O } from "../../helpers/search/search.mjs";
3
3
  import { DEFAULT_API_VERSION as J } from "../../types/api-version.mjs";
4
4
  import { getBuilderSearchParamsFromWindow as L } from "../get-builder-search-params/index.mjs";
5
5
  import { isBrowser as R } from "../is-browser.mjs";
6
- const w = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
6
+ const y = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
7
7
  const {
8
8
  limit: a = 30,
9
9
  userAttributes: r,
10
- query: h,
11
- model: y,
12
- apiKey: u,
13
- enrich: d,
14
- locale: A,
10
+ query: u,
11
+ model: A,
12
+ apiKey: d,
13
+ enrich: P,
14
+ locale: N,
15
15
  apiVersion: o = J,
16
- fields: P,
17
- omit: N,
18
- offset: c,
19
- cacheSeconds: l,
20
- staleCacheSeconds: f,
21
- sort: S,
22
- includeUnpublished: p,
16
+ fields: S,
17
+ omit: c,
18
+ offset: l,
19
+ cacheSeconds: f,
20
+ staleCacheSeconds: m,
21
+ sort: p,
22
+ includeUnpublished: b,
23
23
  apiHost: v
24
24
  } = t;
25
- if (!u)
25
+ if (!d)
26
26
  throw new Error("Missing API key");
27
27
  if (!["v3"].includes(o))
28
28
  throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
29
- const k = a !== 1, I = v || "https://cdn.builder.io", e = new URL(`${I}/api/${o}/content/${y}`);
30
- e.searchParams.set("apiKey", u), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(k)), e.searchParams.set("includeRefs", String(!0));
31
- const m = A || (r == null ? void 0 : r.locale);
29
+ const k = a !== 1, I = v || "https://cdn.builder.io", e = new URL(`${I}/api/${o}/content/${A}`);
30
+ e.searchParams.set("apiKey", d), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(k)), e.searchParams.set("includeRefs", String(!0));
31
+ const h = N || (r == null ? void 0 : r.locale);
32
32
  let i = r || {};
33
- if (m && (e.searchParams.set("locale", m), i = {
34
- locale: m,
33
+ if (h && (e.searchParams.set("locale", h), i = {
34
+ locale: h,
35
35
  ...i
36
- }), d && e.searchParams.set("enrich", String(d)), e.searchParams.set("omit", N || "meta.componentsUsed"), P && e.searchParams.set("fields", P), Number.isFinite(c) && c > -1 && e.searchParams.set("offset", String(Math.floor(c))), typeof p == "boolean" && e.searchParams.set("includeUnpublished", String(p)), l && w(l) && e.searchParams.set("cacheSeconds", String(l)), f && w(f) && e.searchParams.set("staleCacheSeconds", String(f)), S) {
37
- const s = U({
38
- sort: S
36
+ }), P && e.searchParams.set("enrich", String(P)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(l) && l > -1 && e.searchParams.set("offset", String(Math.floor(l))), typeof b == "boolean" && e.searchParams.set("includeUnpublished", String(b)), f && y(f) && e.searchParams.set("cacheSeconds", String(f)), m && y(m) && e.searchParams.set("staleCacheSeconds", String(m)), p) {
37
+ const s = w({
38
+ sort: p
39
39
  });
40
40
  for (const n in s)
41
41
  e.searchParams.set(n, JSON.stringify(s[n]));
42
42
  }
43
- const b = {
43
+ const g = {
44
44
  ...L(),
45
45
  ...O(t.options || {})
46
46
  };
47
47
  i = {
48
48
  ...i,
49
- ...$(b)
49
+ ...$(g)
50
50
  };
51
- const g = U(b);
52
- for (const s in g)
53
- e.searchParams.set(s, String(g[s]));
54
- if (Object.keys(i).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(i)), h) {
51
+ const U = w(g);
52
+ for (const s in U)
53
+ e.searchParams.set(s, String(U[s]));
54
+ if (Object.keys(i).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(i)), u) {
55
55
  const s = E({
56
- query: h
56
+ query: u
57
57
  });
58
58
  for (const n in s)
59
59
  e.searchParams.set(n, JSON.stringify(s[n]));
@@ -1 +1 @@
1
- "use server";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./init.cjs");async function i({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=i;
1
+ "use server";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("next/cache"),r=require("./init.cjs");async function o({key:e,value:t,url:i}){r.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),n.revalidatePath(i)}exports.postPreviewContent=o;
@@ -1,11 +1,13 @@
1
1
  "use server";
2
- import { init as e } from "./init.mjs";
3
- async function o({
2
+ import { revalidatePath as r } from "next/cache";
3
+ import { init as i } from "./init.mjs";
4
+ async function a({
4
5
  key: t,
5
- value: r
6
+ value: e,
7
+ url: o
6
8
  }) {
7
- return e(), globalThis._BUILDER_PREVIEW_LRU_CACHE.set(t, r), { [t]: r };
9
+ i(), globalThis._BUILDER_PREVIEW_LRU_CACHE.set(t, e), r(o);
8
10
  }
9
11
  export {
10
- o as postPreviewContent
12
+ a as postPreviewContent
11
13
  };
@@ -1,4 +1,4 @@
1
- "use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var f,g;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 z.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`
1
+ "use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=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},d=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},m=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":m(),"--flex-dir-tablet":c({stackedStyle:m(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,h="100%",k=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":d({stackedStyle:h,desktopStyle:l}),"--column-margin-left-mobile":d({stackedStyle:k,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:h,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:k,desktopStyle:r})}},b=function(t){var l,r;return z.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,8 @@
22
22
  margin-left: var(--column-margin-left-mobile) !important;
23
23
  }
24
24
  },
25
- `},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((f=e.builderBlock)==null?void 0:f.id)+" div-1aff548e",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(g=e.columns)==null?void 0:g.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks,styleProp:{flexGrow:"1"}})},t))]}),o.jsx("style",{children:`.div-1aff548e {
25
+ `},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-3cd4dbac",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(f=e.columns)==null?void 0:f.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks,styleProp:{flexGrow:"1"}})},t))]}),o.jsx("style",{children:`.div-3cd4dbac {
26
26
  display: flex;
27
27
  line-height: normal;
28
+ height: 100%;
28
29
  }`})]})}module.exports=N;
@@ -7,7 +7,7 @@ import { getClassPropName as N } from "../../functions/get-class-prop-name.mjs";
7
7
  import { mapStyleObjToStrIfNeeded as T } from "../../functions/get-style.mjs";
8
8
  import { getColumnsClass as D } from "./helpers.mjs";
9
9
  function q(e) {
10
- var b, g;
10
+ var f, g;
11
11
  const a = function() {
12
12
  return typeof e.space == "number" ? e.space || 0 : 20;
13
13
  }, s = function() {
@@ -69,7 +69,7 @@ function q(e) {
69
69
  desktopStyle: o
70
70
  })
71
71
  };
72
- }, f = function(t) {
72
+ }, b = function(t) {
73
73
  var l, o;
74
74
  return L(
75
75
  ((o = (l = e.builderContext.content) == null ? void 0 : l.meta) == null ? void 0 : o.breakpoints) || {}
@@ -77,7 +77,7 @@ function q(e) {
77
77
  }, p = function() {
78
78
  const t = `.${e.builderBlock.id}-breakpoints > .builder-column`;
79
79
  return `
80
- @media (max-width: ${f("medium")}px) {
80
+ @media (max-width: ${b("medium")}px) {
81
81
  .${e.builderBlock.id}-breakpoints {
82
82
  flex-direction: var(--flex-dir-tablet);
83
83
  align-items: stretch;
@@ -89,7 +89,7 @@ function q(e) {
89
89
  }
90
90
  }
91
91
 
92
- @media (max-width: ${f("small")}px) {
92
+ @media (max-width: ${b("small")}px) {
93
93
  .${e.builderBlock.id}-breakpoints {
94
94
  flex-direction: var(--flex-dir);
95
95
  align-items: stretch;
@@ -114,7 +114,7 @@ function q(e) {
114
114
  /* @__PURE__ */ y(
115
115
  "div",
116
116
  {
117
- className: D((b = e.builderBlock) == null ? void 0 : b.id) + " div-1aff548e",
117
+ className: D((f = e.builderBlock) == null ? void 0 : f.id) + " div-3cd4dbac",
118
118
  style: v(),
119
119
  children: [
120
120
  /* @__PURE__ */ r(
@@ -151,9 +151,10 @@ function q(e) {
151
151
  ]
152
152
  }
153
153
  ),
154
- /* @__PURE__ */ r("style", { children: `.div-1aff548e {
154
+ /* @__PURE__ */ r("style", { children: `.div-3cd4dbac {
155
155
  display: flex;
156
156
  line-height: normal;
157
+ height: 100%;
157
158
  }` })
158
159
  ] });
159
160
  }
@@ -1 +1 @@
1
- "use client";"use strict";const k=require("react/jsx-runtime"),o=require("react"),B=require("../../../context/builder.context.cjs"),F=require("../../../functions/evaluate/evaluate.cjs"),N=require("../../../functions/fast-clone.cjs"),M=require("../../../functions/get-content/index.cjs"),w=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),O=require("../../../functions/is-previewing.cjs"),W=require("../../../functions/log-fetch.cjs"),A=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),$=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),z=require("../../../helpers/cookie.cjs"),G=require("../../../helpers/preview-lru-cache/set.cjs"),J=require("../../../helpers/subscribe-to-editor.cjs"),L=require("../../../scripts/init-editing.cjs"),Q=require("../../block/animator.cjs"),H=require("./enable-editor.helpers.cjs"),X=require("./styles.helpers.cjs"),Y=require("next/navigation");function Z(e){var q,I,R;const s=o.useRef(null);o.useState(()=>!1);function u(n){var i,r;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(r=(i=e.builderContextSignal).rootSetState)==null||r.call(i,t):e.builderContextSignal.rootState=t}function m(n){var i,r,a,c,d;const t={...e.builderContextSignal.content,...n,data:{...(i=e.builderContextSignal.content)==null?void 0:i.data,...n==null?void 0:n.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...n==null?void 0:n.meta,breakpoints:((a=n==null?void 0:n.meta)==null?void 0:a.breakpoints)||((d=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};G.postPreviewContent({value:t,key:t.id}).then(()=>{V.refresh()})}function K(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[T,p]=o.useState(()=>e.contentWrapper||"div");function S(n){return J.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:i,contentId:r}=t;!r||r!==((a=e.builderContextSignal.content)==null?void 0:a.id)||i&&m({meta:{breakpoints:i}})},animation:t=>{Q.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,ee]=o.useState(()=>({})),[b,te]=o.useState(()=>({})),[h,D]=o.useState(()=>!1);function _(n){var t,i;if(e.builderContextSignal.content){const r=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(i=e.builderContextSignal.content)==null?void 0:i.id;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...$.getInteractionPropertiesForEvent(n),unique:!h})}h||D(!0)}function U(){var t,i,r;const n=(r=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?r:{};Object.entries(n).forEach(([a,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,j)=>String(F.evaluate({code:j,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));W.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:N.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function E(n){var t;window.addEventListener("message",S),L.registerInsertMenu(),L.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{},modelName:(t=e.model)!=null?t:"",apiKey:e.apiKey}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var r,a;if(!((r=i.models)!=null&&r.length)||i.models.includes(e.model)){const c=A.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),r=t.get(`builder.overrides.${i}`),a=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&a===e.apiKey&&(!e.content||r===e.content.id))&&M.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}const V=Y.useRouter(),C=o.useRef(!1);return C.current||(U(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(w.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=z.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}O.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{w.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),k.jsx(B.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?k.jsx(T,{ref:s,onClick:n=>_(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:X.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((R=e.content)==null?void 0:R.id)),style:{display:!e.builderContextSignal.content&&H.needsElementRefDivForEditing()?"none":void 0},...K(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Z;
1
+ "use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),j=require("../../../context/builder.context.cjs"),B=require("../../../functions/evaluate/evaluate.cjs"),F=require("../../../functions/fast-clone.cjs"),N=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),M=require("../../../functions/is-previewing.cjs"),O=require("../../../functions/log-fetch.cjs"),W=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),A=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),$=require("../../../helpers/cookie.cjs"),z=require("../../../helpers/preview-lru-cache/set.cjs"),G=require("../../../helpers/subscribe-to-editor.cjs"),L=require("../../../scripts/init-editing.cjs"),J=require("../../block/animator.cjs"),H=require("./enable-editor.helpers.cjs"),Q=require("./styles.helpers.cjs"),X=require("next/navigation");function Y(e){var q,I,w;const s=o.useRef(null);o.useState(()=>!1);function u(n){var i,r;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(r=(i=e.builderContextSignal).rootSetState)==null||r.call(i,t):e.builderContextSignal.rootState=t}function m(n){var i,r,a,c,d;const t={...e.builderContextSignal.content,...n,data:{...(i=e.builderContextSignal.content)==null?void 0:i.data,...n==null?void 0:n.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...n==null?void 0:n.meta,breakpoints:((a=n==null?void 0:n.meta)==null?void 0:a.breakpoints)||((d=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};z.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function K(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[T,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return G.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:i,contentId:r}=t;!r||r!==((a=e.builderContextSignal.content)==null?void 0:a.id)||i&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[E,D]=o.useState(()=>!1);function _(n){var t,i;if(e.builderContextSignal.content){const r=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(i=e.builderContextSignal.content)==null?void 0:i.id;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...A.getInteractionPropertiesForEvent(n),unique:!E})}E||D(!0)}function U(){var t,i,r;const n=(r=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?r:{};Object.entries(n).forEach(([a,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,V)=>String(B.evaluate({code:V,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));O.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:F.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function h(n){var t;window.addEventListener("message",S),L.registerInsertMenu(),L.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{},modelName:(t=e.model)!=null?t:"",apiKey:e.apiKey}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var r,a;if(!((r=i.models)!=null&&r.length)||i.models.includes(e.model)){const c=W.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),r=t.get(`builder.overrides.${i}`),a=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&a===e.apiKey&&(!e.content||r===e.content.id))&&N.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}X.useRouter();const C=o.useRef(!1);return C.current||(U(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",h),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",h)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(k.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=$.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}M.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),R.jsx(j.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?R.jsx(T,{ref:s,onClick:n=>_(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:Q.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&H.needsElementRefDivForEditing()?"none":void 0},...K(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
@@ -1,138 +1,137 @@
1
1
  "use client";
2
2
  import { jsx as k } from "react/jsx-runtime";
3
3
  import { useRef as P, useState as m, useEffect as c } from "react";
4
- import O from "../../../context/builder.context.mjs";
5
- import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
6
- import { fastClone as j } from "../../../functions/fast-clone.mjs";
7
- import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
4
+ import M from "../../../context/builder.context.mjs";
5
+ import { evaluate as O } from "../../../functions/evaluate/evaluate.mjs";
6
+ import { fastClone as W } from "../../../functions/fast-clone.mjs";
7
+ import { fetchOneEntry as j } from "../../../functions/get-content/index.mjs";
8
8
  import { isBrowser as L } from "../../../functions/is-browser.mjs";
9
9
  import { isEditing as g } from "../../../functions/is-editing.mjs";
10
- import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
11
- import { logFetch as F } from "../../../functions/log-fetch.mjs";
12
- import { createRegisterComponentMessage as $ } from "../../../functions/register-component.mjs";
10
+ import { isPreviewing as A } from "../../../functions/is-previewing.mjs";
11
+ import { logFetch as B } from "../../../functions/log-fetch.mjs";
12
+ import { createRegisterComponentMessage as F } from "../../../functions/register-component.mjs";
13
13
  import { _track as H } from "../../../functions/track/index.mjs";
14
- import { getInteractionPropertiesForEvent as z } from "../../../functions/track/interaction.mjs";
14
+ import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
15
15
  import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
16
- import { getCookieSync as G } from "../../../helpers/cookie.mjs";
17
- import { postPreviewContent as J } from "../../../helpers/preview-lru-cache/set.mjs";
18
- import { createEditorListener as Q } from "../../../helpers/subscribe-to-editor.mjs";
19
- import { registerInsertMenu as X, setupBrowserForEditing as Y } from "../../../scripts/init-editing.mjs";
20
- import { triggerAnimation as Z } from "../../block/animator.mjs";
16
+ import { getCookieSync as z } from "../../../helpers/cookie.mjs";
17
+ import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
18
+ import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
19
+ import { registerInsertMenu as Q, setupBrowserForEditing as X } from "../../../scripts/init-editing.mjs";
20
+ import { triggerAnimation as Y } from "../../block/animator.mjs";
21
21
  import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
22
- import { getWrapperClassName as p } from "./styles.helpers.mjs";
23
- import { useRouter as ee } from "next/navigation";
24
- function ke(e) {
25
- var y, R, w;
22
+ import { getWrapperClassName as Z } from "./styles.helpers.mjs";
23
+ import { useRouter as p } from "next/navigation";
24
+ function Rt(t) {
25
+ var w, y, R;
26
26
  const u = P(null);
27
27
  m(() => !1);
28
28
  function s(n) {
29
- var i, r;
30
- const t = {
31
- ...e.builderContextSignal.rootState,
29
+ var i, o;
30
+ const e = {
31
+ ...t.builderContextSignal.rootState,
32
32
  ...n
33
33
  };
34
- e.builderContextSignal.rootSetState ? (r = (i = e.builderContextSignal).rootSetState) == null || r.call(i, t) : e.builderContextSignal.rootState = t;
34
+ t.builderContextSignal.rootSetState ? (o = (i = t.builderContextSignal).rootSetState) == null || o.call(i, e) : t.builderContextSignal.rootState = e;
35
35
  }
36
36
  function b(n) {
37
- var i, r, a, o, d;
38
- const t = {
39
- ...e.builderContextSignal.content,
37
+ var i, o, a, r, d;
38
+ const e = {
39
+ ...t.builderContextSignal.content,
40
40
  ...n,
41
41
  data: {
42
- ...(i = e.builderContextSignal.content) == null ? void 0 : i.data,
42
+ ...(i = t.builderContextSignal.content) == null ? void 0 : i.data,
43
43
  ...n == null ? void 0 : n.data
44
44
  },
45
45
  meta: {
46
- ...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
46
+ ...(o = t.builderContextSignal.content) == null ? void 0 : o.meta,
47
47
  ...n == null ? void 0 : n.meta,
48
- breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((d = (o = e.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : d.breakpoints)
48
+ breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((d = (r = t.builderContextSignal.content) == null ? void 0 : r.meta) == null ? void 0 : d.breakpoints)
49
49
  }
50
50
  };
51
- J({
52
- value: t,
53
- key: t.id
54
- }).then(() => {
55
- _.refresh();
51
+ G({
52
+ value: e,
53
+ key: e.id,
54
+ url: window.location.pathname
56
55
  });
57
56
  }
58
57
  function T() {
59
- return e.showContent ? {} : {
58
+ return t.showContent ? {} : {
60
59
  hidden: !0,
61
60
  "aria-hidden": !0
62
61
  };
63
62
  }
64
- const [U, te] = m(
65
- () => e.contentWrapper || "div"
63
+ const [U, tt] = m(
64
+ () => t.contentWrapper || "div"
66
65
  );
67
66
  function v(n) {
68
- return Q({
69
- model: e.model,
70
- trustedHosts: e.trustedHosts,
67
+ return J({
68
+ model: t.model,
69
+ trustedHosts: t.trustedHosts,
71
70
  callbacks: {
72
- configureSdk: (t) => {
71
+ configureSdk: (e) => {
73
72
  var a;
74
- const { breakpoints: i, contentId: r } = t;
75
- !r || r !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || i && b({
73
+ const { breakpoints: i, contentId: o } = e;
74
+ !o || o !== ((a = t.builderContextSignal.content) == null ? void 0 : a.id) || i && b({
76
75
  meta: {
77
76
  breakpoints: i
78
77
  }
79
78
  });
80
79
  },
81
- animation: (t) => {
82
- Z(t);
80
+ animation: (e) => {
81
+ Y(e);
83
82
  },
84
- contentUpdate: (t) => {
85
- b(t);
83
+ contentUpdate: (e) => {
84
+ b(e);
86
85
  },
87
- stateUpdate: (t) => {
88
- s(t);
86
+ stateUpdate: (e) => {
87
+ s(e);
89
88
  }
90
89
  }
91
90
  })(n);
92
91
  }
93
- const [h, ne] = m(() => ({})), [S, ie] = m(() => ({})), [x, D] = m(() => !1);
92
+ const [h, et] = m(() => ({})), [S, nt] = m(() => ({})), [x, D] = m(() => !1);
94
93
  function V(n) {
95
- var t, i;
96
- if (e.builderContextSignal.content) {
97
- const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
94
+ var e, i;
95
+ if (t.builderContextSignal.content) {
96
+ const o = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId, a = (i = t.builderContextSignal.content) == null ? void 0 : i.id;
98
97
  H({
99
- apiHost: e.apiHost,
98
+ apiHost: t.apiHost,
100
99
  type: "click",
101
- canTrack: K(e.canTrack),
100
+ canTrack: K(t.canTrack),
102
101
  contentId: a,
103
- apiKey: e.apiKey,
104
- variationId: r !== a ? r : void 0,
105
- ...z(n),
102
+ apiKey: t.apiKey,
103
+ variationId: o !== a ? o : void 0,
104
+ ...$(n),
106
105
  unique: !x
107
106
  });
108
107
  }
109
108
  x || D(!0);
110
109
  }
111
110
  function N() {
112
- var t, i, r;
113
- const n = (r = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? r : {};
114
- Object.entries(n).forEach(([a, o]) => {
115
- if (!o || S[a] || h[a] && !g())
111
+ var e, i, o;
112
+ const n = (o = (i = (e = t.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : i.httpRequests) != null ? o : {};
113
+ Object.entries(n).forEach(([a, r]) => {
114
+ if (!r || S[a] || h[a] && !g())
116
115
  return;
117
116
  S[a] = !0;
118
- const d = o.replace(
117
+ const d = r.replace(
119
118
  /{{([^}]+)}}/g,
120
- (l, M) => String(
121
- W({
122
- code: M,
123
- context: e.context || {},
119
+ (l, _) => String(
120
+ O({
121
+ code: _,
122
+ context: t.context || {},
124
123
  localState: void 0,
125
- rootState: e.builderContextSignal.rootState,
126
- rootSetState: e.builderContextSignal.rootSetState
124
+ rootState: t.builderContextSignal.rootState,
125
+ rootSetState: t.builderContextSignal.rootSetState
127
126
  })
128
127
  )
129
128
  );
130
- F(d), fetch(d).then((l) => l.json()).then((l) => {
129
+ B(d), fetch(d).then((l) => l.json()).then((l) => {
131
130
  s({
132
131
  [a]: l
133
132
  }), h[a] = !0;
134
133
  }).catch((l) => {
135
- console.error("error fetching dynamic data", o, l);
134
+ console.error("error fetching dynamic data", r, l);
136
135
  }).finally(() => {
137
136
  S[a] = !1;
138
137
  });
@@ -144,9 +143,9 @@ function ke(e) {
144
143
  "builder:component:stateChange",
145
144
  {
146
145
  detail: {
147
- state: j(e.builderContextSignal.rootState),
146
+ state: W(t.builderContextSignal.rootState),
148
147
  ref: {
149
- name: e.model
148
+ name: t.model
150
149
  }
151
150
  }
152
151
  }
@@ -154,26 +153,26 @@ function ke(e) {
154
153
  );
155
154
  }
156
155
  function C(n) {
157
- var t;
158
- window.addEventListener("message", v), X(), Y({
159
- ...e.locale ? {
160
- locale: e.locale
156
+ var e;
157
+ window.addEventListener("message", v), Q(), X({
158
+ ...t.locale ? {
159
+ locale: t.locale
161
160
  } : {},
162
- ...e.enrich ? {
163
- enrich: e.enrich
161
+ ...t.enrich ? {
162
+ enrich: t.enrich
164
163
  } : {},
165
- ...e.trustedHosts ? {
166
- trustedHosts: e.trustedHosts
164
+ ...t.trustedHosts ? {
165
+ trustedHosts: t.trustedHosts
167
166
  } : {},
168
- modelName: (t = e.model) != null ? t : "",
169
- apiKey: e.apiKey
167
+ modelName: (e = t.model) != null ? e : "",
168
+ apiKey: t.apiKey
170
169
  }), Object.values(
171
- e.builderContextSignal.componentInfos
170
+ t.builderContextSignal.componentInfos
172
171
  ).forEach((i) => {
173
- var r, a;
174
- if (!((r = i.models) != null && r.length) || i.models.includes(e.model)) {
175
- const o = $(i);
176
- (a = window.parent) == null || a.postMessage(o, "*");
172
+ var o, a;
173
+ if (!((o = i.models) != null && o.length) || i.models.includes(t.model)) {
174
+ const r = F(i);
175
+ (a = window.parent) == null || a.postMessage(r, "*");
177
176
  }
178
177
  }), window.addEventListener(
179
178
  "builder:component:stateChangeListenerActivated",
@@ -181,32 +180,33 @@ function ke(e) {
181
180
  );
182
181
  }
183
182
  function E(n) {
184
- var o;
185
- const t = new URL(location.href).searchParams, i = t.get("builder.preview"), r = t.get(
183
+ var r;
184
+ const e = new URL(location.href).searchParams, i = e.get("builder.preview"), o = e.get(
186
185
  `builder.overrides.${i}`
187
- ), a = t.get("apiKey") || t.get("builder.space");
188
- (i === "BUILDER_STUDIO" || i === e.model && a === e.apiKey && (!e.content || r === e.content.id)) && A({
189
- model: e.model,
190
- apiKey: e.apiKey,
191
- apiVersion: e.builderContextSignal.apiVersion,
192
- ...i === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
186
+ ), a = e.get("apiKey") || e.get("builder.space");
187
+ (i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) && j({
188
+ model: t.model,
189
+ apiKey: t.apiKey,
190
+ apiVersion: t.builderContextSignal.apiVersion,
191
+ ...i === "BUILDER_STUDIO" && ((r = t.context) != null && r.symbolId) ? {
193
192
  query: {
194
- id: e.context.symbolId
193
+ id: t.context.symbolId
195
194
  }
196
195
  } : {}
197
196
  }).then((d) => {
198
197
  d && b(d);
199
198
  });
200
199
  }
201
- const _ = ee(), I = P(!1);
200
+ p();
201
+ const I = P(!1);
202
202
  return I.current || (N(), f(), I.current = !0), c(() => {
203
203
  var n;
204
204
  return (n = u.current) == null || n.addEventListener(
205
205
  "initeditingbldr",
206
206
  C
207
207
  ), () => {
208
- var t;
209
- return (t = u.current) == null ? void 0 : t.removeEventListener(
208
+ var e;
209
+ return (e = u.current) == null ? void 0 : e.removeEventListener(
210
210
  "initeditingbldr",
211
211
  C
212
212
  );
@@ -217,24 +217,24 @@ function ke(e) {
217
217
  "initpreviewingbldr",
218
218
  E
219
219
  ), () => {
220
- var t;
221
- return (t = u.current) == null ? void 0 : t.removeEventListener(
220
+ var e;
221
+ return (e = u.current) == null ? void 0 : e.removeEventListener(
222
222
  "initpreviewingbldr",
223
223
  E
224
224
  );
225
225
  };
226
226
  }, []), c(() => {
227
- var n, t, i;
227
+ var n, e, i;
228
228
  if (L()) {
229
- g() && !e.isNestedRender && u.current && u.current.dispatchEvent(new CustomEvent("initeditingbldr"));
230
- const r = e.builderContextSignal.content && K(e.canTrack), a = G({
231
- name: `builder.tests.${(n = e.builderContextSignal.content) == null ? void 0 : n.id}`,
229
+ g() && !t.isNestedRender && u.current && u.current.dispatchEvent(new CustomEvent("initeditingbldr"));
230
+ const o = t.builderContextSignal.content && K(t.canTrack), a = z({
231
+ name: `builder.tests.${(n = t.builderContextSignal.content) == null ? void 0 : n.id}`,
232
232
  canTrack: !0
233
- }), o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId;
234
- if (r && o === a) {
235
- const d = (i = e.builderContextSignal.content) == null ? void 0 : i.id, l = e.apiKey;
233
+ }), r = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId;
234
+ if (o && r === a) {
235
+ const d = (i = t.builderContextSignal.content) == null ? void 0 : i.id, l = t.apiKey;
236
236
  H({
237
- apiHost: e.apiHost,
237
+ apiHost: t.apiHost,
238
238
  type: "impression",
239
239
  canTrack: !0,
240
240
  contentId: d,
@@ -242,41 +242,41 @@ function ke(e) {
242
242
  variationId: a !== d ? a : void 0
243
243
  });
244
244
  }
245
- B() && g();
245
+ A() && g();
246
246
  }
247
247
  }, []), c(() => {
248
- }, [e.content]), c(() => {
248
+ }, [t.content]), c(() => {
249
249
  f();
250
- }, [e.builderContextSignal.rootState]), c(() => {
251
- e.data && s(e.data);
252
- }, [e.data]), c(() => {
253
- e.locale && s({
254
- locale: e.locale
250
+ }, [t.builderContextSignal.rootState]), c(() => {
251
+ t.data && s(t.data);
252
+ }, [t.data]), c(() => {
253
+ t.locale && s({
254
+ locale: t.locale
255
255
  });
256
- }, [e.locale]), c(() => () => {
256
+ }, [t.locale]), c(() => () => {
257
257
  L() && (window.removeEventListener("message", v), window.removeEventListener(
258
258
  "builder:component:stateChangeListenerActivated",
259
259
  f
260
260
  ));
261
- }, []), /* @__PURE__ */ k(O.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ k(
261
+ }, []), /* @__PURE__ */ k(M.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content || q() ? /* @__PURE__ */ k(
262
262
  U,
263
263
  {
264
264
  ref: u,
265
265
  onClick: (n) => V(n),
266
- "builder-content-id": (y = e.builderContextSignal.content) == null ? void 0 : y.id,
267
- "builder-model": e.model,
268
- className: p(
269
- ((R = e.content) == null ? void 0 : R.testVariationId) || ((w = e.content) == null ? void 0 : w.id)
266
+ "builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
267
+ "builder-model": t.model,
268
+ className: Z(
269
+ ((y = t.content) == null ? void 0 : y.testVariationId) || ((R = t.content) == null ? void 0 : R.id)
270
270
  ),
271
271
  style: {
272
- display: !e.builderContextSignal.content && q() ? "none" : void 0
272
+ display: !t.builderContextSignal.content && q() ? "none" : void 0
273
273
  },
274
274
  ...T(),
275
- ...e.contentWrapperProps,
276
- children: e.children
275
+ ...t.contentWrapperProps,
276
+ children: t.children
277
277
  }
278
278
  ) : null });
279
279
  }
280
280
  export {
281
- ke as default
281
+ Rt as default
282
282
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.8";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.10";exports.SDK_VERSION=e;