@movalib/movalib-commons 1.1.69 → 1.1.70

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.
@@ -4,7 +4,7 @@ interface AccountValidationProps {
4
4
  movaAppType: MovaAppType;
5
5
  smsValidation: boolean;
6
6
  onSubmit: (success: boolean, message: string) => void;
7
- onResendSecurityCode: (success: boolean, message: string) => void;
7
+ onResendSecurityCode?: (success: boolean, message: string) => void;
8
8
  }
9
9
  declare const AccountValidation: FunctionComponent<AccountValidationProps>;
10
10
  export default AccountValidation;
@@ -166,7 +166,7 @@ var AccountValidation = function (_a) {
166
166
  };
167
167
  var resendCode = function () {
168
168
  var _a;
169
- if (controlPhoneNumber()) {
169
+ if (controlPhoneNumber() && onResendSecurityCode) {
170
170
  var req = {
171
171
  phoneNumber: (_a = validationForm.phoneNumber) === null || _a === void 0 ? void 0 : _a.value
172
172
  };
@@ -175,16 +175,12 @@ var AccountValidation = function (_a) {
175
175
  var _a, _b;
176
176
  Logger_1.default.info(response);
177
177
  if (response.success) {
178
- if (onResendSecurityCode) {
179
- // Fermeture boite de dialogue
180
- setOpenPhoneNumberInput(false);
181
- onResendSecurityCode(response.success, (_a = response.data) !== null && _a !== void 0 ? _a : '');
182
- }
178
+ // Fermeture boite de dialogue
179
+ setOpenPhoneNumberInput(false);
180
+ onResendSecurityCode(response.success, (_a = response.data) !== null && _a !== void 0 ? _a : '');
183
181
  }
184
182
  else {
185
- if (onResendSecurityCode) {
186
- onResendSecurityCode(response.success, (_b = response.error) !== null && _b !== void 0 ? _b : '');
187
- }
183
+ onResendSecurityCode(response.success, (_b = response.error) !== null && _b !== void 0 ? _b : '');
188
184
  }
189
185
  }).catch(function (error) {
190
186
  Logger_1.default.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.69",
3
+ "version": "1.1.70",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@ interface AccountValidationProps {
28
28
  movaAppType: MovaAppType,
29
29
  smsValidation: boolean,
30
30
  onSubmit: (success:boolean, message:string) => void,
31
- onResendSecurityCode: (success:boolean, message:string) => void,
31
+ onResendSecurityCode?: (success:boolean, message:string) => void,
32
32
  }
33
33
 
34
34
  const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppType, smsValidation, onSubmit, onResendSecurityCode }) => {
@@ -195,7 +195,7 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
195
195
 
196
196
  const resendCode = () => {
197
197
 
198
- if(controlPhoneNumber()){
198
+ if(controlPhoneNumber() && onResendSecurityCode){
199
199
 
200
200
  let req = {
201
201
  phoneNumber : validationForm.phoneNumber?.value
@@ -207,15 +207,11 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
207
207
  Logger.info(response);
208
208
 
209
209
  if(response.success){
210
- if(onResendSecurityCode){
211
- // Fermeture boite de dialogue
212
- setOpenPhoneNumberInput(false);
213
- onResendSecurityCode(response.success, response.data ?? '');
214
- }
210
+ // Fermeture boite de dialogue
211
+ setOpenPhoneNumberInput(false);
212
+ onResendSecurityCode(response.success, response.data ?? '');
215
213
  }else{
216
- if(onResendSecurityCode){
217
- onResendSecurityCode(response.success, response.error ?? '');
218
- }
214
+ onResendSecurityCode(response.success, response.error ?? '');
219
215
  }
220
216
 
221
217
  }).catch(error => {