@movalib/movalib-commons 1.0.20 → 1.0.22

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.
@@ -112,7 +112,7 @@ var MovaLogin = function (_a) {
112
112
  // Validator pour l'email
113
113
  newForm.email = (0, Tools_1.validateField)(form.email, Validator_1.validateEmail, 'Adresse email invalide');
114
114
  // Validator pour le mot de passe
115
- newForm.password = (0, Tools_1.validateField)(form.password, function (value) { return value.length >= 8; }, 'Votre mot de passe doit faire au moins 8 caractères de long');
115
+ newForm.password = (0, Tools_1.validateField)(form.password, function (value) { return value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value); }, 'Votre mot de passe doit faire au moins 8 caractères de long');
116
116
  setForm(newForm);
117
117
  return newForm.email.isValid && newForm.password.isValid;
118
118
  };
@@ -135,12 +135,12 @@ var MovaLogin = function (_a) {
135
135
  // Validator pour l'email
136
136
  newForm.email = (0, Tools_1.validateField)(userForm.email, Validator_1.validateEmail, 'Adresse email invalide');
137
137
  // Validator pour le mot de passe
138
- newForm.password = (0, Tools_1.validateField)(userForm.password, function (value) { return value.length >= 8; }, 'Votre mot de passe doit faire au moins 8 caractères de long');
138
+ newForm.password = (0, Tools_1.validateField)(userForm.password, function (value) { return value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value); }, 'Votre mot de passe doit faire au moins 10 caractères de long, contenir au moins une majuscule et une minuscule');
139
139
  // Validator pour les CGU
140
140
  newForm.acceptsTerms = (0, Tools_1.validateField)(userForm.acceptsTerms, function (value) { return Boolean(value); }, 'Vous devez accepter les termes de nos CGU');
141
141
  setUserForm(newForm);
142
- return newForm.firstname.isValid && newForm.lastname.isValid && newForm.email.isValid
143
- && newForm.password.isValid && newForm.gender.isValid && newForm.birthDate.isValid;
142
+ return newForm.firstname.isValid && newForm.lastname.isValid && newForm.email.isValid && newForm.password.isValid
143
+ && newForm.gender.isValid && newForm.birthDate.isValid && newForm.acceptsTerms.isValid;
144
144
  };
145
145
  var getMovaLogo = function () {
146
146
  return movaAppType === Enums_1.MovaAppType.GARAGE ? logo_pro_large_png_1.default :
@@ -161,7 +161,7 @@ var MovaLogin = function (_a) {
161
161
  alignItems: 'center',
162
162
  } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '50%' } }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "button", sx: { pt: 2 } }, { children: "Nouveau compte utilisateur" }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, autoFocus: true, fullWidth: true, id: "firstname", label: "Pr\u00E9nom", name: "firstname", autoComplete: "given-name", onChange: function (e) { return handleInputChange(e); }, value: userForm.firstname.value, error: Boolean(userForm.firstname.error), helperText: userForm.firstname.error }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "lastname", label: "Nom", name: "lastname", autoComplete: "family-name", onChange: function (e) { return handleInputChange(e); }, value: userForm.lastname.value, error: Boolean(userForm.lastname.error), helperText: userForm.lastname.error }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: userForm.email.value, error: !userForm.email.isValid, helperText: userForm.email.error }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Mot de passe", type: "password", id: "password", autoComplete: "current-password", onChange: function (e) { return handleInputChange(e); }, value: userForm.password.value, error: !userForm.password.isValid, helperText: Boolean(userForm.password.error) ? userForm.password.error : "8 caractères minimum" }), (0, jsx_runtime_1.jsx)(GenderSelector_1.default, { handleSelectChange: handleSelectChange, form: userForm, required: true, sx: { width: '40%', mr: 2 } }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, name: "birthDate", label: "Date de naissance", type: "date", InputLabelProps: {
163
163
  shrink: true,
164
- }, autoComplete: "bday", value: userForm.birthDate.value, error: !userForm.birthDate.isValid, helperText: userForm.birthDate.error, onChange: function (e) { return handleInputChange(e); }, sx: { width: '50%', float: 'right' } }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !userForm.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: userForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte les", ' ', (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ href: "/terms-and-conditions", target: "_blank" }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" }))] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: userForm.acceptsTerms.error })] })), alertMessage && alertSeverity && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: alertSeverity, sx: { mb: 2 } }, { children: alertMessage })), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, __assign({ loading: loading, type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Cr\u00E9er mon compte" }) }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 4 } })] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
164
+ }, autoComplete: "bday", value: userForm.birthDate.value, error: !userForm.birthDate.isValid, helperText: userForm.birthDate.error, onChange: function (e) { return handleInputChange(e); }, sx: { width: '50%', float: 'right' } }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ error: !userForm.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: userForm.acceptsTerms.value, onChange: function (e, checked) { return handleCheckboxChange(e, checked); } }), label: (0, jsx_runtime_1.jsxs)("span", { children: ["J'accepte les", ' ', (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ href: "/terms-and-conditions", target: "_blank" }, { children: "Conditions G\u00E9n\u00E9rales d'Utilisation" }))] }) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: userForm.acceptsTerms.error })] })), alertMessage && alertSeverity && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: alertSeverity, sx: { mb: 2 } }, { children: alertMessage })), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, __assign({ loading: loading, type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Cr\u00E9er mon compte" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ href: "/login", variant: "body2", color: "text.secondary" }, { children: "Se connecter" })) })) }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 4 } })] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
165
165
  float: 'right',
166
166
  width: '250px',
167
167
  height: '400px',
@@ -1,3 +1,8 @@
1
+ export declare enum DocumentType {
2
+ INVOICE = "INVOICE",
3
+ TYRE_PICTURE = "TYRE_PICTURE",
4
+ CAR_PICTURE = "CAR_PICTURE"
5
+ }
1
6
  export declare enum MovaAppType {
2
7
  /**
3
8
  * Application Garagiste
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoleType = exports.MovaAppType = void 0;
3
+ exports.RoleType = exports.MovaAppType = exports.DocumentType = void 0;
4
+ var DocumentType;
5
+ (function (DocumentType) {
6
+ DocumentType["INVOICE"] = "INVOICE";
7
+ DocumentType["TYRE_PICTURE"] = "TYRE_PICTURE";
8
+ DocumentType["CAR_PICTURE"] = "CAR_PICTURE";
9
+ })(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
4
10
  var MovaAppType;
5
11
  (function (MovaAppType) {
6
12
  /**
@@ -0,0 +1,10 @@
1
+ import { DocumentType } from "../helpers/Enums";
2
+ export default class Document {
3
+ id: string;
4
+ name: string;
5
+ type: DocumentType;
6
+ content: string;
7
+ creationDate: Date;
8
+ updateDate: Date;
9
+ constructor(id: string, name: string, type: DocumentType, content: string, creationDate: Date, updateDate: Date);
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Document = /** @class */ (function () {
4
+ function Document(id, name, type, content, creationDate, updateDate) {
5
+ this.id = id;
6
+ this.name = name;
7
+ this.type = type;
8
+ this.content = content;
9
+ this.creationDate = creationDate;
10
+ this.updateDate = updateDate;
11
+ }
12
+ return Document;
13
+ }());
14
+ exports.default = Document;
@@ -1,4 +1,5 @@
1
1
  import Address from './Address';
2
+ import Vehicle from "./Vehicle";
2
3
  export default class User {
3
4
  id: string;
4
5
  roles: string[];
@@ -10,7 +11,8 @@ export default class User {
10
11
  created: Date;
11
12
  addresses?: Address[];
12
13
  phoneNumber?: string;
13
- constructor(id: string, roles: string[], firstname?: string, lastname?: string, avatar?: string, email?: string, password?: string, created?: Date, addresses?: Address[], phoneNumber?: string);
14
+ vehicles?: Vehicle[];
15
+ constructor(id: string, roles: string[], firstname?: string, lastname?: string, avatar?: string, email?: string, password?: string, created?: Date, addresses?: Address[], phoneNumber?: string, vehicles?: Vehicle[]);
14
16
  static getFirstLetter: (user: User) => string;
15
17
  static isCustomer: (user: User) => boolean;
16
18
  static isTechnician: (user: User) => boolean;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Enums_1 = require("../helpers/Enums");
4
4
  var User = /** @class */ (function () {
5
- function User(id, roles, firstname, lastname, avatar, email, password, created, addresses, phoneNumber) {
5
+ function User(id, roles, firstname, lastname, avatar, email, password, created, addresses, phoneNumber, vehicles) {
6
6
  if (firstname === void 0) { firstname = ''; }
7
7
  if (lastname === void 0) { lastname = ''; }
8
8
  if (avatar === void 0) { avatar = ''; }
@@ -19,6 +19,7 @@ var User = /** @class */ (function () {
19
19
  this.created = created;
20
20
  this.addresses = addresses;
21
21
  this.phoneNumber = phoneNumber;
22
+ this.vehicles = vehicles;
22
23
  }
23
24
  User.getFirstLetter = function (user) {
24
25
  var firstLetter = user.lastname[0].toUpperCase();
@@ -0,0 +1,21 @@
1
+ import Document from './Document';
2
+ export default class Vehicle {
3
+ id: number;
4
+ ownerId: number;
5
+ averageMileagePerYear: number;
6
+ plate: string;
7
+ brand: string;
8
+ model: string;
9
+ version: string;
10
+ vin: string;
11
+ currentMileage: number;
12
+ digitalPassportIndex: string;
13
+ firstRegistrationDate: Date;
14
+ ktype: string;
15
+ tireDiameter: string;
16
+ tireHeight: string;
17
+ tireSpeedIndex: string;
18
+ tireWidth: string;
19
+ documents: Document[];
20
+ constructor(id: number, ownerId: number, averageMileagePerYear: number, plate: string, brand: string, model: string, version: string, vin: string, currentMileage: number, digitalPassportIndex: string, firstRegistrationDate: Date, ktype: string, tireDiameter: string, tireHeight: string, tireSpeedIndex: string, tireWidth: string, documents: Document[]);
21
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* AUDI A5 Sportback (F5A, F5F)
4
+ Marque : AUDI
5
+ Modele : A5 Sportback (F5A, F5F)
6
+ Corps : 3/5 portes
7
+ Version : 2.0 TFSI
8
+ Immatriculation : FE-291-MF
9
+ Années de production : 06 2016 -
10
+ Carburant : Essence
11
+ Cylindrée : 1984 cm3
12
+ Puissance : 140 KW (190 HP) */
13
+ var Vehicle = /** @class */ (function () {
14
+ function Vehicle(id, ownerId, averageMileagePerYear, plate, brand, model, version, vin, currentMileage, digitalPassportIndex, firstRegistrationDate, ktype, tireDiameter, tireHeight, tireSpeedIndex, tireWidth, documents) {
15
+ this.id = id;
16
+ this.ownerId = ownerId;
17
+ this.averageMileagePerYear = averageMileagePerYear;
18
+ this.plate = plate;
19
+ this.brand = brand;
20
+ this.model = model;
21
+ this.version = version;
22
+ this.vin = vin;
23
+ this.currentMileage = currentMileage;
24
+ this.digitalPassportIndex = digitalPassportIndex;
25
+ this.firstRegistrationDate = firstRegistrationDate;
26
+ this.ktype = ktype;
27
+ this.tireDiameter = tireDiameter;
28
+ this.tireHeight = tireHeight;
29
+ this.tireSpeedIndex = tireSpeedIndex;
30
+ this.tireWidth = tireWidth;
31
+ this.documents = documents;
32
+ }
33
+ return Vehicle;
34
+ }());
35
+ exports.default = Vehicle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
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",
package/src/MovaLogin.tsx CHANGED
@@ -82,7 +82,9 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
82
82
  newForm.email = validateField(form.email, validateEmail, 'Adresse email invalide');
83
83
 
84
84
  // Validator pour le mot de passe
85
- newForm.password = validateField(form.password, value => value.length >= 8, 'Votre mot de passe doit faire au moins 8 caractères de long');
85
+ newForm.password = validateField(form.password,
86
+ value => value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value),
87
+ 'Votre mot de passe doit faire au moins 8 caractères de long');
86
88
 
87
89
  setForm(newForm);
88
90
 
@@ -110,15 +110,17 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
110
110
  newForm.email = validateField(userForm.email, validateEmail, 'Adresse email invalide');
111
111
 
112
112
  // Validator pour le mot de passe
113
- newForm.password = validateField(userForm.password, value => value.length >= 8, 'Votre mot de passe doit faire au moins 8 caractères de long');
113
+ newForm.password = validateField(userForm.password,
114
+ value => value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value),
115
+ 'Votre mot de passe doit faire au moins 10 caractères de long, contenir au moins une majuscule et une minuscule');
114
116
 
115
117
  // Validator pour les CGU
116
118
  newForm.acceptsTerms = validateField(userForm.acceptsTerms, value => Boolean(value), 'Vous devez accepter les termes de nos CGU');
117
119
 
118
120
  setUserForm(newForm);
119
121
 
120
- return newForm.firstname.isValid && newForm.lastname.isValid && newForm.email.isValid
121
- && newForm.password.isValid && newForm.gender.isValid && newForm.birthDate.isValid;
122
+ return newForm.firstname.isValid && newForm.lastname.isValid && newForm.email.isValid && newForm.password.isValid
123
+ && newForm.gender.isValid && newForm.birthDate.isValid && newForm.acceptsTerms.isValid;
122
124
  }
123
125
 
124
126
  const getMovaLogo = () => {
@@ -262,6 +264,14 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
262
264
  <span>Créer mon compte</span>
263
265
  </LoadingButton>
264
266
 
267
+ <Grid container>
268
+ <Grid item xs>
269
+ <Link href="/login" variant="body2" color="text.secondary">
270
+ Se connecter
271
+ </Link>
272
+ </Grid>
273
+ </Grid>
274
+
265
275
  </Box>
266
276
  <MovaCopyright sx={{ mt: 8, mb: 4 }} />
267
277
  </Container>
@@ -1,3 +1,9 @@
1
+ export enum DocumentType {
2
+ INVOICE = 'INVOICE',
3
+ TYRE_PICTURE = 'TYRE_PICTURE',
4
+ CAR_PICTURE = 'CAR_PICTURE'
5
+ }
6
+
1
7
 
2
8
  export enum MovaAppType {
3
9
  /**
@@ -0,0 +1,28 @@
1
+ import { DocumentType } from "../helpers/Enums";
2
+
3
+ export default class Document {
4
+
5
+ //Properties
6
+ id: string; // UUID
7
+ name: string;
8
+ type: DocumentType;
9
+ content: string; // Photos stockée en base64
10
+ creationDate: Date;
11
+ updateDate: Date;
12
+
13
+ constructor(
14
+ id: string,
15
+ name: string,
16
+ type: DocumentType,
17
+ content: string,
18
+ creationDate: Date,
19
+ updateDate: Date
20
+ ) {
21
+ this.id = id;
22
+ this.name = name;
23
+ this.type = type;
24
+ this.content = content;
25
+ this.creationDate = creationDate;
26
+ this.updateDate = updateDate;
27
+ }
28
+ }
@@ -1,5 +1,6 @@
1
1
  import { RoleType } from "../helpers/Enums";
2
2
  import Address from './Address';
3
+ import Vehicle from "./Vehicle";
3
4
 
4
5
  export default class User {
5
6
 
@@ -14,6 +15,7 @@ export default class User {
14
15
  created: Date;
15
16
  addresses? : Address[]
16
17
  phoneNumber?: string;
18
+ vehicles?: Vehicle[];
17
19
 
18
20
  constructor(
19
21
  id: string,
@@ -25,7 +27,8 @@ export default class User {
25
27
  password: string = '',
26
28
  created: Date = new Date(),
27
29
  addresses?: Address[],
28
- phoneNumber?: string
30
+ phoneNumber?: string ,
31
+ vehicles?: Vehicle[]
29
32
  ) {
30
33
  this.id = id;
31
34
  this.roles = roles;
@@ -37,6 +40,7 @@ export default class User {
37
40
  this.created = created;
38
41
  this.addresses = addresses;
39
42
  this.phoneNumber = phoneNumber;
43
+ this.vehicles = vehicles;
40
44
  }
41
45
 
42
46
  static getFirstLetter = (user: User) : string => {
@@ -0,0 +1,72 @@
1
+ import Document from './Document';
2
+
3
+ /* AUDI A5 Sportback (F5A, F5F)
4
+ Marque : AUDI
5
+ Modele : A5 Sportback (F5A, F5F)
6
+ Corps : 3/5 portes
7
+ Version : 2.0 TFSI
8
+ Immatriculation : FE-291-MF
9
+ Années de production : 06 2016 -
10
+ Carburant : Essence
11
+ Cylindrée : 1984 cm3
12
+ Puissance : 140 KW (190 HP) */
13
+
14
+ export default class Vehicle {
15
+
16
+ // Properties
17
+ id: number;
18
+ ownerId: number;
19
+ averageMileagePerYear: number;
20
+ plate: string;
21
+ brand: string;
22
+ model: string;
23
+ version: string;
24
+ vin: string;
25
+ currentMileage: number;
26
+ digitalPassportIndex: string;
27
+ firstRegistrationDate: Date;
28
+ ktype: string;
29
+ tireDiameter: string;
30
+ tireHeight: string;
31
+ tireSpeedIndex: string;
32
+ tireWidth: string;
33
+ documents : Document[];
34
+
35
+ constructor(
36
+ id: number,
37
+ ownerId: number,
38
+ averageMileagePerYear: number,
39
+ plate: string,
40
+ brand: string,
41
+ model: string,
42
+ version: string,
43
+ vin: string,
44
+ currentMileage: number,
45
+ digitalPassportIndex: string,
46
+ firstRegistrationDate: Date,
47
+ ktype: string,
48
+ tireDiameter: string,
49
+ tireHeight: string,
50
+ tireSpeedIndex: string,
51
+ tireWidth: string,
52
+ documents: Document[]
53
+ ) {
54
+ this.id = id;
55
+ this.ownerId = ownerId;
56
+ this.averageMileagePerYear = averageMileagePerYear;
57
+ this.plate = plate;
58
+ this.brand = brand;
59
+ this.model = model;
60
+ this.version = version;
61
+ this.vin = vin;
62
+ this.currentMileage = currentMileage;
63
+ this.digitalPassportIndex = digitalPassportIndex;
64
+ this.firstRegistrationDate = firstRegistrationDate;
65
+ this.ktype = ktype;
66
+ this.tireDiameter = tireDiameter;
67
+ this.tireHeight = tireHeight;
68
+ this.tireSpeedIndex = tireSpeedIndex;
69
+ this.tireWidth = tireWidth;
70
+ this.documents = documents;
71
+ }
72
+ }