@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.
package/lib/node/dev.jsx CHANGED
@@ -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";
@@ -250,29 +250,6 @@ var parseCode = (code, {
250
250
  const useCode = useReturn ? `return (${code});` : code;
251
251
  return useCode;
252
252
  };
253
-
254
- // src/functions/evaluate/browser-runtime/browser.ts
255
- var runInBrowser = ({
256
- code,
257
- builder,
258
- context,
259
- event,
260
- localState,
261
- rootSetState,
262
- rootState
263
- }) => {
264
- const functionArgs = getFunctionArguments({
265
- builder,
266
- context,
267
- event,
268
- state: flattenState({
269
- rootState,
270
- localState,
271
- rootSetState
272
- })
273
- });
274
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
275
- };
276
253
  function flattenState({
277
254
  rootState,
278
255
  localState,
@@ -307,6 +284,29 @@ function flattenState({
307
284
  });
308
285
  }
309
286
 
287
+ // src/functions/evaluate/browser-runtime/browser.ts
288
+ var runInBrowser = ({
289
+ code,
290
+ builder,
291
+ context,
292
+ event,
293
+ localState,
294
+ rootSetState,
295
+ rootState
296
+ }) => {
297
+ const functionArgs = getFunctionArguments({
298
+ builder,
299
+ context,
300
+ event,
301
+ state: flattenState({
302
+ rootState,
303
+ localState,
304
+ rootSetState
305
+ })
306
+ });
307
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
308
+ };
309
+
310
310
  // src/constants/sdk-name.ts
311
311
  var SDK_NAME_FOR_TARGET = (() => {
312
312
  switch (TARGET) {
@@ -401,7 +401,7 @@ if (typeof output === 'object' && output !== null) {
401
401
  };
402
402
  var IVM_INSTANCE = null;
403
403
  var IVM_CONTEXT = null;
404
- var SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik";
404
+ 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";
405
405
  var getIvm = () => {
406
406
  try {
407
407
  if (IVM_INSTANCE)
@@ -1264,12 +1264,23 @@ function BlockWrapper(props) {
1264
1264
  var Block_wrapper_default = BlockWrapper;
1265
1265
 
1266
1266
  // src/components/block/components/component-ref/component-ref.tsx
1267
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1267
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1268
1268
  import { Dynamic as Dynamic3 } from "solid-js/web";
1269
1269
 
1270
1270
  // src/components/block/components/interactive-element.tsx
1271
- import { createMemo as createMemo2 } from "solid-js";
1271
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1272
1272
  import { Dynamic as Dynamic2 } from "solid-js/web";
1273
+
1274
+ // src/components/awaiter.tsx
1275
+ import { onMount } from "solid-js";
1276
+ function Awaiter(props) {
1277
+ onMount(() => {
1278
+ });
1279
+ return <><>{props.children}</></>;
1280
+ }
1281
+ var Awaiter_default = Awaiter;
1282
+
1283
+ // src/components/block/components/interactive-element.tsx
1273
1284
  function InteractiveElement(props) {
1274
1285
  const attributes = createMemo2(() => {
1275
1286
  return props.includeBlockProps ? {
@@ -1286,11 +1297,19 @@ function InteractiveElement(props) {
1286
1297
  })
1287
1298
  } : {};
1288
1299
  });
1289
- return <><Dynamic2
1290
- {...props.wrapperProps}
1300
+ return <><Show3
1301
+ fallback={<Dynamic2
1302
+ {...props.wrapperProps}
1303
+ attributes={attributes()}
1304
+ component={props.Wrapper}
1305
+ >{props.children}</Dynamic2>}
1306
+ when={props.Wrapper.load}
1307
+ ><Awaiter_default
1308
+ load={props.Wrapper.load}
1309
+ fallback={props.Wrapper.fallback}
1310
+ props={props.wrapperProps}
1291
1311
  attributes={attributes()}
1292
- component={props.Wrapper}
1293
- >{props.children}</Dynamic2></>;
1312
+ >{props.children}</Awaiter_default></Show3></>;
1294
1313
  }
1295
1314
  var interactive_element_default = InteractiveElement;
1296
1315
 
@@ -1332,7 +1351,7 @@ function ComponentRef(props) {
1332
1351
  const [Wrapper, setWrapper] = createSignal3(
1333
1352
  props.isInteractive ? interactive_element_default : props.componentRef
1334
1353
  );
1335
- return <><Show3 when={props.componentRef}><Dynamic3
1354
+ return <><Show4 when={props.componentRef}><Dynamic3
1336
1355
  {...getWrapperProps({
1337
1356
  componentOptions: props.componentOptions,
1338
1357
  builderBlock: props.builderBlock,
@@ -1353,7 +1372,7 @@ function ComponentRef(props) {
1353
1372
  registeredComponents={props.registeredComponents}
1354
1373
  linkComponent={props.linkComponent}
1355
1374
  />;
1356
- }}</For></Dynamic3></Show3></>;
1375
+ }}</For></Dynamic3></Show4></>;
1357
1376
  }
1358
1377
  var Component_ref_default = ComponentRef;
1359
1378
 
@@ -1442,7 +1461,7 @@ function Block(props) {
1442
1461
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1443
1462
  };
1444
1463
  });
1445
- onMount(() => {
1464
+ onMount2(() => {
1446
1465
  const blockId = processedBlock().id;
1447
1466
  const animations = processedBlock().animations;
1448
1467
  if (animations && blockId) {
@@ -1454,13 +1473,13 @@ function Block(props) {
1454
1473
  );
1455
1474
  }
1456
1475
  });
1457
- return <><Show4 when={canShowBlock()}>
1476
+ return <><Show5 when={canShowBlock()}>
1458
1477
  <Block_styles_default
1459
1478
  block={processedBlock()}
1460
1479
  context={props.context}
1461
1480
  />
1462
- <Show4
1463
- fallback={<Show4
1481
+ <Show5
1482
+ fallback={<Show5
1464
1483
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1465
1484
  const index = _index();
1466
1485
  return <Repeated_block_default
@@ -1482,9 +1501,9 @@ function Block(props) {
1482
1501
  builderBlock={componentRefProps().builderBlock}
1483
1502
  includeBlockProps={componentRefProps().includeBlockProps}
1484
1503
  isInteractive={componentRefProps().isInteractive}
1485
- /></Show4>}
1504
+ /></Show5>}
1486
1505
  when={!blockComponent()?.noWrap}
1487
- ><Show4
1506
+ ><Show5
1488
1507
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1489
1508
  const index = _index();
1490
1509
  return <Repeated_block_default
@@ -1522,13 +1541,13 @@ function Block(props) {
1522
1541
  context={props.context}
1523
1542
  />;
1524
1543
  }}</For2>
1525
- </Block_wrapper_default></Show4></Show4>
1526
- </Show4></>;
1544
+ </Block_wrapper_default></Show5></Show5>
1545
+ </Show5></>;
1527
1546
  }
1528
1547
  var Block_default = Block;
1529
1548
 
1530
1549
  // src/components/blocks/blocks-wrapper.tsx
1531
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1550
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1532
1551
  import { Dynamic as Dynamic4 } from "solid-js/web";
1533
1552
  function BlocksWrapper(props) {
1534
1553
  const className = createMemo6(() => {
@@ -1563,11 +1582,11 @@ function BlocksWrapper(props) {
1563
1582
  }
1564
1583
  }
1565
1584
  let blocksWrapperRef;
1566
- onMount2(() => {
1585
+ onMount3(() => {
1567
1586
  });
1568
1587
  return <>
1569
1588
  <Dynamic4
1570
- class={className() + " dynamic-4da8c6f4"}
1589
+ class={className() + " dynamic-68b2d7fe"}
1571
1590
  ref={blocksWrapperRef}
1572
1591
  builder-path={props.path}
1573
1592
  builder-parent-id={props.parent}
@@ -1579,7 +1598,7 @@ function BlocksWrapper(props) {
1579
1598
  {...props.BlocksWrapperProps}
1580
1599
  component={props.BlocksWrapper}
1581
1600
  >{props.children}</Dynamic4>
1582
- <style>{`.dynamic-4da8c6f4 {
1601
+ <style>{`.dynamic-68b2d7fe {
1583
1602
  display: flex;
1584
1603
  flex-direction: column;
1585
1604
  align-items: stretch;
@@ -1599,7 +1618,7 @@ function Blocks(props) {
1599
1618
  styleProp={props.styleProp}
1600
1619
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1601
1620
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1602
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1621
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1603
1622
  const index = _index();
1604
1623
  return <Block_default
1605
1624
  key={block.id}
@@ -1608,7 +1627,7 @@ function Blocks(props) {
1608
1627
  context={props.context || builderContext}
1609
1628
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1610
1629
  />;
1611
- }}</For3></Show5></Blocks_wrapper_default></>;
1630
+ }}</For3></Show6></Blocks_wrapper_default></>;
1612
1631
  }
1613
1632
  var Blocks_default = Blocks;
1614
1633
 
@@ -1739,15 +1758,15 @@ function Columns(props) {
1739
1758
  }
1740
1759
  return <>
1741
1760
  <div
1742
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1761
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1743
1762
  style={columnsCssVars()}
1744
1763
  {...{}}
1745
1764
  >
1746
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1765
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1747
1766
  id="builderio-columns"
1748
1767
  styles={columnsStyles()}
1749
1768
  nonce={props.builderContext.nonce}
1750
- /></Show6>
1769
+ /></Show7>
1751
1770
  <For4 each={props.columns}>{(column, _index) => {
1752
1771
  const index = _index();
1753
1772
  return <Dynamic_renderer_default
@@ -1768,7 +1787,7 @@ function Columns(props) {
1768
1787
  /></Dynamic_renderer_default>;
1769
1788
  }}</For4>
1770
1789
  </div>
1771
- <style>{`.div-3ff242de {
1790
+ <style>{`.div-46766f1c {
1772
1791
  display: flex;
1773
1792
  line-height: normal;
1774
1793
  }`}</style>
@@ -1783,7 +1802,7 @@ function FragmentComponent(props) {
1783
1802
  var fragment_default = FragmentComponent;
1784
1803
 
1785
1804
  // src/blocks/image/image.tsx
1786
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
1805
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1787
1806
 
1788
1807
  // src/blocks/image/image.helpers.ts
1789
1808
  function removeProtocol(path) {
@@ -1873,14 +1892,14 @@ function Image(props) {
1873
1892
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1874
1893
  return out;
1875
1894
  });
1876
- onMount3(() => {
1895
+ onMount4(() => {
1877
1896
  });
1878
1897
  return <>
1879
1898
  <>
1880
1899
  <picture>
1881
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1900
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1882
1901
  <img
1883
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1902
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1884
1903
  loading={props.highPriority ? "eager" : "lazy"}
1885
1904
  fetchpriority={props.highPriority ? "high" : "auto"}
1886
1905
  alt={props.altText}
@@ -1895,25 +1914,25 @@ function Image(props) {
1895
1914
  sizes={props.sizes}
1896
1915
  />
1897
1916
  </picture>
1898
- <Show7
1917
+ <Show8
1899
1918
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1900
1919
  ><div
1901
- class="builder-image-sizer div-4512e110"
1920
+ class="builder-image-sizer div-7e6ffddc"
1902
1921
  style={{
1903
1922
  "padding-top": props.aspectRatio * 100 + "%"
1904
1923
  }}
1905
- /></Show7>
1906
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1907
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1924
+ /></Show8>
1925
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
1926
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
1908
1927
  </>
1909
- <style>{`.img-4512e110 {
1928
+ <style>{`.img-7e6ffddc {
1910
1929
  opacity: 1;
1911
1930
  transition: opacity 0.2s ease-in-out;
1912
- }.div-4512e110 {
1931
+ }.div-7e6ffddc {
1913
1932
  width: 100%;
1914
1933
  pointer-events: none;
1915
1934
  font-size: 0;
1916
- }.div-4512e110-2 {
1935
+ }.div-7e6ffddc-2 {
1917
1936
  display: flex;
1918
1937
  flex-direction: column;
1919
1938
  align-items: stretch;
@@ -1949,10 +1968,10 @@ function SectionComponent(props) {
1949
1968
  var section_default = SectionComponent;
1950
1969
 
1951
1970
  // src/blocks/symbol/symbol.tsx
1952
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1971
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1953
1972
 
1954
1973
  // src/components/content-variants/content-variants.tsx
1955
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1974
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1956
1975
 
1957
1976
  // src/helpers/url.ts
1958
1977
  var getTopLevelDomain = (host) => {
@@ -2146,7 +2165,7 @@ var handleABTesting = async ({
2146
2165
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2147
2166
 
2148
2167
  // src/components/content/content.tsx
2149
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
2168
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
2150
2169
 
2151
2170
  // src/blocks/accordion/component-info.ts
2152
2171
  var defaultTitle = {
@@ -2280,7 +2299,7 @@ var componentInfo = {
2280
2299
  };
2281
2300
 
2282
2301
  // src/blocks/accordion/accordion.tsx
2283
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2302
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2284
2303
 
2285
2304
  // src/blocks/accordion/helpers.ts
2286
2305
  var convertOrderNumberToString = (order) => {
@@ -2414,7 +2433,7 @@ function Accordion(props) {
2414
2433
  registeredComponents={props.builderComponents}
2415
2434
  linkComponent={props.builderLinkComponent}
2416
2435
  /></div>
2417
- <Show8 when={open().includes(index)}><div
2436
+ <Show9 when={open().includes(index)}><div
2418
2437
  class={getAccordionDetailClassName(index)}
2419
2438
  style={accordionDetailStyles()}
2420
2439
  ><Blocks_default
@@ -2424,7 +2443,7 @@ function Accordion(props) {
2424
2443
  context={props.builderContext}
2425
2444
  registeredComponents={props.builderComponents}
2426
2445
  linkComponent={props.builderLinkComponent}
2427
- /></div></Show8>
2446
+ /></div></Show9>
2428
2447
  </>;
2429
2448
  }}</For5></div></>;
2430
2449
  }
@@ -3105,7 +3124,7 @@ var componentInfo9 = {
3105
3124
  };
3106
3125
 
3107
3126
  // src/blocks/tabs/tabs.tsx
3108
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
3127
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
3109
3128
  function Tabs(props) {
3110
3129
  const [activeTab, setActiveTab] = createSignal10(
3111
3130
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -3147,14 +3166,14 @@ function Tabs(props) {
3147
3166
  linkComponent={props.builderLinkComponent}
3148
3167
  /></span>;
3149
3168
  }}</For6></div>
3150
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
3169
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
3151
3170
  parent={props.builderBlock.id}
3152
3171
  path={`component.options.tabs.${activeTab()}.content`}
3153
3172
  blocks={activeTabContent(activeTab())}
3154
3173
  context={props.builderContext}
3155
3174
  registeredComponents={props.builderComponents}
3156
3175
  linkComponent={props.builderLinkComponent}
3157
- /></div></Show9>
3176
+ /></div></Show10>
3158
3177
  </div></>;
3159
3178
  }
3160
3179
  var tabs_default = Tabs;
@@ -3243,12 +3262,12 @@ var componentInfo11 = {
3243
3262
  };
3244
3263
 
3245
3264
  // src/blocks/custom-code/custom-code.tsx
3246
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3265
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3247
3266
  function CustomCode(props) {
3248
3267
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3249
3268
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3250
3269
  let elementRef;
3251
- onMount4(() => {
3270
+ onMount5(() => {
3252
3271
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3253
3272
  return;
3254
3273
  }
@@ -3598,7 +3617,7 @@ var componentInfo13 = {
3598
3617
  };
3599
3618
 
3600
3619
  // src/blocks/form/form/form.tsx
3601
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3620
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
3602
3621
 
3603
3622
  // src/functions/get-env.ts
3604
3623
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3813,7 +3832,7 @@ function FormComponent(props) {
3813
3832
  {...{}}
3814
3833
  {...props.attributes}
3815
3834
  >
3816
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3835
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3817
3836
  const idx = _index();
3818
3837
  return <Block_default
3819
3838
  key={`form-block-${idx}`}
@@ -3822,23 +3841,23 @@ function FormComponent(props) {
3822
3841
  registeredComponents={props.builderComponents}
3823
3842
  linkComponent={props.builderLinkComponent}
3824
3843
  />;
3825
- }}</For7></Show10>
3826
- <Show10 when={submissionState() === "error"}><Blocks_default
3844
+ }}</For7></Show11>
3845
+ <Show11 when={submissionState() === "error"}><Blocks_default
3827
3846
  path="errorMessage"
3828
3847
  blocks={props.errorMessage}
3829
3848
  context={props.builderContext}
3830
- /></Show10>
3831
- <Show10 when={submissionState() === "sending"}><Blocks_default
3849
+ /></Show11>
3850
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3832
3851
  path="sendingMessage"
3833
3852
  blocks={props.sendingMessage}
3834
3853
  context={props.builderContext}
3835
- /></Show10>
3836
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3837
- <Show10 when={submissionState() === "success"}><Blocks_default
3854
+ /></Show11>
3855
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3856
+ <Show11 when={submissionState() === "success"}><Blocks_default
3838
3857
  path="successMessage"
3839
3858
  blocks={props.successMessage}
3840
3859
  context={props.builderContext}
3841
- /></Show10>
3860
+ /></Show11>
3842
3861
  </form>
3843
3862
  <style>{`.pre-2e825338 {
3844
3863
  padding: 10px;
@@ -4190,7 +4209,7 @@ var componentInfo19 = {
4190
4209
  };
4191
4210
 
4192
4211
  // src/blocks/video/video.tsx
4193
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4212
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4194
4213
  function Video(props) {
4195
4214
  const videoProps = createMemo15(() => {
4196
4215
  return {
@@ -4241,8 +4260,8 @@ function Video(props) {
4241
4260
  }}
4242
4261
  src={props.video || "no-src"}
4243
4262
  poster={props.posterImage}
4244
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4245
- <Show11
4263
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4264
+ <Show12
4246
4265
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4247
4266
  ><div
4248
4267
  style={{
@@ -4251,15 +4270,15 @@ function Video(props) {
4251
4270
  "pointer-events": "none",
4252
4271
  "font-size": "0px"
4253
4272
  }}
4254
- /></Show11>
4255
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4273
+ /></Show12>
4274
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4256
4275
  style={{
4257
4276
  display: "flex",
4258
4277
  "flex-direction": "column",
4259
4278
  "align-items": "stretch"
4260
4279
  }}
4261
- >{props.children}</div></Show11>
4262
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4280
+ >{props.children}</div></Show12>
4281
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4263
4282
  style={{
4264
4283
  "pointer-events": "none",
4265
4284
  display: "flex",
@@ -4271,7 +4290,7 @@ function Video(props) {
4271
4290
  width: "100%",
4272
4291
  height: "100%"
4273
4292
  }}
4274
- >{props.children}</div></Show11>
4293
+ >{props.children}</div></Show12>
4275
4294
  </div></>;
4276
4295
  }
4277
4296
  var video_default = Video;
@@ -4416,8 +4435,8 @@ var Inlined_script_default = InlinedScript;
4416
4435
 
4417
4436
  // src/components/content/components/enable-editor.tsx
4418
4437
  import {
4419
- Show as Show12,
4420
- onMount as onMount5,
4438
+ Show as Show13,
4439
+ onMount as onMount6,
4421
4440
  on as on3,
4422
4441
  createEffect as createEffect3,
4423
4442
  createMemo as createMemo16,
@@ -4924,7 +4943,7 @@ function isFromTrustedHost(trustedHosts, e) {
4924
4943
  }
4925
4944
 
4926
4945
  // src/constants/sdk-version.ts
4927
- var SDK_VERSION = "2.0.16";
4946
+ var SDK_VERSION = "2.0.21";
4928
4947
 
4929
4948
  // src/functions/register.ts
4930
4949
  var registry = {};
@@ -5277,22 +5296,6 @@ function EnableEditor(props) {
5277
5296
  }
5278
5297
  })(event);
5279
5298
  }
5280
- function evaluateJsCode() {
5281
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5282
- if (jsCode) {
5283
- evaluate({
5284
- code: jsCode,
5285
- context: props.context || {},
5286
- localState: void 0,
5287
- rootState: props.builderContextSignal.rootState,
5288
- rootSetState: props.builderContextSignal.rootSetState,
5289
- /**
5290
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5291
- */
5292
- enableCache: false
5293
- });
5294
- }
5295
- }
5296
5299
  function onClick(event) {
5297
5300
  if (props.builderContextSignal.content) {
5298
5301
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5334,7 +5337,7 @@ function EnableEditor(props) {
5334
5337
  })
5335
5338
  )
5336
5339
  );
5337
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5340
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5338
5341
  mergeNewRootState({
5339
5342
  [key]: json
5340
5343
  });
@@ -5364,7 +5367,9 @@ function EnableEditor(props) {
5364
5367
  }
5365
5368
  }
5366
5369
  let elementRef;
5367
- onMount5(() => {
5370
+ runHttpRequests();
5371
+ emitStateUpdate();
5372
+ onMount6(() => {
5368
5373
  if (isBrowser()) {
5369
5374
  if (isEditing()) {
5370
5375
  window.addEventListener("message", processMessage);
@@ -5425,16 +5430,6 @@ function EnableEditor(props) {
5425
5430
  }
5426
5431
  }
5427
5432
  });
5428
- onMount5(() => {
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
- evaluateJsCode();
5435
- runHttpRequests();
5436
- emitStateUpdate();
5437
- });
5438
5433
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5439
5434
  function onUpdateFn_0() {
5440
5435
  if (props.content) {
@@ -5442,57 +5437,35 @@ function EnableEditor(props) {
5442
5437
  }
5443
5438
  }
5444
5439
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5445
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5446
- function onUpdateFn_1() {
5447
- evaluateJsCode();
5448
- }
5449
- createEffect3(
5450
- on3(
5451
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5452
- onUpdateFn_1
5453
- )
5454
- );
5455
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5456
- function onUpdateFn_2() {
5457
- runHttpRequests();
5458
- }
5459
- createEffect3(
5460
- on3(
5461
- () => [
5462
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5463
- ],
5464
- onUpdateFn_2
5465
- )
5466
- );
5467
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5440
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5468
5441
  () => props.builderContextSignal.rootState
5469
5442
  );
5470
- function onUpdateFn_3() {
5443
+ function onUpdateFn_1() {
5471
5444
  emitStateUpdate();
5472
5445
  }
5473
5446
  createEffect3(
5474
5447
  on3(
5475
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5476
- onUpdateFn_3
5448
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5449
+ onUpdateFn_1
5477
5450
  )
5478
5451
  );
5479
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5480
- function onUpdateFn_4() {
5452
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5453
+ function onUpdateFn_2() {
5481
5454
  if (props.data) {
5482
5455
  mergeNewRootState(props.data);
5483
5456
  }
5484
5457
  }
5485
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5486
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5487
- function onUpdateFn_5() {
5458
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5459
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5460
+ function onUpdateFn_3() {
5488
5461
  if (props.locale) {
5489
5462
  mergeNewRootState({
5490
5463
  locale: props.locale
5491
5464
  });
5492
5465
  }
5493
5466
  }
5494
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5495
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
5467
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5468
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
5496
5469
  class={getWrapperClassName(
5497
5470
  props.content?.testVariationId || props.content?.id
5498
5471
  )}
@@ -5505,7 +5478,7 @@ function EnableEditor(props) {
5505
5478
  {...showContentProps()}
5506
5479
  {...props.contentWrapperProps}
5507
5480
  component={ContentWrapper()}
5508
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5481
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5509
5482
  }
5510
5483
  var Enable_editor_default = EnableEditor;
5511
5484
 
@@ -5642,6 +5615,31 @@ function ContentComponent(props) {
5642
5615
  rootState: newRootState
5643
5616
  }));
5644
5617
  }
5618
+ if (!props.apiKey) {
5619
+ logger.error(
5620
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5621
+ );
5622
+ }
5623
+ const jsCode = builderContextSignal().content?.data?.jsCode;
5624
+ if (jsCode) {
5625
+ evaluate({
5626
+ code: jsCode,
5627
+ context: props.context || {},
5628
+ localState: void 0,
5629
+ rootState: builderContextSignal().rootState,
5630
+ rootSetState: (newState) => {
5631
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
5632
+ ...PREVIOUS_VALUE,
5633
+ rootState: newState
5634
+ }));
5635
+ },
5636
+ isExpression: false,
5637
+ /**
5638
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5639
+ */
5640
+ enableCache: false
5641
+ });
5642
+ }
5645
5643
  return <><components_context_default.Provider
5646
5644
  value={{
5647
5645
  registeredComponents: registeredComponents()
@@ -5665,18 +5663,18 @@ function ContentComponent(props) {
5665
5663
  setBuilderContextSignal
5666
5664
  }}
5667
5665
  >
5668
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5666
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5669
5667
  id="builderio-variant-visibility"
5670
5668
  scriptStr={scriptStr()}
5671
5669
  nonce={props.nonce || ""}
5672
- /></Show13>
5673
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5670
+ /></Show14>
5671
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5674
5672
  nonce={props.nonce || ""}
5675
5673
  isNestedRender={props.isNestedRender}
5676
5674
  contentId={builderContextSignal().content?.id}
5677
5675
  cssCode={builderContextSignal().content?.data?.cssCode}
5678
5676
  customFonts={builderContextSignal().content?.data?.customFonts}
5679
- /></Show13>
5677
+ /></Show14>
5680
5678
  <Blocks_default
5681
5679
  blocks={builderContextSignal().content?.data?.blocks}
5682
5680
  context={builderContextSignal()}
@@ -5716,16 +5714,16 @@ function ContentVariants(props) {
5716
5714
  canTrack: getDefaultCanTrack(props.canTrack)
5717
5715
  });
5718
5716
  });
5719
- onMount6(() => {
5717
+ onMount7(() => {
5720
5718
  setShouldRenderVariants(false);
5721
5719
  });
5722
5720
  return <><>
5723
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5721
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5724
5722
  id="builderio-init-variants-fns"
5725
5723
  scriptStr={getInitVariantsFnsScriptString()}
5726
5724
  nonce={props.nonce || ""}
5727
- /></Show14>
5728
- <Show14 when={shouldRenderVariants()}>
5725
+ /></Show15>
5726
+ <Show15 when={shouldRenderVariants()}>
5729
5727
  <Inlined_styles_default
5730
5728
  id="builderio-variants"
5731
5729
  styles={hideVariantsStyleString()}
@@ -5763,7 +5761,7 @@ function ContentVariants(props) {
5763
5761
  {...{}}
5764
5762
  />;
5765
5763
  }}</For9>
5766
- </Show14>
5764
+ </Show15>
5767
5765
  <Content_default
5768
5766
  nonce={props.nonce}
5769
5767
  isNestedRender={props.isNestedRender}
@@ -5844,7 +5842,7 @@ function Symbol(props) {
5844
5842
  }
5845
5843
  });
5846
5844
  }
5847
- onMount7(() => {
5845
+ onMount8(() => {
5848
5846
  });
5849
5847
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5850
5848
  function onUpdateFn_0() {