@builder.io/sdk-svelte 2.0.23 → 2.0.25
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/components/blocks/blocks-wrapper.svelte +4 -1
- package/lib/browser/components/blocks/blocks.svelte +5 -3
- package/lib/browser/components/blocks/blocks.svelte.d.ts +1 -0
- package/lib/browser/components/blocks/blocks.types.d.ts +2 -1
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/get-content/index.js +9 -1
- package/lib/browser/functions/track/index.js +3 -1
- package/lib/browser/helpers/sdk-headers.d.ts +5 -0
- package/lib/browser/helpers/sdk-headers.js +7 -0
- package/lib/edge/components/blocks/blocks-wrapper.svelte +4 -1
- package/lib/edge/components/blocks/blocks.svelte +5 -3
- package/lib/edge/components/blocks/blocks.svelte.d.ts +1 -0
- package/lib/edge/components/blocks/blocks.types.d.ts +2 -1
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/get-content/index.js +9 -1
- package/lib/edge/functions/track/index.js +3 -1
- package/lib/edge/helpers/sdk-headers.d.ts +5 -0
- package/lib/edge/helpers/sdk-headers.js +7 -0
- package/lib/node/components/blocks/blocks-wrapper.svelte +4 -1
- package/lib/node/components/blocks/blocks.svelte +5 -3
- package/lib/node/components/blocks/blocks.svelte.d.ts +1 -0
- package/lib/node/components/blocks/blocks.types.d.ts +2 -1
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/get-content/index.js +9 -1
- package/lib/node/functions/track/index.js +3 -1
- package/lib/node/helpers/sdk-headers.d.ts +5 -0
- package/lib/node/helpers/sdk-headers.js +7 -0
- package/package.json +1 -1
- package/src/components/blocks/blocks-wrapper.svelte +5 -1
- package/src/components/blocks/blocks.svelte +5 -3
- package/src/components/blocks/blocks.types.ts +2 -1
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/get-content/index.ts +9 -1
- package/src/functions/track/index.ts +3 -1
- package/src/helpers/sdk-headers.ts +7 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<script>import { onMount } from "svelte";
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
|
+
export let classNameProp = undefined;
|
|
6
7
|
export let parent;
|
|
7
8
|
export let path;
|
|
8
9
|
export let styleProp;
|
|
@@ -41,7 +42,9 @@ function onMouseEnter() {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
$: className = () => {
|
|
44
|
-
return "builder-blocks"
|
|
45
|
+
return ["builder-blocks", !blocks?.length ? "no-blocks" : "", classNameProp]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(" ");
|
|
45
48
|
};
|
|
46
49
|
let blocksWrapperRef;
|
|
47
50
|
onMount(() => { });
|
|
@@ -7,6 +7,7 @@ export let blocks;
|
|
|
7
7
|
export let parent;
|
|
8
8
|
export let path;
|
|
9
9
|
export let styleProp;
|
|
10
|
+
export let className = undefined;
|
|
10
11
|
export let context = undefined;
|
|
11
12
|
export let linkComponent = undefined;
|
|
12
13
|
export let registeredComponents = undefined;
|
|
@@ -19,9 +20,10 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
19
20
|
{parent}
|
|
20
21
|
{path}
|
|
21
22
|
{styleProp}
|
|
22
|
-
|
|
23
|
+
classNameProp={className}
|
|
24
|
+
BlocksWrapper={$context?.BlocksWrapper || $builderContext?.BlocksWrapper}
|
|
23
25
|
BlocksWrapperProps={$context?.BlocksWrapperProps ||
|
|
24
|
-
$builderContext
|
|
26
|
+
$builderContext?.BlocksWrapperProps}
|
|
25
27
|
>
|
|
26
28
|
{#if blocks}
|
|
27
29
|
{#each blocks as block (block.id)}
|
|
@@ -30,7 +32,7 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
30
32
|
{linkComponent}
|
|
31
33
|
context={context || builderContext}
|
|
32
34
|
registeredComponents={registeredComponents ||
|
|
33
|
-
componentsContext
|
|
35
|
+
componentsContext?.registeredComponents}
|
|
34
36
|
/>
|
|
35
37
|
{/each}
|
|
36
38
|
{/if}</BlocksWrapper
|
|
@@ -6,6 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
parent: BlocksProps["parent"];
|
|
7
7
|
path: BlocksProps["path"];
|
|
8
8
|
styleProp: BlocksProps["styleProp"];
|
|
9
|
+
className?: BlocksProps["className"];
|
|
9
10
|
context?: BlocksProps["context"];
|
|
10
11
|
linkComponent?: BlocksProps["linkComponent"];
|
|
11
12
|
registeredComponents?: BlocksProps["registeredComponents"];
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import type { Writable } from "svelte/store";
|
|
3
3
|
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types';
|
|
4
4
|
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
5
|
-
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
5
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps' | 'classNameProp'>> & {
|
|
6
6
|
context?: Writable<BuilderContextInterface>;
|
|
7
7
|
registeredComponents?: RegisteredComponents;
|
|
8
8
|
linkComponent?: any;
|
|
9
|
+
className?: string;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.25";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.25";
|
|
@@ -3,6 +3,7 @@ import { handleABTesting } from '../../helpers/ab-tests';
|
|
|
3
3
|
import { getDefaultCanTrack } from '../../helpers/canTrack';
|
|
4
4
|
import { logger } from '../../helpers/logger';
|
|
5
5
|
import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
|
|
6
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
6
7
|
import { fetch } from '../get-fetch';
|
|
7
8
|
import { isBrowser } from '../is-browser';
|
|
8
9
|
import { generateContentUrl } from './generate-content-url';
|
|
@@ -23,7 +24,14 @@ export async function fetchOneEntry(options) {
|
|
|
23
24
|
const _fetchContent = async (options) => {
|
|
24
25
|
const url = generateContentUrl(options);
|
|
25
26
|
const _fetch = options.fetch ?? fetch;
|
|
26
|
-
const
|
|
27
|
+
const fetchOptions = {
|
|
28
|
+
...options.fetchOptions,
|
|
29
|
+
headers: {
|
|
30
|
+
...options.fetchOptions?.headers,
|
|
31
|
+
...getSdkHeaders()
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const res = await _fetch(url.href, fetchOptions);
|
|
27
35
|
const content = await res.json();
|
|
28
36
|
return content;
|
|
29
37
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../../constants/target';
|
|
2
2
|
import { logger } from '../../helpers/logger';
|
|
3
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
3
4
|
import { getSessionId } from '../../helpers/sessionId';
|
|
4
5
|
import { getVisitorId } from '../../helpers/visitorId';
|
|
5
6
|
import { isBrowser } from '../is-browser';
|
|
@@ -58,7 +59,8 @@ export async function _track(eventProps) {
|
|
|
58
59
|
events: [await createEvent(eventProps)]
|
|
59
60
|
}),
|
|
60
61
|
headers: {
|
|
61
|
-
'content-type': 'application/json'
|
|
62
|
+
'content-type': 'application/json',
|
|
63
|
+
...getSdkHeaders()
|
|
62
64
|
},
|
|
63
65
|
mode: 'cors'
|
|
64
66
|
}).catch(err => {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<script>import { onMount } from "svelte";
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
|
+
export let classNameProp = undefined;
|
|
6
7
|
export let parent;
|
|
7
8
|
export let path;
|
|
8
9
|
export let styleProp;
|
|
@@ -41,7 +42,9 @@ function onMouseEnter() {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
$: className = () => {
|
|
44
|
-
return "builder-blocks"
|
|
45
|
+
return ["builder-blocks", !blocks?.length ? "no-blocks" : "", classNameProp]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(" ");
|
|
45
48
|
};
|
|
46
49
|
let blocksWrapperRef;
|
|
47
50
|
onMount(() => { });
|
|
@@ -7,6 +7,7 @@ export let blocks;
|
|
|
7
7
|
export let parent;
|
|
8
8
|
export let path;
|
|
9
9
|
export let styleProp;
|
|
10
|
+
export let className = undefined;
|
|
10
11
|
export let context = undefined;
|
|
11
12
|
export let linkComponent = undefined;
|
|
12
13
|
export let registeredComponents = undefined;
|
|
@@ -19,9 +20,10 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
19
20
|
{parent}
|
|
20
21
|
{path}
|
|
21
22
|
{styleProp}
|
|
22
|
-
|
|
23
|
+
classNameProp={className}
|
|
24
|
+
BlocksWrapper={$context?.BlocksWrapper || $builderContext?.BlocksWrapper}
|
|
23
25
|
BlocksWrapperProps={$context?.BlocksWrapperProps ||
|
|
24
|
-
$builderContext
|
|
26
|
+
$builderContext?.BlocksWrapperProps}
|
|
25
27
|
>
|
|
26
28
|
{#if blocks}
|
|
27
29
|
{#each blocks as block (block.id)}
|
|
@@ -30,7 +32,7 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
30
32
|
{linkComponent}
|
|
31
33
|
context={context || builderContext}
|
|
32
34
|
registeredComponents={registeredComponents ||
|
|
33
|
-
componentsContext
|
|
35
|
+
componentsContext?.registeredComponents}
|
|
34
36
|
/>
|
|
35
37
|
{/each}
|
|
36
38
|
{/if}</BlocksWrapper
|
|
@@ -6,6 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
parent: BlocksProps["parent"];
|
|
7
7
|
path: BlocksProps["path"];
|
|
8
8
|
styleProp: BlocksProps["styleProp"];
|
|
9
|
+
className?: BlocksProps["className"];
|
|
9
10
|
context?: BlocksProps["context"];
|
|
10
11
|
linkComponent?: BlocksProps["linkComponent"];
|
|
11
12
|
registeredComponents?: BlocksProps["registeredComponents"];
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import type { Writable } from "svelte/store";
|
|
3
3
|
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types';
|
|
4
4
|
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
5
|
-
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
5
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps' | 'classNameProp'>> & {
|
|
6
6
|
context?: Writable<BuilderContextInterface>;
|
|
7
7
|
registeredComponents?: RegisteredComponents;
|
|
8
8
|
linkComponent?: any;
|
|
9
|
+
className?: string;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.25";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.25";
|
|
@@ -3,6 +3,7 @@ import { handleABTesting } from '../../helpers/ab-tests';
|
|
|
3
3
|
import { getDefaultCanTrack } from '../../helpers/canTrack';
|
|
4
4
|
import { logger } from '../../helpers/logger';
|
|
5
5
|
import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
|
|
6
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
6
7
|
import { fetch } from '../get-fetch';
|
|
7
8
|
import { isBrowser } from '../is-browser';
|
|
8
9
|
import { generateContentUrl } from './generate-content-url';
|
|
@@ -23,7 +24,14 @@ export async function fetchOneEntry(options) {
|
|
|
23
24
|
const _fetchContent = async (options) => {
|
|
24
25
|
const url = generateContentUrl(options);
|
|
25
26
|
const _fetch = options.fetch ?? fetch;
|
|
26
|
-
const
|
|
27
|
+
const fetchOptions = {
|
|
28
|
+
...options.fetchOptions,
|
|
29
|
+
headers: {
|
|
30
|
+
...options.fetchOptions?.headers,
|
|
31
|
+
...getSdkHeaders()
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const res = await _fetch(url.href, fetchOptions);
|
|
27
35
|
const content = await res.json();
|
|
28
36
|
return content;
|
|
29
37
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../../constants/target';
|
|
2
2
|
import { logger } from '../../helpers/logger';
|
|
3
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
3
4
|
import { getSessionId } from '../../helpers/sessionId';
|
|
4
5
|
import { getVisitorId } from '../../helpers/visitorId';
|
|
5
6
|
import { isBrowser } from '../is-browser';
|
|
@@ -58,7 +59,8 @@ export async function _track(eventProps) {
|
|
|
58
59
|
events: [await createEvent(eventProps)]
|
|
59
60
|
}),
|
|
60
61
|
headers: {
|
|
61
|
-
'content-type': 'application/json'
|
|
62
|
+
'content-type': 'application/json',
|
|
63
|
+
...getSdkHeaders()
|
|
62
64
|
},
|
|
63
65
|
mode: 'cors'
|
|
64
66
|
}).catch(err => {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<script>import { onMount } from "svelte";
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
|
+
export let classNameProp = undefined;
|
|
6
7
|
export let parent;
|
|
7
8
|
export let path;
|
|
8
9
|
export let styleProp;
|
|
@@ -41,7 +42,9 @@ function onMouseEnter() {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
$: className = () => {
|
|
44
|
-
return "builder-blocks"
|
|
45
|
+
return ["builder-blocks", !blocks?.length ? "no-blocks" : "", classNameProp]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(" ");
|
|
45
48
|
};
|
|
46
49
|
let blocksWrapperRef;
|
|
47
50
|
onMount(() => { });
|
|
@@ -7,6 +7,7 @@ export let blocks;
|
|
|
7
7
|
export let parent;
|
|
8
8
|
export let path;
|
|
9
9
|
export let styleProp;
|
|
10
|
+
export let className = undefined;
|
|
10
11
|
export let context = undefined;
|
|
11
12
|
export let linkComponent = undefined;
|
|
12
13
|
export let registeredComponents = undefined;
|
|
@@ -19,9 +20,10 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
19
20
|
{parent}
|
|
20
21
|
{path}
|
|
21
22
|
{styleProp}
|
|
22
|
-
|
|
23
|
+
classNameProp={className}
|
|
24
|
+
BlocksWrapper={$context?.BlocksWrapper || $builderContext?.BlocksWrapper}
|
|
23
25
|
BlocksWrapperProps={$context?.BlocksWrapperProps ||
|
|
24
|
-
$builderContext
|
|
26
|
+
$builderContext?.BlocksWrapperProps}
|
|
25
27
|
>
|
|
26
28
|
{#if blocks}
|
|
27
29
|
{#each blocks as block (block.id)}
|
|
@@ -30,7 +32,7 @@ let componentsContext = getContext(ComponentsContext.key);
|
|
|
30
32
|
{linkComponent}
|
|
31
33
|
context={context || builderContext}
|
|
32
34
|
registeredComponents={registeredComponents ||
|
|
33
|
-
componentsContext
|
|
35
|
+
componentsContext?.registeredComponents}
|
|
34
36
|
/>
|
|
35
37
|
{/each}
|
|
36
38
|
{/if}</BlocksWrapper
|
|
@@ -6,6 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
parent: BlocksProps["parent"];
|
|
7
7
|
path: BlocksProps["path"];
|
|
8
8
|
styleProp: BlocksProps["styleProp"];
|
|
9
|
+
className?: BlocksProps["className"];
|
|
9
10
|
context?: BlocksProps["context"];
|
|
10
11
|
linkComponent?: BlocksProps["linkComponent"];
|
|
11
12
|
registeredComponents?: BlocksProps["registeredComponents"];
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import type { Writable } from "svelte/store";
|
|
3
3
|
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types';
|
|
4
4
|
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
5
|
-
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
5
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps' | 'classNameProp'>> & {
|
|
6
6
|
context?: Writable<BuilderContextInterface>;
|
|
7
7
|
registeredComponents?: RegisteredComponents;
|
|
8
8
|
linkComponent?: any;
|
|
9
|
+
className?: string;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.25";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.25";
|
|
@@ -3,6 +3,7 @@ import { handleABTesting } from '../../helpers/ab-tests';
|
|
|
3
3
|
import { getDefaultCanTrack } from '../../helpers/canTrack';
|
|
4
4
|
import { logger } from '../../helpers/logger';
|
|
5
5
|
import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
|
|
6
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
6
7
|
import { fetch } from '../get-fetch';
|
|
7
8
|
import { isBrowser } from '../is-browser';
|
|
8
9
|
import { generateContentUrl } from './generate-content-url';
|
|
@@ -23,7 +24,14 @@ export async function fetchOneEntry(options) {
|
|
|
23
24
|
const _fetchContent = async (options) => {
|
|
24
25
|
const url = generateContentUrl(options);
|
|
25
26
|
const _fetch = options.fetch ?? fetch;
|
|
26
|
-
const
|
|
27
|
+
const fetchOptions = {
|
|
28
|
+
...options.fetchOptions,
|
|
29
|
+
headers: {
|
|
30
|
+
...options.fetchOptions?.headers,
|
|
31
|
+
...getSdkHeaders()
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const res = await _fetch(url.href, fetchOptions);
|
|
27
35
|
const content = await res.json();
|
|
28
36
|
return content;
|
|
29
37
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../../constants/target';
|
|
2
2
|
import { logger } from '../../helpers/logger';
|
|
3
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
3
4
|
import { getSessionId } from '../../helpers/sessionId';
|
|
4
5
|
import { getVisitorId } from '../../helpers/visitorId';
|
|
5
6
|
import { isBrowser } from '../is-browser';
|
|
@@ -58,7 +59,8 @@ export async function _track(eventProps) {
|
|
|
58
59
|
events: [await createEvent(eventProps)]
|
|
59
60
|
}),
|
|
60
61
|
headers: {
|
|
61
|
-
'content-type': 'application/json'
|
|
62
|
+
'content-type': 'application/json',
|
|
63
|
+
...getSdkHeaders()
|
|
62
64
|
},
|
|
63
65
|
mode: 'cors'
|
|
64
66
|
}).catch(err => {
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
BlocksWrapperProps: any;
|
|
15
15
|
children?: any;
|
|
16
|
+
classNameProp?: string;
|
|
16
17
|
};
|
|
17
18
|
</script>
|
|
18
19
|
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
import type { BuilderBlock } from "../../types/builder-block";
|
|
24
25
|
|
|
25
26
|
export let blocks: BlocksWrapperProps["blocks"];
|
|
27
|
+
export let classNameProp: BlocksWrapperProps["classNameProp"] = undefined;
|
|
26
28
|
export let parent: BlocksWrapperProps["parent"];
|
|
27
29
|
export let path: BlocksWrapperProps["path"];
|
|
28
30
|
export let styleProp: BlocksWrapperProps["styleProp"];
|
|
@@ -69,7 +71,9 @@
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
$: className = () => {
|
|
72
|
-
return "builder-blocks"
|
|
74
|
+
return ["builder-blocks", !blocks?.length ? "no-blocks" : "", classNameProp]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(" ");
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
let blocksWrapperRef;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let parent: BlocksProps["parent"];
|
|
12
12
|
export let path: BlocksProps["path"];
|
|
13
13
|
export let styleProp: BlocksProps["styleProp"];
|
|
14
|
+
export let className: BlocksProps["className"] = undefined;
|
|
14
15
|
export let context: BlocksProps["context"] = undefined;
|
|
15
16
|
export let linkComponent: BlocksProps["linkComponent"] = undefined;
|
|
16
17
|
export let registeredComponents: BlocksProps["registeredComponents"] =
|
|
@@ -25,9 +26,10 @@
|
|
|
25
26
|
{parent}
|
|
26
27
|
{path}
|
|
27
28
|
{styleProp}
|
|
28
|
-
|
|
29
|
+
classNameProp={className}
|
|
30
|
+
BlocksWrapper={$context?.BlocksWrapper || $builderContext?.BlocksWrapper}
|
|
29
31
|
BlocksWrapperProps={$context?.BlocksWrapperProps ||
|
|
30
|
-
$builderContext
|
|
32
|
+
$builderContext?.BlocksWrapperProps}
|
|
31
33
|
>
|
|
32
34
|
{#if blocks}
|
|
33
35
|
{#each blocks as block (block.id)}
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
{linkComponent}
|
|
37
39
|
context={context || builderContext}
|
|
38
40
|
registeredComponents={registeredComponents ||
|
|
39
|
-
componentsContext
|
|
41
|
+
componentsContext?.registeredComponents}
|
|
40
42
|
/>
|
|
41
43
|
{/each}
|
|
42
44
|
{/if}</BlocksWrapper
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Writable } from "svelte/store";
|
|
2
2
|
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types';
|
|
3
3
|
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
4
|
-
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
4
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps' | 'classNameProp'>> & {
|
|
5
5
|
context?: Writable<BuilderContextInterface>;
|
|
6
6
|
registeredComponents?: RegisteredComponents;
|
|
7
7
|
linkComponent?: any;
|
|
8
|
+
className?: string;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.25"
|
|
@@ -3,6 +3,7 @@ import { handleABTesting } from '../../helpers/ab-tests';
|
|
|
3
3
|
import { getDefaultCanTrack } from '../../helpers/canTrack';
|
|
4
4
|
import { logger } from '../../helpers/logger';
|
|
5
5
|
import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
|
|
6
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
6
7
|
import type { BuilderContent } from '../../types/builder-content';
|
|
7
8
|
import { fetch } from '../get-fetch';
|
|
8
9
|
import { isBrowser } from '../is-browser';
|
|
@@ -33,7 +34,14 @@ type ContentResponse = ContentResults | {
|
|
|
33
34
|
const _fetchContent = async (options: GetContentOptions) => {
|
|
34
35
|
const url = generateContentUrl(options);
|
|
35
36
|
const _fetch = options.fetch ?? fetch;
|
|
36
|
-
const
|
|
37
|
+
const fetchOptions = {
|
|
38
|
+
...options.fetchOptions,
|
|
39
|
+
headers: {
|
|
40
|
+
...(options.fetchOptions as any)?.headers,
|
|
41
|
+
...getSdkHeaders()
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const res = await _fetch(url.href, fetchOptions);
|
|
37
45
|
const content = await (res.json() as Promise<ContentResponse>);
|
|
38
46
|
return content;
|
|
39
47
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TARGET } from '../../constants/target';
|
|
2
2
|
import { logger } from '../../helpers/logger';
|
|
3
|
+
import { getSdkHeaders } from '../../helpers/sdk-headers';
|
|
3
4
|
import { getSessionId } from '../../helpers/sessionId';
|
|
4
5
|
import { getVisitorId } from '../../helpers/visitorId';
|
|
5
6
|
import type { CanTrack } from '../../types/can-track';
|
|
@@ -118,7 +119,8 @@ export async function _track(eventProps: EventProps) {
|
|
|
118
119
|
events: [await createEvent(eventProps)]
|
|
119
120
|
}),
|
|
120
121
|
headers: {
|
|
121
|
-
'content-type': 'application/json'
|
|
122
|
+
'content-type': 'application/json',
|
|
123
|
+
...getSdkHeaders()
|
|
122
124
|
},
|
|
123
125
|
mode: 'cors'
|
|
124
126
|
}).catch(err => {
|