@builder.io/sdk-svelte 1.0.3 → 1.0.6
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/blocks/button/index.d.ts +1 -0
- package/lib/browser/blocks/button/index.js +1 -0
- package/lib/browser/blocks/columns/index.d.ts +1 -0
- package/lib/browser/blocks/columns/index.js +1 -0
- package/lib/browser/blocks/custom-code/index.d.ts +1 -0
- package/lib/browser/blocks/custom-code/index.js +1 -0
- package/lib/browser/blocks/embed/index.d.ts +1 -0
- package/lib/browser/blocks/embed/index.js +1 -0
- package/lib/browser/blocks/form/form/index.d.ts +1 -0
- package/lib/browser/blocks/form/form/index.js +1 -0
- package/lib/browser/blocks/form/input/index.d.ts +1 -0
- package/lib/browser/blocks/form/input/index.js +1 -0
- package/lib/browser/blocks/form/select/index.d.ts +1 -0
- package/lib/browser/blocks/form/select/index.js +1 -0
- package/lib/browser/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/browser/blocks/form/submit-button/index.js +1 -0
- package/lib/browser/blocks/fragment/index.d.ts +1 -0
- package/lib/browser/blocks/fragment/index.js +1 -0
- package/lib/browser/blocks/image/index.d.ts +1 -0
- package/lib/browser/blocks/image/index.js +1 -0
- package/lib/browser/blocks/img/index.d.ts +1 -0
- package/lib/browser/blocks/img/index.js +1 -0
- package/lib/browser/blocks/raw-text/index.d.ts +1 -0
- package/lib/browser/blocks/raw-text/index.js +1 -0
- package/lib/browser/blocks/section/index.d.ts +1 -0
- package/lib/browser/blocks/section/index.js +1 -0
- package/lib/browser/blocks/slot/index.d.ts +1 -0
- package/lib/browser/blocks/slot/index.js +1 -0
- package/lib/browser/blocks/symbol/index.d.ts +1 -0
- package/lib/browser/blocks/symbol/index.js +1 -0
- package/lib/browser/blocks/symbol/symbol.svelte +3 -1
- package/lib/browser/blocks/text/index.d.ts +1 -0
- package/lib/browser/blocks/text/index.js +1 -0
- package/lib/browser/blocks/textarea/index.d.ts +1 -0
- package/lib/browser/blocks/textarea/index.js +1 -0
- package/lib/browser/blocks/video/index.d.ts +1 -0
- package/lib/browser/blocks/video/index.js +1 -0
- package/lib/browser/components/blocks/index.d.ts +1 -0
- package/lib/browser/components/blocks/index.js +1 -0
- package/lib/browser/components/content-variants/index.d.ts +1 -0
- package/lib/browser/components/content-variants/index.js +1 -0
- package/lib/browser/components/error-boundary.svelte +5 -0
- package/lib/browser/constants/builder-registered-components.js +8 -8
- package/lib/browser/constants/extra-components.js +8 -8
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/browser/functions/get-builder-search-params/index.js +1 -8
- package/lib/browser/functions/get-content/generate-content-url.js +2 -1
- package/lib/browser/functions/is-editing.d.ts +2 -1
- package/lib/browser/functions/is-editing.js +3 -2
- package/lib/browser/functions/is-previewing.d.ts +2 -1
- package/lib/browser/functions/is-previewing.js +5 -3
- package/lib/browser/helpers/search/search.d.ts +5 -0
- package/lib/browser/helpers/search/search.js +17 -0
- package/lib/browser/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/browser/index-helpers/blocks-exports.js +10 -11
- package/lib/browser/index.d.ts +5 -2
- package/lib/browser/index.js +5 -2
- package/lib/edge/blocks/button/index.d.ts +1 -0
- package/lib/edge/blocks/button/index.js +1 -0
- package/lib/edge/blocks/columns/index.d.ts +1 -0
- package/lib/edge/blocks/columns/index.js +1 -0
- package/lib/edge/blocks/custom-code/index.d.ts +1 -0
- package/lib/edge/blocks/custom-code/index.js +1 -0
- package/lib/edge/blocks/embed/index.d.ts +1 -0
- package/lib/edge/blocks/embed/index.js +1 -0
- package/lib/edge/blocks/form/form/index.d.ts +1 -0
- package/lib/edge/blocks/form/form/index.js +1 -0
- package/lib/edge/blocks/form/input/index.d.ts +1 -0
- package/lib/edge/blocks/form/input/index.js +1 -0
- package/lib/edge/blocks/form/select/index.d.ts +1 -0
- package/lib/edge/blocks/form/select/index.js +1 -0
- package/lib/edge/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/edge/blocks/form/submit-button/index.js +1 -0
- package/lib/edge/blocks/fragment/index.d.ts +1 -0
- package/lib/edge/blocks/fragment/index.js +1 -0
- package/lib/edge/blocks/image/index.d.ts +1 -0
- package/lib/edge/blocks/image/index.js +1 -0
- package/lib/edge/blocks/img/index.d.ts +1 -0
- package/lib/edge/blocks/img/index.js +1 -0
- package/lib/edge/blocks/raw-text/index.d.ts +1 -0
- package/lib/edge/blocks/raw-text/index.js +1 -0
- package/lib/edge/blocks/section/index.d.ts +1 -0
- package/lib/edge/blocks/section/index.js +1 -0
- package/lib/edge/blocks/slot/index.d.ts +1 -0
- package/lib/edge/blocks/slot/index.js +1 -0
- package/lib/edge/blocks/symbol/index.d.ts +1 -0
- package/lib/edge/blocks/symbol/index.js +1 -0
- package/lib/edge/blocks/symbol/symbol.svelte +3 -1
- package/lib/edge/blocks/text/index.d.ts +1 -0
- package/lib/edge/blocks/text/index.js +1 -0
- package/lib/edge/blocks/textarea/index.d.ts +1 -0
- package/lib/edge/blocks/textarea/index.js +1 -0
- package/lib/edge/blocks/video/index.d.ts +1 -0
- package/lib/edge/blocks/video/index.js +1 -0
- package/lib/edge/components/blocks/index.d.ts +1 -0
- package/lib/edge/components/blocks/index.js +1 -0
- package/lib/edge/components/content-variants/index.d.ts +1 -0
- package/lib/edge/components/content-variants/index.js +1 -0
- package/lib/edge/components/error-boundary.svelte +5 -0
- package/lib/edge/constants/builder-registered-components.js +8 -8
- package/lib/edge/constants/extra-components.js +8 -8
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/edge/functions/get-builder-search-params/index.js +1 -8
- package/lib/edge/functions/get-content/generate-content-url.js +2 -1
- package/lib/edge/functions/is-editing.d.ts +2 -1
- package/lib/edge/functions/is-editing.js +3 -2
- package/lib/edge/functions/is-previewing.d.ts +2 -1
- package/lib/edge/functions/is-previewing.js +5 -3
- package/lib/edge/helpers/search/search.d.ts +5 -0
- package/lib/edge/helpers/search/search.js +17 -0
- package/lib/edge/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/edge/index-helpers/blocks-exports.js +10 -11
- package/lib/edge/index.d.ts +5 -2
- package/lib/edge/index.js +5 -2
- package/lib/node/blocks/button/index.d.ts +1 -0
- package/lib/node/blocks/button/index.js +1 -0
- package/lib/node/blocks/columns/index.d.ts +1 -0
- package/lib/node/blocks/columns/index.js +1 -0
- package/lib/node/blocks/custom-code/index.d.ts +1 -0
- package/lib/node/blocks/custom-code/index.js +1 -0
- package/lib/node/blocks/embed/index.d.ts +1 -0
- package/lib/node/blocks/embed/index.js +1 -0
- package/lib/node/blocks/form/form/index.d.ts +1 -0
- package/lib/node/blocks/form/form/index.js +1 -0
- package/lib/node/blocks/form/input/index.d.ts +1 -0
- package/lib/node/blocks/form/input/index.js +1 -0
- package/lib/node/blocks/form/select/index.d.ts +1 -0
- package/lib/node/blocks/form/select/index.js +1 -0
- package/lib/node/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/node/blocks/form/submit-button/index.js +1 -0
- package/lib/node/blocks/fragment/index.d.ts +1 -0
- package/lib/node/blocks/fragment/index.js +1 -0
- package/lib/node/blocks/image/index.d.ts +1 -0
- package/lib/node/blocks/image/index.js +1 -0
- package/lib/node/blocks/img/index.d.ts +1 -0
- package/lib/node/blocks/img/index.js +1 -0
- package/lib/node/blocks/raw-text/index.d.ts +1 -0
- package/lib/node/blocks/raw-text/index.js +1 -0
- package/lib/node/blocks/section/index.d.ts +1 -0
- package/lib/node/blocks/section/index.js +1 -0
- package/lib/node/blocks/slot/index.d.ts +1 -0
- package/lib/node/blocks/slot/index.js +1 -0
- package/lib/node/blocks/symbol/index.d.ts +1 -0
- package/lib/node/blocks/symbol/index.js +1 -0
- package/lib/node/blocks/symbol/symbol.svelte +3 -1
- package/lib/node/blocks/text/index.d.ts +1 -0
- package/lib/node/blocks/text/index.js +1 -0
- package/lib/node/blocks/textarea/index.d.ts +1 -0
- package/lib/node/blocks/textarea/index.js +1 -0
- package/lib/node/blocks/video/index.d.ts +1 -0
- package/lib/node/blocks/video/index.js +1 -0
- package/lib/node/components/blocks/index.d.ts +1 -0
- package/lib/node/components/blocks/index.js +1 -0
- package/lib/node/components/content-variants/index.d.ts +1 -0
- package/lib/node/components/content-variants/index.js +1 -0
- package/lib/node/components/error-boundary.svelte +5 -0
- package/lib/node/constants/builder-registered-components.js +8 -8
- package/lib/node/constants/extra-components.js +8 -8
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/node/functions/get-builder-search-params/index.js +1 -8
- package/lib/node/functions/get-content/generate-content-url.js +2 -1
- package/lib/node/functions/is-editing.d.ts +2 -1
- package/lib/node/functions/is-editing.js +3 -2
- package/lib/node/functions/is-previewing.d.ts +2 -1
- package/lib/node/functions/is-previewing.js +5 -3
- package/lib/node/helpers/search/search.d.ts +5 -0
- package/lib/node/helpers/search/search.js +17 -0
- package/lib/node/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/node/index-helpers/blocks-exports.js +10 -11
- package/lib/node/index.d.ts +5 -2
- package/lib/node/index.js +5 -2
- package/package.json +4 -4
- package/src/blocks/button/index.ts +1 -0
- package/src/blocks/columns/index.ts +1 -0
- package/src/blocks/custom-code/index.ts +1 -0
- package/src/blocks/embed/index.ts +1 -0
- package/src/blocks/form/form/index.ts +1 -0
- package/src/blocks/form/input/index.ts +1 -0
- package/src/blocks/form/select/index.ts +1 -0
- package/src/blocks/form/submit-button/index.ts +1 -0
- package/src/blocks/fragment/index.ts +1 -0
- package/src/blocks/image/index.ts +1 -0
- package/src/blocks/img/index.ts +1 -0
- package/src/blocks/raw-text/index.ts +1 -0
- package/src/blocks/section/index.ts +1 -0
- package/src/blocks/slot/index.ts +1 -0
- package/src/blocks/symbol/index.ts +1 -0
- package/src/blocks/symbol/symbol.svelte +3 -1
- package/src/blocks/text/index.ts +1 -0
- package/src/blocks/textarea/index.ts +1 -0
- package/src/blocks/video/index.ts +1 -0
- package/src/components/blocks/index.ts +1 -0
- package/src/components/content-variants/index.ts +1 -0
- package/src/components/error-boundary.svelte +10 -0
- package/src/constants/builder-registered-components.ts +8 -8
- package/src/constants/extra-components.ts +8 -8
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/get-builder-search-params/index.ts +3 -10
- package/src/functions/get-content/generate-content-url.ts +2 -1
- package/src/functions/is-editing.ts +3 -2
- package/src/functions/is-previewing.ts +6 -3
- package/src/helpers/search/search.ts +18 -0
- package/src/index-helpers/blocks-exports.ts +10 -11
- package/src/index.ts +6 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { default as Button } from '../blocks/button/button.svelte';
|
|
2
1
|
import { componentInfo as buttonComponentInfo } from '../blocks/button/component-info.js';
|
|
3
|
-
import { default as
|
|
2
|
+
import { default as Button } from '../blocks/button/index.js';
|
|
4
3
|
import { componentInfo as columnsComponentInfo } from '../blocks/columns/component-info.js';
|
|
4
|
+
import { default as Columns } from '../blocks/columns/index.js';
|
|
5
5
|
import { componentInfo as fragmentComponentInfo } from '../blocks/fragment/component-info.js';
|
|
6
|
-
import { default as Fragment } from '../blocks/fragment/
|
|
6
|
+
import { default as Fragment } from '../blocks/fragment/index.js';
|
|
7
7
|
import { componentInfo as imageComponentInfo } from '../blocks/image/component-info.js';
|
|
8
|
-
import { default as Image } from '../blocks/image/
|
|
8
|
+
import { default as Image } from '../blocks/image/index.js';
|
|
9
9
|
import { componentInfo as sectionComponentInfo } from '../blocks/section/component-info.js';
|
|
10
|
-
import { default as Section } from '../blocks/section/
|
|
10
|
+
import { default as Section } from '../blocks/section/index.js';
|
|
11
11
|
import { componentInfo as slotComponentInfo } from '../blocks/slot/component-info.js';
|
|
12
|
-
import { default as Slot } from '../blocks/slot/
|
|
12
|
+
import { default as Slot } from '../blocks/slot/index.js';
|
|
13
13
|
import { componentInfo as symbolComponentInfo } from '../blocks/symbol/component-info.js';
|
|
14
|
-
import { default as Symbol } from '../blocks/symbol/
|
|
14
|
+
import { default as Symbol } from '../blocks/symbol/index.js';
|
|
15
15
|
import { componentInfo as textComponentInfo } from '../blocks/text/component-info.js';
|
|
16
|
-
import { default as Text } from '../blocks/text/
|
|
16
|
+
import { default as Text } from '../blocks/text/index.js';
|
|
17
17
|
import { getExtraComponents } from './extra-components.js';
|
|
18
18
|
/**
|
|
19
19
|
* Returns a list of all registered components.
|
|
@@ -4,21 +4,21 @@
|
|
|
4
4
|
* React Native SDK.
|
|
5
5
|
*/
|
|
6
6
|
import { componentInfo as customCodeInfo } from '../blocks/custom-code/component-info.js';
|
|
7
|
-
import { default as customCode } from '../blocks/custom-code/
|
|
7
|
+
import { default as customCode } from '../blocks/custom-code/index.js';
|
|
8
8
|
import { componentInfo as embedComponentInfo } from '../blocks/embed/component-info.js';
|
|
9
|
-
import { default as embed } from '../blocks/embed/
|
|
9
|
+
import { default as embed } from '../blocks/embed/index.js';
|
|
10
10
|
import { componentInfo as formComponentInfo } from '../blocks/form/form/component-info.js';
|
|
11
|
-
import { default as Form } from '../blocks/form/form/
|
|
11
|
+
import { default as Form } from '../blocks/form/form/index.js';
|
|
12
12
|
import { componentInfo as formInputComponentInfo } from '../blocks/form/input/component-info.js';
|
|
13
|
-
import { default as FormInput } from '../blocks/form/input/
|
|
13
|
+
import { default as FormInput } from '../blocks/form/input/index.js';
|
|
14
14
|
import { componentInfo as formSelectComponentInfo } from '../blocks/form/select/component-info.js';
|
|
15
|
-
import { default as FormSelect } from '../blocks/form/select/
|
|
15
|
+
import { default as FormSelect } from '../blocks/form/select/index.js';
|
|
16
16
|
import { componentInfo as formSubmitButtonComponentInfo } from '../blocks/form/submit-button/component-info.js';
|
|
17
|
-
import { default as FormSubmitButton } from '../blocks/form/submit-button/
|
|
17
|
+
import { default as FormSubmitButton } from '../blocks/form/submit-button/index.js';
|
|
18
18
|
import { componentInfo as imgComponentInfo } from '../blocks/img/component-info.js';
|
|
19
|
-
import { default as Img } from '../blocks/img/
|
|
19
|
+
import { default as Img } from '../blocks/img/index.js';
|
|
20
20
|
import { componentInfo as videoComponentInfo } from '../blocks/video/component-info.js';
|
|
21
|
-
import { default as Video } from '../blocks/video/
|
|
21
|
+
import { default as Video } from '../blocks/video/index.js';
|
|
22
22
|
import { TARGET } from './target.js';
|
|
23
23
|
export const getExtraComponents = () => [{
|
|
24
24
|
component: customCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.6";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
type QueryObject
|
|
2
|
-
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
1
|
+
import type { QueryObject } from '../../helpers/search/search.js';
|
|
3
2
|
/**
|
|
4
3
|
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
5
4
|
* relevant to the Builder SDK.
|
|
@@ -8,5 +7,3 @@ export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchP
|
|
|
8
7
|
*/
|
|
9
8
|
export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
|
|
10
9
|
export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
|
|
11
|
-
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
12
|
-
export {};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { normalizeSearchParams } from '../../helpers/search/search.js';
|
|
1
2
|
import { isBrowser } from '../is-browser.js';
|
|
2
3
|
const BUILDER_SEARCHPARAMS_PREFIX = 'builder.';
|
|
3
4
|
const BUILDER_OPTIONS_PREFIX = 'options.';
|
|
4
|
-
export const convertSearchParamsToQueryObject = (searchParams) => {
|
|
5
|
-
const options = {};
|
|
6
|
-
searchParams.forEach((value, key) => {
|
|
7
|
-
options[key] = value;
|
|
8
|
-
});
|
|
9
|
-
return options;
|
|
10
|
-
};
|
|
11
5
|
/**
|
|
12
6
|
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
13
7
|
* relevant to the Builder SDK.
|
|
@@ -35,4 +29,3 @@ export const getBuilderSearchParamsFromWindow = () => {
|
|
|
35
29
|
const searchParams = new URLSearchParams(window.location.search);
|
|
36
30
|
return getBuilderSearchParams(searchParams);
|
|
37
31
|
};
|
|
38
|
-
export const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { flatten } from '../../helpers/flatten.js';
|
|
2
|
+
import { normalizeSearchParams } from '../../helpers/search/search.js';
|
|
2
3
|
import { DEFAULT_API_VERSION } from '../../types/api-version.js';
|
|
3
|
-
import { getBuilderSearchParamsFromWindow
|
|
4
|
+
import { getBuilderSearchParamsFromWindow } from '../get-builder-search-params/index.js';
|
|
4
5
|
const isPositiveNumber = (thing) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
|
|
5
6
|
export const generateContentUrl = (options) => {
|
|
6
7
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isEditing(search?: Search): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../constants/target.js';
|
|
2
|
+
import { getSearchString } from '../helpers/search/search.js';
|
|
2
3
|
import { isIframe } from './is-iframe.js';
|
|
3
|
-
export function isEditing() {
|
|
4
|
-
return isIframe() && (TARGET === 'reactNative' || window.location.search.indexOf('builder.frameEditing=') !== -1);
|
|
4
|
+
export function isEditing(search) {
|
|
5
|
+
return isIframe() && (TARGET === 'reactNative' || getSearchString(search || window.location.search).indexOf('builder.frameEditing=') !== -1);
|
|
5
6
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isPreviewing(search?: Search): boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { getSearchString } from '../helpers/search/search.js';
|
|
1
2
|
import { isBrowser } from './is-browser.js';
|
|
2
3
|
import { isEditing } from './is-editing.js';
|
|
3
|
-
export function isPreviewing() {
|
|
4
|
+
export function isPreviewing(search) {
|
|
4
5
|
if (!isBrowser()) {
|
|
5
6
|
return false;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
9
|
+
if (isEditing(normalizedSearch)) {
|
|
8
10
|
return false;
|
|
9
11
|
}
|
|
10
|
-
return Boolean(
|
|
12
|
+
return Boolean(normalizedSearch.indexOf('builder.preview=') !== -1);
|
|
11
13
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type QueryObject = Record<string, string | string[]>;
|
|
2
|
+
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
3
|
+
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
4
|
+
export type Search = URLSearchParams | string | QueryObject;
|
|
5
|
+
export declare const getSearchString: (search: Search) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const convertSearchParamsToQueryObject = (searchParams) => {
|
|
2
|
+
const options = {};
|
|
3
|
+
searchParams.forEach((value, key) => {
|
|
4
|
+
options[key] = value;
|
|
5
|
+
});
|
|
6
|
+
return options;
|
|
7
|
+
};
|
|
8
|
+
export const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
9
|
+
export const getSearchString = (search) => {
|
|
10
|
+
if (typeof search === 'string') {
|
|
11
|
+
return search;
|
|
12
|
+
}
|
|
13
|
+
else if (search instanceof URLSearchParams) {
|
|
14
|
+
return search.toString();
|
|
15
|
+
}
|
|
16
|
+
return new URLSearchParams(search).toString();
|
|
17
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { default as Button } from '../blocks/button/
|
|
2
|
-
export { default as Columns } from '../blocks/columns/
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/
|
|
4
|
-
export { default as Image } from '../blocks/image/
|
|
5
|
-
export { default as Section } from '../blocks/section/
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/
|
|
7
|
-
export { default as Text } from '../blocks/text/
|
|
8
|
-
export { default as Video } from '../blocks/video/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { Blocks, Content };
|
|
1
|
+
export { default as Button } from '../blocks/button/index.js';
|
|
2
|
+
export { default as Columns } from '../blocks/columns/index.js';
|
|
3
|
+
export { default as Fragment } from '../blocks/fragment/index.js';
|
|
4
|
+
export { default as Image } from '../blocks/image/index.js';
|
|
5
|
+
export { default as Section } from '../blocks/section/index.js';
|
|
6
|
+
export { default as Symbol } from '../blocks/symbol/index.js';
|
|
7
|
+
export { default as Text } from '../blocks/text/index.js';
|
|
8
|
+
export { default as Video } from '../blocks/video/index.js';
|
|
9
|
+
export { default as Blocks } from '../components/blocks/index.js';
|
|
10
|
+
export { default as Content } from '../components/content-variants/index.js';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { default as Button } from '../blocks/button/
|
|
2
|
-
export { default as Columns } from '../blocks/columns/
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/
|
|
4
|
-
export { default as Image } from '../blocks/image/
|
|
5
|
-
export { default as Section } from '../blocks/section/
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/
|
|
7
|
-
export { default as Text } from '../blocks/text/
|
|
8
|
-
export { default as Video } from '../blocks/video/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { Blocks, Content };
|
|
1
|
+
export { default as Button } from '../blocks/button/index.js';
|
|
2
|
+
export { default as Columns } from '../blocks/columns/index.js';
|
|
3
|
+
export { default as Fragment } from '../blocks/fragment/index.js';
|
|
4
|
+
export { default as Image } from '../blocks/image/index.js';
|
|
5
|
+
export { default as Section } from '../blocks/section/index.js';
|
|
6
|
+
export { default as Symbol } from '../blocks/symbol/index.js';
|
|
7
|
+
export { default as Text } from '../blocks/text/index.js';
|
|
8
|
+
export { default as Video } from '../blocks/video/index.js';
|
|
9
|
+
export { default as Blocks } from '../components/blocks/index.js';
|
|
10
|
+
export { default as Content } from '../components/content-variants/index.js';
|
package/lib/edge/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
/**
|
|
3
|
+
* In the React SDK, this file is marked with `use client`.
|
|
4
|
+
*/
|
|
2
5
|
export * from './index-helpers/blocks-exports.js';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
7
|
+
* In the React SDK, this file is not marked with `use client`, to allow
|
|
8
|
+
* NextJS App Directory to use the SDK helper functions without issues.
|
|
6
9
|
*/
|
|
7
10
|
export * from './server-index.js';
|
package/lib/edge/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// ignore prettier formatting for this file because the order of exports is meaningful
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
export * from './index-helpers/top-of-file.js';
|
|
4
|
+
/**
|
|
5
|
+
* In the React SDK, this file is marked with `use client`.
|
|
6
|
+
*/
|
|
4
7
|
// prettier-ignore
|
|
5
8
|
export * from './index-helpers/blocks-exports.js';
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
10
|
+
* In the React SDK, this file is not marked with `use client`, to allow
|
|
11
|
+
* NextJS App Directory to use the SDK helper functions without issues.
|
|
9
12
|
*/
|
|
10
13
|
export * from './server-index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './button.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './button.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './columns.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './columns.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './custom-code.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './custom-code.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './embed.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './embed.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './form.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './form.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './input.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './input.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './select.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './select.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './submit-button.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './submit-button.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './fragment.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './fragment.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './image.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './image.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './img.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './img.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './raw-text.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './raw-text.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './section.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './section.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './slot.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './slot.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './symbol.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './symbol.svelte';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
|
-
import ContentVariants from "../../components/content-variants/
|
|
2
|
+
import ContentVariants from "../../components/content-variants/index.js";
|
|
3
3
|
import { filterAttrs } from "../helpers.js";
|
|
4
4
|
import { getClassPropName } from "../../functions/get-class-prop-name.js";
|
|
5
5
|
import { setAttrs } from "../helpers.js";
|
|
@@ -66,5 +66,7 @@ $: onUpdateFn_0(...[symbol]);
|
|
|
66
66
|
model={symbol?.model}
|
|
67
67
|
content={contentToUse}
|
|
68
68
|
linkComponent={builderLinkComponent}
|
|
69
|
+
blocksWrapper={"div"}
|
|
70
|
+
contentWrapper={"div"}
|
|
69
71
|
/>
|
|
70
72
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './text.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './text.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './textarea.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './textarea.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './video.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './video.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './blocks.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './blocks.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './content-variants.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './content-variants.svelte';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { default as Button } from '../blocks/button/button.svelte';
|
|
2
1
|
import { componentInfo as buttonComponentInfo } from '../blocks/button/component-info.js';
|
|
3
|
-
import { default as
|
|
2
|
+
import { default as Button } from '../blocks/button/index.js';
|
|
4
3
|
import { componentInfo as columnsComponentInfo } from '../blocks/columns/component-info.js';
|
|
4
|
+
import { default as Columns } from '../blocks/columns/index.js';
|
|
5
5
|
import { componentInfo as fragmentComponentInfo } from '../blocks/fragment/component-info.js';
|
|
6
|
-
import { default as Fragment } from '../blocks/fragment/
|
|
6
|
+
import { default as Fragment } from '../blocks/fragment/index.js';
|
|
7
7
|
import { componentInfo as imageComponentInfo } from '../blocks/image/component-info.js';
|
|
8
|
-
import { default as Image } from '../blocks/image/
|
|
8
|
+
import { default as Image } from '../blocks/image/index.js';
|
|
9
9
|
import { componentInfo as sectionComponentInfo } from '../blocks/section/component-info.js';
|
|
10
|
-
import { default as Section } from '../blocks/section/
|
|
10
|
+
import { default as Section } from '../blocks/section/index.js';
|
|
11
11
|
import { componentInfo as slotComponentInfo } from '../blocks/slot/component-info.js';
|
|
12
|
-
import { default as Slot } from '../blocks/slot/
|
|
12
|
+
import { default as Slot } from '../blocks/slot/index.js';
|
|
13
13
|
import { componentInfo as symbolComponentInfo } from '../blocks/symbol/component-info.js';
|
|
14
|
-
import { default as Symbol } from '../blocks/symbol/
|
|
14
|
+
import { default as Symbol } from '../blocks/symbol/index.js';
|
|
15
15
|
import { componentInfo as textComponentInfo } from '../blocks/text/component-info.js';
|
|
16
|
-
import { default as Text } from '../blocks/text/
|
|
16
|
+
import { default as Text } from '../blocks/text/index.js';
|
|
17
17
|
import { getExtraComponents } from './extra-components.js';
|
|
18
18
|
/**
|
|
19
19
|
* Returns a list of all registered components.
|
|
@@ -4,21 +4,21 @@
|
|
|
4
4
|
* React Native SDK.
|
|
5
5
|
*/
|
|
6
6
|
import { componentInfo as customCodeInfo } from '../blocks/custom-code/component-info.js';
|
|
7
|
-
import { default as customCode } from '../blocks/custom-code/
|
|
7
|
+
import { default as customCode } from '../blocks/custom-code/index.js';
|
|
8
8
|
import { componentInfo as embedComponentInfo } from '../blocks/embed/component-info.js';
|
|
9
|
-
import { default as embed } from '../blocks/embed/
|
|
9
|
+
import { default as embed } from '../blocks/embed/index.js';
|
|
10
10
|
import { componentInfo as formComponentInfo } from '../blocks/form/form/component-info.js';
|
|
11
|
-
import { default as Form } from '../blocks/form/form/
|
|
11
|
+
import { default as Form } from '../blocks/form/form/index.js';
|
|
12
12
|
import { componentInfo as formInputComponentInfo } from '../blocks/form/input/component-info.js';
|
|
13
|
-
import { default as FormInput } from '../blocks/form/input/
|
|
13
|
+
import { default as FormInput } from '../blocks/form/input/index.js';
|
|
14
14
|
import { componentInfo as formSelectComponentInfo } from '../blocks/form/select/component-info.js';
|
|
15
|
-
import { default as FormSelect } from '../blocks/form/select/
|
|
15
|
+
import { default as FormSelect } from '../blocks/form/select/index.js';
|
|
16
16
|
import { componentInfo as formSubmitButtonComponentInfo } from '../blocks/form/submit-button/component-info.js';
|
|
17
|
-
import { default as FormSubmitButton } from '../blocks/form/submit-button/
|
|
17
|
+
import { default as FormSubmitButton } from '../blocks/form/submit-button/index.js';
|
|
18
18
|
import { componentInfo as imgComponentInfo } from '../blocks/img/component-info.js';
|
|
19
|
-
import { default as Img } from '../blocks/img/
|
|
19
|
+
import { default as Img } from '../blocks/img/index.js';
|
|
20
20
|
import { componentInfo as videoComponentInfo } from '../blocks/video/component-info.js';
|
|
21
|
-
import { default as Video } from '../blocks/video/
|
|
21
|
+
import { default as Video } from '../blocks/video/index.js';
|
|
22
22
|
import { TARGET } from './target.js';
|
|
23
23
|
export const getExtraComponents = () => [{
|
|
24
24
|
component: customCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.6";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
type QueryObject
|
|
2
|
-
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
1
|
+
import type { QueryObject } from '../../helpers/search/search.js';
|
|
3
2
|
/**
|
|
4
3
|
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
5
4
|
* relevant to the Builder SDK.
|
|
@@ -8,5 +7,3 @@ export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchP
|
|
|
8
7
|
*/
|
|
9
8
|
export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
|
|
10
9
|
export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
|
|
11
|
-
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
12
|
-
export {};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { normalizeSearchParams } from '../../helpers/search/search.js';
|
|
1
2
|
import { isBrowser } from '../is-browser.js';
|
|
2
3
|
const BUILDER_SEARCHPARAMS_PREFIX = 'builder.';
|
|
3
4
|
const BUILDER_OPTIONS_PREFIX = 'options.';
|
|
4
|
-
export const convertSearchParamsToQueryObject = (searchParams) => {
|
|
5
|
-
const options = {};
|
|
6
|
-
searchParams.forEach((value, key) => {
|
|
7
|
-
options[key] = value;
|
|
8
|
-
});
|
|
9
|
-
return options;
|
|
10
|
-
};
|
|
11
5
|
/**
|
|
12
6
|
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
13
7
|
* relevant to the Builder SDK.
|
|
@@ -35,4 +29,3 @@ export const getBuilderSearchParamsFromWindow = () => {
|
|
|
35
29
|
const searchParams = new URLSearchParams(window.location.search);
|
|
36
30
|
return getBuilderSearchParams(searchParams);
|
|
37
31
|
};
|
|
38
|
-
export const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { flatten } from '../../helpers/flatten.js';
|
|
2
|
+
import { normalizeSearchParams } from '../../helpers/search/search.js';
|
|
2
3
|
import { DEFAULT_API_VERSION } from '../../types/api-version.js';
|
|
3
|
-
import { getBuilderSearchParamsFromWindow
|
|
4
|
+
import { getBuilderSearchParamsFromWindow } from '../get-builder-search-params/index.js';
|
|
4
5
|
const isPositiveNumber = (thing) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
|
|
5
6
|
export const generateContentUrl = (options) => {
|
|
6
7
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isEditing(search?: Search): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../constants/target.js';
|
|
2
|
+
import { getSearchString } from '../helpers/search/search.js';
|
|
2
3
|
import { isIframe } from './is-iframe.js';
|
|
3
|
-
export function isEditing() {
|
|
4
|
-
return isIframe() && (TARGET === 'reactNative' || window.location.search.indexOf('builder.frameEditing=') !== -1);
|
|
4
|
+
export function isEditing(search) {
|
|
5
|
+
return isIframe() && (TARGET === 'reactNative' || getSearchString(search || window.location.search).indexOf('builder.frameEditing=') !== -1);
|
|
5
6
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isPreviewing(search?: Search): boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { getSearchString } from '../helpers/search/search.js';
|
|
1
2
|
import { isBrowser } from './is-browser.js';
|
|
2
3
|
import { isEditing } from './is-editing.js';
|
|
3
|
-
export function isPreviewing() {
|
|
4
|
+
export function isPreviewing(search) {
|
|
4
5
|
if (!isBrowser()) {
|
|
5
6
|
return false;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
9
|
+
if (isEditing(normalizedSearch)) {
|
|
8
10
|
return false;
|
|
9
11
|
}
|
|
10
|
-
return Boolean(
|
|
12
|
+
return Boolean(normalizedSearch.indexOf('builder.preview=') !== -1);
|
|
11
13
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type QueryObject = Record<string, string | string[]>;
|
|
2
|
+
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
3
|
+
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
4
|
+
export type Search = URLSearchParams | string | QueryObject;
|
|
5
|
+
export declare const getSearchString: (search: Search) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const convertSearchParamsToQueryObject = (searchParams) => {
|
|
2
|
+
const options = {};
|
|
3
|
+
searchParams.forEach((value, key) => {
|
|
4
|
+
options[key] = value;
|
|
5
|
+
});
|
|
6
|
+
return options;
|
|
7
|
+
};
|
|
8
|
+
export const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
9
|
+
export const getSearchString = (search) => {
|
|
10
|
+
if (typeof search === 'string') {
|
|
11
|
+
return search;
|
|
12
|
+
}
|
|
13
|
+
else if (search instanceof URLSearchParams) {
|
|
14
|
+
return search.toString();
|
|
15
|
+
}
|
|
16
|
+
return new URLSearchParams(search).toString();
|
|
17
|
+
};
|