@builder.io/sdk-react-nextjs 0.14.11 → 0.14.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/{USE_CLIENT_BUNDLE-3b942ae2.js → USE_CLIENT_BUNDLE-6ac6c863.js} +203 -211
- package/lib/browser/USE_CLIENT_BUNDLE-c6228734.cjs +21 -0
- package/lib/{edge/USE_SERVER_BUNDLE-ef053564.js → browser/USE_SERVER_BUNDLE-1de84180.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-812e699d.cjs → browser/USE_SERVER_BUNDLE-8d870a7d.cjs} +1 -1
- package/lib/browser/{bundle-260ced55.cjs → bundle-f15c021e.cjs} +2 -2
- package/lib/browser/{bundle-76453d46.js → bundle-f830d2ad.js} +21 -21
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +24 -23
- package/lib/{node/USE_CLIENT_BUNDLE-64c45aac.js → edge/USE_CLIENT_BUNDLE-20aebe3e.js} +203 -211
- package/lib/edge/USE_CLIENT_BUNDLE-714c22c7.cjs +21 -0
- package/lib/{node/USE_SERVER_BUNDLE-ed1c8346.js → edge/USE_SERVER_BUNDLE-87b221af.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-299ebfe7.cjs → edge/USE_SERVER_BUNDLE-dfe3d2e3.cjs} +1 -1
- package/lib/edge/{bundle-c186261f.cjs → bundle-5a4040f8.cjs} +2 -2
- package/lib/edge/{bundle-19c1b23d.js → bundle-d7a3ce0a.js} +21 -21
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +24 -23
- package/lib/node/USE_CLIENT_BUNDLE-9fbb2664.cjs +21 -0
- package/lib/{edge/USE_CLIENT_BUNDLE-42619af6.js → node/USE_CLIENT_BUNDLE-e6e77d7b.js} +203 -211
- package/lib/{browser/USE_SERVER_BUNDLE-ec83933e.cjs → node/USE_SERVER_BUNDLE-44095c01.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-0fe135ea.js → node/USE_SERVER_BUNDLE-c4348bf9.js} +1 -1
- package/lib/node/{bundle-b5555d47.cjs → bundle-3f8cf8a2.cjs} +2 -2
- package/lib/node/{bundle-1a5c4f3c.js → bundle-b1907ae3.js} +6 -6
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +24 -23
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/index.d.ts +1 -0
- package/types/cjs/index-helpers/blocks-exports.d.ts +4 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/index.d.ts +1 -0
- package/types/esm/index-helpers/blocks-exports.d.ts +4 -0
- package/lib/browser/USE_CLIENT_BUNDLE-4cb813ce.cjs +0 -21
- package/lib/edge/USE_CLIENT_BUNDLE-dfe5c354.cjs +0 -21
- package/lib/node/USE_CLIENT_BUNDLE-7dfe38c5.cjs +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-3f8cf8a2.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 jsxRuntime=require("react/jsx-runtime");require("react");const
|
|
1
|
+
"use strict";const jsxRuntime=require("react/jsx-runtime");require("react");const USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-9fbb2664.cjs"),lruCache=require("lru-cache");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"}const convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,getSearchString=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(e){return isIframe()&&getSearchString(e||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:r,rootSetState:i,rootState:a})=>{const s=getFunctionArguments({builder:t,context:n,event:o,state:flattenState({rootState:a,localState:r,rootSetState:i})});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,r)=>{if(t&&r in t)return t[r];const i=o[r];return typeof i=="object"&&i!==null?flattenState({rootState:i,localState:void 0,rootSetState:n?a=>{o[r]=a,n(o)}:void 0}):i},set:(o,r,i)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return o[r]=i,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((r,i,a)=>Object(r[i])===r[i]?r[i]:r[i]=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 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},"data-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,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{const{limit:t=30,userAttributes:n,query:o,model:r,apiKey:i,enrich:a,locale:s,apiVersion:c=DEFAULT_API_VERSION,fields:d,omit:g,offset:l,cacheSeconds:f,staleCacheSeconds:p,sort:m,includeUnpublished:u}=e;if(!i)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const b=t!==1,h=new URL(`https://cdn.builder.io/api/${c}/content/${r}`);if(h.searchParams.set("apiKey",i),h.searchParams.set("limit",String(t)),h.searchParams.set("noTraverse",String(b)),h.searchParams.set("includeRefs",String(!0)),s&&h.searchParams.set("locale",s),a&&h.searchParams.set("enrich",String(a)),h.searchParams.set("omit",g||"meta.componentsUsed"),d&&h.searchParams.set("fields",d),Number.isFinite(l)&&l>-1&&h.searchParams.set("offset",String(Math.floor(l))),typeof u=="boolean"&&h.searchParams.set("includeUnpublished",String(u)),f&&isPositiveNumber(f)&&h.searchParams.set("cacheSeconds",String(f)),p&&isPositiveNumber(p)&&h.searchParams.set("staleCacheSeconds",String(p)),m){const y=flatten({sort:m});for(const x in y)h.searchParams.set(x,JSON.stringify(y[x]))}const S={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(S);for(const y in C)h.searchParams.set(y,String(C[y]));if(n&&h.searchParams.set("userAttributes",JSON.stringify(n)),o){const y=flatten({query:o});for(const x in y)h.searchParams.set(x,JSON.stringify(y[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const _fetchContent=async e=>{const t=generateContentUrl(e);return await(await(e.fetch??fetch$1)(t.href,e.fetchOptions)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}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}}function isPreviewing(e){if(!isBrowser())return!1;const t=getSearchString(e||window.location.search);return isEditing(t)?!1:t.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(r){console.debug("[LocalStorage] SET error: ",r)}},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,...r})=>({type:e,data:{...r,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,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,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}}},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(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.14.11",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(r){console.debug("Could not postmessage",r)}}}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 i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],d=r.data.id,g=new Function(s);let l,f=null;try{l=g.apply(null,c)}catch(p){f=p}f?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:d,error:f.message}},"*"):l&&typeof l.then=="function"?l.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:d,result:p}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:l,id:d}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
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,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{const{limit:t=30,userAttributes:n,query:o,model:r,apiKey:i,enrich:a,locale:s,apiVersion:c=DEFAULT_API_VERSION,fields:d,omit:g,offset:l,cacheSeconds:f,staleCacheSeconds:p,sort:m,includeUnpublished:u}=e;if(!i)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const b=t!==1,h=new URL(`https://cdn.builder.io/api/${c}/content/${r}`);if(h.searchParams.set("apiKey",i),h.searchParams.set("limit",String(t)),h.searchParams.set("noTraverse",String(b)),h.searchParams.set("includeRefs",String(!0)),s&&h.searchParams.set("locale",s),a&&h.searchParams.set("enrich",String(a)),h.searchParams.set("omit",g||"meta.componentsUsed"),d&&h.searchParams.set("fields",d),Number.isFinite(l)&&l>-1&&h.searchParams.set("offset",String(Math.floor(l))),typeof u=="boolean"&&h.searchParams.set("includeUnpublished",String(u)),f&&isPositiveNumber(f)&&h.searchParams.set("cacheSeconds",String(f)),p&&isPositiveNumber(p)&&h.searchParams.set("staleCacheSeconds",String(p)),m){const y=flatten({sort:m});for(const x in y)h.searchParams.set(x,JSON.stringify(y[x]))}const S={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(S);for(const y in C)h.searchParams.set(y,String(C[y]));if(n&&h.searchParams.set("userAttributes",JSON.stringify(n)),o){const y=flatten({query:o});for(const x in y)h.searchParams.set(x,JSON.stringify(y[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const _fetchContent=async e=>{const t=generateContentUrl(e);return await(await(e.fetch??fetch$1)(t.href,e.fetchOptions)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}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}}function isPreviewing(e){if(!isBrowser())return!1;const t=getSearchString(e||window.location.search);return isEditing(t)?!1:t.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(r){console.debug("[LocalStorage] SET error: ",r)}},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,...r})=>({type:e,data:{...r,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,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,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}}},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(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.14.13",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(r){console.debug("Could not postmessage",r)}}}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 i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],d=r.data.id,g=new Function(s);let l,f=null;try{l=g.apply(null,c)}catch(p){f=p}f?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:d,error:f.message}},"*"):l&&typeof l.then=="function"?l.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:d,result:p}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:l,id:d}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
175
175
|
@font-face {
|
|
176
176
|
font-family: "${t}";
|
|
177
177
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
+
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-e6e77d7b.js";
|
|
3
4
|
import { LRUCache } from "lru-cache";
|
|
4
|
-
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-64c45aac.js";
|
|
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 = () => {
|
|
7
7
|
switch (TARGET) {
|
|
@@ -2278,7 +2278,7 @@ function isFromTrustedHost(e, t) {
|
|
|
2278
2278
|
const n = new URL(t.origin), o = n.hostname;
|
|
2279
2279
|
return (e || DEFAULT_TRUSTED_HOSTS).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
|
|
2280
2280
|
}
|
|
2281
|
-
const SDK_VERSION = "0.14.
|
|
2281
|
+
const SDK_VERSION = "0.14.13", registry = {};
|
|
2282
2282
|
function register(e, t) {
|
|
2283
2283
|
let n = registry[e];
|
|
2284
2284
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
|
@@ -2870,13 +2870,13 @@ export {
|
|
|
2870
2870
|
logger as l,
|
|
2871
2871
|
evaluate as m,
|
|
2872
2872
|
getInteractionPropertiesForEvent as n,
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2873
|
+
fetch$1 as o,
|
|
2874
|
+
fastClone as p,
|
|
2875
|
+
createRegisterComponentMessage as q,
|
|
2876
2876
|
registerInsertMenu as r,
|
|
2877
2877
|
setupBrowserForEditing as s,
|
|
2878
2878
|
triggerAnimation as t,
|
|
2879
|
-
|
|
2879
|
+
fetchOneEntry as u,
|
|
2880
2880
|
init as v,
|
|
2881
2881
|
ContentVariants as w,
|
|
2882
2882
|
register as x,
|
package/lib/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-9fbb2664.cjs"),e=require("./bundle-3f8cf8a2.cjs");require("react/jsx-runtime");require("react");require("./USE_SERVER_BUNDLE-44095c01.cjs");require("next/navigation");require("lru-cache");exports.BuilderContext=t.builderContext;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as l, C as
|
|
1
|
+
import { f as n, c as m, F as c, d as p, S as g, V as d } from "./USE_CLIENT_BUNDLE-e6e77d7b.js";
|
|
2
|
+
import { B as l, C as f, w as B, S as C, T as E, F as S, q as x, E as h, G as b, u as y, z as F, c as P, j as T, x as k, y as w, D as R, A as V } from "./bundle-b1907ae3.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./USE_SERVER_BUNDLE-
|
|
5
|
+
import "./USE_SERVER_BUNDLE-c4348bf9.js";
|
|
6
6
|
import "next/navigation";
|
|
7
7
|
import "lru-cache";
|
|
8
8
|
export {
|
|
9
9
|
l as Blocks,
|
|
10
|
-
n as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
c as
|
|
15
|
-
p as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
n as BuilderContext,
|
|
11
|
+
m as Button,
|
|
12
|
+
f as Columns,
|
|
13
|
+
B as Content,
|
|
14
|
+
c as Fragment,
|
|
15
|
+
p as Image,
|
|
16
|
+
g as Section,
|
|
17
|
+
C as Symbol,
|
|
18
|
+
E as Text,
|
|
19
|
+
d as Video,
|
|
20
|
+
S as _processContentResult,
|
|
21
|
+
x as createRegisterComponentMessage,
|
|
21
22
|
h as fetchBuilderProps,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
b as fetchEntries,
|
|
24
|
+
y as fetchOneEntry,
|
|
25
|
+
F as getBuilderSearchParams,
|
|
26
|
+
P as isEditing,
|
|
27
|
+
T as isPreviewing,
|
|
28
|
+
k as register,
|
|
29
|
+
w as setEditorSettings,
|
|
30
|
+
R as subscribeToEditor,
|
|
31
|
+
V as track
|
|
31
32
|
};
|
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.14.
|
|
4
|
+
"version": "0.14.13",
|
|
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.14.
|
|
1
|
+
export declare const SDK_VERSION = "0.14.13";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BuilderContext } from './builder.context.js';
|
|
@@ -8,3 +8,7 @@ export { default as Text } from '../blocks/text/index.js';
|
|
|
8
8
|
export { default as Video } from '../blocks/video/index.js';
|
|
9
9
|
export { default as Blocks } from '../components/blocks/index.js';
|
|
10
10
|
export { default as Content } from '../components/content-variants/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Builder Context
|
|
13
|
+
*/
|
|
14
|
+
export { BuilderContext } from '../context/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.14.
|
|
1
|
+
export declare const SDK_VERSION = "0.14.13";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BuilderContext } from './builder.context.js';
|
|
@@ -8,3 +8,7 @@ export { default as Text } from '../blocks/text/index.js';
|
|
|
8
8
|
export { default as Video } from '../blocks/video/index.js';
|
|
9
9
|
export { default as Blocks } from '../components/blocks/index.js';
|
|
10
10
|
export { default as Content } from '../components/content-variants/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Builder Context
|
|
13
|
+
*/
|
|
14
|
+
export { BuilderContext } from '../context/index.js';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-260ced55.cjs"),o=require("react"),_=require("./USE_SERVER_BUNDLE-ec83933e.cjs"),z=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(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function M(e){return t.jsx(E,{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"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function D(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 V(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 H(e){function r(){var l;return"builder-blocks"+((l=e.blocks)!=null&&l.length?"":" no-blocks")}function m(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:r()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:l=>m(),onMouseEnter:l=>S(),onKeyPress:l=>m(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: stretch;
|
|
5
|
-
}`})]})}function U(e){return t.jsx("span",{children:e.children})}function $(e){var l,b,h,x;function r(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),a.getSrcSet(d)}else if(e.image&&!e.srcset)return a.getSrcSet(d);return a.getSrcSet(d)}function m(){var g;return(g=r==null?void 0:r())!=null&&g.match(/builder\.io/)&&!e.noWebp?r().replace(/\?/g,"?format=webp&"):""}function S(){const g={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?g:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[m()?t.jsx("source",{type:"image/webp",srcSet:m()}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-a0c95e8c",src:e.image,srcSet:r(),sizes:e.sizes})]}),e.aspectRatio&&!((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-a0c95e8c",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx("div",{className:"div-a0c95e8c-2",children:e.children}):null]}),t.jsx("style",{children:`.img-a0c95e8c {
|
|
6
|
-
opacity: 1;
|
|
7
|
-
transition: opacity 0.2s ease-in-out;
|
|
8
|
-
}.div-a0c95e8c {
|
|
9
|
-
width: 100%;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
font-size: 0;
|
|
12
|
-
}.div-a0c95e8c-2 {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: stretch;
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 0;
|
|
18
|
-
left: 0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
}`})]})}function O(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function J(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]);return o.useEffect(()=>{var x;if(!((x=r.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const h=r.current.getElementsByTagName("script");for(let g=0;g<h.length;g++){const d=h[g];if(d.src){if(m.includes(d.src))continue;m.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(l.includes(d.innerText))continue;try{l.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:r,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function G(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]),[h,x]=o.useState(()=>!1);function g(){if(!r.current||!r.current.getElementsByTagName)return;const d=r.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const k=d[f];if(k.src&&!m.includes(k.src)){m.push(k.src);const y=document.createElement("script");y.async=!0,y.src=k.src,document.head.appendChild(y)}else if(a.isJsScript(k)&&!l.includes(k.innerText))try{l.push(k.innerText),new Function(k.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return o.useEffect(()=>{r.current&&!h&&(x(!0),g())},[r.current,h]),t.jsx("div",{className:"builder-embed",ref:r,dangerouslySetInnerHTML:{__html:e.content}})}function Q(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 X(e){var S,l,b,h,x,g,d;function r(){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 m(){return{...r()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...m(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(d=(g=e.builderBlock)==null?void 0:g.children)!=null&&d.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const Y=o.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function Z(e){var R,P,T,B,N,L,F;const r=o.useRef(null);function m(i){var c,s;const n={...e.builderContextSignal.rootState,...i};e.builderContextSignal.rootSetState?(s=(c=e.builderContextSignal).rootSetState)==null||s.call(c,n):e.builderContextSignal.rootState=n}function S(i){var c,s,u,v,W;const n={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(s=e.builderContextSignal.content)==null?void 0:s.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((W=(v=e.builderContextSignal.content)==null?void 0:v.meta)==null?void 0:W.breakpoints)}};_.postPreviewContent({value:n,key:n.id}).then(()=>{q.refresh()})}const[l,b]=o.useState(()=>e.contentWrapper||"div");function h(i){return a.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:n=>{var u;const{breakpoints:c,contentId:s}=n;!s||s!==((u=e.builderContextSignal.content)==null?void 0:u.id)||c&&S({meta:{breakpoints:c}})},animation:n=>{a.triggerAnimation(n)},contentUpdate:n=>{S(n)}}})(i)}function x(){var n,c;const i=(c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.jsCode;i&&a.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,d]=o.useState(()=>({})),[f,k]=o.useState(()=>!1);function y(i){var n,c;if(e.builderContextSignal.content){const s=(n=e.builderContextSignal.content)==null?void 0:n.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:s!==u?s:void 0,...a.getInteractionPropertiesForEvent(i),unique:!f})}f||k(!0)}function A(i){return i.replace(/{{([^}]+)}}/g,(n,c)=>String(a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})))}function K({url:i,key:n}){a.fetch(i).then(c=>c.json()).then(c=>{var u,v;const s={...e.builderContextSignal.rootState,[n]:c};(v=(u=e.builderContextSignal).rootSetState)==null||v.call(u,s),g[n]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var n,c;const i=((c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([s,u])=>{if(u&&(!g[s]||a.isEditing())){const v=A(u);K({url:v,key:s})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(i){window.addEventListener("message",h),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(n=>{var s;const c=a.createRegisterComponentMessage(n);(s=window.parent)==null||s.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function I(i){const n=new URL(location.href).searchParams,c=n.get("builder.preview"),s=n.get(`builder.preview.${c}`),u=n.get("apiKey")||n.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||s===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(v=>{v&&S(v)})}const q=z.useRouter();return o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initeditingbldr",w),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initeditingbldr",w)}},[]),o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initpreviewingbldr",I),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initpreviewingbldr",I)}},[]),o.useEffect(()=>{var i,n;if(a.isBrowser()){if(a.isEditing()&&r.current&&r.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const s=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(n=e.builderContextSignal.content)==null?void 0:n.id,v=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:v,variationId:s!==u?s:void 0})}a.isPreviewing()}},[]),o.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."),x(),j(),C()},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{x()},[(P=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:P.jsCode]),o.useEffect(()=>{j()},[(B=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:B.httpRequests]),o.useEffect(()=>{C()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&m(e.data)},[e.data]),o.useEffect(()=>{e.locale&&m({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(Y.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(l,{ref:r,onClick:i=>y(i),"builder-content-id":(N=e.builderContextSignal.content)==null?void 0:N.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((L=e.content)==null?void 0:L.testVariationId)||((F=e.content)==null?void 0:F.id)}`,children:e.children}):null})}exports.BlockWrapper=D;exports.BlocksWrapper=H;exports.Button=M;exports.CustomCode=J;exports.DynamicRenderer=E;exports.Embed=G;exports.EnableEditor=Z;exports.FragmentComponent=U;exports.Image=$;exports.ImgComponent=Q;exports.InteractiveElement=V;exports.SectionComponent=O;exports.Video=X;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-c186261f.cjs"),o=require("react"),_=require("./USE_SERVER_BUNDLE-812e699d.cjs"),z=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(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function M(e){return t.jsx(E,{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"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function D(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 V(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 H(e){function r(){var l;return"builder-blocks"+((l=e.blocks)!=null&&l.length?"":" no-blocks")}function m(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:r()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:l=>m(),onMouseEnter:l=>S(),onKeyPress:l=>m(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: stretch;
|
|
5
|
-
}`})]})}function U(e){return t.jsx("span",{children:e.children})}function $(e){var l,b,h,x;function r(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),a.getSrcSet(d)}else if(e.image&&!e.srcset)return a.getSrcSet(d);return a.getSrcSet(d)}function m(){var g;return(g=r==null?void 0:r())!=null&&g.match(/builder\.io/)&&!e.noWebp?r().replace(/\?/g,"?format=webp&"):""}function S(){const g={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?g:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[m()?t.jsx("source",{type:"image/webp",srcSet:m()}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-a0c95e8c",src:e.image,srcSet:r(),sizes:e.sizes})]}),e.aspectRatio&&!((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-a0c95e8c",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx("div",{className:"div-a0c95e8c-2",children:e.children}):null]}),t.jsx("style",{children:`.img-a0c95e8c {
|
|
6
|
-
opacity: 1;
|
|
7
|
-
transition: opacity 0.2s ease-in-out;
|
|
8
|
-
}.div-a0c95e8c {
|
|
9
|
-
width: 100%;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
font-size: 0;
|
|
12
|
-
}.div-a0c95e8c-2 {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: stretch;
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 0;
|
|
18
|
-
left: 0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
}`})]})}function O(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function J(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]);return o.useEffect(()=>{var x;if(!((x=r.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const h=r.current.getElementsByTagName("script");for(let g=0;g<h.length;g++){const d=h[g];if(d.src){if(m.includes(d.src))continue;m.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(l.includes(d.innerText))continue;try{l.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:r,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function G(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]),[h,x]=o.useState(()=>!1);function g(){if(!r.current||!r.current.getElementsByTagName)return;const d=r.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const k=d[f];if(k.src&&!m.includes(k.src)){m.push(k.src);const y=document.createElement("script");y.async=!0,y.src=k.src,document.head.appendChild(y)}else if(a.isJsScript(k)&&!l.includes(k.innerText))try{l.push(k.innerText),new Function(k.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return o.useEffect(()=>{r.current&&!h&&(x(!0),g())},[r.current,h]),t.jsx("div",{className:"builder-embed",ref:r,dangerouslySetInnerHTML:{__html:e.content}})}function Q(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 X(e){var S,l,b,h,x,g,d;function r(){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 m(){return{...r()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...m(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(d=(g=e.builderBlock)==null?void 0:g.children)!=null&&d.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const Y=o.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function Z(e){var R,P,T,B,N,L,F;const r=o.useRef(null);function m(i){var c,s;const n={...e.builderContextSignal.rootState,...i};e.builderContextSignal.rootSetState?(s=(c=e.builderContextSignal).rootSetState)==null||s.call(c,n):e.builderContextSignal.rootState=n}function S(i){var c,s,u,v,W;const n={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(s=e.builderContextSignal.content)==null?void 0:s.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((W=(v=e.builderContextSignal.content)==null?void 0:v.meta)==null?void 0:W.breakpoints)}};_.postPreviewContent({value:n,key:n.id}).then(()=>{q.refresh()})}const[l,b]=o.useState(()=>e.contentWrapper||"div");function h(i){return a.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:n=>{var u;const{breakpoints:c,contentId:s}=n;!s||s!==((u=e.builderContextSignal.content)==null?void 0:u.id)||c&&S({meta:{breakpoints:c}})},animation:n=>{a.triggerAnimation(n)},contentUpdate:n=>{S(n)}}})(i)}function x(){var n,c;const i=(c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.jsCode;i&&a.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,d]=o.useState(()=>({})),[f,k]=o.useState(()=>!1);function y(i){var n,c;if(e.builderContextSignal.content){const s=(n=e.builderContextSignal.content)==null?void 0:n.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:s!==u?s:void 0,...a.getInteractionPropertiesForEvent(i),unique:!f})}f||k(!0)}function A(i){return i.replace(/{{([^}]+)}}/g,(n,c)=>String(a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})))}function K({url:i,key:n}){a.fetch(i).then(c=>c.json()).then(c=>{var u,v;const s={...e.builderContextSignal.rootState,[n]:c};(v=(u=e.builderContextSignal).rootSetState)==null||v.call(u,s),g[n]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var n,c;const i=((c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([s,u])=>{if(u&&(!g[s]||a.isEditing())){const v=A(u);K({url:v,key:s})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(i){window.addEventListener("message",h),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(n=>{var s;const c=a.createRegisterComponentMessage(n);(s=window.parent)==null||s.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function I(i){const n=new URL(location.href).searchParams,c=n.get("builder.preview"),s=n.get(`builder.preview.${c}`),u=n.get("apiKey")||n.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||s===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(v=>{v&&S(v)})}const q=z.useRouter();return o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initeditingbldr",w),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initeditingbldr",w)}},[]),o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initpreviewingbldr",I),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initpreviewingbldr",I)}},[]),o.useEffect(()=>{var i,n;if(a.isBrowser()){if(a.isEditing()&&r.current&&r.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const s=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(n=e.builderContextSignal.content)==null?void 0:n.id,v=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:v,variationId:s!==u?s:void 0})}a.isPreviewing()}},[]),o.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."),x(),j(),C()},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{x()},[(P=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:P.jsCode]),o.useEffect(()=>{j()},[(B=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:B.httpRequests]),o.useEffect(()=>{C()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&m(e.data)},[e.data]),o.useEffect(()=>{e.locale&&m({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(Y.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(l,{ref:r,onClick:i=>y(i),"builder-content-id":(N=e.builderContextSignal.content)==null?void 0:N.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((L=e.content)==null?void 0:L.testVariationId)||((F=e.content)==null?void 0:F.id)}`,children:e.children}):null})}exports.BlockWrapper=D;exports.BlocksWrapper=H;exports.Button=M;exports.CustomCode=J;exports.DynamicRenderer=E;exports.Embed=G;exports.EnableEditor=Z;exports.FragmentComponent=U;exports.Image=$;exports.ImgComponent=Q;exports.InteractiveElement=V;exports.SectionComponent=O;exports.Video=X;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-b5555d47.cjs"),o=require("react"),_=require("./USE_SERVER_BUNDLE-299ebfe7.cjs"),z=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(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function M(e){return t.jsx(E,{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"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function D(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 V(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 H(e){function r(){var l;return"builder-blocks"+((l=e.blocks)!=null&&l.length?"":" no-blocks")}function m(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var l,b;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((b=window.parent)==null||b.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:r()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:l=>m(),onMouseEnter:l=>S(),onKeyPress:l=>m(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: stretch;
|
|
5
|
-
}`})]})}function U(e){return t.jsx("span",{children:e.children})}function $(e){var l,b,h,x;function r(){var f;const d=e.image||e.src;if(!d||!(d.match(/builder\.io/)||d.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),a.getSrcSet(d)}else if(e.image&&!e.srcset)return a.getSrcSet(d);return a.getSrcSet(d)}function m(){var g;return(g=r==null?void 0:r())!=null&&g.match(/builder\.io/)&&!e.noWebp?r().replace(/\?/g,"?format=webp&"):""}function S(){const g={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?g:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[m()?t.jsx("source",{type:"image/webp",srcSet:m()}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-a0c95e8c",src:e.image,srcSet:r(),sizes:e.sizes})]}),e.aspectRatio&&!((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-a0c95e8c",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx("div",{className:"div-a0c95e8c-2",children:e.children}):null]}),t.jsx("style",{children:`.img-a0c95e8c {
|
|
6
|
-
opacity: 1;
|
|
7
|
-
transition: opacity 0.2s ease-in-out;
|
|
8
|
-
}.div-a0c95e8c {
|
|
9
|
-
width: 100%;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
font-size: 0;
|
|
12
|
-
}.div-a0c95e8c-2 {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: stretch;
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 0;
|
|
18
|
-
left: 0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
}`})]})}function O(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function J(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]);return o.useEffect(()=>{var x;if(!((x=r.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const h=r.current.getElementsByTagName("script");for(let g=0;g<h.length;g++){const d=h[g];if(d.src){if(m.includes(d.src))continue;m.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(l.includes(d.innerText))continue;try{l.push(d.innerText),new Function(d.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),t.jsx("div",{ref:r,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function G(e){const r=o.useRef(null),[m,S]=o.useState(()=>[]),[l,b]=o.useState(()=>[]),[h,x]=o.useState(()=>!1);function g(){if(!r.current||!r.current.getElementsByTagName)return;const d=r.current.getElementsByTagName("script");for(let f=0;f<d.length;f++){const k=d[f];if(k.src&&!m.includes(k.src)){m.push(k.src);const y=document.createElement("script");y.async=!0,y.src=k.src,document.head.appendChild(y)}else if(a.isJsScript(k)&&!l.includes(k.innerText))try{l.push(k.innerText),new Function(k.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return o.useEffect(()=>{r.current&&!h&&(x(!0),g())},[r.current,h]),t.jsx("div",{className:"builder-embed",ref:r,dangerouslySetInnerHTML:{__html:e.content}})}function Q(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 X(e){var S,l,b,h,x,g,d;function r(){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 m(){return{...r()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...m(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((b=(l=e.builderBlock)==null?void 0:l.children)!=null&&b.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(h=e.builderBlock)==null?void 0:h.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(d=(g=e.builderBlock)==null?void 0:g.children)!=null&&d.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const Y=o.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function Z(e){var R,P,T,B,N,L,F;const r=o.useRef(null);function m(i){var c,s;const n={...e.builderContextSignal.rootState,...i};e.builderContextSignal.rootSetState?(s=(c=e.builderContextSignal).rootSetState)==null||s.call(c,n):e.builderContextSignal.rootState=n}function S(i){var c,s,u,v,W;const n={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(s=e.builderContextSignal.content)==null?void 0:s.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((W=(v=e.builderContextSignal.content)==null?void 0:v.meta)==null?void 0:W.breakpoints)}};_.postPreviewContent({value:n,key:n.id}).then(()=>{q.refresh()})}const[l,b]=o.useState(()=>e.contentWrapper||"div");function h(i){return a.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:n=>{var u;const{breakpoints:c,contentId:s}=n;!s||s!==((u=e.builderContextSignal.content)==null?void 0:u.id)||c&&S({meta:{breakpoints:c}})},animation:n=>{a.triggerAnimation(n)},contentUpdate:n=>{S(n)}}})(i)}function x(){var n,c;const i=(c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.jsCode;i&&a.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,d]=o.useState(()=>({})),[f,k]=o.useState(()=>!1);function y(i){var n,c;if(e.builderContextSignal.content){const s=(n=e.builderContextSignal.content)==null?void 0:n.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:s!==u?s:void 0,...a.getInteractionPropertiesForEvent(i),unique:!f})}f||k(!0)}function A(i){return i.replace(/{{([^}]+)}}/g,(n,c)=>String(a.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})))}function K({url:i,key:n}){a.fetch(i).then(c=>c.json()).then(c=>{var u,v;const s={...e.builderContextSignal.rootState,[n]:c};(v=(u=e.builderContextSignal).rootSetState)==null||v.call(u,s),g[n]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var n,c;const i=((c=(n=e.builderContextSignal.content)==null?void 0:n.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([s,u])=>{if(u&&(!g[s]||a.isEditing())){const v=A(u);K({url:v,key:s})}})}function C(){a.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:a.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function w(i){window.addEventListener("message",h),a.registerInsertMenu(),a.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(n=>{var s;const c=a.createRegisterComponentMessage(n);(s=window.parent)==null||s.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)}function I(i){const n=new URL(location.href).searchParams,c=n.get("builder.preview"),s=n.get(`builder.preview.${c}`),u=n.get("apiKey")||n.get("builder.space");c===e.model&&u===e.apiKey&&(!e.content||s===e.content.id)&&a.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(v=>{v&&S(v)})}const q=z.useRouter();return o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initeditingbldr",w),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initeditingbldr",w)}},[]),o.useEffect(()=>{var i;return(i=r.current)==null||i.addEventListener("initpreviewingbldr",I),()=>{var n;return(n=r.current)==null?void 0:n.removeEventListener("initpreviewingbldr",I)}},[]),o.useEffect(()=>{var i,n;if(a.isBrowser()){if(a.isEditing()&&r.current&&r.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&a.getDefaultCanTrack(e.canTrack)){const s=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,u=(n=e.builderContextSignal.content)==null?void 0:n.id,v=e.apiKey;a._track({type:"impression",canTrack:!0,contentId:u,apiKey:v,variationId:s!==u?s:void 0})}a.isPreviewing()}},[]),o.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."),x(),j(),C()},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{x()},[(P=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:P.jsCode]),o.useEffect(()=>{j()},[(B=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:B.httpRequests]),o.useEffect(()=>{C()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&m(e.data)},[e.data]),o.useEffect(()=>{e.locale&&m({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{a.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(Y.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(l,{ref:r,onClick:i=>y(i),"builder-content-id":(N=e.builderContextSignal.content)==null?void 0:N.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((L=e.content)==null?void 0:L.testVariationId)||((F=e.content)==null?void 0:F.id)}`,children:e.children}):null})}exports.BlockWrapper=D;exports.BlocksWrapper=H;exports.Button=M;exports.CustomCode=J;exports.DynamicRenderer=E;exports.Embed=G;exports.EnableEditor=Z;exports.FragmentComponent=U;exports.Image=$;exports.ImgComponent=Q;exports.InteractiveElement=V;exports.SectionComponent=O;exports.Video=X;
|