@invoicebox/ui 0.1.0-alpha.208 → 0.1.0-alpha.209

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.
@@ -1,7 +1,7 @@
1
1
  import { TCreateErrorFunc } from './types';
2
2
  export declare class Validate {
3
3
  static bic(value: string, createError: TCreateErrorFunc): any;
4
- static website(value: string, createError: TCreateErrorFunc): any;
4
+ static website(value: string, createError: TCreateErrorFunc, isOnlyHttpsFormat?: boolean): any;
5
5
  static vatNumber(value: string, countryId: string, createError: TCreateErrorFunc): any;
6
6
  static taxRegistrationReasonCode(value: string, createError: TCreateErrorFunc): any;
7
7
  static settlementAccount(value: string, bic: string, createError: TCreateErrorFunc): any;
@@ -32,11 +32,15 @@ var Validate = exports.Validate = /*#__PURE__*/function () {
32
32
  }
33
33
  }, {
34
34
  key: "website",
35
- value: function website(value, createError) {
35
+ value: function website(value, createError, isOnlyHttpsFormat) {
36
36
  if (value === '') {
37
37
  return true;
38
38
  }
39
- if (value.match(/^(http[s\u017F]?:\/\/)?(www\.)?([\x2D0-9A-Za-z\u017F\u0401\u0410-\u044F\u0451\u1C80-\u1C83\u1C85\u1C86\u212A]+\.[A-Za-z\u017F\u0401\u0410-\u044F\u0451\u1C80-\u1C83\u1C85\u1C86\u212A]{2,})(\/(?:(?![\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uD800-\uDFFF\uFEFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])*)?$/i)) {
39
+ var basePattern = "(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?::\\d{1,5})?(?:/[\\w\\-.~!$&'()*+,;=:@%/?#]*)?";
40
+ var prefix = isOnlyHttpsFormat ? '^https://' : '^(https://)?';
41
+ var pattern = "".concat(prefix).concat(basePattern, "$");
42
+ var regex = new RegExp(pattern, 'iu');
43
+ if (value.match(regex)) {
40
44
  return true;
41
45
  }
42
46
  return createError('Некорректный адрес');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invoicebox/ui",
3
- "version": "0.1.0-alpha.208",
3
+ "version": "0.1.0-alpha.209",
4
4
  "description": "Invoicebox UI",
5
5
  "license": "Apache License 2.0",
6
6
  "scripts": {