@behio/storefront-sdk 2.6.0 → 2.6.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/README.md +6 -0
- package/dist/index.js +14 -11
- package/dist/index.mjs +14 -11
- package/dist/react.js +14 -11
- package/dist/react.mjs +14 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -269,6 +269,12 @@ does not double quantities. Expired links fail with
|
|
|
269
269
|
`be.storefront.cartLinkExpired`. Answer `GET /cart/link/_probe` with header
|
|
270
270
|
`x-behio-cart-link: 1` so Behio Chat knows the storefront supports links.
|
|
271
271
|
|
|
272
|
+
### Form validation errors (2.6.1)
|
|
273
|
+
|
|
274
|
+
`formFieldErrors(error)` retains every supported field code, including
|
|
275
|
+
`dateNotFuture`, `dateNotPast` and `tooManyFiles`. Display each error beside
|
|
276
|
+
its field and preserve entered values when a submission is rejected.
|
|
277
|
+
|
|
272
278
|
### Cart summary for page scripts (2.6)
|
|
273
279
|
|
|
274
280
|
Browser cart responses dispatch `behio:cart` on `window` with
|
package/dist/index.js
CHANGED
|
@@ -1006,16 +1006,19 @@ function validationFieldMessages(err2, locale = "en") {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
return out;
|
|
1008
1008
|
}
|
|
1009
|
-
var FORM_FIELD_ERROR_CODES =
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1009
|
+
var FORM_FIELD_ERROR_CODES = {
|
|
1010
|
+
required: true,
|
|
1011
|
+
invalid: true,
|
|
1012
|
+
tooShort: true,
|
|
1013
|
+
tooLong: true,
|
|
1014
|
+
min: true,
|
|
1015
|
+
max: true,
|
|
1016
|
+
notOption: true,
|
|
1017
|
+
pattern: true,
|
|
1018
|
+
dateNotFuture: true,
|
|
1019
|
+
dateNotPast: true,
|
|
1020
|
+
tooManyFiles: true
|
|
1021
|
+
};
|
|
1019
1022
|
function formFieldErrors(err2) {
|
|
1020
1023
|
if (errorCode(err2) !== "be.forms.validationFailed") return [];
|
|
1021
1024
|
const raw = errorParams(err2).errors;
|
|
@@ -1027,7 +1030,7 @@ function formFieldErrors(err2) {
|
|
|
1027
1030
|
if (idx <= 0) continue;
|
|
1028
1031
|
const key = entry.slice(0, idx);
|
|
1029
1032
|
const code = entry.slice(idx + 1);
|
|
1030
|
-
if (!
|
|
1033
|
+
if (!Object.prototype.hasOwnProperty.call(FORM_FIELD_ERROR_CODES, code)) continue;
|
|
1031
1034
|
out.push({ key, code });
|
|
1032
1035
|
}
|
|
1033
1036
|
return out;
|
package/dist/index.mjs
CHANGED
|
@@ -1006,16 +1006,19 @@ function validationFieldMessages(err2, locale = "en") {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
return out;
|
|
1008
1008
|
}
|
|
1009
|
-
var FORM_FIELD_ERROR_CODES =
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1009
|
+
var FORM_FIELD_ERROR_CODES = {
|
|
1010
|
+
required: true,
|
|
1011
|
+
invalid: true,
|
|
1012
|
+
tooShort: true,
|
|
1013
|
+
tooLong: true,
|
|
1014
|
+
min: true,
|
|
1015
|
+
max: true,
|
|
1016
|
+
notOption: true,
|
|
1017
|
+
pattern: true,
|
|
1018
|
+
dateNotFuture: true,
|
|
1019
|
+
dateNotPast: true,
|
|
1020
|
+
tooManyFiles: true
|
|
1021
|
+
};
|
|
1019
1022
|
function formFieldErrors(err2) {
|
|
1020
1023
|
if (errorCode(err2) !== "be.forms.validationFailed") return [];
|
|
1021
1024
|
const raw = errorParams(err2).errors;
|
|
@@ -1027,7 +1030,7 @@ function formFieldErrors(err2) {
|
|
|
1027
1030
|
if (idx <= 0) continue;
|
|
1028
1031
|
const key = entry.slice(0, idx);
|
|
1029
1032
|
const code = entry.slice(idx + 1);
|
|
1030
|
-
if (!
|
|
1033
|
+
if (!Object.prototype.hasOwnProperty.call(FORM_FIELD_ERROR_CODES, code)) continue;
|
|
1031
1034
|
out.push({ key, code });
|
|
1032
1035
|
}
|
|
1033
1036
|
return out;
|
package/dist/react.js
CHANGED
|
@@ -4019,16 +4019,19 @@ function errorParams(err) {
|
|
|
4019
4019
|
const params = body?.params;
|
|
4020
4020
|
return params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
4021
4021
|
}
|
|
4022
|
-
var FORM_FIELD_ERROR_CODES =
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4022
|
+
var FORM_FIELD_ERROR_CODES = {
|
|
4023
|
+
required: true,
|
|
4024
|
+
invalid: true,
|
|
4025
|
+
tooShort: true,
|
|
4026
|
+
tooLong: true,
|
|
4027
|
+
min: true,
|
|
4028
|
+
max: true,
|
|
4029
|
+
notOption: true,
|
|
4030
|
+
pattern: true,
|
|
4031
|
+
dateNotFuture: true,
|
|
4032
|
+
dateNotPast: true,
|
|
4033
|
+
tooManyFiles: true
|
|
4034
|
+
};
|
|
4032
4035
|
function formFieldErrors(err) {
|
|
4033
4036
|
if (errorCode(err) !== "be.forms.validationFailed") return [];
|
|
4034
4037
|
const raw = errorParams(err).errors;
|
|
@@ -4040,7 +4043,7 @@ function formFieldErrors(err) {
|
|
|
4040
4043
|
if (idx <= 0) continue;
|
|
4041
4044
|
const key = entry.slice(0, idx);
|
|
4042
4045
|
const code = entry.slice(idx + 1);
|
|
4043
|
-
if (!
|
|
4046
|
+
if (!Object.prototype.hasOwnProperty.call(FORM_FIELD_ERROR_CODES, code)) continue;
|
|
4044
4047
|
out.push({ key, code });
|
|
4045
4048
|
}
|
|
4046
4049
|
return out;
|
package/dist/react.mjs
CHANGED
|
@@ -3909,16 +3909,19 @@ function errorParams(err) {
|
|
|
3909
3909
|
const params = body?.params;
|
|
3910
3910
|
return params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
3911
3911
|
}
|
|
3912
|
-
var FORM_FIELD_ERROR_CODES =
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3912
|
+
var FORM_FIELD_ERROR_CODES = {
|
|
3913
|
+
required: true,
|
|
3914
|
+
invalid: true,
|
|
3915
|
+
tooShort: true,
|
|
3916
|
+
tooLong: true,
|
|
3917
|
+
min: true,
|
|
3918
|
+
max: true,
|
|
3919
|
+
notOption: true,
|
|
3920
|
+
pattern: true,
|
|
3921
|
+
dateNotFuture: true,
|
|
3922
|
+
dateNotPast: true,
|
|
3923
|
+
tooManyFiles: true
|
|
3924
|
+
};
|
|
3922
3925
|
function formFieldErrors(err) {
|
|
3923
3926
|
if (errorCode(err) !== "be.forms.validationFailed") return [];
|
|
3924
3927
|
const raw = errorParams(err).errors;
|
|
@@ -3930,7 +3933,7 @@ function formFieldErrors(err) {
|
|
|
3930
3933
|
if (idx <= 0) continue;
|
|
3931
3934
|
const key = entry.slice(0, idx);
|
|
3932
3935
|
const code = entry.slice(idx + 1);
|
|
3933
|
-
if (!
|
|
3936
|
+
if (!Object.prototype.hasOwnProperty.call(FORM_FIELD_ERROR_CODES, code)) continue;
|
|
3934
3937
|
out.push({ key, code });
|
|
3935
3938
|
}
|
|
3936
3939
|
return out;
|