@builder.io/sdk-react-native 0.4.5 → 0.5.1
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/dist/blocks/button/button.js +6 -2
- package/dist/blocks/button/component-info.js +4 -8
- package/dist/blocks/columns/columns.js +17 -21
- package/dist/blocks/columns/component-info.js +27 -48
- package/dist/blocks/custom-code/component-info.js +4 -8
- package/dist/blocks/custom-code/custom-code.js +1 -1
- package/dist/blocks/embed/component-info.js +7 -11
- package/dist/blocks/embed/embed.js +1 -1
- package/dist/blocks/embed/helpers.js +2 -6
- package/dist/blocks/form/component-info.js +33 -69
- package/dist/blocks/form/form.js +2 -203
- package/dist/blocks/fragment/fragment.js +1 -1
- package/dist/blocks/helpers.js +33 -0
- package/dist/blocks/image/component-info.js +21 -47
- package/dist/blocks/image/image.helpers.js +2 -2
- package/dist/blocks/img/component-info.js +2 -4
- package/dist/blocks/img/img.js +2 -1
- package/dist/blocks/input/component-info.js +8 -34
- package/dist/blocks/input/input.js +2 -1
- package/dist/blocks/raw-text/component-info.js +2 -4
- package/dist/blocks/raw-text/raw-text.js +3 -2
- package/dist/blocks/section/component-info.js +5 -10
- package/dist/blocks/section/section.js +2 -1
- package/dist/blocks/select/component-info.js +12 -24
- package/dist/blocks/select/select.js +2 -1
- package/dist/blocks/submit-button/component-info.js +2 -4
- package/dist/blocks/submit-button/submit-button.js +2 -1
- package/dist/blocks/symbol/component-info.js +7 -12
- package/dist/blocks/symbol/symbol.helpers.js +66 -0
- package/dist/blocks/symbol/symbol.js +23 -52
- package/dist/blocks/text/component-info.js +3 -4
- package/dist/blocks/textarea/component-info.js +6 -12
- package/dist/blocks/textarea/textarea.js +2 -1
- package/dist/blocks/video/component-info.js +21 -41
- package/dist/components/block/block.helpers.js +12 -23
- package/dist/components/block/block.js +40 -70
- package/dist/components/block/components/block-styles.js +1 -1
- package/dist/components/block/components/block-wrapper/block-wrapper.js +41 -0
- package/dist/components/block/components/block-wrapper.js +56 -0
- package/dist/components/block/components/component-ref/component-ref.helpers.js +40 -0
- package/dist/components/block/components/component-ref/component-ref.js +63 -0
- package/dist/components/block/components/component-ref.js +81 -0
- package/dist/components/block/components/interactive-element/interactive-element.helpers.js +35 -0
- package/dist/components/block/components/interactive-element/interactive-element.js +36 -0
- package/dist/components/block/components/interactive-element.js +46 -0
- package/dist/components/block/components/repeated-block.js +4 -4
- package/dist/components/blocks/blocks-wrapper.js +5 -2
- package/dist/components/blocks/blocks.js +9 -3
- package/dist/components/content/builder-editing.js +32 -0
- package/dist/components/content/components/enable-editor.js +30 -33
- package/dist/components/content/components/styles.helpers.js +55 -0
- package/dist/components/content/components/styles.js +61 -0
- package/dist/components/content/content.helpers.js +10 -3
- package/dist/components/content/content.js +27 -40
- package/dist/components/content/wrap-component-ref.js +1 -1
- package/dist/components/content-variants/content-variants.js +38 -34
- package/dist/components/content-variants/content-variants.types.js +1 -0
- package/dist/components/content-variants/helpers.js +61 -25
- package/dist/components/inlined-script.js +1 -1
- package/dist/components/inlined-styles.js +1 -1
- package/dist/constants/device-sizes.js +2 -2
- package/dist/constants/sdk-version.js +1 -1
- package/dist/context/builder.context.js +1 -1
- package/dist/context/components.context.js +6 -0
- package/dist/functions/apply-patch-with-mutation.js +75 -0
- package/dist/functions/apply-patch-with-mutation.test.js +55 -0
- package/dist/functions/camel-to-kebab-case.js +1 -1
- package/dist/functions/evaluate/acorn.js +1691 -0
- package/dist/functions/evaluate/evaluate.js +72 -0
- package/dist/functions/evaluate/index.js +5 -0
- package/dist/functions/evaluate/interpreter.js +2903 -0
- package/dist/functions/evaluate/non-node-runtime.js +97 -0
- package/dist/functions/evaluate/types.js +1 -0
- package/dist/functions/evaluate.test.js +12 -6
- package/dist/functions/event-handler-name.js +1 -1
- package/dist/functions/extract-text-styles.js +3 -9
- package/dist/functions/fast-clone.js +1 -1
- package/dist/functions/get-block-actions-handler.js +2 -2
- package/dist/functions/get-block-actions.js +14 -1
- package/dist/functions/get-block-component-options.js +6 -1
- package/dist/functions/get-block-properties.js +21 -8
- package/dist/functions/get-builder-search-params/fn.test.js +3 -3
- package/dist/functions/get-builder-search-params/index.js +4 -4
- package/dist/functions/get-content/generate-content-url.js +12 -5
- package/dist/functions/get-content/generate-content-url.test.js +31 -17
- package/dist/functions/get-content/index.js +36 -12
- package/dist/functions/get-content/processCookies.js +7 -0
- package/dist/functions/get-processed-block.js +8 -3
- package/dist/functions/get-processed-block.test.js +3 -1
- package/dist/functions/get-react-native-block-styles.js +6 -1
- package/dist/functions/is-non-node-server.js +12 -0
- package/dist/functions/on-change.test.js +13 -3
- package/dist/functions/register-component.js +24 -19
- package/dist/functions/sanitize-react-native-block-styles.js +17 -6
- package/dist/functions/set.test.js +9 -3
- package/dist/functions/track/helpers.js +5 -5
- package/dist/functions/track/index.js +29 -18
- package/dist/functions/track/interaction.js +10 -4
- package/dist/functions/transform-block-properties.js +2 -0
- package/dist/helpers/ab-tests.js +35 -14
- package/dist/helpers/canTrack.js +2 -2
- package/dist/helpers/css.js +2 -2
- package/dist/helpers/flatten.js +10 -7
- package/dist/helpers/nullable.js +1 -1
- package/dist/helpers/preview-lru-cache/get.js +11 -0
- package/dist/helpers/preview-lru-cache/helpers.js +13 -0
- package/dist/helpers/preview-lru-cache/init.js +13 -0
- package/dist/helpers/preview-lru-cache/set.js +37 -0
- package/dist/helpers/preview-lru-cache/types.js +1 -0
- package/dist/helpers/sessionId.js +13 -6
- package/dist/helpers/url.js +1 -1
- package/dist/helpers/visitorId.js +4 -1
- package/dist/index-helpers/blocks-exports.js +2 -2
- package/dist/scripts/init-editing.js +61 -46
- package/package.json +2 -2
- package/src/blocks/button/button.jsx +11 -2
- package/src/blocks/button/component-info.js +16 -22
- package/src/blocks/columns/columns.jsx +27 -26
- package/src/blocks/columns/component-info.js +203 -226
- package/src/blocks/custom-code/component-info.js +19 -25
- package/src/blocks/custom-code/custom-code.jsx +1 -1
- package/src/blocks/embed/component-info.js +31 -37
- package/src/blocks/embed/embed.jsx +1 -1
- package/src/blocks/embed/helpers.js +3 -9
- package/src/blocks/form/component-info.js +174 -212
- package/src/blocks/form/form.jsx +3 -247
- package/src/blocks/fragment/component-info.js +1 -3
- package/src/blocks/fragment/fragment.jsx +1 -1
- package/src/blocks/helpers.js +27 -0
- package/src/blocks/image/component-info.js +105 -133
- package/src/blocks/image/image.helpers.js +3 -5
- package/src/blocks/img/component-info.js +8 -12
- package/src/blocks/img/img.jsx +3 -1
- package/src/blocks/input/component-info.js +29 -57
- package/src/blocks/input/input.jsx +3 -1
- package/src/blocks/raw-text/component-info.js +7 -11
- package/src/blocks/raw-text/raw-text.jsx +4 -2
- package/src/blocks/section/component-info.js +24 -31
- package/src/blocks/section/section.jsx +3 -1
- package/src/blocks/select/component-info.js +34 -48
- package/src/blocks/select/select.jsx +3 -1
- package/src/blocks/submit-button/component-info.js +6 -10
- package/src/blocks/submit-button/submit-button.jsx +3 -2
- package/src/blocks/symbol/component-info.js +30 -37
- package/src/blocks/symbol/symbol.helpers.js +60 -0
- package/src/blocks/symbol/symbol.jsx +33 -61
- package/src/blocks/text/component-info.js +10 -13
- package/src/blocks/textarea/component-info.js +22 -30
- package/src/blocks/textarea/textarea.jsx +3 -1
- package/src/blocks/video/component-info.js +74 -96
- package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
- package/src/components/{render-block/render-block.jsx → block/block.jsx} +68 -81
- package/src/components/{render-block → block/components}/block-styles.jsx +18 -17
- package/src/components/block/components/block-wrapper.jsx +58 -0
- package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
- package/src/components/block/components/component-ref/component-ref.jsx +72 -0
- package/src/components/block/components/interactive-element.jsx +37 -0
- package/src/components/{render-block/render-repeated-block.jsx → block/components/repeated-block.jsx} +10 -6
- package/src/components/blocks/blocks-wrapper.jsx +74 -0
- package/src/components/blocks/blocks.jsx +61 -0
- package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +77 -163
- package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
- package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +5 -5
- package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
- package/src/components/content/content.jsx +148 -0
- package/src/components/content/index.js +2 -0
- package/src/components/content/wrap-component-ref.js +2 -0
- package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +20 -23
- package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
- package/src/components/inlined-script.jsx +1 -1
- package/src/components/inlined-styles.jsx +1 -1
- package/src/constants/device-sizes.js +6 -6
- package/src/constants/sdk-version.js +1 -1
- package/src/context/builder.context.js +1 -1
- package/src/context/components.context.js +5 -0
- package/src/functions/apply-patch-with-mutation.js +66 -0
- package/src/functions/camel-to-kebab-case.js +2 -4
- package/src/functions/evaluate/acorn.js +1595 -0
- package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
- package/src/functions/evaluate/index.js +2 -0
- package/src/functions/evaluate/interpreter.js +2801 -0
- package/src/functions/evaluate/non-node-runtime.js +92 -0
- package/src/functions/evaluate/types.js +0 -0
- package/src/functions/event-handler-name.js +2 -4
- package/src/functions/extract-text-styles.js +4 -12
- package/src/functions/fast-clone.js +2 -4
- package/src/functions/get-block-actions-handler.js +3 -5
- package/src/functions/get-block-actions.js +15 -4
- package/src/functions/get-block-component-options.js +11 -12
- package/src/functions/get-block-properties.js +29 -19
- package/src/functions/get-builder-search-params/index.js +5 -10
- package/src/functions/get-content/generate-content-url.js +17 -19
- package/src/functions/get-content/index.js +43 -29
- package/src/functions/get-fetch.js +1 -3
- package/src/functions/get-global-this.js +1 -3
- package/src/functions/get-processed-block.js +12 -13
- package/src/functions/get-react-native-block-styles.js +11 -12
- package/src/functions/if-target.js +1 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -3
- package/src/functions/is-iframe.js +1 -3
- package/src/functions/is-non-node-server.js +9 -0
- package/src/functions/is-previewing.js +1 -3
- package/src/functions/on-change.js +1 -4
- package/src/functions/register-component.js +34 -42
- package/src/functions/register.js +1 -3
- package/src/functions/sanitize-react-native-block-styles.js +22 -17
- package/src/functions/set-editor-settings.js +1 -3
- package/src/functions/set.js +1 -3
- package/src/functions/track/helpers.js +3 -5
- package/src/functions/track/index.js +45 -43
- package/src/functions/track/interaction.js +11 -7
- package/src/functions/transform-block-properties.js +2 -0
- package/src/helpers/ab-tests.js +45 -28
- package/src/helpers/canTrack.js +3 -5
- package/src/helpers/css.js +3 -7
- package/src/helpers/flatten.js +15 -18
- package/src/helpers/localStorage.js +1 -4
- package/src/helpers/logger.js +1 -3
- package/src/helpers/nullable.js +2 -4
- package/src/helpers/preview-lru-cache/get.js +8 -0
- package/src/helpers/preview-lru-cache/helpers.js +10 -0
- package/src/helpers/preview-lru-cache/init.js +10 -0
- package/src/helpers/preview-lru-cache/set.js +35 -0
- package/src/helpers/preview-lru-cache/types.js +0 -0
- package/src/helpers/sessionId.js +14 -11
- package/src/helpers/time.js +1 -3
- package/src/helpers/url.js +2 -4
- package/src/helpers/uuid.js +4 -6
- package/src/helpers/visitorId.js +8 -7
- package/src/index-helpers/blocks-exports.js +1 -1
- package/src/index.js +2 -17
- package/src/scripts/init-editing.js +62 -48
- package/src/types/api-version.js +1 -3
- package/src/types/builder-props.js +0 -0
- package/src/blocks/util.js +0 -8
- package/src/components/render-block/render-component.jsx +0 -55
- package/src/components/render-blocks.jsx +0 -101
- package/src/components/render-content/builder-editing.jsx +0 -16
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/wrap-component-ref.js +0 -4
- package/src/functions/evaluate.test.js +0 -17
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-content/generate-content-url.test.js +0 -97
- package/src/functions/get-processed-block.test.js +0 -34
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/set.test.js +0 -16
- package/src/helpers/url.test.js +0 -21
- /package/src/components/{render-block → block}/types.js +0 -0
- /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
- /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
|
@@ -7,52 +7,40 @@ const componentInfo = {
|
|
|
7
7
|
defaultStyles: {
|
|
8
8
|
alignSelf: "flex-start"
|
|
9
9
|
},
|
|
10
|
-
inputs: [
|
|
11
|
-
{
|
|
10
|
+
inputs: [{
|
|
12
11
|
name: "options",
|
|
13
12
|
type: "list",
|
|
14
13
|
required: true,
|
|
15
|
-
subFields: [
|
|
16
|
-
{
|
|
14
|
+
subFields: [{
|
|
17
15
|
name: "value",
|
|
18
16
|
type: "text",
|
|
19
17
|
required: true
|
|
20
|
-
},
|
|
21
|
-
{
|
|
18
|
+
}, {
|
|
22
19
|
name: "name",
|
|
23
20
|
type: "text"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
defaultValue: [
|
|
27
|
-
{
|
|
21
|
+
}],
|
|
22
|
+
defaultValue: [{
|
|
28
23
|
value: "option 1"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
24
|
+
}, {
|
|
31
25
|
value: "option 2"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
{
|
|
26
|
+
}]
|
|
27
|
+
}, {
|
|
36
28
|
name: "name",
|
|
37
29
|
type: "string",
|
|
38
30
|
required: true,
|
|
39
31
|
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
32
|
+
}, {
|
|
42
33
|
name: "defaultValue",
|
|
43
34
|
type: "string"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
35
|
+
}, {
|
|
46
36
|
name: "value",
|
|
47
37
|
type: "string",
|
|
48
38
|
advanced: true
|
|
49
|
-
},
|
|
50
|
-
{
|
|
39
|
+
}, {
|
|
51
40
|
name: "required",
|
|
52
41
|
type: "boolean",
|
|
53
42
|
defaultValue: false
|
|
54
|
-
}
|
|
55
|
-
],
|
|
43
|
+
}],
|
|
56
44
|
static: true,
|
|
57
45
|
noWrap: true
|
|
58
46
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
'use client';
|
|
3
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
3
|
if (k2 === undefined) k2 = k;
|
|
5
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -28,9 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
27
|
};
|
|
29
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
29
|
const BaseText_1 = __importDefault(require("../BaseText"));
|
|
30
|
+
("use client");
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
32
|
const react_native_1 = require("react-native");
|
|
33
33
|
const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
34
|
+
const helpers_js_1 = require("../helpers.js");
|
|
34
35
|
function SelectComponent(props) {
|
|
35
36
|
var _a;
|
|
36
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 },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
'use client';
|
|
3
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
3
|
if (k2 === undefined) k2 = k;
|
|
5
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -28,8 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
27
|
};
|
|
29
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
29
|
const BaseText_1 = __importDefault(require("../BaseText"));
|
|
30
|
+
("use client");
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
32
|
const react_native_1 = require("react-native");
|
|
33
|
+
const helpers_js_1 = require("../helpers.js");
|
|
33
34
|
function SubmitButton(props) {
|
|
34
35
|
return (React.createElement(react_native_1.View, { type: "submit", ...props.attributes },
|
|
35
36
|
React.createElement(BaseText_1.default, null, props.text)));
|
|
@@ -5,39 +5,34 @@ const componentInfo = {
|
|
|
5
5
|
name: "Symbol",
|
|
6
6
|
noWrap: true,
|
|
7
7
|
static: true,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
isRSC: true,
|
|
9
|
+
inputs: [{
|
|
10
10
|
name: "symbol",
|
|
11
11
|
type: "uiSymbol"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
12
|
+
}, {
|
|
14
13
|
name: "dataOnly",
|
|
15
14
|
helperText: "Make this a data symbol that doesn't display any UI",
|
|
16
15
|
type: "boolean",
|
|
17
16
|
defaultValue: false,
|
|
18
17
|
advanced: true,
|
|
19
18
|
hideFromUI: true
|
|
20
|
-
},
|
|
21
|
-
{
|
|
19
|
+
}, {
|
|
22
20
|
name: "inheritState",
|
|
23
21
|
helperText: "Inherit the parent component state and data",
|
|
24
22
|
type: "boolean",
|
|
25
23
|
defaultValue: false,
|
|
26
24
|
advanced: true
|
|
27
|
-
},
|
|
28
|
-
{
|
|
25
|
+
}, {
|
|
29
26
|
name: "renderToLiquid",
|
|
30
27
|
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
31
28
|
type: "boolean",
|
|
32
29
|
defaultValue: false,
|
|
33
30
|
advanced: true,
|
|
34
31
|
hideFromUI: true
|
|
35
|
-
},
|
|
36
|
-
{
|
|
32
|
+
}, {
|
|
37
33
|
name: "useChildren",
|
|
38
34
|
hideFromUI: true,
|
|
39
35
|
type: "boolean"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
36
|
+
}]
|
|
42
37
|
};
|
|
43
38
|
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchContent = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value
|
|
13
|
+
}) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __async = (__this, __arguments, generator) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
var fulfilled = value => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.next(value));
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var rejected = value => {
|
|
36
|
+
try {
|
|
37
|
+
step(generator.throw(value));
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
44
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const index_js_1 = require("../../functions/get-content/index.js");
|
|
48
|
+
const logger_js_1 = require("../../helpers/logger.js");
|
|
49
|
+
const fetchContent = _0 => __async(void 0, [_0], function* ({ builderContextValue, symbol }) {
|
|
50
|
+
if ((symbol == null ? void 0 : symbol.model) && (builderContextValue == null ? void 0 : builderContextValue.apiKey)) {
|
|
51
|
+
return (0, index_js_1.getContent)(__spreadValues({
|
|
52
|
+
model: symbol.model,
|
|
53
|
+
apiKey: builderContextValue.apiKey,
|
|
54
|
+
apiVersion: builderContextValue.apiVersion
|
|
55
|
+
}, (symbol == null ? void 0 : symbol.entry) && {
|
|
56
|
+
query: {
|
|
57
|
+
id: symbol.entry
|
|
58
|
+
}
|
|
59
|
+
})).catch(err => {
|
|
60
|
+
logger_js_1.logger.error("Could not fetch symbol content: ", err);
|
|
61
|
+
return void 0;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
});
|
|
66
|
+
exports.fetchContent = fetchContent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -30,19 +30,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
32
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const target_1 = require("../../constants/target");
|
|
37
|
-
const logger_1 = require("../../helpers/logger");
|
|
33
|
+
const content_variants_1 = __importDefault(require("../../components/content-variants/content-variants"));
|
|
34
|
+
const helpers_js_1 = require("../helpers.js");
|
|
35
|
+
const symbol_helpers_js_1 = require("./symbol.helpers.js");
|
|
38
36
|
function Symbol(props) {
|
|
39
37
|
var _a, _b, _c;
|
|
40
|
-
|
|
38
|
+
function className() {
|
|
41
39
|
var _a, _b;
|
|
42
40
|
return [
|
|
43
|
-
...
|
|
44
|
-
? Object.keys(props.attributes.class)
|
|
45
|
-
: [props.attributes.class]),
|
|
41
|
+
...[],
|
|
46
42
|
"builder-symbol",
|
|
47
43
|
((_a = props.symbol) === null || _a === void 0 ? void 0 : _a.inline) ? "builder-inline-symbol" : undefined,
|
|
48
44
|
((_b = props.symbol) === null || _b === void 0 ? void 0 : _b.dynamic) || props.dynamic
|
|
@@ -51,57 +47,32 @@ function Symbol(props) {
|
|
|
51
47
|
]
|
|
52
48
|
.filter(Boolean)
|
|
53
49
|
.join(" ");
|
|
54
|
-
}
|
|
50
|
+
}
|
|
55
51
|
const [contentToUse, setContentToUse] = (0, react_1.useState)(() => { var _a; return (_a = props.symbol) === null || _a === void 0 ? void 0 : _a.content; });
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!contentToUse &&
|
|
68
|
-
((_a = props.symbol) === null || _a === void 0 ? void 0 : _a.model) &&
|
|
69
|
-
(
|
|
70
|
-
// This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
71
|
-
builderContext === null || builderContext === void 0 ? void 0 : builderContext.apiKey)) {
|
|
72
|
-
(0, index_js_1.getContent)({
|
|
73
|
-
model: props.symbol.model,
|
|
74
|
-
apiKey: builderContext.apiKey,
|
|
75
|
-
apiVersion: builderContext.apiVersion,
|
|
76
|
-
...(((_b = props.symbol) === null || _b === void 0 ? void 0 : _b.entry) && {
|
|
77
|
-
query: {
|
|
78
|
-
id: props.symbol.entry,
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
|
-
})
|
|
82
|
-
.then((response) => {
|
|
83
|
-
if (response) {
|
|
84
|
-
setContentToUse(response);
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
.catch((err) => {
|
|
88
|
-
logger_1.logger.error("Could not fetch symbol content: ", err);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
52
|
+
function setContent() {
|
|
53
|
+
if (contentToUse)
|
|
54
|
+
return;
|
|
55
|
+
(0, symbol_helpers_js_1.fetchContent)({
|
|
56
|
+
symbol: props.symbol,
|
|
57
|
+
builderContextValue: props.builderContext,
|
|
58
|
+
}).then((newContent) => {
|
|
59
|
+
if (newContent) {
|
|
60
|
+
setContentToUse(newContent);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
91
63
|
}
|
|
92
|
-
const builderContext = (0, react_1.useContext)(builder_context_js_1.default);
|
|
93
64
|
(0, react_1.useEffect)(() => {
|
|
94
|
-
|
|
65
|
+
setContent();
|
|
95
66
|
}, []);
|
|
96
67
|
(0, react_1.useEffect)(() => {
|
|
97
|
-
|
|
68
|
+
setContent();
|
|
98
69
|
}, [props.symbol]);
|
|
99
70
|
return (React.createElement(react_native_1.View, { ...props.attributes, dataSet: {
|
|
100
|
-
class: className,
|
|
71
|
+
class: className(),
|
|
101
72
|
} },
|
|
102
|
-
React.createElement(
|
|
73
|
+
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: {
|
|
103
74
|
...(_a = props.symbol) === null || _a === void 0 ? void 0 : _a.data,
|
|
104
|
-
...builderContext.localState,
|
|
75
|
+
...props.builderContext.localState,
|
|
105
76
|
...(_b = contentToUse === null || contentToUse === void 0 ? void 0 : contentToUse.data) === null || _b === void 0 ? void 0 : _b.state,
|
|
106
77
|
}, model: (_c = props.symbol) === null || _c === void 0 ? void 0 : _c.model, content: contentToUse })));
|
|
107
78
|
}
|
|
@@ -4,17 +4,16 @@ exports.componentInfo = void 0;
|
|
|
4
4
|
const componentInfo = {
|
|
5
5
|
name: "Text",
|
|
6
6
|
static: true,
|
|
7
|
+
isRSC: true,
|
|
7
8
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
9
|
+
inputs: [{
|
|
10
10
|
name: "text",
|
|
11
11
|
type: "html",
|
|
12
12
|
required: true,
|
|
13
13
|
autoFocus: true,
|
|
14
14
|
bubble: true,
|
|
15
15
|
defaultValue: "Enter some text..."
|
|
16
|
-
}
|
|
17
|
-
],
|
|
16
|
+
}],
|
|
18
17
|
defaultStyles: {
|
|
19
18
|
lineHeight: "normal",
|
|
20
19
|
height: "auto",
|
|
@@ -4,33 +4,27 @@ exports.componentInfo = void 0;
|
|
|
4
4
|
const componentInfo = {
|
|
5
5
|
name: "Form:TextArea",
|
|
6
6
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
7
|
+
inputs: [{
|
|
9
8
|
advanced: true,
|
|
10
9
|
name: "value",
|
|
11
10
|
type: "string"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
11
|
+
}, {
|
|
14
12
|
name: "name",
|
|
15
13
|
type: "string",
|
|
16
14
|
required: true,
|
|
17
15
|
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
18
|
-
},
|
|
19
|
-
{
|
|
16
|
+
}, {
|
|
20
17
|
name: "defaultValue",
|
|
21
18
|
type: "string"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
19
|
+
}, {
|
|
24
20
|
name: "placeholder",
|
|
25
21
|
type: "string",
|
|
26
22
|
defaultValue: "Hello there"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
23
|
+
}, {
|
|
29
24
|
name: "required",
|
|
30
25
|
type: "boolean",
|
|
31
26
|
defaultValue: false
|
|
32
|
-
}
|
|
33
|
-
],
|
|
27
|
+
}],
|
|
34
28
|
defaultStyles: {
|
|
35
29
|
paddingTop: "10px",
|
|
36
30
|
paddingBottom: "10px",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -26,6 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
const React = __importStar(require("react"));
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
|
+
const helpers_js_1 = require("../helpers.js");
|
|
29
30
|
function Textarea(props) {
|
|
30
31
|
return (React.createElement(react_native_1.View, { ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
31
32
|
}
|
|
@@ -9,98 +9,78 @@ const componentInfo = {
|
|
|
9
9
|
minWidth: "20px"
|
|
10
10
|
},
|
|
11
11
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
|
|
12
|
-
inputs: [
|
|
13
|
-
{
|
|
12
|
+
inputs: [{
|
|
14
13
|
name: "video",
|
|
15
14
|
type: "file",
|
|
16
15
|
allowedFileTypes: ["mp4"],
|
|
17
16
|
bubble: true,
|
|
18
17
|
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
19
18
|
required: true
|
|
20
|
-
},
|
|
21
|
-
{
|
|
19
|
+
}, {
|
|
22
20
|
name: "posterImage",
|
|
23
21
|
type: "file",
|
|
24
22
|
allowedFileTypes: ["jpeg", "png"],
|
|
25
23
|
helperText: "Image to show before the video plays"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
24
|
+
}, {
|
|
28
25
|
name: "autoPlay",
|
|
29
26
|
type: "boolean",
|
|
30
27
|
defaultValue: true
|
|
31
|
-
},
|
|
32
|
-
{
|
|
28
|
+
}, {
|
|
33
29
|
name: "controls",
|
|
34
30
|
type: "boolean",
|
|
35
31
|
defaultValue: false
|
|
36
|
-
},
|
|
37
|
-
{
|
|
32
|
+
}, {
|
|
38
33
|
name: "muted",
|
|
39
34
|
type: "boolean",
|
|
40
35
|
defaultValue: true
|
|
41
|
-
},
|
|
42
|
-
{
|
|
36
|
+
}, {
|
|
43
37
|
name: "loop",
|
|
44
38
|
type: "boolean",
|
|
45
39
|
defaultValue: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
40
|
+
}, {
|
|
48
41
|
name: "playsInline",
|
|
49
42
|
type: "boolean",
|
|
50
43
|
defaultValue: true
|
|
51
|
-
},
|
|
52
|
-
{
|
|
44
|
+
}, {
|
|
53
45
|
name: "fit",
|
|
54
46
|
type: "text",
|
|
55
47
|
defaultValue: "cover",
|
|
56
48
|
enum: ["contain", "cover", "fill", "auto"]
|
|
57
|
-
},
|
|
58
|
-
|
|
49
|
+
}, {
|
|
50
|
+
name: "preload",
|
|
51
|
+
type: "text",
|
|
52
|
+
defaultValue: "metadata",
|
|
53
|
+
enum: ["auto", "metadata", "none"]
|
|
54
|
+
}, {
|
|
59
55
|
name: "fitContent",
|
|
60
56
|
type: "boolean",
|
|
61
57
|
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
62
58
|
defaultValue: true,
|
|
63
59
|
advanced: true
|
|
64
|
-
},
|
|
65
|
-
{
|
|
60
|
+
}, {
|
|
66
61
|
name: "position",
|
|
67
62
|
type: "text",
|
|
68
63
|
defaultValue: "center",
|
|
69
|
-
enum: [
|
|
70
|
-
|
|
71
|
-
"top",
|
|
72
|
-
"left",
|
|
73
|
-
"right",
|
|
74
|
-
"bottom",
|
|
75
|
-
"top left",
|
|
76
|
-
"top right",
|
|
77
|
-
"bottom left",
|
|
78
|
-
"bottom right"
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
64
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
65
|
+
}, {
|
|
82
66
|
name: "height",
|
|
83
67
|
type: "number",
|
|
84
68
|
advanced: true
|
|
85
|
-
},
|
|
86
|
-
{
|
|
69
|
+
}, {
|
|
87
70
|
name: "width",
|
|
88
71
|
type: "number",
|
|
89
72
|
advanced: true
|
|
90
|
-
},
|
|
91
|
-
{
|
|
73
|
+
}, {
|
|
92
74
|
name: "aspectRatio",
|
|
93
75
|
type: "number",
|
|
94
76
|
advanced: true,
|
|
95
77
|
defaultValue: 0.7004048582995948
|
|
96
|
-
},
|
|
97
|
-
{
|
|
78
|
+
}, {
|
|
98
79
|
name: "lazyLoad",
|
|
99
80
|
type: "boolean",
|
|
100
81
|
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
101
82
|
defaultValue: true,
|
|
102
83
|
advanced: true
|
|
103
|
-
}
|
|
104
|
-
]
|
|
84
|
+
}]
|
|
105
85
|
};
|
|
106
86
|
exports.componentInfo = componentInfo;
|
|
@@ -7,7 +7,12 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
7
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value
|
|
15
|
+
}) : obj[key] = value;
|
|
11
16
|
var __spreadValues = (a, b) => {
|
|
12
17
|
for (var prop in b || (b = {}))
|
|
13
18
|
if (__hasOwnProp.call(b, prop))
|
|
@@ -33,31 +38,15 @@ var __objRest = (source, exclude) => {
|
|
|
33
38
|
return target;
|
|
34
39
|
};
|
|
35
40
|
const evaluate_1 = require("../../functions/evaluate");
|
|
36
|
-
const
|
|
37
|
-
const EMPTY_HTML_ELEMENTS = [
|
|
38
|
-
|
|
39
|
-
"base",
|
|
40
|
-
"br",
|
|
41
|
-
"col",
|
|
42
|
-
"embed",
|
|
43
|
-
"hr",
|
|
44
|
-
"img",
|
|
45
|
-
"input",
|
|
46
|
-
"keygen",
|
|
47
|
-
"link",
|
|
48
|
-
"meta",
|
|
49
|
-
"param",
|
|
50
|
-
"source",
|
|
51
|
-
"track",
|
|
52
|
-
"wbr"
|
|
53
|
-
];
|
|
54
|
-
const isEmptyHtmlElement = (tagName) => {
|
|
41
|
+
const get_processed_block_js_1 = require("../../functions/get-processed-block.js");
|
|
42
|
+
const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
43
|
+
const isEmptyHtmlElement = tagName => {
|
|
55
44
|
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
56
45
|
};
|
|
57
46
|
exports.isEmptyHtmlElement = isEmptyHtmlElement;
|
|
58
|
-
const getComponent = ({ block, context }) => {
|
|
47
|
+
const getComponent = ({ block, context, registeredComponents }) => {
|
|
59
48
|
var _a;
|
|
60
|
-
const componentName = (_a = (0,
|
|
49
|
+
const componentName = (_a = (0, get_processed_block_js_1.getProcessedBlock)({
|
|
61
50
|
block,
|
|
62
51
|
localState: context.localState,
|
|
63
52
|
rootState: context.rootState,
|
|
@@ -68,7 +57,7 @@ const getComponent = ({ block, context }) => {
|
|
|
68
57
|
if (!componentName) {
|
|
69
58
|
return null;
|
|
70
59
|
}
|
|
71
|
-
const ref =
|
|
60
|
+
const ref = registeredComponents[componentName];
|
|
72
61
|
if (!ref) {
|
|
73
62
|
console.warn(`
|
|
74
63
|
Could not find a registered component named "${componentName}".
|