@builder.io/sdk-react-native 1.0.31-0 → 1.0.31
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/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/browser/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +1 -0
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/module/blocks/symbol/symbol.js +1 -0
- package/lib/browser/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/browser/module/components/content/content.js +1 -0
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/context/types.d.ts +1 -0
- package/lib/browser/typescript/context/types.d.ts.map +1 -1
- package/lib/edge/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/edge/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +1 -0
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/module/blocks/symbol/symbol.js +1 -0
- package/lib/edge/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/edge/module/components/content/content.js +1 -0
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/context/types.d.ts +1 -0
- package/lib/edge/typescript/context/types.d.ts.map +1 -1
- package/lib/node/commonjs/blocks/symbol/symbol.js +1 -0
- package/lib/node/commonjs/blocks/symbol/symbol.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +1 -0
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/module/blocks/symbol/symbol.js +1 -0
- package/lib/node/module/blocks/symbol/symbol.js.map +1 -1
- package/lib/node/module/components/content/content.js +1 -0
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/typescript/blocks/symbol/symbol.d.ts.map +1 -1
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/context/types.d.ts +1 -0
- package/lib/node/typescript/context/types.d.ts.map +1 -1
- package/package.json +5 -9
- package/lib/node/index.cjs +0 -6910
- package/lib/node/index.mjs +0 -7477
- package/src/blocks/BaseText.tsx +0 -17
- package/src/blocks/accordion/accordion.tsx +0 -181
- package/src/blocks/accordion/accordion.types.ts +0 -12
- package/src/blocks/accordion/component-info.ts +0 -124
- package/src/blocks/accordion/helpers.ts +0 -3
- package/src/blocks/accordion/index.ts +0 -1
- package/src/blocks/button/button.tsx +0 -56
- package/src/blocks/button/button.types.ts +0 -7
- package/src/blocks/button/component-info.ts +0 -35
- package/src/blocks/button/index.ts +0 -1
- package/src/blocks/columns/columns.tsx +0 -199
- package/src/blocks/columns/columns.types.ts +0 -14
- package/src/blocks/columns/component-info.ts +0 -219
- package/src/blocks/columns/helpers.ts +0 -3
- package/src/blocks/columns/index.ts +0 -1
- package/src/blocks/custom-code/component-info.ts +0 -24
- package/src/blocks/custom-code/custom-code.tsx +0 -71
- package/src/blocks/custom-code/index.ts +0 -1
- package/src/blocks/embed/component-info.ts +0 -38
- package/src/blocks/embed/embed.tsx +0 -62
- package/src/blocks/embed/helpers.ts +0 -2
- package/src/blocks/embed/index.ts +0 -1
- package/src/blocks/form/form/component-info.ts +0 -233
- package/src/blocks/form/form/form.tsx +0 -324
- package/src/blocks/form/form/index.ts +0 -1
- package/src/blocks/form/input/component-info.ts +0 -47
- package/src/blocks/form/input/index.ts +0 -1
- package/src/blocks/form/input/input.tsx +0 -49
- package/src/blocks/form/select/component-info.ts +0 -44
- package/src/blocks/form/select/index.ts +0 -1
- package/src/blocks/form/select/select.tsx +0 -54
- package/src/blocks/form/submit-button/component-info.ts +0 -27
- package/src/blocks/form/submit-button/index.ts +0 -1
- package/src/blocks/form/submit-button/submit-button.tsx +0 -34
- package/src/blocks/fragment/component-info.ts +0 -8
- package/src/blocks/fragment/fragment.tsx +0 -18
- package/src/blocks/fragment/fragment.types.ts +0 -5
- package/src/blocks/fragment/index.ts +0 -1
- package/src/blocks/helpers.ts +0 -43
- package/src/blocks/image/component-info.ts +0 -124
- package/src/blocks/image/image.helpers.ts +0 -47
- package/src/blocks/image/image.tsx +0 -65
- package/src/blocks/image/image.types.ts +0 -19
- package/src/blocks/image/index.ts +0 -1
- package/src/blocks/img/component-info.ts +0 -16
- package/src/blocks/img/img.tsx +0 -55
- package/src/blocks/img/index.ts +0 -1
- package/src/blocks/raw-text/component-info.ts +0 -11
- package/src/blocks/raw-text/index.ts +0 -1
- package/src/blocks/raw-text/raw-text.tsx +0 -1
- package/src/blocks/section/component-info.ts +0 -41
- package/src/blocks/section/index.ts +0 -1
- package/src/blocks/section/section.tsx +0 -39
- package/src/blocks/section/section.types.ts +0 -6
- package/src/blocks/slot/component-info.ts +0 -15
- package/src/blocks/slot/index.ts +0 -1
- package/src/blocks/slot/slot.tsx +0 -42
- package/src/blocks/symbol/component-info.ts +0 -35
- package/src/blocks/symbol/index.ts +0 -1
- package/src/blocks/symbol/symbol.helpers.ts +0 -47
- package/src/blocks/symbol/symbol.tsx +0 -99
- package/src/blocks/symbol/symbol.types.ts +0 -17
- package/src/blocks/tabs/component-info.ts +0 -139
- package/src/blocks/tabs/index.ts +0 -1
- package/src/blocks/tabs/tabs.tsx +0 -79
- package/src/blocks/tabs/tabs.types.ts +0 -13
- package/src/blocks/text/component-info.ts +0 -20
- package/src/blocks/text/index.ts +0 -1
- package/src/blocks/text/text.tsx +0 -105
- package/src/blocks/text/text.types.ts +0 -4
- package/src/blocks/textarea/component-info.ts +0 -38
- package/src/blocks/textarea/index.ts +0 -1
- package/src/blocks/textarea/textarea.tsx +0 -41
- package/src/blocks/video/component-info.ts +0 -83
- package/src/blocks/video/index.ts +0 -1
- package/src/blocks/video/video.tsx +0 -70
- package/src/blocks/video/video.types.ts +0 -21
- package/src/components/block/animator.ts +0 -220
- package/src/components/block/block.helpers.ts +0 -106
- package/src/components/block/block.tsx +0 -235
- package/src/components/block/components/block-styles.tsx +0 -136
- package/src/components/block/components/block-wrapper.tsx +0 -53
- package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
- package/src/components/block/components/component-ref/component-ref.tsx +0 -66
- package/src/components/block/components/interactive-element.tsx +0 -53
- package/src/components/block/components/repeated-block.tsx +0 -37
- package/src/components/block/types.ts +0 -6
- package/src/components/blocks/blocks-wrapper.tsx +0 -93
- package/src/components/blocks/blocks.tsx +0 -57
- package/src/components/blocks/blocks.types.ts +0 -7
- package/src/components/blocks/index.ts +0 -1
- package/src/components/content/components/enable-editor.tsx +0 -471
- package/src/components/content/components/styles.helpers.ts +0 -101
- package/src/components/content/components/styles.tsx +0 -42
- package/src/components/content/content.helpers.ts +0 -40
- package/src/components/content/content.tsx +0 -150
- package/src/components/content/content.types.ts +0 -13
- package/src/components/content/contentProps.types.ts +0 -17
- package/src/components/content/index.ts +0 -1
- package/src/components/content/wrap-component-ref.ts +0 -6
- package/src/components/content-variants/content-variants.tsx +0 -146
- package/src/components/content-variants/content-variants.types.ts +0 -84
- package/src/components/content-variants/helpers.ts +0 -72
- package/src/components/content-variants/index.ts +0 -1
- package/src/components/content-variants/inlined-fns.ts +0 -22
- package/src/components/dynamic-div.tsx +0 -30
- package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
- package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
- package/src/components/error-boundary.tsx +0 -38
- package/src/components/inlined-script.tsx +0 -10
- package/src/components/inlined-styles.tsx +0 -10
- package/src/constants/builder-registered-components.ts +0 -59
- package/src/constants/device-sizes.ts +0 -59
- package/src/constants/extra-components.ts +0 -1
- package/src/constants/sdk-version.ts +0 -1
- package/src/constants/target.ts +0 -3
- package/src/context/builder.context.ts +0 -15
- package/src/context/components.context.ts +0 -3
- package/src/context/index.ts +0 -1
- package/src/context/types.ts +0 -37
- package/src/functions/apply-patch-with-mutation.ts +0 -61
- package/src/functions/camel-to-kebab-case.ts +0 -1
- package/src/functions/deopt.ts +0 -6
- package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
- package/src/functions/evaluate/browser-runtime/index.ts +0 -1
- package/src/functions/evaluate/choose-eval.ts +0 -23
- package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
- package/src/functions/evaluate/edge-runtime/index.ts +0 -1
- package/src/functions/evaluate/evaluate.ts +0 -76
- package/src/functions/evaluate/helpers.ts +0 -56
- package/src/functions/evaluate/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/init.ts +0 -33
- package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
- package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -24
- package/src/functions/evaluate/placeholder-runtime.ts +0 -4
- package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
- package/src/functions/event-handler-name.ts +0 -4
- package/src/functions/extract-text-styles.ts +0 -24
- package/src/functions/fast-clone.ts +0 -4
- package/src/functions/fetch-builder-props.ts +0 -75
- package/src/functions/get-block-actions-handler.ts +0 -17
- package/src/functions/get-block-actions.ts +0 -35
- package/src/functions/get-block-component-options.ts +0 -11
- package/src/functions/get-block-properties.ts +0 -62
- package/src/functions/get-builder-search-params/index.ts +0 -33
- package/src/functions/get-class-prop-name.ts +0 -15
- package/src/functions/get-content/generate-content-url.ts +0 -88
- package/src/functions/get-content/index.ts +0 -99
- package/src/functions/get-content/types.ts +0 -157
- package/src/functions/get-env.ts +0 -5
- package/src/functions/get-fetch.ts +0 -11
- package/src/functions/get-global-this.ts +0 -16
- package/src/functions/get-processed-block.ts +0 -70
- package/src/functions/get-style.ts +0 -38
- package/src/functions/get.ts +0 -4
- package/src/functions/is-browser.ts +0 -3
- package/src/functions/is-edge-runtime.ts +0 -9
- package/src/functions/is-editing.ts +0 -8
- package/src/functions/is-from-trusted-host.ts +0 -8
- package/src/functions/is-iframe.ts +0 -4
- package/src/functions/is-node-runtime.ts +0 -8
- package/src/functions/is-previewing.ts +0 -16
- package/src/functions/on-change.ts +0 -29
- package/src/functions/register-component.ts +0 -30
- package/src/functions/register.ts +0 -44
- package/src/functions/set-editor-settings.ts +0 -15
- package/src/functions/set.ts +0 -14
- package/src/functions/track/helpers.ts +0 -51
- package/src/functions/track/index.ts +0 -131
- package/src/functions/track/interaction.ts +0 -63
- package/src/functions/transform-block-properties.ts +0 -33
- package/src/functions/transform-block.ts +0 -30
- package/src/functions/transform-style-property.ts +0 -296
- package/src/helpers/ab-tests.ts +0 -166
- package/src/helpers/canTrack.ts +0 -2
- package/src/helpers/cookie.ts +0 -97
- package/src/helpers/css.ts +0 -33
- package/src/helpers/flatten.ts +0 -41
- package/src/helpers/localStorage.ts +0 -36
- package/src/helpers/logger.ts +0 -7
- package/src/helpers/nullable.ts +0 -2
- package/src/helpers/omit.ts +0 -7
- package/src/helpers/preview-lru-cache/get.ts +0 -4
- package/src/helpers/preview-lru-cache/helpers.ts +0 -1
- package/src/helpers/preview-lru-cache/init.ts +0 -7
- package/src/helpers/preview-lru-cache/set.ts +0 -12
- package/src/helpers/preview-lru-cache/types.ts +0 -1
- package/src/helpers/search/search.ts +0 -18
- package/src/helpers/sessionId.ts +0 -37
- package/src/helpers/subscribe-to-editor.ts +0 -95
- package/src/helpers/time.ts +0 -2
- package/src/helpers/url.ts +0 -15
- package/src/helpers/uuid.ts +0 -17
- package/src/helpers/visitorId.ts +0 -37
- package/src/index-helpers/blocks-exports.ts +0 -16
- package/src/index-helpers/top-of-file.ts +0 -2
- package/src/index.ts +0 -15
- package/src/scripts/init-editing.ts +0 -119
- package/src/server-index.ts +0 -43
- package/src/types/api-version.ts +0 -2
- package/src/types/builder-block.ts +0 -89
- package/src/types/builder-content.ts +0 -47
- package/src/types/builder-props.ts +0 -12
- package/src/types/can-track.ts +0 -3
- package/src/types/components.ts +0 -119
- package/src/types/deep-partial.ts +0 -1
- package/src/types/element.ts +0 -57
- package/src/types/enforced-partials.ts +0 -19
- package/src/types/input.ts +0 -123
- package/src/types/targets.ts +0 -1
- package/src/types/typescript.ts +0 -9
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { BuilderContextInterface } from '../context/types';
|
|
2
|
-
import type { BuilderBlock } from '../types/builder-block';
|
|
3
|
-
import { getClassPropName } from './get-class-prop-name';
|
|
4
|
-
import { getStyle } from './get-style';
|
|
5
|
-
import { transformBlockProperties } from './transform-block-properties';
|
|
6
|
-
const extractRelevantRootBlockProperties = (block: BuilderBlock) => {
|
|
7
|
-
// currently we are only spreading the `href` property
|
|
8
|
-
// TO-DO: potentially spread all properties from block, but only if they are not already defined by BuilderBlock
|
|
9
|
-
|
|
10
|
-
// const {
|
|
11
|
-
// '@type': _type,
|
|
12
|
-
// '@version': _version,
|
|
13
|
-
// id: _id,
|
|
14
|
-
// tagName: _tagName,
|
|
15
|
-
// layerName: _layerName,
|
|
16
|
-
// groupLocked: _groupLocked,
|
|
17
|
-
// layerLocked: _layerLocked,
|
|
18
|
-
// class: _class,
|
|
19
|
-
// children: _children,
|
|
20
|
-
// responsiveStyles: _responsiveStyles,
|
|
21
|
-
// component: _component,
|
|
22
|
-
// bindings: _bindings,
|
|
23
|
-
// meta: _meta,
|
|
24
|
-
// actions: _actions,
|
|
25
|
-
// properties: _properties,
|
|
26
|
-
// code: _code,
|
|
27
|
-
// repeat: _repeat,
|
|
28
|
-
// animations: _animations,
|
|
29
|
-
// style: _style,
|
|
30
|
-
// hide: _hide,
|
|
31
|
-
// show: _show,
|
|
32
|
-
// // anything set by dynamic bindings outside of predefined `BuilderBlock` properties
|
|
33
|
-
// ...remainingBlockProperties
|
|
34
|
-
// } = block;
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
href: (block as any).href
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export function getBlockProperties({
|
|
41
|
-
block,
|
|
42
|
-
context
|
|
43
|
-
}: {
|
|
44
|
-
block: BuilderBlock;
|
|
45
|
-
context: BuilderContextInterface;
|
|
46
|
-
}) {
|
|
47
|
-
const properties = {
|
|
48
|
-
...extractRelevantRootBlockProperties(block),
|
|
49
|
-
...block.properties,
|
|
50
|
-
'builder-id': block.id,
|
|
51
|
-
style: getStyle({
|
|
52
|
-
block,
|
|
53
|
-
context
|
|
54
|
-
}),
|
|
55
|
-
[getClassPropName()]: [block.id, 'builder-block', block.class, block.properties?.class].filter(Boolean).join(' ')
|
|
56
|
-
};
|
|
57
|
-
return transformBlockProperties({
|
|
58
|
-
properties,
|
|
59
|
-
context,
|
|
60
|
-
block
|
|
61
|
-
});
|
|
62
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { QueryObject } from '../../helpers/search/search';
|
|
2
|
-
import { normalizeSearchParams } from '../../helpers/search/search';
|
|
3
|
-
import { isBrowser } from '../is-browser';
|
|
4
|
-
const BUILDER_SEARCHPARAMS_PREFIX = 'builder.';
|
|
5
|
-
const BUILDER_OPTIONS_PREFIX = 'options.';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
9
|
-
* relevant to the Builder SDK.
|
|
10
|
-
*
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export const getBuilderSearchParams = (_options: QueryObject | URLSearchParams | undefined) => {
|
|
14
|
-
if (!_options) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
const options = normalizeSearchParams(_options);
|
|
18
|
-
const newOptions: QueryObject = {};
|
|
19
|
-
Object.keys(options).forEach(key => {
|
|
20
|
-
if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
21
|
-
const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, '').replace(BUILDER_OPTIONS_PREFIX, '');
|
|
22
|
-
newOptions[trimmedKey] = options[key];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return newOptions;
|
|
26
|
-
};
|
|
27
|
-
export const getBuilderSearchParamsFromWindow = () => {
|
|
28
|
-
if (!isBrowser()) {
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
32
|
-
return getBuilderSearchParams(searchParams);
|
|
33
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TARGET } from '../constants/target';
|
|
2
|
-
export const getClassPropName = () => {
|
|
3
|
-
switch (TARGET) {
|
|
4
|
-
case 'react':
|
|
5
|
-
case 'reactNative':
|
|
6
|
-
case 'rsc':
|
|
7
|
-
return 'className';
|
|
8
|
-
case 'svelte':
|
|
9
|
-
case 'vue':
|
|
10
|
-
case 'solid':
|
|
11
|
-
case 'qwik':
|
|
12
|
-
case 'angular':
|
|
13
|
-
return 'class';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { flatten, flattenMongoQuery } from '../../helpers/flatten';
|
|
2
|
-
import { normalizeSearchParams } from '../../helpers/search/search';
|
|
3
|
-
import { DEFAULT_API_VERSION } from '../../types/api-version';
|
|
4
|
-
import { getBuilderSearchParamsFromWindow } from '../get-builder-search-params/index';
|
|
5
|
-
import type { GetContentOptions } from './types';
|
|
6
|
-
const isPositiveNumber = (thing: unknown) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
|
|
7
|
-
export const generateContentUrl = (options: GetContentOptions): URL => {
|
|
8
|
-
const {
|
|
9
|
-
limit = 30,
|
|
10
|
-
userAttributes,
|
|
11
|
-
query,
|
|
12
|
-
model,
|
|
13
|
-
apiKey,
|
|
14
|
-
enrich,
|
|
15
|
-
locale,
|
|
16
|
-
apiVersion = DEFAULT_API_VERSION,
|
|
17
|
-
fields,
|
|
18
|
-
omit,
|
|
19
|
-
offset,
|
|
20
|
-
cacheSeconds,
|
|
21
|
-
staleCacheSeconds,
|
|
22
|
-
sort,
|
|
23
|
-
includeUnpublished
|
|
24
|
-
} = options;
|
|
25
|
-
if (!apiKey) {
|
|
26
|
-
throw new Error('Missing API key');
|
|
27
|
-
}
|
|
28
|
-
if (!['v3'].includes(apiVersion)) {
|
|
29
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// if we are fetching an array of content, we disable noTraverse for perf reasons.
|
|
33
|
-
const noTraverse = limit !== 1;
|
|
34
|
-
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
|
|
35
|
-
url.searchParams.set('apiKey', apiKey);
|
|
36
|
-
url.searchParams.set('limit', String(limit));
|
|
37
|
-
url.searchParams.set('noTraverse', String(noTraverse));
|
|
38
|
-
url.searchParams.set('includeRefs', String(true));
|
|
39
|
-
if (locale) url.searchParams.set('locale', locale);
|
|
40
|
-
if (enrich) url.searchParams.set('enrich', String(enrich));
|
|
41
|
-
url.searchParams.set('omit', omit || 'meta.componentsUsed');
|
|
42
|
-
if (fields) {
|
|
43
|
-
url.searchParams.set('fields', fields);
|
|
44
|
-
}
|
|
45
|
-
if (Number.isFinite(offset) && offset! > -1) {
|
|
46
|
-
url.searchParams.set('offset', String(Math.floor(offset!)));
|
|
47
|
-
}
|
|
48
|
-
if (typeof includeUnpublished === 'boolean') {
|
|
49
|
-
url.searchParams.set('includeUnpublished', String(includeUnpublished));
|
|
50
|
-
}
|
|
51
|
-
if (cacheSeconds && isPositiveNumber(cacheSeconds)) {
|
|
52
|
-
url.searchParams.set('cacheSeconds', String(cacheSeconds));
|
|
53
|
-
}
|
|
54
|
-
if (staleCacheSeconds && isPositiveNumber(staleCacheSeconds)) {
|
|
55
|
-
url.searchParams.set('staleCacheSeconds', String(staleCacheSeconds));
|
|
56
|
-
}
|
|
57
|
-
if (sort) {
|
|
58
|
-
const flattened = flatten({
|
|
59
|
-
sort
|
|
60
|
-
});
|
|
61
|
-
for (const key in flattened) {
|
|
62
|
-
url.searchParams.set(key, JSON.stringify((flattened as any)[key]));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// TODO: how to express 'offset' in the url - as direct queryparam or as flattened in options[key] ?
|
|
67
|
-
|
|
68
|
-
const queryOptions = {
|
|
69
|
-
...getBuilderSearchParamsFromWindow(),
|
|
70
|
-
...normalizeSearchParams(options.options || {})
|
|
71
|
-
};
|
|
72
|
-
const flattened = flatten(queryOptions);
|
|
73
|
-
for (const key in flattened) {
|
|
74
|
-
url.searchParams.set(key, String(flattened[key]));
|
|
75
|
-
}
|
|
76
|
-
if (userAttributes) {
|
|
77
|
-
url.searchParams.set('userAttributes', JSON.stringify(userAttributes));
|
|
78
|
-
}
|
|
79
|
-
if (query) {
|
|
80
|
-
const flattened = flattenMongoQuery({
|
|
81
|
-
query
|
|
82
|
-
});
|
|
83
|
-
for (const key in flattened) {
|
|
84
|
-
url.searchParams.set(key, JSON.stringify(flattened[key]));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return url;
|
|
88
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { TARGET } from '../../constants/target';
|
|
2
|
-
import { handleABTesting } from '../../helpers/ab-tests';
|
|
3
|
-
import { getDefaultCanTrack } from '../../helpers/canTrack';
|
|
4
|
-
import { logger } from '../../helpers/logger';
|
|
5
|
-
import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
|
|
6
|
-
import type { BuilderContent } from '../../types/builder-content';
|
|
7
|
-
import { fetch } from '../get-fetch';
|
|
8
|
-
import { isBrowser } from '../is-browser';
|
|
9
|
-
import { generateContentUrl } from './generate-content-url';
|
|
10
|
-
import type { GetContentOptions } from './types';
|
|
11
|
-
const checkContentHasResults = (content: ContentResponse): content is ContentResults => 'results' in content;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns the first content entry that matches the given options.
|
|
15
|
-
*/
|
|
16
|
-
export async function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null> {
|
|
17
|
-
const allContent = await fetchEntries({
|
|
18
|
-
...options,
|
|
19
|
-
limit: 1
|
|
20
|
-
});
|
|
21
|
-
if (allContent) {
|
|
22
|
-
return allContent[0] || null;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
type ContentResults = {
|
|
27
|
-
results: BuilderContent[];
|
|
28
|
-
};
|
|
29
|
-
type ContentResponse = ContentResults | {
|
|
30
|
-
status: number;
|
|
31
|
-
message: string;
|
|
32
|
-
};
|
|
33
|
-
const _fetchContent = async (options: GetContentOptions) => {
|
|
34
|
-
const url = generateContentUrl(options);
|
|
35
|
-
const _fetch = options.fetch ?? fetch;
|
|
36
|
-
const res = await _fetch(url.href, options.fetchOptions);
|
|
37
|
-
const content = await (res.json() as Promise<ContentResponse>);
|
|
38
|
-
return content;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @internal Exported only for testing purposes. Do not use.
|
|
43
|
-
*/
|
|
44
|
-
export const _processContentResult = async (options: GetContentOptions, content: ContentResults, url: URL = generateContentUrl(options)): Promise<BuilderContent[]> => {
|
|
45
|
-
const canTrack = getDefaultCanTrack(options.canTrack);
|
|
46
|
-
const isPreviewing = url.search.includes(`preview=`);
|
|
47
|
-
if (TARGET === 'rsc' && isPreviewing) {
|
|
48
|
-
const newResults: BuilderContent[] = [];
|
|
49
|
-
for (const item of content.results) {
|
|
50
|
-
const previewContent = getPreviewContent(url.searchParams);
|
|
51
|
-
newResults.push(previewContent || item);
|
|
52
|
-
}
|
|
53
|
-
content.results = newResults;
|
|
54
|
-
}
|
|
55
|
-
if (!canTrack) return content.results;
|
|
56
|
-
if (!(isBrowser() || TARGET === 'reactNative')) return content.results;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* For client-side navigations, it is ideal to handle AB testing at this point instead of using our
|
|
60
|
-
* complex multi-rendering variants approach, which is only needed for SSR'd content.
|
|
61
|
-
*
|
|
62
|
-
* This is also where react-native would handle AB testing.
|
|
63
|
-
*/
|
|
64
|
-
try {
|
|
65
|
-
const newResults: BuilderContent[] = [];
|
|
66
|
-
for (const item of content.results) {
|
|
67
|
-
newResults.push(await handleABTesting({
|
|
68
|
-
item,
|
|
69
|
-
canTrack
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
content.results = newResults;
|
|
73
|
-
} catch (e) {
|
|
74
|
-
logger.error('Could not process A/B tests. ', e);
|
|
75
|
-
}
|
|
76
|
-
return content.results;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Returns a paginated array of entries that match the given options.
|
|
81
|
-
*/
|
|
82
|
-
export async function fetchEntries(options: GetContentOptions) {
|
|
83
|
-
try {
|
|
84
|
-
const url = generateContentUrl(options);
|
|
85
|
-
const content = await _fetchContent(options);
|
|
86
|
-
if (!checkContentHasResults(content)) {
|
|
87
|
-
logger.error('Error fetching data. ', {
|
|
88
|
-
url,
|
|
89
|
-
content,
|
|
90
|
-
options
|
|
91
|
-
});
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return _processContentResult(options, content);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
logger.error('Error fetching data. ', error);
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
export interface GetContentOptions {
|
|
2
|
-
/** The model to get content for (required) */
|
|
3
|
-
model: string;
|
|
4
|
-
|
|
5
|
-
/** Your public API key (required) */
|
|
6
|
-
apiKey: string;
|
|
7
|
-
|
|
8
|
-
/** Number of items to fetch. Default is 1 */
|
|
9
|
-
limit?: number;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Use to specify an offset for pagination of results. The default is 0.
|
|
13
|
-
*/
|
|
14
|
-
offset?: number;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* User attribute key value pairs to be used for targeting
|
|
18
|
-
* https://www.builder.io/c/docs/custom-targeting-attributes
|
|
19
|
-
*
|
|
20
|
-
* e.g.
|
|
21
|
-
* ```js
|
|
22
|
-
* userAttributes: {
|
|
23
|
-
* urlPath: '/',
|
|
24
|
-
* returnVisitor: true,
|
|
25
|
-
* device: 'mobile'
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
userAttributes?: (Record<string, any> & {
|
|
30
|
-
urlPath?: string;
|
|
31
|
-
}) | null;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Mongodb style query of your data. E.g.:
|
|
35
|
-
*
|
|
36
|
-
* ```js
|
|
37
|
-
* query: {
|
|
38
|
-
* id: 'abc123',
|
|
39
|
-
* data: {
|
|
40
|
-
* myCustomField: { $gt: 20 },
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* See more info on MongoDB's query operators and format.
|
|
46
|
-
*
|
|
47
|
-
* @see {@link https://docs.mongodb.com/manual/reference/operator/query/}
|
|
48
|
-
*/
|
|
49
|
-
query?: Record<string, any>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Any other API options.
|
|
53
|
-
* Accepts both a key/value object or a `URLSearchParams` instance
|
|
54
|
-
* */
|
|
55
|
-
options?: Record<string, any> | URLSearchParams;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* If set to `false`, it will not use cookies to target content. Therefore, A/B Testing will be disabled and
|
|
59
|
-
* only the default variation will be returned to every user.
|
|
60
|
-
*
|
|
61
|
-
* Defaults to `true`.
|
|
62
|
-
*/
|
|
63
|
-
canTrack?: boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Include multilevel references in the response.
|
|
67
|
-
*/
|
|
68
|
-
enrich?: boolean;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* If provided, the API will auto-resolve localized objects to the value of this `locale` key.
|
|
72
|
-
*/
|
|
73
|
-
locale?: string;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* If provided, sets the Builder API version used to fetch content.
|
|
77
|
-
*
|
|
78
|
-
* Currently, the only available API version is `v3`.
|
|
79
|
-
*/
|
|
80
|
-
apiVersion?: 'v3';
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Only include these fields.
|
|
84
|
-
* Note: 'omit' takes precedence over 'fields'
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```
|
|
88
|
-
* fields: 'id, name, data.customField'
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
fields?: string;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Omit only these fields.
|
|
95
|
-
* Note: 'omit' takes precedence over 'fields'
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```
|
|
99
|
-
* omit: 'data.bigField,data.blocks'
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
omit?: string;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Seconds to cache content. Sets the max-age of the cache-control header
|
|
106
|
-
* response header.
|
|
107
|
-
*
|
|
108
|
-
* Use a higher value for better performance, lower for content that will change more frequently
|
|
109
|
-
*
|
|
110
|
-
* @see {@link https://www.builder.io/c/docs/query-api#__next:~:text=%26includeRefs%3Dtrue-,cacheSeconds,-No}
|
|
111
|
-
*/
|
|
112
|
-
cacheSeconds?: number;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Builder.io uses stale-while-revalidate caching at the CDN level. This means we always serve
|
|
116
|
-
* from edge cache and update caches in the background for maximum possible performance. This also
|
|
117
|
-
* means that the more frequently content is requested, the more fresh it will be. The longest we
|
|
118
|
-
* will ever hold something in stale cache is 1 day by default, and you can set this to be shorter
|
|
119
|
-
* yourself as well. We suggest keeping this high unless you have content that must change rapidly
|
|
120
|
-
* and gets very little traffic.
|
|
121
|
-
*
|
|
122
|
-
* @see {@link https://www.fastly.com/blog/prevent-application-network-instability-serve-stale-content}
|
|
123
|
-
*/
|
|
124
|
-
staleCacheSeconds?: number;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Property to order results by.
|
|
128
|
-
* Use 1 for ascending and -1 for descending.
|
|
129
|
-
*
|
|
130
|
-
* The key is what you're sorting on, so the following example sorts by createdDate
|
|
131
|
-
* and because the value is 1, the sort is ascending.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```
|
|
135
|
-
* createdDate: 1
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
sort?: {
|
|
139
|
-
[key: string]: 1 | -1;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Include content entries in a response that are still in
|
|
144
|
-
* draft mode and un-archived. Default is false.
|
|
145
|
-
*/
|
|
146
|
-
includeUnpublished?: boolean;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Optional override of the `fetch` function. (Defaults to global `fetch`)
|
|
150
|
-
*/
|
|
151
|
-
fetch?: (input: string, init?: object) => Promise<any>;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Optional fetch options to be passed as the second argument to the `fetch` function.
|
|
155
|
-
*/
|
|
156
|
-
fetchOptions?: object;
|
|
157
|
-
}
|
package/src/functions/get-env.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const validEnvList = ['production', 'qa', 'test', 'development', 'dev', 'cdn-qa', 'cloud', 'fast', 'cdn2', 'cdn-prod'];
|
|
2
|
-
export const getEnv = (): string => {
|
|
3
|
-
const env = process.env.NODE_ENV || 'production';
|
|
4
|
-
return validEnvList.includes(env) ? env : 'production';
|
|
5
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getGlobalThis } from './get-global-this';
|
|
2
|
-
function getFetch(): typeof global.fetch {
|
|
3
|
-
const globalFetch: typeof global.fetch = getGlobalThis().fetch;
|
|
4
|
-
if (typeof globalFetch === 'undefined') {
|
|
5
|
-
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
6
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
7
|
-
throw new Error('Builder SDK could not find a global `fetch` function');
|
|
8
|
-
}
|
|
9
|
-
return globalFetch;
|
|
10
|
-
}
|
|
11
|
-
export const fetch = getFetch()
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type Global = typeof global | typeof window | typeof self | typeof globalThis;
|
|
2
|
-
export function getGlobalThis(): Global {
|
|
3
|
-
if (typeof globalThis !== 'undefined') {
|
|
4
|
-
return globalThis;
|
|
5
|
-
}
|
|
6
|
-
if (typeof window !== 'undefined') {
|
|
7
|
-
return window;
|
|
8
|
-
}
|
|
9
|
-
if (typeof global !== 'undefined') {
|
|
10
|
-
return global;
|
|
11
|
-
}
|
|
12
|
-
if (typeof self !== 'undefined') {
|
|
13
|
-
return self;
|
|
14
|
-
}
|
|
15
|
-
return globalThis;
|
|
16
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { BuilderContextInterface } from '../context/types';
|
|
2
|
-
import type { BuilderBlock } from '../types/builder-block';
|
|
3
|
-
import { evaluate } from './evaluate/index';
|
|
4
|
-
import { fastClone } from './fast-clone';
|
|
5
|
-
import { set } from './set';
|
|
6
|
-
import { transformBlock } from './transform-block';
|
|
7
|
-
const evaluateBindings = ({
|
|
8
|
-
block,
|
|
9
|
-
context,
|
|
10
|
-
localState,
|
|
11
|
-
rootState,
|
|
12
|
-
rootSetState
|
|
13
|
-
}: {
|
|
14
|
-
block: BuilderBlock;
|
|
15
|
-
} & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock => {
|
|
16
|
-
if (!block.bindings) {
|
|
17
|
-
return block;
|
|
18
|
-
}
|
|
19
|
-
const copy = fastClone(block);
|
|
20
|
-
const copied = {
|
|
21
|
-
...copy,
|
|
22
|
-
properties: {
|
|
23
|
-
...copy.properties
|
|
24
|
-
},
|
|
25
|
-
actions: {
|
|
26
|
-
...copy.actions
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
for (const binding in block.bindings) {
|
|
30
|
-
const expression = block.bindings[binding];
|
|
31
|
-
const value = evaluate({
|
|
32
|
-
code: expression,
|
|
33
|
-
localState,
|
|
34
|
-
rootState,
|
|
35
|
-
rootSetState,
|
|
36
|
-
context,
|
|
37
|
-
enableCache: true
|
|
38
|
-
});
|
|
39
|
-
set(copied, binding, value);
|
|
40
|
-
}
|
|
41
|
-
return copied;
|
|
42
|
-
};
|
|
43
|
-
export function getProcessedBlock({
|
|
44
|
-
block,
|
|
45
|
-
context,
|
|
46
|
-
shouldEvaluateBindings,
|
|
47
|
-
localState,
|
|
48
|
-
rootState,
|
|
49
|
-
rootSetState
|
|
50
|
-
}: {
|
|
51
|
-
block: BuilderBlock;
|
|
52
|
-
/**
|
|
53
|
-
* In some cases, we want to avoid evaluating bindings and only want framework-specific block transformation. It is
|
|
54
|
-
* also sometimes too early to consider bindings, e.g. when we might be looking at a repeated block.
|
|
55
|
-
*/
|
|
56
|
-
shouldEvaluateBindings: boolean;
|
|
57
|
-
} & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock {
|
|
58
|
-
const transformedBlock = transformBlock(block);
|
|
59
|
-
if (shouldEvaluateBindings) {
|
|
60
|
-
return evaluateBindings({
|
|
61
|
-
block: transformedBlock,
|
|
62
|
-
localState,
|
|
63
|
-
rootState,
|
|
64
|
-
rootSetState,
|
|
65
|
-
context
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
return transformedBlock;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { TARGET } from '../constants/target';
|
|
2
|
-
import type { BuilderContextInterface } from '../context/types';
|
|
3
|
-
import { convertStyleMapToCSSArray } from '../helpers/css';
|
|
4
|
-
import type { BuilderBlock } from '../types/builder-block';
|
|
5
|
-
import { transformStyleProperty } from './transform-style-property';
|
|
6
|
-
export const getStyle = ({
|
|
7
|
-
block,
|
|
8
|
-
context
|
|
9
|
-
}: {
|
|
10
|
-
block: BuilderBlock;
|
|
11
|
-
context: BuilderContextInterface;
|
|
12
|
-
}) => {
|
|
13
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
14
|
-
style: block.style || {},
|
|
15
|
-
context,
|
|
16
|
-
block
|
|
17
|
-
}));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Svelte does not support style attribute as an object so we need to flatten it.
|
|
22
|
-
*
|
|
23
|
-
* Additionally, Svelte, Vue and other frameworks use kebab-case styles, so we need to convert them.
|
|
24
|
-
*/
|
|
25
|
-
export function mapStyleObjToStrIfNeeded(style: Partial<CSSStyleDeclaration>): string | Partial<CSSStyleDeclaration> {
|
|
26
|
-
switch (TARGET) {
|
|
27
|
-
case 'svelte':
|
|
28
|
-
case 'vue':
|
|
29
|
-
case 'solid':
|
|
30
|
-
case 'angular':
|
|
31
|
-
return convertStyleMapToCSSArray(style).join(' ');
|
|
32
|
-
case 'qwik':
|
|
33
|
-
case 'reactNative':
|
|
34
|
-
case 'react':
|
|
35
|
-
case 'rsc':
|
|
36
|
-
return style;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/functions/get.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export const get = (obj: any, path: string, defaultValue?: any) => {
|
|
2
|
-
const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== undefined ? res[key] : res, obj);
|
|
3
|
-
return result === undefined || result === obj ? defaultValue : result;
|
|
4
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TARGET } from '../constants/target';
|
|
2
|
-
import { getSearchString, type Search } from '../helpers/search/search';
|
|
3
|
-
import { isIframe } from './is-iframe';
|
|
4
|
-
export function isEditing(search?: Search) {
|
|
5
|
-
return isIframe() && (TARGET === 'reactNative' ||
|
|
6
|
-
// accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
7
|
-
getSearchString(search || window.location.search).indexOf('builder.frameEditing=') !== -1);
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const DEFAULT_TRUSTED_HOSTS = ['*.beta.builder.io', 'beta.builder.io', 'builder.io', 'localhost', 'qa.builder.io'];
|
|
2
|
-
export function isFromTrustedHost(trustedHosts: string[] | undefined, e: {
|
|
3
|
-
origin: string;
|
|
4
|
-
}): boolean {
|
|
5
|
-
const url = new URL(e.origin),
|
|
6
|
-
hostname = url.hostname;
|
|
7
|
-
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex(trustedHost => trustedHost.startsWith('*.') ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
8
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Search } from '../helpers/search/search';
|
|
2
|
-
import { getSearchString } from '../helpers/search/search';
|
|
3
|
-
import { isBrowser } from './is-browser';
|
|
4
|
-
export function isPreviewing(_search?: Search) {
|
|
5
|
-
const search = _search || (isBrowser() ? window.location.search : undefined);
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* If this function is called on the server without an explicit `search` argument,
|
|
9
|
-
* then it can't check if the user is previewing, and will return `false`.
|
|
10
|
-
*/
|
|
11
|
-
if (!search) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
const normalizedSearch = getSearchString(search);
|
|
15
|
-
return Boolean(normalizedSearch.indexOf('builder.preview=') !== -1);
|
|
16
|
-
}
|