@pagopa/selfcare-common-frontend 1.12.2 → 1.12.5
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/CHANGELOG.md +20 -0
- package/build.info +2 -2
- package/package.json +1 -1
- package/utils/verifyNameMatchWithTaxCode.d.ts +1 -1
- package/utils/verifyNameMatchWithTaxCode.js +18 -7
- package/utils/verifyNameMatchWithTaxCode.js.map +1 -1
- package/utils/verifySurnameMatchWithTaxCode.js +23 -7
- package/utils/verifySurnameMatchWithTaxCode.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v1.12.5](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.4...v1.12.5)
|
|
8
|
+
|
|
9
|
+
- consonant constants it could be an undefined data [`#104`](https://github.com/pagopa/selfcare-common-frontend/pull/104)
|
|
10
|
+
|
|
11
|
+
#### [v1.12.4](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.3...v1.12.4)
|
|
12
|
+
|
|
13
|
+
> 9 September 2022
|
|
14
|
+
|
|
15
|
+
- SELC-1509_addedNewCases Added new cases for covering particularly user name and surname + unitTests [`#103`](https://github.com/pagopa/selfcare-common-frontend/pull/103)
|
|
16
|
+
- SELC-1509_addedNewCases Added new cases for covering particularly user name and surname + unitTests (#103) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
17
|
+
|
|
18
|
+
#### [v1.12.3](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.2...v1.12.3)
|
|
19
|
+
|
|
20
|
+
> 9 September 2022
|
|
21
|
+
|
|
22
|
+
- SELC-1509 Added to checkCF one consonant case [`#102`](https://github.com/pagopa/selfcare-common-frontend/pull/102)
|
|
23
|
+
- SELC-1509 Added to checkCF one consonant case (#102) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
24
|
+
|
|
7
25
|
#### [v1.12.2](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.1...v1.12.2)
|
|
8
26
|
|
|
27
|
+
> 8 September 2022
|
|
28
|
+
|
|
9
29
|
- SELC-1509 Creation of utilities functions with description for easily usage in other repos [`#101`](https://github.com/pagopa/selfcare-common-frontend/pull/101)
|
|
10
30
|
- SELC-1509 Creation of utilities functions with description for easily usage in other repos (#101) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
11
31
|
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
remotes/origin/SELC-1407_usingEnableAssistanceProp
|
|
1
|
+
20220909.3 - selfcare-common-frontend.deploy(46642)
|
|
2
|
+
remotes/origin/SELC-1407_usingEnableAssistanceProp a63dc09d46087b9e36b44a758673b199f810d55f
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/selfcare-common-frontend",
|
|
3
3
|
"description": "Shared React components for the pagopa selfcare project",
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* It covers the possible cases and return: TRUE, when the three letters of name in taxCode doesn't match
|
|
4
4
|
* with the name entered by the user, otherwise FALSE when they match.
|
|
5
5
|
* */
|
|
6
|
-
export declare const verifyNameMatchWithTaxCode: (name: string, fiscalCode?: string | undefined) => string |
|
|
6
|
+
export declare const verifyNameMatchWithTaxCode: (name: string, fiscalCode?: string | undefined) => string | false | undefined;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* */
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.verifyNameMatchWithTaxCode = void 0;
|
|
9
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
9
10
|
const verifyNameMatchWithTaxCode = (name, fiscalCode) => {
|
|
10
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c, _d;
|
|
11
12
|
const fiscalCodeName = fiscalCode === null || fiscalCode === void 0 ? void 0 : fiscalCode.substring(3, 6).toLocaleUpperCase();
|
|
12
|
-
const consonantsName = (_a = name
|
|
13
|
-
.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
13
|
+
const consonantsName = (_a = name === null || name === void 0 ? void 0 : name.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
14
14
|
if ((consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 3 && fiscalCodeName === consonantsName) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
@@ -20,9 +20,8 @@ const verifyNameMatchWithTaxCode = (name, fiscalCode) => {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length)
|
|
24
|
-
const firstVocalFound = (_b = name
|
|
25
|
-
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
23
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 2) {
|
|
24
|
+
const firstVocalFound = (_b = name === null || name === void 0 ? void 0 : name.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
26
25
|
if (firstVocalFound) {
|
|
27
26
|
const threeNameLetters = consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.concat(firstVocalFound);
|
|
28
27
|
if (fiscalCodeName === threeNameLetters) {
|
|
@@ -30,8 +29,20 @@ const verifyNameMatchWithTaxCode = (name, fiscalCode) => {
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
}
|
|
32
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 1) {
|
|
33
|
+
const firstTwoVocalFound = (_c = name === null || name === void 0 ? void 0 : name.match(/[aeiou]/gi)) === null || _c === void 0 ? void 0 : _c.join('').substring(0, 2).toLocaleUpperCase();
|
|
34
|
+
if (firstTwoVocalFound) {
|
|
35
|
+
const threeNameLetters = consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.concat(firstTwoVocalFound);
|
|
36
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
33
41
|
else {
|
|
34
|
-
|
|
42
|
+
const firstThreeVocalFound = (_d = name === null || name === void 0 ? void 0 : name.match(/[aeiou]/gi)) === null || _d === void 0 ? void 0 : _d.join('').substring(0, 3).toLocaleUpperCase();
|
|
43
|
+
if (fiscalCodeName === firstThreeVocalFound) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
return fiscalCode;
|
|
37
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyNameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifyNameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;
|
|
1
|
+
{"version":3,"file":"verifyNameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifyNameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;AAEL,wDAAwD;AACjD,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,UAAmB,EAAE,EAAE;;IAC9E,MAAM,cAAc,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACvE,M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AAM,kBAAkB,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAC3B,KAAK,CAAC,WAAW,CAAC,0CAClB,IAAI,CAAC,EAAE,EACR,SAAS,CAAC,CAAC,EAAE,CAAC,EACd,iBAAiB,EAAE,CAAC;QACvB,IAAI,kBAAkB,EAAE;YACtB,MAAM,gBAAgB,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;YACpE,IAAI,cAAc,KAAK,gBAAgB,EAAE;gBACvC,OAAO,KAAK,CAAC;aACd;SACF;KACF;SAAM;QACL,MAAM,oBAAoB,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAC7B,KAAK,CAAC,WAAW,CAAC,0CAClB,IAAI,CAAC,EAAE,EACR,SAAS,CAAC,CAAC,EAAE,CAAC,EACd,iBAAiB,EAAE,CAAC;QACvB,IAAI,cAAc,KAAK,oBAAoB,EAAE;YAC3C,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAjDW,QAAA,0BAA0B,8BAiDrC"}
|
|
@@ -6,21 +6,37 @@
|
|
|
6
6
|
* */
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.verifySurnameMatchWithTaxCode = void 0;
|
|
9
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
9
10
|
const verifySurnameMatchWithTaxCode = (surname, fiscalCode) => {
|
|
10
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c, _d;
|
|
11
12
|
const fiscalCodeSurname = fiscalCode === null || fiscalCode === void 0 ? void 0 : fiscalCode.substring(0, 3).toLocaleUpperCase();
|
|
12
|
-
const consonantsSurname = (_a = surname
|
|
13
|
-
.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
13
|
+
const consonantsSurname = (_a = surname === null || surname === void 0 ? void 0 : surname.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
14
14
|
if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) >= 3) {
|
|
15
15
|
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.substring(0, 3);
|
|
16
16
|
return fiscalCodeSurname !== threeSurnameLetters;
|
|
17
17
|
}
|
|
18
|
-
else {
|
|
19
|
-
const firstVocalFound = (_b = surname
|
|
20
|
-
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
18
|
+
else if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) === 2) {
|
|
19
|
+
const firstVocalFound = (_b = surname === null || surname === void 0 ? void 0 : surname.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
21
20
|
if (firstVocalFound) {
|
|
22
21
|
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.concat(firstVocalFound);
|
|
23
|
-
|
|
22
|
+
if (fiscalCodeSurname === threeSurnameLetters) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) === 1) {
|
|
28
|
+
const firstTwoVocalFound = (_c = surname === null || surname === void 0 ? void 0 : surname.match(/[aeiou]/gi)) === null || _c === void 0 ? void 0 : _c.join('').substring(0, 2).toLocaleUpperCase();
|
|
29
|
+
if (firstTwoVocalFound) {
|
|
30
|
+
const threeNameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.concat(firstTwoVocalFound);
|
|
31
|
+
if (fiscalCodeSurname === threeNameLetters) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const firstThreeVocalFound = (_d = surname === null || surname === void 0 ? void 0 : surname.match(/[aeiou]/gi)) === null || _d === void 0 ? void 0 : _d.join('').substring(0, 3).toLocaleUpperCase();
|
|
38
|
+
if (fiscalCodeSurname === firstThreeVocalFound) {
|
|
39
|
+
return false;
|
|
24
40
|
}
|
|
25
41
|
}
|
|
26
42
|
return fiscalCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifySurnameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifySurnameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;
|
|
1
|
+
{"version":3,"file":"verifySurnameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifySurnameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;AAEL,wDAAwD;AACjD,MAAM,6BAA6B,GAAG,CAAC,OAAe,EAAE,UAAmB,EAAE,EAAE;;IACpF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC1E,MAAM,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAC7B,KAAK,CAAC,YAAY,CAAC,0CACnB,IAAI,CAAC,EAAE,EACR,OAAO,CAAC,KAAK,EAAE,EAAE,EACjB,iBAAiB,EAAE,CAAC;IACvB,IAAI,iBAAiB,IAAI,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,KAAI,CAAC,EAAE;QACvD,MAAM,mBAAmB,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,iBAAiB,KAAK,mBAAmB,CA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