@builder.io/sdk-react-nextjs 0.12.2 → 0.12.3
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.
- package/lib/browser/{USE_CLIENT_BUNDLE-4b1b3c99.cjs → USE_CLIENT_BUNDLE-64b6ec10.cjs} +3 -5
- package/lib/{node/USE_CLIENT_BUNDLE-d30db795.js → browser/USE_CLIENT_BUNDLE-e89d3175.js} +76 -80
- package/lib/{edge/USE_SERVER_BUNDLE-70c27ea1.js → browser/USE_SERVER_BUNDLE-d6bec4ec.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-f0eeb33e.cjs → browser/USE_SERVER_BUNDLE-f34c0814.cjs} +1 -1
- package/lib/browser/{bundle-1d763be7.cjs → bundle-50ff23eb.cjs} +6 -2
- package/lib/browser/{bundle-d905bf70.js → bundle-f3e8cd29.js} +6 -2
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{node/USE_CLIENT_BUNDLE-def5165a.cjs → edge/USE_CLIENT_BUNDLE-2aed408a.cjs} +3 -5
- package/lib/{browser/USE_CLIENT_BUNDLE-550679f9.js → edge/USE_CLIENT_BUNDLE-a3258a60.js} +76 -80
- package/lib/{node/USE_SERVER_BUNDLE-610c83b3.js → edge/USE_SERVER_BUNDLE-4e9af8f5.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-a5db98bc.cjs → edge/USE_SERVER_BUNDLE-e79e6b55.cjs} +1 -1
- package/lib/edge/{bundle-834dbf29.js → bundle-cb191300.js} +6 -2
- package/lib/edge/{bundle-25fa71b1.cjs → bundle-d4f509a3.cjs} +6 -2
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-aa38a343.js → node/USE_CLIENT_BUNDLE-98a4fbf4.js} +76 -80
- package/lib/{edge/USE_CLIENT_BUNDLE-edb18eb8.cjs → node/USE_CLIENT_BUNDLE-990b655a.cjs} +3 -5
- package/lib/{browser/USE_SERVER_BUNDLE-464dccd7.js → node/USE_SERVER_BUNDLE-b231d861.js} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-6234c5ea.cjs → node/USE_SERVER_BUNDLE-c86a1fb8.cjs} +1 -1
- package/lib/node/{bundle-1f73ead0.js → bundle-11daeaca.js} +6 -2
- package/lib/node/{bundle-4efd9623.cjs → bundle-b2d68b60.cjs} +6 -2
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-
|
|
2
|
-
all: unset;
|
|
3
|
-
}`})]})}function H(e){return t.jsx(t.Fragment,{children:a.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}function U(e){return t.jsx(H,{TagName:e.Wrapper,attributes:a.getBlockProperties({block:e.block,context:e.context}),actionAttributes:a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function O(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...a.getBlockProperties({block:e.block,context:e.context}),...a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function J(e){function l(){var s;return"builder-blocks"+((s=e.blocks)!=null&&s.length?"":" no-blocks")}function g(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:l()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:s=>g(),onMouseEnter:s=>S(),onKeyPress:s=>g(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-50ff23eb.cjs"),r=require("react"),M=require("./USE_SERVER_BUNDLE-f34c0814.cjs"),D=require("next/navigation");function V(e){return t.jsx(t.Fragment,{children:e.link?t.jsx(t.Fragment,{children:t.jsx("a",{...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"button",children:e.text})}):t.jsx(t.Fragment,{children:t.jsx("button",{role:"button",...e.attributes,className:`builder-button ${e.attributes.className}`,style:e.attributes.style,children:e.text})})})}function H(e){return t.jsx(t.Fragment,{children:a.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}function U(e){return t.jsx(H,{TagName:e.Wrapper,attributes:a.getBlockProperties({block:e.block,context:e.context}),actionAttributes:a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function O(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...a.getBlockProperties({block:e.block,context:e.context}),...a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function $(e){function l(){var s;return"builder-blocks"+((s=e.blocks)!=null&&s.length?"":" no-blocks")}function g(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:l()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:s=>g(),onMouseEnter:s=>S(),onKeyPress:s=>g(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
4
2
|
display: flex;
|
|
5
3
|
flex-direction: column;
|
|
6
4
|
align-items: stretch;
|
|
7
|
-
}`})]})}function
|
|
5
|
+
}`})]})}function J(e){return t.jsx("span",{children:e.children})}function G(e){var s,m,x,v;function l(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),a.getSrcSet(d)}else if(e.image&&!e.srcset)return a.getSrcSet(d);return a.getSrcSet(d)}function g(){var b;return(b=l==null?void 0:l())!=null&&b.match(/builder\.io/)&&!e.noWebp?l().replace(/\?/g,"?format=webp&"):""}function S(){const b={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?b:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[g()?t.jsx(t.Fragment,{children:t.jsx("source",{type:"image/webp",srcSet:g()})}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?"presentation":void 0,style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-40c70c9b",src:e.image,srcSet:l(),sizes:e.sizes})]}),e.aspectRatio&&!((m=(s=e.builderBlock)==null?void 0:s.children)!=null&&m.length&&e.fitContent)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"builder-image-sizer div-40c70c9b",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(v=(x=e.builderBlock)==null?void 0:x.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx(t.Fragment,{children:t.jsx("div",{className:"div-40c70c9b-2",children:e.children})}):null]}),t.jsx("style",{children:`.img-40c70c9b {
|
|
8
6
|
opacity: 1;
|
|
9
7
|
transition: opacity 0.2s ease-in-out;
|
|
10
8
|
}.div-40c70c9b {
|
|
@@ -20,4 +18,4 @@
|
|
|
20
18
|
left: 0;
|
|
21
19
|
width: 100%;
|
|
22
20
|
height: 100%;
|
|
23
|
-
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]);return r.useEffect(()=>{var v;if(!((v=l.current)!=null&&v.getElementsByTagName)||typeof window>"u")return;const x=l.current.getElementsByTagName("script");for(let b=0;b<x.length;b++){const d=x[b];if(d.src){if(g.includes(d.src))continue;g.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(s.includes(d.innerText))continue;try{s.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function Y(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]),[x,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const d=l.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const y=d[f];if(y.src&&!g.includes(y.src)){g.push(y.src);const k=document.createElement("script");k.async=!0,k.src=y.src,document.head.appendChild(k)}else if(a.isJsScript(y)&&!s.includes(y.innerText))try{s.push(y.innerText),new Function(y.innerText)()}catch(k){console.warn("`Embed`: Error running script:",k)}}}return r.useEffect(()=>{l.current&&!x&&(v(!0),b())},[l.current,x]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function Z(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},a.isEditing()&&e.imgSrc||"default-key")}function p(e){var S,s,m,x,v,b,d;function l(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...l()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((m=(s=e.builderBlock)==null?void 0:s.children)!=null&&m.length))?t.jsx(t.Fragment,{children:t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(v=(x=e.builderBlock)==null?void 0:x.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(d=(b=e.builderBlock)==null?void 0:b.children)!=null&&d.length&&!e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const ee=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function te(e){var I,P,T,F,B,N,L;const l=r.useRef(null),[g,S]=r.useState(()=>0);r.useState(()=>!0);function s(n){var c,o;const i={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(o=(c=e.builderContextSignal).rootSetState)==null||o.call(c,i):e.builderContextSignal.rootState=i}function m(n){var c,o,u,h,W;const i={...e.builderContextSignal.content,...n,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...n==null?void 0:n.data},meta:{...(o=e.builderContextSignal.content)==null?void 0:o.meta,...n==null?void 0:n.meta,breakpoints:((u=n==null?void 0:n.meta)==null?void 0:u.breakpoints)||((W=(h=e.builderContextSignal.content)==null?void 0:h.meta)==null?void 0:W.breakpoints)}};M.postPreviewContent({value:i,key:i.id}).then(()=>{z.refresh()})}r.useState(()=>0);const[x,v]=r.useState(()=>!1),[b,d]=r.useState(()=>e.contentWrapper||"div");function f(n){var c;if(!a.isFromTrustedHost(e.trustedHosts,n))return;const{data:i}=n;if(i)switch(i.type){case"builder.configureSdk":{const o=i.data,{breakpoints:u,contentId:h}=o;if(!h||h!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&m({meta:{breakpoints:u}}),S(g+1);break}case"builder.contentUpdate":{const o=i.data,u=o.key||o.alias||o.entry||o.modelName,h=o.data;u===e.model&&(m(h),S(g+1));break}}}function y(){var i,c;const n=(c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.jsCode;n&&a.evaluate({code:n,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[k,ne]=r.useState(()=>({})),[E,K]=r.useState(()=>!1);function q(n){var i,c;if(e.builderContextSignal.content){const o=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;a._track({type:"click",canTrack:a.getDefaultCanTrack(e.canTrack),contentId:u,apiKey:e.apiKey,variationId:o!==u?o:void 0,...a.getInteractionPropertiesForEvent(n),unique:!E})}E||K(!0)}function A(n){return n.replace(/{{([^}]+)}}/g,(i,c)=>a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function _({url:n,key:i}){a.fetch(n).then(c=>c.json()).then(c=>{var u,h;const o={...e.builderContextSignal.rootState,[i]:c};(h=(u=e.builderContextSignal).rootSetState)==null||h.call(u,o),k[i]=!0}).catch(c=>{console.error("error fetching dynamic data",n,c)})}function j(){var i,c;const n=((c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.httpRequests)??{};Object.entries(n).forEach(([o,u])=>{if(u&&(!k[o]||a.isEditing())){const h=A(u);_({url:h,key:o})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(n){S(g+1),window.addEventListener("message",f),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var o;const c=a.createRegisterComponentMessage(i);(o=window.parent)==null||o.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function R(n){const i=new URL(location.href).searchParams,c=i.get("builder.preview"),o=i.get(`builder.preview.${c}`),u=i.get("apiKey")||i.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||o===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(h=>{h&&m(h)})}const z=D.useRouter();return r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",w),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initeditingbldr",w)}},[]),r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",R),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initpreviewingbldr",R)}},[]),r.useEffect(()=>{var n,i;if(a.isBrowser()){if(a.isEditing()&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const o=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,u=(i=e.builderContextSignal.content)==null?void 0:i.id,h=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:h,variationId:o!==u?o:void 0})}a.isPreviewing()&&l.current}},[]),r.useEffect(()=>{e.apiKey||a.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),y(),j(),C()},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.addEventListener("message",f))},[x]),r.useEffect(()=>{y()},[(P=(I=e.builderContextSignal.content)==null?void 0:I.data)==null?void 0:P.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(F=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:F.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&s(e.data)},[e.data]),r.useEffect(()=>{e.locale&&s({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(ee.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:r.createElement(b,{key:g,ref:l,onClick:n=>q(n),"builder-content-id":(B=e.builderContextSignal.content)==null?void 0:B.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((N=e.content)==null?void 0:N.testVariationId)||((L=e.content)==null?void 0:L.id)}`},e.children)}):null})}exports.BlockWrapper=U;exports.BlocksWrapper
|
|
21
|
+
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]);return r.useEffect(()=>{var v;if(!((v=l.current)!=null&&v.getElementsByTagName)||typeof window>"u")return;const x=l.current.getElementsByTagName("script");for(let b=0;b<x.length;b++){const d=x[b];if(d.src){if(g.includes(d.src))continue;g.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(s.includes(d.innerText))continue;try{s.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function Y(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]),[x,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const d=l.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const y=d[f];if(y.src&&!g.includes(y.src)){g.push(y.src);const k=document.createElement("script");k.async=!0,k.src=y.src,document.head.appendChild(k)}else if(a.isJsScript(y)&&!s.includes(y.innerText))try{s.push(y.innerText),new Function(y.innerText)()}catch(k){console.warn("`Embed`: Error running script:",k)}}}return r.useEffect(()=>{l.current&&!x&&(v(!0),b())},[l.current,x]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function Z(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},a.isEditing()&&e.imgSrc||"default-key")}function p(e){var S,s,m,x,v,b,d;function l(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...l()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((m=(s=e.builderBlock)==null?void 0:s.children)!=null&&m.length))?t.jsx(t.Fragment,{children:t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(v=(x=e.builderBlock)==null?void 0:x.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(d=(b=e.builderBlock)==null?void 0:b.children)!=null&&d.length&&!e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const ee=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function te(e){var I,P,T,F,B,N,L;const l=r.useRef(null),[g,S]=r.useState(()=>0);r.useState(()=>!0);function s(n){var c,o;const i={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(o=(c=e.builderContextSignal).rootSetState)==null||o.call(c,i):e.builderContextSignal.rootState=i}function m(n){var c,o,u,h,W;const i={...e.builderContextSignal.content,...n,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...n==null?void 0:n.data},meta:{...(o=e.builderContextSignal.content)==null?void 0:o.meta,...n==null?void 0:n.meta,breakpoints:((u=n==null?void 0:n.meta)==null?void 0:u.breakpoints)||((W=(h=e.builderContextSignal.content)==null?void 0:h.meta)==null?void 0:W.breakpoints)}};M.postPreviewContent({value:i,key:i.id}).then(()=>{z.refresh()})}r.useState(()=>0);const[x,v]=r.useState(()=>!1),[b,d]=r.useState(()=>e.contentWrapper||"div");function f(n){var c;if(!a.isFromTrustedHost(e.trustedHosts,n))return;const{data:i}=n;if(i)switch(i.type){case"builder.configureSdk":{const o=i.data,{breakpoints:u,contentId:h}=o;if(!h||h!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&m({meta:{breakpoints:u}}),S(g+1);break}case"builder.contentUpdate":{const o=i.data,u=o.key||o.alias||o.entry||o.modelName,h=o.data;u===e.model&&(m(h),S(g+1));break}}}function y(){var i,c;const n=(c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.jsCode;n&&a.evaluate({code:n,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[k,ne]=r.useState(()=>({})),[E,K]=r.useState(()=>!1);function q(n){var i,c;if(e.builderContextSignal.content){const o=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;a._track({type:"click",canTrack:a.getDefaultCanTrack(e.canTrack),contentId:u,apiKey:e.apiKey,variationId:o!==u?o:void 0,...a.getInteractionPropertiesForEvent(n),unique:!E})}E||K(!0)}function A(n){return n.replace(/{{([^}]+)}}/g,(i,c)=>a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function _({url:n,key:i}){a.fetch(n).then(c=>c.json()).then(c=>{var u,h;const o={...e.builderContextSignal.rootState,[i]:c};(h=(u=e.builderContextSignal).rootSetState)==null||h.call(u,o),k[i]=!0}).catch(c=>{console.error("error fetching dynamic data",n,c)})}function j(){var i,c;const n=((c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.httpRequests)??{};Object.entries(n).forEach(([o,u])=>{if(u&&(!k[o]||a.isEditing())){const h=A(u);_({url:h,key:o})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(n){S(g+1),window.addEventListener("message",f),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var o;const c=a.createRegisterComponentMessage(i);(o=window.parent)==null||o.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function R(n){const i=new URL(location.href).searchParams,c=i.get("builder.preview"),o=i.get(`builder.preview.${c}`),u=i.get("apiKey")||i.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||o===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(h=>{h&&m(h)})}const z=D.useRouter();return r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",w),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initeditingbldr",w)}},[]),r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",R),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initpreviewingbldr",R)}},[]),r.useEffect(()=>{var n,i;if(a.isBrowser()){if(a.isEditing()&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const o=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,u=(i=e.builderContextSignal.content)==null?void 0:i.id,h=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:h,variationId:o!==u?o:void 0})}a.isPreviewing()&&l.current}},[]),r.useEffect(()=>{e.apiKey||a.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),y(),j(),C()},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.addEventListener("message",f))},[x]),r.useEffect(()=>{y()},[(P=(I=e.builderContextSignal.content)==null?void 0:I.data)==null?void 0:P.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(F=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:F.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&s(e.data)},[e.data]),r.useEffect(()=>{e.locale&&s({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(ee.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:r.createElement(b,{key:g,ref:l,onClick:n=>q(n),"builder-content-id":(B=e.builderContextSignal.content)==null?void 0:B.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((N=e.content)==null?void 0:N.testVariationId)||((L=e.content)==null?void 0:L.id)}`},e.children)}):null})}exports.BlockWrapper=U;exports.BlocksWrapper=$;exports.Button=V;exports.CustomCode=X;exports.Embed=Y;exports.EnableEditor=te;exports.FragmentComponent=J;exports.Image=G;exports.ImgComponent=Z;exports.InteractiveElement=O;exports.SectionComponent=Q;exports.Video=p;
|
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { i as Y, g as U, a as O, b as
|
|
2
|
+
import { jsx as t, Fragment as s, jsxs as E } from "react/jsx-runtime";
|
|
3
|
+
import { i as Y, g as U, a as O, b as w, c as R, d as Z, e as P, f as H, _ as V, h as p, l as ee, j as te, k as D, m as ne, n as ie, r as ae, s as ce, o as re, p as le, q as oe } from "./bundle-f3e8cd29.js";
|
|
4
4
|
import { useRef as T, useState as x, useEffect as f, createContext as de, createElement as se } from "react";
|
|
5
|
-
import { p as ue } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as ue } from "./USE_SERVER_BUNDLE-d6bec4ec.js";
|
|
6
6
|
import { useRouter as me } from "next/navigation";
|
|
7
7
|
function ke(e) {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/* @__PURE__ */ t("style", { children: `.button-fdf49de0 {
|
|
28
|
-
all: unset;
|
|
29
|
-
}` })
|
|
30
|
-
] });
|
|
8
|
+
return /* @__PURE__ */ t(s, { children: e.link ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
9
|
+
"a",
|
|
10
|
+
{
|
|
11
|
+
...e.attributes,
|
|
12
|
+
href: e.link,
|
|
13
|
+
target: e.openLinkInNewTab ? "_blank" : void 0,
|
|
14
|
+
role: "button",
|
|
15
|
+
children: e.text
|
|
16
|
+
}
|
|
17
|
+
) }) : /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
role: "button",
|
|
21
|
+
...e.attributes,
|
|
22
|
+
className: `builder-button ${e.attributes.className}`,
|
|
23
|
+
style: e.attributes.style,
|
|
24
|
+
children: e.text
|
|
25
|
+
}
|
|
26
|
+
) }) });
|
|
31
27
|
}
|
|
32
28
|
function ge(e) {
|
|
33
29
|
return /* @__PURE__ */ t(s, { children: Y(e.TagName) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ t(s, { children: typeof e.TagName == "string" ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
|
|
@@ -77,12 +73,12 @@ function we(e) {
|
|
|
77
73
|
}
|
|
78
74
|
function Ee(e) {
|
|
79
75
|
function c() {
|
|
80
|
-
var
|
|
81
|
-
return "builder-blocks" + ((
|
|
76
|
+
var l;
|
|
77
|
+
return "builder-blocks" + ((l = e.blocks) != null && l.length ? "" : " no-blocks");
|
|
82
78
|
}
|
|
83
79
|
function u() {
|
|
84
|
-
var
|
|
85
|
-
|
|
80
|
+
var l, m;
|
|
81
|
+
w() && !((l = e.blocks) != null && l.length) && ((m = window.parent) == null || m.postMessage(
|
|
86
82
|
{
|
|
87
83
|
type: "builder.clickEmptyBlocks",
|
|
88
84
|
data: {
|
|
@@ -94,8 +90,8 @@ function Ee(e) {
|
|
|
94
90
|
));
|
|
95
91
|
}
|
|
96
92
|
function v() {
|
|
97
|
-
var
|
|
98
|
-
|
|
93
|
+
var l, m;
|
|
94
|
+
w() && !((l = e.blocks) != null && l.length) && ((m = window.parent) == null || m.postMessage(
|
|
99
95
|
{
|
|
100
96
|
type: "builder.hoverEmptyBlocks",
|
|
101
97
|
data: {
|
|
@@ -106,7 +102,7 @@ function Ee(e) {
|
|
|
106
102
|
"*"
|
|
107
103
|
));
|
|
108
104
|
}
|
|
109
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ E(s, { children: [
|
|
110
106
|
/* @__PURE__ */ t(
|
|
111
107
|
e.BlocksWrapper,
|
|
112
108
|
{
|
|
@@ -114,9 +110,9 @@ function Ee(e) {
|
|
|
114
110
|
"builder-path": e.path,
|
|
115
111
|
"builder-parent-id": e.parent,
|
|
116
112
|
style: e.styleProp,
|
|
117
|
-
onClick: (
|
|
118
|
-
onMouseEnter: (
|
|
119
|
-
onKeyPress: (
|
|
113
|
+
onClick: (l) => u(),
|
|
114
|
+
onMouseEnter: (l) => v(),
|
|
115
|
+
onKeyPress: (l) => u(),
|
|
120
116
|
...e.BlocksWrapperProps,
|
|
121
117
|
children: e.children
|
|
122
118
|
}
|
|
@@ -132,7 +128,7 @@ function Ie(e) {
|
|
|
132
128
|
return /* @__PURE__ */ t("span", { children: e.children });
|
|
133
129
|
}
|
|
134
130
|
function Re(e) {
|
|
135
|
-
var
|
|
131
|
+
var l, m, S, y;
|
|
136
132
|
function c() {
|
|
137
133
|
var g;
|
|
138
134
|
const o = e.image || e.src;
|
|
@@ -161,9 +157,9 @@ function Re(e) {
|
|
|
161
157
|
};
|
|
162
158
|
return e.aspectRatio ? b : void 0;
|
|
163
159
|
}
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ E(s, { children: [
|
|
161
|
+
/* @__PURE__ */ E(s, { children: [
|
|
162
|
+
/* @__PURE__ */ E("picture", { children: [
|
|
167
163
|
u() ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t("source", { type: "image/webp", srcSet: u() }) }) : null,
|
|
168
164
|
/* @__PURE__ */ t(
|
|
169
165
|
"img",
|
|
@@ -183,7 +179,7 @@ function Re(e) {
|
|
|
183
179
|
}
|
|
184
180
|
)
|
|
185
181
|
] }),
|
|
186
|
-
e.aspectRatio && !((m = (
|
|
182
|
+
e.aspectRatio && !((m = (l = e.builderBlock) == null ? void 0 : l.children) != null && m.length && e.fitContent) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
187
183
|
"div",
|
|
188
184
|
{
|
|
189
185
|
className: "builder-image-sizer div-40c70c9b",
|
|
@@ -236,7 +232,7 @@ function Pe(e) {
|
|
|
236
232
|
);
|
|
237
233
|
}
|
|
238
234
|
function Te(e) {
|
|
239
|
-
const c = T(null), [u, v] = x(() => []), [
|
|
235
|
+
const c = T(null), [u, v] = x(() => []), [l, m] = x(() => []);
|
|
240
236
|
return f(() => {
|
|
241
237
|
var y;
|
|
242
238
|
if (!((y = c.current) != null && y.getElementsByTagName) || typeof window > "u")
|
|
@@ -255,10 +251,10 @@ function Te(e) {
|
|
|
255
251
|
"application/javascript",
|
|
256
252
|
"application/ecmascript"
|
|
257
253
|
].includes(o.type)) {
|
|
258
|
-
if (
|
|
254
|
+
if (l.includes(o.innerText))
|
|
259
255
|
continue;
|
|
260
256
|
try {
|
|
261
|
-
|
|
257
|
+
l.push(o.innerText), new Function(o.innerText)();
|
|
262
258
|
} catch (g) {
|
|
263
259
|
console.warn("`CustomCode`: Error running script:", g);
|
|
264
260
|
}
|
|
@@ -274,7 +270,7 @@ function Te(e) {
|
|
|
274
270
|
);
|
|
275
271
|
}
|
|
276
272
|
function Ne(e) {
|
|
277
|
-
const c = T(null), [u, v] = x(() => []), [
|
|
273
|
+
const c = T(null), [u, v] = x(() => []), [l, m] = x(() => []), [S, y] = x(() => !1);
|
|
278
274
|
function b() {
|
|
279
275
|
if (!c.current || !c.current.getElementsByTagName)
|
|
280
276
|
return;
|
|
@@ -285,9 +281,9 @@ function Ne(e) {
|
|
|
285
281
|
u.push(k.src);
|
|
286
282
|
const C = document.createElement("script");
|
|
287
283
|
C.async = !0, C.src = k.src, document.head.appendChild(C);
|
|
288
|
-
} else if (Z(k) && !
|
|
284
|
+
} else if (Z(k) && !l.includes(k.innerText))
|
|
289
285
|
try {
|
|
290
|
-
|
|
286
|
+
l.push(k.innerText), new Function(k.innerText)();
|
|
291
287
|
} catch (C) {
|
|
292
288
|
console.warn("`Embed`: Error running script:", C);
|
|
293
289
|
}
|
|
@@ -316,11 +312,11 @@ function Be(e) {
|
|
|
316
312
|
src: e.imgSrc || e.image,
|
|
317
313
|
...e.attributes
|
|
318
314
|
},
|
|
319
|
-
|
|
315
|
+
w() && e.imgSrc || "default-key"
|
|
320
316
|
);
|
|
321
317
|
}
|
|
322
318
|
function Le(e) {
|
|
323
|
-
var v,
|
|
319
|
+
var v, l, m, S, y, b, o;
|
|
324
320
|
function c() {
|
|
325
321
|
return {
|
|
326
322
|
...e.autoPlay === !0 ? {
|
|
@@ -345,7 +341,7 @@ function Le(e) {
|
|
|
345
341
|
...c()
|
|
346
342
|
};
|
|
347
343
|
}
|
|
348
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ E(
|
|
349
345
|
"div",
|
|
350
346
|
{
|
|
351
347
|
style: {
|
|
@@ -377,7 +373,7 @@ function Le(e) {
|
|
|
377
373
|
children: e.lazyLoad ? null : /* @__PURE__ */ t("source", { type: "video/mp4", src: e.video })
|
|
378
374
|
}
|
|
379
375
|
),
|
|
380
|
-
e.aspectRatio && !(e.fitContent && ((m = (
|
|
376
|
+
e.aspectRatio && !(e.fitContent && ((m = (l = e.builderBlock) == null ? void 0 : l.children) != null && m.length)) ? /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
381
377
|
"div",
|
|
382
378
|
{
|
|
383
379
|
style: {
|
|
@@ -438,16 +434,16 @@ function je(e) {
|
|
|
438
434
|
var W, F, K, z, A, M, _;
|
|
439
435
|
const c = T(null), [u, v] = x(() => 0);
|
|
440
436
|
x(() => !0);
|
|
441
|
-
function
|
|
442
|
-
var a,
|
|
437
|
+
function l(n) {
|
|
438
|
+
var a, r;
|
|
443
439
|
const i = {
|
|
444
440
|
...e.builderContextSignal.rootState,
|
|
445
441
|
...n
|
|
446
442
|
};
|
|
447
|
-
e.builderContextSignal.rootSetState ? (
|
|
443
|
+
e.builderContextSignal.rootSetState ? (r = (a = e.builderContextSignal).rootSetState) == null || r.call(a, i) : e.builderContextSignal.rootState = i;
|
|
448
444
|
}
|
|
449
445
|
function m(n) {
|
|
450
|
-
var a,
|
|
446
|
+
var a, r, d, h, q;
|
|
451
447
|
const i = {
|
|
452
448
|
...e.builderContextSignal.content,
|
|
453
449
|
...n,
|
|
@@ -456,7 +452,7 @@ function je(e) {
|
|
|
456
452
|
...n == null ? void 0 : n.data
|
|
457
453
|
},
|
|
458
454
|
meta: {
|
|
459
|
-
...(
|
|
455
|
+
...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
|
|
460
456
|
...n == null ? void 0 : n.meta,
|
|
461
457
|
breakpoints: ((d = n == null ? void 0 : n.meta) == null ? void 0 : d.breakpoints) || ((q = (h = e.builderContextSignal.content) == null ? void 0 : h.meta) == null ? void 0 : q.breakpoints)
|
|
462
458
|
}
|
|
@@ -482,7 +478,7 @@ function je(e) {
|
|
|
482
478
|
if (i)
|
|
483
479
|
switch (i.type) {
|
|
484
480
|
case "builder.configureSdk": {
|
|
485
|
-
const
|
|
481
|
+
const r = i.data, { breakpoints: d, contentId: h } = r;
|
|
486
482
|
if (!h || h !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id))
|
|
487
483
|
return;
|
|
488
484
|
d && m({
|
|
@@ -493,7 +489,7 @@ function je(e) {
|
|
|
493
489
|
break;
|
|
494
490
|
}
|
|
495
491
|
case "builder.contentUpdate": {
|
|
496
|
-
const
|
|
492
|
+
const r = i.data, d = r.key || r.alias || r.entry || r.modelName, h = r.data;
|
|
497
493
|
d === e.model && (m(h), v(u + 1));
|
|
498
494
|
break;
|
|
499
495
|
}
|
|
@@ -510,22 +506,22 @@ function je(e) {
|
|
|
510
506
|
rootSetState: e.builderContextSignal.rootSetState
|
|
511
507
|
});
|
|
512
508
|
}
|
|
513
|
-
const [C, be] = x(() => ({})), [N,
|
|
514
|
-
function
|
|
509
|
+
const [C, be] = x(() => ({})), [N, $] = x(() => !1);
|
|
510
|
+
function J(n) {
|
|
515
511
|
var i, a;
|
|
516
512
|
if (e.builderContextSignal.content) {
|
|
517
|
-
const
|
|
513
|
+
const r = (i = e.builderContextSignal.content) == null ? void 0 : i.testVariationId, d = (a = e.builderContextSignal.content) == null ? void 0 : a.id;
|
|
518
514
|
V({
|
|
519
515
|
type: "click",
|
|
520
516
|
canTrack: H(e.canTrack),
|
|
521
517
|
contentId: d,
|
|
522
518
|
apiKey: e.apiKey,
|
|
523
|
-
variationId:
|
|
519
|
+
variationId: r !== d ? r : void 0,
|
|
524
520
|
...ne(n),
|
|
525
521
|
unique: !N
|
|
526
522
|
});
|
|
527
523
|
}
|
|
528
|
-
N ||
|
|
524
|
+
N || $(!0);
|
|
529
525
|
}
|
|
530
526
|
function G(n) {
|
|
531
527
|
return n.replace(
|
|
@@ -542,11 +538,11 @@ function je(e) {
|
|
|
542
538
|
function Q({ url: n, key: i }) {
|
|
543
539
|
oe(n).then((a) => a.json()).then((a) => {
|
|
544
540
|
var d, h;
|
|
545
|
-
const
|
|
541
|
+
const r = {
|
|
546
542
|
...e.builderContextSignal.rootState,
|
|
547
543
|
[i]: a
|
|
548
544
|
};
|
|
549
|
-
(h = (d = e.builderContextSignal).rootSetState) == null || h.call(d,
|
|
545
|
+
(h = (d = e.builderContextSignal).rootSetState) == null || h.call(d, r), C[i] = !0;
|
|
550
546
|
}).catch((a) => {
|
|
551
547
|
console.error("error fetching dynamic data", n, a);
|
|
552
548
|
});
|
|
@@ -554,18 +550,18 @@ function je(e) {
|
|
|
554
550
|
function B() {
|
|
555
551
|
var i, a;
|
|
556
552
|
const n = ((a = (i = e.builderContextSignal.content) == null ? void 0 : i.data) == null ? void 0 : a.httpRequests) ?? {};
|
|
557
|
-
Object.entries(n).forEach(([
|
|
558
|
-
if (d && (!C[
|
|
553
|
+
Object.entries(n).forEach(([r, d]) => {
|
|
554
|
+
if (d && (!C[r] || w())) {
|
|
559
555
|
const h = G(d);
|
|
560
556
|
Q({
|
|
561
557
|
url: h,
|
|
562
|
-
key:
|
|
558
|
+
key: r
|
|
563
559
|
});
|
|
564
560
|
}
|
|
565
561
|
});
|
|
566
562
|
}
|
|
567
563
|
function I() {
|
|
568
|
-
|
|
564
|
+
w() && window.dispatchEvent(
|
|
569
565
|
new CustomEvent(
|
|
570
566
|
"builder:component:stateChange",
|
|
571
567
|
{
|
|
@@ -596,19 +592,19 @@ function je(e) {
|
|
|
596
592
|
}), Object.values(
|
|
597
593
|
e.builderContextSignal.componentInfos
|
|
598
594
|
).forEach((i) => {
|
|
599
|
-
var
|
|
600
|
-
const a =
|
|
601
|
-
(
|
|
595
|
+
var r;
|
|
596
|
+
const a = re(i);
|
|
597
|
+
(r = window.parent) == null || r.postMessage(a, "*");
|
|
602
598
|
}), window.addEventListener(
|
|
603
599
|
"builder:component:stateChangeListenerActivated",
|
|
604
600
|
I
|
|
605
601
|
);
|
|
606
602
|
}
|
|
607
603
|
function j(n) {
|
|
608
|
-
const i = new URL(location.href).searchParams, a = i.get("builder.preview"),
|
|
604
|
+
const i = new URL(location.href).searchParams, a = i.get("builder.preview"), r = i.get(
|
|
609
605
|
`builder.preview.${a}`
|
|
610
606
|
), d = i.get("apiKey") || i.get("builder.space");
|
|
611
|
-
a === e.model && d === e.apiKey && (!e.content ||
|
|
607
|
+
a === e.model && d === e.apiKey && (!e.content || r === e.content.id) && le({
|
|
612
608
|
model: e.model,
|
|
613
609
|
apiKey: e.apiKey,
|
|
614
610
|
apiVersion: e.builderContextSignal.apiVersion
|
|
@@ -644,14 +640,14 @@ function je(e) {
|
|
|
644
640
|
}, []), f(() => {
|
|
645
641
|
var n, i;
|
|
646
642
|
if (P()) {
|
|
647
|
-
if (
|
|
648
|
-
const
|
|
643
|
+
if (w() && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && H(e.canTrack)) {
|
|
644
|
+
const r = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, d = (i = e.builderContextSignal.content) == null ? void 0 : i.id, h = e.apiKey;
|
|
649
645
|
V({
|
|
650
646
|
type: "impression",
|
|
651
647
|
canTrack: !0,
|
|
652
648
|
contentId: d,
|
|
653
649
|
apiKey: h,
|
|
654
|
-
variationId:
|
|
650
|
+
variationId: r !== d ? r : void 0
|
|
655
651
|
});
|
|
656
652
|
}
|
|
657
653
|
p() && c.current;
|
|
@@ -673,9 +669,9 @@ function je(e) {
|
|
|
673
669
|
}, [(z = (K = e.builderContextSignal.content) == null ? void 0 : K.data) == null ? void 0 : z.httpRequests]), f(() => {
|
|
674
670
|
I();
|
|
675
671
|
}, [e.builderContextSignal.rootState]), f(() => {
|
|
676
|
-
e.data &&
|
|
672
|
+
e.data && l(e.data);
|
|
677
673
|
}, [e.data]), f(() => {
|
|
678
|
-
e.locale &&
|
|
674
|
+
e.locale && l({
|
|
679
675
|
locale: e.locale
|
|
680
676
|
});
|
|
681
677
|
}, [e.locale]), f(() => () => {
|
|
@@ -688,7 +684,7 @@ function je(e) {
|
|
|
688
684
|
{
|
|
689
685
|
key: u,
|
|
690
686
|
ref: c,
|
|
691
|
-
onClick: (n) =>
|
|
687
|
+
onClick: (n) => J(n),
|
|
692
688
|
"builder-content-id": (A = e.builderContextSignal.content) == null ? void 0 : A.id,
|
|
693
689
|
"builder-model": e.model,
|
|
694
690
|
...e.showContent ? {} : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-50ff23eb.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Oe=require("lru-cache"),s=require("react/jsx-runtime"),Ne=require("react"),v=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";const Oe=require("lru-cache"),s=require("react/jsx-runtime"),Ne=require("react"),v=require("./USE_CLIENT_BUNDLE-64b6ec10.cjs");require("next/navigation");function _e(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const B="[Builder.io]: ",k={log:(...e)=>console.log(B,...e),error:(...e)=>console.error(B,...e),warn:(...e)=>console.warn(B,...e),debug:(...e)=>console.debug(B,...e)};function x(){return typeof window<"u"&&typeof document<"u"}const I="rsc";function Le(){return x()&&window.self!==window.top}function $(){return Le()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const Ue=()=>{if(x()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Me=()=>typeof navigator=="object"&&navigator.userAgent||"",le=()=>{const e=Me(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),o=Ue();return{urlPath:o==null?void 0:o.pathname,host:(o==null?void 0:o.host)||(o==null?void 0:o.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},De=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),He=()=>({isEditing:$(),isBrowser:x(),isServer:!x(),getUserAttributes:()=>le()}),Ke=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,J=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const c=De({builder:t,context:n,event:o,state:qe(a,i,r)});return new Function(...c.map(([l])=>l),e)(...c.map(([,l])=>l))};function qe(e,t,n){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(o,i)=>t&&i in t?t[i]:e[i],set:(o,i,r)=>{if(t&&i in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[i]=r,n==null||n(e),!0}})}const ze=e=>(x(),J(e));function O({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0}){if(e===""){k.warn("Skipping evaluation of empty code block.");return}const c={code:Ke(e,{isExpression:a}),builder:He(),context:t,event:r,rootSetState:i,rootState:o,localState:n};try{return ze(c)}catch(l){k.error("Failed code evaluation: "+l.message,{code:e});return}}const R=e=>JSON.parse(JSON.stringify(e)),Ge=(e,t,n)=>{if(Object(e)!==e)return e;const o=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return o.slice(0,-1).reduce((i,r,a)=>Object(i[r])===i[r]?i[r]:i[r]=Math.abs(Number(o[a+1]))>>0===+o[a+1]?[]:{},e)[o[o.length-1]]=n,e};const Je=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=R(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const c in e.bindings){const l=e.bindings[c],u=O({code:l,localState:n,rootState:o,rootSetState:i,context:t});Ge(a,c,u)}return a};function W({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?Je({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const Ye=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=W({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!o)return null;const i=n[o];if(i)return i;console.warn(`
|
|
2
2
|
Could not find a registered component named "${o}".
|
|
3
3
|
If you registered it, is the file that registered it imported by the file that needs to render it?`)},Qe=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=O({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(i))return;const r=n.collection.split(".").pop(),a=n.itemName||(r?r+"Item":"item");return i.map((l,u)=>({context:{...t,localState:{...t.localState,$index:u,$item:l,[a]:l,[`$${a}Index`]:u}},block:o}))},de={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},Y=(e,t=de)=>`@media (max-width: ${t[e].max}px)`,ue=({small:e,medium:t})=>{const n=R(de);if(!e||!t)return n;const o=Math.floor(e/2);n.small={max:e,min:o,default:o+1};const i=n.small.max+1;n.medium={max:t,min:i,default:i+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n},Xe=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=e=>e!=null,me=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${Xe(n)}: ${o};`}).filter(w),Ze=e=>me(e).join(`
|
|
4
4
|
`),U=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
)`,Yt=({contentId:e,variationId:t})=>`window.${Ce}(
|
|
136
136
|
"${t}", "${e}", ${we}
|
|
137
137
|
)`;function D(e){return s.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const Qt=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||k.warn("No previewed ID found in search params."),n};function Ie(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Oe.LRUCache({max:500,ttl:1e3*60*5}))}function Xt(e){Ie();const t=Qt(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function Zt(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function en(){const e=Zt().fetch;if(typeof e>"u")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
138
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Te=en();function j(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...j(r,a,n)}:{...o,[a]:r}},{})}const tn="v3",te="builder.",nn="options.",on=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},K=e=>{if(!e)return{};const t=Ee(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(te)){const i=o.replace(te,"").replace(nn,"");n[i]=t[o]}}),n},rn=()=>{if(!x())return{};const e=new URLSearchParams(window.location.search);return K(e)},Ee=e=>e instanceof URLSearchParams?on(e):e,ne=e=>typeof e=="number"&&!isNaN(e)&&e>=0,q=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:c=!0,enrich:l,locale:u,apiVersion:p=tn,fields:g,omit:m,offset:h,cacheSeconds:f,staleCacheSeconds:d,sort:b,includeUnpublished:S}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(p))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${p}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const y=new URL(`https://cdn.builder.io/api/${p}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u?`&locale=${u}`:""}${l?`&enrich=${l}`:""}`);if(y.searchParams.set("omit",m||"meta.componentsUsed"),g&&y.searchParams.set("fields",g),Number.isFinite(h)&&h>-1&&y.searchParams.set("offset",String(Math.floor(h))),typeof S=="boolean"&&y.searchParams.set("includeUnpublished",String(S)),f&&ne(f)&&y.searchParams.set("cacheSeconds",String(f)),d&&ne(d)&&y.searchParams.set("staleCacheSeconds",String(d)),b){const C=j({sort:b});for(const E in C)y.searchParams.set(E,JSON.stringify(C[E]))}const A={...rn(),...Ee(e.options||{})},T=j(A);for(const C in T)y.searchParams.set(C,String(T[C]));if(o&&y.searchParams.set("userAttributes",JSON.stringify(o)),i){const C=j({query:i});for(const E in C)y.searchParams.set(E,JSON.stringify(C[E]))}return y},an=e=>"results"in e;async function L(e){const t=await z({...e,limit:1});return t&&t[0]||null}const sn=L,cn=async e=>{const t=q(e);return await(await Te(t.href)).json()},Re=async(e,t,n=q(e))=>{const o=F(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const c=Xt(n.searchParams);r.push(c||a)}t.results=r}if(!o||!(x()||I==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await It({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t.results};async function z(e){try{const t=q(e),n=await cn(e);return an(n)?Re(e,n):(k.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return k.error("Error fetching data. ",t),null}}const ln=z,dn=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Pe(e,t){const n=new URL(t.origin),o=n.hostname;return(e||dn).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}function un(){return!x()||$()?!1:location.search.indexOf("builder.preview=")!==-1}function mn(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function Ae(){return mn().replace(/-/g,"")}const Be="builderSessionId",fn=async({canTrack:e})=>{if(!e)return;const t=await pe({name:Be,canTrack:e});if(w(t))return t;{const n=hn();return gn({id:n,canTrack:e}),n}},hn=()=>Ae(),gn=({id:e,canTrack:t})=>be({name:Be,value:e,canTrack:t}),Ve=()=>x()&&typeof localStorage<"u"?localStorage:void 0,pn=({key:e,canTrack:t})=>{var n;try{return t?(n=Ve())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},bn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Ve())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},je="builderVisitorId",yn=({canTrack:e})=>{if(!e)return;const t=pn({key:je,canTrack:e});if(w(t))return t;{const n=xn();return Sn({id:n,canTrack:e}),n}},xn=()=>Ae(),Sn=({id:e,canTrack:t})=>bn({key:je,value:e,canTrack:t}),vn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await fn({canTrack:e}),n=yn({canTrack:e});return{sessionId:t,visitorId:n}},kn=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await vn({canTrack:t}),userAttributes:le(),ownerId:n}});async function We(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!$()&&(x()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await kn(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const Cn=e=>We({...e,canTrack:!0});function oe(e){return Math.round(e*1e3)/1e3}const wn=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},In=e=>wn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ie=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=oe(o/n.width),a=oe(i/n.height);return{x:r,y:a}},Tn=e=>{const t=e.target,n=t&&In(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?ie({event:e,target:t}):void 0,builderTargetOffset:n?ie({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},En="0.12.
|
|
138
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Te=en();function j(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...j(r,a,n)}:{...o,[a]:r}},{})}const tn="v3",te="builder.",nn="options.",on=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},K=e=>{if(!e)return{};const t=Ee(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(te)){const i=o.replace(te,"").replace(nn,"");n[i]=t[o]}}),n},rn=()=>{if(!x())return{};const e=new URLSearchParams(window.location.search);return K(e)},Ee=e=>e instanceof URLSearchParams?on(e):e,ne=e=>typeof e=="number"&&!isNaN(e)&&e>=0,q=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:c=!0,enrich:l,locale:u,apiVersion:p=tn,fields:g,omit:m,offset:h,cacheSeconds:f,staleCacheSeconds:d,sort:b,includeUnpublished:S}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(p))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${p}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const y=new URL(`https://cdn.builder.io/api/${p}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u?`&locale=${u}`:""}${l?`&enrich=${l}`:""}`);if(y.searchParams.set("omit",m||"meta.componentsUsed"),g&&y.searchParams.set("fields",g),Number.isFinite(h)&&h>-1&&y.searchParams.set("offset",String(Math.floor(h))),typeof S=="boolean"&&y.searchParams.set("includeUnpublished",String(S)),f&&ne(f)&&y.searchParams.set("cacheSeconds",String(f)),d&&ne(d)&&y.searchParams.set("staleCacheSeconds",String(d)),b){const C=j({sort:b});for(const E in C)y.searchParams.set(E,JSON.stringify(C[E]))}const A={...rn(),...Ee(e.options||{})},T=j(A);for(const C in T)y.searchParams.set(C,String(T[C]));if(o&&y.searchParams.set("userAttributes",JSON.stringify(o)),i){const C=j({query:i});for(const E in C)y.searchParams.set(E,JSON.stringify(C[E]))}return y},an=e=>"results"in e;async function L(e){const t=await z({...e,limit:1});return t&&t[0]||null}const sn=L,cn=async e=>{const t=q(e);return await(await Te(t.href)).json()},Re=async(e,t,n=q(e))=>{const o=F(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const c=Xt(n.searchParams);r.push(c||a)}t.results=r}if(!o||!(x()||I==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await It({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t.results};async function z(e){try{const t=q(e),n=await cn(e);return an(n)?Re(e,n):(k.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return k.error("Error fetching data. ",t),null}}const ln=z,dn=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Pe(e,t){const n=new URL(t.origin),o=n.hostname;return(e||dn).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}function un(){return!x()||$()?!1:location.search.indexOf("builder.preview=")!==-1}function mn(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function Ae(){return mn().replace(/-/g,"")}const Be="builderSessionId",fn=async({canTrack:e})=>{if(!e)return;const t=await pe({name:Be,canTrack:e});if(w(t))return t;{const n=hn();return gn({id:n,canTrack:e}),n}},hn=()=>Ae(),gn=({id:e,canTrack:t})=>be({name:Be,value:e,canTrack:t}),Ve=()=>x()&&typeof localStorage<"u"?localStorage:void 0,pn=({key:e,canTrack:t})=>{var n;try{return t?(n=Ve())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},bn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Ve())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},je="builderVisitorId",yn=({canTrack:e})=>{if(!e)return;const t=pn({key:je,canTrack:e});if(w(t))return t;{const n=xn();return Sn({id:n,canTrack:e}),n}},xn=()=>Ae(),Sn=({id:e,canTrack:t})=>bn({key:je,value:e,canTrack:t}),vn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await fn({canTrack:e}),n=yn({canTrack:e});return{sessionId:t,visitorId:n}},kn=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await vn({canTrack:t}),userAttributes:le(),ownerId:n}});async function We(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!$()&&(x()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await kn(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const Cn=e=>We({...e,canTrack:!0});function oe(e){return Math.round(e*1e3)/1e3}const wn=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},In=e=>wn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ie=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=oe(o/n.width),a=oe(i/n.height);return{x:r,y:a}},Tn=e=>{const t=e.target,n=t&&In(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?ie({event:e,target:t}):void 0,builderTargetOffset:n?ie({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},En="0.12.3",re={};function Fe(e,t){let n=re[e];if(n||(n=re[e]=[]),n.push(t),x()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(i){console.debug("Could not postmessage",i)}}}const Rn=()=>{Fe("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 ae=!1;const Pn=(e={})=>{var t,n;ae||(ae=!0,x()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:En,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var r,a;if(!Pe(e.trustedHosts,o))return;const{data:i}=o;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const c=i.data.text,l=i.data.arguments||[],u=i.data.id,p=new Function(c);let g,m=null;try{g=p.apply(null,l)}catch(h){m=h}m?(r=window.parent)==null||r.postMessage({type:"builder.evaluateError",data:{id:u,error:m.message}},"*"):g&&typeof g.then=="function"?g.then(h=>{var f;(f=window.parent)==null||f.postMessage({type:"builder.evaluateResult",data:{id:u,result:h}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:g,id:u}},"*");break}}})))},An=e=>{var r;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((r=e==null?void 0:e.files)==null?void 0:r.regular);let i="";if(o&&t&&n&&(i+=`
|
|
139
139
|
@font-face {
|
|
140
140
|
font-family: "${t}";
|
|
141
141
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -153,6 +153,10 @@ font-weight: ${a};
|
|
|
153
153
|
${Vn({cssCode:e.cssCode,contentId:e.contentId})}
|
|
154
154
|
${Bn({customFonts:e.customFonts})}
|
|
155
155
|
|
|
156
|
+
.builder-button {
|
|
157
|
+
all: unset;
|
|
158
|
+
}
|
|
159
|
+
|
|
156
160
|
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
157
161
|
margin: 0;
|
|
158
162
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache as Re } from "lru-cache";
|
|
2
2
|
import { jsx as l, Fragment as S, jsxs as T } from "react/jsx-runtime";
|
|
3
3
|
import { createElement as Ae } from "react";
|
|
4
|
-
import { I as Pe, B as Ve, a as Be, b as We, C as $e, E as Oe, F as Fe, c as Ne, d as _e, S as Le, V as Ue, e as Me } from "./USE_CLIENT_BUNDLE-
|
|
4
|
+
import { I as Pe, B as Ve, a as Be, b as We, C as $e, E as Oe, F as Fe, c as Ne, d as _e, S as Le, V as Ue, e as Me } from "./USE_CLIENT_BUNDLE-e89d3175.js";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
function De(e) {
|
|
7
7
|
var t;
|
|
@@ -2058,7 +2058,7 @@ const Tn = (e, t, n = !0) => {
|
|
|
2058
2058
|
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
2059
2059
|
}
|
|
2060
2060
|
};
|
|
2061
|
-
}, Rn = "0.12.
|
|
2061
|
+
}, Rn = "0.12.3", oe = {};
|
|
2062
2062
|
function An(e, t) {
|
|
2063
2063
|
let n = oe[e];
|
|
2064
2064
|
if (n || (n = oe[e] = []), n.push(t), v()) {
|
|
@@ -2206,6 +2206,10 @@ ${Vn({
|
|
|
2206
2206
|
customFonts: e.customFonts
|
|
2207
2207
|
})}
|
|
2208
2208
|
|
|
2209
|
+
.builder-button {
|
|
2210
|
+
all: unset;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2209
2213
|
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
2210
2214
|
margin: 0;
|
|
2211
2215
|
}
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-50ff23eb.cjs"),t=require("./USE_CLIENT_BUNDLE-64b6ec10.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-f34c0814.cjs");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, v as m, C as c, R as g, u as p, S as l, T as C, y as d, o as u, G as B, z as S, p as f, A as h, E, D as R, b as x, h as b, w as k, x as y, F } from "./bundle-
|
|
2
|
-
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, v as m, C as c, R as g, u as p, S as l, T as C, y as d, o as u, G as B, z as S, p as f, A as h, E, D as R, b as x, h as b, w as k, x as y, F } from "./bundle-f3e8cd29.js";
|
|
2
|
+
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-e89d3175.js";
|
|
3
3
|
import "lru-cache";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "next/navigation";
|
|
7
|
-
import "./USE_SERVER_BUNDLE-
|
|
7
|
+
import "./USE_SERVER_BUNDLE-d6bec4ec.js";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
v as Button,
|