@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/edge/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
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -4849,7 +4849,7 @@ function Block(props) {
|
|
|
4849
4849
|
});
|
|
4850
4850
|
}
|
|
4851
4851
|
var block_default = Block;
|
|
4852
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
4852
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
|
|
4853
4853
|
display: flex;
|
|
4854
4854
|
flex-direction: column;
|
|
4855
4855
|
align-items: stretch;
|
|
@@ -4898,7 +4898,7 @@ function BlocksWrapper(props) {
|
|
|
4898
4898
|
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
4899
4899
|
return [createComponent(Dynamic, mergeProps({
|
|
4900
4900
|
get ["class"]() {
|
|
4901
|
-
return className() + " dynamic-
|
|
4901
|
+
return className() + " dynamic-450facf4";
|
|
4902
4902
|
},
|
|
4903
4903
|
ref(r$) {
|
|
4904
4904
|
const _ref$ = blocksWrapperRef;
|
|
@@ -4945,17 +4945,17 @@ function Blocks(props) {
|
|
|
4945
4945
|
get styleProp() {
|
|
4946
4946
|
return props.styleProp;
|
|
4947
4947
|
},
|
|
4948
|
+
get BlocksWrapperProps() {
|
|
4949
|
+
return props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
4950
|
+
},
|
|
4948
4951
|
get classNameProp() {
|
|
4949
4952
|
return props.className;
|
|
4950
4953
|
},
|
|
4951
4954
|
get BlocksWrapper() {
|
|
4952
4955
|
return props.context?.BlocksWrapper || builderContext?.BlocksWrapper;
|
|
4953
4956
|
},
|
|
4954
|
-
get BlocksWrapperProps() {
|
|
4955
|
-
return props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
4956
|
-
},
|
|
4957
4957
|
get children() {
|
|
4958
|
-
return createComponent(Show, {
|
|
4958
|
+
return [memo(() => props.children), createComponent(Show, {
|
|
4959
4959
|
get when() {
|
|
4960
4960
|
return props.blocks;
|
|
4961
4961
|
},
|
|
@@ -4984,7 +4984,7 @@ function Blocks(props) {
|
|
|
4984
4984
|
}
|
|
4985
4985
|
});
|
|
4986
4986
|
}
|
|
4987
|
-
});
|
|
4987
|
+
})];
|
|
4988
4988
|
}
|
|
4989
4989
|
});
|
|
4990
4990
|
}
|
|
@@ -5409,6 +5409,166 @@ function SectionComponent(props) {
|
|
|
5409
5409
|
}
|
|
5410
5410
|
var section_default = SectionComponent;
|
|
5411
5411
|
|
|
5412
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
5413
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
5414
|
+
function isString(val) {
|
|
5415
|
+
return typeof val === "string";
|
|
5416
|
+
}
|
|
5417
|
+
function isNumber(val) {
|
|
5418
|
+
return typeof val === "number";
|
|
5419
|
+
}
|
|
5420
|
+
function objectMatchesQuery(userattr, query2) {
|
|
5421
|
+
const result = (() => {
|
|
5422
|
+
const property = query2.property;
|
|
5423
|
+
const operator = query2.operator;
|
|
5424
|
+
let testValue = query2.value;
|
|
5425
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
5426
|
+
testValue = query2.value.slice(0, -1);
|
|
5427
|
+
}
|
|
5428
|
+
if (!(property && operator)) {
|
|
5429
|
+
return true;
|
|
5430
|
+
}
|
|
5431
|
+
if (Array.isArray(testValue)) {
|
|
5432
|
+
if (operator === "isNot") {
|
|
5433
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
5434
|
+
property,
|
|
5435
|
+
operator,
|
|
5436
|
+
value: val
|
|
5437
|
+
}));
|
|
5438
|
+
}
|
|
5439
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
5440
|
+
property,
|
|
5441
|
+
operator,
|
|
5442
|
+
value: val
|
|
5443
|
+
}));
|
|
5444
|
+
}
|
|
5445
|
+
const value = userattr[property];
|
|
5446
|
+
if (Array.isArray(value)) {
|
|
5447
|
+
return value.includes(testValue);
|
|
5448
|
+
}
|
|
5449
|
+
switch (operator) {
|
|
5450
|
+
case "is":
|
|
5451
|
+
return value === testValue;
|
|
5452
|
+
case "isNot":
|
|
5453
|
+
return value !== testValue;
|
|
5454
|
+
case "contains":
|
|
5455
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
5456
|
+
case "startsWith":
|
|
5457
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
5458
|
+
case "endsWith":
|
|
5459
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
5460
|
+
case "greaterThan":
|
|
5461
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
5462
|
+
case "lessThan":
|
|
5463
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
5464
|
+
case "greaterThanOrEqualTo":
|
|
5465
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
5466
|
+
case "lessThanOrEqualTo":
|
|
5467
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
5468
|
+
default:
|
|
5469
|
+
return false;
|
|
5470
|
+
}
|
|
5471
|
+
})();
|
|
5472
|
+
return result;
|
|
5473
|
+
}
|
|
5474
|
+
const item = {
|
|
5475
|
+
query,
|
|
5476
|
+
startDate,
|
|
5477
|
+
endDate
|
|
5478
|
+
};
|
|
5479
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
5480
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
5481
|
+
return false;
|
|
5482
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
5483
|
+
return false;
|
|
5484
|
+
}
|
|
5485
|
+
if (!item.query || !item.query.length) {
|
|
5486
|
+
return true;
|
|
5487
|
+
}
|
|
5488
|
+
return item.query.every((filter) => {
|
|
5489
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
5490
|
+
});
|
|
5491
|
+
}
|
|
5492
|
+
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}";
|
|
5493
|
+
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}";
|
|
5494
|
+
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}";
|
|
5495
|
+
|
|
5496
|
+
// src/blocks/personalization-container/helpers.ts
|
|
5497
|
+
var DEFAULT_INDEX = "default";
|
|
5498
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
|
|
5499
|
+
var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
|
|
5500
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
|
|
5501
|
+
var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
|
|
5502
|
+
var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
|
|
5503
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
5504
|
+
const hasVariants = variants && variants.length > 0;
|
|
5505
|
+
if (TARGET === "reactNative")
|
|
5506
|
+
return false;
|
|
5507
|
+
if (!hasVariants)
|
|
5508
|
+
return false;
|
|
5509
|
+
if (!canTrack)
|
|
5510
|
+
return false;
|
|
5511
|
+
if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
|
|
5512
|
+
return true;
|
|
5513
|
+
if (isBrowser())
|
|
5514
|
+
return false;
|
|
5515
|
+
return true;
|
|
5516
|
+
}
|
|
5517
|
+
function getBlocksToRender({
|
|
5518
|
+
variants,
|
|
5519
|
+
previewingIndex,
|
|
5520
|
+
isHydrated,
|
|
5521
|
+
filteredVariants,
|
|
5522
|
+
fallbackBlocks
|
|
5523
|
+
}) {
|
|
5524
|
+
const fallback = {
|
|
5525
|
+
blocks: fallbackBlocks ?? [],
|
|
5526
|
+
path: "this.children",
|
|
5527
|
+
index: DEFAULT_INDEX
|
|
5528
|
+
};
|
|
5529
|
+
if (isHydrated && isEditing()) {
|
|
5530
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
5531
|
+
const variant = variants?.[previewingIndex];
|
|
5532
|
+
if (variant) {
|
|
5533
|
+
return {
|
|
5534
|
+
blocks: variant.blocks,
|
|
5535
|
+
path: `variants.${previewingIndex}.blocks`,
|
|
5536
|
+
index: previewingIndex
|
|
5537
|
+
};
|
|
5538
|
+
}
|
|
5539
|
+
}
|
|
5540
|
+
return fallback;
|
|
5541
|
+
}
|
|
5542
|
+
if (isBrowser()) {
|
|
5543
|
+
const winningVariant = filteredVariants?.[0];
|
|
5544
|
+
if (winningVariant && variants) {
|
|
5545
|
+
const variantIndex = variants.indexOf(winningVariant);
|
|
5546
|
+
if (variantIndex !== -1) {
|
|
5547
|
+
return {
|
|
5548
|
+
blocks: winningVariant.blocks,
|
|
5549
|
+
path: `variants.${variantIndex}.blocks`,
|
|
5550
|
+
index: variantIndex
|
|
5551
|
+
};
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
}
|
|
5555
|
+
return fallback;
|
|
5556
|
+
}
|
|
5557
|
+
var getInitPersonalizationVariantsFnsScriptString = () => {
|
|
5558
|
+
return `
|
|
5559
|
+
window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
5560
|
+
window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
|
|
5561
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
5562
|
+
`;
|
|
5563
|
+
};
|
|
5564
|
+
var isHydrationTarget = TARGET === "react";
|
|
5565
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
5566
|
+
return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
5567
|
+
};
|
|
5568
|
+
var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
|
|
5569
|
+
return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
5570
|
+
};
|
|
5571
|
+
|
|
5412
5572
|
// src/helpers/url.ts
|
|
5413
5573
|
var getTopLevelDomain = (host) => {
|
|
5414
5574
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
@@ -6388,7 +6548,8 @@ var componentInfo6 = {
|
|
|
6388
6548
|
name: "PersonalizationContainer",
|
|
6389
6549
|
shouldReceiveBuilderProps: {
|
|
6390
6550
|
builderBlock: true,
|
|
6391
|
-
builderContext: true
|
|
6551
|
+
builderContext: true,
|
|
6552
|
+
builderComponents: true
|
|
6392
6553
|
},
|
|
6393
6554
|
noWrap: true,
|
|
6394
6555
|
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
@@ -6450,208 +6611,22 @@ function isPreviewing(_search) {
|
|
|
6450
6611
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
6451
6612
|
}
|
|
6452
6613
|
|
|
6453
|
-
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
6454
|
-
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
6455
|
-
function isString(val) {
|
|
6456
|
-
return typeof val === "string";
|
|
6457
|
-
}
|
|
6458
|
-
function isNumber(val) {
|
|
6459
|
-
return typeof val === "number";
|
|
6460
|
-
}
|
|
6461
|
-
function objectMatchesQuery(userattr, query2) {
|
|
6462
|
-
const result = (() => {
|
|
6463
|
-
const property = query2.property;
|
|
6464
|
-
const operator = query2.operator;
|
|
6465
|
-
let testValue = query2.value;
|
|
6466
|
-
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
6467
|
-
testValue = query2.value.slice(0, -1);
|
|
6468
|
-
}
|
|
6469
|
-
if (!(property && operator)) {
|
|
6470
|
-
return true;
|
|
6471
|
-
}
|
|
6472
|
-
if (Array.isArray(testValue)) {
|
|
6473
|
-
if (operator === "isNot") {
|
|
6474
|
-
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
6475
|
-
property,
|
|
6476
|
-
operator,
|
|
6477
|
-
value: val
|
|
6478
|
-
}));
|
|
6479
|
-
}
|
|
6480
|
-
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
6481
|
-
property,
|
|
6482
|
-
operator,
|
|
6483
|
-
value: val
|
|
6484
|
-
}));
|
|
6485
|
-
}
|
|
6486
|
-
const value = userattr[property];
|
|
6487
|
-
if (Array.isArray(value)) {
|
|
6488
|
-
return value.includes(testValue);
|
|
6489
|
-
}
|
|
6490
|
-
switch (operator) {
|
|
6491
|
-
case "is":
|
|
6492
|
-
return value === testValue;
|
|
6493
|
-
case "isNot":
|
|
6494
|
-
return value !== testValue;
|
|
6495
|
-
case "contains":
|
|
6496
|
-
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
6497
|
-
case "startsWith":
|
|
6498
|
-
return isString(value) && value.startsWith(String(testValue));
|
|
6499
|
-
case "endsWith":
|
|
6500
|
-
return isString(value) && value.endsWith(String(testValue));
|
|
6501
|
-
case "greaterThan":
|
|
6502
|
-
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
6503
|
-
case "lessThan":
|
|
6504
|
-
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
6505
|
-
case "greaterThanOrEqualTo":
|
|
6506
|
-
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
6507
|
-
case "lessThanOrEqualTo":
|
|
6508
|
-
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
6509
|
-
default:
|
|
6510
|
-
return false;
|
|
6511
|
-
}
|
|
6512
|
-
})();
|
|
6513
|
-
return result;
|
|
6514
|
-
}
|
|
6515
|
-
const item = {
|
|
6516
|
-
query,
|
|
6517
|
-
startDate,
|
|
6518
|
-
endDate
|
|
6519
|
-
};
|
|
6520
|
-
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
6521
|
-
if (item.startDate && new Date(item.startDate) > now) {
|
|
6522
|
-
return false;
|
|
6523
|
-
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
6524
|
-
return false;
|
|
6525
|
-
}
|
|
6526
|
-
if (!item.query || !item.query.length) {
|
|
6527
|
-
return true;
|
|
6528
|
-
}
|
|
6529
|
-
return item.query.every((filter) => {
|
|
6530
|
-
return objectMatchesQuery(userAttributes, filter);
|
|
6531
|
-
});
|
|
6532
|
-
}
|
|
6533
|
-
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
6534
|
-
if (!navigator.cookieEnabled) {
|
|
6535
|
-
return;
|
|
6536
|
-
}
|
|
6537
|
-
function getCookie(name) {
|
|
6538
|
-
const nameEQ = name + '=';
|
|
6539
|
-
const ca = document.cookie.split(';');
|
|
6540
|
-
for (let i = 0; i < ca.length; i++) {
|
|
6541
|
-
let c = ca[i];
|
|
6542
|
-
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
6543
|
-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
6544
|
-
}
|
|
6545
|
-
return null;
|
|
6546
|
-
}
|
|
6547
|
-
function removeVariants() {
|
|
6548
|
-
variants?.forEach(function (_, index) {
|
|
6549
|
-
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
6550
|
-
});
|
|
6551
|
-
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
6552
|
-
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
6553
|
-
}
|
|
6554
|
-
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
6555
|
-
if (locale) {
|
|
6556
|
-
attributes.locale = locale;
|
|
6557
|
-
}
|
|
6558
|
-
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
6559
|
-
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
6560
|
-
});
|
|
6561
|
-
const isDebug = location.href.includes('builder.debug=true');
|
|
6562
|
-
if (isDebug) {
|
|
6563
|
-
console.debug('PersonalizationContainer', {
|
|
6564
|
-
attributes,
|
|
6565
|
-
variants,
|
|
6566
|
-
winningVariantIndex
|
|
6567
|
-
});
|
|
6568
|
-
}
|
|
6569
|
-
if (winningVariantIndex !== -1) {
|
|
6570
|
-
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
6571
|
-
if (winningVariant) {
|
|
6572
|
-
const parentNode = winningVariant.parentNode;
|
|
6573
|
-
if (parentNode) {
|
|
6574
|
-
const newParent = parentNode.cloneNode(false);
|
|
6575
|
-
newParent.appendChild(winningVariant.content.firstChild);
|
|
6576
|
-
newParent.appendChild(winningVariant.content.lastChild);
|
|
6577
|
-
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
6578
|
-
}
|
|
6579
|
-
if (isDebug) {
|
|
6580
|
-
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
6581
|
-
}
|
|
6582
|
-
}
|
|
6583
|
-
} else if (variants && variants.length > 0) {
|
|
6584
|
-
removeVariants();
|
|
6585
|
-
}
|
|
6586
|
-
}`;
|
|
6587
|
-
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}";
|
|
6588
|
-
|
|
6589
|
-
// src/blocks/personalization-container/helpers.ts
|
|
6590
|
-
function checkShouldRenderVariants(variants, canTrack) {
|
|
6591
|
-
const hasVariants = variants && variants.length > 0;
|
|
6592
|
-
if (TARGET === "reactNative")
|
|
6593
|
-
return false;
|
|
6594
|
-
if (!hasVariants)
|
|
6595
|
-
return false;
|
|
6596
|
-
if (!canTrack)
|
|
6597
|
-
return false;
|
|
6598
|
-
if (TARGET === "vue" || TARGET === "svelte")
|
|
6599
|
-
return true;
|
|
6600
|
-
if (isBrowser())
|
|
6601
|
-
return false;
|
|
6602
|
-
return true;
|
|
6603
|
-
}
|
|
6604
|
-
function getBlocksToRender({
|
|
6605
|
-
variants,
|
|
6606
|
-
previewingIndex,
|
|
6607
|
-
isHydrated,
|
|
6608
|
-
filteredVariants,
|
|
6609
|
-
fallbackBlocks
|
|
6610
|
-
}) {
|
|
6611
|
-
const fallback = {
|
|
6612
|
-
blocks: fallbackBlocks ?? [],
|
|
6613
|
-
path: "this.children"
|
|
6614
|
-
};
|
|
6615
|
-
if (isHydrated && isEditing()) {
|
|
6616
|
-
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
6617
|
-
const variant = variants[previewingIndex];
|
|
6618
|
-
return {
|
|
6619
|
-
blocks: variant.blocks,
|
|
6620
|
-
path: `component.options.variants.${previewingIndex}.blocks`
|
|
6621
|
-
};
|
|
6622
|
-
}
|
|
6623
|
-
return fallback;
|
|
6624
|
-
}
|
|
6625
|
-
if (isBrowser()) {
|
|
6626
|
-
const winningVariant = filteredVariants?.[0];
|
|
6627
|
-
if (winningVariant) {
|
|
6628
|
-
return {
|
|
6629
|
-
blocks: winningVariant.blocks,
|
|
6630
|
-
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
6631
|
-
};
|
|
6632
|
-
}
|
|
6633
|
-
}
|
|
6634
|
-
return fallback;
|
|
6635
|
-
}
|
|
6636
|
-
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
6637
|
-
return `
|
|
6638
|
-
(function() {
|
|
6639
|
-
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
6640
|
-
${PERSONALIZATION_SCRIPT}
|
|
6641
|
-
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
6642
|
-
})();
|
|
6643
|
-
`;
|
|
6644
|
-
};
|
|
6645
|
-
|
|
6646
6614
|
// src/blocks/personalization-container/personalization-container.tsx
|
|
6647
6615
|
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
6648
|
-
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
6649
6616
|
function PersonalizationContainer(props) {
|
|
6650
6617
|
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
6651
6618
|
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
6619
|
+
const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal(getUpdateVisibilityStylesScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
6652
6620
|
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
6653
6621
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
6654
|
-
const [
|
|
6622
|
+
const [shouldResetVariants, setShouldResetVariants] = createSignal(false);
|
|
6623
|
+
const attrs = createMemo(() => {
|
|
6624
|
+
return {
|
|
6625
|
+
...props.attributes,
|
|
6626
|
+
...{},
|
|
6627
|
+
[getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
|
|
6628
|
+
};
|
|
6629
|
+
});
|
|
6655
6630
|
const filteredVariants = createMemo(() => {
|
|
6656
6631
|
return (props.variants || []).filter((variant) => {
|
|
6657
6632
|
return filterWithCustomTargeting({
|
|
@@ -6666,26 +6641,26 @@ function PersonalizationContainer(props) {
|
|
|
6666
6641
|
return getBlocksToRender({
|
|
6667
6642
|
variants: props.variants,
|
|
6668
6643
|
fallbackBlocks: props.builderBlock?.children,
|
|
6669
|
-
isHydrated:
|
|
6644
|
+
isHydrated: shouldResetVariants(),
|
|
6670
6645
|
filteredVariants: filteredVariants(),
|
|
6671
6646
|
previewingIndex: props.previewingIndex
|
|
6672
6647
|
});
|
|
6673
6648
|
});
|
|
6674
6649
|
const hideVariantsStyleString = createMemo(() => {
|
|
6675
|
-
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
6650
|
+
return (props.variants || []).map((_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `).join("");
|
|
6676
6651
|
});
|
|
6677
6652
|
let rootRef;
|
|
6678
6653
|
onMount(() => {
|
|
6679
|
-
|
|
6680
|
-
const unsub = userAttributesService.subscribeOnUserAttributesChange((
|
|
6681
|
-
setUserAttributes(
|
|
6654
|
+
setShouldResetVariants(true);
|
|
6655
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs2) => {
|
|
6656
|
+
setUserAttributes(attrs2);
|
|
6682
6657
|
});
|
|
6683
6658
|
if (!(isEditing() || isPreviewing())) {
|
|
6684
6659
|
const variant = filteredVariants()[0];
|
|
6685
6660
|
if (rootRef) {
|
|
6686
6661
|
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
6687
6662
|
detail: {
|
|
6688
|
-
variant: variant ||
|
|
6663
|
+
variant: variant || DEFAULT_INDEX,
|
|
6689
6664
|
content: props.builderContext?.content
|
|
6690
6665
|
},
|
|
6691
6666
|
bubbles: true
|
|
@@ -6695,7 +6670,7 @@ function PersonalizationContainer(props) {
|
|
|
6695
6670
|
if (entry.isIntersecting && rootRef) {
|
|
6696
6671
|
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
6697
6672
|
detail: {
|
|
6698
|
-
variant: variant ||
|
|
6673
|
+
variant: variant || DEFAULT_INDEX,
|
|
6699
6674
|
content: props.builderContext?.content
|
|
6700
6675
|
},
|
|
6701
6676
|
bubbles: true
|
|
@@ -6712,70 +6687,158 @@ function PersonalizationContainer(props) {
|
|
|
6712
6687
|
const _el$ = _tmpl$9();
|
|
6713
6688
|
const _ref$ = rootRef;
|
|
6714
6689
|
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
6715
|
-
spread(_el$, mergeProps(
|
|
6716
|
-
get ["class"]() {
|
|
6717
|
-
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
6718
|
-
}
|
|
6719
|
-
}, () => props.attributes), false, true);
|
|
6690
|
+
spread(_el$, mergeProps(attrs), false, true);
|
|
6720
6691
|
insert(_el$, createComponent(Show, {
|
|
6721
6692
|
get when() {
|
|
6722
|
-
return
|
|
6693
|
+
return memo(() => !!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
6723
6694
|
},
|
|
6724
6695
|
get children() {
|
|
6725
|
-
return
|
|
6726
|
-
get
|
|
6727
|
-
return
|
|
6696
|
+
return createComponent(blocks_default, {
|
|
6697
|
+
get blocks() {
|
|
6698
|
+
return blocksToRender().blocks;
|
|
6728
6699
|
},
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
return (() => {
|
|
6732
|
-
const _el$2 = _tmpl$25();
|
|
6733
|
-
setAttribute(_el$2, "key", index);
|
|
6734
|
-
insert(_el$2, createComponent(blocks_default, {
|
|
6735
|
-
get blocks() {
|
|
6736
|
-
return variant.blocks;
|
|
6737
|
-
},
|
|
6738
|
-
get parent() {
|
|
6739
|
-
return props.builderBlock?.id;
|
|
6740
|
-
},
|
|
6741
|
-
path: `component.options.variants.${index}.blocks`
|
|
6742
|
-
}));
|
|
6743
|
-
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
6744
|
-
return _el$2;
|
|
6745
|
-
})();
|
|
6746
|
-
}
|
|
6747
|
-
}), createComponent(inlined_styles_default, {
|
|
6748
|
-
get nonce() {
|
|
6749
|
-
return props.builderContext?.nonce || "";
|
|
6700
|
+
get parent() {
|
|
6701
|
+
return props.builderBlock?.id;
|
|
6750
6702
|
},
|
|
6751
|
-
get
|
|
6752
|
-
return
|
|
6703
|
+
get path() {
|
|
6704
|
+
return blocksToRender().path;
|
|
6753
6705
|
},
|
|
6754
|
-
get
|
|
6755
|
-
return
|
|
6756
|
-
}
|
|
6757
|
-
}), createComponent(inlined_script_default, {
|
|
6758
|
-
get nonce() {
|
|
6759
|
-
return props.builderContext?.nonce || "";
|
|
6706
|
+
get context() {
|
|
6707
|
+
return props.builderContext;
|
|
6760
6708
|
},
|
|
6761
|
-
get
|
|
6762
|
-
return
|
|
6709
|
+
get registeredComponents() {
|
|
6710
|
+
return props.builderComponents;
|
|
6763
6711
|
},
|
|
6764
|
-
get
|
|
6765
|
-
return
|
|
6712
|
+
get BlocksWrapperProps() {
|
|
6713
|
+
return {
|
|
6714
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6715
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
6716
|
+
};
|
|
6766
6717
|
}
|
|
6767
|
-
})
|
|
6718
|
+
});
|
|
6768
6719
|
}
|
|
6769
6720
|
}), null);
|
|
6770
|
-
insert(_el$, createComponent(
|
|
6771
|
-
get
|
|
6772
|
-
return
|
|
6773
|
-
},
|
|
6774
|
-
get parent() {
|
|
6775
|
-
return props.builderBlock?.id;
|
|
6721
|
+
insert(_el$, createComponent(Show, {
|
|
6722
|
+
get when() {
|
|
6723
|
+
return memo(() => !!!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
6776
6724
|
},
|
|
6777
|
-
get
|
|
6778
|
-
return
|
|
6725
|
+
get children() {
|
|
6726
|
+
return [createComponent(Show, {
|
|
6727
|
+
get when() {
|
|
6728
|
+
return shouldRenderVariants();
|
|
6729
|
+
},
|
|
6730
|
+
get children() {
|
|
6731
|
+
return [createComponent(inlined_styles_default, {
|
|
6732
|
+
get nonce() {
|
|
6733
|
+
return props.builderContext?.nonce || "";
|
|
6734
|
+
},
|
|
6735
|
+
get styles() {
|
|
6736
|
+
return hideVariantsStyleString();
|
|
6737
|
+
},
|
|
6738
|
+
get id() {
|
|
6739
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
6740
|
+
}
|
|
6741
|
+
}), createComponent(inlined_script_default, {
|
|
6742
|
+
get nonce() {
|
|
6743
|
+
return props.builderContext?.nonce || "";
|
|
6744
|
+
},
|
|
6745
|
+
get scriptStr() {
|
|
6746
|
+
return updateVisibilityStylesScript();
|
|
6747
|
+
},
|
|
6748
|
+
get id() {
|
|
6749
|
+
return `variants-visibility-script-${props.builderBlock?.id}`;
|
|
6750
|
+
}
|
|
6751
|
+
}), createComponent(For, {
|
|
6752
|
+
get each() {
|
|
6753
|
+
return props.variants;
|
|
6754
|
+
},
|
|
6755
|
+
children: (variant, _index) => {
|
|
6756
|
+
const index = _index();
|
|
6757
|
+
return createComponent(blocks_default, {
|
|
6758
|
+
get key() {
|
|
6759
|
+
return `${props.builderBlock?.id}-${index}`;
|
|
6760
|
+
},
|
|
6761
|
+
get BlocksWrapperProps() {
|
|
6762
|
+
return {
|
|
6763
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6764
|
+
"aria-hidden": true,
|
|
6765
|
+
hidden: true,
|
|
6766
|
+
"data-variant-id": `${props.builderBlock?.id}-${index}`
|
|
6767
|
+
};
|
|
6768
|
+
},
|
|
6769
|
+
get blocks() {
|
|
6770
|
+
return variant.blocks;
|
|
6771
|
+
},
|
|
6772
|
+
get parent() {
|
|
6773
|
+
return props.builderBlock?.id;
|
|
6774
|
+
},
|
|
6775
|
+
path: `component.options.variants.${index}.blocks`,
|
|
6776
|
+
get context() {
|
|
6777
|
+
return props.builderContext;
|
|
6778
|
+
},
|
|
6779
|
+
get registeredComponents() {
|
|
6780
|
+
return props.builderComponents;
|
|
6781
|
+
},
|
|
6782
|
+
get children() {
|
|
6783
|
+
return createComponent(inlined_script_default, {
|
|
6784
|
+
get nonce() {
|
|
6785
|
+
return props.builderContext?.nonce || "";
|
|
6786
|
+
},
|
|
6787
|
+
get scriptStr() {
|
|
6788
|
+
return scriptStr();
|
|
6789
|
+
},
|
|
6790
|
+
get id() {
|
|
6791
|
+
return `variants-script-${props.builderBlock?.id}-${index}`;
|
|
6792
|
+
}
|
|
6793
|
+
});
|
|
6794
|
+
}
|
|
6795
|
+
});
|
|
6796
|
+
}
|
|
6797
|
+
})];
|
|
6798
|
+
}
|
|
6799
|
+
}), createComponent(blocks_default, {
|
|
6800
|
+
get blocks() {
|
|
6801
|
+
return blocksToRender().blocks;
|
|
6802
|
+
},
|
|
6803
|
+
get parent() {
|
|
6804
|
+
return props.builderBlock?.id;
|
|
6805
|
+
},
|
|
6806
|
+
get path() {
|
|
6807
|
+
return blocksToRender().path;
|
|
6808
|
+
},
|
|
6809
|
+
get context() {
|
|
6810
|
+
return props.builderContext;
|
|
6811
|
+
},
|
|
6812
|
+
get registeredComponents() {
|
|
6813
|
+
return props.builderComponents;
|
|
6814
|
+
},
|
|
6815
|
+
get BlocksWrapperProps() {
|
|
6816
|
+
return {
|
|
6817
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6818
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
6819
|
+
};
|
|
6820
|
+
},
|
|
6821
|
+
get children() {
|
|
6822
|
+
return createComponent(Show, {
|
|
6823
|
+
get when() {
|
|
6824
|
+
return shouldRenderVariants();
|
|
6825
|
+
},
|
|
6826
|
+
get children() {
|
|
6827
|
+
return createComponent(inlined_script_default, {
|
|
6828
|
+
get nonce() {
|
|
6829
|
+
return props.builderContext?.nonce || "";
|
|
6830
|
+
},
|
|
6831
|
+
get scriptStr() {
|
|
6832
|
+
return scriptStr();
|
|
6833
|
+
},
|
|
6834
|
+
get id() {
|
|
6835
|
+
return `variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`;
|
|
6836
|
+
}
|
|
6837
|
+
});
|
|
6838
|
+
}
|
|
6839
|
+
});
|
|
6840
|
+
}
|
|
6841
|
+
})];
|
|
6779
6842
|
}
|
|
6780
6843
|
}), null);
|
|
6781
6844
|
return _el$;
|
|
@@ -7062,7 +7125,7 @@ var componentInfo10 = {
|
|
|
7062
7125
|
}
|
|
7063
7126
|
};
|
|
7064
7127
|
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
7065
|
-
var _tmpl$
|
|
7128
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
7066
7129
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
7067
7130
|
function Tabs(props) {
|
|
7068
7131
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -7077,7 +7140,7 @@ function Tabs(props) {
|
|
|
7077
7140
|
}
|
|
7078
7141
|
}
|
|
7079
7142
|
return (() => {
|
|
7080
|
-
const _el$ = _tmpl$
|
|
7143
|
+
const _el$ = _tmpl$25(), _el$2 = _el$.firstChild;
|
|
7081
7144
|
_el$2.style.setProperty("display", "flex");
|
|
7082
7145
|
_el$2.style.setProperty("flex-direction", "row");
|
|
7083
7146
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -7609,7 +7672,7 @@ function logFetch(url) {
|
|
|
7609
7672
|
|
|
7610
7673
|
// src/blocks/form/form/form.tsx
|
|
7611
7674
|
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
7612
|
-
var _tmpl$
|
|
7675
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
7613
7676
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
7614
7677
|
padding: 10px;
|
|
7615
7678
|
color: red;
|
|
@@ -7802,7 +7865,7 @@ function FormComponent(props) {
|
|
|
7802
7865
|
}
|
|
7803
7866
|
let formRef;
|
|
7804
7867
|
return [(() => {
|
|
7805
|
-
const _el$ = _tmpl$
|
|
7868
|
+
const _el$ = _tmpl$26();
|
|
7806
7869
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
7807
7870
|
const _ref$ = formRef;
|
|
7808
7871
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -8014,7 +8077,7 @@ var componentInfo16 = {
|
|
|
8014
8077
|
noWrap: true
|
|
8015
8078
|
};
|
|
8016
8079
|
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
8017
|
-
var _tmpl$
|
|
8080
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<option>`);
|
|
8018
8081
|
function SelectComponent(props) {
|
|
8019
8082
|
return (() => {
|
|
8020
8083
|
const _el$ = _tmpl$17();
|
|
@@ -8042,7 +8105,7 @@ function SelectComponent(props) {
|
|
|
8042
8105
|
children: (option, _index) => {
|
|
8043
8106
|
const index = _index();
|
|
8044
8107
|
return (() => {
|
|
8045
|
-
const _el$2 = _tmpl$
|
|
8108
|
+
const _el$2 = _tmpl$27();
|
|
8046
8109
|
insert(_el$2, () => option.name || option.value);
|
|
8047
8110
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
8048
8111
|
effect(() => _el$2.value = option.value);
|
|
@@ -8286,7 +8349,7 @@ var componentInfo20 = {
|
|
|
8286
8349
|
}
|
|
8287
8350
|
};
|
|
8288
8351
|
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
8289
|
-
var _tmpl$
|
|
8352
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
8290
8353
|
function Video(props) {
|
|
8291
8354
|
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8292
8355
|
const videoProps = createMemo(() => {
|
|
@@ -8342,7 +8405,7 @@ function Video(props) {
|
|
|
8342
8405
|
}
|
|
8343
8406
|
});
|
|
8344
8407
|
return (() => {
|
|
8345
|
-
const _el$ = _tmpl$
|
|
8408
|
+
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8346
8409
|
_el$.style.setProperty("position", "relative");
|
|
8347
8410
|
const _ref$ = videoRef;
|
|
8348
8411
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
@@ -8479,7 +8542,7 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
8479
8542
|
}, {
|
|
8480
8543
|
component: text_default,
|
|
8481
8544
|
...componentInfo11
|
|
8482
|
-
}, ...TARGET
|
|
8545
|
+
}, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
|
|
8483
8546
|
component: personalization_container_default,
|
|
8484
8547
|
...componentInfo6
|
|
8485
8548
|
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
@@ -8516,7 +8579,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
|
|
|
8516
8579
|
|
|
8517
8580
|
// src/components/content-variants/helpers.ts
|
|
8518
8581
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
8519
|
-
var
|
|
8582
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
|
|
8520
8583
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
8521
8584
|
...variant,
|
|
8522
8585
|
testVariationId: variant.id,
|
|
@@ -8541,20 +8604,20 @@ var checkShouldRenderVariants2 = ({
|
|
|
8541
8604
|
};
|
|
8542
8605
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
8543
8606
|
var isAngularSDK = TARGET === "angular";
|
|
8544
|
-
var
|
|
8607
|
+
var isHydrationTarget2 = getIsHydrationTarget(TARGET);
|
|
8545
8608
|
var getInitVariantsFnsScriptString = () => `
|
|
8546
8609
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
8547
|
-
window.${
|
|
8610
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
8548
8611
|
`;
|
|
8549
8612
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
8550
8613
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
8551
|
-
"${contentId}",${JSON.stringify(variants)}, ${
|
|
8614
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
|
|
8552
8615
|
)`;
|
|
8553
8616
|
var getUpdateVariantVisibilityScript = ({
|
|
8554
8617
|
contentId,
|
|
8555
8618
|
variationId
|
|
8556
|
-
}) => `window.${
|
|
8557
|
-
"${variationId}", "${contentId}", ${
|
|
8619
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
|
|
8620
|
+
"${variationId}", "${contentId}", ${isHydrationTarget2}
|
|
8558
8621
|
)`;
|
|
8559
8622
|
|
|
8560
8623
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -8563,7 +8626,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8563
8626
|
}
|
|
8564
8627
|
|
|
8565
8628
|
// src/constants/sdk-version.ts
|
|
8566
|
-
var SDK_VERSION = "4.0.
|
|
8629
|
+
var SDK_VERSION = "4.0.9";
|
|
8567
8630
|
|
|
8568
8631
|
// src/helpers/sdk-headers.ts
|
|
8569
8632
|
var getSdkHeaders = () => ({
|
|
@@ -9986,7 +10049,7 @@ function ContentVariants(props) {
|
|
|
9986
10049
|
return !props.isNestedRender && TARGET !== "reactNative";
|
|
9987
10050
|
},
|
|
9988
10051
|
get children() {
|
|
9989
|
-
return createComponent(inlined_script_default, {
|
|
10052
|
+
return [createComponent(inlined_script_default, {
|
|
9990
10053
|
id: "builderio-init-variants-fns",
|
|
9991
10054
|
get scriptStr() {
|
|
9992
10055
|
return getInitVariantsFnsScriptString();
|
|
@@ -9994,7 +10057,22 @@ function ContentVariants(props) {
|
|
|
9994
10057
|
get nonce() {
|
|
9995
10058
|
return props.nonce || "";
|
|
9996
10059
|
}
|
|
9997
|
-
})
|
|
10060
|
+
}), createComponent(Show, {
|
|
10061
|
+
get when() {
|
|
10062
|
+
return SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET);
|
|
10063
|
+
},
|
|
10064
|
+
get children() {
|
|
10065
|
+
return createComponent(inlined_script_default, {
|
|
10066
|
+
id: "builderio-init-personalization-variants-fns",
|
|
10067
|
+
get nonce() {
|
|
10068
|
+
return props.nonce || "";
|
|
10069
|
+
},
|
|
10070
|
+
get scriptStr() {
|
|
10071
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
10072
|
+
}
|
|
10073
|
+
});
|
|
10074
|
+
}
|
|
10075
|
+
})];
|
|
9998
10076
|
}
|
|
9999
10077
|
}), createComponent(Show, {
|
|
10000
10078
|
get when() {
|
|
@@ -10182,7 +10260,7 @@ var fetchSymbolContent = async ({
|
|
|
10182
10260
|
};
|
|
10183
10261
|
|
|
10184
10262
|
// src/blocks/symbol/symbol.tsx
|
|
10185
|
-
var _tmpl$
|
|
10263
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
10186
10264
|
function Symbol2(props) {
|
|
10187
10265
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
10188
10266
|
const [symbolEntry, setSymbolEntry] = createSignal(props.symbol?.entry);
|
|
@@ -10216,7 +10294,7 @@ function Symbol2(props) {
|
|
|
10216
10294
|
}
|
|
10217
10295
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
10218
10296
|
return (() => {
|
|
10219
|
-
const _el$ = _tmpl$
|
|
10297
|
+
const _el$ = _tmpl$29();
|
|
10220
10298
|
spread(_el$, mergeProps({
|
|
10221
10299
|
get ["class"]() {
|
|
10222
10300
|
return className();
|