@builder.io/sdk-svelte 5.2.2 → 5.2.3
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/content-variants/content-variants.svelte +9 -15
- package/lib/browser/components/content-variants/helpers.d.ts +0 -1
- package/lib/browser/components/content-variants/helpers.js +0 -31
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/edge/components/content-variants/content-variants.svelte +9 -15
- package/lib/edge/components/content-variants/helpers.d.ts +0 -1
- package/lib/edge/components/content-variants/helpers.js +0 -31
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/node/components/content-variants/content-variants.svelte +9 -15
- package/lib/node/components/content-variants/helpers.d.ts +0 -1
- package/lib/node/components/content-variants/helpers.js +0 -31
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/package.json +1 -1
- package/src/components/content-variants/content-variants.svelte +8 -15
- package/src/components/content-variants/helpers.ts +0 -31
- package/src/constants/sdk-version.ts +1 -1
|
@@ -8,7 +8,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
|
8
8
|
import ContentComponent from "../content/content.svelte";
|
|
9
9
|
import InlinedScript from "../inlined-script.svelte";
|
|
10
10
|
import InlinedStyles from "../inlined-styles.svelte";
|
|
11
|
-
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants,
|
|
11
|
+
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers";
|
|
12
12
|
export let canTrack = undefined;
|
|
13
13
|
export let content;
|
|
14
14
|
export let isNestedRender = undefined;
|
|
@@ -65,23 +65,17 @@ onMount(() => {
|
|
|
65
65
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
66
66
|
<InlinedScript
|
|
67
67
|
id="builderio-init-variants-fns"
|
|
68
|
-
scriptStr={
|
|
69
|
-
"builderio-init-variants-fns",
|
|
70
|
-
getInitVariantsFnsScriptString()
|
|
71
|
-
)}
|
|
68
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
72
69
|
nonce={nonce || ""}
|
|
73
70
|
/>
|
|
74
|
-
{/if}
|
|
75
71
|
|
|
76
|
-
{#if
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)}
|
|
84
|
-
/>
|
|
72
|
+
{#if SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}
|
|
73
|
+
<InlinedScript
|
|
74
|
+
id="builderio-init-personalization-variants-fns"
|
|
75
|
+
nonce={nonce || ""}
|
|
76
|
+
scriptStr={getInitPersonalizationVariantsFnsScriptString()}
|
|
77
|
+
/>
|
|
78
|
+
{/if}
|
|
85
79
|
{/if}
|
|
86
80
|
|
|
87
81
|
{#if shouldRenderVariants}
|
|
@@ -32,7 +32,6 @@ type VariantData = {
|
|
|
32
32
|
id: string;
|
|
33
33
|
testRatio?: number;
|
|
34
34
|
};
|
|
35
|
-
export declare const removeDuplicateScript: (id: string, scriptStr: string) => string;
|
|
36
35
|
export declare const getInitVariantsFnsScriptString: () => string;
|
|
37
36
|
export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
|
|
38
37
|
export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
|
|
@@ -43,37 +43,6 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
43
43
|
const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
|
|
44
44
|
const isAngularSDK = TARGET === 'angular';
|
|
45
45
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
46
|
-
export const removeDuplicateScript = (id, scriptStr) => `
|
|
47
|
-
(function() {
|
|
48
|
-
var selector = 'script[data-id="${id}"]';
|
|
49
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
50
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
51
|
-
|
|
52
|
-
// Synchronously remove any duplicates already in the DOM
|
|
53
|
-
var existing = document.querySelectorAll(selector);
|
|
54
|
-
existing.forEach(function(script, index) {
|
|
55
|
-
if (index > 0) {
|
|
56
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
61
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
62
|
-
window[observerKey] = new MutationObserver(function() {
|
|
63
|
-
var all = document.querySelectorAll(selector);
|
|
64
|
-
for (var i = 1; i < all.length; i++) {
|
|
65
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!window[scriptKey]) {
|
|
72
|
-
window[scriptKey] = true;
|
|
73
|
-
${scriptStr}
|
|
74
|
-
}
|
|
75
|
-
})();
|
|
76
|
-
`;
|
|
77
46
|
export const getInitVariantsFnsScriptString = () => `
|
|
78
47
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
79
48
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.2.
|
|
1
|
+
export declare const SDK_VERSION = "5.2.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "5.2.
|
|
1
|
+
export const SDK_VERSION = "5.2.3";
|
|
@@ -8,7 +8,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
|
8
8
|
import ContentComponent from "../content/content.svelte";
|
|
9
9
|
import InlinedScript from "../inlined-script.svelte";
|
|
10
10
|
import InlinedStyles from "../inlined-styles.svelte";
|
|
11
|
-
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants,
|
|
11
|
+
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers";
|
|
12
12
|
export let canTrack = undefined;
|
|
13
13
|
export let content;
|
|
14
14
|
export let isNestedRender = undefined;
|
|
@@ -65,23 +65,17 @@ onMount(() => {
|
|
|
65
65
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
66
66
|
<InlinedScript
|
|
67
67
|
id="builderio-init-variants-fns"
|
|
68
|
-
scriptStr={
|
|
69
|
-
"builderio-init-variants-fns",
|
|
70
|
-
getInitVariantsFnsScriptString()
|
|
71
|
-
)}
|
|
68
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
72
69
|
nonce={nonce || ""}
|
|
73
70
|
/>
|
|
74
|
-
{/if}
|
|
75
71
|
|
|
76
|
-
{#if
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)}
|
|
84
|
-
/>
|
|
72
|
+
{#if SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}
|
|
73
|
+
<InlinedScript
|
|
74
|
+
id="builderio-init-personalization-variants-fns"
|
|
75
|
+
nonce={nonce || ""}
|
|
76
|
+
scriptStr={getInitPersonalizationVariantsFnsScriptString()}
|
|
77
|
+
/>
|
|
78
|
+
{/if}
|
|
85
79
|
{/if}
|
|
86
80
|
|
|
87
81
|
{#if shouldRenderVariants}
|
|
@@ -32,7 +32,6 @@ type VariantData = {
|
|
|
32
32
|
id: string;
|
|
33
33
|
testRatio?: number;
|
|
34
34
|
};
|
|
35
|
-
export declare const removeDuplicateScript: (id: string, scriptStr: string) => string;
|
|
36
35
|
export declare const getInitVariantsFnsScriptString: () => string;
|
|
37
36
|
export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
|
|
38
37
|
export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
|
|
@@ -43,37 +43,6 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
43
43
|
const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
|
|
44
44
|
const isAngularSDK = TARGET === 'angular';
|
|
45
45
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
46
|
-
export const removeDuplicateScript = (id, scriptStr) => `
|
|
47
|
-
(function() {
|
|
48
|
-
var selector = 'script[data-id="${id}"]';
|
|
49
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
50
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
51
|
-
|
|
52
|
-
// Synchronously remove any duplicates already in the DOM
|
|
53
|
-
var existing = document.querySelectorAll(selector);
|
|
54
|
-
existing.forEach(function(script, index) {
|
|
55
|
-
if (index > 0) {
|
|
56
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
61
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
62
|
-
window[observerKey] = new MutationObserver(function() {
|
|
63
|
-
var all = document.querySelectorAll(selector);
|
|
64
|
-
for (var i = 1; i < all.length; i++) {
|
|
65
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!window[scriptKey]) {
|
|
72
|
-
window[scriptKey] = true;
|
|
73
|
-
${scriptStr}
|
|
74
|
-
}
|
|
75
|
-
})();
|
|
76
|
-
`;
|
|
77
46
|
export const getInitVariantsFnsScriptString = () => `
|
|
78
47
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
79
48
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.2.
|
|
1
|
+
export declare const SDK_VERSION = "5.2.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "5.2.
|
|
1
|
+
export const SDK_VERSION = "5.2.3";
|
|
@@ -8,7 +8,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
|
8
8
|
import ContentComponent from "../content/content.svelte";
|
|
9
9
|
import InlinedScript from "../inlined-script.svelte";
|
|
10
10
|
import InlinedStyles from "../inlined-styles.svelte";
|
|
11
|
-
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants,
|
|
11
|
+
import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers";
|
|
12
12
|
export let canTrack = undefined;
|
|
13
13
|
export let content;
|
|
14
14
|
export let isNestedRender = undefined;
|
|
@@ -65,23 +65,17 @@ onMount(() => {
|
|
|
65
65
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
66
66
|
<InlinedScript
|
|
67
67
|
id="builderio-init-variants-fns"
|
|
68
|
-
scriptStr={
|
|
69
|
-
"builderio-init-variants-fns",
|
|
70
|
-
getInitVariantsFnsScriptString()
|
|
71
|
-
)}
|
|
68
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
72
69
|
nonce={nonce || ""}
|
|
73
70
|
/>
|
|
74
|
-
{/if}
|
|
75
71
|
|
|
76
|
-
{#if
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)}
|
|
84
|
-
/>
|
|
72
|
+
{#if SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}
|
|
73
|
+
<InlinedScript
|
|
74
|
+
id="builderio-init-personalization-variants-fns"
|
|
75
|
+
nonce={nonce || ""}
|
|
76
|
+
scriptStr={getInitPersonalizationVariantsFnsScriptString()}
|
|
77
|
+
/>
|
|
78
|
+
{/if}
|
|
85
79
|
{/if}
|
|
86
80
|
|
|
87
81
|
{#if shouldRenderVariants}
|
|
@@ -32,7 +32,6 @@ type VariantData = {
|
|
|
32
32
|
id: string;
|
|
33
33
|
testRatio?: number;
|
|
34
34
|
};
|
|
35
|
-
export declare const removeDuplicateScript: (id: string, scriptStr: string) => string;
|
|
36
35
|
export declare const getInitVariantsFnsScriptString: () => string;
|
|
37
36
|
export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
|
|
38
37
|
export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
|
|
@@ -43,37 +43,6 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
43
43
|
const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
|
|
44
44
|
const isAngularSDK = TARGET === 'angular';
|
|
45
45
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
46
|
-
export const removeDuplicateScript = (id, scriptStr) => `
|
|
47
|
-
(function() {
|
|
48
|
-
var selector = 'script[data-id="${id}"]';
|
|
49
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
50
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
51
|
-
|
|
52
|
-
// Synchronously remove any duplicates already in the DOM
|
|
53
|
-
var existing = document.querySelectorAll(selector);
|
|
54
|
-
existing.forEach(function(script, index) {
|
|
55
|
-
if (index > 0) {
|
|
56
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
61
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
62
|
-
window[observerKey] = new MutationObserver(function() {
|
|
63
|
-
var all = document.querySelectorAll(selector);
|
|
64
|
-
for (var i = 1; i < all.length; i++) {
|
|
65
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!window[scriptKey]) {
|
|
72
|
-
window[scriptKey] = true;
|
|
73
|
-
${scriptStr}
|
|
74
|
-
}
|
|
75
|
-
})();
|
|
76
|
-
`;
|
|
77
46
|
export const getInitVariantsFnsScriptString = () => `
|
|
78
47
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
79
48
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.2.
|
|
1
|
+
export declare const SDK_VERSION = "5.2.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "5.2.
|
|
1
|
+
export const SDK_VERSION = "5.2.3";
|
package/package.json
CHANGED
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
getInitVariantsFnsScriptString,
|
|
27
27
|
getUpdateCookieAndStylesScript,
|
|
28
28
|
getVariants,
|
|
29
|
-
removeDuplicateScript,
|
|
30
29
|
} from "./helpers";
|
|
31
30
|
|
|
32
31
|
export let canTrack: VariantsProviderProps["canTrack"] = undefined;
|
|
@@ -96,23 +95,17 @@
|
|
|
96
95
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
97
96
|
<InlinedScript
|
|
98
97
|
id="builderio-init-variants-fns"
|
|
99
|
-
scriptStr={
|
|
100
|
-
"builderio-init-variants-fns",
|
|
101
|
-
getInitVariantsFnsScriptString()
|
|
102
|
-
)}
|
|
98
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
103
99
|
nonce={nonce || ""}
|
|
104
100
|
/>
|
|
105
|
-
{/if}
|
|
106
101
|
|
|
107
|
-
{#if
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)}
|
|
115
|
-
/>
|
|
102
|
+
{#if SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}
|
|
103
|
+
<InlinedScript
|
|
104
|
+
id="builderio-init-personalization-variants-fns"
|
|
105
|
+
nonce={nonce || ""}
|
|
106
|
+
scriptStr={getInitPersonalizationVariantsFnsScriptString()}
|
|
107
|
+
/>
|
|
108
|
+
{/if}
|
|
116
109
|
{/if}
|
|
117
110
|
|
|
118
111
|
{#if shouldRenderVariants}
|
|
@@ -54,37 +54,6 @@ type VariantData = {
|
|
|
54
54
|
const getIsHydrationTarget = (target: Target) => target === 'react' || target === 'reactNative';
|
|
55
55
|
const isAngularSDK = TARGET === 'angular';
|
|
56
56
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
57
|
-
export const removeDuplicateScript = (id: string, scriptStr: string) => `
|
|
58
|
-
(function() {
|
|
59
|
-
var selector = 'script[data-id="${id}"]';
|
|
60
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
61
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
62
|
-
|
|
63
|
-
// Synchronously remove any duplicates already in the DOM
|
|
64
|
-
var existing = document.querySelectorAll(selector);
|
|
65
|
-
existing.forEach(function(script, index) {
|
|
66
|
-
if (index > 0) {
|
|
67
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
72
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
73
|
-
window[observerKey] = new MutationObserver(function() {
|
|
74
|
-
var all = document.querySelectorAll(selector);
|
|
75
|
-
for (var i = 1; i < all.length; i++) {
|
|
76
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!window[scriptKey]) {
|
|
83
|
-
window[scriptKey] = true;
|
|
84
|
-
${scriptStr}
|
|
85
|
-
}
|
|
86
|
-
})();
|
|
87
|
-
`;
|
|
88
57
|
export const getInitVariantsFnsScriptString = () => `
|
|
89
58
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
90
59
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "5.2.
|
|
1
|
+
export const SDK_VERSION = "5.2.3"
|