eatci-file-validator 1.0.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/dist/cjs/FileValidator.d.ts +6 -0
  4. package/dist/cjs/FileValidator.js +31 -0
  5. package/dist/cjs/FileValidator.js.map +1 -0
  6. package/dist/cjs/chakra-theme.d.ts +2 -0
  7. package/dist/cjs/chakra-theme.js +27 -0
  8. package/dist/cjs/chakra-theme.js.map +1 -0
  9. package/dist/cjs/index.d.ts +2 -0
  10. package/dist/cjs/index.js +7 -0
  11. package/dist/cjs/index.js.map +1 -0
  12. package/dist/cjs/rules.d.ts +23 -0
  13. package/dist/cjs/rules.js +479 -0
  14. package/dist/cjs/rules.js.map +1 -0
  15. package/dist/cjs/theme.d.ts +18 -0
  16. package/dist/cjs/theme.js +20 -0
  17. package/dist/cjs/theme.js.map +1 -0
  18. package/dist/cjs/translations.d.ts +70 -0
  19. package/dist/cjs/translations.js +72 -0
  20. package/dist/cjs/translations.js.map +1 -0
  21. package/dist/esm/FileValidator.d.ts +6 -0
  22. package/dist/esm/FileValidator.js +27 -0
  23. package/dist/esm/FileValidator.js.map +1 -0
  24. package/dist/esm/chakra-theme.d.ts +2 -0
  25. package/dist/esm/chakra-theme.js +25 -0
  26. package/dist/esm/chakra-theme.js.map +1 -0
  27. package/dist/esm/components/App.d.ts +1 -0
  28. package/dist/esm/components/App.js +113 -0
  29. package/dist/esm/components/App.js.map +1 -0
  30. package/dist/esm/index.d.ts +2 -0
  31. package/dist/esm/index.js +3 -0
  32. package/dist/esm/index.js.map +1 -0
  33. package/dist/esm/rules.d.ts +23 -0
  34. package/dist/esm/rules.js +477 -0
  35. package/dist/esm/rules.js.map +1 -0
  36. package/dist/esm/theme.d.ts +18 -0
  37. package/dist/esm/theme.js +18 -0
  38. package/dist/esm/theme.js.map +1 -0
  39. package/dist/esm/translations.d.ts +70 -0
  40. package/dist/esm/translations.js +70 -0
  41. package/dist/esm/translations.js.map +1 -0
  42. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Igor Gaponov (gapon2401)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # eatci-file-validator
2
+
3
+ [![NPM version][npm-image]][npm-url]
4
+ [![Build][github-build]][github-build-url]
5
+ ![npm-typescript]
6
+ [![License][github-license]][github-license-url]
7
+
8
+ ## Installation:
9
+
10
+ ```bash
11
+ npm install eatci-file-validator
12
+ ```
13
+
14
+ or
15
+
16
+ ```bash
17
+ yarn add -D eatci-file-validator
18
+ ```
19
+
20
+ ## Usage :
21
+
22
+ Add `FileValidator` to your component:
23
+
24
+ ```js
25
+ import React from 'react'
26
+ import ReactDOM from 'react-dom/client'
27
+ import { FileValidator } from 'eatci-file-validator'
28
+
29
+ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
30
+ root.render(
31
+ <React.StrictMode>
32
+ <div>
33
+ <h2>Validator</h2>
34
+ <FileValidator />
35
+ </div>
36
+ </React.StrictMode>,
37
+ )
38
+
39
+ ```
40
+
41
+ [npm-url]: https://www.npmjs.com/package/eatci-file-validator
42
+ [npm-image]: https://img.shields.io/npm/v/eatci-file-validator
43
+ [github-license]: https://img.shields.io/github/license/asacitechnologies/eatci-file-validator
44
+ [github-license-url]: https://github.com/asacitechnologies/eatci-file-validator/blob/master/LICENSE
45
+ [github-build]: https://github.com/asacitechnologies/eatci-file-validator/actions/workflows/publish.yml/badge.svg
46
+ [github-build-url]: https://github.com/asacitechnologies/eatci-file-validator/actions/workflows/publish.yml
47
+ [npm-typescript]: https://img.shields.io/npm/types/eatci-file-validator
@@ -0,0 +1,6 @@
1
+ declare type Props = {
2
+ onSubmit: (data: any) => unknown;
3
+ show: boolean;
4
+ };
5
+ export default function FileValidator({ onSubmit, show }: Props): JSX.Element;
6
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var tslib_1 = require("tslib");
4
+ var react_1 = tslib_1.__importStar(require("react"));
5
+ var react_2 = require("@chakra-ui/react");
6
+ var chakra_theme_1 = tslib_1.__importDefault(require("./chakra-theme"));
7
+ var react_3 = require("@chakra-ui/react");
8
+ var react_spreadsheet_import_1 = require("react-spreadsheet-import");
9
+ var rules_1 = tslib_1.__importDefault(require("./rules"));
10
+ var translations_1 = tslib_1.__importDefault(require("./translations"));
11
+ var theme_1 = tslib_1.__importDefault(require("./theme"));
12
+ function FileValidator(_a) {
13
+ var onSubmit = _a.onSubmit, show = _a.show;
14
+ var _b = (0, react_3.useDisclosure)(), isOpen = _b.isOpen, onOpen = _b.onOpen, onClose = _b.onClose;
15
+ (0, react_1.useEffect)(function () {
16
+ if (show) {
17
+ onOpen();
18
+ }
19
+ });
20
+ var handleOnSubmit = function (data) {
21
+ onSubmit(data);
22
+ };
23
+ var handleOnClose = function () {
24
+ onClose();
25
+ };
26
+ return (react_1["default"].createElement(react_1["default"].Fragment, null,
27
+ react_1["default"].createElement(react_2.ChakraProvider, { theme: chakra_theme_1["default"] },
28
+ react_1["default"].createElement(react_spreadsheet_import_1.ReactSpreadsheetImport, { isOpen: isOpen, onClose: handleOnClose, onSubmit: handleOnSubmit, fields: rules_1["default"].fields, dateFormat: 'dd/mm/yyyy', allowInvalidSubmit: false, customTheme: theme_1["default"], translations: translations_1["default"] }))));
29
+ }
30
+ exports["default"] = FileValidator;
31
+ //# sourceMappingURL=FileValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileValidator.js","sourceRoot":"","sources":["../../src/FileValidator.tsx"],"names":[],"mappings":";;;AAAA,qDAAwC;AACxC,0CAAiD;AACjD,wEAAwC;AACxC,0CAAgD;AAChD,qEAAiE;AACjE,0DAA2B;AAC3B,wEAAyC;AACzC,0DAA2B;AAO3B,SAAwB,aAAa,CAAC,EAAyB;QAAvB,QAAQ,cAAA,EAAE,IAAI,UAAA;IAC9C,IAAA,KAA8B,IAAA,qBAAa,GAAE,EAA3C,MAAM,YAAA,EAAE,MAAM,YAAA,EAAE,OAAO,aAAoB,CAAA;IAEnD,IAAA,iBAAS,EAAC;QACR,IAAI,IAAI,EAAE;YACR,MAAM,EAAE,CAAA;SACT;IACH,CAAC,CAAC,CAAA;IAEF,IAAM,cAAc,GAAG,UAAC,IAAS;QAC/B,QAAQ,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC,CAAA;IAED,IAAM,aAAa,GAAG;QACpB,OAAO,EAAE,CAAA;IACX,CAAC,CAAA;IAED,OAAO,CACL;QACE,iCAAC,sBAAc,IAAC,KAAK,EAAE,yBAAW;YAChC,iCAAC,iDAAsB,IACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,kBAAK,CAAC,MAAM,EACpB,UAAU,EAAC,YAAY,EACvB,kBAAkB,EAAE,KAAK,EACzB,WAAW,EAAE,kBAAK,EAClB,YAAY,EAAE,yBAAY,GAC1B,CACa,CAChB,CACJ,CAAA;AACH,CAAC;AAjCD,mCAiCC"}
@@ -0,0 +1,2 @@
1
+ declare const theme: import("@chakra-ui/utils").Dict<any>;
2
+ export default theme;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var react_1 = require("@chakra-ui/react");
4
+ var theme = (0, react_1.extendTheme)({
5
+ fonts: {
6
+ heading: "'Nunito', sans-serif",
7
+ body: "'Nunito', sans-serif"
8
+ },
9
+ colors: {
10
+ brand: {
11
+ 100: '#ff7800',
12
+ 200: '#ff7800',
13
+ 300: '#f7fafc',
14
+ 400: '#f7fafc',
15
+ 500: '#f7fafc',
16
+ 600: '#ff7800',
17
+ 700: '#e75b2a',
18
+ 800: '#e75b2a',
19
+ 900: '#e75b2a'
20
+ }
21
+ },
22
+ config: {
23
+ initialColorMode: 'light'
24
+ }
25
+ });
26
+ exports["default"] = theme;
27
+ //# sourceMappingURL=chakra-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chakra-theme.js","sourceRoot":"","sources":["../../src/chakra-theme.tsx"],"names":[],"mappings":";;AAAA,0CAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,mBAAW,EAAC;IACxB,KAAK,EAAE;QACL,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,sBAAsB;KAC7B;IACD,MAAM,EAAE;QACN,KAAK,EAAE;YACL,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;SACf;KACF;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,OAAO;KAC1B;CACF,CAAC,CAAA;AAEF,qBAAe,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ import FileValidator from './FileValidator';
2
+ export { FileValidator };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.FileValidator = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var FileValidator_1 = tslib_1.__importDefault(require("./FileValidator"));
6
+ exports.FileValidator = FileValidator_1["default"];
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,0EAA2C;AAElC,wBAFF,0BAAa,CAEE"}
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ fields: {
3
+ label: string;
4
+ key: string;
5
+ alternateMatches: string[];
6
+ fieldType: {
7
+ type: string;
8
+ };
9
+ example: string;
10
+ validations: ({
11
+ rule: string;
12
+ errorMessage: string;
13
+ level: string;
14
+ value?: undefined;
15
+ } | {
16
+ rule: string;
17
+ value: string;
18
+ errorMessage: string;
19
+ level: string;
20
+ })[];
21
+ }[];
22
+ };
23
+ export default _default;
@@ -0,0 +1,479 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports["default"] = {
4
+ fields: [
5
+ {
6
+ label: 'Code compagnie',
7
+ key: 'code_compagnie',
8
+ alternateMatches: ['code_compagnie'],
9
+ fieldType: {
10
+ type: 'input'
11
+ },
12
+ example: 'ASACI_TEST',
13
+ validations: [
14
+ {
15
+ rule: 'required',
16
+ errorMessage: 'Le code compagnie est requis',
17
+ level: 'error'
18
+ },
19
+ {
20
+ rule: 'regex',
21
+ value: '^ASACI_\\w+$',
22
+ errorMessage: 'Le code doit commencer par ASACI_',
23
+ level: 'error'
24
+ },
25
+ ]
26
+ },
27
+ {
28
+ label: "Date d'effet",
29
+ key: 'date_effet',
30
+ alternateMatches: ['date_effet'],
31
+ fieldType: {
32
+ type: 'input'
33
+ },
34
+ example: '01/01/2023',
35
+ validations: [
36
+ {
37
+ rule: 'required',
38
+ errorMessage: "La date d'effet est requise",
39
+ level: 'error'
40
+ },
41
+ {
42
+ rule: 'regex',
43
+ value: '^\\d{2}/\\d{2}/\\d{4}$',
44
+ errorMessage: "Le format de la date d'effet est incorrect",
45
+ level: 'error'
46
+ },
47
+ ]
48
+ },
49
+ {
50
+ label: "Date d'expiration",
51
+ key: 'date_expiration',
52
+ alternateMatches: ['date_expiration'],
53
+ fieldType: {
54
+ type: 'input'
55
+ },
56
+ example: '01/01/2023',
57
+ validations: [
58
+ {
59
+ rule: 'required',
60
+ errorMessage: "La date d'expiration est requise",
61
+ level: 'error'
62
+ },
63
+ {
64
+ rule: 'regex',
65
+ value: '^\\d{2}/\\d{2}/\\d{4}$',
66
+ errorMessage: "Le format de la date d'échéance est incorrect",
67
+ level: 'error'
68
+ },
69
+ ]
70
+ },
71
+ {
72
+ label: 'Genre du vehicule',
73
+ key: 'genre_vehicule',
74
+ alternateMatches: ['genre_vehicule'],
75
+ fieldType: {
76
+ type: 'input'
77
+ },
78
+ example: 'GV01',
79
+ validations: [
80
+ {
81
+ rule: 'required',
82
+ errorMessage: 'Le genre du véhicule est requis',
83
+ level: 'error'
84
+ },
85
+ {
86
+ rule: 'regex',
87
+ value: '^GV\\d{2}$',
88
+ errorMessage: 'Le format du genre du véhicule est incorrect',
89
+ level: 'error'
90
+ },
91
+ ]
92
+ },
93
+ {
94
+ label: "Numéro d'immatriculation",
95
+ key: 'numero_immatriculation',
96
+ alternateMatches: ['numero_immatriculation'],
97
+ fieldType: {
98
+ type: 'input'
99
+ },
100
+ example: '0114AS01',
101
+ validations: [
102
+ {
103
+ rule: 'required',
104
+ errorMessage: "L'immatriculation est requis",
105
+ level: 'error'
106
+ },
107
+ ]
108
+ },
109
+ {
110
+ label: 'Type de véhicule',
111
+ key: 'type_vehicule',
112
+ alternateMatches: ['type_vehicule'],
113
+ fieldType: {
114
+ type: 'input'
115
+ },
116
+ example: 'TV01',
117
+ validations: [
118
+ {
119
+ rule: 'required',
120
+ errorMessage: 'Le type du véhicule est requis',
121
+ level: 'error'
122
+ },
123
+ {
124
+ rule: 'regex',
125
+ value: '^TV\\d{2}$',
126
+ errorMessage: 'Le format du type du véhicule est incorrect',
127
+ level: 'error'
128
+ },
129
+ ]
130
+ },
131
+ {
132
+ label: 'Modèle du véhicule',
133
+ key: 'model_vehicule',
134
+ alternateMatches: ['model_vehicule'],
135
+ fieldType: {
136
+ type: 'input'
137
+ },
138
+ example: 'X5',
139
+ validations: [
140
+ {
141
+ rule: 'required',
142
+ errorMessage: 'Le modèle du véhicule est requis',
143
+ level: 'error'
144
+ },
145
+ ]
146
+ },
147
+ {
148
+ label: 'Catégorie du véhicule',
149
+ key: 'categorie_vehicule',
150
+ alternateMatches: ['categorie_vehicule'],
151
+ fieldType: {
152
+ type: 'input'
153
+ },
154
+ example: '01',
155
+ validations: [
156
+ {
157
+ rule: 'required',
158
+ errorMessage: 'La catégorie est requise',
159
+ level: 'error'
160
+ },
161
+ {
162
+ rule: 'regex',
163
+ value: '^\\d{1,2}$',
164
+ errorMessage: 'Le format de la catégorie du véhicule est incorrect',
165
+ level: 'error'
166
+ },
167
+ ]
168
+ },
169
+ {
170
+ label: 'Usage du véhicule',
171
+ key: 'usage_vehicule',
172
+ alternateMatches: ['usage_vehicule'],
173
+ fieldType: {
174
+ type: 'input'
175
+ },
176
+ example: 'UV01',
177
+ validations: [
178
+ {
179
+ rule: 'required',
180
+ errorMessage: "L'usage est requis",
181
+ level: 'error'
182
+ },
183
+ {
184
+ rule: 'regex',
185
+ value: '^UV\\d{2}$',
186
+ errorMessage: 'Le format de la catégorie du véhicule est incorrect',
187
+ level: 'error'
188
+ },
189
+ ]
190
+ },
191
+ {
192
+ label: "Source d'énergie",
193
+ key: 'source_energie',
194
+ alternateMatches: ['source_energie'],
195
+ fieldType: {
196
+ type: 'input'
197
+ },
198
+ example: 'SEES',
199
+ validations: [
200
+ {
201
+ rule: 'required',
202
+ errorMessage: "La source d'energie est requise",
203
+ level: 'error'
204
+ },
205
+ {
206
+ rule: 'regex',
207
+ value: '^(SEES|SEDI|SEHY|SEEL)$',
208
+ errorMessage: "Le format de la source d'énergie est incorrect",
209
+ level: 'error'
210
+ },
211
+ ]
212
+ },
213
+ {
214
+ label: 'Nombre de place',
215
+ key: 'nombre_place',
216
+ alternateMatches: ['nombre_place'],
217
+ fieldType: {
218
+ type: 'input'
219
+ },
220
+ example: '5',
221
+ validations: [
222
+ {
223
+ rule: 'required',
224
+ errorMessage: 'Le nombre de place est requis',
225
+ level: 'error'
226
+ },
227
+ {
228
+ rule: 'regex',
229
+ value: '^\\d+$',
230
+ errorMessage: 'Le nombre de place doit être un nombre',
231
+ level: 'error'
232
+ },
233
+ ]
234
+ },
235
+ {
236
+ label: 'Marque du véhicule',
237
+ key: 'marque_vehicule',
238
+ alternateMatches: ['marque_vehicule'],
239
+ fieldType: {
240
+ type: 'input'
241
+ },
242
+ example: 'TOYOTA',
243
+ validations: [
244
+ {
245
+ rule: 'required',
246
+ errorMessage: 'La marque est requise',
247
+ level: 'error'
248
+ },
249
+ ]
250
+ },
251
+ {
252
+ label: 'Numéro de chassis',
253
+ key: 'numero_chassis',
254
+ alternateMatches: ['numero_chassis'],
255
+ fieldType: {
256
+ type: 'input'
257
+ },
258
+ example: '01A1',
259
+ validations: [
260
+ {
261
+ rule: 'required',
262
+ errorMessage: 'Le numéro de chassis est requis',
263
+ level: 'error'
264
+ },
265
+ ]
266
+ },
267
+ {
268
+ label: 'Nom du souscripteur',
269
+ key: 'nom_souscripteur',
270
+ alternateMatches: ['nom_souscripteur'],
271
+ fieldType: {
272
+ type: 'input'
273
+ },
274
+ example: 'DION DETY',
275
+ validations: [
276
+ {
277
+ rule: 'required',
278
+ errorMessage: 'Le nom du souscripteur est requis',
279
+ level: 'error'
280
+ },
281
+ ]
282
+ },
283
+ {
284
+ label: 'Type de souscripteur',
285
+ key: 'type_souscripteur',
286
+ alternateMatches: ['type_souscripteur'],
287
+ fieldType: {
288
+ type: 'input'
289
+ },
290
+ example: 'TAPP',
291
+ validations: [
292
+ {
293
+ rule: 'required',
294
+ errorMessage: 'Le type du souscripteur est requis',
295
+ level: 'error'
296
+ },
297
+ {
298
+ rule: 'regex',
299
+ value: '^(TSPP|TSPM)$',
300
+ errorMessage: 'Le type de souscripteur est incorrect',
301
+ level: 'error'
302
+ },
303
+ ]
304
+ },
305
+ {
306
+ label: 'E-mail souscripteur',
307
+ key: 'adresse_mail_souscripteur',
308
+ alternateMatches: ['adresse_mail_souscripteur'],
309
+ fieldType: {
310
+ type: 'input'
311
+ },
312
+ example: 'support@asacitechnologies.com',
313
+ validations: [
314
+ {
315
+ rule: 'required',
316
+ errorMessage: "L'email du souscripteur est requis",
317
+ level: 'error'
318
+ },
319
+ ]
320
+ },
321
+ {
322
+ label: 'Contact du souscripteur',
323
+ key: 'numero_telephone_souscripteur',
324
+ alternateMatches: ['numero_telephone_souscripteur'],
325
+ fieldType: {
326
+ type: 'input'
327
+ },
328
+ example: '0700000000',
329
+ validations: [
330
+ {
331
+ rule: 'required',
332
+ errorMessage: 'Le contact du souscripteur est requis',
333
+ level: 'error'
334
+ },
335
+ ]
336
+ },
337
+ {
338
+ label: 'Boite postale souscripteur',
339
+ key: 'boite_postale_souscripteur',
340
+ alternateMatches: ['boite_postale_souscripteur'],
341
+ fieldType: {
342
+ type: 'input'
343
+ },
344
+ example: '21 BP 5137 ABJ 21',
345
+ validations: [
346
+ {
347
+ rule: 'required',
348
+ errorMessage: 'La boite postale du souscripteur est requise',
349
+ level: 'error'
350
+ },
351
+ ]
352
+ },
353
+ {
354
+ label: "Nom de l'assuré",
355
+ key: 'nom_assure',
356
+ alternateMatches: ['nom_assure'],
357
+ fieldType: {
358
+ type: 'input'
359
+ },
360
+ example: 'GON SALOMON',
361
+ validations: [
362
+ {
363
+ rule: 'required',
364
+ errorMessage: "Le nom de l'assuré est requis",
365
+ level: 'error'
366
+ },
367
+ ]
368
+ },
369
+ {
370
+ label: "E-mail de l'assuré",
371
+ key: 'adresse_mail_assure',
372
+ alternateMatches: ['adresse_mail_assure'],
373
+ fieldType: {
374
+ type: 'input'
375
+ },
376
+ example: 'mon@assure.com',
377
+ validations: [
378
+ {
379
+ rule: 'required',
380
+ errorMessage: "L'email de l'assuré est requis",
381
+ level: 'error'
382
+ },
383
+ ]
384
+ },
385
+ {
386
+ label: "Boite postale de l'assuré",
387
+ key: 'boite_postale_assure',
388
+ alternateMatches: ['boite_postale_assure'],
389
+ fieldType: {
390
+ type: 'input'
391
+ },
392
+ example: '01 BP ABJ 01',
393
+ validations: [
394
+ {
395
+ rule: 'required',
396
+ errorMessage: "La boite postale de l'assuré est requise",
397
+ level: 'error'
398
+ },
399
+ ]
400
+ },
401
+ {
402
+ label: "Contact de l'assuré",
403
+ key: 'numero_telephone_assure',
404
+ alternateMatches: ['numero_telephone_assure'],
405
+ fieldType: {
406
+ type: 'input'
407
+ },
408
+ example: '0708000000',
409
+ validations: [
410
+ {
411
+ rule: 'required',
412
+ errorMessage: "Le contact de l'assuré est requis",
413
+ level: 'error'
414
+ },
415
+ ]
416
+ },
417
+ {
418
+ label: 'Numéro de police',
419
+ key: 'numero_police',
420
+ alternateMatches: ['numero_police'],
421
+ fieldType: {
422
+ type: 'input'
423
+ },
424
+ example: '01/2023',
425
+ validations: [
426
+ {
427
+ rule: 'required',
428
+ errorMessage: 'Le numéro de police est requis',
429
+ level: 'error'
430
+ },
431
+ ]
432
+ },
433
+ {
434
+ label: 'Montant de la RC',
435
+ key: 'rc',
436
+ alternateMatches: ['rc'],
437
+ fieldType: {
438
+ type: 'input'
439
+ },
440
+ example: '100',
441
+ validations: [
442
+ {
443
+ rule: 'required',
444
+ errorMessage: 'La RC est requise',
445
+ level: 'error'
446
+ },
447
+ {
448
+ rule: 'regex',
449
+ value: '^\\d+$',
450
+ errorMessage: 'La RC doit être un nombre',
451
+ level: 'error'
452
+ },
453
+ ]
454
+ },
455
+ {
456
+ label: "Nature de l'attestation",
457
+ key: 'code_nature_attestation',
458
+ alternateMatches: ['code_nature_attestation'],
459
+ fieldType: {
460
+ type: 'input'
461
+ },
462
+ example: 'JAUN',
463
+ validations: [
464
+ {
465
+ rule: 'required',
466
+ errorMessage: "La nature de l'attestation est requise",
467
+ level: 'error'
468
+ },
469
+ {
470
+ rule: 'regex',
471
+ value: '^(JAUN|VERT)$',
472
+ errorMessage: "La nature de l'attestation est incorrect",
473
+ level: 'error'
474
+ },
475
+ ]
476
+ },
477
+ ]
478
+ };
479
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/rules.ts"],"names":[],"mappings":";;AAAA,qBAAe;IACb,MAAM,EAAE;QACN;YACE,KAAK,EAAE,gBAAgB;YACvB,GAAG,EAAE,gBAAgB;YACrB,gBAAgB,EAAE,CAAC,gBAAgB,CAAC;YACpC,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;aACd;YACD,OAAO,EAAE,YAAY;YACrB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,UAAU;oBAChB,YAAY,EAAE,8BAA8B;oBAC5C,KAAK,EAAE,OAAO;iBACf;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,cAAc;oBACrB,YAAY,EAAE,mCAAmC;oBACjD,KAAK,EAAE,OAAO;iBACf;aACF;SACF;QACD;YACE,KAAK,EAAE,cAAc;YACrB,GAAG,EAAE,YAAY;YACjB,gBAAgB,EAAE,CAAC,YAAY,CAAC;YAChC,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;aACd;YACD,OAAO,EAAE,YAAY;YACrB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,UAAU;oBAChB,YAAY,EAAE,6BAA6B;oBAC3C,KAAK,EAAE,OAAO;iBACf;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,wBAAwB;oBAC/B,YAAY,EAAE,4CAA4C;oBAC1D,KAAK,EAAE,OAAO;iBACf;aACF;SACF;QACD;YACE,KAAK,E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