@builder.io/sdk-solid 2.0.16 → 2.0.21

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";
@@ -249,29 +249,6 @@ var parseCode = (code, {
249
249
  const useCode = useReturn ? `return (${code});` : code;
250
250
  return useCode;
251
251
  };
252
-
253
- // src/functions/evaluate/browser-runtime/browser.ts
254
- var runInBrowser = ({
255
- code,
256
- builder,
257
- context,
258
- event,
259
- localState,
260
- rootSetState,
261
- rootState
262
- }) => {
263
- const functionArgs = getFunctionArguments({
264
- builder,
265
- context,
266
- event,
267
- state: flattenState({
268
- rootState,
269
- localState,
270
- rootSetState
271
- })
272
- });
273
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
274
- };
275
252
  function flattenState({
276
253
  rootState,
277
254
  localState,
@@ -306,6 +283,29 @@ function flattenState({
306
283
  });
307
284
  }
308
285
 
286
+ // src/functions/evaluate/browser-runtime/browser.ts
287
+ var runInBrowser = ({
288
+ code,
289
+ builder,
290
+ context,
291
+ event,
292
+ localState,
293
+ rootSetState,
294
+ rootState
295
+ }) => {
296
+ const functionArgs = getFunctionArguments({
297
+ builder,
298
+ context,
299
+ event,
300
+ state: flattenState({
301
+ rootState,
302
+ localState,
303
+ rootSetState
304
+ })
305
+ });
306
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
307
+ };
308
+
309
309
  // src/constants/sdk-name.ts
310
310
  var SDK_NAME_FOR_TARGET = (() => {
311
311
  switch (TARGET) {
@@ -400,7 +400,7 @@ if (typeof output === 'object' && output !== null) {
400
400
  };
401
401
  var IVM_INSTANCE = null;
402
402
  var IVM_CONTEXT = null;
403
- var SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik";
403
+ var SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik" || SDK_NAME === "@builder.io/sdk-vue";
404
404
  var getIvm = () => {
405
405
  try {
406
406
  if (IVM_INSTANCE)
@@ -1258,12 +1258,23 @@ function BlockWrapper(props) {
1258
1258
  var Block_wrapper_default = BlockWrapper;
1259
1259
 
1260
1260
  // src/components/block/components/component-ref/component-ref.tsx
1261
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1261
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1262
1262
  import { Dynamic as Dynamic3 } from "solid-js/web";
1263
1263
 
1264
1264
  // src/components/block/components/interactive-element.tsx
1265
- import { createMemo as createMemo2 } from "solid-js";
1265
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1266
1266
  import { Dynamic as Dynamic2 } from "solid-js/web";
1267
+
1268
+ // src/components/awaiter.tsx
1269
+ import { onMount } from "solid-js";
1270
+ function Awaiter(props) {
1271
+ onMount(() => {
1272
+ });
1273
+ return <><>{props.children}</></>;
1274
+ }
1275
+ var Awaiter_default = Awaiter;
1276
+
1277
+ // src/components/block/components/interactive-element.tsx
1267
1278
  function InteractiveElement(props) {
1268
1279
  const attributes = createMemo2(() => {
1269
1280
  return props.includeBlockProps ? {
@@ -1280,11 +1291,19 @@ function InteractiveElement(props) {
1280
1291
  })
1281
1292
  } : {};
1282
1293
  });
1283
- return <><Dynamic2
1284
- {...props.wrapperProps}
1294
+ return <><Show3
1295
+ fallback={<Dynamic2
1296
+ {...props.wrapperProps}
1297
+ attributes={attributes()}
1298
+ component={props.Wrapper}
1299
+ >{props.children}</Dynamic2>}
1300
+ when={props.Wrapper.load}
1301
+ ><Awaiter_default
1302
+ load={props.Wrapper.load}
1303
+ fallback={props.Wrapper.fallback}
1304
+ props={props.wrapperProps}
1285
1305
  attributes={attributes()}
1286
- component={props.Wrapper}
1287
- >{props.children}</Dynamic2></>;
1306
+ >{props.children}</Awaiter_default></Show3></>;
1288
1307
  }
1289
1308
  var interactive_element_default = InteractiveElement;
1290
1309
 
@@ -1326,7 +1345,7 @@ function ComponentRef(props) {
1326
1345
  const [Wrapper, setWrapper] = createSignal3(
1327
1346
  props.isInteractive ? interactive_element_default : props.componentRef
1328
1347
  );
1329
- return <><Show3 when={props.componentRef}><Dynamic3
1348
+ return <><Show4 when={props.componentRef}><Dynamic3
1330
1349
  {...getWrapperProps({
1331
1350
  componentOptions: props.componentOptions,
1332
1351
  builderBlock: props.builderBlock,
@@ -1347,7 +1366,7 @@ function ComponentRef(props) {
1347
1366
  registeredComponents={props.registeredComponents}
1348
1367
  linkComponent={props.linkComponent}
1349
1368
  />;
1350
- }}</For></Dynamic3></Show3></>;
1369
+ }}</For></Dynamic3></Show4></>;
1351
1370
  }
1352
1371
  var Component_ref_default = ComponentRef;
1353
1372
 
@@ -1436,7 +1455,7 @@ function Block(props) {
1436
1455
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1437
1456
  };
1438
1457
  });
1439
- onMount(() => {
1458
+ onMount2(() => {
1440
1459
  const blockId = processedBlock().id;
1441
1460
  const animations = processedBlock().animations;
1442
1461
  if (animations && blockId) {
@@ -1448,13 +1467,13 @@ function Block(props) {
1448
1467
  );
1449
1468
  }
1450
1469
  });
1451
- return <><Show4 when={canShowBlock()}>
1470
+ return <><Show5 when={canShowBlock()}>
1452
1471
  <Block_styles_default
1453
1472
  block={processedBlock()}
1454
1473
  context={props.context}
1455
1474
  />
1456
- <Show4
1457
- fallback={<Show4
1475
+ <Show5
1476
+ fallback={<Show5
1458
1477
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1459
1478
  const index = _index();
1460
1479
  return <Repeated_block_default
@@ -1476,9 +1495,9 @@ function Block(props) {
1476
1495
  builderBlock={componentRefProps().builderBlock}
1477
1496
  includeBlockProps={componentRefProps().includeBlockProps}
1478
1497
  isInteractive={componentRefProps().isInteractive}
1479
- /></Show4>}
1498
+ /></Show5>}
1480
1499
  when={!blockComponent()?.noWrap}
1481
- ><Show4
1500
+ ><Show5
1482
1501
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1483
1502
  const index = _index();
1484
1503
  return <Repeated_block_default
@@ -1516,13 +1535,13 @@ function Block(props) {
1516
1535
  context={props.context}
1517
1536
  />;
1518
1537
  }}</For2>
1519
- </Block_wrapper_default></Show4></Show4>
1520
- </Show4></>;
1538
+ </Block_wrapper_default></Show5></Show5>
1539
+ </Show5></>;
1521
1540
  }
1522
1541
  var Block_default = Block;
1523
1542
 
1524
1543
  // src/components/blocks/blocks-wrapper.tsx
1525
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1544
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1526
1545
  import { Dynamic as Dynamic4 } from "solid-js/web";
1527
1546
  function BlocksWrapper(props) {
1528
1547
  const className = createMemo6(() => {
@@ -1557,11 +1576,11 @@ function BlocksWrapper(props) {
1557
1576
  }
1558
1577
  }
1559
1578
  let blocksWrapperRef;
1560
- onMount2(() => {
1579
+ onMount3(() => {
1561
1580
  });
1562
1581
  return <>
1563
1582
  <Dynamic4
1564
- class={className() + " dynamic-4da8c6f4"}
1583
+ class={className() + " dynamic-68b2d7fe"}
1565
1584
  ref={blocksWrapperRef}
1566
1585
  builder-path={props.path}
1567
1586
  builder-parent-id={props.parent}
@@ -1573,7 +1592,7 @@ function BlocksWrapper(props) {
1573
1592
  {...props.BlocksWrapperProps}
1574
1593
  component={props.BlocksWrapper}
1575
1594
  >{props.children}</Dynamic4>
1576
- <style>{`.dynamic-4da8c6f4 {
1595
+ <style>{`.dynamic-68b2d7fe {
1577
1596
  display: flex;
1578
1597
  flex-direction: column;
1579
1598
  align-items: stretch;
@@ -1593,7 +1612,7 @@ function Blocks(props) {
1593
1612
  styleProp={props.styleProp}
1594
1613
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1595
1614
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1596
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1615
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1597
1616
  const index = _index();
1598
1617
  return <Block_default
1599
1618
  key={block.id}
@@ -1602,7 +1621,7 @@ function Blocks(props) {
1602
1621
  context={props.context || builderContext}
1603
1622
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1604
1623
  />;
1605
- }}</For3></Show5></Blocks_wrapper_default></>;
1624
+ }}</For3></Show6></Blocks_wrapper_default></>;
1606
1625
  }
1607
1626
  var Blocks_default = Blocks;
1608
1627
 
@@ -1733,15 +1752,15 @@ function Columns(props) {
1733
1752
  }
1734
1753
  return <>
1735
1754
  <div
1736
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1755
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1737
1756
  style={columnsCssVars()}
1738
1757
  {...{}}
1739
1758
  >
1740
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1759
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1741
1760
  id="builderio-columns"
1742
1761
  styles={columnsStyles()}
1743
1762
  nonce={props.builderContext.nonce}
1744
- /></Show6>
1763
+ /></Show7>
1745
1764
  <For4 each={props.columns}>{(column, _index) => {
1746
1765
  const index = _index();
1747
1766
  return <Dynamic_renderer_default
@@ -1762,7 +1781,7 @@ function Columns(props) {
1762
1781
  /></Dynamic_renderer_default>;
1763
1782
  }}</For4>
1764
1783
  </div>
1765
- <style>{`.div-3ff242de {
1784
+ <style>{`.div-46766f1c {
1766
1785
  display: flex;
1767
1786
  line-height: normal;
1768
1787
  }`}</style>
@@ -1777,7 +1796,7 @@ function FragmentComponent(props) {
1777
1796
  var fragment_default = FragmentComponent;
1778
1797
 
1779
1798
  // src/blocks/image/image.tsx
1780
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
1799
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1781
1800
 
1782
1801
  // src/blocks/image/image.helpers.ts
1783
1802
  function removeProtocol(path) {
@@ -1866,14 +1885,14 @@ function Image(props) {
1866
1885
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1867
1886
  return out;
1868
1887
  });
1869
- onMount3(() => {
1888
+ onMount4(() => {
1870
1889
  });
1871
1890
  return <>
1872
1891
  <>
1873
1892
  <picture>
1874
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1893
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1875
1894
  <img
1876
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1895
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1877
1896
  loading={props.highPriority ? "eager" : "lazy"}
1878
1897
  fetchpriority={props.highPriority ? "high" : "auto"}
1879
1898
  alt={props.altText}
@@ -1888,25 +1907,25 @@ function Image(props) {
1888
1907
  sizes={props.sizes}
1889
1908
  />
1890
1909
  </picture>
1891
- <Show7
1910
+ <Show8
1892
1911
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1893
1912
  ><div
1894
- class="builder-image-sizer div-4512e110"
1913
+ class="builder-image-sizer div-7e6ffddc"
1895
1914
  style={{
1896
1915
  "padding-top": props.aspectRatio * 100 + "%"
1897
1916
  }}
1898
- /></Show7>
1899
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1900
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1917
+ /></Show8>
1918
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
1919
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
1901
1920
  </>
1902
- <style>{`.img-4512e110 {
1921
+ <style>{`.img-7e6ffddc {
1903
1922
  opacity: 1;
1904
1923
  transition: opacity 0.2s ease-in-out;
1905
- }.div-4512e110 {
1924
+ }.div-7e6ffddc {
1906
1925
  width: 100%;
1907
1926
  pointer-events: none;
1908
1927
  font-size: 0;
1909
- }.div-4512e110-2 {
1928
+ }.div-7e6ffddc-2 {
1910
1929
  display: flex;
1911
1930
  flex-direction: column;
1912
1931
  align-items: stretch;
@@ -1942,10 +1961,10 @@ function SectionComponent(props) {
1942
1961
  var section_default = SectionComponent;
1943
1962
 
1944
1963
  // src/blocks/symbol/symbol.tsx
1945
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1964
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1946
1965
 
1947
1966
  // src/components/content-variants/content-variants.tsx
1948
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1967
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1949
1968
 
1950
1969
  // src/helpers/url.ts
1951
1970
  var getTopLevelDomain = (host) => {
@@ -2139,7 +2158,7 @@ var handleABTesting = async ({
2139
2158
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2140
2159
 
2141
2160
  // src/components/content/content.tsx
2142
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
2161
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
2143
2162
 
2144
2163
  // src/blocks/accordion/component-info.ts
2145
2164
  var defaultTitle = {
@@ -2273,7 +2292,7 @@ var componentInfo = {
2273
2292
  };
2274
2293
 
2275
2294
  // src/blocks/accordion/accordion.tsx
2276
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2295
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2277
2296
 
2278
2297
  // src/blocks/accordion/helpers.ts
2279
2298
  var convertOrderNumberToString = (order) => {
@@ -2407,7 +2426,7 @@ function Accordion(props) {
2407
2426
  registeredComponents={props.builderComponents}
2408
2427
  linkComponent={props.builderLinkComponent}
2409
2428
  /></div>
2410
- <Show8 when={open().includes(index)}><div
2429
+ <Show9 when={open().includes(index)}><div
2411
2430
  class={getAccordionDetailClassName(index)}
2412
2431
  style={accordionDetailStyles()}
2413
2432
  ><Blocks_default
@@ -2417,7 +2436,7 @@ function Accordion(props) {
2417
2436
  context={props.builderContext}
2418
2437
  registeredComponents={props.builderComponents}
2419
2438
  linkComponent={props.builderLinkComponent}
2420
- /></div></Show8>
2439
+ /></div></Show9>
2421
2440
  </>;
2422
2441
  }}</For5></div></>;
2423
2442
  }
@@ -3097,7 +3116,7 @@ var componentInfo9 = {
3097
3116
  };
3098
3117
 
3099
3118
  // src/blocks/tabs/tabs.tsx
3100
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
3119
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
3101
3120
  function Tabs(props) {
3102
3121
  const [activeTab, setActiveTab] = createSignal10(
3103
3122
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -3139,14 +3158,14 @@ function Tabs(props) {
3139
3158
  linkComponent={props.builderLinkComponent}
3140
3159
  /></span>;
3141
3160
  }}</For6></div>
3142
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
3161
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
3143
3162
  parent={props.builderBlock.id}
3144
3163
  path={`component.options.tabs.${activeTab()}.content`}
3145
3164
  blocks={activeTabContent(activeTab())}
3146
3165
  context={props.builderContext}
3147
3166
  registeredComponents={props.builderComponents}
3148
3167
  linkComponent={props.builderLinkComponent}
3149
- /></div></Show9>
3168
+ /></div></Show10>
3150
3169
  </div></>;
3151
3170
  }
3152
3171
  var tabs_default = Tabs;
@@ -3235,12 +3254,12 @@ var componentInfo11 = {
3235
3254
  };
3236
3255
 
3237
3256
  // src/blocks/custom-code/custom-code.tsx
3238
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3257
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3239
3258
  function CustomCode(props) {
3240
3259
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3241
3260
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3242
3261
  let elementRef;
3243
- onMount4(() => {
3262
+ onMount5(() => {
3244
3263
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3245
3264
  return;
3246
3265
  }
@@ -3588,7 +3607,7 @@ var componentInfo13 = {
3588
3607
  };
3589
3608
 
3590
3609
  // src/blocks/form/form/form.tsx
3591
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3610
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
3592
3611
 
3593
3612
  // src/functions/get-env.ts
3594
3613
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3803,7 +3822,7 @@ function FormComponent(props) {
3803
3822
  {...{}}
3804
3823
  {...props.attributes}
3805
3824
  >
3806
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3825
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3807
3826
  const idx = _index();
3808
3827
  return <Block_default
3809
3828
  key={`form-block-${idx}`}
@@ -3812,23 +3831,23 @@ function FormComponent(props) {
3812
3831
  registeredComponents={props.builderComponents}
3813
3832
  linkComponent={props.builderLinkComponent}
3814
3833
  />;
3815
- }}</For7></Show10>
3816
- <Show10 when={submissionState() === "error"}><Blocks_default
3834
+ }}</For7></Show11>
3835
+ <Show11 when={submissionState() === "error"}><Blocks_default
3817
3836
  path="errorMessage"
3818
3837
  blocks={props.errorMessage}
3819
3838
  context={props.builderContext}
3820
- /></Show10>
3821
- <Show10 when={submissionState() === "sending"}><Blocks_default
3839
+ /></Show11>
3840
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3822
3841
  path="sendingMessage"
3823
3842
  blocks={props.sendingMessage}
3824
3843
  context={props.builderContext}
3825
- /></Show10>
3826
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3827
- <Show10 when={submissionState() === "success"}><Blocks_default
3844
+ /></Show11>
3845
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3846
+ <Show11 when={submissionState() === "success"}><Blocks_default
3828
3847
  path="successMessage"
3829
3848
  blocks={props.successMessage}
3830
3849
  context={props.builderContext}
3831
- /></Show10>
3850
+ /></Show11>
3832
3851
  </form>
3833
3852
  <style>{`.pre-2e825338 {
3834
3853
  padding: 10px;
@@ -4180,7 +4199,7 @@ var componentInfo19 = {
4180
4199
  };
4181
4200
 
4182
4201
  // src/blocks/video/video.tsx
4183
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4202
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4184
4203
  function Video(props) {
4185
4204
  const videoProps = createMemo15(() => {
4186
4205
  return {
@@ -4231,8 +4250,8 @@ function Video(props) {
4231
4250
  }}
4232
4251
  src={props.video || "no-src"}
4233
4252
  poster={props.posterImage}
4234
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4235
- <Show11
4253
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4254
+ <Show12
4236
4255
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4237
4256
  ><div
4238
4257
  style={{
@@ -4241,15 +4260,15 @@ function Video(props) {
4241
4260
  "pointer-events": "none",
4242
4261
  "font-size": "0px"
4243
4262
  }}
4244
- /></Show11>
4245
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4263
+ /></Show12>
4264
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4246
4265
  style={{
4247
4266
  display: "flex",
4248
4267
  "flex-direction": "column",
4249
4268
  "align-items": "stretch"
4250
4269
  }}
4251
- >{props.children}</div></Show11>
4252
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4270
+ >{props.children}</div></Show12>
4271
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4253
4272
  style={{
4254
4273
  "pointer-events": "none",
4255
4274
  display: "flex",
@@ -4261,7 +4280,7 @@ function Video(props) {
4261
4280
  width: "100%",
4262
4281
  height: "100%"
4263
4282
  }}
4264
- >{props.children}</div></Show11>
4283
+ >{props.children}</div></Show12>
4265
4284
  </div></>;
4266
4285
  }
4267
4286
  var video_default = Video;
@@ -4406,8 +4425,8 @@ var Inlined_script_default = InlinedScript;
4406
4425
 
4407
4426
  // src/components/content/components/enable-editor.tsx
4408
4427
  import {
4409
- Show as Show12,
4410
- onMount as onMount5,
4428
+ Show as Show13,
4429
+ onMount as onMount6,
4411
4430
  on as on3,
4412
4431
  createEffect as createEffect3,
4413
4432
  createMemo as createMemo16,
@@ -4909,7 +4928,7 @@ function isFromTrustedHost(trustedHosts, e) {
4909
4928
  }
4910
4929
 
4911
4930
  // src/constants/sdk-version.ts
4912
- var SDK_VERSION = "2.0.16";
4931
+ var SDK_VERSION = "2.0.21";
4913
4932
 
4914
4933
  // src/functions/register.ts
4915
4934
  var registry = {};
@@ -5261,22 +5280,6 @@ function EnableEditor(props) {
5261
5280
  }
5262
5281
  })(event);
5263
5282
  }
5264
- function evaluateJsCode() {
5265
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5266
- if (jsCode) {
5267
- evaluate({
5268
- code: jsCode,
5269
- context: props.context || {},
5270
- localState: void 0,
5271
- rootState: props.builderContextSignal.rootState,
5272
- rootSetState: props.builderContextSignal.rootSetState,
5273
- /**
5274
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5275
- */
5276
- enableCache: false
5277
- });
5278
- }
5279
- }
5280
5283
  function onClick(event) {
5281
5284
  if (props.builderContextSignal.content) {
5282
5285
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5318,7 +5321,7 @@ function EnableEditor(props) {
5318
5321
  })
5319
5322
  )
5320
5323
  );
5321
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5324
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5322
5325
  mergeNewRootState({
5323
5326
  [key]: json
5324
5327
  });
@@ -5347,7 +5350,9 @@ function EnableEditor(props) {
5347
5350
  }
5348
5351
  }
5349
5352
  let elementRef;
5350
- onMount5(() => {
5353
+ runHttpRequests();
5354
+ emitStateUpdate();
5355
+ onMount6(() => {
5351
5356
  if (isBrowser()) {
5352
5357
  if (isEditing()) {
5353
5358
  window.addEventListener("message", processMessage);
@@ -5408,16 +5413,6 @@ function EnableEditor(props) {
5408
5413
  }
5409
5414
  }
5410
5415
  });
5411
- onMount5(() => {
5412
- if (!props.apiKey) {
5413
- logger.error(
5414
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5415
- );
5416
- }
5417
- evaluateJsCode();
5418
- runHttpRequests();
5419
- emitStateUpdate();
5420
- });
5421
5416
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5422
5417
  function onUpdateFn_0() {
5423
5418
  if (props.content) {
@@ -5425,57 +5420,35 @@ function EnableEditor(props) {
5425
5420
  }
5426
5421
  }
5427
5422
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5428
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5429
- function onUpdateFn_1() {
5430
- evaluateJsCode();
5431
- }
5432
- createEffect3(
5433
- on3(
5434
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5435
- onUpdateFn_1
5436
- )
5437
- );
5438
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5439
- function onUpdateFn_2() {
5440
- runHttpRequests();
5441
- }
5442
- createEffect3(
5443
- on3(
5444
- () => [
5445
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5446
- ],
5447
- onUpdateFn_2
5448
- )
5449
- );
5450
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5423
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5451
5424
  () => props.builderContextSignal.rootState
5452
5425
  );
5453
- function onUpdateFn_3() {
5426
+ function onUpdateFn_1() {
5454
5427
  emitStateUpdate();
5455
5428
  }
5456
5429
  createEffect3(
5457
5430
  on3(
5458
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5459
- onUpdateFn_3
5431
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5432
+ onUpdateFn_1
5460
5433
  )
5461
5434
  );
5462
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5463
- function onUpdateFn_4() {
5435
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5436
+ function onUpdateFn_2() {
5464
5437
  if (props.data) {
5465
5438
  mergeNewRootState(props.data);
5466
5439
  }
5467
5440
  }
5468
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5469
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5470
- function onUpdateFn_5() {
5441
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5442
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5443
+ function onUpdateFn_3() {
5471
5444
  if (props.locale) {
5472
5445
  mergeNewRootState({
5473
5446
  locale: props.locale
5474
5447
  });
5475
5448
  }
5476
5449
  }
5477
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5478
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
5450
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5451
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
5479
5452
  class={getWrapperClassName(
5480
5453
  props.content?.testVariationId || props.content?.id
5481
5454
  )}
@@ -5488,7 +5461,7 @@ function EnableEditor(props) {
5488
5461
  {...showContentProps()}
5489
5462
  {...props.contentWrapperProps}
5490
5463
  component={ContentWrapper()}
5491
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5464
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5492
5465
  }
5493
5466
  var Enable_editor_default = EnableEditor;
5494
5467
 
@@ -5625,6 +5598,31 @@ function ContentComponent(props) {
5625
5598
  rootState: newRootState
5626
5599
  }));
5627
5600
  }
5601
+ if (!props.apiKey) {
5602
+ logger.error(
5603
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5604
+ );
5605
+ }
5606
+ const jsCode = builderContextSignal().content?.data?.jsCode;
5607
+ if (jsCode) {
5608
+ evaluate({
5609
+ code: jsCode,
5610
+ context: props.context || {},
5611
+ localState: void 0,
5612
+ rootState: builderContextSignal().rootState,
5613
+ rootSetState: (newState) => {
5614
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
5615
+ ...PREVIOUS_VALUE,
5616
+ rootState: newState
5617
+ }));
5618
+ },
5619
+ isExpression: false,
5620
+ /**
5621
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5622
+ */
5623
+ enableCache: false
5624
+ });
5625
+ }
5628
5626
  return <><components_context_default.Provider
5629
5627
  value={{
5630
5628
  registeredComponents: registeredComponents()
@@ -5648,18 +5646,18 @@ function ContentComponent(props) {
5648
5646
  setBuilderContextSignal
5649
5647
  }}
5650
5648
  >
5651
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5649
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5652
5650
  id="builderio-variant-visibility"
5653
5651
  scriptStr={scriptStr()}
5654
5652
  nonce={props.nonce || ""}
5655
- /></Show13>
5656
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5653
+ /></Show14>
5654
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5657
5655
  nonce={props.nonce || ""}
5658
5656
  isNestedRender={props.isNestedRender}
5659
5657
  contentId={builderContextSignal().content?.id}
5660
5658
  cssCode={builderContextSignal().content?.data?.cssCode}
5661
5659
  customFonts={builderContextSignal().content?.data?.customFonts}
5662
- /></Show13>
5660
+ /></Show14>
5663
5661
  <Blocks_default
5664
5662
  blocks={builderContextSignal().content?.data?.blocks}
5665
5663
  context={builderContextSignal()}
@@ -5699,16 +5697,16 @@ function ContentVariants(props) {
5699
5697
  canTrack: getDefaultCanTrack(props.canTrack)
5700
5698
  });
5701
5699
  });
5702
- onMount6(() => {
5700
+ onMount7(() => {
5703
5701
  setShouldRenderVariants(false);
5704
5702
  });
5705
5703
  return <><>
5706
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5704
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5707
5705
  id="builderio-init-variants-fns"
5708
5706
  scriptStr={getInitVariantsFnsScriptString()}
5709
5707
  nonce={props.nonce || ""}
5710
- /></Show14>
5711
- <Show14 when={shouldRenderVariants()}>
5708
+ /></Show15>
5709
+ <Show15 when={shouldRenderVariants()}>
5712
5710
  <Inlined_styles_default
5713
5711
  id="builderio-variants"
5714
5712
  styles={hideVariantsStyleString()}
@@ -5746,7 +5744,7 @@ function ContentVariants(props) {
5746
5744
  {...{}}
5747
5745
  />;
5748
5746
  }}</For9>
5749
- </Show14>
5747
+ </Show15>
5750
5748
  <Content_default
5751
5749
  nonce={props.nonce}
5752
5750
  isNestedRender={props.isNestedRender}
@@ -5827,7 +5825,7 @@ function Symbol(props) {
5827
5825
  }
5828
5826
  });
5829
5827
  }
5830
- onMount7(() => {
5828
+ onMount8(() => {
5831
5829
  });
5832
5830
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5833
5831
  function onUpdateFn_0() {