@builder.io/sdk-react-native 0.0.1-33 → 0.0.1-37

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.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button.js +10 -3
  3. package/src/blocks/button.lite.tsx +1 -1
  4. package/src/blocks/columns.js +17 -6
  5. package/src/blocks/columns.lite.tsx +1 -2
  6. package/src/blocks/custom-code.js +7 -4
  7. package/src/blocks/custom-code.lite.tsx +9 -5
  8. package/src/blocks/embed.js +7 -4
  9. package/src/blocks/embed.lite.tsx +6 -4
  10. package/src/blocks/form.js +88 -33
  11. package/src/blocks/form.lite.tsx +25 -18
  12. package/src/blocks/fragment.lite.tsx +0 -1
  13. package/src/blocks/image.lite.tsx +5 -3
  14. package/src/blocks/img.js +8 -2
  15. package/src/blocks/img.lite.tsx +0 -1
  16. package/src/blocks/input.js +10 -3
  17. package/src/blocks/input.lite.tsx +3 -2
  18. package/src/blocks/raw-text.lite.tsx +0 -1
  19. package/src/blocks/section.js +9 -4
  20. package/src/blocks/section.lite.tsx +0 -1
  21. package/src/blocks/select.js +16 -5
  22. package/src/blocks/select.lite.tsx +4 -3
  23. package/src/blocks/submit-button.js +8 -2
  24. package/src/blocks/submit-button.lite.tsx +0 -1
  25. package/src/blocks/text.js +17 -4
  26. package/src/blocks/text.lite.tsx +6 -2
  27. package/src/blocks/textarea.js +10 -3
  28. package/src/blocks/textarea.lite.tsx +0 -1
  29. package/src/blocks/video.js +8 -1
  30. package/src/blocks/video.lite.tsx +0 -1
  31. package/src/components/block-styles.lite.tsx +0 -1
  32. package/src/components/error-boundary.lite.tsx +0 -1
  33. package/src/components/render-block.js +30 -11
  34. package/src/components/render-block.lite.tsx +19 -7
  35. package/src/components/render-blocks.js +6 -4
  36. package/src/components/render-blocks.lite.tsx +3 -4
  37. package/src/components/render-content.js +41 -17
  38. package/src/components/render-content.lite.tsx +16 -7
  39. package/src/functions/evaluate.js +9 -8
  40. package/src/functions/get-block-actions.js +4 -1
  41. package/src/functions/get-block-component-options.js +8 -2
  42. package/src/functions/get-block-properties.js +9 -3
  43. package/src/functions/get-block-styles.js +20 -6
  44. package/src/functions/get-content.js +24 -11
  45. package/src/functions/get-content.test.js +6 -4
  46. package/src/functions/get-processed-block.js +8 -2
  47. package/src/functions/get-processed-block.test.js +5 -1
  48. package/src/functions/is-browser.js +5 -1
  49. package/src/functions/is-editing.js +3 -1
  50. package/src/functions/register-component.js +9 -3
  51. package/src/functions/set.js +5 -2
  52. package/src/index.js +9 -10
  53. package/src/scripts/init-editing.js +1 -1
  54. package/src/package.json +0 -18
@@ -20,7 +20,9 @@ function RenderContent(props) {
20
20
  const [context, setContext] = useState(() => ({}));
21
21
  const [overrideContent, setOverrideContent] = useState(() => null);
22
22
  function getCssFromFont(font, data) {
23
- const family = font.family + (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
23
+ const family =
24
+ font.family +
25
+ (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
24
26
  const name = family.split(',')[0];
25
27
  const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
26
28
  let str = '';
@@ -59,7 +61,9 @@ function RenderContent(props) {
59
61
  return (
60
62
  ((data == null ? void 0 : data.customFonts) &&
61
63
  data.customFonts.length &&
62
- data.customFonts.map(font => this.getCssFromFont(font, data)).join(' ')) ||
64
+ data.customFonts
65
+ .map((font) => this.getCssFromFont(font, data))
66
+ .join(' ')) ||
63
67
  ''
64
68
  );
65
69
  }
@@ -68,7 +72,11 @@ function RenderContent(props) {
68
72
  if (data) {
69
73
  switch (data.type) {
70
74
  case 'builder.contentUpdate': {
71
- const key = data.data.key || data.data.alias || data.data.entry || data.data.modelName;
75
+ const key =
76
+ data.data.key ||
77
+ data.data.alias ||
78
+ data.data.entry ||
79
+ data.data.modelName;
72
80
  const contentData = data.data.data;
73
81
  if (key === props.model) {
74
82
  setOverrideContent(contentData);
@@ -107,7 +115,7 @@ function RenderContent(props) {
107
115
  model: props.model,
108
116
  apiKey,
109
117
  options,
110
- }).then(content => {
118
+ }).then((content) => {
111
119
  if (content) {
112
120
  setOverrideContent(content);
113
121
  }
@@ -139,7 +147,7 @@ function RenderContent(props) {
139
147
  /* @__PURE__ */ React.createElement(
140
148
  View,
141
149
  {
142
- onClick: event => {
150
+ onClick: (event) => {
143
151
  if (!isEditing()) {
144
152
  track('click', {
145
153
  contentId: useContent().id,
@@ -147,37 +155,53 @@ function RenderContent(props) {
147
155
  }
148
156
  },
149
157
  'data-builder-content-id':
150
- (_a = useContent == null ? void 0 : useContent()) == null ? void 0 : _a.id,
158
+ (_a = useContent == null ? void 0 : useContent()) == null
159
+ ? void 0
160
+ : _a.id,
151
161
  },
152
- (((_c = (_b = useContent == null ? void 0 : useContent()) == null ? void 0 : _b.data) ==
153
- null
162
+ (((_c =
163
+ (_b = useContent == null ? void 0 : useContent()) == null
164
+ ? void 0
165
+ : _b.data) == null
154
166
  ? void 0
155
167
  : _c.cssCode) ||
156
168
  (((_e =
157
- (_d = useContent == null ? void 0 : useContent()) == null ? void 0 : _d.data) ==
158
- null
169
+ (_d = useContent == null ? void 0 : useContent()) == null
170
+ ? void 0
171
+ : _d.data) == null
159
172
  ? void 0
160
173
  : _e.customFonts) &&
161
174
  ((_g =
162
- (_f = useContent == null ? void 0 : useContent()) == null ? void 0 : _f.data) ==
163
- null
175
+ (_f = useContent == null ? void 0 : useContent()) == null
176
+ ? void 0
177
+ : _f.data) == null
164
178
  ? void 0
165
179
  : _g.customFonts.length))) &&
166
180
  !isReactNative()
167
181
  ? /* @__PURE__ */ React.createElement(
168
182
  View,
169
183
  null,
170
- /* @__PURE__ */ React.createElement(Text, null, useContent().data.cssCode),
171
- /* @__PURE__ */ React.createElement(Text, null, getFontCss(useContent().data))
184
+ /* @__PURE__ */ React.createElement(
185
+ Text,
186
+ null,
187
+ useContent().data.cssCode
188
+ ),
189
+ /* @__PURE__ */ React.createElement(
190
+ Text,
191
+ null,
192
+ getFontCss(useContent().data)
193
+ )
172
194
  )
173
195
  : null,
174
196
  (_j =
175
- (_i = (_h = useContent == null ? void 0 : useContent()) == null ? void 0 : _h.data) ==
176
- null
197
+ (_i =
198
+ (_h = useContent == null ? void 0 : useContent()) == null
199
+ ? void 0
200
+ : _h.data) == null
177
201
  ? void 0
178
202
  : _i.blocks) == null
179
203
  ? void 0
180
- : _j.map(block =>
204
+ : _j.map((block) =>
181
205
  /* @__PURE__ */ React.createElement(RenderBlock, {
182
206
  key: block.id,
183
207
  block,
@@ -28,7 +28,9 @@ export default function RenderContent(props) {
28
28
 
29
29
  function getCssFromFont(font, data) {
30
30
  // TODO: compute what font sizes are used and only load those.......
31
- const family = font.family + (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
31
+ const family =
32
+ font.family +
33
+ (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
32
34
  const name = family.split(',')[0];
33
35
  const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
34
36
  let str = '';
@@ -79,7 +81,9 @@ export default function RenderContent(props) {
79
81
  return (
80
82
  (data?.customFonts &&
81
83
  data.customFonts.length &&
82
- data.customFonts.map(font => this.getCssFromFont(font, data)).join(' ')) ||
84
+ data.customFonts
85
+ .map((font) => this.getCssFromFont(font, data))
86
+ .join(' ')) ||
83
87
  ''
84
88
  );
85
89
  }
@@ -90,7 +94,11 @@ export default function RenderContent(props) {
90
94
  if (data) {
91
95
  switch (data.type) {
92
96
  case 'builder.contentUpdate': {
93
- const key = data.data.key || data.data.alias || data.data.entry || data.data.modelName;
97
+ const key =
98
+ data.data.key ||
99
+ data.data.alias ||
100
+ data.data.entry ||
101
+ data.data.modelName;
94
102
  const contentData = data.data.data; // oof
95
103
 
96
104
  if (key === props.model) {
@@ -138,7 +146,7 @@ export default function RenderContent(props) {
138
146
  model: props.model,
139
147
  apiKey,
140
148
  options,
141
- }).then(content => {
149
+ }).then((content) => {
142
150
  if (content) {
143
151
  setOverrideContent(content);
144
152
  }
@@ -168,7 +176,7 @@ export default function RenderContent(props) {
168
176
  {useContent() ? (
169
177
  <>
170
178
  <View
171
- onClick={event => {
179
+ onClick={(event) => {
172
180
  if (!isEditing()) {
173
181
  track('click', {
174
182
  contentId: useContent().id,
@@ -178,7 +186,8 @@ export default function RenderContent(props) {
178
186
  data-builder-content-id={useContent?.()?.id}
179
187
  >
180
188
  {(useContent?.()?.data?.cssCode ||
181
- (useContent?.()?.data?.customFonts && useContent?.()?.data?.customFonts.length)) &&
189
+ (useContent?.()?.data?.customFonts &&
190
+ useContent?.()?.data?.customFonts.length)) &&
182
191
  !isReactNative() ? (
183
192
  <View>
184
193
  <Text>{useContent().data.cssCode}</Text>
@@ -187,7 +196,7 @@ export default function RenderContent(props) {
187
196
  </View>
188
197
  ) : null}
189
198
 
190
- {useContent?.()?.data?.blocks?.map(block => (
199
+ {useContent?.()?.data?.blocks?.map((block) => (
191
200
  <RenderBlock key={block.id} block={block} />
192
201
  ))}
193
202
  </View>
@@ -14,15 +14,16 @@ function evaluate(options) {
14
14
  );
15
15
  const useCode = `${useReturn ? `return (${code});` : code}`;
16
16
  try {
17
- return new Function('builder', 'Builder', 'state', 'context', 'event', useCode)(
18
- builder,
19
- builder,
20
- options.state,
21
- options.context,
22
- options.event
23
- );
17
+ return new Function(
18
+ 'builder',
19
+ 'Builder',
20
+ 'state',
21
+ 'context',
22
+ 'event',
23
+ useCode
24
+ )(builder, builder, options.state, options.context, options.event);
24
25
  } catch (e) {
25
- console.warn('Builder custom code error', e);
26
+ console.warn('Builder custom code error: ', e);
26
27
  }
27
28
  }
28
29
  export { evaluate };
@@ -7,8 +7,11 @@ function getBlockActions(options) {
7
7
  const obj = {};
8
8
  if (options.block.actions) {
9
9
  for (const key in options.block.actions) {
10
+ if (!options.block.actions.hasOwnProperty(key)) {
11
+ continue;
12
+ }
10
13
  const value = options.block.actions[key];
11
- obj['on' + capitalizeFirstLetter(key)] = event =>
14
+ obj['on' + capitalizeFirstLetter(key)] = (event) =>
12
15
  evaluate({
13
16
  code: value,
14
17
  context: options.context,
@@ -5,10 +5,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
6
  var __defNormalProp = (obj, key, value) =>
7
7
  key in obj
8
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
8
+ ? __defProp(obj, key, {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value,
13
+ })
9
14
  : (obj[key] = value);
10
15
  var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
12
18
  if (__getOwnPropSymbols)
13
19
  for (var prop of __getOwnPropSymbols(b)) {
14
20
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -7,10 +7,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
8
  var __defNormalProp = (obj, key, value) =>
9
9
  key in obj
10
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
10
+ ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value,
15
+ })
11
16
  : (obj[key] = value);
12
17
  var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
14
20
  if (__getOwnPropSymbols)
15
21
  for (var prop of __getOwnPropSymbols(b)) {
16
22
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -23,7 +29,7 @@ import { isBrowser } from './is-browser';
23
29
  import { isReactNative } from './is-react-native';
24
30
  function getBlockProperties(block) {
25
31
  return __spreadProps(__spreadValues({}, block.properties), {
26
- ref: ref => {
32
+ ref: (ref) => {
27
33
  if (isBrowser() && !isReactNative()) {
28
34
  const el = findDOMNode(ref);
29
35
  if (el) {
@@ -5,10 +5,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
6
  var __defNormalProp = (obj, key, value) =>
7
7
  key in obj
8
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
8
+ ? __defProp(obj, key, {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value,
13
+ })
9
14
  : (obj[key] = value);
10
15
  var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
12
18
  if (__getOwnPropSymbols)
13
19
  for (var prop of __getOwnPropSymbols(b)) {
14
20
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -29,7 +35,7 @@ function validateReactNativeStyles(styles) {
29
35
  }
30
36
  delete styles[key];
31
37
  }
32
- if (typeof propertyValue === 'string' && propertyValue.match(/^\d/)) {
38
+ if (typeof propertyValue === 'string' && propertyValue.match(/^\-?\d/)) {
33
39
  const newValue = parseFloat(propertyValue);
34
40
  if (!isNaN(newValue)) {
35
41
  styles[key] = newValue;
@@ -38,9 +44,14 @@ function validateReactNativeStyles(styles) {
38
44
  styles[key] = 0;
39
45
  }
40
46
  }
41
- if (propertiesThatMustBeNumber.has(key) && typeof styles[key] !== 'number') {
47
+ if (
48
+ propertiesThatMustBeNumber.has(key) &&
49
+ typeof styles[key] !== 'number'
50
+ ) {
42
51
  if (SHOW_WARNINGS) {
43
- console.warn(`Style key ${key} must be a number, but had value \`${styles[key]}\``);
52
+ console.warn(
53
+ `Style key ${key} must be a number, but had value \`${styles[key]}\``
54
+ );
44
55
  }
45
56
  delete styles[key];
46
57
  }
@@ -49,7 +60,10 @@ function validateReactNativeStyles(styles) {
49
60
  function getBlockStyles(block) {
50
61
  var _a, _b, _c;
51
62
  const styles = __spreadValues(
52
- __spreadValues({}, (_a = block.responsiveStyles) == null ? void 0 : _a.large),
63
+ __spreadValues(
64
+ {},
65
+ (_a = block.responsiveStyles) == null ? void 0 : _a.large
66
+ ),
53
67
  block.styles
54
68
  );
55
69
  if ((_b = block.responsiveStyles) == null ? void 0 : _b.medium) {
@@ -7,10 +7,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
8
  var __defNormalProp = (obj, key, value) =>
9
9
  key in obj
10
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
10
+ ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value,
15
+ })
11
16
  : (obj[key] = value);
12
17
  var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
14
20
  if (__getOwnPropSymbols)
15
21
  for (var prop of __getOwnPropSymbols(b)) {
16
22
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -20,22 +26,24 @@ var __spreadValues = (a, b) => {
20
26
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
27
  var __async = (__this, __arguments, generator) => {
22
28
  return new Promise((resolve, reject) => {
23
- var fulfilled = value => {
29
+ var fulfilled = (value) => {
24
30
  try {
25
31
  step(generator.next(value));
26
32
  } catch (e) {
27
33
  reject(e);
28
34
  }
29
35
  };
30
- var rejected = value => {
36
+ var rejected = (value) => {
31
37
  try {
32
38
  step(generator.throw(value));
33
39
  } catch (e) {
34
40
  reject(e);
35
41
  }
36
42
  };
37
- var step = x =>
38
- x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
43
+ var step = (x) =>
44
+ x.done
45
+ ? resolve(x.value)
46
+ : Promise.resolve(x.value).then(fulfilled, rejected);
39
47
  step((generator = generator.apply(__this, __arguments)).next());
40
48
  });
41
49
  };
@@ -51,15 +59,19 @@ function flatten(object, path = null, separator = '.') {
51
59
  !(Array.isArray(value) && value.length === 0),
52
60
  ].every(Boolean);
53
61
  return isObject
54
- ? __spreadValues(__spreadValues({}, acc), flatten(value, newPath, separator))
62
+ ? __spreadValues(
63
+ __spreadValues({}, acc),
64
+ flatten(value, newPath, separator)
65
+ )
55
66
  : __spreadProps(__spreadValues({}, acc), { [newPath]: value });
56
67
  }, {});
57
68
  }
58
69
  function getContent(options) {
59
70
  return __async(this, null, function* () {
60
71
  return (
61
- (yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }))).results[0] ||
62
- null
72
+ (yield getAllContent(
73
+ __spreadProps(__spreadValues({}, options), { limit: 1 })
74
+ )).results[0] || null
63
75
  );
64
76
  });
65
77
  }
@@ -92,7 +104,7 @@ function getAllContent(options) {
92
104
  url.searchParams.set(key, JSON.stringify(flattened[key]));
93
105
  }
94
106
  }
95
- const content = yield fetch(url.href).then(res => res.json());
107
+ const content = yield fetch(url.href).then((res) => res.json());
96
108
  if (testGroups) {
97
109
  for (const item of content.results) {
98
110
  if (item.variations && Object.keys(item.variations).length) {
@@ -112,7 +124,8 @@ function getAllContent(options) {
112
124
  n += testRatio;
113
125
  if (random < n) {
114
126
  const variationName =
115
- variation.name || (variation.id === item.id ? 'Default variation' : '');
127
+ variation.name ||
128
+ (variation.id === item.id ? 'Default variation' : '');
116
129
  set = true;
117
130
  Object.assign(item, {
118
131
  data: variation.data,
@@ -1,22 +1,24 @@
1
1
  import * as React from 'react';
2
2
  var __async = (__this, __arguments, generator) => {
3
3
  return new Promise((resolve, reject) => {
4
- var fulfilled = value => {
4
+ var fulfilled = (value) => {
5
5
  try {
6
6
  step(generator.next(value));
7
7
  } catch (e) {
8
8
  reject(e);
9
9
  }
10
10
  };
11
- var rejected = value => {
11
+ var rejected = (value) => {
12
12
  try {
13
13
  step(generator.throw(value));
14
14
  } catch (e) {
15
15
  reject(e);
16
16
  }
17
17
  };
18
- var step = x =>
19
- x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ var step = (x) =>
19
+ x.done
20
+ ? resolve(x.value)
21
+ : Promise.resolve(x.value).then(fulfilled, rejected);
20
22
  step((generator = generator.apply(__this, __arguments)).next());
21
23
  });
22
24
  };
@@ -7,10 +7,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
8
  var __defNormalProp = (obj, key, value) =>
9
9
  key in obj
10
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
10
+ ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value,
15
+ })
11
16
  : (obj[key] = value);
12
17
  var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
14
20
  if (__getOwnPropSymbols)
15
21
  for (var prop of __getOwnPropSymbols(b)) {
16
22
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -17,7 +17,11 @@ test('Can process bindings', () => {
17
17
  'properties.isEditing': 'builder.isEditing',
18
18
  },
19
19
  };
20
- const processed = getProcessedBlock({ block, context: {}, state: { test: 'hello' } });
20
+ const processed = getProcessedBlock({
21
+ block,
22
+ context: {},
23
+ state: { test: 'hello' },
24
+ });
21
25
  expect(processed).not.toEqual(block);
22
26
  expect(processed.properties.foo).toEqual('baz');
23
27
  expect(processed.properties.test).toEqual('hello');
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { isReactNative } from './is-react-native';
3
3
  function isBrowser() {
4
- return typeof window !== 'undefined' && typeof document !== 'undefined' && !isReactNative();
4
+ return (
5
+ typeof window !== 'undefined' &&
6
+ typeof document !== 'undefined' &&
7
+ !isReactNative()
8
+ );
5
9
  }
6
10
  export { isBrowser };
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { isIframe } from './is-iframe';
3
3
  function isEditing() {
4
- return isIframe() && window.location.search.indexOf('builder.frameEditing=') !== -1;
4
+ return (
5
+ isIframe() && window.location.search.indexOf('builder.frameEditing=') !== -1
6
+ );
5
7
  }
6
8
  export { isEditing };
@@ -7,10 +7,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
8
  var __defNormalProp = (obj, key, value) =>
9
9
  key in obj
10
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
10
+ ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value,
15
+ })
11
16
  : (obj[key] = value);
12
17
  var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
14
20
  if (__getOwnPropSymbols)
15
21
  for (var prop of __getOwnPropSymbols(b)) {
16
22
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -41,7 +47,7 @@ function prepareComponentInfoToSend(info) {
41
47
  return __spreadValues(
42
48
  __spreadValues({}, info),
43
49
  info.inputs && {
44
- inputs: info.inputs.map(input => {
50
+ inputs: info.inputs.map((input) => {
45
51
  const keysToConvertFnToString = ['onChange', 'showIf'];
46
52
  for (const key of keysToConvertFnToString) {
47
53
  if (input[key] && typeof input[key] === 'function') {
@@ -3,14 +3,17 @@ const set = (obj, _path, value) => {
3
3
  if (Object(obj) !== obj) {
4
4
  return obj;
5
5
  }
6
- const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
6
+ const path = Array.isArray(_path)
7
+ ? _path
8
+ : _path.toString().match(/[^.[\]]+/g);
7
9
  path
8
10
  .slice(0, -1)
9
11
  .reduce(
10
12
  (a, c, i) =>
11
13
  Object(a[c]) === a[c]
12
14
  ? a[c]
13
- : (a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}),
15
+ : (a[c] =
16
+ Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}),
14
17
  obj
15
18
  )[path[path.length - 1]] = value;
16
19
  return obj;
package/src/index.js CHANGED
@@ -6,22 +6,21 @@ if (isEditing()) {
6
6
  import { default as default2 } from './blocks/columns';
7
7
  import { default as default3 } from './blocks/image';
8
8
  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/section';
12
- import { default as default8 } from './blocks/fragment';
13
- import { default as default9 } from './components/render-content';
9
+ import { default as default5 } from './blocks/symbol';
10
+ import { default as default6 } from './blocks/section';
11
+ import { default as default7 } from './blocks/fragment';
12
+ import { default as default8 } from './components/render-content';
13
+ export * from './functions/is-editing';
14
14
  export * from './functions/register-component';
15
15
  export * from './functions/register';
16
16
  export * from './functions/set-editor-settings';
17
17
  export * from './functions/get-content';
18
18
  export {
19
19
  default2 as Columns,
20
- default8 as Fragment,
20
+ default7 as Fragment,
21
21
  default3 as Image,
22
- default9 as RenderContent,
23
- default7 as Section,
24
- default6 as Symbol,
22
+ default8 as RenderContent,
23
+ default6 as Section,
24
+ default5 as Symbol,
25
25
  default4 as Text,
26
- default5 as Video,
27
26
  };
@@ -62,7 +62,7 @@ if (isBrowser()) {
62
62
  } else {
63
63
  if (result && typeof result.then === 'function') {
64
64
  result
65
- .then(finalResult => {
65
+ .then((finalResult) => {
66
66
  var _a3;
67
67
  (_a3 = window.parent) == null
68
68
  ? void 0
package/src/package.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@builder.io/sdk-react-native",
3
- "description": "Builder.io SDK for React Native",
4
- "version": "0.0.1-1",
5
- "main": "src/index.js",
6
- "scripts": {
7
- "release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
8
- },
9
- "dependencies": {
10
- "react-native-render-html": "^5.1.1"
11
- },
12
- "peerDependencies": {
13
- "react-native": "^0.64.2"
14
- },
15
- "devDependencies": {
16
- "react-native": "^0.64.2"
17
- }
18
- }