@builder.io/sdk-react-nextjs 0.6.4 → 0.7.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.
- package/lib/browser/USE_CLIENT_BUNDLE-3a41b1ba.js +23 -0
- package/lib/{node/USE_CLIENT_BUNDLE-f8df6014.mjs → browser/USE_CLIENT_BUNDLE-fc8c1bc0.mjs} +177 -179
- package/lib/{edge/USE_SERVER_BUNDLE-079fd7e9.mjs → browser/USE_SERVER_BUNDLE-226a15ac.mjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-5955a553.js → browser/USE_SERVER_BUNDLE-d8c698c8.js} +1 -1
- package/lib/browser/{bundle-e116a057.js → bundle-0fae602b.js} +8 -8
- package/lib/browser/{bundle-6ca5e123.mjs → bundle-3b073b16.mjs} +24 -20
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +7 -7
- package/lib/{browser/USE_CLIENT_BUNDLE-f8df6014.mjs → edge/USE_CLIENT_BUNDLE-0e9f8e67.mjs} +177 -179
- package/lib/edge/USE_CLIENT_BUNDLE-d48583e8.js +23 -0
- package/lib/{node/USE_SERVER_BUNDLE-c4ad0f9f.js → edge/USE_SERVER_BUNDLE-105e9ef3.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-a9a2d553.mjs → edge/USE_SERVER_BUNDLE-f6a1e321.mjs} +1 -1
- package/lib/edge/{bundle-df0d312f.js → bundle-0c1d9099.js} +24 -24
- package/lib/edge/{bundle-1e4b4476.mjs → bundle-ed178c62.mjs} +878 -874
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +7 -7
- package/lib/node/USE_CLIENT_BUNDLE-3a41b1ba.js +23 -0
- package/lib/{edge/USE_CLIENT_BUNDLE-bd1c5cd0.mjs → node/USE_CLIENT_BUNDLE-fc8c1bc0.mjs} +177 -179
- package/lib/{browser/USE_SERVER_BUNDLE-a9a2d553.mjs → node/USE_SERVER_BUNDLE-226a15ac.mjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-c4ad0f9f.js → node/USE_SERVER_BUNDLE-d8c698c8.js} +1 -1
- package/lib/node/{bundle-e116a057.js → bundle-0fae602b.js} +8 -8
- package/lib/node/{bundle-6ca5e123.mjs → bundle-3b073b16.mjs} +24 -20
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +7 -7
- package/package.json +2 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/lib/browser/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
- package/lib/edge/USE_CLIENT_BUNDLE-fc2e4ccd.js +0 -23
- package/lib/node/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-0fae602b.js");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";const Fe=require("lru-cache"),s=require("react/jsx-runtime"),Pe=require("react"),v=require("./USE_CLIENT_BUNDLE-
|
|
2
|
-
`),
|
|
1
|
+
"use strict";const Fe=require("lru-cache"),s=require("react/jsx-runtime"),Pe=require("react"),v=require("./USE_CLIENT_BUNDLE-3a41b1ba.js");require("next/navigation");const I=e=>JSON.parse(JSON.stringify(e)),se={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},J=(e,t=se)=>`@media (max-width: ${t[e].max}px)`,ce=({small:e,medium:t})=>{const n=I(se);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},C="rsc",T="[Builder.io]: ",k={log:(...e)=>console.log(T,...e),error:(...e)=>console.error(T,...e),warn:(...e)=>console.warn(T,...e),debug:(...e)=>console.debug(T,...e)};function S(){return typeof window<"u"&&typeof document<"u"}function Oe(){return S()&&window.self!==window.top}function A(){return Oe()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const We=()=>{if(S()){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},Ne=()=>typeof navigator=="object"&&navigator.userAgent||"",le=()=>{const e=Ne(),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()||C==="reactNative"}},n=e.match(/Tablet|iPad/i),o=We();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"}},Le=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),Me=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const l=Le({builder:t,context:n,event:o,state:_e(a,i,r)});return new Function(...l.map(([c])=>c),e)(...l.map(([,c])=>c))};function _e(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}})}function B({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 l={isEditing:A(),isBrowser:S(),isServer:!S(),getUserAttributes:()=>le()},f={code:a&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,builder:l,context:t,event:r,rootSetState:i,rootState:o,localState:n};try{return Me(f)}catch(h){k.error("Failed code evaluation: "+h.message,{code:e});return}}const Ue=(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 Ke=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=I(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const l in e.bindings){const c=e.bindings[l],u=B({code:c,localState:n,rootState:o,rootSetState:i,context:t});Ue(a,l,u)}return a};function R({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?Ke({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const He=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=e=>e!=null,ue=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${He(n)}: ${o};`}).filter(w),De=e=>ue(e).join(`
|
|
2
|
+
`),O=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
|
|
3
3
|
${De(n)}
|
|
4
4
|
}`;return e?`${e} {
|
|
5
5
|
${o}
|
|
6
|
-
}`:o};function
|
|
6
|
+
}`:o};function V(e){return s.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function _(e){const t=function(){const i=R({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return w(i.hide)?!i.hide:w(i.show)?i.show:!0},n=function(){var d;const i=R({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,a=e.context.content,l=ce(((d=a==null?void 0:a.meta)==null?void 0:d.breakpoints)||{}),c=r==null?void 0:r.large,u=r==null?void 0:r.medium,f=r==null?void 0:r.small,h=i.id;if(!h)return"";const p=c?O({className:h,styles:c}):"",m=u?O({className:h,styles:u,mediaQuery:J("medium",l)}):"",g=f?O({className:h,styles:f,mediaQuery:J("small",l)}):"";return[p,m,g].join(" ")};return s.jsx(s.Fragment,{children:n()&&t()?s.jsx(s.Fragment,{children:s.jsx(V,{styles:n()})}):null})}function ze(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const qe=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],W=e=>typeof e=="string"&&qe.includes(e.toLowerCase()),Ge=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=R({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(`
|
|
7
7
|
Could not find a registered component named "${o}".
|
|
8
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`)},Je=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=
|
|
8
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`)},Je=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=B({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((c,u)=>({context:{...t,localState:{...t.localState,$index:u,$item:c,[a]:c,[`$${a}Index`]:u}},block:o}))};function Ye(e){const t=e.repeatContext;return s.jsx($,{block:e.block,context:t,registeredComponents:e.registeredComponents})}function Xe(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Qe=e=>`on${Xe(e)}`,Ze=(e,t)=>n=>B({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function et(e){const t={},n=e.block.actions??{};for(const o in n){if(!n.hasOwnProperty(o))continue;const i=n[o];let r=Qe(o);if(e.stripPrefix)switch(C){case"vue2":case"vue3":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=Ze(i,e)}return t}function tt(e){return e.className=e.class,delete e.class,e}const nt=e=>({href:e.href});function de({block:e,context:t}){var o;const n={...nt(e),...e.properties,"builder-id":e.id,style:e.style?ot(e.style):void 0,class:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return tt(n)}function ot(e){switch(C){case"svelte":case"vue2":case"vue3":case"solid":return ue(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}const it=({componentOptions:e,builderBlock:t,context:n,componentRef:o,includeBlockProps:i,isInteractive:r,contextValue:a})=>r?{Wrapper:o,block:t,context:n,wrapperProps:e}:{...e,...i?{attributes:de({block:t,context:a})}:{}};function Y(e){var n,o;const t=e.isInteractive?v.InteractiveElement:e.componentRef;return s.jsx(s.Fragment,{children:e.componentRef?s.jsx(s.Fragment,{children:s.jsxs(t,{...it({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:[(n=e.blockChildren)==null?void 0:n.map(i=>s.jsx($,{block:i,context:e.context,registeredComponents:e.registeredComponents},"block-"+i.id)),(o=e.blockChildren)==null?void 0:o.map(i=>s.jsx(_,{block:i,context:e.context},"block-style-"+i.id))]})}):null})}function $(e){var u,f,h,p;const t=function(){return Ge({block:e.block,context:e.context,registeredComponents:e.registeredComponents})},n=function(){return Je({block:e.block,context:e.context})},o=function(){return n()?e.block:R({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})},i=function(){return e.block.tagName||"div"},r=function(){return"hide"in o()?!o().hide:"show"in o()?o().show:!0},a=function(){var d;return!((d=t())!=null&&d.component)&&!n()?o().children??[]:[]},l=function(){var g,d,b,x,y;return{blockChildren:o().children??[],componentRef:(g=t())==null?void 0:g.component,componentOptions:{...ze(o()),builderContext:e.context,...((d=t())==null?void 0:d.name)==="Symbol"||((b=t())==null?void 0:b.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:c,registeredComponents:e.registeredComponents,builderBlock:o(),includeBlockProps:((x=t())==null?void 0:x.noWrap)===!0,isInteractive:!((y=t())!=null&&y.isRSC)}},c=e.context;return s.jsx(s.Fragment,{children:r()?s.jsx(s.Fragment,{children:(u=t())!=null&&u.noWrap?s.jsx(s.Fragment,{children:s.jsx(Y,{...l()})}):s.jsxs(s.Fragment,{children:[W(i())?s.jsx(s.Fragment,{children:s.jsx(v.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,hasChildren:!1})}):null,!W(i())&&n()?s.jsx(s.Fragment,{children:(f=n())==null?void 0:f.map((m,g)=>s.jsx(Ye,{repeatContext:m.context,block:m.block,registeredComponents:e.registeredComponents},g))}):null,!W(i())&&!n()?s.jsx(s.Fragment,{children:s.jsxs(v.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,hasChildren:!0,children:[s.jsx(Y,{...l()}),(h=a())==null?void 0:h.map(m=>s.jsx($,{block:m,context:c,registeredComponents:e.registeredComponents},"block-"+m.id)),(p=a())==null?void 0:p.map(m=>s.jsx(_,{block:m,context:c},"block-style-"+m.id))]})}):null]})}):null})}function F(e){var t,n;return s.jsxs(v.BlocksWrapper,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,children:[e.blocks?s.jsx(s.Fragment,{children:(t=e.blocks)==null?void 0:t.map(o=>s.jsx($,{block:o,context:e.context,registeredComponents:e.registeredComponents},"render-block-"+o.id))}):null,e.blocks?s.jsx(s.Fragment,{children:(n=e.blocks)==null?void 0:n.map(o=>s.jsx(_,{block:o,context:e.context},"block-style-"+o.id))}):null]})}function me(e){var m;const t=typeof e.space=="number"?e.space||0:20,n=e.columns||[],o=e.stackColumnsAt||"tablet",i=function(d){var b;return((b=n[d])==null?void 0:b.width)||100/n.length},r=function(d){const b=t*(n.length-1)/n.length;return`calc(${i(d)}% - ${b}px)`},a=function({stackedStyle:d,desktopStyle:b}){return o==="tablet"?d:b},l=function({stackedStyle:d,desktopStyle:b}){return o==="never"?b:d},c=e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column",u=function(){return{"--flex-dir":c,"--flex-dir-tablet":a({stackedStyle:c,desktopStyle:"row"})}},f=function(d){const b=d===0?0:t,x=r(d),y=`${b}px`,q="100%",G=0;return{width:x,["marginLeft"]:y,"--column-width-mobile":l({stackedStyle:q,desktopStyle:x}),"--column-margin-left-mobile":l({stackedStyle:G,desktopStyle:y}),"--column-width-tablet":a({stackedStyle:q,desktopStyle:x}),"--column-margin-left-tablet":a({stackedStyle:G,desktopStyle:y})}},h=function(d){var x,y;return ce(((y=(x=e.builderContext.content)==null?void 0:x.meta)==null?void 0:y.breakpoints)||{})[d].max},p=function(){return`
|
|
9
9
|
@media (max-width: ${h("medium")}px) {
|
|
10
10
|
.${e.builderBlock.id}-breakpoints {
|
|
11
11
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
`};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-119431c8`,style:u(),children:[s.jsx(s.Fragment,{children:s.jsx(
|
|
32
|
+
`};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-119431c8`,style:u(),children:[s.jsx(s.Fragment,{children:s.jsx(V,{styles:p()})}),(m=e.columns)==null?void 0:m.map((g,d)=>Pe.createElement("div",{className:"builder-column div-119431c8-2",style:f(d),key:d},s.jsx(F,{path:`component.options.columns.${d}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,blocks:g.blocks})))]}),s.jsx("style",{children:`.div-119431c8 {
|
|
33
33
|
display: flex;
|
|
34
34
|
line-height: normal;
|
|
35
35
|
}.div-119431c8-2 {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
window.${he} = ${t}
|
|
43
43
|
`},ft=(e,t)=>`
|
|
44
44
|
window.${ge}("${t}",${JSON.stringify(e)}, ${fe})`,gt=({contentId:e,variationId:t})=>`
|
|
45
|
-
window.${he}("${t}", "${e}", ${fe})`,ht={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0},pt={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(o=>{o.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(i=>i.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((l,c)=>l+c.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}]},bt={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},yt={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,l=6e4){return new Promise((c,u)=>{const f=document.createElement("img");let h=!1;f.onload=()=>{h=!0,c(f)},f.addEventListener("error",p=>{console.warn("Image load failed",p.error),u(p.error)}),f.src=a,setTimeout(()=>{h||u(new Error("Image load timed out"))},l)})}function o(a){return Math.round(a*1e3)/1e3}const i=e.get("image"),r=e.get("aspectRatio");if(fetch(i).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),i&&(!r||r===.7041))return n(i).then(a=>{const l=e.get("aspectRatio");e.get("image")===i&&(!l||l===.7041)&&a.width&&a.height&&(e.set("aspectRatio",o(a.height/a.width)),e.set("height",a.height),e.set("width",a.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}]},xt={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},St={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}]},vt={name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};function pe(e){var t;return s.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const kt={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}]},wt={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(o=>o.json()).then(o=>{e.get("url")===t&&(o.html?e.set("content",o.html):e.set("content","Invalid url, please try another"))}).catch(o=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},Ct=["text/javascript","application/javascript","application/ecmascript"],It=e=>Ct.includes(e.type),Tt={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0},Et={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]},Q=()=>[{component:v.Button,...ht},{component:me,...pt},{component:v.CustomCode,...Et},{component:v.Embed,...wt},{component:v.FragmentComponent,...bt},{component:v.Image,...yt},{component:v.ImgComponent,...Tt},{component:v.SectionComponent,...xt},{component:Be,...St},{component:pe,...vt},{component:v.Video,...kt}],Z=[],Rt=e=>({type:"builder.registerComponent",data:W(e)}),jt=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},At=e=>typeof e=="function"?jt(e):I(e),W=({inputs:e,...t})=>({...I(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((o,[i,r])=>({...o,[i]:At(r)}),{}))}),Bt=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+=`
|
|
45
|
+
window.${he}("${t}", "${e}", ${fe})`,ht={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0},pt={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(o=>{o.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(i=>i.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((l,c)=>l+c.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}]},bt={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},yt={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,l=6e4){return new Promise((c,u)=>{const f=document.createElement("img");let h=!1;f.onload=()=>{h=!0,c(f)},f.addEventListener("error",p=>{console.warn("Image load failed",p.error),u(p.error)}),f.src=a,setTimeout(()=>{h||u(new Error("Image load timed out"))},l)})}function o(a){return Math.round(a*1e3)/1e3}const i=e.get("image"),r=e.get("aspectRatio");if(fetch(i).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),i&&(!r||r===.7041))return n(i).then(a=>{const l=e.get("aspectRatio");e.get("image")===i&&(!l||l===.7041)&&a.width&&a.height&&(e.set("aspectRatio",o(a.height/a.width)),e.set("height",a.height),e.set("width",a.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}]},xt={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},St={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}]},vt={name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};function pe(e){var t;return s.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const kt={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}]},wt={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(o=>o.json()).then(o=>{e.get("url")===t&&(o.html?e.set("content",o.html):e.set("content","Invalid url, please try another"))}).catch(o=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},Ct=["text/javascript","application/javascript","application/ecmascript"],It=e=>Ct.includes(e.type),Tt={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0},Et={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]},Q=()=>[{component:v.Button,...ht},{component:me,...pt},{component:v.CustomCode,...Et},{component:v.Embed,...wt},{component:v.FragmentComponent,...bt},{component:v.Image,...yt},{component:v.ImgComponent,...Tt},{component:v.SectionComponent,...xt},{component:Be,...St},{component:pe,...vt},{component:v.Video,...kt}],Z=[],Rt=e=>({type:"builder.registerComponent",data:N(e)}),jt=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},At=e=>typeof e=="function"?jt(e):I(e),N=({inputs:e,...t})=>({...I(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((o,[i,r])=>({...o,[i]:At(r)}),{}))}),Bt=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+=`
|
|
46
46
|
@font-face {
|
|
47
47
|
font-family: "${t}";
|
|
48
48
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -72,5 +72,5 @@ ${Vt({customFonts:e.customFonts})}
|
|
|
72
72
|
text-align: inherit;
|
|
73
73
|
font-family: inherit;
|
|
74
74
|
}
|
|
75
|
-
`.trim();return s.jsx(
|
|
76
|
-
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 be=Nt(),Lt=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},ye=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(o=>o.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(o){k.warn("[COOKIE] GET error: ",(o==null?void 0:o.message)||o);return}},xe=async e=>ye(e),Mt=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(w).join("; "),_t=[["secure",""],["SameSite","None"]],Ut=({name:e,value:t,expires:n})=>{const i=(S()?location.protocol==="https:":!0)?_t:[[]],r=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...r,["path","/"],["domain",Lt(window.location.hostname)],...i];return Mt(a)},Se=async({name:e,value:t,expires:n,canTrack:o})=>{try{if(!o)return;const i=Ut({name:e,value:t,expires:n});document.cookie=i}catch(i){k.warn("[COOKIE] SET error: ",(i==null?void 0:i.message)||i)}};function Kt(){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 ve(){return Kt().replace(/-/g,"")}const ke="builderSessionId",Ht=async({canTrack:e})=>{if(!e)return;const t=await xe({name:ke,canTrack:e});if(w(t))return t;{const n=Dt();return zt({id:n,canTrack:e}),n}},Dt=()=>ve(),zt=({id:e,canTrack:t})=>Se({name:ke,value:e,canTrack:t}),we=()=>S()&&typeof localStorage<"u"?localStorage:void 0,qt=({key:e,canTrack:t})=>{var n;try{return t?(n=we())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},Gt=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=we())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},Ce="builderVisitorId",Jt=({canTrack:e})=>{if(!e)return;const t=qt({key:Ce,canTrack:e});if(w(t))return t;{const n=Yt();return Xt({id:n,canTrack:e}),n}},Yt=()=>ve(),Xt=({id:e,canTrack:t})=>Gt({key:Ce,value:e,canTrack:t}),Qt=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ht({canTrack:e}),n=Jt({canTrack:e});return{sessionId:t,visitorId:n}},Zt=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await Qt({canTrack:t}),userAttributes:le(),ownerId:n}});async function Ie(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!j()&&(S()||C==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Zt(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const en=e=>Ie({...e,canTrack:!0}),tn="0.6.4",ee={};function Te(e,t){let n=ee[e];if(n||(n=ee[e]=[]),n.push(t),S()){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 nn=()=>{Te("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 te=!1;const on=(e={})=>{var t,n;te||(te=!0,S()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:C,version:tn,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:o})=>{var i,r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const a=o.data.text,l=o.data.arguments||[],c=o.data.id,u=new Function(a);let f,h=null;try{f=u.apply(null,l)}catch(p){h=p}h?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:c,error:h.message}},"*"):f&&typeof f.then=="function"?f.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:c,result:p}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:f,id:c}},"*");break}}})))};function ne(e){return Math.round(e*1e3)/1e3}const rn=(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},an=e=>rn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),oe=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=ne(o/n.width),a=ne(i/n.height);return{x:r,y:a}},sn=e=>{const t=e.target,n=t&&an(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?oe({event:e,target:t}):void 0,builderTargetOffset:n?oe({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}};function Ee(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Fe.LRUCache({max:500,ttl:1e3*60*5}))}function N(e){return s.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id})}function ie(e){var i,r,a,l,c,u,f,h,p;const t=gt({variationId:(i=e.content)==null?void 0:i.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),n=[...Q(),...Z,...e.customComponents||[]].reduce((m,{component:g,...d})=>({...m,[d.name]:{component:g,...W(d)}}),{}),o={content:Ot({content:e.content,data:e.data}),localState:void 0,rootState:Pt({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...Q(),...Z,...e.customComponents||[]].reduce((m,{component:g,...d})=>({...m,[d.name]:W(d)}),{}),inheritedStyles:{}};return s.jsxs(v.EnableEditor,{content:e.content,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,classNameProp:e.classNameProp,showContent:e.showContent,builderContextSignal:o,children:[e.isSsrAbTest?s.jsx(s.Fragment,{children:s.jsx(N,{scriptStr:t})}):null,s.jsx(s.Fragment,{children:s.jsx(Ft,{contentId:(a=o.content)==null?void 0:a.id,cssCode:(c=(l=o.content)==null?void 0:l.data)==null?void 0:c.cssCode,customFonts:(f=(u=o.content)==null?void 0:u.data)==null?void 0:f.customFonts})}),s.jsx($,{blocks:(p=(h=o.content)==null?void 0:h.data)==null?void 0:p.blocks,context:o,registeredComponents:n})]})}const L=e=>w(e)?e:!0,cn="builder.tests",U=e=>`${cn}.${e}`,ln=({contentId:e})=>xe({name:U(e),canTrack:!0}),un=({contentId:e})=>ye({name:U(e),canTrack:!0}),dn=({contentId:e,value:t})=>Se({name:U(e),value:t,canTrack:!0}),Re=e=>w(e.id)&&w(e.variations)&&Object.keys(e.variations).length>0,mn=({id:e,variations:t})=>{var i;let n=0;const o=Math.random();for(const r in t){const a=(i=t[r])==null?void 0:i.testRatio;if(n+=a,o<n)return r}return e},je=e=>{const t=mn(e);return dn({contentId:e.id,value:t}).catch(n=>{k.error("could not store A/B test variation: ",n)}),t},Ae=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},fn=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!Re(e))return e;const n=un({contentId:e.id})||je({variations:e.variations,id:e.id}),o=Ae({item:e,testGroupId:n});return{...e,...o}},gn=async({item:e,canTrack:t})=>{if(!t||!Re(e))return e;const o=await ln({contentId:e.id})||je({variations:e.variations,id:e.id}),i=Ae({item:e,testGroupId:o});return{...e,...i}};function K(e){var r,a,l;const t=ct({canTrack:L(e.canTrack),content:e.content}),n=function(){var u;return ft(E(e.content).map(f=>({id:f.testVariationId,testRatio:f.testRatio})),((u=e.content)==null?void 0:u.id)||"")},o=function(){return E(e.content).map(u=>`.variant-${u.testVariationId} { display: none; } `).join("")},i=function(){var u;return t?{...e.content,testVariationId:(u=e.content)==null?void 0:u.id}:fn({item:e.content,canTrack:L(e.canTrack)})};return s.jsxs(s.Fragment,{children:[!e.__isNestedRender&&C!=="reactNative"?s.jsx(s.Fragment,{children:s.jsx(N,{scriptStr:mt()})}):null,t?s.jsxs(s.Fragment,{children:[s.jsx(B,{id:`variants-styles-${(r=e.content)==null?void 0:r.id}`,styles:o()}),s.jsx(N,{scriptStr:n()}),(a=E(e.content))==null?void 0:a.map(c=>s.jsx(ie,{content:c,showContent:!1,classNameProp:void 0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t},c.testVariationId))]}):null,s.jsx(ie,{content:i(),classNameProp:`variant-${(l=e.content)==null?void 0:l.id}`,showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t})]})}const hn=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return F({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{k.error("Could not fetch symbol content: ",n)})};async function Be(e){var o,i,r,a;const t=function(){var c,u;return[e.attributes.className,"builder-symbol",(c=e.symbol)!=null&&c.inline?"builder-inline-symbol":void 0,(u=e.symbol)!=null&&u.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},n=((o=e.symbol)==null?void 0:o.content)||await hn({symbol:e.symbol,builderContextValue:e.builderContext});return s.jsx("div",{...e.attributes,className:t(),children:s.jsx(K,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:e.builderContext.context,customComponents:Object.values(e.builderComponents),data:{...(i=e.symbol)==null?void 0:i.data,...e.builderContext.localState,...(r=n==null?void 0:n.data)==null?void 0:r.state},model:(a=e.symbol)==null?void 0:a.model,content:n})})}const pn=$,bn=K;function yn(){return!S()||j()?!1:location.search.indexOf("builder.preview=")!==-1}const re={};function xn(e){if(S()){Object.assign(re,e);const t={type:"builder.settingsChange",data:re};parent.postMessage(t,"*")}}const Sn=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||k.warn("No previewed ID found in search params."),n};function vn(e){Ee();const t=Sn(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function M(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,...M(r,a,n)}:{...o,[a]:r}},{})}const ae="builder.",kn="options.",wn=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},H=e=>{if(!e)return{};const t=Ve(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(ae)){const i=o.replace(ae,"").replace(kn,"");n[i]=t[o]}}),n},Cn=()=>{if(!S())return{};const e=new URLSearchParams(window.location.search);return H(e)},Ve=e=>e instanceof URLSearchParams?wn(e):e,In="v3",D=e=>{const{limit:t=30,userAttributes:n,query:o,noTraverse:i=!1,model:r,apiKey:a,includeRefs:l=!0,enrich:c,locale:u,apiVersion:f=In}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);const h=new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${t}&noTraverse=${i}&includeRefs=${l}${u?`&locale=${u}`:""}${c?`&enrich=${c}`:""}`),p={...Cn(),...Ve(e.options||{})},m=M(p);for(const g in m)h.searchParams.set(g,String(m[g]));if(n&&h.searchParams.set("userAttributes",JSON.stringify(n)),o){const g=M({query:o});for(const d in g)h.searchParams.set(d,JSON.stringify(g[d]))}return h},Tn=e=>"results"in e;async function F(e){const t=await z({...e,limit:1});return t&&t.results[0]||null}const En=F,Rn=async e=>{const t=D(e);return await(await be(t.href)).json()},$e=async(e,t,n=D(e))=>{const o=L(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const l=vn(n.searchParams);r.push(l||a)}t.results=r}if(!o||!(S()||C==="reactNative"))return t;try{const r=[];for(const a of t.results)r.push(await gn({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t};async function z(e){try{const t=D(e),n=await Rn(e);return Tn(n)?$e(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 jn=z,An=async e=>{var o,i,r;const t=e.path||((o=e.url)==null?void 0:o.pathname)||((i=e.userAttributes)==null?void 0:i.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:H(e.searchParams||((r=e.url)==null?void 0:r.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await F(n)}};exports.Blocks=$;exports.Columns=me;exports.ContentVariants=K;exports.RenderBlocks=pn;exports.RenderContent=bn;exports.Symbol=Be;exports.Text=pe;exports._processContentResult=$e;exports._track=Ie;exports.checkIsDefined=w;exports.createRegisterComponentMessage=Rt;exports.evaluate=A;exports.fastClone=I;exports.fetch=be;exports.fetchBuilderProps=An;exports.fetchEntries=z;exports.fetchOneEntry=F;exports.getAllContent=jn;exports.getBlockActions=et;exports.getBlockProperties=de;exports.getBuilderSearchParams=H;exports.getContent=En;exports.getInteractionPropertiesForEvent=sn;exports.getSrcSet=st;exports.init=Ee;exports.isBrowser=S;exports.isEditing=j;exports.isJsScript=It;exports.isPreviewing=yn;exports.logger=k;exports.register=Te;exports.registerInsertMenu=nn;exports.setEditorSettings=xn;exports.setupBrowserForEditing=on;exports.track=en;
|
|
75
|
+
`.trim();return s.jsx(V,{styles:t})}const Pt=({content:e,data:t,locale:n})=>{var r,a,l;const o={};(a=(r=e==null?void 0:e.data)==null?void 0:r.inputs)==null||a.forEach(c=>{var u;c.name&&c.defaultValue!==void 0&&((u=e==null?void 0:e.data)!=null&&u.state)&&e.data.state[c.name]===void 0&&(o[c.name]=c.defaultValue)});const i={...(l=e==null?void 0:e.data)==null?void 0:l.state,...t,...n?{locale:n}:{}};return{...o,...i}},Ot=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function Wt(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function Nt(){const e=Wt().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.
|
|
76
|
+
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 be=Nt(),Lt=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},ye=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(o=>o.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(o){k.warn("[COOKIE] GET error: ",(o==null?void 0:o.message)||o);return}},xe=async e=>ye(e),Mt=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(w).join("; "),_t=[["secure",""],["SameSite","None"]],Ut=({name:e,value:t,expires:n})=>{const i=(S()?location.protocol==="https:":!0)?_t:[[]],r=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...r,["path","/"],["domain",Lt(window.location.hostname)],...i];return Mt(a)},Se=async({name:e,value:t,expires:n,canTrack:o})=>{try{if(!o)return;const i=Ut({name:e,value:t,expires:n});document.cookie=i}catch(i){k.warn("[COOKIE] SET error: ",(i==null?void 0:i.message)||i)}};function Kt(){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 ve(){return Kt().replace(/-/g,"")}const ke="builderSessionId",Ht=async({canTrack:e})=>{if(!e)return;const t=await xe({name:ke,canTrack:e});if(w(t))return t;{const n=Dt();return zt({id:n,canTrack:e}),n}},Dt=()=>ve(),zt=({id:e,canTrack:t})=>Se({name:ke,value:e,canTrack:t}),we=()=>S()&&typeof localStorage<"u"?localStorage:void 0,qt=({key:e,canTrack:t})=>{var n;try{return t?(n=we())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},Gt=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=we())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},Ce="builderVisitorId",Jt=({canTrack:e})=>{if(!e)return;const t=qt({key:Ce,canTrack:e});if(w(t))return t;{const n=Yt();return Xt({id:n,canTrack:e}),n}},Yt=()=>ve(),Xt=({id:e,canTrack:t})=>Gt({key:Ce,value:e,canTrack:t}),Qt=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ht({canTrack:e}),n=Jt({canTrack:e});return{sessionId:t,visitorId:n}},Zt=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await Qt({canTrack:t}),userAttributes:le(),ownerId:n}});async function Ie(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!A()&&(S()||C==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Zt(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const en=e=>Ie({...e,canTrack:!0}),tn="0.7.0",ee={};function Te(e,t){let n=ee[e];if(n||(n=ee[e]=[]),n.push(t),S()){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 nn=()=>{Te("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 te=!1;const on=(e={})=>{var t,n;te||(te=!0,S()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:C,version:tn,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:o})=>{var i,r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const a=o.data.text,l=o.data.arguments||[],c=o.data.id,u=new Function(a);let f,h=null;try{f=u.apply(null,l)}catch(p){h=p}h?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:c,error:h.message}},"*"):f&&typeof f.then=="function"?f.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:c,result:p}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:f,id:c}},"*");break}}})))};function ne(e){return Math.round(e*1e3)/1e3}const rn=(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},an=e=>rn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),oe=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=ne(o/n.width),a=ne(i/n.height);return{x:r,y:a}},sn=e=>{const t=e.target,n=t&&an(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?oe({event:e,target:t}):void 0,builderTargetOffset:n?oe({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}};function Ee(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Fe.LRUCache({max:500,ttl:1e3*60*5}))}const j=e=>w(e)?e:!0;function L(e){return s.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id})}function ie(e){var i,r,a,l,c,u,f,h,p;const t=gt({variationId:(i=e.content)==null?void 0:i.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),n=[...Q(),...Z,...e.customComponents||[]].reduce((m,{component:g,...d})=>({...m,[d.name]:{component:g,...N(d)}}),{}),o={content:Ot({content:e.content,data:e.data}),localState:void 0,rootState:Pt({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...Q(),...Z,...e.customComponents||[]].reduce((m,{component:g,...d})=>({...m,[d.name]:N(d)}),{}),inheritedStyles:{}};return s.jsxs(v.EnableEditor,{content:e.content,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,classNameProp:e.classNameProp,showContent:e.showContent,builderContextSignal:o,children:[e.isSsrAbTest?s.jsx(s.Fragment,{children:s.jsx(L,{scriptStr:t})}):null,s.jsx(s.Fragment,{children:s.jsx(Ft,{contentId:(a=o.content)==null?void 0:a.id,cssCode:(c=(l=o.content)==null?void 0:l.data)==null?void 0:c.cssCode,customFonts:(f=(u=o.content)==null?void 0:u.data)==null?void 0:f.customFonts})}),s.jsx(F,{blocks:(p=(h=o.content)==null?void 0:h.data)==null?void 0:p.blocks,context:o,registeredComponents:n})]})}const cn="builder.tests",U=e=>`${cn}.${e}`,ln=({contentId:e})=>xe({name:U(e),canTrack:!0}),un=({contentId:e})=>ye({name:U(e),canTrack:!0}),dn=({contentId:e,value:t})=>Se({name:U(e),value:t,canTrack:!0}),Re=e=>w(e.id)&&w(e.variations)&&Object.keys(e.variations).length>0,mn=({id:e,variations:t})=>{var i;let n=0;const o=Math.random();for(const r in t){const a=(i=t[r])==null?void 0:i.testRatio;if(n+=a,o<n)return r}return e},je=e=>{const t=mn(e);return dn({contentId:e.id,value:t}).catch(n=>{k.error("could not store A/B test variation: ",n)}),t},Ae=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},fn=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!Re(e))return e;const n=un({contentId:e.id})||je({variations:e.variations,id:e.id}),o=Ae({item:e,testGroupId:n});return{...e,...o}},gn=async({item:e,canTrack:t})=>{if(!t||!Re(e))return e;const o=await ln({contentId:e.id})||je({variations:e.variations,id:e.id}),i=Ae({item:e,testGroupId:o});return{...e,...i}};function K(e){var r,a,l;const t=ct({canTrack:j(e.canTrack),content:e.content}),n=function(){var u;return ft(E(e.content).map(f=>({id:f.testVariationId,testRatio:f.testRatio})),((u=e.content)==null?void 0:u.id)||"")},o=function(){return E(e.content).map(u=>`.variant-${u.testVariationId} { display: none; } `).join("")},i=function(){var u;return t?{...e.content,testVariationId:(u=e.content)==null?void 0:u.id}:fn({item:e.content,canTrack:j(e.canTrack)})};return s.jsxs(s.Fragment,{children:[!e.__isNestedRender&&C!=="reactNative"?s.jsx(s.Fragment,{children:s.jsx(L,{scriptStr:mt()})}):null,t?s.jsxs(s.Fragment,{children:[s.jsx(V,{id:`variants-styles-${(r=e.content)==null?void 0:r.id}`,styles:o()}),s.jsx(L,{scriptStr:n()}),(a=E(e.content))==null?void 0:a.map(c=>s.jsx(ie,{content:c,showContent:!1,classNameProp:void 0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t},c.testVariationId))]}):null,s.jsx(ie,{content:i(),classNameProp:`variant-${(l=e.content)==null?void 0:l.id}`,showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t})]})}const hn=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return P({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{k.error("Could not fetch symbol content: ",n)})};async function Be(e){var o,i,r,a;const t=function(){var c,u;return[e.attributes.className,"builder-symbol",(c=e.symbol)!=null&&c.inline?"builder-inline-symbol":void 0,(u=e.symbol)!=null&&u.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},n=((o=e.symbol)==null?void 0:o.content)||await hn({symbol:e.symbol,builderContextValue:e.builderContext});return s.jsx("div",{...e.attributes,className:t(),children:s.jsx(K,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:e.builderContext.context,customComponents:Object.values(e.builderComponents),data:{...(i=e.symbol)==null?void 0:i.data,...e.builderContext.localState,...(r=n==null?void 0:n.data)==null?void 0:r.state},model:(a=e.symbol)==null?void 0:a.model,content:n})})}const pn=F,bn=K;function yn(){return!S()||A()?!1:location.search.indexOf("builder.preview=")!==-1}const re={};function xn(e){if(S()){Object.assign(re,e);const t={type:"builder.settingsChange",data:re};parent.postMessage(t,"*")}}const Sn=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||k.warn("No previewed ID found in search params."),n};function vn(e){Ee();const t=Sn(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function M(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,...M(r,a,n)}:{...o,[a]:r}},{})}const ae="builder.",kn="options.",wn=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},H=e=>{if(!e)return{};const t=Ve(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(ae)){const i=o.replace(ae,"").replace(kn,"");n[i]=t[o]}}),n},Cn=()=>{if(!S())return{};const e=new URLSearchParams(window.location.search);return H(e)},Ve=e=>e instanceof URLSearchParams?wn(e):e,In="v3",D=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:l=!0,enrich:c,locale:u,apiVersion:f=In}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const h=new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${l}${u?`&locale=${u}`:""}${c?`&enrich=${c}`:""}`),p={...Cn(),...Ve(e.options||{})},m=M(p);for(const g in m)h.searchParams.set(g,String(m[g]));if(o&&h.searchParams.set("userAttributes",JSON.stringify(o)),i){const g=M({query:i});for(const d in g)h.searchParams.set(d,JSON.stringify(g[d]))}return h},Tn=e=>"results"in e;async function P(e){const t=await z({...e,limit:1});return t&&t.results[0]||null}const En=P,Rn=async e=>{const t=D(e);return await(await be(t.href)).json()},$e=async(e,t,n=D(e))=>{const o=j(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const l=vn(n.searchParams);r.push(l||a)}t.results=r}if(!o||!(S()||C==="reactNative"))return t;try{const r=[];for(const a of t.results)r.push(await gn({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t};async function z(e){try{const t=D(e),n=await Rn(e);return Tn(n)?$e(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 jn=z,An=async e=>{var o,i,r;const t=e.path||((o=e.url)==null?void 0:o.pathname)||((i=e.userAttributes)==null?void 0:i.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:H(e.searchParams||((r=e.url)==null?void 0:r.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await P(n)}};exports.Blocks=F;exports.Columns=me;exports.ContentVariants=K;exports.RenderBlocks=pn;exports.RenderContent=bn;exports.Symbol=Be;exports.Text=pe;exports._processContentResult=$e;exports._track=Ie;exports.createRegisterComponentMessage=Rt;exports.evaluate=B;exports.fastClone=I;exports.fetch=be;exports.fetchBuilderProps=An;exports.fetchEntries=z;exports.fetchOneEntry=P;exports.getAllContent=jn;exports.getBlockActions=et;exports.getBlockProperties=de;exports.getBuilderSearchParams=H;exports.getContent=En;exports.getDefaultCanTrack=j;exports.getInteractionPropertiesForEvent=sn;exports.getSrcSet=st;exports.init=Ee;exports.isBrowser=S;exports.isEditing=A;exports.isJsScript=It;exports.isPreviewing=yn;exports.logger=k;exports.register=Te;exports.registerInsertMenu=nn;exports.setEditorSettings=xn;exports.setupBrowserForEditing=on;exports.track=en;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache as Re } from "lru-cache";
|
|
2
2
|
import { jsx as l, Fragment as x, jsxs as w } from "react/jsx-runtime";
|
|
3
3
|
import { createElement as Ee } from "react";
|
|
4
|
-
import { I as Ae, B as q, a as Ve, b as $e, C as Be, E as Pe, F as Fe, c as Oe, d as We, S as Ne, V as Le, e as Me } from "./USE_CLIENT_BUNDLE-
|
|
4
|
+
import { I as Ae, B as q, a as Ve, b as $e, C as Be, E as Pe, F as Fe, c as Oe, d as We, S as Ne, V as Le, e as Me } from "./USE_CLIENT_BUNDLE-fc8c1bc0.mjs";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const A = (e) => JSON.parse(JSON.stringify(e)), ae = {
|
|
7
7
|
small: {
|
|
@@ -1788,7 +1788,7 @@ async function rn(e) {
|
|
|
1788
1788
|
const Mn = (e) => rn({
|
|
1789
1789
|
...e,
|
|
1790
1790
|
canTrack: !0
|
|
1791
|
-
}), an = "0.
|
|
1791
|
+
}), an = "0.7.0", Z = {};
|
|
1792
1792
|
function sn(e, t) {
|
|
1793
1793
|
let n = Z[e];
|
|
1794
1794
|
if (n || (n = Z[e] = []), n.push(t), v()) {
|
|
@@ -1939,7 +1939,8 @@ function un() {
|
|
|
1939
1939
|
ttl: 1e3 * 60 * 5
|
|
1940
1940
|
}));
|
|
1941
1941
|
}
|
|
1942
|
-
|
|
1942
|
+
const O = (e) => C(e) ? e : !0;
|
|
1943
|
+
function W(e) {
|
|
1943
1944
|
return /* @__PURE__ */ l(
|
|
1944
1945
|
"script",
|
|
1945
1946
|
{
|
|
@@ -2021,7 +2022,7 @@ function oe(e) {
|
|
|
2021
2022
|
showContent: e.showContent,
|
|
2022
2023
|
builderContextSignal: o,
|
|
2023
2024
|
children: [
|
|
2024
|
-
e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2025
|
+
e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: t }) }) : null,
|
|
2025
2026
|
/* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2026
2027
|
Nt,
|
|
2027
2028
|
{
|
|
@@ -2042,7 +2043,7 @@ function oe(e) {
|
|
|
2042
2043
|
}
|
|
2043
2044
|
);
|
|
2044
2045
|
}
|
|
2045
|
-
const
|
|
2046
|
+
const dn = "builder.tests", j = (e) => `${dn}.${e}`, mn = ({
|
|
2046
2047
|
contentId: e
|
|
2047
2048
|
}) => he({
|
|
2048
2049
|
name: j(e),
|
|
@@ -2140,7 +2141,7 @@ const W = (e) => C(e) ? e : !0, dn = "builder.tests", j = (e) => `${dn}.${e}`, m
|
|
|
2140
2141
|
function we(e) {
|
|
2141
2142
|
var r, a, c;
|
|
2142
2143
|
const t = mt({
|
|
2143
|
-
canTrack:
|
|
2144
|
+
canTrack: O(e.canTrack),
|
|
2144
2145
|
content: e.content
|
|
2145
2146
|
}), n = function() {
|
|
2146
2147
|
var u;
|
|
@@ -2160,11 +2161,11 @@ function we(e) {
|
|
|
2160
2161
|
testVariationId: (u = e.content) == null ? void 0 : u.id
|
|
2161
2162
|
} : pn({
|
|
2162
2163
|
item: e.content,
|
|
2163
|
-
canTrack:
|
|
2164
|
+
canTrack: O(e.canTrack)
|
|
2164
2165
|
});
|
|
2165
2166
|
};
|
|
2166
2167
|
return /* @__PURE__ */ w(x, { children: [
|
|
2167
|
-
!e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
|
|
2168
|
+
!e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: pt() }) }) : null,
|
|
2168
2169
|
t ? /* @__PURE__ */ w(x, { children: [
|
|
2169
2170
|
/* @__PURE__ */ l(
|
|
2170
2171
|
V,
|
|
@@ -2173,7 +2174,7 @@ function we(e) {
|
|
|
2173
2174
|
styles: o()
|
|
2174
2175
|
}
|
|
2175
2176
|
),
|
|
2176
|
-
/* @__PURE__ */ l(
|
|
2177
|
+
/* @__PURE__ */ l(W, { scriptStr: n() }),
|
|
2177
2178
|
(a = R(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ l(
|
|
2178
2179
|
oe,
|
|
2179
2180
|
{
|
|
@@ -2324,11 +2325,13 @@ const re = "builder.", kn = "options.", wn = (e) => {
|
|
|
2324
2325
|
const e = new URLSearchParams(window.location.search);
|
|
2325
2326
|
return Ce(e);
|
|
2326
2327
|
}, Ie = (e) => e instanceof URLSearchParams ? wn(e) : e, In = "v3", K = (e) => {
|
|
2328
|
+
let {
|
|
2329
|
+
noTraverse: t = !1
|
|
2330
|
+
} = e;
|
|
2327
2331
|
const {
|
|
2328
|
-
limit:
|
|
2329
|
-
userAttributes:
|
|
2330
|
-
query:
|
|
2331
|
-
noTraverse: i = !1,
|
|
2332
|
+
limit: n = 30,
|
|
2333
|
+
userAttributes: o,
|
|
2334
|
+
query: i,
|
|
2332
2335
|
model: r,
|
|
2333
2336
|
apiKey: a,
|
|
2334
2337
|
includeRefs: c = !0,
|
|
@@ -2340,15 +2343,16 @@ const re = "builder.", kn = "options.", wn = (e) => {
|
|
|
2340
2343
|
throw new Error("Missing API key");
|
|
2341
2344
|
if (!["v2", "v3"].includes(f))
|
|
2342
2345
|
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
|
|
2343
|
-
|
|
2346
|
+
(e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
|
|
2347
|
+
const g = new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u ? `&locale=${u}` : ""}${s ? `&enrich=${s}` : ""}`), p = {
|
|
2344
2348
|
...Cn(),
|
|
2345
2349
|
...Ie(e.options || {})
|
|
2346
2350
|
}, m = N(p);
|
|
2347
2351
|
for (const h in m)
|
|
2348
2352
|
g.searchParams.set(h, String(m[h]));
|
|
2349
|
-
if (
|
|
2353
|
+
if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), i) {
|
|
2350
2354
|
const h = N({
|
|
2351
|
-
query:
|
|
2355
|
+
query: i
|
|
2352
2356
|
});
|
|
2353
2357
|
for (const d in h)
|
|
2354
2358
|
g.searchParams.set(d, JSON.stringify(h[d]));
|
|
@@ -2366,7 +2370,7 @@ const qn = H, Rn = async (e) => {
|
|
|
2366
2370
|
const t = K(e);
|
|
2367
2371
|
return await (await jt(t.href)).json();
|
|
2368
2372
|
}, En = async (e, t, n = K(e)) => {
|
|
2369
|
-
const o =
|
|
2373
|
+
const o = O(e.canTrack);
|
|
2370
2374
|
if (n.search.includes("preview=")) {
|
|
2371
2375
|
const r = [];
|
|
2372
2376
|
for (const a of t.results) {
|
|
@@ -2435,9 +2439,9 @@ export {
|
|
|
2435
2439
|
On as a,
|
|
2436
2440
|
Wn as b,
|
|
2437
2441
|
Nn as c,
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2442
|
+
v as d,
|
|
2443
|
+
Ln as e,
|
|
2444
|
+
O as f,
|
|
2441
2445
|
at as g,
|
|
2442
2446
|
M as h,
|
|
2443
2447
|
L as i,
|
package/lib/node/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-0fae602b.js"),t=require("./USE_CLIENT_BUNDLE-3a41b1ba.js");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-d8c698c8.js");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/node/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, p as m, C as c, R as g, o as p, S as l, T as C, z as d,
|
|
2
|
-
import { b as w, F as A, c as F, S as T, V } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, p as m, C as c, R as g, o as p, S as l, T as C, z as d, e as u, E as B, v as S, w as f, x as E, A as R, y as h, i as x, q as k, t as y, u as P, D as b } from "./bundle-3b073b16.mjs";
|
|
2
|
+
import { b as w, F as A, c as F, S as T, V } from "./USE_CLIENT_BUNDLE-fc8c1bc0.mjs";
|
|
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-226a15ac.mjs";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
w as Button,
|
|
@@ -19,10 +19,10 @@ export {
|
|
|
19
19
|
C as Text,
|
|
20
20
|
V as Video,
|
|
21
21
|
d as _processContentResult,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
u as createRegisterComponentMessage,
|
|
23
|
+
B as fetchBuilderProps,
|
|
24
|
+
S as fetchEntries,
|
|
25
|
+
f as fetchOneEntry,
|
|
26
26
|
E as getAllContent,
|
|
27
27
|
R as getBuilderSearchParams,
|
|
28
28
|
h as getContent,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
7
7
|
"types"
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
|
+
"release": "npm publish",
|
|
92
93
|
"types": "tsc",
|
|
93
94
|
"build": "nx run-many -p @builder.io/sdk-react-nextjs -t types build:node build:edge build:browser",
|
|
94
95
|
"build:node": "SDK_ENV=node vite build --mode lib",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.7.0";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-e116a057.js"),r=require("react"),W=require("./USE_SERVER_BUNDLE-c4ad0f9f.js"),_=require("next/navigation");function A(e){return t.jsxs(t.Fragment,{children:[e.link?t.jsx(t.Fragment,{children:t.jsx("a",{role:"button",...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,children:e.text})}):t.jsx(t.Fragment,{children:t.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-3e7bc8b2",children:e.text})}),t.jsx("style",{children:`.button-3e7bc8b2 {
|
|
2
|
-
all: unset;
|
|
3
|
-
}`})]})}function z(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}function K(e){return t.jsxs(t.Fragment,{children:[" ",e.hasChildren?t.jsx(t.Fragment,{children:t.jsxs(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.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," "]})}):t.jsx(t.Fragment,{children:t.jsx(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function U(e){function l(){var a;return"builder-blocks"+((a=e.blocks)!=null&&a.length?"":" no-blocks")}function g(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function k(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:l()+" div-5821bd52","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:a=>g(),onMouseEnter:a=>k(),onKeyPress:a=>g(),children:e.children}),t.jsx("style",{children:`.div-5821bd52 {
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
align-items: stretch;
|
|
7
|
-
}`})]})}function V(e){return t.jsx("span",{children:e.children})}function D(e){var a,f,h,v;function l(){var m;const o=e.image||e.src;if(!o||!(o.match(/builder\.io/)||o.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((m=e.image)!=null&&m.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),n.getSrcSet(o)}else if(e.image&&!e.srcset)return n.getSrcSet(o);return n.getSrcSet(o)}function g(){var b;return(b=l==null?void 0:l())!=null&&b.match(/builder\.io/)&&!e.noWebp?l().replace(/\?/g,"?format=webp&"):""}function k(){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",...k()},className:"builder-image"+(e.className?" "+e.className:"")+" img-ef11a6be",src:e.image,srcSet:l(),sizes:e.sizes})]}),e.aspectRatio&&!((f=(a=e.builderBlock)==null?void 0:a.children)!=null&&f.length&&e.fitContent)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"builder-image-sizer div-ef11a6be",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(v=(h=e.builderBlock)==null?void 0:h.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-ef11a6be-2",children:e.children})}):null]}),t.jsx("style",{children:`.img-ef11a6be {
|
|
8
|
-
opacity: 1;
|
|
9
|
-
transition: opacity 0.2s ease-in-out;
|
|
10
|
-
}.div-ef11a6be {
|
|
11
|
-
width: 100%;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
font-size: 0;
|
|
14
|
-
}.div-ef11a6be-2 {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
align-items: stretch;
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
left: 0;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}`})]})}function H(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 J(e){var k;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{...e.attributes,...l()}}return t.jsx("video",{...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(k=e.attributes)==null?void 0:k.style,objectFit:e.fit,objectPosition:e.position,borderRadius:1},src:e.video||"no-src",poster:e.posterImage})}function O(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]),[h,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const o=l.current.getElementsByTagName("script");for(let m=0;m<o.length;m++){const x=o[m];if(x.src&&!g.includes(x.src)){g.push(x.src);const y=document.createElement("script");y.async=!0,y.src=x.src,document.head.appendChild(y)}else if(n.isJsScript(x)&&!a.includes(x.innerText))try{a.push(x.innerText),new Function(x.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!h&&(v(!0),b())},[l.current,h]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function G(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}function Q(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]);function h(){if(l.current&&l.current.getElementsByTagName&&typeof window<"u"){const v=l.current.getElementsByTagName("script");for(let b=0;b<v.length;b++){const o=v[b];if(o.src){if(g.includes(o.src))continue;g.push(o.src);const m=document.createElement("script");m.async=!0,m.src=o.src,document.head.appendChild(m)}else if(!o.type||["text/javascript","application/javascript","application/ecmascript"].includes(o.type)){if(a.includes(o.innerText))continue;try{a.push(o.innerText),new Function(o.innerText)()}catch(m){console.warn("`CustomCode`: Error running script:",m)}}}}}return r.useEffect(()=>{h()},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const X=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{}});function Y(e){var R,I,w,T,F;const l=r.useRef(null),[g,k]=r.useState(()=>n.checkIsDefined(e.canTrack)?e.canTrack:!0),[a,f]=r.useState(()=>0);function h(i){var c,d,u,S,P;const s={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(d=e.builderContextSignal.content)==null?void 0:d.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((P=(S=e.builderContextSignal.content)==null?void 0:S.meta)==null?void 0:P.breakpoints)}};W.postPreviewContent({value:s,key:s.id}).then(()=>{M.refresh()})}r.useState(()=>0);const[v,b]=r.useState(()=>!1);function o(i){var c;const{data:s}=i;if(s)switch(s.type){case"builder.configureSdk":{const d=s.data,{breakpoints:u,contentId:S}=d;if(!S||S!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&h({meta:{breakpoints:u}}),f(a+1);break}case"builder.contentUpdate":{const d=s.data,u=d.key||d.alias||d.entry||d.modelName,S=d.data;u===e.model&&(h(S),f(a+1));break}}}function m(){var s,c;const i=(c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.jsCode;i&&n.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[x,y]=r.useState(()=>({})),[E,B]=r.useState(()=>!1);function N(i){var s,c;if(e.builderContextSignal.content){const d=(s=e.builderContextSignal.content)==null?void 0:s.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;n._track({type:"click",canTrack:g,contentId:u,apiKey:e.apiKey,variationId:d!==u?d:void 0,...n.getInteractionPropertiesForEvent(i),unique:!E})}E||B(!0)}function q(i){return i.replace(/{{([^}]+)}}/g,(s,c)=>n.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function L({url:i,key:s}){n.fetch(i).then(c=>c.json()).then(c=>{var u,S;const d={...e.builderContextSignal.rootState,[s]:c};(S=(u=e.builderContextSignal).rootSetState)==null||S.call(u,d),x[s]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var s,c;const i=((c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([d,u])=>{if(u&&(!x[d]||n.isEditing())){const S=q(u);L({url:S,key:d})}})}function C(){n.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:n.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const M=_.useRouter();return r.useEffect(()=>{var i,s;if(e.apiKey||n.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),n.isBrowser()){if(n.isEditing()&&(f(a+1),window.addEventListener("message",o),n.registerInsertMenu(),n.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(c=>{var u;const d=n.createRegisterComponentMessage(c);(u=window.parent)==null||u.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)),e.builderContextSignal.content){const c=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,d=(s=e.builderContextSignal.content)==null?void 0:s.id;n._track({type:"impression",canTrack:g,contentId:d,apiKey:e.apiKey,variationId:c!==d?c:void 0})}m(),j(),C()}},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.addEventListener("message",o))},[v]),r.useEffect(()=>{m()},[(I=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:I.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(T=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:T.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(X.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:t.jsx("div",{ref:l,onClick:i=>N(i),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},className:e.classNameProp,children:e.children},a)}):null})}exports.BlockWrapper=K;exports.BlocksWrapper=U;exports.Button=A;exports.CustomCode=Q;exports.Embed=O;exports.EnableEditor=Y;exports.FragmentComponent=V;exports.Image=D;exports.ImgComponent=G;exports.InteractiveElement=z;exports.SectionComponent=H;exports.Video=J;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-df0d312f.js"),r=require("react"),W=require("./USE_SERVER_BUNDLE-5955a553.js"),_=require("next/navigation");function A(e){return t.jsxs(t.Fragment,{children:[e.link?t.jsx(t.Fragment,{children:t.jsx("a",{role:"button",...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,children:e.text})}):t.jsx(t.Fragment,{children:t.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-3e7bc8b2",children:e.text})}),t.jsx("style",{children:`.button-3e7bc8b2 {
|
|
2
|
-
all: unset;
|
|
3
|
-
}`})]})}function z(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}function K(e){return t.jsxs(t.Fragment,{children:[" ",e.hasChildren?t.jsx(t.Fragment,{children:t.jsxs(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.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," "]})}):t.jsx(t.Fragment,{children:t.jsx(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function U(e){function l(){var a;return"builder-blocks"+((a=e.blocks)!=null&&a.length?"":" no-blocks")}function g(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function k(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:l()+" div-5821bd52","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:a=>g(),onMouseEnter:a=>k(),onKeyPress:a=>g(),children:e.children}),t.jsx("style",{children:`.div-5821bd52 {
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
align-items: stretch;
|
|
7
|
-
}`})]})}function V(e){return t.jsx("span",{children:e.children})}function D(e){var a,f,h,v;function l(){var m;const o=e.image||e.src;if(!o||!(o.match(/builder\.io/)||o.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((m=e.image)!=null&&m.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),n.getSrcSet(o)}else if(e.image&&!e.srcset)return n.getSrcSet(o);return n.getSrcSet(o)}function g(){var b;return(b=l==null?void 0:l())!=null&&b.match(/builder\.io/)&&!e.noWebp?l().replace(/\?/g,"?format=webp&"):""}function k(){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",...k()},className:"builder-image"+(e.className?" "+e.className:"")+" img-ef11a6be",src:e.image,srcSet:l(),sizes:e.sizes})]}),e.aspectRatio&&!((f=(a=e.builderBlock)==null?void 0:a.children)!=null&&f.length&&e.fitContent)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"builder-image-sizer div-ef11a6be",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(v=(h=e.builderBlock)==null?void 0:h.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-ef11a6be-2",children:e.children})}):null]}),t.jsx("style",{children:`.img-ef11a6be {
|
|
8
|
-
opacity: 1;
|
|
9
|
-
transition: opacity 0.2s ease-in-out;
|
|
10
|
-
}.div-ef11a6be {
|
|
11
|
-
width: 100%;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
font-size: 0;
|
|
14
|
-
}.div-ef11a6be-2 {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
align-items: stretch;
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
left: 0;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}`})]})}function H(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 J(e){var k;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{...e.attributes,...l()}}return t.jsx("video",{...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(k=e.attributes)==null?void 0:k.style,objectFit:e.fit,objectPosition:e.position,borderRadius:1},src:e.video||"no-src",poster:e.posterImage})}function O(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]),[h,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const o=l.current.getElementsByTagName("script");for(let m=0;m<o.length;m++){const x=o[m];if(x.src&&!g.includes(x.src)){g.push(x.src);const y=document.createElement("script");y.async=!0,y.src=x.src,document.head.appendChild(y)}else if(n.isJsScript(x)&&!a.includes(x.innerText))try{a.push(x.innerText),new Function(x.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!h&&(v(!0),b())},[l.current,h]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function G(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}function Q(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]);function h(){if(l.current&&l.current.getElementsByTagName&&typeof window<"u"){const v=l.current.getElementsByTagName("script");for(let b=0;b<v.length;b++){const o=v[b];if(o.src){if(g.includes(o.src))continue;g.push(o.src);const m=document.createElement("script");m.async=!0,m.src=o.src,document.head.appendChild(m)}else if(!o.type||["text/javascript","application/javascript","application/ecmascript"].includes(o.type)){if(a.includes(o.innerText))continue;try{a.push(o.innerText),new Function(o.innerText)()}catch(m){console.warn("`CustomCode`: Error running script:",m)}}}}}return r.useEffect(()=>{h()},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const X=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{}});function Y(e){var R,I,w,T,F;const l=r.useRef(null),[g,k]=r.useState(()=>n.checkIsDefined(e.canTrack)?e.canTrack:!0),[a,f]=r.useState(()=>0);function h(i){var c,d,u,S,P;const s={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(d=e.builderContextSignal.content)==null?void 0:d.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((P=(S=e.builderContextSignal.content)==null?void 0:S.meta)==null?void 0:P.breakpoints)}};W.postPreviewContent({value:s,key:s.id}).then(()=>{M.refresh()})}r.useState(()=>0);const[v,b]=r.useState(()=>!1);function o(i){var c;const{data:s}=i;if(s)switch(s.type){case"builder.configureSdk":{const d=s.data,{breakpoints:u,contentId:S}=d;if(!S||S!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&h({meta:{breakpoints:u}}),f(a+1);break}case"builder.contentUpdate":{const d=s.data,u=d.key||d.alias||d.entry||d.modelName,S=d.data;u===e.model&&(h(S),f(a+1));break}}}function m(){var s,c;const i=(c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.jsCode;i&&n.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[x,y]=r.useState(()=>({})),[E,B]=r.useState(()=>!1);function N(i){var s,c;if(e.builderContextSignal.content){const d=(s=e.builderContextSignal.content)==null?void 0:s.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;n._track({type:"click",canTrack:g,contentId:u,apiKey:e.apiKey,variationId:d!==u?d:void 0,...n.getInteractionPropertiesForEvent(i),unique:!E})}E||B(!0)}function q(i){return i.replace(/{{([^}]+)}}/g,(s,c)=>n.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function L({url:i,key:s}){n.fetch(i).then(c=>c.json()).then(c=>{var u,S;const d={...e.builderContextSignal.rootState,[s]:c};(S=(u=e.builderContextSignal).rootSetState)==null||S.call(u,d),x[s]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var s,c;const i=((c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([d,u])=>{if(u&&(!x[d]||n.isEditing())){const S=q(u);L({url:S,key:d})}})}function C(){n.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:n.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const M=_.useRouter();return r.useEffect(()=>{var i,s;if(e.apiKey||n.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),n.isBrowser()){if(n.isEditing()&&(f(a+1),window.addEventListener("message",o),n.registerInsertMenu(),n.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(c=>{var u;const d=n.createRegisterComponentMessage(c);(u=window.parent)==null||u.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)),e.builderContextSignal.content){const c=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,d=(s=e.builderContextSignal.content)==null?void 0:s.id;n._track({type:"impression",canTrack:g,contentId:d,apiKey:e.apiKey,variationId:c!==d?c:void 0})}m(),j(),C()}},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.addEventListener("message",o))},[v]),r.useEffect(()=>{m()},[(I=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:I.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(T=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:T.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(X.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:t.jsx("div",{ref:l,onClick:i=>N(i),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},className:e.classNameProp,children:e.children},a)}):null})}exports.BlockWrapper=K;exports.BlocksWrapper=U;exports.Button=A;exports.CustomCode=Q;exports.Embed=O;exports.EnableEditor=Y;exports.FragmentComponent=V;exports.Image=D;exports.ImgComponent=G;exports.InteractiveElement=z;exports.SectionComponent=H;exports.Video=J;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-e116a057.js"),r=require("react"),W=require("./USE_SERVER_BUNDLE-c4ad0f9f.js"),_=require("next/navigation");function A(e){return t.jsxs(t.Fragment,{children:[e.link?t.jsx(t.Fragment,{children:t.jsx("a",{role:"button",...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,children:e.text})}):t.jsx(t.Fragment,{children:t.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-3e7bc8b2",children:e.text})}),t.jsx("style",{children:`.button-3e7bc8b2 {
|
|
2
|
-
all: unset;
|
|
3
|
-
}`})]})}function z(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}function K(e){return t.jsxs(t.Fragment,{children:[" ",e.hasChildren?t.jsx(t.Fragment,{children:t.jsxs(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.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," "]})}):t.jsx(t.Fragment,{children:t.jsx(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function U(e){function l(){var a;return"builder-blocks"+((a=e.blocks)!=null&&a.length?"":" no-blocks")}function g(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function k(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:l()+" div-5821bd52","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:a=>g(),onMouseEnter:a=>k(),onKeyPress:a=>g(),children:e.children}),t.jsx("style",{children:`.div-5821bd52 {
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
align-items: stretch;
|
|
7
|
-
}`})]})}function V(e){return t.jsx("span",{children:e.children})}function D(e){var a,f,h,v;function l(){var m;const o=e.image||e.src;if(!o||!(o.match(/builder\.io/)||o.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((m=e.image)!=null&&m.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),n.getSrcSet(o)}else if(e.image&&!e.srcset)return n.getSrcSet(o);return n.getSrcSet(o)}function g(){var b;return(b=l==null?void 0:l())!=null&&b.match(/builder\.io/)&&!e.noWebp?l().replace(/\?/g,"?format=webp&"):""}function k(){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",...k()},className:"builder-image"+(e.className?" "+e.className:"")+" img-ef11a6be",src:e.image,srcSet:l(),sizes:e.sizes})]}),e.aspectRatio&&!((f=(a=e.builderBlock)==null?void 0:a.children)!=null&&f.length&&e.fitContent)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"builder-image-sizer div-ef11a6be",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(v=(h=e.builderBlock)==null?void 0:h.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-ef11a6be-2",children:e.children})}):null]}),t.jsx("style",{children:`.img-ef11a6be {
|
|
8
|
-
opacity: 1;
|
|
9
|
-
transition: opacity 0.2s ease-in-out;
|
|
10
|
-
}.div-ef11a6be {
|
|
11
|
-
width: 100%;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
font-size: 0;
|
|
14
|
-
}.div-ef11a6be-2 {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
align-items: stretch;
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
left: 0;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}`})]})}function H(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 J(e){var k;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{...e.attributes,...l()}}return t.jsx("video",{...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(k=e.attributes)==null?void 0:k.style,objectFit:e.fit,objectPosition:e.position,borderRadius:1},src:e.video||"no-src",poster:e.posterImage})}function O(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]),[h,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const o=l.current.getElementsByTagName("script");for(let m=0;m<o.length;m++){const x=o[m];if(x.src&&!g.includes(x.src)){g.push(x.src);const y=document.createElement("script");y.async=!0,y.src=x.src,document.head.appendChild(y)}else if(n.isJsScript(x)&&!a.includes(x.innerText))try{a.push(x.innerText),new Function(x.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!h&&(v(!0),b())},[l.current,h]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function G(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}function Q(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]);function h(){if(l.current&&l.current.getElementsByTagName&&typeof window<"u"){const v=l.current.getElementsByTagName("script");for(let b=0;b<v.length;b++){const o=v[b];if(o.src){if(g.includes(o.src))continue;g.push(o.src);const m=document.createElement("script");m.async=!0,m.src=o.src,document.head.appendChild(m)}else if(!o.type||["text/javascript","application/javascript","application/ecmascript"].includes(o.type)){if(a.includes(o.innerText))continue;try{a.push(o.innerText),new Function(o.innerText)()}catch(m){console.warn("`CustomCode`: Error running script:",m)}}}}}return r.useEffect(()=>{h()},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const X=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{}});function Y(e){var R,I,w,T,F;const l=r.useRef(null),[g,k]=r.useState(()=>n.checkIsDefined(e.canTrack)?e.canTrack:!0),[a,f]=r.useState(()=>0);function h(i){var c,d,u,S,P;const s={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(d=e.builderContextSignal.content)==null?void 0:d.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((P=(S=e.builderContextSignal.content)==null?void 0:S.meta)==null?void 0:P.breakpoints)}};W.postPreviewContent({value:s,key:s.id}).then(()=>{M.refresh()})}r.useState(()=>0);const[v,b]=r.useState(()=>!1);function o(i){var c;const{data:s}=i;if(s)switch(s.type){case"builder.configureSdk":{const d=s.data,{breakpoints:u,contentId:S}=d;if(!S||S!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&h({meta:{breakpoints:u}}),f(a+1);break}case"builder.contentUpdate":{const d=s.data,u=d.key||d.alias||d.entry||d.modelName,S=d.data;u===e.model&&(h(S),f(a+1));break}}}function m(){var s,c;const i=(c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.jsCode;i&&n.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[x,y]=r.useState(()=>({})),[E,B]=r.useState(()=>!1);function N(i){var s,c;if(e.builderContextSignal.content){const d=(s=e.builderContextSignal.content)==null?void 0:s.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;n._track({type:"click",canTrack:g,contentId:u,apiKey:e.apiKey,variationId:d!==u?d:void 0,...n.getInteractionPropertiesForEvent(i),unique:!E})}E||B(!0)}function q(i){return i.replace(/{{([^}]+)}}/g,(s,c)=>n.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function L({url:i,key:s}){n.fetch(i).then(c=>c.json()).then(c=>{var u,S;const d={...e.builderContextSignal.rootState,[s]:c};(S=(u=e.builderContextSignal).rootSetState)==null||S.call(u,d),x[s]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var s,c;const i=((c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([d,u])=>{if(u&&(!x[d]||n.isEditing())){const S=q(u);L({url:S,key:d})}})}function C(){n.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:n.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const M=_.useRouter();return r.useEffect(()=>{var i,s;if(e.apiKey||n.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),n.isBrowser()){if(n.isEditing()&&(f(a+1),window.addEventListener("message",o),n.registerInsertMenu(),n.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(c=>{var u;const d=n.createRegisterComponentMessage(c);(u=window.parent)==null||u.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)),e.builderContextSignal.content){const c=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,d=(s=e.builderContextSignal.content)==null?void 0:s.id;n._track({type:"impression",canTrack:g,contentId:d,apiKey:e.apiKey,variationId:c!==d?c:void 0})}m(),j(),C()}},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.addEventListener("message",o))},[v]),r.useEffect(()=>{m()},[(I=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:I.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(T=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:T.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(X.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:t.jsx("div",{ref:l,onClick:i=>N(i),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},className:e.classNameProp,children:e.children},a)}):null})}exports.BlockWrapper=K;exports.BlocksWrapper=U;exports.Button=A;exports.CustomCode=Q;exports.Embed=O;exports.EnableEditor=Y;exports.FragmentComponent=V;exports.Image=D;exports.ImgComponent=G;exports.InteractiveElement=z;exports.SectionComponent=H;exports.Video=J;
|