rankrunners-cms 0.0.39 → 0.0.41

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rankrunners-cms",
3
3
  "type": "module",
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "peerDependencies": {
6
6
  "@puckeditor/core": "^0.21.1",
7
7
  "@tanstack/react-router": "^1.166.7",
@@ -10,7 +10,7 @@ import {
10
10
  type SendFormFillResult,
11
11
  SendFormFillResultType,
12
12
  } from "../types/form-fills";
13
- import { fromValibot } from "src/libs/valibot-serialize";
13
+ import { fromValibot } from "../../libs/valibot-serialize";
14
14
 
15
15
  export type SendFormFillArgs<
16
16
  A,
@@ -77,19 +77,21 @@ export const sendFormFill = async <
77
77
  return { response: SendFormFillResultType.Success };
78
78
  }
79
79
 
80
+ const responseText = await response.text();
81
+
82
+ if (responseText.includes("validation")) {
83
+ return { response: SendFormFillResultType.ValidationError };
84
+ }
85
+
86
+ if (responseText.includes("captcha")) {
87
+ return { response: SendFormFillResultType.CaptchaError };
88
+ }
89
+
80
90
  console.error("Form fill submission failed with status:", response.status);
81
91
  console.error("Form fill submission:", data);
82
92
  return { response: SendFormFillResultType.UnknownError };
83
93
  } catch (error) {
84
94
  console.error("Error sending form fill:", error);
85
- if (error instanceof Error) {
86
- if (error.message.includes("validation")) {
87
- return { response: SendFormFillResultType.ValidationError };
88
- }
89
- if (error.message.includes("captcha")) {
90
- return { response: SendFormFillResultType.CaptchaError };
91
- }
92
- }
93
95
  if (error instanceof TypeError) {
94
96
  // fetch throws TypeError on network failure
95
97
  return { response: SendFormFillResultType.NetworkError };