@builder.io/sdk-solid 4.0.8 → 4.0.9
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/dist/index.d.ts +14 -2
- package/lib/browser/dev.js +360 -282
- package/lib/browser/dev.jsx +283 -258
- package/lib/browser/index.js +360 -282
- package/lib/browser/index.jsx +283 -258
- package/lib/edge/dev.js +360 -282
- package/lib/edge/dev.jsx +283 -258
- package/lib/edge/index.js +360 -282
- package/lib/edge/index.jsx +283 -258
- package/lib/node/dev.js +360 -282
- package/lib/node/dev.jsx +283 -258
- package/lib/node/index.js +360 -282
- package/lib/node/index.jsx +283 -258
- package/package.json +1 -1
package/lib/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic
|
|
1
|
+
import { delegateEvents, createComponent, memo, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic } from 'solid-js/web';
|
|
2
2
|
import { createContext, useContext, Show, For, createMemo, onMount, createSignal, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/blocks/button/button.tsx
|
|
@@ -1659,7 +1659,7 @@ function Block(props) {
|
|
|
1659
1659
|
});
|
|
1660
1660
|
}
|
|
1661
1661
|
var block_default = Block;
|
|
1662
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1662
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
|
|
1663
1663
|
display: flex;
|
|
1664
1664
|
flex-direction: column;
|
|
1665
1665
|
align-items: stretch;
|
|
@@ -1708,7 +1708,7 @@ function BlocksWrapper(props) {
|
|
|
1708
1708
|
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
1709
1709
|
return [createComponent(Dynamic, mergeProps({
|
|
1710
1710
|
get ["class"]() {
|
|
1711
|
-
return className() + " dynamic-
|
|
1711
|
+
return className() + " dynamic-450facf4";
|
|
1712
1712
|
},
|
|
1713
1713
|
ref(r$) {
|
|
1714
1714
|
const _ref$ = blocksWrapperRef;
|
|
@@ -1755,17 +1755,17 @@ function Blocks(props) {
|
|
|
1755
1755
|
get styleProp() {
|
|
1756
1756
|
return props.styleProp;
|
|
1757
1757
|
},
|
|
1758
|
+
get BlocksWrapperProps() {
|
|
1759
|
+
return props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1760
|
+
},
|
|
1758
1761
|
get classNameProp() {
|
|
1759
1762
|
return props.className;
|
|
1760
1763
|
},
|
|
1761
1764
|
get BlocksWrapper() {
|
|
1762
1765
|
return props.context?.BlocksWrapper || builderContext?.BlocksWrapper;
|
|
1763
1766
|
},
|
|
1764
|
-
get BlocksWrapperProps() {
|
|
1765
|
-
return props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1766
|
-
},
|
|
1767
1767
|
get children() {
|
|
1768
|
-
return createComponent(Show, {
|
|
1768
|
+
return [memo(() => props.children), createComponent(Show, {
|
|
1769
1769
|
get when() {
|
|
1770
1770
|
return props.blocks;
|
|
1771
1771
|
},
|
|
@@ -1794,7 +1794,7 @@ function Blocks(props) {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
});
|
|
1796
1796
|
}
|
|
1797
|
-
});
|
|
1797
|
+
})];
|
|
1798
1798
|
}
|
|
1799
1799
|
});
|
|
1800
1800
|
}
|
|
@@ -2218,6 +2218,166 @@ function SectionComponent(props) {
|
|
|
2218
2218
|
}
|
|
2219
2219
|
var section_default = SectionComponent;
|
|
2220
2220
|
|
|
2221
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
2222
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
2223
|
+
function isString(val) {
|
|
2224
|
+
return typeof val === "string";
|
|
2225
|
+
}
|
|
2226
|
+
function isNumber(val) {
|
|
2227
|
+
return typeof val === "number";
|
|
2228
|
+
}
|
|
2229
|
+
function objectMatchesQuery(userattr, query2) {
|
|
2230
|
+
const result = (() => {
|
|
2231
|
+
const property = query2.property;
|
|
2232
|
+
const operator = query2.operator;
|
|
2233
|
+
let testValue = query2.value;
|
|
2234
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
2235
|
+
testValue = query2.value.slice(0, -1);
|
|
2236
|
+
}
|
|
2237
|
+
if (!(property && operator)) {
|
|
2238
|
+
return true;
|
|
2239
|
+
}
|
|
2240
|
+
if (Array.isArray(testValue)) {
|
|
2241
|
+
if (operator === "isNot") {
|
|
2242
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
2243
|
+
property,
|
|
2244
|
+
operator,
|
|
2245
|
+
value: val
|
|
2246
|
+
}));
|
|
2247
|
+
}
|
|
2248
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
2249
|
+
property,
|
|
2250
|
+
operator,
|
|
2251
|
+
value: val
|
|
2252
|
+
}));
|
|
2253
|
+
}
|
|
2254
|
+
const value = userattr[property];
|
|
2255
|
+
if (Array.isArray(value)) {
|
|
2256
|
+
return value.includes(testValue);
|
|
2257
|
+
}
|
|
2258
|
+
switch (operator) {
|
|
2259
|
+
case "is":
|
|
2260
|
+
return value === testValue;
|
|
2261
|
+
case "isNot":
|
|
2262
|
+
return value !== testValue;
|
|
2263
|
+
case "contains":
|
|
2264
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
2265
|
+
case "startsWith":
|
|
2266
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
2267
|
+
case "endsWith":
|
|
2268
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
2269
|
+
case "greaterThan":
|
|
2270
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
2271
|
+
case "lessThan":
|
|
2272
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
2273
|
+
case "greaterThanOrEqualTo":
|
|
2274
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
2275
|
+
case "lessThanOrEqualTo":
|
|
2276
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
2277
|
+
default:
|
|
2278
|
+
return false;
|
|
2279
|
+
}
|
|
2280
|
+
})();
|
|
2281
|
+
return result;
|
|
2282
|
+
}
|
|
2283
|
+
const item = {
|
|
2284
|
+
query,
|
|
2285
|
+
startDate,
|
|
2286
|
+
endDate
|
|
2287
|
+
};
|
|
2288
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
2289
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
2290
|
+
return false;
|
|
2291
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
2292
|
+
return false;
|
|
2293
|
+
}
|
|
2294
|
+
if (!item.query || !item.query.length) {
|
|
2295
|
+
return true;
|
|
2296
|
+
}
|
|
2297
|
+
return item.query.every((filter) => {
|
|
2298
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
var PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, isHydrationTarget, locale) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const parentDiv = document.currentScript?.parentElement;\n const variantId = parentDiv?.getAttribute('data-variant-id');\n const isDefaultVariant = variantId === `${blockId}-default`;\n const isWinningVariant = winningVariantIndex !== -1 && variantId === `${blockId}-${winningVariantIndex}` || winningVariantIndex === -1 && isDefaultVariant;\n if (isWinningVariant && !isDefaultVariant) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultVariant) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n const itsStyleEl = parentDiv?.previousElementSibling;\n if (itsStyleEl) {\n itsStyleEl.remove();\n }\n parentDiv?.remove();\n }\n const thisScript = document.currentScript;\n if (thisScript) {\n thisScript.remove();\n }\n }\n}";
|
|
2302
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
|
|
2303
|
+
var UPDATE_VISIBILITY_STYLES_SCRIPT = "function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const visibilityStylesEl = document.currentScript?.previousElementSibling;\n if (!visibilityStylesEl) {\n return;\n }\n if (isHydrationTarget) {\n visibilityStylesEl.remove();\n const currentScript = document.currentScript;\n if (currentScript) {\n currentScript.remove();\n }\n } else {\n const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n if (winningVariantIndex !== -1) {\n let newStyleStr = variants?.map((_, index) => {\n if (index === winningVariantIndex) return '';\n return `div[data-variant-id=\"${blockId}-${index}\"] { display: none !important; } `;\n }).join('') || '';\n newStyleStr += `div[data-variant-id=\"${blockId}-default\"] { display: none !important; } `;\n visibilityStylesEl.innerHTML = newStyleStr;\n }\n }\n}";
|
|
2304
|
+
|
|
2305
|
+
// src/blocks/personalization-container/helpers.ts
|
|
2306
|
+
var DEFAULT_INDEX = "default";
|
|
2307
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
|
|
2308
|
+
var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
|
|
2309
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
|
|
2310
|
+
var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
|
|
2311
|
+
var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
|
|
2312
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
2313
|
+
const hasVariants = variants && variants.length > 0;
|
|
2314
|
+
if (TARGET === "reactNative")
|
|
2315
|
+
return false;
|
|
2316
|
+
if (!hasVariants)
|
|
2317
|
+
return false;
|
|
2318
|
+
if (!canTrack)
|
|
2319
|
+
return false;
|
|
2320
|
+
if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
|
|
2321
|
+
return true;
|
|
2322
|
+
if (isBrowser())
|
|
2323
|
+
return false;
|
|
2324
|
+
return true;
|
|
2325
|
+
}
|
|
2326
|
+
function getBlocksToRender({
|
|
2327
|
+
variants,
|
|
2328
|
+
previewingIndex,
|
|
2329
|
+
isHydrated,
|
|
2330
|
+
filteredVariants,
|
|
2331
|
+
fallbackBlocks
|
|
2332
|
+
}) {
|
|
2333
|
+
const fallback = {
|
|
2334
|
+
blocks: fallbackBlocks ?? [],
|
|
2335
|
+
path: "this.children",
|
|
2336
|
+
index: DEFAULT_INDEX
|
|
2337
|
+
};
|
|
2338
|
+
if (isHydrated && isEditing()) {
|
|
2339
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
2340
|
+
const variant = variants?.[previewingIndex];
|
|
2341
|
+
if (variant) {
|
|
2342
|
+
return {
|
|
2343
|
+
blocks: variant.blocks,
|
|
2344
|
+
path: `variants.${previewingIndex}.blocks`,
|
|
2345
|
+
index: previewingIndex
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
return fallback;
|
|
2350
|
+
}
|
|
2351
|
+
if (isBrowser()) {
|
|
2352
|
+
const winningVariant = filteredVariants?.[0];
|
|
2353
|
+
if (winningVariant && variants) {
|
|
2354
|
+
const variantIndex = variants.indexOf(winningVariant);
|
|
2355
|
+
if (variantIndex !== -1) {
|
|
2356
|
+
return {
|
|
2357
|
+
blocks: winningVariant.blocks,
|
|
2358
|
+
path: `variants.${variantIndex}.blocks`,
|
|
2359
|
+
index: variantIndex
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
return fallback;
|
|
2365
|
+
}
|
|
2366
|
+
var getInitPersonalizationVariantsFnsScriptString = () => {
|
|
2367
|
+
return `
|
|
2368
|
+
window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
2369
|
+
window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
|
|
2370
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
2371
|
+
`;
|
|
2372
|
+
};
|
|
2373
|
+
var isHydrationTarget = TARGET === "react";
|
|
2374
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
2375
|
+
return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2376
|
+
};
|
|
2377
|
+
var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
|
|
2378
|
+
return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2221
2381
|
// src/helpers/url.ts
|
|
2222
2382
|
var getTopLevelDomain = (host) => {
|
|
2223
2383
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
@@ -3196,7 +3356,8 @@ var componentInfo6 = {
|
|
|
3196
3356
|
name: "PersonalizationContainer",
|
|
3197
3357
|
shouldReceiveBuilderProps: {
|
|
3198
3358
|
builderBlock: true,
|
|
3199
|
-
builderContext: true
|
|
3359
|
+
builderContext: true,
|
|
3360
|
+
builderComponents: true
|
|
3200
3361
|
},
|
|
3201
3362
|
noWrap: true,
|
|
3202
3363
|
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
@@ -3258,208 +3419,22 @@ function isPreviewing(_search) {
|
|
|
3258
3419
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3259
3420
|
}
|
|
3260
3421
|
|
|
3261
|
-
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3262
|
-
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3263
|
-
function isString(val) {
|
|
3264
|
-
return typeof val === "string";
|
|
3265
|
-
}
|
|
3266
|
-
function isNumber(val) {
|
|
3267
|
-
return typeof val === "number";
|
|
3268
|
-
}
|
|
3269
|
-
function objectMatchesQuery(userattr, query2) {
|
|
3270
|
-
const result = (() => {
|
|
3271
|
-
const property = query2.property;
|
|
3272
|
-
const operator = query2.operator;
|
|
3273
|
-
let testValue = query2.value;
|
|
3274
|
-
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3275
|
-
testValue = query2.value.slice(0, -1);
|
|
3276
|
-
}
|
|
3277
|
-
if (!(property && operator)) {
|
|
3278
|
-
return true;
|
|
3279
|
-
}
|
|
3280
|
-
if (Array.isArray(testValue)) {
|
|
3281
|
-
if (operator === "isNot") {
|
|
3282
|
-
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3283
|
-
property,
|
|
3284
|
-
operator,
|
|
3285
|
-
value: val
|
|
3286
|
-
}));
|
|
3287
|
-
}
|
|
3288
|
-
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3289
|
-
property,
|
|
3290
|
-
operator,
|
|
3291
|
-
value: val
|
|
3292
|
-
}));
|
|
3293
|
-
}
|
|
3294
|
-
const value = userattr[property];
|
|
3295
|
-
if (Array.isArray(value)) {
|
|
3296
|
-
return value.includes(testValue);
|
|
3297
|
-
}
|
|
3298
|
-
switch (operator) {
|
|
3299
|
-
case "is":
|
|
3300
|
-
return value === testValue;
|
|
3301
|
-
case "isNot":
|
|
3302
|
-
return value !== testValue;
|
|
3303
|
-
case "contains":
|
|
3304
|
-
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3305
|
-
case "startsWith":
|
|
3306
|
-
return isString(value) && value.startsWith(String(testValue));
|
|
3307
|
-
case "endsWith":
|
|
3308
|
-
return isString(value) && value.endsWith(String(testValue));
|
|
3309
|
-
case "greaterThan":
|
|
3310
|
-
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3311
|
-
case "lessThan":
|
|
3312
|
-
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3313
|
-
case "greaterThanOrEqualTo":
|
|
3314
|
-
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3315
|
-
case "lessThanOrEqualTo":
|
|
3316
|
-
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3317
|
-
default:
|
|
3318
|
-
return false;
|
|
3319
|
-
}
|
|
3320
|
-
})();
|
|
3321
|
-
return result;
|
|
3322
|
-
}
|
|
3323
|
-
const item = {
|
|
3324
|
-
query,
|
|
3325
|
-
startDate,
|
|
3326
|
-
endDate
|
|
3327
|
-
};
|
|
3328
|
-
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3329
|
-
if (item.startDate && new Date(item.startDate) > now) {
|
|
3330
|
-
return false;
|
|
3331
|
-
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3332
|
-
return false;
|
|
3333
|
-
}
|
|
3334
|
-
if (!item.query || !item.query.length) {
|
|
3335
|
-
return true;
|
|
3336
|
-
}
|
|
3337
|
-
return item.query.every((filter) => {
|
|
3338
|
-
return objectMatchesQuery(userAttributes, filter);
|
|
3339
|
-
});
|
|
3340
|
-
}
|
|
3341
|
-
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3342
|
-
if (!navigator.cookieEnabled) {
|
|
3343
|
-
return;
|
|
3344
|
-
}
|
|
3345
|
-
function getCookie(name) {
|
|
3346
|
-
const nameEQ = name + '=';
|
|
3347
|
-
const ca = document.cookie.split(';');
|
|
3348
|
-
for (let i = 0; i < ca.length; i++) {
|
|
3349
|
-
let c = ca[i];
|
|
3350
|
-
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3351
|
-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3352
|
-
}
|
|
3353
|
-
return null;
|
|
3354
|
-
}
|
|
3355
|
-
function removeVariants() {
|
|
3356
|
-
variants?.forEach(function (_, index) {
|
|
3357
|
-
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3358
|
-
});
|
|
3359
|
-
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3360
|
-
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3361
|
-
}
|
|
3362
|
-
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3363
|
-
if (locale) {
|
|
3364
|
-
attributes.locale = locale;
|
|
3365
|
-
}
|
|
3366
|
-
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3367
|
-
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3368
|
-
});
|
|
3369
|
-
const isDebug = location.href.includes('builder.debug=true');
|
|
3370
|
-
if (isDebug) {
|
|
3371
|
-
console.debug('PersonalizationContainer', {
|
|
3372
|
-
attributes,
|
|
3373
|
-
variants,
|
|
3374
|
-
winningVariantIndex
|
|
3375
|
-
});
|
|
3376
|
-
}
|
|
3377
|
-
if (winningVariantIndex !== -1) {
|
|
3378
|
-
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3379
|
-
if (winningVariant) {
|
|
3380
|
-
const parentNode = winningVariant.parentNode;
|
|
3381
|
-
if (parentNode) {
|
|
3382
|
-
const newParent = parentNode.cloneNode(false);
|
|
3383
|
-
newParent.appendChild(winningVariant.content.firstChild);
|
|
3384
|
-
newParent.appendChild(winningVariant.content.lastChild);
|
|
3385
|
-
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3386
|
-
}
|
|
3387
|
-
if (isDebug) {
|
|
3388
|
-
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
} else if (variants && variants.length > 0) {
|
|
3392
|
-
removeVariants();
|
|
3393
|
-
}
|
|
3394
|
-
}`;
|
|
3395
|
-
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
|
|
3396
|
-
|
|
3397
|
-
// src/blocks/personalization-container/helpers.ts
|
|
3398
|
-
function checkShouldRenderVariants(variants, canTrack) {
|
|
3399
|
-
const hasVariants = variants && variants.length > 0;
|
|
3400
|
-
if (TARGET === "reactNative")
|
|
3401
|
-
return false;
|
|
3402
|
-
if (!hasVariants)
|
|
3403
|
-
return false;
|
|
3404
|
-
if (!canTrack)
|
|
3405
|
-
return false;
|
|
3406
|
-
if (TARGET === "vue" || TARGET === "svelte")
|
|
3407
|
-
return true;
|
|
3408
|
-
if (isBrowser())
|
|
3409
|
-
return false;
|
|
3410
|
-
return true;
|
|
3411
|
-
}
|
|
3412
|
-
function getBlocksToRender({
|
|
3413
|
-
variants,
|
|
3414
|
-
previewingIndex,
|
|
3415
|
-
isHydrated,
|
|
3416
|
-
filteredVariants,
|
|
3417
|
-
fallbackBlocks
|
|
3418
|
-
}) {
|
|
3419
|
-
const fallback = {
|
|
3420
|
-
blocks: fallbackBlocks ?? [],
|
|
3421
|
-
path: "this.children"
|
|
3422
|
-
};
|
|
3423
|
-
if (isHydrated && isEditing()) {
|
|
3424
|
-
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3425
|
-
const variant = variants[previewingIndex];
|
|
3426
|
-
return {
|
|
3427
|
-
blocks: variant.blocks,
|
|
3428
|
-
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3429
|
-
};
|
|
3430
|
-
}
|
|
3431
|
-
return fallback;
|
|
3432
|
-
}
|
|
3433
|
-
if (isBrowser()) {
|
|
3434
|
-
const winningVariant = filteredVariants?.[0];
|
|
3435
|
-
if (winningVariant) {
|
|
3436
|
-
return {
|
|
3437
|
-
blocks: winningVariant.blocks,
|
|
3438
|
-
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3439
|
-
};
|
|
3440
|
-
}
|
|
3441
|
-
}
|
|
3442
|
-
return fallback;
|
|
3443
|
-
}
|
|
3444
|
-
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3445
|
-
return `
|
|
3446
|
-
(function() {
|
|
3447
|
-
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3448
|
-
${PERSONALIZATION_SCRIPT}
|
|
3449
|
-
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3450
|
-
})();
|
|
3451
|
-
`;
|
|
3452
|
-
};
|
|
3453
|
-
|
|
3454
3422
|
// src/blocks/personalization-container/personalization-container.tsx
|
|
3455
3423
|
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
3456
|
-
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
3457
3424
|
function PersonalizationContainer(props) {
|
|
3458
3425
|
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
3459
3426
|
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3427
|
+
const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal(getUpdateVisibilityStylesScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3460
3428
|
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
3461
3429
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
3462
|
-
const [
|
|
3430
|
+
const [shouldResetVariants, setShouldResetVariants] = createSignal(false);
|
|
3431
|
+
const attrs = createMemo(() => {
|
|
3432
|
+
return {
|
|
3433
|
+
...props.attributes,
|
|
3434
|
+
...{},
|
|
3435
|
+
[getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
|
|
3436
|
+
};
|
|
3437
|
+
});
|
|
3463
3438
|
const filteredVariants = createMemo(() => {
|
|
3464
3439
|
return (props.variants || []).filter((variant) => {
|
|
3465
3440
|
return filterWithCustomTargeting({
|
|
@@ -3474,26 +3449,26 @@ function PersonalizationContainer(props) {
|
|
|
3474
3449
|
return getBlocksToRender({
|
|
3475
3450
|
variants: props.variants,
|
|
3476
3451
|
fallbackBlocks: props.builderBlock?.children,
|
|
3477
|
-
isHydrated:
|
|
3452
|
+
isHydrated: shouldResetVariants(),
|
|
3478
3453
|
filteredVariants: filteredVariants(),
|
|
3479
3454
|
previewingIndex: props.previewingIndex
|
|
3480
3455
|
});
|
|
3481
3456
|
});
|
|
3482
3457
|
const hideVariantsStyleString = createMemo(() => {
|
|
3483
|
-
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
3458
|
+
return (props.variants || []).map((_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `).join("");
|
|
3484
3459
|
});
|
|
3485
3460
|
let rootRef;
|
|
3486
3461
|
onMount(() => {
|
|
3487
|
-
|
|
3488
|
-
const unsub = userAttributesService.subscribeOnUserAttributesChange((
|
|
3489
|
-
setUserAttributes(
|
|
3462
|
+
setShouldResetVariants(true);
|
|
3463
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs2) => {
|
|
3464
|
+
setUserAttributes(attrs2);
|
|
3490
3465
|
});
|
|
3491
3466
|
if (!(isEditing() || isPreviewing())) {
|
|
3492
3467
|
const variant = filteredVariants()[0];
|
|
3493
3468
|
if (rootRef) {
|
|
3494
3469
|
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
3495
3470
|
detail: {
|
|
3496
|
-
variant: variant ||
|
|
3471
|
+
variant: variant || DEFAULT_INDEX,
|
|
3497
3472
|
content: props.builderContext?.content
|
|
3498
3473
|
},
|
|
3499
3474
|
bubbles: true
|
|
@@ -3503,7 +3478,7 @@ function PersonalizationContainer(props) {
|
|
|
3503
3478
|
if (entry.isIntersecting && rootRef) {
|
|
3504
3479
|
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
3505
3480
|
detail: {
|
|
3506
|
-
variant: variant ||
|
|
3481
|
+
variant: variant || DEFAULT_INDEX,
|
|
3507
3482
|
content: props.builderContext?.content
|
|
3508
3483
|
},
|
|
3509
3484
|
bubbles: true
|
|
@@ -3520,70 +3495,158 @@ function PersonalizationContainer(props) {
|
|
|
3520
3495
|
const _el$ = _tmpl$9();
|
|
3521
3496
|
const _ref$ = rootRef;
|
|
3522
3497
|
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
3523
|
-
spread(_el$, mergeProps(
|
|
3524
|
-
get ["class"]() {
|
|
3525
|
-
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
3526
|
-
}
|
|
3527
|
-
}, () => props.attributes), false, true);
|
|
3498
|
+
spread(_el$, mergeProps(attrs), false, true);
|
|
3528
3499
|
insert(_el$, createComponent(Show, {
|
|
3529
3500
|
get when() {
|
|
3530
|
-
return
|
|
3501
|
+
return memo(() => !!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3531
3502
|
},
|
|
3532
3503
|
get children() {
|
|
3533
|
-
return
|
|
3534
|
-
get
|
|
3535
|
-
return
|
|
3504
|
+
return createComponent(blocks_default, {
|
|
3505
|
+
get blocks() {
|
|
3506
|
+
return blocksToRender().blocks;
|
|
3536
3507
|
},
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
return (() => {
|
|
3540
|
-
const _el$2 = _tmpl$25();
|
|
3541
|
-
setAttribute(_el$2, "key", index);
|
|
3542
|
-
insert(_el$2, createComponent(blocks_default, {
|
|
3543
|
-
get blocks() {
|
|
3544
|
-
return variant.blocks;
|
|
3545
|
-
},
|
|
3546
|
-
get parent() {
|
|
3547
|
-
return props.builderBlock?.id;
|
|
3548
|
-
},
|
|
3549
|
-
path: `component.options.variants.${index}.blocks`
|
|
3550
|
-
}));
|
|
3551
|
-
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
3552
|
-
return _el$2;
|
|
3553
|
-
})();
|
|
3554
|
-
}
|
|
3555
|
-
}), createComponent(inlined_styles_default, {
|
|
3556
|
-
get nonce() {
|
|
3557
|
-
return props.builderContext?.nonce || "";
|
|
3508
|
+
get parent() {
|
|
3509
|
+
return props.builderBlock?.id;
|
|
3558
3510
|
},
|
|
3559
|
-
get
|
|
3560
|
-
return
|
|
3511
|
+
get path() {
|
|
3512
|
+
return blocksToRender().path;
|
|
3561
3513
|
},
|
|
3562
|
-
get
|
|
3563
|
-
return
|
|
3564
|
-
}
|
|
3565
|
-
}), createComponent(inlined_script_default, {
|
|
3566
|
-
get nonce() {
|
|
3567
|
-
return props.builderContext?.nonce || "";
|
|
3514
|
+
get context() {
|
|
3515
|
+
return props.builderContext;
|
|
3568
3516
|
},
|
|
3569
|
-
get
|
|
3570
|
-
return
|
|
3517
|
+
get registeredComponents() {
|
|
3518
|
+
return props.builderComponents;
|
|
3571
3519
|
},
|
|
3572
|
-
get
|
|
3573
|
-
return
|
|
3520
|
+
get BlocksWrapperProps() {
|
|
3521
|
+
return {
|
|
3522
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3523
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3524
|
+
};
|
|
3574
3525
|
}
|
|
3575
|
-
})
|
|
3526
|
+
});
|
|
3576
3527
|
}
|
|
3577
3528
|
}), null);
|
|
3578
|
-
insert(_el$, createComponent(
|
|
3579
|
-
get
|
|
3580
|
-
return
|
|
3581
|
-
},
|
|
3582
|
-
get parent() {
|
|
3583
|
-
return props.builderBlock?.id;
|
|
3529
|
+
insert(_el$, createComponent(Show, {
|
|
3530
|
+
get when() {
|
|
3531
|
+
return memo(() => !!!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3584
3532
|
},
|
|
3585
|
-
get
|
|
3586
|
-
return
|
|
3533
|
+
get children() {
|
|
3534
|
+
return [createComponent(Show, {
|
|
3535
|
+
get when() {
|
|
3536
|
+
return shouldRenderVariants();
|
|
3537
|
+
},
|
|
3538
|
+
get children() {
|
|
3539
|
+
return [createComponent(inlined_styles_default, {
|
|
3540
|
+
get nonce() {
|
|
3541
|
+
return props.builderContext?.nonce || "";
|
|
3542
|
+
},
|
|
3543
|
+
get styles() {
|
|
3544
|
+
return hideVariantsStyleString();
|
|
3545
|
+
},
|
|
3546
|
+
get id() {
|
|
3547
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
3548
|
+
}
|
|
3549
|
+
}), createComponent(inlined_script_default, {
|
|
3550
|
+
get nonce() {
|
|
3551
|
+
return props.builderContext?.nonce || "";
|
|
3552
|
+
},
|
|
3553
|
+
get scriptStr() {
|
|
3554
|
+
return updateVisibilityStylesScript();
|
|
3555
|
+
},
|
|
3556
|
+
get id() {
|
|
3557
|
+
return `variants-visibility-script-${props.builderBlock?.id}`;
|
|
3558
|
+
}
|
|
3559
|
+
}), createComponent(For, {
|
|
3560
|
+
get each() {
|
|
3561
|
+
return props.variants;
|
|
3562
|
+
},
|
|
3563
|
+
children: (variant, _index) => {
|
|
3564
|
+
const index = _index();
|
|
3565
|
+
return createComponent(blocks_default, {
|
|
3566
|
+
get key() {
|
|
3567
|
+
return `${props.builderBlock?.id}-${index}`;
|
|
3568
|
+
},
|
|
3569
|
+
get BlocksWrapperProps() {
|
|
3570
|
+
return {
|
|
3571
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3572
|
+
"aria-hidden": true,
|
|
3573
|
+
hidden: true,
|
|
3574
|
+
"data-variant-id": `${props.builderBlock?.id}-${index}`
|
|
3575
|
+
};
|
|
3576
|
+
},
|
|
3577
|
+
get blocks() {
|
|
3578
|
+
return variant.blocks;
|
|
3579
|
+
},
|
|
3580
|
+
get parent() {
|
|
3581
|
+
return props.builderBlock?.id;
|
|
3582
|
+
},
|
|
3583
|
+
path: `component.options.variants.${index}.blocks`,
|
|
3584
|
+
get context() {
|
|
3585
|
+
return props.builderContext;
|
|
3586
|
+
},
|
|
3587
|
+
get registeredComponents() {
|
|
3588
|
+
return props.builderComponents;
|
|
3589
|
+
},
|
|
3590
|
+
get children() {
|
|
3591
|
+
return createComponent(inlined_script_default, {
|
|
3592
|
+
get nonce() {
|
|
3593
|
+
return props.builderContext?.nonce || "";
|
|
3594
|
+
},
|
|
3595
|
+
get scriptStr() {
|
|
3596
|
+
return scriptStr();
|
|
3597
|
+
},
|
|
3598
|
+
get id() {
|
|
3599
|
+
return `variants-script-${props.builderBlock?.id}-${index}`;
|
|
3600
|
+
}
|
|
3601
|
+
});
|
|
3602
|
+
}
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
})];
|
|
3606
|
+
}
|
|
3607
|
+
}), createComponent(blocks_default, {
|
|
3608
|
+
get blocks() {
|
|
3609
|
+
return blocksToRender().blocks;
|
|
3610
|
+
},
|
|
3611
|
+
get parent() {
|
|
3612
|
+
return props.builderBlock?.id;
|
|
3613
|
+
},
|
|
3614
|
+
get path() {
|
|
3615
|
+
return blocksToRender().path;
|
|
3616
|
+
},
|
|
3617
|
+
get context() {
|
|
3618
|
+
return props.builderContext;
|
|
3619
|
+
},
|
|
3620
|
+
get registeredComponents() {
|
|
3621
|
+
return props.builderComponents;
|
|
3622
|
+
},
|
|
3623
|
+
get BlocksWrapperProps() {
|
|
3624
|
+
return {
|
|
3625
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3626
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3627
|
+
};
|
|
3628
|
+
},
|
|
3629
|
+
get children() {
|
|
3630
|
+
return createComponent(Show, {
|
|
3631
|
+
get when() {
|
|
3632
|
+
return shouldRenderVariants();
|
|
3633
|
+
},
|
|
3634
|
+
get children() {
|
|
3635
|
+
return createComponent(inlined_script_default, {
|
|
3636
|
+
get nonce() {
|
|
3637
|
+
return props.builderContext?.nonce || "";
|
|
3638
|
+
},
|
|
3639
|
+
get scriptStr() {
|
|
3640
|
+
return scriptStr();
|
|
3641
|
+
},
|
|
3642
|
+
get id() {
|
|
3643
|
+
return `variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`;
|
|
3644
|
+
}
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3648
|
+
}
|
|
3649
|
+
})];
|
|
3587
3650
|
}
|
|
3588
3651
|
}), null);
|
|
3589
3652
|
return _el$;
|
|
@@ -3870,7 +3933,7 @@ var componentInfo10 = {
|
|
|
3870
3933
|
}
|
|
3871
3934
|
};
|
|
3872
3935
|
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
3873
|
-
var _tmpl$
|
|
3936
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
3874
3937
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
3875
3938
|
function Tabs(props) {
|
|
3876
3939
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -3885,7 +3948,7 @@ function Tabs(props) {
|
|
|
3885
3948
|
}
|
|
3886
3949
|
}
|
|
3887
3950
|
return (() => {
|
|
3888
|
-
const _el$ = _tmpl$
|
|
3951
|
+
const _el$ = _tmpl$25(), _el$2 = _el$.firstChild;
|
|
3889
3952
|
_el$2.style.setProperty("display", "flex");
|
|
3890
3953
|
_el$2.style.setProperty("flex-direction", "row");
|
|
3891
3954
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -4417,7 +4480,7 @@ function logFetch(url) {
|
|
|
4417
4480
|
|
|
4418
4481
|
// src/blocks/form/form/form.tsx
|
|
4419
4482
|
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
4420
|
-
var _tmpl$
|
|
4483
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
4421
4484
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
4422
4485
|
padding: 10px;
|
|
4423
4486
|
color: red;
|
|
@@ -4610,7 +4673,7 @@ function FormComponent(props) {
|
|
|
4610
4673
|
}
|
|
4611
4674
|
let formRef;
|
|
4612
4675
|
return [(() => {
|
|
4613
|
-
const _el$ = _tmpl$
|
|
4676
|
+
const _el$ = _tmpl$26();
|
|
4614
4677
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
4615
4678
|
const _ref$ = formRef;
|
|
4616
4679
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -4822,7 +4885,7 @@ var componentInfo16 = {
|
|
|
4822
4885
|
noWrap: true
|
|
4823
4886
|
};
|
|
4824
4887
|
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
4825
|
-
var _tmpl$
|
|
4888
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<option>`);
|
|
4826
4889
|
function SelectComponent(props) {
|
|
4827
4890
|
return (() => {
|
|
4828
4891
|
const _el$ = _tmpl$17();
|
|
@@ -4850,7 +4913,7 @@ function SelectComponent(props) {
|
|
|
4850
4913
|
children: (option, _index) => {
|
|
4851
4914
|
const index = _index();
|
|
4852
4915
|
return (() => {
|
|
4853
|
-
const _el$2 = _tmpl$
|
|
4916
|
+
const _el$2 = _tmpl$27();
|
|
4854
4917
|
insert(_el$2, () => option.name || option.value);
|
|
4855
4918
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
4856
4919
|
effect(() => _el$2.value = option.value);
|
|
@@ -5094,7 +5157,7 @@ var componentInfo20 = {
|
|
|
5094
5157
|
}
|
|
5095
5158
|
};
|
|
5096
5159
|
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5097
|
-
var _tmpl$
|
|
5160
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5098
5161
|
function Video(props) {
|
|
5099
5162
|
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5100
5163
|
const videoProps = createMemo(() => {
|
|
@@ -5149,7 +5212,7 @@ function Video(props) {
|
|
|
5149
5212
|
}
|
|
5150
5213
|
});
|
|
5151
5214
|
return (() => {
|
|
5152
|
-
const _el$ = _tmpl$
|
|
5215
|
+
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5153
5216
|
_el$.style.setProperty("position", "relative");
|
|
5154
5217
|
const _ref$ = videoRef;
|
|
5155
5218
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
@@ -5286,7 +5349,7 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
5286
5349
|
}, {
|
|
5287
5350
|
component: text_default,
|
|
5288
5351
|
...componentInfo11
|
|
5289
|
-
}, ...TARGET
|
|
5352
|
+
}, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
|
|
5290
5353
|
component: personalization_container_default,
|
|
5291
5354
|
...componentInfo6
|
|
5292
5355
|
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
@@ -5323,7 +5386,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
|
|
|
5323
5386
|
|
|
5324
5387
|
// src/components/content-variants/helpers.ts
|
|
5325
5388
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
5326
|
-
var
|
|
5389
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
|
|
5327
5390
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
5328
5391
|
...variant,
|
|
5329
5392
|
testVariationId: variant.id,
|
|
@@ -5348,20 +5411,20 @@ var checkShouldRenderVariants2 = ({
|
|
|
5348
5411
|
};
|
|
5349
5412
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
5350
5413
|
var isAngularSDK = TARGET === "angular";
|
|
5351
|
-
var
|
|
5414
|
+
var isHydrationTarget2 = getIsHydrationTarget(TARGET);
|
|
5352
5415
|
var getInitVariantsFnsScriptString = () => `
|
|
5353
5416
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
5354
|
-
window.${
|
|
5417
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
5355
5418
|
`;
|
|
5356
5419
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
5357
5420
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
5358
|
-
"${contentId}",${JSON.stringify(variants)}, ${
|
|
5421
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
|
|
5359
5422
|
)`;
|
|
5360
5423
|
var getUpdateVariantVisibilityScript = ({
|
|
5361
5424
|
contentId,
|
|
5362
5425
|
variationId
|
|
5363
|
-
}) => `window.${
|
|
5364
|
-
"${variationId}", "${contentId}", ${
|
|
5426
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
|
|
5427
|
+
"${variationId}", "${contentId}", ${isHydrationTarget2}
|
|
5365
5428
|
)`;
|
|
5366
5429
|
|
|
5367
5430
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -5370,7 +5433,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5370
5433
|
}
|
|
5371
5434
|
|
|
5372
5435
|
// src/constants/sdk-version.ts
|
|
5373
|
-
var SDK_VERSION = "4.0.
|
|
5436
|
+
var SDK_VERSION = "4.0.9";
|
|
5374
5437
|
|
|
5375
5438
|
// src/helpers/sdk-headers.ts
|
|
5376
5439
|
var getSdkHeaders = () => ({
|
|
@@ -6786,7 +6849,7 @@ function ContentVariants(props) {
|
|
|
6786
6849
|
return !props.isNestedRender && TARGET !== "reactNative";
|
|
6787
6850
|
},
|
|
6788
6851
|
get children() {
|
|
6789
|
-
return createComponent(inlined_script_default, {
|
|
6852
|
+
return [createComponent(inlined_script_default, {
|
|
6790
6853
|
id: "builderio-init-variants-fns",
|
|
6791
6854
|
get scriptStr() {
|
|
6792
6855
|
return getInitVariantsFnsScriptString();
|
|
@@ -6794,7 +6857,22 @@ function ContentVariants(props) {
|
|
|
6794
6857
|
get nonce() {
|
|
6795
6858
|
return props.nonce || "";
|
|
6796
6859
|
}
|
|
6797
|
-
})
|
|
6860
|
+
}), createComponent(Show, {
|
|
6861
|
+
get when() {
|
|
6862
|
+
return SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET);
|
|
6863
|
+
},
|
|
6864
|
+
get children() {
|
|
6865
|
+
return createComponent(inlined_script_default, {
|
|
6866
|
+
id: "builderio-init-personalization-variants-fns",
|
|
6867
|
+
get nonce() {
|
|
6868
|
+
return props.nonce || "";
|
|
6869
|
+
},
|
|
6870
|
+
get scriptStr() {
|
|
6871
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
6872
|
+
}
|
|
6873
|
+
});
|
|
6874
|
+
}
|
|
6875
|
+
})];
|
|
6798
6876
|
}
|
|
6799
6877
|
}), createComponent(Show, {
|
|
6800
6878
|
get when() {
|
|
@@ -6982,7 +7060,7 @@ var fetchSymbolContent = async ({
|
|
|
6982
7060
|
};
|
|
6983
7061
|
|
|
6984
7062
|
// src/blocks/symbol/symbol.tsx
|
|
6985
|
-
var _tmpl$
|
|
7063
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
6986
7064
|
function Symbol(props) {
|
|
6987
7065
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
6988
7066
|
const [symbolEntry, setSymbolEntry] = createSignal(props.symbol?.entry);
|
|
@@ -7016,7 +7094,7 @@ function Symbol(props) {
|
|
|
7016
7094
|
}
|
|
7017
7095
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
7018
7096
|
return (() => {
|
|
7019
|
-
const _el$ = _tmpl$
|
|
7097
|
+
const _el$ = _tmpl$29();
|
|
7020
7098
|
spread(_el$, mergeProps({
|
|
7021
7099
|
get ["class"]() {
|
|
7022
7100
|
return className();
|