@pagopa/selfcare-common-frontend 1.12.1 → 1.12.2
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 +7 -0
- package/build.info +2 -2
- package/package.json +1 -1
- package/utils/verifyNameMatchWithTaxCode.d.ts +6 -0
- package/utils/verifyNameMatchWithTaxCode.js +39 -0
- package/utils/verifyNameMatchWithTaxCode.js.map +1 -0
- package/utils/verifySurnameMatchWithTaxCode.d.ts +6 -0
- package/utils/verifySurnameMatchWithTaxCode.js +29 -0
- package/utils/verifySurnameMatchWithTaxCode.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,15 @@ 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.2](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.1...v1.12.2)
|
|
8
|
+
|
|
9
|
+
- 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
|
+
- SELC-1509 Creation of utilities functions with description for easily usage in other repos (#101) [`#1509`](https://pagopa.atlassian.net/browse/1509)
|
|
11
|
+
|
|
7
12
|
#### [v1.12.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.12.0...v1.12.1)
|
|
8
13
|
|
|
14
|
+
> 5 September 2022
|
|
15
|
+
|
|
9
16
|
- Change configuration in order to rehabilitate mixpanel [`cbcdb88`](https://github.com/pagopa/selfcare-common-frontend/commit/cbcdb88aad8b71c8b9d115adc91085b378fd182c)
|
|
10
17
|
|
|
11
18
|
#### [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
|
+
20220908.1 - selfcare-common-frontend.deploy(46435)
|
|
2
|
+
remotes/origin/SELC-1407_usingEnableAssistanceProp f91440f30a56761556c55bd0a3ecfa1ecd004cc1
|
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.2",
|
|
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 | boolean | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
const verifyNameMatchWithTaxCode = (name, fiscalCode) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
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();
|
|
14
|
+
if ((consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) === 3 && fiscalCodeName === consonantsName) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) > 3) {
|
|
18
|
+
const threeNameLetters = (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.slice(0, 1)) + (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.slice(2, 4));
|
|
19
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (consonantsName && (consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.length) < 3) {
|
|
24
|
+
const firstVocalFound = (_b = name
|
|
25
|
+
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
26
|
+
if (firstVocalFound) {
|
|
27
|
+
const threeNameLetters = consonantsName === null || consonantsName === void 0 ? void 0 : consonantsName.concat(firstVocalFound);
|
|
28
|
+
if (fiscalCodeName === threeNameLetters) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return fiscalCode;
|
|
37
|
+
};
|
|
38
|
+
exports.verifyNameMatchWithTaxCode = verifyNameMatchWithTaxCode;
|
|
39
|
+
//# sourceMappingURL=verifyNameMatchWithTaxCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyNameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifyNameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;AAEE,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,UAAmB,EAAE,EAAE;;IAC9E,MAAM,cA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,UAAU,CAAC;AACpB,CAAC,CAAC;AA9BW,QAAA,0BAA0B,8BA8BrC"}
|
|
@@ -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,29 @@
|
|
|
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
|
+
const verifySurnameMatchWithTaxCode = (surname, fiscalCode) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
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();
|
|
14
|
+
if (consonantsSurname && (consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.length) >= 3) {
|
|
15
|
+
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.substring(0, 3);
|
|
16
|
+
return fiscalCodeSurname !== threeSurnameLetters;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const firstVocalFound = (_b = surname
|
|
20
|
+
.match(/[aeiou]/gi)) === null || _b === void 0 ? void 0 : _b.join('').substring(0, 1).toLocaleUpperCase();
|
|
21
|
+
if (firstVocalFound) {
|
|
22
|
+
const threeSurnameLetters = consonantsSurname === null || consonantsSurname === void 0 ? void 0 : consonantsSurname.concat(firstVocalFound);
|
|
23
|
+
return fiscalCodeSurname !== threeSurnameLetters;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return fiscalCode;
|
|
27
|
+
};
|
|
28
|
+
exports.verifySurnameMatchWithTaxCode = verifySurnameMatchWithTaxCode;
|
|
29
|
+
//# sourceMappingURL=verifySurnameMatchWithTaxCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifySurnameMatchWithTaxCode.js","sourceRoot":"","sources":["../../src/lib/utils/verifySurnameMatchWithTaxCode.tsx"],"names":[],"mappings":";AAAA;;;;KAIK;;;AAEE,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,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,iBAAiB,KAAK,mBAAmB,CAAC;KAClD;SAAM;QACL,MAAM,eAAe,GAAG,MAAA,OAAO;aAC5B,KAAK,CAAC,WAAW,CAAC,0CACjB,IAAI,CAAC,EAAE,EACR,SAAS,CAAC,CAAC,EAAE,CAAC,EACd,iBAAiB,EAAE,CAAC;QACvB,IAAI,eAAe,EAAE;YACnB,MAAM,mBAAmB,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,CAAC,eAAe,CAAC,CAAC;YACvE,OAAO,iBAAiB,KAAK,mBAAmB,CAAC;SAClD;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAtBW,QAAA,6BAA6B,iCAsBxC"}
|