@builder.io/sdk-react-native 0.4.5 → 0.5.0

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 (249) hide show
  1. package/dist/blocks/button/button.js +6 -2
  2. package/dist/blocks/button/component-info.js +4 -8
  3. package/dist/blocks/columns/columns.js +17 -21
  4. package/dist/blocks/columns/component-info.js +27 -48
  5. package/dist/blocks/custom-code/component-info.js +4 -8
  6. package/dist/blocks/custom-code/custom-code.js +1 -1
  7. package/dist/blocks/embed/component-info.js +7 -11
  8. package/dist/blocks/embed/embed.js +1 -1
  9. package/dist/blocks/embed/helpers.js +2 -6
  10. package/dist/blocks/form/component-info.js +33 -69
  11. package/dist/blocks/form/form.js +2 -203
  12. package/dist/blocks/fragment/fragment.js +1 -1
  13. package/dist/blocks/helpers.js +33 -0
  14. package/dist/blocks/image/component-info.js +21 -47
  15. package/dist/blocks/image/image.helpers.js +2 -2
  16. package/dist/blocks/img/component-info.js +2 -4
  17. package/dist/blocks/img/img.js +2 -1
  18. package/dist/blocks/input/component-info.js +8 -34
  19. package/dist/blocks/input/input.js +2 -1
  20. package/dist/blocks/raw-text/component-info.js +2 -4
  21. package/dist/blocks/raw-text/raw-text.js +3 -2
  22. package/dist/blocks/section/component-info.js +5 -10
  23. package/dist/blocks/section/section.js +2 -1
  24. package/dist/blocks/select/component-info.js +12 -24
  25. package/dist/blocks/select/select.js +2 -1
  26. package/dist/blocks/submit-button/component-info.js +2 -4
  27. package/dist/blocks/submit-button/submit-button.js +2 -1
  28. package/dist/blocks/symbol/component-info.js +7 -12
  29. package/dist/blocks/symbol/symbol.helpers.js +66 -0
  30. package/dist/blocks/symbol/symbol.js +23 -52
  31. package/dist/blocks/text/component-info.js +3 -4
  32. package/dist/blocks/textarea/component-info.js +6 -12
  33. package/dist/blocks/textarea/textarea.js +2 -1
  34. package/dist/blocks/video/component-info.js +21 -41
  35. package/dist/components/block/block.helpers.js +12 -23
  36. package/dist/components/block/block.js +40 -70
  37. package/dist/components/block/components/block-styles.js +1 -1
  38. package/dist/components/block/components/block-wrapper/block-wrapper.js +41 -0
  39. package/dist/components/block/components/block-wrapper.js +56 -0
  40. package/dist/components/block/components/component-ref/component-ref.helpers.js +40 -0
  41. package/dist/components/block/components/component-ref/component-ref.js +63 -0
  42. package/dist/components/block/components/component-ref.js +81 -0
  43. package/dist/components/block/components/interactive-element/interactive-element.helpers.js +35 -0
  44. package/dist/components/block/components/interactive-element/interactive-element.js +36 -0
  45. package/dist/components/block/components/interactive-element.js +46 -0
  46. package/dist/components/block/components/repeated-block.js +4 -4
  47. package/dist/components/blocks/blocks-wrapper.js +5 -2
  48. package/dist/components/blocks/blocks.js +2 -2
  49. package/dist/components/content/builder-editing.js +32 -0
  50. package/dist/components/content/components/enable-editor.js +30 -33
  51. package/dist/components/content/components/styles.helpers.js +55 -0
  52. package/dist/components/content/components/styles.js +61 -0
  53. package/dist/components/content/content.helpers.js +10 -3
  54. package/dist/components/content/content.js +25 -42
  55. package/dist/components/content/wrap-component-ref.js +1 -1
  56. package/dist/components/content-variants/content-variants.js +38 -34
  57. package/dist/components/content-variants/content-variants.types.js +1 -0
  58. package/dist/components/content-variants/helpers.js +61 -25
  59. package/dist/components/inlined-script.js +1 -1
  60. package/dist/components/inlined-styles.js +1 -1
  61. package/dist/constants/device-sizes.js +2 -2
  62. package/dist/constants/sdk-version.js +1 -1
  63. package/dist/context/builder.context.js +1 -1
  64. package/dist/functions/apply-patch-with-mutation.js +75 -0
  65. package/dist/functions/apply-patch-with-mutation.test.js +55 -0
  66. package/dist/functions/camel-to-kebab-case.js +1 -1
  67. package/dist/functions/evaluate/acorn.js +1691 -0
  68. package/dist/functions/evaluate/evaluate.js +72 -0
  69. package/dist/functions/evaluate/index.js +5 -0
  70. package/dist/functions/evaluate/interpreter.js +2903 -0
  71. package/dist/functions/evaluate/non-node-runtime.js +97 -0
  72. package/dist/functions/evaluate/types.js +1 -0
  73. package/dist/functions/evaluate.test.js +12 -6
  74. package/dist/functions/event-handler-name.js +1 -1
  75. package/dist/functions/extract-text-styles.js +3 -9
  76. package/dist/functions/fast-clone.js +1 -1
  77. package/dist/functions/get-block-actions-handler.js +2 -2
  78. package/dist/functions/get-block-actions.js +14 -1
  79. package/dist/functions/get-block-component-options.js +6 -1
  80. package/dist/functions/get-block-properties.js +21 -8
  81. package/dist/functions/get-builder-search-params/fn.test.js +3 -3
  82. package/dist/functions/get-builder-search-params/index.js +4 -4
  83. package/dist/functions/get-content/generate-content-url.js +12 -5
  84. package/dist/functions/get-content/generate-content-url.test.js +31 -17
  85. package/dist/functions/get-content/index.js +36 -12
  86. package/dist/functions/get-content/processCookies.js +7 -0
  87. package/dist/functions/get-processed-block.js +8 -3
  88. package/dist/functions/get-processed-block.test.js +3 -1
  89. package/dist/functions/get-react-native-block-styles.js +6 -1
  90. package/dist/functions/is-non-node-server.js +12 -0
  91. package/dist/functions/on-change.test.js +13 -3
  92. package/dist/functions/register-component.js +24 -19
  93. package/dist/functions/sanitize-react-native-block-styles.js +17 -6
  94. package/dist/functions/set.test.js +9 -3
  95. package/dist/functions/track/helpers.js +5 -5
  96. package/dist/functions/track/index.js +29 -18
  97. package/dist/functions/track/interaction.js +10 -4
  98. package/dist/functions/transform-block-properties.js +2 -0
  99. package/dist/helpers/ab-tests.js +35 -14
  100. package/dist/helpers/canTrack.js +2 -2
  101. package/dist/helpers/css.js +2 -2
  102. package/dist/helpers/flatten.js +10 -7
  103. package/dist/helpers/nullable.js +1 -1
  104. package/dist/helpers/preview-lru-cache/get.js +11 -0
  105. package/dist/helpers/preview-lru-cache/helpers.js +13 -0
  106. package/dist/helpers/preview-lru-cache/init.js +13 -0
  107. package/dist/helpers/preview-lru-cache/set.js +37 -0
  108. package/dist/helpers/preview-lru-cache/types.js +1 -0
  109. package/dist/helpers/sessionId.js +13 -6
  110. package/dist/helpers/url.js +1 -1
  111. package/dist/helpers/visitorId.js +4 -1
  112. package/dist/index-helpers/blocks-exports.js +2 -2
  113. package/dist/scripts/init-editing.js +61 -46
  114. package/package.json +2 -2
  115. package/src/blocks/button/button.jsx +11 -2
  116. package/src/blocks/button/component-info.js +16 -22
  117. package/src/blocks/columns/columns.jsx +27 -26
  118. package/src/blocks/columns/component-info.js +203 -226
  119. package/src/blocks/custom-code/component-info.js +19 -25
  120. package/src/blocks/custom-code/custom-code.jsx +1 -1
  121. package/src/blocks/embed/component-info.js +31 -37
  122. package/src/blocks/embed/embed.jsx +1 -1
  123. package/src/blocks/embed/helpers.js +3 -9
  124. package/src/blocks/form/component-info.js +174 -212
  125. package/src/blocks/form/form.jsx +3 -247
  126. package/src/blocks/fragment/component-info.js +1 -3
  127. package/src/blocks/fragment/fragment.jsx +1 -1
  128. package/src/blocks/helpers.js +27 -0
  129. package/src/blocks/image/component-info.js +105 -133
  130. package/src/blocks/image/image.helpers.js +3 -5
  131. package/src/blocks/img/component-info.js +8 -12
  132. package/src/blocks/img/img.jsx +3 -1
  133. package/src/blocks/input/component-info.js +29 -57
  134. package/src/blocks/input/input.jsx +3 -1
  135. package/src/blocks/raw-text/component-info.js +7 -11
  136. package/src/blocks/raw-text/raw-text.jsx +4 -2
  137. package/src/blocks/section/component-info.js +24 -31
  138. package/src/blocks/section/section.jsx +3 -1
  139. package/src/blocks/select/component-info.js +34 -48
  140. package/src/blocks/select/select.jsx +3 -1
  141. package/src/blocks/submit-button/component-info.js +6 -10
  142. package/src/blocks/submit-button/submit-button.jsx +3 -2
  143. package/src/blocks/symbol/component-info.js +30 -37
  144. package/src/blocks/symbol/symbol.helpers.js +60 -0
  145. package/src/blocks/symbol/symbol.jsx +33 -61
  146. package/src/blocks/text/component-info.js +10 -13
  147. package/src/blocks/textarea/component-info.js +22 -30
  148. package/src/blocks/textarea/textarea.jsx +3 -1
  149. package/src/blocks/video/component-info.js +74 -96
  150. package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
  151. package/src/components/{render-block/render-block.jsx → block/block.jsx} +68 -81
  152. package/src/components/{render-block → block/components}/block-styles.jsx +18 -17
  153. package/src/components/block/components/block-wrapper.jsx +58 -0
  154. package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
  155. package/src/components/block/components/component-ref/component-ref.jsx +72 -0
  156. package/src/components/block/components/interactive-element.jsx +37 -0
  157. package/src/components/{render-block/render-repeated-block.jsx → block/components/repeated-block.jsx} +10 -6
  158. package/src/components/blocks/blocks-wrapper.jsx +74 -0
  159. package/src/components/blocks/blocks.jsx +51 -0
  160. package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +77 -163
  161. package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
  162. package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +5 -5
  163. package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
  164. package/src/components/content/content.jsx +141 -0
  165. package/src/components/content/index.js +2 -0
  166. package/src/components/content/wrap-component-ref.js +2 -0
  167. package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +20 -23
  168. package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
  169. package/src/components/inlined-script.jsx +1 -1
  170. package/src/components/inlined-styles.jsx +1 -1
  171. package/src/constants/device-sizes.js +6 -6
  172. package/src/constants/sdk-version.js +1 -1
  173. package/src/context/builder.context.js +1 -1
  174. package/src/functions/apply-patch-with-mutation.js +66 -0
  175. package/src/functions/camel-to-kebab-case.js +2 -4
  176. package/src/functions/evaluate/acorn.js +1595 -0
  177. package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
  178. package/src/functions/evaluate/index.js +2 -0
  179. package/src/functions/evaluate/interpreter.js +2801 -0
  180. package/src/functions/evaluate/non-node-runtime.js +92 -0
  181. package/src/functions/evaluate/types.js +0 -0
  182. package/src/functions/event-handler-name.js +2 -4
  183. package/src/functions/extract-text-styles.js +4 -12
  184. package/src/functions/fast-clone.js +2 -4
  185. package/src/functions/get-block-actions-handler.js +3 -5
  186. package/src/functions/get-block-actions.js +15 -4
  187. package/src/functions/get-block-component-options.js +11 -12
  188. package/src/functions/get-block-properties.js +29 -19
  189. package/src/functions/get-builder-search-params/index.js +5 -10
  190. package/src/functions/get-content/generate-content-url.js +17 -19
  191. package/src/functions/get-content/index.js +43 -29
  192. package/src/functions/get-fetch.js +1 -3
  193. package/src/functions/get-global-this.js +1 -3
  194. package/src/functions/get-processed-block.js +12 -13
  195. package/src/functions/get-react-native-block-styles.js +11 -12
  196. package/src/functions/if-target.js +1 -3
  197. package/src/functions/is-browser.js +1 -3
  198. package/src/functions/is-editing.js +1 -3
  199. package/src/functions/is-iframe.js +1 -3
  200. package/src/functions/is-non-node-server.js +9 -0
  201. package/src/functions/is-previewing.js +1 -3
  202. package/src/functions/on-change.js +1 -4
  203. package/src/functions/register-component.js +34 -42
  204. package/src/functions/register.js +1 -3
  205. package/src/functions/sanitize-react-native-block-styles.js +22 -17
  206. package/src/functions/set-editor-settings.js +1 -3
  207. package/src/functions/set.js +1 -3
  208. package/src/functions/track/helpers.js +3 -5
  209. package/src/functions/track/index.js +45 -43
  210. package/src/functions/track/interaction.js +11 -7
  211. package/src/functions/transform-block-properties.js +2 -0
  212. package/src/helpers/ab-tests.js +45 -28
  213. package/src/helpers/canTrack.js +3 -5
  214. package/src/helpers/css.js +3 -7
  215. package/src/helpers/flatten.js +15 -18
  216. package/src/helpers/localStorage.js +1 -4
  217. package/src/helpers/logger.js +1 -3
  218. package/src/helpers/nullable.js +2 -4
  219. package/src/helpers/preview-lru-cache/get.js +8 -0
  220. package/src/helpers/preview-lru-cache/helpers.js +10 -0
  221. package/src/helpers/preview-lru-cache/init.js +10 -0
  222. package/src/helpers/preview-lru-cache/set.js +35 -0
  223. package/src/helpers/preview-lru-cache/types.js +0 -0
  224. package/src/helpers/sessionId.js +14 -11
  225. package/src/helpers/time.js +1 -3
  226. package/src/helpers/url.js +2 -4
  227. package/src/helpers/uuid.js +4 -6
  228. package/src/helpers/visitorId.js +8 -7
  229. package/src/index-helpers/blocks-exports.js +1 -1
  230. package/src/index.js +2 -17
  231. package/src/scripts/init-editing.js +62 -48
  232. package/src/types/api-version.js +1 -3
  233. package/src/types/builder-props.js +0 -0
  234. package/src/blocks/util.js +0 -8
  235. package/src/components/render-block/render-component.jsx +0 -55
  236. package/src/components/render-blocks.jsx +0 -101
  237. package/src/components/render-content/builder-editing.jsx +0 -16
  238. package/src/components/render-content/index.js +0 -4
  239. package/src/components/render-content/wrap-component-ref.js +0 -4
  240. package/src/functions/evaluate.test.js +0 -17
  241. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  242. package/src/functions/get-content/generate-content-url.test.js +0 -97
  243. package/src/functions/get-processed-block.test.js +0 -34
  244. package/src/functions/on-change.test.js +0 -19
  245. package/src/functions/set.test.js +0 -16
  246. package/src/helpers/url.test.js +0 -21
  247. /package/src/components/{render-block → block}/types.js +0 -0
  248. /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
  249. /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import * as React from "react";
3
3
  import {
4
4
  FlatList,
@@ -14,15 +14,15 @@ import {
14
14
  getScriptString,
15
15
  getVariants,
16
16
  getVariantsScriptString,
17
- } from "./helpers";
18
- import RenderContent from "../render-content/render-content";
19
- import { getDefaultCanTrack } from "../../helpers/canTrack";
17
+ } from "./helpers.js";
18
+ import ContentComponent from "../content/content";
19
+ import { getDefaultCanTrack } from "../../helpers/canTrack.js";
20
20
  import InlinedStyles from "../inlined-styles";
21
- import { handleABTestingSync } from "../../helpers/ab-tests";
21
+ import { handleABTestingSync } from "../../helpers/ab-tests.js";
22
22
  import InlinedScript from "../inlined-script";
23
- import { TARGET } from "../../constants/target";
23
+ import { TARGET } from "../../constants/target.js";
24
24
 
25
- function RenderContentVariants(props) {
25
+ function ContentVariants(props) {
26
26
  const [shouldRenderVariants, setShouldRenderVariants] = useState(() =>
27
27
  checkShouldRunVariants({
28
28
  canTrack: getDefaultCanTrack(props.canTrack),
@@ -30,29 +30,26 @@ function RenderContentVariants(props) {
30
30
  })
31
31
  );
32
32
 
33
- const [variantScriptStr, setVariantScriptStr] = useState(() =>
34
- getVariantsScriptString(
33
+ function variantScriptStr() {
34
+ return getVariantsScriptString(
35
35
  getVariants(props.content).map((value) => ({
36
36
  id: value.testVariationId,
37
37
  testRatio: value.testRatio,
38
38
  })),
39
39
  props.content?.id || ""
40
- )
41
- );
40
+ );
41
+ }
42
42
 
43
- const [hideVariantsStyleString, setHideVariantsStyleString] = useState(() =>
44
- getVariants(props.content)
43
+ function hideVariantsStyleString() {
44
+ return getVariants(props.content)
45
45
  .map((value) => `.variant-${value.testVariationId} { display: none; } `)
46
- .join("")
47
- );
46
+ .join("");
47
+ }
48
48
 
49
49
  useEffect(() => {
50
50
  /**
51
51
  * We unmount the non-winning variants post-hydration in Vue.
52
52
  */
53
- if (TARGET === "vue2" || TARGET === "vue3") {
54
- setShouldRenderVariants(false);
55
- }
56
53
  }, []);
57
54
 
58
55
  return (
@@ -67,11 +64,11 @@ function RenderContentVariants(props) {
67
64
  <>
68
65
  <InlinedStyles
69
66
  id={`variants-styles-${props.content?.id}`}
70
- styles={hideVariantsStyleString}
67
+ styles={hideVariantsStyleString()}
71
68
  />
72
- <InlinedScript scriptStr={variantScriptStr} />
69
+ <InlinedScript scriptStr={variantScriptStr()} />
73
70
  {getVariants(props.content)?.map((variant) => (
74
- <RenderContent
71
+ <ContentComponent
75
72
  key={variant.testVariationId}
76
73
  content={variant}
77
74
  showContent={false}
@@ -92,7 +89,7 @@ function RenderContentVariants(props) {
92
89
  </>
93
90
  ) : null}
94
91
 
95
- <RenderContent
92
+ <ContentComponent
96
93
  {...{}}
97
94
  content={
98
95
  shouldRenderVariants
@@ -120,4 +117,4 @@ function RenderContentVariants(props) {
120
117
  );
121
118
  }
122
119
 
123
- export default RenderContentVariants;
120
+ export default ContentVariants;
@@ -4,22 +4,23 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value
12
+ }) : obj[key] = value;
8
13
  var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
14
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
17
+ }
17
18
  return a;
18
19
  };
19
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { TARGET } from "../../constants/target";
21
- import { isBrowser } from "../../functions/is-browser";
22
- const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {}).map((variant) => __spreadProps(__spreadValues({}, variant), {
21
+ import { TARGET } from "../../constants/target.js";
22
+ import { isBrowser } from "../../functions/is-browser.js";
23
+ const getVariants = content => Object.values((content == null ? void 0 : content.variations) || {}).map(variant => __spreadProps(__spreadValues({}, variant), {
23
24
  testVariationId: variant.id,
24
25
  id: content == null ? void 0 : content.id
25
26
  }));
@@ -28,16 +29,11 @@ const checkShouldRunVariants = ({
28
29
  content
29
30
  }) => {
30
31
  const hasVariants = getVariants(content).length > 0;
31
- if (TARGET === "reactNative")
32
- return false;
33
- if (!hasVariants)
34
- return false;
35
- if (!canTrack)
36
- return false;
37
- if (TARGET === "vue2" || TARGET === "vue3")
38
- return true;
39
- if (isBrowser())
40
- return false;
32
+ if (TARGET === "reactNative") return false;
33
+ if (!hasVariants) return false;
34
+ if (!canTrack) return false;
35
+ if (TARGET === "vue2" || TARGET === "vue3") return true;
36
+ if (isBrowser()) return false;
41
37
  return true;
42
38
  };
43
39
  function bldrAbTest(contentId, variants, isHydrationTarget2) {
@@ -57,16 +53,14 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
57
53
  const ca = document.cookie.split(";");
58
54
  for (let i = 0; i < ca.length; i++) {
59
55
  let c = ca[i];
60
- while (c.charAt(0) === " ")
61
- c = c.substring(1, c.length);
62
- if (c.indexOf(nameEQ) === 0)
63
- return c.substring(nameEQ.length, c.length);
56
+ while (c.charAt(0) === " ") c = c.substring(1, c.length);
57
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
64
58
  }
65
59
  return null;
66
60
  }
67
61
  const cookieName = `builder.tests.${contentId}`;
68
62
  const variantInCookie = getCookie(cookieName);
69
- const availableIDs = variants.map((vr) => vr.id).concat(contentId);
63
+ const availableIDs = variants.map(vr => vr.id).concat(contentId);
70
64
  if (variantInCookie && availableIDs.includes(variantInCookie)) {
71
65
  return variantInCookie;
72
66
  }
@@ -91,7 +85,9 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
91
85
  const thisScriptEl = document.currentScript;
92
86
  thisScriptEl == null ? void 0 : thisScriptEl.remove();
93
87
  } else {
94
- const newStyleStr = variants.concat({ id: contentId }).filter((variant) => variant.id !== winningVariantId).map((value) => {
88
+ const newStyleStr = variants.concat({
89
+ id: contentId
90
+ }).filter(variant => variant.id !== winningVariantId).map(value => {
95
91
  return `.variant-${value.id} { display: none; }
96
92
  `;
97
93
  }).join("");
@@ -108,10 +104,8 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
108
104
  const ca = document.cookie.split(";");
109
105
  for (let i = 0; i < ca.length; i++) {
110
106
  let c = ca[i];
111
- while (c.charAt(0) === " ")
112
- c = c.substring(1, c.length);
113
- if (c.indexOf(nameEQ) === 0)
114
- return c.substring(nameEQ.length, c.length);
107
+ while (c.charAt(0) === " ") c = c.substring(1, c.length);
108
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
115
109
  }
116
110
  return null;
117
111
  }
@@ -138,7 +132,7 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
138
132
  }
139
133
  return;
140
134
  }
141
- const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
135
+ const getIsHydrationTarget = target => target === "react" || target === "reactNative";
142
136
  const isHydrationTarget = getIsHydrationTarget(TARGET);
143
137
  const AB_TEST_FN_NAME = "builderIoAbTest";
144
138
  const CONTENT_FN_NAME = "builderIoRenderContent";
@@ -161,10 +155,4 @@ const getRenderContentScriptString = ({
161
155
  return `
162
156
  window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
163
157
  };
164
- export {
165
- checkShouldRunVariants,
166
- getRenderContentScriptString,
167
- getScriptString,
168
- getVariants,
169
- getVariantsScriptString
170
- };
158
+ export { checkShouldRunVariants, getRenderContentScriptString, getScriptString, getVariants, getVariantsScriptString }
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import * as React from "react";
3
3
  import {
4
4
  FlatList,
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import * as React from "react";
3
3
  import {
4
4
  FlatList,
@@ -1,4 +1,4 @@
1
- import { fastClone } from "../functions/fast-clone";
1
+ import { fastClone } from "../functions/fast-clone.js";
2
2
  const SIZES = {
3
3
  small: {
4
4
  min: 320,
@@ -17,7 +17,10 @@ const SIZES = {
17
17
  }
18
18
  };
19
19
  const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
20
- const getSizesForBreakpoints = ({ small, medium }) => {
20
+ const getSizesForBreakpoints = ({
21
+ small,
22
+ medium
23
+ }) => {
21
24
  const newSizes = fastClone(SIZES);
22
25
  if (!small || !medium) {
23
26
  return newSizes;
@@ -42,7 +45,4 @@ const getSizesForBreakpoints = ({ small, medium }) => {
42
45
  };
43
46
  return newSizes;
44
47
  };
45
- export {
46
- getMaxWidthQueryForSize,
47
- getSizesForBreakpoints
48
- };
48
+ export { getMaxWidthQueryForSize, getSizesForBreakpoints }
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.4.5"
1
+ export const SDK_VERSION = "0.5.0"
@@ -8,7 +8,7 @@ var stdin_default = createContext({
8
8
  rootState: {},
9
9
  apiKey: null,
10
10
  apiVersion: void 0,
11
- registeredComponents: {},
11
+ componentInfos: {},
12
12
  inheritedStyles: {}
13
13
  });
14
14
  export {
@@ -0,0 +1,66 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value
10
+ }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ const applyPatchWithMinimalMutationChain = (obj, patch, preserveRoot = false) => {
19
+ if (Object(obj) !== obj) {
20
+ return obj;
21
+ }
22
+ const {
23
+ path,
24
+ op,
25
+ value
26
+ } = patch;
27
+ const pathArr = path.split(/\//);
28
+ if (pathArr[0] === "") {
29
+ pathArr.shift();
30
+ }
31
+ const newObj = preserveRoot ? obj : __spreadValues({}, obj);
32
+ let objPart = newObj;
33
+ for (let i = 0; i < pathArr.length; i++) {
34
+ const isLast = i === pathArr.length - 1;
35
+ const property = pathArr[i];
36
+ if (isLast) {
37
+ if (op === "replace") {
38
+ objPart[property] = value;
39
+ } else if (op === "add") {
40
+ const index = Number(property);
41
+ if (Array.isArray(objPart)) {
42
+ if (property === "-") {
43
+ objPart.push(value);
44
+ } else {
45
+ objPart.splice(index, 0, value);
46
+ }
47
+ } else {
48
+ objPart[property] = value;
49
+ }
50
+ } else if (op === "remove") {
51
+ const index = Number(property);
52
+ if (Array.isArray(objPart)) {
53
+ objPart.splice(index, 1);
54
+ } else {
55
+ delete objPart[property];
56
+ }
57
+ }
58
+ } else {
59
+ const nextProperty = pathArr[i + 1];
60
+ const newPart = Object(objPart[property]) === objPart[property] ? objPart[property] : String(Number(nextProperty)) === nextProperty ? [] : {};
61
+ objPart = objPart[property] = Array.isArray(newPart) ? [...newPart] : __spreadValues({}, newPart);
62
+ }
63
+ }
64
+ return newObj;
65
+ };
66
+ export { applyPatchWithMinimalMutationChain }
@@ -1,4 +1,2 @@
1
- const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
2
- export {
3
- camelToKebabCase
4
- };
1
+ const camelToKebabCase = string => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
2
+ export { camelToKebabCase }