@builder.io/sdk-vue 0.7.0 → 0.7.1-1

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 (246) hide show
  1. package/package.json +6 -2
  2. package/vue2/lib/browser/{block-134a618c.cjs → block-2cb52597.cjs} +2 -2
  3. package/vue2/lib/{node/block-169c0cf4.js → browser/block-dc97e982.js} +7 -7
  4. package/vue2/lib/{edge/block-styles-57f025e0.cjs → browser/block-styles-8f571c43.cjs} +1 -1
  5. package/vue2/lib/{node/block-styles-d8839dd9.js → browser/block-styles-bc460f14.js} +5 -5
  6. package/vue2/lib/browser/{block-wrapper-54cd4f6c.cjs → block-wrapper-2d901f3f.cjs} +1 -1
  7. package/vue2/lib/browser/{block-wrapper-ad23d63e.js → block-wrapper-b1a6d78a.js} +5 -5
  8. package/vue2/lib/browser/blocks/custom-code/custom-code.vue.d.ts +0 -1
  9. package/vue2/lib/browser/blocks/image/image.vue.d.ts +1 -1
  10. package/vue2/lib/{edge/blocks-wrapper-be28f72a.cjs → browser/blocks-wrapper-9e8dd7a2.cjs} +1 -1
  11. package/vue2/lib/{edge/blocks-wrapper-671e376d.js → browser/blocks-wrapper-fcb480f0.js} +1 -1
  12. package/vue2/lib/{edge/component-ref-65be9ea0.js → browser/component-ref-68e3a5b6.js} +6 -6
  13. package/vue2/lib/{edge/component-ref-276a92fb.cjs → browser/component-ref-bc236051.cjs} +1 -1
  14. package/vue2/lib/browser/components/content/components/enable-editor.vue.d.ts +2 -0
  15. package/vue2/lib/browser/constants/sdk-version.d.ts +1 -1
  16. package/vue2/lib/browser/{content-91d3070e.cjs → content-1a8d2e10.cjs} +1 -1
  17. package/vue2/lib/{edge/content-962ba49d.js → browser/content-76b432c4.js} +62 -64
  18. package/vue2/lib/browser/{css-2c9ad067.cjs → css-32f0c7fe.cjs} +1 -1
  19. package/vue2/lib/browser/{css-ccd5d9e3.js → css-d68fe0e5.js} +1 -1
  20. package/vue2/lib/browser/{enable-editor-d9f53d7d.js → enable-editor-29804f7c.js} +107 -92
  21. package/vue2/lib/browser/enable-editor-58cd5d33.cjs +1 -0
  22. package/vue2/lib/browser/evaluate-5f291a57.cjs +1 -0
  23. package/vue2/lib/browser/evaluate-c21703b5.js +86 -0
  24. package/vue2/lib/browser/functions/evaluate/choose-eval.d.ts +6 -0
  25. package/vue2/lib/browser/functions/evaluate/evaluate.d.ts +1 -5
  26. package/vue2/lib/browser/functions/evaluate/helpers.d.ts +7 -1
  27. package/vue2/lib/browser/functions/evaluate/node-runtime/index.d.ts +1 -1
  28. package/vue2/lib/browser/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  29. package/vue2/lib/browser/functions/get-content/types.d.ts +94 -3
  30. package/vue2/lib/browser/functions/is-node-runtime.d.ts +4 -0
  31. package/vue2/lib/{node/get-block-actions-e6c36554.js → browser/get-block-actions-47eb8bee.js} +2 -2
  32. package/vue2/lib/browser/{get-block-actions-7a5e8d90.cjs → get-block-actions-4f4fdc14.cjs} +1 -1
  33. package/vue2/lib/browser/{get-block-properties-fded8311.js → get-block-properties-14335b2d.js} +2 -2
  34. package/vue2/lib/{node/get-block-properties-088a8d57.cjs → browser/get-block-properties-4c2072d0.cjs} +1 -1
  35. package/vue2/lib/browser/{get-processed-block-cb418829.cjs → get-processed-block-7dbd0508.cjs} +1 -1
  36. package/vue2/lib/browser/{get-processed-block-28afdbdd.js → get-processed-block-9c43bb30.js} +2 -2
  37. package/vue2/lib/browser/index-7528c088.cjs +32 -0
  38. package/vue2/lib/{node/index-8b428b10.js → browser/index-bb14138e.js} +382 -367
  39. package/vue2/lib/browser/index.cjs +1 -1
  40. package/vue2/lib/browser/index.js +4 -4
  41. package/vue2/lib/{edge/inlined-script-45e42092.js → browser/inlined-script-431b5967.js} +1 -1
  42. package/vue2/lib/browser/{inlined-script-36c7686b.cjs → inlined-script-cc25d25c.cjs} +1 -1
  43. package/vue2/lib/{node/inlined-styles-48c2284e.js → browser/inlined-styles-1717d4f0.js} +1 -1
  44. package/vue2/lib/{node/inlined-styles-f49a7f1a.cjs → browser/inlined-styles-da08b05d.cjs} +1 -1
  45. package/vue2/lib/{node/interactive-element-2463f839.cjs → browser/interactive-element-03353733.cjs} +1 -1
  46. package/vue2/lib/{node/interactive-element-b479db6b.js → browser/interactive-element-ac3e10b7.js} +5 -5
  47. package/vue2/lib/{node/repeated-block-284f31d8.js → browser/repeated-block-51e74834.js} +2 -2
  48. package/vue2/lib/browser/{repeated-block-d5a07fb8.cjs → repeated-block-ba80a339.cjs} +1 -1
  49. package/vue2/lib/browser/style.css +1 -1
  50. package/vue2/lib/{node/styles-4803ecb4.js → browser/styles-5eb21cb8.js} +2 -2
  51. package/vue2/lib/{node/styles-f19bff73.cjs → browser/styles-931da5e8.cjs} +2 -2
  52. package/vue2/lib/{browser/block-169c0cf4.js → edge/block-2c7301d0.js} +7 -7
  53. package/vue2/lib/{node/block-134a618c.cjs → edge/block-40b0f7b5.cjs} +2 -2
  54. package/vue2/lib/{node/block-styles-dd554acd.cjs → edge/block-styles-ba691a55.cjs} +1 -1
  55. package/vue2/lib/edge/{block-styles-9d313184.js → block-styles-bd09453c.js} +5 -5
  56. package/vue2/lib/{node/block-wrapper-ad23d63e.js → edge/block-wrapper-4210f268.js} +5 -5
  57. package/vue2/lib/edge/{block-wrapper-252f3467.cjs → block-wrapper-8e1bd00b.cjs} +1 -1
  58. package/vue2/lib/edge/blocks/custom-code/custom-code.vue.d.ts +0 -1
  59. package/vue2/lib/edge/blocks/image/image.vue.d.ts +1 -1
  60. package/vue2/lib/{browser/blocks-wrapper-051a6973.cjs → edge/blocks-wrapper-7e831b51.cjs} +1 -1
  61. package/vue2/lib/{browser/blocks-wrapper-ba3f831e.js → edge/blocks-wrapper-9c7effa2.js} +1 -1
  62. package/vue2/lib/{node/component-ref-73bbe275.cjs → edge/component-ref-02d30d18.cjs} +1 -1
  63. package/vue2/lib/{node/component-ref-7c67cc85.js → edge/component-ref-0404fc38.js} +6 -6
  64. package/vue2/lib/edge/components/content/components/enable-editor.vue.d.ts +2 -0
  65. package/vue2/lib/edge/constants/sdk-version.d.ts +1 -1
  66. package/vue2/lib/{browser/content-c3064d9d.js → edge/content-173f7be0.js} +62 -64
  67. package/vue2/lib/{node/content-91d3070e.cjs → edge/content-36b34b86.cjs} +1 -1
  68. package/vue2/lib/{node/css-2c9ad067.cjs → edge/css-00393f8a.cjs} +1 -1
  69. package/vue2/lib/edge/{css-9d2e1bcb.js → css-081095c1.js} +1 -1
  70. package/vue2/lib/edge/enable-editor-c36df3b5.cjs +1 -0
  71. package/vue2/lib/{node/enable-editor-d9f53d7d.js → edge/enable-editor-d3f018c6.js} +107 -92
  72. package/vue2/lib/edge/evaluate-47aeba42.cjs +21 -0
  73. package/vue2/lib/edge/{evaluate-becf2384.js → evaluate-d31c253f.js} +379 -346
  74. package/vue2/lib/edge/functions/evaluate/choose-eval.d.ts +6 -0
  75. package/vue2/lib/edge/functions/evaluate/evaluate.d.ts +1 -5
  76. package/vue2/lib/edge/functions/evaluate/helpers.d.ts +7 -1
  77. package/vue2/lib/edge/functions/evaluate/node-runtime/index.d.ts +1 -1
  78. package/vue2/lib/edge/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  79. package/vue2/lib/edge/functions/get-content/types.d.ts +94 -3
  80. package/vue2/lib/edge/functions/is-node-runtime.d.ts +4 -0
  81. package/vue2/lib/{browser/get-block-actions-e6c36554.js → edge/get-block-actions-33002e58.js} +2 -2
  82. package/vue2/lib/edge/{get-block-actions-0ed7b9a3.cjs → get-block-actions-fc18e691.cjs} +1 -1
  83. package/vue2/lib/{browser/get-block-properties-088a8d57.cjs → edge/get-block-properties-c1a43e4b.cjs} +1 -1
  84. package/vue2/lib/edge/{get-block-properties-c460b7ad.js → get-block-properties-d0176121.js} +2 -2
  85. package/vue2/lib/edge/{get-processed-block-23aa8a9f.js → get-processed-block-1280c9d5.js} +2 -2
  86. package/vue2/lib/edge/{get-processed-block-fe5c136a.cjs → get-processed-block-2d9f33f5.cjs} +1 -1
  87. package/vue2/lib/edge/{index-8d71df29.js → index-6e4d121e.js} +382 -367
  88. package/vue2/lib/edge/index-ca5baf07.cjs +32 -0
  89. package/vue2/lib/edge/index.cjs +1 -1
  90. package/vue2/lib/edge/index.js +4 -4
  91. package/vue2/lib/{node/inlined-script-de7385eb.js → edge/inlined-script-7a7207fd.js} +1 -1
  92. package/vue2/lib/{node/inlined-script-36c7686b.cjs → edge/inlined-script-e57329a5.cjs} +1 -1
  93. package/vue2/lib/{browser/inlined-styles-f49a7f1a.cjs → edge/inlined-styles-9a96b77e.cjs} +1 -1
  94. package/vue2/lib/edge/{inlined-styles-411ade32.js → inlined-styles-f109793f.js} +1 -1
  95. package/vue2/lib/{browser/interactive-element-b479db6b.js → edge/interactive-element-6a866621.js} +5 -5
  96. package/vue2/lib/{browser/interactive-element-2463f839.cjs → edge/interactive-element-9c12c501.cjs} +1 -1
  97. package/vue2/lib/edge/{repeated-block-8eefee0f.cjs → repeated-block-1093b757.cjs} +1 -1
  98. package/vue2/lib/{browser/repeated-block-284f31d8.js → edge/repeated-block-f7b967cf.js} +2 -2
  99. package/vue2/lib/edge/style.css +1 -1
  100. package/vue2/lib/{browser/styles-f19bff73.cjs → edge/styles-a211b4e1.cjs} +2 -2
  101. package/vue2/lib/{browser/styles-4803ecb4.js → edge/styles-aa2c087b.js} +2 -2
  102. package/vue2/lib/{edge/block-04a014ef.js → node/block-979d66e1.js} +7 -7
  103. package/vue2/lib/{edge/block-7f6b0f80.cjs → node/block-d7e689a7.cjs} +2 -2
  104. package/vue2/lib/{browser/block-styles-dd554acd.cjs → node/block-styles-00a3a4d7.cjs} +1 -1
  105. package/vue2/lib/{browser/block-styles-d8839dd9.js → node/block-styles-50528f05.js} +5 -5
  106. package/vue2/lib/{edge/block-wrapper-e16ccd29.js → node/block-wrapper-8bd5d40b.js} +5 -5
  107. package/vue2/lib/node/{block-wrapper-54cd4f6c.cjs → block-wrapper-d7b449f1.cjs} +1 -1
  108. package/vue2/lib/node/blocks/custom-code/custom-code.vue.d.ts +0 -1
  109. package/vue2/lib/node/blocks/image/image.vue.d.ts +1 -1
  110. package/vue2/lib/node/{blocks-wrapper-ba3f831e.js → blocks-wrapper-50937fc2.js} +1 -1
  111. package/vue2/lib/node/{blocks-wrapper-051a6973.cjs → blocks-wrapper-d425bec5.cjs} +1 -1
  112. package/vue2/lib/{browser/component-ref-7c67cc85.js → node/component-ref-123ffd3c.js} +6 -6
  113. package/vue2/lib/{browser/component-ref-73bbe275.cjs → node/component-ref-3ba26510.cjs} +1 -1
  114. package/vue2/lib/node/components/content/components/enable-editor.vue.d.ts +2 -0
  115. package/vue2/lib/node/constants/sdk-version.d.ts +1 -1
  116. package/vue2/lib/node/{content-c3064d9d.js → content-d31377e7.js} +62 -64
  117. package/vue2/lib/{edge/content-6d81d16f.cjs → node/content-d8e76f5c.cjs} +1 -1
  118. package/vue2/lib/node/{css-ccd5d9e3.js → css-469bd1df.js} +1 -1
  119. package/vue2/lib/{edge/css-88f2410f.cjs → node/css-c566c7a4.cjs} +1 -1
  120. package/vue2/lib/node/enable-editor-8c4e460a.cjs +1 -0
  121. package/vue2/lib/{edge/enable-editor-b6040943.js → node/enable-editor-96dbd852.js} +107 -92
  122. package/vue2/lib/node/evaluate-45bac138.cjs +41 -0
  123. package/vue2/lib/node/evaluate-946bbbf4.js +187 -0
  124. package/vue2/lib/node/functions/evaluate/choose-eval.d.ts +6 -0
  125. package/vue2/lib/node/functions/evaluate/evaluate.d.ts +1 -5
  126. package/vue2/lib/node/functions/evaluate/helpers.d.ts +7 -1
  127. package/vue2/lib/node/functions/evaluate/node-runtime/index.d.ts +1 -1
  128. package/vue2/lib/node/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  129. package/vue2/lib/node/functions/get-content/types.d.ts +94 -3
  130. package/vue2/lib/node/functions/is-node-runtime.d.ts +4 -0
  131. package/vue2/lib/{edge/get-block-actions-046a80d0.js → node/get-block-actions-a7c25deb.js} +2 -2
  132. package/vue2/lib/node/{get-block-actions-7a5e8d90.cjs → get-block-actions-fa0f60c5.cjs} +1 -1
  133. package/vue2/lib/node/{get-block-properties-fded8311.js → get-block-properties-5524be2a.js} +2 -2
  134. package/vue2/lib/{edge/get-block-properties-a9ab7e30.cjs → node/get-block-properties-75f3f91a.cjs} +1 -1
  135. package/vue2/lib/node/get-processed-block-231c050b.js +52 -0
  136. package/vue2/lib/node/get-processed-block-e246d1ed.cjs +1 -0
  137. package/vue2/lib/{browser/index-8b428b10.js → node/index-7ce12494.js} +382 -367
  138. package/vue2/lib/node/index-ea4df31a.cjs +32 -0
  139. package/vue2/lib/node/index.cjs +1 -1
  140. package/vue2/lib/node/index.js +4 -4
  141. package/vue2/lib/{browser/inlined-script-de7385eb.js → node/inlined-script-073d04d2.js} +1 -1
  142. package/vue2/lib/{edge/inlined-script-f370acdf.cjs → node/inlined-script-dccfb7fc.cjs} +1 -1
  143. package/vue2/lib/{edge/inlined-styles-375c218f.cjs → node/inlined-styles-08dbb945.cjs} +1 -1
  144. package/vue2/lib/{browser/inlined-styles-48c2284e.js → node/inlined-styles-8982c8a6.js} +1 -1
  145. package/vue2/lib/{edge/interactive-element-0e97e5ad.js → node/interactive-element-caabd2d9.js} +5 -5
  146. package/vue2/lib/{edge/interactive-element-92851fbe.cjs → node/interactive-element-fc5a4f1d.cjs} +1 -1
  147. package/vue2/lib/{edge/repeated-block-c41268e9.js → node/repeated-block-0ab8e6be.js} +2 -2
  148. package/vue2/lib/node/{repeated-block-d5a07fb8.cjs → repeated-block-f65d29a5.cjs} +1 -1
  149. package/vue2/lib/node/style.css +1 -1
  150. package/vue2/lib/{edge/styles-633d9689.js → node/styles-6e09a0cc.js} +2 -2
  151. package/vue2/lib/{edge/styles-f2039a70.cjs → node/styles-96606872.cjs} +2 -2
  152. package/vue2/package.json +3 -0
  153. package/vue3/lib/{node/block-wrapper.b3297452.js → browser/block-wrapper.09b54dd3.js} +8 -8
  154. package/vue3/lib/browser/{block-wrapper.c00ddfcb.cjs → block-wrapper.49af98a6.cjs} +1 -1
  155. package/vue3/lib/browser/blocks/custom-code/custom-code.vue.d.ts +0 -1
  156. package/vue3/lib/browser/blocks/image/image.vue.d.ts +1 -1
  157. package/vue3/lib/{edge/component-ref.f5eef526.js → browser/component-ref.63194b25.js} +17 -17
  158. package/vue3/lib/browser/component-ref.78f795cd.cjs +1 -0
  159. package/vue3/lib/browser/components/content/components/enable-editor.vue.d.ts +8 -6
  160. package/vue3/lib/browser/components/content/content.vue.d.ts +6 -6
  161. package/vue3/lib/browser/constants/sdk-version.d.ts +1 -1
  162. package/vue3/lib/browser/functions/evaluate/choose-eval.d.ts +6 -0
  163. package/vue3/lib/browser/functions/evaluate/evaluate.d.ts +1 -5
  164. package/vue3/lib/browser/functions/evaluate/helpers.d.ts +7 -1
  165. package/vue3/lib/browser/functions/evaluate/node-runtime/index.d.ts +1 -1
  166. package/vue3/lib/browser/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  167. package/vue3/lib/browser/functions/get-content/types.d.ts +94 -3
  168. package/vue3/lib/browser/functions/is-node-runtime.d.ts +4 -0
  169. package/vue3/lib/{edge/get-block-actions.c5c7e487.cjs → browser/get-block-actions.2e99e179.cjs} +1 -1
  170. package/vue3/lib/{edge/get-block-actions.f1dcfc47.js → browser/get-block-actions.4f330889.js} +1 -1
  171. package/vue3/lib/{node/index.c51504ff.js → browser/index.88b433c6.js} +826 -795
  172. package/vue3/lib/browser/index.c04232f6.cjs +69 -0
  173. package/vue3/lib/browser/index.cjs +1 -1
  174. package/vue3/lib/browser/index.js +1 -1
  175. package/vue3/lib/{edge/repeated-block.e2eb73cd.js → browser/repeated-block.067ee555.js} +6 -6
  176. package/vue3/lib/browser/{repeated-block.2245fce7.cjs → repeated-block.ef8176d8.cjs} +1 -1
  177. package/vue3/lib/edge/{block-wrapper.6e434dc7.cjs → block-wrapper.2d4ec833.cjs} +1 -1
  178. package/vue3/lib/{browser/block-wrapper.b3297452.js → edge/block-wrapper.4b2f2fb3.js} +8 -8
  179. package/vue3/lib/edge/blocks/custom-code/custom-code.vue.d.ts +0 -1
  180. package/vue3/lib/edge/blocks/image/image.vue.d.ts +1 -1
  181. package/vue3/lib/{node/component-ref.88102d68.js → edge/component-ref.98beaea3.js} +17 -17
  182. package/vue3/lib/edge/component-ref.d8514fb0.cjs +1 -0
  183. package/vue3/lib/edge/components/content/components/enable-editor.vue.d.ts +8 -6
  184. package/vue3/lib/edge/components/content/content.vue.d.ts +6 -6
  185. package/vue3/lib/edge/constants/sdk-version.d.ts +1 -1
  186. package/vue3/lib/edge/functions/evaluate/choose-eval.d.ts +6 -0
  187. package/vue3/lib/edge/functions/evaluate/evaluate.d.ts +1 -5
  188. package/vue3/lib/edge/functions/evaluate/helpers.d.ts +7 -1
  189. package/vue3/lib/edge/functions/evaluate/node-runtime/index.d.ts +1 -1
  190. package/vue3/lib/edge/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  191. package/vue3/lib/edge/functions/get-content/types.d.ts +94 -3
  192. package/vue3/lib/edge/functions/is-node-runtime.d.ts +4 -0
  193. package/vue3/lib/{node/get-block-actions.703f8554.cjs → edge/get-block-actions.407fbfa9.cjs} +1 -1
  194. package/vue3/lib/{browser/get-block-actions.1865148e.js → edge/get-block-actions.b460cca3.js} +1 -1
  195. package/vue3/lib/edge/index.8bdc4716.cjs +89 -0
  196. package/vue3/lib/edge/{index.f80ab661.js → index.a8ffb479.js} +1352 -1293
  197. package/vue3/lib/edge/index.cjs +1 -1
  198. package/vue3/lib/edge/index.js +1 -1
  199. package/vue3/lib/{browser/repeated-block.f6fdedb6.js → edge/repeated-block.cc9bbed2.js} +6 -6
  200. package/vue3/lib/edge/{repeated-block.8292d33a.cjs → repeated-block.f5d444e9.cjs} +1 -1
  201. package/vue3/lib/node/block-wrapper.25e28ca3.cjs +1 -0
  202. package/vue3/lib/{edge/block-wrapper.dad1bb39.js → node/block-wrapper.56bce6c4.js} +7 -6
  203. package/vue3/lib/node/blocks/custom-code/custom-code.vue.d.ts +0 -1
  204. package/vue3/lib/node/blocks/image/image.vue.d.ts +1 -1
  205. package/vue3/lib/node/component-ref.c35ae123.cjs +1 -0
  206. package/vue3/lib/{browser/component-ref.88102d68.js → node/component-ref.cd59ca4d.js} +18 -17
  207. package/vue3/lib/node/components/content/components/enable-editor.vue.d.ts +8 -6
  208. package/vue3/lib/node/components/content/content.vue.d.ts +6 -6
  209. package/vue3/lib/node/constants/sdk-version.d.ts +1 -1
  210. package/vue3/lib/node/functions/evaluate/choose-eval.d.ts +6 -0
  211. package/vue3/lib/node/functions/evaluate/evaluate.d.ts +1 -5
  212. package/vue3/lib/node/functions/evaluate/helpers.d.ts +7 -1
  213. package/vue3/lib/node/functions/evaluate/node-runtime/index.d.ts +1 -1
  214. package/vue3/lib/node/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  215. package/vue3/lib/node/functions/get-content/types.d.ts +94 -3
  216. package/vue3/lib/node/functions/is-node-runtime.d.ts +4 -0
  217. package/vue3/lib/{browser/get-block-actions.703f8554.cjs → node/get-block-actions.0d715e21.cjs} +1 -1
  218. package/vue3/lib/node/{get-block-actions.1865148e.js → get-block-actions.3df391e9.js} +1 -1
  219. package/vue3/lib/{browser/index.c51504ff.js → node/index.88589866.js} +977 -852
  220. package/vue3/lib/node/index.b2d2bb5e.cjs +109 -0
  221. package/vue3/lib/node/index.cjs +1 -1
  222. package/vue3/lib/node/index.js +27 -26
  223. package/vue3/lib/node/{repeated-block.f6fdedb6.js → repeated-block.57ca2ba1.js} +7 -6
  224. package/vue3/lib/node/repeated-block.78ed5bbb.cjs +1 -0
  225. package/vue3/package.json +3 -0
  226. package/vue2/lib/browser/enable-editor-f87e3e48.cjs +0 -1
  227. package/vue2/lib/browser/evaluate-043734e5.cjs +0 -1
  228. package/vue2/lib/browser/evaluate-b309ef11.js +0 -81
  229. package/vue2/lib/browser/index-7b952a40.cjs +0 -32
  230. package/vue2/lib/edge/enable-editor-617a4b09.cjs +0 -1
  231. package/vue2/lib/edge/evaluate-e31fc7a4.cjs +0 -21
  232. package/vue2/lib/edge/index-cb2684cd.cjs +0 -32
  233. package/vue2/lib/node/enable-editor-f87e3e48.cjs +0 -1
  234. package/vue2/lib/node/evaluate-043734e5.cjs +0 -1
  235. package/vue2/lib/node/evaluate-b309ef11.js +0 -81
  236. package/vue2/lib/node/get-processed-block-28afdbdd.js +0 -58
  237. package/vue2/lib/node/get-processed-block-cb418829.cjs +0 -1
  238. package/vue2/lib/node/index-7b952a40.cjs +0 -32
  239. package/vue3/lib/browser/component-ref.5446db23.cjs +0 -1
  240. package/vue3/lib/browser/index.403011b1.cjs +0 -69
  241. package/vue3/lib/edge/component-ref.94b009f1.cjs +0 -1
  242. package/vue3/lib/edge/index.61c09215.cjs +0 -89
  243. package/vue3/lib/node/block-wrapper.c00ddfcb.cjs +0 -1
  244. package/vue3/lib/node/component-ref.5446db23.cjs +0 -1
  245. package/vue3/lib/node/index.403011b1.cjs +0 -69
  246. package/vue3/lib/node/repeated-block.2245fce7.cjs +0 -1
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as k } from "vue";
2
- import { e as m } from "./evaluate-becf2384.js";
3
- import { r as y, m as h, T as w, l as f, o as _, i as u, p as E, _ as g, q as b, t as I, u as U, v as P, f as M, n as T } from "./index-8d71df29.js";
4
- const H = "0.6.4", q = () => {
5
- y("insertMenu", {
2
+ import { e as f } from "./evaluate-946bbbf4.js";
3
+ import { r as w, m as p, T as y, l as g, _ as b, o as S, p as _, i as h, f as E, q as I, t as U, u as M, v as H, n as P } from "./index-7ce12494.js";
4
+ const T = "0.7.1-1", K = () => {
5
+ w("insertMenu", {
6
6
  name: "_default",
7
7
  default: !0,
8
8
  items: [{
@@ -24,14 +24,14 @@ const H = "0.6.4", q = () => {
24
24
  }]
25
25
  });
26
26
  };
27
- let S = !1;
28
- const K = (n = {}) => {
27
+ let C = !1;
28
+ const q = (n = {}) => {
29
29
  var e, t;
30
- S || (S = !0, h() && ((e = window.parent) == null || e.postMessage({
30
+ C || (C = !0, p() && ((e = window.parent) == null || e.postMessage({
31
31
  type: "builder.sdkInfo",
32
32
  data: {
33
- target: w,
34
- version: H,
33
+ target: y,
34
+ version: T,
35
35
  supportsPatchUpdates: !1,
36
36
  // Supports builder-model="..." attribute which is needed to
37
37
  // scope our '+ add block' button styling
@@ -50,33 +50,33 @@ const K = (n = {}) => {
50
50
  if (i != null && i.type)
51
51
  switch (i.type) {
52
52
  case "builder.evaluate": {
53
- const a = i.data.text, v = i.data.arguments || [], d = i.data.id, R = new Function(a);
54
- let r, l = null;
53
+ const a = i.data.text, d = i.data.arguments || [], l = i.data.id, x = new Function(a);
54
+ let r, c = null;
55
55
  try {
56
- r = R.apply(null, v);
57
- } catch (c) {
58
- l = c;
56
+ r = x.apply(null, d);
57
+ } catch (u) {
58
+ c = u;
59
59
  }
60
- l ? (o = window.parent) == null || o.postMessage({
60
+ c ? (o = window.parent) == null || o.postMessage({
61
61
  type: "builder.evaluateError",
62
62
  data: {
63
- id: d,
64
- error: l.message
63
+ id: l,
64
+ error: c.message
65
65
  }
66
- }, "*") : r && typeof r.then == "function" ? r.then((c) => {
67
- var p;
68
- (p = window.parent) == null || p.postMessage({
66
+ }, "*") : r && typeof r.then == "function" ? r.then((u) => {
67
+ var m;
68
+ (m = window.parent) == null || m.postMessage({
69
69
  type: "builder.evaluateResult",
70
70
  data: {
71
- id: d,
72
- result: c
71
+ id: l,
72
+ result: u
73
73
  }
74
74
  }, "*");
75
75
  }).catch(console.error) : (s = window.parent) == null || s.postMessage({
76
76
  type: "builder.evaluateResult",
77
77
  data: {
78
78
  result: r,
79
- id: d
79
+ id: l
80
80
  }
81
81
  }, "*");
82
82
  break;
@@ -84,7 +84,7 @@ const K = (n = {}) => {
84
84
  }
85
85
  })));
86
86
  };
87
- function C(n) {
87
+ function v(n) {
88
88
  return Math.round(n * 1e3) / 1e3;
89
89
  }
90
90
  const O = (n, e, t = !0) => {
@@ -101,11 +101,11 @@ const O = (n, e, t = !0) => {
101
101
  }, N = (n) => O(n, (e) => {
102
102
  const t = e.getAttribute("builder-id") || e.id;
103
103
  return (t == null ? void 0 : t.indexOf("builder-")) === 0;
104
- }), x = ({
104
+ }), R = ({
105
105
  event: n,
106
106
  target: e
107
107
  }) => {
108
- const t = e.getBoundingClientRect(), i = n.clientX - t.left, o = n.clientY - t.top, s = C(i / t.width), a = C(o / t.height);
108
+ const t = e.getBoundingClientRect(), i = n.clientX - t.left, o = n.clientY - t.top, s = v(i / t.width), a = v(o / t.height);
109
109
  return {
110
110
  x: s,
111
111
  y: a
@@ -115,11 +115,11 @@ const O = (n, e, t = !0) => {
115
115
  return {
116
116
  targetBuilderElement: i || void 0,
117
117
  metadata: {
118
- targetOffset: e ? x({
118
+ targetOffset: e ? R({
119
119
  event: n,
120
120
  target: e
121
121
  }) : void 0,
122
- builderTargetOffset: t ? x({
122
+ builderTargetOffset: t ? R({
123
123
  event: n,
124
124
  target: t
125
125
  }) : void 0,
@@ -134,12 +134,12 @@ const O = (n, e, t = !0) => {
134
134
  "context",
135
135
  "canTrack",
136
136
  "apiKey",
137
- "showContent",
138
- "classNameProp",
139
- "content",
140
137
  "locale",
141
138
  "includeRefs",
142
- "enrich"
139
+ "enrich",
140
+ "content",
141
+ "showContent",
142
+ "classNameProp"
143
143
  ],
144
144
  data() {
145
145
  return {
@@ -148,63 +148,40 @@ const O = (n, e, t = !0) => {
148
148
  shouldSendResetCookie: !1,
149
149
  httpReqsData: {},
150
150
  clicked: !1,
151
- builderContext: f
151
+ builderContext: g
152
152
  };
153
153
  },
154
154
  provide() {
155
155
  const n = this;
156
156
  return {
157
- [f.key]: n.builderContextSignal
157
+ [g.key]: n.builderContextSignal
158
158
  };
159
159
  },
160
160
  mounted() {
161
- var n, e;
162
- if (this.apiKey || _.error(
163
- "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
164
- ), h()) {
165
- if (u() && (this.forceReRenderCount = this.forceReRenderCount + 1, window.addEventListener("message", this.processMessage), q(), K({
166
- ...this.locale ? {
167
- locale: this.locale
168
- } : {},
169
- ...this.includeRefs ? {
170
- includeRefs: this.includeRefs
171
- } : {},
172
- ...this.enrich ? {
173
- enrich: this.enrich
174
- } : {}
175
- }), Object.values(
176
- this.builderContextSignal.componentInfos
177
- ).forEach((t) => {
178
- var o;
179
- const i = E(t);
180
- (o = window.parent) == null || o.postMessage(i, "*");
181
- }), window.addEventListener(
182
- "builder:component:stateChangeListenerActivated",
183
- this.emitStateUpdate
184
- )), this.builderContextSignal.content) {
185
- const t = (n = this.builderContextSignal.content) == null ? void 0 : n.testVariationId, i = (e = this.builderContextSignal.content) == null ? void 0 : e.id;
186
- g({
187
- type: "impression",
188
- canTrack: b(this.canTrack),
189
- contentId: i,
190
- apiKey: this.apiKey,
191
- variationId: t !== i ? t : void 0
192
- });
193
- }
194
- if (I()) {
195
- const t = new URL(location.href).searchParams, i = t.get("builder.preview"), o = t.get(
196
- `builder.preview.${i}`
197
- ), s = t.get("apiKey") || t.get("builder.space");
198
- i === this.model && s === this.apiKey && (!this.content || o === this.content.id) && U({
199
- model: this.model,
200
- apiKey: this.apiKey,
201
- apiVersion: this.builderContextSignal.apiVersion
202
- }).then((a) => {
203
- a && this.mergeNewContent(a);
204
- });
161
+ (() => {
162
+ var t, i;
163
+ if (p()) {
164
+ if (h() && this.$refs.elementRef && this.$refs.elementRef.dispatchEvent(
165
+ new CustomEvent("initeditingbldr")
166
+ ), this.builderContextSignal.content && S(this.canTrack)) {
167
+ const s = (t = this.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (i = this.builderContextSignal.content) == null ? void 0 : i.id, d = this.apiKey;
168
+ b({
169
+ type: "impression",
170
+ canTrack: !0,
171
+ contentId: a,
172
+ apiKey: d,
173
+ variationId: s !== a ? s : void 0
174
+ });
175
+ }
176
+ M() && this.$refs.elementRef && this.$refs.elementRef.dispatchEvent(
177
+ new CustomEvent("initpreviewingbldr")
178
+ );
205
179
  }
206
- this.evaluateJsCode(), this.runHttpRequests(), this.emitStateUpdate();
207
- }
180
+ })(), (() => {
181
+ this.apiKey || H.error(
182
+ "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
183
+ ), this.evaluateJsCode(), this.runHttpRequests(), this.emitStateUpdate();
184
+ })();
208
185
  },
209
186
  watch: {
210
187
  onUpdateHook0: {
@@ -235,7 +212,7 @@ const O = (n, e, t = !0) => {
235
212
  }
236
213
  },
237
214
  unmounted() {
238
- h() && (window.removeEventListener("message", this.processMessage), window.removeEventListener(
215
+ p() && (window.removeEventListener("message", this.processMessage), window.removeEventListener(
239
216
  "builder:component:stateChangeListenerActivated",
240
217
  this.emitStateUpdate
241
218
  ));
@@ -314,7 +291,7 @@ const O = (n, e, t = !0) => {
314
291
  evaluateJsCode() {
315
292
  var e, t;
316
293
  const n = (t = (e = this.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : t.jsCode;
317
- n && m({
294
+ n && f({
318
295
  code: n,
319
296
  context: this.context || {},
320
297
  localState: void 0,
@@ -326,9 +303,9 @@ const O = (n, e, t = !0) => {
326
303
  var e, t;
327
304
  if (this.builderContextSignal.content) {
328
305
  const i = (e = this.builderContextSignal.content) == null ? void 0 : e.testVariationId, o = (t = this.builderContextSignal.content) == null ? void 0 : t.id;
329
- g({
306
+ b({
330
307
  type: "click",
331
- canTrack: b(this.canTrack),
308
+ canTrack: S(this.canTrack),
332
309
  contentId: o,
333
310
  apiKey: this.apiKey,
334
311
  variationId: i !== o ? i : void 0,
@@ -341,7 +318,7 @@ const O = (n, e, t = !0) => {
341
318
  evalExpression(n) {
342
319
  return n.replace(
343
320
  /{{([^}]+)}}/g,
344
- (e, t) => m({
321
+ (e, t) => f({
345
322
  code: t,
346
323
  context: this.context || {},
347
324
  localState: void 0,
@@ -351,7 +328,7 @@ const O = (n, e, t = !0) => {
351
328
  );
352
329
  },
353
330
  handleRequest({ url: n, key: e }) {
354
- P(n).then((t) => t.json()).then((t) => {
331
+ _(n).then((t) => t.json()).then((t) => {
355
332
  var o, s;
356
333
  const i = {
357
334
  ...this.builderContextSignal.rootState,
@@ -366,7 +343,7 @@ const O = (n, e, t = !0) => {
366
343
  var e, t;
367
344
  const n = ((t = (e = this.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : t.httpRequests) ?? {};
368
345
  Object.entries(n).forEach(([i, o]) => {
369
- if (o && (!this.httpReqsData[i] || u())) {
346
+ if (o && (!this.httpReqsData[i] || h())) {
370
347
  const s = this.evalExpression(o);
371
348
  this.handleRequest({
372
349
  url: s,
@@ -376,12 +353,12 @@ const O = (n, e, t = !0) => {
376
353
  });
377
354
  },
378
355
  emitStateUpdate() {
379
- u() && window.dispatchEvent(
356
+ h() && window.dispatchEvent(
380
357
  new CustomEvent(
381
358
  "builder:component:stateChange",
382
359
  {
383
360
  detail: {
384
- state: M(this.builderContextSignal.rootState),
361
+ state: E(this.builderContextSignal.rootState),
385
362
  ref: {
386
363
  name: this.model
387
364
  }
@@ -390,6 +367,40 @@ const O = (n, e, t = !0) => {
390
367
  )
391
368
  );
392
369
  },
370
+ elementRef_onIniteditingbldr(n) {
371
+ this.forceReRenderCount = this.forceReRenderCount + 1, window.addEventListener("message", this.processMessage), K(), q({
372
+ ...this.locale ? {
373
+ locale: this.locale
374
+ } : {},
375
+ ...this.includeRefs ? {
376
+ includeRefs: this.includeRefs
377
+ } : {},
378
+ ...this.enrich ? {
379
+ enrich: this.enrich
380
+ } : {}
381
+ }), Object.values(
382
+ this.builderContextSignal.componentInfos
383
+ ).forEach((e) => {
384
+ var i;
385
+ const t = I(e);
386
+ (i = window.parent) == null || i.postMessage(t, "*");
387
+ }), window.addEventListener(
388
+ "builder:component:stateChangeListenerActivated",
389
+ this.emitStateUpdate
390
+ );
391
+ },
392
+ elementRef_onInitpreviewingbldr(n) {
393
+ const e = new URL(location.href).searchParams, t = e.get("builder.preview"), i = e.get(
394
+ `builder.preview.${t}`
395
+ ), o = e.get("apiKey") || e.get("builder.space");
396
+ t === this.model && o === this.apiKey && (!this.content || i === this.content.id) && U({
397
+ model: this.model,
398
+ apiKey: this.apiKey,
399
+ apiVersion: this.builderContextSignal.apiVersion
400
+ }).then((s) => {
401
+ s && this.mergeNewContent(s);
402
+ });
403
+ },
393
404
  _classStringToObject(n) {
394
405
  const e = {};
395
406
  if (typeof n != "string")
@@ -406,13 +417,17 @@ var L = function() {
406
417
  var e = this, t = e._self._c;
407
418
  return e._self._setupProxy, e.builderContextSignal.content ? t("div", e._b({ key: e.forceReRenderCount, ref: "elementRef", class: e._classStringToObject(e.classNameProp), attrs: { "builder-content-id": (i = e.builderContextSignal.content) == null ? void 0 : i.id, "builder-model": e.model }, on: { click: function(o) {
408
419
  return e.onClick(o);
420
+ }, initeditingbldr: function(o) {
421
+ return e.elementRef_onIniteditingbldr(o);
422
+ }, initpreviewingbldr: function(o) {
423
+ return e.elementRef_onInitpreviewingbldr(o);
409
424
  } } }, "div", {
410
425
  ...e.showContent ? {} : {
411
426
  hidden: !0,
412
427
  "aria-hidden": !0
413
428
  }
414
429
  }, !1), [e._t("default")], 2) : e._e();
415
- }, B = [], D = /* @__PURE__ */ T(
430
+ }, B = [], D = /* @__PURE__ */ P(
416
431
  A,
417
432
  L,
418
433
  B,
@@ -422,7 +437,7 @@ var L = function() {
422
437
  null,
423
438
  null
424
439
  );
425
- const z = D.exports;
440
+ const J = D.exports;
426
441
  export {
427
- z as default
442
+ J as default
428
443
  };
@@ -0,0 +1,41 @@
1
+ "use strict";const index=require("./index-ea4df31a.cjs"),getFunctionArguments=({builder:e,context:t,event:s,state:n})=>Object.entries({state:n,Builder:e,builder:e,context:t,event:s}),getBuilderGlobals=()=>({isEditing:index.isEditing(),isBrowser:index.isBrowser(),isServer:!index.isBrowser(),getUserAttributes:()=>index.getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:s,event:n,localState:r,rootSetState:o,rootState:u})=>{const l=getFunctionArguments({builder:t,context:s,event:n,state:flattenState(u,r,o)});return new Function(...l.map(([i])=>i),e)(...l.map(([,i])=>i))};function flattenState(e,t,s){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(n,r)=>t&&r in t?t[r]:e[r],set:(n,r,o)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[r]=o,s==null||s(e),!0}})}const noop=()=>null;let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const set=(e,t,s)=>{if(Object(e)!==e)return e;const n=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return n.slice(0,-1).reduce((r,o,u)=>Object(r[o])===r[o]?r[o]:r[o]=Math.abs(Number(n[u+1]))>>0===+n[u+1]?[]:{},e)[n[n.length-1]]=s,e},ivm=safeDynamicRequire("isolated-vm"),getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
2
+ var refToProxy = (obj) => {
3
+ if (typeof obj !== 'object' || obj === null) {
4
+ return obj;
5
+ }
6
+ return new Proxy({}, {
7
+ get(target, key) {
8
+ if (key === 'copySync') {
9
+ return () => obj.copySync();
10
+ }
11
+ const val = obj.getSync(key);
12
+ if (typeof val?.getSync === 'function') {
13
+ return refToProxy(val);
14
+ }
15
+ return val;
16
+ },
17
+ set(target, key, value) {
18
+ const v = typeof value === 'object' ? new ${INJECTED_IVM_GLOBAL}.Reference(value) : value;
19
+ obj.setSync(key, v);
20
+ ${BUILDER_SET_STATE_NAME}(key, value)
21
+ },
22
+ deleteProperty(target, key) {
23
+ obj.deleteSync(key);
24
+ }
25
+ })
26
+ }
27
+ `,processCode=({code:e,args:t})=>{const s=t.map(([n])=>`var ${n} = refToProxy(${getSyncValName(n)}); `).join("");return`
28
+ ${REF_TO_PROXY_FN}
29
+ ${s}
30
+ function theFunction() {
31
+ ${e}
32
+ }
33
+
34
+ let output = theFunction()
35
+
36
+ if (typeof output === 'object' && output !== null) {
37
+ output = JSON.stringify(output.copySync ? output.copySync() : output);
38
+ }
39
+
40
+ output;
41
+ `},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:s,event:n,localState:r,rootSetState:o,rootState:u})=>{const l=index.fastClone({...u,...r}),i=getFunctionArguments({builder:t,context:s,event:n,state:l}),g=getIsolateContext(),a=g.global;a.setSync("global",a.derefInto()),a.setSync("log",function(...c){console.log(...c)}),a.setSync(BUILDER_SET_STATE_NAME,function(c,y){set(u,c,y),o==null||o(u)}),i.forEach(([c,y])=>{const d=typeof y=="object"?new ivm.Reference(c==="builder"?{...y,getUserAttributes:()=>y.getUserAttributes()}:y):null;a.setSync(getSyncValName(c),d)}),a.setSync(INJECTED_IVM_GLOBAL,ivm);const v=processCode({code:e,args:i}),f=g.evalSync(v);try{return JSON.parse(f)}catch{return f}},chooseBrowserOrServerEval=e=>index.isBrowser()?runInBrowser(e):runInNode(e);function evaluate({code:e,context:t,localState:s,rootState:n,rootSetState:r,event:o,isExpression:u=!0}){if(e===""){index.logger.warn("Skipping evaluation of empty code block.");return}const l={code:parseCode(e,{isExpression:u}),builder:getBuilderGlobals(),context:t,event:o,rootSetState:r,rootState:n,localState:s};try{return chooseBrowserOrServerEval(l)}catch(i){index.logger.error("Failed code evaluation: "+i.message,{code:e});return}}exports.evaluate=evaluate;exports.set=set;
@@ -0,0 +1,187 @@
1
+ import { i as isEditing, m as isBrowser, w as getUserAttributes, f as fastClone, v as logger } from "./index-7ce12494.js";
2
+ const getFunctionArguments = ({
3
+ builder: e,
4
+ context: t,
5
+ event: s,
6
+ state: n
7
+ }) => Object.entries({
8
+ state: n,
9
+ Builder: e,
10
+ // legacy
11
+ builder: e,
12
+ context: t,
13
+ event: s
14
+ }), getBuilderGlobals = () => ({
15
+ isEditing: isEditing(),
16
+ isBrowser: isBrowser(),
17
+ isServer: !isBrowser(),
18
+ getUserAttributes: () => getUserAttributes()
19
+ }), parseCode = (e, {
20
+ isExpression: t = !0
21
+ }) => /* we disable this for cases where we definitely don't want a return */ t && !(e.includes(";") || e.includes(" return ") || e.trim().startsWith("return ")) ? `return (${e});` : e, runInBrowser = ({
22
+ code: e,
23
+ builder: t,
24
+ context: s,
25
+ event: n,
26
+ localState: r,
27
+ rootSetState: o,
28
+ rootState: u
29
+ }) => {
30
+ const l = getFunctionArguments({
31
+ builder: t,
32
+ context: s,
33
+ event: n,
34
+ state: flattenState(u, r, o)
35
+ });
36
+ return new Function(...l.map(([c]) => c), e)(...l.map(([, c]) => c));
37
+ };
38
+ function flattenState(e, t, s) {
39
+ if (e === t)
40
+ throw new Error("rootState === localState");
41
+ return new Proxy(e, {
42
+ get: (n, r) => t && r in t ? t[r] : e[r],
43
+ set: (n, r, o) => {
44
+ if (t && r in t)
45
+ throw new Error("Writing to local state is not allowed as it is read-only.");
46
+ return e[r] = o, s == null || s(e), !0;
47
+ }
48
+ });
49
+ }
50
+ const noop = () => null;
51
+ let safeDynamicRequire = noop;
52
+ try {
53
+ safeDynamicRequire = eval("require");
54
+ } catch (e) {
55
+ }
56
+ const set = (e, t, s) => {
57
+ if (Object(e) !== e)
58
+ return e;
59
+ const n = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
60
+ return n.slice(0, -1).reduce((r, o, u) => Object(r[o]) === r[o] ? r[o] : r[o] = Math.abs(Number(n[u + 1])) >> 0 === +n[u + 1] ? [] : {}, e)[n[n.length - 1]] = s, e;
61
+ }, ivm = safeDynamicRequire("isolated-vm"), getSyncValName = (e) => `bldr_${e}_sync`, BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE", INJECTED_IVM_GLOBAL = "BUILDER_IVM", REF_TO_PROXY_FN = `
62
+ var refToProxy = (obj) => {
63
+ if (typeof obj !== 'object' || obj === null) {
64
+ return obj;
65
+ }
66
+ return new Proxy({}, {
67
+ get(target, key) {
68
+ if (key === 'copySync') {
69
+ return () => obj.copySync();
70
+ }
71
+ const val = obj.getSync(key);
72
+ if (typeof val?.getSync === 'function') {
73
+ return refToProxy(val);
74
+ }
75
+ return val;
76
+ },
77
+ set(target, key, value) {
78
+ const v = typeof value === 'object' ? new ${INJECTED_IVM_GLOBAL}.Reference(value) : value;
79
+ obj.setSync(key, v);
80
+ ${BUILDER_SET_STATE_NAME}(key, value)
81
+ },
82
+ deleteProperty(target, key) {
83
+ obj.deleteSync(key);
84
+ }
85
+ })
86
+ }
87
+ `, processCode = ({
88
+ code: e,
89
+ args: t
90
+ }) => {
91
+ const s = t.map(([n]) => `var ${n} = refToProxy(${getSyncValName(n)}); `).join("");
92
+ return `
93
+ ${REF_TO_PROXY_FN}
94
+ ${s}
95
+ function theFunction() {
96
+ ${e}
97
+ }
98
+
99
+ let output = theFunction()
100
+
101
+ if (typeof output === 'object' && output !== null) {
102
+ output = JSON.stringify(output.copySync ? output.copySync() : output);
103
+ }
104
+
105
+ output;
106
+ `;
107
+ }, getIsolateContext = () => new ivm.Isolate({
108
+ memoryLimit: 128
109
+ }).createContextSync(), runInNode = ({
110
+ code: e,
111
+ builder: t,
112
+ context: s,
113
+ event: n,
114
+ localState: r,
115
+ rootSetState: o,
116
+ rootState: u
117
+ }) => {
118
+ const l = fastClone({
119
+ ...u,
120
+ ...r
121
+ }), c = getFunctionArguments({
122
+ builder: t,
123
+ context: s,
124
+ event: n,
125
+ state: l
126
+ }), g = getIsolateContext(), a = g.global;
127
+ a.setSync("global", a.derefInto()), a.setSync("log", function(...i) {
128
+ console.log(...i);
129
+ }), a.setSync(BUILDER_SET_STATE_NAME, function(i, y) {
130
+ set(u, i, y), o == null || o(u);
131
+ }), c.forEach(([i, y]) => {
132
+ const E = typeof y == "object" ? new ivm.Reference(
133
+ // workaround: methods with default values for arguments is not being cloned over
134
+ i === "builder" ? {
135
+ ...y,
136
+ getUserAttributes: () => y.getUserAttributes()
137
+ } : y
138
+ ) : null;
139
+ a.setSync(getSyncValName(i), E);
140
+ }), a.setSync(INJECTED_IVM_GLOBAL, ivm);
141
+ const v = processCode({
142
+ code: e,
143
+ args: c
144
+ }), f = g.evalSync(v);
145
+ try {
146
+ return JSON.parse(f);
147
+ } catch {
148
+ return f;
149
+ }
150
+ }, chooseBrowserOrServerEval = (e) => isBrowser() ? runInBrowser(e) : runInNode(e);
151
+ function evaluate({
152
+ code: e,
153
+ context: t,
154
+ localState: s,
155
+ rootState: n,
156
+ rootSetState: r,
157
+ event: o,
158
+ isExpression: u = !0
159
+ }) {
160
+ if (e === "") {
161
+ logger.warn("Skipping evaluation of empty code block.");
162
+ return;
163
+ }
164
+ const l = {
165
+ code: parseCode(e, {
166
+ isExpression: u
167
+ }),
168
+ builder: getBuilderGlobals(),
169
+ context: t,
170
+ event: o,
171
+ rootSetState: r,
172
+ rootState: n,
173
+ localState: s
174
+ };
175
+ try {
176
+ return chooseBrowserOrServerEval(l);
177
+ } catch (c) {
178
+ logger.error("Failed code evaluation: " + c.message, {
179
+ code: e
180
+ });
181
+ return;
182
+ }
183
+ }
184
+ export {
185
+ evaluate as e,
186
+ set as s
187
+ };
@@ -0,0 +1,6 @@
1
+ import type { ExecutorArgs } from './helpers.js';
2
+ /**
3
+ * Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
4
+ * end up sending the server runtime code to the browser (most notably in dev mode).
5
+ */
6
+ export declare const chooseBrowserOrServerEval: (args: ExecutorArgs) => any;
@@ -1,6 +1,2 @@
1
- import type { ExecutorArgs } from './helpers.js';
2
- export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
3
- event?: Event;
4
- isExpression?: boolean;
5
- };
1
+ import type { EvaluatorArgs } from './helpers.js';
6
2
  export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: EvaluatorArgs): any;
@@ -1,5 +1,9 @@
1
1
  import type { BuilderContextInterface, BuilderRenderState } from '../../context/types.js';
2
- import type { getUserAttributes } from '../track/helpers.js';
2
+ import { getUserAttributes } from '../track/helpers.js';
3
+ export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
4
+ event?: Event;
5
+ isExpression?: boolean;
6
+ };
3
7
  export type BuilderGlobals = {
4
8
  isEditing: boolean | undefined;
5
9
  isBrowser: boolean | undefined;
@@ -16,3 +20,5 @@ export type FunctionArguments = ReturnType<typeof getFunctionArguments>;
16
20
  export declare const getFunctionArguments: ({ builder, context, event, state }: Pick<ExecutorArgs, "context" | "builder" | "event"> & {
17
21
  state: BuilderRenderState;
18
22
  }) => any;
23
+ export declare const getBuilderGlobals: () => BuilderGlobals;
24
+ export declare const parseCode: (code: string, { isExpression }: Pick<EvaluatorArgs, 'isExpression'>) => string;
@@ -1 +1 @@
1
- export { evaluator } from '../browser-runtime/index.js';
1
+ export { runInNode as evaluator } from './node-runtime.js';
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from '../helpers.js';
2
+ export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;