@experium/findy-form 1.2.39 → 1.2.40

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.
@@ -83,6 +83,14 @@ var getHtml = function getHtml(body) {
83
83
  exports.getHtml = getHtml;
84
84
  var TEXT_FIELDS = ['text', 'email', 'phone', 'date'];
85
85
  var SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region', 'money'];
86
+ var OPD_DATA_CHECKBOXES = {
87
+ 'acceptCheckbox': 'accept',
88
+ 'opdAccept': 'accept',
89
+ 'purposeCheckbox': 'purpose',
90
+ 'opdPurpose': 'purpose',
91
+ 'mailingCheckbox': 'mailing',
92
+ 'transmissionCheckbox': 'transmission'
93
+ };
86
94
 
87
95
  var HtmlOpdForm = /*#__PURE__*/function (_Component) {
88
96
  (0, _inherits2["default"])(HtmlOpdForm, _Component);
@@ -193,7 +201,7 @@ var HtmlOpdForm = /*#__PURE__*/function (_Component) {
193
201
  }
194
202
  }
195
203
 
196
- var separateField = input.getAttribute('data-separate-field');
204
+ var separateField = OPD_DATA_CHECKBOXES[input.getAttribute('data-separate-field') || input.getAttribute('id')];
197
205
 
198
206
  if (separateField) {
199
207
  var value = input.type === 'checkbox' ? input.checked : input.value;
@@ -43,6 +43,10 @@ var _FormContext = require("../../context/FormContext");
43
43
 
44
44
  var _attrs = require("../../utils/attrs");
45
45
 
46
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
47
+
48
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
49
+
46
50
  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); }; }
47
51
 
48
52
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
@@ -182,11 +186,10 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
182
186
  });
183
187
  });
184
188
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSubmitHtml", function (html, data) {
185
- _this.props.input.onChange(html ? {
189
+ _this.props.input.onChange(html ? _objectSpread({
186
190
  value: !!html,
187
- htmlContent: html,
188
- data: data
189
- } : null);
191
+ htmlContent: html
192
+ }, data || {}) : null);
190
193
 
191
194
  _this.setState({
192
195
  openedHtml: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experium/findy-form",
3
- "version": "1.2.39",
3
+ "version": "1.2.40",
4
4
  "main": "./lib/index.js",
5
5
  "homepage": "https://experium.github.io/findy-form",
6
6
  "repository": "https://github.com/experium/findy-form",
@@ -126,6 +126,14 @@ export const getHtml = body => `
126
126
 
127
127
  const TEXT_FIELDS = ['text', 'email', 'phone', 'date'];
128
128
  const SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region', 'money'];
129
+ const OPD_DATA_CHECKBOXES = {
130
+ 'acceptCheckbox': 'accept',
131
+ 'opdAccept': 'accept',
132
+ 'purposeCheckbox': 'purpose',
133
+ 'opdPurpose': 'purpose',
134
+ 'mailingCheckbox': 'mailing',
135
+ 'transmissionCheckbox': 'transmission',
136
+ };
129
137
 
130
138
  class HtmlOpdForm extends Component {
131
139
  state = {
@@ -231,7 +239,7 @@ class HtmlOpdForm extends Component {
231
239
  }
232
240
  }
233
241
 
234
- const separateField = input.getAttribute('data-separate-field');
242
+ const separateField = OPD_DATA_CHECKBOXES[input.getAttribute('data-separate-field') || input.getAttribute('id')];
235
243
 
236
244
  if (separateField) {
237
245
  const value = input.type === 'checkbox' ? input.checked : input.value;
@@ -113,8 +113,9 @@ class PersonalDataAgreementComponent extends Component {
113
113
  this.props.input.onChange(html ? {
114
114
  value: !!html,
115
115
  htmlContent: html,
116
- data,
116
+ ...(data || {}),
117
117
  } : null);
118
+
118
119
  this.setState({ openedHtml: false });
119
120
  }
120
121