@builder.io/sdk-solid 2.0.15 → 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)
@@ -499,24 +499,30 @@ function isNodeRuntime() {
499
499
  }
500
500
 
501
501
  // src/functions/evaluate/should-force-browser-runtime-in-node.ts
502
- var shouldForceBrowserRuntimeInNode = () => {
502
+ var shouldForceBrowserRuntimeInNode = ({
503
+ shouldLogWarning
504
+ }) => {
503
505
  if (!isNodeRuntime())
504
506
  return false;
505
507
  const isArm64 = process.arch === "arm64";
506
508
  const isNode20 = process.version.startsWith("v20");
507
509
  const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes("--no-node-snapshot");
508
510
  if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
509
- logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
511
+ if (shouldLogWarning) {
512
+ logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
510
513
  If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
511
514
  See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
512
515
  `);
516
+ }
513
517
  return true;
514
518
  }
515
519
  return false;
516
520
  };
517
521
 
518
522
  // src/functions/evaluate/choose-eval.ts
519
- var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInNode(args);
523
+ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
524
+ shouldLogWarning: true
525
+ }) ? runInBrowser(args) : runInNode(args);
520
526
 
521
527
  // src/functions/evaluate/evaluate.ts
522
528
  var DISABLE_CACHE = true;
@@ -1252,12 +1258,23 @@ function BlockWrapper(props) {
1252
1258
  var Block_wrapper_default = BlockWrapper;
1253
1259
 
1254
1260
  // src/components/block/components/component-ref/component-ref.tsx
1255
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1261
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1256
1262
  import { Dynamic as Dynamic3 } from "solid-js/web";
1257
1263
 
1258
1264
  // src/components/block/components/interactive-element.tsx
1259
- import { createMemo as createMemo2 } from "solid-js";
1265
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1260
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
1261
1278
  function InteractiveElement(props) {
1262
1279
  const attributes = createMemo2(() => {
1263
1280
  return props.includeBlockProps ? {
@@ -1274,11 +1291,19 @@ function InteractiveElement(props) {
1274
1291
  })
1275
1292
  } : {};
1276
1293
  });
1277
- return <><Dynamic2
1278
- {...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}
1279
1305
  attributes={attributes()}
1280
- component={props.Wrapper}
1281
- >{props.children}</Dynamic2></>;
1306
+ >{props.children}</Awaiter_default></Show3></>;
1282
1307
  }
1283
1308
  var interactive_element_default = InteractiveElement;
1284
1309
 
@@ -1320,7 +1345,7 @@ function ComponentRef(props) {
1320
1345
  const [Wrapper, setWrapper] = createSignal3(
1321
1346
  props.isInteractive ? interactive_element_default : props.componentRef
1322
1347
  );
1323
- return <><Show3 when={props.componentRef}><Dynamic3
1348
+ return <><Show4 when={props.componentRef}><Dynamic3
1324
1349
  {...getWrapperProps({
1325
1350
  componentOptions: props.componentOptions,
1326
1351
  builderBlock: props.builderBlock,
@@ -1341,7 +1366,7 @@ function ComponentRef(props) {
1341
1366
  registeredComponents={props.registeredComponents}
1342
1367
  linkComponent={props.linkComponent}
1343
1368
  />;
1344
- }}</For></Dynamic3></Show3></>;
1369
+ }}</For></Dynamic3></Show4></>;
1345
1370
  }
1346
1371
  var Component_ref_default = ComponentRef;
1347
1372
 
@@ -1430,7 +1455,7 @@ function Block(props) {
1430
1455
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1431
1456
  };
1432
1457
  });
1433
- onMount(() => {
1458
+ onMount2(() => {
1434
1459
  const blockId = processedBlock().id;
1435
1460
  const animations = processedBlock().animations;
1436
1461
  if (animations && blockId) {
@@ -1442,13 +1467,13 @@ function Block(props) {
1442
1467
  );
1443
1468
  }
1444
1469
  });
1445
- return <><Show4 when={canShowBlock()}>
1470
+ return <><Show5 when={canShowBlock()}>
1446
1471
  <Block_styles_default
1447
1472
  block={processedBlock()}
1448
1473
  context={props.context}
1449
1474
  />
1450
- <Show4
1451
- fallback={<Show4
1475
+ <Show5
1476
+ fallback={<Show5
1452
1477
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1453
1478
  const index = _index();
1454
1479
  return <Repeated_block_default
@@ -1470,9 +1495,9 @@ function Block(props) {
1470
1495
  builderBlock={componentRefProps().builderBlock}
1471
1496
  includeBlockProps={componentRefProps().includeBlockProps}
1472
1497
  isInteractive={componentRefProps().isInteractive}
1473
- /></Show4>}
1498
+ /></Show5>}
1474
1499
  when={!blockComponent()?.noWrap}
1475
- ><Show4
1500
+ ><Show5
1476
1501
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1477
1502
  const index = _index();
1478
1503
  return <Repeated_block_default
@@ -1510,13 +1535,13 @@ function Block(props) {
1510
1535
  context={props.context}
1511
1536
  />;
1512
1537
  }}</For2>
1513
- </Block_wrapper_default></Show4></Show4>
1514
- </Show4></>;
1538
+ </Block_wrapper_default></Show5></Show5>
1539
+ </Show5></>;
1515
1540
  }
1516
1541
  var Block_default = Block;
1517
1542
 
1518
1543
  // src/components/blocks/blocks-wrapper.tsx
1519
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1544
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1520
1545
  import { Dynamic as Dynamic4 } from "solid-js/web";
1521
1546
  function BlocksWrapper(props) {
1522
1547
  const className = createMemo6(() => {
@@ -1551,11 +1576,11 @@ function BlocksWrapper(props) {
1551
1576
  }
1552
1577
  }
1553
1578
  let blocksWrapperRef;
1554
- onMount2(() => {
1579
+ onMount3(() => {
1555
1580
  });
1556
1581
  return <>
1557
1582
  <Dynamic4
1558
- class={className() + " dynamic-4da8c6f4"}
1583
+ class={className() + " dynamic-68b2d7fe"}
1559
1584
  ref={blocksWrapperRef}
1560
1585
  builder-path={props.path}
1561
1586
  builder-parent-id={props.parent}
@@ -1567,7 +1592,7 @@ function BlocksWrapper(props) {
1567
1592
  {...props.BlocksWrapperProps}
1568
1593
  component={props.BlocksWrapper}
1569
1594
  >{props.children}</Dynamic4>
1570
- <style>{`.dynamic-4da8c6f4 {
1595
+ <style>{`.dynamic-68b2d7fe {
1571
1596
  display: flex;
1572
1597
  flex-direction: column;
1573
1598
  align-items: stretch;
@@ -1587,7 +1612,7 @@ function Blocks(props) {
1587
1612
  styleProp={props.styleProp}
1588
1613
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1589
1614
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1590
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1615
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1591
1616
  const index = _index();
1592
1617
  return <Block_default
1593
1618
  key={block.id}
@@ -1596,7 +1621,7 @@ function Blocks(props) {
1596
1621
  context={props.context || builderContext}
1597
1622
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1598
1623
  />;
1599
- }}</For3></Show5></Blocks_wrapper_default></>;
1624
+ }}</For3></Show6></Blocks_wrapper_default></>;
1600
1625
  }
1601
1626
  var Blocks_default = Blocks;
1602
1627
 
@@ -1727,15 +1752,15 @@ function Columns(props) {
1727
1752
  }
1728
1753
  return <>
1729
1754
  <div
1730
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1755
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1731
1756
  style={columnsCssVars()}
1732
1757
  {...{}}
1733
1758
  >
1734
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1759
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1735
1760
  id="builderio-columns"
1736
1761
  styles={columnsStyles()}
1737
1762
  nonce={props.builderContext.nonce}
1738
- /></Show6>
1763
+ /></Show7>
1739
1764
  <For4 each={props.columns}>{(column, _index) => {
1740
1765
  const index = _index();
1741
1766
  return <Dynamic_renderer_default
@@ -1756,7 +1781,7 @@ function Columns(props) {
1756
1781
  /></Dynamic_renderer_default>;
1757
1782
  }}</For4>
1758
1783
  </div>
1759
- <style>{`.div-3ff242de {
1784
+ <style>{`.div-46766f1c {
1760
1785
  display: flex;
1761
1786
  line-height: normal;
1762
1787
  }`}</style>
@@ -1771,7 +1796,7 @@ function FragmentComponent(props) {
1771
1796
  var fragment_default = FragmentComponent;
1772
1797
 
1773
1798
  // src/blocks/image/image.tsx
1774
- 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";
1775
1800
 
1776
1801
  // src/blocks/image/image.helpers.ts
1777
1802
  function removeProtocol(path) {
@@ -1860,14 +1885,14 @@ function Image(props) {
1860
1885
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1861
1886
  return out;
1862
1887
  });
1863
- onMount3(() => {
1888
+ onMount4(() => {
1864
1889
  });
1865
1890
  return <>
1866
1891
  <>
1867
1892
  <picture>
1868
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1893
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1869
1894
  <img
1870
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1895
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1871
1896
  loading={props.highPriority ? "eager" : "lazy"}
1872
1897
  fetchpriority={props.highPriority ? "high" : "auto"}
1873
1898
  alt={props.altText}
@@ -1882,25 +1907,25 @@ function Image(props) {
1882
1907
  sizes={props.sizes}
1883
1908
  />
1884
1909
  </picture>
1885
- <Show7
1910
+ <Show8
1886
1911
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1887
1912
  ><div
1888
- class="builder-image-sizer div-4512e110"
1913
+ class="builder-image-sizer div-7e6ffddc"
1889
1914
  style={{
1890
1915
  "padding-top": props.aspectRatio * 100 + "%"
1891
1916
  }}
1892
- /></Show7>
1893
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1894
- <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>
1895
1920
  </>
1896
- <style>{`.img-4512e110 {
1921
+ <style>{`.img-7e6ffddc {
1897
1922
  opacity: 1;
1898
1923
  transition: opacity 0.2s ease-in-out;
1899
- }.div-4512e110 {
1924
+ }.div-7e6ffddc {
1900
1925
  width: 100%;
1901
1926
  pointer-events: none;
1902
1927
  font-size: 0;
1903
- }.div-4512e110-2 {
1928
+ }.div-7e6ffddc-2 {
1904
1929
  display: flex;
1905
1930
  flex-direction: column;
1906
1931
  align-items: stretch;
@@ -1936,10 +1961,10 @@ function SectionComponent(props) {
1936
1961
  var section_default = SectionComponent;
1937
1962
 
1938
1963
  // src/blocks/symbol/symbol.tsx
1939
- 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";
1940
1965
 
1941
1966
  // src/components/content-variants/content-variants.tsx
1942
- 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";
1943
1968
 
1944
1969
  // src/helpers/url.ts
1945
1970
  var getTopLevelDomain = (host) => {
@@ -2133,7 +2158,7 @@ var handleABTesting = async ({
2133
2158
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2134
2159
 
2135
2160
  // src/components/content/content.tsx
2136
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
2161
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
2137
2162
 
2138
2163
  // src/blocks/accordion/component-info.ts
2139
2164
  var defaultTitle = {
@@ -2267,7 +2292,7 @@ var componentInfo = {
2267
2292
  };
2268
2293
 
2269
2294
  // src/blocks/accordion/accordion.tsx
2270
- 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";
2271
2296
 
2272
2297
  // src/blocks/accordion/helpers.ts
2273
2298
  var convertOrderNumberToString = (order) => {
@@ -2401,7 +2426,7 @@ function Accordion(props) {
2401
2426
  registeredComponents={props.builderComponents}
2402
2427
  linkComponent={props.builderLinkComponent}
2403
2428
  /></div>
2404
- <Show8 when={open().includes(index)}><div
2429
+ <Show9 when={open().includes(index)}><div
2405
2430
  class={getAccordionDetailClassName(index)}
2406
2431
  style={accordionDetailStyles()}
2407
2432
  ><Blocks_default
@@ -2411,7 +2436,7 @@ function Accordion(props) {
2411
2436
  context={props.builderContext}
2412
2437
  registeredComponents={props.builderComponents}
2413
2438
  linkComponent={props.builderLinkComponent}
2414
- /></div></Show8>
2439
+ /></div></Show9>
2415
2440
  </>;
2416
2441
  }}</For5></div></>;
2417
2442
  }
@@ -3091,7 +3116,7 @@ var componentInfo9 = {
3091
3116
  };
3092
3117
 
3093
3118
  // src/blocks/tabs/tabs.tsx
3094
- 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";
3095
3120
  function Tabs(props) {
3096
3121
  const [activeTab, setActiveTab] = createSignal10(
3097
3122
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -3133,14 +3158,14 @@ function Tabs(props) {
3133
3158
  linkComponent={props.builderLinkComponent}
3134
3159
  /></span>;
3135
3160
  }}</For6></div>
3136
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
3161
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
3137
3162
  parent={props.builderBlock.id}
3138
3163
  path={`component.options.tabs.${activeTab()}.content`}
3139
3164
  blocks={activeTabContent(activeTab())}
3140
3165
  context={props.builderContext}
3141
3166
  registeredComponents={props.builderComponents}
3142
3167
  linkComponent={props.builderLinkComponent}
3143
- /></div></Show9>
3168
+ /></div></Show10>
3144
3169
  </div></>;
3145
3170
  }
3146
3171
  var tabs_default = Tabs;
@@ -3229,12 +3254,12 @@ var componentInfo11 = {
3229
3254
  };
3230
3255
 
3231
3256
  // src/blocks/custom-code/custom-code.tsx
3232
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3257
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3233
3258
  function CustomCode(props) {
3234
3259
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3235
3260
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3236
3261
  let elementRef;
3237
- onMount4(() => {
3262
+ onMount5(() => {
3238
3263
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3239
3264
  return;
3240
3265
  }
@@ -3582,7 +3607,7 @@ var componentInfo13 = {
3582
3607
  };
3583
3608
 
3584
3609
  // src/blocks/form/form/form.tsx
3585
- 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";
3586
3611
 
3587
3612
  // src/functions/get-env.ts
3588
3613
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3797,7 +3822,7 @@ function FormComponent(props) {
3797
3822
  {...{}}
3798
3823
  {...props.attributes}
3799
3824
  >
3800
- <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) => {
3801
3826
  const idx = _index();
3802
3827
  return <Block_default
3803
3828
  key={`form-block-${idx}`}
@@ -3806,23 +3831,23 @@ function FormComponent(props) {
3806
3831
  registeredComponents={props.builderComponents}
3807
3832
  linkComponent={props.builderLinkComponent}
3808
3833
  />;
3809
- }}</For7></Show10>
3810
- <Show10 when={submissionState() === "error"}><Blocks_default
3834
+ }}</For7></Show11>
3835
+ <Show11 when={submissionState() === "error"}><Blocks_default
3811
3836
  path="errorMessage"
3812
3837
  blocks={props.errorMessage}
3813
3838
  context={props.builderContext}
3814
- /></Show10>
3815
- <Show10 when={submissionState() === "sending"}><Blocks_default
3839
+ /></Show11>
3840
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3816
3841
  path="sendingMessage"
3817
3842
  blocks={props.sendingMessage}
3818
3843
  context={props.builderContext}
3819
- /></Show10>
3820
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3821
- <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
3822
3847
  path="successMessage"
3823
3848
  blocks={props.successMessage}
3824
3849
  context={props.builderContext}
3825
- /></Show10>
3850
+ /></Show11>
3826
3851
  </form>
3827
3852
  <style>{`.pre-2e825338 {
3828
3853
  padding: 10px;
@@ -4174,7 +4199,7 @@ var componentInfo19 = {
4174
4199
  };
4175
4200
 
4176
4201
  // src/blocks/video/video.tsx
4177
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4202
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4178
4203
  function Video(props) {
4179
4204
  const videoProps = createMemo15(() => {
4180
4205
  return {
@@ -4225,8 +4250,8 @@ function Video(props) {
4225
4250
  }}
4226
4251
  src={props.video || "no-src"}
4227
4252
  poster={props.posterImage}
4228
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4229
- <Show11
4253
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4254
+ <Show12
4230
4255
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4231
4256
  ><div
4232
4257
  style={{
@@ -4235,15 +4260,15 @@ function Video(props) {
4235
4260
  "pointer-events": "none",
4236
4261
  "font-size": "0px"
4237
4262
  }}
4238
- /></Show11>
4239
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4263
+ /></Show12>
4264
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4240
4265
  style={{
4241
4266
  display: "flex",
4242
4267
  "flex-direction": "column",
4243
4268
  "align-items": "stretch"
4244
4269
  }}
4245
- >{props.children}</div></Show11>
4246
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4270
+ >{props.children}</div></Show12>
4271
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4247
4272
  style={{
4248
4273
  "pointer-events": "none",
4249
4274
  display: "flex",
@@ -4255,7 +4280,7 @@ function Video(props) {
4255
4280
  width: "100%",
4256
4281
  height: "100%"
4257
4282
  }}
4258
- >{props.children}</div></Show11>
4283
+ >{props.children}</div></Show12>
4259
4284
  </div></>;
4260
4285
  }
4261
4286
  var video_default = Video;
@@ -4400,8 +4425,8 @@ var Inlined_script_default = InlinedScript;
4400
4425
 
4401
4426
  // src/components/content/components/enable-editor.tsx
4402
4427
  import {
4403
- Show as Show12,
4404
- onMount as onMount5,
4428
+ Show as Show13,
4429
+ onMount as onMount6,
4405
4430
  on as on3,
4406
4431
  createEffect as createEffect3,
4407
4432
  createMemo as createMemo16,
@@ -4903,7 +4928,7 @@ function isFromTrustedHost(trustedHosts, e) {
4903
4928
  }
4904
4929
 
4905
4930
  // src/constants/sdk-version.ts
4906
- var SDK_VERSION = "2.0.15";
4931
+ var SDK_VERSION = "2.0.21";
4907
4932
 
4908
4933
  // src/functions/register.ts
4909
4934
  var registry = {};
@@ -5255,22 +5280,6 @@ function EnableEditor(props) {
5255
5280
  }
5256
5281
  })(event);
5257
5282
  }
5258
- function evaluateJsCode() {
5259
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5260
- if (jsCode) {
5261
- evaluate({
5262
- code: jsCode,
5263
- context: props.context || {},
5264
- localState: void 0,
5265
- rootState: props.builderContextSignal.rootState,
5266
- rootSetState: props.builderContextSignal.rootSetState,
5267
- /**
5268
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5269
- */
5270
- enableCache: false
5271
- });
5272
- }
5273
- }
5274
5283
  function onClick(event) {
5275
5284
  if (props.builderContextSignal.content) {
5276
5285
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5312,7 +5321,7 @@ function EnableEditor(props) {
5312
5321
  })
5313
5322
  )
5314
5323
  );
5315
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5324
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5316
5325
  mergeNewRootState({
5317
5326
  [key]: json
5318
5327
  });
@@ -5341,7 +5350,9 @@ function EnableEditor(props) {
5341
5350
  }
5342
5351
  }
5343
5352
  let elementRef;
5344
- onMount5(() => {
5353
+ runHttpRequests();
5354
+ emitStateUpdate();
5355
+ onMount6(() => {
5345
5356
  if (isBrowser()) {
5346
5357
  if (isEditing()) {
5347
5358
  window.addEventListener("message", processMessage);
@@ -5402,16 +5413,6 @@ function EnableEditor(props) {
5402
5413
  }
5403
5414
  }
5404
5415
  });
5405
- onMount5(() => {
5406
- if (!props.apiKey) {
5407
- logger.error(
5408
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5409
- );
5410
- }
5411
- evaluateJsCode();
5412
- runHttpRequests();
5413
- emitStateUpdate();
5414
- });
5415
5416
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5416
5417
  function onUpdateFn_0() {
5417
5418
  if (props.content) {
@@ -5419,57 +5420,35 @@ function EnableEditor(props) {
5419
5420
  }
5420
5421
  }
5421
5422
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5422
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5423
- function onUpdateFn_1() {
5424
- evaluateJsCode();
5425
- }
5426
- createEffect3(
5427
- on3(
5428
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5429
- onUpdateFn_1
5430
- )
5431
- );
5432
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5433
- function onUpdateFn_2() {
5434
- runHttpRequests();
5435
- }
5436
- createEffect3(
5437
- on3(
5438
- () => [
5439
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5440
- ],
5441
- onUpdateFn_2
5442
- )
5443
- );
5444
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5423
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5445
5424
  () => props.builderContextSignal.rootState
5446
5425
  );
5447
- function onUpdateFn_3() {
5426
+ function onUpdateFn_1() {
5448
5427
  emitStateUpdate();
5449
5428
  }
5450
5429
  createEffect3(
5451
5430
  on3(
5452
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5453
- onUpdateFn_3
5431
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5432
+ onUpdateFn_1
5454
5433
  )
5455
5434
  );
5456
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5457
- function onUpdateFn_4() {
5435
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5436
+ function onUpdateFn_2() {
5458
5437
  if (props.data) {
5459
5438
  mergeNewRootState(props.data);
5460
5439
  }
5461
5440
  }
5462
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5463
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5464
- 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() {
5465
5444
  if (props.locale) {
5466
5445
  mergeNewRootState({
5467
5446
  locale: props.locale
5468
5447
  });
5469
5448
  }
5470
5449
  }
5471
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5472
- 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
5473
5452
  class={getWrapperClassName(
5474
5453
  props.content?.testVariationId || props.content?.id
5475
5454
  )}
@@ -5482,7 +5461,7 @@ function EnableEditor(props) {
5482
5461
  {...showContentProps()}
5483
5462
  {...props.contentWrapperProps}
5484
5463
  component={ContentWrapper()}
5485
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5464
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5486
5465
  }
5487
5466
  var Enable_editor_default = EnableEditor;
5488
5467
 
@@ -5619,6 +5598,31 @@ function ContentComponent(props) {
5619
5598
  rootState: newRootState
5620
5599
  }));
5621
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
+ }
5622
5626
  return <><components_context_default.Provider
5623
5627
  value={{
5624
5628
  registeredComponents: registeredComponents()
@@ -5642,18 +5646,18 @@ function ContentComponent(props) {
5642
5646
  setBuilderContextSignal
5643
5647
  }}
5644
5648
  >
5645
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5649
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5646
5650
  id="builderio-variant-visibility"
5647
5651
  scriptStr={scriptStr()}
5648
5652
  nonce={props.nonce || ""}
5649
- /></Show13>
5650
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5653
+ /></Show14>
5654
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5651
5655
  nonce={props.nonce || ""}
5652
5656
  isNestedRender={props.isNestedRender}
5653
5657
  contentId={builderContextSignal().content?.id}
5654
5658
  cssCode={builderContextSignal().content?.data?.cssCode}
5655
5659
  customFonts={builderContextSignal().content?.data?.customFonts}
5656
- /></Show13>
5660
+ /></Show14>
5657
5661
  <Blocks_default
5658
5662
  blocks={builderContextSignal().content?.data?.blocks}
5659
5663
  context={builderContextSignal()}
@@ -5693,16 +5697,16 @@ function ContentVariants(props) {
5693
5697
  canTrack: getDefaultCanTrack(props.canTrack)
5694
5698
  });
5695
5699
  });
5696
- onMount6(() => {
5700
+ onMount7(() => {
5697
5701
  setShouldRenderVariants(false);
5698
5702
  });
5699
5703
  return <><>
5700
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5704
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5701
5705
  id="builderio-init-variants-fns"
5702
5706
  scriptStr={getInitVariantsFnsScriptString()}
5703
5707
  nonce={props.nonce || ""}
5704
- /></Show14>
5705
- <Show14 when={shouldRenderVariants()}>
5708
+ /></Show15>
5709
+ <Show15 when={shouldRenderVariants()}>
5706
5710
  <Inlined_styles_default
5707
5711
  id="builderio-variants"
5708
5712
  styles={hideVariantsStyleString()}
@@ -5740,7 +5744,7 @@ function ContentVariants(props) {
5740
5744
  {...{}}
5741
5745
  />;
5742
5746
  }}</For9>
5743
- </Show14>
5747
+ </Show15>
5744
5748
  <Content_default
5745
5749
  nonce={props.nonce}
5746
5750
  isNestedRender={props.isNestedRender}
@@ -5821,7 +5825,7 @@ function Symbol(props) {
5821
5825
  }
5822
5826
  });
5823
5827
  }
5824
- onMount7(() => {
5828
+ onMount8(() => {
5825
5829
  });
5826
5830
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5827
5831
  function onUpdateFn_0() {