@experium/findy-form 1.3.7 → 1.3.8
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.
|
@@ -90,16 +90,16 @@ var getConstructorOpd = function getConstructorOpd(opdSettings, pdaLanguage, lan
|
|
|
90
90
|
var text = (opdConstructor || []).reduce(function (res, cur) {
|
|
91
91
|
switch (cur.type) {
|
|
92
92
|
case 'question':
|
|
93
|
-
return "".concat(res, "<input name=\"").concat(cur.question, "\" placeholder=\"").concat((0, _ramda.path)(['translations', language], cur) || cur.placeholder || '', "\" type=\"text\" ").concat(cur.required ? 'required' : '', " /> ");
|
|
93
|
+
return "".concat(res, "<input name=\"").concat(cur.question, "\" placeholder=\"").concat((0, _ramda.path)(['translations', pdaLanguage], cur) || (0, _ramda.path)(['translations', language], cur) || cur.placeholder || '', "\" type=\"text\" ").concat(cur.required ? 'required' : '', " /> ");
|
|
94
94
|
|
|
95
95
|
case 'formated':
|
|
96
|
-
return res + ((0, _ramda.path)(['translations', pdaLanguage], cur) || cur.text || '');
|
|
96
|
+
return res + ((0, _ramda.path)(['translations', pdaLanguage], cur) || (0, _ramda.path)(['translations', language], cur) || cur.text || '');
|
|
97
97
|
|
|
98
98
|
case 'checkbox':
|
|
99
|
-
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"", "checkbox-".concat(cur.id), "\" ").concat(cur.required ? 'required="required"' : '', " />\n <label for=\"", "checkbox-".concat(cur.id), "\">").concat((0, _ramda.path)(['translations', pdaLanguage], cur) || cur.label || '', "</label>\n </div>");
|
|
99
|
+
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"", "checkbox-".concat(cur.id), "\" ").concat(cur.required ? 'required="required"' : '', " />\n <label for=\"", "checkbox-".concat(cur.id), "\">").concat((0, _ramda.path)(['translations', pdaLanguage], cur) || (0, _ramda.path)(['translations', language], cur) || cur.label || '', "</label>\n </div>");
|
|
100
100
|
|
|
101
101
|
case 'opdCheckbox':
|
|
102
|
-
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"").concat(cur.opdType, "\" name=\"").concat(cur.opdType, "\" data-separate-field=\"").concat(cur.opdType, "\" ").concat((0, _ramda.path)([cur.opdType, 'required'], opdSettings) ? 'required="required"' : '', " />\n <label for=\"").concat(cur.opdType, "\">").concat((0, _ramda.pathOr)('', [cur.opdType, 'translations', language], opdSettings) || (0, _ramda.pathOr)('', [cur.opdType, 'label'], opdSettings), "</label>\n </div>");
|
|
102
|
+
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"").concat(cur.opdType, "\" name=\"").concat(cur.opdType, "\" data-separate-field=\"").concat(cur.opdType, "\" ").concat((0, _ramda.path)([cur.opdType, 'required'], opdSettings) ? 'required="required"' : '', " />\n <label for=\"").concat(cur.opdType, "\">").concat((0, _ramda.pathOr)('', [cur.opdType, 'translations', pdaLanguage], opdSettings) || (0, _ramda.pathOr)('', [cur.opdType, 'translations', language], opdSettings) || (0, _ramda.pathOr)('', [cur.opdType, 'label'], opdSettings), "</label>\n </div>");
|
|
103
103
|
|
|
104
104
|
default:
|
|
105
105
|
return res;
|
|
@@ -152,20 +152,21 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
152
152
|
renderOpdLabel = _this$props.renderOpdLabel,
|
|
153
153
|
opd = _this$props.opd,
|
|
154
154
|
opdSettings = _this$props.opdSettings,
|
|
155
|
+
pdaLanguage = _this$props.pdaLanguage,
|
|
155
156
|
language = _this$props.language;
|
|
156
157
|
var label = t('opdLabelCustom');
|
|
157
158
|
var modalLinkProps = {
|
|
158
159
|
className: opd ? styles.formLink : styles.withoutOpd,
|
|
159
160
|
onClick: _this.open
|
|
160
161
|
};
|
|
161
|
-
var linkText = (0, _ramda.pathOr)((0, _ramda.pathOr)(t('opdLink'), ['labelLink'], opdSettings), ['translations', 'labelLink', language], opdSettings);
|
|
162
|
-
var link = (0, _ramda.pathOr)((0, _ramda.path)(['link'], opdSettings), ['translations', 'link', language], opdSettings);
|
|
163
|
-
var opdText = (0, _ramda.pathOr)(opd, ['translations', 'text', language], opdSettings);
|
|
162
|
+
var linkText = (0, _ramda.path)(['translations', 'labelLink', pdaLanguage], opdSettings) || (0, _ramda.pathOr)((0, _ramda.pathOr)(t('opdLink'), ['labelLink'], opdSettings), ['translations', 'labelLink', language], opdSettings);
|
|
163
|
+
var link = (0, _ramda.path)(['translations', 'link', pdaLanguage], opdSettings) || (0, _ramda.pathOr)((0, _ramda.path)(['link'], opdSettings), ['translations', 'link', language], opdSettings);
|
|
164
|
+
var opdText = (0, _ramda.pathOr)(['translations', 'text', pdaLanguage], opdSettings) || (0, _ramda.pathOr)(opd, ['translations', 'text', language], opdSettings);
|
|
164
165
|
var opdType = (0, _ramda.pathOr)('modal', ['linkType'], opdSettings);
|
|
165
|
-
return /*#__PURE__*/_react["default"].createElement("span", null, renderOpdLabel ? renderOpdLabel(modalLinkProps) : label !== 'opdLabelCustom' ? label : /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, (0, _ramda.pathOr)((0, _ramda.pathOr)(t('opdLabel'), ['labelStart'], opdSettings), ['translations', 'labelStart', language], opdSettings), ' ', opdType === 'modal' ? /*#__PURE__*/_react["default"].createElement("span", modalLinkProps, linkText) : /*#__PURE__*/_react["default"].createElement("a", {
|
|
166
|
+
return /*#__PURE__*/_react["default"].createElement("span", null, renderOpdLabel ? renderOpdLabel(modalLinkProps) : label !== 'opdLabelCustom' ? label : /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, (0, _ramda.path)(['translations', 'labelStart', pdaLanguage], opdSettings) || (0, _ramda.pathOr)((0, _ramda.pathOr)(t('opdLabel'), ['labelStart'], opdSettings), ['translations', 'labelStart', language], opdSettings), ' ', opdType === 'modal' ? /*#__PURE__*/_react["default"].createElement("span", modalLinkProps, linkText) : /*#__PURE__*/_react["default"].createElement("a", {
|
|
166
167
|
href: "//".concat(link),
|
|
167
168
|
target: "_blank"
|
|
168
|
-
}, linkText), ' ', (0, _ramda.pathOr)((0, _ramda.pathOr)('.', ['labelEnd'], opdSettings), ['translations', 'labelEnd', language], opdSettings)), /*#__PURE__*/_react["default"].createElement(_reactResponsiveModal["default"], {
|
|
169
|
+
}, linkText), ' ', (0, _ramda.path)(['translations', 'labelEnd', pdaLanguage], opdSettings) || (0, _ramda.pathOr)((0, _ramda.pathOr)('.', ['labelEnd'], opdSettings), ['translations', 'labelEnd', language], opdSettings)), /*#__PURE__*/_react["default"].createElement(_reactResponsiveModal["default"], {
|
|
169
170
|
open: _this.state.opened,
|
|
170
171
|
onClose: _this.close,
|
|
171
172
|
classNames: {
|
|
@@ -276,7 +277,7 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
276
277
|
htmlAttrs: htmlAttrs,
|
|
277
278
|
html: _this2.props.htmlOpd || constructorOpd,
|
|
278
279
|
htmlOpdStyles: _this2.props.htmlOpdStyles,
|
|
279
|
-
acceptBtn: (0, _ramda.pathOr)((0, _ramda.path)(['acceptButtonLabel'], opdSettings), ['translations', 'acceptButtonLabel', language], opdSettings)
|
|
280
|
+
acceptBtn: (0, _ramda.path)(['translations', 'acceptButtonLabel', pdaLanguage], opdSettings) || (0, _ramda.pathOr)((0, _ramda.path)(['acceptButtonLabel'], opdSettings), ['translations', 'acceptButtonLabel', language], opdSettings)
|
|
280
281
|
});
|
|
281
282
|
}))));
|
|
282
283
|
});
|
package/package.json
CHANGED
|
@@ -16,18 +16,18 @@ const getConstructorOpd = (opdSettings, pdaLanguage, language) => {
|
|
|
16
16
|
const text = (opdConstructor || []).reduce((res, cur) => {
|
|
17
17
|
switch (cur.type) {
|
|
18
18
|
case 'question':
|
|
19
|
-
return `${res}<input name="${cur.question}" placeholder="${path(['translations', language], cur) || cur.placeholder || ''}" type="text" ${cur.required ? 'required' : ''} /> `;
|
|
19
|
+
return `${res}<input name="${cur.question}" placeholder="${path(['translations', pdaLanguage], cur) || path(['translations', language], cur) || cur.placeholder || ''}" type="text" ${cur.required ? 'required' : ''} /> `;
|
|
20
20
|
case 'formated':
|
|
21
|
-
return res + (path(['translations', pdaLanguage], cur) || cur.text || '');
|
|
21
|
+
return res + (path(['translations', pdaLanguage], cur) || path(['translations', language], cur) || cur.text || '');
|
|
22
22
|
case 'checkbox':
|
|
23
23
|
return `${res}<div>
|
|
24
24
|
<input type="checkbox" id="${`checkbox-${cur.id}`}" ${cur.required ? 'required="required"' : ''} />
|
|
25
|
-
<label for="${`checkbox-${cur.id}`}">${path(['translations', pdaLanguage], cur) || cur.label || ''}</label>
|
|
25
|
+
<label for="${`checkbox-${cur.id}`}">${path(['translations', pdaLanguage], cur) || path(['translations', language], cur) || cur.label || ''}</label>
|
|
26
26
|
</div>`;
|
|
27
27
|
case 'opdCheckbox':
|
|
28
28
|
return `${res}<div>
|
|
29
29
|
<input type="checkbox" id="${cur.opdType}" name="${cur.opdType}" data-separate-field="${cur.opdType}" ${path([cur.opdType, 'required'], opdSettings) ? 'required="required"' : ''} />
|
|
30
|
-
<label for="${cur.opdType}">${pathOr('', [cur.opdType, 'translations', language], opdSettings) || pathOr('', [cur.opdType, 'label'], opdSettings)}</label>
|
|
30
|
+
<label for="${cur.opdType}">${pathOr('', [cur.opdType, 'translations', pdaLanguage], opdSettings) || pathOr('', [cur.opdType, 'translations', language], opdSettings) || pathOr('', [cur.opdType, 'label'], opdSettings)}</label>
|
|
31
31
|
</div>`;
|
|
32
32
|
default:
|
|
33
33
|
return res;
|
|
@@ -61,15 +61,15 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
61
61
|
closeHtml = () => this.setState({ openedHtml: false });
|
|
62
62
|
|
|
63
63
|
getLabel = () => {
|
|
64
|
-
const { t, renderOpdLabel, opd, opdSettings, language } = this.props;
|
|
64
|
+
const { t, renderOpdLabel, opd, opdSettings, pdaLanguage, language } = this.props;
|
|
65
65
|
const label = t('opdLabelCustom');
|
|
66
66
|
const modalLinkProps = {
|
|
67
67
|
className: opd ? styles.formLink : styles.withoutOpd,
|
|
68
68
|
onClick: this.open
|
|
69
69
|
};
|
|
70
|
-
const linkText = pathOr(pathOr(t('opdLink'), ['labelLink'], opdSettings), ['translations', 'labelLink', language], opdSettings);
|
|
71
|
-
const link = pathOr(path(['link'], opdSettings), ['translations', 'link', language], opdSettings);
|
|
72
|
-
const opdText = pathOr(opd, ['translations', 'text', language], opdSettings);
|
|
70
|
+
const linkText = path(['translations', 'labelLink', pdaLanguage], opdSettings) || pathOr(pathOr(t('opdLink'), ['labelLink'], opdSettings), ['translations', 'labelLink', language], opdSettings);
|
|
71
|
+
const link = path(['translations', 'link', pdaLanguage], opdSettings) || pathOr(path(['link'], opdSettings), ['translations', 'link', language], opdSettings);
|
|
72
|
+
const opdText = pathOr(['translations', 'text', pdaLanguage], opdSettings) || pathOr(opd, ['translations', 'text', language], opdSettings);
|
|
73
73
|
const opdType = pathOr('modal', ['linkType'], opdSettings);
|
|
74
74
|
|
|
75
75
|
return <span>
|
|
@@ -78,14 +78,14 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
78
78
|
label
|
|
79
79
|
) : (
|
|
80
80
|
<Fragment>
|
|
81
|
-
{ pathOr(pathOr(t('opdLabel'), ['labelStart'], opdSettings), ['translations', 'labelStart', language], opdSettings) }
|
|
81
|
+
{ path(['translations', 'labelStart', pdaLanguage], opdSettings) || pathOr(pathOr(t('opdLabel'), ['labelStart'], opdSettings), ['translations', 'labelStart', language], opdSettings) }
|
|
82
82
|
{ ' ' }
|
|
83
83
|
{ opdType === 'modal' ?
|
|
84
84
|
<span {...modalLinkProps}>{ linkText }</span> :
|
|
85
85
|
<a href={`//${link}`} target='_blank'>{ linkText }</a>
|
|
86
86
|
}
|
|
87
87
|
{ ' ' }
|
|
88
|
-
{ pathOr(pathOr('.', ['labelEnd'], opdSettings), ['translations', 'labelEnd', language], opdSettings) }
|
|
88
|
+
{ path(['translations', 'labelEnd', pdaLanguage], opdSettings) || pathOr(pathOr('.', ['labelEnd'], opdSettings), ['translations', 'labelEnd', language], opdSettings) }
|
|
89
89
|
</Fragment>
|
|
90
90
|
)
|
|
91
91
|
}
|
|
@@ -196,7 +196,10 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
196
196
|
htmlAttrs={htmlAttrs}
|
|
197
197
|
html={this.props.htmlOpd || constructorOpd}
|
|
198
198
|
htmlOpdStyles={this.props.htmlOpdStyles}
|
|
199
|
-
acceptBtn={
|
|
199
|
+
acceptBtn={
|
|
200
|
+
path(['translations', 'acceptButtonLabel', pdaLanguage], opdSettings)
|
|
201
|
+
|| pathOr(path(['acceptButtonLabel'], opdSettings), ['translations', 'acceptButtonLabel', language], opdSettings)
|
|
202
|
+
} />
|
|
200
203
|
)}
|
|
201
204
|
</FormSpy>
|
|
202
205
|
</Modal>
|