@builder.io/sdk-react-native 1.0.31-0 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/browser/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +1 -0
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/module/blocks/symbol/symbol.js +1 -0
- package/lib/browser/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/browser/module/components/content/content.js +1 -0
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/context/types.d.ts +1 -0
- package/lib/browser/typescript/context/types.d.ts.map +1 -1
- package/lib/edge/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/edge/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +1 -0
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/module/blocks/symbol/symbol.js +1 -0
- package/lib/edge/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/edge/module/components/content/content.js +1 -0
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/context/types.d.ts +1 -0
- package/lib/edge/typescript/context/types.d.ts.map +1 -1
- package/lib/node/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/node/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +1 -0
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/module/blocks/symbol/symbol.js +1 -0
- package/lib/node/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/node/module/components/content/content.js +1 -0
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/context/types.d.ts +1 -0
- package/lib/node/typescript/context/types.d.ts.map +1 -1
- package/package.json +5 -9
- package/lib/node/index.cjs +0 -6910
- package/lib/node/index.mjs +0 -7477
- package/src/blocks/BaseText.tsx +0 -17
- package/src/blocks/accordion/accordion.tsx +0 -181
- package/src/blocks/accordion/accordion.types.ts +0 -12
- package/src/blocks/accordion/component-info.ts +0 -124
- package/src/blocks/accordion/helpers.ts +0 -3
- package/src/blocks/accordion/index.ts +0 -1
- package/src/blocks/button/button.tsx +0 -56
- package/src/blocks/button/button.types.ts +0 -7
- package/src/blocks/button/component-info.ts +0 -35
- package/src/blocks/button/index.ts +0 -1
- package/src/blocks/columns/columns.tsx +0 -199
- package/src/blocks/columns/columns.types.ts +0 -14
- package/src/blocks/columns/component-info.ts +0 -219
- package/src/blocks/columns/helpers.ts +0 -3
- package/src/blocks/columns/index.ts +0 -1
- package/src/blocks/custom-code/component-info.ts +0 -24
- package/src/blocks/custom-code/custom-code.tsx +0 -71
- package/src/blocks/custom-code/index.ts +0 -1
- package/src/blocks/embed/component-info.ts +0 -38
- package/src/blocks/embed/embed.tsx +0 -62
- package/src/blocks/embed/helpers.ts +0 -2
- package/src/blocks/embed/index.ts +0 -1
- package/src/blocks/form/form/component-info.ts +0 -233
- package/src/blocks/form/form/form.tsx +0 -324
- package/src/blocks/form/form/index.ts +0 -1
- package/src/blocks/form/input/component-info.ts +0 -47
- package/src/blocks/form/input/index.ts +0 -1
- package/src/blocks/form/input/input.tsx +0 -49
- package/src/blocks/form/select/component-info.ts +0 -44
- package/src/blocks/form/select/index.ts +0 -1
- package/src/blocks/form/select/select.tsx +0 -54
- package/src/blocks/form/submit-button/component-info.ts +0 -27
- package/src/blocks/form/submit-button/index.ts +0 -1
- package/src/blocks/form/submit-button/submit-button.tsx +0 -34
- package/src/blocks/fragment/component-info.ts +0 -8
- package/src/blocks/fragment/fragment.tsx +0 -18
- package/src/blocks/fragment/fragment.types.ts +0 -5
- package/src/blocks/fragment/index.ts +0 -1
- package/src/blocks/helpers.ts +0 -43
- package/src/blocks/image/component-info.ts +0 -124
- package/src/blocks/image/image.helpers.ts +0 -47
- package/src/blocks/image/image.tsx +0 -65
- package/src/blocks/image/image.types.ts +0 -19
- package/src/blocks/image/index.ts +0 -1
- package/src/blocks/img/component-info.ts +0 -16
- package/src/blocks/img/img.tsx +0 -55
- package/src/blocks/img/index.ts +0 -1
- package/src/blocks/raw-text/component-info.ts +0 -11
- package/src/blocks/raw-text/index.ts +0 -1
- package/src/blocks/raw-text/raw-text.tsx +0 -1
- package/src/blocks/section/component-info.ts +0 -41
- package/src/blocks/section/index.ts +0 -1
- package/src/blocks/section/section.tsx +0 -39
- package/src/blocks/section/section.types.ts +0 -6
- package/src/blocks/slot/component-info.ts +0 -15
- package/src/blocks/slot/index.ts +0 -1
- package/src/blocks/slot/slot.tsx +0 -42
- package/src/blocks/symbol/component-info.ts +0 -35
- package/src/blocks/symbol/index.ts +0 -1
- package/src/blocks/symbol/symbol.helpers.ts +0 -47
- package/src/blocks/symbol/symbol.tsx +0 -99
- package/src/blocks/symbol/symbol.types.ts +0 -17
- package/src/blocks/tabs/component-info.ts +0 -139
- package/src/blocks/tabs/index.ts +0 -1
- package/src/blocks/tabs/tabs.tsx +0 -79
- package/src/blocks/tabs/tabs.types.ts +0 -13
- package/src/blocks/text/component-info.ts +0 -20
- package/src/blocks/text/index.ts +0 -1
- package/src/blocks/text/text.tsx +0 -105
- package/src/blocks/text/text.types.ts +0 -4
- package/src/blocks/textarea/component-info.ts +0 -38
- package/src/blocks/textarea/index.ts +0 -1
- package/src/blocks/textarea/textarea.tsx +0 -41
- package/src/blocks/video/component-info.ts +0 -83
- package/src/blocks/video/index.ts +0 -1
- package/src/blocks/video/video.tsx +0 -70
- package/src/blocks/video/video.types.ts +0 -21
- package/src/components/block/animator.ts +0 -220
- package/src/components/block/block.helpers.ts +0 -106
- package/src/components/block/block.tsx +0 -235
- package/src/components/block/components/block-styles.tsx +0 -136
- package/src/components/block/components/block-wrapper.tsx +0 -53
- package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
- package/src/components/block/components/component-ref/component-ref.tsx +0 -66
- package/src/components/block/components/interactive-element.tsx +0 -53
- package/src/components/block/components/repeated-block.tsx +0 -37
- package/src/components/block/types.ts +0 -6
- package/src/components/blocks/blocks-wrapper.tsx +0 -93
- package/src/components/blocks/blocks.tsx +0 -57
- package/src/components/blocks/blocks.types.ts +0 -7
- package/src/components/blocks/index.ts +0 -1
- package/src/components/content/components/enable-editor.tsx +0 -471
- package/src/components/content/components/styles.helpers.ts +0 -101
- package/src/components/content/components/styles.tsx +0 -42
- package/src/components/content/content.helpers.ts +0 -40
- package/src/components/content/content.tsx +0 -150
- package/src/components/content/content.types.ts +0 -13
- package/src/components/content/contentProps.types.ts +0 -17
- package/src/components/content/index.ts +0 -1
- package/src/components/content/wrap-component-ref.ts +0 -6
- package/src/components/content-variants/content-variants.tsx +0 -146
- package/src/components/content-variants/content-variants.types.ts +0 -84
- package/src/components/content-variants/helpers.ts +0 -72
- package/src/components/content-variants/index.ts +0 -1
- package/src/components/content-variants/inlined-fns.ts +0 -22
- package/src/components/dynamic-div.tsx +0 -30
- package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
- package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
- package/src/components/error-boundary.tsx +0 -38
- package/src/components/inlined-script.tsx +0 -10
- package/src/components/inlined-styles.tsx +0 -10
- package/src/constants/builder-registered-components.ts +0 -59
- package/src/constants/device-sizes.ts +0 -59
- package/src/constants/extra-components.ts +0 -1
- package/src/constants/sdk-version.ts +0 -1
- package/src/constants/target.ts +0 -3
- package/src/context/builder.context.ts +0 -15
- package/src/context/components.context.ts +0 -3
- package/src/context/index.ts +0 -1
- package/src/context/types.ts +0 -37
- package/src/functions/apply-patch-with-mutation.ts +0 -61
- package/src/functions/camel-to-kebab-case.ts +0 -1
- package/src/functions/deopt.ts +0 -6
- package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
- package/src/functions/evaluate/browser-runtime/index.ts +0 -1
- package/src/functions/evaluate/choose-eval.ts +0 -23
- package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
- package/src/functions/evaluate/edge-runtime/index.ts +0 -1
- package/src/functions/evaluate/evaluate.ts +0 -76
- package/src/functions/evaluate/helpers.ts +0 -56
- package/src/functions/evaluate/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/init.ts +0 -33
- package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
- package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -24
- package/src/functions/evaluate/placeholder-runtime.ts +0 -4
- package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
- package/src/functions/event-handler-name.ts +0 -4
- package/src/functions/extract-text-styles.ts +0 -24
- package/src/functions/fast-clone.ts +0 -4
- package/src/functions/fetch-builder-props.ts +0 -75
- package/src/functions/get-block-actions-handler.ts +0 -17
- package/src/functions/get-block-actions.ts +0 -35
- package/src/functions/get-block-component-options.ts +0 -11
- package/src/functions/get-block-properties.ts +0 -62
- package/src/functions/get-builder-search-params/index.ts +0 -33
- package/src/functions/get-class-prop-name.ts +0 -15
- package/src/functions/get-content/generate-content-url.ts +0 -88
- package/src/functions/get-content/index.ts +0 -99
- package/src/functions/get-content/types.ts +0 -157
- package/src/functions/get-env.ts +0 -5
- package/src/functions/get-fetch.ts +0 -11
- package/src/functions/get-global-this.ts +0 -16
- package/src/functions/get-processed-block.ts +0 -70
- package/src/functions/get-style.ts +0 -38
- package/src/functions/get.ts +0 -4
- package/src/functions/is-browser.ts +0 -3
- package/src/functions/is-edge-runtime.ts +0 -9
- package/src/functions/is-editing.ts +0 -8
- package/src/functions/is-from-trusted-host.ts +0 -8
- package/src/functions/is-iframe.ts +0 -4
- package/src/functions/is-node-runtime.ts +0 -8
- package/src/functions/is-previewing.ts +0 -16
- package/src/functions/on-change.ts +0 -29
- package/src/functions/register-component.ts +0 -30
- package/src/functions/register.ts +0 -44
- package/src/functions/set-editor-settings.ts +0 -15
- package/src/functions/set.ts +0 -14
- package/src/functions/track/helpers.ts +0 -51
- package/src/functions/track/index.ts +0 -131
- package/src/functions/track/interaction.ts +0 -63
- package/src/functions/transform-block-properties.ts +0 -33
- package/src/functions/transform-block.ts +0 -30
- package/src/functions/transform-style-property.ts +0 -296
- package/src/helpers/ab-tests.ts +0 -166
- package/src/helpers/canTrack.ts +0 -2
- package/src/helpers/cookie.ts +0 -97
- package/src/helpers/css.ts +0 -33
- package/src/helpers/flatten.ts +0 -41
- package/src/helpers/localStorage.ts +0 -36
- package/src/helpers/logger.ts +0 -7
- package/src/helpers/nullable.ts +0 -2
- package/src/helpers/omit.ts +0 -7
- package/src/helpers/preview-lru-cache/get.ts +0 -4
- package/src/helpers/preview-lru-cache/helpers.ts +0 -1
- package/src/helpers/preview-lru-cache/init.ts +0 -7
- package/src/helpers/preview-lru-cache/set.ts +0 -12
- package/src/helpers/preview-lru-cache/types.ts +0 -1
- package/src/helpers/search/search.ts +0 -18
- package/src/helpers/sessionId.ts +0 -37
- package/src/helpers/subscribe-to-editor.ts +0 -95
- package/src/helpers/time.ts +0 -2
- package/src/helpers/url.ts +0 -15
- package/src/helpers/uuid.ts +0 -17
- package/src/helpers/visitorId.ts +0 -37
- package/src/index-helpers/blocks-exports.ts +0 -16
- package/src/index-helpers/top-of-file.ts +0 -2
- package/src/index.ts +0 -15
- package/src/scripts/init-editing.ts +0 -119
- package/src/server-index.ts +0 -43
- package/src/types/api-version.ts +0 -2
- package/src/types/builder-block.ts +0 -89
- package/src/types/builder-content.ts +0 -47
- package/src/types/builder-props.ts +0 -12
- package/src/types/can-track.ts +0 -3
- package/src/types/components.ts +0 -119
- package/src/types/deep-partial.ts +0 -1
- package/src/types/element.ts +0 -57
- package/src/types/enforced-partials.ts +0 -19
- package/src/types/input.ts +0 -123
- package/src/types/targets.ts +0 -1
- package/src/types/typescript.ts +0 -9
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
export const componentInfo: ComponentInfo = {
|
|
3
|
-
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
4
|
-
name: 'Columns',
|
|
5
|
-
isRSC: true,
|
|
6
|
-
inputs: [{
|
|
7
|
-
name: 'columns',
|
|
8
|
-
type: 'array',
|
|
9
|
-
broadcast: true,
|
|
10
|
-
subFields: [{
|
|
11
|
-
name: 'blocks',
|
|
12
|
-
type: 'array',
|
|
13
|
-
hideFromUI: true,
|
|
14
|
-
defaultValue: [{
|
|
15
|
-
'@type': '@builder.io/sdk:Element',
|
|
16
|
-
responsiveStyles: {
|
|
17
|
-
large: {
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
alignItems: 'stretch',
|
|
21
|
-
flexShrink: '0',
|
|
22
|
-
position: 'relative',
|
|
23
|
-
marginTop: '30px',
|
|
24
|
-
textAlign: 'center',
|
|
25
|
-
lineHeight: 'normal',
|
|
26
|
-
height: 'auto',
|
|
27
|
-
minHeight: '20px',
|
|
28
|
-
minWidth: '20px',
|
|
29
|
-
overflow: 'hidden'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
component: {
|
|
33
|
-
name: 'Image',
|
|
34
|
-
options: {
|
|
35
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
36
|
-
backgroundPosition: 'center',
|
|
37
|
-
backgroundSize: 'cover',
|
|
38
|
-
aspectRatio: 0.7004048582995948
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
'@type': '@builder.io/sdk:Element',
|
|
43
|
-
responsiveStyles: {
|
|
44
|
-
large: {
|
|
45
|
-
display: 'flex',
|
|
46
|
-
flexDirection: 'column',
|
|
47
|
-
alignItems: 'stretch',
|
|
48
|
-
flexShrink: '0',
|
|
49
|
-
position: 'relative',
|
|
50
|
-
marginTop: '30px',
|
|
51
|
-
textAlign: 'center',
|
|
52
|
-
lineHeight: 'normal',
|
|
53
|
-
height: 'auto'
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
component: {
|
|
57
|
-
name: 'Text',
|
|
58
|
-
options: {
|
|
59
|
-
text: '<p>Enter some text...</p>'
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}]
|
|
63
|
-
}, {
|
|
64
|
-
name: 'width',
|
|
65
|
-
type: 'number',
|
|
66
|
-
hideFromUI: true,
|
|
67
|
-
helperText: 'Width %, e.g. set to 50 to fill half of the space'
|
|
68
|
-
}, {
|
|
69
|
-
name: 'link',
|
|
70
|
-
type: 'url',
|
|
71
|
-
helperText: 'Optionally set a url that clicking this column will link to'
|
|
72
|
-
}],
|
|
73
|
-
defaultValue: [{
|
|
74
|
-
blocks: [{
|
|
75
|
-
'@type': '@builder.io/sdk:Element',
|
|
76
|
-
responsiveStyles: {
|
|
77
|
-
large: {
|
|
78
|
-
display: 'flex',
|
|
79
|
-
flexDirection: 'column',
|
|
80
|
-
alignItems: 'stretch',
|
|
81
|
-
flexShrink: '0',
|
|
82
|
-
position: 'relative',
|
|
83
|
-
marginTop: '30px',
|
|
84
|
-
textAlign: 'center',
|
|
85
|
-
lineHeight: 'normal',
|
|
86
|
-
height: 'auto',
|
|
87
|
-
minHeight: '20px',
|
|
88
|
-
minWidth: '20px',
|
|
89
|
-
overflow: 'hidden'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
component: {
|
|
93
|
-
name: 'Image',
|
|
94
|
-
options: {
|
|
95
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
96
|
-
backgroundPosition: 'center',
|
|
97
|
-
backgroundSize: 'cover',
|
|
98
|
-
aspectRatio: 0.7004048582995948
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
'@type': '@builder.io/sdk:Element',
|
|
103
|
-
responsiveStyles: {
|
|
104
|
-
large: {
|
|
105
|
-
display: 'flex',
|
|
106
|
-
flexDirection: 'column',
|
|
107
|
-
alignItems: 'stretch',
|
|
108
|
-
flexShrink: '0',
|
|
109
|
-
position: 'relative',
|
|
110
|
-
marginTop: '30px',
|
|
111
|
-
textAlign: 'center',
|
|
112
|
-
lineHeight: 'normal',
|
|
113
|
-
height: 'auto'
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
component: {
|
|
117
|
-
name: 'Text',
|
|
118
|
-
options: {
|
|
119
|
-
text: '<p>Enter some text...</p>'
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}]
|
|
123
|
-
}, {
|
|
124
|
-
blocks: [{
|
|
125
|
-
'@type': '@builder.io/sdk:Element',
|
|
126
|
-
responsiveStyles: {
|
|
127
|
-
large: {
|
|
128
|
-
display: 'flex',
|
|
129
|
-
flexDirection: 'column',
|
|
130
|
-
alignItems: 'stretch',
|
|
131
|
-
flexShrink: '0',
|
|
132
|
-
position: 'relative',
|
|
133
|
-
marginTop: '30px',
|
|
134
|
-
textAlign: 'center',
|
|
135
|
-
lineHeight: 'normal',
|
|
136
|
-
height: 'auto',
|
|
137
|
-
minHeight: '20px',
|
|
138
|
-
minWidth: '20px',
|
|
139
|
-
overflow: 'hidden'
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
component: {
|
|
143
|
-
name: 'Image',
|
|
144
|
-
options: {
|
|
145
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
146
|
-
backgroundPosition: 'center',
|
|
147
|
-
backgroundSize: 'cover',
|
|
148
|
-
aspectRatio: 0.7004048582995948
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
'@type': '@builder.io/sdk:Element',
|
|
153
|
-
responsiveStyles: {
|
|
154
|
-
large: {
|
|
155
|
-
display: 'flex',
|
|
156
|
-
flexDirection: 'column',
|
|
157
|
-
alignItems: 'stretch',
|
|
158
|
-
flexShrink: '0',
|
|
159
|
-
position: 'relative',
|
|
160
|
-
marginTop: '30px',
|
|
161
|
-
textAlign: 'center',
|
|
162
|
-
lineHeight: 'normal',
|
|
163
|
-
height: 'auto'
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
component: {
|
|
167
|
-
name: 'Text',
|
|
168
|
-
options: {
|
|
169
|
-
text: '<p>Enter some text...</p>'
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}]
|
|
173
|
-
}],
|
|
174
|
-
onChange: (options: Map<string, any>) => {
|
|
175
|
-
function clearWidths() {
|
|
176
|
-
columns.forEach(col => {
|
|
177
|
-
col.delete('width');
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
const columns: Array<Map<string, any>> = options.get('columns');
|
|
181
|
-
if (Array.isArray(columns)) {
|
|
182
|
-
const containsColumnWithWidth = !!columns.find(col => col.get('width'));
|
|
183
|
-
if (containsColumnWithWidth) {
|
|
184
|
-
const containsColumnWithoutWidth = !!columns.find(col => !col.get('width'));
|
|
185
|
-
if (containsColumnWithoutWidth) {
|
|
186
|
-
clearWidths();
|
|
187
|
-
} else {
|
|
188
|
-
const sumWidths = columns.reduce((memo, col) => {
|
|
189
|
-
return memo + col.get('width');
|
|
190
|
-
}, 0);
|
|
191
|
-
const widthsDontAddUp = sumWidths !== 100;
|
|
192
|
-
if (widthsDontAddUp) {
|
|
193
|
-
clearWidths();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}, {
|
|
200
|
-
name: 'space',
|
|
201
|
-
type: 'number',
|
|
202
|
-
defaultValue: 20,
|
|
203
|
-
helperText: 'Size of gap between columns',
|
|
204
|
-
advanced: true
|
|
205
|
-
}, {
|
|
206
|
-
name: 'stackColumnsAt',
|
|
207
|
-
type: 'string',
|
|
208
|
-
defaultValue: 'tablet',
|
|
209
|
-
helperText: 'Convert horizontal columns to vertical at what device size',
|
|
210
|
-
enum: ['tablet', 'mobile', 'never'],
|
|
211
|
-
advanced: true
|
|
212
|
-
}, {
|
|
213
|
-
name: 'reverseColumnsWhenStacked',
|
|
214
|
-
type: 'boolean',
|
|
215
|
-
defaultValue: false,
|
|
216
|
-
helperText: 'When stacking columns for mobile devices, reverse the ordering',
|
|
217
|
-
advanced: true
|
|
218
|
-
}]
|
|
219
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './columns'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
export const componentInfo: ComponentInfo = {
|
|
3
|
-
name: 'Custom Code',
|
|
4
|
-
static: true,
|
|
5
|
-
requiredPermissions: ['editCode'],
|
|
6
|
-
inputs: [{
|
|
7
|
-
name: 'code',
|
|
8
|
-
type: 'html',
|
|
9
|
-
required: true,
|
|
10
|
-
defaultValue: '<p>Hello there, I am custom HTML code!</p>',
|
|
11
|
-
code: true
|
|
12
|
-
}, {
|
|
13
|
-
name: 'replaceNodes',
|
|
14
|
-
type: 'boolean',
|
|
15
|
-
helperText: 'Preserve server rendered dom nodes',
|
|
16
|
-
advanced: true
|
|
17
|
-
}, {
|
|
18
|
-
name: 'scriptsClientOnly',
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
defaultValue: false,
|
|
21
|
-
helperText: 'Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads',
|
|
22
|
-
advanced: true
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { useState, useRef, useEffect } from "react";
|
|
13
|
-
|
|
14
|
-
export interface CustomCodeProps {
|
|
15
|
-
code: string;
|
|
16
|
-
replaceNodes?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function CustomCode(props: CustomCodeProps) {
|
|
20
|
-
const elementRef = useRef<any>(null);
|
|
21
|
-
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
|
22
|
-
|
|
23
|
-
const [scriptsRun, setScriptsRun] = useState(() => []);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
27
|
-
if (
|
|
28
|
-
!elementRef.current?.getElementsByTagName ||
|
|
29
|
-
typeof window === "undefined"
|
|
30
|
-
) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const scripts = elementRef.current.getElementsByTagName("script");
|
|
34
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
35
|
-
const script = scripts[i];
|
|
36
|
-
if (script.src) {
|
|
37
|
-
if (scriptsInserted.includes(script.src)) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
scriptsInserted.push(script.src);
|
|
41
|
-
const newScript = document.createElement("script");
|
|
42
|
-
newScript.async = true;
|
|
43
|
-
newScript.src = script.src;
|
|
44
|
-
document.head.appendChild(newScript);
|
|
45
|
-
} else if (
|
|
46
|
-
!script.type ||
|
|
47
|
-
[
|
|
48
|
-
"text/javascript",
|
|
49
|
-
"application/javascript",
|
|
50
|
-
"application/ecmascript",
|
|
51
|
-
].includes(script.type)
|
|
52
|
-
) {
|
|
53
|
-
if (scriptsRun.includes(script.innerText)) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
scriptsRun.push(script.innerText);
|
|
58
|
-
new Function(script.innerText)();
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<View ref={elementRef} dangerouslySetInnerHTML={{ __html: props.code }} />
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default CustomCode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './custom-code'
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
export const componentInfo: ComponentInfo = {
|
|
3
|
-
name: 'Embed',
|
|
4
|
-
static: true,
|
|
5
|
-
inputs: [{
|
|
6
|
-
name: 'url',
|
|
7
|
-
type: 'url',
|
|
8
|
-
required: true,
|
|
9
|
-
defaultValue: '',
|
|
10
|
-
helperText: 'e.g. enter a youtube url, google map, etc',
|
|
11
|
-
onChange: (options: Map<string, any>): void | Promise<void> => {
|
|
12
|
-
const url = options.get('url');
|
|
13
|
-
if (url) {
|
|
14
|
-
options.set('content', 'Loading...');
|
|
15
|
-
// TODO: get this out of here!
|
|
16
|
-
const apiKey = 'ae0e60e78201a3f2b0de4b';
|
|
17
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
|
|
18
|
-
if (options.get('url') === url) {
|
|
19
|
-
if (data.html) {
|
|
20
|
-
options.set('content', data.html);
|
|
21
|
-
} else {
|
|
22
|
-
options.set('content', 'Invalid url, please try another');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}).catch(_err => {
|
|
26
|
-
options.set('content', 'There was an error embedding this URL, please try again or another URL');
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
options.delete('content');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
name: 'content',
|
|
34
|
-
type: 'html',
|
|
35
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
36
|
-
hideFromUI: true
|
|
37
|
-
}]
|
|
38
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { useState, useRef, useEffect } from "react";
|
|
13
|
-
|
|
14
|
-
export interface EmbedProps {
|
|
15
|
-
content: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
import { isJsScript } from "./helpers";
|
|
19
|
-
|
|
20
|
-
function Embed(props: EmbedProps) {
|
|
21
|
-
const elem = useRef<HTMLDivElement>(null);
|
|
22
|
-
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
|
23
|
-
|
|
24
|
-
const [scriptsRun, setScriptsRun] = useState(() => []);
|
|
25
|
-
|
|
26
|
-
const [ranInitFn, setRanInitFn] = useState(() => false);
|
|
27
|
-
|
|
28
|
-
function findAndRunScripts() {
|
|
29
|
-
if (!elem.current || !elem.current.getElementsByTagName) return;
|
|
30
|
-
const scripts = elem.current.getElementsByTagName("script");
|
|
31
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
32
|
-
const script = scripts[i];
|
|
33
|
-
if (script.src && !scriptsInserted.includes(script.src)) {
|
|
34
|
-
scriptsInserted.push(script.src);
|
|
35
|
-
const newScript = document.createElement("script");
|
|
36
|
-
newScript.async = true;
|
|
37
|
-
newScript.src = script.src;
|
|
38
|
-
document.head.appendChild(newScript);
|
|
39
|
-
} else if (isJsScript(script) && !scriptsRun.includes(script.innerText)) {
|
|
40
|
-
try {
|
|
41
|
-
scriptsRun.push(script.innerText);
|
|
42
|
-
new Function(script.innerText)();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.warn("`Embed`: Error running script:", error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (elem.current && !ranInitFn) {
|
|
52
|
-
setRanInitFn(true);
|
|
53
|
-
findAndRunScripts();
|
|
54
|
-
}
|
|
55
|
-
}, [elem.current, ranInitFn]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<View ref={elem} dangerouslySetInnerHTML={{ __html: props.content }} />
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default Embed;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './embed'
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../../types/components';
|
|
2
|
-
export const componentInfo: ComponentInfo = {
|
|
3
|
-
name: 'Form:Form',
|
|
4
|
-
// editableTags: ['builder-form-error']
|
|
5
|
-
defaults: {
|
|
6
|
-
responsiveStyles: {
|
|
7
|
-
large: {
|
|
8
|
-
marginTop: '15px',
|
|
9
|
-
paddingBottom: '15px'
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5',
|
|
14
|
-
inputs: [{
|
|
15
|
-
name: 'sendSubmissionsTo',
|
|
16
|
-
type: 'string',
|
|
17
|
-
// TODO: save to builder data and user can download as csv
|
|
18
|
-
// TODO: easy for mode too or computed add/remove fields form mode
|
|
19
|
-
// so you can edit details and high level mode at same time...
|
|
20
|
-
// Later - more integrations like mailchimp
|
|
21
|
-
// /api/v1/form-submit?to=mailchimp
|
|
22
|
-
enum: [{
|
|
23
|
-
label: 'Send to email',
|
|
24
|
-
value: 'email',
|
|
25
|
-
helperText: 'Send form submissions to the email address of your choosing'
|
|
26
|
-
}, {
|
|
27
|
-
label: 'Custom',
|
|
28
|
-
value: 'custom',
|
|
29
|
-
helperText: 'Handle where the form requests go manually with a little code, e.g. to your own custom backend'
|
|
30
|
-
}],
|
|
31
|
-
defaultValue: 'email'
|
|
32
|
-
}, {
|
|
33
|
-
name: 'sendSubmissionsToEmail',
|
|
34
|
-
type: 'string',
|
|
35
|
-
required: true,
|
|
36
|
-
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
37
|
-
defaultValue: 'your@email.com',
|
|
38
|
-
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
39
|
-
}, {
|
|
40
|
-
name: 'sendWithJs',
|
|
41
|
-
type: 'boolean',
|
|
42
|
-
helperText: 'Set to false to use basic html form action',
|
|
43
|
-
defaultValue: true,
|
|
44
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
45
|
-
}, {
|
|
46
|
-
name: 'name',
|
|
47
|
-
type: 'string',
|
|
48
|
-
defaultValue: 'My form'
|
|
49
|
-
// advanced: true
|
|
50
|
-
}, {
|
|
51
|
-
name: 'action',
|
|
52
|
-
type: 'string',
|
|
53
|
-
helperText: 'URL to send the form data to',
|
|
54
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
55
|
-
}, {
|
|
56
|
-
name: 'contentType',
|
|
57
|
-
type: 'string',
|
|
58
|
-
defaultValue: 'application/json',
|
|
59
|
-
advanced: true,
|
|
60
|
-
// TODO: do automatically if file input
|
|
61
|
-
enum: ['application/json', 'multipart/form-data', 'application/x-www-form-urlencoded'],
|
|
62
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
63
|
-
}, {
|
|
64
|
-
name: 'method',
|
|
65
|
-
type: 'string',
|
|
66
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
67
|
-
defaultValue: 'POST',
|
|
68
|
-
advanced: true
|
|
69
|
-
}, {
|
|
70
|
-
name: 'previewState',
|
|
71
|
-
type: 'string',
|
|
72
|
-
// TODO: persist: false flag
|
|
73
|
-
enum: ['unsubmitted', 'sending', 'success', 'error'],
|
|
74
|
-
defaultValue: 'unsubmitted',
|
|
75
|
-
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
76
|
-
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
77
|
-
}, {
|
|
78
|
-
name: 'successUrl',
|
|
79
|
-
type: 'url',
|
|
80
|
-
helperText: 'Optional URL to redirect the user to on form submission success',
|
|
81
|
-
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
82
|
-
}, {
|
|
83
|
-
name: 'resetFormOnSubmit',
|
|
84
|
-
type: 'boolean',
|
|
85
|
-
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
86
|
-
advanced: true
|
|
87
|
-
}, {
|
|
88
|
-
name: 'successMessage',
|
|
89
|
-
type: 'uiBlocks',
|
|
90
|
-
hideFromUI: true,
|
|
91
|
-
defaultValue: [{
|
|
92
|
-
'@type': '@builder.io/sdk:Element',
|
|
93
|
-
responsiveStyles: {
|
|
94
|
-
large: {
|
|
95
|
-
marginTop: '10px'
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
component: {
|
|
99
|
-
name: 'Text',
|
|
100
|
-
options: {
|
|
101
|
-
text: '<span>Thanks!</span>'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}]
|
|
105
|
-
}, {
|
|
106
|
-
name: 'validate',
|
|
107
|
-
type: 'boolean',
|
|
108
|
-
defaultValue: true,
|
|
109
|
-
advanced: true
|
|
110
|
-
}, {
|
|
111
|
-
name: 'errorMessagePath',
|
|
112
|
-
type: 'text',
|
|
113
|
-
advanced: true,
|
|
114
|
-
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" }}'
|
|
115
|
-
}, {
|
|
116
|
-
name: 'errorMessage',
|
|
117
|
-
type: 'uiBlocks',
|
|
118
|
-
hideFromUI: true,
|
|
119
|
-
defaultValue: [{
|
|
120
|
-
'@type': '@builder.io/sdk:Element',
|
|
121
|
-
responsiveStyles: {
|
|
122
|
-
large: {
|
|
123
|
-
marginTop: '10px'
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
bindings: {
|
|
127
|
-
'component.options.text': 'state.formErrorMessage || block.component.options.text'
|
|
128
|
-
},
|
|
129
|
-
component: {
|
|
130
|
-
name: 'Text',
|
|
131
|
-
options: {
|
|
132
|
-
text: '<span>Form submission error :( Please check your answers and try again</span>'
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}]
|
|
136
|
-
}, {
|
|
137
|
-
name: 'sendingMessage',
|
|
138
|
-
type: 'uiBlocks',
|
|
139
|
-
hideFromUI: true,
|
|
140
|
-
defaultValue: [{
|
|
141
|
-
'@type': '@builder.io/sdk:Element',
|
|
142
|
-
responsiveStyles: {
|
|
143
|
-
large: {
|
|
144
|
-
marginTop: '10px'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
component: {
|
|
148
|
-
name: 'Text',
|
|
149
|
-
options: {
|
|
150
|
-
text: '<span>Sending...</span>'
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}]
|
|
154
|
-
}, {
|
|
155
|
-
name: 'customHeaders',
|
|
156
|
-
type: 'map',
|
|
157
|
-
valueType: {
|
|
158
|
-
type: 'string'
|
|
159
|
-
},
|
|
160
|
-
advanced: true,
|
|
161
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
162
|
-
}],
|
|
163
|
-
noWrap: true,
|
|
164
|
-
canHaveChildren: true,
|
|
165
|
-
defaultChildren: [{
|
|
166
|
-
'@type': '@builder.io/sdk:Element',
|
|
167
|
-
responsiveStyles: {
|
|
168
|
-
large: {
|
|
169
|
-
marginTop: '10px'
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
component: {
|
|
173
|
-
name: 'Text',
|
|
174
|
-
options: {
|
|
175
|
-
text: '<span>Enter your name</span>'
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
'@type': '@builder.io/sdk:Element',
|
|
180
|
-
responsiveStyles: {
|
|
181
|
-
large: {
|
|
182
|
-
marginTop: '10px'
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
component: {
|
|
186
|
-
name: 'Form:Input',
|
|
187
|
-
options: {
|
|
188
|
-
name: 'name',
|
|
189
|
-
placeholder: 'Jane Doe'
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, {
|
|
193
|
-
'@type': '@builder.io/sdk:Element',
|
|
194
|
-
responsiveStyles: {
|
|
195
|
-
large: {
|
|
196
|
-
marginTop: '10px'
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
component: {
|
|
200
|
-
name: 'Text',
|
|
201
|
-
options: {
|
|
202
|
-
text: '<span>Enter your email</span>'
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
206
|
-
'@type': '@builder.io/sdk:Element',
|
|
207
|
-
responsiveStyles: {
|
|
208
|
-
large: {
|
|
209
|
-
marginTop: '10px'
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
component: {
|
|
213
|
-
name: 'Form:Input',
|
|
214
|
-
options: {
|
|
215
|
-
name: 'email',
|
|
216
|
-
placeholder: 'jane@doe.com'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, {
|
|
220
|
-
'@type': '@builder.io/sdk:Element',
|
|
221
|
-
responsiveStyles: {
|
|
222
|
-
large: {
|
|
223
|
-
marginTop: '10px'
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
component: {
|
|
227
|
-
name: 'Form:SubmitButton',
|
|
228
|
-
options: {
|
|
229
|
-
text: 'Submit'
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}]
|
|
233
|
-
}
|