@builder.io/sdk-qwik 0.20.0 → 0.20.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.
@@ -36,13 +36,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
36
36
  const headers = props.customHeaders || {};
37
37
  let body;
38
38
  const formData = new FormData(el);
39
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
39
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
40
40
  let value;
41
41
  const key = el2.name;
42
42
  if (el2 instanceof HTMLInputElement) {
43
43
  if (el2.type === "radio") {
44
44
  if (el2.checked) {
45
- value = el2.name;
45
+ value = el2.value;
46
46
  return {
47
47
  key,
48
48
  value
@@ -34,13 +34,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
34
34
  const headers = props.customHeaders || {};
35
35
  let body;
36
36
  const formData = new FormData(el);
37
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
37
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
38
38
  let value;
39
39
  const key = el2.name;
40
40
  if (el2 instanceof HTMLInputElement) {
41
41
  if (el2.type === "radio") {
42
42
  if (el2.checked) {
43
- value = el2.name;
43
+ value = el2.value;
44
44
  return {
45
45
  key,
46
46
  value
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.20.0";
3
+ const SDK_VERSION = "0.20.1";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.20.0";
1
+ const SDK_VERSION = "0.20.1";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -27,4 +27,17 @@ function register(type, info) {
27
27
  }
28
28
  }
29
29
  }
30
+ function registerAction(action) {
31
+ var _a;
32
+ if (isBrowser.isBrowser()) {
33
+ const actionClone = JSON.parse(JSON.stringify(action));
34
+ if (action.action)
35
+ actionClone.action = action.action.toString();
36
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
37
+ type: "builder.registerAction",
38
+ data: actionClone
39
+ }, "*");
40
+ }
41
+ }
30
42
  exports.register = register;
43
+ exports.registerAction = registerAction;
@@ -25,6 +25,19 @@ function register(type, info) {
25
25
  }
26
26
  }
27
27
  }
28
+ function registerAction(action) {
29
+ var _a;
30
+ if (isBrowser()) {
31
+ const actionClone = JSON.parse(JSON.stringify(action));
32
+ if (action.action)
33
+ actionClone.action = action.action.toString();
34
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
35
+ type: "builder.registerAction",
36
+ data: actionClone
37
+ }, "*");
38
+ }
39
+ }
28
40
  export {
29
- register
41
+ register,
42
+ registerAction
30
43
  };
@@ -38,6 +38,7 @@ exports.isEditing = isEditing.isEditing;
38
38
  exports.isPreviewing = isPreviewing.isPreviewing;
39
39
  exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
40
40
  exports.register = register.register;
41
+ exports.registerAction = register.registerAction;
41
42
  exports.setEditorSettings = setEditorSettings.setEditorSettings;
42
43
  exports.getBuilderSearchParams = index.getBuilderSearchParams;
43
44
  exports.track = index$1.track;
@@ -13,7 +13,7 @@ import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
13
13
  import { isEditing } from "./functions/is-editing.qwik.mjs";
14
14
  import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
15
15
  import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
16
- import { register } from "./functions/register.qwik.mjs";
16
+ import { register, registerAction } from "./functions/register.qwik.mjs";
17
17
  import { setEditorSettings } from "./functions/set-editor-settings.qwik.mjs";
18
18
  import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.qwik.mjs";
19
19
  import { track } from "./functions/track/index.qwik.mjs";
@@ -41,6 +41,7 @@ export {
41
41
  isEditing,
42
42
  isPreviewing,
43
43
  register,
44
+ registerAction,
44
45
  setClientUserAttributes,
45
46
  setEditorSettings,
46
47
  subscribeToEditor,
@@ -36,13 +36,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
36
36
  const headers = props.customHeaders || {};
37
37
  let body;
38
38
  const formData = new FormData(el);
39
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
39
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
40
40
  let value;
41
41
  const key = el2.name;
42
42
  if (el2 instanceof HTMLInputElement) {
43
43
  if (el2.type === "radio") {
44
44
  if (el2.checked) {
45
- value = el2.name;
45
+ value = el2.value;
46
46
  return {
47
47
  key,
48
48
  value
@@ -34,13 +34,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
34
34
  const headers = props.customHeaders || {};
35
35
  let body;
36
36
  const formData = new FormData(el);
37
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
37
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
38
38
  let value;
39
39
  const key = el2.name;
40
40
  if (el2 instanceof HTMLInputElement) {
41
41
  if (el2.type === "radio") {
42
42
  if (el2.checked) {
43
- value = el2.name;
43
+ value = el2.value;
44
44
  return {
45
45
  key,
46
46
  value
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.20.0";
3
+ const SDK_VERSION = "0.20.1";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.20.0";
1
+ const SDK_VERSION = "0.20.1";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -27,4 +27,17 @@ function register(type, info) {
27
27
  }
28
28
  }
29
29
  }
30
+ function registerAction(action) {
31
+ var _a;
32
+ if (isBrowser.isBrowser()) {
33
+ const actionClone = JSON.parse(JSON.stringify(action));
34
+ if (action.action)
35
+ actionClone.action = action.action.toString();
36
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
37
+ type: "builder.registerAction",
38
+ data: actionClone
39
+ }, "*");
40
+ }
41
+ }
30
42
  exports.register = register;
43
+ exports.registerAction = registerAction;
@@ -25,6 +25,19 @@ function register(type, info) {
25
25
  }
26
26
  }
27
27
  }
28
+ function registerAction(action) {
29
+ var _a;
30
+ if (isBrowser()) {
31
+ const actionClone = JSON.parse(JSON.stringify(action));
32
+ if (action.action)
33
+ actionClone.action = action.action.toString();
34
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
35
+ type: "builder.registerAction",
36
+ data: actionClone
37
+ }, "*");
38
+ }
39
+ }
28
40
  export {
29
- register
41
+ register,
42
+ registerAction
30
43
  };
@@ -38,6 +38,7 @@ exports.isEditing = isEditing.isEditing;
38
38
  exports.isPreviewing = isPreviewing.isPreviewing;
39
39
  exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
40
40
  exports.register = register.register;
41
+ exports.registerAction = register.registerAction;
41
42
  exports.setEditorSettings = setEditorSettings.setEditorSettings;
42
43
  exports.getBuilderSearchParams = index.getBuilderSearchParams;
43
44
  exports.track = index$1.track;
@@ -13,7 +13,7 @@ import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
13
13
  import { isEditing } from "./functions/is-editing.qwik.mjs";
14
14
  import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
15
15
  import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
16
- import { register } from "./functions/register.qwik.mjs";
16
+ import { register, registerAction } from "./functions/register.qwik.mjs";
17
17
  import { setEditorSettings } from "./functions/set-editor-settings.qwik.mjs";
18
18
  import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.qwik.mjs";
19
19
  import { track } from "./functions/track/index.qwik.mjs";
@@ -41,6 +41,7 @@ export {
41
41
  isEditing,
42
42
  isPreviewing,
43
43
  register,
44
+ registerAction,
44
45
  setClientUserAttributes,
45
46
  setEditorSettings,
46
47
  subscribeToEditor,
@@ -36,13 +36,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
36
36
  const headers = props.customHeaders || {};
37
37
  let body;
38
38
  const formData = new FormData(el);
39
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
39
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
40
40
  let value;
41
41
  const key = el2.name;
42
42
  if (el2 instanceof HTMLInputElement) {
43
43
  if (el2.type === "radio") {
44
44
  if (el2.checked) {
45
- value = el2.name;
45
+ value = el2.value;
46
46
  return {
47
47
  key,
48
48
  value
@@ -34,13 +34,13 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
34
34
  const headers = props.customHeaders || {};
35
35
  let body;
36
36
  const formData = new FormData(el);
37
- const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
37
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
38
38
  let value;
39
39
  const key = el2.name;
40
40
  if (el2 instanceof HTMLInputElement) {
41
41
  if (el2.type === "radio") {
42
42
  if (el2.checked) {
43
- value = el2.name;
43
+ value = el2.value;
44
44
  return {
45
45
  key,
46
46
  value
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.20.0";
3
+ const SDK_VERSION = "0.20.1";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.20.0";
1
+ const SDK_VERSION = "0.20.1";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -27,4 +27,17 @@ function register(type, info) {
27
27
  }
28
28
  }
29
29
  }
30
+ function registerAction(action) {
31
+ var _a;
32
+ if (isBrowser.isBrowser()) {
33
+ const actionClone = JSON.parse(JSON.stringify(action));
34
+ if (action.action)
35
+ actionClone.action = action.action.toString();
36
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
37
+ type: "builder.registerAction",
38
+ data: actionClone
39
+ }, "*");
40
+ }
41
+ }
30
42
  exports.register = register;
43
+ exports.registerAction = registerAction;
@@ -25,6 +25,19 @@ function register(type, info) {
25
25
  }
26
26
  }
27
27
  }
28
+ function registerAction(action) {
29
+ var _a;
30
+ if (isBrowser()) {
31
+ const actionClone = JSON.parse(JSON.stringify(action));
32
+ if (action.action)
33
+ actionClone.action = action.action.toString();
34
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
35
+ type: "builder.registerAction",
36
+ data: actionClone
37
+ }, "*");
38
+ }
39
+ }
28
40
  export {
29
- register
41
+ register,
42
+ registerAction
30
43
  };
@@ -38,6 +38,7 @@ exports.isEditing = isEditing.isEditing;
38
38
  exports.isPreviewing = isPreviewing.isPreviewing;
39
39
  exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
40
40
  exports.register = register.register;
41
+ exports.registerAction = register.registerAction;
41
42
  exports.setEditorSettings = setEditorSettings.setEditorSettings;
42
43
  exports.getBuilderSearchParams = index.getBuilderSearchParams;
43
44
  exports.track = index$1.track;
@@ -13,7 +13,7 @@ import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
13
13
  import { isEditing } from "./functions/is-editing.qwik.mjs";
14
14
  import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
15
15
  import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
16
- import { register } from "./functions/register.qwik.mjs";
16
+ import { register, registerAction } from "./functions/register.qwik.mjs";
17
17
  import { setEditorSettings } from "./functions/set-editor-settings.qwik.mjs";
18
18
  import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.qwik.mjs";
19
19
  import { track } from "./functions/track/index.qwik.mjs";
@@ -41,6 +41,7 @@ export {
41
41
  isEditing,
42
42
  isPreviewing,
43
43
  register,
44
+ registerAction,
44
45
  setClientUserAttributes,
45
46
  setEditorSettings,
46
47
  subscribeToEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/qwik",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.20.0";
1
+ export declare const SDK_VERSION = "0.20.1";
@@ -1,5 +1,22 @@
1
1
  import type { BuilderBlock } from '../types/builder-block';
2
2
  import type { DeepPartial } from '../types/deep-partial';
3
+ import type { Input } from '../types/input';
4
+ export interface Action {
5
+ name: string;
6
+ inputs?: readonly Input[];
7
+ returnType?: Input;
8
+ action: (options: Record<string, any>) => string;
9
+ /**
10
+ * Is an action for expression (e.g. calculating a binding like a formula
11
+ * to fill a value based on locale) or a function (e.g. something to trigger
12
+ * on an event like add to cart) or either (e.g. a custom code block)
13
+ */
14
+ kind: 'expression' | 'function' | 'any';
15
+ /**
16
+ * Globally unique ID for an action, e.g. "@builder.io:setState"
17
+ */
18
+ id: string;
19
+ }
3
20
  export interface InsertMenuItem {
4
21
  name: string;
5
22
  icon?: string;
@@ -14,3 +31,4 @@ export interface InsertMenuConfig {
14
31
  }
15
32
  export declare function register(type: 'insertMenu', info: InsertMenuConfig): void;
16
33
  export declare function register(type: string, info: any): void;
34
+ export declare function registerAction(action: Action): void;
@@ -25,7 +25,7 @@ export type { ComponentInfo } from './types/components';
25
25
  export { isEditing } from './functions/is-editing';
26
26
  export { isPreviewing } from './functions/is-previewing';
27
27
  export { createRegisterComponentMessage } from './functions/register-component';
28
- export { register } from './functions/register';
28
+ export { register, registerAction } from './functions/register';
29
29
  export type { InsertMenuConfig, InsertMenuItem } from './functions/register';
30
30
  export { setEditorSettings } from './functions/set-editor-settings';
31
31
  export type { Settings } from './functions/set-editor-settings';