@builder.io/sdk-react-native 0.4.5 → 0.5.0
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 +2 -2
- 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 +25 -42
- 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/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 +51 -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 +141 -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/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
|
@@ -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,13 +27,18 @@ 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 Button(props) {
|
|
34
35
|
return (React.createElement(React.Fragment, null, props.link ? (React.createElement(React.Fragment, null,
|
|
35
36
|
React.createElement(react_native_1.View, { role: "button", ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined },
|
|
36
37
|
React.createElement(BaseText_1.default, null, props.text)))) : (React.createElement(React.Fragment, null,
|
|
37
|
-
React.createElement(react_native_1.View, { ...props.attributes, style:
|
|
38
|
+
React.createElement(react_native_1.View, { ...props.attributes, style: {
|
|
39
|
+
...styles.view1,
|
|
40
|
+
...props.attributes.style,
|
|
41
|
+
} },
|
|
38
42
|
React.createElement(BaseText_1.default, null, props.text))))));
|
|
39
43
|
}
|
|
40
44
|
const styles = react_native_1.StyleSheet.create({ view1: { all: "unset" } });
|
|
@@ -16,25 +16,21 @@ const componentInfo = {
|
|
|
16
16
|
textAlign: "center",
|
|
17
17
|
cursor: "pointer"
|
|
18
18
|
},
|
|
19
|
-
inputs: [
|
|
20
|
-
{
|
|
19
|
+
inputs: [{
|
|
21
20
|
name: "text",
|
|
22
21
|
type: "text",
|
|
23
22
|
defaultValue: "Click me!",
|
|
24
23
|
bubble: true
|
|
25
|
-
},
|
|
26
|
-
{
|
|
24
|
+
}, {
|
|
27
25
|
name: "link",
|
|
28
26
|
type: "url",
|
|
29
27
|
bubble: true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
28
|
+
}, {
|
|
32
29
|
name: "openLinkInNewTab",
|
|
33
30
|
type: "boolean",
|
|
34
31
|
defaultValue: false,
|
|
35
32
|
friendlyName: "Open link in new tab"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
33
|
+
}],
|
|
38
34
|
static: true,
|
|
39
35
|
noWrap: true
|
|
40
36
|
};
|
|
@@ -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,11 +30,10 @@ 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
|
|
33
|
+
const blocks_1 = __importDefault(require("../../components/blocks/blocks"));
|
|
34
|
+
const device_sizes_js_1 = require("../../constants/device-sizes.js");
|
|
35
35
|
const inlined_styles_1 = __importDefault(require("../../components/inlined-styles"));
|
|
36
36
|
const target_js_1 = require("../../constants/target.js");
|
|
37
|
-
const builder_context_js_1 = __importDefault(require("../../context/builder.context.js"));
|
|
38
37
|
function Columns(props) {
|
|
39
38
|
var _a;
|
|
40
39
|
const [gutterSize, setGutterSize] = (0, react_1.useState)(() => typeof props.space === "number" ? props.space || 0 : 20);
|
|
@@ -60,17 +59,8 @@ function Columns(props) {
|
|
|
60
59
|
? "column-reverse"
|
|
61
60
|
: "column");
|
|
62
61
|
function columnsCssVars() {
|
|
63
|
-
if (target_js_1.TARGET === "reactNative") {
|
|
64
|
-
return {
|
|
65
|
-
flexDirection: flexDir,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
62
|
return {
|
|
69
|
-
|
|
70
|
-
"--flex-dir-tablet": getTabletStyle({
|
|
71
|
-
stackedStyle: flexDir,
|
|
72
|
-
desktopStyle: "row",
|
|
73
|
-
}),
|
|
63
|
+
flexDirection: flexDir,
|
|
74
64
|
};
|
|
75
65
|
}
|
|
76
66
|
function columnCssVars(index) {
|
|
@@ -84,9 +74,10 @@ function Columns(props) {
|
|
|
84
74
|
const gutterPixels = `${gutter}px`;
|
|
85
75
|
const mobileWidth = "100%";
|
|
86
76
|
const mobileMarginLeft = 0;
|
|
77
|
+
const marginLeftKey = "margin-left";
|
|
87
78
|
return {
|
|
88
79
|
width,
|
|
89
|
-
|
|
80
|
+
[marginLeftKey]: gutterPixels,
|
|
90
81
|
"--column-width-mobile": getMobileStyle({
|
|
91
82
|
stackedStyle: mobileWidth,
|
|
92
83
|
desktopStyle: width,
|
|
@@ -107,7 +98,7 @@ function Columns(props) {
|
|
|
107
98
|
}
|
|
108
99
|
function getWidthForBreakpointSize(size) {
|
|
109
100
|
var _a, _b;
|
|
110
|
-
const breakpointSizes = (0,
|
|
101
|
+
const breakpointSizes = (0, device_sizes_js_1.getSizesForBreakpoints)(((_b = (_a = props.builderContext.content) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.breakpoints) || {});
|
|
111
102
|
return breakpointSizes[size].max;
|
|
112
103
|
}
|
|
113
104
|
function columnsStyles() {
|
|
@@ -137,18 +128,23 @@ function Columns(props) {
|
|
|
137
128
|
},
|
|
138
129
|
`;
|
|
139
130
|
}
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
return (React.createElement(react_native_1.View, { style: {
|
|
132
|
+
...styles.view1,
|
|
133
|
+
...columnsCssVars(),
|
|
134
|
+
}, dataSet: {
|
|
142
135
|
"builder-block-name": "builder-columns",
|
|
143
136
|
} },
|
|
144
137
|
target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
145
138
|
React.createElement(inlined_styles_1.default, { styles: columnsStyles() }))) : null, (_a = props.columns) === null || _a === void 0 ? void 0 :
|
|
146
|
-
_a.map((column, index) => (React.createElement(react_native_1.View, { style:
|
|
139
|
+
_a.map((column, index) => (React.createElement(react_native_1.View, { style: {
|
|
140
|
+
...styles.view2,
|
|
141
|
+
...columnCssVars(index),
|
|
142
|
+
}, dataSet: {
|
|
147
143
|
"builder-block-name": "builder-column",
|
|
148
144
|
}, key: index },
|
|
149
|
-
React.createElement(
|
|
145
|
+
React.createElement(blocks_1.default, { blocks: column.blocks, path: `component.options.columns.${index}.blocks`, parent: props.builderBlock.id, styleProp: {
|
|
150
146
|
flexGrow: "1",
|
|
151
|
-
} }))))));
|
|
147
|
+
}, context: props.builderContext, registeredComponents: props.builderComponents }))))));
|
|
152
148
|
}
|
|
153
149
|
const styles = react_native_1.StyleSheet.create({
|
|
154
150
|
view1: { display: "flex" },
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentInfo = void 0;
|
|
4
|
-
const util_js_1 = require("../util.js");
|
|
5
4
|
const componentInfo = {
|
|
6
5
|
name: "Columns",
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
isRSC: true,
|
|
7
|
+
inputs: [{
|
|
9
8
|
name: "columns",
|
|
10
9
|
type: "array",
|
|
11
10
|
broadcast: true,
|
|
12
|
-
subFields: [
|
|
13
|
-
{
|
|
11
|
+
subFields: [{
|
|
14
12
|
name: "blocks",
|
|
15
13
|
type: "array",
|
|
16
14
|
hideFromUI: true,
|
|
17
|
-
defaultValue: [
|
|
18
|
-
{
|
|
15
|
+
defaultValue: [{
|
|
19
16
|
"@type": "@builder.io/sdk:Element",
|
|
20
17
|
responsiveStyles: {
|
|
21
18
|
large: {
|
|
@@ -42,8 +39,7 @@ const componentInfo = {
|
|
|
42
39
|
aspectRatio: 0.7004048582995948
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
42
|
+
}, {
|
|
47
43
|
"@type": "@builder.io/sdk:Element",
|
|
48
44
|
responsiveStyles: {
|
|
49
45
|
large: {
|
|
@@ -64,25 +60,19 @@ const componentInfo = {
|
|
|
64
60
|
text: "<p>Enter some text...</p>"
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
{
|
|
63
|
+
}]
|
|
64
|
+
}, {
|
|
71
65
|
name: "width",
|
|
72
66
|
type: "number",
|
|
73
67
|
hideFromUI: true,
|
|
74
68
|
helperText: "Width %, e.g. set to 50 to fill half of the space"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
69
|
+
}, {
|
|
77
70
|
name: "link",
|
|
78
71
|
type: "url",
|
|
79
72
|
helperText: "Optionally set a url that clicking this column will link to"
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
blocks: [
|
|
85
|
-
{
|
|
73
|
+
}],
|
|
74
|
+
defaultValue: [{
|
|
75
|
+
blocks: [{
|
|
86
76
|
"@type": "@builder.io/sdk:Element",
|
|
87
77
|
responsiveStyles: {
|
|
88
78
|
large: {
|
|
@@ -109,8 +99,7 @@ const componentInfo = {
|
|
|
109
99
|
aspectRatio: 0.7004048582995948
|
|
110
100
|
}
|
|
111
101
|
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
102
|
+
}, {
|
|
114
103
|
"@type": "@builder.io/sdk:Element",
|
|
115
104
|
responsiveStyles: {
|
|
116
105
|
large: {
|
|
@@ -131,12 +120,9 @@ const componentInfo = {
|
|
|
131
120
|
text: "<p>Enter some text...</p>"
|
|
132
121
|
}
|
|
133
122
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
blocks: [
|
|
139
|
-
{
|
|
123
|
+
}]
|
|
124
|
+
}, {
|
|
125
|
+
blocks: [{
|
|
140
126
|
"@type": "@builder.io/sdk:Element",
|
|
141
127
|
responsiveStyles: {
|
|
142
128
|
large: {
|
|
@@ -163,8 +149,7 @@ const componentInfo = {
|
|
|
163
149
|
aspectRatio: 0.7004048582995948
|
|
164
150
|
}
|
|
165
151
|
}
|
|
166
|
-
},
|
|
167
|
-
{
|
|
152
|
+
}, {
|
|
168
153
|
"@type": "@builder.io/sdk:Element",
|
|
169
154
|
responsiveStyles: {
|
|
170
155
|
large: {
|
|
@@ -185,21 +170,19 @@ const componentInfo = {
|
|
|
185
170
|
text: "<p>Enter some text...</p>"
|
|
186
171
|
}
|
|
187
172
|
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
],
|
|
192
|
-
onChange: (0, util_js_1.serializeFn)((options) => {
|
|
173
|
+
}]
|
|
174
|
+
}],
|
|
175
|
+
onChange: options => {
|
|
193
176
|
function clearWidths() {
|
|
194
|
-
columns.forEach(
|
|
177
|
+
columns.forEach(col => {
|
|
195
178
|
col.delete("width");
|
|
196
179
|
});
|
|
197
180
|
}
|
|
198
181
|
const columns = options.get("columns");
|
|
199
182
|
if (Array.isArray(columns)) {
|
|
200
|
-
const containsColumnWithWidth = !!columns.find(
|
|
183
|
+
const containsColumnWithWidth = !!columns.find(col => col.get("width"));
|
|
201
184
|
if (containsColumnWithWidth) {
|
|
202
|
-
const containsColumnWithoutWidth = !!columns.find(
|
|
185
|
+
const containsColumnWithoutWidth = !!columns.find(col => !col.get("width"));
|
|
203
186
|
if (containsColumnWithoutWidth) {
|
|
204
187
|
clearWidths();
|
|
205
188
|
}
|
|
@@ -214,30 +197,26 @@ const componentInfo = {
|
|
|
214
197
|
}
|
|
215
198
|
}
|
|
216
199
|
}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
{
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
220
202
|
name: "space",
|
|
221
203
|
type: "number",
|
|
222
204
|
defaultValue: 20,
|
|
223
205
|
helperText: "Size of gap between columns",
|
|
224
206
|
advanced: true
|
|
225
|
-
},
|
|
226
|
-
{
|
|
207
|
+
}, {
|
|
227
208
|
name: "stackColumnsAt",
|
|
228
209
|
type: "string",
|
|
229
210
|
defaultValue: "tablet",
|
|
230
211
|
helperText: "Convert horizontal columns to vertical at what device size",
|
|
231
212
|
enum: ["tablet", "mobile", "never"],
|
|
232
213
|
advanced: true
|
|
233
|
-
},
|
|
234
|
-
{
|
|
214
|
+
}, {
|
|
235
215
|
name: "reverseColumnsWhenStacked",
|
|
236
216
|
type: "boolean",
|
|
237
217
|
defaultValue: false,
|
|
238
218
|
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
239
219
|
advanced: true
|
|
240
|
-
}
|
|
241
|
-
]
|
|
220
|
+
}]
|
|
242
221
|
};
|
|
243
222
|
exports.componentInfo = componentInfo;
|
|
@@ -5,27 +5,23 @@ const componentInfo = {
|
|
|
5
5
|
name: "Custom Code",
|
|
6
6
|
static: true,
|
|
7
7
|
requiredPermissions: ["editCode"],
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
8
|
+
inputs: [{
|
|
10
9
|
name: "code",
|
|
11
10
|
type: "html",
|
|
12
11
|
required: true,
|
|
13
12
|
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
14
13
|
code: true
|
|
15
|
-
},
|
|
16
|
-
{
|
|
14
|
+
}, {
|
|
17
15
|
name: "replaceNodes",
|
|
18
16
|
type: "boolean",
|
|
19
17
|
helperText: "Preserve server rendered dom nodes",
|
|
20
18
|
advanced: true
|
|
21
|
-
},
|
|
22
|
-
{
|
|
19
|
+
}, {
|
|
23
20
|
name: "scriptsClientOnly",
|
|
24
21
|
type: "boolean",
|
|
25
22
|
defaultValue: false,
|
|
26
23
|
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
27
24
|
advanced: true
|
|
28
|
-
}
|
|
29
|
-
]
|
|
25
|
+
}]
|
|
30
26
|
};
|
|
31
27
|
exports.componentInfo = componentInfo;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentInfo = void 0;
|
|
4
|
-
const util_js_1 = require("../util.js");
|
|
5
4
|
const componentInfo = {
|
|
6
5
|
name: "Embed",
|
|
7
6
|
static: true,
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
7
|
+
inputs: [{
|
|
10
8
|
name: "url",
|
|
11
9
|
type: "url",
|
|
12
10
|
required: true,
|
|
13
11
|
defaultValue: "",
|
|
14
12
|
helperText: "e.g. enter a youtube url, google map, etc",
|
|
15
|
-
onChange:
|
|
13
|
+
onChange: options => {
|
|
16
14
|
const url = options.get("url");
|
|
17
15
|
if (url) {
|
|
18
16
|
options.set("content", "Loading...");
|
|
19
17
|
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
20
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(
|
|
18
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
|
|
21
19
|
if (options.get("url") === url) {
|
|
22
20
|
if (data.html) {
|
|
23
21
|
options.set("content", data.html);
|
|
@@ -26,21 +24,19 @@ const componentInfo = {
|
|
|
26
24
|
options.set("content", "Invalid url, please try another");
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
}).catch(
|
|
27
|
+
}).catch(_err => {
|
|
30
28
|
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
else {
|
|
34
32
|
options.delete("content");
|
|
35
33
|
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
39
36
|
name: "content",
|
|
40
37
|
type: "html",
|
|
41
38
|
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
42
39
|
hideFromUI: true
|
|
43
|
-
}
|
|
44
|
-
]
|
|
40
|
+
}]
|
|
45
41
|
};
|
|
46
42
|
exports.componentInfo = componentInfo;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isJsScript = void 0;
|
|
4
|
-
const SCRIPT_MIME_TYPES = [
|
|
5
|
-
|
|
6
|
-
"application/javascript",
|
|
7
|
-
"application/ecmascript"
|
|
8
|
-
];
|
|
9
|
-
const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
4
|
+
const SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
5
|
+
const isJsScript = script => SCRIPT_MIME_TYPES.includes(script.type);
|
|
10
6
|
exports.isJsScript = isJsScript;
|
|
@@ -12,94 +12,75 @@ const componentInfo = {
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
15
|
-
inputs: [
|
|
16
|
-
{
|
|
15
|
+
inputs: [{
|
|
17
16
|
name: "sendSubmissionsTo",
|
|
18
17
|
type: "string",
|
|
19
|
-
enum: [
|
|
20
|
-
{
|
|
18
|
+
enum: [{
|
|
21
19
|
label: "Send to email",
|
|
22
20
|
value: "email",
|
|
23
21
|
helperText: "Send form submissions to the email address of your choosing"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
22
|
+
}, {
|
|
26
23
|
label: "Custom",
|
|
27
24
|
value: "custom",
|
|
28
25
|
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
26
|
+
}],
|
|
31
27
|
defaultValue: "email"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
28
|
+
}, {
|
|
34
29
|
name: "sendSubmissionsToEmail",
|
|
35
30
|
type: "string",
|
|
36
31
|
required: true,
|
|
37
32
|
defaultValue: "your@email.com",
|
|
38
33
|
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
34
|
+
}, {
|
|
41
35
|
name: "sendWithJs",
|
|
42
36
|
type: "boolean",
|
|
43
37
|
helperText: "Set to false to use basic html form action",
|
|
44
38
|
defaultValue: true,
|
|
45
39
|
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
40
|
+
}, {
|
|
48
41
|
name: "name",
|
|
49
42
|
type: "string",
|
|
50
43
|
defaultValue: "My form"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
44
|
+
}, {
|
|
53
45
|
name: "action",
|
|
54
46
|
type: "string",
|
|
55
47
|
helperText: "URL to send the form data to",
|
|
56
48
|
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
57
|
-
},
|
|
58
|
-
{
|
|
49
|
+
}, {
|
|
59
50
|
name: "contentType",
|
|
60
51
|
type: "string",
|
|
61
52
|
defaultValue: "application/json",
|
|
62
53
|
advanced: true,
|
|
63
|
-
enum: [
|
|
64
|
-
"application/json",
|
|
65
|
-
"multipart/form-data",
|
|
66
|
-
"application/x-www-form-urlencoded"
|
|
67
|
-
],
|
|
54
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
68
55
|
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
56
|
+
}, {
|
|
71
57
|
name: "method",
|
|
72
58
|
type: "string",
|
|
73
59
|
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
74
60
|
defaultValue: "POST",
|
|
75
61
|
advanced: true
|
|
76
|
-
},
|
|
77
|
-
{
|
|
62
|
+
}, {
|
|
78
63
|
name: "previewState",
|
|
79
64
|
type: "string",
|
|
80
65
|
enum: ["unsubmitted", "sending", "success", "error"],
|
|
81
66
|
defaultValue: "unsubmitted",
|
|
82
67
|
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
83
68
|
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
69
|
+
}, {
|
|
86
70
|
name: "successUrl",
|
|
87
71
|
type: "url",
|
|
88
72
|
helperText: "Optional URL to redirect the user to on form submission success",
|
|
89
73
|
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
90
|
-
},
|
|
91
|
-
{
|
|
74
|
+
}, {
|
|
92
75
|
name: "resetFormOnSubmit",
|
|
93
76
|
type: "boolean",
|
|
94
77
|
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
95
78
|
advanced: true
|
|
96
|
-
},
|
|
97
|
-
{
|
|
79
|
+
}, {
|
|
98
80
|
name: "successMessage",
|
|
99
81
|
type: "uiBlocks",
|
|
100
82
|
hideFromUI: true,
|
|
101
|
-
defaultValue: [
|
|
102
|
-
{
|
|
83
|
+
defaultValue: [{
|
|
103
84
|
"@type": "@builder.io/sdk:Element",
|
|
104
85
|
responsiveStyles: {
|
|
105
86
|
large: {
|
|
@@ -112,27 +93,22 @@ const componentInfo = {
|
|
|
112
93
|
text: "<span>Thanks!</span>"
|
|
113
94
|
}
|
|
114
95
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
-
{
|
|
96
|
+
}]
|
|
97
|
+
}, {
|
|
119
98
|
name: "validate",
|
|
120
99
|
type: "boolean",
|
|
121
100
|
defaultValue: true,
|
|
122
101
|
advanced: true
|
|
123
|
-
},
|
|
124
|
-
{
|
|
102
|
+
}, {
|
|
125
103
|
name: "errorMessagePath",
|
|
126
104
|
type: "text",
|
|
127
105
|
advanced: true,
|
|
128
106
|
helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
107
|
+
}, {
|
|
131
108
|
name: "errorMessage",
|
|
132
109
|
type: "uiBlocks",
|
|
133
110
|
hideFromUI: true,
|
|
134
|
-
defaultValue: [
|
|
135
|
-
{
|
|
111
|
+
defaultValue: [{
|
|
136
112
|
"@type": "@builder.io/sdk:Element",
|
|
137
113
|
responsiveStyles: {
|
|
138
114
|
large: {
|
|
@@ -148,15 +124,12 @@ const componentInfo = {
|
|
|
148
124
|
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
149
125
|
}
|
|
150
126
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
{
|
|
127
|
+
}]
|
|
128
|
+
}, {
|
|
155
129
|
name: "sendingMessage",
|
|
156
130
|
type: "uiBlocks",
|
|
157
131
|
hideFromUI: true,
|
|
158
|
-
defaultValue: [
|
|
159
|
-
{
|
|
132
|
+
defaultValue: [{
|
|
160
133
|
"@type": "@builder.io/sdk:Element",
|
|
161
134
|
responsiveStyles: {
|
|
162
135
|
large: {
|
|
@@ -169,10 +142,8 @@ const componentInfo = {
|
|
|
169
142
|
text: "<span>Sending...</span>"
|
|
170
143
|
}
|
|
171
144
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
{
|
|
145
|
+
}]
|
|
146
|
+
}, {
|
|
176
147
|
name: "customHeaders",
|
|
177
148
|
type: "map",
|
|
178
149
|
valueType: {
|
|
@@ -180,12 +151,10 @@ const componentInfo = {
|
|
|
180
151
|
},
|
|
181
152
|
advanced: true,
|
|
182
153
|
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
183
|
-
}
|
|
184
|
-
],
|
|
154
|
+
}],
|
|
185
155
|
noWrap: true,
|
|
186
156
|
canHaveChildren: true,
|
|
187
|
-
defaultChildren: [
|
|
188
|
-
{
|
|
157
|
+
defaultChildren: [{
|
|
189
158
|
"@type": "@builder.io/sdk:Element",
|
|
190
159
|
responsiveStyles: {
|
|
191
160
|
large: {
|
|
@@ -198,8 +167,7 @@ const componentInfo = {
|
|
|
198
167
|
text: "<span>Enter your name</span>"
|
|
199
168
|
}
|
|
200
169
|
}
|
|
201
|
-
},
|
|
202
|
-
{
|
|
170
|
+
}, {
|
|
203
171
|
"@type": "@builder.io/sdk:Element",
|
|
204
172
|
responsiveStyles: {
|
|
205
173
|
large: {
|
|
@@ -213,8 +181,7 @@ const componentInfo = {
|
|
|
213
181
|
placeholder: "Jane Doe"
|
|
214
182
|
}
|
|
215
183
|
}
|
|
216
|
-
},
|
|
217
|
-
{
|
|
184
|
+
}, {
|
|
218
185
|
"@type": "@builder.io/sdk:Element",
|
|
219
186
|
responsiveStyles: {
|
|
220
187
|
large: {
|
|
@@ -227,8 +194,7 @@ const componentInfo = {
|
|
|
227
194
|
text: "<span>Enter your email</span>"
|
|
228
195
|
}
|
|
229
196
|
}
|
|
230
|
-
},
|
|
231
|
-
{
|
|
197
|
+
}, {
|
|
232
198
|
"@type": "@builder.io/sdk:Element",
|
|
233
199
|
responsiveStyles: {
|
|
234
200
|
large: {
|
|
@@ -242,8 +208,7 @@ const componentInfo = {
|
|
|
242
208
|
placeholder: "jane@doe.com"
|
|
243
209
|
}
|
|
244
210
|
}
|
|
245
|
-
},
|
|
246
|
-
{
|
|
211
|
+
}, {
|
|
247
212
|
"@type": "@builder.io/sdk:Element",
|
|
248
213
|
responsiveStyles: {
|
|
249
214
|
large: {
|
|
@@ -256,7 +221,6 @@ const componentInfo = {
|
|
|
256
221
|
text: "Submit"
|
|
257
222
|
}
|
|
258
223
|
}
|
|
259
|
-
}
|
|
260
|
-
]
|
|
224
|
+
}]
|
|
261
225
|
};
|
|
262
226
|
exports.componentInfo = componentInfo;
|