@capillarytech/creatives-library 7.17.119 → 7.17.120

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.119",
4
+ "version": "7.17.120",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1442,6 +1442,14 @@ 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
+ */
1445
1453
  initialiseForm(schema, makeFormEmpty, resetTabKeys) {
1446
1454
  let formData = makeFormEmpty ? {} : _.cloneDeep(this.state.formData);
1447
1455
  let errorData = {};
@@ -1471,8 +1479,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1471
1479
  }
1472
1480
  }
1473
1481
  const tempFormData = _.cloneDeep(formData);
1482
+ // Store the value of 'template-name' before the deletion process
1483
+ const templateNameValue = tempFormData['template-name'];
1474
1484
  if (!this.props.isNewVersionFlow) {
1475
1485
  _.forEach(formData, (element, key) => {
1486
+ // This code block is used to clean up the tempFormData object.
1487
+ // If the element is not an object and the key of the element is not found in the formElements array,
1488
+ // then the element is removed from the tempFormData object.
1476
1489
  if (typeof element !== 'object' && this.formElements.indexOf(key) === -1) {
1477
1490
  delete tempFormData[key];
1478
1491
  } else if (typeof element === "object") {
@@ -1482,8 +1495,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1482
1495
  }
1483
1496
  });
1484
1497
  }
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.
1485
1501
  });
1486
1502
  }
1503
+ // If 'template-name' was deleted, re-add it to tempFormData
1504
+ if (!Object.prototype.hasOwnProperty.call(tempFormData, 'template-name')) {
1505
+ tempFormData['template-name'] = templateNameValue;
1506
+ }
1487
1507
  formData = _.cloneDeep(tempFormData);
1488
1508
  this.setState({formData, errorData}, () => {
1489
1509
  this.validateForm();
@@ -311,8 +311,8 @@ export function SlideBoxContent(props) {
311
311
  case constants.VIBER: {
312
312
  const template = cloneDeep(templateDataObject);
313
313
  const { text = "", button = {}, image = {}, video = {} } = get(template, 'versions.base.content.content', {});
314
- const { url: viberImageUrl = "" } = image;
315
314
  const { url: viberVideoUrl = "", thumbnailUrl = '' } = video;
315
+ const { url: viberImageUrl = "" } = image;
316
316
  template.content = {
317
317
  viberPreviewContent: {
318
318
  ...(!isEmpty(image) && { imageURL: viberImageUrl }),
@@ -144,7 +144,7 @@ export const Viber = (props) => {
144
144
  } else if (!isEmpty(video)) {
145
145
  setTemplateMediaType(VIBER_MEDIA_TYPES.VIDEO);
146
146
  setViberVideoSrcAndPreview({
147
- viberVideoSrc: video?.thumbnailUrl,
147
+ viberVideoSrc: video?.url,
148
148
  viberVideoPreviewImg: video?.thumbnailUrl,
149
149
  duration: video?.duration,
150
150
  });
@@ -284,7 +284,6 @@ export const Viber = (props) => {
284
284
  // Text area Code End here
285
285
 
286
286
  // template media code start here
287
-
288
287
  const isMediaTypeImage = templateMediaType === VIBER_MEDIA_TYPES.IMAGE;
289
288
  const isMediaTypeVideo = templateMediaType === VIBER_MEDIA_TYPES.VIDEO;
290
289
 
@@ -380,7 +379,6 @@ export const Viber = (props) => {
380
379
  {isMediaTypeVideo && renderVideoComonent()}
381
380
  </>
382
381
  );
383
-
384
382
  // template media code end here
385
383
 
386
384
  // Button Code start here
@@ -531,6 +529,7 @@ export const Viber = (props) => {
531
529
  );
532
530
  // Button Code End here
533
531
 
532
+ // to generate payload for create and edit
534
533
  const formatSubmitPayload = () => {
535
534
  const messageData = {
536
535
  text: messageContent,