@builder.io/sdk-solid 2.0.16 → 2.0.22

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.
@@ -75,10 +75,10 @@ function Button(props) {
75
75
  var button_default = Button;
76
76
 
77
77
  // src/blocks/columns/columns.tsx
78
- import { Show as Show6, For as For4, createSignal as createSignal7 } from "solid-js";
78
+ import { Show as Show7, For as For4, createSignal as createSignal7 } from "solid-js";
79
79
 
80
80
  // src/components/blocks/blocks.tsx
81
- import { useContext, Show as Show5, For as For3 } from "solid-js";
81
+ import { useContext, Show as Show6, For as For3 } from "solid-js";
82
82
 
83
83
  // src/context/builder.context.ts
84
84
  import { createContext } from "solid-js";
@@ -104,9 +104,9 @@ var components_context_default = createContext2({ registeredComponents: {} });
104
104
 
105
105
  // src/components/block/block.tsx
106
106
  import {
107
- Show as Show4,
107
+ Show as Show5,
108
108
  For as For2,
109
- onMount,
109
+ onMount as onMount2,
110
110
  createMemo as createMemo5,
111
111
  createSignal as createSignal5
112
112
  } from "solid-js";
@@ -248,29 +248,6 @@ var parseCode = (code, {
248
248
  const useCode = useReturn ? `return (${code});` : code;
249
249
  return useCode;
250
250
  };
251
-
252
- // src/functions/evaluate/browser-runtime/browser.ts
253
- var runInBrowser = ({
254
- code,
255
- builder,
256
- context,
257
- event,
258
- localState,
259
- rootSetState,
260
- rootState
261
- }) => {
262
- const functionArgs = getFunctionArguments({
263
- builder,
264
- context,
265
- event,
266
- state: flattenState({
267
- rootState,
268
- localState,
269
- rootSetState
270
- })
271
- });
272
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
273
- };
274
251
  function flattenState({
275
252
  rootState,
276
253
  localState,
@@ -305,6 +282,29 @@ function flattenState({
305
282
  });
306
283
  }
307
284
 
285
+ // src/functions/evaluate/browser-runtime/browser.ts
286
+ var runInBrowser = ({
287
+ code,
288
+ builder,
289
+ context,
290
+ event,
291
+ localState,
292
+ rootSetState,
293
+ rootState
294
+ }) => {
295
+ const functionArgs = getFunctionArguments({
296
+ builder,
297
+ context,
298
+ event,
299
+ state: flattenState({
300
+ rootState,
301
+ localState,
302
+ rootSetState
303
+ })
304
+ });
305
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
306
+ };
307
+
308
308
  // src/helpers/nullable.ts
309
309
  var checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
310
310
 
@@ -1086,12 +1086,23 @@ function BlockWrapper(props) {
1086
1086
  var Block_wrapper_default = BlockWrapper;
1087
1087
 
1088
1088
  // src/components/block/components/component-ref/component-ref.tsx
1089
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1089
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1090
1090
  import { Dynamic as Dynamic3 } from "solid-js/web";
1091
1091
 
1092
1092
  // src/components/block/components/interactive-element.tsx
1093
- import { createMemo as createMemo2 } from "solid-js";
1093
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1094
1094
  import { Dynamic as Dynamic2 } from "solid-js/web";
1095
+
1096
+ // src/components/awaiter.tsx
1097
+ import { onMount } from "solid-js";
1098
+ function Awaiter(props) {
1099
+ onMount(() => {
1100
+ });
1101
+ return <><>{props.children}</></>;
1102
+ }
1103
+ var Awaiter_default = Awaiter;
1104
+
1105
+ // src/components/block/components/interactive-element.tsx
1095
1106
  function InteractiveElement(props) {
1096
1107
  const attributes = createMemo2(() => {
1097
1108
  return props.includeBlockProps ? {
@@ -1108,11 +1119,19 @@ function InteractiveElement(props) {
1108
1119
  })
1109
1120
  } : {};
1110
1121
  });
1111
- return <><Dynamic2
1112
- {...props.wrapperProps}
1122
+ return <><Show3
1123
+ fallback={<Dynamic2
1124
+ {...props.wrapperProps}
1125
+ attributes={attributes()}
1126
+ component={props.Wrapper}
1127
+ >{props.children}</Dynamic2>}
1128
+ when={props.Wrapper.load}
1129
+ ><Awaiter_default
1130
+ load={props.Wrapper.load}
1131
+ fallback={props.Wrapper.fallback}
1132
+ props={props.wrapperProps}
1113
1133
  attributes={attributes()}
1114
- component={props.Wrapper}
1115
- >{props.children}</Dynamic2></>;
1134
+ >{props.children}</Awaiter_default></Show3></>;
1116
1135
  }
1117
1136
  var interactive_element_default = InteractiveElement;
1118
1137
 
@@ -1154,7 +1173,7 @@ function ComponentRef(props) {
1154
1173
  const [Wrapper, setWrapper] = createSignal3(
1155
1174
  props.isInteractive ? interactive_element_default : props.componentRef
1156
1175
  );
1157
- return <><Show3 when={props.componentRef}><Dynamic3
1176
+ return <><Show4 when={props.componentRef}><Dynamic3
1158
1177
  {...getWrapperProps({
1159
1178
  componentOptions: props.componentOptions,
1160
1179
  builderBlock: props.builderBlock,
@@ -1175,7 +1194,7 @@ function ComponentRef(props) {
1175
1194
  registeredComponents={props.registeredComponents}
1176
1195
  linkComponent={props.linkComponent}
1177
1196
  />;
1178
- }}</For></Dynamic3></Show3></>;
1197
+ }}</For></Dynamic3></Show4></>;
1179
1198
  }
1180
1199
  var Component_ref_default = ComponentRef;
1181
1200
 
@@ -1264,7 +1283,7 @@ function Block(props) {
1264
1283
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1265
1284
  };
1266
1285
  });
1267
- onMount(() => {
1286
+ onMount2(() => {
1268
1287
  const blockId = processedBlock().id;
1269
1288
  const animations = processedBlock().animations;
1270
1289
  if (animations && blockId) {
@@ -1276,13 +1295,13 @@ function Block(props) {
1276
1295
  );
1277
1296
  }
1278
1297
  });
1279
- return <><Show4 when={canShowBlock()}>
1298
+ return <><Show5 when={canShowBlock()}>
1280
1299
  <Block_styles_default
1281
1300
  block={processedBlock()}
1282
1301
  context={props.context}
1283
1302
  />
1284
- <Show4
1285
- fallback={<Show4
1303
+ <Show5
1304
+ fallback={<Show5
1286
1305
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1287
1306
  const index = _index();
1288
1307
  return <Repeated_block_default
@@ -1304,9 +1323,9 @@ function Block(props) {
1304
1323
  builderBlock={componentRefProps().builderBlock}
1305
1324
  includeBlockProps={componentRefProps().includeBlockProps}
1306
1325
  isInteractive={componentRefProps().isInteractive}
1307
- /></Show4>}
1326
+ /></Show5>}
1308
1327
  when={!blockComponent()?.noWrap}
1309
- ><Show4
1328
+ ><Show5
1310
1329
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1311
1330
  const index = _index();
1312
1331
  return <Repeated_block_default
@@ -1344,13 +1363,13 @@ function Block(props) {
1344
1363
  context={props.context}
1345
1364
  />;
1346
1365
  }}</For2>
1347
- </Block_wrapper_default></Show4></Show4>
1348
- </Show4></>;
1366
+ </Block_wrapper_default></Show5></Show5>
1367
+ </Show5></>;
1349
1368
  }
1350
1369
  var Block_default = Block;
1351
1370
 
1352
1371
  // src/components/blocks/blocks-wrapper.tsx
1353
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1372
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1354
1373
  import { Dynamic as Dynamic4 } from "solid-js/web";
1355
1374
  function BlocksWrapper(props) {
1356
1375
  const className = createMemo6(() => {
@@ -1385,11 +1404,11 @@ function BlocksWrapper(props) {
1385
1404
  }
1386
1405
  }
1387
1406
  let blocksWrapperRef;
1388
- onMount2(() => {
1407
+ onMount3(() => {
1389
1408
  });
1390
1409
  return <>
1391
1410
  <Dynamic4
1392
- class={className() + " dynamic-4da8c6f4"}
1411
+ class={className() + " dynamic-68b2d7fe"}
1393
1412
  ref={blocksWrapperRef}
1394
1413
  builder-path={props.path}
1395
1414
  builder-parent-id={props.parent}
@@ -1401,7 +1420,7 @@ function BlocksWrapper(props) {
1401
1420
  {...props.BlocksWrapperProps}
1402
1421
  component={props.BlocksWrapper}
1403
1422
  >{props.children}</Dynamic4>
1404
- <style>{`.dynamic-4da8c6f4 {
1423
+ <style>{`.dynamic-68b2d7fe {
1405
1424
  display: flex;
1406
1425
  flex-direction: column;
1407
1426
  align-items: stretch;
@@ -1421,7 +1440,7 @@ function Blocks(props) {
1421
1440
  styleProp={props.styleProp}
1422
1441
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1423
1442
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1424
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1443
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1425
1444
  const index = _index();
1426
1445
  return <Block_default
1427
1446
  key={block.id}
@@ -1430,7 +1449,7 @@ function Blocks(props) {
1430
1449
  context={props.context || builderContext}
1431
1450
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1432
1451
  />;
1433
- }}</For3></Show5></Blocks_wrapper_default></>;
1452
+ }}</For3></Show6></Blocks_wrapper_default></>;
1434
1453
  }
1435
1454
  var Blocks_default = Blocks;
1436
1455
 
@@ -1561,15 +1580,15 @@ function Columns(props) {
1561
1580
  }
1562
1581
  return <>
1563
1582
  <div
1564
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1583
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1565
1584
  style={columnsCssVars()}
1566
1585
  {...{}}
1567
1586
  >
1568
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1587
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1569
1588
  id="builderio-columns"
1570
1589
  styles={columnsStyles()}
1571
1590
  nonce={props.builderContext.nonce}
1572
- /></Show6>
1591
+ /></Show7>
1573
1592
  <For4 each={props.columns}>{(column, _index) => {
1574
1593
  const index = _index();
1575
1594
  return <Dynamic_renderer_default
@@ -1590,7 +1609,7 @@ function Columns(props) {
1590
1609
  /></Dynamic_renderer_default>;
1591
1610
  }}</For4>
1592
1611
  </div>
1593
- <style>{`.div-3ff242de {
1612
+ <style>{`.div-46766f1c {
1594
1613
  display: flex;
1595
1614
  line-height: normal;
1596
1615
  }`}</style>
@@ -1605,7 +1624,7 @@ function FragmentComponent(props) {
1605
1624
  var fragment_default = FragmentComponent;
1606
1625
 
1607
1626
  // src/blocks/image/image.tsx
1608
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
1627
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1609
1628
 
1610
1629
  // src/blocks/image/image.helpers.ts
1611
1630
  function removeProtocol(path) {
@@ -1694,14 +1713,14 @@ function Image(props) {
1694
1713
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1695
1714
  return out;
1696
1715
  });
1697
- onMount3(() => {
1716
+ onMount4(() => {
1698
1717
  });
1699
1718
  return <>
1700
1719
  <>
1701
1720
  <picture>
1702
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1721
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1703
1722
  <img
1704
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1723
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1705
1724
  loading={props.highPriority ? "eager" : "lazy"}
1706
1725
  fetchpriority={props.highPriority ? "high" : "auto"}
1707
1726
  alt={props.altText}
@@ -1716,25 +1735,25 @@ function Image(props) {
1716
1735
  sizes={props.sizes}
1717
1736
  />
1718
1737
  </picture>
1719
- <Show7
1738
+ <Show8
1720
1739
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1721
1740
  ><div
1722
- class="builder-image-sizer div-4512e110"
1741
+ class="builder-image-sizer div-7e6ffddc"
1723
1742
  style={{
1724
1743
  "padding-top": props.aspectRatio * 100 + "%"
1725
1744
  }}
1726
- /></Show7>
1727
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1728
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1745
+ /></Show8>
1746
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
1747
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
1729
1748
  </>
1730
- <style>{`.img-4512e110 {
1749
+ <style>{`.img-7e6ffddc {
1731
1750
  opacity: 1;
1732
1751
  transition: opacity 0.2s ease-in-out;
1733
- }.div-4512e110 {
1752
+ }.div-7e6ffddc {
1734
1753
  width: 100%;
1735
1754
  pointer-events: none;
1736
1755
  font-size: 0;
1737
- }.div-4512e110-2 {
1756
+ }.div-7e6ffddc-2 {
1738
1757
  display: flex;
1739
1758
  flex-direction: column;
1740
1759
  align-items: stretch;
@@ -1770,10 +1789,10 @@ function SectionComponent(props) {
1770
1789
  var section_default = SectionComponent;
1771
1790
 
1772
1791
  // src/blocks/symbol/symbol.tsx
1773
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1792
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1774
1793
 
1775
1794
  // src/components/content-variants/content-variants.tsx
1776
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1795
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1777
1796
 
1778
1797
  // src/helpers/url.ts
1779
1798
  var getTopLevelDomain = (host) => {
@@ -1967,7 +1986,7 @@ var handleABTesting = async ({
1967
1986
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1968
1987
 
1969
1988
  // src/components/content/content.tsx
1970
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
1989
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
1971
1990
 
1972
1991
  // src/blocks/accordion/component-info.ts
1973
1992
  var defaultTitle = {
@@ -2101,7 +2120,7 @@ var componentInfo = {
2101
2120
  };
2102
2121
 
2103
2122
  // src/blocks/accordion/accordion.tsx
2104
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2123
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2105
2124
 
2106
2125
  // src/blocks/accordion/helpers.ts
2107
2126
  var convertOrderNumberToString = (order) => {
@@ -2235,7 +2254,7 @@ function Accordion(props) {
2235
2254
  registeredComponents={props.builderComponents}
2236
2255
  linkComponent={props.builderLinkComponent}
2237
2256
  /></div>
2238
- <Show8 when={open().includes(index)}><div
2257
+ <Show9 when={open().includes(index)}><div
2239
2258
  class={getAccordionDetailClassName(index)}
2240
2259
  style={accordionDetailStyles()}
2241
2260
  ><Blocks_default
@@ -2245,7 +2264,7 @@ function Accordion(props) {
2245
2264
  context={props.builderContext}
2246
2265
  registeredComponents={props.builderComponents}
2247
2266
  linkComponent={props.builderLinkComponent}
2248
- /></div></Show8>
2267
+ /></div></Show9>
2249
2268
  </>;
2250
2269
  }}</For5></div></>;
2251
2270
  }
@@ -2925,7 +2944,7 @@ var componentInfo9 = {
2925
2944
  };
2926
2945
 
2927
2946
  // src/blocks/tabs/tabs.tsx
2928
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
2947
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
2929
2948
  function Tabs(props) {
2930
2949
  const [activeTab, setActiveTab] = createSignal10(
2931
2950
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -2967,14 +2986,14 @@ function Tabs(props) {
2967
2986
  linkComponent={props.builderLinkComponent}
2968
2987
  /></span>;
2969
2988
  }}</For6></div>
2970
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2989
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
2971
2990
  parent={props.builderBlock.id}
2972
2991
  path={`component.options.tabs.${activeTab()}.content`}
2973
2992
  blocks={activeTabContent(activeTab())}
2974
2993
  context={props.builderContext}
2975
2994
  registeredComponents={props.builderComponents}
2976
2995
  linkComponent={props.builderLinkComponent}
2977
- /></div></Show9>
2996
+ /></div></Show10>
2978
2997
  </div></>;
2979
2998
  }
2980
2999
  var tabs_default = Tabs;
@@ -3063,12 +3082,12 @@ var componentInfo11 = {
3063
3082
  };
3064
3083
 
3065
3084
  // src/blocks/custom-code/custom-code.tsx
3066
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3085
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3067
3086
  function CustomCode(props) {
3068
3087
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3069
3088
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3070
3089
  let elementRef;
3071
- onMount4(() => {
3090
+ onMount5(() => {
3072
3091
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3073
3092
  return;
3074
3093
  }
@@ -3416,7 +3435,7 @@ var componentInfo13 = {
3416
3435
  };
3417
3436
 
3418
3437
  // src/blocks/form/form/form.tsx
3419
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3438
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
3420
3439
 
3421
3440
  // src/functions/get-env.ts
3422
3441
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3631,7 +3650,7 @@ function FormComponent(props) {
3631
3650
  {...{}}
3632
3651
  {...props.attributes}
3633
3652
  >
3634
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3653
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3635
3654
  const idx = _index();
3636
3655
  return <Block_default
3637
3656
  key={`form-block-${idx}`}
@@ -3640,23 +3659,23 @@ function FormComponent(props) {
3640
3659
  registeredComponents={props.builderComponents}
3641
3660
  linkComponent={props.builderLinkComponent}
3642
3661
  />;
3643
- }}</For7></Show10>
3644
- <Show10 when={submissionState() === "error"}><Blocks_default
3662
+ }}</For7></Show11>
3663
+ <Show11 when={submissionState() === "error"}><Blocks_default
3645
3664
  path="errorMessage"
3646
3665
  blocks={props.errorMessage}
3647
3666
  context={props.builderContext}
3648
- /></Show10>
3649
- <Show10 when={submissionState() === "sending"}><Blocks_default
3667
+ /></Show11>
3668
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3650
3669
  path="sendingMessage"
3651
3670
  blocks={props.sendingMessage}
3652
3671
  context={props.builderContext}
3653
- /></Show10>
3654
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3655
- <Show10 when={submissionState() === "success"}><Blocks_default
3672
+ /></Show11>
3673
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3674
+ <Show11 when={submissionState() === "success"}><Blocks_default
3656
3675
  path="successMessage"
3657
3676
  blocks={props.successMessage}
3658
3677
  context={props.builderContext}
3659
- /></Show10>
3678
+ /></Show11>
3660
3679
  </form>
3661
3680
  <style>{`.pre-2e825338 {
3662
3681
  padding: 10px;
@@ -4008,7 +4027,7 @@ var componentInfo19 = {
4008
4027
  };
4009
4028
 
4010
4029
  // src/blocks/video/video.tsx
4011
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4030
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4012
4031
  function Video(props) {
4013
4032
  const videoProps = createMemo15(() => {
4014
4033
  return {
@@ -4059,8 +4078,8 @@ function Video(props) {
4059
4078
  }}
4060
4079
  src={props.video || "no-src"}
4061
4080
  poster={props.posterImage}
4062
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4063
- <Show11
4081
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4082
+ <Show12
4064
4083
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4065
4084
  ><div
4066
4085
  style={{
@@ -4069,15 +4088,15 @@ function Video(props) {
4069
4088
  "pointer-events": "none",
4070
4089
  "font-size": "0px"
4071
4090
  }}
4072
- /></Show11>
4073
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4091
+ /></Show12>
4092
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4074
4093
  style={{
4075
4094
  display: "flex",
4076
4095
  "flex-direction": "column",
4077
4096
  "align-items": "stretch"
4078
4097
  }}
4079
- >{props.children}</div></Show11>
4080
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4098
+ >{props.children}</div></Show12>
4099
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4081
4100
  style={{
4082
4101
  "pointer-events": "none",
4083
4102
  display: "flex",
@@ -4089,7 +4108,7 @@ function Video(props) {
4089
4108
  width: "100%",
4090
4109
  height: "100%"
4091
4110
  }}
4092
- >{props.children}</div></Show11>
4111
+ >{props.children}</div></Show12>
4093
4112
  </div></>;
4094
4113
  }
4095
4114
  var video_default = Video;
@@ -4234,8 +4253,8 @@ var Inlined_script_default = InlinedScript;
4234
4253
 
4235
4254
  // src/components/content/components/enable-editor.tsx
4236
4255
  import {
4237
- Show as Show12,
4238
- onMount as onMount5,
4256
+ Show as Show13,
4257
+ onMount as onMount6,
4239
4258
  on as on3,
4240
4259
  createEffect as createEffect3,
4241
4260
  createMemo as createMemo16,
@@ -4737,7 +4756,7 @@ function isFromTrustedHost(trustedHosts, e) {
4737
4756
  }
4738
4757
 
4739
4758
  // src/constants/sdk-version.ts
4740
- var SDK_VERSION = "2.0.16";
4759
+ var SDK_VERSION = "2.0.22";
4741
4760
 
4742
4761
  // src/functions/register.ts
4743
4762
  var registry = {};
@@ -5089,22 +5108,6 @@ function EnableEditor(props) {
5089
5108
  }
5090
5109
  })(event);
5091
5110
  }
5092
- function evaluateJsCode() {
5093
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5094
- if (jsCode) {
5095
- evaluate({
5096
- code: jsCode,
5097
- context: props.context || {},
5098
- localState: void 0,
5099
- rootState: props.builderContextSignal.rootState,
5100
- rootSetState: props.builderContextSignal.rootSetState,
5101
- /**
5102
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5103
- */
5104
- enableCache: false
5105
- });
5106
- }
5107
- }
5108
5111
  function onClick(event) {
5109
5112
  if (props.builderContextSignal.content) {
5110
5113
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5146,7 +5149,7 @@ function EnableEditor(props) {
5146
5149
  })
5147
5150
  )
5148
5151
  );
5149
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5152
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5150
5153
  mergeNewRootState({
5151
5154
  [key]: json
5152
5155
  });
@@ -5175,7 +5178,9 @@ function EnableEditor(props) {
5175
5178
  }
5176
5179
  }
5177
5180
  let elementRef;
5178
- onMount5(() => {
5181
+ runHttpRequests();
5182
+ emitStateUpdate();
5183
+ onMount6(() => {
5179
5184
  if (isBrowser()) {
5180
5185
  if (isEditing()) {
5181
5186
  window.addEventListener("message", processMessage);
@@ -5236,16 +5241,6 @@ function EnableEditor(props) {
5236
5241
  }
5237
5242
  }
5238
5243
  });
5239
- onMount5(() => {
5240
- if (!props.apiKey) {
5241
- logger.error(
5242
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5243
- );
5244
- }
5245
- evaluateJsCode();
5246
- runHttpRequests();
5247
- emitStateUpdate();
5248
- });
5249
5244
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5250
5245
  function onUpdateFn_0() {
5251
5246
  if (props.content) {
@@ -5253,57 +5248,35 @@ function EnableEditor(props) {
5253
5248
  }
5254
5249
  }
5255
5250
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5256
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5257
- function onUpdateFn_1() {
5258
- evaluateJsCode();
5259
- }
5260
- createEffect3(
5261
- on3(
5262
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5263
- onUpdateFn_1
5264
- )
5265
- );
5266
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5267
- function onUpdateFn_2() {
5268
- runHttpRequests();
5269
- }
5270
- createEffect3(
5271
- on3(
5272
- () => [
5273
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5274
- ],
5275
- onUpdateFn_2
5276
- )
5277
- );
5278
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5251
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5279
5252
  () => props.builderContextSignal.rootState
5280
5253
  );
5281
- function onUpdateFn_3() {
5254
+ function onUpdateFn_1() {
5282
5255
  emitStateUpdate();
5283
5256
  }
5284
5257
  createEffect3(
5285
5258
  on3(
5286
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5287
- onUpdateFn_3
5259
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5260
+ onUpdateFn_1
5288
5261
  )
5289
5262
  );
5290
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5291
- function onUpdateFn_4() {
5263
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5264
+ function onUpdateFn_2() {
5292
5265
  if (props.data) {
5293
5266
  mergeNewRootState(props.data);
5294
5267
  }
5295
5268
  }
5296
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5297
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5298
- function onUpdateFn_5() {
5269
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5270
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5271
+ function onUpdateFn_3() {
5299
5272
  if (props.locale) {
5300
5273
  mergeNewRootState({
5301
5274
  locale: props.locale
5302
5275
  });
5303
5276
  }
5304
5277
  }
5305
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5306
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
5278
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5279
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
5307
5280
  class={getWrapperClassName(
5308
5281
  props.content?.testVariationId || props.content?.id
5309
5282
  )}
@@ -5316,7 +5289,7 @@ function EnableEditor(props) {
5316
5289
  {...showContentProps()}
5317
5290
  {...props.contentWrapperProps}
5318
5291
  component={ContentWrapper()}
5319
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5292
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5320
5293
  }
5321
5294
  var Enable_editor_default = EnableEditor;
5322
5295
 
@@ -5453,6 +5426,31 @@ function ContentComponent(props) {
5453
5426
  rootState: newRootState
5454
5427
  }));
5455
5428
  }
5429
+ if (!props.apiKey) {
5430
+ logger.error(
5431
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5432
+ );
5433
+ }
5434
+ const jsCode = builderContextSignal().content?.data?.jsCode;
5435
+ if (jsCode) {
5436
+ evaluate({
5437
+ code: jsCode,
5438
+ context: props.context || {},
5439
+ localState: void 0,
5440
+ rootState: builderContextSignal().rootState,
5441
+ rootSetState: (newState) => {
5442
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
5443
+ ...PREVIOUS_VALUE,
5444
+ rootState: newState
5445
+ }));
5446
+ },
5447
+ isExpression: false,
5448
+ /**
5449
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5450
+ */
5451
+ enableCache: false
5452
+ });
5453
+ }
5456
5454
  return <><components_context_default.Provider
5457
5455
  value={{
5458
5456
  registeredComponents: registeredComponents()
@@ -5476,18 +5474,18 @@ function ContentComponent(props) {
5476
5474
  setBuilderContextSignal
5477
5475
  }}
5478
5476
  >
5479
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5477
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5480
5478
  id="builderio-variant-visibility"
5481
5479
  scriptStr={scriptStr()}
5482
5480
  nonce={props.nonce || ""}
5483
- /></Show13>
5484
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5481
+ /></Show14>
5482
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5485
5483
  nonce={props.nonce || ""}
5486
5484
  isNestedRender={props.isNestedRender}
5487
5485
  contentId={builderContextSignal().content?.id}
5488
5486
  cssCode={builderContextSignal().content?.data?.cssCode}
5489
5487
  customFonts={builderContextSignal().content?.data?.customFonts}
5490
- /></Show13>
5488
+ /></Show14>
5491
5489
  <Blocks_default
5492
5490
  blocks={builderContextSignal().content?.data?.blocks}
5493
5491
  context={builderContextSignal()}
@@ -5527,16 +5525,16 @@ function ContentVariants(props) {
5527
5525
  canTrack: getDefaultCanTrack(props.canTrack)
5528
5526
  });
5529
5527
  });
5530
- onMount6(() => {
5528
+ onMount7(() => {
5531
5529
  setShouldRenderVariants(false);
5532
5530
  });
5533
5531
  return <><>
5534
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5532
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5535
5533
  id="builderio-init-variants-fns"
5536
5534
  scriptStr={getInitVariantsFnsScriptString()}
5537
5535
  nonce={props.nonce || ""}
5538
- /></Show14>
5539
- <Show14 when={shouldRenderVariants()}>
5536
+ /></Show15>
5537
+ <Show15 when={shouldRenderVariants()}>
5540
5538
  <Inlined_styles_default
5541
5539
  id="builderio-variants"
5542
5540
  styles={hideVariantsStyleString()}
@@ -5574,7 +5572,7 @@ function ContentVariants(props) {
5574
5572
  {...{}}
5575
5573
  />;
5576
5574
  }}</For9>
5577
- </Show14>
5575
+ </Show15>
5578
5576
  <Content_default
5579
5577
  nonce={props.nonce}
5580
5578
  isNestedRender={props.isNestedRender}
@@ -5655,7 +5653,7 @@ function Symbol(props) {
5655
5653
  }
5656
5654
  });
5657
5655
  }
5658
- onMount7(() => {
5656
+ onMount8(() => {
5659
5657
  });
5660
5658
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5661
5659
  function onUpdateFn_0() {