@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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic
|
|
1
|
+
import { delegateEvents, createComponent, memo, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic } from 'solid-js/web';
|
|
2
2
|
import { createContext, useContext, Show, For, createMemo, onMount, createSignal, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -4840,7 +4840,7 @@ function Block(props) {
|
|
|
4840
4840
|
});
|
|
4841
4841
|
}
|
|
4842
4842
|
var block_default = Block;
|
|
4843
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
4843
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
|
|
4844
4844
|
display: flex;
|
|
4845
4845
|
flex-direction: column;
|
|
4846
4846
|
align-items: stretch;
|
|
@@ -4889,7 +4889,7 @@ function BlocksWrapper(props) {
|
|
|
4889
4889
|
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
4890
4890
|
return [createComponent(Dynamic, mergeProps({
|
|
4891
4891
|
get ["class"]() {
|
|
4892
|
-
return className() + " dynamic-
|
|
4892
|
+
return className() + " dynamic-450facf4";
|
|
4893
4893
|
},
|
|
4894
4894
|
ref(r$) {
|
|
4895
4895
|
const _ref$ = blocksWrapperRef;
|
|
@@ -4936,17 +4936,17 @@ function Blocks(props) {
|
|
|
4936
4936
|
get styleProp() {
|
|
4937
4937
|
return props.styleProp;
|
|
4938
4938
|
},
|
|
4939
|
+
get BlocksWrapperProps() {
|
|
4940
|
+
return props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
4941
|
+
},
|
|
4939
4942
|
get classNameProp() {
|
|
4940
4943
|
return props.className;
|
|
4941
4944
|
},
|
|
4942
4945
|
get BlocksWrapper() {
|
|
4943
4946
|
return props.context?.BlocksWrapper || builderContext?.BlocksWrapper;
|
|
4944
4947
|
},
|
|
4945
|
-
get BlocksWrapperProps() {
|
|
4946
|
-
return props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps;
|
|
4947
|
-
},
|
|
4948
4948
|
get children() {
|
|
4949
|
-
return createComponent(Show, {
|
|
4949
|
+
return [memo(() => props.children), createComponent(Show, {
|
|
4950
4950
|
get when() {
|
|
4951
4951
|
return props.blocks;
|
|
4952
4952
|
},
|
|
@@ -4975,7 +4975,7 @@ function Blocks(props) {
|
|
|
4975
4975
|
}
|
|
4976
4976
|
});
|
|
4977
4977
|
}
|
|
4978
|
-
});
|
|
4978
|
+
})];
|
|
4979
4979
|
}
|
|
4980
4980
|
});
|
|
4981
4981
|
}
|
|
@@ -5399,6 +5399,166 @@ function SectionComponent(props) {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
var section_default = SectionComponent;
|
|
5401
5401
|
|
|
5402
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
5403
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
5404
|
+
function isString(val) {
|
|
5405
|
+
return typeof val === "string";
|
|
5406
|
+
}
|
|
5407
|
+
function isNumber(val) {
|
|
5408
|
+
return typeof val === "number";
|
|
5409
|
+
}
|
|
5410
|
+
function objectMatchesQuery(userattr, query2) {
|
|
5411
|
+
const result = (() => {
|
|
5412
|
+
const property = query2.property;
|
|
5413
|
+
const operator = query2.operator;
|
|
5414
|
+
let testValue = query2.value;
|
|
5415
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
5416
|
+
testValue = query2.value.slice(0, -1);
|
|
5417
|
+
}
|
|
5418
|
+
if (!(property && operator)) {
|
|
5419
|
+
return true;
|
|
5420
|
+
}
|
|
5421
|
+
if (Array.isArray(testValue)) {
|
|
5422
|
+
if (operator === "isNot") {
|
|
5423
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
5424
|
+
property,
|
|
5425
|
+
operator,
|
|
5426
|
+
value: val
|
|
5427
|
+
}));
|
|
5428
|
+
}
|
|
5429
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
5430
|
+
property,
|
|
5431
|
+
operator,
|
|
5432
|
+
value: val
|
|
5433
|
+
}));
|
|
5434
|
+
}
|
|
5435
|
+
const value = userattr[property];
|
|
5436
|
+
if (Array.isArray(value)) {
|
|
5437
|
+
return value.includes(testValue);
|
|
5438
|
+
}
|
|
5439
|
+
switch (operator) {
|
|
5440
|
+
case "is":
|
|
5441
|
+
return value === testValue;
|
|
5442
|
+
case "isNot":
|
|
5443
|
+
return value !== testValue;
|
|
5444
|
+
case "contains":
|
|
5445
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
5446
|
+
case "startsWith":
|
|
5447
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
5448
|
+
case "endsWith":
|
|
5449
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
5450
|
+
case "greaterThan":
|
|
5451
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
5452
|
+
case "lessThan":
|
|
5453
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
5454
|
+
case "greaterThanOrEqualTo":
|
|
5455
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
5456
|
+
case "lessThanOrEqualTo":
|
|
5457
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
5458
|
+
default:
|
|
5459
|
+
return false;
|
|
5460
|
+
}
|
|
5461
|
+
})();
|
|
5462
|
+
return result;
|
|
5463
|
+
}
|
|
5464
|
+
const item = {
|
|
5465
|
+
query,
|
|
5466
|
+
startDate,
|
|
5467
|
+
endDate
|
|
5468
|
+
};
|
|
5469
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
5470
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
5471
|
+
return false;
|
|
5472
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
5473
|
+
return false;
|
|
5474
|
+
}
|
|
5475
|
+
if (!item.query || !item.query.length) {
|
|
5476
|
+
return true;
|
|
5477
|
+
}
|
|
5478
|
+
return item.query.every((filter) => {
|
|
5479
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
5480
|
+
});
|
|
5481
|
+
}
|
|
5482
|
+
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}";
|
|
5483
|
+
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}";
|
|
5484
|
+
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}";
|
|
5485
|
+
|
|
5486
|
+
// src/blocks/personalization-container/helpers.ts
|
|
5487
|
+
var DEFAULT_INDEX = "default";
|
|
5488
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
|
|
5489
|
+
var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
|
|
5490
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
|
|
5491
|
+
var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
|
|
5492
|
+
var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
|
|
5493
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
5494
|
+
const hasVariants = variants && variants.length > 0;
|
|
5495
|
+
if (TARGET === "reactNative")
|
|
5496
|
+
return false;
|
|
5497
|
+
if (!hasVariants)
|
|
5498
|
+
return false;
|
|
5499
|
+
if (!canTrack)
|
|
5500
|
+
return false;
|
|
5501
|
+
if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
|
|
5502
|
+
return true;
|
|
5503
|
+
if (isBrowser())
|
|
5504
|
+
return false;
|
|
5505
|
+
return true;
|
|
5506
|
+
}
|
|
5507
|
+
function getBlocksToRender({
|
|
5508
|
+
variants,
|
|
5509
|
+
previewingIndex,
|
|
5510
|
+
isHydrated,
|
|
5511
|
+
filteredVariants,
|
|
5512
|
+
fallbackBlocks
|
|
5513
|
+
}) {
|
|
5514
|
+
const fallback = {
|
|
5515
|
+
blocks: fallbackBlocks ?? [],
|
|
5516
|
+
path: "this.children",
|
|
5517
|
+
index: DEFAULT_INDEX
|
|
5518
|
+
};
|
|
5519
|
+
if (isHydrated && isEditing()) {
|
|
5520
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
5521
|
+
const variant = variants?.[previewingIndex];
|
|
5522
|
+
if (variant) {
|
|
5523
|
+
return {
|
|
5524
|
+
blocks: variant.blocks,
|
|
5525
|
+
path: `variants.${previewingIndex}.blocks`,
|
|
5526
|
+
index: previewingIndex
|
|
5527
|
+
};
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
return fallback;
|
|
5531
|
+
}
|
|
5532
|
+
if (isBrowser()) {
|
|
5533
|
+
const winningVariant = filteredVariants?.[0];
|
|
5534
|
+
if (winningVariant && variants) {
|
|
5535
|
+
const variantIndex = variants.indexOf(winningVariant);
|
|
5536
|
+
if (variantIndex !== -1) {
|
|
5537
|
+
return {
|
|
5538
|
+
blocks: winningVariant.blocks,
|
|
5539
|
+
path: `variants.${variantIndex}.blocks`,
|
|
5540
|
+
index: variantIndex
|
|
5541
|
+
};
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
return fallback;
|
|
5546
|
+
}
|
|
5547
|
+
var getInitPersonalizationVariantsFnsScriptString = () => {
|
|
5548
|
+
return `
|
|
5549
|
+
window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
5550
|
+
window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
|
|
5551
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
5552
|
+
`;
|
|
5553
|
+
};
|
|
5554
|
+
var isHydrationTarget = TARGET === "react";
|
|
5555
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
5556
|
+
return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
5557
|
+
};
|
|
5558
|
+
var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
|
|
5559
|
+
return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
|
|
5560
|
+
};
|
|
5561
|
+
|
|
5402
5562
|
// src/helpers/url.ts
|
|
5403
5563
|
var getTopLevelDomain = (host) => {
|
|
5404
5564
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
@@ -6377,7 +6537,8 @@ var componentInfo6 = {
|
|
|
6377
6537
|
name: "PersonalizationContainer",
|
|
6378
6538
|
shouldReceiveBuilderProps: {
|
|
6379
6539
|
builderBlock: true,
|
|
6380
|
-
builderContext: true
|
|
6540
|
+
builderContext: true,
|
|
6541
|
+
builderComponents: true
|
|
6381
6542
|
},
|
|
6382
6543
|
noWrap: true,
|
|
6383
6544
|
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
@@ -6439,208 +6600,22 @@ function isPreviewing(_search) {
|
|
|
6439
6600
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
6440
6601
|
}
|
|
6441
6602
|
|
|
6442
|
-
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
6443
|
-
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
6444
|
-
function isString(val) {
|
|
6445
|
-
return typeof val === "string";
|
|
6446
|
-
}
|
|
6447
|
-
function isNumber(val) {
|
|
6448
|
-
return typeof val === "number";
|
|
6449
|
-
}
|
|
6450
|
-
function objectMatchesQuery(userattr, query2) {
|
|
6451
|
-
const result = (() => {
|
|
6452
|
-
const property = query2.property;
|
|
6453
|
-
const operator = query2.operator;
|
|
6454
|
-
let testValue = query2.value;
|
|
6455
|
-
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
6456
|
-
testValue = query2.value.slice(0, -1);
|
|
6457
|
-
}
|
|
6458
|
-
if (!(property && operator)) {
|
|
6459
|
-
return true;
|
|
6460
|
-
}
|
|
6461
|
-
if (Array.isArray(testValue)) {
|
|
6462
|
-
if (operator === "isNot") {
|
|
6463
|
-
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
6464
|
-
property,
|
|
6465
|
-
operator,
|
|
6466
|
-
value: val
|
|
6467
|
-
}));
|
|
6468
|
-
}
|
|
6469
|
-
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
6470
|
-
property,
|
|
6471
|
-
operator,
|
|
6472
|
-
value: val
|
|
6473
|
-
}));
|
|
6474
|
-
}
|
|
6475
|
-
const value = userattr[property];
|
|
6476
|
-
if (Array.isArray(value)) {
|
|
6477
|
-
return value.includes(testValue);
|
|
6478
|
-
}
|
|
6479
|
-
switch (operator) {
|
|
6480
|
-
case "is":
|
|
6481
|
-
return value === testValue;
|
|
6482
|
-
case "isNot":
|
|
6483
|
-
return value !== testValue;
|
|
6484
|
-
case "contains":
|
|
6485
|
-
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
6486
|
-
case "startsWith":
|
|
6487
|
-
return isString(value) && value.startsWith(String(testValue));
|
|
6488
|
-
case "endsWith":
|
|
6489
|
-
return isString(value) && value.endsWith(String(testValue));
|
|
6490
|
-
case "greaterThan":
|
|
6491
|
-
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
6492
|
-
case "lessThan":
|
|
6493
|
-
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
6494
|
-
case "greaterThanOrEqualTo":
|
|
6495
|
-
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
6496
|
-
case "lessThanOrEqualTo":
|
|
6497
|
-
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
6498
|
-
default:
|
|
6499
|
-
return false;
|
|
6500
|
-
}
|
|
6501
|
-
})();
|
|
6502
|
-
return result;
|
|
6503
|
-
}
|
|
6504
|
-
const item = {
|
|
6505
|
-
query,
|
|
6506
|
-
startDate,
|
|
6507
|
-
endDate
|
|
6508
|
-
};
|
|
6509
|
-
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
6510
|
-
if (item.startDate && new Date(item.startDate) > now) {
|
|
6511
|
-
return false;
|
|
6512
|
-
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
6513
|
-
return false;
|
|
6514
|
-
}
|
|
6515
|
-
if (!item.query || !item.query.length) {
|
|
6516
|
-
return true;
|
|
6517
|
-
}
|
|
6518
|
-
return item.query.every((filter) => {
|
|
6519
|
-
return objectMatchesQuery(userAttributes, filter);
|
|
6520
|
-
});
|
|
6521
|
-
}
|
|
6522
|
-
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
6523
|
-
if (!navigator.cookieEnabled) {
|
|
6524
|
-
return;
|
|
6525
|
-
}
|
|
6526
|
-
function getCookie(name) {
|
|
6527
|
-
const nameEQ = name + '=';
|
|
6528
|
-
const ca = document.cookie.split(';');
|
|
6529
|
-
for (let i = 0; i < ca.length; i++) {
|
|
6530
|
-
let c = ca[i];
|
|
6531
|
-
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
6532
|
-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
6533
|
-
}
|
|
6534
|
-
return null;
|
|
6535
|
-
}
|
|
6536
|
-
function removeVariants() {
|
|
6537
|
-
variants?.forEach(function (_, index) {
|
|
6538
|
-
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
6539
|
-
});
|
|
6540
|
-
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
6541
|
-
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
6542
|
-
}
|
|
6543
|
-
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
6544
|
-
if (locale) {
|
|
6545
|
-
attributes.locale = locale;
|
|
6546
|
-
}
|
|
6547
|
-
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
6548
|
-
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
6549
|
-
});
|
|
6550
|
-
const isDebug = location.href.includes('builder.debug=true');
|
|
6551
|
-
if (isDebug) {
|
|
6552
|
-
console.debug('PersonalizationContainer', {
|
|
6553
|
-
attributes,
|
|
6554
|
-
variants,
|
|
6555
|
-
winningVariantIndex
|
|
6556
|
-
});
|
|
6557
|
-
}
|
|
6558
|
-
if (winningVariantIndex !== -1) {
|
|
6559
|
-
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
6560
|
-
if (winningVariant) {
|
|
6561
|
-
const parentNode = winningVariant.parentNode;
|
|
6562
|
-
if (parentNode) {
|
|
6563
|
-
const newParent = parentNode.cloneNode(false);
|
|
6564
|
-
newParent.appendChild(winningVariant.content.firstChild);
|
|
6565
|
-
newParent.appendChild(winningVariant.content.lastChild);
|
|
6566
|
-
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
6567
|
-
}
|
|
6568
|
-
if (isDebug) {
|
|
6569
|
-
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
6570
|
-
}
|
|
6571
|
-
}
|
|
6572
|
-
} else if (variants && variants.length > 0) {
|
|
6573
|
-
removeVariants();
|
|
6574
|
-
}
|
|
6575
|
-
}`;
|
|
6576
|
-
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}";
|
|
6577
|
-
|
|
6578
|
-
// src/blocks/personalization-container/helpers.ts
|
|
6579
|
-
function checkShouldRenderVariants(variants, canTrack) {
|
|
6580
|
-
const hasVariants = variants && variants.length > 0;
|
|
6581
|
-
if (TARGET === "reactNative")
|
|
6582
|
-
return false;
|
|
6583
|
-
if (!hasVariants)
|
|
6584
|
-
return false;
|
|
6585
|
-
if (!canTrack)
|
|
6586
|
-
return false;
|
|
6587
|
-
if (TARGET === "vue" || TARGET === "svelte")
|
|
6588
|
-
return true;
|
|
6589
|
-
if (isBrowser())
|
|
6590
|
-
return false;
|
|
6591
|
-
return true;
|
|
6592
|
-
}
|
|
6593
|
-
function getBlocksToRender({
|
|
6594
|
-
variants,
|
|
6595
|
-
previewingIndex,
|
|
6596
|
-
isHydrated,
|
|
6597
|
-
filteredVariants,
|
|
6598
|
-
fallbackBlocks
|
|
6599
|
-
}) {
|
|
6600
|
-
const fallback = {
|
|
6601
|
-
blocks: fallbackBlocks ?? [],
|
|
6602
|
-
path: "this.children"
|
|
6603
|
-
};
|
|
6604
|
-
if (isHydrated && isEditing()) {
|
|
6605
|
-
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
6606
|
-
const variant = variants[previewingIndex];
|
|
6607
|
-
return {
|
|
6608
|
-
blocks: variant.blocks,
|
|
6609
|
-
path: `component.options.variants.${previewingIndex}.blocks`
|
|
6610
|
-
};
|
|
6611
|
-
}
|
|
6612
|
-
return fallback;
|
|
6613
|
-
}
|
|
6614
|
-
if (isBrowser()) {
|
|
6615
|
-
const winningVariant = filteredVariants?.[0];
|
|
6616
|
-
if (winningVariant) {
|
|
6617
|
-
return {
|
|
6618
|
-
blocks: winningVariant.blocks,
|
|
6619
|
-
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
6620
|
-
};
|
|
6621
|
-
}
|
|
6622
|
-
}
|
|
6623
|
-
return fallback;
|
|
6624
|
-
}
|
|
6625
|
-
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
6626
|
-
return `
|
|
6627
|
-
(function() {
|
|
6628
|
-
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
6629
|
-
${PERSONALIZATION_SCRIPT}
|
|
6630
|
-
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
6631
|
-
})();
|
|
6632
|
-
`;
|
|
6633
|
-
};
|
|
6634
|
-
|
|
6635
6603
|
// src/blocks/personalization-container/personalization-container.tsx
|
|
6636
6604
|
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
6637
|
-
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
6638
6605
|
function PersonalizationContainer(props) {
|
|
6639
6606
|
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
6640
6607
|
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
6608
|
+
const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal(getUpdateVisibilityStylesScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
6641
6609
|
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
6642
6610
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
6643
|
-
const [
|
|
6611
|
+
const [shouldResetVariants, setShouldResetVariants] = createSignal(false);
|
|
6612
|
+
const attrs = createMemo(() => {
|
|
6613
|
+
return {
|
|
6614
|
+
...props.attributes,
|
|
6615
|
+
...{},
|
|
6616
|
+
[getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
|
|
6617
|
+
};
|
|
6618
|
+
});
|
|
6644
6619
|
const filteredVariants = createMemo(() => {
|
|
6645
6620
|
return (props.variants || []).filter((variant) => {
|
|
6646
6621
|
return filterWithCustomTargeting({
|
|
@@ -6655,26 +6630,26 @@ function PersonalizationContainer(props) {
|
|
|
6655
6630
|
return getBlocksToRender({
|
|
6656
6631
|
variants: props.variants,
|
|
6657
6632
|
fallbackBlocks: props.builderBlock?.children,
|
|
6658
|
-
isHydrated:
|
|
6633
|
+
isHydrated: shouldResetVariants(),
|
|
6659
6634
|
filteredVariants: filteredVariants(),
|
|
6660
6635
|
previewingIndex: props.previewingIndex
|
|
6661
6636
|
});
|
|
6662
6637
|
});
|
|
6663
6638
|
const hideVariantsStyleString = createMemo(() => {
|
|
6664
|
-
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
6639
|
+
return (props.variants || []).map((_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `).join("");
|
|
6665
6640
|
});
|
|
6666
6641
|
let rootRef;
|
|
6667
6642
|
onMount(() => {
|
|
6668
|
-
|
|
6669
|
-
const unsub = userAttributesService.subscribeOnUserAttributesChange((
|
|
6670
|
-
setUserAttributes(
|
|
6643
|
+
setShouldResetVariants(true);
|
|
6644
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs2) => {
|
|
6645
|
+
setUserAttributes(attrs2);
|
|
6671
6646
|
});
|
|
6672
6647
|
if (!(isEditing() || isPreviewing())) {
|
|
6673
6648
|
const variant = filteredVariants()[0];
|
|
6674
6649
|
if (rootRef) {
|
|
6675
6650
|
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
6676
6651
|
detail: {
|
|
6677
|
-
variant: variant ||
|
|
6652
|
+
variant: variant || DEFAULT_INDEX,
|
|
6678
6653
|
content: props.builderContext?.content
|
|
6679
6654
|
},
|
|
6680
6655
|
bubbles: true
|
|
@@ -6684,7 +6659,7 @@ function PersonalizationContainer(props) {
|
|
|
6684
6659
|
if (entry.isIntersecting && rootRef) {
|
|
6685
6660
|
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
6686
6661
|
detail: {
|
|
6687
|
-
variant: variant ||
|
|
6662
|
+
variant: variant || DEFAULT_INDEX,
|
|
6688
6663
|
content: props.builderContext?.content
|
|
6689
6664
|
},
|
|
6690
6665
|
bubbles: true
|
|
@@ -6701,70 +6676,158 @@ function PersonalizationContainer(props) {
|
|
|
6701
6676
|
const _el$ = _tmpl$9();
|
|
6702
6677
|
const _ref$ = rootRef;
|
|
6703
6678
|
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
6704
|
-
spread(_el$, mergeProps(
|
|
6705
|
-
get ["class"]() {
|
|
6706
|
-
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
6707
|
-
}
|
|
6708
|
-
}, () => props.attributes), false, true);
|
|
6679
|
+
spread(_el$, mergeProps(attrs), false, true);
|
|
6709
6680
|
insert(_el$, createComponent(Show, {
|
|
6710
6681
|
get when() {
|
|
6711
|
-
return
|
|
6682
|
+
return memo(() => !!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
6712
6683
|
},
|
|
6713
6684
|
get children() {
|
|
6714
|
-
return
|
|
6715
|
-
get
|
|
6716
|
-
return
|
|
6685
|
+
return createComponent(blocks_default, {
|
|
6686
|
+
get blocks() {
|
|
6687
|
+
return blocksToRender().blocks;
|
|
6717
6688
|
},
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
return (() => {
|
|
6721
|
-
const _el$2 = _tmpl$25();
|
|
6722
|
-
setAttribute(_el$2, "key", index);
|
|
6723
|
-
insert(_el$2, createComponent(blocks_default, {
|
|
6724
|
-
get blocks() {
|
|
6725
|
-
return variant.blocks;
|
|
6726
|
-
},
|
|
6727
|
-
get parent() {
|
|
6728
|
-
return props.builderBlock?.id;
|
|
6729
|
-
},
|
|
6730
|
-
path: `component.options.variants.${index}.blocks`
|
|
6731
|
-
}));
|
|
6732
|
-
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
6733
|
-
return _el$2;
|
|
6734
|
-
})();
|
|
6735
|
-
}
|
|
6736
|
-
}), createComponent(inlined_styles_default, {
|
|
6737
|
-
get nonce() {
|
|
6738
|
-
return props.builderContext?.nonce || "";
|
|
6689
|
+
get parent() {
|
|
6690
|
+
return props.builderBlock?.id;
|
|
6739
6691
|
},
|
|
6740
|
-
get
|
|
6741
|
-
return
|
|
6692
|
+
get path() {
|
|
6693
|
+
return blocksToRender().path;
|
|
6742
6694
|
},
|
|
6743
|
-
get
|
|
6744
|
-
return
|
|
6745
|
-
}
|
|
6746
|
-
}), createComponent(inlined_script_default, {
|
|
6747
|
-
get nonce() {
|
|
6748
|
-
return props.builderContext?.nonce || "";
|
|
6695
|
+
get context() {
|
|
6696
|
+
return props.builderContext;
|
|
6749
6697
|
},
|
|
6750
|
-
get
|
|
6751
|
-
return
|
|
6698
|
+
get registeredComponents() {
|
|
6699
|
+
return props.builderComponents;
|
|
6752
6700
|
},
|
|
6753
|
-
get
|
|
6754
|
-
return
|
|
6701
|
+
get BlocksWrapperProps() {
|
|
6702
|
+
return {
|
|
6703
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6704
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
6705
|
+
};
|
|
6755
6706
|
}
|
|
6756
|
-
})
|
|
6707
|
+
});
|
|
6757
6708
|
}
|
|
6758
6709
|
}), null);
|
|
6759
|
-
insert(_el$, createComponent(
|
|
6760
|
-
get
|
|
6761
|
-
return
|
|
6762
|
-
},
|
|
6763
|
-
get parent() {
|
|
6764
|
-
return props.builderBlock?.id;
|
|
6710
|
+
insert(_el$, createComponent(Show, {
|
|
6711
|
+
get when() {
|
|
6712
|
+
return memo(() => !!!shouldResetVariants())() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET);
|
|
6765
6713
|
},
|
|
6766
|
-
get
|
|
6767
|
-
return
|
|
6714
|
+
get children() {
|
|
6715
|
+
return [createComponent(Show, {
|
|
6716
|
+
get when() {
|
|
6717
|
+
return shouldRenderVariants();
|
|
6718
|
+
},
|
|
6719
|
+
get children() {
|
|
6720
|
+
return [createComponent(inlined_styles_default, {
|
|
6721
|
+
get nonce() {
|
|
6722
|
+
return props.builderContext?.nonce || "";
|
|
6723
|
+
},
|
|
6724
|
+
get styles() {
|
|
6725
|
+
return hideVariantsStyleString();
|
|
6726
|
+
},
|
|
6727
|
+
get id() {
|
|
6728
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
6729
|
+
}
|
|
6730
|
+
}), createComponent(inlined_script_default, {
|
|
6731
|
+
get nonce() {
|
|
6732
|
+
return props.builderContext?.nonce || "";
|
|
6733
|
+
},
|
|
6734
|
+
get scriptStr() {
|
|
6735
|
+
return updateVisibilityStylesScript();
|
|
6736
|
+
},
|
|
6737
|
+
get id() {
|
|
6738
|
+
return `variants-visibility-script-${props.builderBlock?.id}`;
|
|
6739
|
+
}
|
|
6740
|
+
}), createComponent(For, {
|
|
6741
|
+
get each() {
|
|
6742
|
+
return props.variants;
|
|
6743
|
+
},
|
|
6744
|
+
children: (variant, _index) => {
|
|
6745
|
+
const index = _index();
|
|
6746
|
+
return createComponent(blocks_default, {
|
|
6747
|
+
get key() {
|
|
6748
|
+
return `${props.builderBlock?.id}-${index}`;
|
|
6749
|
+
},
|
|
6750
|
+
get BlocksWrapperProps() {
|
|
6751
|
+
return {
|
|
6752
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6753
|
+
"aria-hidden": true,
|
|
6754
|
+
hidden: true,
|
|
6755
|
+
"data-variant-id": `${props.builderBlock?.id}-${index}`
|
|
6756
|
+
};
|
|
6757
|
+
},
|
|
6758
|
+
get blocks() {
|
|
6759
|
+
return variant.blocks;
|
|
6760
|
+
},
|
|
6761
|
+
get parent() {
|
|
6762
|
+
return props.builderBlock?.id;
|
|
6763
|
+
},
|
|
6764
|
+
path: `component.options.variants.${index}.blocks`,
|
|
6765
|
+
get context() {
|
|
6766
|
+
return props.builderContext;
|
|
6767
|
+
},
|
|
6768
|
+
get registeredComponents() {
|
|
6769
|
+
return props.builderComponents;
|
|
6770
|
+
},
|
|
6771
|
+
get children() {
|
|
6772
|
+
return createComponent(inlined_script_default, {
|
|
6773
|
+
get nonce() {
|
|
6774
|
+
return props.builderContext?.nonce || "";
|
|
6775
|
+
},
|
|
6776
|
+
get scriptStr() {
|
|
6777
|
+
return scriptStr();
|
|
6778
|
+
},
|
|
6779
|
+
get id() {
|
|
6780
|
+
return `variants-script-${props.builderBlock?.id}-${index}`;
|
|
6781
|
+
}
|
|
6782
|
+
});
|
|
6783
|
+
}
|
|
6784
|
+
});
|
|
6785
|
+
}
|
|
6786
|
+
})];
|
|
6787
|
+
}
|
|
6788
|
+
}), createComponent(blocks_default, {
|
|
6789
|
+
get blocks() {
|
|
6790
|
+
return blocksToRender().blocks;
|
|
6791
|
+
},
|
|
6792
|
+
get parent() {
|
|
6793
|
+
return props.builderBlock?.id;
|
|
6794
|
+
},
|
|
6795
|
+
get path() {
|
|
6796
|
+
return blocksToRender().path;
|
|
6797
|
+
},
|
|
6798
|
+
get context() {
|
|
6799
|
+
return props.builderContext;
|
|
6800
|
+
},
|
|
6801
|
+
get registeredComponents() {
|
|
6802
|
+
return props.builderComponents;
|
|
6803
|
+
},
|
|
6804
|
+
get BlocksWrapperProps() {
|
|
6805
|
+
return {
|
|
6806
|
+
...props.builderContext?.BlocksWrapperProps,
|
|
6807
|
+
"data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
|
|
6808
|
+
};
|
|
6809
|
+
},
|
|
6810
|
+
get children() {
|
|
6811
|
+
return createComponent(Show, {
|
|
6812
|
+
get when() {
|
|
6813
|
+
return shouldRenderVariants();
|
|
6814
|
+
},
|
|
6815
|
+
get children() {
|
|
6816
|
+
return createComponent(inlined_script_default, {
|
|
6817
|
+
get nonce() {
|
|
6818
|
+
return props.builderContext?.nonce || "";
|
|
6819
|
+
},
|
|
6820
|
+
get scriptStr() {
|
|
6821
|
+
return scriptStr();
|
|
6822
|
+
},
|
|
6823
|
+
get id() {
|
|
6824
|
+
return `variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`;
|
|
6825
|
+
}
|
|
6826
|
+
});
|
|
6827
|
+
}
|
|
6828
|
+
});
|
|
6829
|
+
}
|
|
6830
|
+
})];
|
|
6768
6831
|
}
|
|
6769
6832
|
}), null);
|
|
6770
6833
|
return _el$;
|
|
@@ -7051,7 +7114,7 @@ var componentInfo10 = {
|
|
|
7051
7114
|
}
|
|
7052
7115
|
};
|
|
7053
7116
|
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
7054
|
-
var _tmpl$
|
|
7117
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
7055
7118
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
7056
7119
|
function Tabs(props) {
|
|
7057
7120
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -7066,7 +7129,7 @@ function Tabs(props) {
|
|
|
7066
7129
|
}
|
|
7067
7130
|
}
|
|
7068
7131
|
return (() => {
|
|
7069
|
-
const _el$ = _tmpl$
|
|
7132
|
+
const _el$ = _tmpl$25(), _el$2 = _el$.firstChild;
|
|
7070
7133
|
_el$2.style.setProperty("display", "flex");
|
|
7071
7134
|
_el$2.style.setProperty("flex-direction", "row");
|
|
7072
7135
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -7598,7 +7661,7 @@ function logFetch(url) {
|
|
|
7598
7661
|
|
|
7599
7662
|
// src/blocks/form/form/form.tsx
|
|
7600
7663
|
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
7601
|
-
var _tmpl$
|
|
7664
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
7602
7665
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
7603
7666
|
padding: 10px;
|
|
7604
7667
|
color: red;
|
|
@@ -7791,7 +7854,7 @@ function FormComponent(props) {
|
|
|
7791
7854
|
}
|
|
7792
7855
|
let formRef;
|
|
7793
7856
|
return [(() => {
|
|
7794
|
-
const _el$ = _tmpl$
|
|
7857
|
+
const _el$ = _tmpl$26();
|
|
7795
7858
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
7796
7859
|
const _ref$ = formRef;
|
|
7797
7860
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -8003,7 +8066,7 @@ var componentInfo16 = {
|
|
|
8003
8066
|
noWrap: true
|
|
8004
8067
|
};
|
|
8005
8068
|
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
8006
|
-
var _tmpl$
|
|
8069
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<option>`);
|
|
8007
8070
|
function SelectComponent(props) {
|
|
8008
8071
|
return (() => {
|
|
8009
8072
|
const _el$ = _tmpl$17();
|
|
@@ -8031,7 +8094,7 @@ function SelectComponent(props) {
|
|
|
8031
8094
|
children: (option, _index) => {
|
|
8032
8095
|
const index = _index();
|
|
8033
8096
|
return (() => {
|
|
8034
|
-
const _el$2 = _tmpl$
|
|
8097
|
+
const _el$2 = _tmpl$27();
|
|
8035
8098
|
insert(_el$2, () => option.name || option.value);
|
|
8036
8099
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
8037
8100
|
effect(() => _el$2.value = option.value);
|
|
@@ -8275,7 +8338,7 @@ var componentInfo20 = {
|
|
|
8275
8338
|
}
|
|
8276
8339
|
};
|
|
8277
8340
|
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
8278
|
-
var _tmpl$
|
|
8341
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
8279
8342
|
function Video(props) {
|
|
8280
8343
|
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8281
8344
|
const videoProps = createMemo(() => {
|
|
@@ -8330,7 +8393,7 @@ function Video(props) {
|
|
|
8330
8393
|
}
|
|
8331
8394
|
});
|
|
8332
8395
|
return (() => {
|
|
8333
|
-
const _el$ = _tmpl$
|
|
8396
|
+
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8334
8397
|
_el$.style.setProperty("position", "relative");
|
|
8335
8398
|
const _ref$ = videoRef;
|
|
8336
8399
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
@@ -8467,7 +8530,7 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
8467
8530
|
}, {
|
|
8468
8531
|
component: text_default,
|
|
8469
8532
|
...componentInfo11
|
|
8470
|
-
}, ...TARGET
|
|
8533
|
+
}, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
|
|
8471
8534
|
component: personalization_container_default,
|
|
8472
8535
|
...componentInfo6
|
|
8473
8536
|
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
@@ -8504,7 +8567,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
|
|
|
8504
8567
|
|
|
8505
8568
|
// src/components/content-variants/helpers.ts
|
|
8506
8569
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
8507
|
-
var
|
|
8570
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
|
|
8508
8571
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
8509
8572
|
...variant,
|
|
8510
8573
|
testVariationId: variant.id,
|
|
@@ -8529,20 +8592,20 @@ var checkShouldRenderVariants2 = ({
|
|
|
8529
8592
|
};
|
|
8530
8593
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
8531
8594
|
var isAngularSDK = TARGET === "angular";
|
|
8532
|
-
var
|
|
8595
|
+
var isHydrationTarget2 = getIsHydrationTarget(TARGET);
|
|
8533
8596
|
var getInitVariantsFnsScriptString = () => `
|
|
8534
8597
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
8535
|
-
window.${
|
|
8598
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
8536
8599
|
`;
|
|
8537
8600
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
8538
8601
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
8539
|
-
"${contentId}",${JSON.stringify(variants)}, ${
|
|
8602
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
|
|
8540
8603
|
)`;
|
|
8541
8604
|
var getUpdateVariantVisibilityScript = ({
|
|
8542
8605
|
contentId,
|
|
8543
8606
|
variationId
|
|
8544
|
-
}) => `window.${
|
|
8545
|
-
"${variationId}", "${contentId}", ${
|
|
8607
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
|
|
8608
|
+
"${variationId}", "${contentId}", ${isHydrationTarget2}
|
|
8546
8609
|
)`;
|
|
8547
8610
|
|
|
8548
8611
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -8551,7 +8614,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8551
8614
|
}
|
|
8552
8615
|
|
|
8553
8616
|
// src/constants/sdk-version.ts
|
|
8554
|
-
var SDK_VERSION = "4.0.
|
|
8617
|
+
var SDK_VERSION = "4.0.9";
|
|
8555
8618
|
|
|
8556
8619
|
// src/helpers/sdk-headers.ts
|
|
8557
8620
|
var getSdkHeaders = () => ({
|
|
@@ -9967,7 +10030,7 @@ function ContentVariants(props) {
|
|
|
9967
10030
|
return !props.isNestedRender && TARGET !== "reactNative";
|
|
9968
10031
|
},
|
|
9969
10032
|
get children() {
|
|
9970
|
-
return createComponent(inlined_script_default, {
|
|
10033
|
+
return [createComponent(inlined_script_default, {
|
|
9971
10034
|
id: "builderio-init-variants-fns",
|
|
9972
10035
|
get scriptStr() {
|
|
9973
10036
|
return getInitVariantsFnsScriptString();
|
|
@@ -9975,7 +10038,22 @@ function ContentVariants(props) {
|
|
|
9975
10038
|
get nonce() {
|
|
9976
10039
|
return props.nonce || "";
|
|
9977
10040
|
}
|
|
9978
|
-
})
|
|
10041
|
+
}), createComponent(Show, {
|
|
10042
|
+
get when() {
|
|
10043
|
+
return SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET);
|
|
10044
|
+
},
|
|
10045
|
+
get children() {
|
|
10046
|
+
return createComponent(inlined_script_default, {
|
|
10047
|
+
id: "builderio-init-personalization-variants-fns",
|
|
10048
|
+
get nonce() {
|
|
10049
|
+
return props.nonce || "";
|
|
10050
|
+
},
|
|
10051
|
+
get scriptStr() {
|
|
10052
|
+
return getInitPersonalizationVariantsFnsScriptString();
|
|
10053
|
+
}
|
|
10054
|
+
});
|
|
10055
|
+
}
|
|
10056
|
+
})];
|
|
9979
10057
|
}
|
|
9980
10058
|
}), createComponent(Show, {
|
|
9981
10059
|
get when() {
|
|
@@ -10163,7 +10241,7 @@ var fetchSymbolContent = async ({
|
|
|
10163
10241
|
};
|
|
10164
10242
|
|
|
10165
10243
|
// src/blocks/symbol/symbol.tsx
|
|
10166
|
-
var _tmpl$
|
|
10244
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
10167
10245
|
function Symbol2(props) {
|
|
10168
10246
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
10169
10247
|
const [symbolEntry, setSymbolEntry] = createSignal(props.symbol?.entry);
|
|
@@ -10197,7 +10275,7 @@ function Symbol2(props) {
|
|
|
10197
10275
|
}
|
|
10198
10276
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
10199
10277
|
return (() => {
|
|
10200
|
-
const _el$ = _tmpl$
|
|
10278
|
+
const _el$ = _tmpl$29();
|
|
10201
10279
|
spread(_el$, mergeProps({
|
|
10202
10280
|
get ["class"]() {
|
|
10203
10281
|
return className();
|