@movalib/movalib-commons 1.53.1 → 1.55.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.
package/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/index.ts
2
2
 
3
3
  // Export des services
4
+
4
5
  export { default as VehicleService } from './src/services/VehicleService';
5
6
  export { default as AuthenticationService } from './src/services/AuthenticationService';
6
7
  export { default as GarageService } from './src/services/GarageService';
@@ -27,7 +28,8 @@ export { default as MovaCopyright } from './src/MovaCopyright';
27
28
  export { default as MovaVehicleTireField } from './src/MovaVehicleTireField';
28
29
  export { default as ConfirmationDialog } from './src/ConfirmationDialog';
29
30
  export { default as GenderSelector } from './src/GenderSelector';
30
-
31
+ export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePLVContainer';
32
+ export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
31
33
  // Export des classes
32
34
  export { default as Subscription } from './src/models/Subscription';
33
35
  export { default as Absence } from './src/models/Absence';
@@ -51,22 +53,61 @@ export { default as VehicleTire } from './src/models/VehicleTire';
51
53
  // Export des types
52
54
  export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
53
55
  export type { DaySchedule, DayInterval } from './src/ScheduleFields';
54
- export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
55
- MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
56
+ export type {
57
+ MovaFormField,
58
+ MovaLoginForm,
59
+ MovaUserSignUpForm,
60
+ MovaInterval,
61
+ MovaVehicleForm,
62
+ AddressFieldName,
63
+ } from './src/helpers/Types';
56
64
 
57
65
  // Export des méthodes utilitaires
58
- export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
59
- export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel,
60
- capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals,
61
- findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels } from './src/helpers/Tools';
66
+ export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
67
+ export {
68
+ validateField,
69
+ formatVehicleTire,
70
+ formatFrenchVehiclePlate,
71
+ isEmpty,
72
+ getApplicationShortLabel,
73
+ capitalizeFirstLetter,
74
+ flexLeftRow,
75
+ formatPhoneNumber,
76
+ getFormattedSchedule,
77
+ getFormattedIntervals,
78
+ findScheduleByDayOfWeek,
79
+ getDayOfWeekLabel,
80
+ isSafariOniOS,
81
+ getApplicationsShortLabels,
82
+ } from './src/helpers/Tools';
62
83
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
63
84
  export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
64
- export { request, API_BASE_URL, } from './src/helpers/ApiHelper';
85
+ export { request, API_BASE_URL } from './src/helpers/ApiHelper';
65
86
 
66
87
  // Export des enums
67
- export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType,
68
- DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType,
69
- ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType,
70
- SubscriptionPaymentInterval, RegistrationState, PrestationType, PrestationState, CountryCode,
71
- SubscriptionState, SubscriptionType, APIMethod } from './src/helpers/Enums';
72
-
88
+ export {
89
+ RoleType,
90
+ MovaAppType,
91
+ DayOfWeek,
92
+ EventState,
93
+ EventType,
94
+ DocumentType,
95
+ DigitalPassportIndex,
96
+ DocumentState,
97
+ Gender,
98
+ DateFormatTypes,
99
+ PartsApplicationType,
100
+ ProductType,
101
+ OrderPreference,
102
+ OrderState,
103
+ SlotAlgorithm,
104
+ VehiclePlateFormat as VehiclePlateType,
105
+ SubscriptionPaymentInterval,
106
+ RegistrationState,
107
+ PrestationType,
108
+ PrestationState,
109
+ CountryCode,
110
+ SubscriptionState,
111
+ SubscriptionType,
112
+ APIMethod,
113
+ } from './src/helpers/Enums';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.53.1",
3
+ "version": "1.55.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",
@@ -40,9 +40,7 @@
40
40
  "typescript": "^4.9.5"
41
41
  },
42
42
  "eslintConfig": {
43
- "extends": [
44
- "react-app"
45
- ]
43
+ "extends": ["react-app"]
46
44
  },
47
45
  "devDependencies": {
48
46
  "@types/js-cookie": "^3.0.4",
package/src/GaragePLV.tsx CHANGED
@@ -1,241 +1,41 @@
1
- import React, { CSSProperties, FC, useRef } from 'react';
2
- import QRCode from './QRCode';
1
+ import { Button, darken, useTheme } from '@mui/material';
2
+ import { type FC, useRef } from 'react';
3
3
  import { useReactToPrint } from 'react-to-print';
4
- import { Button, Grid, Typography, darken, useTheme } from '@mui/material';
5
- import { flexCenter, flexStart } from './helpers/Tools';
6
- import LogoLarge from './assets/images/logo/logo_large.png';
7
- import LeafsLarge from './assets/images/leafs_large.png';
8
- import theme from '../theme';
9
-
10
- export enum PrintSize {
11
- A3,
12
- A4
13
- }
4
+ import { PLVComponent, PrintSize } from './components/QrCodePLVContainer/PLVComponent';
5
+ import { flexCenter } from './helpers/Tools';
14
6
 
15
7
  interface GaragePLVProps {
16
8
  url: string;
17
- printSize?: PrintSize
18
- }
19
-
20
- const PLVTitle:CSSProperties = {
21
- display: 'flex',
22
- justifyContent: 'left',
23
- alignItems: 'center',
24
- textTransform: 'uppercase',
25
- fontFamily: 'Montserrat, sans-serif',
26
- fontSize: '50px',
27
- lineHeight: 1.2,
28
- }
29
-
30
- const PLVTitleA3:CSSProperties = {
31
- display: 'flex',
32
- justifyContent: 'left',
33
- alignItems: 'center',
34
- textTransform: 'uppercase',
35
- fontFamily: 'Montserrat, sans-serif',
36
- fontSize: '75px',
37
- lineHeight: 1.2,
38
- }
39
-
40
- const PLVHeaderLogo:CSSProperties = {
41
- display: 'flex',
42
- justifyContent: 'center',
43
- alignItems: 'center',
44
- width:'25%'
45
- }
46
-
47
- const PLVFooterLogo:CSSProperties = {
48
- display: 'flex',
49
- justifyContent: 'end',
50
- alignItems: 'center',
51
- width:'15%',
52
- right: '6%',
53
- position: 'relative',
54
- zIndex: -1
55
- }
56
-
57
- const PLVQRCode:CSSProperties = {
58
- display: 'flex',
59
- justifyContent: 'center',
60
- alignItems: 'center'
61
- }
62
-
63
- const PLVBaseLine:CSSProperties = {
64
- display: 'flex',
65
- justifyContent: 'left',
66
- alignItems: 'center',
67
- fontFamily: 'Caveat',
68
- lineHeight: 2.5,
69
- fontWeight: 700,
70
- marginTop: 20,
71
- paddingLeft: 0,
72
- //transform: 'rotate(-10deg)',
73
- fontSize: '27px',
74
- }
75
-
76
- const PLVBaseLineA3:CSSProperties = {
77
- display: 'flex',
78
- justifyContent: 'left',
79
- alignItems: 'center',
80
- fontFamily: 'Caveat',
81
- lineHeight: 2.5,
82
- fontWeight: 700,
83
- marginTop: 20,
84
- //transform: 'rotate(-10deg)',
85
- fontSize: '38px',
86
- }
87
-
88
- const PVLFooterText:CSSProperties = {
89
- fontFamily: 'Montserrat, sans-serif',
90
- textTransform: 'uppercase',
91
- fontSize: '14px',
92
- letterSpacing: 4,
93
- position: 'absolute'
94
- }
95
-
96
- const PVLFooterTextA3:CSSProperties = {
97
- fontFamily: 'Montserrat, sans-serif',
98
- textTransform: 'uppercase',
99
- fontSize: '20px',
100
- letterSpacing: 4,
101
- position: 'absolute'
102
- }
103
-
104
- /**
105
- * PLV Garage au format A4
106
- */
107
- class PLVComponent extends React.Component<GaragePLVProps> {
108
-
109
- render() {
110
- return (
111
-
112
- <div className="printable-content" style={{
113
- width: this.props.printSize === PrintSize.A4 ? '210mm' :
114
- this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
115
- height: this.props.printSize === PrintSize.A4 ? '297mm' :
116
- this.props.printSize === PrintSize.A3 ? '420mm' : '0mm', }}>
117
-
118
- <Grid container>
119
-
120
- <Grid item xs={12} style={PLVHeaderLogo} sx={{ m: 2, mt: 6, mb: 4 }}>
121
- <img src={LogoLarge} style={PLVHeaderLogo}/>
122
- </Grid>
123
-
124
- <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
125
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle} >
126
- <span className='highlight'>Prenez rendez-vous </span>
127
- </Typography>
128
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
129
- <span className='highlight'> en un clic ! </span>
130
- </Typography>
131
- </Grid>
132
-
133
- <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
134
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
135
- <span className='not-highlight'> Votre entretien </span>
136
- </Typography>
137
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
138
- <span className='not-highlight'> auto ne sera plus </span>
139
- </Typography>
140
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
141
- <span className='not-highlight'> un casse-tête. </span>
142
- </Typography>
143
- </Grid>
144
-
145
- <Grid item xs={6} sx={{ pl: 0, mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }} style={PLVQRCode}>
146
- <QRCode data={this.props.url} size={this.props.printSize === PrintSize.A4 ? 300 : 450} />
147
- </Grid>
148
-
149
- <Grid item xs={6} style={PLVBaseLine}>
150
- <Typography style={this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine }>
151
- Vos rendez-vous et factures en un clic<br />
152
- Alertes et suivi en temps réél<br />
153
- Regroupez 100% de vos documents<br />
154
- Movalib vous réconcilie avec votre auto !
155
- </Typography>
156
- </Grid>
157
-
158
- <Grid item xs={12} style={flexStart}>
159
- <Typography color={theme.palette.primary.dark} sx={{ml: this.props.printSize === PrintSize.A3 ? 8 : 7,
160
- fontSize: this.props.printSize === PrintSize.A3 ? '1.6rem' : '1rem'}}>
161
- Ou rendez-vous sur <b>app.movalib.com</b>
162
- </Typography>
163
- </Grid>
164
-
165
- <Grid item xs={12} sx={{ mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }} style={PLVFooterLogo}>
166
- <span style={this.props.printSize === PrintSize.A3 ? PVLFooterTextA3 : PVLFooterText}>WWW.MOVALIB.COM</span>
167
- <img src={LeafsLarge} style={PLVFooterLogo}/>
168
- </Grid>
169
-
170
- </Grid>
171
-
172
- </div>
173
- );
174
- }
175
9
  }
176
10
 
177
11
  const GaragePLV: FC<GaragePLVProps> = ({ url }) => {
178
-
179
12
  const PLVrefA4 = useRef<PLVComponent>(null);
180
13
  const PLVrefA3 = useRef<PLVComponent>(null);
181
14
  const theme = useTheme();
182
15
 
183
16
  const handleA4Print = useReactToPrint({
184
- content: () => PLVrefA4.current,
185
- documentTitle: 'Movalib_PLV_A4',
17
+ content: () => PLVrefA4.current,
18
+ documentTitle: 'Movalib_PLV_A4',
186
19
  });
187
20
 
188
21
  const handleA3Print = useReactToPrint({
189
22
  content: () => PLVrefA3.current,
190
- documentTitle: 'Movalib_PLV_A3',
23
+ documentTitle: 'Movalib_PLV_A3',
191
24
  });
192
25
 
193
26
  return (
194
27
  <div style={flexCenter}>
195
-
196
28
  <PLVComponent ref={PLVrefA4} url={url} printSize={PrintSize.A4} />
197
29
  <PLVComponent ref={PLVrefA3} url={url} printSize={PrintSize.A3} />
198
30
 
199
- <Button onClick={handleA4Print} variant='outlined'
200
- sx={{ color: darken(theme.palette.primary.main, 0.2), mr: 2 }}>🧾&nbsp;&nbsp;Imprimer la PLV (A4)</Button>
201
- <Button onClick={handleA3Print} variant='outlined'
202
- sx={{ color: darken(theme.palette.primary.main, 0.2)}}>🧾&nbsp;&nbsp;Imprimer la PLV (A3)</Button>
31
+ <Button onClick={handleA4Print} variant='outlined' sx={{ color: darken(theme.palette.primary.main, 0.2), mr: 2 }}>
32
+ 🧾&nbsp;&nbsp;Imprimer la PLV (A4)
33
+ </Button>
34
+ <Button onClick={handleA3Print} variant='outlined' sx={{ color: darken(theme.palette.primary.main, 0.2) }}>
35
+ 🧾&nbsp;&nbsp;Imprimer la PLV (A3)
36
+ </Button>
203
37
  </div>
204
38
  );
205
39
  };
206
40
 
207
41
  export default GaragePLV;
208
-
209
- // CSS pour cacher le contenu à l'écran mais le rendre imprimable
210
- const css = `
211
- .highlight {
212
- background-color: #BCD46C; /* Couleur de surlignage */
213
- margin: 4px 4px; /* Espacement autour du texte surligné */
214
- padding-left : 8px;
215
- padding-right: 8px;
216
- font-weight: 500;
217
- color: white;
218
- }
219
- .not-highlight {
220
- margin: 4px 4px; /* Espacement autour du texte surligné */
221
- padding-left : 8px;
222
- padding-right: 8px;
223
- color: #BCD46C;
224
- }
225
-
226
- .printable-content {
227
- visibility: hidden;
228
- position: absolute;
229
- left: -10000px;
230
- top: -10000px;
231
- }
232
- @media print {
233
- .printable-content {
234
- visibility: visible;
235
- position: static;
236
- }
237
- }
238
- `;
239
- const styleSheet = document.createElement("style");
240
- styleSheet.innerText = css;
241
- document.head.appendChild(styleSheet);
@@ -0,0 +1,214 @@
1
+ import { Grid, Typography } from '@mui/material';
2
+ import React, { type CSSProperties } from 'react';
3
+ import theme from '../../../theme';
4
+ import QRCode from '../../QRCode';
5
+ import LeafsLarge from '../../assets/images/leafs_large.png';
6
+ import LogoLarge from '../../assets/images/logo/logo_large.png';
7
+ import { flexStart } from '../../helpers/Tools';
8
+
9
+ const PLVTitle: CSSProperties = {
10
+ display: 'flex',
11
+ justifyContent: 'left',
12
+ alignItems: 'center',
13
+ textTransform: 'uppercase',
14
+ fontFamily: 'Montserrat, sans-serif',
15
+ fontSize: '50px',
16
+ lineHeight: 1.2,
17
+ };
18
+
19
+ const PLVTitleA3: CSSProperties = {
20
+ display: 'flex',
21
+ justifyContent: 'left',
22
+ alignItems: 'center',
23
+ textTransform: 'uppercase',
24
+ fontFamily: 'Montserrat, sans-serif',
25
+ fontSize: '75px',
26
+ lineHeight: 1.2,
27
+ };
28
+
29
+ const PLVHeaderLogo: CSSProperties = {
30
+ display: 'flex',
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ width: '25%',
34
+ };
35
+
36
+ const PLVFooterLogo: CSSProperties = {
37
+ display: 'flex',
38
+ justifyContent: 'end',
39
+ alignItems: 'center',
40
+ width: '15%',
41
+ right: '6%',
42
+ position: 'relative',
43
+ zIndex: -1,
44
+ };
45
+
46
+ const PLVQRCode: CSSProperties = {
47
+ display: 'flex',
48
+ justifyContent: 'center',
49
+ alignItems: 'center',
50
+ };
51
+
52
+ const PLVBaseLine: CSSProperties = {
53
+ display: 'flex',
54
+ justifyContent: 'left',
55
+ alignItems: 'center',
56
+ fontFamily: 'Caveat',
57
+ lineHeight: 2.5,
58
+ fontWeight: 700,
59
+ marginTop: 20,
60
+ paddingLeft: 0,
61
+ //transform: 'rotate(-10deg)',
62
+ fontSize: '27px',
63
+ };
64
+
65
+ const PLVBaseLineA3: CSSProperties = {
66
+ display: 'flex',
67
+ justifyContent: 'left',
68
+ alignItems: 'center',
69
+ fontFamily: 'Caveat',
70
+ lineHeight: 2.5,
71
+ fontWeight: 700,
72
+ marginTop: 20,
73
+ //transform: 'rotate(-10deg)',
74
+ fontSize: '38px',
75
+ };
76
+
77
+ const PVLFooterText: CSSProperties = {
78
+ fontFamily: 'Montserrat, sans-serif',
79
+ textTransform: 'uppercase',
80
+ fontSize: '14px',
81
+ letterSpacing: 4,
82
+ position: 'absolute',
83
+ };
84
+
85
+ const PVLFooterTextA3: CSSProperties = {
86
+ fontFamily: 'Montserrat, sans-serif',
87
+ textTransform: 'uppercase',
88
+ fontSize: '20px',
89
+ letterSpacing: 4,
90
+ position: 'absolute',
91
+ };
92
+
93
+ export enum PrintSize {
94
+ A3 = 'A3',
95
+ A4 = 'A4',
96
+ }
97
+
98
+ type PLVComponentProps = {
99
+ printSize: PrintSize;
100
+ url: string;
101
+ };
102
+
103
+ /**
104
+ * PLV Garage au format A4
105
+ */
106
+ export class PLVComponent extends React.Component<PLVComponentProps> {
107
+ render() {
108
+ return (
109
+ <div
110
+ className='printable-content'
111
+ style={{
112
+ width:
113
+ this.props.printSize === PrintSize.A4 ? '210mm' : this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
114
+ height:
115
+ this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
116
+ }}
117
+ >
118
+ <Grid container>
119
+ <Grid item xs={12} style={PLVHeaderLogo} sx={{ m: 2, mt: 6, mb: 4 }}>
120
+ <img src={LogoLarge} style={PLVHeaderLogo} />
121
+ </Grid>
122
+
123
+ <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
124
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
125
+ <span className='highlight'>Prenez rendez-vous </span>
126
+ </Typography>
127
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
128
+ <span className='highlight'> en un clic ! </span>
129
+ </Typography>
130
+ </Grid>
131
+
132
+ <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
133
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
134
+ <span className='not-highlight'> Votre entretien </span>
135
+ </Typography>
136
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
137
+ <span className='not-highlight'> auto ne sera plus </span>
138
+ </Typography>
139
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
140
+ <span className='not-highlight'> un casse-tête. </span>
141
+ </Typography>
142
+ </Grid>
143
+
144
+ <Grid item xs={6} sx={{ pl: 0, mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }} style={PLVQRCode}>
145
+ <QRCode data={this.props.url} size={this.props.printSize === PrintSize.A4 ? 300 : 450} />
146
+ </Grid>
147
+
148
+ <Grid item xs={6} style={PLVBaseLine}>
149
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine}>
150
+ Vos rendez-vous et factures en un clic
151
+ <br />
152
+ Alertes et suivi en temps réél
153
+ <br />
154
+ Regroupez 100% de vos documents
155
+ <br />
156
+ Movalib vous réconcilie avec votre auto !
157
+ </Typography>
158
+ </Grid>
159
+
160
+ <Grid item xs={12} style={flexStart}>
161
+ <Typography
162
+ color={theme.palette.primary.dark}
163
+ sx={{
164
+ ml: this.props.printSize === PrintSize.A3 ? 8 : 7,
165
+ fontSize: this.props.printSize === PrintSize.A3 ? '1.6rem' : '1rem',
166
+ }}
167
+ >
168
+ Ou rendez-vous sur <b>app.movalib.com</b>
169
+ </Typography>
170
+ </Grid>
171
+
172
+ <Grid item xs={12} sx={{ mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }} style={PLVFooterLogo}>
173
+ <span style={this.props.printSize === PrintSize.A3 ? PVLFooterTextA3 : PVLFooterText}>WWW.MOVALIB.COM</span>
174
+ <img src={LeafsLarge} style={PLVFooterLogo} />
175
+ </Grid>
176
+ </Grid>
177
+ </div>
178
+ );
179
+ }
180
+ }
181
+
182
+ // CSS pour cacher le contenu à l'écran mais le rendre imprimable
183
+ const css = `
184
+ .highlight {
185
+ background-color: #BCD46C; /* Couleur de surlignage */
186
+ margin: 4px 4px; /* Espacement autour du texte surligné */
187
+ padding-left : 8px;
188
+ padding-right: 8px;
189
+ font-weight: 500;
190
+ color: white;
191
+ }
192
+ .not-highlight {
193
+ margin: 4px 4px; /* Espacement autour du texte surligné */
194
+ padding-left : 8px;
195
+ padding-right: 8px;
196
+ color: #BCD46C;
197
+ }
198
+
199
+ .printable-content {
200
+ visibility: hidden;
201
+ position: absolute;
202
+ left: -10000px;
203
+ top: -10000px;
204
+ }
205
+ @media print {
206
+ .printable-content {
207
+ visibility: visible;
208
+ position: static;
209
+ }
210
+ }
211
+ `;
212
+ const styleSheet = document.createElement('style');
213
+ styleSheet.innerText = css;
214
+ document.head.appendChild(styleSheet);