@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.
package/lib/edge/dev.jsx CHANGED
@@ -4385,15 +4385,15 @@ var Block_wrapper_default = BlockWrapper;
4385
4385
  import {
4386
4386
  Show as Show4,
4387
4387
  For,
4388
- on,
4389
- createEffect,
4388
+ on as on2,
4389
+ createEffect as createEffect2,
4390
4390
  createMemo as createMemo3,
4391
4391
  createSignal as createSignal3
4392
4392
  } from "solid-js";
4393
4393
  import { Dynamic as Dynamic3 } from "solid-js/web";
4394
4394
 
4395
4395
  // src/components/block/components/interactive-element.tsx
4396
- import { Show as Show3, createMemo as createMemo2 } from "solid-js";
4396
+ import { Show as Show3, on, createEffect, createMemo as createMemo2, createSignal as createSignal2 } from "solid-js";
4397
4397
  import { Dynamic as Dynamic2 } from "solid-js/web";
4398
4398
 
4399
4399
  // src/components/awaiter.tsx
@@ -4407,6 +4407,7 @@ var Awaiter_default = Awaiter;
4407
4407
 
4408
4408
  // src/components/block/components/interactive-element.tsx
4409
4409
  function InteractiveElement(props) {
4410
+ const [forceRenderCount, setForceRenderCount] = createSignal2(0);
4410
4411
  const attributes = createMemo2(() => {
4411
4412
  return props.includeBlockProps ? {
4412
4413
  ...getBlockProperties({
@@ -4425,6 +4426,21 @@ function InteractiveElement(props) {
4425
4426
  const targetWrapperProps = createMemo2(() => {
4426
4427
  return props.wrapperProps;
4427
4428
  });
4429
+ const onUpdateFn_0_props_wrapperProps = createMemo2(() => props.wrapperProps);
4430
+ const onUpdateFn_0_props_block__component__options = createMemo2(
4431
+ () => props.block?.component?.options
4432
+ );
4433
+ function onUpdateFn_0() {
4434
+ }
4435
+ createEffect(
4436
+ on(
4437
+ () => [
4438
+ onUpdateFn_0_props_wrapperProps(),
4439
+ onUpdateFn_0_props_block__component__options()
4440
+ ],
4441
+ onUpdateFn_0
4442
+ )
4443
+ );
4428
4444
  return <><Show3
4429
4445
  fallback={<Dynamic2
4430
4446
  {...targetWrapperProps()}
@@ -4488,8 +4504,8 @@ function ComponentRef(props) {
4488
4504
  );
4489
4505
  function onUpdateFn_0() {
4490
4506
  }
4491
- createEffect(
4492
- on(
4507
+ createEffect2(
4508
+ on2(
4493
4509
  () => [
4494
4510
  onUpdateFn_0_props_componentOptions(),
4495
4511
  onUpdateFn_0_props_blockChildren()
@@ -4523,7 +4539,7 @@ function ComponentRef(props) {
4523
4539
  var Component_ref_default = ComponentRef;
4524
4540
 
4525
4541
  // src/components/block/components/repeated-block.tsx
4526
- import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
4542
+ import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
4527
4543
  function RepeatedBlock(props) {
4528
4544
  const [store, setStore] = createSignal4(props.repeatContext);
4529
4545
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -4532,7 +4548,7 @@ function RepeatedBlock(props) {
4532
4548
  function onUpdateFn_0() {
4533
4549
  setStore(props.repeatContext);
4534
4550
  }
4535
- createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
4551
+ createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
4536
4552
  return <><builder_context_default.Provider value={store()}><Block_default
4537
4553
  block={props.block}
4538
4554
  context={store()}
@@ -4701,7 +4717,7 @@ function Block(props) {
4701
4717
  var Block_default = Block;
4702
4718
 
4703
4719
  // src/components/blocks/blocks-wrapper.tsx
4704
- import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
4720
+ import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
4705
4721
  import { Dynamic as Dynamic4 } from "solid-js/web";
4706
4722
  function BlocksWrapper(props) {
4707
4723
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -4754,10 +4770,10 @@ function BlocksWrapper(props) {
4754
4770
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
4755
4771
  function onUpdateFn_0() {
4756
4772
  }
4757
- createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
4773
+ createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
4758
4774
  return <>
4759
4775
  <Dynamic4
4760
- class={className() + " dynamic-023c60f2"}
4776
+ class={className() + " dynamic-450facf4"}
4761
4777
  ref={blocksWrapperRef}
4762
4778
  builder-path={dataPath()}
4763
4779
  builder-parent-id={props.parent}
@@ -4769,7 +4785,7 @@ function BlocksWrapper(props) {
4769
4785
  {...props.BlocksWrapperProps}
4770
4786
  component={props.BlocksWrapper}
4771
4787
  >{props.children}</Dynamic4>
4772
- <style>{`.dynamic-023c60f2 {
4788
+ <style>{`.dynamic-450facf4 {
4773
4789
  display: flex;
4774
4790
  flex-direction: column;
4775
4791
  align-items: stretch;
@@ -4787,19 +4803,22 @@ function Blocks(props) {
4787
4803
  parent={props.parent}
4788
4804
  path={props.path}
4789
4805
  styleProp={props.styleProp}
4806
+ BlocksWrapperProps={props.BlocksWrapperProps || props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
4790
4807
  classNameProp={props.className}
4791
4808
  BlocksWrapper={props.context?.BlocksWrapper || builderContext?.BlocksWrapper}
4792
- BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps}
4793
- ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4794
- const index = _index();
4795
- return <Block_default
4796
- key={block.id}
4797
- block={block}
4798
- linkComponent={props.linkComponent}
4799
- context={props.context || builderContext}
4800
- registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
4801
- />;
4802
- }}</For3></Show6></Blocks_wrapper_default></>;
4809
+ >
4810
+ {props.children}
4811
+ <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4812
+ const index = _index();
4813
+ return <Block_default
4814
+ key={block.id}
4815
+ block={block}
4816
+ linkComponent={props.linkComponent}
4817
+ context={props.context || builderContext}
4818
+ registeredComponents={props.registeredComponents || componentsContext?.registeredComponents}
4819
+ />;
4820
+ }}</For3></Show6>
4821
+ </Blocks_wrapper_default></>;
4803
4822
  }
4804
4823
  var Blocks_default = Blocks;
4805
4824
 
@@ -5146,11 +5165,171 @@ function SectionComponent(props) {
5146
5165
  var section_default = SectionComponent;
5147
5166
 
5148
5167
  // src/blocks/symbol/symbol.tsx
5149
- import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5168
+ import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5150
5169
 
5151
5170
  // src/components/content-variants/content-variants.tsx
5152
5171
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
5153
5172
 
5173
+ // src/blocks/personalization-container/helpers/inlined-fns.ts
5174
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
5175
+ function isString(val) {
5176
+ return typeof val === "string";
5177
+ }
5178
+ function isNumber(val) {
5179
+ return typeof val === "number";
5180
+ }
5181
+ function objectMatchesQuery(userattr, query2) {
5182
+ const result = (() => {
5183
+ const property = query2.property;
5184
+ const operator = query2.operator;
5185
+ let testValue = query2.value;
5186
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
5187
+ testValue = query2.value.slice(0, -1);
5188
+ }
5189
+ if (!(property && operator)) {
5190
+ return true;
5191
+ }
5192
+ if (Array.isArray(testValue)) {
5193
+ if (operator === "isNot") {
5194
+ return testValue.every((val) => objectMatchesQuery(userattr, {
5195
+ property,
5196
+ operator,
5197
+ value: val
5198
+ }));
5199
+ }
5200
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
5201
+ property,
5202
+ operator,
5203
+ value: val
5204
+ }));
5205
+ }
5206
+ const value = userattr[property];
5207
+ if (Array.isArray(value)) {
5208
+ return value.includes(testValue);
5209
+ }
5210
+ switch (operator) {
5211
+ case "is":
5212
+ return value === testValue;
5213
+ case "isNot":
5214
+ return value !== testValue;
5215
+ case "contains":
5216
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
5217
+ case "startsWith":
5218
+ return isString(value) && value.startsWith(String(testValue));
5219
+ case "endsWith":
5220
+ return isString(value) && value.endsWith(String(testValue));
5221
+ case "greaterThan":
5222
+ return isNumber(value) && isNumber(testValue) && value > testValue;
5223
+ case "lessThan":
5224
+ return isNumber(value) && isNumber(testValue) && value < testValue;
5225
+ case "greaterThanOrEqualTo":
5226
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
5227
+ case "lessThanOrEqualTo":
5228
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
5229
+ default:
5230
+ return false;
5231
+ }
5232
+ })();
5233
+ return result;
5234
+ }
5235
+ const item = {
5236
+ query,
5237
+ startDate,
5238
+ endDate
5239
+ };
5240
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
5241
+ if (item.startDate && new Date(item.startDate) > now) {
5242
+ return false;
5243
+ } else if (item.endDate && new Date(item.endDate) < now) {
5244
+ return false;
5245
+ }
5246
+ if (!item.query || !item.query.length) {
5247
+ return true;
5248
+ }
5249
+ return item.query.every((filter) => {
5250
+ return objectMatchesQuery(userAttributes, filter);
5251
+ });
5252
+ }
5253
+ 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}";
5254
+ 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}";
5255
+ 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}";
5256
+
5257
+ // src/blocks/personalization-container/helpers.ts
5258
+ var DEFAULT_INDEX = "default";
5259
+ var FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME = "filterWithCustomTargeting";
5260
+ var BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME = "builderIoPersonalization";
5261
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "updateVisibilityStylesScript";
5262
+ var SDKS_SUPPORTING_PERSONALIZATION = ["react", "vue", "svelte"];
5263
+ var SDKS_REQUIRING_RESET_APPROACH = ["vue", "svelte"];
5264
+ function checkShouldRenderVariants(variants, canTrack) {
5265
+ const hasVariants = variants && variants.length > 0;
5266
+ if (TARGET === "reactNative")
5267
+ return false;
5268
+ if (!hasVariants)
5269
+ return false;
5270
+ if (!canTrack)
5271
+ return false;
5272
+ if (SDKS_REQUIRING_RESET_APPROACH.includes(TARGET))
5273
+ return true;
5274
+ if (isBrowser())
5275
+ return false;
5276
+ return true;
5277
+ }
5278
+ function getBlocksToRender({
5279
+ variants,
5280
+ previewingIndex,
5281
+ isHydrated,
5282
+ filteredVariants,
5283
+ fallbackBlocks
5284
+ }) {
5285
+ const fallback = {
5286
+ blocks: fallbackBlocks ?? [],
5287
+ path: "this.children",
5288
+ index: DEFAULT_INDEX
5289
+ };
5290
+ if (isHydrated && isEditing()) {
5291
+ if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
5292
+ const variant = variants?.[previewingIndex];
5293
+ if (variant) {
5294
+ return {
5295
+ blocks: variant.blocks,
5296
+ path: `variants.${previewingIndex}.blocks`,
5297
+ index: previewingIndex
5298
+ };
5299
+ }
5300
+ }
5301
+ return fallback;
5302
+ }
5303
+ if (isBrowser()) {
5304
+ const winningVariant = filteredVariants?.[0];
5305
+ if (winningVariant && variants) {
5306
+ const variantIndex = variants.indexOf(winningVariant);
5307
+ if (variantIndex !== -1) {
5308
+ return {
5309
+ blocks: winningVariant.blocks,
5310
+ path: `variants.${variantIndex}.blocks`,
5311
+ index: variantIndex
5312
+ };
5313
+ }
5314
+ }
5315
+ }
5316
+ return fallback;
5317
+ }
5318
+ var getInitPersonalizationVariantsFnsScriptString = () => {
5319
+ return `
5320
+ window.${FILTER_WITH_CUSTOM_TARGETING_SCRIPT_FN_NAME} = ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
5321
+ window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME} = ${PERSONALIZATION_SCRIPT}
5322
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VISIBILITY_STYLES_SCRIPT}
5323
+ `;
5324
+ };
5325
+ var isHydrationTarget = TARGET === "react";
5326
+ var getPersonalizationScript = (variants, blockId, locale) => {
5327
+ return `window.${BUILDER_IO_PERSONALIZATION_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
5328
+ };
5329
+ var getUpdateVisibilityStylesScript = (variants, blockId, locale) => {
5330
+ return `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(${JSON.stringify(variants)}, "${blockId}", ${isHydrationTarget}${locale ? `, "${locale}"` : ""})`;
5331
+ };
5332
+
5154
5333
  // src/helpers/url.ts
5155
5334
  var getTopLevelDomain = (host) => {
5156
5335
  if (host === "localhost" || host === "127.0.0.1") {
@@ -6097,7 +6276,8 @@ var componentInfo6 = {
6097
6276
  name: "PersonalizationContainer",
6098
6277
  shouldReceiveBuilderProps: {
6099
6278
  builderBlock: true,
6100
- builderContext: true
6279
+ builderContext: true,
6280
+ builderComponents: true
6101
6281
  },
6102
6282
  noWrap: true,
6103
6283
  image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
@@ -6153,199 +6333,6 @@ function isPreviewing(_search) {
6153
6333
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
6154
6334
  }
6155
6335
 
6156
- // src/blocks/personalization-container/helpers/inlined-fns.ts
6157
- function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
6158
- function isString(val) {
6159
- return typeof val === "string";
6160
- }
6161
- function isNumber(val) {
6162
- return typeof val === "number";
6163
- }
6164
- function objectMatchesQuery(userattr, query2) {
6165
- const result = (() => {
6166
- const property = query2.property;
6167
- const operator = query2.operator;
6168
- let testValue = query2.value;
6169
- if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
6170
- testValue = query2.value.slice(0, -1);
6171
- }
6172
- if (!(property && operator)) {
6173
- return true;
6174
- }
6175
- if (Array.isArray(testValue)) {
6176
- if (operator === "isNot") {
6177
- return testValue.every((val) => objectMatchesQuery(userattr, {
6178
- property,
6179
- operator,
6180
- value: val
6181
- }));
6182
- }
6183
- return !!testValue.find((val) => objectMatchesQuery(userattr, {
6184
- property,
6185
- operator,
6186
- value: val
6187
- }));
6188
- }
6189
- const value = userattr[property];
6190
- if (Array.isArray(value)) {
6191
- return value.includes(testValue);
6192
- }
6193
- switch (operator) {
6194
- case "is":
6195
- return value === testValue;
6196
- case "isNot":
6197
- return value !== testValue;
6198
- case "contains":
6199
- return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
6200
- case "startsWith":
6201
- return isString(value) && value.startsWith(String(testValue));
6202
- case "endsWith":
6203
- return isString(value) && value.endsWith(String(testValue));
6204
- case "greaterThan":
6205
- return isNumber(value) && isNumber(testValue) && value > testValue;
6206
- case "lessThan":
6207
- return isNumber(value) && isNumber(testValue) && value < testValue;
6208
- case "greaterThanOrEqualTo":
6209
- return isNumber(value) && isNumber(testValue) && value >= testValue;
6210
- case "lessThanOrEqualTo":
6211
- return isNumber(value) && isNumber(testValue) && value <= testValue;
6212
- default:
6213
- return false;
6214
- }
6215
- })();
6216
- return result;
6217
- }
6218
- const item = {
6219
- query,
6220
- startDate,
6221
- endDate
6222
- };
6223
- const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
6224
- if (item.startDate && new Date(item.startDate) > now) {
6225
- return false;
6226
- } else if (item.endDate && new Date(item.endDate) < now) {
6227
- return false;
6228
- }
6229
- if (!item.query || !item.query.length) {
6230
- return true;
6231
- }
6232
- return item.query.every((filter) => {
6233
- return objectMatchesQuery(userAttributes, filter);
6234
- });
6235
- }
6236
- var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
6237
- if (!navigator.cookieEnabled) {
6238
- return;
6239
- }
6240
- function getCookie(name) {
6241
- const nameEQ = name + '=';
6242
- const ca = document.cookie.split(';');
6243
- for (let i = 0; i < ca.length; i++) {
6244
- let c = ca[i];
6245
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
6246
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
6247
- }
6248
- return null;
6249
- }
6250
- function removeVariants() {
6251
- variants?.forEach(function (_, index) {
6252
- document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
6253
- });
6254
- document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
6255
- document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
6256
- }
6257
- const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
6258
- if (locale) {
6259
- attributes.locale = locale;
6260
- }
6261
- const winningVariantIndex = variants?.findIndex(function (variant) {
6262
- return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
6263
- });
6264
- const isDebug = location.href.includes('builder.debug=true');
6265
- if (isDebug) {
6266
- console.debug('PersonalizationContainer', {
6267
- attributes,
6268
- variants,
6269
- winningVariantIndex
6270
- });
6271
- }
6272
- if (winningVariantIndex !== -1) {
6273
- const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
6274
- if (winningVariant) {
6275
- const parentNode = winningVariant.parentNode;
6276
- if (parentNode) {
6277
- const newParent = parentNode.cloneNode(false);
6278
- newParent.appendChild(winningVariant.content.firstChild);
6279
- newParent.appendChild(winningVariant.content.lastChild);
6280
- parentNode.parentNode?.replaceChild(newParent, parentNode);
6281
- }
6282
- if (isDebug) {
6283
- console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
6284
- }
6285
- }
6286
- } else if (variants && variants.length > 0) {
6287
- removeVariants();
6288
- }
6289
- }`;
6290
- 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}";
6291
-
6292
- // src/blocks/personalization-container/helpers.ts
6293
- function checkShouldRenderVariants(variants, canTrack) {
6294
- const hasVariants = variants && variants.length > 0;
6295
- if (TARGET === "reactNative")
6296
- return false;
6297
- if (!hasVariants)
6298
- return false;
6299
- if (!canTrack)
6300
- return false;
6301
- if (TARGET === "vue" || TARGET === "svelte")
6302
- return true;
6303
- if (isBrowser())
6304
- return false;
6305
- return true;
6306
- }
6307
- function getBlocksToRender({
6308
- variants,
6309
- previewingIndex,
6310
- isHydrated,
6311
- filteredVariants,
6312
- fallbackBlocks
6313
- }) {
6314
- const fallback = {
6315
- blocks: fallbackBlocks ?? [],
6316
- path: "this.children"
6317
- };
6318
- if (isHydrated && isEditing()) {
6319
- if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
6320
- const variant = variants[previewingIndex];
6321
- return {
6322
- blocks: variant.blocks,
6323
- path: `component.options.variants.${previewingIndex}.blocks`
6324
- };
6325
- }
6326
- return fallback;
6327
- }
6328
- if (isBrowser()) {
6329
- const winningVariant = filteredVariants?.[0];
6330
- if (winningVariant) {
6331
- return {
6332
- blocks: winningVariant.blocks,
6333
- path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
6334
- };
6335
- }
6336
- }
6337
- return fallback;
6338
- }
6339
- var getPersonalizationScript = (variants, blockId, locale) => {
6340
- return `
6341
- (function() {
6342
- ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
6343
- ${PERSONALIZATION_SCRIPT}
6344
- getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
6345
- })();
6346
- `;
6347
- };
6348
-
6349
6336
  // src/blocks/personalization-container/personalization-container.tsx
6350
6337
  function PersonalizationContainer(props) {
6351
6338
  const [userAttributes, setUserAttributes] = createSignal10(
@@ -6358,6 +6345,13 @@ function PersonalizationContainer(props) {
6358
6345
  props.builderContext?.rootState?.locale
6359
6346
  )
6360
6347
  );
6348
+ const [updateVisibilityStylesScript, setUpdateVisibilityStylesScript] = createSignal10(
6349
+ getUpdateVisibilityStylesScript(
6350
+ props.variants,
6351
+ props.builderBlock?.id || "none",
6352
+ props.builderContext?.rootState?.locale
6353
+ )
6354
+ );
6361
6355
  const [unsubscribers, setUnsubscribers] = createSignal10([]);
6362
6356
  const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
6363
6357
  checkShouldRenderVariants(
@@ -6365,7 +6359,14 @@ function PersonalizationContainer(props) {
6365
6359
  getDefaultCanTrack(props.builderContext?.canTrack)
6366
6360
  )
6367
6361
  );
6368
- const [isHydrated, setIsHydrated] = createSignal10(false);
6362
+ const [shouldResetVariants, setShouldResetVariants] = createSignal10(false);
6363
+ const attrs = createMemo10(() => {
6364
+ return {
6365
+ ...props.attributes,
6366
+ ...{},
6367
+ [getClassPropName()]: `builder-personalization-container ${props.attributes[getClassPropName()] || ""}`
6368
+ };
6369
+ });
6369
6370
  const filteredVariants = createMemo10(() => {
6370
6371
  return (props.variants || []).filter((variant) => {
6371
6372
  return filterWithCustomTargeting(
@@ -6385,22 +6386,22 @@ function PersonalizationContainer(props) {
6385
6386
  return getBlocksToRender({
6386
6387
  variants: props.variants,
6387
6388
  fallbackBlocks: props.builderBlock?.children,
6388
- isHydrated: isHydrated(),
6389
+ isHydrated: shouldResetVariants(),
6389
6390
  filteredVariants: filteredVariants(),
6390
6391
  previewingIndex: props.previewingIndex
6391
6392
  });
6392
6393
  });
6393
6394
  const hideVariantsStyleString = createMemo10(() => {
6394
6395
  return (props.variants || []).map(
6395
- (_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
6396
+ (_, index) => `div[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none !important; } `
6396
6397
  ).join("");
6397
6398
  });
6398
6399
  let rootRef;
6399
6400
  onMount5(() => {
6400
- setIsHydrated(true);
6401
+ setShouldResetVariants(true);
6401
6402
  const unsub = userAttributesService.subscribeOnUserAttributesChange(
6402
- (attrs) => {
6403
- setUserAttributes(attrs);
6403
+ (attrs2) => {
6404
+ setUserAttributes(attrs2);
6404
6405
  }
6405
6406
  );
6406
6407
  if (!(isEditing() || isPreviewing())) {
@@ -6409,7 +6410,7 @@ function PersonalizationContainer(props) {
6409
6410
  rootRef.dispatchEvent(
6410
6411
  new CustomEvent("builder.variantLoaded", {
6411
6412
  detail: {
6412
- variant: variant || "default",
6413
+ variant: variant || DEFAULT_INDEX,
6413
6414
  content: props.builderContext?.content
6414
6415
  },
6415
6416
  bubbles: true
@@ -6421,7 +6422,7 @@ function PersonalizationContainer(props) {
6421
6422
  rootRef.dispatchEvent(
6422
6423
  new CustomEvent("builder.variantDisplayed", {
6423
6424
  detail: {
6424
- variant: variant || "default",
6425
+ variant: variant || DEFAULT_INDEX,
6425
6426
  content: props.builderContext?.content
6426
6427
  },
6427
6428
  bubbles: true
@@ -6435,39 +6436,72 @@ function PersonalizationContainer(props) {
6435
6436
  }
6436
6437
  unsubscribers().push(unsub);
6437
6438
  });
6438
- return <><div
6439
- class={`builder-personalization-container ${props.attributes?.className || ""}`}
6440
- ref={rootRef}
6441
- {...props.attributes}
6442
- >
6443
- <Show10 when={shouldRenderVariants()}>
6444
- <For6 each={props.variants}>{(variant, _index) => {
6445
- const index = _index();
6446
- return <template
6447
- key={index}
6448
- data-variant-id={`${props.builderBlock?.id}-${index}`}
6449
- ><Blocks_default
6450
- blocks={variant.blocks}
6451
- parent={props.builderBlock?.id}
6452
- path={`component.options.variants.${index}.blocks`}
6453
- /></template>;
6454
- }}</For6>
6455
- <Inlined_styles_default
6456
- nonce={props.builderContext?.nonce || ""}
6457
- styles={hideVariantsStyleString()}
6458
- id={`variants-styles-${props.builderBlock?.id}`}
6459
- />
6460
- <Inlined_script_default
6461
- nonce={props.builderContext?.nonce || ""}
6462
- scriptStr={scriptStr()}
6463
- id={`variants-script-${props.builderBlock?.id}`}
6464
- />
6465
- </Show10>
6466
- <Blocks_default
6439
+ return <><div ref={rootRef} {...attrs()}>
6440
+ <Show10
6441
+ when={shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
6442
+ ><Blocks_default
6467
6443
  blocks={blocksToRender().blocks}
6468
6444
  parent={props.builderBlock?.id}
6469
6445
  path={blocksToRender().path}
6470
- />
6446
+ context={props.builderContext}
6447
+ registeredComponents={props.builderComponents}
6448
+ BlocksWrapperProps={{
6449
+ ...props.builderContext?.BlocksWrapperProps,
6450
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
6451
+ }}
6452
+ /></Show10>
6453
+ <Show10
6454
+ when={!shouldResetVariants() && SDKS_REQUIRING_RESET_APPROACH.includes(TARGET) || !SDKS_REQUIRING_RESET_APPROACH.includes(TARGET)}
6455
+ >
6456
+ <Show10 when={shouldRenderVariants()}>
6457
+ <Inlined_styles_default
6458
+ nonce={props.builderContext?.nonce || ""}
6459
+ styles={hideVariantsStyleString()}
6460
+ id={`variants-styles-${props.builderBlock?.id}`}
6461
+ />
6462
+ <Inlined_script_default
6463
+ nonce={props.builderContext?.nonce || ""}
6464
+ scriptStr={updateVisibilityStylesScript()}
6465
+ id={`variants-visibility-script-${props.builderBlock?.id}`}
6466
+ />
6467
+ <For6 each={props.variants}>{(variant, _index) => {
6468
+ const index = _index();
6469
+ return <Blocks_default
6470
+ key={`${props.builderBlock?.id}-${index}`}
6471
+ BlocksWrapperProps={{
6472
+ ...props.builderContext?.BlocksWrapperProps,
6473
+ "aria-hidden": true,
6474
+ hidden: true,
6475
+ "data-variant-id": `${props.builderBlock?.id}-${index}`
6476
+ }}
6477
+ blocks={variant.blocks}
6478
+ parent={props.builderBlock?.id}
6479
+ path={`component.options.variants.${index}.blocks`}
6480
+ context={props.builderContext}
6481
+ registeredComponents={props.builderComponents}
6482
+ ><Inlined_script_default
6483
+ nonce={props.builderContext?.nonce || ""}
6484
+ scriptStr={scriptStr()}
6485
+ id={`variants-script-${props.builderBlock?.id}-${index}`}
6486
+ /></Blocks_default>;
6487
+ }}</For6>
6488
+ </Show10>
6489
+ <Blocks_default
6490
+ blocks={blocksToRender().blocks}
6491
+ parent={props.builderBlock?.id}
6492
+ path={blocksToRender().path}
6493
+ context={props.builderContext}
6494
+ registeredComponents={props.builderComponents}
6495
+ BlocksWrapperProps={{
6496
+ ...props.builderContext?.BlocksWrapperProps,
6497
+ "data-variant-id": `${props.builderBlock?.id}-${blocksToRender().index}`
6498
+ }}
6499
+ ><Show10 when={shouldRenderVariants()}><Inlined_script_default
6500
+ nonce={props.builderContext?.nonce || ""}
6501
+ scriptStr={scriptStr()}
6502
+ id={`variants-script-${props.builderBlock?.id}-${DEFAULT_INDEX}`}
6503
+ /></Show10></Blocks_default>
6504
+ </Show10>
6471
6505
  </div></>;
6472
6506
  }
6473
6507
  var personalization_container_default = PersonalizationContainer;
@@ -6859,7 +6893,7 @@ var componentInfo12 = {
6859
6893
  };
6860
6894
 
6861
6895
  // src/blocks/custom-code/custom-code.tsx
6862
- import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
6896
+ import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
6863
6897
  function CustomCode(props) {
6864
6898
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
6865
6899
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -6909,7 +6943,7 @@ function CustomCode(props) {
6909
6943
  runScripts();
6910
6944
  }
6911
6945
  }
6912
- createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
6946
+ createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
6913
6947
  return <><div
6914
6948
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
6915
6949
  ref={elementRef}
@@ -6937,7 +6971,7 @@ var componentInfo13 = {
6937
6971
  };
6938
6972
 
6939
6973
  // src/blocks/embed/embed.tsx
6940
- import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6974
+ import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6941
6975
 
6942
6976
  // src/blocks/embed/helpers.ts
6943
6977
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -6979,8 +7013,8 @@ function Embed(props) {
6979
7013
  findAndRunScripts();
6980
7014
  }
6981
7015
  }
6982
- createEffect6(
6983
- on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
7016
+ createEffect7(
7017
+ on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
6984
7018
  );
6985
7019
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
6986
7020
  }
@@ -7990,7 +8024,7 @@ var getDefaultRegisteredComponents = () => [{
7990
8024
  }, {
7991
8025
  component: text_default,
7992
8026
  ...componentInfo11
7993
- }, ...TARGET === "react" ? [{
8027
+ }, ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [{
7994
8028
  component: personalization_container_default,
7995
8029
  ...componentInfo6
7996
8030
  }] : [], ...TARGET === "rsc" ? [] : [{
@@ -8027,7 +8061,7 @@ var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variant
8027
8061
 
8028
8062
  // src/components/content-variants/helpers.ts
8029
8063
  var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
8030
- var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
8064
+ var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2 = "builderIoRenderContent";
8031
8065
  var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
8032
8066
  ...variant,
8033
8067
  testVariationId: variant.id,
@@ -8052,28 +8086,28 @@ var checkShouldRenderVariants2 = ({
8052
8086
  };
8053
8087
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
8054
8088
  var isAngularSDK = TARGET === "angular";
8055
- var isHydrationTarget = getIsHydrationTarget(TARGET);
8089
+ var isHydrationTarget2 = getIsHydrationTarget(TARGET);
8056
8090
  var getInitVariantsFnsScriptString = () => `
8057
8091
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
8058
- window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
8092
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
8059
8093
  `;
8060
8094
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
8061
8095
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
8062
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
8096
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget2}, ${isAngularSDK}
8063
8097
  )`;
8064
8098
  var getUpdateVariantVisibilityScript = ({
8065
8099
  contentId,
8066
8100
  variationId
8067
- }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
8068
- "${variationId}", "${contentId}", ${isHydrationTarget}
8101
+ }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME2}(
8102
+ "${variationId}", "${contentId}", ${isHydrationTarget2}
8069
8103
  )`;
8070
8104
 
8071
8105
  // src/components/content/components/enable-editor.tsx
8072
8106
  import {
8073
8107
  Show as Show14,
8074
8108
  onMount as onMount8,
8075
- on as on7,
8076
- createEffect as createEffect7,
8109
+ on as on8,
8110
+ createEffect as createEffect8,
8077
8111
  createMemo as createMemo16,
8078
8112
  createSignal as createSignal16
8079
8113
  } from "solid-js";
@@ -8085,7 +8119,7 @@ function getPreviewContent(_searchParams) {
8085
8119
  }
8086
8120
 
8087
8121
  // src/constants/sdk-version.ts
8088
- var SDK_VERSION = "4.0.7";
8122
+ var SDK_VERSION = "4.0.9";
8089
8123
 
8090
8124
  // src/helpers/sdk-headers.ts
8091
8125
  var getSdkHeaders = () => ({
@@ -9177,15 +9211,15 @@ function EnableEditor(props) {
9177
9211
  mergeNewContent(props.content);
9178
9212
  }
9179
9213
  }
9180
- createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9214
+ createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9181
9215
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
9182
9216
  () => props.builderContextSignal.rootState
9183
9217
  );
9184
9218
  function onUpdateFn_1() {
9185
9219
  emitStateUpdate();
9186
9220
  }
9187
- createEffect7(
9188
- on7(
9221
+ createEffect8(
9222
+ on8(
9189
9223
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
9190
9224
  onUpdateFn_1
9191
9225
  )
@@ -9196,7 +9230,7 @@ function EnableEditor(props) {
9196
9230
  mergeNewRootState(props.data);
9197
9231
  }
9198
9232
  }
9199
- createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9233
+ createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9200
9234
  const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
9201
9235
  function onUpdateFn_3() {
9202
9236
  if (props.locale) {
@@ -9205,7 +9239,7 @@ function EnableEditor(props) {
9205
9239
  });
9206
9240
  }
9207
9241
  }
9208
- createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9242
+ createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9209
9243
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
9210
9244
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
9211
9245
  ><Dynamic5
@@ -9451,11 +9485,18 @@ function ContentVariants(props) {
9451
9485
  setShouldRenderVariants(false);
9452
9486
  });
9453
9487
  return <><>
9454
- <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
9455
- id="builderio-init-variants-fns"
9456
- scriptStr={getInitVariantsFnsScriptString()}
9457
- nonce={props.nonce || ""}
9458
- /></Show16>
9488
+ <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}>
9489
+ <Inlined_script_default
9490
+ id="builderio-init-variants-fns"
9491
+ scriptStr={getInitVariantsFnsScriptString()}
9492
+ nonce={props.nonce || ""}
9493
+ />
9494
+ <Show16 when={SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET)}><Inlined_script_default
9495
+ id="builderio-init-personalization-variants-fns"
9496
+ nonce={props.nonce || ""}
9497
+ scriptStr={getInitPersonalizationVariantsFnsScriptString()}
9498
+ /></Show16>
9499
+ </Show16>
9459
9500
  <Show16 when={shouldRenderVariants()}>
9460
9501
  <Inlined_styles_default
9461
9502
  id="builderio-variants"
@@ -9551,6 +9592,7 @@ var fetchSymbolContent = async ({
9551
9592
  // src/blocks/symbol/symbol.tsx
9552
9593
  function Symbol2(props) {
9553
9594
  const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
9595
+ const [symbolEntry, setSymbolEntry] = createSignal20(props.symbol?.entry);
9554
9596
  const blocksWrapper = createMemo20(() => {
9555
9597
  return "div";
9556
9598
  });
@@ -9566,7 +9608,7 @@ function Symbol2(props) {
9566
9608
  ].filter(Boolean).join(" ");
9567
9609
  });
9568
9610
  function setContent() {
9569
- if (contentToUse())
9611
+ if (contentToUse() && symbolEntry() === props.symbol?.entry)
9570
9612
  return;
9571
9613
  fetchSymbolContent({
9572
9614
  symbol: props.symbol,
@@ -9574,6 +9616,7 @@ function Symbol2(props) {
9574
9616
  }).then((newContent) => {
9575
9617
  if (newContent) {
9576
9618
  setContentToUse(newContent);
9619
+ setSymbolEntry(props.symbol?.entry);
9577
9620
  }
9578
9621
  });
9579
9622
  }
@@ -9583,7 +9626,7 @@ function Symbol2(props) {
9583
9626
  function onUpdateFn_0() {
9584
9627
  setContent();
9585
9628
  }
9586
- createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9629
+ createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9587
9630
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
9588
9631
  nonce={props.builderContext.nonce}
9589
9632
  isNestedRender={true}