@capillarytech/creatives-library 8.0.87-alpha.18 → 8.0.87-alpha.2

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 (41) hide show
  1. package/initialState.js +0 -1
  2. package/package.json +1 -1
  3. package/services/api.js +7 -6
  4. package/v2Components/CapWhatsappCTA/messages.js +4 -0
  5. package/v2Components/CapWhatsappCarouselButton/constant.js +51 -0
  6. package/v2Components/CapWhatsappCarouselButton/index.js +446 -0
  7. package/v2Components/CapWhatsappCarouselButton/index.scss +39 -0
  8. package/v2Components/FormBuilder/index.js +3 -7
  9. package/v2Components/TemplatePreview/_templatePreview.scss +9 -0
  10. package/v2Components/TemplatePreview/assets/images/empty_image_preview.svg +4 -0
  11. package/v2Components/TemplatePreview/assets/images/empty_video_preview.svg +4 -0
  12. package/v2Components/TemplatePreview/index.js +169 -104
  13. package/v2Containers/Cap/actions.js +0 -8
  14. package/v2Containers/Cap/constants.js +0 -4
  15. package/v2Containers/Cap/reducer.js +0 -6
  16. package/v2Containers/Cap/sagas.js +0 -23
  17. package/v2Containers/Cap/selectors.js +0 -6
  18. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  19. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -11
  20. package/v2Containers/CreativesContainer/constants.js +0 -3
  21. package/v2Containers/CreativesContainer/index.js +88 -78
  22. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -25
  23. package/v2Containers/CreativesContainer/tests/index.test.js +0 -2
  24. package/v2Containers/Email/index.js +0 -1
  25. package/v2Containers/EmailWrapper/index.js +0 -2
  26. package/v2Containers/MobilePush/Create/index.js +0 -1
  27. package/v2Containers/MobilePush/Edit/index.js +0 -1
  28. package/v2Containers/MobilepushWrapper/index.js +1 -2
  29. package/v2Containers/Sms/Create/index.js +0 -1
  30. package/v2Containers/Sms/Edit/index.js +0 -1
  31. package/v2Containers/SmsWrapper/index.js +0 -2
  32. package/v2Containers/Templates/_templates.scss +35 -0
  33. package/v2Containers/Templates/index.js +64 -5
  34. package/v2Containers/TemplatesV2/index.js +0 -7
  35. package/v2Containers/Whatsapp/constants.js +83 -1
  36. package/v2Containers/Whatsapp/index.js +709 -182
  37. package/v2Containers/Whatsapp/index.scss +52 -1
  38. package/v2Containers/Whatsapp/messages.js +38 -2
  39. package/v2Containers/Whatsapp/utils.js +34 -0
  40. package/v2Containers/mockdata.js +0 -3
  41. package/utils/transformerUtils.js +0 -524
@@ -58,11 +58,7 @@ import {
58
58
  CAP_SPACE_32, CAP_SPACE_56, CAP_SPACE_64,
59
59
  } from '@capillarytech/cap-ui-library/styled/variables';
60
60
  import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
61
-
62
- import {
63
- transformChannelPayload,
64
- // getTemplateDiffState
65
- } from "../../utils/transformerUtils";
61
+ import { DYNAMIC_URL } from '../../v2Components/CapWhatsappCTA/constants';
66
62
 
67
63
  const classPrefix = 'add-creatives-section';
68
64
  const CREATIVES_CONTAINER = 'creativesContainer';
@@ -93,7 +89,6 @@ export class Creatives extends React.Component {
93
89
  weChatMaptemplateStep: 0,
94
90
  isLiquidValidationError: false,
95
91
  errorMessages: [],
96
- metaId: null,
97
92
  };
98
93
  this.creativesTemplateSteps = {
99
94
  1: 'modeSelection',
@@ -235,6 +230,39 @@ export class Creatives extends React.Component {
235
230
  this.setState({ isGetFormData: false });
236
231
  };
237
232
 
233
+ mapCarouselDataToCreatives = (cards) => {
234
+ return cards.map((card) => {
235
+ const { cardVarMapped, cardTemplate, media, buttons, mediaType } = card || {};
236
+ const buttonData = buttons?.map((button) => {
237
+ const { type, text, phoneNumber, url, dynamicUrlPayload } = button;
238
+ const buttonObj = { type, text };
239
+ if (type === "PHONE_NUMBER") {
240
+ buttonObj.phone_number = phoneNumber;
241
+ }
242
+ if (type === "URL") {
243
+ buttonObj.url = url;
244
+ if (dynamicUrlPayload) {
245
+ buttonObj.urlType = DYNAMIC_URL;
246
+ }
247
+ }
248
+ return buttonObj;
249
+ });
250
+ return {
251
+ bodyText: cardTemplate,
252
+ varMap: cardVarMapped,
253
+ ...(mediaType === "IMAGE" && {
254
+ imageUrl: media?.url,
255
+ }),
256
+ ...(mediaType === "VIDEO" && {
257
+ videoUrl: media?.url,
258
+ videoPreviewImg: media?.previewUrl,
259
+ }),
260
+ buttons: buttonData,
261
+ mediaType: mediaType?.toLowerCase(),
262
+ };
263
+ });
264
+ }
265
+
238
266
  getTemplateData = (templateData) => { //from consumers to creatives
239
267
  const { isFullMode, messageDetails = {}, smsRegister } = this.props;
240
268
  const { additionalProperties = {} } = messageDetails;
@@ -462,8 +490,7 @@ export class Creatives extends React.Component {
462
490
  };
463
491
  break;
464
492
  }
465
- case constants.WHATSAPP:
466
- case constants.WHATSAPP?.toLowerCase(): {
493
+ case constants.WHATSAPP: {
467
494
  const {
468
495
  messageBody = '',
469
496
  templateConfigs: {
@@ -477,6 +504,7 @@ export class Creatives extends React.Component {
477
504
  mediaType = 'TEXT',
478
505
  whatsappMedia = {},
479
506
  isPreviewUrl = false,
507
+ cards = [],
480
508
  } = {},
481
509
  } = templateData;
482
510
  const mediaParams = {};
@@ -543,6 +571,7 @@ export class Creatives extends React.Component {
543
571
  },
544
572
  ],
545
573
  isPreviewUrl,
574
+ carouselData: this.mapCarouselDataToCreatives(cards),
546
575
  },
547
576
  },
548
577
  },
@@ -589,6 +618,47 @@ export class Creatives extends React.Component {
589
618
  return templateData || null;
590
619
  }
591
620
 
621
+ getCarouselMappedData = (carouselData = []) => {
622
+ return carouselData.map((carousel) => {
623
+ const { bodyText, imageUrl, videoUrl, videoPreviewImg, buttons, mediaType, cardVarMapped, cardTemplate } = carousel || {};
624
+ const buttonData = buttons.map((button, index) => {
625
+ const { type, text, phone_number, urlType, url } = button;
626
+ const buttonObj = {
627
+ type,
628
+ text,
629
+ index,
630
+ };
631
+ if (type === 'PHONE_NUMBER') {
632
+ buttonObj.phoneNumber = phone_number;
633
+ }
634
+ if (type === 'URL') {
635
+ buttonObj.url = url;
636
+ if (urlType === "DYNAMIC_URL") {
637
+ const dynamicUrlPayload = url.match(/{{(.*?)}}/g);
638
+ buttonObj.dynamicUrlPayload = dynamicUrlPayload.length === 1 ? dynamicUrlPayload[0] : '';
639
+ }
640
+ }
641
+ return buttonObj;
642
+ });
643
+ return {
644
+ body: bodyText,
645
+ cardVarMapped,
646
+ cardTemplate,
647
+ media: {
648
+ ...(mediaType === 'image' && {
649
+ url: imageUrl,
650
+ }),
651
+ ...(mediaType === 'video' && {
652
+ url: videoUrl,
653
+ previewUrl: videoPreviewImg,
654
+ }),
655
+ },
656
+ buttons: buttonData,
657
+ mediaType: mediaType?.toUpperCase(),
658
+ };
659
+ });
660
+ };
661
+
592
662
  getCreativesData = async (channel, template, templateRecords) => { //from creatives to consumers
593
663
  let templateData = { channel };
594
664
  switch (channel) {
@@ -761,6 +831,7 @@ export class Creatives extends React.Component {
761
831
  headerTemplate = '',
762
832
  } = {},
763
833
  isPreviewUrl = false,
834
+ carouselData= [],
764
835
  } = cloneDeep(versions.base.content.whatsapp);
765
836
 
766
837
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
@@ -827,10 +898,15 @@ export class Creatives extends React.Component {
827
898
  varMapped,
828
899
  category,
829
900
  language: languages[0].language,
830
- buttonType,
831
- buttons: modifiedButtons,
901
+ ...(mediaType !== WHATSAPP_MEDIA_TYPES.CAROUSEL && {
902
+ buttonType,
903
+ buttons: modifiedButtons,
904
+ whatsappMedia,
905
+ }),
906
+ ...(mediaType === WHATSAPP_MEDIA_TYPES.CAROUSEL && {
907
+ cards: this.getCarouselMappedData(carouselData),
908
+ }),
832
909
  mediaType,
833
- whatsappMedia,
834
910
  isPreviewUrl,
835
911
  },
836
912
  };
@@ -1023,75 +1099,11 @@ export class Creatives extends React.Component {
1023
1099
  const creativesData = this.getCreativesData(channel, template, templateData);// convers data to consumer understandable format
1024
1100
  creativesData.then((data) => {
1025
1101
  this.logGTMEvent(channel, data);
1026
- this.processCentralCommsMetaId(channel, data);
1102
+ this.props.getCreativesData(data);// send data to consumer
1027
1103
  });
1028
1104
  },
1029
1105
  );
1030
1106
  }
1031
- }
1032
-
1033
- processCentralCommsMetaId = (channel, creativesData) => {
1034
- // Create the payload for the centralcommnsmetaId API call
1035
- const { isLoyaltyModule, loyaltyMetaData } = this.props;
1036
- const { actionName, setMetaId = () => {} } = this.props.loyaltyMetaData || {};
1037
- const { formatMessage } = this.props.intl;
1038
-
1039
- // const isTemplateModified = getTemplateDiffState(
1040
- // channel,
1041
- // loyaltyMetaData,
1042
- // creativesData
1043
- // );
1044
- if (
1045
- loyaltyMetaData
1046
- && isLoyaltyModule
1047
- // && isTemplateModified
1048
- && actionName === constants.LOYALTY_SUPPORTED_ACTION
1049
- ) {
1050
- const payload = transformChannelPayload(creativesData, {
1051
- channel,
1052
- loyaltyMetaData,
1053
- });
1054
-
1055
- // Callback function to handle API response
1056
- const handleMetaIDResult = (result) => {
1057
- if (result?.status?.code === 200) {
1058
- setMetaId(result?.response?.data?.id);
1059
- this.props.getCreativesData(creativesData);
1060
- } else {
1061
- this.setState(
1062
- (prevState) => ({
1063
- liquidErrorMessage: {
1064
- ...prevState.liquidErrorMessage,
1065
- STANDARD_ERROR_MSG:
1066
- result?.errors?.length > 0
1067
- ? [
1068
- ...(prevState.liquidErrorMessage
1069
- ?.STANDARD_ERROR_MSG || []),
1070
- formatMessage(messages.emailBodyEmptyError)
1071
- ]
1072
- : prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
1073
- LIQUID_ERROR_MSG: result?.errors?.map(
1074
- (error) => error?.message
1075
- ) ?? [formatMessage(messages.somethingWentWrong)]
1076
- }
1077
- }),
1078
- () => {
1079
- this.showLiquidErrorInFooter(
1080
- this.state.liquidErrorMessage
1081
- );
1082
- }
1083
- );
1084
- this.props.stopValidation();
1085
- return;
1086
- }
1087
- };
1088
-
1089
- // Call the action to create central comms meta ID
1090
- this.props.globalActions.createCentralCommsMetaId(payload, handleMetaIDResult);
1091
- } else {
1092
- // If not a loyalty module or different action, should work as usual
1093
- this.props.getCreativesData(creativesData);
1094
- }
1095
1107
  };
1096
1108
 
1097
1109
  setIsLoadingContent = (isLoadingContent) => {
@@ -1343,7 +1355,6 @@ export class Creatives extends React.Component {
1343
1355
  enableNewChannels,
1344
1356
  eventContextTags,
1345
1357
  isLoyaltyModule,
1346
- loyaltyMetaData = {},
1347
1358
  } = this.props;
1348
1359
  const mapTemplateCreate =
1349
1360
  slidBoxContent === "createTemplate" &&
@@ -1449,7 +1460,6 @@ export class Creatives extends React.Component {
1449
1460
  hostName={this.props?.hostName || ''}
1450
1461
  eventContextTags={eventContextTags}
1451
1462
  isLoyaltyModule={isLoyaltyModule}
1452
- loyaltyMetaData={loyaltyMetaData}
1453
1463
  />
1454
1464
  )}
1455
1465
  footer={this.shouldShowFooter() && (
@@ -15,11 +15,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
15
15
  getFormData={[Function]}
16
16
  handleClose={[Function]}
17
17
  hostName=""
18
- loyaltyMetaData={
19
- Object {
20
- "actionName": "SEND_COMMUNICATION_ACTION",
21
- }
22
- }
23
18
  onCallTaskSubmit={[Function]}
24
19
  onChannelChange={[Function]}
25
20
  onCreateComplete={[MockFunction]}
@@ -97,11 +92,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
97
92
  getFormData={[Function]}
98
93
  handleClose={[Function]}
99
94
  hostName=""
100
- loyaltyMetaData={
101
- Object {
102
- "actionName": "SEND_COMMUNICATION_ACTION",
103
- }
104
- }
105
95
  onCallTaskSubmit={[Function]}
106
96
  onChannelChange={[Function]}
107
97
  onCreateComplete={[MockFunction]}
@@ -179,11 +169,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
179
169
  getFormData={[Function]}
180
170
  handleClose={[Function]}
181
171
  hostName=""
182
- loyaltyMetaData={
183
- Object {
184
- "actionName": "SEND_COMMUNICATION_ACTION",
185
- }
186
- }
187
172
  onCallTaskSubmit={[Function]}
188
173
  onChannelChange={[Function]}
189
174
  onCreateComplete={[MockFunction]}
@@ -265,11 +250,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
265
250
  getFormData={[Function]}
266
251
  handleClose={[Function]}
267
252
  hostName=""
268
- loyaltyMetaData={
269
- Object {
270
- "actionName": "SEND_COMMUNICATION_ACTION",
271
- }
272
- }
273
253
  onCallTaskSubmit={[Function]}
274
254
  onChannelChange={[Function]}
275
255
  onCreateComplete={[MockFunction]}
@@ -351,11 +331,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
351
331
  getFormData={[Function]}
352
332
  handleClose={[Function]}
353
333
  hostName=""
354
- loyaltyMetaData={
355
- Object {
356
- "actionName": "SEND_COMMUNICATION_ACTION",
357
- }
358
- }
359
334
  onCallTaskSubmit={[Function]}
360
335
  onChannelChange={[Function]}
361
336
  onCreateComplete={[MockFunction]}
@@ -16,7 +16,6 @@ const {
16
16
  smsTemplates,
17
17
  emailEditTemplateData,
18
18
  emailTemplates,
19
- loyaltyMetaData,
20
19
  } = mockdata;
21
20
 
22
21
  jest.mock('../../../v2Components/FormBuilder', () => ({
@@ -41,7 +40,6 @@ describe('Test SlideBoxContent container', () => {
41
40
  const renderFunction = (channel, mode, templates, templateData) => {
42
41
  renderedComponent = shallowWithIntl(
43
42
  <Creatives
44
- loyaltyMetaData={loyaltyMetaData}
45
43
  Templates={templates}
46
44
  channel={channel}
47
45
  slidBoxContent={mode}
@@ -2747,7 +2747,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2747
2747
  eventContextTags={this.props?.eventContextTags}
2748
2748
  forwardedTags={this.props?.forwardedTags}
2749
2749
  isLoyaltyModule={this.props?.isLoyaltyModule}
2750
- messageDetails={this.props?.messageDetails}
2751
2750
  /> : ''}
2752
2751
  </Col>
2753
2752
  </Row>
@@ -229,7 +229,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
229
229
  eventContextTags,
230
230
  // Flag to enable loyalty module specific features in the email editor
231
231
  isLoyaltyModule,
232
- messageDetails = {},
233
232
  } = this.props;
234
233
  const {
235
234
  templateName,
@@ -304,7 +303,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
304
303
  moduleType={moduleType}
305
304
  eventContextTags={eventContextTags}
306
305
  isLoyaltyModule={isLoyaltyModule}
307
- messageDetails={messageDetails}
308
306
  />}
309
307
  {!isShowEmailCreate && (
310
308
  <CmsTemplatesComponent
@@ -1809,7 +1809,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1809
1809
  hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
1810
1810
  isFullMode={this.props.isFullMode}
1811
1811
  eventContextTags={this.props?.eventContextTags}
1812
- messageDetails={this.props?.messageDetails}
1813
1812
  />
1814
1813
  </CapColumn>
1815
1814
  {this.props.iosCtasData && this.state.showIosCtaTable &&
@@ -1991,7 +1991,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1991
1991
  hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
1992
1992
  isFullMode={this.props.isFullMode}
1993
1993
  eventContextTags={this.props?.eventContextTags}
1994
- messageDetails={this.props?.messageDetails}
1995
1994
  />}
1996
1995
  </CapColumn>
1997
1996
  {this.props.iosCtasData && this.state.showIosCtaTable &&
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
72
72
  }
73
73
 
74
74
  render() {
75
- const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], messageDetails = {}} = this.props;
75
+ const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = []} = this.props;
76
76
  const {templateName} = this.state;
77
77
  const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
78
78
  return (
@@ -120,7 +120,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
120
120
  templateData={templateData}
121
121
  hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
122
122
  eventContextTags={eventContextTags}
123
- messageDetails={messageDetails}
124
123
  />
125
124
 
126
125
 
@@ -994,7 +994,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
994
994
  onTestContentClicked={this.props.onTestContentClicked}
995
995
  onPreviewContentClicked={this.props.onPreviewContentClicked}
996
996
  eventContextTags={this.props?.eventContextTags}
997
- messageDetails={this.props?.messageDetails}
998
997
  />
999
998
  </CapColumn>
1000
999
  </CapRow>
@@ -992,7 +992,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
992
992
  onPreviewContentClicked={this.props.onPreviewContentClicked}
993
993
  onTestContentClicked={this.props.onTestContentClicked}
994
994
  eventContextTags={this.props?.eventContextTags}
995
- messageDetails={this.props?.messageDetails}
996
995
  />
997
996
  </CapColumn>
998
997
  </CapRow>
@@ -30,7 +30,6 @@ const SmsWrapper = (props) => {
30
30
  smsRegister,
31
31
  onShowTemplates,
32
32
  eventContextTags,
33
- messageDetails = {},
34
33
  } = props;
35
34
 
36
35
  const smsProps = {
@@ -47,7 +46,6 @@ const SmsWrapper = (props) => {
47
46
  onPreviewContentClicked,
48
47
  onTestContentClicked,
49
48
  eventContextTags,
50
- messageDetails,
51
49
  };
52
50
  const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
53
51
  return <>
@@ -172,6 +172,41 @@
172
172
  }
173
173
 
174
174
  }
175
+
176
+ .WHATSAPP {
177
+ .cap-custom-card {
178
+ .ant-card-body {
179
+ .ant-card-meta {
180
+ background-color: #f4f5f7;
181
+ padding: 0;
182
+ .ant-card-meta-description {
183
+ .whatsapp-container {
184
+ background-color: #FFFFFF;
185
+ padding: 0.857rem;
186
+ }
187
+ .whatsapp-carousel-container {
188
+ padding: 4px 0px 0.571rem;
189
+ border-radius: 6px;
190
+ background-color: rgb(255, 255, 255);
191
+ width: 80%;
192
+ flex-shrink: 0;
193
+ margin-right: 4px;
194
+ white-space: pre-wrap;
195
+ word-break: break-word;
196
+ overflow: auto;
197
+ text-align: left;
198
+ .whatsapp-carosuel-card {
199
+ margin: 2px 6px 1px 7px;
200
+ .whatsapp-carousel-body {
201
+ margin-bottom: 0.571rem;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
175
210
  }
176
211
 
177
212
  .create-new-link{
@@ -116,7 +116,7 @@ import {
116
116
  } from '../Whatsapp/constants';
117
117
  import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
118
118
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
119
- import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill } from '../Whatsapp/utils';
119
+ import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill, getWhatsappCarouselButtonView } from '../Whatsapp/utils';
120
120
  import { getRCSContent } from '../Rcs/utils';
121
121
  import zaloMessages from '../Zalo/messages';
122
122
  import globalMessages from '../../v2Containers/Cap/messages';
@@ -134,7 +134,8 @@ import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAc
134
134
  import rcsIllustration from '../Assets/images/rcsIllustration.png';
135
135
  import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
136
136
  import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
137
-
137
+ import whatsappImageEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_image_preview.svg';
138
+ import whatsappVideoEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_video_preview.svg';
138
139
  import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
139
140
  import { GA } from '@capillarytech/cap-ui-utils';
140
141
  import { MAPP_SDK } from '../InApp/constants';
@@ -1110,8 +1111,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1110
1111
  ? this.getCreativesEditText(channelLowerCase)
1111
1112
  : messages.selectButton
1112
1113
  );
1113
-
1114
- const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
1114
+ const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
1115
1115
  const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
1116
1116
  const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
1117
1117
  const inappBodyType = androidBodyType || iosBodyType;
@@ -1366,7 +1366,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1366
1366
  break;
1367
1367
  }
1368
1368
  case WHATSAPP: {
1369
- const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview} = getWhatsappContent(template);
1369
+ const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview, carouselData = [] } = getWhatsappContent(template);
1370
1370
  templateData.title = (
1371
1371
  <CapRow>
1372
1372
  <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
@@ -1375,6 +1375,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1375
1375
  );
1376
1376
  templateData.content = (
1377
1377
  <>
1378
+ <div className='whatsapp-container'>
1378
1379
  {whatsappImageSrc && (
1379
1380
  <CapImage src={whatsappImageSrc} className="whatsapp-image" />
1380
1381
  )}
@@ -1404,6 +1405,64 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1404
1405
  {getWhatsappCta(template)}
1405
1406
  {getWhatsappQuickReply(template)}
1406
1407
  {getWhatsappAutoFill(template)}
1408
+ </div>
1409
+ <div
1410
+ style={{
1411
+ overflowX: "auto",
1412
+ display: "flex",
1413
+ paddingTop: "5px",
1414
+ paddingRight: "5px",
1415
+ whiteSpace: "nowrap",
1416
+ scrollbarWidth: "none", // Hide scrollbar in Firefox
1417
+ msOverflowStyle: "none", // Hide scrollbar in IE/Edge
1418
+ overflow: "hidden",
1419
+ }}
1420
+ className="scroll-container"
1421
+ >
1422
+ {carouselData.map((data, index) => {
1423
+ return (
1424
+ <div
1425
+ key={`carousel-${index}`}
1426
+ className="whatsapp-carousel-container"
1427
+ >
1428
+ <div className="whatsapp-carosuel-card">
1429
+ {data?.mediaType === "image" && (
1430
+ <CapImage
1431
+ src={data?.imageUrl ? data?.imageUrl : whatsappImageEmptyPreview}
1432
+ className="whatsapp-image"
1433
+ />
1434
+ )}
1435
+ {data?.mediaType === "video" && (
1436
+ <div className="video-preview">
1437
+ <CapImage
1438
+ src={data?.videoPreviewImg ? data?.videoPreviewImg : whatsappVideoEmptyPreview}
1439
+ className="whatsapp-image"
1440
+ />
1441
+ <div className="icon-position">
1442
+ <CapImage
1443
+ className="video-icon"
1444
+ src={videoPlay}
1445
+ />
1446
+ </div>
1447
+ </div>
1448
+ )}
1449
+ <span
1450
+ className={`${
1451
+ (data?.imageUrl || data?.videoPreviewImg)
1452
+ ? 'whatsapp-message-with-media'
1453
+ : 'whatsapp-message-without-media'
1454
+ }`}
1455
+ >
1456
+ <CapLabel type="label9" className='whatsapp-carousel-body'>
1457
+ {data?.bodyText}
1458
+ </CapLabel>
1459
+ </span>
1460
+ {getWhatsappCarouselButtonView(data?.buttons, false)}
1461
+ </div>
1462
+ </div>
1463
+ )
1464
+ })}
1465
+ </div>
1407
1466
  </>
1408
1467
  );
1409
1468
  break;
@@ -56,8 +56,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
56
56
  enableNewChannels = [],
57
57
  currentOrgDetails = {},
58
58
  cap = {},
59
- loyaltyMetaData = {},
60
- isLoyaltyModule = false,
61
59
  } = props;
62
60
 
63
61
  const defaultPanes = {
@@ -100,11 +98,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
100
98
  }
101
99
  const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
102
100
 
103
- const { actionName = ''} = loyaltyMetaData;
104
- if (isLoyaltyModule && actionName === 'SEND_COMMUNICATION_ACTION') {
105
- commonChannels.push('whatsapp', 'zalo');
106
- }
107
-
108
101
  // we only show channels which other than commonChannels
109
102
  // if it is coming in enableNewChannels array
110
103
  filteredPanes = filteredPanes.filter((item) => {