@builder.io/sdk-qwik 0.4.3 → 0.4.5
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/index.qwik.cjs +475 -393
- package/lib/index.qwik.mjs +476 -394
- package/package.json +1 -1
- package/types/blocks/text/text.d.ts +1 -1
- package/types/components/block/block.d.ts +10 -0
- package/types/components/block/block.helpers.d.ts +12 -0
- package/types/components/block/components/block-styles.d.ts +8 -0
- package/types/components/block/components/component-ref.d.ts +21 -0
- package/types/components/block/components/component.d.ts +21 -0
- package/types/components/block/components/repeated-block.d.ts +10 -0
- package/types/components/block/types.d.ts +6 -0
- package/types/components/blocks/blocks-wrapper.d.ts +15 -0
- package/types/components/blocks/blocks.d.ts +9 -0
- package/types/components/content/builder-editing.d.ts +23 -0
- package/types/components/content/components/content-styles.d.ts +8 -0
- package/types/components/content/components/content-styles.helpers.d.ts +15 -0
- package/types/components/content/components/enable-editor.d.ts +23 -0
- package/types/components/content/components/render-styles.d.ts +8 -0
- package/types/components/content/components/render-styles.helpers.d.ts +15 -0
- package/types/components/content/content.d.ts +7 -0
- package/types/components/content/content.helpers.d.ts +7 -0
- package/types/components/content/content.types.d.ts +38 -0
- package/types/components/content/index.d.ts +1 -0
- package/types/components/content/wrap-component-ref.d.ts +6 -0
- package/types/components/content-variants/content-variants.d.ts +3 -0
- package/types/components/content-variants/helpers.d.ts +17 -0
- package/types/components/inlined-script.d.ts +6 -0
- package/types/components/inlined-styles.d.ts +6 -0
- package/types/components/render-content/render-content.types.d.ts +9 -23
- package/types/components/render-content-variants/helpers.d.ts +27 -3
- package/types/components/render-content-variants/render-content-variants.d.ts +8 -2
- package/types/components/render-content-variants/render-content-variants.types.d.ts +20 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/types/builder-props.d.ts +10 -0
- package/types/types/enforced-partials.d.ts +21 -0
- package/types/types/typescript.d.ts +3 -0
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, _jsxQ, createContextId, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, _wrapProp, useStore, useContextProvider, useContext, Slot, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
@@ -32,6 +32,16 @@ const STYLES$3 = `
|
|
|
32
32
|
all: unset;
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
|
+
const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
36
|
+
return /* @__PURE__ */ _jsxQ("style", null, {
|
|
37
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
38
|
+
props
|
|
39
|
+
], "p0.styles"),
|
|
40
|
+
id: _fnSignal((p0) => p0.id, [
|
|
41
|
+
props
|
|
42
|
+
], "p0.id")
|
|
43
|
+
}, null, 3, "NG_0");
|
|
44
|
+
}, "InlinedStyles_component_IOsg46hMexk"));
|
|
35
45
|
const BuilderContext = createContextId("Builder");
|
|
36
46
|
const TARGET = "qwik";
|
|
37
47
|
function isBrowser() {
|
|
@@ -194,16 +204,6 @@ const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
|
194
204
|
else
|
|
195
205
|
return cssClass;
|
|
196
206
|
};
|
|
197
|
-
const RenderInlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
198
|
-
return /* @__PURE__ */ _jsxQ("style", null, {
|
|
199
|
-
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
200
|
-
props
|
|
201
|
-
], "p0.styles"),
|
|
202
|
-
id: _fnSignal((p0) => p0.id, [
|
|
203
|
-
props
|
|
204
|
-
], "p0.id")
|
|
205
|
-
}, null, 3, "zz_0");
|
|
206
|
-
}, "RenderInlinedStyles_component_ejNQtXd1ahM"));
|
|
207
207
|
const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
208
208
|
_jsxBranch();
|
|
209
209
|
const useBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
@@ -264,7 +264,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
264
264
|
useBlock
|
|
265
265
|
]));
|
|
266
266
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
267
|
-
children: css.value && canShowBlock.value ? /* @__PURE__ */ _jsxC(
|
|
267
|
+
children: css.value && canShowBlock.value ? /* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
268
268
|
get styles() {
|
|
269
269
|
return css.value;
|
|
270
270
|
},
|
|
@@ -845,7 +845,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
845
845
|
columnsCssVars
|
|
846
846
|
], "p0.value")
|
|
847
847
|
}, [
|
|
848
|
-
/* @__PURE__ */ _jsxC(
|
|
848
|
+
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
849
849
|
get styles() {
|
|
850
850
|
return columnsStyles.value;
|
|
851
851
|
},
|
|
@@ -1086,6 +1086,194 @@ const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
1086
1086
|
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0")
|
|
1087
1087
|
}, null, 0, "2Y_1");
|
|
1088
1088
|
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1089
|
+
const MSG_PREFIX = "[Builder.io]: ";
|
|
1090
|
+
const logger = {
|
|
1091
|
+
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
1092
|
+
error: (...message) => console.error(MSG_PREFIX, ...message),
|
|
1093
|
+
warn: (...message) => console.warn(MSG_PREFIX, ...message),
|
|
1094
|
+
debug: (...message) => console.debug(MSG_PREFIX, ...message)
|
|
1095
|
+
};
|
|
1096
|
+
const getTopLevelDomain = (host) => {
|
|
1097
|
+
if (host === "localhost" || host === "127.0.0.1")
|
|
1098
|
+
return host;
|
|
1099
|
+
const parts = host.split(".");
|
|
1100
|
+
if (parts.length > 2)
|
|
1101
|
+
return parts.slice(1).join(".");
|
|
1102
|
+
return host;
|
|
1103
|
+
};
|
|
1104
|
+
const getCookieSync = ({ name, canTrack }) => {
|
|
1105
|
+
try {
|
|
1106
|
+
if (!canTrack)
|
|
1107
|
+
return void 0;
|
|
1108
|
+
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
1109
|
+
} catch (err) {
|
|
1110
|
+
logger.warn("[COOKIE] GET error: ", err?.message || err);
|
|
1111
|
+
return void 0;
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
const getCookie = async (args) => getCookieSync(args);
|
|
1115
|
+
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
1116
|
+
const SECURE_CONFIG = [
|
|
1117
|
+
[
|
|
1118
|
+
"secure",
|
|
1119
|
+
""
|
|
1120
|
+
],
|
|
1121
|
+
[
|
|
1122
|
+
"SameSite",
|
|
1123
|
+
"None"
|
|
1124
|
+
]
|
|
1125
|
+
];
|
|
1126
|
+
const createCookieString = ({ name, value, expires }) => {
|
|
1127
|
+
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
1128
|
+
const secureObj = secure ? SECURE_CONFIG : [
|
|
1129
|
+
[]
|
|
1130
|
+
];
|
|
1131
|
+
const expiresObj = expires ? [
|
|
1132
|
+
[
|
|
1133
|
+
"expires",
|
|
1134
|
+
expires.toUTCString()
|
|
1135
|
+
]
|
|
1136
|
+
] : [
|
|
1137
|
+
[]
|
|
1138
|
+
];
|
|
1139
|
+
const cookieValue = [
|
|
1140
|
+
[
|
|
1141
|
+
name,
|
|
1142
|
+
value
|
|
1143
|
+
],
|
|
1144
|
+
...expiresObj,
|
|
1145
|
+
[
|
|
1146
|
+
"path",
|
|
1147
|
+
"/"
|
|
1148
|
+
],
|
|
1149
|
+
[
|
|
1150
|
+
"domain",
|
|
1151
|
+
getTopLevelDomain(window.location.hostname)
|
|
1152
|
+
],
|
|
1153
|
+
...secureObj
|
|
1154
|
+
];
|
|
1155
|
+
const cookie = stringifyCookie(cookieValue);
|
|
1156
|
+
return cookie;
|
|
1157
|
+
};
|
|
1158
|
+
const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
1159
|
+
try {
|
|
1160
|
+
if (!canTrack)
|
|
1161
|
+
return;
|
|
1162
|
+
const cookie = createCookieString({
|
|
1163
|
+
name,
|
|
1164
|
+
value,
|
|
1165
|
+
expires
|
|
1166
|
+
});
|
|
1167
|
+
document.cookie = cookie;
|
|
1168
|
+
} catch (err) {
|
|
1169
|
+
logger.warn("[COOKIE] SET error: ", err?.message || err);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
const BUILDER_STORE_PREFIX = "builder.tests";
|
|
1173
|
+
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
1174
|
+
const getContentVariationCookie = ({ contentId }) => getCookie({
|
|
1175
|
+
name: getContentTestKey(contentId),
|
|
1176
|
+
canTrack: true
|
|
1177
|
+
});
|
|
1178
|
+
const getContentVariationCookieSync = ({ contentId }) => getCookieSync({
|
|
1179
|
+
name: getContentTestKey(contentId),
|
|
1180
|
+
canTrack: true
|
|
1181
|
+
});
|
|
1182
|
+
const setContentVariationCookie = ({ contentId, value }) => setCookie({
|
|
1183
|
+
name: getContentTestKey(contentId),
|
|
1184
|
+
value,
|
|
1185
|
+
canTrack: true
|
|
1186
|
+
});
|
|
1187
|
+
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
1188
|
+
const getRandomVariationId = ({ id, variations }) => {
|
|
1189
|
+
let n = 0;
|
|
1190
|
+
const random = Math.random();
|
|
1191
|
+
for (const id2 in variations) {
|
|
1192
|
+
const testRatio = variations[id2]?.testRatio;
|
|
1193
|
+
n += testRatio;
|
|
1194
|
+
if (random < n)
|
|
1195
|
+
return id2;
|
|
1196
|
+
}
|
|
1197
|
+
return id;
|
|
1198
|
+
};
|
|
1199
|
+
const getAndSetVariantId = (args) => {
|
|
1200
|
+
const randomVariationId = getRandomVariationId(args);
|
|
1201
|
+
setContentVariationCookie({
|
|
1202
|
+
contentId: args.id,
|
|
1203
|
+
value: randomVariationId
|
|
1204
|
+
}).catch((err) => {
|
|
1205
|
+
logger.error("could not store A/B test variation: ", err);
|
|
1206
|
+
});
|
|
1207
|
+
return randomVariationId;
|
|
1208
|
+
};
|
|
1209
|
+
const getTestFields = ({ item, testGroupId }) => {
|
|
1210
|
+
const variationValue = item.variations[testGroupId];
|
|
1211
|
+
if (testGroupId === item.id || !variationValue)
|
|
1212
|
+
return {
|
|
1213
|
+
testVariationId: item.id,
|
|
1214
|
+
testVariationName: "Default"
|
|
1215
|
+
};
|
|
1216
|
+
else
|
|
1217
|
+
return {
|
|
1218
|
+
data: variationValue.data,
|
|
1219
|
+
testVariationId: variationValue.id,
|
|
1220
|
+
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
const handleABTestingSync = ({ item, canTrack }) => {
|
|
1224
|
+
if (!canTrack)
|
|
1225
|
+
return item;
|
|
1226
|
+
if (!item)
|
|
1227
|
+
return void 0;
|
|
1228
|
+
if (!checkIsBuilderContentWithVariations(item))
|
|
1229
|
+
return item;
|
|
1230
|
+
const testGroupId = getContentVariationCookieSync({
|
|
1231
|
+
contentId: item.id
|
|
1232
|
+
}) || getAndSetVariantId({
|
|
1233
|
+
variations: item.variations,
|
|
1234
|
+
id: item.id
|
|
1235
|
+
});
|
|
1236
|
+
const variationValue = getTestFields({
|
|
1237
|
+
item,
|
|
1238
|
+
testGroupId
|
|
1239
|
+
});
|
|
1240
|
+
return {
|
|
1241
|
+
...item,
|
|
1242
|
+
...variationValue
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
const handleABTesting = async ({ item, canTrack }) => {
|
|
1246
|
+
if (!canTrack)
|
|
1247
|
+
return item;
|
|
1248
|
+
if (!checkIsBuilderContentWithVariations(item))
|
|
1249
|
+
return item;
|
|
1250
|
+
const cookieValue = await getContentVariationCookie({
|
|
1251
|
+
contentId: item.id
|
|
1252
|
+
});
|
|
1253
|
+
const testGroupId = cookieValue || getAndSetVariantId({
|
|
1254
|
+
variations: item.variations,
|
|
1255
|
+
id: item.id
|
|
1256
|
+
});
|
|
1257
|
+
const variationValue = getTestFields({
|
|
1258
|
+
item,
|
|
1259
|
+
testGroupId
|
|
1260
|
+
});
|
|
1261
|
+
return {
|
|
1262
|
+
...item,
|
|
1263
|
+
...variationValue
|
|
1264
|
+
};
|
|
1265
|
+
};
|
|
1266
|
+
const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1267
|
+
const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1268
|
+
return /* @__PURE__ */ _jsxQ("script", null, {
|
|
1269
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
|
|
1270
|
+
props
|
|
1271
|
+
], "p0.scriptStr"),
|
|
1272
|
+
id: _fnSignal((p0) => p0.id, [
|
|
1273
|
+
props
|
|
1274
|
+
], "p0.id")
|
|
1275
|
+
}, null, 3, "WO_0");
|
|
1276
|
+
}, "InlinedScript_component_hwThBdhA8rw"));
|
|
1089
1277
|
const componentInfo$a = {
|
|
1090
1278
|
name: "Core:Button",
|
|
1091
1279
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1634,9 +1822,9 @@ const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1634
1822
|
}
|
|
1635
1823
|
}, {
|
|
1636
1824
|
class: "builder-text",
|
|
1637
|
-
dangerouslySetInnerHTML: _fnSignal((p0) => p0.text, [
|
|
1825
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.text?.toString(), [
|
|
1638
1826
|
props
|
|
1639
|
-
], "p0.text")
|
|
1827
|
+
], "p0.text?.toString()")
|
|
1640
1828
|
}, null, 3, "yO_0");
|
|
1641
1829
|
}, "Text_component_15p0cKUxgIE"));
|
|
1642
1830
|
const componentInfo$3 = {
|
|
@@ -2069,201 +2257,23 @@ const getDefaultRegisteredComponents = () => [
|
|
|
2069
2257
|
...componentInfo$3
|
|
2070
2258
|
}
|
|
2071
2259
|
];
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
if (!canTrack)
|
|
2090
|
-
return void 0;
|
|
2091
|
-
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
2092
|
-
} catch (err) {
|
|
2093
|
-
logger.warn("[COOKIE] GET error: ", err?.message || err);
|
|
2094
|
-
return void 0;
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
const getCookie = async (args) => getCookieSync(args);
|
|
2098
|
-
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
2099
|
-
const SECURE_CONFIG = [
|
|
2100
|
-
[
|
|
2101
|
-
"secure",
|
|
2102
|
-
""
|
|
2103
|
-
],
|
|
2104
|
-
[
|
|
2105
|
-
"SameSite",
|
|
2106
|
-
"None"
|
|
2107
|
-
]
|
|
2108
|
-
];
|
|
2109
|
-
const createCookieString = ({ name, value, expires }) => {
|
|
2110
|
-
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
2111
|
-
const secureObj = secure ? SECURE_CONFIG : [
|
|
2112
|
-
[]
|
|
2113
|
-
];
|
|
2114
|
-
const expiresObj = expires ? [
|
|
2115
|
-
[
|
|
2116
|
-
"expires",
|
|
2117
|
-
expires.toUTCString()
|
|
2118
|
-
]
|
|
2119
|
-
] : [
|
|
2120
|
-
[]
|
|
2121
|
-
];
|
|
2122
|
-
const cookieValue = [
|
|
2123
|
-
[
|
|
2124
|
-
name,
|
|
2125
|
-
value
|
|
2126
|
-
],
|
|
2127
|
-
...expiresObj,
|
|
2128
|
-
[
|
|
2129
|
-
"path",
|
|
2130
|
-
"/"
|
|
2131
|
-
],
|
|
2132
|
-
[
|
|
2133
|
-
"domain",
|
|
2134
|
-
getTopLevelDomain(window.location.hostname)
|
|
2135
|
-
],
|
|
2136
|
-
...secureObj
|
|
2137
|
-
];
|
|
2138
|
-
const cookie = stringifyCookie(cookieValue);
|
|
2139
|
-
return cookie;
|
|
2140
|
-
};
|
|
2141
|
-
const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
2142
|
-
try {
|
|
2143
|
-
if (!canTrack)
|
|
2144
|
-
return;
|
|
2145
|
-
const cookie = createCookieString({
|
|
2146
|
-
name,
|
|
2147
|
-
value,
|
|
2148
|
-
expires
|
|
2149
|
-
});
|
|
2150
|
-
document.cookie = cookie;
|
|
2151
|
-
} catch (err) {
|
|
2152
|
-
logger.warn("[COOKIE] SET error: ", err?.message || err);
|
|
2153
|
-
}
|
|
2154
|
-
};
|
|
2155
|
-
const BUILDER_STORE_PREFIX = "builder.tests";
|
|
2156
|
-
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
2157
|
-
const getContentVariationCookie = ({ contentId }) => getCookie({
|
|
2158
|
-
name: getContentTestKey(contentId),
|
|
2159
|
-
canTrack: true
|
|
2160
|
-
});
|
|
2161
|
-
const getContentVariationCookieSync = ({ contentId }) => getCookieSync({
|
|
2162
|
-
name: getContentTestKey(contentId),
|
|
2163
|
-
canTrack: true
|
|
2164
|
-
});
|
|
2165
|
-
const setContentVariationCookie = ({ contentId, value }) => setCookie({
|
|
2166
|
-
name: getContentTestKey(contentId),
|
|
2167
|
-
value,
|
|
2168
|
-
canTrack: true
|
|
2169
|
-
});
|
|
2170
|
-
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
2171
|
-
const getRandomVariationId = ({ id, variations }) => {
|
|
2172
|
-
let n = 0;
|
|
2173
|
-
const random = Math.random();
|
|
2174
|
-
for (const id2 in variations) {
|
|
2175
|
-
const testRatio = variations[id2]?.testRatio;
|
|
2176
|
-
n += testRatio;
|
|
2177
|
-
if (random < n)
|
|
2178
|
-
return id2;
|
|
2179
|
-
}
|
|
2180
|
-
return id;
|
|
2181
|
-
};
|
|
2182
|
-
const getAndSetVariantId = (args) => {
|
|
2183
|
-
const randomVariationId = getRandomVariationId(args);
|
|
2184
|
-
setContentVariationCookie({
|
|
2185
|
-
contentId: args.id,
|
|
2186
|
-
value: randomVariationId
|
|
2187
|
-
}).catch((err) => {
|
|
2188
|
-
logger.error("could not store A/B test variation: ", err);
|
|
2189
|
-
});
|
|
2190
|
-
return randomVariationId;
|
|
2191
|
-
};
|
|
2192
|
-
const getTestFields = ({ item, testGroupId }) => {
|
|
2193
|
-
const variationValue = item.variations[testGroupId];
|
|
2194
|
-
if (testGroupId === item.id || !variationValue)
|
|
2195
|
-
return {
|
|
2196
|
-
testVariationId: item.id,
|
|
2197
|
-
testVariationName: "Default"
|
|
2198
|
-
};
|
|
2199
|
-
else
|
|
2200
|
-
return {
|
|
2201
|
-
data: variationValue.data,
|
|
2202
|
-
testVariationId: variationValue.id,
|
|
2203
|
-
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
2204
|
-
};
|
|
2205
|
-
};
|
|
2206
|
-
const handleABTestingSync = ({ item, canTrack }) => {
|
|
2207
|
-
if (!canTrack)
|
|
2208
|
-
return item;
|
|
2209
|
-
if (!item)
|
|
2210
|
-
return void 0;
|
|
2211
|
-
if (!checkIsBuilderContentWithVariations(item))
|
|
2212
|
-
return item;
|
|
2213
|
-
const testGroupId = getContentVariationCookieSync({
|
|
2214
|
-
contentId: item.id
|
|
2215
|
-
}) || getAndSetVariantId({
|
|
2216
|
-
variations: item.variations,
|
|
2217
|
-
id: item.id
|
|
2218
|
-
});
|
|
2219
|
-
const variationValue = getTestFields({
|
|
2220
|
-
item,
|
|
2221
|
-
testGroupId
|
|
2222
|
-
});
|
|
2223
|
-
return {
|
|
2224
|
-
...item,
|
|
2225
|
-
...variationValue
|
|
2226
|
-
};
|
|
2227
|
-
};
|
|
2228
|
-
const handleABTesting = async ({ item, canTrack }) => {
|
|
2229
|
-
if (!canTrack)
|
|
2230
|
-
return item;
|
|
2231
|
-
if (!checkIsBuilderContentWithVariations(item))
|
|
2232
|
-
return item;
|
|
2233
|
-
const cookieValue = await getContentVariationCookie({
|
|
2234
|
-
contentId: item.id
|
|
2235
|
-
});
|
|
2236
|
-
const testGroupId = cookieValue || getAndSetVariantId({
|
|
2237
|
-
variations: item.variations,
|
|
2238
|
-
id: item.id
|
|
2239
|
-
});
|
|
2240
|
-
const variationValue = getTestFields({
|
|
2241
|
-
item,
|
|
2242
|
-
testGroupId
|
|
2243
|
-
});
|
|
2244
|
-
return {
|
|
2245
|
-
...item,
|
|
2246
|
-
...variationValue
|
|
2247
|
-
};
|
|
2248
|
-
};
|
|
2249
|
-
const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2250
|
-
function getGlobalThis() {
|
|
2251
|
-
if (typeof globalThis !== "undefined")
|
|
2252
|
-
return globalThis;
|
|
2253
|
-
if (typeof window !== "undefined")
|
|
2254
|
-
return window;
|
|
2255
|
-
if (typeof global !== "undefined")
|
|
2256
|
-
return global;
|
|
2257
|
-
if (typeof self !== "undefined")
|
|
2258
|
-
return self;
|
|
2259
|
-
return globalThis;
|
|
2260
|
-
}
|
|
2261
|
-
function getFetch() {
|
|
2262
|
-
const globalFetch = getGlobalThis().fetch;
|
|
2263
|
-
if (typeof globalFetch === "undefined") {
|
|
2264
|
-
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2265
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
2266
|
-
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
2260
|
+
function getGlobalThis() {
|
|
2261
|
+
if (typeof globalThis !== "undefined")
|
|
2262
|
+
return globalThis;
|
|
2263
|
+
if (typeof window !== "undefined")
|
|
2264
|
+
return window;
|
|
2265
|
+
if (typeof global !== "undefined")
|
|
2266
|
+
return global;
|
|
2267
|
+
if (typeof self !== "undefined")
|
|
2268
|
+
return self;
|
|
2269
|
+
return globalThis;
|
|
2270
|
+
}
|
|
2271
|
+
function getFetch() {
|
|
2272
|
+
const globalFetch = getGlobalThis().fetch;
|
|
2273
|
+
if (typeof globalFetch === "undefined") {
|
|
2274
|
+
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2275
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
2276
|
+
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
2267
2277
|
}
|
|
2268
2278
|
return globalFetch;
|
|
2269
2279
|
}
|
|
@@ -2583,7 +2593,7 @@ async function _track(eventProps) {
|
|
|
2583
2593
|
return;
|
|
2584
2594
|
if (!(isBrowser() || TARGET === "reactNative"))
|
|
2585
2595
|
return;
|
|
2586
|
-
return fetch(`https://builder.io/api/v1/track`, {
|
|
2596
|
+
return fetch(`https://cdn.builder.io/api/v1/track`, {
|
|
2587
2597
|
method: "POST",
|
|
2588
2598
|
body: JSON.stringify({
|
|
2589
2599
|
events: [
|
|
@@ -2652,7 +2662,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
2652
2662
|
}
|
|
2653
2663
|
};
|
|
2654
2664
|
};
|
|
2655
|
-
const SDK_VERSION = "0.4.
|
|
2665
|
+
const SDK_VERSION = "0.4.5";
|
|
2656
2666
|
const registry = {};
|
|
2657
2667
|
function register(type, info) {
|
|
2658
2668
|
let typeList = registry[type];
|
|
@@ -2780,7 +2790,11 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
2780
2790
|
});
|
|
2781
2791
|
}
|
|
2782
2792
|
};
|
|
2783
|
-
const getVariants = (content) => Object.values(content?.variations || {})
|
|
2793
|
+
const getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2794
|
+
...variant,
|
|
2795
|
+
testVariationId: variant.id,
|
|
2796
|
+
id: content?.id
|
|
2797
|
+
}));
|
|
2784
2798
|
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
2785
2799
|
const hasVariants = getVariants(content).length > 0;
|
|
2786
2800
|
if (!hasVariants)
|
|
@@ -2834,10 +2848,10 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2834
2848
|
return contentId;
|
|
2835
2849
|
}
|
|
2836
2850
|
const winningVariantId = getAndSetVariantId2();
|
|
2837
|
-
const styleEl = document.
|
|
2851
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
2838
2852
|
if (isHydrationTarget2) {
|
|
2839
2853
|
styleEl.remove();
|
|
2840
|
-
const thisScriptEl = document.
|
|
2854
|
+
const thisScriptEl = document.currentScript;
|
|
2841
2855
|
thisScriptEl?.remove();
|
|
2842
2856
|
} else {
|
|
2843
2857
|
const newStyleStr = variants.concat({
|
|
@@ -2866,7 +2880,7 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
2866
2880
|
}
|
|
2867
2881
|
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2868
2882
|
const variantId = getCookie2(cookieName);
|
|
2869
|
-
const parentDiv = document.
|
|
2883
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
2870
2884
|
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2871
2885
|
if (variantId === variantContentId) {
|
|
2872
2886
|
if (variantIsDefaultContent)
|
|
@@ -2886,22 +2900,25 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
2886
2900
|
}
|
|
2887
2901
|
return;
|
|
2888
2902
|
}
|
|
2889
|
-
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative"
|
|
2903
|
+
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2890
2904
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2891
|
-
const AB_TEST_FN_NAME = "
|
|
2892
|
-
const CONTENT_FN_NAME = "
|
|
2893
|
-
const
|
|
2905
|
+
const AB_TEST_FN_NAME = "builderIoAbTest";
|
|
2906
|
+
const CONTENT_FN_NAME = "builderIoRenderContent";
|
|
2907
|
+
const getScriptString = () => {
|
|
2894
2908
|
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2895
2909
|
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2896
2910
|
return `
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
${AB_TEST_FN_NAME}("${contentId}", ${JSON.stringify(variants)}, ${isHydrationTarget})
|
|
2911
|
+
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2912
|
+
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2900
2913
|
`;
|
|
2901
2914
|
};
|
|
2902
|
-
const
|
|
2915
|
+
const getVariantsScriptString = (variants, contentId) => {
|
|
2916
|
+
return `
|
|
2917
|
+
window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
|
|
2918
|
+
};
|
|
2919
|
+
const getRenderContentScriptString = ({ contentId, variationId }) => {
|
|
2903
2920
|
return `
|
|
2904
|
-
|
|
2921
|
+
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
2905
2922
|
};
|
|
2906
2923
|
const getCssFromFont = (font) => {
|
|
2907
2924
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -2970,7 +2987,7 @@ ${getFontCss({
|
|
|
2970
2987
|
}
|
|
2971
2988
|
`.trim()
|
|
2972
2989
|
});
|
|
2973
|
-
return /* @__PURE__ */ _jsxC(
|
|
2990
|
+
return /* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
2974
2991
|
get styles() {
|
|
2975
2992
|
return state.injectedStyles;
|
|
2976
2993
|
},
|
|
@@ -3171,8 +3188,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3171
3188
|
httpReqsData: {},
|
|
3172
3189
|
overrideContent: null,
|
|
3173
3190
|
scriptStr: getRenderContentScriptString({
|
|
3174
|
-
|
|
3175
|
-
|
|
3191
|
+
variationId: props.content?.testVariationId,
|
|
3192
|
+
contentId: props.content?.id
|
|
3176
3193
|
}),
|
|
3177
3194
|
update: 0
|
|
3178
3195
|
}, {
|
|
@@ -3282,16 +3299,21 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3282
3299
|
children: state.builderContextSignal.content ? /* @__PURE__ */ _jsxS("div", {
|
|
3283
3300
|
ref: elementRef,
|
|
3284
3301
|
...{},
|
|
3285
|
-
...props.
|
|
3302
|
+
...props.showContent ? {} : {
|
|
3286
3303
|
hidden: true,
|
|
3287
3304
|
"aria-hidden": true
|
|
3288
|
-
}
|
|
3305
|
+
},
|
|
3289
3306
|
children: [
|
|
3290
|
-
props.isSsrAbTest ? /* @__PURE__ */
|
|
3291
|
-
|
|
3292
|
-
state
|
|
3293
|
-
|
|
3294
|
-
|
|
3307
|
+
props.isSsrAbTest ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
3308
|
+
get scriptStr() {
|
|
3309
|
+
return state.scriptStr;
|
|
3310
|
+
},
|
|
3311
|
+
[_IMMUTABLE]: {
|
|
3312
|
+
scriptStr: _fnSignal((p0) => p0.scriptStr, [
|
|
3313
|
+
state
|
|
3314
|
+
], "p0.scriptStr")
|
|
3315
|
+
}
|
|
3316
|
+
}, 3, "03_0") : null,
|
|
3295
3317
|
/* @__PURE__ */ _jsxC(RenderContentStyles, {
|
|
3296
3318
|
get contentId() {
|
|
3297
3319
|
return state.builderContextSignal.content?.id;
|
|
@@ -3346,14 +3368,230 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3346
3368
|
}, 0, "03_2") : null
|
|
3347
3369
|
}, 1, "03_3");
|
|
3348
3370
|
}, "RenderContent_component_hEAI0ahViXM"));
|
|
3371
|
+
const RenderContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3372
|
+
_jsxBranch();
|
|
3373
|
+
const state = useStore({
|
|
3374
|
+
hideVariantsStyleString: getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join(""),
|
|
3375
|
+
shouldRenderVariants: checkShouldRunVariants({
|
|
3376
|
+
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3377
|
+
content: props.content
|
|
3378
|
+
}),
|
|
3379
|
+
variantScriptStr: getVariantsScriptString(getVariants(props.content).map((value) => ({
|
|
3380
|
+
id: value.testVariationId,
|
|
3381
|
+
testRatio: value.testRatio
|
|
3382
|
+
})), props.content?.id || "")
|
|
3383
|
+
});
|
|
3384
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3385
|
+
useLexicalScope();
|
|
3386
|
+
}, "RenderContentVariants_component_useVisibleTask_zc1gmoEX01g", [
|
|
3387
|
+
state
|
|
3388
|
+
]));
|
|
3389
|
+
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
3390
|
+
children: [
|
|
3391
|
+
!props.__isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
3392
|
+
scriptStr: getScriptString()
|
|
3393
|
+
}, 3, "Bz_0") : null,
|
|
3394
|
+
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
3395
|
+
children: [
|
|
3396
|
+
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
3397
|
+
get id() {
|
|
3398
|
+
return `variants-styles-${props.content?.id}`;
|
|
3399
|
+
},
|
|
3400
|
+
get styles() {
|
|
3401
|
+
return state.hideVariantsStyleString;
|
|
3402
|
+
},
|
|
3403
|
+
[_IMMUTABLE]: {
|
|
3404
|
+
id: _fnSignal((p0) => `variants-styles-${p0.content?.id}`, [
|
|
3405
|
+
props
|
|
3406
|
+
], "`variants-styles-${p0.content?.id}`"),
|
|
3407
|
+
styles: _fnSignal((p0) => p0.hideVariantsStyleString, [
|
|
3408
|
+
state
|
|
3409
|
+
], "p0.hideVariantsStyleString")
|
|
3410
|
+
}
|
|
3411
|
+
}, 3, "Bz_1"),
|
|
3412
|
+
/* @__PURE__ */ _jsxC(InlinedScript, {
|
|
3413
|
+
get scriptStr() {
|
|
3414
|
+
return state.variantScriptStr;
|
|
3415
|
+
},
|
|
3416
|
+
[_IMMUTABLE]: {
|
|
3417
|
+
scriptStr: _fnSignal((p0) => p0.variantScriptStr, [
|
|
3418
|
+
state
|
|
3419
|
+
], "p0.variantScriptStr")
|
|
3420
|
+
}
|
|
3421
|
+
}, 3, "Bz_2"),
|
|
3422
|
+
(getVariants(props.content) || []).map(function(variant) {
|
|
3423
|
+
return /* @__PURE__ */ _jsxC(RenderContent, {
|
|
3424
|
+
content: variant,
|
|
3425
|
+
showContent: false,
|
|
3426
|
+
classNameProp: void 0,
|
|
3427
|
+
get model() {
|
|
3428
|
+
return props.model;
|
|
3429
|
+
},
|
|
3430
|
+
get data() {
|
|
3431
|
+
return props.data;
|
|
3432
|
+
},
|
|
3433
|
+
get context() {
|
|
3434
|
+
return props.context;
|
|
3435
|
+
},
|
|
3436
|
+
get apiKey() {
|
|
3437
|
+
return props.apiKey;
|
|
3438
|
+
},
|
|
3439
|
+
get apiVersion() {
|
|
3440
|
+
return props.apiVersion;
|
|
3441
|
+
},
|
|
3442
|
+
get customComponents() {
|
|
3443
|
+
return props.customComponents;
|
|
3444
|
+
},
|
|
3445
|
+
get canTrack() {
|
|
3446
|
+
return props.canTrack;
|
|
3447
|
+
},
|
|
3448
|
+
get locale() {
|
|
3449
|
+
return props.locale;
|
|
3450
|
+
},
|
|
3451
|
+
get includeRefs() {
|
|
3452
|
+
return props.includeRefs;
|
|
3453
|
+
},
|
|
3454
|
+
get enrich() {
|
|
3455
|
+
return props.enrich;
|
|
3456
|
+
},
|
|
3457
|
+
get isSsrAbTest() {
|
|
3458
|
+
return state.shouldRenderVariants;
|
|
3459
|
+
},
|
|
3460
|
+
[_IMMUTABLE]: {
|
|
3461
|
+
showContent: _IMMUTABLE,
|
|
3462
|
+
model: _fnSignal((p0) => p0.model, [
|
|
3463
|
+
props
|
|
3464
|
+
], "p0.model"),
|
|
3465
|
+
data: _fnSignal((p0) => p0.data, [
|
|
3466
|
+
props
|
|
3467
|
+
], "p0.data"),
|
|
3468
|
+
context: _fnSignal((p0) => p0.context, [
|
|
3469
|
+
props
|
|
3470
|
+
], "p0.context"),
|
|
3471
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3472
|
+
props
|
|
3473
|
+
], "p0.apiKey"),
|
|
3474
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3475
|
+
props
|
|
3476
|
+
], "p0.apiVersion"),
|
|
3477
|
+
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3478
|
+
props
|
|
3479
|
+
], "p0.customComponents"),
|
|
3480
|
+
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3481
|
+
props
|
|
3482
|
+
], "p0.canTrack"),
|
|
3483
|
+
locale: _fnSignal((p0) => p0.locale, [
|
|
3484
|
+
props
|
|
3485
|
+
], "p0.locale"),
|
|
3486
|
+
includeRefs: _fnSignal((p0) => p0.includeRefs, [
|
|
3487
|
+
props
|
|
3488
|
+
], "p0.includeRefs"),
|
|
3489
|
+
enrich: _fnSignal((p0) => p0.enrich, [
|
|
3490
|
+
props
|
|
3491
|
+
], "p0.enrich"),
|
|
3492
|
+
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3493
|
+
state
|
|
3494
|
+
], "p0.shouldRenderVariants")
|
|
3495
|
+
}
|
|
3496
|
+
}, 3, variant.testVariationId);
|
|
3497
|
+
})
|
|
3498
|
+
]
|
|
3499
|
+
}, 1, "Bz_3") : null,
|
|
3500
|
+
/* @__PURE__ */ _jsxC(RenderContent, {
|
|
3501
|
+
content: state.shouldRenderVariants ? props.content : handleABTestingSync({
|
|
3502
|
+
item: props.content,
|
|
3503
|
+
canTrack: getDefaultCanTrack(props.canTrack)
|
|
3504
|
+
}),
|
|
3505
|
+
get classNameProp() {
|
|
3506
|
+
return `variant-${props.content?.id}`;
|
|
3507
|
+
},
|
|
3508
|
+
showContent: true,
|
|
3509
|
+
get model() {
|
|
3510
|
+
return props.model;
|
|
3511
|
+
},
|
|
3512
|
+
get data() {
|
|
3513
|
+
return props.data;
|
|
3514
|
+
},
|
|
3515
|
+
get context() {
|
|
3516
|
+
return props.context;
|
|
3517
|
+
},
|
|
3518
|
+
get apiKey() {
|
|
3519
|
+
return props.apiKey;
|
|
3520
|
+
},
|
|
3521
|
+
get apiVersion() {
|
|
3522
|
+
return props.apiVersion;
|
|
3523
|
+
},
|
|
3524
|
+
get customComponents() {
|
|
3525
|
+
return props.customComponents;
|
|
3526
|
+
},
|
|
3527
|
+
get canTrack() {
|
|
3528
|
+
return props.canTrack;
|
|
3529
|
+
},
|
|
3530
|
+
get locale() {
|
|
3531
|
+
return props.locale;
|
|
3532
|
+
},
|
|
3533
|
+
get includeRefs() {
|
|
3534
|
+
return props.includeRefs;
|
|
3535
|
+
},
|
|
3536
|
+
get enrich() {
|
|
3537
|
+
return props.enrich;
|
|
3538
|
+
},
|
|
3539
|
+
get isSsrAbTest() {
|
|
3540
|
+
return state.shouldRenderVariants;
|
|
3541
|
+
},
|
|
3542
|
+
[_IMMUTABLE]: {
|
|
3543
|
+
classNameProp: _fnSignal((p0) => `variant-${p0.content?.id}`, [
|
|
3544
|
+
props
|
|
3545
|
+
], "`variant-${p0.content?.id}`"),
|
|
3546
|
+
showContent: _IMMUTABLE,
|
|
3547
|
+
model: _fnSignal((p0) => p0.model, [
|
|
3548
|
+
props
|
|
3549
|
+
], "p0.model"),
|
|
3550
|
+
data: _fnSignal((p0) => p0.data, [
|
|
3551
|
+
props
|
|
3552
|
+
], "p0.data"),
|
|
3553
|
+
context: _fnSignal((p0) => p0.context, [
|
|
3554
|
+
props
|
|
3555
|
+
], "p0.context"),
|
|
3556
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3557
|
+
props
|
|
3558
|
+
], "p0.apiKey"),
|
|
3559
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3560
|
+
props
|
|
3561
|
+
], "p0.apiVersion"),
|
|
3562
|
+
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3563
|
+
props
|
|
3564
|
+
], "p0.customComponents"),
|
|
3565
|
+
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3566
|
+
props
|
|
3567
|
+
], "p0.canTrack"),
|
|
3568
|
+
locale: _fnSignal((p0) => p0.locale, [
|
|
3569
|
+
props
|
|
3570
|
+
], "p0.locale"),
|
|
3571
|
+
includeRefs: _fnSignal((p0) => p0.includeRefs, [
|
|
3572
|
+
props
|
|
3573
|
+
], "p0.includeRefs"),
|
|
3574
|
+
enrich: _fnSignal((p0) => p0.enrich, [
|
|
3575
|
+
props
|
|
3576
|
+
], "p0.enrich"),
|
|
3577
|
+
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3578
|
+
state
|
|
3579
|
+
], "p0.shouldRenderVariants")
|
|
3580
|
+
}
|
|
3581
|
+
}, 3, "Bz_4")
|
|
3582
|
+
]
|
|
3583
|
+
}, 1, "Bz_5");
|
|
3584
|
+
}, "RenderContentVariants_component_OMvvre8Ofjw"));
|
|
3349
3585
|
const fetchContent = function fetchContent2(props, state, builderContext) {
|
|
3350
3586
|
if (!state.contentToUse && props.symbol?.model && builderContext?.apiKey)
|
|
3351
3587
|
getContent({
|
|
3352
3588
|
model: props.symbol.model,
|
|
3353
3589
|
apiKey: builderContext.apiKey,
|
|
3354
3590
|
apiVersion: builderContext.apiVersion,
|
|
3355
|
-
|
|
3356
|
-
|
|
3591
|
+
...props.symbol?.entry && {
|
|
3592
|
+
query: {
|
|
3593
|
+
id: props.symbol.entry
|
|
3594
|
+
}
|
|
3357
3595
|
}
|
|
3358
3596
|
}).then((response) => {
|
|
3359
3597
|
if (response)
|
|
@@ -3394,7 +3632,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
3394
3632
|
]));
|
|
3395
3633
|
return /* @__PURE__ */ _jsxS("div", {
|
|
3396
3634
|
...props.attributes,
|
|
3397
|
-
children: /* @__PURE__ */ _jsxC(
|
|
3635
|
+
children: /* @__PURE__ */ _jsxC(RenderContentVariants, {
|
|
3398
3636
|
get apiVersion() {
|
|
3399
3637
|
return builderContext.apiVersion;
|
|
3400
3638
|
},
|
|
@@ -3456,162 +3694,6 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
3456
3694
|
], "p0.className")
|
|
3457
3695
|
}, 0, "Wt_1");
|
|
3458
3696
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
3459
|
-
const RenderContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3460
|
-
_jsxBranch();
|
|
3461
|
-
const state = useStore({
|
|
3462
|
-
contentToRender: checkShouldRunVariants({
|
|
3463
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3464
|
-
content: props.content
|
|
3465
|
-
}) ? props.content : handleABTestingSync({
|
|
3466
|
-
item: props.content,
|
|
3467
|
-
canTrack: getDefaultCanTrack(props.canTrack)
|
|
3468
|
-
}),
|
|
3469
|
-
hideVariantsStyleString: getVariants(props.content).map((value) => `.variant-${value.id} { display: none; } `).join(""),
|
|
3470
|
-
shouldRenderVariants: checkShouldRunVariants({
|
|
3471
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3472
|
-
content: props.content
|
|
3473
|
-
}),
|
|
3474
|
-
variantScriptStr: getVariantsScriptString(getVariants(props.content).map((value) => ({
|
|
3475
|
-
id: value.id,
|
|
3476
|
-
testRatio: value.testRatio
|
|
3477
|
-
})), props.content?.id || "")
|
|
3478
|
-
});
|
|
3479
|
-
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
3480
|
-
children: [
|
|
3481
|
-
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
3482
|
-
children: [
|
|
3483
|
-
/* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
3484
|
-
get id() {
|
|
3485
|
-
return `variants-styles-${props.content?.id}`;
|
|
3486
|
-
},
|
|
3487
|
-
get styles() {
|
|
3488
|
-
return state.hideVariantsStyleString;
|
|
3489
|
-
},
|
|
3490
|
-
[_IMMUTABLE]: {
|
|
3491
|
-
id: _fnSignal((p0) => `variants-styles-${p0.content?.id}`, [
|
|
3492
|
-
props
|
|
3493
|
-
], "`variants-styles-${p0.content?.id}`"),
|
|
3494
|
-
styles: _fnSignal((p0) => p0.hideVariantsStyleString, [
|
|
3495
|
-
state
|
|
3496
|
-
], "p0.hideVariantsStyleString")
|
|
3497
|
-
}
|
|
3498
|
-
}, 3, "Bz_0"),
|
|
3499
|
-
/* @__PURE__ */ _jsxQ("script", null, {
|
|
3500
|
-
id: _fnSignal((p0) => `variants-script-${p0.content?.id}`, [
|
|
3501
|
-
props
|
|
3502
|
-
], "`variants-script-${p0.content?.id}`"),
|
|
3503
|
-
dangerouslySetInnerHTML: _fnSignal((p0) => p0.variantScriptStr, [
|
|
3504
|
-
state
|
|
3505
|
-
], "p0.variantScriptStr")
|
|
3506
|
-
}, null, 3, null),
|
|
3507
|
-
(getVariants(props.content) || []).map(function(variant) {
|
|
3508
|
-
return /* @__PURE__ */ _jsxC(RenderContent, {
|
|
3509
|
-
content: variant,
|
|
3510
|
-
get apiKey() {
|
|
3511
|
-
return props.apiKey;
|
|
3512
|
-
},
|
|
3513
|
-
get apiVersion() {
|
|
3514
|
-
return props.apiVersion;
|
|
3515
|
-
},
|
|
3516
|
-
get canTrack() {
|
|
3517
|
-
return props.canTrack;
|
|
3518
|
-
},
|
|
3519
|
-
get customComponents() {
|
|
3520
|
-
return props.customComponents;
|
|
3521
|
-
},
|
|
3522
|
-
hideContent: true,
|
|
3523
|
-
get parentContentId() {
|
|
3524
|
-
return props.content?.id;
|
|
3525
|
-
},
|
|
3526
|
-
get isSsrAbTest() {
|
|
3527
|
-
return state.shouldRenderVariants;
|
|
3528
|
-
},
|
|
3529
|
-
[_IMMUTABLE]: {
|
|
3530
|
-
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3531
|
-
props
|
|
3532
|
-
], "p0.apiKey"),
|
|
3533
|
-
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3534
|
-
props
|
|
3535
|
-
], "p0.apiVersion"),
|
|
3536
|
-
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3537
|
-
props
|
|
3538
|
-
], "p0.canTrack"),
|
|
3539
|
-
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3540
|
-
props
|
|
3541
|
-
], "p0.customComponents"),
|
|
3542
|
-
hideContent: _IMMUTABLE,
|
|
3543
|
-
parentContentId: _fnSignal((p0) => p0.content?.id, [
|
|
3544
|
-
props
|
|
3545
|
-
], "p0.content?.id"),
|
|
3546
|
-
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3547
|
-
state
|
|
3548
|
-
], "p0.shouldRenderVariants")
|
|
3549
|
-
}
|
|
3550
|
-
}, 3, variant.id);
|
|
3551
|
-
})
|
|
3552
|
-
]
|
|
3553
|
-
}, 1, "Bz_1") : null,
|
|
3554
|
-
/* @__PURE__ */ _jsxC(RenderContent, {
|
|
3555
|
-
get model() {
|
|
3556
|
-
return props.model;
|
|
3557
|
-
},
|
|
3558
|
-
get content() {
|
|
3559
|
-
return state.contentToRender;
|
|
3560
|
-
},
|
|
3561
|
-
get apiKey() {
|
|
3562
|
-
return props.apiKey;
|
|
3563
|
-
},
|
|
3564
|
-
get apiVersion() {
|
|
3565
|
-
return props.apiVersion;
|
|
3566
|
-
},
|
|
3567
|
-
get canTrack() {
|
|
3568
|
-
return props.canTrack;
|
|
3569
|
-
},
|
|
3570
|
-
get customComponents() {
|
|
3571
|
-
return props.customComponents;
|
|
3572
|
-
},
|
|
3573
|
-
get classNameProp() {
|
|
3574
|
-
return `variant-${props.content?.id}`;
|
|
3575
|
-
},
|
|
3576
|
-
get parentContentId() {
|
|
3577
|
-
return props.content?.id;
|
|
3578
|
-
},
|
|
3579
|
-
get isSsrAbTest() {
|
|
3580
|
-
return state.shouldRenderVariants;
|
|
3581
|
-
},
|
|
3582
|
-
[_IMMUTABLE]: {
|
|
3583
|
-
model: _fnSignal((p0) => p0.model, [
|
|
3584
|
-
props
|
|
3585
|
-
], "p0.model"),
|
|
3586
|
-
content: _fnSignal((p0) => p0.contentToRender, [
|
|
3587
|
-
state
|
|
3588
|
-
], "p0.contentToRender"),
|
|
3589
|
-
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3590
|
-
props
|
|
3591
|
-
], "p0.apiKey"),
|
|
3592
|
-
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3593
|
-
props
|
|
3594
|
-
], "p0.apiVersion"),
|
|
3595
|
-
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3596
|
-
props
|
|
3597
|
-
], "p0.canTrack"),
|
|
3598
|
-
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3599
|
-
props
|
|
3600
|
-
], "p0.customComponents"),
|
|
3601
|
-
classNameProp: _fnSignal((p0) => `variant-${p0.content?.id}`, [
|
|
3602
|
-
props
|
|
3603
|
-
], "`variant-${p0.content?.id}`"),
|
|
3604
|
-
parentContentId: _fnSignal((p0) => p0.content?.id, [
|
|
3605
|
-
props
|
|
3606
|
-
], "p0.content?.id"),
|
|
3607
|
-
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3608
|
-
state
|
|
3609
|
-
], "p0.shouldRenderVariants")
|
|
3610
|
-
}
|
|
3611
|
-
}, 3, "Bz_2")
|
|
3612
|
-
]
|
|
3613
|
-
}, 1, "Bz_3");
|
|
3614
|
-
}, "RenderContentVariants_component_OMvvre8Ofjw"));
|
|
3615
3697
|
const settings = {};
|
|
3616
3698
|
function setEditorSettings(newSettings) {
|
|
3617
3699
|
if (isBrowser()) {
|