@builder.io/sdk-react-native 0.5.2 → 0.5.3
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/README.md +4 -0
- package/dist/blocks/button/button.js +2 -2
- package/dist/blocks/columns/columns.js +8 -4
- package/dist/blocks/img/img.js +1 -1
- package/dist/blocks/input/input.js +1 -1
- package/dist/blocks/section/section.js +1 -1
- package/dist/blocks/select/select.js +1 -1
- package/dist/blocks/submit-button/submit-button.js +1 -1
- package/dist/blocks/symbol/symbol.js +4 -2
- package/dist/blocks/textarea/textarea.js +1 -1
- package/dist/components/blocks/blocks-wrapper.js +4 -2
- package/dist/components/content/components/enable-editor.js +5 -4
- package/dist/components/content/content.js +3 -1
- package/dist/components/content-variants/content-variants.js +13 -6
- package/dist/constants/sdk-version.js +2 -1
- package/dist/functions/evaluate/evaluate.js +39 -2
- package/dist/functions/evaluate/interpreter.js +1 -1
- package/package.json +12 -3
- package/src/components/content-variants/content-variants.jsx +13 -8
- package/src/constants/sdk-version.js +2 -1
- package/src/functions/evaluate/evaluate.js +15 -1
- package/src/functions/evaluate/interpreter.js +1 -1
package/README.md
CHANGED
|
@@ -21,3 +21,7 @@ Take a look at [our example repo](/examples/react-native) for how to use this SD
|
|
|
21
21
|
## Fetch
|
|
22
22
|
|
|
23
23
|
This Package uses fetch. See [these docs](https://github.com/BuilderIO/this-package-uses-fetch/blob/main/README.md) for more information.
|
|
24
|
+
|
|
25
|
+
## Non-Node.js Runtimes (Edge, Serverless)
|
|
26
|
+
|
|
27
|
+
If planning to deploy your app to a non-Node.js runtime (like Edge or Serverless functions), make sure to read the [Non-Node.js Runtimes](../../README.md#non-nodejs-runtimes-edge-serverless) section of the main README.
|
|
@@ -33,9 +33,9 @@ const react_native_1 = require("react-native");
|
|
|
33
33
|
const helpers_js_1 = require("../helpers.js");
|
|
34
34
|
function Button(props) {
|
|
35
35
|
return (React.createElement(React.Fragment, null, props.link ? (React.createElement(React.Fragment, null,
|
|
36
|
-
React.createElement(react_native_1.View, { role: "button", ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined },
|
|
36
|
+
React.createElement(react_native_1.View, { role: "button", ...{}, ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined },
|
|
37
37
|
React.createElement(BaseText_1.default, null, props.text)))) : (React.createElement(React.Fragment, null,
|
|
38
|
-
React.createElement(react_native_1.View, { ...props.attributes, style: {
|
|
38
|
+
React.createElement(react_native_1.View, { ...{}, ...props.attributes, style: {
|
|
39
39
|
...styles.view1,
|
|
40
40
|
...props.attributes.style,
|
|
41
41
|
} },
|
|
@@ -131,16 +131,20 @@ function Columns(props) {
|
|
|
131
131
|
return (React.createElement(react_native_1.View, { style: {
|
|
132
132
|
...styles.view1,
|
|
133
133
|
...columnsCssVars(),
|
|
134
|
-
},
|
|
135
|
-
|
|
134
|
+
}, ...{
|
|
135
|
+
dataSet: {
|
|
136
|
+
"builder-block-name": "builder-columns",
|
|
137
|
+
},
|
|
136
138
|
} },
|
|
137
139
|
target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
138
140
|
React.createElement(inlined_styles_1.default, { styles: columnsStyles() }))) : null, (_a = props.columns) === null || _a === void 0 ? void 0 :
|
|
139
141
|
_a.map((column, index) => (React.createElement(react_native_1.View, { style: {
|
|
140
142
|
...styles.view2,
|
|
141
143
|
...columnCssVars(index),
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
+
}, ...{
|
|
145
|
+
dataSet: {
|
|
146
|
+
"builder-block-name": "builder-column",
|
|
147
|
+
},
|
|
144
148
|
}, key: index },
|
|
145
149
|
React.createElement(blocks_1.default, { blocks: column.blocks, path: `component.options.columns.${index}.blocks`, parent: props.builderBlock.id, styleProp: {
|
|
146
150
|
flexGrow: "1",
|
package/dist/blocks/img/img.js
CHANGED
|
@@ -32,6 +32,6 @@ function ImgComponent(props) {
|
|
|
32
32
|
return (React.createElement(react_native_1.View, { style: {
|
|
33
33
|
objectFit: props.backgroundSize || "cover",
|
|
34
34
|
objectPosition: props.backgroundPosition || "center",
|
|
35
|
-
}, key: ((0, is_editing_js_1.isEditing)() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...props.attributes }));
|
|
35
|
+
}, key: ((0, is_editing_js_1.isEditing)() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...{}, ...props.attributes }));
|
|
36
36
|
}
|
|
37
37
|
exports.default = ImgComponent;
|
|
@@ -29,6 +29,6 @@ const react_native_1 = require("react-native");
|
|
|
29
29
|
const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
30
30
|
const helpers_js_1 = require("../helpers.js");
|
|
31
31
|
function FormInputComponent(props) {
|
|
32
|
-
return (React.createElement(react_native_1.View, { ...props.attributes, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
32
|
+
return (React.createElement(react_native_1.View, { ...{}, ...props.attributes, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
33
33
|
}
|
|
34
34
|
exports.default = FormInputComponent;
|
|
@@ -28,7 +28,7 @@ const React = __importStar(require("react"));
|
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
29
|
const helpers_js_1 = require("../helpers.js");
|
|
30
30
|
function SectionComponent(props) {
|
|
31
|
-
return (React.createElement(react_native_1.View, { ...props.attributes, style: {
|
|
31
|
+
return (React.createElement(react_native_1.View, { ...{}, ...props.attributes, style: {
|
|
32
32
|
width: "100%",
|
|
33
33
|
alignSelf: "stretch",
|
|
34
34
|
flexGrow: 1,
|
|
@@ -34,7 +34,7 @@ const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
|
34
34
|
const helpers_js_1 = require("../helpers.js");
|
|
35
35
|
function SelectComponent(props) {
|
|
36
36
|
var _a;
|
|
37
|
-
return (React.createElement(react_native_1.View, { ...props.attributes, value: props.value, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, (_a = props.options) === null || _a === void 0 ? void 0 : _a.map((option) => (React.createElement(react_native_1.View, { value: option.value },
|
|
37
|
+
return (React.createElement(react_native_1.View, { ...{}, ...props.attributes, value: props.value, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, (_a = props.options) === null || _a === void 0 ? void 0 : _a.map((option) => (React.createElement(react_native_1.View, { value: option.value },
|
|
38
38
|
React.createElement(BaseText_1.default, null, option.name || option.value))))));
|
|
39
39
|
}
|
|
40
40
|
exports.default = SelectComponent;
|
|
@@ -32,7 +32,7 @@ const React = __importStar(require("react"));
|
|
|
32
32
|
const react_native_1 = require("react-native");
|
|
33
33
|
const helpers_js_1 = require("../helpers.js");
|
|
34
34
|
function SubmitButton(props) {
|
|
35
|
-
return (React.createElement(react_native_1.View, { type: "submit", ...props.attributes },
|
|
35
|
+
return (React.createElement(react_native_1.View, { type: "submit", ...{}, ...props.attributes },
|
|
36
36
|
React.createElement(BaseText_1.default, null, props.text)));
|
|
37
37
|
}
|
|
38
38
|
exports.default = SubmitButton;
|
|
@@ -67,8 +67,10 @@ function Symbol(props) {
|
|
|
67
67
|
(0, react_1.useEffect)(() => {
|
|
68
68
|
setContent();
|
|
69
69
|
}, [props.symbol]);
|
|
70
|
-
return (React.createElement(react_native_1.View, { ...props.attributes,
|
|
71
|
-
|
|
70
|
+
return (React.createElement(react_native_1.View, { ...{}, ...props.attributes, ...{
|
|
71
|
+
dataSet: {
|
|
72
|
+
class: className(),
|
|
73
|
+
},
|
|
72
74
|
} },
|
|
73
75
|
React.createElement(content_variants_1.default, { __isNestedRender: true, apiVersion: props.builderContext.apiVersion, apiKey: props.builderContext.apiKey, context: props.builderContext.context, customComponents: Object.values(props.builderComponents), data: {
|
|
74
76
|
...(_a = props.symbol) === null || _a === void 0 ? void 0 : _a.data,
|
|
@@ -28,6 +28,6 @@ const React = __importStar(require("react"));
|
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
29
|
const helpers_js_1 = require("../helpers.js");
|
|
30
30
|
function Textarea(props) {
|
|
31
|
-
return (React.createElement(react_native_1.View, { ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
31
|
+
return (React.createElement(react_native_1.View, { ...{}, ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
32
32
|
}
|
|
33
33
|
exports.default = Textarea;
|
|
@@ -56,8 +56,10 @@ function BlocksWrapper(props) {
|
|
|
56
56
|
}, "*");
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return (React.createElement(react_native_1.View, { "builder-path": props.path, "builder-parent-id": props.parent,
|
|
60
|
-
|
|
59
|
+
return (React.createElement(react_native_1.View, { "builder-path": props.path, "builder-parent-id": props.parent, ...{
|
|
60
|
+
dataSet: {
|
|
61
|
+
class: className(),
|
|
62
|
+
},
|
|
61
63
|
}, style: {
|
|
62
64
|
...styles.view1,
|
|
63
65
|
...props.styleProp,
|
|
@@ -296,10 +296,11 @@ function EnableEditor(props) {
|
|
|
296
296
|
};
|
|
297
297
|
}, []);
|
|
298
298
|
return (React.createElement(builder_context_1.default.Provider, { value: props.builderContextSignal }, props.builderContextSignal.content ? (React.createElement(React.Fragment, null,
|
|
299
|
-
React.createElement(react_native_1.View, { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": (_e = props.builderContextSignal.content) === null || _e === void 0 ? void 0 : _e.id, "builder-model": props.model,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
React.createElement(react_native_1.View, { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": (_e = props.builderContextSignal.content) === null || _e === void 0 ? void 0 : _e.id, "builder-model": props.model, ...{
|
|
300
|
+
// currently, we can't set the actual ID here. // we don't need it right now, we just need to identify content divs for testing.
|
|
301
|
+
dataSet: {
|
|
302
|
+
"builder-content-id": "",
|
|
303
|
+
},
|
|
303
304
|
}, ...(props.showContent
|
|
304
305
|
? {}
|
|
305
306
|
: {
|
|
@@ -104,7 +104,9 @@ function ContentComponent(props) {
|
|
|
104
104
|
return (React.createElement(components_context_1.default.Provider, { value: {
|
|
105
105
|
registeredComponents: registeredComponents,
|
|
106
106
|
} },
|
|
107
|
-
React.createElement(enable_editor_1.default, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal,
|
|
107
|
+
React.createElement(enable_editor_1.default, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal, ...{
|
|
108
|
+
setBuilderContextSignal: setBuilderContextSignal,
|
|
109
|
+
} },
|
|
108
110
|
props.isSsrAbTest ? (React.createElement(React.Fragment, null,
|
|
109
111
|
React.createElement(inlined_script_1.default, { scriptStr: scriptStr }))) : null,
|
|
110
112
|
target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
@@ -55,6 +55,18 @@ function ContentVariants(props) {
|
|
|
55
55
|
.map((value) => `.variant-${value.testVariationId} { display: none; } `)
|
|
56
56
|
.join("");
|
|
57
57
|
}
|
|
58
|
+
function defaultContent() {
|
|
59
|
+
var _a;
|
|
60
|
+
return shouldRenderVariants
|
|
61
|
+
? {
|
|
62
|
+
...props.content,
|
|
63
|
+
testVariationId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.id,
|
|
64
|
+
}
|
|
65
|
+
: (0, ab_tests_js_1.handleABTestingSync)({
|
|
66
|
+
item: props.content,
|
|
67
|
+
canTrack: (0, canTrack_js_1.getDefaultCanTrack)(props.canTrack),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
58
70
|
(0, react_1.useEffect)(() => {
|
|
59
71
|
/**
|
|
60
72
|
* We unmount the non-winning variants post-hydration in Vue.
|
|
@@ -67,11 +79,6 @@ function ContentVariants(props) {
|
|
|
67
79
|
React.createElement(inlined_styles_1.default, { id: `variants-styles-${(_a = props.content) === null || _a === void 0 ? void 0 : _a.id}`, styles: hideVariantsStyleString() }),
|
|
68
80
|
React.createElement(inlined_script_1.default, { scriptStr: variantScriptStr() }), (_b = (0, helpers_js_1.getVariants)(props.content)) === null || _b === void 0 ? void 0 :
|
|
69
81
|
_b.map((variant) => (React.createElement(content_1.default, { key: variant.testVariationId, content: variant, showContent: false, classNameProp: undefined, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants }))))) : null,
|
|
70
|
-
React.createElement(content_1.default, { content: shouldRenderVariants
|
|
71
|
-
? props.content
|
|
72
|
-
: (0, ab_tests_js_1.handleABTestingSync)({
|
|
73
|
-
item: props.content,
|
|
74
|
-
canTrack: (0, canTrack_js_1.getDefaultCanTrack)(props.canTrack),
|
|
75
|
-
}), classNameProp: `variant-${(_c = props.content) === null || _c === void 0 ? void 0 : _c.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
|
|
82
|
+
React.createElement(content_1.default, { ...{}, content: defaultContent(), classNameProp: `variant-${(_c = props.content) === null || _c === void 0 ? void 0 : _c.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
|
|
76
83
|
}
|
|
77
84
|
exports.default = ContentVariants;
|
|
@@ -1,11 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.runInNode = exports.runInBrowser = exports.flattenState = exports.evaluate = void 0;
|
|
4
27
|
const logger_js_1 = require("../../helpers/logger.js");
|
|
5
28
|
const is_browser_js_1 = require("../is-browser.js");
|
|
6
29
|
const is_editing_js_1 = require("../is-editing.js");
|
|
7
30
|
const is_non_node_server_js_1 = require("../is-non-node-server.js");
|
|
8
|
-
|
|
31
|
+
let runInNonNode;
|
|
32
|
+
if ((0, is_non_node_server_js_1.isNonNodeServer)()) {
|
|
33
|
+
Promise.resolve().then(() => __importStar(require("./non-node-runtime.js"))).then(m => {
|
|
34
|
+
runInNonNode = m.runInNonNode;
|
|
35
|
+
}).catch(err => {
|
|
36
|
+
const ERROR_MESSAGE = `Error importing JS interpreter for non-Node.js runtimes. Make sure \`js-interpreter\` is installed.
|
|
37
|
+
Read more here: https://github.com/BuilderIO/builder/tree/main/packages/sdks/README.md#non-nodejs-runtimes-edge-serverless
|
|
38
|
+
`;
|
|
39
|
+
logger_js_1.logger.error(ERROR_MESSAGE, err);
|
|
40
|
+
runInNonNode = (..._args) => {
|
|
41
|
+
logger_js_1.logger.error(ERROR_MESSAGE);
|
|
42
|
+
return void 0;
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
9
46
|
function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
|
|
10
47
|
if (code === "") {
|
|
11
48
|
logger_js_1.logger.warn("Skipping evaluation of empty code block.");
|
|
@@ -30,7 +67,7 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
|
|
|
30
67
|
if ((0, is_browser_js_1.isBrowser)())
|
|
31
68
|
return runInBrowser(args);
|
|
32
69
|
if ((0, is_non_node_server_js_1.isNonNodeServer)())
|
|
33
|
-
return
|
|
70
|
+
return runInNonNode(args);
|
|
34
71
|
return runInNode(args);
|
|
35
72
|
}
|
|
36
73
|
exports.evaluate = evaluate;
|
|
@@ -2897,7 +2897,7 @@ Interpreter.prototype["getGlobalScope"] = Interpreter.prototype.getGlobalScope;
|
|
|
2897
2897
|
Interpreter.prototype["getStateStack"] = Interpreter.prototype.getStateStack;
|
|
2898
2898
|
Interpreter.prototype["setStateStack"] = Interpreter.prototype.setStateStack;
|
|
2899
2899
|
Interpreter["VALUE_IN_DESCRIPTOR"] = Interpreter.VALUE_IN_DESCRIPTOR;
|
|
2900
|
-
const acorn_1 = require("acorn");
|
|
2900
|
+
const acorn_1 = require("./acorn");
|
|
2901
2901
|
Interpreter.nativeGlobal.acornParse = acorn_1.parse;
|
|
2902
2902
|
var stdin_default = Interpreter;
|
|
2903
2903
|
exports.default = stdin_default;
|
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": "0.5.
|
|
4
|
+
"version": "0.5.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -23,14 +23,23 @@
|
|
|
23
23
|
"react-native-video": "^5.1.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"react
|
|
26
|
+
"react": "^18.0.0",
|
|
27
|
+
"react-dom": "^18.0.0",
|
|
28
|
+
"react-native": ">=0.64.3",
|
|
27
29
|
"react-native-url-polyfill": "^1.3.0"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@tsconfig/react-native": "^2.0.3",
|
|
31
33
|
"@types/react-native-video": "^5.0.9",
|
|
34
|
+
"nx": "^16.6.0",
|
|
35
|
+
"nx-cloud": "^16.2.0",
|
|
32
36
|
"react-native-url-polyfill": "^1.3.0",
|
|
33
37
|
"rimraf": "^3.0.2",
|
|
34
|
-
"typescript": "^
|
|
38
|
+
"typescript": "^4.9.4"
|
|
39
|
+
},
|
|
40
|
+
"nx": {
|
|
41
|
+
"implicitDependencies": [
|
|
42
|
+
"@builder.io/sdks"
|
|
43
|
+
]
|
|
35
44
|
}
|
|
36
45
|
}
|
|
@@ -46,6 +46,18 @@ function ContentVariants(props) {
|
|
|
46
46
|
.join("");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function defaultContent() {
|
|
50
|
+
return shouldRenderVariants
|
|
51
|
+
? {
|
|
52
|
+
...props.content,
|
|
53
|
+
testVariationId: props.content?.id,
|
|
54
|
+
}
|
|
55
|
+
: handleABTestingSync({
|
|
56
|
+
item: props.content,
|
|
57
|
+
canTrack: getDefaultCanTrack(props.canTrack),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
useEffect(() => {
|
|
50
62
|
/**
|
|
51
63
|
* We unmount the non-winning variants post-hydration in Vue.
|
|
@@ -91,14 +103,7 @@ function ContentVariants(props) {
|
|
|
91
103
|
|
|
92
104
|
<ContentComponent
|
|
93
105
|
{...{}}
|
|
94
|
-
content={
|
|
95
|
-
shouldRenderVariants
|
|
96
|
-
? props.content
|
|
97
|
-
: handleABTestingSync({
|
|
98
|
-
item: props.content,
|
|
99
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
100
|
-
})
|
|
101
|
-
}
|
|
106
|
+
content={defaultContent()}
|
|
102
107
|
classNameProp={`variant-${props.content?.id}`}
|
|
103
108
|
showContent={true}
|
|
104
109
|
model={props.model}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const SDK_VERSION = "UNKNOWN_VERSION";
|
|
2
|
+
export { SDK_VERSION }
|
|
@@ -2,7 +2,21 @@ import { logger } from "../../helpers/logger.js";
|
|
|
2
2
|
import { isBrowser } from "../is-browser.js";
|
|
3
3
|
import { isEditing } from "../is-editing.js";
|
|
4
4
|
import { isNonNodeServer } from "../is-non-node-server.js";
|
|
5
|
-
|
|
5
|
+
let runInNonNode;
|
|
6
|
+
if (isNonNodeServer()) {
|
|
7
|
+
import("./non-node-runtime.js").then(m => {
|
|
8
|
+
runInNonNode = m.runInNonNode;
|
|
9
|
+
}).catch(err => {
|
|
10
|
+
const ERROR_MESSAGE = `Error importing JS interpreter for non-Node.js runtimes. Make sure \`js-interpreter\` is installed.
|
|
11
|
+
Read more here: https://github.com/BuilderIO/builder/tree/main/packages/sdks/README.md#non-nodejs-runtimes-edge-serverless
|
|
12
|
+
`;
|
|
13
|
+
logger.error(ERROR_MESSAGE, err);
|
|
14
|
+
runInNonNode = (..._args) => {
|
|
15
|
+
logger.error(ERROR_MESSAGE);
|
|
16
|
+
return void 0;
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
}
|
|
6
20
|
function evaluate({
|
|
7
21
|
code,
|
|
8
22
|
context,
|
|
@@ -2795,7 +2795,7 @@ Interpreter.prototype["getGlobalScope"] = Interpreter.prototype.getGlobalScope;
|
|
|
2795
2795
|
Interpreter.prototype["getStateStack"] = Interpreter.prototype.getStateStack;
|
|
2796
2796
|
Interpreter.prototype["setStateStack"] = Interpreter.prototype.setStateStack;
|
|
2797
2797
|
Interpreter["VALUE_IN_DESCRIPTOR"] = Interpreter.VALUE_IN_DESCRIPTOR;
|
|
2798
|
-
import { parse } from "acorn";
|
|
2798
|
+
import { parse } from "./acorn";
|
|
2799
2799
|
Interpreter.nativeGlobal.acornParse = parse;
|
|
2800
2800
|
var stdin_default = Interpreter;
|
|
2801
2801
|
export { stdin_default as default }
|