@builder.io/sdk-react-nextjs 0.16.13 → 0.16.14

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 (85) hide show
  1. package/lib/browser/blocks/columns/columns.cjs +2 -2
  2. package/lib/browser/blocks/columns/columns.mjs +2 -2
  3. package/lib/browser/blocks/image/image.cjs +4 -4
  4. package/lib/browser/blocks/image/image.mjs +25 -25
  5. package/lib/browser/components/awaiter.cjs +1 -0
  6. package/lib/browser/components/awaiter.mjs +10 -0
  7. package/lib/browser/components/block/components/interactive-element.cjs +1 -1
  8. package/lib/browser/components/block/components/interactive-element.mjs +19 -9
  9. package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
  10. package/lib/browser/components/blocks/blocks-wrapper.mjs +5 -5
  11. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  12. package/lib/browser/components/content/components/enable-editor.mjs +114 -139
  13. package/lib/browser/components/content/content.cjs +1 -1
  14. package/lib/browser/components/content/content.mjs +62 -43
  15. package/lib/browser/constants/sdk-version.cjs +1 -1
  16. package/lib/browser/constants/sdk-version.mjs +1 -1
  17. package/lib/browser/functions/evaluate/browser-runtime/browser.cjs +1 -1
  18. package/lib/browser/functions/evaluate/browser-runtime/browser.mjs +19 -45
  19. package/lib/browser/functions/evaluate/helpers.cjs +1 -1
  20. package/lib/browser/functions/evaluate/helpers.mjs +50 -24
  21. package/lib/browser/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
  22. package/lib/browser/functions/evaluate/node-runtime/node-runtime.mjs +7 -7
  23. package/lib/edge/blocks/columns/columns.cjs +2 -2
  24. package/lib/edge/blocks/columns/columns.mjs +2 -2
  25. package/lib/edge/blocks/image/image.cjs +4 -4
  26. package/lib/edge/blocks/image/image.mjs +25 -25
  27. package/lib/edge/components/awaiter.cjs +1 -0
  28. package/lib/edge/components/awaiter.mjs +10 -0
  29. package/lib/edge/components/block/components/interactive-element.cjs +1 -1
  30. package/lib/edge/components/block/components/interactive-element.mjs +19 -9
  31. package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
  32. package/lib/edge/components/blocks/blocks-wrapper.mjs +5 -5
  33. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  34. package/lib/edge/components/content/components/enable-editor.mjs +114 -139
  35. package/lib/edge/components/content/content.cjs +1 -1
  36. package/lib/edge/components/content/content.mjs +62 -43
  37. package/lib/edge/constants/builder-registered-components.cjs +1 -1
  38. package/lib/edge/constants/builder-registered-components.mjs +1 -1
  39. package/lib/edge/constants/extra-components.cjs +1 -1
  40. package/lib/edge/constants/extra-components.mjs +1 -1
  41. package/lib/edge/constants/sdk-version.cjs +1 -1
  42. package/lib/edge/constants/sdk-version.mjs +1 -1
  43. package/lib/edge/functions/evaluate/browser-runtime/browser.cjs +1 -1
  44. package/lib/edge/functions/evaluate/browser-runtime/browser.mjs +19 -45
  45. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +8 -10
  46. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +70 -53
  47. package/lib/edge/functions/evaluate/helpers.cjs +1 -1
  48. package/lib/edge/functions/evaluate/helpers.mjs +50 -24
  49. package/lib/edge/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
  50. package/lib/edge/functions/evaluate/node-runtime/node-runtime.mjs +7 -7
  51. package/lib/node/blocks/columns/columns.cjs +2 -2
  52. package/lib/node/blocks/columns/columns.mjs +2 -2
  53. package/lib/node/blocks/image/image.cjs +4 -4
  54. package/lib/node/blocks/image/image.mjs +25 -25
  55. package/lib/node/components/awaiter.cjs +1 -0
  56. package/lib/node/components/awaiter.mjs +10 -0
  57. package/lib/node/components/block/components/interactive-element.cjs +1 -1
  58. package/lib/node/components/block/components/interactive-element.mjs +19 -9
  59. package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
  60. package/lib/node/components/blocks/blocks-wrapper.mjs +5 -5
  61. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  62. package/lib/node/components/content/components/enable-editor.mjs +114 -139
  63. package/lib/node/components/content/content.cjs +1 -1
  64. package/lib/node/components/content/content.mjs +62 -43
  65. package/lib/node/constants/sdk-version.cjs +1 -1
  66. package/lib/node/constants/sdk-version.mjs +1 -1
  67. package/lib/node/functions/evaluate/browser-runtime/browser.cjs +1 -1
  68. package/lib/node/functions/evaluate/browser-runtime/browser.mjs +19 -45
  69. package/lib/node/functions/evaluate/helpers.cjs +1 -1
  70. package/lib/node/functions/evaluate/helpers.mjs +50 -24
  71. package/lib/node/functions/evaluate/node-runtime/node-runtime.cjs +9 -9
  72. package/lib/node/functions/evaluate/node-runtime/node-runtime.mjs +26 -26
  73. package/package.json +1 -1
  74. package/types/cjs/components/awaiter.d.ts +14 -0
  75. package/types/cjs/constants/sdk-version.d.ts +1 -1
  76. package/types/cjs/context/component-reference-types.d.ts +4 -0
  77. package/types/cjs/context/types.d.ts +2 -1
  78. package/types/cjs/functions/evaluate/browser-runtime/browser.d.ts +0 -6
  79. package/types/cjs/functions/evaluate/helpers.d.ts +5 -0
  80. package/types/esm/components/awaiter.d.ts +14 -0
  81. package/types/esm/constants/sdk-version.d.ts +1 -1
  82. package/types/esm/context/component-reference-types.d.ts +4 -0
  83. package/types/esm/context/types.d.ts +2 -1
  84. package/types/esm/functions/evaluate/browser-runtime/browser.d.ts +0 -6
  85. package/types/esm/functions/evaluate/helpers.d.ts +5 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.13";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.14";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.16.13";
1
+ const o = "0.16.14";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../helpers.cjs"),w=({code:s,builder:i,context:u,event:r,localState:n,rootSetState:e,rootState:t})=>{const f=l.getFunctionArguments({builder:i,context:u,event:r,state:c({rootState:t,localState:n,rootSetState:e})});return new Function(...f.map(([o])=>o),s)(...f.map(([,o])=>o))};function c({rootState:s,localState:i,rootSetState:u}){return new Proxy(s,{get:(r,n)=>{if(i&&n in i)return i[n];const e=r[n];return typeof e=="object"&&e!==null?c({rootState:e,localState:void 0,rootSetState:u?t=>{r[n]=t,u(r)}:void 0}):e},set:(r,n,e)=>{if(i&&n in i)throw new Error("Writing to local state is not allowed as it is read-only.");return r[n]=e,u==null||u(r),!0}})}exports.flattenState=c;exports.runInBrowser=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../helpers.cjs"),g=({code:r,builder:o,context:s,event:u,localState:c,rootSetState:a,rootState:i})=>{const e=n.getFunctionArguments({builder:o,context:s,event:u,state:n.flattenState({rootState:i,localState:c,rootSetState:a})});return new Function(...e.map(([t])=>t),r)(...e.map(([,t])=>t))};exports.runInBrowser=g;
@@ -1,51 +1,25 @@
1
- import { getFunctionArguments as w } from "../helpers.mjs";
2
- const d = ({
3
- code: e,
4
- builder: u,
5
- context: s,
6
- event: i,
7
- localState: n,
8
- rootSetState: r,
9
- rootState: f
1
+ import { getFunctionArguments as m, flattenState as i } from "../helpers.mjs";
2
+ const f = ({
3
+ code: r,
4
+ builder: e,
5
+ context: o,
6
+ event: s,
7
+ localState: u,
8
+ rootSetState: a,
9
+ rootState: c
10
10
  }) => {
11
- const c = w({
12
- builder: u,
13
- context: s,
14
- event: i,
15
- state: t({
16
- rootState: f,
17
- localState: n,
18
- rootSetState: r
11
+ const n = m({
12
+ builder: e,
13
+ context: o,
14
+ event: s,
15
+ state: i({
16
+ rootState: c,
17
+ localState: u,
18
+ rootSetState: a
19
19
  })
20
20
  });
21
- return new Function(...c.map(([o]) => o), e)(...c.map(([, o]) => o));
21
+ return new Function(...n.map(([t]) => t), r)(...n.map(([, t]) => t));
22
22
  };
23
- function t({
24
- rootState: e,
25
- localState: u,
26
- rootSetState: s
27
- }) {
28
- return new Proxy(e, {
29
- get: (i, n) => {
30
- if (u && n in u)
31
- return u[n];
32
- const r = i[n];
33
- return typeof r == "object" && r !== null ? t({
34
- rootState: r,
35
- localState: void 0,
36
- rootSetState: s ? (f) => {
37
- i[n] = f, s(i);
38
- } : void 0
39
- }) : r;
40
- },
41
- set: (i, n, r) => {
42
- if (u && n in u)
43
- throw new Error("Writing to local state is not allowed as it is read-only.");
44
- return i[n] = r, s == null || s(i), !0;
45
- }
46
- });
47
- }
48
23
  export {
49
- t as flattenState,
50
- d as runInBrowser
24
+ f as runInBrowser
51
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../is-browser.cjs"),n=require("../is-editing.cjs"),u=require("../track/helpers.cjs"),o=({builder:e,context:r,event:t,state:s})=>Object.entries({state:s,Builder:e,builder:e,context:r,event:t}),g=()=>({isEditing:n.isEditing(),isBrowser:i.isBrowser(),isServer:!i.isBrowser(),getUserAttributes:()=>u.getUserAttributes()}),l=(e,{isExpression:r=!0})=>r&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e;exports.getBuilderGlobals=g;exports.getFunctionArguments=o;exports.parseCode=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../is-browser.cjs"),d=require("../is-editing.cjs"),c=require("../track/helpers.cjs"),g=({builder:e,context:r,event:n,state:s})=>Object.entries({state:s,Builder:e,builder:e,context:r,event:n}),f=()=>({isEditing:d.isEditing(),isBrowser:u.isBrowser(),isServer:!u.isBrowser(),getUserAttributes:()=>c.getUserAttributes()}),w=(e,{isExpression:r=!0})=>r&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e;function o({rootState:e,localState:r,rootSetState:n}){return new Proxy(e,{get:(s,t)=>{if(r&&t in r)return r[t];const i=s[t];return typeof i=="object"&&i!==null?o({rootState:i,localState:void 0,rootSetState:n?l=>{s[t]=l,n(s)}:void 0}):i},set:(s,t,i)=>{if(r&&t in r)throw new Error("Writing to local state is not allowed as it is read-only.");return s[t]=i,n==null||n(s),!0}})}exports.flattenState=o;exports.getBuilderGlobals=f;exports.getFunctionArguments=g;exports.parseCode=w;
@@ -1,28 +1,54 @@
1
- import { isBrowser as i } from "../is-browser.mjs";
2
- import { isEditing as n } from "../is-editing.mjs";
3
- import { getUserAttributes as u } from "../track/helpers.mjs";
4
- const c = ({
5
- builder: t,
6
- context: r,
7
- event: e,
8
- state: s
1
+ import { isBrowser as u } from "../is-browser.mjs";
2
+ import { isEditing as f } from "../is-editing.mjs";
3
+ import { getUserAttributes as d } from "../track/helpers.mjs";
4
+ const w = ({
5
+ builder: r,
6
+ context: n,
7
+ event: i,
8
+ state: e
9
9
  }) => Object.entries({
10
- state: s,
11
- Builder: t,
10
+ state: e,
11
+ Builder: r,
12
12
  // legacy
13
- builder: t,
14
- context: r,
15
- event: e
16
- }), l = () => ({
17
- isEditing: n(),
18
- isBrowser: i(),
19
- isServer: !i(),
20
- getUserAttributes: () => u()
21
- }), p = (t, {
22
- isExpression: r = !0
23
- }) => /* we disable this for cases where we definitely don't want a return */ r && !(t.includes(";") || t.includes(" return ") || t.trim().startsWith("return ")) ? `return (${t});` : t;
13
+ builder: r,
14
+ context: n,
15
+ event: i
16
+ }), b = () => ({
17
+ isEditing: f(),
18
+ isBrowser: u(),
19
+ isServer: !u(),
20
+ getUserAttributes: () => d()
21
+ }), v = (r, {
22
+ isExpression: n = !0
23
+ }) => /* we disable this for cases where we definitely don't want a return */ n && !(r.includes(";") || r.includes(" return ") || r.trim().startsWith("return ")) ? `return (${r});` : r;
24
+ function l({
25
+ rootState: r,
26
+ localState: n,
27
+ rootSetState: i
28
+ }) {
29
+ return new Proxy(r, {
30
+ get: (e, s) => {
31
+ if (n && s in n)
32
+ return n[s];
33
+ const t = e[s];
34
+ return typeof t == "object" && t !== null ? l({
35
+ rootState: t,
36
+ localState: void 0,
37
+ rootSetState: i ? (o) => {
38
+ e[s] = o, i(e);
39
+ } : void 0
40
+ }) : t;
41
+ },
42
+ set: (e, s, t) => {
43
+ if (n && s in n)
44
+ throw new Error("Writing to local state is not allowed as it is read-only.");
45
+ return e[s] = t, i == null || i(e), !0;
46
+ }
47
+ });
48
+ }
24
49
  export {
25
- l as getBuilderGlobals,
26
- c as getFunctionArguments,
27
- p as parseCode
50
+ l as flattenState,
51
+ b as getBuilderGlobals,
52
+ w as getFunctionArguments,
53
+ v as parseCode
28
54
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../constants/sdk-name.cjs"),m=require("../../../helpers/logger.cjs"),R=require("../../fast-clone.cjs"),A=require("../../set.cjs"),x=require("../helpers.cjs"),M=require("./safeDynamicRequire.cjs"),g=t=>`bldr_${t}_sync`,I="BUILDER_SET_STATE",b="BUILDER_IVM",h=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../constants/sdk-name.cjs"),m=require("../../../helpers/logger.cjs"),A=require("../../fast-clone.cjs"),R=require("../../set.cjs"),x=require("../helpers.cjs"),M=require("./safeDynamicRequire.cjs"),g=t=>`bldr_${t}_sync`,b="BUILDER_SET_STATE",I="BUILDER_IVM",k=`
2
2
  var refToProxy = (obj) => {
3
3
  if (typeof obj !== 'object' || obj === null) {
4
4
  return obj;
@@ -15,18 +15,18 @@ var refToProxy = (obj) => {
15
15
  return val;
16
16
  },
17
17
  set(target, key, value) {
18
- const v = typeof value === 'object' ? new ${b}.Reference(value) : value;
18
+ const v = typeof value === 'object' ? new ${I}.Reference(value) : value;
19
19
  obj.setSync(key, v);
20
- ${I}(key, value)
20
+ ${b}(key, value)
21
21
  },
22
22
  deleteProperty(target, key) {
23
23
  obj.deleteSync(key);
24
24
  }
25
25
  })
26
26
  }
27
- `,k=({code:t,args:e})=>{const i=e.map(([o])=>`var ${o} = refToProxy(${g(o)}); `).join("");return`
28
- ${h}
29
- ${i}
27
+ `,h=({code:t,args:e})=>{const u=e.map(([o])=>`var ${o} = refToProxy(${g(o)}); `).join("");return`
28
+ ${k}
29
+ ${u}
30
30
  function theFunction() {
31
31
  ${t}
32
32
  }
@@ -38,11 +38,11 @@ if (typeof output === 'object' && output !== null) {
38
38
  } else {
39
39
  return output;
40
40
  }
41
- `};let a=null,y=null;const C=(t,e={})=>{a=t,E(e)},O=l.SDK_NAME==="@builder.io/sdk-react-nextjs"||l.SDK_NAME==="@builder.io/sdk-react"||l.SDK_NAME==="@builder.io/sdk-qwik",S=()=>{try{if(a)return a;const e=M.safeDynamicRequire("isolated-vm");if(e)return e}catch(e){m.logger.error("isolated-vm import error.",e)}const t=`${m.MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
41
+ `};let a=null,y=null;const C=(t,e={})=>{a=t,E(e)},D=i.SDK_NAME==="@builder.io/sdk-react-nextjs"||i.SDK_NAME==="@builder.io/sdk-react"||i.SDK_NAME==="@builder.io/sdk-qwik"||i.SDK_NAME==="@builder.io/sdk-vue",S=()=>{try{if(a)return a;const e=M.safeDynamicRequire("isolated-vm");if(e)return e}catch(e){m.logger.error("isolated-vm import error.",e)}const t=`${m.MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
42
42
 
43
43
  SOLUTION: In a server-only execution path within your application, do one of the following:
44
44
 
45
- ${O?`- import and call \`initializeNodeRuntime()\` from "${l.SDK_NAME}/node/init".`:""}
45
+ ${D?`- import and call \`initializeNodeRuntime()\` from "${i.SDK_NAME}/node/init".`:""}
46
46
  - add the following import: \`await import('isolated-vm')\`.
47
47
 
48
- For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(t)};function E(t={memoryLimit:128}){const e=S(),o=new e.Isolate(t).createContextSync(),n=o.global;return n.setSync("global",n.derefInto()),n.setSync("log",function(...c){console.log(...c)}),n.setSync(b,e),y=o,o}const w=()=>y||E(),D=({code:t,builder:e,context:i,event:o,localState:n,rootSetState:c,rootState:u})=>{const _=S(),N=R.fastClone({...u,...n}),f=x.getFunctionArguments({builder:e,context:i,event:o,state:N}),d=w(),p=d.global;p.setSync(I,function(r,s){A.set(u,r,s),c==null||c(u)}),f.forEach(([r,s])=>{const j=typeof s=="object"?new _.Reference(r==="builder"?{...s,getUserAttributes:()=>s.getUserAttributes()}:s):null;p.setSync(g(r),j)});const T=k({code:t,args:f}),v=d.evalClosureSync(T);try{return JSON.parse(v)}catch{return v}};exports.runInNode=D;exports.setIvm=C;
48
+ For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(t)};function E(t={memoryLimit:128}){const e=S(),o=new e.Isolate(t).createContextSync(),n=o.global;return n.setSync("global",n.derefInto()),n.setSync("log",function(...c){console.log(...c)}),n.setSync(I,e),y=o,o}const O=()=>y||E(),w=({code:t,builder:e,context:u,event:o,localState:n,rootSetState:c,rootState:l})=>{const _=S(),N=A.fastClone({...l,...n}),d=x.getFunctionArguments({builder:e,context:u,event:o,state:N}),f=O(),p=f.global;p.setSync(b,function(r,s){R.set(l,r,s),c==null||c(l)}),d.forEach(([r,s])=>{const j=typeof s=="object"?new _.Reference(r==="builder"?{...s,getUserAttributes:()=>s.getUserAttributes()}:s):null;p.setSync(g(r),j)});const T=h({code:t,args:d}),v=f.evalClosureSync(T);try{return JSON.parse(v)}catch{return v}};exports.runInNode=w;exports.setIvm=C;
@@ -1,10 +1,10 @@
1
- import { SDK_NAME as l } from "../../../constants/sdk-name.mjs";
1
+ import { SDK_NAME as s } from "../../../constants/sdk-name.mjs";
2
2
  import { logger as j, MSG_PREFIX as x } from "../../../helpers/logger.mjs";
3
3
  import { fastClone as R } from "../../fast-clone.mjs";
4
- import { set as A } from "../../set.mjs";
5
- import { getFunctionArguments as h } from "../helpers.mjs";
6
- import { safeDynamicRequire as k } from "./safeDynamicRequire.mjs";
7
- const v = (e) => `bldr_${e}_sync`, I = "BUILDER_SET_STATE", b = "BUILDER_IVM", w = `
4
+ import { set as k } from "../../set.mjs";
5
+ import { getFunctionArguments as A } from "../helpers.mjs";
6
+ import { safeDynamicRequire as h } from "./safeDynamicRequire.mjs";
7
+ const v = (e) => `bldr_${e}_sync`, b = "BUILDER_SET_STATE", I = "BUILDER_IVM", w = `
8
8
  var refToProxy = (obj) => {
9
9
  if (typeof obj !== 'object' || obj === null) {
10
10
  return obj;
@@ -21,9 +21,9 @@ var refToProxy = (obj) => {
21
21
  return val;
22
22
  },
23
23
  set(target, key, value) {
24
- const v = typeof value === 'object' ? new ${b}.Reference(value) : value;
24
+ const v = typeof value === 'object' ? new ${I}.Reference(value) : value;
25
25
  obj.setSync(key, v);
26
- ${I}(key, value)
26
+ ${b}(key, value)
27
27
  },
28
28
  deleteProperty(target, key) {
29
29
  obj.deleteSync(key);
@@ -34,10 +34,10 @@ var refToProxy = (obj) => {
34
34
  code: e,
35
35
  args: t
36
36
  }) => {
37
- const s = t.map(([o]) => `var ${o} = refToProxy(${v(o)}); `).join("");
37
+ const l = t.map(([o]) => `var ${o} = refToProxy(${v(o)}); `).join("");
38
38
  return `
39
39
  ${w}
40
- ${s}
40
+ ${l}
41
41
  function theFunction() {
42
42
  ${e}
43
43
  }
@@ -54,11 +54,11 @@ if (typeof output === 'object' && output !== null) {
54
54
  let a = null, y = null;
55
55
  const V = (e, t = {}) => {
56
56
  a = e, E(t);
57
- }, O = l === "@builder.io/sdk-react-nextjs" || l === "@builder.io/sdk-react" || l === "@builder.io/sdk-qwik", g = () => {
57
+ }, O = s === "@builder.io/sdk-react-nextjs" || s === "@builder.io/sdk-react" || s === "@builder.io/sdk-qwik" || s === "@builder.io/sdk-vue", g = () => {
58
58
  try {
59
59
  if (a)
60
60
  return a;
61
- const t = k("isolated-vm");
61
+ const t = h("isolated-vm");
62
62
  if (t)
63
63
  return t;
64
64
  } catch (t) {
@@ -68,7 +68,7 @@ const V = (e, t = {}) => {
68
68
 
69
69
  SOLUTION: In a server-only execution path within your application, do one of the following:
70
70
 
71
- ${O ? `- import and call \`initializeNodeRuntime()\` from "${l}/node/init".` : ""}
71
+ ${O ? `- import and call \`initializeNodeRuntime()\` from "${s}/node/init".` : ""}
72
72
  - add the following import: \`await import('isolated-vm')\`.
73
73
 
74
74
  For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;
@@ -78,37 +78,37 @@ function E(e = {
78
78
  memoryLimit: 128
79
79
  }) {
80
80
  const t = g(), o = new t.Isolate(e).createContextSync(), n = o.global;
81
- return n.setSync("global", n.derefInto()), n.setSync("log", function(...i) {
82
- console.log(...i);
83
- }), n.setSync(b, t), y = o, o;
81
+ return n.setSync("global", n.derefInto()), n.setSync("log", function(...c) {
82
+ console.log(...c);
83
+ }), n.setSync(I, t), y = o, o;
84
84
  }
85
85
  const $ = () => y || E(), B = ({
86
86
  code: e,
87
87
  builder: t,
88
- context: s,
88
+ context: l,
89
89
  event: o,
90
90
  localState: n,
91
- rootSetState: i,
91
+ rootSetState: c,
92
92
  rootState: u
93
93
  }) => {
94
94
  const S = g(), _ = R({
95
95
  ...u,
96
96
  ...n
97
- }), f = h({
97
+ }), f = A({
98
98
  builder: t,
99
- context: s,
99
+ context: l,
100
100
  event: o,
101
101
  state: _
102
102
  }), m = $(), p = m.global;
103
- p.setSync(I, function(r, c) {
104
- A(u, r, c), i == null || i(u);
105
- }), f.forEach(([r, c]) => {
106
- const N = typeof c == "object" ? new S.Reference(
103
+ p.setSync(b, function(r, i) {
104
+ k(u, r, i), c == null || c(u);
105
+ }), f.forEach(([r, i]) => {
106
+ const N = typeof i == "object" ? new S.Reference(
107
107
  // workaround: methods with default values for arguments is not being cloned over
108
108
  r === "builder" ? {
109
- ...c,
110
- getUserAttributes: () => c.getUserAttributes()
111
- } : c
109
+ ...i,
110
+ getUserAttributes: () => i.getUserAttributes()
111
+ } : i
112
112
  ) : null;
113
113
  p.setSync(v(r), N);
114
114
  });
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.16.13",
4
+ "version": "0.16.14",
5
5
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
6
6
  "repository": {
7
7
  "type": "git",
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Placeholder component to be overridden by specific SDKs.
4
+ * Allows to dynamically import components.
5
+ */
6
+ type AwaiterProps = {
7
+ load: () => Promise<any>;
8
+ props?: any;
9
+ attributes?: any;
10
+ fallback?: any;
11
+ children?: any;
12
+ };
13
+ declare function Awaiter(props: AwaiterProps): React.JSX.Element;
14
+ export default Awaiter;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.16.13";
1
+ export declare const SDK_VERSION = "0.16.14";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * To be overriden to the correct `Component` type for each framework.
3
+ */
4
+ export type ComponentReference = any;
@@ -3,9 +3,10 @@ import type { ApiVersion } from '../types/api-version.js';
3
3
  import type { BuilderContent } from '../types/builder-content.js';
4
4
  import type { ComponentInfo } from '../types/components.js';
5
5
  import type { Dictionary, Nullable } from '../types/typescript.js';
6
+ import type { ComponentReference } from './component-reference-types.js';
6
7
  import type { ExtraContextTypes } from './extra-context-types.js';
7
8
  export type RegisteredComponent = ComponentInfo & {
8
- component: any;
9
+ component: ComponentReference;
9
10
  };
10
11
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
11
12
  export type BuilderRenderState = Record<string, unknown>;
@@ -1,8 +1,2 @@
1
- import type { BuilderRenderState } from '../../../context/types.js';
2
1
  import type { ExecutorArgs } from '../helpers.js';
3
2
  export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
4
- export declare function flattenState({ rootState, localState, rootSetState }: {
5
- rootState: Record<string | symbol, any>;
6
- localState: Record<string | symbol, any> | undefined;
7
- rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
8
- }): BuilderRenderState;
@@ -23,3 +23,8 @@ export declare const getFunctionArguments: ({ builder, context, event, state }:
23
23
  }) => [string, Event | BuilderRenderState | import("../../context/types.js").BuilderRenderContext | BuilderGlobals][];
24
24
  export declare const getBuilderGlobals: () => BuilderGlobals;
25
25
  export declare const parseCode: (code: string, { isExpression }: Pick<EvaluatorArgs, 'isExpression'>) => string;
26
+ export declare function flattenState({ rootState, localState, rootSetState }: {
27
+ rootState: Record<string | symbol, any>;
28
+ localState: Record<string | symbol, any> | undefined;
29
+ rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
30
+ }): BuilderRenderState;
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Placeholder component to be overridden by specific SDKs.
4
+ * Allows to dynamically import components.
5
+ */
6
+ type AwaiterProps = {
7
+ load: () => Promise<any>;
8
+ props?: any;
9
+ attributes?: any;
10
+ fallback?: any;
11
+ children?: any;
12
+ };
13
+ declare function Awaiter(props: AwaiterProps): React.JSX.Element;
14
+ export default Awaiter;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.16.13";
1
+ export declare const SDK_VERSION = "0.16.14";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * To be overriden to the correct `Component` type for each framework.
3
+ */
4
+ export type ComponentReference = any;
@@ -3,9 +3,10 @@ import type { ApiVersion } from '../types/api-version.js';
3
3
  import type { BuilderContent } from '../types/builder-content.js';
4
4
  import type { ComponentInfo } from '../types/components.js';
5
5
  import type { Dictionary, Nullable } from '../types/typescript.js';
6
+ import type { ComponentReference } from './component-reference-types.js';
6
7
  import type { ExtraContextTypes } from './extra-context-types.js';
7
8
  export type RegisteredComponent = ComponentInfo & {
8
- component: any;
9
+ component: ComponentReference;
9
10
  };
10
11
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
11
12
  export type BuilderRenderState = Record<string, unknown>;
@@ -1,8 +1,2 @@
1
- import type { BuilderRenderState } from '../../../context/types.js';
2
1
  import type { ExecutorArgs } from '../helpers.js';
3
2
  export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
4
- export declare function flattenState({ rootState, localState, rootSetState }: {
5
- rootState: Record<string | symbol, any>;
6
- localState: Record<string | symbol, any> | undefined;
7
- rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
8
- }): BuilderRenderState;
@@ -23,3 +23,8 @@ export declare const getFunctionArguments: ({ builder, context, event, state }:
23
23
  }) => [string, Event | BuilderRenderState | import("../../context/types.js").BuilderRenderContext | BuilderGlobals][];
24
24
  export declare const getBuilderGlobals: () => BuilderGlobals;
25
25
  export declare const parseCode: (code: string, { isExpression }: Pick<EvaluatorArgs, 'isExpression'>) => string;
26
+ export declare function flattenState({ rootState, localState, rootSetState }: {
27
+ rootState: Record<string | symbol, any>;
28
+ localState: Record<string | symbol, any> | undefined;
29
+ rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
30
+ }): BuilderRenderState;