@builder.io/sdk-react-native 2.0.16 → 2.0.22
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/browser/typescript/types/input.d.ts +1 -1
- package/lib/browser/typescript/types/input.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/edge/typescript/types/input.d.ts +1 -1
- package/lib/edge/typescript/types/input.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/lib/node/typescript/types/input.d.ts +1 -1
- package/lib/node/typescript/types/input.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
- package/src/types/input.ts +1 -1
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
import { logger } from "../../../helpers/logger";
|
|
2
|
-
import {
|
|
3
|
-
import { getFunctionArguments } from "../helpers";
|
|
2
|
+
import { flattenState, getFunctionArguments } from "../helpers";
|
|
4
3
|
import Interpreter from "./acorn-interpreter";
|
|
5
|
-
const processCode = code => {
|
|
6
|
-
return code.split('\n').map(line => {
|
|
7
|
-
const trimmed = line.trim();
|
|
8
|
-
|
|
9
|
-
// this async wrapper doesn't work in JS-interpreter, so we drop it.
|
|
10
|
-
if (line.includes('__awaiter')) return undefined;
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
/**
|
|
6
|
+
* https://stackoverflow.com/a/46503625
|
|
7
|
+
*/
|
|
8
|
+
function patchInterpreter() {
|
|
9
|
+
const originalGetProperty = Interpreter.prototype.getProperty;
|
|
10
|
+
const originalSetProperty = Interpreter.prototype.setProperty;
|
|
11
|
+
function newGetProperty(obj, name) {
|
|
12
|
+
if (obj == null || !obj._connected) {
|
|
13
|
+
return originalGetProperty.call(this, obj, name);
|
|
14
|
+
}
|
|
15
|
+
const value = obj._connected[name];
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
return this.nativeToPseudo(value);
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === 'object') {
|
|
20
|
+
// if the value is an object itself, create another connected object
|
|
21
|
+
return this.createConnectedObject(value);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function newSetProperty(obj, name, value, opt_descriptor) {
|
|
26
|
+
if (obj == null || !obj._connected) {
|
|
27
|
+
return originalSetProperty.call(this, obj, name, value, opt_descriptor);
|
|
28
|
+
}
|
|
29
|
+
obj._connected[name] = this.pseudoToNative(value);
|
|
30
|
+
}
|
|
31
|
+
const getKeys = [];
|
|
32
|
+
const setKeys = [];
|
|
33
|
+
for (const key of Object.keys(Interpreter.prototype)) {
|
|
34
|
+
if (Interpreter.prototype[key] === originalGetProperty) {
|
|
35
|
+
getKeys.push(key);
|
|
36
|
+
}
|
|
37
|
+
if (Interpreter.prototype[key] === originalSetProperty) {
|
|
38
|
+
setKeys.push(key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const key of getKeys) {
|
|
42
|
+
Interpreter.prototype[key] = newGetProperty;
|
|
43
|
+
}
|
|
44
|
+
for (const key of setKeys) {
|
|
45
|
+
Interpreter.prototype[key] = newSetProperty;
|
|
46
|
+
}
|
|
47
|
+
Interpreter.prototype.createConnectedObject = function (obj) {
|
|
48
|
+
const connectedObject = this.createObject(this.OBJECT);
|
|
49
|
+
connectedObject._connected = obj;
|
|
50
|
+
return connectedObject;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
patchInterpreter();
|
|
54
|
+
const processCode = code => {
|
|
55
|
+
return code
|
|
56
|
+
// strip async/await polyfill: remove anything before 'function main()'
|
|
57
|
+
.replace(/^.*?function main\(\)/, `
|
|
58
|
+
var __awaiter = function (e, t, n, r) {return r()},
|
|
59
|
+
__generator = function (e, t) { return t() };
|
|
60
|
+
function main()`)
|
|
61
|
+
// replace ?. with .
|
|
62
|
+
.replace(/\?\./g, '.');
|
|
23
63
|
};
|
|
24
64
|
const getJSONValName = val => val + 'JSON';
|
|
25
65
|
export const runInEdge = ({
|
|
@@ -31,10 +71,11 @@ export const runInEdge = ({
|
|
|
31
71
|
rootSetState,
|
|
32
72
|
code
|
|
33
73
|
}) => {
|
|
34
|
-
const state = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
74
|
+
const state = flattenState({
|
|
75
|
+
rootState,
|
|
76
|
+
localState,
|
|
77
|
+
rootSetState
|
|
78
|
+
});
|
|
38
79
|
const properties = getFunctionArguments({
|
|
39
80
|
builder,
|
|
40
81
|
context,
|
|
@@ -47,6 +88,9 @@ export const runInEdge = ({
|
|
|
47
88
|
*/
|
|
48
89
|
const prependedCode = properties.map(([key]) => {
|
|
49
90
|
const jsonValName = getJSONValName(key);
|
|
91
|
+
if (key === 'state') {
|
|
92
|
+
return ``;
|
|
93
|
+
}
|
|
50
94
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
51
95
|
}).join('\n');
|
|
52
96
|
const cleanedCode = processCode(code);
|
|
@@ -62,24 +106,18 @@ function theFunction() {
|
|
|
62
106
|
}
|
|
63
107
|
theFunction();
|
|
64
108
|
`;
|
|
65
|
-
const setRootState = (prop, value) => {
|
|
66
|
-
const newState = set(state, prop, value);
|
|
67
|
-
rootSetState === null || rootSetState === void 0 || rootSetState(newState);
|
|
68
|
-
};
|
|
69
109
|
const initFunc = function (interpreter, globalObject) {
|
|
70
110
|
/**
|
|
71
111
|
* serialize all function args to JSON strings
|
|
72
112
|
*/
|
|
73
113
|
properties.forEach(([key, val]) => {
|
|
74
|
-
|
|
75
|
-
|
|
114
|
+
if (key === 'state') {
|
|
115
|
+
interpreter.setProperty(globalObject, key, interpreter.createConnectedObject(val), interpreter.READONLY_DESCRIPTOR);
|
|
116
|
+
} else {
|
|
117
|
+
const jsonVal = JSON.stringify(val);
|
|
118
|
+
interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
|
|
119
|
+
}
|
|
76
120
|
});
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Add a JavaScript function "setRootState" to the interpreter's global object, that will be called whenever a
|
|
80
|
-
* state property is set. This function will update the state object.
|
|
81
|
-
*/
|
|
82
|
-
interpreter.setProperty(globalObject, 'setRootState', interpreter.createNativeFunction(setRootState));
|
|
83
121
|
};
|
|
84
122
|
const myInterpreter = new Interpreter(transformed, initFunc);
|
|
85
123
|
myInterpreter.run();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["logger","
|
|
1
|
+
{"version":3,"names":["logger","flattenState","getFunctionArguments","Interpreter","patchInterpreter","originalGetProperty","prototype","getProperty","originalSetProperty","setProperty","newGetProperty","obj","name","_connected","call","value","Array","isArray","nativeToPseudo","createConnectedObject","newSetProperty","opt_descriptor","pseudoToNative","getKeys","setKeys","key","Object","keys","push","connectedObject","createObject","OBJECT","processCode","code","replace","getJSONValName","val","runInEdge","builder","context","event","rootState","localState","rootSetState","state","properties","prependedCode","map","jsonValName","join","cleanedCode","warn","transformed","initFunc","interpreter","globalObject","forEach","READONLY_DESCRIPTOR","jsonVal","JSON","stringify","myInterpreter","run","output"],"sourceRoot":"../../../../../../src","sources":["functions/evaluate/edge-runtime/edge-runtime.ts"],"mappings":"AAAA,SAASA,MAAM;AAEf,SAASC,YAAY,EAAEC,oBAAoB;AAC3C,OAAOC,WAAW;;AAElB;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AAM,GAAGF,aAAa,CAACvC,cAAc,CAACuC,aAAa,CAAC9C,KAAK,CAAC;EAChE,OAAOgD,MAAM;AACf,CAAC"}
|
|
@@ -33,4 +33,37 @@ export const parseCode = (code, {
|
|
|
33
33
|
const useCode = useReturn ? `return (${code});` : code;
|
|
34
34
|
return useCode;
|
|
35
35
|
};
|
|
36
|
+
export function flattenState({
|
|
37
|
+
rootState,
|
|
38
|
+
localState,
|
|
39
|
+
rootSetState
|
|
40
|
+
}) {
|
|
41
|
+
return new Proxy(rootState, {
|
|
42
|
+
get: (target, prop) => {
|
|
43
|
+
if (localState && prop in localState) {
|
|
44
|
+
return localState[prop];
|
|
45
|
+
}
|
|
46
|
+
const val = target[prop];
|
|
47
|
+
if (typeof val === 'object' && val !== null) {
|
|
48
|
+
return flattenState({
|
|
49
|
+
rootState: val,
|
|
50
|
+
localState: undefined,
|
|
51
|
+
rootSetState: rootSetState ? subState => {
|
|
52
|
+
target[prop] = subState;
|
|
53
|
+
rootSetState(target);
|
|
54
|
+
} : undefined
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return val;
|
|
58
|
+
},
|
|
59
|
+
set: (target, prop, value) => {
|
|
60
|
+
if (localState && prop in localState) {
|
|
61
|
+
throw new Error('Writing to local state is not allowed as it is read-only.');
|
|
62
|
+
}
|
|
63
|
+
target[prop] = value;
|
|
64
|
+
rootSetState === null || rootSetState === void 0 || rootSetState(target);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
36
69
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isBrowser","isEditing","getUserAttributes","getFunctionArguments","builder","context","event","state","Object","entries","Builder","getBuilderGlobals","isServer","parseCode","code","isExpression","useReturn","includes","trim","startsWith","useCode"],"sourceRoot":"../../../../../src","sources":["functions/evaluate/helpers.ts"],"mappings":"AACA,SAASA,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,iBAAiB;AAmB1B,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EACnCC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC;AAGF,CAAC,KAAK;EACJ,OAAOC,MAAM,CAACC,OAAO,CAAC;IACpBF,KAAK;IACLG,OAAO,EAAEN,OAAO;IAChB;IACAA,OAAO;IACPC,OAAO;IACPC;EACF,CAAC,CAAC;AACJ,CAAC;AACD,OAAO,MAAMK,iBAAiB,GAAGA,CAAA,MAAuB;EACtDV,SAAS,EAAEA,SAAS,CAAC,CAAC;EACtBD,SAAS,EAAEA,SAAS,CAAC,CAAC;EACtBY,QAAQ,EAAE,CAACZ,SAAS,CAAC,CAAC;EACtBE,iBAAiB,EAAEA,CAAA,KAAMA,iBAAiB,CAAC;AAC7C,CAAC,CAAC;AACF,OAAO,MAAMW,SAAS,GAAGA,CAACC,IAAY,EAAE;EACtCC,YAAY,GAAG;AACoB,CAAC,KAAK;EACzC;EACA;EACA,MAAMC,SAAS;EACf;EACAD,YAAY,IAAI,EAAED,IAAI,CAACG,QAAQ,CAAC,GAAG,CAAC,IAAIH,IAAI,CAACG,QAAQ,CAAC,UAAU,CAAC,IAAIH,IAAI,CAACI,IAAI,CAAC,CAAC,CAACC,UAAU,CAAC,SAAS,CAAC,CAAC;EACvG,MAAMC,OAAO,GAAGJ,SAAS,GAAI,WAAUF,IAAK,IAAG,GAAGA,IAAI;EACtD,OAAOM,OAAO;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"names":["isBrowser","isEditing","getUserAttributes","getFunctionArguments","builder","context","event","state","Object","entries","Builder","getBuilderGlobals","isServer","parseCode","code","isExpression","useReturn","includes","trim","startsWith","useCode","flattenState","rootState","localState","rootSetState","Proxy","get","target","prop","val","undefined","subState","set","value","Error"],"sourceRoot":"../../../../../src","sources":["functions/evaluate/helpers.ts"],"mappings":"AACA,SAASA,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,iBAAiB;AAmB1B,OAAO,MAAMC,oBAAoB,GA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AK,IAAI,EAAE;QAC3C,OAAOR,YAAY,CAAC;UAClBC,SAAS,EAAEO,GAAG;UACdN,UAAU,EAAEO,SAAS;UACrBN,YAAY,EAAEA,YAAY,GAAGO,QAAQ,IAAI;YACvCJ,MAAM,CAACC,IAAI,CAAC,GAAGG,QAAQ;YACvBP,YAAY,CAACG,MAAM,CAAC;UACtB,CAAC,GAAGG;QACN,CAAC,CAAC;MACJ;MACA,OAAOD,GAAG;IACZ,CAAC;IACDG,GAAG,EAAEA,CAACL,MAAM,EAAEC,IAAI,EAAEK,KAAK,KAAK;MAC5B,IAAIV,UAAU,IAAIK,IAAI,IAAIL,UAAU,EAAE;QACpC,MAAM,IAAIW,KAAK,CAAC,2DAA2D,CAAC;MAC9E;MACAP,MAAM,CAACC,IAAI,CAAC,GAAGK,KAAK;MACpBT,YAAY,aAAZA,YAAY,eAAZA,YAAY,CAAGG,MAAM,CAAC;MACtB,OAAO,IAAI;IACb;EACF,CAAC,CAAC;AACJ"}
|
|
@@ -74,7 +74,7 @@ export const setIvm = (ivm, options = {}) => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
// only mention the script for SDKs that have it.
|
|
77
|
-
const SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === '@builder.io/sdk-react-nextjs' || SDK_NAME === '@builder.io/sdk-react' || SDK_NAME === '@builder.io/sdk-qwik';
|
|
77
|
+
const SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === '@builder.io/sdk-react-nextjs' || SDK_NAME === '@builder.io/sdk-react' || SDK_NAME === '@builder.io/sdk-qwik' || SDK_NAME === '@builder.io/sdk-vue';
|
|
78
78
|
const getIvm = () => {
|
|
79
79
|
try {
|
|
80
80
|
if (IVM_INSTANCE) return IVM_INSTANCE;
|
|
@@ -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;AAC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 @@
|
|
|
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.22";
|
|
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,S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AAG,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,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;CAC7C,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC,GAAG;IAClH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAo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AAkB;kHAU1B,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAO,cAKnC,CAAC;AACH,eAAO,MAAM,SAAS,SAAU,MAAM,oBAEnC,KAAK,aAAa,EAAE,cAAc,CAAC,WAQrC,CAAC;AACF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,UAAU,EACV,YAAY,EACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IACrD,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACrE,GAAG,kBAAkB,CA4BrB"}
|
|
@@ -117,7 +117,7 @@ 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
|
}
|
|
123
123
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/types/input.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc;IACd,SAAS,CAAC,EAAE,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,cAAc;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.22",
|
|
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]);
|