@experium/findy-form 1.1.460 → 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,10 +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
  },
70
- 'invalidCaptcha': 'Invalid captcha'
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>)',
71
74
  },
72
75
  },
73
76
  ru: {
@@ -135,10 +138,13 @@ export const TRANSLATIONS = {
135
138
  'fileTypeAudio': 'Неверный тип файла, выберите аудиофайл',
136
139
  'fileTypeVideo': 'Неверный тип файла, выберите видеофайл',
137
140
  'composite': 'Блок обязателен для заполнения',
138
- 'icompleteDate': 'Необходимо указать дату полностью',
139
- 'captchaRequired': 'Необходимо пройти проверку'
141
+ 'incompleteDate': 'Необходимо указать дату полностью',
142
+ 'captchaRequired': 'Необходимо пройти проверку',
143
+ 'incorrectBirthDate': 'Дата не может быть меньше даты рождения',
140
144
  },
141
- 'invalidCaptcha': 'Неверно введена капча'
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>)',
142
148
  },
143
149
  },
144
150
  ua: {
@@ -206,10 +212,13 @@ export const TRANSLATIONS = {
206
212
  'fileTypeAudio': 'Неправильний тип файлу, виберіть аудіофайл',
207
213
  'fileTypeVideo': 'Невірний тип файлу, виберіть відеофайл',
208
214
  'composite': 'Блок обов\'язковий для заповнення',
209
- 'icompleteDate': 'Необхідно вказати дату повністю',
210
- 'captchaRequired': 'Необхідно пройти перевірку'
215
+ 'incompleteDate': 'Необхідно вказати дату повністю',
216
+ 'captchaRequired': 'Необхідно пройти перевірку',
217
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
211
218
  },
212
- 'invalidCaptcha': 'Невірно введена капча'
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>)',
213
222
  },
214
223
  },
215
224
  et: {
@@ -276,17 +285,93 @@ export const TRANSLATIONS = {
276
285
  'fileTypeAudio': 'Vale tüüp, valige helifail',
277
286
  'fileTypeVideo': 'Vale tüüp, valige videofail',
278
287
  'composite': 'Nõutav plokk',
279
- 'icompleteDate': 'Täiskuupäev on kohustuslik',
280
- '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',
281
291
  },
282
- 'invalidCaptcha': 'Sisestati sobimatu captcha'
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>)',
283
295
  },
284
296
  },
285
297
  lt: {
286
298
  translation: {
287
- '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',
288
373
  'addQuestionBlock': 'Pievienot',
289
- 'remove': 'Noņemt',
374
+ 'remove': 'Nonemt',
290
375
  'optional': ' (neobligāti)',
291
376
  'cancel': 'Atcelt',
292
377
  'save': 'Saglabāt',
@@ -346,80 +431,13 @@ export const TRANSLATIONS = {
346
431
  'fileTypeAudio': 'Nederīgs tips, atlasiet audio failu',
347
432
  'fileTypeVideo': 'Nederīgs tips, atlasiet video failu',
348
433
  'composite': 'Nepieciešamais bloks',
349
- 'icompleteDate': 'Nepieciešams norādīt pilnu datumu',
350
- 'captchaRequired': 'Nepieciešama verifikācija'
351
- },
352
- 'invalidCaptcha': 'Ievadīta nederīga captcha'
353
- },
354
- },
355
- lv: {
356
- translation: {
357
- 'send': 'Pateikti',
358
- 'addQuestionBlock': 'Papildyti',
359
- 'remove': 'Pašalinti',
360
- 'optional': ' (neprivaloma)',
361
- 'cancel': 'Atšaukti',
362
- 'save': 'Sutaupyti',
363
- 'stopRecording': 'Sustabdyti įrašymą',
364
- 'startRecording': 'Pradėkite įrašyti',
365
- 'upload': 'Įkelti',
366
- 'download': 'Parsisiųsti',
367
- 'recordAudio': 'Įrašyti garsą',
368
- 'recordVideo': 'Įrašyti garsą',
369
- 'takePhoto': 'Nufotografuoti',
370
- 'opdFormAccept': 'Priimti',
371
- 'opdLabel': 'Aš sutinku',
372
- 'opdLink': 'asmens duomenų tvarkymas',
373
- 'opdOffertaLabel': 'Aš sutinku su sąlygomis',
374
- 'opdOffertaLink': 'viešas pasiūlymas',
375
- 'MONTHS': [
376
- { value: 1, label: 'Sausio mėn' },
377
- { value: 2, label: 'Vasario mėn' },
378
- { value: 3, label: 'Kovas' },
379
- { value: 4, label: 'Balandis' },
380
- { value: 5, label: 'Gegužė' },
381
- { value: 6, label: 'Birželio mėn' },
382
- { value: 7, label: 'Liepos mėn' },
383
- { value: 8, label: 'Rugpjūtis' },
384
- { value: 9, label: 'Rugsėjo mėn' },
385
- { value: 10, label: 'Spalio mėn' },
386
- { value: 11, label: 'Lapkričio mėn' },
387
- { value: 12, label: 'Gruodžio mėn' }
388
- ],
389
- 'loading': 'Įkeliama...',
390
- 'noOptionsMessage': 'Duomenų nėra',
391
- 'otherOption': 'Kita',
392
- 'placeholders': {
393
- 'datePicker': {
394
- 'day': 'Diena',
395
- 'month': 'Mėnuo',
396
- 'year': 'Metai',
397
- },
398
- 'salaryCurrency': 'Pasirinkite valiutą...',
399
- },
400
- 'errors': {
401
- 'required': 'Privalomas laukelis',
402
- 'minLength': 'Minimalus raidžių skaičius - {{count}}',
403
- 'maxLength': 'Maksimalus raidžių skaičius - {{count}}',
404
- 'moreThan': 'Skaičius turi būti didesnis nei {{more}}',
405
- 'currency': 'Reikalinga valiuta',
406
- 'phone': 'Neteisingas telefono numeris',
407
- 'email': 'Neteisingas el. pašto adresas',
408
- 'emailChars': 'Neteisingas el. Paštas (galiojantys simboliai - raidžių skaičiai _ - .)',
409
- 'emailDomain': 'Neteisingas el. Pašto domenas (galiojantys simboliai - raidžių skaičiai - .)',
410
- 'audioPermission': 'Prieiga prie mikrofono yra užblokuota. Leisti prieigą prie mikrofono naršyklės nustatymuose',
411
- 'cameraPermission': 'Prieiga prie kameros yra užblokuota. Leisti prieigą prie fotoaparato naršyklės nustatymuose',
412
- 'uploadError': 'Nepavyko įkelti failo.',
413
- 'maximumFileSize': 'Maksimalus failo dydis: {{count}} megabaitas',
414
- 'maximumFileSize_plural': 'Maksimalus failo dydis: {{count}} megabaitai',
415
- 'fileType': 'Netinkamas tipas, galimi tipai: {{types}}',
416
- 'fileTypeAudio': 'Netinkamas tipas, pasirinkite garso failą',
417
- 'fileTypeVideo': 'Netinkamas tipas, pasirinkite vaizdo failą',
418
- 'composite': 'Reikalingas blokas',
419
- 'icompleteDate': 'Būtina nurodyti visą datą',
420
- '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',
421
437
  },
422
- 'invalidCaptcha': 'Įvesta netinkama captcha'
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>) ',
423
441
  },
424
442
  },
425
443
  kz: {
@@ -487,10 +505,13 @@ export const TRANSLATIONS = {
487
505
  'fileTypeAudio': 'Файл түрі жарамсыз, аудио файлды таңдаңыз',
488
506
  'fileTypeVideo': 'Файл түрі жарамсыз, бейне файлды таңдаңыз',
489
507
  'composite': 'Блок қажет',
490
- 'icompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
491
- 'captchaRequired': 'Тексеру қажет'
508
+ 'incompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
509
+ 'captchaRequired': 'Тексеру қажет',
510
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
492
511
  },
493
- 'invalidCaptcha': 'Жарамсыз captcha енгізілді'
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': '',
494
515
  },
495
516
  },
496
517
  th: {
@@ -558,10 +579,13 @@ export const TRANSLATIONS = {
558
579
  'fileTypeAudio': 'ประเภทไฟล์ไม่ถูกต้อง เลือกไฟล์เสียง',
559
580
  'fileTypeVideo': 'ประเภทไฟล์ไม่ถูกต้อง เลือกไฟล์วิดีโอ',
560
581
  'composite': 'จำเป็นต้องบล็อก',
561
- 'icompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
562
- 'captchaRequired': 'ต้องยืนยัน'
582
+ 'incompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
583
+ 'captchaRequired': 'ต้องยืนยัน',
584
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
563
585
  },
564
- 'validCaptcha': 'ป้อน captcha ไม่ถูกต้อง'
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': '',
565
589
  },
566
590
  },
567
591
  uz: {
@@ -629,10 +653,13 @@ export const TRANSLATIONS = {
629
653
  'fileTypeAudio': 'Fayl turi noto\'g\'ri, audio faylni tanlang',
630
654
  'fileTypeVideo': 'Fayl turi noto\'g\'ri, video faylni tanlang',
631
655
  'composite': 'Bloklash shart',
632
- 'icompleteDate': 'To\'liq sanani ko\'rsatish kerak',
633
- 'captchaRequired': 'Tasdiqlash kerak'
656
+ 'incompleteDate': 'To\'liq sanani ko\'rsatish kerak',
657
+ 'captchaRequired': 'Tasdiqlash kerak',
658
+ 'incorrectBirthDate': 'Date cant be earlier then birth date',
634
659
  },
635
- 'invalidCaptcha': "Noto'g'ri captcha kiritildi"
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': '',
636
663
  },
637
664
  }
638
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 = {}) => {
@@ -191,13 +196,13 @@ const rules = {
191
196
 
192
197
  value.forEach(value => {
193
198
  if (result) {
194
- result = checkFileType(value.type, value.contentType, allowFileExtensions);
199
+ result = checkFileType(value.type, value.contentType, value.extenstion, allowFileExtensions);
195
200
  }
196
201
  });
197
202
 
198
203
  return result;
199
204
  } else {
200
- return checkFileType(value.type, value.contentType, allowFileExtensions);
205
+ return checkFileType(value.type, value.contentType, value.extenstion, allowFileExtensions);
201
206
  }
202
207
  },
203
208
  }),
@@ -211,20 +216,43 @@ const rules = {
211
216
  }),
212
217
  date: () => yup.string().nullable().test({
213
218
  name: 'completeDate',
214
- message: i18n.t('errors.icompleteDate'),
219
+ message: i18n.t('errors.incompleteDate'),
215
220
  test: value => value !== 'incomplete'
216
- })
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'),
217
244
  };
218
245
 
219
246
  export const validate = (value, form, field, fieldsWithoutValidation, props) => {
220
- const customValidation = path(['customValidation', field.field], props);
247
+ const customValidation = path(['customValidation', field.field], props) || path([field.field], additionalRules);
221
248
 
222
249
  try {
223
250
  let rule = rules[field.type] ? rules[field.type](field, props) : yup.string();
224
251
  rule = (field.type === 'personalDataAgreement') ? rule.nullable().required(() => i18n.t('errors.required')) : (
225
252
  (field.required || validateLink(field, form)) && !fieldsWithoutValidation[field.field] ? rule.nullable().required(() => i18n.t('errors.required')) : rule.nullable()
226
253
  );
227
- rule = customValidation ? customValidation(rule) : rule;
254
+
255
+ rule = customValidation ? customValidation(rule, form) : rule;
228
256
 
229
257
  rule.validateSync(value);
230
258
  return undefined;
package/FETCH_HEAD DELETED
File without changes