@builder.io/sdk-react-native 0.0.6-0 → 0.0.6-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 (115) hide show
  1. package/package.json +3 -3
  2. package/src/blocks/button/button.js +0 -34
  3. package/src/blocks/button/component-info.js +0 -41
  4. package/src/blocks/columns/columns.js +0 -62
  5. package/src/blocks/columns/component-info.js +0 -242
  6. package/src/blocks/custom-code/component-info.js +0 -31
  7. package/src/blocks/custom-code/custom-code.js +0 -50
  8. package/src/blocks/embed/component-info.js +0 -44
  9. package/src/blocks/embed/embed.js +0 -43
  10. package/src/blocks/embed/helpers.js +0 -9
  11. package/src/blocks/form/component-info.js +0 -262
  12. package/src/blocks/form/form.js +0 -224
  13. package/src/blocks/fragment/component-info.js +0 -11
  14. package/src/blocks/fragment/fragment.js +0 -8
  15. package/src/blocks/image/component-info.js +0 -151
  16. package/src/blocks/image/image.helpers.js +0 -48
  17. package/src/blocks/image/image.js +0 -41
  18. package/src/blocks/img/component-info.js +0 -20
  19. package/src/blocks/img/img.js +0 -36
  20. package/src/blocks/input/component-info.js +0 -74
  21. package/src/blocks/input/input.js +0 -36
  22. package/src/blocks/raw-text/component-info.js +0 -16
  23. package/src/blocks/raw-text/raw-text.js +0 -10
  24. package/src/blocks/section/component-info.js +0 -49
  25. package/src/blocks/section/section.js +0 -31
  26. package/src/blocks/select/component-info.js +0 -59
  27. package/src/blocks/select/select.js +0 -36
  28. package/src/blocks/submit-button/component-info.js +0 -28
  29. package/src/blocks/submit-button/submit-button.js +0 -29
  30. package/src/blocks/symbol/component-info.js +0 -43
  31. package/src/blocks/symbol/symbol.js +0 -65
  32. package/src/blocks/text/component-info.js +0 -24
  33. package/src/blocks/text/text.js +0 -65
  34. package/src/blocks/textarea/component-info.js +0 -47
  35. package/src/blocks/textarea/textarea.js +0 -32
  36. package/src/blocks/util.js +0 -7
  37. package/src/blocks/video/component-info.js +0 -106
  38. package/src/blocks/video/video.js +0 -52
  39. package/src/components/render-block/block-styles.js +0 -37
  40. package/src/components/render-block/render-block.helpers.js +0 -23
  41. package/src/components/render-block/render-block.js +0 -171
  42. package/src/components/render-block/render-component.js +0 -36
  43. package/src/components/render-block/render-repeated-block.js +0 -30
  44. package/src/components/render-block/types.js +0 -0
  45. package/src/components/render-blocks.js +0 -63
  46. package/src/components/render-content/components/render-styles.js +0 -58
  47. package/src/components/render-content/index.js +0 -4
  48. package/src/components/render-content/render-content.js +0 -262
  49. package/src/components/render-inlined-styles.js +0 -18
  50. package/src/constants/builder-registered-components.js +0 -42
  51. package/src/constants/device-sizes.js +0 -21
  52. package/src/constants/target.js +0 -4
  53. package/src/context/builder.context.js +0 -11
  54. package/src/context/types.js +0 -0
  55. package/src/functions/camel-to-kebab-case.js +0 -4
  56. package/src/functions/convert-style-object.js +0 -6
  57. package/src/functions/evaluate.js +0 -28
  58. package/src/functions/event-handler-name.js +0 -7
  59. package/src/functions/get-block-actions.js +0 -23
  60. package/src/functions/get-block-component-options.js +0 -28
  61. package/src/functions/get-block-properties.js +0 -41
  62. package/src/functions/get-block-styles.js +0 -44
  63. package/src/functions/get-block-tag.js +0 -7
  64. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  65. package/src/functions/get-builder-search-params/index.js +0 -37
  66. package/src/functions/get-content/ab-testing.js +0 -84
  67. package/src/functions/get-content/fn.test.js +0 -31
  68. package/src/functions/get-content/index.js +0 -93
  69. package/src/functions/get-content/types.js +0 -0
  70. package/src/functions/get-fetch.js +0 -34
  71. package/src/functions/get-global-this.js +0 -18
  72. package/src/functions/get-processed-block.js +0 -57
  73. package/src/functions/get-processed-block.test.js +0 -32
  74. package/src/functions/if-target.js +0 -15
  75. package/src/functions/is-browser.js +0 -6
  76. package/src/functions/is-editing.js +0 -7
  77. package/src/functions/is-iframe.js +0 -7
  78. package/src/functions/is-previewing.js +0 -14
  79. package/src/functions/mark-mutable.js +0 -10
  80. package/src/functions/on-change.js +0 -27
  81. package/src/functions/on-change.test.js +0 -19
  82. package/src/functions/register-component.js +0 -72
  83. package/src/functions/register.js +0 -29
  84. package/src/functions/sanitize-styles.js +0 -62
  85. package/src/functions/set-editor-settings.js +0 -15
  86. package/src/functions/set.js +0 -11
  87. package/src/functions/set.test.js +0 -16
  88. package/src/functions/track.js +0 -118
  89. package/src/functions/transform-block.js +0 -37
  90. package/src/helpers/ab-tests.js +0 -18
  91. package/src/helpers/cookie.js +0 -57
  92. package/src/helpers/css.js +0 -12
  93. package/src/helpers/document-cookie.js +0 -0
  94. package/src/helpers/flatten.js +0 -34
  95. package/src/helpers/localStorage.js +0 -34
  96. package/src/helpers/nullable.js +0 -4
  97. package/src/helpers/sessionId.js +0 -51
  98. package/src/helpers/storage.js +0 -37
  99. package/src/helpers/time.js +0 -5
  100. package/src/helpers/url.js +0 -10
  101. package/src/helpers/url.test.js +0 -15
  102. package/src/helpers/uuid.js +0 -13
  103. package/src/helpers/visitorId.js +0 -33
  104. package/src/index-helpers/blocks-exports.js +0 -18
  105. package/src/index-helpers/top-of-file.js +0 -1
  106. package/src/index.js +0 -10
  107. package/src/scripts/init-editing.js +0 -79
  108. package/src/types/builder-block.js +0 -0
  109. package/src/types/builder-content.js +0 -0
  110. package/src/types/can-track.js +0 -0
  111. package/src/types/components.js +0 -0
  112. package/src/types/deep-partial.js +0 -0
  113. package/src/types/element.js +0 -0
  114. package/src/types/targets.js +0 -0
  115. package/src/types/typescript.js +0 -0
@@ -1,15 +0,0 @@
1
- import { isBrowser } from "./is-browser.js";
2
- const settings = {};
3
- function setEditorSettings(newSettings) {
4
- if (isBrowser()) {
5
- Object.assign(settings, newSettings);
6
- const message = {
7
- type: "builder.settingsChange",
8
- data: settings
9
- };
10
- parent.postMessage(message, "*");
11
- }
12
- }
13
- export {
14
- setEditorSettings
15
- };
@@ -1,11 +0,0 @@
1
- const set = (obj, _path, value) => {
2
- if (Object(obj) !== obj) {
3
- return obj;
4
- }
5
- const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
6
- path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
7
- return obj;
8
- };
9
- export {
10
- set
11
- };
@@ -1,16 +0,0 @@
1
- import { set } from "./set.js";
2
- test("can shallow set a property", () => {
3
- const obj = { foo: "bar" };
4
- set(obj, "foo", "baz");
5
- expect(obj.foo).toBe("baz");
6
- });
7
- test("can deeply set a property", () => {
8
- const obj = { foo: "bar" };
9
- set(obj, "foo.bar", "baz");
10
- expect(obj.foo.bar).toBe("baz");
11
- });
12
- test("can deeply create arrays", () => {
13
- const obj = { foo: "bar" };
14
- set(obj, "foo.bar.0", "hi");
15
- expect(obj.foo.bar).toEqual(["hi"]);
16
- });
@@ -1,118 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __async = (__this, __arguments, generator) => {
33
- return new Promise((resolve, reject) => {
34
- var fulfilled = (value) => {
35
- try {
36
- step(generator.next(value));
37
- } catch (e) {
38
- reject(e);
39
- }
40
- };
41
- var rejected = (value) => {
42
- try {
43
- step(generator.throw(value));
44
- } catch (e) {
45
- reject(e);
46
- }
47
- };
48
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
- step((generator = generator.apply(__this, __arguments)).next());
50
- });
51
- };
52
- import { TARGET } from "../constants/target.js";
53
- import { getSessionId } from "../helpers/sessionId.js";
54
- import { getVisitorId } from "../helpers/visitorId.js";
55
- import { isBrowser } from "./is-browser.js";
56
- import { isEditing } from "./is-editing.js";
57
- const getTrackingEventData = (_0) => __async(void 0, [_0], function* ({
58
- canTrack,
59
- orgId
60
- }) {
61
- if (!canTrack) {
62
- return { visitorId: void 0, sessionId: void 0 };
63
- }
64
- const sessionId = yield getSessionId({ canTrack, orgId });
65
- const visitorId = getVisitorId({ canTrack });
66
- return {
67
- sessionId,
68
- visitorId
69
- };
70
- });
71
- const createEvent = (_a) => __async(void 0, null, function* () {
72
- var _b = _a, {
73
- type: eventType,
74
- canTrack,
75
- orgId,
76
- contentId
77
- } = _b, properties = __objRest(_b, [
78
- "type",
79
- "canTrack",
80
- "orgId",
81
- "contentId"
82
- ]);
83
- return {
84
- type: eventType,
85
- data: __spreadProps(__spreadValues(__spreadValues({}, properties), yield getTrackingEventData({ canTrack, orgId })), {
86
- ownerId: orgId,
87
- contentId
88
- })
89
- };
90
- });
91
- function track(eventProps) {
92
- return __async(this, null, function* () {
93
- if (!eventProps.canTrack) {
94
- return;
95
- }
96
- if (isEditing()) {
97
- return;
98
- }
99
- if (!(isBrowser() || TARGET === "reactNative")) {
100
- return;
101
- }
102
- return fetch(`https://builder.io/api/v1/track`, {
103
- method: "POST",
104
- body: JSON.stringify({
105
- events: [yield createEvent(eventProps)]
106
- }),
107
- headers: {
108
- "content-type": "application/json"
109
- },
110
- mode: "cors"
111
- }).catch((err) => {
112
- console.error("Failed to track: ", err);
113
- });
114
- });
115
- }
116
- export {
117
- track
118
- };
@@ -1,37 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- function transformBlock(block) {
21
- if (block.id.startsWith("builder-pixel-") && !block.component) {
22
- return __spreadProps(__spreadValues({}, block), {
23
- component: {
24
- name: "Image",
25
- options: {
26
- image: block.properties.src,
27
- width: 1,
28
- height: 1
29
- }
30
- }
31
- });
32
- }
33
- return block;
34
- }
35
- export {
36
- transformBlock
37
- };
@@ -1,18 +0,0 @@
1
- import { getCookie, setCookie } from "./cookie.js";
2
- const BUILDER_STORE_PREFIX = "builder.tests";
3
- const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
4
- const getContentVariationCookie = ({
5
- contentId,
6
- canTrack,
7
- orgId
8
- }) => getCookie({ name: getContentTestKey(contentId), canTrack, orgId });
9
- const setContentVariationCookie = ({
10
- contentId,
11
- canTrack,
12
- value,
13
- orgId
14
- }) => setCookie({ name: getContentTestKey(contentId), value, canTrack, orgId });
15
- export {
16
- getContentVariationCookie,
17
- setContentVariationCookie
18
- };
@@ -1,57 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import storage from "./storage";
22
- const getCookie = (_0) => __async(void 0, [_0], function* ({
23
- name,
24
- canTrack
25
- }) {
26
- try {
27
- if (!canTrack) {
28
- return void 0;
29
- }
30
- const parsedName = name.replace(/_/g, ".");
31
- const data = yield (yield storage).load(parsedName);
32
- console.log("data", data);
33
- return data.value;
34
- } catch (err) {
35
- console.debug("[COOKIE] GET error: ", err);
36
- }
37
- });
38
- const setCookie = (_0) => __async(void 0, [_0], function* ({
39
- name,
40
- value,
41
- expires,
42
- canTrack
43
- }) {
44
- try {
45
- if (!canTrack) {
46
- return void 0;
47
- }
48
- yield (yield storage).save({ key: name, data: { value }, expires });
49
- console.log("data", yield storage);
50
- } catch (err) {
51
- console.warn("[COOKIE] SET error: ", err);
52
- }
53
- });
54
- export {
55
- getCookie,
56
- setCookie
57
- };
@@ -1,12 +0,0 @@
1
- import { camelToKebabCase } from "../functions/camel-to-kebab-case.js";
2
- const convertStyleMaptoCSS = (style) => {
3
- const cssProps = Object.entries(style).map(([key, value]) => {
4
- if (typeof value === "string") {
5
- return `${camelToKebabCase(key)}: ${value};`;
6
- }
7
- });
8
- return cssProps.join("\n");
9
- };
10
- export {
11
- convertStyleMaptoCSS
12
- };
File without changes
@@ -1,34 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- function flatten(object, path = null, separator = ".") {
21
- return Object.keys(object).reduce((acc, key) => {
22
- const value = object[key];
23
- const newPath = [path, key].filter(Boolean).join(separator);
24
- const isObject = [
25
- typeof value === "object",
26
- value !== null,
27
- !(Array.isArray(value) && value.length === 0)
28
- ].every(Boolean);
29
- return isObject ? __spreadValues(__spreadValues({}, acc), flatten(value, newPath, separator)) : __spreadProps(__spreadValues({}, acc), { [newPath]: value });
30
- }, {});
31
- }
32
- export {
33
- flatten
34
- };
@@ -1,34 +0,0 @@
1
- import { isBrowser } from "../functions/is-browser.js";
2
- const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
3
- const getLocalStorageItem = ({
4
- key,
5
- canTrack
6
- }) => {
7
- var _a;
8
- try {
9
- if (canTrack) {
10
- return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
11
- }
12
- return void 0;
13
- } catch (err) {
14
- console.debug("[LocalStorage] GET error: ", err);
15
- }
16
- };
17
- const setLocalStorageItem = ({
18
- key,
19
- canTrack,
20
- value
21
- }) => {
22
- var _a;
23
- try {
24
- if (canTrack) {
25
- (_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
26
- }
27
- } catch (err) {
28
- console.debug("[LocalStorage] SET error: ", err);
29
- }
30
- };
31
- export {
32
- getLocalStorageItem,
33
- setLocalStorageItem
34
- };
@@ -1,4 +0,0 @@
1
- const checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
2
- export {
3
- checkIsDefined
4
- };
@@ -1,51 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { getCookie, setCookie } from "./cookie.js";
22
- import { checkIsDefined } from "./nullable.js";
23
- import { uuid } from "./uuid.js";
24
- const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
25
- const getSessionId = (_0) => __async(void 0, [_0], function* ({ canTrack, orgId }) {
26
- if (!canTrack) {
27
- return void 0;
28
- }
29
- const sessionId = yield getCookie({
30
- name: SESSION_LOCAL_STORAGE_KEY,
31
- canTrack,
32
- orgId
33
- });
34
- if (checkIsDefined(sessionId)) {
35
- return sessionId;
36
- } else {
37
- const newSessionId = createSessionId();
38
- setSessionId({ id: newSessionId, canTrack, orgId });
39
- }
40
- });
41
- const createSessionId = () => uuid();
42
- const setSessionId = ({
43
- id,
44
- canTrack,
45
- orgId
46
- }) => setCookie({ name: SESSION_LOCAL_STORAGE_KEY, value: id, canTrack, orgId });
47
- export {
48
- createSessionId,
49
- getSessionId,
50
- setSessionId
51
- };
@@ -1,37 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import Storage from "react-native-storage";
22
- import { isBrowser } from "../functions/is-browser.js";
23
- const ONE_DAY = 1e3 * 60 * 60 * 24;
24
- const initStorage = () => __async(void 0, null, function* () {
25
- const backend = isBrowser() ? window.localStorage : yield import("@react-native-async-storage/async-storage");
26
- const storage = new Storage({
27
- size: 1e3,
28
- storageBackend: backend,
29
- defaultExpires: ONE_DAY * 30,
30
- enableCache: true
31
- });
32
- return storage;
33
- });
34
- var stdin_default = initStorage();
35
- export {
36
- stdin_default as default
37
- };
@@ -1,5 +0,0 @@
1
- const MINUTE_TO_MILLESECONDS_MULTIPLIER = 6e4;
2
- const getCurrentDatePlusMinutes = (minutes = 30) => new Date(Date.now() + minutes * MINUTE_TO_MILLESECONDS_MULTIPLIER);
3
- export {
4
- getCurrentDatePlusMinutes
5
- };
@@ -1,10 +0,0 @@
1
- const getTopLevelDomain = (host) => {
2
- const parts = host.split(".");
3
- if (parts.length > 2) {
4
- return parts.slice(1).join(".");
5
- }
6
- return host;
7
- };
8
- export {
9
- getTopLevelDomain
10
- };
@@ -1,15 +0,0 @@
1
- import { getTopLevelDomain } from "./url.js";
2
- describe("getTopLevelDomain", () => {
3
- test("handles root domain", () => {
4
- const output = getTopLevelDomain("example.com");
5
- expect(output).toBe("example.com");
6
- });
7
- test("handles subdomain", () => {
8
- const output = getTopLevelDomain("wwww.example.com");
9
- expect(output).toBe("example.com");
10
- });
11
- test("handles subdomain with long suffix", () => {
12
- const output = getTopLevelDomain("www.example.co.uk");
13
- expect(output).toBe("example.co.uk");
14
- });
15
- });
@@ -1,13 +0,0 @@
1
- function uuidv4() {
2
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
3
- const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
4
- return v.toString(16);
5
- });
6
- }
7
- function uuid() {
8
- return uuidv4().replace(/-/g, "");
9
- }
10
- export {
11
- uuid,
12
- uuidv4
13
- };
@@ -1,33 +0,0 @@
1
- import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
2
- import { checkIsDefined } from "./nullable.js";
3
- import { uuid } from "./uuid.js";
4
- const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
5
- const getVisitorId = ({ canTrack }) => {
6
- if (!canTrack) {
7
- return void 0;
8
- }
9
- const visitorId = getLocalStorageItem({
10
- key: VISITOR_LOCAL_STORAGE_KEY,
11
- canTrack
12
- });
13
- if (checkIsDefined(visitorId)) {
14
- return visitorId;
15
- } else {
16
- const newVisitorId = createVisitorId();
17
- setVisitorId({ id: newVisitorId, canTrack });
18
- }
19
- };
20
- const createVisitorId = () => uuid();
21
- const setVisitorId = ({
22
- id,
23
- canTrack
24
- }) => setLocalStorageItem({
25
- key: VISITOR_LOCAL_STORAGE_KEY,
26
- value: id,
27
- canTrack
28
- });
29
- export {
30
- createVisitorId,
31
- getVisitorId,
32
- setVisitorId
33
- };
@@ -1,18 +0,0 @@
1
- import { default as default2 } from "../blocks/columns/columns.js";
2
- import { default as default3 } from "../blocks/image/image.js";
3
- import { default as default4 } from "../blocks/text/text.js";
4
- import { default as default5 } from "../blocks/symbol/symbol.js";
5
- import { default as default6 } from "../blocks/button/button.js";
6
- import { default as default7 } from "../blocks/section/section.js";
7
- import { default as default8 } from "../blocks/fragment/fragment.js";
8
- import { default as default9 } from "../components/render-content/render-content.js";
9
- export {
10
- default6 as Button,
11
- default2 as Columns,
12
- default8 as Fragment,
13
- default3 as Image,
14
- default9 as RenderContent,
15
- default7 as Section,
16
- default5 as Symbol,
17
- default4 as Text
18
- };
@@ -1 +0,0 @@
1
- import "react-native-url-polyfill/auto";
package/src/index.js DELETED
@@ -1,10 +0,0 @@
1
- import "./index-helpers/top-of-file.js";
2
- import "./scripts/init-editing.js";
3
- export * from "./index-helpers/blocks-exports.js";
4
- export * from "./functions/is-editing.js";
5
- export * from "./functions/is-previewing.js";
6
- export * from "./functions/register-component.js";
7
- export * from "./functions/register.js";
8
- export * from "./functions/set-editor-settings.js";
9
- export * from "./functions/get-content/index.js";
10
- export * from "./functions/get-builder-search-params/index.js";
@@ -1,79 +0,0 @@
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