@builder.io/sdk-react-native 0.0.1-32 → 0.0.1-36

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 (44) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button.js +10 -3
  3. package/src/blocks/button.lite.tsx +1 -0
  4. package/src/blocks/columns.js +17 -6
  5. package/src/blocks/columns.lite.tsx +1 -1
  6. package/src/blocks/custom-code.js +7 -4
  7. package/src/blocks/custom-code.lite.tsx +8 -4
  8. package/src/blocks/embed.js +7 -4
  9. package/src/blocks/embed.lite.tsx +5 -3
  10. package/src/blocks/form.js +88 -33
  11. package/src/blocks/form.lite.tsx +24 -17
  12. package/src/blocks/image.lite.tsx +5 -2
  13. package/src/blocks/img.js +8 -2
  14. package/src/blocks/input.js +10 -3
  15. package/src/blocks/input.lite.tsx +3 -1
  16. package/src/blocks/section.js +9 -4
  17. package/src/blocks/select.js +16 -5
  18. package/src/blocks/select.lite.tsx +4 -2
  19. package/src/blocks/submit-button.js +8 -2
  20. package/src/blocks/text.js +17 -4
  21. package/src/blocks/text.lite.tsx +6 -1
  22. package/src/blocks/textarea.js +10 -3
  23. package/src/blocks/video.js +8 -1
  24. package/src/components/render-block.js +25 -9
  25. package/src/components/render-block.lite.tsx +12 -4
  26. package/src/components/render-blocks.js +6 -4
  27. package/src/components/render-blocks.lite.tsx +3 -3
  28. package/src/components/render-content.js +41 -17
  29. package/src/components/render-content.lite.tsx +16 -7
  30. package/src/functions/evaluate.js +8 -7
  31. package/src/functions/get-block-actions.js +1 -1
  32. package/src/functions/get-block-component-options.js +8 -2
  33. package/src/functions/get-block-properties.js +9 -3
  34. package/src/functions/get-block-styles.js +20 -6
  35. package/src/functions/get-content.js +24 -11
  36. package/src/functions/get-content.test.js +6 -4
  37. package/src/functions/get-processed-block.js +8 -2
  38. package/src/functions/get-processed-block.test.js +5 -1
  39. package/src/functions/is-browser.js +5 -1
  40. package/src/functions/is-editing.js +3 -1
  41. package/src/functions/register-component.js +9 -3
  42. package/src/functions/set.js +5 -2
  43. package/src/index.js +9 -10
  44. package/src/scripts/init-editing.js +1 -1
@@ -7,7 +7,9 @@ export default function FormInputComponent(props) {
7
7
  return (
8
8
  <View
9
9
  {...props.attributes}
10
- key={isEditing() && props.defaultValue ? props.defaultValue : 'default-key'}
10
+ key={
11
+ isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
12
+ }
11
13
  placeholder={props.placeholder}
12
14
  type={props.type}
13
15
  name={props.name}
@@ -8,10 +8,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
9
  var __defNormalProp = (obj, key, value) =>
10
10
  key in obj
11
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
11
+ ? __defProp(obj, key, {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value,
16
+ })
12
17
  : (obj[key] = value);
13
18
  var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
21
  if (__getOwnPropSymbols)
16
22
  for (var prop of __getOwnPropSymbols(b)) {
17
23
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -70,8 +76,7 @@ registerComponent(SectionComponent, {
70
76
  component: {
71
77
  name: 'Text',
72
78
  options: {
73
- text:
74
- "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>",
79
+ text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>",
75
80
  },
76
81
  },
77
82
  },
@@ -8,10 +8,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
9
  var __defNormalProp = (obj, key, value) =>
10
10
  key in obj
11
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
11
+ ? __defProp(obj, key, {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value,
16
+ })
12
17
  : (obj[key] = value);
13
18
  var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
21
  if (__getOwnPropSymbols)
16
22
  for (var prop of __getOwnPropSymbols(b)) {
17
23
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -28,19 +34,24 @@ function SelectComponent(props) {
28
34
  View,
29
35
  __spreadProps(__spreadValues({}, props.attributes), {
30
36
  value: props.value,
31
- key: isEditing() && props.defaultValue ? props.defaultValue : 'default-key',
37
+ key:
38
+ isEditing() && props.defaultValue ? props.defaultValue : 'default-key',
32
39
  defaultValue: props.defaultValue,
33
40
  name: props.name,
34
41
  }),
35
42
  (_a = props.options) == null
36
43
  ? void 0
37
- : _a.map(option =>
44
+ : _a.map((option) =>
38
45
  /* @__PURE__ */ React.createElement(
39
46
  View,
40
47
  {
41
48
  value: option.value,
42
49
  },
43
- /* @__PURE__ */ React.createElement(Text, null, option.name || option.value)
50
+ /* @__PURE__ */ React.createElement(
51
+ Text,
52
+ null,
53
+ option.name || option.value
54
+ )
44
55
  )
45
56
  )
46
57
  );
@@ -8,11 +8,13 @@ export default function SelectComponent(props) {
8
8
  <View
9
9
  {...props.attributes}
10
10
  value={props.value}
11
- key={isEditing() && props.defaultValue ? props.defaultValue : 'default-key'}
11
+ key={
12
+ isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
13
+ }
12
14
  defaultValue={props.defaultValue}
13
15
  name={props.name}
14
16
  >
15
- {props.options?.map(option => (
17
+ {props.options?.map((option) => (
16
18
  <View value={option.value}>
17
19
  <Text>{option.name || option.value}</Text>
18
20
  </View>
@@ -8,10 +8,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
9
  var __defNormalProp = (obj, key, value) =>
10
10
  key in obj
11
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
11
+ ? __defProp(obj, key, {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value,
16
+ })
12
17
  : (obj[key] = value);
13
18
  var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
21
  if (__getOwnPropSymbols)
16
22
  for (var prop of __getOwnPropSymbols(b)) {
17
23
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -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]);
@@ -32,7 +38,10 @@ const PICK_STYLES = ['textAlign'];
32
38
  function getBlockStyles(block) {
33
39
  var _a, _b, _c;
34
40
  const styles = __spreadValues(
35
- __spreadValues({}, (_a = block.responsiveStyles) == null ? void 0 : _a.large),
41
+ __spreadValues(
42
+ {},
43
+ (_a = block.responsiveStyles) == null ? void 0 : _a.large
44
+ ),
36
45
  block.styles
37
46
  );
38
47
  if ((_b = block.responsiveStyles) == null ? void 0 : _b.medium) {
@@ -59,7 +68,11 @@ function getCss(block) {
59
68
  }
60
69
  function Text(props) {
61
70
  return /* @__PURE__ */ React.createElement(HTML, {
62
- source: { html: `<div style="${getCss(props.builderBlock)}">${props.text || ''}</div>` },
71
+ source: {
72
+ html: `<div style="${getCss(props.builderBlock)}">${
73
+ props.text || ''
74
+ }</div>`,
75
+ },
63
76
  });
64
77
  }
65
78
  registerComponent(Text, {
@@ -3,5 +3,10 @@ import { View, StyleSheet, Image, Text } from 'react-native';
3
3
  import { useContext } from 'react';
4
4
 
5
5
  export default function Text(props) {
6
- return <View className="builder-text" dangerouslySetInnerHTML={{ __html: 'props.text' }} />;
6
+ return (
7
+ <View
8
+ className="builder-text"
9
+ dangerouslySetInnerHTML={{ __html: 'props.text' }}
10
+ />
11
+ );
7
12
  }
@@ -8,10 +8,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
9
  var __defNormalProp = (obj, key, value) =>
10
10
  key in obj
11
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
11
+ ? __defProp(obj, key, {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value,
16
+ })
12
17
  : (obj[key] = value);
13
18
  var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
21
  if (__getOwnPropSymbols)
16
22
  for (var prop of __getOwnPropSymbols(b)) {
17
23
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -45,7 +51,8 @@ registerComponent(Textarea, {
45
51
  name: 'name',
46
52
  type: 'string',
47
53
  required: true,
48
- helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"',
54
+ helperText:
55
+ 'Every input in a form needs a unique name describing what it gets, e.g. "email"',
49
56
  },
50
57
  { name: 'defaultValue', type: 'string' },
51
58
  { name: 'placeholder', type: 'string', defaultValue: 'Hello there' },
@@ -16,7 +16,14 @@ function Video(props) {
16
16
  poster: props.posterImage,
17
17
  posterResizeMode: props.fit || 'contain',
18
18
  resizeMode: props.fit || 'contain',
19
- style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 1 },
19
+ style: {
20
+ position: 'absolute',
21
+ top: 0,
22
+ bottom: 0,
23
+ left: 0,
24
+ right: 0,
25
+ zIndex: 1,
26
+ },
20
27
  source: { uri: props.video },
21
28
  }),
22
29
  /* @__PURE__ */ React.createElement(View, {
@@ -6,10 +6,16 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
7
  var __defNormalProp = (obj, key, value) =>
8
8
  key in obj
9
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
9
+ ? __defProp(obj, key, {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value,
14
+ })
10
15
  : (obj[key] = value);
11
16
  var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
17
+ for (var prop in b || (b = {}))
18
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
13
19
  if (__getOwnPropSymbols)
14
20
  for (var prop of __getOwnPropSymbols(b)) {
15
21
  if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
@@ -33,11 +39,13 @@ function RenderBlock(props) {
33
39
  var _a, _b, _c;
34
40
  function component() {
35
41
  var _a2, _b2;
36
- const componentName = (_a2 = useBlock().component) == null ? void 0 : _a2.name;
42
+ const componentName =
43
+ (_a2 = useBlock().component) == null ? void 0 : _a2.name;
37
44
  if (!componentName) {
38
45
  return null;
39
46
  }
40
- const ref = components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
47
+ const ref =
48
+ components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
41
49
  if (componentName && !ref) {
42
50
  console.warn(`
43
51
  Could not find a registered component named "${componentName}".
@@ -47,11 +55,15 @@ function RenderBlock(props) {
47
55
  }
48
56
  function componentInfo() {
49
57
  var _a2;
50
- return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.info;
58
+ return (_a2 = component == null ? void 0 : component()) == null
59
+ ? void 0
60
+ : _a2.info;
51
61
  }
52
62
  function componentRef() {
53
63
  var _a2;
54
- return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component;
64
+ return (_a2 = component == null ? void 0 : component()) == null
65
+ ? void 0
66
+ : _a2.component;
55
67
  }
56
68
  function tagName() {
57
69
  return getBlockTag(useBlock());
@@ -85,7 +97,9 @@ function RenderBlock(props) {
85
97
  return /* @__PURE__ */ React.createElement(
86
98
  React.Fragment,
87
99
  null,
88
- !((_a = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a.noWrap)
100
+ !((_a = componentInfo == null ? void 0 : componentInfo()) == null
101
+ ? void 0
102
+ : _a.noWrap)
89
103
  ? /* @__PURE__ */ React.createElement(
90
104
  React.Fragment,
91
105
  null,
@@ -121,7 +135,7 @@ function RenderBlock(props) {
121
135
  null,
122
136
  (_b = useBlock().children) == null
123
137
  ? void 0
124
- : _b.map(child =>
138
+ : _b.map((child) =>
125
139
  /* @__PURE__ */ React.createElement(RenderBlock, {
126
140
  block: child,
127
141
  })
@@ -135,7 +149,9 @@ function RenderBlock(props) {
135
149
  __spreadProps(
136
150
  __spreadValues(
137
151
  {},
138
- (_c = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _c.options
152
+ (_c = componentInfo == null ? void 0 : componentInfo()) == null
153
+ ? void 0
154
+ : _c.options
139
155
  ),
140
156
  {
141
157
  attributes: properties(),
@@ -85,18 +85,26 @@ export default function RenderBlock(props) {
85
85
  <BlockStyles block={useBlock()} />
86
86
 
87
87
  {componentRef() ? (
88
- <ComponentRefRef {...componentOptions()} builderBlock={useBlock()}>
88
+ <ComponentRefRef
89
+ {...componentOptions()}
90
+ builderBlock={useBlock()}
91
+ >
89
92
  {useBlock().children ? (
90
93
  <>
91
- <RenderBlocks path="children" blocks={useBlock().children} />
94
+ <RenderBlocks
95
+ path="children"
96
+ blocks={useBlock().children}
97
+ />
92
98
  </>
93
99
  ) : null}
94
100
  </ComponentRefRef>
95
101
  ) : null}
96
102
 
97
- {!componentRef() && useBlock().children && useBlock().children.length ? (
103
+ {!componentRef() &&
104
+ useBlock().children &&
105
+ useBlock().children.length ? (
98
106
  <>
99
- {useBlock().children?.map(child => (
107
+ {useBlock().children?.map((child) => (
100
108
  <RenderBlock block={child} />
101
109
  ))}
102
110
  </>
@@ -43,11 +43,13 @@ function RenderBlocks(props) {
43
43
  {
44
44
  'builder-path': props.path,
45
45
  'builder-parent-id': props.parent,
46
- onClick: event => onClick,
47
- onMouseEnter: event => onMouseEnter,
46
+ onClick: (event) => onClick,
47
+ onMouseEnter: (event) => onMouseEnter,
48
48
  className:
49
49
  'builder-blocks' +
50
- (!((_a = props.blocks) == null ? void 0 : _a.length) ? ' no-blocks' : ''),
50
+ (!((_a = props.blocks) == null ? void 0 : _a.length)
51
+ ? ' no-blocks'
52
+ : ''),
51
53
  style: styles.view1,
52
54
  },
53
55
  props.blocks
@@ -56,7 +58,7 @@ function RenderBlocks(props) {
56
58
  null,
57
59
  (_b = props.blocks) == null
58
60
  ? void 0
59
- : _b.map(block =>
61
+ : _b.map((block) =>
60
62
  /* @__PURE__ */ React.createElement(RenderBlock, {
61
63
  block,
62
64
  })
@@ -39,14 +39,14 @@ export default function RenderBlocks(props) {
39
39
  <View
40
40
  builder-path={props.path}
41
41
  builder-parent-id={props.parent}
42
- onClick={event => onClick}
43
- onMouseEnter={event => onMouseEnter}
42
+ onClick={(event) => onClick}
43
+ onMouseEnter={(event) => onMouseEnter}
44
44
  className={'builder-blocks' + (!props.blocks?.length ? ' no-blocks' : '')}
45
45
  style={styles.view1}
46
46
  >
47
47
  {props.blocks ? (
48
48
  <>
49
- {props.blocks?.map(block => (
49
+ {props.blocks?.map((block) => (
50
50
  <RenderBlock block={block} />
51
51
  ))}
52
52
  </>
@@ -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,13 +14,14 @@ 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
26
  console.warn('Builder custom code error', e);
26
27
  }
@@ -8,7 +8,7 @@ function getBlockActions(options) {
8
8
  if (options.block.actions) {
9
9
  for (const key in options.block.actions) {
10
10
  const value = options.block.actions[key];
11
- obj['on' + capitalizeFirstLetter(key)] = event =>
11
+ obj['on' + capitalizeFirstLetter(key)] = (event) =>
12
12
  evaluate({
13
13
  code: value,
14
14
  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) {