@builder.io/sdk-solid 4.2.0 → 4.2.2

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.
package/lib/node/index.js CHANGED
@@ -1480,11 +1480,6 @@ var getWrapperProps = ({
1480
1480
  function ComponentRef(props) {
1481
1481
  createSignal(false);
1482
1482
  const [Wrapper, setWrapper] = createSignal(props.isInteractive ? interactive_element_default : props.componentRef);
1483
- const onUpdateFn_0_props_componentOptions = createMemo(() => props.componentOptions);
1484
- const onUpdateFn_0_props_blockChildren = createMemo(() => props.blockChildren);
1485
- function onUpdateFn_0() {
1486
- }
1487
- createEffect(on(() => [onUpdateFn_0_props_componentOptions(), onUpdateFn_0_props_blockChildren()], onUpdateFn_0));
1488
1483
  return createComponent(Show, {
1489
1484
  get when() {
1490
1485
  return props.componentRef;
@@ -1504,25 +1499,32 @@ function ComponentRef(props) {
1504
1499
  return Wrapper();
1505
1500
  },
1506
1501
  get children() {
1507
- return createComponent(For, {
1508
- get each() {
1509
- return props.blockChildren;
1502
+ return createComponent(Show, {
1503
+ get when() {
1504
+ return props.componentRef;
1510
1505
  },
1511
- children: (child, _index) => {
1512
- _index();
1513
- return createComponent(block_default, {
1514
- get key() {
1515
- return child.id;
1516
- },
1517
- block: child,
1518
- get context() {
1519
- return props.context;
1520
- },
1521
- get registeredComponents() {
1522
- return props.registeredComponents;
1506
+ get children() {
1507
+ return createComponent(For, {
1508
+ get each() {
1509
+ return props.blockChildren;
1523
1510
  },
1524
- get linkComponent() {
1525
- return props.linkComponent;
1511
+ children: (child, _index) => {
1512
+ _index();
1513
+ return createComponent(block_default, {
1514
+ get key() {
1515
+ return child.id;
1516
+ },
1517
+ block: child,
1518
+ get context() {
1519
+ return props.context;
1520
+ },
1521
+ get registeredComponents() {
1522
+ return props.registeredComponents;
1523
+ },
1524
+ get linkComponent() {
1525
+ return props.linkComponent;
1526
+ }
1527
+ });
1526
1528
  }
1527
1529
  });
1528
1530
  }
@@ -1829,7 +1831,7 @@ function Block(props) {
1829
1831
  });
1830
1832
  }
1831
1833
  var block_default = Block;
1832
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
1834
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4d836538 {
1833
1835
  display: flex;
1834
1836
  flex-direction: column;
1835
1837
  align-items: stretch;
@@ -1878,7 +1880,7 @@ function BlocksWrapper(props) {
1878
1880
  createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1879
1881
  return [createComponent(Dynamic, mergeProps({
1880
1882
  get ["class"]() {
1881
- return className() + " dynamic-450facf4";
1883
+ return className() + " dynamic-4d836538";
1882
1884
  },
1883
1885
  ref(r$) {
1884
1886
  const _ref$ = blocksWrapperRef;
@@ -4131,6 +4133,9 @@ function Tabs(props) {
4131
4133
  function activeTabContent(active) {
4132
4134
  return props.tabs && props.tabs[active].content;
4133
4135
  }
4136
+ function getTabStyle(index) {
4137
+ return index === activeTab() ? props.activeTabStyle : {};
4138
+ }
4134
4139
  function onClick(index) {
4135
4140
  if (index === activeTab() && props.collapsible) {
4136
4141
  setActiveTab(-1);
@@ -4172,9 +4177,7 @@ function Tabs(props) {
4172
4177
  }
4173
4178
  }));
4174
4179
  effect((_p$) => {
4175
- const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = {
4176
- ...activeTab() === index ? props.activeTabStyle : {}
4177
- };
4180
+ const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = getTabStyle(index);
4178
4181
  _v$ !== _p$._v$ && className(_el$4, _p$._v$ = _v$);
4179
4182
  _p$._v$2 = style(_el$4, _v$2, _p$._v$2);
4180
4183
  return _p$;
@@ -4670,9 +4673,9 @@ function logFetch(url) {
4670
4673
  }
4671
4674
 
4672
4675
  // src/blocks/form/form/form.tsx
4673
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4676
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-74261216">`);
4674
4677
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4675
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4678
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-74261216 {
4676
4679
  padding: 10px;
4677
4680
  color: red;
4678
4681
  text-align: center;
@@ -4695,6 +4698,9 @@ function FormComponent(props) {
4695
4698
  function submissionState() {
4696
4699
  return isEditing() && props.previewState || formState();
4697
4700
  }
4701
+ function errorResponse(response) {
4702
+ return JSON.stringify(response, null, 2);
4703
+ }
4698
4704
  function onSubmit(event) {
4699
4705
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4700
4706
  if (props.sendSubmissionsTo === "zapier") {
@@ -4709,13 +4715,13 @@ function FormComponent(props) {
4709
4715
  const headers = props.customHeaders || {};
4710
4716
  let body;
4711
4717
  const formData = new FormData(el);
4712
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4718
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
4713
4719
  let value;
4714
4720
  const key = el2.name;
4715
4721
  if (el2 instanceof HTMLInputElement) {
4716
4722
  if (el2.type === "radio") {
4717
4723
  if (el2.checked) {
4718
- value = el2.name;
4724
+ value = el2.value;
4719
4725
  return {
4720
4726
  key,
4721
4727
  value
@@ -4942,7 +4948,7 @@ function FormComponent(props) {
4942
4948
  },
4943
4949
  get children() {
4944
4950
  const _el$2 = _tmpl$15();
4945
- insert(_el$2, () => JSON.stringify(responseData(), null, 2));
4951
+ insert(_el$2, () => errorResponse(responseData()));
4946
4952
  return _el$2;
4947
4953
  }
4948
4954
  }), null);
@@ -5658,7 +5664,7 @@ function getPreviewContent(_searchParams) {
5658
5664
  }
5659
5665
 
5660
5666
  // src/constants/sdk-version.ts
5661
- var SDK_VERSION = "4.2.0";
5667
+ var SDK_VERSION = "4.2.2";
5662
5668
 
5663
5669
  // src/helpers/sdk-headers.ts
5664
5670
  var getSdkHeaders = () => ({
@@ -6462,6 +6468,8 @@ var getWrapperClassName = (variationId) => {
6462
6468
  // src/components/content/components/enable-editor.tsx
6463
6469
  function EnableEditor(props) {
6464
6470
  createSignal(false);
6471
+ const [prevData, setPrevData] = createSignal(null);
6472
+ const [prevLocale, setPrevLocale] = createSignal("");
6465
6473
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6466
6474
  const [httpReqsData, setHttpReqsData] = createSignal({});
6467
6475
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6586,11 +6594,15 @@ function EnableEditor(props) {
6586
6594
  method: "GET"
6587
6595
  };
6588
6596
  logFetch(JSON.stringify(fetchRequestObj));
6589
- fetch(fetchRequestObj.url, {
6597
+ const fetchOptions = {
6590
6598
  method: fetchRequestObj.method,
6591
6599
  headers: fetchRequestObj.headers,
6592
6600
  body: fetchRequestObj.body
6593
- }).then((response) => response.json()).then((json) => {
6601
+ };
6602
+ if (fetchRequestObj.method === "GET") {
6603
+ delete fetchOptions.body;
6604
+ }
6605
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6594
6606
  mergeNewRootState({
6595
6607
  [key]: json
6596
6608
  });
@@ -6698,16 +6710,24 @@ function EnableEditor(props) {
6698
6710
  const onUpdateFn_2_props_data = createMemo(() => props.data);
6699
6711
  function onUpdateFn_2() {
6700
6712
  if (props.data) {
6713
+ if (prevData() === props.data) {
6714
+ return;
6715
+ }
6701
6716
  mergeNewRootState(props.data);
6717
+ setPrevData(props.data);
6702
6718
  }
6703
6719
  }
6704
6720
  createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6705
6721
  const onUpdateFn_3_props_locale = createMemo(() => props.locale);
6706
6722
  function onUpdateFn_3() {
6707
6723
  if (props.locale) {
6724
+ if (prevLocale() === props.locale) {
6725
+ return;
6726
+ }
6708
6727
  mergeNewRootState({
6709
6728
  locale: props.locale
6710
6729
  });
6730
+ setPrevLocale(props.locale);
6711
6731
  }
6712
6732
  }
6713
6733
  createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
@@ -7257,6 +7277,9 @@ function Symbol(props) {
7257
7277
  const contentWrapper = createMemo(() => {
7258
7278
  return "div";
7259
7279
  });
7280
+ const customComponents = createMemo(() => {
7281
+ return Object.values(props.builderComponents);
7282
+ });
7260
7283
  const className = createMemo(() => {
7261
7284
  return [...[props.attributes[getClassPropName()]], "builder-symbol", props.symbol?.inline ? "builder-inline-symbol" : void 0, props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0].filter(Boolean).join(" ");
7262
7285
  });
@@ -7305,7 +7328,7 @@ function Symbol(props) {
7305
7328
  };
7306
7329
  },
7307
7330
  get customComponents() {
7308
- return Object.values(props.builderComponents);
7331
+ return customComponents();
7309
7332
  },
7310
7333
  get data() {
7311
7334
  return {
@@ -7366,6 +7389,18 @@ function register(type, info) {
7366
7389
  }
7367
7390
  }
7368
7391
  }
7392
+ function registerAction(action) {
7393
+ if (isBrowser()) {
7394
+ const actionClone = JSON.parse(JSON.stringify(action));
7395
+ if (action.action) {
7396
+ actionClone.action = action.action.toString();
7397
+ }
7398
+ window.parent?.postMessage({
7399
+ type: "builder.registerAction",
7400
+ data: actionClone
7401
+ }, "*");
7402
+ }
7403
+ }
7369
7404
 
7370
7405
  // src/functions/set-editor-settings.ts
7371
7406
  var settings = {};
@@ -7402,4 +7437,4 @@ var fetchBuilderProps = async (_args) => {
7402
7437
  };
7403
7438
  };
7404
7439
 
7405
- export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
7440
+ export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, registerAction, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
@@ -1364,14 +1364,7 @@ function BlockWrapper(props) {
1364
1364
  var Block_wrapper_default = BlockWrapper;
1365
1365
 
1366
1366
  // src/components/block/components/component-ref/component-ref.tsx
1367
- import {
1368
- Show as Show4,
1369
- For,
1370
- on as on2,
1371
- createEffect as createEffect2,
1372
- createMemo as createMemo3,
1373
- createSignal as createSignal3
1374
- } from "solid-js";
1367
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1375
1368
  import { Dynamic as Dynamic3 } from "solid-js/web";
1376
1369
 
1377
1370
  // src/components/block/components/interactive-element.tsx
@@ -1478,23 +1471,6 @@ function ComponentRef(props) {
1478
1471
  const [Wrapper, setWrapper] = createSignal3(
1479
1472
  props.isInteractive ? interactive_element_default : props.componentRef
1480
1473
  );
1481
- const onUpdateFn_0_props_componentOptions = createMemo3(
1482
- () => props.componentOptions
1483
- );
1484
- const onUpdateFn_0_props_blockChildren = createMemo3(
1485
- () => props.blockChildren
1486
- );
1487
- function onUpdateFn_0() {
1488
- }
1489
- createEffect2(
1490
- on2(
1491
- () => [
1492
- onUpdateFn_0_props_componentOptions(),
1493
- onUpdateFn_0_props_blockChildren()
1494
- ],
1495
- onUpdateFn_0
1496
- )
1497
- );
1498
1474
  return <><Show4 when={props.componentRef}><Dynamic3
1499
1475
  {...getWrapperProps({
1500
1476
  componentOptions: props.componentOptions,
@@ -1507,7 +1483,7 @@ function ComponentRef(props) {
1507
1483
  contextValue: props.context
1508
1484
  })}
1509
1485
  component={Wrapper()}
1510
- ><For each={props.blockChildren}>{(child, _index) => {
1486
+ ><Show4 when={props.componentRef}><For each={props.blockChildren}>{(child, _index) => {
1511
1487
  const index = _index();
1512
1488
  return <Block_default
1513
1489
  key={child.id}
@@ -1516,12 +1492,12 @@ function ComponentRef(props) {
1516
1492
  registeredComponents={props.registeredComponents}
1517
1493
  linkComponent={props.linkComponent}
1518
1494
  />;
1519
- }}</For></Dynamic3></Show4></>;
1495
+ }}</For></Show4></Dynamic3></Show4></>;
1520
1496
  }
1521
1497
  var Component_ref_default = ComponentRef;
1522
1498
 
1523
1499
  // src/components/block/components/repeated-block.tsx
1524
- import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1500
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1525
1501
  function RepeatedBlock(props) {
1526
1502
  const [store, setStore] = createSignal4(props.repeatContext);
1527
1503
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1530,7 +1506,7 @@ function RepeatedBlock(props) {
1530
1506
  function onUpdateFn_0() {
1531
1507
  setStore(props.repeatContext);
1532
1508
  }
1533
- createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1509
+ createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1534
1510
  return <><builder_context_default.Provider value={store()}><Block_default
1535
1511
  block={props.block}
1536
1512
  context={store()}
@@ -1699,7 +1675,7 @@ function Block(props) {
1699
1675
  var Block_default = Block;
1700
1676
 
1701
1677
  // src/components/blocks/blocks-wrapper.tsx
1702
- import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1678
+ import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1703
1679
  import { Dynamic as Dynamic4 } from "solid-js/web";
1704
1680
  function BlocksWrapper(props) {
1705
1681
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1752,10 +1728,10 @@ function BlocksWrapper(props) {
1752
1728
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1753
1729
  function onUpdateFn_0() {
1754
1730
  }
1755
- createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1731
+ createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1756
1732
  return <>
1757
1733
  <Dynamic4
1758
- class={className() + " dynamic-450facf4"}
1734
+ class={className() + " dynamic-4d836538"}
1759
1735
  ref={blocksWrapperRef}
1760
1736
  builder-path={dataPath()}
1761
1737
  builder-parent-id={props.parent}
@@ -1767,7 +1743,7 @@ function BlocksWrapper(props) {
1767
1743
  {...props.BlocksWrapperProps}
1768
1744
  component={props.BlocksWrapper}
1769
1745
  >{props.children}</Dynamic4>
1770
- <style>{`.dynamic-450facf4 {
1746
+ <style>{`.dynamic-4d836538 {
1771
1747
  display: flex;
1772
1748
  flex-direction: column;
1773
1749
  align-items: stretch;
@@ -2146,7 +2122,7 @@ function SectionComponent(props) {
2146
2122
  var section_default = SectionComponent;
2147
2123
 
2148
2124
  // src/blocks/symbol/symbol.tsx
2149
- import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
2125
+ import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
2150
2126
 
2151
2127
  // src/components/content-variants/content-variants.tsx
2152
2128
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal20, createMemo as createMemo20 } from "solid-js";
@@ -3786,6 +3762,9 @@ function Tabs(props) {
3786
3762
  function activeTabContent(active) {
3787
3763
  return props.tabs && props.tabs[active].content;
3788
3764
  }
3765
+ function getTabStyle(index) {
3766
+ return index === activeTab() ? props.activeTabStyle : {};
3767
+ }
3789
3768
  function onClick(index) {
3790
3769
  if (index === activeTab() && props.collapsible) {
3791
3770
  setActiveTab(-1);
@@ -3807,9 +3786,7 @@ function Tabs(props) {
3807
3786
  return <span
3808
3787
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
3809
3788
  key={index}
3810
- style={{
3811
- ...activeTab() === index ? props.activeTabStyle : {}
3812
- }}
3789
+ style={getTabStyle(index)}
3813
3790
  onClick={(event) => onClick(index)}
3814
3791
  ><Blocks_default
3815
3792
  parent={props.builderBlock.id}
@@ -3895,7 +3872,7 @@ var componentInfo12 = {
3895
3872
  };
3896
3873
 
3897
3874
  // src/blocks/custom-code/custom-code.tsx
3898
- import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3875
+ import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3899
3876
  function CustomCode(props) {
3900
3877
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3901
3878
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3945,7 +3922,7 @@ function CustomCode(props) {
3945
3922
  runScripts();
3946
3923
  }
3947
3924
  }
3948
- createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3925
+ createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3949
3926
  return <><div
3950
3927
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3951
3928
  ref={elementRef}
@@ -3973,7 +3950,7 @@ var componentInfo13 = {
3973
3950
  };
3974
3951
 
3975
3952
  // src/blocks/embed/embed.tsx
3976
- import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3953
+ import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3977
3954
 
3978
3955
  // src/blocks/embed/helpers.ts
3979
3956
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -4015,8 +3992,8 @@ function Embed(props) {
4015
3992
  findAndRunScripts();
4016
3993
  }
4017
3994
  }
4018
- createEffect7(
4019
- on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3995
+ createEffect6(
3996
+ on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
4020
3997
  );
4021
3998
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
4022
3999
  }
@@ -4300,6 +4277,9 @@ function FormComponent(props) {
4300
4277
  function submissionState() {
4301
4278
  return isEditing() && props.previewState || formState();
4302
4279
  }
4280
+ function errorResponse(response) {
4281
+ return JSON.stringify(response, null, 2);
4282
+ }
4303
4283
  function onSubmit(event) {
4304
4284
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4305
4285
  if (props.sendSubmissionsTo === "zapier") {
@@ -4314,13 +4294,15 @@ function FormComponent(props) {
4314
4294
  const headers = props.customHeaders || {};
4315
4295
  let body;
4316
4296
  const formData = new FormData(el);
4317
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4297
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4298
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4299
+ ).map((el2) => {
4318
4300
  let value;
4319
4301
  const key = el2.name;
4320
4302
  if (el2 instanceof HTMLInputElement) {
4321
4303
  if (el2.type === "radio") {
4322
4304
  if (el2.checked) {
4323
- value = el2.name;
4305
+ value = el2.value;
4324
4306
  return {
4325
4307
  key,
4326
4308
  value
@@ -4512,14 +4494,14 @@ function FormComponent(props) {
4512
4494
  blocks={props.sendingMessage}
4513
4495
  context={props.builderContext}
4514
4496
  /></Show12>
4515
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4497
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-74261216">{errorResponse(responseData())}</pre></Show12>
4516
4498
  <Show12 when={submissionState() === "success"}><Blocks_default
4517
4499
  path="successMessage"
4518
4500
  blocks={props.successMessage}
4519
4501
  context={props.builderContext}
4520
4502
  /></Show12>
4521
4503
  </form>
4522
- <style>{`.pre-7430044e {
4504
+ <style>{`.pre-74261216 {
4523
4505
  padding: 10px;
4524
4506
  color: red;
4525
4507
  text-align: center;
@@ -5141,8 +5123,8 @@ var getUpdateVariantVisibilityScript = ({
5141
5123
  import {
5142
5124
  Show as Show14,
5143
5125
  onMount as onMount8,
5144
- on as on8,
5145
- createEffect as createEffect8,
5126
+ on as on7,
5127
+ createEffect as createEffect7,
5146
5128
  createMemo as createMemo17,
5147
5129
  createSignal as createSignal17
5148
5130
  } from "solid-js";
@@ -5154,7 +5136,7 @@ function getPreviewContent(_searchParams) {
5154
5136
  }
5155
5137
 
5156
5138
  // src/constants/sdk-version.ts
5157
- var SDK_VERSION = "4.2.0";
5139
+ var SDK_VERSION = "4.2.2";
5158
5140
 
5159
5141
  // src/helpers/sdk-headers.ts
5160
5142
  var getSdkHeaders = () => ({
@@ -5958,6 +5940,8 @@ var getWrapperClassName = (variationId) => {
5958
5940
  // src/components/content/components/enable-editor.tsx
5959
5941
  function EnableEditor(props) {
5960
5942
  const [hasExecuted, setHasExecuted] = createSignal17(false);
5943
+ const [prevData, setPrevData] = createSignal17(null);
5944
+ const [prevLocale, setPrevLocale] = createSignal17("");
5961
5945
  const [ContentWrapper, setContentWrapper] = createSignal17(
5962
5946
  props.contentWrapper || "div"
5963
5947
  );
@@ -6087,11 +6071,15 @@ function EnableEditor(props) {
6087
6071
  method: "GET"
6088
6072
  };
6089
6073
  logFetch(JSON.stringify(fetchRequestObj));
6090
- fetch(fetchRequestObj.url, {
6074
+ const fetchOptions = {
6091
6075
  method: fetchRequestObj.method,
6092
6076
  headers: fetchRequestObj.headers,
6093
6077
  body: fetchRequestObj.body
6094
- }).then((response) => response.json()).then((json) => {
6078
+ };
6079
+ if (fetchRequestObj.method === "GET") {
6080
+ delete fetchOptions.body;
6081
+ }
6082
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6095
6083
  mergeNewRootState({
6096
6084
  [key]: json
6097
6085
  });
@@ -6203,15 +6191,15 @@ function EnableEditor(props) {
6203
6191
  mergeNewContent(props.content);
6204
6192
  }
6205
6193
  }
6206
- createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6194
+ createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6207
6195
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo17(
6208
6196
  () => props.builderContextSignal.rootState
6209
6197
  );
6210
6198
  function onUpdateFn_1() {
6211
6199
  emitStateUpdate();
6212
6200
  }
6213
- createEffect8(
6214
- on8(
6201
+ createEffect7(
6202
+ on7(
6215
6203
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6216
6204
  onUpdateFn_1
6217
6205
  )
@@ -6219,19 +6207,27 @@ function EnableEditor(props) {
6219
6207
  const onUpdateFn_2_props_data = createMemo17(() => props.data);
6220
6208
  function onUpdateFn_2() {
6221
6209
  if (props.data) {
6210
+ if (prevData() === props.data) {
6211
+ return;
6212
+ }
6222
6213
  mergeNewRootState(props.data);
6214
+ setPrevData(props.data);
6223
6215
  }
6224
6216
  }
6225
- createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6217
+ createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6226
6218
  const onUpdateFn_3_props_locale = createMemo17(() => props.locale);
6227
6219
  function onUpdateFn_3() {
6228
6220
  if (props.locale) {
6221
+ if (prevLocale() === props.locale) {
6222
+ return;
6223
+ }
6229
6224
  mergeNewRootState({
6230
6225
  locale: props.locale
6231
6226
  });
6227
+ setPrevLocale(props.locale);
6232
6228
  }
6233
6229
  }
6234
- createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6230
+ createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6235
6231
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6236
6232
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6237
6233
  ><Dynamic5
@@ -6591,6 +6587,9 @@ function Symbol(props) {
6591
6587
  const contentWrapper = createMemo21(() => {
6592
6588
  return "div";
6593
6589
  });
6590
+ const customComponents = createMemo21(() => {
6591
+ return Object.values(props.builderComponents);
6592
+ });
6594
6593
  const className = createMemo21(() => {
6595
6594
  return [
6596
6595
  ...[props.attributes[getClassPropName()]],
@@ -6618,7 +6617,7 @@ function Symbol(props) {
6618
6617
  function onUpdateFn_0() {
6619
6618
  setContent();
6620
6619
  }
6621
- createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6620
+ createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6622
6621
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6623
6622
  nonce={props.builderContext.nonce}
6624
6623
  isNestedRender={true}
@@ -6628,7 +6627,7 @@ function Symbol(props) {
6628
6627
  ...props.builderContext.context,
6629
6628
  symbolId: props.builderBlock?.id
6630
6629
  }}
6631
- customComponents={Object.values(props.builderComponents)}
6630
+ customComponents={customComponents()}
6632
6631
  data={{
6633
6632
  ...props.symbol?.data,
6634
6633
  ...props.builderContext.localState,
@@ -6672,6 +6671,18 @@ function register(type, info) {
6672
6671
  }
6673
6672
  }
6674
6673
  }
6674
+ function registerAction(action) {
6675
+ if (isBrowser()) {
6676
+ const actionClone = JSON.parse(JSON.stringify(action));
6677
+ if (action.action) {
6678
+ actionClone.action = action.action.toString();
6679
+ }
6680
+ window.parent?.postMessage({
6681
+ type: "builder.registerAction",
6682
+ data: actionClone
6683
+ }, "*");
6684
+ }
6685
+ }
6675
6686
 
6676
6687
  // src/functions/set-editor-settings.ts
6677
6688
  var settings = {};
@@ -6728,6 +6739,7 @@ export {
6728
6739
  isEditing,
6729
6740
  isPreviewing,
6730
6741
  register,
6742
+ registerAction,
6731
6743
  setClientUserAttributes,
6732
6744
  setEditorSettings,
6733
6745
  subscribeToEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",