@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";
@@ -248,29 +248,6 @@ var parseCode = (code, {
248
248
  const useCode = useReturn ? `return (${code});` : code;
249
249
  return useCode;
250
250
  };
251
-
252
- // src/functions/evaluate/browser-runtime/browser.ts
253
- var runInBrowser = ({
254
- code,
255
- builder,
256
- context,
257
- event,
258
- localState,
259
- rootSetState,
260
- rootState
261
- }) => {
262
- const functionArgs = getFunctionArguments({
263
- builder,
264
- context,
265
- event,
266
- state: flattenState({
267
- rootState,
268
- localState,
269
- rootSetState
270
- })
271
- });
272
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
273
- };
274
251
  function flattenState({
275
252
  rootState,
276
253
  localState,
@@ -305,6 +282,29 @@ function flattenState({
305
282
  });
306
283
  }
307
284
 
285
+ // src/functions/evaluate/browser-runtime/browser.ts
286
+ var runInBrowser = ({
287
+ code,
288
+ builder,
289
+ context,
290
+ event,
291
+ localState,
292
+ rootSetState,
293
+ rootState
294
+ }) => {
295
+ const functionArgs = getFunctionArguments({
296
+ builder,
297
+ context,
298
+ event,
299
+ state: flattenState({
300
+ rootState,
301
+ localState,
302
+ rootSetState
303
+ })
304
+ });
305
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
306
+ };
307
+
308
308
  // src/helpers/nullable.ts
309
309
  var checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
310
310
 
@@ -314,24 +314,30 @@ function isNodeRuntime() {
314
314
  }
315
315
 
316
316
  // src/functions/evaluate/should-force-browser-runtime-in-node.ts
317
- var shouldForceBrowserRuntimeInNode = () => {
317
+ var shouldForceBrowserRuntimeInNode = ({
318
+ shouldLogWarning
319
+ }) => {
318
320
  if (!isNodeRuntime())
319
321
  return false;
320
322
  const isArm64 = process.arch === "arm64";
321
323
  const isNode20 = process.version.startsWith("v20");
322
324
  const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes("--no-node-snapshot");
323
325
  if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
324
- logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
326
+ if (shouldLogWarning) {
327
+ logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
325
328
  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.
326
329
  See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
327
330
  `);
331
+ }
328
332
  return true;
329
333
  }
330
334
  return false;
331
335
  };
332
336
 
333
337
  // src/functions/evaluate/choose-eval.ts
334
- var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
338
+ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
339
+ shouldLogWarning: true
340
+ }) ? runInBrowser(args) : runInBrowser(args);
335
341
 
336
342
  // src/functions/evaluate/evaluate.ts
337
343
  var DISABLE_CACHE = true;
@@ -1080,12 +1086,23 @@ function BlockWrapper(props) {
1080
1086
  var Block_wrapper_default = BlockWrapper;
1081
1087
 
1082
1088
  // src/components/block/components/component-ref/component-ref.tsx
1083
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1089
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1084
1090
  import { Dynamic as Dynamic3 } from "solid-js/web";
1085
1091
 
1086
1092
  // src/components/block/components/interactive-element.tsx
1087
- import { createMemo as createMemo2 } from "solid-js";
1093
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1088
1094
  import { Dynamic as Dynamic2 } from "solid-js/web";
1095
+
1096
+ // src/components/awaiter.tsx
1097
+ import { onMount } from "solid-js";
1098
+ function Awaiter(props) {
1099
+ onMount(() => {
1100
+ });
1101
+ return <><>{props.children}</></>;
1102
+ }
1103
+ var Awaiter_default = Awaiter;
1104
+
1105
+ // src/components/block/components/interactive-element.tsx
1089
1106
  function InteractiveElement(props) {
1090
1107
  const attributes = createMemo2(() => {
1091
1108
  return props.includeBlockProps ? {
@@ -1102,11 +1119,19 @@ function InteractiveElement(props) {
1102
1119
  })
1103
1120
  } : {};
1104
1121
  });
1105
- return <><Dynamic2
1106
- {...props.wrapperProps}
1122
+ return <><Show3
1123
+ fallback={<Dynamic2
1124
+ {...props.wrapperProps}
1125
+ attributes={attributes()}
1126
+ component={props.Wrapper}
1127
+ >{props.children}</Dynamic2>}
1128
+ when={props.Wrapper.load}
1129
+ ><Awaiter_default
1130
+ load={props.Wrapper.load}
1131
+ fallback={props.Wrapper.fallback}
1132
+ props={props.wrapperProps}
1107
1133
  attributes={attributes()}
1108
- component={props.Wrapper}
1109
- >{props.children}</Dynamic2></>;
1134
+ >{props.children}</Awaiter_default></Show3></>;
1110
1135
  }
1111
1136
  var interactive_element_default = InteractiveElement;
1112
1137
 
@@ -1148,7 +1173,7 @@ function ComponentRef(props) {
1148
1173
  const [Wrapper, setWrapper] = createSignal3(
1149
1174
  props.isInteractive ? interactive_element_default : props.componentRef
1150
1175
  );
1151
- return <><Show3 when={props.componentRef}><Dynamic3
1176
+ return <><Show4 when={props.componentRef}><Dynamic3
1152
1177
  {...getWrapperProps({
1153
1178
  componentOptions: props.componentOptions,
1154
1179
  builderBlock: props.builderBlock,
@@ -1169,7 +1194,7 @@ function ComponentRef(props) {
1169
1194
  registeredComponents={props.registeredComponents}
1170
1195
  linkComponent={props.linkComponent}
1171
1196
  />;
1172
- }}</For></Dynamic3></Show3></>;
1197
+ }}</For></Dynamic3></Show4></>;
1173
1198
  }
1174
1199
  var Component_ref_default = ComponentRef;
1175
1200
 
@@ -1258,7 +1283,7 @@ function Block(props) {
1258
1283
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1259
1284
  };
1260
1285
  });
1261
- onMount(() => {
1286
+ onMount2(() => {
1262
1287
  const blockId = processedBlock().id;
1263
1288
  const animations = processedBlock().animations;
1264
1289
  if (animations && blockId) {
@@ -1270,13 +1295,13 @@ function Block(props) {
1270
1295
  );
1271
1296
  }
1272
1297
  });
1273
- return <><Show4 when={canShowBlock()}>
1298
+ return <><Show5 when={canShowBlock()}>
1274
1299
  <Block_styles_default
1275
1300
  block={processedBlock()}
1276
1301
  context={props.context}
1277
1302
  />
1278
- <Show4
1279
- fallback={<Show4
1303
+ <Show5
1304
+ fallback={<Show5
1280
1305
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1281
1306
  const index = _index();
1282
1307
  return <Repeated_block_default
@@ -1298,9 +1323,9 @@ function Block(props) {
1298
1323
  builderBlock={componentRefProps().builderBlock}
1299
1324
  includeBlockProps={componentRefProps().includeBlockProps}
1300
1325
  isInteractive={componentRefProps().isInteractive}
1301
- /></Show4>}
1326
+ /></Show5>}
1302
1327
  when={!blockComponent()?.noWrap}
1303
- ><Show4
1328
+ ><Show5
1304
1329
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1305
1330
  const index = _index();
1306
1331
  return <Repeated_block_default
@@ -1338,13 +1363,13 @@ function Block(props) {
1338
1363
  context={props.context}
1339
1364
  />;
1340
1365
  }}</For2>
1341
- </Block_wrapper_default></Show4></Show4>
1342
- </Show4></>;
1366
+ </Block_wrapper_default></Show5></Show5>
1367
+ </Show5></>;
1343
1368
  }
1344
1369
  var Block_default = Block;
1345
1370
 
1346
1371
  // src/components/blocks/blocks-wrapper.tsx
1347
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1372
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1348
1373
  import { Dynamic as Dynamic4 } from "solid-js/web";
1349
1374
  function BlocksWrapper(props) {
1350
1375
  const className = createMemo6(() => {
@@ -1379,11 +1404,11 @@ function BlocksWrapper(props) {
1379
1404
  }
1380
1405
  }
1381
1406
  let blocksWrapperRef;
1382
- onMount2(() => {
1407
+ onMount3(() => {
1383
1408
  });
1384
1409
  return <>
1385
1410
  <Dynamic4
1386
- class={className() + " dynamic-4da8c6f4"}
1411
+ class={className() + " dynamic-68b2d7fe"}
1387
1412
  ref={blocksWrapperRef}
1388
1413
  builder-path={props.path}
1389
1414
  builder-parent-id={props.parent}
@@ -1395,7 +1420,7 @@ function BlocksWrapper(props) {
1395
1420
  {...props.BlocksWrapperProps}
1396
1421
  component={props.BlocksWrapper}
1397
1422
  >{props.children}</Dynamic4>
1398
- <style>{`.dynamic-4da8c6f4 {
1423
+ <style>{`.dynamic-68b2d7fe {
1399
1424
  display: flex;
1400
1425
  flex-direction: column;
1401
1426
  align-items: stretch;
@@ -1415,7 +1440,7 @@ function Blocks(props) {
1415
1440
  styleProp={props.styleProp}
1416
1441
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1417
1442
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1418
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1443
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1419
1444
  const index = _index();
1420
1445
  return <Block_default
1421
1446
  key={block.id}
@@ -1424,7 +1449,7 @@ function Blocks(props) {
1424
1449
  context={props.context || builderContext}
1425
1450
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1426
1451
  />;
1427
- }}</For3></Show5></Blocks_wrapper_default></>;
1452
+ }}</For3></Show6></Blocks_wrapper_default></>;
1428
1453
  }
1429
1454
  var Blocks_default = Blocks;
1430
1455
 
@@ -1555,15 +1580,15 @@ function Columns(props) {
1555
1580
  }
1556
1581
  return <>
1557
1582
  <div
1558
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1583
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1559
1584
  style={columnsCssVars()}
1560
1585
  {...{}}
1561
1586
  >
1562
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1587
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1563
1588
  id="builderio-columns"
1564
1589
  styles={columnsStyles()}
1565
1590
  nonce={props.builderContext.nonce}
1566
- /></Show6>
1591
+ /></Show7>
1567
1592
  <For4 each={props.columns}>{(column, _index) => {
1568
1593
  const index = _index();
1569
1594
  return <Dynamic_renderer_default
@@ -1584,7 +1609,7 @@ function Columns(props) {
1584
1609
  /></Dynamic_renderer_default>;
1585
1610
  }}</For4>
1586
1611
  </div>
1587
- <style>{`.div-3ff242de {
1612
+ <style>{`.div-46766f1c {
1588
1613
  display: flex;
1589
1614
  line-height: normal;
1590
1615
  }`}</style>
@@ -1599,7 +1624,7 @@ function FragmentComponent(props) {
1599
1624
  var fragment_default = FragmentComponent;
1600
1625
 
1601
1626
  // src/blocks/image/image.tsx
1602
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
1627
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1603
1628
 
1604
1629
  // src/blocks/image/image.helpers.ts
1605
1630
  function removeProtocol(path) {
@@ -1688,14 +1713,14 @@ function Image(props) {
1688
1713
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1689
1714
  return out;
1690
1715
  });
1691
- onMount3(() => {
1716
+ onMount4(() => {
1692
1717
  });
1693
1718
  return <>
1694
1719
  <>
1695
1720
  <picture>
1696
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1721
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1697
1722
  <img
1698
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1723
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1699
1724
  loading={props.highPriority ? "eager" : "lazy"}
1700
1725
  fetchpriority={props.highPriority ? "high" : "auto"}
1701
1726
  alt={props.altText}
@@ -1710,25 +1735,25 @@ function Image(props) {
1710
1735
  sizes={props.sizes}
1711
1736
  />
1712
1737
  </picture>
1713
- <Show7
1738
+ <Show8
1714
1739
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1715
1740
  ><div
1716
- class="builder-image-sizer div-4512e110"
1741
+ class="builder-image-sizer div-7e6ffddc"
1717
1742
  style={{
1718
1743
  "padding-top": props.aspectRatio * 100 + "%"
1719
1744
  }}
1720
- /></Show7>
1721
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1722
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1745
+ /></Show8>
1746
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
1747
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
1723
1748
  </>
1724
- <style>{`.img-4512e110 {
1749
+ <style>{`.img-7e6ffddc {
1725
1750
  opacity: 1;
1726
1751
  transition: opacity 0.2s ease-in-out;
1727
- }.div-4512e110 {
1752
+ }.div-7e6ffddc {
1728
1753
  width: 100%;
1729
1754
  pointer-events: none;
1730
1755
  font-size: 0;
1731
- }.div-4512e110-2 {
1756
+ }.div-7e6ffddc-2 {
1732
1757
  display: flex;
1733
1758
  flex-direction: column;
1734
1759
  align-items: stretch;
@@ -1764,10 +1789,10 @@ function SectionComponent(props) {
1764
1789
  var section_default = SectionComponent;
1765
1790
 
1766
1791
  // src/blocks/symbol/symbol.tsx
1767
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1792
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1768
1793
 
1769
1794
  // src/components/content-variants/content-variants.tsx
1770
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1795
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1771
1796
 
1772
1797
  // src/helpers/url.ts
1773
1798
  var getTopLevelDomain = (host) => {
@@ -1961,7 +1986,7 @@ var handleABTesting = async ({
1961
1986
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1962
1987
 
1963
1988
  // src/components/content/content.tsx
1964
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
1989
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
1965
1990
 
1966
1991
  // src/blocks/accordion/component-info.ts
1967
1992
  var defaultTitle = {
@@ -2095,7 +2120,7 @@ var componentInfo = {
2095
2120
  };
2096
2121
 
2097
2122
  // src/blocks/accordion/accordion.tsx
2098
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2123
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2099
2124
 
2100
2125
  // src/blocks/accordion/helpers.ts
2101
2126
  var convertOrderNumberToString = (order) => {
@@ -2229,7 +2254,7 @@ function Accordion(props) {
2229
2254
  registeredComponents={props.builderComponents}
2230
2255
  linkComponent={props.builderLinkComponent}
2231
2256
  /></div>
2232
- <Show8 when={open().includes(index)}><div
2257
+ <Show9 when={open().includes(index)}><div
2233
2258
  class={getAccordionDetailClassName(index)}
2234
2259
  style={accordionDetailStyles()}
2235
2260
  ><Blocks_default
@@ -2239,7 +2264,7 @@ function Accordion(props) {
2239
2264
  context={props.builderContext}
2240
2265
  registeredComponents={props.builderComponents}
2241
2266
  linkComponent={props.builderLinkComponent}
2242
- /></div></Show8>
2267
+ /></div></Show9>
2243
2268
  </>;
2244
2269
  }}</For5></div></>;
2245
2270
  }
@@ -2919,7 +2944,7 @@ var componentInfo9 = {
2919
2944
  };
2920
2945
 
2921
2946
  // src/blocks/tabs/tabs.tsx
2922
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
2947
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
2923
2948
  function Tabs(props) {
2924
2949
  const [activeTab, setActiveTab] = createSignal10(
2925
2950
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -2961,14 +2986,14 @@ function Tabs(props) {
2961
2986
  linkComponent={props.builderLinkComponent}
2962
2987
  /></span>;
2963
2988
  }}</For6></div>
2964
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2989
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
2965
2990
  parent={props.builderBlock.id}
2966
2991
  path={`component.options.tabs.${activeTab()}.content`}
2967
2992
  blocks={activeTabContent(activeTab())}
2968
2993
  context={props.builderContext}
2969
2994
  registeredComponents={props.builderComponents}
2970
2995
  linkComponent={props.builderLinkComponent}
2971
- /></div></Show9>
2996
+ /></div></Show10>
2972
2997
  </div></>;
2973
2998
  }
2974
2999
  var tabs_default = Tabs;
@@ -3057,12 +3082,12 @@ var componentInfo11 = {
3057
3082
  };
3058
3083
 
3059
3084
  // src/blocks/custom-code/custom-code.tsx
3060
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3085
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3061
3086
  function CustomCode(props) {
3062
3087
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3063
3088
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3064
3089
  let elementRef;
3065
- onMount4(() => {
3090
+ onMount5(() => {
3066
3091
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3067
3092
  return;
3068
3093
  }
@@ -3410,7 +3435,7 @@ var componentInfo13 = {
3410
3435
  };
3411
3436
 
3412
3437
  // src/blocks/form/form/form.tsx
3413
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3438
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
3414
3439
 
3415
3440
  // src/functions/get-env.ts
3416
3441
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3625,7 +3650,7 @@ function FormComponent(props) {
3625
3650
  {...{}}
3626
3651
  {...props.attributes}
3627
3652
  >
3628
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3653
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3629
3654
  const idx = _index();
3630
3655
  return <Block_default
3631
3656
  key={`form-block-${idx}`}
@@ -3634,23 +3659,23 @@ function FormComponent(props) {
3634
3659
  registeredComponents={props.builderComponents}
3635
3660
  linkComponent={props.builderLinkComponent}
3636
3661
  />;
3637
- }}</For7></Show10>
3638
- <Show10 when={submissionState() === "error"}><Blocks_default
3662
+ }}</For7></Show11>
3663
+ <Show11 when={submissionState() === "error"}><Blocks_default
3639
3664
  path="errorMessage"
3640
3665
  blocks={props.errorMessage}
3641
3666
  context={props.builderContext}
3642
- /></Show10>
3643
- <Show10 when={submissionState() === "sending"}><Blocks_default
3667
+ /></Show11>
3668
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3644
3669
  path="sendingMessage"
3645
3670
  blocks={props.sendingMessage}
3646
3671
  context={props.builderContext}
3647
- /></Show10>
3648
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3649
- <Show10 when={submissionState() === "success"}><Blocks_default
3672
+ /></Show11>
3673
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3674
+ <Show11 when={submissionState() === "success"}><Blocks_default
3650
3675
  path="successMessage"
3651
3676
  blocks={props.successMessage}
3652
3677
  context={props.builderContext}
3653
- /></Show10>
3678
+ /></Show11>
3654
3679
  </form>
3655
3680
  <style>{`.pre-2e825338 {
3656
3681
  padding: 10px;
@@ -4002,7 +4027,7 @@ var componentInfo19 = {
4002
4027
  };
4003
4028
 
4004
4029
  // src/blocks/video/video.tsx
4005
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4030
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4006
4031
  function Video(props) {
4007
4032
  const videoProps = createMemo15(() => {
4008
4033
  return {
@@ -4053,8 +4078,8 @@ function Video(props) {
4053
4078
  }}
4054
4079
  src={props.video || "no-src"}
4055
4080
  poster={props.posterImage}
4056
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4057
- <Show11
4081
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4082
+ <Show12
4058
4083
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4059
4084
  ><div
4060
4085
  style={{
@@ -4063,15 +4088,15 @@ function Video(props) {
4063
4088
  "pointer-events": "none",
4064
4089
  "font-size": "0px"
4065
4090
  }}
4066
- /></Show11>
4067
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4091
+ /></Show12>
4092
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4068
4093
  style={{
4069
4094
  display: "flex",
4070
4095
  "flex-direction": "column",
4071
4096
  "align-items": "stretch"
4072
4097
  }}
4073
- >{props.children}</div></Show11>
4074
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4098
+ >{props.children}</div></Show12>
4099
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4075
4100
  style={{
4076
4101
  "pointer-events": "none",
4077
4102
  display: "flex",
@@ -4083,7 +4108,7 @@ function Video(props) {
4083
4108
  width: "100%",
4084
4109
  height: "100%"
4085
4110
  }}
4086
- >{props.children}</div></Show11>
4111
+ >{props.children}</div></Show12>
4087
4112
  </div></>;
4088
4113
  }
4089
4114
  var video_default = Video;
@@ -4228,8 +4253,8 @@ var Inlined_script_default = InlinedScript;
4228
4253
 
4229
4254
  // src/components/content/components/enable-editor.tsx
4230
4255
  import {
4231
- Show as Show12,
4232
- onMount as onMount5,
4256
+ Show as Show13,
4257
+ onMount as onMount6,
4233
4258
  on as on3,
4234
4259
  createEffect as createEffect3,
4235
4260
  createMemo as createMemo16,
@@ -4731,7 +4756,7 @@ function isFromTrustedHost(trustedHosts, e) {
4731
4756
  }
4732
4757
 
4733
4758
  // src/constants/sdk-version.ts
4734
- var SDK_VERSION = "2.0.15";
4759
+ var SDK_VERSION = "2.0.21";
4735
4760
 
4736
4761
  // src/functions/register.ts
4737
4762
  var registry = {};
@@ -5083,22 +5108,6 @@ function EnableEditor(props) {
5083
5108
  }
5084
5109
  })(event);
5085
5110
  }
5086
- function evaluateJsCode() {
5087
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5088
- if (jsCode) {
5089
- evaluate({
5090
- code: jsCode,
5091
- context: props.context || {},
5092
- localState: void 0,
5093
- rootState: props.builderContextSignal.rootState,
5094
- rootSetState: props.builderContextSignal.rootSetState,
5095
- /**
5096
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5097
- */
5098
- enableCache: false
5099
- });
5100
- }
5101
- }
5102
5111
  function onClick(event) {
5103
5112
  if (props.builderContextSignal.content) {
5104
5113
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5140,7 +5149,7 @@ function EnableEditor(props) {
5140
5149
  })
5141
5150
  )
5142
5151
  );
5143
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5152
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5144
5153
  mergeNewRootState({
5145
5154
  [key]: json
5146
5155
  });
@@ -5169,7 +5178,9 @@ function EnableEditor(props) {
5169
5178
  }
5170
5179
  }
5171
5180
  let elementRef;
5172
- onMount5(() => {
5181
+ runHttpRequests();
5182
+ emitStateUpdate();
5183
+ onMount6(() => {
5173
5184
  if (isBrowser()) {
5174
5185
  if (isEditing()) {
5175
5186
  window.addEventListener("message", processMessage);
@@ -5230,16 +5241,6 @@ function EnableEditor(props) {
5230
5241
  }
5231
5242
  }
5232
5243
  });
5233
- onMount5(() => {
5234
- if (!props.apiKey) {
5235
- logger.error(
5236
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5237
- );
5238
- }
5239
- evaluateJsCode();
5240
- runHttpRequests();
5241
- emitStateUpdate();
5242
- });
5243
5244
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5244
5245
  function onUpdateFn_0() {
5245
5246
  if (props.content) {
@@ -5247,57 +5248,35 @@ function EnableEditor(props) {
5247
5248
  }
5248
5249
  }
5249
5250
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5250
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5251
- function onUpdateFn_1() {
5252
- evaluateJsCode();
5253
- }
5254
- createEffect3(
5255
- on3(
5256
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5257
- onUpdateFn_1
5258
- )
5259
- );
5260
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5261
- function onUpdateFn_2() {
5262
- runHttpRequests();
5263
- }
5264
- createEffect3(
5265
- on3(
5266
- () => [
5267
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5268
- ],
5269
- onUpdateFn_2
5270
- )
5271
- );
5272
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5251
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5273
5252
  () => props.builderContextSignal.rootState
5274
5253
  );
5275
- function onUpdateFn_3() {
5254
+ function onUpdateFn_1() {
5276
5255
  emitStateUpdate();
5277
5256
  }
5278
5257
  createEffect3(
5279
5258
  on3(
5280
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5281
- onUpdateFn_3
5259
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5260
+ onUpdateFn_1
5282
5261
  )
5283
5262
  );
5284
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5285
- function onUpdateFn_4() {
5263
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5264
+ function onUpdateFn_2() {
5286
5265
  if (props.data) {
5287
5266
  mergeNewRootState(props.data);
5288
5267
  }
5289
5268
  }
5290
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5291
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5292
- function onUpdateFn_5() {
5269
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5270
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5271
+ function onUpdateFn_3() {
5293
5272
  if (props.locale) {
5294
5273
  mergeNewRootState({
5295
5274
  locale: props.locale
5296
5275
  });
5297
5276
  }
5298
5277
  }
5299
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5300
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
5278
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5279
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
5301
5280
  class={getWrapperClassName(
5302
5281
  props.content?.testVariationId || props.content?.id
5303
5282
  )}
@@ -5310,7 +5289,7 @@ function EnableEditor(props) {
5310
5289
  {...showContentProps()}
5311
5290
  {...props.contentWrapperProps}
5312
5291
  component={ContentWrapper()}
5313
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5292
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5314
5293
  }
5315
5294
  var Enable_editor_default = EnableEditor;
5316
5295
 
@@ -5447,6 +5426,31 @@ function ContentComponent(props) {
5447
5426
  rootState: newRootState
5448
5427
  }));
5449
5428
  }
5429
+ if (!props.apiKey) {
5430
+ logger.error(
5431
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5432
+ );
5433
+ }
5434
+ const jsCode = builderContextSignal().content?.data?.jsCode;
5435
+ if (jsCode) {
5436
+ evaluate({
5437
+ code: jsCode,
5438
+ context: props.context || {},
5439
+ localState: void 0,
5440
+ rootState: builderContextSignal().rootState,
5441
+ rootSetState: (newState) => {
5442
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
5443
+ ...PREVIOUS_VALUE,
5444
+ rootState: newState
5445
+ }));
5446
+ },
5447
+ isExpression: false,
5448
+ /**
5449
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5450
+ */
5451
+ enableCache: false
5452
+ });
5453
+ }
5450
5454
  return <><components_context_default.Provider
5451
5455
  value={{
5452
5456
  registeredComponents: registeredComponents()
@@ -5470,18 +5474,18 @@ function ContentComponent(props) {
5470
5474
  setBuilderContextSignal
5471
5475
  }}
5472
5476
  >
5473
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5477
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5474
5478
  id="builderio-variant-visibility"
5475
5479
  scriptStr={scriptStr()}
5476
5480
  nonce={props.nonce || ""}
5477
- /></Show13>
5478
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5481
+ /></Show14>
5482
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5479
5483
  nonce={props.nonce || ""}
5480
5484
  isNestedRender={props.isNestedRender}
5481
5485
  contentId={builderContextSignal().content?.id}
5482
5486
  cssCode={builderContextSignal().content?.data?.cssCode}
5483
5487
  customFonts={builderContextSignal().content?.data?.customFonts}
5484
- /></Show13>
5488
+ /></Show14>
5485
5489
  <Blocks_default
5486
5490
  blocks={builderContextSignal().content?.data?.blocks}
5487
5491
  context={builderContextSignal()}
@@ -5521,16 +5525,16 @@ function ContentVariants(props) {
5521
5525
  canTrack: getDefaultCanTrack(props.canTrack)
5522
5526
  });
5523
5527
  });
5524
- onMount6(() => {
5528
+ onMount7(() => {
5525
5529
  setShouldRenderVariants(false);
5526
5530
  });
5527
5531
  return <><>
5528
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5532
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5529
5533
  id="builderio-init-variants-fns"
5530
5534
  scriptStr={getInitVariantsFnsScriptString()}
5531
5535
  nonce={props.nonce || ""}
5532
- /></Show14>
5533
- <Show14 when={shouldRenderVariants()}>
5536
+ /></Show15>
5537
+ <Show15 when={shouldRenderVariants()}>
5534
5538
  <Inlined_styles_default
5535
5539
  id="builderio-variants"
5536
5540
  styles={hideVariantsStyleString()}
@@ -5568,7 +5572,7 @@ function ContentVariants(props) {
5568
5572
  {...{}}
5569
5573
  />;
5570
5574
  }}</For9>
5571
- </Show14>
5575
+ </Show15>
5572
5576
  <Content_default
5573
5577
  nonce={props.nonce}
5574
5578
  isNestedRender={props.isNestedRender}
@@ -5649,7 +5653,7 @@ function Symbol(props) {
5649
5653
  }
5650
5654
  });
5651
5655
  }
5652
- onMount7(() => {
5656
+ onMount8(() => {
5653
5657
  });
5654
5658
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5655
5659
  function onUpdateFn_0() {