@builder.io/sdk-solid 2.0.2 → 2.0.5

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.
@@ -520,6 +520,9 @@ function assign(target, ..._args) {
520
520
  return to;
521
521
  }
522
522
  function bindAnimations(animations) {
523
+ if (TARGET === "reactNative") {
524
+ return;
525
+ }
523
526
  for (const animation of animations) {
524
527
  switch (animation.trigger) {
525
528
  case "pageLoad":
@@ -1464,6 +1467,7 @@ function Columns(props) {
1464
1467
  return breakpointSizes[size].max;
1465
1468
  }
1466
1469
  function columnsStyles() {
1470
+ const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
1467
1471
  return `
1468
1472
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
1469
1473
  .${props.builderBlock.id}-breakpoints {
@@ -1471,7 +1475,7 @@ function Columns(props) {
1471
1475
  align-items: stretch;
1472
1476
  }
1473
1477
 
1474
- .${props.builderBlock.id}-breakpoints > .builder-column {
1478
+ ${childColumnDiv} {
1475
1479
  width: var(--column-width-tablet) !important;
1476
1480
  margin-left: var(--column-margin-left-tablet) !important;
1477
1481
  }
@@ -1483,7 +1487,7 @@ function Columns(props) {
1483
1487
  align-items: stretch;
1484
1488
  }
1485
1489
 
1486
- .${props.builderBlock.id}-breakpoints > .builder-column {
1490
+ ${childColumnDiv} {
1487
1491
  width: var(--column-width-mobile) !important;
1488
1492
  margin-left: var(--column-margin-left-mobile) !important;
1489
1493
  }
@@ -1502,7 +1506,7 @@ function Columns(props) {
1502
1506
  }
1503
1507
  return <>
1504
1508
  <div
1505
- class={getColumnsClass(props.builderBlock?.id) + " div-5b8fb3ac"}
1509
+ class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1506
1510
  style={columnsCssVars()}
1507
1511
  {...{}}
1508
1512
  >
@@ -1531,7 +1535,7 @@ function Columns(props) {
1531
1535
  /></Dynamic_renderer_default>;
1532
1536
  }}</For4>
1533
1537
  </div>
1534
- <style>{`.div-5b8fb3ac {
1538
+ <style>{`.div-3ff242de {
1535
1539
  display: flex;
1536
1540
  line-height: normal;
1537
1541
  }`}</style>
@@ -1546,7 +1550,7 @@ function FragmentComponent(props) {
1546
1550
  var fragment_default = FragmentComponent;
1547
1551
 
1548
1552
  // src/blocks/image/image.tsx
1549
- import { Show as Show7, createMemo as createMemo8 } from "solid-js";
1553
+ import { Show as Show7, onMount as onMount2, createMemo as createMemo8 } from "solid-js";
1550
1554
 
1551
1555
  // src/blocks/image/image.helpers.ts
1552
1556
  function removeProtocol(path) {
@@ -1636,12 +1640,14 @@ function Image(props) {
1636
1640
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1637
1641
  return out;
1638
1642
  });
1643
+ onMount2(() => {
1644
+ });
1639
1645
  return <>
1640
1646
  <>
1641
1647
  <picture>
1642
1648
  <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1643
1649
  <img
1644
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
1650
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1645
1651
  loading={props.highPriority ? "eager" : "lazy"}
1646
1652
  fetchpriority={props.highPriority ? "high" : "auto"}
1647
1653
  alt={props.altText}
@@ -1659,22 +1665,22 @@ function Image(props) {
1659
1665
  <Show7
1660
1666
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1661
1667
  ><div
1662
- class="builder-image-sizer div-e3b1053e"
1668
+ class="builder-image-sizer div-4512e110"
1663
1669
  style={{
1664
1670
  "padding-top": props.aspectRatio * 100 + "%"
1665
1671
  }}
1666
1672
  /></Show7>
1667
1673
  <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1668
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
1674
+ <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1669
1675
  </>
1670
- <style>{`.img-e3b1053e {
1676
+ <style>{`.img-4512e110 {
1671
1677
  opacity: 1;
1672
1678
  transition: opacity 0.2s ease-in-out;
1673
- }.div-e3b1053e {
1679
+ }.div-4512e110 {
1674
1680
  width: 100%;
1675
1681
  pointer-events: none;
1676
1682
  font-size: 0;
1677
- }.div-e3b1053e-2 {
1683
+ }.div-4512e110-2 {
1678
1684
  display: flex;
1679
1685
  flex-direction: column;
1680
1686
  align-items: stretch;
@@ -1710,10 +1716,10 @@ function SectionComponent(props) {
1710
1716
  var section_default = SectionComponent;
1711
1717
 
1712
1718
  // src/blocks/symbol/symbol.tsx
1713
- import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
1719
+ import { onMount as onMount6, on as on3, createEffect as createEffect3, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1714
1720
 
1715
1721
  // src/components/content-variants/content-variants.tsx
1716
- import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
1722
+ import { Show as Show14, For as For9, onMount as onMount5, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1717
1723
 
1718
1724
  // src/helpers/url.ts
1719
1725
  var getTopLevelDomain = (host) => {
@@ -1907,7 +1913,7 @@ var handleABTesting = async ({
1907
1913
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1908
1914
 
1909
1915
  // src/components/content/content.tsx
1910
- import { Show as Show13, createSignal as createSignal17 } from "solid-js";
1916
+ import { Show as Show13, createSignal as createSignal18 } from "solid-js";
1911
1917
 
1912
1918
  // src/blocks/accordion/component-info.ts
1913
1919
  var defaultTitle = {
@@ -2921,7 +2927,8 @@ var tabs_default = Tabs;
2921
2927
  // src/blocks/text/component-info.ts
2922
2928
  var componentInfo10 = {
2923
2929
  shouldReceiveBuilderProps: {
2924
- builderBlock: TARGET === "reactNative" ? true : false
2930
+ builderBlock: TARGET === "reactNative" ? true : false,
2931
+ builderContext: true
2925
2932
  },
2926
2933
  name: "Text",
2927
2934
  static: true,
@@ -2943,10 +2950,31 @@ var componentInfo10 = {
2943
2950
  };
2944
2951
 
2945
2952
  // src/blocks/text/text.tsx
2953
+ import { createMemo as createMemo11 } from "solid-js";
2946
2954
  function Text(props) {
2955
+ const processedText = createMemo11(() => {
2956
+ const context = props.builderContext;
2957
+ const {
2958
+ context: contextContext,
2959
+ localState,
2960
+ rootState,
2961
+ rootSetState
2962
+ } = context;
2963
+ return String(props.text?.toString() || "").replace(
2964
+ /{{([^}]+)}}/g,
2965
+ (match, group) => evaluate({
2966
+ code: group,
2967
+ context: contextContext,
2968
+ localState,
2969
+ rootState,
2970
+ rootSetState,
2971
+ enableCache: false
2972
+ })
2973
+ );
2974
+ });
2947
2975
  return <><div
2948
2976
  class="builder-text"
2949
- innerHTML={props.text?.toString() || ""}
2977
+ innerHTML={processedText()}
2950
2978
  style={{
2951
2979
  outline: "none"
2952
2980
  }}
@@ -2980,12 +3008,12 @@ var componentInfo11 = {
2980
3008
  };
2981
3009
 
2982
3010
  // src/blocks/custom-code/custom-code.tsx
2983
- import { onMount as onMount2, createSignal as createSignal11 } from "solid-js";
3011
+ import { onMount as onMount3, createSignal as createSignal12 } from "solid-js";
2984
3012
  function CustomCode(props) {
2985
- const [scriptsInserted, setScriptsInserted] = createSignal11([]);
2986
- const [scriptsRun, setScriptsRun] = createSignal11([]);
3013
+ const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3014
+ const [scriptsRun, setScriptsRun] = createSignal12([]);
2987
3015
  let elementRef;
2988
- onMount2(() => {
3016
+ onMount3(() => {
2989
3017
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
2990
3018
  return;
2991
3019
  }
@@ -3045,7 +3073,7 @@ var componentInfo12 = {
3045
3073
  };
3046
3074
 
3047
3075
  // src/blocks/embed/embed.tsx
3048
- import { on, createEffect, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3076
+ import { on, createEffect, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3049
3077
 
3050
3078
  // src/blocks/embed/helpers.ts
3051
3079
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3053,9 +3081,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
3053
3081
 
3054
3082
  // src/blocks/embed/embed.tsx
3055
3083
  function Embed(props) {
3056
- const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3057
- const [scriptsRun, setScriptsRun] = createSignal12([]);
3058
- const [ranInitFn, setRanInitFn] = createSignal12(false);
3084
+ const [scriptsInserted, setScriptsInserted] = createSignal13([]);
3085
+ const [scriptsRun, setScriptsRun] = createSignal13([]);
3086
+ const [ranInitFn, setRanInitFn] = createSignal13(false);
3059
3087
  function findAndRunScripts() {
3060
3088
  if (!elem || !elem.getElementsByTagName)
3061
3089
  return;
@@ -3079,8 +3107,8 @@ function Embed(props) {
3079
3107
  }
3080
3108
  }
3081
3109
  let elem;
3082
- const onUpdateFn_0_elem = createMemo12(() => elem);
3083
- const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
3110
+ const onUpdateFn_0_elem = createMemo13(() => elem);
3111
+ const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
3084
3112
  function onUpdateFn_0() {
3085
3113
  if (elem && !ranInitFn()) {
3086
3114
  setRanInitFn(true);
@@ -3335,7 +3363,7 @@ var componentInfo13 = {
3335
3363
  };
3336
3364
 
3337
3365
  // src/blocks/form/form/form.tsx
3338
- import { Show as Show10, For as For7, createSignal as createSignal13 } from "solid-js";
3366
+ import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3339
3367
 
3340
3368
  // src/functions/get-env.ts
3341
3369
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3352,9 +3380,9 @@ var get = (obj, path, defaultValue) => {
3352
3380
 
3353
3381
  // src/blocks/form/form/form.tsx
3354
3382
  function FormComponent(props) {
3355
- const [formState, setFormState] = createSignal13("unsubmitted");
3356
- const [responseData, setResponseData] = createSignal13(null);
3357
- const [formErrorMessage, setFormErrorMessage] = createSignal13("");
3383
+ const [formState, setFormState] = createSignal14("unsubmitted");
3384
+ const [responseData, setResponseData] = createSignal14(null);
3385
+ const [formErrorMessage, setFormErrorMessage] = createSignal14("");
3358
3386
  function mergeNewRootState(newData) {
3359
3387
  const combinedState = {
3360
3388
  ...props.builderContext.rootState,
@@ -3927,9 +3955,9 @@ var componentInfo19 = {
3927
3955
  };
3928
3956
 
3929
3957
  // src/blocks/video/video.tsx
3930
- import { Show as Show11, createMemo as createMemo14 } from "solid-js";
3958
+ import { Show as Show11, createMemo as createMemo15 } from "solid-js";
3931
3959
  function Video(props) {
3932
- const videoProps = createMemo14(() => {
3960
+ const videoProps = createMemo15(() => {
3933
3961
  return {
3934
3962
  ...props.autoPlay === true ? {
3935
3963
  autoPlay: true
@@ -3948,7 +3976,7 @@ function Video(props) {
3948
3976
  } : {}
3949
3977
  };
3950
3978
  });
3951
- const spreadProps = createMemo14(() => {
3979
+ const spreadProps = createMemo15(() => {
3952
3980
  return {
3953
3981
  ...videoProps()
3954
3982
  };
@@ -4086,17 +4114,14 @@ var serializeFn = (fnValue) => {
4086
4114
  const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
4087
4115
  return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
4088
4116
  };
4089
- var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
4090
- var serializeComponentInfo = ({
4091
- inputs,
4092
- ...info
4093
- }) => ({
4094
- ...fastClone(info),
4095
- inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
4096
- ...acc,
4097
- [key]: serializeValue(value)
4098
- }), {}))
4099
- });
4117
+ function serializeComponentInfo(info) {
4118
+ return JSON.parse(JSON.stringify(info, (key, value) => {
4119
+ if (typeof value === "function") {
4120
+ return serializeFn(value);
4121
+ }
4122
+ return value;
4123
+ }));
4124
+ }
4100
4125
 
4101
4126
  // src/components/content-variants/inlined-fns.ts
4102
4127
  var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\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 cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
@@ -4157,11 +4182,11 @@ var Inlined_script_default = InlinedScript;
4157
4182
  // src/components/content/components/enable-editor.tsx
4158
4183
  import {
4159
4184
  Show as Show12,
4160
- onMount as onMount3,
4185
+ onMount as onMount4,
4161
4186
  on as on2,
4162
4187
  createEffect as createEffect2,
4163
- createMemo as createMemo15,
4164
- createSignal as createSignal15
4188
+ createMemo as createMemo16,
4189
+ createSignal as createSignal16
4165
4190
  } from "solid-js";
4166
4191
  import { Dynamic as Dynamic5 } from "solid-js/web";
4167
4192
 
@@ -4664,7 +4689,7 @@ function isFromTrustedHost(trustedHosts, e) {
4664
4689
  }
4665
4690
 
4666
4691
  // src/constants/sdk-version.ts
4667
- var SDK_VERSION = "2.0.2";
4692
+ var SDK_VERSION = "2.0.5";
4668
4693
 
4669
4694
  // src/functions/register.ts
4670
4695
  var registry = {};
@@ -4942,12 +4967,12 @@ var getWrapperClassName = (variationId) => {
4942
4967
 
4943
4968
  // src/components/content/components/enable-editor.tsx
4944
4969
  function EnableEditor(props) {
4945
- const [ContentWrapper, setContentWrapper] = createSignal15(
4970
+ const [ContentWrapper, setContentWrapper] = createSignal16(
4946
4971
  props.contentWrapper || "div"
4947
4972
  );
4948
- const [httpReqsData, setHttpReqsData] = createSignal15({});
4949
- const [httpReqsPending, setHttpReqsPending] = createSignal15({});
4950
- const [clicked, setClicked] = createSignal15(false);
4973
+ const [httpReqsData, setHttpReqsData] = createSignal16({});
4974
+ const [httpReqsPending, setHttpReqsPending] = createSignal16({});
4975
+ const [clicked, setClicked] = createSignal16(false);
4951
4976
  function mergeNewRootState(newData) {
4952
4977
  const combinedState = {
4953
4978
  ...props.builderContextSignal.rootState,
@@ -4981,7 +5006,7 @@ function EnableEditor(props) {
4981
5006
  content: newContentValue
4982
5007
  }));
4983
5008
  }
4984
- const showContentProps = createMemo15(() => {
5009
+ const showContentProps = createMemo16(() => {
4985
5010
  return props.showContent ? {} : {
4986
5011
  hidden: true,
4987
5012
  "aria-hidden": true
@@ -5101,7 +5126,7 @@ function EnableEditor(props) {
5101
5126
  }
5102
5127
  }
5103
5128
  let elementRef;
5104
- onMount3(() => {
5129
+ onMount4(() => {
5105
5130
  if (isBrowser()) {
5106
5131
  if (isEditing()) {
5107
5132
  window.addEventListener("message", processMessage);
@@ -5162,7 +5187,7 @@ function EnableEditor(props) {
5162
5187
  }
5163
5188
  }
5164
5189
  });
5165
- onMount3(() => {
5190
+ onMount4(() => {
5166
5191
  if (!props.apiKey) {
5167
5192
  logger.error(
5168
5193
  "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
@@ -5172,14 +5197,14 @@ function EnableEditor(props) {
5172
5197
  runHttpRequests();
5173
5198
  emitStateUpdate();
5174
5199
  });
5175
- const onUpdateFn_0_props_content = createMemo15(() => props.content);
5200
+ const onUpdateFn_0_props_content = createMemo16(() => props.content);
5176
5201
  function onUpdateFn_0() {
5177
5202
  if (props.content) {
5178
5203
  mergeNewContent(props.content);
5179
5204
  }
5180
5205
  }
5181
5206
  createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5182
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo15(() => props.builderContextSignal.content?.data?.jsCode);
5207
+ const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5183
5208
  function onUpdateFn_1() {
5184
5209
  evaluateJsCode();
5185
5210
  }
@@ -5189,7 +5214,7 @@ function EnableEditor(props) {
5189
5214
  onUpdateFn_1
5190
5215
  )
5191
5216
  );
5192
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo15(() => props.builderContextSignal.content?.data?.httpRequests);
5217
+ const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5193
5218
  function onUpdateFn_2() {
5194
5219
  runHttpRequests();
5195
5220
  }
@@ -5201,7 +5226,7 @@ function EnableEditor(props) {
5201
5226
  onUpdateFn_2
5202
5227
  )
5203
5228
  );
5204
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo15(
5229
+ const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5205
5230
  () => props.builderContextSignal.rootState
5206
5231
  );
5207
5232
  function onUpdateFn_3() {
@@ -5213,14 +5238,14 @@ function EnableEditor(props) {
5213
5238
  onUpdateFn_3
5214
5239
  )
5215
5240
  );
5216
- const onUpdateFn_4_props_data = createMemo15(() => props.data);
5241
+ const onUpdateFn_4_props_data = createMemo16(() => props.data);
5217
5242
  function onUpdateFn_4() {
5218
5243
  if (props.data) {
5219
5244
  mergeNewRootState(props.data);
5220
5245
  }
5221
5246
  }
5222
5247
  createEffect2(on2(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5223
- const onUpdateFn_5_props_locale = createMemo15(() => props.locale);
5248
+ const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5224
5249
  function onUpdateFn_5() {
5225
5250
  if (props.locale) {
5226
5251
  mergeNewRootState({
@@ -5247,9 +5272,9 @@ function EnableEditor(props) {
5247
5272
  var Enable_editor_default = EnableEditor;
5248
5273
 
5249
5274
  // src/components/content/components/styles.tsx
5250
- import { createSignal as createSignal16 } from "solid-js";
5275
+ import { createSignal as createSignal17 } from "solid-js";
5251
5276
  function ContentStyles(props) {
5252
- const [injectedStyles, setInjectedStyles] = createSignal16(
5277
+ const [injectedStyles, setInjectedStyles] = createSignal17(
5253
5278
  `
5254
5279
  ${getCss({
5255
5280
  cssCode: props.cssCode,
@@ -5307,7 +5332,7 @@ var getContentInitialValue = ({
5307
5332
 
5308
5333
  // src/components/content/content.tsx
5309
5334
  function ContentComponent(props) {
5310
- const [scriptStr, setScriptStr] = createSignal17(
5335
+ const [scriptStr, setScriptStr] = createSignal18(
5311
5336
  getUpdateVariantVisibilityScript({
5312
5337
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
5313
5338
  variationId: props.content?.testVariationId,
@@ -5315,7 +5340,7 @@ function ContentComponent(props) {
5315
5340
  contentId: props.content?.id
5316
5341
  })
5317
5342
  );
5318
- const [registeredComponents, setRegisteredComponents] = createSignal17(
5343
+ const [registeredComponents, setRegisteredComponents] = createSignal18(
5319
5344
  [
5320
5345
  ...getDefaultRegisteredComponents(),
5321
5346
  ...props.customComponents?.filter(({ models }) => {
@@ -5336,7 +5361,7 @@ function ContentComponent(props) {
5336
5361
  {}
5337
5362
  )
5338
5363
  );
5339
- const [builderContextSignal, setBuilderContextSignal] = createSignal17({
5364
+ const [builderContextSignal, setBuilderContextSignal] = createSignal18({
5340
5365
  content: getContentInitialValue({
5341
5366
  content: props.content,
5342
5367
  data: props.data
@@ -5426,13 +5451,13 @@ var Content_default = ContentComponent;
5426
5451
 
5427
5452
  // src/components/content-variants/content-variants.tsx
5428
5453
  function ContentVariants(props) {
5429
- const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
5454
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
5430
5455
  checkShouldRenderVariants({
5431
5456
  canTrack: getDefaultCanTrack(props.canTrack),
5432
5457
  content: props.content
5433
5458
  })
5434
5459
  );
5435
- const updateCookieAndStylesScriptStr = createMemo18(() => {
5460
+ const updateCookieAndStylesScriptStr = createMemo19(() => {
5436
5461
  return getUpdateCookieAndStylesScript(
5437
5462
  getVariants(props.content).map((value) => ({
5438
5463
  id: value.testVariationId,
@@ -5441,10 +5466,10 @@ function ContentVariants(props) {
5441
5466
  props.content?.id || ""
5442
5467
  );
5443
5468
  });
5444
- const hideVariantsStyleString = createMemo18(() => {
5469
+ const hideVariantsStyleString = createMemo19(() => {
5445
5470
  return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
5446
5471
  });
5447
- const defaultContent = createMemo18(() => {
5472
+ const defaultContent = createMemo19(() => {
5448
5473
  return shouldRenderVariants() ? {
5449
5474
  ...props.content,
5450
5475
  testVariationId: props.content?.id
@@ -5453,7 +5478,7 @@ function ContentVariants(props) {
5453
5478
  canTrack: getDefaultCanTrack(props.canTrack)
5454
5479
  });
5455
5480
  });
5456
- onMount4(() => {
5481
+ onMount5(() => {
5457
5482
  setShouldRenderVariants(false);
5458
5483
  });
5459
5484
  return <><>
@@ -5553,14 +5578,14 @@ var fetchSymbolContent = async ({
5553
5578
 
5554
5579
  // src/blocks/symbol/symbol.tsx
5555
5580
  function Symbol(props) {
5556
- const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
5557
- const blocksWrapper = createMemo19(() => {
5581
+ const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
5582
+ const blocksWrapper = createMemo20(() => {
5558
5583
  return "div";
5559
5584
  });
5560
- const contentWrapper = createMemo19(() => {
5585
+ const contentWrapper = createMemo20(() => {
5561
5586
  return "div";
5562
5587
  });
5563
- const className = createMemo19(() => {
5588
+ const className = createMemo20(() => {
5564
5589
  return [
5565
5590
  ...[props.attributes[getClassPropName()]],
5566
5591
  "builder-symbol",
@@ -5580,9 +5605,9 @@ function Symbol(props) {
5580
5605
  }
5581
5606
  });
5582
5607
  }
5583
- onMount5(() => {
5608
+ onMount6(() => {
5584
5609
  });
5585
- const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
5610
+ const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5586
5611
  function onUpdateFn_0() {
5587
5612
  setContent();
5588
5613
  }
@@ -531,6 +531,9 @@ function assign(target, ..._args) {
531
531
  return to;
532
532
  }
533
533
  function bindAnimations(animations) {
534
+ if (TARGET === "reactNative") {
535
+ return;
536
+ }
534
537
  for (const animation of animations) {
535
538
  switch (animation.trigger) {
536
539
  case "pageLoad":
@@ -1557,7 +1560,7 @@ var getColumnsClass = (id) => {
1557
1560
 
1558
1561
  // src/blocks/columns/columns.tsx
1559
1562
  var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
1560
- var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-5b8fb3ac {
1563
+ var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
1561
1564
  display: flex;
1562
1565
  line-height: normal;
1563
1566
  }`);
@@ -1637,6 +1640,7 @@ function Columns(props) {
1637
1640
  return breakpointSizes[size].max;
1638
1641
  }
1639
1642
  function columnsStyles() {
1643
+ const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
1640
1644
  return `
1641
1645
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
1642
1646
  .${props.builderBlock.id}-breakpoints {
@@ -1644,7 +1648,7 @@ function Columns(props) {
1644
1648
  align-items: stretch;
1645
1649
  }
1646
1650
 
1647
- .${props.builderBlock.id}-breakpoints > .builder-column {
1651
+ ${childColumnDiv} {
1648
1652
  width: var(--column-width-tablet) !important;
1649
1653
  margin-left: var(--column-margin-left-tablet) !important;
1650
1654
  }
@@ -1656,7 +1660,7 @@ function Columns(props) {
1656
1660
  align-items: stretch;
1657
1661
  }
1658
1662
 
1659
- .${props.builderBlock.id}-breakpoints > .builder-column {
1663
+ ${childColumnDiv} {
1660
1664
  width: var(--column-width-mobile) !important;
1661
1665
  margin-left: var(--column-margin-left-mobile) !important;
1662
1666
  }
@@ -1677,7 +1681,7 @@ function Columns(props) {
1677
1681
  const _el$ = _tmpl$3();
1678
1682
  spread(_el$, mergeProps({
1679
1683
  get ["class"]() {
1680
- return getColumnsClass(props.builderBlock?.id) + " div-5b8fb3ac";
1684
+ return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
1681
1685
  },
1682
1686
  get style() {
1683
1687
  return columnsCssVars();
@@ -1802,16 +1806,16 @@ function getSrcSet(url) {
1802
1806
  // src/blocks/image/image.tsx
1803
1807
  var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
1804
1808
  var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
1805
- var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
1806
- var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
1807
- var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
1809
+ var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-4512e110">`);
1810
+ var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-4512e110-2>`);
1811
+ var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-4512e110 {
1808
1812
  opacity: 1;
1809
1813
  transition: opacity 0.2s ease-in-out;
1810
- }.div-e3b1053e {
1814
+ }.div-4512e110 {
1811
1815
  width: 100%;
1812
1816
  pointer-events: none;
1813
1817
  font-size: 0;
1814
- }.div-e3b1053e-2 {
1818
+ }.div-4512e110-2 {
1815
1819
  display: flex;
1816
1820
  flex-direction: column;
1817
1821
  align-items: stretch;
@@ -1860,6 +1864,8 @@ function Image(props) {
1860
1864
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1861
1865
  return out;
1862
1866
  });
1867
+ onMount(() => {
1868
+ });
1863
1869
  return [[(() => {
1864
1870
  const _el$ = _tmpl$23(), _el$3 = _el$.firstChild;
1865
1871
  insert(_el$, createComponent(Show, {
@@ -1873,7 +1879,7 @@ function Image(props) {
1873
1879
  }
1874
1880
  }), _el$3);
1875
1881
  effect((_p$) => {
1876
- const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
1882
+ const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-4512e110", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
1877
1883
  "object-position": props.backgroundPosition || "center",
1878
1884
  "object-fit": props.backgroundSize || "cover",
1879
1885
  ...aspectRatioCss()
@@ -3243,7 +3249,8 @@ delegateEvents(["click"]);
3243
3249
  // src/blocks/text/component-info.ts
3244
3250
  var componentInfo10 = {
3245
3251
  shouldReceiveBuilderProps: {
3246
- builderBlock: TARGET === "reactNative" ? true : false
3252
+ builderBlock: TARGET === "reactNative" ? true : false,
3253
+ builderContext: true
3247
3254
  },
3248
3255
  name: "Text",
3249
3256
  static: true,
@@ -3265,10 +3272,27 @@ var componentInfo10 = {
3265
3272
  };
3266
3273
  var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
3267
3274
  function Text(props) {
3275
+ const processedText = createMemo(() => {
3276
+ const context = props.builderContext;
3277
+ const {
3278
+ context: contextContext,
3279
+ localState,
3280
+ rootState,
3281
+ rootSetState
3282
+ } = context;
3283
+ return String(props.text?.toString() || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
3284
+ code: group,
3285
+ context: contextContext,
3286
+ localState,
3287
+ rootState,
3288
+ rootSetState,
3289
+ enableCache: false
3290
+ }));
3291
+ });
3268
3292
  return (() => {
3269
3293
  const _el$ = _tmpl$10();
3270
3294
  _el$.style.setProperty("outline", "none");
3271
- effect(() => _el$.innerHTML = props.text?.toString() || "");
3295
+ effect(() => _el$.innerHTML = processedText());
3272
3296
  return _el$;
3273
3297
  })();
3274
3298
  }
@@ -4565,17 +4589,14 @@ var serializeFn = (fnValue) => {
4565
4589
  const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
4566
4590
  return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
4567
4591
  };
4568
- var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
4569
- var serializeComponentInfo = ({
4570
- inputs,
4571
- ...info
4572
- }) => ({
4573
- ...fastClone(info),
4574
- inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
4575
- ...acc,
4576
- [key]: serializeValue(value)
4577
- }), {}))
4578
- });
4592
+ function serializeComponentInfo(info) {
4593
+ return JSON.parse(JSON.stringify(info, (key, value) => {
4594
+ if (typeof value === "function") {
4595
+ return serializeFn(value);
4596
+ }
4597
+ return value;
4598
+ }));
4599
+ }
4579
4600
 
4580
4601
  // src/components/content-variants/inlined-fns.ts
4581
4602
  var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\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 cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
@@ -5136,7 +5157,7 @@ function isFromTrustedHost(trustedHosts, e) {
5136
5157
  }
5137
5158
 
5138
5159
  // src/constants/sdk-version.ts
5139
- var SDK_VERSION = "2.0.2";
5160
+ var SDK_VERSION = "2.0.5";
5140
5161
 
5141
5162
  // src/functions/register.ts
5142
5163
  var registry = {};