@builder.io/sdk-solid 2.0.16 → 2.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,10 +75,10 @@ function Button(props) {
75
75
  var button_default = Button;
76
76
 
77
77
  // src/blocks/columns/columns.tsx
78
- import { Show as Show6, For as For4, createSignal as createSignal7 } from "solid-js";
78
+ import { Show as Show7, For as For4, createSignal as createSignal7 } from "solid-js";
79
79
 
80
80
  // src/components/blocks/blocks.tsx
81
- import { useContext, Show as Show5, For as For3 } from "solid-js";
81
+ import { useContext, Show as Show6, For as For3 } from "solid-js";
82
82
 
83
83
  // src/context/builder.context.ts
84
84
  import { createContext } from "solid-js";
@@ -104,9 +104,9 @@ var components_context_default = createContext2({ registeredComponents: {} });
104
104
 
105
105
  // src/components/block/block.tsx
106
106
  import {
107
- Show as Show4,
107
+ Show as Show5,
108
108
  For as For2,
109
- onMount,
109
+ onMount as onMount2,
110
110
  createMemo as createMemo5,
111
111
  createSignal as createSignal5
112
112
  } from "solid-js";
@@ -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
 
@@ -1092,12 +1092,23 @@ function BlockWrapper(props) {
1092
1092
  var Block_wrapper_default = BlockWrapper;
1093
1093
 
1094
1094
  // src/components/block/components/component-ref/component-ref.tsx
1095
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
1095
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1096
1096
  import { Dynamic as Dynamic3 } from "solid-js/web";
1097
1097
 
1098
1098
  // src/components/block/components/interactive-element.tsx
1099
- import { createMemo as createMemo2 } from "solid-js";
1099
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
1100
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
1101
1112
  function InteractiveElement(props) {
1102
1113
  const attributes = createMemo2(() => {
1103
1114
  return props.includeBlockProps ? {
@@ -1114,11 +1125,19 @@ function InteractiveElement(props) {
1114
1125
  })
1115
1126
  } : {};
1116
1127
  });
1117
- return <><Dynamic2
1118
- {...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}
1119
1139
  attributes={attributes()}
1120
- component={props.Wrapper}
1121
- >{props.children}</Dynamic2></>;
1140
+ >{props.children}</Awaiter_default></Show3></>;
1122
1141
  }
1123
1142
  var interactive_element_default = InteractiveElement;
1124
1143
 
@@ -1160,7 +1179,7 @@ function ComponentRef(props) {
1160
1179
  const [Wrapper, setWrapper] = createSignal3(
1161
1180
  props.isInteractive ? interactive_element_default : props.componentRef
1162
1181
  );
1163
- return <><Show3 when={props.componentRef}><Dynamic3
1182
+ return <><Show4 when={props.componentRef}><Dynamic3
1164
1183
  {...getWrapperProps({
1165
1184
  componentOptions: props.componentOptions,
1166
1185
  builderBlock: props.builderBlock,
@@ -1181,7 +1200,7 @@ function ComponentRef(props) {
1181
1200
  registeredComponents={props.registeredComponents}
1182
1201
  linkComponent={props.linkComponent}
1183
1202
  />;
1184
- }}</For></Dynamic3></Show3></>;
1203
+ }}</For></Dynamic3></Show4></>;
1185
1204
  }
1186
1205
  var Component_ref_default = ComponentRef;
1187
1206
 
@@ -1270,7 +1289,7 @@ function Block(props) {
1270
1289
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
1271
1290
  };
1272
1291
  });
1273
- onMount(() => {
1292
+ onMount2(() => {
1274
1293
  const blockId = processedBlock().id;
1275
1294
  const animations = processedBlock().animations;
1276
1295
  if (animations && blockId) {
@@ -1282,13 +1301,13 @@ function Block(props) {
1282
1301
  );
1283
1302
  }
1284
1303
  });
1285
- return <><Show4 when={canShowBlock()}>
1304
+ return <><Show5 when={canShowBlock()}>
1286
1305
  <Block_styles_default
1287
1306
  block={processedBlock()}
1288
1307
  context={props.context}
1289
1308
  />
1290
- <Show4
1291
- fallback={<Show4
1309
+ <Show5
1310
+ fallback={<Show5
1292
1311
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1293
1312
  const index = _index();
1294
1313
  return <Repeated_block_default
@@ -1310,9 +1329,9 @@ function Block(props) {
1310
1329
  builderBlock={componentRefProps().builderBlock}
1311
1330
  includeBlockProps={componentRefProps().includeBlockProps}
1312
1331
  isInteractive={componentRefProps().isInteractive}
1313
- /></Show4>}
1332
+ /></Show5>}
1314
1333
  when={!blockComponent()?.noWrap}
1315
- ><Show4
1334
+ ><Show5
1316
1335
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
1317
1336
  const index = _index();
1318
1337
  return <Repeated_block_default
@@ -1350,13 +1369,13 @@ function Block(props) {
1350
1369
  context={props.context}
1351
1370
  />;
1352
1371
  }}</For2>
1353
- </Block_wrapper_default></Show4></Show4>
1354
- </Show4></>;
1372
+ </Block_wrapper_default></Show5></Show5>
1373
+ </Show5></>;
1355
1374
  }
1356
1375
  var Block_default = Block;
1357
1376
 
1358
1377
  // src/components/blocks/blocks-wrapper.tsx
1359
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
1378
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
1360
1379
  import { Dynamic as Dynamic4 } from "solid-js/web";
1361
1380
  function BlocksWrapper(props) {
1362
1381
  const className = createMemo6(() => {
@@ -1391,11 +1410,11 @@ function BlocksWrapper(props) {
1391
1410
  }
1392
1411
  }
1393
1412
  let blocksWrapperRef;
1394
- onMount2(() => {
1413
+ onMount3(() => {
1395
1414
  });
1396
1415
  return <>
1397
1416
  <Dynamic4
1398
- class={className() + " dynamic-4da8c6f4"}
1417
+ class={className() + " dynamic-68b2d7fe"}
1399
1418
  ref={blocksWrapperRef}
1400
1419
  builder-path={props.path}
1401
1420
  builder-parent-id={props.parent}
@@ -1407,7 +1426,7 @@ function BlocksWrapper(props) {
1407
1426
  {...props.BlocksWrapperProps}
1408
1427
  component={props.BlocksWrapper}
1409
1428
  >{props.children}</Dynamic4>
1410
- <style>{`.dynamic-4da8c6f4 {
1429
+ <style>{`.dynamic-68b2d7fe {
1411
1430
  display: flex;
1412
1431
  flex-direction: column;
1413
1432
  align-items: stretch;
@@ -1427,7 +1446,7 @@ function Blocks(props) {
1427
1446
  styleProp={props.styleProp}
1428
1447
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
1429
1448
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
1430
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1449
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1431
1450
  const index = _index();
1432
1451
  return <Block_default
1433
1452
  key={block.id}
@@ -1436,7 +1455,7 @@ function Blocks(props) {
1436
1455
  context={props.context || builderContext}
1437
1456
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1438
1457
  />;
1439
- }}</For3></Show5></Blocks_wrapper_default></>;
1458
+ }}</For3></Show6></Blocks_wrapper_default></>;
1440
1459
  }
1441
1460
  var Blocks_default = Blocks;
1442
1461
 
@@ -1567,15 +1586,15 @@ function Columns(props) {
1567
1586
  }
1568
1587
  return <>
1569
1588
  <div
1570
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
1589
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
1571
1590
  style={columnsCssVars()}
1572
1591
  {...{}}
1573
1592
  >
1574
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1593
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
1575
1594
  id="builderio-columns"
1576
1595
  styles={columnsStyles()}
1577
1596
  nonce={props.builderContext.nonce}
1578
- /></Show6>
1597
+ /></Show7>
1579
1598
  <For4 each={props.columns}>{(column, _index) => {
1580
1599
  const index = _index();
1581
1600
  return <Dynamic_renderer_default
@@ -1596,7 +1615,7 @@ function Columns(props) {
1596
1615
  /></Dynamic_renderer_default>;
1597
1616
  }}</For4>
1598
1617
  </div>
1599
- <style>{`.div-3ff242de {
1618
+ <style>{`.div-46766f1c {
1600
1619
  display: flex;
1601
1620
  line-height: normal;
1602
1621
  }`}</style>
@@ -1611,7 +1630,7 @@ function FragmentComponent(props) {
1611
1630
  var fragment_default = FragmentComponent;
1612
1631
 
1613
1632
  // src/blocks/image/image.tsx
1614
- 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";
1615
1634
 
1616
1635
  // src/blocks/image/image.helpers.ts
1617
1636
  function removeProtocol(path) {
@@ -1701,14 +1720,14 @@ function Image(props) {
1701
1720
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1702
1721
  return out;
1703
1722
  });
1704
- onMount3(() => {
1723
+ onMount4(() => {
1705
1724
  });
1706
1725
  return <>
1707
1726
  <>
1708
1727
  <picture>
1709
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1728
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1710
1729
  <img
1711
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1730
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
1712
1731
  loading={props.highPriority ? "eager" : "lazy"}
1713
1732
  fetchpriority={props.highPriority ? "high" : "auto"}
1714
1733
  alt={props.altText}
@@ -1723,25 +1742,25 @@ function Image(props) {
1723
1742
  sizes={props.sizes}
1724
1743
  />
1725
1744
  </picture>
1726
- <Show7
1745
+ <Show8
1727
1746
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1728
1747
  ><div
1729
- class="builder-image-sizer div-4512e110"
1748
+ class="builder-image-sizer div-7e6ffddc"
1730
1749
  style={{
1731
1750
  "padding-top": props.aspectRatio * 100 + "%"
1732
1751
  }}
1733
- /></Show7>
1734
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1735
- <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>
1736
1755
  </>
1737
- <style>{`.img-4512e110 {
1756
+ <style>{`.img-7e6ffddc {
1738
1757
  opacity: 1;
1739
1758
  transition: opacity 0.2s ease-in-out;
1740
- }.div-4512e110 {
1759
+ }.div-7e6ffddc {
1741
1760
  width: 100%;
1742
1761
  pointer-events: none;
1743
1762
  font-size: 0;
1744
- }.div-4512e110-2 {
1763
+ }.div-7e6ffddc-2 {
1745
1764
  display: flex;
1746
1765
  flex-direction: column;
1747
1766
  align-items: stretch;
@@ -1777,10 +1796,10 @@ function SectionComponent(props) {
1777
1796
  var section_default = SectionComponent;
1778
1797
 
1779
1798
  // src/blocks/symbol/symbol.tsx
1780
- 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";
1781
1800
 
1782
1801
  // src/components/content-variants/content-variants.tsx
1783
- 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";
1784
1803
 
1785
1804
  // src/helpers/url.ts
1786
1805
  var getTopLevelDomain = (host) => {
@@ -1974,7 +1993,7 @@ var handleABTesting = async ({
1974
1993
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1975
1994
 
1976
1995
  // src/components/content/content.tsx
1977
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
1996
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
1978
1997
 
1979
1998
  // src/blocks/accordion/component-info.ts
1980
1999
  var defaultTitle = {
@@ -2108,7 +2127,7 @@ var componentInfo = {
2108
2127
  };
2109
2128
 
2110
2129
  // src/blocks/accordion/accordion.tsx
2111
- 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";
2112
2131
 
2113
2132
  // src/blocks/accordion/helpers.ts
2114
2133
  var convertOrderNumberToString = (order) => {
@@ -2242,7 +2261,7 @@ function Accordion(props) {
2242
2261
  registeredComponents={props.builderComponents}
2243
2262
  linkComponent={props.builderLinkComponent}
2244
2263
  /></div>
2245
- <Show8 when={open().includes(index)}><div
2264
+ <Show9 when={open().includes(index)}><div
2246
2265
  class={getAccordionDetailClassName(index)}
2247
2266
  style={accordionDetailStyles()}
2248
2267
  ><Blocks_default
@@ -2252,7 +2271,7 @@ function Accordion(props) {
2252
2271
  context={props.builderContext}
2253
2272
  registeredComponents={props.builderComponents}
2254
2273
  linkComponent={props.builderLinkComponent}
2255
- /></div></Show8>
2274
+ /></div></Show9>
2256
2275
  </>;
2257
2276
  }}</For5></div></>;
2258
2277
  }
@@ -2933,7 +2952,7 @@ var componentInfo9 = {
2933
2952
  };
2934
2953
 
2935
2954
  // src/blocks/tabs/tabs.tsx
2936
- 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";
2937
2956
  function Tabs(props) {
2938
2957
  const [activeTab, setActiveTab] = createSignal10(
2939
2958
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -2975,14 +2994,14 @@ function Tabs(props) {
2975
2994
  linkComponent={props.builderLinkComponent}
2976
2995
  /></span>;
2977
2996
  }}</For6></div>
2978
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2997
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
2979
2998
  parent={props.builderBlock.id}
2980
2999
  path={`component.options.tabs.${activeTab()}.content`}
2981
3000
  blocks={activeTabContent(activeTab())}
2982
3001
  context={props.builderContext}
2983
3002
  registeredComponents={props.builderComponents}
2984
3003
  linkComponent={props.builderLinkComponent}
2985
- /></div></Show9>
3004
+ /></div></Show10>
2986
3005
  </div></>;
2987
3006
  }
2988
3007
  var tabs_default = Tabs;
@@ -3071,12 +3090,12 @@ var componentInfo11 = {
3071
3090
  };
3072
3091
 
3073
3092
  // src/blocks/custom-code/custom-code.tsx
3074
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
3093
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3075
3094
  function CustomCode(props) {
3076
3095
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3077
3096
  const [scriptsRun, setScriptsRun] = createSignal12([]);
3078
3097
  let elementRef;
3079
- onMount4(() => {
3098
+ onMount5(() => {
3080
3099
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3081
3100
  return;
3082
3101
  }
@@ -3426,7 +3445,7 @@ var componentInfo13 = {
3426
3445
  };
3427
3446
 
3428
3447
  // src/blocks/form/form/form.tsx
3429
- 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";
3430
3449
 
3431
3450
  // src/functions/get-env.ts
3432
3451
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3641,7 +3660,7 @@ function FormComponent(props) {
3641
3660
  {...{}}
3642
3661
  {...props.attributes}
3643
3662
  >
3644
- <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) => {
3645
3664
  const idx = _index();
3646
3665
  return <Block_default
3647
3666
  key={`form-block-${idx}`}
@@ -3650,23 +3669,23 @@ function FormComponent(props) {
3650
3669
  registeredComponents={props.builderComponents}
3651
3670
  linkComponent={props.builderLinkComponent}
3652
3671
  />;
3653
- }}</For7></Show10>
3654
- <Show10 when={submissionState() === "error"}><Blocks_default
3672
+ }}</For7></Show11>
3673
+ <Show11 when={submissionState() === "error"}><Blocks_default
3655
3674
  path="errorMessage"
3656
3675
  blocks={props.errorMessage}
3657
3676
  context={props.builderContext}
3658
- /></Show10>
3659
- <Show10 when={submissionState() === "sending"}><Blocks_default
3677
+ /></Show11>
3678
+ <Show11 when={submissionState() === "sending"}><Blocks_default
3660
3679
  path="sendingMessage"
3661
3680
  blocks={props.sendingMessage}
3662
3681
  context={props.builderContext}
3663
- /></Show10>
3664
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
3665
- <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
3666
3685
  path="successMessage"
3667
3686
  blocks={props.successMessage}
3668
3687
  context={props.builderContext}
3669
- /></Show10>
3688
+ /></Show11>
3670
3689
  </form>
3671
3690
  <style>{`.pre-2e825338 {
3672
3691
  padding: 10px;
@@ -4018,7 +4037,7 @@ var componentInfo19 = {
4018
4037
  };
4019
4038
 
4020
4039
  // src/blocks/video/video.tsx
4021
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4040
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
4022
4041
  function Video(props) {
4023
4042
  const videoProps = createMemo15(() => {
4024
4043
  return {
@@ -4069,8 +4088,8 @@ function Video(props) {
4069
4088
  }}
4070
4089
  src={props.video || "no-src"}
4071
4090
  poster={props.posterImage}
4072
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
4073
- <Show11
4091
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4092
+ <Show12
4074
4093
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4075
4094
  ><div
4076
4095
  style={{
@@ -4079,15 +4098,15 @@ function Video(props) {
4079
4098
  "pointer-events": "none",
4080
4099
  "font-size": "0px"
4081
4100
  }}
4082
- /></Show11>
4083
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
4101
+ /></Show12>
4102
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4084
4103
  style={{
4085
4104
  display: "flex",
4086
4105
  "flex-direction": "column",
4087
4106
  "align-items": "stretch"
4088
4107
  }}
4089
- >{props.children}</div></Show11>
4090
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
4108
+ >{props.children}</div></Show12>
4109
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4091
4110
  style={{
4092
4111
  "pointer-events": "none",
4093
4112
  display: "flex",
@@ -4099,7 +4118,7 @@ function Video(props) {
4099
4118
  width: "100%",
4100
4119
  height: "100%"
4101
4120
  }}
4102
- >{props.children}</div></Show11>
4121
+ >{props.children}</div></Show12>
4103
4122
  </div></>;
4104
4123
  }
4105
4124
  var video_default = Video;
@@ -4244,8 +4263,8 @@ var Inlined_script_default = InlinedScript;
4244
4263
 
4245
4264
  // src/components/content/components/enable-editor.tsx
4246
4265
  import {
4247
- Show as Show12,
4248
- onMount as onMount5,
4266
+ Show as Show13,
4267
+ onMount as onMount6,
4249
4268
  on as on3,
4250
4269
  createEffect as createEffect3,
4251
4270
  createMemo as createMemo16,
@@ -4752,7 +4771,7 @@ function isFromTrustedHost(trustedHosts, e) {
4752
4771
  }
4753
4772
 
4754
4773
  // src/constants/sdk-version.ts
4755
- var SDK_VERSION = "2.0.16";
4774
+ var SDK_VERSION = "2.0.21";
4756
4775
 
4757
4776
  // src/functions/register.ts
4758
4777
  var registry = {};
@@ -5105,22 +5124,6 @@ function EnableEditor(props) {
5105
5124
  }
5106
5125
  })(event);
5107
5126
  }
5108
- function evaluateJsCode() {
5109
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
5110
- if (jsCode) {
5111
- evaluate({
5112
- code: jsCode,
5113
- context: props.context || {},
5114
- localState: void 0,
5115
- rootState: props.builderContextSignal.rootState,
5116
- rootSetState: props.builderContextSignal.rootSetState,
5117
- /**
5118
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5119
- */
5120
- enableCache: false
5121
- });
5122
- }
5123
- }
5124
5127
  function onClick(event) {
5125
5128
  if (props.builderContextSignal.content) {
5126
5129
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -5162,7 +5165,7 @@ function EnableEditor(props) {
5162
5165
  })
5163
5166
  )
5164
5167
  );
5165
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
5168
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5166
5169
  mergeNewRootState({
5167
5170
  [key]: json
5168
5171
  });
@@ -5192,7 +5195,9 @@ function EnableEditor(props) {
5192
5195
  }
5193
5196
  }
5194
5197
  let elementRef;
5195
- onMount5(() => {
5198
+ runHttpRequests();
5199
+ emitStateUpdate();
5200
+ onMount6(() => {
5196
5201
  if (isBrowser()) {
5197
5202
  if (isEditing()) {
5198
5203
  window.addEventListener("message", processMessage);
@@ -5253,16 +5258,6 @@ function EnableEditor(props) {
5253
5258
  }
5254
5259
  }
5255
5260
  });
5256
- onMount5(() => {
5257
- if (!props.apiKey) {
5258
- logger.error(
5259
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
5260
- );
5261
- }
5262
- evaluateJsCode();
5263
- runHttpRequests();
5264
- emitStateUpdate();
5265
- });
5266
5261
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
5267
5262
  function onUpdateFn_0() {
5268
5263
  if (props.content) {
@@ -5270,57 +5265,35 @@ function EnableEditor(props) {
5270
5265
  }
5271
5266
  }
5272
5267
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5273
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5274
- function onUpdateFn_1() {
5275
- evaluateJsCode();
5276
- }
5277
- createEffect3(
5278
- on3(
5279
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
5280
- onUpdateFn_1
5281
- )
5282
- );
5283
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5284
- function onUpdateFn_2() {
5285
- runHttpRequests();
5286
- }
5287
- createEffect3(
5288
- on3(
5289
- () => [
5290
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
5291
- ],
5292
- onUpdateFn_2
5293
- )
5294
- );
5295
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5268
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5296
5269
  () => props.builderContextSignal.rootState
5297
5270
  );
5298
- function onUpdateFn_3() {
5271
+ function onUpdateFn_1() {
5299
5272
  emitStateUpdate();
5300
5273
  }
5301
5274
  createEffect3(
5302
5275
  on3(
5303
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
5304
- onUpdateFn_3
5276
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
5277
+ onUpdateFn_1
5305
5278
  )
5306
5279
  );
5307
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
5308
- function onUpdateFn_4() {
5280
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5281
+ function onUpdateFn_2() {
5309
5282
  if (props.data) {
5310
5283
  mergeNewRootState(props.data);
5311
5284
  }
5312
5285
  }
5313
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5314
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5315
- 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() {
5316
5289
  if (props.locale) {
5317
5290
  mergeNewRootState({
5318
5291
  locale: props.locale
5319
5292
  });
5320
5293
  }
5321
5294
  }
5322
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
5323
- 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
5324
5297
  class={getWrapperClassName(
5325
5298
  props.content?.testVariationId || props.content?.id
5326
5299
  )}
@@ -5333,7 +5306,7 @@ function EnableEditor(props) {
5333
5306
  {...showContentProps()}
5334
5307
  {...props.contentWrapperProps}
5335
5308
  component={ContentWrapper()}
5336
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
5309
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
5337
5310
  }
5338
5311
  var Enable_editor_default = EnableEditor;
5339
5312
 
@@ -5470,6 +5443,31 @@ function ContentComponent(props) {
5470
5443
  rootState: newRootState
5471
5444
  }));
5472
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
+ }
5473
5471
  return <><components_context_default.Provider
5474
5472
  value={{
5475
5473
  registeredComponents: registeredComponents()
@@ -5493,18 +5491,18 @@ function ContentComponent(props) {
5493
5491
  setBuilderContextSignal
5494
5492
  }}
5495
5493
  >
5496
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
5494
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
5497
5495
  id="builderio-variant-visibility"
5498
5496
  scriptStr={scriptStr()}
5499
5497
  nonce={props.nonce || ""}
5500
- /></Show13>
5501
- <Show13 when={TARGET !== "reactNative"}><Styles_default
5498
+ /></Show14>
5499
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
5502
5500
  nonce={props.nonce || ""}
5503
5501
  isNestedRender={props.isNestedRender}
5504
5502
  contentId={builderContextSignal().content?.id}
5505
5503
  cssCode={builderContextSignal().content?.data?.cssCode}
5506
5504
  customFonts={builderContextSignal().content?.data?.customFonts}
5507
- /></Show13>
5505
+ /></Show14>
5508
5506
  <Blocks_default
5509
5507
  blocks={builderContextSignal().content?.data?.blocks}
5510
5508
  context={builderContextSignal()}
@@ -5544,16 +5542,16 @@ function ContentVariants(props) {
5544
5542
  canTrack: getDefaultCanTrack(props.canTrack)
5545
5543
  });
5546
5544
  });
5547
- onMount6(() => {
5545
+ onMount7(() => {
5548
5546
  setShouldRenderVariants(false);
5549
5547
  });
5550
5548
  return <><>
5551
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5549
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5552
5550
  id="builderio-init-variants-fns"
5553
5551
  scriptStr={getInitVariantsFnsScriptString()}
5554
5552
  nonce={props.nonce || ""}
5555
- /></Show14>
5556
- <Show14 when={shouldRenderVariants()}>
5553
+ /></Show15>
5554
+ <Show15 when={shouldRenderVariants()}>
5557
5555
  <Inlined_styles_default
5558
5556
  id="builderio-variants"
5559
5557
  styles={hideVariantsStyleString()}
@@ -5591,7 +5589,7 @@ function ContentVariants(props) {
5591
5589
  {...{}}
5592
5590
  />;
5593
5591
  }}</For9>
5594
- </Show14>
5592
+ </Show15>
5595
5593
  <Content_default
5596
5594
  nonce={props.nonce}
5597
5595
  isNestedRender={props.isNestedRender}
@@ -5672,7 +5670,7 @@ function Symbol(props) {
5672
5670
  }
5673
5671
  });
5674
5672
  }
5675
- onMount7(() => {
5673
+ onMount8(() => {
5676
5674
  });
5677
5675
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5678
5676
  function onUpdateFn_0() {