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

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 (63) hide show
  1. package/lib/browser/blocks/text/text.cjs +1 -1
  2. package/lib/browser/blocks/text/text.mjs +7 -8
  3. package/lib/browser/components/block/block.helpers.cjs +1 -1
  4. package/lib/browser/components/block/block.helpers.mjs +11 -12
  5. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  6. package/lib/browser/components/content/components/enable-editor.mjs +9 -10
  7. package/lib/browser/components/content/content.cjs +1 -1
  8. package/lib/browser/components/content/content.mjs +9 -13
  9. package/lib/browser/constants/sdk-version.cjs +1 -1
  10. package/lib/browser/constants/sdk-version.mjs +1 -1
  11. package/lib/browser/functions/evaluate/evaluate.cjs +1 -1
  12. package/lib/browser/functions/evaluate/evaluate.mjs +37 -59
  13. package/lib/browser/functions/get-block-actions-handler.cjs +1 -1
  14. package/lib/browser/functions/get-block-actions-handler.mjs +3 -4
  15. package/lib/browser/functions/get-processed-block.cjs +1 -1
  16. package/lib/browser/functions/get-processed-block.mjs +6 -7
  17. package/lib/browser/functions/get.cjs +1 -0
  18. package/lib/browser/functions/get.mjs +7 -0
  19. package/lib/edge/blocks/text/text.cjs +1 -1
  20. package/lib/edge/blocks/text/text.mjs +7 -8
  21. package/lib/edge/components/block/block.helpers.cjs +1 -1
  22. package/lib/edge/components/block/block.helpers.mjs +11 -12
  23. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  24. package/lib/edge/components/content/components/enable-editor.mjs +9 -10
  25. package/lib/edge/components/content/content.cjs +1 -1
  26. package/lib/edge/components/content/content.mjs +9 -13
  27. package/lib/edge/constants/sdk-version.cjs +1 -1
  28. package/lib/edge/constants/sdk-version.mjs +1 -1
  29. package/lib/edge/functions/evaluate/evaluate.cjs +1 -1
  30. package/lib/edge/functions/evaluate/evaluate.mjs +37 -59
  31. package/lib/edge/functions/get-block-actions-handler.cjs +1 -1
  32. package/lib/edge/functions/get-block-actions-handler.mjs +3 -4
  33. package/lib/edge/functions/get-processed-block.cjs +1 -1
  34. package/lib/edge/functions/get-processed-block.mjs +6 -7
  35. package/lib/edge/functions/get.cjs +1 -0
  36. package/lib/edge/functions/get.mjs +7 -0
  37. package/lib/node/blocks/text/text.cjs +1 -1
  38. package/lib/node/blocks/text/text.mjs +7 -8
  39. package/lib/node/components/block/block.helpers.cjs +1 -1
  40. package/lib/node/components/block/block.helpers.mjs +11 -12
  41. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  42. package/lib/node/components/content/components/enable-editor.mjs +9 -10
  43. package/lib/node/components/content/content.cjs +1 -1
  44. package/lib/node/components/content/content.mjs +9 -13
  45. package/lib/node/constants/sdk-version.cjs +1 -1
  46. package/lib/node/constants/sdk-version.mjs +1 -1
  47. package/lib/node/functions/evaluate/evaluate.cjs +1 -1
  48. package/lib/node/functions/evaluate/evaluate.mjs +37 -59
  49. package/lib/node/functions/get-block-actions-handler.cjs +1 -1
  50. package/lib/node/functions/get-block-actions-handler.mjs +3 -4
  51. package/lib/node/functions/get-processed-block.cjs +1 -1
  52. package/lib/node/functions/get-processed-block.mjs +6 -7
  53. package/lib/node/functions/get.cjs +1 -0
  54. package/lib/node/functions/get.mjs +7 -0
  55. package/package.json +1 -1
  56. package/types/cjs/constants/sdk-version.d.ts +1 -1
  57. package/types/cjs/functions/evaluate/evaluate.d.ts +2 -1
  58. package/types/cjs/functions/evaluate/helpers.d.ts +0 -1
  59. package/types/cjs/types/input.d.ts +1 -1
  60. package/types/esm/constants/sdk-version.d.ts +1 -1
  61. package/types/esm/functions/evaluate/evaluate.d.ts +2 -1
  62. package/types/esm/functions/evaluate/helpers.d.ts +0 -1
  63. package/types/esm/types/input.d.ts +1 -1
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime"),f=require("../../constants/builder-registered-components.cjs"),W=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),j=require("../../helpers/logger.cjs"),P=require("../blocks/blocks.cjs"),R=require("../content-variants/helpers.cjs"),V=require("../inlined-script.cjs"),K=require("./components/enable-editor.cjs"),T=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function F(e){var a,r,l,s,u,d,C,g,S,m,k,x,b;const v=R.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),I=[...f.getDefaultRegisteredComponents(),...((l=e.customComponents)==null?void 0:l.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:{component:h,...y.serializeIncludingFunctions(o)}}),{}),n={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...f.getDefaultRegisteredComponents(),...((s=e.customComponents)==null?void 0:s.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""};e.apiKey||j.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const i=(d=(u=n.content)==null?void 0:u.data)==null?void 0:d.jsCode;return i&&W.evaluate({code:i,context:e.context||{},localState:void 0,rootState:n.rootState,rootSetState:t=>{n.rootState=t},isExpression:!1,enableCache:!1}),c.jsxs(K,{nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:n,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?c.jsx(V,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(T,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(C=n.content)==null?void 0:C.id,cssCode:(S=(g=n.content)==null?void 0:g.data)==null?void 0:S.cssCode,customFonts:(k=(m=n.content)==null?void 0:m.data)==null?void 0:k.customFonts}),c.jsx(P,{blocks:(b=(x=n.content)==null?void 0:x.data)==null?void 0:b.blocks,context:n,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=F;
1
+ "use strict";const c=require("react/jsx-runtime"),y=require("../../constants/builder-registered-components.cjs"),W=require("../../functions/evaluate/evaluate.cjs"),f=require("../../functions/register-component.cjs"),j=require("../../helpers/logger.cjs"),P=require("../blocks/blocks.cjs"),R=require("../content-variants/helpers.cjs"),V=require("../inlined-script.cjs"),K=require("./components/enable-editor.cjs"),T=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function F(e){var a,r,l,s,u,d,g,C,S,m,k,x,b;const v=R.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),I=[...y.getDefaultRegisteredComponents(),...((l=e.customComponents)==null?void 0:l.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:{component:h,...f.serializeIncludingFunctions(o)}}),{}),n={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...y.getDefaultRegisteredComponents(),...((s=e.customComponents)==null?void 0:s.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:f.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""};e.apiKey||j.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const i=(d=(u=n.content)==null?void 0:u.data)==null?void 0:d.jsCode;return i&&W.evaluate({code:i,context:e.context||{},localState:void 0,rootState:n.rootState,rootSetState:t=>{n.rootState=t},isExpression:!1}),c.jsxs(K,{nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:n,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?c.jsx(V,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(T,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(g=n.content)==null?void 0:g.id,cssCode:(S=(C=n.content)==null?void 0:C.data)==null?void 0:S.cssCode,customFonts:(k=(m=n.content)==null?void 0:m.data)==null?void 0:k.customFonts}),c.jsx(P,{blocks:(b=(x=n.content)==null?void 0:x.data)==null?void 0:b.blocks,context:n,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=F;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as W, jsx as a } from "react/jsx-runtime";
2
- import { getDefaultRegisteredComponents as b } from "../../constants/builder-registered-components.mjs";
2
+ import { getDefaultRegisteredComponents as I } from "../../constants/builder-registered-components.mjs";
3
3
  import { evaluate as P } from "../../functions/evaluate/evaluate.mjs";
4
- import { serializeIncludingFunctions as h } from "../../functions/register-component.mjs";
4
+ import { serializeIncludingFunctions as b } from "../../functions/register-component.mjs";
5
5
  import { logger as V } from "../../helpers/logger.mjs";
6
6
  import K from "../blocks/blocks.mjs";
7
7
  import { getUpdateVariantVisibilityScript as T } from "../content-variants/helpers.mjs";
@@ -11,20 +11,20 @@ import A from "./components/styles.mjs";
11
11
  import { getContentInitialValue as B, getRootStateInitialValue as E } from "./content.helpers.mjs";
12
12
  function L(t) {
13
13
  var c, r, l, d, u, m, s, f, C, S, k, g, x;
14
- const I = T({
14
+ const h = T({
15
15
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
16
16
  variationId: (c = t.content) == null ? void 0 : c.testVariationId,
17
17
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
18
18
  contentId: (r = t.content) == null ? void 0 : r.id
19
19
  }), v = [
20
- ...b(),
20
+ ...I(),
21
21
  ...((l = t.customComponents) == null ? void 0 : l.filter(({ models: e }) => !(e != null && e.length) || !t.model ? !0 : e.includes(t.model))) || []
22
22
  ].reduce(
23
23
  (e, { component: y, ...o }) => ({
24
24
  ...e,
25
25
  [o.name]: {
26
26
  component: y,
27
- ...h(o)
27
+ ...b(o)
28
28
  }
29
29
  }),
30
30
  {}
@@ -45,12 +45,12 @@ function L(t) {
45
45
  apiKey: t.apiKey,
46
46
  apiVersion: t.apiVersion,
47
47
  componentInfos: [
48
- ...b(),
48
+ ...I(),
49
49
  ...((d = t.customComponents) == null ? void 0 : d.filter(({ models: e }) => !(e != null && e.length) || !t.model ? !0 : e.includes(t.model))) || []
50
50
  ].reduce(
51
51
  (e, { component: y, ...o }) => ({
52
52
  ...e,
53
- [o.name]: h(o)
53
+ [o.name]: b(o)
54
54
  }),
55
55
  {}
56
56
  ),
@@ -71,11 +71,7 @@ function L(t) {
71
71
  rootSetState: (e) => {
72
72
  n.rootState = e;
73
73
  },
74
- isExpression: !1,
75
- /**
76
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
77
- */
78
- enableCache: !1
74
+ isExpression: !1
79
75
  }), /* @__PURE__ */ W(
80
76
  R,
81
77
  {
@@ -98,7 +94,7 @@ function L(t) {
98
94
  j,
99
95
  {
100
96
  id: "builderio-variant-visibility",
101
- scriptStr: I,
97
+ scriptStr: h,
102
98
  nonce: t.nonce || ""
103
99
  }
104
100
  ) : null,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.14";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.16";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.16.14";
1
+ const o = "0.16.16";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var f=(c,e,t)=>e in c?y(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;var n=(c,e,t)=>(f(c,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("../../helpers/logger.cjs"),C=require("./choose-eval.cjs"),l=require("./helpers.cjs"),K=!0,a=class a{static getCacheKey(e){return JSON.stringify({...e,event:e.event?Math.random():void 0})}static getCachedValue(e){return a.cache.get(e)}static setCachedValue(e,t){a.cache.size>20&&a.cache.delete(a.cache.keys().next().value),a.cache.set(e,{value:t})}};n(a,"cacheLimit",20),n(a,"cache",new Map);let s=a;function S({code:c,context:e,localState:t,rootState:h,rootSetState:d,event:g,isExpression:v=!0,enableCache:u}){if(c==="")return;const i={code:l.parseCode(c,{isExpression:v}),builder:l.getBuilderGlobals(),context:e,event:g,rootSetState:d,rootState:h,localState:t};if(u&&!K){const r=s.getCacheKey(i),o=s.getCachedValue(r);if(o)return o.value}try{const r=C.chooseBrowserOrServerEval(i);if(u){const o=s.getCacheKey(i);s.setCachedValue(o,r)}return r}catch(r){V.logger.error("Failed code evaluation: "+r.message,{code:c});return}}exports.evaluate=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../../helpers/logger.cjs"),E=require("../get.cjs"),h=require("./choose-eval.cjs"),l=require("./helpers.cjs"),p=/^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/,d=/(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/,g=e=>{var s,t,r,i,n,a;return((r=(t=(s=p.exec(e.trim()))==null?void 0:s.groups)==null?void 0:t.getPath)==null?void 0:r.slice(1))||((a=(n=(i=d.exec(e.trim()))==null?void 0:i.groups)==null?void 0:n.getPath)==null?void 0:a.slice(1))};function m({code:e,context:s,localState:t,rootState:r,rootSetState:i,event:n,isExpression:a=!0}){if(e.trim()==="")return;const o=g(e.trim());if(o)return E.get({...r,...t},o);const c={code:l.parseCode(e,{isExpression:a}),builder:l.getBuilderGlobals(),context:s,event:n,rootSetState:i,rootState:r,localState:t};try{return h.chooseBrowserOrServerEval(c)}catch(u){v.logger.error("Failed code evaluation: "+u.message,{code:e});return}}exports.evaluate=m;exports.getSimpleExpressionGetPath=g;
@@ -1,71 +1,49 @@
1
- var f = Object.defineProperty;
2
- var m = (c, e, t) => e in c ? f(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
- var n = (c, e, t) => (m(c, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { logger as v } from "../../helpers/logger.mjs";
5
- import { chooseBrowserOrServerEval as y } from "./choose-eval.mjs";
6
- import { parseCode as V, getBuilderGlobals as p } from "./helpers.mjs";
7
- const C = !0, a = class a {
8
- static getCacheKey(e) {
9
- return JSON.stringify({
10
- ...e,
11
- // replace the event with a random number to break cache
12
- // thats because we can't serialize the event object due to circular refs in DOM node refs.
13
- event: e.event ? Math.random() : void 0
14
- });
15
- }
16
- static getCachedValue(e) {
17
- return a.cache.get(e);
18
- }
19
- static setCachedValue(e, t) {
20
- a.cache.size > 20 && a.cache.delete(a.cache.keys().next().value), a.cache.set(e, {
21
- value: t
22
- });
23
- }
1
+ import { logger as l } from "../../helpers/logger.mjs";
2
+ import { get as m } from "../get.mjs";
3
+ import { chooseBrowserOrServerEval as E } from "./choose-eval.mjs";
4
+ import { parseCode as c, getBuilderGlobals as v } from "./helpers.mjs";
5
+ const p = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/, h = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/, _ = (r) => {
6
+ var s, e, t, i, o, a;
7
+ return ((t = (e = (s = p.exec(r.trim())) == null ? void 0 : s.groups) == null ? void 0 : e.getPath) == null ? void 0 : t.slice(1)) || ((a = (o = (i = h.exec(r.trim())) == null ? void 0 : i.groups) == null ? void 0 : o.getPath) == null ? void 0 : a.slice(1));
24
8
  };
25
- n(a, "cacheLimit", 20), n(a, "cache", /* @__PURE__ */ new Map());
26
- let o = a;
27
- function x({
28
- code: c,
29
- context: e,
30
- localState: t,
31
- rootState: h,
32
- rootSetState: l,
33
- event: d,
34
- isExpression: g = !0,
35
- enableCache: u
9
+ function w({
10
+ code: r,
11
+ context: s,
12
+ localState: e,
13
+ rootState: t,
14
+ rootSetState: i,
15
+ event: o,
16
+ isExpression: a = !0
36
17
  }) {
37
- if (c === "")
18
+ if (r.trim() === "")
38
19
  return;
39
- const s = {
40
- code: V(c, {
41
- isExpression: g
20
+ const n = _(r.trim());
21
+ if (n)
22
+ return m({
23
+ ...t,
24
+ ...e
25
+ }, n);
26
+ const g = {
27
+ code: c(r, {
28
+ isExpression: a
42
29
  }),
43
- builder: p(),
44
- context: e,
45
- event: d,
46
- rootSetState: l,
47
- rootState: h,
48
- localState: t
30
+ builder: v(),
31
+ context: s,
32
+ event: o,
33
+ rootSetState: i,
34
+ rootState: t,
35
+ localState: e
49
36
  };
50
- if (u && !C) {
51
- const r = o.getCacheKey(s), i = o.getCachedValue(r);
52
- if (i)
53
- return i.value;
54
- }
55
37
  try {
56
- const r = y(s);
57
- if (u) {
58
- const i = o.getCacheKey(s);
59
- o.setCachedValue(i, r);
60
- }
61
- return r;
62
- } catch (r) {
63
- v.error("Failed code evaluation: " + r.message, {
64
- code: c
38
+ return E(g);
39
+ } catch (u) {
40
+ l.error("Failed code evaluation: " + u.message, {
41
+ code: r
65
42
  });
66
43
  return;
67
44
  }
68
45
  }
69
46
  export {
70
- x as evaluate
47
+ w as evaluate,
48
+ _ as getSimpleExpressionGetPath
71
49
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./evaluate/evaluate.cjs"),o=(t,e)=>a=>r.evaluate({code:t,context:e.context,localState:e.localState,rootState:e.rootState,rootSetState:e.rootSetState,event:a,isExpression:!1,enableCache:!0});exports.createEventHandler=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./evaluate/evaluate.cjs"),o=(t,e)=>a=>r.evaluate({code:t,context:e.context,localState:e.localState,rootState:e.rootState,rootSetState:e.rootSetState,event:a,isExpression:!1});exports.createEventHandler=o;
@@ -1,14 +1,13 @@
1
1
  import { evaluate as o } from "./evaluate/evaluate.mjs";
2
- const c = (e, t) => (a) => o({
2
+ const S = (e, t) => (a) => o({
3
3
  code: e,
4
4
  context: t.context,
5
5
  localState: t.localState,
6
6
  rootState: t.rootState,
7
7
  rootSetState: t.rootSetState,
8
8
  event: a,
9
- isExpression: !1,
10
- enableCache: !0
9
+ isExpression: !1
11
10
  });
12
11
  export {
13
- c as createEventHandler
12
+ S as createEventHandler
14
13
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./fast-clone.cjs"),g=require("./set.cjs"),m=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(n));if(e["@type"]==="@builder.io/sdk:Element")return e;const t={};for(const n in e)n!=="meta"&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}const y=["svelte","vue","angular","qwik","solid"].includes(l.TARGET),C=e=>{if(y){const t=f.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},h=({block:e,context:t,localState:n,rootState:s,rootSetState:c})=>{if(!e.bindings)return e;const i=C(e);for(const r in e.bindings){const a=e.bindings[r],u=p.evaluate({code:a,localState:n,rootState:s,rootSetState:c,context:t,enableCache:!0});g.set(i,r,u)}return i};function q({block:e,context:t,shouldEvaluateBindings:n,localState:s,rootState:c,rootSetState:i}){const r=m.transformBlock(e);return n?h({block:r,localState:s,rootState:c,rootSetState:i,context:t}):r}exports.deepCloneWithConditions=o;exports.getProcessedBlock=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../constants/target.cjs"),l=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./fast-clone.cjs"),g=require("./set.cjs"),m=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(n));if(e["@type"]==="@builder.io/sdk:Element")return e;const t={};for(const n in e)n!=="meta"&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}const y=["svelte","vue","angular","qwik","solid"].includes(d.TARGET),C=e=>{if(y){const t=f.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(l.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},q=({block:e,context:t,localState:n,rootState:s,rootSetState:c})=>{if(!e.bindings)return e;const i=C(e);for(const r in e.bindings){const a=e.bindings[r],u=p.evaluate({code:a,localState:n,rootState:s,rootSetState:c,context:t});g.set(i,r,u)}return i};function v({block:e,context:t,shouldEvaluateBindings:n,localState:s,rootState:c,rootSetState:i}){const r=m.transformBlock(e);return n?q({block:r,localState:s,rootState:c,rootSetState:i,context:t}):r}exports.deepCloneWithConditions=o;exports.getProcessedBlock=v;
@@ -16,8 +16,8 @@ function c(e) {
16
16
  r !== "meta" && Object.prototype.hasOwnProperty.call(e, r) && (t[r] = c(e[r]));
17
17
  return t;
18
18
  }
19
- const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(d), g = (e) => {
20
- if (C) {
19
+ const g = ["svelte", "vue", "angular", "qwik", "solid"].includes(d), C = (e) => {
20
+ if (g) {
21
21
  const t = u(e);
22
22
  return {
23
23
  ...t,
@@ -42,7 +42,7 @@ const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(d), g = (e) =>
42
42
  meta: e.meta
43
43
  };
44
44
  }
45
- }, h = ({
45
+ }, O = ({
46
46
  block: e,
47
47
  context: t,
48
48
  localState: r,
@@ -51,15 +51,14 @@ const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(d), g = (e) =>
51
51
  }) => {
52
52
  if (!e.bindings)
53
53
  return e;
54
- const i = g(e);
54
+ const i = C(e);
55
55
  for (const n in e.bindings) {
56
56
  const p = e.bindings[n], a = m({
57
57
  code: p,
58
58
  localState: r,
59
59
  rootState: o,
60
60
  rootSetState: s,
61
- context: t,
62
- enableCache: !0
61
+ context: t
63
62
  });
64
63
  l(i, n, a);
65
64
  }
@@ -74,7 +73,7 @@ function S({
74
73
  rootSetState: i
75
74
  }) {
76
75
  const n = y(e);
77
- return r ? h({
76
+ return r ? O({
78
77
  block: n,
79
78
  localState: o,
80
79
  rootState: s,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(l,o,i)=>{const e=String.prototype.split.call(o,/[,[\].]+?/).filter(Boolean).reduce((t,n)=>t!=null?t[n]:t,l);return e===void 0||e===l?i:e};exports.get=r;
@@ -0,0 +1,7 @@
1
+ const r = (o, e, n) => {
2
+ const l = String.prototype.split.call(e, /[,[\].]+?/).filter(Boolean).reduce((t, i) => t != null ? t[i] : t, o);
3
+ return l === void 0 || l === o ? n : l;
4
+ };
5
+ export {
6
+ r as get
7
+ };
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.14",
4
+ "version": "0.16.16",
5
5
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.16.14";
1
+ export declare const SDK_VERSION = "0.16.16";
@@ -1,4 +1,5 @@
1
1
  import type { EvaluatorArgs } from './helpers.js';
2
2
  type EvalValue = unknown;
3
- export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression, enableCache }: EvaluatorArgs): EvalValue;
3
+ export declare const getSimpleExpressionGetPath: (code: string) => string;
4
+ export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: EvaluatorArgs): EvalValue;
4
5
  export {};
@@ -3,7 +3,6 @@ import { getUserAttributes } from '../track/helpers.js';
3
3
  export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
4
4
  event?: Event;
5
5
  isExpression?: boolean;
6
- enableCache: boolean;
7
6
  };
8
7
  export type BuilderGlobals = {
9
8
  isEditing: boolean | undefined;
@@ -117,6 +117,6 @@ export interface Input {
117
117
  valueType?: {
118
118
  type?: string;
119
119
  };
120
- onChange?: ((options: Map<string, any>) => void | Promise<void>) | string;
120
+ onChange?: ((options: Map<string, any>, previousOptions?: Map<string, any>) => void | Promise<void>) | string;
121
121
  meta?: Record<string, any>;
122
122
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.16.14";
1
+ export declare const SDK_VERSION = "0.16.16";
@@ -1,4 +1,5 @@
1
1
  import type { EvaluatorArgs } from './helpers.js';
2
2
  type EvalValue = unknown;
3
- export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression, enableCache }: EvaluatorArgs): EvalValue;
3
+ export declare const getSimpleExpressionGetPath: (code: string) => string;
4
+ export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: EvaluatorArgs): EvalValue;
4
5
  export {};
@@ -3,7 +3,6 @@ import { getUserAttributes } from '../track/helpers.js';
3
3
  export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
4
4
  event?: Event;
5
5
  isExpression?: boolean;
6
- enableCache: boolean;
7
6
  };
8
7
  export type BuilderGlobals = {
9
8
  isEditing: boolean | undefined;
@@ -117,6 +117,6 @@ export interface Input {
117
117
  valueType?: {
118
118
  type?: string;
119
119
  };
120
- onChange?: ((options: Map<string, any>) => void | Promise<void>) | string;
120
+ onChange?: ((options: Map<string, any>, previousOptions?: Map<string, any>) => void | Promise<void>) | string;
121
121
  meta?: Record<string, any>;
122
122
  }