@builder.io/sdk-react-nextjs 0.17.7 → 0.18.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 (69) hide show
  1. package/lib/browser/blocks/symbol/symbol.cjs +1 -1
  2. package/lib/browser/blocks/symbol/symbol.mjs +20 -20
  3. package/lib/browser/blocks/video/video.cjs +1 -1
  4. package/lib/browser/blocks/video/video.mjs +54 -17
  5. package/lib/browser/components/block/components/block-styles.cjs +1 -1
  6. package/lib/browser/components/block/components/block-styles.mjs +50 -42
  7. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  8. package/lib/browser/components/content/components/enable-editor.mjs +48 -45
  9. package/lib/browser/components/content/content.cjs +1 -1
  10. package/lib/browser/components/content/content.mjs +1 -1
  11. package/lib/browser/constants/device-sizes.cjs +1 -1
  12. package/lib/browser/constants/device-sizes.mjs +37 -20
  13. package/lib/browser/constants/sdk-version.cjs +1 -1
  14. package/lib/browser/constants/sdk-version.mjs +1 -1
  15. package/lib/browser/helpers/subscribe-to-editor.cjs +1 -1
  16. package/lib/browser/helpers/subscribe-to-editor.mjs +30 -22
  17. package/lib/browser/scripts/init-editing.cjs +1 -1
  18. package/lib/browser/scripts/init-editing.mjs +16 -13
  19. package/lib/edge/blocks/symbol/symbol.cjs +1 -1
  20. package/lib/edge/blocks/symbol/symbol.mjs +20 -20
  21. package/lib/edge/blocks/video/video.cjs +1 -1
  22. package/lib/edge/blocks/video/video.mjs +54 -17
  23. package/lib/edge/components/block/components/block-styles.cjs +1 -1
  24. package/lib/edge/components/block/components/block-styles.mjs +50 -42
  25. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  26. package/lib/edge/components/content/components/enable-editor.mjs +48 -45
  27. package/lib/edge/components/content/content.cjs +1 -1
  28. package/lib/edge/components/content/content.mjs +1 -1
  29. package/lib/edge/constants/device-sizes.cjs +1 -1
  30. package/lib/edge/constants/device-sizes.mjs +37 -20
  31. package/lib/edge/constants/sdk-version.cjs +1 -1
  32. package/lib/edge/constants/sdk-version.mjs +1 -1
  33. package/lib/edge/helpers/subscribe-to-editor.cjs +1 -1
  34. package/lib/edge/helpers/subscribe-to-editor.mjs +30 -22
  35. package/lib/edge/scripts/init-editing.cjs +1 -1
  36. package/lib/edge/scripts/init-editing.mjs +16 -13
  37. package/lib/node/blocks/symbol/symbol.cjs +1 -1
  38. package/lib/node/blocks/symbol/symbol.mjs +20 -20
  39. package/lib/node/blocks/video/video.cjs +1 -1
  40. package/lib/node/blocks/video/video.mjs +54 -17
  41. package/lib/node/components/block/components/block-styles.cjs +1 -1
  42. package/lib/node/components/block/components/block-styles.mjs +50 -42
  43. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  44. package/lib/node/components/content/components/enable-editor.mjs +48 -45
  45. package/lib/node/components/content/content.cjs +1 -1
  46. package/lib/node/components/content/content.mjs +1 -1
  47. package/lib/node/constants/device-sizes.cjs +1 -1
  48. package/lib/node/constants/device-sizes.mjs +37 -20
  49. package/lib/node/constants/sdk-version.cjs +1 -1
  50. package/lib/node/constants/sdk-version.mjs +1 -1
  51. package/lib/node/helpers/subscribe-to-editor.cjs +1 -1
  52. package/lib/node/helpers/subscribe-to-editor.mjs +30 -22
  53. package/lib/node/scripts/init-editing.cjs +1 -1
  54. package/lib/node/scripts/init-editing.mjs +16 -13
  55. package/package.json +1 -1
  56. package/types/cjs/components/content-variants/content-variants.types.d.ts +2 -2
  57. package/types/cjs/constants/device-sizes.d.ts +3 -2
  58. package/types/cjs/constants/sdk-version.d.ts +1 -1
  59. package/types/cjs/helpers/subscribe-to-editor.d.ts +13 -13
  60. package/types/cjs/scripts/init-editing.d.ts +3 -1
  61. package/types/cjs/types/builder-block.d.ts +0 -1
  62. package/types/cjs/types/builder-content.d.ts +1 -0
  63. package/types/esm/components/content-variants/content-variants.types.d.ts +2 -2
  64. package/types/esm/constants/device-sizes.d.ts +3 -2
  65. package/types/esm/constants/sdk-version.d.ts +1 -1
  66. package/types/esm/helpers/subscribe-to-editor.d.ts +13 -13
  67. package/types/esm/scripts/init-editing.d.ts +3 -1
  68. package/types/esm/types/builder-block.d.ts +0 -1
  69. package/types/esm/types/builder-content.d.ts +1 -0
@@ -1 +1 @@
1
- "use client";"use strict";const w=require("react/jsx-runtime"),o=require("react"),F=require("../../../context/builder.context.cjs"),V=require("../../../functions/evaluate/evaluate.cjs"),M=require("../../../functions/fast-clone.cjs"),N=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),g=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/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,R;const l=o.useRef(null);function f(n){var i,a;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(a=(i=e.builderContextSignal).rootSetState)==null||a.call(i,t):e.builderContextSignal.rootState=t}function m(n){var i,a,r,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:{...(a=e.builderContextSignal.content)==null?void 0:a.meta,...n==null?void 0:n.meta,breakpoints:((r=n==null?void 0:n.meta)==null?void 0:r.breakpoints)||((d=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};z.postPreviewContent({value:t,key:t.id}).then(()=>{j.refresh()})}function T(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[D,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return G.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var r;const{breakpoints:i,contentId:a}=t;!a||a!==((r=e.builderContextSignal.content)==null?void 0:r.id)||i&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[h,K]=o.useState(()=>!1);function _(n){var t,i;if(e.builderContextSignal.content){const a=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,r=(i=e.builderContextSignal.content)==null?void 0:i.id;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:r,apiKey:e.apiKey,variationId:a!==r?a:void 0,...$.getInteractionPropertiesForEvent(n),unique:!h})}h||K(!0)}function U(){var t,i,a;const n=(a=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?a:{};Object.entries(n).forEach(([r,c])=>{if(!c||b[r]||v[r]&&!g.isEditing())return;b[r]=!0;const d=c.replace(/{{([^}]+)}}/g,(s,B)=>String(V.evaluate({code:B,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));W.logFetch(d),fetch(d).then(s=>s.json()).then(s=>{f({[r]:s}),v[r]=!0}).catch(s=>{console.error("error fetching dynamic data",c,s)}).finally(()=>{b[r]=!1})})}function u(){g.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:M.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,a;if(!e.model||!((i=t.models)!=null&&i.length)||t.models.includes(e.model)){const r=A.createRegisterComponentMessage(t);(a=window.parent)==null||a.postMessage(r,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",u)}function x(n){var c;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),a=t.get(`builder.overrides.${i}`),r=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&r===e.apiKey&&(!e.content||a===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)})}const j=X.useRouter(),C=o.useRef(!1);return C.current||(U(),u(),C.current=!0),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t;if(k.isBrowser()){if(g.isEditing()&&!e.isNestedRender&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack)){const a=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,r=(t=e.builderContextSignal.content)==null?void 0:t.id,c=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:r,apiKey:c,variationId:a!==r?a:void 0})}O.isPreviewing()&&g.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{u()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&f(e.data)},[e.data]),o.useEffect(()=>{e.locale&&f({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",u))},[]),w.jsx(F.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?w.jsx(D,{ref:l,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)||((R=e.content)==null?void 0:R.id)),style:{display:!e.builderContextSignal.content&&H.needsElementRefDivForEditing()?"none":void 0},...T(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
1
+ "use client";"use strict";const w=require("react/jsx-runtime"),o=require("react"),F=require("../../../context/builder.context.cjs"),N=require("../../../functions/evaluate/evaluate.cjs"),V=require("../../../functions/fast-clone.cjs"),M=require("../../../functions/get-content/index.cjs"),y=require("../../../functions/is-browser.cjs"),g=require("../../../functions/is-editing.cjs"),O=require("../../../functions/is-previewing.cjs"),W=require("../../../functions/log-fetch.cjs"),A=require("../../../functions/register-component.cjs"),k=require("../../../functions/track/index.cjs"),$=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.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,R;const l=o.useRef(null);function f(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}).then(()=>{j.refresh()})}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)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=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;k._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]&&!g.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(s,B)=>String(N.evaluate({code:B,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));W.logFetch(d),fetch(d).then(s=>s.json()).then(s=>{f({[a]:s}),v[a]=!0}).catch(s=>{console.error("error fetching dynamic data",c,s)}).finally(()=>{b[a]=!1})})}function u(){g.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:V.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",u)}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 j=X.useRouter(),C=o.useRef(!1);return C.current||(U(),u(),C.current=!0),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t;if(y.isBrowser()){if(g.isEditing()&&!e.isNestedRender&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack)){const r=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,a=(t=e.builderContextSignal.content)==null?void 0:t.id,c=e.apiKey;k._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:a,apiKey:c,variationId:r!==a?r:void 0})}O.isPreviewing()&&g.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{u()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&f(e.data)},[e.data]),o.useEffect(()=>{e.locale&&f({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{y.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",u))},[]),w.jsx(F.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?w.jsx(T,{ref:l,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)||((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=Y;
@@ -20,19 +20,19 @@ import { triggerAnimation as Y } from "../../block/animator.mjs";
20
20
  import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
21
21
  import { getWrapperClassName as Z } from "./styles.helpers.mjs";
22
22
  import { useRouter as p } from "next/navigation";
23
- function we(e) {
24
- var R, w, y;
23
+ function Re(e) {
24
+ var y, R, w;
25
25
  const c = P(null);
26
26
  function g(n) {
27
- var i, a;
27
+ var i, r;
28
28
  const t = {
29
29
  ...e.builderContextSignal.rootState,
30
30
  ...n
31
31
  };
32
- e.builderContextSignal.rootSetState ? (a = (i = e.builderContextSignal).rootSetState) == null || a.call(i, t) : e.builderContextSignal.rootState = t;
32
+ e.builderContextSignal.rootSetState ? (r = (i = e.builderContextSignal).rootSetState) == null || r.call(i, t) : e.builderContextSignal.rootState = t;
33
33
  }
34
34
  function b(n) {
35
- var i, a, r, o, d;
35
+ var i, r, a, o, d;
36
36
  const t = {
37
37
  ...e.builderContextSignal.content,
38
38
  ...n,
@@ -41,16 +41,16 @@ function we(e) {
41
41
  ...n == null ? void 0 : n.data
42
42
  },
43
43
  meta: {
44
- ...(a = e.builderContextSignal.content) == null ? void 0 : a.meta,
44
+ ...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
45
45
  ...n == null ? void 0 : n.meta,
46
- breakpoints: ((r = n == null ? void 0 : n.meta) == null ? void 0 : r.breakpoints) || ((d = (o = e.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : d.breakpoints)
46
+ 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)
47
47
  }
48
48
  };
49
49
  G({
50
50
  value: t,
51
51
  key: t.id
52
52
  }).then(() => {
53
- M.refresh();
53
+ _.refresh();
54
54
  });
55
55
  }
56
56
  function T() {
@@ -68,9 +68,9 @@ function we(e) {
68
68
  trustedHosts: e.trustedHosts,
69
69
  callbacks: {
70
70
  configureSdk: (t) => {
71
- var r;
72
- const { breakpoints: i, contentId: a } = t;
73
- !a || a !== ((r = e.builderContextSignal.content) == null ? void 0 : r.id) || i && b({
71
+ var a;
72
+ const { breakpoints: i, contentId: r } = t;
73
+ !r || r !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || i && b({
74
74
  meta: {
75
75
  breakpoints: i
76
76
  }
@@ -86,35 +86,35 @@ function we(e) {
86
86
  })(n);
87
87
  }
88
88
  const [h, te] = s(() => ({})), [S, ne] = s(() => ({})), [x, U] = s(() => !1);
89
- function V(n) {
89
+ function N(n) {
90
90
  var t, i;
91
91
  if (e.builderContextSignal.content) {
92
- const a = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, r = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
92
+ const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
93
93
  H({
94
94
  apiHost: e.apiHost,
95
95
  type: "click",
96
96
  canTrack: K(e.canTrack),
97
- contentId: r,
97
+ contentId: a,
98
98
  apiKey: e.apiKey,
99
- variationId: a !== r ? a : void 0,
99
+ variationId: r !== a ? r : void 0,
100
100
  ...$(n),
101
101
  unique: !x
102
102
  });
103
103
  }
104
104
  x || U(!0);
105
105
  }
106
- function _() {
107
- var t, i, a;
108
- const n = (a = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? a : {};
109
- Object.entries(n).forEach(([r, o]) => {
110
- if (!o || S[r] || h[r] && !f())
106
+ function V() {
107
+ var t, i, r;
108
+ const n = (r = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? r : {};
109
+ Object.entries(n).forEach(([a, o]) => {
110
+ if (!o || S[a] || h[a] && !f())
111
111
  return;
112
- S[r] = !0;
112
+ S[a] = !0;
113
113
  const d = o.replace(
114
114
  /{{([^}]+)}}/g,
115
- (u, N) => String(
115
+ (u, M) => String(
116
116
  W({
117
- code: N,
117
+ code: M,
118
118
  context: e.context || {},
119
119
  localState: void 0,
120
120
  rootState: e.builderContextSignal.rootState,
@@ -124,12 +124,12 @@ function we(e) {
124
124
  );
125
125
  F(d), fetch(d).then((u) => u.json()).then((u) => {
126
126
  g({
127
- [r]: u
128
- }), h[r] = !0;
127
+ [a]: u
128
+ }), h[a] = !0;
129
129
  }).catch((u) => {
130
130
  console.error("error fetching dynamic data", o, u);
131
131
  }).finally(() => {
132
- S[r] = !1;
132
+ S[a] = !1;
133
133
  });
134
134
  });
135
135
  }
@@ -149,6 +149,7 @@ function we(e) {
149
149
  );
150
150
  }
151
151
  function C(n) {
152
+ var t;
152
153
  window.addEventListener("message", v), Q(), X({
153
154
  ...e.locale ? {
154
155
  locale: e.locale
@@ -158,14 +159,16 @@ function we(e) {
158
159
  } : {},
159
160
  ...e.trustedHosts ? {
160
161
  trustedHosts: e.trustedHosts
161
- } : {}
162
+ } : {},
163
+ modelName: (t = e.model) != null ? t : "",
164
+ apiKey: e.apiKey
162
165
  }), Object.values(
163
166
  e.builderContextSignal.componentInfos
164
- ).forEach((t) => {
165
- var i, a;
166
- if (!e.model || !((i = t.models) != null && i.length) || t.models.includes(e.model)) {
167
- const r = z(t);
168
- (a = window.parent) == null || a.postMessage(r, "*");
167
+ ).forEach((i) => {
168
+ var r, a;
169
+ if (!((r = i.models) != null && r.length) || i.models.includes(e.model)) {
170
+ const o = z(i);
171
+ (a = window.parent) == null || a.postMessage(o, "*");
169
172
  }
170
173
  }), window.addEventListener(
171
174
  "builder:component:stateChangeListenerActivated",
@@ -174,11 +177,11 @@ function we(e) {
174
177
  }
175
178
  function E(n) {
176
179
  var o;
177
- const t = new URL(location.href).searchParams, i = t.get("builder.preview"), a = t.get(
180
+ const t = new URL(location.href).searchParams, i = t.get("builder.preview"), r = t.get(
178
181
  `builder.overrides.${i}`
179
- ), r = t.get("apiKey") || t.get("builder.space");
180
- (i === "BUILDER_STUDIO" || i === e.model && r === e.apiKey && (!e.content || a === e.content.id)) && A({
181
- model: e.model || "",
182
+ ), a = t.get("apiKey") || t.get("builder.space");
183
+ (i === "BUILDER_STUDIO" || i === e.model && a === e.apiKey && (!e.content || r === e.content.id)) && A({
184
+ model: e.model,
182
185
  apiKey: e.apiKey,
183
186
  apiVersion: e.builderContextSignal.apiVersion,
184
187
  ...i === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
@@ -190,8 +193,8 @@ function we(e) {
190
193
  d && b(d);
191
194
  });
192
195
  }
193
- const M = p(), I = P(!1);
194
- return I.current || (_(), m(), I.current = !0), l(() => {
196
+ const _ = p(), I = P(!1);
197
+ return I.current || (V(), m(), I.current = !0), l(() => {
195
198
  var n;
196
199
  return (n = c.current) == null || n.addEventListener(
197
200
  "initeditingbldr",
@@ -219,14 +222,14 @@ function we(e) {
219
222
  var n, t;
220
223
  if (L()) {
221
224
  if (f() && !e.isNestedRender && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && K(e.canTrack)) {
222
- const a = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, r = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
225
+ const r = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, a = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
223
226
  H({
224
227
  apiHost: e.apiHost,
225
228
  type: "impression",
226
229
  canTrack: !0,
227
- contentId: r,
230
+ contentId: a,
228
231
  apiKey: o,
229
- variationId: a !== r ? a : void 0
232
+ variationId: r !== a ? r : void 0
230
233
  });
231
234
  }
232
235
  B() && f();
@@ -249,11 +252,11 @@ function we(e) {
249
252
  D,
250
253
  {
251
254
  ref: c,
252
- onClick: (n) => V(n),
253
- "builder-content-id": (R = e.builderContextSignal.content) == null ? void 0 : R.id,
255
+ onClick: (n) => N(n),
256
+ "builder-content-id": (y = e.builderContextSignal.content) == null ? void 0 : y.id,
254
257
  "builder-model": e.model,
255
258
  className: Z(
256
- ((w = e.content) == null ? void 0 : w.testVariationId) || ((y = e.content) == null ? void 0 : y.id)
259
+ ((R = e.content) == null ? void 0 : R.testVariationId) || ((w = e.content) == null ? void 0 : w.id)
257
260
  ),
258
261
  style: {
259
262
  display: !e.builderContextSignal.content && q() ? "none" : void 0
@@ -265,5 +268,5 @@ function we(e) {
265
268
  ) : null });
266
269
  }
267
270
  export {
268
- we as default
271
+ Re as default
269
272
  };
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime"),b=require("../../constants/builder-registered-components.cjs"),h=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),R=require("../../helpers/logger.cjs"),W=require("../blocks/blocks.cjs"),j=require("../content-variants/helpers.cjs"),P=require("../inlined-script.cjs"),V=require("./components/enable-editor.cjs"),K=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function T(e){var a,s,r,d,l,u,m,C,g,S,k;const v=j.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(s=e.content)==null?void 0:s.id}),I=[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:{component:x,...y.serializeIncludingFunctions(o)}}),{}),t={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:[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model||""};e.apiKey||R.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=(r=t.content)==null?void 0:r.data)==null?void 0:d.jsCode;return i&&h.evaluate({code:i,context:e.context||{},localState:void 0,rootState:t.rootState,rootSetState:n=>{t.rootState=n},isExpression:!1}),c.jsxs(V,{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:t,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,children:[e.isSsrAbTest?c.jsx(P,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(K,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(l=t.content)==null?void 0:l.id,cssCode:(m=(u=t.content)==null?void 0:u.data)==null?void 0:m.cssCode,customFonts:(g=(C=t.content)==null?void 0:C.data)==null?void 0:g.customFonts}),c.jsx(W,{blocks:(k=(S=t.content)==null?void 0:S.data)==null?void 0:k.blocks,context:t,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=T;
1
+ "use strict";const c=require("react/jsx-runtime"),b=require("../../constants/builder-registered-components.cjs"),h=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),R=require("../../helpers/logger.cjs"),W=require("../blocks/blocks.cjs"),j=require("../content-variants/helpers.cjs"),P=require("../inlined-script.cjs"),V=require("./components/enable-editor.cjs"),K=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function T(e){var a,s,r,d,l,u,m,C,g,S,k;const v=j.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(s=e.content)==null?void 0:s.id}),I=[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:{component:x,...y.serializeIncludingFunctions(o)}}),{}),t={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:[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model};e.apiKey||R.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=(r=t.content)==null?void 0:r.data)==null?void 0:d.jsCode;return i&&h.evaluate({code:i,context:e.context||{},localState:void 0,rootState:t.rootState,rootSetState:n=>{t.rootState=n},isExpression:!1}),c.jsxs(V,{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:t,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,children:[e.isSsrAbTest?c.jsx(P,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(K,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(l=t.content)==null?void 0:l.id,cssCode:(m=(u=t.content)==null?void 0:u.data)==null?void 0:m.cssCode,customFonts:(g=(C=t.content)==null?void 0:C.data)==null?void 0:g.customFonts}),c.jsx(W,{blocks:(k=(S=t.content)==null?void 0:S.data)==null?void 0:k.blocks,context:t,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=T;
@@ -58,7 +58,7 @@ function G(t) {
58
58
  BlocksWrapper: t.blocksWrapper || "div",
59
59
  BlocksWrapperProps: t.blocksWrapperProps || {},
60
60
  nonce: t.nonce || "",
61
- model: t.model || ""
61
+ model: t.model
62
62
  };
63
63
  t.apiKey || W.error(
64
64
  "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../functions/fast-clone.cjs"),o={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},l=(t,a=o)=>`@media (max-width: ${a[t].max}px)`,s=({small:t,medium:a})=>{const e=r.fastClone(o);if(!t||!a)return e;const i=Math.floor(t/2);e.small={max:t,min:i,default:i+1};const m=e.small.max+1;e.medium={max:a,min:m,default:m+1};const n=e.medium.max+1;return e.large={max:2e3,min:n,default:n+1},e};exports.getMaxWidthQueryForSize=l;exports.getSizesForBreakpoints=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../functions/fast-clone.cjs"),r={xsmall:{min:0,default:160,max:320},small:{min:321,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},x=(a,e=r)=>`@media (max-width: ${e[a].max}px)`,d=a=>{const e=u.fastClone(r);if(!a)return e;const{xsmall:m,small:t,medium:l}=a;if(m){const o=Math.floor(m/2);e.xsmall={max:m,min:o,default:o+1}}if(!t||!l)return e;const i=m?e.xsmall.max+1:Math.floor(t/2);e.small={max:t,min:i,default:i+1};const n=e.small.max+1;e.medium={max:l,min:n,default:n+1};const s=e.medium.max+1;return e.large={max:2e3,min:s,default:s+1},e};exports.getMaxWidthQueryForSize=x;exports.getSizesForBreakpoints=d;
@@ -1,7 +1,12 @@
1
- import { fastClone as l } from "../functions/fast-clone.mjs";
1
+ import { fastClone as r } from "../functions/fast-clone.mjs";
2
2
  const o = {
3
+ xsmall: {
4
+ min: 0,
5
+ default: 160,
6
+ max: 320
7
+ },
3
8
  small: {
4
- min: 320,
9
+ min: 321,
5
10
  default: 321,
6
11
  max: 640
7
12
  },
@@ -15,34 +20,46 @@ const o = {
15
20
  default: 991,
16
21
  max: 1200
17
22
  }
18
- }, s = (a, e = o) => `@media (max-width: ${e[a].max}px)`, x = ({
19
- small: a,
20
- medium: e
21
- }) => {
22
- const m = l(o);
23
- if (!a || !e)
23
+ }, d = (a, m = o) => `@media (max-width: ${m[a].max}px)`, f = (a) => {
24
+ const m = r(o);
25
+ if (!a)
26
+ return m;
27
+ const {
28
+ xsmall: l,
29
+ small: e,
30
+ medium: t
31
+ } = a;
32
+ if (l) {
33
+ const x = Math.floor(l / 2);
34
+ m.xsmall = {
35
+ max: l,
36
+ min: x,
37
+ default: x + 1
38
+ };
39
+ }
40
+ if (!e || !t)
24
41
  return m;
25
- const t = Math.floor(a / 2);
42
+ const i = l ? m.xsmall.max + 1 : Math.floor(e / 2);
26
43
  m.small = {
27
- max: a,
28
- min: t,
29
- default: t + 1
30
- };
31
- const i = m.small.max + 1;
32
- m.medium = {
33
44
  max: e,
34
45
  min: i,
35
46
  default: i + 1
36
47
  };
37
- const n = m.medium.max + 1;
48
+ const n = m.small.max + 1;
49
+ m.medium = {
50
+ max: t,
51
+ min: n,
52
+ default: n + 1
53
+ };
54
+ const s = m.medium.max + 1;
38
55
  return m.large = {
39
56
  max: 2e3,
40
57
  // TODO: decide upper limit
41
- min: n,
42
- default: n + 1
58
+ min: s,
59
+ default: s + 1
43
60
  }, m;
44
61
  };
45
62
  export {
46
- s as getMaxWidthQueryForSize,
47
- x as getSizesForBreakpoints
63
+ d as getMaxWidthQueryForSize,
64
+ f as getSizesForBreakpoints
48
65
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.7";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.0";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.17.7";
1
+ const o = "0.18.0";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),g=require("../scripts/init-editing.cjs"),b=require("./logger.cjs"),o=({model:n,trustedHosts:i,callbacks:e})=>t=>{if(!u.isFromTrustedHost(i,t))return;const{data:r}=t;if(r)switch(r.type){case"builder.configureSdk":{e.configureSdk(r.data);break}case"builder.triggerAnimation":{e.animation(r.data);break}case"builder.contentUpdate":{const s=r.data,a=s.key||s.alias||s.entry||s.modelName,d=s.data;a===n&&e.contentUpdate(d);break}}},m=(n,i,e)=>{if(!c.isBrowser)return b.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};g.setupBrowserForEditing();const t=o({callbacks:{contentUpdate:i,animation:()=>{},configureSdk:()=>{}},model:n,trustedHosts:e==null?void 0:e.trustedHosts});return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}};exports.createEditorListener=o;exports.subscribeToEditor=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),g=require("../scripts/init-editing.cjs"),b=require("./logger.cjs"),s=({model:n,trustedHosts:o,callbacks:t})=>i=>{if(!u.isFromTrustedHost(o,i))return;const{data:e}=i;if(e)switch(e.type){case"builder.configureSdk":{t.configureSdk(e.data);break}case"builder.triggerAnimation":{t.animation(e.data);break}case"builder.contentUpdate":{const r=e.data,a=r.key||r.alias||r.entry||r.modelName,d=r.data;a===n&&t.contentUpdate(d);break}}},m=({model:n,apiKey:o,callback:t,trustedHosts:i})=>{if(!c.isBrowser)return b.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};g.setupBrowserForEditing({modelName:n,apiKey:o});const e=s({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:n,trustedHosts:i});return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}};exports.createEditorListener=s;exports.subscribeToEditor=m;
@@ -3,52 +3,60 @@ import { isFromTrustedHost as c } from "../functions/is-from-trusted-host.mjs";
3
3
  import { setupBrowserForEditing as m } from "../scripts/init-editing.mjs";
4
4
  import { logger as u } from "./logger.mjs";
5
5
  const g = ({
6
- model: o,
7
- trustedHosts: s,
8
- callbacks: e
9
- }) => (t) => {
10
- if (!c(s, t))
6
+ model: n,
7
+ trustedHosts: i,
8
+ callbacks: t
9
+ }) => (o) => {
10
+ if (!c(i, o))
11
11
  return;
12
12
  const {
13
- data: r
14
- } = t;
15
- if (r)
16
- switch (r.type) {
13
+ data: e
14
+ } = o;
15
+ if (e)
16
+ switch (e.type) {
17
17
  case "builder.configureSdk": {
18
- e.configureSdk(r.data);
18
+ t.configureSdk(e.data);
19
19
  break;
20
20
  }
21
21
  case "builder.triggerAnimation": {
22
- e.animation(r.data);
22
+ t.animation(e.data);
23
23
  break;
24
24
  }
25
25
  case "builder.contentUpdate": {
26
- const n = r.data, i = n.key || n.alias || n.entry || n.modelName, a = n.data;
27
- i === o && e.contentUpdate(a);
26
+ const r = e.data, s = r.key || r.alias || r.entry || r.modelName, a = r.data;
27
+ s === n && t.contentUpdate(a);
28
28
  break;
29
29
  }
30
30
  }
31
- }, l = (o, s, e) => {
31
+ }, k = ({
32
+ model: n,
33
+ apiKey: i,
34
+ callback: t,
35
+ trustedHosts: o
36
+ }) => {
32
37
  if (!d)
33
38
  return u.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
34
39
  };
35
- m();
36
- const t = g({
40
+ m({
41
+ modelName: n,
42
+ apiKey: i
43
+ });
44
+ const e = g({
37
45
  callbacks: {
38
- contentUpdate: s,
46
+ contentUpdate: t,
39
47
  animation: () => {
40
48
  },
41
49
  configureSdk: () => {
42
50
  }
43
51
  },
44
- model: o,
45
- trustedHosts: e == null ? void 0 : e.trustedHosts
52
+ model: n,
53
+ trustedHosts: o
46
54
  });
47
- return window.addEventListener("message", t), () => {
48
- window.removeEventListener("message", t);
55
+ return window.addEventListener("message", e), () => {
56
+ window.removeEventListener("message", e);
49
57
  };
50
58
  };
51
59
  export {
52
60
  g as createEditorListener,
53
- l as subscribeToEditor
61
+ k as subscribeToEditor
54
62
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),M=require("../functions/is-from-trusted-host.cjs"),B=require("../functions/register.cjs"),E=()=>{B.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const v=(o={})=>{var a,i;c||(c=!0,b.isBrowser()&&((a=window.parent)==null||a.postMessage({type:"builder.sdkInfo",data:{target:y.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:o}},"*"),window.addEventListener("message",u=>{var d,l;if(!M.isFromTrustedHost(o.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const g=e.data.text,m=e.data.arguments||[],r=e.data.id,w=new Function(g);let t,s=null;try{t=w.apply(null,m)}catch(n){s=n}s?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:r,error:s.message}},"*"):t&&typeof t.then=="function"?t.then(n=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:r,result:n}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:r}},"*");break}}})))};exports.registerInsertMenu=E;exports.setupBrowserForEditing=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),B=require("../functions/is-from-trusted-host.cjs"),M=require("../functions/register.cjs"),E=()=>{M.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const S=r=>{var o,i;c||(c=!0,b.isBrowser()&&((o=window.parent)==null||o.postMessage({type:"builder.sdkInfo",data:{target:y.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:r.modelName,apiKey:r.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:r}},"*"),window.addEventListener("message",u=>{var d,l;if(!B.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const m=e.data.text,g=e.data.arguments||[],s=e.data.id,w=new Function(m);let t,a=null;try{t=w.apply(null,g)}catch(n){a=n}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(n=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:n}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.registerInsertMenu=E;exports.setupBrowserForEditing=S;
@@ -1,10 +1,10 @@
1
1
  import { SDK_VERSION as w } from "../constants/sdk-version.mjs";
2
2
  import { TARGET as y } from "../constants/target.mjs";
3
3
  import { isBrowser as b } from "../functions/is-browser.mjs";
4
- import { isFromTrustedHost as C } from "../functions/is-from-trusted-host.mjs";
5
- import { register as E } from "../functions/register.mjs";
6
- const x = () => {
7
- E("insertMenu", {
4
+ import { isFromTrustedHost as B } from "../functions/is-from-trusted-host.mjs";
5
+ import { register as C } from "../functions/register.mjs";
6
+ const S = () => {
7
+ C("insertMenu", {
8
8
  name: "_default",
9
9
  default: !0,
10
10
  items: [{
@@ -27,7 +27,7 @@ const x = () => {
27
27
  });
28
28
  };
29
29
  let m = !1;
30
- const S = (a = {}) => {
30
+ const x = (r) => {
31
31
  var n, i;
32
32
  m || (m = !0, b() && ((n = window.parent) == null || n.postMessage({
33
33
  type: "builder.sdkInfo",
@@ -39,16 +39,19 @@ const S = (a = {}) => {
39
39
  // scope our '+ add block' button styling
40
40
  supportsAddBlockScoping: !0,
41
41
  supportsCustomBreakpoints: !0,
42
+ modelName: r.modelName,
43
+ apiKey: r.apiKey,
44
+ supportsXSmallBreakpoint: !0,
42
45
  blockLevelPersonalization: !0
43
46
  }
44
47
  }, "*"), (i = window.parent) == null || i.postMessage({
45
48
  type: "builder.updateContent",
46
49
  data: {
47
- options: a
50
+ options: r
48
51
  }
49
52
  }, "*"), window.addEventListener("message", (u) => {
50
53
  var p, d;
51
- if (!C(a.trustedHosts, u))
54
+ if (!B(r.trustedHosts, u))
52
55
  return;
53
56
  const {
54
57
  data: e
@@ -56,7 +59,7 @@ const S = (a = {}) => {
56
59
  if (e != null && e.type)
57
60
  switch (e.type) {
58
61
  case "builder.evaluate": {
59
- const c = e.data.text, f = e.data.arguments || [], r = e.data.id, g = new Function(c);
62
+ const c = e.data.text, f = e.data.arguments || [], a = e.data.id, g = new Function(c);
60
63
  let t, s = null;
61
64
  try {
62
65
  t = g.apply(null, f);
@@ -66,7 +69,7 @@ const S = (a = {}) => {
66
69
  s ? (p = window.parent) == null || p.postMessage({
67
70
  type: "builder.evaluateError",
68
71
  data: {
69
- id: r,
72
+ id: a,
70
73
  error: s.message
71
74
  }
72
75
  }, "*") : t && typeof t.then == "function" ? t.then((o) => {
@@ -74,7 +77,7 @@ const S = (a = {}) => {
74
77
  (l = window.parent) == null || l.postMessage({
75
78
  type: "builder.evaluateResult",
76
79
  data: {
77
- id: r,
80
+ id: a,
78
81
  result: o
79
82
  }
80
83
  }, "*");
@@ -82,7 +85,7 @@ const S = (a = {}) => {
82
85
  type: "builder.evaluateResult",
83
86
  data: {
84
87
  result: t,
85
- id: r
88
+ id: a
86
89
  }
87
90
  }, "*");
88
91
  break;
@@ -91,6 +94,6 @@ const S = (a = {}) => {
91
94
  })));
92
95
  };
93
96
  export {
94
- x as registerInsertMenu,
95
- S as setupBrowserForEditing
97
+ S as registerInsertMenu,
98
+ x as setupBrowserForEditing
96
99
  };
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),y=require("../../components/content-variants/content-variants.cjs"),C=require("../../functions/get-class-prop-name.cjs"),x=require("./symbol.helpers.cjs");async function k(e){var n,i,o,l,a;const u=function(){return"div"},d=function(){return"div"},m=function(){var r,b;return[e.attributes[C.getClassPropName()],"builder-symbol",(r=e.symbol)!=null&&r.inline?"builder-inline-symbol":void 0,(b=e.symbol)!=null&&b.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await x.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return s.jsx("div",{...e.attributes,className:m(),children:s.jsx(y,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(l=t==null?void 0:t.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(a=e.symbol)==null?void 0:a.model,content:t,linkComponent:e.builderLinkComponent,blocksWrapper:u(),contentWrapper:d()})})}module.exports=k;
1
+ "use strict";const u=require("react/jsx-runtime"),C=require("../../components/content-variants/content-variants.cjs"),x=require("../../functions/get-class-prop-name.cjs"),k=require("./symbol.helpers.cjs");async function f(e){var n,i,o,l,a,c;const d=function(){return"div"},m=function(){return"div"},y=function(){var b,s;return[e.attributes[x.getClassPropName()],"builder-symbol",(b=e.symbol)!=null&&b.inline?"builder-inline-symbol":void 0,(s=e.symbol)!=null&&s.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await k.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return u.jsx("div",{...e.attributes,className:y(),children:u.jsx(C,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(l=t==null?void 0:t.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(c=(a=e.symbol)==null?void 0:a.model)!=null?c:"",content:t,linkComponent:e.builderLinkComponent,blocksWrapper:d(),contentWrapper:m()})})}module.exports=f;
@@ -1,27 +1,27 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import y from "../../components/content-variants/content-variants.mjs";
3
- import { getClassPropName as C } from "../../functions/get-class-prop-name.mjs";
4
- import { fetchSymbolContent as x } from "./symbol.helpers.mjs";
5
- async function N(e) {
6
- var n, o, i, l, a;
7
- const d = function() {
8
- return "div";
9
- }, u = function() {
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import C from "../../components/content-variants/content-variants.mjs";
3
+ import { getClassPropName as x } from "../../functions/get-class-prop-name.mjs";
4
+ import { fetchSymbolContent as f } from "./symbol.helpers.mjs";
5
+ async function V(e) {
6
+ var n, o, i, l, a, r;
7
+ const u = function() {
10
8
  return "div";
11
9
  }, s = function() {
12
- var c, m;
10
+ return "div";
11
+ }, y = function() {
12
+ var m, b;
13
13
  return [
14
- e.attributes[C()],
14
+ e.attributes[x()],
15
15
  "builder-symbol",
16
- (c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
17
- (m = e.symbol) != null && m.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
16
+ (m = e.symbol) != null && m.inline ? "builder-inline-symbol" : void 0,
17
+ (b = e.symbol) != null && b.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
18
18
  ].filter(Boolean).join(" ");
19
- }, t = ((n = e.symbol) == null ? void 0 : n.content) || await x({
19
+ }, t = ((n = e.symbol) == null ? void 0 : n.content) || await f({
20
20
  symbol: e.symbol,
21
21
  builderContextValue: e.builderContext
22
22
  });
23
- return /* @__PURE__ */ b("div", { ...e.attributes, className: s(), children: /* @__PURE__ */ b(
24
- y,
23
+ return /* @__PURE__ */ d("div", { ...e.attributes, className: y(), children: /* @__PURE__ */ d(
24
+ C,
25
25
  {
26
26
  nonce: e.builderContext.nonce,
27
27
  isNestedRender: !0,
@@ -38,14 +38,14 @@ async function N(e) {
38
38
  ...(l = t == null ? void 0 : t.data) == null ? void 0 : l.state
39
39
  },
40
40
  canTrack: e.builderContext.canTrack,
41
- model: (a = e.symbol) == null ? void 0 : a.model,
41
+ model: (r = (a = e.symbol) == null ? void 0 : a.model) != null ? r : "",
42
42
  content: t,
43
43
  linkComponent: e.builderLinkComponent,
44
- blocksWrapper: d(),
45
- contentWrapper: u()
44
+ blocksWrapper: u(),
45
+ contentWrapper: s()
46
46
  }
47
47
  ) });
48
48
  }
49
49
  export {
50
- N as default
50
+ V as default
51
51
  };