@builder.io/sdk-react 4.2.1 → 4.2.3

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.
Files changed (90) hide show
  1. package/lib/browser/blocks-exports.cjs +37 -37
  2. package/lib/browser/blocks-exports.mjs +1238 -1168
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +1 -1
  5. package/lib/browser/server-entry-0817de95.cjs +2 -0
  6. package/lib/browser/{server-entry-5e98a993.js → server-entry-331e2fd4.js} +248 -246
  7. package/lib/browser/server-entry.cjs +1 -1
  8. package/lib/browser/server-entry.mjs +1 -1
  9. package/lib/edge/{accordion-4bab42b1.cjs → accordion-1559ca68.cjs} +1 -1
  10. package/lib/edge/{accordion-a8a363e4.js → accordion-3e9ee224.js} +1 -1
  11. package/lib/edge/{blocks-d07d0261.cjs → blocks-4f20c19a.cjs} +14 -14
  12. package/lib/edge/{blocks-e1f5b0d0.js → blocks-b9be7dc1.js} +749 -736
  13. package/lib/edge/blocks-exports.cjs +1 -1
  14. package/lib/edge/blocks-exports.mjs +2 -2
  15. package/lib/edge/{button-6734c0bb.cjs → button-0a632d4f.cjs} +1 -1
  16. package/lib/edge/{button-bbcadacf.js → button-ba852235.js} +2 -2
  17. package/lib/edge/{columns-821cba14.cjs → columns-66170ac9.cjs} +1 -1
  18. package/lib/edge/{columns-cf3081c6.js → columns-ee2fba7b.js} +3 -3
  19. package/lib/edge/content-variants-4f54d98a.cjs +302 -0
  20. package/lib/edge/{content-variants-a704e35c.js → content-variants-c013569a.js} +489 -444
  21. package/lib/edge/{custom-code-f6c30129.js → custom-code-38e2c9d5.js} +1 -1
  22. package/lib/edge/{custom-code-8fcaa31e.cjs → custom-code-48579935.cjs} +1 -1
  23. package/lib/edge/{embed-3c0b5564.js → embed-1ce0435c.js} +1 -1
  24. package/lib/edge/{embed-666d3cc4.cjs → embed-9a7f29ff.cjs} +1 -1
  25. package/lib/edge/form-d9b6dea6.cjs +1 -0
  26. package/lib/edge/{form-8b068721.js → form-f558f5d4.js} +24 -21
  27. package/lib/edge/{get-class-prop-name-d6d821d6.js → get-class-prop-name-35ccd32a.js} +1 -1
  28. package/lib/edge/{get-class-prop-name-2869a960.cjs → get-class-prop-name-d2be9a48.cjs} +1 -1
  29. package/lib/edge/image-cce92f6c.cjs +17 -0
  30. package/lib/edge/image-d87761af.js +123 -0
  31. package/lib/edge/img-a1e0f10e.js +33 -0
  32. package/lib/edge/img-b21eb075.cjs +1 -0
  33. package/lib/edge/index.cjs +1 -1
  34. package/lib/edge/index.mjs +1 -1
  35. package/lib/edge/{input-665ef328.js → input-5c0d3350.js} +1 -1
  36. package/lib/edge/{input-d31d6451.cjs → input-6854bc85.cjs} +1 -1
  37. package/lib/edge/{personalization-container-e784836e.js → personalization-container-adf9e0bd.js} +4 -4
  38. package/lib/edge/{personalization-container-d12566e8.cjs → personalization-container-f7fdc090.cjs} +1 -1
  39. package/lib/edge/{select-c3085265.cjs → select-6c4637ae.cjs} +1 -1
  40. package/lib/edge/{select-5fe49bd4.js → select-713e73f6.js} +1 -1
  41. package/lib/edge/server-entry-0bef3cb1.cjs +2 -0
  42. package/lib/{node/server-entry-48724189.js → edge/server-entry-71badd34.js} +307 -307
  43. package/lib/edge/server-entry.cjs +1 -1
  44. package/lib/edge/server-entry.mjs +1 -1
  45. package/lib/edge/{slot-cbbbb02e.cjs → slot-59a86f46.cjs} +1 -1
  46. package/lib/edge/{slot-a17ee2d7.js → slot-a3c27352.js} +3 -3
  47. package/lib/edge/symbol-3d81a9de.cjs +1 -0
  48. package/lib/edge/{symbol-9f960685.js → symbol-86e5a3f0.js} +26 -23
  49. package/lib/edge/tabs-0d914e5c.cjs +1 -0
  50. package/lib/edge/{tabs-26ac5b2f.js → tabs-60f8bb61.js} +24 -23
  51. package/lib/node/blocks-exports.cjs +38 -38
  52. package/lib/node/blocks-exports.mjs +1375 -1305
  53. package/lib/node/index.cjs +1 -1
  54. package/lib/node/index.mjs +3 -3
  55. package/lib/node/init.cjs +1 -1
  56. package/lib/node/init.mjs +3 -3
  57. package/lib/node/server-entry-05b0f263.cjs +2 -0
  58. package/lib/{edge/server-entry-c9d5300f.js → node/server-entry-68823bb0.js} +346 -342
  59. package/lib/node/server-entry.cjs +1 -1
  60. package/lib/node/server-entry.mjs +1 -1
  61. package/lib/node/{setIvm-a7aba6d2.js → setIvm-bb3d0e32.js} +1 -1
  62. package/lib/node/{setIvm-3b6199a0.cjs → setIvm-bec8f1ed.cjs} +1 -1
  63. package/lib/node/setIvm.cjs +1 -1
  64. package/lib/node/setIvm.mjs +2 -2
  65. package/lib/node/{should-force-browser-runtime-in-node-fdc70f22.js → should-force-browser-runtime-in-node-a4c71d14.js} +1 -1
  66. package/lib/node/{should-force-browser-runtime-in-node-cbe0ef14.cjs → should-force-browser-runtime-in-node-bbbdf124.cjs} +1 -1
  67. package/package.json +1 -1
  68. package/types/blocks/img/img.d.ts +2 -0
  69. package/types/blocks/symbol/symbol.types.d.ts +1 -2
  70. package/types/components/awaiter.d.ts +1 -11
  71. package/types/components/awaiter.types.d.ts +7 -0
  72. package/types/components/block/components/live-edit-block-styles.d.ts +8 -0
  73. package/types/components/block/components/style-wrapper.d.ts +9 -0
  74. package/types/components/live-edit.d.ts +9 -0
  75. package/types/constants/sdk-version.d.ts +1 -1
  76. package/types/helpers/find-block.d.ts +18 -0
  77. package/types/helpers/subscribe-to-editor.d.ts +3 -2
  78. package/lib/browser/server-entry-4cf669a1.cjs +0 -2
  79. package/lib/edge/content-variants-ec180883.cjs +0 -302
  80. package/lib/edge/form-51f639ab.cjs +0 -1
  81. package/lib/edge/image-209835f4.js +0 -94
  82. package/lib/edge/image-87a4e006.cjs +0 -17
  83. package/lib/edge/image.helpers-3e926d47.js +0 -33
  84. package/lib/edge/image.helpers-dba8a869.cjs +0 -1
  85. package/lib/edge/img-b04b9b6d.cjs +0 -1
  86. package/lib/edge/img-dfbd4080.js +0 -28
  87. package/lib/edge/server-entry-acf5ce7d.cjs +0 -2
  88. package/lib/edge/symbol-b56b5675.cjs +0 -1
  89. package/lib/edge/tabs-bf6643d7.cjs +0 -1
  90. package/lib/node/server-entry-562c0663.cjs +0 -2
@@ -1,2 +0,0 @@
1
- "use strict";const S="react";function a(){return typeof window!="undefined"&&typeof document!="undefined"}const A="[Builder.io]: ",d={log:(...t)=>console.log(A,...t),error:(...t)=>console.error(A,...t),warn:(...t)=>console.warn(A,...t),debug:(...t)=>console.debug(A,...t)},p=t=>t!=null,yt=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var n;try{return e?(n=document.cookie.split("; ").find(r=>r.startsWith(`${t}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},$=async t=>v(t),bt=t=>t.map(([e,n])=>n?`${e}=${n}`:e).filter(p).join("; "),mt=[["secure",""],["SameSite","None"]],wt=({name:t,value:e,expires:n})=>{const s=(a()?location.protocol==="https:":!0)?mt:[[]],o=n?[["expires",n.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",yt(window.location.hostname)],...s];return bt(i)},O=async({name:t,value:e,expires:n,canTrack:r})=>{try{if(!r)return;const s=wt({name:t,value:e,expires:n});document.cookie=s}catch(s){d.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};const V="builder.userAttributes";function D(){let t=!0;const e=new Set;return{setUserAttributes(n){if(!a())return;const r={...this.getUserAttributes(),...n};O({name:V,value:JSON.stringify(r),canTrack:t}),e.forEach(s=>s(r))},getUserAttributes(){return a()?JSON.parse(v({name:V,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(n,{fireImmediately:r}={}){return e.add(n),r&&n(this.getUserAttributes()),function(){e.delete(n)}},setCanTrack(n){t=n}}}let U;a()&&S==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=D()),U=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):U=D();const P=U,Et=t=>{P.setUserAttributes(t)},It=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},G=t=>t instanceof URLSearchParams?It(t):t,J=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function At(){return a()&&window.self!==window.top}function z(t){return At()&&J(t||window.location.search).indexOf("builder.frameEditing=")!==-1}function vt(t){const e=t||(a()?window.location.search:void 0);return e?J(e).indexOf("builder.preview=")!==-1:!1}const kt=t=>({type:"builder.registerComponent",data:R(t)}),Ut=t=>{const e=t.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!n?"function ":""}${e}).apply(this, arguments)`};function R(t){return JSON.parse(JSON.stringify(t,(e,n)=>typeof n=="function"?Ut(n):n))}const F={};function Tt(t,e){t==="plugin"&&(e=R(e));let n=F[t];if(n||(n=F[t]=[]),n.push(e),a()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(s){console.debug("Could not postmessage",s)}}}function Ot(t){var e;if(a()){const n=JSON.parse(JSON.stringify(t));t.action&&(n.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:n},"*")}}const M={};function Pt(t){if(a()){Object.assign(M,t);const e={type:"builder.settingsChange",data:M};parent.postMessage(e,"*")}}const K="builder.",Rt="options.",C=t=>{if(!t)return{};const e=G(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(K)){const s=r.replace(K,"").replace(Rt,"");n[s]=e[r]}}),n},Ct=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return C(t)},X="4.2.1",H=()=>({"X-Builder-SDK":S,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":X});function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Bt().replace(/-/g,"")}const Y="builderSessionId",xt=async({canTrack:t})=>{if(!t)return;const e=await $({name:Y,canTrack:t});if(p(e))return e;{const n=_t();return Lt({id:n,canTrack:t}),n}},_t=()=>Q(),Lt=({id:t,canTrack:e})=>O({name:Y,value:t,canTrack:e}),Z=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Nt=({key:t,canTrack:e})=>{var n;try{return e?(n=Z())==null?void 0:n.getItem(t):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Vt=({key:t,canTrack:e,value:n})=>{var r;try{e&&((r=Z())==null||r.setItem(t,n))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Dt=({canTrack:t})=>{if(!t)return;const e=Nt({key:q,canTrack:t});if(p(e))return e;{const n=Ft();return Mt({id:n,canTrack:t}),n}},Ft=()=>Q(),Mt=({id:t,canTrack:e})=>Vt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(t)}const Kt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Wt=()=>typeof navigator=="object"&&navigator.userAgent||"",et=()=>{const t=Wt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||S==="reactNative"}},n=t.match(/Tablet|iPad/i),r=Kt();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},jt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await xt({canTrack:t}),n=Dt({canTrack:t});return{sessionId:e,visitorId:n}},$t=async({type:t,canTrack:e,apiKey:n,metadata:r,...s})=>({type:t,data:{...s,metadata:{url:location.href,...r},...await jt({canTrack:e}),userAttributes:et(),ownerId:n}});async function nt({apiHost:t,...e}){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||z()||!(a()||S==="reactNative"))return;const r=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await $t(e)]}),headers:{"content-type":"application/json",...H()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const Gt=t=>nt({...t,canTrack:!0}),Jt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const n=new URL(e.origin),r=n.hostname;return(t||Jt).findIndex(s=>s.startsWith("*.")?r.endsWith(s.slice(1)):s===r)>-1}let W=!1;const st=t=>{var e,n;W||(W=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:S,version:X,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",r=>{var o,i;if(!rt(t.trustedHosts,r))return;const{data:s}=r;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,m=s.data.arguments||[],y=s.data.id,w=new Function(u);let l,g=null;try{l=w.apply(null,m)}catch(h){g=h}g?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var E;(E=window.parent)==null||E.postMessage({type:"builder.evaluateResult",data:{id:y,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:y}},"*");break}}})))},ot=({model:t,trustedHosts:e,callbacks:n})=>r=>{if(!rt(e,r))return;const{data:s}=r;if(s)switch(s.type){case"builder.configureSdk":{n.configureSdk(s.data);break}case"builder.triggerAnimation":{n.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state;i===t&&u&&n.stateUpdate(u);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data;i===t&&n.contentUpdate(u);break}}},zt=({model:t,apiKey:e,callback:n,trustedHosts:r})=>{if(!a)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};st({modelName:t,apiKey:e});const s=ot({callbacks:{contentUpdate:n,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:r});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Xt="builder.tests",B=t=>`${Xt}.${t}`,Ht=({contentId:t})=>$({name:B(t),canTrack:!0}),Qt=({contentId:t})=>v({name:B(t),canTrack:!0}),Yt=({contentId:t,value:e})=>O({name:B(t),value:e,canTrack:!0}),it=t=>p(t.id)&&p(t.variations)&&Object.keys(t.variations).length>0,Zt=({id:t,variations:e})=>{var s;let n=0;const r=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(n+=i,r<n)return o}return t},at=t=>{const e=Zt(t);return Yt({contentId:t.id,value:e}).catch(n=>{d.error("could not store A/B test variation: ",n)}),e},ct=({item:t,testGroupId:e})=>{const n=t.variations[e];return e===t.id||!n?{testVariationId:t.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===t.id?"Default":"")}},qt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!it(t))return t;const n=Qt({contentId:t.id})||at({variations:t.variations,id:t.id}),r=ct({item:t,testGroupId:n});return{...t,...r}},te=async({item:t,canTrack:e})=>{if(!e||!it(t))return t;const r=await Ht({contentId:t.id})||at({variations:t.variations,id:t.id}),s=ct({item:t,testGroupId:r});return{...t,...s}},ut=t=>{const e=p(t)?t:!0;return P.setCanTrack(e),e};function ee(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ne(){const t=ee().fetch;if(typeof t=="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 t}const re=ne();function T(t,e=null,n="."){return Object.keys(t).reduce((r,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(n);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...r,...T(o,i,n)}:{...r,[i]:o}},{})}function lt(t,e,n={}){for(const r in t){const s=t[r],o=e?e+"."+r:r;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?lt(s,o,n):n[o]=s}return n}function se(t){const e={};for(const n in t){const r=n.split(".");let s=e;for(let o=0;o<r.length;o++){const i=r[o];o===r.length-1?s[i]=t[n]:(s[i]=s[i]||{},s=s[i])}}return e}const oe="v3",j=t=>typeof t=="number"&&!isNaN(t)&&t>=0,x=t=>{const{limit:e=30,userAttributes:n,query:r,model:s,apiKey:o,enrich:i,locale:u,apiVersion:m=oe,fields:y,omit:w,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:E,includeUnpublished:_,apiHost:ht}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(m))throw new Error(`Invalid apiVersion: expected 'v3', received '${m}'`);const pt=e!==1,St=ht||"https://cdn.builder.io",c=new URL(`${St}/api/${m}/content/${s}`);c.searchParams.set("apiKey",o),c.searchParams.set("limit",String(e)),c.searchParams.set("noTraverse",String(pt)),c.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let b=n||{};if(k&&(c.searchParams.set("locale",k),b={locale:k,...b}),i&&c.searchParams.set("enrich",String(i)),c.searchParams.set("omit",w!=null?w:"meta.componentsUsed"),y&&c.searchParams.set("fields",y),Number.isFinite(l)&&l>-1&&c.searchParams.set("offset",String(Math.floor(l))),typeof _=="boolean"&&c.searchParams.set("includeUnpublished",String(_)),g&&j(g)&&c.searchParams.set("cacheSeconds",String(g)),h&&j(h)&&c.searchParams.set("staleCacheSeconds",String(h)),E){const f=T({sort:E});for(const I in f)c.searchParams.set(I,JSON.stringify(f[I]))}const L={...Ct(),...G(t.options||{})};b={...b,...ae(L)};const N=T(L);for(const f in N)c.searchParams.set(f,String(N[f]));if(Object.keys(b).length>0&&c.searchParams.set("userAttributes",JSON.stringify(b)),r){const f=lt({query:r});for(const I in f)c.searchParams.set(I,JSON.stringify(f[I]))}return c},ie=t=>{const e={};for(const n in t)n.startsWith("userAttributes.")&&(e[n]=t[n],delete t[n]);return e},ae=t=>{if(a()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=ie(t),{userAttributes:n}=se(e);return n}return{}},ce=t=>"results"in t;async function dt(t){const e=await gt({...t,limit:1});return e&&e[0]||null}const ue=async t=>{var i,u;const e=x(t),n=(i=t.fetch)!=null?i:re,r={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...H()}};return await(await n(e.href,r)).json()},ft=async(t,e,n=x(t))=>{const r=ut(t.canTrack);if(n.search.includes("preview="),!r||!(a()||S==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await te({item:o,canTrack:r}));e.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return e.results};async function gt(t){const e=x(t),n=await ue(t);if(!ce(n))throw d.error("Error fetching data. ",{url:e,content:n,options:t}),n;return ft(t,n)}const le=async t=>{var r,s,o;const e=t.path||((r=t.url)==null?void 0:r.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),n={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:C(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:n.apiKey,model:n.model,content:await dt(n)}};exports.TARGET=S;exports._processContentResult=ft;exports._track=nt;exports.checkIsDefined=p;exports.createEditorListener=ot;exports.createRegisterComponentMessage=kt;exports.fetchBuilderProps=le;exports.fetchEntries=gt;exports.fetchOneEntry=dt;exports.getBuilderSearchParams=C;exports.getCookieSync=v;exports.getDefaultCanTrack=ut;exports.getUserAttributes=et;exports.handleABTestingSync=qt;exports.isBrowser=a;exports.isEditing=z;exports.isPreviewing=vt;exports.logFetch=tt;exports.logger=d;exports.register=Tt;exports.registerAction=Ot;exports.serializeIncludingFunctions=R;exports.setClientUserAttributes=Et;exports.setEditorSettings=Pt;exports.setupBrowserForEditing=st;exports.subscribeToEditor=zt;exports.track=Gt;exports.userAttributesService=P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),o=require("react"),S=require("./blocks-exports.cjs"),E=require("./get-class-prop-name-2869a960.cjs"),b=require("./server-entry-acf5ce7d.cjs"),g=async({builderContextValue:e,symbol:n})=>{if(n!=null&&n.model&&(e!=null&&e.apiKey))return b.fetchOneEntry({model:n.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(n==null?void 0:n.entry)&&{query:{id:n.entry}}}).catch(c=>{b.logger.error("Could not fetch symbol content: ",c)})};function h(e){var a,l,u,d,s;function n(){return"div"}function c(){return"div"}function f(){var t,r;return[e.attributes[E.getClassPropName()],"builder-symbol",(t=e.symbol)!=null&&t.inline?"builder-inline-symbol":void 0,(r=e.symbol)!=null&&r.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")}const[i,C]=o.useState(()=>{var t;return(t=e.symbol)==null?void 0:t.content}),[v,k]=o.useState(()=>{var t;return(t=e.symbol)==null?void 0:t.entry});function x(){var t;i&&v===((t=e.symbol)==null?void 0:t.entry)||g({symbol:e.symbol,builderContextValue:e.builderContext}).then(r=>{var y;r&&(C(r),k((y=e.symbol)==null?void 0:y.entry))})}return o.useEffect(()=>{},[]),o.useEffect(()=>{x()},[e.symbol]),m.jsx("div",{...e.attributes,className:f(),children:m.jsx(S.Content,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(a=e.builderBlock)==null?void 0:a.id},customComponents:Object.values(e.builderComponents),data:{...(l=e.symbol)==null?void 0:l.data,...e.builderContext.localState,...(u=i==null?void 0:i.data)==null?void 0:u.state},canTrack:e.builderContext.canTrack,model:(s=(d=e.symbol)==null?void 0:d.model)!=null?s:"",content:i,linkComponent:e.builderLinkComponent,blocksWrapper:n(),contentWrapper:c()})})}exports.default=h;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),u=require("react"),b=require("./blocks-d07d0261.cjs");require("./blocks-exports.cjs");require("./server-entry-acf5ce7d.cjs");require("./get-class-prop-name-2869a960.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var o;const[t,a]=u.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function r(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:(o=e.tabs)==null?void 0:o.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>r(i),children:l.jsx(b.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(b.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,2 +0,0 @@
1
- "use strict";const S="react",A="[Builder.io]: ",d={log:(...t)=>console.log(A,...t),error:(...t)=>console.error(A,...t),warn:(...t)=>console.warn(A,...t),debug:(...t)=>console.debug(A,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}const yt=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},G=t=>t instanceof URLSearchParams?yt(t):t,$=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return a()&&window.self!==window.top}function J(t){return bt()&&$(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const mt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},wt=()=>typeof navigator=="object"&&navigator.userAgent||"",z=()=>{const t=wt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||S==="reactNative"}},n=t.match(/Tablet|iPad/i),r=mt();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},p=t=>t!=null;function Et(t){const e=t||(a()?window.location.search:void 0);return e?$(e).indexOf("builder.preview=")!==-1:!1}const It=t=>({type:"builder.registerComponent",data:O(t)}),At=t=>{const e=t.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!n?"function ":""}${e}).apply(this, arguments)`};function O(t){return JSON.parse(JSON.stringify(t,(e,n)=>typeof n=="function"?At(n):n))}const V={};function vt(t,e){t==="plugin"&&(e=O(e));let n=V[t];if(n||(n=V[t]=[]),n.push(e),a()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(s){console.debug("Could not postmessage",s)}}}function kt(t){var e;if(a()){const n=JSON.parse(JSON.stringify(t));t.action&&(n.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:n},"*")}}const D={};function Ut(t){if(a()){Object.assign(D,t);const e={type:"builder.settingsChange",data:D};parent.postMessage(e,"*")}}const F="builder.",Tt="options.",P=t=>{if(!t)return{};const e=G(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(F)){const s=r.replace(F,"").replace(Tt,"");n[s]=e[r]}}),n},Ot=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return P(t)},X="4.2.1",H=()=>({"X-Builder-SDK":S,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":X}),Pt=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var n;try{return e?(n=document.cookie.split("; ").find(r=>r.startsWith(`${t}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},Q=async t=>v(t),Rt=t=>t.map(([e,n])=>n?`${e}=${n}`:e).filter(p).join("; "),Ct=[["secure",""],["SameSite","None"]],Bt=({name:t,value:e,expires:n})=>{const s=(a()?location.protocol==="https:":!0)?Ct:[[]],o=n?[["expires",n.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Pt(window.location.hostname)],...s];return Rt(i)},R=async({name:t,value:e,expires:n,canTrack:r})=>{try{if(!r)return;const s=Bt({name:t,value:e,expires:n});document.cookie=s}catch(s){d.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function _t(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Y(){return _t().replace(/-/g,"")}const Z="builderSessionId",xt=async({canTrack:t})=>{if(!t)return;const e=await Q({name:Z,canTrack:t});if(p(e))return e;{const n=Lt();return Nt({id:n,canTrack:t}),n}},Lt=()=>Y(),Nt=({id:t,canTrack:e})=>R({name:Z,value:t,canTrack:e}),q=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Vt=({key:t,canTrack:e})=>{var n;try{return e?(n=q())==null?void 0:n.getItem(t):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Dt=({key:t,canTrack:e,value:n})=>{var r;try{e&&((r=q())==null||r.setItem(t,n))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},tt="builderVisitorId",Ft=({canTrack:t})=>{if(!t)return;const e=Vt({key:tt,canTrack:t});if(p(e))return e;{const n=Mt();return Kt({id:n,canTrack:t}),n}},Mt=()=>Y(),Kt=({id:t,canTrack:e})=>Dt({key:tt,value:t,canTrack:e});function et(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(t)}const Wt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await xt({canTrack:t}),n=Ft({canTrack:t});return{sessionId:e,visitorId:n}},jt=async({type:t,canTrack:e,apiKey:n,metadata:r,...s})=>({type:t,data:{...s,metadata:{url:location.href,...r},...await Wt({canTrack:e}),userAttributes:z(),ownerId:n}});async function nt({apiHost:t,...e}){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||J()||!(a()||S==="reactNative"))return;const r=`${t||"https://cdn.builder.io"}/api/v1/track`;return et(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await jt(e)]}),headers:{"content-type":"application/json",...H()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const Gt=t=>nt({...t,canTrack:!0}),$t=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const n=new URL(e.origin),r=n.hostname;return(t||$t).findIndex(s=>s.startsWith("*.")?r.endsWith(s.slice(1)):s===r)>-1}let M=!1;const st=t=>{var e,n;M||(M=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:S,version:X,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",r=>{var o,i;if(!rt(t.trustedHosts,r))return;const{data:s}=r;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,m=s.data.arguments||[],y=s.data.id,w=new Function(u);let l,g=null;try{l=w.apply(null,m)}catch(h){g=h}g?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var E;(E=window.parent)==null||E.postMessage({type:"builder.evaluateResult",data:{id:y,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:y}},"*");break}}})))},ot=({model:t,trustedHosts:e,callbacks:n})=>r=>{if(!rt(e,r))return;const{data:s}=r;if(s)switch(s.type){case"builder.configureSdk":{n.configureSdk(s.data);break}case"builder.triggerAnimation":{n.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state;i===t&&u&&n.stateUpdate(u);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data;i===t&&n.contentUpdate(u);break}}},Jt=({model:t,apiKey:e,callback:n,trustedHosts:r})=>{if(!a)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};st({modelName:t,apiKey:e});const s=ot({callbacks:{contentUpdate:n,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:r});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},zt="builder.tests",C=t=>`${zt}.${t}`,Xt=({contentId:t})=>Q({name:C(t),canTrack:!0}),Ht=({contentId:t})=>v({name:C(t),canTrack:!0}),Qt=({contentId:t,value:e})=>R({name:C(t),value:e,canTrack:!0}),it=t=>p(t.id)&&p(t.variations)&&Object.keys(t.variations).length>0,Yt=({id:t,variations:e})=>{var s;let n=0;const r=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(n+=i,r<n)return o}return t},at=t=>{const e=Yt(t);return Qt({contentId:t.id,value:e}).catch(n=>{d.error("could not store A/B test variation: ",n)}),e},ct=({item:t,testGroupId:e})=>{const n=t.variations[e];return e===t.id||!n?{testVariationId:t.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===t.id?"Default":"")}},Zt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!it(t))return t;const n=Ht({contentId:t.id})||at({variations:t.variations,id:t.id}),r=ct({item:t,testGroupId:n});return{...t,...r}},qt=async({item:t,canTrack:e})=>{if(!e||!it(t))return t;const r=await Xt({contentId:t.id})||at({variations:t.variations,id:t.id}),s=ct({item:t,testGroupId:r});return{...t,...s}};const K="builder.userAttributes";function W(){let t=!0;const e=new Set;return{setUserAttributes(n){if(!a())return;const r={...this.getUserAttributes(),...n};R({name:K,value:JSON.stringify(r),canTrack:t}),e.forEach(s=>s(r))},getUserAttributes(){return a()?JSON.parse(v({name:K,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(n,{fireImmediately:r}={}){return e.add(n),r&&n(this.getUserAttributes()),function(){e.delete(n)}},setCanTrack(n){t=n}}}let U;a()&&S==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=W()),U=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):U=W();const B=U,te=t=>{B.setUserAttributes(t)},ut=t=>{const e=p(t)?t:!0;return B.setCanTrack(e),e};function ee(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ne(){const t=ee().fetch;if(typeof t=="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 t}const re=ne();function T(t,e=null,n="."){return Object.keys(t).reduce((r,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(n);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...r,...T(o,i,n)}:{...r,[i]:o}},{})}function lt(t,e,n={}){for(const r in t){const s=t[r],o=e?e+"."+r:r;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?lt(s,o,n):n[o]=s}return n}function se(t){const e={};for(const n in t){const r=n.split(".");let s=e;for(let o=0;o<r.length;o++){const i=r[o];o===r.length-1?s[i]=t[n]:(s[i]=s[i]||{},s=s[i])}}return e}const oe="v3",j=t=>typeof t=="number"&&!isNaN(t)&&t>=0,_=t=>{const{limit:e=30,userAttributes:n,query:r,model:s,apiKey:o,enrich:i,locale:u,apiVersion:m=oe,fields:y,omit:w,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:E,includeUnpublished:x,apiHost:ht}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(m))throw new Error(`Invalid apiVersion: expected 'v3', received '${m}'`);const pt=e!==1,St=ht||"https://cdn.builder.io",c=new URL(`${St}/api/${m}/content/${s}`);c.searchParams.set("apiKey",o),c.searchParams.set("limit",String(e)),c.searchParams.set("noTraverse",String(pt)),c.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let b=n||{};if(k&&(c.searchParams.set("locale",k),b={locale:k,...b}),i&&c.searchParams.set("enrich",String(i)),c.searchParams.set("omit",w!=null?w:"meta.componentsUsed"),y&&c.searchParams.set("fields",y),Number.isFinite(l)&&l>-1&&c.searchParams.set("offset",String(Math.floor(l))),typeof x=="boolean"&&c.searchParams.set("includeUnpublished",String(x)),g&&j(g)&&c.searchParams.set("cacheSeconds",String(g)),h&&j(h)&&c.searchParams.set("staleCacheSeconds",String(h)),E){const f=T({sort:E});for(const I in f)c.searchParams.set(I,JSON.stringify(f[I]))}const L={...Ot(),...G(t.options||{})};b={...b,...ae(L)};const N=T(L);for(const f in N)c.searchParams.set(f,String(N[f]));if(Object.keys(b).length>0&&c.searchParams.set("userAttributes",JSON.stringify(b)),r){const f=lt({query:r});for(const I in f)c.searchParams.set(I,JSON.stringify(f[I]))}return c},ie=t=>{const e={};for(const n in t)n.startsWith("userAttributes.")&&(e[n]=t[n],delete t[n]);return e},ae=t=>{if(a()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=ie(t),{userAttributes:n}=se(e);return n}return{}},ce=t=>"results"in t;async function dt(t){const e=await gt({...t,limit:1});return e&&e[0]||null}const ue=async t=>{var i,u;const e=_(t),n=(i=t.fetch)!=null?i:re,r={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...H()}};return await(await n(e.href,r)).json()},ft=async(t,e,n=_(t))=>{const r=ut(t.canTrack);if(n.search.includes("preview="),!r||!(a()||S==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await qt({item:o,canTrack:r}));e.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return e.results};async function gt(t){const e=_(t),n=await ue(t);if(!ce(n))throw d.error("Error fetching data. ",{url:e,content:n,options:t}),n;return ft(t,n)}const le=async t=>{var r,s,o;const e=t.path||((r=t.url)==null?void 0:r.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),n={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:P(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:n.apiKey,model:n.model,content:await dt(n)}};exports.MSG_PREFIX=A;exports.TARGET=S;exports._processContentResult=ft;exports._track=nt;exports.checkIsDefined=p;exports.createEditorListener=ot;exports.createRegisterComponentMessage=It;exports.fetchBuilderProps=le;exports.fetchEntries=gt;exports.fetchOneEntry=dt;exports.getBuilderSearchParams=P;exports.getCookieSync=v;exports.getDefaultCanTrack=ut;exports.getUserAttributes=z;exports.handleABTestingSync=Zt;exports.isBrowser=a;exports.isEditing=J;exports.isPreviewing=Et;exports.logFetch=et;exports.logger=d;exports.register=vt;exports.registerAction=kt;exports.serializeIncludingFunctions=O;exports.setClientUserAttributes=te;exports.setEditorSettings=Ut;exports.setupBrowserForEditing=st;exports.subscribeToEditor=Jt;exports.track=Gt;exports.userAttributesService=B;