@capillarytech/creatives-library 7.17.121 → 7.17.123

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.121",
4
+ "version": "7.17.123",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1471,11 +1471,18 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1471
1471
  }
1472
1472
  }
1473
1473
  const tempFormData = _.cloneDeep(formData);
1474
+ // Store the value of 'template-name' before the deletion process
1475
+ const templateNameValue = tempFormData['template-name'];
1474
1476
  if (!this.props.isNewVersionFlow) {
1475
1477
  _.forEach(formData, (element, key) => {
1478
+ // This code block is used to clean up the tempFormData object.
1479
+ // If the element is not an object and the key of the element is not found in the formElements array,
1480
+ // then the element is removed from the tempFormData object.
1476
1481
  if (typeof element !== 'object' && this.formElements.indexOf(key) === -1) {
1477
1482
  delete tempFormData[key];
1478
1483
  } else if (typeof element === "object") {
1484
+ // If the property key (innerKey) is not "tabKey", "base", "name", "imagePreview", "image"
1485
+ // and is not found in the formElements array, then the property is removed from the object in tempFormData.
1479
1486
  _.forEach(element, (innerElement, innerKey) => {
1480
1487
  if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && innerKey !== 'imagePreview' && innerKey !== 'image' && this.formElements.indexOf(innerKey) === -1) {
1481
1488
  delete tempFormData[key][innerKey];
@@ -1484,6 +1491,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1484
1491
  }
1485
1492
  });
1486
1493
  }
1494
+ const channel = this.props.schema?.channel || "";
1495
+ // If 'template-name' was deleted, re-add it to tempFormData for mobilepush channel
1496
+ if (!('template-name' in tempFormData) && channel.toUpperCase() === MOBILE_PUSH) {
1497
+ tempFormData['template-name'] = templateNameValue;
1498
+ }
1487
1499
  formData = _.cloneDeep(tempFormData);
1488
1500
  this.setState({formData, errorData}, () => {
1489
1501
  this.validateForm();