@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";
@@ -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/helpers/nullable.ts
311
311
  var checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
312
312
 
@@ -316,24 +316,30 @@ function isNodeRuntime() {
316
316
  }
317
317
 
318
318
  // src/functions/evaluate/should-force-browser-runtime-in-node.ts
319
- var shouldForceBrowserRuntimeInNode = () => {
319
+ var shouldForceBrowserRuntimeInNode = ({
320
+ shouldLogWarning
321
+ }) => {
320
322
  if (!isNodeRuntime())
321
323
  return false;
322
324
  const isArm64 = process.arch === "arm64";
323
325
  const isNode20 = process.version.startsWith("v20");
324
326
  const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes("--no-node-snapshot");
325
327
  if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
326
- logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
328
+ if (shouldLogWarning) {
329
+ logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
327
330
  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.
328
331
  See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
329
332
  `);
333
+ }
330
334
  return true;
331
335
  }
332
336
  return false;
333
337
  };
334
338
 
335
339
  // src/functions/evaluate/choose-eval.ts
336
- var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
340
+ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
341
+ shouldLogWarning: true
342
+ }) ? runInBrowser(args) : runInBrowser(args);
337
343
 
338
344
  // src/functions/evaluate/evaluate.ts
339
345
  var DISABLE_CACHE = true;
@@ -1086,12 +1092,23 @@ function BlockWrapper(props) {
1086
1092
  var Block_wrapper_default = BlockWrapper;
1087
1093
 
1088
1094
  // src/components/block/components/component-ref/component-ref.tsx
1089
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1095
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1090
1096
  import { Dynamic as Dynamic3 } from "solid-js/web";
1091
1097
 
1092
1098
  // src/components/block/components/interactive-element.tsx
1093
- import { createMemo as createMemo2 } from "solid-js";
1099
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1094
1100
  import { Dynamic as Dynamic2 } from "solid-js/web";
1101
+
1102
+ // src/components/awaiter.tsx
1103
+ import { onMount } from "solid-js";
1104
+ function Awaiter(props) {
1105
+ onMount(() => {
1106
+ });
1107
+ return <><>{props.children}</></>;
1108
+ }
1109
+ var Awaiter_default = Awaiter;
1110
+
1111
+ // src/components/block/components/interactive-element.tsx
1095
1112
  function InteractiveElement(props) {
1096
1113
  const attributes = createMemo2(() => {
1097
1114
  return props.includeBlockProps ? {
@@ -1108,11 +1125,19 @@ function InteractiveElement(props) {
1108
1125
  })
1109
1126
  } : {};
1110
1127
  });
1111
- return <><Dynamic2
1112
- {...props.wrapperProps}
1128
+ return <><Show3
1129
+ fallback={<Dynamic2
1130
+ {...props.wrapperProps}
1131
+ attributes={attributes()}
1132
+ component={props.Wrapper}
1133
+ >{props.children}</Dynamic2>}
1134
+ when={props.Wrapper.load}
1135
+ ><Awaiter_default
1136
+ load={props.Wrapper.load}
1137
+ fallback={props.Wrapper.fallback}
1138
+ props={props.wrapperProps}
1113
1139
  attributes={attributes()}
1114
- component={props.Wrapper}
1115
- >{props.children}</Dynamic2></>;
1140
+ >{props.children}</Awaiter_default></Show3></>;
1116
1141
  }
1117
1142
  var interactive_element_default = InteractiveElement;
1118
1143
 
@@ -1154,7 +1179,7 @@ function ComponentRef(props) {
1154
1179
  const [Wrapper, setWrapper] = createSignal3(
1155
1180
  props.isInteractive ? interactive_element_default : props.componentRef
1156
1181
  );
1157
- return <><Show3 when={props.componentRef}><Dynamic3
1182
+ return <><Show4 when={props.componentRef}><Dynamic3
1158
1183
  {...getWrapperProps({
1159
1184
  componentOptions: props.componentOptions,
1160
1185
  builderBlock: props.builderBlock,
@@ -1175,7 +1200,7 @@ function ComponentRef(props) {
1175
1200
  registeredComponents={props.registeredComponents}
1176
1201
  linkComponent={props.linkComponent}
1177
1202
  />;
1178
- }}</For></Dynamic3></Show3></>;
1203
+ }}</For></Dynamic3></Show4></>;
1179
1204
  }
1180
1205
  var Component_ref_default = ComponentRef;
1181
1206
 
@@ -1264,7 +1289,7 @@ function Block(props) {
1264
1289
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1265
1290
  };
1266
1291
  });
1267
- onMount(() => {
1292
+ onMount2(() => {
1268
1293
  const blockId = processedBlock().id;
1269
1294
  const animations = processedBlock().animations;
1270
1295
  if (animations && blockId) {
@@ -1276,13 +1301,13 @@ function Block(props) {
1276
1301
  );
1277
1302
  }
1278
1303
  });
1279
- return <><Show4 when={canShowBlock()}>
1304
+ return <><Show5 when={canShowBlock()}>
1280
1305
  <Block_styles_default
1281
1306
  block={processedBlock()}
1282
1307
  context={props.context}
1283
1308
  />
1284
- <Show4
1285
- fallback={<Show4
1309
+ <Show5
1310
+ fallback={<Show5
1286
1311
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1287
1312
  const index = _index();
1288
1313
  return <Repeated_block_default
@@ -1304,9 +1329,9 @@ function Block(props) {
1304
1329
  builderBlock={componentRefProps().builderBlock}
1305
1330
  includeBlockProps={componentRefProps().includeBlockProps}
1306
1331
  isInteractive={componentRefProps().isInteractive}
1307
- /></Show4>}
1332
+ /></Show5>}
1308
1333
  when={!blockComponent()?.noWrap}
1309
- ><Show4
1334
+ ><Show5
1310
1335
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1311
1336
  const index = _index();
1312
1337
  return <Repeated_block_default
@@ -1344,13 +1369,13 @@ function Block(props) {
1344
1369
  context={props.context}
1345
1370
  />;
1346
1371
  }}</For2>
1347
- </Block_wrapper_default></Show4></Show4>
1348
- </Show4></>;
1372
+ </Block_wrapper_default></Show5></Show5>
1373
+ </Show5></>;
1349
1374
  }
1350
1375
  var Block_default = Block;
1351
1376
 
1352
1377
  // src/components/blocks/blocks-wrapper.tsx
1353
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1378
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1354
1379
  import { Dynamic as Dynamic4 } from "solid-js/web";
1355
1380
  function BlocksWrapper(props) {
1356
1381
  const className = createMemo6(() => {
@@ -1385,11 +1410,11 @@ function BlocksWrapper(props) {
1385
1410
  }
1386
1411
  }
1387
1412
  let blocksWrapperRef;
1388
- onMount2(() => {
1413
+ onMount3(() => {
1389
1414
  });
1390
1415
  return <>
1391
1416
  <Dynamic4
1392
- class={className() + " dynamic-4da8c6f4"}
1417
+ class={className() + " dynamic-68b2d7fe"}
1393
1418
  ref={blocksWrapperRef}
1394
1419
  builder-path={props.path}
1395
1420
  builder-parent-id={props.parent}
@@ -1401,7 +1426,7 @@ function BlocksWrapper(props) {
1401
1426
  {...props.BlocksWrapperProps}
1402
1427
  component={props.BlocksWrapper}
1403
1428
  >{props.children}</Dynamic4>
1404
- <style>{`.dynamic-4da8c6f4 {
1429
+ <style>{`.dynamic-68b2d7fe {
1405
1430
  display: flex;
1406
1431
  flex-direction: column;
1407
1432
  align-items: stretch;
@@ -1421,7 +1446,7 @@ function Blocks(props) {
1421
1446
  styleProp={props.styleProp}
1422
1447
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1423
1448
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1424
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1449
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1425
1450
  const index = _index();
1426
1451
  return <Block_default
1427
1452
  key={block.id}
@@ -1430,7 +1455,7 @@ function Blocks(props) {
1430
1455
  context={props.context || builderContext}
1431
1456
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1432
1457
  />;
1433
- }}</For3></Show5></Blocks_wrapper_default></>;
1458
+ }}</For3></Show6></Blocks_wrapper_default></>;
1434
1459
  }
1435
1460
  var Blocks_default = Blocks;
1436
1461
 
@@ -1561,15 +1586,15 @@ function Columns(props) {
1561
1586
  }
1562
1587
  return <>
1563
1588
  <div
1564
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1589
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1565
1590
  style={columnsCssVars()}
1566
1591
  {...{}}
1567
1592
  >
1568
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1593
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1569
1594
  id="builderio-columns"
1570
1595
  styles={columnsStyles()}
1571
1596
  nonce={props.builderContext.nonce}
1572
- /></Show6>
1597
+ /></Show7>
1573
1598
  <For4 each={props.columns}>{(column, _index) => {
1574
1599
  const index = _index();
1575
1600
  return <Dynamic_renderer_default
@@ -1590,7 +1615,7 @@ function Columns(props) {
1590
1615
  /></Dynamic_renderer_default>;
1591
1616
  }}</For4>
1592
1617
  </div>
1593
- <style>{`.div-3ff242de {
1618
+ <style>{`.div-46766f1c {
1594
1619
  display: flex;
1595
1620
  line-height: normal;
1596
1621
  }`}</style>
@@ -1605,7 +1630,7 @@ function FragmentComponent(props) {
1605
1630
  var fragment_default = FragmentComponent;
1606
1631
 
1607
1632
  // src/blocks/image/image.tsx
1608
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
1633
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1609
1634
 
1610
1635
  // src/blocks/image/image.helpers.ts
1611
1636
  function removeProtocol(path) {
@@ -1695,14 +1720,14 @@ function Image(props) {
1695
1720
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1696
1721
  return out;
1697
1722
  });
1698
- onMount3(() => {
1723
+ onMount4(() => {
1699
1724
  });
1700
1725
  return <>
1701
1726
  <>
1702
1727
  <picture>
1703
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1728
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1704
1729
  <img
1705
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1730
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1706
1731
  loading={props.highPriority ? "eager" : "lazy"}
1707
1732
  fetchpriority={props.highPriority ? "high" : "auto"}
1708
1733
  alt={props.altText}
@@ -1717,25 +1742,25 @@ function Image(props) {
1717
1742
  sizes={props.sizes}
1718
1743
  />
1719
1744
  </picture>
1720
- <Show7
1745
+ <Show8
1721
1746
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1722
1747
  ><div
1723
- class="builder-image-sizer div-4512e110"
1748
+ class="builder-image-sizer div-7e6ffddc"
1724
1749
  style={{
1725
1750
  "padding-top": props.aspectRatio * 100 + "%"
1726
1751
  }}
1727
- /></Show7>
1728
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1729
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1752
+ /></Show8>
1753
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
1754
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
1730
1755
  </>
1731
- <style>{`.img-4512e110 {
1756
+ <style>{`.img-7e6ffddc {
1732
1757
  opacity: 1;
1733
1758
  transition: opacity 0.2s ease-in-out;
1734
- }.div-4512e110 {
1759
+ }.div-7e6ffddc {
1735
1760
  width: 100%;
1736
1761
  pointer-events: none;
1737
1762
  font-size: 0;
1738
- }.div-4512e110-2 {
1763
+ }.div-7e6ffddc-2 {
1739
1764
  display: flex;
1740
1765
  flex-direction: column;
1741
1766
  align-items: stretch;
@@ -1771,10 +1796,10 @@ function SectionComponent(props) {
1771
1796
  var section_default = SectionComponent;
1772
1797
 
1773
1798
  // src/blocks/symbol/symbol.tsx
1774
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1799
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1775
1800
 
1776
1801
  // src/components/content-variants/content-variants.tsx
1777
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1802
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1778
1803
 
1779
1804
  // src/helpers/url.ts
1780
1805
  var getTopLevelDomain = (host) => {
@@ -1968,7 +1993,7 @@ var handleABTesting = async ({
1968
1993
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1969
1994
 
1970
1995
  // src/components/content/content.tsx
1971
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
1996
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
1972
1997
 
1973
1998
  // src/blocks/accordion/component-info.ts
1974
1999
  var defaultTitle = {
@@ -2102,7 +2127,7 @@ var componentInfo = {
2102
2127
  };
2103
2128
 
2104
2129
  // src/blocks/accordion/accordion.tsx
2105
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2130
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2106
2131
 
2107
2132
  // src/blocks/accordion/helpers.ts
2108
2133
  var convertOrderNumberToString = (order) => {
@@ -2236,7 +2261,7 @@ function Accordion(props) {
2236
2261
  registeredComponents={props.builderComponents}
2237
2262
  linkComponent={props.builderLinkComponent}
2238
2263
  /></div>
2239
- <Show8 when={open().includes(index)}><div
2264
+ <Show9 when={open().includes(index)}><div
2240
2265
  class={getAccordionDetailClassName(index)}
2241
2266
  style={accordionDetailStyles()}
2242
2267
  ><Blocks_default
@@ -2246,7 +2271,7 @@ function Accordion(props) {
2246
2271
  context={props.builderContext}
2247
2272
  registeredComponents={props.builderComponents}
2248
2273
  linkComponent={props.builderLinkComponent}
2249
- /></div></Show8>
2274
+ /></div></Show9>
2250
2275
  </>;
2251
2276
  }}</For5></div></>;
2252
2277
  }
@@ -2927,7 +2952,7 @@ var componentInfo9 = {
2927
2952
  };
2928
2953
 
2929
2954
  // src/blocks/tabs/tabs.tsx
2930
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
2955
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
2931
2956
  function Tabs(props) {
2932
2957
  const [activeTab, setActiveTab] = createSignal10(
2933
2958
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -2969,14 +2994,14 @@ function Tabs(props) {
2969
2994
  linkComponent={props.builderLinkComponent}
2970
2995
  /></span>;
2971
2996
  }}</For6></div>
2972
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2997
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
2973
2998
  parent={props.builderBlock.id}
2974
2999
  path={`component.options.tabs.${activeTab()}.content`}
2975
3000
  blocks={activeTabContent(activeTab())}
2976
3001
  context={props.builderContext}
2977
3002
  registeredComponents={props.builderComponents}
2978
3003
  linkComponent={props.builderLinkComponent}
2979
- /></div></Show9>
3004
+ /></div></Show10>
2980
3005
  </div></>;
2981
3006
  }
2982
3007
  var tabs_default = Tabs;
@@ -3065,12 +3090,12 @@ var componentInfo11 = {
3065
3090
  };
3066
3091
 
3067
3092
  // src/blocks/custom-code/custom-code.tsx
3068
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3093
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3069
3094
  function CustomCode(props) {
3070
3095
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3071
3096
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3072
3097
  let elementRef;
3073
- onMount4(() => {
3098
+ onMount5(() => {
3074
3099
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3075
3100
  return;
3076
3101
  }
@@ -3420,7 +3445,7 @@ var componentInfo13 = {
3420
3445
  };
3421
3446
 
3422
3447
  // src/blocks/form/form/form.tsx
3423
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3448
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
3424
3449
 
3425
3450
  // src/functions/get-env.ts
3426
3451
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3635,7 +3660,7 @@ function FormComponent(props) {
3635
3660
  {...{}}
3636
3661
  {...props.attributes}
3637
3662
  >
3638
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3663
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3639
3664
  const idx = _index();
3640
3665
  return <Block_default
3641
3666
  key={`form-block-${idx}`}
@@ -3644,23 +3669,23 @@ function FormComponent(props) {
3644
3669
  registeredComponents={props.builderComponents}
3645
3670
  linkComponent={props.builderLinkComponent}
3646
3671
  />;
3647
- }}</For7></Show10>
3648
- <Show10 when={submissionState() === "error"}><Blocks_default
3672
+ }}</For7></Show11>
3673
+ <Show11 when={submissionState() === "error"}><Blocks_default
3649
3674
  path="errorMessage"
3650
3675
  blocks={props.errorMessage}
3651
3676
  context={props.builderContext}
3652
- /></Show10>
3653
- <Show10 when={submissionState() === "sending"}><Blocks_default
3677
+ /></Show11>
3678
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3654
3679
  path="sendingMessage"
3655
3680
  blocks={props.sendingMessage}
3656
3681
  context={props.builderContext}
3657
- /></Show10>
3658
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3659
- <Show10 when={submissionState() === "success"}><Blocks_default
3682
+ /></Show11>
3683
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3684
+ <Show11 when={submissionState() === "success"}><Blocks_default
3660
3685
  path="successMessage"
3661
3686
  blocks={props.successMessage}
3662
3687
  context={props.builderContext}
3663
- /></Show10>
3688
+ /></Show11>
3664
3689
  </form>
3665
3690
  <style>{`.pre-2e825338 {
3666
3691
  padding: 10px;
@@ -4012,7 +4037,7 @@ var componentInfo19 = {
4012
4037
  };
4013
4038
 
4014
4039
  // src/blocks/video/video.tsx
4015
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4040
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4016
4041
  function Video(props) {
4017
4042
  const videoProps = createMemo15(() => {
4018
4043
  return {
@@ -4063,8 +4088,8 @@ function Video(props) {
4063
4088
  }}
4064
4089
  src={props.video || "no-src"}
4065
4090
  poster={props.posterImage}
4066
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4067
- <Show11
4091
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4092
+ <Show12
4068
4093
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4069
4094
  ><div
4070
4095
  style={{
@@ -4073,15 +4098,15 @@ function Video(props) {
4073
4098
  "pointer-events": "none",
4074
4099
  "font-size": "0px"
4075
4100
  }}
4076
- /></Show11>
4077
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4101
+ /></Show12>
4102
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4078
4103
  style={{
4079
4104
  display: "flex",
4080
4105
  "flex-direction": "column",
4081
4106
  "align-items": "stretch"
4082
4107
  }}
4083
- >{props.children}</div></Show11>
4084
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4108
+ >{props.children}</div></Show12>
4109
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4085
4110
  style={{
4086
4111
  "pointer-events": "none",
4087
4112
  display: "flex",
@@ -4093,7 +4118,7 @@ function Video(props) {
4093
4118
  width: "100%",
4094
4119
  height: "100%"
4095
4120
  }}
4096
- >{props.children}</div></Show11>
4121
+ >{props.children}</div></Show12>
4097
4122
  </div></>;
4098
4123
  }
4099
4124
  var video_default = Video;
@@ -4238,8 +4263,8 @@ var Inlined_script_default = InlinedScript;
4238
4263
 
4239
4264
  // src/components/content/components/enable-editor.tsx
4240
4265
  import {
4241
- Show as Show12,
4242
- onMount as onMount5,
4266
+ Show as Show13,
4267
+ onMount as onMount6,
4243
4268
  on as on3,
4244
4269
  createEffect as createEffect3,
4245
4270
  createMemo as createMemo16,
@@ -4746,7 +4771,7 @@ function isFromTrustedHost(trustedHosts, e) {
4746
4771
  }
4747
4772
 
4748
4773
  // src/constants/sdk-version.ts
4749
- var SDK_VERSION = "2.0.15";
4774
+ var SDK_VERSION = "2.0.21";
4750
4775
 
4751
4776
  // src/functions/register.ts
4752
4777
  var registry = {};
@@ -5099,22 +5124,6 @@ function EnableEditor(props) {
5099
5124
  }
5100
5125
  })(event);
5101
5126
  }
5102
- function evaluateJsCode() {
5103
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5104
- if (jsCode) {
5105
- evaluate({
5106
- code: jsCode,
5107
- context: props.context || {},
5108
- localState: void 0,
5109
- rootState: props.builderContextSignal.rootState,
5110
- rootSetState: props.builderContextSignal.rootSetState,
5111
- /**
5112
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5113
- */
5114
- enableCache: false
5115
- });
5116
- }
5117
- }
5118
5127
  function onClick(event) {
5119
5128
  if (props.builderContextSignal.content) {
5120
5129
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5156,7 +5165,7 @@ function EnableEditor(props) {
5156
5165
  })
5157
5166
  )
5158
5167
  );
5159
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5168
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5160
5169
  mergeNewRootState({
5161
5170
  [key]: json
5162
5171
  });
@@ -5186,7 +5195,9 @@ function EnableEditor(props) {
5186
5195
  }
5187
5196
  }
5188
5197
  let elementRef;
5189
- onMount5(() => {
5198
+ runHttpRequests();
5199
+ emitStateUpdate();
5200
+ onMount6(() => {
5190
5201
  if (isBrowser()) {
5191
5202
  if (isEditing()) {
5192
5203
  window.addEventListener("message", processMessage);
@@ -5247,16 +5258,6 @@ function EnableEditor(props) {
5247
5258
  }
5248
5259
  }
5249
5260
  });
5250
- onMount5(() => {
5251
- if (!props.apiKey) {
5252
- logger.error(
5253
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5254
- );
5255
- }
5256
- evaluateJsCode();
5257
- runHttpRequests();
5258
- emitStateUpdate();
5259
- });
5260
5261
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5261
5262
  function onUpdateFn_0() {
5262
5263
  if (props.content) {
@@ -5264,57 +5265,35 @@ function EnableEditor(props) {
5264
5265
  }
5265
5266
  }
5266
5267
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5267
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5268
- function onUpdateFn_1() {
5269
- evaluateJsCode();
5270
- }
5271
- createEffect3(
5272
- on3(
5273
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5274
- onUpdateFn_1
5275
- )
5276
- );
5277
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5278
- function onUpdateFn_2() {
5279
- runHttpRequests();
5280
- }
5281
- createEffect3(
5282
- on3(
5283
- () => [
5284
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5285
- ],
5286
- onUpdateFn_2
5287
- )
5288
- );
5289
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5268
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5290
5269
  () => props.builderContextSignal.rootState
5291
5270
  );
5292
- function onUpdateFn_3() {
5271
+ function onUpdateFn_1() {
5293
5272
  emitStateUpdate();
5294
5273
  }
5295
5274
  createEffect3(
5296
5275
  on3(
5297
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5298
- onUpdateFn_3
5276
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5277
+ onUpdateFn_1
5299
5278
  )
5300
5279
  );
5301
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5302
- function onUpdateFn_4() {
5280
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5281
+ function onUpdateFn_2() {
5303
5282
  if (props.data) {
5304
5283
  mergeNewRootState(props.data);
5305
5284
  }
5306
5285
  }
5307
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5308
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5309
- function onUpdateFn_5() {
5286
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5287
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5288
+ function onUpdateFn_3() {
5310
5289
  if (props.locale) {
5311
5290
  mergeNewRootState({
5312
5291
  locale: props.locale
5313
5292
  });
5314
5293
  }
5315
5294
  }
5316
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5317
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
5295
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5296
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
5318
5297
  class={getWrapperClassName(
5319
5298
  props.content?.testVariationId || props.content?.id
5320
5299
  )}
@@ -5327,7 +5306,7 @@ function EnableEditor(props) {
5327
5306
  {...showContentProps()}
5328
5307
  {...props.contentWrapperProps}
5329
5308
  component={ContentWrapper()}
5330
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5309
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5331
5310
  }
5332
5311
  var Enable_editor_default = EnableEditor;
5333
5312
 
@@ -5464,6 +5443,31 @@ function ContentComponent(props) {
5464
5443
  rootState: newRootState
5465
5444
  }));
5466
5445
  }
5446
+ if (!props.apiKey) {
5447
+ logger.error(
5448
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5449
+ );
5450
+ }
5451
+ const jsCode = builderContextSignal().content?.data?.jsCode;
5452
+ if (jsCode) {
5453
+ evaluate({
5454
+ code: jsCode,
5455
+ context: props.context || {},
5456
+ localState: void 0,
5457
+ rootState: builderContextSignal().rootState,
5458
+ rootSetState: (newState) => {
5459
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
5460
+ ...PREVIOUS_VALUE,
5461
+ rootState: newState
5462
+ }));
5463
+ },
5464
+ isExpression: false,
5465
+ /**
5466
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5467
+ */
5468
+ enableCache: false
5469
+ });
5470
+ }
5467
5471
  return <><components_context_default.Provider
5468
5472
  value={{
5469
5473
  registeredComponents: registeredComponents()
@@ -5487,18 +5491,18 @@ function ContentComponent(props) {
5487
5491
  setBuilderContextSignal
5488
5492
  }}
5489
5493
  >
5490
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5494
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5491
5495
  id="builderio-variant-visibility"
5492
5496
  scriptStr={scriptStr()}
5493
5497
  nonce={props.nonce || ""}
5494
- /></Show13>
5495
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5498
+ /></Show14>
5499
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5496
5500
  nonce={props.nonce || ""}
5497
5501
  isNestedRender={props.isNestedRender}
5498
5502
  contentId={builderContextSignal().content?.id}
5499
5503
  cssCode={builderContextSignal().content?.data?.cssCode}
5500
5504
  customFonts={builderContextSignal().content?.data?.customFonts}
5501
- /></Show13>
5505
+ /></Show14>
5502
5506
  <Blocks_default
5503
5507
  blocks={builderContextSignal().content?.data?.blocks}
5504
5508
  context={builderContextSignal()}
@@ -5538,16 +5542,16 @@ function ContentVariants(props) {
5538
5542
  canTrack: getDefaultCanTrack(props.canTrack)
5539
5543
  });
5540
5544
  });
5541
- onMount6(() => {
5545
+ onMount7(() => {
5542
5546
  setShouldRenderVariants(false);
5543
5547
  });
5544
5548
  return <><>
5545
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5549
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5546
5550
  id="builderio-init-variants-fns"
5547
5551
  scriptStr={getInitVariantsFnsScriptString()}
5548
5552
  nonce={props.nonce || ""}
5549
- /></Show14>
5550
- <Show14 when={shouldRenderVariants()}>
5553
+ /></Show15>
5554
+ <Show15 when={shouldRenderVariants()}>
5551
5555
  <Inlined_styles_default
5552
5556
  id="builderio-variants"
5553
5557
  styles={hideVariantsStyleString()}
@@ -5585,7 +5589,7 @@ function ContentVariants(props) {
5585
5589
  {...{}}
5586
5590
  />;
5587
5591
  }}</For9>
5588
- </Show14>
5592
+ </Show15>
5589
5593
  <Content_default
5590
5594
  nonce={props.nonce}
5591
5595
  isNestedRender={props.isNestedRender}
@@ -5666,7 +5670,7 @@ function Symbol(props) {
5666
5670
  }
5667
5671
  });
5668
5672
  }
5669
- onMount7(() => {
5673
+ onMount8(() => {
5670
5674
  });
5671
5675
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5672
5676
  function onUpdateFn_0() {