@builder.io/sdk-react-native 0.0.1-68 → 0.0.1-69
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/package.json +1 -1
- package/src/blocks/button/component-info.js +0 -1
- package/src/blocks/columns/component-info.js +3 -3
- package/src/blocks/custom-code/component-info.js +0 -1
- package/src/blocks/embed/component-info.js +3 -3
- package/src/blocks/embed/helpers.js +0 -1
- package/src/blocks/form/component-info.js +0 -1
- package/src/blocks/form/form.js +5 -2
- package/src/blocks/fragment/component-info.js +0 -1
- package/src/blocks/image/component-info.js +3 -3
- package/src/blocks/image/image.helpers.js +0 -1
- package/src/blocks/image/image.js +0 -1
- package/src/blocks/img/component-info.js +0 -1
- package/src/blocks/img/img.js +1 -1
- package/src/blocks/input/component-info.js +0 -1
- package/src/blocks/raw-text/component-info.js +0 -1
- package/src/blocks/section/component-info.js +0 -1
- package/src/blocks/select/component-info.js +0 -1
- package/src/blocks/submit-button/component-info.js +0 -1
- package/src/blocks/symbol/component-info.js +0 -1
- package/src/blocks/text/component-info.js +0 -1
- package/src/blocks/text/text.js +0 -1
- package/src/blocks/textarea/component-info.js +0 -1
- package/src/blocks/util.js +7 -0
- package/src/blocks/video/component-info.js +0 -1
- package/src/blocks/video/video.js +0 -1
- package/src/components/render-block/block-styles.js +5 -8
- package/src/components/render-block/render-block.helpers.js +0 -1
- package/src/components/render-block/render-block.js +22 -20
- package/src/components/render-block/render-component.js +4 -2
- package/src/components/render-block/render-repeated-block.js +2 -1
- package/src/components/render-block/types.js +0 -1
- package/src/components/render-blocks.js +7 -2
- package/src/components/render-content/index.js +0 -1
- package/src/components/render-content/render-content.js +13 -2
- package/src/constants/builder-registered-components.js +0 -1
- package/src/constants/device-sizes.js +0 -1
- package/src/constants/target.js +0 -1
- package/src/functions/camel-to-kebab-case.js +0 -1
- package/src/functions/convert-style-object.js +0 -1
- package/src/functions/evaluate.js +0 -1
- package/src/functions/event-handler-name.js +0 -1
- package/src/functions/get-block-actions.js +0 -1
- package/src/functions/get-block-component-options.js +0 -1
- package/src/functions/get-block-properties.js +0 -1
- package/src/functions/get-block-styles.js +0 -1
- package/src/functions/get-block-tag.js +0 -1
- package/src/functions/get-builder-search-params/fn.test.js +0 -1
- package/src/functions/get-builder-search-params/index.js +0 -1
- package/src/functions/get-content/ab-testing.js +0 -1
- package/src/functions/get-content/fn.test.js +0 -1
- package/src/functions/get-content/index.js +0 -1
- package/src/functions/get-content/types.js +0 -1
- package/src/functions/get-fetch.js +2 -3
- package/src/functions/get-global-this.js +0 -1
- package/src/functions/get-processed-block.js +10 -7
- package/src/functions/get-processed-block.test.js +1 -2
- package/src/functions/if-target.js +0 -1
- package/src/functions/is-browser.js +0 -1
- package/src/functions/is-editing.js +0 -1
- package/src/functions/is-iframe.js +0 -1
- package/src/functions/is-previewing.js +0 -1
- package/src/functions/is-react-native.js +0 -1
- package/src/functions/on-change.js +0 -1
- package/src/functions/on-change.test.js +0 -1
- package/src/functions/register-component.js +0 -1
- package/src/functions/register.js +0 -1
- package/src/functions/sanitize-styles.js +0 -1
- package/src/functions/set-editor-settings.js +0 -1
- package/src/functions/set.js +0 -1
- package/src/functions/set.test.js +0 -1
- package/src/functions/track.js +0 -1
- package/src/functions/transform-block.js +0 -1
- package/src/helpers/cookie.js +0 -1
- package/src/helpers/css.js +0 -1
- package/src/helpers/flatten.js +0 -1
- package/src/helpers/localStorage.js +0 -1
- package/src/helpers/nullable.js +0 -1
- package/src/helpers/sessionId.js +0 -1
- package/src/helpers/time.js +0 -1
- package/src/helpers/url.js +0 -1
- package/src/helpers/url.test.js +0 -1
- package/src/helpers/uuid.js +0 -1
- package/src/helpers/visitorId.js +0 -1
- package/src/index-helpers/blocks-exports.js +0 -1
- package/src/index-helpers/top-of-file.js +0 -1
- package/src/index.js +0 -1
- package/src/scripts/init-editing.js +4 -6
- package/src/types/builder-block.js +0 -1
- package/src/types/builder-content.js +0 -1
- package/src/types/can-track.js +0 -1
- package/src/types/components.js +0 -1
- package/src/types/deep-partial.js +0 -1
- package/src/types/element.js +0 -1
- package/src/types/targets.js +0 -1
- package/src/types/typescript.js +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "0.0.1-
|
|
4
|
+
"version": "0.0.1-69",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { markSerializable } from "../util";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Columns",
|
|
4
4
|
builtIn: true,
|
|
@@ -187,7 +187,7 @@ const componentInfo = {
|
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
],
|
|
190
|
-
onChange(options) {
|
|
190
|
+
onChange: markSerializable((options) => {
|
|
191
191
|
function clearWidths() {
|
|
192
192
|
columns.forEach((col) => {
|
|
193
193
|
col.delete("width");
|
|
@@ -211,7 +211,7 @@ const componentInfo = {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
}
|
|
214
|
+
})
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
name: "space",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { markSerializable } from "../util";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Embed",
|
|
4
4
|
static: true,
|
|
@@ -10,7 +10,7 @@ const componentInfo = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
defaultValue: "",
|
|
12
12
|
helperText: "e.g. enter a youtube url, google map, etc",
|
|
13
|
-
onChange(options) {
|
|
13
|
+
onChange: markSerializable((options) => {
|
|
14
14
|
const url = options.get("url");
|
|
15
15
|
if (url) {
|
|
16
16
|
options.set("content", "Loading...");
|
|
@@ -29,7 +29,7 @@ const componentInfo = {
|
|
|
29
29
|
} else {
|
|
30
30
|
options.delete("content");
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
})
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
name: "content",
|
package/src/blocks/form/form.js
CHANGED
|
@@ -39,8 +39,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
import * as React from "react";
|
|
41
41
|
import { View, StyleSheet, Text } from "react-native";
|
|
42
|
-
import { useState, useRef } from "react";
|
|
42
|
+
import { useState, useContext, useRef } from "react";
|
|
43
43
|
import RenderBlock from "../../components/render-block/render-block.js";
|
|
44
|
+
import BuilderBlocks from "../../components/render-blocks.js";
|
|
44
45
|
import { isEditing } from "../../functions/is-editing.js";
|
|
45
46
|
function FormComponent(props) {
|
|
46
47
|
var _a, _b;
|
|
@@ -191,6 +192,7 @@ function FormComponent(props) {
|
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
194
|
}
|
|
195
|
+
const builderContext = useContext(BuilderContext);
|
|
194
196
|
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
195
197
|
validate: props.validate,
|
|
196
198
|
ref: formRef,
|
|
@@ -199,7 +201,8 @@ function FormComponent(props) {
|
|
|
199
201
|
name: props.name,
|
|
200
202
|
onSubmit: (event) => onSubmit(event)
|
|
201
203
|
}), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
202
|
-
block
|
|
204
|
+
block,
|
|
205
|
+
context: builderContext
|
|
203
206
|
}))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
|
|
204
207
|
dataPath: "errorMessage",
|
|
205
208
|
blocks: props.errorMessage
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { markSerializable } from "../util";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Image",
|
|
4
4
|
static: true,
|
|
@@ -19,7 +19,7 @@ const componentInfo = {
|
|
|
19
19
|
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
20
20
|
required: true,
|
|
21
21
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
22
|
-
onChange(options) {
|
|
22
|
+
onChange: markSerializable((options) => {
|
|
23
23
|
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
24
24
|
options.delete("srcset");
|
|
25
25
|
options.delete("noWebp");
|
|
@@ -65,7 +65,7 @@ const componentInfo = {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
})
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
name: "backgroundSize",
|
package/src/blocks/img/img.js
CHANGED
package/src/blocks/text/text.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
|
|
3
3
|
import { TARGET } from "../../constants/target.js";
|
|
4
|
-
import BuilderContext from "../../context/builder.context";
|
|
5
4
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
6
|
-
import RenderInlinedStyles from "../render-inlined-styles.js";
|
|
7
5
|
import { convertStyleMaptoCSS } from "../../helpers/css.js";
|
|
8
|
-
import
|
|
6
|
+
import RenderInlinedStyles from "../render-inlined-styles.js";
|
|
9
7
|
function BlockStyles(props) {
|
|
10
8
|
function useBlock() {
|
|
11
9
|
return getProcessedBlock({
|
|
12
10
|
block: props.block,
|
|
13
|
-
state:
|
|
14
|
-
context:
|
|
15
|
-
|
|
11
|
+
state: props.context.state,
|
|
12
|
+
context: props.context.context,
|
|
13
|
+
shouldEvaluateBindings: true
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
function css() {
|
|
@@ -30,7 +28,6 @@ function BlockStyles(props) {
|
|
|
30
28
|
}` : ""}
|
|
31
29
|
}`;
|
|
32
30
|
}
|
|
33
|
-
const builderContext = useContext(BuilderContext);
|
|
34
31
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
|
|
35
32
|
styles: css()
|
|
36
33
|
})) : null);
|
|
@@ -30,8 +30,6 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import * as React from "react";
|
|
33
|
-
import { useContext } from "react";
|
|
34
|
-
import BuilderContext from "../../context/builder.context";
|
|
35
33
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
36
34
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
37
35
|
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
@@ -49,14 +47,14 @@ function RenderBlock(props) {
|
|
|
49
47
|
var _a2;
|
|
50
48
|
const componentName = (_a2 = getProcessedBlock({
|
|
51
49
|
block: props.block,
|
|
52
|
-
state:
|
|
53
|
-
context:
|
|
54
|
-
|
|
50
|
+
state: props.context.state,
|
|
51
|
+
context: props.context.context,
|
|
52
|
+
shouldEvaluateBindings: false
|
|
55
53
|
}).component) == null ? void 0 : _a2.name;
|
|
56
54
|
if (!componentName) {
|
|
57
55
|
return null;
|
|
58
56
|
}
|
|
59
|
-
const ref =
|
|
57
|
+
const ref = props.context.registeredComponents[componentName];
|
|
60
58
|
if (!ref) {
|
|
61
59
|
console.warn(`
|
|
62
60
|
Could not find a registered component named "${componentName}".
|
|
@@ -84,16 +82,16 @@ function RenderBlock(props) {
|
|
|
84
82
|
function useBlock() {
|
|
85
83
|
return repeatItemData() ? props.block : getProcessedBlock({
|
|
86
84
|
block: props.block,
|
|
87
|
-
state:
|
|
88
|
-
context:
|
|
89
|
-
|
|
85
|
+
state: props.context.state,
|
|
86
|
+
context: props.context.context,
|
|
87
|
+
shouldEvaluateBindings: true
|
|
90
88
|
});
|
|
91
89
|
}
|
|
92
90
|
function attributes() {
|
|
93
91
|
return __spreadProps(__spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
94
92
|
block: useBlock(),
|
|
95
|
-
state:
|
|
96
|
-
context:
|
|
93
|
+
state: props.context.state,
|
|
94
|
+
context: props.context.context
|
|
97
95
|
})), {
|
|
98
96
|
style: getBlockStyles(useBlock())
|
|
99
97
|
});
|
|
@@ -111,7 +109,8 @@ function RenderBlock(props) {
|
|
|
111
109
|
return {
|
|
112
110
|
blockChildren: children(),
|
|
113
111
|
componentRef: componentRef(),
|
|
114
|
-
componentOptions: componentOptions()
|
|
112
|
+
componentOptions: componentOptions(),
|
|
113
|
+
context: props.context
|
|
115
114
|
};
|
|
116
115
|
}
|
|
117
116
|
function children() {
|
|
@@ -129,8 +128,8 @@ function RenderBlock(props) {
|
|
|
129
128
|
}
|
|
130
129
|
const itemsArray = evaluate({
|
|
131
130
|
code: repeat.collection,
|
|
132
|
-
state:
|
|
133
|
-
context:
|
|
131
|
+
state: props.context.state,
|
|
132
|
+
context: props.context.context
|
|
134
133
|
});
|
|
135
134
|
if (!Array.isArray(itemsArray)) {
|
|
136
135
|
return void 0;
|
|
@@ -138,8 +137,8 @@ function RenderBlock(props) {
|
|
|
138
137
|
const collectionName = repeat.collection.split(".").pop();
|
|
139
138
|
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
140
139
|
const repeatArray = itemsArray.map((item, index) => ({
|
|
141
|
-
context: __spreadProps(__spreadValues({},
|
|
142
|
-
state: __spreadProps(__spreadValues({},
|
|
140
|
+
context: __spreadProps(__spreadValues({}, props.context), {
|
|
141
|
+
state: __spreadProps(__spreadValues({}, props.context.state), {
|
|
143
142
|
$index: index,
|
|
144
143
|
$item: item,
|
|
145
144
|
[itemNameToUse]: item,
|
|
@@ -150,7 +149,6 @@ function RenderBlock(props) {
|
|
|
150
149
|
}));
|
|
151
150
|
return repeatArray;
|
|
152
151
|
}
|
|
153
|
-
const builderContext = useContext(BuilderContext);
|
|
154
152
|
const TagNameRef = tagName();
|
|
155
153
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, shouldWrap() ? /* @__PURE__ */ React.createElement(React.Fragment, null, !isEmptyHtmlElement(tagName()) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()), repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = repeatItemData()) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
|
|
156
154
|
key: index,
|
|
@@ -158,11 +156,15 @@ function RenderBlock(props) {
|
|
|
158
156
|
block: data.block
|
|
159
157
|
}))) : null, !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderComponent, __spreadValues({}, renderComponentProps()))) : null, (_b = childrenWithoutParentComponent()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
160
158
|
key: "render-block-" + child.id,
|
|
161
|
-
block: child
|
|
159
|
+
block: child,
|
|
160
|
+
context: props.context
|
|
162
161
|
})), (_c = childrenWithoutParentComponent()) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
163
162
|
key: "block-style-" + child.id,
|
|
164
|
-
block: child
|
|
165
|
-
|
|
163
|
+
block: child,
|
|
164
|
+
context: props.context
|
|
165
|
+
})))) : /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : /* @__PURE__ */ React.createElement(RenderComponent, __spreadProps(__spreadValues({}, renderComponentProps()), {
|
|
166
|
+
context: props.context
|
|
167
|
+
})));
|
|
166
168
|
}
|
|
167
169
|
export {
|
|
168
170
|
RenderBlock as default
|
|
@@ -22,10 +22,12 @@ function RenderComponent(props) {
|
|
|
22
22
|
const ComponentRefRef = props.componentRef;
|
|
23
23
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.componentRef ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, props.componentOptions), (_a = props.blockChildren) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
24
24
|
key: "render-block-" + child.id,
|
|
25
|
-
block: child
|
|
25
|
+
block: child,
|
|
26
|
+
context: props.context
|
|
26
27
|
})), (_b = props.blockChildren) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
27
28
|
key: "block-style-" + child.id,
|
|
28
|
-
block: child
|
|
29
|
+
block: child,
|
|
30
|
+
context: props.context
|
|
29
31
|
})))) : null);
|
|
30
32
|
}
|
|
31
33
|
export {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import BuilderContext from "../context/builder.context";
|
|
3
5
|
import { isEditing } from "../functions/is-editing.js";
|
|
4
6
|
import BlockStyles from "./render-block/block-styles.js";
|
|
5
7
|
import RenderBlock from "./render-block/render-block.js";
|
|
@@ -33,6 +35,7 @@ function RenderBlocks(props) {
|
|
|
33
35
|
}, "*");
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
const builderContext = useContext(BuilderContext);
|
|
36
39
|
return /* @__PURE__ */ React.createElement(View, {
|
|
37
40
|
"builder-path": props.path,
|
|
38
41
|
"builder-parent-id": props.parent,
|
|
@@ -44,10 +47,12 @@ function RenderBlocks(props) {
|
|
|
44
47
|
style: styles.view1
|
|
45
48
|
}, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = props.blocks) == null ? void 0 : _a.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
46
49
|
key: "render-block-" + block.id,
|
|
47
|
-
block
|
|
50
|
+
block,
|
|
51
|
+
context: builderContext
|
|
48
52
|
}))) : null, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = props.blocks) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
49
53
|
key: "block-style-" + block.id,
|
|
50
|
-
block
|
|
54
|
+
block,
|
|
55
|
+
context: builderContext
|
|
51
56
|
}))) : null);
|
|
52
57
|
}
|
|
53
58
|
const styles = StyleSheet.create({
|
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
import * as React from "react";
|
|
41
41
|
import { View } from "react-native";
|
|
42
|
-
import { useState, useEffect } from "react";
|
|
42
|
+
import { useState, useRef, useEffect } from "react";
|
|
43
43
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
44
44
|
import { TARGET } from "../../constants/target.js";
|
|
45
45
|
import BuilderContext from "../../context/builder.context";
|
|
@@ -56,8 +56,14 @@ import {
|
|
|
56
56
|
import { track } from "../../functions/track.js";
|
|
57
57
|
import RenderBlocks from "../render-blocks.js";
|
|
58
58
|
import RenderContentStyles from "./components/render-styles.js";
|
|
59
|
+
import {
|
|
60
|
+
registerInsertMenu,
|
|
61
|
+
setupBrowserForEditing
|
|
62
|
+
} from "../../scripts/init-editing.js";
|
|
59
63
|
function RenderContent(props) {
|
|
60
64
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
65
|
+
const elementRef = useRef(null);
|
|
66
|
+
const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
|
|
61
67
|
function useContent() {
|
|
62
68
|
var _a2;
|
|
63
69
|
const mergedContent = __spreadProps(__spreadValues(__spreadValues({}, props.content), overrideContent), {
|
|
@@ -179,6 +185,9 @@ function RenderContent(props) {
|
|
|
179
185
|
useEffect(() => {
|
|
180
186
|
if (isBrowser()) {
|
|
181
187
|
if (isEditing()) {
|
|
188
|
+
setForceReRenderCount(forceReRenderCount + 1);
|
|
189
|
+
registerInsertMenu();
|
|
190
|
+
setupBrowserForEditing();
|
|
182
191
|
Object.values(allRegisteredComponents()).forEach((registeredComponent) => {
|
|
183
192
|
var _a2;
|
|
184
193
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
@@ -252,13 +261,15 @@ function RenderContent(props) {
|
|
|
252
261
|
}
|
|
253
262
|
}
|
|
254
263
|
}, useContent() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
|
|
264
|
+
ref: elementRef,
|
|
255
265
|
onClick: (event) => onClick(event),
|
|
256
266
|
"builder-content-id": (_e = useContent == null ? void 0 : useContent()) == null ? void 0 : _e.id
|
|
257
267
|
}, shouldRenderContentStyles() ? /* @__PURE__ */ React.createElement(RenderContentStyles, {
|
|
258
268
|
cssCode: (_g = (_f = useContent == null ? void 0 : useContent()) == null ? void 0 : _f.data) == null ? void 0 : _g.cssCode,
|
|
259
269
|
customFonts: (_i = (_h = useContent == null ? void 0 : useContent()) == null ? void 0 : _h.data) == null ? void 0 : _i.customFonts
|
|
260
270
|
}) : null, /* @__PURE__ */ React.createElement(RenderBlocks, {
|
|
261
|
-
blocks: (_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks
|
|
271
|
+
blocks: (_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks,
|
|
272
|
+
key: forceReRenderCount
|
|
262
273
|
}))) : null);
|
|
263
274
|
}
|
|
264
275
|
export {
|
package/src/constants/target.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { convertSearchParamsToQueryObject, getBuilderSearchParams } from ".";
|
|
3
2
|
const querystring = "someotherValue=jklsjfdal&abc=klfdjklgfds&builder.cachebust=true&builder.preview=page&builder.noCache=true&__builder_editing__=true&builder.overrides.page=037948e52eaf4743afed464f02c70da4&builder.overrides.037948e52eaf4743afed464f02c70da4=037948e52eaf4743afed464f02c70da4&builder.overrides.page%3A%2F=037948e52eaf4743afed464f02c70da4&preview_theme_id=128854393017";
|
|
4
3
|
const url = new URL(`localhost:3000/about-us?${querystring}`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
var __async = (__this, __arguments, generator) => {
|
|
3
2
|
return new Promise((resolve, reject) => {
|
|
4
3
|
var fulfilled = (value) => {
|
|
@@ -25,9 +24,9 @@ function getFetch() {
|
|
|
25
24
|
const globalFetch = getGlobalThis().fetch;
|
|
26
25
|
if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
|
|
27
26
|
const nodeFetch = import("node-fetch").then((d) => d.default);
|
|
28
|
-
return nodeFetch;
|
|
27
|
+
return nodeFetch.default || nodeFetch;
|
|
29
28
|
}
|
|
30
|
-
return globalFetch;
|
|
29
|
+
return globalFetch.default || globalFetch;
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
export {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -40,13 +39,17 @@ const evaluateBindings = ({
|
|
|
40
39
|
}
|
|
41
40
|
return copied;
|
|
42
41
|
};
|
|
43
|
-
function getProcessedBlock(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
function getProcessedBlock({
|
|
43
|
+
block,
|
|
44
|
+
context,
|
|
45
|
+
shouldEvaluateBindings,
|
|
46
|
+
state
|
|
47
|
+
}) {
|
|
48
|
+
const transformedBlock = transformBlock(block);
|
|
49
|
+
if (shouldEvaluateBindings) {
|
|
50
|
+
return evaluateBindings({ block: transformedBlock, state, context });
|
|
48
51
|
} else {
|
|
49
|
-
return
|
|
52
|
+
return transformedBlock;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
export {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { getProcessedBlock } from "./get-processed-block.js";
|
|
3
2
|
test("Can process bindings", () => {
|
|
4
3
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -22,7 +21,7 @@ test("Can process bindings", () => {
|
|
|
22
21
|
block,
|
|
23
22
|
context: {},
|
|
24
23
|
state: { test: "hello" },
|
|
25
|
-
|
|
24
|
+
shouldEvaluateBindings: true
|
|
26
25
|
});
|
|
27
26
|
expect(processed).not.toEqual(block);
|
|
28
27
|
expect((_a = processed.properties) == null ? void 0 : _a.foo).toEqual("baz");
|
package/src/functions/set.js
CHANGED
package/src/functions/track.js
CHANGED
package/src/helpers/cookie.js
CHANGED
package/src/helpers/css.js
CHANGED
package/src/helpers/flatten.js
CHANGED
package/src/helpers/nullable.js
CHANGED
package/src/helpers/sessionId.js
CHANGED
package/src/helpers/time.js
CHANGED
package/src/helpers/url.js
CHANGED
package/src/helpers/url.test.js
CHANGED
package/src/helpers/uuid.js
CHANGED
package/src/helpers/visitorId.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { TARGET } from "../constants/target.js";
|
|
3
2
|
import { isBrowser } from "../functions/is-browser.js";
|
|
4
|
-
import { isEditing } from "../functions/is-editing.js";
|
|
5
3
|
import { register } from "../functions/register.js";
|
|
6
4
|
const registerInsertMenu = () => {
|
|
7
5
|
register("insertMenu", {
|
|
@@ -75,7 +73,7 @@ const setupBrowserForEditing = () => {
|
|
|
75
73
|
});
|
|
76
74
|
}
|
|
77
75
|
};
|
|
78
|
-
|
|
79
|
-
registerInsertMenu
|
|
80
|
-
setupBrowserForEditing
|
|
81
|
-
}
|
|
76
|
+
export {
|
|
77
|
+
registerInsertMenu,
|
|
78
|
+
setupBrowserForEditing
|
|
79
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
package/src/types/can-track.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
package/src/types/components.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
package/src/types/element.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
package/src/types/targets.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
package/src/types/typescript.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|