@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/dev.js CHANGED
@@ -1489,11 +1489,6 @@ var getWrapperProps = ({
1489
1489
  function ComponentRef(props) {
1490
1490
  createSignal(false);
1491
1491
  const [Wrapper, setWrapper] = createSignal(props.isInteractive ? interactive_element_default : props.componentRef);
1492
- const onUpdateFn_0_props_componentOptions = createMemo(() => props.componentOptions);
1493
- const onUpdateFn_0_props_blockChildren = createMemo(() => props.blockChildren);
1494
- function onUpdateFn_0() {
1495
- }
1496
- createEffect(on(() => [onUpdateFn_0_props_componentOptions(), onUpdateFn_0_props_blockChildren()], onUpdateFn_0));
1497
1492
  return createComponent(Show, {
1498
1493
  get when() {
1499
1494
  return props.componentRef;
@@ -1513,25 +1508,32 @@ function ComponentRef(props) {
1513
1508
  return Wrapper();
1514
1509
  },
1515
1510
  get children() {
1516
- return createComponent(For, {
1517
- get each() {
1518
- return props.blockChildren;
1511
+ return createComponent(Show, {
1512
+ get when() {
1513
+ return props.componentRef;
1519
1514
  },
1520
- children: (child, _index) => {
1521
- _index();
1522
- return createComponent(block_default, {
1523
- get key() {
1524
- return child.id;
1525
- },
1526
- block: child,
1527
- get context() {
1528
- return props.context;
1529
- },
1530
- get registeredComponents() {
1531
- return props.registeredComponents;
1515
+ get children() {
1516
+ return createComponent(For, {
1517
+ get each() {
1518
+ return props.blockChildren;
1532
1519
  },
1533
- get linkComponent() {
1534
- return props.linkComponent;
1520
+ children: (child, _index) => {
1521
+ _index();
1522
+ return createComponent(block_default, {
1523
+ get key() {
1524
+ return child.id;
1525
+ },
1526
+ block: child,
1527
+ get context() {
1528
+ return props.context;
1529
+ },
1530
+ get registeredComponents() {
1531
+ return props.registeredComponents;
1532
+ },
1533
+ get linkComponent() {
1534
+ return props.linkComponent;
1535
+ }
1536
+ });
1535
1537
  }
1536
1538
  });
1537
1539
  }
@@ -1838,7 +1840,7 @@ function Block(props) {
1838
1840
  });
1839
1841
  }
1840
1842
  var block_default = Block;
1841
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
1843
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4d836538 {
1842
1844
  display: flex;
1843
1845
  flex-direction: column;
1844
1846
  align-items: stretch;
@@ -1887,7 +1889,7 @@ function BlocksWrapper(props) {
1887
1889
  createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1888
1890
  return [createComponent(Dynamic, mergeProps({
1889
1891
  get ["class"]() {
1890
- return className() + " dynamic-450facf4";
1892
+ return className() + " dynamic-4d836538";
1891
1893
  },
1892
1894
  ref(r$) {
1893
1895
  const _ref$ = blocksWrapperRef;
@@ -4142,6 +4144,9 @@ function Tabs(props) {
4142
4144
  function activeTabContent(active) {
4143
4145
  return props.tabs && props.tabs[active].content;
4144
4146
  }
4147
+ function getTabStyle(index) {
4148
+ return index === activeTab() ? props.activeTabStyle : {};
4149
+ }
4145
4150
  function onClick(index) {
4146
4151
  if (index === activeTab() && props.collapsible) {
4147
4152
  setActiveTab(-1);
@@ -4183,9 +4188,7 @@ function Tabs(props) {
4183
4188
  }
4184
4189
  }));
4185
4190
  effect((_p$) => {
4186
- const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = {
4187
- ...activeTab() === index ? props.activeTabStyle : {}
4188
- };
4191
+ const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = getTabStyle(index);
4189
4192
  _v$ !== _p$._v$ && className(_el$4, _p$._v$ = _v$);
4190
4193
  _p$._v$2 = style(_el$4, _v$2, _p$._v$2);
4191
4194
  return _p$;
@@ -4681,9 +4684,9 @@ function logFetch(url) {
4681
4684
  }
4682
4685
 
4683
4686
  // src/blocks/form/form/form.tsx
4684
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4687
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-74261216">`);
4685
4688
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4686
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4689
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-74261216 {
4687
4690
  padding: 10px;
4688
4691
  color: red;
4689
4692
  text-align: center;
@@ -4706,6 +4709,9 @@ function FormComponent(props) {
4706
4709
  function submissionState() {
4707
4710
  return isEditing() && props.previewState || formState();
4708
4711
  }
4712
+ function errorResponse(response) {
4713
+ return JSON.stringify(response, null, 2);
4714
+ }
4709
4715
  function onSubmit(event) {
4710
4716
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4711
4717
  if (props.sendSubmissionsTo === "zapier") {
@@ -4720,13 +4726,13 @@ function FormComponent(props) {
4720
4726
  const headers = props.customHeaders || {};
4721
4727
  let body;
4722
4728
  const formData = new FormData(el);
4723
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4729
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
4724
4730
  let value;
4725
4731
  const key = el2.name;
4726
4732
  if (el2 instanceof HTMLInputElement) {
4727
4733
  if (el2.type === "radio") {
4728
4734
  if (el2.checked) {
4729
- value = el2.name;
4735
+ value = el2.value;
4730
4736
  return {
4731
4737
  key,
4732
4738
  value
@@ -4954,7 +4960,7 @@ function FormComponent(props) {
4954
4960
  },
4955
4961
  get children() {
4956
4962
  const _el$2 = _tmpl$15();
4957
- insert(_el$2, () => JSON.stringify(responseData(), null, 2));
4963
+ insert(_el$2, () => errorResponse(responseData()));
4958
4964
  return _el$2;
4959
4965
  }
4960
4966
  }), null);
@@ -5671,7 +5677,7 @@ function getPreviewContent(_searchParams) {
5671
5677
  }
5672
5678
 
5673
5679
  // src/constants/sdk-version.ts
5674
- var SDK_VERSION = "4.2.0";
5680
+ var SDK_VERSION = "4.2.2";
5675
5681
 
5676
5682
  // src/helpers/sdk-headers.ts
5677
5683
  var getSdkHeaders = () => ({
@@ -6480,6 +6486,8 @@ var getWrapperClassName = (variationId) => {
6480
6486
  // src/components/content/components/enable-editor.tsx
6481
6487
  function EnableEditor(props) {
6482
6488
  createSignal(false);
6489
+ const [prevData, setPrevData] = createSignal(null);
6490
+ const [prevLocale, setPrevLocale] = createSignal("");
6483
6491
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6484
6492
  const [httpReqsData, setHttpReqsData] = createSignal({});
6485
6493
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6604,11 +6612,15 @@ function EnableEditor(props) {
6604
6612
  method: "GET"
6605
6613
  };
6606
6614
  logFetch(JSON.stringify(fetchRequestObj));
6607
- fetch(fetchRequestObj.url, {
6615
+ const fetchOptions = {
6608
6616
  method: fetchRequestObj.method,
6609
6617
  headers: fetchRequestObj.headers,
6610
6618
  body: fetchRequestObj.body
6611
- }).then((response) => response.json()).then((json) => {
6619
+ };
6620
+ if (fetchRequestObj.method === "GET") {
6621
+ delete fetchOptions.body;
6622
+ }
6623
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6612
6624
  mergeNewRootState({
6613
6625
  [key]: json
6614
6626
  });
@@ -6717,16 +6729,24 @@ function EnableEditor(props) {
6717
6729
  const onUpdateFn_2_props_data = createMemo(() => props.data);
6718
6730
  function onUpdateFn_2() {
6719
6731
  if (props.data) {
6732
+ if (prevData() === props.data) {
6733
+ return;
6734
+ }
6720
6735
  mergeNewRootState(props.data);
6736
+ setPrevData(props.data);
6721
6737
  }
6722
6738
  }
6723
6739
  createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6724
6740
  const onUpdateFn_3_props_locale = createMemo(() => props.locale);
6725
6741
  function onUpdateFn_3() {
6726
6742
  if (props.locale) {
6743
+ if (prevLocale() === props.locale) {
6744
+ return;
6745
+ }
6727
6746
  mergeNewRootState({
6728
6747
  locale: props.locale
6729
6748
  });
6749
+ setPrevLocale(props.locale);
6730
6750
  }
6731
6751
  }
6732
6752
  createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
@@ -7276,6 +7296,9 @@ function Symbol(props) {
7276
7296
  const contentWrapper = createMemo(() => {
7277
7297
  return "div";
7278
7298
  });
7299
+ const customComponents = createMemo(() => {
7300
+ return Object.values(props.builderComponents);
7301
+ });
7279
7302
  const className = createMemo(() => {
7280
7303
  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(" ");
7281
7304
  });
@@ -7324,7 +7347,7 @@ function Symbol(props) {
7324
7347
  };
7325
7348
  },
7326
7349
  get customComponents() {
7327
- return Object.values(props.builderComponents);
7350
+ return customComponents();
7328
7351
  },
7329
7352
  get data() {
7330
7353
  return {
@@ -7386,6 +7409,18 @@ function register(type, info) {
7386
7409
  }
7387
7410
  }
7388
7411
  }
7412
+ function registerAction(action) {
7413
+ if (isBrowser()) {
7414
+ const actionClone = JSON.parse(JSON.stringify(action));
7415
+ if (action.action) {
7416
+ actionClone.action = action.action.toString();
7417
+ }
7418
+ window.parent?.postMessage({
7419
+ type: "builder.registerAction",
7420
+ data: actionClone
7421
+ }, "*");
7422
+ }
7423
+ }
7389
7424
 
7390
7425
  // src/functions/set-editor-settings.ts
7391
7426
  var settings = {};
@@ -7422,4 +7457,4 @@ var fetchBuilderProps = async (_args) => {
7422
7457
  };
7423
7458
  };
7424
7459
 
7425
- 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 };
7460
+ 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 };
package/lib/node/dev.jsx CHANGED
@@ -1371,14 +1371,7 @@ function BlockWrapper(props) {
1371
1371
  var Block_wrapper_default = BlockWrapper;
1372
1372
 
1373
1373
  // src/components/block/components/component-ref/component-ref.tsx
1374
- import {
1375
- Show as Show4,
1376
- For,
1377
- on as on2,
1378
- createEffect as createEffect2,
1379
- createMemo as createMemo3,
1380
- createSignal as createSignal3
1381
- } from "solid-js";
1374
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1382
1375
  import { Dynamic as Dynamic3 } from "solid-js/web";
1383
1376
 
1384
1377
  // src/components/block/components/interactive-element.tsx
@@ -1485,23 +1478,6 @@ function ComponentRef(props) {
1485
1478
  const [Wrapper, setWrapper] = createSignal3(
1486
1479
  props.isInteractive ? interactive_element_default : props.componentRef
1487
1480
  );
1488
- const onUpdateFn_0_props_componentOptions = createMemo3(
1489
- () => props.componentOptions
1490
- );
1491
- const onUpdateFn_0_props_blockChildren = createMemo3(
1492
- () => props.blockChildren
1493
- );
1494
- function onUpdateFn_0() {
1495
- }
1496
- createEffect2(
1497
- on2(
1498
- () => [
1499
- onUpdateFn_0_props_componentOptions(),
1500
- onUpdateFn_0_props_blockChildren()
1501
- ],
1502
- onUpdateFn_0
1503
- )
1504
- );
1505
1481
  return <><Show4 when={props.componentRef}><Dynamic3
1506
1482
  {...getWrapperProps({
1507
1483
  componentOptions: props.componentOptions,
@@ -1514,7 +1490,7 @@ function ComponentRef(props) {
1514
1490
  contextValue: props.context
1515
1491
  })}
1516
1492
  component={Wrapper()}
1517
- ><For each={props.blockChildren}>{(child, _index) => {
1493
+ ><Show4 when={props.componentRef}><For each={props.blockChildren}>{(child, _index) => {
1518
1494
  const index = _index();
1519
1495
  return <Block_default
1520
1496
  key={child.id}
@@ -1523,12 +1499,12 @@ function ComponentRef(props) {
1523
1499
  registeredComponents={props.registeredComponents}
1524
1500
  linkComponent={props.linkComponent}
1525
1501
  />;
1526
- }}</For></Dynamic3></Show4></>;
1502
+ }}</For></Show4></Dynamic3></Show4></>;
1527
1503
  }
1528
1504
  var Component_ref_default = ComponentRef;
1529
1505
 
1530
1506
  // src/components/block/components/repeated-block.tsx
1531
- import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1507
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1532
1508
  function RepeatedBlock(props) {
1533
1509
  const [store, setStore] = createSignal4(props.repeatContext);
1534
1510
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1537,7 +1513,7 @@ function RepeatedBlock(props) {
1537
1513
  function onUpdateFn_0() {
1538
1514
  setStore(props.repeatContext);
1539
1515
  }
1540
- createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1516
+ createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1541
1517
  return <><builder_context_default.Provider value={store()}><Block_default
1542
1518
  block={props.block}
1543
1519
  context={store()}
@@ -1706,7 +1682,7 @@ function Block(props) {
1706
1682
  var Block_default = Block;
1707
1683
 
1708
1684
  // src/components/blocks/blocks-wrapper.tsx
1709
- import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1685
+ import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1710
1686
  import { Dynamic as Dynamic4 } from "solid-js/web";
1711
1687
  function BlocksWrapper(props) {
1712
1688
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1759,10 +1735,10 @@ function BlocksWrapper(props) {
1759
1735
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1760
1736
  function onUpdateFn_0() {
1761
1737
  }
1762
- createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1738
+ createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1763
1739
  return <>
1764
1740
  <Dynamic4
1765
- class={className() + " dynamic-450facf4"}
1741
+ class={className() + " dynamic-4d836538"}
1766
1742
  ref={blocksWrapperRef}
1767
1743
  builder-path={dataPath()}
1768
1744
  builder-parent-id={props.parent}
@@ -1774,7 +1750,7 @@ function BlocksWrapper(props) {
1774
1750
  {...props.BlocksWrapperProps}
1775
1751
  component={props.BlocksWrapper}
1776
1752
  >{props.children}</Dynamic4>
1777
- <style>{`.dynamic-450facf4 {
1753
+ <style>{`.dynamic-4d836538 {
1778
1754
  display: flex;
1779
1755
  flex-direction: column;
1780
1756
  align-items: stretch;
@@ -2154,7 +2130,7 @@ function SectionComponent(props) {
2154
2130
  var section_default = SectionComponent;
2155
2131
 
2156
2132
  // src/blocks/symbol/symbol.tsx
2157
- import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
2133
+ import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
2158
2134
 
2159
2135
  // src/components/content-variants/content-variants.tsx
2160
2136
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal20, createMemo as createMemo20 } from "solid-js";
@@ -3795,6 +3771,9 @@ function Tabs(props) {
3795
3771
  function activeTabContent(active) {
3796
3772
  return props.tabs && props.tabs[active].content;
3797
3773
  }
3774
+ function getTabStyle(index) {
3775
+ return index === activeTab() ? props.activeTabStyle : {};
3776
+ }
3798
3777
  function onClick(index) {
3799
3778
  if (index === activeTab() && props.collapsible) {
3800
3779
  setActiveTab(-1);
@@ -3816,9 +3795,7 @@ function Tabs(props) {
3816
3795
  return <span
3817
3796
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
3818
3797
  key={index}
3819
- style={{
3820
- ...activeTab() === index ? props.activeTabStyle : {}
3821
- }}
3798
+ style={getTabStyle(index)}
3822
3799
  onClick={(event) => onClick(index)}
3823
3800
  ><Blocks_default
3824
3801
  parent={props.builderBlock.id}
@@ -3904,7 +3881,7 @@ var componentInfo12 = {
3904
3881
  };
3905
3882
 
3906
3883
  // src/blocks/custom-code/custom-code.tsx
3907
- import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3884
+ import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3908
3885
  function CustomCode(props) {
3909
3886
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3910
3887
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3954,7 +3931,7 @@ function CustomCode(props) {
3954
3931
  runScripts();
3955
3932
  }
3956
3933
  }
3957
- createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3934
+ createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3958
3935
  return <><div
3959
3936
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3960
3937
  ref={elementRef}
@@ -3982,7 +3959,7 @@ var componentInfo13 = {
3982
3959
  };
3983
3960
 
3984
3961
  // src/blocks/embed/embed.tsx
3985
- import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3962
+ import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3986
3963
 
3987
3964
  // src/blocks/embed/helpers.ts
3988
3965
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -4024,8 +4001,8 @@ function Embed(props) {
4024
4001
  findAndRunScripts();
4025
4002
  }
4026
4003
  }
4027
- createEffect7(
4028
- on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
4004
+ createEffect6(
4005
+ on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
4029
4006
  );
4030
4007
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
4031
4008
  }
@@ -4309,6 +4286,9 @@ function FormComponent(props) {
4309
4286
  function submissionState() {
4310
4287
  return isEditing() && props.previewState || formState();
4311
4288
  }
4289
+ function errorResponse(response) {
4290
+ return JSON.stringify(response, null, 2);
4291
+ }
4312
4292
  function onSubmit(event) {
4313
4293
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4314
4294
  if (props.sendSubmissionsTo === "zapier") {
@@ -4323,13 +4303,15 @@ function FormComponent(props) {
4323
4303
  const headers = props.customHeaders || {};
4324
4304
  let body;
4325
4305
  const formData = new FormData(el);
4326
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4306
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4307
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4308
+ ).map((el2) => {
4327
4309
  let value;
4328
4310
  const key = el2.name;
4329
4311
  if (el2 instanceof HTMLInputElement) {
4330
4312
  if (el2.type === "radio") {
4331
4313
  if (el2.checked) {
4332
- value = el2.name;
4314
+ value = el2.value;
4333
4315
  return {
4334
4316
  key,
4335
4317
  value
@@ -4522,14 +4504,14 @@ function FormComponent(props) {
4522
4504
  blocks={props.sendingMessage}
4523
4505
  context={props.builderContext}
4524
4506
  /></Show12>
4525
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4507
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-74261216">{errorResponse(responseData())}</pre></Show12>
4526
4508
  <Show12 when={submissionState() === "success"}><Blocks_default
4527
4509
  path="successMessage"
4528
4510
  blocks={props.successMessage}
4529
4511
  context={props.builderContext}
4530
4512
  /></Show12>
4531
4513
  </form>
4532
- <style>{`.pre-7430044e {
4514
+ <style>{`.pre-74261216 {
4533
4515
  padding: 10px;
4534
4516
  color: red;
4535
4517
  text-align: center;
@@ -5152,8 +5134,8 @@ var getUpdateVariantVisibilityScript = ({
5152
5134
  import {
5153
5135
  Show as Show14,
5154
5136
  onMount as onMount8,
5155
- on as on8,
5156
- createEffect as createEffect8,
5137
+ on as on7,
5138
+ createEffect as createEffect7,
5157
5139
  createMemo as createMemo17,
5158
5140
  createSignal as createSignal17
5159
5141
  } from "solid-js";
@@ -5165,7 +5147,7 @@ function getPreviewContent(_searchParams) {
5165
5147
  }
5166
5148
 
5167
5149
  // src/constants/sdk-version.ts
5168
- var SDK_VERSION = "4.2.0";
5150
+ var SDK_VERSION = "4.2.2";
5169
5151
 
5170
5152
  // src/helpers/sdk-headers.ts
5171
5153
  var getSdkHeaders = () => ({
@@ -5974,6 +5956,8 @@ var getWrapperClassName = (variationId) => {
5974
5956
  // src/components/content/components/enable-editor.tsx
5975
5957
  function EnableEditor(props) {
5976
5958
  const [hasExecuted, setHasExecuted] = createSignal17(false);
5959
+ const [prevData, setPrevData] = createSignal17(null);
5960
+ const [prevLocale, setPrevLocale] = createSignal17("");
5977
5961
  const [ContentWrapper, setContentWrapper] = createSignal17(
5978
5962
  props.contentWrapper || "div"
5979
5963
  );
@@ -6103,11 +6087,15 @@ function EnableEditor(props) {
6103
6087
  method: "GET"
6104
6088
  };
6105
6089
  logFetch(JSON.stringify(fetchRequestObj));
6106
- fetch(fetchRequestObj.url, {
6090
+ const fetchOptions = {
6107
6091
  method: fetchRequestObj.method,
6108
6092
  headers: fetchRequestObj.headers,
6109
6093
  body: fetchRequestObj.body
6110
- }).then((response) => response.json()).then((json) => {
6094
+ };
6095
+ if (fetchRequestObj.method === "GET") {
6096
+ delete fetchOptions.body;
6097
+ }
6098
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6111
6099
  mergeNewRootState({
6112
6100
  [key]: json
6113
6101
  });
@@ -6224,15 +6212,15 @@ function EnableEditor(props) {
6224
6212
  mergeNewContent(props.content);
6225
6213
  }
6226
6214
  }
6227
- createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6215
+ createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6228
6216
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo17(
6229
6217
  () => props.builderContextSignal.rootState
6230
6218
  );
6231
6219
  function onUpdateFn_1() {
6232
6220
  emitStateUpdate();
6233
6221
  }
6234
- createEffect8(
6235
- on8(
6222
+ createEffect7(
6223
+ on7(
6236
6224
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6237
6225
  onUpdateFn_1
6238
6226
  )
@@ -6240,19 +6228,27 @@ function EnableEditor(props) {
6240
6228
  const onUpdateFn_2_props_data = createMemo17(() => props.data);
6241
6229
  function onUpdateFn_2() {
6242
6230
  if (props.data) {
6231
+ if (prevData() === props.data) {
6232
+ return;
6233
+ }
6243
6234
  mergeNewRootState(props.data);
6235
+ setPrevData(props.data);
6244
6236
  }
6245
6237
  }
6246
- createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6238
+ createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6247
6239
  const onUpdateFn_3_props_locale = createMemo17(() => props.locale);
6248
6240
  function onUpdateFn_3() {
6249
6241
  if (props.locale) {
6242
+ if (prevLocale() === props.locale) {
6243
+ return;
6244
+ }
6250
6245
  mergeNewRootState({
6251
6246
  locale: props.locale
6252
6247
  });
6248
+ setPrevLocale(props.locale);
6253
6249
  }
6254
6250
  }
6255
- createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6251
+ createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6256
6252
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6257
6253
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6258
6254
  ><Dynamic5
@@ -6612,6 +6608,9 @@ function Symbol(props) {
6612
6608
  const contentWrapper = createMemo21(() => {
6613
6609
  return "div";
6614
6610
  });
6611
+ const customComponents = createMemo21(() => {
6612
+ return Object.values(props.builderComponents);
6613
+ });
6615
6614
  const className = createMemo21(() => {
6616
6615
  return [
6617
6616
  ...[props.attributes[getClassPropName()]],
@@ -6639,7 +6638,7 @@ function Symbol(props) {
6639
6638
  function onUpdateFn_0() {
6640
6639
  setContent();
6641
6640
  }
6642
- createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6641
+ createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6643
6642
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6644
6643
  nonce={props.builderContext.nonce}
6645
6644
  isNestedRender={true}
@@ -6649,7 +6648,7 @@ function Symbol(props) {
6649
6648
  ...props.builderContext.context,
6650
6649
  symbolId: props.builderBlock?.id
6651
6650
  }}
6652
- customComponents={Object.values(props.builderComponents)}
6651
+ customComponents={customComponents()}
6653
6652
  data={{
6654
6653
  ...props.symbol?.data,
6655
6654
  ...props.builderContext.localState,
@@ -6694,6 +6693,18 @@ function register(type, info) {
6694
6693
  }
6695
6694
  }
6696
6695
  }
6696
+ function registerAction(action) {
6697
+ if (isBrowser()) {
6698
+ const actionClone = JSON.parse(JSON.stringify(action));
6699
+ if (action.action) {
6700
+ actionClone.action = action.action.toString();
6701
+ }
6702
+ window.parent?.postMessage({
6703
+ type: "builder.registerAction",
6704
+ data: actionClone
6705
+ }, "*");
6706
+ }
6707
+ }
6697
6708
 
6698
6709
  // src/functions/set-editor-settings.ts
6699
6710
  var settings = {};
@@ -6750,6 +6761,7 @@ export {
6750
6761
  isEditing,
6751
6762
  isPreviewing,
6752
6763
  register,
6764
+ registerAction,
6753
6765
  setClientUserAttributes,
6754
6766
  setEditorSettings,
6755
6767
  subscribeToEditor,