@builder.io/sdk-qwik 0.18.14 → 0.18.15

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.
@@ -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 && props.errorMessagePath) {
117
- let message = get.get(body2, props.errorMessagePath);
118
- if (message) {
119
- if (typeof message !== "string")
120
- message = JSON.stringify(message);
121
- state.formErrorMessage = message;
122
- mergeNewRootState(props, state, formRef, {
123
- formErrorMessage: message
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 && props.errorMessagePath) {
115
- let message = get(body2, props.errorMessagePath);
116
- if (message) {
117
- if (typeof message !== "string")
118
- message = JSON.stringify(message);
119
- state.formErrorMessage = message;
120
- mergeNewRootState(props, state, formRef, {
121
- formErrorMessage: message
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";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.18.14";
3
+ const SDK_VERSION = "0.18.15";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.18.14";
1
+ const SDK_VERSION = "0.18.15";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -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 && props.errorMessagePath) {
117
- let message = get.get(body2, props.errorMessagePath);
118
- if (message) {
119
- if (typeof message !== "string")
120
- message = JSON.stringify(message);
121
- state.formErrorMessage = message;
122
- mergeNewRootState(props, state, formRef, {
123
- formErrorMessage: message
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 && props.errorMessagePath) {
115
- let message = get(body2, props.errorMessagePath);
116
- if (message) {
117
- if (typeof message !== "string")
118
- message = JSON.stringify(message);
119
- state.formErrorMessage = message;
120
- mergeNewRootState(props, state, formRef, {
121
- formErrorMessage: message
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";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.18.14";
3
+ const SDK_VERSION = "0.18.15";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.18.14";
1
+ const SDK_VERSION = "0.18.15";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -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 && props.errorMessagePath) {
117
- let message = get.get(body2, props.errorMessagePath);
118
- if (message) {
119
- if (typeof message !== "string")
120
- message = JSON.stringify(message);
121
- state.formErrorMessage = message;
122
- mergeNewRootState(props, state, formRef, {
123
- formErrorMessage: message
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 && props.errorMessagePath) {
115
- let message = get(body2, props.errorMessagePath);
116
- if (message) {
117
- if (typeof message !== "string")
118
- message = JSON.stringify(message);
119
- state.formErrorMessage = message;
120
- mergeNewRootState(props, state, formRef, {
121
- formErrorMessage: message
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";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.18.14";
3
+ const SDK_VERSION = "0.18.15";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.18.14";
1
+ const SDK_VERSION = "0.18.15";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.18.14",
3
+ "version": "0.18.15",
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.18.14";
1
+ export declare const SDK_VERSION = "0.18.15";