@builder.io/sdk-qwik 0.25.2 → 0.25.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.qwik.cjs +41 -37
- package/lib/browser/components/content-variants/content-variants.qwik.mjs +42 -38
- package/lib/browser/components/content-variants/helpers.qwik.cjs +0 -32
- package/lib/browser/components/content-variants/helpers.qwik.mjs +1 -33
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/components/content-variants/content-variants.qwik.cjs +41 -37
- package/lib/edge/components/content-variants/content-variants.qwik.mjs +42 -38
- package/lib/edge/components/content-variants/helpers.qwik.cjs +0 -32
- package/lib/edge/components/content-variants/helpers.qwik.mjs +1 -33
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/components/content-variants/content-variants.qwik.cjs +41 -37
- package/lib/node/components/content-variants/content-variants.qwik.mjs +42 -38
- package/lib/node/components/content-variants/helpers.qwik.cjs +0 -32
- package/lib/node/components/content-variants/helpers.qwik.mjs +1 -33
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/package.json +1 -1
- package/types/src/components/content-variants/helpers.d.ts +0 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
|
@@ -50,38 +50,42 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
50
50
|
]));
|
|
51
51
|
return /* @__PURE__ */ qwik._jsxC(qwik.Fragment, {
|
|
52
52
|
children: [
|
|
53
|
-
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
56
|
+
id: "builderio-init-variants-fns",
|
|
57
|
+
get scriptStr() {
|
|
58
|
+
return helpers.getInitVariantsFnsScriptString();
|
|
59
|
+
},
|
|
60
|
+
get nonce() {
|
|
61
|
+
return props.nonce || "";
|
|
62
|
+
},
|
|
63
|
+
[qwik._IMMUTABLE]: {
|
|
64
|
+
id: qwik._IMMUTABLE,
|
|
65
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
66
|
+
props
|
|
67
|
+
], 'p0.nonce||""'),
|
|
68
|
+
scriptStr: qwik._IMMUTABLE
|
|
69
|
+
}
|
|
70
|
+
}, 3, "XM_0"),
|
|
71
|
+
helpers$1.SDKS_SUPPORTING_PERSONALIZATION.includes(target.TARGET) ? /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
72
|
+
id: "builderio-init-personalization-variants-fns",
|
|
73
|
+
get nonce() {
|
|
74
|
+
return props.nonce || "";
|
|
75
|
+
},
|
|
76
|
+
get scriptStr() {
|
|
77
|
+
return helpers$1.getInitPersonalizationVariantsFnsScriptString();
|
|
78
|
+
},
|
|
79
|
+
[qwik._IMMUTABLE]: {
|
|
80
|
+
id: qwik._IMMUTABLE,
|
|
81
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
82
|
+
props
|
|
83
|
+
], 'p0.nonce||""'),
|
|
84
|
+
scriptStr: qwik._IMMUTABLE
|
|
85
|
+
}
|
|
86
|
+
}, 3, "XM_1") : null
|
|
87
|
+
]
|
|
88
|
+
}, 1, "XM_2") : null,
|
|
85
89
|
state.shouldRenderVariants ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
86
90
|
children: [
|
|
87
91
|
/* @__PURE__ */ qwik._jsxC(inlinedStyles.InlinedStyles, {
|
|
@@ -101,7 +105,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
101
105
|
hideVariantsStyleString
|
|
102
106
|
], "p0.value")
|
|
103
107
|
}
|
|
104
|
-
}, 3, "
|
|
108
|
+
}, 3, "XM_3"),
|
|
105
109
|
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
106
110
|
id: "builderio-variants-visibility",
|
|
107
111
|
get scriptStr() {
|
|
@@ -119,7 +123,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
119
123
|
updateCookieAndStylesScriptStr
|
|
120
124
|
], "p0.value")
|
|
121
125
|
}
|
|
122
|
-
}, 3, "
|
|
126
|
+
}, 3, "XM_4"),
|
|
123
127
|
(helpers.getVariants(props.content) || []).map((variant) => {
|
|
124
128
|
return /* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
125
129
|
get apiHost() {
|
|
@@ -244,7 +248,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
244
248
|
}, 3, variant.testVariationId);
|
|
245
249
|
})
|
|
246
250
|
]
|
|
247
|
-
}, 1, "
|
|
251
|
+
}, 1, "XM_5") : null,
|
|
248
252
|
/* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
249
253
|
get apiHost() {
|
|
250
254
|
return props.apiHost;
|
|
@@ -370,9 +374,9 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
370
374
|
props
|
|
371
375
|
], "p0.trustedHosts")
|
|
372
376
|
}
|
|
373
|
-
}, 3, "
|
|
377
|
+
}, 3, "XM_6")
|
|
374
378
|
]
|
|
375
|
-
}, 1, "
|
|
379
|
+
}, 1, "XM_7");
|
|
376
380
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
377
381
|
exports.ContentVariants = ContentVariants;
|
|
378
382
|
exports.default = ContentVariants;
|
|
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.qwik.mjs";
|
|
|
7
7
|
import { ContentComponent } from "../content/content.qwik.mjs";
|
|
8
8
|
import { InlinedScript } from "../inlined-script.qwik.mjs";
|
|
9
9
|
import { InlinedStyles } from "../inlined-styles.qwik.mjs";
|
|
10
|
-
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants,
|
|
10
|
+
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants, getInitVariantsFnsScriptString } from "./helpers.qwik.mjs";
|
|
11
11
|
const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
12
12
|
_jsxBranch();
|
|
13
13
|
const state = useStore({
|
|
@@ -48,38 +48,42 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
48
48
|
]));
|
|
49
49
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
50
50
|
children: [
|
|
51
|
-
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
54
|
+
id: "builderio-init-variants-fns",
|
|
55
|
+
get scriptStr() {
|
|
56
|
+
return getInitVariantsFnsScriptString();
|
|
57
|
+
},
|
|
58
|
+
get nonce() {
|
|
59
|
+
return props.nonce || "";
|
|
60
|
+
},
|
|
61
|
+
[_IMMUTABLE]: {
|
|
62
|
+
id: _IMMUTABLE,
|
|
63
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
64
|
+
props
|
|
65
|
+
], 'p0.nonce||""'),
|
|
66
|
+
scriptStr: _IMMUTABLE
|
|
67
|
+
}
|
|
68
|
+
}, 3, "XM_0"),
|
|
69
|
+
SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
70
|
+
id: "builderio-init-personalization-variants-fns",
|
|
71
|
+
get nonce() {
|
|
72
|
+
return props.nonce || "";
|
|
73
|
+
},
|
|
74
|
+
get scriptStr() {
|
|
75
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
76
|
+
},
|
|
77
|
+
[_IMMUTABLE]: {
|
|
78
|
+
id: _IMMUTABLE,
|
|
79
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
80
|
+
props
|
|
81
|
+
], 'p0.nonce||""'),
|
|
82
|
+
scriptStr: _IMMUTABLE
|
|
83
|
+
}
|
|
84
|
+
}, 3, "XM_1") : null
|
|
85
|
+
]
|
|
86
|
+
}, 1, "XM_2") : null,
|
|
83
87
|
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
84
88
|
children: [
|
|
85
89
|
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
@@ -99,7 +103,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
99
103
|
hideVariantsStyleString
|
|
100
104
|
], "p0.value")
|
|
101
105
|
}
|
|
102
|
-
}, 3, "
|
|
106
|
+
}, 3, "XM_3"),
|
|
103
107
|
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
104
108
|
id: "builderio-variants-visibility",
|
|
105
109
|
get scriptStr() {
|
|
@@ -117,7 +121,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
117
121
|
updateCookieAndStylesScriptStr
|
|
118
122
|
], "p0.value")
|
|
119
123
|
}
|
|
120
|
-
}, 3, "
|
|
124
|
+
}, 3, "XM_4"),
|
|
121
125
|
(getVariants(props.content) || []).map((variant) => {
|
|
122
126
|
return /* @__PURE__ */ _jsxC(ContentComponent, {
|
|
123
127
|
get apiHost() {
|
|
@@ -242,7 +246,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
242
246
|
}, 3, variant.testVariationId);
|
|
243
247
|
})
|
|
244
248
|
]
|
|
245
|
-
}, 1, "
|
|
249
|
+
}, 1, "XM_5") : null,
|
|
246
250
|
/* @__PURE__ */ _jsxC(ContentComponent, {
|
|
247
251
|
get apiHost() {
|
|
248
252
|
return props.apiHost;
|
|
@@ -368,9 +372,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
368
372
|
props
|
|
369
373
|
], "p0.trustedHosts")
|
|
370
374
|
}
|
|
371
|
-
}, 3, "
|
|
375
|
+
}, 3, "XM_6")
|
|
372
376
|
]
|
|
373
|
-
}, 1, "
|
|
377
|
+
}, 1, "XM_7");
|
|
374
378
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
375
379
|
export {
|
|
376
380
|
ContentVariants,
|
|
@@ -23,37 +23,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
23
23
|
const getIsHydrationTarget = (target2) => target2 === "react" || target2 === "reactNative";
|
|
24
24
|
const isAngularSDK = target.TARGET === "angular";
|
|
25
25
|
const isHydrationTarget = getIsHydrationTarget(target.TARGET);
|
|
26
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
27
|
-
(function() {
|
|
28
|
-
var selector = 'script[data-id="${id}"]';
|
|
29
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
30
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
31
|
-
|
|
32
|
-
// Synchronously remove any duplicates already in the DOM
|
|
33
|
-
var existing = document.querySelectorAll(selector);
|
|
34
|
-
existing.forEach(function(script, index) {
|
|
35
|
-
if (index > 0) {
|
|
36
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
41
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
42
|
-
window[observerKey] = new MutationObserver(function() {
|
|
43
|
-
var all = document.querySelectorAll(selector);
|
|
44
|
-
for (var i = 1; i < all.length; i++) {
|
|
45
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!window[scriptKey]) {
|
|
52
|
-
window[scriptKey] = true;
|
|
53
|
-
${scriptStr}
|
|
54
|
-
}
|
|
55
|
-
})();
|
|
56
|
-
`;
|
|
57
26
|
const getInitVariantsFnsScriptString = () => `
|
|
58
27
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${inlinedFns.UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
59
28
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${inlinedFns.UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -70,4 +39,3 @@ exports.getInitVariantsFnsScriptString = getInitVariantsFnsScriptString;
|
|
|
70
39
|
exports.getUpdateCookieAndStylesScript = getUpdateCookieAndStylesScript;
|
|
71
40
|
exports.getUpdateVariantVisibilityScript = getUpdateVariantVisibilityScript;
|
|
72
41
|
exports.getVariants = getVariants;
|
|
73
|
-
exports.removeDuplicateScript = removeDuplicateScript;
|
|
@@ -21,37 +21,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
21
21
|
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
22
22
|
const isAngularSDK = TARGET === "angular";
|
|
23
23
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
24
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
25
|
-
(function() {
|
|
26
|
-
var selector = 'script[data-id="${id}"]';
|
|
27
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
28
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
29
|
-
|
|
30
|
-
// Synchronously remove any duplicates already in the DOM
|
|
31
|
-
var existing = document.querySelectorAll(selector);
|
|
32
|
-
existing.forEach(function(script, index) {
|
|
33
|
-
if (index > 0) {
|
|
34
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
39
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
40
|
-
window[observerKey] = new MutationObserver(function() {
|
|
41
|
-
var all = document.querySelectorAll(selector);
|
|
42
|
-
for (var i = 1; i < all.length; i++) {
|
|
43
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!window[scriptKey]) {
|
|
50
|
-
window[scriptKey] = true;
|
|
51
|
-
${scriptStr}
|
|
52
|
-
}
|
|
53
|
-
})();
|
|
54
|
-
`;
|
|
55
24
|
const getInitVariantsFnsScriptString = () => `
|
|
56
25
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
57
26
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -68,6 +37,5 @@ export {
|
|
|
68
37
|
getInitVariantsFnsScriptString,
|
|
69
38
|
getUpdateCookieAndStylesScript,
|
|
70
39
|
getUpdateVariantVisibilityScript,
|
|
71
|
-
getVariants
|
|
72
|
-
removeDuplicateScript
|
|
40
|
+
getVariants
|
|
73
41
|
};
|
|
@@ -50,38 +50,42 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
50
50
|
]));
|
|
51
51
|
return /* @__PURE__ */ qwik._jsxC(qwik.Fragment, {
|
|
52
52
|
children: [
|
|
53
|
-
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
56
|
+
id: "builderio-init-variants-fns",
|
|
57
|
+
get scriptStr() {
|
|
58
|
+
return helpers.getInitVariantsFnsScriptString();
|
|
59
|
+
},
|
|
60
|
+
get nonce() {
|
|
61
|
+
return props.nonce || "";
|
|
62
|
+
},
|
|
63
|
+
[qwik._IMMUTABLE]: {
|
|
64
|
+
id: qwik._IMMUTABLE,
|
|
65
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
66
|
+
props
|
|
67
|
+
], 'p0.nonce||""'),
|
|
68
|
+
scriptStr: qwik._IMMUTABLE
|
|
69
|
+
}
|
|
70
|
+
}, 3, "XM_0"),
|
|
71
|
+
helpers$1.SDKS_SUPPORTING_PERSONALIZATION.includes(target.TARGET) ? /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
72
|
+
id: "builderio-init-personalization-variants-fns",
|
|
73
|
+
get nonce() {
|
|
74
|
+
return props.nonce || "";
|
|
75
|
+
},
|
|
76
|
+
get scriptStr() {
|
|
77
|
+
return helpers$1.getInitPersonalizationVariantsFnsScriptString();
|
|
78
|
+
},
|
|
79
|
+
[qwik._IMMUTABLE]: {
|
|
80
|
+
id: qwik._IMMUTABLE,
|
|
81
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
82
|
+
props
|
|
83
|
+
], 'p0.nonce||""'),
|
|
84
|
+
scriptStr: qwik._IMMUTABLE
|
|
85
|
+
}
|
|
86
|
+
}, 3, "XM_1") : null
|
|
87
|
+
]
|
|
88
|
+
}, 1, "XM_2") : null,
|
|
85
89
|
state.shouldRenderVariants ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
86
90
|
children: [
|
|
87
91
|
/* @__PURE__ */ qwik._jsxC(inlinedStyles.InlinedStyles, {
|
|
@@ -101,7 +105,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
101
105
|
hideVariantsStyleString
|
|
102
106
|
], "p0.value")
|
|
103
107
|
}
|
|
104
|
-
}, 3, "
|
|
108
|
+
}, 3, "XM_3"),
|
|
105
109
|
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
106
110
|
id: "builderio-variants-visibility",
|
|
107
111
|
get scriptStr() {
|
|
@@ -119,7 +123,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
119
123
|
updateCookieAndStylesScriptStr
|
|
120
124
|
], "p0.value")
|
|
121
125
|
}
|
|
122
|
-
}, 3, "
|
|
126
|
+
}, 3, "XM_4"),
|
|
123
127
|
(helpers.getVariants(props.content) || []).map((variant) => {
|
|
124
128
|
return /* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
125
129
|
get apiHost() {
|
|
@@ -244,7 +248,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
244
248
|
}, 3, variant.testVariationId);
|
|
245
249
|
})
|
|
246
250
|
]
|
|
247
|
-
}, 1, "
|
|
251
|
+
}, 1, "XM_5") : null,
|
|
248
252
|
/* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
249
253
|
get apiHost() {
|
|
250
254
|
return props.apiHost;
|
|
@@ -370,9 +374,9 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
370
374
|
props
|
|
371
375
|
], "p0.trustedHosts")
|
|
372
376
|
}
|
|
373
|
-
}, 3, "
|
|
377
|
+
}, 3, "XM_6")
|
|
374
378
|
]
|
|
375
|
-
}, 1, "
|
|
379
|
+
}, 1, "XM_7");
|
|
376
380
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
377
381
|
exports.ContentVariants = ContentVariants;
|
|
378
382
|
exports.default = ContentVariants;
|
|
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.qwik.mjs";
|
|
|
7
7
|
import { ContentComponent } from "../content/content.qwik.mjs";
|
|
8
8
|
import { InlinedScript } from "../inlined-script.qwik.mjs";
|
|
9
9
|
import { InlinedStyles } from "../inlined-styles.qwik.mjs";
|
|
10
|
-
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants,
|
|
10
|
+
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants, getInitVariantsFnsScriptString } from "./helpers.qwik.mjs";
|
|
11
11
|
const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
12
12
|
_jsxBranch();
|
|
13
13
|
const state = useStore({
|
|
@@ -48,38 +48,42 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
48
48
|
]));
|
|
49
49
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
50
50
|
children: [
|
|
51
|
-
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
54
|
+
id: "builderio-init-variants-fns",
|
|
55
|
+
get scriptStr() {
|
|
56
|
+
return getInitVariantsFnsScriptString();
|
|
57
|
+
},
|
|
58
|
+
get nonce() {
|
|
59
|
+
return props.nonce || "";
|
|
60
|
+
},
|
|
61
|
+
[_IMMUTABLE]: {
|
|
62
|
+
id: _IMMUTABLE,
|
|
63
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
64
|
+
props
|
|
65
|
+
], 'p0.nonce||""'),
|
|
66
|
+
scriptStr: _IMMUTABLE
|
|
67
|
+
}
|
|
68
|
+
}, 3, "XM_0"),
|
|
69
|
+
SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
70
|
+
id: "builderio-init-personalization-variants-fns",
|
|
71
|
+
get nonce() {
|
|
72
|
+
return props.nonce || "";
|
|
73
|
+
},
|
|
74
|
+
get scriptStr() {
|
|
75
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
76
|
+
},
|
|
77
|
+
[_IMMUTABLE]: {
|
|
78
|
+
id: _IMMUTABLE,
|
|
79
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
80
|
+
props
|
|
81
|
+
], 'p0.nonce||""'),
|
|
82
|
+
scriptStr: _IMMUTABLE
|
|
83
|
+
}
|
|
84
|
+
}, 3, "XM_1") : null
|
|
85
|
+
]
|
|
86
|
+
}, 1, "XM_2") : null,
|
|
83
87
|
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
84
88
|
children: [
|
|
85
89
|
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
@@ -99,7 +103,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
99
103
|
hideVariantsStyleString
|
|
100
104
|
], "p0.value")
|
|
101
105
|
}
|
|
102
|
-
}, 3, "
|
|
106
|
+
}, 3, "XM_3"),
|
|
103
107
|
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
104
108
|
id: "builderio-variants-visibility",
|
|
105
109
|
get scriptStr() {
|
|
@@ -117,7 +121,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
117
121
|
updateCookieAndStylesScriptStr
|
|
118
122
|
], "p0.value")
|
|
119
123
|
}
|
|
120
|
-
}, 3, "
|
|
124
|
+
}, 3, "XM_4"),
|
|
121
125
|
(getVariants(props.content) || []).map((variant) => {
|
|
122
126
|
return /* @__PURE__ */ _jsxC(ContentComponent, {
|
|
123
127
|
get apiHost() {
|
|
@@ -242,7 +246,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
242
246
|
}, 3, variant.testVariationId);
|
|
243
247
|
})
|
|
244
248
|
]
|
|
245
|
-
}, 1, "
|
|
249
|
+
}, 1, "XM_5") : null,
|
|
246
250
|
/* @__PURE__ */ _jsxC(ContentComponent, {
|
|
247
251
|
get apiHost() {
|
|
248
252
|
return props.apiHost;
|
|
@@ -368,9 +372,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
368
372
|
props
|
|
369
373
|
], "p0.trustedHosts")
|
|
370
374
|
}
|
|
371
|
-
}, 3, "
|
|
375
|
+
}, 3, "XM_6")
|
|
372
376
|
]
|
|
373
|
-
}, 1, "
|
|
377
|
+
}, 1, "XM_7");
|
|
374
378
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
375
379
|
export {
|
|
376
380
|
ContentVariants,
|
|
@@ -23,37 +23,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
23
23
|
const getIsHydrationTarget = (target2) => target2 === "react" || target2 === "reactNative";
|
|
24
24
|
const isAngularSDK = target.TARGET === "angular";
|
|
25
25
|
const isHydrationTarget = getIsHydrationTarget(target.TARGET);
|
|
26
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
27
|
-
(function() {
|
|
28
|
-
var selector = 'script[data-id="${id}"]';
|
|
29
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
30
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
31
|
-
|
|
32
|
-
// Synchronously remove any duplicates already in the DOM
|
|
33
|
-
var existing = document.querySelectorAll(selector);
|
|
34
|
-
existing.forEach(function(script, index) {
|
|
35
|
-
if (index > 0) {
|
|
36
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
41
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
42
|
-
window[observerKey] = new MutationObserver(function() {
|
|
43
|
-
var all = document.querySelectorAll(selector);
|
|
44
|
-
for (var i = 1; i < all.length; i++) {
|
|
45
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!window[scriptKey]) {
|
|
52
|
-
window[scriptKey] = true;
|
|
53
|
-
${scriptStr}
|
|
54
|
-
}
|
|
55
|
-
})();
|
|
56
|
-
`;
|
|
57
26
|
const getInitVariantsFnsScriptString = () => `
|
|
58
27
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${inlinedFns.UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
59
28
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${inlinedFns.UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -70,4 +39,3 @@ exports.getInitVariantsFnsScriptString = getInitVariantsFnsScriptString;
|
|
|
70
39
|
exports.getUpdateCookieAndStylesScript = getUpdateCookieAndStylesScript;
|
|
71
40
|
exports.getUpdateVariantVisibilityScript = getUpdateVariantVisibilityScript;
|
|
72
41
|
exports.getVariants = getVariants;
|
|
73
|
-
exports.removeDuplicateScript = removeDuplicateScript;
|
|
@@ -21,37 +21,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
21
21
|
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
22
22
|
const isAngularSDK = TARGET === "angular";
|
|
23
23
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
24
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
25
|
-
(function() {
|
|
26
|
-
var selector = 'script[data-id="${id}"]';
|
|
27
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
28
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
29
|
-
|
|
30
|
-
// Synchronously remove any duplicates already in the DOM
|
|
31
|
-
var existing = document.querySelectorAll(selector);
|
|
32
|
-
existing.forEach(function(script, index) {
|
|
33
|
-
if (index > 0) {
|
|
34
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
39
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
40
|
-
window[observerKey] = new MutationObserver(function() {
|
|
41
|
-
var all = document.querySelectorAll(selector);
|
|
42
|
-
for (var i = 1; i < all.length; i++) {
|
|
43
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!window[scriptKey]) {
|
|
50
|
-
window[scriptKey] = true;
|
|
51
|
-
${scriptStr}
|
|
52
|
-
}
|
|
53
|
-
})();
|
|
54
|
-
`;
|
|
55
24
|
const getInitVariantsFnsScriptString = () => `
|
|
56
25
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
57
26
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -68,6 +37,5 @@ export {
|
|
|
68
37
|
getInitVariantsFnsScriptString,
|
|
69
38
|
getUpdateCookieAndStylesScript,
|
|
70
39
|
getUpdateVariantVisibilityScript,
|
|
71
|
-
getVariants
|
|
72
|
-
removeDuplicateScript
|
|
40
|
+
getVariants
|
|
73
41
|
};
|
|
@@ -50,38 +50,42 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
50
50
|
]));
|
|
51
51
|
return /* @__PURE__ */ qwik._jsxC(qwik.Fragment, {
|
|
52
52
|
children: [
|
|
53
|
-
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
!props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
56
|
+
id: "builderio-init-variants-fns",
|
|
57
|
+
get scriptStr() {
|
|
58
|
+
return helpers.getInitVariantsFnsScriptString();
|
|
59
|
+
},
|
|
60
|
+
get nonce() {
|
|
61
|
+
return props.nonce || "";
|
|
62
|
+
},
|
|
63
|
+
[qwik._IMMUTABLE]: {
|
|
64
|
+
id: qwik._IMMUTABLE,
|
|
65
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
66
|
+
props
|
|
67
|
+
], 'p0.nonce||""'),
|
|
68
|
+
scriptStr: qwik._IMMUTABLE
|
|
69
|
+
}
|
|
70
|
+
}, 3, "XM_0"),
|
|
71
|
+
helpers$1.SDKS_SUPPORTING_PERSONALIZATION.includes(target.TARGET) ? /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
72
|
+
id: "builderio-init-personalization-variants-fns",
|
|
73
|
+
get nonce() {
|
|
74
|
+
return props.nonce || "";
|
|
75
|
+
},
|
|
76
|
+
get scriptStr() {
|
|
77
|
+
return helpers$1.getInitPersonalizationVariantsFnsScriptString();
|
|
78
|
+
},
|
|
79
|
+
[qwik._IMMUTABLE]: {
|
|
80
|
+
id: qwik._IMMUTABLE,
|
|
81
|
+
nonce: qwik._fnSignal((p0) => p0.nonce || "", [
|
|
82
|
+
props
|
|
83
|
+
], 'p0.nonce||""'),
|
|
84
|
+
scriptStr: qwik._IMMUTABLE
|
|
85
|
+
}
|
|
86
|
+
}, 3, "XM_1") : null
|
|
87
|
+
]
|
|
88
|
+
}, 1, "XM_2") : null,
|
|
85
89
|
state.shouldRenderVariants ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
86
90
|
children: [
|
|
87
91
|
/* @__PURE__ */ qwik._jsxC(inlinedStyles.InlinedStyles, {
|
|
@@ -101,7 +105,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
101
105
|
hideVariantsStyleString
|
|
102
106
|
], "p0.value")
|
|
103
107
|
}
|
|
104
|
-
}, 3, "
|
|
108
|
+
}, 3, "XM_3"),
|
|
105
109
|
/* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
|
|
106
110
|
id: "builderio-variants-visibility",
|
|
107
111
|
get scriptStr() {
|
|
@@ -119,7 +123,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
119
123
|
updateCookieAndStylesScriptStr
|
|
120
124
|
], "p0.value")
|
|
121
125
|
}
|
|
122
|
-
}, 3, "
|
|
126
|
+
}, 3, "XM_4"),
|
|
123
127
|
(helpers.getVariants(props.content) || []).map((variant) => {
|
|
124
128
|
return /* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
125
129
|
get apiHost() {
|
|
@@ -244,7 +248,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
244
248
|
}, 3, variant.testVariationId);
|
|
245
249
|
})
|
|
246
250
|
]
|
|
247
|
-
}, 1, "
|
|
251
|
+
}, 1, "XM_5") : null,
|
|
248
252
|
/* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
|
|
249
253
|
get apiHost() {
|
|
250
254
|
return props.apiHost;
|
|
@@ -370,9 +374,9 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
|
|
|
370
374
|
props
|
|
371
375
|
], "p0.trustedHosts")
|
|
372
376
|
}
|
|
373
|
-
}, 3, "
|
|
377
|
+
}, 3, "XM_6")
|
|
374
378
|
]
|
|
375
|
-
}, 1, "
|
|
379
|
+
}, 1, "XM_7");
|
|
376
380
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
377
381
|
exports.ContentVariants = ContentVariants;
|
|
378
382
|
exports.default = ContentVariants;
|
|
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.qwik.mjs";
|
|
|
7
7
|
import { ContentComponent } from "../content/content.qwik.mjs";
|
|
8
8
|
import { InlinedScript } from "../inlined-script.qwik.mjs";
|
|
9
9
|
import { InlinedStyles } from "../inlined-styles.qwik.mjs";
|
|
10
|
-
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants,
|
|
10
|
+
import { checkShouldRenderVariants, getUpdateCookieAndStylesScript, getVariants, getInitVariantsFnsScriptString } from "./helpers.qwik.mjs";
|
|
11
11
|
const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
12
12
|
_jsxBranch();
|
|
13
13
|
const state = useStore({
|
|
@@ -48,38 +48,42 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
48
48
|
]));
|
|
49
49
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
50
50
|
children: [
|
|
51
|
-
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
54
|
+
id: "builderio-init-variants-fns",
|
|
55
|
+
get scriptStr() {
|
|
56
|
+
return getInitVariantsFnsScriptString();
|
|
57
|
+
},
|
|
58
|
+
get nonce() {
|
|
59
|
+
return props.nonce || "";
|
|
60
|
+
},
|
|
61
|
+
[_IMMUTABLE]: {
|
|
62
|
+
id: _IMMUTABLE,
|
|
63
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
64
|
+
props
|
|
65
|
+
], 'p0.nonce||""'),
|
|
66
|
+
scriptStr: _IMMUTABLE
|
|
67
|
+
}
|
|
68
|
+
}, 3, "XM_0"),
|
|
69
|
+
SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
70
|
+
id: "builderio-init-personalization-variants-fns",
|
|
71
|
+
get nonce() {
|
|
72
|
+
return props.nonce || "";
|
|
73
|
+
},
|
|
74
|
+
get scriptStr() {
|
|
75
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
76
|
+
},
|
|
77
|
+
[_IMMUTABLE]: {
|
|
78
|
+
id: _IMMUTABLE,
|
|
79
|
+
nonce: _fnSignal((p0) => p0.nonce || "", [
|
|
80
|
+
props
|
|
81
|
+
], 'p0.nonce||""'),
|
|
82
|
+
scriptStr: _IMMUTABLE
|
|
83
|
+
}
|
|
84
|
+
}, 3, "XM_1") : null
|
|
85
|
+
]
|
|
86
|
+
}, 1, "XM_2") : null,
|
|
83
87
|
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
84
88
|
children: [
|
|
85
89
|
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
@@ -99,7 +103,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
99
103
|
hideVariantsStyleString
|
|
100
104
|
], "p0.value")
|
|
101
105
|
}
|
|
102
|
-
}, 3, "
|
|
106
|
+
}, 3, "XM_3"),
|
|
103
107
|
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
104
108
|
id: "builderio-variants-visibility",
|
|
105
109
|
get scriptStr() {
|
|
@@ -117,7 +121,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
117
121
|
updateCookieAndStylesScriptStr
|
|
118
122
|
], "p0.value")
|
|
119
123
|
}
|
|
120
|
-
}, 3, "
|
|
124
|
+
}, 3, "XM_4"),
|
|
121
125
|
(getVariants(props.content) || []).map((variant) => {
|
|
122
126
|
return /* @__PURE__ */ _jsxC(ContentComponent, {
|
|
123
127
|
get apiHost() {
|
|
@@ -242,7 +246,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
242
246
|
}, 3, variant.testVariationId);
|
|
243
247
|
})
|
|
244
248
|
]
|
|
245
|
-
}, 1, "
|
|
249
|
+
}, 1, "XM_5") : null,
|
|
246
250
|
/* @__PURE__ */ _jsxC(ContentComponent, {
|
|
247
251
|
get apiHost() {
|
|
248
252
|
return props.apiHost;
|
|
@@ -368,9 +372,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
368
372
|
props
|
|
369
373
|
], "p0.trustedHosts")
|
|
370
374
|
}
|
|
371
|
-
}, 3, "
|
|
375
|
+
}, 3, "XM_6")
|
|
372
376
|
]
|
|
373
|
-
}, 1, "
|
|
377
|
+
}, 1, "XM_7");
|
|
374
378
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
375
379
|
export {
|
|
376
380
|
ContentVariants,
|
|
@@ -23,37 +23,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
23
23
|
const getIsHydrationTarget = (target2) => target2 === "react" || target2 === "reactNative";
|
|
24
24
|
const isAngularSDK = target.TARGET === "angular";
|
|
25
25
|
const isHydrationTarget = getIsHydrationTarget(target.TARGET);
|
|
26
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
27
|
-
(function() {
|
|
28
|
-
var selector = 'script[data-id="${id}"]';
|
|
29
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
30
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
31
|
-
|
|
32
|
-
// Synchronously remove any duplicates already in the DOM
|
|
33
|
-
var existing = document.querySelectorAll(selector);
|
|
34
|
-
existing.forEach(function(script, index) {
|
|
35
|
-
if (index > 0) {
|
|
36
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
41
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
42
|
-
window[observerKey] = new MutationObserver(function() {
|
|
43
|
-
var all = document.querySelectorAll(selector);
|
|
44
|
-
for (var i = 1; i < all.length; i++) {
|
|
45
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!window[scriptKey]) {
|
|
52
|
-
window[scriptKey] = true;
|
|
53
|
-
${scriptStr}
|
|
54
|
-
}
|
|
55
|
-
})();
|
|
56
|
-
`;
|
|
57
26
|
const getInitVariantsFnsScriptString = () => `
|
|
58
27
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${inlinedFns.UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
59
28
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${inlinedFns.UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -70,4 +39,3 @@ exports.getInitVariantsFnsScriptString = getInitVariantsFnsScriptString;
|
|
|
70
39
|
exports.getUpdateCookieAndStylesScript = getUpdateCookieAndStylesScript;
|
|
71
40
|
exports.getUpdateVariantVisibilityScript = getUpdateVariantVisibilityScript;
|
|
72
41
|
exports.getVariants = getVariants;
|
|
73
|
-
exports.removeDuplicateScript = removeDuplicateScript;
|
|
@@ -21,37 +21,6 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
21
21
|
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
22
22
|
const isAngularSDK = TARGET === "angular";
|
|
23
23
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
24
|
-
const removeDuplicateScript = (id, scriptStr) => `
|
|
25
|
-
(function() {
|
|
26
|
-
var selector = 'script[data-id="${id}"]';
|
|
27
|
-
var scriptKey = '__builderioScriptInitialized_${id}';
|
|
28
|
-
var observerKey = '__builderioScriptObserver_${id}';
|
|
29
|
-
|
|
30
|
-
// Synchronously remove any duplicates already in the DOM
|
|
31
|
-
var existing = document.querySelectorAll(selector);
|
|
32
|
-
existing.forEach(function(script, index) {
|
|
33
|
-
if (index > 0) {
|
|
34
|
-
script.parentNode && script.parentNode.removeChild(script);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Watch for duplicates added later (e.g. RSC streaming chunks)
|
|
39
|
-
if (!window[observerKey] && typeof MutationObserver !== 'undefined') {
|
|
40
|
-
window[observerKey] = new MutationObserver(function() {
|
|
41
|
-
var all = document.querySelectorAll(selector);
|
|
42
|
-
for (var i = 1; i < all.length; i++) {
|
|
43
|
-
all[i].parentNode && all[i].parentNode.removeChild(all[i]);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
window[observerKey].observe(document.documentElement, { childList: true, subtree: true });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!window[scriptKey]) {
|
|
50
|
-
window[scriptKey] = true;
|
|
51
|
-
${scriptStr}
|
|
52
|
-
}
|
|
53
|
-
})();
|
|
54
|
-
`;
|
|
55
24
|
const getInitVariantsFnsScriptString = () => `
|
|
56
25
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
57
26
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
@@ -68,6 +37,5 @@ export {
|
|
|
68
37
|
getInitVariantsFnsScriptString,
|
|
69
38
|
getUpdateCookieAndStylesScript,
|
|
70
39
|
getUpdateVariantVisibilityScript,
|
|
71
|
-
getVariants
|
|
72
|
-
removeDuplicateScript
|
|
40
|
+
getVariants
|
|
73
41
|
};
|
package/package.json
CHANGED
|
@@ -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 }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.25.
|
|
1
|
+
export declare const SDK_VERSION = "0.25.3";
|