@builder.io/sdk-react-nextjs 0.12.5 → 0.12.6
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-4ba4594d.js → browser/USE_CLIENT_BUNDLE-4d4e23b4.js} +3 -6
- package/lib/browser/{USE_CLIENT_BUNDLE-70be4cc5.cjs → USE_CLIENT_BUNDLE-e5d64246.cjs} +2 -2
- package/lib/{edge/USE_SERVER_BUNDLE-36de460d.js → browser/USE_SERVER_BUNDLE-2bf0dc28.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-50c2f18b.cjs → browser/USE_SERVER_BUNDLE-ccca985e.cjs} +1 -1
- package/lib/browser/{bundle-bd9886c9.cjs → bundle-6e21e129.cjs} +15 -15
- package/lib/browser/{bundle-f9f52242.js → bundle-b3104268.js} +118 -101
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{browser/USE_CLIENT_BUNDLE-7492ecd8.js → edge/USE_CLIENT_BUNDLE-41ee32e4.js} +3 -6
- package/lib/{node/USE_CLIENT_BUNDLE-2f43c320.cjs → edge/USE_CLIENT_BUNDLE-cc55e91d.cjs} +2 -2
- package/lib/{node/USE_SERVER_BUNDLE-473d50ad.cjs → edge/USE_SERVER_BUNDLE-19879780.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-2534ef71.js → edge/USE_SERVER_BUNDLE-fda604b6.js} +1 -1
- package/lib/edge/{bundle-765860e3.js → bundle-ee1ebe27.js} +501 -484
- package/lib/edge/{bundle-71cfdd3e.cjs → bundle-f2d4a6db.cjs} +26 -26
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-1148158d.cjs → node/USE_CLIENT_BUNDLE-343cb348.cjs} +2 -2
- package/lib/{edge/USE_CLIENT_BUNDLE-cb840c0f.js → node/USE_CLIENT_BUNDLE-aa8ab44a.js} +3 -6
- package/lib/{browser/USE_SERVER_BUNDLE-fe386ed3.js → node/USE_SERVER_BUNDLE-2fdc522e.js} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-875d4629.cjs → node/USE_SERVER_BUNDLE-cbcb1baf.cjs} +1 -1
- package/lib/node/{bundle-305bb463.js → bundle-99e5b33f.js} +25 -8
- package/lib/node/{bundle-1c54df65.cjs → bundle-c799b7fc.cjs} +2 -2
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/evaluate/browser-runtime/browser.d.ts +5 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/evaluate/browser-runtime/browser.d.ts +5 -1
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-f2d4a6db.cjs"),t=require("./USE_CLIENT_BUNDLE-cc55e91d.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-19879780.cjs");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, w as m, C as c, R as g, v as p, S as l, T as C, z as d, p as B, H as S, A as f, q as u, D as E, F as R, E as h, c as x, j as k, x as y, y as F, G as P } from "./bundle-
|
|
2
|
-
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, w as m, C as c, R as g, v as p, S as l, T as C, z as d, p as B, H as S, A as f, q as u, D as E, F as R, E as h, c as x, j as k, x as y, y as F, G as P } from "./bundle-ee1ebe27.js";
|
|
2
|
+
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-41ee32e4.js";
|
|
3
3
|
import "lru-cache";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "next/navigation";
|
|
7
|
-
import "./USE_SERVER_BUNDLE-
|
|
7
|
+
import "./USE_SERVER_BUNDLE-fda604b6.js";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
v as Button,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-c799b7fc.cjs"),r=require("react"),M=require("./USE_SERVER_BUNDLE-cbcb1baf.cjs"),V=require("next/navigation");function E(e){return t.jsx(t.Fragment,{children:a.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}function H(e){return t.jsx(E,{TagName:e.link?e.builderLinkComponent||"a":"button",attributes:{...e.attributes,[a.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[a.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},actionAttributes:{},children:e.text})}function U(e){return t.jsx(E,{TagName:e.Wrapper,attributes:a.getBlockProperties({block:e.block,context:e.context}),actionAttributes:a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function $(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...a.getBlockProperties({block:e.block,context:e.context}),...a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function O(e){function l(){var s;return"builder-blocks"+((s=e.blocks)!=null&&s.length?"":" no-blocks")}function g(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var s,m;a.isEditing()&&!((s=e.blocks)!=null&&s.length)&&((m=window.parent)==null||m.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:l()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:s=>g(),onMouseEnter:s=>S(),onKeyPress:s=>g(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
left: 0;
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
|
-
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]);return r.useEffect(()=>{var v;if(!((v=l.current)!=null&&v.getElementsByTagName)||typeof window>"u")return;const x=l.current.getElementsByTagName("script");for(let h=0;h<x.length;h++){const d=x[h];if(d.src){if(g.includes(d.src))continue;g.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(s.includes(d.innerText))continue;try{s.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function Y(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]),[x,v]=r.useState(()=>!1);function h(){if(!l.current||!l.current.getElementsByTagName)return;const d=l.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const k=d[f];if(k.src&&!g.includes(k.src)){g.push(k.src);const y=document.createElement("script");y.async=!0,y.src=k.src,document.head.appendChild(y)}else if(a.isJsScript(k)&&!s.includes(k.innerText))try{s.push(k.innerText),new Function(k.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!x&&(v(!0),h())},[l.current,x]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function Z(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},a.isEditing()&&e.imgSrc||"default-key")}function p(e){var S,s,m,x,v,h,d;function l(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...l()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((m=(s=e.builderBlock)==null?void 0:s.children)!=null&&m.length))?t.jsx(t.Fragment,{children:t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(v=(x=e.builderBlock)==null?void 0:x.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(d=(h=e.builderBlock)==null?void 0:h.children)!=null&&d.length&&!e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const ee=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function te(e){var P,T,B,N,F,L,W;const l=r.useRef(null),[g,S]=r.useState(()=>0);r.useState(()=>!0);function s(n){var c,o;const i={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(o=(c=e.builderContextSignal).rootSetState)==null||o.call(c,i):e.builderContextSignal.rootState=i}function m(n){var c,o,u,b,K;const i={...e.builderContextSignal.content,...n,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...n==null?void 0:n.data},meta:{...(o=e.builderContextSignal.content)==null?void 0:o.meta,...n==null?void 0:n.meta,breakpoints:((u=n==null?void 0:n.meta)==null?void 0:u.breakpoints)||((K=(b=e.builderContextSignal.content)==null?void 0:b.meta)==null?void 0:K.breakpoints)}};M.postPreviewContent({value:i,key:i.id}).then(()=>{D.refresh()})}r.useState(()=>0);const[x,v]=r.useState(()=>!1),[h,d]=r.useState(()=>e.contentWrapper||"div");function f(n){var c;if(!a.isFromTrustedHost(e.trustedHosts,n))return;const{data:i}=n;if(i)switch(i.type){case"builder.configureSdk":{const o=i.data,{breakpoints:u,contentId:b}=o;if(!b||b!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&m({meta:{breakpoints:u}}),S(g+1);break}case"builder.contentUpdate":{const o=i.data,u=o.key||o.alias||o.entry||o.modelName,b=o.data;u===e.model&&(m(b),S(g+1));break}}}function k(){var i,c;const n=(c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.jsCode;n&&a.evaluate({code:n,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[y,ne]=r.useState(()=>({})),[j,q]=r.useState(()=>!1);function A(n){var i,c;if(e.builderContextSignal.content){const o=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;a._track({type:"click",canTrack:a.getDefaultCanTrack(e.canTrack),contentId:u,apiKey:e.apiKey,variationId:o!==u?o:void 0,...a.getInteractionPropertiesForEvent(n),unique:!j})}j||q(!0)}function _(n){return n.replace(/{{([^}]+)}}/g,(i,c)=>a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function z({url:n,key:i}){a.fetch(n).then(c=>c.json()).then(c=>{var u,b;const o={...e.builderContextSignal.rootState,[i]:c};(b=(u=e.builderContextSignal).rootSetState)==null||b.call(u,o),y[i]=!0}).catch(c=>{console.error("error fetching dynamic data",n,c)})}function w(){var i,c;const n=((c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.httpRequests)??{};Object.entries(n).forEach(([o,u])=>{if(u&&(!y[o]||a.isEditing())){const b=_(u);z({url:b,key:o})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function R(n){S(g+1),window.addEventListener("message",f),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var o;const c=a.createRegisterComponentMessage(i);(o=window.parent)==null||o.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function I(n){const i=new URL(location.href).searchParams,c=i.get("builder.preview"),o=i.get(`builder.preview.${c}`),u=i.get("apiKey")||i.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||o===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(b=>{b&&m(b)})}const D=V.useRouter();return r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",R),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initeditingbldr",R)}},[]),r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",I),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initpreviewingbldr",I)}},[]),r.useEffect(()=>{var n,i;if(a.isBrowser()){if(a.isEditing()&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const o=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,u=(i=e.builderContextSignal.content)==null?void 0:i.id,b=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:b,variationId:o!==u?o:void 0})}a.isPreviewing()&&l.current}},[]),r.useEffect(()=>{e.apiKey||a.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),k(),w(),C()},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.addEventListener("message",f))},[x]),r.useEffect(()=>{k()},[(T=(P=e.builderContextSignal.content)==null?void 0:P.data)==null?void 0:T.jsCode
|
|
21
|
+
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]);return r.useEffect(()=>{var v;if(!((v=l.current)!=null&&v.getElementsByTagName)||typeof window>"u")return;const x=l.current.getElementsByTagName("script");for(let h=0;h<x.length;h++){const d=x[h];if(d.src){if(g.includes(d.src))continue;g.push(d.src);const f=document.createElement("script");f.async=!0,f.src=d.src,document.head.appendChild(f)}else if(!d.type||["text/javascript","application/javascript","application/ecmascript"].includes(d.type)){if(s.includes(d.innerText))continue;try{s.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function Y(e){const l=r.useRef(null),[g,S]=r.useState(()=>[]),[s,m]=r.useState(()=>[]),[x,v]=r.useState(()=>!1);function h(){if(!l.current||!l.current.getElementsByTagName)return;const d=l.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const k=d[f];if(k.src&&!g.includes(k.src)){g.push(k.src);const y=document.createElement("script");y.async=!0,y.src=k.src,document.head.appendChild(y)}else if(a.isJsScript(k)&&!s.includes(k.innerText))try{s.push(k.innerText),new Function(k.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!x&&(v(!0),h())},[l.current,x]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function Z(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},a.isEditing()&&e.imgSrc||"default-key")}function p(e){var S,s,m,x,v,h,d;function l(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...l()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((m=(s=e.builderBlock)==null?void 0:s.children)!=null&&m.length))?t.jsx(t.Fragment,{children:t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(v=(x=e.builderBlock)==null?void 0:x.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(d=(h=e.builderBlock)==null?void 0:h.children)!=null&&d.length&&!e.fitContent?t.jsx(t.Fragment,{children:t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const ee=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function te(e){var P,T,B,N,F,L,W;const l=r.useRef(null),[g,S]=r.useState(()=>0);r.useState(()=>!0);function s(n){var c,o;const i={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(o=(c=e.builderContextSignal).rootSetState)==null||o.call(c,i):e.builderContextSignal.rootState=i}function m(n){var c,o,u,b,K;const i={...e.builderContextSignal.content,...n,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...n==null?void 0:n.data},meta:{...(o=e.builderContextSignal.content)==null?void 0:o.meta,...n==null?void 0:n.meta,breakpoints:((u=n==null?void 0:n.meta)==null?void 0:u.breakpoints)||((K=(b=e.builderContextSignal.content)==null?void 0:b.meta)==null?void 0:K.breakpoints)}};M.postPreviewContent({value:i,key:i.id}).then(()=>{D.refresh()})}r.useState(()=>0);const[x,v]=r.useState(()=>!1),[h,d]=r.useState(()=>e.contentWrapper||"div");function f(n){var c;if(!a.isFromTrustedHost(e.trustedHosts,n))return;const{data:i}=n;if(i)switch(i.type){case"builder.configureSdk":{const o=i.data,{breakpoints:u,contentId:b}=o;if(!b||b!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&m({meta:{breakpoints:u}}),S(g+1);break}case"builder.contentUpdate":{const o=i.data,u=o.key||o.alias||o.entry||o.modelName,b=o.data;u===e.model&&(m(b),S(g+1));break}}}function k(){var i,c;const n=(c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.jsCode;n&&a.evaluate({code:n,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[y,ne]=r.useState(()=>({})),[j,q]=r.useState(()=>!1);function A(n){var i,c;if(e.builderContextSignal.content){const o=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;a._track({type:"click",canTrack:a.getDefaultCanTrack(e.canTrack),contentId:u,apiKey:e.apiKey,variationId:o!==u?o:void 0,...a.getInteractionPropertiesForEvent(n),unique:!j})}j||q(!0)}function _(n){return n.replace(/{{([^}]+)}}/g,(i,c)=>a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function z({url:n,key:i}){a.fetch(n).then(c=>c.json()).then(c=>{var u,b;const o={...e.builderContextSignal.rootState,[i]:c};(b=(u=e.builderContextSignal).rootSetState)==null||b.call(u,o),y[i]=!0}).catch(c=>{console.error("error fetching dynamic data",n,c)})}function w(){var i,c;const n=((c=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:c.httpRequests)??{};Object.entries(n).forEach(([o,u])=>{if(u&&(!y[o]||a.isEditing())){const b=_(u);z({url:b,key:o})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function R(n){S(g+1),window.addEventListener("message",f),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var o;const c=a.createRegisterComponentMessage(i);(o=window.parent)==null||o.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function I(n){const i=new URL(location.href).searchParams,c=i.get("builder.preview"),o=i.get(`builder.preview.${c}`),u=i.get("apiKey")||i.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||o===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(b=>{b&&m(b)})}const D=V.useRouter();return r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",R),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initeditingbldr",R)}},[]),r.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",I),()=>{var i;return(i=l.current)==null?void 0:i.removeEventListener("initpreviewingbldr",I)}},[]),r.useEffect(()=>{var n,i;if(a.isBrowser()){if(a.isEditing()&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const o=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,u=(i=e.builderContextSignal.content)==null?void 0:i.id,b=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:b,variationId:o!==u?o:void 0})}a.isPreviewing()&&l.current}},[]),r.useEffect(()=>{e.apiKey||a.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),k(),w(),C()},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.addEventListener("message",f))},[x]),r.useEffect(()=>{k()},[(T=(P=e.builderContextSignal.content)==null?void 0:P.data)==null?void 0:T.jsCode]),r.useEffect(()=>{w()},[(N=(B=e.builderContextSignal.content)==null?void 0:B.data)==null?void 0:N.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&s(e.data)},[e.data]),r.useEffect(()=>{e.locale&&s({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",f),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(ee.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:r.createElement(h,{key:g,ref:l,onClick:n=>A(n),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((L=e.content)==null?void 0:L.testVariationId)||((W=e.content)==null?void 0:W.id)}`},e.children)}):null})}exports.BlockWrapper=U;exports.BlocksWrapper=O;exports.Button=H;exports.CustomCode=X;exports.DynamicRenderer=E;exports.Embed=Y;exports.EnableEditor=te;exports.FragmentComponent=J;exports.Image=G;exports.ImgComponent=Z;exports.InteractiveElement=$;exports.SectionComponent=Q;exports.Video=p;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i, Fragment as h, jsxs as E } from "react/jsx-runtime";
|
|
3
|
-
import { i as p, g as D, a as $, b as O, c as w, d as R, e as ee, f as P, h as H, _ as V, j as te, l as ne, k as ie, m as U, n as ae, o as ce, r as re, s as le, p as oe, q as de, t as se } from "./bundle-
|
|
3
|
+
import { i as p, g as D, a as $, b as O, c as w, d as R, e as ee, f as P, h as H, _ as V, j as te, l as ne, k as ie, m as U, n as ae, o as ce, r as re, s as le, p as oe, q as de, t as se } from "./bundle-99e5b33f.js";
|
|
4
4
|
import { useRef as T, useState as x, useEffect as f, createContext as ue, createElement as me } from "react";
|
|
5
|
-
import { p as ge } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as ge } from "./USE_SERVER_BUNDLE-2fdc522e.js";
|
|
6
6
|
import { useRouter as be } from "next/navigation";
|
|
7
7
|
function J(e) {
|
|
8
8
|
return /* @__PURE__ */ i(h, { children: p(e.TagName) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ i(h, { children: typeof e.TagName == "string" ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
|
|
@@ -661,10 +661,7 @@ function We(e) {
|
|
|
661
661
|
P() && (window.removeEventListener("message", m), window.addEventListener("message", m));
|
|
662
662
|
}, [S]), f(() => {
|
|
663
663
|
k();
|
|
664
|
-
}, [
|
|
665
|
-
(F = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : F.jsCode,
|
|
666
|
-
e.builderContextSignal.rootState
|
|
667
|
-
]), f(() => {
|
|
664
|
+
}, [(F = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : F.jsCode]), f(() => {
|
|
668
665
|
B();
|
|
669
666
|
}, [(A = (K = e.builderContextSignal.content) == null ? void 0 : K.data) == null ? void 0 : A.httpRequests]), f(() => {
|
|
670
667
|
I();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-c799b7fc.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,6 +1,6 @@
|
|
|
1
1
|
import { LRUCache } from "lru-cache";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-
|
|
3
|
+
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-aa8ab44a.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase()), TARGET = "rsc", getClassPropName = () => {
|
|
@@ -106,19 +106,36 @@ const getLocation = () => {
|
|
|
106
106
|
builder: t,
|
|
107
107
|
context: n,
|
|
108
108
|
event: o,
|
|
109
|
-
state: flattenState(
|
|
109
|
+
state: flattenState({
|
|
110
|
+
rootState: a,
|
|
111
|
+
localState: i,
|
|
112
|
+
rootSetState: r
|
|
113
|
+
})
|
|
110
114
|
});
|
|
111
115
|
return new Function(...s.map(([c]) => c), e)(...s.map(([, c]) => c));
|
|
112
116
|
};
|
|
113
|
-
function flattenState(
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
function flattenState({
|
|
118
|
+
rootState: e,
|
|
119
|
+
localState: t,
|
|
120
|
+
rootSetState: n
|
|
121
|
+
}) {
|
|
116
122
|
return new Proxy(e, {
|
|
117
|
-
get: (o, i) =>
|
|
123
|
+
get: (o, i) => {
|
|
124
|
+
if (t && i in t)
|
|
125
|
+
return t[i];
|
|
126
|
+
const r = o[i];
|
|
127
|
+
return typeof r == "object" ? flattenState({
|
|
128
|
+
rootState: r,
|
|
129
|
+
localState: void 0,
|
|
130
|
+
rootSetState: n ? (a) => {
|
|
131
|
+
o[i] = a, n(o);
|
|
132
|
+
} : void 0
|
|
133
|
+
}) : r;
|
|
134
|
+
},
|
|
118
135
|
set: (o, i, r) => {
|
|
119
136
|
if (t && i in t)
|
|
120
137
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
121
|
-
return
|
|
138
|
+
return o[i] = r, n == null || n(o), !0;
|
|
122
139
|
}
|
|
123
140
|
});
|
|
124
141
|
}
|
|
@@ -2218,7 +2235,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2218
2235
|
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
2219
2236
|
}
|
|
2220
2237
|
};
|
|
2221
|
-
}, SDK_VERSION = "0.12.
|
|
2238
|
+
}, SDK_VERSION = "0.12.6", registry = {};
|
|
2222
2239
|
function register(e, t) {
|
|
2223
2240
|
let n = registry[e];
|
|
2224
2241
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const lruCache=require("lru-cache"),jsxRuntime=require("react/jsx-runtime"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";const lruCache=require("lru-cache"),jsxRuntime=require("react/jsx-runtime"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-343cb348.cjs");require("react");require("next/navigation");const EMPTY_HTML_ELEMENTS=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),isEmptyElement=e=>typeof e=="string"&&EMPTY_HTML_ELEMENTS.has(e.toLowerCase()),TARGET="rsc",getClassPropName=()=>{switch(TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function getBlockComponentOptions(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(){return isIframe()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){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},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),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()||TARGET==="reactNative"}},n=e.match(/Tablet|iPad/i),o=getLocation();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"}},getFunctionArguments=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const s=getFunctionArguments({builder:t,context:n,event:o,state:flattenState({rootState:a,localState:i,rootSetState:r})});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState({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"?flattenState({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 fastClone=e=>JSON.parse(JSON.stringify(e)),set=(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},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const ivm=safeDynamicRequire("isolated-vm"),getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
2
|
var refToProxy = (obj) => {
|
|
3
3
|
if (typeof obj !== 'object' || obj === null) {
|
|
4
4
|
return obj;
|
|
@@ -171,7 +171,7 @@ output;
|
|
|
171
171
|
)`,getUpdateVariantVisibilityScript=({contentId:e,variationId:t})=>`window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
172
172
|
"${t}", "${e}", ${isHydrationTarget}
|
|
173
173
|
)`;function InlinedScript(e){return jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const getIdFromSearchParams=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||logger.warn("No previewed ID found in search params."),n};function init(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new lruCache.LRUCache({max:500,ttl:1e3*60*5}))}function getPreviewContent(e){init();const t=getIdFromSearchParams(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function getGlobalThis(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function getFetch(){const e=getGlobalThis().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.
|
|
174
|
-
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 fetch$1=getFetch();function flatten(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,...flatten(r,a,n)}:{...o,[a]:r}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const i=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[i]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:s=!0,enrich:c,locale:m,apiVersion:f=DEFAULT_API_VERSION,fields:p,omit:g,offset:u,cacheSeconds:l,staleCacheSeconds:d,sort:b,includeUnpublished:S}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const h=new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m?`&locale=${m}`:""}${c?`&enrich=${c}`:""}`);if(h.searchParams.set("omit",g||"meta.componentsUsed"),p&&h.searchParams.set("fields",p),Number.isFinite(u)&&u>-1&&h.searchParams.set("offset",String(Math.floor(u))),typeof S=="boolean"&&h.searchParams.set("includeUnpublished",String(S)),l&&isPositiveNumber(l)&&h.searchParams.set("cacheSeconds",String(l)),d&&isPositiveNumber(d)&&h.searchParams.set("staleCacheSeconds",String(d)),b){const y=flatten({sort:b});for(const k in y)h.searchParams.set(k,JSON.stringify(y[k]))}const C={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},x=flatten(C);for(const y in x)h.searchParams.set(y,String(x[y]));if(o&&h.searchParams.set("userAttributes",JSON.stringify(o)),i){const y=flatten({query:i});for(const k in y)h.searchParams.set(k,JSON.stringify(y[k]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const getContent=fetchOneEntry,_fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);r.push(s||a)}t.results=r}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await handleABTesting({item:a,canTrack:o}));t.results=r}catch(r){logger.error("Could not process A/B tests. ",r)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}const getAllContent=fetchEntries,DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}function isPreviewing(){return!isBrowser()||isEditing()?!1:location.search.indexOf("builder.preview=")!==-1}function uuidv4(){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 uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(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},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=round(o/n.width),a=round(i/n.height);return{x:r,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},SDK_VERSION="0.12.
|
|
174
|
+
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 fetch$1=getFetch();function flatten(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,...flatten(r,a,n)}:{...o,[a]:r}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const i=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[i]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:s=!0,enrich:c,locale:m,apiVersion:f=DEFAULT_API_VERSION,fields:p,omit:g,offset:u,cacheSeconds:l,staleCacheSeconds:d,sort:b,includeUnpublished:S}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const h=new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m?`&locale=${m}`:""}${c?`&enrich=${c}`:""}`);if(h.searchParams.set("omit",g||"meta.componentsUsed"),p&&h.searchParams.set("fields",p),Number.isFinite(u)&&u>-1&&h.searchParams.set("offset",String(Math.floor(u))),typeof S=="boolean"&&h.searchParams.set("includeUnpublished",String(S)),l&&isPositiveNumber(l)&&h.searchParams.set("cacheSeconds",String(l)),d&&isPositiveNumber(d)&&h.searchParams.set("staleCacheSeconds",String(d)),b){const y=flatten({sort:b});for(const k in y)h.searchParams.set(k,JSON.stringify(y[k]))}const C={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},x=flatten(C);for(const y in x)h.searchParams.set(y,String(x[y]));if(o&&h.searchParams.set("userAttributes",JSON.stringify(o)),i){const y=flatten({query:i});for(const k in y)h.searchParams.set(k,JSON.stringify(y[k]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const getContent=fetchOneEntry,_fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);r.push(s||a)}t.results=r}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await handleABTesting({item:a,canTrack:o}));t.results=r}catch(r){logger.error("Could not process A/B tests. ",r)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}const getAllContent=fetchEntries,DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}function isPreviewing(){return!isBrowser()||isEditing()?!1:location.search.indexOf("builder.preview=")!==-1}function uuidv4(){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 uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(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},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=round(o/n.width),a=round(i/n.height);return{x:r,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},SDK_VERSION="0.12.6",registry={};function register(e,t){let n=registry[e];if(n||(n=registry[e]=[]),n.push(t),isBrowser()){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 registerInsertMenu=()=>{register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:TARGET,version:SDK_VERSION,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(!isFromTrustedHost(e.trustedHosts,o))return;const{data:i}=o;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const s=i.data.text,c=i.data.arguments||[],m=i.data.id,f=new Function(s);let p,g=null;try{p=f.apply(null,c)}catch(u){g=u}g?(r=window.parent)==null||r.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):p&&typeof p.then=="function"?p.then(u=>{var l;(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{id:m,result:u}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:p,id:m}},"*");break}}})))},getCssFromFont=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+=`
|
|
175
175
|
@font-face {
|
|
176
176
|
font-family: "${t}";
|
|
177
177
|
src: local("${n}"), url('${o}') format('woff2');
|
package/lib/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-c799b7fc.cjs"),t=require("./USE_CLIENT_BUNDLE-343cb348.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-cbcb1baf.cjs");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, w as m, C as c, R as g, v as p, S as l, T as C, z as d, p as B, H as S, A as f, q as u, D as E, F as R, E as h, c as x, j as k, x as y, y as F, G as P } from "./bundle-
|
|
2
|
-
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, w as m, C as c, R as g, v as p, S as l, T as C, z as d, p as B, H as S, A as f, q as u, D as E, F as R, E as h, c as x, j as k, x as y, y as F, G as P } from "./bundle-99e5b33f.js";
|
|
2
|
+
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-aa8ab44a.js";
|
|
3
3
|
import "lru-cache";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "next/navigation";
|
|
7
|
-
import "./USE_SERVER_BUNDLE-
|
|
7
|
+
import "./USE_SERVER_BUNDLE-2fdc522e.js";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
v as Button,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.6",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.12.
|
|
1
|
+
export declare const SDK_VERSION = "0.12.6";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { BuilderRenderState } from '../../../context/types.js';
|
|
2
2
|
import type { ExecutorArgs } from '../helpers.js';
|
|
3
3
|
export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
|
|
4
|
-
export declare function flattenState(rootState
|
|
4
|
+
export declare function flattenState({ rootState, localState, rootSetState }: {
|
|
5
|
+
rootState: Record<string | symbol, any>;
|
|
6
|
+
localState: Record<string | symbol, any> | undefined;
|
|
7
|
+
rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
|
|
8
|
+
}): BuilderRenderState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.12.
|
|
1
|
+
export declare const SDK_VERSION = "0.12.6";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { BuilderRenderState } from '../../../context/types.js';
|
|
2
2
|
import type { ExecutorArgs } from '../helpers.js';
|
|
3
3
|
export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
|
|
4
|
-
export declare function flattenState(rootState
|
|
4
|
+
export declare function flattenState({ rootState, localState, rootSetState }: {
|
|
5
|
+
rootState: Record<string | symbol, any>;
|
|
6
|
+
localState: Record<string | symbol, any> | undefined;
|
|
7
|
+
rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
|
|
8
|
+
}): BuilderRenderState;
|