@experium/findy-form 1.1.457 → 1.2.1

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.
@@ -64,9 +64,13 @@ export const TRANSLATIONS = {
64
64
  'fileTypeAudio': 'Invalid type, select audio file',
65
65
  'fileTypeVideo': 'Invalid type, select video file',
66
66
  'composite': 'Required block',
67
- 'icompleteDate': 'Full date is required',
68
- 'captchaRequired': 'Verification required'
67
+ 'incompleteDate': 'Full date is required',
68
+ 'captchaRequired': 'Verification required',
69
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
69
70
  },
71
+ 'invalidCaptcha': 'Invalid captcha',
72
+ 'licenseError': 'The maximum number of responses has been reached for test access. Contact the Sales Department of Geliosoft LLC and the contacts of the sales department (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 Moscow time), <a href=\"tel:+79150216424\"> +7 (915) 021-64-24 </a>) ',
73
+ 'licenseExpired': 'The test access period "30 days" has expired. Contact the Sales Department of "Heliosoft" LLC and the contacts of the sales department (<a href="mailto:help@findy.ru"> help@findy.ru </a>, <a href="tel:+74957836603"> +7 (495) 783-66-03 </a> (9:00-18:00 Moscow time), <a href="tel: +79150216424"> + 7 (915) 021-64-24 </a>)',
70
74
  },
71
75
  },
72
76
  ru: {
@@ -134,9 +138,13 @@ export const TRANSLATIONS = {
134
138
  'fileTypeAudio': 'Неверный тип файла, выберите аудиофайл',
135
139
  'fileTypeVideo': 'Неверный тип файла, выберите видеофайл',
136
140
  'composite': 'Блок обязателен для заполнения',
137
- 'icompleteDate': 'Необходимо указать дату полностью',
138
- 'captchaRequired': 'Необходимо пройти проверку'
141
+ 'incompleteDate': 'Необходимо указать дату полностью',
142
+ 'captchaRequired': 'Необходимо пройти проверку',
143
+ 'incorrectBirthDate': 'Дата не может быть меньше даты рождения',
139
144
  },
145
+ 'invalidCaptcha': 'Неверно введена капча',
146
+ 'licenseError': 'В рамках тестового доступа достигнуто максимальное количество откликов. Обратитесь в Отдел продаж ООО "Гелиософт" и контакты отдела продаж (<a href=\"mailto:help@findy.ru\">help@findy.ru</a>, <a href=\"tel:+74957836603\">+7 (495) 783-66-03</a> (9:00-18:00 МСК), <a href=\"tel:+79150216424\">+7 (915) 021-64-24</a>)',
147
+ 'licenseExpired': 'Срок тестового доступа "30 дней" завершен. Обратитесь в Отдел продаж ООО "Гелиософт" и контакты отдела продаж (<a href="mailto:help@findy.ru">help@findy.ru</a>, <a href="tel:+74957836603">+7 (495) 783-66-03</a> (9:00-18:00 МСК), <a href="tel:+79150216424">+7 (915) 021-64-24</a>)',
140
148
  },
141
149
  },
142
150
  ua: {
@@ -204,9 +212,13 @@ export const TRANSLATIONS = {
204
212
  'fileTypeAudio': 'Неправильний тип файлу, виберіть аудіофайл',
205
213
  'fileTypeVideo': 'Невірний тип файлу, виберіть відеофайл',
206
214
  'composite': 'Блок обов\'язковий для заповнення',
207
- 'icompleteDate': 'Необхідно вказати дату повністю',
208
- 'captchaRequired': 'Необхідно пройти перевірку'
215
+ 'incompleteDate': 'Необхідно вказати дату повністю',
216
+ 'captchaRequired': 'Необхідно пройти перевірку',
217
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
209
218
  },
219
+ 'invalidCaptcha': 'Невірно введена капча',
220
+ 'licenseError': 'В рамках тестового доступу досягнуто максимальну кількість відгуків. Зверніться до Відділу продажу ТОВ "Геліософт" і контакти відділу продажів (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 за київським часом), <a href=\"tel:+79150216424\"> +7 (915) 021-64-24 </a>) ',
221
+ 'licenseExpired': 'Термін тестового доступу "30 днів" завершено. Зверніться до Відділу продаж ТОВ "Геліософт" (<a href="mailto:help@findy.ru">help@findy.ru</a>, <a href="tel:+74957836603">+7 (495) 783-66-03</a> (9:00-18:00 МСК), <a href="tel:+79150216424">+7 (915) 021-64-24</a>)',
210
222
  },
211
223
  },
212
224
  et: {
@@ -273,16 +285,93 @@ export const TRANSLATIONS = {
273
285
  'fileTypeAudio': 'Vale tüüp, valige helifail',
274
286
  'fileTypeVideo': 'Vale tüüp, valige videofail',
275
287
  'composite': 'Nõutav plokk',
276
- 'icompleteDate': 'Täiskuupäev on kohustuslik',
277
- 'captchaRequired': 'Nõutav kontrollimine'
288
+ 'incompleteDate': 'Täiskuupäev on kohustuslik',
289
+ 'captchaRequired': 'Nõutav kontrollimine',
290
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
278
291
  },
292
+ 'invalidCaptcha': 'Sisestati sobimatu captcha',
293
+ 'licenseError': 'Testjuurdepääsuks on saavutatud maksimaalne vastuste arv. Võtke ühendust Heliosoft LLC müügiosakonnaga ja müügiosakonna kontaktidega (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 MSK), <a href=\"tel:+79150216424\"> +7 (915) 021-64–24</a>)',
294
+ 'licenseExpired': 'Testjuurdepääsu periood "30 päeva" on möödas. Võtke ühendust "Heliosoft" LLC müügiosakonnaga ja müügiosakonna kontaktidega (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 MSK), <a href=\"tel:+79150216424\"> +7 (915) 021-64–24</a>)',
279
295
  },
280
296
  },
281
297
  lt: {
282
298
  translation: {
283
- 'send': 'Iesniegt',
299
+ 'send': 'Pateikti',
300
+ 'addQuestionBlock': 'Papildyti',
301
+ 'remove': 'Pašalinti',
302
+ 'optional': ' (neprivaloma)',
303
+ 'cancel': 'Atšaukti',
304
+ 'save': 'Išsaugoti',
305
+ 'stopRecording': 'Sustabdyti įrašymą',
306
+ 'startRecording': 'Pradėti įrašymą',
307
+ 'upload': 'Įkelti',
308
+ 'download': 'Parsisiųsti',
309
+ 'recordAudio': 'Įrašyti garsą',
310
+ 'recordVideo': 'Įrašyti vaizdo įrašą',
311
+ 'takePhoto': 'Nufotografuoti',
312
+ 'opdFormAccept': 'Priimti',
313
+ 'opdLabel': 'Aš sutinku su',
314
+ 'opdLink': 'asmens duomenų tvarkymas',
315
+ 'opdOffertaLabel': 'Sutinku su sąlygomis',
316
+ 'opdOffertaLink': 'viešas pasiūlymas',
317
+ 'MONTHS': [
318
+ { value: 1, label: 'Sausis' },
319
+ { value: 2, label: 'Vasaris' },
320
+ { value: 3, label: 'Kovas' },
321
+ { value: 4, label: 'Balandis' },
322
+ { value: 5, label: 'Gegužė' },
323
+ { value: 6, label: 'Birželis' },
324
+ { value: 7, label: 'Liepa' },
325
+ { value: 8, label: 'Rugpjūtis' },
326
+ { value: 9, label: 'Rugsėjis' },
327
+ { value: 10, label: 'Spalis' },
328
+ { value: 11, label: 'Lapkritis' },
329
+ { value: 12, label: 'Gruodis' }
330
+ ],
331
+ 'loading': 'Įkeliama...',
332
+ 'noOptionsMessage': 'Duomenų nėra',
333
+ 'otherOption': 'Kita',
334
+ 'placeholders': {
335
+ 'datePicker': {
336
+ 'day': 'Diena',
337
+ 'month': 'Mėnuo',
338
+ 'year': 'Metai',
339
+ },
340
+ 'salaryCurrency': 'Pasirinkite valiutą...',
341
+ },
342
+ 'errors': {
343
+ 'required': 'Privalomas laukelis',
344
+ 'minLength': 'Minimalus raidžių skaičius - {{count}}',
345
+ 'maxLength': 'Maksimalus raidžių skaičius - {{count}}',
346
+ 'moreThan': 'Skaičius turi būti didesnis nei {{more}}',
347
+ 'currency': 'Reikalinga valiuta',
348
+ 'phone': 'Neteisingas telefono numeris',
349
+ 'email': 'Neteisingas el. pašto adresas',
350
+ 'emailChars': 'Neteisingas el. Paštas (galiojantys simboliai - raidžių skaičiai _ - .)',
351
+ 'emailDomain': 'Neteisingas el. Pašto domenas (galiojantys simboliai - raidžių skaičiai - .)',
352
+ 'audioPermission': 'Prieiga prie mikrofono yra užblokuota. Leisti prieigą prie mikrofono naršyklės nustatymuose',
353
+ 'cameraPermission': 'Prieiga prie kameros užblokuota. Leiskite prieigą prie kameros naršyklės nustatymuose',
354
+ 'uploadError': 'Nepavyko įkelti failo.',
355
+ 'maximumFileSize': 'Maksimalus failo dydis: {{count}} megabaitai',
356
+ 'maximumFileSize_plural': 'Didžiausias failo dydis: {{count}} megabaitų',
357
+ 'fileType': 'Netinkamas tipas, galimi tipai: {{types}}',
358
+ 'fileTypeAudio': 'Netinkamas tipas, pasirinkite garso failą',
359
+ 'fileTypeVideo': 'Netinkamas tipas, pasirinkite vaizdo failą',
360
+ 'composite': 'Reikalingas blokas',
361
+ 'incompleteDate': 'Būtina nurodyti pilną datą',
362
+ 'captchaRequired': 'Būtina patvirtinimas',
363
+ 'incorrectBirthDate': 'Data negali būti ankstesnė už gimimo datą',
364
+ },
365
+ 'invalidCaptcha': 'Neteisingas CAPTCHA kodas',
366
+ 'licenseError': 'Pasiektas maksimalus bandymų prieigos atsakymų skaičius. Susisiekite su „Heliosoft LLC“ pardavimo skyriumi ir pardavimo skyriaus kontaktais (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 Maskvos laiku), <a href=\"tel:+79150216424\"> +7 (915) 021-64–24 </a>)',
367
+ 'licenseExpired': 'Bandymo prieigos laikotarpis „30 dienų“ baigėsi. Susisiekite su „Heliosoft“ LLC pardavimų skyriumi ir pardavimo skyriaus kontaktais (<a href="mailto:help@findy.ru"> help@findy.ru </a>, <a href = "tel: +74957836603 "> +7 (495) 783-66-03 </a> (9:00-18:00 Maskvos laiku), <a href="tel: +79150216424"> + 7 (915) 021-64-24 < /a>)',
368
+ },
369
+ },
370
+ lv: {
371
+ translation: {
372
+ 'send': 'Pateikti',
284
373
  'addQuestionBlock': 'Pievienot',
285
- 'remove': 'Noņemt',
374
+ 'remove': 'Nonemt',
286
375
  'optional': ' (neobligāti)',
287
376
  'cancel': 'Atcelt',
288
377
  'save': 'Saglabāt',
@@ -342,78 +431,13 @@ export const TRANSLATIONS = {
342
431
  'fileTypeAudio': 'Nederīgs tips, atlasiet audio failu',
343
432
  'fileTypeVideo': 'Nederīgs tips, atlasiet video failu',
344
433
  'composite': 'Nepieciešamais bloks',
345
- 'icompleteDate': 'Nepieciešams norādīt pilnu datumu',
346
- 'captchaRequired': 'Nepieciešama verifikācija'
347
- },
348
- },
349
- },
350
- lv: {
351
- translation: {
352
- 'send': 'Pateikti',
353
- 'addQuestionBlock': 'Papildyti',
354
- 'remove': 'Pašalinti',
355
- 'optional': ' (neprivaloma)',
356
- 'cancel': 'Atšaukti',
357
- 'save': 'Sutaupyti',
358
- 'stopRecording': 'Sustabdyti įrašymą',
359
- 'startRecording': 'Pradėkite įrašyti',
360
- 'upload': 'Įkelti',
361
- 'download': 'Parsisiųsti',
362
- 'recordAudio': 'Įrašyti garsą',
363
- 'recordVideo': 'Įrašyti garsą',
364
- 'takePhoto': 'Nufotografuoti',
365
- 'opdFormAccept': 'Priimti',
366
- 'opdLabel': 'Aš sutinku',
367
- 'opdLink': 'asmens duomenų tvarkymas',
368
- 'opdOffertaLabel': 'Aš sutinku su sąlygomis',
369
- 'opdOffertaLink': 'viešas pasiūlymas',
370
- 'MONTHS': [
371
- { value: 1, label: 'Sausio mėn' },
372
- { value: 2, label: 'Vasario mėn' },
373
- { value: 3, label: 'Kovas' },
374
- { value: 4, label: 'Balandis' },
375
- { value: 5, label: 'Gegužė' },
376
- { value: 6, label: 'Birželio mėn' },
377
- { value: 7, label: 'Liepos mėn' },
378
- { value: 8, label: 'Rugpjūtis' },
379
- { value: 9, label: 'Rugsėjo mėn' },
380
- { value: 10, label: 'Spalio mėn' },
381
- { value: 11, label: 'Lapkričio mėn' },
382
- { value: 12, label: 'Gruodžio mėn' }
383
- ],
384
- 'loading': 'Įkeliama...',
385
- 'noOptionsMessage': 'Duomenų nėra',
386
- 'otherOption': 'Kita',
387
- 'placeholders': {
388
- 'datePicker': {
389
- 'day': 'Diena',
390
- 'month': 'Mėnuo',
391
- 'year': 'Metai',
392
- },
393
- 'salaryCurrency': 'Pasirinkite valiutą...',
394
- },
395
- 'errors': {
396
- 'required': 'Privalomas laukelis',
397
- 'minLength': 'Minimalus raidžių skaičius - {{count}}',
398
- 'maxLength': 'Maksimalus raidžių skaičius - {{count}}',
399
- 'moreThan': 'Skaičius turi būti didesnis nei {{more}}',
400
- 'currency': 'Reikalinga valiuta',
401
- 'phone': 'Neteisingas telefono numeris',
402
- 'email': 'Neteisingas el. pašto adresas',
403
- 'emailChars': 'Neteisingas el. Paštas (galiojantys simboliai - raidžių skaičiai _ - .)',
404
- 'emailDomain': 'Neteisingas el. Pašto domenas (galiojantys simboliai - raidžių skaičiai - .)',
405
- 'audioPermission': 'Prieiga prie mikrofono yra užblokuota. Leisti prieigą prie mikrofono naršyklės nustatymuose',
406
- 'cameraPermission': 'Prieiga prie kameros yra užblokuota. Leisti prieigą prie fotoaparato naršyklės nustatymuose',
407
- 'uploadError': 'Nepavyko įkelti failo.',
408
- 'maximumFileSize': 'Maksimalus failo dydis: {{count}} megabaitas',
409
- 'maximumFileSize_plural': 'Maksimalus failo dydis: {{count}} megabaitai',
410
- 'fileType': 'Netinkamas tipas, galimi tipai: {{types}}',
411
- 'fileTypeAudio': 'Netinkamas tipas, pasirinkite garso failą',
412
- 'fileTypeVideo': 'Netinkamas tipas, pasirinkite vaizdo failą',
413
- 'composite': 'Reikalingas blokas',
414
- 'icompleteDate': 'Būtina nurodyti visą datą',
415
- 'captchaRequired': 'Būtina patvirtinti'
434
+ 'incompleteDate': 'Nepieciešams norādīt pilnu datumu',
435
+ 'captchaRequired': 'Nepieciešama verifikācija',
436
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
416
437
  },
438
+ 'invalidCaptcha': 'Ievadīta nederīga captcha',
439
+ 'licenseError': 'Testa piekļūšanai ir sasniegts maksimālais atbilžu skaits. Sazinieties ar Heliosoft LLC pārdošanas nodaļu un pārdošanas nodaļas kontaktpersonām (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 pēc Maskavas laika), <a href=\"tel:+79150216424\"> +7 (915) 021-64–24 </a>)',
440
+ 'licenseExpired': 'Pārbaudes piekļuves periods "30 dienas" ir beidzies. Sazinieties ar "Heliosoft" LLC Pārdošanas Nodaļu un pārdošanas nodaļas kontaktiem (<a href="mailto:help@findy.ru"> help@findy.ru </a>, <a href="tel:+74957836603"> +7 (495) 783-66-03 </a> (9:00-18:00 Maskavas laiks), <a href="tel: +79150216424"> + 7 (915) 021-64-24 </a>) ',
417
441
  },
418
442
  },
419
443
  kz: {
@@ -481,9 +505,13 @@ export const TRANSLATIONS = {
481
505
  'fileTypeAudio': 'Файл түрі жарамсыз, аудио файлды таңдаңыз',
482
506
  'fileTypeVideo': 'Файл түрі жарамсыз, бейне файлды таңдаңыз',
483
507
  'composite': 'Блок қажет',
484
- 'icompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
485
- 'captchaRequired': 'Тексеру қажет'
508
+ 'incompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
509
+ 'captchaRequired': 'Тексеру қажет',
510
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
486
511
  },
512
+ 'invalidCaptcha': 'Жарамсыз captcha енгізілді',
513
+ 'licenseError': 'Тестке кіру үшін жауаптардың максималды санына жетті. Heliosoft LLC сату бөліміне және сату бөлімінің байланыстарына хабарласыңыз (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href =\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (Мәскеу уақытымен 9:00-18:00), <a href=\"tel:+79150216424\"> +7 (915) 021-64-24 </a>) ',
514
+ 'licenseExpired': '',
487
515
  },
488
516
  },
489
517
  th: {
@@ -551,9 +579,13 @@ export const TRANSLATIONS = {
551
579
  'fileTypeAudio': 'ประเภทไฟล์ไม่ถูกต้อง เลือกไฟล์เสียง',
552
580
  'fileTypeVideo': 'ประเภทไฟล์ไม่ถูกต้อง เลือกไฟล์วิดีโอ',
553
581
  'composite': 'จำเป็นต้องบล็อก',
554
- 'icompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
555
- 'captchaRequired': 'ต้องยืนยัน'
582
+ 'incompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
583
+ 'captchaRequired': 'ต้องยืนยัน',
584
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
556
585
  },
586
+ 'validCaptcha': 'ป้อน captcha ไม่ถูกต้อง',
587
+ 'licenseError': 'มีการตอบกลับถึงจำนวนสูงสุดสำหรับการเข้าถึงการทดสอบแล้ว ติดต่อฝ่ายขายของ Heliosoft LLC และผู้ติดต่อของฝ่ายขาย (<a href=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href=\"tel:+74957836603\"> +7 (495) 783-66-03 </a> (9:00-18:00 น. เวลามอสโก), ​​<a href=\"tel:+79150216424\"> +7 (915) 021-64-24 </a>) ',
588
+ 'licenseExpired': '',
557
589
  },
558
590
  },
559
591
  uz: {
@@ -621,9 +653,13 @@ export const TRANSLATIONS = {
621
653
  'fileTypeAudio': 'Fayl turi noto\'g\'ri, audio faylni tanlang',
622
654
  'fileTypeVideo': 'Fayl turi noto\'g\'ri, video faylni tanlang',
623
655
  'composite': 'Bloklash shart',
624
- 'icompleteDate': 'To\'liq sanani ko\'rsatish kerak',
625
- 'captchaRequired': 'Tasdiqlash kerak'
656
+ 'incompleteDate': 'To\'liq sanani ko\'rsatish kerak',
657
+ 'captchaRequired': 'Tasdiqlash kerak',
658
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
626
659
  },
660
+ 'invalidCaptcha': "Noto'g'ri captcha kiritildi",
661
+ 'licenseError': 'Testlarga kirish uchun maksimal javoblar soniga erishildi. "Heliosoft" MChJ savdo bo\'limi va savdo bo\'limi bilan bog\'laning (< ahref=\"mailto:help@findy.ru\"> help@findy.ru </a>, <a href =\"tel:+ 74957836603\"> +7 (495) 783-66-03 </a> (Moskva vaqti bilan 9:00-18:00), <a href=\"tel:+79150216424\"> +7 (915) 021-64-24 </a>)',
662
+ 'licenseExpired': '',
627
663
  },
628
664
  }
629
665
  };
@@ -80,6 +80,22 @@
80
80
  border: 0;
81
81
  }
82
82
 
83
+ body .rc-checkbox:hover .rc-checkbox-inner, body .rc-checkbox-input:focus + .rc-checkbox-inner {
84
+ border-color: #3a70ba;
85
+ }
86
+
87
+ .pda-modal .checkbox-wrapper .rc-checkbox.rc-checkbox-checked .rc-checkbox-inner:after {
88
+ left: 4px;
89
+ top: 1px;
90
+ width: 4px;
91
+ height: 7px;
92
+ }
93
+
94
+ .checkbox-wrapper .rc-checkbox-checked .rc-checkbox-inner {
95
+ border-color: #3a70ba;
96
+ background-color: #3a70ba;
97
+ }
98
+
83
99
  .radio-wrapper .radio-label {
84
100
  display: inline-block;
85
101
  padding-left: 10px;
@@ -122,6 +138,9 @@
122
138
  word-break: break-word;
123
139
  }
124
140
  @media screen and (max-width: 991px) {
141
+ .pda-modal {
142
+ width: 100%;
143
+ }
125
144
  .pda-modal input.text {
126
145
  width: 90%;
127
146
  }
@@ -0,0 +1,7 @@
1
+ import { pathEq } from 'ramda';
2
+
3
+ export const isError = (error, serverErrors) => (
4
+ !!pathEq(['graphQLErrors', 0, 'message'], error, serverErrors)
5
+ || !!pathEq(['data', 'message'], error, serverErrors)
6
+ || !!pathEq(['message'], error, serverErrors)
7
+ );
@@ -1,5 +1,6 @@
1
- import { path, split, replace, contains, head, prop, isEmpty, values, join, keys, startsWith, is } from 'ramda';
1
+ import { path, split, replace, contains, head, prop, isEmpty, values, join, keys, startsWith, is, forEach } from 'ramda';
2
2
  import * as yup from 'yup';
3
+ import moment from 'moment';
3
4
  import { isPhoneNumber } from 'class-validator';
4
5
  import { parsePhoneNumberWithError, ParseError } from 'libphonenumber-js';
5
6
 
@@ -8,18 +9,22 @@ import i18n from './i18n';
8
9
  import { EMAIL_EXPERIUM, EMAIL_DOMAIN, EMAIL_RFC, EMAIL_RFC_LOCALPART } from '../constants/regexps';
9
10
  import { defaultAllowFileExtensions, VALIDATION_FILE_TYPES } from '../constants/allowFileExtensions';
10
11
 
11
- export const checkFileType = (fileType, mimeType, allowFileExtensions = {}) => {
12
+ const checkDate = value => !value || value === 'incomplete';
13
+
14
+ export const checkFileType = (fileType, mimeType, extenstion, allowFileExtensions = {}) => {
12
15
  switch (fileType) {
13
16
  case 'audio':
14
17
  return startsWith('audio', mimeType);
15
18
  case 'video':
16
19
  return startsWith('video', mimeType);
17
- default:
20
+ case 'image':
18
21
  const allowFileTypes = join(',', values(
19
22
  allowFileExtensions && !isEmpty(allowFileExtensions[fileType]) ? allowFileExtensions[fileType] : defaultAllowFileExtensions[fileType]
20
23
  ));
21
24
 
22
25
  return allowFileTypes ? contains(mimeType, split(',', replace(/\s/g, '', allowFileTypes))) : true;
26
+ default:
27
+ return !fileType || (allowFileTypes ? allowFileExtensions[fileType][extenstion] : defaultAllowFileExtensions[fileType][extenstion]);
23
28
  }
24
29
  };
25
30
  export const getFileTypeMessage = (type, allowFileExtensions = {}) => {
@@ -167,7 +172,13 @@ const rules = {
167
172
  }
168
173
  }),
169
174
  personalDataAgreement: (field, { htmlOpd, opdSettings }) => htmlOpd || path(['useConstructor'], opdSettings) ? yup.string() : yup.boolean(),
170
- boolean: field => yup.boolean(),
175
+ boolean: field => {
176
+ return !field.required ? yup.boolean() : yup.mixed().test({
177
+ name: 'requiredBoolean',
178
+ message: i18n.t('errors.required'),
179
+ test: value => !!value,
180
+ });
181
+ },
171
182
  choice: field => path(['settings', 'multiple'], field) ? yup.array() : yup.string(),
172
183
  file: (field, { allowFileExtensions }) => yup.mixed().test({
173
184
  name: 'fileExtensions',
@@ -185,13 +196,13 @@ const rules = {
185
196
 
186
197
  value.forEach(value => {
187
198
  if (result) {
188
- result = checkFileType(value.type, value.contentType, allowFileExtensions);
199
+ result = checkFileType(value.type, value.contentType, value.extenstion, allowFileExtensions);
189
200
  }
190
201
  });
191
202
 
192
203
  return result;
193
204
  } else {
194
- return checkFileType(value.type, value.contentType, allowFileExtensions);
205
+ return checkFileType(value.type, value.contentType, value.extenstion, allowFileExtensions);
195
206
  }
196
207
  },
197
208
  }),
@@ -205,20 +216,43 @@ const rules = {
205
216
  }),
206
217
  date: () => yup.string().nullable().test({
207
218
  name: 'completeDate',
208
- message: i18n.t('errors.icompleteDate'),
219
+ message: i18n.t('errors.incompleteDate'),
209
220
  test: value => value !== 'incomplete'
210
- })
221
+ }),
222
+ };
223
+
224
+ const validateBirthDate = format => (rule, form) => rule.test({
225
+ name: 'incorrectBirthDate',
226
+ message: i18n.t('errors.incorrectBirthDate'),
227
+ test: value => {
228
+ if (checkDate(value) || checkDate(form.birthDate)) {
229
+ return true;
230
+ }
231
+
232
+ const birthDate = moment(form.birthDate, 'DD.MM.YYYY');
233
+ const date = moment(value, format);
234
+
235
+ return date.isAfter(birthDate);
236
+ }
237
+ });
238
+
239
+ const additionalRules = {
240
+ yearEnd: validateBirthDate('YYYY'),
241
+ courseYearEnd: validateBirthDate('YYYY'),
242
+ experienceStart: validateBirthDate('DD.YYYY'),
243
+ experienceEnd: validateBirthDate('DD.YYYY'),
211
244
  };
212
245
 
213
246
  export const validate = (value, form, field, fieldsWithoutValidation, props) => {
214
- const customValidation = path(['customValidation', field.field], props);
247
+ const customValidation = path(['customValidation', field.field], props) || path([field.field], additionalRules);
215
248
 
216
249
  try {
217
250
  let rule = rules[field.type] ? rules[field.type](field, props) : yup.string();
218
251
  rule = (field.type === 'personalDataAgreement') ? rule.nullable().required(() => i18n.t('errors.required')) : (
219
252
  (field.required || validateLink(field, form)) && !fieldsWithoutValidation[field.field] ? rule.nullable().required(() => i18n.t('errors.required')) : rule.nullable()
220
253
  );
221
- rule = customValidation ? customValidation(rule) : rule;
254
+
255
+ rule = customValidation ? customValidation(rule, form) : rule;
222
256
 
223
257
  rule.validateSync(value);
224
258
  return undefined;
package/FETCH_HEAD DELETED
File without changes