@builder.io/sdk-react 3.0.0 → 3.0.2
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/blocks-exports.cjs +31 -31
- package/lib/browser/blocks-exports.mjs +1008 -962
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/server-entry-75ce8600.cjs +2 -0
- package/lib/browser/server-entry-a2495a20.js +748 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-98d9699d.cjs → accordion-1c16f65e.cjs} +1 -1
- package/lib/edge/{accordion-19141399.js → accordion-c020e15b.js} +1 -1
- package/lib/edge/blocks-27ac5b23.js +3534 -0
- package/lib/edge/blocks-cd946d16.cjs +30 -0
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +8 -7
- package/lib/edge/{button-a335b33d.js → button-5cdb4f26.js} +2 -2
- package/lib/edge/{button-90d3b8fd.cjs → button-8572fca5.cjs} +1 -1
- package/lib/edge/{columns-34eb4f77.js → columns-3ac1fa96.js} +5 -6
- package/lib/edge/columns-c8a9cb89.cjs +28 -0
- package/lib/edge/{content-variants-eb0b71da.js → content-variants-23c8eec6.js} +348 -344
- package/lib/edge/content-variants-caa23bf7.cjs +134 -0
- package/lib/edge/form-3d9bf265.cjs +1 -0
- package/lib/edge/{form-f468b835.js → form-7fc5691b.js} +14 -15
- package/lib/edge/{get-class-prop-name-f431302d.cjs → get-class-prop-name-29fd576a.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-79a17608.js → get-class-prop-name-a4845b04.js} +1 -1
- package/lib/edge/{image-6970c193.js → image-5c9e156f.js} +28 -28
- package/lib/edge/image-94922c87.cjs +17 -0
- package/lib/edge/{img-da07f7ae.cjs → img-102acaa2.cjs} +1 -1
- package/lib/edge/{img-0d66e9e1.js → img-388698cb.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-f7f73607.cjs → input-10e350a9.cjs} +1 -1
- package/lib/edge/{input-5962ba3b.js → input-5484e9e7.js} +1 -1
- package/lib/edge/{select-74305b69.js → select-b8406bcf.js} +1 -1
- package/lib/edge/{select-1f1bb9a6.cjs → select-f11be7a7.cjs} +1 -1
- package/lib/edge/server-entry-1879cbc4.cjs +2 -0
- package/lib/edge/server-entry-7ce03a4e.js +746 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-ad2d5248.js → slot-23f75377.js} +5 -6
- package/lib/edge/slot-4ab390ec.cjs +1 -0
- package/lib/edge/{symbol-70bb59b7.js → symbol-2eafb4e0.js} +2 -2
- package/lib/edge/{symbol-5baac842.cjs → symbol-fa343d77.cjs} +1 -1
- package/lib/edge/{tabs-0244ee23.js → tabs-4c9c64f6.js} +15 -16
- package/lib/edge/tabs-7d258d82.cjs +1 -0
- package/lib/edge/text-5915f038.js +17 -0
- package/lib/edge/text-e6dbb721.cjs +1 -0
- package/lib/node/blocks-exports.cjs +29 -29
- package/lib/node/blocks-exports.mjs +903 -857
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-2b263dde.js +749 -0
- package/lib/node/server-entry-ec330556.cjs +2 -0
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-97b6edac.cjs → setIvm-1e6f0b60.cjs} +1 -1
- package/lib/node/{setIvm-bcada801.js → setIvm-7eb67cd6.js} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-16d6b365.cjs → should-force-browser-runtime-in-node-23218b19.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-f1c78223.js → should-force-browser-runtime-in-node-cdae9360.js} +1 -1
- package/package.json +1 -1
- package/types/components/block/block.helpers.d.ts +6 -3
- package/types/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/constants/file-types.d.ts +2 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/context/types.d.ts +1 -0
- package/types/functions/extract-localized-values.d.ts +2 -0
- package/types/functions/get-block-component-options.d.ts +2 -1
- package/types/functions/get-processed-block.d.ts +1 -6
- package/types/functions/traverse.d.ts +34 -0
- package/types/helpers/flatten.d.ts +6 -0
- package/types/server-index.d.ts +1 -1
- package/types/types/components.d.ts +3 -0
- package/lib/browser/server-entry-52c69986.js +0 -717
- package/lib/browser/server-entry-f3c2ac77.cjs +0 -2
- package/lib/edge/blocks-672d29ca.cjs +0 -12
- package/lib/edge/blocks-7299cf1f.js +0 -870
- package/lib/edge/columns-96859531.cjs +0 -28
- package/lib/edge/content-variants-30e475b2.cjs +0 -134
- package/lib/edge/evaluate-0793c18a.js +0 -2612
- package/lib/edge/evaluate-84062c52.cjs +0 -19
- package/lib/edge/form-99fe0879.cjs +0 -1
- package/lib/edge/image-54d2f755.cjs +0 -17
- package/lib/edge/server-entry-4f813956.cjs +0 -2
- package/lib/edge/server-entry-c793e7d2.js +0 -715
- package/lib/edge/slot-0add1d03.cjs +0 -1
- package/lib/edge/tabs-a4146223.cjs +0 -1
- package/lib/edge/text-214ed248.cjs +0 -1
- package/lib/edge/text-2e3cf22b.js +0 -37
- package/lib/node/server-entry-60acf7c6.js +0 -718
- package/lib/node/server-entry-e3ec26c9.cjs +0 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),r=require("react"),s=require("./server-entry-1879cbc4.cjs"),k=require("./blocks-exports.cjs"),E=require("./blocks-cd946d16.cjs");require("./get-class-prop-name-29fd576a.cjs");require("./dynamic-renderer-b29b45ca.cjs");const q={"@type":"@builder.io/sdk:Element",layerName:"Accordion item title",responsiveStyles:{large:{marginTop:"10px",position:"relative",display:"flex",alignItems:"stretch",flexDirection:"column",paddingBottom:"10px"}},children:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"left",display:"flex",flexDirection:"column"}},component:{name:"Text",options:{text:"I am an accordion title. Click me!"}}}]},H={"@type":"@builder.io/sdk:Element",layerName:"Accordion item detail",responsiveStyles:{large:{position:"relative",display:"flex",alignItems:"stretch",flexDirection:"column",marginTop:"10px",paddingBottom:"10px"}},children:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{paddingTop:"50px",textAlign:"left",display:"flex",flexDirection:"column",paddingBottom:"50px"}},component:{name:"Text",options:{text:"I am an accordion detail, hello!"}}}]},G={name:"Builder:Accordion",canHaveChildren:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",defaultStyles:{display:"flex",flexDirection:"column",alignItems:"stretch"},inputs:[{name:"items",type:"list",broadcast:!0,subFields:[{name:"title",type:"uiBlocks",hideFromUI:!0,defaultValue:[q]},{name:"detail",type:"uiBlocks",hideFromUI:!0,defaultValue:[H]}],defaultValue:[{title:[q],detail:[H]},{title:[q],detail:[H]}],showIf:e=>!e.get("useChildrenForItems")},{name:"oneAtATime",helperText:"Only allow opening one at a time (collapse all others when new item openned)",type:"boolean",defaultValue:!1},{name:"grid",helperText:"Display as a grid",type:"boolean",defaultValue:!1},{name:"gridRowWidth",helperText:"Display as a grid",type:"string",showIf:e=>e.get("grid"),defaultValue:"25%"},{name:"useChildrenForItems",type:"boolean",helperText:"Use child elements for each slide, instead of the array. Useful for dynamically repeating items",advanced:!0,defaultValue:!1,onChange:e=>{e.get("useChildrenForItems")===!0&&e.set("items",[])}}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},Q=r.lazy(()=>Promise.resolve().then(()=>require("./accordion-1c16f65e.cjs"))),X={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,shouldReceiveBuilderProps:{builderLinkComponent:!0}},Z={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(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(d=>d.get("width"))&&(n.find(m=>!m.get("width"))||n.reduce((o,p)=>o+p.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}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},ee={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},N=["jpeg","jpg","png","svg","webp","gif","jfif","pjpeg","pjp","apng","avif","tif","tiff","heif","bmp","eps","raw","cr2","nef","orf","sr2","psd","heic","dib","ai"],te=["mp4","webm","mkv","flv","vob","ogv","ogg","drc","gif","gifv","mng","avi","mov","qt","mts","m2ts","ts","wmv","yuv","rm","rmvb","viv","asf","amv","m4p","mpeg","mpe","m2v","m4v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b"],ne={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:N,required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,o=6e4){return new Promise((p,I)=>{const T=document.createElement("img");let R=!1;T.onload=()=>{R=!0,p(T)},T.addEventListener("error",C=>{console.warn("Image load failed",C.error),I(C.error)}),T.src=a,setTimeout(()=>{R||I(new Error("Image load timed out"))},o)})}function i(a){return Math.round(a*1e3)/1e3}const d=e.get("image"),m=e.get("aspectRatio");if(fetch(d).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),d&&(!m||m===.7041))return n(d).then(a=>{const o=e.get("aspectRatio");e.get("image")===d&&(!o||o===.7041)&&a.width&&a.height&&(e.set("aspectRatio",i(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:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{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}],shouldReceiveBuilderProps:{builderBlock:!0}},ae={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>"}}}]},ie={name:"Slot",isRSC:!0,description:"Allow child blocks to be inserted into this content when used as a Symbol",docsLink:"https://www.builder.io/c/docs/symbols-with-blocks",image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",inputs:[{name:"name",type:"string",required:!0,defaultValue:"children"}],shouldReceiveBuilderProps:{builderContext:!0,builderComponents:!0}},oe=r.lazy(()=>Promise.resolve().then(()=>require("./slot-4ab390ec.cjs"))),re={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"}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},U={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"10px",paddingBottom:"10px",minWidth:"100px",textAlign:"center",display:"flex",flexDirection:"column",cursor:"pointer",userSelect:"none"}},component:{name:"Text",options:{text:"New tab"}}},L={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{height:"200px",display:"flex",marginTop:"20px",flexDirection:"column"}},component:{name:"Text",options:{text:"New tab content "}}},le={name:"Builder: Tabs",inputs:[{name:"tabs",type:"list",broadcast:!0,subFields:[{name:"label",type:"uiBlocks",hideFromUI:!0,defaultValue:[U]},{name:"content",type:"uiBlocks",hideFromUI:!0,defaultValue:[L]}],defaultValue:[{label:[{...U,component:{name:"Text",options:{text:"Tab 1"}}}],content:[{...L,component:{name:"Text",options:{text:"Tab 1 content"}}}]},{label:[{...U,component:{name:"Text",options:{text:"Tab 2"}}}],content:[{...L,component:{name:"Text",options:{text:"Tab 2 content"}}}]}]},{name:"activeTabStyle",type:"uiStyle",helperText:"CSS styles for the active tab",defaultValue:{backgroundColor:"rgba(0, 0, 0, 0.1)"}},{name:"defaultActiveTab",type:"number",helperText:'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',defaultValue:1,advanced:!0},{name:"collapsible",type:"boolean",helperText:"If on, clicking an open tab closes it so no tabs are active",defaultValue:!1,advanced:!0},{name:"tabHeaderLayout",type:"enum",helperText:"Change the layout of the tab headers (uses justify-content)",defaultValue:"flex-start",enum:[{label:"Center",value:"center"},{label:"Space between",value:"space-between"},{label:"Space around",value:"space-around"},{label:"Left",value:"flex-start"},{label:"Right",value:"flex-end"}]}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},se=r.lazy(()=>Promise.resolve().then(()=>require("./tabs-7d258d82.cjs"))),de={shouldReceiveBuilderProps:{builderBlock:!1,builderContext:!0},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"}},ue={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}]},ce=r.lazy(()=>Promise.resolve().then(()=>require("./custom-code-6d9730ff.cjs"))),me={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc"},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},pe=r.lazy(()=>Promise.resolve().then(()=>require("./embed-32bdd007.cjs"))),fe={name:"Form:Form",defaults:{responsiveStyles:{large:{marginTop:"15px",paddingBottom:"15px"}}},image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",inputs:[{name:"sendSubmissionsTo",type:"string",enum:[{label:"Send to email",value:"email",helperText:"Send form submissions to the email address of your choosing"},{label:"Custom",value:"custom",helperText:"Handle where the form requests go manually with a little code, e.g. to your own custom backend"}],defaultValue:"email"},{name:"sendSubmissionsToEmail",type:"string",required:!0,defaultValue:"your@email.com",showIf:'options.get("sendSubmissionsTo") === "email"'},{name:"sendWithJs",type:"boolean",helperText:"Set to false to use basic html form action",defaultValue:!0,showIf:'options.get("sendSubmissionsTo") === "custom"'},{name:"name",type:"string",defaultValue:"My form"},{name:"action",type:"string",helperText:"URL to send the form data to",showIf:'options.get("sendSubmissionsTo") === "custom"'},{name:"contentType",type:"string",defaultValue:"application/json",advanced:!0,enum:["application/json","multipart/form-data","application/x-www-form-urlencoded"],showIf:'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'},{name:"method",type:"string",showIf:'options.get("sendSubmissionsTo") === "custom"',defaultValue:"POST",advanced:!0},{name:"previewState",type:"string",enum:["unsubmitted","sending","success","error"],defaultValue:"unsubmitted",helperText:'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',showIf:'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'},{name:"successUrl",type:"url",helperText:"Optional URL to redirect the user to on form submission success",showIf:'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'},{name:"resetFormOnSubmit",type:"boolean",showIf:"options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",advanced:!0},{name:"successMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Thanks!</span>"}}}]},{name:"validate",type:"boolean",defaultValue:!0,advanced:!0},{name:"errorMessagePath",type:"text",advanced:!0,helperText:'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'},{name:"errorMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},bindings:{"component.options.text":"state.formErrorMessage || block.component.options.text"},component:{name:"Text",options:{text:"<span>Form submission error :( Please check your answers and try again</span>"}}}]},{name:"sendingMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Sending...</span>"}}}]},{name:"customHeaders",type:"map",valueType:{type:"string"},advanced:!0,showIf:'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'}],noWrap:!0,canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Enter your name</span>"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:Input",options:{name:"name",placeholder:"Jane Doe"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Enter your email</span>"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:Input",options:{name:"email",placeholder:"jane@doe.com"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:SubmitButton",options:{text:"Submit"}}}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},ge=r.lazy(()=>Promise.resolve().then(()=>require("./form-3d9bf265.cjs"))),he={name:"Form:Input",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",inputs:[{name:"type",type:"text",enum:["text","number","email","url","checkbox","radio","range","date","datetime-local","search","tel","time","file","month","week","password","color","hidden"],defaultValue:"text"},{name:"name",type:"string",required:!0,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:"placeholder",type:"string",defaultValue:"Hello there",helperText:"Text to display when there is no value"},{name:"defaultValue",type:"string"},{name:"value",type:"string",advanced:!0},{name:"required",type:"boolean",helperText:"Is this input required to be filled out to submit a form",defaultValue:!1}],noWrap:!0,static:!0,defaultStyles:{paddingTop:"10px",paddingBottom:"10px",paddingLeft:"10px",paddingRight:"10px",borderRadius:"3px",borderWidth:"1px",borderStyle:"solid",borderColor:"#ccc"}},be=r.lazy(()=>Promise.resolve().then(()=>require("./input-10e350a9.cjs"))),ye={name:"Form:Select",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",defaultStyles:{alignSelf:"flex-start"},inputs:[{name:"options",type:"list",required:!0,subFields:[{name:"value",type:"text",required:!0},{name:"name",type:"text"}],defaultValue:[{value:"option 1"},{value:"option 2"}]},{name:"name",type:"string",required:!0,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:"defaultValue",type:"string"},{name:"value",type:"string",advanced:!0},{name:"required",type:"boolean",defaultValue:!1}],static:!0,noWrap:!0},xe=r.lazy(()=>Promise.resolve().then(()=>require("./select-f11be7a7.cjs"))),ve={name:"Form:SubmitButton",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#3898EC",color:"white",borderRadius:"4px",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me"}],static:!0,noWrap:!0},Se=r.lazy(()=>Promise.resolve().then(()=>require("./submit-button-b363e0ed.cjs"))),Te={name:"Form:TextArea",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",inputs:[{advanced:!0,name:"value",type:"string"},{name:"name",type:"string",required:!0,helperText:'Every input in a form needs a unique name describing what it gets, e.g. "email"'},{name:"defaultValue",type:"string"},{name:"placeholder",type:"string",defaultValue:"Hello there"},{name:"required",type:"boolean",defaultValue:!1}],defaultStyles:{paddingTop:"10px",paddingBottom:"10px",paddingLeft:"10px",paddingRight:"10px",borderRadius:"3px",borderWidth:"1px",borderStyle:"solid",borderColor:"#ccc"},static:!0,noWrap:!0},Ie=r.lazy(()=>Promise.resolve().then(()=>require("./textarea-56a875bc.cjs"))),ke={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:N,required:!0}],noWrap:!0,static:!0},Ce=r.lazy(()=>Promise.resolve().then(()=>require("./img-102acaa2.cjs"))),we={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:te,bubble:!0,defaultValue:"https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",required:!0},{name:"posterImage",type:"file",allowedFileTypes:N,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}],shouldReceiveBuilderProps:{builderBlock:!0}},Ee=()=>[{component:ce,...ue},{component:pe,...me},{component:ge,...fe},{component:be,...he},{component:Se,...ve},{component:xe,...ye},{component:Ie,...Te},{component:Ce,...ke},{component:k.Video,...we}],$=()=>[{component:k.Button,...X},{component:k.Columns,...Z},{component:k.Fragment,...ee},{component:k.Image,...ne},{component:k.Section,...ae},{component:oe,...ie},{component:k.Symbol,...re},{component:k.Text,...de},{component:se,...le},{component:Q,...G},...Ee()],Ve=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
2
|
+
function getAndSetVariantId() {
|
|
3
|
+
function setCookie(name, value, days) {
|
|
4
|
+
let expires = '';
|
|
5
|
+
if (days) {
|
|
6
|
+
const date = new Date();
|
|
7
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
8
|
+
expires = '; expires=' + date.toUTCString();
|
|
9
|
+
}
|
|
10
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
|
|
11
|
+
}
|
|
12
|
+
function getCookie(name) {
|
|
13
|
+
const nameEQ = name + '=';
|
|
14
|
+
const ca = document.cookie.split(';');
|
|
15
|
+
for (let i = 0; i < ca.length; i++) {
|
|
16
|
+
let c = ca[i];
|
|
17
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
18
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const cookieName = \`builder.tests.\${contentId}\`;
|
|
23
|
+
const variantInCookie = getCookie(cookieName);
|
|
24
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
25
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
26
|
+
return variantInCookie;
|
|
27
|
+
}
|
|
28
|
+
let n = 0;
|
|
29
|
+
const random = Math.random();
|
|
30
|
+
for (let i = 0; i < variants.length; i++) {
|
|
31
|
+
const variant = variants[i];
|
|
32
|
+
const testRatio = variant.testRatio;
|
|
33
|
+
n += testRatio;
|
|
34
|
+
if (random < n) {
|
|
35
|
+
setCookie(cookieName, variant.id);
|
|
36
|
+
return variant.id;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
setCookie(cookieName, contentId);
|
|
40
|
+
return contentId;
|
|
41
|
+
}
|
|
42
|
+
const winningVariantId = getAndSetVariantId();
|
|
43
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
44
|
+
if (isHydrationTarget) {
|
|
45
|
+
styleEl.remove();
|
|
46
|
+
const thisScriptEl = document.currentScript;
|
|
47
|
+
thisScriptEl?.remove();
|
|
48
|
+
} else {
|
|
49
|
+
const newStyleStr = variants.concat({
|
|
50
|
+
id: contentId
|
|
51
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
52
|
+
return \`.variant-\${value.id} { display: none; }
|
|
53
|
+
\`;
|
|
54
|
+
}).join('');
|
|
55
|
+
styleEl.innerHTML = newStyleStr;
|
|
56
|
+
}
|
|
57
|
+
}`,Re=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
58
|
+
if (!navigator.cookieEnabled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
function getCookie(name) {
|
|
62
|
+
const nameEQ = name + '=';
|
|
63
|
+
const ca = document.cookie.split(';');
|
|
64
|
+
for (let i = 0; i < ca.length; i++) {
|
|
65
|
+
let c = ca[i];
|
|
66
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
67
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const cookieName = \`builder.tests.\${defaultContentId}\`;
|
|
72
|
+
const winningVariant = getCookie(cookieName);
|
|
73
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
74
|
+
const isDefaultContent = variantContentId === defaultContentId;
|
|
75
|
+
const isWinningVariant = winningVariant === variantContentId;
|
|
76
|
+
if (isWinningVariant && !isDefaultContent) {
|
|
77
|
+
parentDiv?.removeAttribute('hidden');
|
|
78
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
79
|
+
} else if (!isWinningVariant && isDefaultContent) {
|
|
80
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
81
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
82
|
+
}
|
|
83
|
+
if (isHydrationTarget) {
|
|
84
|
+
if (!isWinningVariant) {
|
|
85
|
+
parentDiv?.remove();
|
|
86
|
+
}
|
|
87
|
+
const thisScriptEl = document.currentScript;
|
|
88
|
+
thisScriptEl?.remove();
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}`,M="builderIoAbTest",J="builderIoRenderContent",D=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),Fe=({canTrack:e,content:t})=>!(!(D(t).length>0)||!e||s.isBrowser()),Pe=e=>e==="react"||e==="reactNative",Y=Pe(s.TARGET),Ae=()=>`
|
|
92
|
+
window.${M} = ${Ve}
|
|
93
|
+
window.${J} = ${Re}
|
|
94
|
+
`,We=(e,t)=>`
|
|
95
|
+
window.${M}(
|
|
96
|
+
"${t}",${JSON.stringify(e)}, ${Y}
|
|
97
|
+
)`,Be=({contentId:e,variationId:t})=>`window.${J}(
|
|
98
|
+
"${t}", "${e}", ${Y}
|
|
99
|
+
)`;function j(e){return f.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id,nonce:e.nonce||""})}function _(e){return Math.round(e*1e3)/1e3}const De=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},qe=e=>De(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),z=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,d=e.clientY-n.top,m=_(i/n.width),a=_(d/n.height);return{x:m,y:a}},He=e=>{const t=e.target,n=t&&qe(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?z({event:e,target:t}):void 0,builderTargetOffset:n?z({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},Ue=["svelte","qwik","vue"],K=()=>Ue.includes(s.TARGET)&&(s.isEditing()||s.isPreviewing()),Le=e=>{var m,a;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(a=e.fileUrl)!=null?a:(m=e==null?void 0:e.files)==null?void 0:m.regular;let d="";if(i&&t&&n&&(d+=`
|
|
100
|
+
@font-face {
|
|
101
|
+
font-family: "${t}";
|
|
102
|
+
src: local("${n}"), url('${i}') format('woff2');
|
|
103
|
+
font-display: fallback;
|
|
104
|
+
font-weight: 400;
|
|
105
|
+
}
|
|
106
|
+
`.trim()),e.files)for(const o in e.files){if(!(String(Number(o))===o))continue;const I=e.files[o];I&&I!==i&&(d+=`
|
|
107
|
+
@font-face {
|
|
108
|
+
font-family: "${t}";
|
|
109
|
+
src: url('${I}') format('woff2');
|
|
110
|
+
font-display: fallback;
|
|
111
|
+
font-weight: ${o};
|
|
112
|
+
}
|
|
113
|
+
`.trim())}return d},je=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>Le(n)))==null?void 0:t.join(" "))||""},Ne=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",$e=`
|
|
114
|
+
.builder-button {
|
|
115
|
+
all: unset;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
119
|
+
margin: 0;
|
|
120
|
+
}
|
|
121
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
122
|
+
color: inherit;
|
|
123
|
+
line-height: inherit;
|
|
124
|
+
letter-spacing: inherit;
|
|
125
|
+
font-weight: inherit;
|
|
126
|
+
font-size: inherit;
|
|
127
|
+
text-align: inherit;
|
|
128
|
+
font-family: inherit;
|
|
129
|
+
}
|
|
130
|
+
`,_e=e=>e?"":$e,ze=e=>`variant-${e}`;function Ke(e){var y,x,w;const t=r.useRef(null);function n(u){var g,b;const c={...e.builderContextSignal.rootState,...u};e.builderContextSignal.rootSetState?(b=(g=e.builderContextSignal).rootSetState)==null||b.call(g,c):e.setBuilderContextSignal(l=>({...l,rootState:c}))}function i(u){var g,b,l,h,v;const c={...e.builderContextSignal.content,...u,data:{...(g=e.builderContextSignal.content)==null?void 0:g.data,...u==null?void 0:u.data},meta:{...(b=e.builderContextSignal.content)==null?void 0:b.meta,...u==null?void 0:u.meta,breakpoints:((l=u==null?void 0:u.meta)==null?void 0:l.breakpoints)||((v=(h=e.builderContextSignal.content)==null?void 0:h.meta)==null?void 0:v.breakpoints)}};e.setBuilderContextSignal(S=>({...S,content:c}))}function d(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[m,a]=r.useState(()=>e.contentWrapper||"div");function o(u){return s.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:c=>{var l;const{breakpoints:g,contentId:b}=c;!b||b!==((l=e.builderContextSignal.content)==null?void 0:l.id)||g&&i({meta:{breakpoints:g}})},animation:c=>{E.triggerAnimation(c)},contentUpdate:c=>{i(c)}}})(u)}const[p,I]=r.useState(()=>({})),[T,R]=r.useState(()=>({})),[C,P]=r.useState(()=>!1);function A(u){var c,g;if(e.builderContextSignal.content){const b=(c=e.builderContextSignal.content)==null?void 0:c.testVariationId,l=(g=e.builderContextSignal.content)==null?void 0:g.id;s._track({apiHost:e.apiHost,type:"click",canTrack:s.getDefaultCanTrack(e.canTrack),contentId:l,apiKey:e.apiKey,variationId:b!==l?b:void 0,...He(u),unique:!C})}C||P(!0)}function W(){var c,g,b;const u=(b=(g=(c=e.builderContextSignal.content)==null?void 0:c.data)==null?void 0:g.httpRequests)!=null?b:{};Object.entries(u).forEach(([l,h])=>{if(!h||T[l]||p[l]&&!s.isEditing())return;T[l]=!0;const v=h.replace(/{{([^}]+)}}/g,(S,B)=>String(E.evaluate({code:B,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));s.logFetch(v),fetch(v).then(S=>S.json()).then(S=>{n({[l]:S}),p[l]=!0}).catch(S=>{console.error("error fetching dynamic data",h,S)}).finally(()=>{T[l]=!1})})}function V(){s.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:E.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const F=r.useRef(!1);return F.current||(W(),V(),F.current=!0),r.useEffect(()=>{var u,c,g;if(s.isBrowser()){if(s.isEditing()&&!e.isNestedRender&&(window.addEventListener("message",o),s.registerInsertMenu(),s.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(l=>{var h,v;if(!e.model||!((h=l.models)!=null&&h.length)||l.models.includes(e.model)){const S=s.createRegisterComponentMessage(l);(v=window.parent)==null||v.postMessage(S,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",V)),e.builderContextSignal.content&&s.getDefaultCanTrack(e.canTrack)){const l=(u=e.builderContextSignal.content)==null?void 0:u.testVariationId,h=(c=e.builderContextSignal.content)==null?void 0:c.id,v=e.apiKey;s._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:h,apiKey:v,variationId:l!==h?l:void 0})}if(s.isPreviewing()&&!s.isEditing()){const l=new URL(location.href).searchParams,h=l.get("builder.preview"),v=l.get(`builder.overrides.${h}`),S=l.get("apiKey")||l.get("builder.space");(h==="BUILDER_STUDIO"||h===e.model&&S===e.apiKey&&(!e.content||v===e.content.id))&&s.fetchOneEntry({model:e.model||"",apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...h==="BUILDER_STUDIO"&&((g=e.context)!=null&&g.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(B=>{B&&i(B)})}}},[]),r.useEffect(()=>{e.content&&i(e.content)},[e.content]),r.useEffect(()=>{V()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&n(e.data)},[e.data]),r.useEffect(()=>{e.locale&&n({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{s.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",V))},[]),f.jsx(k.BuilderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||K()?f.jsx(m,{ref:t,onClick:u=>A(u),"builder-content-id":(y=e.builderContextSignal.content)==null?void 0:y.id,"builder-model":e.model,className:ze(((x=e.content)==null?void 0:x.testVariationId)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&K()?"none":void 0},...d(),...e.contentWrapperProps,children:e.children}):null})}function Oe(e){const[t,n]=r.useState(()=>`
|
|
131
|
+
${Ne({cssCode:e.cssCode,contentId:e.contentId})}
|
|
132
|
+
${je({customFonts:e.customFonts})}
|
|
133
|
+
${_e(e.isNestedRender)}
|
|
134
|
+
`.trim());return f.jsx(E.InlinedStyles,{id:"builderio-content",styles:t,nonce:e.nonce})}const Me=({content:e,data:t,locale:n})=>{var m,a,o;const i={},d=((m=e==null?void 0:e.data)==null?void 0:m.state)||{};return(o=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||o.forEach(p=>{p.name&&p.defaultValue!==void 0&&(i[p.name]=p.defaultValue)}),{...i,...d,...t,...n?{locale:n}:{}}},Je=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function O(e){var I,T,R,C,P,A,W,V,F;const[t,n]=r.useState(()=>{var y,x;return Be({variationId:(y=e.content)==null?void 0:y.testVariationId,contentId:(x=e.content)==null?void 0:x.id})});function i(y){o(x=>({...x,rootState:y}))}const[d,m]=r.useState(()=>[...$(),...e.customComponents||[]].reduce((y,{component:x,...w})=>({...y,[w.name]:{component:x,...s.serializeIncludingFunctions(w)}}),{})),[a,o]=r.useState(()=>({content:Je({content:e.content,data:e.data}),localState:void 0,rootState:Me({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...$(),...e.customComponents||[]].reduce((y,{component:x,...w})=>({...y,[w.name]:s.serializeIncludingFunctions(w)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model||""})),p=r.useRef(!1);if(!p.current){e.apiKey||s.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const y=(T=(I=a.content)==null?void 0:I.data)==null?void 0:T.jsCode;y&&E.evaluate({code:y,context:e.context||{},localState:void 0,rootState:a.rootState,rootSetState:x=>{Object.assign(a.rootState,x)},isExpression:!1}),p.current=!0}return f.jsx(E.ComponentsContext.Provider,{value:{registeredComponents:d},children:f.jsxs(Ke,{apiHost:e.apiHost,nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:a,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,setBuilderContextSignal:o,children:[e.isSsrAbTest?f.jsx(j,{id:"builderio-variant-visibility",scriptStr:t,nonce:e.nonce||""}):null,f.jsx(Oe,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(R=a.content)==null?void 0:R.id,cssCode:(P=(C=a.content)==null?void 0:C.data)==null?void 0:P.cssCode,customFonts:(W=(A=a.content)==null?void 0:A.data)==null?void 0:W.customFonts}),f.jsx(E.Blocks,{blocks:(F=(V=a.content)==null?void 0:V.data)==null?void 0:F.blocks,context:a,registeredComponents:d,linkComponent:e.linkComponent})]})})}function Ye(e){var a;const[t,n]=r.useState(()=>Fe({canTrack:s.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var o;return We(D(e.content).map(p=>({id:p.testVariationId,testRatio:p.testRatio})),((o=e.content)==null?void 0:o.id)||"")}function d(){return D(e.content).map(o=>`.variant-${o.testVariationId} { display: none; } `).join("")}function m(){var o;return t?{...e.content,testVariationId:(o=e.content)==null?void 0:o.id}:s.handleABTestingSync({item:e.content,canTrack:s.getDefaultCanTrack(e.canTrack)})}return r.useEffect(()=>{},[]),f.jsxs(f.Fragment,{children:[!e.isNestedRender&&s.TARGET!=="reactNative"?f.jsx(j,{id:"builderio-init-variants-fns",scriptStr:Ae(),nonce:e.nonce||""}):null,t?f.jsxs(f.Fragment,{children:[f.jsx(E.InlinedStyles,{id:"builderio-variants",styles:d(),nonce:e.nonce||""}),f.jsx(j,{id:"builderio-variants-visibility",scriptStr:i(),nonce:e.nonce||""}),(a=D(e.content))==null?void 0:a.map(o=>f.jsx(O,{apiHost:e.apiHost,isNestedRender:e.isNestedRender,nonce:e.nonce,content:o,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},o.testVariationId))]}):null,f.jsx(O,{apiHost:e.apiHost,nonce:e.nonce,isNestedRender:e.isNestedRender,content:m(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts})]})}exports.default=Ye;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),l=require("./blocks-cd946d16.cjs"),T=require("./server-entry-1879cbc4.cjs");require("./blocks-exports.cjs");require("./get-class-prop-name-29fd576a.cjs");require("./dynamic-renderer-b29b45ca.cjs");const A=["production","qa","test","development","dev","cdn-qa","cloud","fast","cdn2","cdn-prod"],B=()=>{const e=process.env.NODE_ENV||"production";return A.includes(e)?e:"production"};function O(e){var v,x;const o=h.useRef(null),[F,g]=h.useState(()=>"unsubmitted"),[y,S]=h.useState(()=>null),[J,q]=h.useState(()=>"");function N(r){var d,m;const a={...e.builderContext.rootState,...r};e.builderContext.rootSetState?(m=(d=e.builderContext).rootSetState)==null||m.call(d,a):e.builderContext.rootState=a}function f(){return T.isEditing()&&e.previewState||F}function w(r){var d;const a=e.sendWithJs||e.sendSubmissionsTo==="email";if(e.sendSubmissionsTo==="zapier")r.preventDefault();else if(a){if(!(e.action||e.sendSubmissionsTo==="email")){r.preventDefault();return}r.preventDefault();const m=r.currentTarget||r.target,E=e.customHeaders||{};let b;const P=new FormData(m),k=Array.from(m.querySelectorAll("input,select,textarea")).filter(t=>!!t.name).map(t=>{let n;const c=t.name;if(t instanceof HTMLInputElement)if(t.type==="radio"){if(t.checked)return n=t.name,{key:c,value:n}}else if(t.type==="checkbox")n=t.checked;else if(t.type==="number"||t.type==="range"){const i=t.valueAsNumber;isNaN(i)||(n=i)}else t.type==="file"?n=t.files:n=t.value;else n=t.value;return{key:c,value:n}});let u=e.contentType;if(e.sendSubmissionsTo==="email"&&(u="multipart/form-data"),Array.from(k).forEach(({value:t})=>{(t instanceof File||Array.isArray(t)&&t[0]instanceof File||t instanceof FileList)&&(u="multipart/form-data")}),u!=="application/json")b=P;else{const t={};Array.from(k).forEach(({value:n,key:c})=>{l.set(t,c,n)}),b=JSON.stringify(t)}u&&u!=="multipart/form-data"&&(a&&((d=e.action)!=null&&d.includes("zapier.com"))||(E["content-type"]=u));const C=new CustomEvent("presubmit",{detail:{body:b}});if(o.current&&(o.current.dispatchEvent(C),C.defaultPrevented))return;g("sending");const D=`${B()==="dev"?"http://localhost:5000":"https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(e.sendSubmissionsToEmail||"")}&name=${encodeURIComponent(e.name||"")}`,j=e.sendSubmissionsTo==="email"?D:e.action;T.logFetch(j),fetch(j,{body:b,headers:E,method:e.method||"post"}).then(async t=>{let n;const c=t.headers.get("content-type");if(c&&c.indexOf("application/json")!==-1?n=await t.json():n=await t.text(),!t.ok&&e.errorMessagePath){let i=l.get(n,e.errorMessagePath);i&&(typeof i!="string"&&(i=JSON.stringify(i)),q(i),N({formErrorMessage:i}))}if(S(n),g(t.ok?"success":"error"),t.ok){const i=new CustomEvent("submit:success",{detail:{res:t,body:n}});if(o.current){if(o.current.dispatchEvent(i),i.defaultPrevented)return;e.resetFormOnSubmit!==!1&&o.current.reset()}if(e.successUrl)if(o.current){const M=new CustomEvent("route",{detail:{url:e.successUrl}});o.current.dispatchEvent(M),M.defaultPrevented||(location.href=e.successUrl)}else location.href=e.successUrl}},t=>{const n=new CustomEvent("submit:error",{detail:{error:t}});o.current&&(o.current.dispatchEvent(n),n.defaultPrevented)||(S(t),g("error"))})}}return s.jsxs(s.Fragment,{children:[" ",s.jsxs("form",{validate:e.validate,ref:o,action:!e.sendWithJs&&e.action,method:e.method,name:e.name,onSubmit:r=>w(r),...e.attributes,children:[e.builderBlock&&e.builderBlock.children?s.jsx(s.Fragment,{children:(x=(v=e.builderBlock)==null?void 0:v.children)==null?void 0:x.map((r,a)=>s.jsx(l.Block,{block:r,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent},`form-block-${a}`))}):null,f()==="error"?s.jsx(l.Blocks,{path:"errorMessage",blocks:e.errorMessage,context:e.builderContext}):null,f()==="sending"?s.jsx(l.Blocks,{path:"sendingMessage",blocks:e.sendingMessage,context:e.builderContext}):null,f()==="error"&&y?s.jsx("pre",{className:"builder-form-error-text pre-135d4696",children:JSON.stringify(y,null,2)}):null,f()==="success"?s.jsx(l.Blocks,{path:"successMessage",blocks:e.successMessage,context:e.builderContext}):null]})," ",s.jsx("style",{children:".pre-135d4696 { padding: 10px; color: red; text-align: center; }"})," "]})}exports.default=O;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { jsxs as F, Fragment as N, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as O, useState as h } from "react";
|
|
3
|
-
import { Block as U, Blocks as g, set as B } from "./blocks-
|
|
4
|
-
import {
|
|
5
|
-
import { isEditing as $, logFetch as L } from "./server-entry-c793e7d2.js";
|
|
3
|
+
import { Block as U, Blocks as g, set as B, get as R } from "./blocks-27ac5b23.js";
|
|
4
|
+
import { isEditing as $, logFetch as L } from "./server-entry-7ce03a4e.js";
|
|
6
5
|
import "./blocks-exports.mjs";
|
|
7
|
-
import "./get-class-prop-name-
|
|
6
|
+
import "./get-class-prop-name-a4845b04.js";
|
|
8
7
|
import "./dynamic-renderer-8b343325.js";
|
|
9
8
|
const q = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"], W = () => {
|
|
10
9
|
const e = process.env.NODE_ENV || "production";
|
|
11
10
|
return q.includes(e) ? e : "production";
|
|
12
11
|
};
|
|
13
|
-
function
|
|
12
|
+
function X(e) {
|
|
14
13
|
var S, E;
|
|
15
14
|
const o = O(null), [w, b] = h(() => "unsubmitted"), [v, y] = h(() => null), [z, D] = h(() => "");
|
|
16
15
|
function P(r) {
|
|
17
|
-
var l,
|
|
16
|
+
var l, d;
|
|
18
17
|
const s = {
|
|
19
18
|
...e.builderContext.rootState,
|
|
20
19
|
...r
|
|
21
20
|
};
|
|
22
|
-
e.builderContext.rootSetState ? (
|
|
21
|
+
e.builderContext.rootSetState ? (d = (l = e.builderContext).rootSetState) == null || d.call(l, s) : e.builderContext.rootState = s;
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function m() {
|
|
25
24
|
return $() && e.previewState || w;
|
|
26
25
|
}
|
|
27
26
|
function A(r) {
|
|
@@ -35,9 +34,9 @@ function Y(e) {
|
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
36
|
r.preventDefault();
|
|
38
|
-
const
|
|
37
|
+
const d = r.currentTarget || r.target, x = e.customHeaders || {};
|
|
39
38
|
let f;
|
|
40
|
-
const j = new FormData(
|
|
39
|
+
const j = new FormData(d), C = Array.from(d.querySelectorAll("input,select,textarea")).filter((t) => !!t.name).map((t) => {
|
|
41
40
|
let n;
|
|
42
41
|
const a = t.name;
|
|
43
42
|
if (t instanceof HTMLInputElement)
|
|
@@ -139,7 +138,7 @@ function Y(e) {
|
|
|
139
138
|
},
|
|
140
139
|
`form-block-${s}`
|
|
141
140
|
)) }) : null,
|
|
142
|
-
|
|
141
|
+
m() === "error" ? /* @__PURE__ */ c(
|
|
143
142
|
g,
|
|
144
143
|
{
|
|
145
144
|
path: "errorMessage",
|
|
@@ -147,7 +146,7 @@ function Y(e) {
|
|
|
147
146
|
context: e.builderContext
|
|
148
147
|
}
|
|
149
148
|
) : null,
|
|
150
|
-
|
|
149
|
+
m() === "sending" ? /* @__PURE__ */ c(
|
|
151
150
|
g,
|
|
152
151
|
{
|
|
153
152
|
path: "sendingMessage",
|
|
@@ -155,8 +154,8 @@ function Y(e) {
|
|
|
155
154
|
context: e.builderContext
|
|
156
155
|
}
|
|
157
156
|
) : null,
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
m() === "error" && v ? /* @__PURE__ */ c("pre", { className: "builder-form-error-text pre-135d4696", children: JSON.stringify(v, null, 2) }) : null,
|
|
158
|
+
m() === "success" ? /* @__PURE__ */ c(
|
|
160
159
|
g,
|
|
161
160
|
{
|
|
162
161
|
path: "successMessage",
|
|
@@ -173,5 +172,5 @@ function Y(e) {
|
|
|
173
172
|
] });
|
|
174
173
|
}
|
|
175
174
|
export {
|
|
176
|
-
|
|
175
|
+
X as default
|
|
177
176
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./server-entry-
|
|
1
|
+
"use strict";const e=require("./server-entry-1879cbc4.cjs"),s=()=>{switch(e.TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":case"angular":return"class"}};exports.getClassPropName=s;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useEffect as
|
|
1
|
+
import { jsxs as f, Fragment as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as y } from "react";
|
|
3
3
|
function x(e) {
|
|
4
4
|
return e.replace(/http(s)?:/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
const n = new RegExp("([?&])" + i + "=.*?(&|$)", "i"),
|
|
8
|
-
return e.match(n) ? e.replace(n, "$1" + i + "=" + encodeURIComponent(t) + "$2") : e +
|
|
6
|
+
function v(e = "", i, t) {
|
|
7
|
+
const n = new RegExp("([?&])" + i + "=.*?(&|$)", "i"), c = e.indexOf("?") !== -1 ? "&" : "?";
|
|
8
|
+
return e.match(n) ? e.replace(n, "$1" + i + "=" + encodeURIComponent(t) + "$2") : e + c + i + "=" + encodeURIComponent(t);
|
|
9
9
|
}
|
|
10
10
|
function $(e, i) {
|
|
11
11
|
if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !i)
|
|
@@ -14,38 +14,38 @@ function $(e, i) {
|
|
|
14
14
|
return x(e);
|
|
15
15
|
const t = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
16
16
|
if (t) {
|
|
17
|
-
const n = e.split(t[0]),
|
|
18
|
-
return x(`${n[0]}_${r}${
|
|
17
|
+
const n = e.split(t[0]), c = t[3], r = i.match("x") ? i : `${i}x`;
|
|
18
|
+
return x(`${n[0]}_${r}${c}`);
|
|
19
19
|
}
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function m(e) {
|
|
23
23
|
if (!e)
|
|
24
24
|
return e;
|
|
25
25
|
const i = [100, 200, 400, 800, 1200, 1600, 2e3];
|
|
26
26
|
if (e.match(/builder\.io/)) {
|
|
27
27
|
let t = e;
|
|
28
28
|
const n = Number(e.split("?width=")[1]);
|
|
29
|
-
return isNaN(n) || (t = `${t} ${n}w`), i.filter((
|
|
29
|
+
return isNaN(n) || (t = `${t} ${n}w`), i.filter((c) => c !== n).map((c) => `${v(e, "width", c)} ${c}w`).concat([t]).join(", ");
|
|
30
30
|
}
|
|
31
31
|
return e.match(/cdn\.shopify\.com/) ? i.map((t) => [$(e, `${t}x${t}`), t]).filter(([t]) => !!t).map(([t, n]) => `${t} ${n}w`).concat([e]).join(", ") : e;
|
|
32
32
|
}
|
|
33
33
|
function R(e) {
|
|
34
|
-
var
|
|
34
|
+
var c, r, u, h, s, g;
|
|
35
35
|
function i() {
|
|
36
36
|
var b;
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const a = e.image || e.src;
|
|
38
|
+
if (!a || // We can auto add srcset for cdn.builder.io and shopify
|
|
39
39
|
// images, otherwise you can supply this prop manually
|
|
40
|
-
!(
|
|
40
|
+
!(typeof a == "string" && (a.match(/builder\.io/) || a.match(/cdn\.shopify\.com/))))
|
|
41
41
|
return e.srcset;
|
|
42
42
|
if (!e.noWebp) {
|
|
43
43
|
if (e.srcset && ((b = e.image) != null && b.includes("builder.io/api/v1/image"))) {
|
|
44
44
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
45
|
-
return console.debug("Removed given srcset"),
|
|
45
|
+
return console.debug("Removed given srcset"), m(a);
|
|
46
46
|
} else if (e.image && !e.srcset)
|
|
47
|
-
return
|
|
48
|
-
return
|
|
47
|
+
return m(a);
|
|
48
|
+
return m(a);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function t() {
|
|
@@ -62,10 +62,10 @@ function R(e) {
|
|
|
62
62
|
};
|
|
63
63
|
return e.aspectRatio ? l : void 0;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
66
|
-
}, []), /* @__PURE__ */ d
|
|
67
|
-
/* @__PURE__ */ d
|
|
68
|
-
/* @__PURE__ */
|
|
65
|
+
return y(() => {
|
|
66
|
+
}, []), /* @__PURE__ */ f(d, { children: [
|
|
67
|
+
/* @__PURE__ */ f(d, { children: [
|
|
68
|
+
/* @__PURE__ */ f("picture", { children: [
|
|
69
69
|
t() ? /* @__PURE__ */ o("source", { type: "image/webp", srcSet: t() }) : null,
|
|
70
70
|
/* @__PURE__ */ o(
|
|
71
71
|
"img",
|
|
@@ -79,33 +79,33 @@ function R(e) {
|
|
|
79
79
|
objectFit: e.backgroundSize || "cover",
|
|
80
80
|
...n()
|
|
81
81
|
},
|
|
82
|
-
className: "builder-image" + (e.className ? " " + e.className : "") + " img-
|
|
82
|
+
className: "builder-image" + (e.className ? " " + e.className : "") + " img-c071ff08",
|
|
83
83
|
src: e.image,
|
|
84
84
|
srcSet: i(),
|
|
85
85
|
sizes: e.sizes
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
] }),
|
|
89
|
-
e.aspectRatio && !((r = (
|
|
89
|
+
e.aspectRatio && !((r = (c = e.builderBlock) == null ? void 0 : c.children) != null && r.length && e.fitContent) ? /* @__PURE__ */ o(
|
|
90
90
|
"div",
|
|
91
91
|
{
|
|
92
|
-
className: "builder-image-sizer div-
|
|
92
|
+
className: "builder-image-sizer div-c071ff08",
|
|
93
93
|
style: {
|
|
94
94
|
paddingTop: e.aspectRatio * 100 + "%"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
) : null,
|
|
98
|
-
(h = (u = e.builderBlock) == null ? void 0 : u.children) != null && h.length && e.fitContent ? /* @__PURE__ */ o(
|
|
99
|
-
!e.fitContent && ((g = (s = e.builderBlock) == null ? void 0 : s.children) != null && g.length) ? /* @__PURE__ */ o("div", { className: "div-
|
|
98
|
+
(h = (u = e.builderBlock) == null ? void 0 : u.children) != null && h.length && e.fitContent ? /* @__PURE__ */ o(d, { children: e.children }) : null,
|
|
99
|
+
!e.fitContent && ((g = (s = e.builderBlock) == null ? void 0 : s.children) != null && g.length) ? /* @__PURE__ */ o("div", { className: "div-c071ff08-2", children: e.children }) : null
|
|
100
100
|
] }),
|
|
101
|
-
/* @__PURE__ */ o("style", { children: `.img-
|
|
101
|
+
/* @__PURE__ */ o("style", { children: `.img-c071ff08 {
|
|
102
102
|
opacity: 1;
|
|
103
103
|
transition: opacity 0.2s ease-in-out;
|
|
104
|
-
}.div-
|
|
104
|
+
}.div-c071ff08 {
|
|
105
105
|
width: 100%;
|
|
106
106
|
pointer-events: none;
|
|
107
107
|
font-size: 0;
|
|
108
|
-
}.div-
|
|
108
|
+
}.div-c071ff08-2 {
|
|
109
109
|
display: flex;
|
|
110
110
|
flex-direction: column;
|
|
111
111
|
align-items: stretch;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("react");function g(e){return e.replace(/http(s)?:/,"")}function x(e="",i,t){const n=new RegExp("([?&])"+i+"=.*?(&|$)","i"),a=e.indexOf("?")!==-1?"&":"?";return e.match(n)?e.replace(n,"$1"+i+"="+encodeURIComponent(t)+"$2"):e+a+i+"="+encodeURIComponent(t)}function y(e,i){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!i)return e;if(i==="master")return g(e);const t=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(t){const n=e.split(t[0]),a=t[3],r=i.match("x")?i:`${i}x`;return g(`${n[0]}_${r}${a}`)}return null}function f(e){if(!e)return e;const i=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let t=e;const n=Number(e.split("?width=")[1]);return isNaN(n)||(t=`${t} ${n}w`),i.filter(a=>a!==n).map(a=>`${x(e,"width",a)} ${a}w`).concat([t]).join(", ")}return e.match(/cdn\.shopify\.com/)?i.map(t=>[y(e,`${t}x${t}`),t]).filter(([t])=>!!t).map(([t,n])=>`${t} ${n}w`).concat([e]).join(", "):e}function j(e){var a,r,s,d,u,m;function i(){var h;const o=e.image||e.src;if(!o||!(typeof o=="string"&&(o.match(/builder\.io/)||o.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),f(o)}else if(e.image&&!e.srcset)return f(o);return f(o)}}function t(){var l;return(l=i==null?void 0:i())!=null&&l.match(/builder\.io/)&&!e.noWebp?i().replace(/\?/g,"?format=webp&"):""}function n(){const l={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?l:void 0}return b.useEffect(()=>{},[]),c.jsxs(c.Fragment,{children:[c.jsxs(c.Fragment,{children:[c.jsxs("picture",{children:[t()?c.jsx("source",{type:"image/webp",srcSet:t()}):null,c.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...n()},className:"builder-image"+(e.className?" "+e.className:"")+" img-c071ff08",src:e.image,srcSet:i(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(a=e.builderBlock)==null?void 0:a.children)!=null&&r.length&&e.fitContent)?c.jsx("div",{className:"builder-image-sizer div-c071ff08",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(d=(s=e.builderBlock)==null?void 0:s.children)!=null&&d.length&&e.fitContent?c.jsx(c.Fragment,{children:e.children}):null,!e.fitContent&&((m=(u=e.builderBlock)==null?void 0:u.children)!=null&&m.length)?c.jsx("div",{className:"div-c071ff08-2",children:e.children}):null]}),c.jsx("style",{children:`.img-c071ff08 {
|
|
2
|
+
opacity: 1;
|
|
3
|
+
transition: opacity 0.2s ease-in-out;
|
|
4
|
+
}.div-c071ff08 {
|
|
5
|
+
width: 100%;
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
font-size: 0;
|
|
8
|
+
}.div-c071ff08-2 {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}`})]})}exports.default=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("./server-entry-1879cbc4.cjs");function n(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},i.isEditing()&&e.imgSrc||"default-key")}exports.default=n;
|
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-1879cbc4.cjs");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as o, BuilderContext as i, Button as s, Columns as n, Content as c, Fragment as g, Image as m, Section as a, Symbol as d, Text as l, Video as u } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as C, fetchEntries as E, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as b, register as P, setEditorSettings as k, subscribeToEditor as y, track as R } from "./server-entry-
|
|
2
|
+
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as C, fetchEntries as E, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as b, register as P, setEditorSettings as k, subscribeToEditor as y, track as R } from "./server-entry-7ce03a4e.js";
|
|
3
3
|
import "react";
|
|
4
4
|
export {
|
|
5
5
|
o as Blocks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("./server-entry-1879cbc4.cjs");function a(e){return t.createElement("input",{...e.attributes,key:u.isEditing()&&e.defaultValue?e.defaultValue:"default-key",placeholder:e.placeholder,type:e.type,name:e.name,value:e.value,defaultValue:e.defaultValue,required:e.required})}exports.default=a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as m } from "react";
|
|
3
|
-
import { isEditing as n } from "./server-entry-
|
|
3
|
+
import { isEditing as n } from "./server-entry-7ce03a4e.js";
|
|
4
4
|
function r(e) {
|
|
5
5
|
var t;
|
|
6
6
|
return /* @__PURE__ */ m(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),r=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),r=require("./server-entry-1879cbc4.cjs");function i(e){var u;return n.createElement("select",{...e.attributes,value:e.value,key:r.isEditing()&&e.defaultValue?e.defaultValue:"default-key",defaultValue:e.defaultValue,name:e.name,required:e.required},(u=e.options)==null?void 0:u.map((t,a)=>l.jsx("option",{value:t.value,children:t.name||t.value},`${t.name}-${a}`)))}exports.default=i;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const w="react",gt=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},M=t=>t instanceof URLSearchParams?gt(t):t,N=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function c(){return typeof window!="undefined"&&typeof document!="undefined"}function pt(){return c()&&window.self!==window.top}function K(t){return pt()&&N(t||window.location.search).indexOf("builder.frameEditing=")!==-1}function mt(t){const e=t||(c()?window.location.search:void 0);return e?N(e).indexOf("builder.preview=")!==-1:!1}const yt=t=>({type:"builder.registerComponent",data:P(t)}),wt=t=>{const e=t.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!n?"function ":""}${e}).apply(this, arguments)`};function P(t){return JSON.parse(JSON.stringify(t,(e,n)=>typeof n=="function"?wt(n):n))}const U={};function j(t,e){t==="plugin"&&(e=P(e));let n=U[t];if(n||(n=U[t]=[]),n.push(e),c()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(s){console.debug("Could not postmessage",s)}}}const L={};function St(t){if(c()){Object.assign(L,t);const e={type:"builder.settingsChange",data:L};parent.postMessage(e,"*")}}const F="builder.",bt="options.",O=t=>{if(!t)return{};const e=M(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(F)){const s=r.replace(F,"").replace(bt,"");n[s]=e[r]}}),n},vt=()=>{if(!c())return{};const t=new URLSearchParams(window.location.search);return O(t)},I="[Builder.io]: ",d={log:(...t)=>console.log(I,...t),error:(...t)=>console.error(I,...t),warn:(...t)=>console.warn(I,...t),debug:(...t)=>console.debug(I,...t)},W="3.0.2",_=()=>({"X-Builder-SDK":w,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":W}),p=t=>t!=null,It=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},$=({name:t,canTrack:e})=>{var n;try{return e?(n=document.cookie.split("; ").find(r=>r.startsWith(`${t}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},G=async t=>$(t),kt=t=>t.map(([e,n])=>n?`${e}=${n}`:e).filter(p).join("; "),Et=[["secure",""],["SameSite","None"]],At=({name:t,value:e,expires:n})=>{const s=(c()?location.protocol==="https:":!0)?Et:[[]],o=n?[["expires",n.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",It(window.location.hostname)],...s];return kt(i)},z=async({name:t,value:e,expires:n,canTrack:r})=>{try{if(!r)return;const s=At({name:t,value:e,expires:n});document.cookie=s}catch(s){d.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Pt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function H(){return Pt().replace(/-/g,"")}const J="builderSessionId",Ot=async({canTrack:t})=>{if(!t)return;const e=await G({name:J,canTrack:t});if(p(e))return e;{const n=Ct();return Tt({id:n,canTrack:t}),n}},Ct=()=>H(),Tt=({id:t,canTrack:e})=>z({name:J,value:t,canTrack:e}),X=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,xt=({key:t,canTrack:e})=>{var n;try{return e?(n=X())==null?void 0:n.getItem(t):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Bt=({key:t,canTrack:e,value:n})=>{var r;try{e&&((r=X())==null||r.setItem(t,n))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},Q="builderVisitorId",Rt=({canTrack:t})=>{if(!t)return;const e=xt({key:Q,canTrack:t});if(p(e))return e;{const n=Ut();return Lt({id:n,canTrack:t}),n}},Ut=()=>H(),Lt=({id:t,canTrack:e})=>Bt({key:Q,value:t,canTrack:e});function Y(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(t)}const Ft=()=>{if(c()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Vt=()=>typeof navigator=="object"&&navigator.userAgent||"",Z=()=>{const t=Vt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||w==="reactNative"}},n=t.match(/Tablet|iPad/i),r=Ft();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},Dt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await Ot({canTrack:t}),n=Rt({canTrack:t});return{sessionId:e,visitorId:n}},Mt=async({type:t,canTrack:e,apiKey:n,metadata:r,...s})=>({type:t,data:{...s,metadata:{url:location.href,...r},...await Dt({canTrack:e}),userAttributes:Z(),ownerId:n}});async function q({apiHost:t,...e}){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||K()||!(c()||w==="reactNative"))return;const r=`${t||"https://cdn.builder.io"}/api/v1/track`;return Y(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await Mt(e)]}),headers:{"content-type":"application/json",..._()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const Nt=t=>q({...t,canTrack:!0}),Kt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function tt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const n=new URL(e.origin),r=n.hostname;return(t||Kt).findIndex(s=>s.startsWith("*.")?r.endsWith(s.slice(1)):s===r)>-1}const jt=()=>{j("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 V=!1;const et=(t={})=>{var e,n;V||(V=!0,c()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:w,version:W,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",r=>{var o,i;if(!tt(t.trustedHosts,r))return;const{data:s}=r;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,S=s.data.arguments||[],m=s.data.id,k=new Function(u);let l,h=null;try{l=k.apply(null,S)}catch(g){h=g}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:m,error:h.message}},"*"):l&&typeof l.then=="function"?l.then(g=>{var b;(b=window.parent)==null||b.postMessage({type:"builder.evaluateResult",data:{id:m,result:g}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:m}},"*");break}}})))},nt=({model:t,trustedHosts:e,callbacks:n})=>r=>{if(!tt(e,r))return;const{data:s}=r;if(s)switch(s.type){case"builder.configureSdk":{n.configureSdk(s.data);break}case"builder.triggerAnimation":{n.animation(s.data);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data;i===t&&n.contentUpdate(u);break}}},Wt=(t,e,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};et();const r=nt({callbacks:{contentUpdate:e,animation:()=>{},configureSdk:()=>{}},model:t,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},_t="builder.tests",C=t=>`${_t}.${t}`,$t=({contentId:t})=>G({name:C(t),canTrack:!0}),Gt=({contentId:t})=>$({name:C(t),canTrack:!0}),zt=({contentId:t,value:e})=>z({name:C(t),value:e,canTrack:!0}),rt=t=>p(t.id)&&p(t.variations)&&Object.keys(t.variations).length>0,Ht=({id:t,variations:e})=>{var s;let n=0;const r=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(n+=i,r<n)return o}return t},st=t=>{const e=Ht(t);return zt({contentId:t.id,value:e}).catch(n=>{d.error("could not store A/B test variation: ",n)}),e},ot=({item:t,testGroupId:e})=>{const n=t.variations[e];return e===t.id||!n?{testVariationId:t.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===t.id?"Default":"")}},Jt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!rt(t))return t;const n=Gt({contentId:t.id})||st({variations:t.variations,id:t.id}),r=ot({item:t,testGroupId:n});return{...t,...r}},Xt=async({item:t,canTrack:e})=>{if(!e||!rt(t))return t;const r=await $t({contentId:t.id})||st({variations:t.variations,id:t.id}),s=ot({item:t,testGroupId:r});return{...t,...s}},it=t=>p(t)?t:!0;function Qt(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Yt(){const t=Qt().fetch;if(typeof t=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return t}const Zt=Yt();function A(t,e=null,n="."){return Object.keys(t).reduce((r,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(n);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...r,...A(o,i,n)}:{...r,[i]:o}},{})}function at(t,e,n={}){for(const r in t){const s=t[r],o=e?e+"."+r:r;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?at(s,o,n):n[o]=s}return n}function qt(t){const e={};for(const n in t){const r=n.split(".");let s=e;for(let o=0;o<r.length;o++){const i=r[o];o===r.length-1?s[i]=t[n]:(s[i]=s[i]||{},s=s[i])}}return e}const te="v3",D=t=>typeof t=="number"&&!isNaN(t)&&t>=0,T=t=>{const{limit:e=30,userAttributes:n,query:r,model:s,apiKey:o,enrich:i,locale:u,apiVersion:S=te,fields:m,omit:k,offset:l,cacheSeconds:h,staleCacheSeconds:g,sort:b,includeUnpublished:x,apiHost:dt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ft=e!==1,ht=dt||"https://cdn.builder.io",a=new URL(`${ht}/api/${S}/content/${s}`);a.searchParams.set("apiKey",o),a.searchParams.set("limit",String(e)),a.searchParams.set("noTraverse",String(ft)),a.searchParams.set("includeRefs",String(!0));const E=u||(n==null?void 0:n.locale);let y=n||{};if(E&&(a.searchParams.set("locale",E),y={locale:E,...y}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",k||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof x=="boolean"&&a.searchParams.set("includeUnpublished",String(x)),h&&D(h)&&a.searchParams.set("cacheSeconds",String(h)),g&&D(g)&&a.searchParams.set("staleCacheSeconds",String(g)),b){const f=A({sort:b});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}const B={...vt(),...M(t.options||{})};y={...y,...ne(B)};const R=A(B);for(const f in R)a.searchParams.set(f,String(R[f]));if(Object.keys(y).length>0&&a.searchParams.set("userAttributes",JSON.stringify(y)),r){const f=at({query:r});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}return a},ee=t=>{const e={};for(const n in t)n.startsWith("userAttributes.")&&(e[n]=t[n],delete t[n]);return e},ne=t=>{if(c()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=ee(t),{userAttributes:n}=qt(e);return n}return{}},re=t=>"results"in t;async function ct(t){const e=await lt({...t,limit:1});return e&&e[0]||null}const se=async t=>{var i,u;const e=T(t),n=(i=t.fetch)!=null?i:Zt,r={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,..._()}};return await(await n(e.href,r)).json()},ut=async(t,e,n=T(t))=>{const r=it(t.canTrack);if(n.search.includes("preview="),!r||!(c()||w==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await Xt({item:o,canTrack:r}));e.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return e.results};async function lt(t){const e=T(t),n=await se(t);if(!re(n))throw d.error("Error fetching data. ",{url:e,content:n,options:t}),n;return ut(t,n)}const oe=async t=>{var r,s,o;const e=t.path||((r=t.url)==null?void 0:r.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),n={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:O(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:n.apiKey,model:n.model,content:await ct(n)}};exports.TARGET=w;exports._processContentResult=ut;exports._track=q;exports.checkIsDefined=p;exports.createEditorListener=nt;exports.createRegisterComponentMessage=yt;exports.fetchBuilderProps=oe;exports.fetchEntries=lt;exports.fetchOneEntry=ct;exports.getBuilderSearchParams=O;exports.getDefaultCanTrack=it;exports.getUserAttributes=Z;exports.handleABTestingSync=Jt;exports.isBrowser=c;exports.isEditing=K;exports.isPreviewing=mt;exports.logFetch=Y;exports.logger=d;exports.register=j;exports.registerInsertMenu=jt;exports.serializeIncludingFunctions=P;exports.setEditorSettings=St;exports.setupBrowserForEditing=et;exports.subscribeToEditor=Wt;exports.track=Nt;
|