@legalplace/wizardx-core 3.0.6 → 3.1.0
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 +30 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/phoneNumber.helper.d.ts +4 -0
- package/dist/helpers/phoneNumber.helper.js +4 -0
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.js +6 -0
- package/dist/redux/sagas/initInputs.js +6 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.1.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.7...@legalplace/wizardx-core@3.1.0) (2023-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* lint ([2ad64ca](https://git.legalplace.eu/legalplace/monorepo/commits/2ad64ca857ed83d93d7588b977d9b05cabe853b9)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
12
|
+
* lint ([6fa57d1](https://git.legalplace.eu/legalplace/monorepo/commits/6fa57d16f0f072cd23cac73ff3a057eaa4379a09)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
13
|
+
* lint ([95ed2a7](https://git.legalplace.eu/legalplace/monorepo/commits/95ed2a7470cd8e81c96567ee04005020c069b804)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
14
|
+
* lint ([8fac69d](https://git.legalplace.eu/legalplace/monorepo/commits/8fac69de6878d4c1433d72cb07125fe5b2df1ca0)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
15
|
+
* revert changes ([618808f](https://git.legalplace.eu/legalplace/monorepo/commits/618808f57cd020b1e882a03fcc58e83648a73c77)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
16
|
+
* use new role enum ([bb36f38](https://git.legalplace.eu/legalplace/monorepo/commits/bb36f38099165a049318e500b3124267debbaa23)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* only update variable when phone number is long enough ([fb1c193](https://git.legalplace.eu/legalplace/monorepo/commits/fb1c19376e1c488ca436f1121664e839ce113ebb)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
22
|
+
* refactor phone validator ([d5eefb8](https://git.legalplace.eu/legalplace/monorepo/commits/d5eefb8c669ef5f0af4f8ce07b0787896d7a3e83)), closes [api#7521](https://git.legalplace.eu/legalplace/monorepo/issues/7521)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [3.0.7](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.6...@legalplace/wizardx-core@3.0.7) (2023-02-13)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @legalplace/wizardx-core
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [3.0.6](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.5...@legalplace/wizardx-core@3.0.6) (2023-02-13)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @legalplace/wizardx-core
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PhoneNumber } from "libphonenumber-js";
|
|
2
|
+
export declare const checkPhoneNumberValidity: (phone: string) => boolean;
|
|
3
|
+
export declare const parsePhoneNumber: (phone: string) => PhoneNumber;
|
|
4
|
+
export declare const isValidPhoneNumberLength: (phone: string) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { isValidPhoneNumber, parsePhoneNumber as parseLibPhoneNumber, isPossiblePhoneNumber, } from "libphonenumber-js";
|
|
2
|
+
export const checkPhoneNumberValidity = (phone) => isValidPhoneNumber(phone);
|
|
3
|
+
export const parsePhoneNumber = (phone) => parseLibPhoneNumber(phone);
|
|
4
|
+
export const isValidPhoneNumberLength = (phone) => isPossiblePhoneNumber(phone);
|
|
@@ -8,6 +8,7 @@ import { UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, UPDATE_SECTION_COND
|
|
|
8
8
|
import { selectOptionConditionValue, selectVariableConditionValue, selectIsOptionDisplayed, selectIsVariableDisplayed, } from "../selectors/conditions";
|
|
9
9
|
import { FETCH_MODEL_SUCCEEDED } from "../constants/app";
|
|
10
10
|
import { checkDateValidity } from "../../helpers/date.helper";
|
|
11
|
+
import { checkPhoneNumberValidity } from "../../helpers/phoneNumber.helper";
|
|
11
12
|
const validateSectionMandatory = (mpi, sectionId) => {
|
|
12
13
|
const parentSection = selectSectionReference(sectionId);
|
|
13
14
|
let childOptions = [...parentSection.options];
|
|
@@ -137,6 +138,11 @@ const watchUpdateVariableInputCondition = (mpi, next, action, ignoreNext) => {
|
|
|
137
138
|
!checkDateValidity(value)) {
|
|
138
139
|
mandatoryValue = false;
|
|
139
140
|
}
|
|
141
|
+
if (variableType === "phone_number" &&
|
|
142
|
+
typeof value === "string" &&
|
|
143
|
+
!checkPhoneNumberValidity(value)) {
|
|
144
|
+
mandatoryValue = false;
|
|
145
|
+
}
|
|
140
146
|
mpi.dispatch(setMandatoryVariableAction(id, index, mandatoryValue));
|
|
141
147
|
};
|
|
142
148
|
const watchUpdateOptionInputCondition = (mpi, next, action, ignoreNext) => {
|
|
@@ -7,6 +7,7 @@ import { initConditionsAction } from "../actions/conditions";
|
|
|
7
7
|
import { ConditionsInitiator } from "../../libs/ConditionsInitiator";
|
|
8
8
|
import { selectOptionRelations, selectVariableReference, } from "../selectors/references";
|
|
9
9
|
import { checkDateValidity } from "../../helpers/date.helper";
|
|
10
|
+
import { checkPhoneNumberValidity } from "../../helpers/phoneNumber.helper";
|
|
10
11
|
const getValues = (arr1, arr2) => arr1.map((v, index) => arr2[index] || v);
|
|
11
12
|
export function* initInputsDecorator(action) {
|
|
12
13
|
const state = yield select((s) => s);
|
|
@@ -60,6 +61,11 @@ export function* initInputsDecorator(action) {
|
|
|
60
61
|
!checkDateValidity(value)) {
|
|
61
62
|
return false;
|
|
62
63
|
}
|
|
64
|
+
if (variableType === "phone_number" &&
|
|
65
|
+
typeof value === "string" &&
|
|
66
|
+
!checkPhoneNumberValidity(value)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
63
69
|
return `${value}`.trim().length > 0;
|
|
64
70
|
})));
|
|
65
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@appnest/masonry-layout": "^2.0.8",
|
|
23
23
|
"@cryptography/sha1": "^0.2.0",
|
|
24
|
-
"@legalplace/lp-events": "1.
|
|
24
|
+
"@legalplace/lp-events": "1.14.0",
|
|
25
25
|
"@legalplace/lplogic": "^2.1.6",
|
|
26
26
|
"@legalplace/model-healthcheck": "^1.1.5",
|
|
27
27
|
"@legalplace/referencesparser": "^2.3.13",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"connected-react-router": "^6.8.0",
|
|
33
33
|
"crypto-js": "^4.1.1",
|
|
34
34
|
"history": "4.10.1",
|
|
35
|
+
"libphonenumber-js": "^1.10.19",
|
|
35
36
|
"lodash": "^4.17.21",
|
|
36
37
|
"moment-business-days": "^1.2.0",
|
|
37
38
|
"mousetrap": "^1.6.5",
|
|
@@ -94,5 +95,5 @@
|
|
|
94
95
|
"*.test.ts",
|
|
95
96
|
"*.test.tsx"
|
|
96
97
|
],
|
|
97
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "9917341091ff9261793aad171a1d12e4e810aa4e"
|
|
98
99
|
}
|