@capillarytech/creatives-library 7.17.122 → 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.122",
4
+ "version": "7.17.123",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1442,14 +1442,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1442
1442
  return formData;
1443
1443
  }
1444
1444
 
1445
- /**
1446
- * Initializes the form with the given schema.
1447
- *
1448
- * @param {Object} schema - The schema object for the form.
1449
- * @param {boolean} makeFormEmpty - Flag indicating whether to make the form empty.
1450
- * @param {boolean} resetTabKeys - Flag indicating whether to reset tab keys.
1451
- * @returns {void}
1452
- */
1453
1445
  initialiseForm(schema, makeFormEmpty, resetTabKeys) {
1454
1446
  let formData = makeFormEmpty ? {} : _.cloneDeep(this.state.formData);
1455
1447
  let errorData = {};
@@ -1489,19 +1481,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1489
1481
  if (typeof element !== 'object' && this.formElements.indexOf(key) === -1) {
1490
1482
  delete tempFormData[key];
1491
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.
1492
1486
  _.forEach(element, (innerElement, innerKey) => {
1493
1487
  if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && innerKey !== 'imagePreview' && innerKey !== 'image' && this.formElements.indexOf(innerKey) === -1) {
1494
1488
  delete tempFormData[key][innerKey];
1495
1489
  }
1496
1490
  });
1497
1491
  }
1498
- // If the element is an object, it iterates over its properties (innerElement).
1499
- // If the property key (innerKey) is not "tabKey", "base", "name", "imagePreview", "image"
1500
- // and is not found in the formElements array, then the property is removed from the object in tempFormData.
1501
1492
  });
1502
1493
  }
1494
+ const channel = this.props.schema?.channel || "";
1503
1495
  // If 'template-name' was deleted, re-add it to tempFormData for mobilepush channel
1504
- if (!Object.prototype.hasOwnProperty.call(tempFormData, 'template-name') && this.props.schema.channel.toUpperCase() === MOBILE_PUSH) {
1496
+ if (!('template-name' in tempFormData) && channel.toUpperCase() === MOBILE_PUSH) {
1505
1497
  tempFormData['template-name'] = templateNameValue;
1506
1498
  }
1507
1499
  formData = _.cloneDeep(tempFormData);