@builder.io/sdk-react-native 1.0.31-2 → 1.0.32

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 (426) hide show
  1. package/lib/browser/commonjs/blocks/image/component-info.js +5 -0
  2. package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
  3. package/lib/browser/commonjs/components/block/block.helpers.js +27 -7
  4. package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
  5. package/lib/browser/commonjs/components/block/block.js +9 -13
  6. package/lib/browser/commonjs/components/block/block.js.map +1 -1
  7. package/lib/browser/commonjs/components/block/components/block-wrapper.js.map +1 -1
  8. package/lib/browser/commonjs/components/content/components/enable-editor.js +9 -9
  9. package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
  10. package/lib/browser/commonjs/components/content/components/styles.helpers.js +2 -2
  11. package/lib/browser/commonjs/components/content/components/styles.helpers.js.map +1 -1
  12. package/lib/browser/commonjs/components/content/content.js +0 -1
  13. package/lib/browser/commonjs/components/content/content.js.map +1 -1
  14. package/lib/browser/commonjs/constants/sdk-version.js +1 -1
  15. package/lib/browser/commonjs/constants/sdk-version.js.map +1 -1
  16. package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  17. package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  18. package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  19. package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  20. package/lib/browser/commonjs/functions/get-block-actions.js +1 -2
  21. package/lib/browser/commonjs/functions/get-block-actions.js.map +1 -1
  22. package/lib/browser/commonjs/functions/get-block-component-options.js +1 -5
  23. package/lib/browser/commonjs/functions/get-block-component-options.js.map +1 -1
  24. package/lib/browser/commonjs/functions/get-content/index.js +1 -2
  25. package/lib/browser/commonjs/functions/get-content/index.js.map +1 -1
  26. package/lib/browser/commonjs/helpers/cookie.js +2 -12
  27. package/lib/browser/commonjs/helpers/cookie.js.map +1 -1
  28. package/lib/browser/module/blocks/image/component-info.js +5 -0
  29. package/lib/browser/module/blocks/image/component-info.js.map +1 -1
  30. package/lib/browser/module/components/block/block.helpers.js +22 -4
  31. package/lib/browser/module/components/block/block.helpers.js.map +1 -1
  32. package/lib/browser/module/components/block/block.js +10 -14
  33. package/lib/browser/module/components/block/block.js.map +1 -1
  34. package/lib/browser/module/components/block/components/block-wrapper.js.map +1 -1
  35. package/lib/browser/module/components/content/components/enable-editor.js +9 -9
  36. package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
  37. package/lib/browser/module/components/content/components/styles.helpers.js +2 -2
  38. package/lib/browser/module/components/content/components/styles.helpers.js.map +1 -1
  39. package/lib/browser/module/components/content/content.js +0 -1
  40. package/lib/browser/module/components/content/content.js.map +1 -1
  41. package/lib/browser/module/constants/sdk-version.js +1 -1
  42. package/lib/browser/module/constants/sdk-version.js.map +1 -1
  43. package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  44. package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  45. package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  46. package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  47. package/lib/browser/module/functions/get-block-actions.js +1 -2
  48. package/lib/browser/module/functions/get-block-actions.js.map +1 -1
  49. package/lib/browser/module/functions/get-block-component-options.js +1 -5
  50. package/lib/browser/module/functions/get-block-component-options.js.map +1 -1
  51. package/lib/browser/module/functions/get-content/index.js +1 -2
  52. package/lib/browser/module/functions/get-content/index.js.map +1 -1
  53. package/lib/browser/module/helpers/cookie.js +2 -11
  54. package/lib/browser/module/helpers/cookie.js.map +1 -1
  55. package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
  56. package/lib/browser/typescript/blocks/image/image.types.d.ts +1 -0
  57. package/lib/browser/typescript/blocks/image/image.types.d.ts.map +1 -1
  58. package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
  59. package/lib/browser/typescript/components/block/block.helpers.d.ts +20 -2
  60. package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
  61. package/lib/browser/typescript/components/block/components/block-wrapper.d.ts +0 -1
  62. package/lib/browser/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  63. package/lib/browser/typescript/components/content/components/enable-editor.d.ts +1 -1
  64. package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  65. package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
  66. package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
  67. package/lib/browser/typescript/constants/sdk-version.d.ts.map +1 -1
  68. package/lib/browser/typescript/functions/get-block-component-options.d.ts.map +1 -1
  69. package/lib/browser/typescript/helpers/cookie.d.ts +0 -1
  70. package/lib/browser/typescript/helpers/cookie.d.ts.map +1 -1
  71. package/lib/edge/commonjs/blocks/image/component-info.js +5 -0
  72. package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
  73. package/lib/edge/commonjs/components/block/block.helpers.js +27 -7
  74. package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
  75. package/lib/edge/commonjs/components/block/block.js +9 -13
  76. package/lib/edge/commonjs/components/block/block.js.map +1 -1
  77. package/lib/edge/commonjs/components/block/components/block-wrapper.js.map +1 -1
  78. package/lib/edge/commonjs/components/content/components/enable-editor.js +9 -9
  79. package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
  80. package/lib/edge/commonjs/components/content/components/styles.helpers.js +2 -2
  81. package/lib/edge/commonjs/components/content/components/styles.helpers.js.map +1 -1
  82. package/lib/edge/commonjs/components/content/content.js +0 -1
  83. package/lib/edge/commonjs/components/content/content.js.map +1 -1
  84. package/lib/edge/commonjs/constants/sdk-version.js +1 -1
  85. package/lib/edge/commonjs/constants/sdk-version.js.map +1 -1
  86. package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  87. package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  88. package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  89. package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  90. package/lib/edge/commonjs/functions/get-block-actions.js +1 -2
  91. package/lib/edge/commonjs/functions/get-block-actions.js.map +1 -1
  92. package/lib/edge/commonjs/functions/get-block-component-options.js +1 -5
  93. package/lib/edge/commonjs/functions/get-block-component-options.js.map +1 -1
  94. package/lib/edge/commonjs/functions/get-content/index.js +1 -2
  95. package/lib/edge/commonjs/functions/get-content/index.js.map +1 -1
  96. package/lib/edge/commonjs/helpers/cookie.js +2 -12
  97. package/lib/edge/commonjs/helpers/cookie.js.map +1 -1
  98. package/lib/edge/module/blocks/image/component-info.js +5 -0
  99. package/lib/edge/module/blocks/image/component-info.js.map +1 -1
  100. package/lib/edge/module/components/block/block.helpers.js +22 -4
  101. package/lib/edge/module/components/block/block.helpers.js.map +1 -1
  102. package/lib/edge/module/components/block/block.js +10 -14
  103. package/lib/edge/module/components/block/block.js.map +1 -1
  104. package/lib/edge/module/components/block/components/block-wrapper.js.map +1 -1
  105. package/lib/edge/module/components/content/components/enable-editor.js +9 -9
  106. package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
  107. package/lib/edge/module/components/content/components/styles.helpers.js +2 -2
  108. package/lib/edge/module/components/content/components/styles.helpers.js.map +1 -1
  109. package/lib/edge/module/components/content/content.js +0 -1
  110. package/lib/edge/module/components/content/content.js.map +1 -1
  111. package/lib/edge/module/constants/sdk-version.js +1 -1
  112. package/lib/edge/module/constants/sdk-version.js.map +1 -1
  113. package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  114. package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  115. package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  116. package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  117. package/lib/edge/module/functions/get-block-actions.js +1 -2
  118. package/lib/edge/module/functions/get-block-actions.js.map +1 -1
  119. package/lib/edge/module/functions/get-block-component-options.js +1 -5
  120. package/lib/edge/module/functions/get-block-component-options.js.map +1 -1
  121. package/lib/edge/module/functions/get-content/index.js +1 -2
  122. package/lib/edge/module/functions/get-content/index.js.map +1 -1
  123. package/lib/edge/module/helpers/cookie.js +2 -11
  124. package/lib/edge/module/helpers/cookie.js.map +1 -1
  125. package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
  126. package/lib/edge/typescript/blocks/image/image.types.d.ts +1 -0
  127. package/lib/edge/typescript/blocks/image/image.types.d.ts.map +1 -1
  128. package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
  129. package/lib/edge/typescript/components/block/block.helpers.d.ts +20 -2
  130. package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
  131. package/lib/edge/typescript/components/block/components/block-wrapper.d.ts +0 -1
  132. package/lib/edge/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  133. package/lib/edge/typescript/components/content/components/enable-editor.d.ts +1 -1
  134. package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  135. package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
  136. package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
  137. package/lib/edge/typescript/constants/sdk-version.d.ts.map +1 -1
  138. package/lib/edge/typescript/functions/get-block-component-options.d.ts.map +1 -1
  139. package/lib/edge/typescript/helpers/cookie.d.ts +0 -1
  140. package/lib/edge/typescript/helpers/cookie.d.ts.map +1 -1
  141. package/lib/node/commonjs/blocks/image/component-info.js +5 -0
  142. package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
  143. package/lib/node/commonjs/components/block/block.helpers.js +27 -7
  144. package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
  145. package/lib/node/commonjs/components/block/block.js +9 -13
  146. package/lib/node/commonjs/components/block/block.js.map +1 -1
  147. package/lib/node/commonjs/components/block/components/block-wrapper.js.map +1 -1
  148. package/lib/node/commonjs/components/content/components/enable-editor.js +9 -9
  149. package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
  150. package/lib/node/commonjs/components/content/components/styles.helpers.js +2 -2
  151. package/lib/node/commonjs/components/content/components/styles.helpers.js.map +1 -1
  152. package/lib/node/commonjs/components/content/content.js +0 -1
  153. package/lib/node/commonjs/components/content/content.js.map +1 -1
  154. package/lib/node/commonjs/constants/sdk-version.js +1 -1
  155. package/lib/node/commonjs/constants/sdk-version.js.map +1 -1
  156. package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  157. package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  158. package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  159. package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  160. package/lib/node/commonjs/functions/get-block-actions.js +1 -2
  161. package/lib/node/commonjs/functions/get-block-actions.js.map +1 -1
  162. package/lib/node/commonjs/functions/get-block-component-options.js +1 -5
  163. package/lib/node/commonjs/functions/get-block-component-options.js.map +1 -1
  164. package/lib/node/commonjs/functions/get-content/index.js +1 -2
  165. package/lib/node/commonjs/functions/get-content/index.js.map +1 -1
  166. package/lib/node/commonjs/helpers/cookie.js +2 -12
  167. package/lib/node/commonjs/helpers/cookie.js.map +1 -1
  168. package/lib/node/module/blocks/image/component-info.js +5 -0
  169. package/lib/node/module/blocks/image/component-info.js.map +1 -1
  170. package/lib/node/module/components/block/block.helpers.js +22 -4
  171. package/lib/node/module/components/block/block.helpers.js.map +1 -1
  172. package/lib/node/module/components/block/block.js +10 -14
  173. package/lib/node/module/components/block/block.js.map +1 -1
  174. package/lib/node/module/components/block/components/block-wrapper.js.map +1 -1
  175. package/lib/node/module/components/content/components/enable-editor.js +9 -9
  176. package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
  177. package/lib/node/module/components/content/components/styles.helpers.js +2 -2
  178. package/lib/node/module/components/content/components/styles.helpers.js.map +1 -1
  179. package/lib/node/module/components/content/content.js +0 -1
  180. package/lib/node/module/components/content/content.js.map +1 -1
  181. package/lib/node/module/constants/sdk-version.js +1 -1
  182. package/lib/node/module/constants/sdk-version.js.map +1 -1
  183. package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  184. package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  185. package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  186. package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  187. package/lib/node/module/functions/get-block-actions.js +1 -2
  188. package/lib/node/module/functions/get-block-actions.js.map +1 -1
  189. package/lib/node/module/functions/get-block-component-options.js +1 -5
  190. package/lib/node/module/functions/get-block-component-options.js.map +1 -1
  191. package/lib/node/module/functions/get-content/index.js +1 -2
  192. package/lib/node/module/functions/get-content/index.js.map +1 -1
  193. package/lib/node/module/helpers/cookie.js +2 -11
  194. package/lib/node/module/helpers/cookie.js.map +1 -1
  195. package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
  196. package/lib/node/typescript/blocks/image/image.types.d.ts +1 -0
  197. package/lib/node/typescript/blocks/image/image.types.d.ts.map +1 -1
  198. package/lib/node/typescript/components/block/block.d.ts.map +1 -1
  199. package/lib/node/typescript/components/block/block.helpers.d.ts +20 -2
  200. package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
  201. package/lib/node/typescript/components/block/components/block-wrapper.d.ts +0 -1
  202. package/lib/node/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  203. package/lib/node/typescript/components/content/components/enable-editor.d.ts +1 -1
  204. package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  205. package/lib/node/typescript/components/content/content.d.ts.map +1 -1
  206. package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
  207. package/lib/node/typescript/constants/sdk-version.d.ts.map +1 -1
  208. package/lib/node/typescript/functions/get-block-component-options.d.ts.map +1 -1
  209. package/lib/node/typescript/helpers/cookie.d.ts +0 -1
  210. package/lib/node/typescript/helpers/cookie.d.ts.map +1 -1
  211. package/package.json +5 -8
  212. package/lib/node/index.cjs +0 -6910
  213. package/lib/node/index.mjs +0 -7477
  214. package/src/blocks/BaseText.tsx +0 -17
  215. package/src/blocks/accordion/accordion.tsx +0 -181
  216. package/src/blocks/accordion/accordion.types.ts +0 -12
  217. package/src/blocks/accordion/component-info.ts +0 -124
  218. package/src/blocks/accordion/helpers.ts +0 -3
  219. package/src/blocks/accordion/index.ts +0 -1
  220. package/src/blocks/button/button.tsx +0 -56
  221. package/src/blocks/button/button.types.ts +0 -7
  222. package/src/blocks/button/component-info.ts +0 -35
  223. package/src/blocks/button/index.ts +0 -1
  224. package/src/blocks/columns/columns.tsx +0 -199
  225. package/src/blocks/columns/columns.types.ts +0 -14
  226. package/src/blocks/columns/component-info.ts +0 -219
  227. package/src/blocks/columns/helpers.ts +0 -3
  228. package/src/blocks/columns/index.ts +0 -1
  229. package/src/blocks/custom-code/component-info.ts +0 -24
  230. package/src/blocks/custom-code/custom-code.tsx +0 -71
  231. package/src/blocks/custom-code/index.ts +0 -1
  232. package/src/blocks/embed/component-info.ts +0 -38
  233. package/src/blocks/embed/embed.tsx +0 -62
  234. package/src/blocks/embed/helpers.ts +0 -2
  235. package/src/blocks/embed/index.ts +0 -1
  236. package/src/blocks/form/form/component-info.ts +0 -233
  237. package/src/blocks/form/form/form.tsx +0 -324
  238. package/src/blocks/form/form/index.ts +0 -1
  239. package/src/blocks/form/input/component-info.ts +0 -47
  240. package/src/blocks/form/input/index.ts +0 -1
  241. package/src/blocks/form/input/input.tsx +0 -49
  242. package/src/blocks/form/select/component-info.ts +0 -44
  243. package/src/blocks/form/select/index.ts +0 -1
  244. package/src/blocks/form/select/select.tsx +0 -54
  245. package/src/blocks/form/submit-button/component-info.ts +0 -27
  246. package/src/blocks/form/submit-button/index.ts +0 -1
  247. package/src/blocks/form/submit-button/submit-button.tsx +0 -34
  248. package/src/blocks/fragment/component-info.ts +0 -8
  249. package/src/blocks/fragment/fragment.tsx +0 -18
  250. package/src/blocks/fragment/fragment.types.ts +0 -5
  251. package/src/blocks/fragment/index.ts +0 -1
  252. package/src/blocks/helpers.ts +0 -43
  253. package/src/blocks/image/component-info.ts +0 -124
  254. package/src/blocks/image/image.helpers.ts +0 -47
  255. package/src/blocks/image/image.tsx +0 -65
  256. package/src/blocks/image/image.types.ts +0 -19
  257. package/src/blocks/image/index.ts +0 -1
  258. package/src/blocks/img/component-info.ts +0 -16
  259. package/src/blocks/img/img.tsx +0 -55
  260. package/src/blocks/img/index.ts +0 -1
  261. package/src/blocks/raw-text/component-info.ts +0 -11
  262. package/src/blocks/raw-text/index.ts +0 -1
  263. package/src/blocks/raw-text/raw-text.tsx +0 -1
  264. package/src/blocks/section/component-info.ts +0 -41
  265. package/src/blocks/section/index.ts +0 -1
  266. package/src/blocks/section/section.tsx +0 -39
  267. package/src/blocks/section/section.types.ts +0 -6
  268. package/src/blocks/slot/component-info.ts +0 -15
  269. package/src/blocks/slot/index.ts +0 -1
  270. package/src/blocks/slot/slot.tsx +0 -42
  271. package/src/blocks/symbol/component-info.ts +0 -35
  272. package/src/blocks/symbol/index.ts +0 -1
  273. package/src/blocks/symbol/symbol.helpers.ts +0 -47
  274. package/src/blocks/symbol/symbol.tsx +0 -100
  275. package/src/blocks/symbol/symbol.types.ts +0 -17
  276. package/src/blocks/tabs/component-info.ts +0 -139
  277. package/src/blocks/tabs/index.ts +0 -1
  278. package/src/blocks/tabs/tabs.tsx +0 -79
  279. package/src/blocks/tabs/tabs.types.ts +0 -13
  280. package/src/blocks/text/component-info.ts +0 -20
  281. package/src/blocks/text/index.ts +0 -1
  282. package/src/blocks/text/text.tsx +0 -105
  283. package/src/blocks/text/text.types.ts +0 -4
  284. package/src/blocks/textarea/component-info.ts +0 -38
  285. package/src/blocks/textarea/index.ts +0 -1
  286. package/src/blocks/textarea/textarea.tsx +0 -41
  287. package/src/blocks/video/component-info.ts +0 -83
  288. package/src/blocks/video/index.ts +0 -1
  289. package/src/blocks/video/video.tsx +0 -70
  290. package/src/blocks/video/video.types.ts +0 -21
  291. package/src/components/block/animator.ts +0 -220
  292. package/src/components/block/block.helpers.ts +0 -106
  293. package/src/components/block/block.tsx +0 -235
  294. package/src/components/block/components/block-styles.tsx +0 -136
  295. package/src/components/block/components/block-wrapper.tsx +0 -53
  296. package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
  297. package/src/components/block/components/component-ref/component-ref.tsx +0 -66
  298. package/src/components/block/components/interactive-element.tsx +0 -53
  299. package/src/components/block/components/repeated-block.tsx +0 -37
  300. package/src/components/block/types.ts +0 -6
  301. package/src/components/blocks/blocks-wrapper.tsx +0 -93
  302. package/src/components/blocks/blocks.tsx +0 -57
  303. package/src/components/blocks/blocks.types.ts +0 -7
  304. package/src/components/blocks/index.ts +0 -1
  305. package/src/components/content/components/enable-editor.tsx +0 -471
  306. package/src/components/content/components/styles.helpers.ts +0 -101
  307. package/src/components/content/components/styles.tsx +0 -42
  308. package/src/components/content/content.helpers.ts +0 -40
  309. package/src/components/content/content.tsx +0 -151
  310. package/src/components/content/content.types.ts +0 -13
  311. package/src/components/content/contentProps.types.ts +0 -17
  312. package/src/components/content/index.ts +0 -1
  313. package/src/components/content/wrap-component-ref.ts +0 -6
  314. package/src/components/content-variants/content-variants.tsx +0 -146
  315. package/src/components/content-variants/content-variants.types.ts +0 -84
  316. package/src/components/content-variants/helpers.ts +0 -72
  317. package/src/components/content-variants/index.ts +0 -1
  318. package/src/components/content-variants/inlined-fns.ts +0 -22
  319. package/src/components/dynamic-div.tsx +0 -30
  320. package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
  321. package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
  322. package/src/components/error-boundary.tsx +0 -38
  323. package/src/components/inlined-script.tsx +0 -10
  324. package/src/components/inlined-styles.tsx +0 -10
  325. package/src/constants/builder-registered-components.ts +0 -59
  326. package/src/constants/device-sizes.ts +0 -59
  327. package/src/constants/extra-components.ts +0 -1
  328. package/src/constants/sdk-version.ts +0 -1
  329. package/src/constants/target.ts +0 -3
  330. package/src/context/builder.context.ts +0 -15
  331. package/src/context/components.context.ts +0 -3
  332. package/src/context/index.ts +0 -1
  333. package/src/context/types.ts +0 -38
  334. package/src/functions/apply-patch-with-mutation.ts +0 -61
  335. package/src/functions/camel-to-kebab-case.ts +0 -1
  336. package/src/functions/deopt.ts +0 -6
  337. package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
  338. package/src/functions/evaluate/browser-runtime/index.ts +0 -1
  339. package/src/functions/evaluate/choose-eval.ts +0 -23
  340. package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
  341. package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
  342. package/src/functions/evaluate/edge-runtime/index.ts +0 -1
  343. package/src/functions/evaluate/evaluate.ts +0 -76
  344. package/src/functions/evaluate/helpers.ts +0 -56
  345. package/src/functions/evaluate/index.ts +0 -1
  346. package/src/functions/evaluate/node-runtime/index.ts +0 -1
  347. package/src/functions/evaluate/node-runtime/init.ts +0 -33
  348. package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
  349. package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -14
  350. package/src/functions/evaluate/placeholder-runtime.ts +0 -4
  351. package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
  352. package/src/functions/event-handler-name.ts +0 -4
  353. package/src/functions/extract-text-styles.ts +0 -24
  354. package/src/functions/fast-clone.ts +0 -4
  355. package/src/functions/fetch-builder-props.ts +0 -75
  356. package/src/functions/get-block-actions-handler.ts +0 -17
  357. package/src/functions/get-block-actions.ts +0 -35
  358. package/src/functions/get-block-component-options.ts +0 -11
  359. package/src/functions/get-block-properties.ts +0 -62
  360. package/src/functions/get-builder-search-params/index.ts +0 -33
  361. package/src/functions/get-class-prop-name.ts +0 -15
  362. package/src/functions/get-content/generate-content-url.ts +0 -88
  363. package/src/functions/get-content/index.ts +0 -99
  364. package/src/functions/get-content/types.ts +0 -157
  365. package/src/functions/get-env.ts +0 -5
  366. package/src/functions/get-fetch.ts +0 -11
  367. package/src/functions/get-global-this.ts +0 -16
  368. package/src/functions/get-processed-block.ts +0 -70
  369. package/src/functions/get-style.ts +0 -38
  370. package/src/functions/get.ts +0 -4
  371. package/src/functions/is-browser.ts +0 -3
  372. package/src/functions/is-edge-runtime.ts +0 -9
  373. package/src/functions/is-editing.ts +0 -8
  374. package/src/functions/is-from-trusted-host.ts +0 -8
  375. package/src/functions/is-iframe.ts +0 -4
  376. package/src/functions/is-node-runtime.ts +0 -8
  377. package/src/functions/is-previewing.ts +0 -16
  378. package/src/functions/on-change.ts +0 -29
  379. package/src/functions/register-component.ts +0 -30
  380. package/src/functions/register.ts +0 -44
  381. package/src/functions/set-editor-settings.ts +0 -15
  382. package/src/functions/set.ts +0 -14
  383. package/src/functions/track/helpers.ts +0 -51
  384. package/src/functions/track/index.ts +0 -131
  385. package/src/functions/track/interaction.ts +0 -63
  386. package/src/functions/transform-block-properties.ts +0 -33
  387. package/src/functions/transform-block.ts +0 -30
  388. package/src/functions/transform-style-property.ts +0 -296
  389. package/src/helpers/ab-tests.ts +0 -166
  390. package/src/helpers/canTrack.ts +0 -2
  391. package/src/helpers/cookie.ts +0 -109
  392. package/src/helpers/css.ts +0 -33
  393. package/src/helpers/flatten.ts +0 -41
  394. package/src/helpers/localStorage.ts +0 -36
  395. package/src/helpers/logger.ts +0 -7
  396. package/src/helpers/nullable.ts +0 -2
  397. package/src/helpers/omit.ts +0 -7
  398. package/src/helpers/preview-lru-cache/get.ts +0 -4
  399. package/src/helpers/preview-lru-cache/helpers.ts +0 -1
  400. package/src/helpers/preview-lru-cache/init.ts +0 -7
  401. package/src/helpers/preview-lru-cache/set.ts +0 -12
  402. package/src/helpers/preview-lru-cache/types.ts +0 -1
  403. package/src/helpers/search/search.ts +0 -18
  404. package/src/helpers/sessionId.ts +0 -37
  405. package/src/helpers/subscribe-to-editor.ts +0 -95
  406. package/src/helpers/time.ts +0 -2
  407. package/src/helpers/url.ts +0 -15
  408. package/src/helpers/uuid.ts +0 -17
  409. package/src/helpers/visitorId.ts +0 -37
  410. package/src/index-helpers/blocks-exports.ts +0 -16
  411. package/src/index-helpers/top-of-file.ts +0 -2
  412. package/src/index.ts +0 -15
  413. package/src/scripts/init-editing.ts +0 -119
  414. package/src/server-index.ts +0 -43
  415. package/src/types/api-version.ts +0 -2
  416. package/src/types/builder-block.ts +0 -89
  417. package/src/types/builder-content.ts +0 -47
  418. package/src/types/builder-props.ts +0 -12
  419. package/src/types/can-track.ts +0 -3
  420. package/src/types/components.ts +0 -119
  421. package/src/types/deep-partial.ts +0 -1
  422. package/src/types/element.ts +0 -57
  423. package/src/types/enforced-partials.ts +0 -19
  424. package/src/types/input.ts +0 -123
  425. package/src/types/targets.ts +0 -1
  426. package/src/types/typescript.ts +0 -9
@@ -1,296 +0,0 @@
1
- import cssToStyleSheet from 'css-to-react-native';
2
- import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
- import type { BuilderContextInterface } from '../context/types';
4
- import type { BuilderBlock } from '../types/builder-block';
5
- import type { Dictionary } from '../types/typescript';
6
-
7
- const cssToReactNative: typeof cssToStyleSheet = (cssToStyleSheet as any)
8
- .default
9
- ? (cssToStyleSheet as any).default
10
- : cssToStyleSheet;
11
-
12
- type StyleSheetProperties = ImageStyle & TextStyle & ViewStyle;
13
-
14
- /**
15
- * @description List of allowed css properties.
16
- * We use this to filter out web CSS from Builder.io that would crash RN.
17
- */
18
- const ALLOWED_CSS_PROPERTIES: Array<keyof StyleSheetProperties> = [
19
- // img props
20
- 'backfaceVisibility',
21
- 'backgroundColor',
22
- 'borderBottomLeftRadius',
23
- 'borderBottomRightRadius',
24
- 'borderColor',
25
- 'borderRadius',
26
- 'borderTopLeftRadius',
27
- 'borderTopRightRadius',
28
- 'borderWidth',
29
- 'opacity',
30
- 'overflow',
31
- 'overlayColor',
32
- 'resizeMode',
33
- 'objectFit',
34
- 'tintColor',
35
- // layout props
36
- 'alignContent',
37
- 'alignItems',
38
- 'alignSelf',
39
- 'aspectRatio',
40
- 'borderBottomWidth',
41
- 'borderEndWidth',
42
- 'borderLeftWidth',
43
- 'borderRightWidth',
44
- 'borderStartWidth',
45
- 'borderTopWidth',
46
- 'borderWidth',
47
- 'bottom',
48
- 'columnGap',
49
- 'direction',
50
- 'display',
51
- 'end',
52
- 'flex',
53
- 'flexBasis',
54
- 'flexDirection',
55
- 'flexGrow',
56
- 'flexShrink',
57
- 'flexWrap',
58
- 'gap',
59
- 'height',
60
- 'width',
61
- 'justifyContent',
62
- 'left',
63
- 'margin',
64
- 'marginBottom',
65
- 'marginEnd',
66
- 'marginHorizontal',
67
- 'marginLeft',
68
- 'marginRight',
69
- 'marginStart',
70
- 'marginTop',
71
- 'marginVertical',
72
- 'maxHeight',
73
- 'maxWidth',
74
- 'minHeight',
75
- 'minWidth',
76
- 'overflow',
77
- 'padding',
78
- 'paddingBottom',
79
- 'paddingEnd',
80
- 'paddingHorizontal',
81
- 'paddingLeft',
82
- 'paddingRight',
83
- 'paddingStart',
84
- 'paddingTop',
85
- 'paddingVertical',
86
- 'position',
87
- 'right',
88
- 'rowGap',
89
- 'start',
90
- 'top',
91
- // shadow
92
- 'shadowColor',
93
- 'shadowOffset',
94
- 'shadowOpacity',
95
- 'shadowRadius',
96
- // text props
97
- 'color',
98
- 'fontFamily',
99
- 'fontSize',
100
- 'fontStyle',
101
- 'fontWeight',
102
- 'includeFontPadding',
103
- 'fontVariant',
104
- 'letterSpacing',
105
- 'lineHeight',
106
- 'textAlign',
107
- 'textAlignVertical',
108
- 'textDecorationColor',
109
- 'textDecorationLine',
110
- 'textDecorationStyle',
111
- 'textShadowColor',
112
- 'textShadowOffset',
113
- 'textShadowRadius',
114
- 'textTransform',
115
- 'verticalAlign',
116
- 'writingDirection',
117
- // TO-DO: type is missing until v73.2: https://github.com/facebook/react-native/issues/39015
118
- 'userSelect' as any,
119
- // view style props
120
- 'backfaceVisibility',
121
- 'backgroundColor',
122
- 'borderBottomColor',
123
- 'borderBottomEndRadius',
124
- 'borderBottomLeftRadius',
125
- 'borderBottomRightRadius',
126
- 'borderBottomStartRadius',
127
- 'borderStartEndRadius',
128
- 'borderStartStartRadius',
129
- 'borderEndEndRadius',
130
- 'borderEndStartRadius',
131
- 'borderBottomWidth',
132
- 'borderColor',
133
- 'borderCurve',
134
- 'borderEndColor',
135
- 'borderLeftColor',
136
- 'borderLeftWidth',
137
- 'borderRadius',
138
- 'borderRightColor',
139
- 'borderRightWidth',
140
- 'borderStartColor',
141
- 'borderStyle',
142
- 'borderTopColor',
143
- 'borderTopEndRadius',
144
- 'borderTopLeftRadius',
145
- 'borderTopRightRadius',
146
- 'borderTopStartRadius',
147
- 'borderTopWidth',
148
- 'borderWidth',
149
- 'elevation',
150
- 'opacity',
151
- 'pointerEvents',
152
- ];
153
-
154
- const DISPLAY_VALUES = ['flex', 'none'];
155
-
156
- const BORDERSTYLE_VALUES = ['solid', 'dotted', 'dashed'];
157
-
158
- function omit<T extends object>(obj: T, ...values: (keyof T)[]): Partial<T> {
159
- const newObject = Object.assign({}, obj);
160
- for (const key of values) {
161
- delete (newObject as any)[key];
162
- }
163
- return newObject;
164
- }
165
-
166
- const inRange = (value: number, min: number, max: number) =>
167
- value >= min && value <= max;
168
-
169
- const processValue = (
170
- styles: { [key: string]: string },
171
- [key, value]: [string, unknown]
172
- ): string | undefined => {
173
- if (typeof value !== 'string' || value === '') return undefined;
174
- if (!ALLOWED_CSS_PROPERTIES.includes(key as any)) return undefined;
175
- if (value.includes('calc')) return undefined;
176
- if (value.includes('inherit')) return undefined;
177
- if (value === 'px') return undefined;
178
- if (key === 'display' && !DISPLAY_VALUES.includes(value)) return undefined;
179
-
180
- if (key === 'borderStyle' && !BORDERSTYLE_VALUES.includes(value))
181
- return undefined;
182
-
183
- if (key === 'maxWidth' && value === 'none') {
184
- return '100%';
185
- }
186
-
187
- if (key === 'lineHeight' && !value.includes('px')) {
188
- const fontSize = parseFloat(styles.fontSize);
189
- const lineHeight = parseFloat(styles.lineHeight);
190
-
191
- if (!isNaN(fontSize) && !isNaN(lineHeight) && inRange(lineHeight, 1, 2)) {
192
- return `${Math.round(fontSize * lineHeight)}px`;
193
- }
194
-
195
- return undefined;
196
- }
197
-
198
- if (key === 'fontFamily') {
199
- return value.replace(/["]/g, '').split(',')[0];
200
- }
201
-
202
- const numericValue = parseFloat(value);
203
- const isNumeric = !isNaN(numericValue);
204
-
205
- if (isNumeric) {
206
- const processSuffix = (numAsStr: string) => {
207
- if (numAsStr.includes('em')) {
208
- if (key === 'letterSpacing') return numAsStr.replace('em', 'px');
209
-
210
- return numAsStr.replace('em', '');
211
- }
212
-
213
- if (numAsStr.includes('pt')) return numAsStr.replace('pt', '');
214
- if (numAsStr.includes('vw')) return numAsStr.replace('vw', '%');
215
- if (numAsStr.includes('vh')) return numAsStr.replace('vh', '%');
216
-
217
- return numAsStr;
218
- };
219
-
220
- return processSuffix(value);
221
- }
222
-
223
- return value;
224
- };
225
-
226
- /**
227
- * @description Cleans styles that RN can't handle and css-to-react-native doesn't fix
228
- */
229
- const cleanCssStyleProps = (styles: {
230
- [key: string]: string;
231
- }): { [key: string]: string } =>
232
- Object.entries(styles).reduce((acc, [key, value]) => {
233
- const processedValue = processValue(styles, [key, value]);
234
- if (processedValue === undefined) return acc;
235
- return { ...acc, [key]: processedValue };
236
- }, {});
237
-
238
- /**
239
- * We ignore any `display: none` coming from med/large styles, as that would
240
- * inadvertedly hide our content on mobile.
241
- */
242
- const removeDisplayNone = (styles: Dictionary<any>) =>
243
- styles.display === 'none' ? omit(styles, 'display') : styles;
244
-
245
- function getReactNativeBlockStyles({
246
- block,
247
- context,
248
- blockStyles,
249
- }: {
250
- block: BuilderBlock;
251
- context: BuilderContextInterface;
252
- blockStyles: any;
253
- }): CSSStyleDeclaration | Record<string, string | undefined> {
254
- const responsiveStyles = block.responsiveStyles;
255
- if (!responsiveStyles) {
256
- return {};
257
- }
258
-
259
- const largeAndMediumStyles = removeDisplayNone({
260
- ...(responsiveStyles.large || {}),
261
- ...(responsiveStyles.medium || {}),
262
- });
263
-
264
- const styles = {
265
- // recursively apply inherited styles so that they can be passed down to children `Text` blocks
266
- ...context.inheritedStyles,
267
- ...largeAndMediumStyles,
268
- ...(responsiveStyles.small || {}),
269
- ...blockStyles,
270
- } as Record<string, string | number>;
271
-
272
- const cleanedCSS = cleanCssStyleProps(styles as any);
273
-
274
- const newStyles = cssToReactNative(
275
- Object.entries(cleanedCSS)
276
- ) as any as CSSStyleDeclaration;
277
-
278
- return newStyles;
279
- }
280
-
281
- export function transformStyleProperty({
282
- block,
283
- context,
284
- style,
285
- }: {
286
- block: BuilderBlock;
287
- context: BuilderContextInterface;
288
- style: any;
289
- }) {
290
- const newStyles = getReactNativeBlockStyles({
291
- block,
292
- context,
293
- blockStyles: style,
294
- });
295
- return newStyles;
296
- }
@@ -1,166 +0,0 @@
1
- import { TARGET } from '../constants/target';
2
- import { checkIsDefined } from '../helpers/nullable';
3
- import type { BuilderContent, BuilderContentVariation } from '../types/builder-content';
4
- import type { CanTrack } from '../types/can-track';
5
- import type { Nullable, Overwrite } from '../types/typescript';
6
- import { getCookie, getCookieSync, setCookie } from './cookie';
7
- import { logger } from './logger';
8
- const BUILDER_STORE_PREFIX = 'builder.tests';
9
- const getContentTestKey = (id: string) => `${BUILDER_STORE_PREFIX}.${id}`;
10
- const getContentVariationCookie = ({
11
- contentId
12
- }: {
13
- contentId: string;
14
- }) => getCookie({
15
- name: getContentTestKey(contentId),
16
- canTrack: true
17
- });
18
- const getContentVariationCookieSync = ({
19
- contentId
20
- }: {
21
- contentId: string;
22
- }) => getCookieSync({
23
- name: getContentTestKey(contentId),
24
- canTrack: true
25
- });
26
- const setContentVariationCookie = ({
27
- contentId,
28
- value
29
- }: {
30
- contentId: string;
31
- value: string;
32
- }) => setCookie({
33
- name: getContentTestKey(contentId),
34
- value,
35
- canTrack: true
36
- });
37
- type BuilderContentWithVariations = Overwrite<BuilderContent, Required<Pick<BuilderContent, 'variations' | 'id'>>>;
38
- const checkIsBuilderContentWithVariations = (item: BuilderContent): item is BuilderContentWithVariations => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
39
-
40
- /**
41
- * Randomly assign a variation to a user
42
- */
43
- const getRandomVariationId = ({
44
- id,
45
- variations
46
- }: BuilderContentWithVariations) => {
47
- let n = 0;
48
- const random = Math.random();
49
-
50
- // loop over variations test ratios, incrementing a counter,
51
- // until we find the variation that this user should be assigned to
52
- for (const id in variations) {
53
- const testRatio = variations[id]?.testRatio;
54
- n += testRatio!;
55
- if (random < n) {
56
- return id;
57
- }
58
- }
59
-
60
- // the variations array does not include the default variation.
61
- // if we arrive here, then it means that the random number fits in the default variation bucket.
62
- return id;
63
- };
64
- const getAndSetVariantId = (args: BuilderContentWithVariations) => {
65
- // if variation not found in storage, assign a random variation to this user
66
- const randomVariationId = getRandomVariationId(args);
67
-
68
- // store variation in cookies/storage
69
- setContentVariationCookie({
70
- contentId: args.id,
71
- value: randomVariationId
72
- }).catch(err => {
73
- logger.error('could not store A/B test variation: ', err);
74
- });
75
- return randomVariationId;
76
- };
77
- type TestFields = {
78
- data?: BuilderContentVariation['data'];
79
- testVariationId?: string;
80
- testVariationName: string;
81
- };
82
- const getTestFields = ({
83
- item,
84
- testGroupId
85
- }: {
86
- item: BuilderContentWithVariations;
87
- testGroupId: string;
88
- }): TestFields => {
89
- const variationValue = item.variations[testGroupId];
90
- if (testGroupId === item.id ||
91
- // handle edge-case where `testGroupId` points to non-existing variation
92
- !variationValue) {
93
- return {
94
- testVariationId: item.id,
95
- testVariationName: 'Default'
96
- };
97
- } else {
98
- return {
99
- data: variationValue.data,
100
- testVariationId: variationValue.id,
101
- testVariationName: variationValue.name || (variationValue.id === item.id ? 'Default' : '')
102
- };
103
- }
104
- };
105
- export const handleABTestingSync = ({
106
- item,
107
- canTrack
108
- }: {
109
- item: Nullable<BuilderContent>;
110
- } & CanTrack): Nullable<BuilderContent> => {
111
- /**
112
- * We cannot SSR in React-Native.
113
- */
114
- if (TARGET === 'reactNative') return item;
115
- if (!canTrack) {
116
- return item;
117
- }
118
- if (!item) {
119
- return undefined;
120
- }
121
- if (!checkIsBuilderContentWithVariations(item)) {
122
- return item;
123
- }
124
- const testGroupId = getContentVariationCookieSync({
125
- contentId: item.id
126
- }) || getAndSetVariantId({
127
- variations: item.variations,
128
- id: item.id
129
- });
130
- const variationValue = getTestFields({
131
- item,
132
- testGroupId
133
- });
134
- return {
135
- ...item,
136
- ...variationValue
137
- };
138
- };
139
- export const handleABTesting = async ({
140
- item,
141
- canTrack
142
- }: {
143
- item: BuilderContent;
144
- } & CanTrack): Promise<BuilderContent> => {
145
- if (!canTrack) {
146
- return item;
147
- }
148
- if (!checkIsBuilderContentWithVariations(item)) {
149
- return item;
150
- }
151
- const cookieValue = await getContentVariationCookie({
152
- contentId: item.id
153
- });
154
- const testGroupId = cookieValue || getAndSetVariantId({
155
- variations: item.variations,
156
- id: item.id
157
- });
158
- const variationValue = getTestFields({
159
- item,
160
- testGroupId
161
- });
162
- return {
163
- ...item,
164
- ...variationValue
165
- };
166
- }
@@ -1,2 +0,0 @@
1
- import { checkIsDefined } from './nullable';
2
- export const getDefaultCanTrack = (canTrack?: boolean) => checkIsDefined(canTrack) ? canTrack : true
@@ -1,109 +0,0 @@
1
- // polyfill `regenerator-runtime` for `react-native-storage`
2
- import 'regenerator-runtime/runtime';
3
-
4
- import AsyncStorage from '@react-native-async-storage/async-storage';
5
- import { Platform } from 'react-native';
6
- import Storage from 'react-native-storage';
7
- import { isBrowser } from '../functions/is-browser';
8
- import type { CanTrack } from '../types/can-track';
9
- import { logger } from './logger';
10
-
11
- const ONE_DAY = 1000 * 60 * 60 * 24;
12
-
13
- const initStorage = () => {
14
- const backend =
15
- Platform.OS === 'web'
16
- ? isBrowser()
17
- ? // web
18
- window?.localStorage
19
- : // static rendering/SSR in expo 50+
20
- undefined
21
- : // non-web (iOS/Android)
22
- AsyncStorage;
23
-
24
- const storage = new Storage({
25
- // maximum capacity, default 1000 key-ids
26
- size: 1000,
27
-
28
- // Use AsyncStorage for RN apps, or window.localStorage for web apps.
29
- // If storageBackend is not set, data will be lost after reload.
30
- storageBackend: backend,
31
-
32
- // expire time, default: 1 day (1000 * 3600 * 24 milliseconds).
33
- // can be null, which means never expire.
34
- defaultExpires: ONE_DAY * 30,
35
-
36
- // cache data in the memory. default is true.
37
- enableCache: true,
38
- });
39
-
40
- return storage;
41
- };
42
-
43
- const storage = initStorage();
44
-
45
- const getStorageName = (name: string) => `builderio.${name}`;
46
-
47
- // stub, never called, but needed to fix bundling.
48
- export const getCookieSync = (
49
- _: {
50
- name: string;
51
- } & CanTrack
52
- ): any => {};
53
-
54
- export const getCookie = async ({
55
- name,
56
- canTrack,
57
- }: {
58
- name: string;
59
- } & CanTrack) => {
60
- try {
61
- if (!canTrack) {
62
- return undefined;
63
- }
64
-
65
- // react-native does not support underscores in names
66
- const parsedName = name.replace(/_/g, '.');
67
-
68
- const data = await storage.load({ key: getStorageName(parsedName) });
69
-
70
- return data.value;
71
- } catch (err) {
72
- if (err?.name !== 'NotFoundError') {
73
- logger.warn('[COOKIE] GET error: ', err?.message || err);
74
- }
75
- return undefined;
76
- }
77
- };
78
-
79
- export const setCookie = async ({
80
- name,
81
- value,
82
- expires,
83
- canTrack,
84
- }: {
85
- name: string;
86
- value: string;
87
- expires?: Date;
88
- } & CanTrack) => {
89
- try {
90
- if (!canTrack) {
91
- return undefined;
92
- }
93
- // convert `expires` date to number representing milliseconds from now until the date
94
- const expiresAsNumber = expires
95
- ? expires.getTime() - Date.now()
96
- : undefined;
97
-
98
- await storage.save({
99
- key: getStorageName(name),
100
- data: { value },
101
- expires: expiresAsNumber,
102
- });
103
- } catch (err) {
104
- if (err?.name !== 'NotFoundError') {
105
- logger.warn('[COOKIE] SET error: ', err?.message || err);
106
- }
107
- return undefined;
108
- }
109
- };
@@ -1,33 +0,0 @@
1
- import { camelToKebabCase } from '../functions/camel-to-kebab-case';
2
- import { checkIsDefined } from './nullable';
3
- export const convertStyleMapToCSSArray = (style: Partial<CSSStyleDeclaration>): string[] => {
4
- const cssProps = Object.entries(style).map(([key, value]) => {
5
- if (typeof value === 'string') {
6
- return `${camelToKebabCase(key)}: ${value};`;
7
- } else {
8
- return undefined;
9
- }
10
- });
11
- return cssProps.filter(checkIsDefined);
12
- };
13
- export const convertStyleMapToCSS = (style: Partial<CSSStyleDeclaration>): string => convertStyleMapToCSSArray(style).join('\n');
14
- export const createCssClass = ({
15
- mediaQuery,
16
- className,
17
- styles
18
- }: {
19
- mediaQuery?: string;
20
- className: string;
21
- styles: Partial<CSSStyleDeclaration>;
22
- }) => {
23
- const cssClass = `.${className} {
24
- ${convertStyleMapToCSS(styles)}
25
- }`;
26
- if (mediaQuery) {
27
- return `${mediaQuery} {
28
- ${cssClass}
29
- }`;
30
- } else {
31
- return cssClass;
32
- }
33
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Convert deep object to a flat object with dots
3
- *
4
- * { foo: { bar: 'baz' }} -> { 'foo.bar': 'baz' }
5
- */
6
- export function flatten<T extends Record<string, any>>(object: T, path: string | null = null, separator = '.'): T {
7
- return Object.keys(object).reduce((acc: T, key: string): T => {
8
- const value = object[key];
9
- const newPath = [path, key].filter(Boolean).join(separator);
10
- const isObject = [typeof value === 'object', value !== null, !(Array.isArray(value) && value.length === 0)].every(Boolean);
11
- return isObject ? {
12
- ...acc,
13
- ...flatten(value, newPath, separator)
14
- } : {
15
- ...acc,
16
- [newPath]: value
17
- };
18
- }, ({} as T));
19
- }
20
-
21
- /**
22
- * Flatten a nested MongoDB query object into a flat object with dot-separated keys.
23
- * $ keys are not flattened and are left as is.
24
- *
25
- * { foo: { bar: { $gt: 5 }}} -> { 'foo.bar': { '$gt': 5 }}
26
- * { foo: {'bar.id': { $elemMatch: { 'baz.id': { $in: ['abc', 'bcd'] }}}}} -> { 'foo.bar.id': { '$elemMatch': { 'baz.id': { '$in': ['abc', 'bcd'] }}}}
27
- */
28
- export function flattenMongoQuery(obj: any, _current?: any, _res: any = {}): {
29
- [key: string]: string;
30
- } {
31
- for (const key in obj) {
32
- const value = obj[key];
33
- const newKey = _current ? _current + '.' + key : key;
34
- if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).find(item => item.startsWith('$'))) {
35
- flattenMongoQuery(value, newKey, _res);
36
- } else {
37
- _res[newKey] = value;
38
- }
39
- }
40
- return _res;
41
- }
@@ -1,36 +0,0 @@
1
- import { isBrowser } from '../functions/is-browser';
2
- import type { CanTrack } from '../types/can-track';
3
- import type { Nullable } from './nullable';
4
- const getLocalStorage = () => isBrowser() && typeof localStorage !== 'undefined' ? localStorage : undefined;
5
- export const getLocalStorageItem = ({
6
- key,
7
- canTrack
8
- }: {
9
- key: string;
10
- } & CanTrack): Nullable<string> => {
11
- try {
12
- if (canTrack) {
13
- return getLocalStorage()?.getItem(key);
14
- }
15
- return undefined;
16
- } catch (err) {
17
- console.debug('[LocalStorage] GET error: ', err);
18
- return undefined;
19
- }
20
- };
21
- export const setLocalStorageItem = ({
22
- key,
23
- canTrack,
24
- value
25
- }: {
26
- key: string;
27
- value: string;
28
- } & CanTrack) => {
29
- try {
30
- if (canTrack) {
31
- getLocalStorage()?.setItem(key, value);
32
- }
33
- } catch (err) {
34
- console.debug('[LocalStorage] SET error: ', err);
35
- }
36
- }
@@ -1,7 +0,0 @@
1
- export const MSG_PREFIX = '[Builder.io]: ';
2
- export const logger = {
3
- log: (...message: any[]) => console.log(MSG_PREFIX, ...message),
4
- error: (...message: any[]) => console.error(MSG_PREFIX, ...message),
5
- warn: (...message: any[]) => console.warn(MSG_PREFIX, ...message),
6
- debug: (...message: any[]) => console.debug(MSG_PREFIX, ...message)
7
- }
@@ -1,2 +0,0 @@
1
- export type Nullable<T> = T | null | undefined;
2
- export const checkIsDefined = <T,>(maybeT: Nullable<T>): maybeT is T => maybeT !== null && maybeT !== undefined
@@ -1,7 +0,0 @@
1
- export function omit<T extends object>(obj: T, ...values: (keyof T)[]): Partial<T> {
2
- const newObject = Object.assign({}, obj);
3
- for (const key of values) {
4
- delete (newObject as any)[key];
5
- }
6
- return newObject;
7
- }