Skip to content

Commit

Permalink
feat(company data): extend legal entity pattern to support all langua…
Browse files Browse the repository at this point in the history
…ge (#250)
  • Loading branch information
typecastcloud authored Oct 22, 2024
1 parent d90f12c commit 47d02c4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 37 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- remove logic that sets bpn before validation [#253](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/253)
- fixed company data invalidation when receiving multiple identifier [247](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/247)

### Change

- adjust legalEntityPattern REGEX to allow all language characters and update ES version [#250](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/250)

## 2.1.0-alpha.1

### Change
Expand Down
34 changes: 24 additions & 10 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ npm/npmjs/-/define-data-property/1.1.4, MIT, approved, #10591
npm/npmjs/-/define-properties/1.2.1, MIT, approved, #7116
npm/npmjs/-/delayed-stream/1.0.0, MIT, approved, clearlydefined
npm/npmjs/-/dequal/2.0.3, MIT, approved, clearlydefined
npm/npmjs/-/detect-libc/1.0.3, Apache-2.0, approved, clearlydefined
npm/npmjs/-/detect-newline/3.1.0, MIT, approved, clearlydefined
npm/npmjs/-/diff-sequences/29.6.3, MIT, approved, clearlydefined
npm/npmjs/-/diff/4.0.2, BSD-3-Clause, approved, #2728
Expand Down Expand Up @@ -220,7 +221,7 @@ npm/npmjs/-/https-proxy-agent/5.0.1, MIT, approved, clearlydefined
npm/npmjs/-/human-signals/2.1.0, Apache-2.0, approved, clearlydefined
npm/npmjs/-/husky/9.1.6, MIT, approved, clearlydefined
npm/npmjs/-/i18next-browser-languagedetector/7.2.1, MIT, approved, clearlydefined
npm/npmjs/-/i18next/23.15.1, MIT, approved, #16823
npm/npmjs/-/i18next/23.15.2, MIT, approved, #16823
npm/npmjs/-/iconv-lite/0.6.3, MIT, approved, clearlydefined
npm/npmjs/-/identity-obj-proxy/3.0.0, MIT, approved, clearlydefined
npm/npmjs/-/ieee754/1.2.1, BSD-3-Clause, approved, clearlydefined
Expand Down Expand Up @@ -350,7 +351,6 @@ npm/npmjs/-/mime-db/1.52.0, MIT, approved, clearlydefined
npm/npmjs/-/mime-types/2.1.35, MIT, approved, clearlydefined
npm/npmjs/-/mimic-fn/2.1.0, MIT, approved, clearlydefined
npm/npmjs/-/min-indent/1.0.1, MIT, approved, clearlydefined
npm/npmjs/-/mini-create-react-context/0.4.1, MIT, approved, clearlydefined
npm/npmjs/-/minimatch/3.1.2, ISC, approved, clearlydefined
npm/npmjs/-/minimatch/5.1.6, ISC, approved, #5952
npm/npmjs/-/minimatch/9.0.3, ISC, approved, #9190
Expand All @@ -361,6 +361,7 @@ npm/npmjs/-/nanoid/3.3.7, MIT, approved, #7571
npm/npmjs/-/nanoid/5.0.7, MIT, approved, clearlydefined
npm/npmjs/-/natural-compare/1.4.0, MIT, approved, clearlydefined
npm/npmjs/-/no-case/3.0.4, MIT, approved, clearlydefined
npm/npmjs/-/node-addon-api/7.1.1, MIT, approved, clearlydefined
npm/npmjs/-/node-int64/0.4.0, MIT, approved, clearlydefined
npm/npmjs/-/node-releases/2.0.18, MIT, approved, #1954
npm/npmjs/-/normalize-path/3.0.0, MIT, approved, clearlydefined
Expand Down Expand Up @@ -393,7 +394,7 @@ npm/npmjs/-/path-key/3.1.1, MIT, approved, clearlydefined
npm/npmjs/-/path-parse/1.0.7, MIT, approved, clearlydefined
npm/npmjs/-/path-to-regexp/1.9.0, MIT, approved, #16188
npm/npmjs/-/path-type/4.0.0, MIT, approved, clearlydefined
npm/npmjs/-/phone/3.1.50, MIT, approved, #10500
npm/npmjs/-/phone/3.1.51, MIT, approved, #10500
npm/npmjs/-/picocolors/1.1.0, ISC, approved, clearlydefined
npm/npmjs/-/picomatch/2.3.1, MIT, approved, clearlydefined
npm/npmjs/-/pirates/4.0.6, MIT, approved, #680
Expand All @@ -418,9 +419,9 @@ npm/npmjs/-/react-bootstrap/2.10.5, MIT AND BSD-3-Clause AND Apache-2.0 AND CC-P
npm/npmjs/-/react-datepicker/6.9.0, MIT AND BSD-3-Clause, approved, #16449
npm/npmjs/-/react-dom/18.3.1, MIT, approved, clearlydefined
npm/npmjs/-/react-dropzone-uploader/2.11.0, MIT, approved, clearlydefined
npm/npmjs/-/react-dropzone/14.2.3, MIT, approved, clearlydefined
npm/npmjs/-/react-dropzone/14.2.10, MIT, approved, #16858
npm/npmjs/-/react-fast-compare/3.2.2, MIT, approved, clearlydefined
npm/npmjs/-/react-hook-form/7.53.0, MIT, approved, clearlydefined
npm/npmjs/-/react-hook-form/7.53.1, MIT, approved, #16857
npm/npmjs/-/react-i18next/14.1.3, MIT AND Apache-2.0, approved, #13870
npm/npmjs/-/react-icons/5.3.0, MIT, approved, clearlydefined
npm/npmjs/-/react-is/16.13.1, MIT, approved, clearlydefined
Expand All @@ -431,10 +432,10 @@ npm/npmjs/-/react-onclickoutside/6.13.1, MIT, approved, clearlydefined
npm/npmjs/-/react-player/2.16.0, MIT, approved, #14388
npm/npmjs/-/react-redux/9.1.2, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-3-Clause, approved, #13913
npm/npmjs/-/react-refresh/0.14.2, MIT, approved, clearlydefined
npm/npmjs/-/react-router-dom/5.3.3, MIT AND BSD-3-Clause, approved, #3023
npm/npmjs/-/react-router/5.3.3, MIT AND BSD-3-Clause AND CC-BY-4.0, approved, #3024
npm/npmjs/-/react-router-dom/5.3.4, MIT AND BSD-3-Clause, approved, #3023
npm/npmjs/-/react-router/5.3.4, MIT AND BSD-3-Clause AND CC-BY-4.0, approved, #3024
npm/npmjs/-/react-search-input/0.11.3, MIT, approved, clearlydefined
npm/npmjs/-/react-toastify/10.0.5, MIT, approved, #13093
npm/npmjs/-/react-toastify/10.0.6, MIT, approved, #13093
npm/npmjs/-/react-tooltip/5.28.0, MIT, approved, clearlydefined
npm/npmjs/-/react-transition-group/4.4.5, BSD-3-Clause, approved, CQ22955
npm/npmjs/-/react/18.3.1, MIT, approved, clearlydefined
Expand Down Expand Up @@ -466,7 +467,7 @@ npm/npmjs/-/run-parallel/1.2.0, MIT, approved, clearlydefined
npm/npmjs/-/safe-array-concat/1.1.2, MIT, approved, clearlydefined
npm/npmjs/-/safe-regex-test/1.0.3, MIT, approved, clearlydefined
npm/npmjs/-/safer-buffer/2.1.2, MIT, approved, clearlydefined
npm/npmjs/-/sass/1.79.4, MIT AND BSD-3-Clause AND Apache-2.0, approved, #16433
npm/npmjs/-/sass/1.79.6, MIT AND BSD-3-Clause AND Apache-2.0, approved, #16433
npm/npmjs/-/saxes/6.0.0, ISC, approved, clearlydefined
npm/npmjs/-/scheduler/0.23.2, MIT, approved, #14588
npm/npmjs/-/semver/6.3.1, ISC, approved, clearlydefined
Expand Down Expand Up @@ -699,11 +700,24 @@ npm/npmjs/@mui/utils/5.16.6, MIT, approved, #15716
npm/npmjs/@nodelib/fs.scandir/2.1.5, MIT, approved, clearlydefined
npm/npmjs/@nodelib/fs.stat/2.0.5, MIT, approved, clearlydefined
npm/npmjs/@nodelib/fs.walk/1.2.8, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-android-arm64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-darwin-arm64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-darwin-x64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-freebsd-x64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-linux-arm-glibc/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-linux-arm64-glibc/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-linux-arm64-musl/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-linux-x64-glibc/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-linux-x64-musl/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-win32-arm64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-win32-ia32/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher-win32-x64/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@parcel/watcher/2.4.1, MIT, approved, clearlydefined
npm/npmjs/@popperjs/core/2.11.8, MIT, approved, clearlydefined
npm/npmjs/@react-aria/ssr/3.9.6, Apache-2.0 AND MIT AND ISC AND BSD-2-Clause, approved, #16450
npm/npmjs/@react-hook/cache/1.1.1, MIT, approved, clearlydefined
npm/npmjs/@react-hook/latest/1.0.3, MIT, approved, clearlydefined
npm/npmjs/@reduxjs/toolkit/2.2.7, MIT AND (BSD-2-Clause AND ISC AND MIT) AND Apache-2.0, approved, #14170
npm/npmjs/@reduxjs/toolkit/2.2.8, MIT AND (BSD-2-Clause AND ISC AND MIT) AND Apache-2.0, approved, #14170
npm/npmjs/@restart/hooks/0.4.16, MIT, approved, #7049
npm/npmjs/@restart/ui/1.8.0, MIT, approved, clearlydefined
npm/npmjs/@rollup/pluginutils/5.1.2, MIT, approved, #16428
Expand Down
7 changes: 5 additions & 2 deletions src/types/Patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ export const Patterns = {
STREET:
/^(?!.*\s$)([a-zA-Z0-9À-ÿšŚął]{1,40}( ?[.,'/-] ?| )?){1,10}[a-zA-Z0-9À-ÿšŚął.]$/,
// legalEntityPattern
// \w covers A-Za-z0-9 and _
// \p{L} or \p{Letter} covers all letters in any language (Thai does not work)
// \p{Sc} or \p{Currency_Symbol} covers currency symbols
// \u0E00-\u0E7Fa covers Thai characters
// \d digits
// \s whitespace
// \x22 double quote
legalEntityPattern:
/^(?!.*\s$)([\wÀ-ÿ£$€¥¢@%*+\-/\\,.:;=<>!?&^#'\x22()[\]]\s?){1,160}$/,
/^(?!.*\s$)([\p{L}\u0E00-\u0E7F\d\p{Sc}@%*+_\-/\\,.:;=<>!?&^#'\x22()[\]]\s?){1,160}$/u,
registeredNamePattern:
/^(?!.*\s$)[a-zA-ZÀ-ÿŚął\d][a-zA-ZÀ-ÿŚął\d\s!#'$@&%()*+,\-_./:;=<>?[\]\\^]{2,60}$/,
regionPattern: /^(?!.*\s$)([a-zA-Z0-9À-ÿŚął,"()'-]\s?)*$/,
Expand Down
50 changes: 28 additions & 22 deletions src/types/testdata/legalentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const LEGAL_ENTITY_DATA = {
'+SEN Inc.', // leading special character
'La Poste S.A.',
'JPMORGAN ASIA-PACIFIC ADVANTAGE HYBRID FUND (QDII)',
'Currency £$€¥¢',
'摩根亚太优势混合型证券投资基金 (QDII)',
'Adis Tachov, zpracování plastů s.r.o.',
'BURY SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ',
'GAMMO Europe Korlátolt Felelősségű Társaság',
'Currency £$€¥¢₫฿',
'Brackets []()',
'Punctuation !?,.;:',
'Double "Quote" Company S.A.', // special character "" in name
Expand All @@ -50,27 +54,29 @@ export const LEGAL_ENTITY_DATA = {
'Finnish: ÄÖ',
'Icelandic: ÆÐÞ',
'Dutch: ÏËÏ',
// -- not supported by the pattern
// 'ACE 9 SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ',
// '摩根亚太优势混合型证券投资基金 (QDII)',
// '삼성', // Samsung
// '三', // Samsung
// 'Czech: ČĎŇŘŠŤŽ',
// 'Estonian: ÄÖÜŠŽ',
// 'Slovak: ĽĹŔŠŤŽ',
// 'Polish: ĄĆĘŁŃÓŚŹŻ',
// 'Hungarian: ÁÉÍÓÖŐÚÜŰ',
// 'Romanian: ÂÎŞŢ',
// 'Bulgarian: ЙЪЬ',
// 'Greek: ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ',
// 'Turkish: ÇĞİıÖŞÜ',
// 'Arabic: ابتثجحخدذرزسشصضطظعغفقكلمنهوي',
// 'Hebrew: שלום עולם',
// 'Hindi: अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषस',
// 'Japanese: あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん',
// 'Chinese: 你好 世界',
// 'Korean: 안녕하세요 세계',
// 'Thai: สวัสดีชาวโลก', // Thai does not seem to work even with /p{L}
'ACE 9 SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ',
'摩根亚太优势混合型证券投资基金 (QDII)',
'삼성', // Samsung
'三', // Samsung
'Czech: ČĎŇŘŠŤŽ',
'Estonian: ÄÖÜŠŽ',
'Slovak: ĽĹŔŠŤŽ',
'Polish: ĄĆĘŁŃÓŚŹŻ',
'Hungarian: ÁÉÍÓÖŐÚÜŰ',
'Romanian: ÂÎŞŢ',
'Bulgarian: ЙЪЬ',
'Greek: ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ',
'Turkish: ÇĞİıÖŞÜ',
'Arabic: ابتثجحخدذرزسشصضطظعغفقكلمنهوي',
'Hebrew: שלום עולם',
'Hindi: अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषस',
'Tamil: அஆஇஈஉஊஎஏஐஒஓஔகஙசஞடணதநனபமயரலவழளஷஸஹ',
'Japanese: あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん',
'Chinese: 你好 世界',
'Korean: 안녕하세요 세계',
'Thai: สวัสดีชาวโลก', // Thai does not seem to work even with /p{L} and required additional range
'Vietnamese: ăâắáấàằầảẳẩãẵẫạặậđêéếèềẻểẽễẹệíìỉĩịôơóốớòồờỏổởõỗỡọộợưúứùừủửũữụựýỳỷỹỵ',
'Singapore: 你好 世界',
],
invalid: [
' Bayerische Motoren Werke Aktiengesellschaft', // leading space
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES5",
"target": "ES6",
"useDefineForClassFields": true,
"lib": ["ES5", "DOM", "DOM.Iterable"],
"lib": ["ES6", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json.orig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"lib": [
"dom",
"dom.iterable",
Expand Down

0 comments on commit 47d02c4

Please sign in to comment.