@builder.io/sdk-react-native 2.0.16 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/commonjs/components/awaiter.js +21 -0
- package/lib/browser/commonjs/components/awaiter.js.map +1 -0
- package/lib/browser/commonjs/components/block/components/interactive-element.js +9 -2
- package/lib/browser/commonjs/components/block/components/interactive-element.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/enable-editor.js +17 -45
- package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +37 -5
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/commonjs/context/component-reference-types.js +2 -0
- package/lib/browser/commonjs/context/component-reference-types.js.map +1 -0
- package/lib/browser/commonjs/functions/evaluate/browser-runtime/browser.js +1 -35
- package/lib/browser/commonjs/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +71 -34
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/helpers.js +34 -0
- package/lib/browser/commonjs/functions/evaluate/helpers.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/browser/commonjs/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/browser/module/components/awaiter.js +14 -0
- package/lib/browser/module/components/awaiter.js.map +1 -0
- package/lib/browser/module/components/block/components/interactive-element.js +8 -2
- package/lib/browser/module/components/block/components/interactive-element.js.map +1 -1
- package/lib/browser/module/components/content/components/enable-editor.js +16 -44
- package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/module/components/content/content.js +38 -6
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/module/context/component-reference-types.js +2 -0
- package/lib/browser/module/context/component-reference-types.js.map +1 -0
- package/lib/browser/module/functions/evaluate/browser-runtime/browser.js +1 -34
- package/lib/browser/module/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js +73 -35
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/module/functions/evaluate/helpers.js +33 -0
- package/lib/browser/module/functions/evaluate/helpers.js.map +1 -1
- package/lib/browser/module/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/browser/module/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/browser/typescript/components/awaiter.d.ts +15 -0
- package/lib/browser/typescript/components/awaiter.d.ts.map +1 -0
- package/lib/browser/typescript/components/block/components/interactive-element.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/context/component-reference-types.d.ts +5 -0
- package/lib/browser/typescript/context/component-reference-types.d.ts.map +1 -0
- package/lib/browser/typescript/context/types.d.ts +2 -1
- package/lib/browser/typescript/context/types.d.ts.map +1 -1
- package/lib/browser/typescript/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/lib/browser/typescript/functions/evaluate/browser-runtime/browser.d.ts.map +1 -1
- package/lib/browser/typescript/functions/evaluate/helpers.d.ts +5 -0
- package/lib/browser/typescript/functions/evaluate/helpers.d.ts.map +1 -1
- package/lib/edge/commonjs/components/awaiter.js +21 -0
- package/lib/edge/commonjs/components/awaiter.js.map +1 -0
- package/lib/edge/commonjs/components/block/components/interactive-element.js +9 -2
- package/lib/edge/commonjs/components/block/components/interactive-element.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/enable-editor.js +17 -45
- package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +37 -5
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/commonjs/context/component-reference-types.js +2 -0
- package/lib/edge/commonjs/context/component-reference-types.js.map +1 -0
- package/lib/edge/commonjs/functions/evaluate/browser-runtime/browser.js +1 -35
- package/lib/edge/commonjs/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +71 -34
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/helpers.js +34 -0
- package/lib/edge/commonjs/functions/evaluate/helpers.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/edge/commonjs/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/edge/module/components/awaiter.js +14 -0
- package/lib/edge/module/components/awaiter.js.map +1 -0
- package/lib/edge/module/components/block/components/interactive-element.js +8 -2
- package/lib/edge/module/components/block/components/interactive-element.js.map +1 -1
- package/lib/edge/module/components/content/components/enable-editor.js +16 -44
- package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/module/components/content/content.js +38 -6
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/module/context/component-reference-types.js +2 -0
- package/lib/edge/module/context/component-reference-types.js.map +1 -0
- package/lib/edge/module/functions/evaluate/browser-runtime/browser.js +1 -34
- package/lib/edge/module/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js +73 -35
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/module/functions/evaluate/helpers.js +33 -0
- package/lib/edge/module/functions/evaluate/helpers.js.map +1 -1
- package/lib/edge/module/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/edge/module/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/edge/typescript/components/awaiter.d.ts +15 -0
- package/lib/edge/typescript/components/awaiter.d.ts.map +1 -0
- package/lib/edge/typescript/components/block/components/interactive-element.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/context/component-reference-types.d.ts +5 -0
- package/lib/edge/typescript/context/component-reference-types.d.ts.map +1 -0
- package/lib/edge/typescript/context/types.d.ts +2 -1
- package/lib/edge/typescript/context/types.d.ts.map +1 -1
- package/lib/edge/typescript/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/lib/edge/typescript/functions/evaluate/browser-runtime/browser.d.ts.map +1 -1
- package/lib/edge/typescript/functions/evaluate/helpers.d.ts +5 -0
- package/lib/edge/typescript/functions/evaluate/helpers.d.ts.map +1 -1
- package/lib/node/commonjs/components/awaiter.js +21 -0
- package/lib/node/commonjs/components/awaiter.js.map +1 -0
- package/lib/node/commonjs/components/block/components/interactive-element.js +9 -2
- package/lib/node/commonjs/components/block/components/interactive-element.js.map +1 -1
- package/lib/node/commonjs/components/content/components/enable-editor.js +17 -45
- package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +37 -5
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/commonjs/context/component-reference-types.js +2 -0
- package/lib/node/commonjs/context/component-reference-types.js.map +1 -0
- package/lib/node/commonjs/functions/evaluate/browser-runtime/browser.js +1 -35
- package/lib/node/commonjs/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +71 -34
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/helpers.js +34 -0
- package/lib/node/commonjs/functions/evaluate/helpers.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/node/commonjs/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/node/module/components/awaiter.js +14 -0
- package/lib/node/module/components/awaiter.js.map +1 -0
- package/lib/node/module/components/block/components/interactive-element.js +8 -2
- package/lib/node/module/components/block/components/interactive-element.js.map +1 -1
- package/lib/node/module/components/content/components/enable-editor.js +16 -44
- package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/module/components/content/content.js +38 -6
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/module/context/component-reference-types.js +2 -0
- package/lib/node/module/context/component-reference-types.js.map +1 -0
- package/lib/node/module/functions/evaluate/browser-runtime/browser.js +1 -34
- package/lib/node/module/functions/evaluate/browser-runtime/browser.js.map +1 -1
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js +73 -35
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/module/functions/evaluate/helpers.js +33 -0
- package/lib/node/module/functions/evaluate/helpers.js.map +1 -1
- package/lib/node/module/functions/evaluate/node-runtime/node-runtime.js +1 -1
- package/lib/node/module/functions/evaluate/node-runtime/node-runtime.js.map +1 -1
- package/lib/node/typescript/components/awaiter.d.ts +15 -0
- package/lib/node/typescript/components/awaiter.d.ts.map +1 -0
- package/lib/node/typescript/components/block/components/interactive-element.d.ts.map +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/context/component-reference-types.d.ts +5 -0
- package/lib/node/typescript/context/component-reference-types.d.ts.map +1 -0
- package/lib/node/typescript/context/types.d.ts +2 -1
- package/lib/node/typescript/context/types.d.ts.map +1 -1
- package/lib/node/typescript/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/lib/node/typescript/functions/evaluate/browser-runtime/browser.d.ts.map +1 -1
- package/lib/node/typescript/functions/evaluate/helpers.d.ts +5 -0
- package/lib/node/typescript/functions/evaluate/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/awaiter.tsx +36 -0
- package/src/components/block/components/interactive-element.tsx +19 -3
- package/src/components/content/components/enable-editor.tsx +7 -36
- package/src/components/content/content.tsx +71 -36
- package/src/constants/sdk-version.ts +1 -1
- package/src/context/component-reference-types.ts +4 -0
- package/src/context/types.ts +2 -1
- package/src/functions/evaluate/browser-runtime/browser.ts +1 -39
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +73 -35
- package/src/functions/evaluate/helpers.ts +37 -0
- package/src/functions/evaluate/node-runtime/node-runtime.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SDK_NAME","MSG_PREFIX","logger","fastClone","set","getFunctionArguments","safeDynamicRequire","getSyncValName","key","BUILDER_SET_STATE_NAME","INJECTED_IVM_GLOBAL","REF_TO_PROXY_FN","processCode","code","args","fnArgs","map","name","join","IVM_INSTANCE","IVM_CONTEXT","setIvm","ivm","options","setIsolateContext","SHOULD_MENTION_INITIALIZE_SCRIPT","getIvm","dynRequiredIvm","error","ERROR_MESSAGE","Error","memoryLimit","isolate","Isolate","context","createContextSync","jail","global","setSync","derefInto","logArgs","console","log","getIsolateContext","runInNode","builder","event","localState","rootSetState","rootState","state","isolateContext","value","forEach","arg","val","Reference","getUserAttributes","evalStr","resultStr","evalClosureSync","res","JSON","parse","_error"],"sourceRoot":"../../../../../../src","sources":["functions/evaluate/node-runtime/node-runtime.ts"],"mappings":"AACA,SAASA,QAAQ;AACjB,SAASC,UAAU,EAAEC,MAAM;AAC3B,SAASC,SAAS;AAClB,SAASC,GAAG;AAEZ,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,MAAMC,cAAc,GAAIC,GAAW,IAAM,QAAOA,GAAI,OAAM;AAC1D,MAAMC,sBAAsB,GAAG,mBAAmB;AAClD,MAAMC,mBAAmB,GAAG,aAAa;;AAEzC;AACA;AACA,MAAMC,eAAe,GAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoDD,mBAAoB;AACxE;AACA,UAAUD,sBAAuB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,MAAMG,WAAW,GAAGA,CAAC;EACnBC,IAAI;EACJC;AAIF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGD,IAAI,CAACE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,KAAM,OAAMA,IAAK,iBAAgBV,cAAc,CAACU,IAAI,CAAE,KAAI,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;;EAEnG;EACA,OAAQ;AACV,EAAEP,eAAgB;AAClB,EAAEI,MAAO;AACT;AACA,IAAIF,IAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAED,IAAIM,YAAqC,GAAG,IAAI;AAChD,IAAIC,WAA2B,GAAG,IAAI;;AAEtC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CAACC,GAAqB,EAAEC,OAAuB,GAAG,CAAC,CAAC,KAAK;EAC7EJ,YAAY,GAAGG,GAAG;EAClBE,iBAAiB,CAACD,OAAO,CAAC;AAC5B,CAAC;;AAED;AACA,MAAME,gCAAgC,GAAGzB,QAAQ,KAAK,8BAA8B,IAAIA,QAAQ,KAAK,uBAAuB,IAAIA,QAAQ,KAAK,sBAAsB;
|
|
1
|
+
{"version":3,"names":["SDK_NAME","MSG_PREFIX","logger","fastClone","set","getFunctionArguments","safeDynamicRequire","getSyncValName","key","BUILDER_SET_STATE_NAME","INJECTED_IVM_GLOBAL","REF_TO_PROXY_FN","processCode","code","args","fnArgs","map","name","join","IVM_INSTANCE","IVM_CONTEXT","setIvm","ivm","options","setIsolateContext","SHOULD_MENTION_INITIALIZE_SCRIPT","getIvm","dynRequiredIvm","error","ERROR_MESSAGE","Error","memoryLimit","isolate","Isolate","context","createContextSync","jail","global","setSync","derefInto","logArgs","console","log","getIsolateContext","runInNode","builder","event","localState","rootSetState","rootState","state","isolateContext","value","forEach","arg","val","Reference","getUserAttributes","evalStr","resultStr","evalClosureSync","res","JSON","parse","_error"],"sourceRoot":"../../../../../../src","sources":["functions/evaluate/node-runtime/node-runtime.ts"],"mappings":"AACA,SAASA,QAAQ;AACjB,SAASC,UAAU,EAAEC,MAAM;AAC3B,SAASC,SAAS;AAClB,SAASC,GAAG;AAEZ,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,MAAMC,cAAc,GAAIC,GAAW,IAAM,QAAOA,GAAI,OAAM;AAC1D,MAAMC,sBAAsB,GAAG,mBAAmB;AAClD,MAAMC,mBAAmB,GAAG,aAAa;;AAEzC;AACA;AACA,MAAMC,eAAe,GAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoDD,mBAAoB;AACxE;AACA,UAAUD,sBAAuB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,MAAMG,WAAW,GAAGA,CAAC;EACnBC,IAAI;EACJC;AAIF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGD,IAAI,CAACE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,KAAM,OAAMA,IAAK,iBAAgBV,cAAc,CAACU,IAAI,CAAE,KAAI,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;;EAEnG;EACA,OAAQ;AACV,EAAEP,eAAgB;AAClB,EAAEI,MAAO;AACT;AACA,IAAIF,IAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAED,IAAIM,YAAqC,GAAG,IAA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,MAAMC,GAAG,GAAG,OAAOD,GAAG,KAAK,QAAQ,GAAG,IAAIhC,GAAG,CAACkC,SAAS;IACvD;IACAhD,GAAG,KAAK,SAAS,GAAG;MAClB,GAAG8C,GAAG;MACNG,iBAAiB,EAAEA,CAAA,KAAOH,GAAG,CAAoBG,iBAAiB,CAAC;IACrE,CAAC,GAAGH,GAAG,CAAC,GAAG,IAAI;IACflB,IAAI,CAACE,OAAO,CAAC/B,cAAc,CAACC,GAAG,CAAC,EAAE+C,GAAG,CAAC;EACxC,CAAC,CAAC;EACF,MAAMG,OAAO,GAAG9C,WAAW,CAAC;IAC1BC,IAAI;IACJC;EACF,CAAC,CAAC;EACF,MAAM6C,SAAS,GAAGR,cAAc,CAACS,eAAe,CAACF,OAAO,CAAC;EACzD,IAAI;IACF;IACA,MAAMG,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACJ,SAAS,CAAC;IACjC,OAAOE,GAAG;EACZ,CAAC,CAAC,OAAOG,MAAW,EAAE;IACpB,OAAOL,SAAS;EAClB;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
15
|
+
//# sourceMappingURL=awaiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awaiter.d.ts","sourceRoot":"","sources":["../../../../src/components/awaiter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B;;;GAGG;AAEH,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAInC;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-element.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/components/interactive-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AACF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"interactive-element.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/components/interactive-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AACF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,iBAAS,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,qBAuCzD;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,gBAAgB,GAChB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,gBAAgB,GAChB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAsBtE,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,kBAAkB,CAAC;AAG1B,iBAAS,YAAY,CAAC,KAAK,EAAE,kBAAkB,qBAgY9C;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,qBAiK5C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.21";
|
|
2
2
|
//# sourceMappingURL=sdk-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-reference-types.d.ts","sourceRoot":"","sources":["../../../../src/context/component-reference-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAA"}
|
|
@@ -3,9 +3,10 @@ import type { ApiVersion } from '../types/api-version';
|
|
|
3
3
|
import type { BuilderContent } from '../types/builder-content';
|
|
4
4
|
import type { ComponentInfo } from '../types/components';
|
|
5
5
|
import type { Dictionary, Nullable } from '../types/typescript';
|
|
6
|
+
import type { ComponentReference } from './component-reference-types';
|
|
6
7
|
import type { ExtraContextTypes } from './extra-context-types';
|
|
7
8
|
export type RegisteredComponent = ComponentInfo & {
|
|
8
|
-
component:
|
|
9
|
+
component: ComponentReference;
|
|
9
10
|
};
|
|
10
11
|
export type RegisteredComponents = Dictionary<RegisteredComponent>;
|
|
11
12
|
export type BuilderRenderState = Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3D,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,oBAAoB,CAAC,EAAE,iBAAiB;IAClI,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClC,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;OAIG;IACH,SAAS,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE;;;;OAIG;IACH,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAE1C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type { BuilderRenderState } from '../../../context/types';
|
|
2
1
|
import type { ExecutorArgs } from '../helpers';
|
|
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;
|
|
9
3
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../src/functions/evaluate/browser-runtime/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../../src/functions/evaluate/browser-runtime/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,YAAY,2EAQtB,YAAY,QAYd,CAAA"}
|
|
@@ -23,4 +23,9 @@ export declare const getFunctionArguments: ({ builder, context, event, state }:
|
|
|
23
23
|
}) => [string, Event | BuilderRenderState | import("../../context/types").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;
|
|
26
31
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/functions/evaluate/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG;IACpE,KA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
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.21",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/react-native",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
FlatList,
|
|
4
|
+
ScrollView,
|
|
5
|
+
View,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Image,
|
|
8
|
+
Text,
|
|
9
|
+
Pressable,
|
|
10
|
+
TextInput,
|
|
11
|
+
TouchableOpacity,
|
|
12
|
+
Button,
|
|
13
|
+
Linking,
|
|
14
|
+
} from "react-native";
|
|
15
|
+
import { useEffect } from "react";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Placeholder component to be overridden by specific SDKs.
|
|
19
|
+
* Allows to dynamically import components.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
type AwaiterProps = {
|
|
23
|
+
load: () => Promise<any>;
|
|
24
|
+
props?: any;
|
|
25
|
+
attributes?: any;
|
|
26
|
+
fallback?: any;
|
|
27
|
+
children?: any;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function Awaiter(props: AwaiterProps) {
|
|
31
|
+
useEffect(() => {}, []);
|
|
32
|
+
|
|
33
|
+
return <>{props.children}</>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default Awaiter;
|
|
@@ -26,6 +26,7 @@ import { getBlockActions } from "../../../functions/get-block-actions";
|
|
|
26
26
|
import { getBlockProperties } from "../../../functions/get-block-properties";
|
|
27
27
|
import type { BuilderBlock } from "../../../types/builder-block";
|
|
28
28
|
import type { Dictionary } from "../../../types/typescript";
|
|
29
|
+
import Awaiter from "../../awaiter";
|
|
29
30
|
|
|
30
31
|
function InteractiveElement(props: InteractiveElementProps) {
|
|
31
32
|
function attributes() {
|
|
@@ -47,9 +48,24 @@ function InteractiveElement(props: InteractiveElementProps) {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
|
|
51
|
-
{props.
|
|
52
|
-
|
|
51
|
+
<>
|
|
52
|
+
{props.Wrapper.load ? (
|
|
53
|
+
<>
|
|
54
|
+
<Awaiter
|
|
55
|
+
load={props.Wrapper.load}
|
|
56
|
+
fallback={props.Wrapper.fallback}
|
|
57
|
+
props={props.wrapperProps}
|
|
58
|
+
attributes={attributes()}
|
|
59
|
+
>
|
|
60
|
+
{props.children}
|
|
61
|
+
</Awaiter>
|
|
62
|
+
</>
|
|
63
|
+
) : (
|
|
64
|
+
<props.Wrapper {...props.wrapperProps} attributes={attributes()}>
|
|
65
|
+
{props.children}
|
|
66
|
+
</props.Wrapper>
|
|
67
|
+
)}
|
|
68
|
+
</>
|
|
53
69
|
);
|
|
54
70
|
}
|
|
55
71
|
|
|
@@ -33,7 +33,6 @@ import type { BuilderContextInterface } from "../../../context/types";
|
|
|
33
33
|
import { evaluate } from "../../../functions/evaluate/index";
|
|
34
34
|
import { fastClone } from "../../../functions/fast-clone";
|
|
35
35
|
import { fetchOneEntry } from "../../../functions/get-content/index";
|
|
36
|
-
import { fetch } from "../../../functions/get-fetch";
|
|
37
36
|
import { isBrowser } from "../../../functions/is-browser";
|
|
38
37
|
import { isEditing } from "../../../functions/is-editing";
|
|
39
38
|
import { isPreviewing } from "../../../functions/is-previewing";
|
|
@@ -41,7 +40,6 @@ import { createRegisterComponentMessage } from "../../../functions/register-comp
|
|
|
41
40
|
import { _track } from "../../../functions/track/index";
|
|
42
41
|
import { getInteractionPropertiesForEvent } from "../../../functions/track/interaction";
|
|
43
42
|
import { getDefaultCanTrack } from "../../../helpers/canTrack";
|
|
44
|
-
import { logger } from "../../../helpers/logger";
|
|
45
43
|
import { postPreviewContent } from "../../../helpers/preview-lru-cache/set";
|
|
46
44
|
import { createEditorListener } from "../../../helpers/subscribe-to-editor";
|
|
47
45
|
import {
|
|
@@ -142,24 +140,6 @@ function EnableEditor(props: BuilderEditorProps) {
|
|
|
142
140
|
})(event);
|
|
143
141
|
}
|
|
144
142
|
|
|
145
|
-
function evaluateJsCode() {
|
|
146
|
-
// run any dynamic JS code attached to content
|
|
147
|
-
const jsCode = props.builderContextSignal.content?.data?.jsCode;
|
|
148
|
-
if (jsCode) {
|
|
149
|
-
evaluate({
|
|
150
|
-
code: jsCode,
|
|
151
|
-
context: props.context || {},
|
|
152
|
-
localState: undefined,
|
|
153
|
-
rootState: props.builderContextSignal.rootState,
|
|
154
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
155
|
-
/**
|
|
156
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
157
|
-
*/
|
|
158
|
-
enableCache: false,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
143
|
const [httpReqsData, setHttpReqsData] = useState(() => ({}));
|
|
164
144
|
|
|
165
145
|
const [httpReqsPending, setHttpReqsPending] = useState(() => ({}));
|
|
@@ -310,6 +290,13 @@ function EnableEditor(props: BuilderEditorProps) {
|
|
|
310
290
|
}
|
|
311
291
|
}
|
|
312
292
|
|
|
293
|
+
const hasInitialized = useRef(false);
|
|
294
|
+
if (!hasInitialized.current) {
|
|
295
|
+
runHttpRequests();
|
|
296
|
+
emitStateUpdate();
|
|
297
|
+
hasInitialized.current = true;
|
|
298
|
+
}
|
|
299
|
+
|
|
313
300
|
useEffect(() => {
|
|
314
301
|
if (isBrowser()) {
|
|
315
302
|
if (isEditing()) {
|
|
@@ -397,28 +384,12 @@ function EnableEditor(props: BuilderEditorProps) {
|
|
|
397
384
|
}
|
|
398
385
|
}
|
|
399
386
|
}, []);
|
|
400
|
-
useEffect(() => {
|
|
401
|
-
if (!props.apiKey) {
|
|
402
|
-
logger.error(
|
|
403
|
-
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
404
|
-
);
|
|
405
|
-
}
|
|
406
|
-
evaluateJsCode();
|
|
407
|
-
runHttpRequests();
|
|
408
|
-
emitStateUpdate();
|
|
409
|
-
}, []);
|
|
410
387
|
|
|
411
388
|
useEffect(() => {
|
|
412
389
|
if (props.content) {
|
|
413
390
|
mergeNewContent(props.content);
|
|
414
391
|
}
|
|
415
392
|
}, [props.content]);
|
|
416
|
-
useEffect(() => {
|
|
417
|
-
evaluateJsCode();
|
|
418
|
-
}, [props.builderContextSignal.content?.data?.jsCode]);
|
|
419
|
-
useEffect(() => {
|
|
420
|
-
runHttpRequests();
|
|
421
|
-
}, [props.builderContextSignal.content?.data?.httpRequests]);
|
|
422
393
|
useEffect(() => {
|
|
423
394
|
emitStateUpdate();
|
|
424
395
|
}, [props.builderContextSignal.rootState]);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Button,
|
|
13
13
|
Linking,
|
|
14
14
|
} from "react-native";
|
|
15
|
-
import { useState, useContext } from "react";
|
|
15
|
+
import { useState, useContext, useRef } from "react";
|
|
16
16
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components";
|
|
17
17
|
import { TARGET } from "../../constants/target";
|
|
18
18
|
import ComponentsContext from "../../context/components.context";
|
|
@@ -21,7 +21,9 @@ import type {
|
|
|
21
21
|
BuilderRenderState,
|
|
22
22
|
RegisteredComponents,
|
|
23
23
|
} from "../../context/types";
|
|
24
|
+
import { evaluate } from "../../functions/evaluate/evaluate";
|
|
24
25
|
import { serializeIncludingFunctions } from "../../functions/register-component";
|
|
26
|
+
import { logger } from "../../helpers/logger";
|
|
25
27
|
import type { ComponentInfo } from "../../types/components";
|
|
26
28
|
import type { Dictionary } from "../../types/typescript";
|
|
27
29
|
import Blocks from "../blocks/blocks";
|
|
@@ -74,42 +76,75 @@ function ContentComponent(props: ContentProps) {
|
|
|
74
76
|
)
|
|
75
77
|
);
|
|
76
78
|
|
|
77
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
content:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
localState: undefined,
|
|
84
|
-
rootState: getRootStateInitialValue({
|
|
85
|
-
content: props.content,
|
|
86
|
-
data: props.data,
|
|
87
|
-
locale: props.locale,
|
|
88
|
-
}),
|
|
89
|
-
rootSetState: contentSetState,
|
|
90
|
-
context: props.context || {},
|
|
91
|
-
canTrack: props.canTrack,
|
|
92
|
-
apiKey: props.apiKey,
|
|
93
|
-
apiVersion: props.apiVersion,
|
|
94
|
-
componentInfos: [
|
|
95
|
-
...getDefaultRegisteredComponents(),
|
|
96
|
-
...(props.customComponents?.filter(({ models }) => {
|
|
97
|
-
if (!models?.length) return true;
|
|
98
|
-
if (!props.model) return true;
|
|
99
|
-
return models.includes(props.model);
|
|
100
|
-
}) || []),
|
|
101
|
-
].reduce<Dictionary<ComponentInfo>>(
|
|
102
|
-
(acc, { component: _, ...info }) => ({
|
|
103
|
-
...acc,
|
|
104
|
-
[info.name]: serializeIncludingFunctions(info),
|
|
79
|
+
const [builderContextSignal, setBuilderContextSignal] =
|
|
80
|
+
useState<BuilderContextInterface>(() => ({
|
|
81
|
+
strictStyleMode: props.strictStyleMode,
|
|
82
|
+
content: getContentInitialValue({
|
|
83
|
+
content: props.content,
|
|
84
|
+
data: props.data,
|
|
105
85
|
}),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
86
|
+
localState: undefined,
|
|
87
|
+
rootState: getRootStateInitialValue({
|
|
88
|
+
content: props.content,
|
|
89
|
+
data: props.data,
|
|
90
|
+
locale: props.locale,
|
|
91
|
+
}),
|
|
92
|
+
rootSetState: contentSetState,
|
|
93
|
+
context: props.context || {},
|
|
94
|
+
canTrack: props.canTrack,
|
|
95
|
+
apiKey: props.apiKey,
|
|
96
|
+
apiVersion: props.apiVersion,
|
|
97
|
+
componentInfos: [
|
|
98
|
+
...getDefaultRegisteredComponents(),
|
|
99
|
+
...(props.customComponents?.filter(({ models }) => {
|
|
100
|
+
if (!models?.length) return true;
|
|
101
|
+
if (!props.model) return true;
|
|
102
|
+
return models.includes(props.model);
|
|
103
|
+
}) || []),
|
|
104
|
+
].reduce<Dictionary<ComponentInfo>>(
|
|
105
|
+
(acc, { component: _, ...info }) => ({
|
|
106
|
+
...acc,
|
|
107
|
+
[info.name]: serializeIncludingFunctions(info),
|
|
108
|
+
}),
|
|
109
|
+
{}
|
|
110
|
+
),
|
|
111
|
+
inheritedStyles: {},
|
|
112
|
+
BlocksWrapper: props.blocksWrapper || ScrollView,
|
|
113
|
+
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
114
|
+
nonce: props.nonce || "",
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
const hasInitialized = useRef(false);
|
|
118
|
+
if (!hasInitialized.current) {
|
|
119
|
+
if (!props.apiKey) {
|
|
120
|
+
logger.error(
|
|
121
|
+
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// run any dynamic JS code attached to content
|
|
126
|
+
const jsCode = builderContextSignal.content?.data?.jsCode;
|
|
127
|
+
if (jsCode) {
|
|
128
|
+
evaluate({
|
|
129
|
+
code: jsCode,
|
|
130
|
+
context: props.context || {},
|
|
131
|
+
localState: undefined,
|
|
132
|
+
rootState: builderContextSignal.rootState,
|
|
133
|
+
rootSetState: (newState) => {
|
|
134
|
+
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
135
|
+
...PREVIOUS_VALUE,
|
|
136
|
+
rootState: newState,
|
|
137
|
+
}));
|
|
138
|
+
},
|
|
139
|
+
isExpression: false,
|
|
140
|
+
/**
|
|
141
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
142
|
+
*/
|
|
143
|
+
enableCache: false,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
hasInitialized.current = true;
|
|
147
|
+
}
|
|
113
148
|
|
|
114
149
|
return (
|
|
115
150
|
<ComponentsContext.Provider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.21"
|
package/src/context/types.ts
CHANGED
|
@@ -3,9 +3,10 @@ import type { ApiVersion } from '../types/api-version';
|
|
|
3
3
|
import type { BuilderContent } from '../types/builder-content';
|
|
4
4
|
import type { ComponentInfo } from '../types/components';
|
|
5
5
|
import type { Dictionary, Nullable } from '../types/typescript';
|
|
6
|
+
import type { ComponentReference } from './component-reference-types';
|
|
6
7
|
import type { ExtraContextTypes } from './extra-context-types';
|
|
7
8
|
export type RegisteredComponent = ComponentInfo & {
|
|
8
|
-
component:
|
|
9
|
+
component: ComponentReference;
|
|
9
10
|
};
|
|
10
11
|
export type RegisteredComponents = Dictionary<RegisteredComponent>;
|
|
11
12
|
export type BuilderRenderState = Record<string, unknown>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { BuilderRenderState } from '../../../context/types';
|
|
2
1
|
import type { ExecutorArgs } from '../helpers';
|
|
3
|
-
import { getFunctionArguments } from '../helpers';
|
|
2
|
+
import { flattenState, getFunctionArguments } from '../helpers';
|
|
4
3
|
export const runInBrowser = ({
|
|
5
4
|
code,
|
|
6
5
|
builder,
|
|
@@ -21,41 +20,4 @@ export const runInBrowser = ({
|
|
|
21
20
|
})
|
|
22
21
|
});
|
|
23
22
|
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
24
|
-
};
|
|
25
|
-
export function flattenState({
|
|
26
|
-
rootState,
|
|
27
|
-
localState,
|
|
28
|
-
rootSetState
|
|
29
|
-
}: {
|
|
30
|
-
rootState: Record<string | symbol, any>;
|
|
31
|
-
localState: Record<string | symbol, any> | undefined;
|
|
32
|
-
rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
|
|
33
|
-
}): BuilderRenderState {
|
|
34
|
-
return new Proxy(rootState, {
|
|
35
|
-
get: (target, prop) => {
|
|
36
|
-
if (localState && prop in localState) {
|
|
37
|
-
return localState[prop];
|
|
38
|
-
}
|
|
39
|
-
const val = target[prop];
|
|
40
|
-
if (typeof val === 'object' && val !== null) {
|
|
41
|
-
return flattenState({
|
|
42
|
-
rootState: val,
|
|
43
|
-
localState: undefined,
|
|
44
|
-
rootSetState: rootSetState ? subState => {
|
|
45
|
-
target[prop] = subState;
|
|
46
|
-
rootSetState(target);
|
|
47
|
-
} : undefined
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return val;
|
|
51
|
-
},
|
|
52
|
-
set: (target, prop, value) => {
|
|
53
|
-
if (localState && prop in localState) {
|
|
54
|
-
throw new Error('Writing to local state is not allowed as it is read-only.');
|
|
55
|
-
}
|
|
56
|
-
target[prop] = value;
|
|
57
|
-
rootSetState?.(target);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
23
|
}
|
|
@@ -1,26 +1,66 @@
|
|
|
1
1
|
import { logger } from '../../../helpers/logger';
|
|
2
|
-
import { set } from '../../set';
|
|
3
2
|
import type { ExecutorArgs } from '../helpers';
|
|
4
|
-
import { getFunctionArguments } from '../helpers';
|
|
3
|
+
import { flattenState, getFunctionArguments } from '../helpers';
|
|
5
4
|
import Interpreter from './acorn-interpreter';
|
|
6
|
-
const processCode = (code: string) => {
|
|
7
|
-
return code.split('\n').map(line => {
|
|
8
|
-
const trimmed = line.trim();
|
|
9
|
-
|
|
10
|
-
// this async wrapper doesn't work in JS-interpreter, so we drop it.
|
|
11
|
-
if (line.includes('__awaiter')) return undefined;
|
|
12
5
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
/**
|
|
7
|
+
* https://stackoverflow.com/a/46503625
|
|
8
|
+
*/
|
|
9
|
+
function patchInterpreter() {
|
|
10
|
+
const originalGetProperty = Interpreter.prototype.getProperty;
|
|
11
|
+
const originalSetProperty = Interpreter.prototype.setProperty;
|
|
12
|
+
function newGetProperty(this: typeof Interpreter, obj: any, name: any) {
|
|
13
|
+
if (obj == null || !obj._connected) {
|
|
14
|
+
return originalGetProperty.call(this, obj, name);
|
|
15
|
+
}
|
|
16
|
+
const value = obj._connected[name];
|
|
17
|
+
if (Array.isArray(value)) {
|
|
18
|
+
return this.nativeToPseudo(value);
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'object') {
|
|
21
|
+
// if the value is an object itself, create another connected object
|
|
22
|
+
return this.createConnectedObject(value);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
function newSetProperty(this: typeof Interpreter, obj: any, name: any, value: any, opt_descriptor: any) {
|
|
27
|
+
if (obj == null || !obj._connected) {
|
|
28
|
+
return originalSetProperty.call(this, obj, name, value, opt_descriptor);
|
|
29
|
+
}
|
|
30
|
+
obj._connected[name] = this.pseudoToNative(value);
|
|
31
|
+
}
|
|
32
|
+
const getKeys: string[] = [];
|
|
33
|
+
const setKeys: string[] = [];
|
|
34
|
+
for (const key of Object.keys(Interpreter.prototype)) {
|
|
35
|
+
if (Interpreter.prototype[key] === originalGetProperty) {
|
|
36
|
+
getKeys.push(key);
|
|
37
|
+
}
|
|
38
|
+
if (Interpreter.prototype[key] === originalSetProperty) {
|
|
39
|
+
setKeys.push(key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (const key of getKeys) {
|
|
43
|
+
Interpreter.prototype[key] = newGetProperty;
|
|
44
|
+
}
|
|
45
|
+
for (const key of setKeys) {
|
|
46
|
+
Interpreter.prototype[key] = newSetProperty;
|
|
47
|
+
}
|
|
48
|
+
Interpreter.prototype.createConnectedObject = function (obj: any) {
|
|
49
|
+
const connectedObject = this.createObject(this.OBJECT);
|
|
50
|
+
connectedObject._connected = obj;
|
|
51
|
+
return connectedObject;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
patchInterpreter();
|
|
55
|
+
const processCode = (code: string) => {
|
|
56
|
+
return code
|
|
57
|
+
// strip async/await polyfill: remove anything before 'function main()'
|
|
58
|
+
.replace(/^.*?function main\(\)/, `
|
|
59
|
+
var __awaiter = function (e, t, n, r) {return r()},
|
|
60
|
+
__generator = function (e, t) { return t() };
|
|
61
|
+
function main()`)
|
|
62
|
+
// replace ?. with .
|
|
63
|
+
.replace(/\?\./g, '.');
|
|
24
64
|
};
|
|
25
65
|
const getJSONValName = (val: string) => val + 'JSON';
|
|
26
66
|
export const runInEdge = ({
|
|
@@ -32,10 +72,11 @@ export const runInEdge = ({
|
|
|
32
72
|
rootSetState,
|
|
33
73
|
code
|
|
34
74
|
}: ExecutorArgs) => {
|
|
35
|
-
const state = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
75
|
+
const state = flattenState({
|
|
76
|
+
rootState,
|
|
77
|
+
localState,
|
|
78
|
+
rootSetState
|
|
79
|
+
});
|
|
39
80
|
const properties = getFunctionArguments({
|
|
40
81
|
builder,
|
|
41
82
|
context,
|
|
@@ -48,6 +89,9 @@ export const runInEdge = ({
|
|
|
48
89
|
*/
|
|
49
90
|
const prependedCode = properties.map(([key]) => {
|
|
50
91
|
const jsonValName = getJSONValName(key);
|
|
92
|
+
if (key === 'state') {
|
|
93
|
+
return ``;
|
|
94
|
+
}
|
|
51
95
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
52
96
|
}).join('\n');
|
|
53
97
|
const cleanedCode = processCode(code);
|
|
@@ -63,24 +107,18 @@ function theFunction() {
|
|
|
63
107
|
}
|
|
64
108
|
theFunction();
|
|
65
109
|
`;
|
|
66
|
-
const setRootState = (prop: string, value: any) => {
|
|
67
|
-
const newState = set(state, prop, value);
|
|
68
|
-
rootSetState?.(newState);
|
|
69
|
-
};
|
|
70
110
|
const initFunc = function (interpreter: any, globalObject: any) {
|
|
71
111
|
/**
|
|
72
112
|
* serialize all function args to JSON strings
|
|
73
113
|
*/
|
|
74
114
|
properties.forEach(([key, val]) => {
|
|
75
|
-
|
|
76
|
-
|
|
115
|
+
if (key === 'state') {
|
|
116
|
+
interpreter.setProperty(globalObject, key, interpreter.createConnectedObject(val), interpreter.READONLY_DESCRIPTOR);
|
|
117
|
+
} else {
|
|
118
|
+
const jsonVal = JSON.stringify(val);
|
|
119
|
+
interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
|
|
120
|
+
}
|
|
77
121
|
});
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Add a JavaScript function "setRootState" to the interpreter's global object, that will be called whenever a
|
|
81
|
-
* state property is set. This function will update the state object.
|
|
82
|
-
*/
|
|
83
|
-
interpreter.setProperty(globalObject, 'setRootState', interpreter.createNativeFunction(setRootState));
|
|
84
122
|
};
|
|
85
123
|
const myInterpreter = new Interpreter(transformed, initFunc);
|
|
86
124
|
myInterpreter.run();
|