@capillarytech/creatives-library 7.17.81 → 7.17.82-alpha.1

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.
Files changed (38) hide show
  1. package/containers/Cap/sagas.js +7 -5
  2. package/containers/Cap/tests/saga.test.js +81 -1
  3. package/package.json +3 -2
  4. package/services/api.js +5 -0
  5. package/services/tests/api.test.js +9 -1
  6. package/v2Components/CapWhatsappQuickReply/index.js +243 -0
  7. package/v2Components/CapWhatsappQuickReply/index.scss +43 -0
  8. package/v2Components/CapWhatsappQuickReply/messages.js +24 -0
  9. package/v2Components/TemplatePreview/_templatePreview.scss +23 -0
  10. package/v2Components/TemplatePreview/index.js +51 -1
  11. package/v2Components/TemplatePreview/messages.js +4 -0
  12. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +0 -14
  13. package/v2Containers/CreativesContainer/index.js +22 -2
  14. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +2 -0
  15. package/v2Containers/Templates/index.js +5 -2
  16. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +6 -0
  17. package/v2Containers/Whatsapp/actions.js +16 -0
  18. package/v2Containers/Whatsapp/constants.js +22 -0
  19. package/v2Containers/Whatsapp/index.js +699 -187
  20. package/v2Containers/Whatsapp/index.scss +55 -1
  21. package/v2Containers/Whatsapp/messages.js +37 -0
  22. package/v2Containers/Whatsapp/reducer.js +19 -0
  23. package/v2Containers/Whatsapp/sagas.js +40 -1
  24. package/v2Containers/Whatsapp/styles.scss +29 -0
  25. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +40962 -24255
  26. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +12 -0
  27. package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
  28. package/v2Containers/Whatsapp/tests/index.test.js +8 -0
  29. package/v2Containers/Whatsapp/tests/mockData.js +6 -0
  30. package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
  31. package/v2Containers/Whatsapp/tests/saga.test.js +90 -0
  32. package/v2Containers/Whatsapp/tests/utils.test.js +11 -0
  33. package/v2Containers/Whatsapp/utils.js +45 -3
  34. package/v2Containers/mockdata.js +105 -4
  35. package/v2Containers/InApp/constants.js +0 -0
  36. package/v2Containers/InApp/index.js +0 -499
  37. package/v2Containers/InApp/index.scss +0 -0
  38. package/v2Containers/InApp/messages.js +0 -0
@@ -411,10 +411,11 @@ export class Creatives extends React.Component {
411
411
  buttons = [],
412
412
  mediaType = 'TEXT',
413
413
  whatsappMedia = {},
414
+ isPreviewUrl = false,
414
415
  } = {},
415
416
  } = templateData;
416
417
  const mediaParams = {};
417
- const { url = '', previewUrl = '', docParams = {}} = whatsappMedia;
418
+ const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia;
418
419
  switch (mediaType) {
419
420
  case (WHATSAPP_MEDIA_TYPES.IMAGE):
420
421
  mediaParams.imageUrl = url;
@@ -462,6 +463,11 @@ export class Creatives extends React.Component {
462
463
  ...mediaParams,
463
464
  buttonType,
464
465
  buttons: modifiedButtons,
466
+ whatsappMedia: {
467
+ header: headerTemplate,
468
+ footer,
469
+ headerVarMapped,
470
+ },
465
471
  languages: [
466
472
  {
467
473
  language,
@@ -471,6 +477,7 @@ export class Creatives extends React.Component {
471
477
  : template,
472
478
  },
473
479
  ],
480
+ isPreviewUrl,
474
481
  },
475
482
  },
476
483
  },
@@ -667,6 +674,13 @@ export class Creatives extends React.Component {
667
674
  documentUrl = '',
668
675
  videoPreviewImg = '',
669
676
  whatsappDocParams = {},
677
+ whatsappMedia: {
678
+ header = '',
679
+ headerVarMapped = {},
680
+ footer = '',
681
+ headerTemplate = '',
682
+ } = {},
683
+ isPreviewUrl = false,
670
684
  } = cloneDeep(versions.base.content.whatsapp);
671
685
 
672
686
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
@@ -691,7 +705,12 @@ export class Creatives extends React.Component {
691
705
  varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
692
706
  "{{unsubscribe}}";
693
707
  }
694
- const whatsappMedia = {};
708
+ const whatsappMedia = {
709
+ header,
710
+ footer,
711
+ headerVarMapped,
712
+ headerTemplate
713
+ };
695
714
  const {
696
715
  whatsappDocName = '', whatsappDocSize, whatsappDocPages, whatsappDocImg = ''
697
716
  } = whatsappDocParams;
@@ -731,6 +750,7 @@ export class Creatives extends React.Component {
731
750
  buttons: modifiedButtons,
732
751
  mediaType,
733
752
  whatsappMedia,
753
+ isPreviewUrl,
734
754
  },
735
755
  };
736
756
  }
@@ -725,6 +725,8 @@ exports[`Test SlideBoxContent container Should render correct component for what
725
725
  "url": "https://docs.google.com/{{1}}",
726
726
  },
727
727
  ],
728
+ "templateFooterPreview": "",
729
+ "templateHeaderPreview": "",
728
730
  "templateMsg": <CapLabel
729
731
  type="label5"
730
732
  >
@@ -107,7 +107,7 @@ import {
107
107
  HOST_GUPSHUP,
108
108
  } from '../Whatsapp/constants';
109
109
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
110
- import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta } from '../Whatsapp/utils';
110
+ import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply } from '../Whatsapp/utils';
111
111
  import { getRCSContent } from '../Rcs/utils';
112
112
  import zaloMessages from '../Zalo/messages';
113
113
  import globalMessages from '../../v2Containers/Cap/messages';
@@ -1174,7 +1174,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1174
1174
  break;
1175
1175
  }
1176
1176
  case WHATSAPP: {
1177
- const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = ''} = getWhatsappContent(template);
1177
+ const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview} = getWhatsappContent(template);
1178
1178
  templateData.title = (
1179
1179
  <CapRow>
1180
1180
  <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
@@ -1205,9 +1205,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1205
1205
  : 'whatsapp-message-without-media'
1206
1206
  }`}
1207
1207
  >
1208
+ {templateHeaderPreview}
1208
1209
  {templateMsg}
1210
+ {templateFooterPreview}
1209
1211
  </span>
1210
1212
  {getWhatsappCta(template)}
1213
+ {getWhatsappQuickReply(template)}
1211
1214
  </>
1212
1215
  );
1213
1216
  break;
@@ -1389,12 +1389,14 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
1389
1389
  <span
1390
1390
  className="whatsapp-message-with-media"
1391
1391
  >
1392
+
1392
1393
  <CapLabel
1393
1394
  type="label9"
1394
1395
  >
1395
1396
  Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
1396
1397
  Click {{unsubscribe}} to unsubscribe
1397
1398
  </CapLabel>
1399
+
1398
1400
  </span>
1399
1401
  <CapLabel
1400
1402
  style={
@@ -1830,12 +1832,14 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
1830
1832
  <span
1831
1833
  className="whatsapp-message-with-media"
1832
1834
  >
1835
+
1833
1836
  <CapLabel
1834
1837
  type="label9"
1835
1838
  >
1836
1839
  Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
1837
1840
  Click {{unsubscribe}} to unsubscribe
1838
1841
  </CapLabel>
1842
+
1839
1843
  </span>
1840
1844
  <CapLabel
1841
1845
  style={
@@ -2271,12 +2275,14 @@ exports[`Test Templates container Test max templates warning 1`] = `
2271
2275
  <span
2272
2276
  className="whatsapp-message-with-media"
2273
2277
  >
2278
+
2274
2279
  <CapLabel
2275
2280
  type="label9"
2276
2281
  >
2277
2282
  Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
2278
2283
  Click {{unsubscribe}} to unsubscribe
2279
2284
  </CapLabel>
2285
+
2280
2286
  </span>
2281
2287
  <CapLabel
2282
2288
  style={
@@ -6,6 +6,8 @@ import {
6
6
  WHATSAPP,
7
7
  UPLOAD_WHATSAPP_ASSET_REQUEST,
8
8
  CLEAR_WHATSAPP_ASSET,
9
+ URL_META_TAGS_REQUEST,
10
+ URL_META_TAGS_RESET,
9
11
  } from './constants';
10
12
 
11
13
  export function createWhatsappTemplate(payload, callback, gupshupMediaFile) {
@@ -55,3 +57,17 @@ export const clearWhatsappAsset = (templateType) => ({
55
57
  type: CLEAR_WHATSAPP_ASSET,
56
58
  templateType,
57
59
  });
60
+
61
+ export function getMetaTags({previewUrl, callBack}) {
62
+ return {
63
+ type: URL_META_TAGS_REQUEST,
64
+ previewUrl,
65
+ callBack,
66
+ };
67
+ }
68
+
69
+ export function resetMetaTags() {
70
+ return {
71
+ type: URL_META_TAGS_RESET,
72
+ };
73
+ }
@@ -12,6 +12,8 @@ import messages from './messages';
12
12
  export const UNSUBSCRIBE_TEXT_LENGTH = 36;
13
13
  export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
14
14
  export const WHATSAPP = 'WHATSAPP';
15
+ export const TEMPLATE_HEADER_MAX_LENGTH = 60;
16
+ export const QUICK_REPLY_BUTTON_TEXT_MAX_LENGTH = 20;
15
17
 
16
18
  const prefix = 'app/v2Containers/Whatsapp';
17
19
  export const TEMPLATE_CREATE_REQUEST = `${prefix}/TEMPLATE_CREATE_REQUEST`;
@@ -29,6 +31,12 @@ export const UPLOAD_WHATSAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_WHATSAPP_ASSET_SU
29
31
  export const UPLOAD_WHATSAPP_ASSET_FAILURE = `${prefix}/UPLOAD_WHATSAPP_ASSET_FAILURE`;
30
32
  export const CLEAR_WHATSAPP_ASSET = `${prefix}/CLEAR_WHATSAPP_ASSET`;
31
33
 
34
+ //For meta tags
35
+ export const URL_META_TAGS_REQUEST = `${prefix}/URL_META_TAGS_REQUEST`;
36
+ export const URL_META_TAGS_SUCCESS = `${prefix}/URL_META_TAGS_SUCCESS`;
37
+ export const URL_META_TAGS_FAILURE = `${prefix}/URL_META_TAGS_FAILURE`;
38
+ export const URL_META_TAGS_RESET = `${prefix}/URL_META_TAGS_RESET`;
39
+
32
40
  export const STATUS = 'status';
33
41
  export const CATEGORY = 'category';
34
42
 
@@ -178,6 +186,10 @@ export const WHATSAPP_MEDIA_TYPES = {
178
186
  export const NONE = 'NONE';
179
187
  export const CTA = 'CTA';
180
188
  export const QUICK_REPLY = 'QUICK_REPLY';
189
+ export const HEADER_TEXT = 'header';
190
+ export const FOOTER_TEXT = 'footer';
191
+ export const MESSAGE_TEXT = 'message';
192
+ export const BUTTON_TEXT = 'buttonText'
181
193
  export const WHATSAPP_BUTTON_TYPES = {
182
194
  NONE,
183
195
  CTA,
@@ -197,6 +209,16 @@ export const INITIAL_CTA_DATA = [
197
209
  },
198
210
  ];
199
211
 
212
+ export const INITIAL_QUICK_REPLY_DATA = [
213
+ {
214
+ index: 0,
215
+ text: "",
216
+ type: "QUICK_REPLY",
217
+ isSaved: false,
218
+ error: "",
219
+ },
220
+ ];
221
+
200
222
  export const ALLOWED_IMAGE_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
201
223
  export const ALLOWED_EXTENSIONS_VIDEO_REGEX = (/\.(mp4)$/i);
202
224
  export const ALLOWED_EXTENSIONS_DOCUMENT_REGEX = (/\.(pdf)$/i);