@builder.io/sdk-react-nextjs 0.5.8 → 0.6.0
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.
- package/lib/browser/USE_CLIENT_BUNDLE-29f9ac5c.js +23 -0
- package/lib/browser/USE_CLIENT_BUNDLE-dfa97c43.mjs +664 -0
- package/lib/browser/USE_SERVER_BUNDLE-25e181fa.js +1 -0
- package/lib/browser/USE_SERVER_BUNDLE-fcd44ecb.mjs +11 -0
- package/lib/browser/bundle-5cab6113.js +76 -0
- package/lib/browser/bundle-babbd573.mjs +2419 -0
- package/lib/browser/index.cjs +1 -0
- package/lib/browser/index.mjs +34 -0
- package/lib/edge/USE_CLIENT_BUNDLE-3cbb02d5.mjs +664 -0
- package/lib/edge/USE_CLIENT_BUNDLE-d0b99f60.js +23 -0
- package/lib/edge/USE_SERVER_BUNDLE-4eeb4634.mjs +11 -0
- package/lib/edge/USE_SERVER_BUNDLE-bbd89085.js +1 -0
- package/lib/edge/bundle-9ed99f98.mjs +4863 -0
- package/lib/edge/bundle-e4764e2a.js +96 -0
- package/lib/edge/index.cjs +1 -0
- package/lib/edge/index.mjs +34 -0
- package/lib/node/USE_CLIENT_BUNDLE-29f9ac5c.js +23 -0
- package/lib/node/USE_CLIENT_BUNDLE-dfa97c43.mjs +664 -0
- package/lib/node/USE_SERVER_BUNDLE-25e181fa.js +1 -0
- package/lib/node/USE_SERVER_BUNDLE-fcd44ecb.mjs +11 -0
- package/lib/node/bundle-5cab6113.js +76 -0
- package/lib/node/bundle-babbd573.mjs +2419 -0
- package/lib/node/index.cjs +1 -0
- package/lib/node/index.mjs +34 -0
- package/package.json +96 -13
- package/{dist → types}/components/content/content.types.d.ts +2 -2
- package/{dist → types}/components/content-variants/content-variants.d.ts +2 -2
- package/{dist → types}/components/content-variants/content-variants.types.d.ts +1 -1
- package/types/constants/sdk-version.d.ts +1 -0
- package/types/functions/deopt.d.ts +4 -0
- package/types/functions/evaluate/browser-runtime/browser.d.ts +4 -0
- package/types/functions/evaluate/browser-runtime/index.d.ts +1 -0
- package/types/functions/evaluate/evaluate.d.ts +6 -0
- package/types/functions/evaluate/helpers.d.ts +18 -0
- package/types/functions/evaluate/index.d.ts +1 -0
- package/{dist → types}/functions/fetch-builder-props.d.ts +4 -3
- package/{dist → types}/functions/get-content/index.d.ts +4 -5
- package/{dist → types}/index-helpers/blocks-exports.d.ts +2 -2
- package/types/index.d.ts +7 -0
- package/{dist/index.d.ts → types/server-index.d.ts} +0 -1
- package/dist/blocks/button/button.js +0 -12
- package/dist/blocks/button/component-info.js +0 -34
- package/dist/blocks/columns/columns.js +0 -119
- package/dist/blocks/columns/component-info.js +0 -219
- package/dist/blocks/custom-code/component-info.js +0 -23
- package/dist/blocks/custom-code/custom-code.js +0 -51
- package/dist/blocks/embed/component-info.js +0 -39
- package/dist/blocks/embed/embed.js +0 -42
- package/dist/blocks/embed/helpers.js +0 -2
- package/dist/blocks/fragment/component-info.js +0 -7
- package/dist/blocks/fragment/fragment.js +0 -6
- package/dist/blocks/helpers.js +0 -40
- package/dist/blocks/image/component-info.js +0 -122
- package/dist/blocks/image/image.helpers.js +0 -47
- package/dist/blocks/image/image.js +0 -82
- package/dist/blocks/img/component-info.js +0 -15
- package/dist/blocks/img/img.js +0 -10
- package/dist/blocks/section/component-info.js +0 -40
- package/dist/blocks/section/section.js +0 -17
- package/dist/blocks/symbol/component-info.js +0 -34
- package/dist/blocks/symbol/symbol.helpers.js +0 -31
- package/dist/blocks/symbol/symbol.js +0 -29
- package/dist/blocks/text/component-info.js +0 -19
- package/dist/blocks/text/text.js +0 -7
- package/dist/blocks/video/component-info.js +0 -82
- package/dist/blocks/video/video.js +0 -50
- package/dist/components/block/block.helpers.js +0 -69
- package/dist/components/block/block.js +0 -92
- package/dist/components/block/components/block-styles.js +0 -65
- package/dist/components/block/components/block-wrapper.js +0 -36
- package/dist/components/block/components/component-ref/component-ref.helpers.js +0 -22
- package/dist/components/block/components/component-ref/component-ref.js +0 -21
- package/dist/components/block/components/interactive-element.js +0 -20
- package/dist/components/block/components/repeated-block.js +0 -7
- package/dist/components/block/types.js +0 -1
- package/dist/components/blocks/blocks-wrapper.js +0 -38
- package/dist/components/blocks/blocks.js +0 -10
- package/dist/components/content/components/enable-editor.js +0 -250
- package/dist/components/content/components/styles.helpers.js +0 -58
- package/dist/components/content/components/styles.js +0 -30
- package/dist/components/content/content.helpers.js +0 -30
- package/dist/components/content/content.js +0 -74
- package/dist/components/content/content.types.js +0 -1
- package/dist/components/content/wrap-component-ref.js +0 -6
- package/dist/components/content-variants/content-variants.js +0 -45
- package/dist/components/content-variants/content-variants.types.js +0 -1
- package/dist/components/content-variants/helpers.js +0 -189
- package/dist/components/inlined-script.js +0 -5
- package/dist/components/inlined-styles.js +0 -5
- package/dist/constants/builder-registered-components.js +0 -60
- package/dist/constants/device-sizes.js +0 -45
- package/dist/constants/sdk-version.d.ts +0 -1
- package/dist/constants/sdk-version.js +0 -1
- package/dist/constants/target.js +0 -2
- package/dist/context/builder.context.js +0 -12
- package/dist/context/components.context.js +0 -2
- package/dist/context/types.js +0 -1
- package/dist/functions/camel-to-kebab-case.js +0 -1
- package/dist/functions/evaluate/acorn-interpreter.d.ts +0 -2
- package/dist/functions/evaluate/acorn-interpreter.js +0 -3111
- package/dist/functions/evaluate/evaluate.d.ts +0 -10
- package/dist/functions/evaluate/evaluate.js +0 -70
- package/dist/functions/evaluate/index.d.ts +0 -1
- package/dist/functions/evaluate/index.js +0 -1
- package/dist/functions/evaluate/non-node-runtime/index.d.ts +0 -1
- package/dist/functions/evaluate/non-node-runtime/index.js +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -84
- package/dist/functions/evaluate/types.d.ts +0 -11
- package/dist/functions/evaluate/types.js +0 -1
- package/dist/functions/event-handler-name.js +0 -4
- package/dist/functions/extract-text-styles.js +0 -22
- package/dist/functions/fast-clone.js +0 -4
- package/dist/functions/fetch-builder-props.js +0 -25
- package/dist/functions/get-block-actions-handler.js +0 -10
- package/dist/functions/get-block-actions.js +0 -28
- package/dist/functions/get-block-component-options.js +0 -10
- package/dist/functions/get-block-properties.js +0 -72
- package/dist/functions/get-builder-search-params/index.js +0 -38
- package/dist/functions/get-content/generate-content-url.js +0 -33
- package/dist/functions/get-content/index.js +0 -100
- package/dist/functions/get-content/types.js +0 -1
- package/dist/functions/get-fetch.js +0 -11
- package/dist/functions/get-global-this.js +0 -15
- package/dist/functions/get-processed-block.js +0 -46
- package/dist/functions/get-react-native-block-styles.js +0 -17
- package/dist/functions/is-browser.js +0 -3
- package/dist/functions/is-editing.js +0 -5
- package/dist/functions/is-iframe.js +0 -4
- package/dist/functions/is-non-node-server.d.ts +0 -4
- package/dist/functions/is-non-node-server.js +0 -8
- package/dist/functions/is-previewing.js +0 -11
- package/dist/functions/register-component.js +0 -38
- package/dist/functions/register.js +0 -27
- package/dist/functions/sanitize-react-native-block-styles.js +0 -61
- package/dist/functions/set-editor-settings.js +0 -12
- package/dist/functions/set.js +0 -14
- package/dist/functions/track/helpers.js +0 -51
- package/dist/functions/track/index.js +0 -71
- package/dist/functions/track/interaction.js +0 -53
- package/dist/functions/transform-block-properties.js +0 -5
- package/dist/functions/transform-block.js +0 -4
- package/dist/helpers/ab-tests.js +0 -122
- package/dist/helpers/canTrack.js +0 -2
- package/dist/helpers/cookie.js +0 -55
- package/dist/helpers/css.js +0 -27
- package/dist/helpers/flatten.js +0 -19
- package/dist/helpers/localStorage.js +0 -24
- package/dist/helpers/logger.js +0 -7
- package/dist/helpers/nullable.js +0 -1
- package/dist/helpers/preview-lru-cache/get.js +0 -9
- package/dist/helpers/preview-lru-cache/helpers.js +0 -9
- package/dist/helpers/preview-lru-cache/init.js +0 -15
- package/dist/helpers/preview-lru-cache/set.js +0 -7
- package/dist/helpers/preview-lru-cache/types.js +0 -6
- package/dist/helpers/sessionId.js +0 -30
- package/dist/helpers/url.js +0 -15
- package/dist/helpers/uuid.js +0 -15
- package/dist/helpers/visitorId.js +0 -30
- package/dist/index-helpers/blocks-exports.js +0 -19
- package/dist/index-helpers/top-of-file.js +0 -4
- package/dist/index.js +0 -11
- package/dist/scripts/init-editing.js +0 -110
- package/dist/types/api-version.js +0 -1
- package/dist/types/builder-block.js +0 -1
- package/dist/types/builder-content.js +0 -1
- package/dist/types/builder-props.js +0 -1
- package/dist/types/can-track.js +0 -1
- package/dist/types/components.js +0 -1
- package/dist/types/deep-partial.js +0 -1
- package/dist/types/element.js +0 -1
- package/dist/types/enforced-partials.js +0 -1
- package/dist/types/input.js +0 -1
- package/dist/types/targets.js +0 -1
- package/dist/types/typescript.js +0 -1
- /package/{dist → types}/blocks/button/button.d.ts +0 -0
- /package/{dist → types}/blocks/button/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/columns/columns.d.ts +0 -0
- /package/{dist → types}/blocks/columns/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/custom-code.d.ts +0 -0
- /package/{dist → types}/blocks/embed/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/embed/embed.d.ts +0 -0
- /package/{dist → types}/blocks/embed/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/fragment.d.ts +0 -0
- /package/{dist → types}/blocks/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/image/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/img/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/img/img.d.ts +0 -0
- /package/{dist → types}/blocks/section/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/section/section.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/text/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/text/text.d.ts +0 -0
- /package/{dist → types}/blocks/video/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/video/video.d.ts +0 -0
- /package/{dist → types}/components/block/block.d.ts +0 -0
- /package/{dist → types}/components/block/block.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-styles.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-wrapper.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/interactive-element.d.ts +0 -0
- /package/{dist → types}/components/block/components/repeated-block.d.ts +0 -0
- /package/{dist → types}/components/block/types.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks-wrapper.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks.d.ts +0 -0
- /package/{dist → types}/components/content/components/enable-editor.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/content.d.ts +0 -0
- /package/{dist → types}/components/content/content.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/wrap-component-ref.d.ts +0 -0
- /package/{dist → types}/components/content-variants/helpers.d.ts +0 -0
- /package/{dist → types}/components/inlined-script.d.ts +0 -0
- /package/{dist → types}/components/inlined-styles.d.ts +0 -0
- /package/{dist → types}/constants/builder-registered-components.d.ts +0 -0
- /package/{dist → types}/constants/device-sizes.d.ts +0 -0
- /package/{dist → types}/constants/target.d.ts +0 -0
- /package/{dist → types}/context/builder.context.d.ts +0 -0
- /package/{dist → types}/context/components.context.d.ts +0 -0
- /package/{dist → types}/context/types.d.ts +0 -0
- /package/{dist → types}/functions/camel-to-kebab-case.d.ts +0 -0
- /package/{dist → types}/functions/event-handler-name.d.ts +0 -0
- /package/{dist → types}/functions/extract-text-styles.d.ts +0 -0
- /package/{dist → types}/functions/fast-clone.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions-handler.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions.d.ts +0 -0
- /package/{dist → types}/functions/get-block-component-options.d.ts +0 -0
- /package/{dist → types}/functions/get-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/get-builder-search-params/index.d.ts +0 -0
- /package/{dist → types}/functions/get-content/generate-content-url.d.ts +0 -0
- /package/{dist → types}/functions/get-content/types.d.ts +0 -0
- /package/{dist → types}/functions/get-fetch.d.ts +0 -0
- /package/{dist → types}/functions/get-global-this.d.ts +0 -0
- /package/{dist → types}/functions/get-processed-block.d.ts +0 -0
- /package/{dist → types}/functions/get-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/is-browser.d.ts +0 -0
- /package/{dist → types}/functions/is-editing.d.ts +0 -0
- /package/{dist → types}/functions/is-iframe.d.ts +0 -0
- /package/{dist → types}/functions/is-previewing.d.ts +0 -0
- /package/{dist → types}/functions/register-component.d.ts +0 -0
- /package/{dist → types}/functions/register.d.ts +0 -0
- /package/{dist → types}/functions/sanitize-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/set-editor-settings.d.ts +0 -0
- /package/{dist → types}/functions/set.d.ts +0 -0
- /package/{dist → types}/functions/track/helpers.d.ts +0 -0
- /package/{dist → types}/functions/track/index.d.ts +0 -0
- /package/{dist → types}/functions/track/interaction.d.ts +0 -0
- /package/{dist → types}/functions/transform-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/transform-block.d.ts +0 -0
- /package/{dist → types}/helpers/ab-tests.d.ts +0 -0
- /package/{dist → types}/helpers/canTrack.d.ts +0 -0
- /package/{dist → types}/helpers/cookie.d.ts +0 -0
- /package/{dist → types}/helpers/css.d.ts +0 -0
- /package/{dist → types}/helpers/flatten.d.ts +0 -0
- /package/{dist → types}/helpers/localStorage.d.ts +0 -0
- /package/{dist → types}/helpers/logger.d.ts +0 -0
- /package/{dist → types}/helpers/nullable.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/get.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/helpers.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/init.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/set.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/types.d.ts +0 -0
- /package/{dist → types}/helpers/sessionId.d.ts +0 -0
- /package/{dist → types}/helpers/url.d.ts +0 -0
- /package/{dist → types}/helpers/uuid.d.ts +0 -0
- /package/{dist → types}/helpers/visitorId.d.ts +0 -0
- /package/{dist → types}/index-helpers/top-of-file.d.ts +0 -0
- /package/{dist → types}/scripts/init-editing.d.ts +0 -0
- /package/{dist → types}/types/api-version.d.ts +0 -0
- /package/{dist → types}/types/builder-block.d.ts +0 -0
- /package/{dist → types}/types/builder-content.d.ts +0 -0
- /package/{dist → types}/types/builder-props.d.ts +0 -0
- /package/{dist → types}/types/can-track.d.ts +0 -0
- /package/{dist → types}/types/components.d.ts +0 -0
- /package/{dist → types}/types/deep-partial.d.ts +0 -0
- /package/{dist → types}/types/element.d.ts +0 -0
- /package/{dist → types}/types/enforced-partials.d.ts +0 -0
- /package/{dist → types}/types/input.d.ts +0 -0
- /package/{dist → types}/types/targets.d.ts +0 -0
- /package/{dist → types}/types/typescript.d.ts +0 -0
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { logger } from '../logger';
|
|
2
|
-
export const getIdFromSearchParams = (searchParams) => {
|
|
3
|
-
const previewedModel = searchParams.get('preview');
|
|
4
|
-
const previewedId = searchParams.get('overrides.' + previewedModel);
|
|
5
|
-
if (!previewedId) {
|
|
6
|
-
logger.warn('No previewed ID found in search params.');
|
|
7
|
-
}
|
|
8
|
-
return previewedId;
|
|
9
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is an LRU cache to hold preview content on the server-side.
|
|
3
|
-
*
|
|
4
|
-
* Note: This logic is only used by the NextJS SDK.
|
|
5
|
-
*/
|
|
6
|
-
import { LRUCache } from 'lru-cache';
|
|
7
|
-
export function init() {
|
|
8
|
-
if (!globalThis._BUILDER_PREVIEW_LRU_CACHE) {
|
|
9
|
-
globalThis._BUILDER_PREVIEW_LRU_CACHE = new LRUCache({
|
|
10
|
-
max: 500,
|
|
11
|
-
// how long to live in ms
|
|
12
|
-
ttl: 1000 * 60 * 5,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getCookie, setCookie } from './cookie.js';
|
|
2
|
-
import { checkIsDefined } from './nullable.js';
|
|
3
|
-
import { uuid } from './uuid.js';
|
|
4
|
-
const SESSION_LOCAL_STORAGE_KEY = 'builderSessionId';
|
|
5
|
-
export const getSessionId = async ({ canTrack }) => {
|
|
6
|
-
if (!canTrack) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const sessionId = await getCookie({
|
|
10
|
-
name: SESSION_LOCAL_STORAGE_KEY,
|
|
11
|
-
canTrack
|
|
12
|
-
});
|
|
13
|
-
if (checkIsDefined(sessionId)) {
|
|
14
|
-
return sessionId;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
const newSessionId = createSessionId();
|
|
18
|
-
setSessionId({
|
|
19
|
-
id: newSessionId,
|
|
20
|
-
canTrack
|
|
21
|
-
});
|
|
22
|
-
return newSessionId;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export const createSessionId = () => uuid();
|
|
26
|
-
export const setSessionId = ({ id, canTrack }) => setCookie({
|
|
27
|
-
name: SESSION_LOCAL_STORAGE_KEY,
|
|
28
|
-
value: id,
|
|
29
|
-
canTrack
|
|
30
|
-
});
|
package/dist/helpers/url.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Only gets one level up from hostname
|
|
3
|
-
* wwww.example.com -> example.com
|
|
4
|
-
* www.example.co.uk -> example.co.uk
|
|
5
|
-
*/
|
|
6
|
-
export const getTopLevelDomain = (host) => {
|
|
7
|
-
if (host === 'localhost' || host === '127.0.0.1') {
|
|
8
|
-
return host;
|
|
9
|
-
}
|
|
10
|
-
const parts = host.split('.');
|
|
11
|
-
if (parts.length > 2) {
|
|
12
|
-
return parts.slice(1).join('.');
|
|
13
|
-
}
|
|
14
|
-
return host;
|
|
15
|
-
};
|
package/dist/helpers/uuid.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @credit https://stackoverflow.com/a/2117523
|
|
3
|
-
*/
|
|
4
|
-
export function uuidv4() {
|
|
5
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
6
|
-
const r = Math.random() * 16 | 0, v = c == 'x' ? r : r & 0x3 | 0x8;
|
|
7
|
-
return v.toString(16);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Slightly cleaner and smaller UUIDs
|
|
12
|
-
*/
|
|
13
|
-
export function uuid() {
|
|
14
|
-
return uuidv4().replace(/-/g, '');
|
|
15
|
-
}
|
|
@@ -1,30 +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
|
-
export const getVisitorId = ({ canTrack }) => {
|
|
6
|
-
if (!canTrack) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const visitorId = getLocalStorageItem({
|
|
10
|
-
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
11
|
-
canTrack
|
|
12
|
-
});
|
|
13
|
-
if (checkIsDefined(visitorId)) {
|
|
14
|
-
return visitorId;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
const newVisitorId = createVisitorId();
|
|
18
|
-
setVisitorId({
|
|
19
|
-
id: newVisitorId,
|
|
20
|
-
canTrack
|
|
21
|
-
});
|
|
22
|
-
return newVisitorId;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export const createVisitorId = () => uuid();
|
|
26
|
-
export const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
|
|
27
|
-
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
28
|
-
value: id,
|
|
29
|
-
canTrack
|
|
30
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { default as Button } from '../blocks/button/button';
|
|
2
|
-
export { default as Columns } from '../blocks/columns/columns';
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/fragment';
|
|
4
|
-
export { default as Image } from '../blocks/image/image';
|
|
5
|
-
export { default as Section } from '../blocks/section/section';
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/symbol';
|
|
7
|
-
export { default as Text } from '../blocks/text/text';
|
|
8
|
-
export { default as Video } from '../blocks/video/video';
|
|
9
|
-
import { default as Blocks } from '../components/blocks/blocks';
|
|
10
|
-
import { default as Content } from '../components/content-variants/content-variants';
|
|
11
|
-
export { Blocks, Content };
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use `Blocks` instead.
|
|
14
|
-
*/
|
|
15
|
-
export const RenderBlocks = Blocks;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Use `Content` instead.
|
|
18
|
-
*/
|
|
19
|
-
export const RenderContent = Content;
|
package/dist/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './index-helpers/top-of-file.js';
|
|
2
|
-
export * from './index-helpers/blocks-exports.js';
|
|
3
|
-
export { isEditing } from './functions/is-editing.js';
|
|
4
|
-
export { isPreviewing } from './functions/is-previewing.js';
|
|
5
|
-
export { createRegisterComponentMessage } from './functions/register-component.js';
|
|
6
|
-
export { register } from './functions/register.js';
|
|
7
|
-
export { setEditorSettings } from './functions/set-editor-settings.js';
|
|
8
|
-
export { fetchEntries, fetchOneEntry, getAllContent, getContent, _processContentResult } from './functions/get-content/index.js';
|
|
9
|
-
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
10
|
-
export { track } from './functions/track/index.js';
|
|
11
|
-
export { fetchBuilderProps } from './functions/fetch-builder-props.js';
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { SDK_VERSION } from '../constants/sdk-version.js';
|
|
2
|
-
import { TARGET } from '../constants/target.js';
|
|
3
|
-
import { isBrowser } from '../functions/is-browser.js';
|
|
4
|
-
import { register } from '../functions/register.js';
|
|
5
|
-
export const registerInsertMenu = () => {
|
|
6
|
-
register('insertMenu', {
|
|
7
|
-
name: '_default',
|
|
8
|
-
default: true,
|
|
9
|
-
items: [{
|
|
10
|
-
name: 'Box'
|
|
11
|
-
}, {
|
|
12
|
-
name: 'Text'
|
|
13
|
-
}, {
|
|
14
|
-
name: 'Image'
|
|
15
|
-
}, {
|
|
16
|
-
name: 'Columns'
|
|
17
|
-
}, ...(TARGET === 'reactNative' ? [] : [{
|
|
18
|
-
name: 'Core:Section'
|
|
19
|
-
}, {
|
|
20
|
-
name: 'Core:Button'
|
|
21
|
-
}, {
|
|
22
|
-
name: 'Embed'
|
|
23
|
-
}, {
|
|
24
|
-
name: 'Custom Code'
|
|
25
|
-
}])]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
let isSetupForEditing = false;
|
|
29
|
-
export const setupBrowserForEditing = (options = {}) => {
|
|
30
|
-
if (isSetupForEditing) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
isSetupForEditing = true;
|
|
34
|
-
if (isBrowser()) {
|
|
35
|
-
window.parent?.postMessage({
|
|
36
|
-
type: 'builder.sdkInfo',
|
|
37
|
-
data: {
|
|
38
|
-
target: TARGET,
|
|
39
|
-
version: SDK_VERSION,
|
|
40
|
-
supportsPatchUpdates: false,
|
|
41
|
-
// Supports builder-model="..." attribute which is needed to
|
|
42
|
-
// scope our '+ add block' button styling
|
|
43
|
-
supportsAddBlockScoping: true,
|
|
44
|
-
supportsCustomBreakpoints: true
|
|
45
|
-
}
|
|
46
|
-
}, '*');
|
|
47
|
-
window.parent?.postMessage({
|
|
48
|
-
type: 'builder.updateContent',
|
|
49
|
-
data: {
|
|
50
|
-
options
|
|
51
|
-
}
|
|
52
|
-
}, '*');
|
|
53
|
-
window.addEventListener('message', ({ data }) => {
|
|
54
|
-
if (!data?.type) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
switch (data.type) {
|
|
58
|
-
case 'builder.evaluate':
|
|
59
|
-
{
|
|
60
|
-
const text = data.data.text;
|
|
61
|
-
const args = data.data.arguments || [];
|
|
62
|
-
const id = data.data.id;
|
|
63
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
64
|
-
const fn = new Function(text);
|
|
65
|
-
let result;
|
|
66
|
-
let error = null;
|
|
67
|
-
try {
|
|
68
|
-
// eslint-disable-next-line prefer-spread
|
|
69
|
-
result = fn.apply(null, args);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
error = err;
|
|
73
|
-
}
|
|
74
|
-
if (error) {
|
|
75
|
-
window.parent?.postMessage({
|
|
76
|
-
type: 'builder.evaluateError',
|
|
77
|
-
data: {
|
|
78
|
-
id,
|
|
79
|
-
error: error.message
|
|
80
|
-
}
|
|
81
|
-
}, '*');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (result && typeof result.then === 'function') {
|
|
85
|
-
result.then(finalResult => {
|
|
86
|
-
window.parent?.postMessage({
|
|
87
|
-
type: 'builder.evaluateResult',
|
|
88
|
-
data: {
|
|
89
|
-
id,
|
|
90
|
-
result: finalResult
|
|
91
|
-
}
|
|
92
|
-
}, '*');
|
|
93
|
-
}).catch(console.error);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
window.parent?.postMessage({
|
|
97
|
-
type: 'builder.evaluateResult',
|
|
98
|
-
data: {
|
|
99
|
-
result,
|
|
100
|
-
id
|
|
101
|
-
}
|
|
102
|
-
}, '*');
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_API_VERSION = 'v3';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/can-track.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/components.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/element.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/input.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/targets.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/typescript.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{dist → types}/components/block/components/component-ref/component-ref.helpers.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|