@movalib/movalib-commons 1.60.0 → 1.62.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.
@@ -1,7 +1,7 @@
1
- import { FunctionComponent, ReactNode } from "react";
2
1
  import { AlertColor } from "@mui/material";
3
- import { MovaLoginForm } from "./helpers/Types";
2
+ import { FunctionComponent, ReactNode } from "react";
4
3
  import { MovaAppType } from "./helpers/Enums";
4
+ import { MovaLoginForm } from "./helpers/Types";
5
5
  /**
6
6
  * Propriétés du composant
7
7
  * movaAppType : type d'application Movalib au sein de laquelle le composant est injectée
@@ -51,26 +51,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  var jsx_runtime_1 = require("react/jsx-runtime");
54
- var react_1 = require("react");
54
+ var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
55
+ var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
55
56
  var lab_1 = require("@mui/lab");
56
- var logo_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_large_border.png"));
57
- var logo_pro_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large_border.png"));
57
+ var material_1 = require("@mui/material");
58
+ var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
59
+ var libphonenumber_js_1 = require("libphonenumber-js");
60
+ var react_1 = require("react");
61
+ var react_router_dom_1 = require("react-router-dom");
62
+ var DialogForgotPassword_1 = __importDefault(require("./DialogForgotPassword"));
63
+ var MovaCopyright_1 = __importDefault(require("./MovaCopyright"));
64
+ var leaf_green_large_png_1 = __importDefault(require("./assets/images/leaf_green_large.png"));
65
+ var leaf_pink_large_png_1 = __importDefault(require("./assets/images/leaf_pink_large.png"));
58
66
  var logo_admin_large_png_1 = __importDefault(require("./assets/images/logo/logo_admin_large.png"));
67
+ var logo_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_large_border.png"));
59
68
  var logo_large_dm_png_1 = __importDefault(require("./assets/images/logo/logo_large_dm.png"));
69
+ var logo_pro_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large_border.png"));
60
70
  var logo_pro_large_dm_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large_dm.png"));
61
- var leaf_green_large_png_1 = __importDefault(require("./assets/images/leaf_green_large.png"));
62
- var leaf_pink_large_png_1 = __importDefault(require("./assets/images/leaf_pink_large.png"));
63
- var material_1 = require("@mui/material");
64
- var MovaCopyright_1 = __importDefault(require("./MovaCopyright"));
65
71
  var Enums_1 = require("./helpers/Enums");
66
- var Validator_1 = require("./helpers/Validator");
67
72
  var Tools_1 = require("./helpers/Tools");
68
- var react_router_dom_1 = require("react-router-dom");
69
- var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
70
- var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
71
- var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
72
- var DialogForgotPassword_1 = __importDefault(require("./DialogForgotPassword"));
73
- var libphonenumber_js_1 = require("libphonenumber-js");
73
+ var Validator_1 = require("./helpers/Validator");
74
74
  // Permet de centrer le contenu de l'application
75
75
  var styles = {
76
76
  display: 'flex',
@@ -233,14 +233,16 @@ var MovaLogin = function (_a) {
233
233
  </Dialog>
234
234
  );
235
235
  } */
236
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: styles }, { children: [(0, jsx_runtime_1.jsx)("img", { src: leaf_green_large_png_1.default, style: { position: 'fixed',
236
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: styles }, { children: [(0, jsx_runtime_1.jsx)("img", { src: leaf_green_large_png_1.default, style: {
237
+ position: 'fixed',
237
238
  float: 'left',
238
239
  width: '250px',
239
240
  height: '400px',
240
241
  top: '-20%',
241
242
  left: '0%',
242
243
  opacity: '0.3',
243
- zIndex: -8 }, alt: 'Feuille Verte Movalib' }), (0, jsx_runtime_1.jsxs)(material_1.Container, __assign({ component: "main", maxWidth: "xs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CssBaseline, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
244
+ zIndex: -8
245
+ }, alt: 'Feuille Verte Movalib' }), (0, jsx_runtime_1.jsxs)(material_1.Container, __assign({ component: "main", maxWidth: "xs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CssBaseline, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
244
246
  marginTop: 6,
245
247
  display: 'flex',
246
248
  flexDirection: 'column',
@@ -263,13 +265,15 @@ var MovaLogin = function (_a) {
263
265
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
264
266
  }
265
267
  } }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { value: "remember", color: "primary" }), label: "Se souvenir de moi" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, __assign({ loading: loading, type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2, backgroundColor: darkMode ? theme.palette.primary.dark : theme.palette.primary.main } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Se connecter" }) })), movaAppType === Enums_1.MovaAppType.INDIVIDUAL && (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ fullWidth: true, variant: "outlined", onClick: function (e) { return handleOnClickSignUp(); }, sx: { mb: 2, color: theme.palette.primary.dark } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "CR\u00C9ER MON COMPTE" }) })), alertMessage && alertSeverity && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: alertSeverity, sx: { mb: 2 } }, { children: alertMessage })), (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({ variant: "body2", color: "text.secondary", onClick: function (e) { return handleOnClickForgotPassword(); }, sx: { cursor: 'pointer' } }, { children: "Mot de passe oubli\u00E9 ?" })) })) }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 1 } }), version && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body2', color: theme.palette.grey[200], sx: { textAlign: 'center' } }, { children: version })), openForgotPassword &&
266
- (0, jsx_runtime_1.jsx)(DialogForgotPassword_1.default, { openForgotPassword: openForgotPassword, setOpenForgotPassword: setOpenForgotPassword, movaAppType: movaAppType, form: form, handleInputChange: handleInputChange, handleSubmitForgotPassword: handleSubmitForgotPassword })] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
268
+ (0, jsx_runtime_1.jsx)(DialogForgotPassword_1.default, { openForgotPassword: openForgotPassword, setOpenForgotPassword: setOpenForgotPassword, movaAppType: movaAppType, form: form, handleInputChange: handleInputChange, handleSubmitForgotPassword: handleSubmitForgotPassword })] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: {
269
+ position: 'fixed',
267
270
  float: 'right',
268
271
  width: '250px',
269
272
  height: '400px',
270
273
  bottom: '-20%',
271
274
  right: '0%',
272
275
  opacity: '0.3',
273
- zIndex: '-10' }, alt: 'Feuille Rose Movalib' })] })));
276
+ zIndex: '-10'
277
+ }, alt: 'Feuille Rose Movalib' })] })));
274
278
  };
275
279
  exports.default = MovaLogin;
@@ -1,11 +1,12 @@
1
- import VehicleTire from "../models/VehicleTire";
2
- import { MovaFormField, MovaInterval } from "./Types";
3
1
  import { CSSProperties } from "react";
4
- import { DayOfWeek, PartsApplicationType } from "./Enums";
5
2
  import Schedule from "../models/Schedule";
3
+ import VehicleTire from "../models/VehicleTire";
4
+ import { DayOfWeek, PartsApplicationType } from "./Enums";
5
+ import { MovaFormField, MovaInterval } from "./Types";
6
6
  export declare const getApplicationsShortLabels: (applications: PartsApplicationType[] | undefined) => string;
7
7
  export declare const flexStart: CSSProperties;
8
8
  export declare const isSafariOniOS: () => boolean;
9
+ export declare const isInvalidMobileNumber: (phoneNumber?: string) => boolean;
9
10
  export declare const FR_WEEK_DAYS: string[];
10
11
  export declare const getDayOfWeekLabel: (day: DayOfWeek) => string | undefined;
11
12
  export declare const getDayOfWeekIndex: (day: DayOfWeek) => number;
@@ -1,28 +1,67 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = exports.flexLeftRow = exports.getFrenchDayLabel = exports.getDayOfWeek = exports.findScheduleByDayOfWeek = exports.formatTime = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
6
+ exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = exports.flexLeftRow = exports.getFrenchDayLabel = exports.getDayOfWeek = exports.findScheduleByDayOfWeek = exports.formatTime = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isInvalidMobileNumber = exports.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
7
+ var max_1 = __importDefault(require("libphonenumber-js/max"));
4
8
  var Enums_1 = require("./Enums");
5
9
  var getApplicationsShortLabels = function (applications) {
6
10
  if (!applications) {
7
- return '';
11
+ return "";
8
12
  }
9
- return applications.map(exports.getApplicationShortLabel).join(' + ');
13
+ return applications.map(exports.getApplicationShortLabel).join(" + ");
10
14
  };
11
15
  exports.getApplicationsShortLabels = getApplicationsShortLabels;
12
16
  exports.flexStart = {
13
- display: 'flex',
14
- justifyContent: 'start',
15
- alignItems: 'center'
17
+ display: "flex",
18
+ justifyContent: "start",
19
+ alignItems: "center",
16
20
  };
17
21
  var isSafariOniOS = function () {
18
22
  var userAgent = window.navigator.userAgent;
19
- var iOS = !!userAgent.match(/iPad/i) || !!userAgent.match(/iPhone/i) || !!userAgent.match(/iPod/i);
23
+ var iOS = !!userAgent.match(/iPad/i) ||
24
+ !!userAgent.match(/iPhone/i) ||
25
+ !!userAgent.match(/iPod/i);
20
26
  var webkit = !!userAgent.match(/WebKit/i);
21
27
  var criOS = !!userAgent.match(/CriOS/i);
22
28
  return iOS && webkit && !criOS;
23
29
  };
24
30
  exports.isSafariOniOS = isSafariOniOS;
25
- exports.FR_WEEK_DAYS = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'];
31
+ var isInvalidMobileNumber = function (phoneNumber) {
32
+ var _a;
33
+ if (phoneNumber === void 0) { phoneNumber = ""; }
34
+ if (!phoneNumber || typeof phoneNumber !== "string")
35
+ return true;
36
+ // Nettoyage : supprime les espaces et convertit "00..." en "+..."
37
+ var cleaned = phoneNumber.replace(/\s+/g, "").replace(/^00/, "+");
38
+ // Si le numéro ne commence pas par +, on assume que c'est un numéro local français
39
+ var cleanedPhoneNumber = cleaned.startsWith("+")
40
+ ? cleaned
41
+ : "+33".concat(cleaned.replace(/^0/, ""));
42
+ try {
43
+ var parsed = (0, max_1.default)(cleanedPhoneNumber);
44
+ var type = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.getType) === null || _a === void 0 ? void 0 : _a.call(parsed);
45
+ console.log(type);
46
+ console.log(parsed === null || parsed === void 0 ? void 0 : parsed.isValid());
47
+ console.log(["MOBILE", "MOBILE_OR_FIXED_LINE"].includes(type || ""));
48
+ return !((parsed === null || parsed === void 0 ? void 0 : parsed.isValid()) &&
49
+ ["MOBILE", "MOBILE_OR_FIXED_LINE"].includes(type || ""));
50
+ }
51
+ catch (_b) {
52
+ return true;
53
+ }
54
+ };
55
+ exports.isInvalidMobileNumber = isInvalidMobileNumber;
56
+ exports.FR_WEEK_DAYS = [
57
+ "Lundi",
58
+ "Mardi",
59
+ "Mercredi",
60
+ "Jeudi",
61
+ "Vendredi",
62
+ "Samedi",
63
+ "Dimanche",
64
+ ];
26
65
  var getDayOfWeekLabel = function (day) {
27
66
  if (day) {
28
67
  return exports.FR_WEEK_DAYS[(0, exports.getDayOfWeekIndex)(day)];
@@ -84,8 +123,12 @@ var sortMovaIntervals = function (intervals) {
84
123
  if (intervals) {
85
124
  return intervals.sort(function (a, b) {
86
125
  // Convertir en Date si nécessaire
87
- var startTimeA = a.startTime instanceof Date ? a.startTime : new Date(a.startTime);
88
- var startTimeB = b.startTime instanceof Date ? b.startTime : new Date(b.startTime);
126
+ var startTimeA = a.startTime instanceof Date
127
+ ? a.startTime
128
+ : new Date(a.startTime);
129
+ var startTimeB = b.startTime instanceof Date
130
+ ? b.startTime
131
+ : new Date(b.startTime);
89
132
  // Gérer les valeurs nulles
90
133
  if (startTimeA === null && startTimeB === null)
91
134
  return 0;
@@ -106,32 +149,46 @@ var findScheduleByDayOfWeek = function (schedules, dayIndex) {
106
149
  exports.findScheduleByDayOfWeek = findScheduleByDayOfWeek;
107
150
  var getDayOfWeek = function (index) {
108
151
  switch (index) {
109
- case 0: return Enums_1.DayOfWeek.MONDAY;
110
- case 1: return Enums_1.DayOfWeek.TUESDAY;
111
- case 2: return Enums_1.DayOfWeek.WEDNESDAY;
112
- case 3: return Enums_1.DayOfWeek.THURSDAY;
113
- case 4: return Enums_1.DayOfWeek.FRIDAY;
114
- case 5: return Enums_1.DayOfWeek.SATURDAY;
115
- case 6: return Enums_1.DayOfWeek.SUNDAY;
152
+ case 0:
153
+ return Enums_1.DayOfWeek.MONDAY;
154
+ case 1:
155
+ return Enums_1.DayOfWeek.TUESDAY;
156
+ case 2:
157
+ return Enums_1.DayOfWeek.WEDNESDAY;
158
+ case 3:
159
+ return Enums_1.DayOfWeek.THURSDAY;
160
+ case 4:
161
+ return Enums_1.DayOfWeek.FRIDAY;
162
+ case 5:
163
+ return Enums_1.DayOfWeek.SATURDAY;
164
+ case 6:
165
+ return Enums_1.DayOfWeek.SUNDAY;
116
166
  }
117
167
  };
118
168
  exports.getDayOfWeek = getDayOfWeek;
119
169
  var getFrenchDayLabel = function (day) {
120
170
  switch (day) {
121
- case Enums_1.DayOfWeek.MONDAY: return 'Lundi';
122
- case Enums_1.DayOfWeek.TUESDAY: return 'Mardi';
123
- case Enums_1.DayOfWeek.WEDNESDAY: return 'Mercredi';
124
- case Enums_1.DayOfWeek.THURSDAY: return 'Jeudi';
125
- case Enums_1.DayOfWeek.FRIDAY: return 'Vendredi';
126
- case Enums_1.DayOfWeek.SATURDAY: return 'Samedi';
127
- case Enums_1.DayOfWeek.SUNDAY: return 'Dimanche';
171
+ case Enums_1.DayOfWeek.MONDAY:
172
+ return "Lundi";
173
+ case Enums_1.DayOfWeek.TUESDAY:
174
+ return "Mardi";
175
+ case Enums_1.DayOfWeek.WEDNESDAY:
176
+ return "Mercredi";
177
+ case Enums_1.DayOfWeek.THURSDAY:
178
+ return "Jeudi";
179
+ case Enums_1.DayOfWeek.FRIDAY:
180
+ return "Vendredi";
181
+ case Enums_1.DayOfWeek.SATURDAY:
182
+ return "Samedi";
183
+ case Enums_1.DayOfWeek.SUNDAY:
184
+ return "Dimanche";
128
185
  }
129
186
  };
130
187
  exports.getFrenchDayLabel = getFrenchDayLabel;
131
188
  exports.flexLeftRow = {
132
- display: 'flex',
133
- justifyContent: 'start',
134
- alignItems: 'center'
189
+ display: "flex",
190
+ justifyContent: "start",
191
+ alignItems: "center",
135
192
  };
136
193
  var capitalizeFirstLetter = function (str) {
137
194
  if (str.length === 0) {
@@ -145,30 +202,40 @@ exports.capitalizeFirstLetter = capitalizeFirstLetter;
145
202
  var getApplicationShortLabel = function (application) {
146
203
  if (application) {
147
204
  switch (application) {
148
- case Enums_1.PartsApplicationType.FRONT: return "AV";
149
- case Enums_1.PartsApplicationType.REAR: return "AR";
150
- case Enums_1.PartsApplicationType.FRONT_REAR: return "AV + AR";
151
- case Enums_1.PartsApplicationType.LEFT: return "G";
152
- case Enums_1.PartsApplicationType.RIGHT: return "D";
153
- case Enums_1.PartsApplicationType.LEFT_RIGHT: return "G + D";
154
- case Enums_1.PartsApplicationType.FRONT_LEFT: return "AVG";
155
- case Enums_1.PartsApplicationType.FRONT_RIGHT: return "AVD";
156
- case Enums_1.PartsApplicationType.REAR_LEFT: return "ARG";
157
- case Enums_1.PartsApplicationType.REAR_RIGHT: return "ARD";
205
+ case Enums_1.PartsApplicationType.FRONT:
206
+ return "AV";
207
+ case Enums_1.PartsApplicationType.REAR:
208
+ return "AR";
209
+ case Enums_1.PartsApplicationType.FRONT_REAR:
210
+ return "AV + AR";
211
+ case Enums_1.PartsApplicationType.LEFT:
212
+ return "G";
213
+ case Enums_1.PartsApplicationType.RIGHT:
214
+ return "D";
215
+ case Enums_1.PartsApplicationType.LEFT_RIGHT:
216
+ return "G + D";
217
+ case Enums_1.PartsApplicationType.FRONT_LEFT:
218
+ return "AVG";
219
+ case Enums_1.PartsApplicationType.FRONT_RIGHT:
220
+ return "AVD";
221
+ case Enums_1.PartsApplicationType.REAR_LEFT:
222
+ return "ARG";
223
+ case Enums_1.PartsApplicationType.REAR_RIGHT:
224
+ return "ARD";
158
225
  }
159
226
  }
160
227
  return "";
161
228
  };
162
229
  exports.getApplicationShortLabel = getApplicationShortLabel;
163
230
  exports.flexEnd = {
164
- display: 'flex',
165
- justifyContent: 'end',
166
- alignItems: 'center'
231
+ display: "flex",
232
+ justifyContent: "end",
233
+ alignItems: "center",
167
234
  };
168
235
  exports.flexCenter = {
169
- display: 'flex',
170
- justifyContent: 'center',
171
- alignItems: 'center'
236
+ display: "flex",
237
+ justifyContent: "center",
238
+ alignItems: "center",
172
239
  };
173
240
  var isEmpty = function (data) {
174
241
  return Object.keys(data).length === 0;
@@ -187,7 +254,7 @@ var formatFrenchVehiclePlate = function (input) {
187
254
  plateFormat = Enums_1.VehiclePlateFormat.FRENCH_OLD;
188
255
  }
189
256
  // Supprimer tous les caractères non alphanumériques
190
- var cleanedInput = input.replace(/[^A-Z0-9]/gi, '').toUpperCase();
257
+ var cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
191
258
  switch (plateFormat) {
192
259
  case Enums_1.VehiclePlateFormat.FRENCH_NEW: {
193
260
  // Ajouter des tirets aux positions appropriées
@@ -214,18 +281,21 @@ var formatVehicleTire = function (vehicleTire) {
214
281
  var concatened = "".concat(vehicleTire.width).concat(vehicleTire.height).concat(vehicleTire.diameter).concat(vehicleTire.speedIndex);
215
282
  return (0, exports.formatVehicleTireStr)(concatened);
216
283
  }
217
- return '';
284
+ return "";
218
285
  };
219
286
  exports.formatVehicleTire = formatVehicleTire;
220
287
  var formatVehicleTireStr = function (input) {
221
- var formatted = input.toUpperCase().replace(/[^0-9A-QS-Za-qs-z]/g, '').slice(0, 7);
288
+ var formatted = input
289
+ .toUpperCase()
290
+ .replace(/[^0-9A-QS-Za-qs-z]/g, "")
291
+ .slice(0, 7);
222
292
  if (formatted.length > 3) {
223
293
  formatted = "".concat(formatted.substring(0, 3), " / ").concat(formatted.substring(3));
224
294
  }
225
295
  var indexOfRraw = input.indexOf("R");
226
- var toAdd = indexOfRraw !== -1 ? input.substring(indexOfRraw + 3) : '';
296
+ var toAdd = indexOfRraw !== -1 ? input.substring(indexOfRraw + 3) : "";
227
297
  if (toAdd.length > 0) {
228
- toAdd = ' ' + toAdd;
298
+ toAdd = " " + toAdd;
229
299
  }
230
300
  if (formatted.length > 8) {
231
301
  formatted = "".concat(formatted.substring(0, 8), " R").concat(formatted.substring(8)).concat(toAdd);
@@ -246,10 +316,10 @@ var validateField = function (field, validator, errorMsg) {
246
316
  return { value: field.value, error: errorMsg, isValid: false };
247
317
  }
248
318
  else if (field) {
249
- return { value: field.value, error: '', isValid: true };
319
+ return { value: field.value, error: "", isValid: true };
250
320
  }
251
321
  else {
252
- return { value: '', error: '', isValid: true };
322
+ return { value: "", error: "", isValid: true };
253
323
  }
254
324
  };
255
325
  exports.validateField = validateField;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateEmail = exports.validateText = exports.validatePhoneNumber = void 0;
4
+ var Tools_1 = require("./Tools");
4
5
  /**
5
6
  * Un email valide
6
7
  */
@@ -31,10 +32,10 @@ var userNameRegex = /^[a-z0-9_-]{3,20}$/;
31
32
  */
32
33
  var textRegex = /^[a-zA-Z0-9\s.,!?'"()+=-_-éèçà]+$/;
33
34
  function validatePhoneNumber(phoneNumber) {
34
- if (phoneNumber === null || phoneNumber === undefined || phoneNumber === '') {
35
+ if (phoneNumber === null || phoneNumber === undefined || phoneNumber === "") {
35
36
  return false;
36
37
  }
37
- return phoneNumberRegex.test(phoneNumber);
38
+ return !(0, Tools_1.isInvalidMobileNumber)(phoneNumber);
38
39
  }
39
40
  exports.validatePhoneNumber = validatePhoneNumber;
40
41
  function validateText(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.60.0",
3
+ "version": "1.62.0",
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",