directual-web-components-v2 3.11.327 → 3.11.328

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/dist/index.js CHANGED
@@ -26486,7 +26486,23 @@ function Comments(props) {
26486
26486
  function sendComment(comment, finish, local) {
26487
26487
  !local && setLoading(true);
26488
26488
  const endpoint = _$1__default.get(data, "sl");
26489
- callEndpoint && callEndpoint(endpoint, "POST", comment, undefined, (result, data) => {
26489
+ const customMapping = _$1__default.get(data, "params.customMapping") || [];
26490
+ const enrichedComment = _extends({}, comment);
26491
+ if (customMapping.length > 0) {
26492
+ customMapping.forEach(mapping => {
26493
+ const target = _$1__default.get(mapping, 'target');
26494
+ const value = _$1__default.get(mapping, 'value');
26495
+ if (target && value !== undefined && value !== '') {
26496
+ if (enrichedComment.hasOwnProperty(target)) {
26497
+ console.warn("Custom mapping overrides fixed field: " + target);
26498
+ }
26499
+ let convertedValue = value;
26500
+ if (value === 'true') convertedValue = true;else if (value === 'false') convertedValue = false;else if (!isNaN(value) && value !== '') convertedValue = Number(value);
26501
+ enrichedComment[target] = convertedValue;
26502
+ }
26503
+ });
26504
+ }
26505
+ callEndpoint && callEndpoint(endpoint, "POST", enrichedComment, undefined, (result, data) => {
26490
26506
  if (result == "ok") {
26491
26507
  console.log("FINISH SUBMIT");
26492
26508
  console.log(data);