@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/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -1828,7 +1828,7 @@ function Block(props) {
|
|
|
1828
1828
|
});
|
|
1829
1829
|
}
|
|
1830
1830
|
var block_default = Block;
|
|
1831
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1831
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
|
|
1832
1832
|
display: flex;
|
|
1833
1833
|
flex-direction: column;
|
|
1834
1834
|
align-items: stretch;
|
|
@@ -1877,7 +1877,7 @@ function BlocksWrapper(props) {
|
|
|
1877
1877
|
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
1878
1878
|
return [createComponent(Dynamic, mergeProps({
|
|
1879
1879
|
get ["class"]() {
|
|
1880
|
-
return className() + " dynamic-
|
|
1880
|
+
return className() + " dynamic-450facf4";
|
|
1881
1881
|
},
|
|
1882
1882
|
ref(r$) {
|
|
1883
1883
|
const _ref$ = blocksWrapperRef;
|
|
@@ -1924,17 +1924,17 @@ function Blocks(props) {
|
|
|
1924
1924
|
get styleProp() {
|
|
1925
1925
|
return props.styleProp;
|
|
1926
1926
|
},
|
|
1927
|
+
get BlocksWrapperProps() {
|
|
1928
|
+
return props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1929
|
+
},
|
|
1927
1930
|
get classNameProp() {
|
|
1928
1931
|
return props.className;
|
|
1929
1932
|
},
|
|
1930
1933
|
get BlocksWrapper() {
|
|
1931
1934
|
return props.context?.BlocksWrapper || builderContext?.BlocksWrapper;
|
|
1932
1935
|
},
|
|
1933
|
-
get BlocksWrapperProps() {
|
|
1934
|
-
return props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
1935
|
-
},
|
|
1936
1936
|
get children() {
|
|
1937
|
-
return createComponent(Show, {
|
|
1937
|
+
return [memo(() => props.children), createComponent(Show, {
|
|
1938
1938
|
get when() {
|
|
1939
1939
|
return props.blocks;
|
|
1940
1940
|
},
|
|
@@ -1963,7 +1963,7 @@ function Blocks(props) {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
});
|
|
1965
1965
|
}
|
|
1966
|
-
});
|
|
1966
|
+
})];
|
|
1967
1967
|
}
|
|
1968
1968
|
});
|
|
1969
1969
|
}
|
|
@@ -2387,6 +2387,166 @@ function SectionComponent(props) {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
var section_default = SectionComponent;
|
|
2389
2389
|
|
|
2390
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
2391
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
2392
|
+
function isString(val) {
|
|
2393
|
+
return typeof val === "string";
|
|
2394
|
+
}
|
|
2395
|
+
function isNumber(val) {
|
|
2396
|
+
return typeof val === "number";
|
|
2397
|
+
}
|
|
2398
|
+
function objectMatchesQuery(userattr, query2) {
|
|
2399
|
+
const result = (() => {
|
|
2400
|
+
const property = query2.property;
|
|
2401
|
+
const operator = query2.operator;
|
|
2402
|
+
let testValue = query2.value;
|
|
2403
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
2404
|
+
testValue = query2.value.slice(0, -1);
|
|
2405
|
+
}
|
|
2406
|
+
if (!(property && operator)) {
|
|
2407
|
+
return true;
|
|
2408
|
+
}
|
|
2409
|
+
if (Array.isArray(testValue)) {
|
|
2410
|
+
if (operator === "isNot") {
|
|
2411
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
2412
|
+
property,
|
|
2413
|
+
operator,
|
|
2414
|
+
value: val
|
|
2415
|
+
}));
|
|
2416
|
+
}
|
|
2417
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
2418
|
+
property,
|
|
2419
|
+
operator,
|
|
2420
|
+
value: val
|
|
2421
|
+
}));
|
|
2422
|
+
}
|
|
2423
|
+
const value = userattr[property];
|
|
2424
|
+
if (Array.isArray(value)) {
|
|
2425
|
+
return value.includes(testValue);
|
|
2426
|
+
}
|
|
2427
|
+
switch (operator) {
|
|
2428
|
+
case "is":
|
|
2429
|
+
return value === testValue;
|
|
2430
|
+
case "isNot":
|
|
2431
|
+
return value !== testValue;
|
|
2432
|
+
case "contains":
|
|
2433
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
2434
|
+
case "startsWith":
|
|
2435
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
2436
|
+
case "endsWith":
|
|
2437
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
2438
|
+
case "greaterThan":
|
|
2439
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
2440
|
+
case "lessThan":
|
|
2441
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
2442
|
+
case "greaterThanOrEqualTo":
|
|
2443
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
2444
|
+
case "lessThanOrEqualTo":
|
|
2445
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
2446
|
+
default:
|
|
2447
|
+
return false;
|
|
2448
|
+
}
|
|
2449
|
+
})();
|
|
2450
|
+
return result;
|
|
2451
|
+
}
|
|
2452
|
+
const item = {
|
|
2453
|
+
query,
|
|
2454
|
+
startDate,
|
|
2455
|
+
endDate
|
|
2456
|
+
};
|
|
2457
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
2458
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
2459
|
+
return false;
|
|
2460
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
2461
|
+
return false;
|
|
2462
|
+
}
|
|
2463
|
+
if (!item.query || !item.query.length) {
|
|
2464
|
+
return true;
|
|
2465
|
+
}
|
|
2466
|
+
return item.query.every((filter) => {
|
|
2467
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
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}";
|
|
2471
|
+
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}";
|
|
2472
|
+
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}";
|
|
2473
|
+
|
|
2474
|
+
// src/blocks/personalization-container/helpers.ts
|
|
2475
|
+
var DEFAULT_INDEX = "default";
|
|
2476
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
|
|
2477
|
+
var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
|
|
2478
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
|
|
2479
|
+
var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
|
|
2480
|
+
var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
|
|
2481
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
2482
|
+
const hasVariants = variants && variants.length > 0;
|
|
2483
|
+
if (TARGET === "reactNative")
|
|
2484
|
+
return false;
|
|
2485
|
+
if (!hasVariants)
|
|
2486
|
+
return false;
|
|
2487
|
+
if (!canTrack)
|
|
2488
|
+
return false;
|
|
2489
|
+
if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
|
|
2490
|
+
return true;
|
|
2491
|
+
if (isBrowser())
|
|
2492
|
+
return false;
|
|
2493
|
+
return true;
|
|
2494
|
+
}
|
|
2495
|
+
function getBlocksToRender({
|
|
2496
|
+
variants,
|
|
2497
|
+
previewingIndex,
|
|
2498
|
+
isHydrated,
|
|
2499
|
+
filteredVariants,
|
|
2500
|
+
fallbackBlocks
|
|
2501
|
+
}) {
|
|
2502
|
+
const fallback = {
|
|
2503
|
+
blocks: fallbackBlocks ?? [],
|
|
2504
|
+
path: "this.children",
|
|
2505
|
+
index: DEFAULT_INDEX
|
|
2506
|
+
};
|
|
2507
|
+
if (isHydrated && isEditing()) {
|
|
2508
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
2509
|
+
const variant = variants?.[previewingIndex];
|
|
2510
|
+
if (variant) {
|
|
2511
|
+
return {
|
|
2512
|
+
blocks: variant.blocks,
|
|
2513
|
+
path: `variants.${previewingIndex}.blocks`,
|
|
2514
|
+
index: previewingIndex
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
return fallback;
|
|
2519
|
+
}
|
|
2520
|
+
if (isBrowser()) {
|
|
2521
|
+
const winningVariant = filteredVariants?.[0];
|
|
2522
|
+
if (winningVariant && variants) {
|
|
2523
|
+
const variantIndex = variants.indexOf(winningVariant);
|
|
2524
|
+
if (variantIndex !== -1) {
|
|
2525
|
+
return {
|
|
2526
|
+
blocks: winningVariant.blocks,
|
|
2527
|
+
path: `variants.${variantIndex}.blocks`,
|
|
2528
|
+
index: variantIndex
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return fallback;
|
|
2534
|
+
}
|
|
2535
|
+
var getInitPersonalizationVariantsFnsScriptString = () => {
|
|
2536
|
+
return `
|
|
2537
|
+
window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
2538
|
+
window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
|
|
2539
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
2540
|
+
`;
|
|
2541
|
+
};
|
|
2542
|
+
var isHydrationTarget = TARGET === "react";
|
|
2543
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
2544
|
+
return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2545
|
+
};
|
|
2546
|
+
var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
|
|
2547
|
+
return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2390
2550
|
// src/helpers/url.ts
|
|
2391
2551
|
var getTopLevelDomain = (host) => {
|
|
2392
2552
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
@@ -3365,7 +3525,8 @@ var componentInfo6 = {
|
|
|
3365
3525
|
name: "PersonalizationContainer",
|
|
3366
3526
|
shouldReceiveBuilderProps: {
|
|
3367
3527
|
builderBlock: true,
|
|
3368
|
-
builderContext: true
|
|
3528
|
+
builderContext: true,
|
|
3529
|
+
builderComponents: true
|
|
3369
3530
|
},
|
|
3370
3531
|
noWrap: true,
|
|
3371
3532
|
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
@@ -3427,208 +3588,22 @@ function isPreviewing(_search) {
|
|
|
3427
3588
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3428
3589
|
}
|
|
3429
3590
|
|
|
3430
|
-
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3431
|
-
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3432
|
-
function isString(val) {
|
|
3433
|
-
return typeof val === "string";
|
|
3434
|
-
}
|
|
3435
|
-
function isNumber(val) {
|
|
3436
|
-
return typeof val === "number";
|
|
3437
|
-
}
|
|
3438
|
-
function objectMatchesQuery(userattr, query2) {
|
|
3439
|
-
const result = (() => {
|
|
3440
|
-
const property = query2.property;
|
|
3441
|
-
const operator = query2.operator;
|
|
3442
|
-
let testValue = query2.value;
|
|
3443
|
-
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3444
|
-
testValue = query2.value.slice(0, -1);
|
|
3445
|
-
}
|
|
3446
|
-
if (!(property && operator)) {
|
|
3447
|
-
return true;
|
|
3448
|
-
}
|
|
3449
|
-
if (Array.isArray(testValue)) {
|
|
3450
|
-
if (operator === "isNot") {
|
|
3451
|
-
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3452
|
-
property,
|
|
3453
|
-
operator,
|
|
3454
|
-
value: val
|
|
3455
|
-
}));
|
|
3456
|
-
}
|
|
3457
|
-
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3458
|
-
property,
|
|
3459
|
-
operator,
|
|
3460
|
-
value: val
|
|
3461
|
-
}));
|
|
3462
|
-
}
|
|
3463
|
-
const value = userattr[property];
|
|
3464
|
-
if (Array.isArray(value)) {
|
|
3465
|
-
return value.includes(testValue);
|
|
3466
|
-
}
|
|
3467
|
-
switch (operator) {
|
|
3468
|
-
case "is":
|
|
3469
|
-
return value === testValue;
|
|
3470
|
-
case "isNot":
|
|
3471
|
-
return value !== testValue;
|
|
3472
|
-
case "contains":
|
|
3473
|
-
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3474
|
-
case "startsWith":
|
|
3475
|
-
return isString(value) && value.startsWith(String(testValue));
|
|
3476
|
-
case "endsWith":
|
|
3477
|
-
return isString(value) && value.endsWith(String(testValue));
|
|
3478
|
-
case "greaterThan":
|
|
3479
|
-
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3480
|
-
case "lessThan":
|
|
3481
|
-
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3482
|
-
case "greaterThanOrEqualTo":
|
|
3483
|
-
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3484
|
-
case "lessThanOrEqualTo":
|
|
3485
|
-
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3486
|
-
default:
|
|
3487
|
-
return false;
|
|
3488
|
-
}
|
|
3489
|
-
})();
|
|
3490
|
-
return result;
|
|
3491
|
-
}
|
|
3492
|
-
const item = {
|
|
3493
|
-
query,
|
|
3494
|
-
startDate,
|
|
3495
|
-
endDate
|
|
3496
|
-
};
|
|
3497
|
-
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3498
|
-
if (item.startDate && new Date(item.startDate) > now) {
|
|
3499
|
-
return false;
|
|
3500
|
-
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3501
|
-
return false;
|
|
3502
|
-
}
|
|
3503
|
-
if (!item.query || !item.query.length) {
|
|
3504
|
-
return true;
|
|
3505
|
-
}
|
|
3506
|
-
return item.query.every((filter) => {
|
|
3507
|
-
return objectMatchesQuery(userAttributes, filter);
|
|
3508
|
-
});
|
|
3509
|
-
}
|
|
3510
|
-
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3511
|
-
if (!navigator.cookieEnabled) {
|
|
3512
|
-
return;
|
|
3513
|
-
}
|
|
3514
|
-
function getCookie(name) {
|
|
3515
|
-
const nameEQ = name + '=';
|
|
3516
|
-
const ca = document.cookie.split(';');
|
|
3517
|
-
for (let i = 0; i < ca.length; i++) {
|
|
3518
|
-
let c = ca[i];
|
|
3519
|
-
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3520
|
-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3521
|
-
}
|
|
3522
|
-
return null;
|
|
3523
|
-
}
|
|
3524
|
-
function removeVariants() {
|
|
3525
|
-
variants?.forEach(function (_, index) {
|
|
3526
|
-
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3527
|
-
});
|
|
3528
|
-
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3529
|
-
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3530
|
-
}
|
|
3531
|
-
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3532
|
-
if (locale) {
|
|
3533
|
-
attributes.locale = locale;
|
|
3534
|
-
}
|
|
3535
|
-
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3536
|
-
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3537
|
-
});
|
|
3538
|
-
const isDebug = location.href.includes('builder.debug=true');
|
|
3539
|
-
if (isDebug) {
|
|
3540
|
-
console.debug('PersonalizationContainer', {
|
|
3541
|
-
attributes,
|
|
3542
|
-
variants,
|
|
3543
|
-
winningVariantIndex
|
|
3544
|
-
});
|
|
3545
|
-
}
|
|
3546
|
-
if (winningVariantIndex !== -1) {
|
|
3547
|
-
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3548
|
-
if (winningVariant) {
|
|
3549
|
-
const parentNode = winningVariant.parentNode;
|
|
3550
|
-
if (parentNode) {
|
|
3551
|
-
const newParent = parentNode.cloneNode(false);
|
|
3552
|
-
newParent.appendChild(winningVariant.content.firstChild);
|
|
3553
|
-
newParent.appendChild(winningVariant.content.lastChild);
|
|
3554
|
-
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3555
|
-
}
|
|
3556
|
-
if (isDebug) {
|
|
3557
|
-
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
|
-
} else if (variants && variants.length > 0) {
|
|
3561
|
-
removeVariants();
|
|
3562
|
-
}
|
|
3563
|
-
}`;
|
|
3564
|
-
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}";
|
|
3565
|
-
|
|
3566
|
-
// src/blocks/personalization-container/helpers.ts
|
|
3567
|
-
function checkShouldRenderVariants(variants, canTrack) {
|
|
3568
|
-
const hasVariants = variants && variants.length > 0;
|
|
3569
|
-
if (TARGET === "reactNative")
|
|
3570
|
-
return false;
|
|
3571
|
-
if (!hasVariants)
|
|
3572
|
-
return false;
|
|
3573
|
-
if (!canTrack)
|
|
3574
|
-
return false;
|
|
3575
|
-
if (TARGET === "vue" || TARGET === "svelte")
|
|
3576
|
-
return true;
|
|
3577
|
-
if (isBrowser())
|
|
3578
|
-
return false;
|
|
3579
|
-
return true;
|
|
3580
|
-
}
|
|
3581
|
-
function getBlocksToRender({
|
|
3582
|
-
variants,
|
|
3583
|
-
previewingIndex,
|
|
3584
|
-
isHydrated,
|
|
3585
|
-
filteredVariants,
|
|
3586
|
-
fallbackBlocks
|
|
3587
|
-
}) {
|
|
3588
|
-
const fallback = {
|
|
3589
|
-
blocks: fallbackBlocks ?? [],
|
|
3590
|
-
path: "this.children"
|
|
3591
|
-
};
|
|
3592
|
-
if (isHydrated && isEditing()) {
|
|
3593
|
-
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3594
|
-
const variant = variants[previewingIndex];
|
|
3595
|
-
return {
|
|
3596
|
-
blocks: variant.blocks,
|
|
3597
|
-
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3598
|
-
};
|
|
3599
|
-
}
|
|
3600
|
-
return fallback;
|
|
3601
|
-
}
|
|
3602
|
-
if (isBrowser()) {
|
|
3603
|
-
const winningVariant = filteredVariants?.[0];
|
|
3604
|
-
if (winningVariant) {
|
|
3605
|
-
return {
|
|
3606
|
-
blocks: winningVariant.blocks,
|
|
3607
|
-
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3608
|
-
};
|
|
3609
|
-
}
|
|
3610
|
-
}
|
|
3611
|
-
return fallback;
|
|
3612
|
-
}
|
|
3613
|
-
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3614
|
-
return `
|
|
3615
|
-
(function() {
|
|
3616
|
-
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3617
|
-
${PERSONALIZATION_SCRIPT}
|
|
3618
|
-
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3619
|
-
})();
|
|
3620
|
-
`;
|
|
3621
|
-
};
|
|
3622
|
-
|
|
3623
3591
|
// src/blocks/personalization-container/personalization-container.tsx
|
|
3624
3592
|
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
3625
|
-
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
3626
3593
|
function PersonalizationContainer(props) {
|
|
3627
3594
|
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
3628
3595
|
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3596
|
+
const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal(getUpdateVisibilityStylesScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3629
3597
|
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
3630
3598
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
3631
|
-
const [
|
|
3599
|
+
const [shouldResetVariants, setShouldResetVariants] = createSignal(false);
|
|
3600
|
+
const attrs = createMemo(() => {
|
|
3601
|
+
return {
|
|
3602
|
+
...props.attributes,
|
|
3603
|
+
...{},
|
|
3604
|
+
[getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
|
|
3605
|
+
};
|
|
3606
|
+
});
|
|
3632
3607
|
const filteredVariants = createMemo(() => {
|
|
3633
3608
|
return (props.variants || []).filter((variant) => {
|
|
3634
3609
|
return filterWithCustomTargeting({
|
|
@@ -3643,26 +3618,26 @@ function PersonalizationContainer(props) {
|
|
|
3643
3618
|
return getBlocksToRender({
|
|
3644
3619
|
variants: props.variants,
|
|
3645
3620
|
fallbackBlocks: props.builderBlock?.children,
|
|
3646
|
-
isHydrated:
|
|
3621
|
+
isHydrated: shouldResetVariants(),
|
|
3647
3622
|
filteredVariants: filteredVariants(),
|
|
3648
3623
|
previewingIndex: props.previewingIndex
|
|
3649
3624
|
});
|
|
3650
3625
|
});
|
|
3651
3626
|
const hideVariantsStyleString = createMemo(() => {
|
|
3652
|
-
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
3627
|
+
return (props.variants || []).map((_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `).join("");
|
|
3653
3628
|
});
|
|
3654
3629
|
let rootRef;
|
|
3655
3630
|
onMount(() => {
|
|
3656
|
-
|
|
3657
|
-
const unsub = userAttributesService.subscribeOnUserAttributesChange((
|
|
3658
|
-
setUserAttributes(
|
|
3631
|
+
setShouldResetVariants(true);
|
|
3632
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs2) => {
|
|
3633
|
+
setUserAttributes(attrs2);
|
|
3659
3634
|
});
|
|
3660
3635
|
if (!(isEditing() || isPreviewing())) {
|
|
3661
3636
|
const variant = filteredVariants()[0];
|
|
3662
3637
|
if (rootRef) {
|
|
3663
3638
|
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
3664
3639
|
detail: {
|
|
3665
|
-
variant: variant ||
|
|
3640
|
+
variant: variant || DEFAULT_INDEX,
|
|
3666
3641
|
content: props.builderContext?.content
|
|
3667
3642
|
},
|
|
3668
3643
|
bubbles: true
|
|
@@ -3672,7 +3647,7 @@ function PersonalizationContainer(props) {
|
|
|
3672
3647
|
if (entry.isIntersecting && rootRef) {
|
|
3673
3648
|
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
3674
3649
|
detail: {
|
|
3675
|
-
variant: variant ||
|
|
3650
|
+
variant: variant || DEFAULT_INDEX,
|
|
3676
3651
|
content: props.builderContext?.content
|
|
3677
3652
|
},
|
|
3678
3653
|
bubbles: true
|
|
@@ -3689,70 +3664,158 @@ function PersonalizationContainer(props) {
|
|
|
3689
3664
|
const _el$ = _tmpl$9();
|
|
3690
3665
|
const _ref$ = rootRef;
|
|
3691
3666
|
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
3692
|
-
spread(_el$, mergeProps(
|
|
3693
|
-
get ["class"]() {
|
|
3694
|
-
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
3695
|
-
}
|
|
3696
|
-
}, () => props.attributes), false, true);
|
|
3667
|
+
spread(_el$, mergeProps(attrs), false, true);
|
|
3697
3668
|
insert(_el$, createComponent(Show, {
|
|
3698
3669
|
get when() {
|
|
3699
|
-
return
|
|
3670
|
+
return memo(() => !!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3700
3671
|
},
|
|
3701
3672
|
get children() {
|
|
3702
|
-
return
|
|
3703
|
-
get
|
|
3704
|
-
return
|
|
3673
|
+
return createComponent(blocks_default, {
|
|
3674
|
+
get blocks() {
|
|
3675
|
+
return blocksToRender().blocks;
|
|
3705
3676
|
},
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
return (() => {
|
|
3709
|
-
const _el$2 = _tmpl$25();
|
|
3710
|
-
setAttribute(_el$2, "key", index);
|
|
3711
|
-
insert(_el$2, createComponent(blocks_default, {
|
|
3712
|
-
get blocks() {
|
|
3713
|
-
return variant.blocks;
|
|
3714
|
-
},
|
|
3715
|
-
get parent() {
|
|
3716
|
-
return props.builderBlock?.id;
|
|
3717
|
-
},
|
|
3718
|
-
path: `component.options.variants.${index}.blocks`
|
|
3719
|
-
}));
|
|
3720
|
-
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
3721
|
-
return _el$2;
|
|
3722
|
-
})();
|
|
3723
|
-
}
|
|
3724
|
-
}), createComponent(inlined_styles_default, {
|
|
3725
|
-
get nonce() {
|
|
3726
|
-
return props.builderContext?.nonce || "";
|
|
3677
|
+
get parent() {
|
|
3678
|
+
return props.builderBlock?.id;
|
|
3727
3679
|
},
|
|
3728
|
-
get
|
|
3729
|
-
return
|
|
3680
|
+
get path() {
|
|
3681
|
+
return blocksToRender().path;
|
|
3730
3682
|
},
|
|
3731
|
-
get
|
|
3732
|
-
return
|
|
3733
|
-
}
|
|
3734
|
-
}), createComponent(inlined_script_default, {
|
|
3735
|
-
get nonce() {
|
|
3736
|
-
return props.builderContext?.nonce || "";
|
|
3683
|
+
get context() {
|
|
3684
|
+
return props.builderContext;
|
|
3737
3685
|
},
|
|
3738
|
-
get
|
|
3739
|
-
return
|
|
3686
|
+
get registeredComponents() {
|
|
3687
|
+
return props.builderComponents;
|
|
3740
3688
|
},
|
|
3741
|
-
get
|
|
3742
|
-
return
|
|
3689
|
+
get BlocksWrapperProps() {
|
|
3690
|
+
return {
|
|
3691
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3692
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3693
|
+
};
|
|
3743
3694
|
}
|
|
3744
|
-
})
|
|
3695
|
+
});
|
|
3745
3696
|
}
|
|
3746
3697
|
}), null);
|
|
3747
|
-
insert(_el$, createComponent(
|
|
3748
|
-
get
|
|
3749
|
-
return
|
|
3750
|
-
},
|
|
3751
|
-
get parent() {
|
|
3752
|
-
return props.builderBlock?.id;
|
|
3698
|
+
insert(_el$, createComponent(Show, {
|
|
3699
|
+
get when() {
|
|
3700
|
+
return memo(() => !!!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
3753
3701
|
},
|
|
3754
|
-
get
|
|
3755
|
-
return
|
|
3702
|
+
get children() {
|
|
3703
|
+
return [createComponent(Show, {
|
|
3704
|
+
get when() {
|
|
3705
|
+
return shouldRenderVariants();
|
|
3706
|
+
},
|
|
3707
|
+
get children() {
|
|
3708
|
+
return [createComponent(inlined_styles_default, {
|
|
3709
|
+
get nonce() {
|
|
3710
|
+
return props.builderContext?.nonce || "";
|
|
3711
|
+
},
|
|
3712
|
+
get styles() {
|
|
3713
|
+
return hideVariantsStyleString();
|
|
3714
|
+
},
|
|
3715
|
+
get id() {
|
|
3716
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
3717
|
+
}
|
|
3718
|
+
}), createComponent(inlined_script_default, {
|
|
3719
|
+
get nonce() {
|
|
3720
|
+
return props.builderContext?.nonce || "";
|
|
3721
|
+
},
|
|
3722
|
+
get scriptStr() {
|
|
3723
|
+
return updateVisibilityStylesScript();
|
|
3724
|
+
},
|
|
3725
|
+
get id() {
|
|
3726
|
+
return `variants-visibility-script-${props.builderBlock?.id}`;
|
|
3727
|
+
}
|
|
3728
|
+
}), createComponent(For, {
|
|
3729
|
+
get each() {
|
|
3730
|
+
return props.variants;
|
|
3731
|
+
},
|
|
3732
|
+
children: (variant, _index) => {
|
|
3733
|
+
const index = _index();
|
|
3734
|
+
return createComponent(blocks_default, {
|
|
3735
|
+
get key() {
|
|
3736
|
+
return `${props.builderBlock?.id}-${index}`;
|
|
3737
|
+
},
|
|
3738
|
+
get BlocksWrapperProps() {
|
|
3739
|
+
return {
|
|
3740
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3741
|
+
"aria-hidden": true,
|
|
3742
|
+
hidden: true,
|
|
3743
|
+
"data-variant-id": `${props.builderBlock?.id}-${index}`
|
|
3744
|
+
};
|
|
3745
|
+
},
|
|
3746
|
+
get blocks() {
|
|
3747
|
+
return variant.blocks;
|
|
3748
|
+
},
|
|
3749
|
+
get parent() {
|
|
3750
|
+
return props.builderBlock?.id;
|
|
3751
|
+
},
|
|
3752
|
+
path: `component.options.variants.${index}.blocks`,
|
|
3753
|
+
get context() {
|
|
3754
|
+
return props.builderContext;
|
|
3755
|
+
},
|
|
3756
|
+
get registeredComponents() {
|
|
3757
|
+
return props.builderComponents;
|
|
3758
|
+
},
|
|
3759
|
+
get children() {
|
|
3760
|
+
return createComponent(inlined_script_default, {
|
|
3761
|
+
get nonce() {
|
|
3762
|
+
return props.builderContext?.nonce || "";
|
|
3763
|
+
},
|
|
3764
|
+
get scriptStr() {
|
|
3765
|
+
return scriptStr();
|
|
3766
|
+
},
|
|
3767
|
+
get id() {
|
|
3768
|
+
return `variants-script-${props.builderBlock?.id}-${index}`;
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
})];
|
|
3775
|
+
}
|
|
3776
|
+
}), createComponent(blocks_default, {
|
|
3777
|
+
get blocks() {
|
|
3778
|
+
return blocksToRender().blocks;
|
|
3779
|
+
},
|
|
3780
|
+
get parent() {
|
|
3781
|
+
return props.builderBlock?.id;
|
|
3782
|
+
},
|
|
3783
|
+
get path() {
|
|
3784
|
+
return blocksToRender().path;
|
|
3785
|
+
},
|
|
3786
|
+
get context() {
|
|
3787
|
+
return props.builderContext;
|
|
3788
|
+
},
|
|
3789
|
+
get registeredComponents() {
|
|
3790
|
+
return props.builderComponents;
|
|
3791
|
+
},
|
|
3792
|
+
get BlocksWrapperProps() {
|
|
3793
|
+
return {
|
|
3794
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
3795
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
3796
|
+
};
|
|
3797
|
+
},
|
|
3798
|
+
get children() {
|
|
3799
|
+
return createComponent(Show, {
|
|
3800
|
+
get when() {
|
|
3801
|
+
return shouldRenderVariants();
|
|
3802
|
+
},
|
|
3803
|
+
get children() {
|
|
3804
|
+
return createComponent(inlined_script_default, {
|
|
3805
|
+
get nonce() {
|
|
3806
|
+
return props.builderContext?.nonce || "";
|
|
3807
|
+
},
|
|
3808
|
+
get scriptStr() {
|
|
3809
|
+
return scriptStr();
|
|
3810
|
+
},
|
|
3811
|
+
get id() {
|
|
3812
|
+
return `variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`;
|
|
3813
|
+
}
|
|
3814
|
+
});
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3817
|
+
}
|
|
3818
|
+
})];
|
|
3756
3819
|
}
|
|
3757
3820
|
}), null);
|
|
3758
3821
|
return _el$;
|
|
@@ -4039,7 +4102,7 @@ var componentInfo10 = {
|
|
|
4039
4102
|
}
|
|
4040
4103
|
};
|
|
4041
4104
|
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
4042
|
-
var _tmpl$
|
|
4105
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
4043
4106
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
4044
4107
|
function Tabs(props) {
|
|
4045
4108
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -4054,7 +4117,7 @@ function Tabs(props) {
|
|
|
4054
4117
|
}
|
|
4055
4118
|
}
|
|
4056
4119
|
return (() => {
|
|
4057
|
-
const _el$ = _tmpl$
|
|
4120
|
+
const _el$ = _tmpl$25(), _el$2 = _el$.firstChild;
|
|
4058
4121
|
_el$2.style.setProperty("display", "flex");
|
|
4059
4122
|
_el$2.style.setProperty("flex-direction", "row");
|
|
4060
4123
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -4586,7 +4649,7 @@ function logFetch(url) {
|
|
|
4586
4649
|
|
|
4587
4650
|
// src/blocks/form/form/form.tsx
|
|
4588
4651
|
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
4589
|
-
var _tmpl$
|
|
4652
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
4590
4653
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
4591
4654
|
padding: 10px;
|
|
4592
4655
|
color: red;
|
|
@@ -4779,7 +4842,7 @@ function FormComponent(props) {
|
|
|
4779
4842
|
}
|
|
4780
4843
|
let formRef;
|
|
4781
4844
|
return [(() => {
|
|
4782
|
-
const _el$ = _tmpl$
|
|
4845
|
+
const _el$ = _tmpl$26();
|
|
4783
4846
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
4784
4847
|
const _ref$ = formRef;
|
|
4785
4848
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -4991,7 +5054,7 @@ var componentInfo16 = {
|
|
|
4991
5054
|
noWrap: true
|
|
4992
5055
|
};
|
|
4993
5056
|
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
4994
|
-
var _tmpl$
|
|
5057
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<option>`);
|
|
4995
5058
|
function SelectComponent(props) {
|
|
4996
5059
|
return (() => {
|
|
4997
5060
|
const _el$ = _tmpl$17();
|
|
@@ -5019,7 +5082,7 @@ function SelectComponent(props) {
|
|
|
5019
5082
|
children: (option, _index) => {
|
|
5020
5083
|
const index = _index();
|
|
5021
5084
|
return (() => {
|
|
5022
|
-
const _el$2 = _tmpl$
|
|
5085
|
+
const _el$2 = _tmpl$27();
|
|
5023
5086
|
insert(_el$2, () => option.name || option.value);
|
|
5024
5087
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
5025
5088
|
effect(() => _el$2.value = option.value);
|
|
@@ -5263,7 +5326,7 @@ var componentInfo20 = {
|
|
|
5263
5326
|
}
|
|
5264
5327
|
};
|
|
5265
5328
|
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5266
|
-
var _tmpl$
|
|
5329
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5267
5330
|
function Video(props) {
|
|
5268
5331
|
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5269
5332
|
const videoProps = createMemo(() => {
|
|
@@ -5318,7 +5381,7 @@ function Video(props) {
|
|
|
5318
5381
|
}
|
|
5319
5382
|
});
|
|
5320
5383
|
return (() => {
|
|
5321
|
-
const _el$ = _tmpl$
|
|
5384
|
+
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5322
5385
|
_el$.style.setProperty("position", "relative");
|
|
5323
5386
|
const _ref$ = videoRef;
|
|
5324
5387
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
@@ -5455,7 +5518,7 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
5455
5518
|
}, {
|
|
5456
5519
|
component: text_default,
|
|
5457
5520
|
...componentInfo11
|
|
5458
|
-
}, ...TARGET
|
|
5521
|
+
}, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
|
|
5459
5522
|
component: personalization_container_default,
|
|
5460
5523
|
...componentInfo6
|
|
5461
5524
|
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
@@ -5492,7 +5555,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
|
|
|
5492
5555
|
|
|
5493
5556
|
// src/components/content-variants/helpers.ts
|
|
5494
5557
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
5495
|
-
var
|
|
5558
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
|
|
5496
5559
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
5497
5560
|
...variant,
|
|
5498
5561
|
testVariationId: variant.id,
|
|
@@ -5517,20 +5580,20 @@ var checkShouldRenderVariants2 = ({
|
|
|
5517
5580
|
};
|
|
5518
5581
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
5519
5582
|
var isAngularSDK = TARGET === "angular";
|
|
5520
|
-
var
|
|
5583
|
+
var isHydrationTarget2 = getIsHydrationTarget(TARGET);
|
|
5521
5584
|
var getInitVariantsFnsScriptString = () => `
|
|
5522
5585
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
5523
|
-
window.${
|
|
5586
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
5524
5587
|
`;
|
|
5525
5588
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
5526
5589
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
5527
|
-
"${contentId}",${JSON.stringify(variants)}, ${
|
|
5590
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
|
|
5528
5591
|
)`;
|
|
5529
5592
|
var getUpdateVariantVisibilityScript = ({
|
|
5530
5593
|
contentId,
|
|
5531
5594
|
variationId
|
|
5532
|
-
}) => `window.${
|
|
5533
|
-
"${variationId}", "${contentId}", ${
|
|
5595
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
|
|
5596
|
+
"${variationId}", "${contentId}", ${isHydrationTarget2}
|
|
5534
5597
|
)`;
|
|
5535
5598
|
|
|
5536
5599
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -5539,7 +5602,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5539
5602
|
}
|
|
5540
5603
|
|
|
5541
5604
|
// src/constants/sdk-version.ts
|
|
5542
|
-
var SDK_VERSION = "4.0.
|
|
5605
|
+
var SDK_VERSION = "4.0.9";
|
|
5543
5606
|
|
|
5544
5607
|
// src/helpers/sdk-headers.ts
|
|
5545
5608
|
var getSdkHeaders = () => ({
|
|
@@ -6955,7 +7018,7 @@ function ContentVariants(props) {
|
|
|
6955
7018
|
return !props.isNestedRender && TARGET !== "reactNative";
|
|
6956
7019
|
},
|
|
6957
7020
|
get children() {
|
|
6958
|
-
return createComponent(inlined_script_default, {
|
|
7021
|
+
return [createComponent(inlined_script_default, {
|
|
6959
7022
|
id: "builderio-init-variants-fns",
|
|
6960
7023
|
get scriptStr() {
|
|
6961
7024
|
return getInitVariantsFnsScriptString();
|
|
@@ -6963,7 +7026,22 @@ function ContentVariants(props) {
|
|
|
6963
7026
|
get nonce() {
|
|
6964
7027
|
return props.nonce || "";
|
|
6965
7028
|
}
|
|
6966
|
-
})
|
|
7029
|
+
}), createComponent(Show, {
|
|
7030
|
+
get when() {
|
|
7031
|
+
return SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET);
|
|
7032
|
+
},
|
|
7033
|
+
get children() {
|
|
7034
|
+
return createComponent(inlined_script_default, {
|
|
7035
|
+
id: "builderio-init-personalization-variants-fns",
|
|
7036
|
+
get nonce() {
|
|
7037
|
+
return props.nonce || "";
|
|
7038
|
+
},
|
|
7039
|
+
get scriptStr() {
|
|
7040
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
7041
|
+
}
|
|
7042
|
+
});
|
|
7043
|
+
}
|
|
7044
|
+
})];
|
|
6967
7045
|
}
|
|
6968
7046
|
}), createComponent(Show, {
|
|
6969
7047
|
get when() {
|
|
@@ -7151,7 +7229,7 @@ var fetchSymbolContent = async ({
|
|
|
7151
7229
|
};
|
|
7152
7230
|
|
|
7153
7231
|
// src/blocks/symbol/symbol.tsx
|
|
7154
|
-
var _tmpl$
|
|
7232
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
7155
7233
|
function Symbol(props) {
|
|
7156
7234
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
7157
7235
|
const [symbolEntry, setSymbolEntry] = createSignal(props.symbol?.entry);
|
|
@@ -7185,7 +7263,7 @@ function Symbol(props) {
|
|
|
7185
7263
|
}
|
|
7186
7264
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
7187
7265
|
return (() => {
|
|
7188
|
-
const _el$ = _tmpl$
|
|
7266
|
+
const _el$ = _tmpl$29();
|
|
7189
7267
|
spread(_el$, mergeProps({
|
|
7190
7268
|
get ["class"]() {
|
|
7191
7269
|
return className();
|