@builder.io/sdk-react-nextjs 0.14.29 → 0.14.30

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 (100) hide show
  1. package/lib/browser/blocks-exports.cjs +188 -0
  2. package/lib/browser/blocks-exports.mjs +2812 -0
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +25 -26
  5. package/lib/browser/init.cjs +8 -0
  6. package/lib/browser/init.mjs +60 -0
  7. package/lib/browser/server-entry-24a8bb57.js +720 -0
  8. package/lib/browser/server-entry-6927b611.cjs +2 -0
  9. package/lib/browser/server-entry.cjs +1 -0
  10. package/lib/browser/server-entry.mjs +16 -0
  11. package/lib/edge/blocks-exports.cjs +208 -0
  12. package/lib/edge/{bundle-f748b05a.js → blocks-exports.mjs} +2381 -2401
  13. package/lib/edge/index.cjs +1 -1
  14. package/lib/edge/index.mjs +25 -26
  15. package/lib/edge/init.cjs +8 -0
  16. package/lib/edge/init.mjs +60 -0
  17. package/lib/edge/server-entry-24a8bb57.js +720 -0
  18. package/lib/edge/server-entry-6927b611.cjs +2 -0
  19. package/lib/edge/server-entry.cjs +1 -0
  20. package/lib/edge/server-entry.mjs +16 -0
  21. package/lib/node/blocks-exports.cjs +188 -0
  22. package/lib/node/blocks-exports.mjs +2788 -0
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +23 -23
  25. package/lib/node/init.cjs +1 -0
  26. package/lib/node/init.mjs +13 -0
  27. package/lib/node/node-runtime-39bc20c5.cjs +48 -0
  28. package/lib/node/node-runtime-bf50fca0.js +167 -0
  29. package/lib/node/server-entry-3cc55723.js +720 -0
  30. package/lib/node/server-entry-8112afc1.cjs +2 -0
  31. package/lib/node/server-entry.cjs +1 -0
  32. package/lib/node/server-entry.mjs +16 -0
  33. package/package.json +14 -9
  34. package/types/cjs/blocks/BaseText.d.ts +6 -0
  35. package/types/cjs/blocks/raw-text/component-info.d.ts +2 -0
  36. package/types/cjs/blocks/raw-text/index.d.ts +1 -0
  37. package/types/cjs/blocks/raw-text/raw-text.d.ts +7 -0
  38. package/types/cjs/blocks/textarea/component-info.d.ts +2 -0
  39. package/types/cjs/blocks/textarea/index.d.ts +1 -0
  40. package/types/cjs/blocks/textarea/textarea.d.ts +13 -0
  41. package/types/cjs/components/content/index.d.ts +1 -0
  42. package/types/cjs/components/error-boundary.d.ts +11 -0
  43. package/types/cjs/constants/sdk-name.d.ts +1 -0
  44. package/types/cjs/constants/sdk-version.d.ts +1 -1
  45. package/types/cjs/functions/apply-patch-with-mutation.d.ts +10 -0
  46. package/types/cjs/functions/evaluate/edge-runtime/acorn-interpreter.d.ts +2 -0
  47. package/types/cjs/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
  48. package/types/cjs/functions/evaluate/edge-runtime/index.d.ts +1 -0
  49. package/types/cjs/functions/evaluate/node-runtime/index.d.ts +1 -0
  50. package/types/cjs/functions/evaluate/node-runtime/init.d.ts +13 -0
  51. package/types/cjs/functions/evaluate/node-runtime/node-runtime.d.ts +11 -0
  52. package/types/cjs/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +8 -0
  53. package/types/cjs/functions/evaluate/placeholder-runtime.d.ts +2 -0
  54. package/types/cjs/functions/extract-css-var-default-value.d.ts +1 -0
  55. package/types/cjs/functions/is-edge-runtime.d.ts +4 -0
  56. package/types/cjs/functions/on-change.d.ts +7 -0
  57. package/types/cjs/helpers/omit.d.ts +1 -0
  58. package/types/cjs/helpers/time.d.ts +1 -0
  59. package/types/esm/blocks/BaseText.d.ts +6 -0
  60. package/types/esm/blocks/raw-text/component-info.d.ts +2 -0
  61. package/types/esm/blocks/raw-text/index.d.ts +1 -0
  62. package/types/esm/blocks/raw-text/raw-text.d.ts +7 -0
  63. package/types/esm/blocks/textarea/component-info.d.ts +2 -0
  64. package/types/esm/blocks/textarea/index.d.ts +1 -0
  65. package/types/esm/blocks/textarea/textarea.d.ts +13 -0
  66. package/types/esm/components/content/index.d.ts +1 -0
  67. package/types/esm/components/error-boundary.d.ts +11 -0
  68. package/types/esm/constants/sdk-name.d.ts +1 -0
  69. package/types/esm/constants/sdk-version.d.ts +1 -1
  70. package/types/esm/functions/apply-patch-with-mutation.d.ts +10 -0
  71. package/types/esm/functions/evaluate/edge-runtime/acorn-interpreter.d.ts +2 -0
  72. package/types/esm/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
  73. package/types/esm/functions/evaluate/edge-runtime/index.d.ts +1 -0
  74. package/types/esm/functions/evaluate/node-runtime/index.d.ts +1 -0
  75. package/types/esm/functions/evaluate/node-runtime/init.d.ts +13 -0
  76. package/types/esm/functions/evaluate/node-runtime/node-runtime.d.ts +11 -0
  77. package/types/esm/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +8 -0
  78. package/types/esm/functions/evaluate/placeholder-runtime.d.ts +2 -0
  79. package/types/esm/functions/extract-css-var-default-value.d.ts +1 -0
  80. package/types/esm/functions/is-edge-runtime.d.ts +4 -0
  81. package/types/esm/functions/on-change.d.ts +7 -0
  82. package/types/esm/helpers/omit.d.ts +1 -0
  83. package/types/esm/helpers/time.d.ts +1 -0
  84. package/lib/browser/USE_CLIENT_BUNDLE-2675ec3a.js +0 -703
  85. package/lib/browser/USE_CLIENT_BUNDLE-d62c0e9f.cjs +0 -21
  86. package/lib/browser/USE_SERVER_BUNDLE-22146bcb.cjs +0 -1
  87. package/lib/browser/USE_SERVER_BUNDLE-a878761a.js +0 -11
  88. package/lib/browser/bundle-4aca3c04.cjs +0 -169
  89. package/lib/browser/bundle-9acde1f6.js +0 -2832
  90. package/lib/edge/USE_CLIENT_BUNDLE-744a0d92.js +0 -703
  91. package/lib/edge/USE_CLIENT_BUNDLE-ad07ada0.cjs +0 -21
  92. package/lib/edge/USE_SERVER_BUNDLE-50d2bf59.cjs +0 -1
  93. package/lib/edge/USE_SERVER_BUNDLE-d2138019.js +0 -11
  94. package/lib/edge/bundle-6770809f.cjs +0 -189
  95. package/lib/node/USE_CLIENT_BUNDLE-2f8a2b0f.cjs +0 -21
  96. package/lib/node/USE_CLIENT_BUNDLE-bdfd3683.js +0 -703
  97. package/lib/node/USE_SERVER_BUNDLE-786cc2c7.cjs +0 -1
  98. package/lib/node/USE_SERVER_BUNDLE-a6561926.js +0 -11
  99. package/lib/node/bundle-8b02f7d4.cjs +0 -216
  100. package/lib/node/bundle-ca4c205c.js +0 -2953
@@ -0,0 +1,2 @@
1
+ "use strict";const de=require("lru-cache"),I="rsc",b="[Builder.io]: ",d={log:(...e)=>console.log(b,...e),error:(...e)=>console.error(b,...e),warn:(...e)=>console.warn(b,...e),debug:(...e)=>console.debug(b,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const le=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},V=e=>e instanceof URLSearchParams?le(e):e,M=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function fe(){return c()&&window.self!==window.top}function _(e){return fe()&&M(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const ge=()=>{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},he=()=>typeof navigator=="object"&&navigator.userAgent||"",F=()=>{const e=he(),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()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),r=ge();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"}},C=e=>JSON.parse(JSON.stringify(e)),p=e=>e!=null,pe=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},D=({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){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},N=async e=>D(e),me=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),ye=[["secure",""],["SameSite","None"]],we=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?ye:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",pe(window.location.hostname)],...o];return me(i)},j=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=we({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}},Se="builder.tests",k=e=>`${Se}.${e}`,be=({contentId:e})=>N({name:k(e),canTrack:!0}),Ie=({contentId:e})=>D({name:k(e),canTrack:!0}),ve=({contentId:e,value:t})=>j({name:k(e),value:t,canTrack:!0}),K=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,Ee=({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},W=e=>{const t=Ee(e);return ve({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},$=({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":"")}},Ce=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!K(e))return e;const n=Ie({contentId:e.id})||W({variations:e.variations,id:e.id}),r=$({item:e,testGroupId:n});return{...e,...r}},ke=async({item:e,canTrack:t})=>{if(!t||!K(e))return e;const r=await be({contentId:e.id})||W({variations:e.variations,id:e.id}),o=$({item:e,testGroupId:r});return{...e,...o}},G=e=>p(e)?e:!0,Pe=e=>({type:"builder.registerComponent",data:H(e)}),Re=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},Oe=e=>typeof e=="function"?Re(e):C(e),H=({inputs:e,...t})=>({...C(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((r,[o,s])=>({...r,[o]:Oe(s)}),{}))}),Ae=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||d.warn("No previewed ID found in search params."),n};function z(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new de.LRUCache({max:500,ttl:1e3*60*5}))}function Te(e){z();const t=Ae(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function xe(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Be(){const e=xe().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 J=Be();function E(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,...E(s,i,n)}:{...r,[i]:s}},{})}function X(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("$"))?X(o,s,n):n[s]=o}return n}const Le="v3",T="builder.",Ue="options.",P=e=>{if(!e)return{};const t=V(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(T)){const o=r.replace(T,"").replace(Ue,"");n[o]=t[r]}}),n},Ve=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},x=e=>typeof e=="number"&&!isNaN(e)&&e>=0,R=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:y=Le,fields:m,omit:v,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:O}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(y))throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);const ce=t!==1,a=new URL(`https://cdn.builder.io/api/${y}/content/${o}`);if(a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(ce)),a.searchParams.set("includeRefs",String(!0)),u&&a.searchParams.set("locale",u),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",v||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof O=="boolean"&&a.searchParams.set("includeUnpublished",String(O)),g&&x(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&x(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=E({sort:w});for(const S in f)a.searchParams.set(S,JSON.stringify(f[S]))}const ue={...Ve(),...V(e.options||{})},A=E(ue);for(const f in A)a.searchParams.set(f,String(A[f]));if(n&&a.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=X({query:r});for(const S in f)a.searchParams.set(S,JSON.stringify(f[S]))}return a},Me=e=>"results"in e;async function q(e){const t=await Y({...e,limit:1});return t&&t[0]||null}const _e=async e=>{var s;const t=R(e);return await(await((s=e.fetch)!=null?s:J)(t.href,e.fetchOptions)).json()},Q=async(e,t,n=R(e))=>{const r=G(e.canTrack);if(n.search.includes("preview=")){const s=[];for(const i of t.results){const u=Te(n.searchParams);s.push(u||i)}t.results=s}if(!r||!(c()||I==="reactNative"))return t.results;try{const s=[];for(const i of t.results)s.push(await ke({item:i,canTrack:r}));t.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return t.results};async function Y(e){try{const t=R(e),n=await _e(e);return Me(n)?Q(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}function Fe(e){const t=e||(c()?window.location.search:void 0);return t?M(t).indexOf("builder.preview=")!==-1:!1}function De(){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 De().replace(/-/g,"")}const ee="builderSessionId",Ne=async({canTrack:e})=>{if(!e)return;const t=await N({name:ee,canTrack:e});if(p(t))return t;{const n=je();return Ke({id:n,canTrack:e}),n}},je=()=>Z(),Ke=({id:e,canTrack:t})=>j({name:ee,value:e,canTrack:t}),te=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,We=({key:e,canTrack:t})=>{var n;try{return t?(n=te())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},$e=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=te())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},ne="builderVisitorId",Ge=({canTrack:e})=>{if(!e)return;const t=We({key:ne,canTrack:e});if(p(t))return t;{const n=He();return ze({id:n,canTrack:e}),n}},He=()=>Z(),ze=({id:e,canTrack:t})=>$e({key:ne,value:e,canTrack:t}),Je=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ne({canTrack:e}),n=Ge({canTrack:e});return{sessionId:t,visitorId:n}},Xe=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Je({canTrack:t}),userAttributes:F(),ownerId:n}});async function re(e){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!_()&&(c()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Xe(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const qe=e=>re({...e,canTrack:!0}),Qe=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function oe(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Qe).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Ye="0.14.30",B={};function se(e,t){let n=B[e];if(n||(n=B[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 Ze=()=>{se("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 L=!1;const ie=(e={})=>{var t,n;L||(L=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:Ye,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(!oe(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,y=o.data.arguments||[],m=o.data.id,v=new Function(u);let l,g=null;try{l=v.apply(null,y)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):l&&typeof l.then=="function"?l.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:l,id:m}},"*");break}}})))},ae=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!oe(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}}},et=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};ie();const r=ae({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},U={};function tt(e){if(c()){Object.assign(U,e);const t={type:"builder.settingsChange",data:U};parent.postMessage(t,"*")}}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:P(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await q(n)}};exports.MSG_PREFIX=b;exports.TARGET=I;exports._processContentResult=Q;exports._track=re;exports.checkIsDefined=p;exports.createEditorListener=ae;exports.createRegisterComponentMessage=Pe;exports.fastClone=C;exports.fetch=J;exports.fetchBuilderProps=nt;exports.fetchEntries=Y;exports.fetchOneEntry=q;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=G;exports.getUserAttributes=F;exports.handleABTestingSync=Ce;exports.init=z;exports.isBrowser=c;exports.isEditing=_;exports.isPreviewing=Fe;exports.logger=d;exports.register=se;exports.registerInsertMenu=Ze;exports.serializeComponentInfo=H;exports.setEditorSettings=tt;exports.setupBrowserForEditing=ie;exports.subscribeToEditor=et;exports.track=qe;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-8112afc1.cjs");require("lru-cache");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;
@@ -0,0 +1,16 @@
1
+ import { _processContentResult as i, createRegisterComponentMessage as s, fetchBuilderProps as o, fetchEntries as n, fetchOneEntry as c, getBuilderSearchParams as g, isEditing as a, isPreviewing as d, register as p, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-3cc55723.js";
2
+ import "lru-cache";
3
+ export {
4
+ i as _processContentResult,
5
+ s as createRegisterComponentMessage,
6
+ o as fetchBuilderProps,
7
+ n as fetchEntries,
8
+ c as fetchOneEntry,
9
+ g as getBuilderSearchParams,
10
+ a as isEditing,
11
+ d as isPreviewing,
12
+ p as register,
13
+ E as setEditorSettings,
14
+ f as subscribeToEditor,
15
+ h as track
16
+ };
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.29",
4
+ "version": "0.14.30",
5
5
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
6
6
  "repository": {
7
7
  "type": "git",
@@ -12,8 +12,9 @@
12
12
  "lib",
13
13
  "types"
14
14
  ],
15
- "main": "./lib/edge/index.cjs",
16
- "module": "./lib/edge/index.mjs",
15
+ "types": "./types/index.d.ts",
16
+ "main": "./lib/node/index.cjs",
17
+ "module": "./lib/node/index.mjs",
17
18
  "type": "module",
18
19
  "exports": {
19
20
  ".": {
@@ -66,6 +67,11 @@
66
67
  "require": "./lib/browser/index.cjs"
67
68
  }
68
69
  },
70
+ "./node/init": {
71
+ "types": "./types/esm/functions/evaluate/node-runtime/init.d.ts",
72
+ "import": "./lib/node/init.mjs",
73
+ "require": "./lib/node/init.cjs"
74
+ },
69
75
  "./bundle/edge": {
70
76
  "import": "./lib/edge/index.mjs",
71
77
  "require": "./lib/edge/index.cjs"
@@ -91,8 +97,8 @@
91
97
  },
92
98
  "peerDependencies": {
93
99
  "next": ">=13.4.20",
94
- "react": "^18.2.0",
95
- "react-dom": "^18.2.0"
100
+ "react": ">=18.2.0",
101
+ "react-dom": ">=18.2.0"
96
102
  },
97
103
  "devDependencies": {
98
104
  "@builder.io/sdks": "workspace:*",
@@ -101,10 +107,8 @@
101
107
  "nx": "16.10.0",
102
108
  "nx-cloud": "16.5.2",
103
109
  "react": "^18.2.0",
104
- "rimraf": "^3.0.2",
105
110
  "typescript": "^5.1.6",
106
- "vite": "^4.4.9",
107
- "vite-plugin-dts": "^3.5.2"
111
+ "vite": "^4.4.9"
108
112
  },
109
113
  "dependencies": {
110
114
  "isolated-vm": "^5.0.0",
@@ -129,5 +133,6 @@
129
133
  ]
130
134
  }
131
135
  }
132
- }
136
+ },
137
+ "stableVersion": "0.14.29"
133
138
  }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ export interface BaseTextProps {
3
+ text: string;
4
+ }
5
+ declare function BaseText(props: BaseTextProps): React.JSX.Element;
6
+ export default BaseText;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1 @@
1
+ export { default } from './raw-text.js';
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export interface RawTextProps {
3
+ attributes?: any;
4
+ text?: string;
5
+ }
6
+ declare function RawText(props: RawTextProps): React.JSX.Element;
7
+ export default RawText;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1 @@
1
+ export { default } from './textarea.js';
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ /**
3
+ * This import is used by the Svelte SDK. Do not remove.
4
+ */
5
+ export interface TextareaProps {
6
+ attributes?: any;
7
+ name?: string;
8
+ value?: string;
9
+ defaultValue?: string;
10
+ placeholder?: string;
11
+ }
12
+ declare function Textarea(props: TextareaProps): React.JSX.Element;
13
+ export default Textarea;
@@ -0,0 +1 @@
1
+ export { default } from './content.js';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export default class ErrorBoundary extends React.Component<React.PropsWithChildren, {
3
+ hasError: boolean;
4
+ }> {
5
+ constructor(props: any);
6
+ static getDerivedStateFromError(_error: any): {
7
+ hasError: boolean;
8
+ };
9
+ componentDidCatch(error: any, info: any): void;
10
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode>;
11
+ }
@@ -0,0 +1 @@
1
+ export declare const SDK_NAME: `@builder.io/sdk-${any}`;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.14.29";
1
+ export declare const SDK_VERSION = "0.14.30";
@@ -0,0 +1,10 @@
1
+ export type Patch = {
2
+ path: string;
3
+ op: 'add' | 'remove' | 'replace';
4
+ value: any;
5
+ };
6
+ export declare const applyPatchWithMinimalMutationChain: <T extends object>(obj: T, patch: {
7
+ path: string;
8
+ op: 'add' | 'remove' | 'replace';
9
+ value: any;
10
+ }, preserveRoot?: boolean) => T;
@@ -0,0 +1,2 @@
1
+ declare const _default: Class;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from '../helpers.js';
2
+ export declare const runInEdge: ({ builder, context, event, rootState, localState, rootSetState, code }: ExecutorArgs) => any;
@@ -0,0 +1 @@
1
+ export { runInEdge as evaluator } from './edge-runtime.js';
@@ -0,0 +1 @@
1
+ export { runInNode as evaluator } from './node-runtime.js';
@@ -0,0 +1,13 @@
1
+ import type { IsolateOptions } from 'isolated-vm';
2
+ /**
3
+ * This function initializes the SDK on a Node server. It handles importing the
4
+ * `isolated-vm` package which is needed for dynamic bindings.
5
+ *
6
+ * NOTE: this function cannot be called on the client. You must call this function
7
+ * from a server-only location, such as:
8
+ * - The NextJS Pages router's `_document.tsx`
9
+ * - Your Remix route's `loader`
10
+ */
11
+ export declare const initializeNodeRuntime: (args?: {
12
+ ivmIsolateOptions?: IsolateOptions;
13
+ }) => void;
@@ -0,0 +1,11 @@
1
+ import type { IsolateOptions } from 'isolated-vm';
2
+ import type { ExecutorArgs } from '../helpers.js';
3
+ type IsolatedVMImport = typeof import('isolated-vm');
4
+ /**
5
+ * Set the `isolated-vm` instance to be used by the node runtime.
6
+ * This is useful for environments that are not able to rely on our
7
+ * `safeDynamicRequire` trick to import the `isolated-vm` package.
8
+ */
9
+ export declare const setIvm: (ivm: IsolatedVMImport, options?: IsolateOptions) => void;
10
+ export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Overriding usage of `node:module` because of https://github.com/vercel/next.js/issues/60491
3
+ * This doesn't actually work in production, but it lets the tests pass...
4
+ * Mono-repo env seems to pull in the SDK differently which allows the eval('require') to work.
5
+ */
6
+ /// <reference types="node" />
7
+ /// <reference types="react-native" />
8
+ export declare let safeDynamicRequire: typeof require;
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from './helpers.js';
2
+ export declare const evaluator: (_args: ExecutorArgs) => never;
@@ -0,0 +1 @@
1
+ export declare function extractCssVarDefaultValue(value: string): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Identifies edge runtimes (edge, workers, serverless, etc.)
3
+ */
4
+ export declare function isEdgeRuntime(): boolean;
@@ -0,0 +1,7 @@
1
+ export declare const onChangeProxySymbol: unique symbol;
2
+ /**
3
+ * Deeply observe an object and run a callback when it changes
4
+ *
5
+ * See ./on-change.test.ts for more info
6
+ */
7
+ export declare function onChange<T extends object = any>(obj: T, cb: () => void): T;
@@ -0,0 +1 @@
1
+ export declare function omit<T extends object>(obj: T, ...values: (keyof T)[]): Partial<T>;
@@ -0,0 +1 @@
1
+ export declare const getCurrentDatePlusMinutes: (minutes?: number) => Date;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ export interface BaseTextProps {
3
+ text: string;
4
+ }
5
+ declare function BaseText(props: BaseTextProps): React.JSX.Element;
6
+ export default BaseText;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1 @@
1
+ export { default } from './raw-text.js';
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export interface RawTextProps {
3
+ attributes?: any;
4
+ text?: string;
5
+ }
6
+ declare function RawText(props: RawTextProps): React.JSX.Element;
7
+ export default RawText;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1 @@
1
+ export { default } from './textarea.js';
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ /**
3
+ * This import is used by the Svelte SDK. Do not remove.
4
+ */
5
+ export interface TextareaProps {
6
+ attributes?: any;
7
+ name?: string;
8
+ value?: string;
9
+ defaultValue?: string;
10
+ placeholder?: string;
11
+ }
12
+ declare function Textarea(props: TextareaProps): React.JSX.Element;
13
+ export default Textarea;
@@ -0,0 +1 @@
1
+ export { default } from './content.js';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export default class ErrorBoundary extends React.Component<React.PropsWithChildren, {
3
+ hasError: boolean;
4
+ }> {
5
+ constructor(props: any);
6
+ static getDerivedStateFromError(_error: any): {
7
+ hasError: boolean;
8
+ };
9
+ componentDidCatch(error: any, info: any): void;
10
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode>;
11
+ }
@@ -0,0 +1 @@
1
+ export declare const SDK_NAME: `@builder.io/sdk-${any}`;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.14.29";
1
+ export declare const SDK_VERSION = "0.14.30";
@@ -0,0 +1,10 @@
1
+ export type Patch = {
2
+ path: string;
3
+ op: 'add' | 'remove' | 'replace';
4
+ value: any;
5
+ };
6
+ export declare const applyPatchWithMinimalMutationChain: <T extends object>(obj: T, patch: {
7
+ path: string;
8
+ op: 'add' | 'remove' | 'replace';
9
+ value: any;
10
+ }, preserveRoot?: boolean) => T;
@@ -0,0 +1,2 @@
1
+ declare const _default: Class;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from '../helpers.js';
2
+ export declare const runInEdge: ({ builder, context, event, rootState, localState, rootSetState, code }: ExecutorArgs) => any;
@@ -0,0 +1 @@
1
+ export { runInEdge as evaluator } from './edge-runtime.js';
@@ -0,0 +1 @@
1
+ export { runInNode as evaluator } from './node-runtime.js';
@@ -0,0 +1,13 @@
1
+ import type { IsolateOptions } from 'isolated-vm';
2
+ /**
3
+ * This function initializes the SDK on a Node server. It handles importing the
4
+ * `isolated-vm` package which is needed for dynamic bindings.
5
+ *
6
+ * NOTE: this function cannot be called on the client. You must call this function
7
+ * from a server-only location, such as:
8
+ * - The NextJS Pages router's `_document.tsx`
9
+ * - Your Remix route's `loader`
10
+ */
11
+ export declare const initializeNodeRuntime: (args?: {
12
+ ivmIsolateOptions?: IsolateOptions;
13
+ }) => void;
@@ -0,0 +1,11 @@
1
+ import type { IsolateOptions } from 'isolated-vm';
2
+ import type { ExecutorArgs } from '../helpers.js';
3
+ type IsolatedVMImport = typeof import('isolated-vm');
4
+ /**
5
+ * Set the `isolated-vm` instance to be used by the node runtime.
6
+ * This is useful for environments that are not able to rely on our
7
+ * `safeDynamicRequire` trick to import the `isolated-vm` package.
8
+ */
9
+ export declare const setIvm: (ivm: IsolatedVMImport, options?: IsolateOptions) => void;
10
+ export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Overriding usage of `node:module` because of https://github.com/vercel/next.js/issues/60491
3
+ * This doesn't actually work in production, but it lets the tests pass...
4
+ * Mono-repo env seems to pull in the SDK differently which allows the eval('require') to work.
5
+ */
6
+ /// <reference types="node" resolution-mode="require"/>
7
+ /// <reference types="react-native" />
8
+ export declare let safeDynamicRequire: typeof require;
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from './helpers.js';
2
+ export declare const evaluator: (_args: ExecutorArgs) => never;
@@ -0,0 +1 @@
1
+ export declare function extractCssVarDefaultValue(value: string): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Identifies edge runtimes (edge, workers, serverless, etc.)
3
+ */
4
+ export declare function isEdgeRuntime(): boolean;
@@ -0,0 +1,7 @@
1
+ export declare const onChangeProxySymbol: unique symbol;
2
+ /**
3
+ * Deeply observe an object and run a callback when it changes
4
+ *
5
+ * See ./on-change.test.ts for more info
6
+ */
7
+ export declare function onChange<T extends object = any>(obj: T, cb: () => void): T;
@@ -0,0 +1 @@
1
+ export declare function omit<T extends object>(obj: T, ...values: (keyof T)[]): Partial<T>;
@@ -0,0 +1 @@
1
+ export declare const getCurrentDatePlusMinutes: (minutes?: number) => Date;