@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/dist/index.d.ts CHANGED
@@ -814,6 +814,22 @@ type DeepPartial<T> = {
814
814
  [P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
815
815
  };
816
816
 
817
+ interface Action {
818
+ name: string;
819
+ inputs?: readonly Input[];
820
+ returnType?: Input;
821
+ action: (options: Record<string, any>) => string;
822
+ /**
823
+ * Is an action for expression (e.g. calculating a binding like a formula
824
+ * to fill a value based on locale) or a function (e.g. something to trigger
825
+ * on an event like add to cart) or either (e.g. a custom code block)
826
+ */
827
+ kind: 'expression' | 'function' | 'any';
828
+ /**
829
+ * Globally unique ID for an action, e.g. "@builder.io:setState"
830
+ */
831
+ id: string;
832
+ }
817
833
  interface InsertMenuItem {
818
834
  name: string;
819
835
  icon?: string;
@@ -828,6 +844,7 @@ interface InsertMenuConfig {
828
844
  }
829
845
  declare function register(type: 'insertMenu', info: InsertMenuConfig): void;
830
846
  declare function register(type: string, info: any): void;
847
+ declare function registerAction(action: Action): void;
831
848
 
832
849
  type Settings = {
833
850
  customInsertMenu?: boolean;
@@ -1123,4 +1140,4 @@ declare const _processContentResult: (options: GetContentOptions, content: Conte
1123
1140
  */
1124
1141
  declare function fetchEntries(options: GetContentOptions): Promise<BuilderContent[]>;
1125
1142
 
1126
- export { Blocks, BlocksProps, BuilderBlock, BuilderContent, _default as BuilderContext, BuilderContextInterface, Button, ButtonProps, ColumnProps, Columns, ComponentInfo, ContentVariants as Content, ContentVariantsPrps as ContentProps, FragmentComponent as Fragment, FragmentProps, GetContentOptions, Image, ImageProps, InsertMenuConfig, InsertMenuItem, RegisteredComponent, RegisteredComponents, SectionComponent as Section, SectionProps, Settings, Symbol, SymbolProps, Text, TextProps, Video, VideoProps, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
1143
+ export { Blocks, BlocksProps, BuilderBlock, BuilderContent, _default as BuilderContext, BuilderContextInterface, Button, ButtonProps, ColumnProps, Columns, ComponentInfo, ContentVariants as Content, ContentVariantsPrps as ContentProps, FragmentComponent as Fragment, FragmentProps, GetContentOptions, Image, ImageProps, InsertMenuConfig, InsertMenuItem, RegisteredComponent, RegisteredComponents, SectionComponent as Section, SectionProps, Settings, Symbol, SymbolProps, Text, TextProps, Video, VideoProps, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, registerAction, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
@@ -1320,11 +1320,6 @@ var getWrapperProps = ({
1320
1320
  function ComponentRef(props) {
1321
1321
  createSignal(false);
1322
1322
  const [Wrapper, setWrapper] = createSignal(props.isInteractive ? interactive_element_default : props.componentRef);
1323
- const onUpdateFn_0_props_componentOptions = createMemo(() => props.componentOptions);
1324
- const onUpdateFn_0_props_blockChildren = createMemo(() => props.blockChildren);
1325
- function onUpdateFn_0() {
1326
- }
1327
- createEffect(on(() => [onUpdateFn_0_props_componentOptions(), onUpdateFn_0_props_blockChildren()], onUpdateFn_0));
1328
1323
  return createComponent(Show, {
1329
1324
  get when() {
1330
1325
  return props.componentRef;
@@ -1344,25 +1339,32 @@ function ComponentRef(props) {
1344
1339
  return Wrapper();
1345
1340
  },
1346
1341
  get children() {
1347
- return createComponent(For, {
1348
- get each() {
1349
- return props.blockChildren;
1342
+ return createComponent(Show, {
1343
+ get when() {
1344
+ return props.componentRef;
1350
1345
  },
1351
- children: (child, _index) => {
1352
- _index();
1353
- return createComponent(block_default, {
1354
- get key() {
1355
- return child.id;
1356
- },
1357
- block: child,
1358
- get context() {
1359
- return props.context;
1360
- },
1361
- get registeredComponents() {
1362
- return props.registeredComponents;
1346
+ get children() {
1347
+ return createComponent(For, {
1348
+ get each() {
1349
+ return props.blockChildren;
1363
1350
  },
1364
- get linkComponent() {
1365
- return props.linkComponent;
1351
+ children: (child, _index) => {
1352
+ _index();
1353
+ return createComponent(block_default, {
1354
+ get key() {
1355
+ return child.id;
1356
+ },
1357
+ block: child,
1358
+ get context() {
1359
+ return props.context;
1360
+ },
1361
+ get registeredComponents() {
1362
+ return props.registeredComponents;
1363
+ },
1364
+ get linkComponent() {
1365
+ return props.linkComponent;
1366
+ }
1367
+ });
1366
1368
  }
1367
1369
  });
1368
1370
  }
@@ -1669,7 +1671,7 @@ function Block(props) {
1669
1671
  });
1670
1672
  }
1671
1673
  var block_default = Block;
1672
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-450facf4 {
1674
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4d836538 {
1673
1675
  display: flex;
1674
1676
  flex-direction: column;
1675
1677
  align-items: stretch;
@@ -1718,7 +1720,7 @@ function BlocksWrapper(props) {
1718
1720
  createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1719
1721
  return [createComponent(Dynamic, mergeProps({
1720
1722
  get ["class"]() {
1721
- return className() + " dynamic-450facf4";
1723
+ return className() + " dynamic-4d836538";
1722
1724
  },
1723
1725
  ref(r$) {
1724
1726
  const _ref$ = blocksWrapperRef;
@@ -3973,6 +3975,9 @@ function Tabs(props) {
3973
3975
  function activeTabContent(active) {
3974
3976
  return props.tabs && props.tabs[active].content;
3975
3977
  }
3978
+ function getTabStyle(index) {
3979
+ return index === activeTab() ? props.activeTabStyle : {};
3980
+ }
3976
3981
  function onClick(index) {
3977
3982
  if (index === activeTab() && props.collapsible) {
3978
3983
  setActiveTab(-1);
@@ -4014,9 +4019,7 @@ function Tabs(props) {
4014
4019
  }
4015
4020
  }));
4016
4021
  effect((_p$) => {
4017
- const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = {
4018
- ...activeTab() === index ? props.activeTabStyle : {}
4019
- };
4022
+ const _v$ = `builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`, _v$2 = getTabStyle(index);
4020
4023
  _v$ !== _p$._v$ && className(_el$4, _p$._v$ = _v$);
4021
4024
  _p$._v$2 = style(_el$4, _v$2, _p$._v$2);
4022
4025
  return _p$;
@@ -4512,9 +4515,9 @@ function logFetch(url) {
4512
4515
  }
4513
4516
 
4514
4517
  // src/blocks/form/form/form.tsx
4515
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4518
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-74261216">`);
4516
4519
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4517
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4520
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-74261216 {
4518
4521
  padding: 10px;
4519
4522
  color: red;
4520
4523
  text-align: center;
@@ -4537,6 +4540,9 @@ function FormComponent(props) {
4537
4540
  function submissionState() {
4538
4541
  return isEditing() && props.previewState || formState();
4539
4542
  }
4543
+ function errorResponse(response) {
4544
+ return JSON.stringify(response, null, 2);
4545
+ }
4540
4546
  function onSubmit(event) {
4541
4547
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4542
4548
  if (props.sendSubmissionsTo === "zapier") {
@@ -4551,13 +4557,13 @@ function FormComponent(props) {
4551
4557
  const headers = props.customHeaders || {};
4552
4558
  let body;
4553
4559
  const formData = new FormData(el);
4554
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4560
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
4555
4561
  let value;
4556
4562
  const key = el2.name;
4557
4563
  if (el2 instanceof HTMLInputElement) {
4558
4564
  if (el2.type === "radio") {
4559
4565
  if (el2.checked) {
4560
- value = el2.name;
4566
+ value = el2.value;
4561
4567
  return {
4562
4568
  key,
4563
4569
  value
@@ -4785,7 +4791,7 @@ function FormComponent(props) {
4785
4791
  },
4786
4792
  get children() {
4787
4793
  const _el$2 = _tmpl$15();
4788
- insert(_el$2, () => JSON.stringify(responseData(), null, 2));
4794
+ insert(_el$2, () => errorResponse(responseData()));
4789
4795
  return _el$2;
4790
4796
  }
4791
4797
  }), null);
@@ -5502,7 +5508,7 @@ function getPreviewContent(_searchParams) {
5502
5508
  }
5503
5509
 
5504
5510
  // src/constants/sdk-version.ts
5505
- var SDK_VERSION = "4.2.0";
5511
+ var SDK_VERSION = "4.2.2";
5506
5512
 
5507
5513
  // src/helpers/sdk-headers.ts
5508
5514
  var getSdkHeaders = () => ({
@@ -6311,6 +6317,8 @@ var getWrapperClassName = (variationId) => {
6311
6317
  // src/components/content/components/enable-editor.tsx
6312
6318
  function EnableEditor(props) {
6313
6319
  createSignal(false);
6320
+ const [prevData, setPrevData] = createSignal(null);
6321
+ const [prevLocale, setPrevLocale] = createSignal("");
6314
6322
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6315
6323
  const [httpReqsData, setHttpReqsData] = createSignal({});
6316
6324
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6435,11 +6443,15 @@ function EnableEditor(props) {
6435
6443
  method: "GET"
6436
6444
  };
6437
6445
  logFetch(JSON.stringify(fetchRequestObj));
6438
- fetch(fetchRequestObj.url, {
6446
+ const fetchOptions = {
6439
6447
  method: fetchRequestObj.method,
6440
6448
  headers: fetchRequestObj.headers,
6441
6449
  body: fetchRequestObj.body
6442
- }).then((response) => response.json()).then((json) => {
6450
+ };
6451
+ if (fetchRequestObj.method === "GET") {
6452
+ delete fetchOptions.body;
6453
+ }
6454
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
6443
6455
  mergeNewRootState({
6444
6456
  [key]: json
6445
6457
  });
@@ -6548,16 +6560,24 @@ function EnableEditor(props) {
6548
6560
  const onUpdateFn_2_props_data = createMemo(() => props.data);
6549
6561
  function onUpdateFn_2() {
6550
6562
  if (props.data) {
6563
+ if (prevData() === props.data) {
6564
+ return;
6565
+ }
6551
6566
  mergeNewRootState(props.data);
6567
+ setPrevData(props.data);
6552
6568
  }
6553
6569
  }
6554
6570
  createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6555
6571
  const onUpdateFn_3_props_locale = createMemo(() => props.locale);
6556
6572
  function onUpdateFn_3() {
6557
6573
  if (props.locale) {
6574
+ if (prevLocale() === props.locale) {
6575
+ return;
6576
+ }
6558
6577
  mergeNewRootState({
6559
6578
  locale: props.locale
6560
6579
  });
6580
+ setPrevLocale(props.locale);
6561
6581
  }
6562
6582
  }
6563
6583
  createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
@@ -7107,6 +7127,9 @@ function Symbol(props) {
7107
7127
  const contentWrapper = createMemo(() => {
7108
7128
  return "div";
7109
7129
  });
7130
+ const customComponents = createMemo(() => {
7131
+ return Object.values(props.builderComponents);
7132
+ });
7110
7133
  const className = createMemo(() => {
7111
7134
  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(" ");
7112
7135
  });
@@ -7155,7 +7178,7 @@ function Symbol(props) {
7155
7178
  };
7156
7179
  },
7157
7180
  get customComponents() {
7158
- return Object.values(props.builderComponents);
7181
+ return customComponents();
7159
7182
  },
7160
7183
  get data() {
7161
7184
  return {
@@ -7217,6 +7240,18 @@ function register(type, info) {
7217
7240
  }
7218
7241
  }
7219
7242
  }
7243
+ function registerAction(action) {
7244
+ if (isBrowser()) {
7245
+ const actionClone = JSON.parse(JSON.stringify(action));
7246
+ if (action.action) {
7247
+ actionClone.action = action.action.toString();
7248
+ }
7249
+ window.parent?.postMessage({
7250
+ type: "builder.registerAction",
7251
+ data: actionClone
7252
+ }, "*");
7253
+ }
7254
+ }
7220
7255
 
7221
7256
  // src/functions/set-editor-settings.ts
7222
7257
  var settings = {};
@@ -7253,4 +7288,4 @@ var fetchBuilderProps = async (_args) => {
7253
7288
  };
7254
7289
  };
7255
7290
 
7256
- 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 };
7291
+ 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 };
@@ -1200,14 +1200,7 @@ function BlockWrapper(props) {
1200
1200
  var Block_wrapper_default = BlockWrapper;
1201
1201
 
1202
1202
  // src/components/block/components/component-ref/component-ref.tsx
1203
- import {
1204
- Show as Show4,
1205
- For,
1206
- on as on2,
1207
- createEffect as createEffect2,
1208
- createMemo as createMemo3,
1209
- createSignal as createSignal3
1210
- } from "solid-js";
1203
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
1211
1204
  import { Dynamic as Dynamic3 } from "solid-js/web";
1212
1205
 
1213
1206
  // src/components/block/components/interactive-element.tsx
@@ -1314,23 +1307,6 @@ function ComponentRef(props) {
1314
1307
  const [Wrapper, setWrapper] = createSignal3(
1315
1308
  props.isInteractive ? interactive_element_default : props.componentRef
1316
1309
  );
1317
- const onUpdateFn_0_props_componentOptions = createMemo3(
1318
- () => props.componentOptions
1319
- );
1320
- const onUpdateFn_0_props_blockChildren = createMemo3(
1321
- () => props.blockChildren
1322
- );
1323
- function onUpdateFn_0() {
1324
- }
1325
- createEffect2(
1326
- on2(
1327
- () => [
1328
- onUpdateFn_0_props_componentOptions(),
1329
- onUpdateFn_0_props_blockChildren()
1330
- ],
1331
- onUpdateFn_0
1332
- )
1333
- );
1334
1310
  return <><Show4 when={props.componentRef}><Dynamic3
1335
1311
  {...getWrapperProps({
1336
1312
  componentOptions: props.componentOptions,
@@ -1343,7 +1319,7 @@ function ComponentRef(props) {
1343
1319
  contextValue: props.context
1344
1320
  })}
1345
1321
  component={Wrapper()}
1346
- ><For each={props.blockChildren}>{(child, _index) => {
1322
+ ><Show4 when={props.componentRef}><For each={props.blockChildren}>{(child, _index) => {
1347
1323
  const index = _index();
1348
1324
  return <Block_default
1349
1325
  key={child.id}
@@ -1352,12 +1328,12 @@ function ComponentRef(props) {
1352
1328
  registeredComponents={props.registeredComponents}
1353
1329
  linkComponent={props.linkComponent}
1354
1330
  />;
1355
- }}</For></Dynamic3></Show4></>;
1331
+ }}</For></Show4></Dynamic3></Show4></>;
1356
1332
  }
1357
1333
  var Component_ref_default = ComponentRef;
1358
1334
 
1359
1335
  // src/components/block/components/repeated-block.tsx
1360
- import { on as on3, createEffect as createEffect3, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1336
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo4, createSignal as createSignal4 } from "solid-js";
1361
1337
  function RepeatedBlock(props) {
1362
1338
  const [store, setStore] = createSignal4(props.repeatContext);
1363
1339
  const onUpdateFn_0_props_repeatContext = createMemo4(
@@ -1366,7 +1342,7 @@ function RepeatedBlock(props) {
1366
1342
  function onUpdateFn_0() {
1367
1343
  setStore(props.repeatContext);
1368
1344
  }
1369
- createEffect3(on3(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1345
+ createEffect2(on2(() => [onUpdateFn_0_props_repeatContext()], onUpdateFn_0));
1370
1346
  return <><builder_context_default.Provider value={store()}><Block_default
1371
1347
  block={props.block}
1372
1348
  context={store()}
@@ -1535,7 +1511,7 @@ function Block(props) {
1535
1511
  var Block_default = Block;
1536
1512
 
1537
1513
  // src/components/blocks/blocks-wrapper.tsx
1538
- import { onMount as onMount3, on as on5, createEffect as createEffect5, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1514
+ import { onMount as onMount3, on as on4, createEffect as createEffect4, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
1539
1515
  import { Dynamic as Dynamic4 } from "solid-js/web";
1540
1516
  function BlocksWrapper(props) {
1541
1517
  const [shouldUpdate, setShouldUpdate] = createSignal6(false);
@@ -1588,10 +1564,10 @@ function BlocksWrapper(props) {
1588
1564
  const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
1589
1565
  function onUpdateFn_0() {
1590
1566
  }
1591
- createEffect5(on5(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1567
+ createEffect4(on4(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1592
1568
  return <>
1593
1569
  <Dynamic4
1594
- class={className() + " dynamic-450facf4"}
1570
+ class={className() + " dynamic-4d836538"}
1595
1571
  ref={blocksWrapperRef}
1596
1572
  builder-path={dataPath()}
1597
1573
  builder-parent-id={props.parent}
@@ -1603,7 +1579,7 @@ function BlocksWrapper(props) {
1603
1579
  {...props.BlocksWrapperProps}
1604
1580
  component={props.BlocksWrapper}
1605
1581
  >{props.children}</Dynamic4>
1606
- <style>{`.dynamic-450facf4 {
1582
+ <style>{`.dynamic-4d836538 {
1607
1583
  display: flex;
1608
1584
  flex-direction: column;
1609
1585
  align-items: stretch;
@@ -1983,7 +1959,7 @@ function SectionComponent(props) {
1983
1959
  var section_default = SectionComponent;
1984
1960
 
1985
1961
  // src/blocks/symbol/symbol.tsx
1986
- import { onMount as onMount10, on as on9, createEffect as createEffect9, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
1962
+ import { onMount as onMount10, on as on8, createEffect as createEffect8, createMemo as createMemo21, createSignal as createSignal21 } from "solid-js";
1987
1963
 
1988
1964
  // src/components/content-variants/content-variants.tsx
1989
1965
  import { Show as Show16, For as For9, onMount as onMount9, createSignal as createSignal20, createMemo as createMemo20 } from "solid-js";
@@ -3624,6 +3600,9 @@ function Tabs(props) {
3624
3600
  function activeTabContent(active) {
3625
3601
  return props.tabs && props.tabs[active].content;
3626
3602
  }
3603
+ function getTabStyle(index) {
3604
+ return index === activeTab() ? props.activeTabStyle : {};
3605
+ }
3627
3606
  function onClick(index) {
3628
3607
  if (index === activeTab() && props.collapsible) {
3629
3608
  setActiveTab(-1);
@@ -3645,9 +3624,7 @@ function Tabs(props) {
3645
3624
  return <span
3646
3625
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
3647
3626
  key={index}
3648
- style={{
3649
- ...activeTab() === index ? props.activeTabStyle : {}
3650
- }}
3627
+ style={getTabStyle(index)}
3651
3628
  onClick={(event) => onClick(index)}
3652
3629
  ><Blocks_default
3653
3630
  parent={props.builderBlock.id}
@@ -3733,7 +3710,7 @@ var componentInfo12 = {
3733
3710
  };
3734
3711
 
3735
3712
  // src/blocks/custom-code/custom-code.tsx
3736
- import { onMount as onMount6, on as on6, createEffect as createEffect6, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3713
+ import { onMount as onMount6, on as on5, createEffect as createEffect5, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3737
3714
  function CustomCode(props) {
3738
3715
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3739
3716
  const [scriptsRun, setScriptsRun] = createSignal12([]);
@@ -3783,7 +3760,7 @@ function CustomCode(props) {
3783
3760
  runScripts();
3784
3761
  }
3785
3762
  }
3786
- createEffect6(on6(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3763
+ createEffect5(on5(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
3787
3764
  return <><div
3788
3765
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
3789
3766
  ref={elementRef}
@@ -3811,7 +3788,7 @@ var componentInfo13 = {
3811
3788
  };
3812
3789
 
3813
3790
  // src/blocks/embed/embed.tsx
3814
- import { on as on7, createEffect as createEffect7, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3791
+ import { on as on6, createEffect as createEffect6, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3815
3792
 
3816
3793
  // src/blocks/embed/helpers.ts
3817
3794
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3853,8 +3830,8 @@ function Embed(props) {
3853
3830
  findAndRunScripts();
3854
3831
  }
3855
3832
  }
3856
- createEffect7(
3857
- on7(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3833
+ createEffect6(
3834
+ on6(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
3858
3835
  );
3859
3836
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
3860
3837
  }
@@ -4138,6 +4115,9 @@ function FormComponent(props) {
4138
4115
  function submissionState() {
4139
4116
  return isEditing() && props.previewState || formState();
4140
4117
  }
4118
+ function errorResponse(response) {
4119
+ return JSON.stringify(response, null, 2);
4120
+ }
4141
4121
  function onSubmit(event) {
4142
4122
  const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
4143
4123
  if (props.sendSubmissionsTo === "zapier") {
@@ -4152,13 +4132,15 @@ function FormComponent(props) {
4152
4132
  const headers = props.customHeaders || {};
4153
4133
  let body;
4154
4134
  const formData = new FormData(el);
4155
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4135
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4136
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4137
+ ).map((el2) => {
4156
4138
  let value;
4157
4139
  const key = el2.name;
4158
4140
  if (el2 instanceof HTMLInputElement) {
4159
4141
  if (el2.type === "radio") {
4160
4142
  if (el2.checked) {
4161
- value = el2.name;
4143
+ value = el2.value;
4162
4144
  return {
4163
4145
  key,
4164
4146
  value
@@ -4351,14 +4333,14 @@ function FormComponent(props) {
4351
4333
  blocks={props.sendingMessage}
4352
4334
  context={props.builderContext}
4353
4335
  /></Show12>
4354
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4336
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-74261216">{errorResponse(responseData())}</pre></Show12>
4355
4337
  <Show12 when={submissionState() === "success"}><Blocks_default
4356
4338
  path="successMessage"
4357
4339
  blocks={props.successMessage}
4358
4340
  context={props.builderContext}
4359
4341
  /></Show12>
4360
4342
  </form>
4361
- <style>{`.pre-7430044e {
4343
+ <style>{`.pre-74261216 {
4362
4344
  padding: 10px;
4363
4345
  color: red;
4364
4346
  text-align: center;
@@ -4981,8 +4963,8 @@ var getUpdateVariantVisibilityScript = ({
4981
4963
  import {
4982
4964
  Show as Show14,
4983
4965
  onMount as onMount8,
4984
- on as on8,
4985
- createEffect as createEffect8,
4966
+ on as on7,
4967
+ createEffect as createEffect7,
4986
4968
  createMemo as createMemo17,
4987
4969
  createSignal as createSignal17
4988
4970
  } from "solid-js";
@@ -4994,7 +4976,7 @@ function getPreviewContent(_searchParams) {
4994
4976
  }
4995
4977
 
4996
4978
  // src/constants/sdk-version.ts
4997
- var SDK_VERSION = "4.2.0";
4979
+ var SDK_VERSION = "4.2.2";
4998
4980
 
4999
4981
  // src/helpers/sdk-headers.ts
5000
4982
  var getSdkHeaders = () => ({
@@ -5803,6 +5785,8 @@ var getWrapperClassName = (variationId) => {
5803
5785
  // src/components/content/components/enable-editor.tsx
5804
5786
  function EnableEditor(props) {
5805
5787
  const [hasExecuted, setHasExecuted] = createSignal17(false);
5788
+ const [prevData, setPrevData] = createSignal17(null);
5789
+ const [prevLocale, setPrevLocale] = createSignal17("");
5806
5790
  const [ContentWrapper, setContentWrapper] = createSignal17(
5807
5791
  props.contentWrapper || "div"
5808
5792
  );
@@ -5932,11 +5916,15 @@ function EnableEditor(props) {
5932
5916
  method: "GET"
5933
5917
  };
5934
5918
  logFetch(JSON.stringify(fetchRequestObj));
5935
- fetch(fetchRequestObj.url, {
5919
+ const fetchOptions = {
5936
5920
  method: fetchRequestObj.method,
5937
5921
  headers: fetchRequestObj.headers,
5938
5922
  body: fetchRequestObj.body
5939
- }).then((response) => response.json()).then((json) => {
5923
+ };
5924
+ if (fetchRequestObj.method === "GET") {
5925
+ delete fetchOptions.body;
5926
+ }
5927
+ fetch(fetchRequestObj.url, fetchOptions).then((response) => response.json()).then((json) => {
5940
5928
  mergeNewRootState({
5941
5929
  [key]: json
5942
5930
  });
@@ -6053,15 +6041,15 @@ function EnableEditor(props) {
6053
6041
  mergeNewContent(props.content);
6054
6042
  }
6055
6043
  }
6056
- createEffect8(on8(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6044
+ createEffect7(on7(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
6057
6045
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo17(
6058
6046
  () => props.builderContextSignal.rootState
6059
6047
  );
6060
6048
  function onUpdateFn_1() {
6061
6049
  emitStateUpdate();
6062
6050
  }
6063
- createEffect8(
6064
- on8(
6051
+ createEffect7(
6052
+ on7(
6065
6053
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
6066
6054
  onUpdateFn_1
6067
6055
  )
@@ -6069,19 +6057,27 @@ function EnableEditor(props) {
6069
6057
  const onUpdateFn_2_props_data = createMemo17(() => props.data);
6070
6058
  function onUpdateFn_2() {
6071
6059
  if (props.data) {
6060
+ if (prevData() === props.data) {
6061
+ return;
6062
+ }
6072
6063
  mergeNewRootState(props.data);
6064
+ setPrevData(props.data);
6073
6065
  }
6074
6066
  }
6075
- createEffect8(on8(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6067
+ createEffect7(on7(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
6076
6068
  const onUpdateFn_3_props_locale = createMemo17(() => props.locale);
6077
6069
  function onUpdateFn_3() {
6078
6070
  if (props.locale) {
6071
+ if (prevLocale() === props.locale) {
6072
+ return;
6073
+ }
6079
6074
  mergeNewRootState({
6080
6075
  locale: props.locale
6081
6076
  });
6077
+ setPrevLocale(props.locale);
6082
6078
  }
6083
6079
  }
6084
- createEffect8(on8(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6080
+ createEffect7(on7(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
6085
6081
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
6086
6082
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
6087
6083
  ><Dynamic5
@@ -6441,6 +6437,9 @@ function Symbol(props) {
6441
6437
  const contentWrapper = createMemo21(() => {
6442
6438
  return "div";
6443
6439
  });
6440
+ const customComponents = createMemo21(() => {
6441
+ return Object.values(props.builderComponents);
6442
+ });
6444
6443
  const className = createMemo21(() => {
6445
6444
  return [
6446
6445
  ...[props.attributes[getClassPropName()]],
@@ -6468,7 +6467,7 @@ function Symbol(props) {
6468
6467
  function onUpdateFn_0() {
6469
6468
  setContent();
6470
6469
  }
6471
- createEffect9(on9(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6470
+ createEffect8(on8(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
6472
6471
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
6473
6472
  nonce={props.builderContext.nonce}
6474
6473
  isNestedRender={true}
@@ -6478,7 +6477,7 @@ function Symbol(props) {
6478
6477
  ...props.builderContext.context,
6479
6478
  symbolId: props.builderBlock?.id
6480
6479
  }}
6481
- customComponents={Object.values(props.builderComponents)}
6480
+ customComponents={customComponents()}
6482
6481
  data={{
6483
6482
  ...props.symbol?.data,
6484
6483
  ...props.builderContext.localState,
@@ -6523,6 +6522,18 @@ function register(type, info) {
6523
6522
  }
6524
6523
  }
6525
6524
  }
6525
+ function registerAction(action) {
6526
+ if (isBrowser()) {
6527
+ const actionClone = JSON.parse(JSON.stringify(action));
6528
+ if (action.action) {
6529
+ actionClone.action = action.action.toString();
6530
+ }
6531
+ window.parent?.postMessage({
6532
+ type: "builder.registerAction",
6533
+ data: actionClone
6534
+ }, "*");
6535
+ }
6536
+ }
6526
6537
 
6527
6538
  // src/functions/set-editor-settings.ts
6528
6539
  var settings = {};
@@ -6579,6 +6590,7 @@ export {
6579
6590
  isEditing,
6580
6591
  isPreviewing,
6581
6592
  register,
6593
+ registerAction,
6582
6594
  setClientUserAttributes,
6583
6595
  setEditorSettings,
6584
6596
  subscribeToEditor,