@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.
- package/lib/browser/blocks/form/form/form.qwik.cjs +2 -2
- package/lib/browser/blocks/form/form/form.qwik.mjs +2 -2
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/browser/functions/register.qwik.cjs +13 -0
- package/lib/browser/functions/register.qwik.mjs +14 -1
- package/lib/browser/index.qwik.cjs +1 -0
- package/lib/browser/index.qwik.mjs +2 -1
- package/lib/edge/blocks/form/form/form.qwik.cjs +2 -2
- package/lib/edge/blocks/form/form/form.qwik.mjs +2 -2
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/functions/register.qwik.cjs +13 -0
- package/lib/edge/functions/register.qwik.mjs +14 -1
- package/lib/edge/index.qwik.cjs +1 -0
- package/lib/edge/index.qwik.mjs +2 -1
- package/lib/node/blocks/form/form/form.qwik.cjs +2 -2
- package/lib/node/blocks/form/form/form.qwik.mjs +2 -2
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/functions/register.qwik.cjs +13 -0
- package/lib/node/functions/register.qwik.mjs +14 -1
- package/lib/node/index.qwik.cjs +1 -0
- package/lib/node/index.qwik.mjs +2 -1
- package/package.json +1 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/functions/register.d.ts +18 -0
- package/types/src/server-index.d.ts +1 -1
|
@@ -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.
|
|
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.
|
|
43
|
+
value = el2.value;
|
|
44
44
|
return {
|
|
45
45
|
key,
|
|
46
46
|
value
|
|
@@ -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.
|
|
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.
|
|
43
|
+
value = el2.value;
|
|
44
44
|
return {
|
|
45
45
|
key,
|
|
46
46
|
value
|
|
@@ -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
|
};
|
package/lib/edge/index.qwik.cjs
CHANGED
|
@@ -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;
|
package/lib/edge/index.qwik.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
43
|
+
value = el2.value;
|
|
44
44
|
return {
|
|
45
45
|
key,
|
|
46
46
|
value
|
|
@@ -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
|
};
|
package/lib/node/index.qwik.cjs
CHANGED
|
@@ -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;
|
package/lib/node/index.qwik.mjs
CHANGED
|
@@ -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 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.20.
|
|
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';
|