@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.
@@ -1311,11 +1311,6 @@ var getWrapperProps = ({
1311
1311
  function ComponentRef(props) {
1312
1312
  createSignal(false);
1313
1313
  const [Wrapper, setWrapper] = createSignal(props.isInteractive ? interactive_element_default : props.componentRef);
1314
- const onUpdateFn_0_props_componentOptions = createMemo(() => props.componentOptions);
1315
- const onUpdateFn_0_props_blockChildren = createMemo(() => props.blockChildren);
1316
- function onUpdateFn_0() {
1317
- }
1318
- createEffect(on(() => [onUpdateFn_0_props_componentOptions(), onUpdateFn_0_props_blockChildren()], onUpdateFn_0));
1319
1314
  return createComponent(Show, {
1320
1315
  get when() {
1321
1316
  return props.componentRef;
@@ -1335,25 +1330,32 @@ function ComponentRef(props) {
1335
1330
  return Wrapper();
1336
1331
  },
1337
1332
  get children() {
1338
- return createComponent(For, {
1339
- get each() {
1340
- return props.blockChildren;
1333
+ return createComponent(Show, {
1334
+ get when() {
1335
+ return props.componentRef;
1341
1336
  },
1342
- children: (child, _index) => {
1343
- _index();
1344
- return createComponent(block_default, {
1345
- get key() {
1346
- return child.id;
1347
- },
1348
- block: child,
1349
- get context() {
1350
- return props.context;
1351
- },
1352
- get registeredComponents() {
1353
- return props.registeredComponents;
1337
+ get children() {
1338
+ return createComponent(For, {
1339
+ get each() {
1340
+ return props.blockChildren;
1354
1341
  },
1355
- get linkComponent() {
1356
- return props.linkComponent;
1342
+ children: (child, _index) => {
1343
+ _index();
1344
+ return createComponent(block_default, {
1345
+ get key() {
1346
+ return child.id;
1347
+ },
1348
+ block: child,
1349
+ get context() {
1350
+ return props.context;
1351
+ },
1352
+ get registeredComponents() {
1353
+ return props.registeredComponents;
1354
+ },
1355
+ get linkComponent() {
1356
+ return props.linkComponent;
1357
+ }
1358
+ });
1357
1359
  }
1358
1360
  });
1359
1361
  }
@@ -1660,7 +1662,7 @@ function Block(props) {
1660
1662
  });
1661
1663
  }
1662
1664
  var block_default = Block;
1663
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
1665
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4d836538 {
1664
1666
  display: flex;
1665
1667
  flex-direction: column;
1666
1668
  align-items: stretch;
@@ -1709,7 +1711,7 @@ function BlocksWrapper(props) {
1709
1711
  createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1710
1712
  return [createComponent(Dynamic, mergeProps({
1711
1713
  get ["class"]() {
1712
- return className() + " dynamic-450facf4";
1714
+ return className() + " dynamic-4d836538";
1713
1715
  },
1714
1716
  ref(r$) {
1715
1717
  const _ref$ = blocksWrapperRef;
@@ -3962,6 +3964,9 @@ function Tabs(props) {
3962
3964
  function activeTabContent(active) {
3963
3965
  return props.tabs && props.tabs[active].content;
3964
3966
  }
3967
+ function getTabStyle(index) {
3968
+ return index === activeTab() ? props.activeTabStyle : {};
3969
+ }
3965
3970
  function onClick(index) {
3966
3971
  if (index === activeTab() && props.collapsible) {
3967
3972
  setActiveTab(-1);
@@ -4003,9 +4008,7 @@ function Tabs(props) {
4003
4008
  }
4004
4009
  }));
4005
4010
  effect((_p$) => {
4006
- const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = {
4007
- ...activeTab() === index ? props.activeTabStyle : {}
4008
- };
4011
+ const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = getTabStyle(index);
4009
4012
  _v$ !== _p$._v$ && className(_el$4, _p$._v$ = _v$);
4010
4013
  _p$._v$2 = style(_el$4, _v$2, _p$._v$2);
4011
4014
  return _p$;
@@ -4501,9 +4504,9 @@ function logFetch(url) {
4501
4504
  }
4502
4505
 
4503
4506
  // src/blocks/form/form/form.tsx
4504
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4507
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-74261216">`);
4505
4508
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4506
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4509
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-74261216 {
4507
4510
  padding: 10px;
4508
4511
  color: red;
4509
4512
  text-align: center;
@@ -4526,6 +4529,9 @@ function FormComponent(props) {
4526
4529
  function submissionState() {
4527
4530
  return isEditing() && props.previewState || formState();
4528
4531
  }
4532
+ function errorResponse(response) {
4533
+ return JSON.stringify(response, null, 2);
4534
+ }
4529
4535
  function onSubmit(event) {
4530
4536
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4531
4537
  if (props.sendSubmissionsTo === "zapier") {
@@ -4540,13 +4546,13 @@ function FormComponent(props) {
4540
4546
  const headers = props.customHeaders || {};
4541
4547
  let body;
4542
4548
  const formData = new FormData(el);
4543
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4549
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
4544
4550
  let value;
4545
4551
  const key = el2.name;
4546
4552
  if (el2 instanceof HTMLInputElement) {
4547
4553
  if (el2.type === "radio") {
4548
4554
  if (el2.checked) {
4549
- value = el2.name;
4555
+ value = el2.value;
4550
4556
  return {
4551
4557
  key,
4552
4558
  value
@@ -4773,7 +4779,7 @@ function FormComponent(props) {
4773
4779
  },
4774
4780
  get children() {
4775
4781
  const _el$2 = _tmpl$15();
4776
- insert(_el$2, () => JSON.stringify(responseData(), null, 2));
4782
+ insert(_el$2, () => errorResponse(responseData()));
4777
4783
  return _el$2;
4778
4784
  }
4779
4785
  }), null);
@@ -5489,7 +5495,7 @@ function getPreviewContent(_searchParams) {
5489
5495
  }
5490
5496
 
5491
5497
  // src/constants/sdk-version.ts
5492
- var SDK_VERSION = "4.2.0";
5498
+ var SDK_VERSION = "4.2.2";
5493
5499
 
5494
5500
  // src/helpers/sdk-headers.ts
5495
5501
  var getSdkHeaders = () => ({
@@ -6293,6 +6299,8 @@ var getWrapperClassName = (variationId) => {
6293
6299
  // src/components/content/components/enable-editor.tsx
6294
6300
  function EnableEditor(props) {
6295
6301
  createSignal(false);
6302
+ const [prevData, setPrevData] = createSignal(null);
6303
+ const [prevLocale, setPrevLocale] = createSignal("");
6296
6304
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6297
6305
  const [httpReqsData, setHttpReqsData] = createSignal({});
6298
6306
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6417,11 +6425,15 @@ function EnableEditor(props) {
6417
6425
  method: "GET"
6418
6426
  };
6419
6427
  logFetch(JSON.stringify(fetchRequestObj));
6420
- fetch(fetchRequestObj.url, {
6428
+ const fetchOptions = {
6421
6429
  method: fetchRequestObj.method,
6422
6430
  headers: fetchRequestObj.headers,
6423
6431
  body: fetchRequestObj.body
6424
- }).then((response) => response.json()).then((json) => {
6432
+ };
6433
+ if (fetchRequestObj.method === "GET") {
6434
+ delete fetchOptions.body;
6435
+ }
6436
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6425
6437
  mergeNewRootState({
6426
6438
  [key]: json
6427
6439
  });
@@ -6529,16 +6541,24 @@ function EnableEditor(props) {
6529
6541
  const onUpdateFn_2_props_data = createMemo(() => props.data);
6530
6542
  function onUpdateFn_2() {
6531
6543
  if (props.data) {
6544
+ if (prevData() === props.data) {
6545
+ return;
6546
+ }
6532
6547
  mergeNewRootState(props.data);
6548
+ setPrevData(props.data);
6533
6549
  }
6534
6550
  }
6535
6551
  createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6536
6552
  const onUpdateFn_3_props_locale = createMemo(() => props.locale);
6537
6553
  function onUpdateFn_3() {
6538
6554
  if (props.locale) {
6555
+ if (prevLocale() === props.locale) {
6556
+ return;
6557
+ }
6539
6558
  mergeNewRootState({
6540
6559
  locale: props.locale
6541
6560
  });
6561
+ setPrevLocale(props.locale);
6542
6562
  }
6543
6563
  }
6544
6564
  createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
@@ -7088,6 +7108,9 @@ function Symbol(props) {
7088
7108
  const contentWrapper = createMemo(() => {
7089
7109
  return "div";
7090
7110
  });
7111
+ const customComponents = createMemo(() => {
7112
+ return Object.values(props.builderComponents);
7113
+ });
7091
7114
  const className = createMemo(() => {
7092
7115
  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(" ");
7093
7116
  });
@@ -7136,7 +7159,7 @@ function Symbol(props) {
7136
7159
  };
7137
7160
  },
7138
7161
  get customComponents() {
7139
- return Object.values(props.builderComponents);
7162
+ return customComponents();
7140
7163
  },
7141
7164
  get data() {
7142
7165
  return {
@@ -7197,6 +7220,18 @@ function register(type, info) {
7197
7220
  }
7198
7221
  }
7199
7222
  }
7223
+ function registerAction(action) {
7224
+ if (isBrowser()) {
7225
+ const actionClone = JSON.parse(JSON.stringify(action));
7226
+ if (action.action) {
7227
+ actionClone.action = action.action.toString();
7228
+ }
7229
+ window.parent?.postMessage({
7230
+ type: "builder.registerAction",
7231
+ data: actionClone
7232
+ }, "*");
7233
+ }
7234
+ }
7200
7235
 
7201
7236
  // src/functions/set-editor-settings.ts
7202
7237
  var settings = {};
@@ -7233,4 +7268,4 @@ var fetchBuilderProps = async (_args) => {
7233
7268
  };
7234
7269
  };
7235
7270
 
7236
- 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 };
7271
+ 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 };
@@ -1193,14 +1193,7 @@ function BlockWrapper(props) {
1193
1193
  var Block_wrapper_default = BlockWrapper;
1194
1194
 
1195
1195
  // src/components/block/components/component-ref/component-ref.tsx
1196
- import {
1197
- Show as Show4,
1198
- For,
1199
- on as on2,
1200
- createEffect as createEffect2,
1201
- createMemo as createMemo3,
1202
- createSignal as createSignal3
1203
- } from "solid-js";
1196
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1204
1197
  import { Dynamic as Dynamic3 } from "solid-js/web";
1205
1198
 
1206
1199
  // src/components/block/components/interactive-element.tsx
@@ -1307,23 +1300,6 @@ function ComponentRef(props) {
1307
1300
  const [Wrapper, setWrapper] = createSignal3(
1308
1301
  props.isInteractive ? interactive_element_default : props.componentRef
1309
1302
  );
1310
- const onUpdateFn_0_props_componentOptions = createMemo3(
1311
- () => props.componentOptions
1312
- );
1313
- const onUpdateFn_0_props_blockChildren = createMemo3(
1314
- () => props.blockChildren
1315
- );
1316
- function onUpdateFn_0() {
1317
- }
1318
- createEffect2(
1319
- on2(
1320
- () => [
1321
- onUpdateFn_0_props_componentOptions(),
1322
- onUpdateFn_0_props_blockChildren()
1323
- ],
1324
- onUpdateFn_0
1325
- )
1326
- );
1327
1303
  return <><Show4 when={props.componentRef}><Dynamic3
1328
1304
  {...getWrapperProps({
1329
1305
  componentOptions: props.componentOptions,
@@ -1336,7 +1312,7 @@ function ComponentRef(props) {
1336
1312
  contextValue: props.context
1337
1313
  })}
1338
1314
  component={Wrapper()}
1339
- ><For each={props.blockChildren}>{(child, _index) => {
1315
+ ><Show4 when={props.componentRef}><For each={props.blockChildren}>{(child, _index) => {
1340
1316
  const index = _index();
1341
1317
  return <Block_default
1342
1318
  key={child.id}
@@ -1345,12 +1321,12 @@ function ComponentRef(props) {
1345
1321
  registeredComponents={props.registeredComponents}
1346
1322
  linkComponent={props.linkComponent}
1347
1323
  />;
1348
- }}</For></Dynamic3></Show4></>;
1324
+ }}</For></Show4></Dynamic3></Show4></>;
1349
1325
  }
1350
1326
  var Component_ref_default = ComponentRef;
1351
1327
 
1352
1328
  // src/components/block/components/repeated-block.tsx
1353
- import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1329
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1354
1330
  function RepeatedBlock(props) {
1355
1331
  const [store, setStore] = createSignal4(props.repeatContext);
1356
1332
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1359,7 +1335,7 @@ function RepeatedBlock(props) {
1359
1335
  function onUpdateFn_0() {
1360
1336
  setStore(props.repeatContext);
1361
1337
  }
1362
- createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1338
+ createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1363
1339
  return <><builder_context_default.Provider value={store()}><Block_default
1364
1340
  block={props.block}
1365
1341
  context={store()}
@@ -1528,7 +1504,7 @@ function Block(props) {
1528
1504
  var Block_default = Block;
1529
1505
 
1530
1506
  // src/components/blocks/blocks-wrapper.tsx
1531
- import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1507
+ import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1532
1508
  import { Dynamic as Dynamic4 } from "solid-js/web";
1533
1509
  function BlocksWrapper(props) {
1534
1510
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1581,10 +1557,10 @@ function BlocksWrapper(props) {
1581
1557
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1582
1558
  function onUpdateFn_0() {
1583
1559
  }
1584
- createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1560
+ createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1585
1561
  return <>
1586
1562
  <Dynamic4
1587
- class={className() + " dynamic-450facf4"}
1563
+ class={className() + " dynamic-4d836538"}
1588
1564
  ref={blocksWrapperRef}
1589
1565
  builder-path={dataPath()}
1590
1566
  builder-parent-id={props.parent}
@@ -1596,7 +1572,7 @@ function BlocksWrapper(props) {
1596
1572
  {...props.BlocksWrapperProps}
1597
1573
  component={props.BlocksWrapper}
1598
1574
  >{props.children}</Dynamic4>
1599
- <style>{`.dynamic-450facf4 {
1575
+ <style>{`.dynamic-4d836538 {
1600
1576
  display: flex;
1601
1577
  flex-direction: column;
1602
1578
  align-items: stretch;
@@ -1975,7 +1951,7 @@ function SectionComponent(props) {
1975
1951
  var section_default = SectionComponent;
1976
1952
 
1977
1953
  // src/blocks/symbol/symbol.tsx
1978
- import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
1954
+ import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
1979
1955
 
1980
1956
  // src/components/content-variants/content-variants.tsx
1981
1957
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal20, createMemo as createMemo20 } from "solid-js";
@@ -3615,6 +3591,9 @@ function Tabs(props) {
3615
3591
  function activeTabContent(active) {
3616
3592
  return props.tabs && props.tabs[active].content;
3617
3593
  }
3594
+ function getTabStyle(index) {
3595
+ return index === activeTab() ? props.activeTabStyle : {};
3596
+ }
3618
3597
  function onClick(index) {
3619
3598
  if (index === activeTab() && props.collapsible) {
3620
3599
  setActiveTab(-1);
@@ -3636,9 +3615,7 @@ function Tabs(props) {
3636
3615
  return <span
3637
3616
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
3638
3617
  key={index}
3639
- style={{
3640
- ...activeTab() === index ? props.activeTabStyle : {}
3641
- }}
3618
+ style={getTabStyle(index)}
3642
3619
  onClick={(event) => onClick(index)}
3643
3620
  ><Blocks_default
3644
3621
  parent={props.builderBlock.id}
@@ -3724,7 +3701,7 @@ var componentInfo12 = {
3724
3701
  };
3725
3702
 
3726
3703
  // src/blocks/custom-code/custom-code.tsx
3727
- import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3704
+ import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3728
3705
  function CustomCode(props) {
3729
3706
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3730
3707
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3774,7 +3751,7 @@ function CustomCode(props) {
3774
3751
  runScripts();
3775
3752
  }
3776
3753
  }
3777
- createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3754
+ createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3778
3755
  return <><div
3779
3756
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3780
3757
  ref={elementRef}
@@ -3802,7 +3779,7 @@ var componentInfo13 = {
3802
3779
  };
3803
3780
 
3804
3781
  // src/blocks/embed/embed.tsx
3805
- import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3782
+ import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3806
3783
 
3807
3784
  // src/blocks/embed/helpers.ts
3808
3785
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3844,8 +3821,8 @@ function Embed(props) {
3844
3821
  findAndRunScripts();
3845
3822
  }
3846
3823
  }
3847
- createEffect7(
3848
- on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3824
+ createEffect6(
3825
+ on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3849
3826
  );
3850
3827
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
3851
3828
  }
@@ -4129,6 +4106,9 @@ function FormComponent(props) {
4129
4106
  function submissionState() {
4130
4107
  return isEditing() && props.previewState || formState();
4131
4108
  }
4109
+ function errorResponse(response) {
4110
+ return JSON.stringify(response, null, 2);
4111
+ }
4132
4112
  function onSubmit(event) {
4133
4113
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4134
4114
  if (props.sendSubmissionsTo === "zapier") {
@@ -4143,13 +4123,15 @@ function FormComponent(props) {
4143
4123
  const headers = props.customHeaders || {};
4144
4124
  let body;
4145
4125
  const formData = new FormData(el);
4146
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4126
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4127
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4128
+ ).map((el2) => {
4147
4129
  let value;
4148
4130
  const key = el2.name;
4149
4131
  if (el2 instanceof HTMLInputElement) {
4150
4132
  if (el2.type === "radio") {
4151
4133
  if (el2.checked) {
4152
- value = el2.name;
4134
+ value = el2.value;
4153
4135
  return {
4154
4136
  key,
4155
4137
  value
@@ -4341,14 +4323,14 @@ function FormComponent(props) {
4341
4323
  blocks={props.sendingMessage}
4342
4324
  context={props.builderContext}
4343
4325
  /></Show12>
4344
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4326
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-74261216">{errorResponse(responseData())}</pre></Show12>
4345
4327
  <Show12 when={submissionState() === "success"}><Blocks_default
4346
4328
  path="successMessage"
4347
4329
  blocks={props.successMessage}
4348
4330
  context={props.builderContext}
4349
4331
  /></Show12>
4350
4332
  </form>
4351
- <style>{`.pre-7430044e {
4333
+ <style>{`.pre-74261216 {
4352
4334
  padding: 10px;
4353
4335
  color: red;
4354
4336
  text-align: center;
@@ -4970,8 +4952,8 @@ var getUpdateVariantVisibilityScript = ({
4970
4952
  import {
4971
4953
  Show as Show14,
4972
4954
  onMount as onMount8,
4973
- on as on8,
4974
- createEffect as createEffect8,
4955
+ on as on7,
4956
+ createEffect as createEffect7,
4975
4957
  createMemo as createMemo17,
4976
4958
  createSignal as createSignal17
4977
4959
  } from "solid-js";
@@ -4983,7 +4965,7 @@ function getPreviewContent(_searchParams) {
4983
4965
  }
4984
4966
 
4985
4967
  // src/constants/sdk-version.ts
4986
- var SDK_VERSION = "4.2.0";
4968
+ var SDK_VERSION = "4.2.2";
4987
4969
 
4988
4970
  // src/helpers/sdk-headers.ts
4989
4971
  var getSdkHeaders = () => ({
@@ -5787,6 +5769,8 @@ var getWrapperClassName = (variationId) => {
5787
5769
  // src/components/content/components/enable-editor.tsx
5788
5770
  function EnableEditor(props) {
5789
5771
  const [hasExecuted, setHasExecuted] = createSignal17(false);
5772
+ const [prevData, setPrevData] = createSignal17(null);
5773
+ const [prevLocale, setPrevLocale] = createSignal17("");
5790
5774
  const [ContentWrapper, setContentWrapper] = createSignal17(
5791
5775
  props.contentWrapper || "div"
5792
5776
  );
@@ -5916,11 +5900,15 @@ function EnableEditor(props) {
5916
5900
  method: "GET"
5917
5901
  };
5918
5902
  logFetch(JSON.stringify(fetchRequestObj));
5919
- fetch(fetchRequestObj.url, {
5903
+ const fetchOptions = {
5920
5904
  method: fetchRequestObj.method,
5921
5905
  headers: fetchRequestObj.headers,
5922
5906
  body: fetchRequestObj.body
5923
- }).then((response) => response.json()).then((json) => {
5907
+ };
5908
+ if (fetchRequestObj.method === "GET") {
5909
+ delete fetchOptions.body;
5910
+ }
5911
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
5924
5912
  mergeNewRootState({
5925
5913
  [key]: json
5926
5914
  });
@@ -6032,15 +6020,15 @@ function EnableEditor(props) {
6032
6020
  mergeNewContent(props.content);
6033
6021
  }
6034
6022
  }
6035
- createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6023
+ createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6036
6024
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo17(
6037
6025
  () => props.builderContextSignal.rootState
6038
6026
  );
6039
6027
  function onUpdateFn_1() {
6040
6028
  emitStateUpdate();
6041
6029
  }
6042
- createEffect8(
6043
- on8(
6030
+ createEffect7(
6031
+ on7(
6044
6032
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6045
6033
  onUpdateFn_1
6046
6034
  )
@@ -6048,19 +6036,27 @@ function EnableEditor(props) {
6048
6036
  const onUpdateFn_2_props_data = createMemo17(() => props.data);
6049
6037
  function onUpdateFn_2() {
6050
6038
  if (props.data) {
6039
+ if (prevData() === props.data) {
6040
+ return;
6041
+ }
6051
6042
  mergeNewRootState(props.data);
6043
+ setPrevData(props.data);
6052
6044
  }
6053
6045
  }
6054
- createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6046
+ createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6055
6047
  const onUpdateFn_3_props_locale = createMemo17(() => props.locale);
6056
6048
  function onUpdateFn_3() {
6057
6049
  if (props.locale) {
6050
+ if (prevLocale() === props.locale) {
6051
+ return;
6052
+ }
6058
6053
  mergeNewRootState({
6059
6054
  locale: props.locale
6060
6055
  });
6056
+ setPrevLocale(props.locale);
6061
6057
  }
6062
6058
  }
6063
- createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6059
+ createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6064
6060
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6065
6061
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6066
6062
  ><Dynamic5
@@ -6420,6 +6416,9 @@ function Symbol(props) {
6420
6416
  const contentWrapper = createMemo21(() => {
6421
6417
  return "div";
6422
6418
  });
6419
+ const customComponents = createMemo21(() => {
6420
+ return Object.values(props.builderComponents);
6421
+ });
6423
6422
  const className = createMemo21(() => {
6424
6423
  return [
6425
6424
  ...[props.attributes[getClassPropName()]],
@@ -6447,7 +6446,7 @@ function Symbol(props) {
6447
6446
  function onUpdateFn_0() {
6448
6447
  setContent();
6449
6448
  }
6450
- createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6449
+ createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6451
6450
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6452
6451
  nonce={props.builderContext.nonce}
6453
6452
  isNestedRender={true}
@@ -6457,7 +6456,7 @@ function Symbol(props) {
6457
6456
  ...props.builderContext.context,
6458
6457
  symbolId: props.builderBlock?.id
6459
6458
  }}
6460
- customComponents={Object.values(props.builderComponents)}
6459
+ customComponents={customComponents()}
6461
6460
  data={{
6462
6461
  ...props.symbol?.data,
6463
6462
  ...props.builderContext.localState,
@@ -6501,6 +6500,18 @@ function register(type, info) {
6501
6500
  }
6502
6501
  }
6503
6502
  }
6503
+ function registerAction(action) {
6504
+ if (isBrowser()) {
6505
+ const actionClone = JSON.parse(JSON.stringify(action));
6506
+ if (action.action) {
6507
+ actionClone.action = action.action.toString();
6508
+ }
6509
+ window.parent?.postMessage({
6510
+ type: "builder.registerAction",
6511
+ data: actionClone
6512
+ }, "*");
6513
+ }
6514
+ }
6504
6515
 
6505
6516
  // src/functions/set-editor-settings.ts
6506
6517
  var settings = {};
@@ -6557,6 +6568,7 @@ export {
6557
6568
  isEditing,
6558
6569
  isPreviewing,
6559
6570
  register,
6571
+ registerAction,
6560
6572
  setClientUserAttributes,
6561
6573
  setEditorSettings,
6562
6574
  subscribeToEditor,