@experium/findy-form 1.1.457 → 1.2.4
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/{.travis.yml → .travis.old.yml} +1 -1
- package/Jenkinsfile +40 -0
- package/dist/404.html +22 -0
- package/dist/app.js +343 -0
- package/dist/index.html +30 -0
- package/lib/components/Form.js +2 -1
- package/lib/components/formComponents/Captcha.js +8 -3
- package/lib/components/formComponents/PersonalDataAgreement.js +9 -6
- package/lib/constants/translations.js +18 -9
- package/lib/utils/validation.js +7 -1
- package/package.json +6 -6
- package/src/components/Form.js +3 -2
- package/src/components/formComponents/Captcha.js +4 -2
- package/src/components/formComponents/PersonalDataAgreement.js +7 -6
- package/src/constants/translations.js +9 -0
- package/src/utils/validation.js +7 -1
- package/FETCH_HEAD +0 -0
package/dist/index.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>App</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<script>
|
|
8
|
+
(function(l) {
|
|
9
|
+
if (l.search) {
|
|
10
|
+
var q = {};
|
|
11
|
+
l.search.slice(1).split('&').forEach(function(v) {
|
|
12
|
+
var a = v.split('=');
|
|
13
|
+
q[a[0]] = a.slice(1).join('=').replace(/~and~/g, '&');
|
|
14
|
+
});
|
|
15
|
+
if (q.p !== undefined) {
|
|
16
|
+
window.history.replaceState(null, null,
|
|
17
|
+
l.pathname.slice(0, -1) + (q.p || '') +
|
|
18
|
+
(q.q ? ('?' + q.q) : '') +
|
|
19
|
+
l.hash
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}(window.location))
|
|
24
|
+
</script>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div id="root"></div>
|
|
28
|
+
<script src="/jobot-forms/app.js"></script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
package/lib/components/Form.js
CHANGED
|
@@ -388,7 +388,8 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
388
388
|
return value ? undefined : _i18n["default"].t('errors.captchaRequired');
|
|
389
389
|
},
|
|
390
390
|
language: language,
|
|
391
|
-
options: captchaOptions
|
|
391
|
+
options: captchaOptions,
|
|
392
|
+
invalidCaptcha: !!(0, _ramda.pathEq)(['graphQLErrors', 0, 'message'], 'Invalid captcha', serverErrors)
|
|
392
393
|
}), /*#__PURE__*/_react["default"].createElement(_reactFinalForm.Field, {
|
|
393
394
|
name: "personalDataAgreement",
|
|
394
395
|
subscription: {
|
|
@@ -29,6 +29,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
29
29
|
|
|
30
30
|
var _reactGoogleRecaptcha = _interopRequireDefault(require("react-google-recaptcha"));
|
|
31
31
|
|
|
32
|
+
var _reactI18next = require("react-i18next");
|
|
33
|
+
|
|
32
34
|
var _withFieldWrapper = _interopRequireDefault(require("../hocs/withFieldWrapper"));
|
|
33
35
|
|
|
34
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
@@ -98,7 +100,8 @@ var ReCaptcha = /*#__PURE__*/function (_Component) {
|
|
|
98
100
|
onChange = _this$props$input.onChange,
|
|
99
101
|
name = _this$props$input.name,
|
|
100
102
|
value = _this$props$input.value,
|
|
101
|
-
language = _this$props.language
|
|
103
|
+
language = _this$props.language,
|
|
104
|
+
invalidCaptcha = _this$props.invalidCaptcha;
|
|
102
105
|
var options = this.props.options || {};
|
|
103
106
|
var sitekey = options.captchaToken || process.env.RECAPTCHA || process.env.REACT_APP_RECAPTCHA;
|
|
104
107
|
return sitekey && options.captchaType === 'recaptcha' ? /*#__PURE__*/_react["default"].createElement(_reactGoogleRecaptcha["default"], {
|
|
@@ -123,12 +126,14 @@ var ReCaptcha = /*#__PURE__*/function (_Component) {
|
|
|
123
126
|
maxWidth: 150,
|
|
124
127
|
display: 'block'
|
|
125
128
|
}
|
|
126
|
-
})
|
|
129
|
+
}), invalidCaptcha && /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
|
+
className: styles.error
|
|
131
|
+
}, this.props.t('invalidCaptcha'))) : 'CAPTCH TYPE OPTIONS ERROR';
|
|
127
132
|
}
|
|
128
133
|
}]);
|
|
129
134
|
return ReCaptcha;
|
|
130
135
|
}(_react.Component);
|
|
131
136
|
|
|
132
|
-
var _default = (0, _withFieldWrapper["default"])(ReCaptcha);
|
|
137
|
+
var _default = (0, _withFieldWrapper["default"])((0, _reactI18next.withTranslation)()(ReCaptcha));
|
|
133
138
|
|
|
134
139
|
exports["default"] = _default;
|
|
@@ -81,8 +81,9 @@ var styles = {
|
|
|
81
81
|
"modalButtonGroup": "index__modalButtonGroup"
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
var getConstructorOpd = function getConstructorOpd(opdSettings) {
|
|
85
|
-
var opdConstructor = (0, _ramda.pathOr)([], ['data', 'opdConstructor'], opdSettings);
|
|
84
|
+
var getConstructorOpd = function getConstructorOpd(opdSettings, language) {
|
|
85
|
+
var opdConstructor = language && language !== 'ru' ? (0, _ramda.pathOr)([], ['data', 'locale', language, 'opdConstructor'], opdSettings) : (0, _ramda.pathOr)([], ['data', 'opdConstructor'], opdSettings);
|
|
86
|
+
var checkboxes = language && language !== 'ru' ? (0, _ramda.pathOr)([], ['data', 'locale', language, 'checkboxes'], opdSettings) : (0, _ramda.pathOr)([], ['data', 'checkboxes'], opdSettings);
|
|
86
87
|
var text = opdConstructor.reduce(function (res, cur) {
|
|
87
88
|
switch (cur.type) {
|
|
88
89
|
case 'text':
|
|
@@ -103,7 +104,7 @@ var getConstructorOpd = function getConstructorOpd(opdSettings) {
|
|
|
103
104
|
}, '');
|
|
104
105
|
return "<div>\n ".concat(text, "\n ").concat((0, _ramda.path)(['purposeCheckbox', 'active'], opdSettings) ? "<p><label><input name=\"opdPurpose\" type=\"checkbox\" data-separate-field=\"opdPurpose\" ".concat((0, _ramda.path)(['purposeCheckbox', 'required'], opdSettings) ? 'required' : '', " />").concat((0, _ramda.path)(['purposeCheckbox', 'label'], opdSettings) || 'я выражаю согласие на обработку персональных данных для цели рассмотрения вопроса о моем трудоустройстве в Компании и включения в кадровый резерв Компании', "</label></p>") : '', "\n ").concat((0, _ramda.path)(['acceptCheckbox', 'active'], opdSettings) ? "<p><label><input name=\"opdAccept\" type=\"checkbox\" data-separate-field=\"opdAccept\" ".concat((0, _ramda.path)(['acceptCheckbox', 'required'], opdSettings) ? 'required' : '', " />").concat((0, _ramda.path)(['acceptCheckbox', 'label'], opdSettings) || 'я выражаю согласие на передачу моих персональных данных в организацию', "</label></p>") : '', "\n ").concat((0, _ramda.path)(['transmissionCheckbox', 'active'], opdSettings) ? "<p><label><input name=\"transmission\" type=\"checkbox\" data-separate-field=\"transmission\" ".concat((0, _ramda.path)(['transmissionCheckbox', 'required'], opdSettings) ? 'required' : '', " />").concat((0, _ramda.path)(['transmissionCheckbox', 'label'], opdSettings) || 'я выражаю согласие на трансграничную передачу моих персональных данных', "</label></p>") : '', "\n ").concat((0, _ramda.path)(['mailingCheckbox', 'active'], opdSettings) ? "<p><label><input name=\"mailing\" type=\"checkbox\" data-separate-field=\"mailing\" ".concat((0, _ramda.path)(['mailingCheckbox', 'required'], opdSettings) ? 'required' : '', " />").concat((0, _ramda.path)(['mailingCheckbox', 'label'], opdSettings) || 'я выражаю согласие на получение рассылки материалов рекламного и/или информационного характера посредством SMS-сервисов, Viber, WhatsApp, Telegram, Skype и других месcенджеров, электронной почты и т.д.', "</label></p>") : '', "\n ").concat((0, _ramda.filter)(function (i) {
|
|
105
106
|
return !!i.show;
|
|
106
|
-
},
|
|
107
|
+
}, checkboxes).reduce(function (res, cur, index) {
|
|
107
108
|
return "".concat(res, "<p><label><input name=\"checkbox-").concat(index, "\" type=\"checkbox\" ").concat(cur.required ? 'required' : '', " />").concat(cur.label, "</label></p>");
|
|
108
109
|
}, ''), "\n </div>");
|
|
109
110
|
};
|
|
@@ -223,8 +224,10 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
223
224
|
value: function render() {
|
|
224
225
|
var _this2 = this;
|
|
225
226
|
|
|
226
|
-
var
|
|
227
|
-
|
|
227
|
+
var _this$props3 = this.props,
|
|
228
|
+
opdSettings = _this$props3.opdSettings,
|
|
229
|
+
language = _this$props3.language;
|
|
230
|
+
var constructorOpd = (0, _ramda.path)(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, language) : null;
|
|
228
231
|
return /*#__PURE__*/_react["default"].createElement(_FormContext.FormContext.Consumer, null, function (_ref) {
|
|
229
232
|
var htmlAttrs = _ref.htmlAttrs;
|
|
230
233
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_Checkbox.Checkbox, (0, _extends2["default"])({
|
|
@@ -257,7 +260,7 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
257
260
|
},
|
|
258
261
|
htmlAttrs: htmlAttrs,
|
|
259
262
|
html: _this2.props.htmlOpd || constructorOpd,
|
|
260
|
-
acceptBtn: (0, _ramda.path)(['acceptButtonLabel'], opdSettings)
|
|
263
|
+
acceptBtn: (0, _ramda.pathOr)((0, _ramda.path)(['acceptButtonLabel'], opdSettings), ['translations', 'acceptButtonLabel', language], opdSettings)
|
|
261
264
|
});
|
|
262
265
|
})));
|
|
263
266
|
});
|
|
@@ -96,7 +96,8 @@ var TRANSLATIONS = {
|
|
|
96
96
|
'composite': 'Required block',
|
|
97
97
|
'icompleteDate': 'Full date is required',
|
|
98
98
|
'captchaRequired': 'Verification required'
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
|
+
'invalidCaptcha': 'Invalid captcha'
|
|
100
101
|
}
|
|
101
102
|
},
|
|
102
103
|
ru: {
|
|
@@ -189,7 +190,8 @@ var TRANSLATIONS = {
|
|
|
189
190
|
'composite': 'Блок обязателен для заполнения',
|
|
190
191
|
'icompleteDate': 'Необходимо указать дату полностью',
|
|
191
192
|
'captchaRequired': 'Необходимо пройти проверку'
|
|
192
|
-
}
|
|
193
|
+
},
|
|
194
|
+
'invalidCaptcha': 'Неверно введена капча'
|
|
193
195
|
}
|
|
194
196
|
},
|
|
195
197
|
ua: {
|
|
@@ -282,7 +284,8 @@ var TRANSLATIONS = {
|
|
|
282
284
|
'composite': 'Блок обов\'язковий для заповнення',
|
|
283
285
|
'icompleteDate': 'Необхідно вказати дату повністю',
|
|
284
286
|
'captchaRequired': 'Необхідно пройти перевірку'
|
|
285
|
-
}
|
|
287
|
+
},
|
|
288
|
+
'invalidCaptcha': 'Невірно введена капча'
|
|
286
289
|
}
|
|
287
290
|
},
|
|
288
291
|
et: {
|
|
@@ -374,7 +377,8 @@ var TRANSLATIONS = {
|
|
|
374
377
|
'composite': 'Nõutav plokk',
|
|
375
378
|
'icompleteDate': 'Täiskuupäev on kohustuslik',
|
|
376
379
|
'captchaRequired': 'Nõutav kontrollimine'
|
|
377
|
-
}
|
|
380
|
+
},
|
|
381
|
+
'invalidCaptcha': 'Sisestati sobimatu captcha'
|
|
378
382
|
}
|
|
379
383
|
},
|
|
380
384
|
lt: {
|
|
@@ -466,7 +470,8 @@ var TRANSLATIONS = {
|
|
|
466
470
|
'composite': 'Nepieciešamais bloks',
|
|
467
471
|
'icompleteDate': 'Nepieciešams norādīt pilnu datumu',
|
|
468
472
|
'captchaRequired': 'Nepieciešama verifikācija'
|
|
469
|
-
}
|
|
473
|
+
},
|
|
474
|
+
'invalidCaptcha': 'Ievadīta nederīga captcha'
|
|
470
475
|
}
|
|
471
476
|
},
|
|
472
477
|
lv: {
|
|
@@ -558,7 +563,8 @@ var TRANSLATIONS = {
|
|
|
558
563
|
'composite': 'Reikalingas blokas',
|
|
559
564
|
'icompleteDate': 'Būtina nurodyti visą datą',
|
|
560
565
|
'captchaRequired': 'Būtina patvirtinti'
|
|
561
|
-
}
|
|
566
|
+
},
|
|
567
|
+
'invalidCaptcha': 'Įvesta netinkama captcha'
|
|
562
568
|
}
|
|
563
569
|
},
|
|
564
570
|
kz: {
|
|
@@ -651,7 +657,8 @@ var TRANSLATIONS = {
|
|
|
651
657
|
'composite': 'Блок қажет',
|
|
652
658
|
'icompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
|
|
653
659
|
'captchaRequired': 'Тексеру қажет'
|
|
654
|
-
}
|
|
660
|
+
},
|
|
661
|
+
'invalidCaptcha': 'Жарамсыз captcha енгізілді'
|
|
655
662
|
}
|
|
656
663
|
},
|
|
657
664
|
th: {
|
|
@@ -744,7 +751,8 @@ var TRANSLATIONS = {
|
|
|
744
751
|
'composite': 'จำเป็นต้องบล็อก',
|
|
745
752
|
'icompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
|
|
746
753
|
'captchaRequired': 'ต้องยืนยัน'
|
|
747
|
-
}
|
|
754
|
+
},
|
|
755
|
+
'validCaptcha': 'ป้อน captcha ไม่ถูกต้อง'
|
|
748
756
|
}
|
|
749
757
|
},
|
|
750
758
|
uz: {
|
|
@@ -837,7 +845,8 @@ var TRANSLATIONS = {
|
|
|
837
845
|
'composite': 'Bloklash shart',
|
|
838
846
|
'icompleteDate': 'To\'liq sanani ko\'rsatish kerak',
|
|
839
847
|
'captchaRequired': 'Tasdiqlash kerak'
|
|
840
|
-
}
|
|
848
|
+
},
|
|
849
|
+
'invalidCaptcha': "Noto'g'ri captcha kiritildi"
|
|
841
850
|
}
|
|
842
851
|
}
|
|
843
852
|
};
|
package/lib/utils/validation.js
CHANGED
|
@@ -209,7 +209,13 @@ var rules = {
|
|
|
209
209
|
return htmlOpd || (0, _ramda.path)(['useConstructor'], opdSettings) ? yup.string() : yup["boolean"]();
|
|
210
210
|
},
|
|
211
211
|
"boolean": function boolean(field) {
|
|
212
|
-
return yup["boolean"]()
|
|
212
|
+
return !field.required ? yup["boolean"]() : yup.mixed().test({
|
|
213
|
+
name: 'requiredBoolean',
|
|
214
|
+
message: _i18n["default"].t('errors.required'),
|
|
215
|
+
test: function test(value) {
|
|
216
|
+
return !!value;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
213
219
|
},
|
|
214
220
|
choice: function choice(field) {
|
|
215
221
|
return (0, _ramda.path)(['settings', 'multiple'], field) ? yup.array() : yup.string();
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experium/findy-form",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/experium/
|
|
7
|
+
"url": "https://github.com/experium/findy-form.git"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public",
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"@ant-design/icons": "^4.2.2",
|
|
15
15
|
"class-validator": "^0.12.2",
|
|
16
16
|
"classnames": "^2.2.6",
|
|
17
|
-
"final-form": "^4.20.
|
|
17
|
+
"final-form": "^4.20.2",
|
|
18
18
|
"final-form-arrays": "^3.0.2",
|
|
19
19
|
"getusermedia": "^2.0.1",
|
|
20
20
|
"i18next": "^19.8.4",
|
|
21
21
|
"ismobilejs": "^1.1.1",
|
|
22
22
|
"libphonenumber-js": "^1.8.1",
|
|
23
|
-
"moment": "^2.
|
|
23
|
+
"moment": "^2.29.1",
|
|
24
24
|
"qs": "^6.9.4",
|
|
25
25
|
"ramda": "^0.27.1",
|
|
26
26
|
"rc-checkbox": "^2.3.2",
|
|
27
27
|
"rc-select": "^12.1.6",
|
|
28
28
|
"rc-tree-select": "^4.1.2",
|
|
29
|
-
"react": "^17.0.
|
|
30
|
-
"react-dom": "^17.0.
|
|
29
|
+
"react": "^17.0.2",
|
|
30
|
+
"react-dom": "^17.0.2",
|
|
31
31
|
"react-final-form": "^6.5.2",
|
|
32
32
|
"react-final-form-arrays": "^3.1.3",
|
|
33
33
|
"react-google-recaptcha": "^2.1.0",
|
package/src/components/Form.js
CHANGED
|
@@ -5,7 +5,7 @@ import i18n from '../utils/i18n';
|
|
|
5
5
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
7
|
import { Form as FinalFormForm, Field, FormSpy } from 'react-final-form';
|
|
8
|
-
import { pathOr, prop, equals, isEmpty, forEach, path, includes, assocPath} from 'ramda';
|
|
8
|
+
import { pathOr, prop, equals, isEmpty, forEach, path, includes, assocPath, pathEq} from 'ramda';
|
|
9
9
|
import arrayMutators from 'final-form-arrays';
|
|
10
10
|
import { withTranslation } from 'react-i18next';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -279,7 +279,8 @@ class Form extends Component {
|
|
|
279
279
|
component={Captcha}
|
|
280
280
|
validate={value => value ? undefined : i18n.t('errors.captchaRequired')}
|
|
281
281
|
language={language}
|
|
282
|
-
options={captchaOptions}
|
|
282
|
+
options={captchaOptions}
|
|
283
|
+
invalidCaptcha={!!pathEq(['graphQLErrors', 0, 'message'], 'Invalid captcha', serverErrors)} />
|
|
283
284
|
}
|
|
284
285
|
<Field name='personalDataAgreement' subscription={{ value: true }}>
|
|
285
286
|
{({ input: { value } }) => (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { includes } from 'ramda';
|
|
2
2
|
import React, { Component, Fragment } from 'react';
|
|
3
3
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
4
|
+
import { withTranslation } from 'react-i18next';
|
|
4
5
|
|
|
5
6
|
import styles from '../../styles/index.module.css';
|
|
6
7
|
import withFieldWrapper from '../hocs/withFieldWrapper';
|
|
@@ -9,7 +10,7 @@ class ReCaptcha extends Component {
|
|
|
9
10
|
onChange = e => this.props.input.onChange(e.target.value);
|
|
10
11
|
|
|
11
12
|
render() {
|
|
12
|
-
const { input: { onChange, name, value }, language } = this.props;
|
|
13
|
+
const { input: { onChange, name, value }, language, invalidCaptcha } = this.props;
|
|
13
14
|
const options = this.props.options || {};
|
|
14
15
|
const sitekey = options.captchaToken || process.env.RECAPTCHA || process.env.REACT_APP_RECAPTCHA;
|
|
15
16
|
|
|
@@ -29,9 +30,10 @@ class ReCaptcha extends Component {
|
|
|
29
30
|
onChange={this.onChange}
|
|
30
31
|
style={{ marginTop: 15, maxWidth: 150, display: 'block' }}
|
|
31
32
|
/>
|
|
33
|
+
{ invalidCaptcha && <div className={styles.error}>{ this.props.t('invalidCaptcha') }</div> }
|
|
32
34
|
</Fragment>
|
|
33
35
|
: 'CAPTCH TYPE OPTIONS ERROR';
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
export default withFieldWrapper(ReCaptcha);
|
|
39
|
+
export default withFieldWrapper(withTranslation()(ReCaptcha));
|
|
@@ -13,8 +13,9 @@ import HtmlOpdForm from './HtmlOpdForm';
|
|
|
13
13
|
import { FormContext } from '../../context/FormContext';
|
|
14
14
|
import { getAttrs } from '../../utils/attrs';
|
|
15
15
|
|
|
16
|
-
const getConstructorOpd = opdSettings => {
|
|
17
|
-
const opdConstructor = pathOr([], ['data', 'opdConstructor'], opdSettings);
|
|
16
|
+
const getConstructorOpd = (opdSettings, language) => {
|
|
17
|
+
const opdConstructor = language && language !== 'ru' ? pathOr([], ['data', 'locale', language, 'opdConstructor'], opdSettings) : pathOr([], ['data', 'opdConstructor'], opdSettings);
|
|
18
|
+
const checkboxes = language && language !== 'ru' ? pathOr([], ['data', 'locale', language, 'checkboxes'], opdSettings) : pathOr([], ['data', 'checkboxes'], opdSettings);
|
|
18
19
|
|
|
19
20
|
const text = opdConstructor.reduce((res, cur) => {
|
|
20
21
|
switch (cur.type) {
|
|
@@ -37,7 +38,7 @@ const getConstructorOpd = opdSettings => {
|
|
|
37
38
|
${path(['acceptCheckbox', 'active'], opdSettings) ? `<p><label><input name="opdAccept" type="checkbox" data-separate-field="opdAccept" ${path(['acceptCheckbox', 'required'], opdSettings) ? 'required' : ''} />${path(['acceptCheckbox', 'label'], opdSettings) || 'я выражаю согласие на передачу моих персональных данных в организацию'}</label></p>` : ''}
|
|
38
39
|
${path(['transmissionCheckbox', 'active'], opdSettings) ? `<p><label><input name="transmission" type="checkbox" data-separate-field="transmission" ${path(['transmissionCheckbox', 'required'], opdSettings) ? 'required' : ''} />${path(['transmissionCheckbox', 'label'], opdSettings) || 'я выражаю согласие на трансграничную передачу моих персональных данных'}</label></p>` : ''}
|
|
39
40
|
${path(['mailingCheckbox', 'active'], opdSettings) ? `<p><label><input name="mailing" type="checkbox" data-separate-field="mailing" ${path(['mailingCheckbox', 'required'], opdSettings) ? 'required' : ''} />${path(['mailingCheckbox', 'label'], opdSettings) || 'я выражаю согласие на получение рассылки материалов рекламного и/или информационного характера посредством SMS-сервисов, Viber, WhatsApp, Telegram, Skype и других месcенджеров, электронной почты и т.д.'}</label></p>` : ''}
|
|
40
|
-
${filter(i => !!i.show,
|
|
41
|
+
${filter(i => !!i.show, checkboxes).reduce((res, cur, index) => `${res}<p><label><input name="checkbox-${index}" type="checkbox" ${cur.required ? 'required' : ''} />${cur.label}</label></p>`, '')}
|
|
41
42
|
</div>`;
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -137,8 +138,8 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
render() {
|
|
140
|
-
const { opdSettings } = this.props;
|
|
141
|
-
const constructorOpd = path(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings) : null;
|
|
141
|
+
const { opdSettings, language } = this.props;
|
|
142
|
+
const constructorOpd = path(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, language) : null;
|
|
142
143
|
|
|
143
144
|
return <FormContext.Consumer>{ ({ htmlAttrs }) => (
|
|
144
145
|
<Fragment>
|
|
@@ -174,7 +175,7 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
174
175
|
getOpdValues={() => this.getOpdValues(formProps)}
|
|
175
176
|
htmlAttrs={htmlAttrs}
|
|
176
177
|
html={this.props.htmlOpd || constructorOpd}
|
|
177
|
-
acceptBtn={path(['acceptButtonLabel'], opdSettings)} />
|
|
178
|
+
acceptBtn={pathOr(path(['acceptButtonLabel'], opdSettings), ['translations', 'acceptButtonLabel', language], opdSettings)} />
|
|
178
179
|
)}
|
|
179
180
|
</FormSpy>
|
|
180
181
|
</Modal>
|
|
@@ -67,6 +67,7 @@ export const TRANSLATIONS = {
|
|
|
67
67
|
'icompleteDate': 'Full date is required',
|
|
68
68
|
'captchaRequired': 'Verification required'
|
|
69
69
|
},
|
|
70
|
+
'invalidCaptcha': 'Invalid captcha'
|
|
70
71
|
},
|
|
71
72
|
},
|
|
72
73
|
ru: {
|
|
@@ -137,6 +138,7 @@ export const TRANSLATIONS = {
|
|
|
137
138
|
'icompleteDate': 'Необходимо указать дату полностью',
|
|
138
139
|
'captchaRequired': 'Необходимо пройти проверку'
|
|
139
140
|
},
|
|
141
|
+
'invalidCaptcha': 'Неверно введена капча'
|
|
140
142
|
},
|
|
141
143
|
},
|
|
142
144
|
ua: {
|
|
@@ -207,6 +209,7 @@ export const TRANSLATIONS = {
|
|
|
207
209
|
'icompleteDate': 'Необхідно вказати дату повністю',
|
|
208
210
|
'captchaRequired': 'Необхідно пройти перевірку'
|
|
209
211
|
},
|
|
212
|
+
'invalidCaptcha': 'Невірно введена капча'
|
|
210
213
|
},
|
|
211
214
|
},
|
|
212
215
|
et: {
|
|
@@ -276,6 +279,7 @@ export const TRANSLATIONS = {
|
|
|
276
279
|
'icompleteDate': 'Täiskuupäev on kohustuslik',
|
|
277
280
|
'captchaRequired': 'Nõutav kontrollimine'
|
|
278
281
|
},
|
|
282
|
+
'invalidCaptcha': 'Sisestati sobimatu captcha'
|
|
279
283
|
},
|
|
280
284
|
},
|
|
281
285
|
lt: {
|
|
@@ -345,6 +349,7 @@ export const TRANSLATIONS = {
|
|
|
345
349
|
'icompleteDate': 'Nepieciešams norādīt pilnu datumu',
|
|
346
350
|
'captchaRequired': 'Nepieciešama verifikācija'
|
|
347
351
|
},
|
|
352
|
+
'invalidCaptcha': 'Ievadīta nederīga captcha'
|
|
348
353
|
},
|
|
349
354
|
},
|
|
350
355
|
lv: {
|
|
@@ -414,6 +419,7 @@ export const TRANSLATIONS = {
|
|
|
414
419
|
'icompleteDate': 'Būtina nurodyti visą datą',
|
|
415
420
|
'captchaRequired': 'Būtina patvirtinti'
|
|
416
421
|
},
|
|
422
|
+
'invalidCaptcha': 'Įvesta netinkama captcha'
|
|
417
423
|
},
|
|
418
424
|
},
|
|
419
425
|
kz: {
|
|
@@ -484,6 +490,7 @@ export const TRANSLATIONS = {
|
|
|
484
490
|
'icompleteDate': 'Сіз толық күнді көрсетуіңіз керек',
|
|
485
491
|
'captchaRequired': 'Тексеру қажет'
|
|
486
492
|
},
|
|
493
|
+
'invalidCaptcha': 'Жарамсыз captcha енгізілді'
|
|
487
494
|
},
|
|
488
495
|
},
|
|
489
496
|
th: {
|
|
@@ -554,6 +561,7 @@ export const TRANSLATIONS = {
|
|
|
554
561
|
'icompleteDate': 'คุณต้องระบุวันที่แบบเต็ม',
|
|
555
562
|
'captchaRequired': 'ต้องยืนยัน'
|
|
556
563
|
},
|
|
564
|
+
'validCaptcha': 'ป้อน captcha ไม่ถูกต้อง'
|
|
557
565
|
},
|
|
558
566
|
},
|
|
559
567
|
uz: {
|
|
@@ -624,6 +632,7 @@ export const TRANSLATIONS = {
|
|
|
624
632
|
'icompleteDate': 'To\'liq sanani ko\'rsatish kerak',
|
|
625
633
|
'captchaRequired': 'Tasdiqlash kerak'
|
|
626
634
|
},
|
|
635
|
+
'invalidCaptcha': "Noto'g'ri captcha kiritildi"
|
|
627
636
|
},
|
|
628
637
|
}
|
|
629
638
|
};
|
package/src/utils/validation.js
CHANGED
|
@@ -167,7 +167,13 @@ const rules = {
|
|
|
167
167
|
}
|
|
168
168
|
}),
|
|
169
169
|
personalDataAgreement: (field, { htmlOpd, opdSettings }) => htmlOpd || path(['useConstructor'], opdSettings) ? yup.string() : yup.boolean(),
|
|
170
|
-
boolean: field =>
|
|
170
|
+
boolean: field => {
|
|
171
|
+
return !field.required ? yup.boolean() : yup.mixed().test({
|
|
172
|
+
name: 'requiredBoolean',
|
|
173
|
+
message: i18n.t('errors.required'),
|
|
174
|
+
test: value => !!value,
|
|
175
|
+
});
|
|
176
|
+
},
|
|
171
177
|
choice: field => path(['settings', 'multiple'], field) ? yup.array() : yup.string(),
|
|
172
178
|
file: (field, { allowFileExtensions }) => yup.mixed().test({
|
|
173
179
|
name: 'fileExtensions',
|
package/FETCH_HEAD
DELETED
|
File without changes
|