@pradip1995/segment-login-template 0.5.2 → 0.5.4
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-login-template",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@pradip1995/commerce-auth": "^4.0.0",
|
|
29
29
|
"@pradip1995/commerce-core": "^4.0.0",
|
|
30
30
|
"@pradip1995/plugin-sdk": "^0.2.0",
|
|
31
|
+
"next": ">=15",
|
|
31
32
|
"react": ">=19",
|
|
32
|
-
"react-dom": ">=19"
|
|
33
|
-
"next": ">=15"
|
|
33
|
+
"react-dom": ">=19"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@pradip1995/commerce-auth": "^4.0.0",
|
|
@@ -136,6 +136,23 @@ function parseBackendError(body: unknown, status: number): string {
|
|
|
136
136
|
if (/^invalid request( data)?\.?$/i.test(primary)) {
|
|
137
137
|
return "Invalid payment details. Check required fields and try again."
|
|
138
138
|
}
|
|
139
|
+
if (/^failed to set default payment detail\.?$/i.test(primary)) {
|
|
140
|
+
const detail =
|
|
141
|
+
typeof data.error === "string" && data.error.trim() ? data.error.trim() : ""
|
|
142
|
+
if (detail) {
|
|
143
|
+
if (/already exists|unique|duplicate/i.test(detail)) {
|
|
144
|
+
return "Could not update your default payment method. Please try again."
|
|
145
|
+
}
|
|
146
|
+
return detail
|
|
147
|
+
}
|
|
148
|
+
return "Could not update your default payment method. Please try again."
|
|
149
|
+
}
|
|
150
|
+
if (/payment details? with customer(_|\s)?id:?\s*.*already exists/i.test(primary)) {
|
|
151
|
+
return "Could not update your default payment method. Please try again."
|
|
152
|
+
}
|
|
153
|
+
if (/already exists/i.test(primary) && /customer/i.test(primary)) {
|
|
154
|
+
return "Could not update your default payment method. Please try again."
|
|
155
|
+
}
|
|
139
156
|
if (/^failed to delete payment detail\.?$/i.test(primary)) {
|
|
140
157
|
const detail =
|
|
141
158
|
typeof data.error === "string" && data.error.trim() ? data.error.trim() : ""
|