@builder.io/sdk-react-nextjs 0.14.12 → 0.14.13
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/{node/USE_CLIENT_BUNDLE-fb4f77f0.js → browser/USE_CLIENT_BUNDLE-6ac6c863.js} +4 -3
- package/lib/browser/{USE_CLIENT_BUNDLE-2bbdea6c.cjs → USE_CLIENT_BUNDLE-c6228734.cjs} +3 -3
- package/lib/{edge/USE_SERVER_BUNDLE-2a938215.js → browser/USE_SERVER_BUNDLE-1de84180.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-0b27a689.cjs → browser/USE_SERVER_BUNDLE-8d870a7d.cjs} +1 -1
- package/lib/browser/{bundle-4a0b6a84.cjs → bundle-f15c021e.cjs} +2 -2
- package/lib/browser/{bundle-98fafe36.js → bundle-f830d2ad.js} +17 -17
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +25 -24
- package/lib/{browser/USE_CLIENT_BUNDLE-c82c8713.js → edge/USE_CLIENT_BUNDLE-20aebe3e.js} +4 -3
- package/lib/{node/USE_CLIENT_BUNDLE-75f2f077.cjs → edge/USE_CLIENT_BUNDLE-714c22c7.cjs} +3 -3
- package/lib/{node/USE_SERVER_BUNDLE-63519b03.js → edge/USE_SERVER_BUNDLE-87b221af.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-16129827.cjs → edge/USE_SERVER_BUNDLE-dfe3d2e3.cjs} +1 -1
- package/lib/edge/{bundle-eb2a536e.cjs → bundle-5a4040f8.cjs} +2 -2
- package/lib/edge/{bundle-85357ad0.js → bundle-d7a3ce0a.js} +17 -17
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +25 -24
- package/lib/{edge/USE_CLIENT_BUNDLE-cf915435.cjs → node/USE_CLIENT_BUNDLE-9fbb2664.cjs} +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-75473f15.js → node/USE_CLIENT_BUNDLE-e6e77d7b.js} +4 -3
- package/lib/{browser/USE_SERVER_BUNDLE-62b1c4be.cjs → node/USE_SERVER_BUNDLE-44095c01.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-c1a3d2f3.js → node/USE_SERVER_BUNDLE-c4348bf9.js} +1 -1
- package/lib/node/{bundle-2c8e3747.cjs → bundle-3f8cf8a2.cjs} +2 -2
- package/lib/node/{bundle-5867f6cd.js → bundle-b1907ae3.js} +2 -2
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +25 -24
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/index.d.ts +1 -0
- package/types/cjs/index-helpers/blocks-exports.d.ts +4 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/index.d.ts +1 -0
- package/types/esm/index-helpers/blocks-exports.d.ts +4 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i, Fragment as E, jsxs as I } from "react/jsx-runtime";
|
|
3
|
-
import { i as Y, g as q, a as U, b as $, c as w, d as R, e as Z, f as H, h as _, _ as V, j as p, l as ee, k as te, t as ne, m as D, n as ie, o as ae, p as ce, r as re, s as le, q as oe, u as de } from "./bundle-
|
|
3
|
+
import { i as Y, g as q, a as U, b as $, c as w, d as R, e as Z, f as H, h as _, _ as V, j as p, l as ee, k as te, t as ne, m as D, n as ie, o as ae, p as ce, r as re, s as le, q as oe, u as de } from "./bundle-f830d2ad.js";
|
|
4
4
|
import { useRef as T, useState as k, useEffect as f, createContext as se } from "react";
|
|
5
|
-
import { p as ue } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as ue } from "./USE_SERVER_BUNDLE-1de84180.js";
|
|
6
6
|
import { useRouter as me } from "next/navigation";
|
|
7
7
|
function O(e) {
|
|
8
8
|
return /* @__PURE__ */ i(E, { children: Y(e.TagName) ? /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ i(E, { children: typeof e.TagName == "string" ? /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
@@ -693,5 +693,6 @@ export {
|
|
|
693
693
|
Te as b,
|
|
694
694
|
xe as c,
|
|
695
695
|
we as d,
|
|
696
|
-
Be as e
|
|
696
|
+
Be as e,
|
|
697
|
+
ge as f
|
|
697
698
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),i=require("./bundle-
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),i=require("./bundle-f15c021e.cjs"),l=require("react"),M=require("./USE_SERVER_BUNDLE-8d870a7d.cjs"),D=require("next/navigation");function j(e){return t.jsx(t.Fragment,{children:i.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function H(e){return t.jsx(j,{attributes:{...e.attributes,[i.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[i.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function V(e){return t.jsx(j,{TagName:e.Wrapper,attributes:i.getBlockProperties({block:e.block,context:e.context}),actionAttributes:i.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function U(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...i.getBlockProperties({block:e.block,context:e.context}),...i.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function $(e){function c(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function u(){var o,b;i.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((b=window.parent)==null||b.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var o,b;i.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((b=window.parent)==null||b.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:c()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>u(),onMouseEnter:o=>S(),onKeyPress:o=>u(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
5
|
-
}`})]})}function
|
|
5
|
+
}`})]})}function O(e){return t.jsx("span",{children:e.children})}function J(e){var o,b,h,x;function c(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),i.getSrcSet(d)}else if(e.image&&!e.srcset)return i.getSrcSet(d);return i.getSrcSet(d)}function u(){var g;return(g=c==null?void 0:c())!=null&&g.match(/builder\.io/)&&!e.noWebp?c().replace(/\?/g,"?format=webp&"):""}function S(){const g={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?g:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[u()?t.jsx("source",{type:"image/webp",srcSet:u()}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-a0c95e8c",src:e.image,srcSet:c(),sizes:e.sizes})]}),e.aspectRatio&&!((b=(o=e.builderBlock)==null?void 0:o.children)!=null&&b.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-a0c95e8c",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx("div",{className:"div-a0c95e8c-2",children:e.children}):null]}),t.jsx("style",{children:`.img-a0c95e8c {
|
|
6
6
|
opacity: 1;
|
|
7
7
|
transition: opacity 0.2s ease-in-out;
|
|
8
8
|
}.div-a0c95e8c {
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
left: 0;
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
|
-
}`})]})}function
|
|
21
|
+
}`})]})}function G(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 Q(e){const c=l.useRef(null),[u,S]=l.useState(()=>[]),[o,b]=l.useState(()=>[]);return l.useEffect(()=>{var x;if(!((x=c.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const h=c.current.getElementsByTagName("script");for(let g=0;g<h.length;g++){const d=h[g];if(d.src){if(u.includes(d.src))continue;u.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(o.includes(d.innerText))continue;try{o.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:c,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function X(e){const c=l.useRef(null),[u,S]=l.useState(()=>[]),[o,b]=l.useState(()=>[]),[h,x]=l.useState(()=>!1);function g(){if(!c.current||!c.current.getElementsByTagName)return;const d=c.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const v=d[f];if(v.src&&!u.includes(v.src)){u.push(v.src);const C=document.createElement("script");C.async=!0,C.src=v.src,document.head.appendChild(C)}else if(i.isJsScript(v)&&!o.includes(v.innerText))try{o.push(v.innerText),new Function(v.innerText)()}catch(C){console.warn("`Embed`: Error running script:",C)}}}return l.useEffect(()=>{c.current&&!h&&(x(!0),g())},[c.current,h]),t.jsx("div",{className:"builder-embed",ref:c,dangerouslySetInnerHTML:{__html:e.content}})}function Y(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")}function Z(e){var S,o,b,h,x,g,d;function c(){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 u(){return{...c()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...u(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((b=(o=e.builderBlock)==null?void 0:o.children)!=null&&b.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(d=(g=e.builderBlock)==null?void 0:g.children)!=null&&d.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const q=l.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function p(e){var P,T,B,N,L,F,W;const c=l.useRef(null);function u(a){var s,r;const n={...e.builderContextSignal.rootState,...a};e.builderContextSignal.rootSetState?(r=(s=e.builderContextSignal).rootSetState)==null||r.call(s,n):e.builderContextSignal.rootState=n}function S(a){var s,r,m,y,k;const n={...e.builderContextSignal.content,...a,data:{...(s=e.builderContextSignal.content)==null?void 0:s.data,...a==null?void 0:a.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...a==null?void 0:a.meta,breakpoints:((m=a==null?void 0:a.meta)==null?void 0:m.breakpoints)||((k=(y=e.builderContextSignal.content)==null?void 0:y.meta)==null?void 0:k.breakpoints)}};M.postPreviewContent({value:n,key:n.id}).then(()=>{_.refresh()})}const[o,b]=l.useState(()=>e.contentWrapper||"div");function h(a){return i.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:n=>{var m;const{breakpoints:s,contentId:r}=n;!r||r!==((m=e.builderContextSignal.content)==null?void 0:m.id)||s&&S({meta:{breakpoints:s}})},animation:n=>{i.triggerAnimation(n)},contentUpdate:n=>{S(n)}}})(a)}function x(){var n,s;const a=(s=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:s.jsCode;a&&i.evaluate({code:a,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,d]=l.useState(()=>({})),[f,v]=l.useState(()=>({})),[C,A]=l.useState(()=>!1);function K(a){var n,s;if(e.builderContextSignal.content){const r=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,m=(s=e.builderContextSignal.content)==null?void 0:s.id;i._track({type:"click",canTrack:i.getDefaultCanTrack(e.canTrack),contentId:m,apiKey:e.apiKey,variationId:r!==m?r:void 0,...i.getInteractionPropertiesForEvent(a),unique:!C})}C||A(!0)}function I(){var n,s;const a=((s=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:s.httpRequests)??{};Object.entries(a).forEach(([r,m])=>{if(!m||f[r]||g[r]&&!i.isEditing())return;f[r]=!0;const y=m.replace(/{{([^}]+)}}/g,(k,z)=>String(i.evaluate({code:z,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));i.fetch(y).then(k=>k.json()).then(k=>{u({[r]:k}),g[r]=!0}).catch(k=>{console.error("error fetching dynamic data",m,k)}).finally(()=>{f[r]=!1})})}function E(){i.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:i.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(a){window.addEventListener("message",h),i.registerInsertMenu(),i.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(n=>{var r;const s=i.createRegisterComponentMessage(n);(r=window.parent)==null||r.postMessage(s,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",E)}function R(a){const n=new URL(location.href).searchParams,s=n.get("builder.preview"),r=n.get(`builder.preview.${s}`),m=n.get("apiKey")||n.get("builder.space");s===e.model&&m===e.apiKey&&(!e.content||r===e.content.id)&&i.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(y=>{y&&S(y)})}const _=D.useRouter();return l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initeditingbldr",w),()=>{var n;return(n=c.current)==null?void 0:n.removeEventListener("initeditingbldr",w)}},[]),l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initpreviewingbldr",R),()=>{var n;return(n=c.current)==null?void 0:n.removeEventListener("initpreviewingbldr",R)}},[]),l.useEffect(()=>{var a,n;if(i.isBrowser()){if(i.isEditing()&&c.current&&c.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&i.getDefaultCanTrack(e.canTrack)){const r=(a=e.builderContextSignal.content)==null?void 0:a.testVariationId,m=(n=e.builderContextSignal.content)==null?void 0:n.id,y=e.apiKey;i._track({type:"impression",canTrack:!0,contentId:m,apiKey:y,variationId:r!==m?r:void 0})}i.isPreviewing()}},[]),l.useEffect(()=>{e.apiKey||i.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),x(),I(),E()},[]),l.useEffect(()=>{},[e.content]),l.useEffect(()=>{x()},[(T=(P=e.builderContextSignal.content)==null?void 0:P.data)==null?void 0:T.jsCode]),l.useEffect(()=>{I()},[(N=(B=e.builderContextSignal.content)==null?void 0:B.data)==null?void 0:N.httpRequests]),l.useEffect(()=>{E()},[e.builderContextSignal.rootState]),l.useEffect(()=>{e.data&&u(e.data)},[e.data]),l.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),l.useEffect(()=>()=>{i.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",E))},[]),t.jsx(q.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(o,{ref:c,onClick:a=>K(a),"builder-content-id":(L=e.builderContextSignal.content)==null?void 0:L.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((F=e.content)==null?void 0:F.testVariationId)||((W=e.content)==null?void 0:W.id)}`,children:e.children}):null})}exports.BlockWrapper=V;exports.BlocksWrapper=$;exports.Button=H;exports.CustomCode=Q;exports.DynamicRenderer=j;exports.Embed=X;exports.EnableEditor=p;exports.FragmentComponent=O;exports.Image=J;exports.ImgComponent=Y;exports.InteractiveElement=U;exports.SectionComponent=G;exports.Video=Z;exports.builderContext=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-f15c021e.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime");require("react");const
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime");require("react");const v=require("./USE_CLIENT_BUNDLE-c6228734.cjs"),Ke=require("lru-cache");require("next/navigation");const ze=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),qe=e=>typeof e=="string"&&ze.has(e.toLowerCase()),E="rsc",O=()=>{switch(E){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function Je(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const A="[Builder.io]: ",k={log:(...e)=>console.log(A,...e),error:(...e)=>console.error(A,...e),warn:(...e)=>console.warn(A,...e),debug:(...e)=>console.debug(A,...e)};function y(){return typeof window<"u"&&typeof document<"u"}const Ye=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},de=e=>e instanceof URLSearchParams?Ye(e):e,ue=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function Ge(){return y()&&window.self!==window.top}function N(e){return Ge()&&ue(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const Qe=()=>{if(y()){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},Xe=()=>typeof navigator=="object"&&navigator.userAgent||"",me=()=>{const e=Xe(),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()||E==="reactNative"}},n=e.match(/Tablet|iPad/i),o=Qe();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"}},Ze=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),et=()=>({isEditing:N(),isBrowser:y(),isServer:!y(),getUserAttributes:()=>me()}),tt=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,G=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const s=Ze({builder:t,context:n,event:o,state:fe({rootState:a,localState:i,rootSetState:r})});return new Function(...s.map(([l])=>l),e)(...s.map(([,l])=>l))};function fe({rootState:e,localState:t,rootSetState:n}){return new Proxy(e,{get:(o,i)=>{if(t&&i in t)return t[i];const r=o[i];return typeof r=="object"&&r!==null?fe({rootState:r,localState:void 0,rootSetState:n?a=>{o[i]=a,n(o)}:void 0}):r},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 o[i]=r,n==null||n(o),!0}})}const w=e=>e!=null;function nt(){var e;return typeof process<"u"&&w((e=process==null?void 0:process.versions)==null?void 0:e.node)}const ot=()=>{var o;if(!nt())return!1;const e=process.arch==="arm64",t=process.version.startsWith("v20"),n=(o=process.env.NODE_OPTIONS)==null?void 0:o.includes("--no-node-snapshot");return e&&t&&!n?(k.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "),!0):!1},it=e=>(y()||ot(),G(e)),K=class R{static getCacheKey(t){return JSON.stringify({...t,event:t.event?Math.random():void 0})}static getCachedValue(t){return R.cache.get(t)}static setCachedValue(t,n){R.cache.size>20&&R.cache.delete(R.cache.keys().next().value),R.cache.set(t,{value:n})}};K.cacheLimit=20;K.cache=new Map;let V=K;function $({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0,enableCache:s}){if(e===""){k.warn("Skipping evaluation of empty code block.");return}const l={code:tt(e,{isExpression:a}),builder:et(),context:t,event:r,rootSetState:i,rootState:o,localState:n};if(s){const u=V.getCacheKey(l),p=V.getCachedValue(u);if(p)return p.value}try{const u=it(l);if(s){const p=V.getCacheKey(l);V.setCachedValue(p,u)}return u}catch(u){k.error("Failed code evaluation: "+u.message,{code:e});return}}const P=e=>JSON.parse(JSON.stringify(e)),rt=(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 at=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=P(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const s in e.bindings){const l=e.bindings[s],u=$({code:l,localState:n,rootState:o,rootSetState:i,context:t,enableCache:!0});rt(a,s,u)}return a};function W({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?at({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const st=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),he=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${st(n)}: ${o};`}).filter(w),ct=e=>he(e).join(`
|
|
2
2
|
`),D=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
|
|
3
3
|
${ct(n)}
|
|
4
4
|
}`;return e?`${e} {
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
)`,cn=({contentId:e,variationId:t})=>`window.${Re}(
|
|
132
132
|
"${t}", "${e}", ${Pe}
|
|
133
133
|
)`;function H(e){return c.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id})}const ln=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||k.warn("No previewed ID found in search params."),n};function Ae(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Ke.LRUCache({max:500,ttl:1e3*60*5}))}function dn(e){Ae();const t=ln(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function un(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function mn(){const e=un().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.
|
|
134
|
-
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 Ve=mn();function j(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...j(r,a,n)}:{...o,[a]:r}},{})}const fn="v3",te="builder.",hn="options.",q=e=>{if(!e)return{};const t=de(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(te)){const i=o.replace(te,"").replace(hn,"");n[i]=t[o]}}),n},pn=()=>{if(!y())return{};const e=new URLSearchParams(window.location.search);return q(e)},ne=e=>typeof e=="number"&&!isNaN(e)&&e>=0,J=e=>{const{limit:t=30,userAttributes:n,query:o,model:i,apiKey:r,enrich:a,locale:s,apiVersion:l=fn,fields:u,omit:p,offset:d,cacheSeconds:f,staleCacheSeconds:b,sort:h,includeUnpublished:m}=e;if(!r)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const S=t!==1,g=new URL(`https://cdn.builder.io/api/${l}/content/${i}`);if(g.searchParams.set("apiKey",r),g.searchParams.set("limit",String(t)),g.searchParams.set("noTraverse",String(S)),g.searchParams.set("includeRefs",String(!0)),s&&g.searchParams.set("locale",s),a&&g.searchParams.set("enrich",String(a)),g.searchParams.set("omit",p||"meta.componentsUsed"),u&&g.searchParams.set("fields",u),Number.isFinite(d)&&d>-1&&g.searchParams.set("offset",String(Math.floor(d))),typeof m=="boolean"&&g.searchParams.set("includeUnpublished",String(m)),f&&ne(f)&&g.searchParams.set("cacheSeconds",String(f)),b&&ne(b)&&g.searchParams.set("staleCacheSeconds",String(b)),h){const x=j({sort:h});for(const I in x)g.searchParams.set(I,JSON.stringify(x[I]))}const C={...pn(),...de(e.options||{})},T=j(C);for(const x in T)g.searchParams.set(x,String(T[x]));if(n&&g.searchParams.set("userAttributes",JSON.stringify(n)),o){const x=j({query:o});for(const I in x)g.searchParams.set(I,JSON.stringify(x[I]))}return g},gn=e=>"results"in e;async function Y(e){const t=await je({...e,limit:1});return t&&t[0]||null}const bn=async e=>{const t=J(e);return await(await(e.fetch??Ve)(t.href,e.fetchOptions)).json()},Be=async(e,t,n=J(e))=>{const o=F(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const s=dn(n.searchParams);r.push(s||a)}t.results=r}if(!o||!(y()||E==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await Ft({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t.results};async function je(e){try{const t=J(e),n=await bn(e);return gn(n)?Be(e,n):(k.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return k.error("Error fetching data. ",t),null}}function yn(e){if(!y())return!1;const t=ue(e||window.location.search);return N(t)?!1:t.indexOf("builder.preview=")!==-1}function Sn(){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 We(){return Sn().replace(/-/g,"")}const Fe="builderSessionId",xn=async({canTrack:e})=>{if(!e)return;const t=await ke({name:Fe,canTrack:e});if(w(t))return t;{const n=kn();return vn({id:n,canTrack:e}),n}},kn=()=>We(),vn=({id:e,canTrack:t})=>ve({name:Fe,value:e,canTrack:t}),Oe=()=>y()&&typeof localStorage<"u"?localStorage:void 0,Cn=({key:e,canTrack:t})=>{var n;try{return t?(n=Oe())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},wn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Oe())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},Ne="builderVisitorId",In=({canTrack:e})=>{if(!e)return;const t=Cn({key:Ne,canTrack:e});if(w(t))return t;{const n=En();return Tn({id:n,canTrack:e}),n}},En=()=>We(),Tn=({id:e,canTrack:t})=>wn({key:Ne,value:e,canTrack:t}),Rn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await xn({canTrack:e}),n=In({canTrack:e});return{sessionId:t,visitorId:n}},Pn=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await Rn({canTrack:t}),userAttributes:me(),ownerId:n}});async function $e(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!N()&&(y()||E==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Pn(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const An=e=>$e({...e,canTrack:!0});function oe(e){return Math.round(e*1e3)/1e3}const Vn=(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},Bn=e=>Vn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ie=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=oe(o/n.width),a=oe(i/n.height);return{x:r,y:a}},jn=e=>{const t=e.target,n=t&&Bn(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?ie({event:e,target:t}):void 0,builderTargetOffset:n?ie({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},Wn=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Le(e,t){const n=new URL(t.origin),o=n.hostname;return(e||Wn).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}const Fn="0.14.
|
|
134
|
+
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 Ve=mn();function j(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...j(r,a,n)}:{...o,[a]:r}},{})}const fn="v3",te="builder.",hn="options.",q=e=>{if(!e)return{};const t=de(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(te)){const i=o.replace(te,"").replace(hn,"");n[i]=t[o]}}),n},pn=()=>{if(!y())return{};const e=new URLSearchParams(window.location.search);return q(e)},ne=e=>typeof e=="number"&&!isNaN(e)&&e>=0,J=e=>{const{limit:t=30,userAttributes:n,query:o,model:i,apiKey:r,enrich:a,locale:s,apiVersion:l=fn,fields:u,omit:p,offset:d,cacheSeconds:f,staleCacheSeconds:b,sort:h,includeUnpublished:m}=e;if(!r)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const S=t!==1,g=new URL(`https://cdn.builder.io/api/${l}/content/${i}`);if(g.searchParams.set("apiKey",r),g.searchParams.set("limit",String(t)),g.searchParams.set("noTraverse",String(S)),g.searchParams.set("includeRefs",String(!0)),s&&g.searchParams.set("locale",s),a&&g.searchParams.set("enrich",String(a)),g.searchParams.set("omit",p||"meta.componentsUsed"),u&&g.searchParams.set("fields",u),Number.isFinite(d)&&d>-1&&g.searchParams.set("offset",String(Math.floor(d))),typeof m=="boolean"&&g.searchParams.set("includeUnpublished",String(m)),f&&ne(f)&&g.searchParams.set("cacheSeconds",String(f)),b&&ne(b)&&g.searchParams.set("staleCacheSeconds",String(b)),h){const x=j({sort:h});for(const I in x)g.searchParams.set(I,JSON.stringify(x[I]))}const C={...pn(),...de(e.options||{})},T=j(C);for(const x in T)g.searchParams.set(x,String(T[x]));if(n&&g.searchParams.set("userAttributes",JSON.stringify(n)),o){const x=j({query:o});for(const I in x)g.searchParams.set(I,JSON.stringify(x[I]))}return g},gn=e=>"results"in e;async function Y(e){const t=await je({...e,limit:1});return t&&t[0]||null}const bn=async e=>{const t=J(e);return await(await(e.fetch??Ve)(t.href,e.fetchOptions)).json()},Be=async(e,t,n=J(e))=>{const o=F(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const s=dn(n.searchParams);r.push(s||a)}t.results=r}if(!o||!(y()||E==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await Ft({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t.results};async function je(e){try{const t=J(e),n=await bn(e);return gn(n)?Be(e,n):(k.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return k.error("Error fetching data. ",t),null}}function yn(e){if(!y())return!1;const t=ue(e||window.location.search);return N(t)?!1:t.indexOf("builder.preview=")!==-1}function Sn(){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 We(){return Sn().replace(/-/g,"")}const Fe="builderSessionId",xn=async({canTrack:e})=>{if(!e)return;const t=await ke({name:Fe,canTrack:e});if(w(t))return t;{const n=kn();return vn({id:n,canTrack:e}),n}},kn=()=>We(),vn=({id:e,canTrack:t})=>ve({name:Fe,value:e,canTrack:t}),Oe=()=>y()&&typeof localStorage<"u"?localStorage:void 0,Cn=({key:e,canTrack:t})=>{var n;try{return t?(n=Oe())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},wn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Oe())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},Ne="builderVisitorId",In=({canTrack:e})=>{if(!e)return;const t=Cn({key:Ne,canTrack:e});if(w(t))return t;{const n=En();return Tn({id:n,canTrack:e}),n}},En=()=>We(),Tn=({id:e,canTrack:t})=>wn({key:Ne,value:e,canTrack:t}),Rn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await xn({canTrack:e}),n=In({canTrack:e});return{sessionId:t,visitorId:n}},Pn=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await Rn({canTrack:t}),userAttributes:me(),ownerId:n}});async function $e(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!N()&&(y()||E==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Pn(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const An=e=>$e({...e,canTrack:!0});function oe(e){return Math.round(e*1e3)/1e3}const Vn=(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},Bn=e=>Vn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ie=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=oe(o/n.width),a=oe(i/n.height);return{x:r,y:a}},jn=e=>{const t=e.target,n=t&&Bn(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?ie({event:e,target:t}):void 0,builderTargetOffset:n?ie({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},Wn=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Le(e,t){const n=new URL(t.origin),o=n.hostname;return(e||Wn).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}const Fn="0.14.13",re={};function Ue(e,t){let n=re[e];if(n||(n=re[e]=[]),n.push(t),y()){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 On=()=>{Ue("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let ae=!1;const _e=(e={})=>{var t,n;ae||(ae=!0,y()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:E,version:Fn,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var r,a;if(!Le(e.trustedHosts,o))return;const{data:i}=o;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const s=i.data.text,l=i.data.arguments||[],u=i.data.id,p=new Function(s);let d,f=null;try{d=p.apply(null,l)}catch(b){f=b}f?(r=window.parent)==null||r.postMessage({type:"builder.evaluateError",data:{id:u,error:f.message}},"*"):d&&typeof d.then=="function"?d.then(b=>{var h;(h=window.parent)==null||h.postMessage({type:"builder.evaluateResult",data:{id:u,result:b}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:d,id:u}},"*");break}}})))},De=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!Le(t,o))return;const{data:i}=o;if(i)switch(i.type){case"builder.configureSdk":{n.configureSdk(i.data);break}case"builder.triggerAnimation":{n.animation(i.data);break}case"builder.contentUpdate":{const r=i.data,a=r.key||r.alias||r.entry||r.modelName,s=r.data;a===e&&n.contentUpdate(s);break}}},Nn=(e,t,n)=>{if(!y)return k.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};_e();const o=De({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function se(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const i=arguments[o];if(i!=null)for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n}const $n=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function Ln(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function Un(e,t){const n=_n(e),o=getComputedStyle(t),i=e.steps[0].styles,r=e.steps[e.steps.length-1].styles,a=[i,r];for(const s of a)for(const l of n)l in s||(s[l]=o[l])}function _n(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function Dn(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){Ln(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{Un(e,n),n.style.transition="none",n.style.transitionDelay="0",se(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${$n(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),se(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const Mn=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+=`
|
|
135
135
|
@font-face {
|
|
136
136
|
font-family: "${t}";
|
|
137
137
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as l, Fragment as k, jsxs as R } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { I as We, B as Oe, a as Ne, D as $e, C as Fe, E as Le, b as Ue, V as De, c as _e, F as Me, d as je, S as He, e as Ke } from "./USE_CLIENT_BUNDLE-6ac6c863.js";
|
|
4
|
+
import { LRUCache as ze } from "lru-cache";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const qe = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), so = (e) => typeof e == "string" && qe.has(e.toLowerCase()), T = "rsc", M = () => {
|
|
7
7
|
switch (T) {
|
|
@@ -566,7 +566,7 @@ const vt = ({
|
|
|
566
566
|
};
|
|
567
567
|
function Q(e) {
|
|
568
568
|
var n;
|
|
569
|
-
const t = e.isInteractive ?
|
|
569
|
+
const t = e.isInteractive ? We : e.componentRef;
|
|
570
570
|
return /* @__PURE__ */ l(k, { children: e.componentRef ? /* @__PURE__ */ l(k, { children: /* @__PURE__ */ l(
|
|
571
571
|
t,
|
|
572
572
|
{
|
|
@@ -688,7 +688,7 @@ function F(e) {
|
|
|
688
688
|
},
|
|
689
689
|
f
|
|
690
690
|
)) }) : /* @__PURE__ */ R(
|
|
691
|
-
|
|
691
|
+
Oe,
|
|
692
692
|
{
|
|
693
693
|
Wrapper: i(),
|
|
694
694
|
block: o(),
|
|
@@ -727,7 +727,7 @@ function F(e) {
|
|
|
727
727
|
function z(e) {
|
|
728
728
|
var t, n, o;
|
|
729
729
|
return /* @__PURE__ */ l(
|
|
730
|
-
|
|
730
|
+
Ne,
|
|
731
731
|
{
|
|
732
732
|
blocks: e.blocks,
|
|
733
733
|
parent: e.parent,
|
|
@@ -842,7 +842,7 @@ function xt(e) {
|
|
|
842
842
|
children: [
|
|
843
843
|
/* @__PURE__ */ l($, { id: "builderio-columns", styles: f() }),
|
|
844
844
|
(b = e.columns) == null ? void 0 : b.map((h, m) => /* @__PURE__ */ l(
|
|
845
|
-
|
|
845
|
+
$e,
|
|
846
846
|
{
|
|
847
847
|
TagName: h.link ? e.builderLinkComponent || "a" : "div",
|
|
848
848
|
actionAttributes: {},
|
|
@@ -1668,31 +1668,31 @@ const zt = {
|
|
|
1668
1668
|
advanced: !0
|
|
1669
1669
|
}]
|
|
1670
1670
|
}, Qt = () => [{
|
|
1671
|
-
component:
|
|
1671
|
+
component: Fe,
|
|
1672
1672
|
...zt
|
|
1673
1673
|
}, {
|
|
1674
|
-
component:
|
|
1674
|
+
component: Le,
|
|
1675
1675
|
...qt
|
|
1676
1676
|
}, {
|
|
1677
|
-
component:
|
|
1677
|
+
component: Ue,
|
|
1678
1678
|
...Gt
|
|
1679
1679
|
}, {
|
|
1680
|
-
component:
|
|
1680
|
+
component: De,
|
|
1681
1681
|
...Jt
|
|
1682
1682
|
}], Z = () => [{
|
|
1683
|
-
component:
|
|
1683
|
+
component: _e,
|
|
1684
1684
|
...$t
|
|
1685
1685
|
}, {
|
|
1686
1686
|
component: xt,
|
|
1687
1687
|
...Ft
|
|
1688
1688
|
}, {
|
|
1689
|
-
component:
|
|
1689
|
+
component: Me,
|
|
1690
1690
|
...Lt
|
|
1691
1691
|
}, {
|
|
1692
|
-
component:
|
|
1692
|
+
component: je,
|
|
1693
1693
|
...Ut
|
|
1694
1694
|
}, {
|
|
1695
|
-
component:
|
|
1695
|
+
component: He,
|
|
1696
1696
|
...Dt
|
|
1697
1697
|
}, {
|
|
1698
1698
|
component: Mt,
|
|
@@ -1841,7 +1841,7 @@ const cn = (e) => {
|
|
|
1841
1841
|
return n || x.warn("No previewed ID found in search params."), n;
|
|
1842
1842
|
};
|
|
1843
1843
|
function ln() {
|
|
1844
|
-
globalThis._BUILDER_PREVIEW_LRU_CACHE || (globalThis._BUILDER_PREVIEW_LRU_CACHE = new
|
|
1844
|
+
globalThis._BUILDER_PREVIEW_LRU_CACHE || (globalThis._BUILDER_PREVIEW_LRU_CACHE = new ze({
|
|
1845
1845
|
max: 500,
|
|
1846
1846
|
// how long to live in ms
|
|
1847
1847
|
ttl: 1e3 * 60 * 5
|
|
@@ -2177,7 +2177,7 @@ function Be(e, t) {
|
|
|
2177
2177
|
const n = new URL(t.origin), o = n.hostname;
|
|
2178
2178
|
return (e || Nn).findIndex((i) => i.startsWith("*.") ? o.endsWith(i.slice(1)) : i === o) > -1;
|
|
2179
2179
|
}
|
|
2180
|
-
const $n = "0.14.
|
|
2180
|
+
const $n = "0.14.13", ie = {};
|
|
2181
2181
|
function Fn(e, t) {
|
|
2182
2182
|
let n = ie[e];
|
|
2183
2183
|
if (n || (n = ie[e] = []), n.push(t), S()) {
|
|
@@ -2509,7 +2509,7 @@ function se(e) {
|
|
|
2509
2509
|
BlocksWrapperProps: e.blocksWrapperProps || {}
|
|
2510
2510
|
};
|
|
2511
2511
|
return /* @__PURE__ */ R(
|
|
2512
|
-
|
|
2512
|
+
Ke,
|
|
2513
2513
|
{
|
|
2514
2514
|
content: e.content,
|
|
2515
2515
|
data: e.data,
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-c6228734.cjs"),e=require("./bundle-f15c021e.cjs");require("react/jsx-runtime");require("react");require("./USE_SERVER_BUNDLE-8d870a7d.cjs");require("next/navigation");require("lru-cache");exports.BuilderContext=t.builderContext;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;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.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/browser/index.mjs
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
1
|
+
import { f as n, c as m, F as c, d as p, S as g, V as d } from "./USE_CLIENT_BUNDLE-6ac6c863.js";
|
|
2
|
+
import { B as l, C as f, w as B, S as C, T as E, F as S, q as x, E as h, G as b, u as y, z as F, c as P, j as T, x as k, y as w, D as R, A as V } from "./bundle-f830d2ad.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./USE_SERVER_BUNDLE-
|
|
5
|
+
import "./USE_SERVER_BUNDLE-1de84180.js";
|
|
6
6
|
import "next/navigation";
|
|
7
7
|
import "lru-cache";
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
n as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
c as
|
|
15
|
-
p as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
l as Blocks,
|
|
10
|
+
n as BuilderContext,
|
|
11
|
+
m as Button,
|
|
12
|
+
f as Columns,
|
|
13
|
+
B as Content,
|
|
14
|
+
c as Fragment,
|
|
15
|
+
p as Image,
|
|
16
|
+
g as Section,
|
|
17
|
+
C as Symbol,
|
|
18
|
+
E as Text,
|
|
19
|
+
d as Video,
|
|
20
|
+
S as _processContentResult,
|
|
21
|
+
x as createRegisterComponentMessage,
|
|
21
22
|
h as fetchBuilderProps,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
b as fetchEntries,
|
|
24
|
+
y as fetchOneEntry,
|
|
25
|
+
F as getBuilderSearchParams,
|
|
26
|
+
P as isEditing,
|
|
27
|
+
T as isPreviewing,
|
|
28
|
+
k as register,
|
|
29
|
+
w as setEditorSettings,
|
|
30
|
+
R as subscribeToEditor,
|
|
31
|
+
V as track
|
|
31
32
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i, Fragment as E, jsxs as I } from "react/jsx-runtime";
|
|
3
|
-
import { i as Y, g as q, a as U, b as $, c as w, d as R, e as Z, f as H, h as _, _ as V, j as p, l as ee, k as te, t as ne, m as D, n as ie, o as ae, p as ce, r as re, s as le, q as oe, u as de } from "./bundle-
|
|
3
|
+
import { i as Y, g as q, a as U, b as $, c as w, d as R, e as Z, f as H, h as _, _ as V, j as p, l as ee, k as te, t as ne, m as D, n as ie, o as ae, p as ce, r as re, s as le, q as oe, u as de } from "./bundle-d7a3ce0a.js";
|
|
4
4
|
import { useRef as T, useState as k, useEffect as f, createContext as se } from "react";
|
|
5
|
-
import { p as ue } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as ue } from "./USE_SERVER_BUNDLE-87b221af.js";
|
|
6
6
|
import { useRouter as me } from "next/navigation";
|
|
7
7
|
function O(e) {
|
|
8
8
|
return /* @__PURE__ */ i(E, { children: Y(e.TagName) ? /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ i(E, { children: typeof e.TagName == "string" ? /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
@@ -693,5 +693,6 @@ export {
|
|
|
693
693
|
Te as b,
|
|
694
694
|
xe as c,
|
|
695
695
|
we as d,
|
|
696
|
-
Be as e
|
|
696
|
+
Be as e,
|
|
697
|
+
ge as f
|
|
697
698
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),i=require("./bundle-
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),i=require("./bundle-5a4040f8.cjs"),l=require("react"),M=require("./USE_SERVER_BUNDLE-dfe3d2e3.cjs"),D=require("next/navigation");function j(e){return t.jsx(t.Fragment,{children:i.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function H(e){return t.jsx(j,{attributes:{...e.attributes,[i.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[i.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function V(e){return t.jsx(j,{TagName:e.Wrapper,attributes:i.getBlockProperties({block:e.block,context:e.context}),actionAttributes:i.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function U(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...i.getBlockProperties({block:e.block,context:e.context}),...i.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function $(e){function c(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function u(){var o,b;i.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((b=window.parent)==null||b.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var o,b;i.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((b=window.parent)==null||b.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:c()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>u(),onMouseEnter:o=>S(),onKeyPress:o=>u(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
5
|
-
}`})]})}function
|
|
5
|
+
}`})]})}function O(e){return t.jsx("span",{children:e.children})}function J(e){var o,b,h,x;function c(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),i.getSrcSet(d)}else if(e.image&&!e.srcset)return i.getSrcSet(d);return i.getSrcSet(d)}function u(){var g;return(g=c==null?void 0:c())!=null&&g.match(/builder\.io/)&&!e.noWebp?c().replace(/\?/g,"?format=webp&"):""}function S(){const g={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?g:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[u()?t.jsx("source",{type:"image/webp",srcSet:u()}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-a0c95e8c",src:e.image,srcSet:c(),sizes:e.sizes})]}),e.aspectRatio&&!((b=(o=e.builderBlock)==null?void 0:o.children)!=null&&b.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-a0c95e8c",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx("div",{className:"div-a0c95e8c-2",children:e.children}):null]}),t.jsx("style",{children:`.img-a0c95e8c {
|
|
6
6
|
opacity: 1;
|
|
7
7
|
transition: opacity 0.2s ease-in-out;
|
|
8
8
|
}.div-a0c95e8c {
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
left: 0;
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
|
-
}`})]})}function
|
|
21
|
+
}`})]})}function G(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 Q(e){const c=l.useRef(null),[u,S]=l.useState(()=>[]),[o,b]=l.useState(()=>[]);return l.useEffect(()=>{var x;if(!((x=c.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const h=c.current.getElementsByTagName("script");for(let g=0;g<h.length;g++){const d=h[g];if(d.src){if(u.includes(d.src))continue;u.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(o.includes(d.innerText))continue;try{o.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:c,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function X(e){const c=l.useRef(null),[u,S]=l.useState(()=>[]),[o,b]=l.useState(()=>[]),[h,x]=l.useState(()=>!1);function g(){if(!c.current||!c.current.getElementsByTagName)return;const d=c.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const v=d[f];if(v.src&&!u.includes(v.src)){u.push(v.src);const C=document.createElement("script");C.async=!0,C.src=v.src,document.head.appendChild(C)}else if(i.isJsScript(v)&&!o.includes(v.innerText))try{o.push(v.innerText),new Function(v.innerText)()}catch(C){console.warn("`Embed`: Error running script:",C)}}}return l.useEffect(()=>{c.current&&!h&&(x(!0),g())},[c.current,h]),t.jsx("div",{className:"builder-embed",ref:c,dangerouslySetInnerHTML:{__html:e.content}})}function Y(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")}function Z(e){var S,o,b,h,x,g,d;function c(){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 u(){return{...c()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...u(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((b=(o=e.builderBlock)==null?void 0:o.children)!=null&&b.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(d=(g=e.builderBlock)==null?void 0:g.children)!=null&&d.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const q=l.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function p(e){var P,T,B,N,L,F,W;const c=l.useRef(null);function u(a){var s,r;const n={...e.builderContextSignal.rootState,...a};e.builderContextSignal.rootSetState?(r=(s=e.builderContextSignal).rootSetState)==null||r.call(s,n):e.builderContextSignal.rootState=n}function S(a){var s,r,m,y,k;const n={...e.builderContextSignal.content,...a,data:{...(s=e.builderContextSignal.content)==null?void 0:s.data,...a==null?void 0:a.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...a==null?void 0:a.meta,breakpoints:((m=a==null?void 0:a.meta)==null?void 0:m.breakpoints)||((k=(y=e.builderContextSignal.content)==null?void 0:y.meta)==null?void 0:k.breakpoints)}};M.postPreviewContent({value:n,key:n.id}).then(()=>{_.refresh()})}const[o,b]=l.useState(()=>e.contentWrapper||"div");function h(a){return i.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:n=>{var m;const{breakpoints:s,contentId:r}=n;!r||r!==((m=e.builderContextSignal.content)==null?void 0:m.id)||s&&S({meta:{breakpoints:s}})},animation:n=>{i.triggerAnimation(n)},contentUpdate:n=>{S(n)}}})(a)}function x(){var n,s;const a=(s=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:s.jsCode;a&&i.evaluate({code:a,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,d]=l.useState(()=>({})),[f,v]=l.useState(()=>({})),[C,A]=l.useState(()=>!1);function K(a){var n,s;if(e.builderContextSignal.content){const r=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,m=(s=e.builderContextSignal.content)==null?void 0:s.id;i._track({type:"click",canTrack:i.getDefaultCanTrack(e.canTrack),contentId:m,apiKey:e.apiKey,variationId:r!==m?r:void 0,...i.getInteractionPropertiesForEvent(a),unique:!C})}C||A(!0)}function I(){var n,s;const a=((s=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:s.httpRequests)??{};Object.entries(a).forEach(([r,m])=>{if(!m||f[r]||g[r]&&!i.isEditing())return;f[r]=!0;const y=m.replace(/{{([^}]+)}}/g,(k,z)=>String(i.evaluate({code:z,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));i.fetch(y).then(k=>k.json()).then(k=>{u({[r]:k}),g[r]=!0}).catch(k=>{console.error("error fetching dynamic data",m,k)}).finally(()=>{f[r]=!1})})}function E(){i.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:i.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(a){window.addEventListener("message",h),i.registerInsertMenu(),i.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(n=>{var r;const s=i.createRegisterComponentMessage(n);(r=window.parent)==null||r.postMessage(s,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",E)}function R(a){const n=new URL(location.href).searchParams,s=n.get("builder.preview"),r=n.get(`builder.preview.${s}`),m=n.get("apiKey")||n.get("builder.space");s===e.model&&m===e.apiKey&&(!e.content||r===e.content.id)&&i.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(y=>{y&&S(y)})}const _=D.useRouter();return l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initeditingbldr",w),()=>{var n;return(n=c.current)==null?void 0:n.removeEventListener("initeditingbldr",w)}},[]),l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initpreviewingbldr",R),()=>{var n;return(n=c.current)==null?void 0:n.removeEventListener("initpreviewingbldr",R)}},[]),l.useEffect(()=>{var a,n;if(i.isBrowser()){if(i.isEditing()&&c.current&&c.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&i.getDefaultCanTrack(e.canTrack)){const r=(a=e.builderContextSignal.content)==null?void 0:a.testVariationId,m=(n=e.builderContextSignal.content)==null?void 0:n.id,y=e.apiKey;i._track({type:"impression",canTrack:!0,contentId:m,apiKey:y,variationId:r!==m?r:void 0})}i.isPreviewing()}},[]),l.useEffect(()=>{e.apiKey||i.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),x(),I(),E()},[]),l.useEffect(()=>{},[e.content]),l.useEffect(()=>{x()},[(T=(P=e.builderContextSignal.content)==null?void 0:P.data)==null?void 0:T.jsCode]),l.useEffect(()=>{I()},[(N=(B=e.builderContextSignal.content)==null?void 0:B.data)==null?void 0:N.httpRequests]),l.useEffect(()=>{E()},[e.builderContextSignal.rootState]),l.useEffect(()=>{e.data&&u(e.data)},[e.data]),l.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),l.useEffect(()=>()=>{i.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",E))},[]),t.jsx(q.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(o,{ref:c,onClick:a=>K(a),"builder-content-id":(L=e.builderContextSignal.content)==null?void 0:L.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((F=e.content)==null?void 0:F.testVariationId)||((W=e.content)==null?void 0:W.id)}`,children:e.children}):null})}exports.BlockWrapper=V;exports.BlocksWrapper=$;exports.Button=H;exports.CustomCode=Q;exports.DynamicRenderer=j;exports.Embed=X;exports.EnableEditor=p;exports.FragmentComponent=O;exports.Image=J;exports.ImgComponent=Y;exports.InteractiveElement=U;exports.SectionComponent=G;exports.Video=Z;exports.builderContext=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-5a4040f8.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|