@capillarytech/creatives-library 7.12.60 → 7.12.62

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.12.60",
4
+ "version": "7.12.62",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -154,6 +154,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
154
154
  showTestAndPreviewIcon,
155
155
  module,
156
156
  viberBrandName,
157
+ viberAccountName,
157
158
  whatsappAccountName,
158
159
  whatsappContentLen,
159
160
  intl,
@@ -388,6 +388,11 @@ export class Creatives extends React.Component {
388
388
  }
389
389
  return btn;
390
390
  });
391
+ for (const key in varMapped) {
392
+ if (key.includes('_unsubscribe')) {
393
+ delete varMapped[key];
394
+ }
395
+ }
391
396
  const unsubscribeRegex = /Click {{unsubscribe}} to unsubscribe/g;
392
397
  creativesTemplateData = {
393
398
  type: constants.WHATSAPP,
@@ -597,6 +602,7 @@ export class Creatives extends React.Component {
597
602
  buttons = [],
598
603
  imageUrl = '',
599
604
  } = cloneDeep(versions.base.content.whatsapp);
605
+
600
606
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
601
607
  if (btn.type === 'PHONE_NUMBER') {
602
608
  btn.phoneNumber = btn.phone_number;
@@ -607,6 +613,19 @@ export class Creatives extends React.Component {
607
613
  }
608
614
  return btn;
609
615
  });
616
+
617
+ //to send {{unsubscribe}} to backend inside varMapped
618
+ const unsubscribeRegex = /Click {{unsubscribe}} to unsubscribe/g;
619
+ if (
620
+ languages[0].content?.match(unsubscribeRegex)?.length > 0 &&
621
+ Object.keys(varMapped)?.every(
622
+ (key) => !key?.includes("_unsubscribe")
623
+ )
624
+ ) {
625
+ varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
626
+ "{{unsubscribe}}";
627
+ }
628
+
610
629
  templateData = {
611
630
  channel,
612
631
  accountId,