@movalib/movalib-commons 1.2.28 → 1.2.30

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.
@@ -61,7 +61,7 @@ var AccountValidation = function (_a) {
61
61
  // Si cette variable est transmise, cela signifie que le compte a été créé sans mot de passe
62
62
  var localEmptyPwd = Boolean(params.get('emptyPwd'));
63
63
  setEmptyPwd(localEmptyPwd);
64
- if (token) {
64
+ if (token && !resetPassword) {
65
65
  setLoading(true);
66
66
  try {
67
67
  UserService_1.default.existsByToken(token)
@@ -81,8 +81,6 @@ var AccountValidation = function (_a) {
81
81
  finally {
82
82
  setLoading(false);
83
83
  }
84
- }
85
- if (token && !resetPassword) {
86
84
  if (!localEmptyPwd) {
87
85
  var req = {
88
86
  token: token
@@ -175,10 +173,12 @@ var AccountValidation = function (_a) {
175
173
  if (smsValidation)
176
174
  newForm.securityCode = (0, Tools_1.validateField)(validationForm.securityCode, function (value) { return value.length === 6; }, "Le code doit contenir 6 chiffres");
177
175
  // Validator pour les CGU
178
- newForm.acceptsTerms = (0, Tools_1.validateField)(validationForm.acceptsTerms, function (value) { return Boolean(value); }, movaAppType == Enums_1.MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
176
+ if (!resetPassword) {
177
+ newForm.acceptsTerms = (0, Tools_1.validateField)(validationForm.acceptsTerms, function (value) { return Boolean(value); }, movaAppType == Enums_1.MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
178
+ }
179
179
  setValidationForm(newForm);
180
180
  return newForm.password.isValid && newForm.confirmation.isValid && (smsValidation ? newForm.securityCode.isValid : true) &&
181
- newForm.acceptsTerms.isValid;
181
+ (resetPassword ? true : newForm.acceptsTerms.isValid);
182
182
  };
183
183
  var handleValidateAccount = function () {
184
184
  if (validateForm()) {
@@ -267,8 +267,9 @@ var AccountValidation = function (_a) {
267
267
  endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function (e) { return setShowPassword(function (prev) { return !prev; }); } }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
268
268
  } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "confirmation", label: "Confirmation mot de passe", type: showPassword ? 'text' : 'password', id: "confirmation", onChange: function (e) { return handleInputChange(e); }, value: validationForm.confirmation.value, error: !validationForm.confirmation.isValid, helperText: Boolean(validationForm.confirmation.error) ? validationForm.confirmation.error : "", InputProps: {
269
269
  endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function (e) { return setShowPassword(function (prev) { return !prev; }); } }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
270
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, display: 'flex', justifyContent: 'start' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !validationForm.acceptsTerms.isValid }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { name: "acceptsTerms", color: "primary", checked: validationForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); }, sx: { pr: 2 } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte ", movaAppType === Enums_1.MovaAppType.GARAGE ? "sans réserve" : '', " les", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: movaAppType === Enums_1.MovaAppType.GARAGE ? proCGUPath : CGUPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" })), movaAppType === Enums_1.MovaAppType.GARAGE &&
271
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)("br", {}), "et les ", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: proCGVPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales de Vente" }))] })] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: validationForm.acceptsTerms.error })] })) }))] })) })), loading &&
270
+ } }) })), !resetPassword &&
271
+ (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, display: 'flex', justifyContent: 'start' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !validationForm.acceptsTerms.isValid }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { name: "acceptsTerms", color: "primary", checked: validationForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); }, sx: { pr: 2 } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte ", movaAppType === Enums_1.MovaAppType.GARAGE ? "sans réserve" : '', " les", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: movaAppType === Enums_1.MovaAppType.GARAGE ? proCGUPath : CGUPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" })), movaAppType === Enums_1.MovaAppType.GARAGE &&
272
+ (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)("br", {}), "et les ", ' ', (0, jsx_runtime_1.jsx)("a", __assign({ href: proCGVPath, target: "_blank", style: { color: theme.palette.primary.main } }, { children: "Conditions G\u00E9n\u00E9rales de Vente" }))] })] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: validationForm.acceptsTerms.error })] })) }))] })) })), loading &&
272
273
  (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh" }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}) })), openPhoneNumberInput && (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openPhoneNumberInput, confirmLabel: "Envoyer", closeLabel: "Annuler", onClose: function () { return setOpenPhoneNumberInput(false); }, onConfirm: resendCode, message: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [(0, jsx_runtime_1.jsx)("b", { children: "Indiquez nous votre num\u00E9ro de t\u00E9l\u00E9phone" }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, required: true, id: "phoneNumber", label: "N\u00B0 de t\u00E9l\u00E9phone", name: "phoneNumber", autoComplete: "tel", onChange: function (e) { return handleInputChange(e); }, value: validationForm.phoneNumber.value, error: Boolean(validationForm.phoneNumber.error), helperText: validationForm.phoneNumber.error }) }))] }) })] }));
273
274
  };
274
275
  exports.default = AccountValidation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
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",
@@ -60,7 +60,8 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
60
60
  let localEmptyPwd = Boolean(params.get('emptyPwd'));
61
61
  setEmptyPwd(localEmptyPwd);
62
62
 
63
- if(token){
63
+ if (token && !resetPassword) {
64
+
64
65
  setLoading(true);
65
66
 
66
67
  try {
@@ -82,9 +83,6 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
82
83
  }finally {
83
84
  setLoading(false);
84
85
  }
85
- }
86
-
87
- if (token && !resetPassword) {
88
86
 
89
87
  if(!localEmptyPwd){
90
88
 
@@ -200,13 +198,15 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
200
198
  newForm.securityCode = validateField(validationForm.securityCode, value => value.length === 6, "Le code doit contenir 6 chiffres");
201
199
 
202
200
  // Validator pour les CGU
203
- newForm.acceptsTerms = validateField(validationForm.acceptsTerms, value => Boolean(value),
201
+ if(!resetPassword){
202
+ newForm.acceptsTerms = validateField(validationForm.acceptsTerms, value => Boolean(value),
204
203
  movaAppType == MovaAppType.GARAGE ? 'Vous devez accepter les termes de nos CGU et de nos CGV' : 'Vous devez accepter les termes de nos CGU');
204
+ }
205
205
 
206
206
  setValidationForm(newForm);
207
207
 
208
208
  return newForm.password.isValid && newForm.confirmation.isValid && (smsValidation ? newForm.securityCode.isValid : true) &&
209
- newForm.acceptsTerms.isValid;
209
+ (resetPassword ? true : newForm.acceptsTerms.isValid);
210
210
  }
211
211
 
212
212
 
@@ -423,39 +423,41 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
423
423
  }}
424
424
  />
425
425
  </Grid>
426
- <Grid item xs={12} sx={{mt: 2, display:'flex', justifyContent:'start'}} >
427
- <FormControl error={!validationForm.acceptsTerms.isValid} >
428
- <FormControlLabel
429
- control={
430
- <Checkbox
431
- name="acceptsTerms"
432
- color="primary"
433
- checked={validationForm.acceptsTerms.value}
434
- onChange={(e, checked) => handleCheckboxChange(e, checked)}
435
- sx={{pr: 2}}
436
- />
437
- }
438
- label={
439
- <span>
440
- J'accepte {movaAppType === MovaAppType.GARAGE ? "sans réserve" : ''} les{' '}
441
- <a href={movaAppType === MovaAppType.GARAGE ? proCGUPath : CGUPath} target="_blank"
442
- style={{ color:theme.palette.primary.main}}>
443
- Conditions Générales d'Utilisation
444
- </a>
445
- {movaAppType === MovaAppType.GARAGE &&
446
- <>
447
- &nbsp;<br />et les {' '}
448
- <a href={proCGVPath} target="_blank" style={{ color:theme.palette.primary.main}}>
449
- Conditions Générales de Vente
426
+ {!resetPassword &&
427
+ <Grid item xs={12} sx={{mt: 2, display:'flex', justifyContent:'start'}} >
428
+ <FormControl error={!validationForm.acceptsTerms.isValid} >
429
+ <FormControlLabel
430
+ control={
431
+ <Checkbox
432
+ name="acceptsTerms"
433
+ color="primary"
434
+ checked={validationForm.acceptsTerms.value}
435
+ onChange={(e, checked) => handleCheckboxChange(e, checked)}
436
+ sx={{pr: 2}}
437
+ />
438
+ }
439
+ label={
440
+ <span>
441
+ J'accepte {movaAppType === MovaAppType.GARAGE ? "sans réserve" : ''} les{' '}
442
+ <a href={movaAppType === MovaAppType.GARAGE ? proCGUPath : CGUPath} target="_blank"
443
+ style={{ color:theme.palette.primary.main}}>
444
+ Conditions Générales d'Utilisation
450
445
  </a>
451
- </>
446
+ {movaAppType === MovaAppType.GARAGE &&
447
+ <>
448
+ &nbsp;<br />et les {' '}
449
+ <a href={proCGVPath} target="_blank" style={{ color:theme.palette.primary.main}}>
450
+ Conditions Générales de Vente
451
+ </a>
452
+ </>
453
+ }
454
+ </span>
452
455
  }
453
- </span>
454
- }
455
- />
456
- <FormHelperText>{validationForm.acceptsTerms.error}</FormHelperText>
457
- </FormControl>
458
- </Grid>
456
+ />
457
+ <FormHelperText>{validationForm.acceptsTerms.error}</FormHelperText>
458
+ </FormControl>
459
+ </Grid>
460
+ }
459
461
  </Grid>
460
462
  </MovaDialog>}
461
463