@builder.io/sdk-solid 4.0.7 → 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.
@@ -1202,15 +1202,15 @@ var Block_wrapper_default = BlockWrapper;
1202
1202
  import {
1203
1203
  Show as Show4,
1204
1204
  For,
1205
- on,
1206
- createEffect,
1205
+ on as on2,
1206
+ createEffect as createEffect2,
1207
1207
  createMemo as createMemo3,
1208
1208
  createSignal as createSignal3
1209
1209
  } from "solid-js";
1210
1210
  import { Dynamic as Dynamic3 } from "solid-js/web";
1211
1211
 
1212
1212
  // src/components/block/components/interactive-element.tsx
1213
- import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1213
+ import { Show as Show3, on, createEffect, createMemo as createMemo2, createSignal as createSignal2 } from "solid-js";
1214
1214
  import { Dynamic as Dynamic2 } from "solid-js/web";
1215
1215
 
1216
1216
  // src/components/awaiter.tsx
@@ -1224,6 +1224,7 @@ var Awaiter_default = Awaiter;
1224
1224
 
1225
1225
  // src/components/block/components/interactive-element.tsx
1226
1226
  function InteractiveElement(props) {
1227
+ const [forceRenderCount, setForceRenderCount] = createSignal2(0);
1227
1228
  const attributes = createMemo2(() => {
1228
1229
  return props.includeBlockProps ? {
1229
1230
  ...getBlockProperties({
@@ -1242,6 +1243,21 @@ function InteractiveElement(props) {
1242
1243
  const targetWrapperProps = createMemo2(() => {
1243
1244
  return props.wrapperProps;
1244
1245
  });
1246
+ const onUpdateFn_0_props_wrapperProps = createMemo2(() => props.wrapperProps);
1247
+ const onUpdateFn_0_props_block__component__options = createMemo2(
1248
+ () => props.block?.component?.options
1249
+ );
1250
+ function onUpdateFn_0() {
1251
+ }
1252
+ createEffect(
1253
+ on(
1254
+ () => [
1255
+ onUpdateFn_0_props_wrapperProps(),
1256
+ onUpdateFn_0_props_block__component__options()
1257
+ ],
1258
+ onUpdateFn_0
1259
+ )
1260
+ );
1245
1261
  return <><Show3
1246
1262
  fallback={<Dynamic2
1247
1263
  {...targetWrapperProps()}
@@ -1305,8 +1321,8 @@ function ComponentRef(props) {
1305
1321
  );
1306
1322
  function onUpdateFn_0() {
1307
1323
  }
1308
- createEffect(
1309
- on(
1324
+ createEffect2(
1325
+ on2(
1310
1326
  () => [
1311
1327
  onUpdateFn_0_props_componentOptions(),
1312
1328
  onUpdateFn_0_props_blockChildren()
@@ -1340,7 +1356,7 @@ function ComponentRef(props) {
1340
1356
  var Component_ref_default = ComponentRef;
1341
1357
 
1342
1358
  // src/components/block/components/repeated-block.tsx
1343
- import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1359
+ import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1344
1360
  function RepeatedBlock(props) {
1345
1361
  const [store, setStore] = createSignal4(props.repeatContext);
1346
1362
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1349,7 +1365,7 @@ function RepeatedBlock(props) {
1349
1365
  function onUpdateFn_0() {
1350
1366
  setStore(props.repeatContext);
1351
1367
  }
1352
- createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1368
+ createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1353
1369
  return <><builder_context_default.Provider value={store()}><Block_default
1354
1370
  block={props.block}
1355
1371
  context={store()}
@@ -1518,7 +1534,7 @@ function Block(props) {
1518
1534
  var Block_default = Block;
1519
1535
 
1520
1536
  // src/components/blocks/blocks-wrapper.tsx
1521
- import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1537
+ import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1522
1538
  import { Dynamic as Dynamic4 } from "solid-js/web";
1523
1539
  function BlocksWrapper(props) {
1524
1540
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1571,10 +1587,10 @@ function BlocksWrapper(props) {
1571
1587
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1572
1588
  function onUpdateFn_0() {
1573
1589
  }
1574
- createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1590
+ createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1575
1591
  return <>
1576
1592
  <Dynamic4
1577
- class={className() + " dynamic-023c60f2"}
1593
+ class={className() + " dynamic-450facf4"}
1578
1594
  ref={blocksWrapperRef}
1579
1595
  builder-path={dataPath()}
1580
1596
  builder-parent-id={props.parent}
@@ -1586,7 +1602,7 @@ function BlocksWrapper(props) {
1586
1602
  {...props.BlocksWrapperProps}
1587
1603
  component={props.BlocksWrapper}
1588
1604
  >{props.children}</Dynamic4>
1589
- <style>{`.dynamic-023c60f2 {
1605
+ <style>{`.dynamic-450facf4 {
1590
1606
  display: flex;
1591
1607
  flex-direction: column;
1592
1608
  align-items: stretch;
@@ -1604,19 +1620,22 @@ function Blocks(props) {
1604
1620
  parent={props.parent}
1605
1621
  path={props.path}
1606
1622
  styleProp={props.styleProp}
1623
+ BlocksWrapperProps={props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
1607
1624
  classNameProp={props.className}
1608
1625
  BlocksWrapper={props.context?.BlocksWrapper || builderContext?.BlocksWrapper}
1609
- BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
1610
- ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1611
- const index = _index();
1612
- return <Block_default
1613
- key={block.id}
1614
- block={block}
1615
- linkComponent={props.linkComponent}
1616
- context={props.context || builderContext}
1617
- registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
1618
- />;
1619
- }}</For3></Show6></Blocks_wrapper_default></>;
1626
+ >
1627
+ {props.children}
1628
+ <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1629
+ const index = _index();
1630
+ return <Block_default
1631
+ key={block.id}
1632
+ block={block}
1633
+ linkComponent={props.linkComponent}
1634
+ context={props.context || builderContext}
1635
+ registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
1636
+ />;
1637
+ }}</For3></Show6>
1638
+ </Blocks_wrapper_default></>;
1620
1639
  }
1621
1640
  var Blocks_default = Blocks;
1622
1641
 
@@ -1963,11 +1982,171 @@ function SectionComponent(props) {
1963
1982
  var section_default = SectionComponent;
1964
1983
 
1965
1984
  // src/blocks/symbol/symbol.tsx
1966
- import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1985
+ import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1967
1986
 
1968
1987
  // src/components/content-variants/content-variants.tsx
1969
1988
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1970
1989
 
1990
+ // src/blocks/personalization-container/helpers/inlined-fns.ts
1991
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
1992
+ function isString(val) {
1993
+ return typeof val === "string";
1994
+ }
1995
+ function isNumber(val) {
1996
+ return typeof val === "number";
1997
+ }
1998
+ function objectMatchesQuery(userattr, query2) {
1999
+ const result = (() => {
2000
+ const property = query2.property;
2001
+ const operator = query2.operator;
2002
+ let testValue = query2.value;
2003
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
2004
+ testValue = query2.value.slice(0, -1);
2005
+ }
2006
+ if (!(property && operator)) {
2007
+ return true;
2008
+ }
2009
+ if (Array.isArray(testValue)) {
2010
+ if (operator === "isNot") {
2011
+ return testValue.every((val) => objectMatchesQuery(userattr, {
2012
+ property,
2013
+ operator,
2014
+ value: val
2015
+ }));
2016
+ }
2017
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
2018
+ property,
2019
+ operator,
2020
+ value: val
2021
+ }));
2022
+ }
2023
+ const value = userattr[property];
2024
+ if (Array.isArray(value)) {
2025
+ return value.includes(testValue);
2026
+ }
2027
+ switch (operator) {
2028
+ case "is":
2029
+ return value === testValue;
2030
+ case "isNot":
2031
+ return value !== testValue;
2032
+ case "contains":
2033
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
2034
+ case "startsWith":
2035
+ return isString(value) && value.startsWith(String(testValue));
2036
+ case "endsWith":
2037
+ return isString(value) && value.endsWith(String(testValue));
2038
+ case "greaterThan":
2039
+ return isNumber(value) && isNumber(testValue) && value > testValue;
2040
+ case "lessThan":
2041
+ return isNumber(value) && isNumber(testValue) && value < testValue;
2042
+ case "greaterThanOrEqualTo":
2043
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
2044
+ case "lessThanOrEqualTo":
2045
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
2046
+ default:
2047
+ return false;
2048
+ }
2049
+ })();
2050
+ return result;
2051
+ }
2052
+ const item = {
2053
+ query,
2054
+ startDate,
2055
+ endDate
2056
+ };
2057
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
2058
+ if (item.startDate && new Date(item.startDate) > now) {
2059
+ return false;
2060
+ } else if (item.endDate && new Date(item.endDate) < now) {
2061
+ return false;
2062
+ }
2063
+ if (!item.query || !item.query.length) {
2064
+ return true;
2065
+ }
2066
+ return item.query.every((filter) => {
2067
+ return objectMatchesQuery(userAttributes, filter);
2068
+ });
2069
+ }
2070
+ 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}";
2071
+ 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}";
2072
+ 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}";
2073
+
2074
+ // src/blocks/personalization-container/helpers.ts
2075
+ var DEFAULT_INDEX = "default";
2076
+ var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
2077
+ var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
2078
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
2079
+ var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
2080
+ var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
2081
+ function checkShouldRenderVariants(variants, canTrack) {
2082
+ const hasVariants = variants && variants.length > 0;
2083
+ if (TARGET === "reactNative")
2084
+ return false;
2085
+ if (!hasVariants)
2086
+ return false;
2087
+ if (!canTrack)
2088
+ return false;
2089
+ if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
2090
+ return true;
2091
+ if (isBrowser())
2092
+ return false;
2093
+ return true;
2094
+ }
2095
+ function getBlocksToRender({
2096
+ variants,
2097
+ previewingIndex,
2098
+ isHydrated,
2099
+ filteredVariants,
2100
+ fallbackBlocks
2101
+ }) {
2102
+ const fallback = {
2103
+ blocks: fallbackBlocks ?? [],
2104
+ path: "this.children",
2105
+ index: DEFAULT_INDEX
2106
+ };
2107
+ if (isHydrated && isEditing()) {
2108
+ if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
2109
+ const variant = variants?.[previewingIndex];
2110
+ if (variant) {
2111
+ return {
2112
+ blocks: variant.blocks,
2113
+ path: `variants.${previewingIndex}.blocks`,
2114
+ index: previewingIndex
2115
+ };
2116
+ }
2117
+ }
2118
+ return fallback;
2119
+ }
2120
+ if (isBrowser()) {
2121
+ const winningVariant = filteredVariants?.[0];
2122
+ if (winningVariant && variants) {
2123
+ const variantIndex = variants.indexOf(winningVariant);
2124
+ if (variantIndex !== -1) {
2125
+ return {
2126
+ blocks: winningVariant.blocks,
2127
+ path: `variants.${variantIndex}.blocks`,
2128
+ index: variantIndex
2129
+ };
2130
+ }
2131
+ }
2132
+ }
2133
+ return fallback;
2134
+ }
2135
+ var getInitPersonalizationVariantsFnsScriptString = () => {
2136
+ return `
2137
+ window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
2138
+ window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
2139
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
2140
+ `;
2141
+ };
2142
+ var isHydrationTarget = TARGET === "react";
2143
+ var getPersonalizationScript = (variants, blockId, locale) => {
2144
+ return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
2145
+ };
2146
+ var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
2147
+ return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
2148
+ };
2149
+
1971
2150
  // src/helpers/url.ts
1972
2151
  var getTopLevelDomain = (host) => {
1973
2152
  if (host === "localhost" || host === "127.0.0.1") {
@@ -2914,7 +3093,8 @@ var componentInfo6 = {
2914
3093
  name: "PersonalizationContainer",
2915
3094
  shouldReceiveBuilderProps: {
2916
3095
  builderBlock: true,
2917
- builderContext: true
3096
+ builderContext: true,
3097
+ builderComponents: true
2918
3098
  },
2919
3099
  noWrap: true,
2920
3100
  image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
@@ -2970,199 +3150,6 @@ function isPreviewing(_search) {
2970
3150
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
2971
3151
  }
2972
3152
 
2973
- // src/blocks/personalization-container/helpers/inlined-fns.ts
2974
- function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
2975
- function isString(val) {
2976
- return typeof val === "string";
2977
- }
2978
- function isNumber(val) {
2979
- return typeof val === "number";
2980
- }
2981
- function objectMatchesQuery(userattr, query2) {
2982
- const result = (() => {
2983
- const property = query2.property;
2984
- const operator = query2.operator;
2985
- let testValue = query2.value;
2986
- if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
2987
- testValue = query2.value.slice(0, -1);
2988
- }
2989
- if (!(property && operator)) {
2990
- return true;
2991
- }
2992
- if (Array.isArray(testValue)) {
2993
- if (operator === "isNot") {
2994
- return testValue.every((val) => objectMatchesQuery(userattr, {
2995
- property,
2996
- operator,
2997
- value: val
2998
- }));
2999
- }
3000
- return !!testValue.find((val) => objectMatchesQuery(userattr, {
3001
- property,
3002
- operator,
3003
- value: val
3004
- }));
3005
- }
3006
- const value = userattr[property];
3007
- if (Array.isArray(value)) {
3008
- return value.includes(testValue);
3009
- }
3010
- switch (operator) {
3011
- case "is":
3012
- return value === testValue;
3013
- case "isNot":
3014
- return value !== testValue;
3015
- case "contains":
3016
- return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
3017
- case "startsWith":
3018
- return isString(value) && value.startsWith(String(testValue));
3019
- case "endsWith":
3020
- return isString(value) && value.endsWith(String(testValue));
3021
- case "greaterThan":
3022
- return isNumber(value) && isNumber(testValue) && value > testValue;
3023
- case "lessThan":
3024
- return isNumber(value) && isNumber(testValue) && value < testValue;
3025
- case "greaterThanOrEqualTo":
3026
- return isNumber(value) && isNumber(testValue) && value >= testValue;
3027
- case "lessThanOrEqualTo":
3028
- return isNumber(value) && isNumber(testValue) && value <= testValue;
3029
- default:
3030
- return false;
3031
- }
3032
- })();
3033
- return result;
3034
- }
3035
- const item = {
3036
- query,
3037
- startDate,
3038
- endDate
3039
- };
3040
- const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
3041
- if (item.startDate && new Date(item.startDate) > now) {
3042
- return false;
3043
- } else if (item.endDate && new Date(item.endDate) < now) {
3044
- return false;
3045
- }
3046
- if (!item.query || !item.query.length) {
3047
- return true;
3048
- }
3049
- return item.query.every((filter) => {
3050
- return objectMatchesQuery(userAttributes, filter);
3051
- });
3052
- }
3053
- var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
3054
- if (!navigator.cookieEnabled) {
3055
- return;
3056
- }
3057
- function getCookie(name) {
3058
- const nameEQ = name + '=';
3059
- const ca = document.cookie.split(';');
3060
- for (let i = 0; i < ca.length; i++) {
3061
- let c = ca[i];
3062
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
3063
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
3064
- }
3065
- return null;
3066
- }
3067
- function removeVariants() {
3068
- variants?.forEach(function (_, index) {
3069
- document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
3070
- });
3071
- document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
3072
- document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
3073
- }
3074
- const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
3075
- if (locale) {
3076
- attributes.locale = locale;
3077
- }
3078
- const winningVariantIndex = variants?.findIndex(function (variant) {
3079
- return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
3080
- });
3081
- const isDebug = location.href.includes('builder.debug=true');
3082
- if (isDebug) {
3083
- console.debug('PersonalizationContainer', {
3084
- attributes,
3085
- variants,
3086
- winningVariantIndex
3087
- });
3088
- }
3089
- if (winningVariantIndex !== -1) {
3090
- const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
3091
- if (winningVariant) {
3092
- const parentNode = winningVariant.parentNode;
3093
- if (parentNode) {
3094
- const newParent = parentNode.cloneNode(false);
3095
- newParent.appendChild(winningVariant.content.firstChild);
3096
- newParent.appendChild(winningVariant.content.lastChild);
3097
- parentNode.parentNode?.replaceChild(newParent, parentNode);
3098
- }
3099
- if (isDebug) {
3100
- console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
3101
- }
3102
- }
3103
- } else if (variants && variants.length > 0) {
3104
- removeVariants();
3105
- }
3106
- }`;
3107
- 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}";
3108
-
3109
- // src/blocks/personalization-container/helpers.ts
3110
- function checkShouldRenderVariants(variants, canTrack) {
3111
- const hasVariants = variants && variants.length > 0;
3112
- if (TARGET === "reactNative")
3113
- return false;
3114
- if (!hasVariants)
3115
- return false;
3116
- if (!canTrack)
3117
- return false;
3118
- if (TARGET === "vue" || TARGET === "svelte")
3119
- return true;
3120
- if (isBrowser())
3121
- return false;
3122
- return true;
3123
- }
3124
- function getBlocksToRender({
3125
- variants,
3126
- previewingIndex,
3127
- isHydrated,
3128
- filteredVariants,
3129
- fallbackBlocks
3130
- }) {
3131
- const fallback = {
3132
- blocks: fallbackBlocks ?? [],
3133
- path: "this.children"
3134
- };
3135
- if (isHydrated && isEditing()) {
3136
- if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
3137
- const variant = variants[previewingIndex];
3138
- return {
3139
- blocks: variant.blocks,
3140
- path: `component.options.variants.${previewingIndex}.blocks`
3141
- };
3142
- }
3143
- return fallback;
3144
- }
3145
- if (isBrowser()) {
3146
- const winningVariant = filteredVariants?.[0];
3147
- if (winningVariant) {
3148
- return {
3149
- blocks: winningVariant.blocks,
3150
- path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
3151
- };
3152
- }
3153
- }
3154
- return fallback;
3155
- }
3156
- var getPersonalizationScript = (variants, blockId, locale) => {
3157
- return `
3158
- (function() {
3159
- ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
3160
- ${PERSONALIZATION_SCRIPT}
3161
- getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
3162
- })();
3163
- `;
3164
- };
3165
-
3166
3153
  // src/blocks/personalization-container/personalization-container.tsx
3167
3154
  function PersonalizationContainer(props) {
3168
3155
  const [userAttributes, setUserAttributes] = createSignal10(
@@ -3175,6 +3162,13 @@ function PersonalizationContainer(props) {
3175
3162
  props.builderContext?.rootState?.locale
3176
3163
  )
3177
3164
  );
3165
+ const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal10(
3166
+ getUpdateVisibilityStylesScript(
3167
+ props.variants,
3168
+ props.builderBlock?.id || "none",
3169
+ props.builderContext?.rootState?.locale
3170
+ )
3171
+ );
3178
3172
  const [unsubscribers, setUnsubscribers] = createSignal10([]);
3179
3173
  const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
3180
3174
  checkShouldRenderVariants(
@@ -3182,7 +3176,14 @@ function PersonalizationContainer(props) {
3182
3176
  getDefaultCanTrack(props.builderContext?.canTrack)
3183
3177
  )
3184
3178
  );
3185
- const [isHydrated, setIsHydrated] = createSignal10(false);
3179
+ const [shouldResetVariants, setShouldResetVariants] = createSignal10(false);
3180
+ const attrs = createMemo10(() => {
3181
+ return {
3182
+ ...props.attributes,
3183
+ ...{},
3184
+ [getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
3185
+ };
3186
+ });
3186
3187
  const filteredVariants = createMemo10(() => {
3187
3188
  return (props.variants || []).filter((variant) => {
3188
3189
  return filterWithCustomTargeting(
@@ -3202,22 +3203,22 @@ function PersonalizationContainer(props) {
3202
3203
  return getBlocksToRender({
3203
3204
  variants: props.variants,
3204
3205
  fallbackBlocks: props.builderBlock?.children,
3205
- isHydrated: isHydrated(),
3206
+ isHydrated: shouldResetVariants(),
3206
3207
  filteredVariants: filteredVariants(),
3207
3208
  previewingIndex: props.previewingIndex
3208
3209
  });
3209
3210
  });
3210
3211
  const hideVariantsStyleString = createMemo10(() => {
3211
3212
  return (props.variants || []).map(
3212
- (_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
3213
+ (_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `
3213
3214
  ).join("");
3214
3215
  });
3215
3216
  let rootRef;
3216
3217
  onMount5(() => {
3217
- setIsHydrated(true);
3218
+ setShouldResetVariants(true);
3218
3219
  const unsub = userAttributesService.subscribeOnUserAttributesChange(
3219
- (attrs) => {
3220
- setUserAttributes(attrs);
3220
+ (attrs2) => {
3221
+ setUserAttributes(attrs2);
3221
3222
  }
3222
3223
  );
3223
3224
  if (!(isEditing() || isPreviewing())) {
@@ -3226,7 +3227,7 @@ function PersonalizationContainer(props) {
3226
3227
  rootRef.dispatchEvent(
3227
3228
  new CustomEvent("builder.variantLoaded", {
3228
3229
  detail: {
3229
- variant: variant || "default",
3230
+ variant: variant || DEFAULT_INDEX,
3230
3231
  content: props.builderContext?.content
3231
3232
  },
3232
3233
  bubbles: true
@@ -3238,7 +3239,7 @@ function PersonalizationContainer(props) {
3238
3239
  rootRef.dispatchEvent(
3239
3240
  new CustomEvent("builder.variantDisplayed", {
3240
3241
  detail: {
3241
- variant: variant || "default",
3242
+ variant: variant || DEFAULT_INDEX,
3242
3243
  content: props.builderContext?.content
3243
3244
  },
3244
3245
  bubbles: true
@@ -3252,39 +3253,72 @@ function PersonalizationContainer(props) {
3252
3253
  }
3253
3254
  unsubscribers().push(unsub);
3254
3255
  });
3255
- return <><div
3256
- class={`builder-personalization-container ${props.attributes?.className || ""}`}
3257
- ref={rootRef}
3258
- {...props.attributes}
3259
- >
3260
- <Show10 when={shouldRenderVariants()}>
3261
- <For6 each={props.variants}>{(variant, _index) => {
3262
- const index = _index();
3263
- return <template
3264
- key={index}
3265
- data-variant-id={`${props.builderBlock?.id}-${index}`}
3266
- ><Blocks_default
3267
- blocks={variant.blocks}
3268
- parent={props.builderBlock?.id}
3269
- path={`component.options.variants.${index}.blocks`}
3270
- /></template>;
3271
- }}</For6>
3272
- <Inlined_styles_default
3273
- nonce={props.builderContext?.nonce || ""}
3274
- styles={hideVariantsStyleString()}
3275
- id={`variants-styles-${props.builderBlock?.id}`}
3276
- />
3277
- <Inlined_script_default
3278
- nonce={props.builderContext?.nonce || ""}
3279
- scriptStr={scriptStr()}
3280
- id={`variants-script-${props.builderBlock?.id}`}
3281
- />
3282
- </Show10>
3283
- <Blocks_default
3256
+ return <><div ref={rootRef} {...attrs()}>
3257
+ <Show10
3258
+ when={shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
3259
+ ><Blocks_default
3284
3260
  blocks={blocksToRender().blocks}
3285
3261
  parent={props.builderBlock?.id}
3286
3262
  path={blocksToRender().path}
3287
- />
3263
+ context={props.builderContext}
3264
+ registeredComponents={props.builderComponents}
3265
+ BlocksWrapperProps={{
3266
+ ...props.builderContext?.BlocksWrapperProps,
3267
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
3268
+ }}
3269
+ /></Show10>
3270
+ <Show10
3271
+ when={!shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
3272
+ >
3273
+ <Show10 when={shouldRenderVariants()}>
3274
+ <Inlined_styles_default
3275
+ nonce={props.builderContext?.nonce || ""}
3276
+ styles={hideVariantsStyleString()}
3277
+ id={`variants-styles-${props.builderBlock?.id}`}
3278
+ />
3279
+ <Inlined_script_default
3280
+ nonce={props.builderContext?.nonce || ""}
3281
+ scriptStr={updateVisibilityStylesScript()}
3282
+ id={`variants-visibility-script-${props.builderBlock?.id}`}
3283
+ />
3284
+ <For6 each={props.variants}>{(variant, _index) => {
3285
+ const index = _index();
3286
+ return <Blocks_default
3287
+ key={`${props.builderBlock?.id}-${index}`}
3288
+ BlocksWrapperProps={{
3289
+ ...props.builderContext?.BlocksWrapperProps,
3290
+ "aria-hidden": true,
3291
+ hidden: true,
3292
+ "data-variant-id": `${props.builderBlock?.id}-${index}`
3293
+ }}
3294
+ blocks={variant.blocks}
3295
+ parent={props.builderBlock?.id}
3296
+ path={`component.options.variants.${index}.blocks`}
3297
+ context={props.builderContext}
3298
+ registeredComponents={props.builderComponents}
3299
+ ><Inlined_script_default
3300
+ nonce={props.builderContext?.nonce || ""}
3301
+ scriptStr={scriptStr()}
3302
+ id={`variants-script-${props.builderBlock?.id}-${index}`}
3303
+ /></Blocks_default>;
3304
+ }}</For6>
3305
+ </Show10>
3306
+ <Blocks_default
3307
+ blocks={blocksToRender().blocks}
3308
+ parent={props.builderBlock?.id}
3309
+ path={blocksToRender().path}
3310
+ context={props.builderContext}
3311
+ registeredComponents={props.builderComponents}
3312
+ BlocksWrapperProps={{
3313
+ ...props.builderContext?.BlocksWrapperProps,
3314
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
3315
+ }}
3316
+ ><Show10 when={shouldRenderVariants()}><Inlined_script_default
3317
+ nonce={props.builderContext?.nonce || ""}
3318
+ scriptStr={scriptStr()}
3319
+ id={`variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`}
3320
+ /></Show10></Blocks_default>
3321
+ </Show10>
3288
3322
  </div></>;
3289
3323
  }
3290
3324
  var personalization_container_default = PersonalizationContainer;
@@ -3676,7 +3710,7 @@ var componentInfo12 = {
3676
3710
  };
3677
3711
 
3678
3712
  // src/blocks/custom-code/custom-code.tsx
3679
- import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3713
+ import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3680
3714
  function CustomCode(props) {
3681
3715
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3682
3716
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3726,7 +3760,7 @@ function CustomCode(props) {
3726
3760
  runScripts();
3727
3761
  }
3728
3762
  }
3729
- createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3763
+ createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3730
3764
  return <><div
3731
3765
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3732
3766
  ref={elementRef}
@@ -3754,7 +3788,7 @@ var componentInfo13 = {
3754
3788
  };
3755
3789
 
3756
3790
  // src/blocks/embed/embed.tsx
3757
- import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3791
+ import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3758
3792
 
3759
3793
  // src/blocks/embed/helpers.ts
3760
3794
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3796,8 +3830,8 @@ function Embed(props) {
3796
3830
  findAndRunScripts();
3797
3831
  }
3798
3832
  }
3799
- createEffect6(
3800
- on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3833
+ createEffect7(
3834
+ on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3801
3835
  );
3802
3836
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
3803
3837
  }
@@ -4807,7 +4841,7 @@ var getDefaultRegisteredComponents = () => [{
4807
4841
  }, {
4808
4842
  component: text_default,
4809
4843
  ...componentInfo11
4810
- }, ...TARGET === "react" ? [{
4844
+ }, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
4811
4845
  component: personalization_container_default,
4812
4846
  ...componentInfo6
4813
4847
  }] : [], ...TARGET === "rsc" ? [] : [{
@@ -4844,7 +4878,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
4844
4878
 
4845
4879
  // src/components/content-variants/helpers.ts
4846
4880
  var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
4847
- var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
4881
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
4848
4882
  var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
4849
4883
  ...variant,
4850
4884
  testVariationId: variant.id,
@@ -4869,28 +4903,28 @@ var checkShouldRenderVariants2 = ({
4869
4903
  };
4870
4904
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
4871
4905
  var isAngularSDK = TARGET === "angular";
4872
- var isHydrationTarget = getIsHydrationTarget(TARGET);
4906
+ var isHydrationTarget2 = getIsHydrationTarget(TARGET);
4873
4907
  var getInitVariantsFnsScriptString = () => `
4874
4908
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
4875
- window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
4909
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
4876
4910
  `;
4877
4911
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
4878
4912
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
4879
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
4913
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
4880
4914
  )`;
4881
4915
  var getUpdateVariantVisibilityScript = ({
4882
4916
  contentId,
4883
4917
  variationId
4884
- }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
4885
- "${variationId}", "${contentId}", ${isHydrationTarget}
4918
+ }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
4919
+ "${variationId}", "${contentId}", ${isHydrationTarget2}
4886
4920
  )`;
4887
4921
 
4888
4922
  // src/components/content/components/enable-editor.tsx
4889
4923
  import {
4890
4924
  Show as Show14,
4891
4925
  onMount as onMount8,
4892
- on as on7,
4893
- createEffect as createEffect7,
4926
+ on as on8,
4927
+ createEffect as createEffect8,
4894
4928
  createMemo as createMemo16,
4895
4929
  createSignal as createSignal16
4896
4930
  } from "solid-js";
@@ -4902,7 +4936,7 @@ function getPreviewContent(_searchParams) {
4902
4936
  }
4903
4937
 
4904
4938
  // src/constants/sdk-version.ts
4905
- var SDK_VERSION = "4.0.7";
4939
+ var SDK_VERSION = "4.0.9";
4906
4940
 
4907
4941
  // src/helpers/sdk-headers.ts
4908
4942
  var getSdkHeaders = () => ({
@@ -5994,15 +6028,15 @@ function EnableEditor(props) {
5994
6028
  mergeNewContent(props.content);
5995
6029
  }
5996
6030
  }
5997
- createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6031
+ createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5998
6032
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5999
6033
  () => props.builderContextSignal.rootState
6000
6034
  );
6001
6035
  function onUpdateFn_1() {
6002
6036
  emitStateUpdate();
6003
6037
  }
6004
- createEffect7(
6005
- on7(
6038
+ createEffect8(
6039
+ on8(
6006
6040
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6007
6041
  onUpdateFn_1
6008
6042
  )
@@ -6013,7 +6047,7 @@ function EnableEditor(props) {
6013
6047
  mergeNewRootState(props.data);
6014
6048
  }
6015
6049
  }
6016
- createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6050
+ createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6017
6051
  const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
6018
6052
  function onUpdateFn_3() {
6019
6053
  if (props.locale) {
@@ -6022,7 +6056,7 @@ function EnableEditor(props) {
6022
6056
  });
6023
6057
  }
6024
6058
  }
6025
- createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6059
+ createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6026
6060
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6027
6061
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6028
6062
  ><Dynamic5
@@ -6268,11 +6302,18 @@ function ContentVariants(props) {
6268
6302
  setShouldRenderVariants(false);
6269
6303
  });
6270
6304
  return <><>
6271
- <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
6272
- id="builderio-init-variants-fns"
6273
- scriptStr={getInitVariantsFnsScriptString()}
6274
- nonce={props.nonce || ""}
6275
- /></Show16>
6305
+ <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}>
6306
+ <Inlined_script_default
6307
+ id="builderio-init-variants-fns"
6308
+ scriptStr={getInitVariantsFnsScriptString()}
6309
+ nonce={props.nonce || ""}
6310
+ />
6311
+ <Show16 when={SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}><Inlined_script_default
6312
+ id="builderio-init-personalization-variants-fns"
6313
+ nonce={props.nonce || ""}
6314
+ scriptStr={getInitPersonalizationVariantsFnsScriptString()}
6315
+ /></Show16>
6316
+ </Show16>
6276
6317
  <Show16 when={shouldRenderVariants()}>
6277
6318
  <Inlined_styles_default
6278
6319
  id="builderio-variants"
@@ -6368,6 +6409,7 @@ var fetchSymbolContent = async ({
6368
6409
  // src/blocks/symbol/symbol.tsx
6369
6410
  function Symbol(props) {
6370
6411
  const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
6412
+ const [symbolEntry, setSymbolEntry] = createSignal20(props.symbol?.entry);
6371
6413
  const blocksWrapper = createMemo20(() => {
6372
6414
  return "div";
6373
6415
  });
@@ -6383,7 +6425,7 @@ function Symbol(props) {
6383
6425
  ].filter(Boolean).join(" ");
6384
6426
  });
6385
6427
  function setContent() {
6386
- if (contentToUse())
6428
+ if (contentToUse() && symbolEntry() === props.symbol?.entry)
6387
6429
  return;
6388
6430
  fetchSymbolContent({
6389
6431
  symbol: props.symbol,
@@ -6391,6 +6433,7 @@ function Symbol(props) {
6391
6433
  }).then((newContent) => {
6392
6434
  if (newContent) {
6393
6435
  setContentToUse(newContent);
6436
+ setSymbolEntry(props.symbol?.entry);
6394
6437
  }
6395
6438
  });
6396
6439
  }
@@ -6400,7 +6443,7 @@ function Symbol(props) {
6400
6443
  function onUpdateFn_0() {
6401
6444
  setContent();
6402
6445
  }
6403
- createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6446
+ createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6404
6447
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6405
6448
  nonce={props.builderContext.nonce}
6406
6449
  isNestedRender={true}