@builder.io/sdk-solid 4.2.0 → 4.2.1

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 };
@@ -4512,9 +4512,9 @@ function logFetch(url) {
4512
4512
  }
4513
4513
 
4514
4514
  // src/blocks/form/form/form.tsx
4515
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4515
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
4516
4516
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4517
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4517
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
4518
4518
  padding: 10px;
4519
4519
  color: red;
4520
4520
  text-align: center;
@@ -4551,13 +4551,13 @@ function FormComponent(props) {
4551
4551
  const headers = props.customHeaders || {};
4552
4552
  let body;
4553
4553
  const formData = new FormData(el);
4554
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4554
+ 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
4555
  let value;
4556
4556
  const key = el2.name;
4557
4557
  if (el2 instanceof HTMLInputElement) {
4558
4558
  if (el2.type === "radio") {
4559
4559
  if (el2.checked) {
4560
- value = el2.name;
4560
+ value = el2.value;
4561
4561
  return {
4562
4562
  key,
4563
4563
  value
@@ -5502,7 +5502,7 @@ function getPreviewContent(_searchParams) {
5502
5502
  }
5503
5503
 
5504
5504
  // src/constants/sdk-version.ts
5505
- var SDK_VERSION = "4.2.0";
5505
+ var SDK_VERSION = "4.2.1";
5506
5506
 
5507
5507
  // src/helpers/sdk-headers.ts
5508
5508
  var getSdkHeaders = () => ({
@@ -7217,6 +7217,18 @@ function register(type, info) {
7217
7217
  }
7218
7218
  }
7219
7219
  }
7220
+ function registerAction(action) {
7221
+ if (isBrowser()) {
7222
+ const actionClone = JSON.parse(JSON.stringify(action));
7223
+ if (action.action) {
7224
+ actionClone.action = action.action.toString();
7225
+ }
7226
+ window.parent?.postMessage({
7227
+ type: "builder.registerAction",
7228
+ data: actionClone
7229
+ }, "*");
7230
+ }
7231
+ }
7220
7232
 
7221
7233
  // src/functions/set-editor-settings.ts
7222
7234
  var settings = {};
@@ -7253,4 +7265,4 @@ var fetchBuilderProps = async (_args) => {
7253
7265
  };
7254
7266
  };
7255
7267
 
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 };
7268
+ 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 };
@@ -4152,13 +4152,15 @@ function FormComponent(props) {
4152
4152
  const headers = props.customHeaders || {};
4153
4153
  let body;
4154
4154
  const formData = new FormData(el);
4155
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4155
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4156
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4157
+ ).map((el2) => {
4156
4158
  let value;
4157
4159
  const key = el2.name;
4158
4160
  if (el2 instanceof HTMLInputElement) {
4159
4161
  if (el2.type === "radio") {
4160
4162
  if (el2.checked) {
4161
- value = el2.name;
4163
+ value = el2.value;
4162
4164
  return {
4163
4165
  key,
4164
4166
  value
@@ -4351,14 +4353,14 @@ function FormComponent(props) {
4351
4353
  blocks={props.sendingMessage}
4352
4354
  context={props.builderContext}
4353
4355
  /></Show12>
4354
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4356
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4355
4357
  <Show12 when={submissionState() === "success"}><Blocks_default
4356
4358
  path="successMessage"
4357
4359
  blocks={props.successMessage}
4358
4360
  context={props.builderContext}
4359
4361
  /></Show12>
4360
4362
  </form>
4361
- <style>{`.pre-7430044e {
4363
+ <style>{`.pre-fdf23968 {
4362
4364
  padding: 10px;
4363
4365
  color: red;
4364
4366
  text-align: center;
@@ -4994,7 +4996,7 @@ function getPreviewContent(_searchParams) {
4994
4996
  }
4995
4997
 
4996
4998
  // src/constants/sdk-version.ts
4997
- var SDK_VERSION = "4.2.0";
4999
+ var SDK_VERSION = "4.2.1";
4998
5000
 
4999
5001
  // src/helpers/sdk-headers.ts
5000
5002
  var getSdkHeaders = () => ({
@@ -6523,6 +6525,18 @@ function register(type, info) {
6523
6525
  }
6524
6526
  }
6525
6527
  }
6528
+ function registerAction(action) {
6529
+ if (isBrowser()) {
6530
+ const actionClone = JSON.parse(JSON.stringify(action));
6531
+ if (action.action) {
6532
+ actionClone.action = action.action.toString();
6533
+ }
6534
+ window.parent?.postMessage({
6535
+ type: "builder.registerAction",
6536
+ data: actionClone
6537
+ }, "*");
6538
+ }
6539
+ }
6526
6540
 
6527
6541
  // src/functions/set-editor-settings.ts
6528
6542
  var settings = {};
@@ -6579,6 +6593,7 @@ export {
6579
6593
  isEditing,
6580
6594
  isPreviewing,
6581
6595
  register,
6596
+ registerAction,
6582
6597
  setClientUserAttributes,
6583
6598
  setEditorSettings,
6584
6599
  subscribeToEditor,
@@ -4501,9 +4501,9 @@ function logFetch(url) {
4501
4501
  }
4502
4502
 
4503
4503
  // src/blocks/form/form/form.tsx
4504
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4504
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
4505
4505
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4506
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4506
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
4507
4507
  padding: 10px;
4508
4508
  color: red;
4509
4509
  text-align: center;
@@ -4540,13 +4540,13 @@ function FormComponent(props) {
4540
4540
  const headers = props.customHeaders || {};
4541
4541
  let body;
4542
4542
  const formData = new FormData(el);
4543
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4543
+ 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
4544
  let value;
4545
4545
  const key = el2.name;
4546
4546
  if (el2 instanceof HTMLInputElement) {
4547
4547
  if (el2.type === "radio") {
4548
4548
  if (el2.checked) {
4549
- value = el2.name;
4549
+ value = el2.value;
4550
4550
  return {
4551
4551
  key,
4552
4552
  value
@@ -5489,7 +5489,7 @@ function getPreviewContent(_searchParams) {
5489
5489
  }
5490
5490
 
5491
5491
  // src/constants/sdk-version.ts
5492
- var SDK_VERSION = "4.2.0";
5492
+ var SDK_VERSION = "4.2.1";
5493
5493
 
5494
5494
  // src/helpers/sdk-headers.ts
5495
5495
  var getSdkHeaders = () => ({
@@ -7197,6 +7197,18 @@ function register(type, info) {
7197
7197
  }
7198
7198
  }
7199
7199
  }
7200
+ function registerAction(action) {
7201
+ if (isBrowser()) {
7202
+ const actionClone = JSON.parse(JSON.stringify(action));
7203
+ if (action.action) {
7204
+ actionClone.action = action.action.toString();
7205
+ }
7206
+ window.parent?.postMessage({
7207
+ type: "builder.registerAction",
7208
+ data: actionClone
7209
+ }, "*");
7210
+ }
7211
+ }
7200
7212
 
7201
7213
  // src/functions/set-editor-settings.ts
7202
7214
  var settings = {};
@@ -7233,4 +7245,4 @@ var fetchBuilderProps = async (_args) => {
7233
7245
  };
7234
7246
  };
7235
7247
 
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 };
7248
+ 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 };
@@ -4143,13 +4143,15 @@ function FormComponent(props) {
4143
4143
  const headers = props.customHeaders || {};
4144
4144
  let body;
4145
4145
  const formData = new FormData(el);
4146
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4146
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4147
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4148
+ ).map((el2) => {
4147
4149
  let value;
4148
4150
  const key = el2.name;
4149
4151
  if (el2 instanceof HTMLInputElement) {
4150
4152
  if (el2.type === "radio") {
4151
4153
  if (el2.checked) {
4152
- value = el2.name;
4154
+ value = el2.value;
4153
4155
  return {
4154
4156
  key,
4155
4157
  value
@@ -4341,14 +4343,14 @@ function FormComponent(props) {
4341
4343
  blocks={props.sendingMessage}
4342
4344
  context={props.builderContext}
4343
4345
  /></Show12>
4344
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4346
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4345
4347
  <Show12 when={submissionState() === "success"}><Blocks_default
4346
4348
  path="successMessage"
4347
4349
  blocks={props.successMessage}
4348
4350
  context={props.builderContext}
4349
4351
  /></Show12>
4350
4352
  </form>
4351
- <style>{`.pre-7430044e {
4353
+ <style>{`.pre-fdf23968 {
4352
4354
  padding: 10px;
4353
4355
  color: red;
4354
4356
  text-align: center;
@@ -4983,7 +4985,7 @@ function getPreviewContent(_searchParams) {
4983
4985
  }
4984
4986
 
4985
4987
  // src/constants/sdk-version.ts
4986
- var SDK_VERSION = "4.2.0";
4988
+ var SDK_VERSION = "4.2.1";
4987
4989
 
4988
4990
  // src/helpers/sdk-headers.ts
4989
4991
  var getSdkHeaders = () => ({
@@ -6501,6 +6503,18 @@ function register(type, info) {
6501
6503
  }
6502
6504
  }
6503
6505
  }
6506
+ function registerAction(action) {
6507
+ if (isBrowser()) {
6508
+ const actionClone = JSON.parse(JSON.stringify(action));
6509
+ if (action.action) {
6510
+ actionClone.action = action.action.toString();
6511
+ }
6512
+ window.parent?.postMessage({
6513
+ type: "builder.registerAction",
6514
+ data: actionClone
6515
+ }, "*");
6516
+ }
6517
+ }
6504
6518
 
6505
6519
  // src/functions/set-editor-settings.ts
6506
6520
  var settings = {};
@@ -6557,6 +6571,7 @@ export {
6557
6571
  isEditing,
6558
6572
  isPreviewing,
6559
6573
  register,
6574
+ registerAction,
6560
6575
  setClientUserAttributes,
6561
6576
  setEditorSettings,
6562
6577
  subscribeToEditor,
package/lib/edge/dev.js CHANGED
@@ -7693,9 +7693,9 @@ function logFetch(url) {
7693
7693
  }
7694
7694
 
7695
7695
  // src/blocks/form/form/form.tsx
7696
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
7696
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
7697
7697
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
7698
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
7698
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
7699
7699
  padding: 10px;
7700
7700
  color: red;
7701
7701
  text-align: center;
@@ -7732,13 +7732,13 @@ function FormComponent(props) {
7732
7732
  const headers = props.customHeaders || {};
7733
7733
  let body;
7734
7734
  const formData = new FormData(el);
7735
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
7735
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
7736
7736
  let value;
7737
7737
  const key = el2.name;
7738
7738
  if (el2 instanceof HTMLInputElement) {
7739
7739
  if (el2.type === "radio") {
7740
7740
  if (el2.checked) {
7741
- value = el2.name;
7741
+ value = el2.value;
7742
7742
  return {
7743
7743
  key,
7744
7744
  value
@@ -8683,7 +8683,7 @@ function getPreviewContent(_searchParams) {
8683
8683
  }
8684
8684
 
8685
8685
  // src/constants/sdk-version.ts
8686
- var SDK_VERSION = "4.2.0";
8686
+ var SDK_VERSION = "4.2.1";
8687
8687
 
8688
8688
  // src/helpers/sdk-headers.ts
8689
8689
  var getSdkHeaders = () => ({
@@ -10398,6 +10398,18 @@ function register(type, info) {
10398
10398
  }
10399
10399
  }
10400
10400
  }
10401
+ function registerAction(action) {
10402
+ if (isBrowser()) {
10403
+ const actionClone = JSON.parse(JSON.stringify(action));
10404
+ if (action.action) {
10405
+ actionClone.action = action.action.toString();
10406
+ }
10407
+ window.parent?.postMessage({
10408
+ type: "builder.registerAction",
10409
+ data: actionClone
10410
+ }, "*");
10411
+ }
10412
+ }
10401
10413
 
10402
10414
  // src/functions/set-editor-settings.ts
10403
10415
  var settings = {};
@@ -10434,4 +10446,4 @@ var fetchBuilderProps = async (_args) => {
10434
10446
  };
10435
10447
  };
10436
10448
 
10437
- 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 };
10449
+ 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/edge/dev.jsx CHANGED
@@ -7335,13 +7335,15 @@ function FormComponent(props) {
7335
7335
  const headers = props.customHeaders || {};
7336
7336
  let body;
7337
7337
  const formData = new FormData(el);
7338
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
7338
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
7339
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
7340
+ ).map((el2) => {
7339
7341
  let value;
7340
7342
  const key = el2.name;
7341
7343
  if (el2 instanceof HTMLInputElement) {
7342
7344
  if (el2.type === "radio") {
7343
7345
  if (el2.checked) {
7344
- value = el2.name;
7346
+ value = el2.value;
7345
7347
  return {
7346
7348
  key,
7347
7349
  value
@@ -7534,14 +7536,14 @@ function FormComponent(props) {
7534
7536
  blocks={props.sendingMessage}
7535
7537
  context={props.builderContext}
7536
7538
  /></Show12>
7537
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
7539
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
7538
7540
  <Show12 when={submissionState() === "success"}><Blocks_default
7539
7541
  path="successMessage"
7540
7542
  blocks={props.successMessage}
7541
7543
  context={props.builderContext}
7542
7544
  /></Show12>
7543
7545
  </form>
7544
- <style>{`.pre-7430044e {
7546
+ <style>{`.pre-fdf23968 {
7545
7547
  padding: 10px;
7546
7548
  color: red;
7547
7549
  text-align: center;
@@ -8177,7 +8179,7 @@ function getPreviewContent(_searchParams) {
8177
8179
  }
8178
8180
 
8179
8181
  // src/constants/sdk-version.ts
8180
- var SDK_VERSION = "4.2.0";
8182
+ var SDK_VERSION = "4.2.1";
8181
8183
 
8182
8184
  // src/helpers/sdk-headers.ts
8183
8185
  var getSdkHeaders = () => ({
@@ -9706,6 +9708,18 @@ function register(type, info) {
9706
9708
  }
9707
9709
  }
9708
9710
  }
9711
+ function registerAction(action) {
9712
+ if (isBrowser()) {
9713
+ const actionClone = JSON.parse(JSON.stringify(action));
9714
+ if (action.action) {
9715
+ actionClone.action = action.action.toString();
9716
+ }
9717
+ window.parent?.postMessage({
9718
+ type: "builder.registerAction",
9719
+ data: actionClone
9720
+ }, "*");
9721
+ }
9722
+ }
9709
9723
 
9710
9724
  // src/functions/set-editor-settings.ts
9711
9725
  var settings = {};
@@ -9762,6 +9776,7 @@ export {
9762
9776
  isEditing,
9763
9777
  isPreviewing,
9764
9778
  register,
9779
+ registerAction,
9765
9780
  setClientUserAttributes,
9766
9781
  setEditorSettings,
9767
9782
  subscribeToEditor,
package/lib/edge/index.js CHANGED
@@ -7682,9 +7682,9 @@ function logFetch(url) {
7682
7682
  }
7683
7683
 
7684
7684
  // src/blocks/form/form/form.tsx
7685
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
7685
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
7686
7686
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
7687
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
7687
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
7688
7688
  padding: 10px;
7689
7689
  color: red;
7690
7690
  text-align: center;
@@ -7721,13 +7721,13 @@ function FormComponent(props) {
7721
7721
  const headers = props.customHeaders || {};
7722
7722
  let body;
7723
7723
  const formData = new FormData(el);
7724
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
7724
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
7725
7725
  let value;
7726
7726
  const key = el2.name;
7727
7727
  if (el2 instanceof HTMLInputElement) {
7728
7728
  if (el2.type === "radio") {
7729
7729
  if (el2.checked) {
7730
- value = el2.name;
7730
+ value = el2.value;
7731
7731
  return {
7732
7732
  key,
7733
7733
  value
@@ -8670,7 +8670,7 @@ function getPreviewContent(_searchParams) {
8670
8670
  }
8671
8671
 
8672
8672
  // src/constants/sdk-version.ts
8673
- var SDK_VERSION = "4.2.0";
8673
+ var SDK_VERSION = "4.2.1";
8674
8674
 
8675
8675
  // src/helpers/sdk-headers.ts
8676
8676
  var getSdkHeaders = () => ({
@@ -10378,6 +10378,18 @@ function register(type, info) {
10378
10378
  }
10379
10379
  }
10380
10380
  }
10381
+ function registerAction(action) {
10382
+ if (isBrowser()) {
10383
+ const actionClone = JSON.parse(JSON.stringify(action));
10384
+ if (action.action) {
10385
+ actionClone.action = action.action.toString();
10386
+ }
10387
+ window.parent?.postMessage({
10388
+ type: "builder.registerAction",
10389
+ data: actionClone
10390
+ }, "*");
10391
+ }
10392
+ }
10381
10393
 
10382
10394
  // src/functions/set-editor-settings.ts
10383
10395
  var settings = {};
@@ -10414,4 +10426,4 @@ var fetchBuilderProps = async (_args) => {
10414
10426
  };
10415
10427
  };
10416
10428
 
10417
- 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 };
10429
+ 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 };
@@ -7326,13 +7326,15 @@ function FormComponent(props) {
7326
7326
  const headers = props.customHeaders || {};
7327
7327
  let body;
7328
7328
  const formData = new FormData(el);
7329
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
7329
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
7330
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
7331
+ ).map((el2) => {
7330
7332
  let value;
7331
7333
  const key = el2.name;
7332
7334
  if (el2 instanceof HTMLInputElement) {
7333
7335
  if (el2.type === "radio") {
7334
7336
  if (el2.checked) {
7335
- value = el2.name;
7337
+ value = el2.value;
7336
7338
  return {
7337
7339
  key,
7338
7340
  value
@@ -7524,14 +7526,14 @@ function FormComponent(props) {
7524
7526
  blocks={props.sendingMessage}
7525
7527
  context={props.builderContext}
7526
7528
  /></Show12>
7527
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
7529
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
7528
7530
  <Show12 when={submissionState() === "success"}><Blocks_default
7529
7531
  path="successMessage"
7530
7532
  blocks={props.successMessage}
7531
7533
  context={props.builderContext}
7532
7534
  /></Show12>
7533
7535
  </form>
7534
- <style>{`.pre-7430044e {
7536
+ <style>{`.pre-fdf23968 {
7535
7537
  padding: 10px;
7536
7538
  color: red;
7537
7539
  text-align: center;
@@ -8166,7 +8168,7 @@ function getPreviewContent(_searchParams) {
8166
8168
  }
8167
8169
 
8168
8170
  // src/constants/sdk-version.ts
8169
- var SDK_VERSION = "4.2.0";
8171
+ var SDK_VERSION = "4.2.1";
8170
8172
 
8171
8173
  // src/helpers/sdk-headers.ts
8172
8174
  var getSdkHeaders = () => ({
@@ -9684,6 +9686,18 @@ function register(type, info) {
9684
9686
  }
9685
9687
  }
9686
9688
  }
9689
+ function registerAction(action) {
9690
+ if (isBrowser()) {
9691
+ const actionClone = JSON.parse(JSON.stringify(action));
9692
+ if (action.action) {
9693
+ actionClone.action = action.action.toString();
9694
+ }
9695
+ window.parent?.postMessage({
9696
+ type: "builder.registerAction",
9697
+ data: actionClone
9698
+ }, "*");
9699
+ }
9700
+ }
9687
9701
 
9688
9702
  // src/functions/set-editor-settings.ts
9689
9703
  var settings = {};
@@ -9740,6 +9754,7 @@ export {
9740
9754
  isEditing,
9741
9755
  isPreviewing,
9742
9756
  register,
9757
+ registerAction,
9743
9758
  setClientUserAttributes,
9744
9759
  setEditorSettings,
9745
9760
  subscribeToEditor,
package/lib/node/dev.js CHANGED
@@ -4681,9 +4681,9 @@ function logFetch(url) {
4681
4681
  }
4682
4682
 
4683
4683
  // src/blocks/form/form/form.tsx
4684
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4684
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
4685
4685
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4686
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4686
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
4687
4687
  padding: 10px;
4688
4688
  color: red;
4689
4689
  text-align: center;
@@ -4720,13 +4720,13 @@ function FormComponent(props) {
4720
4720
  const headers = props.customHeaders || {};
4721
4721
  let body;
4722
4722
  const formData = new FormData(el);
4723
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4723
+ 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
4724
  let value;
4725
4725
  const key = el2.name;
4726
4726
  if (el2 instanceof HTMLInputElement) {
4727
4727
  if (el2.type === "radio") {
4728
4728
  if (el2.checked) {
4729
- value = el2.name;
4729
+ value = el2.value;
4730
4730
  return {
4731
4731
  key,
4732
4732
  value
@@ -5671,7 +5671,7 @@ function getPreviewContent(_searchParams) {
5671
5671
  }
5672
5672
 
5673
5673
  // src/constants/sdk-version.ts
5674
- var SDK_VERSION = "4.2.0";
5674
+ var SDK_VERSION = "4.2.1";
5675
5675
 
5676
5676
  // src/helpers/sdk-headers.ts
5677
5677
  var getSdkHeaders = () => ({
@@ -7386,6 +7386,18 @@ function register(type, info) {
7386
7386
  }
7387
7387
  }
7388
7388
  }
7389
+ function registerAction(action) {
7390
+ if (isBrowser()) {
7391
+ const actionClone = JSON.parse(JSON.stringify(action));
7392
+ if (action.action) {
7393
+ actionClone.action = action.action.toString();
7394
+ }
7395
+ window.parent?.postMessage({
7396
+ type: "builder.registerAction",
7397
+ data: actionClone
7398
+ }, "*");
7399
+ }
7400
+ }
7389
7401
 
7390
7402
  // src/functions/set-editor-settings.ts
7391
7403
  var settings = {};
@@ -7422,4 +7434,4 @@ var fetchBuilderProps = async (_args) => {
7422
7434
  };
7423
7435
  };
7424
7436
 
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 };
7437
+ 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
@@ -4323,13 +4323,15 @@ function FormComponent(props) {
4323
4323
  const headers = props.customHeaders || {};
4324
4324
  let body;
4325
4325
  const formData = new FormData(el);
4326
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4326
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4327
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4328
+ ).map((el2) => {
4327
4329
  let value;
4328
4330
  const key = el2.name;
4329
4331
  if (el2 instanceof HTMLInputElement) {
4330
4332
  if (el2.type === "radio") {
4331
4333
  if (el2.checked) {
4332
- value = el2.name;
4334
+ value = el2.value;
4333
4335
  return {
4334
4336
  key,
4335
4337
  value
@@ -4522,14 +4524,14 @@ function FormComponent(props) {
4522
4524
  blocks={props.sendingMessage}
4523
4525
  context={props.builderContext}
4524
4526
  /></Show12>
4525
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4527
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4526
4528
  <Show12 when={submissionState() === "success"}><Blocks_default
4527
4529
  path="successMessage"
4528
4530
  blocks={props.successMessage}
4529
4531
  context={props.builderContext}
4530
4532
  /></Show12>
4531
4533
  </form>
4532
- <style>{`.pre-7430044e {
4534
+ <style>{`.pre-fdf23968 {
4533
4535
  padding: 10px;
4534
4536
  color: red;
4535
4537
  text-align: center;
@@ -5165,7 +5167,7 @@ function getPreviewContent(_searchParams) {
5165
5167
  }
5166
5168
 
5167
5169
  // src/constants/sdk-version.ts
5168
- var SDK_VERSION = "4.2.0";
5170
+ var SDK_VERSION = "4.2.1";
5169
5171
 
5170
5172
  // src/helpers/sdk-headers.ts
5171
5173
  var getSdkHeaders = () => ({
@@ -6694,6 +6696,18 @@ function register(type, info) {
6694
6696
  }
6695
6697
  }
6696
6698
  }
6699
+ function registerAction(action) {
6700
+ if (isBrowser()) {
6701
+ const actionClone = JSON.parse(JSON.stringify(action));
6702
+ if (action.action) {
6703
+ actionClone.action = action.action.toString();
6704
+ }
6705
+ window.parent?.postMessage({
6706
+ type: "builder.registerAction",
6707
+ data: actionClone
6708
+ }, "*");
6709
+ }
6710
+ }
6697
6711
 
6698
6712
  // src/functions/set-editor-settings.ts
6699
6713
  var settings = {};
@@ -6750,6 +6764,7 @@ export {
6750
6764
  isEditing,
6751
6765
  isPreviewing,
6752
6766
  register,
6767
+ registerAction,
6753
6768
  setClientUserAttributes,
6754
6769
  setEditorSettings,
6755
6770
  subscribeToEditor,
package/lib/node/index.js CHANGED
@@ -4670,9 +4670,9 @@ function logFetch(url) {
4670
4670
  }
4671
4671
 
4672
4672
  // src/blocks/form/form/form.tsx
4673
- var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-7430044e">`);
4673
+ var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
4674
4674
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
4675
- var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-7430044e {
4675
+ var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
4676
4676
  padding: 10px;
4677
4677
  color: red;
4678
4678
  text-align: center;
@@ -4709,13 +4709,13 @@ function FormComponent(props) {
4709
4709
  const headers = props.customHeaders || {};
4710
4710
  let body;
4711
4711
  const formData = new FormData(el);
4712
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4712
+ 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
4713
  let value;
4714
4714
  const key = el2.name;
4715
4715
  if (el2 instanceof HTMLInputElement) {
4716
4716
  if (el2.type === "radio") {
4717
4717
  if (el2.checked) {
4718
- value = el2.name;
4718
+ value = el2.value;
4719
4719
  return {
4720
4720
  key,
4721
4721
  value
@@ -5658,7 +5658,7 @@ function getPreviewContent(_searchParams) {
5658
5658
  }
5659
5659
 
5660
5660
  // src/constants/sdk-version.ts
5661
- var SDK_VERSION = "4.2.0";
5661
+ var SDK_VERSION = "4.2.1";
5662
5662
 
5663
5663
  // src/helpers/sdk-headers.ts
5664
5664
  var getSdkHeaders = () => ({
@@ -7366,6 +7366,18 @@ function register(type, info) {
7366
7366
  }
7367
7367
  }
7368
7368
  }
7369
+ function registerAction(action) {
7370
+ if (isBrowser()) {
7371
+ const actionClone = JSON.parse(JSON.stringify(action));
7372
+ if (action.action) {
7373
+ actionClone.action = action.action.toString();
7374
+ }
7375
+ window.parent?.postMessage({
7376
+ type: "builder.registerAction",
7377
+ data: actionClone
7378
+ }, "*");
7379
+ }
7380
+ }
7369
7381
 
7370
7382
  // src/functions/set-editor-settings.ts
7371
7383
  var settings = {};
@@ -7402,4 +7414,4 @@ var fetchBuilderProps = async (_args) => {
7402
7414
  };
7403
7415
  };
7404
7416
 
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 };
7417
+ 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 };
@@ -4314,13 +4314,15 @@ function FormComponent(props) {
4314
4314
  const headers = props.customHeaders || {};
4315
4315
  let body;
4316
4316
  const formData = new FormData(el);
4317
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
4317
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
4318
+ (el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
4319
+ ).map((el2) => {
4318
4320
  let value;
4319
4321
  const key = el2.name;
4320
4322
  if (el2 instanceof HTMLInputElement) {
4321
4323
  if (el2.type === "radio") {
4322
4324
  if (el2.checked) {
4323
- value = el2.name;
4325
+ value = el2.value;
4324
4326
  return {
4325
4327
  key,
4326
4328
  value
@@ -4512,14 +4514,14 @@ function FormComponent(props) {
4512
4514
  blocks={props.sendingMessage}
4513
4515
  context={props.builderContext}
4514
4516
  /></Show12>
4515
- <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-7430044e">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4517
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4516
4518
  <Show12 when={submissionState() === "success"}><Blocks_default
4517
4519
  path="successMessage"
4518
4520
  blocks={props.successMessage}
4519
4521
  context={props.builderContext}
4520
4522
  /></Show12>
4521
4523
  </form>
4522
- <style>{`.pre-7430044e {
4524
+ <style>{`.pre-fdf23968 {
4523
4525
  padding: 10px;
4524
4526
  color: red;
4525
4527
  text-align: center;
@@ -5154,7 +5156,7 @@ function getPreviewContent(_searchParams) {
5154
5156
  }
5155
5157
 
5156
5158
  // src/constants/sdk-version.ts
5157
- var SDK_VERSION = "4.2.0";
5159
+ var SDK_VERSION = "4.2.1";
5158
5160
 
5159
5161
  // src/helpers/sdk-headers.ts
5160
5162
  var getSdkHeaders = () => ({
@@ -6672,6 +6674,18 @@ function register(type, info) {
6672
6674
  }
6673
6675
  }
6674
6676
  }
6677
+ function registerAction(action) {
6678
+ if (isBrowser()) {
6679
+ const actionClone = JSON.parse(JSON.stringify(action));
6680
+ if (action.action) {
6681
+ actionClone.action = action.action.toString();
6682
+ }
6683
+ window.parent?.postMessage({
6684
+ type: "builder.registerAction",
6685
+ data: actionClone
6686
+ }, "*");
6687
+ }
6688
+ }
6675
6689
 
6676
6690
  // src/functions/set-editor-settings.ts
6677
6691
  var settings = {};
@@ -6728,6 +6742,7 @@ export {
6728
6742
  isEditing,
6729
6743
  isPreviewing,
6730
6744
  register,
6745
+ registerAction,
6731
6746
  setClientUserAttributes,
6732
6747
  setEditorSettings,
6733
6748
  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.1",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",