@builder.io/sdk-react-native 0.0.1-7 → 0.0.1-70

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 (153) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +19 -0
  3. package/package.json +6 -4
  4. package/src/blocks/button/button.js +34 -0
  5. package/src/blocks/button/component-info.js +41 -0
  6. package/src/blocks/columns/columns.js +61 -0
  7. package/src/blocks/columns/component-info.js +242 -0
  8. package/src/blocks/custom-code/component-info.js +31 -0
  9. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.js} +16 -33
  10. package/src/blocks/embed/component-info.js +44 -0
  11. package/src/blocks/embed/embed.js +43 -0
  12. package/src/blocks/embed/helpers.js +9 -0
  13. package/src/blocks/form/component-info.js +262 -0
  14. package/src/blocks/form/form.js +224 -0
  15. package/src/blocks/fragment/component-info.js +11 -0
  16. package/src/blocks/fragment/fragment.js +8 -0
  17. package/src/blocks/image/component-info.js +151 -0
  18. package/src/blocks/image/image.helpers.js +48 -0
  19. package/src/blocks/image/image.js +40 -0
  20. package/src/blocks/img/component-info.js +20 -0
  21. package/src/blocks/img/img.js +36 -0
  22. package/src/blocks/input/component-info.js +74 -0
  23. package/src/blocks/input/input.js +36 -0
  24. package/src/blocks/raw-text/component-info.js +16 -0
  25. package/src/blocks/raw-text/raw-text.js +10 -0
  26. package/src/blocks/section/component-info.js +49 -0
  27. package/src/blocks/section/section.js +31 -0
  28. package/src/blocks/select/component-info.js +59 -0
  29. package/src/blocks/select/select.js +36 -0
  30. package/src/blocks/submit-button/component-info.js +28 -0
  31. package/src/blocks/submit-button/submit-button.js +29 -0
  32. package/src/blocks/symbol/component-info.js +43 -0
  33. package/src/blocks/symbol/symbol.js +69 -0
  34. package/src/blocks/{text.js → text/component-info.js} +4 -11
  35. package/src/blocks/text/text.js +64 -0
  36. package/src/blocks/textarea/component-info.js +47 -0
  37. package/src/blocks/textarea/textarea.js +32 -0
  38. package/src/blocks/util.js +7 -0
  39. package/src/blocks/video/component-info.js +106 -0
  40. package/src/blocks/video/video.js +32 -0
  41. package/src/components/render-block/block-styles.js +37 -0
  42. package/src/components/render-block/render-block.helpers.js +23 -0
  43. package/src/components/render-block/render-block.js +171 -0
  44. package/src/components/render-block/render-component.js +35 -0
  45. package/src/components/render-block/render-repeated-block.js +30 -0
  46. package/src/components/render-block/types.js +0 -0
  47. package/src/components/render-blocks.js +29 -13
  48. package/src/components/render-content/components/render-styles.js +58 -0
  49. package/src/components/render-content/index.js +4 -0
  50. package/src/components/render-content/render-content.js +277 -0
  51. package/src/components/render-inlined-styles.js +18 -0
  52. package/src/constants/builder-registered-components.js +42 -0
  53. package/src/constants/device-sizes.js +3 -22
  54. package/src/constants/target.js +4 -0
  55. package/src/context/builder.context.js +7 -1
  56. package/src/functions/camel-to-kebab-case.js +4 -0
  57. package/src/functions/convert-style-object.js +6 -0
  58. package/src/functions/evaluate.js +17 -9
  59. package/src/functions/event-handler-name.js +7 -0
  60. package/src/functions/get-block-actions.js +14 -14
  61. package/src/functions/get-block-component-options.js +22 -2
  62. package/src/functions/get-block-properties.js +2 -4
  63. package/src/functions/get-block-styles.js +9 -28
  64. package/src/functions/get-block-tag.js +1 -2
  65. package/src/functions/get-builder-search-params/fn.test.js +13 -0
  66. package/src/functions/get-builder-search-params/index.js +33 -0
  67. package/src/functions/get-content/ab-testing.js +38 -0
  68. package/src/functions/get-content/fn.test.js +31 -0
  69. package/src/functions/get-content/index.js +96 -0
  70. package/src/functions/get-content/types.js +0 -0
  71. package/src/functions/get-fetch.js +34 -0
  72. package/src/functions/get-global-this.js +18 -0
  73. package/src/functions/get-processed-block.js +22 -10
  74. package/src/functions/get-processed-block.test.js +14 -9
  75. package/src/functions/if-target.js +11 -3
  76. package/src/functions/is-browser.js +1 -3
  77. package/src/functions/is-editing.js +1 -2
  78. package/src/functions/is-iframe.js +1 -2
  79. package/src/functions/is-previewing.js +14 -0
  80. package/src/functions/is-react-native.js +1 -2
  81. package/src/functions/on-change.js +0 -1
  82. package/src/functions/on-change.test.js +1 -3
  83. package/src/functions/register-component.js +46 -27
  84. package/src/functions/register.js +29 -0
  85. package/src/functions/sanitize-styles.js +32 -0
  86. package/src/functions/set-editor-settings.js +15 -0
  87. package/src/functions/set.js +0 -1
  88. package/src/functions/set.test.js +1 -3
  89. package/src/functions/track.js +109 -13
  90. package/src/functions/transform-block.js +37 -0
  91. package/src/helpers/cookie.js +59 -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 +26 -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 -24
  105. package/src/scripts/init-editing.js +73 -51
  106. package/src/types/builder-block.js +0 -1
  107. package/src/types/builder-content.js +0 -1
  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
  114. package/index.js +0 -11
  115. package/src/blocks/button.js +0 -37
  116. package/src/blocks/button.lite.tsx +0 -29
  117. package/src/blocks/columns.js +0 -42
  118. package/src/blocks/columns.lite.tsx +0 -41
  119. package/src/blocks/custom-code.js +0 -56
  120. package/src/blocks/embed.js +0 -56
  121. package/src/blocks/embed.lite.tsx +0 -65
  122. package/src/blocks/form.js +0 -229
  123. package/src/blocks/form.lite.tsx +0 -257
  124. package/src/blocks/image.js +0 -123
  125. package/src/blocks/image.lite.tsx +0 -35
  126. package/src/blocks/img.js +0 -41
  127. package/src/blocks/img.lite.tsx +0 -19
  128. package/src/blocks/input.js +0 -41
  129. package/src/blocks/input.lite.tsx +0 -23
  130. package/src/blocks/raw-text.js +0 -17
  131. package/src/blocks/raw-text.lite.tsx +0 -12
  132. package/src/blocks/section.js +0 -36
  133. package/src/blocks/section.lite.tsx +0 -20
  134. package/src/blocks/select.js +0 -40
  135. package/src/blocks/select.lite.tsx +0 -24
  136. package/src/blocks/submit-button.js +0 -34
  137. package/src/blocks/submit-button.lite.tsx +0 -11
  138. package/src/blocks/symbol.js +0 -20
  139. package/src/blocks/symbol.lite.tsx +0 -20
  140. package/src/blocks/text.lite.tsx +0 -12
  141. package/src/blocks/textarea.js +0 -37
  142. package/src/blocks/textarea.lite.tsx +0 -15
  143. package/src/blocks/video.js +0 -49
  144. package/src/blocks/video.lite.tsx +0 -28
  145. package/src/components/render-block.js +0 -84
  146. package/src/components/render-block.lite.tsx +0 -92
  147. package/src/components/render-blocks.lite.tsx +0 -56
  148. package/src/components/render-content.js +0 -66
  149. package/src/components/render-content.lite.tsx +0 -95
  150. package/src/functions/get-content.js +0 -103
  151. package/src/functions/get-target.js +0 -7
  152. package/src/functions/macro-eval.js +0 -6
  153. package/src/package.json +0 -18
@@ -1,103 +0,0 @@
1
- import * as React from 'react';
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
40
- };
41
- import { isBrowser } from "./is-browser";
42
- import { isReactNative } from "./is-react-native";
43
- if (!(isBrowser() || isReactNative())) {
44
- import("node-fetch");
45
- }
46
- function getContent(options) {
47
- return __async(this, null, function* () {
48
- return (yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }))).results[0] || null;
49
- });
50
- }
51
- function getAllContent(options) {
52
- return __async(this, null, function* () {
53
- const { model, apiKey } = options;
54
- const { limit, testGroups, userAttributes } = __spreadValues({
55
- limit: 1,
56
- userAttributes: null,
57
- testGroups: null
58
- }, options);
59
- const content = yield fetch(`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&userAttributes=${JSON.stringify(userAttributes)}`).then((res) => res.json());
60
- if (testGroups) {
61
- for (const item of content) {
62
- if (item.variations && Object.keys(item.variations).length) {
63
- const testGroup = testGroups[item.id];
64
- const variationValue = item.variations[testGroup];
65
- if (testGroup && variationValue) {
66
- item.data = variationValue.data;
67
- item.testVariationId = variationValue.id;
68
- item.testVariationName = variationValue.name;
69
- } else {
70
- let n = 0;
71
- const random = Math.random();
72
- let set = false;
73
- for (const id in item.variations) {
74
- const variation = item.variations[id];
75
- const testRatio = variation.testRatio;
76
- n += testRatio;
77
- if (random < n) {
78
- const variationName = variation.name || (variation.id === item.id ? "Default variation" : "");
79
- set = true;
80
- Object.assign(item, {
81
- data: variation.data,
82
- testVariationId: variation.id,
83
- testVariationName: variationName
84
- });
85
- }
86
- }
87
- if (!set) {
88
- Object.assign(item, {
89
- testVariationId: item.id,
90
- testVariationName: "Default"
91
- });
92
- }
93
- }
94
- }
95
- }
96
- }
97
- return content;
98
- });
99
- }
100
- export {
101
- getAllContent,
102
- getContent
103
- };
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- function getTarget() {
3
- return "reactNative";
4
- }
5
- export {
6
- getTarget
7
- };
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- function macroEval(items, string) {
3
- }
4
- export {
5
- macroEval
6
- };
package/src/package.json DELETED
@@ -1,18 +0,0 @@
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
- }