@movalib/movalib-commons 1.0.66 → 1.0.68

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.
Files changed (44) hide show
  1. package/.env.development +6 -0
  2. package/.env.production +4 -0
  3. package/devIndex.tsx +127 -12
  4. package/dist/devIndex.js +104 -8
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.js +5 -1
  7. package/dist/src/MovaLogin.js +11 -2
  8. package/dist/src/MovaSignUp.d.ts +1 -1
  9. package/dist/src/MovaSignUp.js +42 -10
  10. package/dist/src/QRCode.d.ts +1 -0
  11. package/dist/src/QRCode.js +13 -12
  12. package/dist/src/ScheduleFields.d.ts +24 -0
  13. package/dist/src/ScheduleFields.js +202 -0
  14. package/dist/src/helpers/ApiHelper.d.ts +20 -0
  15. package/dist/src/helpers/ApiHelper.js +74 -0
  16. package/dist/src/helpers/CookieUtils.d.ts +6 -0
  17. package/dist/src/helpers/CookieUtils.js +28 -0
  18. package/dist/src/helpers/Enums.d.ts +8 -1
  19. package/dist/src/helpers/Enums.js +10 -2
  20. package/dist/src/helpers/Tools.d.ts +6 -2
  21. package/dist/src/helpers/Tools.js +20 -7
  22. package/dist/src/services/AuthenticationService.d.ts +6 -0
  23. package/dist/src/services/AuthenticationService.js +106 -0
  24. package/dist/src/services/GarageService.d.ts +5 -0
  25. package/dist/src/services/GarageService.js +16 -0
  26. package/dist/src/services/UserService.d.ts +10 -0
  27. package/dist/src/services/UserService.js +76 -0
  28. package/index.ts +3 -1
  29. package/package.json +9 -7
  30. package/public/index.html +1 -1
  31. package/src/MovaLogin.tsx +24 -5
  32. package/src/MovaSignUp.tsx +71 -15
  33. package/src/QRCode.css +4 -0
  34. package/src/QRCode.tsx +12 -13
  35. package/src/ScheduleFields.tsx +301 -0
  36. package/src/helpers/ApiHelper.ts +95 -0
  37. package/src/helpers/CookieUtils.ts +23 -0
  38. package/src/helpers/Enums.ts +8 -1
  39. package/src/helpers/Tools.ts +20 -2
  40. package/src/services/AuthenticationService.ts +68 -0
  41. package/src/services/GarageService.ts +14 -0
  42. package/src/services/UserService.ts +25 -0
  43. package/tsconfig.json +1 -1
  44. package/webpack.config.js +9 -0
@@ -0,0 +1,6 @@
1
+ #Les variables d'environnements React doivent commencer par "REACT_APP_"
2
+ HTTPS=true
3
+ REACT_APP_API_URL=https://localhost:8443/api
4
+ # Activer cette URL pour tester la PROD avec l'API en Localhost
5
+ #REACT_APP_API_URL=http://localhost:8080/api
6
+ REACT_APP_MOVALIB_APP_URL=https://localhost:3001
@@ -0,0 +1,4 @@
1
+ #Les variables d'environnements React doivent commencer par "REACT_APP_"
2
+ HTTPS=true
3
+ REACT_APP_API_URL=https://api.movalib.com/api
4
+ REACT_APP_MOVALIB_APP_URL=https://app.movalib.com
package/devIndex.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Fragment, useEffect, useState } from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  // Import des composants de la bibliothèque
4
4
  import MovaLogin from './src/MovaLogin';
@@ -7,21 +7,136 @@ import { MovaAppType } from './src/helpers/Enums';
7
7
  import { ThemeProvider } from '@mui/material/styles';
8
8
  import theme from './theme'; // Import du thème personnalisé
9
9
  import MovaSignUp from './src/MovaSignUp';
10
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
11
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
12
+ import DatePicker from '@mui/lab/DatePicker';
13
+ import frLocale from 'date-fns/locale/fr';
14
+ import QRCode from './src/QRCode';
15
+ import { Box } from '@mui/material';
16
+ import GarageService from './src/services/GarageService';
17
+ import AuthenticationService from './src/services/AuthenticationService';
18
+ import Logger from './src/helpers/Logger';
19
+ import Garage from './src/models/Garage';
20
+ import ScheduleFields, { DaySchedule } from './src/ScheduleFields';
21
+ import Schedule from './src/models/Schedule';
22
+ import { flexCenter } from './src/helpers/Tools';
10
23
 
11
24
  const App = () => {
25
+
26
+ // Activation des logs console si nous ne sommes pas en PRODUCTION sinon contrôle de la variable debugMode
27
+ if (process.env.NODE_ENV !== 'production' || localStorage.getItem('debugMode') === 'true') {
28
+ Logger.enableLogging();
29
+ }
30
+
31
+ // Chargement de données garage de test
32
+ const [garage, setGarage] = useState<Garage>();
33
+
34
+ useEffect(() => {
35
+
36
+ refreshGarageData();
37
+
38
+ }, []);
39
+
40
+
41
+ const refreshGarageData = () => {
42
+
43
+ AuthenticationService.login(MovaAppType.GARAGE, "cto@movalib.com", "cto@MOVALIB.com")
44
+ .then(response => {
45
+
46
+ if(response.success){
47
+ Logger.info(response.data);
48
+
49
+ // Chargement des données du garage
50
+ GarageService.getAdministratedGarages()
51
+ .then(response => {
52
+
53
+ if (response.success) {
54
+ Logger.info(response.data);
55
+ setGarage(response.data ? response.data[0] : undefined);
56
+ } else {
57
+ Logger.error(response.error);
58
+ }
59
+ })
60
+ .catch(error => {
61
+ Logger.error(response.error);
62
+ });
63
+
64
+ }else{
65
+ Logger.error(response.error);
66
+ }
67
+
68
+ }).catch(error => {
69
+ Logger.error(error);
70
+ });
71
+ }
72
+
73
+ const getQRCodeData = ():string => {
74
+ // On renvoie les données pour le QR Code, l'url change selon l'environnement (variables d'environnement)
75
+ return `https://localhost:3001/#/garage/1?redirect=garage`;
76
+ }
77
+
78
+ const handleScheduleChange = (schedule: DaySchedule[]) => {
79
+ alert('Hello !');
80
+ if(schedule){
81
+ // On contrôle l'absence d'erreur dans le tableau de schedule
82
+ const hasErrors = schedule.some(day => day.intervals.some(interval => interval.error !== null));
83
+
84
+ if(!hasErrors){
85
+ // On crée un objet Schedule sur la base du DaySchedule reçu de ScheduleFields
86
+ let newSchedule = new Array<Schedule>();
87
+
88
+ schedule.forEach(s => {
89
+ newSchedule.push(new Schedule(
90
+ s.day,
91
+ s.intervals.map(({ startTime, endTime, countryCode }) => ({ startTime, endTime, countryCode })),
92
+ true
93
+ ));
94
+ });
95
+
96
+ Logger.info(JSON.stringify(newSchedule));
97
+ let request = {
98
+ schedule: JSON.stringify(newSchedule)
99
+ };
100
+
101
+ alert('Schedule Submitted !');
102
+ }
103
+ }
104
+ }
105
+
106
+
12
107
  return (
13
108
  <div>
14
- <ThemeProvider theme={theme}>
15
- <MovaLogin movaAppType={MovaAppType.GARAGE} onSubmit={function (form: MovaLoginForm): void {
16
- alert('Form Submitted !');
17
- } } onSubmitForgotPassword={function (email: string): void {
18
- throw new Error('Function not implemented.');
19
- } } />
20
-
21
- <MovaSignUp movaAppType={MovaAppType.USER} onSubmit={function (form: MovaLoginForm): void {
22
- alert('Form Submitted !');
23
- } } />
24
- </ThemeProvider>
109
+ <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={frLocale}>
110
+ <ThemeProvider theme={theme}>
111
+ <Box sx={{ mb: 4}}>
112
+
113
+ <MovaLogin movaAppType={MovaAppType.GARAGE} onSubmit={function (form: MovaLoginForm): void {
114
+ alert('Form Submitted !');
115
+ } } onSubmitForgotPassword={function (email: string): void {
116
+ throw new Error('Function not implemented.');
117
+ } } />
118
+
119
+ <MovaSignUp movaAppType={MovaAppType.INDIVIDUAL} onSubmit={function (form: MovaLoginForm): void {
120
+ alert('Form Submitted !');
121
+ } } />
122
+
123
+ <QRCode data={getQRCodeData()} showDownload={true} />
124
+
125
+ <div style={{ marginTop: '40px' }} />
126
+
127
+ <div style={flexCenter}>
128
+ <ScheduleFields
129
+ schedules={garage?.schedules}
130
+ size="small"
131
+ timePickerStep={30}
132
+ onChange={handleScheduleChange}
133
+ />
134
+ </div>
135
+
136
+
137
+ </Box>
138
+ </ThemeProvider>
139
+ </LocalizationProvider>
25
140
  </div>
26
141
  );
27
142
  };
package/dist/devIndex.js CHANGED
@@ -10,12 +10,35 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
38
  };
16
39
  Object.defineProperty(exports, "__esModule", { value: true });
17
40
  var jsx_runtime_1 = require("react/jsx-runtime");
18
- var react_1 = __importDefault(require("react"));
41
+ var react_1 = __importStar(require("react"));
19
42
  var client_1 = require("react-dom/client");
20
43
  // Import des composants de la bibliothèque
21
44
  var MovaLogin_1 = __importDefault(require("./src/MovaLogin"));
@@ -23,14 +46,87 @@ var Enums_1 = require("./src/helpers/Enums");
23
46
  var styles_1 = require("@mui/material/styles");
24
47
  var theme_1 = __importDefault(require("./theme")); // Import du thème personnalisé
25
48
  var MovaSignUp_1 = __importDefault(require("./src/MovaSignUp"));
49
+ var LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
50
+ var AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
51
+ var fr_1 = __importDefault(require("date-fns/locale/fr"));
52
+ var QRCode_1 = __importDefault(require("./src/QRCode"));
53
+ var material_1 = require("@mui/material");
54
+ var GarageService_1 = __importDefault(require("./src/services/GarageService"));
55
+ var AuthenticationService_1 = __importDefault(require("./src/services/AuthenticationService"));
56
+ var Logger_1 = __importDefault(require("./src/helpers/Logger"));
57
+ var ScheduleFields_1 = __importDefault(require("./src/ScheduleFields"));
58
+ var Schedule_1 = __importDefault(require("./src/models/Schedule"));
59
+ var Tools_1 = require("./src/helpers/Tools");
26
60
  var App = function () {
27
- return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, __assign({ theme: theme_1.default }, { children: [(0, jsx_runtime_1.jsx)(MovaLogin_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (form) {
28
- alert('Form Submitted !');
29
- }, onSubmitForgotPassword: function (email) {
30
- throw new Error('Function not implemented.');
31
- } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { movaAppType: Enums_1.MovaAppType.USER, onSubmit: function (form) {
32
- alert('Form Submitted !');
33
- } })] })) }));
61
+ // Activation des logs console si nous ne sommes pas en PRODUCTION sinon contrôle de la variable debugMode
62
+ if (process.env.NODE_ENV !== 'production' || localStorage.getItem('debugMode') === 'true') {
63
+ Logger_1.default.enableLogging();
64
+ }
65
+ // Chargement de données garage de test
66
+ var _a = (0, react_1.useState)(), garage = _a[0], setGarage = _a[1];
67
+ (0, react_1.useEffect)(function () {
68
+ refreshGarageData();
69
+ }, []);
70
+ var refreshGarageData = function () {
71
+ AuthenticationService_1.default.login(Enums_1.MovaAppType.GARAGE, "cto@movalib.com", "cto@MOVALIB.com")
72
+ .then(function (response) {
73
+ if (response.success) {
74
+ Logger_1.default.info(response.data);
75
+ // Chargement des données du garage
76
+ GarageService_1.default.getAdministratedGarages()
77
+ .then(function (response) {
78
+ if (response.success) {
79
+ Logger_1.default.info(response.data);
80
+ setGarage(response.data ? response.data[0] : undefined);
81
+ }
82
+ else {
83
+ Logger_1.default.error(response.error);
84
+ }
85
+ })
86
+ .catch(function (error) {
87
+ Logger_1.default.error(response.error);
88
+ });
89
+ }
90
+ else {
91
+ Logger_1.default.error(response.error);
92
+ }
93
+ }).catch(function (error) {
94
+ Logger_1.default.error(error);
95
+ });
96
+ };
97
+ var getQRCodeData = function () {
98
+ // On renvoie les données pour le QR Code, l'url change selon l'environnement (variables d'environnement)
99
+ return "https://localhost:3001/#/garage/1?redirect=garage";
100
+ };
101
+ var handleScheduleChange = function (schedule) {
102
+ alert('Hello !');
103
+ if (schedule) {
104
+ // On contrôle l'absence d'erreur dans le tableau de schedule
105
+ var hasErrors = schedule.some(function (day) { return day.intervals.some(function (interval) { return interval.error !== null; }); });
106
+ if (!hasErrors) {
107
+ // On crée un objet Schedule sur la base du DaySchedule reçu de ScheduleFields
108
+ var newSchedule_1 = new Array();
109
+ schedule.forEach(function (s) {
110
+ newSchedule_1.push(new Schedule_1.default(s.day, s.intervals.map(function (_a) {
111
+ var startTime = _a.startTime, endTime = _a.endTime, countryCode = _a.countryCode;
112
+ return ({ startTime: startTime, endTime: endTime, countryCode: countryCode });
113
+ }), true));
114
+ });
115
+ Logger_1.default.info(JSON.stringify(newSchedule_1));
116
+ var request = {
117
+ schedule: JSON.stringify(newSchedule_1)
118
+ };
119
+ alert('Schedule Submitted !');
120
+ }
121
+ }
122
+ };
123
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(LocalizationProvider_1.LocalizationProvider, __assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: fr_1.default }, { children: (0, jsx_runtime_1.jsx)(styles_1.ThemeProvider, __assign({ theme: theme_1.default }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: { mb: 4 } }, { children: [(0, jsx_runtime_1.jsx)(MovaLogin_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (form) {
124
+ alert('Form Submitted !');
125
+ }, onSubmitForgotPassword: function (email) {
126
+ throw new Error('Function not implemented.');
127
+ } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { movaAppType: Enums_1.MovaAppType.INDIVIDUAL, onSubmit: function (form) {
128
+ alert('Form Submitted !');
129
+ } }), (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: getQRCodeData(), showDownload: true }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: '40px' } }), (0, jsx_runtime_1.jsx)("div", __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(ScheduleFields_1.default, { schedules: garage === null || garage === void 0 ? void 0 : garage.schedules, size: "small", timePickerStep: 30, onChange: handleScheduleChange }) }))] })) })) })) }));
34
130
  };
35
131
  var root = (0, client_1.createRoot)(document.getElementById('root'));
36
132
  root.render((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(App, {}) }));
package/dist/index.d.ts CHANGED
@@ -23,8 +23,10 @@ export { default as Garage } from './src/models/Garage';
23
23
  export { default as Schedule } from './src/models/Schedule';
24
24
  export { default as Event } from './src/models/Event';
25
25
  export { default as VehicleTire } from './src/models/VehicleTire';
26
+ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
26
27
  export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference, MovaVehicleForm } from './src/helpers/Types';
27
- export { validateField, formatVehicleTire, formatFrenchVehiclePlate } from './src/helpers/Tools';
28
+ export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
29
+ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty } from './src/helpers/Tools';
28
30
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
29
31
  export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLetter } from './src/helpers/DateUtils';
30
32
  export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes } from './src/helpers/Enums';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.capitalizeFirstLetter = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = void 0;
7
+ exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.capitalizeFirstLetter = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = void 0;
8
8
  // Export des composants
9
9
  var VehicleFullCard_1 = require("./src/VehicleFullCard");
10
10
  Object.defineProperty(exports, "VehicleFullCard", { enumerable: true, get: function () { return __importDefault(VehicleFullCard_1).default; } });
@@ -58,10 +58,14 @@ Object.defineProperty(exports, "Event", { enumerable: true, get: function () { r
58
58
  var VehicleTire_1 = require("./src/models/VehicleTire");
59
59
  Object.defineProperty(exports, "VehicleTire", { enumerable: true, get: function () { return __importDefault(VehicleTire_1).default; } });
60
60
  // Export des méthodes utilitaires
61
+ var CookieUtils_1 = require("./src/helpers/CookieUtils");
62
+ Object.defineProperty(exports, "readCookie", { enumerable: true, get: function () { return CookieUtils_1.readCookie; } });
63
+ Object.defineProperty(exports, "deleteCookie", { enumerable: true, get: function () { return CookieUtils_1.deleteCookie; } });
61
64
  var Tools_1 = require("./src/helpers/Tools");
62
65
  Object.defineProperty(exports, "validateField", { enumerable: true, get: function () { return Tools_1.validateField; } });
63
66
  Object.defineProperty(exports, "formatVehicleTire", { enumerable: true, get: function () { return Tools_1.formatVehicleTire; } });
64
67
  Object.defineProperty(exports, "formatFrenchVehiclePlate", { enumerable: true, get: function () { return Tools_1.formatFrenchVehiclePlate; } });
68
+ Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return Tools_1.isEmpty; } });
65
69
  var Validator_1 = require("./src/helpers/Validator");
66
70
  Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return Validator_1.validatePhoneNumber; } });
67
71
  Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return Validator_1.validateText; } });
@@ -63,6 +63,9 @@ var Enums_1 = require("./helpers/Enums");
63
63
  var Validator_1 = require("./helpers/Validator");
64
64
  var Tools_1 = require("./helpers/Tools");
65
65
  var react_router_dom_1 = require("react-router-dom");
66
+ var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
67
+ var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
68
+ var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
66
69
  // Permet de centrer le contenu de l'application
67
70
  var styles = {
68
71
  display: 'flex',
@@ -85,6 +88,7 @@ var MovaLogin = function (_a) {
85
88
  var _c = (0, react_1.useState)(""), message = _c[0], setMessage = _c[1];
86
89
  var history = (0, react_router_dom_1.useHistory)();
87
90
  var _d = (0, react_1.useState)(false), openForgotPassword = _d[0], setOpenForgotPassword = _d[1];
91
+ var _e = (0, react_1.useState)(false), showPassword = _e[0], setShowPassword = _e[1];
88
92
  var handleInputChange = function (e) {
89
93
  var _a;
90
94
  var fieldName = e.target.name;
@@ -121,7 +125,7 @@ var MovaLogin = function (_a) {
121
125
  };
122
126
  var getMovaLogo = function () {
123
127
  return movaAppType === Enums_1.MovaAppType.GARAGE ? logo_pro_large_png_1.default :
124
- movaAppType === Enums_1.MovaAppType.USER ? logo_large_png_1.default :
128
+ movaAppType === Enums_1.MovaAppType.INDIVIDUAL ? logo_large_png_1.default :
125
129
  movaAppType === Enums_1.MovaAppType.ADMIN ? logo_large_png_1.default : logo_large_png_1.default;
126
130
  };
127
131
  var handleOnClickSignUp = function (e) {
@@ -143,6 +147,9 @@ var MovaLogin = function (_a) {
143
147
  onSubmitForgotPassword(form.email.value);
144
148
  }
145
149
  };
150
+ var handleClickShowPassword = function () {
151
+ setShowPassword(function (prev) { return !prev; });
152
+ };
146
153
  /**
147
154
  * Boite de diaogue pour la perte du mot de passe
148
155
  */
@@ -162,7 +169,9 @@ var MovaLogin = function (_a) {
162
169
  display: 'flex',
163
170
  flexDirection: 'column',
164
171
  alignItems: 'center',
165
- } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '80%' } }), (0, jsx_runtime_1.jsx)("br", {})] })), (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, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", autoFocus: true, onChange: function (e) { return handleInputChange(e); }, value: form.email.value, error: !form.email.isValid, helperText: form.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: form.password.value, error: !form.password.isValid, helperText: form.password.error }), (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 } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Se connecter" }) })), alertMessage && alertSeverity && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: alertSeverity, sx: { mb: 2 } }, { children: alertMessage })), (0, jsx_runtime_1.jsxs)(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(e); } }, { children: "Mot de passe oubli\u00E9 ?" })) })), movaAppType === Enums_1.MovaAppType.USER && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ variant: "body2", color: "text.secondary", onClick: function (e) { return handleOnClickSignUp(e); } }, { children: "Cr\u00E9er mon compte" })) }))] }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 4 } }), openForgotPassword && dialogForgotPassword()] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
172
+ } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '80%' } }), (0, jsx_runtime_1.jsx)("br", {})] })), (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, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", autoFocus: true, onChange: function (e) { return handleInputChange(e); }, value: form.email.value, error: !form.email.isValid, helperText: form.email.error }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Mot de passe", type: showPassword ? 'text' : 'password', id: "password", autoComplete: "current-password", onChange: function (e) { return handleInputChange(e); }, value: form.password.value, error: !form.password.isValid, helperText: form.password.error, InputProps: {
173
+ 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: handleClickShowPassword }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
174
+ } }), (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 } }, { children: (0, jsx_runtime_1.jsx)("span", { children: "Se connecter" }) })), alertMessage && alertSeverity && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: alertSeverity, sx: { mb: 2 } }, { children: alertMessage })), (0, jsx_runtime_1.jsxs)(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(e); } }, { children: "Mot de passe oubli\u00E9 ?" })) })), movaAppType === Enums_1.MovaAppType.INDIVIDUAL && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ variant: "body2", color: "text.secondary", onClick: function (e) { return handleOnClickSignUp(e); } }, { children: "Cr\u00E9er mon compte" })) }))] }))] })), (0, jsx_runtime_1.jsx)(MovaCopyright_1.default, { sx: { mt: 8, mb: 4 } }), openForgotPassword && dialogForgotPassword()] })), (0, jsx_runtime_1.jsx)("img", { src: leaf_pink_large_png_1.default, style: { position: 'fixed',
166
175
  float: 'right',
167
176
  width: '250px',
168
177
  height: '400px',
@@ -5,7 +5,7 @@ import { MovaAppType } from "./helpers/Enums";
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
8
- * onSubmit : callbakc invoquée en cas de formulaire valide
8
+ * onSubmit : callback invoquée en cas de formulaire valide
9
9
  * alertMessage : éventuel message à afficher
10
10
  * alertSeverity : niveau d'alerte pour le message à afficher
11
11
  * loading : permet de mettre éventuellement le bouton de soumission en état de chargement
@@ -53,6 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
53
53
  var jsx_runtime_1 = require("react/jsx-runtime");
54
54
  var react_1 = require("react");
55
55
  var lab_1 = require("@mui/lab");
56
+ var DatePicker_1 = require("@mui/x-date-pickers/DatePicker");
56
57
  var logo_large_png_1 = __importDefault(require("./assets/images/logo/logo_large.png"));
57
58
  var logo_pro_large_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large.png"));
58
59
  var leaf_green_large_png_1 = __importDefault(require("./assets/images/leaf_green_large.png"));
@@ -64,6 +65,10 @@ var Validator_1 = require("./helpers/Validator");
64
65
  var GenderSelector_1 = __importDefault(require("./GenderSelector"));
65
66
  var Tools_1 = require("./helpers/Tools");
66
67
  var react_router_dom_1 = require("react-router-dom");
68
+ var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
69
+ var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
70
+ var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
71
+ var isValid_1 = __importDefault(require("date-fns/isValid"));
67
72
  // Permet de centrer le contenu de l'application
68
73
  var styles = {
69
74
  display: 'flex',
@@ -76,7 +81,7 @@ var initialUserFormState = {
76
81
  email: { value: '', isValid: true },
77
82
  password: { value: '', isValid: true },
78
83
  gender: { value: '', isValid: true },
79
- birthDate: { value: '', isValid: true },
84
+ birthDate: { value: null, isValid: true },
80
85
  acceptsTerms: { value: false, isValid: true },
81
86
  };
82
87
  /**
@@ -88,12 +93,25 @@ var MovaLogin = function (_a) {
88
93
  var _b = (0, react_1.useState)(initialUserFormState), userForm = _b[0], setUserForm = _b[1];
89
94
  var history = (0, react_router_dom_1.useHistory)();
90
95
  var _c = (0, react_1.useState)(""), message = _c[0], setMessage = _c[1];
96
+ var _d = (0, react_1.useState)(false), showPassword = _d[0], setShowPassword = _d[1];
97
+ var handleDateChange = function (name, date) {
98
+ var _a;
99
+ console.log(date);
100
+ if (name && date) {
101
+ var fieldName = name;
102
+ var fieldValue = date;
103
+ var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
104
+ setUserForm(__assign(__assign({}, userForm), newField));
105
+ }
106
+ };
91
107
  var handleInputChange = function (e) {
92
108
  var _a;
93
- var fieldName = e.target.name;
94
- var fieldValue = e.target.value;
95
- var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
96
- setUserForm(__assign(__assign({}, userForm), newField));
109
+ if (e) {
110
+ var fieldName = e.target.name;
111
+ var fieldValue = e.target.value;
112
+ var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
113
+ setUserForm(__assign(__assign({}, userForm), newField));
114
+ }
97
115
  };
98
116
  var handleCheckboxChange = function (e, checked) {
99
117
  var _a;
@@ -132,7 +150,7 @@ var MovaLogin = function (_a) {
132
150
  newForm.email = (0, Tools_1.validateField)(userForm.email, function (value) { return !!value; }, 'Champ obligatoire');
133
151
  newForm.password = (0, Tools_1.validateField)(userForm.password, function (value) { return !!value; }, 'Champ obligatoire');
134
152
  newForm.gender = (0, Tools_1.validateField)(userForm.gender, function (value) { return !!value; }, 'Champ obligatoire');
135
- newForm.birthDate = (0, Tools_1.validateField)(userForm.birthDate, function (value) { return !!value; }, 'Champ obligatoire');
153
+ newForm.birthDate = (0, Tools_1.validateField)(userForm.birthDate, function (value) { return !!value && (0, isValid_1.default)(value); }, 'Champ obligatoire');
136
154
  // Validator pour l'email
137
155
  newForm.email = (0, Tools_1.validateField)(userForm.email, Validator_1.validateEmail, 'Adresse email invalide');
138
156
  // Validator pour le mot de passe
@@ -145,7 +163,7 @@ var MovaLogin = function (_a) {
145
163
  };
146
164
  var getMovaLogo = function () {
147
165
  return movaAppType === Enums_1.MovaAppType.GARAGE ? logo_pro_large_png_1.default :
148
- movaAppType === Enums_1.MovaAppType.USER ? logo_large_png_1.default :
166
+ movaAppType === Enums_1.MovaAppType.INDIVIDUAL ? logo_large_png_1.default :
149
167
  movaAppType === Enums_1.MovaAppType.ADMIN ? logo_large_png_1.default : logo_large_png_1.default;
150
168
  };
151
169
  var handleOnClickLogin = function (e) {
@@ -155,6 +173,9 @@ var MovaLogin = function (_a) {
155
173
  history.push('/login');
156
174
  }
157
175
  };
176
+ var handleClickShowPassword = function () {
177
+ setShowPassword(function (prev) { return !prev; });
178
+ };
158
179
  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',
159
180
  float: 'left',
160
181
  width: '250px',
@@ -167,9 +188,20 @@ var MovaLogin = function (_a) {
167
188
  display: 'flex',
168
189
  flexDirection: 'column',
169
190
  alignItems: 'center',
170
- } }, { 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: {
171
- shrink: true,
172
- }, 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({ variant: "body2", color: "text.secondary", onClick: function (e) { return handleOnClickLogin(e); } }, { 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',
191
+ } }, { 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: showPassword ? 'text' : '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 : "10 caractères minimum, 1 majuscule, 1 minuscule", InputProps: {
192
+ 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: handleClickShowPassword }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
193
+ } }), (0, jsx_runtime_1.jsx)(GenderSelector_1.default, { handleSelectChange: handleSelectChange, form: userForm, required: true, sx: { width: '40%', mr: 2 } }), (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { label: "Date de naissance", value: userForm.birthDate.value, format: 'dd / MM / yyyy', formatDensity: 'dense',
194
+ //views={['day']}
195
+ displayWeekNumber: true, onChange: function (newValue) { return handleDateChange('birthDate', newValue); }, slotProps: {
196
+ textField: {
197
+ required: true,
198
+ error: !userForm.birthDate.isValid,
199
+ sx: {
200
+ width: '50%', mt: 2, float: 'right',
201
+ padding: 0,
202
+ },
203
+ },
204
+ } }), (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({ variant: "body2", color: "text.secondary", onClick: function (e) { return handleOnClickLogin(e); } }, { 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',
173
205
  float: 'right',
174
206
  width: '250px',
175
207
  height: '400px',
@@ -1,4 +1,5 @@
1
1
  import { type FC } from 'react';
2
+ import './QRCode.css';
2
3
  interface QRCodeProps {
3
4
  data?: string;
4
5
  showDownload?: boolean;
@@ -19,17 +19,15 @@ var react_1 = require("react");
19
19
  var leaf_yellow_small_png_1 = __importDefault(require("./assets/images/leaf_yellow_small.png"));
20
20
  var material_1 = require("@mui/material");
21
21
  var qr_code_styling_1 = __importDefault(require("qr-code-styling"));
22
+ require("./QRCode.css");
22
23
  var styles = {
23
24
  inputWrapper: {
24
25
  margin: "20px 0",
25
26
  display: "flex",
26
27
  alignItems: 'center',
27
28
  justifyContent: "center",
28
- width: '100%'
29
- },
30
- inputBox: {
31
- flexGrow: 1,
32
- marginRight: 20
29
+ width: '300px',
30
+ height: '300px'
33
31
  }
34
32
  };
35
33
  var QRCode = function (_a) {
@@ -38,9 +36,9 @@ var QRCode = function (_a) {
38
36
  // Le contenu du QR Code est transmis en props, sinon redirection vers ls site vitrine
39
37
  var defaultData = 'https://movalib.com';
40
38
  var _c = (0, react_1.useState)({
41
- width: 300,
42
- height: 300,
43
- type: 'svg',
39
+ width: 600,
40
+ height: 600,
41
+ type: 'canvas',
44
42
  data: data !== null && data !== void 0 ? data : defaultData,
45
43
  image: leaf_yellow_small_png_1.default,
46
44
  margin: 10,
@@ -52,8 +50,7 @@ var QRCode = function (_a) {
52
50
  imageOptions: {
53
51
  hideBackgroundDots: true,
54
52
  imageSize: 0.4,
55
- margin: 15,
56
- crossOrigin: 'anonymous',
53
+ margin: 15
57
54
  },
58
55
  dotsOptions: {
59
56
  color: (0, material_1.darken)(theme.palette.primary.main, 0.3),
@@ -116,7 +113,11 @@ var QRCode = function (_a) {
116
113
  name: "movalib-qr-code"
117
114
  });
118
115
  };
119
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)("div", { ref: ref, style: styles.inputWrapper }), showDownload &&
120
- (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { display: 'flex', justifyContent: 'center' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: 'outlined', onClick: onDownloadClick, sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "T\u00E9l\u00E9charger" })) }))] }));
116
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
117
+ display: 'flex',
118
+ flexDirection: 'column',
119
+ alignItems: 'center'
120
+ } }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: ref, style: styles.inputWrapper, className: 'qr-code' }), showDownload &&
121
+ (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { display: 'flex', justifyContent: 'center' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: 'outlined', onClick: onDownloadClick, sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "T\u00E9l\u00E9charger" })) }))] })));
121
122
  };
122
123
  exports.default = QRCode;
@@ -0,0 +1,24 @@
1
+ import { FunctionComponent } from 'react';
2
+ import Schedule from './models/Schedule';
3
+ import { DayOfWeek } from './helpers/Enums';
4
+ export declare const FR_WEEK_DAYS: string[];
5
+ type DayInterval = {
6
+ startTime: Date | '' | null;
7
+ endTime: Date | '' | null;
8
+ countryCode: string;
9
+ error: string | null;
10
+ };
11
+ export type DaySchedule = {
12
+ day: DayOfWeek;
13
+ checked: boolean;
14
+ allDay: boolean;
15
+ intervals: DayInterval[];
16
+ };
17
+ interface ScheduleFieldsProps {
18
+ timePickerStep: number;
19
+ size: 'small' | 'medium';
20
+ onChange: (schedules: DaySchedule[]) => void;
21
+ schedules?: Schedule[] | undefined;
22
+ }
23
+ declare const ScheduleFields: FunctionComponent<ScheduleFieldsProps>;
24
+ export default ScheduleFields;