@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.
@@ -1366,15 +1366,15 @@ var Block_wrapper_default = BlockWrapper;
1366
1366
  import {
1367
1367
  Show as Show4,
1368
1368
  For,
1369
- on,
1370
- createEffect,
1369
+ on as on2,
1370
+ createEffect as createEffect2,
1371
1371
  createMemo as createMemo3,
1372
1372
  createSignal as createSignal3
1373
1373
  } from "solid-js";
1374
1374
  import { Dynamic as Dynamic3 } from "solid-js/web";
1375
1375
 
1376
1376
  // src/components/block/components/interactive-element.tsx
1377
- import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1377
+ import { Show as Show3, on, createEffect, createMemo as createMemo2, createSignal as createSignal2 } from "solid-js";
1378
1378
  import { Dynamic as Dynamic2 } from "solid-js/web";
1379
1379
 
1380
1380
  // src/components/awaiter.tsx
@@ -1388,6 +1388,7 @@ var Awaiter_default = Awaiter;
1388
1388
 
1389
1389
  // src/components/block/components/interactive-element.tsx
1390
1390
  function InteractiveElement(props) {
1391
+ const [forceRenderCount, setForceRenderCount] = createSignal2(0);
1391
1392
  const attributes = createMemo2(() => {
1392
1393
  return props.includeBlockProps ? {
1393
1394
  ...getBlockProperties({
@@ -1406,6 +1407,21 @@ function InteractiveElement(props) {
1406
1407
  const targetWrapperProps = createMemo2(() => {
1407
1408
  return props.wrapperProps;
1408
1409
  });
1410
+ const onUpdateFn_0_props_wrapperProps = createMemo2(() => props.wrapperProps);
1411
+ const onUpdateFn_0_props_block__component__options = createMemo2(
1412
+ () => props.block?.component?.options
1413
+ );
1414
+ function onUpdateFn_0() {
1415
+ }
1416
+ createEffect(
1417
+ on(
1418
+ () => [
1419
+ onUpdateFn_0_props_wrapperProps(),
1420
+ onUpdateFn_0_props_block__component__options()
1421
+ ],
1422
+ onUpdateFn_0
1423
+ )
1424
+ );
1409
1425
  return <><Show3
1410
1426
  fallback={<Dynamic2
1411
1427
  {...targetWrapperProps()}
@@ -1469,8 +1485,8 @@ function ComponentRef(props) {
1469
1485
  );
1470
1486
  function onUpdateFn_0() {
1471
1487
  }
1472
- createEffect(
1473
- on(
1488
+ createEffect2(
1489
+ on2(
1474
1490
  () => [
1475
1491
  onUpdateFn_0_props_componentOptions(),
1476
1492
  onUpdateFn_0_props_blockChildren()
@@ -1504,7 +1520,7 @@ function ComponentRef(props) {
1504
1520
  var Component_ref_default = ComponentRef;
1505
1521
 
1506
1522
  // src/components/block/components/repeated-block.tsx
1507
- import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1523
+ import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1508
1524
  function RepeatedBlock(props) {
1509
1525
  const [store, setStore] = createSignal4(props.repeatContext);
1510
1526
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1513,7 +1529,7 @@ function RepeatedBlock(props) {
1513
1529
  function onUpdateFn_0() {
1514
1530
  setStore(props.repeatContext);
1515
1531
  }
1516
- createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1532
+ createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1517
1533
  return <><builder_context_default.Provider value={store()}><Block_default
1518
1534
  block={props.block}
1519
1535
  context={store()}
@@ -1682,7 +1698,7 @@ function Block(props) {
1682
1698
  var Block_default = Block;
1683
1699
 
1684
1700
  // src/components/blocks/blocks-wrapper.tsx
1685
- import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1701
+ import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1686
1702
  import { Dynamic as Dynamic4 } from "solid-js/web";
1687
1703
  function BlocksWrapper(props) {
1688
1704
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1735,10 +1751,10 @@ function BlocksWrapper(props) {
1735
1751
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1736
1752
  function onUpdateFn_0() {
1737
1753
  }
1738
- createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1754
+ createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1739
1755
  return <>
1740
1756
  <Dynamic4
1741
- class={className() + " dynamic-023c60f2"}
1757
+ class={className() + " dynamic-450facf4"}
1742
1758
  ref={blocksWrapperRef}
1743
1759
  builder-path={dataPath()}
1744
1760
  builder-parent-id={props.parent}
@@ -1750,7 +1766,7 @@ function BlocksWrapper(props) {
1750
1766
  {...props.BlocksWrapperProps}
1751
1767
  component={props.BlocksWrapper}
1752
1768
  >{props.children}</Dynamic4>
1753
- <style>{`.dynamic-023c60f2 {
1769
+ <style>{`.dynamic-450facf4 {
1754
1770
  display: flex;
1755
1771
  flex-direction: column;
1756
1772
  align-items: stretch;
@@ -1768,19 +1784,22 @@ function Blocks(props) {
1768
1784
  parent={props.parent}
1769
1785
  path={props.path}
1770
1786
  styleProp={props.styleProp}
1787
+ BlocksWrapperProps={props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
1771
1788
  classNameProp={props.className}
1772
1789
  BlocksWrapper={props.context?.BlocksWrapper || builderContext?.BlocksWrapper}
1773
- BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
1774
- ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1775
- const index = _index();
1776
- return <Block_default
1777
- key={block.id}
1778
- block={block}
1779
- linkComponent={props.linkComponent}
1780
- context={props.context || builderContext}
1781
- registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
1782
- />;
1783
- }}</For3></Show6></Blocks_wrapper_default></>;
1790
+ >
1791
+ {props.children}
1792
+ <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1793
+ const index = _index();
1794
+ return <Block_default
1795
+ key={block.id}
1796
+ block={block}
1797
+ linkComponent={props.linkComponent}
1798
+ context={props.context || builderContext}
1799
+ registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
1800
+ />;
1801
+ }}</For3></Show6>
1802
+ </Blocks_wrapper_default></>;
1784
1803
  }
1785
1804
  var Blocks_default = Blocks;
1786
1805
 
@@ -2126,11 +2145,171 @@ function SectionComponent(props) {
2126
2145
  var section_default = SectionComponent;
2127
2146
 
2128
2147
  // src/blocks/symbol/symbol.tsx
2129
- import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2148
+ import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2130
2149
 
2131
2150
  // src/components/content-variants/content-variants.tsx
2132
2151
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
2133
2152
 
2153
+ // src/blocks/personalization-container/helpers/inlined-fns.ts
2154
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
2155
+ function isString(val) {
2156
+ return typeof val === "string";
2157
+ }
2158
+ function isNumber(val) {
2159
+ return typeof val === "number";
2160
+ }
2161
+ function objectMatchesQuery(userattr, query2) {
2162
+ const result = (() => {
2163
+ const property = query2.property;
2164
+ const operator = query2.operator;
2165
+ let testValue = query2.value;
2166
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
2167
+ testValue = query2.value.slice(0, -1);
2168
+ }
2169
+ if (!(property && operator)) {
2170
+ return true;
2171
+ }
2172
+ if (Array.isArray(testValue)) {
2173
+ if (operator === "isNot") {
2174
+ return testValue.every((val) => objectMatchesQuery(userattr, {
2175
+ property,
2176
+ operator,
2177
+ value: val
2178
+ }));
2179
+ }
2180
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
2181
+ property,
2182
+ operator,
2183
+ value: val
2184
+ }));
2185
+ }
2186
+ const value = userattr[property];
2187
+ if (Array.isArray(value)) {
2188
+ return value.includes(testValue);
2189
+ }
2190
+ switch (operator) {
2191
+ case "is":
2192
+ return value === testValue;
2193
+ case "isNot":
2194
+ return value !== testValue;
2195
+ case "contains":
2196
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
2197
+ case "startsWith":
2198
+ return isString(value) && value.startsWith(String(testValue));
2199
+ case "endsWith":
2200
+ return isString(value) && value.endsWith(String(testValue));
2201
+ case "greaterThan":
2202
+ return isNumber(value) && isNumber(testValue) && value > testValue;
2203
+ case "lessThan":
2204
+ return isNumber(value) && isNumber(testValue) && value < testValue;
2205
+ case "greaterThanOrEqualTo":
2206
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
2207
+ case "lessThanOrEqualTo":
2208
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
2209
+ default:
2210
+ return false;
2211
+ }
2212
+ })();
2213
+ return result;
2214
+ }
2215
+ const item = {
2216
+ query,
2217
+ startDate,
2218
+ endDate
2219
+ };
2220
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
2221
+ if (item.startDate && new Date(item.startDate) > now) {
2222
+ return false;
2223
+ } else if (item.endDate && new Date(item.endDate) < now) {
2224
+ return false;
2225
+ }
2226
+ if (!item.query || !item.query.length) {
2227
+ return true;
2228
+ }
2229
+ return item.query.every((filter) => {
2230
+ return objectMatchesQuery(userAttributes, filter);
2231
+ });
2232
+ }
2233
+ 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}";
2234
+ 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}";
2235
+ 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}";
2236
+
2237
+ // src/blocks/personalization-container/helpers.ts
2238
+ var DEFAULT_INDEX = "default";
2239
+ var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
2240
+ var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
2241
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
2242
+ var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
2243
+ var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
2244
+ function checkShouldRenderVariants(variants, canTrack) {
2245
+ const hasVariants = variants && variants.length > 0;
2246
+ if (TARGET === "reactNative")
2247
+ return false;
2248
+ if (!hasVariants)
2249
+ return false;
2250
+ if (!canTrack)
2251
+ return false;
2252
+ if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
2253
+ return true;
2254
+ if (isBrowser())
2255
+ return false;
2256
+ return true;
2257
+ }
2258
+ function getBlocksToRender({
2259
+ variants,
2260
+ previewingIndex,
2261
+ isHydrated,
2262
+ filteredVariants,
2263
+ fallbackBlocks
2264
+ }) {
2265
+ const fallback = {
2266
+ blocks: fallbackBlocks ?? [],
2267
+ path: "this.children",
2268
+ index: DEFAULT_INDEX
2269
+ };
2270
+ if (isHydrated && isEditing()) {
2271
+ if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
2272
+ const variant = variants?.[previewingIndex];
2273
+ if (variant) {
2274
+ return {
2275
+ blocks: variant.blocks,
2276
+ path: `variants.${previewingIndex}.blocks`,
2277
+ index: previewingIndex
2278
+ };
2279
+ }
2280
+ }
2281
+ return fallback;
2282
+ }
2283
+ if (isBrowser()) {
2284
+ const winningVariant = filteredVariants?.[0];
2285
+ if (winningVariant && variants) {
2286
+ const variantIndex = variants.indexOf(winningVariant);
2287
+ if (variantIndex !== -1) {
2288
+ return {
2289
+ blocks: winningVariant.blocks,
2290
+ path: `variants.${variantIndex}.blocks`,
2291
+ index: variantIndex
2292
+ };
2293
+ }
2294
+ }
2295
+ }
2296
+ return fallback;
2297
+ }
2298
+ var getInitPersonalizationVariantsFnsScriptString = () => {
2299
+ return `
2300
+ window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
2301
+ window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
2302
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
2303
+ `;
2304
+ };
2305
+ var isHydrationTarget = TARGET === "react";
2306
+ var getPersonalizationScript = (variants, blockId, locale) => {
2307
+ return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
2308
+ };
2309
+ var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
2310
+ return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
2311
+ };
2312
+
2134
2313
  // src/helpers/url.ts
2135
2314
  var getTopLevelDomain = (host) => {
2136
2315
  if (host === "localhost" || host === "127.0.0.1") {
@@ -3076,7 +3255,8 @@ var componentInfo6 = {
3076
3255
  name: "PersonalizationContainer",
3077
3256
  shouldReceiveBuilderProps: {
3078
3257
  builderBlock: true,
3079
- builderContext: true
3258
+ builderContext: true,
3259
+ builderComponents: true
3080
3260
  },
3081
3261
  noWrap: true,
3082
3262
  image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
@@ -3132,199 +3312,6 @@ function isPreviewing(_search) {
3132
3312
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
3133
3313
  }
3134
3314
 
3135
- // src/blocks/personalization-container/helpers/inlined-fns.ts
3136
- function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
3137
- function isString(val) {
3138
- return typeof val === "string";
3139
- }
3140
- function isNumber(val) {
3141
- return typeof val === "number";
3142
- }
3143
- function objectMatchesQuery(userattr, query2) {
3144
- const result = (() => {
3145
- const property = query2.property;
3146
- const operator = query2.operator;
3147
- let testValue = query2.value;
3148
- if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
3149
- testValue = query2.value.slice(0, -1);
3150
- }
3151
- if (!(property && operator)) {
3152
- return true;
3153
- }
3154
- if (Array.isArray(testValue)) {
3155
- if (operator === "isNot") {
3156
- return testValue.every((val) => objectMatchesQuery(userattr, {
3157
- property,
3158
- operator,
3159
- value: val
3160
- }));
3161
- }
3162
- return !!testValue.find((val) => objectMatchesQuery(userattr, {
3163
- property,
3164
- operator,
3165
- value: val
3166
- }));
3167
- }
3168
- const value = userattr[property];
3169
- if (Array.isArray(value)) {
3170
- return value.includes(testValue);
3171
- }
3172
- switch (operator) {
3173
- case "is":
3174
- return value === testValue;
3175
- case "isNot":
3176
- return value !== testValue;
3177
- case "contains":
3178
- return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
3179
- case "startsWith":
3180
- return isString(value) && value.startsWith(String(testValue));
3181
- case "endsWith":
3182
- return isString(value) && value.endsWith(String(testValue));
3183
- case "greaterThan":
3184
- return isNumber(value) && isNumber(testValue) && value > testValue;
3185
- case "lessThan":
3186
- return isNumber(value) && isNumber(testValue) && value < testValue;
3187
- case "greaterThanOrEqualTo":
3188
- return isNumber(value) && isNumber(testValue) && value >= testValue;
3189
- case "lessThanOrEqualTo":
3190
- return isNumber(value) && isNumber(testValue) && value <= testValue;
3191
- default:
3192
- return false;
3193
- }
3194
- })();
3195
- return result;
3196
- }
3197
- const item = {
3198
- query,
3199
- startDate,
3200
- endDate
3201
- };
3202
- const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
3203
- if (item.startDate && new Date(item.startDate) > now) {
3204
- return false;
3205
- } else if (item.endDate && new Date(item.endDate) < now) {
3206
- return false;
3207
- }
3208
- if (!item.query || !item.query.length) {
3209
- return true;
3210
- }
3211
- return item.query.every((filter) => {
3212
- return objectMatchesQuery(userAttributes, filter);
3213
- });
3214
- }
3215
- var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
3216
- if (!navigator.cookieEnabled) {
3217
- return;
3218
- }
3219
- function getCookie(name) {
3220
- const nameEQ = name + '=';
3221
- const ca = document.cookie.split(';');
3222
- for (let i = 0; i < ca.length; i++) {
3223
- let c = ca[i];
3224
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
3225
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
3226
- }
3227
- return null;
3228
- }
3229
- function removeVariants() {
3230
- variants?.forEach(function (_, index) {
3231
- document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
3232
- });
3233
- document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
3234
- document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
3235
- }
3236
- const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
3237
- if (locale) {
3238
- attributes.locale = locale;
3239
- }
3240
- const winningVariantIndex = variants?.findIndex(function (variant) {
3241
- return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
3242
- });
3243
- const isDebug = location.href.includes('builder.debug=true');
3244
- if (isDebug) {
3245
- console.debug('PersonalizationContainer', {
3246
- attributes,
3247
- variants,
3248
- winningVariantIndex
3249
- });
3250
- }
3251
- if (winningVariantIndex !== -1) {
3252
- const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
3253
- if (winningVariant) {
3254
- const parentNode = winningVariant.parentNode;
3255
- if (parentNode) {
3256
- const newParent = parentNode.cloneNode(false);
3257
- newParent.appendChild(winningVariant.content.firstChild);
3258
- newParent.appendChild(winningVariant.content.lastChild);
3259
- parentNode.parentNode?.replaceChild(newParent, parentNode);
3260
- }
3261
- if (isDebug) {
3262
- console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
3263
- }
3264
- }
3265
- } else if (variants && variants.length > 0) {
3266
- removeVariants();
3267
- }
3268
- }`;
3269
- 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}";
3270
-
3271
- // src/blocks/personalization-container/helpers.ts
3272
- function checkShouldRenderVariants(variants, canTrack) {
3273
- const hasVariants = variants && variants.length > 0;
3274
- if (TARGET === "reactNative")
3275
- return false;
3276
- if (!hasVariants)
3277
- return false;
3278
- if (!canTrack)
3279
- return false;
3280
- if (TARGET === "vue" || TARGET === "svelte")
3281
- return true;
3282
- if (isBrowser())
3283
- return false;
3284
- return true;
3285
- }
3286
- function getBlocksToRender({
3287
- variants,
3288
- previewingIndex,
3289
- isHydrated,
3290
- filteredVariants,
3291
- fallbackBlocks
3292
- }) {
3293
- const fallback = {
3294
- blocks: fallbackBlocks ?? [],
3295
- path: "this.children"
3296
- };
3297
- if (isHydrated && isEditing()) {
3298
- if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
3299
- const variant = variants[previewingIndex];
3300
- return {
3301
- blocks: variant.blocks,
3302
- path: `component.options.variants.${previewingIndex}.blocks`
3303
- };
3304
- }
3305
- return fallback;
3306
- }
3307
- if (isBrowser()) {
3308
- const winningVariant = filteredVariants?.[0];
3309
- if (winningVariant) {
3310
- return {
3311
- blocks: winningVariant.blocks,
3312
- path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
3313
- };
3314
- }
3315
- }
3316
- return fallback;
3317
- }
3318
- var getPersonalizationScript = (variants, blockId, locale) => {
3319
- return `
3320
- (function() {
3321
- ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
3322
- ${PERSONALIZATION_SCRIPT}
3323
- getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
3324
- })();
3325
- `;
3326
- };
3327
-
3328
3315
  // src/blocks/personalization-container/personalization-container.tsx
3329
3316
  function PersonalizationContainer(props) {
3330
3317
  const [userAttributes, setUserAttributes] = createSignal10(
@@ -3337,6 +3324,13 @@ function PersonalizationContainer(props) {
3337
3324
  props.builderContext?.rootState?.locale
3338
3325
  )
3339
3326
  );
3327
+ const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal10(
3328
+ getUpdateVisibilityStylesScript(
3329
+ props.variants,
3330
+ props.builderBlock?.id || "none",
3331
+ props.builderContext?.rootState?.locale
3332
+ )
3333
+ );
3340
3334
  const [unsubscribers, setUnsubscribers] = createSignal10([]);
3341
3335
  const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
3342
3336
  checkShouldRenderVariants(
@@ -3344,7 +3338,14 @@ function PersonalizationContainer(props) {
3344
3338
  getDefaultCanTrack(props.builderContext?.canTrack)
3345
3339
  )
3346
3340
  );
3347
- const [isHydrated, setIsHydrated] = createSignal10(false);
3341
+ const [shouldResetVariants, setShouldResetVariants] = createSignal10(false);
3342
+ const attrs = createMemo10(() => {
3343
+ return {
3344
+ ...props.attributes,
3345
+ ...{},
3346
+ [getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
3347
+ };
3348
+ });
3348
3349
  const filteredVariants = createMemo10(() => {
3349
3350
  return (props.variants || []).filter((variant) => {
3350
3351
  return filterWithCustomTargeting(
@@ -3364,22 +3365,22 @@ function PersonalizationContainer(props) {
3364
3365
  return getBlocksToRender({
3365
3366
  variants: props.variants,
3366
3367
  fallbackBlocks: props.builderBlock?.children,
3367
- isHydrated: isHydrated(),
3368
+ isHydrated: shouldResetVariants(),
3368
3369
  filteredVariants: filteredVariants(),
3369
3370
  previewingIndex: props.previewingIndex
3370
3371
  });
3371
3372
  });
3372
3373
  const hideVariantsStyleString = createMemo10(() => {
3373
3374
  return (props.variants || []).map(
3374
- (_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
3375
+ (_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `
3375
3376
  ).join("");
3376
3377
  });
3377
3378
  let rootRef;
3378
3379
  onMount5(() => {
3379
- setIsHydrated(true);
3380
+ setShouldResetVariants(true);
3380
3381
  const unsub = userAttributesService.subscribeOnUserAttributesChange(
3381
- (attrs) => {
3382
- setUserAttributes(attrs);
3382
+ (attrs2) => {
3383
+ setUserAttributes(attrs2);
3383
3384
  }
3384
3385
  );
3385
3386
  if (!(isEditing() || isPreviewing())) {
@@ -3388,7 +3389,7 @@ function PersonalizationContainer(props) {
3388
3389
  rootRef.dispatchEvent(
3389
3390
  new CustomEvent("builder.variantLoaded", {
3390
3391
  detail: {
3391
- variant: variant || "default",
3392
+ variant: variant || DEFAULT_INDEX,
3392
3393
  content: props.builderContext?.content
3393
3394
  },
3394
3395
  bubbles: true
@@ -3400,7 +3401,7 @@ function PersonalizationContainer(props) {
3400
3401
  rootRef.dispatchEvent(
3401
3402
  new CustomEvent("builder.variantDisplayed", {
3402
3403
  detail: {
3403
- variant: variant || "default",
3404
+ variant: variant || DEFAULT_INDEX,
3404
3405
  content: props.builderContext?.content
3405
3406
  },
3406
3407
  bubbles: true
@@ -3414,39 +3415,72 @@ function PersonalizationContainer(props) {
3414
3415
  }
3415
3416
  unsubscribers().push(unsub);
3416
3417
  });
3417
- return <><div
3418
- class={`builder-personalization-container ${props.attributes?.className || ""}`}
3419
- ref={rootRef}
3420
- {...props.attributes}
3421
- >
3422
- <Show10 when={shouldRenderVariants()}>
3423
- <For6 each={props.variants}>{(variant, _index) => {
3424
- const index = _index();
3425
- return <template
3426
- key={index}
3427
- data-variant-id={`${props.builderBlock?.id}-${index}`}
3428
- ><Blocks_default
3429
- blocks={variant.blocks}
3430
- parent={props.builderBlock?.id}
3431
- path={`component.options.variants.${index}.blocks`}
3432
- /></template>;
3433
- }}</For6>
3434
- <Inlined_styles_default
3435
- nonce={props.builderContext?.nonce || ""}
3436
- styles={hideVariantsStyleString()}
3437
- id={`variants-styles-${props.builderBlock?.id}`}
3438
- />
3439
- <Inlined_script_default
3440
- nonce={props.builderContext?.nonce || ""}
3441
- scriptStr={scriptStr()}
3442
- id={`variants-script-${props.builderBlock?.id}`}
3443
- />
3444
- </Show10>
3445
- <Blocks_default
3418
+ return <><div ref={rootRef} {...attrs()}>
3419
+ <Show10
3420
+ when={shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
3421
+ ><Blocks_default
3446
3422
  blocks={blocksToRender().blocks}
3447
3423
  parent={props.builderBlock?.id}
3448
3424
  path={blocksToRender().path}
3449
- />
3425
+ context={props.builderContext}
3426
+ registeredComponents={props.builderComponents}
3427
+ BlocksWrapperProps={{
3428
+ ...props.builderContext?.BlocksWrapperProps,
3429
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
3430
+ }}
3431
+ /></Show10>
3432
+ <Show10
3433
+ when={!shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
3434
+ >
3435
+ <Show10 when={shouldRenderVariants()}>
3436
+ <Inlined_styles_default
3437
+ nonce={props.builderContext?.nonce || ""}
3438
+ styles={hideVariantsStyleString()}
3439
+ id={`variants-styles-${props.builderBlock?.id}`}
3440
+ />
3441
+ <Inlined_script_default
3442
+ nonce={props.builderContext?.nonce || ""}
3443
+ scriptStr={updateVisibilityStylesScript()}
3444
+ id={`variants-visibility-script-${props.builderBlock?.id}`}
3445
+ />
3446
+ <For6 each={props.variants}>{(variant, _index) => {
3447
+ const index = _index();
3448
+ return <Blocks_default
3449
+ key={`${props.builderBlock?.id}-${index}`}
3450
+ BlocksWrapperProps={{
3451
+ ...props.builderContext?.BlocksWrapperProps,
3452
+ "aria-hidden": true,
3453
+ hidden: true,
3454
+ "data-variant-id": `${props.builderBlock?.id}-${index}`
3455
+ }}
3456
+ blocks={variant.blocks}
3457
+ parent={props.builderBlock?.id}
3458
+ path={`component.options.variants.${index}.blocks`}
3459
+ context={props.builderContext}
3460
+ registeredComponents={props.builderComponents}
3461
+ ><Inlined_script_default
3462
+ nonce={props.builderContext?.nonce || ""}
3463
+ scriptStr={scriptStr()}
3464
+ id={`variants-script-${props.builderBlock?.id}-${index}`}
3465
+ /></Blocks_default>;
3466
+ }}</For6>
3467
+ </Show10>
3468
+ <Blocks_default
3469
+ blocks={blocksToRender().blocks}
3470
+ parent={props.builderBlock?.id}
3471
+ path={blocksToRender().path}
3472
+ context={props.builderContext}
3473
+ registeredComponents={props.builderComponents}
3474
+ BlocksWrapperProps={{
3475
+ ...props.builderContext?.BlocksWrapperProps,
3476
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
3477
+ }}
3478
+ ><Show10 when={shouldRenderVariants()}><Inlined_script_default
3479
+ nonce={props.builderContext?.nonce || ""}
3480
+ scriptStr={scriptStr()}
3481
+ id={`variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`}
3482
+ /></Show10></Blocks_default>
3483
+ </Show10>
3450
3484
  </div></>;
3451
3485
  }
3452
3486
  var personalization_container_default = PersonalizationContainer;
@@ -3838,7 +3872,7 @@ var componentInfo12 = {
3838
3872
  };
3839
3873
 
3840
3874
  // src/blocks/custom-code/custom-code.tsx
3841
- import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3875
+ import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3842
3876
  function CustomCode(props) {
3843
3877
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3844
3878
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3888,7 +3922,7 @@ function CustomCode(props) {
3888
3922
  runScripts();
3889
3923
  }
3890
3924
  }
3891
- createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3925
+ createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3892
3926
  return <><div
3893
3927
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3894
3928
  ref={elementRef}
@@ -3916,7 +3950,7 @@ var componentInfo13 = {
3916
3950
  };
3917
3951
 
3918
3952
  // src/blocks/embed/embed.tsx
3919
- import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3953
+ import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3920
3954
 
3921
3955
  // src/blocks/embed/helpers.ts
3922
3956
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3958,8 +3992,8 @@ function Embed(props) {
3958
3992
  findAndRunScripts();
3959
3993
  }
3960
3994
  }
3961
- createEffect6(
3962
- on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3995
+ createEffect7(
3996
+ on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3963
3997
  );
3964
3998
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
3965
3999
  }
@@ -4968,7 +5002,7 @@ var getDefaultRegisteredComponents = () => [{
4968
5002
  }, {
4969
5003
  component: text_default,
4970
5004
  ...componentInfo11
4971
- }, ...TARGET === "react" ? [{
5005
+ }, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
4972
5006
  component: personalization_container_default,
4973
5007
  ...componentInfo6
4974
5008
  }] : [], ...TARGET === "rsc" ? [] : [{
@@ -5005,7 +5039,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
5005
5039
 
5006
5040
  // src/components/content-variants/helpers.ts
5007
5041
  var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
5008
- var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
5042
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
5009
5043
  var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
5010
5044
  ...variant,
5011
5045
  testVariationId: variant.id,
@@ -5030,28 +5064,28 @@ var checkShouldRenderVariants2 = ({
5030
5064
  };
5031
5065
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
5032
5066
  var isAngularSDK = TARGET === "angular";
5033
- var isHydrationTarget = getIsHydrationTarget(TARGET);
5067
+ var isHydrationTarget2 = getIsHydrationTarget(TARGET);
5034
5068
  var getInitVariantsFnsScriptString = () => `
5035
5069
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
5036
- window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
5070
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
5037
5071
  `;
5038
5072
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
5039
5073
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
5040
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
5074
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
5041
5075
  )`;
5042
5076
  var getUpdateVariantVisibilityScript = ({
5043
5077
  contentId,
5044
5078
  variationId
5045
- }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
5046
- "${variationId}", "${contentId}", ${isHydrationTarget}
5079
+ }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
5080
+ "${variationId}", "${contentId}", ${isHydrationTarget2}
5047
5081
  )`;
5048
5082
 
5049
5083
  // src/components/content/components/enable-editor.tsx
5050
5084
  import {
5051
5085
  Show as Show14,
5052
5086
  onMount as onMount8,
5053
- on as on7,
5054
- createEffect as createEffect7,
5087
+ on as on8,
5088
+ createEffect as createEffect8,
5055
5089
  createMemo as createMemo16,
5056
5090
  createSignal as createSignal16
5057
5091
  } from "solid-js";
@@ -5063,7 +5097,7 @@ function getPreviewContent(_searchParams) {
5063
5097
  }
5064
5098
 
5065
5099
  // src/constants/sdk-version.ts
5066
- var SDK_VERSION = "4.0.7";
5100
+ var SDK_VERSION = "4.0.9";
5067
5101
 
5068
5102
  // src/helpers/sdk-headers.ts
5069
5103
  var getSdkHeaders = () => ({
@@ -6148,15 +6182,15 @@ function EnableEditor(props) {
6148
6182
  mergeNewContent(props.content);
6149
6183
  }
6150
6184
  }
6151
- createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6185
+ createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6152
6186
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
6153
6187
  () => props.builderContextSignal.rootState
6154
6188
  );
6155
6189
  function onUpdateFn_1() {
6156
6190
  emitStateUpdate();
6157
6191
  }
6158
- createEffect7(
6159
- on7(
6192
+ createEffect8(
6193
+ on8(
6160
6194
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6161
6195
  onUpdateFn_1
6162
6196
  )
@@ -6167,7 +6201,7 @@ function EnableEditor(props) {
6167
6201
  mergeNewRootState(props.data);
6168
6202
  }
6169
6203
  }
6170
- createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6204
+ createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6171
6205
  const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
6172
6206
  function onUpdateFn_3() {
6173
6207
  if (props.locale) {
@@ -6176,7 +6210,7 @@ function EnableEditor(props) {
6176
6210
  });
6177
6211
  }
6178
6212
  }
6179
- createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6213
+ createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6180
6214
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6181
6215
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6182
6216
  ><Dynamic5
@@ -6422,11 +6456,18 @@ function ContentVariants(props) {
6422
6456
  setShouldRenderVariants(false);
6423
6457
  });
6424
6458
  return <><>
6425
- <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
6426
- id="builderio-init-variants-fns"
6427
- scriptStr={getInitVariantsFnsScriptString()}
6428
- nonce={props.nonce || ""}
6429
- /></Show16>
6459
+ <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}>
6460
+ <Inlined_script_default
6461
+ id="builderio-init-variants-fns"
6462
+ scriptStr={getInitVariantsFnsScriptString()}
6463
+ nonce={props.nonce || ""}
6464
+ />
6465
+ <Show16 when={SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}><Inlined_script_default
6466
+ id="builderio-init-personalization-variants-fns"
6467
+ nonce={props.nonce || ""}
6468
+ scriptStr={getInitPersonalizationVariantsFnsScriptString()}
6469
+ /></Show16>
6470
+ </Show16>
6430
6471
  <Show16 when={shouldRenderVariants()}>
6431
6472
  <Inlined_styles_default
6432
6473
  id="builderio-variants"
@@ -6522,6 +6563,7 @@ var fetchSymbolContent = async ({
6522
6563
  // src/blocks/symbol/symbol.tsx
6523
6564
  function Symbol(props) {
6524
6565
  const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
6566
+ const [symbolEntry, setSymbolEntry] = createSignal20(props.symbol?.entry);
6525
6567
  const blocksWrapper = createMemo20(() => {
6526
6568
  return "div";
6527
6569
  });
@@ -6537,7 +6579,7 @@ function Symbol(props) {
6537
6579
  ].filter(Boolean).join(" ");
6538
6580
  });
6539
6581
  function setContent() {
6540
- if (contentToUse())
6582
+ if (contentToUse() && symbolEntry() === props.symbol?.entry)
6541
6583
  return;
6542
6584
  fetchSymbolContent({
6543
6585
  symbol: props.symbol,
@@ -6545,6 +6587,7 @@ function Symbol(props) {
6545
6587
  }).then((newContent) => {
6546
6588
  if (newContent) {
6547
6589
  setContentToUse(newContent);
6590
+ setSymbolEntry(props.symbol?.entry);
6548
6591
  }
6549
6592
  });
6550
6593
  }
@@ -6554,7 +6597,7 @@ function Symbol(props) {
6554
6597
  function onUpdateFn_0() {
6555
6598
  setContent();
6556
6599
  }
6557
- createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6600
+ createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6558
6601
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6559
6602
  nonce={props.builderContext.nonce}
6560
6603
  isNestedRender={true}