@builder.io/sdk-react-native 0.0.1-34 → 0.0.1-35

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 (82) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button.js +35 -0
  3. package/src/blocks/button.lite.tsx +25 -0
  4. package/src/blocks/columns.js +43 -0
  5. package/src/blocks/columns.lite.tsx +41 -0
  6. package/src/blocks/custom-code.js +56 -0
  7. package/src/blocks/custom-code.lite.tsx +67 -0
  8. package/src/blocks/embed.js +56 -0
  9. package/src/blocks/embed.lite.tsx +65 -0
  10. package/src/blocks/form.js +226 -0
  11. package/src/blocks/form.lite.tsx +253 -0
  12. package/src/blocks/fragment.js +13 -0
  13. package/src/blocks/fragment.lite.tsx +11 -0
  14. package/src/blocks/image.js +121 -0
  15. package/src/blocks/image.lite.tsx +67 -0
  16. package/src/blocks/img.js +41 -0
  17. package/src/blocks/img.lite.tsx +19 -0
  18. package/src/blocks/input.js +41 -0
  19. package/src/blocks/input.lite.tsx +21 -0
  20. package/src/blocks/raw-text.js +17 -0
  21. package/src/blocks/raw-text.lite.tsx +12 -0
  22. package/src/blocks/section.js +36 -0
  23. package/src/blocks/section.lite.tsx +20 -0
  24. package/src/blocks/select.js +41 -0
  25. package/src/blocks/select.lite.tsx +24 -0
  26. package/src/blocks/submit-button.js +34 -0
  27. package/src/blocks/submit-button.lite.tsx +11 -0
  28. package/src/blocks/symbol.js +20 -0
  29. package/src/blocks/symbol.lite.tsx +20 -0
  30. package/src/blocks/text.js +85 -0
  31. package/src/blocks/text.lite.tsx +12 -0
  32. package/src/blocks/textarea.js +37 -0
  33. package/src/blocks/textarea.lite.tsx +15 -0
  34. package/src/blocks/video.js +88 -0
  35. package/src/blocks/video.lite.tsx +28 -0
  36. package/src/components/block-styles.js +7 -0
  37. package/src/components/block-styles.lite.tsx +7 -0
  38. package/src/components/error-boundary.js +25 -0
  39. package/src/components/error-boundary.lite.tsx +7 -0
  40. package/src/components/render-block.js +105 -0
  41. package/src/components/render-block.lite.tsx +125 -0
  42. package/src/components/render-blocks.js +47 -0
  43. package/src/components/render-blocks.lite.tsx +60 -0
  44. package/src/components/render-content.js +143 -0
  45. package/src/components/render-content.lite.tsx +207 -0
  46. package/src/constants/device-sizes.js +40 -0
  47. package/src/context/builder.context.js +5 -0
  48. package/src/functions/evaluate.js +20 -0
  49. package/src/functions/get-block-actions.js +23 -0
  50. package/src/functions/get-block-component-options.js +24 -0
  51. package/src/functions/get-block-properties.js +43 -0
  52. package/src/functions/get-block-styles.js +61 -0
  53. package/src/functions/get-block-tag.js +8 -0
  54. package/src/functions/get-content.js +128 -0
  55. package/src/functions/get-content.test.js +47 -0
  56. package/src/functions/get-fetch.js +13 -0
  57. package/src/functions/get-global-this.js +19 -0
  58. package/src/functions/get-processed-block.js +45 -0
  59. package/src/functions/get-processed-block.test.js +27 -0
  60. package/src/functions/get-target.js +7 -0
  61. package/src/functions/if-target.js +7 -0
  62. package/src/functions/is-browser.js +8 -0
  63. package/src/functions/is-editing.js +8 -0
  64. package/src/functions/is-iframe.js +8 -0
  65. package/src/functions/is-previewing.js +15 -0
  66. package/src/functions/is-react-native.js +7 -0
  67. package/src/functions/macro-eval.js +6 -0
  68. package/src/functions/on-change.js +28 -0
  69. package/src/functions/on-change.test.js +21 -0
  70. package/src/functions/previewing-model-name.js +12 -0
  71. package/src/functions/register-component.js +54 -0
  72. package/src/functions/register.js +30 -0
  73. package/src/functions/set-editor-settings.js +16 -0
  74. package/src/functions/set.js +12 -0
  75. package/src/functions/set.test.js +18 -0
  76. package/src/functions/track.js +19 -0
  77. package/src/index.js +25 -0
  78. package/src/package.json +18 -0
  79. package/src/scripts/init-editing.js +71 -0
  80. package/src/types/builder-block.js +1 -0
  81. package/src/types/builder-content.js +1 -0
  82. package/src/types/deep-partial.js +1 -0
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { isBrowser } from "./is-browser";
3
+ import { isReactNative } from "./is-react-native";
4
+ function track(event, properties) {
5
+ if (!isBrowser() || isReactNative()) {
6
+ return;
7
+ }
8
+ return fetch(`https://builder.io/api/v1/track`, {
9
+ method: "POST",
10
+ body: JSON.stringify({ events: [{ type: event, data: properties }] }),
11
+ headers: {
12
+ "content-type": "application/json"
13
+ },
14
+ mode: "cors"
15
+ });
16
+ }
17
+ export {
18
+ track
19
+ };
package/src/index.js ADDED
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { isEditing } from "./functions/is-editing";
3
+ if (isEditing()) {
4
+ import("./scripts/init-editing");
5
+ }
6
+ import { default as default2 } from "./blocks/columns";
7
+ import { default as default3 } from "./blocks/image";
8
+ import { default as default4 } from "./blocks/text";
9
+ import { default as default5 } from "./blocks/symbol";
10
+ import { default as default6 } from "./blocks/section";
11
+ import { default as default7 } from "./blocks/fragment";
12
+ import { default as default8 } from "./components/render-content";
13
+ export * from "./functions/register-component";
14
+ export * from "./functions/register";
15
+ export * from "./functions/set-editor-settings";
16
+ export * from "./functions/get-content";
17
+ export {
18
+ default2 as Columns,
19
+ default7 as Fragment,
20
+ default3 as Image,
21
+ default8 as RenderContent,
22
+ default6 as Section,
23
+ default5 as Symbol,
24
+ default4 as Text
25
+ };
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@builder.io/sdk-react-native",
3
+ "description": "Builder.io SDK for React Native",
4
+ "version": "0.0.1-1",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
8
+ },
9
+ "dependencies": {
10
+ "react-native-render-html": "^5.1.1"
11
+ },
12
+ "peerDependencies": {
13
+ "react-native": "^0.64.2"
14
+ },
15
+ "devDependencies": {
16
+ "react-native": "^0.64.2"
17
+ }
18
+ }
@@ -0,0 +1,71 @@
1
+ import * as React from 'react';
2
+ var _a;
3
+ import { isBrowser } from "../functions/is-browser";
4
+ import { register } from "../functions/register";
5
+ register("insertMenu", {
6
+ name: "_default",
7
+ default: true,
8
+ items: [
9
+ { name: "Box" },
10
+ { name: "Text" },
11
+ { name: "Image" },
12
+ { name: "Columns" },
13
+ ...true ? [] : [
14
+ { name: "Core:Section" },
15
+ { name: "Core:Button" },
16
+ { name: "Embed" },
17
+ { name: "Custom Code" }
18
+ ]
19
+ ]
20
+ });
21
+ if (isBrowser()) {
22
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
23
+ type: "builder.sdkInfo",
24
+ data: {
25
+ target: "reactNative",
26
+ supportsPatchUpdates: false
27
+ }
28
+ }, "*");
29
+ window.addEventListener("message", ({ data }) => {
30
+ var _a2, _b;
31
+ if (data) {
32
+ switch (data.type) {
33
+ case "builder.evaluate": {
34
+ const text = data.data.text;
35
+ const args = data.data.arguments || [];
36
+ const id = data.data.id;
37
+ const fn = new Function(text);
38
+ let result;
39
+ let error = null;
40
+ try {
41
+ result = fn.apply(null, args);
42
+ } catch (err) {
43
+ error = err;
44
+ }
45
+ if (error) {
46
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
47
+ type: "builder.evaluateError",
48
+ data: { id, error: error.message }
49
+ }, "*");
50
+ } else {
51
+ if (result && typeof result.then === "function") {
52
+ result.then((finalResult) => {
53
+ var _a3;
54
+ (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
55
+ type: "builder.evaluateResult",
56
+ data: { id, result: finalResult }
57
+ }, "*");
58
+ }).catch(console.error);
59
+ } else {
60
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
61
+ type: "builder.evaluateResult",
62
+ data: { result, id }
63
+ }, "*");
64
+ }
65
+ }
66
+ break;
67
+ }
68
+ }
69
+ }
70
+ });
71
+ }
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ import * as React from 'react';