@builder.io/sdk-react-native 0.0.1-38 → 0.0.1-44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # Builder.io React-native SDK (BETA)
2
+
3
+ This is the React-Native SDK. It is currently in beta.
4
+
5
+ ## Feature Support
6
+
7
+ To check the status of the SDK, look at [these tables](../../README.md#feature-implementation).
8
+
9
+ ## Getting Started
10
+
11
+ ```
12
+ npm install @builder.io/sdk-react-native@dev
13
+ ```
14
+
15
+ Take a look at [our example repo](/examples/react-native) for how to use this SDK.
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react-native",
3
3
  "description": "Builder.io SDK for React Native",
4
- "version": "0.0.1-38",
4
+ "version": "0.0.1-44",
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"
8
8
  },
9
9
  "dependencies": {
10
- "react-native-render-html": "^5.1.1",
10
+ "react-native-render-html": "^6.3.4",
11
11
  "react-native-video": "^5.1.1"
12
12
  },
13
13
  "peerDependencies": {
14
- "react-native": "^0.64.2"
14
+ "react-native": "^0.64.3"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/react-native-video": "^5.0.9",
18
- "react-native": "^0.64.2"
18
+ "react-native": "^0.64.3"
19
19
  }
20
20
  }
@@ -12,14 +12,44 @@ function Columns(props) {
12
12
  return props.columns || [];
13
13
  }
14
14
  function getWidth(index) {
15
- const columns = this.getColumns();
16
- return (columns[index] && columns[index].width) || 100 / columns.length;
15
+ var _a2;
16
+ const columns = getColumns();
17
+ return (
18
+ ((_a2 = columns[index]) == null ? void 0 : _a2.width) ||
19
+ 100 / columns.length
20
+ );
17
21
  }
18
22
  function getColumnCssWidth(index) {
19
- const columns = this.getColumns();
20
- const gutterSize = this.getGutterSize();
23
+ const columns = getColumns();
24
+ const gutterSize = getGutterSize();
21
25
  const subtractWidth = (gutterSize * (columns.length - 1)) / columns.length;
22
- return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
26
+ return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
27
+ }
28
+ function maybeApplyForTablet(prop) {
29
+ const stackColumnsAt = props.stackColumnsAt || 'tablet';
30
+ return stackColumnsAt === 'tablet' ? prop : 'inherit';
31
+ }
32
+ function columnsCssVars() {
33
+ const flexDir =
34
+ props.stackColumnsAt === 'never'
35
+ ? 'inherit'
36
+ : props.reverseColumnsWhenStacked
37
+ ? 'column-reverse'
38
+ : 'column';
39
+ return {
40
+ '--flex-dir': flexDir,
41
+ '--flex-dir-tablet': maybeApplyForTablet(flexDir),
42
+ };
43
+ }
44
+ function columnCssVars() {
45
+ const width = '100%';
46
+ const marginLeft = '0';
47
+ return {
48
+ '--column-width': width,
49
+ '--column-margin-left': marginLeft,
50
+ '--column-width-tablet': maybeApplyForTablet(width),
51
+ '--column-margin-left-tablet': maybeApplyForTablet(marginLeft),
52
+ };
23
53
  }
24
54
  return /* @__PURE__ */ React.createElement(
25
55
  View,
@@ -12,15 +12,44 @@ export default function Columns(props) {
12
12
  }
13
13
 
14
14
  function getWidth(index) {
15
- const columns = this.getColumns();
16
- return (columns[index] && columns[index].width) || 100 / columns.length;
15
+ const columns = getColumns();
16
+ return columns[index]?.width || 100 / columns.length;
17
17
  }
18
18
 
19
19
  function getColumnCssWidth(index) {
20
- const columns = this.getColumns();
21
- const gutterSize = this.getGutterSize();
20
+ const columns = getColumns();
21
+ const gutterSize = getGutterSize();
22
22
  const subtractWidth = (gutterSize * (columns.length - 1)) / columns.length;
23
- return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
23
+ return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
24
+ }
25
+
26
+ function maybeApplyForTablet(prop) {
27
+ const stackColumnsAt = props.stackColumnsAt || 'tablet';
28
+ return stackColumnsAt === 'tablet' ? prop : 'inherit';
29
+ }
30
+
31
+ function columnsCssVars() {
32
+ const flexDir =
33
+ props.stackColumnsAt === 'never'
34
+ ? 'inherit'
35
+ : props.reverseColumnsWhenStacked
36
+ ? 'column-reverse'
37
+ : 'column';
38
+ return {
39
+ '--flex-dir': flexDir,
40
+ '--flex-dir-tablet': maybeApplyForTablet(flexDir),
41
+ };
42
+ }
43
+
44
+ function columnCssVars() {
45
+ const width = '100%';
46
+ const marginLeft = '0';
47
+ return {
48
+ '--column-width': width,
49
+ '--column-margin-left': marginLeft,
50
+ '--column-width-tablet': maybeApplyForTablet(width),
51
+ '--column-margin-left-tablet': maybeApplyForTablet(marginLeft),
52
+ };
24
53
  }
25
54
 
26
55
  return (
@@ -141,7 +141,7 @@ export default function FormComponent(props) {
141
141
  get(body, props.errorMessagePath);
142
142
  if (message) {
143
143
  if (typeof message !== 'string') {
144
- /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
144
+ /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
145
145
  JSON.stringify(message);
146
146
  }
147
147
  setFormErrorMessage(message);
@@ -1,24 +1,60 @@
1
1
  import * as React from 'react';
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) =>
7
+ key in obj
8
+ ? __defProp(obj, key, {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value,
13
+ })
14
+ : (obj[key] = value);
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
2
24
  import { Image as ReactImage, View } from 'react-native';
3
25
  import { registerComponent } from '../functions/register-component';
4
26
  function Image(props) {
5
- return /* @__PURE__ */ React.createElement(
6
- View,
7
- {
8
- style: { position: 'relative' },
9
- },
10
- /* @__PURE__ */ React.createElement(ReactImage, {
11
- resizeMode: props.backgroundSize || 'contain',
12
- style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 },
13
- source: { uri: props.image },
14
- }),
15
- /* @__PURE__ */ React.createElement(View, {
16
- style: {
17
- width: '100%',
18
- paddingTop: props.aspectRatio * 100 + '%',
19
- },
20
- })
21
- );
27
+ return props.aspectRatio
28
+ ? /* @__PURE__ */ React.createElement(
29
+ View,
30
+ {
31
+ style: { position: 'relative' },
32
+ },
33
+ /* @__PURE__ */ React.createElement(ReactImage, {
34
+ resizeMode: props.backgroundSize || 'contain',
35
+ style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 },
36
+ source: { uri: props.image },
37
+ }),
38
+ /* @__PURE__ */ React.createElement(View, {
39
+ style: {
40
+ width: '100%',
41
+ paddingTop: props.aspectRatio * 100 + '%',
42
+ },
43
+ })
44
+ )
45
+ : /* @__PURE__ */ React.createElement(ReactImage, {
46
+ resizeMode: props.backgroundSize || 'contain',
47
+ style: __spreadValues(
48
+ __spreadValues(
49
+ {
50
+ position: 'relative',
51
+ },
52
+ props.width ? { width: props.width } : {}
53
+ ),
54
+ props.height ? { height: props.height } : {}
55
+ ),
56
+ source: { uri: props.image },
57
+ });
22
58
  }
23
59
  registerComponent(Image, {
24
60
  name: 'Image',
@@ -34,9 +34,8 @@ import BuilderContext from '../context/builder.context';
34
34
  import { getBlockActions } from '../functions/get-block-actions';
35
35
  import { getProcessedBlock } from '../functions/get-processed-block';
36
36
  import BlockStyles from './block-styles';
37
- import RenderBlocks from './render-blocks';
38
37
  function RenderBlock(props) {
39
- var _a, _b, _c;
38
+ var _a, _b, _c, _d;
40
39
  function component() {
41
40
  var _a2, _b2;
42
41
  const componentName =
@@ -94,6 +93,13 @@ function RenderBlock(props) {
94
93
  function componentOptions() {
95
94
  return getBlockComponentOptions(useBlock());
96
95
  }
96
+ function children() {
97
+ var _a2;
98
+ return (_a2 = useBlock().children) != null ? _a2 : [];
99
+ }
100
+ function noCompRefChildren() {
101
+ return componentRef() ? [] : children();
102
+ }
97
103
  const builderContext = useContext(BuilderContext);
98
104
  const ComponentRefRef = componentRef();
99
105
  const TagNameRef = tagName();
@@ -120,23 +126,7 @@ function RenderBlock(props) {
120
126
  __spreadProps(__spreadValues({}, componentOptions()), {
121
127
  builderBlock: useBlock(),
122
128
  }),
123
- useBlock().children
124
- ? /* @__PURE__ */ React.createElement(
125
- React.Fragment,
126
- null,
127
- /* @__PURE__ */ React.createElement(RenderBlocks, {
128
- path: 'children',
129
- blocks: useBlock().children,
130
- })
131
- )
132
- : null
133
- )
134
- : null,
135
- !componentRef() && useBlock().children && useBlock().children.length
136
- ? /* @__PURE__ */ React.createElement(
137
- React.Fragment,
138
- null,
139
- (_b = useBlock().children) == null
129
+ (_b = children()) == null
140
130
  ? void 0
141
131
  : _b.map((child) =>
142
132
  /* @__PURE__ */ React.createElement(RenderBlock, {
@@ -144,25 +134,30 @@ function RenderBlock(props) {
144
134
  })
145
135
  )
146
136
  )
147
- : null
137
+ : null,
138
+ (_c = noCompRefChildren()) == null
139
+ ? void 0
140
+ : _c.map((child) =>
141
+ /* @__PURE__ */ React.createElement(RenderBlock, {
142
+ block: child,
143
+ })
144
+ )
148
145
  )
149
146
  )
150
147
  : /* @__PURE__ */ React.createElement(
151
148
  ComponentRefRef,
152
- __spreadProps(
153
- __spreadValues(
154
- {},
155
- (_c = componentInfo == null ? void 0 : componentInfo()) == null
156
- ? void 0
157
- : _c.options
158
- ),
159
- {
160
- attributes: propertiesAndActions(),
161
- builderBlock: useBlock(),
162
- style: css(),
163
- children: useBlock().children,
164
- }
165
- )
149
+ __spreadProps(__spreadValues({}, componentOptions()), {
150
+ attributes: propertiesAndActions(),
151
+ builderBlock: useBlock(),
152
+ style: css(),
153
+ }),
154
+ (_d = children()) == null
155
+ ? void 0
156
+ : _d.map((child) =>
157
+ /* @__PURE__ */ React.createElement(RenderBlock, {
158
+ block: child,
159
+ })
160
+ )
166
161
  )
167
162
  );
168
163
  }
@@ -10,7 +10,6 @@ import BuilderContext from '../context/builder.context.lite';
10
10
  import { getBlockActions } from '../functions/get-block-actions';
11
11
  import { getProcessedBlock } from '../functions/get-processed-block';
12
12
  import BlockStyles from './block-styles.lite';
13
- import RenderBlocks from './render-blocks.lite';
14
13
 
15
14
  export default function RenderBlock(props) {
16
15
  function component() {
@@ -76,6 +75,18 @@ export default function RenderBlock(props) {
76
75
  return getBlockComponentOptions(useBlock());
77
76
  }
78
77
 
78
+ function children() {
79
+ // TO-DO: When should `canHaveChildren` dictate rendering?
80
+ // This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
81
+ // but still receive and need to render children.
82
+ // return componentInfo?.()?.canHaveChildren ? useBlock().children : [];
83
+ return useBlock().children ?? [];
84
+ }
85
+
86
+ function noCompRefChildren() {
87
+ return componentRef() ? [] : children();
88
+ }
89
+
79
90
  const builderContext = useContext(BuilderContext);
80
91
 
81
92
  const ComponentRefRef = componentRef();
@@ -93,36 +104,28 @@ export default function RenderBlock(props) {
93
104
  {...componentOptions()}
94
105
  builderBlock={useBlock()}
95
106
  >
96
- {useBlock().children ? (
97
- <>
98
- <RenderBlocks
99
- path="children"
100
- blocks={useBlock().children}
101
- />
102
- </>
103
- ) : null}
104
- </ComponentRefRef>
105
- ) : null}
106
-
107
- {!componentRef() &&
108
- useBlock().children &&
109
- useBlock().children.length ? (
110
- <>
111
- {useBlock().children?.map((child) => (
107
+ {children()?.map((child) => (
112
108
  <RenderBlock block={child} />
113
109
  ))}
114
- </>
110
+ </ComponentRefRef>
115
111
  ) : null}
112
+
113
+ {noCompRefChildren()?.map((child) => (
114
+ <RenderBlock block={child} />
115
+ ))}
116
116
  </TagNameRef>
117
117
  </>
118
118
  ) : (
119
119
  <ComponentRefRef
120
- {...componentInfo?.()?.options}
120
+ {...componentOptions()}
121
121
  attributes={propertiesAndActions()}
122
122
  builderBlock={useBlock()}
123
123
  style={css()}
124
- children={useBlock().children}
125
- />
124
+ >
125
+ {children()?.map((child) => (
126
+ <RenderBlock block={child} />
127
+ ))}
128
+ </ComponentRefRef>
126
129
  )}
127
130
  </>
128
131
  );
@@ -11,7 +11,7 @@ import { isPreviewing } from '../functions/is-previewing';
11
11
  import { previewingModelName } from '../functions/previewing-model-name';
12
12
  import { getContent } from '../functions/get-content';
13
13
  function RenderContent(props) {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
15
15
  function useContent() {
16
16
  return overrideContent || props.content;
17
17
  }
@@ -20,21 +20,27 @@ function RenderContent(props) {
20
20
  const [context, setContext] = useState(() => ({}));
21
21
  const [overrideContent, setOverrideContent] = useState(() => null);
22
22
  function getCssFromFont(font, data) {
23
+ var _a2, _b2;
23
24
  const family =
24
25
  font.family +
25
26
  (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
26
27
  const name = family.split(',')[0];
27
- const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
28
+ const url =
29
+ (_b2 = font.fileUrl) != null
30
+ ? _b2
31
+ : (_a2 = font == null ? void 0 : font.files) == null
32
+ ? void 0
33
+ : _a2.regular;
28
34
  let str = '';
29
35
  if (url && family && name) {
30
36
  str += `
31
- @font-face {
32
- font-family: "${family}";
33
- src: local("${name}"), url('${url}') format('woff2');
34
- font-display: fallback;
35
- font-weight: 400;
36
- }
37
- `.trim();
37
+ @font-face {
38
+ font-family: "${family}";
39
+ src: local("${name}"), url('${url}') format('woff2');
40
+ font-display: fallback;
41
+ font-weight: 400;
42
+ }
43
+ `.trim();
38
44
  }
39
45
  if (font.files) {
40
46
  for (const weight in font.files) {
@@ -45,26 +51,27 @@ function RenderContent(props) {
45
51
  const weightUrl = font.files[weight];
46
52
  if (weightUrl && weightUrl !== url) {
47
53
  str += `
48
- @font-face {
49
- font-family: "${family}";
50
- src: url('${weightUrl}') format('woff2');
51
- font-display: fallback;
52
- font-weight: ${weight};
53
- }
54
- `.trim();
54
+ @font-face {
55
+ font-family: "${family}";
56
+ src: url('${weightUrl}') format('woff2');
57
+ font-display: fallback;
58
+ font-weight: ${weight};
59
+ }
60
+ `.trim();
55
61
  }
56
62
  }
57
63
  }
58
64
  return str;
59
65
  }
60
66
  function getFontCss(data) {
67
+ var _a2, _b2;
61
68
  return (
62
- ((data == null ? void 0 : data.customFonts) &&
63
- data.customFonts.length &&
64
- data.customFonts
65
- .map((font) => this.getCssFromFont(font, data))
66
- .join(' ')) ||
67
- ''
69
+ ((_b2 =
70
+ (_a2 = data == null ? void 0 : data.customFonts) == null
71
+ ? void 0
72
+ : _a2.map((font) => getCssFromFont(font, data))) == null
73
+ ? void 0
74
+ : _b2.join(' ')) || ''
68
75
  );
69
76
  }
70
77
  function processMessage(event) {
@@ -165,18 +172,15 @@ function RenderContent(props) {
165
172
  : _b.data) == null
166
173
  ? void 0
167
174
  : _c.cssCode) ||
168
- (((_e =
169
- (_d = useContent == null ? void 0 : useContent()) == null
170
- ? void 0
171
- : _d.data) == null
172
- ? void 0
173
- : _e.customFonts) &&
174
- ((_g =
175
- (_f = useContent == null ? void 0 : useContent()) == null
175
+ ((_f =
176
+ (_e =
177
+ (_d = useContent == null ? void 0 : useContent()) == null
176
178
  ? void 0
177
- : _f.data) == null
179
+ : _d.data) == null
178
180
  ? void 0
179
- : _g.customFonts.length))) &&
181
+ : _e.customFonts) == null
182
+ ? void 0
183
+ : _f.length)) &&
180
184
  !isReactNative()
181
185
  ? /* @__PURE__ */ React.createElement(
182
186
  View,
@@ -193,15 +197,15 @@ function RenderContent(props) {
193
197
  )
194
198
  )
195
199
  : null,
196
- (_j =
197
- (_i =
198
- (_h = useContent == null ? void 0 : useContent()) == null
200
+ (_i =
201
+ (_h =
202
+ (_g = useContent == null ? void 0 : useContent()) == null
199
203
  ? void 0
200
- : _h.data) == null
204
+ : _g.data) == null
201
205
  ? void 0
202
- : _i.blocks) == null
206
+ : _h.blocks) == null
203
207
  ? void 0
204
- : _j.map((block) =>
208
+ : _i.map((block) =>
205
209
  /* @__PURE__ */ React.createElement(RenderBlock, {
206
210
  key: block.id,
207
211
  block,
@@ -32,18 +32,18 @@ export default function RenderContent(props) {
32
32
  font.family +
33
33
  (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
34
34
  const name = family.split(',')[0];
35
- const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
35
+ const url = font.fileUrl ?? font?.files?.regular;
36
36
  let str = '';
37
37
 
38
38
  if (url && family && name) {
39
39
  str += `
40
- @font-face {
41
- font-family: "${family}";
42
- src: local("${name}"), url('${url}') format('woff2');
43
- font-display: fallback;
44
- font-weight: 400;
45
- }
46
- `.trim();
40
+ @font-face {
41
+ font-family: "${family}";
42
+ src: local("${name}"), url('${url}') format('woff2');
43
+ font-display: fallback;
44
+ font-weight: 400;
45
+ }
46
+ `.trim();
47
47
  }
48
48
 
49
49
  if (font.files) {
@@ -58,13 +58,13 @@ export default function RenderContent(props) {
58
58
 
59
59
  if (weightUrl && weightUrl !== url) {
60
60
  str += `
61
- @font-face {
62
- font-family: "${family}";
63
- src: url('${weightUrl}') format('woff2');
64
- font-display: fallback;
65
- font-weight: ${weight};
66
- }
67
- `.trim();
61
+ @font-face {
62
+ font-family: "${family}";
63
+ src: url('${weightUrl}') format('woff2');
64
+ font-display: fallback;
65
+ font-weight: ${weight};
66
+ }
67
+ `.trim();
68
68
  }
69
69
  }
70
70
  }
@@ -74,16 +74,12 @@ export default function RenderContent(props) {
74
74
 
75
75
  function getFontCss(data) {
76
76
  // TODO: flag for this
77
- // if (!this.builder.allowCustomFonts) {
77
+ // if (!builder.allowCustomFonts) {
78
78
  // return '';
79
79
  // }
80
80
  // TODO: separate internal data from external
81
81
  return (
82
- (data?.customFonts &&
83
- data.customFonts.length &&
84
- data.customFonts
85
- .map((font) => this.getCssFromFont(font, data))
86
- .join(' ')) ||
82
+ data?.customFonts?.map((font) => getCssFromFont(font, data))?.join(' ') ||
87
83
  ''
88
84
  );
89
85
  }
@@ -186,8 +182,7 @@ export default function RenderContent(props) {
186
182
  data-builder-content-id={useContent?.()?.id}
187
183
  >
188
184
  {(useContent?.()?.data?.cssCode ||
189
- (useContent?.()?.data?.customFonts &&
190
- useContent?.()?.data?.customFonts.length)) &&
185
+ useContent?.()?.data?.customFonts?.length) &&
191
186
  !isReactNative() ? (
192
187
  <View>
193
188
  <Text>{useContent().data.cssCode}</Text>
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { evaluate } from './evaluate';
3
- import { getEventHandlerName } from './name-event-handlers';
3
+ import { getEventHandlerName } from './event-handler-name';
4
4
  function getBlockActions(options) {
5
5
  const obj = {};
6
6
  if (options.block.actions) {
@@ -25,12 +25,11 @@ var __spreadValues = (a, b) => {
25
25
  };
26
26
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
27
  import { findDOMNode } from 'react-dom';
28
- import { isBrowser } from './is-browser';
29
- import { isReactNative } from './is-react-native';
28
+ import { isEditing } from './is-editing';
30
29
  function getBlockProperties(block) {
31
30
  return __spreadProps(__spreadValues({}, block.properties), {
32
31
  ref: (ref) => {
33
- if (isBrowser() && !isReactNative()) {
32
+ if (isEditing()) {
34
33
  const el = findDOMNode(ref);
35
34
  if (el) {
36
35
  el.setAttribute('builder-id', block.id);
@@ -78,16 +78,18 @@ function getContent(options) {
78
78
  function getAllContent(options) {
79
79
  return __async(this, null, function* () {
80
80
  const { model, apiKey } = options;
81
- const { limit, testGroups, userAttributes, query } = __spreadValues(
82
- {
83
- limit: 1,
84
- userAttributes: null,
85
- testGroups: null,
86
- },
87
- options
88
- );
81
+ const { limit, testGroups, userAttributes, query, noTraverse } =
82
+ __spreadValues(
83
+ {
84
+ limit: 1,
85
+ userAttributes: null,
86
+ testGroups: null,
87
+ noTraverse: false,
88
+ },
89
+ options
90
+ );
89
91
  const url = new URL(
90
- `https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}`
92
+ `https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`
91
93
  );
92
94
  if (options.options) {
93
95
  const flattened = flatten(options.options);
@@ -1,10 +1,5 @@
1
1
  import * as React from 'react';
2
- import { isReactNative } from './is-react-native';
3
2
  function isBrowser() {
4
- return (
5
- typeof window !== 'undefined' &&
6
- typeof document !== 'undefined' &&
7
- !isReactNative()
8
- );
3
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
9
4
  }
10
5
  export { isBrowser };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  function isReactNative() {
3
- return typeof navigator === 'object' && navigator.product === 'ReactNative';
3
+ return true;
4
4
  }
5
5
  export { isReactNative };
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { isBrowser } from './is-browser';
3
3
  import { isReactNative } from './is-react-native';
4
4
  function track(event, properties) {
5
- if (!isBrowser() || isReactNative()) {
5
+ if (!(isBrowser() || isReactNative())) {
6
6
  return;
7
7
  }
8
8
  return fetch(`https://builder.io/api/v1/track`, {
@@ -25,12 +25,14 @@ var __spreadValues = (a, b) => {
25
25
  };
26
26
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
27
  function transformBlock(block) {
28
- if (block.id.startsWith('builder-pixel-')) {
28
+ if (block.id.startsWith('builder-pixel-') && !block.component) {
29
29
  return __spreadProps(__spreadValues({}, block), {
30
30
  component: {
31
31
  name: 'Image',
32
32
  options: {
33
33
  image: block.properties.src,
34
+ width: 1,
35
+ height: 1,
34
36
  },
35
37
  },
36
38
  });
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import 'react-native-url-polyfill/auto';
2
3
  import { isEditing } from './functions/is-editing';
3
4
  if (isEditing()) {
4
5
  import('./scripts/init-editing');
@@ -6,25 +7,23 @@ if (isEditing()) {
6
7
  import { default as default2 } from './blocks/columns';
7
8
  import { default as default3 } from './blocks/image';
8
9
  import { default as default4 } from './blocks/text';
9
- import { default as default5 } from './blocks/video';
10
- import { default as default6 } from './blocks/symbol';
11
- import { default as default7 } from './blocks/button';
12
- import { default as default8 } from './blocks/section';
13
- import { default as default9 } from './blocks/fragment';
14
- import { default as default10 } from './components/render-content';
10
+ import { default as default5 } from './blocks/symbol';
11
+ import { default as default6 } from './blocks/section';
12
+ import { default as default7 } from './blocks/fragment';
13
+ import { default as default8 } from './components/render-content';
14
+ import { default as default9 } from './blocks/button';
15
15
  export * from './functions/is-editing';
16
16
  export * from './functions/register-component';
17
17
  export * from './functions/register';
18
18
  export * from './functions/set-editor-settings';
19
19
  export * from './functions/get-content';
20
20
  export {
21
- default7 as Button,
21
+ default9 as Button,
22
22
  default2 as Columns,
23
- default9 as Fragment,
23
+ default7 as Fragment,
24
24
  default3 as Image,
25
- default10 as RenderContent,
26
- default8 as Section,
27
- default6 as Symbol,
25
+ default8 as RenderContent,
26
+ default6 as Section,
27
+ default5 as Symbol,
28
28
  default4 as Text,
29
- default5 as Video,
30
29
  };