@builder.io/sdk-react-native 0.4.4 → 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 (393) 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 +19 -23
  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 -50
  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 +102 -0
  36. package/dist/components/block/block.js +141 -0
  37. package/dist/components/block/components/block-styles.js +95 -0
  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/component.js +41 -0
  44. package/dist/components/block/components/interactive-element/interactive-element.helpers.js +35 -0
  45. package/dist/components/block/components/interactive-element/interactive-element.js +36 -0
  46. package/dist/components/block/components/interactive-element.js +46 -0
  47. package/dist/components/block/components/repeated-block.js +40 -0
  48. package/dist/components/block/types.js +1 -0
  49. package/dist/components/blocks/blocks-wrapper.js +69 -0
  50. package/dist/components/blocks/blocks.js +41 -0
  51. package/dist/components/content/builder-editing.js +32 -0
  52. package/dist/components/content/components/content-styles.helpers.js +55 -0
  53. package/dist/components/content/components/content-styles.js +61 -0
  54. package/dist/components/content/components/enable-editor.js +310 -0
  55. package/dist/components/content/components/styles.helpers.js +55 -0
  56. package/dist/components/content/components/styles.js +61 -0
  57. package/dist/components/content/content.helpers.js +49 -0
  58. package/dist/components/content/content.js +110 -0
  59. package/dist/components/content/content.types.js +1 -0
  60. package/dist/components/content/index.js +8 -0
  61. package/dist/components/content/wrap-component-ref.js +5 -0
  62. package/dist/components/content-variants/content-variants.js +77 -0
  63. package/dist/components/content-variants/content-variants.types.js +1 -0
  64. package/dist/components/content-variants/helpers.js +175 -0
  65. package/dist/components/inlined-script.js +32 -0
  66. package/dist/components/{render-inlined-styles.js → inlined-styles.js} +3 -3
  67. package/dist/components/render-block/block-styles.js +2 -2
  68. package/dist/components/render-content/components/render-styles.js +2 -2
  69. package/dist/components/render-content/render-content.js +10 -8
  70. package/dist/components/render-content-variants/helpers.js +49 -20
  71. package/dist/components/render-content-variants/render-content-variants.js +29 -24
  72. package/dist/components/render-content-variants/render-content-variants.types.js +1 -0
  73. package/dist/constants/device-sizes.js +2 -2
  74. package/dist/constants/sdk-version.js +1 -1
  75. package/dist/context/builder.context.js +1 -1
  76. package/dist/functions/apply-patch-with-mutation.js +75 -0
  77. package/dist/functions/apply-patch-with-mutation.test.js +55 -0
  78. package/dist/functions/camel-to-kebab-case.js +1 -1
  79. package/dist/functions/evaluate/acorn.js +1691 -0
  80. package/dist/functions/evaluate/evaluate.js +72 -0
  81. package/dist/functions/evaluate/index.js +5 -0
  82. package/dist/functions/evaluate/interpreter.js +2903 -0
  83. package/dist/functions/evaluate/non-node-runtime.js +97 -0
  84. package/dist/functions/evaluate/types.js +1 -0
  85. package/dist/functions/evaluate.test.js +12 -6
  86. package/dist/functions/event-handler-name.js +1 -1
  87. package/dist/functions/extract-text-styles.js +3 -9
  88. package/dist/functions/fast-clone.js +1 -1
  89. package/dist/functions/get-block-actions-handler.js +2 -2
  90. package/dist/functions/get-block-actions.js +14 -1
  91. package/dist/functions/get-block-component-options.js +6 -1
  92. package/dist/functions/get-block-properties.js +21 -8
  93. package/dist/functions/get-builder-search-params/fn.test.js +3 -3
  94. package/dist/functions/get-builder-search-params/index.js +4 -4
  95. package/dist/functions/get-content/generate-content-url.js +12 -5
  96. package/dist/functions/get-content/generate-content-url.test.js +31 -17
  97. package/dist/functions/get-content/index.js +36 -12
  98. package/dist/functions/get-content/processCookies.js +7 -0
  99. package/dist/functions/get-processed-block.js +8 -3
  100. package/dist/functions/get-processed-block.test.js +3 -1
  101. package/dist/functions/get-react-native-block-styles.js +6 -1
  102. package/dist/functions/is-non-node-server.js +12 -0
  103. package/dist/functions/on-change.test.js +13 -3
  104. package/dist/functions/register-component.js +24 -19
  105. package/dist/functions/sanitize-react-native-block-styles.js +17 -6
  106. package/dist/functions/set.test.js +9 -3
  107. package/dist/functions/track/helpers.js +5 -5
  108. package/dist/functions/track/index.js +29 -18
  109. package/dist/functions/track/interaction.js +10 -4
  110. package/dist/functions/transform-block-properties.js +2 -0
  111. package/dist/helpers/ab-tests.js +38 -14
  112. package/dist/helpers/canTrack.js +2 -2
  113. package/dist/helpers/css.js +2 -2
  114. package/dist/helpers/flatten.js +10 -7
  115. package/dist/helpers/nullable.js +1 -1
  116. package/dist/helpers/preview-lru-cache/get.js +11 -0
  117. package/dist/helpers/preview-lru-cache/helpers.js +13 -0
  118. package/dist/helpers/preview-lru-cache/init.js +13 -0
  119. package/dist/helpers/preview-lru-cache/set.js +37 -0
  120. package/dist/helpers/preview-lru-cache/types.js +1 -0
  121. package/dist/helpers/sessionId.js +13 -6
  122. package/dist/helpers/url.js +1 -1
  123. package/dist/helpers/visitorId.js +4 -1
  124. package/dist/index-helpers/blocks-exports.js +2 -2
  125. package/dist/scripts/init-editing.js +61 -46
  126. package/dist/types/builder-props.js +1 -0
  127. package/dist/types/enforced-partials.js +1 -0
  128. package/package.json +2 -2
  129. package/src/blocks/button/button.jsx +11 -2
  130. package/src/blocks/button/component-info.js +16 -22
  131. package/src/blocks/columns/columns.jsx +29 -28
  132. package/src/blocks/columns/component-info.js +203 -226
  133. package/src/blocks/custom-code/component-info.js +19 -25
  134. package/src/blocks/custom-code/custom-code.jsx +1 -1
  135. package/src/blocks/embed/component-info.js +31 -37
  136. package/src/blocks/embed/embed.jsx +1 -1
  137. package/src/blocks/embed/helpers.js +3 -9
  138. package/src/blocks/form/component-info.js +174 -212
  139. package/src/blocks/form/form.jsx +3 -247
  140. package/src/blocks/fragment/component-info.js +1 -3
  141. package/src/blocks/fragment/fragment.jsx +1 -1
  142. package/src/blocks/helpers.js +27 -0
  143. package/src/blocks/image/component-info.js +105 -133
  144. package/src/blocks/image/image.helpers.js +3 -5
  145. package/src/blocks/img/component-info.js +8 -12
  146. package/src/blocks/img/img.jsx +3 -1
  147. package/src/blocks/input/component-info.js +29 -57
  148. package/src/blocks/input/input.jsx +3 -1
  149. package/src/blocks/raw-text/component-info.js +7 -11
  150. package/src/blocks/raw-text/raw-text.jsx +4 -2
  151. package/src/blocks/section/component-info.js +24 -31
  152. package/src/blocks/section/section.jsx +3 -1
  153. package/src/blocks/select/component-info.js +34 -48
  154. package/src/blocks/select/select.jsx +3 -1
  155. package/src/blocks/submit-button/component-info.js +6 -10
  156. package/src/blocks/submit-button/submit-button.jsx +3 -2
  157. package/src/blocks/symbol/component-info.js +30 -37
  158. package/src/blocks/symbol/symbol.helpers.js +60 -0
  159. package/src/blocks/symbol/symbol.jsx +34 -59
  160. package/src/blocks/text/component-info.js +10 -13
  161. package/src/blocks/textarea/component-info.js +22 -30
  162. package/src/blocks/textarea/textarea.jsx +3 -1
  163. package/src/blocks/video/component-info.js +74 -96
  164. package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
  165. package/src/components/{render-block/render-block.jsx → block/block.jsx} +68 -81
  166. package/src/components/{render-block → block/components}/block-styles.jsx +19 -18
  167. package/src/components/block/components/block-wrapper.jsx +58 -0
  168. package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
  169. package/src/components/block/components/component-ref/component-ref.jsx +72 -0
  170. package/src/components/block/components/interactive-element.jsx +37 -0
  171. package/src/components/{render-block/render-repeated-block.jsx → block/components/repeated-block.jsx} +10 -6
  172. package/src/components/blocks/blocks-wrapper.jsx +74 -0
  173. package/src/components/blocks/blocks.jsx +51 -0
  174. package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +81 -165
  175. package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
  176. package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +7 -7
  177. package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
  178. package/src/components/content/content.jsx +141 -0
  179. package/src/components/content/content.types.js +0 -0
  180. package/src/components/content/index.js +2 -0
  181. package/src/components/content/wrap-component-ref.js +2 -0
  182. package/src/components/content-variants/content-variants.jsx +120 -0
  183. package/src/components/{render-content-variants → content-variants}/helpers.js +58 -41
  184. package/src/components/inlined-script.jsx +18 -0
  185. package/src/components/{render-inlined-styles.jsx → inlined-styles.jsx} +3 -3
  186. package/src/constants/device-sizes.js +6 -6
  187. package/src/constants/sdk-version.js +1 -1
  188. package/src/context/builder.context.js +1 -1
  189. package/src/functions/apply-patch-with-mutation.js +66 -0
  190. package/src/functions/camel-to-kebab-case.js +2 -4
  191. package/src/functions/evaluate/acorn.js +1595 -0
  192. package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
  193. package/src/functions/evaluate/index.js +2 -0
  194. package/src/functions/evaluate/interpreter.js +2801 -0
  195. package/src/functions/evaluate/non-node-runtime.js +92 -0
  196. package/src/functions/evaluate/types.js +0 -0
  197. package/src/functions/event-handler-name.js +2 -4
  198. package/src/functions/extract-text-styles.js +4 -12
  199. package/src/functions/fast-clone.js +2 -4
  200. package/src/functions/get-block-actions-handler.js +3 -5
  201. package/src/functions/get-block-actions.js +15 -4
  202. package/src/functions/get-block-component-options.js +11 -12
  203. package/src/functions/get-block-properties.js +29 -19
  204. package/src/functions/get-builder-search-params/index.js +5 -10
  205. package/src/functions/get-content/generate-content-url.js +17 -19
  206. package/src/functions/get-content/index.js +43 -29
  207. package/src/functions/get-fetch.js +1 -3
  208. package/src/functions/get-global-this.js +1 -3
  209. package/src/functions/get-processed-block.js +12 -13
  210. package/src/functions/get-react-native-block-styles.js +11 -12
  211. package/src/functions/if-target.js +1 -3
  212. package/src/functions/is-browser.js +1 -3
  213. package/src/functions/is-editing.js +1 -3
  214. package/src/functions/is-iframe.js +1 -3
  215. package/src/functions/is-non-node-server.js +9 -0
  216. package/src/functions/is-previewing.js +1 -3
  217. package/src/functions/on-change.js +1 -4
  218. package/src/functions/register-component.js +34 -42
  219. package/src/functions/register.js +1 -3
  220. package/src/functions/sanitize-react-native-block-styles.js +22 -17
  221. package/src/functions/set-editor-settings.js +1 -3
  222. package/src/functions/set.js +1 -3
  223. package/src/functions/track/helpers.js +3 -5
  224. package/src/functions/track/index.js +45 -43
  225. package/src/functions/track/interaction.js +11 -7
  226. package/src/functions/transform-block-properties.js +2 -0
  227. package/src/helpers/ab-tests.js +46 -26
  228. package/src/helpers/canTrack.js +3 -5
  229. package/src/helpers/css.js +3 -7
  230. package/src/helpers/flatten.js +15 -18
  231. package/src/helpers/localStorage.js +1 -4
  232. package/src/helpers/logger.js +1 -3
  233. package/src/helpers/nullable.js +2 -4
  234. package/src/helpers/preview-lru-cache/get.js +8 -0
  235. package/src/helpers/preview-lru-cache/helpers.js +10 -0
  236. package/src/helpers/preview-lru-cache/init.js +10 -0
  237. package/src/helpers/preview-lru-cache/set.js +35 -0
  238. package/src/helpers/preview-lru-cache/types.js +0 -0
  239. package/src/helpers/sessionId.js +14 -11
  240. package/src/helpers/time.js +1 -3
  241. package/src/helpers/url.js +2 -4
  242. package/src/helpers/uuid.js +4 -6
  243. package/src/helpers/visitorId.js +8 -7
  244. package/src/index-helpers/blocks-exports.js +1 -1
  245. package/src/index.js +2 -17
  246. package/src/scripts/init-editing.js +62 -48
  247. package/src/types/api-version.js +1 -3
  248. package/src/types/builder-props.js +0 -0
  249. package/src/types/enforced-partials.js +0 -0
  250. package/dist/blocks/BaseText.d.ts +0 -6
  251. package/dist/blocks/button/button.d.ts +0 -9
  252. package/dist/blocks/button/component-info.d.ts +0 -2
  253. package/dist/blocks/columns/columns.d.ts +0 -16
  254. package/dist/blocks/columns/component-info.d.ts +0 -2
  255. package/dist/blocks/custom-code/component-info.d.ts +0 -2
  256. package/dist/blocks/custom-code/custom-code.d.ts +0 -5
  257. package/dist/blocks/embed/component-info.d.ts +0 -2
  258. package/dist/blocks/embed/embed.d.ts +0 -5
  259. package/dist/blocks/embed/helpers.d.ts +0 -1
  260. package/dist/blocks/form/component-info.d.ts +0 -2
  261. package/dist/blocks/form/form.d.ts +0 -28
  262. package/dist/blocks/fragment/component-info.d.ts +0 -2
  263. package/dist/blocks/fragment/fragment.d.ts +0 -8
  264. package/dist/blocks/image/component-info.d.ts +0 -2
  265. package/dist/blocks/image/image.d.ts +0 -17
  266. package/dist/blocks/image/image.helpers.d.ts +0 -1
  267. package/dist/blocks/img/component-info.d.ts +0 -2
  268. package/dist/blocks/img/img.d.ts +0 -11
  269. package/dist/blocks/input/component-info.d.ts +0 -2
  270. package/dist/blocks/input/input.d.ts +0 -12
  271. package/dist/blocks/raw-text/component-info.d.ts +0 -2
  272. package/dist/blocks/raw-text/raw-text.d.ts +0 -5
  273. package/dist/blocks/section/component-info.d.ts +0 -2
  274. package/dist/blocks/section/section.d.ts +0 -9
  275. package/dist/blocks/select/component-info.d.ts +0 -2
  276. package/dist/blocks/select/select.d.ts +0 -13
  277. package/dist/blocks/submit-button/component-info.d.ts +0 -2
  278. package/dist/blocks/submit-button/submit-button.d.ts +0 -7
  279. package/dist/blocks/symbol/component-info.d.ts +0 -2
  280. package/dist/blocks/symbol/symbol.d.ts +0 -21
  281. package/dist/blocks/text/component-info.d.ts +0 -2
  282. package/dist/blocks/text/text.d.ts +0 -7
  283. package/dist/blocks/textarea/component-info.d.ts +0 -2
  284. package/dist/blocks/textarea/textarea.d.ts +0 -10
  285. package/dist/blocks/util.d.ts +0 -4
  286. package/dist/blocks/video/component-info.d.ts +0 -2
  287. package/dist/blocks/video/video.d.ts +0 -31
  288. package/dist/components/render-block/block-styles.d.ts +0 -9
  289. package/dist/components/render-block/render-block.d.ts +0 -9
  290. package/dist/components/render-block/render-block.helpers.d.ts +0 -12
  291. package/dist/components/render-block/render-component.d.ts +0 -17
  292. package/dist/components/render-block/render-repeated-block.d.ts +0 -9
  293. package/dist/components/render-block/types.d.ts +0 -6
  294. package/dist/components/render-blocks.d.ts +0 -10
  295. package/dist/components/render-content/builder-editing.d.ts +0 -3
  296. package/dist/components/render-content/components/render-styles.d.ts +0 -9
  297. package/dist/components/render-content/components/render-styles.helpers.d.ts +0 -15
  298. package/dist/components/render-content/index.d.ts +0 -1
  299. package/dist/components/render-content/render-content.d.ts +0 -4
  300. package/dist/components/render-content/render-content.helpers.d.ts +0 -7
  301. package/dist/components/render-content/render-content.types.d.ts +0 -38
  302. package/dist/components/render-content/wrap-component-ref.d.ts +0 -6
  303. package/dist/components/render-content-variants/helpers.d.ts +0 -17
  304. package/dist/components/render-content-variants/render-content-variants.d.ts +0 -5
  305. package/dist/components/render-inlined-styles.d.ts +0 -7
  306. package/dist/constants/builder-registered-components.d.ts +0 -6
  307. package/dist/constants/device-sizes.d.ts +0 -13
  308. package/dist/constants/sdk-version.d.ts +0 -1
  309. package/dist/constants/target.d.ts +0 -3
  310. package/dist/context/builder.context.d.ts +0 -3
  311. package/dist/context/types.d.ts +0 -35
  312. package/dist/functions/camel-to-kebab-case.d.ts +0 -1
  313. package/dist/functions/evaluate.d.ts +0 -7
  314. package/dist/functions/evaluate.test.d.ts +0 -1
  315. package/dist/functions/event-handler-name.d.ts +0 -1
  316. package/dist/functions/extract-text-styles.d.ts +0 -4
  317. package/dist/functions/fast-clone.d.ts +0 -4
  318. package/dist/functions/get-block-actions-handler.d.ts +0 -8
  319. package/dist/functions/get-block-actions.d.ts +0 -9
  320. package/dist/functions/get-block-component-options.d.ts +0 -2
  321. package/dist/functions/get-block-properties.d.ts +0 -2
  322. package/dist/functions/get-builder-search-params/fn.test.d.ts +0 -1
  323. package/dist/functions/get-builder-search-params/index.d.ts +0 -12
  324. package/dist/functions/get-content/generate-content-url.d.ts +0 -2
  325. package/dist/functions/get-content/generate-content-url.test.d.ts +0 -1
  326. package/dist/functions/get-content/index.d.ts +0 -16
  327. package/dist/functions/get-content/types.d.ts +0 -51
  328. package/dist/functions/get-fetch.d.ts +0 -1
  329. package/dist/functions/get-processed-block.d.ts +0 -10
  330. package/dist/functions/get-processed-block.test.d.ts +0 -1
  331. package/dist/functions/get-react-native-block-styles.d.ts +0 -7
  332. package/dist/functions/if-target.d.ts +0 -7
  333. package/dist/functions/is-browser.d.ts +0 -1
  334. package/dist/functions/is-editing.d.ts +0 -1
  335. package/dist/functions/is-iframe.d.ts +0 -1
  336. package/dist/functions/is-previewing.d.ts +0 -1
  337. package/dist/functions/on-change.d.ts +0 -7
  338. package/dist/functions/on-change.test.d.ts +0 -1
  339. package/dist/functions/register-component.d.ts +0 -14
  340. package/dist/functions/register.d.ts +0 -16
  341. package/dist/functions/sanitize-react-native-block-styles.d.ts +0 -3
  342. package/dist/functions/set-editor-settings.d.ts +0 -4
  343. package/dist/functions/set.d.ts +0 -7
  344. package/dist/functions/set.test.d.ts +0 -1
  345. package/dist/functions/track/helpers.d.ts +0 -5
  346. package/dist/functions/track/index.d.ts +0 -51
  347. package/dist/functions/track/interaction.d.ts +0 -13
  348. package/dist/functions/transform-block-properties.d.ts +0 -3
  349. package/dist/functions/transform-block.d.ts +0 -2
  350. package/dist/helpers/ab-tests.d.ts +0 -9
  351. package/dist/helpers/canTrack.d.ts +0 -1
  352. package/dist/helpers/cookie.d.ts +0 -9
  353. package/dist/helpers/css.d.ts +0 -7
  354. package/dist/helpers/flatten.d.ts +0 -6
  355. package/dist/helpers/localStorage.d.ts +0 -9
  356. package/dist/helpers/logger.d.ts +0 -6
  357. package/dist/helpers/nullable.d.ts +0 -2
  358. package/dist/helpers/sessionId.d.ts +0 -6
  359. package/dist/helpers/time.d.ts +0 -1
  360. package/dist/helpers/url.d.ts +0 -6
  361. package/dist/helpers/url.test.d.ts +0 -1
  362. package/dist/helpers/uuid.d.ts +0 -8
  363. package/dist/helpers/visitorId.d.ts +0 -6
  364. package/dist/index-helpers/blocks-exports.d.ts +0 -8
  365. package/dist/index-helpers/top-of-file.d.ts +0 -1
  366. package/dist/index.d.ts +0 -15
  367. package/dist/scripts/init-editing.d.ts +0 -6
  368. package/dist/types/api-version.d.ts +0 -2
  369. package/dist/types/builder-block.d.ts +0 -66
  370. package/dist/types/builder-content.d.ts +0 -44
  371. package/dist/types/can-track.d.ts +0 -3
  372. package/dist/types/components.d.ts +0 -105
  373. package/dist/types/deep-partial.d.ts +0 -3
  374. package/dist/types/element.d.ts +0 -59
  375. package/dist/types/input.d.ts +0 -121
  376. package/dist/types/targets.d.ts +0 -3
  377. package/dist/types/typescript.d.ts +0 -5
  378. package/src/blocks/util.js +0 -8
  379. package/src/components/render-block/render-component.jsx +0 -55
  380. package/src/components/render-blocks.jsx +0 -101
  381. package/src/components/render-content/builder-editing.jsx +0 -16
  382. package/src/components/render-content/index.js +0 -4
  383. package/src/components/render-content/wrap-component-ref.js +0 -4
  384. package/src/components/render-content-variants/render-content-variants.jsx +0 -101
  385. package/src/functions/evaluate.test.js +0 -17
  386. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  387. package/src/functions/get-content/generate-content-url.test.js +0 -97
  388. package/src/functions/get-processed-block.test.js +0 -34
  389. package/src/functions/on-change.test.js +0 -19
  390. package/src/functions/set.test.js +0 -16
  391. package/src/helpers/url.test.js +0 -21
  392. /package/src/components/{render-block → block}/types.js +0 -0
  393. /package/src/components/{render-content/render-content.types.js → content-variants/content-variants.types.js} +0 -0
@@ -1,3 +0,0 @@
1
- type Styles = Record<string, string | number>;
2
- export declare const sanitizeReactNativeBlockStyles: (styles: Styles) => Styles;
3
- export {};
@@ -1,4 +0,0 @@
1
- export type Settings = {
2
- customInsertMenu?: boolean;
3
- };
4
- export declare function setEditorSettings(newSettings: Settings): void;
@@ -1,7 +0,0 @@
1
- /**
2
- * Minimal implementation of lodash's _.set
3
- * https://lodash.com/docs/4.17.15#set
4
- *
5
- * See ./set.test.ts for usage examples
6
- */
7
- export declare const set: (obj: any, _path: string | string[], value: any) => any;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export declare const getUserAttributes: () => {
2
- urlPath: string | undefined;
3
- host: string | undefined;
4
- device: string;
5
- };
@@ -1,51 +0,0 @@
1
- import type { CanTrack } from '../../types/can-track.js';
2
- import type { Dictionary } from '../../types/typescript.js';
3
- interface Event {
4
- /**
5
- * The type of your event.
6
- *
7
- * Examples: `click`, `conversion`, `pageview`, `impression`
8
- */
9
- type: string;
10
- data: {
11
- /**
12
- * (Optional) The content's ID. Useful if this event pertains to a specific piece of content.
13
- */
14
- contentId?: string;
15
- /**
16
- * This is the ID of the space that the content belongs to.
17
- */
18
- ownerId: string;
19
- /**
20
- * (Optional) metadata that you want to provide with your event.
21
- */
22
- metadata?: Dictionary<any>;
23
- /**
24
- * Session ID of the user. This is provided by the SDK by checking session storage.
25
- */
26
- sessionId: string | undefined;
27
- /**
28
- * Visitor ID of the user. This is provided by the SDK by checking cookies.
29
- */
30
- visitorId: string | undefined;
31
- /**
32
- * (Optional) If running an A/B test, the ID of the variation that the user is in.
33
- */
34
- variationId?: string;
35
- [index: string]: any;
36
- };
37
- }
38
- type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | 'variationId' | 'metadata'> & {
39
- /**
40
- * Your organization's API key.
41
- */
42
- apiKey: Event['data']['ownerId'];
43
- /**
44
- * (Optional) Any additional (non-metadata) properties to add to the event.
45
- */
46
- [index: string]: any;
47
- };
48
- export type EventProps = EventProperties & CanTrack;
49
- export declare function _track(eventProps: EventProps): Promise<void | Response>;
50
- export declare const track: (args: EventProperties) => Promise<void | Response>;
51
- export {};
@@ -1,13 +0,0 @@
1
- type Offset = {
2
- x: number;
3
- y: number;
4
- };
5
- export declare const getInteractionPropertiesForEvent: (event: MouseEvent) => {
6
- targetBuilderElement: string | undefined;
7
- metadata: {
8
- targetOffset: Offset | undefined;
9
- builderTargetOffset: Offset | undefined;
10
- builderElementIndex: number | undefined;
11
- };
12
- };
13
- export {};
@@ -1,3 +0,0 @@
1
- export declare function transformBlockProperties<T extends {
2
- id?: string;
3
- }>(block: T): T;
@@ -1,2 +0,0 @@
1
- import type { BuilderBlock } from '../types/builder-block.js';
2
- export declare function transformBlock(block: BuilderBlock): BuilderBlock;
@@ -1,9 +0,0 @@
1
- import type { CanTrack } from '../types/can-track.js';
2
- import type { BuilderContent } from '../types/builder-content.js';
3
- import type { Nullable } from '../types/typescript.js';
4
- export declare const handleABTestingSync: ({ item, canTrack, }: {
5
- item: Nullable<BuilderContent>;
6
- } & CanTrack) => Nullable<BuilderContent>;
7
- export declare const handleABTesting: ({ item, canTrack, }: {
8
- item: BuilderContent;
9
- } & CanTrack) => Promise<BuilderContent>;
@@ -1 +0,0 @@
1
- export declare const getDefaultCanTrack: (canTrack?: boolean) => boolean;
@@ -1,9 +0,0 @@
1
- import type { CanTrack } from '../types/can-track.js';
2
- export declare const getCookie: ({ name, canTrack, }: {
3
- name: string;
4
- } & CanTrack) => Promise<any>;
5
- export declare const setCookie: ({ name, value, expires, canTrack, }: {
6
- name: string;
7
- value: string;
8
- expires?: Date | undefined;
9
- } & CanTrack) => Promise<undefined>;
@@ -1,7 +0,0 @@
1
- export declare const convertStyleMapToCSSArray: (style: Partial<CSSStyleDeclaration>) => string[];
2
- export declare const convertStyleMapToCSS: (style: Partial<CSSStyleDeclaration>) => string;
3
- export declare const createCssClass: ({ mediaQuery, className, styles, }: {
4
- mediaQuery?: string | undefined;
5
- className: string;
6
- styles: Partial<CSSStyleDeclaration>;
7
- }) => string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Convert deep object to a flat object with dots
3
- *
4
- * { foo: { bar: 'baz' }} -> { 'foo.bar': 'baz' }
5
- */
6
- export declare function flatten<T extends Record<string, any>>(object: T, path?: string | null, separator?: string): T;
@@ -1,9 +0,0 @@
1
- import type { CanTrack } from '../types/can-track.js';
2
- import type { Nullable } from './nullable.js';
3
- export declare const getLocalStorageItem: ({ key, canTrack, }: {
4
- key: string;
5
- } & CanTrack) => Nullable<string>;
6
- export declare const setLocalStorageItem: ({ key, canTrack, value, }: {
7
- key: string;
8
- value: string;
9
- } & CanTrack) => void;
@@ -1,6 +0,0 @@
1
- export declare const logger: {
2
- log: (...message: any[]) => void;
3
- error: (...message: any[]) => void;
4
- warn: (...message: any[]) => void;
5
- debug: (...message: any[]) => void;
6
- };
@@ -1,2 +0,0 @@
1
- export type Nullable<T> = T | null | undefined;
2
- export declare const checkIsDefined: <T>(maybeT: Nullable<T>) => maybeT is T;
@@ -1,6 +0,0 @@
1
- import type { CanTrack } from '../types/can-track.js';
2
- export declare const getSessionId: ({ canTrack, }: CanTrack) => Promise<string | undefined>;
3
- export declare const createSessionId: () => string;
4
- export declare const setSessionId: ({ id, canTrack, }: {
5
- id: string;
6
- } & CanTrack) => Promise<undefined>;
@@ -1 +0,0 @@
1
- export declare const getCurrentDatePlusMinutes: (minutes?: number) => Date;
@@ -1,6 +0,0 @@
1
- /**
2
- * Only gets one level up from hostname
3
- * wwww.example.com -> example.com
4
- * www.example.co.uk -> example.co.uk
5
- */
6
- export declare const getTopLevelDomain: (host: string) => string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * @credit https://stackoverflow.com/a/2117523
3
- */
4
- export declare function uuidv4(): string;
5
- /**
6
- * Slightly cleaner and smaller UUIDs
7
- */
8
- export declare function uuid(): string;
@@ -1,6 +0,0 @@
1
- import type { CanTrack } from '../types/can-track.js';
2
- export declare const getVisitorId: ({ canTrack }: CanTrack) => string | undefined;
3
- export declare const createVisitorId: () => string;
4
- export declare const setVisitorId: ({ id, canTrack, }: {
5
- id: string;
6
- } & CanTrack) => void;
@@ -1,8 +0,0 @@
1
- export { default as Columns } from '../blocks/columns/columns';
2
- export { default as Image } from '../blocks/image/image';
3
- export { default as Text } from '../blocks/text/text';
4
- export { default as Symbol } from '../blocks/symbol/symbol';
5
- export { default as Button } from '../blocks/button/button';
6
- export { default as Section } from '../blocks/section/section';
7
- export { default as Fragment } from '../blocks/fragment/fragment';
8
- export { default as RenderContent } from '../components/render-content/render-content';
@@ -1 +0,0 @@
1
- import 'react-native-url-polyfill/auto';
package/dist/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export * from './index-helpers/top-of-file.js';
2
- export * from './index-helpers/blocks-exports.js';
3
- export { isEditing } from './functions/is-editing.js';
4
- export { isPreviewing } from './functions/is-previewing.js';
5
- export { createRegisterComponentMessage } from './functions/register-component.js';
6
- export { register } from './functions/register.js';
7
- export type { InsertMenuConfig, InsertMenuItem } from './functions/register.js';
8
- export { setEditorSettings } from './functions/set-editor-settings.js';
9
- export type { Settings } from './functions/set-editor-settings.js';
10
- export { getAllContent, getContent, processContentResult, } from './functions/get-content/index.js';
11
- export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
12
- export { track } from './functions/track/index.js';
13
- export type { RegisteredComponent } from './context/types';
14
- export type { ComponentInfo } from './types/components';
15
- export type { RenderContentProps } from './components/render-content/render-content.types.js';
@@ -1,6 +0,0 @@
1
- export declare const registerInsertMenu: () => void;
2
- export declare const setupBrowserForEditing: (options?: {
3
- enrich?: boolean;
4
- includeRefs?: boolean;
5
- locale?: string;
6
- }) => void;
@@ -1,2 +0,0 @@
1
- export type ApiVersion = 'v2' | 'v3';
2
- export declare const DEFAULT_API_VERSION: ApiVersion;
@@ -1,66 +0,0 @@
1
- type JSONValue = string | number | boolean | JSONObject | JSONArray;
2
- interface JSONObject {
3
- [x: string]: JSONValue;
4
- }
5
- interface JSONArray extends Array<JSONValue> {
6
- }
7
- /** @todo typedoc this */
8
- export interface BuilderBlock {
9
- '@type': '@builder.io/sdk:Element';
10
- '@version'?: number;
11
- id?: string;
12
- tagName?: string;
13
- layerName?: string;
14
- groupLocked?: boolean;
15
- layerLocked?: boolean;
16
- /** @todo make alias for properties.class */
17
- class?: string;
18
- children?: BuilderBlock[];
19
- responsiveStyles?: {
20
- large?: Partial<CSSStyleDeclaration>;
21
- medium?: Partial<CSSStyleDeclaration>;
22
- small?: Partial<CSSStyleDeclaration>;
23
- /** @deprecated */
24
- xsmall?: Partial<CSSStyleDeclaration>;
25
- };
26
- component?: {
27
- name: string;
28
- options?: any;
29
- tag?: string;
30
- };
31
- bindings?: {
32
- [key: string]: string;
33
- };
34
- meta?: {
35
- [key: string]: JSONValue;
36
- };
37
- actions?: {
38
- [key: string]: string;
39
- };
40
- properties?: {
41
- [key: string]: string;
42
- };
43
- code?: {
44
- bindings?: {
45
- [key: string]: string;
46
- };
47
- actions?: {
48
- [key: string]: string;
49
- };
50
- };
51
- repeat?: {
52
- collection: string;
53
- itemName?: string;
54
- } | null;
55
- animations?: any[];
56
- style?: Partial<CSSStyleDeclaration>;
57
- /**
58
- * generated by the "Hide If" binding
59
- */
60
- hide?: boolean;
61
- /**
62
- * generated by the "Show If" binding
63
- */
64
- show?: boolean;
65
- }
66
- export {};
@@ -1,44 +0,0 @@
1
- import type { BuilderBlock } from './builder-block.js';
2
- import type { Input } from './input.js';
3
- import type { Nullable } from './typescript.js';
4
- export interface Breakpoints {
5
- small: number;
6
- medium: number;
7
- }
8
- export interface BuilderContentVariation {
9
- data?: {
10
- title?: string;
11
- blocks?: BuilderBlock[];
12
- inputs?: Input[];
13
- state?: {
14
- [key: string]: any;
15
- };
16
- jsCode?: string;
17
- tsCode?: string;
18
- httpRequests?: {
19
- [key: string]: string;
20
- };
21
- [key: string]: any;
22
- };
23
- name?: string;
24
- testRatio?: number;
25
- id?: string;
26
- meta?: {
27
- breakpoints?: Nullable<Breakpoints>;
28
- [key: string]: any;
29
- };
30
- }
31
- export interface BuilderContent extends BuilderContentVariation {
32
- '@version'?: number;
33
- published?: 'published' | 'draft' | 'archived';
34
- modelId?: string;
35
- priority?: number;
36
- lastUpdated?: number;
37
- startDate?: number;
38
- endDate?: number;
39
- variations?: {
40
- [id: string]: BuilderContentVariation;
41
- };
42
- testVariationId?: string;
43
- testVariationName?: string;
44
- }
@@ -1,3 +0,0 @@
1
- export type CanTrack = {
2
- canTrack: boolean;
3
- };
@@ -1,105 +0,0 @@
1
- import type { BuilderElement } from './element';
2
- import type { Input } from './input';
3
- export interface ComponentInfo {
4
- /**
5
- * Name your component something unique, e.g. 'MyButton'. You can override built-in components
6
- * by registering a component with the same name, e.g. 'Text', to replace the built-in text component
7
- */
8
- name: string;
9
- description?: string;
10
- /**
11
- * Link to a documentation page for this component
12
- */
13
- docsLink?: string;
14
- image?: string;
15
- /**
16
- * Input schema for your component for users to fill in the options
17
- */
18
- inputs?: Input[];
19
- class?: any;
20
- type?: 'angular' | 'webcomponent' | 'react' | 'vue';
21
- defaultStyles?: {
22
- [key: string]: string;
23
- };
24
- /**
25
- * Turn on if your component can accept children. Be sure to use in combination with
26
- * withChildren(YourComponent) like here
27
- * github.com/BuilderIO/builder/blob/master/examples/react-design-system/src/components/HeroWithChildren/HeroWithChildren.builder.js#L5
28
- */
29
- canHaveChildren?: boolean;
30
- fragment?: boolean;
31
- /**
32
- * Do not wrap a component in a dom element. Be sure to use {...props.attributes} with this option
33
- * like here github.com/BuilderIO/builder/blob/master/packages/react/src/blocks/forms/Input.tsx#L34
34
- */
35
- noWrap?: boolean;
36
- /**
37
- * Default children
38
- */
39
- defaultChildren?: BuilderElement[];
40
- defaults?: Partial<BuilderElement>;
41
- hooks?: {
42
- [key: string]: string | Function;
43
- };
44
- /**
45
- * Hide your component in editor, useful for gradually deprecating components
46
- */
47
- hideFromInsertMenu?: boolean;
48
- tag?: string;
49
- static?: boolean;
50
- /**
51
- * Passing a list of model names will restrict using the component to only the models listed here, otherwise it'll be available for all models
52
- */
53
- models?: string[];
54
- /**
55
- * Specify restrictions direct children must match
56
- */
57
- childRequirements?: {
58
- /** Message to show when this doesn't match, e.g. "Children of 'Columns' must be a 'Column'" */
59
- message: string;
60
- /** Simple way to say children must be a specific component name */
61
- component?: string;
62
- /**
63
- * More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
64
- * of what the children objects should match, e.g.
65
- *
66
- * @example
67
- * query: {
68
- * // Child of this element must be a 'Button' or 'Text' component
69
- * 'component.name': { $in: ['Button', 'Text'] }
70
- * }
71
- */
72
- query?: any;
73
- };
74
- /**
75
- * Specify restrictions any parent must match
76
- */
77
- requiresParent?: {
78
- /** Message to show when this doesn't match, e.g. "'Add to cart' buttons must be within a 'Product box'" */
79
- message: string;
80
- /** Simple way to say a parent must be a specific component name, e.g. 'Product box' */
81
- component?: string;
82
- /**
83
- * More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
84
- * of what at least one parent in the parents hierarchy should match, e.g.
85
- *
86
- * @example
87
- * query: {
88
- * // Thils element must be somewhere inside either a 'Product box' or 'Collection' component
89
- * 'component.name': { $in: ['Product Box', 'Collection'] }
90
- * }
91
- */
92
- query?: any;
93
- };
94
- /** not yet implemented */
95
- friendlyName?: string;
96
- /**
97
- * Use to restrict access to your component based on a the current user permissions
98
- * By default components will show to all users
99
- * for more information on permissions in builder check https://www.builder.io/c/docs/guides/roles-and-permissions
100
- */
101
- requiredPermissions?: Array<Permission>;
102
- hidden?: boolean;
103
- }
104
- type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
105
- export {};
@@ -1,3 +0,0 @@
1
- export type DeepPartial<T> = {
2
- [P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
3
- };
@@ -1,59 +0,0 @@
1
- type JSONValue = string | number | boolean | JSONObject | JSONArray;
2
- interface JSONObject {
3
- [x: string]: JSONValue;
4
- }
5
- interface JSONArray extends Array<JSONValue> {
6
- }
7
- /** @todo typedoc this */
8
- export interface BuilderElement {
9
- '@type': '@builder.io/sdk:Element';
10
- '@version'?: number;
11
- id?: string;
12
- tagName?: string;
13
- layerName?: string;
14
- groupLocked?: boolean;
15
- layerLocked?: boolean;
16
- /** @todo make alias for properties.class */
17
- class?: string;
18
- children?: BuilderElement[];
19
- responsiveStyles?: {
20
- large?: Partial<CSSStyleDeclaration>;
21
- medium?: Partial<CSSStyleDeclaration>;
22
- small?: Partial<CSSStyleDeclaration>;
23
- /** @deprecated */
24
- xsmall?: Partial<CSSStyleDeclaration>;
25
- };
26
- component?: {
27
- name: string;
28
- options?: any;
29
- tag?: string;
30
- };
31
- bindings?: {
32
- [key: string]: string;
33
- };
34
- meta?: {
35
- [key: string]: JSONValue;
36
- };
37
- actions?: {
38
- [key: string]: string;
39
- };
40
- properties?: {
41
- [key: string]: string;
42
- };
43
- code?: {
44
- bindings?: {
45
- [key: string]: string;
46
- };
47
- actions?: {
48
- [key: string]: string;
49
- };
50
- };
51
- repeat?: {
52
- collection: string;
53
- itemName?: string;
54
- } | null;
55
- animations?: Animation[];
56
- }
57
- interface Animation {
58
- }
59
- export {};
@@ -1,121 +0,0 @@
1
- export interface Input {
2
- /** This is the name of the component prop this input represents */
3
- name: string;
4
- /** A friendlier name to show in the UI if the component prop name is not ideal for end users */
5
- friendlyName?: string;
6
- /** @hidden @deprecated */
7
- description?: string;
8
- /** A default value to use */
9
- defaultValue?: any;
10
- /**
11
- * The type of input to use, such as 'text'
12
- *
13
- * See all available inputs [here](https://www.builder.io/c/docs/custom-react-components#input-types)
14
- * and you can create your own custom input types and associated editor UIs with [plugins](https://www.builder.io/c/docs/extending/plugins)
15
- */
16
- type: string;
17
- /** Is this input mandatory or not */
18
- required?: boolean;
19
- /** @hidden */
20
- autoFocus?: boolean;
21
- subFields?: Input[];
22
- /**
23
- * Additional text to render in the UI to give guidance on how to use this
24
- *
25
- * @example
26
- * ```js
27
- * helperText: 'Be sure to use a proper URL, starting with "https://"'
28
- * 111
29
- */
30
- helperText?: string;
31
- /** @hidden */
32
- allowedFileTypes?: string[];
33
- /** @hidden */
34
- imageHeight?: number;
35
- /** @hidden */
36
- imageWidth?: number;
37
- /** @hidden */
38
- mediaHeight?: number;
39
- /** @hidden */
40
- mediaWidth?: number;
41
- /** @hidden */
42
- hideFromUI?: boolean;
43
- /** @hidden */
44
- modelId?: string;
45
- /**
46
- * Number field type validation maximum accepted input
47
- */
48
- max?: number;
49
- /**
50
- * Number field type validation minimum accepted input
51
- */
52
- min?: number;
53
- /**
54
- * Number field type step size when using arrows
55
- */
56
- step?: number;
57
- /**
58
- * Set this to `true` to show the editor for this input when
59
- * children of this component are selected. This is useful for things
60
- * like Tabs, such that users may not always select the Tabs component
61
- * directly but will still be looking for how to add additional tabs
62
- */
63
- broadcast?: boolean;
64
- /**
65
- * Set this to `true` to show the editor for this input when
66
- * group locked parents of this component are selected. This is useful
67
- * to bubble up important inputs for locked groups, like text and images
68
- */
69
- bubble?: boolean;
70
- /**
71
- * Set this to `true` if you want this component to be translatable
72
- */
73
- localized?: boolean;
74
- /** @hidden */
75
- options?: {
76
- [key: string]: any;
77
- };
78
- /**
79
- * For "text" input type, specifying an enum will show a dropdown of options instead
80
- */
81
- enum?: string[] | {
82
- label: string;
83
- value: any;
84
- helperText?: string;
85
- }[];
86
- /** Regex field validation for all string types (text, longText, html, url, etc) */
87
- regex?: {
88
- /** pattern to test, like "^\/[a-z]$" */
89
- pattern: string;
90
- /** flags for the RegExp constructor, e.g. "gi" */
91
- options?: string;
92
- /**
93
- * Friendly message to display to end-users if the regex fails, e.g.
94
- * "You must use a relative url starting with '/...' "
95
- */
96
- message: string;
97
- };
98
- /**
99
- * Set this to `true` to put this under the "show more" section of
100
- * the options editor. Useful for things that are more advanced
101
- * or more rarely used and don't need to be too prominent
102
- */
103
- advanced?: boolean;
104
- /** @hidden */
105
- /** @hidden */
106
- code?: boolean;
107
- /** @hidden */
108
- richText?: boolean;
109
- /** @hidden */
110
- showIf?: ((options: Map<string, any>) => boolean) | string;
111
- /** @hidden */
112
- copyOnAdd?: boolean;
113
- /**
114
- * Use optionally with inputs of type `reference`. Restricts the content entry picker to a specific model by name.
115
- */
116
- model?: string;
117
- valueType?: {
118
- type?: string;
119
- };
120
- onChange?: ((options: Map<string, any>) => void | Promise<void>) | string;
121
- }
@@ -1,3 +0,0 @@
1
- type MitosisTargets = import('@builder.io/mitosis').Target;
2
- export type Target = Extract<MitosisTargets, 'vue3' | 'vue2' | 'reactNative' | 'svelte' | 'qwik' | 'react' | 'solid'>;
3
- export {};