@pagopa/selfcare-common-frontend 1.12.1 → 1.12.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/CHANGELOG.md +21 -0
- package/build.info +2 -2
- package/package.json +1 -1
- package/utils/verifyNameMatchWithTaxCode.d.ts +6 -0
- package/utils/verifyNameMatchWithTaxCode.js +54 -0
- package/utils/verifyNameMatchWithTaxCode.js.map +1 -0
- package/utils/verifySurnameMatchWithTaxCode.d.ts +6 -0
- package/utils/verifySurnameMatchWithTaxCode.js +49 -0
- package/utils/verifySurnameMatchWithTaxCode.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,29 @@ 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.4](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.3...v1.12.4)
|
|
8
|
+
|
|
9
|
+
- SELC-1509_addedNewCases Added new cases for covering particularly user name and surname + unitTests [`#103`](https://github.com/pagopa/selfcare-common-frontend/pull/103)
|
|
10
|
+
- SELC-1509_addedNewCases Added new cases for covering particularly user name and surname + unitTests (#103) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
11
|
+
|
|
12
|
+
#### [v1.12.3](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.2...v1.12.3)
|
|
13
|
+
|
|
14
|
+
> 9 September 2022
|
|
15
|
+
|
|
16
|
+
- SELC-1509 Added to checkCF one consonant case [`#102`](https://github.com/pagopa/selfcare-common-frontend/pull/102)
|
|
17
|
+
- SELC-1509 Added to checkCF one consonant case (#102) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
18
|
+
|
|
19
|
+
#### [v1.12.2](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.1...v1.12.2)
|
|
20
|
+
|
|
21
|
+
> 8 September 2022
|
|
22
|
+
|
|
23
|
+
- SELC-1509 Creation of utilities functions with description for easily usage in other repos [`#101`](https://github.com/pagopa/selfcare-common-frontend/pull/101)
|
|
24
|
+
- SELC-1509 Creation of utilities functions with description for easily usage in other repos (#101) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
25
|
+
|
|
7
26
|
#### [v1.12.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.0...v1.12.1)
|
|
8
27
|
|
|
28
|
+
> 5 September 2022
|
|
29
|
+
|
|
9
30
|
- Change configuration in order to rehabilitate mixpanel [`cbcdb88`](https://github.com/pagopa/selfcare-common-frontend/commit/cbcdb88aad8b71c8b9d115adc91085b378fd182c)
|
|
10
31
|
|
|
11
32
|
#### [v1.12.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.11.14...v1.12.0)
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
remotes/origin/SELC-1407_usingEnableAssistanceProp
|
|
1
|
+
20220909.2 - selfcare-common-frontend.deploy(46616)
|
|
2
|
+
remotes/origin/SELC-1407_usingEnableAssistanceProp 87149fe79d927b2947874689376cb2616a59b2b8
|
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.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** It allows you to verify that the name that the user would be entering corresponds or not with the
|
|
2
|
+
* characters given to the name in the taxcode.
|
|
3
|
+
* It covers the possible cases and return: TRUE, when the three letters of name in taxCode doesn't match
|
|
4
|
+
* with the name entered by the user, otherwise FALSE when they match.
|
|
5
|
+
* */
|
|
6
|
+
export declare const verifyNameMatchWithTaxCode: (name: string, fiscalCode?: string | undefined) => string | false | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** It allows you to verify that the name that the user would be entering corresponds or not with the
|
|
3
|
+
* characters given to the name in the taxcode.
|
|
4
|
+
* It covers the possible cases and return: TRUE, when the three letters of name in taxCode doesn't match
|
|
5
|
+
* with the name entered by the user, otherwise FALSE when they match.
|
|
6
|
+
* */
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.verifyNameMatchWithTaxCode = void 0;
|
|
9
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
10
|
+
const verifyNameMatchWithTaxCode = (name, fiscalCode) => {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
const fiscalCodeName = fiscalCode === null || fiscalCode === void 0 ? void 0 : fiscalCode.substring(3, 6).toLocaleUpperCase();
|
|
13
|
+
const consonantsName = (_a = name
|
|
14
|
+
.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
15
|
+
if ((consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 3 && fiscalCodeName === consonantsName) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) > 3) {
|
|
19
|
+
const threeNameLetters = (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.slice(0, 1)) + (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.slice(2, 4));
|
|
20
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 2) {
|
|
25
|
+
const firstVocalFound = (_b = name
|
|
26
|
+
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
27
|
+
if (firstVocalFound) {
|
|
28
|
+
const threeNameLetters = consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.concat(firstVocalFound);
|
|
29
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 1) {
|
|
35
|
+
const firstTwoVocalFound = (_c = name
|
|
36
|
+
.match(/[aeiou]/gi)) === null || _c === void 0 ? void 0 : _c.join('').substring(0, 2).toLocaleUpperCase();
|
|
37
|
+
if (firstTwoVocalFound) {
|
|
38
|
+
const threeNameLetters = consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.concat(firstTwoVocalFound);
|
|
39
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const firstThreeVocalFound = (_d = name
|
|
46
|
+
.match(/[aeiou]/gi)) === null || _d === void 0 ? void 0 : _d.join('').substring(0, 3).toLocaleUpperCase();
|
|
47
|
+
if (fiscalCodeName === firstThreeVocalFound) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return fiscalCode;
|
|
52
|
+
};
|
|
53
|
+
exports.verifyNameMatchWithTaxCode = verifyNameMatchWithTaxCode;
|
|
54
|
+
//# sourceMappingURL=verifyNameMatchWithTaxCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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d,cAAc,CAAE,MAAM,MAAK,CAAC,EAAE;QACzD,MAAM,kBAAkB,GAAG,MAAA,IAAI;aAC5B,KAAK,CAAC,WAAW,CAAC,0CACjB,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;aAC9B,KAAK,CAAC,WAAW,CAAC,0CACjB,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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** It allows you to verify that the surname that the user would be entering corresponds or not with the
|
|
2
|
+
* characters given to the surname in the taxcode.
|
|
3
|
+
* It covers the possible cases and return: TRUE, when the three letters of surname in taxCode doesn't match
|
|
4
|
+
* with the surname entered by the user, otherwise FALSE when they match.
|
|
5
|
+
* */
|
|
6
|
+
export declare const verifySurnameMatchWithTaxCode: (surname: string, fiscalCode?: string | undefined) => string | boolean | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** It allows you to verify that the surname that the user would be entering corresponds or not with the
|
|
3
|
+
* characters given to the surname in the taxcode.
|
|
4
|
+
* It covers the possible cases and return: TRUE, when the three letters of surname in taxCode doesn't match
|
|
5
|
+
* with the surname entered by the user, otherwise FALSE when they match.
|
|
6
|
+
* */
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.verifySurnameMatchWithTaxCode = void 0;
|
|
9
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
10
|
+
const verifySurnameMatchWithTaxCode = (surname, fiscalCode) => {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
const fiscalCodeSurname = fiscalCode === null || fiscalCode === void 0 ? void 0 : fiscalCode.substring(0, 3).toLocaleUpperCase();
|
|
13
|
+
const consonantsSurname = (_a = surname
|
|
14
|
+
.match(/[^aeiou]/gi)) === null || _a === void 0 ? void 0 : _a.join('').replace(/\s/g, '').toLocaleUpperCase();
|
|
15
|
+
if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) >= 3) {
|
|
16
|
+
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.substring(0, 3);
|
|
17
|
+
return fiscalCodeSurname !== threeSurnameLetters;
|
|
18
|
+
}
|
|
19
|
+
else if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) === 2) {
|
|
20
|
+
const firstVocalFound = (_b = surname
|
|
21
|
+
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
22
|
+
if (firstVocalFound) {
|
|
23
|
+
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.concat(firstVocalFound);
|
|
24
|
+
if (fiscalCodeSurname === threeSurnameLetters) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) === 1) {
|
|
30
|
+
const firstTwoVocalFound = (_c = surname
|
|
31
|
+
.match(/[aeiou]/gi)) === null || _c === void 0 ? void 0 : _c.join('').substring(0, 2).toLocaleUpperCase();
|
|
32
|
+
if (firstTwoVocalFound) {
|
|
33
|
+
const threeNameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.concat(firstTwoVocalFound);
|
|
34
|
+
if (fiscalCodeSurname === threeNameLetters) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const firstThreeVocalFound = (_d = surname
|
|
41
|
+
.match(/[aeiou]/gi)) === null || _d === void 0 ? void 0 : _d.join('').substring(0, 3).toLocaleUpperCase();
|
|
42
|
+
if (fiscalCodeSurname === firstThreeVocalFound) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return fiscalCode;
|
|
47
|
+
};
|
|
48
|
+
exports.verifySurnameMatchWithTaxCode = verifySurnameMatchWithTaxCode;
|
|
49
|
+
//# sourceMappingURL=verifySurnameMatchWithTaxCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;SAC9B,KAAK,CAAC,YAAY,CAAC,0CAClB,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,iBA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