@invoicebox/ui 0.1.0-alpha.141 → 0.1.0-alpha.142
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/dist/validate/index.d.ts +2 -0
- package/dist/validate/index.js +34 -0
- package/package.json +1 -1
package/dist/validate/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare class Validate {
|
|
3
|
+
static bic(value: string, path: string, createError: (params?: yup.CreateErrorOptions) => yup.ValidationError): true | yup.ValidationError;
|
|
4
|
+
static website(value: string, path: string, createError: (params?: yup.CreateErrorOptions) => yup.ValidationError): true | yup.ValidationError;
|
|
3
5
|
static vatNumber(value: string, path: string, countryId: string, createError: (params?: yup.CreateErrorOptions) => yup.ValidationError): true | yup.ValidationError;
|
|
4
6
|
static taxRegistrationReasonCode(value: string, path: string, createError: (params?: yup.CreateErrorOptions) => yup.ValidationError): true | yup.ValidationError;
|
|
5
7
|
static registrationNumber(value: string, path: string, vatNumber: string, countryId: string, createError: (params?: yup.CreateErrorOptions) => yup.ValidationError): true | yup.ValidationError;
|
package/dist/validate/index.js
CHANGED
|
@@ -17,6 +17,40 @@ var Validate = exports.Validate = /*#__PURE__*/function () {
|
|
|
17
17
|
_classCallCheck(this, Validate);
|
|
18
18
|
}
|
|
19
19
|
return _createClass(Validate, null, [{
|
|
20
|
+
key: "bic",
|
|
21
|
+
value: function bic(value, path, createError) {
|
|
22
|
+
if (value === '') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (/[^0-9]/.test(value)) {
|
|
26
|
+
return createError({
|
|
27
|
+
path: path,
|
|
28
|
+
message: 'БИК может состоять только из цифр'
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (value.length !== 9) {
|
|
32
|
+
return createError({
|
|
33
|
+
path: path,
|
|
34
|
+
message: 'БИК может состоять только из 9 цифр'
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "website",
|
|
41
|
+
value: function website(value, path, createError) {
|
|
42
|
+
if (value === '') {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (value.match(/^((ftp|http|https):\/\/)?(www.)?(?!.*(ftp|http|https|www.))[a-zA-Z0-9_-]+(\.[a-zA-Z]+)+((\/)[\w#]+)*(\/\w+\?[a-zA-Z0-9_]+=\w+(&[a-zA-Z0-9_]+=\w+)*)?$/gm)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return createError({
|
|
49
|
+
path: path,
|
|
50
|
+
message: 'Некорректный адрес'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
20
54
|
key: "vatNumber",
|
|
21
55
|
value: function vatNumber(value, path, countryId, createError) {
|
|
22
56
|
switch (countryId) {
|