@builder.io/sdk-react-nextjs 0.12.4 → 0.12.5
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-ee5a9d6f.cjs → browser/USE_CLIENT_BUNDLE-70be4cc5.cjs} +1 -1
- package/lib/browser/{USE_CLIENT_BUNDLE-e6d429be.js → USE_CLIENT_BUNDLE-7492ecd8.js} +2 -2
- package/lib/{edge/USE_SERVER_BUNDLE-816ab6e4.cjs → browser/USE_SERVER_BUNDLE-875d4629.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-c0911af0.js → browser/USE_SERVER_BUNDLE-fe386ed3.js} +1 -1
- package/lib/browser/{bundle-0e5cec1c.cjs → bundle-bd9886c9.cjs} +20 -20
- package/lib/browser/{bundle-bab67847.js → bundle-f9f52242.js} +247 -236
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{browser/USE_CLIENT_BUNDLE-e9e1ee85.cjs → edge/USE_CLIENT_BUNDLE-1148158d.cjs} +1 -1
- package/lib/{node/USE_CLIENT_BUNDLE-75f921e2.js → edge/USE_CLIENT_BUNDLE-cb840c0f.js} +2 -2
- package/lib/{node/USE_SERVER_BUNDLE-86d90afe.js → edge/USE_SERVER_BUNDLE-36de460d.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-793c12c9.cjs → edge/USE_SERVER_BUNDLE-50c2f18b.cjs} +1 -1
- package/lib/edge/{bundle-e64fe0fd.cjs → bundle-71cfdd3e.cjs} +23 -23
- package/lib/edge/{bundle-28d9d04c.js → bundle-765860e3.js} +323 -312
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-d87c391a.cjs → node/USE_CLIENT_BUNDLE-2f43c320.cjs} +1 -1
- package/lib/{edge/USE_CLIENT_BUNDLE-8d251b8b.js → node/USE_CLIENT_BUNDLE-4ba4594d.js} +2 -2
- package/lib/{browser/USE_SERVER_BUNDLE-44c49b1e.js → node/USE_SERVER_BUNDLE-2534ef71.js} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-9bcc0ad4.cjs → node/USE_SERVER_BUNDLE-473d50ad.cjs} +1 -1
- package/lib/node/{bundle-72df28b3.cjs → bundle-1c54df65.cjs} +5 -5
- package/lib/node/{bundle-031e3608.js → bundle-305bb463.js} +15 -4
- 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/should-force-browser-runtime-in-node.d.ts +1 -0
- package/types/cjs/functions/is-node-runtime.d.ts +4 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/evaluate/should-force-browser-runtime-in-node.d.ts +1 -0
- package/types/esm/functions/is-node-runtime.d.ts +4 -0
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-71cfdd3e.cjs"),t=require("./USE_CLIENT_BUNDLE-1148158d.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-50c2f18b.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-765860e3.js";
|
|
2
|
+
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-cb840c0f.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-36de460d.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-1c54df65.cjs"),r=require("react"),M=require("./USE_SERVER_BUNDLE-473d50ad.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;
|
|
@@ -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-305bb463.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-2534ef71.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 }) }) }) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-1c54df65.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 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-2f43c320.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(a,i,r)});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState(e,t,n){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(o,i)=>t&&i in t?t[i]:e[i],set:(o,i,r)=>{if(t&&i in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[i]=r,n==null||n(e),!0}})}const 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;
|
|
@@ -38,14 +38,14 @@ if (typeof output === 'object' && output !== null) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
output;
|
|
41
|
-
`},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const s=fastClone({...a,...i}),c=getFunctionArguments({builder:t,context:n,event:o,state:s}),m=getIsolateContext(),f=m.global;f.setSync("global",f.derefInto()),f.setSync("log",function(...u){console.log(...u)}),f.setSync(BUILDER_SET_STATE_NAME,function(u,l){set(a,u,l),r==null||r(a)}),c.forEach(([u,l])=>{const d=typeof l=="object"?new ivm.Reference(u==="builder"?{...l,getUserAttributes:()=>l.getUserAttributes()}:l):null;f.setSync(getSyncValName(u),d)}),f.setSync(INJECTED_IVM_GLOBAL,ivm);const p=processCode({code:e,args:c}),g=m.evalSync(p);try{return JSON.parse(g)}catch{return g}},chooseBrowserOrServerEval=e=>isBrowser()?runInBrowser(e):runInNode(e);function evaluate({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0}){if(e===""){logger.warn("Skipping evaluation of empty code block.");return}const s={code:parseCode(e,{isExpression:a}),builder:getBuilderGlobals(),context:t,event:r,rootSetState:i,rootState:o,localState:n};try{return chooseBrowserOrServerEval(s)}catch(c){logger.error("Failed code evaluation: "+c.message,{code:e});return}}function transformBlock(e){return e}const evaluateBindings=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=fastClone(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const s in e.bindings){const c=e.bindings[s],m=evaluate({code:c,localState:n,rootState:o,rootSetState:i,context:t});set(a,s,m)}return a};function getProcessedBlock({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?evaluateBindings({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const getComponent=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!o)return null;const i=n[o];if(i)return i;console.warn(`
|
|
41
|
+
`},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const s=fastClone({...a,...i}),c=getFunctionArguments({builder:t,context:n,event:o,state:s}),m=getIsolateContext(),f=m.global;f.setSync("global",f.derefInto()),f.setSync("log",function(...u){console.log(...u)}),f.setSync(BUILDER_SET_STATE_NAME,function(u,l){set(a,u,l),r==null||r(a)}),c.forEach(([u,l])=>{const d=typeof l=="object"?new ivm.Reference(u==="builder"?{...l,getUserAttributes:()=>l.getUserAttributes()}:l):null;f.setSync(getSyncValName(u),d)}),f.setSync(INJECTED_IVM_GLOBAL,ivm);const p=processCode({code:e,args:c}),g=m.evalSync(p);try{return JSON.parse(g)}catch{return g}},checkIsDefined=e=>e!=null;function isNodeRuntime(){var e;return typeof process<"u"&&checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const shouldForceBrowserRuntimeInNode=()=>{var o;if(!isNodeRuntime())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?(logger.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},chooseBrowserOrServerEval=e=>isBrowser()||shouldForceBrowserRuntimeInNode()?runInBrowser(e):runInNode(e);function evaluate({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0}){if(e===""){logger.warn("Skipping evaluation of empty code block.");return}const s={code:parseCode(e,{isExpression:a}),builder:getBuilderGlobals(),context:t,event:r,rootSetState:i,rootState:o,localState:n};try{return chooseBrowserOrServerEval(s)}catch(c){logger.error("Failed code evaluation: "+c.message,{code:e});return}}function transformBlock(e){return e}const evaluateBindings=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=fastClone(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const s in e.bindings){const c=e.bindings[s],m=evaluate({code:c,localState:n,rootState:o,rootSetState:i,context:t});set(a,s,m)}return a};function getProcessedBlock({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?evaluateBindings({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const getComponent=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!o)return null;const i=n[o];if(i)return i;console.warn(`
|
|
42
42
|
Could not find a registered component named "${o}".
|
|
43
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`)},getRepeatItemData=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=evaluate({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(i))return;const r=n.collection.split(".").pop(),a=n.itemName||(r?r+"Item":"item");return i.map((c,m)=>({context:{...t,localState:{...t.localState,$index:m,$item:c,[a]:c,[`$${a}Index`]:m}},block:o}))},SIZES={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},getMaxWidthQueryForSize=(e,t=SIZES)=>`@media (max-width: ${t[e].max}px)`,getSizesForBreakpoints=({small:e,medium:t})=>{const n=fastClone(SIZES);if(!e||!t)return n;const o=Math.floor(e/2);n.small={max:e,min:o,default:o+1};const i=n.small.max+1;n.medium={max:t,min:i,default:i+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n},camelToKebabCase=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),
|
|
43
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`)},getRepeatItemData=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=evaluate({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(i))return;const r=n.collection.split(".").pop(),a=n.itemName||(r?r+"Item":"item");return i.map((c,m)=>({context:{...t,localState:{...t.localState,$index:m,$item:c,[a]:c,[`$${a}Index`]:m}},block:o}))},SIZES={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},getMaxWidthQueryForSize=(e,t=SIZES)=>`@media (max-width: ${t[e].max}px)`,getSizesForBreakpoints=({small:e,medium:t})=>{const n=fastClone(SIZES);if(!e||!t)return n;const o=Math.floor(e/2);n.small={max:e,min:o,default:o+1};const i=n.small.max+1;n.medium={max:t,min:i,default:i+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n},camelToKebabCase=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),convertStyleMapToCSSArray=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${camelToKebabCase(n)}: ${o};`}).filter(checkIsDefined),convertStyleMapToCSS=e=>convertStyleMapToCSSArray(e).join(`
|
|
44
44
|
`),createCssClass=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
|
|
45
45
|
${convertStyleMapToCSS(n)}
|
|
46
46
|
}`;return e?`${e} {
|
|
47
47
|
${o}
|
|
48
|
-
}`:o};function InlinedStyles(e){return jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function BlockStyles(e){const t=function(){const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return checkIsDefined(i.hide)?!i.hide:checkIsDefined(i.show)?i.show:!0},n=function(){var d;const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,a=e.context.content,s=getSizesForBreakpoints(((d=a==null?void 0:a.meta)==null?void 0:d.breakpoints)||{}),c=r==null?void 0:r.large,m=r==null?void 0:r.medium,f=r==null?void 0:r.small,p=i.id;if(!p)return"";const g=c?createCssClass({className:p,styles:c}):"",u=m?createCssClass({className:p,styles:m,mediaQuery:getMaxWidthQueryForSize("medium",s)}):"",l=f?createCssClass({className:p,styles:f,mediaQuery:getMaxWidthQueryForSize("small",s)}):"";return[g,u,l].join(" ")};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:n()&&t()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:n()})}):null})}function capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}const getEventHandlerName=e=>`on${capitalizeFirstLetter(e)}`,createEventHandler=(e,t)=>n=>evaluate({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function getBlockActions(e){const t={},n=e.block.actions??{};for(const o in n){if(!n.hasOwnProperty(o))continue;const i=n[o];let r=getEventHandlerName(o);if(e.stripPrefix)switch(TARGET){case"vue":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=createEventHandler(i,e)}return t}function transformStyleProperty({style:e}){return e}const getStyle=({block:e,context:t})=>mapStyleObjToStrIfNeeded(transformStyleProperty({style:e.style||{},context:t,block:e}));function mapStyleObjToStrIfNeeded(e){switch(TARGET){case"svelte":case"vue":case"solid":return convertStyleMapToCSSArray(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function transformBlockProperties({properties:e}){return e}const extractRelevantRootBlockProperties=e=>({href:e.href});function getBlockProperties({block:e,context:t}){var o;const n={...extractRelevantRootBlockProperties(e),...e.properties,"builder-id":e.id,style:getStyle({block:e,context:t}),[getClassPropName()]:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return transformBlockProperties({properties:n,context:t,block:e})}const getWrapperProps=({componentOptions:e,builderBlock:t,context:n,componentRef:o,includeBlockProps:i,isInteractive:r,contextValue:a})=>{const s={...e,...i?{attributes:getBlockProperties({block:t,context:a})}:{}};return r?{Wrapper:o,block:t,context:n,wrapperProps:e,includeBlockProps:i}:s};function ComponentRef(e){var n;const t=e.isInteractive?USE_CLIENT_BUNDLE.InteractiveElement:e.componentRef;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.componentRef?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(t,{...getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(n=e.blockChildren)==null?void 0:n.map(o=>jsxRuntime.jsx(Block,{block:o,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},o.id))})}):null})}function RepeatedBlock(e){const t=e.repeatContext;return jsxRuntime.jsx(Block,{block:e.block,context:t,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent})}function Block(e){var m,f,p;const t=function(){return getComponent({block:e.block,context:e.context,registeredComponents:e.registeredComponents})},n=function(){return getRepeatItemData({block:e.block,context:e.context})},o=function(){var u;return(u=e.block.repeat)!=null&&u.collection?e.block:getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})},i=function(){var l;return e.block.tagName==="a"||((l=o().properties)==null?void 0:l.href)||o().href?e.linkComponent||"a":e.block.tagName||"div"},r=function(){var d,b;if((d=e.block.repeat)!=null&&d.collection)return!!((b=n())!=null&&b.length);const u="hide"in o()?o().hide:!1;return("show"in o()?o().show:!0)&&!u},a=function(){var l;return!((l=t())!=null&&l.component)&&!n()?o().children??[]:[]},s=function(){var u,l,d,b,S,h,C,
|
|
48
|
+
}`:o};function InlinedStyles(e){return jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function BlockStyles(e){const t=function(){const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return checkIsDefined(i.hide)?!i.hide:checkIsDefined(i.show)?i.show:!0},n=function(){var d;const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,a=e.context.content,s=getSizesForBreakpoints(((d=a==null?void 0:a.meta)==null?void 0:d.breakpoints)||{}),c=r==null?void 0:r.large,m=r==null?void 0:r.medium,f=r==null?void 0:r.small,p=i.id;if(!p)return"";const g=c?createCssClass({className:p,styles:c}):"",u=m?createCssClass({className:p,styles:m,mediaQuery:getMaxWidthQueryForSize("medium",s)}):"",l=f?createCssClass({className:p,styles:f,mediaQuery:getMaxWidthQueryForSize("small",s)}):"";return[g,u,l].join(" ")};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:n()&&t()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:n()})}):null})}function capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}const getEventHandlerName=e=>`on${capitalizeFirstLetter(e)}`,createEventHandler=(e,t)=>n=>evaluate({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function getBlockActions(e){const t={},n=e.block.actions??{};for(const o in n){if(!n.hasOwnProperty(o))continue;const i=n[o];let r=getEventHandlerName(o);if(e.stripPrefix)switch(TARGET){case"vue":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=createEventHandler(i,e)}return t}function transformStyleProperty({style:e}){return e}const getStyle=({block:e,context:t})=>mapStyleObjToStrIfNeeded(transformStyleProperty({style:e.style||{},context:t,block:e}));function mapStyleObjToStrIfNeeded(e){switch(TARGET){case"svelte":case"vue":case"solid":return convertStyleMapToCSSArray(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function transformBlockProperties({properties:e}){return e}const extractRelevantRootBlockProperties=e=>({href:e.href});function getBlockProperties({block:e,context:t}){var o;const n={...extractRelevantRootBlockProperties(e),...e.properties,"builder-id":e.id,style:getStyle({block:e,context:t}),[getClassPropName()]:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return transformBlockProperties({properties:n,context:t,block:e})}const getWrapperProps=({componentOptions:e,builderBlock:t,context:n,componentRef:o,includeBlockProps:i,isInteractive:r,contextValue:a})=>{const s={...e,...i?{attributes:getBlockProperties({block:t,context:a})}:{}};return r?{Wrapper:o,block:t,context:n,wrapperProps:e,includeBlockProps:i}:s};function ComponentRef(e){var n;const t=e.isInteractive?USE_CLIENT_BUNDLE.InteractiveElement:e.componentRef;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.componentRef?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(t,{...getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(n=e.blockChildren)==null?void 0:n.map(o=>jsxRuntime.jsx(Block,{block:o,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},o.id))})}):null})}function RepeatedBlock(e){const t=e.repeatContext;return jsxRuntime.jsx(Block,{block:e.block,context:t,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent})}function Block(e){var m,f,p;const t=function(){return getComponent({block:e.block,context:e.context,registeredComponents:e.registeredComponents})},n=function(){return getRepeatItemData({block:e.block,context:e.context})},o=function(){var u;return(u=e.block.repeat)!=null&&u.collection?e.block:getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})},i=function(){var l;return e.block.tagName==="a"||((l=o().properties)==null?void 0:l.href)||o().href?e.linkComponent||"a":e.block.tagName||"div"},r=function(){var d,b;if((d=e.block.repeat)!=null&&d.collection)return!!((b=n())!=null&&b.length);const u="hide"in o()?o().hide:!1;return("show"in o()?o().show:!0)&&!u},a=function(){var l;return!((l=t())!=null&&l.component)&&!n()?o().children??[]:[]},s=function(){var u,l,d,b,S,h,C,x;return{blockChildren:o().children??[],componentRef:(u=t())==null?void 0:u.component,componentOptions:{...getBlockComponentOptions(o()),builderContext:e.context,...((l=t())==null?void 0:l.name)==="Core:Button"||((d=t())==null?void 0:d.name)==="Symbol"||((b=t())==null?void 0:b.name)==="Columns"?{builderLinkComponent:e.linkComponent}:{},...((S=t())==null?void 0:S.name)==="Symbol"||((h=t())==null?void 0:h.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:c,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:o(),includeBlockProps:((C=t())==null?void 0:C.noWrap)===!0,isInteractive:!((x=t())!=null&&x.isRSC)}},c=e.context;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(BlockStyles,{block:e.block,context:e.context}),(m=t())!=null&&m.noWrap?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ComponentRef,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,linkComponent:s().linkComponent,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:n()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:(p=n())==null?void 0:p.map((g,u)=>jsxRuntime.jsx(RepeatedBlock,{repeatContext:g.context,block:g.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},u))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(USE_CLIENT_BUNDLE.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,linkComponent:e.linkComponent,children:[jsxRuntime.jsx(ComponentRef,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,linkComponent:s().linkComponent,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive}),(f=a())==null?void 0:f.map(g=>jsxRuntime.jsx(Block,{block:g,context:c,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},g.id))]})})})]}):null})}function Blocks(e){var t,n,o;return jsxRuntime.jsx(USE_CLIENT_BUNDLE.BlocksWrapper,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,BlocksWrapper:(t=e.context)==null?void 0:t.BlocksWrapper,BlocksWrapperProps:(n=e.context)==null?void 0:n.BlocksWrapperProps,children:e.blocks?jsxRuntime.jsx(jsxRuntime.Fragment,{children:(o=e.blocks)==null?void 0:o.map(i=>jsxRuntime.jsx(Block,{block:i,linkComponent:e.linkComponent,context:e.context,registeredComponents:e.registeredComponents},i.id))}):null})}function Columns(e){var u;const t=typeof e.space=="number"?e.space||0:20,n=e.columns||[],o=e.stackColumnsAt||"tablet",i=function(d){var b;return((b=n[d])==null?void 0:b.width)||100/n.length},r=function(d){const b=t*(n.length-1)/n.length;return`calc(${i(d)}% - ${b}px)`},a=function({stackedStyle:d,desktopStyle:b}){return o==="tablet"?d:b},s=function({stackedStyle:d,desktopStyle:b}){return o==="never"?b:d},c=e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column",m=function(){return{"--flex-dir":c,"--flex-dir-tablet":a({stackedStyle:c,desktopStyle:"row"})}},f=function(d){const b=d===0?0:t,S=r(d),h=`${b}px`,C="100%",x=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:S,["marginLeft"]:h,"--column-width-mobile":s({stackedStyle:C,desktopStyle:S}),"--column-margin-left-mobile":s({stackedStyle:x,desktopStyle:h}),"--column-width-tablet":a({stackedStyle:C,desktopStyle:S}),"--column-margin-left-tablet":a({stackedStyle:x,desktopStyle:h})}},p=function(d){var S,h;return getSizesForBreakpoints(((h=(S=e.builderContext.content)==null?void 0:S.meta)==null?void 0:h.breakpoints)||{})[d].max},g=function(){return`
|
|
49
49
|
@media (max-width: ${p("medium")}px) {
|
|
50
50
|
.${e.builderBlock.id}-breakpoints {
|
|
51
51
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -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
|
|
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.5",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');
|
|
@@ -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-4ba4594d.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 = () => {
|
|
@@ -223,7 +223,18 @@ output;
|
|
|
223
223
|
} catch {
|
|
224
224
|
return g;
|
|
225
225
|
}
|
|
226
|
-
},
|
|
226
|
+
}, checkIsDefined = (e) => e != null;
|
|
227
|
+
function isNodeRuntime() {
|
|
228
|
+
var e;
|
|
229
|
+
return typeof process < "u" && checkIsDefined((e = process == null ? void 0 : process.versions) == null ? void 0 : e.node);
|
|
230
|
+
}
|
|
231
|
+
const shouldForceBrowserRuntimeInNode = () => {
|
|
232
|
+
var o;
|
|
233
|
+
if (!isNodeRuntime())
|
|
234
|
+
return !1;
|
|
235
|
+
const e = process.arch === "arm64", t = process.version.startsWith("v20"), n = (o = process.env.NODE_OPTIONS) == null ? void 0 : o.includes("--no-node-snapshot");
|
|
236
|
+
return e && t && !n ? (logger.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;
|
|
237
|
+
}, chooseBrowserOrServerEval = (e) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(e) : runInNode(e);
|
|
227
238
|
function evaluate({
|
|
228
239
|
code: e,
|
|
229
240
|
context: t,
|
|
@@ -404,7 +415,7 @@ const getComponent = ({
|
|
|
404
415
|
min: r,
|
|
405
416
|
default: r + 1
|
|
406
417
|
}, n;
|
|
407
|
-
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(),
|
|
418
|
+
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, o]) => {
|
|
408
419
|
if (typeof o == "string")
|
|
409
420
|
return `${camelToKebabCase(n)}: ${o};`;
|
|
410
421
|
}).filter(checkIsDefined), convertStyleMapToCSS = (e) => convertStyleMapToCSSArray(e).join(`
|
|
@@ -2207,7 +2218,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2207
2218
|
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
2208
2219
|
}
|
|
2209
2220
|
};
|
|
2210
|
-
}, SDK_VERSION = "0.12.
|
|
2221
|
+
}, SDK_VERSION = "0.12.5", registry = {};
|
|
2211
2222
|
function register(e, t) {
|
|
2212
2223
|
let n = registry[e];
|
|
2213
2224
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
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-1c54df65.cjs"),t=require("./USE_CLIENT_BUNDLE-2f43c320.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-473d50ad.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-305bb463.js";
|
|
2
|
+
import { b as v, F as w, c as A, S as T, V } from "./USE_CLIENT_BUNDLE-4ba4594d.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-2534ef71.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.5",
|
|
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.5";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldForceBrowserRuntimeInNode: () => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.12.
|
|
1
|
+
export declare const SDK_VERSION = "0.12.5";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldForceBrowserRuntimeInNode: () => boolean;
|