@builder.io/sdk-qwik 0.18.14 → 0.19.0
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 +30 -9
- package/lib/browser/blocks/form/form/form.qwik.mjs +30 -9
- package/lib/browser/blocks/img/img.qwik.cjs +15 -0
- package/lib/browser/blocks/img/img.qwik.mjs +16 -1
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/blocks/form/form/form.qwik.cjs +30 -9
- package/lib/edge/blocks/form/form/form.qwik.mjs +30 -9
- package/lib/edge/blocks/img/img.qwik.cjs +15 -0
- package/lib/edge/blocks/img/img.qwik.mjs +16 -1
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/blocks/form/form/form.qwik.cjs +30 -9
- package/lib/node/blocks/form/form/form.qwik.mjs +30 -9
- package/lib/node/blocks/img/img.qwik.cjs +15 -0
- package/lib/node/blocks/img/img.qwik.mjs +16 -1
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/package.json +1 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
|
@@ -99,6 +99,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
state.formState = "sending";
|
|
102
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
103
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
104
|
+
console.error(message);
|
|
105
|
+
state.formState = "error";
|
|
106
|
+
mergeNewRootState(props, state, formRef, {
|
|
107
|
+
formErrorMessage: message
|
|
108
|
+
});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
102
111
|
const formUrl = `${getEnv.getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
103
112
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
104
113
|
logFetch.logFetch(url);
|
|
@@ -113,16 +122,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
113
122
|
body2 = await res.json();
|
|
114
123
|
else
|
|
115
124
|
body2 = await res.text();
|
|
116
|
-
if (!res.ok
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
if (!res.ok) {
|
|
126
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
127
|
+
detail: {
|
|
128
|
+
error: body2,
|
|
129
|
+
status: res.status
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (formRef.value.nativeElement) {
|
|
133
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
134
|
+
if (submitErrorEvent.defaultPrevented)
|
|
135
|
+
return;
|
|
125
136
|
}
|
|
137
|
+
state.responseData = body2;
|
|
138
|
+
state.formState = "error";
|
|
139
|
+
let message = props.errorMessagePath ? get.get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
140
|
+
if (typeof message !== "string")
|
|
141
|
+
message = JSON.stringify(message);
|
|
142
|
+
state.formErrorMessage = message;
|
|
143
|
+
mergeNewRootState(props, state, formRef, {
|
|
144
|
+
formErrorMessage: message
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
126
147
|
}
|
|
127
148
|
state.responseData = body2;
|
|
128
149
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -97,6 +97,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
state.formState = "sending";
|
|
100
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
101
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
102
|
+
console.error(message);
|
|
103
|
+
state.formState = "error";
|
|
104
|
+
mergeNewRootState(props, state, formRef, {
|
|
105
|
+
formErrorMessage: message
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
100
109
|
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
101
110
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
102
111
|
logFetch(url);
|
|
@@ -111,16 +120,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
111
120
|
body2 = await res.json();
|
|
112
121
|
else
|
|
113
122
|
body2 = await res.text();
|
|
114
|
-
if (!res.ok
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (!res.ok) {
|
|
124
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
125
|
+
detail: {
|
|
126
|
+
error: body2,
|
|
127
|
+
status: res.status
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (formRef.value.nativeElement) {
|
|
131
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
132
|
+
if (submitErrorEvent.defaultPrevented)
|
|
133
|
+
return;
|
|
123
134
|
}
|
|
135
|
+
state.responseData = body2;
|
|
136
|
+
state.formState = "error";
|
|
137
|
+
let message = props.errorMessagePath ? get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
138
|
+
if (typeof message !== "string")
|
|
139
|
+
message = JSON.stringify(message);
|
|
140
|
+
state.formErrorMessage = message;
|
|
141
|
+
mergeNewRootState(props, state, formRef, {
|
|
142
|
+
formErrorMessage: message
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
124
145
|
}
|
|
125
146
|
state.responseData = body2;
|
|
126
147
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
4
|
const isEditing = require("../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const image_helpers = require("../image/image.helpers.qwik.cjs");
|
|
5
6
|
const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
7
|
+
const srcSetToUse = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
8
|
+
const [props2] = qwik.useLexicalScope();
|
|
9
|
+
const url = props2.imgSrc || props2.image;
|
|
10
|
+
if (!url || typeof url !== "string")
|
|
11
|
+
return void 0;
|
|
12
|
+
if (!url.match(/builder\.io/))
|
|
13
|
+
return void 0;
|
|
14
|
+
return image_helpers.getSrcSet(url);
|
|
15
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
16
|
+
props
|
|
17
|
+
]));
|
|
6
18
|
return /* @__PURE__ */ qwik._jsxS("img", {
|
|
7
19
|
...props.attributes
|
|
8
20
|
}, {
|
|
@@ -12,6 +24,9 @@ const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
12
24
|
src: qwik._fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
13
25
|
props
|
|
14
26
|
], "p0.imgSrc||p0.image"),
|
|
27
|
+
srcSet: qwik._fnSignal((p0) => p0.value, [
|
|
28
|
+
srcSetToUse
|
|
29
|
+
], "p0.value"),
|
|
15
30
|
style: qwik._fnSignal((p0) => ({
|
|
16
31
|
objectFit: p0.backgroundSize || "cover",
|
|
17
32
|
objectPosition: p0.backgroundPosition || "center"
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, useComputedQrl, useLexicalScope, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { getSrcSet } from "../image/image.helpers.qwik.mjs";
|
|
3
4
|
const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
5
|
+
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
6
|
+
const [props2] = useLexicalScope();
|
|
7
|
+
const url = props2.imgSrc || props2.image;
|
|
8
|
+
if (!url || typeof url !== "string")
|
|
9
|
+
return void 0;
|
|
10
|
+
if (!url.match(/builder\.io/))
|
|
11
|
+
return void 0;
|
|
12
|
+
return getSrcSet(url);
|
|
13
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
14
|
+
props
|
|
15
|
+
]));
|
|
4
16
|
return /* @__PURE__ */ _jsxS("img", {
|
|
5
17
|
...props.attributes
|
|
6
18
|
}, {
|
|
@@ -10,6 +22,9 @@ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
10
22
|
src: _fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
11
23
|
props
|
|
12
24
|
], "p0.imgSrc||p0.image"),
|
|
25
|
+
srcSet: _fnSignal((p0) => p0.value, [
|
|
26
|
+
srcSetToUse
|
|
27
|
+
], "p0.value"),
|
|
13
28
|
style: _fnSignal((p0) => ({
|
|
14
29
|
objectFit: p0.backgroundSize || "cover",
|
|
15
30
|
objectPosition: p0.backgroundPosition || "center"
|
|
@@ -99,6 +99,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
state.formState = "sending";
|
|
102
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
103
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
104
|
+
console.error(message);
|
|
105
|
+
state.formState = "error";
|
|
106
|
+
mergeNewRootState(props, state, formRef, {
|
|
107
|
+
formErrorMessage: message
|
|
108
|
+
});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
102
111
|
const formUrl = `${getEnv.getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
103
112
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
104
113
|
logFetch.logFetch(url);
|
|
@@ -113,16 +122,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
113
122
|
body2 = await res.json();
|
|
114
123
|
else
|
|
115
124
|
body2 = await res.text();
|
|
116
|
-
if (!res.ok
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
if (!res.ok) {
|
|
126
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
127
|
+
detail: {
|
|
128
|
+
error: body2,
|
|
129
|
+
status: res.status
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (formRef.value.nativeElement) {
|
|
133
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
134
|
+
if (submitErrorEvent.defaultPrevented)
|
|
135
|
+
return;
|
|
125
136
|
}
|
|
137
|
+
state.responseData = body2;
|
|
138
|
+
state.formState = "error";
|
|
139
|
+
let message = props.errorMessagePath ? get.get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
140
|
+
if (typeof message !== "string")
|
|
141
|
+
message = JSON.stringify(message);
|
|
142
|
+
state.formErrorMessage = message;
|
|
143
|
+
mergeNewRootState(props, state, formRef, {
|
|
144
|
+
formErrorMessage: message
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
126
147
|
}
|
|
127
148
|
state.responseData = body2;
|
|
128
149
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -97,6 +97,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
state.formState = "sending";
|
|
100
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
101
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
102
|
+
console.error(message);
|
|
103
|
+
state.formState = "error";
|
|
104
|
+
mergeNewRootState(props, state, formRef, {
|
|
105
|
+
formErrorMessage: message
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
100
109
|
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
101
110
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
102
111
|
logFetch(url);
|
|
@@ -111,16 +120,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
111
120
|
body2 = await res.json();
|
|
112
121
|
else
|
|
113
122
|
body2 = await res.text();
|
|
114
|
-
if (!res.ok
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (!res.ok) {
|
|
124
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
125
|
+
detail: {
|
|
126
|
+
error: body2,
|
|
127
|
+
status: res.status
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (formRef.value.nativeElement) {
|
|
131
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
132
|
+
if (submitErrorEvent.defaultPrevented)
|
|
133
|
+
return;
|
|
123
134
|
}
|
|
135
|
+
state.responseData = body2;
|
|
136
|
+
state.formState = "error";
|
|
137
|
+
let message = props.errorMessagePath ? get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
138
|
+
if (typeof message !== "string")
|
|
139
|
+
message = JSON.stringify(message);
|
|
140
|
+
state.formErrorMessage = message;
|
|
141
|
+
mergeNewRootState(props, state, formRef, {
|
|
142
|
+
formErrorMessage: message
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
124
145
|
}
|
|
125
146
|
state.responseData = body2;
|
|
126
147
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
4
|
const isEditing = require("../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const image_helpers = require("../image/image.helpers.qwik.cjs");
|
|
5
6
|
const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
7
|
+
const srcSetToUse = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
8
|
+
const [props2] = qwik.useLexicalScope();
|
|
9
|
+
const url = props2.imgSrc || props2.image;
|
|
10
|
+
if (!url || typeof url !== "string")
|
|
11
|
+
return void 0;
|
|
12
|
+
if (!url.match(/builder\.io/))
|
|
13
|
+
return void 0;
|
|
14
|
+
return image_helpers.getSrcSet(url);
|
|
15
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
16
|
+
props
|
|
17
|
+
]));
|
|
6
18
|
return /* @__PURE__ */ qwik._jsxS("img", {
|
|
7
19
|
...props.attributes
|
|
8
20
|
}, {
|
|
@@ -12,6 +24,9 @@ const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
12
24
|
src: qwik._fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
13
25
|
props
|
|
14
26
|
], "p0.imgSrc||p0.image"),
|
|
27
|
+
srcSet: qwik._fnSignal((p0) => p0.value, [
|
|
28
|
+
srcSetToUse
|
|
29
|
+
], "p0.value"),
|
|
15
30
|
style: qwik._fnSignal((p0) => ({
|
|
16
31
|
objectFit: p0.backgroundSize || "cover",
|
|
17
32
|
objectPosition: p0.backgroundPosition || "center"
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, useComputedQrl, useLexicalScope, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { getSrcSet } from "../image/image.helpers.qwik.mjs";
|
|
3
4
|
const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
5
|
+
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
6
|
+
const [props2] = useLexicalScope();
|
|
7
|
+
const url = props2.imgSrc || props2.image;
|
|
8
|
+
if (!url || typeof url !== "string")
|
|
9
|
+
return void 0;
|
|
10
|
+
if (!url.match(/builder\.io/))
|
|
11
|
+
return void 0;
|
|
12
|
+
return getSrcSet(url);
|
|
13
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
14
|
+
props
|
|
15
|
+
]));
|
|
4
16
|
return /* @__PURE__ */ _jsxS("img", {
|
|
5
17
|
...props.attributes
|
|
6
18
|
}, {
|
|
@@ -10,6 +22,9 @@ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
10
22
|
src: _fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
11
23
|
props
|
|
12
24
|
], "p0.imgSrc||p0.image"),
|
|
25
|
+
srcSet: _fnSignal((p0) => p0.value, [
|
|
26
|
+
srcSetToUse
|
|
27
|
+
], "p0.value"),
|
|
13
28
|
style: _fnSignal((p0) => ({
|
|
14
29
|
objectFit: p0.backgroundSize || "cover",
|
|
15
30
|
objectPosition: p0.backgroundPosition || "center"
|
|
@@ -99,6 +99,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
state.formState = "sending";
|
|
102
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
103
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
104
|
+
console.error(message);
|
|
105
|
+
state.formState = "error";
|
|
106
|
+
mergeNewRootState(props, state, formRef, {
|
|
107
|
+
formErrorMessage: message
|
|
108
|
+
});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
102
111
|
const formUrl = `${getEnv.getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
103
112
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
104
113
|
logFetch.logFetch(url);
|
|
@@ -113,16 +122,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
113
122
|
body2 = await res.json();
|
|
114
123
|
else
|
|
115
124
|
body2 = await res.text();
|
|
116
|
-
if (!res.ok
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
if (!res.ok) {
|
|
126
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
127
|
+
detail: {
|
|
128
|
+
error: body2,
|
|
129
|
+
status: res.status
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (formRef.value.nativeElement) {
|
|
133
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
134
|
+
if (submitErrorEvent.defaultPrevented)
|
|
135
|
+
return;
|
|
125
136
|
}
|
|
137
|
+
state.responseData = body2;
|
|
138
|
+
state.formState = "error";
|
|
139
|
+
let message = props.errorMessagePath ? get.get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
140
|
+
if (typeof message !== "string")
|
|
141
|
+
message = JSON.stringify(message);
|
|
142
|
+
state.formErrorMessage = message;
|
|
143
|
+
mergeNewRootState(props, state, formRef, {
|
|
144
|
+
formErrorMessage: message
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
126
147
|
}
|
|
127
148
|
state.responseData = body2;
|
|
128
149
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -97,6 +97,15 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
state.formState = "sending";
|
|
100
|
+
if (props.sendSubmissionsTo === "email" && (props.sendSubmissionsToEmail === "your@email.com" || !props.sendSubmissionsToEmail)) {
|
|
101
|
+
const message = "SubmissionsToEmail is required when sendSubmissionsTo is set to email";
|
|
102
|
+
console.error(message);
|
|
103
|
+
state.formState = "error";
|
|
104
|
+
mergeNewRootState(props, state, formRef, {
|
|
105
|
+
formErrorMessage: message
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
100
109
|
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
101
110
|
const url = props.sendSubmissionsTo === "email" ? formUrl : props.action;
|
|
102
111
|
logFetch(url);
|
|
@@ -111,16 +120,28 @@ const onSubmit = function onSubmit2(props, state, formRef, event) {
|
|
|
111
120
|
body2 = await res.json();
|
|
112
121
|
else
|
|
113
122
|
body2 = await res.text();
|
|
114
|
-
if (!res.ok
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (!res.ok) {
|
|
124
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
125
|
+
detail: {
|
|
126
|
+
error: body2,
|
|
127
|
+
status: res.status
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (formRef.value.nativeElement) {
|
|
131
|
+
formRef.value.nativeElement.dispatchEvent(submitErrorEvent);
|
|
132
|
+
if (submitErrorEvent.defaultPrevented)
|
|
133
|
+
return;
|
|
123
134
|
}
|
|
135
|
+
state.responseData = body2;
|
|
136
|
+
state.formState = "error";
|
|
137
|
+
let message = props.errorMessagePath ? get(body2, props.errorMessagePath) : body2.message || body2.error || body2;
|
|
138
|
+
if (typeof message !== "string")
|
|
139
|
+
message = JSON.stringify(message);
|
|
140
|
+
state.formErrorMessage = message;
|
|
141
|
+
mergeNewRootState(props, state, formRef, {
|
|
142
|
+
formErrorMessage: message
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
124
145
|
}
|
|
125
146
|
state.responseData = body2;
|
|
126
147
|
state.formState = res.ok ? "success" : "error";
|
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
4
|
const isEditing = require("../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const image_helpers = require("../image/image.helpers.qwik.cjs");
|
|
5
6
|
const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
7
|
+
const srcSetToUse = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
8
|
+
const [props2] = qwik.useLexicalScope();
|
|
9
|
+
const url = props2.imgSrc || props2.image;
|
|
10
|
+
if (!url || typeof url !== "string")
|
|
11
|
+
return void 0;
|
|
12
|
+
if (!url.match(/builder\.io/))
|
|
13
|
+
return void 0;
|
|
14
|
+
return image_helpers.getSrcSet(url);
|
|
15
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
16
|
+
props
|
|
17
|
+
]));
|
|
6
18
|
return /* @__PURE__ */ qwik._jsxS("img", {
|
|
7
19
|
...props.attributes
|
|
8
20
|
}, {
|
|
@@ -12,6 +24,9 @@ const ImgComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
12
24
|
src: qwik._fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
13
25
|
props
|
|
14
26
|
], "p0.imgSrc||p0.image"),
|
|
27
|
+
srcSet: qwik._fnSignal((p0) => p0.value, [
|
|
28
|
+
srcSetToUse
|
|
29
|
+
], "p0.value"),
|
|
15
30
|
style: qwik._fnSignal((p0) => ({
|
|
16
31
|
objectFit: p0.backgroundSize || "cover",
|
|
17
32
|
objectPosition: p0.backgroundPosition || "center"
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, useComputedQrl, useLexicalScope, _jsxS, _fnSignal } from "@builder.io/qwik";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { getSrcSet } from "../image/image.helpers.qwik.mjs";
|
|
3
4
|
const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
5
|
+
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
6
|
+
const [props2] = useLexicalScope();
|
|
7
|
+
const url = props2.imgSrc || props2.image;
|
|
8
|
+
if (!url || typeof url !== "string")
|
|
9
|
+
return void 0;
|
|
10
|
+
if (!url.match(/builder\.io/))
|
|
11
|
+
return void 0;
|
|
12
|
+
return getSrcSet(url);
|
|
13
|
+
}, "ImgComponent_component_srcSetToUse_useComputed_z7PUtkds7Q0", [
|
|
14
|
+
props
|
|
15
|
+
]));
|
|
4
16
|
return /* @__PURE__ */ _jsxS("img", {
|
|
5
17
|
...props.attributes
|
|
6
18
|
}, {
|
|
@@ -10,6 +22,9 @@ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
10
22
|
src: _fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
11
23
|
props
|
|
12
24
|
], "p0.imgSrc||p0.image"),
|
|
25
|
+
srcSet: _fnSignal((p0) => p0.value, [
|
|
26
|
+
srcSetToUse
|
|
27
|
+
], "p0.value"),
|
|
13
28
|
style: _fnSignal((p0) => ({
|
|
14
29
|
objectFit: p0.backgroundSize || "cover",
|
|
15
30
|
objectPosition: p0.backgroundPosition || "center"
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.19.0";
|