@builder.io/sdk-solid 2.0.16 → 2.0.22

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.
@@ -83,10 +83,10 @@ function Button(props) {
83
83
  var button_default = Button;
84
84
 
85
85
  // src/blocks/columns/columns.tsx
86
- import { Show as Show6, For as For4, createSignal as createSignal7 } from "solid-js";
86
+ import { Show as Show7, For as For4, createSignal as createSignal7 } from "solid-js";
87
87
 
88
88
  // src/components/blocks/blocks.tsx
89
- import { useContext, Show as Show5, For as For3 } from "solid-js";
89
+ import { useContext, Show as Show6, For as For3 } from "solid-js";
90
90
 
91
91
  // src/context/builder.context.ts
92
92
  import { createContext } from "solid-js";
@@ -112,9 +112,9 @@ var components_context_default = createContext2({ registeredComponents: {} });
112
112
 
113
113
  // src/components/block/block.tsx
114
114
  import {
115
- Show as Show4,
115
+ Show as Show5,
116
116
  For as For2,
117
- onMount,
117
+ onMount as onMount2,
118
118
  createMemo as createMemo5,
119
119
  createSignal as createSignal5
120
120
  } from "solid-js";
@@ -256,29 +256,6 @@ var parseCode = (code, {
256
256
  const useCode = useReturn ? `return (${code});` : code;
257
257
  return useCode;
258
258
  };
259
-
260
- // src/functions/evaluate/browser-runtime/browser.ts
261
- var runInBrowser = ({
262
- code,
263
- builder,
264
- context,
265
- event,
266
- localState,
267
- rootSetState,
268
- rootState
269
- }) => {
270
- const functionArgs = getFunctionArguments({
271
- builder,
272
- context,
273
- event,
274
- state: flattenState({
275
- rootState,
276
- localState,
277
- rootSetState
278
- })
279
- });
280
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
281
- };
282
259
  function flattenState({
283
260
  rootState,
284
261
  localState,
@@ -313,14 +290,27 @@ function flattenState({
313
290
  });
314
291
  }
315
292
 
316
- // src/functions/set.ts
317
- var set = (obj, _path, value) => {
318
- if (Object(obj) !== obj) {
319
- return obj;
320
- }
321
- const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
322
- path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
323
- return obj;
293
+ // src/functions/evaluate/browser-runtime/browser.ts
294
+ var runInBrowser = ({
295
+ code,
296
+ builder,
297
+ context,
298
+ event,
299
+ localState,
300
+ rootSetState,
301
+ rootState
302
+ }) => {
303
+ const functionArgs = getFunctionArguments({
304
+ builder,
305
+ context,
306
+ event,
307
+ state: flattenState({
308
+ rootState,
309
+ localState,
310
+ rootSetState
311
+ })
312
+ });
313
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
324
314
  };
325
315
 
326
316
  // src/functions/evaluate/edge-runtime/acorn-interpreter.ts
@@ -3392,22 +3382,56 @@ t.VALUE_IN_DESCRIPTOR = Ia;
3392
3382
  var acorn_interpreter_default = t;
3393
3383
 
3394
3384
  // src/functions/evaluate/edge-runtime/edge-runtime.ts
3385
+ function patchInterpreter() {
3386
+ const originalGetProperty = acorn_interpreter_default.prototype.getProperty;
3387
+ const originalSetProperty = acorn_interpreter_default.prototype.setProperty;
3388
+ function newGetProperty(obj, name) {
3389
+ if (obj == null || !obj._connected) {
3390
+ return originalGetProperty.call(this, obj, name);
3391
+ }
3392
+ const value = obj._connected[name];
3393
+ if (Array.isArray(value)) {
3394
+ return this.nativeToPseudo(value);
3395
+ }
3396
+ if (typeof value === "object") {
3397
+ return this.createConnectedObject(value);
3398
+ }
3399
+ return value;
3400
+ }
3401
+ function newSetProperty(obj, name, value, opt_descriptor) {
3402
+ if (obj == null || !obj._connected) {
3403
+ return originalSetProperty.call(this, obj, name, value, opt_descriptor);
3404
+ }
3405
+ obj._connected[name] = this.pseudoToNative(value);
3406
+ }
3407
+ const getKeys = [];
3408
+ const setKeys = [];
3409
+ for (const key of Object.keys(acorn_interpreter_default.prototype)) {
3410
+ if (acorn_interpreter_default.prototype[key] === originalGetProperty) {
3411
+ getKeys.push(key);
3412
+ }
3413
+ if (acorn_interpreter_default.prototype[key] === originalSetProperty) {
3414
+ setKeys.push(key);
3415
+ }
3416
+ }
3417
+ for (const key of getKeys) {
3418
+ acorn_interpreter_default.prototype[key] = newGetProperty;
3419
+ }
3420
+ for (const key of setKeys) {
3421
+ acorn_interpreter_default.prototype[key] = newSetProperty;
3422
+ }
3423
+ acorn_interpreter_default.prototype.createConnectedObject = function(obj) {
3424
+ const connectedObject = this.createObject(this.OBJECT);
3425
+ connectedObject._connected = obj;
3426
+ return connectedObject;
3427
+ };
3428
+ }
3429
+ patchInterpreter();
3395
3430
  var processCode = (code) => {
3396
- return code.split("\n").map((line) => {
3397
- const trimmed = line.trim();
3398
- if (line.includes("__awaiter"))
3399
- return void 0;
3400
- const isStateSetter = trimmed.startsWith("state.");
3401
- if (!isStateSetter)
3402
- return line;
3403
- const [lhs, rhs] = trimmed.split("=");
3404
- const setStr = lhs.replace("state.", "").trim();
3405
- const setExpr = `setRootState('${setStr}', ${rhs.trim()})`;
3406
- return `
3407
- ${line}
3408
- ${setExpr}
3409
- `;
3410
- }).filter(Boolean).join("\n");
3431
+ return code.replace(/^.*?function main\(\)/, `
3432
+ var __awaiter = function (e, t, n, r) {return r()},
3433
+ __generator = function (e, t) { return t() };
3434
+ function main()`).replace(/\?\./g, ".");
3411
3435
  };
3412
3436
  var getJSONValName = (val) => val + "JSON";
3413
3437
  var runInEdge = ({
@@ -3419,10 +3443,11 @@ var runInEdge = ({
3419
3443
  rootSetState,
3420
3444
  code
3421
3445
  }) => {
3422
- const state = {
3423
- ...rootState,
3424
- ...localState
3425
- };
3446
+ const state = flattenState({
3447
+ rootState,
3448
+ localState,
3449
+ rootSetState
3450
+ });
3426
3451
  const properties = getFunctionArguments({
3427
3452
  builder,
3428
3453
  context,
@@ -3431,6 +3456,9 @@ var runInEdge = ({
3431
3456
  });
3432
3457
  const prependedCode = properties.map(([key]) => {
3433
3458
  const jsonValName = getJSONValName(key);
3459
+ if (key === "state") {
3460
+ return ``;
3461
+ }
3434
3462
  return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
3435
3463
  }).join("\n");
3436
3464
  const cleanedCode = processCode(code);
@@ -3446,16 +3474,15 @@ function theFunction() {
3446
3474
  }
3447
3475
  theFunction();
3448
3476
  `;
3449
- const setRootState = (prop, value) => {
3450
- const newState = set(state, prop, value);
3451
- rootSetState?.(newState);
3452
- };
3453
3477
  const initFunc = function(interpreter, globalObject) {
3454
3478
  properties.forEach(([key, val]) => {
3455
- const jsonVal = JSON.stringify(val);
3456
- interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
3479
+ if (key === "state") {
3480
+ interpreter.setProperty(globalObject, key, interpreter.createConnectedObject(val), interpreter.READONLY_DESCRIPTOR);
3481
+ } else {
3482
+ const jsonVal = JSON.stringify(val);
3483
+ interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
3484
+ }
3457
3485
  });
3458
- interpreter.setProperty(globalObject, "setRootState", interpreter.createNativeFunction(setRootState));
3459
3486
  };
3460
3487
  const myInterpreter = new acorn_interpreter_default(transformed, initFunc);
3461
3488
  myInterpreter.run();
@@ -3572,6 +3599,16 @@ function evaluate({
3572
3599
  // src/functions/fast-clone.ts
3573
3600
  var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
3574
3601
 
3602
+ // src/functions/set.ts
3603
+ var set = (obj, _path, value) => {
3604
+ if (Object(obj) !== obj) {
3605
+ return obj;
3606
+ }
3607
+ const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
3608
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
3609
+ return obj;
3610
+ };
3611
+
3575
3612
  // src/functions/transform-block.ts
3576
3613
  function transformBlock(block) {
3577
3614
  return block;
@@ -4234,12 +4271,23 @@ function BlockWrapper(props) {
4234
4271
  var Block_wrapper_default = BlockWrapper;
4235
4272
 
4236
4273
  // src/components/block/components/component-ref/component-ref.tsx
4237
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
4274
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
4238
4275
  import { Dynamic as Dynamic3 } from "solid-js/web";
4239
4276
 
4240
4277
  // src/components/block/components/interactive-element.tsx
4241
- import { createMemo as createMemo2 } from "solid-js";
4278
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
4242
4279
  import { Dynamic as Dynamic2 } from "solid-js/web";
4280
+
4281
+ // src/components/awaiter.tsx
4282
+ import { onMount } from "solid-js";
4283
+ function Awaiter(props) {
4284
+ onMount(() => {
4285
+ });
4286
+ return <><>{props.children}</></>;
4287
+ }
4288
+ var Awaiter_default = Awaiter;
4289
+
4290
+ // src/components/block/components/interactive-element.tsx
4243
4291
  function InteractiveElement(props) {
4244
4292
  const attributes = createMemo2(() => {
4245
4293
  return props.includeBlockProps ? {
@@ -4256,11 +4304,19 @@ function InteractiveElement(props) {
4256
4304
  })
4257
4305
  } : {};
4258
4306
  });
4259
- return <><Dynamic2
4260
- {...props.wrapperProps}
4307
+ return <><Show3
4308
+ fallback={<Dynamic2
4309
+ {...props.wrapperProps}
4310
+ attributes={attributes()}
4311
+ component={props.Wrapper}
4312
+ >{props.children}</Dynamic2>}
4313
+ when={props.Wrapper.load}
4314
+ ><Awaiter_default
4315
+ load={props.Wrapper.load}
4316
+ fallback={props.Wrapper.fallback}
4317
+ props={props.wrapperProps}
4261
4318
  attributes={attributes()}
4262
- component={props.Wrapper}
4263
- >{props.children}</Dynamic2></>;
4319
+ >{props.children}</Awaiter_default></Show3></>;
4264
4320
  }
4265
4321
  var interactive_element_default = InteractiveElement;
4266
4322
 
@@ -4302,7 +4358,7 @@ function ComponentRef(props) {
4302
4358
  const [Wrapper, setWrapper] = createSignal3(
4303
4359
  props.isInteractive ? interactive_element_default : props.componentRef
4304
4360
  );
4305
- return <><Show3 when={props.componentRef}><Dynamic3
4361
+ return <><Show4 when={props.componentRef}><Dynamic3
4306
4362
  {...getWrapperProps({
4307
4363
  componentOptions: props.componentOptions,
4308
4364
  builderBlock: props.builderBlock,
@@ -4323,7 +4379,7 @@ function ComponentRef(props) {
4323
4379
  registeredComponents={props.registeredComponents}
4324
4380
  linkComponent={props.linkComponent}
4325
4381
  />;
4326
- }}</For></Dynamic3></Show3></>;
4382
+ }}</For></Dynamic3></Show4></>;
4327
4383
  }
4328
4384
  var Component_ref_default = ComponentRef;
4329
4385
 
@@ -4412,7 +4468,7 @@ function Block(props) {
4412
4468
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
4413
4469
  };
4414
4470
  });
4415
- onMount(() => {
4471
+ onMount2(() => {
4416
4472
  const blockId = processedBlock().id;
4417
4473
  const animations = processedBlock().animations;
4418
4474
  if (animations && blockId) {
@@ -4424,13 +4480,13 @@ function Block(props) {
4424
4480
  );
4425
4481
  }
4426
4482
  });
4427
- return <><Show4 when={canShowBlock()}>
4483
+ return <><Show5 when={canShowBlock()}>
4428
4484
  <Block_styles_default
4429
4485
  block={processedBlock()}
4430
4486
  context={props.context}
4431
4487
  />
4432
- <Show4
4433
- fallback={<Show4
4488
+ <Show5
4489
+ fallback={<Show5
4434
4490
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
4435
4491
  const index = _index();
4436
4492
  return <Repeated_block_default
@@ -4452,9 +4508,9 @@ function Block(props) {
4452
4508
  builderBlock={componentRefProps().builderBlock}
4453
4509
  includeBlockProps={componentRefProps().includeBlockProps}
4454
4510
  isInteractive={componentRefProps().isInteractive}
4455
- /></Show4>}
4511
+ /></Show5>}
4456
4512
  when={!blockComponent()?.noWrap}
4457
- ><Show4
4513
+ ><Show5
4458
4514
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
4459
4515
  const index = _index();
4460
4516
  return <Repeated_block_default
@@ -4492,13 +4548,13 @@ function Block(props) {
4492
4548
  context={props.context}
4493
4549
  />;
4494
4550
  }}</For2>
4495
- </Block_wrapper_default></Show4></Show4>
4496
- </Show4></>;
4551
+ </Block_wrapper_default></Show5></Show5>
4552
+ </Show5></>;
4497
4553
  }
4498
4554
  var Block_default = Block;
4499
4555
 
4500
4556
  // src/components/blocks/blocks-wrapper.tsx
4501
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
4557
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
4502
4558
  import { Dynamic as Dynamic4 } from "solid-js/web";
4503
4559
  function BlocksWrapper(props) {
4504
4560
  const className = createMemo6(() => {
@@ -4533,11 +4589,11 @@ function BlocksWrapper(props) {
4533
4589
  }
4534
4590
  }
4535
4591
  let blocksWrapperRef;
4536
- onMount2(() => {
4592
+ onMount3(() => {
4537
4593
  });
4538
4594
  return <>
4539
4595
  <Dynamic4
4540
- class={className() + " dynamic-4da8c6f4"}
4596
+ class={className() + " dynamic-68b2d7fe"}
4541
4597
  ref={blocksWrapperRef}
4542
4598
  builder-path={props.path}
4543
4599
  builder-parent-id={props.parent}
@@ -4549,7 +4605,7 @@ function BlocksWrapper(props) {
4549
4605
  {...props.BlocksWrapperProps}
4550
4606
  component={props.BlocksWrapper}
4551
4607
  >{props.children}</Dynamic4>
4552
- <style>{`.dynamic-4da8c6f4 {
4608
+ <style>{`.dynamic-68b2d7fe {
4553
4609
  display: flex;
4554
4610
  flex-direction: column;
4555
4611
  align-items: stretch;
@@ -4569,7 +4625,7 @@ function Blocks(props) {
4569
4625
  styleProp={props.styleProp}
4570
4626
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
4571
4627
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
4572
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4628
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4573
4629
  const index = _index();
4574
4630
  return <Block_default
4575
4631
  key={block.id}
@@ -4578,7 +4634,7 @@ function Blocks(props) {
4578
4634
  context={props.context || builderContext}
4579
4635
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4580
4636
  />;
4581
- }}</For3></Show5></Blocks_wrapper_default></>;
4637
+ }}</For3></Show6></Blocks_wrapper_default></>;
4582
4638
  }
4583
4639
  var Blocks_default = Blocks;
4584
4640
 
@@ -4709,15 +4765,15 @@ function Columns(props) {
4709
4765
  }
4710
4766
  return <>
4711
4767
  <div
4712
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
4768
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
4713
4769
  style={columnsCssVars()}
4714
4770
  {...{}}
4715
4771
  >
4716
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
4772
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
4717
4773
  id="builderio-columns"
4718
4774
  styles={columnsStyles()}
4719
4775
  nonce={props.builderContext.nonce}
4720
- /></Show6>
4776
+ /></Show7>
4721
4777
  <For4 each={props.columns}>{(column, _index) => {
4722
4778
  const index = _index();
4723
4779
  return <Dynamic_renderer_default
@@ -4738,7 +4794,7 @@ function Columns(props) {
4738
4794
  /></Dynamic_renderer_default>;
4739
4795
  }}</For4>
4740
4796
  </div>
4741
- <style>{`.div-3ff242de {
4797
+ <style>{`.div-46766f1c {
4742
4798
  display: flex;
4743
4799
  line-height: normal;
4744
4800
  }`}</style>
@@ -4753,7 +4809,7 @@ function FragmentComponent(props) {
4753
4809
  var fragment_default = FragmentComponent;
4754
4810
 
4755
4811
  // src/blocks/image/image.tsx
4756
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
4812
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
4757
4813
 
4758
4814
  // src/blocks/image/image.helpers.ts
4759
4815
  function removeProtocol(path) {
@@ -4842,14 +4898,14 @@ function Image(props) {
4842
4898
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
4843
4899
  return out;
4844
4900
  });
4845
- onMount3(() => {
4901
+ onMount4(() => {
4846
4902
  });
4847
4903
  return <>
4848
4904
  <>
4849
4905
  <picture>
4850
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
4906
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
4851
4907
  <img
4852
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
4908
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
4853
4909
  loading={props.highPriority ? "eager" : "lazy"}
4854
4910
  fetchpriority={props.highPriority ? "high" : "auto"}
4855
4911
  alt={props.altText}
@@ -4864,25 +4920,25 @@ function Image(props) {
4864
4920
  sizes={props.sizes}
4865
4921
  />
4866
4922
  </picture>
4867
- <Show7
4923
+ <Show8
4868
4924
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
4869
4925
  ><div
4870
- class="builder-image-sizer div-4512e110"
4926
+ class="builder-image-sizer div-7e6ffddc"
4871
4927
  style={{
4872
4928
  "padding-top": props.aspectRatio * 100 + "%"
4873
4929
  }}
4874
- /></Show7>
4875
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
4876
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
4930
+ /></Show8>
4931
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
4932
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
4877
4933
  </>
4878
- <style>{`.img-4512e110 {
4934
+ <style>{`.img-7e6ffddc {
4879
4935
  opacity: 1;
4880
4936
  transition: opacity 0.2s ease-in-out;
4881
- }.div-4512e110 {
4937
+ }.div-7e6ffddc {
4882
4938
  width: 100%;
4883
4939
  pointer-events: none;
4884
4940
  font-size: 0;
4885
- }.div-4512e110-2 {
4941
+ }.div-7e6ffddc-2 {
4886
4942
  display: flex;
4887
4943
  flex-direction: column;
4888
4944
  align-items: stretch;
@@ -4918,10 +4974,10 @@ function SectionComponent(props) {
4918
4974
  var section_default = SectionComponent;
4919
4975
 
4920
4976
  // src/blocks/symbol/symbol.tsx
4921
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
4977
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
4922
4978
 
4923
4979
  // src/components/content-variants/content-variants.tsx
4924
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
4980
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
4925
4981
 
4926
4982
  // src/helpers/url.ts
4927
4983
  var getTopLevelDomain = (host) => {
@@ -5115,7 +5171,7 @@ var handleABTesting = async ({
5115
5171
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
5116
5172
 
5117
5173
  // src/components/content/content.tsx
5118
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
5174
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
5119
5175
 
5120
5176
  // src/blocks/accordion/component-info.ts
5121
5177
  var defaultTitle = {
@@ -5249,7 +5305,7 @@ var componentInfo = {
5249
5305
  };
5250
5306
 
5251
5307
  // src/blocks/accordion/accordion.tsx
5252
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
5308
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
5253
5309
 
5254
5310
  // src/blocks/accordion/helpers.ts
5255
5311
  var convertOrderNumberToString = (order) => {
@@ -5383,7 +5439,7 @@ function Accordion(props) {
5383
5439
  registeredComponents={props.builderComponents}
5384
5440
  linkComponent={props.builderLinkComponent}
5385
5441
  /></div>
5386
- <Show8 when={open().includes(index)}><div
5442
+ <Show9 when={open().includes(index)}><div
5387
5443
  class={getAccordionDetailClassName(index)}
5388
5444
  style={accordionDetailStyles()}
5389
5445
  ><Blocks_default
@@ -5393,7 +5449,7 @@ function Accordion(props) {
5393
5449
  context={props.builderContext}
5394
5450
  registeredComponents={props.builderComponents}
5395
5451
  linkComponent={props.builderLinkComponent}
5396
- /></div></Show8>
5452
+ /></div></Show9>
5397
5453
  </>;
5398
5454
  }}</For5></div></>;
5399
5455
  }
@@ -6073,7 +6129,7 @@ var componentInfo9 = {
6073
6129
  };
6074
6130
 
6075
6131
  // src/blocks/tabs/tabs.tsx
6076
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
6132
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
6077
6133
  function Tabs(props) {
6078
6134
  const [activeTab, setActiveTab] = createSignal10(
6079
6135
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -6115,14 +6171,14 @@ function Tabs(props) {
6115
6171
  linkComponent={props.builderLinkComponent}
6116
6172
  /></span>;
6117
6173
  }}</For6></div>
6118
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
6174
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
6119
6175
  parent={props.builderBlock.id}
6120
6176
  path={`component.options.tabs.${activeTab()}.content`}
6121
6177
  blocks={activeTabContent(activeTab())}
6122
6178
  context={props.builderContext}
6123
6179
  registeredComponents={props.builderComponents}
6124
6180
  linkComponent={props.builderLinkComponent}
6125
- /></div></Show9>
6181
+ /></div></Show10>
6126
6182
  </div></>;
6127
6183
  }
6128
6184
  var tabs_default = Tabs;
@@ -6211,12 +6267,12 @@ var componentInfo11 = {
6211
6267
  };
6212
6268
 
6213
6269
  // src/blocks/custom-code/custom-code.tsx
6214
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
6270
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
6215
6271
  function CustomCode(props) {
6216
6272
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
6217
6273
  const [scriptsRun, setScriptsRun] = createSignal12([]);
6218
6274
  let elementRef;
6219
- onMount4(() => {
6275
+ onMount5(() => {
6220
6276
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
6221
6277
  return;
6222
6278
  }
@@ -6564,7 +6620,7 @@ var componentInfo13 = {
6564
6620
  };
6565
6621
 
6566
6622
  // src/blocks/form/form/form.tsx
6567
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
6623
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
6568
6624
 
6569
6625
  // src/functions/get-env.ts
6570
6626
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -6779,7 +6835,7 @@ function FormComponent(props) {
6779
6835
  {...{}}
6780
6836
  {...props.attributes}
6781
6837
  >
6782
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
6838
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
6783
6839
  const idx = _index();
6784
6840
  return <Block_default
6785
6841
  key={`form-block-${idx}`}
@@ -6788,23 +6844,23 @@ function FormComponent(props) {
6788
6844
  registeredComponents={props.builderComponents}
6789
6845
  linkComponent={props.builderLinkComponent}
6790
6846
  />;
6791
- }}</For7></Show10>
6792
- <Show10 when={submissionState() === "error"}><Blocks_default
6847
+ }}</For7></Show11>
6848
+ <Show11 when={submissionState() === "error"}><Blocks_default
6793
6849
  path="errorMessage"
6794
6850
  blocks={props.errorMessage}
6795
6851
  context={props.builderContext}
6796
- /></Show10>
6797
- <Show10 when={submissionState() === "sending"}><Blocks_default
6852
+ /></Show11>
6853
+ <Show11 when={submissionState() === "sending"}><Blocks_default
6798
6854
  path="sendingMessage"
6799
6855
  blocks={props.sendingMessage}
6800
6856
  context={props.builderContext}
6801
- /></Show10>
6802
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
6803
- <Show10 when={submissionState() === "success"}><Blocks_default
6857
+ /></Show11>
6858
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
6859
+ <Show11 when={submissionState() === "success"}><Blocks_default
6804
6860
  path="successMessage"
6805
6861
  blocks={props.successMessage}
6806
6862
  context={props.builderContext}
6807
- /></Show10>
6863
+ /></Show11>
6808
6864
  </form>
6809
6865
  <style>{`.pre-2e825338 {
6810
6866
  padding: 10px;
@@ -7156,7 +7212,7 @@ var componentInfo19 = {
7156
7212
  };
7157
7213
 
7158
7214
  // src/blocks/video/video.tsx
7159
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
7215
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
7160
7216
  function Video(props) {
7161
7217
  const videoProps = createMemo15(() => {
7162
7218
  return {
@@ -7207,8 +7263,8 @@ function Video(props) {
7207
7263
  }}
7208
7264
  src={props.video || "no-src"}
7209
7265
  poster={props.posterImage}
7210
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
7211
- <Show11
7266
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
7267
+ <Show12
7212
7268
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
7213
7269
  ><div
7214
7270
  style={{
@@ -7217,15 +7273,15 @@ function Video(props) {
7217
7273
  "pointer-events": "none",
7218
7274
  "font-size": "0px"
7219
7275
  }}
7220
- /></Show11>
7221
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
7276
+ /></Show12>
7277
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
7222
7278
  style={{
7223
7279
  display: "flex",
7224
7280
  "flex-direction": "column",
7225
7281
  "align-items": "stretch"
7226
7282
  }}
7227
- >{props.children}</div></Show11>
7228
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
7283
+ >{props.children}</div></Show12>
7284
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
7229
7285
  style={{
7230
7286
  "pointer-events": "none",
7231
7287
  display: "flex",
@@ -7237,7 +7293,7 @@ function Video(props) {
7237
7293
  width: "100%",
7238
7294
  height: "100%"
7239
7295
  }}
7240
- >{props.children}</div></Show11>
7296
+ >{props.children}</div></Show12>
7241
7297
  </div></>;
7242
7298
  }
7243
7299
  var video_default = Video;
@@ -7382,8 +7438,8 @@ var Inlined_script_default = InlinedScript;
7382
7438
 
7383
7439
  // src/components/content/components/enable-editor.tsx
7384
7440
  import {
7385
- Show as Show12,
7386
- onMount as onMount5,
7441
+ Show as Show13,
7442
+ onMount as onMount6,
7387
7443
  on as on3,
7388
7444
  createEffect as createEffect3,
7389
7445
  createMemo as createMemo16,
@@ -7885,7 +7941,7 @@ function isFromTrustedHost(trustedHosts, e) {
7885
7941
  }
7886
7942
 
7887
7943
  // src/constants/sdk-version.ts
7888
- var SDK_VERSION = "2.0.16";
7944
+ var SDK_VERSION = "2.0.22";
7889
7945
 
7890
7946
  // src/functions/register.ts
7891
7947
  var registry = {};
@@ -8237,22 +8293,6 @@ function EnableEditor(props) {
8237
8293
  }
8238
8294
  })(event);
8239
8295
  }
8240
- function evaluateJsCode() {
8241
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
8242
- if (jsCode) {
8243
- evaluate({
8244
- code: jsCode,
8245
- context: props.context || {},
8246
- localState: void 0,
8247
- rootState: props.builderContextSignal.rootState,
8248
- rootSetState: props.builderContextSignal.rootSetState,
8249
- /**
8250
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
8251
- */
8252
- enableCache: false
8253
- });
8254
- }
8255
- }
8256
8296
  function onClick(event) {
8257
8297
  if (props.builderContextSignal.content) {
8258
8298
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -8294,7 +8334,7 @@ function EnableEditor(props) {
8294
8334
  })
8295
8335
  )
8296
8336
  );
8297
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
8337
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
8298
8338
  mergeNewRootState({
8299
8339
  [key]: json
8300
8340
  });
@@ -8323,7 +8363,9 @@ function EnableEditor(props) {
8323
8363
  }
8324
8364
  }
8325
8365
  let elementRef;
8326
- onMount5(() => {
8366
+ runHttpRequests();
8367
+ emitStateUpdate();
8368
+ onMount6(() => {
8327
8369
  if (isBrowser()) {
8328
8370
  if (isEditing()) {
8329
8371
  window.addEventListener("message", processMessage);
@@ -8384,16 +8426,6 @@ function EnableEditor(props) {
8384
8426
  }
8385
8427
  }
8386
8428
  });
8387
- onMount5(() => {
8388
- if (!props.apiKey) {
8389
- logger.error(
8390
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
8391
- );
8392
- }
8393
- evaluateJsCode();
8394
- runHttpRequests();
8395
- emitStateUpdate();
8396
- });
8397
8429
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
8398
8430
  function onUpdateFn_0() {
8399
8431
  if (props.content) {
@@ -8401,57 +8433,35 @@ function EnableEditor(props) {
8401
8433
  }
8402
8434
  }
8403
8435
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
8404
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
8405
- function onUpdateFn_1() {
8406
- evaluateJsCode();
8407
- }
8408
- createEffect3(
8409
- on3(
8410
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
8411
- onUpdateFn_1
8412
- )
8413
- );
8414
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
8415
- function onUpdateFn_2() {
8416
- runHttpRequests();
8417
- }
8418
- createEffect3(
8419
- on3(
8420
- () => [
8421
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
8422
- ],
8423
- onUpdateFn_2
8424
- )
8425
- );
8426
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
8436
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
8427
8437
  () => props.builderContextSignal.rootState
8428
8438
  );
8429
- function onUpdateFn_3() {
8439
+ function onUpdateFn_1() {
8430
8440
  emitStateUpdate();
8431
8441
  }
8432
8442
  createEffect3(
8433
8443
  on3(
8434
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
8435
- onUpdateFn_3
8444
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
8445
+ onUpdateFn_1
8436
8446
  )
8437
8447
  );
8438
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
8439
- function onUpdateFn_4() {
8448
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
8449
+ function onUpdateFn_2() {
8440
8450
  if (props.data) {
8441
8451
  mergeNewRootState(props.data);
8442
8452
  }
8443
8453
  }
8444
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
8445
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
8446
- function onUpdateFn_5() {
8454
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
8455
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
8456
+ function onUpdateFn_3() {
8447
8457
  if (props.locale) {
8448
8458
  mergeNewRootState({
8449
8459
  locale: props.locale
8450
8460
  });
8451
8461
  }
8452
8462
  }
8453
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
8454
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
8463
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
8464
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
8455
8465
  class={getWrapperClassName(
8456
8466
  props.content?.testVariationId || props.content?.id
8457
8467
  )}
@@ -8464,7 +8474,7 @@ function EnableEditor(props) {
8464
8474
  {...showContentProps()}
8465
8475
  {...props.contentWrapperProps}
8466
8476
  component={ContentWrapper()}
8467
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
8477
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
8468
8478
  }
8469
8479
  var Enable_editor_default = EnableEditor;
8470
8480
 
@@ -8601,6 +8611,31 @@ function ContentComponent(props) {
8601
8611
  rootState: newRootState
8602
8612
  }));
8603
8613
  }
8614
+ if (!props.apiKey) {
8615
+ logger.error(
8616
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
8617
+ );
8618
+ }
8619
+ const jsCode = builderContextSignal().content?.data?.jsCode;
8620
+ if (jsCode) {
8621
+ evaluate({
8622
+ code: jsCode,
8623
+ context: props.context || {},
8624
+ localState: void 0,
8625
+ rootState: builderContextSignal().rootState,
8626
+ rootSetState: (newState) => {
8627
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
8628
+ ...PREVIOUS_VALUE,
8629
+ rootState: newState
8630
+ }));
8631
+ },
8632
+ isExpression: false,
8633
+ /**
8634
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
8635
+ */
8636
+ enableCache: false
8637
+ });
8638
+ }
8604
8639
  return <><components_context_default.Provider
8605
8640
  value={{
8606
8641
  registeredComponents: registeredComponents()
@@ -8624,18 +8659,18 @@ function ContentComponent(props) {
8624
8659
  setBuilderContextSignal
8625
8660
  }}
8626
8661
  >
8627
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
8662
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
8628
8663
  id="builderio-variant-visibility"
8629
8664
  scriptStr={scriptStr()}
8630
8665
  nonce={props.nonce || ""}
8631
- /></Show13>
8632
- <Show13 when={TARGET !== "reactNative"}><Styles_default
8666
+ /></Show14>
8667
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
8633
8668
  nonce={props.nonce || ""}
8634
8669
  isNestedRender={props.isNestedRender}
8635
8670
  contentId={builderContextSignal().content?.id}
8636
8671
  cssCode={builderContextSignal().content?.data?.cssCode}
8637
8672
  customFonts={builderContextSignal().content?.data?.customFonts}
8638
- /></Show13>
8673
+ /></Show14>
8639
8674
  <Blocks_default
8640
8675
  blocks={builderContextSignal().content?.data?.blocks}
8641
8676
  context={builderContextSignal()}
@@ -8675,16 +8710,16 @@ function ContentVariants(props) {
8675
8710
  canTrack: getDefaultCanTrack(props.canTrack)
8676
8711
  });
8677
8712
  });
8678
- onMount6(() => {
8713
+ onMount7(() => {
8679
8714
  setShouldRenderVariants(false);
8680
8715
  });
8681
8716
  return <><>
8682
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
8717
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
8683
8718
  id="builderio-init-variants-fns"
8684
8719
  scriptStr={getInitVariantsFnsScriptString()}
8685
8720
  nonce={props.nonce || ""}
8686
- /></Show14>
8687
- <Show14 when={shouldRenderVariants()}>
8721
+ /></Show15>
8722
+ <Show15 when={shouldRenderVariants()}>
8688
8723
  <Inlined_styles_default
8689
8724
  id="builderio-variants"
8690
8725
  styles={hideVariantsStyleString()}
@@ -8722,7 +8757,7 @@ function ContentVariants(props) {
8722
8757
  {...{}}
8723
8758
  />;
8724
8759
  }}</For9>
8725
- </Show14>
8760
+ </Show15>
8726
8761
  <Content_default
8727
8762
  nonce={props.nonce}
8728
8763
  isNestedRender={props.isNestedRender}
@@ -8803,7 +8838,7 @@ function Symbol2(props) {
8803
8838
  }
8804
8839
  });
8805
8840
  }
8806
- onMount7(() => {
8841
+ onMount8(() => {
8807
8842
  });
8808
8843
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
8809
8844
  function onUpdateFn_0() {