@builder.io/sdk-react 0.2.1 → 0.2.3-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 (437) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/react/blocks/BaseText.d.ts +2 -0
  3. package/dist/react/blocks/BaseText.js +1 -0
  4. package/dist/react/blocks/button/button.d.ts +2 -0
  5. package/dist/react/blocks/button/button.js +1 -0
  6. package/dist/react/blocks/button/component-info.d.ts +38 -0
  7. package/dist/react/blocks/columns/columns.d.ts +2 -0
  8. package/dist/react/blocks/columns/columns.js +1 -0
  9. package/dist/react/blocks/columns/component-info.d.ts +176 -0
  10. package/dist/react/blocks/custom-code/component-info.d.ts +31 -0
  11. package/dist/react/blocks/custom-code/custom-code.d.ts +2 -0
  12. package/dist/react/blocks/custom-code/custom-code.js +1 -0
  13. package/dist/react/blocks/embed/component-info.d.ts +22 -0
  14. package/dist/react/blocks/embed/embed.d.ts +2 -0
  15. package/dist/react/blocks/embed/embed.js +1 -0
  16. package/dist/react/blocks/embed/helpers.d.ts +1 -0
  17. package/dist/react/blocks/form/component-info.d.ts +235 -0
  18. package/dist/react/blocks/form/form.d.ts +2 -0
  19. package/dist/react/blocks/form/form.js +1 -0
  20. package/dist/react/blocks/fragment/component-info.d.ts +8 -0
  21. package/dist/react/blocks/fragment/fragment.d.ts +2 -0
  22. package/dist/react/blocks/fragment/fragment.js +1 -0
  23. package/dist/react/blocks/image/component-info.d.ts +114 -0
  24. package/dist/react/blocks/image/image.d.ts +2 -0
  25. package/dist/react/blocks/image/image.helpers.d.ts +1 -0
  26. package/dist/react/blocks/image/image.js +1 -0
  27. package/dist/react/blocks/img/component-info.d.ts +15 -0
  28. package/dist/react/blocks/img/img.d.ts +2 -0
  29. package/dist/react/blocks/img/img.js +1 -0
  30. package/dist/react/blocks/input/component-info.d.ts +66 -0
  31. package/dist/react/blocks/input/input.d.ts +2 -0
  32. package/dist/react/blocks/input/input.js +1 -0
  33. package/dist/react/blocks/raw-text/component-info.d.ts +10 -0
  34. package/dist/react/blocks/raw-text/raw-text.d.ts +2 -0
  35. package/dist/react/blocks/raw-text/raw-text.js +1 -0
  36. package/dist/react/blocks/section/component-info.d.ts +43 -0
  37. package/dist/react/blocks/section/section.d.ts +2 -0
  38. package/dist/react/blocks/section/section.js +1 -0
  39. package/dist/react/blocks/select/component-info.d.ts +61 -0
  40. package/dist/react/blocks/select/select.d.ts +2 -0
  41. package/dist/react/blocks/select/select.js +1 -0
  42. package/dist/react/blocks/submit-button/component-info.d.ts +23 -0
  43. package/dist/react/blocks/submit-button/submit-button.d.ts +2 -0
  44. package/dist/react/blocks/submit-button/submit-button.js +1 -0
  45. package/dist/react/blocks/symbol/component-info.d.ts +35 -0
  46. package/dist/react/blocks/symbol/symbol.d.ts +2 -0
  47. package/dist/react/blocks/symbol/symbol.js +3 -1
  48. package/dist/react/blocks/text/component-info.d.ts +19 -0
  49. package/dist/react/blocks/text/text.d.ts +2 -0
  50. package/dist/react/blocks/text/text.js +1 -0
  51. package/dist/react/blocks/textarea/component-info.d.ts +53 -0
  52. package/dist/react/blocks/textarea/textarea.d.ts +2 -0
  53. package/dist/react/blocks/textarea/textarea.js +1 -0
  54. package/dist/react/blocks/util.d.ts +1 -0
  55. package/dist/react/blocks/video/component-info.d.ts +80 -0
  56. package/dist/react/blocks/video/video.d.ts +2 -0
  57. package/dist/react/blocks/video/video.js +1 -0
  58. package/dist/react/components/render-block/block-styles.d.ts +2 -0
  59. package/dist/react/components/render-block/block-styles.js +1 -0
  60. package/dist/react/components/render-block/render-block.d.ts +2 -0
  61. package/dist/react/components/render-block/render-block.helpers.d.ts +13 -0
  62. package/dist/react/components/render-block/render-block.js +3 -3
  63. package/dist/react/components/render-block/render-component.d.ts +2 -0
  64. package/dist/react/components/render-block/render-component.js +1 -0
  65. package/dist/react/components/render-block/render-repeated-block.d.ts +2 -0
  66. package/dist/react/components/render-block/render-repeated-block.js +1 -0
  67. package/dist/react/components/render-blocks.d.ts +2 -0
  68. package/dist/react/components/render-blocks.js +1 -0
  69. package/dist/react/components/render-content/builder-editing.d.ts +2 -0
  70. package/dist/react/components/render-content/builder-editing.js +1 -0
  71. package/dist/react/components/render-content/components/render-styles.d.ts +2 -0
  72. package/dist/react/components/render-content/components/render-styles.helpers.d.ts +7 -0
  73. package/dist/react/components/render-content/components/render-styles.js +1 -0
  74. package/dist/react/components/render-content/index.d.ts +2 -0
  75. package/dist/react/components/render-content/render-content.d.ts +2 -0
  76. package/dist/react/components/render-content/render-content.helpers.d.ts +9 -0
  77. package/dist/react/components/render-content/render-content.js +9 -7
  78. package/dist/react/components/render-content-variants/helpers.js +98 -0
  79. package/dist/react/components/render-content-variants/render-content-variants.js +45 -0
  80. package/dist/react/components/render-inlined-styles.d.ts +2 -0
  81. package/dist/react/components/render-inlined-styles.js +1 -0
  82. package/dist/react/constants/builder-registered-components.d.ts +1 -0
  83. package/dist/react/constants/device-sizes.d.ts +21 -0
  84. package/dist/react/constants/target.d.ts +1 -0
  85. package/dist/react/context/builder.context.d.ts +11 -0
  86. package/dist/react/functions/camel-to-kebab-case.d.ts +1 -0
  87. package/dist/react/functions/evaluate.d.ts +7 -0
  88. package/dist/react/functions/event-handler-name.d.ts +1 -0
  89. package/dist/react/functions/extract-text-styles.d.ts +1 -0
  90. package/dist/react/functions/fast-clone.d.ts +1 -0
  91. package/dist/react/functions/get-block-actions-handler.d.ts +1 -0
  92. package/dist/react/functions/get-block-actions.d.ts +1 -0
  93. package/dist/react/functions/get-block-component-options.d.ts +1 -0
  94. package/dist/react/functions/get-block-properties.d.ts +1 -0
  95. package/dist/react/functions/get-block-properties.js +4 -1
  96. package/dist/react/functions/get-builder-search-params/fn.test.d.ts +1 -0
  97. package/dist/react/functions/get-builder-search-params/index.d.ts +4 -0
  98. package/dist/react/functions/get-content/ab-testing.d.ts +1 -0
  99. package/dist/react/functions/get-content/generate-content-url.d.ts +1 -0
  100. package/dist/react/functions/get-content/generate-content-url.test.d.ts +1 -0
  101. package/dist/react/functions/get-content/index.d.ts +2 -0
  102. package/dist/react/functions/get-content/index.js +22 -15
  103. package/dist/react/functions/get-fetch.d.ts +1 -0
  104. package/dist/react/functions/get-global-this.d.ts +1 -0
  105. package/dist/react/functions/get-processed-block.d.ts +6 -0
  106. package/dist/react/functions/get-processed-block.test.d.ts +1 -0
  107. package/dist/react/functions/get-react-native-block-styles.d.ts +5 -0
  108. package/dist/react/functions/if-target.d.ts +5 -0
  109. package/dist/react/functions/is-browser.d.ts +1 -0
  110. package/dist/react/functions/is-editing.d.ts +1 -0
  111. package/dist/react/functions/is-iframe.d.ts +1 -0
  112. package/dist/react/functions/is-previewing.d.ts +1 -0
  113. package/dist/react/functions/on-change.d.ts +2 -0
  114. package/dist/react/functions/on-change.test.d.ts +1 -0
  115. package/dist/react/functions/register-component.d.ts +6 -0
  116. package/dist/react/functions/register.d.ts +1 -0
  117. package/dist/react/functions/sanitize-react-native-block-styles.d.ts +1 -0
  118. package/dist/react/functions/set-editor-settings.d.ts +1 -0
  119. package/dist/react/functions/set.d.ts +1 -0
  120. package/dist/react/functions/set.test.d.ts +1 -0
  121. package/dist/react/functions/track/helpers.d.ts +5 -0
  122. package/dist/react/functions/track/index.d.ts +2 -0
  123. package/dist/react/functions/track/index.js +2 -1
  124. package/dist/react/functions/track/interaction.d.ts +14 -0
  125. package/dist/react/functions/transform-block-properties.d.ts +1 -0
  126. package/dist/react/functions/transform-block.d.ts +1 -0
  127. package/dist/react/helpers/ab-tests.d.ts +9 -0
  128. package/dist/react/helpers/cookie.d.ts +2 -0
  129. package/dist/react/helpers/css.d.ts +7 -0
  130. package/dist/react/helpers/flatten.d.ts +1 -0
  131. package/dist/react/helpers/localStorage.d.ts +9 -0
  132. package/dist/react/helpers/logger.d.ts +5 -0
  133. package/dist/react/helpers/logger.js +7 -0
  134. package/dist/react/helpers/nullable.d.ts +1 -0
  135. package/dist/react/helpers/sessionId.d.ts +6 -0
  136. package/dist/react/helpers/time.d.ts +1 -0
  137. package/dist/react/helpers/url.d.ts +1 -0
  138. package/dist/react/helpers/url.test.d.ts +1 -0
  139. package/dist/react/helpers/uuid.d.ts +2 -0
  140. package/dist/react/helpers/visitorId.d.ts +8 -0
  141. package/dist/react/index-helpers/blocks-exports.d.ts +11 -0
  142. package/dist/react/index-helpers/top-of-file.d.ts +2 -0
  143. package/{src/index.js → dist/react/index.d.ts} +2 -5
  144. package/dist/react/scripts/init-editing.d.ts +2 -0
  145. package/dist/react/types/api-version.d.ts +1 -0
  146. package/dist/react/types/targets.d.ts +0 -0
  147. package/dist/react/types/typescript.d.ts +0 -0
  148. package/dist/rsc/blocks/BaseText.d.ts +2 -0
  149. package/dist/rsc/blocks/button/button.d.ts +2 -0
  150. package/dist/rsc/blocks/button/component-info.d.ts +38 -0
  151. package/dist/rsc/blocks/columns/columns.d.ts +2 -0
  152. package/dist/rsc/blocks/columns/component-info.d.ts +176 -0
  153. package/dist/rsc/blocks/custom-code/component-info.d.ts +31 -0
  154. package/dist/rsc/blocks/custom-code/custom-code.d.ts +2 -0
  155. package/dist/rsc/blocks/embed/component-info.d.ts +22 -0
  156. package/dist/rsc/blocks/embed/embed.d.ts +2 -0
  157. package/dist/rsc/blocks/embed/helpers.d.ts +1 -0
  158. package/dist/rsc/blocks/form/component-info.d.ts +235 -0
  159. package/dist/rsc/blocks/form/form.d.ts +2 -0
  160. package/dist/rsc/blocks/fragment/component-info.d.ts +8 -0
  161. package/dist/rsc/blocks/fragment/fragment.d.ts +2 -0
  162. package/dist/rsc/blocks/image/component-info.d.ts +114 -0
  163. package/dist/rsc/blocks/image/image.d.ts +2 -0
  164. package/dist/rsc/blocks/image/image.helpers.d.ts +1 -0
  165. package/dist/rsc/blocks/img/component-info.d.ts +15 -0
  166. package/dist/rsc/blocks/img/img.d.ts +2 -0
  167. package/dist/rsc/blocks/input/component-info.d.ts +66 -0
  168. package/dist/rsc/blocks/input/input.d.ts +2 -0
  169. package/dist/rsc/blocks/raw-text/component-info.d.ts +10 -0
  170. package/dist/rsc/blocks/raw-text/raw-text.d.ts +2 -0
  171. package/dist/rsc/blocks/section/component-info.d.ts +43 -0
  172. package/dist/rsc/blocks/section/section.d.ts +2 -0
  173. package/dist/rsc/blocks/select/component-info.d.ts +61 -0
  174. package/dist/rsc/blocks/select/select.d.ts +2 -0
  175. package/dist/rsc/blocks/submit-button/component-info.d.ts +23 -0
  176. package/dist/rsc/blocks/submit-button/submit-button.d.ts +2 -0
  177. package/dist/rsc/blocks/symbol/component-info.d.ts +35 -0
  178. package/dist/rsc/blocks/symbol/symbol.d.ts +2 -0
  179. package/dist/rsc/blocks/symbol/symbol.js +2 -1
  180. package/dist/rsc/blocks/text/component-info.d.ts +19 -0
  181. package/dist/rsc/blocks/text/text.d.ts +2 -0
  182. package/dist/rsc/blocks/textarea/component-info.d.ts +53 -0
  183. package/dist/rsc/blocks/textarea/textarea.d.ts +2 -0
  184. package/dist/rsc/blocks/util.d.ts +1 -0
  185. package/dist/rsc/blocks/video/component-info.d.ts +80 -0
  186. package/dist/rsc/blocks/video/video.d.ts +2 -0
  187. package/dist/rsc/components/render-block/block-styles.d.ts +2 -0
  188. package/dist/rsc/components/render-block/render-block.d.ts +2 -0
  189. package/dist/rsc/components/render-block/render-block.helpers.d.ts +10 -0
  190. package/dist/rsc/components/render-block/render-block.js +2 -3
  191. package/dist/rsc/components/render-block/render-component.d.ts +2 -0
  192. package/dist/rsc/components/render-block/render-repeated-block.d.ts +2 -0
  193. package/dist/rsc/components/render-block/types.d.ts +0 -0
  194. package/dist/rsc/components/render-blocks.d.ts +2 -0
  195. package/dist/rsc/components/render-content/builder-editing.d.ts +27 -0
  196. package/dist/rsc/components/render-content/components/render-styles.d.ts +2 -0
  197. package/dist/rsc/components/render-content/components/render-styles.helpers.d.ts +7 -0
  198. package/dist/rsc/components/render-content/index.d.ts +2 -0
  199. package/dist/rsc/components/render-content/render-content.d.ts +2 -0
  200. package/dist/rsc/components/render-content/render-content.helpers.d.ts +9 -0
  201. package/dist/rsc/components/render-content/render-content.js +1 -0
  202. package/dist/rsc/components/render-content/render-content.types.d.ts +0 -0
  203. package/dist/rsc/components/render-content-variants/helpers.js +99 -0
  204. package/dist/rsc/components/render-content-variants/render-content-variants.js +45 -0
  205. package/dist/rsc/components/render-inlined-styles.d.ts +2 -0
  206. package/dist/rsc/constants/builder-registered-components.d.ts +1 -0
  207. package/dist/rsc/constants/device-sizes.d.ts +21 -0
  208. package/dist/rsc/constants/target.d.ts +1 -0
  209. package/dist/rsc/context/builder.context.d.ts +11 -0
  210. package/dist/rsc/context/types.d.ts +0 -0
  211. package/dist/rsc/functions/camel-to-kebab-case.d.ts +1 -0
  212. package/dist/rsc/functions/evaluate.d.ts +1 -0
  213. package/dist/rsc/functions/event-handler-name.d.ts +1 -0
  214. package/dist/rsc/functions/extract-text-styles.d.ts +1 -0
  215. package/dist/rsc/functions/fast-clone.d.ts +1 -0
  216. package/dist/rsc/functions/get-block-actions-handler.d.ts +1 -0
  217. package/dist/rsc/functions/get-block-actions.d.ts +1 -0
  218. package/dist/rsc/functions/get-block-component-options.d.ts +1 -0
  219. package/dist/rsc/functions/get-block-properties.d.ts +1 -0
  220. package/dist/rsc/functions/get-block-properties.js +4 -1
  221. package/dist/rsc/functions/get-builder-search-params/fn.test.d.ts +1 -0
  222. package/dist/rsc/functions/get-builder-search-params/index.d.ts +4 -0
  223. package/dist/rsc/functions/get-content/ab-testing.d.ts +1 -0
  224. package/dist/rsc/functions/get-content/generate-content-url.d.ts +1 -0
  225. package/dist/rsc/functions/get-content/generate-content-url.test.d.ts +1 -0
  226. package/dist/rsc/functions/get-content/index.d.ts +2 -0
  227. package/dist/rsc/functions/get-content/index.js +22 -15
  228. package/dist/rsc/functions/get-content/types.d.ts +0 -0
  229. package/dist/rsc/functions/get-fetch.d.ts +1 -0
  230. package/dist/rsc/functions/get-global-this.d.ts +1 -0
  231. package/dist/rsc/functions/get-processed-block.d.ts +6 -0
  232. package/dist/rsc/functions/get-processed-block.test.d.ts +1 -0
  233. package/dist/rsc/functions/get-react-native-block-styles.d.ts +5 -0
  234. package/dist/rsc/functions/if-target.d.ts +5 -0
  235. package/dist/rsc/functions/is-browser.d.ts +1 -0
  236. package/dist/rsc/functions/is-editing.d.ts +1 -0
  237. package/dist/rsc/functions/is-iframe.d.ts +1 -0
  238. package/dist/rsc/functions/is-previewing.d.ts +1 -0
  239. package/dist/rsc/functions/on-change.d.ts +2 -0
  240. package/dist/rsc/functions/on-change.test.d.ts +1 -0
  241. package/dist/rsc/functions/register-component.d.ts +6 -0
  242. package/dist/rsc/functions/register.d.ts +1 -0
  243. package/dist/rsc/functions/sanitize-react-native-block-styles.d.ts +1 -0
  244. package/dist/rsc/functions/set-editor-settings.d.ts +1 -0
  245. package/dist/rsc/functions/set.d.ts +1 -0
  246. package/dist/rsc/functions/set.test.d.ts +1 -0
  247. package/dist/rsc/functions/track/helpers.d.ts +5 -0
  248. package/dist/rsc/functions/track/index.d.ts +2 -0
  249. package/dist/rsc/functions/track/index.js +2 -1
  250. package/dist/rsc/functions/track/interaction.d.ts +14 -0
  251. package/dist/rsc/functions/transform-block-properties.d.ts +1 -0
  252. package/dist/rsc/functions/transform-block.d.ts +1 -0
  253. package/dist/rsc/helpers/ab-tests.d.ts +9 -0
  254. package/dist/rsc/helpers/cookie.d.ts +2 -0
  255. package/dist/rsc/helpers/css.d.ts +7 -0
  256. package/dist/rsc/helpers/flatten.d.ts +1 -0
  257. package/dist/rsc/helpers/localStorage.d.ts +9 -0
  258. package/dist/rsc/helpers/logger.d.ts +5 -0
  259. package/dist/rsc/helpers/logger.js +7 -0
  260. package/dist/rsc/helpers/nullable.d.ts +1 -0
  261. package/dist/rsc/helpers/sessionId.d.ts +6 -0
  262. package/dist/rsc/helpers/time.d.ts +1 -0
  263. package/dist/rsc/helpers/url.d.ts +1 -0
  264. package/dist/rsc/helpers/url.test.d.ts +1 -0
  265. package/dist/rsc/helpers/uuid.d.ts +2 -0
  266. package/dist/rsc/helpers/visitorId.d.ts +8 -0
  267. package/dist/rsc/index-helpers/blocks-exports.d.ts +11 -0
  268. package/dist/rsc/index-helpers/top-of-file.d.ts +2 -0
  269. package/dist/rsc/index.d.ts +11 -0
  270. package/dist/rsc/scripts/init-editing.d.ts +2 -0
  271. package/dist/rsc/types/api-version.d.ts +1 -0
  272. package/dist/rsc/types/builder-block.d.ts +0 -0
  273. package/dist/rsc/types/builder-content.d.ts +0 -0
  274. package/dist/rsc/types/can-track.d.ts +0 -0
  275. package/dist/rsc/types/components.d.ts +0 -0
  276. package/dist/rsc/types/deep-partial.d.ts +0 -0
  277. package/dist/rsc/types/element.d.ts +0 -0
  278. package/dist/rsc/types/input.d.ts +0 -0
  279. package/dist/rsc/types/targets.d.ts +0 -0
  280. package/dist/rsc/types/typescript.d.ts +0 -0
  281. package/package.json +4 -10
  282. package/packages/react/src/blocks/BaseText.jsx +1 -0
  283. package/packages/react/src/blocks/button/button.jsx +1 -0
  284. package/packages/react/src/blocks/columns/columns.jsx +1 -0
  285. package/packages/react/src/blocks/custom-code/custom-code.jsx +1 -0
  286. package/packages/react/src/blocks/embed/embed.jsx +1 -0
  287. package/packages/react/src/blocks/form/form.jsx +1 -0
  288. package/packages/react/src/blocks/fragment/fragment.jsx +1 -0
  289. package/packages/react/src/blocks/image/image.jsx +1 -0
  290. package/packages/react/src/blocks/img/img.jsx +1 -0
  291. package/packages/react/src/blocks/input/input.jsx +1 -0
  292. package/packages/react/src/blocks/raw-text/raw-text.jsx +1 -0
  293. package/packages/react/src/blocks/section/section.jsx +1 -0
  294. package/packages/react/src/blocks/select/select.jsx +1 -0
  295. package/packages/react/src/blocks/submit-button/submit-button.jsx +1 -0
  296. package/packages/react/src/blocks/symbol/symbol.jsx +3 -1
  297. package/packages/react/src/blocks/text/text.jsx +1 -0
  298. package/packages/react/src/blocks/textarea/textarea.jsx +1 -0
  299. package/packages/react/src/blocks/video/video.jsx +1 -0
  300. package/packages/react/src/components/render-block/block-styles.jsx +1 -0
  301. package/packages/react/src/components/render-block/render-block.jsx +3 -3
  302. package/packages/react/src/components/render-block/render-component.jsx +1 -0
  303. package/packages/react/src/components/render-block/render-repeated-block.jsx +1 -0
  304. package/packages/react/src/components/render-blocks.jsx +1 -0
  305. package/packages/react/src/components/render-content/builder-editing.jsx +1 -0
  306. package/packages/react/src/components/render-content/components/render-styles.jsx +1 -0
  307. package/packages/react/src/components/render-content/render-content.jsx +12 -8
  308. package/packages/react/src/components/render-inlined-styles.jsx +1 -0
  309. package/packages/react/src/functions/get-block-properties.js +4 -1
  310. package/packages/react/src/functions/get-content/index.js +21 -15
  311. package/packages/react/src/functions/track/index.js +2 -1
  312. package/packages/react/src/helpers/logger.js +9 -0
  313. package/packages/rsc/src/blocks/symbol/symbol.jsx +2 -4
  314. package/packages/rsc/src/components/render-block/render-block.jsx +2 -3
  315. package/packages/rsc/src/components/render-content/render-content.jsx +1 -0
  316. package/packages/rsc/src/functions/get-block-properties.js +4 -1
  317. package/packages/rsc/src/functions/get-content/index.js +21 -15
  318. package/packages/rsc/src/functions/track/index.js +2 -1
  319. package/packages/rsc/src/helpers/logger.js +9 -0
  320. package/tsconfig.base.json +8 -3
  321. package/src/blocks/BaseText.jsx +0 -9
  322. package/src/blocks/button/button.jsx +0 -27
  323. package/src/blocks/button/component-info.js +0 -41
  324. package/src/blocks/columns/columns.jsx +0 -172
  325. package/src/blocks/columns/component-info.js +0 -242
  326. package/src/blocks/custom-code/component-info.js +0 -31
  327. package/src/blocks/custom-code/custom-code.jsx +0 -64
  328. package/src/blocks/embed/component-info.js +0 -44
  329. package/src/blocks/embed/embed.jsx +0 -49
  330. package/src/blocks/embed/helpers.js +0 -9
  331. package/src/blocks/form/component-info.js +0 -262
  332. package/src/blocks/form/form.jsx +0 -253
  333. package/src/blocks/fragment/component-info.js +0 -11
  334. package/src/blocks/fragment/fragment.jsx +0 -5
  335. package/src/blocks/image/component-info.js +0 -151
  336. package/src/blocks/image/image.helpers.js +0 -48
  337. package/src/blocks/image/image.jsx +0 -122
  338. package/src/blocks/img/component-info.js +0 -20
  339. package/src/blocks/img/img.jsx +0 -17
  340. package/src/blocks/input/component-info.js +0 -74
  341. package/src/blocks/input/input.jsx +0 -19
  342. package/src/blocks/raw-text/component-info.js +0 -16
  343. package/src/blocks/raw-text/raw-text.jsx +0 -10
  344. package/src/blocks/section/component-info.js +0 -49
  345. package/src/blocks/section/section.jsx +0 -27
  346. package/src/blocks/select/component-info.js +0 -59
  347. package/src/blocks/select/select.jsx +0 -20
  348. package/src/blocks/submit-button/component-info.js +0 -28
  349. package/src/blocks/submit-button/submit-button.jsx +0 -9
  350. package/src/blocks/symbol/component-info.js +0 -43
  351. package/src/blocks/symbol/symbol.jsx +0 -84
  352. package/src/blocks/text/component-info.js +0 -24
  353. package/src/blocks/text/text.jsx +0 -10
  354. package/src/blocks/textarea/component-info.js +0 -47
  355. package/src/blocks/textarea/textarea.jsx +0 -13
  356. package/src/blocks/util.js +0 -8
  357. package/src/blocks/video/component-info.js +0 -106
  358. package/src/blocks/video/video.jsx +0 -58
  359. package/src/components/render-block/block-styles.jsx +0 -69
  360. package/src/components/render-block/render-block.helpers.js +0 -23
  361. package/src/components/render-block/render-block.jsx +0 -252
  362. package/src/components/render-block/render-component-with-context.jsx +0 -38
  363. package/src/components/render-block/render-component.jsx +0 -33
  364. package/src/components/render-block/render-repeated-block.jsx +0 -33
  365. package/src/components/render-blocks.jsx +0 -89
  366. package/src/components/render-content/builder-editing.jsx +0 -5
  367. package/src/components/render-content/components/render-styles.jsx +0 -64
  368. package/src/components/render-content/index.js +0 -4
  369. package/src/components/render-content/render-content.jsx +0 -370
  370. package/src/components/render-inlined-styles.jsx +0 -28
  371. package/src/constants/builder-registered-components.js +0 -54
  372. package/src/constants/device-sizes.js +0 -48
  373. package/src/constants/target.js +0 -4
  374. package/src/context/builder.context.js +0 -12
  375. package/src/functions/camel-to-kebab-case.js +0 -4
  376. package/src/functions/evaluate.js +0 -29
  377. package/src/functions/event-handler-name.js +0 -7
  378. package/src/functions/extract-text-styles.js +0 -22
  379. package/src/functions/fast-clone.js +0 -4
  380. package/src/functions/get-block-actions-handler.js +0 -11
  381. package/src/functions/get-block-actions.js +0 -18
  382. package/src/functions/get-block-component-options.js +0 -28
  383. package/src/functions/get-block-properties.js +0 -50
  384. package/src/functions/get-block-tag.js +0 -6
  385. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  386. package/src/functions/get-builder-search-params/index.js +0 -38
  387. package/src/functions/get-content/ab-testing.js +0 -99
  388. package/src/functions/get-content/generate-content-url.js +0 -55
  389. package/src/functions/get-content/generate-content-url.test.js +0 -31
  390. package/src/functions/get-content/index.js +0 -65
  391. package/src/functions/get-fetch.js +0 -14
  392. package/src/functions/get-global-this.js +0 -18
  393. package/src/functions/get-processed-block.js +0 -59
  394. package/src/functions/get-processed-block.test.js +0 -32
  395. package/src/functions/get-react-native-block-styles.js +0 -33
  396. package/src/functions/if-target.js +0 -15
  397. package/src/functions/is-browser.js +0 -6
  398. package/src/functions/is-editing.js +0 -7
  399. package/src/functions/is-iframe.js +0 -7
  400. package/src/functions/is-previewing.js +0 -14
  401. package/src/functions/on-change.js +0 -27
  402. package/src/functions/on-change.test.js +0 -19
  403. package/src/functions/register-component.js +0 -68
  404. package/src/functions/register.js +0 -29
  405. package/src/functions/sanitize-react-native-block-styles.js +0 -66
  406. package/src/functions/set-editor-settings.js +0 -15
  407. package/src/functions/set.js +0 -11
  408. package/src/functions/set.test.js +0 -16
  409. package/src/functions/track.js +0 -124
  410. package/src/functions/transform-block-properties.js +0 -6
  411. package/src/functions/transform-block.js +0 -6
  412. package/src/helpers/ab-tests.js +0 -16
  413. package/src/helpers/cookie.js +0 -81
  414. package/src/helpers/css.js +0 -34
  415. package/src/helpers/flatten.js +0 -34
  416. package/src/helpers/localStorage.js +0 -35
  417. package/src/helpers/nullable.js +0 -4
  418. package/src/helpers/sessionId.js +0 -52
  419. package/src/helpers/time.js +0 -5
  420. package/src/helpers/url.js +0 -13
  421. package/src/helpers/url.test.js +0 -21
  422. package/src/helpers/uuid.js +0 -13
  423. package/src/helpers/visitorId.js +0 -34
  424. package/src/index-helpers/blocks-exports.js +0 -22
  425. package/src/index-helpers/top-of-file.js +0 -4
  426. package/src/scripts/init-editing.js +0 -93
  427. /package/{src/components/render-block/types.js → dist/react/components/render-block/types.d.ts} +0 -0
  428. /package/{src/context/types.js → dist/react/components/render-content/render-content.types.d.ts} +0 -0
  429. /package/{src/functions/get-content/types.js → dist/react/context/types.d.ts} +0 -0
  430. /package/{src/types/builder-block.js → dist/react/functions/get-content/types.d.ts} +0 -0
  431. /package/{src/types/builder-content.js → dist/react/types/builder-block.d.ts} +0 -0
  432. /package/{src/types/can-track.js → dist/react/types/builder-content.d.ts} +0 -0
  433. /package/{src/types/components.js → dist/react/types/can-track.d.ts} +0 -0
  434. /package/{src/types/deep-partial.js → dist/react/types/components.d.ts} +0 -0
  435. /package/{src/types/element.js → dist/react/types/deep-partial.d.ts} +0 -0
  436. /package/{src/types/targets.js → dist/react/types/element.d.ts} +0 -0
  437. /package/{src/types/typescript.js → dist/react/types/input.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ export function getComponent({ block, context }: {
2
+ block: any;
3
+ context: any;
4
+ }): any;
5
+ export function getProxyState(context: any): any;
6
+ export function getRepeatItemData({ block, context }: {
7
+ block: any;
8
+ context: any;
9
+ }): {
10
+ context: any;
11
+ block: {};
12
+ }[] | undefined;
13
+ export function isEmptyHtmlElement(tagName: any): boolean;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useState } from "react";
3
4
  import { getBlockActions } from "../../functions/get-block-actions.js";
@@ -11,7 +12,6 @@ import { TARGET } from "../../constants/target.js";
11
12
  import { extractTextStyles } from "../../functions/extract-text-styles.js";
12
13
  import RenderComponent from "./render-component";
13
14
  import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
14
- import { checkIsDefined } from "../../helpers/nullable.js";
15
15
  function RenderBlock(props) {
16
16
  const [component, setComponent] = useState(() => getComponent({
17
17
  block: props.block,
@@ -33,10 +33,10 @@ function RenderBlock(props) {
33
33
  }
34
34
  const [tag, setTag] = useState(() => props.block.tagName || "div");
35
35
  function canShowBlock() {
36
- if (checkIsDefined(useBlock().hide)) {
36
+ if ("hide" in useBlock()) {
37
37
  return !useBlock().hide;
38
38
  }
39
- if (checkIsDefined(useBlock().show)) {
39
+ if ("show" in useBlock()) {
40
40
  return useBlock().show;
41
41
  }
42
42
  return true;
@@ -0,0 +1,2 @@
1
+ export default RenderComponent;
2
+ declare function RenderComponent(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import BlockStyles from "./block-styles";
3
4
  import RenderBlock from "./render-block";
@@ -0,0 +1,2 @@
1
+ export default RenderRepeatedBlock;
2
+ declare function RenderRepeatedBlock(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useContext } from "react";
3
4
  import BuilderContext from "../../context/builder.context.js";
@@ -0,0 +1,2 @@
1
+ export default RenderBlocks;
2
+ declare function RenderBlocks(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useContext } from "react";
3
4
  import BuilderContext from "../context/builder.context.js";
@@ -0,0 +1,2 @@
1
+ export default BuilderEditing;
2
+ declare function BuilderEditing(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  function BuilderEditing(props) {
3
4
  return React.createElement("div", null);
@@ -0,0 +1,2 @@
1
+ export default RenderContentStyles;
2
+ declare function RenderContentStyles(props: any): JSX.Element;
@@ -0,0 +1,7 @@
1
+ export function getCss({ cssCode, contentId }: {
2
+ cssCode: any;
3
+ contentId: any;
4
+ }): any;
5
+ export function getFontCss({ customFonts }: {
6
+ customFonts: any;
7
+ }): any;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useState } from "react";
3
4
  import RenderInlinedStyles from "../../render-inlined-styles";
@@ -0,0 +1,2 @@
1
+ export { default2 as default };
2
+ import { default as default2 } from "./render-content";
@@ -0,0 +1,2 @@
1
+ export default RenderContent;
2
+ declare function RenderContent(props: any): JSX.Element;
@@ -0,0 +1,9 @@
1
+ export function getContentInitialValue({ content, data }: {
2
+ content: any;
3
+ data: any;
4
+ }): any;
5
+ export function getContextStateInitialValue({ content, data, locale }: {
6
+ content: any;
7
+ data: any;
8
+ locale: any;
9
+ }): any;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useState, useContext, useRef, useEffect } from "react";
3
4
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
@@ -17,6 +18,7 @@ import { checkIsDefined } from "../../helpers/nullable.js";
17
18
  import { getInteractionPropertiesForEvent } from "../../functions/track/interaction.js";
18
19
  import { getContentInitialValue, getContextStateInitialValue, } from "./render-content.helpers.js";
19
20
  import { TARGET } from "../../constants/target.js";
21
+ import { logger } from "../../helpers/logger.js";
20
22
  function RenderContent(props) {
21
23
  const elementRef = useRef(null);
22
24
  const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
@@ -186,7 +188,7 @@ function RenderContent(props) {
186
188
  }
187
189
  useEffect(() => {
188
190
  if (!props.apiKey) {
189
- console.error("[Builder.io]: No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
191
+ logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
190
192
  }
191
193
  if (isBrowser()) {
192
194
  if (isEditing()) {
@@ -225,19 +227,19 @@ function RenderContent(props) {
225
227
  // override normal content in preview mode
226
228
  if (isPreviewing()) {
227
229
  const searchParams = new URL(location.href).searchParams;
228
- const searchParamPreview = searchParams.get("builder.preview");
230
+ const searchParamPreviewModel = searchParams.get("builder.preview");
231
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
229
232
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
230
233
  /**
231
234
  * Make sure that:
232
235
  * - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
233
- *
234
- * TO-DO: should we check that the preview item ID is the same as the initial one being rendered? Or would
235
- * this break scenarios where the item is not published yet?
236
+ * - if there is content, that the preview ID is the same as that of the one we receive.
236
237
  *
237
238
  * TO-DO: should we only update the state when there is a change?
238
239
  **/
239
- if (searchParamPreview === props.model &&
240
- previewApiKey === props.apiKey) {
240
+ if (searchParamPreviewModel === props.model &&
241
+ previewApiKey === props.apiKey &&
242
+ (!props.content || searchParamPreviewId === props.content.id)) {
241
243
  getContent({
242
244
  model: props.model,
243
245
  apiKey: props.apiKey,
@@ -0,0 +1,98 @@
1
+ const variantScriptFn = function main(contentId, variants) {
2
+ console.log("Running variant script", JSON.stringify({ contentId, variants }));
3
+ if (!navigator.cookieEnabled) {
4
+ console.log("Cookies are disabled, skipping variant script");
5
+ return;
6
+ }
7
+ const templateSelectorById = (id) => `template[data-template-variant-id="${id}"]`;
8
+ function removeTemplates() {
9
+ console.log("Removing variants");
10
+ variants.forEach((template) => {
11
+ const el2 = document.querySelector(templateSelectorById(template.id));
12
+ if (el2) {
13
+ console.log("Removing variant", template.id);
14
+ el2.remove();
15
+ }
16
+ });
17
+ const el = document.getElementById(`variants-script-${contentId}`);
18
+ if (el) {
19
+ console.log("Removing variant script");
20
+ el.remove();
21
+ }
22
+ }
23
+ if (typeof document.createElement("template").content === "undefined") {
24
+ console.log("Template polyfill not found, skipping variant script");
25
+ removeTemplates();
26
+ return;
27
+ }
28
+ function setCookie(name, value, days) {
29
+ let expires = "";
30
+ if (days) {
31
+ const date = new Date();
32
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
33
+ expires = "; expires=" + date.toUTCString();
34
+ }
35
+ document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
36
+ }
37
+ function getCookie(name) {
38
+ const nameEQ = name + "=";
39
+ const ca = document.cookie.split(";");
40
+ for (let i = 0; i < ca.length; i++) {
41
+ let c = ca[i];
42
+ while (c.charAt(0) == " ")
43
+ c = c.substring(1, c.length);
44
+ if (c.indexOf(nameEQ) == 0)
45
+ return c.substring(nameEQ.length, c.length);
46
+ }
47
+ return null;
48
+ }
49
+ function getAndSetVariantId() {
50
+ const cookieName = `builder.tests.${contentId}`;
51
+ const variantInCookie = getCookie(cookieName);
52
+ const availableIDs = variants.map((vr) => vr.id).concat(contentId);
53
+ if (variantInCookie && availableIDs.indexOf(variantInCookie) > -1) {
54
+ return variantInCookie;
55
+ }
56
+ let n = 0;
57
+ const random = Math.random();
58
+ for (let i = 0; i < variants.length; i++) {
59
+ const variant = variants[i];
60
+ const testRatio = variant.testRatio;
61
+ n += testRatio;
62
+ if (random < n) {
63
+ setCookie(cookieName, variant.id);
64
+ return variant.id;
65
+ }
66
+ }
67
+ setCookie(cookieName, contentId);
68
+ return contentId;
69
+ }
70
+ const variantId = getAndSetVariantId();
71
+ if (variantId !== contentId) {
72
+ console.log("Variant found", variantId);
73
+ const winningTemplate = document.querySelector(templateSelectorById(variantId));
74
+ console.log("winningTemplate", winningTemplate);
75
+ if (!winningTemplate) {
76
+ console.log("No template found for variant", variantId);
77
+ console.log("selector: ", templateSelectorById(variantId));
78
+ return;
79
+ }
80
+ const templatesParent = winningTemplate.parentNode;
81
+ if (templatesParent) {
82
+ templatesParent.replaceChild(winningTemplate.content.firstElementChild, winningTemplate);
83
+ }
84
+ }
85
+ else if (variants.length > 0) {
86
+ console.log("No variant found, removing all variants");
87
+ }
88
+ removeTemplates();
89
+ console.log("Variant script complete");
90
+ };
91
+ const getVariantsScriptString = (variants, contentId) => {
92
+ const fnStr = variantScriptFn.toString().replace(/\s+/g, " ");
93
+ return `
94
+ ${fnStr}
95
+ main("${contentId}", ${JSON.stringify(variants)})
96
+ `;
97
+ };
98
+ export { getVariantsScriptString };
@@ -0,0 +1,45 @@
1
+ import * as React from "react";
2
+ import { useState, useEffect } from "react";
3
+ import { isBrowser } from "../../functions/is-browser";
4
+ import { getVariantsScriptString } from "./helpers";
5
+ import RenderContent from "../render-content/render-content";
6
+ import { checkIsDefined } from "../../helpers/nullable";
7
+ import { handleABTestingSync } from "../../helpers/ab-tests";
8
+ import { TARGET } from "../../constants/target";
9
+ function RenderContentVariants(props) {
10
+ const [variantScriptStr, setVariantScriptStr] = useState(() => getVariantsScriptString(Object.values(props.content?.variations || {}).map((value) => ({
11
+ id: value.id,
12
+ testRatio: value.testRatio,
13
+ })), props.content?.id || ""));
14
+ const [variants, setVariants] = useState(() => [
15
+ ...Object.values(props.content?.variations || {}),
16
+ props.content,
17
+ ]);
18
+ const [contentToUse, setContentToUse] = useState(() => ((isBrowser() && props.canTrack) || !isBrowser()) &&
19
+ Object.keys(props.content?.variations || {}).length > 0
20
+ ? undefined
21
+ : handleABTestingSync({
22
+ item: props.content,
23
+ canTrack: checkIsDefined(props.canTrack) ? props.canTrack : true,
24
+ }));
25
+ const [shouldRenderVariants, setShouldRenderVariants] = useState(() => ((isBrowser() && props.canTrack) || !isBrowser()) &&
26
+ Object.keys(props.content?.variations || {}).length > 0);
27
+ useEffect(() => {
28
+ if (TARGET === "svelte" && shouldRenderVariants) {
29
+ // get first template in loop
30
+ const templates = document.querySelectorAll(`template[data-template-variant-id="${variants[0]?.id}"]`);
31
+ const lastTemplate = templates[templates.length - 1];
32
+ // create and append script as sibling of template
33
+ const script = document.createElement("script");
34
+ script.id = `variants-script-${props.content?.id}`;
35
+ script.innerHTML = variantScriptStr;
36
+ lastTemplate?.parentNode?.append(script, lastTemplate);
37
+ }
38
+ }, []);
39
+ return (React.createElement(React.Fragment, null, shouldRenderVariants ? (React.createElement(React.Fragment, null,
40
+ variants?.map((variant) => (React.createElement("template", { key: variant?.id, "data-template-variant-id": variant?.id },
41
+ React.createElement(RenderContent, { content: variant, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents })))),
42
+ React.createElement("script", { id: `variants-script-${props.content?.id}`, dangerouslySetInnerHTML: { __html: variantScriptStr } }),
43
+ React.createElement(RenderContent, { content: contentToUse, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents }))) : (React.createElement(RenderContent, { content: contentToUse, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents }))));
44
+ }
45
+ export default RenderContentVariants;
@@ -0,0 +1,2 @@
1
+ export default RenderInlinedStyles;
2
+ declare function RenderInlinedStyles(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { TARGET } from "../constants/target.js";
3
4
  function RenderInlinedStyles(props) {
@@ -0,0 +1 @@
1
+ export function getDefaultRegisteredComponents(): any[];
@@ -0,0 +1,21 @@
1
+ export function getMaxWidthQueryForSize(size: any, sizeValues?: {
2
+ small: {
3
+ min: number;
4
+ default: number;
5
+ max: number;
6
+ };
7
+ medium: {
8
+ min: number;
9
+ default: number;
10
+ max: number;
11
+ };
12
+ large: {
13
+ min: number;
14
+ default: number;
15
+ max: number;
16
+ };
17
+ }): string;
18
+ export function getSizesForBreakpoints({ small, medium }: {
19
+ small: any;
20
+ medium: any;
21
+ }): any;
@@ -0,0 +1 @@
1
+ export const TARGET: "react";
@@ -0,0 +1,11 @@
1
+ export { stdin_default as default };
2
+ declare var stdin_default: import("react").Context<{
3
+ content: null;
4
+ context: {};
5
+ state: {};
6
+ setState(): void;
7
+ apiKey: null;
8
+ apiVersion: undefined;
9
+ registeredComponents: {};
10
+ inheritedStyles: {};
11
+ }>;
@@ -0,0 +1 @@
1
+ export function camelToKebabCase(string: any): any;
@@ -0,0 +1,7 @@
1
+ export function evaluate({ code, context, state, event, isExpression }: {
2
+ code: any;
3
+ context: any;
4
+ state: any;
5
+ event: any;
6
+ isExpression?: boolean | undefined;
7
+ }): any;
@@ -0,0 +1 @@
1
+ export function getEventHandlerName(key: any): string;
@@ -0,0 +1 @@
1
+ export function extractTextStyles(styles: any): {};
@@ -0,0 +1 @@
1
+ export function fastClone(obj: any): any;
@@ -0,0 +1 @@
1
+ export function createEventHandler(value: any, options: any): (event: any) => any;
@@ -0,0 +1 @@
1
+ export function getBlockActions(options: any): {};
@@ -0,0 +1 @@
1
+ export function getBlockComponentOptions(block: any): any;
@@ -0,0 +1 @@
1
+ export function getBlockProperties(block: any): any;
@@ -20,9 +20,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { TARGET } from "../constants/target.js";
21
21
  import { convertStyleMapToCSSArray } from "../helpers/css.js";
22
22
  import { transformBlockProperties } from "./transform-block-properties.js";
23
+ const extractRelevantRootBlockProperties = (block) => {
24
+ return { href: block.href };
25
+ };
23
26
  function getBlockProperties(block) {
24
27
  var _a;
25
- const properties = __spreadProps(__spreadValues({}, block.properties), {
28
+ const properties = __spreadProps(__spreadValues(__spreadValues({}, extractRelevantRootBlockProperties(block)), block.properties), {
26
29
  "builder-id": block.id,
27
30
  style: getStyleAttribute(block.style),
28
31
  class: [block.id, "builder-block", block.class, (_a = block.properties) == null ? void 0 : _a.class].filter(Boolean).join(" ")
@@ -0,0 +1,4 @@
1
+ export function convertSearchParamsToQueryObject(searchParams: any): {};
2
+ export function getBuilderSearchParams(_options: any): {};
3
+ export function getBuilderSearchParamsFromWindow(): {};
4
+ export function normalizeSearchParams(searchParams: any): any;
@@ -0,0 +1 @@
1
+ export function handleABTesting(_0: any): Promise<any>;
@@ -0,0 +1 @@
1
+ export function generateContentUrl(options: any): URL;
@@ -0,0 +1,2 @@
1
+ export function getAllContent(options: any): Promise<any>;
2
+ export function getContent(options: any): Promise<any>;
@@ -39,13 +39,14 @@ var __async = (__this, __arguments, generator) => {
39
39
  step((generator = generator.apply(__this, __arguments)).next());
40
40
  });
41
41
  };
42
+ import { logger } from "../../helpers/logger.js";
42
43
  import { fetch } from "../get-fetch.js";
43
44
  import { handleABTesting } from "./ab-testing.js";
44
45
  import { generateContentUrl } from "./generate-content-url.js";
45
46
  function getContent(options) {
46
47
  return __async(this, null, function* () {
47
48
  const allContent = yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }));
48
- if ("results" in allContent) {
49
+ if (allContent && "results" in allContent) {
49
50
  return (allContent == null ? void 0 : allContent.results[0]) || null;
50
51
  }
51
52
  return null;
@@ -53,25 +54,31 @@ function getContent(options) {
53
54
  }
54
55
  function getAllContent(options) {
55
56
  return __async(this, null, function* () {
56
- const url = generateContentUrl(options);
57
- const res = yield fetch(url.href);
58
- const content = yield res.json();
59
- if ("status" in content && !("results" in content)) {
60
- console.error("[Builder.io]: Error fetching data. ", content, options);
61
- return content;
62
- }
63
- const canTrack = options.canTrack !== false;
64
57
  try {
65
- if (canTrack && Array.isArray(content.results)) {
66
- for (const item of content.results) {
67
- yield handleABTesting({ item, canTrack });
58
+ const url = generateContentUrl(options);
59
+ const res = yield fetch(url.href);
60
+ const content = yield res.json();
61
+ if ("status" in content && !("results" in content)) {
62
+ logger.error("Error fetching data. ", { url, content, options });
63
+ return content;
64
+ }
65
+ const canTrack = options.canTrack !== false;
66
+ try {
67
+ if (canTrack && Array.isArray(content.results)) {
68
+ for (const item of content.results) {
69
+ yield handleABTesting({ item, canTrack });
70
+ }
68
71
  }
69
72
  }
73
+ catch (e) {
74
+ logger.error("Could not setup A/B testing. ", e);
75
+ }
76
+ return content;
70
77
  }
71
- catch (e) {
72
- console.error("[Builder.io]: Could not setup A/B testing. ", e);
78
+ catch (error) {
79
+ logger.error("Error fetching data. ", error);
80
+ return null;
73
81
  }
74
- return content;
75
82
  });
76
83
  }
77
84
  export { getAllContent, getContent };
@@ -0,0 +1 @@
1
+ export const fetch: typeof globalThis.fetch;
@@ -0,0 +1 @@
1
+ export function getGlobalThis(): typeof globalThis;
@@ -0,0 +1,6 @@
1
+ export function getProcessedBlock({ block, context, shouldEvaluateBindings, state }: {
2
+ block: any;
3
+ context: any;
4
+ shouldEvaluateBindings: any;
5
+ state: any;
6
+ }): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export function getReactNativeBlockStyles({ block, context, blockStyles }: {
2
+ block: any;
3
+ context: any;
4
+ blockStyles: any;
5
+ }): {};
@@ -0,0 +1,5 @@
1
+ export function ifTarget({ targets, doThing, elseThing }: {
2
+ targets: any;
3
+ doThing: any;
4
+ elseThing: any;
5
+ }): any;
@@ -0,0 +1 @@
1
+ export function isBrowser(): boolean;
@@ -0,0 +1 @@
1
+ export function isEditing(): boolean;
@@ -0,0 +1 @@
1
+ export function isIframe(): boolean;
@@ -0,0 +1 @@
1
+ export function isPreviewing(): boolean;
@@ -0,0 +1,2 @@
1
+ export function onChange(obj: any, cb: any): any;
2
+ export const onChangeProxySymbol: unique symbol;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export const components: any[];
2
+ export function createRegisterComponentMessage(_a: any): {
3
+ type: string;
4
+ data: any;
5
+ };
6
+ export function registerComponent(component: any, info: any): any;
@@ -0,0 +1 @@
1
+ export function register(type: any, info: any): void;
@@ -0,0 +1 @@
1
+ export function sanitizeReactNativeBlockStyles(styles: any): {};
@@ -0,0 +1 @@
1
+ export function setEditorSettings(newSettings: any): void;
@@ -0,0 +1 @@
1
+ export function set(obj: any, _path: any, value: any): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export function getUserAttributes(): {
2
+ urlPath: string | undefined;
3
+ host: string | undefined;
4
+ device: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export function _track(eventProps: any): Promise<any>;
2
+ export function track(args: any): Promise<any>;
@@ -52,6 +52,7 @@ var __async = (__this, __arguments, generator) => {
52
52
  });
53
53
  };
54
54
  import { TARGET } from "../../constants/target.js";
55
+ import { logger } from "../../helpers/logger.js";
55
56
  import { getSessionId } from "../../helpers/sessionId.js";
56
57
  import { getVisitorId } from "../../helpers/visitorId.js";
57
58
  import { isBrowser } from "../is-browser.js";
@@ -90,7 +91,7 @@ const createEvent = (_a) => __async(void 0, null, function* () {
90
91
  function _track(eventProps) {
91
92
  return __async(this, null, function* () {
92
93
  if (!eventProps.apiKey) {
93
- console.error("[Builder.io]: Missing API key for track call. Please provide your API key.");
94
+ logger.error("Missing API key for track call. Please provide your API key.");
94
95
  return;
95
96
  }
96
97
  if (!eventProps.canTrack) {
@@ -0,0 +1,14 @@
1
+ export function getInteractionPropertiesForEvent(event: any): {
2
+ targetBuilderElement: any;
3
+ metadata: {
4
+ targetOffset: {
5
+ x: number;
6
+ y: number;
7
+ } | undefined;
8
+ builderTargetOffset: {
9
+ x: number;
10
+ y: number;
11
+ } | undefined;
12
+ builderElementIndex: number | undefined;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export function transformBlockProperties(properties: any): any;