@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/node/dev.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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -1837,7 +1837,7 @@ function Block(props) {
|
|
|
1837
1837
|
});
|
|
1838
1838
|
}
|
|
1839
1839
|
var block_default = Block;
|
|
1840
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1840
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
|
|
1841
1841
|
display: flex;
|
|
1842
1842
|
flex-direction: column;
|
|
1843
1843
|
align-items: stretch;
|
|
@@ -1886,7 +1886,7 @@ function BlocksWrapper(props) {
|
|
|
1886
1886
|
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
1887
1887
|
return [createComponent(Dynamic, mergeProps({
|
|
1888
1888
|
get ["class"]() {
|
|
1889
|
-
return className() + " dynamic-
|
|
1889
|
+
return className() + " dynamic-450facf4";
|
|
1890
1890
|
},
|
|
1891
1891
|
ref(r$) {
|
|
1892
1892
|
const _ref$ = blocksWrapperRef;
|
|
@@ -1933,17 +1933,17 @@ function Blocks(props) {
|
|
|
1933
1933
|
get styleProp() {
|
|
1934
1934
|
return props.styleProp;
|
|
1935
1935
|
},
|
|
1936
|
+
get BlocksWrapperProps() {
|
|
1937
|
+
return props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1938
|
+
},
|
|
1936
1939
|
get classNameProp() {
|
|
1937
1940
|
return props.className;
|
|
1938
1941
|
},
|
|
1939
1942
|
get BlocksWrapper() {
|
|
1940
1943
|
return props.context?.BlocksWrapper || builderContext?.BlocksWrapper;
|
|
1941
1944
|
},
|
|
1942
|
-
get BlocksWrapperProps() {
|
|
1943
|
-
return props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1944
|
-
},
|
|
1945
1945
|
get children() {
|
|
1946
|
-
return createComponent(Show, {
|
|
1946
|
+
return [memo(() => props.children), createComponent(Show, {
|
|
1947
1947
|
get when() {
|
|
1948
1948
|
return props.blocks;
|
|
1949
1949
|
},
|
|
@@ -1972,7 +1972,7 @@ function Blocks(props) {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
});
|
|
1974
1974
|
}
|
|
1975
|
-
});
|
|
1975
|
+
})];
|
|
1976
1976
|
}
|
|
1977
1977
|
});
|
|
1978
1978
|
}
|
|
@@ -2397,6 +2397,166 @@ function SectionComponent(props) {
|
|
|
2397
2397
|
}
|
|
2398
2398
|
var section_default = SectionComponent;
|
|
2399
2399
|
|
|
2400
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
2401
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
2402
|
+
function isString(val) {
|
|
2403
|
+
return typeof val === "string";
|
|
2404
|
+
}
|
|
2405
|
+
function isNumber(val) {
|
|
2406
|
+
return typeof val === "number";
|
|
2407
|
+
}
|
|
2408
|
+
function objectMatchesQuery(userattr, query2) {
|
|
2409
|
+
const result = (() => {
|
|
2410
|
+
const property = query2.property;
|
|
2411
|
+
const operator = query2.operator;
|
|
2412
|
+
let testValue = query2.value;
|
|
2413
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
2414
|
+
testValue = query2.value.slice(0, -1);
|
|
2415
|
+
}
|
|
2416
|
+
if (!(property && operator)) {
|
|
2417
|
+
return true;
|
|
2418
|
+
}
|
|
2419
|
+
if (Array.isArray(testValue)) {
|
|
2420
|
+
if (operator === "isNot") {
|
|
2421
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
2422
|
+
property,
|
|
2423
|
+
operator,
|
|
2424
|
+
value: val
|
|
2425
|
+
}));
|
|
2426
|
+
}
|
|
2427
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
2428
|
+
property,
|
|
2429
|
+
operator,
|
|
2430
|
+
value: val
|
|
2431
|
+
}));
|
|
2432
|
+
}
|
|
2433
|
+
const value = userattr[property];
|
|
2434
|
+
if (Array.isArray(value)) {
|
|
2435
|
+
return value.includes(testValue);
|
|
2436
|
+
}
|
|
2437
|
+
switch (operator) {
|
|
2438
|
+
case "is":
|
|
2439
|
+
return value === testValue;
|
|
2440
|
+
case "isNot":
|
|
2441
|
+
return value !== testValue;
|
|
2442
|
+
case "contains":
|
|
2443
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
2444
|
+
case "startsWith":
|
|
2445
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
2446
|
+
case "endsWith":
|
|
2447
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
2448
|
+
case "greaterThan":
|
|
2449
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
2450
|
+
case "lessThan":
|
|
2451
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
2452
|
+
case "greaterThanOrEqualTo":
|
|
2453
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
2454
|
+
case "lessThanOrEqualTo":
|
|
2455
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
2456
|
+
default:
|
|
2457
|
+
return false;
|
|
2458
|
+
}
|
|
2459
|
+
})();
|
|
2460
|
+
return result;
|
|
2461
|
+
}
|
|
2462
|
+
const item = {
|
|
2463
|
+
query,
|
|
2464
|
+
startDate,
|
|
2465
|
+
endDate
|
|
2466
|
+
};
|
|
2467
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
2468
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
2469
|
+
return false;
|
|
2470
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
2471
|
+
return false;
|
|
2472
|
+
}
|
|
2473
|
+
if (!item.query || !item.query.length) {
|
|
2474
|
+
return true;
|
|
2475
|
+
}
|
|
2476
|
+
return item.query.every((filter) => {
|
|
2477
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
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}";
|
|
2481
|
+
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}";
|
|
2482
|
+
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}";
|
|
2483
|
+
|
|
2484
|
+
// src/blocks/personalization-container/helpers.ts
|
|
2485
|
+
var DEFAULT_INDEX = "default";
|
|
2486
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
|
|
2487
|
+
var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
|
|
2488
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
|
|
2489
|
+
var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
|
|
2490
|
+
var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
|
|
2491
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
2492
|
+
const hasVariants = variants && variants.length > 0;
|
|
2493
|
+
if (TARGET === "reactNative")
|
|
2494
|
+
return false;
|
|
2495
|
+
if (!hasVariants)
|
|
2496
|
+
return false;
|
|
2497
|
+
if (!canTrack)
|
|
2498
|
+
return false;
|
|
2499
|
+
if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
|
|
2500
|
+
return true;
|
|
2501
|
+
if (isBrowser())
|
|
2502
|
+
return false;
|
|
2503
|
+
return true;
|
|
2504
|
+
}
|
|
2505
|
+
function getBlocksToRender({
|
|
2506
|
+
variants,
|
|
2507
|
+
previewingIndex,
|
|
2508
|
+
isHydrated,
|
|
2509
|
+
filteredVariants,
|
|
2510
|
+
fallbackBlocks
|
|
2511
|
+
}) {
|
|
2512
|
+
const fallback = {
|
|
2513
|
+
blocks: fallbackBlocks ?? [],
|
|
2514
|
+
path: "this.children",
|
|
2515
|
+
index: DEFAULT_INDEX
|
|
2516
|
+
};
|
|
2517
|
+
if (isHydrated && isEditing()) {
|
|
2518
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
2519
|
+
const variant = variants?.[previewingIndex];
|
|
2520
|
+
if (variant) {
|
|
2521
|
+
return {
|
|
2522
|
+
blocks: variant.blocks,
|
|
2523
|
+
path: `variants.${previewingIndex}.blocks`,
|
|
2524
|
+
index: previewingIndex
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
return fallback;
|
|
2529
|
+
}
|
|
2530
|
+
if (isBrowser()) {
|
|
2531
|
+
const winningVariant = filteredVariants?.[0];
|
|
2532
|
+
if (winningVariant && variants) {
|
|
2533
|
+
const variantIndex = variants.indexOf(winningVariant);
|
|
2534
|
+
if (variantIndex !== -1) {
|
|
2535
|
+
return {
|
|
2536
|
+
blocks: winningVariant.blocks,
|
|
2537
|
+
path: `variants.${variantIndex}.blocks`,
|
|
2538
|
+
index: variantIndex
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
return fallback;
|
|
2544
|
+
}
|
|
2545
|
+
var getInitPersonalizationVariantsFnsScriptString = () => {
|
|
2546
|
+
return `
|
|
2547
|
+
window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
2548
|
+
window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
|
|
2549
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
2550
|
+
`;
|
|
2551
|
+
};
|
|
2552
|
+
var isHydrationTarget = TARGET === "react";
|
|
2553
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
2554
|
+
return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2555
|
+
};
|
|
2556
|
+
var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
|
|
2557
|
+
return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2558
|
+
};
|
|
2559
|
+
|
|
2400
2560
|
// src/helpers/url.ts
|
|
2401
2561
|
var getTopLevelDomain = (host) => {
|
|
2402
2562
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
@@ -3376,7 +3536,8 @@ var componentInfo6 = {
|
|
|
3376
3536
|
name: "PersonalizationContainer",
|
|
3377
3537
|
shouldReceiveBuilderProps: {
|
|
3378
3538
|
builderBlock: true,
|
|
3379
|
-
builderContext: true
|
|
3539
|
+
builderContext: true,
|
|
3540
|
+
builderComponents: true
|
|
3380
3541
|
},
|
|
3381
3542
|
noWrap: true,
|
|
3382
3543
|
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
@@ -3438,208 +3599,22 @@ function isPreviewing(_search) {
|
|
|
3438
3599
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3439
3600
|
}
|
|
3440
3601
|
|
|
3441
|
-
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3442
|
-
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3443
|
-
function isString(val) {
|
|
3444
|
-
return typeof val === "string";
|
|
3445
|
-
}
|
|
3446
|
-
function isNumber(val) {
|
|
3447
|
-
return typeof val === "number";
|
|
3448
|
-
}
|
|
3449
|
-
function objectMatchesQuery(userattr, query2) {
|
|
3450
|
-
const result = (() => {
|
|
3451
|
-
const property = query2.property;
|
|
3452
|
-
const operator = query2.operator;
|
|
3453
|
-
let testValue = query2.value;
|
|
3454
|
-
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3455
|
-
testValue = query2.value.slice(0, -1);
|
|
3456
|
-
}
|
|
3457
|
-
if (!(property && operator)) {
|
|
3458
|
-
return true;
|
|
3459
|
-
}
|
|
3460
|
-
if (Array.isArray(testValue)) {
|
|
3461
|
-
if (operator === "isNot") {
|
|
3462
|
-
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3463
|
-
property,
|
|
3464
|
-
operator,
|
|
3465
|
-
value: val
|
|
3466
|
-
}));
|
|
3467
|
-
}
|
|
3468
|
-
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3469
|
-
property,
|
|
3470
|
-
operator,
|
|
3471
|
-
value: val
|
|
3472
|
-
}));
|
|
3473
|
-
}
|
|
3474
|
-
const value = userattr[property];
|
|
3475
|
-
if (Array.isArray(value)) {
|
|
3476
|
-
return value.includes(testValue);
|
|
3477
|
-
}
|
|
3478
|
-
switch (operator) {
|
|
3479
|
-
case "is":
|
|
3480
|
-
return value === testValue;
|
|
3481
|
-
case "isNot":
|
|
3482
|
-
return value !== testValue;
|
|
3483
|
-
case "contains":
|
|
3484
|
-
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3485
|
-
case "startsWith":
|
|
3486
|
-
return isString(value) && value.startsWith(String(testValue));
|
|
3487
|
-
case "endsWith":
|
|
3488
|
-
return isString(value) && value.endsWith(String(testValue));
|
|
3489
|
-
case "greaterThan":
|
|
3490
|
-
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3491
|
-
case "lessThan":
|
|
3492
|
-
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3493
|
-
case "greaterThanOrEqualTo":
|
|
3494
|
-
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3495
|
-
case "lessThanOrEqualTo":
|
|
3496
|
-
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3497
|
-
default:
|
|
3498
|
-
return false;
|
|
3499
|
-
}
|
|
3500
|
-
})();
|
|
3501
|
-
return result;
|
|
3502
|
-
}
|
|
3503
|
-
const item = {
|
|
3504
|
-
query,
|
|
3505
|
-
startDate,
|
|
3506
|
-
endDate
|
|
3507
|
-
};
|
|
3508
|
-
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3509
|
-
if (item.startDate && new Date(item.startDate) > now) {
|
|
3510
|
-
return false;
|
|
3511
|
-
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3512
|
-
return false;
|
|
3513
|
-
}
|
|
3514
|
-
if (!item.query || !item.query.length) {
|
|
3515
|
-
return true;
|
|
3516
|
-
}
|
|
3517
|
-
return item.query.every((filter) => {
|
|
3518
|
-
return objectMatchesQuery(userAttributes, filter);
|
|
3519
|
-
});
|
|
3520
|
-
}
|
|
3521
|
-
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3522
|
-
if (!navigator.cookieEnabled) {
|
|
3523
|
-
return;
|
|
3524
|
-
}
|
|
3525
|
-
function getCookie(name) {
|
|
3526
|
-
const nameEQ = name + '=';
|
|
3527
|
-
const ca = document.cookie.split(';');
|
|
3528
|
-
for (let i = 0; i < ca.length; i++) {
|
|
3529
|
-
let c = ca[i];
|
|
3530
|
-
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3531
|
-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3532
|
-
}
|
|
3533
|
-
return null;
|
|
3534
|
-
}
|
|
3535
|
-
function removeVariants() {
|
|
3536
|
-
variants?.forEach(function (_, index) {
|
|
3537
|
-
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3538
|
-
});
|
|
3539
|
-
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3540
|
-
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3541
|
-
}
|
|
3542
|
-
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3543
|
-
if (locale) {
|
|
3544
|
-
attributes.locale = locale;
|
|
3545
|
-
}
|
|
3546
|
-
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3547
|
-
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3548
|
-
});
|
|
3549
|
-
const isDebug = location.href.includes('builder.debug=true');
|
|
3550
|
-
if (isDebug) {
|
|
3551
|
-
console.debug('PersonalizationContainer', {
|
|
3552
|
-
attributes,
|
|
3553
|
-
variants,
|
|
3554
|
-
winningVariantIndex
|
|
3555
|
-
});
|
|
3556
|
-
}
|
|
3557
|
-
if (winningVariantIndex !== -1) {
|
|
3558
|
-
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3559
|
-
if (winningVariant) {
|
|
3560
|
-
const parentNode = winningVariant.parentNode;
|
|
3561
|
-
if (parentNode) {
|
|
3562
|
-
const newParent = parentNode.cloneNode(false);
|
|
3563
|
-
newParent.appendChild(winningVariant.content.firstChild);
|
|
3564
|
-
newParent.appendChild(winningVariant.content.lastChild);
|
|
3565
|
-
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3566
|
-
}
|
|
3567
|
-
if (isDebug) {
|
|
3568
|
-
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3569
|
-
}
|
|
3570
|
-
}
|
|
3571
|
-
} else if (variants && variants.length > 0) {
|
|
3572
|
-
removeVariants();
|
|
3573
|
-
}
|
|
3574
|
-
}`;
|
|
3575
|
-
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}";
|
|
3576
|
-
|
|
3577
|
-
// src/blocks/personalization-container/helpers.ts
|
|
3578
|
-
function checkShouldRenderVariants(variants, canTrack) {
|
|
3579
|
-
const hasVariants = variants && variants.length > 0;
|
|
3580
|
-
if (TARGET === "reactNative")
|
|
3581
|
-
return false;
|
|
3582
|
-
if (!hasVariants)
|
|
3583
|
-
return false;
|
|
3584
|
-
if (!canTrack)
|
|
3585
|
-
return false;
|
|
3586
|
-
if (TARGET === "vue" || TARGET === "svelte")
|
|
3587
|
-
return true;
|
|
3588
|
-
if (isBrowser())
|
|
3589
|
-
return false;
|
|
3590
|
-
return true;
|
|
3591
|
-
}
|
|
3592
|
-
function getBlocksToRender({
|
|
3593
|
-
variants,
|
|
3594
|
-
previewingIndex,
|
|
3595
|
-
isHydrated,
|
|
3596
|
-
filteredVariants,
|
|
3597
|
-
fallbackBlocks
|
|
3598
|
-
}) {
|
|
3599
|
-
const fallback = {
|
|
3600
|
-
blocks: fallbackBlocks ?? [],
|
|
3601
|
-
path: "this.children"
|
|
3602
|
-
};
|
|
3603
|
-
if (isHydrated && isEditing()) {
|
|
3604
|
-
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3605
|
-
const variant = variants[previewingIndex];
|
|
3606
|
-
return {
|
|
3607
|
-
blocks: variant.blocks,
|
|
3608
|
-
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3609
|
-
};
|
|
3610
|
-
}
|
|
3611
|
-
return fallback;
|
|
3612
|
-
}
|
|
3613
|
-
if (isBrowser()) {
|
|
3614
|
-
const winningVariant = filteredVariants?.[0];
|
|
3615
|
-
if (winningVariant) {
|
|
3616
|
-
return {
|
|
3617
|
-
blocks: winningVariant.blocks,
|
|
3618
|
-
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3619
|
-
};
|
|
3620
|
-
}
|
|
3621
|
-
}
|
|
3622
|
-
return fallback;
|
|
3623
|
-
}
|
|
3624
|
-
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3625
|
-
return `
|
|
3626
|
-
(function() {
|
|
3627
|
-
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3628
|
-
${PERSONALIZATION_SCRIPT}
|
|
3629
|
-
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3630
|
-
})();
|
|
3631
|
-
`;
|
|
3632
|
-
};
|
|
3633
|
-
|
|
3634
3602
|
// src/blocks/personalization-container/personalization-container.tsx
|
|
3635
3603
|
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
3636
|
-
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
3637
3604
|
function PersonalizationContainer(props) {
|
|
3638
3605
|
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
3639
3606
|
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3607
|
+
const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal(getUpdateVisibilityStylesScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3640
3608
|
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
3641
3609
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
3642
|
-
const [
|
|
3610
|
+
const [shouldResetVariants, setShouldResetVariants] = createSignal(false);
|
|
3611
|
+
const attrs = createMemo(() => {
|
|
3612
|
+
return {
|
|
3613
|
+
...props.attributes,
|
|
3614
|
+
...{},
|
|
3615
|
+
[getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
|
|
3616
|
+
};
|
|
3617
|
+
});
|
|
3643
3618
|
const filteredVariants = createMemo(() => {
|
|
3644
3619
|
return (props.variants || []).filter((variant) => {
|
|
3645
3620
|
return filterWithCustomTargeting({
|
|
@@ -3654,26 +3629,26 @@ function PersonalizationContainer(props) {
|
|
|
3654
3629
|
return getBlocksToRender({
|
|
3655
3630
|
variants: props.variants,
|
|
3656
3631
|
fallbackBlocks: props.builderBlock?.children,
|
|
3657
|
-
isHydrated:
|
|
3632
|
+
isHydrated: shouldResetVariants(),
|
|
3658
3633
|
filteredVariants: filteredVariants(),
|
|
3659
3634
|
previewingIndex: props.previewingIndex
|
|
3660
3635
|
});
|
|
3661
3636
|
});
|
|
3662
3637
|
const hideVariantsStyleString = createMemo(() => {
|
|
3663
|
-
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
3638
|
+
return (props.variants || []).map((_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `).join("");
|
|
3664
3639
|
});
|
|
3665
3640
|
let rootRef;
|
|
3666
3641
|
onMount(() => {
|
|
3667
|
-
|
|
3668
|
-
const unsub = userAttributesService.subscribeOnUserAttributesChange((
|
|
3669
|
-
setUserAttributes(
|
|
3642
|
+
setShouldResetVariants(true);
|
|
3643
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs2) => {
|
|
3644
|
+
setUserAttributes(attrs2);
|
|
3670
3645
|
});
|
|
3671
3646
|
if (!(isEditing() || isPreviewing())) {
|
|
3672
3647
|
const variant = filteredVariants()[0];
|
|
3673
3648
|
if (rootRef) {
|
|
3674
3649
|
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
3675
3650
|
detail: {
|
|
3676
|
-
variant: variant ||
|
|
3651
|
+
variant: variant || DEFAULT_INDEX,
|
|
3677
3652
|
content: props.builderContext?.content
|
|
3678
3653
|
},
|
|
3679
3654
|
bubbles: true
|
|
@@ -3683,7 +3658,7 @@ function PersonalizationContainer(props) {
|
|
|
3683
3658
|
if (entry.isIntersecting && rootRef) {
|
|
3684
3659
|
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
3685
3660
|
detail: {
|
|
3686
|
-
variant: variant ||
|
|
3661
|
+
variant: variant || DEFAULT_INDEX,
|
|
3687
3662
|
content: props.builderContext?.content
|
|
3688
3663
|
},
|
|
3689
3664
|
bubbles: true
|
|
@@ -3700,70 +3675,158 @@ function PersonalizationContainer(props) {
|
|
|
3700
3675
|
const _el$ = _tmpl$9();
|
|
3701
3676
|
const _ref$ = rootRef;
|
|
3702
3677
|
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
3703
|
-
spread(_el$, mergeProps(
|
|
3704
|
-
get ["class"]() {
|
|
3705
|
-
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
3706
|
-
}
|
|
3707
|
-
}, () => props.attributes), false, true);
|
|
3678
|
+
spread(_el$, mergeProps(attrs), false, true);
|
|
3708
3679
|
insert(_el$, createComponent(Show, {
|
|
3709
3680
|
get when() {
|
|
3710
|
-
return
|
|
3681
|
+
return memo(() => !!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3711
3682
|
},
|
|
3712
3683
|
get children() {
|
|
3713
|
-
return
|
|
3714
|
-
get
|
|
3715
|
-
return
|
|
3684
|
+
return createComponent(blocks_default, {
|
|
3685
|
+
get blocks() {
|
|
3686
|
+
return blocksToRender().blocks;
|
|
3716
3687
|
},
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
return (() => {
|
|
3720
|
-
const _el$2 = _tmpl$25();
|
|
3721
|
-
setAttribute(_el$2, "key", index);
|
|
3722
|
-
insert(_el$2, createComponent(blocks_default, {
|
|
3723
|
-
get blocks() {
|
|
3724
|
-
return variant.blocks;
|
|
3725
|
-
},
|
|
3726
|
-
get parent() {
|
|
3727
|
-
return props.builderBlock?.id;
|
|
3728
|
-
},
|
|
3729
|
-
path: `component.options.variants.${index}.blocks`
|
|
3730
|
-
}));
|
|
3731
|
-
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
3732
|
-
return _el$2;
|
|
3733
|
-
})();
|
|
3734
|
-
}
|
|
3735
|
-
}), createComponent(inlined_styles_default, {
|
|
3736
|
-
get nonce() {
|
|
3737
|
-
return props.builderContext?.nonce || "";
|
|
3688
|
+
get parent() {
|
|
3689
|
+
return props.builderBlock?.id;
|
|
3738
3690
|
},
|
|
3739
|
-
get
|
|
3740
|
-
return
|
|
3691
|
+
get path() {
|
|
3692
|
+
return blocksToRender().path;
|
|
3741
3693
|
},
|
|
3742
|
-
get
|
|
3743
|
-
return
|
|
3744
|
-
}
|
|
3745
|
-
}), createComponent(inlined_script_default, {
|
|
3746
|
-
get nonce() {
|
|
3747
|
-
return props.builderContext?.nonce || "";
|
|
3694
|
+
get context() {
|
|
3695
|
+
return props.builderContext;
|
|
3748
3696
|
},
|
|
3749
|
-
get
|
|
3750
|
-
return
|
|
3697
|
+
get registeredComponents() {
|
|
3698
|
+
return props.builderComponents;
|
|
3751
3699
|
},
|
|
3752
|
-
get
|
|
3753
|
-
return
|
|
3700
|
+
get BlocksWrapperProps() {
|
|
3701
|
+
return {
|
|
3702
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3703
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3704
|
+
};
|
|
3754
3705
|
}
|
|
3755
|
-
})
|
|
3706
|
+
});
|
|
3756
3707
|
}
|
|
3757
3708
|
}), null);
|
|
3758
|
-
insert(_el$, createComponent(
|
|
3759
|
-
get
|
|
3760
|
-
return
|
|
3761
|
-
},
|
|
3762
|
-
get parent() {
|
|
3763
|
-
return props.builderBlock?.id;
|
|
3709
|
+
insert(_el$, createComponent(Show, {
|
|
3710
|
+
get when() {
|
|
3711
|
+
return memo(() => !!!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3764
3712
|
},
|
|
3765
|
-
get
|
|
3766
|
-
return
|
|
3713
|
+
get children() {
|
|
3714
|
+
return [createComponent(Show, {
|
|
3715
|
+
get when() {
|
|
3716
|
+
return shouldRenderVariants();
|
|
3717
|
+
},
|
|
3718
|
+
get children() {
|
|
3719
|
+
return [createComponent(inlined_styles_default, {
|
|
3720
|
+
get nonce() {
|
|
3721
|
+
return props.builderContext?.nonce || "";
|
|
3722
|
+
},
|
|
3723
|
+
get styles() {
|
|
3724
|
+
return hideVariantsStyleString();
|
|
3725
|
+
},
|
|
3726
|
+
get id() {
|
|
3727
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
3728
|
+
}
|
|
3729
|
+
}), createComponent(inlined_script_default, {
|
|
3730
|
+
get nonce() {
|
|
3731
|
+
return props.builderContext?.nonce || "";
|
|
3732
|
+
},
|
|
3733
|
+
get scriptStr() {
|
|
3734
|
+
return updateVisibilityStylesScript();
|
|
3735
|
+
},
|
|
3736
|
+
get id() {
|
|
3737
|
+
return `variants-visibility-script-${props.builderBlock?.id}`;
|
|
3738
|
+
}
|
|
3739
|
+
}), createComponent(For, {
|
|
3740
|
+
get each() {
|
|
3741
|
+
return props.variants;
|
|
3742
|
+
},
|
|
3743
|
+
children: (variant, _index) => {
|
|
3744
|
+
const index = _index();
|
|
3745
|
+
return createComponent(blocks_default, {
|
|
3746
|
+
get key() {
|
|
3747
|
+
return `${props.builderBlock?.id}-${index}`;
|
|
3748
|
+
},
|
|
3749
|
+
get BlocksWrapperProps() {
|
|
3750
|
+
return {
|
|
3751
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3752
|
+
"aria-hidden": true,
|
|
3753
|
+
hidden: true,
|
|
3754
|
+
"data-variant-id": `${props.builderBlock?.id}-${index}`
|
|
3755
|
+
};
|
|
3756
|
+
},
|
|
3757
|
+
get blocks() {
|
|
3758
|
+
return variant.blocks;
|
|
3759
|
+
},
|
|
3760
|
+
get parent() {
|
|
3761
|
+
return props.builderBlock?.id;
|
|
3762
|
+
},
|
|
3763
|
+
path: `component.options.variants.${index}.blocks`,
|
|
3764
|
+
get context() {
|
|
3765
|
+
return props.builderContext;
|
|
3766
|
+
},
|
|
3767
|
+
get registeredComponents() {
|
|
3768
|
+
return props.builderComponents;
|
|
3769
|
+
},
|
|
3770
|
+
get children() {
|
|
3771
|
+
return createComponent(inlined_script_default, {
|
|
3772
|
+
get nonce() {
|
|
3773
|
+
return props.builderContext?.nonce || "";
|
|
3774
|
+
},
|
|
3775
|
+
get scriptStr() {
|
|
3776
|
+
return scriptStr();
|
|
3777
|
+
},
|
|
3778
|
+
get id() {
|
|
3779
|
+
return `variants-script-${props.builderBlock?.id}-${index}`;
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
}
|
|
3783
|
+
});
|
|
3784
|
+
}
|
|
3785
|
+
})];
|
|
3786
|
+
}
|
|
3787
|
+
}), createComponent(blocks_default, {
|
|
3788
|
+
get blocks() {
|
|
3789
|
+
return blocksToRender().blocks;
|
|
3790
|
+
},
|
|
3791
|
+
get parent() {
|
|
3792
|
+
return props.builderBlock?.id;
|
|
3793
|
+
},
|
|
3794
|
+
get path() {
|
|
3795
|
+
return blocksToRender().path;
|
|
3796
|
+
},
|
|
3797
|
+
get context() {
|
|
3798
|
+
return props.builderContext;
|
|
3799
|
+
},
|
|
3800
|
+
get registeredComponents() {
|
|
3801
|
+
return props.builderComponents;
|
|
3802
|
+
},
|
|
3803
|
+
get BlocksWrapperProps() {
|
|
3804
|
+
return {
|
|
3805
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3806
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3807
|
+
};
|
|
3808
|
+
},
|
|
3809
|
+
get children() {
|
|
3810
|
+
return createComponent(Show, {
|
|
3811
|
+
get when() {
|
|
3812
|
+
return shouldRenderVariants();
|
|
3813
|
+
},
|
|
3814
|
+
get children() {
|
|
3815
|
+
return createComponent(inlined_script_default, {
|
|
3816
|
+
get nonce() {
|
|
3817
|
+
return props.builderContext?.nonce || "";
|
|
3818
|
+
},
|
|
3819
|
+
get scriptStr() {
|
|
3820
|
+
return scriptStr();
|
|
3821
|
+
},
|
|
3822
|
+
get id() {
|
|
3823
|
+
return `variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`;
|
|
3824
|
+
}
|
|
3825
|
+
});
|
|
3826
|
+
}
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3829
|
+
})];
|
|
3767
3830
|
}
|
|
3768
3831
|
}), null);
|
|
3769
3832
|
return _el$;
|
|
@@ -4050,7 +4113,7 @@ var componentInfo10 = {
|
|
|
4050
4113
|
}
|
|
4051
4114
|
};
|
|
4052
4115
|
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
4053
|
-
var _tmpl$
|
|
4116
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
4054
4117
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
4055
4118
|
function Tabs(props) {
|
|
4056
4119
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -4065,7 +4128,7 @@ function Tabs(props) {
|
|
|
4065
4128
|
}
|
|
4066
4129
|
}
|
|
4067
4130
|
return (() => {
|
|
4068
|
-
const _el$ = _tmpl$
|
|
4131
|
+
const _el$ = _tmpl$25(), _el$2 = _el$.firstChild;
|
|
4069
4132
|
_el$2.style.setProperty("display", "flex");
|
|
4070
4133
|
_el$2.style.setProperty("flex-direction", "row");
|
|
4071
4134
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -4597,7 +4660,7 @@ function logFetch(url) {
|
|
|
4597
4660
|
|
|
4598
4661
|
// src/blocks/form/form/form.tsx
|
|
4599
4662
|
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
4600
|
-
var _tmpl$
|
|
4663
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
4601
4664
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
4602
4665
|
padding: 10px;
|
|
4603
4666
|
color: red;
|
|
@@ -4790,7 +4853,7 @@ function FormComponent(props) {
|
|
|
4790
4853
|
}
|
|
4791
4854
|
let formRef;
|
|
4792
4855
|
return [(() => {
|
|
4793
|
-
const _el$ = _tmpl$
|
|
4856
|
+
const _el$ = _tmpl$26();
|
|
4794
4857
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
4795
4858
|
const _ref$ = formRef;
|
|
4796
4859
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -5002,7 +5065,7 @@ var componentInfo16 = {
|
|
|
5002
5065
|
noWrap: true
|
|
5003
5066
|
};
|
|
5004
5067
|
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
5005
|
-
var _tmpl$
|
|
5068
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<option>`);
|
|
5006
5069
|
function SelectComponent(props) {
|
|
5007
5070
|
return (() => {
|
|
5008
5071
|
const _el$ = _tmpl$17();
|
|
@@ -5030,7 +5093,7 @@ function SelectComponent(props) {
|
|
|
5030
5093
|
children: (option, _index) => {
|
|
5031
5094
|
const index = _index();
|
|
5032
5095
|
return (() => {
|
|
5033
|
-
const _el$2 = _tmpl$
|
|
5096
|
+
const _el$2 = _tmpl$27();
|
|
5034
5097
|
insert(_el$2, () => option.name || option.value);
|
|
5035
5098
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
5036
5099
|
effect(() => _el$2.value = option.value);
|
|
@@ -5274,7 +5337,7 @@ var componentInfo20 = {
|
|
|
5274
5337
|
}
|
|
5275
5338
|
};
|
|
5276
5339
|
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5277
|
-
var _tmpl$
|
|
5340
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5278
5341
|
function Video(props) {
|
|
5279
5342
|
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5280
5343
|
const videoProps = createMemo(() => {
|
|
@@ -5330,7 +5393,7 @@ function Video(props) {
|
|
|
5330
5393
|
}
|
|
5331
5394
|
});
|
|
5332
5395
|
return (() => {
|
|
5333
|
-
const _el$ = _tmpl$
|
|
5396
|
+
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5334
5397
|
_el$.style.setProperty("position", "relative");
|
|
5335
5398
|
const _ref$ = videoRef;
|
|
5336
5399
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
@@ -5467,7 +5530,7 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
5467
5530
|
}, {
|
|
5468
5531
|
component: text_default,
|
|
5469
5532
|
...componentInfo11
|
|
5470
|
-
}, ...TARGET
|
|
5533
|
+
}, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
|
|
5471
5534
|
component: personalization_container_default,
|
|
5472
5535
|
...componentInfo6
|
|
5473
5536
|
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
@@ -5504,7 +5567,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
|
|
|
5504
5567
|
|
|
5505
5568
|
// src/components/content-variants/helpers.ts
|
|
5506
5569
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
5507
|
-
var
|
|
5570
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
|
|
5508
5571
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
5509
5572
|
...variant,
|
|
5510
5573
|
testVariationId: variant.id,
|
|
@@ -5529,20 +5592,20 @@ var checkShouldRenderVariants2 = ({
|
|
|
5529
5592
|
};
|
|
5530
5593
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
5531
5594
|
var isAngularSDK = TARGET === "angular";
|
|
5532
|
-
var
|
|
5595
|
+
var isHydrationTarget2 = getIsHydrationTarget(TARGET);
|
|
5533
5596
|
var getInitVariantsFnsScriptString = () => `
|
|
5534
5597
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
5535
|
-
window.${
|
|
5598
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
5536
5599
|
`;
|
|
5537
5600
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
5538
5601
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
5539
|
-
"${contentId}",${JSON.stringify(variants)}, ${
|
|
5602
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
|
|
5540
5603
|
)`;
|
|
5541
5604
|
var getUpdateVariantVisibilityScript = ({
|
|
5542
5605
|
contentId,
|
|
5543
5606
|
variationId
|
|
5544
|
-
}) => `window.${
|
|
5545
|
-
"${variationId}", "${contentId}", ${
|
|
5607
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
|
|
5608
|
+
"${variationId}", "${contentId}", ${isHydrationTarget2}
|
|
5546
5609
|
)`;
|
|
5547
5610
|
|
|
5548
5611
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -5551,7 +5614,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5551
5614
|
}
|
|
5552
5615
|
|
|
5553
5616
|
// src/constants/sdk-version.ts
|
|
5554
|
-
var SDK_VERSION = "4.0.
|
|
5617
|
+
var SDK_VERSION = "4.0.9";
|
|
5555
5618
|
|
|
5556
5619
|
// src/helpers/sdk-headers.ts
|
|
5557
5620
|
var getSdkHeaders = () => ({
|
|
@@ -6974,7 +7037,7 @@ function ContentVariants(props) {
|
|
|
6974
7037
|
return !props.isNestedRender && TARGET !== "reactNative";
|
|
6975
7038
|
},
|
|
6976
7039
|
get children() {
|
|
6977
|
-
return createComponent(inlined_script_default, {
|
|
7040
|
+
return [createComponent(inlined_script_default, {
|
|
6978
7041
|
id: "builderio-init-variants-fns",
|
|
6979
7042
|
get scriptStr() {
|
|
6980
7043
|
return getInitVariantsFnsScriptString();
|
|
@@ -6982,7 +7045,22 @@ function ContentVariants(props) {
|
|
|
6982
7045
|
get nonce() {
|
|
6983
7046
|
return props.nonce || "";
|
|
6984
7047
|
}
|
|
6985
|
-
})
|
|
7048
|
+
}), createComponent(Show, {
|
|
7049
|
+
get when() {
|
|
7050
|
+
return SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET);
|
|
7051
|
+
},
|
|
7052
|
+
get children() {
|
|
7053
|
+
return createComponent(inlined_script_default, {
|
|
7054
|
+
id: "builderio-init-personalization-variants-fns",
|
|
7055
|
+
get nonce() {
|
|
7056
|
+
return props.nonce || "";
|
|
7057
|
+
},
|
|
7058
|
+
get scriptStr() {
|
|
7059
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
7060
|
+
}
|
|
7061
|
+
});
|
|
7062
|
+
}
|
|
7063
|
+
})];
|
|
6986
7064
|
}
|
|
6987
7065
|
}), createComponent(Show, {
|
|
6988
7066
|
get when() {
|
|
@@ -7170,7 +7248,7 @@ var fetchSymbolContent = async ({
|
|
|
7170
7248
|
};
|
|
7171
7249
|
|
|
7172
7250
|
// src/blocks/symbol/symbol.tsx
|
|
7173
|
-
var _tmpl$
|
|
7251
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
7174
7252
|
function Symbol(props) {
|
|
7175
7253
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
7176
7254
|
const [symbolEntry, setSymbolEntry] = createSignal(props.symbol?.entry);
|
|
@@ -7204,7 +7282,7 @@ function Symbol(props) {
|
|
|
7204
7282
|
}
|
|
7205
7283
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
7206
7284
|
return (() => {
|
|
7207
|
-
const _el$ = _tmpl$
|
|
7285
|
+
const _el$ = _tmpl$29();
|
|
7208
7286
|
spread(_el$, mergeProps({
|
|
7209
7287
|
get ["class"]() {
|
|
7210
7288
|
return className();
|