@builder.io/sdk-react-native 0.0.6-1 → 0.0.6-2

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 (113) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button/button.js +34 -0
  3. package/src/blocks/button/component-info.js +41 -0
  4. package/src/blocks/columns/columns.js +62 -0
  5. package/src/blocks/columns/component-info.js +242 -0
  6. package/src/blocks/custom-code/component-info.js +31 -0
  7. package/src/blocks/custom-code/custom-code.js +50 -0
  8. package/src/blocks/embed/component-info.js +44 -0
  9. package/src/blocks/embed/embed.js +43 -0
  10. package/src/blocks/embed/helpers.js +9 -0
  11. package/src/blocks/form/component-info.js +262 -0
  12. package/src/blocks/form/form.js +224 -0
  13. package/src/blocks/fragment/component-info.js +11 -0
  14. package/src/blocks/fragment/fragment.js +8 -0
  15. package/src/blocks/image/component-info.js +151 -0
  16. package/src/blocks/image/image.helpers.js +48 -0
  17. package/src/blocks/image/image.js +41 -0
  18. package/src/blocks/img/component-info.js +20 -0
  19. package/src/blocks/img/img.js +36 -0
  20. package/src/blocks/input/component-info.js +74 -0
  21. package/src/blocks/input/input.js +36 -0
  22. package/src/blocks/raw-text/component-info.js +16 -0
  23. package/src/blocks/raw-text/raw-text.js +10 -0
  24. package/src/blocks/section/component-info.js +49 -0
  25. package/src/blocks/section/section.js +31 -0
  26. package/src/blocks/select/component-info.js +59 -0
  27. package/src/blocks/select/select.js +36 -0
  28. package/src/blocks/submit-button/component-info.js +28 -0
  29. package/src/blocks/submit-button/submit-button.js +29 -0
  30. package/src/blocks/symbol/component-info.js +43 -0
  31. package/src/blocks/symbol/symbol.js +65 -0
  32. package/src/blocks/text/component-info.js +24 -0
  33. package/src/blocks/text/text.js +65 -0
  34. package/src/blocks/textarea/component-info.js +47 -0
  35. package/src/blocks/textarea/textarea.js +32 -0
  36. package/src/blocks/util.js +7 -0
  37. package/src/blocks/video/component-info.js +106 -0
  38. package/src/blocks/video/video.js +52 -0
  39. package/src/components/render-block/block-styles.js +37 -0
  40. package/src/components/render-block/render-block.helpers.js +23 -0
  41. package/src/components/render-block/render-block.js +171 -0
  42. package/src/components/render-block/render-component.js +36 -0
  43. package/src/components/render-block/render-repeated-block.js +30 -0
  44. package/src/components/render-block/types.js +0 -0
  45. package/src/components/render-blocks.js +63 -0
  46. package/src/components/render-content/components/render-styles.js +58 -0
  47. package/src/components/render-content/index.js +4 -0
  48. package/src/components/render-content/render-content.js +262 -0
  49. package/src/components/render-inlined-styles.js +18 -0
  50. package/src/constants/builder-registered-components.js +42 -0
  51. package/src/constants/device-sizes.js +21 -0
  52. package/src/constants/target.js +4 -0
  53. package/src/context/builder.context.js +11 -0
  54. package/src/context/types.js +0 -0
  55. package/src/functions/camel-to-kebab-case.js +4 -0
  56. package/src/functions/convert-style-object.js +6 -0
  57. package/src/functions/evaluate.js +28 -0
  58. package/src/functions/event-handler-name.js +7 -0
  59. package/src/functions/get-block-actions.js +23 -0
  60. package/src/functions/get-block-component-options.js +28 -0
  61. package/src/functions/get-block-properties.js +41 -0
  62. package/src/functions/get-block-styles.js +44 -0
  63. package/src/functions/get-block-tag.js +7 -0
  64. package/src/functions/get-builder-search-params/fn.test.js +13 -0
  65. package/src/functions/get-builder-search-params/index.js +37 -0
  66. package/src/functions/get-content/ab-testing.js +98 -0
  67. package/src/functions/get-content/fn.test.js +31 -0
  68. package/src/functions/get-content/index.js +96 -0
  69. package/src/functions/get-content/types.js +0 -0
  70. package/src/functions/get-fetch.js +34 -0
  71. package/src/functions/get-global-this.js +18 -0
  72. package/src/functions/get-processed-block.js +57 -0
  73. package/src/functions/get-processed-block.test.js +32 -0
  74. package/src/functions/if-target.js +15 -0
  75. package/src/functions/is-browser.js +6 -0
  76. package/src/functions/is-editing.js +7 -0
  77. package/src/functions/is-iframe.js +7 -0
  78. package/src/functions/is-previewing.js +14 -0
  79. package/src/functions/mark-mutable.js +10 -0
  80. package/src/functions/on-change.js +27 -0
  81. package/src/functions/on-change.test.js +19 -0
  82. package/src/functions/register-component.js +72 -0
  83. package/src/functions/register.js +29 -0
  84. package/src/functions/sanitize-styles.js +61 -0
  85. package/src/functions/set-editor-settings.js +15 -0
  86. package/src/functions/set.js +11 -0
  87. package/src/functions/set.test.js +16 -0
  88. package/src/functions/track.js +117 -0
  89. package/src/functions/transform-block.js +37 -0
  90. package/src/helpers/ab-tests.js +16 -0
  91. package/src/helpers/cookie.js +72 -0
  92. package/src/helpers/css.js +12 -0
  93. package/src/helpers/flatten.js +34 -0
  94. package/src/helpers/localStorage.js +34 -0
  95. package/src/helpers/nullable.js +4 -0
  96. package/src/helpers/sessionId.js +49 -0
  97. package/src/helpers/time.js +5 -0
  98. package/src/helpers/url.js +10 -0
  99. package/src/helpers/url.test.js +15 -0
  100. package/src/helpers/uuid.js +13 -0
  101. package/src/helpers/visitorId.js +33 -0
  102. package/src/index-helpers/blocks-exports.js +18 -0
  103. package/src/index-helpers/top-of-file.js +1 -0
  104. package/src/index.js +10 -0
  105. package/src/scripts/init-editing.js +79 -0
  106. package/src/types/builder-block.js +0 -0
  107. package/src/types/builder-content.js +0 -0
  108. package/src/types/can-track.js +0 -0
  109. package/src/types/components.js +0 -0
  110. package/src/types/deep-partial.js +0 -0
  111. package/src/types/element.js +0 -0
  112. package/src/types/targets.js +0 -0
  113. package/src/types/typescript.js +0 -0
@@ -0,0 +1,79 @@
1
+ import { TARGET } from "../constants/target.js";
2
+ import { isBrowser } from "../functions/is-browser.js";
3
+ import { register } from "../functions/register.js";
4
+ const registerInsertMenu = () => {
5
+ register("insertMenu", {
6
+ name: "_default",
7
+ default: true,
8
+ items: [
9
+ { name: "Box" },
10
+ { name: "Text" },
11
+ { name: "Image" },
12
+ { name: "Columns" },
13
+ ...TARGET === "reactNative" ? [] : [
14
+ { name: "Core:Section" },
15
+ { name: "Core:Button" },
16
+ { name: "Embed" },
17
+ { name: "Custom Code" }
18
+ ]
19
+ ]
20
+ });
21
+ };
22
+ const setupBrowserForEditing = () => {
23
+ var _a;
24
+ if (isBrowser()) {
25
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
26
+ type: "builder.sdkInfo",
27
+ data: {
28
+ target: TARGET,
29
+ supportsPatchUpdates: false
30
+ }
31
+ }, "*");
32
+ window.addEventListener("message", ({ data }) => {
33
+ var _a2, _b;
34
+ if (data) {
35
+ switch (data.type) {
36
+ case "builder.evaluate": {
37
+ const text = data.data.text;
38
+ const args = data.data.arguments || [];
39
+ const id = data.data.id;
40
+ const fn = new Function(text);
41
+ let result;
42
+ let error = null;
43
+ try {
44
+ result = fn.apply(null, args);
45
+ } catch (err) {
46
+ error = err;
47
+ }
48
+ if (error) {
49
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
50
+ type: "builder.evaluateError",
51
+ data: { id, error: error.message }
52
+ }, "*");
53
+ } else {
54
+ if (result && typeof result.then === "function") {
55
+ result.then((finalResult) => {
56
+ var _a3;
57
+ (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
58
+ type: "builder.evaluateResult",
59
+ data: { id, result: finalResult }
60
+ }, "*");
61
+ }).catch(console.error);
62
+ } else {
63
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
64
+ type: "builder.evaluateResult",
65
+ data: { result, id }
66
+ }, "*");
67
+ }
68
+ }
69
+ break;
70
+ }
71
+ }
72
+ }
73
+ });
74
+ }
75
+ };
76
+ export {
77
+ registerInsertMenu,
78
+ setupBrowserForEditing
79
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes