@builder.io/sdk-react 3.0.1 → 3.0.3-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/blocks-exports.cjs +169 -32
- package/lib/browser/blocks-exports.mjs +1331 -922
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +17 -16
- package/lib/browser/server-entry-c7bda8b5.cjs +2 -0
- package/lib/browser/server-entry-da1754bd.js +790 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/accordion-388f5e60.cjs +1 -0
- package/lib/edge/{accordion-1572cb0d.js → accordion-50de133c.js} +17 -16
- package/lib/edge/blocks-5e476ddc.js +3534 -0
- package/lib/edge/blocks-a5193d52.cjs +30 -0
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +13 -12
- package/lib/edge/{button-0709893d.js → button-4261ae64.js} +2 -2
- package/lib/edge/{button-cf66cf8d.cjs → button-c6ec3aea.cjs} +1 -1
- package/lib/edge/{columns-e234acc6.js → columns-28e9fb0a.js} +14 -15
- package/lib/edge/columns-8c831c02.cjs +28 -0
- package/lib/edge/{content-variants-3ab9230f.js → content-variants-36ca4fe5.js} +297 -252
- package/lib/edge/content-variants-81713434.cjs +134 -0
- package/lib/edge/{custom-code-6d9730ff.cjs → custom-code-8119ea3f.cjs} +1 -1
- package/lib/edge/dynamic-blocks-exports.cjs +3 -1
- package/lib/edge/dynamic-blocks-exports.mjs +5 -2
- package/lib/edge/{form-27bcc23a.js → form-039fb5ff.js} +7 -8
- package/lib/edge/form-e7a1dec9.cjs +1 -0
- package/lib/edge/{get-class-prop-name-a3bd113c.js → get-class-prop-name-65d6824c.js} +1 -1
- package/lib/edge/{get-class-prop-name-0b3d48a4.cjs → get-class-prop-name-a86a3e60.cjs} +1 -1
- package/lib/edge/{image-5c9e156f.js → image-2a2b26d2.js} +6 -6
- package/lib/edge/{image-94922c87.cjs → image-4db81d72.cjs} +3 -3
- package/lib/edge/{img-80be6914.js → img-61d29fb3.js} +1 -1
- package/lib/edge/{img-e0c8f7f9.cjs → img-7de3a3de.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +18 -17
- package/lib/edge/{input-f5ba6b1e.cjs → input-bd5387a6.cjs} +1 -1
- package/lib/edge/{input-920922d5.js → input-c8539054.js} +1 -1
- package/lib/edge/personalization-container-3fda6014.cjs +138 -0
- package/lib/edge/personalization-container-c76e4fef.js +379 -0
- package/lib/edge/{select-673864b7.js → select-6b5cda00.js} +1 -1
- package/lib/edge/{select-2ced1aca.cjs → select-73accaf4.cjs} +1 -1
- package/lib/edge/server-entry-838c1f06.js +788 -0
- package/lib/edge/server-entry-ea2a8b0e.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/slot-099112f1.cjs +1 -0
- package/lib/edge/{slot-68f2b177.js → slot-403c77da.js} +5 -6
- package/lib/edge/{symbol-7e260a70.js → symbol-97f456f4.js} +2 -2
- package/lib/edge/{symbol-ded9dba9.cjs → symbol-ffa6e6cd.cjs} +1 -1
- package/lib/edge/{tabs-5156494d.js → tabs-a7c94ead.js} +15 -16
- package/lib/edge/tabs-ad55c6a7.cjs +1 -0
- package/lib/edge/text-5915f038.js +17 -0
- package/lib/edge/text-e6dbb721.cjs +1 -0
- package/lib/node/blocks-exports.cjs +169 -32
- package/lib/node/blocks-exports.mjs +1359 -950
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +17 -16
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-51bc0b1d.js +791 -0
- package/lib/node/server-entry-d7316893.cjs +2 -0
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-8b303d4e.js → setIvm-575cf1f1.js} +1 -1
- package/lib/node/{setIvm-aba1bed8.cjs → setIvm-d912cf4d.cjs} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-491a9b55.cjs → should-force-browser-runtime-in-node-23225980.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-0a037bde.js → should-force-browser-runtime-in-node-66df4856.js} +1 -1
- package/package.json +1 -1
- package/types/blocks/index.d.ts +4 -0
- package/types/blocks/personalization-container/component-info.d.ts +2 -0
- package/types/blocks/personalization-container/helpers/index.d.ts +15 -0
- package/types/blocks/personalization-container/helpers/inlined-fns.d.ts +8 -0
- package/types/blocks/personalization-container/helpers.d.ts +27 -0
- package/types/blocks/personalization-container/index.d.ts +1 -0
- package/types/blocks/personalization-container/personalization-container.d.ts +4 -0
- package/types/blocks/personalization-container/personalization-container.types.d.ts +14 -0
- package/types/blocks/textarea/component-info.d.ts +2 -0
- package/types/blocks/textarea/index.d.ts +1 -0
- package/types/blocks/textarea/textarea.d.ts +14 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/filter-with-custom-targeting.d.ts +15 -0
- package/types/functions/get-block-component-options.d.ts +2 -1
- package/types/functions/get-processed-block.d.ts +1 -6
- package/types/helpers/flatten.d.ts +6 -0
- package/types/helpers/user-attributes.d.ts +17 -0
- package/types/index-helpers/blocks-exports.d.ts +1 -0
- package/types/server-index.d.ts +1 -1
- package/types/types/builder-content.d.ts +1 -0
- package/types/types/input.d.ts +11 -0
- package/lib/browser/server-entry-017b8439.js +0 -717
- package/lib/browser/server-entry-9f80066e.cjs +0 -2
- package/lib/edge/accordion-decb24cf.cjs +0 -1
- package/lib/edge/blocks-9c35be74.js +0 -916
- package/lib/edge/blocks-d3823063.cjs +0 -12
- package/lib/edge/columns-2fdf0656.cjs +0 -28
- package/lib/edge/content-variants-616a6c0f.cjs +0 -134
- package/lib/edge/evaluate-ccf1ad96.cjs +0 -19
- package/lib/edge/evaluate-f0b82ede.js +0 -2612
- package/lib/edge/form-7c61693d.cjs +0 -1
- package/lib/edge/server-entry-6c0047ea.js +0 -715
- package/lib/edge/server-entry-de142ee8.cjs +0 -2
- package/lib/edge/slot-cc8b4e5b.cjs +0 -1
- package/lib/edge/tabs-d422921f.cjs +0 -1
- package/lib/edge/text-27a917c0.js +0 -37
- package/lib/edge/text-5796f488.cjs +0 -1
- package/lib/node/server-entry-e91e06a3.cjs +0 -2
- package/lib/node/server-entry-fdedc1aa.js +0 -718
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const y="react",he=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},M=e=>e instanceof URLSearchParams?he(e):e,D=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function c(){return typeof window!="undefined"&&typeof document!="undefined"}function pe(){return c()&&window.self!==window.top}function N(e){return pe()&&D(e||window.location.search).indexOf("builder.frameEditing=")!==-1}function me(e){const t=e||(c()?window.location.search:void 0);return t?D(t).indexOf("builder.preview=")!==-1:!1}const ye=e=>({type:"builder.registerComponent",data:O(e)}),Se=e=>{const t=e.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(t);return`return (${!t.startsWith("function")&&!t.startsWith("async")&&!t.startsWith("(")&&!n?"function ":""}${t}).apply(this, arguments)`};function O(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?Se(n):n))}const R={};function K(e,t){e==="plugin"&&(t=O(t));let n=R[e];if(n||(n=R[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const U={};function we(e){if(c()){Object.assign(U,e);const t={type:"builder.settingsChange",data:U};parent.postMessage(t,"*")}}const L="builder.",be="options.",C=e=>{if(!e)return{};const t=M(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(L)){const o=r.replace(L,"").replace(be,"");n[o]=t[r]}}),n},ve=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return C(e)},I="[Builder.io]: ",l={log:(...e)=>console.log(I,...e),error:(...e)=>console.error(I,...e),warn:(...e)=>console.warn(I,...e),debug:(...e)=>console.debug(I,...e)},j="3.0.1",W=()=>({"X-Builder-SDK":y,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":j}),p=e=>e!=null,Ie=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},_=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){l.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},$=async e=>_(e),Ee=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),ke=[["secure",""],["SameSite","None"]],Pe=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?ke:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",Ie(window.location.hostname)],...o];return Ee(i)},G=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Pe({name:e,value:t,expires:n});document.cookie=o}catch(o){l.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function Oe(){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 z(){return Oe().replace(/-/g,"")}const H="builderSessionId",Ce=async({canTrack:e})=>{if(!e)return;const t=await $({name:H,canTrack:e});if(p(t))return t;{const n=Ae();return Te({id:n,canTrack:e}),n}},Ae=()=>z(),Te=({id:e,canTrack:t})=>G({name:H,value:e,canTrack:t}),X=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,xe=({key:e,canTrack:t})=>{var n;try{return t?(n=X())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Be=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=X())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},J="builderVisitorId",Re=({canTrack:e})=>{if(!e)return;const t=xe({key:J,canTrack:e});if(p(t))return t;{const n=Ue();return Le({id:n,canTrack:e}),n}},Ue=()=>z(),Le=({id:e,canTrack:t})=>Be({key:J,value:e,canTrack:t});function q(e){var t;typeof process!="undefined"&&((t=process.env)!=null&&t.DEBUG)&&String(process.env.DEBUG)=="true"&&l.log(e)}const Ve=()=>{if(c()){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},Fe=()=>typeof navigator=="object"&&navigator.userAgent||"",Q=()=>{const e=Fe(),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()||y==="reactNative"}},n=e.match(/Tablet|iPad/i),r=Ve();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},Me=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ce({canTrack:e}),n=Re({canTrack:e});return{sessionId:t,visitorId:n}},De=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Me({canTrack:t}),userAttributes:Q(),ownerId:n}});async function Y({apiHost:e,...t}){if(!t.apiKey){l.error("Missing API key for track call. Please provide your API key.");return}if(!t.canTrack||N()||!(c()||y==="reactNative"))return;const r=`${e||"https://cdn.builder.io"}/api/v1/track`;return q(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await De(t)]}),headers:{"content-type":"application/json",...W()},mode:"cors"}).catch(o=>{console.error("Failed to track: ",o)})}const Ne=e=>Y({...e,canTrack:!0}),Ke=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Z(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Ke).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const je=()=>{K("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let V=!1;const ee=(e={})=>{var t,n;V||(V=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:y,version:j,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,i;if(!Z(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,S=o.data.arguments||[],m=o.data.id,E=new Function(u);let d,g=null;try{d=E.apply(null,S)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):d&&typeof d.then=="function"?d.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:m}},"*");break}}})))},te=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!Z(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,i=s.key||s.alias||s.entry||s.modelName,u=s.data;i===e&&n.contentUpdate(u);break}}},We=(e,t,n)=>{if(!c)return l.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};ee();const r=te({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},_e="builder.tests",A=e=>`${_e}.${e}`,$e=({contentId:e})=>$({name:A(e),canTrack:!0}),Ge=({contentId:e})=>_({name:A(e),canTrack:!0}),ze=({contentId:e,value:t})=>G({name:A(e),value:t,canTrack:!0}),ne=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,He=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const i=(o=t[s])==null?void 0:o.testRatio;if(n+=i,r<n)return s}return e},re=e=>{const t=He(e);return ze({contentId:e.id,value:t}).catch(n=>{l.error("could not store A/B test variation: ",n)}),t},oe=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},Xe=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!ne(e))return e;const n=Ge({contentId:e.id})||re({variations:e.variations,id:e.id}),r=oe({item:e,testGroupId:n});return{...e,...r}},Je=async({item:e,canTrack:t})=>{if(!t||!ne(e))return e;const r=await $e({contentId:e.id})||re({variations:e.variations,id:e.id}),o=oe({item:e,testGroupId:r});return{...e,...o}},se=e=>p(e)?e:!0;function qe(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Qe(){const e=qe().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Ye=Qe();function P(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],i=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...P(s,i,n)}:{...r,[i]:s}},{})}function ie(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(i=>i.startsWith("$"))?ie(o,s,n):n[s]=o}return n}const Ze="v3",F=e=>typeof e=="number"&&!isNaN(e)&&e>=0,T=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:S=Ze,fields:m,omit:E,offset:d,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:x,apiHost:de}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const le=t!==1,fe=de||"https://cdn.builder.io",a=new URL(`${fe}/api/${S}/content/${o}`);a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(le)),a.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let v=n;if(k&&(a.searchParams.set("locale",k),v={locale:k,...v}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",E||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(d)&&d>-1&&a.searchParams.set("offset",String(Math.floor(d))),typeof x=="boolean"&&a.searchParams.set("includeUnpublished",String(x)),g&&F(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&F(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=P({sort:w});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}const ge={...ve(),...M(e.options||{})},B=P(ge);for(const f in B)a.searchParams.set(f,String(B[f]));if(v&&a.searchParams.set("userAttributes",JSON.stringify(v)),r){const f=ie({query:r});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}return a},et=e=>"results"in e;async function ae(e){const t=await ue({...e,limit:1});return t&&t[0]||null}const tt=async e=>{var i,u;const t=T(e),n=(i=e.fetch)!=null?i:Ye,r={...e.fetchOptions,headers:{...(u=e.fetchOptions)==null?void 0:u.headers,...W()}};return await(await n(t.href,r)).json()},ce=async(e,t,n=T(e))=>{const r=se(e.canTrack);if(n.search.includes("preview="),!r||!(c()||y==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await Je({item:s,canTrack:r}));t.results=o}catch(o){l.error("Could not process A/B tests. ",o)}return t.results};async function ue(e){const t=T(e),n=await tt(e);if(!et(n))throw l.error("Error fetching data. ",{url:t,content:n,options:e}),n;return ce(e,n)}const nt=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:C(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await ae(n)}};exports.TARGET=y;exports._processContentResult=ce;exports._track=Y;exports.checkIsDefined=p;exports.createEditorListener=te;exports.createRegisterComponentMessage=ye;exports.fetchBuilderProps=nt;exports.fetchEntries=ue;exports.fetchOneEntry=ae;exports.getBuilderSearchParams=C;exports.getDefaultCanTrack=se;exports.getUserAttributes=Q;exports.handleABTestingSync=Xe;exports.isBrowser=c;exports.isEditing=N;exports.isPreviewing=me;exports.logFetch=q;exports.logger=l;exports.register=K;exports.registerInsertMenu=je;exports.serializeIncludingFunctions=O;exports.setEditorSettings=we;exports.setupBrowserForEditing=ee;exports.subscribeToEditor=We;exports.track=Ne;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("./blocks-d3823063.cjs");require("react");require("./blocks-exports.cjs");require("./server-entry-de142ee8.cjs");require("./evaluate-ccf1ad96.cjs");require("./get-class-prop-name-0b3d48a4.cjs");require("./dynamic-renderer-b29b45ca.cjs");function u(e){var t,r,n;return i.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:i.jsx(o.Blocks,{parent:(r=e.builderContext.context)==null?void 0:r.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,registeredComponents:e.builderComponents,blocks:(n=e.builderContext.rootState)==null?void 0:n[e.name]})})}exports.default=u;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),b=require("react"),o=require("./blocks-d3823063.cjs");require("./blocks-exports.cjs");require("./server-entry-de142ee8.cjs");require("./evaluate-ccf1ad96.cjs");require("./get-class-prop-name-0b3d48a4.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var r;const[t,a]=b.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function u(n){n===t&&e.collapsible?a(-1):a(n)}return l.jsxs("div",{children:[l.jsx("div",{className:"builder-tabs-wrap",style:{display:"flex",flexDirection:"row",justifyContent:e.tabHeaderLayout||"flex-start",overflow:"auto"},children:(r=e.tabs)==null?void 0:r.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>u(i),children:l.jsx(o.Blocks,{parent:e.builderBlock.id,path:`tabs.${i}.label`,blocks:n.label,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})},i))}),c(t)?l.jsx("div",{children:l.jsx(o.Blocks,{parent:e.builderBlock.id,path:`tabs.${t}.content`,blocks:c(t),context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]})}exports.default=s;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { evaluate as u } from "./evaluate-f0b82ede.js";
|
|
3
|
-
import "./server-entry-6c0047ea.js";
|
|
4
|
-
function f(t) {
|
|
5
|
-
function o() {
|
|
6
|
-
var e;
|
|
7
|
-
const n = t.builderContext, {
|
|
8
|
-
context: r,
|
|
9
|
-
localState: c,
|
|
10
|
-
rootState: a,
|
|
11
|
-
rootSetState: l
|
|
12
|
-
} = n;
|
|
13
|
-
return String(((e = t.text) == null ? void 0 : e.toString()) || "").replace(
|
|
14
|
-
/{{([^}]+)}}/g,
|
|
15
|
-
(s, x) => u({
|
|
16
|
-
code: x,
|
|
17
|
-
context: r,
|
|
18
|
-
localState: c,
|
|
19
|
-
rootState: a,
|
|
20
|
-
rootSetState: l
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return /* @__PURE__ */ i(
|
|
25
|
-
"div",
|
|
26
|
-
{
|
|
27
|
-
className: "builder-text",
|
|
28
|
-
dangerouslySetInnerHTML: { __html: o() },
|
|
29
|
-
style: {
|
|
30
|
-
outline: "none"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
f as default
|
|
37
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),s=require("./evaluate-ccf1ad96.cjs");require("./server-entry-de142ee8.cjs");function x(t){function n(){var e;const o=t.builderContext,{context:r,localState:c,rootState:u,rootSetState:a}=o;return String(((e=t.text)==null?void 0:e.toString())||"").replace(/{{([^}]+)}}/g,(d,l)=>s.evaluate({code:l,context:r,localState:c,rootState:u,rootSetState:a}))}return i.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:n()},style:{outline:"none"}})}exports.default=x;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const y="react",v="[Builder.io]: ",l={log:(...e)=>console.log(v,...e),error:(...e)=>console.error(v,...e),warn:(...e)=>console.warn(v,...e),debug:(...e)=>console.debug(v,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const he=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},M=e=>e instanceof URLSearchParams?he(e):e,D=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function pe(){return c()&&window.self!==window.top}function N(e){return pe()&&D(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const me=()=>{if(c()){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},ye=()=>typeof navigator=="object"&&navigator.userAgent||"",K=()=>{const e=ye(),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()||y==="reactNative"}},n=e.match(/Tablet|iPad/i),r=me();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null;function Se(e){const t=e||(c()?window.location.search:void 0);return t?D(t).indexOf("builder.preview=")!==-1:!1}const we=e=>({type:"builder.registerComponent",data:O(e)}),be=e=>{const t=e.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(t);return`return (${!t.startsWith("function")&&!t.startsWith("async")&&!t.startsWith("(")&&!n?"function ":""}${t}).apply(this, arguments)`};function O(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?be(n):n))}const R={};function j(e,t){e==="plugin"&&(t=O(t));let n=R[e];if(n||(n=R[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const U={};function ve(e){if(c()){Object.assign(U,e);const t={type:"builder.settingsChange",data:U};parent.postMessage(t,"*")}}const L="builder.",Ie="options.",C=e=>{if(!e)return{};const t=M(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(L)){const o=r.replace(L,"").replace(Ie,"");n[o]=t[r]}}),n},Ee=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return C(e)},W="3.0.1",_=()=>({"X-Builder-SDK":y,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":W}),ke=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},G=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){l.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},$=async e=>G(e),Pe=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),Oe=[["secure",""],["SameSite","None"]],Ce=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?Oe:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",ke(window.location.hostname)],...o];return Pe(i)},X=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Ce({name:e,value:t,expires:n});document.cookie=o}catch(o){l.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function Ae(){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 z(){return Ae().replace(/-/g,"")}const H="builderSessionId",Te=async({canTrack:e})=>{if(!e)return;const t=await $({name:H,canTrack:e});if(p(t))return t;{const n=xe();return Be({id:n,canTrack:e}),n}},xe=()=>z(),Be=({id:e,canTrack:t})=>X({name:H,value:e,canTrack:t}),J=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Re=({key:e,canTrack:t})=>{var n;try{return t?(n=J())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Ue=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=J())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},q="builderVisitorId",Le=({canTrack:e})=>{if(!e)return;const t=Re({key:q,canTrack:e});if(p(t))return t;{const n=Ve();return Fe({id:n,canTrack:e}),n}},Ve=()=>z(),Fe=({id:e,canTrack:t})=>Ue({key:q,value:e,canTrack:t});function Q(e){var t;typeof process!="undefined"&&((t=process.env)!=null&&t.DEBUG)&&String(process.env.DEBUG)=="true"&&l.log(e)}const Me=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Te({canTrack:e}),n=Le({canTrack:e});return{sessionId:t,visitorId:n}},De=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Me({canTrack:t}),userAttributes:K(),ownerId:n}});async function Y({apiHost:e,...t}){if(!t.apiKey){l.error("Missing API key for track call. Please provide your API key.");return}if(!t.canTrack||N()||!(c()||y==="reactNative"))return;const r=`${e||"https://cdn.builder.io"}/api/v1/track`;return Q(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await De(t)]}),headers:{"content-type":"application/json",..._()},mode:"cors"}).catch(o=>{console.error("Failed to track: ",o)})}const Ne=e=>Y({...e,canTrack:!0}),Ke=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Z(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Ke).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const je=()=>{j("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let V=!1;const ee=(e={})=>{var t,n;V||(V=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:y,version:W,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,i;if(!Z(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,S=o.data.arguments||[],m=o.data.id,E=new Function(u);let d,g=null;try{d=E.apply(null,S)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):d&&typeof d.then=="function"?d.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:m}},"*");break}}})))},te=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!Z(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,i=s.key||s.alias||s.entry||s.modelName,u=s.data;i===e&&n.contentUpdate(u);break}}},We=(e,t,n)=>{if(!c)return l.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};ee();const r=te({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},_e="builder.tests",A=e=>`${_e}.${e}`,Ge=({contentId:e})=>$({name:A(e),canTrack:!0}),$e=({contentId:e})=>G({name:A(e),canTrack:!0}),Xe=({contentId:e,value:t})=>X({name:A(e),value:t,canTrack:!0}),ne=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,ze=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const i=(o=t[s])==null?void 0:o.testRatio;if(n+=i,r<n)return s}return e},re=e=>{const t=ze(e);return Xe({contentId:e.id,value:t}).catch(n=>{l.error("could not store A/B test variation: ",n)}),t},oe=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},He=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!ne(e))return e;const n=$e({contentId:e.id})||re({variations:e.variations,id:e.id}),r=oe({item:e,testGroupId:n});return{...e,...r}},Je=async({item:e,canTrack:t})=>{if(!t||!ne(e))return e;const r=await Ge({contentId:e.id})||re({variations:e.variations,id:e.id}),o=oe({item:e,testGroupId:r});return{...e,...o}},se=e=>p(e)?e:!0;function qe(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Qe(){const e=qe().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Ye=Qe();function P(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],i=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...P(s,i,n)}:{...r,[i]:s}},{})}function ie(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(i=>i.startsWith("$"))?ie(o,s,n):n[s]=o}return n}const Ze="v3",F=e=>typeof e=="number"&&!isNaN(e)&&e>=0,T=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:S=Ze,fields:m,omit:E,offset:d,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:x,apiHost:de}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const le=t!==1,fe=de||"https://cdn.builder.io",a=new URL(`${fe}/api/${S}/content/${o}`);a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(le)),a.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let I=n;if(k&&(a.searchParams.set("locale",k),I={locale:k,...I}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",E||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(d)&&d>-1&&a.searchParams.set("offset",String(Math.floor(d))),typeof x=="boolean"&&a.searchParams.set("includeUnpublished",String(x)),g&&F(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&F(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=P({sort:w});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}const ge={...Ee(),...M(e.options||{})},B=P(ge);for(const f in B)a.searchParams.set(f,String(B[f]));if(I&&a.searchParams.set("userAttributes",JSON.stringify(I)),r){const f=ie({query:r});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}return a},et=e=>"results"in e;async function ae(e){const t=await ue({...e,limit:1});return t&&t[0]||null}const tt=async e=>{var i,u;const t=T(e),n=(i=e.fetch)!=null?i:Ye,r={...e.fetchOptions,headers:{...(u=e.fetchOptions)==null?void 0:u.headers,..._()}};return await(await n(t.href,r)).json()},ce=async(e,t,n=T(e))=>{const r=se(e.canTrack);if(n.search.includes("preview="),!r||!(c()||y==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await Je({item:s,canTrack:r}));t.results=o}catch(o){l.error("Could not process A/B tests. ",o)}return t.results};async function ue(e){const t=T(e),n=await tt(e);if(!et(n))throw l.error("Error fetching data. ",{url:t,content:n,options:e}),n;return ce(e,n)}const nt=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:C(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await ae(n)}};exports.MSG_PREFIX=v;exports.TARGET=y;exports._processContentResult=ce;exports._track=Y;exports.checkIsDefined=p;exports.createEditorListener=te;exports.createRegisterComponentMessage=we;exports.fetchBuilderProps=nt;exports.fetchEntries=ue;exports.fetchOneEntry=ae;exports.getBuilderSearchParams=C;exports.getDefaultCanTrack=se;exports.getUserAttributes=K;exports.handleABTestingSync=He;exports.isBrowser=c;exports.isEditing=N;exports.isPreviewing=Se;exports.logFetch=Q;exports.logger=l;exports.register=j;exports.registerInsertMenu=je;exports.serializeIncludingFunctions=O;exports.setEditorSettings=ve;exports.setupBrowserForEditing=ee;exports.subscribeToEditor=We;exports.track=Ne;
|